@povio/ui 2.2.12 → 2.3.0-rc.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (284) hide show
  1. package/dist/assets/icons/AlignCenter.js +26 -11
  2. package/dist/assets/icons/AlignLeft.js +26 -11
  3. package/dist/assets/icons/AlignLeftRight.js +26 -11
  4. package/dist/assets/icons/AlignRight.js +26 -11
  5. package/dist/assets/icons/ArrowDropDown.js +26 -11
  6. package/dist/assets/icons/ArrowDropUp.js +26 -11
  7. package/dist/assets/icons/ArrowLeft.js +26 -11
  8. package/dist/assets/icons/ArrowRight.js +26 -11
  9. package/dist/assets/icons/Bold.js +26 -11
  10. package/dist/assets/icons/BulletedList.js +26 -11
  11. package/dist/assets/icons/Calendar.js +28 -13
  12. package/dist/assets/icons/Check.js +28 -13
  13. package/dist/assets/icons/CheckCircle.js +26 -11
  14. package/dist/assets/icons/CheckboxCheckmark.js +29 -14
  15. package/dist/assets/icons/CheckboxIndeterminate.js +29 -14
  16. package/dist/assets/icons/ChevronDown.js +28 -13
  17. package/dist/assets/icons/ChevronLeft.js +28 -13
  18. package/dist/assets/icons/ChevronRight.js +28 -13
  19. package/dist/assets/icons/ChevronUp.js +28 -13
  20. package/dist/assets/icons/ChevronsLeft.js +28 -13
  21. package/dist/assets/icons/ChevronsRight.js +28 -13
  22. package/dist/assets/icons/Clock.js +26 -11
  23. package/dist/assets/icons/Close.js +26 -11
  24. package/dist/assets/icons/DateTime.js +35 -14
  25. package/dist/assets/icons/DragIndicator.js +26 -11
  26. package/dist/assets/icons/File.js +28 -13
  27. package/dist/assets/icons/Highlight.js +26 -11
  28. package/dist/assets/icons/HighlightOn.js +49 -15
  29. package/dist/assets/icons/Home.js +26 -11
  30. package/dist/assets/icons/Info.js +37 -16
  31. package/dist/assets/icons/Italic.js +26 -11
  32. package/dist/assets/icons/Link.js +26 -11
  33. package/dist/assets/icons/Menu.js +26 -11
  34. package/dist/assets/icons/NumberedList.js +26 -11
  35. package/dist/assets/icons/PointerHorizontal.js +26 -11
  36. package/dist/assets/icons/PointerVertical.js +26 -11
  37. package/dist/assets/icons/Search.js +26 -11
  38. package/dist/assets/icons/Send.js +28 -13
  39. package/dist/assets/icons/Strikethrough.js +26 -11
  40. package/dist/assets/icons/TextColor.js +48 -14
  41. package/dist/assets/icons/Today.js +26 -11
  42. package/dist/assets/icons/Underlined.js +28 -13
  43. package/dist/assets/icons/Upload.js +35 -14
  44. package/dist/assets/icons/Visibility.js +26 -11
  45. package/dist/assets/icons/VisibilityOff.js +26 -11
  46. package/dist/assets/icons/WarningFilled.js +28 -13
  47. package/dist/components/Breadcrumbs/Breadcrumbs.js +207 -56
  48. package/dist/components/Menu/Menu.js +18 -2
  49. package/dist/components/Menu/MenuDesktop.js +41 -7
  50. package/dist/components/Menu/MenuItem.js +32 -9
  51. package/dist/components/Menu/MenuMobile.js +97 -38
  52. package/dist/components/Menu/MenuPopover.js +105 -29
  53. package/dist/components/buttons/IconButton/IconButton.js +40 -8
  54. package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +2 -1
  55. package/dist/components/buttons/InlineIconButton/InlineIconButton.js +34 -9
  56. package/dist/components/buttons/PillButton/PillButton.js +55 -17
  57. package/dist/components/buttons/SplitButton/SplitButton.js +103 -18
  58. package/dist/components/buttons/TextButton/TextButton.js +30 -8
  59. package/dist/components/buttons/ToggleButton/ToggleButton.js +28 -8
  60. package/dist/components/buttons/shared/ButtonContent.js +80 -22
  61. package/dist/components/inputs/Checkbox/Checkbox.js +172 -35
  62. package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +24 -10
  63. package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +3 -0
  64. package/dist/components/inputs/Checkbox/checkbox.cva.js +2 -1
  65. package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +10 -5
  66. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +121 -20
  67. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +10 -5
  68. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +215 -111
  69. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +11 -5
  70. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +123 -19
  71. package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +5 -3
  72. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +448 -104
  73. package/dist/components/inputs/DateTime/shared/Calendar.d.ts +5 -2
  74. package/dist/components/inputs/DateTime/shared/Calendar.js +330 -119
  75. package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +1 -1
  76. package/dist/components/inputs/DateTime/shared/CalendarCell.js +283 -102
  77. package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +1 -1
  78. package/dist/components/inputs/DateTime/shared/CalendarGrid.js +142 -33
  79. package/dist/components/inputs/DateTime/shared/CalendarHeader.js +249 -93
  80. package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
  81. package/dist/components/inputs/DateTime/shared/DateField.js +296 -112
  82. package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +6 -3
  83. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +355 -135
  84. package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +14 -0
  85. package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +97 -11
  86. package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +81 -27
  87. package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +59 -10
  88. package/dist/components/inputs/DateTime/shared/MonthPicker.js +103 -58
  89. package/dist/components/inputs/DateTime/shared/RangeCalendar.js +193 -82
  90. package/dist/components/inputs/DateTime/shared/TimeField.js +27 -8
  91. package/dist/components/inputs/DateTime/shared/TimePickerForm.js +279 -110
  92. package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +2 -1
  93. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +207 -65
  94. package/dist/components/inputs/DateTime/shared/YearPicker.js +119 -68
  95. package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +4 -0
  96. package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +7 -0
  97. package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +13 -0
  98. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +6 -0
  99. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +21 -0
  100. package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +2 -0
  101. package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +1 -0
  102. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +31 -0
  103. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +80 -0
  104. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +1 -0
  105. package/dist/components/inputs/File/FileUpload.js +87 -44
  106. package/dist/components/inputs/File/FileUploadContainer.js +15 -7
  107. package/dist/components/inputs/File/InputUpload.js +317 -79
  108. package/dist/components/inputs/File/shared/FileCard.js +104 -41
  109. package/dist/components/inputs/File/shared/FileCardList.js +47 -12
  110. package/dist/components/inputs/File/shared/FileUploadContent.js +175 -44
  111. package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +149 -46
  112. package/dist/components/inputs/File/shared/FileUploadContentError.js +234 -93
  113. package/dist/components/inputs/File/shared/FileUploadContentFilled.js +230 -97
  114. package/dist/components/inputs/File/shared/FileUploadContentLoading.js +199 -55
  115. package/dist/components/inputs/File/shared/InputUploadContent.js +148 -34
  116. package/dist/components/inputs/File/shared/InputUploadFilled.js +49 -8
  117. package/dist/components/inputs/File/shared/ProgressBar.js +48 -9
  118. package/dist/components/inputs/FormField/FormField.d.ts +3 -3
  119. package/dist/components/inputs/FormField/FormField.js +119 -37
  120. package/dist/components/inputs/FormField/FormFieldError.js +25 -5
  121. package/dist/components/inputs/FormField/FormFieldHeader.d.ts +2 -2
  122. package/dist/components/inputs/FormField/FormFieldHeader.js +81 -22
  123. package/dist/components/inputs/FormField/FormFieldHeaderClose.js +31 -7
  124. package/dist/components/inputs/FormField/FormFieldHelper.js +26 -6
  125. package/dist/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
  126. package/dist/components/inputs/FormField/FormFieldLabel.js +40 -9
  127. package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +6 -0
  128. package/dist/components/inputs/FormField/formFieldHeader.cva.js +11 -0
  129. package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +5 -2
  130. package/dist/components/inputs/Input/NumberInput/NumberInput.js +332 -81
  131. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.d.ts +45 -0
  132. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +571 -0
  133. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +35 -0
  134. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +479 -0
  135. package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +48 -9
  136. package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +4 -0
  137. package/dist/components/inputs/Input/TextArea/TextArea.cva.js +5 -0
  138. package/dist/components/inputs/Input/TextArea/TextArea.js +305 -90
  139. package/dist/components/inputs/Input/TextInput/TextInput.d.ts +3 -1
  140. package/dist/components/inputs/Input/TextInput/TextInput.js +321 -80
  141. package/dist/components/inputs/Input/shared/InputContent.js +192 -59
  142. package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +1 -0
  143. package/dist/components/inputs/Input/shared/numberStatic.utils.js +7 -0
  144. package/dist/components/inputs/Inputs/Form.js +40 -11
  145. package/dist/components/inputs/Inputs/InputItem.d.ts +15 -21
  146. package/dist/components/inputs/Inputs/InputItem.js +69 -14
  147. package/dist/components/inputs/Inputs/Inputs.js +37 -11
  148. package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +2 -1
  149. package/dist/components/inputs/RadioGroup/RadioGroup.js +352 -60
  150. package/dist/components/inputs/RadioGroup/radio.cva.d.ts +17 -0
  151. package/dist/components/inputs/RadioGroup/radio.cva.js +42 -1
  152. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +6 -2
  153. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +109 -7
  154. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +3 -18
  155. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +34 -8
  156. package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +36 -0
  157. package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +14 -0
  158. package/dist/components/inputs/Selection/Select/QuerySelect.js +122 -0
  159. package/dist/components/inputs/Selection/Select/Select.d.ts +7 -3
  160. package/dist/components/inputs/Selection/Select/Select.js +132 -5
  161. package/dist/components/inputs/Selection/shared/SelectBase.d.ts +8 -1
  162. package/dist/components/inputs/Selection/shared/SelectBase.js +69 -18
  163. package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
  164. package/dist/components/inputs/Selection/shared/SelectDesktop.js +393 -138
  165. package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
  166. package/dist/components/inputs/Selection/shared/SelectInput.js +337 -115
  167. package/dist/components/inputs/Selection/shared/SelectInputTags.js +99 -25
  168. package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
  169. package/dist/components/inputs/Selection/shared/SelectListBox.js +164 -52
  170. package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +85 -35
  171. package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +69 -16
  172. package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +70 -21
  173. package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +58 -9
  174. package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
  175. package/dist/components/inputs/Selection/shared/SelectMobile.js +9 -3
  176. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +9 -0
  177. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +47 -0
  178. package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +6 -0
  179. package/dist/components/inputs/Selection/shared/querySelect.utils.js +13 -0
  180. package/dist/components/inputs/Selection/shared/select.context.d.ts +3 -2
  181. package/dist/components/inputs/Selection/shared/select.context.js +57 -34
  182. package/dist/components/inputs/Selection/shared/select.types.d.ts +3 -2
  183. package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +3 -0
  184. package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +5 -0
  185. package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +5 -0
  186. package/dist/components/inputs/Selection/shared/selectInput.cva.js +5 -0
  187. package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +23 -0
  188. package/dist/components/inputs/Selection/shared/staticSelect.utils.js +37 -0
  189. package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +1 -0
  190. package/dist/components/inputs/Selection/shared/useSelectItems.js +109 -49
  191. package/dist/components/inputs/Skeleton/InputFrame.d.ts +79 -0
  192. package/dist/components/inputs/Skeleton/InputFrame.js +526 -0
  193. package/dist/components/inputs/Slider/Slider.js +250 -74
  194. package/dist/components/inputs/TextEditor/TextEditor.d.ts +1 -0
  195. package/dist/components/inputs/TextEditor/TextEditor.js +447 -98
  196. package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +37 -11
  197. package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +102 -30
  198. package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +194 -45
  199. package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +88 -28
  200. package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +48 -14
  201. package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +66 -19
  202. package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +49 -15
  203. package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +92 -32
  204. package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +126 -54
  205. package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +141 -38
  206. package/dist/components/inputs/Toggle/Toggle.js +189 -37
  207. package/dist/components/inputs/Toggle/toggle.cva.d.ts +3 -0
  208. package/dist/components/inputs/Toggle/toggle.cva.js +2 -1
  209. package/dist/components/inputs/shared/CheckContent.d.ts +2 -1
  210. package/dist/components/inputs/shared/CheckContent.js +21 -11
  211. package/dist/components/inputs/shared/InputClear.d.ts +2 -1
  212. package/dist/components/inputs/shared/InputClear.js +79 -10
  213. package/dist/components/inputs/shared/StaticInput.d.ts +38 -0
  214. package/dist/components/inputs/shared/TooltipWrapper.js +50 -11
  215. package/dist/components/inputs/shared/input.cva.d.ts +10 -0
  216. package/dist/components/inputs/shared/input.cva.js +32 -4
  217. package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +4 -0
  218. package/dist/components/inputs/shared/tooltipWrapper.cva.js +5 -0
  219. package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +14 -0
  220. package/dist/components/inputs/shared/useStaticInputHandoff.js +100 -0
  221. package/dist/components/navigation/Accordion/Accordion.js +69 -22
  222. package/dist/components/navigation/Accordion/AccordionItem.js +86 -41
  223. package/dist/components/navigation/Stepper/Stepper.js +67 -22
  224. package/dist/components/navigation/Stepper/StepperItem.js +104 -31
  225. package/dist/components/navigation/Stepper/StepperSeparator.js +23 -5
  226. package/dist/components/overlays/ActionModal/ActionModal.js +169 -35
  227. package/dist/components/overlays/BottomSheet/BottomSheet.js +96 -23
  228. package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +48 -8
  229. package/dist/components/overlays/Drawer/Drawer.js +62 -20
  230. package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +83 -27
  231. package/dist/components/overlays/Tooltip/Tooltip.js +137 -28
  232. package/dist/components/overlays/Tooltip/TooltipEllipsis.js +37 -12
  233. package/dist/components/segment/Segment.js +218 -57
  234. package/dist/components/segment/SegmentItem.js +67 -10
  235. package/dist/components/shared/pagination/Pagination.js +108 -22
  236. package/dist/components/shared/pagination/PaginationList.js +167 -64
  237. package/dist/components/status/Alert/Alert.js +97 -30
  238. package/dist/components/status/Loader/Loader.js +77 -22
  239. package/dist/components/status/Toast/Toast.js +21 -13
  240. package/dist/components/status/Toast/useToast.js +62 -57
  241. package/dist/components/table/ColumnConfig.js +158 -54
  242. package/dist/components/table/InfiniteTable.js +67 -16
  243. package/dist/components/table/PaginatedTable.js +84 -18
  244. package/dist/components/table/Table.js +28 -27
  245. package/dist/components/text/Link/Link.js +19 -7
  246. package/dist/components/text/Typography/Typography.js +23 -8
  247. package/dist/config/confirmation.context.js +1 -1
  248. package/dist/config/link.context.js +23 -9
  249. package/dist/config/router.context.d.ts +3 -4
  250. package/dist/config/router.context.js +42 -18
  251. package/dist/config/theme.context.js +98 -45
  252. package/dist/config/uiConfig.context.d.ts +15 -3
  253. package/dist/config/uiConfig.context.js +55 -11
  254. package/dist/config/uiStyle.context.d.ts +27 -4
  255. package/dist/config/uiStyle.context.js +15 -5
  256. package/dist/helpers/dynamicInputs.d.ts +5 -5
  257. package/dist/helpers/dynamicInputs.js +3 -0
  258. package/dist/hooks/useBreakpoint.js +16 -3
  259. package/dist/hooks/useDebounceCallback.js +51 -17
  260. package/dist/hooks/useFilters.js +145 -80
  261. package/dist/hooks/useForm.js +42 -8
  262. package/dist/hooks/useFormAutosave.js +101 -30
  263. package/dist/hooks/useIntersectionObserver.d.ts +1 -1
  264. package/dist/hooks/useIntersectionObserver.js +91 -24
  265. package/dist/hooks/useLocalStorage.js +43 -10
  266. package/dist/hooks/useLongPressRepeat.js +55 -20
  267. package/dist/hooks/usePagination.js +51 -17
  268. package/dist/hooks/useQueryAutocomplete.d.ts +14 -0
  269. package/dist/hooks/useQueryAutocomplete.js +57 -0
  270. package/dist/hooks/useScrollableListBox.js +37 -16
  271. package/dist/hooks/useSorting.js +71 -27
  272. package/dist/hooks/useStateAndRef.js +21 -7
  273. package/dist/hooks/useTableColumnConfig.js +124 -31
  274. package/dist/hooks/useTranslationMemo.js +25 -5
  275. package/dist/index.d.ts +7 -0
  276. package/dist/index.js +5 -3
  277. package/dist/tw-ui-plugin.js +2 -0
  278. package/dist/utils/date-time.utils.d.ts +31 -10
  279. package/dist/utils/date-time.utils.js +117 -22
  280. package/dist/utils/query.utils.d.ts +4 -0
  281. package/dist/utils/query.utils.js +8 -0
  282. package/dist/utils/routing.utils.d.ts +1 -0
  283. package/dist/utils/routing.utils.js +14 -0
  284. package/package.json +2 -2
