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 Clock from 'react-clock' ;
98import Fit from 'react-fit' ;
109
1110import TimeInput from 'react-time-picker/dist/esm/TimeInput' ;
1211
13- import { isTime , 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-timerange-picker' ;
2822const outsideActionEvents = [ 'mousedown' , 'focusin' , 'touchstart' ] as const ;
29- const allViews = [ 'hour' , 'minute' , 'second' ] 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
@@ -668,50 +663,4 @@ const TimeRangePicker: React.FC<TimeRangePickerProps> = function TimeRangePicker
668663 ) ;
669664} ;
670665
671- const isValue = PropTypes . oneOfType ( [ PropTypes . string , PropTypes . instanceOf ( Date ) ] ) ;
672-
673- const isValueOrValueArray = PropTypes . oneOfType ( [ isValue , rangeOf ( isValue ) ] ) ;
674-
675- TimeRangePicker . propTypes = {
676- amPmAriaLabel : PropTypes . string ,
677- autoFocus : PropTypes . bool ,
678- className : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . arrayOf ( PropTypes . string ) ] ) ,
679- clearAriaLabel : PropTypes . string ,
680- clearIcon : PropTypes . oneOfType ( [ PropTypes . node , PropTypes . func ] ) ,
681- clockAriaLabel : PropTypes . string ,
682- clockClassName : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . arrayOf ( PropTypes . string ) ] ) ,
683- clockIcon : PropTypes . oneOfType ( [ PropTypes . node , PropTypes . func ] ) ,
684- closeClock : PropTypes . bool ,
685- 'data-testid' : PropTypes . string ,
686- disableClock : PropTypes . bool ,
687- disabled : PropTypes . bool ,
688- format : PropTypes . string ,
689- hourAriaLabel : PropTypes . string ,
690- hourPlaceholder : PropTypes . string ,
691- id : PropTypes . string ,
692- isOpen : PropTypes . bool ,
693- locale : PropTypes . string ,
694- maxDetail : PropTypes . oneOf ( allViews ) ,
695- maxTime : isTime ,
696- minTime : isTime ,
697- minuteAriaLabel : PropTypes . string ,
698- minutePlaceholder : PropTypes . string ,
699- name : PropTypes . string ,
700- nativeInputAriaLabel : PropTypes . string ,
701- onChange : PropTypes . func ,
702- onClockClose : PropTypes . func ,
703- onClockOpen : PropTypes . func ,
704- onFocus : PropTypes . func ,
705- openClockOnFocus : PropTypes . bool ,
706- rangeDivider : PropTypes . node ,
707- required : PropTypes . bool ,
708- secondAriaLabel : PropTypes . string ,
709- secondPlaceholder : PropTypes . string ,
710- value : isValueOrValueArray ,
711- } ;
712-
713- if ( isBrowser ) {
714- TimeRangePicker . propTypes . portalContainer = PropTypes . instanceOf ( HTMLElement ) ;
715- }
716-
717666export default TimeRangePicker ;
0 commit comments