@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
@@ -12,19 +12,22 @@ import { FormField } from "../../FormField/FormField.js";
12
12
  import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
13
13
  import { InputFrame } from "../../Skeleton/InputFrame.js";
14
14
  import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
15
+ import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
16
+ import { c } from "react/compiler-runtime";
15
17
  import { jsx, jsxs } from "react/jsx-runtime";
16
18
  import { clsx } from "clsx";
17
19
  import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
18
20
  import { useDatePicker, useLocale } from "react-aria";
19
21
  import { mergeRefs } from "@react-aria/utils";
20
- import { Controller, useWatch } from "react-hook-form";
21
- import { createCalendar, getLocalTimeZone, toCalendarDate, today } from "@internationalized/date";
22
+ import { Controller } from "react-hook-form";
23
+ import { createCalendar, toCalendarDate, today } from "@internationalized/date";
22
24
  import { DateTime } from "luxon";
23
25
  import { useCalendarState, useDatePickerState } from "react-stately";
24
26
  //#region src/components/inputs/DateTime/DatePicker/DatePicker.tsx
27
+ var DATE_PICKER_TIME_ZONE = "UTC";
25
28
  var DatePickerBase = (props) => {
26
29
  const ui = UIConfig.useConfig();
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, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, shouldUpdateDateOnMonthYearChange: shouldUpdateDateOnMonthYearChangeProp, granularity: granularityProp, autoFixYear: autoFixYearProp, format, ...rest } = props;
30
+ 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, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, shouldUpdateDateOnMonthYearChange: shouldUpdateDateOnMonthYearChangeProp, granularity: granularityProp, autoFixYear: autoFixYearProp, fireBlurOnChange: fireBlurOnChangeProp, format, ...rest } = props;
28
31
  const as = asProp ?? ui.input.as;
29
32
  const hideLabel = hideLabelProp ?? ui.input.hideLabel;
30
33
  const variant = variantProp ?? ui.input.variant;
