@povio/ui 2.3.0-rc.3 → 2.3.0-rc.31

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 +188 -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 +267 -87
  65. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -0
  66. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +347 -182
  67. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +1 -0
  68. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +177 -69
  69. package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +1 -0
  70. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +530 -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 +245 -90
  77. package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
  78. package/dist/components/inputs/DateTime/shared/DateField.js +295 -112
  79. package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +6 -1
  80. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +375 -146
  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 +3 -1
  89. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +208 -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 -123
  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 +298 -89
  115. package/dist/components/inputs/Input/TextInput/TextInput.js +370 -121
  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 +139 -44
  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 +444 -124
  146. package/dist/components/inputs/Slider/Slider.js +247 -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 -41
  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
@@ -7,18 +7,21 @@ import { InputFrame } from "../../Skeleton/InputFrame.js";
7
7
  import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
8
8
  import { InputContent } from "../shared/InputContent.js";
9
9
  import { getStaticNumberDisplayValue } from "../shared/numberStatic.utils.js";
10
+ import { c } from "react/compiler-runtime";
10
11
  import { jsx } from "react/jsx-runtime";
11
12
  import { clsx } from "clsx";
12
- import { useCallback, useEffect, useRef, useState } from "react";
13
+ import { useEffect, useRef, useState } from "react";
13
14
  import { Input, useLocale } from "react-aria-components";
14
15
  import { useFocusVisible, useNumberField } from "react-aria";
15
16
  import { mergeRefs } from "@react-aria/utils";
16
- import { Controller, useWatch } from "react-hook-form";
17
+ import { Controller } from "react-hook-form";
17
18
  import { useNumberFieldState } from "react-stately";
18
19
  //#region src/components/inputs/Input/NumberInput/NumberInput.tsx
