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 ba47d64 commit d920022
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 280 deletions.
1 change: 0 additions & 1 deletion packages/react-calendar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"@wojtekmaj/date-utils": "^1.1.3",
"clsx": "^2.0.0",
"get-user-locale": "^2.2.1",
"prop-types": "^15.6.0",
"warning": "^4.0.0"
},
"devDependencies": {
Expand Down
75 changes: 0 additions & 75 deletions packages/react-calendar/src/Calendar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use client';

import { forwardRef, useCallback, useImperativeHandle, useState } from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';

import Navigation from './Calendar/Navigation.js';
Expand All @@ -11,15 +10,6 @@ import YearView from './YearView.js';
import MonthView from './MonthView.js';

import { getBegin, getBeginNext, getEnd, getValueRange } from './shared/dates.js';
import {
isCalendarType,
isClassName,
isMaxDate,
isMinDate,
isRef,
isView,
rangeOf,
} from './shared/propTypes.js';
import { between } from './shared/utils.js';

import type {
Expand Down Expand Up @@ -1144,69 +1134,4 @@ const Calendar = forwardRef(function Calendar(props: CalendarProps, ref) {
);
});

const isActiveStartDate = PropTypes.instanceOf(Date);

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

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

Calendar.propTypes = {
activeStartDate: isActiveStartDate,
allowPartialRange: PropTypes.bool,
calendarType: isCalendarType,
className: isClassName,
defaultActiveStartDate: isActiveStartDate,
defaultValue: isValueOrValueArray,
defaultView: isView,
formatDay: PropTypes.func,
formatLongDate: PropTypes.func,
formatMonth: PropTypes.func,
formatMonthYear: PropTypes.func,
formatShortWeekday: PropTypes.func,
formatWeekday: PropTypes.func,
formatYear: PropTypes.func,
goToRangeStartOnSelect: PropTypes.bool,
inputRef: isRef,
locale: PropTypes.string,
maxDate: isMaxDate,
maxDetail: PropTypes.oneOf(allViews),
minDate: isMinDate,
minDetail: PropTypes.oneOf(allViews),
navigationAriaLabel: PropTypes.string,
navigationAriaLive: PropTypes.oneOf(['off', 'polite', 'assertive'] as const),
navigationLabel: PropTypes.func,
next2AriaLabel: PropTypes.string,
next2Label: PropTypes.node,
nextAriaLabel: PropTypes.string,
nextLabel: PropTypes.node,
onActiveStartDateChange: PropTypes.func,
onChange: PropTypes.func,
onClickDay: PropTypes.func,
onClickDecade: PropTypes.func,
onClickMonth: PropTypes.func,
onClickWeekNumber: PropTypes.func,
onClickYear: PropTypes.func,
onDrillDown: PropTypes.func,
onDrillUp: PropTypes.func,
onViewChange: PropTypes.func,
prev2AriaLabel: PropTypes.string,
prev2Label: PropTypes.node,
prevAriaLabel: PropTypes.string,
prevLabel: PropTypes.node,
returnValue: PropTypes.oneOf(['start', 'end', 'range'] as const),
selectRange: PropTypes.bool,
showDoubleView: PropTypes.bool,
showFixedNumberOfWeeks: PropTypes.bool,
showNavigation: PropTypes.bool,
showNeighboringCentury: PropTypes.bool,
showNeighboringDecade: PropTypes.bool,
showNeighboringMonth: PropTypes.bool,
showWeekNumbers: PropTypes.bool,
tileClassName: PropTypes.oneOfType([PropTypes.func, isClassName]),
tileContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
tileDisabled: PropTypes.func,
value: isValueOrValueArray,
view: isView,
};

export default Calendar;
9 changes: 0 additions & 9 deletions packages/react-calendar/src/CenturyView.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import PropTypes from 'prop-types';

import Decades from './CenturyView/Decades.js';

import { tileGroupProps } from './shared/propTypes.js';

type CenturyViewProps = React.ComponentProps<typeof Decades>;

/**
Expand All @@ -17,9 +13,4 @@ const CenturyView: React.FC<CenturyViewProps> = function CenturyView(props) {
return <div className="react-calendar__century-view">{renderDecades()}</div>;
};

CenturyView.propTypes = {
...tileGroupProps,
showNeighboringCentury: PropTypes.bool,
};

export default CenturyView;
9 changes: 0 additions & 9 deletions packages/react-calendar/src/DecadeView.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import PropTypes from 'prop-types';

import Years from './DecadeView/Years.js';

import { tileGroupProps } from './shared/propTypes.js';

type DecadeViewProps = React.ComponentProps<typeof Years>;

/**
Expand All @@ -17,9 +13,4 @@ const DecadeView: React.FC<DecadeViewProps> = function DecadeView(props) {
return <div className="react-calendar__decade-view">{renderYears()}</div>;
};

DecadeView.propTypes = {
...tileGroupProps,
showNeighboringDecade: PropTypes.bool,
};

export default DecadeView;
16 changes: 0 additions & 16 deletions packages/react-calendar/src/MonthView.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import PropTypes from 'prop-types';
import clsx from 'clsx';

import Days from './MonthView/Days.js';
import Weekdays from './MonthView/Weekdays.js';
import WeekNumbers from './MonthView/WeekNumbers.js';

import { CALENDAR_TYPES, CALENDAR_TYPE_LOCALES } from './shared/const.js';
import { isCalendarType, tileGroupProps } from './shared/propTypes.js';

import type { CalendarType, DeprecatedCalendarType } from './shared/types.js';

Expand Down Expand Up @@ -114,18 +112,4 @@ const MonthView: React.FC<MonthViewProps> = function MonthView(props) {
);
};

MonthView.propTypes = {
...tileGroupProps,
calendarType: isCalendarType,
formatDay: PropTypes.func,
formatLongDate: PropTypes.func,
formatShortWeekday: PropTypes.func,
formatWeekday: PropTypes.func,
onClickWeekNumber: PropTypes.func,
onMouseLeave: PropTypes.func,
showFixedNumberOfWeeks: PropTypes.bool,
showNeighboringMonth: PropTypes.bool,
showWeekNumbers: PropTypes.bool,
};

export default MonthView;
6 changes: 0 additions & 6 deletions packages/react-calendar/src/YearView.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import Months from './YearView/Months.js';

import { tileGroupProps } from './shared/propTypes.js';

type YearViewProps = React.ComponentProps<typeof Months>;

/**
Expand All @@ -15,8 +13,4 @@ const YearView: React.FC<YearViewProps> = function YearView(props) {
return <div className="react-calendar__year-view">{renderMonths()}</div>;
};

YearView.propTypes = {
...tileGroupProps,
};

export default YearView;
161 changes: 0 additions & 161 deletions packages/react-calendar/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.2",
"react": "^18.2.0",
"react-calendar": "latest",
"react-dom": "^18.2.0"
Expand Down
3 changes: 1 addition & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4045,7 +4045,7 @@ __metadata:
languageName: node
linkType: hard

"prop-types@npm:^15.6.0, prop-types@npm:^15.8.1":
"prop-types@npm:^15.8.1":
version: 15.8.1
resolution: "prop-types@npm:15.8.1"
dependencies:
Expand Down Expand Up @@ -4112,7 +4112,6 @@ __metadata:
happy-dom: "npm:^12.6.0"
nodemon: "npm:^3.0.0"
prettier: "npm:^3.2.0"
prop-types: "npm:^15.6.0"
react: "npm:^18.2.0"
react-dom: "npm:^18.2.0"
rimraf: "npm:^3.0.0"
Expand Down

0 comments on commit d920022

Please sign in to comment.