@cube-dev/ui-kit 0.147.3 → 0.148.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 (557) hide show
  1. package/dist/CHANGELOG.md +16 -0
  2. package/dist/_internal/hooks/use-chained-callback.js +1 -1
  3. package/dist/_internal/hooks/use-debounced-value.js +1 -1
  4. package/dist/_internal/hooks/use-deprecation-warning.js +1 -1
  5. package/dist/_internal/hooks/use-event.js +1 -1
  6. package/dist/_internal/hooks/use-is-first-render.js +1 -1
  7. package/dist/_internal/hooks/use-sync-ref.js +1 -1
  8. package/dist/_internal/hooks/use-timer/timer.js +1 -1
  9. package/dist/_internal/hooks/use-timer/use-timer.js +1 -1
  10. package/dist/_internal/hooks/use-warn.js +1 -1
  11. package/dist/components/Block.js +1 -1
  12. package/dist/components/CollectionItem.js +1 -1
  13. package/dist/components/GlobalStyles.js +1 -1
  14. package/dist/components/GridProvider.js +1 -1
  15. package/dist/components/HiddenInput.js +1 -1
  16. package/dist/components/Root.js +1 -1
  17. package/dist/components/actions/Action/Action.js +1 -1
  18. package/dist/components/actions/Banner/Banner.js +1 -1
  19. package/dist/components/actions/Button/Button.js +1 -1
  20. package/dist/components/actions/ButtonGroup/ButtonGroup.js +1 -1
  21. package/dist/components/actions/ButtonSplit/ButtonSplit.js +1 -1
  22. package/dist/components/actions/ButtonSplit/context.js +1 -1
  23. package/dist/components/actions/CommandMenu/CommandMenu.js +1 -1
  24. package/dist/components/actions/CommandMenu/styled.js +1 -1
  25. package/dist/components/actions/ItemAction/ItemAction.js +1 -1
  26. package/dist/components/actions/ItemActionContext.js +1 -1
  27. package/dist/components/actions/ItemButton/ItemButton.js +1 -1
  28. package/dist/components/actions/Link/Link.js +1 -1
  29. package/dist/components/actions/Menu/Menu.js +1 -1
  30. package/dist/components/actions/Menu/MenuItem.js +1 -1
  31. package/dist/components/actions/Menu/MenuSection.js +1 -1
  32. package/dist/components/actions/Menu/MenuTrigger.js +1 -1
  33. package/dist/components/actions/Menu/SubMenuTrigger.js +1 -1
  34. package/dist/components/actions/Menu/SubmenuTriggerContext.js +1 -1
  35. package/dist/components/actions/Menu/context.js +1 -1
  36. package/dist/components/actions/Menu/styled.js +1 -1
  37. package/dist/components/actions/index.js +1 -1
  38. package/dist/components/actions/use-action.js +1 -1
  39. package/dist/components/actions/use-anchored-menu.js +1 -1
  40. package/dist/components/actions/use-context-menu.js +1 -1
  41. package/dist/components/content/ActiveZone/ActiveZone.js +1 -1
  42. package/dist/components/content/Alert/Alert.js +1 -1
  43. package/dist/components/content/Alert/use-alert.js +1 -1
  44. package/dist/components/content/Avatar/Avatar.js +1 -1
  45. package/dist/components/content/Badge/Badge.js +1 -1
  46. package/dist/components/content/Card/Card.js +1 -1
  47. package/dist/components/content/Content.js +1 -1
  48. package/dist/components/content/CopyPasteBlock/CopyPasteBlock.js +1 -1
  49. package/dist/components/content/CopySnippet/CopySnippet.js +1 -1
  50. package/dist/components/content/Disclosure/Disclosure.js +1 -1
  51. package/dist/components/content/Divider.js +1 -1
  52. package/dist/components/content/Footer.js +1 -1
  53. package/dist/components/content/Header.js +1 -1
  54. package/dist/components/content/HotKeys/HotKeys.js +1 -1
  55. package/dist/components/content/InlineInput/InlineInput.js +1 -1
  56. package/dist/components/content/Item/Item.js +1 -1
  57. package/dist/components/content/ItemBadge/ItemBadge.js +1 -1
  58. package/dist/components/content/ItemCard/ItemCard.js +1 -1
  59. package/dist/components/content/Layout/GridLayout.js +1 -1
  60. package/dist/components/content/Layout/Layout.js +1 -1
  61. package/dist/components/content/Layout/LayoutBlock.js +1 -1
  62. package/dist/components/content/Layout/LayoutCenter.js +1 -1
  63. package/dist/components/content/Layout/LayoutContainer.js +1 -1
  64. package/dist/components/content/Layout/LayoutContent.js +1 -1
  65. package/dist/components/content/Layout/LayoutContext.js +1 -1
  66. package/dist/components/content/Layout/LayoutFlex.js +1 -1
  67. package/dist/components/content/Layout/LayoutFooter.js +1 -1
  68. package/dist/components/content/Layout/LayoutGrid.js +1 -1
  69. package/dist/components/content/Layout/LayoutHeader.js +1 -1
  70. package/dist/components/content/Layout/LayoutPane.js +1 -1
  71. package/dist/components/content/Layout/LayoutPanel.js +1 -1
  72. package/dist/components/content/Layout/LayoutPanelHeader.js +1 -1
  73. package/dist/components/content/Layout/LayoutToolbar.js +1 -1
  74. package/dist/components/content/Layout/hooks/useTinyScrollbar.js +1 -1
  75. package/dist/components/content/Layout/index.js +1 -1
  76. package/dist/components/content/Layout/utils.js +1 -1
  77. package/dist/components/content/Paragraph.js +1 -1
  78. package/dist/components/content/Placeholder/Placeholder.js +1 -1
  79. package/dist/components/content/PrismCode/PrismCode.js +1 -1
  80. package/dist/components/content/PrismCode/prismSetup.js +1 -1
  81. package/dist/components/content/PrismDiffCode/PrismDiffCode.js +1 -1
  82. package/dist/components/content/Result/Result.js +1 -1
  83. package/dist/components/content/Skeleton/Skeleton.js +1 -1
  84. package/dist/components/content/Tag/Tag.js +1 -1
  85. package/dist/components/content/Text.js +1 -1
  86. package/dist/components/content/TextItem/TextItem.js +1 -1
  87. package/dist/components/content/Title.js +1 -1
  88. package/dist/components/content/Tree/Tree.js +1 -1
  89. package/dist/components/content/Tree/TreeNode.js +1 -1
  90. package/dist/components/content/Tree/styled.js +1 -1
  91. package/dist/components/content/Tree/tree-index.js +1 -1
  92. package/dist/components/content/Tree/use-checkbox-tree.js +1 -1
  93. package/dist/components/content/Tree/use-load-data.js +1 -1
  94. package/dist/components/content/highlightText.js +1 -1
  95. package/dist/components/content/use-auto-tooltip.js +1 -1
  96. package/dist/components/fields/Checkbox/Checkbox.js +17 -17
  97. package/dist/components/fields/Checkbox/Checkbox.js.map +1 -1
  98. package/dist/components/fields/Checkbox/CheckboxGroup.js +5 -8
  99. package/dist/components/fields/Checkbox/CheckboxGroup.js.map +1 -1
  100. package/dist/components/fields/Checkbox/context.js +1 -1
  101. package/dist/components/fields/ComboBox/ComboBox.d.ts +0 -2
  102. package/dist/components/fields/ComboBox/ComboBox.js +26 -23
  103. package/dist/components/fields/ComboBox/ComboBox.js.map +1 -1
  104. package/dist/components/fields/CommandTextArea/CommandTextArea.js +1 -5
  105. package/dist/components/fields/CommandTextArea/CommandTextArea.js.map +1 -1
  106. package/dist/components/fields/CommandTextArea/caretPosition.js +1 -1
  107. package/dist/components/fields/CommandTextArea/useCaretAnchor.js +1 -1
  108. package/dist/components/fields/DatePicker/DateInput.d.ts +1 -2
  109. package/dist/components/fields/DatePicker/DateInput.js +4 -7
  110. package/dist/components/fields/DatePicker/DateInput.js.map +1 -1
  111. package/dist/components/fields/DatePicker/DateInputBase.js +21 -14
  112. package/dist/components/fields/DatePicker/DateInputBase.js.map +1 -1
  113. package/dist/components/fields/DatePicker/DatePicker.d.ts +1 -2
  114. package/dist/components/fields/DatePicker/DatePicker.js +4 -7
  115. package/dist/components/fields/DatePicker/DatePicker.js.map +1 -1
  116. package/dist/components/fields/DatePicker/DatePickerButton.js +1 -1
  117. package/dist/components/fields/DatePicker/DatePickerElement.js +1 -1
  118. package/dist/components/fields/DatePicker/DatePickerInput.js +1 -1
  119. package/dist/components/fields/DatePicker/DatePickerSegment.js +1 -1
  120. package/dist/components/fields/DatePicker/DateRangePicker.d.ts +1 -2
  121. package/dist/components/fields/DatePicker/DateRangePicker.js +4 -7
  122. package/dist/components/fields/DatePicker/DateRangePicker.js.map +1 -1
  123. package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.d.ts +1 -2
  124. package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js +6 -8
  125. package/dist/components/fields/DatePicker/DateRangeSeparatedPicker.js.map +1 -1
  126. package/dist/components/fields/DatePicker/TimeInput.d.ts +1 -2
  127. package/dist/components/fields/DatePicker/TimeInput.js +4 -7
  128. package/dist/components/fields/DatePicker/TimeInput.js.map +1 -1
  129. package/dist/components/fields/DatePicker/parseDate.js +1 -1
  130. package/dist/components/fields/DatePicker/props.js +1 -1
  131. package/dist/components/fields/DatePicker/utils.js +1 -1
  132. package/dist/components/fields/FileInput/FileInput.js +26 -7
  133. package/dist/components/fields/FileInput/FileInput.js.map +1 -1
  134. package/dist/components/fields/FilterListBox/FilterListBox.js +11 -11
  135. package/dist/components/fields/FilterListBox/FilterListBox.js.map +1 -1
  136. package/dist/components/fields/FilterPicker/FilterPicker.js +20 -10
  137. package/dist/components/fields/FilterPicker/FilterPicker.js.map +1 -1
  138. package/dist/components/fields/Input/Input.js +1 -1
  139. package/dist/components/fields/ListBox/DraggableListBox.js +1 -1
  140. package/dist/components/fields/ListBox/ListBox.js +35 -27
  141. package/dist/components/fields/ListBox/ListBox.js.map +1 -1
  142. package/dist/components/fields/ListBoxPopover/ListBoxPopover.js +1 -1
  143. package/dist/components/fields/ListBoxPopover/listNavigation.js +1 -1
  144. package/dist/components/fields/ListBoxPopover/useCompositeFocus.js +1 -1
  145. package/dist/components/fields/NumberInput/NumberInput.js +1 -3
  146. package/dist/components/fields/NumberInput/NumberInput.js.map +1 -1
  147. package/dist/components/fields/NumberInput/StepButton.js +1 -1
  148. package/dist/components/fields/PasswordInput/PasswordInput.js +1 -3
  149. package/dist/components/fields/PasswordInput/PasswordInput.js.map +1 -1
  150. package/dist/components/fields/Picker/Picker.js +20 -10
  151. package/dist/components/fields/Picker/Picker.js.map +1 -1
  152. package/dist/components/fields/RadioGroup/Radio.d.ts +0 -1
  153. package/dist/components/fields/RadioGroup/Radio.js +14 -8
  154. package/dist/components/fields/RadioGroup/Radio.js.map +1 -1
  155. package/dist/components/fields/RadioGroup/RadioGroup.d.ts +0 -1
  156. package/dist/components/fields/RadioGroup/RadioGroup.js +4 -7
  157. package/dist/components/fields/RadioGroup/RadioGroup.js.map +1 -1
  158. package/dist/components/fields/RadioGroup/context.js +1 -1
  159. package/dist/components/fields/SearchComboBox/SearchComboBox.d.ts +0 -2
  160. package/dist/components/fields/SearchComboBox/SearchComboBox.js +21 -12
  161. package/dist/components/fields/SearchComboBox/SearchComboBox.js.map +1 -1
  162. package/dist/components/fields/SearchInput/SearchInput.d.ts +1 -1
  163. package/dist/components/fields/SearchInput/SearchInput.js +11 -4
  164. package/dist/components/fields/SearchInput/SearchInput.js.map +1 -1
  165. package/dist/components/fields/Select/Select.js +22 -22
  166. package/dist/components/fields/Select/Select.js.map +1 -1
  167. package/dist/components/fields/Slider/Gradation.js +1 -1
  168. package/dist/components/fields/Slider/HueSlider.js +1 -1
  169. package/dist/components/fields/Slider/RangeSlider.js +10 -4
  170. package/dist/components/fields/Slider/RangeSlider.js.map +1 -1
  171. package/dist/components/fields/Slider/Slider.js +6 -2
  172. package/dist/components/fields/Slider/Slider.js.map +1 -1
  173. package/dist/components/fields/Slider/SliderBase.js +18 -8
  174. package/dist/components/fields/Slider/SliderBase.js.map +1 -1
  175. package/dist/components/fields/Slider/SliderThumb.js +11 -4
  176. package/dist/components/fields/Slider/SliderThumb.js.map +1 -1
  177. package/dist/components/fields/Slider/SliderTrack.js +15 -4
  178. package/dist/components/fields/Slider/SliderTrack.js.map +1 -1
  179. package/dist/components/fields/Slider/elements.js +5 -1
  180. package/dist/components/fields/Slider/elements.js.map +1 -1
  181. package/dist/components/fields/Slider/index.js +1 -1
  182. package/dist/components/fields/Switch/Switch.js +11 -9
  183. package/dist/components/fields/Switch/Switch.js.map +1 -1
  184. package/dist/components/fields/TextArea/TextArea.js +1 -3
  185. package/dist/components/fields/TextArea/TextArea.js.map +1 -1
  186. package/dist/components/fields/TextInput/TextInput.js +1 -3
  187. package/dist/components/fields/TextInput/TextInput.js.map +1 -1
  188. package/dist/components/fields/TextInput/TextInputBase.js +29 -33
  189. package/dist/components/fields/TextInput/TextInputBase.js.map +1 -1
  190. package/dist/components/fields/TextInputMapper/TextInputMapper.d.ts +2 -0
  191. package/dist/components/fields/TextInputMapper/TextInputMapper.js +13 -5
  192. package/dist/components/fields/TextInputMapper/TextInputMapper.js.map +1 -1
  193. package/dist/components/form/FieldWrapper/FieldWrapper.d.ts +29 -2
  194. package/dist/components/form/FieldWrapper/FieldWrapper.js +11 -7
  195. package/dist/components/form/FieldWrapper/FieldWrapper.js.map +1 -1
  196. package/dist/components/form/FieldWrapper/index.d.ts +1 -2
  197. package/dist/components/form/FieldWrapper/types.d.ts +2 -3
  198. package/dist/components/form/Form/Field.js +8 -5
  199. package/dist/components/form/Form/Field.js.map +1 -1
  200. package/dist/components/form/Form/Form.js +6 -4
  201. package/dist/components/form/Form/Form.js.map +1 -1
  202. package/dist/components/form/Form/ResetButton/ResetButton.js +1 -1
  203. package/dist/components/form/Form/SubmitButton/SubmitButton.js +1 -1
  204. package/dist/components/form/Form/SubmitError.js +1 -1
  205. package/dist/components/form/Form/index.js +1 -1
  206. package/dist/components/form/Form/use-field/types.d.ts +7 -5
  207. package/dist/components/form/Form/use-field/use-field-props.js +7 -1
  208. package/dist/components/form/Form/use-field/use-field-props.js.map +1 -1
  209. package/dist/components/form/Form/use-field/use-field.js +8 -6
  210. package/dist/components/form/Form/use-field/use-field.js.map +1 -1
  211. package/dist/components/form/Form/use-form.js +1 -1
  212. package/dist/components/form/Form/validation.js +1 -1
  213. package/dist/components/form/Label.d.ts +2 -3
  214. package/dist/components/form/Label.js +7 -4
  215. package/dist/components/form/Label.js.map +1 -1
  216. package/dist/components/form/index.d.ts +6 -3
  217. package/dist/components/form/validation/ValidationIndicator.d.ts +28 -0
  218. package/dist/components/form/validation/ValidationIndicator.js +37 -0
  219. package/dist/components/form/validation/ValidationIndicator.js.map +1 -0
  220. package/dist/components/form/validation/index.d.ts +4 -0
  221. package/dist/components/form/validation/resolve-validation-props.d.ts +51 -0
  222. package/dist/components/form/validation/resolve-validation-props.js +49 -0
  223. package/dist/components/form/validation/resolve-validation-props.js.map +1 -0
  224. package/dist/components/form/validation/use-validation-props.d.ts +16 -0
  225. package/dist/components/form/validation/use-validation-props.js +29 -0
  226. package/dist/components/form/validation/use-validation-props.js.map +1 -0
  227. package/dist/components/form/wrapper.d.ts +5 -1
  228. package/dist/components/form/wrapper.js +8 -3
  229. package/dist/components/form/wrapper.js.map +1 -1
  230. package/dist/components/helpers/DisplayTransition/DisplayTransition.js +1 -1
  231. package/dist/components/helpers/IconSwitch/IconSwitch.js +1 -1
  232. package/dist/components/layout/Board/Board.js +1 -1
  233. package/dist/components/layout/Board/BoardProvider.js +1 -1
  234. package/dist/components/layout/Board/BoardResponsive.js +1 -1
  235. package/dist/components/layout/Board/Widget.js +1 -1
  236. package/dist/components/layout/Board/WidgetHost.js +1 -1
  237. package/dist/components/layout/Board/board-context.js +1 -1
  238. package/dist/components/layout/Board/board-store.js +1 -1
  239. package/dist/components/layout/Board/grid-core/calculate.js +1 -1
  240. package/dist/components/layout/Board/grid-core/collision.js +1 -1
  241. package/dist/components/layout/Board/grid-core/compactors.js +1 -1
  242. package/dist/components/layout/Board/grid-core/constraints.js +1 -1
  243. package/dist/components/layout/Board/grid-core/layout.js +1 -1
  244. package/dist/components/layout/Board/grid-core/sort.js +1 -1
  245. package/dist/components/layout/Board/index.js +1 -1
  246. package/dist/components/layout/Board/responsive-utils.js +1 -1
  247. package/dist/components/layout/Board/use-board-layout.js +1 -1
  248. package/dist/components/layout/Board/use-board-registry.js +1 -1
  249. package/dist/components/layout/Flex.js +1 -1
  250. package/dist/components/layout/Flow.js +1 -1
  251. package/dist/components/layout/Grid.js +1 -1
  252. package/dist/components/layout/Panel.js +1 -1
  253. package/dist/components/layout/Prefix.js +1 -1
  254. package/dist/components/layout/ResizablePanel.js +1 -1
  255. package/dist/components/layout/Space.js +1 -1
  256. package/dist/components/layout/Suffix.js +1 -1
  257. package/dist/components/navigation/Tabs/DraggableTabList.js +1 -1
  258. package/dist/components/navigation/Tabs/TabButton.js +1 -1
  259. package/dist/components/navigation/Tabs/TabDropIndicator.js +1 -1
  260. package/dist/components/navigation/Tabs/TabPanel.js +1 -1
  261. package/dist/components/navigation/Tabs/TabPicker.js +1 -1
  262. package/dist/components/navigation/Tabs/Tabs.js +1 -1
  263. package/dist/components/navigation/Tabs/TabsAction.js +1 -1
  264. package/dist/components/navigation/Tabs/TabsContext.js +1 -1
  265. package/dist/components/navigation/Tabs/popover-placement.js +1 -1
  266. package/dist/components/navigation/Tabs/styled.js +1 -1
  267. package/dist/components/navigation/Tabs/types.js +1 -1
  268. package/dist/components/navigation/Tabs/use-tab-editing.js +1 -1
  269. package/dist/components/navigation/Tabs/use-tab-indicator.js +1 -1
  270. package/dist/components/organisms/FileTabs/FileTabs.js +1 -1
  271. package/dist/components/organisms/StatsCard/StatsCard.js +1 -1
  272. package/dist/components/other/Calendar/Calendar.js +1 -1
  273. package/dist/components/other/Calendar/CalendarCell.js +1 -1
  274. package/dist/components/other/Calendar/CalendarGrid.js +1 -1
  275. package/dist/components/other/Calendar/RangeCalendar.js +1 -1
  276. package/dist/components/other/CloudLogo/CloudLogo.js +1 -1
  277. package/dist/components/overlays/AlertDialog/AlertDialog.js +1 -1
  278. package/dist/components/overlays/AlertDialog/AlertDialogApiProvider.js +1 -1
  279. package/dist/components/overlays/AlertDialog/AlertDialogZone.js +1 -1
  280. package/dist/components/overlays/Dialog/Dialog.js +1 -1
  281. package/dist/components/overlays/Dialog/DialogContainer.js +1 -1
  282. package/dist/components/overlays/Dialog/DialogForm.js +4 -3
  283. package/dist/components/overlays/Dialog/DialogForm.js.map +1 -1
  284. package/dist/components/overlays/Dialog/DialogTrigger.js +1 -1
  285. package/dist/components/overlays/Dialog/context.js +1 -1
  286. package/dist/components/overlays/Dialog/use-dialog-container.js +1 -1
  287. package/dist/components/overlays/Modal/Modal.js +1 -1
  288. package/dist/components/overlays/Modal/OpenTransitionContext.js +1 -1
  289. package/dist/components/overlays/Modal/Overlay.js +1 -1
  290. package/dist/components/overlays/Modal/Popover.js +1 -1
  291. package/dist/components/overlays/Modal/Tray.js +1 -1
  292. package/dist/components/overlays/Modal/Underlay.js +1 -1
  293. package/dist/components/overlays/Notifications/Notification.js +1 -1
  294. package/dist/components/overlays/Notifications/NotificationAction.js +1 -1
  295. package/dist/components/overlays/Notifications/NotificationCard.js +1 -1
  296. package/dist/components/overlays/Notifications/NotificationContext.js +1 -1
  297. package/dist/components/overlays/Notifications/NotificationItem.js +1 -1
  298. package/dist/components/overlays/Notifications/OverlayContainer.js +1 -1
  299. package/dist/components/overlays/Notifications/OverlayProvider.js +1 -1
  300. package/dist/components/overlays/Notifications/PersistentNotificationsList.js +1 -1
  301. package/dist/components/overlays/Notifications/dismissed-storage.js +1 -1
  302. package/dist/components/overlays/Notifications/format-relative-time.js +1 -1
  303. package/dist/components/overlays/Notifications/index.js +1 -1
  304. package/dist/components/overlays/Notifications/use-notification-state.js +1 -1
  305. package/dist/components/overlays/Notifications/use-notifications.js +1 -1
  306. package/dist/components/overlays/Notifications/use-overlay-timers.js +1 -1
  307. package/dist/components/overlays/Notifications/use-persistent-notifications.js +1 -1
  308. package/dist/components/overlays/Notifications/use-persistent-state.js +1 -1
  309. package/dist/components/overlays/Notifications/use-toast-state.js +1 -1
  310. package/dist/components/overlays/Toast/ToastItem.js +1 -1
  311. package/dist/components/overlays/Toast/index.js +1 -1
  312. package/dist/components/overlays/Toast/useProgressToast.js +1 -1
  313. package/dist/components/overlays/Toast/useToast.js +1 -1
  314. package/dist/components/overlays/Tooltip/Tooltip.js +1 -1
  315. package/dist/components/overlays/Tooltip/TooltipProvider.js +1 -1
  316. package/dist/components/overlays/Tooltip/TooltipTrigger.js +1 -1
  317. package/dist/components/overlays/Tooltip/context.js +1 -1
  318. package/dist/components/portal/Portal.js +1 -1
  319. package/dist/components/portal/PortalProvider.js +1 -1
  320. package/dist/components/portal/usePortal.js +1 -1
  321. package/dist/components/shared/DraggableCollection.js +1 -1
  322. package/dist/components/shared/InvalidIcon.js +1 -1
  323. package/dist/components/shared/ValidIcon.js +1 -1
  324. package/dist/components/status/LoadingAnimation/LoadingAnimation.js +1 -1
  325. package/dist/components/status/Spin/Cube.js +1 -1
  326. package/dist/components/status/Spin/InternalSpinner.js +1 -1
  327. package/dist/components/status/Spin/Spin.js +1 -1
  328. package/dist/components/status/Spin/SpinsContainer.js +1 -1
  329. package/dist/data/item-themes.js +1 -1
  330. package/dist/data/themes.js +1 -1
  331. package/dist/i18n/I18nProvider.js +1 -1
  332. package/dist/i18n/createFormatter.js +1 -1
  333. package/dist/i18n/index.js +1 -1
  334. package/dist/i18n/instance.js +1 -1
  335. package/dist/i18n/locales/de-DE/uikit.js +1 -1
  336. package/dist/i18n/locales/en-US/uikit.js +1 -1
  337. package/dist/i18n/locales/es-ES/uikit.js +1 -1
  338. package/dist/i18n/locales/es-MX/uikit.js +1 -1
  339. package/dist/i18n/locales/fr-FR/uikit.js +1 -1
  340. package/dist/i18n/locales/it-IT/uikit.js +1 -1
  341. package/dist/i18n/locales/ja-JP/uikit.js +1 -1
  342. package/dist/i18n/locales/nb-NO/uikit.js +1 -1
  343. package/dist/i18n/locales/pt-BR/uikit.js +1 -1
  344. package/dist/i18n/locales/pt-PT/uikit.js +1 -1
  345. package/dist/i18n/locales/sv-SE/uikit.js +1 -1
  346. package/dist/i18n/locales/vi-VN/uikit.js +1 -1
  347. package/dist/i18n/locales.js +1 -1
  348. package/dist/i18n/useFormatter.js +1 -1
  349. package/dist/i18n/useI18n.js +1 -1
  350. package/dist/icons/AdjustmentsHorizontalIcon.js +1 -1
  351. package/dist/icons/AdjustmentsIcon.js +1 -1
  352. package/dist/icons/AiIcon.js +1 -1
  353. package/dist/icons/AreaChartIcon.js +1 -1
  354. package/dist/icons/BackwardIcon.js +1 -1
  355. package/dist/icons/BarChartIcon.js +1 -1
  356. package/dist/icons/BellFilledIcon.js +1 -1
  357. package/dist/icons/BellIcon.js +1 -1
  358. package/dist/icons/BooleanIcon.js +1 -1
  359. package/dist/icons/CalendarEditIcon.js +1 -1
  360. package/dist/icons/CalendarIcon.js +1 -1
  361. package/dist/icons/CaretDownIcon.js +1 -1
  362. package/dist/icons/CaretUpIcon.js +1 -1
  363. package/dist/icons/ChartAreaStackedIcon.js +1 -1
  364. package/dist/icons/ChartAreaStackedPercentageIcon.js +1 -1
  365. package/dist/icons/ChartBarGroupedHorizontalIcon.js +1 -1
  366. package/dist/icons/ChartBarGroupedIcon.js +1 -1
  367. package/dist/icons/ChartBarHorizontalIcon.js +1 -1
  368. package/dist/icons/ChartBarLineIcon.js +1 -1
  369. package/dist/icons/ChartBarStackedHorizontalIcon.js +1 -1
  370. package/dist/icons/ChartBarStackedIcon.js +1 -1
  371. package/dist/icons/ChartBarStackedPercentageHorizontalIcon.js +1 -1
  372. package/dist/icons/ChartBarStackedPercentageIcon.js +1 -1
  373. package/dist/icons/ChartBoxPlot2Icon.js +1 -1
  374. package/dist/icons/ChartBoxPlotIcon.js +1 -1
  375. package/dist/icons/ChartBubbleIcon.js +1 -1
  376. package/dist/icons/ChartDonut2Icon.js +1 -1
  377. package/dist/icons/ChartFunnelIcon.js +1 -1
  378. package/dist/icons/ChartHeatmapIcon.js +1 -1
  379. package/dist/icons/ChartKPIIcon.js +1 -1
  380. package/dist/icons/ChartPie2Icon.js +1 -1
  381. package/dist/icons/ChartScatterIcon.js +1 -1
  382. package/dist/icons/CheckCircleFilledIcon.js +1 -1
  383. package/dist/icons/CheckCircleIcon.js +1 -1
  384. package/dist/icons/CheckIcon.js +1 -1
  385. package/dist/icons/CircleFilledIcon.js +1 -1
  386. package/dist/icons/ClearIcon.js +1 -1
  387. package/dist/icons/CloseCircleFilledIcon.js +1 -1
  388. package/dist/icons/CloseCircleIcon.js +1 -1
  389. package/dist/icons/CloseIcon.js +1 -1
  390. package/dist/icons/CodeIcon.js +1 -1
  391. package/dist/icons/ColumnTotalIcon.js +1 -1
  392. package/dist/icons/CopyIcon.js +1 -1
  393. package/dist/icons/CountIcon.js +1 -1
  394. package/dist/icons/CubeIcon.js +1 -1
  395. package/dist/icons/CubePauseIcon.js +1 -1
  396. package/dist/icons/CubePlayIcon.js +1 -1
  397. package/dist/icons/CurrencyDollarIcon.js +1 -1
  398. package/dist/icons/DangerIcon.js +1 -1
  399. package/dist/icons/DashboardIcon.js +1 -1
  400. package/dist/icons/DatabaseIcon.js +1 -1
  401. package/dist/icons/DecimalDecreaseIcon.js +1 -1
  402. package/dist/icons/DecimalIncreaseIcon.js +1 -1
  403. package/dist/icons/DirectionIcon.js +1 -1
  404. package/dist/icons/DonutIcon.js +1 -1
  405. package/dist/icons/DownIcon.js +1 -1
  406. package/dist/icons/EditIcon.js +1 -1
  407. package/dist/icons/ExclamationCircleFilledIcon.js +1 -1
  408. package/dist/icons/ExclamationCircleIcon.js +1 -1
  409. package/dist/icons/ExclamationIcon.js +1 -1
  410. package/dist/icons/EyeIcon.js +1 -1
  411. package/dist/icons/EyeInvisibleIcon.js +1 -1
  412. package/dist/icons/FilterIcon.js +1 -1
  413. package/dist/icons/FolderFilledIcon.js +1 -1
  414. package/dist/icons/FolderIcon.js +1 -1
  415. package/dist/icons/FolderOpenFilledIcon.js +1 -1
  416. package/dist/icons/FolderOpenIcon.js +1 -1
  417. package/dist/icons/ForwardIcon.js +1 -1
  418. package/dist/icons/GripVerticalIcon.js +1 -1
  419. package/dist/icons/HierarchyIcon.js +1 -1
  420. package/dist/icons/HierarchyOpenIcon.js +1 -1
  421. package/dist/icons/Icon.js +1 -1
  422. package/dist/icons/InfoCircleIcon.js +1 -1
  423. package/dist/icons/InfoIcon.js +1 -1
  424. package/dist/icons/KeyIcon.js +1 -1
  425. package/dist/icons/LeftIcon.js +1 -1
  426. package/dist/icons/LineChartIcon.js +1 -1
  427. package/dist/icons/LoadingIcon.js +1 -1
  428. package/dist/icons/LockFilledIcon.js +1 -1
  429. package/dist/icons/LockIcon.js +1 -1
  430. package/dist/icons/MoreIcon.js +1 -1
  431. package/dist/icons/NotAllowedIcon.js +1 -1
  432. package/dist/icons/Number123Icon.js +1 -1
  433. package/dist/icons/NumberIcon.js +1 -1
  434. package/dist/icons/PauseCircleFilledIcon.js +1 -1
  435. package/dist/icons/PauseCircleIcon.js +1 -1
  436. package/dist/icons/PauseIcon.js +1 -1
  437. package/dist/icons/PercentageIcon.js +1 -1
  438. package/dist/icons/PieChartIcon.js +1 -1
  439. package/dist/icons/PlayCircleIcon.js +1 -1
  440. package/dist/icons/PlayIcon.js +1 -1
  441. package/dist/icons/PlusIcon.js +1 -1
  442. package/dist/icons/ProgressBarIcon.js +1 -1
  443. package/dist/icons/ReloadIcon.js +1 -1
  444. package/dist/icons/ReportIcon.js +1 -1
  445. package/dist/icons/ReturnIcon.js +1 -1
  446. package/dist/icons/RightIcon.js +1 -1
  447. package/dist/icons/RowTotalsIcon.js +1 -1
  448. package/dist/icons/SchemeIcon.js +1 -1
  449. package/dist/icons/SearchIcon.js +1 -1
  450. package/dist/icons/SemanticQueryIcon.js +1 -1
  451. package/dist/icons/SettingsIcon.js +1 -1
  452. package/dist/icons/ShieldFilledIcon.js +1 -1
  453. package/dist/icons/ShieldIcon.js +1 -1
  454. package/dist/icons/SlashIcon.js +1 -1
  455. package/dist/icons/SparklesIcon.js +1 -1
  456. package/dist/icons/SqlIcon.js +1 -1
  457. package/dist/icons/StatsIcon.js +1 -1
  458. package/dist/icons/StopIcon.js +1 -1
  459. package/dist/icons/StringIcon.js +1 -1
  460. package/dist/icons/SubtotalsIcon.js +1 -1
  461. package/dist/icons/SwitchIcon.js +1 -1
  462. package/dist/icons/TableIcon.js +1 -1
  463. package/dist/icons/ThumbsDownIcon.js +1 -1
  464. package/dist/icons/ThumbsUpIcon.js +1 -1
  465. package/dist/icons/ThunderboltCrossedIcon.js +1 -1
  466. package/dist/icons/ThunderboltFilledIcon.js +1 -1
  467. package/dist/icons/ThunderboltIcon.js +1 -1
  468. package/dist/icons/TimeIcon.js +1 -1
  469. package/dist/icons/TrashIcon.js +1 -1
  470. package/dist/icons/UnlockIcon.js +1 -1
  471. package/dist/icons/UpIcon.js +1 -1
  472. package/dist/icons/UserGroupIcon.js +1 -1
  473. package/dist/icons/UserIcon.js +1 -1
  474. package/dist/icons/UserLockIcon.js +1 -1
  475. package/dist/icons/ViewIcon.js +1 -1
  476. package/dist/icons/WarningFilledIcon.js +1 -1
  477. package/dist/icons/WarningIcon.js +1 -1
  478. package/dist/icons/wrap-icon.js +1 -1
  479. package/dist/index.d.ts +6 -4
  480. package/dist/index.js +5 -3
  481. package/dist/index.js.map +1 -1
  482. package/dist/provider.d.ts +2 -1
  483. package/dist/provider.js +6 -4
  484. package/dist/provider.js.map +1 -1
  485. package/dist/providers/TrackingProvider.js +1 -1
  486. package/dist/providers/navigationAdapter.default.js +1 -1
  487. package/dist/shared/form.d.ts +17 -4
  488. package/dist/shared/index.d.ts +1 -1
  489. package/dist/tokens/base.js +1 -1
  490. package/dist/tokens/colors.js +1 -1
  491. package/dist/tokens/index.js +1 -1
  492. package/dist/tokens/layout.js +1 -1
  493. package/dist/tokens/palette.js +1 -1
  494. package/dist/tokens/shadows.js +1 -1
  495. package/dist/tokens/sizes.js +1 -1
  496. package/dist/tokens/spacing.js +1 -1
  497. package/dist/tokens/typography.js +1 -1
  498. package/dist/utils/ResizeSensor.js +1 -1
  499. package/dist/utils/is-dev-env.js +1 -1
  500. package/dist/utils/modules.js +1 -1
  501. package/dist/utils/promise.js +1 -1
  502. package/dist/utils/raf.js +1 -1
  503. package/dist/utils/random.js +1 -1
  504. package/dist/utils/range.js +1 -1
  505. package/dist/utils/react/RenderCache.js +1 -1
  506. package/dist/utils/react/Slots.js +1 -1
  507. package/dist/utils/react/chain.js +1 -1
  508. package/dist/utils/react/forwardRefWithGenerics.js +1 -1
  509. package/dist/utils/react/index.js +1 -1
  510. package/dist/utils/react/interactions.js +1 -1
  511. package/dist/utils/react/isTextOnly.js +1 -1
  512. package/dist/utils/react/mapProps.js +1 -1
  513. package/dist/utils/react/mergeProps.js +1 -1
  514. package/dist/utils/react/nullableValue.js +1 -1
  515. package/dist/utils/react/resolveIcon.js +1 -1
  516. package/dist/utils/react/sharedStore.js +1 -1
  517. package/dist/utils/react/useCombinedRefs.js +1 -1
  518. package/dist/utils/react/useControlledFocusVisible.js +1 -1
  519. package/dist/utils/react/useEventBus.js +1 -1
  520. package/dist/utils/react/useId.js +1 -1
  521. package/dist/utils/react/useIsDarwin.js +1 -1
  522. package/dist/utils/react/useKeySymbols.js +1 -1
  523. package/dist/utils/react/useLayoutEffect.js +1 -1
  524. package/dist/utils/react/useLocalStorage.js +1 -1
  525. package/dist/utils/react/useMergeStyles.js +1 -1
  526. package/dist/utils/react/usePopoverSync.js +1 -1
  527. package/dist/utils/react/useQaProps.js +1 -1
  528. package/dist/utils/react/useViewportSize.js +1 -1
  529. package/dist/utils/react/wrapNodeIfPlain.js +1 -1
  530. package/dist/utils/selection.js +1 -1
  531. package/dist/utils/styles.js +1 -1
  532. package/dist/utils/tree.js +1 -1
  533. package/dist/utils/warnings.js +1 -1
  534. package/dist/version.js +2 -2
  535. package/docs/FieldProperties.md +4 -2
  536. package/docs/Introduction.md +1 -1
  537. package/docs/components/fields/Checkbox.md +1 -1
  538. package/docs/components/fields/CommandTextArea.md +1 -1
  539. package/docs/components/fields/DatePicker.md +1 -1
  540. package/docs/components/fields/FileInput.md +3 -1
  541. package/docs/components/fields/FilterListBox.md +2 -2
  542. package/docs/components/fields/ListBox.md +2 -2
  543. package/docs/components/fields/NumberInput.md +3 -3
  544. package/docs/components/fields/PasswordInput.md +3 -2
  545. package/docs/components/fields/Picker.md +5 -5
  546. package/docs/components/fields/SearchInput.md +5 -4
  547. package/docs/components/fields/Select.md +3 -3
  548. package/docs/components/fields/Slider.md +4 -0
  549. package/docs/components/fields/TextInput.md +3 -3
  550. package/docs/components/fields/TextInputMapper.md +5 -0
  551. package/docs/components/form/Field.md +10 -9
  552. package/docs/components/form/Form.md +3 -1
  553. package/docs/components/overlays/DialogForm.md +3 -1
  554. package/package.json +1 -1
  555. package/dist/components/form/FieldWrapper/extract-field-wrapper-props.d.ts +0 -12
  556. package/dist/components/form/FieldWrapper/extract-field-wrapper-props.js +0 -41
  557. package/dist/components/form/FieldWrapper/extract-field-wrapper-props.js.map +0 -1
