@povio/ui 2.3.0-rc.4 → 2.3.0-rc.40

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 (231) hide show
  1. package/dist/assets/icons/AlignCenter.js +26 -11
  2. package/dist/assets/icons/AlignLeft.js +26 -11
  3. package/dist/assets/icons/AlignLeftRight.js +26 -11
  4. package/dist/assets/icons/AlignRight.js +26 -11
  5. package/dist/assets/icons/ArrowDropDown.js +26 -11
  6. package/dist/assets/icons/ArrowDropUp.js +26 -11
  7. package/dist/assets/icons/ArrowLeft.js +26 -11
  8. package/dist/assets/icons/ArrowRight.js +26 -11
  9. package/dist/assets/icons/Bold.js +26 -11
  10. package/dist/assets/icons/BulletedList.js +26 -11
  11. package/dist/assets/icons/Calendar.js +28 -13
  12. package/dist/assets/icons/Check.js +28 -13
  13. package/dist/assets/icons/CheckCircle.js +26 -11
  14. package/dist/assets/icons/CheckboxCheckmark.js +29 -14
  15. package/dist/assets/icons/CheckboxIndeterminate.js +29 -14
  16. package/dist/assets/icons/ChevronDown.js +28 -13
  17. package/dist/assets/icons/ChevronLeft.js +28 -13
  18. package/dist/assets/icons/ChevronRight.js +28 -13
  19. package/dist/assets/icons/ChevronUp.js +28 -13
  20. package/dist/assets/icons/ChevronsLeft.js +28 -13
  21. package/dist/assets/icons/ChevronsRight.js +28 -13
  22. package/dist/assets/icons/Clock.js +26 -11
  23. package/dist/assets/icons/Close.js +26 -11
  24. package/dist/assets/icons/DateTime.js +35 -14
  25. package/dist/assets/icons/DragIndicator.js +26 -11
  26. package/dist/assets/icons/File.js +28 -13
  27. package/dist/assets/icons/Highlight.js +26 -11
  28. package/dist/assets/icons/HighlightOn.js +49 -15
  29. package/dist/assets/icons/Home.js +26 -11
  30. package/dist/assets/icons/Info.js +37 -16
  31. package/dist/assets/icons/Italic.js +26 -11
  32. package/dist/assets/icons/Link.js +26 -11
  33. package/dist/assets/icons/Menu.js +26 -11
  34. package/dist/assets/icons/NumberedList.js +26 -11
  35. package/dist/assets/icons/PointerHorizontal.js +26 -11
  36. package/dist/assets/icons/PointerVertical.js +26 -11
  37. package/dist/assets/icons/Search.js +26 -11
  38. package/dist/assets/icons/Send.js +28 -13
  39. package/dist/assets/icons/Strikethrough.js +26 -11
  40. package/dist/assets/icons/TextColor.js +48 -14
  41. package/dist/assets/icons/Today.js +26 -11
  42. package/dist/assets/icons/Underlined.js +28 -13
  43. package/dist/assets/icons/Upload.js +35 -14
  44. package/dist/assets/icons/Visibility.js +26 -11
  45. package/dist/assets/icons/VisibilityOff.js +26 -11
  46. package/dist/assets/icons/WarningFilled.js +28 -13
  47. package/dist/components/Breadcrumbs/Breadcrumbs.js +207 -56
  48. package/dist/components/Menu/Menu.js +18 -2
  49. package/dist/components/Menu/MenuDesktop.js +41 -7
  50. package/dist/components/Menu/MenuItem.js +32 -9
  51. package/dist/components/Menu/MenuMobile.js +97 -38
  52. package/dist/components/Menu/MenuPopover.js +105 -29
  53. package/dist/components/buttons/IconButton/IconButton.js +40 -8
  54. package/dist/components/buttons/InlineIconButton/InlineIconButton.js +34 -9
  55. package/dist/components/buttons/PillButton/PillButton.js +55 -17
  56. package/dist/components/buttons/SplitButton/SplitButton.js +103 -18
  57. package/dist/components/buttons/TextButton/TextButton.js +30 -8
  58. package/dist/components/buttons/ToggleButton/ToggleButton.js +28 -8
  59. package/dist/components/buttons/shared/ButtonContent.js +80 -22
  60. package/dist/components/inputs/Checkbox/Checkbox.d.ts +1 -0
  61. package/dist/components/inputs/Checkbox/Checkbox.js +193 -34
  62. package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +24 -10
  63. package/dist/components/inputs/Checkbox/checkbox.cva.js +2 -0
  64. package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +1 -0
  65. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +289 -93
  66. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -0
  67. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +376 -189
  68. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +1 -0
  69. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +189 -75
  70. package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +1 -0
  71. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +559 -159
  72. package/dist/components/inputs/DateTime/shared/Calendar.js +333 -137
  73. package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +2 -1
  74. package/dist/components/inputs/DateTime/shared/CalendarCell.js +301 -102
  75. package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +2 -1
  76. package/dist/components/inputs/DateTime/shared/CalendarGrid.js +146 -33
  77. package/dist/components/inputs/DateTime/shared/CalendarHeader.js +245 -90
  78. package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
  79. package/dist/components/inputs/DateTime/shared/DateField.js +311 -112
  80. package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +7 -1
  81. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +374 -147
  82. package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +3 -2
  83. package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +93 -21
  84. package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +81 -27
  85. package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +59 -10
  86. package/dist/components/inputs/DateTime/shared/MonthPicker.js +103 -58
  87. package/dist/components/inputs/DateTime/shared/RangeCalendar.js +193 -82
  88. package/dist/components/inputs/DateTime/shared/TimeField.js +27 -8
  89. package/dist/components/inputs/DateTime/shared/TimePickerForm.js +279 -110
  90. package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +3 -1
  91. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +208 -70
  92. package/dist/components/inputs/DateTime/shared/YearPicker.js +119 -68
  93. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +9 -1
  94. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +43 -7
  95. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +16 -8
  96. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +46 -41
  97. package/dist/components/inputs/File/FileUpload.js +86 -44
  98. package/dist/components/inputs/File/FileUploadContainer.js +15 -7
  99. package/dist/components/inputs/File/InputUpload.js +317 -79
  100. package/dist/components/inputs/File/shared/FileCard.js +104 -41
  101. package/dist/components/inputs/File/shared/FileCardList.js +47 -12
  102. package/dist/components/inputs/File/shared/FileUploadContent.js +175 -44
  103. package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +149 -46
  104. package/dist/components/inputs/File/shared/FileUploadContentError.js +234 -93
  105. package/dist/components/inputs/File/shared/FileUploadContentFilled.js +230 -97
  106. package/dist/components/inputs/File/shared/FileUploadContentLoading.js +199 -55
  107. package/dist/components/inputs/File/shared/InputUploadContent.js +148 -35
  108. package/dist/components/inputs/File/shared/InputUploadFilled.js +50 -9
  109. package/dist/components/inputs/File/shared/ProgressBar.js +48 -9
  110. package/dist/components/inputs/FormField/FormField.js +119 -37
  111. package/dist/components/inputs/FormField/FormFieldError.js +25 -5
  112. package/dist/components/inputs/FormField/FormFieldHeader.js +79 -22
  113. package/dist/components/inputs/FormField/FormFieldHeaderClose.js +31 -7
  114. package/dist/components/inputs/FormField/FormFieldHelper.js +26 -6
  115. package/dist/components/inputs/FormField/FormFieldLabel.js +40 -9
  116. package/dist/components/inputs/Input/NumberInput/NumberInput.js +400 -125
  117. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +541 -116
  118. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +486 -146
  119. package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +48 -9
  120. package/dist/components/inputs/Input/TextArea/TextArea.js +298 -89
  121. package/dist/components/inputs/Input/TextInput/TextInput.js +370 -121
  122. package/dist/components/inputs/Input/shared/InputContent.js +190 -58
  123. package/dist/components/inputs/Inputs/Form.js +40 -11
  124. package/dist/components/inputs/Inputs/InputItem.d.ts +0 -1
  125. package/dist/components/inputs/Inputs/InputItem.js +65 -16
  126. package/dist/components/inputs/Inputs/Inputs.js +37 -11
  127. package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -0
  128. package/dist/components/inputs/RadioGroup/RadioGroup.js +320 -108
  129. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +146 -50
  130. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +4 -4
  131. package/dist/components/inputs/Selection/Select/QuerySelect.js +90 -28
  132. package/dist/components/inputs/Selection/Select/Select.js +140 -45
  133. package/dist/components/inputs/Selection/shared/SelectBase.js +69 -20
  134. package/dist/components/inputs/Selection/shared/SelectDesktop.js +390 -143
  135. package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
  136. package/dist/components/inputs/Selection/shared/SelectInput.js +328 -137
  137. package/dist/components/inputs/Selection/shared/SelectInputTags.js +99 -25
  138. package/dist/components/inputs/Selection/shared/SelectListBox.js +163 -51
  139. package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +85 -35
  140. package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +69 -16
  141. package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +70 -21
  142. package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +58 -9
  143. package/dist/components/inputs/Selection/shared/SelectMobile.js +3 -2
  144. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +9 -0
  145. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +47 -0
  146. package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +1 -0
  147. package/dist/components/inputs/Selection/shared/querySelect.utils.js +12 -1
  148. package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -2
  149. package/dist/components/inputs/Selection/shared/select.context.js +47 -39
  150. package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +5 -0
  151. package/dist/components/inputs/Selection/shared/selectInput.cva.js +5 -0
  152. package/dist/components/inputs/Selection/shared/useSelectItems.js +109 -49
  153. package/dist/components/inputs/Skeleton/InputFrame.d.ts +3 -0
  154. package/dist/components/inputs/Skeleton/InputFrame.js +445 -117
  155. package/dist/components/inputs/Slider/Slider.d.ts +2 -1
  156. package/dist/components/inputs/Slider/Slider.js +265 -78
  157. package/dist/components/inputs/TextEditor/TextEditor.js +447 -103
  158. package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +37 -11
  159. package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +102 -30
  160. package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +194 -45
  161. package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +88 -28
  162. package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +48 -14
  163. package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +66 -19
  164. package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +49 -15
  165. package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +92 -32
  166. package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +126 -54
  167. package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +141 -38
  168. package/dist/components/inputs/Toggle/Toggle.d.ts +1 -0
  169. package/dist/components/inputs/Toggle/Toggle.js +212 -41
  170. package/dist/components/inputs/Toggle/toggle.cva.js +2 -1
  171. package/dist/components/inputs/shared/CheckContent.js +21 -10
  172. package/dist/components/inputs/shared/InputClear.js +88 -21
  173. package/dist/components/inputs/shared/TooltipWrapper.js +47 -12
  174. package/dist/components/inputs/shared/input.cva.js +35 -13
  175. package/dist/components/inputs/shared/label.cva.js +2 -2
  176. package/dist/components/inputs/shared/useStaticInputHandoff.js +83 -40
  177. package/dist/components/navigation/Accordion/Accordion.js +69 -22
  178. package/dist/components/navigation/Accordion/AccordionItem.js +86 -41
  179. package/dist/components/navigation/Stepper/Stepper.js +67 -22
  180. package/dist/components/navigation/Stepper/StepperItem.js +104 -31
  181. package/dist/components/navigation/Stepper/StepperSeparator.js +23 -5
  182. package/dist/components/overlays/ActionModal/ActionModal.js +169 -35
  183. package/dist/components/overlays/BottomSheet/BottomSheet.js +122 -25
  184. package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +48 -8
  185. package/dist/components/overlays/Drawer/Drawer.js +62 -20
  186. package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +83 -27
  187. package/dist/components/overlays/Tooltip/Tooltip.js +137 -28
  188. package/dist/components/overlays/Tooltip/TooltipEllipsis.js +37 -12
  189. package/dist/components/segment/Segment.js +218 -57
  190. package/dist/components/segment/SegmentItem.js +67 -10
  191. package/dist/components/shared/pagination/Pagination.js +108 -22
  192. package/dist/components/shared/pagination/PaginationList.js +167 -64
  193. package/dist/components/status/Alert/Alert.js +97 -30
  194. package/dist/components/status/Loader/Loader.js +77 -22
  195. package/dist/components/status/Toast/Toast.js +21 -13
  196. package/dist/components/status/Toast/useToast.js +62 -57
  197. package/dist/components/table/ColumnConfig.js +158 -54
  198. package/dist/components/table/InfiniteTable.js +67 -16
  199. package/dist/components/table/PaginatedTable.js +84 -18
  200. package/dist/components/table/Table.js +23 -23
  201. package/dist/components/text/Link/Link.js +19 -7
  202. package/dist/components/text/Typography/Typography.js +23 -8
  203. package/dist/config/confirmation.context.js +1 -1
  204. package/dist/config/link.context.js +23 -9
  205. package/dist/config/router.context.js +42 -16
  206. package/dist/config/theme.context.js +98 -45
  207. package/dist/config/uiConfig.context.d.ts +7 -5
  208. package/dist/config/uiConfig.context.js +52 -12
  209. package/dist/config/uiStyle.context.js +15 -5
  210. package/dist/helpers/dynamicInputs.d.ts +1 -1
  211. package/dist/hooks/useBreakpoint.js +16 -3
  212. package/dist/hooks/useDebounceCallback.js +51 -17
  213. package/dist/hooks/useFilters.js +125 -64
  214. package/dist/hooks/useForm.js +42 -8
  215. package/dist/hooks/useFormAutosave.js +101 -30
  216. package/dist/hooks/useIntersectionObserver.js +86 -32
  217. package/dist/hooks/useLocalStorage.js +43 -10
  218. package/dist/hooks/useLongPressRepeat.js +55 -20
  219. package/dist/hooks/usePagination.js +49 -19
  220. package/dist/hooks/useQueryAutocomplete.js +1 -0
  221. package/dist/hooks/useScrollableListBox.js +37 -16
  222. package/dist/hooks/useSorting.js +69 -28
  223. package/dist/hooks/useStateAndRef.js +21 -7
  224. package/dist/hooks/useTableColumnConfig.js +124 -31
  225. package/dist/hooks/useTranslationMemo.js +25 -5
  226. package/dist/index.js +2 -2
  227. package/dist/tw-ui-plugin.js +6 -1
  228. package/dist/utils/date-time.utils.d.ts +7 -0
  229. package/dist/utils/date-time.utils.js +34 -23
  230. package/dist/utils/dom.utils.js +1 -1
  231. package/package.json +1 -1
