react-clock
Advanced tools
Comparing version 4.2.0 to 4.3.0
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import type { formatHour as defaultFormatHour } from './shared/hourFormatter'; | ||
import { isHandWidth } from './shared/propTypes'; | ||
import type { ClassName, HandLength, HandWidth, MarkLength, MarkWidth, OppositeHandLength } from './shared/types'; | ||
type ClockProps = { | ||
export type ClockProps = { | ||
className?: ClassName; | ||
@@ -36,13 +35,13 @@ formatHour?: typeof defaultFormatHour; | ||
formatHour: PropTypes.Requireable<(...args: any[]) => any>; | ||
hourHandLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
hourHandOppositeLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
hourHandWidth: typeof isHandWidth; | ||
hourMarksLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
hourMarksWidth: typeof isHandWidth; | ||
hourHandLength: PropTypes.Validator<number>; | ||
hourHandOppositeLength: PropTypes.Validator<number>; | ||
hourHandWidth: PropTypes.Validator<number>; | ||
hourMarksLength: PropTypes.Validator<number>; | ||
hourMarksWidth: PropTypes.Validator<number>; | ||
locale: PropTypes.Requireable<string>; | ||
minuteHandLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
minuteHandOppositeLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
minuteHandWidth: typeof isHandWidth; | ||
minuteMarksLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
minuteMarksWidth: typeof isHandWidth; | ||
minuteHandLength: PropTypes.Validator<number>; | ||
minuteHandOppositeLength: PropTypes.Validator<number>; | ||
minuteHandWidth: PropTypes.Validator<number>; | ||
minuteMarksLength: PropTypes.Validator<number>; | ||
minuteMarksWidth: PropTypes.Validator<number>; | ||
renderHourMarks: PropTypes.Requireable<boolean>; | ||
@@ -53,5 +52,5 @@ renderMinuteHand: PropTypes.Requireable<boolean>; | ||
renderSecondHand: PropTypes.Requireable<boolean>; | ||
secondHandLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
secondHandOppositeLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
secondHandWidth: typeof isHandWidth; | ||
secondHandLength: PropTypes.Validator<number>; | ||
secondHandOppositeLength: PropTypes.Validator<number>; | ||
secondHandWidth: PropTypes.Validator<number>; | ||
size: PropTypes.Requireable<NonNullable<string | number | null | undefined>>; | ||
@@ -58,0 +57,0 @@ value: PropTypes.Requireable<NonNullable<string | Date | null | undefined>>; |
/// <reference types="react" /> | ||
import PropTypes from 'prop-types'; | ||
import { isHandWidth } from './shared/propTypes'; | ||
import type { HandLength, HandWidth, OppositeHandLength } from './shared/types'; | ||
@@ -16,8 +15,8 @@ type HandProps = { | ||
angle: PropTypes.Requireable<number>; | ||
length: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
length: PropTypes.Validator<number>; | ||
name: PropTypes.Validator<string>; | ||
oppositeLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
width: typeof isHandWidth; | ||
oppositeLength: PropTypes.Validator<number>; | ||
width: PropTypes.Validator<number>; | ||
}; | ||
} | ||
export default Hand; |
import Clock from './Clock'; | ||
export type { ClockProps } from './Clock'; | ||
export { Clock }; | ||
export default Clock; |
@@ -15,8 +15,8 @@ import React from 'react'; | ||
angle: PropTypes.Requireable<number>; | ||
length: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
length: PropTypes.Validator<number>; | ||
name: PropTypes.Validator<string>; | ||
number: PropTypes.Requireable<PropTypes.ReactNodeLike>; | ||
width: typeof import("./shared/propTypes").isHandWidth; | ||
width: PropTypes.Validator<number>; | ||
}; | ||
} | ||
export default Mark; |
@@ -1,5 +0,6 @@ | ||
export declare const isHandLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
export declare const isOppositeHandLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
export declare function isHandWidth(props: Record<string, unknown>, propName: string, componentName: string): Error | null; | ||
export declare const isMarkLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
export declare const isMarkWidth: typeof isHandWidth; | ||
import type { Validator } from 'prop-types'; | ||
export declare const isHandLength: Validator<number>; | ||
export declare const isOppositeHandLength: Validator<number>; | ||
export declare const isHandWidth: Validator<number>; | ||
export declare const isMarkLength: Validator<number>; | ||
export declare const isMarkWidth: Validator<number>; |
@@ -21,3 +21,3 @@ "use strict"; | ||
exports.isOppositeHandLength = isNumberBetween(-100, 100); | ||
function isHandWidth(props, propName, componentName) { | ||
var isHandWidth = function isHandWidth(props, propName, componentName) { | ||
var _a = props, _b = propName, width = _a[_b]; | ||
@@ -34,5 +34,5 @@ if (typeof width !== 'undefined') { | ||
return null; | ||
} | ||
}; | ||
exports.isHandWidth = isHandWidth; | ||
exports.isMarkLength = exports.isHandLength; | ||
exports.isMarkWidth = isHandWidth; | ||
exports.isMarkWidth = exports.isHandWidth; |
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import type { formatHour as defaultFormatHour } from './shared/hourFormatter'; | ||
import { isHandWidth } from './shared/propTypes'; | ||
import type { ClassName, HandLength, HandWidth, MarkLength, MarkWidth, OppositeHandLength } from './shared/types'; | ||
type ClockProps = { | ||
export type ClockProps = { | ||
className?: ClassName; | ||
@@ -36,13 +35,13 @@ formatHour?: typeof defaultFormatHour; | ||
formatHour: PropTypes.Requireable<(...args: any[]) => any>; | ||
hourHandLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
hourHandOppositeLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
hourHandWidth: typeof isHandWidth; | ||
hourMarksLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
hourMarksWidth: typeof isHandWidth; | ||
hourHandLength: PropTypes.Validator<number>; | ||
hourHandOppositeLength: PropTypes.Validator<number>; | ||
hourHandWidth: PropTypes.Validator<number>; | ||
hourMarksLength: PropTypes.Validator<number>; | ||
hourMarksWidth: PropTypes.Validator<number>; | ||
locale: PropTypes.Requireable<string>; | ||
minuteHandLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
minuteHandOppositeLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
minuteHandWidth: typeof isHandWidth; | ||
minuteMarksLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
minuteMarksWidth: typeof isHandWidth; | ||
minuteHandLength: PropTypes.Validator<number>; | ||
minuteHandOppositeLength: PropTypes.Validator<number>; | ||
minuteHandWidth: PropTypes.Validator<number>; | ||
minuteMarksLength: PropTypes.Validator<number>; | ||
minuteMarksWidth: PropTypes.Validator<number>; | ||
renderHourMarks: PropTypes.Requireable<boolean>; | ||
@@ -53,5 +52,5 @@ renderMinuteHand: PropTypes.Requireable<boolean>; | ||
renderSecondHand: PropTypes.Requireable<boolean>; | ||
secondHandLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
secondHandOppositeLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
secondHandWidth: typeof isHandWidth; | ||
secondHandLength: PropTypes.Validator<number>; | ||
secondHandOppositeLength: PropTypes.Validator<number>; | ||
secondHandWidth: PropTypes.Validator<number>; | ||
size: PropTypes.Requireable<NonNullable<string | number | null | undefined>>; | ||
@@ -58,0 +57,0 @@ value: PropTypes.Requireable<NonNullable<string | Date | null | undefined>>; |
/// <reference types="react" /> | ||
import PropTypes from 'prop-types'; | ||
import { isHandWidth } from './shared/propTypes'; | ||
import type { HandLength, HandWidth, OppositeHandLength } from './shared/types'; | ||
@@ -16,8 +15,8 @@ type HandProps = { | ||
angle: PropTypes.Requireable<number>; | ||
length: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
length: PropTypes.Validator<number>; | ||
name: PropTypes.Validator<string>; | ||
oppositeLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
width: typeof isHandWidth; | ||
oppositeLength: PropTypes.Validator<number>; | ||
width: PropTypes.Validator<number>; | ||
}; | ||
} | ||
export default Hand; |
import Clock from './Clock'; | ||
export type { ClockProps } from './Clock'; | ||
export { Clock }; | ||
export default Clock; |
@@ -15,8 +15,8 @@ import React from 'react'; | ||
angle: PropTypes.Requireable<number>; | ||
length: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
length: PropTypes.Validator<number>; | ||
name: PropTypes.Validator<string>; | ||
number: PropTypes.Requireable<PropTypes.ReactNodeLike>; | ||
width: typeof import("./shared/propTypes").isHandWidth; | ||
width: PropTypes.Validator<number>; | ||
}; | ||
} | ||
export default Mark; |
@@ -1,5 +0,6 @@ | ||
export declare const isHandLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
export declare const isOppositeHandLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
export declare function isHandWidth(props: Record<string, unknown>, propName: string, componentName: string): Error | null; | ||
export declare const isMarkLength: (props: Record<string, unknown>, propName: string, componentName: string) => Error | null; | ||
export declare const isMarkWidth: typeof isHandWidth; | ||
import type { Validator } from 'prop-types'; | ||
export declare const isHandLength: Validator<number>; | ||
export declare const isOppositeHandLength: Validator<number>; | ||
export declare const isHandWidth: Validator<number>; | ||
export declare const isMarkLength: Validator<number>; | ||
export declare const isMarkWidth: Validator<number>; |
@@ -18,3 +18,3 @@ function isNumberBetween(min, max) { | ||
export var isOppositeHandLength = isNumberBetween(-100, 100); | ||
export function isHandWidth(props, propName, componentName) { | ||
export var isHandWidth = function isHandWidth(props, propName, componentName) { | ||
var _a = props, _b = propName, width = _a[_b]; | ||
@@ -31,4 +31,4 @@ if (typeof width !== 'undefined') { | ||
return null; | ||
} | ||
}; | ||
export var isMarkLength = isHandLength; | ||
export var isMarkWidth = isHandWidth; |
{ | ||
"name": "react-clock", | ||
"version": "4.2.0", | ||
"version": "4.3.0", | ||
"description": "An analog clock 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" | ||
}, | ||
@@ -49,3 +49,3 @@ "keywords": [ | ||
"@wojtekmaj/date-utils": "^1.1.2", | ||
"clsx": "^1.2.1", | ||
"clsx": "^2.0.0", | ||
"get-user-locale": "^2.2.1", | ||
@@ -57,4 +57,5 @@ "prop-types": "^15.6.0" | ||
"@testing-library/react": "^14.0.0", | ||
"@types/node": "*", | ||
"eslint": "^8.26.0", | ||
"eslint-config-wojtekmaj": "^0.8.3", | ||
"eslint-config-wojtekmaj": "^0.9.0", | ||
"husky": "^8.0.0", | ||
@@ -67,4 +68,5 @@ "jsdom": "^21.1.0", | ||
"rimraf": "^3.0.0", | ||
"typescript": "^5.0.2", | ||
"vitest": "^0.29.2" | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.0.0", | ||
"vitest": "^0.30.1" | ||
}, | ||
@@ -75,2 +77,6 @@ "peerDependencies": { | ||
}, | ||
"publishConfig": { | ||
"access": "public", | ||
"provenance": true | ||
}, | ||
"files": [ | ||
@@ -77,0 +83,0 @@ "dist", |
import Clock from './Clock'; | ||
export type { ClockProps } from './Clock'; | ||
export { Clock }; | ||
export default Clock; |
@@ -1,3 +0,5 @@ | ||
function isNumberBetween(min: number, max: number) { | ||
return (props: Record<string, unknown>, propName: string, componentName: string) => { | ||
import type { Validator } from 'prop-types'; | ||
function isNumberBetween(min: number, max: number): Validator<number> { | ||
return (props, propName, componentName) => { | ||
const { [propName]: value } = props; | ||
@@ -28,7 +30,3 @@ | ||
export function isHandWidth( | ||
props: Record<string, unknown>, | ||
propName: string, | ||
componentName: string, | ||
) { | ||
export const isHandWidth: Validator<number> = function isHandWidth(props, propName, componentName) { | ||
const { [propName]: width } = props; | ||
@@ -52,3 +50,3 @@ | ||
return null; | ||
} | ||
}; | ||
@@ -55,0 +53,0 @@ export const isMarkLength = isHandLength; |
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
78438
15
1618
+ Addedclsx@2.1.1(transitive)
- Removedclsx@1.2.1(transitive)
Updatedclsx@^2.0.0