@povio/ui 2.2.12 → 2.3.0-rc.10

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 +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.js +172 -35
  62. package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +24 -10
  63. package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +3 -0
  64. package/dist/components/inputs/Checkbox/checkbox.cva.js +2 -1
  65. package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +10 -5
  66. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +121 -20
  67. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +10 -5
  68. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +215 -111
  69. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +11 -5
  70. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +123 -19
  71. package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +5 -3
  72. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +448 -104
  73. package/dist/components/inputs/DateTime/shared/Calendar.d.ts +5 -2
  74. package/dist/components/inputs/DateTime/shared/Calendar.js +330 -119
  75. package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +1 -1
  76. package/dist/components/inputs/DateTime/shared/CalendarCell.js +283 -102
  77. package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +1 -1
  78. package/dist/components/inputs/DateTime/shared/CalendarGrid.js +142 -33
  79. package/dist/components/inputs/DateTime/shared/CalendarHeader.js +249 -93
  80. package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
  81. package/dist/components/inputs/DateTime/shared/DateField.js +296 -112
  82. package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +6 -3
  83. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +355 -135
  84. package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +14 -0
  85. package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +97 -11
  86. package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +81 -27
  87. package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +59 -10
  88. package/dist/components/inputs/DateTime/shared/MonthPicker.js +103 -58
  89. package/dist/components/inputs/DateTime/shared/RangeCalendar.js +193 -82
  90. package/dist/components/inputs/DateTime/shared/TimeField.js +27 -8
  91. package/dist/components/inputs/DateTime/shared/TimePickerForm.js +279 -110
  92. package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +2 -1
  93. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +207 -65
  94. package/dist/components/inputs/DateTime/shared/YearPicker.js +119 -68
  95. package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +4 -0
  96. package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +7 -0
  97. package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +13 -0
  98. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +6 -0
  99. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +21 -0
  100. package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +2 -0
  101. package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +1 -0
  102. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +31 -0
  103. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +80 -0
  104. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +1 -0
  105. package/dist/components/inputs/File/FileUpload.js +87 -44
  106. package/dist/components/inputs/File/FileUploadContainer.js +15 -7
  107. package/dist/components/inputs/File/InputUpload.js +317 -79
  108. package/dist/components/inputs/File/shared/FileCard.js +104 -41
  109. package/dist/components/inputs/File/shared/FileCardList.js +47 -12
  110. package/dist/components/inputs/File/shared/FileUploadContent.js +175 -44
  111. package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +149 -46
  112. package/dist/components/inputs/File/shared/FileUploadContentError.js +234 -93
  113. package/dist/components/inputs/File/shared/FileUploadContentFilled.js +230 -97
  114. package/dist/components/inputs/File/shared/FileUploadContentLoading.js +199 -55
  115. package/dist/components/inputs/File/shared/InputUploadContent.js +148 -34
  116. package/dist/components/inputs/File/shared/InputUploadFilled.js +49 -8
  117. package/dist/components/inputs/File/shared/ProgressBar.js +48 -9
  118. package/dist/components/inputs/FormField/FormField.d.ts +3 -3
  119. package/dist/components/inputs/FormField/FormField.js +119 -37
  120. package/dist/components/inputs/FormField/FormFieldError.js +25 -5
  121. package/dist/components/inputs/FormField/FormFieldHeader.d.ts +2 -2
  122. package/dist/components/inputs/FormField/FormFieldHeader.js +81 -22
  123. package/dist/components/inputs/FormField/FormFieldHeaderClose.js +31 -7
  124. package/dist/components/inputs/FormField/FormFieldHelper.js +26 -6
  125. package/dist/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
  126. package/dist/components/inputs/FormField/FormFieldLabel.js +40 -9
  127. package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +6 -0
  128. package/dist/components/inputs/FormField/formFieldHeader.cva.js +11 -0
  129. package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +5 -2
  130. package/dist/components/inputs/Input/NumberInput/NumberInput.js +332 -81
  131. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.d.ts +45 -0
  132. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +571 -0
  133. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +35 -0
  134. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +479 -0
  135. package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +48 -9
  136. package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +4 -0
  137. package/dist/components/inputs/Input/TextArea/TextArea.cva.js +5 -0
  138. package/dist/components/inputs/Input/TextArea/TextArea.js +305 -90
  139. package/dist/components/inputs/Input/TextInput/TextInput.d.ts +3 -1
  140. package/dist/components/inputs/Input/TextInput/TextInput.js +321 -80
  141. package/dist/components/inputs/Input/shared/InputContent.js +192 -59
  142. package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +1 -0
  143. package/dist/components/inputs/Input/shared/numberStatic.utils.js +7 -0
  144. package/dist/components/inputs/Inputs/Form.js +40 -11
  145. package/dist/components/inputs/Inputs/InputItem.d.ts +15 -21
  146. package/dist/components/inputs/Inputs/InputItem.js +69 -14
  147. package/dist/components/inputs/Inputs/Inputs.js +37 -11
  148. package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +2 -1
  149. package/dist/components/inputs/RadioGroup/RadioGroup.js +352 -60
  150. package/dist/components/inputs/RadioGroup/radio.cva.d.ts +17 -0
  151. package/dist/components/inputs/RadioGroup/radio.cva.js +42 -1
  152. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +6 -2
  153. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +109 -7
  154. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +3 -18
  155. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +34 -8
  156. package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +36 -0
  157. package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +14 -0
  158. package/dist/components/inputs/Selection/Select/QuerySelect.js +122 -0
  159. package/dist/components/inputs/Selection/Select/Select.d.ts +7 -3
  160. package/dist/components/inputs/Selection/Select/Select.js +132 -5
  161. package/dist/components/inputs/Selection/shared/SelectBase.d.ts +8 -1
  162. package/dist/components/inputs/Selection/shared/SelectBase.js +69 -18
  163. package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
  164. package/dist/components/inputs/Selection/shared/SelectDesktop.js +393 -138
  165. package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
  166. package/dist/components/inputs/Selection/shared/SelectInput.js +337 -115
  167. package/dist/components/inputs/Selection/shared/SelectInputTags.js +99 -25
  168. package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
  169. package/dist/components/inputs/Selection/shared/SelectListBox.js +164 -52
  170. package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +85 -35
  171. package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +69 -16
  172. package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +70 -21
  173. package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +58 -9
  174. package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
  175. package/dist/components/inputs/Selection/shared/SelectMobile.js +9 -3
  176. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +9 -0
  177. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +47 -0
  178. package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +6 -0
  179. package/dist/components/inputs/Selection/shared/querySelect.utils.js +13 -0
  180. package/dist/components/inputs/Selection/shared/select.context.d.ts +3 -2
  181. package/dist/components/inputs/Selection/shared/select.context.js +57 -34
  182. package/dist/components/inputs/Selection/shared/select.types.d.ts +3 -2
  183. package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +3 -0
  184. package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +5 -0
  185. package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +5 -0
  186. package/dist/components/inputs/Selection/shared/selectInput.cva.js +5 -0
  187. package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +23 -0
  188. package/dist/components/inputs/Selection/shared/staticSelect.utils.js +37 -0
  189. package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +1 -0
  190. package/dist/components/inputs/Selection/shared/useSelectItems.js +109 -49
  191. package/dist/components/inputs/Skeleton/InputFrame.d.ts +79 -0
  192. package/dist/components/inputs/Skeleton/InputFrame.js +526 -0
  193. package/dist/components/inputs/Slider/Slider.js +250 -74
  194. package/dist/components/inputs/TextEditor/TextEditor.d.ts +1 -0
  195. package/dist/components/inputs/TextEditor/TextEditor.js +447 -98
  196. package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +37 -11
  197. package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +102 -30
  198. package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +194 -45
  199. package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +88 -28
  200. package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +48 -14
  201. package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +66 -19
  202. package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +49 -15
  203. package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +92 -32
  204. package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +126 -54
  205. package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +141 -38
  206. package/dist/components/inputs/Toggle/Toggle.js +189 -37
  207. package/dist/components/inputs/Toggle/toggle.cva.d.ts +3 -0
  208. package/dist/components/inputs/Toggle/toggle.cva.js +2 -1
  209. package/dist/components/inputs/shared/CheckContent.d.ts +2 -1
  210. package/dist/components/inputs/shared/CheckContent.js +21 -11
  211. package/dist/components/inputs/shared/InputClear.d.ts +2 -1
  212. package/dist/components/inputs/shared/InputClear.js +79 -10
  213. package/dist/components/inputs/shared/StaticInput.d.ts +38 -0
  214. package/dist/components/inputs/shared/TooltipWrapper.js +50 -11
  215. package/dist/components/inputs/shared/input.cva.d.ts +10 -0
  216. package/dist/components/inputs/shared/input.cva.js +32 -4
  217. package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +4 -0
  218. package/dist/components/inputs/shared/tooltipWrapper.cva.js +5 -0
  219. package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +14 -0
  220. package/dist/components/inputs/shared/useStaticInputHandoff.js +100 -0
  221. package/dist/components/navigation/Accordion/Accordion.js +69 -22
  222. package/dist/components/navigation/Accordion/AccordionItem.js +86 -41
  223. package/dist/components/navigation/Stepper/Stepper.js +67 -22
  224. package/dist/components/navigation/Stepper/StepperItem.js +104 -31
  225. package/dist/components/navigation/Stepper/StepperSeparator.js +23 -5
  226. package/dist/components/overlays/ActionModal/ActionModal.js +169 -35
  227. package/dist/components/overlays/BottomSheet/BottomSheet.js +96 -23
  228. package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +48 -8
  229. package/dist/components/overlays/Drawer/Drawer.js +62 -20
  230. package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +83 -27
  231. package/dist/components/overlays/Tooltip/Tooltip.js +137 -28
  232. package/dist/components/overlays/Tooltip/TooltipEllipsis.js +37 -12
  233. package/dist/components/segment/Segment.js +218 -57
  234. package/dist/components/segment/SegmentItem.js +67 -10
  235. package/dist/components/shared/pagination/Pagination.js +108 -22
  236. package/dist/components/shared/pagination/PaginationList.js +167 -64
  237. package/dist/components/status/Alert/Alert.js +97 -30
  238. package/dist/components/status/Loader/Loader.js +77 -22
  239. package/dist/components/status/Toast/Toast.js +21 -13
  240. package/dist/components/status/Toast/useToast.js +62 -57
  241. package/dist/components/table/ColumnConfig.js +158 -54
  242. package/dist/components/table/InfiniteTable.js +67 -16
  243. package/dist/components/table/PaginatedTable.js +84 -18
  244. package/dist/components/table/Table.js +28 -27
  245. package/dist/components/text/Link/Link.js +19 -7
  246. package/dist/components/text/Typography/Typography.js +23 -8
  247. package/dist/config/confirmation.context.js +1 -1
  248. package/dist/config/link.context.js +23 -9
  249. package/dist/config/router.context.d.ts +3 -4
  250. package/dist/config/router.context.js +42 -18
  251. package/dist/config/theme.context.js +98 -45
  252. package/dist/config/uiConfig.context.d.ts +15 -3
  253. package/dist/config/uiConfig.context.js +55 -11
  254. package/dist/config/uiStyle.context.d.ts +27 -4
  255. package/dist/config/uiStyle.context.js +15 -5
  256. package/dist/helpers/dynamicInputs.d.ts +5 -5
  257. package/dist/helpers/dynamicInputs.js +3 -0
  258. package/dist/hooks/useBreakpoint.js +16 -3
  259. package/dist/hooks/useDebounceCallback.js +51 -17
  260. package/dist/hooks/useFilters.js +145 -80
  261. package/dist/hooks/useForm.js +42 -8
  262. package/dist/hooks/useFormAutosave.js +101 -30
  263. package/dist/hooks/useIntersectionObserver.d.ts +1 -1
  264. package/dist/hooks/useIntersectionObserver.js +91 -24
  265. package/dist/hooks/useLocalStorage.js +43 -10
  266. package/dist/hooks/useLongPressRepeat.js +55 -20
  267. package/dist/hooks/usePagination.js +51 -17
  268. package/dist/hooks/useQueryAutocomplete.d.ts +14 -0
  269. package/dist/hooks/useQueryAutocomplete.js +57 -0
  270. package/dist/hooks/useScrollableListBox.js +37 -16
  271. package/dist/hooks/useSorting.js +71 -27
  272. package/dist/hooks/useStateAndRef.js +21 -7
  273. package/dist/hooks/useTableColumnConfig.js +124 -31
  274. package/dist/hooks/useTranslationMemo.js +25 -5
  275. package/dist/index.d.ts +7 -0
  276. package/dist/index.js +5 -3
  277. package/dist/tw-ui-plugin.js +2 -0
  278. package/dist/utils/date-time.utils.d.ts +31 -10
  279. package/dist/utils/date-time.utils.js +117 -22
  280. package/dist/utils/query.utils.d.ts +4 -0
  281. package/dist/utils/query.utils.js +8 -0
  282. package/dist/utils/routing.utils.d.ts +1 -0
  283. package/dist/utils/routing.utils.js +14 -0
  284. package/package.json +2 -2
