@povio/ui 2.3.0-rc.4 → 2.3.0-rc.40

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 (231) 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 +193 -34
  62. package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +24 -10
  63. package/dist/components/inputs/Checkbox/checkbox.cva.js +2 -0
  64. package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +1 -0
  65. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +289 -93
  66. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -0
  67. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +376 -189
  68. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +1 -0
  69. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +189 -75
  70. package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +1 -0
  71. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +559 -159
  72. package/dist/components/inputs/DateTime/shared/Calendar.js +333 -137
  73. package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +2 -1
  74. package/dist/components/inputs/DateTime/shared/CalendarCell.js +301 -102
  75. package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +2 -1
  76. package/dist/components/inputs/DateTime/shared/CalendarGrid.js +146 -33
  77. package/dist/components/inputs/DateTime/shared/CalendarHeader.js +245 -90
  78. package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
  79. package/dist/components/inputs/DateTime/shared/DateField.js +311 -112
  80. package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +7 -1
  81. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +374 -147
  82. package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +3 -2
  83. package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +93 -21
  84. package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +81 -27
  85. package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +59 -10
  86. package/dist/components/inputs/DateTime/shared/MonthPicker.js +103 -58
  87. package/dist/components/inputs/DateTime/shared/RangeCalendar.js +193 -82
  88. package/dist/components/inputs/DateTime/shared/TimeField.js +27 -8
  89. package/dist/components/inputs/DateTime/shared/TimePickerForm.js +279 -110
  90. package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +3 -1
  91. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +208 -70
  92. package/dist/components/inputs/DateTime/shared/YearPicker.js +119 -68
  93. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +9 -1
  94. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +43 -7
  95. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +16 -8
  96. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +46 -41
  97. package/dist/components/inputs/File/FileUpload.js +86 -44
  98. package/dist/components/inputs/File/FileUploadContainer.js +15 -7
  99. package/dist/components/inputs/File/InputUpload.js +317 -79
  100. package/dist/components/inputs/File/shared/FileCard.js +104 -41
  101. package/dist/components/inputs/File/shared/FileCardList.js +47 -12
  102. package/dist/components/inputs/File/shared/FileUploadContent.js +175 -44
  103. package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +149 -46
  104. package/dist/components/inputs/File/shared/FileUploadContentError.js +234 -93
  105. package/dist/components/inputs/File/shared/FileUploadContentFilled.js +230 -97
  106. package/dist/components/inputs/File/shared/FileUploadContentLoading.js +199 -55
  107. package/dist/components/inputs/File/shared/InputUploadContent.js +148 -35
  108. package/dist/components/inputs/File/shared/InputUploadFilled.js +50 -9
  109. package/dist/components/inputs/File/shared/ProgressBar.js +48 -9
  110. package/dist/components/inputs/FormField/FormField.js +119 -37
  111. package/dist/components/inputs/FormField/FormFieldError.js +25 -5
  112. package/dist/components/inputs/FormField/FormFieldHeader.js +79 -22
  113. package/dist/components/inputs/FormField/FormFieldHeaderClose.js +31 -7
  114. package/dist/components/inputs/FormField/FormFieldHelper.js +26 -6
  115. package/dist/components/inputs/FormField/FormFieldLabel.js +40 -9
  116. package/dist/components/inputs/Input/NumberInput/NumberInput.js +400 -125
  117. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +541 -116
  118. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +486 -146
  119. package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +48 -9
  120. package/dist/components/inputs/Input/TextArea/TextArea.js +298 -89
  121. package/dist/components/inputs/Input/TextInput/TextInput.js +370 -121
  122. package/dist/components/inputs/Input/shared/InputContent.js +190 -58
  123. package/dist/components/inputs/Inputs/Form.js +40 -11
  124. package/dist/components/inputs/Inputs/InputItem.d.ts +0 -1
  125. package/dist/components/inputs/Inputs/InputItem.js +65 -16
  126. package/dist/components/inputs/Inputs/Inputs.js +37 -11
  127. package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -0
  128. package/dist/components/inputs/RadioGroup/RadioGroup.js +320 -108
  129. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +146 -50
  130. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +4 -4
  131. package/dist/components/inputs/Selection/Select/QuerySelect.js +90 -28
  132. package/dist/components/inputs/Selection/Select/Select.js +140 -45
  133. package/dist/components/inputs/Selection/shared/SelectBase.js +69 -20
  134. package/dist/components/inputs/Selection/shared/SelectDesktop.js +390 -143
  135. package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
  136. package/dist/components/inputs/Selection/shared/SelectInput.js +328 -137
  137. package/dist/components/inputs/Selection/shared/SelectInputTags.js +99 -25
  138. package/dist/components/inputs/Selection/shared/SelectListBox.js +163 -51
  139. package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +85 -35
  140. package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +69 -16
  141. package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +70 -21
  142. package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +58 -9
  143. package/dist/components/inputs/Selection/shared/SelectMobile.js +3 -2
  144. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +9 -0
  145. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +47 -0
  146. package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +1 -0
  147. package/dist/components/inputs/Selection/shared/querySelect.utils.js +12 -1
  148. package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -2
  149. package/dist/components/inputs/Selection/shared/select.context.js +47 -39
  150. package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +5 -0
  151. package/dist/components/inputs/Selection/shared/selectInput.cva.js +5 -0
  152. package/dist/components/inputs/Selection/shared/useSelectItems.js +109 -49
  153. package/dist/components/inputs/Skeleton/InputFrame.d.ts +3 -0
  154. package/dist/components/inputs/Skeleton/InputFrame.js +445 -117
  155. package/dist/components/inputs/Slider/Slider.d.ts +2 -1
  156. package/dist/components/inputs/Slider/Slider.js +265 -78
  157. package/dist/components/inputs/TextEditor/TextEditor.js +447 -103
  158. package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +37 -11
  159. package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +102 -30
  160. package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +194 -45
  161. package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +88 -28
  162. package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +48 -14
  163. package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +66 -19
  164. package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +49 -15
  165. package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +92 -32
  166. package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +126 -54
  167. package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +141 -38
  168. package/dist/components/inputs/Toggle/Toggle.d.ts +1 -0
  169. package/dist/components/inputs/Toggle/Toggle.js +212 -41
  170. package/dist/components/inputs/Toggle/toggle.cva.js +2 -1
  171. package/dist/components/inputs/shared/CheckContent.js +21 -10
  172. package/dist/components/inputs/shared/InputClear.js +88 -21
  173. package/dist/components/inputs/shared/TooltipWrapper.js +47 -12
  174. package/dist/components/inputs/shared/input.cva.js +35 -13
  175. package/dist/components/inputs/shared/label.cva.js +2 -2
  176. package/dist/components/inputs/shared/useStaticInputHandoff.js +83 -40
  177. package/dist/components/navigation/Accordion/Accordion.js +69 -22
  178. package/dist/components/navigation/Accordion/AccordionItem.js +86 -41
  179. package/dist/components/navigation/Stepper/Stepper.js +67 -22
  180. package/dist/components/navigation/Stepper/StepperItem.js +104 -31
  181. package/dist/components/navigation/Stepper/StepperSeparator.js +23 -5
  182. package/dist/components/overlays/ActionModal/ActionModal.js +169 -35
  183. package/dist/components/overlays/BottomSheet/BottomSheet.js +122 -25
  184. package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +48 -8
  185. package/dist/components/overlays/Drawer/Drawer.js +62 -20
  186. package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +83 -27
  187. package/dist/components/overlays/Tooltip/Tooltip.js +137 -28
  188. package/dist/components/overlays/Tooltip/TooltipEllipsis.js +37 -12
  189. package/dist/components/segment/Segment.js +218 -57
  190. package/dist/components/segment/SegmentItem.js +67 -10
  191. package/dist/components/shared/pagination/Pagination.js +108 -22
  192. package/dist/components/shared/pagination/PaginationList.js +167 -64
  193. package/dist/components/status/Alert/Alert.js +97 -30
  194. package/dist/components/status/Loader/Loader.js +77 -22
  195. package/dist/components/status/Toast/Toast.js +21 -13
  196. package/dist/components/status/Toast/useToast.js +62 -57
  197. package/dist/components/table/ColumnConfig.js +158 -54
  198. package/dist/components/table/InfiniteTable.js +67 -16
  199. package/dist/components/table/PaginatedTable.js +84 -18
  200. package/dist/components/table/Table.js +23 -23
  201. package/dist/components/text/Link/Link.js +19 -7
  202. package/dist/components/text/Typography/Typography.js +23 -8
  203. package/dist/config/confirmation.context.js +1 -1
  204. package/dist/config/link.context.js +23 -9
  205. package/dist/config/router.context.js +42 -16
  206. package/dist/config/theme.context.js +98 -45
  207. package/dist/config/uiConfig.context.d.ts +7 -5
  208. package/dist/config/uiConfig.context.js +52 -12
  209. package/dist/config/uiStyle.context.js +15 -5
  210. package/dist/helpers/dynamicInputs.d.ts +1 -1
  211. package/dist/hooks/useBreakpoint.js +16 -3
  212. package/dist/hooks/useDebounceCallback.js +51 -17
  213. package/dist/hooks/useFilters.js +125 -64
  214. package/dist/hooks/useForm.js +42 -8
  215. package/dist/hooks/useFormAutosave.js +101 -30
  216. package/dist/hooks/useIntersectionObserver.js +86 -32
  217. package/dist/hooks/useLocalStorage.js +43 -10
  218. package/dist/hooks/useLongPressRepeat.js +55 -20
  219. package/dist/hooks/usePagination.js +49 -19
  220. package/dist/hooks/useQueryAutocomplete.js +1 -0
  221. package/dist/hooks/useScrollableListBox.js +37 -16
  222. package/dist/hooks/useSorting.js +69 -28
  223. package/dist/hooks/useStateAndRef.js +21 -7
  224. package/dist/hooks/useTableColumnConfig.js +124 -31
  225. package/dist/hooks/useTranslationMemo.js +25 -5
  226. package/dist/index.js +2 -2
  227. package/dist/tw-ui-plugin.js +6 -1
  228. package/dist/utils/date-time.utils.d.ts +7 -0
  229. package/dist/utils/date-time.utils.js +34 -23
  230. package/dist/utils/dom.utils.js +1 -1
  231. 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(90);
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,310 @@ 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
- 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;
60
+ const state = useNumberFieldState(numberProps);
61
+ const { labelProps, inputProps } = useNumberField(numberProps, state, numberFieldRef);
62
+ let t2;
63
+ let t3;
64
+ if ($[4] !== autoFocusOnMount || $[5] !== isDisabled) {
65
+ t2 = () => {
66
+ if (!autoFocusOnMount || isDisabled) return;
67
+ requestAnimationFrame(() => inputRef.current?.focus());
68
+ };
69
+ t3 = [autoFocusOnMount, isDisabled];
70
+ $[4] = autoFocusOnMount;
71
+ $[5] = isDisabled;
72
+ $[6] = t2;
73
+ $[7] = t3;
74
+ } else {
75
+ t2 = $[6];
76
+ t3 = $[7];
77
+ }
78
+ useEffect(t2, t3);
79
+ const t4 = isHeaderHidden || as === "inline" || as === "filter" || as === "floating";
80
+ let t5;
81
+ if ($[8] !== error || $[9] !== errorClassName || $[10] !== headerClassName || $[11] !== helperText || $[12] !== hideLabel || $[13] !== isDisabled || $[14] !== isRequired || $[15] !== label || $[16] !== rightContent || $[17] !== t4 || $[18] !== tooltipText) {
82
+ t5 = {
83
+ error,
84
+ label,
85
+ tooltipText,
86
+ helperText,
87
+ isRequired,
88
+ rightContent,
89
+ isHeaderHidden: t4,
90
+ hideLabel,
91
+ isDisabled,
92
+ headerClassName,
93
+ errorClassName
94
+ };
95
+ $[8] = error;
96
+ $[9] = errorClassName;
97
+ $[10] = headerClassName;
98
+ $[11] = helperText;
99
+ $[12] = hideLabel;
100
+ $[13] = isDisabled;
101
+ $[14] = isRequired;
102
+ $[15] = label;
103
+ $[16] = rightContent;
104
+ $[17] = t4;
105
+ $[18] = tooltipText;
106
+ $[19] = t5;
107
+ } else t5 = $[19];
108
+ const formFieldProps = t5;
109
+ let t6;
110
+ if ($[20] !== onBlur) {
111
+ t6 = (e_0) => {
112
+ const target = numberFieldRef.current ?? e_0?.target;
75
113
  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, {
114
+ };
115
+ $[20] = onBlur;
116
+ $[21] = t6;
117
+ } else t6 = $[21];
118
+ const handleInputBlur = t6;
119
+ let t7;
120
+ if ($[22] !== onChange || $[23] !== state) {
121
+ t7 = (val) => {
122
+ if (val === "") state.setInputValue("");
123
+ onChange?.(val === "" ? null : Number(val));
124
+ };
125
+ $[22] = onChange;
126
+ $[23] = state;
127
+ $[24] = t7;
128
+ } else t7 = $[24];
129
+ let t8;
130
+ if ($[25] !== action || $[26] !== handleInputBlur || $[27] !== isClearable || $[28] !== isDisabled || $[29] !== isLoading || $[30] !== leadingIcon || $[31] !== state.inputValue || $[32] !== t7 || $[33] !== trailingIcon || $[34] !== unit) {
131
+ t8 = {
132
+ unit,
133
+ isLoading,
134
+ isDisabled,
135
+ action,
136
+ leadingIcon,
137
+ trailingIcon,
138
+ isClearable,
139
+ onChange: t7,
140
+ value: state.inputValue,
141
+ onBlur: handleInputBlur
142
+ };
143
+ $[25] = action;
144
+ $[26] = handleInputBlur;
145
+ $[27] = isClearable;
146
+ $[28] = isDisabled;
147
+ $[29] = isLoading;
148
+ $[30] = leadingIcon;
149
+ $[31] = state.inputValue;
150
+ $[32] = t7;
151
+ $[33] = trailingIcon;
152
+ $[34] = unit;
153
+ $[35] = t8;
154
+ } else t8 = $[35];
155
+ const inputContentProps = t8;
156
+ const t9 = hideLabel || isHeaderHidden;
157
+ let t10;
158
+ if ($[36] !== headerClassName || $[37] !== helperText || $[38] !== isDisabled || $[39] !== isRequired || $[40] !== label || $[41] !== labelProps || $[42] !== rightContent || $[43] !== t9 || $[44] !== tooltipText) {
159
+ t10 = {
160
+ label,
161
+ tooltipText,
162
+ helperText,
163
+ isRequired,
164
+ rightContent,
165
+ isHeaderHidden: t9,
166
+ isDisabled,
167
+ className: headerClassName,
168
+ labelProps
169
+ };
170
+ $[36] = headerClassName;
171
+ $[37] = helperText;
172
+ $[38] = isDisabled;
173
+ $[39] = isRequired;
174
+ $[40] = label;
175
+ $[41] = labelProps;
176
+ $[42] = rightContent;
177
+ $[43] = t9;
178
+ $[44] = tooltipText;
179
+ $[45] = t10;
180
+ } else t10 = $[45];
181
+ const headerProps = t10;
182
+ const dataIsDisabled = isDisabled || void 0;
183
+ const T0 = TooltipWrapper;
184
+ const t11 = as === "inline" ? -1 : void 0;
185
+ const T1 = FormField;
186
+ let t12;
187
+ if ($[46] !== className) {
188
+ t12 = clsx("group w-full", className);
189
+ $[46] = className;
190
+ $[47] = t12;
191
+ } else t12 = $[47];
192
+ const t13 = as === "inline" ? -1 : void 0;
193
+ const t14 = clsx("relative flex cursor-text has-disabled:cursor-default", inputBaseCva({
194
+ variant,
90
195
  as,
91
- error,
92
- triggerTabIndex: as === "inline" ? -1 : void 0,
93
- children: /* @__PURE__ */ jsx(FormField, {
196
+ ...rest
197
+ }), inputClassName);
198
+ let t15;
199
+ if ($[48] === Symbol.for("react.memo_cache_sentinel")) {
200
+ t15 = () => inputRef.current?.focus();
201
+ $[48] = t15;
202
+ } else t15 = $[48];
203
+ const t16 = value === null || value === void 0 || void 0;
204
+ const t17 = isRequired || void 0;
205
+ let t18;
206
+ if ($[49] !== ref) {
207
+ t18 = mergeRefs(ref, inputRef, numberFieldRef);
208
+ $[49] = ref;
209
+ $[50] = t18;
210
+ } else t18 = $[50];
211
+ const t19 = isDirty || void 0;
212
+ const t20 = isRequired || void 0;
213
+ const t21 = state.inputValue === "" || state.inputValue === void 0 || state.inputValue === null || void 0;
214
+ const t22 = !("" + value === "" || value === null || value === void 0) || void 0;
215
+ const t23 = as === "floating" ? "\xA0" : inputProps.placeholder;
216
+ let t24;
217
+ if ($[51] !== inputProps || $[52] !== isFocusVisible) {
218
+ t24 = (e_1) => {
219
+ inputProps.onFocus?.(e_1);
220
+ if (isFocusVisible) e_1.target.select();
221
+ };
222
+ $[51] = inputProps;
223
+ $[52] = isFocusVisible;
224
+ $[53] = t24;
225
+ } else t24 = $[53];
226
+ let t25;
227
+ if ($[54] !== dataIsDisabled || $[55] !== inputProps || $[56] !== t18 || $[57] !== t19 || $[58] !== t20 || $[59] !== t21 || $[60] !== t22 || $[61] !== t23 || $[62] !== t24) {
228
+ t25 = /* @__PURE__ */ jsx(Input, {
229
+ ...inputProps,
230
+ ref: t18,
231
+ "data-is-dirty": t19,
232
+ "data-is-required": t20,
233
+ "data-is-empty": t21,
234
+ "data-is-filled": t22,
235
+ "data-is-disabled": dataIsDisabled,
236
+ placeholder: t23,
237
+ className: "w-full bg-transparent outline-none",
238
+ onFocus: t24
239
+ });
240
+ $[54] = dataIsDisabled;
241
+ $[55] = inputProps;
242
+ $[56] = t18;
243
+ $[57] = t19;
244
+ $[58] = t20;
245
+ $[59] = t21;
246
+ $[60] = t22;
247
+ $[61] = t23;
248
+ $[62] = t24;
249
+ $[63] = t25;
250
+ } else t25 = $[63];
251
+ let t26;
252
+ if ($[64] !== as || $[65] !== headerProps || $[66] !== inputContentProps || $[67] !== size || $[68] !== t25) {
253
+ t26 = /* @__PURE__ */ jsx(InputContent, {
254
+ ...inputContentProps,
255
+ headerProps,
256
+ as,
257
+ size,
258
+ children: t25
259
+ });
260
+ $[64] = as;
261
+ $[65] = headerProps;
262
+ $[66] = inputContentProps;
263
+ $[67] = size;
264
+ $[68] = t25;
265
+ $[69] = t26;
266
+ } else t26 = $[69];
267
+ let t27;
268
+ if ($[70] !== dataIsDisabled || $[71] !== t14 || $[72] !== t16 || $[73] !== t17 || $[74] !== t26) {
269
+ t27 = /* @__PURE__ */ jsx("div", {
270
+ className: t14,
271
+ onClick: t15,
272
+ "data-is-empty": t16,
273
+ "data-is-required": t17,
274
+ "data-is-disabled": dataIsDisabled,
275
+ children: t26
276
+ });
277
+ $[70] = dataIsDisabled;
278
+ $[71] = t14;
279
+ $[72] = t16;
280
+ $[73] = t17;
281
+ $[74] = t26;
282
+ $[75] = t27;
283
+ } else t27 = $[75];
284
+ let t28;
285
+ if ($[76] !== T1 || $[77] !== as || $[78] !== formFieldProps || $[79] !== labelProps || $[80] !== t12 || $[81] !== t13 || $[82] !== t27) {
286
+ t28 = /* @__PURE__ */ jsx(T1, {
94
287
  ...formFieldProps,
95
288
  as,
96
289
  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
- });
290
+ className: t12,
291
+ tabIndex: t13,
292
+ children: t27
293
+ });
294
+ $[76] = T1;
295
+ $[77] = as;
296
+ $[78] = formFieldProps;
297
+ $[79] = labelProps;
298
+ $[80] = t12;
299
+ $[81] = t13;
300
+ $[82] = t27;
301
+ $[83] = t28;
302
+ } else t28 = $[83];
303
+ let t29;
304
+ if ($[84] !== T0 || $[85] !== as || $[86] !== error || $[87] !== t11 || $[88] !== t28) {
305
+ t29 = /* @__PURE__ */ jsx(T0, {
306
+ as,
307
+ error,
308
+ triggerTabIndex: t11,
309
+ children: t28
310
+ });
311
+ $[84] = T0;
312
+ $[85] = as;
313
+ $[86] = error;
314
+ $[87] = t11;
315
+ $[88] = t28;
316
+ $[89] = t29;
317
+ } else t29 = $[89];
318
+ return t29;
131
319
  };