@@ -38,6 +41,7 @@ var DatePickerBase = (props) => {
38
41
  const shouldUpdateDateOnMonthYearChange = shouldUpdateDateOnMonthYearChangeProp ?? ui.dateInput.shouldUpdateDateOnMonthYearChange;
39
42
  const granularity = granularityProp ?? ui.dateInput.granularity;
40
43
  const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
44
+ const fireBlurOnChange = fireBlurOnChangeProp ?? ui.dateInput.fireBlurOnChange;
41
45
  const normalizeByGranularity = useCallback((date) => {
42
46
  if (granularity === "year") return date.set({
43
47
  month: 1,
@@ -63,36 +67,42 @@ var DatePickerBase = (props) => {
63
67
  const datePickerRef = useMemo(() => ({ get current() {
64
68
  return datePickerInputRef.current?.getContainer?.() || null;
65
69
  } }), []);
66
- useImperativeHandle(ref, () => ({ clear: () => {
67
- datePickerInputRef.current?.clear();
68
- } }));
70
+ useImperativeHandle(ref, () => ({
71
+ clear: () => {
72
+ datePickerInputRef.current?.clear();
73
+ },
74
+ getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
75
+ }));
69
76
  const handleBlur = (val) => {
70
77
  onBlur?.({ target: { value: val } });
71
78
  };
79
+ const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
80
+ const normalizedValue = value ?? null;
72
81
  const dialogState = useDatePickerState({
73
82
  ...rest,
74
- defaultValue: value || rest.defaultValue,
83
+ defaultValue: normalizedValue ?? rest.defaultValue ?? null,
75
84
  shouldCloseOnSelect: false,
76
85
  shouldForceLeadingZeros
77
86
  });
78
87
  const state = useDatePickerState({
79
88
  ...rest,
80
89
  shouldForceLeadingZeros,
81
- value,
82
- onChange: (val) => {
83
- let normalizedValue = val;
84
- if (val) normalizedValue = normalizeByGranularity(val);
85
- if (normalizedValue && (rest.minValue && normalizedValue < rest?.minValue || rest?.maxValue && normalizedValue > rest?.maxValue)) {
90
+ value: normalizedValue,
91
+ onChange: (val_0) => {
92
+ let normalizedValue_0 = val_0;
93
+ if (val_0) normalizedValue_0 = normalizeByGranularity(val_0);
94
+ if (normalizedValue_0 && (rest.minValue && normalizedValue_0 < rest?.minValue || rest?.maxValue && normalizedValue_0 > rest?.maxValue)) {
86
95
  state.setValue(state.value);
87
96
  return;
88
97
  }
89
- onChange?.(normalizedValue);
90
- dialogState.setValue(normalizedValue);
91
- if (normalizedValue) {
92
- calendarState.setFocusedDate(normalizedValue);
98
+ onChange?.(normalizedValue_0);
99
+ dialogState.setValue(normalizedValue_0);
100
+ if (fireBlurOnChange) debouncedBlur(normalizedValue_0);
101
+ if (normalizedValue_0) {
102
+ calendarState.setFocusedDate(normalizedValue_0);
93
103
  return;
94
104
  }
95
- calendarState.setFocusedDate(today(getLocalTimeZone()));
105
+ calendarState.setFocusedDate(today(DATE_PICKER_TIME_ZONE));
96
106
  },
97
107
  shouldCloseOnSelect: false
98
108
  });
@@ -127,11 +137,11 @@ var DatePickerBase = (props) => {
127
137
  const newValue = dialogState.value ? normalizeByGranularity(dialogState.value) : dialogState.value;
128
138
  state.setValue(newValue);
129
139
  state.toggle();
130
- handleBlur(newValue);
140
+ if (fireBlurOnChange) handleBlur(newValue);
131
141
  };
132
142
  const onMonthYearChange = (selectedDate) => {
133
143
  if (!(shouldUpdateDateOnMonthYearChange || granularity !== "day")) return;
134
- const updatedDate = normalizeByGranularity((dialogState.value || state.value || today(getLocalTimeZone())).set({
144
+ const updatedDate = normalizeByGranularity((dialogState.value || state.value || today(DATE_PICKER_TIME_ZONE)).set({
135
145
  year: selectedDate.year,
136
146
  month: selectedDate.month
137
147
  }));
@@ -142,15 +152,18 @@ var DatePickerBase = (props) => {
142
152
  onApply();
143
153
  };
144
154
  const onTodayPress = () => {
145
- const todayValue = normalizeByGranularity(today(getLocalTimeZone()));
155
+ const todayValue = normalizeByGranularity(today(DATE_PICKER_TIME_ZONE));
146
156
  dialogState.setValue(todayValue);
147
157
  calendarState.setFocusedDate(todayValue);
148
158
  };
159
+ const onInputClear = () => {
160
+ onChange?.(null);
161
+ };
149
162
  useEffect(() => {
150
163
  if (!state.isOpen) return;
151
164
  if (granularity !== "year") return;
152
165
  if (dialogState.value) return;
153
- const defaultYearValue = normalizeByGranularity(today(getLocalTimeZone()));
166
+ const defaultYearValue = normalizeByGranularity(today(DATE_PICKER_TIME_ZONE));
154
167
  dialogState.setValue(defaultYearValue);
155
168
  calendarState.setFocusedDate(defaultYearValue);
156
169
  }, [
@@ -164,7 +177,7 @@ var DatePickerBase = (props) => {
164
177
  const onOpenChange = (isOpen) => {
165
178
  state.toggle();
166
179
  if (state.value) calendarState.setFocusedDate(normalizeByGranularity(state.value));
167
- if (!state.value) calendarState.setFocusedDate(today(getLocalTimeZone()));
180
+ if (!state.value) calendarState.setFocusedDate(today(DATE_PICKER_TIME_ZONE));
168
181
  if (!isOpen) dialogState.setValue(state.value);
169
182
  };
170
183
  return /* @__PURE__ */ jsx(TooltipWrapper, {
@@ -175,13 +188,22 @@ var DatePickerBase = (props) => {
175
188
  ...formFieldProps,
176
189
  as,
177
190
  labelProps,
178
- className: clsx("relative inline-flex w-full flex-col text-left", className),
191
+ className: clsx("group relative inline-flex w-full flex-col text-left", className),
179
192
  tabIndex: as === "inline" ? -1 : void 0,
180
193
  children: [/* @__PURE__ */ jsx(DatePickerInput, {
181
194
  ref: mergeRefs(ref, datePickerInputRef),
182
195
  as,
183
196
  groupProps,
184
- fieldProps,
197
+ fieldProps: {
198
+ ...fieldProps,
199
+ onBlur: (event) => {
200
+ fieldProps.onBlur?.(event);
201
+ handleBlur(state.value);
202
+ }
203
+ },
204
+ fieldValue: normalizedValue,
205
+ isValueControlled: true,
206
+ hasValue: normalizedValue != null,
185
207
  buttonProps,
186
208
  isDirty,
187
209
  isDisabled,
@@ -200,7 +222,10 @@ var DatePickerBase = (props) => {
200
222
  placeholder,
201
223
  className: inputClassName,
202
224
  dateGranularity: granularity,
203
- format
225
+ format,
226
+ timeZone: DATE_PICKER_TIME_ZONE,
227
+ fireBlurOnChange,
228
+ onClear: onInputClear
204
229
  }), (!disableDropdown || disableManualEntry) && state.isOpen && /* @__PURE__ */ jsx(DateTimeDialog, {
205
230
  footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
206
231
  isDisabled,
@@ -226,7 +251,11 @@ var DatePickerBase = (props) => {
226
251
  })
227
252
  });
228
253
  };
229
- var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, renderStaticInput, ...props }) => {
254
+ var DatePickerInner = (t0) => {
255
+ const $ = c(28);
256
+ const { fullIso: t1, granularity: t2, minValue, maxValue, renderStaticInput, isFormControlDisabled, ...props } = t0;
257
+ const fullIso = t1 === void 0 ? true : t1;
258
+ const granularity = t2 === void 0 ? "day" : t2;
230
259
  const ui = UIConfig.useConfig();
231
260
  const datePickerInputContentRowCva = UIStyle.useCva("datePickerInput.contentRowCva", datePickerInputContentRow);
232
261
  const { locale } = useLocale();
@@ -237,51 +266,88 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
237
266
  inputRef,
238
267
  renderInput,
239
268
  setRenderInput,
240
- getFocusTarget: (input) => {
241
- return (input.getContainer?.() ?? input).querySelector("input, button, [tabindex]:not([tabindex='-1'])");
242
- }
269
+ getFocusTarget: _temp
243
270
  });
244
- const watchedValue = "formControl" in props && props.formControl ? useWatch({
245
- control: props.formControl.control,
246
- name: props.formControl.name
247
- }) : props.value;
248
- let isFormControlDisabled = false;
249
- if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
250
- const rawValue = watchedValue ?? props.value ?? null;
251
- const normalizeByGranularity = (date) => {
252
- if (granularity === "year") return date.set({
253
- month: 1,
254
- day: 1
255
- });
256
- if (granularity === "month") return date.set({ day: 1 });
257
- return date;
258
- };
259
- const formatCalendarDate = (calendarDate) => {
260
- if (calendarDate === null) return null;
261
- const normalizedDate = normalizeByGranularity(calendarDate);
262
- if (fullIso) return DateTimeUtils.fromCalendarDateToUTCISO(normalizedDate);
263
- const date = DateTimeUtils.fromDateValueToLocal(normalizedDate);
264
- return DateTime.fromJSDate(date).toISODate();
265
- };
266
- const parseCalendarDate = (formattedDate) => {
267
- if (formattedDate == null) return formattedDate;
268
- if (fullIso) return normalizeByGranularity(DateTimeUtils.fromUTCISOToCalendarDate(formattedDate));
269
- const date = DateTime.fromISO(formattedDate).toJSDate();
270
- return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date)));
271
- };
272
- const dateLimits = {
273
- minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
274
- maxValue: typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue
275
- };
271
+ const normalizedValue = props.value ?? null;
272
+ let t3;
273
+ if ($[0] !== granularity) {
274
+ t3 = (date) => {
275
+ if (granularity === "year") return date.set({
276
+ month: 1,
277
+ day: 1
278
+ });
279
+ if (granularity === "month") return date.set({ day: 1 });
280
+ return date;
281
+ };
282
+ $[0] = granularity;
283
+ $[1] = t3;
284
+ } else t3 = $[1];
285
+ const normalizeByGranularity = t3;
286
+ let t4;
287
+ if ($[2] !== fullIso || $[3] !== normalizeByGranularity) {
288
+ t4 = (calendarDate) => {
289
+ if (calendarDate === null) return null;
290
+ const normalizedDate = normalizeByGranularity(calendarDate);
291
+ if (fullIso) return DateTimeUtils.fromCalendarDateToUTCISO(normalizedDate);
292
+ const date_0 = DateTimeUtils.fromDateValueToLocal(normalizedDate, "UTC");
293
+ return DateTime.fromJSDate(date_0, { zone: "UTC" }).toISODate();
294
+ };
295
+ $[2] = fullIso;
296
+ $[3] = normalizeByGranularity;
297
+ $[4] = t4;
298
+ } else t4 = $[4];
299
+ const formatCalendarDate = t4;
300
+ let t5;
301
+ if ($[5] !== fullIso || $[6] !== normalizeByGranularity) {
302
+ t5 = (formattedDate) => {
303
+ if (formattedDate == null) return null;
304
+ if (fullIso) return normalizeByGranularity(DateTimeUtils.fromUTCISOToCalendarDate(formattedDate));
305
+ const date_1 = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
306
+ return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date_1, "UTC")));
307
+ };
308
+ $[5] = fullIso;
309
+ $[6] = normalizeByGranularity;
310
+ $[7] = t5;
311
+ } else t5 = $[7];
312
+ const parseCalendarDate = t5;
313
+ let t6;
314
+ if ($[8] !== minValue || $[9] !== parseCalendarDate) {
315
+ t6 = typeof minValue === "string" ? parseCalendarDate(minValue) : minValue;
316
+ $[8] = minValue;
317
+ $[9] = parseCalendarDate;
318
+ $[10] = t6;
319
+ } else t6 = $[10];
320
+ let t7;
321
+ if ($[11] !== maxValue || $[12] !== parseCalendarDate) {
322
+ t7 = typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue;
323
+ $[11] = maxValue;
324
+ $[12] = parseCalendarDate;
325
+ $[13] = t7;
326
+ } else t7 = $[13];
327
+ let t8;
328
+ if ($[14] !== t6 || $[15] !== t7) {
329
+ t8 = {
330
+ minValue: t6,
331
+ maxValue: t7
332
+ };
333
+ $[14] = t6;
334
+ $[15] = t7;
335
+ $[16] = t8;
336
+ } else t8 = $[16];
337
+ const dateLimits = t8;
276
338
  if (!renderInput) {
277
- const dateValue = rawValue ? parseCalendarDate(rawValue) : null;
339
+ const dateValue = normalizedValue ? parseCalendarDate(normalizedValue) : null;
278
340
  const as = props.as ?? ui.input.as;
279
341
  const size = props.size ?? ui.input.size;
280
342
  const isDisabled = isFormControlDisabled || !!props.isDisabled;
281
343
  const todayIcon = props.todayIcon ?? ui.dateInput.todayIcon;
282
344
  const todayIconButtonSize = props.todayIconButtonSize ?? ui.dateInput.todayIconButtonSize;
283
345
  const todayIconPlacement = props.todayIconPlacement ?? ui.dateInput.todayIconPlacement;
284
- const staticTodayIcon = renderDatePickerTodayIcon(todayIcon, todayIconButtonSize);
346
+ const staticTodayIcon = renderDatePickerTodayIcon(todayIcon, {
347
+ isDisabled,
348
+ renderStatic: true,
349
+ size: todayIconButtonSize
350
+ });
285
351
  const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
286
352
  const showDropdown = !props.disableDropdown || disableManualEntry;
287
353
  const staticSegments = getStaticCalendarDateSegments({
@@ -289,61 +355,191 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
289
355
  locale,
290
356
  shouldForceLeadingZeros,
291
357
  isDisabled,
292
- hidePlaceholder: as === "floating" && !dateValue
358
+ hidePlaceholder: as === "floating" && !dateValue,
359
+ disableManualEntry,
360
+ placeholder: props.placeholder,
361
+ dateGranularity: granularity
293
362
  });
294
363
  return /* @__PURE__ */ jsx(InputFrame, {
295
364
  ...props,
296
365
  isDisabled,
297
- className: clsx("relative inline-flex w-full flex-col text-left", props.className),
366
+ className: clsx("group relative inline-flex w-full flex-col text-left", props.className),
298
367
  inputClassName: clsx("min-w-input-width-min-width", props.inputClassName),
299
368
  contentClassName: "pr-0!",
300
369
  contentWrapperClassName: datePickerInputContentRowCva({ size }),
301
370
  labelPlacement: "content-row",
302
371
  dataAttributes: {
303
- dataIsEmpty: dateValue === null,
304
- dataIsFilled: dateValue !== null,
372
+ dataIsEmpty: dateValue == null,
373
+ dataIsFilled: dateValue != null,
305
374
  dataIsDirty: props.isDirty,
306
375
  dataIsRequired: props.isRequired,
307
376
  dataIsDisabled: isDisabled,
308
377
  dataDisabled: isDisabled,
309
378
  dataInvalid: !!props.error,
310
- dataHasSelection: dateValue !== null
379
+ dataHasSelection: dateValue != null
311
380
  },
312
381
  renderStatic: true,
313
382
  onStaticInteract: renderRealInput,
314
383
  actionContent: staticTodayIcon,
315
384
  actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
385
+ showClear: dateValue != null,
386
+ wrapContentAndTrailing: true,
387
+ contentAndTrailingClassName: "gap-2!",
316
388
  trailingClassName: "py-0! pl-0!",
317
- trailingContent: showDropdown ? ui.dateInput.calendarIcon : void 0,
389
+ action: showDropdown ? {
390
+ icon: ui.dateInput.calendarIcon,
391
+ onClick: _temp2,
392
+ altText: ""
393
+ } : void 0,
318
394
  children: staticSegments
319
395
  });
320
396
  }
321
- if ("formControl" in props && props.formControl) {
322
- const { formControl, ref, ...innerProps } = props;
323
- return /* @__PURE__ */ jsx(Controller, {
324
- control: formControl.control,
325
- name: formControl.name,
326
- render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DatePickerBase, {
327
- ...innerProps,
328
- ...dateLimits,
329
- ref: mergeRefs(ref, field.ref, inputRef),
330
- value: parseCalendarDate(field.value),
331
- onChange: (value) => field.onChange(formatCalendarDate(value)),
332
- onBlur: field.onBlur,
333
- isDirty,
334
- isDisabled: field.disabled || props.isDisabled,
335
- error: props.error ?? error?.message
336
- })
397
+ const T0 = DatePickerBase;
398
+ const t9 = mergeRefs(props.ref, inputRef);
399
+ const t10 = parseCalendarDate(normalizedValue);
400
+ let t11;
401
+ if ($[17] !== formatCalendarDate || $[18] !== props) {
402
+ t11 = (value) => props.onChange?.(formatCalendarDate(value));
403
+ $[17] = formatCalendarDate;
404
+ $[18] = props;
405
+ $[19] = t11;
406
+ } else t11 = $[19];
407
+ let t12;
408
+ if ($[20] !== T0 || $[21] !== dateLimits || $[22] !== granularity || $[23] !== props || $[24] !== t10 || $[25] !== t11 || $[26] !== t9) {
409
+ t12 = /* @__PURE__ */ jsx(T0, {
410
+ ...props,
411
+ ...dateLimits,
412
+ ref: t9,
413
+ granularity,
414
+ value: t10,
415
+ onChange: t11
337
416
  });
417
+ $[20] = T0;
418
+ $[21] = dateLimits;
419
+ $[22] = granularity;
420
+ $[23] = props;
421
+ $[24] = t10;
422
+ $[25] = t11;
423
+ $[26] = t9;
424
+ $[27] = t12;
425
+ } else t12 = $[27];
426
+ return t12;
427
+ };
428
+ var DatePicker = (t0) => {
429
+ const $ = c(33);
430
+ let maxValue;
431
+ let minValue;
432
+ let props;
433
+ let renderStaticInput;
434
+ let t1;
435
+ let t2;
436
+ if ($[0] !== t0) {
437
+ ({fullIso: t1, granularity: t2, minValue, maxValue, renderStaticInput, ...props} = t0);
438
+ $[0] = t0;
439
+ $[1] = maxValue;
440
+ $[2] = minValue;
441
+ $[3] = props;
442
+ $[4] = renderStaticInput;
443
+ $[5] = t1;
444
+ $[6] = t2;
445
+ } else {
446
+ maxValue = $[1];
447
+ minValue = $[2];
448
+ props = $[3];
449
+ renderStaticInput = $[4];
450
+ t1 = $[5];
451
+ t2 = $[6];
338
452
  }
339
- return /* @__PURE__ */ jsx(DatePickerBase, {
340
- ...props,
341
- ...dateLimits,
342
- ref: mergeRefs(props.ref, inputRef),
343
- granularity,
344
- value: parseCalendarDate(props.value),
345
- onChange: (value) => props.onChange?.(formatCalendarDate(value))
346
- });
453
+ const fullIso = t1 === void 0 ? true : t1;
454
+ const granularity = t2 === void 0 ? "day" : t2;
455
+ if ("formControl" in props && props.formControl) {
456
+ let formControl;
457
+ let innerProps;
458
+ let ref;
459
+ if ($[7] !== props) {
460
+ ({formControl, ref, ...innerProps} = props);
461
+ $[7] = props;
462
+ $[8] = formControl;
463
+ $[9] = innerProps;
464
+ $[10] = ref;
465
+ } else {
466
+ formControl = $[8];
467
+ innerProps = $[9];
468
+ ref = $[10];
469
+ }
470
+ const controlWithOptions = formControl.control;
471
+ let t3;
472
+ 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) {
473
+ t3 = (t4) => {
474
+ const { field, fieldState: t5 } = t4;
475
+ const { error, isDirty } = t5;
476
+ return /* @__PURE__ */ jsx(DatePickerInner, {
477
+ ...innerProps,
478
+ ref: mergeRefs(ref, field.ref),
479
+ value: field.value ?? null,
480
+ onChange: field.onChange,
481
+ onBlur: field.onBlur,
482
+ isDirty,
483
+ isDisabled: field.disabled || props.isDisabled,
484
+ isFormControlDisabled: !!controlWithOptions._options?.disabled,
485
+ error: props.error ?? error?.message,
486
+ fullIso,
487
+ granularity,
488
+ minValue,
489
+ maxValue,
490
+ renderStaticInput
491
+ });
492
+ };
493
+ $[11] = controlWithOptions._options?.disabled;
494
+ $[12] = fullIso;
495
+ $[13] = granularity;
496
+ $[14] = innerProps;
497
+ $[15] = maxValue;
498
+ $[16] = minValue;
499
+ $[17] = props.error;
500
+ $[18] = props.isDisabled;
501
+ $[19] = ref;
502
+ $[20] = renderStaticInput;
503
+ $[21] = t3;
504
+ } else t3 = $[21];
505
+ let t4;
506
+ if ($[22] !== formControl.control || $[23] !== formControl.name || $[24] !== t3) {
507
+ t4 = /* @__PURE__ */ jsx(Controller, {
508
+ control: formControl.control,
509
+ name: formControl.name,
510
+ render: t3
511
+ });
512
+ $[22] = formControl.control;
513
+ $[23] = formControl.name;
514
+ $[24] = t3;
515
+ $[25] = t4;
516
+ } else t4 = $[25];
517
+ return t4;
518
+ }
519
+ let t3;
520
+ if ($[26] !== fullIso || $[27] !== granularity || $[28] !== maxValue || $[29] !== minValue || $[30] !== props || $[31] !== renderStaticInput) {
521
+ t3 = /* @__PURE__ */ jsx(DatePickerInner, {
522
+ ...props,
523
+ fullIso,
524
+ granularity,
525
+ minValue,
526
+ maxValue,
527
+ renderStaticInput
528
+ });
529
+ $[26] = fullIso;
530
+ $[27] = granularity;
531
+ $[28] = maxValue;
532
+ $[29] = minValue;
533
+ $[30] = props;
534
+ $[31] = renderStaticInput;
535
+ $[32] = t3;
536
+ } else t3 = $[32];
537
+ return t3;
347
538
  };
539
+ function _temp(input) {
540
+ const container = input.getContainer?.() ?? input;
541
+ return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
542
+ }
543
+ function _temp2() {}
348
544
  //#endregion
349
545
  export { DatePicker };
@@ -23,6 +23,7 @@ interface DateRangePickerBaseProps extends FormFieldProps, InputVariantProps, Om
23
23
  placeholder?: string;
24
24
  inputClassName?: string;
25
25
  onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
26
+ fireBlurOnChange?: boolean;
26
27
  }
27
28
  export interface DateRangePickerProps extends Omit<DateRangePickerBaseProps, "value" | "onChange" | "minValue" | "maxValue"> {
28
29
  value?: {