@@ -1,25 +1,29 @@
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;
24
28
  }
25
29
  export interface DatePickerProps extends Omit<DatePickerBaseProps, "value" | "onChange" | "minValue" | "maxValue"> {
@@ -28,7 +32,8 @@ export interface DatePickerProps extends Omit<DatePickerBaseProps, "value" | "on
28
32
  fullIso?: boolean;
29
33
  minValue?: DateValue | string;
30
34
  maxValue?: DateValue | string;
35
+ renderStaticInput?: boolean;
31
36
  }
32
37
  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;
38
+ export declare const DatePicker: <TFieldValues extends FieldValues>({ fullIso, granularity, minValue, maxValue, renderStaticInput, ...props }: ControlledDatePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
34
39
  export {};
@@ -1,24 +1,44 @@
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";
9
16
  import { jsx, jsxs } from "react/jsx-runtime";
10
17
  import { clsx } from "clsx";
11
- import { useCallback, useEffect, useImperativeHandle, useMemo, useRef } from "react";
18
+ import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
12
19
  import { useDatePicker, useLocale } from "react-aria";
13
20
  import { mergeRefs } from "@react-aria/utils";
14
- import { Controller } from "react-hook-form";
21
+ import { Controller, useWatch } from "react-hook-form";
15
22
  import { createCalendar, getLocalTimeZone, toCalendarDate, today } from "@internationalized/date";
16
23
  import { DateTime } from "luxon";
17
24
  import { useCalendarState, useDatePickerState } from "react-stately";
18
25
  //#region src/components/inputs/DateTime/DatePicker/DatePicker.tsx
19
26
  var DatePickerBase = (props) => {
20
27
  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;
28
+ 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, format, ...rest } = props;
29
+ const as = asProp ?? ui.input.as;
30
+ const hideLabel = hideLabelProp ?? ui.input.hideLabel;
31
+ const variant = variantProp ?? ui.input.variant;
32
+ const size = sizeProp ?? ui.input.size;
33
+ const isClearable = isClearableProp ?? ui.input.isClearable;
34
+ const todayIcon = todayIconProp ?? ui.dateInput.todayIcon;
35
+ const todayIconButtonSize = todayIconButtonSizeProp ?? ui.dateInput.todayIconButtonSize;
36
+ const todayIconPlacement = todayIconPlacementProp ?? ui.dateInput.todayIconPlacement;
37
+ const shouldForceLeadingZeros = shouldForceLeadingZerosProp ?? ui.dateInput.shouldForceLeadingZeros;
38
+ const disableManualEntry = disableManualEntryProp ?? ui.dateInput.disableManualEntry;
39
+ const shouldUpdateDateOnMonthYearChange = shouldUpdateDateOnMonthYearChangeProp ?? ui.dateInput.shouldUpdateDateOnMonthYearChange;
40
+ const granularity = granularityProp ?? ui.dateInput.granularity;
41
+ const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
22
42
  const normalizeByGranularity = useCallback((date) => {
23
43
  if (granularity === "year") return date.set({
24
44
  month: 1,
@@ -44,9 +64,16 @@ var DatePickerBase = (props) => {
44
64
  const datePickerRef = useMemo(() => ({ get current() {
45
65
  return datePickerInputRef.current?.getContainer?.() || null;
46
66
  } }), []);
47
- useImperativeHandle(ref, () => ({ clear: () => {
48
- datePickerInputRef.current?.clear();
49
- } }));
67
+ useImperativeHandle(ref, () => ({
68
+ clear: () => {
69
+ datePickerInputRef.current?.clear();
70
+ },
71
+ getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
72
+ }));
73
+ const handleBlur = (val) => {
74
+ onBlur?.({ target: { value: val } });
75
+ };
76
+ const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
50
77
  const dialogState = useDatePickerState({
51
78
  ...rest,
52
79
  defaultValue: value || rest.defaultValue,
@@ -57,15 +84,16 @@ var DatePickerBase = (props) => {
57
84
  ...rest,
58
85
  shouldForceLeadingZeros,
59
86
  value,
60
- onChange: (val) => {
61
- let normalizedValue = val;
62
- if (val) normalizedValue = normalizeByGranularity(val);
87
+ onChange: (val_0) => {
88
+ let normalizedValue = val_0;
89
+ if (val_0) normalizedValue = normalizeByGranularity(val_0);
63
90
  if (normalizedValue && (rest.minValue && normalizedValue < rest?.minValue || rest?.maxValue && normalizedValue > rest?.maxValue)) {
64
91
  state.setValue(state.value);
65
92
  return;
66
93
  }
67
94
  onChange?.(normalizedValue);
68
95
  dialogState.setValue(normalizedValue);
96
+ debouncedBlur(normalizedValue);
69
97
  if (normalizedValue) {
70
98
  calendarState.setFocusedDate(normalizedValue);
71
99
  return;
@@ -102,9 +130,10 @@ var DatePickerBase = (props) => {
102
130
  labelProps
103
131
  };
104
132
  const onApply = () => {
105
- if (dialogState.value) state.setValue(normalizeByGranularity(dialogState.value));
106
- if (!dialogState.value) state.setValue(dialogState.value);
133
+ const newValue = dialogState.value ? normalizeByGranularity(dialogState.value) : dialogState.value;
134
+ state.setValue(newValue);
107
135
  state.toggle();
136
+ handleBlur(newValue);
108
137
  };
109
138
  const onMonthYearChange = (selectedDate) => {
110
139
  if (!(shouldUpdateDateOnMonthYearChange || granularity !== "day")) return;
@@ -163,6 +192,7 @@ var DatePickerBase = (props) => {
163
192
  isDirty,
164
193
  isDisabled,
165
194
  disableManualEntry,
195
+ autoFixYear,
166
196
  isInvalid: !!error,
167
197
  disableDropdown,
168
198
  variant,
@@ -170,13 +200,14 @@ var DatePickerBase = (props) => {
170
200
  isClearable,
171
201
  headerProps,
172
202
  todayIcon,
203
+ todayIconButtonSize,
204
+ todayIconPlacement,
173
205
  onOpenDropdown: () => state.toggle(),
174
206
  placeholder,
175
207
  className: inputClassName,
176
208
  dateGranularity: granularity,
177
- autoFixYear,
178
209
  format
179
- }), (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(DateTimeDialog, {
210
+ }), (!disableDropdown || disableManualEntry) && state.isOpen && /* @__PURE__ */ jsx(DateTimeDialog, {
180
211
  footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
181
212
  isDisabled,
182
213
  isValid: !dialogState.isInvalid && !!dialogState.value,
@@ -201,7 +232,29 @@ var DatePickerBase = (props) => {
201
232
  })
202
233
  });
203
234
  };
204
- var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ...props }) => {
235
+ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, renderStaticInput, ...props }) => {
236
+ const ui = UIConfig.useConfig();
237
+ const datePickerInputContentRowCva = UIStyle.useCva("datePickerInput.contentRowCva", datePickerInputContentRow);
238
+ const { locale } = useLocale();
239
+ const shouldForceLeadingZeros = props.shouldForceLeadingZeros ?? ui.dateInput.shouldForceLeadingZeros;
240
+ const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
241
+ const inputRef = useRef(null);
242
+ const { renderRealInput } = useStaticInputHandoff({
243
+ inputRef,
244
+ renderInput,
245
+ setRenderInput,
246
+ getFocusTarget: (input) => {
247
+ const container = input.getContainer?.() ?? input;
248
+ return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
249
+ }
250
+ });
251
+ const watchedValue = "formControl" in props && props.formControl ? useWatch({
252
+ control: props.formControl.control,
253
+ name: props.formControl.name
254
+ }) : props.value;
255
+ let isFormControlDisabled = false;
256
+ if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
257
+ const rawValue = watchedValue ?? props.value ?? null;
205
258
  const normalizeByGranularity = (date) => {
206
259
  if (granularity === "year") return date.set({
207
260
  month: 1,
@@ -214,19 +267,66 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ...
214
267
  if (calendarDate === null) return null;
215
268
  const normalizedDate = normalizeByGranularity(calendarDate);
216
269
  if (fullIso) return DateTimeUtils.fromCalendarDateToUTCISO(normalizedDate);
217
- const date = DateTimeUtils.fromDateValueToLocal(normalizedDate);
218
- return DateTime.fromJSDate(date).toISODate();
270
+ const date_0 = DateTimeUtils.fromDateValueToLocal(normalizedDate);
271
+ return DateTime.fromJSDate(date_0).toISODate();
219
272
  };
220
273
  const parseCalendarDate = (formattedDate) => {
221
274
  if (formattedDate == null) return formattedDate;
222
275
  if (fullIso) return normalizeByGranularity(DateTimeUtils.fromUTCISOToCalendarDate(formattedDate));
223
- const date = DateTime.fromISO(formattedDate).toJSDate();
224
- return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date)));
276
+ const date_1 = DateTime.fromISO(formattedDate).toJSDate();
277
+ return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date_1)));
225
278
  };
226
279
  const dateLimits = {
227
280
  minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
228
281
  maxValue: typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue
229
282
  };
283
+ if (!renderInput) {
284
+ const dateValue = rawValue ? parseCalendarDate(rawValue) : null;
285
+ const as = props.as ?? ui.input.as;
286
+ const size = props.size ?? ui.input.size;
287
+ const isDisabled = isFormControlDisabled || !!props.isDisabled;
288
+ const todayIcon = props.todayIcon ?? ui.dateInput.todayIcon;
289
+ const todayIconButtonSize = props.todayIconButtonSize ?? ui.dateInput.todayIconButtonSize;
290
+ const todayIconPlacement = props.todayIconPlacement ?? ui.dateInput.todayIconPlacement;
291
+ const staticTodayIcon = renderDatePickerTodayIcon(todayIcon, todayIconButtonSize);
292
+ const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
293
+ const showDropdown = !props.disableDropdown || disableManualEntry;
294
+ const staticSegments = getStaticCalendarDateSegments({
295
+ value: dateValue,
296
+ locale,
297
+ shouldForceLeadingZeros,
298
+ isDisabled,
299
+ hidePlaceholder: as === "floating" && !dateValue
300
+ });
301
+ return /* @__PURE__ */ jsx(InputFrame, {
302
+ ...props,
303
+ isDisabled,
304
+ className: clsx("relative inline-flex w-full flex-col text-left", props.className),
305
+ inputClassName: clsx("min-w-input-width-min-width", props.inputClassName),
306
+ contentClassName: "pr-0!",
307
+ contentWrapperClassName: datePickerInputContentRowCva({ size }),
308
+ labelPlacement: "content-row",
309
+ dataAttributes: {
310
+ dataIsEmpty: dateValue === null,
311
+ dataIsFilled: dateValue !== null,
312
+ dataIsDirty: props.isDirty,
313
+ dataIsRequired: props.isRequired,
314
+ dataIsDisabled: isDisabled,
315
+ dataDisabled: isDisabled,
316
+ dataInvalid: !!props.error,
317
+ dataHasSelection: dateValue !== null
318
+ },
319
+ renderStatic: true,
320
+ onStaticInteract: renderRealInput,
321
+ actionContent: staticTodayIcon,
322
+ actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
323
+ wrapContentAndTrailing: true,
324
+ contentAndTrailingClassName: "gap-2!",
325
+ trailingClassName: "py-0! pl-0!",
326
+ trailingContent: showDropdown ? ui.dateInput.calendarIcon : void 0,
327
+ children: staticSegments
328
+ });
329
+ }
230
330
  if ("formControl" in props && props.formControl) {
231
331
  const { formControl, ref, ...innerProps } = props;
232
332
  return /* @__PURE__ */ jsx(Controller, {
@@ -235,7 +335,7 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ...
235
335
  render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DatePickerBase, {
236
336
  ...innerProps,
237
337
  ...dateLimits,
238
- ref: mergeRefs(ref, field.ref),
338
+ ref: mergeRefs(ref, field.ref, inputRef),
239
339
  value: parseCalendarDate(field.value),
240
340
  onChange: (value) => field.onChange(formatCalendarDate(value)),
241
341
  onBlur: field.onBlur,
@@ -248,9 +348,10 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ...
248
348
  return /* @__PURE__ */ jsx(DatePickerBase, {
249
349
  ...props,
250
350
  ...dateLimits,
351
+ ref: mergeRefs(props.ref, inputRef),
251
352
  granularity,
252
353
  value: parseCalendarDate(props.value),
253
- onChange: (value) => props.onChange?.(formatCalendarDate(value))
354
+ onChange: (value_0) => props.onChange?.(formatCalendarDate(value_0))
254
355
  });
255
356
  };
256
357
  //#endregion
@@ -1,24 +1,28 @@
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;
22
26
  }
23
27
  export interface DateRangePickerProps extends Omit<DateRangePickerBaseProps, "value" | "onChange" | "minValue" | "maxValue"> {
24
28
  value?: {
@@ -32,7 +36,8 @@ export interface DateRangePickerProps extends Omit<DateRangePickerBaseProps, "va
32
36
  fullIso?: boolean;
33
37
  minValue?: DateValue | string;
34
38
  maxValue?: DateValue | string;
39
+ renderStaticInput?: boolean;
35
40
  }
36
41
  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;
42
+ export declare const DateRangePicker: <TFieldValues extends FieldValues>({ fullIso, minValue, maxValue, renderStaticInput, ...props }: ControlledDateRangePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
38
43
  export {};