react-date-picker
Advanced tools
Comparing version 10.2.0 to 10.2.1
/// <reference types="react" /> | ||
import PropTypes from 'prop-types'; | ||
import { isMaxDate, isMinDate } from './shared/propTypes'; | ||
import type { Detail, LooseValuePiece, Value } from './shared/types'; | ||
@@ -41,5 +40,5 @@ type DateInputProps = { | ||
locale: PropTypes.Requireable<string>; | ||
maxDate: typeof isMaxDate; | ||
maxDate: PropTypes.Validator<Date | null | undefined>; | ||
maxDetail: PropTypes.Requireable<"month" | "year" | "century" | "decade">; | ||
minDate: typeof isMinDate; | ||
minDate: PropTypes.Validator<Date | null | undefined>; | ||
monthAriaLabel: PropTypes.Requireable<string>; | ||
@@ -46,0 +45,0 @@ monthPlaceholder: PropTypes.Requireable<string>; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Input from './Input'; | ||
import { isMaxDate, isMinDate } from '../shared/propTypes'; | ||
type DayInputProps = { | ||
@@ -20,4 +19,4 @@ maxDate?: Date; | ||
}>> | null | undefined>>; | ||
maxDate: typeof isMaxDate; | ||
minDate: typeof isMinDate; | ||
maxDate: PropTypes.Validator<Date | null | undefined>; | ||
minDate: PropTypes.Validator<Date | null | undefined>; | ||
month: PropTypes.Requireable<string>; | ||
@@ -24,0 +23,0 @@ onChange: PropTypes.Requireable<(...args: any[]) => any>; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Input from './Input'; | ||
import { isMaxDate, isMinDate } from '../shared/propTypes'; | ||
type MonthInputProps = { | ||
@@ -19,4 +18,4 @@ maxDate?: Date; | ||
}>> | null | undefined>>; | ||
maxDate: typeof isMaxDate; | ||
minDate: typeof isMinDate; | ||
maxDate: PropTypes.Validator<Date | null | undefined>; | ||
minDate: PropTypes.Validator<Date | null | undefined>; | ||
onChange: PropTypes.Requireable<(...args: any[]) => any>; | ||
@@ -23,0 +22,0 @@ onKeyDown: PropTypes.Requireable<(...args: any[]) => any>; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { isMaxDate, isMinDate } from '../shared/propTypes'; | ||
type MonthSelectProps = { | ||
@@ -36,4 +35,4 @@ ariaLabel?: string; | ||
locale: PropTypes.Requireable<string>; | ||
maxDate: typeof isMaxDate; | ||
minDate: typeof isMinDate; | ||
maxDate: PropTypes.Validator<Date | null | undefined>; | ||
minDate: PropTypes.Validator<Date | null | undefined>; | ||
onChange: PropTypes.Requireable<(...args: any[]) => any>; | ||
@@ -40,0 +39,0 @@ onKeyDown: PropTypes.Requireable<(...args: any[]) => any>; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { isMaxDate, isMinDate } from '../shared/propTypes'; | ||
type NativeInputProps = { | ||
@@ -20,4 +19,4 @@ ariaLabel?: string; | ||
disabled: PropTypes.Requireable<boolean>; | ||
maxDate: typeof isMaxDate; | ||
minDate: typeof isMinDate; | ||
maxDate: PropTypes.Validator<Date | null | undefined>; | ||
minDate: PropTypes.Validator<Date | null | undefined>; | ||
name: PropTypes.Requireable<string>; | ||
@@ -24,0 +23,0 @@ onChange: PropTypes.Requireable<(...args: any[]) => any>; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Input from './Input'; | ||
import { isMaxDate, isMinDate } from '../shared/propTypes'; | ||
type YearInputProps = { | ||
@@ -20,4 +19,4 @@ maxDate?: Date; | ||
}>> | null | undefined>>; | ||
maxDate: typeof isMaxDate; | ||
minDate: typeof isMinDate; | ||
maxDate: PropTypes.Validator<Date | null | undefined>; | ||
minDate: PropTypes.Validator<Date | null | undefined>; | ||
onChange: PropTypes.Requireable<(...args: any[]) => any>; | ||
@@ -24,0 +23,0 @@ onKeyDown: PropTypes.Requireable<(...args: any[]) => any>; |
@@ -5,3 +5,2 @@ import React from 'react'; | ||
import Calendar from 'react-calendar'; | ||
import { isMaxDate, isMinDate } from './shared/propTypes'; | ||
import type { ClassName, CloseReason, Detail, LooseValue, OpenReason, Value } from './shared/types'; | ||
@@ -77,5 +76,5 @@ type Icon = React.ReactElement | string; | ||
locale: PropTypes.Requireable<string>; | ||
maxDate: typeof isMaxDate; | ||
maxDate: PropTypes.Validator<Date | null | undefined>; | ||
maxDetail: PropTypes.Requireable<"month" | "year" | "century" | "decade">; | ||
minDate: typeof isMinDate; | ||
minDate: PropTypes.Validator<Date | null | undefined>; | ||
monthAriaLabel: PropTypes.Requireable<string>; | ||
@@ -94,3 +93,3 @@ monthPlaceholder: PropTypes.Requireable<string>; | ||
showLeadingZeros: PropTypes.Requireable<boolean>; | ||
value: PropTypes.Requireable<NonNullable<NonNullable<string | Date | null | undefined> | (NonNullable<string | Date | null | undefined> | null | undefined)[] | null | undefined>>; | ||
value: PropTypes.Requireable<NonNullable<NonNullable<string | Date | null | undefined> | import("./shared/types").Range<NonNullable<string | Date | null | undefined>> | null | undefined>>; | ||
yearAriaLabel: PropTypes.Requireable<string>; | ||
@@ -97,0 +96,0 @@ yearPlaceholder: PropTypes.Requireable<string>; |
@@ -231,3 +231,3 @@ "use strict"; | ||
var isValue = prop_types_1.default.oneOfType([prop_types_1.default.string, prop_types_1.default.instanceOf(Date)]); | ||
var isValueOrValueArray = prop_types_1.default.oneOfType([isValue, prop_types_1.default.arrayOf(isValue)]); | ||
var isValueOrValueArray = prop_types_1.default.oneOfType([isValue, (0, propTypes_1.rangeOf)(isValue)]); | ||
DatePicker.propTypes = { | ||
@@ -234,0 +234,0 @@ autoFocus: prop_types_1.default.bool, |
import DatePicker from './DatePicker'; | ||
import type { DatePickerProps } from './DatePicker'; | ||
export type { DatePickerProps } from './DatePicker'; | ||
export { DatePicker }; | ||
export type { DatePickerProps }; | ||
export default DatePicker; |
import PropTypes from 'prop-types'; | ||
import type { Requireable, Validator } from 'prop-types'; | ||
import type { Range } from './types'; | ||
export declare const isValueType: PropTypes.Requireable<string>; | ||
export declare function isMinDate(props: Record<string, unknown>, propName: string, componentName: string): Error | null; | ||
export declare function isMaxDate(props: Record<string, unknown>, propName: string, componentName: string): Error | null; | ||
export declare const isMinDate: Validator<Date | null | undefined>; | ||
export declare const isMaxDate: Validator<Date | null | undefined>; | ||
export declare const isRef: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | Required<PropTypes.InferProps<{ | ||
current: PropTypes.Requireable<any>; | ||
}>> | null | undefined>>; | ||
export declare const rangeOf: <T>(type: PropTypes.Requireable<T>) => PropTypes.Requireable<Range<T>>; |
@@ -15,3 +15,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isRef = exports.isMaxDate = exports.isMinDate = exports.isValueType = void 0; | ||
exports.rangeOf = exports.isRef = exports.isMaxDate = exports.isMinDate = exports.isValueType = void 0; | ||
var prop_types_1 = __importDefault(require("prop-types")); | ||
@@ -21,3 +21,3 @@ var allViews = ['century', 'decade', 'year', 'month']; | ||
exports.isValueType = prop_types_1.default.oneOf(allValueTypes); | ||
function isMinDate(props, propName, componentName) { | ||
var isMinDate = function isMinDate(props, propName, componentName) { | ||
var _a = props, _b = propName, minDate = _a[_b]; | ||
@@ -35,5 +35,5 @@ if (!minDate) { | ||
return null; | ||
} | ||
}; | ||
exports.isMinDate = isMinDate; | ||
function isMaxDate(props, propName, componentName) { | ||
var isMaxDate = function isMaxDate(props, propName, componentName) { | ||
var _a = props, _b = propName, maxDate = _a[_b]; | ||
@@ -51,3 +51,3 @@ if (!maxDate) { | ||
return null; | ||
} | ||
}; | ||
exports.isMaxDate = isMaxDate; | ||
@@ -60,1 +60,5 @@ exports.isRef = prop_types_1.default.oneOfType([ | ||
]); | ||
var rangeOf = function (type) { | ||
return prop_types_1.default.arrayOf(type); | ||
}; | ||
exports.rangeOf = rangeOf; |
@@ -1,2 +0,2 @@ | ||
type Range<T> = [T, T]; | ||
export type Range<T> = [T, T]; | ||
export type ClassName = string | null | undefined | (string | null | undefined)[]; | ||
@@ -3,0 +3,0 @@ export type CloseReason = 'buttonClick' | 'escape' | 'outsideAction' | 'select'; |
/// <reference types="react" /> | ||
import PropTypes from 'prop-types'; | ||
import { isMaxDate, isMinDate } from './shared/propTypes'; | ||
import type { Detail, LooseValuePiece, Value } from './shared/types'; | ||
@@ -41,5 +40,5 @@ type DateInputProps = { | ||
locale: PropTypes.Requireable<string>; | ||
maxDate: typeof isMaxDate; | ||
maxDate: PropTypes.Validator<Date | null | undefined>; | ||
maxDetail: PropTypes.Requireable<"month" | "year" | "century" | "decade">; | ||
minDate: typeof isMinDate; | ||
minDate: PropTypes.Validator<Date | null | undefined>; | ||
monthAriaLabel: PropTypes.Requireable<string>; | ||
@@ -46,0 +45,0 @@ monthPlaceholder: PropTypes.Requireable<string>; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Input from './Input'; | ||
import { isMaxDate, isMinDate } from '../shared/propTypes'; | ||
type DayInputProps = { | ||
@@ -20,4 +19,4 @@ maxDate?: Date; | ||
}>> | null | undefined>>; | ||
maxDate: typeof isMaxDate; | ||
minDate: typeof isMinDate; | ||
maxDate: PropTypes.Validator<Date | null | undefined>; | ||
minDate: PropTypes.Validator<Date | null | undefined>; | ||
month: PropTypes.Requireable<string>; | ||
@@ -24,0 +23,0 @@ onChange: PropTypes.Requireable<(...args: any[]) => any>; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Input from './Input'; | ||
import { isMaxDate, isMinDate } from '../shared/propTypes'; | ||
type MonthInputProps = { | ||
@@ -19,4 +18,4 @@ maxDate?: Date; | ||
}>> | null | undefined>>; | ||
maxDate: typeof isMaxDate; | ||
minDate: typeof isMinDate; | ||
maxDate: PropTypes.Validator<Date | null | undefined>; | ||
minDate: PropTypes.Validator<Date | null | undefined>; | ||
onChange: PropTypes.Requireable<(...args: any[]) => any>; | ||
@@ -23,0 +22,0 @@ onKeyDown: PropTypes.Requireable<(...args: any[]) => any>; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { isMaxDate, isMinDate } from '../shared/propTypes'; | ||
type MonthSelectProps = { | ||
@@ -36,4 +35,4 @@ ariaLabel?: string; | ||
locale: PropTypes.Requireable<string>; | ||
maxDate: typeof isMaxDate; | ||
minDate: typeof isMinDate; | ||
maxDate: PropTypes.Validator<Date | null | undefined>; | ||
minDate: PropTypes.Validator<Date | null | undefined>; | ||
onChange: PropTypes.Requireable<(...args: any[]) => any>; | ||
@@ -40,0 +39,0 @@ onKeyDown: PropTypes.Requireable<(...args: any[]) => any>; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { isMaxDate, isMinDate } from '../shared/propTypes'; | ||
type NativeInputProps = { | ||
@@ -20,4 +19,4 @@ ariaLabel?: string; | ||
disabled: PropTypes.Requireable<boolean>; | ||
maxDate: typeof isMaxDate; | ||
minDate: typeof isMinDate; | ||
maxDate: PropTypes.Validator<Date | null | undefined>; | ||
minDate: PropTypes.Validator<Date | null | undefined>; | ||
name: PropTypes.Requireable<string>; | ||
@@ -24,0 +23,0 @@ onChange: PropTypes.Requireable<(...args: any[]) => any>; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Input from './Input'; | ||
import { isMaxDate, isMinDate } from '../shared/propTypes'; | ||
type YearInputProps = { | ||
@@ -20,4 +19,4 @@ maxDate?: Date; | ||
}>> | null | undefined>>; | ||
maxDate: typeof isMaxDate; | ||
minDate: typeof isMinDate; | ||
maxDate: PropTypes.Validator<Date | null | undefined>; | ||
minDate: PropTypes.Validator<Date | null | undefined>; | ||
onChange: PropTypes.Requireable<(...args: any[]) => any>; | ||
@@ -24,0 +23,0 @@ onKeyDown: PropTypes.Requireable<(...args: any[]) => any>; |
@@ -5,3 +5,2 @@ import React from 'react'; | ||
import Calendar from 'react-calendar'; | ||
import { isMaxDate, isMinDate } from './shared/propTypes'; | ||
import type { ClassName, CloseReason, Detail, LooseValue, OpenReason, Value } from './shared/types'; | ||
@@ -77,5 +76,5 @@ type Icon = React.ReactElement | string; | ||
locale: PropTypes.Requireable<string>; | ||
maxDate: typeof isMaxDate; | ||
maxDate: PropTypes.Validator<Date | null | undefined>; | ||
maxDetail: PropTypes.Requireable<"month" | "year" | "century" | "decade">; | ||
minDate: typeof isMinDate; | ||
minDate: PropTypes.Validator<Date | null | undefined>; | ||
monthAriaLabel: PropTypes.Requireable<string>; | ||
@@ -94,3 +93,3 @@ monthPlaceholder: PropTypes.Requireable<string>; | ||
showLeadingZeros: PropTypes.Requireable<boolean>; | ||
value: PropTypes.Requireable<NonNullable<NonNullable<string | Date | null | undefined> | (NonNullable<string | Date | null | undefined> | null | undefined)[] | null | undefined>>; | ||
value: PropTypes.Requireable<NonNullable<NonNullable<string | Date | null | undefined> | import("./shared/types").Range<NonNullable<string | Date | null | undefined>> | null | undefined>>; | ||
yearAriaLabel: PropTypes.Requireable<string>; | ||
@@ -97,0 +96,0 @@ yearPlaceholder: PropTypes.Requireable<string>; |
@@ -31,3 +31,3 @@ var __assign = (this && this.__assign) || function () { | ||
import DateInput from './DateInput'; | ||
import { isMaxDate, isMinDate } from './shared/propTypes'; | ||
import { isMaxDate, isMinDate, rangeOf } from './shared/propTypes'; | ||
var baseClassName = 'react-date-picker'; | ||
@@ -203,3 +203,3 @@ var outsideActionEvents = ['mousedown', 'focusin', 'touchstart']; | ||
var isValue = PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]); | ||
var isValueOrValueArray = PropTypes.oneOfType([isValue, PropTypes.arrayOf(isValue)]); | ||
var isValueOrValueArray = PropTypes.oneOfType([isValue, rangeOf(isValue)]); | ||
DatePicker.propTypes = { | ||
@@ -206,0 +206,0 @@ autoFocus: PropTypes.bool, |
import DatePicker from './DatePicker'; | ||
import type { DatePickerProps } from './DatePicker'; | ||
export type { DatePickerProps } from './DatePicker'; | ||
export { DatePicker }; | ||
export type { DatePickerProps }; | ||
export default DatePicker; |
import PropTypes from 'prop-types'; | ||
import type { Requireable, Validator } from 'prop-types'; | ||
import type { Range } from './types'; | ||
export declare const isValueType: PropTypes.Requireable<string>; | ||
export declare function isMinDate(props: Record<string, unknown>, propName: string, componentName: string): Error | null; | ||
export declare function isMaxDate(props: Record<string, unknown>, propName: string, componentName: string): Error | null; | ||
export declare const isMinDate: Validator<Date | null | undefined>; | ||
export declare const isMaxDate: Validator<Date | null | undefined>; | ||
export declare const isRef: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | Required<PropTypes.InferProps<{ | ||
current: PropTypes.Requireable<any>; | ||
}>> | null | undefined>>; | ||
export declare const rangeOf: <T>(type: PropTypes.Requireable<T>) => PropTypes.Requireable<Range<T>>; |
@@ -14,3 +14,3 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
export var isValueType = PropTypes.oneOf(allValueTypes); | ||
export function isMinDate(props, propName, componentName) { | ||
export var isMinDate = function isMinDate(props, propName, componentName) { | ||
var _a = props, _b = propName, minDate = _a[_b]; | ||
@@ -28,4 +28,4 @@ if (!minDate) { | ||
return null; | ||
} | ||
export function isMaxDate(props, propName, componentName) { | ||
}; | ||
export var isMaxDate = function isMaxDate(props, propName, componentName) { | ||
var _a = props, _b = propName, maxDate = _a[_b]; | ||
@@ -43,3 +43,3 @@ if (!maxDate) { | ||
return null; | ||
} | ||
}; | ||
export var isRef = PropTypes.oneOfType([ | ||
@@ -51,1 +51,4 @@ PropTypes.func, | ||
]); | ||
export var rangeOf = function (type) { | ||
return PropTypes.arrayOf(type); | ||
}; |
@@ -1,2 +0,2 @@ | ||
type Range<T> = [T, T]; | ||
export type Range<T> = [T, T]; | ||
export type ClassName = string | null | undefined | (string | null | undefined)[]; | ||
@@ -3,0 +3,0 @@ export type CloseReason = 'buttonClick' | 'escape' | 'outsideAction' | 'select'; |
{ | ||
"name": "react-date-picker", | ||
"version": "10.2.0", | ||
"version": "10.2.1", | ||
"description": "A date picker for your React app.", | ||
@@ -18,3 +18,3 @@ "main": "dist/cjs/index.js", | ||
"clean": "rimraf dist", | ||
"copy-styles": "node ./copy-styles.mjs", | ||
"copy-styles": "node --loader ts-node/esm ./copy-styles.ts", | ||
"lint": "eslint . --ext .js,.jsx,.ts,.tsx", | ||
@@ -25,3 +25,3 @@ "prepack": "yarn clean && yarn build", | ||
"tsc": "tsc --noEmit", | ||
"unit": "vitest run" | ||
"unit": "vitest" | ||
}, | ||
@@ -42,7 +42,7 @@ "keywords": [ | ||
"@wojtekmaj/date-utils": "^1.1.3", | ||
"clsx": "^1.2.1", | ||
"clsx": "^2.0.0", | ||
"get-user-locale": "^2.2.1", | ||
"make-event-props": "^1.4.2", | ||
"prop-types": "^15.6.0", | ||
"react-calendar": "^4.2.1", | ||
"react-calendar": "^4.4.0", | ||
"react-fit": "^1.5.1", | ||
@@ -56,4 +56,5 @@ "update-input-width": "^1.3.1" | ||
"@testing-library/user-event": "^14.4.0", | ||
"@types/node": "*", | ||
"eslint": "^8.26.0", | ||
"eslint-config-wojtekmaj": "^0.8.3", | ||
"eslint-config-wojtekmaj": "^0.9.0", | ||
"husky": "^8.0.0", | ||
@@ -66,2 +67,3 @@ "jsdom": "^21.1.0", | ||
"rimraf": "^3.0.0", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.0.0", | ||
@@ -75,2 +77,6 @@ "vitest": "^0.30.1", | ||
}, | ||
"publishConfig": { | ||
"access": "public", | ||
"provenance": true | ||
}, | ||
"files": [ | ||
@@ -77,0 +83,0 @@ "dist", |
import DatePicker from './DatePicker'; | ||
import type { DatePickerProps } from './DatePicker'; | ||
export type { DatePickerProps } from './DatePicker'; | ||
export { DatePicker }; | ||
export type { DatePickerProps }; | ||
export default DatePicker; |
import PropTypes from 'prop-types'; | ||
import type { Requireable, Validator } from 'prop-types'; | ||
import type { Range } from './types'; | ||
const allViews = ['century', 'decade', 'year', 'month']; | ||
@@ -8,3 +11,7 @@ const allValueTypes = [...allViews.slice(1), 'day']; | ||
export function isMinDate(props: Record<string, unknown>, propName: string, componentName: string) { | ||
export const isMinDate: Validator<Date | null | undefined> = function isMinDate( | ||
props, | ||
propName, | ||
componentName, | ||
) { | ||
const { [propName]: minDate } = props; | ||
@@ -31,5 +38,9 @@ | ||
return null; | ||
} | ||
}; | ||
export function isMaxDate(props: Record<string, unknown>, propName: string, componentName: string) { | ||
export const isMaxDate: Validator<Date | null | undefined> = function isMaxDate( | ||
props, | ||
propName, | ||
componentName, | ||
) { | ||
const { [propName]: maxDate } = props; | ||
@@ -56,3 +67,3 @@ | ||
return null; | ||
} | ||
}; | ||
@@ -65,1 +76,5 @@ export const isRef = PropTypes.oneOfType([ | ||
]); | ||
export const rangeOf = <T>(type: Requireable<T>): Requireable<Range<T>> => { | ||
return PropTypes.arrayOf(type) as Requireable<Range<T>>; | ||
}; |
@@ -1,2 +0,2 @@ | ||
type Range<T> = [T, T]; | ||
export type Range<T> = [T, T]; | ||
@@ -3,0 +3,0 @@ export type ClassName = string | null | undefined | (string | null | undefined)[]; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
321049
7124
18
- Removedclsx@1.2.1(transitive)
Updatedclsx@^2.0.0
Updatedreact-calendar@^4.4.0