@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,672 +1,512 @@
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
- import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
- import PropTypes from 'prop-types';
10
- import React, { useContext, useRef, useEffect, cloneElement } from 'react';
11
- import cx from 'classnames';
12
- import { Close } from '@carbon/icons-react';
13
- import { toggleClass } from '../../tools/toggleClass.js';
14
- import Button from '../Button/Button.js';
15
- import '../Button/Button.Skeleton.js';
16
- import ButtonSet from '../ButtonSet/ButtonSet.js';
17
- import InlineLoading from '../InlineLoading/InlineLoading.js';
18
- import { Layer } from '../Layer/index.js';
19
- import { requiredIfGivenPropIsTruthy } from '../../prop-types/requiredIfGivenPropIsTruthy.js';
20
- import { wrapFocus, wrapFocusWithoutSentinels, elementOrParentIsFloatingMenu } from '../../internal/wrapFocus.js';
21
- import { useResizeObserver } from '../../internal/useResizeObserver.js';
22
- import { useId } from '../../internal/useId.js';
23
- import { useMergedRefs } from '../../internal/useMergedRefs.js';
24
- import { usePrefix } from '../../internal/usePrefix.js';
25
- import { usePreviousValue } from '../../internal/usePreviousValue.js';
26
- import { Escape, Enter, Tab } from '../../internal/keyboard/keys.js';
27
- import { match } from '../../internal/keyboard/match.js';
28
- import { IconButton } from '../IconButton/index.js';
29
- import { noopFn } from '../../internal/noopFn.js';
30
- import { Text } from '../Text/Text.js';
31
- import '../Text/TextDirection.js';
32
- import { useFeatureFlag } from '../FeatureFlags/index.js';
33
- import { composeEventHandlers } from '../../tools/events.js';
34
- import { deprecate } from '../../prop-types/deprecate.js';
35
- import { Dialog } from '../Dialog/Dialog.js';
36
- import { AILabel } from '../AILabel/index.js';
37
- import { isComponentElement } from '../../internal/utils.js';
38
- import { warning } from '../../internal/warning.js';
39
- import { ModalPresenceContext, useExclusiveModalPresenceContext, ModalPresence } from './ModalPresence.js';
8
+ import { usePrefix } from "../../internal/usePrefix.js";
9
+ import { Text } from "../Text/Text.js";
10
+ import { Enter, Escape, Tab } from "../../internal/keyboard/keys.js";
11
+ import { match } from "../../internal/keyboard/match.js";
12
+ import { useId } from "../../internal/useId.js";
13
+ import { noopFn } from "../../internal/noopFn.js";
14
+ import { warning } from "../../internal/warning.js";
15
+ import { deprecate } from "../../prop-types/deprecate.js";
16
+ import { useMergedRefs } from "../../internal/useMergedRefs.js";
17
+ import { useFeatureFlag } from "../FeatureFlags/index.js";
18
+ import { IconButton } from "../IconButton/index.js";
19
+ import Button_default from "../Button/index.js";
20
+ import ButtonSet_default from "../ButtonSet/index.js";
21
+ import { AILabel } from "../AILabel/index.js";
22
+ import { isComponentElement } from "../../internal/utils.js";
23
+ import { useResizeObserver } from "../../internal/useResizeObserver.js";
24
+ import { composeEventHandlers } from "../../tools/events.js";
25
+ import { Layer } from "../Layer/index.js";
26
+ import InlineLoading_default from "../InlineLoading/index.js";
27
+ import { toggleClass } from "../../tools/toggleClass.js";
28
+ import { requiredIfGivenPropIsTruthy } from "../../prop-types/requiredIfGivenPropIsTruthy.js";
29
+ import { elementOrParentIsFloatingMenu, wrapFocus, wrapFocusWithoutSentinels } from "../../internal/wrapFocus.js";
30
+ import { Dialog } from "../Dialog/Dialog.js";
31
+ import { usePreviousValue } from "../../internal/usePreviousValue.js";
32
+ import { ModalPresence, ModalPresenceContext, useExclusiveModalPresenceContext } from "./ModalPresence.js";
33
+ import classNames from "classnames";
34
+ import React, { cloneElement, useContext, useEffect, useRef } from "react";
35
+ import PropTypes from "prop-types";
36
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
37
+ import { Close } from "@carbon/icons-react";
40
38
 
41
- const ModalSizes = ['xs', 'sm', 'md', 'lg'];
42
- const invalidOutsideClickMessage = '`<Modal>` prop `preventCloseOnClickOutside` should not be `false` when ' + '`passiveModal` is `false`. Transactional, non-passive Modals should ' + 'not be dissmissable by clicking outside. ' + 'See: https://carbondesignsystem.com/components/modal/usage/#transactional-modal';
43
- const Modal = /*#__PURE__*/React.forwardRef(function Modal({
44
- open,
45
- ...props
46
- }, ref) {
47
- const id = useId();
48
- const enablePresence = useFeatureFlag('enable-presence');
49
- const hasPresenceContext = Boolean(useContext(ModalPresenceContext));
50
- const hasPresenceOptIn = enablePresence || hasPresenceContext;
51
- const exclusivePresenceContext = useExclusiveModalPresenceContext(id);
52
-
53
- // if opt in and not exclusive to a presence context, wrap with presence
54
- if (hasPresenceOptIn && !exclusivePresenceContext) {
55
- return /*#__PURE__*/React.createElement(ModalPresence, {
56
- open: open ?? false,
57
- _presenceId: id
58
- // do not auto enable styles for opt-in by feature flag
59
- ,
60
- _autoEnablePresence: hasPresenceContext
61
- }, /*#__PURE__*/React.createElement(ModalDialog, _extends({
62
- open: true,
63
- ref: ref
64
- }, props)));
65
- }
66
- return /*#__PURE__*/React.createElement(ModalDialog, _extends({
67
- ref: ref,
68
- open: open
69
- }, props));
39
+ //#region src/components/Modal/Modal.tsx
40
+ /**
41
+ * Copyright IBM Corp. 2016, 2025
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 ModalSizes = [
47
+ "xs",
48
+ "sm",
49
+ "md",
50
+ "lg"
51
+ ];
52
+ const invalidOutsideClickMessage = "`<Modal>` prop `preventCloseOnClickOutside` should not be `false` when `passiveModal` is `false`. Transactional, non-passive Modals should not be dissmissable by clicking outside. See: https://carbondesignsystem.com/components/modal/usage/#transactional-modal";
53
+ const Modal = React.forwardRef(function Modal({ open, ...props }, ref) {
54
+ const id = useId();
55
+ const enablePresence = useFeatureFlag("enable-presence");
56
+ const hasPresenceContext = Boolean(useContext(ModalPresenceContext));
57
+ const hasPresenceOptIn = enablePresence || hasPresenceContext;
58
+ const exclusivePresenceContext = useExclusiveModalPresenceContext(id);
59
+ if (hasPresenceOptIn && !exclusivePresenceContext) return /* @__PURE__ */ jsx(ModalPresence, {
60
+ open: open ?? false,
61
+ _presenceId: id,
62
+ _autoEnablePresence: hasPresenceContext,
63
+ children: /* @__PURE__ */ jsx(ModalDialog, {
64
+ open: true,
65
+ ref,
66
+ ...props
67
+ })
68
+ });
69
+ return /* @__PURE__ */ jsx(ModalDialog, {
70
+ ref,
71
+ open,
72
+ ...props
73
+ });
70
74
  });