@@ -3,110 +3,346 @@ import { UIConfig } from "../../../../config/uiConfig.context.js";
3
3
  import { inputBase } from "../../shared/input.cva.js";
4
4
  import { FormField } from "../../FormField/FormField.js";
5
5
  import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
6
+ import { InputFrame } from "../../Skeleton/InputFrame.js";
7
+ import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
6
8
  import { InputContent } from "../shared/InputContent.js";
9
+ import { c } from "react/compiler-runtime";
7
10
  import { jsx } from "react/jsx-runtime";
8
11
  import { clsx } from "clsx";
9
- import { useRef } from "react";
12
+ import { useEffect, useRef, useState } from "react";
10
13
  import { Input } from "react-aria-components";
11
14
  import { useFocusVisible, useTextField } from "react-aria";
12
15
  import { mergeRefs } from "@react-aria/utils";
13
- import { Controller } from "react-hook-form";
16
+ import { Controller, useWatch } from "react-hook-form";
14
17
  //#region src/components/inputs/Input/TextInput/TextInput.tsx
15
18
  var TextInputBase = (props) => {
19
+ const $ = c(83);
16
20
  const ui = UIConfig.useConfig();
17
21
  const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
18
22
  const inputRef = useRef(null);
19
- const { ref, inputClassName, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, className, unit, isLoading, action, leadingIcon, trailingIcon, value, onChange, onBlur, as = ui.input.as, hideLabel = ui.input.hideLabel, variant = ui.input.variant, size = ui.input.size, isClearable = ui.input.isClearable, ...rest } = props;
23
+ const { ref, inputClassName, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, className, unit, isLoading, action, leadingIcon, trailingIcon, value, onChange, onBlur, as: asProp, hideLabel: hideLabelProp, variant: variantProp, size: sizeProp, isClearable: isClearableProp, autoFocusOnMount, ...rest } = props;
24
+ const as = asProp ?? ui.input.as;
25
+ const hideLabel = hideLabelProp ?? ui.input.hideLabel;
26
+ const variant = variantProp ?? ui.input.variant;
27
+ const size = sizeProp ?? ui.input.size;
28
+ const isClearable = isClearableProp ?? ui.input.isClearable;
20
29
  const textFieldRef = useRef(null);
21
30
  const { isFocusVisible } = useFocusVisible();
31
+ const inputValue = value ?? "";
22
32
  const { labelProps, inputProps } = useTextField({
23
33
  ...rest,
24
34
  label,
25
35
  isDisabled,
26
36
  isInvalid: !!error,
27
37
  isRequired,
28
- value,
38
+ value: inputValue,
29
39
  onChange,
30
40
  onBlur
31
41
  }, textFieldRef);
32
- const formFieldProps = {
33
- error,
34
- label,
35
- tooltipText,
36
- helperText,
37
- isRequired,
38
- rightContent,
39
- isHeaderHidden: isHeaderHidden || as === "inline" || as === "filter" || as === "floating",
40
- hideLabel,
41
- isDisabled,
42
- headerClassName,
43
- errorClassName
44
- };
45
- const inputContentProps = {
46
- unit,
47
- isLoading,
48
- isDisabled,
49
- action,
50
- leadingIcon,
51
- trailingIcon,
52
- isClearable,
53
- value,
54
- onChange,
55
- onBlur
56
- };
57
- const headerProps = {
58
- label,
59
- tooltipText,
60
- helperText,
61
- isRequired,
62
- rightContent,
63
- isHeaderHidden: hideLabel || isHeaderHidden,
64
- isDisabled,
65
- className: headerClassName,
66
- labelProps
67
- };
68
- return /* @__PURE__ */ jsx(TooltipWrapper, {
42
+ let t0;
43
+ let t1;
44
+ if ($[0] !== autoFocusOnMount || $[1] !== isDisabled) {
45
+ t0 = () => {
46
+ if (!autoFocusOnMount || isDisabled) return;
47
+ requestAnimationFrame(() => inputRef.current?.focus());
48
+ };
49
+ t1 = [autoFocusOnMount, isDisabled];
50
+ $[0] = autoFocusOnMount;
51
+ $[1] = isDisabled;
52
+ $[2] = t0;
53
+ $[3] = t1;
54
+ } else {
55
+ t0 = $[2];
56
+ t1 = $[3];
57
+ }
58
+ useEffect(t0, t1);
59
+ const t2 = isHeaderHidden || as === "inline" || as === "filter" || as === "floating";
60
+ let t3;
61
+ if ($[4] !== error || $[5] !== errorClassName || $[6] !== headerClassName || $[7] !== helperText || $[8] !== hideLabel || $[9] !== isDisabled || $[10] !== isRequired || $[11] !== label || $[12] !== rightContent || $[13] !== t2 || $[14] !== tooltipText) {
62
+ t3 = {
63
+ error,
64
+ label,
65
+ tooltipText,
66
+ helperText,
67
+ isRequired,
68
+ rightContent,
69
+ isHeaderHidden: t2,
70
+ hideLabel,
71
+ isDisabled,
72
+ headerClassName,
73
+ errorClassName
74
+ };
75
+ $[4] = error;
76
+ $[5] = errorClassName;
77
+ $[6] = headerClassName;
78
+ $[7] = helperText;
79
+ $[8] = hideLabel;
80
+ $[9] = isDisabled;
81
+ $[10] = isRequired;
82
+ $[11] = label;
83
+ $[12] = rightContent;
84
+ $[13] = t2;
85
+ $[14] = tooltipText;
86
+ $[15] = t3;
87
+ } else t3 = $[15];
88
+ const formFieldProps = t3;
89
+ let t4;
90
+ if ($[16] !== action || $[17] !== inputValue || $[18] !== isClearable || $[19] !== isDisabled || $[20] !== isLoading || $[21] !== leadingIcon || $[22] !== onBlur || $[23] !== onChange || $[24] !== trailingIcon || $[25] !== unit) {
91
+ t4 = {
92
+ unit,
93
+ isLoading,
94
+ isDisabled,
95
+ action,
96
+ leadingIcon,
97
+ trailingIcon,
98
+ isClearable,
99
+ value: inputValue,
100
+ onChange,
101
+ onBlur
102
+ };
103
+ $[16] = action;
104
+ $[17] = inputValue;
105
+ $[18] = isClearable;
106
+ $[19] = isDisabled;
107
+ $[20] = isLoading;
108
+ $[21] = leadingIcon;
109
+ $[22] = onBlur;
110
+ $[23] = onChange;
111
+ $[24] = trailingIcon;
112
+ $[25] = unit;
113
+ $[26] = t4;
114
+ } else t4 = $[26];
115
+ const inputContentProps = t4;
116
+ const t5 = hideLabel || isHeaderHidden;
117
+ let t6;
118
+ if ($[27] !== headerClassName || $[28] !== helperText || $[29] !== isDisabled || $[30] !== isRequired || $[31] !== label || $[32] !== labelProps || $[33] !== rightContent || $[34] !== t5 || $[35] !== tooltipText) {
119
+ t6 = {
120
+ label,
121
+ tooltipText,
122
+ helperText,
123
+ isRequired,
124
+ rightContent,
125
+ isHeaderHidden: t5,
126
+ isDisabled,
127
+ className: headerClassName,
128
+ labelProps
129
+ };
130
+ $[27] = headerClassName;
131
+ $[28] = helperText;
132
+ $[29] = isDisabled;
133
+ $[30] = isRequired;
134
+ $[31] = label;
135
+ $[32] = labelProps;
136
+ $[33] = rightContent;
137
+ $[34] = t5;
138
+ $[35] = tooltipText;
139
+ $[36] = t6;
140
+ } else t6 = $[36];
141
+ const headerProps = t6;
142
+ const T0 = TooltipWrapper;
143
+ const t7 = as === "inline" ? -1 : void 0;
144
+ const T1 = FormField;
145
+ const t8 = as === "inline" && "h-full";
146
+ let t9;
147
+ if ($[37] !== className || $[38] !== t8) {
148
+ t9 = clsx("group w-full", t8, className);
149
+ $[37] = className;
150
+ $[38] = t8;
151
+ $[39] = t9;
152
+ } else t9 = $[39];
153
+ const t10 = as === "inline" ? -1 : void 0;
154
+ const t11 = value === "" || value === null || value === void 0 || void 0;
155
+ const t12 = isRequired || void 0;
156
+ const t13 = clsx("relative flex cursor-text has-disabled:cursor-default", inputBaseCva({
157
+ variant,
69
158
  as,
70
- error,
71
- triggerTabIndex: as === "inline" ? -1 : void 0,
72
- children: /* @__PURE__ */ jsx(FormField, {
159
+ ...rest
160
+ }), inputClassName);
161
+ let t14;
162
+ if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
163
+ t14 = () => inputRef.current?.focus();
164
+ $[40] = t14;
165
+ } else t14 = $[40];
166
+ const t15 = value === "" || value === null || value === void 0 || void 0;
167
+ const t16 = isRequired || void 0;
168
+ let t17;
169
+ if ($[41] !== ref) {
170
+ t17 = mergeRefs(ref, inputRef);
171
+ $[41] = ref;
172
+ $[42] = t17;
173
+ } else t17 = $[42];
174
+ const t18 = value === "" || value === null || value === void 0 || void 0;
175
+ const t19 = !(value === "" || value === null || value === void 0) || void 0;
176
+ const t20 = isDirty || void 0;
177
+ const t21 = isRequired || void 0;
178
+ const t22 = isDisabled || void 0;
179
+ const t23 = as === "floating" ? "\xA0" : inputProps.placeholder;
180
+ let t24;
181
+ if ($[43] !== inputProps || $[44] !== isFocusVisible) {
182
+ t24 = (e) => {
183
+ inputProps.onFocus?.(e);
184
+ if (isFocusVisible) e.target.select();
185
+ };
186
+ $[43] = inputProps;
187
+ $[44] = isFocusVisible;
188
+ $[45] = t24;
189
+ } else t24 = $[45];
190
+ let t25;
191
+ if ($[46] !== inputProps || $[47] !== t17 || $[48] !== t18 || $[49] !== t19 || $[50] !== t20 || $[51] !== t21 || $[52] !== t22 || $[53] !== t23 || $[54] !== t24) {
192
+ t25 = /* @__PURE__ */ jsx(Input, {
193
+ ...inputProps,
194
+ ref: t17,
195
+ "data-is-empty": t18,
196
+ "data-is-filled": t19,
197
+ "data-is-dirty": t20,
198
+ "data-is-required": t21,
199
+ "data-is-disabled": t22,
200
+ placeholder: t23,
201
+ className: "w-full outline-none",
202
+ onFocus: t24
203
+ });
204
+ $[46] = inputProps;
205
+ $[47] = t17;
206
+ $[48] = t18;
207
+ $[49] = t19;
208
+ $[50] = t20;
209
+ $[51] = t21;
210
+ $[52] = t22;
211
+ $[53] = t23;
212
+ $[54] = t24;
213
+ $[55] = t25;
214
+ } else t25 = $[55];
215
+ let t26;
216
+ if ($[56] !== as || $[57] !== headerProps || $[58] !== inputContentProps || $[59] !== size || $[60] !== t25) {
217
+ t26 = /* @__PURE__ */ jsx(InputContent, {
218
+ ...inputContentProps,
219
+ headerProps,
220
+ as,
221
+ size,
222
+ children: t25
223
+ });
224
+ $[56] = as;
225
+ $[57] = headerProps;
226
+ $[58] = inputContentProps;
227
+ $[59] = size;
228
+ $[60] = t25;
229
+ $[61] = t26;
230
+ } else t26 = $[61];
231
+ let t27;
232
+ if ($[62] !== t13 || $[63] !== t15 || $[64] !== t16 || $[65] !== t26) {
233
+ t27 = /* @__PURE__ */ jsx("div", {
234
+ className: t13,
235
+ onClick: t14,
236
+ "data-is-empty": t15,
237
+ "data-is-required": t16,
238
+ children: t26
239
+ });
240
+ $[62] = t13;
241
+ $[63] = t15;
242
+ $[64] = t16;
243
+ $[65] = t26;
244
+ $[66] = t27;
245
+ } else t27 = $[66];
246
+ let t28;
247
+ if ($[67] !== T1 || $[68] !== as || $[69] !== formFieldProps || $[70] !== labelProps || $[71] !== t10 || $[72] !== t11 || $[73] !== t12 || $[74] !== t27 || $[75] !== t9) {
248
+ t28 = /* @__PURE__ */ jsx(T1, {
73
249
  ...formFieldProps,
74
250
  as,
75
251
  labelProps,
76
- className: clsx("group w-full", as === "inline" && "h-full", className),
77
- tabIndex: as === "inline" ? -1 : void 0,
78
- children: /* @__PURE__ */ jsx("div", {
79
- className: clsx("relative flex cursor-text has-disabled:cursor-default", inputBaseCva({
80
- variant,
81
- as,
82
- ...rest
83
- }), inputClassName),
84
- onClick: () => inputRef.current?.focus(),
85
- children: /* @__PURE__ */ jsx(InputContent, {
86
- ...inputContentProps,
87
- headerProps,
88
- as,
89
- size,
90
- children: /* @__PURE__ */ jsx(Input, {
91
- ...inputProps,
92
- ref: mergeRefs(ref, inputRef),
93
- "data-is-empty": value === "" || value === null || value === void 0 || void 0,
94
- "data-is-dirty": isDirty || void 0,
95
- "data-is-required": isRequired || void 0,
96
- "data-is-disabled": isDisabled || void 0,
97
- placeholder: as === "floating" ? "\xA0" : inputProps.placeholder,
98
- className: "w-full outline-none",
99
- onFocus: (e) => {
100
- inputProps.onFocus?.(e);
101
- if (isFocusVisible) e.target.select();
102
- }
103
- })
104
- })
105
- })
106
- })
107
- });
252
+ className: t9,
253
+ tabIndex: t10,
254
+ "data-is-empty": t11,
255
+ "data-is-required": t12,
256
+ children: t27
257
+ });
258
+ $[67] = T1;
259
+ $[68] = as;
260
+ $[69] = formFieldProps;
261
+ $[70] = labelProps;
262
+ $[71] = t10;
263
+ $[72] = t11;
264
+ $[73] = t12;
265
+ $[74] = t27;
266
+ $[75] = t9;
267
+ $[76] = t28;
268
+ } else t28 = $[76];
269
+ let t29;
270
+ if ($[77] !== T0 || $[78] !== as || $[79] !== error || $[80] !== t28 || $[81] !== t7) {
271
+ t29 = /* @__PURE__ */ jsx(T0, {
272
+ as,
273
+ error,
274
+ triggerTabIndex: t7,
275
+ children: t28
276
+ });
277
+ $[77] = T0;
278
+ $[78] = as;
279
+ $[79] = error;
280
+ $[80] = t28;
281
+ $[81] = t7;
282
+ $[82] = t29;
283
+ } else t29 = $[82];
284
+ return t29;
108
285
  };
