react-time-picker
Advanced tools
Comparing version 6.2.0 to 6.2.1
import TimePicker from './TimePicker'; | ||
import type { TimePickerProps } from './TimePicker'; | ||
export type { TimePickerProps } from './TimePicker'; | ||
export { TimePicker }; | ||
export type { TimePickerProps }; | ||
export default TimePicker; |
import PropTypes from 'prop-types'; | ||
export declare function isTime(props: Record<string, unknown>, propName: string, componentName: string): Error | null; | ||
import type { Requireable, Validator } from 'prop-types'; | ||
import type { Range } from './types'; | ||
export declare const isTime: Validator<string>; | ||
export declare const isValueType: PropTypes.Requireable<string>; | ||
@@ -7,1 +9,2 @@ export declare const isRef: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | Required<PropTypes.InferProps<{ | ||
}>> | 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.isValueType = exports.isTime = void 0; | ||
exports.rangeOf = exports.isRef = exports.isValueType = exports.isTime = void 0; | ||
var prop_types_1 = __importDefault(require("prop-types")); | ||
@@ -21,3 +21,3 @@ var allViews = ['hour', 'minute', 'second']; | ||
var hourOptionalSecondsRegExp = /^(([0-1])?[0-9]|2[0-3]):[0-5][0-9](:([0-5][0-9]))?$/; | ||
function isTime(props, propName, componentName) { | ||
var isTime = function isTime(props, propName, componentName) { | ||
var _a = props, _b = propName, time = _a[_b]; | ||
@@ -31,3 +31,3 @@ if (time) { | ||
return null; | ||
} | ||
}; | ||
exports.isTime = isTime; | ||
@@ -41,1 +41,5 @@ exports.isValueType = prop_types_1.default.oneOf(allValueTypes); | ||
]); | ||
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 AmPmType = 'am' | 'pm'; | ||
@@ -10,2 +10,1 @@ export type ClassName = string | null | undefined | (string | null | undefined)[]; | ||
export type Value = string | null; | ||
export {}; |
/// <reference types="react" /> | ||
import PropTypes from 'prop-types'; | ||
import { isTime } from './shared/propTypes'; | ||
import type { Detail, LooseValuePiece, Value } from './shared/types'; | ||
@@ -42,4 +41,4 @@ type TimeInputProps = { | ||
maxDetail: PropTypes.Requireable<"hour" | "minute" | "second">; | ||
maxTime: typeof isTime; | ||
minTime: typeof isTime; | ||
maxTime: PropTypes.Validator<string>; | ||
minTime: PropTypes.Validator<string>; | ||
minuteAriaLabel: PropTypes.Requireable<string>; | ||
@@ -53,5 +52,5 @@ minutePlaceholder: PropTypes.Requireable<string>; | ||
secondPlaceholder: PropTypes.Requireable<string>; | ||
value: PropTypes.Requireable<{}>; | ||
value: PropTypes.Requireable<NonNullable<string | Date | null | undefined>>; | ||
}; | ||
} | ||
export default TimeInput; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { isTime } from '../shared/propTypes'; | ||
type AmPmProps = { | ||
@@ -33,4 +32,4 @@ ariaLabel?: string; | ||
locale: PropTypes.Requireable<string>; | ||
maxTime: typeof isTime; | ||
minTime: typeof isTime; | ||
maxTime: PropTypes.Validator<string>; | ||
minTime: PropTypes.Validator<string>; | ||
onChange: PropTypes.Requireable<(...args: any[]) => any>; | ||
@@ -37,0 +36,0 @@ onKeyDown: PropTypes.Requireable<(...args: any[]) => any>; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Input from './Input'; | ||
import { isTime } from '../shared/propTypes'; | ||
import type { AmPmType } from '../shared/types'; | ||
@@ -23,4 +22,4 @@ type Hour12InputProps = { | ||
}>> | null | undefined>>; | ||
maxTime: typeof isTime; | ||
minTime: typeof isTime; | ||
maxTime: PropTypes.Validator<string>; | ||
minTime: PropTypes.Validator<string>; | ||
onChange: PropTypes.Requireable<(...args: any[]) => any>; | ||
@@ -27,0 +26,0 @@ onKeyDown: PropTypes.Requireable<(...args: any[]) => any>; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Input from './Input'; | ||
import { isTime } from '../shared/propTypes'; | ||
type Hour24InputProps = { | ||
@@ -20,4 +19,4 @@ maxTime?: string; | ||
}>> | null | undefined>>; | ||
maxTime: typeof isTime; | ||
minTime: typeof isTime; | ||
maxTime: PropTypes.Validator<string>; | ||
minTime: PropTypes.Validator<string>; | ||
onChange: PropTypes.Requireable<(...args: any[]) => any>; | ||
@@ -24,0 +23,0 @@ onKeyDown: PropTypes.Requireable<(...args: any[]) => any>; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Input from './Input'; | ||
import { isTime } from '../shared/propTypes'; | ||
type MinuteInputProps = { | ||
@@ -21,4 +20,4 @@ hour?: string | null; | ||
}>> | null | undefined>>; | ||
maxTime: typeof isTime; | ||
minTime: typeof isTime; | ||
maxTime: PropTypes.Validator<string>; | ||
minTime: PropTypes.Validator<string>; | ||
onChange: PropTypes.Requireable<(...args: any[]) => any>; | ||
@@ -25,0 +24,0 @@ onKeyDown: PropTypes.Requireable<(...args: any[]) => any>; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { isTime } from '../shared/propTypes'; | ||
type NativeInputProps = { | ||
@@ -20,4 +19,4 @@ ariaLabel?: string; | ||
disabled: PropTypes.Requireable<boolean>; | ||
maxTime: typeof isTime; | ||
minTime: typeof isTime; | ||
maxTime: PropTypes.Validator<string>; | ||
minTime: PropTypes.Validator<string>; | ||
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 { isTime } from '../shared/propTypes'; | ||
type SecondInputProps = { | ||
@@ -22,4 +21,4 @@ hour?: string | null; | ||
}>> | null | undefined>>; | ||
maxTime: typeof isTime; | ||
minTime: typeof isTime; | ||
maxTime: PropTypes.Validator<string>; | ||
minTime: PropTypes.Validator<string>; | ||
minute: PropTypes.Requireable<string>; | ||
@@ -26,0 +25,0 @@ onChange: PropTypes.Requireable<(...args: any[]) => any>; |
@@ -5,3 +5,2 @@ import React from 'react'; | ||
import Clock from 'react-clock'; | ||
import { isTime } from './shared/propTypes'; | ||
import type { ClassName, CloseReason, Detail, LooseValue, OpenReason, Value } from './shared/types'; | ||
@@ -78,4 +77,4 @@ type Icon = React.ReactElement | string; | ||
maxDetail: PropTypes.Requireable<"hour" | "minute" | "second">; | ||
maxTime: typeof isTime; | ||
minTime: typeof isTime; | ||
maxTime: PropTypes.Validator<string>; | ||
minTime: PropTypes.Validator<string>; | ||
minuteAriaLabel: PropTypes.Requireable<string>; | ||
@@ -94,5 +93,5 @@ minutePlaceholder: PropTypes.Requireable<string>; | ||
secondPlaceholder: PropTypes.Requireable<string>; | ||
value: PropTypes.Requireable<{}>; | ||
value: PropTypes.Requireable<NonNullable<NonNullable<string | Date | null | undefined> | import("./shared/types").Range<NonNullable<string | Date | null | undefined>> | null | undefined>>; | ||
}; | ||
} | ||
export default TimePicker; |
@@ -232,3 +232,3 @@ "use strict"; | ||
var isValue = prop_types_1.default.oneOfType([propTypes_1.isTime, 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)]); | ||
TimePicker.propTypes = { | ||
@@ -235,0 +235,0 @@ amPmAriaLabel: prop_types_1.default.string, |
import TimePicker from './TimePicker'; | ||
import type { TimePickerProps } from './TimePicker'; | ||
export type { TimePickerProps } from './TimePicker'; | ||
export { TimePicker }; | ||
export type { TimePickerProps }; | ||
export default TimePicker; |
import PropTypes from 'prop-types'; | ||
export declare function isTime(props: Record<string, unknown>, propName: string, componentName: string): Error | null; | ||
import type { Requireable, Validator } from 'prop-types'; | ||
import type { Range } from './types'; | ||
export declare const isTime: Validator<string>; | ||
export declare const isValueType: PropTypes.Requireable<string>; | ||
@@ -7,1 +9,2 @@ export declare const isRef: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | Required<PropTypes.InferProps<{ | ||
}>> | 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) { | ||
var hourOptionalSecondsRegExp = /^(([0-1])?[0-9]|2[0-3]):[0-5][0-9](:([0-5][0-9]))?$/; | ||
export function isTime(props, propName, componentName) { | ||
export var isTime = function isTime(props, propName, componentName) { | ||
var _a = props, _b = propName, time = _a[_b]; | ||
@@ -24,3 +24,3 @@ if (time) { | ||
return null; | ||
} | ||
}; | ||
export var isValueType = PropTypes.oneOf(allValueTypes); | ||
@@ -33,1 +33,4 @@ export var isRef = PropTypes.oneOfType([ | ||
]); | ||
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 AmPmType = 'am' | 'pm'; | ||
@@ -10,2 +10,1 @@ export type ClassName = string | null | undefined | (string | null | undefined)[]; | ||
export type Value = string | null; | ||
export {}; |
/// <reference types="react" /> | ||
import PropTypes from 'prop-types'; | ||
import { isTime } from './shared/propTypes'; | ||
import type { Detail, LooseValuePiece, Value } from './shared/types'; | ||
@@ -42,4 +41,4 @@ type TimeInputProps = { | ||
maxDetail: PropTypes.Requireable<"hour" | "minute" | "second">; | ||
maxTime: typeof isTime; | ||
minTime: typeof isTime; | ||
maxTime: PropTypes.Validator<string>; | ||
minTime: PropTypes.Validator<string>; | ||
minuteAriaLabel: PropTypes.Requireable<string>; | ||
@@ -53,5 +52,5 @@ minutePlaceholder: PropTypes.Requireable<string>; | ||
secondPlaceholder: PropTypes.Requireable<string>; | ||
value: PropTypes.Requireable<{}>; | ||
value: PropTypes.Requireable<NonNullable<string | Date | null | undefined>>; | ||
}; | ||
} | ||
export default TimeInput; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { isTime } from '../shared/propTypes'; | ||
type AmPmProps = { | ||
@@ -33,4 +32,4 @@ ariaLabel?: string; | ||
locale: PropTypes.Requireable<string>; | ||
maxTime: typeof isTime; | ||
minTime: typeof isTime; | ||
maxTime: PropTypes.Validator<string>; | ||
minTime: PropTypes.Validator<string>; | ||
onChange: PropTypes.Requireable<(...args: any[]) => any>; | ||
@@ -37,0 +36,0 @@ onKeyDown: PropTypes.Requireable<(...args: any[]) => any>; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Input from './Input'; | ||
import { isTime } from '../shared/propTypes'; | ||
import type { AmPmType } from '../shared/types'; | ||
@@ -23,4 +22,4 @@ type Hour12InputProps = { | ||
}>> | null | undefined>>; | ||
maxTime: typeof isTime; | ||
minTime: typeof isTime; | ||
maxTime: PropTypes.Validator<string>; | ||
minTime: PropTypes.Validator<string>; | ||
onChange: PropTypes.Requireable<(...args: any[]) => any>; | ||
@@ -27,0 +26,0 @@ onKeyDown: PropTypes.Requireable<(...args: any[]) => any>; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Input from './Input'; | ||
import { isTime } from '../shared/propTypes'; | ||
type Hour24InputProps = { | ||
@@ -20,4 +19,4 @@ maxTime?: string; | ||
}>> | null | undefined>>; | ||
maxTime: typeof isTime; | ||
minTime: typeof isTime; | ||
maxTime: PropTypes.Validator<string>; | ||
minTime: PropTypes.Validator<string>; | ||
onChange: PropTypes.Requireable<(...args: any[]) => any>; | ||
@@ -24,0 +23,0 @@ onKeyDown: PropTypes.Requireable<(...args: any[]) => any>; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Input from './Input'; | ||
import { isTime } from '../shared/propTypes'; | ||
type MinuteInputProps = { | ||
@@ -21,4 +20,4 @@ hour?: string | null; | ||
}>> | null | undefined>>; | ||
maxTime: typeof isTime; | ||
minTime: typeof isTime; | ||
maxTime: PropTypes.Validator<string>; | ||
minTime: PropTypes.Validator<string>; | ||
onChange: PropTypes.Requireable<(...args: any[]) => any>; | ||
@@ -25,0 +24,0 @@ onKeyDown: PropTypes.Requireable<(...args: any[]) => any>; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { isTime } from '../shared/propTypes'; | ||
type NativeInputProps = { | ||
@@ -20,4 +19,4 @@ ariaLabel?: string; | ||
disabled: PropTypes.Requireable<boolean>; | ||
maxTime: typeof isTime; | ||
minTime: typeof isTime; | ||
maxTime: PropTypes.Validator<string>; | ||
minTime: PropTypes.Validator<string>; | ||
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 { isTime } from '../shared/propTypes'; | ||
type SecondInputProps = { | ||
@@ -22,4 +21,4 @@ hour?: string | null; | ||
}>> | null | undefined>>; | ||
maxTime: typeof isTime; | ||
minTime: typeof isTime; | ||
maxTime: PropTypes.Validator<string>; | ||
minTime: PropTypes.Validator<string>; | ||
minute: PropTypes.Requireable<string>; | ||
@@ -26,0 +25,0 @@ onChange: PropTypes.Requireable<(...args: any[]) => any>; |
@@ -5,3 +5,2 @@ import React from 'react'; | ||
import Clock from 'react-clock'; | ||
import { isTime } from './shared/propTypes'; | ||
import type { ClassName, CloseReason, Detail, LooseValue, OpenReason, Value } from './shared/types'; | ||
@@ -78,4 +77,4 @@ type Icon = React.ReactElement | string; | ||
maxDetail: PropTypes.Requireable<"hour" | "minute" | "second">; | ||
maxTime: typeof isTime; | ||
minTime: typeof isTime; | ||
maxTime: PropTypes.Validator<string>; | ||
minTime: PropTypes.Validator<string>; | ||
minuteAriaLabel: PropTypes.Requireable<string>; | ||
@@ -94,5 +93,5 @@ minutePlaceholder: PropTypes.Requireable<string>; | ||
secondPlaceholder: PropTypes.Requireable<string>; | ||
value: PropTypes.Requireable<{}>; | ||
value: PropTypes.Requireable<NonNullable<NonNullable<string | Date | null | undefined> | import("./shared/types").Range<NonNullable<string | Date | null | undefined>> | null | undefined>>; | ||
}; | ||
} | ||
export default TimePicker; |
@@ -31,3 +31,3 @@ var __assign = (this && this.__assign) || function () { | ||
import TimeInput from './TimeInput'; | ||
import { isTime } from './shared/propTypes'; | ||
import { isTime, rangeOf } from './shared/propTypes'; | ||
var baseClassName = 'react-time-picker'; | ||
@@ -204,3 +204,3 @@ var outsideActionEvents = ['mousedown', 'focusin', 'touchstart']; | ||
var isValue = PropTypes.oneOfType([isTime, PropTypes.instanceOf(Date)]); | ||
var isValueOrValueArray = PropTypes.oneOfType([isValue, PropTypes.arrayOf(isValue)]); | ||
var isValueOrValueArray = PropTypes.oneOfType([isValue, rangeOf(isValue)]); | ||
TimePicker.propTypes = { | ||
@@ -207,0 +207,0 @@ amPmAriaLabel: PropTypes.string, |
{ | ||
"name": "react-time-picker", | ||
"version": "6.2.0", | ||
"version": "6.2.1", | ||
"description": "A time 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" | ||
}, | ||
@@ -40,7 +40,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-clock": "^4.2.0", | ||
"react-clock": "^4.3.0", | ||
"react-fit": "^1.5.1", | ||
@@ -54,4 +54,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", | ||
@@ -64,2 +65,3 @@ "jsdom": "^21.1.0", | ||
"rimraf": "^3.0.0", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.0.0", | ||
@@ -73,2 +75,6 @@ "vitest": "^0.30.1", | ||
}, | ||
"publishConfig": { | ||
"access": "public", | ||
"provenance": true | ||
}, | ||
"files": [ | ||
@@ -75,0 +81,0 @@ "dist", |
import TimePicker from './TimePicker'; | ||
import type { TimePickerProps } from './TimePicker'; | ||
export type { TimePickerProps } from './TimePicker'; | ||
export { TimePicker }; | ||
export type { TimePickerProps }; | ||
export default TimePicker; |
import PropTypes from 'prop-types'; | ||
import type { Requireable, Validator } from 'prop-types'; | ||
import type { Range } from './types'; | ||
const allViews = ['hour', 'minute', 'second']; | ||
@@ -8,3 +11,3 @@ const allValueTypes = [...allViews]; | ||
export function isTime(props: Record<string, unknown>, propName: string, componentName: string) { | ||
export const isTime: Validator<string> = function isTime(props, propName, componentName) { | ||
const { [propName]: time } = props; | ||
@@ -22,3 +25,3 @@ | ||
return null; | ||
} | ||
}; | ||
@@ -33,1 +36,5 @@ export const isValueType = PropTypes.oneOf(allValueTypes); | ||
]); | ||
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 AmPmType = 'am' | 'pm'; |
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
314448
18
6977
- Removedclsx@1.2.1(transitive)
Updatedclsx@^2.0.0
Updatedreact-clock@^4.3.0