@povio/ui 2.3.0-rc.9 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (282) hide show
  1. package/dist/assets/icons/AlignCenter.js +11 -26
  2. package/dist/assets/icons/AlignLeft.js +11 -26
  3. package/dist/assets/icons/AlignLeftRight.js +11 -26
  4. package/dist/assets/icons/AlignRight.js +11 -26
  5. package/dist/assets/icons/ArrowDropDown.js +11 -26
  6. package/dist/assets/icons/ArrowDropUp.js +11 -26
  7. package/dist/assets/icons/ArrowLeft.js +11 -26
  8. package/dist/assets/icons/ArrowRight.js +11 -26
  9. package/dist/assets/icons/Bold.js +11 -26
  10. package/dist/assets/icons/BulletedList.js +11 -26
  11. package/dist/assets/icons/Calendar.js +13 -28
  12. package/dist/assets/icons/Check.js +13 -28
  13. package/dist/assets/icons/CheckCircle.js +11 -26
  14. package/dist/assets/icons/CheckboxCheckmark.js +14 -29
  15. package/dist/assets/icons/CheckboxIndeterminate.js +14 -29
  16. package/dist/assets/icons/ChevronDown.js +13 -28
  17. package/dist/assets/icons/ChevronLeft.js +13 -28
  18. package/dist/assets/icons/ChevronRight.js +13 -28
  19. package/dist/assets/icons/ChevronUp.js +13 -28
  20. package/dist/assets/icons/ChevronsLeft.js +13 -28
  21. package/dist/assets/icons/ChevronsRight.js +13 -28
  22. package/dist/assets/icons/Clock.js +11 -26
  23. package/dist/assets/icons/Close.js +11 -26
  24. package/dist/assets/icons/DateTime.js +14 -35
  25. package/dist/assets/icons/DragIndicator.js +11 -26
  26. package/dist/assets/icons/File.js +13 -28
  27. package/dist/assets/icons/Highlight.js +11 -26
  28. package/dist/assets/icons/HighlightOn.js +15 -49
  29. package/dist/assets/icons/Home.js +11 -26
  30. package/dist/assets/icons/Info.js +16 -37
  31. package/dist/assets/icons/Italic.js +11 -26
  32. package/dist/assets/icons/Link.js +11 -26
  33. package/dist/assets/icons/Menu.js +11 -26
  34. package/dist/assets/icons/NumberedList.js +11 -26
  35. package/dist/assets/icons/PointerHorizontal.js +11 -26
  36. package/dist/assets/icons/PointerVertical.js +11 -26
  37. package/dist/assets/icons/Search.js +11 -26
  38. package/dist/assets/icons/Send.js +13 -28
  39. package/dist/assets/icons/Strikethrough.js +11 -26
  40. package/dist/assets/icons/TextColor.js +14 -48
  41. package/dist/assets/icons/Today.js +11 -26
  42. package/dist/assets/icons/Underlined.js +13 -28
  43. package/dist/assets/icons/Upload.js +14 -35
  44. package/dist/assets/icons/Visibility.js +11 -26
  45. package/dist/assets/icons/VisibilityOff.js +11 -26
  46. package/dist/assets/icons/WarningFilled.js +13 -28
  47. package/dist/components/Breadcrumbs/Breadcrumbs.js +56 -207
  48. package/dist/components/Menu/Menu.js +2 -18
  49. package/dist/components/Menu/MenuDesktop.js +7 -41
  50. package/dist/components/Menu/MenuItem.js +9 -32
  51. package/dist/components/Menu/MenuMobile.js +38 -97
  52. package/dist/components/Menu/MenuPopover.js +29 -105
  53. package/dist/components/buttons/IconButton/IconButton.js +8 -40
  54. package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +1 -2
  55. package/dist/components/buttons/InlineIconButton/InlineIconButton.js +9 -34
  56. package/dist/components/buttons/PillButton/PillButton.js +17 -55
  57. package/dist/components/buttons/SplitButton/SplitButton.js +18 -103
  58. package/dist/components/buttons/TextButton/TextButton.js +8 -30
  59. package/dist/components/buttons/ToggleButton/ToggleButton.js +8 -28
  60. package/dist/components/buttons/shared/ButtonContent.js +22 -80
  61. package/dist/components/inputs/Checkbox/Checkbox.js +35 -172
  62. package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +10 -24
  63. package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +0 -3
  64. package/dist/components/inputs/Checkbox/checkbox.cva.js +1 -2
  65. package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +5 -10
  66. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +20 -121
  67. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +5 -10
  68. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +111 -215
  69. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +5 -11
  70. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +19 -123
  71. package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +3 -5
  72. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +104 -448
  73. package/dist/components/inputs/DateTime/shared/Calendar.d.ts +2 -5
  74. package/dist/components/inputs/DateTime/shared/Calendar.js +119 -330
  75. package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +1 -1
  76. package/dist/components/inputs/DateTime/shared/CalendarCell.js +102 -283
  77. package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +1 -1
  78. package/dist/components/inputs/DateTime/shared/CalendarGrid.js +33 -142
  79. package/dist/components/inputs/DateTime/shared/CalendarHeader.js +93 -249
  80. package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +137 -318
  81. package/dist/components/inputs/DateTime/shared/DateField.js +112 -296
  82. package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +3 -6
  83. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +136 -355
  84. package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +0 -14
  85. package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +11 -97
  86. package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +27 -81
  87. package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +10 -59
  88. package/dist/components/inputs/DateTime/shared/MonthPicker.js +58 -103
  89. package/dist/components/inputs/DateTime/shared/RangeCalendar.js +82 -193
  90. package/dist/components/inputs/DateTime/shared/TimeField.js +8 -27
  91. package/dist/components/inputs/DateTime/shared/TimePickerForm.js +110 -279
  92. package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +1 -2
  93. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +65 -207
  94. package/dist/components/inputs/DateTime/shared/YearPicker.js +68 -119
  95. package/dist/components/inputs/File/FileUpload.js +44 -87
  96. package/dist/components/inputs/File/FileUploadContainer.js +7 -15
  97. package/dist/components/inputs/File/InputUpload.js +79 -317
  98. package/dist/components/inputs/File/shared/FileCard.js +41 -104
  99. package/dist/components/inputs/File/shared/FileCardList.js +12 -47
  100. package/dist/components/inputs/File/shared/FileUploadContent.js +44 -175
  101. package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +46 -149
  102. package/dist/components/inputs/File/shared/FileUploadContentError.js +93 -234
  103. package/dist/components/inputs/File/shared/FileUploadContentFilled.js +97 -230
  104. package/dist/components/inputs/File/shared/FileUploadContentLoading.js +55 -199
  105. package/dist/components/inputs/File/shared/InputUploadContent.js +34 -148
  106. package/dist/components/inputs/File/shared/InputUploadFilled.js +8 -49
  107. package/dist/components/inputs/File/shared/ProgressBar.js +9 -48
  108. package/dist/components/inputs/FormField/FormField.d.ts +3 -3
  109. package/dist/components/inputs/FormField/FormField.js +37 -119
  110. package/dist/components/inputs/FormField/FormFieldError.js +5 -25
  111. package/dist/components/inputs/FormField/FormFieldHeader.d.ts +2 -2
  112. package/dist/components/inputs/FormField/FormFieldHeader.js +22 -81
  113. package/dist/components/inputs/FormField/FormFieldHeaderClose.js +7 -31
  114. package/dist/components/inputs/FormField/FormFieldHelper.js +6 -26
  115. package/dist/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
  116. package/dist/components/inputs/FormField/FormFieldLabel.js +9 -40
  117. package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +2 -5
  118. package/dist/components/inputs/Input/NumberInput/NumberInput.js +88 -334
  119. package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +9 -48
  120. package/dist/components/inputs/Input/TextArea/TextArea.js +90 -305
  121. package/dist/components/inputs/Input/TextInput/TextInput.d.ts +1 -3
  122. package/dist/components/inputs/Input/TextInput/TextInput.js +79 -319
  123. package/dist/components/inputs/Input/shared/InputContent.js +59 -192
  124. package/dist/components/inputs/Inputs/Form.js +11 -40
  125. package/dist/components/inputs/Inputs/InputItem.d.ts +21 -16
  126. package/dist/components/inputs/Inputs/InputItem.js +14 -71
  127. package/dist/components/inputs/Inputs/Inputs.js +11 -37
  128. package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -2
  129. package/dist/components/inputs/RadioGroup/RadioGroup.js +60 -352
  130. package/dist/components/inputs/RadioGroup/radio.cva.d.ts +0 -17
  131. package/dist/components/inputs/RadioGroup/radio.cva.js +1 -42
  132. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +2 -6
  133. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +7 -109
  134. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +18 -3
  135. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +8 -34
  136. package/dist/components/inputs/Selection/Select/Select.d.ts +3 -7
  137. package/dist/components/inputs/Selection/Select/Select.js +5 -132
  138. package/dist/components/inputs/Selection/shared/SelectBase.d.ts +1 -8
  139. package/dist/components/inputs/Selection/shared/SelectBase.js +18 -69
  140. package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
  141. package/dist/components/inputs/Selection/shared/SelectDesktop.js +138 -393
  142. package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
  143. package/dist/components/inputs/Selection/shared/SelectInput.js +116 -338
  144. package/dist/components/inputs/Selection/shared/SelectInputTags.js +25 -99
  145. package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
  146. package/dist/components/inputs/Selection/shared/SelectListBox.js +52 -164
  147. package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +35 -85
  148. package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +16 -69
  149. package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +21 -70
  150. package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +9 -58
  151. package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
  152. package/dist/components/inputs/Selection/shared/SelectMobile.js +3 -9
  153. package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -3
  154. package/dist/components/inputs/Selection/shared/select.context.js +34 -57
  155. package/dist/components/inputs/Selection/shared/select.types.d.ts +2 -3
  156. package/dist/components/inputs/Selection/shared/useSelectItems.js +49 -109
  157. package/dist/components/inputs/Slider/Slider.js +74 -250
  158. package/dist/components/inputs/TextEditor/TextEditor.d.ts +0 -1
  159. package/dist/components/inputs/TextEditor/TextEditor.js +98 -447
  160. package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +11 -37
  161. package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +30 -102
  162. package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +45 -194
  163. package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +28 -88
  164. package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +14 -48
  165. package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +19 -66
  166. package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +15 -49
  167. package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +32 -92
  168. package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +54 -126
  169. package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +38 -141
  170. package/dist/components/inputs/Toggle/Toggle.js +37 -189
  171. package/dist/components/inputs/Toggle/toggle.cva.d.ts +0 -3
  172. package/dist/components/inputs/Toggle/toggle.cva.js +1 -2
  173. package/dist/components/inputs/shared/CheckContent.d.ts +1 -2
  174. package/dist/components/inputs/shared/CheckContent.js +11 -21
  175. package/dist/components/inputs/shared/InputClear.d.ts +1 -2
  176. package/dist/components/inputs/shared/InputClear.js +13 -79
  177. package/dist/components/inputs/shared/TooltipWrapper.js +11 -50
  178. package/dist/components/inputs/shared/input.cva.d.ts +0 -10
  179. package/dist/components/inputs/shared/input.cva.js +4 -32
  180. package/dist/components/navigation/Accordion/Accordion.js +22 -69
  181. package/dist/components/navigation/Accordion/AccordionItem.js +41 -86
  182. package/dist/components/navigation/Stepper/Stepper.js +22 -67
  183. package/dist/components/navigation/Stepper/StepperItem.js +31 -104
  184. package/dist/components/navigation/Stepper/StepperSeparator.js +5 -23
  185. package/dist/components/overlays/ActionModal/ActionModal.js +35 -169
  186. package/dist/components/overlays/BottomSheet/BottomSheet.js +49 -98
  187. package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +8 -48
  188. package/dist/components/overlays/Drawer/Drawer.js +20 -62
  189. package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +27 -83
  190. package/dist/components/overlays/Tooltip/Tooltip.js +28 -137
  191. package/dist/components/overlays/Tooltip/TooltipEllipsis.js +12 -37
  192. package/dist/components/segment/Segment.js +57 -218
  193. package/dist/components/segment/SegmentItem.js +10 -67
  194. package/dist/components/shared/pagination/Pagination.js +22 -108
  195. package/dist/components/shared/pagination/PaginationList.js +64 -167
  196. package/dist/components/status/Alert/Alert.js +30 -97
  197. package/dist/components/status/Loader/Loader.js +22 -77
  198. package/dist/components/status/Toast/Toast.js +13 -21
  199. package/dist/components/status/Toast/useToast.js +57 -62
  200. package/dist/components/table/ColumnConfig.js +54 -158
  201. package/dist/components/table/InfiniteTable.js +16 -67
  202. package/dist/components/table/PaginatedTable.js +18 -84
  203. package/dist/components/table/Table.js +27 -28
  204. package/dist/components/text/Link/Link.js +7 -19
  205. package/dist/components/text/Typography/Typography.js +8 -23
  206. package/dist/config/confirmation.context.js +1 -1
  207. package/dist/config/link.context.js +9 -23
  208. package/dist/config/router.context.js +16 -42
  209. package/dist/config/theme.context.js +45 -98
  210. package/dist/config/uiConfig.context.d.ts +6 -16
  211. package/dist/config/uiConfig.context.js +13 -56
  212. package/dist/config/uiStyle.context.d.ts +4 -27
  213. package/dist/config/uiStyle.context.js +5 -15
  214. package/dist/helpers/dynamicInputs.d.ts +5 -5
  215. package/dist/helpers/dynamicInputs.js +0 -3
  216. package/dist/hooks/useBreakpoint.js +3 -16
  217. package/dist/hooks/useDebounceCallback.js +17 -51
  218. package/dist/hooks/useFilters.js +64 -125
  219. package/dist/hooks/useForm.js +8 -42
  220. package/dist/hooks/useFormAutosave.js +30 -101
  221. package/dist/hooks/useIntersectionObserver.d.ts +1 -1
  222. package/dist/hooks/useIntersectionObserver.js +24 -91
  223. package/dist/hooks/useLocalStorage.js +10 -43
  224. package/dist/hooks/useLongPressRepeat.js +20 -55
  225. package/dist/hooks/usePagination.js +19 -49
  226. package/dist/hooks/useScrollableListBox.js +16 -37
  227. package/dist/hooks/useSorting.js +28 -69
  228. package/dist/hooks/useStateAndRef.js +7 -21
  229. package/dist/hooks/useTableColumnConfig.js +31 -124
  230. package/dist/hooks/useTranslationMemo.js +5 -25
  231. package/dist/index.d.ts +0 -7
  232. package/dist/index.js +3 -5
  233. package/dist/tw-ui-plugin.js +0 -2
  234. package/dist/utils/date-time.utils.d.ts +10 -31
  235. package/dist/utils/date-time.utils.js +22 -123
  236. package/dist/utils/dom.utils.js +1 -1
  237. package/package.json +1 -1
  238. package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +0 -4
  239. package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +0 -7
  240. package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +0 -13
  241. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +0 -6
  242. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +0 -21
  243. package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +0 -2
  244. package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +0 -1
  245. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +0 -31
  246. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +0 -80
  247. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +0 -1
  248. package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +0 -6
  249. package/dist/components/inputs/FormField/formFieldHeader.cva.js +0 -11
  250. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.d.ts +0 -45
  251. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +0 -571
  252. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +0 -35
  253. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +0 -479
  254. package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +0 -4
  255. package/dist/components/inputs/Input/TextArea/TextArea.cva.js +0 -5
  256. package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +0 -1
  257. package/dist/components/inputs/Input/shared/numberStatic.utils.js +0 -7
  258. package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +0 -36
  259. package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +0 -14
  260. package/dist/components/inputs/Selection/Select/QuerySelect.js +0 -122
  261. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +0 -9
  262. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +0 -47
  263. package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +0 -6
  264. package/dist/components/inputs/Selection/shared/querySelect.utils.js +0 -13
  265. package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +0 -3
  266. package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +0 -5
  267. package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +0 -5
  268. package/dist/components/inputs/Selection/shared/selectInput.cva.js +0 -5
  269. package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +0 -23
  270. package/dist/components/inputs/Selection/shared/staticSelect.utils.js +0 -37
  271. package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +0 -1
  272. package/dist/components/inputs/Skeleton/InputFrame.d.ts +0 -79
  273. package/dist/components/inputs/Skeleton/InputFrame.js +0 -526
  274. package/dist/components/inputs/shared/StaticInput.d.ts +0 -38
  275. package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +0 -4
  276. package/dist/components/inputs/shared/tooltipWrapper.cva.js +0 -5
  277. package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +0 -14
  278. package/dist/components/inputs/shared/useStaticInputHandoff.js +0 -100
  279. package/dist/hooks/useQueryAutocomplete.d.ts +0 -14
  280. package/dist/hooks/useQueryAutocomplete.js +0 -57
  281. package/dist/utils/query.utils.d.ts +0 -4
  282. package/dist/utils/query.utils.js +0 -8