@@ -1,10 +1,10 @@
1
- /** @license MIT | @cube-dev/ui-kit v0.147.3 | Cube Dev Team */
1
+ /** @license MIT | @cube-dev/ui-kit v0.148.0 | Cube Dev Team */
2
2
  import { extractStyles } from "../../../utils/styles.js";
3
3
  import { useCombinedRefs } from "../../../utils/react/useCombinedRefs.js";
4
- import { useProviderProps } from "../../../provider.js";
5
4
  import { useI18n } from "../../../i18n/useI18n.js";
6
5
  import { Action } from "../../actions/Action/Action.js";
7
- import { useFormProps } from "../../form/Form/Form.js";
6
+ import { getValidationMods } from "../../form/validation/resolve-validation-props.js";
7
+ import { ValidationIndicator } from "../../form/validation/ValidationIndicator.js";
8
8
  import { useFieldProps } from "../../form/Form/use-field/use-field-props.js";
9
9
  import { wrapWithField } from "../../form/wrapper.js";
10
10
  import { CONTAINER_STYLES, tasty } from "@tenphi/tasty";
@@ -31,6 +31,8 @@ const FileInputElement = tasty(Action, {
31
31
  },
32
32
  border: {
33
33
  "": true,
34
+ valid: "#success-text.50",
35
+ invalid: "#danger-text.50",
34
36
  ":focus-within & :focus-visible": "#primary-text"
35
37
  },
36
38
  radius: true,
@@ -65,6 +67,17 @@ const FileInputElement = tasty(Action, {
65
67
  width: "max 100%",
66
68
  overflow: "hidden"
67
69
  },
70
+ State: {
71
+ display: "flex",
72
+ placeItems: "center"
73
+ },
74
+ ValidationIcon: {
75
+ $: "> State >",
76
+ display: "grid",
77
+ placeItems: "center",
78
+ width: "min 2x",
79
+ fontSize: "$icon-size"
80
+ },
68
81
  Input: {
69
82
  position: "absolute",
70
83
  top: 0,
@@ -93,8 +106,6 @@ function extractFileNameFromValue(value) {
93
106
  }
94
107
  function FileInput(props, ref) {
95
108
  const { t } = useI18n();
96
- props = useProviderProps(props);
97
- props = useFormProps(props);
98
109
  props = useFieldProps({ ...props }, {
99
110
  defaultValidationTrigger: "onChange",
100
111
  valuePropsMapper: ({ value, onChange }) => ({
@@ -102,7 +113,7 @@ function FileInput(props, ref) {
102
113
  value: props.type === "file" || !props.type ? value : void 0
103
114
  })
104
115
  });
105
- let { id, name, qa, value, onChange, placeholder, inputRef, isDisabled, inputStyles, type = "file", inputProps, accept, form, ...otherProps } = props;
116
+ let { id, name, qa, value, onChange, placeholder, inputRef, isDisabled, isInvalid, isValid, inputStyles, type = "file", inputProps, accept, form, ...otherProps } = props;
106
117
  const [dragHover, setDragHover] = useState(false);
107
118
  const defaultValue = useMemo(() => type === "file" ? value : void 0, [type, value]);
108
119
  const [fileName, setFileName] = useState(useMemo(() => extractFileNameFromValue(defaultValue), []));
@@ -130,7 +141,11 @@ function FileInput(props, ref) {
130
141
  isDisabled,
131
142
  mods: {
132
143
  selected: !!value,
133
- "drag-hover": dragHover
144
+ "drag-hover": dragHover,
145
+ ...getValidationMods({
146
+ isInvalid,
147
+ isValid
148
+ })
134
149
  },
135
150
  onKeyDown: (e) => {
136
151
  if (e.key === "Enter" || e.key === "Space") inputRef?.current?.click();
@@ -167,6 +182,10 @@ function FileInput(props, ref) {
167
182
  /* @__PURE__ */ jsx("div", {
168
183
  "data-element": fileName ? "Value" : "Placeholder",
169
184
  children: fileName || placeholder || t("fileInput.noFileSelected", "No file selected")
185
+ }),
186
+ /* @__PURE__ */ jsx(ValidationIndicator, {
187
+ isInvalid,
188
+ isValid
170
189
  })
171
190
  ]
172
191
  }), domRef, { ...props });
@@ -1 +1 @@
1
- {"version":3,"file":"FileInput.js","names":[],"sources":["../../../../src/components/fields/FileInput/FileInput.tsx"],"sourcesContent":["import { createFocusableRef } from '@react-spectrum/utils';\nimport {\n BaseProps,\n BlockStyleProps,\n CONTAINER_STYLES,\n ContainerStyleProps,\n PositionStyleProps,\n Props,\n Styles,\n tasty,\n} from '@tenphi/tasty';\nimport {\n forwardRef,\n RefObject,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { useI18n } from '../../../i18n';\nimport { useProviderProps } from '../../../provider';\nimport { FieldBaseProps } from '../../../shared';\nimport { useCombinedRefs } from '../../../utils/react';\nimport { extractStyles } from '../../../utils/styles';\nimport { Action } from '../../actions';\nimport { useFieldProps, useFormProps, wrapWithField } from '../../form';\n\nimport type { AriaTextFieldProps } from 'react-aria';\n\nconst FileInputElement = tasty(Action, {\n qa: 'FileInputWrapper',\n styles: {\n display: 'inline-flex',\n position: 'relative',\n preset: 't3',\n padding: '.5x 1x',\n gap: '1x',\n flow: 'row',\n placeItems: 'center start',\n fill: {\n '': '#surface',\n 'drag-hover': '#primary.16',\n ':hover': '#primary.08',\n disabled: '#disabled-surface',\n },\n border: {\n '': true,\n ':focus-within & :focus-visible': '#primary-text',\n },\n radius: true,\n cursor: '$pointer',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n\n Button: {\n radius: true,\n border: {\n '': '#clear',\n pressed: '#primary.30',\n },\n fill: '#primary.12',\n color: {\n '': '#primary',\n disabled: '#dark.30',\n },\n padding: '.5x (1.5x - 1px)',\n transition: 'theme',\n },\n\n Placeholder: {\n color: '#dark-02',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n width: 'max 100%',\n overflow: 'hidden',\n },\n\n Value: {\n color: '#dark-02',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n width: 'max 100%',\n overflow: 'hidden',\n },\n\n Input: {\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n radius: '$content-radius',\n opacity: 0.01,\n cursor: '$pointer',\n zIndex: 10,\n },\n },\n});\n\nexport interface CubeFileInputProps\n extends BaseProps,\n PositionStyleProps,\n ContainerStyleProps,\n BlockStyleProps,\n AriaTextFieldProps,\n FieldBaseProps {\n /**\n * The size of the input\n * @default default\n */\n size?: 'small' | 'default' | 'large' | string;\n /** The input ref */\n inputRef?: RefObject<HTMLInputElement>;\n /** Style map for the input */\n inputStyles?: Styles;\n /**\n * The type of the input\n * @default file\n */\n type?: 'file' | 'text';\n /** Direct input props */\n inputProps?: Props;\n /** The file types that the input should accept */\n accept?: string;\n value?: string;\n onChange?: (value: string) => void;\n placeholder?: string;\n}\n\nfunction extractContents(element, callback) {\n const files = element?.files;\n\n if (files && files.length > 0) {\n const fileReader = new FileReader();\n\n fileReader.onload = function () {\n callback(fileReader.result);\n };\n\n fileReader.readAsText(files[0]);\n }\n}\n\nfunction extractFileNameFromValue(value?: string) {\n return typeof value === 'string'\n ? (value as string).split('\\\\')?.pop()\n : undefined;\n}\n\nfunction FileInput(props: CubeFileInputProps, ref) {\n const { t } = useI18n();\n\n props = useProviderProps(props);\n props = useFormProps(props);\n props = useFieldProps(\n { ...props },\n {\n defaultValidationTrigger: 'onChange',\n valuePropsMapper: ({ value, onChange }) => ({\n onChange,\n value: props.type === 'file' || !props.type ? value : undefined,\n }),\n },\n );\n\n let {\n id,\n name,\n qa,\n value,\n onChange,\n placeholder,\n inputRef,\n isDisabled,\n inputStyles,\n type = 'file',\n inputProps,\n accept,\n form,\n ...otherProps\n } = props;\n\n const [dragHover, setDragHover] = useState(false);\n const defaultValue = useMemo(\n () => (type === 'file' ? value : undefined),\n [type, value],\n );\n const defaultFileName = useMemo(\n () => extractFileNameFromValue(defaultValue),\n [],\n );\n const [fileName, setFileName] = useState<string | undefined>(defaultFileName);\n\n let domRef = useRef(null);\n\n inputRef = useCombinedRefs(inputRef);\n\n const onLocalChange = useCallback(\n (event: any) => {\n const value = event.target.value;\n\n setFileName(extractFileNameFromValue(value));\n\n if (type === 'file') {\n onChange?.(value);\n } else {\n extractContents(event.target, onChange);\n }\n },\n [onChange],\n );\n\n let styles = extractStyles(otherProps, CONTAINER_STYLES);\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef?.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef?.current;\n },\n }));\n\n const fileInput = (\n <FileInputElement\n ref={domRef}\n styles={inputStyles}\n isDisabled={isDisabled}\n mods={{\n selected: !!value,\n 'drag-hover': dragHover,\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === 'Space') {\n inputRef?.current?.click();\n }\n }}\n >\n <input\n ref={inputRef}\n id={id}\n name={name}\n accept={accept}\n data-qa={qa || 'FileInput'}\n data-input-type=\"fileinput\"\n data-element=\"Input\"\n disabled={isDisabled}\n type=\"file\"\n multiple={false}\n tabIndex={-1}\n onChange={onLocalChange}\n onDragEnter={() => {\n setDragHover(true);\n }}\n onDragLeave={() => {\n setDragHover(false);\n }}\n onDrop={() => {\n setDragHover(false);\n }}\n {...inputProps}\n />\n <div data-element=\"Button\">\n {t('fileInput.chooseFile', 'Choose file')}\n </div>\n <div data-element={fileName ? 'Value' : 'Placeholder'}>\n {fileName ||\n placeholder ||\n t('fileInput.noFileSelected', 'No file selected')}\n </div>\n </FileInputElement>\n );\n\n return wrapWithField(fileInput, domRef, {\n ...props,\n });\n}\n\n/**\n * FileInputs are file inputs that allow users to select local files to\n * upload them to the server.\n */\nconst _FileInput = forwardRef(FileInput);\n\n_FileInput.displayName = 'FileInput';\n\nexport { _FileInput as FileInput };\n"],"mappings":";;;;;;;;;;;;;;;AA+BA,MAAM,mBAAmB,MAAM,QAAQ;CACrC,IAAI;CACJ,QAAQ;EACN,SAAS;EACT,UAAU;EACV,QAAQ;EACR,SAAS;EACT,KAAK;EACL,MAAM;EACN,YAAY;EACZ,MAAM;GACJ,IAAI;GACJ,cAAc;GACd,UAAU;GACV,UAAU;GACX;EACD,QAAQ;GACN,IAAI;GACJ,kCAAkC;GACnC;EACD,QAAQ;EACR,QAAQ;EACR,UAAU;EACV,YAAY;EAEZ,QAAQ;GACN,QAAQ;GACR,QAAQ;IACN,IAAI;IACJ,SAAS;IACV;GACD,MAAM;GACN,OAAO;IACL,IAAI;IACJ,UAAU;IACX;GACD,SAAS;GACT,YAAY;GACb;EAED,aAAa;GACX,OAAO;GACP,YAAY;GACZ,cAAc;GACd,OAAO;GACP,UAAU;GACX;EAED,OAAO;GACL,OAAO;GACP,YAAY;GACZ,cAAc;GACd,OAAO;GACP,UAAU;GACX;EAED,OAAO;GACL,UAAU;GACV,KAAK;GACL,OAAO;GACP,QAAQ;GACR,MAAM;GACN,QAAQ;GACR,SAAS;GACT,QAAQ;GACR,QAAQ;GACT;EACF;CACF,CAAC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,SAAS;AACP,OAAI,UAAU,QACZ,UAAS,QAAQ,QAAQ;;EAG7B,kBAAkB;AAChB,UAAO,UAAU;;EAEpB,EAAE;AAoDH,QAAO,cAjDL,qBAAC;EACC,KAAK;EACL,QAAQ;EACI;EACZ,MAAM;GACJ,UAAU,CAAC,CAAC;GACZ,cAAc;GACf;EACD,YAAY,MAAM;AAChB,OAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,QACjC,WAAU,SAAS,OAAO;;;GAI9B,oBAAC;IACC,KAAK;IACD;IACE;IACE;IACR,WAAS,MAAM;IACf,mBAAgB;IAChB,gBAAa;IACb,UAAU;IACV,MAAK;IACL,UAAU;IACV,UAAU;IACV,UAAU;IACV,mBAAmB;AACjB,kBAAa,KAAK;;IAEpB,mBAAmB;AACjB,kBAAa,MAAM;;IAErB,cAAc;AACZ,kBAAa,MAAM;;IAErB,GAAI;KACJ;GACF,oBAAC;IAAI,gBAAa;cACf,EAAE,wBAAwB,cAAc;KACrC;GACN,oBAAC;IAAI,gBAAc,WAAW,UAAU;cACrC,YACC,eACA,EAAE,4BAA4B,mBAAmB;KAC/C;;GACW,EAGW,QAAQ,EACtC,GAAG,OACJ,CAAC;;;;;;AAOJ,MAAM,aAAa,WAAW,UAAU;AAExC,WAAW,cAAc"}
1
+ {"version":3,"file":"FileInput.js","names":[],"sources":["../../../../src/components/fields/FileInput/FileInput.tsx"],"sourcesContent":["import { createFocusableRef } from '@react-spectrum/utils';\nimport {\n BaseProps,\n BlockStyleProps,\n CONTAINER_STYLES,\n ContainerStyleProps,\n PositionStyleProps,\n Props,\n Styles,\n tasty,\n} from '@tenphi/tasty';\nimport {\n forwardRef,\n RefObject,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { useI18n } from '../../../i18n';\nimport { FieldBaseProps } from '../../../shared';\nimport { useCombinedRefs } from '../../../utils/react';\nimport { extractStyles } from '../../../utils/styles';\nimport { Action } from '../../actions';\nimport {\n getValidationMods,\n useFieldProps,\n ValidationIndicator,\n wrapWithField,\n} from '../../form';\n\nimport type { AriaTextFieldProps } from 'react-aria';\n\nconst FileInputElement = tasty(Action, {\n qa: 'FileInputWrapper',\n styles: {\n display: 'inline-flex',\n position: 'relative',\n preset: 't3',\n padding: '.5x 1x',\n gap: '1x',\n flow: 'row',\n placeItems: 'center start',\n fill: {\n '': '#surface',\n 'drag-hover': '#primary.16',\n ':hover': '#primary.08',\n disabled: '#disabled-surface',\n },\n border: {\n '': true,\n valid: '#success-text.50',\n invalid: '#danger-text.50',\n ':focus-within & :focus-visible': '#primary-text',\n },\n radius: true,\n cursor: '$pointer',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n\n Button: {\n radius: true,\n border: {\n '': '#clear',\n pressed: '#primary.30',\n },\n fill: '#primary.12',\n color: {\n '': '#primary',\n disabled: '#dark.30',\n },\n padding: '.5x (1.5x - 1px)',\n transition: 'theme',\n },\n\n Placeholder: {\n color: '#dark-02',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n width: 'max 100%',\n overflow: 'hidden',\n },\n\n Value: {\n color: '#dark-02',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n width: 'max 100%',\n overflow: 'hidden',\n },\n\n State: {\n display: 'flex',\n placeItems: 'center',\n },\n\n ValidationIcon: {\n $: '> State >',\n display: 'grid',\n placeItems: 'center',\n width: 'min 2x',\n fontSize: '$icon-size',\n },\n\n Input: {\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n radius: '$content-radius',\n opacity: 0.01,\n cursor: '$pointer',\n zIndex: 10,\n },\n },\n});\n\nexport interface CubeFileInputProps\n extends BaseProps,\n PositionStyleProps,\n ContainerStyleProps,\n BlockStyleProps,\n AriaTextFieldProps,\n FieldBaseProps {\n /**\n * The size of the input\n * @default default\n */\n size?: 'small' | 'default' | 'large' | string;\n /** The input ref */\n inputRef?: RefObject<HTMLInputElement>;\n /** Style map for the input */\n inputStyles?: Styles;\n /**\n * The type of the input\n * @default file\n */\n type?: 'file' | 'text';\n /** Direct input props */\n inputProps?: Props;\n /** The file types that the input should accept */\n accept?: string;\n value?: string;\n onChange?: (value: string) => void;\n placeholder?: string;\n}\n\nfunction extractContents(element, callback) {\n const files = element?.files;\n\n if (files && files.length > 0) {\n const fileReader = new FileReader();\n\n fileReader.onload = function () {\n callback(fileReader.result);\n };\n\n fileReader.readAsText(files[0]);\n }\n}\n\nfunction extractFileNameFromValue(value?: string) {\n return typeof value === 'string'\n ? (value as string).split('\\\\')?.pop()\n : undefined;\n}\n\nfunction FileInput(props: CubeFileInputProps, ref) {\n const { t } = useI18n();\n\n props = useFieldProps(\n { ...props },\n {\n defaultValidationTrigger: 'onChange',\n valuePropsMapper: ({ value, onChange }) => ({\n onChange,\n value: props.type === 'file' || !props.type ? value : undefined,\n }),\n },\n );\n\n let {\n id,\n name,\n qa,\n value,\n onChange,\n placeholder,\n inputRef,\n isDisabled,\n isInvalid,\n isValid,\n inputStyles,\n type = 'file',\n inputProps,\n accept,\n form,\n ...otherProps\n } = props;\n\n const [dragHover, setDragHover] = useState(false);\n const defaultValue = useMemo(\n () => (type === 'file' ? value : undefined),\n [type, value],\n );\n const defaultFileName = useMemo(\n () => extractFileNameFromValue(defaultValue),\n [],\n );\n const [fileName, setFileName] = useState<string | undefined>(defaultFileName);\n\n let domRef = useRef(null);\n\n inputRef = useCombinedRefs(inputRef);\n\n const onLocalChange = useCallback(\n (event: any) => {\n const value = event.target.value;\n\n setFileName(extractFileNameFromValue(value));\n\n if (type === 'file') {\n onChange?.(value);\n } else {\n extractContents(event.target, onChange);\n }\n },\n [onChange],\n );\n\n let styles = extractStyles(otherProps, CONTAINER_STYLES);\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef?.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef?.current;\n },\n }));\n\n const fileInput = (\n <FileInputElement\n ref={domRef}\n styles={inputStyles}\n isDisabled={isDisabled}\n mods={{\n selected: !!value,\n 'drag-hover': dragHover,\n ...getValidationMods({ isInvalid, isValid }),\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === 'Space') {\n inputRef?.current?.click();\n }\n }}\n >\n <input\n ref={inputRef}\n id={id}\n name={name}\n accept={accept}\n data-qa={qa || 'FileInput'}\n data-input-type=\"fileinput\"\n data-element=\"Input\"\n disabled={isDisabled}\n type=\"file\"\n multiple={false}\n tabIndex={-1}\n onChange={onLocalChange}\n onDragEnter={() => {\n setDragHover(true);\n }}\n onDragLeave={() => {\n setDragHover(false);\n }}\n onDrop={() => {\n setDragHover(false);\n }}\n {...inputProps}\n />\n <div data-element=\"Button\">\n {t('fileInput.chooseFile', 'Choose file')}\n </div>\n <div data-element={fileName ? 'Value' : 'Placeholder'}>\n {fileName ||\n placeholder ||\n t('fileInput.noFileSelected', 'No file selected')}\n </div>\n <ValidationIndicator isInvalid={isInvalid} isValid={isValid} />\n </FileInputElement>\n );\n\n return wrapWithField(fileInput, domRef, {\n ...props,\n });\n}\n\n/**\n * FileInputs are file inputs that allow users to select local files to\n * upload them to the server.\n */\nconst _FileInput = forwardRef(FileInput);\n\n_FileInput.displayName = 'FileInput';\n\nexport { _FileInput as FileInput };\n"],"mappings":";;;;;;;;;;;;;;;AAmCA,MAAM,mBAAmB,MAAM,QAAQ;CACrC,IAAI;CACJ,QAAQ;EACN,SAAS;EACT,UAAU;EACV,QAAQ;EACR,SAAS;EACT,KAAK;EACL,MAAM;EACN,YAAY;EACZ,MAAM;GACJ,IAAI;GACJ,cAAc;GACd,UAAU;GACV,UAAU;GACX;EACD,QAAQ;GACN,IAAI;GACJ,OAAO;GACP,SAAS;GACT,kCAAkC;GACnC;EACD,QAAQ;EACR,QAAQ;EACR,UAAU;EACV,YAAY;EAEZ,QAAQ;GACN,QAAQ;GACR,QAAQ;IACN,IAAI;IACJ,SAAS;IACV;GACD,MAAM;GACN,OAAO;IACL,IAAI;IACJ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;AAExC,WAAW,cAAc"}
@@ -1,14 +1,13 @@
1
- /** @license MIT | @cube-dev/ui-kit v0.147.3 | Cube Dev Team */
1
+ /** @license MIT | @cube-dev/ui-kit v0.148.0 | Cube Dev Team */
2
2
  import { extractStyles } from "../../../utils/styles.js";
3
3
  import { mergeProps as mergeProps$1 } from "../../../utils/react/mergeProps.js";
4
4
  import { useCombinedRefs } from "../../../utils/react/useCombinedRefs.js";
5
5
  import { modAttrs } from "../../../utils/react/index.js";
6
6
  import { useFocus as useFocus$1 } from "../../../utils/react/interactions.js";
7
7
  import { LoadingIcon } from "../../../icons/LoadingIcon.js";
8
- import { useProviderProps } from "../../../provider.js";
9
8
  import { useI18n } from "../../../i18n/useI18n.js";
10
9
  import { StyledHeader } from "../../actions/Menu/styled.js";
11
- import { useFormProps } from "../../form/Form/Form.js";
10
+ import { getValidationMods } from "../../form/validation/resolve-validation-props.js";
12
11
  import { useFieldProps } from "../../form/Form/use-field/use-field-props.js";
13
12
  import { wrapWithField } from "../../form/wrapper.js";
14
13
  import { ListBox } from "../ListBox/ListBox.js";
@@ -80,8 +79,6 @@ const PROP_STYLES = [
80
79
  ...COLOR_STYLES
81
80
  ];
82
81
  const FilterListBox = forwardRef(function FilterListBox(props, ref) {
83
- props = useProviderProps(props);
84
- props = useFormProps(props);
85
82
  props = useFieldProps(props, { valuePropsMapper: ({ value, onChange }) => {
86
83
  const fieldProps = {};
87
84
  if (props.selectionMode === "multiple") fieldProps.selectedKeys = value || [];
@@ -94,7 +91,7 @@ const FilterListBox = forwardRef(function FilterListBox(props, ref) {
94
91
  return fieldProps;
95
92
  } });
96
93
  const { t } = useI18n();
97
- let { qa, label, extra, id, labelStyles, isRequired, necessityIndicator, validationState, isDisabled, isLoading, isLoadingItems, searchPlaceholder = t("filterListBox.searchPlaceholder", "Search..."), autoFocus, filter, mods: externalMods, emptyLabel, searchInputStyles, listStyles, optionStyles, sectionStyles, headingStyles, searchInputRef, listRef, message, description, styles, focusOnHover, shouldFocusWrap, labelSuffix, selectedKey, defaultSelectedKey, selectedKeys, defaultSelectedKeys, onSelectionChange: externalOnSelectionChange, allowsCustomValue = false, showSelectAll, selectAllLabel, header, footer, size = "medium", headerStyles, footerStyles, listBoxStyles, items, children: renderChildren, onEscape, isCheckable, onOptionClick, selectionMode = "single", allValueProps, customValueProps, newCustomValueProps, searchValue: controlledSearchValue, onSearchChange, _internalCollection, isReorderable = false, onReorder, form, ...otherProps } = props;
94
+ let { qa, label, extra, id, labelStyles, isRequired, necessityIndicator, isInvalid, isValid, isDisabled, isLoading, isLoadingItems, searchPlaceholder = t("filterListBox.searchPlaceholder", "Search..."), autoFocus, filter, mods: externalMods, emptyLabel, searchInputStyles, listStyles, optionStyles, sectionStyles, headingStyles, searchInputRef, listRef, message, description, styles, focusOnHover, shouldFocusWrap, labelSuffix, selectedKey, defaultSelectedKey, selectedKeys, defaultSelectedKeys, onSelectionChange: externalOnSelectionChange, allowsCustomValue = false, showSelectAll, selectAllLabel, header, footer, size = "medium", headerStyles, footerStyles, listBoxStyles, items, children: renderChildren, onEscape, isCheckable, onOptionClick, selectionMode = "single", allValueProps, customValueProps, newCustomValueProps, searchValue: controlledSearchValue, onSearchChange, _internalCollection, isReorderable = false, onReorder, form, ...otherProps } = props;
98
95
  let children = renderChildren;
99
96
  const renderFn = renderChildren;
100
97
  if (items && typeof renderFn === "function") try {
@@ -266,7 +263,6 @@ const FilterListBox = forwardRef(function FilterListBox(props, ref) {
266
263
  searchInputRef = useCombinedRefs(searchInputRef);
267
264
  listRef = useCombinedRefs(listRef);
268
265
  const { isFocused, focusProps } = useFocus$1({ isDisabled });
269
- const isInvalid = validationState === "invalid";
270
266
  const listBoxRef = useRef(null);
271
267
  const listStateRef = useRef(null);
272
268
  useLayoutEffect(() => {
@@ -406,8 +402,10 @@ const FilterListBox = forwardRef(function FilterListBox(props, ref) {
406
402
  }
407
403
  } });
408
404
  const mods = useMemo(() => ({
409
- invalid: isInvalid,
410
- valid: validationState === "valid",
405
+ ...getValidationMods({
406
+ isInvalid,
407
+ isValid
408
+ }),
411
409
  disabled: !!isDisabled,
412
410
  focused: isFocused,
413
411
  loading: !!isLoading,
@@ -418,7 +416,8 @@ const FilterListBox = forwardRef(function FilterListBox(props, ref) {
418
416
  ...externalMods
419
417
  }), [
420
418
  isInvalid,
421
- validationState,
419
+ isInvalid,
420
+ isValid,
422
421
  isDisabled,
423
422
  isFocused,
424
423
  isLoading,
@@ -515,7 +514,8 @@ const FilterListBox = forwardRef(function FilterListBox(props, ref) {
515
514
  optionStyles,
516
515
  sectionStyles,
517
516
  headingStyles,
518
- validationState,
517
+ isInvalid,
518
+ isValid,
519
519
  disallowEmptySelection: props.disallowEmptySelection,
520
520
  disabledKeys: props.disabledKeys,
521
521
  focusOnHover,
@@ -1 +1 @@
1
- {"version":3,"file":"FilterListBox.js","names":["mergeProps","BaseSection","useFocus"],"sources":["../../../../src/components/fields/FilterListBox/FilterListBox.tsx"],"sourcesContent":["import { Key } from '@react-types/shared';\nimport {\n BASE_STYLES,\n COLOR_STYLES,\n OUTER_STYLES,\n Styles,\n tasty,\n} from '@tenphi/tasty';\nimport {\n cloneElement,\n ForwardedRef,\n forwardRef,\n isValidElement,\n ReactElement,\n ReactNode,\n RefObject,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useFilter, useKeyboard } from 'react-aria';\nimport { Section as BaseSection, Item, useListState } from 'react-stately';\nimport { CubeCollectionItemProps } from 'src/components/CollectionItem';\n\nimport { useI18n } from '../../../i18n';\nimport { LoadingIcon } from '../../../icons';\nimport { useProviderProps } from '../../../provider';\nimport { mergeProps, modAttrs, useCombinedRefs } from '../../../utils/react';\nimport { useFocus } from '../../../utils/react/interactions';\nimport { extractStyles } from '../../../utils/styles';\nimport { StyledHeader } from '../../actions/Menu/styled';\nimport { useFieldProps, useFormProps, wrapWithField } from '../../form';\nimport { CubeListBoxProps, ListBox } from '../ListBox/ListBox';\nimport {\n DEFAULT_INPUT_STYLES,\n INPUT_WRAPPER_STYLES,\n} from '../TextInput/TextInputBase';\n\nimport type { Collection, Node } from '@react-types/shared';\nimport type { FieldBaseProps } from '../../../shared';\n\ntype FilterFn = (textValue: string, inputValue: string) => boolean;\n\nconst FilterListBoxWrapperElement = tasty({\n styles: {\n display: 'grid',\n flow: 'column',\n gridColumns: '1sf',\n gridRows: 'max-content max-content 1sf',\n gap: 0,\n position: 'relative',\n radius: true,\n color: '#dark-02',\n transition: 'theme',\n outline: {\n '': '#purple-03.0',\n 'invalid & focused': '#danger.50',\n focused: '#purple-03',\n },\n border: {\n '': true,\n focused: '#primary-text',\n valid: '#success-text.50',\n invalid: '#danger-text.50',\n disabled: true,\n popover: false,\n },\n },\n});\n\nconst SearchWrapperElement = tasty({\n qa: 'FilterListBoxSearchWrapper',\n styles: {\n ...INPUT_WRAPPER_STYLES,\n border: 'bottom',\n radius: '1r top',\n fill: '#clear',\n height: '($size + 1x)',\n $size: {\n '': '$size-md',\n 'size=small': '$size-sm',\n 'size=medium': '$size-md',\n 'size=large': '$size-lg',\n },\n },\n});\n\nconst SearchInputElement = tasty({\n as: 'input',\n styles: {\n ...DEFAULT_INPUT_STYLES,\n fill: '#clear',\n padding: {\n '': '.5x 1.5x',\n prefix: '0 1.5x 0 .5x',\n suffix: '.5x .5x .5x 1.5x',\n 'prefix & suffix': '0 .5x 0 .5x',\n },\n },\n});\n\nconst StyledHeaderWithoutBorder = tasty(StyledHeader, {\n styles: {\n border: false,\n },\n});\n\nexport interface CubeFilterListBoxProps<T>\n extends Omit<CubeListBoxProps<T>, 'filter'>,\n FieldBaseProps {\n /** Placeholder text for the search input */\n searchPlaceholder?: string;\n /** Whether the search input should have autofocus */\n autoFocus?: boolean;\n /**\n * Custom filter function for determining if an option should be included in search results.\n * Pass `false` to disable internal filtering completely (useful for external filtering).\n */\n filter?: FilterFn | false;\n /** Label shown when the list is empty. When provided, overrides both the \"No results found\" and \"No items\" defaults. */\n emptyLabel?: ReactNode;\n /** Custom styles for the search input */\n searchInputStyles?: Styles;\n /** Whether the FilterListBox is in loading state (shows loading icon in search input) */\n isLoading?: boolean;\n /** Whether items are currently loading. Shows a loading icon in the search input suffix. */\n isLoadingItems?: boolean;\n /** Ref for accessing the search input element */\n searchInputRef?: RefObject<HTMLInputElement | null>;\n /** Whether to allow entering custom values that are not present in the predefined options */\n allowsCustomValue?: boolean;\n /** Additional modifiers for styling the FilterListBox */\n mods?: Record<string, boolean>;\n /** Custom styles for the list box */\n listBoxStyles?: Styles;\n\n /**\n * Callback fired when the user presses Escape key while the search input is empty.\n * Can be used by parent components (e.g. FilterPicker) to close an enclosing Dialog.\n */\n onEscape?: () => void;\n\n /**\n * Whether to show checkboxes for multiple selection mode.\n * This adds a checkbox icon to the left of each option.\n */\n isCheckable?: boolean;\n\n /**\n * Callback fired when an option is clicked but not on the checkbox area.\n * Used by FilterPicker to close the popover on non-checkbox clicks.\n */\n onOptionClick?: (key: Key) => void;\n\n /**\n * Props to apply to existing custom values (values that are already selected but not in the predefined options).\n */\n customValueProps?: Partial<CubeCollectionItemProps<T>>;\n\n /**\n * Props to apply to new custom values (values typed in the search input that are about to be added).\n * These are merged with customValueProps for new custom values.\n */\n newCustomValueProps?: Partial<CubeCollectionItemProps<T>>;\n\n /**\n * Controlled search value. When provided, the search input becomes controlled.\n * Use with `onSearchChange` to manage the search state externally.\n */\n searchValue?: string;\n\n /**\n * Callback fired when the search input value changes.\n * Use with `searchValue` for controlled search input.\n */\n onSearchChange?: (value: string) => void;\n\n /**\n * Pre-built collection to use instead of creating a new one.\n * Used internally by FilterPicker to avoid duplicate collection creation.\n * @internal\n */\n _internalCollection?: Collection<Node<any>>;\n}\n\nconst PROP_STYLES = [...BASE_STYLES, ...OUTER_STYLES, ...COLOR_STYLES];\n\nexport const FilterListBox = forwardRef(function FilterListBox<\n T extends object,\n>(props: CubeFilterListBoxProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n props = useFieldProps(props, {\n valuePropsMapper: ({ value, onChange }) => {\n const fieldProps: any = {};\n\n if (props.selectionMode === 'multiple') {\n fieldProps.selectedKeys = value || [];\n } else {\n fieldProps.selectedKey = value ?? null;\n }\n\n fieldProps.onSelectionChange = (key: any) => {\n if (props.selectionMode === 'multiple') {\n // Handle \"all\" selection and array selections\n if (key === 'all') {\n onChange('all');\n } else {\n onChange(key ? (Array.isArray(key) ? key : [key]) : []);\n }\n } else {\n onChange(Array.isArray(key) ? key[0] : key);\n }\n };\n\n return fieldProps;\n },\n });\n\n const { t } = useI18n();\n\n let {\n qa,\n label,\n extra,\n id,\n labelStyles,\n isRequired,\n necessityIndicator,\n validationState,\n isDisabled,\n isLoading,\n isLoadingItems,\n searchPlaceholder = t('filterListBox.searchPlaceholder', 'Search...'),\n autoFocus,\n filter,\n mods: externalMods,\n emptyLabel,\n searchInputStyles,\n listStyles,\n optionStyles,\n sectionStyles,\n headingStyles,\n searchInputRef,\n listRef,\n message,\n description,\n styles,\n focusOnHover,\n shouldFocusWrap,\n labelSuffix,\n selectedKey,\n defaultSelectedKey,\n selectedKeys,\n defaultSelectedKeys,\n onSelectionChange: externalOnSelectionChange,\n allowsCustomValue = false,\n showSelectAll,\n selectAllLabel,\n header,\n footer,\n size = 'medium',\n headerStyles,\n footerStyles,\n listBoxStyles,\n items,\n children: renderChildren,\n onEscape,\n isCheckable,\n onOptionClick,\n selectionMode = 'single',\n allValueProps,\n customValueProps,\n newCustomValueProps,\n searchValue: controlledSearchValue,\n onSearchChange,\n _internalCollection,\n isReorderable = false,\n onReorder,\n form,\n ...otherProps\n } = props;\n\n // Preserve the original `children` (may be a render function) before we\n // potentially overwrite it.\n let children: ReactNode = renderChildren as ReactNode;\n\n const renderFn = renderChildren as unknown;\n\n if (items && typeof renderFn === 'function') {\n try {\n const itemsArray = Array.from(items as Iterable<any>);\n // Execute the render function for each item to obtain <Item/> / <Section/> nodes.\n children = itemsArray.map((item, idx) => {\n const rendered = (renderFn as (it: any) => ReactNode)(item);\n // Ensure every element has a stable key: rely on the user-provided key\n // inside the render function, otherwise fall back to the item itself or\n // the index. This mirrors React Aria examples where the render function\n // is expected to set keys, but we add a fallback for robustness.\n if (\n isValidElement(rendered) &&\n (rendered as ReactElement).key == null\n ) {\n return cloneElement(rendered as ReactElement, {\n key: (rendered as any)?.key ?? item?.key ?? idx,\n });\n }\n\n return rendered as ReactNode;\n });\n } catch {\n // If conversion fails for some reason, we silently ignore and proceed\n // with the original children value so we don't break runtime.\n }\n }\n\n // Use provided collection from FilterPicker or create our own\n // Hook call order is stable: _internalCollection is consistent per component instance\n const localCollectionState = _internalCollection\n ? { collection: _internalCollection }\n : useListState({\n children: children as any,\n items: items as any,\n selectionMode: 'none' as any,\n });\n\n // Collect original option keys to avoid duplicating them as custom values.\n const originalKeys = useMemo(() => {\n const keys = new Set<string>();\n for (const item of localCollectionState.collection) {\n if (item.type === 'item') {\n keys.add(String(item.key));\n }\n }\n return keys;\n }, [localCollectionState.collection]);\n\n // State to keep track of custom (user-entered) items that were selected.\n const [customKeys, setCustomKeys] = useState<Set<string>>(new Set());\n\n // Controlled/uncontrolled search value pattern\n const [internalSearchValue, setInternalSearchValue] = useState('');\n const isSearchControlled = controlledSearchValue !== undefined;\n const searchValue = isSearchControlled\n ? controlledSearchValue\n : internalSearchValue;\n\n const { contains } = useFilter({ sensitivity: 'base' });\n\n // Initialize custom keys from current selection\n useEffect(() => {\n if (!allowsCustomValue) return;\n\n const currentSelectedKeys = selectedKeys\n ? selectedKeys === 'all'\n ? [] // Skip custom key detection when 'all' is selected\n : Array.from(selectedKeys).map(String)\n : selectedKey != null\n ? [String(selectedKey)]\n : [];\n\n if (currentSelectedKeys.length === 0) return;\n\n const keysToAdd = currentSelectedKeys.filter((k) => !originalKeys.has(k));\n\n if (keysToAdd.length) {\n setCustomKeys((prev) => new Set([...Array.from(prev), ...keysToAdd]));\n }\n }, [allowsCustomValue, selectedKeys, selectedKey, originalKeys]);\n\n // Merge original children with any custom items so they persist in the list.\n // If there are selected custom values, they should appear on top with other\n // selected items (which are already sorted by the parent component, e.g. FilterPicker).\n const mergedChildren: ReactNode = useMemo(() => {\n if (!children && customKeys.size === 0) return children;\n\n // Selected custom values are injected by FilterListBox itself, not by the\n // parent. They must respect the search input regardless of the `filter`\n // prop — `filter={false}` only describes the parent's authority over its\n // own items. Filter them with the user-provided filter (if any) or the\n // default `contains`.\n const term = searchValue.trim();\n const localFilter: FilterFn =\n typeof filter === 'function' ? filter : contains;\n\n // Build React elements for custom values (kept stable via their key).\n const customArray = Array.from(customKeys)\n .filter((key) => !term || localFilter(key, term))\n .map((key) => (\n <Item key={key} textValue={key} {...customValueProps}>\n {key}\n </Item>\n ));\n\n // Identify which custom keys are currently selected so we can promote them.\n const selectedKeysSet = new Set<string>();\n\n if (selectionMode === 'multiple') {\n if (selectedKeys === 'all') {\n // When 'all' is selected, no custom items should be treated as selected\n // since 'all' means all available items, not custom ones\n } else {\n Array.from(selectedKeys ?? []).forEach((k) =>\n selectedKeysSet.add(String(k)),\n );\n }\n } else {\n if (selectedKey != null) selectedKeysSet.add(String(selectedKey));\n }\n\n const selectedCustom: ReactNode[] = [];\n const unselectedCustom: ReactNode[] = [];\n\n customArray.forEach((item: any) => {\n if (selectedKeysSet.has(String(item.key))) {\n selectedCustom.push(item);\n } else {\n unselectedCustom.push(item);\n }\n });\n\n if (!children) {\n // No original items – just return selected custom followed by the rest.\n return [...selectedCustom, ...unselectedCustom];\n }\n\n const originalArray = Array.isArray(children) ? children : [children];\n\n // Final order: selected custom items -> original array (already possibly\n // sorted by parent) -> unselected custom items.\n return [...selectedCustom, ...originalArray, ...unselectedCustom];\n }, [\n children,\n customKeys,\n selectionMode,\n selectedKey,\n selectedKeys,\n searchValue,\n filter,\n contains,\n customValueProps,\n ]);\n\n // Determine an aria-label for the internal ListBox to avoid React Aria warnings.\n const innerAriaLabel =\n (props as any)['aria-label'] ||\n (typeof label === 'string' ? label : undefined);\n\n const handleSearchChange = useCallback(\n (value: string) => {\n if (!isSearchControlled) {\n setInternalSearchValue(value);\n }\n onSearchChange?.(value);\n },\n [isSearchControlled, onSearchChange],\n );\n\n // Choose the text filter function: user-provided `filter` prop (if any),\n // or the default `contains` helper from `useFilter`.\n // When `filter={false}`, the parent owns filtering — we normally pass items\n // through unchanged. The exception is when `isLoadingItems` is `true`: a\n // server fetch is in flight and currently visible items are stale, so we\n // fall back to client-side `contains` to hide non-matching stale items\n // until the new items arrive.\n const textFilterFn = useMemo<FilterFn>(() => {\n if (filter === false) {\n return isLoadingItems ? contains : () => true;\n }\n return filter || contains;\n }, [filter, contains, isLoadingItems]);\n\n // Create a filter function for collection nodes (similar to ComboBox pattern)\n const filterFn = useCallback(\n (nodes: Iterable<any>) => {\n // Server-side filtering with no fetch in flight — items are\n // authoritative and shown as-is.\n if (filter === false && !isLoadingItems) return nodes;\n\n const term = searchValue.trim();\n\n if (!term) {\n return nodes;\n }\n\n // Filter nodes based on their textValue and preserve section structure\n return [...nodes]\n .map((node: any) => {\n if (node.type === 'section' && node.childNodes) {\n const filteredNodes = [...node.childNodes].filter((child: any) =>\n textFilterFn(child.textValue || '', term),\n );\n\n if (filteredNodes.length === 0) {\n return null;\n }\n\n return {\n ...node,\n childNodes: filteredNodes,\n hasChildNodes: true,\n };\n }\n\n return textFilterFn(node.textValue || '', term) ? node : null;\n })\n .filter(Boolean);\n },\n [filter, searchValue, textFilterFn, isLoadingItems],\n );\n\n // Handle custom values if allowed\n const enhancedChildren = useMemo(() => {\n let childrenToProcess = mergedChildren;\n\n // Handle custom values if allowed\n if (!allowsCustomValue) return childrenToProcess;\n\n const term = searchValue.trim();\n if (!term) return childrenToProcess;\n\n // Helper to determine if the term is already present (exact match on rendered textValue or the key).\n const doesTermExist = (term: string): boolean => {\n // Check if term exists in custom keys\n if (customKeys.has(term)) {\n return true;\n }\n\n // Check if term exists in original collection\n for (const item of localCollectionState.collection) {\n if (item.type === 'item') {\n const textValue = item.textValue || String(item.rendered || '');\n if (term === textValue || String(item.key) === term) {\n return true;\n }\n }\n }\n return false;\n };\n\n if (doesTermExist(term)) {\n return childrenToProcess;\n }\n\n // Check if there are any items that will match the filter.\n // This determines whether we need to visually separate the custom value\n // from real items (i.e. render a divider between sections). When there\n // are no visible items, we skip the section wrapper so no divider is\n // drawn above a lone custom-value option.\n //\n // Selected custom values (from `customKeys`) are filtered by `localFilter`\n // in `mergedChildren` regardless of `filter={false}`, so this check must\n // use the same logic — otherwise we'd report \"items visible\" and draw a\n // divider while the actual collection only contains the custom value.\n const localFilter: FilterFn =\n typeof filter === 'function' ? filter : contains;\n\n const hasVisibleFilteredItems = (() => {\n for (const item of localCollectionState.collection) {\n if (item.type === 'item') {\n const textValue = item.textValue || String(item.rendered || '');\n if (textFilterFn(textValue, term)) {\n return true;\n }\n } else if (item.type === 'section' && item.childNodes) {\n for (const child of item.childNodes) {\n const textValue = child.textValue || String(child.rendered || '');\n if (textFilterFn(textValue, term)) {\n return true;\n }\n }\n }\n }\n\n for (const customKey of customKeys) {\n if (localFilter(customKey, term)) {\n return true;\n }\n }\n\n return false;\n })();\n\n // Create the custom option\n const customOption = (\n <Item\n key={term}\n textValue={term}\n {...mergeProps(customValueProps, newCustomValueProps)}\n >\n {term}\n </Item>\n );\n\n // If there are visible filtered items, add visual separation for custom value\n if (hasVisibleFilteredItems && childrenToProcess) {\n // Check if the collection contains any sections\n // If it does, we can't wrap childrenToProcess in another section (would create nested sections)\n const hasSections = [...localCollectionState.collection].some(\n (item) => item.type === 'section',\n );\n\n const customValueSection = (\n <BaseSection\n key=\"__custom_value__\"\n aria-label={t('filterListBox.customValue', 'Custom value')}\n >\n {customOption}\n </BaseSection>\n );\n\n if (hasSections) {\n // Collection has sections - just append the custom value section without wrapping\n if (Array.isArray(childrenToProcess)) {\n return [...childrenToProcess, customValueSection];\n }\n return [childrenToProcess, customValueSection];\n }\n\n // No sections in collection - wrap items in a section for visual separation\n const filteredItemsSection = (\n <BaseSection\n key=\"__filtered_items__\"\n aria-label={t('filterListBox.filteredItems', 'Filtered items')}\n >\n {childrenToProcess}\n </BaseSection>\n );\n\n return [filteredItemsSection, customValueSection];\n }\n\n // No visible filtered items, just return the custom option without sections\n if (Array.isArray(childrenToProcess)) {\n return [...childrenToProcess, customOption];\n }\n\n if (childrenToProcess) {\n return [childrenToProcess, customOption];\n }\n\n return customOption;\n }, [\n allowsCustomValue,\n mergedChildren,\n searchValue,\n customKeys,\n localCollectionState.collection,\n customValueProps,\n newCustomValueProps,\n textFilterFn,\n filter,\n contains,\n t,\n ]);\n\n styles = extractStyles(otherProps, PROP_STYLES, styles);\n\n ref = useCombinedRefs(ref);\n searchInputRef = useCombinedRefs(searchInputRef);\n listRef = useCombinedRefs(listRef);\n\n const { isFocused, focusProps } = useFocus({ isDisabled });\n const isInvalid = validationState === 'invalid';\n\n const listBoxRef = useRef<HTMLDivElement>(null);\n\n // Ref to access internal ListBox state (selection manager, etc.)\n const listStateRef = useRef<any>(null);\n\n // No separate focusedKey state needed; rely directly on selectionManager.focusedKey.\n\n // When the search value changes, the visible collection of items may change as well.\n // If the currently focused item is no longer visible, move virtual focus to the first\n // available item so that arrow navigation and Enter behaviour continue to work.\n // If there are no available items, reset the selection so Enter won't select anything.\n // Priority: focus on selected items first, then fall back to first visible item.\n useLayoutEffect(() => {\n const listState = listStateRef.current;\n\n if (!listState) return;\n\n const { selectionManager, collection } = listState;\n\n // Walk the collection and:\n // 1. Collect visible item keys (supports sections).\n // 2. Detect the synthetic \"new custom value\" option — the one generated\n // from the current search term when `allowsCustomValue` is true.\n //\n // The custom value is rendered in one of two layouts depending on whether\n // any real item text-matches the search term (`hasVisibleFilteredItems`\n // in `enhancedChildren`):\n // • Some items match → wrapped in a `__custom_value__` section\n // (`customValueHasMatches = true`)\n // • No items match → appended at the top level with key === term\n // (`customValueHasMatches = false`)\n //\n // The layout itself is the signal we use to decide whether the custom\n // value should be the focus target (no matches) or whether focus should\n // move to a real item (matches present).\n const term = searchValue.trim();\n let newCustomValueKey: Key | null = null;\n let customValueHasMatches = false;\n\n const collectVisibleKeys = (\n nodes: Iterable<any>,\n out: Key[],\n inCustomSection = false,\n ) => {\n for (const node of nodes) {\n if (node.type === 'item') {\n out.push(node.key);\n if (inCustomSection) {\n newCustomValueKey = node.key;\n customValueHasMatches = true;\n }\n } else if (node.childNodes) {\n const isCustomSection =\n inCustomSection || node.key === '__custom_value__';\n collectVisibleKeys(node.childNodes, out, isCustomSection);\n }\n }\n };\n\n const visibleKeys: Key[] = [];\n collectVisibleKeys(collection, visibleKeys);\n\n // Detect the appended-at-top-level case (no items text-match). The custom\n // option is added with key === trimmed search term and lives directly in\n // the top-level collection (not nested in any section).\n if (newCustomValueKey == null && allowsCustomValue && term) {\n for (const node of collection) {\n if (node.type === 'item' && String(node.key) === term) {\n newCustomValueKey = node.key;\n customValueHasMatches = false;\n break;\n }\n }\n }\n\n // If there are no visible items, reset the focused key so Enter won't select anything\n if (visibleKeys.length === 0) {\n selectionManager.setFocusedKey(null);\n return;\n }\n\n // The custom value should be the focus target when it exists and there\n // are no real text-matches — the user's typed value is then the only\n // actionable option. During an in-flight server fetch (`filter === false`\n // + `isLoadingItems`) `textFilterFn` falls back to client-side `contains`\n // so non-matching stale items are hidden, which keeps this signal honest.\n const customValueShouldBeFocused =\n newCustomValueKey != null && !customValueHasMatches;\n\n // Decide whether the current focus is already on the right thing. If yes,\n // don't disturb it. Otherwise fall through and re-pick a focus target.\n const currentFocused = selectionManager.focusedKey;\n if (currentFocused != null && visibleKeys.includes(currentFocused)) {\n const currentIsNewCustomValue =\n newCustomValueKey != null && currentFocused === newCustomValueKey;\n if (customValueShouldBeFocused) {\n if (currentIsNewCustomValue) return;\n } else if (newCustomValueKey != null) {\n // Custom value exists but isn't the priority (matches available) —\n // any non-custom focus is fine.\n if (!currentIsNewCustomValue) return;\n } else {\n // No custom value involved at all.\n return;\n }\n }\n\n // Helper to find the first selected item that's visible\n const findFirstVisibleSelectedKey = (): Key | null => {\n if (selectionMode === 'single') {\n // Single selection: check if selectedKey is visible\n if (selectedKey != null) {\n const selectedKeyStr = String(selectedKey);\n if (visibleKeys.some((k) => String(k) === selectedKeyStr)) {\n return selectedKey;\n }\n }\n } else if (selectionMode === 'multiple') {\n // Multiple selection: find first selected key that's visible\n if (selectedKeys && selectedKeys !== 'all') {\n for (const key of selectedKeys) {\n const keyStr = String(key);\n if (visibleKeys.some((k) => String(k) === keyStr)) {\n return key;\n }\n }\n }\n }\n return null;\n };\n\n // Determine which key to focus\n let keyToFocus: Key | null = null;\n\n if (customValueShouldBeFocused) {\n // No real matches — promote the custom value over any selected/stale\n // item so the user can press Enter to add the value they just typed.\n keyToFocus = newCustomValueKey;\n } else {\n keyToFocus = findFirstVisibleSelectedKey();\n\n // Fallback to first visible item if no selected item found. Prefer the\n // first real (non-custom-value) item so focus doesn't land on the\n // bottom-of-list custom-value suggestion when real items are available.\n if (keyToFocus == null) {\n const firstRealKey = visibleKeys.find((k) => k !== newCustomValueKey);\n keyToFocus = firstRealKey ?? visibleKeys[0];\n }\n }\n\n // Mark this focus change as keyboard navigation so ListBox will scroll to it\n if (listState.lastFocusSourceRef) {\n listState.lastFocusSourceRef.current = 'keyboard';\n }\n\n // Set focus to the determined key\n selectionManager.setFocusedKey(keyToFocus);\n }, [\n searchValue,\n enhancedChildren,\n selectionMode,\n selectedKey,\n selectedKeys,\n allowsCustomValue,\n ]);\n\n // Keyboard navigation handler for search input\n const { keyboardProps } = useKeyboard({\n onKeyDown: (e) => {\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {\n e.preventDefault();\n\n const listState = listStateRef.current;\n if (!listState) return;\n\n const { selectionManager, collection } = listState;\n\n // Helper to collect visible item keys (supports sections)\n // Collection is already filtered by React Stately via filterFn\n const collectVisibleKeys = (nodes: Iterable<any>, out: Key[]) => {\n for (const node of nodes) {\n if (node.type === 'item') {\n out.push(node.key);\n } else if (node.childNodes) {\n collectVisibleKeys(node.childNodes, out);\n }\n }\n };\n\n const visibleKeys: Key[] = [];\n collectVisibleKeys(collection, visibleKeys);\n\n if (visibleKeys.length === 0) return;\n\n const isArrowDown = e.key === 'ArrowDown';\n const direction = isArrowDown ? 1 : -1;\n\n const currentKey = selectionManager.focusedKey;\n\n let nextKey: Key | null = null;\n\n if (currentKey == null) {\n // If nothing focused yet, pick first/last depending on direction\n nextKey = isArrowDown\n ? visibleKeys[0]\n : visibleKeys[visibleKeys.length - 1];\n } else {\n const currentIndex = visibleKeys.indexOf(currentKey);\n if (currentIndex !== -1) {\n const newIndex = currentIndex + direction;\n if (newIndex >= 0 && newIndex < visibleKeys.length) {\n nextKey = visibleKeys[newIndex];\n } else if (shouldFocusWrap) {\n // Wrap around\n nextKey = isArrowDown\n ? visibleKeys[0]\n : visibleKeys[visibleKeys.length - 1];\n }\n } else {\n // Fallback\n nextKey = isArrowDown\n ? visibleKeys[0]\n : visibleKeys[visibleKeys.length - 1];\n }\n }\n\n if (nextKey != null) {\n // Mark this focus change as keyboard navigation\n if (listState.lastFocusSourceRef) {\n listState.lastFocusSourceRef.current = 'keyboard';\n }\n selectionManager.setFocusedKey(nextKey);\n }\n } else if (\n e.key === 'Home' ||\n e.key === 'End' ||\n e.key === 'PageUp' ||\n e.key === 'PageDown'\n ) {\n e.preventDefault();\n\n const listState = listStateRef.current;\n if (!listState) return;\n\n const { selectionManager, collection } = listState;\n\n // Helper to collect visible item keys (supports sections)\n // Collection is already filtered by React Stately via filterFn\n const collectVisibleKeys = (nodes: Iterable<any>, out: Key[]) => {\n for (const node of nodes) {\n if (node.type === 'item') {\n out.push(node.key);\n } else if (node.childNodes) {\n collectVisibleKeys(node.childNodes, out);\n }\n }\n };\n\n const visibleKeys: Key[] = [];\n collectVisibleKeys(collection, visibleKeys);\n\n if (visibleKeys.length === 0) return;\n\n const targetKey =\n e.key === 'Home' || e.key === 'PageUp'\n ? visibleKeys[0]\n : visibleKeys[visibleKeys.length - 1];\n\n // Mark this focus change as keyboard navigation\n if (listState.lastFocusSourceRef) {\n listState.lastFocusSourceRef.current = 'keyboard';\n }\n selectionManager.setFocusedKey(targetKey);\n } else if (e.key === 'Enter' || (e.key === ' ' && !searchValue)) {\n const listState = listStateRef.current;\n\n if (!listState) return;\n\n const keyToSelect = listState.selectionManager.focusedKey;\n\n if (keyToSelect != null) {\n e.preventDefault();\n listState.selectionManager.select(keyToSelect, e);\n\n if (\n e.key === 'Enter' &&\n isCheckable &&\n onEscape &&\n selectionMode === 'multiple'\n ) {\n onEscape();\n }\n }\n } else if (e.key === 'Escape') {\n if (searchValue) {\n // Clear the current search if any text is present.\n e.preventDefault();\n handleSearchChange('');\n } else {\n // Notify parent that Escape was pressed on an empty input.\n if (onEscape) {\n e.preventDefault();\n onEscape();\n }\n }\n }\n },\n });\n\n const mods = useMemo(\n () => ({\n invalid: isInvalid,\n valid: validationState === 'valid',\n disabled: !!isDisabled,\n focused: isFocused,\n loading: !!isLoading,\n 'loading-items': !!isLoadingItems,\n searchable: true,\n prefix: !!isLoading,\n suffix: !!isLoadingItems,\n ...externalMods,\n }),\n [\n isInvalid,\n validationState,\n isDisabled,\n isFocused,\n isLoading,\n isLoadingItems,\n externalMods,\n ],\n );\n\n // Handler must be defined before we render ListBox so we can pass it.\n const handleSelectionChange = (selection: any) => {\n if (allowsCustomValue) {\n // Normalize current selection into an array of string keys\n let selectedValues: string[] = [];\n\n if (selection != null) {\n if (Array.isArray(selection)) {\n selectedValues = selection.map(String);\n } else {\n selectedValues = [String(selection)];\n }\n }\n\n // Build next custom keys set based on selected values\n const nextSet = new Set<string>();\n\n selectedValues.forEach((val) => {\n if (!originalKeys.has(val)) {\n nextSet.add(val);\n }\n });\n\n // Update internal custom keys state\n setCustomKeys(nextSet);\n }\n\n if (externalOnSelectionChange) {\n (externalOnSelectionChange as any)(selection);\n }\n };\n\n // Custom option click handler that ensures search input receives focus\n const handleOptionClick = (key: Key) => {\n // Focus the search input to enable keyboard navigation\n // Use setTimeout to ensure this happens after React state updates\n setTimeout(() => {\n if (searchInputRef.current) {\n searchInputRef.current.focus();\n }\n }, 0);\n\n // Call the original onOptionClick if provided\n if (onOptionClick) {\n onOptionClick(key);\n }\n };\n\n const searchInput = (\n <SearchWrapperElement mods={mods} data-size={size}>\n {isLoading && (\n <div data-element=\"Prefix\">\n <div data-element=\"InputIcon\">\n {isLoading ? <LoadingIcon /> : null}\n </div>\n </div>\n )}\n <SearchInputElement\n ref={searchInputRef}\n qa={qa || 'FilterListBox'}\n id={id}\n data-prefix={isLoading ? '' : undefined}\n data-suffix={isLoadingItems ? '' : undefined}\n type=\"search\"\n placeholder={searchPlaceholder}\n value={searchValue}\n disabled={isDisabled}\n autoFocus={autoFocus}\n data-autofocus={autoFocus ? '' : undefined}\n styles={searchInputStyles}\n data-size={size}\n data-input-type=\"filterlistbox\"\n role=\"combobox\"\n aria-expanded=\"true\"\n aria-haspopup=\"listbox\"\n aria-activedescendant={\n listStateRef.current?.selectionManager.focusedKey != null\n ? `ListBoxItem-${listStateRef.current?.selectionManager.focusedKey}`\n : undefined\n }\n onChange={(e) => {\n handleSearchChange(e.target.value);\n }}\n {...keyboardProps}\n {...modAttrs(mods)}\n />\n {isLoadingItems && (\n <div data-element=\"Suffix\">\n <LoadingIcon data-element=\"InputIcon\" />\n </div>\n )}\n </SearchWrapperElement>\n );\n\n const filterListBoxField = (\n <FilterListBoxWrapperElement\n ref={ref}\n qa=\"FilterListBoxWrapper\"\n {...modAttrs(mods)}\n styles={styles}\n {...focusProps}\n >\n {header ? (\n <StyledHeaderWithoutBorder data-size={size} styles={headerStyles}>\n {header}\n </StyledHeaderWithoutBorder>\n ) : (\n <div role=\"presentation\" />\n )}\n {searchInput}\n <ListBox\n ref={listBoxRef}\n aria-label={innerAriaLabel}\n selectedKey={selectedKey}\n defaultSelectedKey={defaultSelectedKey}\n selectedKeys={selectedKeys}\n defaultSelectedKeys={defaultSelectedKeys}\n selectionMode={selectionMode}\n isDisabled={isDisabled}\n listRef={listRef}\n stateRef={listStateRef}\n listStyles={listStyles}\n shouldFocusWrap={shouldFocusWrap}\n optionStyles={optionStyles}\n sectionStyles={sectionStyles}\n headingStyles={headingStyles}\n validationState={validationState}\n disallowEmptySelection={props.disallowEmptySelection}\n disabledKeys={props.disabledKeys}\n focusOnHover={focusOnHover}\n shouldUseVirtualFocus={!(isReorderable && !searchValue.trim())}\n showSelectAll={showSelectAll}\n selectAllLabel={selectAllLabel}\n footer={footer}\n footerStyles={footerStyles}\n mods={mods}\n size=\"medium\"\n styles={listBoxStyles}\n isCheckable={isCheckable}\n items={items as any}\n allValueProps={allValueProps}\n filter={filterFn}\n emptyLabel={\n emptyLabel !== undefined\n ? emptyLabel\n : searchValue.trim()\n ? t('filterListBox.noResults', 'No results found')\n : t('filterListBox.noItems', 'No items')\n }\n isReorderable={isReorderable && !searchValue.trim()}\n onReorder={onReorder}\n onSelectionChange={handleSelectionChange}\n onEscape={onEscape}\n onOptionClick={handleOptionClick}\n >\n {enhancedChildren as any}\n </ListBox>\n </FilterListBoxWrapperElement>\n );\n\n return wrapWithField<Omit<CubeFilterListBoxProps<T>, 'children'>>(\n filterListBoxField,\n ref,\n props,\n );\n}) as unknown as (<T>(\n props: CubeFilterListBoxProps<T> & { ref?: ForwardedRef<HTMLDivElement> },\n) => ReactElement) & { Item: typeof Item; Section: typeof BaseSection };\n\nFilterListBox.Item = ListBox.Item;\n\nFilterListBox.Section = BaseSection;\n\nObject.defineProperty(FilterListBox, 'cubeInputType', {\n value: 'FilterListBox',\n enumerable: false,\n configurable: false,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8CA,MAAM,8BAA8B,MAAM,EACxC,QAAQ;CACN,SAAS;CACT,MAAM;CACN,aAAa;CACb,UAAU;CACV,KAAK;CACL,UAAU;CACV,QAAQ;CACR,OAAO;CACP,YAAY;CACZ,SAAS;EACP,IAAI;EACJ,qBAAqB;EACrB,SAAS;EACV;CACD,QAAQ;EACN,IAAI;EACJ,SAAS;EACT,OAAO;EACP,SAAS;EACT,UAAU;EACV,SAAS;EACV;CACF,EACF,CAAC;AA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P,UAAU;IACC;IACX,kBAAgB,YAAY,KAAK;IACjC,QAAQ;IACR,aAAW;IACX,mBAAgB;IAChB,MAAK;IACL,iBAAc;IACd,iBAAc;IACd,yBACE,aAAa,SAAS,iBAAiB,cAAc,OACjD,eAAe,aAAa,SAAS,iBAAiB,eACtD;IAEN,WAAW,MAAM;AACf,wBAAmB,EAAE,OAAO,MAAM;;IAEpC,GAAI;IACJ,GAAI,SAAS,KAAK;KAClB;GACD,kBACC,oBAAC;IAAI,gBAAa;cAChB,oBAAC,eAAY,gBAAa,cAAc;KACpC;;GAEa;AAqEzB,QAAO,cAjEL,qBAAC;EACM;EACL,IAAG;EACH,GAAI,SAAS,KAAK;EACV;EACR,GAAI;;GAEH,SACC,oBAAC;IAA0B,aAAW;IAAM,QAAQ;cACjD;KACyB,GAE5B,oBAAC,SAAI,MAAK,iBAAiB;GAE5B;GACD,oBAAC;IACC,KAAK;IACL,cAAY;IACC;IACO;IACN;IACO;IACN;IACH;IACH;IACT,UAAU;IACE;IACK;IACH;IACC;IACA;IACE;IACjB,wBAAwB,MAAM;IAC9B,cAAc,MAAM;IACN;IACd,uBAAuB,EAAE,iBAAiB,CAAC,YAAY,MAAM;IAC9C;IACC;IACR;IACM;IACR;IACN,MAAK;IACL,QAAQ;IACK;IACN;IACQ;IACf,QAAQ;IACR,YACE,eAAe,SACX,aACA,YAAY,MAAM,GAChB,EAAE,2BAA2B,mBAAmB,GAChD,EAAE,yBAAyB,WAAW;IAE9C,eAAe,iBAAiB,CAAC,YAAY,MAAM;IACxC;IACX,mBAAmB;IACT;IACV,eAAe;cAEd;KACO;;GACkB,EAK9B,KACA,MACD;EACD;AAIF,cAAc,OAAO,QAAQ;AAE7B,cAAc,UAAUD;AAExB,OAAO,eAAe,eAAe,iBAAiB;CACpD,OAAO;CACP,YAAY;CACZ,cAAc;CACf,CAAC"}
1
+ {"version":3,"file":"FilterListBox.js","names":["mergeProps","BaseSection","useFocus"],"sources":["../../../../src/components/fields/FilterListBox/FilterListBox.tsx"],"sourcesContent":["import { Key } from '@react-types/shared';\nimport {\n BASE_STYLES,\n COLOR_STYLES,\n OUTER_STYLES,\n Styles,\n tasty,\n} from '@tenphi/tasty';\nimport {\n cloneElement,\n ForwardedRef,\n forwardRef,\n isValidElement,\n ReactElement,\n ReactNode,\n RefObject,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useFilter, useKeyboard } from 'react-aria';\nimport { Section as BaseSection, Item, useListState } from 'react-stately';\nimport { CubeCollectionItemProps } from 'src/components/CollectionItem';\n\nimport { useI18n } from '../../../i18n';\nimport { LoadingIcon } from '../../../icons';\nimport { mergeProps, modAttrs, useCombinedRefs } from '../../../utils/react';\nimport { useFocus } from '../../../utils/react/interactions';\nimport { extractStyles } from '../../../utils/styles';\nimport { StyledHeader } from '../../actions/Menu/styled';\nimport { getValidationMods, useFieldProps, wrapWithField } from '../../form';\nimport { CubeListBoxProps, ListBox } from '../ListBox/ListBox';\nimport {\n DEFAULT_INPUT_STYLES,\n INPUT_WRAPPER_STYLES,\n} from '../TextInput/TextInputBase';\n\nimport type { Collection, Node } from '@react-types/shared';\nimport type { FieldBaseProps } from '../../../shared';\n\ntype FilterFn = (textValue: string, inputValue: string) => boolean;\n\nconst FilterListBoxWrapperElement = tasty({\n styles: {\n display: 'grid',\n flow: 'column',\n gridColumns: '1sf',\n gridRows: 'max-content max-content 1sf',\n gap: 0,\n position: 'relative',\n radius: true,\n color: '#dark-02',\n transition: 'theme',\n outline: {\n '': '#purple-03.0',\n 'invalid & focused': '#danger.50',\n focused: '#purple-03',\n },\n border: {\n '': true,\n focused: '#primary-text',\n valid: '#success-text.50',\n invalid: '#danger-text.50',\n disabled: true,\n popover: false,\n },\n },\n});\n\nconst SearchWrapperElement = tasty({\n qa: 'FilterListBoxSearchWrapper',\n styles: {\n ...INPUT_WRAPPER_STYLES,\n border: 'bottom',\n radius: '1r top',\n fill: '#clear',\n height: '($size + 1x)',\n $size: {\n '': '$size-md',\n 'size=small': '$size-sm',\n 'size=medium': '$size-md',\n 'size=large': '$size-lg',\n },\n },\n});\n\nconst SearchInputElement = tasty({\n as: 'input',\n styles: {\n ...DEFAULT_INPUT_STYLES,\n fill: '#clear',\n padding: {\n '': '.5x 1.5x',\n prefix: '0 1.5x 0 .5x',\n suffix: '.5x .5x .5x 1.5x',\n 'prefix & suffix': '0 .5x 0 .5x',\n },\n },\n});\n\nconst StyledHeaderWithoutBorder = tasty(StyledHeader, {\n styles: {\n border: false,\n },\n});\n\nexport interface CubeFilterListBoxProps<T>\n extends Omit<CubeListBoxProps<T>, 'filter'>,\n FieldBaseProps {\n /** Placeholder text for the search input */\n searchPlaceholder?: string;\n /** Whether the search input should have autofocus */\n autoFocus?: boolean;\n /**\n * Custom filter function for determining if an option should be included in search results.\n * Pass `false` to disable internal filtering completely (useful for external filtering).\n */\n filter?: FilterFn | false;\n /** Label shown when the list is empty. When provided, overrides both the \"No results found\" and \"No items\" defaults. */\n emptyLabel?: ReactNode;\n /** Custom styles for the search input */\n searchInputStyles?: Styles;\n /** Whether the FilterListBox is in loading state (shows loading icon in search input) */\n isLoading?: boolean;\n /** Whether items are currently loading. Shows a loading icon in the search input suffix. */\n isLoadingItems?: boolean;\n /** Ref for accessing the search input element */\n searchInputRef?: RefObject<HTMLInputElement | null>;\n /** Whether to allow entering custom values that are not present in the predefined options */\n allowsCustomValue?: boolean;\n /** Additional modifiers for styling the FilterListBox */\n mods?: Record<string, boolean>;\n /** Custom styles for the list box */\n listBoxStyles?: Styles;\n\n /**\n * Callback fired when the user presses Escape key while the search input is empty.\n * Can be used by parent components (e.g. FilterPicker) to close an enclosing Dialog.\n */\n onEscape?: () => void;\n\n /**\n * Whether to show checkboxes for multiple selection mode.\n * This adds a checkbox icon to the left of each option.\n */\n isCheckable?: boolean;\n\n /**\n * Callback fired when an option is clicked but not on the checkbox area.\n * Used by FilterPicker to close the popover on non-checkbox clicks.\n */\n onOptionClick?: (key: Key) => void;\n\n /**\n * Props to apply to existing custom values (values that are already selected but not in the predefined options).\n */\n customValueProps?: Partial<CubeCollectionItemProps<T>>;\n\n /**\n * Props to apply to new custom values (values typed in the search input that are about to be added).\n * These are merged with customValueProps for new custom values.\n */\n newCustomValueProps?: Partial<CubeCollectionItemProps<T>>;\n\n /**\n * Controlled search value. When provided, the search input becomes controlled.\n * Use with `onSearchChange` to manage the search state externally.\n */\n searchValue?: string;\n\n /**\n * Callback fired when the search input value changes.\n * Use with `searchValue` for controlled search input.\n */\n onSearchChange?: (value: string) => void;\n\n /**\n * Pre-built collection to use instead of creating a new one.\n * Used internally by FilterPicker to avoid duplicate collection creation.\n * @internal\n */\n _internalCollection?: Collection<Node<any>>;\n}\n\nconst PROP_STYLES = [...BASE_STYLES, ...OUTER_STYLES, ...COLOR_STYLES];\n\nexport const FilterListBox = forwardRef(function FilterListBox<\n T extends object,\n>(props: CubeFilterListBoxProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n props = useFieldProps(props, {\n valuePropsMapper: ({ value, onChange }) => {\n const fieldProps: any = {};\n\n if (props.selectionMode === 'multiple') {\n fieldProps.selectedKeys = value || [];\n } else {\n fieldProps.selectedKey = value ?? null;\n }\n\n fieldProps.onSelectionChange = (key: any) => {\n if (props.selectionMode === 'multiple') {\n // Handle \"all\" selection and array selections\n if (key === 'all') {\n onChange('all');\n } else {\n onChange(key ? (Array.isArray(key) ? key : [key]) : []);\n }\n } else {\n onChange(Array.isArray(key) ? key[0] : key);\n }\n };\n\n return fieldProps;\n },\n });\n\n const { t } = useI18n();\n\n let {\n qa,\n label,\n extra,\n id,\n labelStyles,\n isRequired,\n necessityIndicator,\n isInvalid,\n isValid,\n isDisabled,\n isLoading,\n isLoadingItems,\n searchPlaceholder = t('filterListBox.searchPlaceholder', 'Search...'),\n autoFocus,\n filter,\n mods: externalMods,\n emptyLabel,\n searchInputStyles,\n listStyles,\n optionStyles,\n sectionStyles,\n headingStyles,\n searchInputRef,\n listRef,\n message,\n description,\n styles,\n focusOnHover,\n shouldFocusWrap,\n labelSuffix,\n selectedKey,\n defaultSelectedKey,\n selectedKeys,\n defaultSelectedKeys,\n onSelectionChange: externalOnSelectionChange,\n allowsCustomValue = false,\n showSelectAll,\n selectAllLabel,\n header,\n footer,\n size = 'medium',\n headerStyles,\n footerStyles,\n listBoxStyles,\n items,\n children: renderChildren,\n onEscape,\n isCheckable,\n onOptionClick,\n selectionMode = 'single',\n allValueProps,\n customValueProps,\n newCustomValueProps,\n searchValue: controlledSearchValue,\n onSearchChange,\n _internalCollection,\n isReorderable = false,\n onReorder,\n form,\n ...otherProps\n } = props;\n\n // Preserve the original `children` (may be a render function) before we\n // potentially overwrite it.\n let children: ReactNode = renderChildren as ReactNode;\n\n const renderFn = renderChildren as unknown;\n\n if (items && typeof renderFn === 'function') {\n try {\n const itemsArray = Array.from(items as Iterable<any>);\n // Execute the render function for each item to obtain <Item/> / <Section/> nodes.\n children = itemsArray.map((item, idx) => {\n const rendered = (renderFn as (it: any) => ReactNode)(item);\n // Ensure every element has a stable key: rely on the user-provided key\n // inside the render function, otherwise fall back to the item itself or\n // the index. This mirrors React Aria examples where the render function\n // is expected to set keys, but we add a fallback for robustness.\n if (\n isValidElement(rendered) &&\n (rendered as ReactElement).key == null\n ) {\n return cloneElement(rendered as ReactElement, {\n key: (rendered as any)?.key ?? item?.key ?? idx,\n });\n }\n\n return rendered as ReactNode;\n });\n } catch {\n // If conversion fails for some reason, we silently ignore and proceed\n // with the original children value so we don't break runtime.\n }\n }\n\n // Use provided collection from FilterPicker or create our own\n // Hook call order is stable: _internalCollection is consistent per component instance\n const localCollectionState = _internalCollection\n ? { collection: _internalCollection }\n : useListState({\n children: children as any,\n items: items as any,\n selectionMode: 'none' as any,\n });\n\n // Collect original option keys to avoid duplicating them as custom values.\n const originalKeys = useMemo(() => {\n const keys = new Set<string>();\n for (const item of localCollectionState.collection) {\n if (item.type === 'item') {\n keys.add(String(item.key));\n }\n }\n return keys;\n }, [localCollectionState.collection]);\n\n // State to keep track of custom (user-entered) items that were selected.\n const [customKeys, setCustomKeys] = useState<Set<string>>(new Set());\n\n // Controlled/uncontrolled search value pattern\n const [internalSearchValue, setInternalSearchValue] = useState('');\n const isSearchControlled = controlledSearchValue !== undefined;\n const searchValue = isSearchControlled\n ? controlledSearchValue\n : internalSearchValue;\n\n const { contains } = useFilter({ sensitivity: 'base' });\n\n // Initialize custom keys from current selection\n useEffect(() => {\n if (!allowsCustomValue) return;\n\n const currentSelectedKeys = selectedKeys\n ? selectedKeys === 'all'\n ? [] // Skip custom key detection when 'all' is selected\n : Array.from(selectedKeys).map(String)\n : selectedKey != null\n ? [String(selectedKey)]\n : [];\n\n if (currentSelectedKeys.length === 0) return;\n\n const keysToAdd = currentSelectedKeys.filter((k) => !originalKeys.has(k));\n\n if (keysToAdd.length) {\n setCustomKeys((prev) => new Set([...Array.from(prev), ...keysToAdd]));\n }\n }, [allowsCustomValue, selectedKeys, selectedKey, originalKeys]);\n\n // Merge original children with any custom items so they persist in the list.\n // If there are selected custom values, they should appear on top with other\n // selected items (which are already sorted by the parent component, e.g. FilterPicker).\n const mergedChildren: ReactNode = useMemo(() => {\n if (!children && customKeys.size === 0) return children;\n\n // Selected custom values are injected by FilterListBox itself, not by the\n // parent. They must respect the search input regardless of the `filter`\n // prop — `filter={false}` only describes the parent's authority over its\n // own items. Filter them with the user-provided filter (if any) or the\n // default `contains`.\n const term = searchValue.trim();\n const localFilter: FilterFn =\n typeof filter === 'function' ? filter : contains;\n\n // Build React elements for custom values (kept stable via their key).\n const customArray = Array.from(customKeys)\n .filter((key) => !term || localFilter(key, term))\n .map((key) => (\n <Item key={key} textValue={key} {...customValueProps}>\n {key}\n </Item>\n ));\n\n // Identify which custom keys are currently selected so we can promote them.\n const selectedKeysSet = new Set<string>();\n\n if (selectionMode === 'multiple') {\n if (selectedKeys === 'all') {\n // When 'all' is selected, no custom items should be treated as selected\n // since 'all' means all available items, not custom ones\n } else {\n Array.from(selectedKeys ?? []).forEach((k) =>\n selectedKeysSet.add(String(k)),\n );\n }\n } else {\n if (selectedKey != null) selectedKeysSet.add(String(selectedKey));\n }\n\n const selectedCustom: ReactNode[] = [];\n const unselectedCustom: ReactNode[] = [];\n\n customArray.forEach((item: any) => {\n if (selectedKeysSet.has(String(item.key))) {\n selectedCustom.push(item);\n } else {\n unselectedCustom.push(item);\n }\n });\n\n if (!children) {\n // No original items – just return selected custom followed by the rest.\n return [...selectedCustom, ...unselectedCustom];\n }\n\n const originalArray = Array.isArray(children) ? children : [children];\n\n // Final order: selected custom items -> original array (already possibly\n // sorted by parent) -> unselected custom items.\n return [...selectedCustom, ...originalArray, ...unselectedCustom];\n }, [\n children,\n customKeys,\n selectionMode,\n selectedKey,\n selectedKeys,\n searchValue,\n filter,\n contains,\n customValueProps,\n ]);\n\n // Determine an aria-label for the internal ListBox to avoid React Aria warnings.\n const innerAriaLabel =\n (props as any)['aria-label'] ||\n (typeof label === 'string' ? label : undefined);\n\n const handleSearchChange = useCallback(\n (value: string) => {\n if (!isSearchControlled) {\n setInternalSearchValue(value);\n }\n onSearchChange?.(value);\n },\n [isSearchControlled, onSearchChange],\n );\n\n // Choose the text filter function: user-provided `filter` prop (if any),\n // or the default `contains` helper from `useFilter`.\n // When `filter={false}`, the parent owns filtering — we normally pass items\n // through unchanged. The exception is when `isLoadingItems` is `true`: a\n // server fetch is in flight and currently visible items are stale, so we\n // fall back to client-side `contains` to hide non-matching stale items\n // until the new items arrive.\n const textFilterFn = useMemo<FilterFn>(() => {\n if (filter === false) {\n return isLoadingItems ? contains : () => true;\n }\n return filter || contains;\n }, [filter, contains, isLoadingItems]);\n\n // Create a filter function for collection nodes (similar to ComboBox pattern)\n const filterFn = useCallback(\n (nodes: Iterable<any>) => {\n // Server-side filtering with no fetch in flight — items are\n // authoritative and shown as-is.\n if (filter === false && !isLoadingItems) return nodes;\n\n const term = searchValue.trim();\n\n if (!term) {\n return nodes;\n }\n\n // Filter nodes based on their textValue and preserve section structure\n return [...nodes]\n .map((node: any) => {\n if (node.type === 'section' && node.childNodes) {\n const filteredNodes = [...node.childNodes].filter((child: any) =>\n textFilterFn(child.textValue || '', term),\n );\n\n if (filteredNodes.length === 0) {\n return null;\n }\n\n return {\n ...node,\n childNodes: filteredNodes,\n hasChildNodes: true,\n };\n }\n\n return textFilterFn(node.textValue || '', term) ? node : null;\n })\n .filter(Boolean);\n },\n [filter, searchValue, textFilterFn, isLoadingItems],\n );\n\n // Handle custom values if allowed\n const enhancedChildren = useMemo(() => {\n let childrenToProcess = mergedChildren;\n\n // Handle custom values if allowed\n if (!allowsCustomValue) return childrenToProcess;\n\n const term = searchValue.trim();\n if (!term) return childrenToProcess;\n\n // Helper to determine if the term is already present (exact match on rendered textValue or the key).\n const doesTermExist = (term: string): boolean => {\n // Check if term exists in custom keys\n if (customKeys.has(term)) {\n return true;\n }\n\n // Check if term exists in original collection\n for (const item of localCollectionState.collection) {\n if (item.type === 'item') {\n const textValue = item.textValue || String(item.rendered || '');\n if (term === textValue || String(item.key) === term) {\n return true;\n }\n }\n }\n return false;\n };\n\n if (doesTermExist(term)) {\n return childrenToProcess;\n }\n\n // Check if there are any items that will match the filter.\n // This determines whether we need to visually separate the custom value\n // from real items (i.e. render a divider between sections). When there\n // are no visible items, we skip the section wrapper so no divider is\n // drawn above a lone custom-value option.\n //\n // Selected custom values (from `customKeys`) are filtered by `localFilter`\n // in `mergedChildren` regardless of `filter={false}`, so this check must\n // use the same logic — otherwise we'd report \"items visible\" and draw a\n // divider while the actual collection only contains the custom value.\n const localFilter: FilterFn =\n typeof filter === 'function' ? filter : contains;\n\n const hasVisibleFilteredItems = (() => {\n for (const item of localCollectionState.collection) {\n if (item.type === 'item') {\n const textValue = item.textValue || String(item.rendered || '');\n if (textFilterFn(textValue, term)) {\n return true;\n }\n } else if (item.type === 'section' && item.childNodes) {\n for (const child of item.childNodes) {\n const textValue = child.textValue || String(child.rendered || '');\n if (textFilterFn(textValue, term)) {\n return true;\n }\n }\n }\n }\n\n for (const customKey of customKeys) {\n if (localFilter(customKey, term)) {\n return true;\n }\n }\n\n return false;\n })();\n\n // Create the custom option\n const customOption = (\n <Item\n key={term}\n textValue={term}\n {...mergeProps(customValueProps, newCustomValueProps)}\n >\n {term}\n </Item>\n );\n\n // If there are visible filtered items, add visual separation for custom value\n if (hasVisibleFilteredItems && childrenToProcess) {\n // Check if the collection contains any sections\n // If it does, we can't wrap childrenToProcess in another section (would create nested sections)\n const hasSections = [...localCollectionState.collection].some(\n (item) => item.type === 'section',\n );\n\n const customValueSection = (\n <BaseSection\n key=\"__custom_value__\"\n aria-label={t('filterListBox.customValue', 'Custom value')}\n >\n {customOption}\n </BaseSection>\n );\n\n if (hasSections) {\n // Collection has sections - just append the custom value section without wrapping\n if (Array.isArray(childrenToProcess)) {\n return [...childrenToProcess, customValueSection];\n }\n return [childrenToProcess, customValueSection];\n }\n\n // No sections in collection - wrap items in a section for visual separation\n const filteredItemsSection = (\n <BaseSection\n key=\"__filtered_items__\"\n aria-label={t('filterListBox.filteredItems', 'Filtered items')}\n >\n {childrenToProcess}\n </BaseSection>\n );\n\n return [filteredItemsSection, customValueSection];\n }\n\n // No visible filtered items, just return the custom option without sections\n if (Array.isArray(childrenToProcess)) {\n return [...childrenToProcess, customOption];\n }\n\n if (childrenToProcess) {\n return [childrenToProcess, customOption];\n }\n\n return customOption;\n }, [\n allowsCustomValue,\n mergedChildren,\n searchValue,\n customKeys,\n localCollectionState.collection,\n customValueProps,\n newCustomValueProps,\n textFilterFn,\n filter,\n contains,\n t,\n ]);\n\n styles = extractStyles(otherProps, PROP_STYLES, styles);\n\n ref = useCombinedRefs(ref);\n searchInputRef = useCombinedRefs(searchInputRef);\n listRef = useCombinedRefs(listRef);\n\n const { isFocused, focusProps } = useFocus({ isDisabled });\n\n const listBoxRef = useRef<HTMLDivElement>(null);\n\n // Ref to access internal ListBox state (selection manager, etc.)\n const listStateRef = useRef<any>(null);\n\n // No separate focusedKey state needed; rely directly on selectionManager.focusedKey.\n\n // When the search value changes, the visible collection of items may change as well.\n // If the currently focused item is no longer visible, move virtual focus to the first\n // available item so that arrow navigation and Enter behaviour continue to work.\n // If there are no available items, reset the selection so Enter won't select anything.\n // Priority: focus on selected items first, then fall back to first visible item.\n useLayoutEffect(() => {\n const listState = listStateRef.current;\n\n if (!listState) return;\n\n const { selectionManager, collection } = listState;\n\n // Walk the collection and:\n // 1. Collect visible item keys (supports sections).\n // 2. Detect the synthetic \"new custom value\" option — the one generated\n // from the current search term when `allowsCustomValue` is true.\n //\n // The custom value is rendered in one of two layouts depending on whether\n // any real item text-matches the search term (`hasVisibleFilteredItems`\n // in `enhancedChildren`):\n // • Some items match → wrapped in a `__custom_value__` section\n // (`customValueHasMatches = true`)\n // • No items match → appended at the top level with key === term\n // (`customValueHasMatches = false`)\n //\n // The layout itself is the signal we use to decide whether the custom\n // value should be the focus target (no matches) or whether focus should\n // move to a real item (matches present).\n const term = searchValue.trim();\n let newCustomValueKey: Key | null = null;\n let customValueHasMatches = false;\n\n const collectVisibleKeys = (\n nodes: Iterable<any>,\n out: Key[],\n inCustomSection = false,\n ) => {\n for (const node of nodes) {\n if (node.type === 'item') {\n out.push(node.key);\n if (inCustomSection) {\n newCustomValueKey = node.key;\n customValueHasMatches = true;\n }\n } else if (node.childNodes) {\n const isCustomSection =\n inCustomSection || node.key === '__custom_value__';\n collectVisibleKeys(node.childNodes, out, isCustomSection);\n }\n }\n };\n\n const visibleKeys: Key[] = [];\n collectVisibleKeys(collection, visibleKeys);\n\n // Detect the appended-at-top-level case (no items text-match). The custom\n // option is added with key === trimmed search term and lives directly in\n // the top-level collection (not nested in any section).\n if (newCustomValueKey == null && allowsCustomValue && term) {\n for (const node of collection) {\n if (node.type === 'item' && String(node.key) === term) {\n newCustomValueKey = node.key;\n customValueHasMatches = false;\n break;\n }\n }\n }\n\n // If there are no visible items, reset the focused key so Enter won't select anything\n if (visibleKeys.length === 0) {\n selectionManager.setFocusedKey(null);\n return;\n }\n\n // The custom value should be the focus target when it exists and there\n // are no real text-matches — the user's typed value is then the only\n // actionable option. During an in-flight server fetch (`filter === false`\n // + `isLoadingItems`) `textFilterFn` falls back to client-side `contains`\n // so non-matching stale items are hidden, which keeps this signal honest.\n const customValueShouldBeFocused =\n newCustomValueKey != null && !customValueHasMatches;\n\n // Decide whether the current focus is already on the right thing. If yes,\n // don't disturb it. Otherwise fall through and re-pick a focus target.\n const currentFocused = selectionManager.focusedKey;\n if (currentFocused != null && visibleKeys.includes(currentFocused)) {\n const currentIsNewCustomValue =\n newCustomValueKey != null && currentFocused === newCustomValueKey;\n if (customValueShouldBeFocused) {\n if (currentIsNewCustomValue) return;\n } else if (newCustomValueKey != null) {\n // Custom value exists but isn't the priority (matches available) —\n // any non-custom focus is fine.\n if (!currentIsNewCustomValue) return;\n } else {\n // No custom value involved at all.\n return;\n }\n }\n\n // Helper to find the first selected item that's visible\n const findFirstVisibleSelectedKey = (): Key | null => {\n if (selectionMode === 'single') {\n // Single selection: check if selectedKey is visible\n if (selectedKey != null) {\n const selectedKeyStr = String(selectedKey);\n if (visibleKeys.some((k) => String(k) === selectedKeyStr)) {\n return selectedKey;\n }\n }\n } else if (selectionMode === 'multiple') {\n // Multiple selection: find first selected key that's visible\n if (selectedKeys && selectedKeys !== 'all') {\n for (const key of selectedKeys) {\n const keyStr = String(key);\n if (visibleKeys.some((k) => String(k) === keyStr)) {\n return key;\n }\n }\n }\n }\n return null;\n };\n\n // Determine which key to focus\n let keyToFocus: Key | null = null;\n\n if (customValueShouldBeFocused) {\n // No real matches — promote the custom value over any selected/stale\n // item so the user can press Enter to add the value they just typed.\n keyToFocus = newCustomValueKey;\n } else {\n keyToFocus = findFirstVisibleSelectedKey();\n\n // Fallback to first visible item if no selected item found. Prefer the\n // first real (non-custom-value) item so focus doesn't land on the\n // bottom-of-list custom-value suggestion when real items are available.\n if (keyToFocus == null) {\n const firstRealKey = visibleKeys.find((k) => k !== newCustomValueKey);\n keyToFocus = firstRealKey ?? visibleKeys[0];\n }\n }\n\n // Mark this focus change as keyboard navigation so ListBox will scroll to it\n if (listState.lastFocusSourceRef) {\n listState.lastFocusSourceRef.current = 'keyboard';\n }\n\n // Set focus to the determined key\n selectionManager.setFocusedKey(keyToFocus);\n }, [\n searchValue,\n enhancedChildren,\n selectionMode,\n selectedKey,\n selectedKeys,\n allowsCustomValue,\n ]);\n\n // Keyboard navigation handler for search input\n const { keyboardProps } = useKeyboard({\n onKeyDown: (e) => {\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {\n e.preventDefault();\n\n const listState = listStateRef.current;\n if (!listState) return;\n\n const { selectionManager, collection } = listState;\n\n // Helper to collect visible item keys (supports sections)\n // Collection is already filtered by React Stately via filterFn\n const collectVisibleKeys = (nodes: Iterable<any>, out: Key[]) => {\n for (const node of nodes) {\n if (node.type === 'item') {\n out.push(node.key);\n } else if (node.childNodes) {\n collectVisibleKeys(node.childNodes, out);\n }\n }\n };\n\n const visibleKeys: Key[] = [];\n collectVisibleKeys(collection, visibleKeys);\n\n if (visibleKeys.length === 0) return;\n\n const isArrowDown = e.key === 'ArrowDown';\n const direction = isArrowDown ? 1 : -1;\n\n const currentKey = selectionManager.focusedKey;\n\n let nextKey: Key | null = null;\n\n if (currentKey == null) {\n // If nothing focused yet, pick first/last depending on direction\n nextKey = isArrowDown\n ? visibleKeys[0]\n : visibleKeys[visibleKeys.length - 1];\n } else {\n const currentIndex = visibleKeys.indexOf(currentKey);\n if (currentIndex !== -1) {\n const newIndex = currentIndex + direction;\n if (newIndex >= 0 && newIndex < visibleKeys.length) {\n nextKey = visibleKeys[newIndex];\n } else if (shouldFocusWrap) {\n // Wrap around\n nextKey = isArrowDown\n ? visibleKeys[0]\n : visibleKeys[visibleKeys.length - 1];\n }\n } else {\n // Fallback\n nextKey = isArrowDown\n ? visibleKeys[0]\n : visibleKeys[visibleKeys.length - 1];\n }\n }\n\n if (nextKey != null) {\n // Mark this focus change as keyboard navigation\n if (listState.lastFocusSourceRef) {\n listState.lastFocusSourceRef.current = 'keyboard';\n }\n selectionManager.setFocusedKey(nextKey);\n }\n } else if (\n e.key === 'Home' ||\n e.key === 'End' ||\n e.key === 'PageUp' ||\n e.key === 'PageDown'\n ) {\n e.preventDefault();\n\n const listState = listStateRef.current;\n if (!listState) return;\n\n const { selectionManager, collection } = listState;\n\n // Helper to collect visible item keys (supports sections)\n // Collection is already filtered by React Stately via filterFn\n const collectVisibleKeys = (nodes: Iterable<any>, out: Key[]) => {\n for (const node of nodes) {\n if (node.type === 'item') {\n out.push(node.key);\n } else if (node.childNodes) {\n collectVisibleKeys(node.childNodes, out);\n }\n }\n };\n\n const visibleKeys: Key[] = [];\n collectVisibleKeys(collection, visibleKeys);\n\n if (visibleKeys.length === 0) return;\n\n const targetKey =\n e.key === 'Home' || e.key === 'PageUp'\n ? visibleKeys[0]\n : visibleKeys[visibleKeys.length - 1];\n\n // Mark this focus change as keyboard navigation\n if (listState.lastFocusSourceRef) {\n listState.lastFocusSourceRef.current = 'keyboard';\n }\n selectionManager.setFocusedKey(targetKey);\n } else if (e.key === 'Enter' || (e.key === ' ' && !searchValue)) {\n const listState = listStateRef.current;\n\n if (!listState) return;\n\n const keyToSelect = listState.selectionManager.focusedKey;\n\n if (keyToSelect != null) {\n e.preventDefault();\n listState.selectionManager.select(keyToSelect, e);\n\n if (\n e.key === 'Enter' &&\n isCheckable &&\n onEscape &&\n selectionMode === 'multiple'\n ) {\n onEscape();\n }\n }\n } else if (e.key === 'Escape') {\n if (searchValue) {\n // Clear the current search if any text is present.\n e.preventDefault();\n handleSearchChange('');\n } else {\n // Notify parent that Escape was pressed on an empty input.\n if (onEscape) {\n e.preventDefault();\n onEscape();\n }\n }\n }\n },\n });\n\n const mods = useMemo(\n () => ({\n ...getValidationMods({ isInvalid, isValid }),\n disabled: !!isDisabled,\n focused: isFocused,\n loading: !!isLoading,\n 'loading-items': !!isLoadingItems,\n searchable: true,\n prefix: !!isLoading,\n suffix: !!isLoadingItems,\n ...externalMods,\n }),\n [\n isInvalid,\n isInvalid,\n isValid,\n isDisabled,\n isFocused,\n isLoading,\n isLoadingItems,\n externalMods,\n ],\n );\n\n // Handler must be defined before we render ListBox so we can pass it.\n const handleSelectionChange = (selection: any) => {\n if (allowsCustomValue) {\n // Normalize current selection into an array of string keys\n let selectedValues: string[] = [];\n\n if (selection != null) {\n if (Array.isArray(selection)) {\n selectedValues = selection.map(String);\n } else {\n selectedValues = [String(selection)];\n }\n }\n\n // Build next custom keys set based on selected values\n const nextSet = new Set<string>();\n\n selectedValues.forEach((val) => {\n if (!originalKeys.has(val)) {\n nextSet.add(val);\n }\n });\n\n // Update internal custom keys state\n setCustomKeys(nextSet);\n }\n\n if (externalOnSelectionChange) {\n (externalOnSelectionChange as any)(selection);\n }\n };\n\n // Custom option click handler that ensures search input receives focus\n const handleOptionClick = (key: Key) => {\n // Focus the search input to enable keyboard navigation\n // Use setTimeout to ensure this happens after React state updates\n setTimeout(() => {\n if (searchInputRef.current) {\n searchInputRef.current.focus();\n }\n }, 0);\n\n // Call the original onOptionClick if provided\n if (onOptionClick) {\n onOptionClick(key);\n }\n };\n\n const searchInput = (\n <SearchWrapperElement mods={mods} data-size={size}>\n {isLoading && (\n <div data-element=\"Prefix\">\n <div data-element=\"InputIcon\">\n {isLoading ? <LoadingIcon /> : null}\n </div>\n </div>\n )}\n <SearchInputElement\n ref={searchInputRef}\n qa={qa || 'FilterListBox'}\n id={id}\n data-prefix={isLoading ? '' : undefined}\n data-suffix={isLoadingItems ? '' : undefined}\n type=\"search\"\n placeholder={searchPlaceholder}\n value={searchValue}\n disabled={isDisabled}\n autoFocus={autoFocus}\n data-autofocus={autoFocus ? '' : undefined}\n styles={searchInputStyles}\n data-size={size}\n data-input-type=\"filterlistbox\"\n role=\"combobox\"\n aria-expanded=\"true\"\n aria-haspopup=\"listbox\"\n aria-activedescendant={\n listStateRef.current?.selectionManager.focusedKey != null\n ? `ListBoxItem-${listStateRef.current?.selectionManager.focusedKey}`\n : undefined\n }\n onChange={(e) => {\n handleSearchChange(e.target.value);\n }}\n {...keyboardProps}\n {...modAttrs(mods)}\n />\n {isLoadingItems && (\n <div data-element=\"Suffix\">\n <LoadingIcon data-element=\"InputIcon\" />\n </div>\n )}\n </SearchWrapperElement>\n );\n\n const filterListBoxField = (\n <FilterListBoxWrapperElement\n ref={ref}\n qa=\"FilterListBoxWrapper\"\n {...modAttrs(mods)}\n styles={styles}\n {...focusProps}\n >\n {header ? (\n <StyledHeaderWithoutBorder data-size={size} styles={headerStyles}>\n {header}\n </StyledHeaderWithoutBorder>\n ) : (\n <div role=\"presentation\" />\n )}\n {searchInput}\n <ListBox\n ref={listBoxRef}\n aria-label={innerAriaLabel}\n selectedKey={selectedKey}\n defaultSelectedKey={defaultSelectedKey}\n selectedKeys={selectedKeys}\n defaultSelectedKeys={defaultSelectedKeys}\n selectionMode={selectionMode}\n isDisabled={isDisabled}\n listRef={listRef}\n stateRef={listStateRef}\n listStyles={listStyles}\n shouldFocusWrap={shouldFocusWrap}\n optionStyles={optionStyles}\n sectionStyles={sectionStyles}\n headingStyles={headingStyles}\n isInvalid={isInvalid}\n isValid={isValid}\n disallowEmptySelection={props.disallowEmptySelection}\n disabledKeys={props.disabledKeys}\n focusOnHover={focusOnHover}\n shouldUseVirtualFocus={!(isReorderable && !searchValue.trim())}\n showSelectAll={showSelectAll}\n selectAllLabel={selectAllLabel}\n footer={footer}\n footerStyles={footerStyles}\n mods={mods}\n size=\"medium\"\n styles={listBoxStyles}\n isCheckable={isCheckable}\n items={items as any}\n allValueProps={allValueProps}\n filter={filterFn}\n emptyLabel={\n emptyLabel !== undefined\n ? emptyLabel\n : searchValue.trim()\n ? t('filterListBox.noResults', 'No results found')\n : t('filterListBox.noItems', 'No items')\n }\n isReorderable={isReorderable && !searchValue.trim()}\n onReorder={onReorder}\n onSelectionChange={handleSelectionChange}\n onEscape={onEscape}\n onOptionClick={handleOptionClick}\n >\n {enhancedChildren as any}\n </ListBox>\n </FilterListBoxWrapperElement>\n );\n\n return wrapWithField<Omit<CubeFilterListBoxProps<T>, 'children'>>(\n filterListBoxField,\n ref,\n props,\n );\n}) as unknown as (<T>(\n props: CubeFilterListBoxProps<T> & { ref?: ForwardedRef<HTMLDivElement> },\n) => ReactElement) & { Item: typeof Item; Section: typeof BaseSection };\n\nFilterListBox.Item = ListBox.Item;\n\nFilterListBox.Section = BaseSection;\n\nObject.defineProperty(FilterListBox, 'cubeInputType', {\n value: 'FilterListBox',\n enumerable: false,\n configurable: false,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,8BAA8B,MAAM,EACxC,QAAQ;CACN,SAAS;CACT,MAAM;CACN,aAAa;CACb,UAAU;CACV,KAAK;CACL,UAAU;CACV,QAAQ;CACR,OAAO;CACP,YAAY;CACZ,SAAS;EACP,IAAI;EACJ,qBAAqB;EACrB,SAAS;EACV;CACD,QAAQ;EACN,IAAI;EACJ,SAAS;EACT,OAAO;EACP,SAAS;EACT,UAAU;EACV,SAAS;EACV;CACF,EACF,CAAC;AAEF,MAAM,uBAAuB,MAAM;CACjC,IAAI;CACJ,QAAQ;EACN,GAAG;EACH,QAAQ;EACR,QAAQ;EACR,MAAM;EACN,QAAQ;EACR,OAAO;GACL,IAAI;GACJ,cAAc;GACd,eAAe;GACf,cAAc;GACf;EACF;CACF,CAAC;AAEF,MAAM,qBAAqB,MAAM;CAC/B,IAAI;CACJ,QAAQ;EACN,GAAG;EACH,MAAM;EACN,SAAS;GACP,IAAI;GACJ,QAAQ;GACR,QAAQ;GACR,mBAAmB;GACpB;EACF;CACF,CAAC;AAEF,MAAM,4BAA4B,MAAM,cAAc,EACpD,QAAQ,EACN,QAAQ,OACT,EACF,CAAC;AAgFF,MAAM,cAAc;CAAC,GAAG;CAAa,GAAG;CAAc,GAAG;CAAa;AAEtE,MAAa,gBAAgB,WAAW,SAAS,cAE/C,OAAkC,KAAmC;AACrE,SAAQ,cAAc,OAAO,EAC3B,mBAAmB,EAAE,OAAO,eAAe;EACzC,MAAM,aAAkB,EAAE;AAE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B,cAAc,MAAM;IACN;IACd,uBAAuB,EAAE,iBAAiB,CAAC,YAAY,MAAM;IAC9C;IACC;IACR;IACM;IACR;IACN,MAAK;IACL,QAAQ;IACK;IACN;IACQ;IACf,QAAQ;IACR,YACE,eAAe,SACX,aACA,YAAY,MAAM,GAChB,EAAE,2BAA2B,mBAAmB,GAChD,EAAE,yBAAyB,WAAW;IAE9C,eAAe,iBAAiB,CAAC,YAAY,MAAM;IACxC;IACX,mBAAmB;IACT;IACV,eAAe;cAEd;KACO;;GACkB,EAK9B,KACA,MACD;EACD;AAIF,cAAc,OAAO,QAAQ;AAE7B,cAAc,UAAUD;AAExB,OAAO,eAAe,eAAe,iBAAiB;CACpD,OAAO;CACP,YAAY;CACZ,cAAc;CACf,CAAC"}
@@ -1,17 +1,17 @@
1
- /** @license MIT | @cube-dev/ui-kit v0.147.3 | Cube Dev Team */
1
+ /** @license MIT | @cube-dev/ui-kit v0.148.0 | Cube Dev Team */
2
2
  import { extractStyles } from "../../../utils/styles.js";
3
3
  import { useEvent } from "../../../_internal/hooks/use-event.js";
4
4
  import { _Text } from "../../content/Text.js";
5
5
  import { LoadingIcon } from "../../../icons/LoadingIcon.js";
6
6
  import { ItemActionProvider } from "../../actions/ItemActionContext.js";
7
7
  import { useWarn } from "../../../_internal/hooks/use-warn.js";
8
- import { useProviderProps } from "../../../provider.js";
9
8
  import { ItemAction } from "../../actions/ItemAction/ItemAction.js";
10
9
  import { useI18n } from "../../../i18n/useI18n.js";
11
10
  import { CloseIcon } from "../../../icons/CloseIcon.js";
12
11
  import { DirectionIcon } from "../../../icons/DirectionIcon.js";
13
12
  import { _ItemButton } from "../../actions/ItemButton/ItemButton.js";
14
- import { useFormProps } from "../../form/Form/Form.js";
13
+ import { getValidationTheme } from "../../form/validation/resolve-validation-props.js";
14
+ import { getValidationIcon } from "../../form/validation/ValidationIndicator.js";
15
15
  import { useFieldProps } from "../../form/Form/use-field/use-field-props.js";
16
16
  import { wrapWithField } from "../../form/wrapper.js";
17
17
  import { Dialog } from "../../overlays/Dialog/Dialog.js";
@@ -21,7 +21,7 @@ import { processSelectionArray } from "../../../utils/selection.js";
21
21
  import { FilterListBox } from "../FilterListBox/FilterListBox.js";
22
22
  import { BASE_STYLES, COLOR_STYLES, OUTER_STYLES, filterBaseProps, tasty } from "@tenphi/tasty";
23
23
  import { forwardRef, useEffect, useMemo, useRef, useState } from "react";
24
- import { jsx, jsxs } from "react/jsx-runtime";
24
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
25
25
  import { FocusScope, useKeyboard } from "react-aria";
26
26
  import { Section, useListState } from "react-stately";
27
27
 
@@ -43,8 +43,6 @@ const FilterPickerWrapper = tasty({
43
43
  });
44
44
  const FilterPicker = forwardRef(function FilterPicker(props, ref) {
45
45
  const { t } = useI18n();
46
- props = useProviderProps(props);
47
- props = useFormProps(props);
48
46
  props = useFieldProps(props, { valuePropsMapper: ({ value, onChange }) => {
49
47
  const fieldProps = {};
50
48
  if (props.selectionMode === "multiple") fieldProps.selectedKeys = value || [];
@@ -56,7 +54,7 @@ const FilterPicker = forwardRef(function FilterPicker(props, ref) {
56
54
  };
57
55
  return fieldProps;
58
56
  } });
59
- let { qa, label, extra, id, icon, rightIcon, prefix, suffix, hotkeys, triggerTooltip, triggerDescription, labelStyles, isRequired, necessityIndicator, validationState, isDisabled, isLoading, message, mods: externalMods, description, descriptionPlacement, placeholder, size = "medium", styles, listBoxStyles, popoverStyles, type = "outline", theme = "default", shape, labelSuffix, shouldFocusWrap, children, shouldFlip = true, placement = "bottom start", containerPadding = 8, selectedKey, defaultSelectedKey, selectedKeys, defaultSelectedKeys, disabledKeys, onSelectionChange, selectionMode = "single", listStateRef, focusOnHover, showSelectAll, selectAllLabel = t("picker.all", "All"), items, header, footer, headerStyles, footerStyles, triggerStyles, allowsCustomValue, renderSummary, isCheckable, allValueProps, customValueProps, newCustomValueProps, searchPlaceholder, autoFocus, filter, emptyLabel, searchInputStyles, searchInputRef, listStyles, optionStyles, sectionStyles, headingStyles, listRef, disallowEmptySelection, shouldUseVirtualFocus, onEscape, onOptionClick, isClearable, isLoadingItems, searchValue, onSearchChange, sortSelectedToTop: sortSelectedToTopProp, onOpenChange, isReorderable, onReorder, form, ...otherProps } = props;
57
+ let { qa, label, extra, id, icon, rightIcon, prefix, suffix, hotkeys, triggerTooltip, triggerDescription, labelStyles, isRequired, necessityIndicator, isInvalid, isValid, isDisabled, isLoading, message, mods: externalMods, description, descriptionPlacement, placeholder, size = "medium", styles, listBoxStyles, popoverStyles, type = "outline", theme = "default", shape, labelSuffix, shouldFocusWrap, children, shouldFlip = true, placement = "bottom start", containerPadding = 8, selectedKey, defaultSelectedKey, selectedKeys, defaultSelectedKeys, disabledKeys, onSelectionChange, selectionMode = "single", listStateRef, focusOnHover, showSelectAll, selectAllLabel = t("picker.all", "All"), items, header, footer, headerStyles, footerStyles, triggerStyles, allowsCustomValue, renderSummary, isCheckable, allValueProps, customValueProps, newCustomValueProps, searchPlaceholder, autoFocus, filter, emptyLabel, searchInputStyles, searchInputRef, listStyles, optionStyles, sectionStyles, headingStyles, listRef, disallowEmptySelection, shouldUseVirtualFocus, onEscape, onOptionClick, isClearable, isLoadingItems, searchValue, onSearchChange, sortSelectedToTop: sortSelectedToTopProp, onOpenChange, isReorderable, onReorder, form, ...otherProps } = props;
60
58
  const sortSelectedToTopExplicit = sortSelectedToTopProp !== void 0;
61
59
  const sortSelectedToTop = sortSelectedToTopProp ?? (items ? true : false);
62
60
  styles = extractStyles(otherProps, PROP_STYLES, styles);
@@ -266,13 +264,21 @@ const FilterPicker = forwardRef(function FilterPicker(props, ref) {
266
264
  selectAllLabel
267
265
  ]);
268
266
  const showClearButton = isClearable && hasSelection && !isDisabled && !props.isReadOnly;
267
+ const validationIcon = getValidationIcon({
268
+ isInvalid,
269
+ isValid
270
+ });
271
+ if (validationIcon) suffix = /* @__PURE__ */ jsxs(Fragment$1, { children: [suffix, validationIcon] });
269
272
  const triggerElement = /* @__PURE__ */ jsx(_ItemButton, {
270
273
  ref: triggerRef,
271
274
  "data-popover-trigger": true,
272
275
  qa: qa || "FilterPicker",
273
276
  id,
274
277
  type,
275
- theme: validationState === "invalid" ? "danger" : theme,
278
+ theme: getValidationTheme(theme, {
279
+ isInvalid,
280
+ isValid
281
+ }),
276
282
  size,
277
283
  shape,
278
284
  isDisabled: isDisabled || isLoading,
@@ -284,7 +290,10 @@ const FilterPicker = forwardRef(function FilterPicker(props, ref) {
284
290
  icon,
285
291
  rightIcon: isLoading ? /* @__PURE__ */ jsx(LoadingIcon, {}) : rightIcon !== void 0 ? rightIcon : showClearButton ? /* @__PURE__ */ jsx(ItemActionProvider, {
286
292
  type,
287
- theme: validationState === "invalid" ? "danger" : theme,
293
+ theme: getValidationTheme(theme, {
294
+ isInvalid,
295
+ isValid
296
+ }),
288
297
  children: /* @__PURE__ */ jsx(ItemAction, {
289
298
  icon: /* @__PURE__ */ jsx(CloseIcon, {}),
290
299
  size,
@@ -376,7 +385,8 @@ const FilterPicker = forwardRef(function FilterPicker(props, ref) {
376
385
  shouldFocusWrap,
377
386
  allowsCustomValue,
378
387
  selectionMode,
379
- validationState,
388
+ isInvalid,
389
+ isValid,
380
390
  isDisabled,
381
391
  isLoading,
382
392
  isLoadingItems,