Skip to content

Commit 36b35ad

Browse files
committed
Remove propTypes
1 parent da12119 commit 36b35ad

File tree

5 files changed

+3
-136
lines changed

5 files changed

+3
-136
lines changed

packages/react-datetime-picker/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
"clsx": "^2.0.0",
6767
"get-user-locale": "^2.2.1",
6868
"make-event-props": "^1.6.0",
69-
"prop-types": "^15.6.0",
7069
"react-calendar": "^4.6.0",
7170
"react-clock": "^4.5.0",
7271
"react-date-picker": "^10.5.0",

packages/react-datetime-picker/src/DateTimePicker.tsx

Lines changed: 3 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
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';
@@ -11,9 +10,6 @@ import Fit from 'react-fit';
1110

1211
import DateTimeInput from './DateTimeInput.js';
1312

14-
import { isMaxDate, isMinDate, rangeOf } from './shared/propTypes.js';
15-
16-
import type { ReactNodeArray } from 'prop-types';
1713
import type {
1814
ClassName,
1915
CloseReason,
@@ -23,8 +19,6 @@ import type {
2319
Value,
2420
} from './shared/types.js';
2521

26-
const isBrowser = typeof document !== 'undefined';
27-
2822
const baseClassName = 'react-datetime-picker';
2923
const outsideActionEvents = ['mousedown', 'focusin', 'touchstart'] as const;
3024
const allViews = ['hour', 'minute', 'second'] as const;
@@ -59,7 +53,9 @@ const ClearIcon = (
5953
</svg>
6054
);
6155

62-
type Icon = React.ReactElement | ReactNodeArray | null | string | number | boolean;
56+
type ReactNodeLike = React.ReactNode | string | number | boolean | null | undefined;
57+
58+
type Icon = ReactNodeLike | ReactNodeLike[];
6359

6460
type IconOrRenderFunction = Icon | React.ComponentType | React.ReactElement;
6561

@@ -902,61 +898,4 @@ const DateTimePicker: React.FC<DateTimePickerProps> = function DateTimePicker(pr
902898
);
903899
};
904900

905-
const isValue = PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]);
906-
907-
const isValueOrValueArray = PropTypes.oneOfType([isValue, rangeOf(isValue)]);
908-
909-
DateTimePicker.propTypes = {
910-
amPmAriaLabel: PropTypes.string,
911-
autoFocus: PropTypes.bool,
912-
calendarAriaLabel: PropTypes.string,
913-
calendarClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
914-
calendarIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
915-
className: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
916-
clearAriaLabel: PropTypes.string,
917-
clearIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
918-
clockClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
919-
closeWidgets: PropTypes.bool,
920-
'data-testid': PropTypes.string,
921-
dayAriaLabel: PropTypes.string,
922-
dayPlaceholder: PropTypes.string,
923-
disableCalendar: PropTypes.bool,
924-
disableClock: PropTypes.bool,
925-
disabled: PropTypes.bool,
926-
format: PropTypes.string,
927-
hourAriaLabel: PropTypes.string,
928-
hourPlaceholder: PropTypes.string,
929-
id: PropTypes.string,
930-
isCalendarOpen: PropTypes.bool,
931-
isClockOpen: PropTypes.bool,
932-
locale: PropTypes.string,
933-
maxDate: isMaxDate,
934-
maxDetail: PropTypes.oneOf(allViews),
935-
minDate: isMinDate,
936-
minuteAriaLabel: PropTypes.string,
937-
minutePlaceholder: PropTypes.string,
938-
monthAriaLabel: PropTypes.string,
939-
monthPlaceholder: PropTypes.string,
940-
name: PropTypes.string,
941-
nativeInputAriaLabel: PropTypes.string,
942-
onCalendarClose: PropTypes.func,
943-
onCalendarOpen: PropTypes.func,
944-
onChange: PropTypes.func,
945-
onClockClose: PropTypes.func,
946-
onClockOpen: PropTypes.func,
947-
onFocus: PropTypes.func,
948-
openWidgetsOnFocus: PropTypes.bool,
949-
required: PropTypes.bool,
950-
secondAriaLabel: PropTypes.string,
951-
secondPlaceholder: PropTypes.string,
952-
showLeadingZeros: PropTypes.bool,
953-
value: isValueOrValueArray,
954-
yearAriaLabel: PropTypes.string,
955-
yearPlaceholder: PropTypes.string,
956-
};
957-
958-
if (isBrowser) {
959-
DateTimePicker.propTypes.portalContainer = PropTypes.instanceOf(HTMLElement);
960-
}
961-
962901
export default DateTimePicker;

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

Lines changed: 0 additions & 69 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.2",
1918
"react": "^18.2.0",
2019
"react-datetime-picker": "latest",
2120
"react-dom": "^18.2.0"

yarn.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4323,7 +4323,6 @@ __metadata:
43234323
make-event-props: "npm:^1.6.0"
43244324
nodemon: "npm:^3.0.0"
43254325
prettier: "npm:^3.2.0"
4326-
prop-types: "npm:^15.6.0"
43274326
react: "npm:^18.2.0"
43284327
react-calendar: "npm:^4.6.0"
43294328
react-clock: "npm:^4.5.0"

0 commit comments

Comments
 (0)