@povio/ui 2.3.0 → 2.3.2-rc.1

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