@povio/ui 3.0.0-rc.3 → 3.1.0

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 (309) hide show
  1. package/README.md +39 -0
  2. package/dist/assets/icons/AlignCenter.js +11 -26
  3. package/dist/assets/icons/AlignLeft.js +11 -26
  4. package/dist/assets/icons/AlignLeftRight.js +11 -26
  5. package/dist/assets/icons/AlignRight.js +11 -26
  6. package/dist/assets/icons/ArrowDropDown.js +11 -26
  7. package/dist/assets/icons/ArrowDropUp.js +11 -26
  8. package/dist/assets/icons/ArrowLeft.js +11 -26
  9. package/dist/assets/icons/ArrowRight.js +11 -26
  10. package/dist/assets/icons/Bold.js +11 -26
  11. package/dist/assets/icons/BulletedList.js +11 -26
  12. package/dist/assets/icons/Calendar.js +13 -28
  13. package/dist/assets/icons/Check.js +13 -28
  14. package/dist/assets/icons/CheckCircle.js +11 -26
  15. package/dist/assets/icons/CheckboxCheckmark.js +14 -29
  16. package/dist/assets/icons/CheckboxIndeterminate.js +14 -29
  17. package/dist/assets/icons/ChevronDown.js +13 -28
  18. package/dist/assets/icons/ChevronLeft.js +13 -28
  19. package/dist/assets/icons/ChevronRight.js +13 -28
  20. package/dist/assets/icons/ChevronUp.js +13 -28
  21. package/dist/assets/icons/ChevronsLeft.js +13 -28
  22. package/dist/assets/icons/ChevronsRight.js +13 -28
  23. package/dist/assets/icons/Clock.js +11 -26
  24. package/dist/assets/icons/Close.js +11 -26
  25. package/dist/assets/icons/DateTime.js +14 -35
  26. package/dist/assets/icons/DragIndicator.js +11 -26
  27. package/dist/assets/icons/File.js +13 -28
  28. package/dist/assets/icons/Highlight.js +11 -26
  29. package/dist/assets/icons/HighlightOn.js +15 -49
  30. package/dist/assets/icons/Home.js +11 -26
  31. package/dist/assets/icons/Info.js +16 -37
  32. package/dist/assets/icons/Italic.js +11 -26
  33. package/dist/assets/icons/Link.js +11 -26
  34. package/dist/assets/icons/Menu.js +11 -26
  35. package/dist/assets/icons/NumberedList.js +11 -26
  36. package/dist/assets/icons/PointerHorizontal.js +11 -26
  37. package/dist/assets/icons/PointerVertical.js +11 -26
  38. package/dist/assets/icons/Search.js +11 -26
  39. package/dist/assets/icons/Send.js +13 -28
  40. package/dist/assets/icons/Strikethrough.js +11 -26
  41. package/dist/assets/icons/TextColor.js +14 -48
  42. package/dist/assets/icons/Today.js +11 -26
  43. package/dist/assets/icons/Underlined.js +13 -28
  44. package/dist/assets/icons/Upload.js +14 -35
  45. package/dist/assets/icons/Visibility.js +11 -26
  46. package/dist/assets/icons/VisibilityOff.js +11 -26
  47. package/dist/assets/icons/WarningFilled.js +13 -28
  48. package/dist/components/Breadcrumbs/Breadcrumbs.js +56 -207
  49. package/dist/components/Menu/Menu.d.ts +4 -0
  50. package/dist/components/Menu/Menu.js +2 -18
  51. package/dist/components/Menu/MenuDesktop.js +7 -41
  52. package/dist/components/Menu/MenuItem.js +9 -32
  53. package/dist/components/Menu/MenuMobile.d.ts +1 -1
  54. package/dist/components/Menu/MenuMobile.js +39 -97
  55. package/dist/components/Menu/MenuPopover.js +29 -105
  56. package/dist/components/buttons/IconButton/IconButton.js +8 -40
  57. package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +1 -2
  58. package/dist/components/buttons/InlineIconButton/InlineIconButton.js +9 -34
  59. package/dist/components/buttons/PillButton/PillButton.js +17 -55
  60. package/dist/components/buttons/SplitButton/SplitButton.js +18 -103
  61. package/dist/components/buttons/TextButton/TextButton.js +8 -30
  62. package/dist/components/buttons/ToggleButton/ToggleButton.js +8 -28
  63. package/dist/components/buttons/shared/ButtonContent.js +22 -80
  64. package/dist/components/inputs/Checkbox/Checkbox.d.ts +0 -1
  65. package/dist/components/inputs/Checkbox/Checkbox.js +35 -201
  66. package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +10 -24
  67. package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +0 -3
  68. package/dist/components/inputs/Checkbox/checkbox.cva.js +1 -2
  69. package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +5 -12
  70. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +75 -373
  71. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +5 -12
  72. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +186 -492
  73. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +5 -14
  74. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +47 -273
  75. package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +3 -7
  76. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +121 -611
  77. package/dist/components/inputs/DateTime/shared/Calendar.d.ts +3 -5
  78. package/dist/components/inputs/DateTime/shared/Calendar.js +120 -338
  79. package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +2 -4
  80. package/dist/components/inputs/DateTime/shared/CalendarCell.js +103 -310
  81. package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +2 -4
  82. package/dist/components/inputs/DateTime/shared/CalendarGrid.js +33 -150
  83. package/dist/components/inputs/DateTime/shared/CalendarHeader.d.ts +2 -1
  84. package/dist/components/inputs/DateTime/shared/CalendarHeader.js +98 -249
  85. package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +137 -318
  86. package/dist/components/inputs/DateTime/shared/DateField.js +112 -286
  87. package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +3 -14
  88. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +129 -356
  89. package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +0 -15
  90. package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +11 -96
  91. package/dist/components/inputs/DateTime/shared/DateTimeDialog.d.ts +4 -1
  92. package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +28 -81
  93. package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +10 -59
  94. package/dist/components/inputs/DateTime/shared/MonthPicker.js +58 -103
  95. package/dist/components/inputs/DateTime/shared/RangeCalendar.js +82 -193
  96. package/dist/components/inputs/DateTime/shared/TimeField.js +8 -27
  97. package/dist/components/inputs/DateTime/shared/TimePickerForm.js +110 -279
  98. package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +1 -4
  99. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +65 -210
  100. package/dist/components/inputs/DateTime/shared/YearPicker.js +68 -119
  101. package/dist/components/inputs/File/FileUpload.js +45 -88
  102. package/dist/components/inputs/File/FileUploadContainer.js +7 -15
  103. package/dist/components/inputs/File/InputUpload.js +79 -317
  104. package/dist/components/inputs/File/shared/FileCard.js +41 -104
  105. package/dist/components/inputs/File/shared/FileCardList.js +12 -47
  106. package/dist/components/inputs/File/shared/FileUploadContent.js +44 -175
  107. package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +46 -149
  108. package/dist/components/inputs/File/shared/FileUploadContentError.js +93 -234
  109. package/dist/components/inputs/File/shared/FileUploadContentFilled.js +97 -230
  110. package/dist/components/inputs/File/shared/FileUploadContentLoading.js +55 -199
  111. package/dist/components/inputs/File/shared/InputUploadContent.js +34 -148
  112. package/dist/components/inputs/File/shared/InputUploadFilled.js +8 -49
  113. package/dist/components/inputs/File/shared/ProgressBar.d.ts +2 -2
  114. package/dist/components/inputs/File/shared/ProgressBar.js +20 -53
  115. package/dist/components/inputs/File/shared/fileUpload.cva.d.ts +1 -1
  116. package/dist/components/inputs/File/shared/fileUpload.cva.js +1 -1
  117. package/dist/components/inputs/File/shared/progressBar.cva.d.ts +38 -0
  118. package/dist/components/inputs/File/shared/progressBar.cva.js +28 -0
  119. package/dist/components/inputs/FormField/FormField.d.ts +3 -3
  120. package/dist/components/inputs/FormField/FormField.js +37 -119
  121. package/dist/components/inputs/FormField/FormFieldError.js +5 -25
  122. package/dist/components/inputs/FormField/FormFieldHeader.d.ts +2 -2
  123. package/dist/components/inputs/FormField/FormFieldHeader.js +22 -81
  124. package/dist/components/inputs/FormField/FormFieldHeaderClose.js +7 -31
  125. package/dist/components/inputs/FormField/FormFieldHelper.js +6 -26
  126. package/dist/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
  127. package/dist/components/inputs/FormField/FormFieldLabel.js +9 -40
  128. package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +2 -5
  129. package/dist/components/inputs/Input/NumberInput/NumberInput.js +97 -447
  130. package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +9 -48
  131. package/dist/components/inputs/Input/TextArea/TextArea.js +90 -305
  132. package/dist/components/inputs/Input/TextInput/TextInput.d.ts +1 -3
  133. package/dist/components/inputs/Input/TextInput/TextInput.js +90 -419
  134. package/dist/components/inputs/Input/shared/InputContent.js +59 -192
  135. package/dist/components/inputs/Inputs/Form.js +11 -40
  136. package/dist/components/inputs/Inputs/InputItem.d.ts +21 -15
  137. package/dist/components/inputs/Inputs/InputItem.js +14 -69
  138. package/dist/components/inputs/Inputs/Inputs.js +11 -37
  139. package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -3
  140. package/dist/components/inputs/RadioGroup/RadioGroup.js +61 -353
  141. package/dist/components/inputs/RadioGroup/radio.cva.d.ts +0 -45
  142. package/dist/components/inputs/RadioGroup/radio.cva.js +1 -48
  143. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +2 -6
  144. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +22 -217
  145. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +18 -3
  146. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +8 -107
  147. package/dist/components/inputs/Selection/Select/Select.d.ts +3 -7
  148. package/dist/components/inputs/Selection/Select/Select.js +18 -227
  149. package/dist/components/inputs/Selection/shared/SelectBase.d.ts +3 -8
  150. package/dist/components/inputs/Selection/shared/SelectBase.js +18 -69
  151. package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
  152. package/dist/components/inputs/Selection/shared/SelectDesktop.js +138 -393
  153. package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
  154. package/dist/components/inputs/Selection/shared/SelectInput.js +116 -397
  155. package/dist/components/inputs/Selection/shared/SelectInputTags.js +25 -99
  156. package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
  157. package/dist/components/inputs/Selection/shared/SelectListBox.js +52 -164
  158. package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +35 -85
  159. package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +16 -69
  160. package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +21 -70
  161. package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +9 -58
  162. package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
  163. package/dist/components/inputs/Selection/shared/SelectMobile.js +6 -11
  164. package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -3
  165. package/dist/components/inputs/Selection/shared/select.context.js +36 -67
  166. package/dist/components/inputs/Selection/shared/select.types.d.ts +2 -3
  167. package/dist/components/inputs/Selection/shared/useSelectItems.js +49 -109
  168. package/dist/components/inputs/Slider/Slider.d.ts +1 -2
  169. package/dist/components/inputs/Slider/Slider.js +76 -265
  170. package/dist/components/inputs/TextEditor/TextEditor.d.ts +0 -1
  171. package/dist/components/inputs/TextEditor/TextEditor.js +98 -447
  172. package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +11 -37
  173. package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +30 -102
  174. package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +45 -194
  175. package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +28 -88
  176. package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +14 -48
  177. package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +19 -66
  178. package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +15 -49
  179. package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +32 -92
  180. package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +54 -126
  181. package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +38 -141
  182. package/dist/components/inputs/Toggle/Toggle.d.ts +0 -1
  183. package/dist/components/inputs/Toggle/Toggle.js +37 -214
  184. package/dist/components/inputs/Toggle/toggle.cva.d.ts +0 -3
  185. package/dist/components/inputs/Toggle/toggle.cva.js +1 -2
  186. package/dist/components/inputs/shared/CheckContent.d.ts +1 -2
  187. package/dist/components/inputs/shared/CheckContent.js +11 -21
  188. package/dist/components/inputs/shared/InputClear.d.ts +1 -2
  189. package/dist/components/inputs/shared/InputClear.js +12 -88
  190. package/dist/components/inputs/shared/TooltipWrapper.js +11 -50
  191. package/dist/components/inputs/shared/input.cva.d.ts +0 -28
  192. package/dist/components/inputs/shared/input.cva.js +4 -38
  193. package/dist/components/navigation/Accordion/Accordion.js +22 -69
  194. package/dist/components/navigation/Accordion/AccordionItem.js +41 -86
  195. package/dist/components/navigation/Stepper/Stepper.js +22 -67
  196. package/dist/components/navigation/Stepper/StepperItem.js +31 -104
  197. package/dist/components/navigation/Stepper/StepperSeparator.js +5 -23
  198. package/dist/components/overlays/ActionModal/ActionModal.js +35 -169
  199. package/dist/components/overlays/BottomSheet/BottomSheet.js +25 -98
  200. package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +8 -48
  201. package/dist/components/overlays/Drawer/Drawer.js +22 -64
  202. package/dist/components/overlays/Modal/modal.cva.js +1 -1
  203. package/dist/components/overlays/ResponsivePopover/ResponsivePopover.d.ts +5 -1
  204. package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +28 -83
  205. package/dist/components/overlays/Tooltip/Tooltip.js +28 -137
  206. package/dist/components/overlays/Tooltip/TooltipEllipsis.js +12 -37
  207. package/dist/components/segment/Segment.js +57 -218
  208. package/dist/components/segment/SegmentItem.js +10 -67
  209. package/dist/components/shared/pagination/Pagination.js +22 -108
  210. package/dist/components/shared/pagination/PaginationList.js +64 -167
  211. package/dist/components/status/Alert/Alert.js +30 -97
  212. package/dist/components/status/Loader/Loader.js +22 -77
  213. package/dist/components/status/Toast/Toast.js +17 -22
  214. package/dist/components/status/Toast/toast.cva.d.ts +14 -3
  215. package/dist/components/status/Toast/toast.cva.js +12 -10
  216. package/dist/components/status/Toast/useToast.js +57 -62
  217. package/dist/components/table/ColumnConfig.js +54 -158
  218. package/dist/components/table/InfiniteTable.js +16 -67
  219. package/dist/components/table/PaginatedTable.js +18 -84
  220. package/dist/components/table/Table.js +30 -30
  221. package/dist/components/table/table.cva.d.ts +7 -0
  222. package/dist/components/table/table.cva.js +2 -1
  223. package/dist/components/text/Link/Link.js +7 -19
  224. package/dist/components/text/Pill/Pill.d.ts +15 -0
  225. package/dist/components/text/Pill/Pill.js +44 -0
  226. package/dist/components/text/Typography/Typography.js +8 -23
  227. package/dist/config/confirmation.context.js +1 -1
  228. package/dist/config/link.context.js +9 -23
  229. package/dist/config/router.context.js +16 -42
  230. package/dist/config/theme.context.js +45 -98
  231. package/dist/config/uiConfig.context.d.ts +10 -21
  232. package/dist/config/uiConfig.context.js +18 -69
  233. package/dist/config/uiOverrides.context.d.ts +10 -20
  234. package/dist/config/uiOverrides.context.js +14 -54
  235. package/dist/helpers/dynamicInputs.d.ts +5 -5
  236. package/dist/helpers/dynamicInputs.js +0 -3
  237. package/dist/hooks/useAutosave.d.ts +1 -2
  238. package/dist/hooks/useAutosave.js +4 -12
  239. package/dist/hooks/useBreakpoint.js +3 -16
  240. package/dist/hooks/useDebounceCallback.js +17 -51
  241. package/dist/hooks/useFilters.js +64 -125
  242. package/dist/hooks/useForm.js +8 -42
  243. package/dist/hooks/useFormAutosave.d.ts +1 -3
  244. package/dist/hooks/useFormAutosave.js +30 -122
  245. package/dist/hooks/useIntersectionObserver.d.ts +1 -1
  246. package/dist/hooks/useIntersectionObserver.js +24 -91
  247. package/dist/hooks/useLocalStorage.js +10 -43
  248. package/dist/hooks/useLongPressRepeat.js +20 -55
  249. package/dist/hooks/usePagination.js +19 -49
  250. package/dist/hooks/useScrollableListBox.js +16 -37
  251. package/dist/hooks/useSorting.js +28 -69
  252. package/dist/hooks/useStateAndRef.js +7 -21
  253. package/dist/hooks/useTableColumnConfig.js +31 -124
  254. package/dist/hooks/useTranslationMemo.js +5 -25
  255. package/dist/index.d.ts +7 -16
  256. package/dist/index.js +6 -13
  257. package/dist/tw-ui-plugin.js +0 -6
  258. package/dist/utils/date-time.utils.d.ts +10 -38
  259. package/dist/utils/date-time.utils.js +22 -136
  260. package/package.json +1 -1
  261. package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +0 -5
  262. package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +0 -16
  263. package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +0 -16
  264. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +0 -15
  265. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +0 -32
  266. package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +0 -2
  267. package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +0 -1
  268. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +0 -40
  269. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +0 -85
  270. package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +0 -1
  271. package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +0 -13
  272. package/dist/components/inputs/FormField/formFieldHeader.cva.js +0 -14
  273. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.d.ts +0 -45
  274. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +0 -571
  275. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +0 -35
  276. package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +0 -575
  277. package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +0 -8
  278. package/dist/components/inputs/Input/TextArea/TextArea.cva.js +0 -5
  279. package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +0 -1
  280. package/dist/components/inputs/Input/shared/numberStatic.utils.js +0 -7
  281. package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +0 -37
  282. package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +0 -14
  283. package/dist/components/inputs/Selection/Select/QuerySelect.js +0 -178
  284. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +0 -9
  285. package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +0 -47
  286. package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +0 -14
  287. package/dist/components/inputs/Selection/shared/querySelect.utils.js +0 -43
  288. package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +0 -6
  289. package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +0 -5
  290. package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +0 -12
  291. package/dist/components/inputs/Selection/shared/selectInput.cva.js +0 -8
  292. package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +0 -23
  293. package/dist/components/inputs/Selection/shared/staticSelect.utils.js +0 -54
  294. package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +0 -1
  295. package/dist/components/inputs/Skeleton/InputFrame.d.ts +0 -82
  296. package/dist/components/inputs/Skeleton/InputFrame.js +0 -548
  297. package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +0 -8
  298. package/dist/components/inputs/shared/tooltipWrapper.cva.js +0 -5
  299. package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +0 -14
  300. package/dist/components/inputs/shared/useStaticInputHandoff.js +0 -100
  301. package/dist/hooks/useAutosave.spec.d.ts +0 -1
  302. package/dist/hooks/useFormAutosave.spec.d.ts +0 -1
  303. package/dist/hooks/useKeyInteractions.d.ts +0 -20
  304. package/dist/hooks/useKeyInteractions.js +0 -54
  305. package/dist/hooks/useKeyInteractions.spec.d.ts +0 -1
  306. package/dist/hooks/useQueryAutocomplete.d.ts +0 -14
  307. package/dist/hooks/useQueryAutocomplete.js +0 -72
  308. package/dist/utils/query.utils.d.ts +0 -4
  309. package/dist/utils/query.utils.js +0 -8
