@povio/ui 2.3.0-rc.2 → 2.3.0-rc.21

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 (218) 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.js +34 -9
  55. package/dist/components/buttons/PillButton/PillButton.js +55 -17
  56. package/dist/components/buttons/SplitButton/SplitButton.js +103 -18
  57. package/dist/components/buttons/TextButton/TextButton.js +30 -8
  58. package/dist/components/buttons/ToggleButton/ToggleButton.js +28 -8
  59. package/dist/components/buttons/shared/ButtonContent.js +80 -22
  60. package/dist/components/inputs/Checkbox/Checkbox.d.ts +1 -0
  61. package/dist/components/inputs/Checkbox/Checkbox.js +190 -34
  62. package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +24 -10
  63. package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +1 -0
  64. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +258 -76
  65. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -0
  66. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +342 -177
  67. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +1 -0
  68. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +173 -63
  69. package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +1 -0
  70. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +522 -157
  71. package/dist/components/inputs/DateTime/shared/Calendar.js +333 -137
  72. package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +2 -1
  73. package/dist/components/inputs/DateTime/shared/CalendarCell.js +301 -102
  74. package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +2 -1
  75. package/dist/components/inputs/DateTime/shared/CalendarGrid.js +146 -33
  76. package/dist/components/inputs/DateTime/shared/CalendarHeader.js +249 -93
  77. package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
  78. package/dist/components/inputs/DateTime/shared/DateField.js +296 -112
  79. package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +2 -1
  80. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +352 -145
  81. package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +94 -21
  82. package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +81 -27
  83. package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +59 -10
  84. package/dist/components/inputs/DateTime/shared/MonthPicker.js +103 -58
  85. package/dist/components/inputs/DateTime/shared/RangeCalendar.js +193 -82
  86. package/dist/components/inputs/DateTime/shared/TimeField.js +27 -8
  87. package/dist/components/inputs/DateTime/shared/TimePickerForm.js +279 -110
  88. package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +2 -1
  89. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +206 -70
  90. package/dist/components/inputs/DateTime/shared/YearPicker.js +119 -68
  91. package/dist/components/inputs/File/FileUpload.js +86 -44
  92. package/dist/components/inputs/File/FileUploadContainer.js +15 -7
  93. package/dist/components/inputs/File/InputUpload.js +317 -79
  94. package/dist/components/inputs/File/shared/FileCard.js +104 -41
  95. package/dist/components/inputs/File/shared/FileCardList.js +47 -12
  96. package/dist/components/inputs/File/shared/FileUploadContent.js +175 -44
  97. package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +149 -46
  98. package/dist/components/inputs/File/shared/FileUploadContentError.js +234 -93
  99. package/dist/components/inputs/File/shared/FileUploadContentFilled.js +230 -97
  100. package/dist/components/inputs/File/shared/FileUploadContentLoading.js +199 -55
  101. package/dist/components/inputs/File/shared/InputUploadContent.js +148 -35
  102. package/dist/components/inputs/File/shared/InputUploadFilled.js +49 -8
  103. package/dist/components/inputs/File/shared/ProgressBar.js +48 -9
  104. package/dist/components/inputs/FormField/FormField.js +119 -37
  105. package/dist/components/inputs/FormField/FormFieldError.js +25 -5
  106. package/dist/components/inputs/FormField/FormFieldHeader.js +79 -22
  107. package/dist/components/inputs/FormField/FormFieldHeaderClose.js +31 -7
  108. package/dist/components/inputs/FormField/FormFieldHelper.js +26 -6
  109. package/dist/components/inputs/FormField/FormFieldLabel.js +40 -9
  110. package/dist/components/inputs/Input/NumberInput/NumberInput.js +392 -122
  111. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +541 -116
  112. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +463 -146
  113. package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +48 -9
  114. package/dist/components/inputs/Input/TextArea/TextArea.js +303 -90
  115. package/dist/components/inputs/Input/TextInput/TextInput.js +376 -122
  116. package/dist/components/inputs/Input/shared/InputContent.js +190 -58
  117. package/dist/components/inputs/Inputs/Form.js +40 -11
  118. package/dist/components/inputs/Inputs/InputItem.d.ts +0 -1
  119. package/dist/components/inputs/Inputs/InputItem.js +65 -16
  120. package/dist/components/inputs/Inputs/Inputs.js +37 -11
  121. package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -0
  122. package/dist/components/inputs/RadioGroup/RadioGroup.js +333 -107
  123. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +145 -50
  124. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +3 -2
  125. package/dist/components/inputs/Selection/Select/QuerySelect.js +107 -27
  126. package/dist/components/inputs/Selection/Select/Select.js +140 -45
  127. package/dist/components/inputs/Selection/shared/SelectBase.js +69 -20
  128. package/dist/components/inputs/Selection/shared/SelectDesktop.js +390 -143
  129. package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
  130. package/dist/components/inputs/Selection/shared/SelectInput.js +326 -136
  131. package/dist/components/inputs/Selection/shared/SelectInputTags.js +99 -25
  132. package/dist/components/inputs/Selection/shared/SelectListBox.js +163 -51
  133. package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +85 -35
  134. package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +69 -16
  135. package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +70 -21
  136. package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +58 -9
  137. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +9 -0
  138. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +47 -0
  139. package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -2
  140. package/dist/components/inputs/Selection/shared/select.context.js +44 -38
  141. package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +5 -0
  142. package/dist/components/inputs/Selection/shared/selectInput.cva.js +5 -0
  143. package/dist/components/inputs/Selection/shared/useSelectItems.js +109 -49
  144. package/dist/components/inputs/Skeleton/InputFrame.d.ts +2 -0
  145. package/dist/components/inputs/Skeleton/InputFrame.js +442 -116
  146. package/dist/components/inputs/Slider/Slider.js +250 -74
  147. package/dist/components/inputs/TextEditor/TextEditor.js +447 -103
  148. package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +37 -11
  149. package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +102 -30
  150. package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +194 -45
  151. package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +88 -28
  152. package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +48 -14
  153. package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +66 -19
  154. package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +49 -15
  155. package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +92 -32
  156. package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +126 -54
  157. package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +141 -38
  158. package/dist/components/inputs/Toggle/Toggle.d.ts +1 -0
  159. package/dist/components/inputs/Toggle/Toggle.js +206 -40
  160. package/dist/components/inputs/shared/CheckContent.js +21 -10
  161. package/dist/components/inputs/shared/InputClear.js +78 -21
  162. package/dist/components/inputs/shared/TooltipWrapper.js +47 -12
  163. package/dist/components/inputs/shared/input.cva.js +13 -3
  164. package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +1 -0
  165. package/dist/components/inputs/shared/useStaticInputHandoff.js +87 -34
  166. package/dist/components/navigation/Accordion/Accordion.js +69 -22
  167. package/dist/components/navigation/Accordion/AccordionItem.js +86 -41
  168. package/dist/components/navigation/Stepper/Stepper.js +67 -22
  169. package/dist/components/navigation/Stepper/StepperItem.js +104 -31
  170. package/dist/components/navigation/Stepper/StepperSeparator.js +23 -5
  171. package/dist/components/overlays/ActionModal/ActionModal.js +169 -35
  172. package/dist/components/overlays/BottomSheet/BottomSheet.js +96 -23
  173. package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +48 -8
  174. package/dist/components/overlays/Drawer/Drawer.js +62 -20
  175. package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +83 -27
  176. package/dist/components/overlays/Tooltip/Tooltip.js +137 -28
  177. package/dist/components/overlays/Tooltip/TooltipEllipsis.js +37 -12
  178. package/dist/components/segment/Segment.js +218 -57
  179. package/dist/components/segment/SegmentItem.js +67 -10
  180. package/dist/components/shared/pagination/Pagination.js +108 -22
  181. package/dist/components/shared/pagination/PaginationList.js +167 -64
  182. package/dist/components/status/Alert/Alert.js +97 -30
  183. package/dist/components/status/Loader/Loader.js +77 -22
  184. package/dist/components/status/Toast/Toast.js +21 -13
  185. package/dist/components/status/Toast/useToast.js +62 -57
  186. package/dist/components/table/ColumnConfig.js +158 -54
  187. package/dist/components/table/InfiniteTable.js +67 -16
  188. package/dist/components/table/PaginatedTable.js +84 -18
  189. package/dist/components/table/Table.js +28 -27
  190. package/dist/components/text/Link/Link.js +19 -7
  191. package/dist/components/text/Typography/Typography.js +23 -8
  192. package/dist/config/confirmation.context.js +1 -1
  193. package/dist/config/link.context.js +23 -9
  194. package/dist/config/router.context.js +42 -16
  195. package/dist/config/theme.context.js +98 -45
  196. package/dist/config/uiConfig.context.d.ts +4 -4
  197. package/dist/config/uiConfig.context.js +50 -11
  198. package/dist/config/uiStyle.context.js +15 -5
  199. package/dist/helpers/dynamicInputs.d.ts +1 -1
  200. package/dist/hooks/useBreakpoint.js +16 -3
  201. package/dist/hooks/useDebounceCallback.js +51 -17
  202. package/dist/hooks/useFilters.js +125 -64
  203. package/dist/hooks/useForm.js +42 -8
  204. package/dist/hooks/useFormAutosave.js +101 -30
  205. package/dist/hooks/useIntersectionObserver.js +86 -32
  206. package/dist/hooks/useLocalStorage.js +43 -10
  207. package/dist/hooks/useLongPressRepeat.js +55 -20
  208. package/dist/hooks/usePagination.js +49 -19
  209. package/dist/hooks/useQueryAutocomplete.js +1 -0
  210. package/dist/hooks/useScrollableListBox.js +37 -16
  211. package/dist/hooks/useSorting.js +69 -28
  212. package/dist/hooks/useStateAndRef.js +21 -7
  213. package/dist/hooks/useTableColumnConfig.js +124 -31
  214. package/dist/hooks/useTranslationMemo.js +25 -5
  215. package/dist/index.js +2 -2
  216. package/dist/utils/date-time.utils.d.ts +2 -0
  217. package/dist/utils/date-time.utils.js +17 -13
  218. package/package.json +1 -1
