@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
@@ -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,17 +14,14 @@ 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
- import { c } from "react/compiler-runtime";
19
18
  import { jsx, jsxs } from "react/jsx-runtime";
20
19
  import { clsx } from "clsx";
21
- import { useCallback, useImperativeHandle, useMemo, useRef, useState } from "react";
20
+ import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
22
21
  import { Button } from "react-aria-components";
23
22
  import { useDateRangePicker, useLocale as useLocale$1 } from "react-aria";
24
23
  import { mergeRefs } from "@react-aria/utils";
25
24
  import { useTranslation } from "react-i18next";
26
- import { Controller } from "react-hook-form";
27
25
  import { createCalendar, endOfMonth, endOfWeek, endOfYear, getLocalTimeZone, startOfMonth, startOfWeek, startOfYear, toCalendarDate, today } from "@internationalized/date";
28
26
  import { DateTime } from "luxon";
29
27
  import { useDateRangePickerState, useRangeCalendarState } from "react-stately";
@@ -31,7 +29,7 @@ import { useDateRangePickerState, useRangeCalendarState } from "react-stately";
31
29
  var DateRangePickerBase = (props) => {
32
30
  const ui = UIConfig.useConfig();
33
31
  const { t } = useTranslation();
34
- 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;
35
33
  const hideLabel = hideLabelProp ?? ui.input.hideLabel;
36
34
  const variant = variantProp ?? ui.input.variant;
37
35
  const as = asProp ?? ui.input.as;
@@ -44,7 +42,6 @@ var DateRangePickerBase = (props) => {
44
42
  const shouldForceLeadingZeros = shouldForceLeadingZerosProp ?? ui.dateInput.shouldForceLeadingZeros;
45
43
  const disableManualEntry = disableManualEntryProp ?? ui.dateInput.disableManualEntry;
46
44
  const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
47
- const fireBlurOnChange = fireBlurOnChangeProp ?? ui.dateInput.fireBlurOnChange;
48
45
  const allowPartialRange = allowPartialRangeProp ?? ui.dateInput.allowPartialRange;
49
46
  const timeZone = ui.dateInput.timeZone;
50
47
  let effectiveTimeZone = getLocalTimeZone();
@@ -78,7 +75,6 @@ var DateRangePickerBase = (props) => {
78
75
  onChange?.(newValue);
79
76
  if (isInvalidRange) return;
80
77
  handleCalendarStatesChange(newValue);
81
- if (fireBlurOnChange) debouncedBlur(newValue);
82
78
  },
83
79
  shouldCloseOnSelect: false
84
80
  });
@@ -106,7 +102,6 @@ var DateRangePickerBase = (props) => {
106
102
  if (partialRange.start && partialRange.end) return;
107
103
  const newValue_0 = partialRange.start || partialRange.end ? partialRange : null;
108
104
  onChange?.(newValue_0);
109
- if (fireBlurOnChange) debouncedBlur(newValue_0);
110
105
  };
111
106
  const { locale } = useLocale$1();
