@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.
Files changed (78) hide show
  1. package/dist/components/inputs/Checkbox/Checkbox.d.ts +1 -2
  2. package/dist/components/inputs/Checkbox/Checkbox.js +93 -100
  3. package/dist/components/inputs/Checkbox/CheckboxGroup.d.ts +1 -2
  4. package/dist/components/inputs/Checkbox/CheckboxGroup.js +109 -113
  5. package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +1 -2
  6. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +14 -21
  7. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -2
  8. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +14 -22
  9. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +1 -2
  10. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +14 -21
  11. package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +1 -2
  12. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +275 -294
  13. package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +1 -2
  14. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +1 -10
  15. package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +1 -2
  16. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +43 -46
  17. package/dist/components/inputs/File/FileUpload.d.ts +1 -1
  18. package/dist/components/inputs/File/FileUpload.js +17 -17
  19. package/dist/components/inputs/File/InputUpload.d.ts +1 -1
  20. package/dist/components/inputs/File/InputUpload.js +17 -17
  21. package/dist/components/inputs/File/fileUpload.types.d.ts +1 -1
  22. package/dist/components/inputs/File/inputUpload.types.d.ts +1 -1
  23. package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +1 -1
  24. package/dist/components/inputs/Input/NumberInput/NumberInput.js +19 -19
  25. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +1 -1
  26. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +18 -18
  27. package/dist/components/inputs/Input/PasswordInput/PasswordInput.d.ts +1 -1
  28. package/dist/components/inputs/Input/TextArea/TextArea.d.ts +1 -1
  29. package/dist/components/inputs/Input/TextArea/TextArea.js +18 -18
  30. package/dist/components/inputs/Input/TextInput/TextInput.d.ts +2 -2
  31. package/dist/components/inputs/Input/TextInput/TextInput.js +36 -38
  32. package/dist/components/inputs/Inputs/Form.d.ts +4 -4
  33. package/dist/components/inputs/Inputs/InputItem.d.ts +22 -22
  34. package/dist/components/inputs/Inputs/InputItem.js +35 -36
  35. package/dist/components/inputs/Inputs/Inputs.d.ts +2 -2
  36. package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -2
  37. package/dist/components/inputs/RadioGroup/RadioGroup.js +107 -111
  38. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +1 -1
  39. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +13 -13
  40. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +1 -1
  41. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +19 -19
  42. package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +1 -1
  43. package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +1 -1
  44. package/dist/components/inputs/Selection/Select/QuerySelect.js +19 -19
  45. package/dist/components/inputs/Selection/Select/Select.d.ts +1 -1
  46. package/dist/components/inputs/Selection/Select/Select.js +19 -19
  47. package/dist/components/inputs/Selection/shared/SelectBase.d.ts +0 -1
  48. package/dist/components/inputs/Selection/shared/SelectBase.js +34 -37
  49. package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -2
  50. package/dist/components/inputs/Selection/shared/select.context.js +4 -8
  51. package/dist/components/inputs/Selection/shared/select.types.d.ts +1 -1
  52. package/dist/components/inputs/Slider/Slider.d.ts +1 -1
  53. package/dist/components/inputs/Slider/Slider.js +18 -18
  54. package/dist/components/inputs/TextEditor/TextEditor.d.ts +1 -1
  55. package/dist/components/inputs/TextEditor/TextEditor.js +18 -18
  56. package/dist/components/inputs/Toggle/Toggle.d.ts +1 -2
  57. package/dist/components/inputs/Toggle/Toggle.js +59 -63
  58. package/dist/components/inputs/shared/form.binding.d.ts +27 -0
  59. package/dist/components/inputs/shared/form.binding.js +57 -0
  60. package/dist/components/inputs/shared/form.types.d.ts +9 -8
  61. package/dist/components/inputs/shared/form.types.js +8 -0
  62. package/dist/components/segment/Segment.d.ts +1 -1
  63. package/dist/components/segment/Segment.js +17 -17
  64. package/dist/components/segment/segment.types.d.ts +1 -1
  65. package/dist/config/uiConfig.context.d.ts +5 -5
  66. package/dist/config/uiConfig.context.js +3 -12
  67. package/dist/helpers/dynamicColumns.d.ts +1 -1
  68. package/dist/helpers/dynamicInputs.d.ts +7 -7
  69. package/dist/hooks/useAutosave.d.ts +4 -4
  70. package/dist/hooks/useAutosave.js +64 -49
  71. package/dist/hooks/useForm.d.ts +39 -15
  72. package/dist/hooks/useForm.js +96 -43
  73. package/dist/hooks/useFormAutosave.d.ts +8 -9
  74. package/dist/hooks/useFormAutosave.js +23 -9
  75. package/dist/index.d.ts +2 -2
  76. package/dist/index.js +3 -3
  77. package/package.json +2 -3
  78. package/dist/hooks/useAutosave.spec.d.ts +0 -1
@@ -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 { checkboxContentRowDefinition, checkboxContentWrapperDefinition, checkboxGroupLabelDefinition } from "./checkbox.cva.js";
4
5
  import { CheckboxBase } from "./Checkbox.js";
