@carbon/react 1.103.0-rc.0 → 1.104.0-rc.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 (777) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +950 -950
  2. package/es/_virtual/_rolldown/runtime.js +25 -0
  3. package/es/components/AILabel/index.d.ts +29 -2
  4. package/es/components/AILabel/index.js +114 -169
  5. package/es/components/AISkeleton/AISkeletonIcon.js +23 -27
  6. package/es/components/AISkeleton/AISkeletonPlaceholder.js +19 -27
  7. package/es/components/AISkeleton/AISkeletonText.js +26 -39
  8. package/es/components/Accordion/Accordion.Skeleton.js +55 -79
  9. package/es/components/Accordion/Accordion.js +43 -61
  10. package/es/components/Accordion/AccordionItem.js +102 -156
  11. package/es/components/Accordion/AccordionProvider.js +18 -15
  12. package/es/components/AspectRatio/AspectRatio.js +41 -47
  13. package/es/components/BadgeIndicator/index.js +28 -33
  14. package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +39 -50
  15. package/es/components/Breadcrumb/Breadcrumb.js +39 -51
  16. package/es/components/Breadcrumb/BreadcrumbItem.js +80 -83
  17. package/es/components/Button/Button.Skeleton.js +49 -58
  18. package/es/components/Button/Button.d.ts +1 -1
  19. package/es/components/Button/Button.js +146 -240
  20. package/es/components/Button/ButtonBase.js +82 -104
  21. package/es/components/Button/index.js +13 -6
  22. package/es/components/ButtonSet/ButtonSet.js +74 -98
  23. package/es/components/ButtonSet/index.js +12 -4
  24. package/es/components/ChatButton/ChatButton.Skeleton.js +27 -27
  25. package/es/components/ChatButton/ChatButton.js +64 -79
  26. package/es/components/Checkbox/Checkbox.Skeleton.js +26 -25
  27. package/es/components/Checkbox/Checkbox.js +116 -195
  28. package/es/components/Checkbox/index.js +13 -5
  29. package/es/components/CheckboxGroup/CheckboxGroup.js +100 -148
  30. package/es/components/ClassPrefix/index.js +21 -17
  31. package/es/components/CodeSnippet/CodeSnippet.Skeleton.js +45 -42
  32. package/es/components/CodeSnippet/CodeSnippet.js +210 -299
  33. package/es/components/ComboBox/ComboBox.js +621 -970
  34. package/es/components/ComboBox/index.js +12 -4
  35. package/es/components/ComboButton/index.js +172 -208
  36. package/es/components/ComposedModal/ComposedModal.js +311 -450
  37. package/es/components/ComposedModal/ComposedModalPresence.js +47 -42
  38. package/es/components/ComposedModal/ModalFooter.js +127 -207
  39. package/es/components/ComposedModal/ModalHeader.js +71 -101
  40. package/es/components/ComposedModal/useComposedModalState.js +21 -15
  41. package/es/components/ContainedList/ContainedList.js +67 -102
  42. package/es/components/ContainedList/ContainedListItem/ContainedListItem.js +49 -67
  43. package/es/components/ContainedList/ContainedListItem/index.js +12 -4
  44. package/es/components/ContainedList/index.js +15 -12
  45. package/es/components/ContentSwitcher/ContentSwitcher.js +108 -140
  46. package/es/components/ContextMenu/useContextMenu.js +41 -36
  47. package/es/components/Copy/Copy.js +97 -117
  48. package/es/components/Copy/index.js +12 -4
  49. package/es/components/CopyButton/CopyButton.js +81 -94
  50. package/es/components/CopyButton/index.js +12 -4
  51. package/es/components/DangerButton/DangerButton.js +11 -9
  52. package/es/components/DataTable/DataTable.d.ts +11 -11
  53. package/es/components/DataTable/DataTable.js +448 -630
  54. package/es/components/DataTable/Table.js +111 -156
  55. package/es/components/DataTable/TableActionList.js +14 -6
  56. package/es/components/DataTable/TableBatchAction.js +25 -34
  57. package/es/components/DataTable/TableBatchActions.js +78 -113
  58. package/es/components/DataTable/TableBody.js +26 -19
  59. package/es/components/DataTable/TableCell.js +31 -46
  60. package/es/components/DataTable/TableContainer.js +75 -82
  61. package/es/components/DataTable/TableContext.js +14 -6
  62. package/es/components/DataTable/TableDecoratorRow.js +30 -36
  63. package/es/components/DataTable/TableExpandHeader.js +53 -90
  64. package/es/components/DataTable/TableExpandRow.js +82 -119
  65. package/es/components/DataTable/TableExpandedRow.js +45 -51
  66. package/es/components/DataTable/TableHead.js +7 -5
  67. package/es/components/DataTable/TableHeader.js +138 -181
  68. package/es/components/DataTable/TableRow.d.ts +1 -1
  69. package/es/components/DataTable/TableRow.js +42 -76
  70. package/es/components/DataTable/TableSelectAll.js +42 -70
  71. package/es/components/DataTable/TableSelectRow.js +63 -98
  72. package/es/components/DataTable/TableSlugRow.js +35 -43
  73. package/es/components/DataTable/TableToolbar.js +33 -45
  74. package/es/components/DataTable/TableToolbarAction.js +25 -20
  75. package/es/components/DataTable/TableToolbarContent.js +14 -6
  76. package/es/components/DataTable/TableToolbarMenu.js +35 -46
  77. package/es/components/DataTable/TableToolbarSearch.js +97 -187
  78. package/es/components/DataTable/state/getDerivedStateFromProps.js +38 -43
  79. package/es/components/DataTable/state/sortStates.js +11 -9
  80. package/es/components/DataTable/state/sorting.js +53 -72
  81. package/es/components/DataTable/tools/cells.js +15 -7
  82. package/es/components/DataTable/tools/denormalize.js +27 -19
  83. package/es/components/DataTable/tools/filter.js +21 -22
  84. package/es/components/DataTable/tools/normalize.js +57 -72
  85. package/es/components/DataTable/tools/sorting.js +50 -71
  86. package/es/components/DataTableSkeleton/DataTableSkeleton.js +66 -94
  87. package/es/components/DatePicker/DatePicker.Skeleton.js +44 -51
  88. package/es/components/DatePicker/DatePicker.d.ts +4 -2
  89. package/es/components/DatePicker/DatePicker.js +485 -749
  90. package/es/components/DatePicker/DatePickerLocales.js +75 -126
  91. package/es/components/DatePicker/index.js +13 -5
  92. package/es/components/DatePicker/plugins/appendToPlugin.js +31 -45
  93. package/es/components/DatePicker/plugins/fixEventsPlugin.js +127 -171
  94. package/es/components/DatePicker/plugins/rangePlugin.d.ts +1 -1
  95. package/es/components/DatePicker/plugins/rangePlugin.js +40 -47
  96. package/es/components/DatePicker/utils.d.ts +7 -0
  97. package/es/components/DatePicker/utils.js +18 -0
  98. package/es/components/DatePickerInput/DatePickerInput.js +179 -289
  99. package/es/components/DatePickerInput/index.js +12 -4
  100. package/es/components/Dialog/Dialog.js +303 -574
  101. package/es/components/Dialog/index.js +18 -2
  102. package/es/components/Dropdown/Dropdown.Skeleton.js +26 -38
  103. package/es/components/Dropdown/Dropdown.js +344 -535
  104. package/es/components/Dropdown/index.js +13 -5
  105. package/es/components/ErrorBoundary/ErrorBoundary.js +36 -58
  106. package/es/components/ErrorBoundary/ErrorBoundaryContext.js +14 -9
  107. package/es/components/ExpandableSearch/ExpandableSearch.js +60 -69
  108. package/es/components/ExpandableSearch/index.js +12 -4
  109. package/es/components/FeatureFlags/index.d.ts +11 -2
  110. package/es/components/FeatureFlags/index.js +79 -77
  111. package/es/components/FileUploader/FileUploader.Skeleton.js +35 -30
  112. package/es/components/FileUploader/FileUploader.js +269 -343
  113. package/es/components/FileUploader/FileUploaderButton.js +110 -160
  114. package/es/components/FileUploader/FileUploaderDropContainer.js +144 -221
  115. package/es/components/FileUploader/FileUploaderItem.js +138 -157
  116. package/es/components/FileUploader/Filename.d.ts +1 -1
  117. package/es/components/FileUploader/Filename.js +53 -72
  118. package/es/components/FluidComboBox/FluidComboBox.Skeleton.js +26 -28
  119. package/es/components/FluidComboBox/FluidComboBox.js +54 -105
  120. package/es/components/FluidDatePicker/FluidDatePicker.Skeleton.js +56 -53
  121. package/es/components/FluidDatePicker/FluidDatePicker.js +46 -68
  122. package/es/components/FluidDatePickerInput/FluidDatePickerInput.js +23 -16
  123. package/es/components/FluidDropdown/FluidDropdown.Skeleton.js +26 -28
  124. package/es/components/FluidDropdown/FluidDropdown.js +55 -111
  125. package/es/components/FluidForm/FluidForm.js +29 -31
  126. package/es/components/FluidForm/FormContext.js +12 -6
  127. package/es/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +26 -28
  128. package/es/components/FluidMultiSelect/FluidMultiSelect.js +67 -197
  129. package/es/components/FluidNumberInput/FluidNumberInput.Skeleton.js +27 -30
  130. package/es/components/FluidNumberInput/FluidNumberInput.js +63 -147
  131. package/es/components/FluidSearch/FluidSearch.Skeleton.js +27 -30
  132. package/es/components/FluidSearch/FluidSearch.js +41 -84
  133. package/es/components/FluidSelect/FluidSelect.Skeleton.js +26 -28
  134. package/es/components/FluidSelect/FluidSelect.js +40 -76
  135. package/es/components/FluidSelect/index.js +13 -5
  136. package/es/components/FluidTextArea/FluidTextArea.Skeleton.js +27 -30
  137. package/es/components/FluidTextArea/FluidTextArea.js +48 -112
  138. package/es/components/FluidTextInput/FluidPasswordInput.js +44 -99
  139. package/es/components/FluidTextInput/FluidTextInput.Skeleton.js +27 -30
  140. package/es/components/FluidTextInput/FluidTextInput.js +49 -104
  141. package/es/components/FluidTextInput/index.js +14 -6
  142. package/es/components/FluidTimePicker/FluidTimePicker.Skeleton.js +30 -33
  143. package/es/components/FluidTimePicker/FluidTimePicker.js +68 -115
  144. package/es/components/FluidTimePickerSelect/FluidTimePickerSelect.js +28 -47
  145. package/es/components/Form/Form.js +23 -25
  146. package/es/components/FormGroup/FormGroup.js +45 -67
  147. package/es/components/FormItem/FormItem.js +23 -25
  148. package/es/components/FormLabel/FormLabel.js +28 -34
  149. package/es/components/Grid/CSSGrid.d.ts +1 -1
  150. package/es/components/Grid/CSSGrid.js +85 -127
  151. package/es/components/Grid/Column.js +192 -324
  152. package/es/components/Grid/ColumnHang.js +28 -36
  153. package/es/components/Grid/FlexGrid.js +40 -60
  154. package/es/components/Grid/Grid.js +29 -42
  155. package/es/components/Grid/GridContext.js +36 -42
  156. package/es/components/Grid/Row.js +31 -49
  157. package/es/components/Heading/index.js +36 -51
  158. package/es/components/Icon/Icon.Skeleton.js +21 -21
  159. package/es/components/IconButton/index.js +117 -178
  160. package/es/components/IconIndicator/index.d.ts +1 -1
  161. package/es/components/IconIndicator/index.js +59 -60
  162. package/es/components/IdPrefix/index.js +21 -17
  163. package/es/components/InlineCheckbox/InlineCheckbox.js +69 -113
  164. package/es/components/InlineCheckbox/index.js +12 -4
  165. package/es/components/InlineLoading/InlineLoading.js +83 -100
  166. package/es/components/InlineLoading/index.js +12 -4
  167. package/es/components/Layer/LayerContext.js +12 -4
  168. package/es/components/Layer/LayerLevel.js +20 -4
  169. package/es/components/Layer/index.js +54 -66
  170. package/es/components/Layout/index.js +77 -109
  171. package/es/components/LayoutDirection/LayoutDirection.d.ts +1 -1
  172. package/es/components/LayoutDirection/LayoutDirection.js +33 -37
  173. package/es/components/LayoutDirection/LayoutDirectionContext.js +12 -6
  174. package/es/components/LayoutDirection/useLayoutDirection.js +15 -7
  175. package/es/components/Link/Link.js +63 -108
  176. package/es/components/Link/index.js +12 -4
  177. package/es/components/ListBox/ListBox.js +78 -126
  178. package/es/components/ListBox/ListBoxField.js +24 -43
  179. package/es/components/ListBox/ListBoxMenu.js +36 -42
  180. package/es/components/ListBox/ListBoxMenuIcon.js +39 -40
  181. package/es/components/ListBox/ListBoxMenuItem.js +67 -88
  182. package/es/components/ListBox/ListBoxPropTypes.js +17 -5
  183. package/es/components/ListBox/ListBoxSelection.js +71 -96
  184. package/es/components/ListBox/index.js +16 -14
  185. package/es/components/ListBox/next/ListBoxSelection.js +79 -117
  186. package/es/components/ListBox/next/ListBoxTrigger.js +44 -48
  187. package/es/components/ListItem/ListItem.js +25 -28
  188. package/es/components/Loading/Loading.js +64 -73
  189. package/es/components/Loading/index.js +12 -4
  190. package/es/components/Menu/Menu.js +220 -363
  191. package/es/components/Menu/MenuContext.d.ts +1 -1
  192. package/es/components/Menu/MenuContext.js +41 -38
  193. package/es/components/Menu/MenuItem.js +282 -413
  194. package/es/components/MenuButton/index.js +134 -195
  195. package/es/components/Modal/Modal.js +500 -660
  196. package/es/components/Modal/ModalPresence.js +39 -37
  197. package/es/components/Modal/index.js +13 -5
  198. package/es/components/ModalWrapper/ModalWrapper.d.ts +2 -2
  199. package/es/components/ModalWrapper/ModalWrapper.js +106 -130
  200. package/es/components/MultiSelect/FilterableMultiSelect.js +605 -918
  201. package/es/components/MultiSelect/MultiSelect.js +454 -716
  202. package/es/components/MultiSelect/MultiSelectPropTypes.js +13 -30
  203. package/es/components/MultiSelect/filter.js +14 -9
  204. package/es/components/MultiSelect/tools/sorting.js +21 -34
  205. package/es/components/Notification/Notification.js +508 -785
  206. package/es/components/NumberInput/NumberFormatPropTypes.js +69 -30
  207. package/es/components/NumberInput/NumberInput.Skeleton.js +29 -33
  208. package/es/components/NumberInput/NumberInput.js +567 -947
  209. package/es/components/OrderedList/OrderedList.js +31 -44
  210. package/es/components/OverflowMenu/OverflowMenu.js +335 -450
  211. package/es/components/OverflowMenu/index.js +25 -16
  212. package/es/components/OverflowMenu/next/index.js +154 -186
  213. package/es/components/OverflowMenuItem/OverflowMenuItem.js +100 -160
  214. package/es/components/OverflowMenuItem/index.js +12 -4
  215. package/es/components/OverflowMenuV2/index.js +15 -13
  216. package/es/components/PageHeader/PageHeader.js +297 -442
  217. package/es/components/PageHeader/index.js +24 -2
  218. package/es/components/Pagination/Pagination.Skeleton.js +34 -35
  219. package/es/components/Pagination/Pagination.d.ts +1 -1
  220. package/es/components/Pagination/Pagination.js +251 -356
  221. package/es/components/Pagination/experimental/PageSelector.js +38 -54
  222. package/es/components/Pagination/experimental/Pagination-story.d.ts +114 -0
  223. package/es/components/Pagination/experimental/Pagination.js +144 -196
  224. package/es/components/PaginationNav/PaginationNav.js +320 -426
  225. package/es/components/Popover/index.js +318 -437
  226. package/es/components/PrimaryButton/PrimaryButton.js +11 -9
  227. package/es/components/ProgressBar/ProgressBar.js +117 -143
  228. package/es/components/ProgressIndicator/ProgressIndicator.Skeleton.js +42 -38
  229. package/es/components/ProgressIndicator/ProgressIndicator.js +146 -243
  230. package/es/components/RadioButton/RadioButton.Skeleton.js +23 -25
  231. package/es/components/RadioButton/RadioButton.js +101 -174
  232. package/es/components/RadioButton/index.js +12 -4
  233. package/es/components/RadioButtonGroup/RadioButtonGroup.js +135 -207
  234. package/es/components/RadioTile/RadioTile.js +104 -168
  235. package/es/components/RadioTile/index.js +12 -4
  236. package/es/components/Search/Search.Skeleton.js +28 -33
  237. package/es/components/Search/Search.js +182 -278
  238. package/es/components/Search/index.js +13 -5
  239. package/es/components/Search/utils.js +11 -3
  240. package/es/components/SecondaryButton/SecondaryButton.js +11 -9
  241. package/es/components/Select/Select.Skeleton.js +27 -30
  242. package/es/components/Select/Select.js +178 -257
  243. package/es/components/Select/index.js +13 -5
  244. package/es/components/SelectItem/SelectItem.js +33 -48
  245. package/es/components/SelectItem/index.js +12 -4
  246. package/es/components/SelectItemGroup/SelectItemGroup.js +27 -37
  247. package/es/components/ShapeIndicator/index.d.ts +1 -1
  248. package/es/components/ShapeIndicator/index.js +74 -80
  249. package/es/components/SkeletonIcon/SkeletonIcon.js +21 -24
  250. package/es/components/SkeletonPlaceholder/SkeletonPlaceholder.js +15 -24
  251. package/es/components/SkeletonText/SkeletonText.js +67 -81
  252. package/es/components/SkeletonText/index.js +12 -4
  253. package/es/components/Slider/Slider.Skeleton.js +68 -91
  254. package/es/components/Slider/Slider.js +864 -1315
  255. package/es/components/Slider/SliderHandles.js +73 -66
  256. package/es/components/Stack/HStack.js +19 -11
  257. package/es/components/Stack/Stack.js +56 -80
  258. package/es/components/Stack/VStack.js +19 -11
  259. package/es/components/StructuredList/StructuredList.Skeleton.js +55 -48
  260. package/es/components/StructuredList/StructuredList.js +178 -317
  261. package/es/components/Switch/IconSwitch.js +99 -145
  262. package/es/components/Switch/Switch.js +66 -99
  263. package/es/components/TabContent/TabContent.js +28 -34
  264. package/es/components/Tabs/Tabs.Skeleton.js +41 -36
  265. package/es/components/Tabs/Tabs.js +732 -1147
  266. package/es/components/Tabs/usePressable.js +97 -112
  267. package/es/components/Tag/DismissibleTag.js +119 -156
  268. package/es/components/Tag/OperationalTag.js +91 -111
  269. package/es/components/Tag/SelectableTag.js +94 -129
  270. package/es/components/Tag/Tag.Skeleton.js +26 -30
  271. package/es/components/Tag/Tag.js +152 -200
  272. package/es/components/Tag/isEllipsisActive.js +13 -8
  273. package/es/components/Text/Text.js +66 -79
  274. package/es/components/Text/TextDirection.js +36 -37
  275. package/es/components/Text/TextDirectionContext.js +14 -8
  276. package/es/components/Text/createTextComponent.js +21 -20
  277. package/es/components/TextArea/TextArea.Skeleton.js +25 -29
  278. package/es/components/TextArea/TextArea.js +315 -422
  279. package/es/components/TextArea/index.js +13 -5
  280. package/es/components/TextInput/ControlledPasswordInput.js +133 -198
  281. package/es/components/TextInput/PasswordInput.js +196 -303
  282. package/es/components/TextInput/TextInput.Skeleton.js +24 -28
  283. package/es/components/TextInput/TextInput.js +219 -317
  284. package/es/components/TextInput/index.js +13 -5
  285. package/es/components/TextInput/util.js +21 -25
  286. package/es/components/Theme/index.js +79 -95
  287. package/es/components/Tile/Tile.d.ts +2 -2
  288. package/es/components/Tile/Tile.js +394 -588
  289. package/es/components/TileGroup/TileGroup.js +70 -111
  290. package/es/components/TimePicker/TimePicker.d.ts +1 -1
  291. package/es/components/TimePicker/TimePicker.js +148 -247
  292. package/es/components/TimePickerSelect/TimePickerSelect.js +43 -58
  293. package/es/components/Toggle/Toggle.Skeleton.js +24 -22
  294. package/es/components/Toggle/Toggle.js +102 -171
  295. package/es/components/ToggleSmall/ToggleSmall.Skeleton.js +46 -51
  296. package/es/components/Toggletip/index.d.ts +2 -2
  297. package/es/components/Toggletip/index.js +170 -256
  298. package/es/components/Tooltip/DefinitionTooltip.js +98 -138
  299. package/es/components/Tooltip/Tooltip.js +188 -263
  300. package/es/components/TreeView/TreeContext.js +13 -5
  301. package/es/components/TreeView/TreeNode.js +361 -500
  302. package/es/components/TreeView/TreeView.js +164 -237
  303. package/es/components/UIShell/Content.js +23 -30
  304. package/es/components/UIShell/Header.js +25 -29
  305. package/es/components/UIShell/HeaderContainer.js +31 -40
  306. package/es/components/UIShell/HeaderGlobalAction.js +65 -90
  307. package/es/components/UIShell/HeaderGlobalBar.js +16 -9
  308. package/es/components/UIShell/HeaderMenu.js +141 -215
  309. package/es/components/UIShell/HeaderMenuButton.js +43 -66
  310. package/es/components/UIShell/HeaderMenuItem.js +49 -76
  311. package/es/components/UIShell/HeaderName.js +32 -44
  312. package/es/components/UIShell/HeaderNavigation.js +32 -37
  313. package/es/components/UIShell/HeaderPanel.js +74 -97
  314. package/es/components/UIShell/HeaderSideNavItems.js +27 -33
  315. package/es/components/UIShell/Link.js +29 -50
  316. package/es/components/UIShell/SideNav.js +132 -241
  317. package/es/components/UIShell/SideNavContext.js +21 -15
  318. package/es/components/UIShell/SideNavDetails.js +29 -34
  319. package/es/components/UIShell/SideNavDivider.js +21 -21
  320. package/es/components/UIShell/SideNavFooter.js +43 -52
  321. package/es/components/UIShell/SideNavHeader.js +26 -35
  322. package/es/components/UIShell/SideNavIcon.js +28 -33
  323. package/es/components/UIShell/SideNavItem.js +28 -33
  324. package/es/components/UIShell/SideNavItems.js +31 -40
  325. package/es/components/UIShell/SideNavLink.js +52 -79
  326. package/es/components/UIShell/SideNavLinkText.js +24 -25
  327. package/es/components/UIShell/SideNavMenu.js +102 -143
  328. package/es/components/UIShell/SideNavMenuItem.js +40 -52
  329. package/es/components/UIShell/SideNavSwitcher.js +59 -68
  330. package/es/components/UIShell/SkipToContent.js +28 -36
  331. package/es/components/UIShell/Switcher.js +69 -99
  332. package/es/components/UIShell/SwitcherDivider.js +16 -24
  333. package/es/components/UIShell/SwitcherItem.js +74 -114
  334. package/es/components/UnorderedList/UnorderedList.js +28 -37
  335. package/es/feature-flags.js +19 -10
  336. package/es/index.js +249 -242
  337. package/es/internal/FloatingMenu.js +246 -292
  338. package/es/internal/OptimizedResize.js +35 -46
  339. package/es/internal/Selection.js +99 -132
  340. package/es/internal/clamp.js +12 -4
  341. package/es/internal/defaultItemToString.js +15 -9
  342. package/es/internal/deprecateFieldOnObject.js +22 -14
  343. package/es/internal/environment.js +15 -7
  344. package/es/internal/getAnnouncement.js +16 -13
  345. package/es/internal/keyboard/keys.js +48 -48
  346. package/es/internal/keyboard/match.js +25 -42
  347. package/es/internal/keyboard/navigation.js +22 -27
  348. package/es/internal/noopFn.js +10 -2
  349. package/es/internal/useAttachedMenu.js +43 -51
  350. package/es/internal/useControllableState.js +43 -48
  351. package/es/internal/useDelayedState.js +30 -35
  352. package/es/internal/useEvent.js +39 -35
  353. package/es/internal/useId.js +51 -87
  354. package/es/internal/useIdPrefix.js +13 -5
  355. package/es/internal/useIsomorphicEffect.js +12 -4
  356. package/es/internal/useMatchMedia.js +29 -21
  357. package/es/internal/useMergedRefs.js +26 -22
  358. package/es/internal/useNoInteractiveChildren.js +70 -99
  359. package/es/internal/useNormalizedInputProps.js +47 -51
  360. package/es/internal/useOutsideClick.js +21 -24
  361. package/es/internal/useOverflowItems.js +89 -90
  362. package/es/internal/usePrefix.js +13 -5
  363. package/es/internal/usePresence.js +51 -54
  364. package/es/internal/usePresenceContext.js +35 -35
  365. package/es/internal/usePreviousValue.js +26 -18
  366. package/es/internal/useResizeObserver.js +57 -66
  367. package/es/internal/useSavedCallback.js +24 -17
  368. package/es/internal/utils.js +17 -9
  369. package/es/internal/warning.js +17 -22
  370. package/es/internal/wrapFocus.js +77 -98
  371. package/es/prop-types/AriaPropTypes.js +14 -6
  372. package/es/prop-types/deprecate.js +30 -27
  373. package/es/prop-types/deprecateComponent.js +17 -8
  374. package/es/prop-types/deprecateValuesWithin.js +18 -21
  375. package/es/prop-types/isRequiredOneOf.js +21 -24
  376. package/es/prop-types/requiredIfGivenPropIsTruthy.js +14 -14
  377. package/es/tools/events.js +17 -21
  378. package/es/tools/mapPopoverAlign.js +19 -18
  379. package/es/tools/mergeRefs.js +14 -17
  380. package/es/tools/setupGetInstanceId.js +16 -8
  381. package/es/tools/toggleClass.js +17 -9
  382. package/es/tools/wrapComponent.js +34 -39
  383. package/icons/index.d.ts +2 -1
  384. package/icons/index.esm.js +2 -2
  385. package/icons/index.js +7 -10
  386. package/lib/_virtual/_rolldown/runtime.js +50 -0
  387. package/lib/components/AILabel/index.d.ts +29 -2
  388. package/lib/components/AILabel/index.js +118 -171
  389. package/lib/components/AISkeleton/AISkeletonIcon.js +27 -31
  390. package/lib/components/AISkeleton/AISkeletonPlaceholder.js +29 -31
  391. package/lib/components/AISkeleton/AISkeletonText.js +30 -43
  392. package/lib/components/Accordion/Accordion.Skeleton.js +59 -84
  393. package/lib/components/Accordion/Accordion.js +47 -65
  394. package/lib/components/Accordion/AccordionItem.js +106 -160
  395. package/lib/components/Accordion/AccordionProvider.js +20 -17
  396. package/lib/components/AspectRatio/AspectRatio.js +45 -51
  397. package/lib/components/BadgeIndicator/index.js +33 -39
  398. package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +43 -55
  399. package/lib/components/Breadcrumb/Breadcrumb.js +43 -55
  400. package/lib/components/Breadcrumb/BreadcrumbItem.js +84 -87
  401. package/lib/components/Button/Button.Skeleton.js +53 -63
  402. package/lib/components/Button/Button.d.ts +1 -1
  403. package/lib/components/Button/Button.js +149 -244
  404. package/lib/components/Button/ButtonBase.js +85 -108
  405. package/lib/components/Button/index.js +13 -15
  406. package/lib/components/ButtonSet/ButtonSet.js +78 -102
  407. package/lib/components/ButtonSet/index.js +12 -9
  408. package/lib/components/ChatButton/ChatButton.Skeleton.js +31 -31
  409. package/lib/components/ChatButton/ChatButton.js +68 -83
  410. package/lib/components/Checkbox/Checkbox.Skeleton.js +30 -30
  411. package/lib/components/Checkbox/Checkbox.js +119 -198
  412. package/lib/components/Checkbox/index.js +13 -11
  413. package/lib/components/CheckboxGroup/CheckboxGroup.js +104 -152
  414. package/lib/components/ClassPrefix/index.js +24 -19
  415. package/lib/components/CodeSnippet/CodeSnippet.Skeleton.js +49 -47
  416. package/lib/components/CodeSnippet/CodeSnippet.js +215 -303
  417. package/lib/components/ComboBox/ComboBox.js +626 -974
  418. package/lib/components/ComboBox/index.js +12 -9
  419. package/lib/components/ComboButton/index.js +176 -210
  420. package/lib/components/ComposedModal/ComposedModal.js +315 -454
  421. package/lib/components/ComposedModal/ComposedModalPresence.js +49 -44
  422. package/lib/components/ComposedModal/ModalFooter.js +131 -209
  423. package/lib/components/ComposedModal/ModalHeader.js +75 -103
  424. package/lib/components/ComposedModal/useComposedModalState.js +22 -17
  425. package/lib/components/ContainedList/ContainedList.js +77 -106
  426. package/lib/components/ContainedList/ContainedListItem/ContainedListItem.js +59 -71
  427. package/lib/components/ContainedList/ContainedListItem/index.js +12 -9
  428. package/lib/components/ContainedList/index.js +18 -15
  429. package/lib/components/ContentSwitcher/ContentSwitcher.js +112 -142
  430. package/lib/components/ContextMenu/useContextMenu.js +42 -40
  431. package/lib/components/Copy/Copy.js +101 -121
  432. package/lib/components/Copy/index.js +12 -9
  433. package/lib/components/CopyButton/CopyButton.js +85 -98
  434. package/lib/components/CopyButton/index.js +12 -9
  435. package/lib/components/DangerButton/DangerButton.js +19 -13
  436. package/lib/components/DataTable/DataTable.d.ts +11 -11
  437. package/lib/components/DataTable/DataTable.js +474 -655
  438. package/lib/components/DataTable/Table.js +115 -161
  439. package/lib/components/DataTable/TableActionList.js +15 -11
  440. package/lib/components/DataTable/TableBatchAction.js +28 -38
  441. package/lib/components/DataTable/TableBatchActions.js +82 -117
  442. package/lib/components/DataTable/TableBody.js +29 -23
  443. package/lib/components/DataTable/TableCell.js +35 -50
  444. package/lib/components/DataTable/TableContainer.js +79 -86
  445. package/lib/components/DataTable/TableContext.js +15 -8
  446. package/lib/components/DataTable/TableDecoratorRow.js +34 -40
  447. package/lib/components/DataTable/TableExpandHeader.js +57 -94
  448. package/lib/components/DataTable/TableExpandRow.js +86 -123
  449. package/lib/components/DataTable/TableExpandedRow.js +49 -55
  450. package/lib/components/DataTable/TableHead.js +8 -10
  451. package/lib/components/DataTable/TableHeader.js +142 -185
  452. package/lib/components/DataTable/TableRow.d.ts +1 -1
  453. package/lib/components/DataTable/TableRow.js +46 -80
  454. package/lib/components/DataTable/TableSelectAll.js +46 -74
  455. package/lib/components/DataTable/TableSelectRow.js +67 -102
  456. package/lib/components/DataTable/TableSlugRow.js +39 -47
  457. package/lib/components/DataTable/TableToolbar.js +37 -49
  458. package/lib/components/DataTable/TableToolbarAction.js +28 -24
  459. package/lib/components/DataTable/TableToolbarContent.js +15 -11
  460. package/lib/components/DataTable/TableToolbarMenu.js +39 -50
  461. package/lib/components/DataTable/TableToolbarSearch.js +101 -191
  462. package/lib/components/DataTable/state/getDerivedStateFromProps.js +38 -47
  463. package/lib/components/DataTable/state/sortStates.js +11 -10
  464. package/lib/components/DataTable/state/sorting.js +54 -76
  465. package/lib/components/DataTable/tools/cells.js +15 -8
  466. package/lib/components/DataTable/tools/denormalize.js +27 -22
  467. package/lib/components/DataTable/tools/filter.js +21 -23
  468. package/lib/components/DataTable/tools/normalize.js +57 -76
  469. package/lib/components/DataTable/tools/sorting.js +50 -75
  470. package/lib/components/DataTableSkeleton/DataTableSkeleton.js +70 -98
  471. package/lib/components/DatePicker/DatePicker.Skeleton.js +48 -56
  472. package/lib/components/DatePicker/DatePicker.d.ts +4 -2
  473. package/lib/components/DatePicker/DatePicker.js +491 -753
  474. package/lib/components/DatePicker/DatePickerLocales.js +75 -127
  475. package/lib/components/DatePicker/index.js +13 -11
  476. package/lib/components/DatePicker/plugins/appendToPlugin.js +31 -46
  477. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +127 -175
  478. package/lib/components/DatePicker/plugins/rangePlugin.d.ts +1 -1
  479. package/lib/components/DatePicker/plugins/rangePlugin.js +42 -49
  480. package/lib/components/DatePicker/utils.d.ts +7 -0
  481. package/lib/components/DatePicker/utils.js +19 -0
  482. package/lib/components/DatePickerInput/DatePickerInput.js +183 -293
  483. package/lib/components/DatePickerInput/index.js +12 -9
  484. package/lib/components/Dialog/Dialog.js +307 -576
  485. package/lib/components/Dialog/index.js +21 -13
  486. package/lib/components/Dropdown/Dropdown.Skeleton.js +30 -43
  487. package/lib/components/Dropdown/Dropdown.js +348 -539
  488. package/lib/components/Dropdown/index.js +13 -11
  489. package/lib/components/ErrorBoundary/ErrorBoundary.js +39 -62
  490. package/lib/components/ErrorBoundary/ErrorBoundaryContext.js +15 -11
  491. package/lib/components/ExpandableSearch/ExpandableSearch.js +63 -73
  492. package/lib/components/ExpandableSearch/index.js +12 -9
  493. package/lib/components/FeatureFlags/index.d.ts +11 -2
  494. package/lib/components/FeatureFlags/index.js +82 -79
  495. package/lib/components/FileUploader/FileUploader.Skeleton.js +39 -35
  496. package/lib/components/FileUploader/FileUploader.js +273 -347
  497. package/lib/components/FileUploader/FileUploaderButton.js +114 -164
  498. package/lib/components/FileUploader/FileUploaderDropContainer.js +148 -225
  499. package/lib/components/FileUploader/FileUploaderItem.js +142 -161
  500. package/lib/components/FileUploader/Filename.d.ts +1 -1
  501. package/lib/components/FileUploader/Filename.js +56 -76
  502. package/lib/components/FluidComboBox/FluidComboBox.Skeleton.js +30 -32
  503. package/lib/components/FluidComboBox/FluidComboBox.js +58 -109
  504. package/lib/components/FluidDatePicker/FluidDatePicker.Skeleton.js +60 -57
  505. package/lib/components/FluidDatePicker/FluidDatePicker.js +50 -72
  506. package/lib/components/FluidDatePickerInput/FluidDatePickerInput.js +25 -20
  507. package/lib/components/FluidDropdown/FluidDropdown.Skeleton.js +30 -32
  508. package/lib/components/FluidDropdown/FluidDropdown.js +59 -115
  509. package/lib/components/FluidForm/FluidForm.js +33 -35
  510. package/lib/components/FluidForm/FormContext.js +13 -8
  511. package/lib/components/FluidMultiSelect/FluidMultiSelect.Skeleton.js +30 -32
  512. package/lib/components/FluidMultiSelect/FluidMultiSelect.js +71 -201
  513. package/lib/components/FluidNumberInput/FluidNumberInput.Skeleton.js +31 -34
  514. package/lib/components/FluidNumberInput/FluidNumberInput.js +67 -151
  515. package/lib/components/FluidSearch/FluidSearch.Skeleton.js +31 -34
  516. package/lib/components/FluidSearch/FluidSearch.js +45 -88
  517. package/lib/components/FluidSelect/FluidSelect.Skeleton.js +30 -32
  518. package/lib/components/FluidSelect/FluidSelect.js +44 -80
  519. package/lib/components/FluidSelect/index.js +13 -11
  520. package/lib/components/FluidTextArea/FluidTextArea.Skeleton.js +31 -34
  521. package/lib/components/FluidTextArea/FluidTextArea.js +52 -116
  522. package/lib/components/FluidTextInput/FluidPasswordInput.js +48 -103
  523. package/lib/components/FluidTextInput/FluidTextInput.Skeleton.js +31 -34
  524. package/lib/components/FluidTextInput/FluidTextInput.js +53 -108
  525. package/lib/components/FluidTextInput/index.js +14 -13
  526. package/lib/components/FluidTimePicker/FluidTimePicker.Skeleton.js +34 -37
  527. package/lib/components/FluidTimePicker/FluidTimePicker.js +72 -119
  528. package/lib/components/FluidTimePickerSelect/FluidTimePickerSelect.js +31 -51
  529. package/lib/components/Form/Form.js +27 -29
  530. package/lib/components/FormGroup/FormGroup.js +49 -71
  531. package/lib/components/FormItem/FormItem.js +27 -29
  532. package/lib/components/FormLabel/FormLabel.js +32 -38
  533. package/lib/components/Grid/CSSGrid.d.ts +1 -1
  534. package/lib/components/Grid/CSSGrid.js +89 -129
  535. package/lib/components/Grid/Column.js +196 -328
  536. package/lib/components/Grid/ColumnHang.js +32 -38
  537. package/lib/components/Grid/FlexGrid.js +44 -62
  538. package/lib/components/Grid/Grid.js +32 -44
  539. package/lib/components/Grid/GridContext.js +39 -44
  540. package/lib/components/Grid/Row.js +35 -53
  541. package/lib/components/Heading/index.js +39 -53
  542. package/lib/components/Icon/Icon.Skeleton.js +25 -23
  543. package/lib/components/IconButton/index.js +121 -180
  544. package/lib/components/IconIndicator/index.d.ts +1 -1
  545. package/lib/components/IconIndicator/index.js +63 -63
  546. package/lib/components/IdPrefix/index.js +24 -19
  547. package/lib/components/InlineCheckbox/InlineCheckbox.js +72 -117
  548. package/lib/components/InlineCheckbox/index.js +12 -9
  549. package/lib/components/InlineLoading/InlineLoading.js +87 -104
  550. package/lib/components/InlineLoading/index.js +12 -9
  551. package/lib/components/Layer/LayerContext.js +14 -6
  552. package/lib/components/Layer/LayerLevel.js +20 -6
  553. package/lib/components/Layer/index.js +58 -68
  554. package/lib/components/Layout/index.js +81 -111
  555. package/lib/components/LayoutDirection/LayoutDirection.d.ts +1 -1
  556. package/lib/components/LayoutDirection/LayoutDirection.js +36 -40
  557. package/lib/components/LayoutDirection/LayoutDirectionContext.js +14 -8
  558. package/lib/components/LayoutDirection/useLayoutDirection.js +16 -9
  559. package/lib/components/Link/Link.js +67 -112
  560. package/lib/components/Link/index.js +12 -9
  561. package/lib/components/ListBox/ListBox.js +82 -130
  562. package/lib/components/ListBox/ListBoxField.js +33 -47
  563. package/lib/components/ListBox/ListBoxMenu.js +39 -46
  564. package/lib/components/ListBox/ListBoxMenuIcon.js +43 -44
  565. package/lib/components/ListBox/ListBoxMenuItem.js +71 -92
  566. package/lib/components/ListBox/ListBoxPropTypes.js +21 -9
  567. package/lib/components/ListBox/ListBoxSelection.js +75 -100
  568. package/lib/components/ListBox/index.js +17 -21
  569. package/lib/components/ListBox/next/ListBoxSelection.js +83 -121
  570. package/lib/components/ListBox/next/ListBoxTrigger.js +48 -52
  571. package/lib/components/ListItem/ListItem.js +29 -32
  572. package/lib/components/Loading/Loading.js +68 -77
  573. package/lib/components/Loading/index.js +12 -9
  574. package/lib/components/Menu/Menu.js +224 -365
  575. package/lib/components/Menu/MenuContext.d.ts +1 -1
  576. package/lib/components/Menu/MenuContext.js +42 -40
  577. package/lib/components/Menu/MenuItem.js +286 -415
  578. package/lib/components/MenuButton/index.js +138 -197
  579. package/lib/components/Modal/Modal.js +504 -665
  580. package/lib/components/Modal/ModalPresence.js +41 -39
  581. package/lib/components/Modal/index.js +13 -10
  582. package/lib/components/ModalWrapper/ModalWrapper.d.ts +2 -2
  583. package/lib/components/ModalWrapper/ModalWrapper.js +112 -134
  584. package/lib/components/MultiSelect/FilterableMultiSelect.js +611 -920
  585. package/lib/components/MultiSelect/MultiSelect.js +459 -718
  586. package/lib/components/MultiSelect/MultiSelectPropTypes.js +15 -32
  587. package/lib/components/MultiSelect/filter.js +14 -10
  588. package/lib/components/MultiSelect/tools/sorting.js +21 -35
  589. package/lib/components/Notification/Notification.js +514 -787
  590. package/lib/components/NumberInput/NumberFormatPropTypes.js +72 -33
  591. package/lib/components/NumberInput/NumberInput.Skeleton.js +33 -37
  592. package/lib/components/NumberInput/NumberInput.js +571 -950
  593. package/lib/components/OrderedList/OrderedList.js +35 -48
  594. package/lib/components/OverflowMenu/OverflowMenu.js +341 -454
  595. package/lib/components/OverflowMenu/index.js +27 -21
  596. package/lib/components/OverflowMenu/next/index.js +158 -188
  597. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +104 -164
  598. package/lib/components/OverflowMenuItem/index.js +12 -9
  599. package/lib/components/OverflowMenuV2/index.js +25 -15
  600. package/lib/components/PageHeader/PageHeader.js +301 -444
  601. package/lib/components/PageHeader/index.js +27 -19
  602. package/lib/components/Pagination/Pagination.Skeleton.js +38 -37
  603. package/lib/components/Pagination/Pagination.d.ts +1 -1
  604. package/lib/components/Pagination/Pagination.js +256 -360
  605. package/lib/components/Pagination/experimental/PageSelector.js +48 -58
  606. package/lib/components/Pagination/experimental/Pagination-story.d.ts +114 -0
  607. package/lib/components/Pagination/experimental/Pagination.js +148 -200
  608. package/lib/components/PaginationNav/PaginationNav.js +324 -430
  609. package/lib/components/Popover/index.js +323 -440
  610. package/lib/components/PrimaryButton/PrimaryButton.js +19 -13
  611. package/lib/components/ProgressBar/ProgressBar.js +121 -147
  612. package/lib/components/ProgressIndicator/ProgressIndicator.Skeleton.js +46 -43
  613. package/lib/components/ProgressIndicator/ProgressIndicator.js +150 -245
  614. package/lib/components/RadioButton/RadioButton.Skeleton.js +27 -27
  615. package/lib/components/RadioButton/RadioButton.js +105 -178
  616. package/lib/components/RadioButton/index.js +12 -9
  617. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +139 -211
  618. package/lib/components/RadioTile/RadioTile.js +108 -172
  619. package/lib/components/RadioTile/index.js +12 -9
  620. package/lib/components/Search/Search.Skeleton.js +32 -38
  621. package/lib/components/Search/Search.js +185 -281
  622. package/lib/components/Search/index.js +13 -11
  623. package/lib/components/Search/utils.js +11 -4
  624. package/lib/components/SecondaryButton/SecondaryButton.js +19 -13
  625. package/lib/components/Select/Select.Skeleton.js +31 -35
  626. package/lib/components/Select/Select.js +182 -261
  627. package/lib/components/Select/index.js +13 -11
  628. package/lib/components/SelectItem/SelectItem.js +37 -52
  629. package/lib/components/SelectItem/index.js +12 -9
  630. package/lib/components/SelectItemGroup/SelectItemGroup.js +31 -41
  631. package/lib/components/ShapeIndicator/index.d.ts +1 -1
  632. package/lib/components/ShapeIndicator/index.js +78 -83
  633. package/lib/components/SkeletonIcon/SkeletonIcon.js +25 -28
  634. package/lib/components/SkeletonPlaceholder/SkeletonPlaceholder.js +25 -28
  635. package/lib/components/SkeletonText/SkeletonText.js +71 -85
  636. package/lib/components/SkeletonText/index.js +12 -9
  637. package/lib/components/Slider/Slider.Skeleton.js +72 -95
  638. package/lib/components/Slider/Slider.js +868 -1319
  639. package/lib/components/Slider/SliderHandles.js +75 -68
  640. package/lib/components/Stack/HStack.js +22 -14
  641. package/lib/components/Stack/Stack.js +60 -82
  642. package/lib/components/Stack/VStack.js +22 -14
  643. package/lib/components/StructuredList/StructuredList.Skeleton.js +59 -52
  644. package/lib/components/StructuredList/StructuredList.js +182 -319
  645. package/lib/components/Switch/IconSwitch.js +103 -149
  646. package/lib/components/Switch/Switch.js +70 -103
  647. package/lib/components/TabContent/TabContent.js +32 -38
  648. package/lib/components/Tabs/Tabs.Skeleton.js +45 -41
  649. package/lib/components/Tabs/Tabs.js +738 -1151
  650. package/lib/components/Tabs/usePressable.js +98 -114
  651. package/lib/components/Tag/DismissibleTag.js +123 -160
  652. package/lib/components/Tag/OperationalTag.js +95 -115
  653. package/lib/components/Tag/SelectableTag.js +98 -133
  654. package/lib/components/Tag/Tag.Skeleton.js +30 -32
  655. package/lib/components/Tag/Tag.js +156 -204
  656. package/lib/components/Tag/isEllipsisActive.js +13 -9
  657. package/lib/components/Text/Text.js +69 -81
  658. package/lib/components/Text/TextDirection.js +39 -39
  659. package/lib/components/Text/TextDirectionContext.js +15 -10
  660. package/lib/components/Text/createTextComponent.js +29 -22
  661. package/lib/components/TextArea/TextArea.Skeleton.js +29 -34
  662. package/lib/components/TextArea/TextArea.js +319 -426
  663. package/lib/components/TextArea/index.js +13 -11
  664. package/lib/components/TextInput/ControlledPasswordInput.js +137 -202
  665. package/lib/components/TextInput/PasswordInput.js +200 -307
  666. package/lib/components/TextInput/TextInput.Skeleton.js +28 -33
  667. package/lib/components/TextInput/TextInput.js +223 -321
  668. package/lib/components/TextInput/index.js +13 -11
  669. package/lib/components/TextInput/util.js +21 -26
  670. package/lib/components/Theme/index.js +83 -97
  671. package/lib/components/Tile/Tile.d.ts +2 -2
  672. package/lib/components/Tile/Tile.js +398 -590
  673. package/lib/components/TileGroup/TileGroup.js +73 -113
  674. package/lib/components/TimePicker/TimePicker.d.ts +1 -1
  675. package/lib/components/TimePicker/TimePicker.js +152 -251
  676. package/lib/components/TimePickerSelect/TimePickerSelect.js +47 -62
  677. package/lib/components/Toggle/Toggle.Skeleton.js +28 -24
  678. package/lib/components/Toggle/Toggle.js +106 -176
  679. package/lib/components/ToggleSmall/ToggleSmall.Skeleton.js +50 -53
  680. package/lib/components/Toggletip/index.d.ts +2 -2
  681. package/lib/components/Toggletip/index.js +174 -258
  682. package/lib/components/Tooltip/DefinitionTooltip.js +102 -140
  683. package/lib/components/Tooltip/Tooltip.js +192 -265
  684. package/lib/components/TreeView/TreeContext.js +14 -7
  685. package/lib/components/TreeView/TreeNode.js +365 -504
  686. package/lib/components/TreeView/TreeView.js +169 -242
  687. package/lib/components/UIShell/Content.js +27 -34
  688. package/lib/components/UIShell/Header.js +29 -33
  689. package/lib/components/UIShell/HeaderContainer.js +34 -44
  690. package/lib/components/UIShell/HeaderGlobalAction.js +69 -94
  691. package/lib/components/UIShell/HeaderGlobalBar.js +17 -14
  692. package/lib/components/UIShell/HeaderMenu.js +146 -221
  693. package/lib/components/UIShell/HeaderMenuButton.js +47 -70
  694. package/lib/components/UIShell/HeaderMenuItem.js +53 -80
  695. package/lib/components/UIShell/HeaderName.js +36 -48
  696. package/lib/components/UIShell/HeaderNavigation.js +36 -41
  697. package/lib/components/UIShell/HeaderPanel.js +78 -101
  698. package/lib/components/UIShell/HeaderSideNavItems.js +31 -37
  699. package/lib/components/UIShell/Link.js +32 -54
  700. package/lib/components/UIShell/SideNav.js +136 -245
  701. package/lib/components/UIShell/SideNavContext.js +23 -17
  702. package/lib/components/UIShell/SideNavDetails.js +33 -38
  703. package/lib/components/UIShell/SideNavDivider.js +25 -25
  704. package/lib/components/UIShell/SideNavFooter.js +47 -56
  705. package/lib/components/UIShell/SideNavHeader.js +30 -39
  706. package/lib/components/UIShell/SideNavIcon.js +32 -37
  707. package/lib/components/UIShell/SideNavItem.js +32 -37
  708. package/lib/components/UIShell/SideNavItems.js +35 -44
  709. package/lib/components/UIShell/SideNavLink.js +56 -83
  710. package/lib/components/UIShell/SideNavLinkText.js +28 -29
  711. package/lib/components/UIShell/SideNavMenu.js +106 -148
  712. package/lib/components/UIShell/SideNavMenuItem.js +44 -56
  713. package/lib/components/UIShell/SideNavSwitcher.js +63 -72
  714. package/lib/components/UIShell/SkipToContent.js +32 -40
  715. package/lib/components/UIShell/Switcher.js +73 -103
  716. package/lib/components/UIShell/SwitcherDivider.js +26 -28
  717. package/lib/components/UIShell/SwitcherItem.js +78 -118
  718. package/lib/components/UnorderedList/UnorderedList.js +32 -41
  719. package/lib/feature-flags.js +21 -13
  720. package/lib/index.js +622 -602
  721. package/lib/internal/FloatingMenu.js +249 -296
  722. package/lib/internal/OptimizedResize.js +35 -47
  723. package/lib/internal/Selection.js +102 -134
  724. package/lib/internal/clamp.js +12 -5
  725. package/lib/internal/defaultItemToString.js +15 -10
  726. package/lib/internal/deprecateFieldOnObject.js +23 -16
  727. package/lib/internal/environment.js +15 -8
  728. package/lib/internal/getAnnouncement.js +16 -14
  729. package/lib/internal/keyboard/keys.js +48 -49
  730. package/lib/internal/keyboard/match.js +25 -43
  731. package/lib/internal/keyboard/navigation.js +22 -29
  732. package/lib/internal/noopFn.js +10 -3
  733. package/lib/internal/useAttachedMenu.js +44 -53
  734. package/lib/internal/useControllableState.js +44 -50
  735. package/lib/internal/useDelayedState.js +31 -37
  736. package/lib/internal/useEvent.js +40 -37
  737. package/lib/internal/useId.js +54 -91
  738. package/lib/internal/useIdPrefix.js +15 -7
  739. package/lib/internal/useIsomorphicEffect.js +13 -8
  740. package/lib/internal/useMatchMedia.js +30 -23
  741. package/lib/internal/useMergedRefs.js +27 -24
  742. package/lib/internal/useNoInteractiveChildren.js +73 -101
  743. package/lib/internal/useNormalizedInputProps.js +55 -53
  744. package/lib/internal/useOutsideClick.js +22 -26
  745. package/lib/internal/useOverflowItems.js +90 -94
  746. package/lib/internal/usePrefix.js +15 -7
  747. package/lib/internal/usePresence.js +52 -56
  748. package/lib/internal/usePresenceContext.js +36 -37
  749. package/lib/internal/usePreviousValue.js +27 -20
  750. package/lib/internal/useResizeObserver.js +58 -68
  751. package/lib/internal/useSavedCallback.js +25 -19
  752. package/lib/internal/utils.js +18 -11
  753. package/lib/internal/warning.js +24 -23
  754. package/lib/internal/wrapFocus.js +78 -100
  755. package/lib/prop-types/AriaPropTypes.js +17 -9
  756. package/lib/prop-types/deprecate.js +30 -29
  757. package/lib/prop-types/deprecateComponent.js +17 -10
  758. package/lib/prop-types/deprecateValuesWithin.js +18 -23
  759. package/lib/prop-types/isRequiredOneOf.js +21 -25
  760. package/lib/prop-types/requiredIfGivenPropIsTruthy.js +14 -15
  761. package/lib/tools/events.js +17 -22
  762. package/lib/tools/mapPopoverAlign.js +19 -19
  763. package/lib/tools/mergeRefs.js +14 -18
  764. package/lib/tools/setupGetInstanceId.js +16 -9
  765. package/lib/tools/toggleClass.js +17 -10
  766. package/lib/tools/wrapComponent.js +38 -43
  767. package/package.json +10 -16
  768. package/es/_virtual/_rollupPluginBabelHelpers.js +0 -40
  769. package/es/components/DataTable/stories/examples/TableToolbarFilter.d.ts +0 -54
  770. package/es/node_modules/es-toolkit/dist/compat/function/debounce.js +0 -55
  771. package/es/node_modules/es-toolkit/dist/compat/function/throttle.js +0 -23
  772. package/es/node_modules/es-toolkit/dist/function/debounce.js +0 -70
  773. package/lib/_virtual/_rollupPluginBabelHelpers.js +0 -45
  774. package/lib/components/DataTable/stories/examples/TableToolbarFilter.d.ts +0 -54
  775. package/lib/node_modules/es-toolkit/dist/compat/function/debounce.js +0 -57
  776. package/lib/node_modules/es-toolkit/dist/compat/function/throttle.js +0 -25
  777. package/lib/node_modules/es-toolkit/dist/function/debounce.js +0 -72
