@povio/ui 2.3.0-rc.3 → 2.3.0-rc.31

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 (218) 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 +188 -34
  62. package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +24 -10
  63. package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +1 -0
  64. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +267 -87
  65. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -0
  66. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +347 -182
  67. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +1 -0
  68. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +177 -69
  69. package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +1 -0
  70. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +530 -157
  71. package/dist/components/inputs/DateTime/shared/Calendar.js +333 -137
  72. package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +2 -1
  73. package/dist/components/inputs/DateTime/shared/CalendarCell.js +301 -102
  74. package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +2 -1
  75. package/dist/components/inputs/DateTime/shared/CalendarGrid.js +146 -33
  76. package/dist/components/inputs/DateTime/shared/CalendarHeader.js +245 -90
  77. package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
  78. package/dist/components/inputs/DateTime/shared/DateField.js +295 -112
  79. package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +6 -1
  80. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +375 -146
  81. package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +94 -21
  82. package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +81 -27
  83. package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +59 -10
  84. package/dist/components/inputs/DateTime/shared/MonthPicker.js +103 -58
  85. package/dist/components/inputs/DateTime/shared/RangeCalendar.js +193 -82
  86. package/dist/components/inputs/DateTime/shared/TimeField.js +27 -8
  87. package/dist/components/inputs/DateTime/shared/TimePickerForm.js +279 -110
  88. package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +3 -1
  89. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +208 -70
  90. package/dist/components/inputs/DateTime/shared/YearPicker.js +119 -68
  91. package/dist/components/inputs/File/FileUpload.js +86 -44
  92. package/dist/components/inputs/File/FileUploadContainer.js +15 -7
  93. package/dist/components/inputs/File/InputUpload.js +317 -79
  94. package/dist/components/inputs/File/shared/FileCard.js +104 -41
  95. package/dist/components/inputs/File/shared/FileCardList.js +47 -12
  96. package/dist/components/inputs/File/shared/FileUploadContent.js +175 -44
  97. package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +149 -46
  98. package/dist/components/inputs/File/shared/FileUploadContentError.js +234 -93
  99. package/dist/components/inputs/File/shared/FileUploadContentFilled.js +230 -97
  100. package/dist/components/inputs/File/shared/FileUploadContentLoading.js +199 -55
  101. package/dist/components/inputs/File/shared/InputUploadContent.js +148 -35
  102. package/dist/components/inputs/File/shared/InputUploadFilled.js +49 -8
  103. package/dist/components/inputs/File/shared/ProgressBar.js +48 -9
  104. package/dist/components/inputs/FormField/FormField.js +119 -37
  105. package/dist/components/inputs/FormField/FormFieldError.js +25 -5
  106. package/dist/components/inputs/FormField/FormFieldHeader.js +79 -22
  107. package/dist/components/inputs/FormField/FormFieldHeaderClose.js +31 -7
  108. package/dist/components/inputs/FormField/FormFieldHelper.js +26 -6
  109. package/dist/components/inputs/FormField/FormFieldLabel.js +40 -9
  110. package/dist/components/inputs/Input/NumberInput/NumberInput.js +392 -123
  111. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +541 -116
  112. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +463 -146
  113. package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +48 -9
  114. package/dist/components/inputs/Input/TextArea/TextArea.js +298 -89
  115. package/dist/components/inputs/Input/TextInput/TextInput.js +370 -121
  116. package/dist/components/inputs/Input/shared/InputContent.js +190 -58
  117. package/dist/components/inputs/Inputs/Form.js +40 -11
  118. package/dist/components/inputs/Inputs/InputItem.d.ts +0 -1
  119. package/dist/components/inputs/Inputs/InputItem.js +65 -16
  120. package/dist/components/inputs/Inputs/Inputs.js +37 -11
  121. package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -0
  122. package/dist/components/inputs/RadioGroup/RadioGroup.js +333 -107
  123. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +145 -50
  124. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +3 -2
  125. package/dist/components/inputs/Selection/Select/QuerySelect.js +107 -27
  126. package/dist/components/inputs/Selection/Select/Select.js +139 -44
  127. package/dist/components/inputs/Selection/shared/SelectBase.js +69 -20
  128. package/dist/components/inputs/Selection/shared/SelectDesktop.js +390 -143
  129. package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
  130. package/dist/components/inputs/Selection/shared/SelectInput.js +326 -136
  131. package/dist/components/inputs/Selection/shared/SelectInputTags.js +99 -25
  132. package/dist/components/inputs/Selection/shared/SelectListBox.js +163 -51
  133. package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +85 -35
  134. package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +69 -16
  135. package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +70 -21
  136. package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +58 -9
  137. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +9 -0
  138. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +47 -0
  139. package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -2
  140. package/dist/components/inputs/Selection/shared/select.context.js +44 -38
  141. package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +5 -0
  142. package/dist/components/inputs/Selection/shared/selectInput.cva.js +5 -0
  143. package/dist/components/inputs/Selection/shared/useSelectItems.js +109 -49
  144. package/dist/components/inputs/Skeleton/InputFrame.d.ts +2 -0
  145. package/dist/components/inputs/Skeleton/InputFrame.js +444 -124
  146. package/dist/components/inputs/Slider/Slider.js +247 -74
  147. package/dist/components/inputs/TextEditor/TextEditor.js +447 -103
  148. package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +37 -11
  149. package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +102 -30
  150. package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +194 -45
  151. package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +88 -28
  152. package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +48 -14
  153. package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +66 -19
  154. package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +49 -15
  155. package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +92 -32
  156. package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +126 -54
  157. package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +141 -38
  158. package/dist/components/inputs/Toggle/Toggle.d.ts +1 -0
  159. package/dist/components/inputs/Toggle/Toggle.js +206 -41
  160. package/dist/components/inputs/shared/CheckContent.js +21 -10
  161. package/dist/components/inputs/shared/InputClear.js +78 -21
  162. package/dist/components/inputs/shared/TooltipWrapper.js +47 -12
  163. package/dist/components/inputs/shared/input.cva.js +13 -3
  164. package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +1 -0
  165. package/dist/components/inputs/shared/useStaticInputHandoff.js +87 -34
  166. package/dist/components/navigation/Accordion/Accordion.js +69 -22
  167. package/dist/components/navigation/Accordion/AccordionItem.js +86 -41
  168. package/dist/components/navigation/Stepper/Stepper.js +67 -22
  169. package/dist/components/navigation/Stepper/StepperItem.js +104 -31
  170. package/dist/components/navigation/Stepper/StepperSeparator.js +23 -5
  171. package/dist/components/overlays/ActionModal/ActionModal.js +169 -35
  172. package/dist/components/overlays/BottomSheet/BottomSheet.js +96 -23
  173. package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +48 -8
  174. package/dist/components/overlays/Drawer/Drawer.js +62 -20
  175. package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +83 -27
  176. package/dist/components/overlays/Tooltip/Tooltip.js +137 -28
  177. package/dist/components/overlays/Tooltip/TooltipEllipsis.js +37 -12
  178. package/dist/components/segment/Segment.js +218 -57
  179. package/dist/components/segment/SegmentItem.js +67 -10
  180. package/dist/components/shared/pagination/Pagination.js +108 -22
  181. package/dist/components/shared/pagination/PaginationList.js +167 -64
  182. package/dist/components/status/Alert/Alert.js +97 -30
  183. package/dist/components/status/Loader/Loader.js +77 -22
  184. package/dist/components/status/Toast/Toast.js +21 -13
  185. package/dist/components/status/Toast/useToast.js +62 -57
  186. package/dist/components/table/ColumnConfig.js +158 -54
  187. package/dist/components/table/InfiniteTable.js +67 -16
  188. package/dist/components/table/PaginatedTable.js +84 -18
  189. package/dist/components/table/Table.js +28 -27
  190. package/dist/components/text/Link/Link.js +19 -7
  191. package/dist/components/text/Typography/Typography.js +23 -8
  192. package/dist/config/confirmation.context.js +1 -1
  193. package/dist/config/link.context.js +23 -9
  194. package/dist/config/router.context.js +42 -16
  195. package/dist/config/theme.context.js +98 -45
  196. package/dist/config/uiConfig.context.d.ts +4 -4
  197. package/dist/config/uiConfig.context.js +50 -11
  198. package/dist/config/uiStyle.context.js +15 -5
  199. package/dist/helpers/dynamicInputs.d.ts +1 -1
  200. package/dist/hooks/useBreakpoint.js +16 -3
  201. package/dist/hooks/useDebounceCallback.js +51 -17
  202. package/dist/hooks/useFilters.js +125 -64
  203. package/dist/hooks/useForm.js +42 -8
  204. package/dist/hooks/useFormAutosave.js +101 -30
  205. package/dist/hooks/useIntersectionObserver.js +86 -32
  206. package/dist/hooks/useLocalStorage.js +43 -10
  207. package/dist/hooks/useLongPressRepeat.js +55 -20
  208. package/dist/hooks/usePagination.js +49 -19
  209. package/dist/hooks/useQueryAutocomplete.js +1 -0
  210. package/dist/hooks/useScrollableListBox.js +37 -16
  211. package/dist/hooks/useSorting.js +69 -28
  212. package/dist/hooks/useStateAndRef.js +21 -7
  213. package/dist/hooks/useTableColumnConfig.js +124 -31
  214. package/dist/hooks/useTranslationMemo.js +25 -5
  215. package/dist/index.js +2 -2
  216. package/dist/utils/date-time.utils.d.ts +2 -0
  217. package/dist/utils/date-time.utils.js +17 -13
  218. package/package.json +1 -1
