@povio/ui 3.4.0-rc.1 → 3.4.0-rc.11
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/inputs/Checkbox/Checkbox.d.ts +2 -1
- package/dist/components/inputs/Checkbox/Checkbox.js +100 -93
- package/dist/components/inputs/Checkbox/CheckboxGroup.d.ts +2 -1
- package/dist/components/inputs/Checkbox/CheckboxGroup.js +113 -109
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +2 -1
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +21 -14
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +2 -1
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +22 -14
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +2 -1
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +21 -14
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +2 -1
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +294 -275
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +10 -1
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +46 -43
- package/dist/components/inputs/File/FileUpload.d.ts +1 -1
- package/dist/components/inputs/File/FileUpload.js +17 -17
- package/dist/components/inputs/File/InputUpload.d.ts +1 -1
- package/dist/components/inputs/File/InputUpload.js +17 -17
- package/dist/components/inputs/File/fileUpload.types.d.ts +1 -1
- package/dist/components/inputs/File/inputUpload.types.d.ts +1 -1
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +1 -1
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +19 -19
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +1 -1
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +18 -18
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.d.ts +1 -1
- package/dist/components/inputs/Input/TextArea/TextArea.d.ts +1 -1
- package/dist/components/inputs/Input/TextArea/TextArea.js +18 -18
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +2 -2
- package/dist/components/inputs/Input/TextInput/TextInput.js +38 -36
- package/dist/components/inputs/Inputs/Form.d.ts +4 -4
- package/dist/components/inputs/Inputs/InputItem.d.ts +22 -22
- package/dist/components/inputs/Inputs/InputItem.js +36 -35
- package/dist/components/inputs/Inputs/Inputs.d.ts +2 -2
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +2 -1
- package/dist/components/inputs/RadioGroup/RadioGroup.js +111 -107
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +1 -1
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +13 -13
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +1 -1
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +19 -19
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +1 -1
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +1 -1
- package/dist/components/inputs/Selection/Select/QuerySelect.js +19 -19
- package/dist/components/inputs/Selection/Select/Select.d.ts +1 -1
- package/dist/components/inputs/Selection/Select/Select.js +19 -19
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +1 -0
- package/dist/components/inputs/Selection/shared/SelectBase.js +37 -34
- package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/select.context.js +8 -4
- package/dist/components/inputs/Selection/shared/select.types.d.ts +1 -1
- package/dist/components/inputs/Slider/Slider.d.ts +1 -1
- package/dist/components/inputs/Slider/Slider.js +18 -18
- package/dist/components/inputs/TextEditor/TextEditor.d.ts +1 -1
- package/dist/components/inputs/TextEditor/TextEditor.js +18 -18
- package/dist/components/inputs/Toggle/Toggle.d.ts +2 -1
- package/dist/components/inputs/Toggle/Toggle.js +63 -59
- package/dist/components/inputs/shared/form.types.d.ts +8 -9
- package/dist/components/segment/Segment.d.ts +1 -1
- package/dist/components/segment/Segment.js +17 -17
- package/dist/components/segment/segment.types.d.ts +1 -1
- package/dist/config/uiConfig.context.d.ts +5 -5
- package/dist/config/uiConfig.context.js +12 -3
- package/dist/helpers/dynamicColumns.d.ts +1 -1
- package/dist/helpers/dynamicInputs.d.ts +7 -7
- package/dist/hooks/useAutosave.d.ts +4 -4
- package/dist/hooks/useAutosave.js +49 -64
- package/dist/hooks/useAutosave.spec.d.ts +1 -0
- package/dist/hooks/useForm.d.ts +15 -39
- package/dist/hooks/useForm.js +43 -96
- package/dist/hooks/useFormAutosave.d.ts +9 -8
- package/dist/hooks/useFormAutosave.js +9 -23
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/package.json +3 -2
- package/dist/components/inputs/shared/form.binding.d.ts +0 -27
- package/dist/components/inputs/shared/form.binding.js +0 -57
- package/dist/components/inputs/shared/form.types.js +0 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentType, ReactElement, Ref, SVGProps } from 'react';
|
|
2
2
|
import { CheckboxProps as AriaCheckboxProps } from 'react-aria-components';
|
|
3
|
-
import { FieldValues } from '
|
|
3
|
+
import { FieldValues } from 'react-hook-form';
|
|
4
4
|
import { CheckboxVariantProps } from './checkbox.cva';
|
|
5
5
|
import { FormFieldErrorProps } from '../FormField/FormFieldError';
|
|
6
6
|
import { ControlProps } from '../shared/form.types';
|
|
@@ -9,6 +9,7 @@ export interface CheckboxBaseProps extends FormFieldErrorProps, CheckboxVariantP
|
|
|
9
9
|
children: string | ReactElement;
|
|
10
10
|
hideLabel?: boolean;
|
|
11
11
|
hideError?: boolean;
|
|
12
|
+
fireBlurOnChange?: boolean;
|
|
12
13
|
selectedIcon?: ComponentType<SVGProps<SVGSVGElement>>;
|
|
13
14
|
indeterminateIcon?: ComponentType<SVGProps<SVGSVGElement>>;
|
|
14
15
|
isDirty?: boolean;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { UIOverrides } from "../../../config/uiOverrides.context.js";
|
|
2
2
|
import { UIConfig } from "../../../config/uiConfig.context.js";
|
|
3
|
-
import { FieldController } from "../shared/form.binding.js";
|
|
4
3
|
import { checkboxContentClassName, checkboxIndicatorClass, checkboxTypography } from "./checkbox.cva.js";
|
|
5
4
|
import { FormFieldError } from "../FormField/FormFieldError.js";
|
|
6
5
|
import { CheckContent } from "../shared/CheckContent.js";
|
|
@@ -10,15 +9,17 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
10
9
|
import { clsx } from "clsx";
|
|
11
10
|
import { Checkbox } from "react-aria-components";
|
|
12
11
|
import { mergeRefs } from "@react-aria/utils";
|
|
12
|
+
import { Controller } from "react-hook-form";
|
|
13
13
|
//#region src/components/inputs/Checkbox/Checkbox.tsx
|
|
14
14
|
var CheckboxBase = (props) => {
|
|
15
|
-
const $ = c(
|
|
15
|
+
const $ = c(54);
|
|
16
16
|
const ui = UIConfig.useConfig();
|
|
17
17
|
const checkboxTypographyMap = UIOverrides.useMapper("checkbox.typography", checkboxTypography);
|
|
18
18
|
const checkboxContentClassNameMap = UIOverrides.useMapper("checkbox.contentClassName", checkboxContentClassName);
|
|
19
19
|
let children;
|
|
20
20
|
let className;
|
|
21
21
|
let error;
|
|
22
|
+
let fireBlurOnChangeProp;
|
|
22
23
|
let hideError;
|
|
23
24
|
let hideLabelProp;
|
|
24
25
|
let isDisabled;
|
|
@@ -29,55 +30,61 @@ var CheckboxBase = (props) => {
|
|
|
29
30
|
let rest;
|
|
30
31
|
let variantProp;
|
|
31
32
|
if ($[0] !== props) {
|
|
32
|
-
({className, children, isDisabled, isRequired, error, hideError, labelClassName, variant: variantProp, hideLabel: hideLabelProp, onChange, onBlur, ...rest} = props);
|
|
33
|
+
({className, children, isDisabled, isRequired, error, hideError, labelClassName, variant: variantProp, hideLabel: hideLabelProp, fireBlurOnChange: fireBlurOnChangeProp, onChange, onBlur, ...rest} = props);
|
|
33
34
|
$[0] = props;
|
|
34
35
|
$[1] = children;
|
|
35
36
|
$[2] = className;
|
|
36
37
|
$[3] = error;
|
|
37
|
-
$[4] =
|
|
38
|
-
$[5] =
|
|
39
|
-
$[6] =
|
|
40
|
-
$[7] =
|
|
41
|
-
$[8] =
|
|
42
|
-
$[9] =
|
|
43
|
-
$[10] =
|
|
44
|
-
$[11] =
|
|
45
|
-
$[12] =
|
|
38
|
+
$[4] = fireBlurOnChangeProp;
|
|
39
|
+
$[5] = hideError;
|
|
40
|
+
$[6] = hideLabelProp;
|
|
41
|
+
$[7] = isDisabled;
|
|
42
|
+
$[8] = isRequired;
|
|
43
|
+
$[9] = labelClassName;
|
|
44
|
+
$[10] = onBlur;
|
|
45
|
+
$[11] = onChange;
|
|
46
|
+
$[12] = rest;
|
|
47
|
+
$[13] = variantProp;
|
|
46
48
|
} else {
|
|
47
49
|
children = $[1];
|
|
48
50
|
className = $[2];
|
|
49
51
|
error = $[3];
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
fireBlurOnChangeProp = $[4];
|
|
53
|
+
hideError = $[5];
|
|
54
|
+
hideLabelProp = $[6];
|
|
55
|
+
isDisabled = $[7];
|
|
56
|
+
isRequired = $[8];
|
|
57
|
+
labelClassName = $[9];
|
|
58
|
+
onBlur = $[10];
|
|
59
|
+
onChange = $[11];
|
|
60
|
+
rest = $[12];
|
|
61
|
+
variantProp = $[13];
|
|
59
62
|
}
|
|
60
63
|
const variant = variantProp ?? ui.checkbox.variant;
|
|
61
64
|
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
65
|
+
const fireBlurOnChange = fireBlurOnChangeProp ?? ui.checkbox.fireBlurOnChange;
|
|
62
66
|
let t0;
|
|
63
|
-
if ($[
|
|
67
|
+
if ($[14] !== error || $[15] !== isDisabled) {
|
|
64
68
|
t0 = {
|
|
65
69
|
error,
|
|
66
70
|
isDisabled
|
|
67
71
|
};
|
|
68
|
-
$[
|
|
69
|
-
$[
|
|
70
|
-
$[
|
|
71
|
-
} else t0 = $[
|
|
72
|
+
$[14] = error;
|
|
73
|
+
$[15] = isDisabled;
|
|
74
|
+
$[16] = t0;
|
|
75
|
+
} else t0 = $[16];
|
|
72
76
|
const formFieldErrorProps = t0;
|
|
73
77
|
let t1;
|
|
74
|
-
if ($[
|
|
78
|
+
if ($[17] !== fireBlurOnChange || $[18] !== onBlur || $[19] !== onChange) {
|
|
75
79
|
t1 = (isSelected) => {
|
|
76
80
|
onChange?.(isSelected);
|
|
81
|
+
if (fireBlurOnChange) onBlur?.({});
|
|
77
82
|
};
|
|
78
|
-
$[
|
|
79
|
-
$[
|
|
80
|
-
|
|
83
|
+
$[17] = fireBlurOnChange;
|
|
84
|
+
$[18] = onBlur;
|
|
85
|
+
$[19] = onChange;
|
|
86
|
+
$[20] = t1;
|
|
87
|
+
} else t1 = $[20];
|
|
81
88
|
const handleChange = t1;
|
|
82
89
|
const t2 = !!error;
|
|
83
90
|
const t3 = hideLabel && typeof children === "string" ? children : void 0;
|
|
@@ -85,23 +92,23 @@ var CheckboxBase = (props) => {
|
|
|
85
92
|
const t5 = props.isDirty || void 0;
|
|
86
93
|
const t6 = props.isRequired || void 0;
|
|
87
94
|
let t7;
|
|
88
|
-
if ($[
|
|
95
|
+
if ($[21] !== className) {
|
|
89
96
|
t7 = clsx("relative", checkboxIndicatorClass, className);
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
92
|
-
} else t7 = $[
|
|
97
|
+
$[21] = className;
|
|
98
|
+
$[22] = t7;
|
|
99
|
+
} else t7 = $[22];
|
|
93
100
|
let t8;
|
|
94
|
-
if ($[
|
|
101
|
+
if ($[23] !== rest || $[24] !== variant) {
|
|
95
102
|
t8 = /* @__PURE__ */ jsx(CheckboxCheckmark, {
|
|
96
103
|
variant,
|
|
97
104
|
...rest
|
|
98
105
|
});
|
|
99
|
-
$[
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
102
|
-
} else t8 = $[
|
|
106
|
+
$[23] = rest;
|
|
107
|
+
$[24] = variant;
|
|
108
|
+
$[25] = t8;
|
|
109
|
+
} else t8 = $[25];
|
|
103
110
|
let t9;
|
|
104
|
-
if ($[
|
|
111
|
+
if ($[26] !== checkboxContentClassNameMap || $[27] !== checkboxTypographyMap || $[28] !== children || $[29] !== hideLabel || $[30] !== labelClassName || $[31] !== rest || $[32] !== variant) {
|
|
105
112
|
t9 = !hideLabel && /* @__PURE__ */ jsx(CheckContent, {
|
|
106
113
|
typography: checkboxTypographyMap({
|
|
107
114
|
variant,
|
|
@@ -114,17 +121,17 @@ var CheckboxBase = (props) => {
|
|
|
114
121
|
className: labelClassName,
|
|
115
122
|
children
|
|
116
123
|
});
|
|
117
|
-
$[
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
121
|
-
$[
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
125
|
-
} else t9 = $[
|
|
124
|
+
$[26] = checkboxContentClassNameMap;
|
|
125
|
+
$[27] = checkboxTypographyMap;
|
|
126
|
+
$[28] = children;
|
|
127
|
+
$[29] = hideLabel;
|
|
128
|
+
$[30] = labelClassName;
|
|
129
|
+
$[31] = rest;
|
|
130
|
+
$[32] = variant;
|
|
131
|
+
$[33] = t9;
|
|
132
|
+
} else t9 = $[33];
|
|
126
133
|
let t10;
|
|
127
|
-
if ($[
|
|
134
|
+
if ($[34] !== handleChange || $[35] !== isDisabled || $[36] !== isRequired || $[37] !== onBlur || $[38] !== rest || $[39] !== t2 || $[40] !== t3 || $[41] !== t4 || $[42] !== t5 || $[43] !== t6 || $[44] !== t7 || $[45] !== t8 || $[46] !== t9) {
|
|
128
135
|
t10 = /* @__PURE__ */ jsxs(Checkbox, {
|
|
129
136
|
...rest,
|
|
130
137
|
isDisabled,
|
|
@@ -139,68 +146,68 @@ var CheckboxBase = (props) => {
|
|
|
139
146
|
className: t7,
|
|
140
147
|
children: [t8, t9]
|
|
141
148
|
});
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
} else t10 = $[
|
|
149
|
+
$[34] = handleChange;
|
|
150
|
+
$[35] = isDisabled;
|
|
151
|
+
$[36] = isRequired;
|
|
152
|
+
$[37] = onBlur;
|
|
153
|
+
$[38] = rest;
|
|
154
|
+
$[39] = t2;
|
|
155
|
+
$[40] = t3;
|
|
156
|
+
$[41] = t4;
|
|
157
|
+
$[42] = t5;
|
|
158
|
+
$[43] = t6;
|
|
159
|
+
$[44] = t7;
|
|
160
|
+
$[45] = t8;
|
|
161
|
+
$[46] = t9;
|
|
162
|
+
$[47] = t10;
|
|
163
|
+
} else t10 = $[47];
|
|
157
164
|
let t11;
|
|
158
|
-
if ($[
|
|
165
|
+
if ($[48] !== formFieldErrorProps || $[49] !== hideError) {
|
|
159
166
|
t11 = !hideError && /* @__PURE__ */ jsx(FormFieldError, { ...formFieldErrorProps });
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
} else t11 = $[
|
|
167
|
+
$[48] = formFieldErrorProps;
|
|
168
|
+
$[49] = hideError;
|
|
169
|
+
$[50] = t11;
|
|
170
|
+
} else t11 = $[50];
|
|
164
171
|
let t12;
|
|
165
|
-
if ($[
|
|
172
|
+
if ($[51] !== t10 || $[52] !== t11) {
|
|
166
173
|
t12 = /* @__PURE__ */ jsxs(Fragment, { children: [t10, t11] });
|
|
167
|
-
$[
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
} else t12 = $[
|
|
174
|
+
$[51] = t10;
|
|
175
|
+
$[52] = t11;
|
|
176
|
+
$[53] = t12;
|
|
177
|
+
} else t12 = $[53];
|
|
171
178
|
return t12;
|
|
172
179
|
};
|
|
173
180
|
var Checkbox$1 = (props) => {
|
|
174
181
|
const $ = c(15);
|
|
175
|
-
if ("
|
|
176
|
-
let
|
|
182
|
+
if ("formControl" in props && props.formControl) {
|
|
183
|
+
let formControl;
|
|
177
184
|
let innerProps;
|
|
178
185
|
let ref;
|
|
179
186
|
if ($[0] !== props) {
|
|
180
|
-
({
|
|
187
|
+
({formControl, ref, ...innerProps} = props);
|
|
181
188
|
$[0] = props;
|
|
182
|
-
$[1] =
|
|
189
|
+
$[1] = formControl;
|
|
183
190
|
$[2] = innerProps;
|
|
184
191
|
$[3] = ref;
|
|
185
192
|
} else {
|
|
186
|
-
|
|
193
|
+
formControl = $[1];
|
|
187
194
|
innerProps = $[2];
|
|
188
195
|
ref = $[3];
|
|
189
196
|
}
|
|
190
197
|
let t0;
|
|
191
198
|
if ($[4] !== innerProps || $[5] !== props.error || $[6] !== props.isDisabled || $[7] !== ref) {
|
|
192
199
|
t0 = (t1) => {
|
|
193
|
-
const { field
|
|
200
|
+
const { field, fieldState: t2 } = t1;
|
|
194
201
|
const { error, isDirty } = t2;
|
|
195
202
|
return /* @__PURE__ */ jsx(CheckboxBase, {
|
|
196
203
|
...innerProps,
|
|
197
|
-
ref: mergeRefs(ref,
|
|
198
|
-
isSelected:
|
|
199
|
-
onChange:
|
|
200
|
-
onBlur:
|
|
201
|
-
name:
|
|
204
|
+
ref: mergeRefs(ref, field.ref),
|
|
205
|
+
isSelected: field.value,
|
|
206
|
+
onChange: field.onChange,
|
|
207
|
+
onBlur: field.onBlur,
|
|
208
|
+
name: field.name,
|
|
202
209
|
isDirty,
|
|
203
|
-
isDisabled:
|
|
210
|
+
isDisabled: field.disabled || props.isDisabled,
|
|
204
211
|
error: props.error ?? error?.message
|
|
205
212
|
});
|
|
206
213
|
};
|
|
@@ -211,14 +218,14 @@ var Checkbox$1 = (props) => {
|
|
|
211
218
|
$[8] = t0;
|
|
212
219
|
} else t0 = $[8];
|
|
213
220
|
let t1;
|
|
214
|
-
if ($[9] !==
|
|
215
|
-
t1 = /* @__PURE__ */ jsx(
|
|
216
|
-
control:
|
|
217
|
-
name:
|
|
221
|
+
if ($[9] !== formControl.control || $[10] !== formControl.name || $[11] !== t0) {
|
|
222
|
+
t1 = /* @__PURE__ */ jsx(Controller, {
|
|
223
|
+
control: formControl.control,
|
|
224
|
+
name: formControl.name,
|
|
218
225
|
render: t0
|
|
219
226
|
});
|
|
220
|
-
$[9] =
|
|
221
|
-
$[10] =
|
|
227
|
+
$[9] = formControl.control;
|
|
228
|
+
$[10] = formControl.name;
|
|
222
229
|
$[11] = t0;
|
|
223
230
|
$[12] = t1;
|
|
224
231
|
} else t1 = $[12];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactElement, Ref } from 'react';
|
|
2
2
|
import { CheckboxGroupProps as AriaCheckboxGroupProps } from 'react-aria-components';
|
|
3
|
-
import { FieldValues } from '
|
|
3
|
+
import { FieldValues } from 'react-hook-form';
|
|
4
4
|
import { CheckboxVariantProps } from './checkbox.cva';
|
|
5
5
|
import { FormFieldProps } from '../FormField/FormField';
|
|
6
6
|
import { ControlProps } from '../shared/form.types';
|
|
@@ -18,6 +18,7 @@ interface CheckboxGroupBaseProps extends Omit<FormFieldProps, "variant">, Checkb
|
|
|
18
18
|
isDirty?: boolean;
|
|
19
19
|
inputClassName?: string;
|
|
20
20
|
labelClassName?: string;
|
|
21
|
+
fireBlurOnChange?: boolean;
|
|
21
22
|
}
|
|
22
23
|
export interface CheckboxGroupProps extends CheckboxGroupBaseProps {
|
|
23
24
|
}
|