@@ -1,225 +1,30 @@
1
- import { UIOverrides } from "../../../../config/uiOverrides.context.js";
2
- import { UIConfig } from "../../../../config/uiConfig.context.js";
3
- import { InputFrame } from "../../Skeleton/InputFrame.js";
4
- import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
5
- import { selectInputTagsContentWrapperDefinition } from "../shared/selectInput.cva.js";
6
1
  import { SelectBase } from "../shared/SelectBase.js";
7
- import { StaticSelectTrailingContent } from "../shared/StaticSelectTrailingContent.js";
8
- import { getStaticSelectValue } from "../shared/staticSelect.utils.js";
9
- import { c } from "react/compiler-runtime";
10
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
- import { clsx } from "clsx";
12
- import { useRef, useState } from "react";
2
+ import { jsx } from "react/jsx-runtime";
13
3
  import { mergeRefs } from "@react-aria/utils";
14
4
  import { Controller } from "react-hook-form";
15
5
  //#region src/components/inputs/Selection/Autocomplete/Autocomplete.tsx
16
- function AutocompleteInner(t0) {
17
- const $ = c(8);
18
- const { renderStaticInput, isFormControlDisabled, ...props } = t0;
19
- const ui = UIConfig.useConfig();
20
- const selectInputTagsContentWrapperCva = UIOverrides.useCva("select.tagsContentWrapperCva", selectInputTagsContentWrapperDefinition);
21
- const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
22
- const rootRef = useRef(null);
23
- let t1;
24
- if ($[0] !== renderInput) {
25
- t1 = {
26
- inputRef: rootRef,
27
- renderInput,
28
- setRenderInput,
29
- getFocusTarget: _temp
30
- };
31
- $[0] = renderInput;
32
- $[1] = t1;
33
- } else t1 = $[1];
34
- const { renderRealInput, replayStaticInputChange } = useStaticInputHandoff(t1);
35
- const currentValue = props.value;
36
- if (!renderInput && !!props.customTrigger) setRenderInput(true);
37
- if (!renderInput) {
38
- const as = props.as ?? ui.input.as;
39
- const size = props.size ?? ui.input.size;
40
- let isDisabled = !!props.isDisabled;
41
- if (isFormControlDisabled) isDisabled = true;
42
- const mode = props.selectionMode ?? ui.select.selectionMode;
43
- const { selectedItem, displayValue, isEmpty } = getStaticSelectValue({
44
- items: props.items,
45
- value: currentValue,
46
- selectionMode: mode,
47
- initialSelection: props.initialSelection,
48
- mapInitialToSelectItem: props.mapInitialToSelectItem,
49
- showSelectionContent: props.showSelectionContent,
50
- isDisabled,
51
- collapseAfter: props.collapseAfter ?? ui.select.collapseAfter,
52
- selectedTagsType: props.selectedTagsType ?? ui.select.selectedTagsType
53
- });
54
- const isMultiple = mode === "multiple";
55
- const trailingContent = /* @__PURE__ */ jsx(StaticSelectTrailingContent, {
56
- trailingContent: props.trailingContent,
57
- hideDropdownIcon: props.hideDropdownIcon,
58
- isDisabled,
59
- size
60
- });
61
- const placeholder = as === "floating" ? null : props.placeholder;
62
- const shouldRenderPlaceholderAfterValue = mode !== "single" && props.placeholder && !isEmpty;
63
- const inputValue = !isMultiple && selectedItem ? selectedItem.label : "";
64
- const dataAttributes = {
65
- dataIsEmpty: isEmpty,
66
- dataIsFilled: !isEmpty,
67
- dataIsDirty: props.isDirty,
68
- dataIsRequired: props.isRequired,
69
- dataIsDisabled: isDisabled,
70
- dataDisabled: isDisabled,
71
- dataInvalid: !!props.error,
72
- dataHasSelection: !isEmpty,
73
- dataHasSearch: false
74
- };
75
- const t2 = isDisabled;
76
- const t3 = clsx("w-full", props.containerClassName);
77
- const t4 = clsx(props.className, props.inputClassName);
78
- let t5;
79
- if ($[2] !== selectInputTagsContentWrapperCva) {
80
- t5 = selectInputTagsContentWrapperCva({ isSearchable: true });
81
- $[2] = selectInputTagsContentWrapperCva;
82
- $[3] = t5;
83
- } else t5 = $[3];
84
- return /* @__PURE__ */ jsx(InputFrame, {
85
- ...props,
86
- isDisabled: t2,
87
- isLoading: false,
88
- className: t3,
89
- inputClassName: t4,
90
- contentWrapperClassName: t5,
91
- contentGroup: "select",
92
- labelPlacement: "content-row",
93
- dataAttributes,
94
- renderStatic: true,
95
- onStaticInteract: renderRealInput,
96
- wrapTrailingContent: false,
97
- leadingContent: props.leadingContent && /* @__PURE__ */ jsx("div", {
98
- className: "ml-input-side-default flex shrink-0 items-center",
99
- children: props.leadingContent
100
- }),
101
- trailingContent,
102
- children: (dataAttributeProps) => /* @__PURE__ */ jsxs(Fragment, { children: [isMultiple && !isEmpty && displayValue, /* @__PURE__ */ jsx("input", {
103
- disabled: isDisabled,
104
- tabIndex: -1,
105
- role: "combobox",
106
- "aria-autocomplete": "list",
107
- "aria-controls": `${dataAttributeProps.id}-listbox`,
108
- "aria-expanded": false,
109
- value: inputValue,
110
- placeholder: isMultiple && shouldRenderPlaceholderAfterValue ? props.placeholder : placeholder ?? void 0,
111
- className: clsx("w-full flex-1 bg-transparent outline-none placeholder:text-text-default-3 disabled:text-interactive-text-secondary-disabled", props.inputClassName),
112
- onChange: (event) => replayStaticInputChange(event.target.value),
113
- ...dataAttributeProps,
114
- "data-rac": true
115
- })] })
116
- });
117
- }
118
- const T0 = SelectBase;
119
- const t2 = mergeRefs(props.ref, rootRef);
120
- let t3;
121
- if ($[4] !== T0 || $[5] !== props || $[6] !== t2) {
122
- t3 = /* @__PURE__ */ jsx(T0, {
123
- ...props,
124
- ref: t2,
125
- isSearchable: true
126
- });
127
- $[4] = T0;
128
- $[5] = props;
129
- $[6] = t2;
130
- $[7] = t3;
131
- } else t3 = $[7];
132
- return t3;
133
- }
134
- function _temp(root) {
135
- return root.querySelector("input, [data-type='select-trigger'], button, [tabindex]");
136
- }
137
- function Autocomplete(t0) {
138
- const $ = c(23);
139
- let props;
140
- let renderStaticInput;
141
- if ($[0] !== t0) {
142
- ({renderStaticInput, ...props} = t0);
143
- $[0] = t0;
144
- $[1] = props;
145
- $[2] = renderStaticInput;
146
- } else {
147
- props = $[1];
148
- renderStaticInput = $[2];
149
- }
6
+ var Autocomplete = (props) => {
150
7
  if ("formControl" in props && props.formControl) {
151
- let formControl;
152
- let innerProps;
153
- let ref;
154
- let t1;
155
- if ($[3] !== props) {
156
- ({ignoreInputValueFiltering: t1, formControl, ref, ...innerProps} = props);
157
- $[3] = props;
158
- $[4] = formControl;
159
- $[5] = innerProps;
160
- $[6] = ref;
161
- $[7] = t1;
162
- } else {
163
- formControl = $[4];
164
- innerProps = $[5];
165
- ref = $[6];
166
- t1 = $[7];
167
- }
168
- const ignoreInputValueFiltering = t1 === void 0 ? true : t1;
169
- const controlWithOptions = formControl.control;
170
- let t2;
171
- if ($[8] !== controlWithOptions._options?.disabled || $[9] !== ignoreInputValueFiltering || $[10] !== innerProps || $[11] !== props.error || $[12] !== props.isDisabled || $[13] !== ref || $[14] !== renderStaticInput) {
172
- t2 = (t3) => {
173
- const { field, fieldState: t4 } = t3;
174
- const { error, isDirty } = t4;
175
- return /* @__PURE__ */ jsx(AutocompleteInner, {
176
- ...innerProps,
177
- ref: mergeRefs(ref, field.ref),
178
- value: field.value,
179
- onChange: field.onChange,
180
- onBlur: field.onBlur,
181
- isDirty,
182
- isDisabled: field.disabled || props.isDisabled,
183
- isFormControlDisabled: !!controlWithOptions._options?.disabled,
184
- error: props.error ?? error?.message,
185
- ignoreInputValueFiltering,
186
- renderStaticInput
187
- });
188
- };
189
- $[8] = controlWithOptions._options?.disabled;
190
- $[9] = ignoreInputValueFiltering;
191
- $[10] = innerProps;
192
- $[11] = props.error;
193
- $[12] = props.isDisabled;
194
- $[13] = ref;
195
- $[14] = renderStaticInput;
196
- $[15] = t2;
197
- } else t2 = $[15];
198
- let t3;
199
- if ($[16] !== formControl.control || $[17] !== formControl.name || $[18] !== t2) {
200
- t3 = /* @__PURE__ */ jsx(Controller, {
201
- control: formControl.control,
202
- name: formControl.name,
203
- render: t2
204
- });
205
- $[16] = formControl.control;
206
- $[17] = formControl.name;
207
- $[18] = t2;
208
- $[19] = t3;
209
- } else t3 = $[19];
210
- return t3;
211
- }
212
- let t1;
213
- if ($[20] !== props || $[21] !== renderStaticInput) {
214
- t1 = /* @__PURE__ */ jsx(AutocompleteInner, {
215
- ...props,
216
- renderStaticInput
8
+ const { formControl, ref, ...innerProps } = props;
9
+ return /* @__PURE__ */ jsx(Controller, {
10
+ control: formControl.control,
11
+ name: formControl.name,
12
+ render: ({ field, fieldState: { error } }) => /* @__PURE__ */ jsx(SelectBase, {
13
+ ...innerProps,
14
+ ref: mergeRefs(ref, field.ref),
15
+ value: field.value,
16
+ onChange: field.onChange,
17
+ onBlur: field.onBlur,
18
+ isDisabled: field.disabled || props.isDisabled,
19
+ error: props.error ?? error?.message,
20
+ isSearchable: true
21
+ })
217
22
  });
218
- $[20] = props;
219
- $[21] = renderStaticInput;
220
- $[22] = t1;
221
- } else t1 = $[22];
222
- return t1;
223
- }
23
+ }
24
+ return /* @__PURE__ */ jsx(SelectBase, {
25
+ ...props,
26
+ isSearchable: true
27
+ });
28
+ };
224
29
  //#endregion
225
30
  export { Autocomplete };
@@ -1,4 +1,19 @@
1
+ import { UseQueryResult } from '@tanstack/react-query';
2
+ import { Key } from 'react-aria-components';
1
3
  import { FieldValues } from 'react-hook-form';
2
- import { QueryAutocompleteProps, QueryFn } from './queryAutocomplete.types';
3
- import { SelectItem } from '../shared/select.types';
4
- export declare const QueryAutocomplete: <TFieldValues extends FieldValues, TSelectItem extends SelectItem<any>, TQueryFn extends QueryFn>(props: QueryAutocompleteProps<TFieldValues, TSelectItem, TQueryFn>) => import("react/jsx-runtime").JSX.Element;
4
+ import { AutocompleteProps } from './Autocomplete';
5
+ import { GroupedSelectControlProps, GroupedSelectProps, SelectItem } from '../shared/select.types';
6
+ import { OmitDiscriminatedUnion } from '../../../../types/common';
7
+ type QueryFn<TSelectItem extends SelectItem = SelectItem> = (...args: any) => UseQueryResult<Array<TSelectItem>>;
8
+ type TKey<TQueryFn extends QueryFn> = Exclude<ReturnType<TQueryFn>["data"], undefined>[0] extends {
9
+ id: infer InferredKey extends Key;
10
+ } ? InferredKey : never;
11
+ type QueryAutocompleteProps<TFieldValues extends FieldValues, TSelectItem extends SelectItem<any>, TQueryFn extends QueryFn<TSelectItem>> = OmitDiscriminatedUnion<AutocompleteProps<TKey<TQueryFn>>, "items" | "onSearchChange" | "isLoading" | keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TKey<TQueryFn>> & {
12
+ query: Parameters<TQueryFn>[0] extends {
13
+ search?: string;
14
+ } ? TQueryFn : never;
15
+ queryParams?: Omit<Parameters<TQueryFn>[0], "search">;
16
+ queryOptions?: Parameters<TQueryFn>[1];
17
+ };
18
+ export declare const QueryAutocomplete: <TFieldValues extends FieldValues, TSelectItem extends SelectItem<any>, TQueryFn extends QueryFn<TSelectItem>>({ query, queryParams, queryOptions, ...props }: QueryAutocompleteProps<TFieldValues, TSelectItem, TQueryFn>) => import("react/jsx-runtime").JSX.Element;
19
+ export {};
@@ -1,119 +1,20 @@
1
- import { UIConfig } from "../../../../config/uiConfig.context.js";
2
1
  import { Autocomplete } from "./Autocomplete.js";
3
- import { getQueryItems, getSelectionIdsToResolve } from "../shared/querySelect.utils.js";
4
- import { useQueryAutocomplete } from "../../../../hooks/useQueryAutocomplete.js";
5
- import { c } from "react/compiler-runtime";
6
2
  import { jsx } from "react/jsx-runtime";
7
3
  import { useState } from "react";
8
- import { mergeRefs } from "@react-aria/utils";
9
- import { Controller } from "react-hook-form";
10
4
  //#region src/components/inputs/Selection/Autocomplete/QueryAutocomplete.tsx
11
- var QueryAutocompleteContent = ({ query, queryParams, queryOptions, queryMap, leadingContent, ...props }) => {
12
- "use no memo";
13
- const ui = UIConfig.useConfig();
5
+ var QueryAutocomplete = ({ query, queryParams, queryOptions, ...props }) => {
14
6
  const [search, setSearch] = useState("");
15
- const { onChange, ...restProps } = props;
16
- const value = "value" in props ? props.value : void 0;
17
- const selectedIdsToResolve = getSelectionIdsToResolve({
18
- initialSelection: props.initialSelection,
19
- value,
20
- mapInitialToSelectItem: props.mapInitialToSelectItem
21
- });
22
- const { items, totalItems, isLoading, handleEnableQuery, hasNextPage, fetchNextPage } = useQueryAutocomplete({
23
- query,
24
- queryParams,
25
- queryOptions,
26
- mapItems: (data) => getQueryItems(data, queryMap),
7
+ const { data: items, isLoading } = query({
27
8
  search,
28
- initialQueryState: selectedIdsToResolve.count > 0 ? false : props.isInitialQueryDisabled ?? ui.queryAutocomplete?.isInitialQueryDisabled,
29
- selectedIdsToResolve: selectedIdsToResolve.items
30
- });
31
- const handleChange = (value_0) => {
32
- onChange?.(value_0);
33
- props.onBlur?.({ target: { value: null } });
34
- };
35
- const { isInitialQueryDisabled: _, ...autocompleteProps } = restProps;
36
- const onSearchChange = (value_1) => {
37
- setSearch(value_1);
38
- handleEnableQuery();
39
- };
9
+ ...queryParams
10
+ }, queryOptions);
40
11
  return /* @__PURE__ */ jsx(Autocomplete, {
41
- ...autocompleteProps,
42
- items,
43
- totalItems,
44
- onSearchChange,
12
+ ...props,
13
+ items: items ?? [],
14
+ onSearchChange: setSearch,
45
15
  isClientSearchDisabled: true,
46
- isLoading,
47
- onChange: handleChange,
48
- onMouseEnter: handleEnableQuery,
49
- onFocusCapture: handleEnableQuery,
50
- leadingContent,
51
- hasLoadMore: hasNextPage,
52
- onLoadMore: fetchNextPage
16
+ isLoading
53
17
  });
54
18
  };
55
- var QueryAutocomplete = (props) => {
56
- const $ = c(16);
57
- if ("formControl" in props && props.formControl) {
58
- let formControl;
59
- let innerProps;
60
- let ref;
61
- if ($[0] !== props) {
62
- ({formControl, ref, ...innerProps} = props);
63
- $[0] = props;
64
- $[1] = formControl;
65
- $[2] = innerProps;
66
- $[3] = ref;
67
- } else {
68
- formControl = $[1];
69
- innerProps = $[2];
70
- ref = $[3];
71
- }
72
- const controlWithOptions = formControl.control;
73
- let t0;
74
- if ($[4] !== controlWithOptions || $[5] !== innerProps || $[6] !== props.error || $[7] !== props.isDisabled || $[8] !== ref) {
75
- t0 = (t1) => {
76
- const { field, fieldState: t2 } = t1;
77
- const { error, isDirty } = t2;
78
- return /* @__PURE__ */ jsx(QueryAutocompleteContent, {
79
- ...innerProps,
80
- ref: mergeRefs(ref, field.ref),
81
- value: field.value,
82
- onChange: field.onChange,
83
- onBlur: field.onBlur,
84
- isDirty,
85
- isDisabled: field.disabled || props.isDisabled || !!controlWithOptions._options?.disabled,
86
- error: props.error ?? error?.message
87
- });
88
- };
89
- $[4] = controlWithOptions;
90
- $[5] = innerProps;
91
- $[6] = props.error;
92
- $[7] = props.isDisabled;
93
- $[8] = ref;
94
- $[9] = t0;
95
- } else t0 = $[9];
96
- let t1;
97
- if ($[10] !== formControl.control || $[11] !== formControl.name || $[12] !== t0) {
98
- t1 = /* @__PURE__ */ jsx(Controller, {
99
- control: formControl.control,
100
- name: formControl.name,
101
- render: t0
102
- });
103
- $[10] = formControl.control;
104
- $[11] = formControl.name;
105
- $[12] = t0;
106
- $[13] = t1;
107
- } else t1 = $[13];
108
- return t1;
109
- }
110
- let t0;
111
- if ($[14] !== props) {
112
- t0 = /* @__PURE__ */ jsx(QueryAutocompleteContent, { ...props });
113
- $[14] = props;
114
- $[15] = t0;
115
- } else t0 = $[15];
116
- return t0;
117
- };
118
19
  //#endregion
119
20
  export { QueryAutocomplete };
@@ -1,12 +1,8 @@
1
- import { ReactElement } from 'react';
2
1
  import { Key } from 'react-aria-components';
3
2
  import { FieldValues } from 'react-hook-form';
4
3
  import { SelectBaseProps } from '../shared/SelectBase';
5
4
  import { DefaultInitialSelectItem, GroupedSelectControlProps, GroupedSelectProps, SelectAsyncProps } from '../shared/select.types';
6
5
  import { OmitDiscriminatedUnion } from '../../../../types/common';
7
- export type SelectProps<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = OmitDiscriminatedUnion<SelectBaseProps<TKey, TInitialSelectItem>, keyof SelectAsyncProps> & {
8
- renderStaticInput?: boolean;
9
- };
10
- export type ControlledSelectProps<TFieldValues extends FieldValues, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = Omit<SelectProps<TKey, TInitialSelectItem>, keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TKey, TInitialSelectItem>;
11
- export declare function Select<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>>(props: SelectProps<TKey, TInitialSelectItem>): ReactElement;
12
- export declare function Select<TFieldValues extends FieldValues, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>>(props: ControlledSelectProps<TFieldValues, TKey, TInitialSelectItem>): ReactElement;
6
+ export type SelectProps<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = OmitDiscriminatedUnion<SelectBaseProps<TKey, TInitialSelectItem>, "initialSelection" | "mapInitialToSelectItem" | keyof SelectAsyncProps>;
7
+ export type ControlledSelectProps<TFieldValues extends FieldValues, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = Omit<SelectProps<TKey, TInitialSelectItem>, keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TKey>;
8
+ export declare const Select: <TFieldValues extends FieldValues, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>>(props: ControlledSelectProps<TFieldValues, TKey, TInitialSelectItem>) => import("react/jsx-runtime").JSX.Element;
@@ -1,235 +1,26 @@
1
- import { UIOverrides } from "../../../../config/uiOverrides.context.js";
2
- import { Typography } from "../../../text/Typography/Typography.js";
3
- import { UIConfig } from "../../../../config/uiConfig.context.js";
4
- import { InputFrame } from "../../Skeleton/InputFrame.js";
5
- import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
6
- import { selectInputTagsContentWrapperDefinition } from "../shared/selectInput.cva.js";
7
1
  import { SelectBase } from "../shared/SelectBase.js";
8
- import { StaticSelectTrailingContent } from "../shared/StaticSelectTrailingContent.js";
9
- import { getStaticSelectValue } from "../shared/staticSelect.utils.js";
10
- import { c } from "react/compiler-runtime";
11
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
- import { clsx } from "clsx";
13
- import { useRef, useState } from "react";
2
+ import { jsx } from "react/jsx-runtime";
14
3
  import { mergeRefs } from "@react-aria/utils";
15
4
  import { Controller } from "react-hook-form";
16
5
  //#region src/components/inputs/Selection/Select/Select.tsx
17
- function SelectInner(t0) {
18
- const $ = c(6);
19
- const { renderStaticInput, isFormControlDisabled, ...props } = t0;
20
- const ui = UIConfig.useConfig();
21
- const selectInputTagsContentWrapperCva = UIOverrides.useCva("select.tagsContentWrapperCva", selectInputTagsContentWrapperDefinition);
22
- const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
23
- const rootRef = useRef(null);
24
- let t1;
25
- if ($[0] !== renderInput) {
26
- t1 = {
27
- inputRef: rootRef,
28
- renderInput,
29
- setRenderInput,
30
- getFocusTarget: _temp
31
- };
32
- $[0] = renderInput;
33
- $[1] = t1;
34
- } else t1 = $[1];
35
- const { renderRealInput, replayStaticInputChange, replayStaticInputPress } = useStaticInputHandoff(t1);
36
- const currentValue = props.value;
37
- if (!renderInput && props.selectionMode !== "multiple" && !!props.showSelectionContent && currentValue != null) setRenderInput(true);
38
- if (!renderInput && !!props.customTrigger) setRenderInput(true);
39
- if (!renderInput) {
40
- const as = props.as ?? ui.input.as;
41
- const size = props.size ?? ui.input.size;
42
- let isDisabled = !!props.isDisabled;
43
- if (isFormControlDisabled) isDisabled = true;
44
- const mode = props.selectionMode ?? ui.select.selectionMode;
45
- const isMultiple = mode === "multiple";
46
- const { selectedItem, displayValue, isEmpty } = getStaticSelectValue({
47
- items: props.items,
48
- value: currentValue,
49
- selectionMode: mode,
50
- initialSelection: props.initialSelection,
51
- mapInitialToSelectItem: props.mapInitialToSelectItem,
52
- showSelectionContent: props.showSelectionContent,
53
- isDisabled,
54
- collapseAfter: props.collapseAfter ?? ui.select.collapseAfter,
55
- selectedTagsType: props.selectedTagsType ?? ui.select.selectedTagsType
56
- });
57
- const isSearchable = props.isSearchable ?? ui.select.isSearchable;
58
- const trailingContent = /* @__PURE__ */ jsx(StaticSelectTrailingContent, {
59
- trailingContent: props.trailingContent,
60
- hideDropdownIcon: props.hideDropdownIcon,
61
- isDisabled,
62
- size
63
- });
64
- const placeholder = as === "floating" ? null : props.placeholder;
65
- const inputValue = !isMultiple && selectedItem ? selectedItem.label : "";
66
- const shouldRenderPlaceholderAfterValue = isMultiple && props.placeholder && !isEmpty;
67
- const dataAttributes = {
68
- dataIsEmpty: isEmpty,
69
- dataIsFilled: !isEmpty,
70
- dataIsDirty: props.isDirty,
71
- dataIsRequired: props.isRequired,
72
- dataIsDisabled: isDisabled,
73
- dataDisabled: isDisabled,
74
- dataInvalid: !!props.error,
75
- dataHasSelection: !isEmpty,
76
- dataHasSearch: false
77
- };
78
- const buttonContent = isMultiple && !isEmpty ? /* @__PURE__ */ jsx(Fragment, { children: "\xA0" }) : isEmpty ? /* @__PURE__ */ jsx(Typography, {
79
- size: "label-1",
80
- as: "span",
81
- className: "block truncate text-text-default-3",
82
- children: placeholder
83
- }) : /* @__PURE__ */ jsx(Typography, {
84
- size: "label-1",
85
- as: "span",
86
- className: "block truncate",
87
- children: displayValue
88
- });
89
- return /* @__PURE__ */ jsx(InputFrame, {
90
- ...props,
91
- isDisabled,
92
- isLoading: false,
93
- className: clsx("w-full", props.containerClassName),
94
- inputClassName: clsx(props.className, props.inputClassName),
95
- contentWrapperClassName: selectInputTagsContentWrapperCva({ isSearchable }),
96
- contentGroup: "select",
97
- typographySize: "label-1",
98
- labelPlacement: "content-row",
99
- dataAttributes,
100
- renderStatic: true,
101
- wrapTrailingContent: false,
102
- onStaticInteract: renderRealInput,
103
- leadingContent: props.leadingContent && /* @__PURE__ */ jsx("div", {
104
- className: "ml-input-side-default flex shrink-0 items-center",
105
- children: props.leadingContent
106
- }),
107
- showClear: false,
108
- trailingContent,
109
- children: (dataAttributeProps) => /* @__PURE__ */ jsxs(Fragment, { children: [isMultiple && !isEmpty && displayValue, isSearchable ? /* @__PURE__ */ jsx("input", {
110
- disabled: isDisabled,
111
- tabIndex: -1,
112
- role: "combobox",
113
- "aria-autocomplete": "list",
114
- "aria-controls": `${dataAttributeProps.id}-listbox`,
115
- "aria-expanded": false,
116
- value: inputValue,
117
- placeholder: shouldRenderPlaceholderAfterValue ? props.placeholder : placeholder ?? void 0,
118
- className: clsx("w-full flex-1 bg-transparent outline-none placeholder:text-text-default-3 disabled:text-interactive-text-secondary-disabled", props.inputClassName),
119
- onChange: (event) => replayStaticInputChange(event.target.value),
120
- ...dataAttributeProps,
121
- "data-rac": true
122
- }) : /* @__PURE__ */ jsx("button", {
123
- type: "button",
124
- disabled: isDisabled,
125
- tabIndex: -1,
126
- "data-type": "select-trigger",
127
- className: clsx("w-full truncate bg-transparent text-start outline-none disabled:text-interactive-text-secondary-disabled", isMultiple && !isEmpty && "absolute inset-0 z-0"),
128
- onClick: replayStaticInputPress,
129
- ...dataAttributeProps,
130
- "data-rac": true,
131
- children: buttonContent
132
- })] })
133
- });
134
- }
135
- const T0 = SelectBase;
136
- const t2 = mergeRefs(props.ref, rootRef);
137
- let t3;
138
- if ($[2] !== T0 || $[3] !== props || $[4] !== t2) {
139
- t3 = /* @__PURE__ */ jsx(T0, {
140
- ...props,
141
- ref: t2
142
- });
143
- $[2] = T0;
144
- $[3] = props;
145
- $[4] = t2;
146
- $[5] = t3;
147
- } else t3 = $[5];
148
- return t3;
149
- }
150
- function _temp(root) {
151
- return root.querySelector("[data-type='select-trigger'], input, button, [tabindex]");
152
- }
153
- function Select(t0) {
154
- const $ = c(21);
155
- let props;
156
- let renderStaticInput;
157
- if ($[0] !== t0) {
158
- ({renderStaticInput, ...props} = t0);
159
- $[0] = t0;
160
- $[1] = props;
161
- $[2] = renderStaticInput;
162
- } else {
163
- props = $[1];
164
- renderStaticInput = $[2];
165
- }
6
+ var Select = (props) => {
166
7
  if ("formControl" in props && props.formControl) {
167
- let formControl;
168
- let innerProps;
169
- let ref;
170
- if ($[3] !== props) {
171
- ({formControl, ref, ...innerProps} = props);
172
- $[3] = props;
173
- $[4] = formControl;
174
- $[5] = innerProps;
175
- $[6] = ref;
176
- } else {
177
- formControl = $[4];
178
- innerProps = $[5];
179
- ref = $[6];
180
- }
181
- const controlWithOptions = formControl.control;
182
- let t1;
183
- if ($[7] !== controlWithOptions._options?.disabled || $[8] !== innerProps || $[9] !== props.error || $[10] !== props.isDisabled || $[11] !== ref || $[12] !== renderStaticInput) {
184
- t1 = (t2) => {
185
- const { field, fieldState: t3 } = t2;
186
- const { error, isDirty } = t3;
187
- return /* @__PURE__ */ jsx(SelectInner, {
188
- ...innerProps,
189
- ref: mergeRefs(ref, field.ref),
190
- value: field.value,
191
- onChange: field.onChange,
192
- onBlur: field.onBlur,
193
- isDirty,
194
- isDisabled: field.disabled || props.isDisabled,
195
- isFormControlDisabled: !!controlWithOptions._options?.disabled,
196
- error: props.error ?? error?.message,
197
- renderStaticInput
198
- });
199
- };
200
- $[7] = controlWithOptions._options?.disabled;
201
- $[8] = innerProps;
202
- $[9] = props.error;
203
- $[10] = props.isDisabled;
204
- $[11] = ref;
205
- $[12] = renderStaticInput;
206
- $[13] = t1;
207
- } else t1 = $[13];
208
- let t2;
209
- if ($[14] !== formControl.control || $[15] !== formControl.name || $[16] !== t1) {
210
- t2 = /* @__PURE__ */ jsx(Controller, {
211
- control: formControl.control,
212
- name: formControl.name,
213
- render: t1
214
- });
215
- $[14] = formControl.control;
216
- $[15] = formControl.name;
217
- $[16] = t1;
218
- $[17] = t2;
219
- } else t2 = $[17];
220
- return t2;
221
- }
222
- let t1;
223
- if ($[18] !== props || $[19] !== renderStaticInput) {
224
- t1 = /* @__PURE__ */ jsx(SelectInner, {
225
- ...props,
226
- renderStaticInput
8
+ const { formControl, ref, ...innerProps } = props;
9
+ return /* @__PURE__ */ jsx(Controller, {
10
+ control: formControl.control,
11
+ name: formControl.name,
12
+ render: ({ field, fieldState: { error } }) => /* @__PURE__ */ jsx(SelectBase, {
13
+ ...innerProps,
14
+ ref: mergeRefs(ref, field.ref),
15
+ value: field.value,
16
+ onChange: field.onChange,
17
+ onBlur: field.onBlur,
18
+ isDisabled: field.disabled || props.isDisabled,
19
+ error: props.error ?? error?.message
20
+ })
227
21
  });
228
- $[18] = props;
229
- $[19] = renderStaticInput;
230
- $[20] = t1;
231
- } else t1 = $[20];
232
- return t1;
233
- }
22
+ }
23
+ return /* @__PURE__ */ jsx(SelectBase, { ...props });
24
+ };
234
25
  //#endregion
235
26
  export { Select };