@wojtekmaj/react-daterange-picker
Advanced tools
Comparing version 5.2.0 to 5.2.1
@@ -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<string>; | ||
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>; |
@@ -246,3 +246,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)]); | ||
DateRangePicker.propTypes = { | ||
@@ -249,0 +249,0 @@ autoFocus: prop_types_1.default.bool, |
import DateRangePicker from './DateRangePicker'; | ||
import type { DateRangePickerProps } from './DateRangePicker'; | ||
export type { DateRangePickerProps } from './DateRangePicker'; | ||
export { DateRangePicker }; | ||
export type { DateRangePickerProps }; | ||
export default DateRangePicker; |
@@ -1,2 +0,6 @@ | ||
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; | ||
import PropTypes from 'prop-types'; | ||
import type { Requireable, Validator } from 'prop-types'; | ||
import type { Range } from './types'; | ||
export declare const isMinDate: Validator<Date | null | undefined>; | ||
export declare const isMaxDate: Validator<Date | null | undefined>; | ||
export declare const rangeOf: <T>(type: PropTypes.Requireable<T>) => PropTypes.Requireable<Range<T>>; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isMaxDate = exports.isMinDate = void 0; | ||
function isMinDate(props, propName, componentName) { | ||
exports.rangeOf = exports.isMaxDate = exports.isMinDate = void 0; | ||
var prop_types_1 = __importDefault(require("prop-types")); | ||
var isMinDate = function isMinDate(props, propName, componentName) { | ||
var _a = props, _b = propName, minDate = _a[_b]; | ||
@@ -17,5 +21,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]; | ||
@@ -33,3 +37,7 @@ if (!maxDate) { | ||
return null; | ||
} | ||
}; | ||
exports.isMaxDate = isMaxDate; | ||
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'; |
@@ -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<string>; | ||
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 'react-date-picker/dist/cjs/DateInput'; | ||
import { isMaxDate, isMinDate } from './shared/propTypes'; | ||
import { isMaxDate, isMinDate, rangeOf } from './shared/propTypes'; | ||
var baseClassName = 'react-daterange-picker'; | ||
@@ -218,3 +218,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)]); | ||
DateRangePicker.propTypes = { | ||
@@ -221,0 +221,0 @@ autoFocus: PropTypes.bool, |
import DateRangePicker from './DateRangePicker'; | ||
import type { DateRangePickerProps } from './DateRangePicker'; | ||
export type { DateRangePickerProps } from './DateRangePicker'; | ||
export { DateRangePicker }; | ||
export type { DateRangePickerProps }; | ||
export default DateRangePicker; |
@@ -1,2 +0,6 @@ | ||
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; | ||
import PropTypes from 'prop-types'; | ||
import type { Requireable, Validator } from 'prop-types'; | ||
import type { Range } from './types'; | ||
export declare const isMinDate: Validator<Date | null | undefined>; | ||
export declare const isMaxDate: Validator<Date | null | undefined>; | ||
export declare const rangeOf: <T>(type: PropTypes.Requireable<T>) => PropTypes.Requireable<Range<T>>; |
@@ -1,2 +0,3 @@ | ||
export function isMinDate(props, propName, componentName) { | ||
import PropTypes from 'prop-types'; | ||
export var isMinDate = function isMinDate(props, propName, componentName) { | ||
var _a = props, _b = propName, minDate = _a[_b]; | ||
@@ -14,4 +15,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]; | ||
@@ -29,2 +30,5 @@ if (!maxDate) { | ||
return null; | ||
} | ||
}; | ||
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": "@wojtekmaj/react-daterange-picker", | ||
"version": "5.2.0", | ||
"version": "5.2.1", | ||
"description": "A date range 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" | ||
}, | ||
@@ -43,7 +43,7 @@ "keywords": [ | ||
"dependencies": { | ||
"clsx": "^1.2.1", | ||
"clsx": "^2.0.0", | ||
"make-event-props": "^1.4.2", | ||
"prop-types": "^15.6.0", | ||
"react-calendar": "^4.2.1", | ||
"react-date-picker": "^10.2.0", | ||
"react-calendar": "^4.4.0", | ||
"react-date-picker": "^10.2.1", | ||
"react-fit": "^1.5.1" | ||
@@ -56,4 +56,5 @@ }, | ||
"@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", | ||
@@ -76,3 +78,4 @@ "vitest": "^0.30.1", | ||
"publishConfig": { | ||
"access": "public" | ||
"access": "public", | ||
"provenance": true | ||
}, | ||
@@ -79,0 +82,0 @@ "files": [ |
import DateRangePicker from './DateRangePicker'; | ||
import type { DateRangePickerProps } from './DateRangePicker'; | ||
export type { DateRangePickerProps } from './DateRangePicker'; | ||
export { DateRangePicker }; | ||
export type { DateRangePickerProps }; | ||
export default DateRangePicker; |
@@ -1,2 +0,11 @@ | ||
export function isMinDate(props: Record<string, unknown>, propName: string, componentName: string) { | ||
import PropTypes from 'prop-types'; | ||
import type { Requireable, Validator } from 'prop-types'; | ||
import type { Range } from './types'; | ||
export const isMinDate: Validator<Date | null | undefined> = function isMinDate( | ||
props, | ||
propName, | ||
componentName, | ||
) { | ||
const { [propName]: minDate } = props; | ||
@@ -23,5 +32,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; | ||
@@ -48,2 +61,6 @@ | ||
return null; | ||
} | ||
}; | ||
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
124712
2177
18
- Removedclsx@1.2.1(transitive)
Updatedclsx@^2.0.0
Updatedreact-calendar@^4.4.0
Updatedreact-date-picker@^10.2.1