@@ -1,989 +1,641 @@
1
1
  /**
2
- * Copyright IBM Corp. 2016, 2023
2
+ * Copyright IBM Corp. 2016, 2026
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- 'use strict';
8
+ const require_runtime = require('../../_virtual/_rolldown/runtime.js');
9
+ const require_usePrefix = require('../../internal/usePrefix.js');
10
+ const require_Text = require('../Text/Text.js');
11
+ const require_keys = require('../../internal/keyboard/keys.js');
12
+ const require_match = require('../../internal/keyboard/match.js');
13
+ const require_useId = require('../../internal/useId.js');
14
+ const require_deprecate = require('../../prop-types/deprecate.js');
15
+ const require_index = require('../FeatureFlags/index.js');
16
+ const require_index$1 = require('../AILabel/index.js');
17
+ const require_defaultItemToString = require('../../internal/defaultItemToString.js');
18
+ const require_utils = require('../../internal/utils.js');
19
+ const require_ListBoxPropTypes = require('../ListBox/ListBoxPropTypes.js');
20
+ const require_FormContext = require('../FluidForm/FormContext.js');
21
+ const require_index$2 = require('../ListBox/index.js');
22
+ const require_ListBoxSelection = require('../ListBox/next/ListBoxSelection.js');
23
+ const require_ListBoxTrigger = require('../ListBox/next/ListBoxTrigger.js');
24
+ const require_mergeRefs = require('../../tools/mergeRefs.js');
25
+ const require_useNormalizedInputProps = require('../../internal/useNormalizedInputProps.js');
26
+ let classnames = require("classnames");
27
+ classnames = require_runtime.__toESM(classnames);
28
+ let react = require("react");
29
+ react = require_runtime.__toESM(react);
30
+ let prop_types = require("prop-types");
31
+ prop_types = require_runtime.__toESM(prop_types);
32
+ let react_jsx_runtime = require("react/jsx-runtime");
33
+ let _carbon_icons_react = require("@carbon/icons-react");
34
+ let _floating_ui_react = require("@floating-ui/react");
35
+ let downshift = require("downshift");
36
+ let react_fast_compare = require("react-fast-compare");
37
+ react_fast_compare = require_runtime.__toESM(react_fast_compare);
9
38
 
10
- Object.defineProperty(exports, '__esModule', { value: true });
11
-
12
- var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
- var cx = require('classnames');
14
- var Downshift = require('downshift');
15
- var PropTypes = require('prop-types');
16
- var React = require('react');
17
- var Text = require('../Text/Text.js');
18
- require('../Text/TextDirection.js');
19
- var iconsReact = require('@carbon/icons-react');
20
- var isEqual = require('react-fast-compare');
21
- var index$2 = require('../ListBox/index.js');
22
- var ListBoxSelection = require('../ListBox/next/ListBoxSelection.js');
23
- var ListBoxTrigger = require('../ListBox/next/ListBoxTrigger.js');
24
- var keys = require('../../internal/keyboard/keys.js');
25
- var match = require('../../internal/keyboard/match.js');
26
- var useId = require('../../internal/useId.js');
27
- var mergeRefs = require('../../tools/mergeRefs.js');
28
- var deprecate = require('../../prop-types/deprecate.js');
29
- var usePrefix = require('../../internal/usePrefix.js');
30
- var useNormalizedInputProps = require('../../internal/useNormalizedInputProps.js');
31
- require('../FluidForm/FluidForm.js');
32
- var FormContext = require('../FluidForm/FormContext.js');
33
- var react = require('@floating-ui/react');
34
- var index = require('../FeatureFlags/index.js');
35
- var index$1 = require('../AILabel/index.js');
36
- var defaultItemToString = require('../../internal/defaultItemToString.js');
37
- var utils = require('../../internal/utils.js');
38
- var ListBoxPropTypes = require('../ListBox/ListBoxPropTypes.js');
39
-
40
- const {
41
- InputBlur,
42
- InputKeyDownEnter,
43
- FunctionToggleMenu,
44
- ToggleButtonClick,
45
- ItemMouseMove,
46
- InputKeyDownArrowUp,
47
- InputKeyDownArrowDown,
48
- MenuMouseLeave,
49
- ItemClick,
50
- FunctionSelectItem
51
- } = Downshift.useCombobox.stateChangeTypes;
39
+ //#region src/components/ComboBox/ComboBox.tsx
40
+ /**
41
+ * Copyright IBM Corp. 2016, 2026
42
+ *
43
+ * This source code is licensed under the Apache-2.0 license found in the
44
+ * LICENSE file in the root directory of this source tree.
45
+ */
46
+ const { InputBlur, InputKeyDownEnter, FunctionToggleMenu, ToggleButtonClick, ItemMouseMove, InputKeyDownArrowUp, InputKeyDownArrowDown, MenuMouseLeave, ItemClick, FunctionSelectItem } = downshift.useCombobox.stateChangeTypes;
52
47
  const defaultShouldFilterItem = () => true;