@@ -10,139 +10,421 @@ import { InputFrame } from "../../Skeleton/InputFrame.js";
10
10
  import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
11
11
  import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
12
12
  import { TimePickerInput } from "../shared/TimePickerInput.js";
13
+ import { c } from "react/compiler-runtime";
13
14
  import { jsx, jsxs } from "react/jsx-runtime";
14
15
  import { clsx } from "clsx";
15
16
  import { useEffect, useRef, useState } from "react";
16
17
  import { useLocale, useTimeField } from "react-aria";
17
18
  import { mergeRefs } from "@react-aria/utils";
18
- import { Controller, useWatch } from "react-hook-form";
19
- import { getLocalTimeZone, now, toTime } from "@internationalized/date";
19
+ import { Controller } from "react-hook-form";
20
+ import { now, toTime } from "@internationalized/date";
20
21
  import { DateTime } from "luxon";
21
22
  import { useTimeFieldState } from "react-stately";
22
23
  //#region src/components/inputs/DateTime/TimePicker/TimePicker.tsx
23
24
  var TimePickerBase = (props) => {
25
+ const $ = c(133);
24
26
  const ui = UIConfig.useConfig();
25
- const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, placeholder, className, inputClassName, variant = ui.input.variant, as = ui.input.as, size = ui.input.size, hideLabel = ui.input.hideLabel, isClearable = ui.input.isClearable, disableManualEntry = ui.dateInput.disableManualEntry, ...rest } = props;
26
- const formFieldProps = {
27
- error,
28
- label,
29
- tooltipText,
30
- helperText,
31
- isRequired,
32
- rightContent,
33
- isHeaderHidden: isHeaderHidden || as === "inline" || as === "filter" || as === "floating",
34
- hideLabel,
35
- isDisabled,
36
- headerClassName,
37
- errorClassName
38
- };
27
+ let asProp;
28
+ let className;
29
+ let disableDropdown;
30
+ let disableManualEntryProp;
31
+ let error;
32
+ let errorClassName;
33
+ let fireBlurOnChangeProp;
34
+ let headerClassName;
35
+ let helperText;
36
+ let hideLabelProp;
37
+ let inputClassName;
38
+ let isClearableProp;
39
+ let isDirty;
40
+ let isDisabled;
41
+ let isHeaderHidden;
42
+ let isRequired;
43
+ let label;
44
+ let onBlur;
45
+ let onChange;
46
+ let placeholder;
47
+ let ref;
48
+ let rest;
49
+ let rightContent;
50
+ let sizeProp;
51
+ let tooltipText;
52
+ let value;
53
+ let variantProp;
54
+ if ($[0] !== props) {
55
+ ({ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, placeholder, className, inputClassName, variant: variantProp, as: asProp, size: sizeProp, hideLabel: hideLabelProp, isClearable: isClearableProp, disableManualEntry: disableManualEntryProp, fireBlurOnChange: fireBlurOnChangeProp, ...rest} = props);
56
+ $[0] = props;
57
+ $[1] = asProp;
58
+ $[2] = className;
59
+ $[3] = disableDropdown;
60
+ $[4] = disableManualEntryProp;
61
+ $[5] = error;
62
+ $[6] = errorClassName;
63
+ $[7] = fireBlurOnChangeProp;
64
+ $[8] = headerClassName;
65
+ $[9] = helperText;
66
+ $[10] = hideLabelProp;
67
+ $[11] = inputClassName;
68
+ $[12] = isClearableProp;
69
+ $[13] = isDirty;
70
+ $[14] = isDisabled;
71
+ $[15] = isHeaderHidden;
72
+ $[16] = isRequired;
73
+ $[17] = label;
74
+ $[18] = onBlur;
75
+ $[19] = onChange;
76
+ $[20] = placeholder;
77
+ $[21] = ref;
78
+ $[22] = rest;
79
+ $[23] = rightContent;
80
+ $[24] = sizeProp;
81
+ $[25] = tooltipText;
82
+ $[26] = value;
83
+ $[27] = variantProp;
84
+ } else {
85
+ asProp = $[1];
86
+ className = $[2];
87
+ disableDropdown = $[3];
88
+ disableManualEntryProp = $[4];
89
+ error = $[5];
90
+ errorClassName = $[6];
91
+ fireBlurOnChangeProp = $[7];
92
+ headerClassName = $[8];
93
+ helperText = $[9];
94
+ hideLabelProp = $[10];
95
+ inputClassName = $[11];
96
+ isClearableProp = $[12];
97
+ isDirty = $[13];
98
+ isDisabled = $[14];
99
+ isHeaderHidden = $[15];
100
+ isRequired = $[16];
101
+ label = $[17];
102
+ onBlur = $[18];
103
+ onChange = $[19];
104
+ placeholder = $[20];
105
+ ref = $[21];
106
+ rest = $[22];
107
+ rightContent = $[23];
108
+ sizeProp = $[24];
109
+ tooltipText = $[25];
110
+ value = $[26];
111
+ variantProp = $[27];
112
+ }
113
+ const variant = variantProp ?? ui.input.variant;
114
+ const as = asProp ?? ui.input.as;
115
+ const size = sizeProp ?? ui.input.size;
116
+ const hideLabel = hideLabelProp ?? ui.input.hideLabel;
117
+ const isClearable = isClearableProp ?? ui.input.isClearable;
118
+ const disableManualEntry = disableManualEntryProp ?? ui.dateInput.disableManualEntry;
119
+ const fireBlurOnChange = fireBlurOnChangeProp ?? ui.dateInput.fireBlurOnChange;
120
+ const t0 = isHeaderHidden || as === "inline" || as === "filter" || as === "floating";
121
+ let t1;
122
+ if ($[28] !== error || $[29] !== errorClassName || $[30] !== headerClassName || $[31] !== helperText || $[32] !== hideLabel || $[33] !== isDisabled || $[34] !== isRequired || $[35] !== label || $[36] !== rightContent || $[37] !== t0 || $[38] !== tooltipText) {
123
+ t1 = {
124
+ error,
125
+ label,
126
+ tooltipText,
127
+ helperText,
128
+ isRequired,
129
+ rightContent,
130
+ isHeaderHidden: t0,
131
+ hideLabel,
132
+ isDisabled,
133
+ headerClassName,
134
+ errorClassName
135
+ };
136
+ $[28] = error;
137
+ $[29] = errorClassName;
138
+ $[30] = headerClassName;
139
+ $[31] = helperText;
140
+ $[32] = hideLabel;
141
+ $[33] = isDisabled;
142
+ $[34] = isRequired;
143
+ $[35] = label;
144
+ $[36] = rightContent;
145
+ $[37] = t0;
146
+ $[38] = tooltipText;
147
+ $[39] = t1;
148
+ } else t1 = $[39];
149
+ const formFieldProps = t1;
39
150
  const [isOpen, setIsOpen] = useState(false);