112
107
  useImperativeHandle(ref, () => ({
@@ -118,7 +113,6 @@ var DateRangePickerBase = (props) => {
118
113
  const handleBlur = (newValue_1) => {
119
114
  onBlur?.({ target: { value: newValue_1 } });
120
115
  };
121
- const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
122
116
  const formFieldProps = {
123
117
  error: error || validationRangeError,
124
118
  label,
@@ -430,7 +424,6 @@ var DateRangePickerBase = (props) => {
430
424
  }
431
425
  }
432
426
  state.toggle();
433
- if (fireBlurOnChange) handleBlur(valueToApply);
434
427
  };
435
428
  const onTodayPress = () => {
436
429
  const todayDate = today(effectiveTimeZone);
@@ -458,27 +451,34 @@ var DateRangePickerBase = (props) => {
458
451
  isSelecting: false
459
452
  });
460
453
  setHoverDate(null);
461
- if (fireBlurOnChange) handleBlur(null);
462
454
  };
463
- const onOpenChange = (isOpen) => {
464
- state.toggle();
465
- if (!isOpen) {
466
- if (state.value) {
467
- dialogState.setValue(state.value);
468
- leftCalendarState.setValue(state.value);
469
- rightCalendarState.setValue(state.value);
470
- const startDate_3 = state.value.start || today(effectiveTimeZone);
471
- const endDate_3 = state.value.end || today(effectiveTimeZone).add({ months: 1 });
472
- leftCalendarState.setFocusedDate(startDate_3);
473
- if (startDate_3.year === endDate_3.year && startDate_3.month === endDate_3.month) rightCalendarState.setFocusedDate(startDate_3.add({ months: 1 }));
474
- else rightCalendarState.setFocusedDate(endDate_3);
475
- setRangeSelection({
476
- start: state.value.start,
477
- end: state.value.end,
478
- isSelecting: false
479
- });
480
- }
455
+ const syncSelectionFromControlledValue = () => {
456
+ const currentValue = state.value;
457
+ if (!(currentValue != null && currentValue.start != null && currentValue.end != null)) {
458
+ syncCalendarStates(null);
459
+ return;
460
+ }
461
+ syncCalendarStates(currentValue);
462
+ const startDate_3 = currentValue.start;
463
+ const endDate_3 = currentValue.end;
464
+ leftCalendarState.setFocusedDate(startDate_3);
465
+ if (startDate_3.year === endDate_3.year && startDate_3.month === endDate_3.month) {
466
+ rightCalendarState.setFocusedDate(startDate_3.add({ months: 1 }));
467
+ return;
481
468
  }
469
+ rightCalendarState.setFocusedDate(endDate_3);
470
+ };
471
+ useEffect(() => {
472
+ if (!state.isOpen) return;
473
+ syncSelectionFromControlledValue();
474
+ }, [state.isOpen]);
475
+ const onOpenChange = (_isOpen) => {
476
+ state.toggle();
477
+ syncSelectionFromControlledValue();
478
+ };
479
+ const onOpenDropdown = () => {
480
+ syncSelectionFromControlledValue();
481
+ state.toggle();
482
482
  };
483
483
  const todayDate_0 = today(effectiveTimeZone);
484
484
  const getThisWeekRange = () => {
@@ -659,9 +659,8 @@ var DateRangePickerBase = (props) => {
659
659
  autoFixYear,
660
660
  placeholder,
661
661
  className: inputClassName,
662
- onOpenDropdown: () => state.toggle(),
662
+ onOpenDropdown,
663
663
  timeZone: effectiveTimeZone,
664
- fireBlurOnChange,
665
664
  onClear: onInputClear
666
665
  }), /* @__PURE__ */ jsx(DateTimeDialog, {
667
666
  hideSidebar,
@@ -713,10 +712,7 @@ var DateRangePickerBase = (props) => {
713
712
  })
714
713
  });
715
714
  };
716
- var DateRangePickerInner = (t0) => {
717
- const $ = c(21);
718
- const { fullIso: t1, minValue, maxValue, renderStaticInput, isFormControlDisabled, ...props } = t0;
719
- const fullIso = t1 === void 0 ? true : t1;
715
+ var DateRangePickerInner = ({ fullIso = true, minValue, maxValue, renderStaticInput, isFormControlDisabled, ...props }) => {
720
716
  const ui = UIConfig.useConfig();
721
717
  const datePickerInputContentRowCva = UIOverrides.useCva("datePickerInput.contentRowCva", datePickerInputContentRowDefinition);
722
718
  const { locale } = useLocale$1();
@@ -728,8 +724,15 @@ var DateRangePickerInner = (t0) => {
728
724
  inputRef,
729
725
  renderInput,
730
726
  setRenderInput,
731
- getFocusTarget: _temp,
732
- getPressTarget: _temp2
727
+ getFocusTarget: (input, staticTarget) => {
728
+ const container = input.getContainer?.() ?? input;
729
+ return container instanceof HTMLElement ? getStaticDateTimeFocusTarget(container, staticTarget) : null;
730
+ },
731
+ getPressTarget: (input_0) => {
732
+ const container_0 = input_0.getContainer?.() ?? input_0;
733
+ if (!(container_0 instanceof HTMLElement)) return null;
734
+ return container_0.querySelector("[data-static-press-action]");
735
+ }
733
736
  });
734
737
  const normalizedValue = props.value ?? null;
735
738
  const formatDateRange = (range) => {
@@ -760,43 +763,16 @@ var DateRangePickerInner = (t0) => {
760
763
  end: endZonedDateTime ? toCalendarDate(endZonedDateTime) : null
761
764
  };
762
765
  };
763
- let t2;
764
- if ($[0] !== fullIso) {
765
- t2 = (formattedDate) => {
766
- if (formattedDate == null) return null;
767
- if (fullIso) return DateTimeUtils.fromUTCISOToCalendarDate(formattedDate);
768
- const date = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
769
- return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date, "UTC"));
770
- };
771
- $[0] = fullIso;
772
- $[1] = t2;
773
- } else t2 = $[1];
774
- const parseCalendarDate = t2;
775
- let t3;
776
- if ($[2] !== minValue || $[3] !== parseCalendarDate) {
777
- t3 = typeof minValue === "string" ? parseCalendarDate(minValue) : minValue;
778
- $[2] = minValue;
779
- $[3] = parseCalendarDate;
780
- $[4] = t3;
781
- } else t3 = $[4];
782
- let t4;
783
- if ($[5] !== maxValue || $[6] !== parseCalendarDate) {
784
- t4 = typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue;
785
- $[5] = maxValue;
786
- $[6] = parseCalendarDate;
787
- $[7] = t4;
788
- } else t4 = $[7];
789
- let t5;
790
- if ($[8] !== t3 || $[9] !== t4) {
791
- t5 = {
792
- minValue: t3,
793
- maxValue: t4
794
- };
795
- $[8] = t3;
796
- $[9] = t4;
797
- $[10] = t5;
798
- } else t5 = $[10];
799
- const dateLimits = t5;
766
+ const parseCalendarDate = (formattedDate) => {
767
+ if (formattedDate == null) return null;
768
+ if (fullIso) return DateTimeUtils.fromUTCISOToCalendarDate(formattedDate);
769
+ const date = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
770
+ return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date, "UTC"));
771
+ };
772
+ const dateLimits = {
773
+ minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
774
+ maxValue: typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue
775
+ };
800
776
  if (!renderInput) {
801
777
  const startDateValue = parseCalendarDate(normalizedValue?.start ?? null);
802
778
  const endDateValue = parseCalendarDate(normalizedValue?.end ?? null);
@@ -856,153 +832,51 @@ var DateRangePickerInner = (t0) => {
856
832
  trailingClassName: "py-0! pl-0!",
857
833
  action: showDropdown ? {
858
834
  icon: ui.dateInput.calendarIcon,
859
- onClick: _temp3,
835
+ onClick: () => {},
860
836
  altText: ""
861
837
  } : void 0,
862
838
  children: staticSegments
863
839
  });