71
- const ModalDialog = /*#__PURE__*/React.forwardRef(function ModalDialog({
72
- 'aria-label': ariaLabelProp,
73
- children,
74
- className,
75
- decorator,
76
- modalHeading = '',
77
- modalLabel = '',
78
- modalAriaLabel,
79
- passiveModal = false,
80
- secondaryButtonText,
81
- primaryButtonText,
82
- open: externalOpen,
83
- onRequestClose = noopFn,
84
- onRequestSubmit = noopFn,
85
- onSecondarySubmit,
86
- primaryButtonDisabled = false,
87
- danger,
88
- alert,
89
- secondaryButtons,
90
- selectorPrimaryFocus = '[data-modal-primary-focus]',
91
- selectorsFloatingMenus,
92
- shouldSubmitOnEnter,
93
- size,
94
- hasScrollingContent = false,
95
- closeButtonLabel = 'Close',
96
- preventCloseOnClickOutside,
97
- isFullWidth,
98
- launcherButtonRef,
99
- loadingStatus = 'inactive',
100
- loadingDescription,
101
- loadingIconDescription,
102
- onLoadingSuccess = noopFn,
103
- slug,
104
- ...rest
105
- }, ref) {
106
- const prefix = usePrefix();
107
- const button = useRef(null);
108
- const secondaryButton = useRef(null);
109
- const contentRef = useRef(null);
110
- const innerModal = useRef(null);
111
- const startTrap = useRef(null);
112
- const endTrap = useRef(null);
113
- const wrapFocusTimeout = useRef(null);
114
- const modalInstanceId = `modal-${useId()}`;
115
- const modalLabelId = `${prefix}--modal-header__label--${modalInstanceId}`;
116
- const modalHeadingId = `${prefix}--modal-header__heading--${modalInstanceId}`;
117
- const modalBodyId = `${prefix}--modal-body--${modalInstanceId}`;
118
- const modalCloseButtonClass = `${prefix}--modal-close`;
119
- const primaryButtonClass = cx({
120
- [`${prefix}--btn--loading`]: loadingStatus !== 'inactive'
121
- });
122
- const loadingActive = loadingStatus !== 'inactive';
123
- const presenceContext = useContext(ModalPresenceContext);
124
- const mergedRefs = useMergedRefs([ref, presenceContext?.presenceRef]);
125
- const enablePresence = useFeatureFlag('enable-presence') || presenceContext?.autoEnablePresence;
126
-
127
- // always mark as open when mounted with presence
128
- const open = externalOpen || enablePresence;
129
- const prevOpen = usePreviousValue(open);
130
- const deprecatedFlag = useFeatureFlag('enable-experimental-focus-wrap-without-sentinels');
131
- const focusTrapWithoutSentinelsFlag = useFeatureFlag('enable-focus-wrap-without-sentinels');
132
- const focusTrapWithoutSentinels = focusTrapWithoutSentinelsFlag || deprecatedFlag;
133
- const enableDialogElement = useFeatureFlag('enable-dialog-element');
134
- process.env.NODE_ENV !== "production" ? warning(!(focusTrapWithoutSentinels && enableDialogElement), '`<Modal>` detected both `focusTrapWithoutSentinels` and ' + '`enableDialogElement` feature flags are enabled. The native dialog ' + 'element handles focus, so `enableDialogElement` must be off for ' + '`focusTrapWithoutSentinels` to have any effect.') : void 0;
135
- process.env.NODE_ENV !== "production" ? warning(!(!passiveModal && preventCloseOnClickOutside === false), invalidOutsideClickMessage) : void 0;
136
- function isCloseButton(element) {
137
- return !onSecondarySubmit && element === secondaryButton.current || element.classList.contains(modalCloseButtonClass);
138
- }
139
- function handleKeyDown(evt) {
140
- const {
141
- target
142
- } = evt;
143
- evt.stopPropagation();
144
- if (open && target instanceof HTMLElement) {
145
- if (match(evt, Enter) && shouldSubmitOnEnter && !isCloseButton(target) && document.activeElement !== button.current) {
146
- onRequestSubmit(evt);
147
- }
148
- if (focusTrapWithoutSentinels && !enableDialogElement && match(evt, Tab) && innerModal.current) {
149
- wrapFocusWithoutSentinels({
150
- containerNode: innerModal.current,
151
- currentActiveNode: target,
152
- event: evt
153
- });
154
- }
155
- }
156
- }
157
- function handleOnClick(evt) {
158
- const {
159
- target
160
- } = evt;
161
- const shouldCloseOnOutsideClick =
162
- // Passive modals can close on clicks outside the modal when
163
- // preventCloseOnClickOutside is undefined or explicitly set to false.
164
- passiveModal && !preventCloseOnClickOutside ||
165
- // Non-passive modals have to explicitly opt-in for close on outside
166
- // behavior by explicitly setting preventCloseOnClickOutside to false,
167
- // rather than just leaving it undefined.
168
- !passiveModal && preventCloseOnClickOutside === false;
169
- if (shouldCloseOnOutsideClick && target instanceof Node && !elementOrParentIsFloatingMenu(target, selectorsFloatingMenus, prefix) && innerModal.current && !innerModal.current.contains(target)) {
170
- onRequestClose(evt);
171
- }
172
- }
173
- function handleBlur({
174
- target: oldActiveNode,
175
- relatedTarget: currentActiveNode
176
- }) {
177
- if (!enableDialogElement && open && oldActiveNode instanceof HTMLElement && currentActiveNode instanceof HTMLElement) {
178
- const {
179
- current: bodyNode
180
- } = innerModal;
181
- const {
182
- current: startTrapNode
183
- } = startTrap;
184
- const {
185
- current: endTrapNode
186
- } = endTrap;
187
- // use setTimeout to ensure focus is set after all browser default focus behavior. Fixes issue of
188
- // focus not wrapping in Firefox
189
- wrapFocusTimeout.current = setTimeout(() => {
190
- wrapFocus({
191
- bodyNode,
192
- startTrapNode,
193
- endTrapNode,
194
- currentActiveNode,
195
- oldActiveNode,
196
- selectorsFloatingMenus,
197
- prefix
198
- });
199
- if (wrapFocusTimeout.current) {
200
- clearTimeout(wrapFocusTimeout.current);
201
- }
202
- });
203
- }
204
-
205
- // Adjust scroll if needed so that element with focus is not obscured by gradient
206
- const modalContent = document.querySelector(`.${prefix}--modal-content`);
207
- if (!modalContent || !modalContent.classList.contains(`${prefix}--modal-scroll-content`) || !currentActiveNode || !modalContent.contains(currentActiveNode)) {
208
- return;
209
- }
210
- currentActiveNode.scrollIntoView({
211
- block: 'center'
212
- });
213
- }
214
- const onSecondaryButtonClick = onSecondarySubmit ? onSecondarySubmit : onRequestClose;
215
- const {
216
- height
217
- } = useResizeObserver({
218
- ref: contentRef
219
- });
220
- const modalClasses = cx(`${prefix}--modal`, {
221
- [`${prefix}--modal-tall`]: !passiveModal,
222
- 'is-visible': enablePresence || open,
223
- [`${prefix}--modal--enable-presence`]: presenceContext?.autoEnablePresence,
224
- [`${prefix}--modal--danger`]: danger,
225
- [`${prefix}--modal--slug`]: slug,
226
- [`${prefix}--modal--decorator`]: decorator
227
- }, className);
228
- const containerClasses = cx(`${prefix}--modal-container`, {
229
- [`${prefix}--modal-container--${size}`]: size,
230
- [`${prefix}--modal-container--full-width`]: isFullWidth
231
- });
232
-
233
- /**
234
- * isScrollable is implicitly dependent on height, when height gets updated
235
- * via `useResizeObserver`, clientHeight and scrollHeight get updated too
236
- */
237
- const isScrollable = !!contentRef.current && contentRef?.current?.scrollHeight > contentRef?.current?.clientHeight;
238
- const contentClasses = cx(`${prefix}--modal-content`, {
239
- [`${prefix}--modal-scroll-content`]: hasScrollingContent || isScrollable,
240
- [`${prefix}--modal-scroll-content--no-fade`]: height <= 300
241
- });
242
- const footerClasses = cx(`${prefix}--modal-footer`, {
243
- [`${prefix}--modal-footer--three-button`]: Array.isArray(secondaryButtons) && secondaryButtons.length === 2
244
- });
245
- const asStringOrUndefined = node => {
246
- return typeof node === 'string' ? node : undefined;
247
- };
248
- const modalLabelStr = asStringOrUndefined(modalLabel);
249
- const modalHeadingStr = asStringOrUndefined(modalHeading);
250
- const ariaLabel = modalLabelStr || ariaLabelProp || modalAriaLabel || modalHeadingStr;
251
- const getAriaLabelledBy = modalLabel ? modalLabelId : modalHeadingId;
252
- const hasScrollingContentProps = hasScrollingContent || isScrollable ? {
253
- tabIndex: 0,
254
- role: 'region',
255
- 'aria-label': ariaLabel,
256
- 'aria-labelledby': getAriaLabelledBy
257
- } : {};
258
- const alertDialogProps = {};
259
- if (alert && passiveModal) {
260
- alertDialogProps.role = 'alert';
261
- }
262
- if (alert && !passiveModal) {
263
- alertDialogProps.role = 'alertdialog';
264
- alertDialogProps['aria-describedby'] = modalBodyId;
265
- }
266
- useEffect(() => {
267
- if (!open) return;
268
- const handleEscapeKey = event => {
269
- if (match(event, Escape)) {
270
- event.preventDefault();
271
- event.stopPropagation();
272
- onRequestClose(event);
273
- }
274
- };
275
- document.addEventListener('keydown', handleEscapeKey, true);
276
- return () => {
277
- document.removeEventListener('keydown', handleEscapeKey, true);
278
- };
279
- // eslint-disable-next-line react-hooks/exhaustive-deps -- https://github.com/carbon-design-system/carbon/issues/20452
280
- }, [open]);
281
- useEffect(() => {
282
- return () => {
283
- if (!enableDialogElement) {
284
- toggleClass(document.body, `${prefix}--body--with-modal-open`, false);
285
- }
286
- };
287
- }, [prefix, enableDialogElement]);
288
- useEffect(() => {
289
- if (!enableDialogElement) {
290
- toggleClass(document.body, `${prefix}--body--with-modal-open`, open ?? false);
291
- }
292
- }, [open, prefix, enableDialogElement]);
293
- useEffect(() => {
294
- if (!enableDialogElement && !enablePresence && prevOpen && !open && launcherButtonRef) {
295
- setTimeout(() => {
296
- if ('current' in launcherButtonRef) {
297
- launcherButtonRef.current?.focus();
298
- }
299
- });
300
- }
301
- }, [open, prevOpen, launcherButtonRef, enableDialogElement, enablePresence]);
302
- // Focus launcherButtonRef on unmount
303
- useEffect(() => {
304
- const launcherButton = launcherButtonRef?.current;
305
- return () => {
306
- if (enablePresence && launcherButton) {
307
- setTimeout(() => {
308
- launcherButton.focus();
309
- });
310
- }
311
- };
312
- }, [enablePresence, launcherButtonRef]);
313
- useEffect(() => {
314
- if (!enableDialogElement) {
315
- const initialFocus = focusContainerElement => {
316
- const containerElement = focusContainerElement || innerModal.current;
317
- const primaryFocusElement = containerElement && (containerElement.querySelector(selectorPrimaryFocus) || danger && containerElement.querySelector(`.${prefix}--btn--secondary`));
318
- if (primaryFocusElement) {
319
- return primaryFocusElement;
320
- }
321
- return button && button.current;
322
- };
323
- const focusButton = focusContainerElement => {
324
- const target = initialFocus(focusContainerElement);
325
- if (target !== null) {
326
- target.focus();
327
- }
328
- };
329
- if (open) {
330
- focusButton(innerModal.current);
331
- }
332
- }
333
- }, [open, selectorPrimaryFocus, danger, prefix, enableDialogElement]);
334
-
335
- // AILabel always size `sm`
336
- const candidate = slug ?? decorator;
337
- const candidateIsAILabel = isComponentElement(candidate, AILabel);
338
- const normalizedDecorator = candidateIsAILabel ? /*#__PURE__*/cloneElement(candidate, {
339
- size: 'sm'
340
- }) : candidate;
341
- const modalButton = /*#__PURE__*/React.createElement("div", {
342
- className: `${prefix}--modal-close-button`
343
- }, /*#__PURE__*/React.createElement(IconButton, {
344
- className: modalCloseButtonClass,
345
- label: closeButtonLabel,
346
- onClick: onRequestClose,
347
- "aria-label": closeButtonLabel,
348
- align: "left",
349
- ref: button
350
- }, /*#__PURE__*/React.createElement(Close, {
351
- size: 20,
352
- "aria-hidden": "true",
353
- tabIndex: "-1",
354
- className: `${modalCloseButtonClass}__icon`
355
- })));
356
-
357
- // alertdialog is the only permitted aria role for a native dialog element
358
- // https://www.w3.org/TR/html-aria/#docconformance:~:text=Role%3A-,alertdialog,-.%20(dialog%20is
359
- const isAlertDialog = alert && !passiveModal;
360
- const modalBody = enableDialogElement ? /*#__PURE__*/React.createElement(Dialog, {
361
- open: open,
362
- focusAfterCloseRef: launcherButtonRef,
363
- modal: true,
364
- ref: innerModal,
365
- role: isAlertDialog ? 'alertdialog' : '',
366
- "aria-describedby": isAlertDialog ? modalBodyId : '',
367
- className: containerClasses,
368
- "aria-label": ariaLabel,
369
- "data-exiting": presenceContext?.isExiting || undefined
370
- }, /*#__PURE__*/React.createElement("div", {
371
- className: `${prefix}--modal-header`
372
- }, modalLabel && /*#__PURE__*/React.createElement(Text, {
373
- as: "h2",
374
- id: modalLabelId,
375
- className: `${prefix}--modal-header__label`
376
- }, modalLabel), /*#__PURE__*/React.createElement(Text, {
377
- as: "h2",
378
- id: modalHeadingId,
379
- className: `${prefix}--modal-header__heading`
380
- }, modalHeading), decorator ? /*#__PURE__*/React.createElement("div", {
381
- className: `${prefix}--modal--inner__decorator`
382
- }, normalizedDecorator) : '', /*#__PURE__*/React.createElement("div", {
383
- className: `${prefix}--modal-close-button`
384
- }, /*#__PURE__*/React.createElement(IconButton, {
385
- className: modalCloseButtonClass,
386
- label: closeButtonLabel,
387
- onClick: onRequestClose,
388
- "aria-label": closeButtonLabel,
389
- align: "left",
390
- ref: button
391
- }, /*#__PURE__*/React.createElement(Close, {
392
- size: 20,
393
- "aria-hidden": "true",
394
- tabIndex: "-1",
395
- className: `${modalCloseButtonClass}__icon`
396
- })))), /*#__PURE__*/React.createElement(Layer, _extends({
397
- ref: contentRef,
398
- id: modalBodyId,
399
- className: contentClasses
400
- }, hasScrollingContentProps), children), !passiveModal && /*#__PURE__*/React.createElement(ButtonSet, {
401
- className: footerClasses,
402
- "aria-busy": loadingActive
403
- }, Array.isArray(secondaryButtons) && secondaryButtons.length <= 2 ? secondaryButtons.map(({
404
- buttonText,
405
- onClick: onButtonClick
406
- }, i) => /*#__PURE__*/React.createElement(Button, {
407
- key: `${buttonText}-${i}`,
408
- kind: "secondary",
409
- onClick: onButtonClick
410
- }, buttonText)) : secondaryButtonText && /*#__PURE__*/React.createElement(Button, {
411
- disabled: loadingActive,
412
- kind: "secondary",
413
- onClick: onSecondaryButtonClick,
414
- ref: secondaryButton
415
- }, secondaryButtonText), /*#__PURE__*/React.createElement(Button, {
416
- className: primaryButtonClass,
417
- kind: danger ? 'danger' : 'primary',
418
- disabled: loadingActive || primaryButtonDisabled,
419
- onClick: onRequestSubmit,
420
- ref: button
421
- }, loadingStatus === 'inactive' ? primaryButtonText : /*#__PURE__*/React.createElement(InlineLoading, {
422
- status: loadingStatus,
423
- description: loadingDescription,
424
- iconDescription: loadingIconDescription,
425
- className: `${prefix}--inline-loading--btn`,
426
- onSuccess: onLoadingSuccess
427
- })))) : /*#__PURE__*/React.createElement(React.Fragment, null, !enableDialogElement && !focusTrapWithoutSentinels && /*#__PURE__*/React.createElement("span", {
428
- ref: startTrap,
429
- tabIndex: 0,
430
- role: "link",
431
- className: `${prefix}--visually-hidden`
432
- }, "Focus sentinel"), /*#__PURE__*/React.createElement("div", _extends({
433
- ref: innerModal,
434
- role: "dialog"
435
- }, alertDialogProps, {
436
- className: containerClasses,
437
- "aria-label": ariaLabel,
438
- "aria-modal": "true",
439
- tabIndex: -1
440
- }), /*#__PURE__*/React.createElement("div", {
441
- className: `${prefix}--modal-header`
442
- }, passiveModal && modalButton, modalLabel && /*#__PURE__*/React.createElement(Text, {
443
- as: "h2",
444
- id: modalLabelId,
445
- className: `${prefix}--modal-header__label`
446
- }, modalLabel), /*#__PURE__*/React.createElement(Text, {
447
- as: "h2",
448
- id: modalHeadingId,
449
- className: `${prefix}--modal-header__heading`
450
- }, modalHeading), slug ? normalizedDecorator : decorator ? /*#__PURE__*/React.createElement("div", {
451
- className: `${prefix}--modal--inner__decorator`
452
- }, normalizedDecorator) : '', !passiveModal && modalButton), /*#__PURE__*/React.createElement(Layer, _extends({
453
- ref: contentRef,
454
- id: modalBodyId,
455
- className: contentClasses
456
- }, hasScrollingContentProps), children), !passiveModal && /*#__PURE__*/React.createElement(ButtonSet, {
457
- className: footerClasses,
458
- "aria-busy": loadingActive
459
- }, Array.isArray(secondaryButtons) && secondaryButtons.length <= 2 ? secondaryButtons.map(({
460
- buttonText,
461
- onClick: onButtonClick
462
- }, i) => /*#__PURE__*/React.createElement(Button, {
463
- key: `${buttonText}-${i}`,
464
- kind: "secondary",
465
- onClick: onButtonClick
466
- }, buttonText)) : secondaryButtonText && /*#__PURE__*/React.createElement(Button, {
467
- disabled: loadingActive,
468
- kind: "secondary",
469
- onClick: onSecondaryButtonClick,
470
- ref: secondaryButton
471
- }, secondaryButtonText), /*#__PURE__*/React.createElement(Button, {
472
- className: primaryButtonClass,
473
- kind: danger ? 'danger' : 'primary',
474
- disabled: loadingActive || primaryButtonDisabled,
475
- onClick: onRequestSubmit,
476
- ref: button
477
- }, loadingStatus === 'inactive' ? primaryButtonText : /*#__PURE__*/React.createElement(InlineLoading, {
478
- status: loadingStatus,
479
- description: loadingDescription,
480
- iconDescription: loadingIconDescription,
481
- className: `${prefix}--inline-loading--btn`,
482
- onSuccess: onLoadingSuccess
483
- })))), !enableDialogElement && !focusTrapWithoutSentinels && /*#__PURE__*/React.createElement("span", {
484
- ref: endTrap,
485
- tabIndex: 0,
486
- role: "link",
487
- className: `${prefix}--visually-hidden`
488
- }, "Focus sentinel"));
489
- return /*#__PURE__*/React.createElement(Layer, _extends({}, rest, {
490
- level: 0,
491
- onKeyDown: handleKeyDown,
492
- onClick: composeEventHandlers([rest?.onClick, handleOnClick]),
493
- onBlur: handleBlur,
494
- className: modalClasses,
495
- role: "presentation",
496
- ref: mergedRefs,
497
- "data-exiting": presenceContext?.isExiting || undefined
498
- }), modalBody);
75
+ const ModalDialog = React.forwardRef(function ModalDialog({ "aria-label": ariaLabelProp, children, className, decorator, modalHeading = "", modalLabel = "", modalAriaLabel, passiveModal = false, secondaryButtonText, primaryButtonText, open: externalOpen, onRequestClose = noopFn, onRequestSubmit = noopFn, onSecondarySubmit, primaryButtonDisabled = false, danger, alert, secondaryButtons, selectorPrimaryFocus = "[data-modal-primary-focus]", selectorsFloatingMenus, shouldSubmitOnEnter, size, hasScrollingContent = false, closeButtonLabel = "Close", preventCloseOnClickOutside, isFullWidth, launcherButtonRef, loadingStatus = "inactive", loadingDescription, loadingIconDescription, onLoadingSuccess = noopFn, slug, ...rest }, ref) {
76
+ const prefix = usePrefix();
77
+ const button = useRef(null);
78
+ const secondaryButton = useRef(null);
79
+ const contentRef = useRef(null);
80
+ const innerModal = useRef(null);
81
+ const startTrap = useRef(null);
82
+ const endTrap = useRef(null);
83
+ const wrapFocusTimeout = useRef(null);
84
+ const modalInstanceId = `modal-${useId()}`;
85
+ const modalLabelId = `${prefix}--modal-header__label--${modalInstanceId}`;
86
+ const modalHeadingId = `${prefix}--modal-header__heading--${modalInstanceId}`;
87
+ const modalBodyId = `${prefix}--modal-body--${modalInstanceId}`;
88
+ const modalCloseButtonClass = `${prefix}--modal-close`;
89
+ const primaryButtonClass = classNames({ [`${prefix}--btn--loading`]: loadingStatus !== "inactive" });
90
+ const loadingActive = loadingStatus !== "inactive";
91
+ const presenceContext = useContext(ModalPresenceContext);
92
+ const mergedRefs = useMergedRefs([ref, presenceContext?.presenceRef]);
93
+ const enablePresence = useFeatureFlag("enable-presence") || presenceContext?.autoEnablePresence;
94
+ const open = externalOpen || enablePresence;
95
+ const prevOpen = usePreviousValue(open);
96
+ const deprecatedFlag = useFeatureFlag("enable-experimental-focus-wrap-without-sentinels");
97
+ const focusTrapWithoutSentinels = useFeatureFlag("enable-focus-wrap-without-sentinels") || deprecatedFlag;
98
+ const enableDialogElement = useFeatureFlag("enable-dialog-element");
99
+ warning(!(focusTrapWithoutSentinels && enableDialogElement), "`<Modal>` detected both `focusTrapWithoutSentinels` and `enableDialogElement` feature flags are enabled. The native dialog element handles focus, so `enableDialogElement` must be off for `focusTrapWithoutSentinels` to have any effect.");
100
+ warning(!(!passiveModal && preventCloseOnClickOutside === false), invalidOutsideClickMessage);
101
+ function isCloseButton(element) {
102
+ return !onSecondarySubmit && element === secondaryButton.current || element.classList.contains(modalCloseButtonClass);
103
+ }
104
+ function handleKeyDown(evt) {
105
+ const { target } = evt;
106
+ evt.stopPropagation();
107
+ if (open && target instanceof HTMLElement) {
108
+ if (match(evt, Enter) && shouldSubmitOnEnter && !isCloseButton(target) && document.activeElement !== button.current) onRequestSubmit(evt);
109
+ if (focusTrapWithoutSentinels && !enableDialogElement && match(evt, Tab) && innerModal.current) wrapFocusWithoutSentinels({
110
+ containerNode: innerModal.current,
111
+ currentActiveNode: target,
112
+ event: evt
113
+ });
114
+ }
115
+ }
116
+ function handleOnClick(evt) {
117
+ const { target } = evt;
118
+ if ((passiveModal && !preventCloseOnClickOutside || !passiveModal && preventCloseOnClickOutside === false) && target instanceof Node && !elementOrParentIsFloatingMenu(target, selectorsFloatingMenus, prefix) && innerModal.current && !innerModal.current.contains(target)) onRequestClose(evt);
119
+ }
120
+ function handleBlur({ target: oldActiveNode, relatedTarget: currentActiveNode }) {
121
+ if (!enableDialogElement && open && oldActiveNode instanceof HTMLElement && currentActiveNode instanceof HTMLElement) {
122
+ const { current: bodyNode } = innerModal;
123
+ const { current: startTrapNode } = startTrap;
124
+ const { current: endTrapNode } = endTrap;
125
+ wrapFocusTimeout.current = setTimeout(() => {
126
+ wrapFocus({
127
+ bodyNode,
128
+ startTrapNode,
129
+ endTrapNode,
130
+ currentActiveNode,
131
+ oldActiveNode,
132
+ selectorsFloatingMenus,
133
+ prefix
134
+ });
135
+ if (wrapFocusTimeout.current) clearTimeout(wrapFocusTimeout.current);
136
+ });
137
+ }
138
+ const modalContent = document.querySelector(`.${prefix}--modal-content`);
139
+ if (!modalContent || !modalContent.classList.contains(`${prefix}--modal-scroll-content`) || !currentActiveNode || !modalContent.contains(currentActiveNode)) return;
140
+ currentActiveNode.scrollIntoView({ block: "center" });
141
+ }
142
+ const onSecondaryButtonClick = onSecondarySubmit ? onSecondarySubmit : onRequestClose;
143
+ const { height } = useResizeObserver({ ref: contentRef });
144
+ const modalClasses = classNames(`${prefix}--modal`, {
145
+ [`${prefix}--modal-tall`]: !passiveModal,
146
+ "is-visible": enablePresence || open,
147
+ [`${prefix}--modal--enable-presence`]: presenceContext?.autoEnablePresence,
148
+ [`${prefix}--modal--danger`]: danger,
149
+ [`${prefix}--modal--slug`]: slug,
150
+ [`${prefix}--modal--decorator`]: decorator
151
+ }, className);
152
+ const containerClasses = classNames(`${prefix}--modal-container`, {
153
+ [`${prefix}--modal-container--${size}`]: size,
154
+ [`${prefix}--modal-container--full-width`]: isFullWidth
155
+ });
156
+ /**
157
+ * isScrollable is implicitly dependent on height, when height gets updated
158
+ * via `useResizeObserver`, clientHeight and scrollHeight get updated too
159
+ */
160
+ const isScrollable = !!contentRef.current && contentRef?.current?.scrollHeight > contentRef?.current?.clientHeight;
161
+ const contentClasses = classNames(`${prefix}--modal-content`, {
162
+ [`${prefix}--modal-scroll-content`]: hasScrollingContent || isScrollable,
163
+ [`${prefix}--modal-scroll-content--no-fade`]: height <= 300
164
+ });
165
+ const footerClasses = classNames(`${prefix}--modal-footer`, { [`${prefix}--modal-footer--three-button`]: Array.isArray(secondaryButtons) && secondaryButtons.length === 2 });
166
+ const asStringOrUndefined = (node) => {
167
+ return typeof node === "string" ? node : void 0;
168
+ };
169
+ const modalLabelStr = asStringOrUndefined(modalLabel);
170
+ const modalHeadingStr = asStringOrUndefined(modalHeading);
171
+ const ariaLabel = modalLabelStr || ariaLabelProp || modalAriaLabel || modalHeadingStr;
172
+ const getAriaLabelledBy = modalLabel ? modalLabelId : modalHeadingId;
173
+ const hasScrollingContentProps = hasScrollingContent || isScrollable ? {
174
+ tabIndex: 0,
175
+ role: "region",
176
+ "aria-label": ariaLabel,
177
+ "aria-labelledby": getAriaLabelledBy
178
+ } : {};
179
+ const alertDialogProps = {};
180
+ if (alert && passiveModal) alertDialogProps.role = "alert";
181
+ if (alert && !passiveModal) {
182
+ alertDialogProps.role = "alertdialog";
183
+ alertDialogProps["aria-describedby"] = modalBodyId;
184
+ }
185
+ useEffect(() => {
186
+ if (!open) return;
187
+ const handleEscapeKey = (event) => {
188
+ if (match(event, Escape)) {
189
+ event.preventDefault();
190
+ event.stopPropagation();
191
+ onRequestClose(event);
192
+ }
193
+ };
194
+ document.addEventListener("keydown", handleEscapeKey, true);
195
+ return () => {
196
+ document.removeEventListener("keydown", handleEscapeKey, true);
197
+ };
198
+ }, [open]);
199
+ useEffect(() => {
200
+ return () => {
201
+ if (!enableDialogElement) toggleClass(document.body, `${prefix}--body--with-modal-open`, false);
202
+ };
203
+ }, [prefix, enableDialogElement]);
204
+ useEffect(() => {
205
+ if (!enableDialogElement) toggleClass(document.body, `${prefix}--body--with-modal-open`, open ?? false);
206
+ }, [
207
+ open,
208
+ prefix,
209
+ enableDialogElement
210
+ ]);
211
+ useEffect(() => {
212
+ if (!enableDialogElement && !enablePresence && prevOpen && !open && launcherButtonRef) setTimeout(() => {
213
+ if ("current" in launcherButtonRef) launcherButtonRef.current?.focus();
214
+ });
215
+ }, [
216
+ open,
217
+ prevOpen,
218
+ launcherButtonRef,
219
+ enableDialogElement,
220
+ enablePresence
221
+ ]);
222
+ useEffect(() => {
223
+ const launcherButton = launcherButtonRef?.current;
224
+ return () => {
225
+ if (enablePresence && launcherButton) setTimeout(() => {
226
+ launcherButton.focus();
227
+ });
228
+ };
229
+ }, [enablePresence, launcherButtonRef]);
230
+ useEffect(() => {
231
+ if (!enableDialogElement) {
232
+ const initialFocus = (focusContainerElement) => {
233
+ const containerElement = focusContainerElement || innerModal.current;
234
+ const primaryFocusElement = containerElement && (containerElement.querySelector(selectorPrimaryFocus) || danger && containerElement.querySelector(`.${prefix}--btn--secondary`));
235
+ if (primaryFocusElement) return primaryFocusElement;
236
+ return button && button.current;
237
+ };
238
+ const focusButton = (focusContainerElement) => {
239
+ const target = initialFocus(focusContainerElement);
240
+ if (target !== null) target.focus();
241
+ };
242
+ if (open) focusButton(innerModal.current);
243
+ }
244
+ }, [
245
+ open,
246
+ selectorPrimaryFocus,
247
+ danger,
248
+ prefix,
249
+ enableDialogElement
250
+ ]);
251
+ const candidate = slug ?? decorator;
252
+ const normalizedDecorator = isComponentElement(candidate, AILabel) ? cloneElement(candidate, { size: "sm" }) : candidate;
253
+ const modalButton = /* @__PURE__ */ jsx("div", {
254
+ className: `${prefix}--modal-close-button`,
255
+ children: /* @__PURE__ */ jsx(IconButton, {
256
+ className: modalCloseButtonClass,
257
+ label: closeButtonLabel,
258
+ onClick: onRequestClose,
259
+ "aria-label": closeButtonLabel,
260
+ align: "left",
261
+ ref: button,
262
+ children: /* @__PURE__ */ jsx(Close, {
263
+ size: 20,
264
+ "aria-hidden": "true",
265
+ tabIndex: "-1",
266
+ className: `${modalCloseButtonClass}__icon`
267
+ })
268
+ })
269
+ });
270
+ const isAlertDialog = alert && !passiveModal;
271
+ const modalBody = enableDialogElement ? /* @__PURE__ */ jsxs(Dialog, {
272
+ open,
273
+ focusAfterCloseRef: launcherButtonRef,
274
+ modal: true,
275
+ ref: innerModal,
276
+ role: isAlertDialog ? "alertdialog" : "",
277
+ "aria-describedby": isAlertDialog ? modalBodyId : "",
278
+ className: containerClasses,
279
+ "aria-label": ariaLabel,
280
+ "data-exiting": presenceContext?.isExiting || void 0,
281
+ children: [
282
+ /* @__PURE__ */ jsxs("div", {
283
+ className: `${prefix}--modal-header`,
284
+ children: [
285
+ modalLabel && /* @__PURE__ */ jsx(Text, {
286
+ as: "h2",
287
+ id: modalLabelId,
288
+ className: `${prefix}--modal-header__label`,
289
+ children: modalLabel
290
+ }),
291
+ /* @__PURE__ */ jsx(Text, {
292
+ as: "h2",
293
+ id: modalHeadingId,
294
+ className: `${prefix}--modal-header__heading`,
295
+ children: modalHeading
296
+ }),
297
+ decorator ? /* @__PURE__ */ jsx("div", {
298
+ className: `${prefix}--modal--inner__decorator`,
299
+ children: normalizedDecorator
300
+ }) : "",
301
+ /* @__PURE__ */ jsx("div", {
302
+ className: `${prefix}--modal-close-button`,
303
+ children: /* @__PURE__ */ jsx(IconButton, {
304
+ className: modalCloseButtonClass,
305
+ label: closeButtonLabel,
306
+ onClick: onRequestClose,
307
+ "aria-label": closeButtonLabel,
308
+ align: "left",
309
+ ref: button,
310
+ children: /* @__PURE__ */ jsx(Close, {
311
+ size: 20,
312
+ "aria-hidden": "true",
313
+ tabIndex: "-1",
314
+ className: `${modalCloseButtonClass}__icon`
315
+ })
316
+ })
317
+ })
318
+ ]
319
+ }),
320
+ /* @__PURE__ */ jsx(Layer, {
321
+ ref: contentRef,
322
+ id: modalBodyId,
323
+ className: contentClasses,
324
+ ...hasScrollingContentProps,
325
+ children
326
+ }),
327
+ !passiveModal && /* @__PURE__ */ jsxs(ButtonSet_default, {
328
+ className: footerClasses,
329
+ "aria-busy": loadingActive,
330
+ children: [Array.isArray(secondaryButtons) && secondaryButtons.length <= 2 ? secondaryButtons.map(({ buttonText, onClick: onButtonClick }, i) => /* @__PURE__ */ jsx(Button_default, {
331
+ kind: "secondary",
332
+ onClick: onButtonClick,
333
+ children: buttonText
334
+ }, `${buttonText}-${i}`)) : secondaryButtonText && /* @__PURE__ */ jsx(Button_default, {
335
+ disabled: loadingActive,
336
+ kind: "secondary",
337
+ onClick: onSecondaryButtonClick,
338
+ ref: secondaryButton,
339
+ children: secondaryButtonText
340
+ }), /* @__PURE__ */ jsx(Button_default, {
341
+ className: primaryButtonClass,
342
+ kind: danger ? "danger" : "primary",
343
+ disabled: loadingActive || primaryButtonDisabled,
344
+ onClick: onRequestSubmit,
345
+ ref: button,
346
+ children: loadingStatus === "inactive" ? primaryButtonText : /* @__PURE__ */ jsx(InlineLoading_default, {
347
+ status: loadingStatus,
348
+ description: loadingDescription,
349
+ iconDescription: loadingIconDescription,
350
+ className: `${prefix}--inline-loading--btn`,
351
+ onSuccess: onLoadingSuccess
352
+ })
353
+ })]
354
+ })
355
+ ]
356
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [
357
+ !enableDialogElement && !focusTrapWithoutSentinels && /* @__PURE__ */ jsx("span", {
358
+ ref: startTrap,
359
+ tabIndex: 0,
360
+ role: "link",
361
+ className: `${prefix}--visually-hidden`,
362
+ children: "Focus sentinel"
363
+ }),
364
+ /* @__PURE__ */ jsxs("div", {
365
+ ref: innerModal,
366
+ role: "dialog",
367
+ ...alertDialogProps,
368
+ className: containerClasses,
369
+ "aria-label": ariaLabel,
370
+ "aria-modal": "true",
371
+ tabIndex: -1,
372
+ children: [
373
+ /* @__PURE__ */ jsxs("div", {
374
+ className: `${prefix}--modal-header`,
375
+ children: [
376
+ passiveModal && modalButton,
377
+ modalLabel && /* @__PURE__ */ jsx(Text, {
378
+ as: "h2",
379
+ id: modalLabelId,
380
+ className: `${prefix}--modal-header__label`,
381
+ children: modalLabel
382
+ }),
383
+ /* @__PURE__ */ jsx(Text, {
384
+ as: "h2",
385
+ id: modalHeadingId,
386
+ className: `${prefix}--modal-header__heading`,
387
+ children: modalHeading
388
+ }),
389
+ slug ? normalizedDecorator : decorator ? /* @__PURE__ */ jsx("div", {
390
+ className: `${prefix}--modal--inner__decorator`,
391
+ children: normalizedDecorator
392
+ }) : "",
393
+ !passiveModal && modalButton
394
+ ]
395
+ }),
396
+ /* @__PURE__ */ jsx(Layer, {
397
+ ref: contentRef,
398
+ id: modalBodyId,
399
+ className: contentClasses,
400
+ ...hasScrollingContentProps,
401
+ children
402
+ }),
403
+ !passiveModal && /* @__PURE__ */ jsxs(ButtonSet_default, {
404
+ className: footerClasses,
405
+ "aria-busy": loadingActive,
406
+ children: [Array.isArray(secondaryButtons) && secondaryButtons.length <= 2 ? secondaryButtons.map(({ buttonText, onClick: onButtonClick }, i) => /* @__PURE__ */ jsx(Button_default, {
407
+ kind: "secondary",
408
+ onClick: onButtonClick,
409
+ children: buttonText
410
+ }, `${buttonText}-${i}`)) : secondaryButtonText && /* @__PURE__ */ jsx(Button_default, {
411
+ disabled: loadingActive,
412
+ kind: "secondary",
413
+ onClick: onSecondaryButtonClick,
414
+ ref: secondaryButton,
415
+ children: secondaryButtonText
416
+ }), /* @__PURE__ */ jsx(Button_default, {
417
+ className: primaryButtonClass,
418
+ kind: danger ? "danger" : "primary",
419
+ disabled: loadingActive || primaryButtonDisabled,
420
+ onClick: onRequestSubmit,
421
+ ref: button,
422
+ children: loadingStatus === "inactive" ? primaryButtonText : /* @__PURE__ */ jsx(InlineLoading_default, {
423
+ status: loadingStatus,
424
+ description: loadingDescription,
425
+ iconDescription: loadingIconDescription,
426
+ className: `${prefix}--inline-loading--btn`,
427
+ onSuccess: onLoadingSuccess
428
+ })
429
+ })]
430
+ })
431
+ ]
432
+ }),
433
+ !enableDialogElement && !focusTrapWithoutSentinels && /* @__PURE__ */ jsx("span", {
434
+ ref: endTrap,
435
+ tabIndex: 0,
436
+ role: "link",
437
+ className: `${prefix}--visually-hidden`,
438
+ children: "Focus sentinel"
439
+ })
440
+ ] });
441
+ return /* @__PURE__ */ jsx(Layer, {
442
+ ...rest,
443
+ level: 0,
444
+ onKeyDown: handleKeyDown,
445
+ onClick: composeEventHandlers([rest?.onClick, handleOnClick]),
446
+ onBlur: handleBlur,
447
+ className: modalClasses,
448
+ role: "presentation",
449
+ ref: mergedRefs,
450
+ "data-exiting": presenceContext?.isExiting || void 0,
451
+ children: modalBody
452
+ });
499
453
  });
500
454
  Modal.propTypes = {
501
- /**
502
- * Specify whether the Modal is displaying an alert, error or warning
503
- * Should go hand in hand with the danger prop.
504
- */
505
- alert: PropTypes.bool,
506
- /**
507
- * Required props for the accessibility label of the header
508
- */
509
- ['aria-label']: requiredIfGivenPropIsTruthy('hasScrollingContent', PropTypes.string),
510
- /**
511
- * Provide the contents of your Modal
512
- */
513
- children: PropTypes.node,
514
- /**
515
- * Specify an optional className to be applied to the modal root node
516
- */
517
- className: PropTypes.string,
518
- /**
519
- * Specify label for the close button of the modal; defaults to close
520
- */
521
- closeButtonLabel: PropTypes.string,
522
- /**
523
- * Specify whether the Modal is for dangerous actions
524
- */
525
- danger: PropTypes.bool,
526
- /**
527
- * **Experimental**: Provide a decorator component to be rendered inside the `Modal` component
528
- */
529
- decorator: PropTypes.node,
530
- /**
531
- * Specify whether the modal contains scrolling content
532
- */
533
- hasScrollingContent: PropTypes.bool,
534
- /**
535
- * Specify the DOM element ID of the top-level node.
536
- */
537
- id: PropTypes.string,
538
- /**
539
- * Specify whether or not the Modal content should have any inner padding.
540
- */
541
- isFullWidth: PropTypes.bool,
542
- /**
543
- * Provide a ref to return focus to once the modal is closed.
544
- */
545
- launcherButtonRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
546
- current: PropTypes.oneOfType([
547
- // `PropTypes.instanceOf(HTMLButtonElement)` alone won't work because
548
- // `HTMLButtonElement` is not defined in the test environment even
549
- // though `testEnvironment` is set to `jsdom`.
550
- typeof HTMLButtonElement !== 'undefined' ? PropTypes.instanceOf(HTMLButtonElement) : PropTypes.any, PropTypes.oneOf([null])]).isRequired
551
- })]),
552
- /**
553
- * Specify the description for the loading text
554
- */
555
- loadingDescription: PropTypes.string,
556
- /**
557
- * Specify the description for the loading text
558
- */
559
- loadingIconDescription: PropTypes.string,
560
- /**
561
- * loading status
562
- */
563
- loadingStatus: PropTypes.oneOf(['inactive', 'active', 'finished', 'error']),
564
- /**
565
- * Specify a label to be read by screen readers on the modal root node
566
- */
567
- modalAriaLabel: PropTypes.string,
568
- /**
569
- * Specify the content of the modal header title.
570
- */
571
- modalHeading: PropTypes.node,
572
- /**
573
- * Specify the content of the modal header label.
574
- */
575
- modalLabel: PropTypes.node,
576
- /**
577
- * Specify a handler for keypresses.
578
- */
579
- onKeyDown: PropTypes.func,
580
- /**
581
- * Provide an optional handler to be invoked when loading is
582
- * successful
583
- */
584
- onLoadingSuccess: PropTypes.func,
585
- /**
586
- * Specify a handler for closing modal.
587
- * The handler should care of closing modal, e.g. changing `open` prop.
588
- */
589
- onRequestClose: PropTypes.func,
590
- /**
591
- * Specify a handler for "submitting" modal.
592
- * The handler should care of closing modal, e.g. changing `open` prop, if necessary.
593
- */
594
- onRequestSubmit: PropTypes.func,
595
- /**
596
- * Specify a handler for the secondary button.
597
- * Useful if separate handler from `onRequestClose` is desirable
598
- */
599
- onSecondarySubmit: PropTypes.func,
600
- /**
601
- * Specify whether the Modal is currently open
602
- */
603
- open: PropTypes.bool,
604
- /**
605
- * Specify whether the modal should be button-less
606
- */
607
- passiveModal: PropTypes.bool,
608
- /**
609
- * Prevent closing on click outside of modal
610
- */
611
- preventCloseOnClickOutside: (props, propName) => {
612
- if (!props.passiveModal && props[propName] === false) {
613
- return new Error(invalidOutsideClickMessage);
614
- }
615
- return null;
616
- },
617
- /**
618
- * Specify whether the Button should be disabled, or not
619
- */
620
- primaryButtonDisabled: PropTypes.bool,
621
- /**
622
- * Specify the text for the primary button
623
- */
624
- primaryButtonText: PropTypes.node,
625
- /**
626
- * Specify the text for the secondary button
627
- */
628
- secondaryButtonText: PropTypes.node,
629
- /**
630
- * Specify an array of config objects for secondary buttons
631
- * (`Array<{
632
- * buttonText: string,
633
- * onClick: function,
634
- * }>`).
635
- */
636
- secondaryButtons: (props, propName, componentName) => {
637
- if (props.secondaryButtons) {
638
- if (!Array.isArray(props.secondaryButtons) || props.secondaryButtons.length !== 2) {
639
- return new Error(`${propName} needs to be an array of two button config objects`);
640
- }
641
- const shape = {
642
- buttonText: PropTypes.node,
643
- onClick: PropTypes.func
644
- };
645
- props[propName].forEach(secondaryButton => {
646
- PropTypes.checkPropTypes(shape, secondaryButton, propName, componentName);
647
- });
648
- }
649
- return null;
650
- },
651
- /**
652
- * Specify a CSS selector that matches the DOM element that should
653
- * be focused when the Modal opens
654
- */
655
- selectorPrimaryFocus: PropTypes.string,
656
- /**
657
- * Specify CSS selectors that match DOM elements working as floating menus.
658
- * Focusing on those elements won't trigger "focus-wrap" behavior
659
- */
660
- selectorsFloatingMenus: PropTypes.arrayOf(PropTypes.string.isRequired),
661
- /**
662
- * Specify if Enter key should be used as "submit" action
663
- */
664
- shouldSubmitOnEnter: PropTypes.bool,
665
- /**
666
- * Specify the size variant.
667
- */
668
- size: PropTypes.oneOf(ModalSizes),
669
- slug: deprecate(PropTypes.node, 'The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.')
455
+ alert: PropTypes.bool,
456
+ ["aria-label"]: requiredIfGivenPropIsTruthy("hasScrollingContent", PropTypes.string),
457
+ children: PropTypes.node,
458
+ className: PropTypes.string,
459
+ closeButtonLabel: PropTypes.string,
460
+ danger: PropTypes.bool,
461
+ decorator: PropTypes.node,
462
+ hasScrollingContent: PropTypes.bool,
463
+ id: PropTypes.string,
464
+ isFullWidth: PropTypes.bool,
465
+ launcherButtonRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.oneOfType([typeof HTMLButtonElement !== "undefined" ? PropTypes.instanceOf(HTMLButtonElement) : PropTypes.any, PropTypes.oneOf([null])]).isRequired })]),
466
+ loadingDescription: PropTypes.string,
467
+ loadingIconDescription: PropTypes.string,
468
+ loadingStatus: PropTypes.oneOf([
469
+ "inactive",
470
+ "active",
471
+ "finished",
472
+ "error"
473
+ ]),
474
+ modalAriaLabel: PropTypes.string,
475
+ modalHeading: PropTypes.node,
476
+ modalLabel: PropTypes.node,
477
+ onKeyDown: PropTypes.func,
478
+ onLoadingSuccess: PropTypes.func,
479
+ onRequestClose: PropTypes.func,
480
+ onRequestSubmit: PropTypes.func,
481
+ onSecondarySubmit: PropTypes.func,
482
+ open: PropTypes.bool,
483
+ passiveModal: PropTypes.bool,
484
+ preventCloseOnClickOutside: (props, propName) => {
485
+ if (!props.passiveModal && props[propName] === false) return new Error(invalidOutsideClickMessage);
486
+ return null;
487
+ },
488
+ primaryButtonDisabled: PropTypes.bool,
489
+ primaryButtonText: PropTypes.node,
490
+ secondaryButtonText: PropTypes.node,
491
+ secondaryButtons: (props, propName, componentName) => {
492
+ if (props.secondaryButtons) {
493
+ if (!Array.isArray(props.secondaryButtons) || props.secondaryButtons.length !== 2) return /* @__PURE__ */ new Error(`${propName} needs to be an array of two button config objects`);
494
+ const shape = {
495
+ buttonText: PropTypes.node,
496
+ onClick: PropTypes.func
497
+ };
498
+ props[propName].forEach((secondaryButton) => {
499
+ PropTypes.checkPropTypes(shape, secondaryButton, propName, componentName);
500
+ });
501
+ }
502
+ return null;
503
+ },
504
+ selectorPrimaryFocus: PropTypes.string,
505
+ selectorsFloatingMenus: PropTypes.arrayOf(PropTypes.string.isRequired),
506
+ shouldSubmitOnEnter: PropTypes.bool,
507
+ size: PropTypes.oneOf(ModalSizes),
508
+ slug: deprecate(PropTypes.node, "The `slug` prop has been deprecated and will be removed in the next major version. Use the decorator prop instead.")
670
509
  };
671
510
 
672
- export { ModalSizes, Modal as default };
511
+ //#endregion
512
+ export { Modal as default };