19
20
  var NumberInputBase = (props) => {
21
+ const $ = c(89);
20
22
  const ui = UIConfig.useConfig();
21
23
  const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
24
+ const hasControlledValue = "value" in props;
22
25
  const inputRef = useRef(null);
23
26
  const { ref, inputClassName, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, className, unit, isLoading, action, leadingIcon, trailingIcon, value, onChange, onBlur, formatOptions: formatOptionsProp, variant: variantProp, as: asProp, size: sizeProp, hideLabel: hideLabelProp, isClearable: isClearableProp, autoFocusOnMount, ...rest } = props;
24
27
  const formatOptions = formatOptionsProp ?? ui.numberInput.formatOptions;
@@ -30,123 +33,305 @@ var NumberInputBase = (props) => {
30
33
  const numberFieldRef = useRef(null);
31
34
  const { isFocusVisible } = useFocusVisible();
32
35
  const { locale } = useLocale();
36
+ let t0;
37
+ if ($[0] !== onChange) {
38
+ t0 = (nextValue) => onChange?.(Number.isNaN(nextValue) ? null : nextValue);
39
+ $[0] = onChange;
40
+ $[1] = t0;
41
+ } else t0 = $[1];
42
+ let t1;
43
+ if ($[2] !== onBlur) {
44
+ t1 = (e) => onBlur?.({ target: e.target });
45
+ $[2] = onBlur;
46
+ $[3] = t1;
47
+ } else t1 = $[3];
33
48
  const numberProps = {
34
49
  ...rest,
35
- value: value ?? void 0,
50
+ value: hasControlledValue ? value ?? NaN : void 0,
36
51
  label,
37
52
  isDisabled,
38
53
  isInvalid: !!error,
39
54
  isRequired,
40
- onChange,
41
- onBlur: (e) => onBlur?.({ target: e.target }),
55
+ onChange: t0,
56
+ onBlur: t1,
42
57
  locale,
43
58
  formatOptions
44
59
  };
45
60
  const { labelProps, inputProps } = useNumberField(numberProps, useNumberFieldState(numberProps), numberFieldRef);
46
- useEffect(() => {
47
- if (!autoFocusOnMount || isDisabled) return;
48
- requestAnimationFrame(() => inputRef.current?.focus());
49
- }, [autoFocusOnMount, isDisabled]);
50
- const formFieldProps = {
51
- error,
52
- label,
53
- tooltipText,
54
- helperText,
55
- isRequired,
56
- rightContent,
57
- isHeaderHidden: isHeaderHidden || as === "inline" || as === "filter" || as === "floating",
58
- hideLabel,
59
- isDisabled,
60
- headerClassName,
61
- errorClassName
62
- };
63
- const inputContentProps = {
64
- unit,
65
- isLoading,
66
- isDisabled,
67
- action,
68
- leadingIcon,
69
- trailingIcon,
70
- isClearable,
71
- value,
72
- onChange: (val) => onChange?.(val === "" ? null : Number(val)),
73
- onBlur: useCallback((e) => {
74
- const target = numberFieldRef.current ?? e?.target;
61
+ let t2;
62
+ let t3;
63
+ if ($[4] !== autoFocusOnMount || $[5] !== isDisabled) {
64
+ t2 = () => {
65
+ if (!autoFocusOnMount || isDisabled) return;
66
+ requestAnimationFrame(() => inputRef.current?.focus());
67
+ };
68
+ t3 = [autoFocusOnMount, isDisabled];
69
+ $[4] = autoFocusOnMount;
70
+ $[5] = isDisabled;
71
+ $[6] = t2;
72
+ $[7] = t3;
73
+ } else {
74
+ t2 = $[6];
75
+ t3 = $[7];
76
+ }
77
+ useEffect(t2, t3);
78
+ const t4 = isHeaderHidden || as === "inline" || as === "filter" || as === "floating";
79
+ let t5;
80
+ if ($[8] !== error || $[9] !== errorClassName || $[10] !== headerClassName || $[11] !== helperText || $[12] !== hideLabel || $[13] !== isDisabled || $[14] !== isRequired || $[15] !== label || $[16] !== rightContent || $[17] !== t4 || $[18] !== tooltipText) {
81
+ t5 = {
82
+ error,
83
+ label,
84
+ tooltipText,
85
+ helperText,
86
+ isRequired,
87
+ rightContent,
88
+ isHeaderHidden: t4,
89
+ hideLabel,
90
+ isDisabled,
91
+ headerClassName,
92
+ errorClassName
93
+ };
94
+ $[8] = error;
95
+ $[9] = errorClassName;
96
+ $[10] = headerClassName;
97
+ $[11] = helperText;
98
+ $[12] = hideLabel;
99
+ $[13] = isDisabled;
100
+ $[14] = isRequired;
101
+ $[15] = label;
102
+ $[16] = rightContent;
103
+ $[17] = t4;
104
+ $[18] = tooltipText;
105
+ $[19] = t5;
106
+ } else t5 = $[19];
107
+ const formFieldProps = t5;
108
+ let t6;
109
+ if ($[20] !== onBlur) {
110
+ t6 = (e_0) => {
111
+ const target = numberFieldRef.current ?? e_0?.target;
75
112
  onBlur?.({ target });
76
- }, [onBlur])
77
- };
78
- const headerProps = {
79
- label,
80
- tooltipText,
81
- helperText,
82
- isRequired,
83
- rightContent,
84
- isHeaderHidden: hideLabel || isHeaderHidden,
85
- isDisabled,
86
- className: headerClassName,
87
- labelProps
88
- };
89
- return /* @__PURE__ */ jsx(TooltipWrapper, {
113
+ };
114
+ $[20] = onBlur;
115
+ $[21] = t6;
116
+ } else t6 = $[21];
117
+ const handleInputBlur = t6;
118
+ let t7;
119
+ if ($[22] !== onChange) {
120
+ t7 = (val) => onChange?.(val === "" ? null : Number(val));
121
+ $[22] = onChange;
122
+ $[23] = t7;
123
+ } else t7 = $[23];
124
+ let t8;
125
+ if ($[24] !== action || $[25] !== handleInputBlur || $[26] !== isClearable || $[27] !== isDisabled || $[28] !== isLoading || $[29] !== leadingIcon || $[30] !== t7 || $[31] !== trailingIcon || $[32] !== unit || $[33] !== value) {
126
+ t8 = {
127
+ unit,
128
+ isLoading,
129
+ isDisabled,
130
+ action,
131
+ leadingIcon,
132
+ trailingIcon,
133
+ isClearable,
134
+ value,
135
+ onChange: t7,
136
+ onBlur: handleInputBlur
137
+ };
138
+ $[24] = action;
139
+ $[25] = handleInputBlur;
140
+ $[26] = isClearable;
141
+ $[27] = isDisabled;
142
+ $[28] = isLoading;
143
+ $[29] = leadingIcon;
144
+ $[30] = t7;
145
+ $[31] = trailingIcon;
146
+ $[32] = unit;
147
+ $[33] = value;
148
+ $[34] = t8;
149
+ } else t8 = $[34];
150
+ const inputContentProps = t8;
151
+ const t9 = hideLabel || isHeaderHidden;
152
+ let t10;
153
+ if ($[35] !== headerClassName || $[36] !== helperText || $[37] !== isDisabled || $[38] !== isRequired || $[39] !== label || $[40] !== labelProps || $[41] !== rightContent || $[42] !== t9 || $[43] !== tooltipText) {
154
+ t10 = {
155
+ label,
156
+ tooltipText,
157
+ helperText,
158
+ isRequired,
159
+ rightContent,
160
+ isHeaderHidden: t9,
161
+ isDisabled,
162
+ className: headerClassName,
163
+ labelProps
164
+ };
165
+ $[35] = headerClassName;
166
+ $[36] = helperText;
167
+ $[37] = isDisabled;
168
+ $[38] = isRequired;
169
+ $[39] = label;
170
+ $[40] = labelProps;
171
+ $[41] = rightContent;
172
+ $[42] = t9;
173
+ $[43] = tooltipText;
174
+ $[44] = t10;
175
+ } else t10 = $[44];
176
+ const headerProps = t10;
177
+ const dataIsDisabled = isDisabled || void 0;
178
+ const T0 = TooltipWrapper;
179
+ const t11 = as === "inline" ? -1 : void 0;
180
+ const T1 = FormField;
181
+ let t12;
182
+ if ($[45] !== className) {
183
+ t12 = clsx("group w-full", className);
184
+ $[45] = className;
185
+ $[46] = t12;
186
+ } else t12 = $[46];
187
+ const t13 = as === "inline" ? -1 : void 0;
188
+ const t14 = clsx("relative flex cursor-text has-disabled:cursor-default", inputBaseCva({
189
+ variant,
90
190
  as,
91
- error,
92
- triggerTabIndex: as === "inline" ? -1 : void 0,
93
- children: /* @__PURE__ */ jsx(FormField, {
191
+ ...rest
192
+ }), inputClassName);
193
+ let t15;
194
+ if ($[47] === Symbol.for("react.memo_cache_sentinel")) {
195
+ t15 = () => inputRef.current?.focus();
196
+ $[47] = t15;
197
+ } else t15 = $[47];
198
+ const t16 = value === null || value === void 0 || void 0;
199
+ const t17 = isRequired || void 0;
200
+ let t18;
201
+ if ($[48] !== ref) {
202
+ t18 = mergeRefs(ref, inputRef);
203
+ $[48] = ref;
204
+ $[49] = t18;
205
+ } else t18 = $[49];
206
+ const t19 = isDirty || void 0;
207
+ const t20 = isRequired || void 0;
208
+ const t21 = value === null || value === void 0 || void 0;
209
+ const t22 = !("" + value === "" || value === null || value === void 0) || void 0;
210
+ const t23 = as === "floating" ? "\xA0" : inputProps.placeholder;
211
+ let t24;
212
+ if ($[50] !== inputProps || $[51] !== isFocusVisible) {
213
+ t24 = (e_1) => {
214
+ inputProps.onFocus?.(e_1);
215
+ if (isFocusVisible) e_1.target.select();
216
+ };
217
+ $[50] = inputProps;
218
+ $[51] = isFocusVisible;
219
+ $[52] = t24;
220
+ } else t24 = $[52];
221
+ let t25;
222
+ if ($[53] !== dataIsDisabled || $[54] !== inputProps || $[55] !== t18 || $[56] !== t19 || $[57] !== t20 || $[58] !== t21 || $[59] !== t22 || $[60] !== t23 || $[61] !== t24) {
223
+ t25 = /* @__PURE__ */ jsx(Input, {
224
+ ...inputProps,
225
+ ref: t18,
226
+ "data-is-dirty": t19,
227
+ "data-is-required": t20,
228
+ "data-is-empty": t21,
229
+ "data-is-filled": t22,
230
+ "data-is-disabled": dataIsDisabled,
231
+ placeholder: t23,
232
+ className: "w-full bg-transparent outline-none",
233
+ onFocus: t24
234
+ });
235
+ $[53] = dataIsDisabled;
236
+ $[54] = inputProps;
237
+ $[55] = t18;
238
+ $[56] = t19;
239
+ $[57] = t20;
240
+ $[58] = t21;
241
+ $[59] = t22;
242
+ $[60] = t23;
243
+ $[61] = t24;
244
+ $[62] = t25;
245
+ } else t25 = $[62];
246
+ let t26;
247
+ if ($[63] !== as || $[64] !== headerProps || $[65] !== inputContentProps || $[66] !== size || $[67] !== t25) {
248
+ t26 = /* @__PURE__ */ jsx(InputContent, {
249
+ ...inputContentProps,
250
+ headerProps,
251
+ as,
252
+ size,
253
+ children: t25
254
+ });
255
+ $[63] = as;
256
+ $[64] = headerProps;
257
+ $[65] = inputContentProps;
258
+ $[66] = size;
259
+ $[67] = t25;
260
+ $[68] = t26;
261
+ } else t26 = $[68];
262
+ let t27;
263
+ if ($[69] !== dataIsDisabled || $[70] !== t14 || $[71] !== t16 || $[72] !== t17 || $[73] !== t26) {
264
+ t27 = /* @__PURE__ */ jsx("div", {
265
+ className: t14,
266
+ onClick: t15,
267
+ "data-is-empty": t16,
268
+ "data-is-required": t17,
269
+ "data-is-disabled": dataIsDisabled,
270
+ children: t26
271
+ });
272
+ $[69] = dataIsDisabled;
273
+ $[70] = t14;
274
+ $[71] = t16;
275
+ $[72] = t17;
276
+ $[73] = t26;
277
+ $[74] = t27;
278
+ } else t27 = $[74];
279
+ let t28;
280
+ if ($[75] !== T1 || $[76] !== as || $[77] !== formFieldProps || $[78] !== labelProps || $[79] !== t12 || $[80] !== t13 || $[81] !== t27) {
281
+ t28 = /* @__PURE__ */ jsx(T1, {
94
282
  ...formFieldProps,
95
283
  as,
96
284
  labelProps,
97
- className: clsx("group w-full", className),
98
- tabIndex: as === "inline" ? -1 : void 0,
99
- children: /* @__PURE__ */ jsx("div", {
100
- className: clsx("relative flex cursor-text has-disabled:cursor-default", inputBaseCva({
101
- variant,
102
- as,
103
- ...rest
104
- }), inputClassName),
105
- onClick: () => inputRef.current?.focus(),
106
- "data-is-empty": value === null || value === void 0 || void 0,
107
- "data-is-required": isRequired || void 0,
108
- children: /* @__PURE__ */ jsx(InputContent, {
109
- ...inputContentProps,
110
- headerProps,
111
- as,
112
- size,
113
- children: /* @__PURE__ */ jsx(Input, {
114
- ...inputProps,
115
- ref: mergeRefs(ref, inputRef),
116
- "data-is-dirty": isDirty || void 0,
117
- "data-is-required": isRequired || void 0,
118
- "data-is-empty": value === null || value === void 0 || void 0,
119
- "data-is-filled": !("" + value === "" || value === null || value === void 0) || void 0,
120
- placeholder: as === "floating" ? "\xA0" : inputProps.placeholder,
121
- className: "w-full outline-none",
122
- onFocus: (e) => {
123
- inputProps.onFocus?.(e);
124
- if (isFocusVisible) e.target.select();
125
- }
126
- })
127
- })
128
- })
129
- })
130
- });
285
+ className: t12,
286
+ tabIndex: t13,
287
+ children: t27
288
+ });
289
+ $[75] = T1;
290
+ $[76] = as;
291
+ $[77] = formFieldProps;
292
+ $[78] = labelProps;
293
+ $[79] = t12;
294
+ $[80] = t13;
295
+ $[81] = t27;
296
+ $[82] = t28;
297
+ } else t28 = $[82];
298
+ let t29;
299
+ if ($[83] !== T0 || $[84] !== as || $[85] !== error || $[86] !== t11 || $[87] !== t28) {
300
+ t29 = /* @__PURE__ */ jsx(T0, {
301
+ as,
302
+ error,
303
+ triggerTabIndex: t11,
304
+ children: t28
305
+ });
306
+ $[83] = T0;
307
+ $[84] = as;
308
+ $[85] = error;
309
+ $[86] = t11;
310
+ $[87] = t28;
311
+ $[88] = t29;
312
+ } else t29 = $[88];
313
+ return t29;
131
314
  };
132
- var NumberInput = ({ renderStaticInput, ...props }) => {
315
+ var NumberInputInner = (t0) => {
316
+ const $ = c(9);
317
+ const { renderStaticInput, isFormControlDisabled, ...props } = t0;
133
318
  const ui = UIConfig.useConfig();
134
319
  const { locale } = useLocale();
135
320
  const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
136
321
  const inputRef = useRef(null);
137
- const { shouldFocus, renderRealInput, replayStaticInputChange } = useStaticInputHandoff({
138
- inputRef,
139
- renderInput,
140
- setRenderInput
141
- });
142
- const watchedValue = "formControl" in props && props.formControl ? useWatch({
143
- control: props.formControl.control,
144
- name: props.formControl.name
145
- }) : props.value;
146
- let isFormControlDisabled = false;
147
- if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
322
+ let t1;
323
+ if ($[0] !== renderInput) {
324
+ t1 = {
325
+ inputRef,
326
+ renderInput,
327
+ setRenderInput
328
+ };
329
+ $[0] = renderInput;
330
+ $[1] = t1;
331
+ } else t1 = $[1];
332
+ const { shouldFocus, renderRealInput, replayStaticInputChange } = useStaticInputHandoff(t1);
148
333
  if (!renderInput) {
149
- const staticValue = watchedValue ?? props.value ?? props.defaultValue;
334
+ const staticValue = props.value ?? props.defaultValue;
150
335
  const formatOptions = props.formatOptions ?? ui.numberInput.formatOptions;
151
336
  const displayValue = getStaticNumberDisplayValue(staticValue, new Intl.NumberFormat(locale, formatOptions)) ?? "";
152
337
  const hasValue = displayValue !== "";
@@ -163,15 +348,25 @@ var NumberInput = ({ renderStaticInput, ...props }) => {
163
348
  dataInvalid: !!props.error,
164
349
  dataHasSelection: hasValue
165
350
  };
351
+ const t2 = isDisabled;
352
+ const t3 = clsx("group w-full", as === "inline" && "h-full", props.className);
353
+ const t4 = props.inputClassName;
354
+ const t5 = as === "inline" && "h-full";
355
+ let t6;
356
+ if ($[2] !== t5) {
357
+ t6 = clsx(t5, "pr-0!");
358
+ $[2] = t5;
359
+ $[3] = t6;
360
+ } else t6 = $[3];
166
361
  return /* @__PURE__ */ jsx(InputFrame, {
167
362
  ...props,
168
- isDisabled,
169
- className: clsx("group w-full", as === "inline" && "h-full", props.className),
363
+ isDisabled: t2,
364
+ className: t3,
170
365
  dataAttributes,
171
366
  renderStatic: true,
172
367
  onStaticInteract: renderRealInput,
173
- inputClassName: props.inputClassName,
174
- contentClassName: "pr-0!",
368
+ inputClassName: t4,
369
+ contentClassName: t6,
175
370
  trailingClassName: "py-0! pl-0!",
176
371
  wrapContentAndTrailing: true,
177
372
  children: (dataAttributeProps) => /* @__PURE__ */ jsx("input", {
@@ -189,29 +384,103 @@ var NumberInput = ({ renderStaticInput, ...props }) => {
189
384
  })
190
385
  });
191
386
  }
192
- if ("formControl" in props && props.formControl) {
193
- const { formControl, ref, ...innerProps } = props;
194
- return /* @__PURE__ */ jsx(Controller, {
195
- control: formControl.control,
196
- name: formControl.name,
197
- render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(NumberInputBase, {
198
- ...innerProps,
199
- ref: mergeRefs(ref, field.ref, inputRef),
200
- value: field.value,
201
- onChange: field.onChange,
202
- onBlur: field.onBlur,
203
- isDirty,
204
- isDisabled: field.disabled || props.isDisabled,
205
- error: props.error ?? error?.message,
206
- autoFocusOnMount: shouldFocus
207
- }, field.value === null || field.value === void 0 ? "empty" : "filled")
387
+ const T0 = NumberInputBase;
388
+ const t2 = mergeRefs(props.ref, inputRef);
389
+ let t3;
390
+ if ($[4] !== T0 || $[5] !== props || $[6] !== shouldFocus || $[7] !== t2) {
391
+ t3 = /* @__PURE__ */ jsx(T0, {
392
+ ...props,
393
+ ref: t2,
394
+ autoFocusOnMount: shouldFocus
208
395
  });
396
+ $[4] = T0;
397
+ $[5] = props;
398
+ $[6] = shouldFocus;
399
+ $[7] = t2;
400
+ $[8] = t3;
401
+ } else t3 = $[8];
402
+ return t3;
403
+ };
404
+ var NumberInput = (t0) => {
405
+ const $ = c(21);
406
+ let props;
407
+ let renderStaticInput;
408
+ if ($[0] !== t0) {
409
+ ({renderStaticInput, ...props} = t0);
410
+ $[0] = t0;
411
+ $[1] = props;
412
+ $[2] = renderStaticInput;
413
+ } else {
414
+ props = $[1];
415
+ renderStaticInput = $[2];
209
416
  }
210
- return /* @__PURE__ */ jsx(NumberInputBase, {
211
- ...props,
212
- ref: mergeRefs(props.ref, inputRef),
213
- autoFocusOnMount: shouldFocus
214
- }, props.value === null || props.value === void 0 ? "empty" : "filled");
417
+ if ("formControl" in props && props.formControl) {
418
+ let formControl;
419
+ let innerProps;
420
+ let ref;
421
+ if ($[3] !== props) {
422
+ ({formControl, ref, ...innerProps} = props);
423
+ $[3] = props;
424
+ $[4] = formControl;
425
+ $[5] = innerProps;
426
+ $[6] = ref;
427
+ } else {
428
+ formControl = $[4];
429
+ innerProps = $[5];
430
+ ref = $[6];
431
+ }
432
+ const controlWithOptions = formControl.control;
433
+ let t1;
434
+ if ($[7] !== controlWithOptions._options?.disabled || $[8] !== innerProps || $[9] !== props.error || $[10] !== props.isDisabled || $[11] !== ref || $[12] !== renderStaticInput) {
435
+ t1 = (t2) => {
436
+ const { field, fieldState: t3 } = t2;
437
+ const { error, isDirty } = t3;
438
+ return /* @__PURE__ */ jsx(NumberInputInner, {
439
+ ...innerProps,
440
+ ref: mergeRefs(ref, field.ref),
441
+ value: field.value,
442
+ onChange: field.onChange,
443
+ onBlur: field.onBlur,
444
+ isDirty,
445
+ isDisabled: field.disabled || props.isDisabled,
446
+ isFormControlDisabled: !!controlWithOptions._options?.disabled,
447
+ error: props.error ?? error?.message,
448
+ renderStaticInput
449
+ });
450
+ };
451
+ $[7] = controlWithOptions._options?.disabled;
452
+ $[8] = innerProps;
453
+ $[9] = props.error;
454
+ $[10] = props.isDisabled;
455
+ $[11] = ref;
456
+ $[12] = renderStaticInput;
457
+ $[13] = t1;
458
+ } else t1 = $[13];
459
+ let t2;
460
+ if ($[14] !== formControl.control || $[15] !== formControl.name || $[16] !== t1) {
461
+ t2 = /* @__PURE__ */ jsx(Controller, {
462
+ control: formControl.control,
463
+ name: formControl.name,
464
+ render: t1
465
+ });
466
+ $[14] = formControl.control;
467
+ $[15] = formControl.name;
468
+ $[16] = t1;
469
+ $[17] = t2;
470
+ } else t2 = $[17];
471
+ return t2;
472
+ }
473
+ let t1;
474
+ if ($[18] !== props || $[19] !== renderStaticInput) {
475
+ t1 = /* @__PURE__ */ jsx(NumberInputInner, {
476
+ ...props,
477
+ renderStaticInput
478
+ });
479
+ $[18] = props;
480
+ $[19] = renderStaticInput;
481
+ $[20] = t1;
482
+ } else t1 = $[20];
483
+ return t1;
215
484
  };
216
485
  //#endregion
217
486
  export { NumberInput };