@povio/ui 2.3.2-rc.3 → 2.3.3

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