@carbon/react 1.91.0-rc.0 → 1.92.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 (173) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +969 -934
  2. package/es/components/Accordion/AccordionItem.d.ts +12 -1
  3. package/es/components/Accordion/AccordionItem.js +9 -2
  4. package/es/components/Breadcrumb/Breadcrumb.Skeleton.d.ts +27 -2
  5. package/es/components/Breadcrumb/Breadcrumb.Skeleton.js +27 -4
  6. package/es/components/Breadcrumb/Breadcrumb.js +2 -1
  7. package/es/components/Breadcrumb/BreadcrumbItem.js +1 -1
  8. package/es/components/Checkbox/Checkbox.js +2 -2
  9. package/es/components/ComboBox/ComboBox.js +39 -23
  10. package/es/components/ComboButton/index.js +1 -1
  11. package/es/components/ComposedModal/ComposedModal.js +66 -17
  12. package/es/components/ComposedModal/ComposedModalPresence.d.ts +34 -0
  13. package/es/components/ComposedModal/ComposedModalPresence.js +42 -0
  14. package/es/components/ComposedModal/index.d.ts +1 -0
  15. package/es/components/ComposedModal/useComposedModalState.d.ts +7 -0
  16. package/es/components/ComposedModal/useComposedModalState.js +24 -0
  17. package/es/components/ContentSwitcher/ContentSwitcher.js +2 -2
  18. package/es/components/DataTable/TableBatchActions.js +2 -2
  19. package/es/components/DatePickerInput/DatePickerInput.js +2 -2
  20. package/es/components/Dialog/Dialog.js +2 -2
  21. package/es/components/Dropdown/Dropdown.js +5 -5
  22. package/es/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
  23. package/es/components/ExpandableSearch/ExpandableSearch.js +1 -1
  24. package/es/components/FeatureFlags/index.d.ts +2 -1
  25. package/es/components/FeatureFlags/index.js +3 -1
  26. package/es/components/FileUploader/FileUploader.js +2 -2
  27. package/es/components/FileUploader/FileUploaderItem.js +2 -2
  28. package/es/components/FluidTextInput/FluidPasswordInput.js +24 -5
  29. package/es/components/FluidTextInput/index.js +1 -1
  30. package/es/components/FormLabel/FormLabel.js +1 -1
  31. package/es/components/ListBox/ListBox.d.ts +1 -1
  32. package/es/components/ListBox/ListBox.js +1 -2
  33. package/es/components/ListItem/ListItem.js +1 -1
  34. package/es/components/Menu/MenuItem.js +2 -2
  35. package/es/components/MenuButton/index.d.ts +1 -1
  36. package/es/components/MenuButton/index.js +1 -1
  37. package/es/components/Modal/Modal.js +60 -10
  38. package/es/components/Modal/ModalPresence.d.ts +32 -0
  39. package/es/components/Modal/ModalPresence.js +37 -0
  40. package/es/components/Modal/index.d.ts +2 -1
  41. package/es/components/Modal/index.js +1 -0
  42. package/es/components/MultiSelect/FilterableMultiSelect.js +3 -3
  43. package/es/components/MultiSelect/MultiSelect.js +6 -5
  44. package/es/components/Notification/Notification.js +2 -2
  45. package/es/components/NumberInput/NumberInput.d.ts +21 -11
  46. package/es/components/NumberInput/NumberInput.js +40 -26
  47. package/es/components/OverflowMenu/OverflowMenu.js +2 -3
  48. package/es/components/OverflowMenu/next/index.js +1 -1
  49. package/es/components/OverflowMenuItem/OverflowMenuItem.js +1 -1
  50. package/es/components/PageHeader/PageHeader.js +2 -2
  51. package/es/components/PaginationNav/PaginationNav.d.ts +20 -0
  52. package/es/components/PaginationNav/PaginationNav.js +34 -5
  53. package/es/components/ProgressIndicator/ProgressIndicator.js +1 -1
  54. package/es/components/RadioButton/RadioButton.js +3 -3
  55. package/es/components/RadioButtonGroup/RadioButtonGroup.js +2 -2
  56. package/es/components/RadioTile/RadioTile.js +2 -2
  57. package/es/components/Select/Select.js +2 -2
  58. package/es/components/Slider/Slider.js +2 -2
  59. package/es/components/StructuredList/StructuredList.js +2 -2
  60. package/es/components/Tabs/Tabs.js +2 -2
  61. package/es/components/Tag/DismissibleTag.js +3 -3
  62. package/es/components/Tag/OperationalTag.js +3 -3
  63. package/es/components/Tag/SelectableTag.js +3 -3
  64. package/es/components/Tag/Tag.js +2 -2
  65. package/es/components/Text/Text.d.ts +1 -1
  66. package/es/components/Text/Text.js +0 -1
  67. package/es/components/Text/TextDirection.d.ts +1 -1
  68. package/es/components/Text/TextDirection.js +0 -1
  69. package/es/components/Text/createTextComponent.d.ts +2 -8
  70. package/es/components/Text/createTextComponent.js +2 -2
  71. package/es/components/Text/index.d.ts +0 -8
  72. package/es/components/TextArea/TextArea.js +2 -2
  73. package/es/components/TextInput/TextInput.js +2 -2
  74. package/es/components/Tile/Tile.js +2 -2
  75. package/es/components/Toggle/Toggle.js +2 -2
  76. package/es/components/UIShell/Switcher.js +0 -26
  77. package/es/index.d.ts +27 -23
  78. package/es/index.js +44 -41
  79. package/es/internal/useNormalizedInputProps.js +2 -2
  80. package/es/internal/usePresence.d.ts +17 -0
  81. package/es/internal/usePresence.js +66 -0
  82. package/es/internal/usePresenceContext.d.ts +25 -0
  83. package/es/internal/usePresenceContext.js +46 -0
  84. package/es/tools/mergeRefs.d.ts +5 -5
  85. package/es/tools/mergeRefs.js +16 -12
  86. package/lib/components/Accordion/AccordionItem.d.ts +12 -1
  87. package/lib/components/Accordion/AccordionItem.js +9 -2
  88. package/lib/components/Breadcrumb/Breadcrumb.Skeleton.d.ts +27 -2
  89. package/lib/components/Breadcrumb/Breadcrumb.Skeleton.js +27 -4
  90. package/lib/components/Breadcrumb/Breadcrumb.js +2 -1
  91. package/lib/components/Breadcrumb/BreadcrumbItem.js +1 -1
  92. package/lib/components/Checkbox/Checkbox.js +2 -2
  93. package/lib/components/ComboBox/ComboBox.js +39 -23
  94. package/lib/components/ComboButton/index.js +1 -1
  95. package/lib/components/ComposedModal/ComposedModal.js +65 -16
  96. package/lib/components/ComposedModal/ComposedModalPresence.d.ts +34 -0
  97. package/lib/components/ComposedModal/ComposedModalPresence.js +46 -0
  98. package/lib/components/ComposedModal/index.d.ts +1 -0
  99. package/lib/components/ComposedModal/useComposedModalState.d.ts +7 -0
  100. package/lib/components/ComposedModal/useComposedModalState.js +26 -0
  101. package/lib/components/ContentSwitcher/ContentSwitcher.js +1 -1
  102. package/lib/components/DataTable/TableBatchActions.js +2 -2
  103. package/lib/components/DatePickerInput/DatePickerInput.js +2 -2
  104. package/lib/components/Dialog/Dialog.js +2 -2
  105. package/lib/components/Dropdown/Dropdown.js +3 -3
  106. package/lib/components/ExpandableSearch/ExpandableSearch.d.ts +1 -1
  107. package/lib/components/ExpandableSearch/ExpandableSearch.js +1 -1
  108. package/lib/components/FeatureFlags/index.d.ts +2 -1
  109. package/lib/components/FeatureFlags/index.js +3 -1
  110. package/lib/components/FileUploader/FileUploader.js +2 -2
  111. package/lib/components/FileUploader/FileUploaderItem.js +2 -2
  112. package/lib/components/FluidTextInput/FluidPasswordInput.js +26 -5
  113. package/lib/components/FluidTextInput/index.js +2 -1
  114. package/lib/components/FormLabel/FormLabel.js +1 -1
  115. package/lib/components/ListBox/ListBox.d.ts +1 -1
  116. package/lib/components/ListBox/ListBox.js +1 -2
  117. package/lib/components/ListItem/ListItem.js +1 -1
  118. package/lib/components/Menu/MenuItem.js +2 -2
  119. package/lib/components/MenuButton/index.d.ts +1 -1
  120. package/lib/components/MenuButton/index.js +1 -1
  121. package/lib/components/Modal/Modal.js +59 -9
  122. package/lib/components/Modal/ModalPresence.d.ts +32 -0
  123. package/lib/components/Modal/ModalPresence.js +41 -0
  124. package/lib/components/Modal/index.d.ts +2 -1
  125. package/lib/components/Modal/index.js +1 -0
  126. package/lib/components/MultiSelect/FilterableMultiSelect.js +3 -3
  127. package/lib/components/MultiSelect/MultiSelect.js +4 -3
  128. package/lib/components/Notification/Notification.js +2 -2
  129. package/lib/components/NumberInput/NumberInput.d.ts +21 -11
  130. package/lib/components/NumberInput/NumberInput.js +40 -26
  131. package/lib/components/OverflowMenu/OverflowMenu.js +2 -3
  132. package/lib/components/OverflowMenu/next/index.js +1 -1
  133. package/lib/components/OverflowMenuItem/OverflowMenuItem.js +1 -1
  134. package/lib/components/PageHeader/PageHeader.js +2 -2
  135. package/lib/components/PaginationNav/PaginationNav.d.ts +20 -0
  136. package/lib/components/PaginationNav/PaginationNav.js +34 -5
  137. package/lib/components/ProgressIndicator/ProgressIndicator.js +1 -1
  138. package/lib/components/RadioButton/RadioButton.js +3 -3
  139. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +3 -3
  140. package/lib/components/RadioTile/RadioTile.js +2 -2
  141. package/lib/components/Select/Select.js +2 -2
  142. package/lib/components/Slider/Slider.js +2 -2
  143. package/lib/components/StructuredList/StructuredList.js +2 -2
  144. package/lib/components/Tabs/Tabs.js +2 -2
  145. package/lib/components/Tag/DismissibleTag.js +3 -3
  146. package/lib/components/Tag/OperationalTag.js +3 -3
  147. package/lib/components/Tag/SelectableTag.js +3 -3
  148. package/lib/components/Tag/Tag.js +2 -2
  149. package/lib/components/Text/Text.d.ts +1 -1
  150. package/lib/components/Text/Text.js +0 -1
  151. package/lib/components/Text/TextDirection.d.ts +1 -1
  152. package/lib/components/Text/TextDirection.js +0 -1
  153. package/lib/components/Text/createTextComponent.d.ts +2 -8
  154. package/lib/components/Text/createTextComponent.js +2 -2
  155. package/lib/components/Text/index.d.ts +0 -8
  156. package/lib/components/TextArea/TextArea.js +2 -2
  157. package/lib/components/TextInput/TextInput.js +2 -2
  158. package/lib/components/Tile/Tile.js +2 -2
  159. package/lib/components/Toggle/Toggle.js +2 -2
  160. package/lib/components/UIShell/Switcher.js +0 -26
  161. package/lib/index.d.ts +27 -23
  162. package/lib/index.js +55 -6
  163. package/lib/internal/useNormalizedInputProps.js +2 -2
  164. package/lib/internal/usePresence.d.ts +17 -0
  165. package/lib/internal/usePresence.js +68 -0
  166. package/lib/internal/usePresenceContext.d.ts +25 -0
  167. package/lib/internal/usePresenceContext.js +48 -0
  168. package/lib/tools/mergeRefs.d.ts +5 -5
  169. package/lib/tools/mergeRefs.js +16 -14
  170. package/package.json +8 -8
  171. package/telemetry.yml +5 -2
  172. package/es/components/Text/index.js +0 -16
  173. package/lib/components/Text/index.js +0 -20
