@povio/ui 3.3.0-rc.4 → 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 (125) hide show
  1. package/README.md +15 -1
  2. package/dist/components/Breadcrumbs/Breadcrumbs.js +55 -206
  3. package/dist/components/buttons/InlineIconButton/InlineIconButton.js +9 -34
  4. package/dist/components/buttons/shared/ButtonContent.js +22 -80
  5. package/dist/components/inputs/Checkbox/Checkbox.d.ts +1 -2
  6. package/dist/components/inputs/Checkbox/Checkbox.js +93 -100
  7. package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +10 -24
  8. package/dist/components/inputs/Checkbox/CheckboxGroup.d.ts +1 -2
  9. package/dist/components/inputs/Checkbox/CheckboxGroup.js +109 -113
  10. package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +1 -2
  11. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +97 -238
  12. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -2
  13. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +88 -214
  14. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +1 -2
  15. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +64 -143
  16. package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +1 -2
  17. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +275 -294
  18. package/dist/components/inputs/DateTime/shared/Calendar.js +139 -339
  19. package/dist/components/inputs/DateTime/shared/CalendarCell.js +114 -308
  20. package/dist/components/inputs/DateTime/shared/CalendarGrid.js +35 -150
  21. package/dist/components/inputs/DateTime/shared/CalendarHeader.js +95 -229
  22. package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +115 -296
  23. package/dist/components/inputs/DateTime/shared/DateField.js +135 -306
  24. package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +1 -2
  25. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +136 -343
  26. package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +10 -59
  27. package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +1 -2
  28. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +43 -46
  29. package/dist/components/inputs/File/FileUpload.d.ts +1 -1
  30. package/dist/components/inputs/File/FileUpload.js +18 -18
  31. package/dist/components/inputs/File/InputUpload.d.ts +1 -1
  32. package/dist/components/inputs/File/InputUpload.js +82 -278
  33. package/dist/components/inputs/File/fileUpload.types.d.ts +1 -1
  34. package/dist/components/inputs/File/inputUpload.types.d.ts +1 -1
  35. package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +48 -180
  36. package/dist/components/inputs/File/shared/FileUploadContentError.js +95 -265
  37. package/dist/components/inputs/File/shared/FileUploadContentFilled.js +99 -261
  38. package/dist/components/inputs/File/shared/FileUploadContentLoading.js +56 -234
  39. package/dist/components/inputs/File/shared/ProgressBar.js +15 -102
  40. package/dist/components/inputs/FormField/FormField.js +34 -47
  41. package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +1 -1
  42. package/dist/components/inputs/Input/NumberInput/NumberInput.js +19 -19
  43. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +1 -1
  44. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +93 -331
  45. package/dist/components/inputs/Input/PasswordInput/PasswordInput.d.ts +1 -1
  46. package/dist/components/inputs/Input/TextArea/TextArea.d.ts +1 -1
  47. package/dist/components/inputs/Input/TextArea/TextArea.js +18 -18
  48. package/dist/components/inputs/Input/TextInput/TextInput.d.ts +2 -2
  49. package/dist/components/inputs/Input/TextInput/TextInput.js +36 -38
  50. package/dist/components/inputs/Inputs/Form.d.ts +4 -4
  51. package/dist/components/inputs/Inputs/InputItem.d.ts +22 -22
  52. package/dist/components/inputs/Inputs/InputItem.js +35 -36
  53. package/dist/components/inputs/Inputs/Inputs.d.ts +2 -2
  54. package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -2
  55. package/dist/components/inputs/RadioGroup/RadioGroup.js +107 -111
  56. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +1 -1
  57. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +26 -86
  58. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +1 -1
  59. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +19 -19
  60. package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +1 -1
  61. package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +1 -1
  62. package/dist/components/inputs/Selection/Select/QuerySelect.js +49 -115
  63. package/dist/components/inputs/Selection/Select/Select.d.ts +1 -1
  64. package/dist/components/inputs/Selection/Select/Select.js +22 -22
  65. package/dist/components/inputs/Selection/shared/SelectBase.d.ts +0 -1
  66. package/dist/components/inputs/Selection/shared/SelectBase.js +34 -37
  67. package/dist/components/inputs/Selection/shared/SelectInput.js +1 -0
  68. package/dist/components/inputs/Selection/shared/SelectListBox.js +51 -163
  69. package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -2
  70. package/dist/components/inputs/Selection/shared/select.context.js +4 -8
  71. package/dist/components/inputs/Selection/shared/select.types.d.ts +1 -1
  72. package/dist/components/inputs/Selection/shared/useSelectItems.js +48 -108
  73. package/dist/components/inputs/Skeleton/InputFrame.js +177 -552
  74. package/dist/components/inputs/Slider/Slider.d.ts +1 -1
  75. package/dist/components/inputs/Slider/Slider.js +18 -18
  76. package/dist/components/inputs/TextEditor/TextEditor.d.ts +1 -1
  77. package/dist/components/inputs/TextEditor/TextEditor.js +105 -407
  78. package/dist/components/inputs/Toggle/Toggle.d.ts +1 -2
  79. package/dist/components/inputs/Toggle/Toggle.js +59 -63
  80. package/dist/components/inputs/shared/InputClear.js +24 -40
  81. package/dist/components/inputs/shared/form.binding.d.ts +27 -0
  82. package/dist/components/inputs/shared/form.binding.js +57 -0
  83. package/dist/components/inputs/shared/form.types.d.ts +9 -8
  84. package/dist/components/inputs/shared/form.types.js +8 -0
  85. package/dist/components/navigation/Accordion/Accordion.js +22 -69
  86. package/dist/components/navigation/Accordion/AccordionItem.js +41 -86
  87. package/dist/components/navigation/Stepper/Stepper.js +22 -67
  88. package/dist/components/overlays/ActionModal/ActionModal.js +35 -169
  89. package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +29 -110
  90. package/dist/components/segment/Segment.d.ts +1 -1
  91. package/dist/components/segment/Segment.js +17 -17
  92. package/dist/components/segment/segment.types.d.ts +1 -1
  93. package/dist/components/shared/pagination/Pagination.js +22 -108
  94. package/dist/components/status/Alert/Alert.js +30 -97
  95. package/dist/components/table/InfiniteTable.js +16 -67
  96. package/dist/components/table/Table.d.ts +2 -8
  97. package/dist/components/table/Table.js +33 -55
  98. package/dist/components/text/Typography/Typography.js +8 -23
  99. package/dist/config/confirmation.context.js +1 -1
  100. package/dist/config/theme.context.js +45 -98
  101. package/dist/config/uiConfig.context.d.ts +5 -5
  102. package/dist/config/uiConfig.context.js +11 -51
  103. package/dist/config/uiOverrides.context.d.ts +0 -1
  104. package/dist/helpers/dynamicColumns.d.ts +1 -1
  105. package/dist/helpers/dynamicInputs.d.ts +7 -7
  106. package/dist/hooks/useAutosave.d.ts +4 -4
  107. package/dist/hooks/useAutosave.js +64 -49
  108. package/dist/hooks/useDebounceCallback.js +17 -51
  109. package/dist/hooks/useForm.d.ts +39 -15
  110. package/dist/hooks/useForm.js +96 -43
  111. package/dist/hooks/useFormAutosave.d.ts +8 -9
  112. package/dist/hooks/useFormAutosave.js +49 -122
  113. package/dist/hooks/useLongPressRepeat.js +20 -55
  114. package/dist/index.d.ts +2 -3
  115. package/dist/index.js +3 -4
  116. package/package.json +3 -4
  117. package/dist/components/inputs/FormField/formField.cva.d.ts +0 -11
  118. package/dist/components/inputs/FormField/formField.cva.js +0 -16
  119. package/dist/components/table/TableColumnFilterInput.d.ts +0 -9
  120. package/dist/components/table/TableColumnFilterInput.js +0 -108
  121. package/dist/components/table/TableColumnFilterPlaceholder.d.ts +0 -5
  122. package/dist/components/table/TableColumnFilterPlaceholder.js +0 -41
  123. package/dist/components/table/TableColumnFilterRow.d.ts +0 -16
  124. package/dist/components/table/TableColumnFilterRow.js +0 -68
  125. 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 { FormField } from "../../FormField/FormField.js";
