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 a011dc0 commit 64fe739
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 82 deletions.
1 change: 0 additions & 1 deletion packages/react-timerange-picker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"dependencies": {
"clsx": "^2.0.0",
"make-event-props": "^1.6.0",
"prop-types": "^15.6.0",
"react-clock": "^4.5.0",
"react-fit": "^1.7.0",
"react-time-picker": "^6.5.0"
Expand Down
57 changes: 3 additions & 54 deletions packages/react-timerange-picker/src/TimeRangePicker.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 Clock from 'react-clock';
import Fit from 'react-fit';

import TimeInput from 'react-time-picker/dist/esm/TimeInput';

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

import type { ReactNodeArray } from 'prop-types';
import type {
ClassName,
CloseReason,
Expand All @@ -22,11 +18,8 @@ import type {
Value,
} from './shared/types.js';

const isBrowser = typeof document !== 'undefined';

const baseClassName = 'react-timerange-picker';
const outsideActionEvents = ['mousedown', 'focusin', 'touchstart'] as const;
const allViews = ['hour', 'minute', 'second'] as const;

const iconProps = {
xmlns: 'http://www.w3.org/2000/svg',
Expand Down Expand Up @@ -58,7 +51,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 @@ -668,50 +663,4 @@ const TimeRangePicker: React.FC<TimeRangePickerProps> = function TimeRangePicker
);
};

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

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

TimeRangePicker.propTypes = {
amPmAriaLabel: PropTypes.string,
autoFocus: PropTypes.bool,
className: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
clearAriaLabel: PropTypes.string,
clearIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
clockAriaLabel: PropTypes.string,
clockClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
clockIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
closeClock: PropTypes.bool,
'data-testid': PropTypes.string,
disableClock: PropTypes.bool,
disabled: PropTypes.bool,
format: PropTypes.string,
hourAriaLabel: PropTypes.string,
hourPlaceholder: PropTypes.string,
id: PropTypes.string,
isOpen: PropTypes.bool,
locale: PropTypes.string,
maxDetail: PropTypes.oneOf(allViews),
maxTime: isTime,
minTime: isTime,
minuteAriaLabel: PropTypes.string,
minutePlaceholder: PropTypes.string,
name: PropTypes.string,
nativeInputAriaLabel: PropTypes.string,
onChange: PropTypes.func,
onClockClose: PropTypes.func,
onClockOpen: PropTypes.func,
onFocus: PropTypes.func,
openClockOnFocus: PropTypes.bool,
rangeDivider: PropTypes.node,
required: PropTypes.bool,
secondAriaLabel: PropTypes.string,
secondPlaceholder: PropTypes.string,
value: isValueOrValueArray,
};

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

export default TimeRangePicker;
25 changes: 0 additions & 25 deletions packages/react-timerange-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 @@ -16,7 +16,6 @@
"license": "MIT",
"dependencies": {
"@wojtekmaj/react-timerange-picker": "latest",
"prop-types": "^15.6.0",
"react": "^18.2.0",
"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 @@ -1221,7 +1221,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-clock: "npm:^4.5.0"
react-dom: "npm:^18.2.0"
Expand Down

0 comments on commit 64fe739

Please sign in to comment.