@@ -13,44 +13,47 @@ import { Period, DatepickerType, ColorKeys } from "../types";
1313
1414import { Arrow , VerticalDash } from "./utils" ;
1515
16- const Datepicker : React . FC < DatepickerType > = ( {
17- primaryColor = "blue" ,
18- value = null ,
19- onChange,
20- useRange = true ,
21- showFooter = false ,
22- showShortcuts = false ,
23- configs = undefined ,
24- asSingle = false ,
25- placeholder = null ,
26- separator = "~" ,
27- startFrom = null ,
28- i18n = LANGUAGE ,
29- disabled = false ,
30- inputClassName = null ,
31- containerClassName = null ,
32- popupClassName = null ,
33- toggleClassName = null ,
34- toggleIcon = undefined ,
35- displayFormat = DATE_FORMAT ,
36- readOnly = false ,
37- minDate = null ,
38- maxDate = null ,
39- dateLooking = "forward" ,
40- disabledDates = null ,
41- inputId,
42- inputName,
43- startWeekOn = "sun" ,
44- classNames = undefined ,
45- popoverDirection = undefined ,
46- required = false
47- } ) => {
48- // Ref
16+ const Datepicker = ( props : DatepickerType ) => {
17+ // Props
18+ const {
19+ primaryColor = "blue" ,
20+ value = null ,
21+ onChange,
22+ useRange = true ,
23+ showFooter = false ,
24+ showShortcuts = false ,
25+ configs = undefined ,
26+ asSingle = false ,
27+ placeholder = null ,
28+ separator = "~" ,
29+ startFrom = null ,
30+ i18n = LANGUAGE ,
31+ disabled = false ,
32+ inputClassName = null ,
33+ containerClassName = null ,
34+ toggleClassName = null ,
35+ popupClassName = null ,
36+ toggleIcon = undefined ,
37+ displayFormat = DATE_FORMAT ,
38+ readOnly = false ,
39+ minDate = null ,
40+ maxDate = null ,
41+ dateLooking = "forward" ,
42+ disabledDates = null ,
43+ inputId,
44+ inputName,
45+ startWeekOn = "sun" ,
46+ classNames = undefined ,
47+ popoverDirection = undefined ,
48+ required = false
49+ } = props ;
50+
51+ // Refs
4952 const containerRef = useRef < HTMLDivElement | null > ( null ) ;
5053 const calendarContainerRef = useRef < HTMLDivElement | null > ( null ) ;
5154 const arrowRef = useRef < HTMLDivElement | null > ( null ) ;
5255
53- // State
56+ // States
5457 const [ firstDate , setFirstDate ] = useState < dayjs . Dayjs > (
5558 startFrom && dayjs ( startFrom ) . isValid ( ) ? dayjs ( startFrom ) : dayjs ( )
5659 ) ;
@@ -246,6 +249,7 @@ const Datepicker: React.FC<DatepickerType> = ({
246249 }
247250 return DEFAULT_COLOR ;
248251 } , [ primaryColor ] ) ;
252+
249253 const contextValues = useMemo ( ( ) => {
250254 return {
251255 asSingle,
@@ -318,8 +322,8 @@ const Datepicker: React.FC<DatepickerType> = ({
318322 classNames ,
319323 inputRef ,
320324 popoverDirection ,
321- firstGotoDate ,
322- required
325+ required ,
326+ firstGotoDate
323327 ] ) ;
324328
325329 const containerClassNameOverload = useMemo ( ( ) => {
0 commit comments