@@ -15,6 +15,7 @@ import { InputFrame } from "../../Skeleton/InputFrame.js";
15
15
  import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
16
16
  import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
17
17
  import { RangeCalendar } from "../shared/RangeCalendar.js";
18
+ import { c } from "react/compiler-runtime";
18
19
  import { jsx, jsxs } from "react/jsx-runtime";
19
20
  import { clsx } from "clsx";
20
21
  import { useCallback, useImperativeHandle, useMemo, useRef, useState } from "react";
@@ -22,15 +23,16 @@ import { Button } from "react-aria-components";
22
23
  import { useDateRangePicker, useLocale as useLocale$1 } from "react-aria";
23
24
  import { mergeRefs } from "@react-aria/utils";
24
25
  import { useTranslation } from "react-i18next";
25
- import { Controller, useWatch } from "react-hook-form";
26
- import { createCalendar, endOfMonth, endOfWeek, endOfYear, getLocalTimeZone, startOfMonth, startOfWeek, startOfYear, toCalendarDate, today } from "@internationalized/date";
26
+ import { Controller } from "react-hook-form";
27
+ import { createCalendar, endOfMonth, endOfWeek, endOfYear, startOfMonth, startOfWeek, startOfYear, toCalendarDate, today } from "@internationalized/date";
27
28
  import { DateTime } from "luxon";
