22
33import { createElement , useCallback , useEffect , useMemo , useRef , useState } from 'react' ;
44import { createPortal } from 'react-dom' ;
5- import PropTypes from 'prop-types' ;
65import makeEventProps from 'make-event-props' ;
76import clsx from 'clsx' ;
87import Calendar from 'react-calendar' ;
98import Fit from 'react-fit' ;
109
1110import DateInput from 'react-date-picker/dist/esm/DateInput' ;
1211
13- import { isMaxDate , isMinDate , rangeOf } from './shared/propTypes.js' ;
14-
15- import type { ReactNodeArray } from 'prop-types' ;
1612import type {
1713 ClassName ,
1814 CloseReason ,
@@ -22,11 +18,8 @@ import type {
2218 Value ,
2319} from './shared/types.js' ;
2420
25- const isBrowser = typeof document !== 'undefined' ;
26-
2721const baseClassName = 'react-daterange-picker' ;
2822const outsideActionEvents = [ 'mousedown' , 'focusin' , 'touchstart' ] as const ;
29- const allViews = [ 'century' , 'decade' , 'year' , 'month' ] as const ;
3023
3124const iconProps = {
3225 xmlns : 'http://www.w3.org/2000/svg' ,
@@ -58,7 +51,9 @@ const ClearIcon = (
5851 </ svg >
5952) ;
6053
61- type Icon = React . ReactElement | ReactNodeArray | null | string | number | boolean ;
54+ type ReactNodeLike = React . ReactNode | string | number | boolean | null | undefined ;
55+
56+ type Icon = ReactNodeLike | ReactNodeLike [ ] ;
6257
6358type IconOrRenderFunction = Icon | React . ComponentType | React . ReactElement ;
6459
@@ -686,50 +681,4 @@ const DateRangePicker: React.FC<DateRangePickerProps> = function DateRangePicker
686681 ) ;
687682} ;
688683
689- const isValue = PropTypes . oneOfType ( [ PropTypes . string , PropTypes . instanceOf ( Date ) ] ) ;
690-
691- const isValueOrValueArray = PropTypes . oneOfType ( [ isValue , rangeOf ( isValue ) ] ) ;
692-
693- DateRangePicker . propTypes = {
694- autoFocus : PropTypes . bool ,
695- calendarAriaLabel : PropTypes . string ,
696- calendarClassName : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . arrayOf ( PropTypes . string ) ] ) ,
697- calendarIcon : PropTypes . oneOfType ( [ PropTypes . node , PropTypes . func ] ) ,
698- className : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . arrayOf ( PropTypes . string ) ] ) ,
699- clearAriaLabel : PropTypes . string ,
700- clearIcon : PropTypes . oneOfType ( [ PropTypes . node , PropTypes . func ] ) ,
701- closeCalendar : PropTypes . bool ,
702- 'data-testid' : PropTypes . string ,
703- dayAriaLabel : PropTypes . string ,
704- dayPlaceholder : PropTypes . string ,
705- disableCalendar : PropTypes . bool ,
706- disabled : PropTypes . bool ,
707- format : PropTypes . string ,
708- id : PropTypes . string ,
709- isOpen : PropTypes . bool ,
710- locale : PropTypes . string ,
711- maxDate : isMaxDate ,
712- maxDetail : PropTypes . oneOf ( allViews ) ,
713- minDate : isMinDate ,
714- monthAriaLabel : PropTypes . string ,
715- monthPlaceholder : PropTypes . string ,
716- name : PropTypes . string ,
717- nativeInputAriaLabel : PropTypes . string ,
718- onCalendarClose : PropTypes . func ,
719- onCalendarOpen : PropTypes . func ,
720- onChange : PropTypes . func ,
721- onFocus : PropTypes . func ,
722- openCalendarOnFocus : PropTypes . bool ,
723- rangeDivider : PropTypes . node ,
724- required : PropTypes . bool ,
725- showLeadingZeros : PropTypes . bool ,
726- value : isValueOrValueArray ,
727- yearAriaLabel : PropTypes . string ,
728- yearPlaceholder : PropTypes . string ,
729- } ;
730-
731- if ( isBrowser ) {
732- DateRangePicker . propTypes . portalContainer = PropTypes . instanceOf ( HTMLElement ) ;
733- }
734-
735684export default DateRangePicker ;
0 commit comments