4
5
  import { Calendar } from "../shared/Calendar.js";
5
6
  import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
@@ -12,21 +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
- import { c } from "react/compiler-runtime";
17
16
  import { jsx, jsxs } from "react/jsx-runtime";
18
17
  import { clsx } from "clsx";
19
18
  import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
20
19
  import { useDatePicker, useLocale } from "react-aria";
21
20
  import { mergeRefs } from "@react-aria/utils";
22
- import { Controller } from "react-hook-form";
23
21
  import { createCalendar, getLocalTimeZone, toCalendarDate, today } from "@internationalized/date";
24
22
  import { DateTime } from "luxon";
25
23
  import { useCalendarState, useDatePickerState } from "react-stately";
26
24
  //#region src/components/inputs/DateTime/DatePicker/DatePicker.tsx
27
25
  var DatePickerBase = (props) => {
28
26
  const ui = UIConfig.useConfig();
29
- 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;
30
28
  const as = asProp ?? ui.input.as;
31
29
  const hideLabel = hideLabelProp ?? ui.input.hideLabel;
32
30
  const variant = variantProp ?? ui.input.variant;
@@ -41,7 +39,6 @@ var DatePickerBase = (props) => {
41
39
  const shouldUpdateDateOnMonthYearChange = shouldUpdateDateOnMonthYearChangeProp ?? ui.dateInput.shouldUpdateDateOnMonthYearChange;
42
40
  const granularity = granularityProp ?? ui.dateInput.granularity;
43
41
  const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
44
- const fireBlurOnChange = fireBlurOnChangeProp ?? ui.dateInput.fireBlurOnChange;
45
42
  const timeZone = ui.dateInput.timeZone;
46
43
  let effectiveTimeZone = getLocalTimeZone();
47
44
  if (timeZone !== "clientLocal") effectiveTimeZone = timeZone;
@@ -79,7 +76,6 @@ var DatePickerBase = (props) => {
79
76
  const handleBlur = (val) => {
80
77
  onBlur?.({ target: { value: val } });
81
78
  };
82
- const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
83
79
  const normalizedValue = value ?? null;
84
80
  const dialogState = useDatePickerState({
85
81
  ...rest,
@@ -100,7 +96,6 @@ var DatePickerBase = (props) => {
100
96
  }
101
97
  onChange?.(normalizedValue_0);
102
98
  dialogState.setValue(normalizedValue_0);
103
- if (fireBlurOnChange) debouncedBlur(normalizedValue_0);
104
99
  if (normalizedValue_0) {
105
100
  calendarState.setFocusedDate(normalizedValue_0);
106
101
  return;
@@ -140,7 +135,6 @@ var DatePickerBase = (props) => {
140
135
  const newValue = dialogState.value ? normalizeByGranularity(dialogState.value) : dialogState.value;
141
136
  state.setValue(newValue);
142
137
  state.toggle();
143
- if (fireBlurOnChange) handleBlur(newValue);
144
138
  };
145
139
  const onMonthYearChange = (selectedDate) => {
146
140
  if (!(shouldUpdateDateOnMonthYearChange || granularity !== "day")) return;
@@ -162,8 +156,19 @@ var DatePickerBase = (props) => {
162
156
  const onInputClear = () => {
163
157
  onChange?.(null);
164
158
  dialogState.setValue(null);
165
- if (fireBlurOnChange) handleBlur(null);
166
159
  };
160
+ const syncDialogFromControlledValue = () => {
161
+ dialogState.setValue(state.value);
162
+ if (state.value) {
163
+ calendarState.setFocusedDate(normalizeByGranularity(state.value));
164
+ return;
165
+ }
166
+ calendarState.setFocusedDate(today(effectiveTimeZone));
167
+ };
168
+ useEffect(() => {
169
+ if (!state.isOpen) return;
170
+ syncDialogFromControlledValue();
171
+ }, [state.isOpen]);
167
172
  useEffect(() => {
168
173
  if (!state.isOpen) return;
169
174
  if (granularity !== "year") return;
@@ -180,11 +185,13 @@ var DatePickerBase = (props) => {
180
185
  normalizeByGranularity,
181
186
  effectiveTimeZone
182
187
  ]);
183
- const onOpenChange = (isOpen) => {
188
+ const onOpenChange = (_isOpen) => {
189
+ state.toggle();
190
+ syncDialogFromControlledValue();
191
+ };
192
+ const onOpenDropdown = () => {
193
+ syncDialogFromControlledValue();
184
194
  state.toggle();
185
- if (state.value) calendarState.setFocusedDate(normalizeByGranularity(state.value));
186
- if (!state.value) calendarState.setFocusedDate(today(effectiveTimeZone));
187
- if (!isOpen) dialogState.setValue(state.value);
188
195
  };
189
196
  return /* @__PURE__ */ jsx(TooltipWrapper, {
190
197
  as,
@@ -225,13 +232,12 @@ var DatePickerBase = (props) => {
225
232
  todayIconButtonSize,
226
233
  todayIconButtonComponent,
227
234
  todayIconPlacement,
228
- onOpenDropdown: () => state.toggle(),
235
+ onOpenDropdown,
229
236
  placeholder,
230
237
  className: inputClassName,
231
238
  dateGranularity: granularity,
232
239
  format,
233
240
  timeZone: effectiveTimeZone,
234
- fireBlurOnChange,
235
241
  onClear: onInputClear
236
242
  }), (!disableDropdown || disableManualEntry) && state.isOpen && /* @__PURE__ */ jsx(DateTimeDialog, {
237
243
  footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
@@ -258,11 +264,7 @@ var DatePickerBase = (props) => {
258
264
  })
259
265
  });
260
266
  };
261
- var DatePickerInner = (t0) => {
262
- const $ = c(28);
263
- const { fullIso: t1, granularity: t2, minValue, maxValue, renderStaticInput, isFormControlDisabled, ...props } = t0;
264
- const fullIso = t1 === void 0 ? true : t1;
265
- const granularity = t2 === void 0 ? "day" : t2;
267
+ var DatePickerInner = ({ fullIso = true, granularity = "day", minValue, maxValue, renderStaticInput, isFormControlDisabled, ...props }) => {
266
268
  const ui = UIConfig.useConfig();
267
269
  const datePickerInputContentRowCva = UIOverrides.useCva("datePickerInput.contentRowCva", datePickerInputContentRowDefinition);
268
270
  const { locale } = useLocale();
@@ -273,76 +275,42 @@ var DatePickerInner = (t0) => {
273
275
  inputRef,
274
276
  renderInput,
275
277
  setRenderInput,
276
- getFocusTarget: _temp,
277
- getPressTarget: _temp2
278
+ getFocusTarget: (input, staticTarget) => {
279
+ const container = input.getContainer?.() ?? input;
280
+ return container instanceof HTMLElement ? getStaticDateTimeFocusTarget(container, staticTarget) : null;
281
+ },
282
+ getPressTarget: (input_0) => {
283
+ const container_0 = input_0.getContainer?.() ?? input_0;
284
+ if (!(container_0 instanceof HTMLElement)) return null;
285
+ return container_0.querySelector("[data-static-press-action]");
286
+ }
278
287
  });
279
288
  const normalizedValue = props.value ?? null;
280
- let t3;
281
- if ($[0] !== granularity) {
282
- t3 = (date) => {
283
- if (granularity === "year") return date.set({
284
- month: 1,
285
- day: 1
286
- });
287
- if (granularity === "month") return date.set({ day: 1 });
288
- return date;
289
- };
290
- $[0] = granularity;
291
- $[1] = t3;
292
- } else t3 = $[1];
293
- const normalizeByGranularity = t3;
294
- let t4;
295
- if ($[2] !== fullIso || $[3] !== normalizeByGranularity) {
296
- t4 = (calendarDate) => {
297
- if (calendarDate === null) return null;
298
- const normalizedDate = normalizeByGranularity(calendarDate);
299
- if (fullIso) return DateTimeUtils.fromCalendarDateToUTCISO(normalizedDate);
300
- const date_0 = DateTimeUtils.fromDateValueToLocal(normalizedDate, "UTC");
301
- return DateTime.fromJSDate(date_0, { zone: "UTC" }).toISODate();
302
- };
303
- $[2] = fullIso;
304
- $[3] = normalizeByGranularity;
305
- $[4] = t4;
306
- } else t4 = $[4];
307
- const formatCalendarDate = t4;
308
- let t5;
309
- if ($[5] !== fullIso || $[6] !== normalizeByGranularity) {
310
- t5 = (formattedDate) => {
311
- if (formattedDate == null) return null;
312
- if (fullIso) return normalizeByGranularity(DateTimeUtils.fromUTCISOToCalendarDate(formattedDate));
313
- const date_1 = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
314
- return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date_1, "UTC")));
315
- };
316
- $[5] = fullIso;
317
- $[6] = normalizeByGranularity;
318
- $[7] = t5;
319
- } else t5 = $[7];
320
- const parseCalendarDate = t5;
321
- let t6;
322
- if ($[8] !== minValue || $[9] !== parseCalendarDate) {
323
- t6 = typeof minValue === "string" ? parseCalendarDate(minValue) : minValue;
324
- $[8] = minValue;
325
- $[9] = parseCalendarDate;
326
- $[10] = t6;
327
- } else t6 = $[10];
328
- let t7;
329
- if ($[11] !== maxValue || $[12] !== parseCalendarDate) {
330
- t7 = typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue;
331
- $[11] = maxValue;
332
- $[12] = parseCalendarDate;
333
- $[13] = t7;
334
- } else t7 = $[13];
335
- let t8;
336
- if ($[14] !== t6 || $[15] !== t7) {
337
- t8 = {
338
- minValue: t6,
339
- maxValue: t7
340
- };
341
- $[14] = t6;
342
- $[15] = t7;
343
- $[16] = t8;
344
- } else t8 = $[16];
345
- const dateLimits = t8;
289
+ const normalizeByGranularity = (date) => {
290
+ if (granularity === "year") return date.set({
291
+ month: 1,
292
+ day: 1
293
+ });
294
+ if (granularity === "month") return date.set({ day: 1 });
295
+ return date;
296
+ };
297
+ const formatCalendarDate = (calendarDate) => {
298
+ if (calendarDate === null) return null;
299
+ const normalizedDate = normalizeByGranularity(calendarDate);
300
+ if (fullIso) return DateTimeUtils.fromCalendarDateToUTCISO(normalizedDate);
301
+ const date_0 = DateTimeUtils.fromDateValueToLocal(normalizedDate, "UTC");
302
+ return DateTime.fromJSDate(date_0, { zone: "UTC" }).toISODate();
303
+ };
304
+ const parseCalendarDate = (formattedDate) => {
305
+ if (formattedDate == null) return null;
306
+ if (fullIso) return normalizeByGranularity(DateTimeUtils.fromUTCISOToCalendarDate(formattedDate));
307
+ const date_1 = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
308
+ return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date_1, "UTC")));
309
+ };
310
+ const dateLimits = {
311
+ minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
312
+ maxValue: typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue
313
+ };
346
314
  if (!renderInput) {
347
315
  const dateValue = normalizedValue ? parseCalendarDate(normalizedValue) : null;
348
316
  const as = props.as ?? ui.input.as;
@@ -400,163 +368,54 @@ var DatePickerInner = (t0) => {
400
368
  trailingClassName: "py-0! pl-0!",
401
369
  action: showDropdown ? {
402
370
  icon: ui.dateInput.calendarIcon,
403
- onClick: _temp3,
371
+ onClick: () => {},
404
372
  altText: ""
405
373
  } : void 0,
406
374
  children: staticSegments
407
375
  });
408
376
  }
409
- const T0 = DatePickerBase;
410
- const t9 = mergeRefs(props.ref, inputRef);
411
- const t10 = parseCalendarDate(normalizedValue);
412
- let t11;
413
- if ($[17] !== formatCalendarDate || $[18] !== props) {
414
- t11 = (value) => props.onChange?.(formatCalendarDate(value));
415
- $[17] = formatCalendarDate;
416
- $[18] = props;
417
- $[19] = t11;
418
- } else t11 = $[19];
419
- let t12;
420
- if ($[20] !== T0 || $[21] !== dateLimits || $[22] !== granularity || $[23] !== props || $[24] !== t10 || $[25] !== t11 || $[26] !== t9) {
421
- t12 = /* @__PURE__ */ jsx(T0, {
422
- ...props,
423
- ...dateLimits,
424
- ref: t9,
425
- granularity,
426
- value: t10,
427
- onChange: t11
428
- });
429
- $[20] = T0;
430
- $[21] = dateLimits;
431
- $[22] = granularity;
432
- $[23] = props;
433
- $[24] = t10;
434
- $[25] = t11;
435
- $[26] = t9;
436
- $[27] = t12;
437
- } else t12 = $[27];
438
- return t12;
377
+ return /* @__PURE__ */ jsx(DatePickerBase, {
378
+ ...props,
379
+ ...dateLimits,
380
+ ref: mergeRefs(props.ref, inputRef),
381
+ granularity,
382
+ value: parseCalendarDate(normalizedValue),
383
+ onChange: (value) => props.onChange?.(formatCalendarDate(value))
384
+ });
439
385
  };
440
- var DatePicker = (t0) => {
441
- const $ = c(33);
442
- let maxValue;
443
- let minValue;
444
- let props;
445
- let renderStaticInput;
446
- let t1;
447
- let t2;
448
- if ($[0] !== t0) {
449
- ({fullIso: t1, granularity: t2, minValue, maxValue, renderStaticInput, ...props} = t0);
450
- $[0] = t0;
451
- $[1] = maxValue;
452
- $[2] = minValue;
453
- $[3] = props;
454
- $[4] = renderStaticInput;
455
- $[5] = t1;
456
- $[6] = t2;
457
- } else {
458
- maxValue = $[1];
459
- minValue = $[2];
460
- props = $[3];
461
- renderStaticInput = $[4];
462
- t1 = $[5];
463
- t2 = $[6];
464
- }
465
- const fullIso = t1 === void 0 ? true : t1;
466
- const granularity = t2 === void 0 ? "day" : t2;
467
- if ("formControl" in props && props.formControl) {
468
- let formControl;
469
- let innerProps;
470
- let ref;
471
- if ($[7] !== props) {
472
- ({formControl, ref, ...innerProps} = props);
473
- $[7] = props;
474
- $[8] = formControl;
475
- $[9] = innerProps;
476
- $[10] = ref;
477
- } else {
478
- formControl = $[8];
479
- innerProps = $[9];
480
- ref = $[10];
481
- }
482
- const controlWithOptions = formControl.control;
483
- let t3;
484
- if ($[11] !== controlWithOptions._options?.disabled || $[12] !== fullIso || $[13] !== granularity || $[14] !== innerProps || $[15] !== maxValue || $[16] !== minValue || $[17] !== props.error || $[18] !== props.isDisabled || $[19] !== ref || $[20] !== renderStaticInput) {
485
- t3 = (t4) => {
486
- const { field, fieldState: t5 } = t4;
487
- const { error, isDirty } = t5;
488
- return /* @__PURE__ */ jsx(DatePickerInner, {
489
- ...innerProps,
490
- ref: mergeRefs(ref, field.ref),
491
- value: field.value ?? null,
492
- onChange: field.onChange,
493
- onBlur: field.onBlur,
494
- isDirty,
495
- isDisabled: field.disabled || props.isDisabled,
496
- isFormControlDisabled: !!controlWithOptions._options?.disabled,
497
- error: props.error ?? error?.message,
498
- fullIso,
499
- granularity,
500
- minValue,
501
- maxValue,
502
- renderStaticInput
503
- });
504
- };
505
- $[11] = controlWithOptions._options?.disabled;
506
- $[12] = fullIso;
507
- $[13] = granularity;
508
- $[14] = innerProps;
509
- $[15] = maxValue;
510
- $[16] = minValue;
511
- $[17] = props.error;
512
- $[18] = props.isDisabled;
513
- $[19] = ref;
514
- $[20] = renderStaticInput;
515
- $[21] = t3;
516
- } else t3 = $[21];
517
- let t4;
518
- if ($[22] !== formControl.control || $[23] !== formControl.name || $[24] !== t3) {
519
- t4 = /* @__PURE__ */ jsx(Controller, {
520
- control: formControl.control,
521
- name: formControl.name,
522
- render: t3
523
- });
524
- $[22] = formControl.control;
525
- $[23] = formControl.name;
526
- $[24] = t3;
527
- $[25] = t4;
528
- } else t4 = $[25];
529
- return t4;
530
- }
531
- let t3;
532
- if ($[26] !== fullIso || $[27] !== granularity || $[28] !== maxValue || $[29] !== minValue || $[30] !== props || $[31] !== renderStaticInput) {
533
- t3 = /* @__PURE__ */ jsx(DatePickerInner, {
534
- ...props,
535
- fullIso,
536
- granularity,
537
- minValue,
538
- maxValue,
539
- renderStaticInput
386
+ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, renderStaticInput, ...props }) => {
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, {
394
+ ...innerProps,
395
+ ref: mergeRefs(ref, field_0.ref),
396
+ value: field_0.value ?? null,
397
+ onChange: field_0.onChange,
398
+ onBlur: field_0.onBlur,
399
+ isDirty,
400
+ isDisabled: field_0.disabled || props.isDisabled,
401
+ isFormControlDisabled: !!controlWithOptions._options?.disabled,
402
+ error: props.error ?? error?.message,
403
+ fullIso,
404
+ granularity,
405
+ minValue,
406
+ maxValue,
407
+ renderStaticInput
408
+ })
540
409
  });
541
- $[26] = fullIso;
542
- $[27] = granularity;
543
- $[28] = maxValue;
544
- $[29] = minValue;
545
- $[30] = props;
546
- $[31] = renderStaticInput;
547
- $[32] = t3;
548
- } else t3 = $[32];
549
- return t3;
410
+ }
411
+ return /* @__PURE__ */ jsx(DatePickerInner, {
412
+ ...props,
413
+ fullIso,
414
+ granularity,
415
+ minValue,
416
+ maxValue,
417
+ renderStaticInput
418
+ });
550
419
  };
551
- function _temp(input, staticTarget) {
552
- const container = input.getContainer?.() ?? input;
553
- return container instanceof HTMLElement ? getStaticDateTimeFocusTarget(container, staticTarget) : null;
554
- }
555
- function _temp2(input_0) {
556
- const container_0 = input_0.getContainer?.() ?? input_0;
557
- if (!(container_0 instanceof HTMLElement)) return null;
558
- return container_0.querySelector("[data-static-press-action]");
559
- }
560
- function _temp3() {}
561
420
  //#endregion
562
421
  export { DatePicker };
@@ -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"> {