40
151
  const initialDateEmitRef = useRef(true);
41
152
  const { locale } = useLocale();
42
- const dialogState = useTimeFieldState({
43
- ...rest,
44
- defaultValue: value || rest.defaultValue,
45
- locale
46
- });
47
- const handleBlur = (val) => {
48
- onBlur?.({ target: { value: val } });
49
- };
50
- const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
51
- const state = useTimeFieldState({
52
- ...rest,
53
- isDisabled,
54
- value,
55
- onChange: (val) => {
56
- onChange?.(val);
57
- debouncedBlur(val);
58
- },
59
- locale
60
- });
61
- useEffect(() => {
62
- if (initialDateEmitRef.current) {
63
- initialDateEmitRef.current = false;
64
- return;
65
- }
66
- if (state.timeValue) onChange?.(state.timeValue);
67
- }, [rest.date]);
153
+ const t2 = value || rest.defaultValue;
154
+ let t3;
155
+ if ($[40] !== locale || $[41] !== rest || $[42] !== t2) {
156
+ t3 = {
157
+ ...rest,
158
+ defaultValue: t2,
159
+ locale
160
+ };
161
+ $[40] = locale;
162
+ $[41] = rest;
163
+ $[42] = t2;
164
+ $[43] = t3;
165
+ } else t3 = $[43];
166
+ const dialogState = useTimeFieldState(t3);
167
+ let t4;
168
+ if ($[44] !== onBlur) {
169
+ t4 = (val) => {
170
+ onBlur?.({ target: { value: val } });
171
+ };
172
+ $[44] = onBlur;
173
+ $[45] = t4;
174
+ } else t4 = $[45];
175
+ const handleBlur = t4;
176
+ let t5;
177
+ if ($[46] === Symbol.for("react.memo_cache_sentinel")) {
178
+ t5 = { delay: 500 };
179
+ $[46] = t5;
180
+ } else t5 = $[46];
181
+ const { callback: debouncedBlur } = useDebounceCallback(handleBlur, t5);
182
+ let t6;
183
+ if ($[47] !== debouncedBlur || $[48] !== fireBlurOnChange || $[49] !== onChange) {
184
+ t6 = (val_0) => {
185
+ onChange?.(val_0);
186
+ if (fireBlurOnChange) debouncedBlur(val_0);
187
+ };
188
+ $[47] = debouncedBlur;
189
+ $[48] = fireBlurOnChange;
190
+ $[49] = onChange;
191
+ $[50] = t6;
192
+ } else t6 = $[50];
193
+ let t7;
194
+ if ($[51] !== isDisabled || $[52] !== locale || $[53] !== rest || $[54] !== t6 || $[55] !== value) {
195
+ t7 = {
196
+ ...rest,
197
+ isDisabled,
198
+ value,
199
+ onChange: t6,
200
+ locale
201
+ };
202
+ $[51] = isDisabled;
203
+ $[52] = locale;
204
+ $[53] = rest;
205
+ $[54] = t6;
206
+ $[55] = value;
207
+ $[56] = t7;
208
+ } else t7 = $[56];
209
+ const state = useTimeFieldState(t7);
210
+ let t8;
211
+ if ($[57] !== onChange || $[58] !== state.timeValue) {
212
+ t8 = () => {
213
+ if (initialDateEmitRef.current) {
214
+ initialDateEmitRef.current = false;
215
+ return;
216
+ }
217
+ if (state.timeValue) onChange?.(state.timeValue);
218
+ };
219
+ $[57] = onChange;
220
+ $[58] = state.timeValue;
221
+ $[59] = t8;
222
+ } else t8 = $[59];
223
+ let t9;
224
+ if ($[60] !== rest.date) {
225
+ t9 = [rest.date];
226
+ $[60] = rest.date;
227
+ $[61] = t9;
228
+ } else t9 = $[61];
229
+ useEffect(t8, t9);
68
230
  const timeFieldRef = useRef(null);
