@povio/ui 2.3.1 → 2.3.2-rc.2

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