|
2 | 2 |
|
3 | 3 | import { createElement, useCallback, useEffect, useMemo, useRef, useState } from 'react'; |
4 | 4 | import { createPortal } from 'react-dom'; |
5 | | -import PropTypes from 'prop-types'; |
6 | 5 | import makeEventProps from 'make-event-props'; |
7 | 6 | import clsx from 'clsx'; |
8 | 7 | import Calendar from 'react-calendar'; |
9 | 8 | import Fit from 'react-fit'; |
10 | 9 |
|
11 | 10 | import DateInput from 'react-date-picker/dist/esm/DateInput'; |
12 | 11 |
|
13 | | -import { isMaxDate, isMinDate, rangeOf } from './shared/propTypes.js'; |
14 | | - |
15 | | -import type { ReactNodeArray } from 'prop-types'; |
16 | 12 | import type { |
17 | 13 | ClassName, |
18 | 14 | CloseReason, |
@@ -58,7 +54,9 @@ const ClearIcon = ( |
58 | 54 | </svg> |
59 | 55 | ); |
60 | 56 |
|
61 | | -type Icon = React.ReactElement | ReactNodeArray | null | string | number | boolean; |
| 57 | +type ReactNodeLike = React.ReactNode | string | number | boolean | null | undefined; |
| 58 | + |
| 59 | +type Icon = ReactNodeLike | ReactNodeLike[]; |
62 | 60 |
|
63 | 61 | type IconOrRenderFunction = Icon | React.ComponentType | React.ReactElement; |
64 | 62 |
|
@@ -686,50 +684,4 @@ const DateRangePicker: React.FC<DateRangePickerProps> = function DateRangePicker |
686 | 684 | ); |
687 | 685 | }; |
688 | 686 |
|
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 | | - |
735 | 687 | export default DateRangePicker; |
0 commit comments