@ultraviolet/form 3.10.6 → 3.11.1
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/dist/components/SliderField/index.cjs +1 -1
- package/dist/components/SliderField/index.js +1 -1
- package/dist/components/TextAreaField/index.cjs +2 -1
- package/dist/components/TextAreaField/index.d.ts +1 -1
- package/dist/components/TextAreaField/index.js +2 -1
- package/dist/components/ToggleGroupField/index.d.ts +2 -2
- package/dist/validators/index.d.ts +2 -2
- package/dist/validators/maxDate.cjs +1 -1
- package/dist/validators/maxDate.d.ts +1 -1
- package/dist/validators/maxDate.js +1 -1
- package/dist/validators/minDate.cjs +1 -1
- package/dist/validators/minDate.d.ts +1 -1
- package/dist/validators/minDate.js +1 -1
- package/package.json +3 -3
|
@@ -59,7 +59,7 @@ const SliderField = ({
|
|
|
59
59
|
onBlur?.(event);
|
|
60
60
|
}, onChange: (newValue) => {
|
|
61
61
|
if (options) {
|
|
62
|
-
const processedValue = !Array.isArray(newValue) ? options[newValue]
|
|
62
|
+
const processedValue = !Array.isArray(newValue) ? options[newValue]?.value : newValue.map((val) => val ? options[val]?.value : options[0]?.value);
|
|
63
63
|
field.onChange(processedValue);
|
|
64
64
|
onChange?.(processedValue);
|
|
65
65
|
} else {
|
|
@@ -57,7 +57,7 @@ const SliderField = ({
|
|
|
57
57
|
onBlur?.(event);
|
|
58
58
|
}, onChange: (newValue) => {
|
|
59
59
|
if (options) {
|
|
60
|
-
const processedValue = !Array.isArray(newValue) ? options[newValue]
|
|
60
|
+
const processedValue = !Array.isArray(newValue) ? options[newValue]?.value : newValue.map((val) => val ? options[val]?.value : options[0]?.value);
|
|
61
61
|
field.onChange(processedValue);
|
|
62
62
|
onChange?.(processedValue);
|
|
63
63
|
} else {
|
|
@@ -23,6 +23,7 @@ const TextAreaField = ({
|
|
|
23
23
|
onFocus,
|
|
24
24
|
onBlur,
|
|
25
25
|
onKeyDown,
|
|
26
|
+
maxRows,
|
|
26
27
|
placeholder,
|
|
27
28
|
readOnly,
|
|
28
29
|
required,
|
|
@@ -87,7 +88,7 @@ const TextAreaField = ({
|
|
|
87
88
|
}, onChange: (event) => {
|
|
88
89
|
field.onChange(event);
|
|
89
90
|
onChange?.(event);
|
|
90
|
-
}, onFocus, onKeyDown: onKeyDownHandler, placeholder, readOnly, required, rows, success, tabIndex, tooltip, value: field.value, ...label ? {
|
|
91
|
+
}, onFocus, onKeyDown: onKeyDownHandler, placeholder, readOnly, required, rows, maxRows, success, tabIndex, tooltip, value: field.value, ...label ? {
|
|
91
92
|
label
|
|
92
93
|
} : {
|
|
93
94
|
"aria-label": ariaLabel
|
|
@@ -9,4 +9,4 @@ export type TextAreaFieldProps<TFieldValues extends FieldValues, TFieldName exte
|
|
|
9
9
|
/**
|
|
10
10
|
* This component offers a form field based on Ultraviolet UI TextArea component
|
|
11
11
|
*/
|
|
12
|
-
export declare const TextAreaField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ autoFocus, clearable, className, tabIndex, control, "data-testid": dataTestId, disabled, helper, label, labelDescription, onChange, minLength, maxLength, name, onFocus, onBlur, onKeyDown, placeholder, readOnly, required, rows, success, tooltip, regex: regexes, submitOnEnter, validate, "aria-label": ariaLabel, }: TextAreaFieldProps<TFieldValues, TFieldName>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const TextAreaField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ autoFocus, clearable, className, tabIndex, control, "data-testid": dataTestId, disabled, helper, label, labelDescription, onChange, minLength, maxLength, name, onFocus, onBlur, onKeyDown, maxRows, placeholder, readOnly, required, rows, success, tooltip, regex: regexes, submitOnEnter, validate, "aria-label": ariaLabel, }: TextAreaFieldProps<TFieldValues, TFieldName>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -21,6 +21,7 @@ const TextAreaField = ({
|
|
|
21
21
|
onFocus,
|
|
22
22
|
onBlur,
|
|
23
23
|
onKeyDown,
|
|
24
|
+
maxRows,
|
|
24
25
|
placeholder,
|
|
25
26
|
readOnly,
|
|
26
27
|
required,
|
|
@@ -85,7 +86,7 @@ const TextAreaField = ({
|
|
|
85
86
|
}, onChange: (event) => {
|
|
86
87
|
field.onChange(event);
|
|
87
88
|
onChange?.(event);
|
|
88
|
-
}, onFocus, onKeyDown: onKeyDownHandler, placeholder, readOnly, required, rows, success, tabIndex, tooltip, value: field.value, ...label ? {
|
|
89
|
+
}, onFocus, onKeyDown: onKeyDownHandler, placeholder, readOnly, required, rows, maxRows, success, tabIndex, tooltip, value: field.value, ...label ? {
|
|
89
90
|
label
|
|
90
91
|
} : {
|
|
91
92
|
"aria-label": ariaLabel
|
|
@@ -2,9 +2,9 @@ import { ToggleGroup } from '@ultraviolet/ui';
|
|
|
2
2
|
import type { ComponentProps } from 'react';
|
|
3
3
|
import type { FieldPath, FieldValues } from 'react-hook-form';
|
|
4
4
|
import type { BaseFieldProps } from '../../types';
|
|
5
|
-
type ToggleGroupFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Partial<Pick<ComponentProps<typeof ToggleGroup>, 'className' | 'helper' | 'direction' | 'children' | 'error' | 'legend'>> & Required<Pick<ComponentProps<typeof ToggleGroup>, 'legend'>>;
|
|
5
|
+
type ToggleGroupFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Partial<Pick<ComponentProps<typeof ToggleGroup>, 'className' | 'helper' | 'direction' | 'children' | 'error' | 'legend' | 'description'>> & Required<Pick<ComponentProps<typeof ToggleGroup>, 'legend'>>;
|
|
6
6
|
export declare const ToggleGroupField: {
|
|
7
|
-
<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ legend, control, className, helper, direction, children, onChange, label, error: customError, name, required, shouldUnregister, validate, }: ToggleGroupFieldProps<TFieldValues, TFieldName>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
7
|
+
<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ legend, control, className, helper, description, direction, children, onChange, label, error: customError, name, required, shouldUnregister, validate, }: ToggleGroupFieldProps<TFieldValues, TFieldName>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
8
|
Toggle: ({ disabled, name, value, label, helper, error, className, "data-testid": dataTestId, }: Omit<{
|
|
9
9
|
id?: string;
|
|
10
10
|
checked?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
minDate: (
|
|
3
|
-
maxDate: (maxDate?: Date) => (value: Date) => boolean;
|
|
2
|
+
minDate: (maxDate?: Date) => (value: Date | [Date, Date]) => boolean;
|
|
3
|
+
maxDate: (maxDate?: Date) => (value: Date | [Date, Date]) => boolean;
|
|
4
4
|
};
|
|
5
5
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const maxDateValidator = (maxDate) => (value) => value === void 0 || maxDate === void 0 || value <= maxDate;
|
|
3
|
+
const maxDateValidator = (maxDate) => (value) => value === void 0 || maxDate === void 0 || (Array.isArray(value) ? value[1] <= maxDate : value <= maxDate);
|
|
4
4
|
exports.maxDateValidator = maxDateValidator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const maxDateValidator: (maxDate?: Date) => (value: Date) => boolean;
|
|
1
|
+
export declare const maxDateValidator: (maxDate?: Date) => (value: Date | [Date, Date]) => boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const maxDateValidator = (maxDate) => (value) => value === void 0 || maxDate === void 0 || value <= maxDate;
|
|
1
|
+
const maxDateValidator = (maxDate) => (value) => value === void 0 || maxDate === void 0 || (Array.isArray(value) ? value[1] <= maxDate : value <= maxDate);
|
|
2
2
|
export {
|
|
3
3
|
maxDateValidator
|
|
4
4
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const minDateValidator = (
|
|
3
|
+
const minDateValidator = (maxDate) => (value) => value === void 0 || maxDate === void 0 || (Array.isArray(value) ? value[0] >= maxDate : value >= maxDate);
|
|
4
4
|
exports.minDateValidator = minDateValidator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const minDateValidator: (
|
|
1
|
+
export declare const minDateValidator: (maxDate?: Date) => (value: Date | [Date, Date]) => boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const minDateValidator = (
|
|
1
|
+
const minDateValidator = (maxDate) => (value) => value === void 0 || maxDate === void 0 || (Array.isArray(value) ? value[0] >= maxDate : value >= maxDate);
|
|
2
2
|
export {
|
|
3
3
|
minDateValidator
|
|
4
4
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultraviolet/form",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.11.1",
|
|
4
4
|
"description": "Ultraviolet Form",
|
|
5
5
|
"homepage": "https://github.com/scaleway/ultraviolet#readme",
|
|
6
6
|
"repository": {
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
"@babel/runtime": "7.26.0",
|
|
72
72
|
"react-hook-form": "7.53.2",
|
|
73
73
|
"react-select": "5.8.3",
|
|
74
|
-
"@ultraviolet/
|
|
75
|
-
"@ultraviolet/
|
|
74
|
+
"@ultraviolet/themes": "1.15.0",
|
|
75
|
+
"@ultraviolet/ui": "1.77.1"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
78
|
"build:profile": "npx vite-bundle-visualizer -c vite.config.ts",
|