53
- const autocompleteCustomFilter = ({
54
- item,
55
- inputValue
56
- }) => {
57
- if (inputValue === null || inputValue === '') {
58
- return true; // Show all items if there's no input
59
- }
60
- const lowercaseItem = item.toLowerCase();
61
- const lowercaseInput = inputValue.toLowerCase();
62
- return lowercaseItem.startsWith(lowercaseInput);
48
+ const isDisabledItem = (item) => item !== null && typeof item === "object" && "disabled" in item && Boolean(item.disabled);
49
+ const autocompleteCustomFilter = ({ item, inputValue }) => {
50
+ if (inputValue === null || inputValue === "") return true;
51
+ const lowercaseItem = item.toLowerCase();
52
+ const lowercaseInput = inputValue.toLowerCase();
53
+ return lowercaseItem.startsWith(lowercaseInput);
63
54
  };
64
- const getInputValue = ({
65
- initialSelectedItem,
66
- itemToString,
67
- selectedItem,
68
- prevSelectedItem
69
- }) => {
70
- // If there's a current selection (even if it's an object or string), use it.
71
- if (selectedItem !== null && typeof selectedItem !== 'undefined') {
72
- return itemToString(selectedItem);
73
- }
74
-
75
- // On the very first render (when no previous value exists), use
76
- // `initialSelectedItem`.
77
- if (typeof prevSelectedItem === 'undefined' && initialSelectedItem !== null && typeof initialSelectedItem !== 'undefined') {
78
- return itemToString(initialSelectedItem);
79
- }
80
-
81
- // Otherwise (i.e., after the user has cleared the selection), return an empty
82
- // string.
83
- return '';
55
+ const getInputValue = ({ initialSelectedItem, itemToString, selectedItem, prevSelectedItem }) => {
56
+ if (selectedItem !== null && typeof selectedItem !== "undefined") return itemToString(selectedItem);
57
+ if (typeof prevSelectedItem === "undefined" && initialSelectedItem !== null && typeof initialSelectedItem !== "undefined") return itemToString(initialSelectedItem);
58
+ return "";
84
59
  };
85
- const findHighlightedIndex = ({
86
- items,
87
- itemToString = defaultItemToString.defaultItemToString
88
- }, inputValue) => {
89
- if (!inputValue) {
90
- return -1;
91
- }
92
- const searchValue = inputValue.toLowerCase();
93
- for (let i = 0; i < items.length; i++) {
94
- const item = itemToString(items[i]).toLowerCase();
95
- if (!items[i]['disabled'] && item.indexOf(searchValue) !== -1) {
96
- return i;
97
- }
98
- }
99
- return -1;
60
+ const findHighlightedIndex = ({ items, itemToString = require_defaultItemToString.defaultItemToString }, inputValue) => {
61
+ if (!inputValue) return -1;
62
+ const searchValue = inputValue.toLowerCase();
63
+ for (let i = 0; i < items.length; i++) {
64
+ const item = itemToString(items[i]).toLowerCase();
65
+ if (!items[i]["disabled"] && item.indexOf(searchValue) !== -1) return i;
66
+ }
67
+ return -1;
100
68
  };
101
- const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
102
- const prevInputLengthRef = React.useRef(0);
103
- const inputRef = React.useRef(null);
104
- const {
105
- ['aria-label']: ariaLabel = 'Choose an item',
106
- ariaLabel: deprecatedAriaLabel,
107
- autoAlign = false,
108
- className: containerClassName,
109
- decorator,
110
- direction = 'bottom',
111
- disabled = false,
112
- downshiftActions,
113
- downshiftProps,
114
- helperText,
115
- id,
116
- initialSelectedItem,
117
- invalid,
118
- invalidText,
119
- items,
120
- itemToElement = null,
121
- itemToString = defaultItemToString.defaultItemToString,
122
- light,
123
- onChange,
124
- onInputChange,
125
- onToggleClick,
126
- placeholder,
127
- readOnly,
128
- selectedItem: selectedItemProp,
129
- shouldFilterItem = defaultShouldFilterItem,
130
- size,
131
- titleText,
132
- translateWithId,
133
- typeahead = false,
134
- warn,
135
- warnText,
136
- allowCustomValue = false,
137
- slug,
138
- inputProps,
139
- ...rest
140
- } = props;
141
- const enableFloatingStyles = index.useFeatureFlag('enable-v12-dynamic-floating-styles') || autoAlign;
142
- const {
143
- refs,
144
- floatingStyles,
145
- middlewareData
146
- } = react.useFloating(enableFloatingStyles ? {
147
- placement: direction,
148
- strategy: 'fixed',
149
- middleware: autoAlign ? [react.flip(), react.hide()] : undefined,
150
- whileElementsMounted: react.autoUpdate
151
- } : {});
152
- const referenceElement = refs?.reference?.current;
153
- const parentWidth = referenceElement instanceof HTMLElement ? referenceElement.clientWidth : undefined;
154
- React.useEffect(() => {
155
- if (enableFloatingStyles) {
156
- const updatedFloatingStyles = {
157
- ...floatingStyles,
158
- visibility: middlewareData.hide?.referenceHidden ? 'hidden' : 'visible'
159
- };
160
- Object.keys(updatedFloatingStyles).forEach(style => {
161
- if (refs.floating.current) {
162
- refs.floating.current.style[style] = updatedFloatingStyles[style];
163
- }
164
- });
165
- if (parentWidth && refs.floating.current) {
166
- refs.floating.current.style.width = parentWidth + 'px';
167
- }
168
- }
169
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
170
- }, [enableFloatingStyles, floatingStyles, refs.floating, parentWidth]);
171
- const [inputValue, setInputValue] = React.useState(getInputValue({
172
- initialSelectedItem,
173
- itemToString,
174
- selectedItem: selectedItemProp
175
- }));
176
- const [typeaheadText, setTypeaheadText] = React.useState('');
177
- React.useEffect(() => {
178
- if (typeahead) {
179
- if (inputValue.length >= prevInputLengthRef.current) {
180
- if (inputValue) {
181
- const filteredItems = items.filter(item => autocompleteCustomFilter({
182
- item: itemToString(item),
183
- inputValue: inputValue
184
- }));
185
- if (filteredItems.length > 0) {
186
- const suggestion = itemToString(filteredItems[0]);
187
- setTypeaheadText(suggestion.slice(inputValue.length));
188
- } else {
189
- setTypeaheadText('');
190
- }
191
- } else {
192
- setTypeaheadText('');
193
- }
194
- } else {
195
- setTypeaheadText('');
196
- }
197
- prevInputLengthRef.current = inputValue.length;
198
- }
199
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
200
- }, [typeahead, inputValue, items, itemToString, autocompleteCustomFilter]);
201
- const isManualClearingRef = React.useRef(false);
202
- const committedCustomValueRef = React.useRef('');
203
- const [isClearing, setIsClearing] = React.useState(false);
204
- const prefix = usePrefix.usePrefix();
205
- const {
206
- isFluid
207
- } = React.useContext(FormContext.FormContext);
208
- const textInput = React.useRef(null);
209
- const comboBoxInstanceId = useId.useId();
210
- const [isFocused, setIsFocused] = React.useState(false);
211
- const prevInputValue = React.useRef(inputValue);
212
- const prevSelectedItemProp = React.useRef(selectedItemProp);
213
- React.useEffect(() => {
214
- isManualClearingRef.current = isClearing;
215
-
216
- // Reset flag after render cycle
217
- if (isClearing) {
218
- setIsClearing(false);
219
- }
220
- }, [isClearing]);
221
-
222
- // fully controlled combobox: handle changes to selectedItemProp
223
- React.useEffect(() => {
224
- if (prevSelectedItemProp.current !== selectedItemProp) {
225
- const currentInputValue = getInputValue({
226
- initialSelectedItem,
227
- itemToString,
228
- selectedItem: selectedItemProp,
229
- prevSelectedItem: prevSelectedItemProp.current
230
- });
231
- // selectedItem has been updated externally, need to update state and call onChange
232
- if (inputValue !== currentInputValue) {
233
- setInputValue(currentInputValue);
234
- onChange({
235
- selectedItem: selectedItemProp,
236
- inputValue: currentInputValue
237
- });
238
- }
239
- prevSelectedItemProp.current = selectedItemProp;
240
- }
241
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
242
- }, [selectedItemProp]);
243
- const filterItems = (items, itemToString, inputValue) => items.filter(item => typeahead ? autocompleteCustomFilter({
244
- item: itemToString(item),
245
- inputValue
246
- }) : shouldFilterItem ? shouldFilterItem({
247
- item,
248
- itemToString,
249
- inputValue
250
- }) : defaultShouldFilterItem());
251
-
252
- // call onInputChange whenever inputValue is updated
253
- React.useEffect(() => {
254
- if (prevInputValue.current !== inputValue) {
255
- prevInputValue.current = inputValue;
256
- onInputChange?.(inputValue);
257
- }
258
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
259
- }, [inputValue]);
260
- const handleSelectionClear = () => {
261
- if (textInput?.current) {
262
- textInput.current.focus();
263
- }
264
- };
265
- const filteredItems = inputValue => filterItems(items, itemToString, inputValue || null);
266
- const indexToHighlight = inputValue => findHighlightedIndex({
267
- ...props,
268
- items: filteredItems(inputValue)
269
- }, inputValue);
270
- const stateReducer = React.useCallback((state, actionAndChanges) => {
271
- const {
272
- type,
273
- changes
274
- } = actionAndChanges;
275
- const {
276
- highlightedIndex
277
- } = changes;
278
- switch (type) {
279
- case InputBlur:
280
- {
281
- // If custom values are allowed, treat whatever the user typed as
282
- // the value.
283
- if (allowCustomValue && highlightedIndex === -1) {
284
- const inputValue = state.inputValue ?? '';
285
- const currentSelectedItem = typeof changes.selectedItem === 'undefined' ? state.selectedItem : changes.selectedItem;
286
- const isMatchingSelection = currentSelectedItem !== null && typeof currentSelectedItem !== 'undefined' && itemToString(currentSelectedItem) === inputValue && items.some(item => isEqual(item, currentSelectedItem));
287
- if (isMatchingSelection) {
288
- return changes;
289
- }
290
- const nextSelectedItem = inputValue === '' ? null : items.find(item => itemToString(item) === inputValue) ?? inputValue;
291
- const isCustomSelection = typeof nextSelectedItem === 'string' && nextSelectedItem !== '' && !items.some(item => isEqual(item, nextSelectedItem));
292
- if (!isEqual(currentSelectedItem, nextSelectedItem) && onChange) {
293
- onChange({
294
- selectedItem: nextSelectedItem,
295
- inputValue
296
- });
297
- committedCustomValueRef.current = isCustomSelection ? inputValue : '';
298
- }
299
- return {
300
- ...changes,
301
- selectedItem: nextSelectedItem
302
- };
303
- }
304
-
305
- // If a new item was selected, keep its label in the input.
306
- if (state.inputValue && highlightedIndex === -1 && changes.selectedItem) {
307
- return {
308
- ...changes,
309
- inputValue: itemToString(changes.selectedItem)
310
- };
311
- }
312
-
313
- // If custom values are not allowed, normalize any non-matching
314
- // text. If the input isn’t an exact item label, restore the
315
- // selected label if there is one, or clear it.
316
- if (!allowCustomValue) {
317
- const currentInput = state.inputValue ?? '';
318
- const hasExactMatch = !!currentInput && items.some(item => itemToString(item) === currentInput);
319
- if (!hasExactMatch) {
320
- const restoredInput = state.selectedItem !== null ? itemToString(state.selectedItem) : '';
321
- return {
322
- ...changes,
323
- inputValue: restoredInput
324
- };
325
- }
326
- }
327
- return changes;
328
- }
329
- case InputKeyDownEnter:
330
- if (!allowCustomValue) {
331
- if (state.highlightedIndex !== -1) {
332
- const filteredList = filterItems(items, itemToString, inputValue);
333
- const highlightedItem = filteredList[state.highlightedIndex];
334
-
335
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
336
- if (highlightedItem && !highlightedItem.disabled) {
337
- return {
338
- ...changes,
339
- selectedItem: highlightedItem,
340
- inputValue: itemToString(highlightedItem)
341
- };
342
- }
343
- } else {
344
- const autoIndex = indexToHighlight(inputValue);
345
- if (autoIndex !== -1) {
346
- const matchingItem = items[autoIndex];
347
-
348
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
349
- if (matchingItem && !matchingItem.disabled) {
350
- return {
351
- ...changes,
352
- selectedItem: matchingItem,
353
- inputValue: itemToString(matchingItem)
354
- };
355
- }
356
- }
357
-
358
- // If no matching item is found and there is an existing
359
- // selection, clear the selection.
360
- if (state.selectedItem !== null) {
361
- return {
362
- ...changes,
363
- selectedItem: null,
364
- inputValue
365
- };
366
- }
367
- }
368
- }
369
-
370
- // For `allowCustomValue` or if no matching item is found, keep the
371
- // menu open.
372
- return {
373
- ...changes,
374
- isOpen: true
375
- };
376
- case FunctionToggleMenu:
377
- case ToggleButtonClick:
378
- // When closing the menu, apply the same normalization as blur.
379
- if (state.isOpen && !changes.isOpen && !allowCustomValue) {
380
- const currentInput = state.inputValue ?? '';
381
- const hasExactMatch = !!currentInput && items.some(item => itemToString(item) === currentInput);
382
- if (!hasExactMatch) {
383
- const restoredInput = state.selectedItem !== null ? itemToString(state.selectedItem) : '';
384
- return {
385
- ...changes,
386
- inputValue: restoredInput
387
- };
388
- }
389
- }
390
- return changes;
391
- case MenuMouseLeave:
392
- return {
393
- ...changes,
394
- highlightedIndex: state.highlightedIndex
395
- };
396
- case InputKeyDownArrowUp:
397
- case InputKeyDownArrowDown:
398
- if (highlightedIndex === -1) {
399
- return {
400
- ...changes,
401
- highlightedIndex: 0
402
- };
403
- }
404
- return changes;
405
- case ItemMouseMove:
406
- return {
407
- ...changes,
408
- highlightedIndex: state.highlightedIndex
409
- };
410
- default:
411
- return changes;
412
- }
413
- },
414
- // eslint-disable-next-line react-hooks/exhaustive-deps
415
- [allowCustomValue, inputValue, itemToString, items, onChange]);
416
- const handleToggleClick = isOpen => event => {
417
- if (onToggleClick) {
418
- onToggleClick(event);
419
- }
420
- if (readOnly) {
421
- // Prevent the list from opening if readOnly is true
422
- event.preventDownshiftDefault = true;
423
- event?.persist?.();
424
- return;
425
- }
426
- if (event.target === textInput.current && isOpen) {
427
- event.preventDownshiftDefault = true;
428
- event?.persist?.();
429
- }
430
- };
431
- const normalizedProps = useNormalizedInputProps.useNormalizedInputProps({
432
- id,
433
- readOnly,
434
- disabled: disabled || false,
435
- invalid: invalid || false,
436
- invalidText,
437
- warn: warn || false,
438
- warnText
439
- });
440
- const className = cx(`${prefix}--combo-box`, {
441
- [`${prefix}--combo-box--invalid--focused`]: invalid && isFocused,
442
- [`${prefix}--list-box--up`]: direction === 'top',
443
- [`${prefix}--combo-box--warning`]: normalizedProps.warn,
444
- [`${prefix}--combo-box--readonly`]: readOnly,
445
- [`${prefix}--autoalign`]: enableFloatingStyles
446
- });
447
- const titleClasses = cx(`${prefix}--label`, {
448
- [`${prefix}--label--disabled`]: disabled
449
- });
450
- const helperTextId = `combobox-helper-text-${comboBoxInstanceId}`;
451
- const warnTextId = `combobox-warn-text-${comboBoxInstanceId}`;
452
- const invalidTextId = `combobox-invalid-text-${comboBoxInstanceId}`;
453
- const helperClasses = cx(`${prefix}--form__helper-text`, {
454
- [`${prefix}--form__helper-text--disabled`]: disabled
455
- });
456
- const wrapperClasses = cx(`${prefix}--list-box__wrapper`, [containerClassName, {
457
- [`${prefix}--list-box__wrapper--fluid--invalid`]: isFluid && invalid,
458
- [`${prefix}--list-box__wrapper--slug`]: slug,
459
- [`${prefix}--list-box__wrapper--decorator`]: decorator
460
- }]);
461
- const inputClasses = cx(`${prefix}--text-input`, {
462
- [`${prefix}--text-input--empty`]: !inputValue,
463
- [`${prefix}--combo-box--input--focus`]: isFocused
464
- });
465
-
466
- // AILabel always size `mini`
467
- const candidate = slug ?? decorator;
468
- const candidateIsAILabel = utils.isComponentElement(candidate, index$1.AILabel);
469
- const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/React.cloneElement(candidate, {
470
- size: 'mini'
471
- }) : candidate;
472
- const {
473
- // Prop getters
474
- getInputProps,
475
- getItemProps,
476
- getLabelProps,
477
- getMenuProps,
478
- getToggleButtonProps,
479
- // State
480
- isOpen,
481
- highlightedIndex,
482
- selectedItem,
483
- // Actions
484
- closeMenu,
485
- openMenu,
486
- reset,
487
- selectItem,
488
- setHighlightedIndex,
489
- setInputValue: downshiftSetInputValue,
490
- toggleMenu
491
- } = Downshift.useCombobox({
492
- items: filterItems(items, itemToString, inputValue),
493
- inputValue: inputValue,
494
- itemToString: item => {
495
- return itemToString(item);
496
- },
497
- onInputValueChange({
498
- inputValue
499
- }) {
500
- const normalizedInput = inputValue || '';
501
- setInputValue(normalizedInput);
502
- setHighlightedIndex(indexToHighlight(normalizedInput));
503
- },
504
- onHighlightedIndexChange: ({
505
- highlightedIndex
506
- }) => {
507
- if (highlightedIndex > -1) {
508
- const itemArray = document.querySelectorAll(`li.${prefix}--list-box__menu-item[role="option"]`);
509
- const highlightedItem = itemArray[highlightedIndex];
510
- if (highlightedItem) {
511
- highlightedItem.scrollIntoView({
512
- behavior: 'smooth',
513
- block: 'nearest'
514
- });
515
- }
516
- }
517
- },
518
- initialSelectedItem: initialSelectedItem,
519
- inputId: id,
520
- stateReducer,
521
- // eslint-disable-next-line @typescript-eslint/no-unused-vars -- https://github.com/carbon-design-system/carbon/issues/20452
522
- isItemDisabled(item, _index) {
523
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/carbon-design-system/carbon/issues/20452
524
- return item?.disabled;
525
- },
526
- ...downshiftProps,
527
- onStateChange: ({
528
- type,
529
- selectedItem: newSelectedItem
530
- }) => {
531
- downshiftProps?.onStateChange?.({
532
- type,
533
- selectedItem: newSelectedItem
534
- });
535
- if (isManualClearingRef.current) {
536
- return;
537
- }
538
- if ((type === ItemClick || type === FunctionSelectItem || type === InputKeyDownEnter) && typeof newSelectedItem !== 'undefined' && !isEqual(selectedItemProp, newSelectedItem)) {
539
- if (items.some(item => isEqual(item, newSelectedItem))) {
540
- committedCustomValueRef.current = '';
541
- }
542
- onChange({
543
- selectedItem: newSelectedItem
544
- });
545
- }
546
- }
547
- });
548
-
549
- // Keep the dropdown highlight in sync with either the controlled value or
550
- // Downshift's own selection when uncontrolled.
551
- const currentSelectedItem = typeof selectedItemProp !== 'undefined' ? selectedItemProp : selectedItem;
552
- React.useEffect(() => {
553
- // Used to expose the downshift actions to consumers for use with downshiftProps
554
- // An odd pattern, here we mutate the value stored in the ref provided from the consumer.
555
- // A riff of https://gist.github.com/gaearon/1a018a023347fe1c2476073330cc5509
556
- if (downshiftActions) {
557
- downshiftActions.current = {
558
- closeMenu,
559
- openMenu,
560
- reset,
561
- selectItem,
562
- setHighlightedIndex,
563
- setInputValue: downshiftSetInputValue,
564
- toggleMenu
565
- };
566
- }
567
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
568
- }, [closeMenu, openMenu, reset, selectItem, setHighlightedIndex, downshiftSetInputValue, toggleMenu]);
569
- const buttonProps = getToggleButtonProps({
570
- disabled: disabled || readOnly,
571
- onClick: handleToggleClick(isOpen),
572
- // When we moved the "root node" of Downshift to the <input> for
573
- // ARIA 1.2 compliance, we unfortunately hit this branch for the
574
- // "mouseup" event that downshift listens to:
575
- // https://github.com/downshift-js/downshift/blob/v5.2.1/src/downshift.js#L1051-L1065
576
- //
577
- // As a result, it will reset the state of the component and so we
578
- // stop the event from propagating to prevent this if the menu is already open.
579
- // This allows the toggleMenu behavior for the toggleButton to correctly open and
580
- // close the menu.
581
- onMouseUp(event) {
582
- if (isOpen) {
583
- event.stopPropagation();
584
- }
585
- }
586
- });
587
- const handleFocus = evt => {
588
- setIsFocused(evt.type === 'focus');
589
- if (!inputRef.current?.value && evt.type === 'blur') {
590
- selectItem(null);
591
- }
592
- };
593
- const readOnlyEventHandlers = readOnly ? {
594
- onKeyDown: evt => {
595
- // This prevents the select from opening for the above keys
596
- if (evt.key !== 'Tab') {
597
- evt.preventDefault();
598
- }
599
- },
600
- onClick: evt => {
601
- // Prevent the default behavior which would open the list
602
- evt.preventDefault();
603
- // Focus on the element as per readonly input behavior
604
- evt.currentTarget.focus();
605
- }
606
- } : {};
607
-
608
- // The input should be described by the appropriate message text id
609
- // when both the message is supplied *and* when the component is in
610
- // the matching state (invalid, warn, etc).
611
- const ariaDescribedBy = normalizedProps.invalid && invalidText && invalidTextId || normalizedProps.warn && warnText && warnTextId || helperText && !isFluid && helperTextId || undefined;
612
-
613
- // Memoize the value of getMenuProps to avoid an infinite loop
614
- const menuProps = React.useMemo(() => getMenuProps({
615
- ref: enableFloatingStyles ? refs.setFloating : null
616
- }),
617
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
618
- [enableFloatingStyles, deprecatedAriaLabel, ariaLabel, getMenuProps, refs.setFloating]);
619
- React.useEffect(() => {
620
- if (textInput.current) {
621
- if (inputRef.current && typeaheadText) {
622
- const selectionStart = inputValue.length;
623
- const selectionEnd = selectionStart + typeaheadText.length;
624
- inputRef.current.value = inputValue + typeaheadText;
625
- inputRef.current.setSelectionRange(selectionStart, selectionEnd);
626
- }
627
- }
628
- }, [inputValue, typeaheadText]);
629
- return /*#__PURE__*/React.createElement("div", {
630
- className: wrapperClasses
631
- }, titleText && /*#__PURE__*/React.createElement(Text.Text, _rollupPluginBabelHelpers.extends({
632
- as: "label",
633
- className: titleClasses
634
- }, getLabelProps()), titleText), /*#__PURE__*/React.createElement(index$2.default, {
635
- onFocus: handleFocus,
636
- onBlur: handleFocus,
637
- className: className,
638
- disabled: disabled,
639
- invalid: normalizedProps.invalid,
640
- invalidText: invalidText,
641
- invalidTextId: invalidTextId,
642
- isOpen: isOpen,
643
- light: light,
644
- size: size,
645
- warn: normalizedProps.warn,
646
- ref: enableFloatingStyles ? refs.setReference : null,
647
- warnText: warnText,
648
- warnTextId: warnTextId
649
- }, /*#__PURE__*/React.createElement("div", {
650
- className: `${prefix}--list-box__field`
651
- }, /*#__PURE__*/React.createElement("input", _rollupPluginBabelHelpers.extends({
652
- disabled: disabled,
653
- className: inputClasses,
654
- type: "text",
655
- tabIndex: 0,
656
- "aria-haspopup": "listbox",
657
- title: textInput?.current?.value
658
- }, getInputProps({
659
- 'aria-label': titleText ? undefined : deprecatedAriaLabel || ariaLabel,
660
- 'aria-controls': menuProps.id,
661
- placeholder,
662
- value: inputValue,
663
- ...inputProps,
664
- onChange: e => {
665
- const newValue = e.target.value;
666
- const shouldClearSelection = allowCustomValue && committedCustomValueRef.current && inputValue === committedCustomValueRef.current && newValue === '';
667
- setInputValue(newValue);
668
- downshiftSetInputValue(newValue);
669
- if (shouldClearSelection) {
670
- setIsClearing(true);
671
- onChange({
672
- selectedItem: null,
673
- inputValue: ''
674
- });
675
- selectItem(null);
676
- committedCustomValueRef.current = '';
677
- }
678
- },
679
- ref: mergeRefs.mergeRefs(textInput, ref, inputRef),
680
- onKeyDown: event => {
681
- if (match.match(event, keys.Space)) {
682
- event.stopPropagation();
683
- }
684
- if (match.match(event, keys.Enter) && (!inputValue || allowCustomValue)) {
685
- toggleMenu();
686
- if (highlightedIndex !== -1) {
687
- selectItem(filterItems(items, itemToString, inputValue)[highlightedIndex]);
688
- }
689
-
690
- // Since `onChange` does not normally fire when the menu is closed, we should
691
- // manually fire it when `allowCustomValue` is provided, the menu is closing,
692
- // and there is a value.
693
- if (allowCustomValue && isOpen && inputValue && highlightedIndex === -1) {
694
- committedCustomValueRef.current = inputValue;
695
- onChange({
696
- selectedItem: null,
697
- inputValue
698
- });
699
- }
700
- event.preventDownshiftDefault = true;
701
- event?.persist?.();
702
- }
703
- if (match.match(event, keys.Escape) && inputValue) {
704
- if (event.target === textInput.current && isOpen) {
705
- toggleMenu();
706
- event.preventDownshiftDefault = true;
707
- event?.persist?.();
708
- }
709
- }
710
- if (match.match(event, keys.Home) && event.code !== 'Numpad7') {
711
- event.target.setSelectionRange(0, 0);
712
- }
713
- if (match.match(event, keys.End) && event.code !== 'Numpad1') {
714
- event.target.setSelectionRange(event.target.value.length, event.target.value.length);
715
- }
716
- if (event.altKey && event.key == 'ArrowDown') {
717
- event.preventDownshiftDefault = true;
718
- if (!isOpen) {
719
- toggleMenu();
720
- }
721
- }
722
- if (event.altKey && event.key == 'ArrowUp') {
723
- event.preventDownshiftDefault = true;
724
- if (isOpen) {
725
- toggleMenu();
726
- }
727
- }
728
- if (!inputValue && highlightedIndex == -1 && event.key == 'Enter') {
729
- if (!isOpen) toggleMenu();
730
- selectItem(null);
731
- event.preventDownshiftDefault = true;
732
- if (event.currentTarget.ariaExpanded === 'false') openMenu();
733
- }
734
- if (typeahead && event.key === 'Tab') {
735
- // event.preventDefault();
736
- const matchingItem = items.find(item => itemToString(item).toLowerCase().startsWith(inputValue.toLowerCase()));
737
- if (matchingItem) {
738
- const newValue = itemToString(matchingItem);
739
- downshiftSetInputValue(newValue);
740
- selectItem(matchingItem);
741
- }
742
- }
743
- }
744
- }), rest, readOnlyEventHandlers, {
745
- readOnly: readOnly,
746
- "aria-describedby": ariaDescribedBy
747
- })), normalizedProps.invalid && /*#__PURE__*/React.createElement(iconsReact.WarningFilled, {
748
- className: `${prefix}--list-box__invalid-icon`
749
- }), normalizedProps.warn && /*#__PURE__*/React.createElement(iconsReact.WarningAltFilled, {
750
- className: `${prefix}--list-box__invalid-icon ${prefix}--list-box__invalid-icon--warning`
751
- }), inputValue && /*#__PURE__*/React.createElement(ListBoxSelection.default, {
752
- clearSelection: () => {
753
- setIsClearing(true); // This updates the state which syncs to the ref
754
- setInputValue('');
755
- onChange({
756
- selectedItem: null
757
- });
758
- selectItem(null);
759
- committedCustomValueRef.current = '';
760
- handleSelectionClear();
761
- },
762
- translateWithId: translateWithId,
763
- disabled: disabled || readOnly,
764
- onClearSelection: handleSelectionClear,
765
- selectionCount: 0
766
- }), /*#__PURE__*/React.createElement(ListBoxTrigger.default, _rollupPluginBabelHelpers.extends({}, buttonProps, {
767
- isOpen: isOpen,
768
- translateWithId: translateWithId
769
- }))), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React.createElement("div", {
770
- className: `${prefix}--list-box__inner-wrapper--decorator`
771
- }, candidateIsAILabel ? normalizedDecorator : /*#__PURE__*/React.createElement("span", null, normalizedDecorator)) : '', /*#__PURE__*/React.createElement(index$2.default.Menu, menuProps, isOpen ? filterItems(items, itemToString, inputValue).map((item, index) => {
772
- const isObject = item !== null && typeof item === 'object';
773
- const title = isObject && 'text' in item && itemToElement ? item.text?.toString() : itemToString(item);
774
- const itemProps = getItemProps({
775
- item,
776
- index
777
- });
778
-
779
- // The initial implementation using <Downshift> would place the disabled attribute
780
- // on disabled menu items. Conversely, useCombobox places aria-disabled instead.
781
- // To avoid any potential breaking changes, we avoid placing aria-disabled and
782
- // instead match the old behavior of placing the disabled attribute.
783
- const disabled = itemProps['aria-disabled'];
784
- const {
785
- 'aria-disabled': unusedAriaDisabled,
786
- // eslint-disable-line @typescript-eslint/no-unused-vars
787
- 'aria-selected': unusedAriaSelected,
788
- // eslint-disable-line @typescript-eslint/no-unused-vars
789
- ...modifiedItemProps
790
- } = itemProps;
791
- const isSelected = isEqual(currentSelectedItem, item);
792
- return /*#__PURE__*/React.createElement(index$2.default.MenuItem, _rollupPluginBabelHelpers.extends({
793
- key: itemProps.id,
794
- isActive: isSelected,
795
- isHighlighted: highlightedIndex === index,
796
- title: title,
797
- disabled: disabled
798
- }, modifiedItemProps, {
799
- "aria-selected": isSelected
800
- }), itemToElement ? itemToElement(item) : itemToString(item), isSelected && /*#__PURE__*/React.createElement(iconsReact.Checkmark, {
801
- className: `${prefix}--list-box__menu-item__selected-icon`
802
- }));
803
- }) : null)), helperText && !normalizedProps.invalid && !normalizedProps.warn && !isFluid && /*#__PURE__*/React.createElement(Text.Text, {
804
- as: "div",
805
- id: helperTextId,
806
- className: helperClasses
807
- }, helperText));
69
+ const ComboBox = (0, react.forwardRef)((props, ref) => {
70
+ const prevInputLengthRef = (0, react.useRef)(0);
71
+ const inputRef = (0, react.useRef)(null);
72
+ const { ["aria-label"]: ariaLabel = "Choose an item", ariaLabel: deprecatedAriaLabel, autoAlign = false, className: containerClassName, decorator, direction = "bottom", disabled = false, downshiftActions, downshiftProps, helperText, id, initialSelectedItem, invalid, invalidText, items, itemToElement = null, itemToString = require_defaultItemToString.defaultItemToString, light, onChange, onInputChange, onToggleClick, placeholder, readOnly, selectedItem: selectedItemProp, shouldFilterItem = defaultShouldFilterItem, size, titleText, translateWithId, typeahead = false, warn, warnText, allowCustomValue = false, slug, inputProps, ...rest } = props;
73
+ const enableFloatingStyles = require_index.useFeatureFlag("enable-v12-dynamic-floating-styles") || autoAlign;
74
+ const { refs, floatingStyles, middlewareData } = (0, _floating_ui_react.useFloating)(enableFloatingStyles ? {
75
+ placement: direction,
76
+ strategy: "fixed",
77
+ middleware: autoAlign ? [(0, _floating_ui_react.flip)(), (0, _floating_ui_react.hide)()] : void 0,
78
+ whileElementsMounted: _floating_ui_react.autoUpdate
79
+ } : {});
80
+ const referenceElement = refs?.reference?.current;
81
+ const parentWidth = typeof HTMLElement !== "undefined" && referenceElement instanceof HTMLElement ? referenceElement.clientWidth : void 0;
82
+ (0, react.useEffect)(() => {
83
+ if (enableFloatingStyles) {
84
+ const updatedFloatingStyles = {
85
+ ...floatingStyles,
86
+ visibility: middlewareData.hide?.referenceHidden ? "hidden" : "visible"
87
+ };
88
+ Object.keys(updatedFloatingStyles).forEach((style) => {
89
+ if (refs.floating.current) refs.floating.current.style[style] = updatedFloatingStyles[style];
90
+ });
91
+ if (parentWidth && refs.floating.current) refs.floating.current.style.width = parentWidth + "px";
92
+ }
93
+ }, [
94
+ enableFloatingStyles,
95
+ floatingStyles,
96
+ refs.floating,
97
+ parentWidth
98
+ ]);
99
+ const [inputValue, setInputValue] = (0, react.useState)(getInputValue({
100
+ initialSelectedItem,
101
+ itemToString,
102
+ selectedItem: selectedItemProp
103
+ }));
104
+ const [typeaheadText, setTypeaheadText] = (0, react.useState)("");
105
+ (0, react.useEffect)(() => {
106
+ if (typeahead) {
107
+ if (inputValue.length >= prevInputLengthRef.current) if (inputValue) {
108
+ const filteredItems = items.filter((item) => !isDisabledItem(item) && autocompleteCustomFilter({
109
+ item: itemToString(item),
110
+ inputValue
111
+ }));
112
+ if (filteredItems.length > 0) setTypeaheadText(itemToString(filteredItems[0]).slice(inputValue.length));
113
+ else setTypeaheadText("");
114
+ } else setTypeaheadText("");
115
+ else setTypeaheadText("");
116
+ prevInputLengthRef.current = inputValue.length;
117
+ }
118
+ }, [
119
+ typeahead,
120
+ inputValue,
121
+ items,
122
+ itemToString,
123
+ autocompleteCustomFilter
124
+ ]);
125
+ const isManualClearingRef = (0, react.useRef)(false);
126
+ const committedCustomValueRef = (0, react.useRef)("");
127
+ const [isClearing, setIsClearing] = (0, react.useState)(false);
128
+ const prefix = require_usePrefix.usePrefix();
129
+ const { isFluid } = (0, react.useContext)(require_FormContext.FormContext);
130
+ const textInput = (0, react.useRef)(null);
131
+ const comboBoxInstanceId = require_useId.useId();
132
+ const [isFocused, setIsFocused] = (0, react.useState)(false);
133
+ const prevInputValue = (0, react.useRef)(inputValue);
134
+ const prevSelectedItemProp = (0, react.useRef)(selectedItemProp);
135
+ (0, react.useEffect)(() => {
136
+ isManualClearingRef.current = isClearing;
137
+ if (isClearing) setIsClearing(false);
138
+ }, [isClearing]);
139
+ (0, react.useEffect)(() => {
140
+ if (prevSelectedItemProp.current !== selectedItemProp) {
141
+ const currentInputValue = getInputValue({
142
+ initialSelectedItem,
143
+ itemToString,
144
+ selectedItem: selectedItemProp,
145
+ prevSelectedItem: prevSelectedItemProp.current
146
+ });
147
+ if (inputValue !== currentInputValue) {
148
+ setInputValue(currentInputValue);
149
+ onChange({
150
+ selectedItem: selectedItemProp,
151
+ inputValue: currentInputValue
152
+ });
153
+ }
154
+ prevSelectedItemProp.current = selectedItemProp;
155
+ }
156
+ }, [selectedItemProp]);
157
+ const filterItems = (items, itemToString, inputValue) => items.filter((item) => typeahead ? autocompleteCustomFilter({
158
+ item: itemToString(item),
159
+ inputValue
160
+ }) : shouldFilterItem ? shouldFilterItem({
161
+ item,
162
+ itemToString,
163
+ inputValue
164
+ }) : defaultShouldFilterItem());
165
+ (0, react.useEffect)(() => {
166
+ if (prevInputValue.current !== inputValue) {
167
+ prevInputValue.current = inputValue;
168
+ onInputChange?.(inputValue);
169
+ }
170
+ }, [inputValue]);
171
+ const handleSelectionClear = () => {
172
+ if (textInput?.current) textInput.current.focus();
173
+ };
174
+ const filteredItems = (inputValue) => filterItems(items, itemToString, inputValue || null);
175
+ const indexToHighlight = (inputValue) => findHighlightedIndex({
176
+ ...props,
177
+ items: filteredItems(inputValue)
178
+ }, inputValue);
179
+ const stateReducer = (0, react.useCallback)((state, actionAndChanges) => {
180
+ const { type, changes } = actionAndChanges;
181
+ const { highlightedIndex } = changes;
182
+ switch (type) {
183
+ case InputBlur:
184
+ if (allowCustomValue && highlightedIndex === -1) {
185
+ const inputValue = state.inputValue ?? "";
186
+ const currentSelectedItem = typeof changes.selectedItem === "undefined" ? state.selectedItem : changes.selectedItem;
187
+ if (currentSelectedItem !== null && typeof currentSelectedItem !== "undefined" && itemToString(currentSelectedItem) === inputValue && items.some((item) => (0, react_fast_compare.default)(item, currentSelectedItem))) return changes;
188
+ const nextSelectedItem = inputValue === "" ? null : items.find((item) => itemToString(item) === inputValue) ?? inputValue;
189
+ const isCustomSelection = typeof nextSelectedItem === "string" && nextSelectedItem !== "" && !items.some((item) => (0, react_fast_compare.default)(item, nextSelectedItem));
190
+ if (!(0, react_fast_compare.default)(currentSelectedItem, nextSelectedItem) && onChange) {
191
+ onChange({
192
+ selectedItem: nextSelectedItem,
193
+ inputValue
194
+ });
195
+ committedCustomValueRef.current = isCustomSelection ? inputValue : "";
196
+ }
197
+ return {
198
+ ...changes,
199
+ selectedItem: nextSelectedItem
200
+ };
201
+ }
202
+ if (state.inputValue && highlightedIndex === -1 && changes.selectedItem) return {
203
+ ...changes,
204
+ inputValue: itemToString(changes.selectedItem)
205
+ };
206
+ if (!allowCustomValue) {
207
+ const currentInput = state.inputValue ?? "";
208
+ if (!(!!currentInput && items.some((item) => itemToString(item) === currentInput))) {
209
+ const restoredInput = state.selectedItem !== null ? itemToString(state.selectedItem) : "";
210
+ return {
211
+ ...changes,
212
+ inputValue: restoredInput
213
+ };
214
+ }
215
+ }
216
+ return changes;
217
+ case InputKeyDownEnter:
218
+ if (!allowCustomValue) if (state.highlightedIndex !== -1) {
219
+ const highlightedItem = filterItems(items, itemToString, inputValue)[state.highlightedIndex];
220
+ if (highlightedItem && !highlightedItem.disabled) return {
221
+ ...changes,
222
+ selectedItem: highlightedItem,
223
+ inputValue: itemToString(highlightedItem)
224
+ };
225
+ } else {
226
+ const autoIndex = indexToHighlight(inputValue);
227
+ if (autoIndex !== -1) {
228
+ const matchingItem = items[autoIndex];
229
+ if (matchingItem && !matchingItem.disabled) return {
230
+ ...changes,
231
+ selectedItem: matchingItem,
232
+ inputValue: itemToString(matchingItem)
233
+ };
234
+ }
235
+ if (state.selectedItem !== null) return {
236
+ ...changes,
237
+ selectedItem: null,
238
+ inputValue
239
+ };
240
+ }
241
+ return {
242
+ ...changes,
243
+ isOpen: true
244
+ };
245
+ case FunctionToggleMenu:
246
+ case ToggleButtonClick:
247
+ if (state.isOpen && !changes.isOpen && !allowCustomValue) {
248
+ const currentInput = state.inputValue ?? "";
249
+ if (!(!!currentInput && items.some((item) => itemToString(item) === currentInput))) {
250
+ const restoredInput = state.selectedItem !== null ? itemToString(state.selectedItem) : "";
251
+ return {
252
+ ...changes,
253
+ inputValue: restoredInput
254
+ };
255
+ }
256
+ }
257
+ return changes;
258
+ case MenuMouseLeave: return {
259
+ ...changes,
260
+ highlightedIndex: state.highlightedIndex
261
+ };
262
+ case InputKeyDownArrowUp:
263
+ case InputKeyDownArrowDown:
264
+ if (highlightedIndex === -1) return {
265
+ ...changes,
266
+ highlightedIndex: 0
267
+ };
268
+ return changes;
269
+ case ItemMouseMove: return {
270
+ ...changes,
271
+ highlightedIndex: state.highlightedIndex
272
+ };
273
+ default: return changes;
274
+ }
275
+ }, [
276
+ allowCustomValue,
277
+ inputValue,
278
+ itemToString,
279
+ items,
280
+ onChange
281
+ ]);
282
+ const handleToggleClick = (isOpen) => (event) => {
283
+ if (onToggleClick) onToggleClick(event);
284
+ if (readOnly) {
285
+ event.preventDownshiftDefault = true;
286
+ event?.persist?.();
287
+ return;
288
+ }
289
+ if (event.target === textInput.current && isOpen) {
290
+ event.preventDownshiftDefault = true;
291
+ event?.persist?.();
292
+ }
293
+ };
294
+ const normalizedProps = require_useNormalizedInputProps.useNormalizedInputProps({
295
+ id,
296
+ readOnly,
297
+ disabled: disabled || false,
298
+ invalid: invalid || false,
299
+ invalidText,
300
+ warn: warn || false,
301
+ warnText
302
+ });
303
+ const className = (0, classnames.default)(`${prefix}--combo-box`, {
304
+ [`${prefix}--combo-box--invalid--focused`]: invalid && isFocused,
305
+ [`${prefix}--list-box--up`]: direction === "top",
306
+ [`${prefix}--combo-box--warning`]: normalizedProps.warn,
307
+ [`${prefix}--combo-box--readonly`]: readOnly,
308
+ [`${prefix}--autoalign`]: enableFloatingStyles
309
+ });
310
+ const titleClasses = (0, classnames.default)(`${prefix}--label`, { [`${prefix}--label--disabled`]: disabled });
311
+ const helperTextId = `combobox-helper-text-${comboBoxInstanceId}`;
312
+ const warnTextId = `combobox-warn-text-${comboBoxInstanceId}`;
313
+ const invalidTextId = `combobox-invalid-text-${comboBoxInstanceId}`;
314
+ const helperClasses = (0, classnames.default)(`${prefix}--form__helper-text`, { [`${prefix}--form__helper-text--disabled`]: disabled });
315
+ const wrapperClasses = (0, classnames.default)(`${prefix}--list-box__wrapper`, [containerClassName, {
316
+ [`${prefix}--list-box__wrapper--fluid--invalid`]: isFluid && invalid,
317
+ [`${prefix}--list-box__wrapper--slug`]: slug,
318
+ [`${prefix}--list-box__wrapper--decorator`]: decorator
319
+ }]);
320
+ const inputClasses = (0, classnames.default)(`${prefix}--text-input`, {
321
+ [`${prefix}--text-input--empty`]: !inputValue,
322
+ [`${prefix}--combo-box--input--focus`]: isFocused
323
+ });
324
+ const candidate = slug ?? decorator;
325
+ const candidateIsAILabel = require_utils.isComponentElement(candidate, require_index$1.AILabel);
326
+ const normalizedDecorator = candidateIsAILabel ? (0, react.cloneElement)(candidate, { size: "mini" }) : candidate;
327
+ const { getInputProps, getItemProps, getLabelProps, getMenuProps, getToggleButtonProps, isOpen, highlightedIndex, selectedItem, closeMenu, openMenu, reset, selectItem, setHighlightedIndex, setInputValue: downshiftSetInputValue, toggleMenu } = (0, downshift.useCombobox)({
328
+ items: filterItems(items, itemToString, inputValue),
329
+ inputValue,
330
+ itemToString: (item) => {
331
+ return itemToString(item);
332
+ },
333
+ onInputValueChange({ inputValue }) {
334
+ const normalizedInput = inputValue || "";
335
+ setInputValue(normalizedInput);
336
+ setHighlightedIndex(indexToHighlight(normalizedInput));
337
+ },
338
+ onHighlightedIndexChange: ({ highlightedIndex }) => {
339
+ if (highlightedIndex > -1) {
340
+ const highlightedItem = document.querySelectorAll(`li.${prefix}--list-box__menu-item[role="option"]`)[highlightedIndex];
341
+ if (highlightedItem) highlightedItem.scrollIntoView({
342
+ behavior: "smooth",
343
+ block: "nearest"
344
+ });
345
+ }
346
+ },
347
+ initialSelectedItem,
348
+ inputId: id,
349
+ stateReducer,
350
+ isItemDisabled(item) {
351
+ return item?.disabled;
352
+ },
353
+ ...downshiftProps,
354
+ onStateChange: ({ type, selectedItem: newSelectedItem }) => {
355
+ downshiftProps?.onStateChange?.({
356
+ type,
357
+ selectedItem: newSelectedItem
358
+ });
359
+ if (isManualClearingRef.current) return;
360
+ if ((type === ItemClick || type === FunctionSelectItem || type === InputKeyDownEnter) && typeof newSelectedItem !== "undefined" && !(0, react_fast_compare.default)(selectedItemProp, newSelectedItem)) {
361
+ if (items.some((item) => (0, react_fast_compare.default)(item, newSelectedItem))) committedCustomValueRef.current = "";
362
+ onChange({ selectedItem: newSelectedItem });
363
+ }
364
+ }
365
+ });
366
+ const currentSelectedItem = typeof selectedItemProp !== "undefined" ? selectedItemProp : selectedItem;
367
+ (0, react.useEffect)(() => {
368
+ if (downshiftActions) downshiftActions.current = {
369
+ closeMenu,
370
+ openMenu,
371
+ reset,
372
+ selectItem,
373
+ setHighlightedIndex,
374
+ setInputValue: downshiftSetInputValue,
375
+ toggleMenu
376
+ };
377
+ }, [
378
+ closeMenu,
379
+ openMenu,
380
+ reset,
381
+ selectItem,
382
+ setHighlightedIndex,
383
+ downshiftSetInputValue,
384
+ toggleMenu
385
+ ]);
386
+ const buttonProps = getToggleButtonProps({
387
+ disabled: disabled || readOnly,
388
+ onClick: handleToggleClick(isOpen),
389
+ onMouseUp(event) {
390
+ if (isOpen) event.stopPropagation();
391
+ }
392
+ });
393
+ const handleFocus = (evt) => {
394
+ setIsFocused(evt.type === "focus");
395
+ if (!inputRef.current?.value && evt.type === "blur") selectItem(null);
396
+ };
397
+ const readOnlyEventHandlers = readOnly ? {
398
+ onKeyDown: (evt) => {
399
+ if (evt.key !== "Tab") evt.preventDefault();
400
+ },
401
+ onClick: (evt) => {
402
+ evt.preventDefault();
403
+ evt.currentTarget.focus();
404
+ }
405
+ } : {};
406
+ const ariaDescribedBy = normalizedProps.invalid && invalidText && invalidTextId || normalizedProps.warn && warnText && warnTextId || helperText && !isFluid && helperTextId || void 0;
407
+ const menuProps = (0, react.useMemo)(() => getMenuProps({ ref: enableFloatingStyles ? refs.setFloating : null }), [
408
+ enableFloatingStyles,
409
+ deprecatedAriaLabel,
410
+ ariaLabel,
411
+ getMenuProps,
412
+ refs.setFloating
413
+ ]);
414
+ (0, react.useEffect)(() => {
415
+ if (textInput.current) {
416
+ if (inputRef.current && typeaheadText) {
417
+ const selectionStart = inputValue.length;
418
+ const selectionEnd = selectionStart + typeaheadText.length;
419
+ inputRef.current.value = inputValue + typeaheadText;
420
+ inputRef.current.setSelectionRange(selectionStart, selectionEnd);
421
+ }
422
+ }
423
+ }, [inputValue, typeaheadText]);
424
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
425
+ className: wrapperClasses,
426
+ children: [
427
+ titleText && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
428
+ as: "label",
429
+ className: titleClasses,
430
+ ...getLabelProps(),
431
+ children: titleText
432
+ }),
433
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_index$2.default, {
434
+ onFocus: handleFocus,
435
+ onBlur: handleFocus,
436
+ className,
437
+ disabled,
438
+ invalid: normalizedProps.invalid,
439
+ invalidText,
440
+ invalidTextId,
441
+ isOpen,
442
+ light,
443
+ size,
444
+ warn: normalizedProps.warn,
445
+ ref: enableFloatingStyles ? refs.setReference : null,
446
+ warnText,
447
+ warnTextId,
448
+ children: [
449
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
450
+ className: `${prefix}--list-box__field`,
451
+ children: [
452
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
453
+ disabled,
454
+ className: inputClasses,
455
+ type: "text",
456
+ tabIndex: 0,
457
+ "aria-haspopup": "listbox",
458
+ title: textInput?.current?.value,
459
+ ...getInputProps({
460
+ "aria-label": titleText ? void 0 : deprecatedAriaLabel || ariaLabel,
461
+ "aria-controls": menuProps.id,
462
+ placeholder,
463
+ value: inputValue,
464
+ ...inputProps,
465
+ onChange: (e) => {
466
+ const newValue = e.target.value;
467
+ const shouldClearSelection = allowCustomValue && committedCustomValueRef.current && inputValue === committedCustomValueRef.current && newValue === "";
468
+ setInputValue(newValue);
469
+ downshiftSetInputValue(newValue);
470
+ if (shouldClearSelection) {
471
+ setIsClearing(true);
472
+ onChange({
473
+ selectedItem: null,
474
+ inputValue: ""
475
+ });
476
+ selectItem(null);
477
+ committedCustomValueRef.current = "";
478
+ }
479
+ },
480
+ ref: require_mergeRefs.mergeRefs(textInput, ref, inputRef),
481
+ onKeyDown: (event) => {
482
+ if (require_match.match(event, require_keys.Space)) event.stopPropagation();
483
+ if (require_match.match(event, require_keys.Enter) && (!inputValue || allowCustomValue)) {
484
+ toggleMenu();
485
+ if (highlightedIndex !== -1) selectItem(filterItems(items, itemToString, inputValue)[highlightedIndex]);
486
+ if (allowCustomValue && isOpen && inputValue && highlightedIndex === -1) {
487
+ committedCustomValueRef.current = inputValue;
488
+ onChange({
489
+ selectedItem: null,
490
+ inputValue
491
+ });
492
+ }
493
+ event.preventDownshiftDefault = true;
494
+ event?.persist?.();
495
+ }
496
+ if (require_match.match(event, require_keys.Escape) && inputValue) {
497
+ if (event.target === textInput.current && isOpen) {
498
+ toggleMenu();
499
+ event.preventDownshiftDefault = true;
500
+ event?.persist?.();
501
+ }
502
+ }
503
+ if (require_match.match(event, require_keys.Home) && event.code !== "Numpad7") event.target.setSelectionRange(0, 0);
504
+ if (require_match.match(event, require_keys.End) && event.code !== "Numpad1") event.target.setSelectionRange(event.target.value.length, event.target.value.length);
505
+ if (event.altKey && event.key == "ArrowDown") {
506
+ event.preventDownshiftDefault = true;
507
+ if (!isOpen) toggleMenu();
508
+ }
509
+ if (event.altKey && event.key == "ArrowUp") {
510
+ event.preventDownshiftDefault = true;
511
+ if (isOpen) toggleMenu();
512
+ }
513
+ if (!inputValue && highlightedIndex == -1 && event.key == "Enter") {
514
+ if (!isOpen) toggleMenu();
515
+ selectItem(null);
516
+ event.preventDownshiftDefault = true;
517
+ if (event.currentTarget.ariaExpanded === "false") openMenu();
518
+ }
519
+ if (typeahead && event.key === "Tab") {
520
+ if (!isOpen) return;
521
+ const matchingItem = items.find((item) => !isDisabledItem(item) && itemToString(item).toLowerCase().startsWith(inputValue.toLowerCase()));
522
+ if (matchingItem) {
523
+ downshiftSetInputValue(itemToString(matchingItem));
524
+ selectItem(matchingItem);
525
+ }
526
+ }
527
+ }
528
+ }),
529
+ ...rest,
530
+ ...readOnlyEventHandlers,
531
+ readOnly,
532
+ "aria-describedby": ariaDescribedBy
533
+ }),
534
+ normalizedProps.invalid && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_carbon_icons_react.WarningFilled, { className: `${prefix}--list-box__invalid-icon` }),
535
+ normalizedProps.warn && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_carbon_icons_react.WarningAltFilled, { className: `${prefix}--list-box__invalid-icon ${prefix}--list-box__invalid-icon--warning` }),
536
+ inputValue && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ListBoxSelection.default, {
537
+ clearSelection: () => {
538
+ setIsClearing(true);
539
+ setInputValue("");
540
+ onChange({ selectedItem: null });
541
+ selectItem(null);
542
+ committedCustomValueRef.current = "";
543
+ handleSelectionClear();
544
+ },
545
+ translateWithId,
546
+ disabled: disabled || readOnly,
547
+ onClearSelection: handleSelectionClear,
548
+ selectionCount: 0
549
+ }),
550
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ListBoxTrigger.default, {
551
+ ...buttonProps,
552
+ isOpen,
553
+ translateWithId
554
+ })
555
+ ]
556
+ }),
557
+ slug ? normalizedDecorator : decorator ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
558
+ className: `${prefix}--list-box__inner-wrapper--decorator`,
559
+ children: candidateIsAILabel ? normalizedDecorator : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: normalizedDecorator })
560
+ }) : "",
561
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index$2.default.Menu, {
562
+ ...menuProps,
563
+ children: isOpen ? filterItems(items, itemToString, inputValue).map((item, index) => {
564
+ const title = item !== null && typeof item === "object" && "text" in item && itemToElement ? item.text?.toString() : itemToString(item);
565
+ const itemProps = getItemProps({
566
+ item,
567
+ index
568
+ });
569
+ const disabled = itemProps["aria-disabled"];
570
+ const { "aria-disabled": unusedAriaDisabled, "aria-selected": unusedAriaSelected, ...modifiedItemProps } = itemProps;
571
+ const isSelected = (0, react_fast_compare.default)(currentSelectedItem, item);
572
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_index$2.default.MenuItem, {
573
+ isActive: isSelected,
574
+ isHighlighted: highlightedIndex === index,
575
+ title,
576
+ disabled,
577
+ ...modifiedItemProps,
578
+ "aria-selected": isSelected,
579
+ children: [itemToElement ? itemToElement(item) : itemToString(item), isSelected && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_carbon_icons_react.Checkmark, { className: `${prefix}--list-box__menu-item__selected-icon` })]
580
+ }, itemProps.id);
581
+ }) : null
582
+ })
583
+ ]
584
+ }),
585
+ helperText && !normalizedProps.invalid && !normalizedProps.warn && !isFluid && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
586
+ as: "div",
587
+ id: helperTextId,
588
+ className: helperClasses,
589
+ children: helperText
590
+ })
591
+ ]
592
+ });
808
593
  });