864
840
  }
865
- const T0 = DateRangePickerBase;
866
- const t6 = mergeRefs(props.ref, inputRef);
867
- const t7 = parseDateRange(normalizedValue);
868
- let t8;
869
- if ($[11] !== formatDateRange || $[12] !== props) {
870
- t8 = (value) => props.onChange?.(formatDateRange(value));
871
- $[11] = formatDateRange;
872
- $[12] = props;
873
- $[13] = t8;
874
- } else t8 = $[13];
875
- let t9;
876
- if ($[14] !== T0 || $[15] !== dateLimits || $[16] !== props || $[17] !== t6 || $[18] !== t7 || $[19] !== t8) {
877
- t9 = /* @__PURE__ */ jsx(T0, {
878
- ...props,
879
- ...dateLimits,
880
- ref: t6,
881
- value: t7,
882
- onChange: t8
883
- });
884
- $[14] = T0;
885
- $[15] = dateLimits;
886
- $[16] = props;
887
- $[17] = t6;
888
- $[18] = t7;
889
- $[19] = t8;
890
- $[20] = t9;
891
- } else t9 = $[20];
892
- return t9;
841
+ return /* @__PURE__ */ jsx(DateRangePickerBase, {
842
+ ...props,
843
+ ...dateLimits,
844
+ ref: mergeRefs(props.ref, inputRef),
845
+ value: parseDateRange(normalizedValue),
846
+ onChange: (value) => props.onChange?.(formatDateRange(value))
847
+ });
893
848
  };