5
6
  import { FormFieldLabel } from "../FormField/FormFieldLabel.js";
@@ -11,22 +12,20 @@ import { clsx } from "clsx";
11
12
  import { CheckboxGroup } from "react-aria-components";
12
13
  import { useLabel } from "react-aria";
13
14
  import { mergeRefs } from "@react-aria/utils";
14
- import { Controller } from "react-hook-form";
15
15
  //#region src/components/inputs/Checkbox/CheckboxGroup.tsx
16
16
  var CheckboxGroupBase = (props) => {
17
- const $ = c(101);
17
+ const $ = c(99);
18
18
  const ui = UIConfig.useConfig();
19
19
  const checkboxContentWrapperCva = UIOverrides.useCva("checkbox.contentWrapperCva", checkboxContentWrapperDefinition);
20
20
  const checkboxContentRowCva = UIOverrides.useCva("checkbox.contentRowCva", checkboxContentRowDefinition);
21
21
  const checkboxGroupLabelCva = UIOverrides.useCva("checkbox.groupLabelCva", checkboxGroupLabelDefinition);
22
22
  const inputBaseCva = UIOverrides.useCva("input.baseCva", inputBaseDefinition);
23
23
  const inputSizeCva = UIOverrides.useCva("input.sizeCva", inputSizeDefinition);
24
- const { ref, label, tooltipText, helperText, isDirty, isRequired, rightContent, isDisabled, headerClassName, errorClassName, labelClassName, inputClassName, isHeaderHidden, error, className, options, allValue, value, defaultValue, onChange, onBlur, fireBlurOnChange: fireBlurOnChangeProp, as: asProp, size: sizeProp, variant: variantProp, hideLabel: hideLabelProp, ...rest } = props;
24
+ const { ref, label, tooltipText, helperText, isDirty, isRequired, rightContent, isDisabled, headerClassName, errorClassName, labelClassName, inputClassName, isHeaderHidden, error, className, options, allValue, value, defaultValue, onChange, onBlur, as: asProp, size: sizeProp, variant: variantProp, hideLabel: hideLabelProp, ...rest } = props;
25
25
  const as = asProp ?? ui.input.as;
26
26
  const size = sizeProp ?? ui.input.size;
27
27
  const variant = variantProp ?? ui.checkbox.variant;
28
28
  const hideLabel = hideLabelProp ?? ui.input.hideLabel;
29
- const fireBlurOnChange = fireBlurOnChangeProp ?? ui.checkbox.fireBlurOnChange;
30
29
  let optionValues;
31
30
  let resolvedValue;
32
31
  let t0;
@@ -122,19 +121,16 @@ var CheckboxGroupBase = (props) => {
122
121
  } else t5 = $[31];
123
122
  const headerProps = t5;
124
123
  let t6;
125
- if ($[32] !== allValue || $[33] !== fireBlurOnChange || $[34] !== onBlur || $[35] !== onChange || $[36] !== optionValues) {
124
+ if ($[32] !== allValue || $[33] !== onChange || $[34] !== optionValues) {
126
125
  t6 = (nextValue) => {
127
126
  const hasAllOptions = allValue !== void 0 && optionValues.length > 0 && optionValues.every((optionValue) => nextValue.includes(optionValue));
128
127
  onChange?.(hasAllOptions ? allValue : nextValue);
129
- if (fireBlurOnChange) onBlur?.({});
130
128
  };
131
129
  $[32] = allValue;
132
- $[33] = fireBlurOnChange;
133
- $[34] = onBlur;
134
- $[35] = onChange;
135
- $[36] = optionValues;
136
- $[37] = t6;
137
- } else t6 = $[37];
130
+ $[33] = onChange;
131
+ $[34] = optionValues;
132
+ $[35] = t6;
133
+ } else t6 = $[35];
138
134
  const handleChange = t6;
139
135
  const T0 = CheckboxGroup;
140
136
  const t7 = !!error;
@@ -144,26 +140,26 @@ var CheckboxGroupBase = (props) => {
144
140
  const T1 = FormField;
145
141
  const t11 = as === "inline" && "h-full";
146
142
  let t12;
147
- if ($[38] !== className || $[39] !== t11) {
143
+ if ($[36] !== className || $[37] !== t11) {
148
144
  t12 = clsx("w-full", t11, className);
149
- $[38] = className;
150
- $[39] = t11;
151
- $[40] = t12;
152
- } else t12 = $[40];
145
+ $[36] = className;
146
+ $[37] = t11;
147
+ $[38] = t12;
148
+ } else t12 = $[38];
153
149
  const t13 = as === "inline" ? -1 : void 0;
154
150
  let t14;
155
- if ($[41] !== as || $[42] !== inputBaseCva || $[43] !== inputClassName || $[44] !== shouldRenderInputFrame || $[45] !== ui) {
151
+ if ($[39] !== as || $[40] !== inputBaseCva || $[41] !== inputClassName || $[42] !== shouldRenderInputFrame || $[43] !== ui) {
156
152
  t14 = clsx("group/checkbox-group-content relative", shouldRenderInputFrame && inputBaseCva({
157
153
  variant: ui.input.variant,
158
154
  as
159
155
  }), inputClassName);
160
- $[41] = as;
161
- $[42] = inputBaseCva;
162
- $[43] = inputClassName;
163
- $[44] = shouldRenderInputFrame;
164
- $[45] = ui;
165
- $[46] = t14;
166
- } else t14 = $[46];
156
+ $[39] = as;
157
+ $[40] = inputBaseCva;
158
+ $[41] = inputClassName;
159
+ $[42] = shouldRenderInputFrame;
160
+ $[43] = ui;
161
+ $[44] = t14;
162
+ } else t14 = $[44];
167
163
  const t15 = "";
168
164
  const t16 = isDisabled || void 0;
169
165
  const t17 = isDisabled || void 0;
@@ -183,20 +179,20 @@ var CheckboxGroupBase = (props) => {
183
179
  const t22 = isDirty || void 0;
184
180
  const t23 = isRequired || void 0;
185
181
  let t24;
186
- if ($[47] !== as || $[48] !== checkboxGroupLabelCva || $[49] !== headerClassName || $[50] !== headerProps || $[51] !== size) {
182
+ if ($[45] !== as || $[46] !== checkboxGroupLabelCva || $[47] !== headerClassName || $[48] !== headerProps || $[49] !== size) {
187
183
  t24 = as && ["filter", "floating"].includes(as) && /* @__PURE__ */ jsx(FormFieldLabel, {
188
184
  ...headerProps,
189
185
  as: as === "floating" ? "filter" : as,
190
186
  size,
191
187
  className: clsx(headerClassName, checkboxGroupLabelCva({ as }))
192
188
  });
193
- $[47] = as;
194
- $[48] = checkboxGroupLabelCva;
195
- $[49] = headerClassName;
196
- $[50] = headerProps;
197
- $[51] = size;
198
- $[52] = t24;
199
- } else t24 = $[52];
189
+ $[45] = as;
190
+ $[46] = checkboxGroupLabelCva;
191
+ $[47] = headerClassName;
192
+ $[48] = headerProps;
193
+ $[49] = size;
194
+ $[50] = t24;
195
+ } else t24 = $[50];
200
196
  const t25 = checkboxContentRowCva({
201
197
  variant,
202
198
  as,
@@ -204,9 +200,9 @@ var CheckboxGroupBase = (props) => {
204
200
  ...rest
205
201
  });
206
202
  let t26;
207
- if ($[53] !== hideLabel || $[54] !== labelClassName || $[55] !== options || $[56] !== variant) {
203
+ if ($[51] !== hideLabel || $[52] !== labelClassName || $[53] !== options || $[54] !== variant) {
208
204
  let t27;
209
- if ($[58] !== hideLabel || $[59] !== labelClassName || $[60] !== variant) {
205
+ if ($[56] !== hideLabel || $[57] !== labelClassName || $[58] !== variant) {
210
206
  t27 = (option_0) => /* @__PURE__ */ jsx(CheckboxBase, {
211
207
  value: option_0.value,
212
208
  variant,
@@ -215,45 +211,45 @@ var CheckboxGroupBase = (props) => {
215
211
  labelClassName,
216
212
  children: option_0.label
217
213
  }, option_0.value);
218
- $[58] = hideLabel;
219
- $[59] = labelClassName;
220
- $[60] = variant;
221
- $[61] = t27;
222
- } else t27 = $[61];
214
+ $[56] = hideLabel;
215
+ $[57] = labelClassName;
216
+ $[58] = variant;
217
+ $[59] = t27;
218
+ } else t27 = $[59];
223
219
  t26 = options.map(t27);
224
- $[53] = hideLabel;
225
- $[54] = labelClassName;
226
- $[55] = options;
227
- $[56] = variant;
228
- $[57] = t26;
229
- } else t26 = $[57];
220
+ $[51] = hideLabel;
221
+ $[52] = labelClassName;
222
+ $[53] = options;
223
+ $[54] = variant;
224
+ $[55] = t26;
225
+ } else t26 = $[55];
230
226
  let t27;
231
- if ($[62] !== t25 || $[63] !== t26) {
227
+ if ($[60] !== t25 || $[61] !== t26) {
232
228
  t27 = /* @__PURE__ */ jsx("div", {
233
229
  className: t25,
234
230
  children: t26
235
231
  });
236
- $[62] = t25;
237
- $[63] = t26;
238
- $[64] = t27;
239
- } else t27 = $[64];
232
+ $[60] = t25;
233
+ $[61] = t26;
234
+ $[62] = t27;
235
+ } else t27 = $[62];
240
236
  let t28;
241
- if ($[65] !== t21 || $[66] !== t22 || $[67] !== t23 || $[68] !== t24 || $[69] !== t27) {
237
+ if ($[63] !== t21 || $[64] !== t22 || $[65] !== t23 || $[66] !== t24 || $[67] !== t27) {
242
238
  t28 = /* @__PURE__ */ jsxs("div", {
243
239
  className: t21,
244
240
  "data-is-dirty": t22,
245
241
  "data-is-required": t23,
246
242
  children: [t24, t27]
247
243
  });
248
- $[65] = t21;
249
- $[66] = t22;
250
- $[67] = t23;
251
- $[68] = t24;
252
- $[69] = t27;
253
- $[70] = t28;
254
- } else t28 = $[70];
244
+ $[63] = t21;
245
+ $[64] = t22;
246
+ $[65] = t23;
247
+ $[66] = t24;
248
+ $[67] = t27;
249
+ $[68] = t28;
250
+ } else t28 = $[68];
255
251
  let t29;
256
- if ($[71] !== t14 || $[72] !== t16 || $[73] !== t17 || $[74] !== t18 || $[75] !== t19 || $[76] !== t28) {
252
+ if ($[69] !== t14 || $[70] !== t16 || $[71] !== t17 || $[72] !== t18 || $[73] !== t19 || $[74] !== t28) {
257
253
  t29 = /* @__PURE__ */ jsx("div", {
258
254
  className: t14,
259
255
  "data-rac": t15,
@@ -264,16 +260,16 @@ var CheckboxGroupBase = (props) => {
264
260
  "data-checkbox-group-content": t20,
265
261
  children: t28
266
262
  });
267
- $[71] = t14;
268
- $[72] = t16;
269
- $[73] = t17;
270
- $[74] = t18;
271
- $[75] = t19;
272
- $[76] = t28;
273
- $[77] = t29;
274
- } else t29 = $[77];
263
+ $[69] = t14;
264
+ $[70] = t16;
265
+ $[71] = t17;
266
+ $[72] = t18;
267
+ $[73] = t19;
268
+ $[74] = t28;
269
+ $[75] = t29;
270
+ } else t29 = $[75];
275
271
  let t30;
276
- if ($[78] !== T1 || $[79] !== as || $[80] !== formFieldProps || $[81] !== labelProps || $[82] !== t12 || $[83] !== t13 || $[84] !== t29) {
272
+ if ($[76] !== T1 || $[77] !== as || $[78] !== formFieldProps || $[79] !== labelProps || $[80] !== t12 || $[81] !== t13 || $[82] !== t29) {
277
273
  t30 = /* @__PURE__ */ jsx(T1, {
278
274
  ...formFieldProps,
279
275
  as,
@@ -282,17 +278,17 @@ var CheckboxGroupBase = (props) => {
282
278
  tabIndex: t13,
283
279
  children: t29
284
280
  });
285
- $[78] = T1;
286
- $[79] = as;
287
- $[80] = formFieldProps;
288
- $[81] = labelProps;
289
- $[82] = t12;
290
- $[83] = t13;
291
- $[84] = t29;
292
- $[85] = t30;
293
- } else t30 = $[85];
281
+ $[76] = T1;
282
+ $[77] = as;
283
+ $[78] = formFieldProps;
284
+ $[79] = labelProps;
285
+ $[80] = t12;
286
+ $[81] = t13;
287
+ $[82] = t29;
288
+ $[83] = t30;
289
+ } else t30 = $[83];
294
290
  let t31;
295
- if ($[86] !== T0 || $[87] !== fieldProps || $[88] !== handleChange || $[89] !== isDisabled || $[90] !== isRequired || $[91] !== onBlur || $[92] !== ref || $[93] !== resolvedDefaultValue || $[94] !== resolvedValue || $[95] !== rest || $[96] !== t30 || $[97] !== t7 || $[98] !== t8 || $[99] !== t9) {
291
+ if ($[84] !== T0 || $[85] !== fieldProps || $[86] !== handleChange || $[87] !== isDisabled || $[88] !== isRequired || $[89] !== onBlur || $[90] !== ref || $[91] !== resolvedDefaultValue || $[92] !== resolvedValue || $[93] !== rest || $[94] !== t30 || $[95] !== t7 || $[96] !== t8 || $[97] !== t9) {
296
292
  t31 = /* @__PURE__ */ jsx(T0, {
297
293
  ...rest,
298
294
  ...fieldProps,
@@ -309,55 +305,55 @@ var CheckboxGroupBase = (props) => {
309
305
  className: t10,
310
306
  children: t30
311
307
  });
312
- $[86] = T0;
313
- $[87] = fieldProps;
314
- $[88] = handleChange;
315
- $[89] = isDisabled;
316
- $[90] = isRequired;
317
- $[91] = onBlur;
318
- $[92] = ref;
319
- $[93] = resolvedDefaultValue;
320
- $[94] = resolvedValue;
321
- $[95] = rest;
322
- $[96] = t30;
323
- $[97] = t7;
324
- $[98] = t8;
325
- $[99] = t9;
326
- $[100] = t31;
327
- } else t31 = $[100];
308
+ $[84] = T0;
309
+ $[85] = fieldProps;
310
+ $[86] = handleChange;
311
+ $[87] = isDisabled;
312
+ $[88] = isRequired;
313
+ $[89] = onBlur;
314
+ $[90] = ref;
315
+ $[91] = resolvedDefaultValue;
316
+ $[92] = resolvedValue;
317
+ $[93] = rest;
318
+ $[94] = t30;
319
+ $[95] = t7;
320
+ $[96] = t8;
321
+ $[97] = t9;
322
+ $[98] = t31;
323
+ } else t31 = $[98];
328
324
  return t31;
329
325
  };
330
326
  var CheckboxGroup$1 = (props) => {
331
327
  const $ = c(15);
332
- if ("formControl" in props && props.formControl) {
333
- let formControl;
328
+ if ("field" in props && props.field) {
329
+ let field;
334
330
  let innerProps;
335
331
  let ref;
336
332
  if ($[0] !== props) {
337
- ({formControl, ref, ...innerProps} = props);
333
+ ({field, ref, ...innerProps} = props);
338
334
  $[0] = props;
339
- $[1] = formControl;
335
+ $[1] = field;
340
336
  $[2] = innerProps;
341
337
  $[3] = ref;
342
338
  } else {
343
- formControl = $[1];
339
+ field = $[1];
344
340
  innerProps = $[2];
345
341
  ref = $[3];
346
342
  }
347
343
  let t0;
348
344
  if ($[4] !== innerProps || $[5] !== props.error || $[6] !== props.isDisabled || $[7] !== ref) {
349
345
  t0 = (t1) => {
350
- const { field, fieldState: t2 } = t1;
346
+ const { field: field_0, fieldState: t2 } = t1;
351
347
  const { error, isDirty } = t2;
352
348
  return /* @__PURE__ */ jsx(CheckboxGroupBase, {
353
349
  ...innerProps,
354
- ref: mergeRefs(ref, field.ref),
355
- value: field.value,
356
- onChange: field.onChange,
357
- onBlur: field.onBlur,
358
- name: field.name,
350
+ ref: mergeRefs(ref, field_0.ref),
351
+ value: field_0.value,
352
+ onChange: field_0.onChange,
353
+ onBlur: field_0.onBlur,
354
+ name: field_0.name,
359
355
  isDirty,
360
- isDisabled: field.disabled || props.isDisabled,
356
+ isDisabled: field_0.disabled || props.isDisabled,
361
357
  error: props.error ?? error?.message
362
358
  });
363
359
  };
@@ -368,14 +364,14 @@ var CheckboxGroup$1 = (props) => {
368
364
  $[8] = t0;
369
365
  } else t0 = $[8];
370
366
  let t1;
371
- if ($[9] !== formControl.control || $[10] !== formControl.name || $[11] !== t0) {
372
- t1 = /* @__PURE__ */ jsx(Controller, {
373
- control: formControl.control,
374
- name: formControl.name,
367
+ if ($[9] !== field.form || $[10] !== field.name || $[11] !== t0) {
368
+ t1 = /* @__PURE__ */ jsx(FieldController, {
369
+ control: field.form,
370
+ name: field.name,
375
371
  render: t0
376
372
  });
377
- $[9] = formControl.control;
378
- $[10] = formControl.name;
373
+ $[9] = field.form;
374
+ $[10] = field.name;
379
375
  $[11] = t0;
380
376
  $[12] = t1;
381
377
  } else t1 = $[12];
@@ -1,6 +1,6 @@
1
1
  import { CalendarDate, DateValue } from '@internationalized/date';
2
2
  import { FocusEvent, Ref } from 'react';
3
- import { FieldValues } from 'react-hook-form';
3
+ import { FieldValues } from '../../shared/form.binding';
4
4
  import { DatePickerStateOptions } from 'react-stately';
5
5
  import { DatePickerInputHandle } from '../shared/DatePickerInput';
6
6
  import { DatePickerTodayIcon, DatePickerTodayIconButtonComponent, DatePickerTodayIconButtonSize, DatePickerTodayIconPlacement } from '../shared/datePicker.types';
@@ -26,7 +26,6 @@ interface DatePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<Da
26
26
  shouldUpdateDateOnMonthYearChange?: boolean;
27
27
  granularity?: DatePickerGranularity;
28
28
  format?: string;
29
- fireBlurOnChange?: boolean;
30
29
  }
31
30
  export interface DatePickerProps extends Omit<DatePickerBaseProps, "value" | "onChange" | "minValue" | "maxValue"> {
32
31
  value?: string | null;
@@ -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 { FormField } from "../../FormField/FormField.js";
4
5
  import { Calendar } from "../shared/Calendar.js";
5
6
  import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
@@ -12,20 +13,18 @@ import { getStaticCalendarDateSegments, getStaticDateTimeFocusTarget } from "../
12
13
  import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
13
14
  import { InputFrame } from "../../Skeleton/InputFrame.js";
14
15
  import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
15
- import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
16
16
  import { jsx, jsxs } from "react/jsx-runtime";
17
17
  import { clsx } from "clsx";
18
18
  import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
19
19
  import { useDatePicker, useLocale } from "react-aria";
20
20
  import { mergeRefs } from "@react-aria/utils";
21
- import { Controller } from "react-hook-form";
22
21
  import { createCalendar, getLocalTimeZone, toCalendarDate, today } from "@internationalized/date";
23
22
  import { DateTime } from "luxon";
24
23
  import { useCalendarState, useDatePickerState } from "react-stately";
25
24
  //#region src/components/inputs/DateTime/DatePicker/DatePicker.tsx
26
25
  var DatePickerBase = (props) => {
27
26
  const ui = UIConfig.useConfig();
28
- const { ref, label, tooltipText, helperText, isRequired, rightContent, isDirty, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, placeholder, inputClassName, as: asProp, hideLabel: hideLabelProp, variant: variantProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconButtonComponent: todayIconButtonComponentProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, shouldUpdateDateOnMonthYearChange: shouldUpdateDateOnMonthYearChangeProp, granularity: granularityProp, autoFixYear: autoFixYearProp, fireBlurOnChange: fireBlurOnChangeProp, format, ...rest } = props;
27
+ const { ref, label, tooltipText, helperText, isRequired, rightContent, isDirty, isDisabled, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, placeholder, inputClassName, as: asProp, hideLabel: hideLabelProp, variant: variantProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconButtonComponent: todayIconButtonComponentProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, shouldUpdateDateOnMonthYearChange: shouldUpdateDateOnMonthYearChangeProp, granularity: granularityProp, autoFixYear: autoFixYearProp, format, ...rest } = props;
29
28
  const as = asProp ?? ui.input.as;
30
29
  const hideLabel = hideLabelProp ?? ui.input.hideLabel;
31
30
  const variant = variantProp ?? ui.input.variant;
@@ -40,7 +39,6 @@ var DatePickerBase = (props) => {
40
39
  const shouldUpdateDateOnMonthYearChange = shouldUpdateDateOnMonthYearChangeProp ?? ui.dateInput.shouldUpdateDateOnMonthYearChange;
41
40
  const granularity = granularityProp ?? ui.dateInput.granularity;
42
41
  const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
43
- const fireBlurOnChange = fireBlurOnChangeProp ?? ui.dateInput.fireBlurOnChange;
44
42
  const timeZone = ui.dateInput.timeZone;
45
43
  let effectiveTimeZone = getLocalTimeZone();
46
44
  if (timeZone !== "clientLocal") effectiveTimeZone = timeZone;
@@ -78,7 +76,6 @@ var DatePickerBase = (props) => {
78
76
  const handleBlur = (val) => {
79
77
  onBlur?.({ target: { value: val } });
80
78
  };
81
- const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
82
79
  const normalizedValue = value ?? null;
83
80
  const dialogState = useDatePickerState({
84
81
  ...rest,
@@ -99,7 +96,6 @@ var DatePickerBase = (props) => {
99
96
  }
100
97
  onChange?.(normalizedValue_0);
101
98
  dialogState.setValue(normalizedValue_0);
102
- if (fireBlurOnChange) debouncedBlur(normalizedValue_0);
103
99
  if (normalizedValue_0) {
104
100
  calendarState.setFocusedDate(normalizedValue_0);
105
101
  return;
@@ -139,7 +135,6 @@ var DatePickerBase = (props) => {
139
135
  const newValue = dialogState.value ? normalizeByGranularity(dialogState.value) : dialogState.value;
140
136
  state.setValue(newValue);
141
137
  state.toggle();
142
- if (fireBlurOnChange) handleBlur(newValue);
143
138
  };
144
139
  const onMonthYearChange = (selectedDate) => {
145
140
  if (!(shouldUpdateDateOnMonthYearChange || granularity !== "day")) return;
@@ -161,7 +156,6 @@ var DatePickerBase = (props) => {
161
156
  const onInputClear = () => {
162
157
  onChange?.(null);
163
158
  dialogState.setValue(null);
164
- if (fireBlurOnChange) handleBlur(null);
165
159
  };
166
160
  const syncDialogFromControlledValue = () => {
167
161
  dialogState.setValue(state.value);
@@ -244,7 +238,6 @@ var DatePickerBase = (props) => {
244
238
  dateGranularity: granularity,
245
239
  format,
246
240
  timeZone: effectiveTimeZone,
247
- fireBlurOnChange,
248
241
  onClear: onInputClear
249
242
  }), (!disableDropdown || disableManualEntry) && state.isOpen && /* @__PURE__ */ jsx(DateTimeDialog, {
250
243
  footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
@@ -391,20 +384,20 @@ var DatePickerInner = ({ fullIso = true, granularity = "day", minValue, maxValue
391
384
  });
392
385
  };
393
386
  var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, renderStaticInput, ...props }) => {
394
- if ("formControl" in props && props.formControl) {
395
- const { formControl, ref, ...innerProps } = props;
396
- const controlWithOptions = formControl.control;
397
- return /* @__PURE__ */ jsx(Controller, {
398
- control: formControl.control,
399
- name: formControl.name,
400
- render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DatePickerInner, {
387
+ if ("field" in props && props.field) {
388
+ const { field, ref, ...innerProps } = props;
389
+ const controlWithOptions = field.form;
390
+ return /* @__PURE__ */ jsx(FieldController, {
391
+ control: field.form,
392
+ name: field.name,
393
+ render: ({ field: field_0, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DatePickerInner, {
401
394
  ...innerProps,
402
- ref: mergeRefs(ref, field.ref),
403
- value: field.value ?? null,
404
- onChange: field.onChange,
405
- onBlur: field.onBlur,
395
+ ref: mergeRefs(ref, field_0.ref),
396
+ value: field_0.value ?? null,
397
+ onChange: field_0.onChange,
398
+ onBlur: field_0.onBlur,
406
399
  isDirty,
407
- isDisabled: field.disabled || props.isDisabled,
400
+ isDisabled: field_0.disabled || props.isDisabled,
408
401
  isFormControlDisabled: !!controlWithOptions._options?.disabled,
409
402
  error: props.error ?? error?.message,
410
403
  fullIso,
@@ -1,7 +1,7 @@
1
1
  import { CalendarDate } from '@internationalized/date';
2
2
  import { FocusEvent, Ref } from 'react';
3
3
  import { DateValue } from 'react-aria';
4
- import { FieldValues } from 'react-hook-form';
4
+ import { FieldValues } from '../../shared/form.binding';
5
5
  import { DateRangePickerStateOptions } from 'react-stately';
6
6
  import { DatePickerInputHandle } from '../shared/DatePickerInput';
7
7
  import { DatePickerTodayIcon, DatePickerTodayIconButtonComponent, DatePickerTodayIconButtonSize, DatePickerTodayIconPlacement } from '../shared/datePicker.types';
@@ -24,7 +24,6 @@ interface DateRangePickerBaseProps extends FormFieldProps, InputVariantProps, Om
24
24
  placeholder?: string;
25
25
  inputClassName?: string;
26
26
  onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
27
- fireBlurOnChange?: boolean;
28
27
  allowPartialRange?: boolean;
29
28
  }
30
29
  export interface DateRangePickerProps extends Omit<DateRangePickerBaseProps, "value" | "onChange" | "minValue" | "maxValue"> {
@@ -2,6 +2,7 @@ import { UIOverrides } from "../../../../config/uiOverrides.context.js";
2
2
  import { Typography } from "../../../text/Typography/Typography.js";
3
3
  import { UIConfig } from "../../../../config/uiConfig.context.js";
4
4
  import "../../../../config/i18n.js";
5
+ import { FieldController } from "../../shared/form.binding.js";
5
6
  import { FormField } from "../../FormField/FormField.js";
6
7
  import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
7
8
  import { datePickerInputContentRowDefinition } from "../shared/datePickerInput.cva.js";
@@ -13,7 +14,6 @@ import { getStaticDateRangeSegments, getStaticDateTimeFocusTarget } from "../sha
13
14
  import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
14
15
  import { InputFrame } from "../../Skeleton/InputFrame.js";
15
16
  import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
16
- import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
17
17
  import { RangeCalendar } from "../shared/RangeCalendar.js";
18
18
  import { jsx, jsxs } from "react/jsx-runtime";
19
19
  import { clsx } from "clsx";
@@ -22,7 +22,6 @@ import { Button } from "react-aria-components";
22
22
  import { useDateRangePicker, useLocale as useLocale$1 } from "react-aria";
23
23
  import { mergeRefs } from "@react-aria/utils";
24
24
  import { useTranslation } from "react-i18next";
25
- import { Controller } from "react-hook-form";
26
25
  import { createCalendar, endOfMonth, endOfWeek, endOfYear, getLocalTimeZone, startOfMonth, startOfWeek, startOfYear, toCalendarDate, today } from "@internationalized/date";
27
26
  import { DateTime } from "luxon";
28
27
  import { useDateRangePickerState, useRangeCalendarState } from "react-stately";
@@ -30,7 +29,7 @@ import { useDateRangePickerState, useRangeCalendarState } from "react-stately";
30
29
  var DateRangePickerBase = (props) => {
31
30
  const ui = UIConfig.useConfig();
32
31
  const { t } = useTranslation();
33
- const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, hideSidebar, placeholder, inputClassName, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconButtonComponent: todayIconButtonComponentProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, autoFixYear: autoFixYearProp, fireBlurOnChange: fireBlurOnChangeProp, allowPartialRange: allowPartialRangeProp, minValue, maxValue, ...rest } = props;
32
+ const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, hideSidebar, placeholder, inputClassName, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconButtonComponent: todayIconButtonComponentProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, autoFixYear: autoFixYearProp, allowPartialRange: allowPartialRangeProp, minValue, maxValue, ...rest } = props;
34
33
  const hideLabel = hideLabelProp ?? ui.input.hideLabel;
35
34
  const variant = variantProp ?? ui.input.variant;
36
35
  const as = asProp ?? ui.input.as;
@@ -43,7 +42,6 @@ var DateRangePickerBase = (props) => {
43
42
  const shouldForceLeadingZeros = shouldForceLeadingZerosProp ?? ui.dateInput.shouldForceLeadingZeros;
44
43
  const disableManualEntry = disableManualEntryProp ?? ui.dateInput.disableManualEntry;
45
44
  const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
46
- const fireBlurOnChange = fireBlurOnChangeProp ?? ui.dateInput.fireBlurOnChange;
47
45
  const allowPartialRange = allowPartialRangeProp ?? ui.dateInput.allowPartialRange;
48
46
  const timeZone = ui.dateInput.timeZone;
49
47
  let effectiveTimeZone = getLocalTimeZone();
@@ -77,7 +75,6 @@ var DateRangePickerBase = (props) => {
77
75
  onChange?.(newValue);
78
76
  if (isInvalidRange) return;
79
77
  handleCalendarStatesChange(newValue);
80
- if (fireBlurOnChange) debouncedBlur(newValue);
81
78
  },
82
79
  shouldCloseOnSelect: false
83
80
  });
@@ -105,7 +102,6 @@ var DateRangePickerBase = (props) => {
105
102
  if (partialRange.start && partialRange.end) return;
106
103
  const newValue_0 = partialRange.start || partialRange.end ? partialRange : null;
107
104
  onChange?.(newValue_0);
108
- if (fireBlurOnChange) debouncedBlur(newValue_0);
109
105
  };
110
106
  const { locale } = useLocale$1();
111
107
  useImperativeHandle(ref, () => ({
@@ -117,7 +113,6 @@ var DateRangePickerBase = (props) => {
117
113
  const handleBlur = (newValue_1) => {
118
114
  onBlur?.({ target: { value: newValue_1 } });
119
115
  };
120
- const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
121
116
  const formFieldProps = {
122
117
  error: error || validationRangeError,
123
118
  label,
@@ -429,7 +424,6 @@ var DateRangePickerBase = (props) => {
429
424
  }
430
425
  }
431
426
  state.toggle();
432
- if (fireBlurOnChange) handleBlur(valueToApply);
433
427
  };
434
428
  const onTodayPress = () => {
435
429
  const todayDate = today(effectiveTimeZone);
@@ -457,7 +451,6 @@ var DateRangePickerBase = (props) => {
457
451
  isSelecting: false
458
452
  });
459
453
  setHoverDate(null);
460
- if (fireBlurOnChange) handleBlur(null);
461
454
  };
462
455
  const syncSelectionFromControlledValue = () => {
463
456
  const currentValue = state.value;
@@ -668,7 +661,6 @@ var DateRangePickerBase = (props) => {
668
661
  className: inputClassName,
669
662
  onOpenDropdown,
670
663
  timeZone: effectiveTimeZone,
671
- fireBlurOnChange,
672
664
  onClear: onInputClear
673
665
  }), /* @__PURE__ */ jsx(DateTimeDialog, {
674
666
  hideSidebar,
@@ -855,20 +847,20 @@ var DateRangePickerInner = ({ fullIso = true, minValue, maxValue, renderStaticIn
855
847
  });
856
848
  };
857
849
  var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput, ...props }) => {
858
- if ("formControl" in props && props.formControl) {
859
- const { formControl, ref, ...innerProps } = props;
860
- const controlWithOptions = formControl.control;
861
- return /* @__PURE__ */ jsx(Controller, {
862
- control: formControl.control,
863
- name: formControl.name,
864
- render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DateRangePickerInner, {
850
+ if ("field" in props && props.field) {
851
+ const { field, ref, ...innerProps } = props;
852
+ const controlWithOptions = field.form;
853
+ return /* @__PURE__ */ jsx(FieldController, {
854
+ control: field.form,
855
+ name: field.name,
856
+ render: ({ field: field_0, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DateRangePickerInner, {
865
857
  ...innerProps,
866
- ref: mergeRefs(ref, field.ref),
867
- value: field.value ?? null,
868
- onChange: field.onChange,
869
- onBlur: field.onBlur,
858
+ ref: mergeRefs(ref, field_0.ref),
859
+ value: field_0.value ?? null,
860
+ onChange: field_0.onChange,
861
+ onBlur: field_0.onBlur,
870
862
  isDirty,
871
- isDisabled: field.disabled || props.isDisabled,
863
+ isDisabled: field_0.disabled || props.isDisabled,
872
864
  isFormControlDisabled: !!controlWithOptions._options?.disabled,
873
865
  error: props.error ?? error?.message,
874
866
  fullIso,
@@ -1,6 +1,6 @@
1
1
  import { FocusEvent, Ref } from 'react';
2
2
  import { DateValue } from 'react-aria';
3
- import { FieldValues } from 'react-hook-form';
3
+ import { FieldValues } from '../../shared/form.binding';
4
4
  import { DatePickerStateOptions } from 'react-stately';
5
5
  import { DatePickerInputHandle } from '../shared/DatePickerInput';
6
6
  import { DatePickerTodayIcon, DatePickerTodayIconButtonComponent, DatePickerTodayIconButtonSize, DatePickerTodayIconPlacement } from '../shared/datePicker.types';
@@ -27,7 +27,6 @@ interface DateTimePickerBaseProps extends FormFieldProps, InputVariantProps, Omi
27
27
  timeZone?: string;
28
28
  format?: string;
29
29
  onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
30
- fireBlurOnChange?: boolean;
31
30
  }
32
31
  export interface DateTimePickerProps extends Omit<DateTimePickerBaseProps, "value" | "onChange"> {
33
32
  value?: string | null;