809
- ComboBox.displayName = 'ComboBox';
594
+ ComboBox.displayName = "ComboBox";
810
595
  ComboBox.propTypes = {
811
- /**
812
- * Specify whether or not the ComboBox should allow a value that is
813
- * not in the list to be entered in the input
814
- */
815
- allowCustomValue: PropTypes.bool,
816
- /**
817
- * 'aria-label' of the ListBox component.
818
- * Specify a label to be read by screen readers on the container node
819
- */
820
- ['aria-label']: PropTypes.string,
821
- /**
822
- * Deprecated, please use `aria-label` instead.
823
- * Specify a label to be read by screen readers on the container note.
824
- * 'aria-label' of the ListBox component.
825
- */
826
- ariaLabel: deprecate.deprecate(PropTypes.string, 'This prop syntax has been deprecated. Please use the new `aria-label`.'),
827
- /**
828
- * **Experimental**: Will attempt to automatically align the floating
829
- * element to avoid collisions with the viewport and being clipped by
830
- * ancestor elements. Requires React v17+
831
- * @see https://github.com/carbon-design-system/carbon/issues/18714
832
- */
833
- autoAlign: PropTypes.bool,
834
- /**
835
- * An optional className to add to the container node
836
- */
837
- className: PropTypes.string,
838
- /**
839
- * **Experimental**: Provide a decorator component to be rendered inside the `ComboBox` component
840
- */
841
- decorator: PropTypes.node,
842
- /**
843
- * Specify the direction of the combobox dropdown. Can be either top or bottom.
844
- */
845
- direction: PropTypes.oneOf(['top', 'bottom']),
846
- /**
847
- * Specify if the control should be disabled, or not
848
- */
849
- disabled: PropTypes.bool,
850
- /**
851
- * Additional props passed to Downshift.
852
- *
853
- * **Use with caution:** anything you define here overrides the components'
854
- * internal handling of that prop. Downshift APIs and internals are subject to
855
- * change, and in some cases they can not be shimmed by Carbon to shield you
856
- * from potentially breaking changes.
857
- */
858
- downshiftProps: PropTypes.object,
859
- /**
860
- * Provide a ref that will be mutated to contain an object of downshift
861
- * action functions. These can be called to change the internal state of the
862
- * downshift useCombobox hook.
863
- *
864
- * **Use with caution:** calling these actions modifies the internal state of
865
- * downshift. It may conflict with or override the state management used within
866
- * Combobox. Downshift APIs and internals are subject to change, and in some
867
- * cases they can not be shimmed by Carbon to shield you from potentially breaking
868
- * changes.
869
- */
870
- downshiftActions: PropTypes.exact({
871
- current: PropTypes.any
872
- }),
873
- /**
874
- * Provide helper text that is used alongside the control label for
875
- * additional help
876
- */
877
- helperText: PropTypes.node,
878
- /**
879
- * Specify a custom `id` for the input
880
- */
881
- id: PropTypes.string.isRequired,
882
- /**
883
- * Allow users to pass in an arbitrary item or a string (in case their items are an array of strings)
884
- * from their collection that are pre-selected
885
- */
886
- initialSelectedItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number]),
887
- /**
888
- * Specify if the currently selected value is invalid.
889
- */
890
- invalid: PropTypes.bool,
891
- /**
892
- * Message which is displayed if the value is invalid.
893
- */
894
- invalidText: PropTypes.node,
895
- /**
896
- * Renders an item as a custom React node instead of a string.
897
- */
898
- itemToElement: PropTypes.func,
899
- /**
900
- * Helper function passed to downshift that allows the library to render a
901
- * given item to a string label. By default, it extracts the `label` field
902
- * from a given item to serve as the item label in the list
903
- */
904
- itemToString: PropTypes.func,
905
- /**
906
- * We try to stay as generic as possible here to allow individuals to pass
907
- * in a collection of whatever kind of data structure they prefer
908
- */
909
- items: PropTypes.array.isRequired,
910
- /**
911
- * should use "light theme" (white background)?
912
- */
913
- light: deprecate.deprecate(PropTypes.bool, 'The `light` prop for `Combobox` has ' + 'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'),
914
- /**
915
- * `onChange` is a utility for this controlled component to communicate to a
916
- * consuming component when a specific dropdown item is selected.
917
- * `({ selectedItem }) => void`
918
- * @param {{ selectedItem }}
919
- */
920
- onChange: PropTypes.func.isRequired,
921
- /**
922
- * Callback function to notify consumer when the text input changes.
923
- * This provides support to change available items based on the text.
924
- * `(inputText) => void`
925
- * @param {string} inputText
926
- */
927
- onInputChange: PropTypes.func,
928
- /**
929
- * Callback function that fires when the combobox menu toggle is clicked
930
- * `(evt) => void`
931
- * @param {MouseEvent} event
932
- */
933
- onToggleClick: PropTypes.func,
934
- /**
935
- * Used to provide a placeholder text node before a user enters any input.
936
- * This is only present if the control has no items selected
937
- */
938
- placeholder: PropTypes.string,
939
- /**
940
- * Is the ComboBox readonly?
941
- */
942
- readOnly: PropTypes.bool,
943
- /**
944
- * For full control of the selection
945
- */
946
- selectedItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.number]),
947
- /**
948
- * Specify your own filtering logic by passing in a `shouldFilterItem`
949
- * function that takes in the current input and an item and passes back
950
- * whether or not the item should be filtered.
951
- * this prop will be ignored if `typeahead` prop is enabled
952
- */
953
- shouldFilterItem: PropTypes.func,
954
- /**
955
- * Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
956
- */
957
- size: ListBoxPropTypes.ListBoxSizePropType,
958
- slug: deprecate.deprecate(PropTypes.node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.'),
959
- /**
960
- * Provide text to be used in a `<label>` element that is tied to the
961
- * combobox via ARIA attributes.
962
- */
963
- titleText: PropTypes.node,
964
- /**
965
- * Translates component strings using your i18n tool.
966
- */
967
- translateWithId: PropTypes.func,
968
- /**
969
- * **Experimental**: will enable autocomplete and typeahead for the input field
970
- */
971
- typeahead: PropTypes.bool,
972
- /**
973
- * Specify whether the control is currently in warning state
974
- */
975
- warn: PropTypes.bool,
976
- /**
977
- * Provide the text that is displayed when the control is in warning state
978
- */
979
- warnText: PropTypes.node,
980
- /**
981
- * Specify native input attributes to place on the `<input>`, like maxLength.
982
- * These are passed to downshift's getInputProps() and will override the
983
- * internal input props.
984
- * https://github.com/downshift-js/downshift?tab=readme-ov-file#getinputprops
985
- */
986
- inputProps: PropTypes.object
596
+ allowCustomValue: prop_types.default.bool,
597
+ ["aria-label"]: prop_types.default.string,
598
+ ariaLabel: require_deprecate.deprecate(prop_types.default.string, "This prop syntax has been deprecated. Please use the new `aria-label`."),
599
+ autoAlign: prop_types.default.bool,
600
+ className: prop_types.default.string,
601
+ decorator: prop_types.default.node,
602
+ direction: prop_types.default.oneOf(["top", "bottom"]),
603
+ disabled: prop_types.default.bool,
604
+ downshiftProps: prop_types.default.object,
605
+ downshiftActions: prop_types.default.exact({ current: prop_types.default.any }),
606
+ helperText: prop_types.default.node,
607
+ id: prop_types.default.string.isRequired,
608
+ initialSelectedItem: prop_types.default.oneOfType([
609
+ prop_types.default.object,
610
+ prop_types.default.string,
611
+ prop_types.default.number
612
+ ]),
613
+ invalid: prop_types.default.bool,
614
+ invalidText: prop_types.default.node,
615
+ itemToElement: prop_types.default.func,
616
+ itemToString: prop_types.default.func,
617
+ items: prop_types.default.array.isRequired,
618
+ light: require_deprecate.deprecate(prop_types.default.bool, "The `light` prop for `Combobox` has been deprecated in favor of the new `Layer` component. It will be removed in the next major release."),
619
+ onChange: prop_types.default.func.isRequired,
620
+ onInputChange: prop_types.default.func,
621
+ onToggleClick: prop_types.default.func,
622
+ placeholder: prop_types.default.string,
623
+ readOnly: prop_types.default.bool,
624
+ selectedItem: prop_types.default.oneOfType([
625
+ prop_types.default.object,
626
+ prop_types.default.string,
627
+ prop_types.default.number
628
+ ]),
629
+ shouldFilterItem: prop_types.default.func,
630
+ size: require_ListBoxPropTypes.ListBoxSizePropType,
631
+ slug: require_deprecate.deprecate(prop_types.default.node, "The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead."),
632
+ titleText: prop_types.default.node,
633
+ translateWithId: prop_types.default.func,
634
+ typeahead: prop_types.default.bool,
635
+ warn: prop_types.default.bool,
636
+ warnText: prop_types.default.node,
637
+ inputProps: prop_types.default.object
987
638
  };
988
639
 
989
- exports.default = ComboBox;
640
+ //#endregion
641
+ exports.default = ComboBox;