69
- const { labelProps, fieldProps } = useTimeField({
70
- ...rest,
71
- label,
72
- isReadOnly: disableManualEntry
73
- }, state, timeFieldRef);
74
- const headerProps = {
75
- label,
76
- tooltipText,
77
- helperText,
78
- isRequired,
79
- rightContent,
80
- isHeaderHidden: hideLabel || isHeaderHidden,
81
- isDisabled,
82
- className: headerClassName,
83
- labelProps
84
- };
85
- const onApply = () => {
86
- const newValue = dialogState.value;
87
- state.setValue(newValue);
88
- setIsOpen(false);
89
- handleBlur(newValue);
90
- };
91
- const onOpenChange = (open) => {
92
- setIsOpen(open);
93
- if (!isOpen) dialogState.setValue(state.value);
94
- };
95
- const onOpen = () => {
96
- dialogState.setValue(state.value);
97
- setIsOpen(true);
98
- };
99
- return /* @__PURE__ */ jsx(TooltipWrapper, {
100
- as,
101
- error,
102
- triggerTabIndex: as === "inline" ? -1 : void 0,
103
- children: /* @__PURE__ */ jsxs(FormField, {
231
+ let t10;
232
+ if ($[62] !== disableManualEntry || $[63] !== label || $[64] !== rest) {
233
+ t10 = {
234
+ ...rest,
235
+ label,
236
+ isReadOnly: disableManualEntry
237
+ };
238
+ $[62] = disableManualEntry;
239
+ $[63] = label;
240
+ $[64] = rest;
241
+ $[65] = t10;
242
+ } else t10 = $[65];
243
+ const { labelProps, fieldProps } = useTimeField(t10, state, timeFieldRef);
244
+ const t11 = hideLabel || isHeaderHidden;
245
+ let t12;
246
+ if ($[66] !== headerClassName || $[67] !== helperText || $[68] !== isDisabled || $[69] !== isRequired || $[70] !== label || $[71] !== labelProps || $[72] !== rightContent || $[73] !== t11 || $[74] !== tooltipText) {
247
+ t12 = {
248
+ label,
249
+ tooltipText,
250
+ helperText,
251
+ isRequired,
252
+ rightContent,
253
+ isHeaderHidden: t11,
254
+ isDisabled,
255
+ className: headerClassName,
256
+ labelProps
257
+ };
258
+ $[66] = headerClassName;
259
+ $[67] = helperText;
260
+ $[68] = isDisabled;
261
+ $[69] = isRequired;
262
+ $[70] = label;
263
+ $[71] = labelProps;
264
+ $[72] = rightContent;
265
+ $[73] = t11;
266
+ $[74] = tooltipText;
267
+ $[75] = t12;
268
+ } else t12 = $[75];
269
+ const headerProps = t12;
270
+ let t13;
271
+ if ($[76] !== dialogState.value || $[77] !== fireBlurOnChange || $[78] !== handleBlur || $[79] !== state) {
272
+ t13 = () => {
273
+ const newValue = dialogState.value;
274
+ state.setValue(newValue);
275
+ setIsOpen(false);
276
+ if (fireBlurOnChange) handleBlur(newValue);
277
+ };
278
+ $[76] = dialogState.value;
279
+ $[77] = fireBlurOnChange;
280
+ $[78] = handleBlur;
281
+ $[79] = state;
282
+ $[80] = t13;
283
+ } else t13 = $[80];
284
+ const onApply = t13;
285
+ let t14;
286
+ if ($[81] !== dialogState || $[82] !== isOpen || $[83] !== state.value) {
287
+ t14 = (open) => {
288
+ setIsOpen(open);
289
+ if (!isOpen) dialogState.setValue(state.value);
290
+ };
291
+ $[81] = dialogState;
292
+ $[82] = isOpen;
293
+ $[83] = state.value;
294
+ $[84] = t14;
295
+ } else t14 = $[84];
296
+ const onOpenChange = t14;
297
+ let t15;
298
+ if ($[85] !== dialogState || $[86] !== state.value) {
299
+ t15 = () => {
300
+ dialogState.setValue(state.value);
301
+ setIsOpen(true);
302
+ };
303
+ $[85] = dialogState;
304
+ $[86] = state.value;
305
+ $[87] = t15;
306
+ } else t15 = $[87];
307
+ const onOpen = t15;
308
+ const t16 = as === "inline" ? -1 : void 0;
309
+ let t17;
310
+ if ($[88] !== className) {
311
+ t17 = clsx("relative inline-flex w-full flex-col text-left", className);
312
+ $[88] = className;
313
+ $[89] = t17;
314
+ } else t17 = $[89];
315
+ const t18 = as === "inline" ? -1 : void 0;
316
+ let t19;
317
+ if ($[90] !== ref) {
318
+ t19 = mergeRefs(ref, timeFieldRef);
319
+ $[90] = ref;
320
+ $[91] = t19;
321
+ } else t19 = $[91];
322
+ const t20 = !!error;
323
+ let t21;
324
+ if ($[92] !== as || $[93] !== disableDropdown || $[94] !== disableManualEntry || $[95] !== fieldProps || $[96] !== fireBlurOnChange || $[97] !== headerProps || $[98] !== inputClassName || $[99] !== isClearable || $[100] !== isDirty || $[101] !== isDisabled || $[102] !== isRequired || $[103] !== onOpen || $[104] !== placeholder || $[105] !== size || $[106] !== state || $[107] !== t19 || $[108] !== t20 || $[109] !== variant) {
325
+ t21 = /* @__PURE__ */ jsx(TimePickerInput, {
326
+ ref: t19,
327
+ as,
328
+ fieldProps,
329
+ state,
330
+ onPress: onOpen,
331
+ isDisabled,
332
+ isDirty,
333
+ isRequired,
334
+ isInvalid: t20,
335
+ disableDropdown,
336
+ variant,
337
+ size,
338
+ isClearable,
339
+ headerProps,
340
+ disableManualEntry,
341
+ placeholder,
342
+ className: inputClassName,
343
+ fireBlurOnChange
344
+ });
345
+ $[92] = as;
346
+ $[93] = disableDropdown;
347
+ $[94] = disableManualEntry;
348
+ $[95] = fieldProps;
349
+ $[96] = fireBlurOnChange;
350
+ $[97] = headerProps;
351
+ $[98] = inputClassName;
352
+ $[99] = isClearable;
353
+ $[100] = isDirty;
354
+ $[101] = isDisabled;
355
+ $[102] = isRequired;
356
+ $[103] = onOpen;
357
+ $[104] = placeholder;
358
+ $[105] = size;
359
+ $[106] = state;
360
+ $[107] = t19;
361
+ $[108] = t20;
362
+ $[109] = variant;
363
+ $[110] = t21;
364
+ } else t21 = $[110];
365
+ let t22;
366
+ if ($[111] !== dialogState || $[112] !== disableDropdown || $[113] !== disableManualEntry || $[114] !== isDisabled || $[115] !== isOpen || $[116] !== label || $[117] !== onApply || $[118] !== onOpenChange) {
367
+ t22 = (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(DateTimeDialog, {
368
+ footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
369
+ isDisabled,
370
+ onApply,
371
+ isValid: !dialogState.isInvalid && !!dialogState.value
372
+ }),
373
+ label,
374
+ triggerRef: timeFieldRef,
375
+ isOpen,
376
+ onOpenChange,
377
+ children: /* @__PURE__ */ jsx(TimePickerForm, { state: dialogState })
378
+ });
379
+ $[111] = dialogState;
380
+ $[112] = disableDropdown;
381
+ $[113] = disableManualEntry;
382
+ $[114] = isDisabled;
383
+ $[115] = isOpen;
384
+ $[116] = label;
385
+ $[117] = onApply;
386
+ $[118] = onOpenChange;
387
+ $[119] = t22;
388
+ } else t22 = $[119];
389
+ let t23;
390
+ if ($[120] !== as || $[121] !== formFieldProps || $[122] !== labelProps || $[123] !== t17 || $[124] !== t18 || $[125] !== t21 || $[126] !== t22) {
391
+ t23 = /* @__PURE__ */ jsxs(FormField, {
104
392
  ...formFieldProps,
105
393
  as,
106
394
  labelProps,
107
- className: clsx("relative inline-flex w-full flex-col text-left", className),
108
- tabIndex: as === "inline" ? -1 : void 0,
109
- children: [/* @__PURE__ */ jsx(TimePickerInput, {
110
- ref: mergeRefs(ref, timeFieldRef),
111
- as,
112
- fieldProps,
113
- state,
114
- onPress: onOpen,
115
- isDisabled,
116
- isDirty,
117
- isRequired,
118
- isInvalid: !!error,
119
- disableDropdown,
120
- variant,
121
- size,
122
- isClearable,
123
- headerProps,
124
- disableManualEntry,
125
- placeholder,
126
- className: inputClassName
127
- }), (!disableDropdown || disableManualEntry) && /* @__PURE__ */ jsx(DateTimeDialog, {
128
- footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
129
- isDisabled,
130
- onApply,
131
- isValid: !dialogState.isInvalid && !!dialogState.value
132
- }),
133
- label,
134
- triggerRef: timeFieldRef,
135
- isOpen,
136
- onOpenChange,
137
- children: /* @__PURE__ */ jsx(TimePickerForm, { state: dialogState })
138
- })]
139
- })
140
- });
395
+ className: t17,
396
+ tabIndex: t18,
397
+ children: [t21, t22]
398
+ });
399
+ $[120] = as;
400
+ $[121] = formFieldProps;
401
+ $[122] = labelProps;
402
+ $[123] = t17;
403
+ $[124] = t18;
404
+ $[125] = t21;
405
+ $[126] = t22;
406
+ $[127] = t23;
407
+ } else t23 = $[127];
408
+ let t24;
409
+ if ($[128] !== as || $[129] !== error || $[130] !== t16 || $[131] !== t23) {
410
+ t24 = /* @__PURE__ */ jsx(TooltipWrapper, {
411
+ as,
412
+ error,
413
+ triggerTabIndex: t16,
414
+ children: t23
415
+ });
416
+ $[128] = as;
417
+ $[129] = error;
418
+ $[130] = t16;
419
+ $[131] = t23;
420
+ $[132] = t24;
421
+ } else t24 = $[132];
422
+ return t24;
141
423
  };