@@ -1,315 +1,131 @@
1
1
  import { DateSegmentItem } from "./DateSegmentItem.js";
2
2
  import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
3
- import { c } from "react/compiler-runtime";
4
3
  import { Fragment, jsx } from "react/jsx-runtime";
5
4
  import { clsx } from "clsx";
6
- import { useEffect, useImperativeHandle, useRef } from "react";
5
+ import { useCallback, useEffect, useImperativeHandle, useMemo, useRef } from "react";
7
6
  import { useDateField, useLocale } from "react-aria";
8
7
  import { createCalendar } from "@internationalized/date";
9
8
  import { DateTime } from "luxon";
10
9
  import { useDateFieldState } from "react-stately";
11
10
  //#region src/components/inputs/DateTime/shared/DateField.tsx
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;
11
+ var DateField = ({ ref, onClearChange, hidePlaceholder, isDisabled, disableManualEntry, dateGranularity = "day", isTimeOptional = false, format, timeZone, ...props }) => {
51
12
  const { locale } = useLocale();
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);
13
+ const state = useDateFieldState({
14
+ ...props,
15
+ isDisabled,
16
+ isReadOnly: disableManualEntry,
17
+ locale,
18
+ createCalendar
19
+ });
68
20
  const dataFieldRef = useRef(null);
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);
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;
137
58
  }
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);
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;
145
66
  }
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);
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);
150
86
  }
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
- for (const segment_5 of state.segments) if (segment_5.type !== "literal") state.clearSegment(segment_5.type);
185
- },
186
- autoFixYear
187
- });
188
- $[34] = autoFixYear;
189
- $[35] = state;
190
- $[36] = t10;
191
- } else t10 = $[36];
192
- useImperativeHandle(ref, t10);
193
- let t11;
194
- let t12;
195
- if ($[37] !== onClearChange || $[38] !== state.segments) {
196
- t11 = () => {
197
- onClearChange?.(state.segments.some(_temp6));
198
- };
199
- t12 = [state.segments, onClearChange];
200
- $[37] = onClearChange;
201
- $[38] = state.segments;
202
- $[39] = t11;
203
- $[40] = t12;
204
- } else {
205
- t11 = $[39];
206
- t12 = $[40];
207
- }
208
- useEffect(t11, t12);
209
- let t13;
210
- if ($[41] !== disableManualEntry || $[42] !== format || $[43] !== state.value || $[44] !== timeZone) {
211
- const getFormattedDisplayValue = () => {
212
- if (!disableManualEntry) return null;
213
- if (!format) return null;
214
- if (!state.value) return null;
215
- const jsDate = DateTimeUtils.fromDateValueToLocal(state.value, timeZone);
216
- const formattedDate = DateTime.fromJSDate(jsDate);
217
- if (!formattedDate.isValid) return null;
218
- return formattedDate.toFormat(format);
219
- };
220
- t13 = getFormattedDisplayValue();
221
- $[41] = disableManualEntry;
222
- $[42] = format;
223
- $[43] = state.value;
224
- $[44] = timeZone;
225
- $[45] = t13;
226
- } else t13 = $[45];
227
- const formattedDisplayValue = t13;
228
- let t14;
229
- if ($[46] !== hidePlaceholder || $[47] !== isDisabled || $[48] !== segmentsToRender || $[49] !== state) {
230
- t14 = /* @__PURE__ */ jsx(Fragment, { children: segmentsToRender.map((segment_7, i) => /* @__PURE__ */ jsx(DateSegmentItem, {
231
- segment: segment_7,
232
- state,
233
- isDisabled,
234
- hidePlaceholder
235
- }, i)) });
236
- $[46] = hidePlaceholder;
237
- $[47] = isDisabled;
238
- $[48] = segmentsToRender;
239
- $[49] = state;
240
- $[50] = t14;
241
- } else t14 = $[50];
242
- let fieldContent = t14;
243
- if (formattedDisplayValue) {
244
- const t15 = isDisabled && "text-interactive-text-secondary-disabled";
245
- let t16;
246
- if ($[51] !== t15) {
247
- t16 = clsx("select-none", t15);
248
- $[51] = t15;
249
- $[52] = t16;
250
- } else t16 = $[52];
251
- let t17;
252
- if ($[53] !== formattedDisplayValue || $[54] !== t16) {
253
- t17 = /* @__PURE__ */ jsx("span", {
254
- className: t16,
255
- children: formattedDisplayValue
256
- });
257
- $[53] = formattedDisplayValue;
258
- $[54] = t16;
259
- $[55] = t17;
260
- } else t17 = $[55];
261
- fieldContent = t17;
262
- }
263
- const t15 = disableManualEntry && "pointer-events-none";
264
- let t16;
265
- if ($[56] !== t15) {
266
- t16 = clsx("relative w-full", t15);
267
- $[56] = t15;
268
- $[57] = t16;
269
- } else t16 = $[57];
270
- let t17;
271
- if ($[58] !== fieldContent) {
272
- t17 = /* @__PURE__ */ jsx("div", {
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", {
273
125
  className: "flex",
274
126
  children: fieldContent
275
- });
276
- $[58] = fieldContent;
277
- $[59] = t17;
278
- } else t17 = $[59];
279
- let t18;
280
- if ($[60] !== fieldProps || $[61] !== handleBlur || $[62] !== t16 || $[63] !== t17) {
281
- t18 = /* @__PURE__ */ jsx("div", {
282
- ...fieldProps,
283
- ref: dataFieldRef,
284
- onBlur: handleBlur,
285
- className: t16,
286
- children: t17
287
- });
288
- $[60] = fieldProps;
289
- $[61] = handleBlur;
290
- $[62] = t16;
291
- $[63] = t17;
292
- $[64] = t18;
293
- } else t18 = $[64];
294
- return t18;
127
+ })
128
+ });
295
129
  };
