Skip to content

Commit a7d73e5

Browse files
committed
Remove propTypes
1 parent bfe3945 commit a7d73e5

File tree

5 files changed

+3
-130
lines changed

5 files changed

+3
-130
lines changed

packages/react-date-picker/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@
110110
"clsx": "^2.0.0",
111111
"get-user-locale": "^2.2.1",
112112
"make-event-props": "^1.6.0",
113-
"prop-types": "^15.6.0",
114113
"react-calendar": "^4.6.0",
115114
"react-fit": "^1.7.0",
116115
"update-input-width": "^1.4.0"

packages/react-date-picker/src/DatePicker.tsx

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22

33
import { createElement, useCallback, useEffect, useMemo, useRef, useState } from 'react';
44
import { createPortal } from 'react-dom';
5-
import PropTypes from 'prop-types';
65
import makeEventProps from 'make-event-props';
76
import clsx from 'clsx';
87
import Calendar from 'react-calendar';
98
import Fit from 'react-fit';
109

1110
import DateInput from './DateInput.js';
1211

13-
import { isMaxDate, isMinDate, rangeOf } from './shared/propTypes.js';
14-
15-
import type { ReactNodeArray } from 'prop-types';
1612
import type {
1713
ClassName,
1814
CloseReason,
@@ -58,7 +54,9 @@ const ClearIcon = (
5854
</svg>
5955
);
6056

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[];
6260

6361
type IconOrRenderFunction = Icon | React.ComponentType | React.ReactElement;
6462

@@ -655,50 +653,4 @@ const DatePicker: React.FC<DatePickerProps> = function DatePicker(props) {
655653
);
656654
};
657655

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-
704656
export default DatePicker;

packages/react-date-picker/src/shared/propTypes.ts

Lines changed: 0 additions & 76 deletions
This file was deleted.

sample/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
},
1616
"license": "MIT",
1717
"dependencies": {
18-
"prop-types": "^15.6.0",
1918
"react": "^18.2.0",
2019
"react-date-picker": "latest",
2120
"react-dom": "^18.2.0"

yarn.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4176,7 +4176,6 @@ __metadata:
41764176
make-event-props: "npm:^1.6.0"
41774177
nodemon: "npm:^3.0.0"
41784178
prettier: "npm:^3.2.0"
4179-
prop-types: "npm:^15.6.0"
41804179
react: "npm:^18.2.0"
41814180
react-calendar: "npm:^4.6.0"
41824181
react-dom: "npm:^18.2.0"

0 commit comments

Comments
 (0)