@povio/ui 2.3.2-rc.3 → 2.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (284) hide show
  1. package/dist/assets/icons/AlignCenter.js +11 -26
  2. package/dist/assets/icons/AlignLeft.js +11 -26
  3. package/dist/assets/icons/AlignLeftRight.js +11 -26
  4. package/dist/assets/icons/AlignRight.js +11 -26
  5. package/dist/assets/icons/ArrowDropDown.js +11 -26
  6. package/dist/assets/icons/ArrowDropUp.js +11 -26
  7. package/dist/assets/icons/ArrowLeft.js +11 -26
  8. package/dist/assets/icons/ArrowRight.js +11 -26
  9. package/dist/assets/icons/Bold.js +11 -26
  10. package/dist/assets/icons/BulletedList.js +11 -26
  11. package/dist/assets/icons/Calendar.js +13 -28
  12. package/dist/assets/icons/Check.js +13 -28
  13. package/dist/assets/icons/CheckCircle.js +11 -26
  14. package/dist/assets/icons/CheckboxCheckmark.js +14 -29
  15. package/dist/assets/icons/CheckboxIndeterminate.js +14 -29
  16. package/dist/assets/icons/ChevronDown.js +13 -28
  17. package/dist/assets/icons/ChevronLeft.js +13 -28
  18. package/dist/assets/icons/ChevronRight.js +13 -28
  19. package/dist/assets/icons/ChevronUp.js +13 -28
  20. package/dist/assets/icons/ChevronsLeft.js +13 -28
  21. package/dist/assets/icons/ChevronsRight.js +13 -28
  22. package/dist/assets/icons/Clock.js +11 -26
  23. package/dist/assets/icons/Close.js +11 -26
  24. package/dist/assets/icons/DateTime.js +14 -35
  25. package/dist/assets/icons/DragIndicator.js +11 -26
  26. package/dist/assets/icons/File.js +13 -28
  27. package/dist/assets/icons/Highlight.js +11 -26
  28. package/dist/assets/icons/HighlightOn.js +15 -49
  29. package/dist/assets/icons/Home.js +11 -26
  30. package/dist/assets/icons/Info.js +16 -37
  31. package/dist/assets/icons/Italic.js +11 -26
  32. package/dist/assets/icons/Link.js +11 -26
  33. package/dist/assets/icons/Menu.js +11 -26
  34. package/dist/assets/icons/NumberedList.js +11 -26
  35. package/dist/assets/icons/PointerHorizontal.js +11 -26
  36. package/dist/assets/icons/PointerVertical.js +11 -26
  37. package/dist/assets/icons/Search.js +11 -26
  38. package/dist/assets/icons/Send.js +13 -28
  39. package/dist/assets/icons/Strikethrough.js +11 -26
  40. package/dist/assets/icons/TextColor.js +14 -48
  41. package/dist/assets/icons/Today.js +11 -26
  42. package/dist/assets/icons/Underlined.js +13 -28
  43. package/dist/assets/icons/Upload.js +14 -35
  44. package/dist/assets/icons/Visibility.js +11 -26
  45. package/dist/assets/icons/VisibilityOff.js +11 -26
  46. package/dist/assets/icons/WarningFilled.js +13 -28
  47. package/dist/assets/locales/sl/translation.json.js +2 -2
  48. package/dist/components/Breadcrumbs/Breadcrumbs.js +56 -207
  49. package/dist/components/Menu/Menu.js +2 -18
  50. package/dist/components/Menu/MenuDesktop.js +7 -41
  51. package/dist/components/Menu/MenuItem.js +9 -32
  52. package/dist/components/Menu/MenuMobile.js +38 -97
  53. package/dist/components/Menu/MenuPopover.js +29 -105
  54. package/dist/components/buttons/IconButton/IconButton.js +8 -40
  55. package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +1 -2
  56. package/dist/components/buttons/InlineIconButton/InlineIconButton.js +9 -34
  57. package/dist/components/buttons/PillButton/PillButton.js +17 -55
  58. package/dist/components/buttons/SplitButton/SplitButton.js +18 -103
  59. package/dist/components/buttons/TextButton/TextButton.js +8 -30
  60. package/dist/components/buttons/ToggleButton/ToggleButton.js +8 -28
  61. package/dist/components/buttons/shared/ButtonContent.js +22 -80
  62. package/dist/components/inputs/Checkbox/Checkbox.d.ts +0 -1
  63. package/dist/components/inputs/Checkbox/Checkbox.js +35 -201
  64. package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +10 -24
  65. package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +0 -3
  66. package/dist/components/inputs/Checkbox/checkbox.cva.js +1 -2
  67. package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +5 -12
  68. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +75 -368
  69. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +5 -12
  70. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +298 -506
  71. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +5 -13
  72. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +56 -273
  73. package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +3 -6
  74. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +130 -606
  75. package/dist/components/inputs/DateTime/shared/Calendar.d.ts +2 -5
  76. package/dist/components/inputs/DateTime/shared/Calendar.js +119 -332
  77. package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +2 -3
  78. package/dist/components/inputs/DateTime/shared/CalendarCell.js +102 -301
  79. package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +2 -3
  80. package/dist/components/inputs/DateTime/shared/CalendarGrid.js +33 -146
  81. package/dist/components/inputs/DateTime/shared/CalendarHeader.js +93 -249
  82. package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +137 -318
  83. package/dist/components/inputs/DateTime/shared/DateField.js +112 -311
  84. package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +3 -13
  85. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +139 -383
  86. package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +0 -15
  87. package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +11 -96
  88. package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +27 -81
  89. package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +10 -59
  90. package/dist/components/inputs/DateTime/shared/MonthPicker.js +58 -103
  91. package/dist/components/inputs/DateTime/shared/RangeCalendar.js +82 -193
  92. package/dist/components/inputs/DateTime/shared/TimeField.js +8 -27
  93. package/dist/components/inputs/DateTime/shared/TimePickerForm.js +110 -279
  94. package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +1 -4
  95. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +65 -210
  96. package/dist/components/inputs/DateTime/shared/YearPicker.js +68 -119
  97. package/dist/components/inputs/File/FileUpload.js +44 -87
  98. package/dist/components/inputs/File/FileUploadContainer.js +7 -15
  99. package/dist/components/inputs/File/InputUpload.js +79 -317
  100. package/dist/components/inputs/File/shared/FileCard.js +41 -104
  101. package/dist/components/inputs/File/shared/FileCardList.js +12 -47
  102. package/dist/components/inputs/File/shared/FileUploadContent.js +44 -175
  103. package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +46 -149
  104. package/dist/components/inputs/File/shared/FileUploadContentError.js +93 -234
  105. package/dist/components/inputs/File/shared/FileUploadContentFilled.js +97 -230
  106. package/dist/components/inputs/File/shared/FileUploadContentLoading.js +55 -199
  107. package/dist/components/inputs/File/shared/InputUploadContent.js +34 -148
  108. package/dist/components/inputs/File/shared/InputUploadFilled.js +8 -49
  109. package/dist/components/inputs/File/shared/ProgressBar.js +9 -48
  110. package/dist/components/inputs/FormField/FormField.d.ts +3 -3
  111. package/dist/components/inputs/FormField/FormField.js +37 -119
  112. package/dist/components/inputs/FormField/FormFieldError.js +5 -25
  113. package/dist/components/inputs/FormField/FormFieldHeader.d.ts +2 -2
  114. package/dist/components/inputs/FormField/FormFieldHeader.js +22 -81
  115. package/dist/components/inputs/FormField/FormFieldHeaderClose.js +7 -31
  116. package/dist/components/inputs/FormField/FormFieldHelper.js +6 -26
  117. package/dist/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
  118. package/dist/components/inputs/FormField/FormFieldLabel.js +9 -40
  119. package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +2 -5
  120. package/dist/components/inputs/Input/NumberInput/NumberInput.js +97 -447
  121. package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +9 -48
  122. package/dist/components/inputs/Input/TextArea/TextArea.js +90 -305
  123. package/dist/components/inputs/Input/TextInput/TextInput.d.ts +1 -3
  124. package/dist/components/inputs/Input/TextInput/TextInput.js +90 -419
  125. package/dist/components/inputs/Input/shared/InputContent.js +59 -192
  126. package/dist/components/inputs/Inputs/Form.js +11 -40
  127. package/dist/components/inputs/Inputs/InputItem.d.ts +21 -15
  128. package/dist/components/inputs/Inputs/InputItem.js +14 -69
  129. package/dist/components/inputs/Inputs/Inputs.js +11 -37
  130. package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -3
  131. package/dist/components/inputs/RadioGroup/RadioGroup.js +61 -353
  132. package/dist/components/inputs/RadioGroup/radio.cva.d.ts +0 -17
  133. package/dist/components/inputs/RadioGroup/radio.cva.js +1 -42
  134. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +2 -6
  135. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +22 -214
  136. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +18 -3
  137. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +8 -104
  138. package/dist/components/inputs/Selection/Select/Select.d.ts +3 -7
  139. package/dist/components/inputs/Selection/Select/Select.js +18 -225
  140. package/dist/components/inputs/Selection/shared/SelectBase.d.ts +1 -8
  141. package/dist/components/inputs/Selection/shared/SelectBase.js +18 -69
  142. package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
  143. package/dist/components/inputs/Selection/shared/SelectDesktop.js +138 -393
  144. package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
  145. package/dist/components/inputs/Selection/shared/SelectInput.js +116 -330
  146. package/dist/components/inputs/Selection/shared/SelectInputTags.js +25 -99
  147. package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
  148. package/dist/components/inputs/Selection/shared/SelectListBox.js +52 -164
  149. package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +35 -85
  150. package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +16 -69
  151. package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +21 -70
  152. package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +9 -58
  153. package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
  154. package/dist/components/inputs/Selection/shared/SelectMobile.js +3 -9
  155. package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -3
  156. package/dist/components/inputs/Selection/shared/select.context.js +36 -67
  157. package/dist/components/inputs/Selection/shared/select.types.d.ts +2 -3
  158. package/dist/components/inputs/Selection/shared/useSelectItems.js +49 -109
  159. package/dist/components/inputs/Slider/Slider.d.ts +1 -2
  160. package/dist/components/inputs/Slider/Slider.js +76 -265
  161. package/dist/components/inputs/TextEditor/TextEditor.d.ts +0 -1
  162. package/dist/components/inputs/TextEditor/TextEditor.js +98 -447
  163. package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +11 -37
  164. package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +30 -102
  165. package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +45 -194
  166. package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +28 -88
  167. package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +14 -48
  168. package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +19 -66
  169. package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +15 -49
  170. package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +32 -92
  171. package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +54 -126
  172. package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +38 -141
  173. package/dist/components/inputs/Toggle/Toggle.d.ts +0 -1
  174. package/dist/components/inputs/Toggle/Toggle.js +37 -214
  175. package/dist/components/inputs/Toggle/toggle.cva.d.ts +0 -3
  176. package/dist/components/inputs/Toggle/toggle.cva.js +1 -2
  177. package/dist/components/inputs/shared/CheckContent.d.ts +1 -2
  178. package/dist/components/inputs/shared/CheckContent.js +11 -21
  179. package/dist/components/inputs/shared/InputClear.d.ts +1 -2
  180. package/dist/components/inputs/shared/InputClear.js +12 -88
  181. package/dist/components/inputs/shared/TooltipWrapper.js +11 -50
  182. package/dist/components/inputs/shared/input.cva.d.ts +0 -10
  183. package/dist/components/inputs/shared/input.cva.js +4 -32
  184. package/dist/components/navigation/Accordion/Accordion.js +22 -69
  185. package/dist/components/navigation/Accordion/AccordionItem.js +41 -86
  186. package/dist/components/navigation/Stepper/Stepper.js +22 -67
  187. package/dist/components/navigation/Stepper/StepperItem.js +31 -104
  188. package/dist/components/navigation/Stepper/StepperSeparator.js +5 -23
  189. package/dist/components/overlays/ActionModal/ActionModal.js +35 -169
  190. package/dist/components/overlays/BottomSheet/BottomSheet.js +23 -96
  191. package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +8 -48
  192. package/dist/components/overlays/Drawer/Drawer.js +20 -62
  193. package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +27 -83
  194. package/dist/components/overlays/Tooltip/Tooltip.js +28 -137
  195. package/dist/components/overlays/Tooltip/TooltipEllipsis.js +12 -37
  196. package/dist/components/segment/Segment.js +57 -218
  197. package/dist/components/segment/SegmentItem.js +10 -67
  198. package/dist/components/shared/pagination/Pagination.js +22 -108
  199. package/dist/components/shared/pagination/PaginationList.js +64 -167
  200. package/dist/components/status/Alert/Alert.js +30 -97
  201. package/dist/components/status/Loader/Loader.js +22 -77
  202. package/dist/components/status/Toast/Toast.js +13 -21
  203. package/dist/components/status/Toast/useToast.js +57 -62
  204. package/dist/components/table/ColumnConfig.js +54 -158
  205. package/dist/components/table/InfiniteTable.js +16 -67
  206. package/dist/components/table/PaginatedTable.js +18 -84
  207. package/dist/components/table/Table.js +27 -28
  208. package/dist/components/text/Link/Link.js +7 -19
  209. package/dist/components/text/Typography/Typography.js +8 -23
  210. package/dist/config/confirmation.context.js +1 -1
  211. package/dist/config/link.context.js +9 -23
  212. package/dist/config/router.context.js +16 -42
  213. package/dist/config/theme.context.js +45 -98
  214. package/dist/config/uiConfig.context.d.ts +6 -19
  215. package/dist/config/uiConfig.context.js +14 -67
  216. package/dist/config/uiStyle.context.d.ts +4 -27
  217. package/dist/config/uiStyle.context.js +5 -15
  218. package/dist/helpers/dynamicInputs.d.ts +5 -5
  219. package/dist/helpers/dynamicInputs.js +0 -3
  220. package/dist/hooks/useBreakpoint.js +3 -16
  221. package/dist/hooks/useDebounceCallback.js +17 -51
  222. package/dist/hooks/useFilters.js +64 -125
  223. package/dist/hooks/useForm.js +8 -42
  224. package/dist/hooks/useFormAutosave.js +30 -101
  225. package/dist/hooks/useIntersectionObserver.d.ts +1 -1
  226. package/dist/hooks/useIntersectionObserver.js +24 -91
  227. package/dist/hooks/useLocalStorage.js +10 -43
  228. package/dist/hooks/useLongPressRepeat.js +20 -55
  229. package/dist/hooks/usePagination.js +19 -49
  230. package/dist/hooks/useScrollableListBox.js +16 -37
  231. package/dist/hooks/useSorting.js +28 -69
  232. package/dist/hooks/useStateAndRef.js +7 -21
  233. package/dist/hooks/useTableColumnConfig.js +31 -124
  234. package/dist/hooks/useTranslationMemo.js +5 -25
  235. package/dist/index.d.ts +0 -7
  236. package/dist/index.js +2 -4
  237. package/dist/tw-ui-plugin.js +0 -6
  238. package/dist/utils/date-time.utils.d.ts +10 -38
  239. package/dist/utils/date-time.utils.js +22 -134
  240. package/package.json +1 -1
  241. package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +0 -5
  242. package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +0 -7
  243. package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +0 -13
  244. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +0 -15
  245. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +0 -32
  246. package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +0 -2
  247. package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +0 -1
  248. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +0 -39
  249. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +0 -85
  250. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +0 -1
  251. package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +0 -6
  252. package/dist/components/inputs/FormField/formFieldHeader.cva.js +0 -11
  253. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.d.ts +0 -45
  254. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +0 -571
  255. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +0 -35
  256. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +0 -575
  257. package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +0 -4
  258. package/dist/components/inputs/Input/TextArea/TextArea.cva.js +0 -5
  259. package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +0 -1
  260. package/dist/components/inputs/Input/shared/numberStatic.utils.js +0 -7
  261. package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +0 -36
  262. package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +0 -14
  263. package/dist/components/inputs/Selection/Select/QuerySelect.js +0 -173
  264. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +0 -9
  265. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +0 -47
  266. package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +0 -12
  267. package/dist/components/inputs/Selection/shared/querySelect.utils.js +0 -36
  268. package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +0 -3
  269. package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +0 -5
  270. package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +0 -5
  271. package/dist/components/inputs/Selection/shared/selectInput.cva.js +0 -5
  272. package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +0 -23
  273. package/dist/components/inputs/Selection/shared/staticSelect.utils.js +0 -37
  274. package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +0 -1
  275. package/dist/components/inputs/Skeleton/InputFrame.d.ts +0 -82
  276. package/dist/components/inputs/Skeleton/InputFrame.js +0 -548
  277. package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +0 -4
  278. package/dist/components/inputs/shared/tooltipWrapper.cva.js +0 -5
  279. package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +0 -14
  280. package/dist/components/inputs/shared/useStaticInputHandoff.js +0 -100
  281. package/dist/hooks/useQueryAutocomplete.d.ts +0 -14
  282. package/dist/hooks/useQueryAutocomplete.js +0 -57
  283. package/dist/utils/query.utils.d.ts +0 -4
  284. package/dist/utils/query.utils.js +0 -8
