@nexub/react 8.4.0 → 8.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accessibility.json +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +3 -0
- package/dist/components/DatePicker/DatePicker.js +7 -2
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +4 -1
- package/dist/components/DateTimePicker/DateTimePicker.js +7 -2
- package/dist/components/NumberInput/NumberInput.d.ts +3 -0
- package/dist/components/NumberInput/NumberInput.js +6 -1
- package/package.json +6 -6
package/accessibility.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "8.
|
|
2
|
+
"version": "8.5.0",
|
|
3
3
|
"standard": "WCAG 2.2 Level AA",
|
|
4
4
|
"method": {
|
|
5
5
|
"automated": "axe-core rules tagged wcag2a, wcag2aa, wcag21a, wcag21aa and wcag22aa, run on every Storybook story in light and dark, and on open popups (menus, listboxes, dialogs), on every pull request; a new violation fails the build.",
|
|
@@ -22,6 +22,9 @@ export declare function useCalendarLocale(localeProp?: Locale): {
|
|
|
22
22
|
};
|
|
23
23
|
export interface DatePickerProps {
|
|
24
24
|
value?: Date;
|
|
25
|
+
/** Called with the new value. */
|
|
26
|
+
onValueChange?: (date: Date | undefined) => void;
|
|
27
|
+
/** @deprecated 8.5: use `onValueChange` (the name every other Nexub input, and React Native, uses). Removed in 9.0. */
|
|
25
28
|
onChange?: (date: Date | undefined) => void;
|
|
26
29
|
placeholder?: string;
|
|
27
30
|
disabled?: boolean;
|
|
@@ -88,6 +88,7 @@ const calendarClassNames = {
|
|
|
88
88
|
const DatePicker = React.forwardRef(
|
|
89
89
|
function DatePicker2({
|
|
90
90
|
value,
|
|
91
|
+
onValueChange,
|
|
91
92
|
onChange,
|
|
92
93
|
placeholder: placeholderProp,
|
|
93
94
|
disabled = false,
|
|
@@ -102,6 +103,10 @@ const DatePicker = React.forwardRef(
|
|
|
102
103
|
typeable = false
|
|
103
104
|
}, ref) {
|
|
104
105
|
const [open, setOpen] = React.useState(false);
|
|
106
|
+
const change = (v) => {
|
|
107
|
+
onValueChange?.(v);
|
|
108
|
+
onChange?.(v);
|
|
109
|
+
};
|
|
105
110
|
const messages = useNexubMessages();
|
|
106
111
|
const placeholder = placeholderProp ?? messages.pickDate;
|
|
107
112
|
const calendar = useCalendarLocale(localeProp);
|
|
@@ -112,11 +117,11 @@ const DatePicker = React.forwardRef(
|
|
|
112
117
|
const invalid = typed !== void 0 && (!isValid(typed) || minDate !== void 0 && typed < minDate || maxDate !== void 0 && typed > maxDate || disabledDates !== void 0 && dateMatchModifiers(typed, disabledDates));
|
|
113
118
|
const commit = () => {
|
|
114
119
|
if (text === null || invalid) return;
|
|
115
|
-
|
|
120
|
+
change(typed);
|
|
116
121
|
setText(null);
|
|
117
122
|
};
|
|
118
123
|
const pick = (date) => {
|
|
119
|
-
|
|
124
|
+
change(date);
|
|
120
125
|
setText(null);
|
|
121
126
|
setOpen(false);
|
|
122
127
|
};
|
|
@@ -3,6 +3,9 @@ import type { Locale } from 'date-fns';
|
|
|
3
3
|
export interface DateTimePickerProps {
|
|
4
4
|
/** Date and time in the reader's local time. */
|
|
5
5
|
value?: Date;
|
|
6
|
+
/** Called with the new value. */
|
|
7
|
+
onValueChange?: (value: Date | undefined) => void;
|
|
8
|
+
/** @deprecated 8.5: use `onValueChange` (the name every other Nexub input, and React Native, uses). Removed in 9.0. */
|
|
6
9
|
onChange?: (value: Date | undefined) => void;
|
|
7
10
|
/** Time used when a date is picked first. @default '09:00' */
|
|
8
11
|
defaultTime?: string;
|
|
@@ -17,4 +20,4 @@ export interface DateTimePickerProps {
|
|
|
17
20
|
locale?: Locale;
|
|
18
21
|
}
|
|
19
22
|
/** A DatePicker and a TimePicker that edit one `Date` together. */
|
|
20
|
-
export declare function DateTimePicker({ value, onChange, defaultTime, minuteStep, minDate, maxDate, disabled, timeZone, 'aria-label': ariaLabel, className, locale, }: DateTimePickerProps): React.JSX.Element;
|
|
23
|
+
export declare function DateTimePicker({ value, onValueChange, onChange, defaultTime, minuteStep, minDate, maxDate, disabled, timeZone, 'aria-label': ariaLabel, className, locale, }: DateTimePickerProps): React.JSX.Element;
|
|
@@ -15,6 +15,7 @@ const withTime = (d, time) => {
|
|
|
15
15
|
};
|
|
16
16
|
function DateTimePicker({
|
|
17
17
|
value,
|
|
18
|
+
onValueChange,
|
|
18
19
|
onChange,
|
|
19
20
|
defaultTime = "09:00",
|
|
20
21
|
minuteStep,
|
|
@@ -26,6 +27,10 @@ function DateTimePicker({
|
|
|
26
27
|
className,
|
|
27
28
|
locale
|
|
28
29
|
}) {
|
|
30
|
+
const change = (v) => {
|
|
31
|
+
onValueChange?.(v);
|
|
32
|
+
onChange?.(v);
|
|
33
|
+
};
|
|
29
34
|
const messages = useNexubMessages();
|
|
30
35
|
const intlLocale = useIntlLocale();
|
|
31
36
|
const [pendingTime, setPendingTime] = React.useState(defaultTime);
|
|
@@ -37,7 +42,7 @@ function DateTimePicker({
|
|
|
37
42
|
{
|
|
38
43
|
"aria-label": messages.dateLabel,
|
|
39
44
|
value,
|
|
40
|
-
|
|
45
|
+
onValueChange: (date) => change(date ? withTime(date, time) : void 0),
|
|
41
46
|
minDate,
|
|
42
47
|
maxDate,
|
|
43
48
|
disabled,
|
|
@@ -54,7 +59,7 @@ function DateTimePicker({
|
|
|
54
59
|
disabled,
|
|
55
60
|
onValueChange: (next) => {
|
|
56
61
|
if (!next) return;
|
|
57
|
-
if (value)
|
|
62
|
+
if (value) change(withTime(value, next));
|
|
58
63
|
else setPendingTime(next);
|
|
59
64
|
}
|
|
60
65
|
}
|
|
@@ -9,6 +9,9 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
9
9
|
showSteppers?: boolean;
|
|
10
10
|
value?: number;
|
|
11
11
|
defaultValue?: number;
|
|
12
|
+
/** Called with the new value. */
|
|
13
|
+
onValueChange?: (value: number) => void;
|
|
14
|
+
/** @deprecated 8.5: use `onValueChange` (the name every other Nexub input, and React Native, uses). Removed in 9.0. */
|
|
12
15
|
onChange?: (value: number) => void;
|
|
13
16
|
invalid?: boolean;
|
|
14
17
|
}
|
|
@@ -26,19 +26,24 @@ const NumberInput = React.forwardRef(
|
|
|
26
26
|
showSteppers = false,
|
|
27
27
|
value,
|
|
28
28
|
defaultValue = 0,
|
|
29
|
+
onValueChange,
|
|
29
30
|
onChange,
|
|
30
31
|
invalid,
|
|
31
32
|
disabled,
|
|
32
33
|
...props
|
|
33
34
|
}, ref) => {
|
|
34
35
|
const [internalValue, setInternalValue] = React.useState(defaultValue);
|
|
36
|
+
const change = (v) => {
|
|
37
|
+
onValueChange?.(v);
|
|
38
|
+
onChange?.(v);
|
|
39
|
+
};
|
|
35
40
|
const messages = useNexubMessages();
|
|
36
41
|
const controlled = value !== void 0;
|
|
37
42
|
const currentValue = controlled ? value : internalValue;
|
|
38
43
|
const commit = (next) => {
|
|
39
44
|
const clamped = clampValue(next, min, max);
|
|
40
45
|
if (!controlled) setInternalValue(clamped);
|
|
41
|
-
|
|
46
|
+
change(clamped);
|
|
42
47
|
};
|
|
43
48
|
const handleChange = (e) => {
|
|
44
49
|
const parsed = parseFloat(e.target.value);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexub/react",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.5.0",
|
|
4
4
|
"description": "React component library for Nexub Design System — 90+ accessible, themeable UI components built on Radix UI primitives.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -86,14 +86,14 @@
|
|
|
86
86
|
"get-nonce": "^1.0.1",
|
|
87
87
|
"react-day-picker": "^10.0.2",
|
|
88
88
|
"tailwind-merge": "^3.7.0",
|
|
89
|
-
"@nexub/core": "8.
|
|
90
|
-
"@nexub/icons": "8.
|
|
89
|
+
"@nexub/core": "8.5.0",
|
|
90
|
+
"@nexub/icons": "8.5.0"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
93
|
"react": ">=19 <20",
|
|
94
94
|
"react-dom": ">=19 <20",
|
|
95
95
|
"@tanstack/react-virtual": "^3.14.22",
|
|
96
|
-
"@nexub/tokens": "^8.
|
|
96
|
+
"@nexub/tokens": "^8.5.0"
|
|
97
97
|
},
|
|
98
98
|
"peerDependenciesMeta": {
|
|
99
99
|
"@tanstack/react-virtual": {
|
|
@@ -126,8 +126,8 @@
|
|
|
126
126
|
"vaul": "1.1.2",
|
|
127
127
|
"vite": "^8.3.5",
|
|
128
128
|
"vitest": "^5.0.5",
|
|
129
|
-
"@nexub/themes": "8.
|
|
130
|
-
"@nexub/tokens": "8.
|
|
129
|
+
"@nexub/themes": "8.5.0",
|
|
130
|
+
"@nexub/tokens": "8.5.0"
|
|
131
131
|
},
|
|
132
132
|
"scripts": {
|
|
133
133
|
"build": "rm -rf dist && tsup && tsc -p tsconfig.build.json && rm -f dist/vendor/*.d.ts && node scripts/check-dts.mjs && tailwindcss -i src/styles.css -o dist/styles.css --minify && cp -R ../themes/src/fonts dist/fonts",
|