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