@@ -7,7 +7,6 @@
7
7
 
8
8
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React from 'react';
10
- import './index.js';
11
10
  import { Text } from './Text.js';
12
11
 
13
12
  /**
@@ -27,5 +26,6 @@ const createTextComponent = (element, displayName) => {
27
26
  }
28
27
  return TextWrapper;
29
28
  };
29
+ const Legend = createTextComponent('legend', 'Legend');
30
30
 
31
- export { createTextComponent };
31
+ export { Legend };
@@ -7,11 +7,3 @@
7
7
  export * from './Text';
8
8
  export * from './TextDirection';
9
9
  export * from './TextDirectionContext';
10
- export declare const Label: {
11
- (props: import("./Text").TextProps<import("react").ElementType>): import("react/jsx-runtime").JSX.Element;
12
- displayName: string;
13
- };
14
- export declare const Legend: {
15
- (props: import("./Text").TextProps<import("react").ElementType>): import("react/jsx-runtime").JSX.Element;
16
- displayName: string;
17
- };
@@ -19,10 +19,10 @@ import useIsomorphicEffect from '../../internal/useIsomorphicEffect.js';
19
19
  import { useMergedRefs } from '../../internal/useMergedRefs.js';
20
20
  import { useId } from '../../internal/useId.js';
21
21
  import { noopFn } from '../../internal/noopFn.js';
22
- import '../Text/index.js';
22
+ import { Text } from '../Text/Text.js';
23
+ import '../Text/TextDirection.js';
23
24
  import { AILabel } from '../AILabel/index.js';
24
25
  import { isComponentElement } from '../../internal/utils.js';
25
- import { Text } from '../Text/Text.js';
26
26
 
27
27
  const frFn = forwardRef;
28
28
  const TextArea = frFn((props, forwardRef) => {
@@ -16,10 +16,10 @@ import { FormContext } from '../FluidForm/FormContext.js';
16
16
  import { useMergedRefs } from '../../internal/useMergedRefs.js';
17
17
  import { usePrefix } from '../../internal/usePrefix.js';
18
18
  import { getAnnouncement } from '../../internal/getAnnouncement.js';
19
- import '../Text/index.js';
19
+ import { Text } from '../Text/Text.js';
20
+ import '../Text/TextDirection.js';
20
21
  import { AILabel } from '../AILabel/index.js';
21
22
  import { isComponentElement } from '../../internal/utils.js';
22
- import { Text } from '../Text/Text.js';
23
23
 
24
24
  const TextInput = /*#__PURE__*/React.forwardRef(({
25
25
  className,
@@ -21,10 +21,10 @@ import { getInteractiveContent, getRoleContent } from '../../internal/useNoInter
21
21
  import { useMergedRefs } from '../../internal/useMergedRefs.js';
22
22
  import { useFeatureFlag } from '../FeatureFlags/index.js';
23
23
  import { useId } from '../../internal/useId.js';
24
- import '../Text/index.js';
24
+ import { Text } from '../Text/Text.js';
25
+ import '../Text/TextDirection.js';
25
26
  import { AILabel } from '../AILabel/index.js';
26
27
  import { isComponentElement } from '../../internal/utils.js';
27
- import { Text } from '../Text/Text.js';
28
28
 
29
29
  var _CheckboxCheckedFille, _Checkbox, _ChevronDown, _ChevronDown2;
30
30
  const Tile = /*#__PURE__*/React.forwardRef(({
@@ -11,8 +11,8 @@ import PropTypes from 'prop-types';
11
11
  import cx from 'classnames';
12
12
  import { useControllableState } from '../../internal/useControllableState.js';
13
13
  import { usePrefix } from '../../internal/usePrefix.js';
14
- import '../Text/index.js';
15
14
  import { Text } from '../Text/Text.js';
15
+ import '../Text/TextDirection.js';
16
16
 
17
17
  var _path;
18
18
  function Toggle({
@@ -101,7 +101,7 @@ function Toggle({
101
101
  className: appearanceClasses
102
102
  }, /*#__PURE__*/React.createElement("div", {
103
103
  className: switchClasses
104
- }, isSm && /*#__PURE__*/React.createElement("svg", {
104
+ }, isSm && !readOnly && /*#__PURE__*/React.createElement("svg", {
105
105
  "aria-hidden": "true",
106
106
  focusable: "false",
107
107
  className: `${prefix}--toggle__check`,
@@ -12,34 +12,8 @@ import { usePrefix } from '../../internal/usePrefix.js';
12
12
  import { useMergedRefs } from '../../internal/useMergedRefs.js';
13
13
  import PropTypes from 'prop-types';
14
14
  import { AriaLabelPropType } from '../../prop-types/AriaPropTypes.js';
15
- import './Content.js';
16
- import './Header.js';
17
- import './HeaderContainer.js';
18
- import './HeaderGlobalAction.js';
19
- import './HeaderGlobalBar.js';
20
- import './HeaderMenu.js';
21
- import './HeaderMenuButton.js';
22
- import './HeaderMenuItem.js';
23
- import './HeaderName.js';
24
- import './HeaderNavigation.js';
25
- import './HeaderPanel.js';
26
- import './HeaderSideNavItems.js';
27
15
  import SwitcherItem from './SwitcherItem.js';
28
16
  import SwitcherDivider from './SwitcherDivider.js';
29
- import './SkipToContent.js';
30
- import './SideNav.js';
31
- import './SideNavDetails.js';
32
- import './SideNavDivider.js';
33
- import './SideNavFooter.js';
34
- import './SideNavHeader.js';
35
- import './SideNavIcon.js';
36
- import './SideNavItem.js';
37
- import './SideNavItems.js';
38
- import './SideNavLink.js';
39
- import './SideNavLinkText.js';
40
- import './SideNavMenu.js';
41
- import './SideNavMenuItem.js';
42
- import './SideNavSwitcher.js';
43
17
 
44
18
  const Switcher = /*#__PURE__*/forwardRef((props, forwardRef) => {
45
19
  const switcherRef = useRef(null);
package/es/index.d.ts CHANGED
@@ -33,7 +33,10 @@ export * from './components/ErrorBoundary';
33
33
  export * from './components/ExpandableSearch';
34
34
  export { FeatureFlags, useFeatureFlag, useFeatureFlags, FeatureFlags as unstable_FeatureFlags, // this export can be removed in v12
35
35
  useFeatureFlag as unstable_useFeatureFlag, // this export can be removed in v12
36
- useFeatureFlags as unstable_useFeatureFlags, } from './components/FeatureFlags';
36
+ useFeatureFlags as unstable_useFeatureFlags, // this export can be removed in v12
37
+ FeatureFlags as preview_FeatureFlags, // this export can be removed in v12
38
+ useFeatureFlag as preview_useFeatureFlag, // this export can be removed in v12
39
+ useFeatureFlags as preview_useFeatureFlags, } from './components/FeatureFlags';
37
40
  export * from './components/FileUploader';
38
41
  export * from './components/FluidForm';
39
42
  export * from './components/Form';
@@ -58,6 +61,7 @@ export * from './components/OrderedList';
58
61
  export * from './components/OverflowMenu';
59
62
  export * from './components/OverflowMenuItem';
60
63
  export * as unstable__PageHeader from './components/PageHeader';
64
+ export * as preview__PageHeader from './components/PageHeader';
61
65
  export * as preview__Dialog from './components/Dialog';
62
66
  export * from './components/Pagination';
63
67
  export * from './components/Pagination/Pagination.Skeleton';
@@ -99,36 +103,36 @@ export * from './components/Toggletip';
99
103
  export * from './components/TreeView';
100
104
  export * from './components/UIShell';
101
105
  export * from './components/UnorderedList';
102
- export { FluidComboBox, FluidComboBoxSkeleton, FluidComboBox as unstable__FluidComboBox, FluidComboBoxSkeleton as unstable__FluidComboBoxSkeleton, } from './components/FluidComboBox';
103
- export { FluidDatePicker, FluidDatePickerSkeleton, FluidDatePicker as unstable__FluidDatePicker, FluidDatePickerSkeleton as unstable__FluidDatePickerSkeleton, } from './components/FluidDatePicker';
104
- export { FluidDatePickerInput, FluidDatePickerInput as unstable__FluidDatePickerInput, } from './components/FluidDatePickerInput';
105
- export { FluidDropdown, FluidDropdownSkeleton, FluidDropdown as unstable__FluidDropdown, FluidDropdownSkeleton as unstable__FluidDropdownSkeleton, } from './components/FluidDropdown';
106
- export { FluidMultiSelect, FluidMultiSelectSkeleton, FluidMultiSelect as unstable__FluidMultiSelect, FluidMultiSelectSkeleton as unstable__FluidMultiSelectSkeleton, } from './components/FluidMultiSelect';
107
- export { FluidSelect, FluidSelectSkeleton, FluidSelect as unstable__FluidSelect, FluidSelectSkeleton as unstable__FluidSelectSkeleton, } from './components/FluidSelect';
108
- export { FluidSearch, FluidSearchSkeleton, FluidSearch as unstable__FluidSearch, FluidSearchSkeleton as unstable__FluidSearchSkeleton, } from './components/FluidSearch';
109
- export { FluidTextArea, FluidTextAreaSkeleton, FluidTextArea as unstable__FluidTextArea, FluidTextAreaSkeleton as unstable__FluidTextAreaSkeleton, } from './components/FluidTextArea';
110
- export { FluidTextInput, FluidTextInputSkeleton, FluidTextInput as unstable__FluidTextInput, FluidTextInputSkeleton as unstable__FluidTextInputSkeleton, } from './components/FluidTextInput';
111
- export { FluidNumberInput, FluidNumberInputSkeleton, FluidNumberInput as unstable__FluidNumberInput, FluidNumberInputSkeleton as unstable__FluidNumberInputSkeleton, } from './components/FluidNumberInput';
112
- export { FluidTimePicker, FluidTimePickerSkeleton, FluidTimePicker as unstable__FluidTimePicker, FluidTimePickerSkeleton as unstable__FluidTimePickerSkeleton, } from './components/FluidTimePicker';
113
- export { FluidTimePickerSelect, FluidTimePickerSelect as unstable__FluidTimePickerSelect, } from './components/FluidTimePickerSelect';
106
+ export { FluidComboBox, FluidComboBoxSkeleton, FluidComboBox as unstable__FluidComboBox, FluidComboBoxSkeleton as unstable__FluidComboBoxSkeleton, FluidComboBox as preview__FluidComboBox, FluidComboBoxSkeleton as preview__FluidComboBoxSkeleton, } from './components/FluidComboBox';
107
+ export { FluidDatePicker, FluidDatePickerSkeleton, FluidDatePicker as unstable__FluidDatePicker, FluidDatePickerSkeleton as unstable__FluidDatePickerSkeleton, FluidDatePicker as preview__FluidDatePicker, FluidDatePickerSkeleton as preview__FluidDatePickerSkeleton, } from './components/FluidDatePicker';
108
+ export { FluidDatePickerInput, FluidDatePickerInput as unstable__FluidDatePickerInput, FluidDatePickerInput as preview__FluidDatePickerInput, } from './components/FluidDatePickerInput';
109
+ export { FluidDropdown, FluidDropdownSkeleton, FluidDropdown as unstable__FluidDropdown, FluidDropdownSkeleton as unstable__FluidDropdownSkeleton, FluidDropdown as preview__FluidDropdown, FluidDropdownSkeleton as preview__FluidDropdownSkeleton, } from './components/FluidDropdown';
110
+ export { FluidMultiSelect, FluidMultiSelectSkeleton, FluidMultiSelect as unstable__FluidMultiSelect, FluidMultiSelectSkeleton as unstable__FluidMultiSelectSkeleton, FluidMultiSelect as preview__FluidMultiSelect, FluidMultiSelectSkeleton as preview__FluidMultiSelectSkeleton, } from './components/FluidMultiSelect';
111
+ export { FluidSelect, FluidSelectSkeleton, FluidSelect as unstable__FluidSelect, FluidSelectSkeleton as unstable__FluidSelectSkeleton, FluidSelect as preview__FluidSelect, FluidSelectSkeleton as preview__FluidSelectSkeleton, } from './components/FluidSelect';
112
+ export { FluidSearch, FluidSearchSkeleton, FluidSearch as unstable__FluidSearch, FluidSearchSkeleton as unstable__FluidSearchSkeleton, FluidSearch as preview__FluidSearch, FluidSearchSkeleton as preview__FluidSearchSkeleton, } from './components/FluidSearch';
113
+ export { FluidTextArea, FluidTextAreaSkeleton, FluidTextArea as unstable__FluidTextArea, FluidTextAreaSkeleton as unstable__FluidTextAreaSkeleton, FluidTextArea as preview__FluidTextArea, FluidTextAreaSkeleton as preview__FluidTextAreaSkeleton, } from './components/FluidTextArea';
114
+ export { FluidPasswordInput, FluidTextInput, FluidTextInputSkeleton, FluidTextInput as unstable__FluidTextInput, FluidTextInputSkeleton as unstable__FluidTextInputSkeleton, FluidTextInput as preview__FluidTextInput, FluidTextInputSkeleton as preview__FluidTextInputSkeleton, } from './components/FluidTextInput';
115
+ export { FluidNumberInput, FluidNumberInputSkeleton, FluidNumberInput as unstable__FluidNumberInput, FluidNumberInputSkeleton as unstable__FluidNumberInputSkeleton, FluidNumberInput as preview__FluidNumberInput, FluidNumberInputSkeleton as preview__FluidNumberInputSkeleton, } from './components/FluidNumberInput';
116
+ export { FluidTimePicker, FluidTimePickerSkeleton, FluidTimePicker as unstable__FluidTimePicker, FluidTimePickerSkeleton as unstable__FluidTimePickerSkeleton, FluidTimePicker as preview__FluidTimePicker, FluidTimePickerSkeleton as preview__FluidTimePickerSkeleton, } from './components/FluidTimePicker';
117
+ export { FluidTimePickerSelect, FluidTimePickerSelect as unstable__FluidTimePickerSelect, FluidTimePickerSelect as preview__FluidTimePickerSelect, } from './components/FluidTimePickerSelect';
114
118
  export * from './components/Heading';
115
119
  export * from './components/IconButton';
116
120
  export * from './components/Layer';
117
- export { Layout as unstable_Layout } from './components/Layout';
118
- export { LayoutDirection as unstable_LayoutDirection, useLayoutDirection as unstable_useLayoutDirection, } from './components/LayoutDirection';
119
- export { OverflowMenuV2 as unstable_OverflowMenuV2 } from './components/OverflowMenuV2';
120
- export { PageSelector as unstable_PageSelector, Pagination as unstable_Pagination, } from './components/Pagination/experimental';
121
+ export { Layout as unstable_Layout, Layout as preview_Layout, } from './components/Layout';
122
+ export { LayoutDirection as unstable_LayoutDirection, useLayoutDirection as unstable_useLayoutDirection, LayoutDirection as preview_LayoutDirection, useLayoutDirection as preview_useLayoutDirection, } from './components/LayoutDirection';
123
+ export { OverflowMenuV2 as unstable_OverflowMenuV2, OverflowMenuV2 as preview_OverflowMenuV2, } from './components/OverflowMenuV2';
124
+ export { PageSelector as unstable_PageSelector, Pagination as unstable_Pagination, PageSelector as preview_PageSelector, Pagination as preview_Pagination, } from './components/Pagination/experimental';
121
125
  export * from './components/Popover';
122
126
  export * from './components/ProgressBar';
123
127
  export { AILabel, AILabelContent, AILabelActions } from './components/AILabel';
124
- export { IconIndicator as unstable__IconIndicator } from './components/IconIndicator';
125
- export { ShapeIndicator as unstable__ShapeIndicator } from './components/ShapeIndicator';
126
- export { AILabel as unstable__Slug, AILabelContent as unstable__SlugContent, AILabelActions as unstable__SlugActions, } from './components/AILabel';
127
- export { ChatButton as unstable__ChatButton, ChatButtonSkeleton as unstable__ChatButtonSkeleton, } from './components/ChatButton';
128
+ export { IconIndicator as unstable__IconIndicator, IconIndicator as preview__IconIndicator, } from './components/IconIndicator';
129
+ export { ShapeIndicator as unstable__ShapeIndicator, ShapeIndicator as preview__ShapeIndicator, } from './components/ShapeIndicator';
130
+ export { AILabel as unstable__Slug, AILabelContent as unstable__SlugContent, AILabelActions as unstable__SlugActions, AILabel as preview__Slug, AILabelContent as preview__SlugContent, AILabelActions as preview__SlugActions, } from './components/AILabel';
131
+ export { ChatButton as unstable__ChatButton, ChatButtonSkeleton as unstable__ChatButtonSkeleton, ChatButton as preview__ChatButton, ChatButtonSkeleton as preview__ChatButtonSkeleton, } from './components/ChatButton';
128
132
  export { AISkeletonText, AISkeletonIcon, AISkeletonPlaceholder, } from './components/AISkeleton';
129
- export { AISkeletonText as unstable__AiSkeletonText, AISkeletonIcon as unstable__AiSkeletonIcon, AISkeletonPlaceholder as unstable__AiSkeletonPlaceholder, } from './components/AISkeleton';
133
+ export { AISkeletonText as unstable__AiSkeletonText, AISkeletonIcon as unstable__AiSkeletonIcon, AISkeletonPlaceholder as unstable__AiSkeletonPlaceholder, AISkeletonText as preview__AiSkeletonText, AISkeletonIcon as preview__AiSkeletonIcon, AISkeletonPlaceholder as preview__AiSkeletonPlaceholder, } from './components/AISkeleton';
130
134
  export * from './components/Tooltip';
131
- export { Text as unstable_Text, TextDirection as unstable_TextDirection, } from './components/Text';
135
+ export { Text as unstable_Text, TextDirection as unstable_TextDirection, Text as preview_Text, TextDirection as preview_TextDirection, } from './components/Text';
132
136
  export * from './components/Tooltip/DefinitionTooltip';
133
137
  export * from './components/Theme';
134
138
  export * from './internal/usePrefix';
package/es/index.js CHANGED
@@ -26,6 +26,7 @@ export { default as CodeSnippetSkeleton } from './components/CodeSnippet/CodeSni
26
26
  export { default as ComboBox } from './components/ComboBox/ComboBox.js';
27
27
  export { ComboButton } from './components/ComboButton/index.js';
28
28
  export { default as ComposedModal, ModalBody } from './components/ComposedModal/ComposedModal.js';
29
+ export { ComposedModalPresence } from './components/ComposedModal/ComposedModalPresence.js';
29
30
  export { ModalHeader } from './components/ComposedModal/ModalHeader.js';
30
31
  export { ModalFooter } from './components/ComposedModal/ModalFooter.js';
31
32
  import './components/ContainedList/index.js';
@@ -66,7 +67,7 @@ export { default as DropdownSkeleton } from './components/Dropdown/Dropdown.Skel
66
67
  export { default as ErrorBoundary } from './components/ErrorBoundary/ErrorBoundary.js';
67
68
  export { ErrorBoundaryContext } from './components/ErrorBoundary/ErrorBoundaryContext.js';
68
69
  export { default as ExpandableSearch } from './components/ExpandableSearch/ExpandableSearch.js';
69
- export { FeatureFlags, FeatureFlags as unstable_FeatureFlags, useFeatureFlag as unstable_useFeatureFlag, useFeatureFlags as unstable_useFeatureFlags, useFeatureFlag, useFeatureFlags } from './components/FeatureFlags/index.js';
70
+ export { FeatureFlags, FeatureFlags as preview_FeatureFlags, useFeatureFlag as preview_useFeatureFlag, useFeatureFlags as preview_useFeatureFlags, FeatureFlags as unstable_FeatureFlags, useFeatureFlag as unstable_useFeatureFlag, useFeatureFlags as unstable_useFeatureFlags, useFeatureFlag, useFeatureFlags } from './components/FeatureFlags/index.js';
70
71
  export { default as FileUploader } from './components/FileUploader/FileUploader.js';
71
72
  export { default as Filename } from './components/FileUploader/Filename.js';
72
73
  export { default as FileUploaderSkeleton } from './components/FileUploader/FileUploader.Skeleton.js';
@@ -95,6 +96,7 @@ export { Menu } from './components/Menu/Menu.js';
95
96
  export { MenuItem, MenuItemDivider, MenuItemGroup, MenuItemRadioGroup, MenuItemSelectable } from './components/Menu/MenuItem.js';
96
97
  export { MenuButton } from './components/MenuButton/index.js';
97
98
  export { default as Modal } from './components/Modal/Modal.js';
99
+ export { ModalPresence } from './components/Modal/ModalPresence.js';
98
100
  export { default as ModalWrapper } from './components/ModalWrapper/ModalWrapper.js';
99
101
  export { FilterableMultiSelect } from './components/MultiSelect/FilterableMultiSelect.js';
100
102
  export { MultiSelect } from './components/MultiSelect/MultiSelect.js';
@@ -105,6 +107,7 @@ export { default as OrderedList } from './components/OrderedList/OrderedList.js'
105
107
  export { default as OverflowMenu } from './components/OverflowMenu/index.js';
106
108
  export { default as OverflowMenuItem } from './components/OverflowMenuItem/OverflowMenuItem.js';
107
109
  import * as index from './components/PageHeader/index.js';
110
+ export { index as preview__PageHeader };
108
111
  export { index as unstable__PageHeader };
109
112
  import * as index$1 from './components/Dialog/index.js';
110
113
  export { index$1 as preview__Dialog };
@@ -191,55 +194,55 @@ export { default as SideNavMenu } from './components/UIShell/SideNavMenu.js';
191
194
  export { default as SideNavMenuItem } from './components/UIShell/SideNavMenuItem.js';
192
195
  export { default as SideNavSwitcher } from './components/UIShell/SideNavSwitcher.js';
193
196
  export { default as UnorderedList } from './components/UnorderedList/UnorderedList.js';
194
- export { default as FluidComboBox, default as unstable__FluidComboBox } from './components/FluidComboBox/FluidComboBox.js';
195
- export { default as FluidComboBoxSkeleton, default as unstable__FluidComboBoxSkeleton } from './components/FluidComboBox/FluidComboBox.Skeleton.js';
196
- export { default as FluidDatePicker, default as unstable__FluidDatePicker } from './components/FluidDatePicker/FluidDatePicker.js';
197
- export { default as FluidDatePickerSkeleton, default as unstable__FluidDatePickerSkeleton } from './components/FluidDatePicker/FluidDatePicker.Skeleton.js';
198
- export { default as FluidDatePickerInput, default as unstable__FluidDatePickerInput } from './components/FluidDatePickerInput/FluidDatePickerInput.js';
199
- export { default as FluidDropdown, default as unstable__FluidDropdown } from './components/FluidDropdown/FluidDropdown.js';
200
- export { default as FluidDropdownSkeleton, default as unstable__FluidDropdownSkeleton } from './components/FluidDropdown/FluidDropdown.Skeleton.js';
201
- export { default as FluidMultiSelect, default as unstable__FluidMultiSelect } from './components/FluidMultiSelect/FluidMultiSelect.js';
202
- export { default as FluidMultiSelectSkeleton, default as unstable__FluidMultiSelectSkeleton } from './components/FluidMultiSelect/FluidMultiSelect.Skeleton.js';
203
- export { default as FluidSelect, default as unstable__FluidSelect } from './components/FluidSelect/FluidSelect.js';
204
- export { default as FluidSelectSkeleton, default as unstable__FluidSelectSkeleton } from './components/FluidSelect/FluidSelect.Skeleton.js';
205
- export { default as FluidSearch, default as unstable__FluidSearch } from './components/FluidSearch/FluidSearch.js';
206
- export { default as FluidSearchSkeleton, default as unstable__FluidSearchSkeleton } from './components/FluidSearch/FluidSearch.Skeleton.js';
207
- export { default as FluidTextArea, default as unstable__FluidTextArea } from './components/FluidTextArea/FluidTextArea.js';
208
- export { default as FluidTextAreaSkeleton, default as unstable__FluidTextAreaSkeleton } from './components/FluidTextArea/FluidTextArea.Skeleton.js';
209
- export { default as FluidTextInput, default as unstable__FluidTextInput } from './components/FluidTextInput/FluidTextInput.js';
210
- import './components/FluidTextInput/FluidPasswordInput.js';
211
- export { default as FluidTextInputSkeleton, default as unstable__FluidTextInputSkeleton } from './components/FluidTextInput/FluidTextInput.Skeleton.js';
212
- export { default as FluidNumberInput, default as unstable__FluidNumberInput } from './components/FluidNumberInput/FluidNumberInput.js';
213
- export { default as FluidNumberInputSkeleton, default as unstable__FluidNumberInputSkeleton } from './components/FluidNumberInput/FluidNumberInput.Skeleton.js';
214
- export { default as FluidTimePicker, default as unstable__FluidTimePicker } from './components/FluidTimePicker/FluidTimePicker.js';
215
- export { default as FluidTimePickerSkeleton, default as unstable__FluidTimePickerSkeleton } from './components/FluidTimePicker/FluidTimePicker.Skeleton.js';
216
- export { default as FluidTimePickerSelect, default as unstable__FluidTimePickerSelect } from './components/FluidTimePickerSelect/FluidTimePickerSelect.js';
197
+ export { default as FluidComboBox, default as preview__FluidComboBox, default as unstable__FluidComboBox } from './components/FluidComboBox/FluidComboBox.js';
198
+ export { default as FluidComboBoxSkeleton, default as preview__FluidComboBoxSkeleton, default as unstable__FluidComboBoxSkeleton } from './components/FluidComboBox/FluidComboBox.Skeleton.js';
199
+ export { default as FluidDatePicker, default as preview__FluidDatePicker, default as unstable__FluidDatePicker } from './components/FluidDatePicker/FluidDatePicker.js';
200
+ export { default as FluidDatePickerSkeleton, default as preview__FluidDatePickerSkeleton, default as unstable__FluidDatePickerSkeleton } from './components/FluidDatePicker/FluidDatePicker.Skeleton.js';
201
+ export { default as FluidDatePickerInput, default as preview__FluidDatePickerInput, default as unstable__FluidDatePickerInput } from './components/FluidDatePickerInput/FluidDatePickerInput.js';
202
+ export { default as FluidDropdown, default as preview__FluidDropdown, default as unstable__FluidDropdown } from './components/FluidDropdown/FluidDropdown.js';
203
+ export { default as FluidDropdownSkeleton, default as preview__FluidDropdownSkeleton, default as unstable__FluidDropdownSkeleton } from './components/FluidDropdown/FluidDropdown.Skeleton.js';
204
+ export { default as FluidMultiSelect, default as preview__FluidMultiSelect, default as unstable__FluidMultiSelect } from './components/FluidMultiSelect/FluidMultiSelect.js';
205
+ export { default as FluidMultiSelectSkeleton, default as preview__FluidMultiSelectSkeleton, default as unstable__FluidMultiSelectSkeleton } from './components/FluidMultiSelect/FluidMultiSelect.Skeleton.js';
206
+ export { default as FluidSelect, default as preview__FluidSelect, default as unstable__FluidSelect } from './components/FluidSelect/FluidSelect.js';
207
+ export { default as FluidSelectSkeleton, default as preview__FluidSelectSkeleton, default as unstable__FluidSelectSkeleton } from './components/FluidSelect/FluidSelect.Skeleton.js';
208
+ export { default as FluidSearch, default as preview__FluidSearch, default as unstable__FluidSearch } from './components/FluidSearch/FluidSearch.js';
209
+ export { default as FluidSearchSkeleton, default as preview__FluidSearchSkeleton, default as unstable__FluidSearchSkeleton } from './components/FluidSearch/FluidSearch.Skeleton.js';
210
+ export { default as FluidTextArea, default as preview__FluidTextArea, default as unstable__FluidTextArea } from './components/FluidTextArea/FluidTextArea.js';
211
+ export { default as FluidTextAreaSkeleton, default as preview__FluidTextAreaSkeleton, default as unstable__FluidTextAreaSkeleton } from './components/FluidTextArea/FluidTextArea.Skeleton.js';
212
+ export { default as FluidTextInput, default as preview__FluidTextInput, default as unstable__FluidTextInput } from './components/FluidTextInput/FluidTextInput.js';
213
+ export { default as FluidPasswordInput } from './components/FluidTextInput/FluidPasswordInput.js';
214
+ export { default as FluidTextInputSkeleton, default as preview__FluidTextInputSkeleton, default as unstable__FluidTextInputSkeleton } from './components/FluidTextInput/FluidTextInput.Skeleton.js';
215
+ export { default as FluidNumberInput, default as preview__FluidNumberInput, default as unstable__FluidNumberInput } from './components/FluidNumberInput/FluidNumberInput.js';
216
+ export { default as FluidNumberInputSkeleton, default as preview__FluidNumberInputSkeleton, default as unstable__FluidNumberInputSkeleton } from './components/FluidNumberInput/FluidNumberInput.Skeleton.js';
217
+ export { default as FluidTimePicker, default as preview__FluidTimePicker, default as unstable__FluidTimePicker } from './components/FluidTimePicker/FluidTimePicker.js';
218
+ export { default as FluidTimePickerSkeleton, default as preview__FluidTimePickerSkeleton, default as unstable__FluidTimePickerSkeleton } from './components/FluidTimePicker/FluidTimePicker.Skeleton.js';
219
+ export { default as FluidTimePickerSelect, default as preview__FluidTimePickerSelect, default as unstable__FluidTimePickerSelect } from './components/FluidTimePickerSelect/FluidTimePickerSelect.js';
217
220
  export { Heading, Section } from './components/Heading/index.js';
218
221
  export { IconButton, IconButtonKinds } from './components/IconButton/index.js';
219
222
  export { Layer, useLayer } from './components/Layer/index.js';
220
- export { Layout as unstable_Layout } from './components/Layout/index.js';
221
- export { LayoutDirection as unstable_LayoutDirection } from './components/LayoutDirection/LayoutDirection.js';
222
- export { useLayoutDirection as unstable_useLayoutDirection } from './components/LayoutDirection/useLayoutDirection.js';
223
- export { OverflowMenuV2 as unstable_OverflowMenuV2 } from './components/OverflowMenuV2/index.js';
223
+ export { Layout as preview_Layout, Layout as unstable_Layout } from './components/Layout/index.js';
224
+ export { LayoutDirection as preview_LayoutDirection, LayoutDirection as unstable_LayoutDirection } from './components/LayoutDirection/LayoutDirection.js';
225
+ export { useLayoutDirection as preview_useLayoutDirection, useLayoutDirection as unstable_useLayoutDirection } from './components/LayoutDirection/useLayoutDirection.js';
226
+ export { OverflowMenuV2 as preview_OverflowMenuV2, OverflowMenuV2 as unstable_OverflowMenuV2 } from './components/OverflowMenuV2/index.js';
224
227
  export { Popover, PopoverContent } from './components/Popover/index.js';
225
228
  export { default as ProgressBar } from './components/ProgressBar/ProgressBar.js';
226
- export { AILabel, AILabelActions, AILabelContent, AILabel as unstable__Slug, AILabelActions as unstable__SlugActions, AILabelContent as unstable__SlugContent } from './components/AILabel/index.js';
227
- export { IconIndicator as unstable__IconIndicator } from './components/IconIndicator/index.js';
228
- export { ShapeIndicator as unstable__ShapeIndicator } from './components/ShapeIndicator/index.js';
229
- export { default as unstable__ChatButton } from './components/ChatButton/ChatButton.js';
230
- export { default as unstable__ChatButtonSkeleton } from './components/ChatButton/ChatButton.Skeleton.js';
231
- export { default as AISkeletonPlaceholder, default as unstable__AiSkeletonPlaceholder } from './components/AISkeleton/AISkeletonPlaceholder.js';
232
- export { default as AISkeletonIcon, default as unstable__AiSkeletonIcon } from './components/AISkeleton/AISkeletonIcon.js';
233
- export { default as AISkeletonText, default as unstable__AiSkeletonText } from './components/AISkeleton/AISkeletonText.js';
229
+ export { AILabel, AILabelActions, AILabelContent, AILabel as preview__Slug, AILabelActions as preview__SlugActions, AILabelContent as preview__SlugContent, AILabel as unstable__Slug, AILabelActions as unstable__SlugActions, AILabelContent as unstable__SlugContent } from './components/AILabel/index.js';
230
+ export { IconIndicator as preview__IconIndicator, IconIndicator as unstable__IconIndicator } from './components/IconIndicator/index.js';
231
+ export { ShapeIndicator as preview__ShapeIndicator, ShapeIndicator as unstable__ShapeIndicator } from './components/ShapeIndicator/index.js';
232
+ export { default as preview__ChatButton, default as unstable__ChatButton } from './components/ChatButton/ChatButton.js';
233
+ export { default as preview__ChatButtonSkeleton, default as unstable__ChatButtonSkeleton } from './components/ChatButton/ChatButton.Skeleton.js';
234
+ export { default as AISkeletonPlaceholder, default as preview__AiSkeletonPlaceholder, default as unstable__AiSkeletonPlaceholder } from './components/AISkeleton/AISkeletonPlaceholder.js';
235
+ export { default as AISkeletonIcon, default as preview__AiSkeletonIcon, default as unstable__AiSkeletonIcon } from './components/AISkeleton/AISkeletonIcon.js';
236
+ export { default as AISkeletonText, default as preview__AiSkeletonText, default as unstable__AiSkeletonText } from './components/AISkeleton/AISkeletonText.js';
234
237
  export { DefinitionTooltip } from './components/Tooltip/DefinitionTooltip.js';
235
238
  export { Tooltip } from './components/Tooltip/Tooltip.js';
236
- import './components/Text/index.js';
239
+ export { Text as preview_Text, Text as unstable_Text } from './components/Text/Text.js';
240
+ export { TextDirection as preview_TextDirection, TextDirection as unstable_TextDirection } from './components/Text/TextDirection.js';
241
+ import 'react';
237
242
  export { GlobalTheme, Theme, ThemeContext, usePrefersDarkScheme, useTheme } from './components/Theme/index.js';
238
243
  export { PrefixContext, usePrefix } from './internal/usePrefix.js';
239
244
  export { useIdPrefix } from './internal/useIdPrefix.js';
240
- export { default as unstable_PageSelector } from './components/Pagination/experimental/PageSelector.js';
241
- export { default as unstable_Pagination } from './components/Pagination/experimental/Pagination.js';
245
+ export { default as preview_PageSelector, default as unstable_PageSelector } from './components/Pagination/experimental/PageSelector.js';
246
+ export { default as preview_Pagination, default as unstable_Pagination } from './components/Pagination/experimental/Pagination.js';
242
247
  export { default as ContainedListItem } from './components/ContainedList/ContainedListItem/ContainedListItem.js';
243
248
  export { default as ContainedList } from './components/ContainedList/ContainedList.js';
244
- export { Text as unstable_Text } from './components/Text/Text.js';
245
- export { TextDirection as unstable_TextDirection } from './components/Text/TextDirection.js';
@@ -7,9 +7,9 @@
7
7
 
8
8
  import React from 'react';
9
9
  import { WarningFilled, WarningAltFilled } from '@carbon/icons-react';
10
- import '../components/Text/index.js';
11
- import { usePrefix } from './usePrefix.js';
12
10
  import { Text } from '../components/Text/Text.js';
11
+ import '../components/Text/TextDirection.js';
12
+ import { usePrefix } from './usePrefix.js';
13
13
 
14
14
  /**
15
15
  * Returns an object containing normalized properties for an input component.
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright IBM Corp. 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { type RefObject } from 'react';
8
+ export declare const usePresence: (ref: RefObject<HTMLElement | null>, isOpen: boolean) => {
9
+ /**
10
+ * Indicates whether the ref object is supposed to be mounted
11
+ */
12
+ isPresent: boolean;
13
+ /**
14
+ * Indicates whether the ref object is currently exiting
15
+ */
16
+ isExiting: boolean;
17
+ };
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { useState, useCallback, useLayoutEffect } from 'react';
9
+ import { usePrefix } from './usePrefix.js';
10
+
11
+ const usePresence = (ref, isOpen) => {
12
+ const prefix = usePrefix();
13
+ const [exitState, setExitState] = useState(isOpen ? 'idle' : 'finished');
14
+ const isExiting = exitState === 'active';
15
+
16
+ // element is exiting
17
+ if (!isOpen && exitState === 'idle') {
18
+ setExitState('active');
19
+ }
20
+
21
+ // element exit was interrupted
22
+ if (isOpen && exitState !== 'idle') {
23
+ setExitState('idle');
24
+ }
25
+ const handleAnimationEnd = useCallback(() => {
26
+ setExitState('finished');
27
+ }, []);
28
+ useLayoutEffect(() => {
29
+ if (!ref.current || !isExiting) return;
30
+
31
+ // resolve for JSDOM
32
+ if (!('getAnimations' in ref.current)) {
33
+ handleAnimationEnd();
34
+ return;
35
+ }
36
+
37
+ // cover all animations that start with the presence prefix
38
+ const animations = ref.current.getAnimations({
39
+ subtree: true
40
+ }).filter(animation => animation instanceof CSSAnimation && animation.animationName.startsWith(`${prefix}--presence`));
41
+ if (!animations.length) {
42
+ handleAnimationEnd();
43
+ return;
44
+ }
45
+ let cancelled = false;
46
+ Promise.all(animations.map(animation => animation.finished)).finally(() => {
47
+ if (cancelled) return;
48
+ handleAnimationEnd();
49
+ });
50
+ return () => {
51
+ cancelled = true;
52
+ };
53
+ }, [ref, isExiting, prefix, handleAnimationEnd]);
54
+ return {
55
+ /**
56
+ * Indicates whether the ref object is supposed to be mounted
57
+ */
58
+ isPresent: isOpen || exitState !== 'finished',
59
+ /**
60
+ * Indicates whether the ref object is currently exiting
61
+ */
62
+ isExiting
63
+ };
64
+ };
65
+
66
+ export { usePresence };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright IBM Corp. 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { type RefObject } from 'react';
8
+ export interface PresenceContext {
9
+ /**
10
+ * The ref object the presence mode is mounted with
11
+ */
12
+ presenceRef: RefObject<HTMLDivElement | null>;
13
+ /**
14
+ * Indicates whether the ref object is currently exiting
15
+ */
16
+ isExiting: boolean;
17
+ /**
18
+ * Returns if the caller is exclusive to this presence context
19
+ */
20
+ isPresenceExclusive: (id: string) => boolean;
21
+ }
22
+ /**
23
+ * Returns if the presence node is present and the context value to be used by a presence context, e.g. ModalPresence.
24
+ */
25
+ export declare const usePresenceContext: (open: boolean, initialPresenceId?: string) => readonly [boolean, PresenceContext];
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { useRef, useCallback, useMemo } from 'react';
9
+ import { usePresence } from './usePresence.js';
10
+
11
+ /**
12
+ * Returns if the presence node is present and the context value to be used by a presence context, e.g. ModalPresence.
13
+ */
14
+ const usePresenceContext = (open, initialPresenceId) => {
15
+ const presenceIdRef = useRef(initialPresenceId);
16
+ const presenceRef = useRef(null);
17
+ const prevPresenceRef = useRef(null);
18
+
19
+ // clean up the presence id, if not predefined and if the presence node was unmounted
20
+ if (!initialPresenceId && prevPresenceRef.current && !presenceRef.current) {
21
+ presenceIdRef.current = null;
22
+ }
23
+ prevPresenceRef.current = presenceRef.current;
24
+ const {
25
+ isPresent,
26
+ isExiting
27
+ } = usePresence(presenceRef, open);
28
+ const isPresenceExclusive = useCallback(id => {
29
+ if (!id) return false;
30
+
31
+ // return false if the presence context is occupied
32
+ if (presenceIdRef.current && presenceIdRef.current !== id) return false;
33
+
34
+ // otherwise occupy presence context and return true
35
+ presenceIdRef.current = id;
36
+ return true;
37
+ }, []);
38
+ const contextValue = useMemo(() => ({
39
+ presenceRef,
40
+ isPresenceExclusive,
41
+ isExiting
42
+ }), [presenceRef, isPresenceExclusive, isExiting]);
43
+ return [isPresent, contextValue];
44
+ };
45
+
46
+ export { usePresenceContext };
@@ -1,12 +1,12 @@
1
- export default mergeRefs;
2
1
  /**
3
- * Copyright IBM Corp. 2016, 2023
2
+ * Copyright IBM Corp. 2016, 2025
4
3
  *
5
4
  * This source code is licensed under the Apache-2.0 license found in the
6
5
  * LICENSE file in the root directory of this source tree.
7
6
  */
7
+ import type { Ref, RefCallback } from 'react';
8
8
  /**
9
- * @param {...Ref<Element>} refs List of React refs to merge.
10
- * @returns {Ref<Element>} Merged React ref.
9
+ * @param refs Refs to merge.
10
+ * @returns Merged ref.
11
11
  */
12
- declare function mergeRefs(...refs: Ref<Element>[]): Ref<Element>;
12
+ export declare const mergeRefs: <T>(...refs: (Ref<T> | null | undefined)[]) => RefCallback<T>;
@@ -6,18 +6,22 @@
6
6
  */
7
7
 
8
8
  /**
9
- * @param {...Ref<Element>} refs List of React refs to merge.
10
- * @returns {Ref<Element>} Merged React ref.
9
+ * @param refs Refs to merge.
10
+ * @returns Merged ref.
11
11
  */
12
- const mergeRefs = (...refs) => el => {
13
- refs.forEach(ref => {
14
- // https://github.com/facebook/react/issues/13029#issuecomment-410002316
15
- if (typeof ref === 'function') {
16
- ref(el);
17
- } else if (Object(ref) === ref) {
18
- ref.current = el;
19
- }
20
- });
12
+ const mergeRefs = (...refs) => {
13
+ return value => {
14
+ refs.forEach(ref => {
15
+ if (!ref) return;
16
+
17
+ // https://github.com/facebook/react/issues/13029#issuecomment-410002316
18
+ if (typeof ref === 'function') {
19
+ ref(value);
20
+ } else if (typeof ref === 'object' && 'current' in ref) {
21
+ ref.current = value;
22
+ }
23
+ });
24
+ };
21
25
  };
22
26
 
23
- export { mergeRefs as default };
27
+ export { mergeRefs };
@@ -12,6 +12,11 @@ export interface AccordionItemProps {
12
12
  * this value will be managed by the parent Accordion.
13
13
  */
14
14
  disabled?: boolean;
15
+ /**
16
+ * Specify a custom label for the accordion button.
17
+ * This is important for accessibility when the accordion has no visible title.
18
+ */
19
+ 'aria-label'?: AriaAttributes['aria-label'];
15
20
  /**
16
21
  * The handler of the massaged `click` event.
17
22
  */
@@ -52,6 +57,7 @@ export interface AccordionItemProps {
52
57
  export interface AccordionToggleProps {
53
58
  'aria-controls'?: AriaAttributes['aria-controls'];
54
59
  'aria-expanded'?: AriaAttributes['aria-expanded'];
60
+ 'aria-label'?: AriaAttributes['aria-label'];
55
61
  className?: string;
56
62
  disabled?: boolean;
57
63
  onClick?: MouseEventHandler<HTMLButtonElement>;
@@ -59,7 +65,7 @@ export interface AccordionToggleProps {
59
65
  type?: 'button';
60
66
  }
61
67
  declare function AccordionItem({ children, className: customClassName, open, onHeadingClick, renderExpando, // remove renderExpando in next major release
62
- renderToggle, title, disabled: controlledDisabled, handleAnimationEnd, ...rest }: PropsWithChildren<AccordionItemProps>): import("react/jsx-runtime").JSX.Element;
68
+ renderToggle, title, disabled: controlledDisabled, handleAnimationEnd, 'aria-label': ariaLabel, ...rest }: PropsWithChildren<AccordionItemProps>): import("react/jsx-runtime").JSX.Element;
63
69
  declare namespace AccordionItem {
64
70
  var propTypes: {
65
71
  /**
@@ -74,6 +80,11 @@ declare namespace AccordionItem {
74
80
  * Specify whether an individual AccordionItem should be disabled
75
81
  */
76
82
  disabled: PropTypes.Requireable<boolean>;
83
+ /**
84
+ * Specify a custom label for the accordion button.
85
+ * This is important for accessibility when the accordion has no visible title.
86
+ */
87
+ 'aria-label': PropTypes.Requireable<string>;
77
88
  /**
78
89
  * The handler of the massaged `click` event.
79
90
  */