@@ -1,131 +1,314 @@
1
1
  import { DateSegmentItem } from "./DateSegmentItem.js";
2
2
  import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
3
+ import { c } from "react/compiler-runtime";
3
4
  import { Fragment, jsx } from "react/jsx-runtime";
4
5
  import { clsx } from "clsx";
5
- import { useCallback, useEffect, useImperativeHandle, useMemo, useRef } from "react";
6
+ import { useEffect, useImperativeHandle, useRef } from "react";
6
7
  import { useDateField, useLocale } from "react-aria";
7
8
  import { createCalendar } from "@internationalized/date";
8
9
  import { DateTime } from "luxon";
9
10
  import { useDateFieldState } from "react-stately";
10
11
  //#region src/components/inputs/DateTime/shared/DateField.tsx
11
- var DateField = ({ ref, onClearChange, hidePlaceholder, isDisabled, disableManualEntry, dateGranularity = "day", isTimeOptional = false, format, timeZone, ...props }) => {
12
+ var DateField = (t0) => {
13
+ const $ = c(65);
14
+ let disableManualEntry;
15
+ let format;
16
+ let hidePlaceholder;
17
+ let isDisabled;
18
+ let onClearChange;
19
+ let props;
20
+ let ref;
21
+ let t1;
22
+ let t2;
23
+ let timeZone;
24
+ if ($[0] !== t0) {
25
+ ({ref, onClearChange, hidePlaceholder, isDisabled, disableManualEntry, dateGranularity: t1, isTimeOptional: t2, format, timeZone, ...props} = t0);
26
+ $[0] = t0;
27
+ $[1] = disableManualEntry;
28
+ $[2] = format;
29
+ $[3] = hidePlaceholder;
30
+ $[4] = isDisabled;
31
+ $[5] = onClearChange;
32
+ $[6] = props;
33
+ $[7] = ref;
34
+ $[8] = t1;
35
+ $[9] = t2;
36
+ $[10] = timeZone;
37
+ } else {
38
+ disableManualEntry = $[1];
39
+ format = $[2];
40
+ hidePlaceholder = $[3];
41
+ isDisabled = $[4];
42
+ onClearChange = $[5];
43
+ props = $[6];
44
+ ref = $[7];
45
+ t1 = $[8];
46
+ t2 = $[9];
47
+ timeZone = $[10];
48
+ }
49
+ const dateGranularity = t1 === void 0 ? "day" : t1;
50
+ const isTimeOptional = t2 === void 0 ? false : t2;
12
51
  const { locale } = useLocale();
13
- const state = useDateFieldState({
14
- ...props,
15
- isDisabled,
16
- isReadOnly: disableManualEntry,
17
- locale,
18
- createCalendar
19
- });
52
+ let t3;
53
+ if ($[11] !== disableManualEntry || $[12] !== isDisabled || $[13] !== locale || $[14] !== props) {
54
+ t3 = {
55
+ ...props,
56
+ isDisabled,
57
+ isReadOnly: disableManualEntry,
58
+ locale,
59
+ createCalendar
60
+ };
61
+ $[11] = disableManualEntry;
62
+ $[12] = isDisabled;
63
+ $[13] = locale;
64
+ $[14] = props;
65
+ $[15] = t3;
66
+ } else t3 = $[15];
67
+ const state = useDateFieldState(t3);
20
68
  const dataFieldRef = useRef(null);
21
- const { fieldProps } = useDateField({
22
- ...props,
23
- isDisabled,
24
- isReadOnly: disableManualEntry
25
- }, state, dataFieldRef);
26
- const isSegmentVisible = useCallback((segmentType) => {
27
- if (dateGranularity === "day") return true;
28
- if (dateGranularity === "month") return segmentType !== "day";
29
- if (dateGranularity === "year") return segmentType === "year";
30
- return true;
31
- }, [dateGranularity]);
32
- const getSegmentsToRender = useCallback(() => {
33
- const segments = [];
34
- for (const segment of state.segments) if (segment.type !== "literal") {
35
- if (isSegmentVisible(segment.type)) segments.push(segment);
36
- } else if (segments.length > 0 && segments.at(-1)?.type !== "literal") segments.push(segment);
37
- return segments;
38
- }, [state.segments, isSegmentVisible]);
39
- const segmentsToRender = useMemo(() => getSegmentsToRender(), [getSegmentsToRender]);
40
- const autoFixYear = () => {
41
- const monthSegment = state.segments.find((segment) => segment.type === "month");
42
- const daySegment = state.segments.find((segment) => segment.type === "day");
43
- const yearSegment = state.segments.find((segment) => segment.type === "year");
44
- const hourSegment = state.segments.find((segment) => segment.type === "hour");
45
- const minuteSegment = state.segments.find((segment) => segment.type === "minute");
46
- const isMonthFilled = monthSegment && !monthSegment.isPlaceholder;
47
- const isDayFilled = daySegment && !daySegment.isPlaceholder;
48
- const isYearFilled = yearSegment && !yearSegment.isPlaceholder && yearSegment.text?.length > 0;
49
- const isYearEmpty = yearSegment && !(parseInt(yearSegment.text) && yearSegment.text?.length === 4);
50
- const isDateFilled = isMonthFilled && isDayFilled && isYearFilled;
51
- const isHourEmpty = hourSegment && (hourSegment.isPlaceholder || Number.isNaN(parseInt(hourSegment.text ?? "", 10)));
52
- const isMinuteEmpty = minuteSegment && (minuteSegment.isPlaceholder || Number.isNaN(parseInt(minuteSegment.text ?? "", 10)));
53
- if (!isTimeOptional && isDateFilled && minuteSegment && isMinuteEmpty) {
54
- let minute = minuteSegment?.value || 0;
55
- if (minuteSegment?.text?.length && minuteSegment?.text?.length > 0) {
56
- minute = parseInt(minuteSegment?.text ?? "00");
57
- if (isNaN(minute)) minute = 0;
69
+ let t4;
70
+ if ($[16] !== disableManualEntry || $[17] !== isDisabled || $[18] !== props) {
71
+ t4 = {
72
+ ...props,
73
+ isDisabled,
74
+ isReadOnly: disableManualEntry
75
+ };
76
+ $[16] = disableManualEntry;
77
+ $[17] = isDisabled;
78
+ $[18] = props;
79
+ $[19] = t4;
80
+ } else t4 = $[19];
81
+ const { fieldProps } = useDateField(t4, state, dataFieldRef);
82
+ let t5;
83
+ if ($[20] !== dateGranularity) {
84
+ t5 = (segmentType) => {
85
+ if (dateGranularity === "day") return true;
86
+ if (dateGranularity === "month") return segmentType !== "day";
87
+ if (dateGranularity === "year") return segmentType === "year";
88
+ return true;
89
+ };
90
+ $[20] = dateGranularity;
91
+ $[21] = t5;
92
+ } else t5 = $[21];
93
+ const isSegmentVisible = t5;
94
+ let t6;
95
+ if ($[22] !== isSegmentVisible || $[23] !== state.segments) {
96
+ t6 = () => {
97
+ const segments = [];
98
+ for (const segment of state.segments) if (segment.type !== "literal") {
99
+ if (isSegmentVisible(segment.type)) segments.push(segment);
100
+ } else if (segments.length > 0 && segments.at(-1)?.type !== "literal") segments.push(segment);
101
+ return segments;
102
+ };
103
+ $[22] = isSegmentVisible;
104
+ $[23] = state.segments;
105
+ $[24] = t6;
106
+ } else t6 = $[24];
107
+ const getSegmentsToRender = t6;
108
+ let t7;
109
+ if ($[25] !== getSegmentsToRender) {
110
+ t7 = getSegmentsToRender();
111
+ $[25] = getSegmentsToRender;
112
+ $[26] = t7;
113
+ } else t7 = $[26];
114
+ const segmentsToRender = t7;
115
+ let t8;
116
+ if ($[27] !== isTimeOptional || $[28] !== state) {
117
+ t8 = () => {
118
+ const monthSegment = state.segments.find(_temp);
119
+ const daySegment = state.segments.find(_temp2);
120
+ const yearSegment = state.segments.find(_temp3);
121
+ const hourSegment = state.segments.find(_temp4);
122
+ const minuteSegment = state.segments.find(_temp5);
123
+ const isMonthFilled = monthSegment && !monthSegment.isPlaceholder;
124
+ const isDayFilled = daySegment && !daySegment.isPlaceholder;
125
+ const isYearFilled = yearSegment && !yearSegment.isPlaceholder && yearSegment.text?.length > 0;
126
+ const isYearEmpty = yearSegment && !(parseInt(yearSegment.text) && yearSegment.text?.length === 4);
127
+ const isDateFilled = isMonthFilled && isDayFilled && isYearFilled;
128
+ const isHourEmpty = hourSegment && (hourSegment.isPlaceholder || Number.isNaN(parseInt(hourSegment.text ?? "", 10)));
129
+ const isMinuteEmpty = minuteSegment && (minuteSegment.isPlaceholder || Number.isNaN(parseInt(minuteSegment.text ?? "", 10)));
130
+ if (!isTimeOptional && isDateFilled && minuteSegment && isMinuteEmpty) {
131
+ let minute = minuteSegment?.value || 0;
132
+ if (minuteSegment?.text?.length && minuteSegment?.text?.length > 0) {
133
+ minute = parseInt(minuteSegment?.text ?? "00");
134
+ if (isNaN(minute)) minute = 0;
135
+ }
136
+ state.setSegment("minute", minute);
58
137
  }
59
- state.setSegment("minute", minute);
60
- }
61
- if (!isTimeOptional && isDateFilled && hourSegment && isHourEmpty) {
62
- let hour = hourSegment?.value || 0;
63
- if (hourSegment?.text?.length && hourSegment?.text?.length > 0) {
64
- hour = parseInt(hourSegment?.text ?? "00");
65
- if (isNaN(hour)) hour = 0;
138
+ if (!isTimeOptional && isDateFilled && hourSegment && isHourEmpty) {
139
+ let hour = hourSegment?.value || 0;
140
+ if (hourSegment?.text?.length && hourSegment?.text?.length > 0) {
141
+ hour = parseInt(hourSegment?.text ?? "00");
142
+ if (isNaN(hour)) hour = 0;
143
+ }
144
+ state.setSegment("hour", hour);
66
145
  }
67
- state.setSegment("hour", hour);
68
- }
69
- if (isMonthFilled && isDayFilled && isYearEmpty) {
70
- let year = (/* @__PURE__ */ new Date()).getFullYear();
71
- if (yearSegment?.text?.length && yearSegment?.text?.length === 2) year = parseInt(`20${yearSegment?.text}`);
72
- state.setSegment("year", year);
73
- }
74
- };
75
- const handleBlur = (e) => {
76
- fieldProps.onBlur?.(e);
77
- if (!state.value) return;
78
- const currentValue = state.value;
79
- const { year } = currentValue;
80
- if (year >= 0 && year <= 99) {
81
- const correctedYear = year <= 50 ? 2e3 + year : 1900 + year;
82
- const correctedDate = currentValue.set({ year: correctedYear });
83
- if (correctedDate) {
84
- state.setValue(correctedDate);
85
- props.onChange?.(correctedDate);
146
+ if (isMonthFilled && isDayFilled && isYearEmpty) {
147
+ let year = (/* @__PURE__ */ new Date()).getFullYear();
148
+ if (yearSegment?.text?.length && yearSegment?.text?.length === 2) year = parseInt(`20${yearSegment?.text}`);
149
+ state.setSegment("year", year);
86
150
  }
87
- }
88
- };
89
- useImperativeHandle(ref, () => ({
90
- clearField: () => {
91
- state.setValue(null);
92
- for (const segment of state.segments) if (segment.type !== "literal") state.clearSegment(segment.type);
93
- },
94
- autoFixYear
95
- }));
96
- useEffect(() => {
97
- onClearChange?.(state.segments.some((segment) => segment.type !== "literal" && segment.isPlaceholder === false));
98
- }, [state.segments, onClearChange]);
99
- const getFormattedDisplayValue = () => {
100
- if (!disableManualEntry) return null;
101
- if (!format) return null;
102
- if (!state.value) return null;
103
- const jsDate = DateTimeUtils.fromDateValueToLocal(state.value, timeZone);
104
- const formattedDate = DateTime.fromJSDate(jsDate);
105
- if (!formattedDate.isValid) return null;
106
- return formattedDate.toFormat(format);
107
- };
108
- const formattedDisplayValue = getFormattedDisplayValue();
109
- let fieldContent = /* @__PURE__ */ jsx(Fragment, { children: segmentsToRender.map((segment, i) => /* @__PURE__ */ jsx(DateSegmentItem, {
110
- segment,
111
- state,
112
- isDisabled,
113
- hidePlaceholder
114
- }, i)) });
115
- if (formattedDisplayValue) fieldContent = /* @__PURE__ */ jsx("span", {
116
- className: clsx("select-none", isDisabled && "text-interactive-text-secondary-disabled"),
117
- children: formattedDisplayValue
118
- });
119
- return /* @__PURE__ */ jsx("div", {
120
- ...fieldProps,
121
- ref: dataFieldRef,
122
- onBlur: handleBlur,
123
- className: clsx("relative w-full", disableManualEntry && "pointer-events-none"),
124
- children: /* @__PURE__ */ jsx("div", {
151
+ };
152
+ $[27] = isTimeOptional;
153
+ $[28] = state;
154
+ $[29] = t8;
155
+ } else t8 = $[29];
156
+ const autoFixYear = t8;
157
+ let t9;
158
+ if ($[30] !== fieldProps || $[31] !== props || $[32] !== state) {
159
+ t9 = (e) => {
160
+ fieldProps.onBlur?.(e);
161
+ if (!state.value) return;
162
+ const currentValue = state.value;
163
+ const { year: year_0 } = currentValue;
164
+ if (year_0 >= 0 && year_0 <= 99) {
165
+ const correctedYear = year_0 <= 50 ? 2e3 + year_0 : 1900 + year_0;
166
+ const correctedDate = currentValue.set({ year: correctedYear });
167
+ if (correctedDate) {
168
+ state.setValue(correctedDate);
169
+ props.onChange?.(correctedDate);
170
+ }
171
+ }
172
+ };
173
+ $[30] = fieldProps;
174
+ $[31] = props;
175
+ $[32] = state;
176
+ $[33] = t9;
177
+ } else t9 = $[33];
178
+ const handleBlur = t9;
179
+ let t10;
180
+ if ($[34] !== autoFixYear || $[35] !== state) {
181
+ t10 = () => ({
182
+ clearField: () => {
183
+ state.setValue(null);
184
+ },
185
+ autoFixYear
186
+ });
187
+ $[34] = autoFixYear;
188
+ $[35] = state;
189
+ $[36] = t10;
190
+ } else t10 = $[36];
191
+ useImperativeHandle(ref, t10);
192
+ let t11;
193
+ let t12;
194
+ if ($[37] !== onClearChange || $[38] !== state.segments) {
195
+ t11 = () => {
196
+ onClearChange?.(state.segments.some(_temp6));
197
+ };
198
+ t12 = [state.segments, onClearChange];
199
+ $[37] = onClearChange;
200
+ $[38] = state.segments;
201
+ $[39] = t11;
202
+ $[40] = t12;
203
+ } else {
204
+ t11 = $[39];
205
+ t12 = $[40];
206
+ }
207
+ useEffect(t11, t12);
208
+ let t13;
209
+ if ($[41] !== disableManualEntry || $[42] !== format || $[43] !== state.value || $[44] !== timeZone) {
210
+ const getFormattedDisplayValue = () => {
211
+ if (!disableManualEntry) return null;
212
+ if (!format) return null;
213
+ if (!state.value) return null;
214
+ const jsDate = DateTimeUtils.fromDateValueToLocal(state.value, timeZone);
215
+ const formattedDate = DateTime.fromJSDate(jsDate);
216
+ if (!formattedDate.isValid) return null;
217
+ return formattedDate.toFormat(format);
218
+ };
219
+ t13 = getFormattedDisplayValue();
220
+ $[41] = disableManualEntry;
221
+ $[42] = format;
222
+ $[43] = state.value;
223
+ $[44] = timeZone;
224
+ $[45] = t13;
225
+ } else t13 = $[45];
226
+ const formattedDisplayValue = t13;
227
+ let t14;
228
+ if ($[46] !== hidePlaceholder || $[47] !== isDisabled || $[48] !== segmentsToRender || $[49] !== state) {
229
+ t14 = /* @__PURE__ */ jsx(Fragment, { children: segmentsToRender.map((segment_6, i) => /* @__PURE__ */ jsx(DateSegmentItem, {
230
+ segment: segment_6,
231
+ state,
232
+ isDisabled,
233
+ hidePlaceholder
234
+ }, i)) });
235
+ $[46] = hidePlaceholder;
236
+ $[47] = isDisabled;
237
+ $[48] = segmentsToRender;
238
+ $[49] = state;
239
+ $[50] = t14;
240
+ } else t14 = $[50];
241
+ let fieldContent = t14;
242
+ if (formattedDisplayValue) {
243
+ const t15 = isDisabled && "text-interactive-text-secondary-disabled";
244
+ let t16;
245
+ if ($[51] !== t15) {
246
+ t16 = clsx("select-none", t15);
247
+ $[51] = t15;
248
+ $[52] = t16;
249
+ } else t16 = $[52];
250
+ let t17;
251
+ if ($[53] !== formattedDisplayValue || $[54] !== t16) {
252
+ t17 = /* @__PURE__ */ jsx("span", {
253
+ className: t16,
254
+ children: formattedDisplayValue
255
+ });
256
+ $[53] = formattedDisplayValue;
257
+ $[54] = t16;
258
+ $[55] = t17;
259
+ } else t17 = $[55];
260
+ fieldContent = t17;
261
+ }
262
+ const t15 = disableManualEntry && "pointer-events-none";
263
+ let t16;
264
+ if ($[56] !== t15) {
265
+ t16 = clsx("relative w-full", t15);
266
+ $[56] = t15;
267
+ $[57] = t16;
268
+ } else t16 = $[57];
269
+ let t17;
270
+ if ($[58] !== fieldContent) {
271
+ t17 = /* @__PURE__ */ jsx("div", {
125
272
  className: "flex",
126
273
  children: fieldContent
127
- })
128
- });
274
+ });
275
+ $[58] = fieldContent;
276
+ $[59] = t17;
277
+ } else t17 = $[59];
278
+ let t18;
279
+ if ($[60] !== fieldProps || $[61] !== handleBlur || $[62] !== t16 || $[63] !== t17) {
280
+ t18 = /* @__PURE__ */ jsx("div", {
281
+ ...fieldProps,
282
+ ref: dataFieldRef,
283
+ onBlur: handleBlur,
284
+ className: t16,
285
+ children: t17
286
+ });
287
+ $[60] = fieldProps;
288
+ $[61] = handleBlur;
289
+ $[62] = t16;
290
+ $[63] = t17;
291
+ $[64] = t18;
292
+ } else t18 = $[64];
293
+ return t18;
129
294
  };
295
+ function _temp(segment_0) {
296
+ return segment_0.type === "month";
297
+ }
298
+ function _temp2(segment_1) {
299
+ return segment_1.type === "day";
300
+ }
301
+ function _temp3(segment_2) {
302
+ return segment_2.type === "year";
303
+ }
304
+ function _temp4(segment_3) {
305
+ return segment_3.type === "hour";
306
+ }
307
+ function _temp5(segment_4) {
308
+ return segment_4.type === "minute";
309
+ }
310
+ function _temp6(segment_5) {
311
+ return segment_5.type !== "literal" && segment_5.isPlaceholder === false;
312
+ }
130
313
  //#endregion
131
314
  export { DateField };
@@ -12,6 +12,9 @@ interface DatePickerInputProps extends InputVariantProps {
12
12
  groupProps: DatePickerAria["groupProps"];
13
13
  fieldProps: DatePickerAria["fieldProps"];
14
14
  endFieldProps?: DatePickerAria["fieldProps"];
15
+ fieldValue?: DatePickerAria["fieldProps"]["value"];
16
+ endFieldValue?: DatePickerAria["fieldProps"]["value"];
17
+ hasValue?: boolean;
15
18
  buttonProps: DatePickerAria["buttonProps"];
16
19
  isDisabled?: boolean;
17
20
  isInvalid?: boolean;
@@ -33,6 +36,8 @@ interface DatePickerInputProps extends InputVariantProps {
33
36
  timeZone?: string;
34
37
  isTimeOptional?: boolean;
35
38
  format?: string;
39
+ fireBlurOnChange?: boolean;
40
+ onClear?: () => void;
36
41
  }
37
- export declare const DatePickerInput: ({ ref, as, groupProps, fieldProps, endFieldProps, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, isClearable, headerProps, todayIcon, todayIconButtonSize, todayIconPlacement, isDirty, isRequired, disableManualEntry, autoFixYear, placeholder, className, onOpenDropdown, dateGranularity, timeZone, isTimeOptional, format, ...props }: DatePickerInputProps) => import("react/jsx-runtime").JSX.Element;
42
+ export declare const DatePickerInput: ({ ref, as, groupProps, fieldProps, endFieldProps, fieldValue, endFieldValue, hasValue, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, isClearable, headerProps, todayIcon, todayIconButtonSize, todayIconPlacement, isDirty, isRequired, disableManualEntry, autoFixYear, placeholder, className, onOpenDropdown, dateGranularity, timeZone, isTimeOptional, format, fireBlurOnChange, onClear: onClearProp, ...props }: DatePickerInputProps) => import("react/jsx-runtime").JSX.Element;
38
43
  export {};