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