109
- var TextInput = (props) => {
286
+ var TextInput = ({ renderStaticInput, ...props }) => {
287
+ const ui = UIConfig.useConfig();
288
+ const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
289
+ const inputRef = useRef(null);
290
+ const { shouldFocus, renderRealInput, replayStaticInputChange } = useStaticInputHandoff({
291
+ inputRef,
292
+ renderInput,
293
+ setRenderInput
294
+ });
295
+ const watchedValue = "formControl" in props && props.formControl ? useWatch({
296
+ control: props.formControl.control,
297
+ name: props.formControl.name
298
+ }) : props.value;
299
+ let isFormControlDisabled = false;
300
+ if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
301
+ const staticValue = watchedValue ?? props.value ?? props.defaultValue ?? "";
302
+ const inputType = props.type;
303
+ if (!renderInput && inputType === "password" && `${staticValue}`.length > 0) setRenderInput(true);
304
+ if (!renderInput) {
305
+ const as = props.as ?? ui.input.as;
306
+ let isDisabled = !!props.isDisabled;
307
+ if (isFormControlDisabled) isDisabled = true;
308
+ const maskedPasswordValue = inputType === "password" && `${staticValue}`.length > 0 ? "•".repeat(`${staticValue}`.length) : staticValue;
309
+ const displayValue = maskedPasswordValue == null ? "" : `${maskedPasswordValue}`;
310
+ const hasValue = displayValue !== "";
311
+ const dataAttributes = {
312
+ dataIsEmpty: !hasValue,
313
+ dataIsFilled: hasValue,
314
+ dataIsDirty: props.isDirty,
315
+ dataIsRequired: props.isRequired,
316
+ dataIsDisabled: isDisabled,
317
+ dataDisabled: isDisabled,
318
+ dataInvalid: !!props.error,
319
+ dataHasSelection: hasValue
320
+ };
321
+ return /* @__PURE__ */ jsx(InputFrame, {
322
+ ...props,
323
+ isDisabled,
324
+ className: clsx("group w-full", as === "inline" && "h-full", props.className),
325
+ dataAttributes,
326
+ renderStatic: true,
327
+ onStaticInteract: renderRealInput,
328
+ inputClassName: props.inputClassName,
329
+ contentClassName: clsx(as === "inline" && "h-full", "pr-0!"),
330
+ trailingClassName: "py-0! pl-0!",
331
+ wrapContentAndTrailing: true,
332
+ children: (dataAttributeProps) => /* @__PURE__ */ jsx("input", {
333
+ ref: inputRef,
334
+ type: inputType === "hidden" ? "password" : inputType,
335
+ disabled: isDisabled,
336
+ tabIndex: -1,
337
+ value: displayValue,
338
+ placeholder: as === "floating" ? "" : props.placeholder,
339
+ className: "w-full bg-transparent outline-none placeholder:text-text-default-3 disabled:text-interactive-text-secondary-disabled",
340
+ onChange: (event) => replayStaticInputChange(event.target.value),
341
+ ...dataAttributeProps,
342
+ "data-rac": true
343
+ })
344
+ });
345
+ }
110
346
  if ("formControl" in props && props.formControl) {
111
347
  const { formControl, ref, ...innerProps } = props;
112
348
  return /* @__PURE__ */ jsx(Controller, {
@@ -114,17 +350,22 @@ var TextInput = (props) => {
114
350
  name: formControl.name,
115
351
  render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(TextInputBase, {
116
352
  ...innerProps,
117
- ref: mergeRefs(ref, field.ref),
353
+ ref: mergeRefs(ref, field.ref, inputRef),
118
354
  value: field.value,
119
355
  onChange: field.onChange,
120
356
  onBlur: field.onBlur,
121
357
  isDirty,
122
358
  isDisabled: field.disabled || props.isDisabled,
123
- error: props.error ?? error?.message
359
+ error: props.error ?? error?.message,
360
+ autoFocusOnMount: shouldFocus
124
361
  })
125
362
  });
126
363
  }
127
- return /* @__PURE__ */ jsx(TextInputBase, { ...props });
364
+ return /* @__PURE__ */ jsx(TextInputBase, {
365
+ ...props,
366
+ ref: mergeRefs(props.ref, inputRef),
367
+ autoFocusOnMount: shouldFocus
368
+ });
128
369
  };
129
370
  //#endregion
130
371
  export { TextInput };