@@ -41,7 +41,6 @@ var checkboxTypography = compoundMapper({ default: {
41
41
  sizeMobile: "label-1",
42
42
  variant: "default"
43
43
  } });
44
- var checkboxContentClassName = compoundMapper({ default: "text-text-default-2" });
45
44
  var checkboxIcon = cva(["absolute hidden size-3"], {
46
45
  variants: { iconVariant: {
47
46
  selected: ["group-selected:block"],
@@ -50,4 +49,4 @@ var checkboxIcon = cva(["absolute hidden size-3"], {
50
49
  defaultVariants: { iconVariant: "selected" }
51
50
  });
52
51
  //#endregion
53
- export { checkbox, checkboxContentClassName, checkboxIcon, checkboxIndicatorClass, checkboxTypography };
52
+ export { checkbox, checkboxIcon, checkboxIndicatorClass, checkboxTypography };
@@ -1,32 +1,26 @@
1
1
  import { CalendarDate, DateValue } from '@internationalized/date';
2
- import { FocusEvent, Ref } from 'react';
2
+ import { 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';
7
6
  import { FormFieldProps } from '../../FormField/FormField';
8
7
  import { ControlProps } from '../../shared/form.types';
9
8
  import { InputVariantProps } from '../../shared/input.cva';
10
9
  type DatePickerGranularity = "day" | "month" | "year";
11
- interface DatePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<DatePickerStateOptions<CalendarDate>, "granularity" | "shouldCloseOnSelect" | "label" | "onBlur"> {
10
+ interface DatePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<DatePickerStateOptions<CalendarDate>, "granularity" | "shouldCloseOnSelect" | "label"> {
12
11
  ref?: Ref<DatePickerInputHandle & HTMLDivElement>;
13
12
  disableDropdown?: boolean;
14
13
  isClearable?: boolean;
15
14
  className?: string;
16
- todayIcon?: DatePickerTodayIcon;
17
- todayIconButtonSize?: DatePickerTodayIconButtonSize;
18
- todayIconButtonComponent?: DatePickerTodayIconButtonComponent;
19
- todayIconPlacement?: DatePickerTodayIconPlacement;
15
+ todayIcon?: boolean;
20
16
  isDirty?: boolean;
21
17
  disableManualEntry?: boolean;
22
- autoFixYear?: boolean;
23
18
  placeholder?: string;
24
19
  inputClassName?: string;
25
- onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
26
20
  shouldUpdateDateOnMonthYearChange?: boolean;
27
21
  granularity?: DatePickerGranularity;
22
+ autoFixYear?: boolean;
28
23
  format?: string;
29
- fireBlurOnChange?: boolean;
30
24
  }
31
25
  export interface DatePickerProps extends Omit<DatePickerBaseProps, "value" | "onChange" | "minValue" | "maxValue"> {
32
26
  value?: string | null;
@@ -34,8 +28,7 @@ export interface DatePickerProps extends Omit<DatePickerBaseProps, "value" | "on
34
28
  fullIso?: boolean;
35
29
  minValue?: DateValue | string;
36
30
  maxValue?: DateValue | string;
37
- renderStaticInput?: boolean;
38
31
  }
39
32
  export type ControlledDatePickerProps<TFieldValues extends FieldValues> = ControlProps<DatePickerProps, TFieldValues>;
40
- export declare const DatePicker: <TFieldValues extends FieldValues>({ fullIso, granularity, minValue, maxValue, renderStaticInput, ...props }: ControlledDatePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
33
+ export declare const DatePicker: <TFieldValues extends FieldValues>({ fullIso, granularity, minValue, maxValue, ...props }: ControlledDatePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
41
34
  export {};
@@ -1,48 +1,24 @@
1
- import { UIStyle } from "../../../../config/uiStyle.context.js";
2
1
  import { UIConfig } from "../../../../config/uiConfig.context.js";
3
2
  import { Calendar } from "../shared/Calendar.js";
4
3
  import { DateTimeUtils } from "../../../../utils/date-time.utils.js";
5
- import { datePickerInputContentRow } from "../shared/datePickerInput.cva.js";
6
- import { renderDatePickerTodayIcon } from "../shared/datePickerTodayIcon.js";
7
4
  import { DatePickerInput } from "../shared/DatePickerInput.js";
8
5
  import { DateTimeDialog } from "../shared/DateTimeDialog.js";
9
6
  import { DateTimeDialogFooter } from "../shared/DateTimeDialogFooter.js";
10
- import { getStaticCalendarDateSegments } from "../shared/staticDateTimeSegments.js";
11
7
  import { FormField } from "../../FormField/FormField.js";
12
8
  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";
17
9
  import { jsx, jsxs } from "react/jsx-runtime";
18
10
  import { clsx } from "clsx";
19
- import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
11
+ import { useCallback, useEffect, useImperativeHandle, useMemo, useRef } from "react";
20
12
  import { useDatePicker, useLocale } from "react-aria";
21
13
  import { mergeRefs } from "@react-aria/utils";
22
14
  import { Controller } from "react-hook-form";
23
- import { createCalendar, toCalendarDate, today } from "@internationalized/date";
15
+ import { createCalendar, getLocalTimeZone, toCalendarDate, today } from "@internationalized/date";
24
16
  import { DateTime } from "luxon";
25
17
  import { useCalendarState, useDatePickerState } from "react-stately";
26
18
  //#region src/components/inputs/DateTime/DatePicker/DatePicker.tsx
27
- var DATE_PICKER_TIME_ZONE = "UTC";
28
19
  var DatePickerBase = (props) => {
29
20
  const ui = UIConfig.useConfig();
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;
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;
46
22
  const normalizeByGranularity = useCallback((date) => {
47
23
  if (granularity === "year") return date.set({
48
24
  month: 1,
@@ -68,42 +44,33 @@ var DatePickerBase = (props) => {
68
44
  const datePickerRef = useMemo(() => ({ get current() {
69
45
  return datePickerInputRef.current?.getContainer?.() || null;
70
46
  } }), []);
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;
47
+ useImperativeHandle(ref, () => ({ clear: () => {
48
+ datePickerInputRef.current?.clear();
49
+ } }));
82
50
  const dialogState = useDatePickerState({
83
51
  ...rest,
84
- defaultValue: normalizedValue ?? rest.defaultValue ?? null,
52
+ defaultValue: value || rest.defaultValue,
85
53
  shouldCloseOnSelect: false,
86
54
  shouldForceLeadingZeros
87
55
  });
88
56
  const state = useDatePickerState({
89
57
  ...rest,
90
58
  shouldForceLeadingZeros,
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)) {
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)) {
96
64
  state.setValue(state.value);
97
65
  return;
98
66
  }
99
- onChange?.(normalizedValue_0);
100
- dialogState.setValue(normalizedValue_0);
101
- if (fireBlurOnChange) debouncedBlur(normalizedValue_0);
102
- if (normalizedValue_0) {
103
- calendarState.setFocusedDate(normalizedValue_0);
67
+ onChange?.(normalizedValue);
68
+ dialogState.setValue(normalizedValue);
69
+ if (normalizedValue) {
70
+ calendarState.setFocusedDate(normalizedValue);
104
71
  return;
105
72
  }
106
- calendarState.setFocusedDate(today(DATE_PICKER_TIME_ZONE));
73
+ calendarState.setFocusedDate(today(getLocalTimeZone()));
107
74
  },
108
75
  shouldCloseOnSelect: false
109
76
  });
@@ -135,14 +102,13 @@ var DatePickerBase = (props) => {
135
102
  labelProps
136
103
  };
137
104
  const onApply = () => {
138
- const newValue = dialogState.value ? normalizeByGranularity(dialogState.value) : dialogState.value;
139
- state.setValue(newValue);
105
+ if (dialogState.value) state.setValue(normalizeByGranularity(dialogState.value));
106
+ if (!dialogState.value) state.setValue(dialogState.value);
140
107
  state.toggle();
141
- if (fireBlurOnChange) handleBlur(newValue);
142
108
  };
143
109
  const onMonthYearChange = (selectedDate) => {
144
110
  if (!(shouldUpdateDateOnMonthYearChange || granularity !== "day")) return;
145
- const updatedDate = normalizeByGranularity((dialogState.value || state.value || today(DATE_PICKER_TIME_ZONE)).set({
111
+ const updatedDate = normalizeByGranularity((dialogState.value || state.value || today(getLocalTimeZone())).set({
146
112
  year: selectedDate.year,
147
113
  month: selectedDate.month
148
114
  }));
@@ -153,18 +119,15 @@ var DatePickerBase = (props) => {
153
119
  onApply();
154
120
  };
155
121
  const onTodayPress = () => {
156
- const todayValue = normalizeByGranularity(today(DATE_PICKER_TIME_ZONE));
122
+ const todayValue = normalizeByGranularity(today(getLocalTimeZone()));
157
123
  dialogState.setValue(todayValue);
158
124
  calendarState.setFocusedDate(todayValue);
159
125
  };
160
- const onInputClear = () => {
161
- onChange?.(null);
162
- };
163
126
  useEffect(() => {
164
127
  if (!state.isOpen) return;
165
128
  if (granularity !== "year") return;
166
129
  if (dialogState.value) return;
167
- const defaultYearValue = normalizeByGranularity(today(DATE_PICKER_TIME_ZONE));
130
+ const defaultYearValue = normalizeByGranularity(today(getLocalTimeZone()));
168
131
  dialogState.setValue(defaultYearValue);
169
132
  calendarState.setFocusedDate(defaultYearValue);
170
133
  }, [
@@ -178,7 +141,7 @@ var DatePickerBase = (props) => {
178
141
  const onOpenChange = (isOpen) => {
179
142
  state.toggle();
180
143
  if (state.value) calendarState.setFocusedDate(normalizeByGranularity(state.value));
181
- if (!state.value) calendarState.setFocusedDate(today(DATE_PICKER_TIME_ZONE));
144
+ if (!state.value) calendarState.setFocusedDate(today(getLocalTimeZone()));
182
145
  if (!isOpen) dialogState.setValue(state.value);
183
146
  };
184
147
  return /* @__PURE__ */ jsx(TooltipWrapper, {
@@ -195,21 +158,11 @@ var DatePickerBase = (props) => {
195
158
  ref: mergeRefs(ref, datePickerInputRef),
196
159
  as,
197
160
  groupProps,
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,
161
+ fieldProps,
208
162
  buttonProps,
209
163
  isDirty,
210
164
  isDisabled,
211
165
  disableManualEntry,
212
- autoFixYear,
213
166
  isInvalid: !!error,
214
167
  disableDropdown,
215
168
  variant,
@@ -217,18 +170,13 @@ var DatePickerBase = (props) => {
217
170
  isClearable,
218
171
  headerProps,
219
172
  todayIcon,
220
- todayIconButtonSize,
221
- todayIconButtonComponent,
222
- todayIconPlacement,
223
173
  onOpenDropdown: () => state.toggle(),
224
174
  placeholder,
225
175
  className: inputClassName,
226
176
  dateGranularity: granularity,
227
- format,
228
- timeZone: DATE_PICKER_TIME_ZONE,
229
- fireBlurOnChange,
230
- onClear: onInputClear
231
- }), (!disableDropdown || disableManualEntry) && state.isOpen && /* @__PURE__ */ jsx(DateTimeDialog, {
177
+ autoFixYear,
178
+ format
179
+ }), (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(DateTimeDialog, {
232
180
  footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
233
181
  isDisabled,
234
182
  isValid: !dialogState.isInvalid && !!dialogState.value,
@@ -253,298 +201,57 @@ var DatePickerBase = (props) => {
253
201
  })
254
202
  });
255
203
  };
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
354
- });
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
- contentGroup: "date-picker",
375
- labelPlacement: "content-row",
376
- dataAttributes: {
377
- dataIsEmpty: dateValue == null,
378
- dataIsFilled: dateValue != null,
379
- dataIsDirty: props.isDirty,
380
- dataIsRequired: props.isRequired,
381
- dataIsDisabled: isDisabled,
382
- dataDisabled: isDisabled,
383
- dataInvalid: !!props.error,
384
- dataHasSelection: dateValue != null
385
- },
386
- renderStatic: true,
387
- onStaticInteract: renderRealInput,
388
- actionContent: staticTodayIcon,
389
- actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
390
- showClear: dateValue != null,
391
- wrapContentAndTrailing: true,
392
- contentAndTrailingClassName: "gap-2!",
393
- trailingClassName: "py-0! pl-0!",
394
- action: showDropdown ? {
395
- icon: ui.dateInput.calendarIcon,
396
- onClick: _temp2,
397
- altText: ""
398
- } : void 0,
399
- children: staticSegments
400
- });
401
- }
402
- const T0 = DatePickerBase;
403
- const t9 = mergeRefs(props.ref, inputRef);
404
- const t10 = parseCalendarDate(normalizedValue);
405
- let t11;
406
- if ($[17] !== formatCalendarDate || $[18] !== props) {
407
- t11 = (value) => props.onChange?.(formatCalendarDate(value));
408
- $[17] = formatCalendarDate;
409
- $[18] = props;
410
- $[19] = t11;
411
- } else t11 = $[19];
412
- let t12;
413
- if ($[20] !== T0 || $[21] !== dateLimits || $[22] !== granularity || $[23] !== props || $[24] !== t10 || $[25] !== t11 || $[26] !== t9) {
414
- t12 = /* @__PURE__ */ jsx(T0, {
415
- ...props,
416
- ...dateLimits,
417
- ref: t9,
418
- granularity,
419
- value: t10,
420
- onChange: t11
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
421
209
  });
422
- $[20] = T0;
423
- $[21] = dateLimits;
424
- $[22] = granularity;
425
- $[23] = props;
426
- $[24] = t10;
427
- $[25] = t11;
428
- $[26] = t9;
429
- $[27] = t12;
430
- } else t12 = $[27];
431
- return t12;
432
- };
433
- var DatePicker = (t0) => {
434
- const $ = c(33);
435
- let maxValue;
436
- let minValue;
437
- let props;
438
- let renderStaticInput;
439
- let t1;
440
- let t2;
441
- if ($[0] !== t0) {
442
- ({fullIso: t1, granularity: t2, minValue, maxValue, renderStaticInput, ...props} = t0);
443
- $[0] = t0;
444
- $[1] = maxValue;
445
- $[2] = minValue;
446
- $[3] = props;
447
- $[4] = renderStaticInput;
448
- $[5] = t1;
449
- $[6] = t2;
450
- } else {
451
- maxValue = $[1];
452
- minValue = $[2];
453
- props = $[3];
454
- renderStaticInput = $[4];
455
- t1 = $[5];
456
- t2 = $[6];
457
- }
458
- const fullIso = t1 === void 0 ? true : t1;
459
- const granularity = t2 === void 0 ? "day" : t2;
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
+ };
460
230
  if ("formControl" in props && props.formControl) {
461
- let formControl;
462
- let innerProps;
463
- let ref;
464
- if ($[7] !== props) {
465
- ({formControl, ref, ...innerProps} = props);
466
- $[7] = props;
467
- $[8] = formControl;
468
- $[9] = innerProps;
469
- $[10] = ref;
470
- } else {
471
- formControl = $[8];
472
- innerProps = $[9];
473
- ref = $[10];
474
- }
475
- const controlWithOptions = formControl.control;
476
- let t3;
477
- 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) {
478
- t3 = (t4) => {
479
- const { field, fieldState: t5 } = t4;
480
- const { error, isDirty } = t5;
481
- return /* @__PURE__ */ jsx(DatePickerInner, {
482
- ...innerProps,
483
- ref: mergeRefs(ref, field.ref),
484
- value: field.value ?? null,
485
- onChange: field.onChange,
486
- onBlur: field.onBlur,
487
- isDirty,
488
- isDisabled: field.disabled || props.isDisabled,
489
- isFormControlDisabled: !!controlWithOptions._options?.disabled,
490
- error: props.error ?? error?.message,
491
- fullIso,
492
- granularity,
493
- minValue,
494
- maxValue,
495
- renderStaticInput
496
- });
497
- };
498
- $[11] = controlWithOptions._options?.disabled;
499
- $[12] = fullIso;
500
- $[13] = granularity;
501
- $[14] = innerProps;
502
- $[15] = maxValue;
503
- $[16] = minValue;
504
- $[17] = props.error;
505
- $[18] = props.isDisabled;
506
- $[19] = ref;
507
- $[20] = renderStaticInput;
508
- $[21] = t3;
509
- } else t3 = $[21];
510
- let t4;
511
- if ($[22] !== formControl.control || $[23] !== formControl.name || $[24] !== t3) {
512
- t4 = /* @__PURE__ */ jsx(Controller, {
513
- control: formControl.control,
514
- name: formControl.name,
515
- render: t3
516
- });
517
- $[22] = formControl.control;
518
- $[23] = formControl.name;
519
- $[24] = t3;
520
- $[25] = t4;
521
- } else t4 = $[25];
522
- return t4;
523
- }
524
- let t3;
525
- if ($[26] !== fullIso || $[27] !== granularity || $[28] !== maxValue || $[29] !== minValue || $[30] !== props || $[31] !== renderStaticInput) {
526
- t3 = /* @__PURE__ */ jsx(DatePickerInner, {
527
- ...props,
528
- fullIso,
529
- granularity,
530
- minValue,
531
- maxValue,
532
- renderStaticInput
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
+ })
533
246
  });
534
- $[26] = fullIso;
535
- $[27] = granularity;
536
- $[28] = maxValue;
537
- $[29] = minValue;
538
- $[30] = props;
539
- $[31] = renderStaticInput;
540
- $[32] = t3;
541
- } else t3 = $[32];
542
- return t3;
247
+ }
248
+ return /* @__PURE__ */ jsx(DatePickerBase, {
249
+ ...props,
250
+ ...dateLimits,
251
+ granularity,
252
+ value: parseCalendarDate(props.value),
253
+ onChange: (value) => props.onChange?.(formatCalendarDate(value))
254
+ });
543
255
  };
544
- function _temp(input) {
545
- const container = input.getContainer?.() ?? input;
546
- return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
547
- }
548
- function _temp2() {}
549
256
  //#endregion
550
257
  export { DatePicker };
@@ -1,30 +1,24 @@
1
1
  import { CalendarDate } from '@internationalized/date';
2
- import { FocusEvent, Ref } from 'react';
2
+ import { 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';
8
7
  import { FormFieldProps } from '../../FormField/FormField';
9
8
  import { ControlProps } from '../../shared/form.types';
10
9
  import { InputVariantProps } from '../../shared/input.cva';
11
- interface DateRangePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<DateRangePickerStateOptions<CalendarDate>, "granularity" | "shouldCloseOnSelect" | "label" | "onBlur"> {
10
+ interface DateRangePickerBaseProps extends FormFieldProps, InputVariantProps, Omit<DateRangePickerStateOptions<CalendarDate>, "granularity" | "shouldCloseOnSelect" | "label"> {
12
11
  ref?: Ref<DatePickerInputHandle & HTMLDivElement>;
13
12
  disableDropdown?: boolean;
14
13
  isClearable?: boolean;
15
14
  hideSidebar?: boolean;
16
15
  className?: string;
17
- todayIcon?: DatePickerTodayIcon;
18
- todayIconButtonSize?: DatePickerTodayIconButtonSize;
19
- todayIconButtonComponent?: DatePickerTodayIconButtonComponent;
20
- todayIconPlacement?: DatePickerTodayIconPlacement;
16
+ todayIcon?: boolean;
21
17
  isDirty?: boolean;
22
18
  disableManualEntry?: boolean;
23
- autoFixYear?: boolean;
24
19
  placeholder?: string;
25
20
  inputClassName?: string;
26
- onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
27
- fireBlurOnChange?: boolean;
21
+ autoFixYear?: boolean;
28
22
  }
29
23
  export interface DateRangePickerProps extends Omit<DateRangePickerBaseProps, "value" | "onChange" | "minValue" | "maxValue"> {
30
24
  value?: {
@@ -38,8 +32,7 @@ export interface DateRangePickerProps extends Omit<DateRangePickerBaseProps, "va
38
32
  fullIso?: boolean;
39
33
  minValue?: DateValue | string;
40
34
  maxValue?: DateValue | string;
41
- renderStaticInput?: boolean;
42
35
  }
43
36
  export type ControlledDateRangePickerProps<TFieldValues extends FieldValues> = ControlProps<DateRangePickerProps, TFieldValues>;
44
- export declare const DateRangePicker: <TFieldValues extends FieldValues>({ fullIso, minValue, maxValue, renderStaticInput, ...props }: ControlledDateRangePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
37
+ export declare const DateRangePicker: <TFieldValues extends FieldValues>({ fullIso, minValue, maxValue, ...props }: ControlledDateRangePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
45
38
  export {};