|
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 './DateInput.js'; |
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 |
|
@@ -655,50 +653,4 @@ const DatePicker: React.FC<DatePickerProps> = function DatePicker(props) { |
655 | 653 | ); |
656 | 654 | }; |
657 | 655 |
|
658 | | -const isValue = PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]); |
659 | | - |
660 | | -const isValueOrValueArray = PropTypes.oneOfType([isValue, rangeOf(isValue)]); |
661 | | - |
662 | | -DatePicker.propTypes = { |
663 | | - autoFocus: PropTypes.bool, |
664 | | - calendarAriaLabel: PropTypes.string, |
665 | | - calendarClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]), |
666 | | - calendarIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), |
667 | | - className: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]), |
668 | | - clearAriaLabel: PropTypes.string, |
669 | | - clearIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), |
670 | | - closeCalendar: PropTypes.bool, |
671 | | - 'data-testid': PropTypes.string, |
672 | | - dayAriaLabel: PropTypes.string, |
673 | | - dayPlaceholder: PropTypes.string, |
674 | | - disableCalendar: PropTypes.bool, |
675 | | - disabled: PropTypes.bool, |
676 | | - format: PropTypes.string, |
677 | | - id: PropTypes.string, |
678 | | - isOpen: PropTypes.bool, |
679 | | - locale: PropTypes.string, |
680 | | - maxDate: isMaxDate, |
681 | | - maxDetail: PropTypes.oneOf(allViews), |
682 | | - minDate: isMinDate, |
683 | | - monthAriaLabel: PropTypes.string, |
684 | | - monthPlaceholder: PropTypes.string, |
685 | | - name: PropTypes.string, |
686 | | - nativeInputAriaLabel: PropTypes.string, |
687 | | - onCalendarClose: PropTypes.func, |
688 | | - onCalendarOpen: PropTypes.func, |
689 | | - onChange: PropTypes.func, |
690 | | - onFocus: PropTypes.func, |
691 | | - openCalendarOnFocus: PropTypes.bool, |
692 | | - required: PropTypes.bool, |
693 | | - returnValue: PropTypes.oneOf(['start', 'end', 'range'] as const), |
694 | | - showLeadingZeros: PropTypes.bool, |
695 | | - value: isValueOrValueArray, |
696 | | - yearAriaLabel: PropTypes.string, |
697 | | - yearPlaceholder: PropTypes.string, |
698 | | -}; |
699 | | - |
700 | | -if (isBrowser) { |
701 | | - DatePicker.propTypes.portalContainer = PropTypes.instanceOf(HTMLElement); |
702 | | -} |
703 | | - |
704 | 656 | export default DatePicker; |
0 commit comments