Skip to content

Commit

Permalink
Remove propTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Apr 26, 2024
1 parent bfe3945 commit a7d73e5
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 130 deletions.
1 change: 0 additions & 1 deletion packages/react-date-picker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@
"clsx": "^2.0.0",
"get-user-locale": "^2.2.1",
"make-event-props": "^1.6.0",
"prop-types": "^15.6.0",
"react-calendar": "^4.6.0",
"react-fit": "^1.7.0",
"update-input-width": "^1.4.0"
Expand Down
54 changes: 3 additions & 51 deletions packages/react-date-picker/src/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@

import { createElement, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { createPortal } from 'react-dom';
import PropTypes from 'prop-types';
import makeEventProps from 'make-event-props';
import clsx from 'clsx';
import Calendar from 'react-calendar';
import Fit from 'react-fit';

import DateInput from './DateInput.js';

import { isMaxDate, isMinDate, rangeOf } from './shared/propTypes.js';

import type { ReactNodeArray } from 'prop-types';
import type {
ClassName,
CloseReason,
Expand Down Expand Up @@ -58,7 +54,9 @@ const ClearIcon = (
</svg>
);

type Icon = React.ReactElement | ReactNodeArray | null | string | number | boolean;
type ReactNodeLike = React.ReactNode | string | number | boolean | null | undefined;

type Icon = ReactNodeLike | ReactNodeLike[];

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

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

const isValue = PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]);

const isValueOrValueArray = PropTypes.oneOfType([isValue, rangeOf(isValue)]);

DatePicker.propTypes = {
autoFocus: PropTypes.bool,
calendarAriaLabel: PropTypes.string,
calendarClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
calendarIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
className: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
clearAriaLabel: PropTypes.string,
clearIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
closeCalendar: PropTypes.bool,
'data-testid': PropTypes.string,
dayAriaLabel: PropTypes.string,
dayPlaceholder: PropTypes.string,
disableCalendar: PropTypes.bool,
disabled: PropTypes.bool,
format: PropTypes.string,
id: PropTypes.string,
isOpen: PropTypes.bool,
locale: PropTypes.string,
maxDate: isMaxDate,
maxDetail: PropTypes.oneOf(allViews),
minDate: isMinDate,
monthAriaLabel: PropTypes.string,
monthPlaceholder: PropTypes.string,
name: PropTypes.string,
nativeInputAriaLabel: PropTypes.string,
onCalendarClose: PropTypes.func,
onCalendarOpen: PropTypes.func,
onChange: PropTypes.func,
onFocus: PropTypes.func,
openCalendarOnFocus: PropTypes.bool,
required: PropTypes.bool,
returnValue: PropTypes.oneOf(['start', 'end', 'range'] as const),
showLeadingZeros: PropTypes.bool,
value: isValueOrValueArray,
yearAriaLabel: PropTypes.string,
yearPlaceholder: PropTypes.string,
};

if (isBrowser) {
DatePicker.propTypes.portalContainer = PropTypes.instanceOf(HTMLElement);
}

export default DatePicker;
76 changes: 0 additions & 76 deletions packages/react-date-picker/src/shared/propTypes.ts

This file was deleted.

1 change: 0 additions & 1 deletion sample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
},
"license": "MIT",
"dependencies": {
"prop-types": "^15.6.0",
"react": "^18.2.0",
"react-date-picker": "latest",
"react-dom": "^18.2.0"
Expand Down
1 change: 0 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4176,7 +4176,6 @@ __metadata:
make-event-props: "npm:^1.6.0"
nodemon: "npm:^3.0.0"
prettier: "npm:^3.2.0"
prop-types: "npm:^15.6.0"
react: "npm:^18.2.0"
react-calendar: "npm:^4.6.0"
react-dom: "npm:^18.2.0"
Expand Down

0 comments on commit a7d73e5

Please sign in to comment.