28
29
  import { useDateRangePickerState, useRangeCalendarState } from "react-stately";
29
30
  //#region src/components/inputs/DateTime/DateRangePicker/DateRangePicker.tsx
31
+ var DATE_PICKER_TIME_ZONE = "UTC";
30
32
  var DateRangePickerBase = (props) => {
31
33
  const ui = UIConfig.useConfig();
32
34
  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, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, autoFixYear: autoFixYearProp, ...rest } = props;
35
+ 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, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, autoFixYear: autoFixYearProp, fireBlurOnChange: fireBlurOnChangeProp, ...rest } = props;
34
36
  const hideLabel = hideLabelProp ?? ui.input.hideLabel;
35
37
  const variant = variantProp ?? ui.input.variant;
36
38
  const as = asProp ?? ui.input.as;
@@ -42,26 +44,28 @@ var DateRangePickerBase = (props) => {
42
44
  const shouldForceLeadingZeros = shouldForceLeadingZerosProp ?? ui.dateInput.shouldForceLeadingZeros;
43
45
  const disableManualEntry = disableManualEntryProp ?? ui.dateInput.disableManualEntry;
44
46
  const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
47
+ const fireBlurOnChange = fireBlurOnChangeProp ?? ui.dateInput.fireBlurOnChange;
45
48
  const [validationRangeError, setValidationRangeError] = useState();
46
49
  const datePickerInputRef = useRef(null);
47
50
  const dateRangePickerRef = useMemo(() => ({ get current() {
48
51
  return datePickerInputRef.current?.getContainer?.() || null;
49
52
  } }), []);
53
+ const normalizedValue = value ?? null;
50
54
  const dialogState = useDateRangePickerState({
51
55
  ...rest,
52
- value,
56
+ value: normalizedValue,
53
57
  shouldCloseOnSelect: false,
54
58
  shouldForceLeadingZeros
55
59
  });
56
60
  const state = useDateRangePickerState({
57
61
  ...rest,
58
62
  shouldForceLeadingZeros,
59
- value,
63
+ value: normalizedValue,
60
64
  onChange: (newValue) => {
61
65
  if (isValidRange(newValue)) return;
62
66
  onChange?.(newValue);
63
67
  handleCalendarStatesChange(newValue);
64
- debouncedBlur(newValue);
68
+ if (fireBlurOnChange) debouncedBlur(newValue);
65
69
  },
66
70
  shouldCloseOnSelect: false
67
71
  });
@@ -76,11 +80,14 @@ var DateRangePickerBase = (props) => {
76
80
  shouldForceLeadingZeros
77
81
  }, dialogState, dateRangePickerRef);
78
82
  const { locale } = useLocale$1();