894
- var DateRangePicker = (t0) => {
895
- const $ = c(30);
896
- let maxValue;
897
- let minValue;
898
- let props;
899
- let renderStaticInput;
900
- let t1;
901
- if ($[0] !== t0) {
902
- ({fullIso: t1, minValue, maxValue, renderStaticInput, ...props} = t0);
903
- $[0] = t0;
904
- $[1] = maxValue;
905
- $[2] = minValue;
906
- $[3] = props;
907
- $[4] = renderStaticInput;
908
- $[5] = t1;
909
- } else {
910
- maxValue = $[1];
911
- minValue = $[2];
912
- props = $[3];
913
- renderStaticInput = $[4];
914
- t1 = $[5];
915
- }
916
- const fullIso = t1 === void 0 ? true : t1;
917
- if ("formControl" in props && props.formControl) {
918
- let formControl;
919
- let innerProps;
920
- let ref;
921
- if ($[6] !== props) {
922
- ({formControl, ref, ...innerProps} = props);
923
- $[6] = props;
924
- $[7] = formControl;
925
- $[8] = innerProps;
926
- $[9] = ref;
927
- } else {
928
- formControl = $[7];
929
- innerProps = $[8];
930
- ref = $[9];
931
- }
932
- const controlWithOptions = formControl.control;
933
- let t2;
934
- if ($[10] !== controlWithOptions._options?.disabled || $[11] !== fullIso || $[12] !== innerProps || $[13] !== maxValue || $[14] !== minValue || $[15] !== props.error || $[16] !== props.isDisabled || $[17] !== ref || $[18] !== renderStaticInput) {
935
- t2 = (t3) => {
936
- const { field, fieldState: t4 } = t3;
937
- const { error, isDirty } = t4;
938
- return /* @__PURE__ */ jsx(DateRangePickerInner, {
939
- ...innerProps,
940
- ref: mergeRefs(ref, field.ref),
941
- value: field.value ?? null,
942
- onChange: field.onChange,
943
- onBlur: field.onBlur,
944
- isDirty,
945
- isDisabled: field.disabled || props.isDisabled,
946
- isFormControlDisabled: !!controlWithOptions._options?.disabled,
947
- error: props.error ?? error?.message,
948
- fullIso,
949
- minValue,
950
- maxValue,
951
- renderStaticInput
952
- });
953
- };
954
- $[10] = controlWithOptions._options?.disabled;
955
- $[11] = fullIso;
956
- $[12] = innerProps;
957
- $[13] = maxValue;
958
- $[14] = minValue;
959
- $[15] = props.error;
960
- $[16] = props.isDisabled;
961
- $[17] = ref;
962
- $[18] = renderStaticInput;
963
- $[19] = t2;
964
- } else t2 = $[19];
965
- let t3;
966
- if ($[20] !== formControl.control || $[21] !== formControl.name || $[22] !== t2) {
967
- t3 = /* @__PURE__ */ jsx(Controller, {
968
- control: formControl.control,
969
- name: formControl.name,
970
- render: t2
971
- });
972
- $[20] = formControl.control;
973
- $[21] = formControl.name;
974
- $[22] = t2;
975
- $[23] = t3;
976
- } else t3 = $[23];
977
- return t3;
978
- }
979
- let t2;
980
- if ($[24] !== fullIso || $[25] !== maxValue || $[26] !== minValue || $[27] !== props || $[28] !== renderStaticInput) {
981
- t2 = /* @__PURE__ */ jsx(DateRangePickerInner, {
982
- ...props,
983
- fullIso,
984
- minValue,
985
- maxValue,
986
- renderStaticInput
849
+ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput, ...props }) => {
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, {
857
+ ...innerProps,
858
+ ref: mergeRefs(ref, field_0.ref),
859
+ value: field_0.value ?? null,
860
+ onChange: field_0.onChange,
861
+ onBlur: field_0.onBlur,
862
+ isDirty,
863
+ isDisabled: field_0.disabled || props.isDisabled,
864
+ isFormControlDisabled: !!controlWithOptions._options?.disabled,
865
+ error: props.error ?? error?.message,
866
+ fullIso,
867
+ minValue,
868
+ maxValue,
869
+ renderStaticInput
870
+ })
987
871
  });
988
- $[24] = fullIso;
989
- $[25] = maxValue;
990
- $[26] = minValue;
991
- $[27] = props;
992
- $[28] = renderStaticInput;
993
- $[29] = t2;
994
- } else t2 = $[29];
995
- return t2;
872
+ }
873
+ return /* @__PURE__ */ jsx(DateRangePickerInner, {
874
+ ...props,
875
+ fullIso,
876
+ minValue,
877
+ maxValue,
878
+ renderStaticInput
879
+ });
996
880
  };
997
- function _temp(input, staticTarget) {
998
- const container = input.getContainer?.() ?? input;
999
- return container instanceof HTMLElement ? getStaticDateTimeFocusTarget(container, staticTarget) : null;
1000
- }
1001
- function _temp2(input_0) {
1002
- const container_0 = input_0.getContainer?.() ?? input_0;
1003
- if (!(container_0 instanceof HTMLElement)) return null;
1004
- return container_0.querySelector("[data-static-press-action]");
1005
- }
1006
- function _temp3() {}
1007
881
  //#endregion
1008
882
  export { DateRangePicker };
@@ -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;