@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,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 { CheckContent } from "../shared/CheckContent.js";
|
|
5
4
|
import { FormFieldLabel } from "../FormField/FormFieldLabel.js";
|
|
6
5
|
import { FormField } from "../FormField/FormField.js";
|
|
@@ -12,9 +11,10 @@ import { clsx } from "clsx";
|
|
|
12
11
|
import { Radio, RadioGroup } from "react-aria-components";
|
|
13
12
|
import { useLabel } from "react-aria";
|
|
14
13
|
import { mergeRefs } from "@react-aria/utils";
|
|
14
|
+
import { Controller } from "react-hook-form";
|
|
15
15
|
//#region src/components/inputs/RadioGroup/RadioGroup.tsx
|
|
16
16
|
var RadioGroupBase = (props) => {
|
|
17
|
-
const $ = c(
|
|
17
|
+
const $ = c(91);
|
|
18
18
|
const ui = UIConfig.useConfig();
|
|
19
19
|
const radioCva = UIOverrides.useCva("radio.cva", radioDefinition);
|
|
20
20
|
const radioTypographyMap = UIOverrides.useMapper("radio.typography", radioTypography);
|
|
@@ -23,11 +23,12 @@ var RadioGroupBase = (props) => {
|
|
|
23
23
|
const inputBaseCva = UIOverrides.useCva("input.baseCva", inputBaseDefinition);
|
|
24
24
|
const inputSizeCva = UIOverrides.useCva("input.sizeCva", inputSizeDefinition);
|
|
25
25
|
const radioContentClassNameMap = UIOverrides.useMapper("radio.contentClassName", radioContentClassName);
|
|
26
|
-
const { ref, label, tooltipText, helperText, isDirty, isRequired, rightContent, isDisabled, headerClassName, errorClassName, labelClassName, inputClassName, isHeaderHidden, error, className, options, value, defaultValue, onChange, onBlur, as: asProp, size: sizeProp, variant: variantProp, hideLabel: hideLabelProp, ...rest } = props;
|
|
26
|
+
const { ref, label, tooltipText, helperText, isDirty, isRequired, rightContent, isDisabled, headerClassName, errorClassName, labelClassName, inputClassName, isHeaderHidden, error, className, options, value, defaultValue, onChange, onBlur, fireBlurOnChange: fireBlurOnChangeProp, as: asProp, size: sizeProp, variant: variantProp, hideLabel: hideLabelProp, ...rest } = props;
|
|
27
27
|
const as = asProp ?? ui.input.as;
|
|
28
28
|
const size = sizeProp ?? ui.input.size;
|
|
29
29
|
const variant = variantProp ?? ui.radioGroup.variant;
|
|
30
30
|
const hideLabel = hideLabelProp ?? ui.radioGroup.hideLabel;
|
|
31
|
+
const fireBlurOnChange = fireBlurOnChangeProp ?? ui.radioGroup.fireBlurOnChange;
|
|
31
32
|
const radioClassName = radioCva({
|
|
32
33
|
variant,
|
|
33
34
|
...rest
|
|
@@ -108,13 +109,16 @@ var RadioGroupBase = (props) => {
|
|
|
108
109
|
const selectedValue = value ?? defaultValue;
|
|
109
110
|
const shouldRenderInputFrame = as !== "default";
|
|
110
111
|
let t5;
|
|
111
|
-
if ($[25] !== onChange) {
|
|
112
|
+
if ($[25] !== fireBlurOnChange || $[26] !== onBlur || $[27] !== onChange) {
|
|
112
113
|
t5 = (nextValue) => {
|
|
113
114
|
onChange?.(nextValue);
|
|
115
|
+
if (fireBlurOnChange) onBlur?.({});
|
|
114
116
|
};
|
|
115
|
-
$[25] =
|
|
116
|
-
$[26] =
|
|
117
|
-
|
|
117
|
+
$[25] = fireBlurOnChange;
|
|
118
|
+
$[26] = onBlur;
|
|
119
|
+
$[27] = onChange;
|
|
120
|
+
$[28] = t5;
|
|
121
|
+
} else t5 = $[28];
|
|
118
122
|
const handleChange = t5;
|
|
119
123
|
const T0 = RadioGroup;
|
|
120
124
|
const t6 = !!error;
|
|
@@ -124,26 +128,26 @@ var RadioGroupBase = (props) => {
|
|
|
124
128
|
const T1 = FormField;
|
|
125
129
|
const t10 = as === "inline" && "h-full";
|
|
126
130
|
let t11;
|
|
127
|
-
if ($[
|
|
131
|
+
if ($[29] !== className || $[30] !== t10) {
|
|
128
132
|
t11 = clsx("w-full", t10, className);
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
} else t11 = $[
|
|
133
|
+
$[29] = className;
|
|
134
|
+
$[30] = t10;
|
|
135
|
+
$[31] = t11;
|
|
136
|
+
} else t11 = $[31];
|
|
133
137
|
const t12 = as === "inline" ? -1 : void 0;
|
|
134
138
|
let t13;
|
|
135
|
-
if ($[
|
|
139
|
+
if ($[32] !== as || $[33] !== inputBaseCva || $[34] !== inputClassName || $[35] !== shouldRenderInputFrame || $[36] !== ui) {
|
|
136
140
|
t13 = clsx("group/radio-group-content relative", shouldRenderInputFrame && inputBaseCva({
|
|
137
141
|
variant: ui.input.variant,
|
|
138
142
|
as
|
|
139
143
|
}), inputClassName);
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
146
|
-
} else t13 = $[
|
|
144
|
+
$[32] = as;
|
|
145
|
+
$[33] = inputBaseCva;
|
|
146
|
+
$[34] = inputClassName;
|
|
147
|
+
$[35] = shouldRenderInputFrame;
|
|
148
|
+
$[36] = ui;
|
|
149
|
+
$[37] = t13;
|
|
150
|
+
} else t13 = $[37];
|
|
147
151
|
const t14 = "";
|
|
148
152
|
const t15 = isDisabled || void 0;
|
|
149
153
|
const t16 = isDisabled || void 0;
|
|
@@ -162,17 +166,17 @@ var RadioGroupBase = (props) => {
|
|
|
162
166
|
const t21 = isDirty || void 0;
|
|
163
167
|
const t22 = isRequired || void 0;
|
|
164
168
|
let t23;
|
|
165
|
-
if ($[
|
|
169
|
+
if ($[38] !== as || $[39] !== headerProps || $[40] !== size) {
|
|
166
170
|
t23 = as && ["filter", "floating"].includes(as) && /* @__PURE__ */ jsx(FormFieldLabel, {
|
|
167
171
|
as,
|
|
168
172
|
size,
|
|
169
173
|
...headerProps
|
|
170
174
|
});
|
|
171
|
-
$[
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
175
|
-
} else t23 = $[
|
|
175
|
+
$[38] = as;
|
|
176
|
+
$[39] = headerProps;
|
|
177
|
+
$[40] = size;
|
|
178
|
+
$[41] = t23;
|
|
179
|
+
} else t23 = $[41];
|
|
176
180
|
const t24 = radioContentRowCva({
|
|
177
181
|
variant,
|
|
178
182
|
as,
|
|
@@ -180,9 +184,9 @@ var RadioGroupBase = (props) => {
|
|
|
180
184
|
...rest
|
|
181
185
|
});
|
|
182
186
|
let t25;
|
|
183
|
-
if ($[
|
|
187
|
+
if ($[42] !== labelClassName || $[43] !== options || $[44] !== radioClassName || $[45] !== radioContentClassNameValue || $[46] !== radioTypographyProps) {
|
|
184
188
|
let t26;
|
|
185
|
-
if ($[
|
|
189
|
+
if ($[48] !== labelClassName || $[49] !== radioClassName || $[50] !== radioContentClassNameValue || $[51] !== radioTypographyProps) {
|
|
186
190
|
t26 = (option) => /* @__PURE__ */ jsxs(Radio, {
|
|
187
191
|
value: option.value,
|
|
188
192
|
className: clsx("relative", radioIndicatorClass),
|
|
@@ -193,47 +197,47 @@ var RadioGroupBase = (props) => {
|
|
|
193
197
|
children: option.label
|
|
194
198
|
})]
|
|
195
199
|
}, option.value);
|
|
196
|
-
$[
|
|
197
|
-
$[
|
|
198
|
-
$[
|
|
199
|
-
$[
|
|
200
|
-
$[
|
|
201
|
-
} else t26 = $[
|
|
200
|
+
$[48] = labelClassName;
|
|
201
|
+
$[49] = radioClassName;
|
|
202
|
+
$[50] = radioContentClassNameValue;
|
|
203
|
+
$[51] = radioTypographyProps;
|
|
204
|
+
$[52] = t26;
|
|
205
|
+
} else t26 = $[52];
|
|
202
206
|
t25 = options.map(t26);
|
|
203
|
-
$[
|
|
204
|
-
$[
|
|
205
|
-
$[
|
|
206
|
-
$[
|
|
207
|
-
$[
|
|
208
|
-
$[
|
|
209
|
-
} else t25 = $[
|
|
207
|
+
$[42] = labelClassName;
|
|
208
|
+
$[43] = options;
|
|
209
|
+
$[44] = radioClassName;
|
|
210
|
+
$[45] = radioContentClassNameValue;
|
|
211
|
+
$[46] = radioTypographyProps;
|
|
212
|
+
$[47] = t25;
|
|
213
|
+
} else t25 = $[47];
|
|
210
214
|
let t26;
|
|
211
|
-
if ($[
|
|
215
|
+
if ($[53] !== t24 || $[54] !== t25) {
|
|
212
216
|
t26 = /* @__PURE__ */ jsx("div", {
|
|
213
217
|
className: t24,
|
|
214
218
|
children: t25
|
|
215
219
|
});
|
|
216
|
-
$[
|
|
217
|
-
$[
|
|
218
|
-
$[
|
|
219
|
-
} else t26 = $[
|
|
220
|
+
$[53] = t24;
|
|
221
|
+
$[54] = t25;
|
|
222
|
+
$[55] = t26;
|
|
223
|
+
} else t26 = $[55];
|
|
220
224
|
let t27;
|
|
221
|
-
if ($[
|
|
225
|
+
if ($[56] !== t20 || $[57] !== t21 || $[58] !== t22 || $[59] !== t23 || $[60] !== t26) {
|
|
222
226
|
t27 = /* @__PURE__ */ jsxs("div", {
|
|
223
227
|
className: t20,
|
|
224
228
|
"data-is-dirty": t21,
|
|
225
229
|
"data-is-required": t22,
|
|
226
230
|
children: [t23, t26]
|
|
227
231
|
});
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
232
|
-
$[
|
|
233
|
-
$[
|
|
234
|
-
} else t27 = $[
|
|
232
|
+
$[56] = t20;
|
|
233
|
+
$[57] = t21;
|
|
234
|
+
$[58] = t22;
|
|
235
|
+
$[59] = t23;
|
|
236
|
+
$[60] = t26;
|
|
237
|
+
$[61] = t27;
|
|
238
|
+
} else t27 = $[61];
|
|
235
239
|
let t28;
|
|
236
|
-
if ($[
|
|
240
|
+
if ($[62] !== t13 || $[63] !== t15 || $[64] !== t16 || $[65] !== t17 || $[66] !== t18 || $[67] !== t27) {
|
|
237
241
|
t28 = /* @__PURE__ */ jsx("div", {
|
|
238
242
|
className: t13,
|
|
239
243
|
"data-rac": t14,
|
|
@@ -244,16 +248,16 @@ var RadioGroupBase = (props) => {
|
|
|
244
248
|
"data-radio-group-content": t19,
|
|
245
249
|
children: t27
|
|
246
250
|
});
|
|
247
|
-
$[
|
|
248
|
-
$[
|
|
249
|
-
$[
|
|
250
|
-
$[
|
|
251
|
-
$[
|
|
252
|
-
$[
|
|
253
|
-
$[
|
|
254
|
-
} else t28 = $[
|
|
251
|
+
$[62] = t13;
|
|
252
|
+
$[63] = t15;
|
|
253
|
+
$[64] = t16;
|
|
254
|
+
$[65] = t17;
|
|
255
|
+
$[66] = t18;
|
|
256
|
+
$[67] = t27;
|
|
257
|
+
$[68] = t28;
|
|
258
|
+
} else t28 = $[68];
|
|
255
259
|
let t29;
|
|
256
|
-
if ($[
|
|
260
|
+
if ($[69] !== T1 || $[70] !== as || $[71] !== formFieldProps || $[72] !== labelProps || $[73] !== t11 || $[74] !== t12 || $[75] !== t28) {
|
|
257
261
|
t29 = /* @__PURE__ */ jsx(T1, {
|
|
258
262
|
...formFieldProps,
|
|
259
263
|
as,
|
|
@@ -262,17 +266,17 @@ var RadioGroupBase = (props) => {
|
|
|
262
266
|
tabIndex: t12,
|
|
263
267
|
children: t28
|
|
264
268
|
});
|
|
265
|
-
$[
|
|
266
|
-
$[
|
|
267
|
-
$[
|
|
268
|
-
$[
|
|
269
|
-
$[
|
|
270
|
-
$[
|
|
271
|
-
$[
|
|
272
|
-
$[
|
|
273
|
-
} else t29 = $[
|
|
269
|
+
$[69] = T1;
|
|
270
|
+
$[70] = as;
|
|
271
|
+
$[71] = formFieldProps;
|
|
272
|
+
$[72] = labelProps;
|
|
273
|
+
$[73] = t11;
|
|
274
|
+
$[74] = t12;
|
|
275
|
+
$[75] = t28;
|
|
276
|
+
$[76] = t29;
|
|
277
|
+
} else t29 = $[76];
|
|
274
278
|
let t30;
|
|
275
|
-
if ($[
|
|
279
|
+
if ($[77] !== T0 || $[78] !== defaultValue || $[79] !== fieldProps || $[80] !== handleChange || $[81] !== isDisabled || $[82] !== onBlur || $[83] !== ref || $[84] !== rest || $[85] !== t29 || $[86] !== t6 || $[87] !== t7 || $[88] !== t8 || $[89] !== value) {
|
|
276
280
|
t30 = /* @__PURE__ */ jsx(T0, {
|
|
277
281
|
...rest,
|
|
278
282
|
...fieldProps,
|
|
@@ -288,54 +292,54 @@ var RadioGroupBase = (props) => {
|
|
|
288
292
|
className: t9,
|
|
289
293
|
children: t29
|
|
290
294
|
});
|
|
291
|
-
$[
|
|
292
|
-
$[
|
|
293
|
-
$[
|
|
294
|
-
$[
|
|
295
|
-
$[
|
|
296
|
-
$[
|
|
297
|
-
$[
|
|
298
|
-
$[
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
301
|
-
$[
|
|
302
|
-
$[
|
|
303
|
-
$[
|
|
304
|
-
$[
|
|
305
|
-
} else t30 = $[
|
|
295
|
+
$[77] = T0;
|
|
296
|
+
$[78] = defaultValue;
|
|
297
|
+
$[79] = fieldProps;
|
|
298
|
+
$[80] = handleChange;
|
|
299
|
+
$[81] = isDisabled;
|
|
300
|
+
$[82] = onBlur;
|
|
301
|
+
$[83] = ref;
|
|
302
|
+
$[84] = rest;
|
|
303
|
+
$[85] = t29;
|
|
304
|
+
$[86] = t6;
|
|
305
|
+
$[87] = t7;
|
|
306
|
+
$[88] = t8;
|
|
307
|
+
$[89] = value;
|
|
308
|
+
$[90] = t30;
|
|
309
|
+
} else t30 = $[90];
|
|
306
310
|
return t30;
|
|
307
311
|
};
|
|
308
312
|
var RadioGroup$1 = (props) => {
|
|
309
313
|
const $ = c(15);
|
|
310
|
-
if ("
|
|
311
|
-
let
|
|
314
|
+
if ("formControl" in props && props.formControl) {
|
|
315
|
+
let formControl;
|
|
312
316
|
let innerProps;
|
|
313
317
|
let ref;
|
|
314
318
|
if ($[0] !== props) {
|
|
315
|
-
({
|
|
319
|
+
({formControl, ref, ...innerProps} = props);
|
|
316
320
|
$[0] = props;
|
|
317
|
-
$[1] =
|
|
321
|
+
$[1] = formControl;
|
|
318
322
|
$[2] = innerProps;
|
|
319
323
|
$[3] = ref;
|
|
320
324
|
} else {
|
|
321
|
-
|
|
325
|
+
formControl = $[1];
|
|
322
326
|
innerProps = $[2];
|
|
323
327
|
ref = $[3];
|
|
324
328
|
}
|
|
325
329
|
let t0;
|
|
326
330
|
if ($[4] !== innerProps || $[5] !== props.error || $[6] !== props.isDisabled || $[7] !== ref) {
|
|
327
331
|
t0 = (t1) => {
|
|
328
|
-
const { field
|
|
332
|
+
const { field, fieldState: t2 } = t1;
|
|
329
333
|
const { error, isDirty } = t2;
|
|
330
334
|
return /* @__PURE__ */ jsx(RadioGroupBase, {
|
|
331
335
|
...innerProps,
|
|
332
|
-
ref: mergeRefs(ref,
|
|
333
|
-
value:
|
|
334
|
-
onChange:
|
|
335
|
-
onBlur:
|
|
336
|
-
name:
|
|
336
|
+
ref: mergeRefs(ref, field.ref),
|
|
337
|
+
value: field.value,
|
|
338
|
+
onChange: field.onChange,
|
|
339
|
+
onBlur: field.onBlur,
|
|
340
|
+
name: field.name,
|
|
337
341
|
isDirty,
|
|
338
|
-
isDisabled:
|
|
342
|
+
isDisabled: field.disabled || props.isDisabled,
|
|
339
343
|
error: props.error ?? error?.message
|
|
340
344
|
});
|
|
341
345
|
};
|
|
@@ -346,14 +350,14 @@ var RadioGroup$1 = (props) => {
|
|
|
346
350
|
$[8] = t0;
|
|
347
351
|
} else t0 = $[8];
|
|
348
352
|
let t1;
|
|
349
|
-
if ($[9] !==
|
|
350
|
-
t1 = /* @__PURE__ */ jsx(
|
|
351
|
-
control:
|
|
352
|
-
name:
|
|
353
|
+
if ($[9] !== formControl.control || $[10] !== formControl.name || $[11] !== t0) {
|
|
354
|
+
t1 = /* @__PURE__ */ jsx(Controller, {
|
|
355
|
+
control: formControl.control,
|
|
356
|
+
name: formControl.name,
|
|
353
357
|
render: t0
|
|
354
358
|
});
|
|
355
|
-
$[9] =
|
|
356
|
-
$[10] =
|
|
359
|
+
$[9] = formControl.control;
|
|
360
|
+
$[10] = formControl.name;
|
|
357
361
|
$[11] = t0;
|
|
358
362
|
$[12] = t1;
|
|
359
363
|
} else t1 = $[12];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { Key } from 'react-aria-components';
|
|
3
|
-
import { FieldValues } from '
|
|
3
|
+
import { FieldValues } from 'react-hook-form';
|
|
4
4
|
import { SelectBaseProps } from '../shared/SelectBase';
|
|
5
5
|
import { DefaultInitialSelectItem, GroupedSelectControlProps, GroupedSelectProps } from '../shared/select.types';
|
|
6
6
|
import { OmitDiscriminatedUnion } from '../../../../types/common';
|
|
@@ -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 { InputFrame } from "../../Skeleton/InputFrame.js";
|
|
5
4
|
import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
|
|
6
5
|
import { selectInputTagsContentWrapperDefinition } from "../shared/selectInput.cva.js";
|
|
@@ -12,6 +11,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
12
11
|
import { clsx } from "clsx";
|
|
13
12
|
import { useRef, useState } from "react";
|
|
14
13
|
import { mergeRefs } from "@react-aria/utils";
|
|
14
|
+
import { Controller } from "react-hook-form";
|
|
15
15
|
//#region src/components/inputs/Selection/Autocomplete/Autocomplete.tsx
|
|
16
16
|
function AutocompleteInner(t0) {
|
|
17
17
|
const $ = c(8);
|
|
@@ -135,20 +135,20 @@ function _temp(root) {
|
|
|
135
135
|
return root.querySelector("input, [data-type='select-trigger'], button, [tabindex]");
|
|
136
136
|
}
|
|
137
137
|
function Autocomplete({ renderStaticInput, ...props }) {
|
|
138
|
-
if ("
|
|
139
|
-
const { ignoreInputValueFiltering = true,
|
|
140
|
-
const controlWithOptions =
|
|
141
|
-
return /* @__PURE__ */ jsx(
|
|
142
|
-
control:
|
|
143
|
-
name:
|
|
144
|
-
render: ({ field
|
|
138
|
+
if ("formControl" in props && props.formControl) {
|
|
139
|
+
const { ignoreInputValueFiltering = true, formControl, ref, ...innerProps } = props;
|
|
140
|
+
const controlWithOptions = formControl.control;
|
|
141
|
+
return /* @__PURE__ */ jsx(Controller, {
|
|
142
|
+
control: formControl.control,
|
|
143
|
+
name: formControl.name,
|
|
144
|
+
render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(AutocompleteInner, {
|
|
145
145
|
...innerProps,
|
|
146
|
-
ref: mergeRefs(ref,
|
|
147
|
-
value:
|
|
148
|
-
onChange:
|
|
149
|
-
onBlur:
|
|
146
|
+
ref: mergeRefs(ref, field.ref),
|
|
147
|
+
value: field.value,
|
|
148
|
+
onChange: field.onChange,
|
|
149
|
+
onBlur: field.onBlur,
|
|
150
150
|
isDirty,
|
|
151
|
-
isDisabled:
|
|
151
|
+
isDisabled: field.disabled || props.isDisabled,
|
|
152
152
|
isFormControlDisabled: !!controlWithOptions._options?.disabled,
|
|
153
153
|
error: props.error ?? error?.message,
|
|
154
154
|
ignoreInputValueFiltering,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldValues } from '
|
|
1
|
+
import { FieldValues } from 'react-hook-form';
|
|
2
2
|
import { QueryAutocompleteProps, QueryFn } from './queryAutocomplete.types';
|
|
3
3
|
import { SelectItem } from '../shared/select.types';
|
|
4
4
|
export declare const QueryAutocomplete: <TFieldValues extends FieldValues, TSelectItem extends SelectItem<any>, TQueryFn extends QueryFn>(props: QueryAutocompleteProps<TFieldValues, TSelectItem, TQueryFn>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
2
|
-
import { FieldController } from "../../shared/form.binding.js";
|
|
3
2
|
import { Autocomplete } from "./Autocomplete.js";
|
|
4
3
|
import { getQueryItems, getSelectionIdsToResolve } from "../shared/querySelect.utils.js";
|
|
5
4
|
import { useQueryAutocomplete } from "../../../../hooks/useQueryAutocomplete.js";
|
|
@@ -7,6 +6,7 @@ import { c } from "react/compiler-runtime";
|
|
|
7
6
|
import { jsx } from "react/jsx-runtime";
|
|
8
7
|
import { useState } from "react";
|
|
9
8
|
import { mergeRefs } from "@react-aria/utils";
|
|
9
|
+
import { Controller } from "react-hook-form";
|
|
10
10
|
//#region src/components/inputs/Selection/Autocomplete/QueryAutocomplete.tsx
|
|
11
11
|
var LoadedQueryAutocompleteContent = ({ query, queryParams, queryOptions, queryMap, resolveSelectedItemsWithIds, isQueryEnabledInitially = false, leadingContent, ...props }) => {
|
|
12
12
|
"use no memo";
|
|
@@ -111,35 +111,35 @@ var QueryAutocompleteContent = (props) => {
|
|
|
111
111
|
};
|
|
112
112
|
var QueryAutocomplete = (props) => {
|
|
113
113
|
const $ = c(16);
|
|
114
|
-
if ("
|
|
115
|
-
let
|
|
114
|
+
if ("formControl" in props && props.formControl) {
|
|
115
|
+
let formControl;
|
|
116
116
|
let innerProps;
|
|
117
117
|
let ref;
|
|
118
118
|
if ($[0] !== props) {
|
|
119
|
-
({
|
|
119
|
+
({formControl, ref, ...innerProps} = props);
|
|
120
120
|
$[0] = props;
|
|
121
|
-
$[1] =
|
|
121
|
+
$[1] = formControl;
|
|
122
122
|
$[2] = innerProps;
|
|
123
123
|
$[3] = ref;
|
|
124
124
|
} else {
|
|
125
|
-
|
|
125
|
+
formControl = $[1];
|
|
126
126
|
innerProps = $[2];
|
|
127
127
|
ref = $[3];
|
|
128
128
|
}
|
|
129
|
-
const controlWithOptions =
|
|
129
|
+
const controlWithOptions = formControl.control;
|
|
130
130
|
let t0;
|
|
131
131
|
if ($[4] !== controlWithOptions || $[5] !== innerProps || $[6] !== props.error || $[7] !== props.isDisabled || $[8] !== ref) {
|
|
132
132
|
t0 = (t1) => {
|
|
133
|
-
const { field
|
|
133
|
+
const { field, fieldState: t2 } = t1;
|
|
134
134
|
const { error, isDirty } = t2;
|
|
135
135
|
return /* @__PURE__ */ jsx(QueryAutocompleteContent, {
|
|
136
136
|
...innerProps,
|
|
137
|
-
ref: mergeRefs(ref,
|
|
138
|
-
value:
|
|
139
|
-
onChange:
|
|
140
|
-
onBlur:
|
|
137
|
+
ref: mergeRefs(ref, field.ref),
|
|
138
|
+
value: field.value,
|
|
139
|
+
onChange: field.onChange,
|
|
140
|
+
onBlur: field.onBlur,
|
|
141
141
|
isDirty,
|
|
142
|
-
isDisabled:
|
|
142
|
+
isDisabled: field.disabled || props.isDisabled || !!controlWithOptions._options?.disabled,
|
|
143
143
|
error: props.error ?? error?.message
|
|
144
144
|
});
|
|
145
145
|
};
|
|
@@ -151,14 +151,14 @@ var QueryAutocomplete = (props) => {
|
|
|
151
151
|
$[9] = t0;
|
|
152
152
|
} else t0 = $[9];
|
|
153
153
|
let t1;
|
|
154
|
-
if ($[10] !==
|
|
155
|
-
t1 = /* @__PURE__ */ jsx(
|
|
156
|
-
control:
|
|
157
|
-
name:
|
|
154
|
+
if ($[10] !== formControl.control || $[11] !== formControl.name || $[12] !== t0) {
|
|
155
|
+
t1 = /* @__PURE__ */ jsx(Controller, {
|
|
156
|
+
control: formControl.control,
|
|
157
|
+
name: formControl.name,
|
|
158
158
|
render: t0
|
|
159
159
|
});
|
|
160
|
-
$[10] =
|
|
161
|
-
$[11] =
|
|
160
|
+
$[10] = formControl.control;
|
|
161
|
+
$[11] = formControl.name;
|
|
162
162
|
$[12] = t0;
|
|
163
163
|
$[13] = t1;
|
|
164
164
|
} else t1 = $[13];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InfiniteData, UseInfiniteQueryResult, UseQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import { Key } from 'react-aria-components';
|
|
3
|
-
import { FieldValues } from '
|
|
3
|
+
import { FieldValues } from 'react-hook-form';
|
|
4
4
|
import { AutocompleteProps } from './Autocomplete';
|
|
5
5
|
import { GroupedSelectControlProps, GroupedSelectProps, SelectItem } from '../shared/select.types';
|
|
6
6
|
import { OmitDiscriminatedUnion } from '../../../../types/common';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Key } from 'react-aria-components';
|
|
2
|
-
import { FieldValues } from '
|
|
2
|
+
import { FieldValues } from 'react-hook-form';
|
|
3
3
|
import { DefaultInitialSelectItem, GroupedSelectControlProps, GroupedSelectProps, SelectItem } from '../shared/select.types';
|
|
4
4
|
import { SelectProps } from './Select';
|
|
5
5
|
import { QueryDataType, QueryFn } from '../shared/querySelect.utils';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
2
|
-
import { FieldController } from "../../shared/form.binding.js";
|
|
3
2
|
import { Select } from "./Select.js";
|
|
4
3
|
import { getQueryItems, getSelectionIdsToResolve } from "../shared/querySelect.utils.js";
|
|
5
4
|
import { useQueryAutocomplete } from "../../../../hooks/useQueryAutocomplete.js";
|
|
@@ -7,6 +6,7 @@ import { c } from "react/compiler-runtime";
|
|
|
7
6
|
import { jsx } from "react/jsx-runtime";
|
|
8
7
|
import { useState } from "react";
|
|
9
8
|
import { mergeRefs } from "@react-aria/utils";
|
|
9
|
+
import { Controller } from "react-hook-form";
|
|
10
10
|
//#region src/components/inputs/Selection/Select/QuerySelect.tsx
|
|
11
11
|
var LoadedQuerySelectContent = ({ query, queryParams, queryOptions, queryMap, resolveSelectedItemsWithIds, isQueryEnabledInitially = false, ...props }) => {
|
|
12
12
|
const ui = UIConfig.useConfig();
|
|
@@ -107,35 +107,35 @@ var QuerySelectContent = (props) => {
|
|
|
107
107
|
};
|
|
108
108
|
var QuerySelect = (props) => {
|
|
109
109
|
const $ = c(16);
|
|
110
|
-
if ("
|
|
111
|
-
let
|
|
110
|
+
if ("formControl" in props && props.formControl) {
|
|
111
|
+
let formControl;
|
|
112
112
|
let innerProps;
|
|
113
113
|
let ref;
|
|
114
114
|
if ($[0] !== props) {
|
|
115
|
-
({
|
|
115
|
+
({formControl, ref, ...innerProps} = props);
|
|
116
116
|
$[0] = props;
|
|
117
|
-
$[1] =
|
|
117
|
+
$[1] = formControl;
|
|
118
118
|
$[2] = innerProps;
|
|
119
119
|
$[3] = ref;
|
|
120
120
|
} else {
|
|
121
|
-
|
|
121
|
+
formControl = $[1];
|
|
122
122
|
innerProps = $[2];
|
|
123
123
|
ref = $[3];
|
|
124
124
|
}
|
|
125
|
-
const controlWithOptions =
|
|
125
|
+
const controlWithOptions = formControl.control;
|
|
126
126
|
let t0;
|
|
127
127
|
if ($[4] !== controlWithOptions || $[5] !== innerProps || $[6] !== props.error || $[7] !== props.isDisabled || $[8] !== ref) {
|
|
128
128
|
t0 = (t1) => {
|
|
129
|
-
const { field
|
|
129
|
+
const { field, fieldState: t2 } = t1;
|
|
130
130
|
const { error, isDirty } = t2;
|
|
131
131
|
return /* @__PURE__ */ jsx(QuerySelectContent, {
|
|
132
132
|
...innerProps,
|
|
133
|
-
ref: mergeRefs(ref,
|
|
134
|
-
value:
|
|
135
|
-
onChange:
|
|
136
|
-
onBlur:
|
|
133
|
+
ref: mergeRefs(ref, field.ref),
|
|
134
|
+
value: field.value,
|
|
135
|
+
onChange: field.onChange,
|
|
136
|
+
onBlur: field.onBlur,
|
|
137
137
|
isDirty,
|
|
138
|
-
isDisabled:
|
|
138
|
+
isDisabled: field.disabled || props.isDisabled || !!controlWithOptions._options?.disabled,
|
|
139
139
|
error: props.error ?? error?.message
|
|
140
140
|
});
|
|
141
141
|
};
|
|
@@ -147,14 +147,14 @@ var QuerySelect = (props) => {
|
|
|
147
147
|
$[9] = t0;
|
|
148
148
|
} else t0 = $[9];
|
|
149
149
|
let t1;
|
|
150
|
-
if ($[10] !==
|
|
151
|
-
t1 = /* @__PURE__ */ jsx(
|
|
152
|
-
control:
|
|
153
|
-
name:
|
|
150
|
+
if ($[10] !== formControl.control || $[11] !== formControl.name || $[12] !== t0) {
|
|
151
|
+
t1 = /* @__PURE__ */ jsx(Controller, {
|
|
152
|
+
control: formControl.control,
|
|
153
|
+
name: formControl.name,
|
|
154
154
|
render: t0
|
|
155
155
|
});
|
|
156
|
-
$[10] =
|
|
157
|
-
$[11] =
|
|
156
|
+
$[10] = formControl.control;
|
|
157
|
+
$[11] = formControl.name;
|
|
158
158
|
$[12] = t0;
|
|
159
159
|
$[13] = t1;
|
|
160
160
|
} else t1 = $[13];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { Key } from 'react-aria-components';
|
|
3
|
-
import { FieldValues } from '
|
|
3
|
+
import { FieldValues } from 'react-hook-form';
|
|
4
4
|
import { SelectBaseProps } from '../shared/SelectBase';
|
|
5
5
|
import { DefaultInitialSelectItem, GroupedSelectControlProps, GroupedSelectProps, SelectAsyncProps } from '../shared/select.types';
|
|
6
6
|
import { OmitDiscriminatedUnion } from '../../../../types/common';
|