79
- useImperativeHandle(ref, () => ({ clear: () => {
80
- datePickerInputRef.current?.clear();
81
- } }));
82
- const handleBlur = (newValue) => {
83
- onBlur?.({ target: { value: newValue } });
83
+ useImperativeHandle(ref, () => ({
84
+ clear: () => {
85
+ datePickerInputRef.current?.clear();
86
+ },
87
+ getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
88
+ }));
89
+ const handleBlur = (newValue_0) => {
90
+ onBlur?.({ target: { value: newValue_0 } });
84
91
  };
85
92
  const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
86
93
  const formFieldProps = {
@@ -111,7 +118,7 @@ var DateRangePickerBase = (props) => {
111
118
  createCalendar,
112
119
  pageBehavior: "single",
113
120
  visibleDuration: { months: 1 },
114
- defaultFocusedValue: today(getLocalTimeZone()).add({ months: 1 }),
121
+ defaultFocusedValue: today(DATE_PICKER_TIME_ZONE).add({ months: 1 }),
115
122
  minValue: void 0,
116
123
  maxValue: void 0
117
124
  });
@@ -133,10 +140,10 @@ var DateRangePickerBase = (props) => {
133
140
  className: headerClassName,
134
141
  labelProps
135
142
  };
136
- const isValidRange = useCallback((newValue) => {
137
- if (newValue?.start && newValue?.end) {
138
- const startDate = newValue.start;
139
- if (newValue.end.compare(startDate) < 0) {
143
+ const isValidRange = useCallback((newValue_1) => {
144
+ if (newValue_1?.start && newValue_1?.end) {
145
+ const startDate = newValue_1.start;
146
+ if (newValue_1.end.compare(startDate) < 0) {
140
147
  setValidationRangeError(t(($) => $.ui.datePicker.errors.endDateBeforeStart, { ns: "ui" }));
141
148
  return true;
142
149
  }
@@ -144,20 +151,20 @@ var DateRangePickerBase = (props) => {
144
151
  } else setValidationRangeError(void 0);
145
152
  return false;
146
153
  }, [t]);
147
- const handleCalendarStatesChange = (newValue) => {
148
- if (newValue) {
149
- if (isValidRange(newValue)) return;
150
- dialogState.setValue(newValue);
151
- const startDate = newValue.start;
152
- const endDate = newValue.end;
153
- leftCalendarState.setFocusedDate(startDate);
154
- if (startDate.year === endDate.year && startDate.month === endDate.month) rightCalendarState.setFocusedDate(startDate.add({ months: 1 }));
155
- else rightCalendarState.setFocusedDate(endDate);
156
- leftCalendarState.setValue(newValue);
157
- rightCalendarState.setValue(newValue);
154
+ const handleCalendarStatesChange = (newValue_2) => {
155
+ if (newValue_2) {
156
+ if (isValidRange(newValue_2)) return;
157
+ dialogState.setValue(newValue_2);
158
+ const startDate_0 = newValue_2.start;
159
+ const endDate_0 = newValue_2.end;
160
+ leftCalendarState.setFocusedDate(startDate_0);
161
+ if (startDate_0.year === endDate_0.year && startDate_0.month === endDate_0.month) rightCalendarState.setFocusedDate(startDate_0.add({ months: 1 }));
162
+ else rightCalendarState.setFocusedDate(endDate_0);
163
+ leftCalendarState.setValue(newValue_2);
164
+ rightCalendarState.setValue(newValue_2);
158
165
  setRangeSelection({
159
- start: newValue.start,
160
- end: newValue.end,
166
+ start: newValue_2.start,
167
+ end: newValue_2.end,
161
168
  isSelecting: false
162
169
  });
163
170
  setHoverDate(null);
@@ -181,27 +188,27 @@ var DateRangePickerBase = (props) => {
181
188
  setHoverDate(date);
182
189
  });
183
190
  }, []);
184
- const handleDateHover = useCallback((date) => {
185
- if (rangeSelection.isSelecting && rangeSelection.start) throttledSetHoverDate(date);
191
+ const handleDateHover = useCallback((date_0) => {
192
+ if (rangeSelection.isSelecting && rangeSelection.start) throttledSetHoverDate(date_0);
186
193
  }, [
187
194
  rangeSelection.isSelecting,
188
195
  rangeSelection.start,
189
196
  throttledSetHoverDate
190
197
  ]);
191
- const handleDateSelection = useCallback((date, calendarSide) => {
198
+ const handleDateSelection = useCallback((date_1, calendarSide) => {
192
199
  if (calendarSide) {
193
200
  const currentVisibleMonth = (calendarSide === "left" ? leftCalendarState : rightCalendarState).visibleRange.start;
194
- if (date.month !== currentVisibleMonth.month || date.year !== currentVisibleMonth.year) if (calendarSide === "left") {
195
- leftCalendarState.setFocusedDate(date);
196
- rightCalendarState.setFocusedDate(date.add({ months: 1 }));
201
+ if (date_1.month !== currentVisibleMonth.month || date_1.year !== currentVisibleMonth.year) if (calendarSide === "left") {
202
+ leftCalendarState.setFocusedDate(date_1);
203
+ rightCalendarState.setFocusedDate(date_1.add({ months: 1 }));
197
204
  } else {
198
- rightCalendarState.setFocusedDate(date);
199
- leftCalendarState.setFocusedDate(date.subtract({ months: 1 }));
205
+ rightCalendarState.setFocusedDate(date_1);
206
+ leftCalendarState.setFocusedDate(date_1.subtract({ months: 1 }));
200
207
  }
201
208
  }
202
209
  if (!rangeSelection.isSelecting || !rangeSelection.start) {
203
210
  setRangeSelection({
204
- start: date,
211
+ start: date_1,
205
212
  end: null,
206
213
  isSelecting: true
207
214
  });
@@ -210,7 +217,7 @@ var DateRangePickerBase = (props) => {
210
217
  rightCalendarState.setValue(null);
211
218
  } else {
212
219
  const { start } = rangeSelection;
213
- const end = date;
220
+ const end = date_1;
214
221
  const finalStart = start.compare(end) <= 0 ? start : end;
215
222
  const finalEnd = start.compare(end) <= 0 ? end : start;
216
223
  const newRange = {
@@ -234,16 +241,16 @@ var DateRangePickerBase = (props) => {
234
241
  rightCalendarState,
235
242
  dialogState
236
243
  ]);
237
- const handleKeyboardNavigation = useCallback((event, date, calendarSide) => {
238
- const currentState = calendarSide === "left" ? leftCalendarState : rightCalendarState;
239
- const otherState = calendarSide === "left" ? rightCalendarState : leftCalendarState;
244
+ const handleKeyboardNavigation = useCallback((event, date_2, calendarSide_0) => {
245
+ const currentState_0 = calendarSide_0 === "left" ? leftCalendarState : rightCalendarState;
246
+ const otherState = calendarSide_0 === "left" ? rightCalendarState : leftCalendarState;
240
247
  let shouldPreventDefault = false;
241
248
  switch (event.key) {
242
249
  case "ArrowRight": {
243
- const nextDate = date.add({ days: 1 });
244
- const currentMonth = currentState.visibleRange.start;
245
- const otherMonth = otherState.visibleRange.start;
246
- if (calendarSide === "left" && nextDate.month !== currentMonth.month) if (nextDate.year === otherMonth.year && nextDate.month === otherMonth.month) {
250
+ const nextDate = date_2.add({ days: 1 });
251
+ const currentMonth_2 = currentState_0.visibleRange.start;
252
+ const otherMonth_2 = otherState.visibleRange.start;
253
+ if (calendarSide_0 === "left" && nextDate.month !== currentMonth_2.month) if (nextDate.year === otherMonth_2.year && nextDate.month === otherMonth_2.month) {
247
254
  otherState.setFocusedDate(nextDate);
248
255
  shouldPreventDefault = true;
249
256
  } else {
@@ -253,10 +260,10 @@ var DateRangePickerBase = (props) => {
253
260
  break;
254
261
  }
255
262
  case "ArrowLeft": {
256
- const prevDate = date.subtract({ days: 1 });
257
- const currentMonth = currentState.visibleRange.start;
258
- const otherMonth = otherState.visibleRange.start;
259
- if (calendarSide === "right" && prevDate.month !== currentMonth.month) if (prevDate.year === otherMonth.year && prevDate.month === otherMonth.month) {
263
+ const prevDate = date_2.subtract({ days: 1 });
264
+ const currentMonth_1 = currentState_0.visibleRange.start;
265
+ const otherMonth_1 = otherState.visibleRange.start;
266
+ if (calendarSide_0 === "right" && prevDate.month !== currentMonth_1.month) if (prevDate.year === otherMonth_1.year && prevDate.month === otherMonth_1.month) {
260
267
  otherState.setFocusedDate(prevDate);
261
268
  shouldPreventDefault = true;
262
269
  } else {
@@ -266,10 +273,10 @@ var DateRangePickerBase = (props) => {
266
273
  break;
267
274
  }
268
275
  case "ArrowDown": {
269
- const nextWeekDate = date.add({ weeks: 1 });
270
- const currentMonth = currentState.visibleRange.start;
271
- const otherMonth = otherState.visibleRange.start;
272
- if (calendarSide === "left" && nextWeekDate.month !== currentMonth.month) if (nextWeekDate.year === otherMonth.year && nextWeekDate.month === otherMonth.month) {
276
+ const nextWeekDate = date_2.add({ weeks: 1 });
277
+ const currentMonth_0 = currentState_0.visibleRange.start;
278
+ const otherMonth_0 = otherState.visibleRange.start;
279
+ if (calendarSide_0 === "left" && nextWeekDate.month !== currentMonth_0.month) if (nextWeekDate.year === otherMonth_0.year && nextWeekDate.month === otherMonth_0.month) {
273
280
  otherState.setFocusedDate(nextWeekDate);
274
281
  shouldPreventDefault = true;
275
282
  } else {
@@ -279,10 +286,10 @@ var DateRangePickerBase = (props) => {
279
286
  break;
280
287
  }
281
288
  case "ArrowUp": {
282
- const prevWeekDate = date.subtract({ weeks: 1 });
283
- const currentMonth = currentState.visibleRange.start;
289
+ const prevWeekDate = date_2.subtract({ weeks: 1 });
290
+ const currentMonth = currentState_0.visibleRange.start;
284
291
  const otherMonth = otherState.visibleRange.start;
285
- if (calendarSide === "right" && prevWeekDate.month !== currentMonth.month) if (prevWeekDate.year === otherMonth.year && prevWeekDate.month === otherMonth.month) {
292
+ if (calendarSide_0 === "right" && prevWeekDate.month !== currentMonth.month) if (prevWeekDate.year === otherMonth.year && prevWeekDate.month === otherMonth.month) {
286
293
  otherState.setFocusedDate(prevWeekDate);
287
294
  shouldPreventDefault = true;
288
295
  } else {
@@ -293,7 +300,7 @@ var DateRangePickerBase = (props) => {
293
300
  }
294
301
  case "Enter":
295
302
  case " ":
296
- handleDateSelection(date);
303
+ handleDateSelection(date_2);
297
304
  shouldPreventDefault = true;
298
305
  break;
299
306
  case "Escape":
@@ -317,14 +324,14 @@ var DateRangePickerBase = (props) => {
317
324
  rightCalendarState,
318
325
  handleDateSelection
319
326
  ]);
320
- const syncCalendarStates = useCallback((newValue) => {
321
- if (isValidRange(newValue)) return;
322
- leftCalendarState.setValue(newValue);
323
- rightCalendarState.setValue(newValue);
324
- dialogState.setValue(newValue);
325
- if (newValue) setRangeSelection({
326
- start: newValue.start,
327
- end: newValue.end,
327
+ const syncCalendarStates = useCallback((newValue_3) => {
328
+ if (isValidRange(newValue_3)) return;
329
+ leftCalendarState.setValue(newValue_3);
330
+ rightCalendarState.setValue(newValue_3);
331
+ dialogState.setValue(newValue_3);
332
+ if (newValue_3) setRangeSelection({
333
+ start: newValue_3.start,
334
+ end: newValue_3.end,
328
335
  isSelecting: false
329
336
  });
330
337
  else setRangeSelection({
@@ -346,12 +353,12 @@ var DateRangePickerBase = (props) => {
346
353
  } : dialogState.value;
347
354
  if (valueToApply) {
348
355
  state.setValue(valueToApply);
349
- handleBlur(valueToApply);
356
+ if (fireBlurOnChange) handleBlur(valueToApply);
350
357
  }
351
358
  state.toggle();
352
359
  };
353
360
  const onTodayPress = () => {
354
- const todayDate = today(getLocalTimeZone());
361
+ const todayDate = today(DATE_PICKER_TIME_ZONE);
355
362
  leftCalendarState.setFocusedDate(todayDate);
356
363
  rightCalendarState.setFocusedDate(todayDate.add({ months: 1 }));
357
364
  syncCalendarStates({
@@ -359,6 +366,9 @@ var DateRangePickerBase = (props) => {
359
366
  end: todayDate
360
367
  });
361
368
  };
369
+ const onInputClear = () => {
370
+ onChange?.(null);
371
+ };
362
372
  const onOpenChange = (isOpen) => {
363
373
  state.toggle();
364
374
  if (!isOpen) {
@@ -366,11 +376,11 @@ var DateRangePickerBase = (props) => {
366
376
  dialogState.setValue(state.value);
367
377
  leftCalendarState.setValue(state.value);
368
378
  rightCalendarState.setValue(state.value);
369
- const startDate = state.value.start || today(getLocalTimeZone());
370
- const endDate = state.value.end || today(getLocalTimeZone()).add({ months: 1 });
371
- leftCalendarState.setFocusedDate(startDate);
372
- if (startDate.year === endDate.year && startDate.month === endDate.month) rightCalendarState.setFocusedDate(startDate.add({ months: 1 }));
373
- else rightCalendarState.setFocusedDate(endDate);
379
+ const startDate_1 = state.value.start || today(DATE_PICKER_TIME_ZONE);
380
+ const endDate_1 = state.value.end || today(DATE_PICKER_TIME_ZONE).add({ months: 1 });
381
+ leftCalendarState.setFocusedDate(startDate_1);
382
+ if (startDate_1.year === endDate_1.year && startDate_1.month === endDate_1.month) rightCalendarState.setFocusedDate(startDate_1.add({ months: 1 }));
383
+ else rightCalendarState.setFocusedDate(endDate_1);
374
384
  setRangeSelection({
375
385
  start: state.value.start,
376
386
  end: state.value.end,
@@ -379,87 +389,87 @@ var DateRangePickerBase = (props) => {
379
389
  }
380
390
  }
381
391
  };
382
- const todayDate = today(getLocalTimeZone());
392
+ const todayDate_0 = today(DATE_PICKER_TIME_ZONE);
383
393
  const getThisWeekRange = () => {
384
394
  return {
385
- start: startOfWeek(todayDate, locale),
386
- end: endOfWeek(todayDate, locale)
395
+ start: startOfWeek(todayDate_0, locale),
396
+ end: endOfWeek(todayDate_0, locale)
387
397
  };
388
398
  };
389
399
  const getLastWeekRange = () => {
390
- const thisWeekStart = startOfWeek(todayDate, locale);
400
+ const thisWeekStart = startOfWeek(todayDate_0, locale);
391
401
  return {
392
402
  start: thisWeekStart.subtract({ weeks: 1 }),
393
403
  end: thisWeekStart.subtract({ days: 1 })
394
404
  };
395
405
  };
396
406
  const getThisAndLastWeekRange = () => {
397
- const thisWeekEnd = endOfWeek(todayDate, locale);
407
+ const thisWeekEnd = endOfWeek(todayDate_0, locale);
398
408
  return {
399
- start: startOfWeek(todayDate, locale).subtract({ weeks: 1 }),
409
+ start: startOfWeek(todayDate_0, locale).subtract({ weeks: 1 }),
400
410
  end: thisWeekEnd
401
411
  };
402
412
  };
403
413
  const getThisMonthRange = () => {
404
414
  return {
405
- start: startOfMonth(todayDate),
406
- end: endOfMonth(todayDate)
415
+ start: startOfMonth(todayDate_0),
416
+ end: endOfMonth(todayDate_0)
407
417
  };
408
418
  };
409
419
  const getThisAndLastMonthRange = () => {
410
- const thisMonthEnd = endOfMonth(todayDate);
420
+ const thisMonthEnd = endOfMonth(todayDate_0);
411
421
  return {
412
- start: startOfMonth(todayDate).subtract({ months: 1 }),
422
+ start: startOfMonth(todayDate_0).subtract({ months: 1 }),
413
423
  end: thisMonthEnd
414
424
  };
415
425
  };
416
426
  const presets = [
417
427
  {
418
- label: t(($) => $.ui.datePicker.presets.thisWeek, { ns: "ui" }),
428
+ label: t(($_0) => $_0.ui.datePicker.presets.thisWeek, { ns: "ui" }),
419
429
  getValue: getThisWeekRange
420
430
  },
421
431
  {
422
- label: t(($) => $.ui.datePicker.presets.lastWeek, { ns: "ui" }),
432
+ label: t(($_1) => $_1.ui.datePicker.presets.lastWeek, { ns: "ui" }),
423
433
  getValue: getLastWeekRange
424
434
  },
425
435
  {
426
- label: t(($) => $.ui.datePicker.presets.thisAndLastWeek, { ns: "ui" }),
436
+ label: t(($_2) => $_2.ui.datePicker.presets.thisAndLastWeek, { ns: "ui" }),
427
437
  getValue: getThisAndLastWeekRange
428
438
  },
429
439
  {
430
- label: t(($) => $.ui.datePicker.presets.thisMonth, { ns: "ui" }),
440
+ label: t(($_3) => $_3.ui.datePicker.presets.thisMonth, { ns: "ui" }),
431
441
  getValue: getThisMonthRange
432
442
  },
433
443
  {
434
- label: t(($) => $.ui.datePicker.presets.thisAndLastMonth, { ns: "ui" }),
444
+ label: t(($_4) => $_4.ui.datePicker.presets.thisAndLastMonth, { ns: "ui" }),
435
445
  getValue: getThisAndLastMonthRange
436
446
  },
437
447
  {
438
- label: t(($) => $.ui.datePicker.presets.thisYear, { ns: "ui" }),
448
+ label: t(($_5) => $_5.ui.datePicker.presets.thisYear, { ns: "ui" }),
439
449
  getValue: () => ({
440
- start: startOfYear(todayDate),
441
- end: todayDate
450
+ start: startOfYear(todayDate_0),
451
+ end: todayDate_0
442
452
  })
443
453
  },
444
454
  {
445
- label: t(($) => $.ui.datePicker.presets.lastYear, { ns: "ui" }),
455
+ label: t(($_6) => $_6.ui.datePicker.presets.lastYear, { ns: "ui" }),
446
456
  getValue: () => ({
447
- start: startOfYear(todayDate.subtract({ years: 1 })),
448
- end: endOfYear(todayDate.subtract({ years: 1 }))
457
+ start: startOfYear(todayDate_0.subtract({ years: 1 })),
458
+ end: endOfYear(todayDate_0.subtract({ years: 1 }))
449
459
  })
450
460
  },
451
461
  {
452
- label: t(($) => $.ui.datePicker.presets.thisAndLastYear, { ns: "ui" }),
462
+ label: t(($_7) => $_7.ui.datePicker.presets.thisAndLastYear, { ns: "ui" }),
453
463
  getValue: () => ({
454
- start: startOfYear(todayDate.subtract({ years: 1 })),
455
- end: todayDate
464
+ start: startOfYear(todayDate_0.subtract({ years: 1 })),
465
+ end: todayDate_0
456
466
  })
457
467
  },
458
468
  {
459
- label: t(($) => $.ui.datePicker.presets.soFar, { ns: "ui" }),
469
+ label: t(($_8) => $_8.ui.datePicker.presets.soFar, { ns: "ui" }),
460
470
  getValue: () => ({
461
- start: startOfYear(todayDate),
462
- end: todayDate
471
+ start: startOfYear(todayDate_0),
472
+ end: todayDate_0
463
473
  })
464
474
  }
465
475
  ];
@@ -467,12 +477,12 @@ var DateRangePickerBase = (props) => {
467
477
  setActivePreset(preset.label);
468
478
  const presetValue = preset.getValue();
469
479
  syncCalendarStates(presetValue);
470
- const startDate = presetValue.start;
471
- leftCalendarState.setFocusedDate(startDate);
472
- const endDate = presetValue.end;
473
- if ((endDate.year - startDate.year) * 12 + (endDate.month - startDate.month) > 2) rightCalendarState.setFocusedDate(endDate);
480
+ const startDate_2 = presetValue.start;
481
+ leftCalendarState.setFocusedDate(startDate_2);
482
+ const endDate_2 = presetValue.end;
483
+ if ((endDate_2.year - startDate_2.year) * 12 + (endDate_2.month - startDate_2.month) > 2) rightCalendarState.setFocusedDate(endDate_2);
474
484
  else {
475
- const rightCalendarMonth = startDate.add({ months: 1 });
485
+ const rightCalendarMonth = startDate_2.add({ months: 1 });
476
486
  rightCalendarState.setFocusedDate(rightCalendarMonth);
477
487
  }
478
488
  };
@@ -484,14 +494,30 @@ var DateRangePickerBase = (props) => {
484
494
  ...formFieldProps,
485
495
  as,
486
496
  labelProps,
487
- className: clsx("relative inline-flex w-full flex-col text-left", className),
497
+ className: clsx("group relative inline-flex w-full flex-col text-left", className),
488
498
  tabIndex: as === "inline" ? -1 : void 0,
489
499
  children: [/* @__PURE__ */ jsx(DatePickerInput, {
490
500
  ref: mergeRefs(ref, datePickerInputRef),
491
501
  as,
492
502
  groupProps,
493
- fieldProps: startFieldProps,
494
- endFieldProps,
503
+ fieldProps: {
504
+ ...startFieldProps,
505
+ onBlur: (event_0) => {
506
+ startFieldProps.onBlur?.(event_0);
507
+ handleBlur(state.value);
508
+ }
509
+ },
510
+ endFieldProps: {
511
+ ...endFieldProps,
512
+ onBlur: (event_1) => {
513
+ endFieldProps.onBlur?.(event_1);
514
+ handleBlur(state.value);
515
+ }
516
+ },
517
+ fieldValue: normalizedValue?.start ?? null,
518
+ endFieldValue: normalizedValue?.end ?? null,
519
+ isValueControlled: true,
520
+ hasValue: normalizedValue?.start != null || normalizedValue?.end != null,
495
521
  buttonProps,
496
522
  isDisabled,
497
523
  isInvalid: !!error,
@@ -508,22 +534,25 @@ var DateRangePickerBase = (props) => {
508
534
  autoFixYear,
509
535
  placeholder,
510
536
  className: inputClassName,
511
- onOpenDropdown: () => state.toggle()
537
+ onOpenDropdown: () => state.toggle(),
538
+ timeZone: DATE_PICKER_TIME_ZONE,
539
+ fireBlurOnChange,
540
+ onClear: onInputClear
512
541
  }), /* @__PURE__ */ jsx(DateTimeDialog, {
513
542
  hideSidebar,
514
543
  sidebar: /* @__PURE__ */ jsx("div", {
515
544
  className: "flex w-full flex-row overflow-auto border-elevation-outline-default-1 border-solid [-ms-overflow-style:none] [scrollbar-width:none] md:w-[156px] md:flex-col md:border-r [&::-webkit-scrollbar]:hidden",
516
- children: presets.map((preset) => /* @__PURE__ */ jsx(Button, {
517
- onClick: () => selectPreset(preset),
518
- className: clsx("w-full px-2 py-1 text-left md:px-list-side-item-left md:py-list-height-item", activePreset !== preset.label && "text-interactive-text-secondary-idle hover:text-interactive-text-secondary-hover", activePreset === preset.label && "bg-interactive-contained-primary-idle text-interactive-text-secondary-idle-inverted"),
545
+ children: presets.map((preset_0) => /* @__PURE__ */ jsx(Button, {
546
+ onClick: () => selectPreset(preset_0),
547
+ className: clsx("w-full px-2 py-1 text-left md:px-list-side-item-left md:py-list-height-item", activePreset !== preset_0.label && "text-interactive-text-secondary-idle hover:text-interactive-text-secondary-hover", activePreset === preset_0.label && "bg-interactive-contained-primary-idle text-interactive-text-secondary-idle-inverted"),
519
548
  children: /* @__PURE__ */ jsx(Typography, {
520
549
  size: "label-2",
521
550
  sizeMobile: "label-3",
522
551
  as: "span",
523
552
  className: "whitespace-nowrap",
524
- children: preset.label
553
+ children: preset_0.label
525
554
  })
526
- }, preset.label))
555
+ }, preset_0.label))
527
556
  }),
528
557
  footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
529
558
  isDisabled,
@@ -558,7 +587,10 @@ var DateRangePickerBase = (props) => {
558
587
  })
559
588
  });
560
589
  };
561
- var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput, ...props }) => {
590
+ var DateRangePickerInner = (t0) => {
591
+ const $ = c(25);
592
+ const { fullIso: t1, minValue, maxValue, renderStaticInput, isFormControlDisabled, ...props } = t0;
593
+ const fullIso = t1 === void 0 ? true : t1;
562
594
  const ui = UIConfig.useConfig();
563
595
  const datePickerInputContentRowCva = UIStyle.useCva("datePickerInput.contentRowCva", datePickerInputContentRow);
564
596
  const { locale } = useLocale$1();
@@ -569,66 +601,101 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
569
601
  inputRef,
570
602
  renderInput,
571
603
  setRenderInput,
572
- getFocusTarget: (input) => {
573
- return (input.getContainer?.() ?? input).querySelector("input, button, [tabindex]:not([tabindex='-1'])");
574
- }
604
+ getFocusTarget: _temp
575
605
  });
576
- const watchedValue = "formControl" in props && props.formControl ? useWatch({
577
- control: props.formControl.control,
578
- name: props.formControl.name
579
- }) : props.value;
580
- let isFormControlDisabled = false;
581
- if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
582
- const rawValue = watchedValue ?? props.value ?? null;
583
- const formatDateRange = (range) => {
584
- if (!range?.start || !range?.end) return null;
585
- if (fullIso) return {
586
- start: DateTimeUtils.fromCalendarDateToUTCISO(range.start),
587
- end: DateTimeUtils.fromCalendarDateToUTCISO(range.end, { endOfDay: true })
606
+ const normalizedValue = props.value ?? null;
607
+ let t2;
608
+ if ($[0] !== fullIso) {
609
+ t2 = (range) => {
610
+ if (!range?.start || !range?.end) return null;
611
+ if (fullIso) return {
612
+ start: DateTimeUtils.fromCalendarDateToUTCISO(range.start),
613
+ end: DateTimeUtils.fromCalendarDateToUTCISO(range.end, { endOfDay: true })
614
+ };
615
+ const startDate = DateTimeUtils.fromDateValueToLocal(range.start, "UTC");
616
+ const endDate = DateTimeUtils.fromDateValueToLocal(range.end, "UTC");
617
+ return {
618
+ start: DateTime.fromJSDate(startDate, { zone: "UTC" }).toISODate(),
619
+ end: DateTime.fromJSDate(endDate, { zone: "UTC" }).toISODate()
620
+ };
588
621
  };
589
- const startDate = DateTimeUtils.fromDateValueToLocal(range.start);
590
- const endDate = DateTimeUtils.fromDateValueToLocal(range.end);
591
- return {
592
- start: DateTime.fromJSDate(startDate).toISODate(),
593
- end: DateTime.fromJSDate(endDate).toISODate()
622
+ $[0] = fullIso;
623
+ $[1] = t2;
624
+ } else t2 = $[1];
625
+ const formatDateRange = t2;
626
+ let t3;
627
+ if ($[2] !== fullIso) {
628
+ t3 = (formattedRange) => {
629
+ if (!formattedRange?.start || !formattedRange?.end) return null;
630
+ if (fullIso) return {
631
+ start: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.start),
632
+ end: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.end)
633
+ };
634
+ const startDate_0 = DateTime.fromISO(formattedRange.start, { zone: "UTC" }).toJSDate();
635
+ const endDate_0 = DateTime.fromISO(formattedRange.end, { zone: "UTC" }).toJSDate();
636
+ const startZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(startDate_0, "UTC");
637
+ const endZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(endDate_0, "UTC");
638
+ return {
639
+ start: toCalendarDate(startZonedDateTime),
640
+ end: toCalendarDate(endZonedDateTime)
641
+ };
594
642
  };
595
- };
596
- const parseDateRange = (formattedRange) => {
597
- if (!formattedRange?.start || !formattedRange?.end) return formattedRange;
598
- if (fullIso) return {
599
- start: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.start),
600
- end: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.end)
643
+ $[2] = fullIso;
644
+ $[3] = t3;
645
+ } else t3 = $[3];
646
+ const parseDateRange = t3;
647
+ let t4;
648
+ if ($[4] !== fullIso) {
649
+ t4 = (formattedDate) => {
650
+ if (formattedDate == null) return null;
651
+ if (fullIso) return DateTimeUtils.fromUTCISOToCalendarDate(formattedDate);
652
+ const date = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
653
+ return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date, "UTC"));
601
654
  };
602
- const startDate = DateTime.fromISO(formattedRange.start).toJSDate();
603
- const endDate = DateTime.fromISO(formattedRange.end).toJSDate();
604
- const startZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(startDate);
605
- const endZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(endDate);
606
- return {
607
- start: toCalendarDate(startZonedDateTime),
608
- end: toCalendarDate(endZonedDateTime)
655
+ $[4] = fullIso;
656
+ $[5] = t4;
657
+ } else t4 = $[5];
658
+ const parseCalendarDate = t4;
659
+ let t5;
660
+ if ($[6] !== minValue || $[7] !== parseCalendarDate) {
661
+ t5 = typeof minValue === "string" ? parseCalendarDate(minValue) : minValue;
662
+ $[6] = minValue;
663
+ $[7] = parseCalendarDate;
664
+ $[8] = t5;
665
+ } else t5 = $[8];
666
+ let t6;
667
+ if ($[9] !== maxValue || $[10] !== parseCalendarDate) {
668
+ t6 = typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue;
669
+ $[9] = maxValue;
670
+ $[10] = parseCalendarDate;
671
+ $[11] = t6;
672
+ } else t6 = $[11];
673
+ let t7;
674
+ if ($[12] !== t5 || $[13] !== t6) {
675
+ t7 = {
676
+ minValue: t5,
677
+ maxValue: t6
609
678
  };
610
- };
611
- const parseCalendarDate = (formattedDate) => {
612
- if (formattedDate == null) return formattedDate;
613
- if (fullIso) return DateTimeUtils.fromUTCISOToCalendarDate(formattedDate);
614
- const date = DateTime.fromISO(formattedDate).toJSDate();
615
- return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date));
616
- };
617
- const dateLimits = {
618
- minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
619
- maxValue: typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue
620
- };
679
+ $[12] = t5;
680
+ $[13] = t6;
681
+ $[14] = t7;
682
+ } else t7 = $[14];
683
+ const dateLimits = t7;
621
684
  if (!renderInput) {
622
- const startDateValue = parseCalendarDate(rawValue?.start ?? null);
623
- const endDateValue = parseCalendarDate(rawValue?.end ?? null);
624
- const hasProvidedRangeValue = !!(rawValue?.start || rawValue?.end);
685
+ const startDateValue = parseCalendarDate(normalizedValue?.start ?? null);
686
+ const endDateValue = parseCalendarDate(normalizedValue?.end ?? null);
687
+ const hasProvidedRangeValue = !!(normalizedValue?.start || normalizedValue?.end);
625
688
  const as = props.as ?? ui.input.as;
626
689
  const size = props.size ?? ui.input.size;
627
690
  const isDisabled = isFormControlDisabled || !!props.isDisabled;
628
691
  const todayIcon = props.todayIcon ?? ui.dateInput.todayIcon;
629
692
  const todayIconButtonSize = props.todayIconButtonSize ?? ui.dateInput.todayIconButtonSize;
630
693
  const todayIconPlacement = props.todayIconPlacement ?? ui.dateInput.todayIconPlacement;
631
- const staticTodayIcon = renderDatePickerTodayIcon(todayIcon, todayIconButtonSize);
694
+ const staticTodayIcon = renderDatePickerTodayIcon(todayIcon, {
695
+ isDisabled,
696
+ renderStatic: true,
697
+ size: todayIconButtonSize
698
+ });
632
699
  const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
633
700
  const showDropdown = !props.disableDropdown || disableManualEntry;
634
701
  const staticSegments = getStaticDateRangeSegments({
@@ -637,12 +704,14 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
637
704
  locale,
638
705
  shouldForceLeadingZeros,
639
706
  isDisabled,
640
- hidePlaceholder: as === "floating" && !hasProvidedRangeValue
707
+ hidePlaceholder: as === "floating" && !hasProvidedRangeValue,
708
+ disableManualEntry,
709
+ placeholder: props.placeholder
641
710
  });
642
711
  return /* @__PURE__ */ jsx(InputFrame, {
643
712
  ...props,
644
713
  isDisabled,
645
- className: clsx("relative inline-flex w-full flex-col text-left", props.className),
714
+ className: clsx("group relative inline-flex w-full flex-col text-left", props.className),
646
715
  inputClassName: clsx("min-w-input-width-min-width", props.inputClassName),
647
716
  contentClassName: "pr-0!",
648
717
  contentWrapperClassName: datePickerInputContentRowCva({ size }),
@@ -661,36 +730,154 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
661
730
  onStaticInteract: renderRealInput,
662
731
  actionContent: staticTodayIcon,
663
732
  actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
733
+ showClear: hasProvidedRangeValue,
734
+ wrapContentAndTrailing: true,
735
+ contentAndTrailingClassName: "gap-2!",
664
736
  trailingClassName: "py-0! pl-0!",
665
- trailingContent: showDropdown ? ui.dateInput.calendarIcon : void 0,
737
+ action: showDropdown ? {
738
+ icon: ui.dateInput.calendarIcon,
739
+ onClick: _temp2,
740
+ altText: ""
741
+ } : void 0,
666
742
  children: staticSegments
667
743
  });
668
744
  }
669
- if ("formControl" in props && props.formControl) {
670
- const { formControl, ref, ...innerProps } = props;
671
- return /* @__PURE__ */ jsx(Controller, {
672
- control: formControl.control,
673
- name: formControl.name,
674
- render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DateRangePickerBase, {
675
- ...innerProps,
676
- ...dateLimits,
677
- ref: mergeRefs(ref, field.ref, inputRef),
678
- value: parseDateRange(field.value),
679
- onChange: (value) => field.onChange(formatDateRange(value)),
680
- onBlur: field.onBlur,
681
- isDirty,
682
- isDisabled: field.disabled || props.isDisabled,
683
- error: props.error ?? error?.message
684
- })
745
+ const T0 = DateRangePickerBase;
746
+ const t8 = mergeRefs(props.ref, inputRef);
747
+ const t9 = parseDateRange(normalizedValue);
748
+ let t10;
749
+ if ($[15] !== formatDateRange || $[16] !== props) {
750
+ t10 = (value) => props.onChange?.(formatDateRange(value));
751
+ $[15] = formatDateRange;
752
+ $[16] = props;
753
+ $[17] = t10;
754
+ } else t10 = $[17];
755
+ let t11;
756
+ if ($[18] !== T0 || $[19] !== dateLimits || $[20] !== props || $[21] !== t10 || $[22] !== t8 || $[23] !== t9) {
757
+ t11 = /* @__PURE__ */ jsx(T0, {
758
+ ...props,
759
+ ...dateLimits,
760
+ ref: t8,
761
+ value: t9,
762
+ onChange: t10
685
763
  });
764
+ $[18] = T0;
765
+ $[19] = dateLimits;
766
+ $[20] = props;
767
+ $[21] = t10;
768
+ $[22] = t8;
769
+ $[23] = t9;
770
+ $[24] = t11;
771
+ } else t11 = $[24];
772
+ return t11;
773
+ };
774
+ var DateRangePicker = (t0) => {
775
+ const $ = c(30);
776
+ let maxValue;
777
+ let minValue;
778
+ let props;
779
+ let renderStaticInput;
780
+ let t1;
781
+ if ($[0] !== t0) {
782
+ ({fullIso: t1, minValue, maxValue, renderStaticInput, ...props} = t0);
783
+ $[0] = t0;
784
+ $[1] = maxValue;
785
+ $[2] = minValue;
786
+ $[3] = props;
787
+ $[4] = renderStaticInput;
788
+ $[5] = t1;
789
+ } else {
790
+ maxValue = $[1];
791
+ minValue = $[2];
792
+ props = $[3];
793
+ renderStaticInput = $[4];
794
+ t1 = $[5];
686
795
  }
687
- return /* @__PURE__ */ jsx(DateRangePickerBase, {
688
- ...props,
689
- ...dateLimits,
690
- ref: mergeRefs(props.ref, inputRef),
691
- value: parseDateRange(props.value),
692
- onChange: (value) => props.onChange?.(formatDateRange(value))
693
- });
796
+ const fullIso = t1 === void 0 ? true : t1;
797
+ if ("formControl" in props && props.formControl) {
798
+ let formControl;
799
+ let innerProps;
800
+ let ref;
801
+ if ($[6] !== props) {
802
+ ({formControl, ref, ...innerProps} = props);
803
+ $[6] = props;
804
+ $[7] = formControl;
805
+ $[8] = innerProps;
806
+ $[9] = ref;
807
+ } else {
808
+ formControl = $[7];
809
+ innerProps = $[8];
810
+ ref = $[9];
811
+ }
812
+ const controlWithOptions = formControl.control;
813
+ let t2;
814
+ if ($[10] !== controlWithOptions._options?.disabled || $[11] !== fullIso || $[12] !== innerProps || $[13] !== maxValue || $[14] !== minValue || $[15] !== props.error || $[16] !== props.isDisabled || $[17] !== ref || $[18] !== renderStaticInput) {
815
+ t2 = (t3) => {
816
+ const { field, fieldState: t4 } = t3;
817
+ const { error, isDirty } = t4;
818
+ return /* @__PURE__ */ jsx(DateRangePickerInner, {
819
+ ...innerProps,
820
+ ref: mergeRefs(ref, field.ref),
821
+ value: field.value ?? null,
822
+ onChange: field.onChange,
823
+ onBlur: field.onBlur,
824
+ isDirty,
825
+ isDisabled: field.disabled || props.isDisabled,
826
+ isFormControlDisabled: !!controlWithOptions._options?.disabled,
827
+ error: props.error ?? error?.message,
828
+ fullIso,
829
+ minValue,
830
+ maxValue,
831
+ renderStaticInput
832
+ });
833
+ };
834
+ $[10] = controlWithOptions._options?.disabled;
835
+ $[11] = fullIso;
836
+ $[12] = innerProps;
837
+ $[13] = maxValue;
838
+ $[14] = minValue;
839
+ $[15] = props.error;
840
+ $[16] = props.isDisabled;
841
+ $[17] = ref;
842
+ $[18] = renderStaticInput;
843
+ $[19] = t2;
844
+ } else t2 = $[19];
845
+ let t3;
846
+ if ($[20] !== formControl.control || $[21] !== formControl.name || $[22] !== t2) {
847
+ t3 = /* @__PURE__ */ jsx(Controller, {
848
+ control: formControl.control,
849
+ name: formControl.name,
850
+ render: t2
851
+ });
852
+ $[20] = formControl.control;
853
+ $[21] = formControl.name;
854
+ $[22] = t2;
855
+ $[23] = t3;
856
+ } else t3 = $[23];
857
+ return t3;
858
+ }
859
+ let t2;
860
+ if ($[24] !== fullIso || $[25] !== maxValue || $[26] !== minValue || $[27] !== props || $[28] !== renderStaticInput) {
861
+ t2 = /* @__PURE__ */ jsx(DateRangePickerInner, {
862
+ ...props,
863
+ fullIso,
864
+ minValue,
865
+ maxValue,
866
+ renderStaticInput
867
+ });
868
+ $[24] = fullIso;
869
+ $[25] = maxValue;
870
+ $[26] = minValue;
871
+ $[27] = props;
872
+ $[28] = renderStaticInput;
873
+ $[29] = t2;
874
+ } else t2 = $[29];
875
+ return t2;
694
876
  };
877
+ function _temp(input) {
878
+ const container = input.getContainer?.() ?? input;
879
+ return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
880
+ }
881
+ function _temp2() {}
695
882
  //#endregion
696
883
  export { DateRangePicker };