142
- var TimePicker = ({ renderStaticInput, ...props }) => {
424
+ var TimePickerInner = (t0) => {
425
+ const $ = c(9);
426
+ const { renderStaticInput, isFormControlDisabled, ...props } = t0;
143
427
  const ui = UIConfig.useConfig();
144
- let effectiveTimeZone = getLocalTimeZone();
145
- if (props.timeZone) effectiveTimeZone = props.timeZone;
146
428
  const { locale } = useLocale();
147
429
  const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
148
430
  const inputRef = useRef(null);
@@ -150,39 +432,30 @@ var TimePicker = ({ renderStaticInput, ...props }) => {
150
432
  inputRef,
151
433
  renderInput,
152
434
  setRenderInput,
153
- getFocusTarget: (input) => input.querySelector("input, button, [tabindex]:not([tabindex='-1'])")
435
+ getFocusTarget: _temp
154
436
  });
155
- const watchedValue = "formControl" in props && props.formControl ? useWatch({
156
- control: props.formControl.control,
157
- name: props.formControl.name
158
- }) : props.value;
159
- let isFormControlDisabled = false;
160
- if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
161
- const rawValue = watchedValue ?? props.value ?? null;
437
+ const rawValue = props.value ?? null;
162
438
  const formatTimeValue = (timeValue) => {
163
439
  if (timeValue === null) return null;
164
440
  let parsedDate;
165
- if (props.date) parsedDate = DateTime.fromISO(props.date, { zone: effectiveTimeZone }).toJSDate();
166
- let dateValue = now(effectiveTimeZone);
167
- if (parsedDate) dateValue = DateTimeUtils.fromLocalToZonedDateTime(parsedDate, effectiveTimeZone);
441
+ if (props.date) parsedDate = DateTime.fromISO(props.date, { zone: "UTC" }).toJSDate();
442
+ let dateValue = now("UTC");
443
+ if (parsedDate) dateValue = DateTimeUtils.fromLocalToZonedDateTime(parsedDate, "UTC");
168
444
  const dateTimeValue = dateValue.set(timeValue);
169
- return DateTimeUtils.fromDateValueToISO(dateTimeValue, effectiveTimeZone);
170
- };
171
- const parseTimeValue = (isoString) => {
172
- if (isoString == null) return isoString;
173
- return toTime(DateTimeUtils.fromISOtoZonedDateTime(isoString, effectiveTimeZone));
445
+ return DateTimeUtils.fromDateValueToISO(dateTimeValue, "UTC");
174
446
  };
447
+ const parseTimeValue = _temp2;
175
448
  if (!renderInput) {
176
- const timeValue = rawValue ? parseTimeValue(rawValue) : null;
449
+ const timeValue_0 = rawValue ? parseTimeValue(rawValue) : null;
177
450
  const as = props.as ?? ui.input.as;
178
451
  const isDisabled = isFormControlDisabled || !!props.isDisabled;
179
452
  const disableManualEntry = props.disableManualEntry ?? ui.dateInput.disableManualEntry;
180
453
  const showDropdown = !props.disableDropdown || disableManualEntry;
181
454
  const staticSegments = getStaticTimeSegments({
182
- value: timeValue,
455
+ value: timeValue_0,
183
456
  locale,
184
457
  isDisabled,
185
- hidePlaceholder: as === "floating" && !timeValue
458
+ hidePlaceholder: as === "floating" && !timeValue_0
186
459
  });
187
460
  return /* @__PURE__ */ jsx(InputFrame, {
188
461
  ...props,
@@ -192,45 +465,137 @@ var TimePicker = ({ renderStaticInput, ...props }) => {
192
465
  contentClassName: "pr-0!",
193
466
  labelPlacement: "content-row",
194
467
  dataAttributes: {
195
- dataIsEmpty: timeValue === null,
196
- dataIsFilled: timeValue !== null,
468
+ dataIsEmpty: timeValue_0 === null,
469
+ dataIsFilled: timeValue_0 !== null,
197
470
  dataIsDirty: props.isDirty,
198
471
  dataIsRequired: props.isRequired,
199
472
  dataIsDisabled: isDisabled,
200
473
  dataDisabled: isDisabled,
201
474
  dataInvalid: !!props.error,
202
- dataHasSelection: timeValue !== null
475
+ dataHasSelection: timeValue_0 !== null
203
476
  },
204
477
  renderStatic: true,
205
478
  onStaticInteract: renderRealInput,
479
+ wrapContentAndTrailing: true,
206
480
  trailingClassName: "py-0! pl-0!",
207
481
  trailingContent: showDropdown ? ui.dateInput.timeIcon : void 0,
208
482
  children: staticSegments
209
483
  });
210
484
  }
211
- if ("formControl" in props && props.formControl) {
212
- const { formControl, ref, ...innerProps } = props;
213
- return /* @__PURE__ */ jsx(Controller, {
214
- control: formControl.control,
215
- name: formControl.name,
216
- render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(TimePickerBase, {
217
- ...innerProps,
218
- ref: mergeRefs(ref, field.ref, inputRef),
219
- value: parseTimeValue(field.value),
220
- onChange: (value) => field.onChange(formatTimeValue(value)),
221
- onBlur: field.onBlur,
222
- isDirty,
223
- isDisabled: field.disabled || props.isDisabled,
224
- error: props.error ?? error?.message
225
- })
485
+ const T0 = TimePickerBase;
486
+ const t1 = mergeRefs(props.ref, inputRef);
487
+ const t2 = parseTimeValue(props.value);
488
+ let t3;
489
+ if ($[0] !== formatTimeValue || $[1] !== props) {
490
+ t3 = (value) => props.onChange?.(formatTimeValue(value));
491
+ $[0] = formatTimeValue;
492
+ $[1] = props;
493
+ $[2] = t3;
494
+ } else t3 = $[2];
495
+ let t4;
496
+ if ($[3] !== T0 || $[4] !== props || $[5] !== t1 || $[6] !== t2 || $[7] !== t3) {
497
+ t4 = /* @__PURE__ */ jsx(T0, {
498
+ ...props,
499
+ ref: t1,
500
+ value: t2,
501
+ onChange: t3
226
502
  });
503
+ $[3] = T0;
504
+ $[4] = props;
505
+ $[5] = t1;
506
+ $[6] = t2;
507
+ $[7] = t3;
508
+ $[8] = t4;
509
+ } else t4 = $[8];
510
+ return t4;
511
+ };
512
+ var TimePicker = (t0) => {
513
+ const $ = c(21);
514
+ let props;
515
+ let renderStaticInput;
516
+ if ($[0] !== t0) {
517
+ ({renderStaticInput, ...props} = t0);
518
+ $[0] = t0;
519
+ $[1] = props;
520
+ $[2] = renderStaticInput;
521
+ } else {
522
+ props = $[1];
523
+ renderStaticInput = $[2];
227
524
  }
228
- return /* @__PURE__ */ jsx(TimePickerBase, {
229
- ...props,
230
- ref: mergeRefs(props.ref, inputRef),
231
- value: parseTimeValue(props.value),
232
- onChange: (value) => props.onChange?.(formatTimeValue(value))
233
- });
525
+ if ("formControl" in props && props.formControl) {
526
+ let formControl;
527
+ let innerProps;
528
+ let ref;
529
+ if ($[3] !== props) {
530
+ ({formControl, ref, ...innerProps} = props);
531
+ $[3] = props;
532
+ $[4] = formControl;
533
+ $[5] = innerProps;
534
+ $[6] = ref;
535
+ } else {
536
+ formControl = $[4];
537
+ innerProps = $[5];
538
+ ref = $[6];
539
+ }
540
+ const controlWithOptions = formControl.control;
541
+ let t1;
542
+ if ($[7] !== controlWithOptions._options?.disabled || $[8] !== innerProps || $[9] !== props.error || $[10] !== props.isDisabled || $[11] !== ref || $[12] !== renderStaticInput) {
543
+ t1 = (t2) => {
544
+ const { field, fieldState: t3 } = t2;
545
+ const { error, isDirty } = t3;
546
+ return /* @__PURE__ */ jsx(TimePickerInner, {
547
+ ...innerProps,
548
+ ref: mergeRefs(ref, field.ref),
549
+ value: field.value,
550
+ onChange: field.onChange,
551
+ onBlur: field.onBlur,
552
+ isDirty,
553
+ isDisabled: field.disabled || props.isDisabled,
554
+ isFormControlDisabled: !!controlWithOptions._options?.disabled,
555
+ error: props.error ?? error?.message,
556
+ renderStaticInput
557
+ });
558
+ };
559
+ $[7] = controlWithOptions._options?.disabled;
560
+ $[8] = innerProps;
561
+ $[9] = props.error;
562
+ $[10] = props.isDisabled;
563
+ $[11] = ref;
564
+ $[12] = renderStaticInput;
565
+ $[13] = t1;
566
+ } else t1 = $[13];
567
+ let t2;
568
+ if ($[14] !== formControl.control || $[15] !== formControl.name || $[16] !== t1) {
569
+ t2 = /* @__PURE__ */ jsx(Controller, {
570
+ control: formControl.control,
571
+ name: formControl.name,
572
+ render: t1
573
+ });
574
+ $[14] = formControl.control;
575
+ $[15] = formControl.name;
576
+ $[16] = t1;
577
+ $[17] = t2;
578
+ } else t2 = $[17];
579
+ return t2;
580
+ }
581
+ let t1;
582
+ if ($[18] !== props || $[19] !== renderStaticInput) {
583
+ t1 = /* @__PURE__ */ jsx(TimePickerInner, {
584
+ ...props,
585
+ renderStaticInput
586
+ });
587
+ $[18] = props;
588
+ $[19] = renderStaticInput;
589
+ $[20] = t1;
590
+ } else t1 = $[20];
591
+ return t1;
234
592
  };
593
+ function _temp(input) {
594
+ return input.querySelector("input, button, [tabindex]:not([tabindex='-1'])");
595
+ }
596
+ function _temp2(isoString) {
597
+ if (isoString == null) return isoString;
598
+ return toTime(DateTimeUtils.fromISOtoZonedDateTime(isoString, "UTC"));
599
+ }
235
600
  //#endregion
236
601
  export { TimePicker };