296
- function _temp(segment_0) {
297
- return segment_0.type === "month";
298
- }
299
- function _temp2(segment_1) {
300
- return segment_1.type === "day";
301
- }
302
- function _temp3(segment_2) {
303
- return segment_2.type === "year";
304
- }
305
- function _temp4(segment_3) {
306
- return segment_3.type === "hour";
307
- }
308
- function _temp5(segment_4) {
309
- return segment_4.type === "minute";
310
- }
311
- function _temp6(segment_6) {
312
- return segment_6.type !== "literal" && segment_6.isPlaceholder === false;
313
- }
314
130
  //#endregion
315
131
  export { DateField };
@@ -1,6 +1,5 @@
1
1
  import { Ref } from 'react';
2
2
  import { DatePickerAria } from 'react-aria';
3
- import { DatePickerTodayIcon, DatePickerTodayIconButtonSize, DatePickerTodayIconPlacement } from './datePicker.types';
4
3
  import { FormFieldHeaderProps } from '../../FormField/FormFieldHeader';
5
4
  import { InputVariantProps } from '../../shared/input.cva';
6
5
  export interface DatePickerInputHandle {
@@ -19,20 +18,18 @@ interface DatePickerInputProps extends InputVariantProps {
19
18
  isDateTime?: boolean;
20
19
  isClearable?: boolean;
21
20
  headerProps?: FormFieldHeaderProps;
22
- todayIcon?: DatePickerTodayIcon;
23
- todayIconButtonSize?: DatePickerTodayIconButtonSize;
24
- todayIconPlacement?: DatePickerTodayIconPlacement;
21
+ todayIcon?: boolean;
25
22
  isDirty?: boolean;
26
23
  isRequired?: boolean;
27
24
  disableManualEntry?: boolean;
28
- autoFixYear?: boolean;
29
25
  placeholder?: string;
30
26
  className?: string;
31
27
  onOpenDropdown?: () => void;
32
28
  dateGranularity?: "day" | "month" | "year";
33
29
  timeZone?: string;
30
+ autoFixYear?: boolean;
34
31
  isTimeOptional?: boolean;
35
32
  format?: string;
36
33
  }
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;
34
+ export declare const DatePickerInput: ({ ref, as, groupProps, fieldProps, endFieldProps, buttonProps, isDisabled, isInvalid, disableDropdown, variant, size, isDateTime, isClearable, headerProps, todayIcon, isDirty, isRequired, disableManualEntry, placeholder, className, onOpenDropdown, dateGranularity, timeZone, autoFixYear, isTimeOptional, format, ...props }: DatePickerInputProps) => import("react/jsx-runtime").JSX.Element;
38
35
  export {};