1
- import 'jb-date-input' ;
2
- import React from 'react' ;
1
+ import React , { useEffect } from 'react' ;
3
2
import { FormalTheme , SamplesSectionWrapper , SamplesTitle } from './styled' ;
4
3
import dynamic from 'next/dynamic' ;
5
4
// eslint-disable-next-line no-duplicate-imports
6
- import { InputTypes , JBDateInputValueObject } from 'jb-date-input' ;
7
- const JBDateInput = dynamic ( ( ) => import ( 'jb-date-input-react' ) . then ( module => module . default ) , {
5
+ // import {JBDateInputValueObject } from 'jb-date-input-react';
6
+ // import {InputTypes as JBDateInputInputTypes} from 'jb-date-input/dist/web-component/jb-date-input/lib/Types';
7
+ enum InputTypes {
8
+ jalali = 'JALALI' ,
9
+ gregorian = 'GREGORIAN'
10
+ }
11
+ const JBDateInput = dynamic ( ( ) => import ( 'jb-date-input-react' ) . then ( module => module . JBDateInput ) , {
8
12
ssr : false ,
9
13
} ) ;
10
14
const validationList = [
@@ -13,7 +17,7 @@ const validationList = [
13
17
message : 'تاریخ باید تنها در قرن 13 شمسی باشد'
14
18
} ,
15
19
{
16
- validator : ( inputedText : string , valueObject : JBDateInputValueObject , valueText : string ) => {
20
+ validator : ( inputedText : string , valueObject : any , valueText : string ) => {
17
21
//you can use raw inputed text or formatted text in expected value in argumants
18
22
//you have access to both jalali and gregorian date object here in valueObject
19
23
// remember valueObject and valueText are both empty and null when date is incomplete
@@ -29,13 +33,13 @@ function Samples() {
29
33
< SamplesTitle >
30
34
Samples
31
35
</ SamplesTitle >
32
- < JBDateInput label = "simple date:" > { } </ JBDateInput >
33
- < JBDateInput label = "with persian number" usePersianNumber = { true } > { } </ JBDateInput >
34
- < JBDateInput label = "with default value:" value = "2020-08-10T08:51:23.176Z" > { } </ JBDateInput >
35
- < JBDateInput label = "with min and max value:" value = "2020-08-10T08:51:23.176Z" min = "2020-08-05T08:51:23.176Z" max = "2020-08-15T08:51:23.176Z" > { } </ JBDateInput >
36
- < JBDateInput label = "with validation" validationList = { validationList } > { } </ JBDateInput >
37
- < JBDateInput label = "gregorian date:" inputType = "GREGORIAN" > { } </ JBDateInput >
38
- < JBDateInput label = "with default opened calendar date" inputType = "JALALI" calendarDefaultDateView = { { year : 1350 , month : 3 , dateType :InputTypes . jalali } } > { } </ JBDateInput >
36
+ < JBDateInput label = "simple date:" > { } </ JBDateInput >
37
+ < JBDateInput label = "with persian number" usePersianNumber = { true } > { } </ JBDateInput >
38
+ < JBDateInput label = "with default value:" value = "2020-08-10T08:51:23.176Z" > { } </ JBDateInput >
39
+ < JBDateInput label = "with min and max value:" value = "2020-08-10T08:51:23.176Z" min = "2020-08-05T08:51:23.176Z" max = "2020-08-15T08:51:23.176Z" > { } </ JBDateInput >
40
+ < JBDateInput label = "with validation" validationList = { validationList } > { } </ JBDateInput >
41
+ < JBDateInput label = "gregorian date:" inputType = "GREGORIAN" > { } </ JBDateInput >
42
+ < JBDateInput label = "with default opened calendar date" inputType = "JALALI" calendarDefaultDateView = { { year : 1350 , month : 3 , dateType : InputTypes . jalali } } > { } </ JBDateInput >
39
43
< JBDateInput label = "with custom icon" >
40
44
< div slot = "calendar-trigger-icon" >
41
45
< svg xmlns = "http://www.w3.org/2000/svg" version = "1.1" x = "0px" y = "0px" viewBox = "0 0 610.398 610.398" >
@@ -65,7 +69,7 @@ function Samples() {
65
69
< div > before</ div >
66
70
</ jb-date-input-inbox-element >
67
71
</ JBDateInput >
68
- < FormalTheme label = "more formal look" > { } </ FormalTheme >
72
+ < FormalTheme label = "more formal look" > { } </ FormalTheme >
69
73
70
74
</ SamplesSectionWrapper >
71
75
) ;
0 commit comments