132
- var NumberInput = ({ renderStaticInput, ...props }) => {
320
+ var NumberInputInner = (t0) => {
321
+ const $ = c(9);
322
+ const { renderStaticInput, isFormControlDisabled, ...props } = t0;
133
323
  const ui = UIConfig.useConfig();
134
324
  const { locale } = useLocale();
135
325
  const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
136
326
  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;
327
+ let t1;
328
+ if ($[0] !== renderInput) {
329
+ t1 = {
330
+ inputRef,
331
+ renderInput,
332
+ setRenderInput
333
+ };
334
+ $[0] = renderInput;
335
+ $[1] = t1;
336
+ } else t1 = $[1];
337
+ const { shouldFocus, renderRealInput, replayStaticInputChange } = useStaticInputHandoff(t1);
148
338
  if (!renderInput) {
149
- const staticValue = watchedValue ?? props.value ?? props.defaultValue;
339
+ const staticValue = props.value ?? props.defaultValue;
150
340
  const formatOptions = props.formatOptions ?? ui.numberInput.formatOptions;
151
341
  const displayValue = getStaticNumberDisplayValue(staticValue, new Intl.NumberFormat(locale, formatOptions)) ?? "";
152
342
  const hasValue = displayValue !== "";
@@ -163,17 +353,28 @@ var NumberInput = ({ renderStaticInput, ...props }) => {
163
353
  dataInvalid: !!props.error,
164
354
  dataHasSelection: hasValue
165
355
  };
356
+ const t2 = isDisabled;
357
+ const t3 = clsx("group w-full", as === "inline" && "h-full", props.className);
358
+ const t4 = props.inputClassName;
359
+ const t5 = as === "inline" && "h-full";
360
+ let t6;
361
+ if ($[2] !== t5) {
362
+ t6 = clsx(t5, "pr-0!");
363
+ $[2] = t5;
364
+ $[3] = t6;
365
+ } else t6 = $[3];
166
366
  return /* @__PURE__ */ jsx(InputFrame, {
167
367
  ...props,
168
- isDisabled,
169
- className: clsx("group w-full", as === "inline" && "h-full", props.className),
368
+ isDisabled: t2,
369
+ className: t3,
170
370
  dataAttributes,
171
371
  renderStatic: true,
172
372
  onStaticInteract: renderRealInput,
173
- inputClassName: props.inputClassName,
174
- contentClassName: "pr-0!",
373
+ inputClassName: t4,
374
+ contentClassName: t6,
175
375
  trailingClassName: "py-0! pl-0!",
176
376
  wrapContentAndTrailing: true,
377
+ reserveTrailingContent: true,
177
378
  children: (dataAttributeProps) => /* @__PURE__ */ jsx("input", {
178
379
  type: "text",
179
380
  ref: inputRef,
@@ -182,36 +383,110 @@ var NumberInput = ({ renderStaticInput, ...props }) => {
182
383
  tabIndex: -1,
183
384
  value: displayValue,
184
385
  placeholder: as === "floating" ? "" : props.placeholder,
185
- className: "w-full bg-transparent outline-none placeholder:text-text-default-3 disabled:text-interactive-text-secondary-disabled",
386
+ className: "w-full bg-transparent outline-none",
186
387
  onChange: (event) => replayStaticInputChange(event.target.value),
187
388
  ...dataAttributeProps,
188
389
  "data-rac": true
189
390
  })
190
391
  });
191
392
  }
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")
393
+ const T0 = NumberInputBase;
394
+ const t2 = mergeRefs(props.ref, inputRef);
395
+ let t3;
396
+ if ($[4] !== T0 || $[5] !== props || $[6] !== shouldFocus || $[7] !== t2) {
397
+ t3 = /* @__PURE__ */ jsx(T0, {
398
+ ...props,
399
+ ref: t2,
400
+ autoFocusOnMount: shouldFocus
208
401
  });
402
+ $[4] = T0;
403
+ $[5] = props;
404
+ $[6] = shouldFocus;
405
+ $[7] = t2;
406
+ $[8] = t3;
407
+ } else t3 = $[8];
408
+ return t3;
409
+ };
410
+ var NumberInput = (t0) => {
411
+ const $ = c(21);
412
+ let props;
413
+ let renderStaticInput;
414
+ if ($[0] !== t0) {
415
+ ({renderStaticInput, ...props} = t0);
416
+ $[0] = t0;
417
+ $[1] = props;
418
+ $[2] = renderStaticInput;
419
+ } else {
420
+ props = $[1];
421
+ renderStaticInput = $[2];
209
422
  }
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");
423
+ if ("formControl" in props && props.formControl) {
424
+ let formControl;
425
+ let innerProps;
426
+ let ref;
427
+ if ($[3] !== props) {
428
+ ({formControl, ref, ...innerProps} = props);
429
+ $[3] = props;
430
+ $[4] = formControl;
431
+ $[5] = innerProps;
432
+ $[6] = ref;
433
+ } else {
434
+ formControl = $[4];
435
+ innerProps = $[5];
436
+ ref = $[6];
437
+ }
438
+ const controlWithOptions = formControl.control;
439
+ let t1;
440
+ if ($[7] !== controlWithOptions._options?.disabled || $[8] !== innerProps || $[9] !== props.error || $[10] !== props.isDisabled || $[11] !== ref || $[12] !== renderStaticInput) {
441
+ t1 = (t2) => {
442
+ const { field, fieldState: t3 } = t2;
443
+ const { error, isDirty } = t3;
444
+ return /* @__PURE__ */ jsx(NumberInputInner, {
445
+ ...innerProps,
446
+ ref: mergeRefs(ref, field.ref),
447
+ value: field.value,
448
+ onChange: field.onChange,
449
+ onBlur: field.onBlur,
450
+ isDirty,
451
+ isDisabled: field.disabled || props.isDisabled,
452
+ isFormControlDisabled: !!controlWithOptions._options?.disabled,
453
+ error: props.error ?? error?.message,
454
+ renderStaticInput
455
+ });
456
+ };
457
+ $[7] = controlWithOptions._options?.disabled;
458
+ $[8] = innerProps;
459
+ $[9] = props.error;
460
+ $[10] = props.isDisabled;
461
+ $[11] = ref;
462
+ $[12] = renderStaticInput;
463
+ $[13] = t1;
464
+ } else t1 = $[13];
465
+ let t2;
466
+ if ($[14] !== formControl.control || $[15] !== formControl.name || $[16] !== t1) {
467
+ t2 = /* @__PURE__ */ jsx(Controller, {
468
+ control: formControl.control,
469
+ name: formControl.name,
470
+ render: t1
471
+ });
472
+ $[14] = formControl.control;
473
+ $[15] = formControl.name;
474
+ $[16] = t1;
475
+ $[17] = t2;
476
+ } else t2 = $[17];
477
+ return t2;
478
+ }
479
+ let t1;
480
+ if ($[18] !== props || $[19] !== renderStaticInput) {
481
+ t1 = /* @__PURE__ */ jsx(NumberInputInner, {
482
+ ...props,
483
+ renderStaticInput
484
+ });
485
+ $[18] = props;
486
+ $[19] = renderStaticInput;
487
+ $[20] = t1;
488
+ } else t1 = $[20];
489
+ return t1;
215
490
  };
216
491
  //#endregion
217
492
  export { NumberInput };