@carbon/react 1.31.2 → 1.32.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 (184) hide show
  1. package/README.md +1 -1
  2. package/es/components/Accordion/Accordion.Skeleton.d.ts +64 -0
  3. package/es/components/Accordion/Accordion.Skeleton.js +3 -3
  4. package/es/components/Accordion/Accordion.d.ts +65 -0
  5. package/es/components/Accordion/Accordion.js +5 -6
  6. package/es/components/Accordion/AccordionItem.d.ts +105 -0
  7. package/es/components/Accordion/AccordionItem.js +12 -9
  8. package/es/components/Accordion/AccordionProvider.d.ts +20 -0
  9. package/es/components/Accordion/AccordionProvider.js +25 -0
  10. package/es/components/Accordion/index.d.ts +11 -0
  11. package/es/components/Button/Button.Skeleton.d.ts +28 -0
  12. package/es/components/Button/Button.Skeleton.js +5 -3
  13. package/es/components/Button/Button.d.ts +72 -0
  14. package/es/components/Button/Button.js +13 -10
  15. package/es/components/Button/index.d.ts +11 -0
  16. package/es/components/Button/index.js +2 -1
  17. package/es/components/ButtonSet/ButtonSet.d.ts +17 -0
  18. package/es/components/ButtonSet/ButtonSet.js +1 -2
  19. package/es/components/ButtonSet/index.d.ts +9 -0
  20. package/es/components/CodeSnippet/CodeSnippet.js +1 -0
  21. package/es/components/ComboButton/index.js +1 -0
  22. package/es/components/ComposedModal/ComposedModal.d.ts +70 -0
  23. package/es/components/ComposedModal/ComposedModal.js +58 -67
  24. package/es/components/ComposedModal/ModalFooter.d.ts +71 -0
  25. package/es/components/ComposedModal/ModalFooter.js +22 -19
  26. package/es/components/ComposedModal/ModalHeader.d.ts +58 -0
  27. package/es/components/ComposedModal/ModalHeader.js +8 -25
  28. package/es/components/ComposedModal/index.d.ts +9 -0
  29. package/es/components/ContainedList/ContainedList.js +12 -1
  30. package/es/components/ContentSwitcher/ContentSwitcher.d.ts +109 -0
  31. package/es/components/ContentSwitcher/ContentSwitcher.js +14 -6
  32. package/es/components/DangerButton/DangerButton.d.ts +9 -0
  33. package/es/components/DangerButton/DangerButton.js +2 -2
  34. package/es/components/DangerButton/index.d.ts +9 -0
  35. package/es/components/DataTable/TableBatchAction.js +1 -0
  36. package/es/components/DataTable/TableBatchActions.js +1 -0
  37. package/es/components/DataTable/TableBody.d.ts +29 -0
  38. package/es/components/DataTable/TableBody.js +2 -3
  39. package/es/components/DataTable/TableContainer.d.ts +51 -0
  40. package/es/components/DataTable/TableContainer.js +3 -4
  41. package/es/components/DataTable/TableExpandHeader.d.ts +86 -0
  42. package/es/components/DataTable/TableExpandHeader.js +4 -5
  43. package/es/components/DatePicker/plugins/fixEventsPlugin.js +12 -16
  44. package/es/components/Dropdown/Dropdown.js +1 -0
  45. package/es/components/FluidTextInput/FluidTextInput.js +1 -0
  46. package/es/components/FormGroup/FormGroup.d.ts +80 -0
  47. package/es/components/IconButton/index.js +3 -2
  48. package/es/components/Layout/index.d.ts +74 -0
  49. package/es/components/Layout/index.js +14 -5
  50. package/es/components/Link/Link.d.ts +2 -2
  51. package/es/components/Link/Link.js +2 -1
  52. package/es/components/MenuButton/index.js +1 -0
  53. package/es/components/Modal/Modal.js +1 -0
  54. package/es/components/ModalWrapper/ModalWrapper.js +1 -0
  55. package/es/components/Notification/Notification.d.ts +531 -0
  56. package/es/components/Notification/Notification.js +40 -6
  57. package/es/components/Notification/index.d.ts +7 -0
  58. package/es/components/PrimaryButton/PrimaryButton.js +1 -0
  59. package/es/components/SecondaryButton/SecondaryButton.js +1 -0
  60. package/es/components/Select/Select.d.ts +1 -1
  61. package/es/components/SkeletonText/SkeletonText.d.ts +61 -0
  62. package/es/components/SkeletonText/SkeletonText.js +15 -17
  63. package/es/components/SkeletonText/index.d.ts +9 -0
  64. package/es/components/Switch/Switch.d.ts +56 -0
  65. package/es/components/Switch/Switch.js +4 -4
  66. package/es/components/Tab/index.d.ts +9 -0
  67. package/es/components/TabContent/TabContent.d.ts +40 -0
  68. package/es/components/TabContent/TabContent.js +6 -12
  69. package/es/components/TabContent/index.d.ts +10 -0
  70. package/es/components/Tabs/Tabs.Skeleton.d.ts +33 -0
  71. package/es/components/Tabs/Tabs.Skeleton.js +2 -2
  72. package/es/components/Tabs/Tabs.d.ts +303 -0
  73. package/es/components/Tabs/Tabs.js +136 -95
  74. package/es/components/Tabs/index.d.ts +10 -0
  75. package/es/components/Tabs/usePressable.js +11 -0
  76. package/es/components/TextInput/ControlledPasswordInput.d.ts +90 -0
  77. package/es/components/TextInput/ControlledPasswordInput.js +5 -6
  78. package/es/components/Tile/Tile.d.ts +153 -0
  79. package/es/components/Tile/Tile.js +62 -74
  80. package/es/components/Tile/index.d.ts +7 -0
  81. package/es/components/Toggle/Toggle.Skeleton.d.ts +3 -47
  82. package/es/components/Toggle/Toggle.Skeleton.js +24 -64
  83. package/es/components/Toggle/Toggle.js +1 -1
  84. package/es/components/UIShell/HeaderGlobalAction.js +1 -0
  85. package/es/components/UIShell/SideNav.d.ts +1 -1
  86. package/es/index.js +16 -16
  87. package/es/internal/keyboard/match.js +2 -2
  88. package/es/internal/useControllableState.js +2 -2
  89. package/es/internal/wrapFocus.js +6 -6
  90. package/es/prop-types/requiredIfGivenPropIsTruthy.js +1 -1
  91. package/es/prop-types/types.js +3 -0
  92. package/lib/components/Accordion/Accordion.Skeleton.d.ts +64 -0
  93. package/lib/components/Accordion/Accordion.Skeleton.js +3 -3
  94. package/lib/components/Accordion/Accordion.d.ts +65 -0
  95. package/lib/components/Accordion/Accordion.js +5 -6
  96. package/lib/components/Accordion/AccordionItem.d.ts +105 -0
  97. package/lib/components/Accordion/AccordionItem.js +11 -8
  98. package/lib/components/Accordion/AccordionProvider.d.ts +20 -0
  99. package/lib/components/Accordion/AccordionProvider.js +34 -0
  100. package/lib/components/Accordion/index.d.ts +11 -0
  101. package/lib/components/Button/Button.Skeleton.d.ts +28 -0
  102. package/lib/components/Button/Button.Skeleton.js +5 -3
  103. package/lib/components/Button/Button.d.ts +72 -0
  104. package/lib/components/Button/Button.js +18 -11
  105. package/lib/components/Button/index.d.ts +11 -0
  106. package/lib/components/Button/index.js +6 -0
  107. package/lib/components/ButtonSet/ButtonSet.d.ts +17 -0
  108. package/lib/components/ButtonSet/ButtonSet.js +1 -2
  109. package/lib/components/ButtonSet/index.d.ts +9 -0
  110. package/lib/components/CodeSnippet/CodeSnippet.js +1 -0
  111. package/lib/components/ComboButton/index.js +1 -0
  112. package/lib/components/ComposedModal/ComposedModal.d.ts +70 -0
  113. package/lib/components/ComposedModal/ComposedModal.js +58 -67
  114. package/lib/components/ComposedModal/ModalFooter.d.ts +71 -0
  115. package/lib/components/ComposedModal/ModalFooter.js +22 -19
  116. package/lib/components/ComposedModal/ModalHeader.d.ts +58 -0
  117. package/lib/components/ComposedModal/ModalHeader.js +8 -25
  118. package/lib/components/ComposedModal/index.d.ts +9 -0
  119. package/lib/components/ContainedList/ContainedList.js +12 -1
  120. package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +109 -0
  121. package/lib/components/ContentSwitcher/ContentSwitcher.js +14 -6
  122. package/lib/components/DangerButton/DangerButton.d.ts +9 -0
  123. package/lib/components/DangerButton/DangerButton.js +2 -2
  124. package/lib/components/DangerButton/index.d.ts +9 -0
  125. package/lib/components/DataTable/TableBatchAction.js +1 -0
  126. package/lib/components/DataTable/TableBatchActions.js +1 -0
  127. package/lib/components/DataTable/TableBody.d.ts +29 -0
  128. package/lib/components/DataTable/TableBody.js +3 -4
  129. package/lib/components/DataTable/TableContainer.d.ts +51 -0
  130. package/lib/components/DataTable/TableContainer.js +3 -4
  131. package/lib/components/DataTable/TableExpandHeader.d.ts +86 -0
  132. package/lib/components/DataTable/TableExpandHeader.js +4 -5
  133. package/lib/components/DatePicker/plugins/fixEventsPlugin.js +12 -16
  134. package/lib/components/Dropdown/Dropdown.js +1 -0
  135. package/lib/components/FluidTextInput/FluidTextInput.js +1 -0
  136. package/lib/components/FormGroup/FormGroup.d.ts +80 -0
  137. package/lib/components/IconButton/index.js +3 -2
  138. package/lib/components/Layout/index.d.ts +74 -0
  139. package/lib/components/Layout/index.js +14 -5
  140. package/lib/components/Link/Link.d.ts +2 -2
  141. package/lib/components/Link/Link.js +2 -1
  142. package/lib/components/MenuButton/index.js +1 -0
  143. package/lib/components/Modal/Modal.js +1 -0
  144. package/lib/components/ModalWrapper/ModalWrapper.js +1 -0
  145. package/lib/components/Notification/Notification.d.ts +531 -0
  146. package/lib/components/Notification/Notification.js +40 -6
  147. package/lib/components/Notification/index.d.ts +7 -0
  148. package/lib/components/PrimaryButton/PrimaryButton.js +1 -0
  149. package/lib/components/SecondaryButton/SecondaryButton.js +1 -0
  150. package/lib/components/Select/Select.d.ts +1 -1
  151. package/lib/components/SkeletonText/SkeletonText.d.ts +61 -0
  152. package/lib/components/SkeletonText/SkeletonText.js +15 -17
  153. package/lib/components/SkeletonText/index.d.ts +9 -0
  154. package/lib/components/Switch/Switch.d.ts +56 -0
  155. package/lib/components/Switch/Switch.js +4 -4
  156. package/lib/components/Tab/index.d.ts +9 -0
  157. package/lib/components/TabContent/TabContent.d.ts +40 -0
  158. package/lib/components/TabContent/TabContent.js +6 -12
  159. package/lib/components/TabContent/index.d.ts +10 -0
  160. package/lib/components/Tabs/Tabs.Skeleton.d.ts +33 -0
  161. package/lib/components/Tabs/Tabs.Skeleton.js +2 -2
  162. package/lib/components/Tabs/Tabs.d.ts +303 -0
  163. package/lib/components/Tabs/Tabs.js +135 -94
  164. package/lib/components/Tabs/index.d.ts +10 -0
  165. package/lib/components/Tabs/usePressable.js +11 -0
  166. package/lib/components/TextInput/ControlledPasswordInput.d.ts +90 -0
  167. package/lib/components/TextInput/ControlledPasswordInput.js +5 -6
  168. package/lib/components/Tile/Tile.d.ts +153 -0
  169. package/lib/components/Tile/Tile.js +62 -74
  170. package/lib/components/Tile/index.d.ts +7 -0
  171. package/lib/components/Toggle/Toggle.Skeleton.d.ts +3 -47
  172. package/lib/components/Toggle/Toggle.Skeleton.js +22 -62
  173. package/lib/components/Toggle/Toggle.js +1 -1
  174. package/lib/components/UIShell/HeaderGlobalAction.js +1 -0
  175. package/lib/components/UIShell/SideNav.d.ts +1 -1
  176. package/lib/index.js +51 -47
  177. package/lib/internal/keyboard/match.js +2 -2
  178. package/lib/internal/useControllableState.js +2 -2
  179. package/lib/internal/wrapFocus.js +6 -6
  180. package/lib/prop-types/requiredIfGivenPropIsTruthy.js +1 -1
  181. package/lib/prop-types/types.js +3 -0
  182. package/package.json +4 -3
  183. package/scss/components/contained-list/_contained-list.scss +9 -0
  184. package/scss/components/contained-list/_index.scss +9 -0
@@ -20,5 +20,5 @@ interface SideNavProps extends ComponentProps<'nav'> {
20
20
  onSideNavBlur?: () => void | undefined;
21
21
  enterDelayMs?: number;
22
22
  }
23
- declare const SideNav: React.ForwardRefExoticComponent<Pick<SideNavProps, "children" | "className" | "slot" | "style" | "title" | "dir" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "onToggle" | "key" | "id" | "onAnimationEnd" | "aria-controls" | "aria-expanded" | "onClick" | "onKeyDown" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "href" | "enterDelayMs" | "expanded" | "defaultExpanded" | "isChildOfHeader" | "isFixedNav" | "isRail" | "isPersistent" | "addFocusListeners" | "addMouseListeners" | "onOverlayClick" | "onSideNavBlur"> & React.RefAttributes<HTMLElement>>;
23
+ declare const SideNav: React.ForwardRefExoticComponent<Pick<SideNavProps, "children" | "slot" | "style" | "title" | "className" | "dir" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "onToggle" | "key" | "id" | "aria-controls" | "aria-expanded" | "onClick" | "onAnimationEnd" | "onKeyDown" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "href" | "expanded" | "enterDelayMs" | "defaultExpanded" | "isChildOfHeader" | "isFixedNav" | "isRail" | "isPersistent" | "addFocusListeners" | "addMouseListeners" | "onOverlayClick" | "onSideNavBlur"> & React.RefAttributes<HTMLElement>>;
24
24
  export default SideNav;
package/es/index.js CHANGED
@@ -6,12 +6,22 @@
6
6
  */
7
7
 
8
8
  import './feature-flags.js';
9
+ export { default as Accordion } from './components/Accordion/Accordion.js';
10
+ export { default as AccordionItem } from './components/Accordion/AccordionItem.js';
11
+ export { default as AccordionSkeleton } from './components/Accordion/Accordion.Skeleton.js';
9
12
  export { default as AspectRatio } from './components/AspectRatio/AspectRatio.js';
13
+ export { default as Button, ButtonKinds, ButtonSizes, ButtonTooltipAlignments, ButtonTooltipPositions } from './components/Button/Button.js';
14
+ export { default as ButtonSkeleton } from './components/Button/Button.Skeleton.js';
15
+ export { default as ButtonSet } from './components/ButtonSet/ButtonSet.js';
10
16
  export { default as Checkbox } from './components/Checkbox/Checkbox.js';
11
17
  export { default as CheckboxSkeleton } from './components/Checkbox/Checkbox.Skeleton.js';
12
18
  export { ClassPrefix } from './components/ClassPrefix/index.js';
13
19
  export { ComboButton } from './components/ComboButton/index.js';
20
+ export { default as ComposedModal, ModalBody } from './components/ComposedModal/ComposedModal.js';
21
+ export { ModalHeader } from './components/ComposedModal/ModalHeader.js';
22
+ export { ModalFooter } from './components/ComposedModal/ModalFooter.js';
14
23
  export { default as ContentSwitcher } from './components/ContentSwitcher/index.js';
24
+ export { default as DangerButton } from './components/DangerButton/DangerButton.js';
15
25
  import './components/DataTable/index.js';
16
26
  export { default as DataTableSkeleton } from './components/DataTableSkeleton/DataTableSkeleton.js';
17
27
  export { default as DatePicker } from './components/DatePicker/DatePicker.js';
@@ -31,17 +41,23 @@ export { IdPrefix } from './components/IdPrefix/index.js';
31
41
  export { default as Link } from './components/Link/Link.js';
32
42
  export { default as ListItem } from './components/ListItem/ListItem.js';
33
43
  export { MenuButton } from './components/MenuButton/index.js';
44
+ export { ActionableNotification, InlineNotification, NotificationActionButton, NotificationButton, ToastNotification } from './components/Notification/Notification.js';
34
45
  export { default as OrderedList } from './components/OrderedList/OrderedList.js';
35
46
  export { default as OverflowMenu } from './components/OverflowMenu/index.js';
36
47
  export { default as PaginationSkeleton } from './components/Pagination/Pagination.Skeleton.js';
37
48
  export { default as RadioButtonSkeleton } from './components/RadioButton/RadioButton.Skeleton.js';
38
49
  export { default as Search } from './components/Search/Search.js';
39
50
  export { default as SearchSkeleton } from './components/Search/Search.Skeleton.js';
51
+ export { default as SkeletonText } from './components/SkeletonText/SkeletonText.js';
40
52
  export { default as Slider } from './components/Slider/index.js';
53
+ export { IconTab, Tab, TabList, TabPanel, TabPanels, Tabs } from './components/Tabs/Tabs.js';
54
+ export { default as TabContent } from './components/TabContent/TabContent.js';
55
+ export { default as TabsSkeleton } from './components/Tabs/Tabs.Skeleton.js';
41
56
  export { default as TagSkeleton } from './components/Tag/Tag.Skeleton.js';
42
57
  export { default as TextArea } from './components/TextArea/TextArea.js';
43
58
  export { default as TextAreaSkeleton } from './components/TextArea/TextArea.Skeleton.js';
44
59
  import './components/TextInput/index.js';
60
+ export { ClickableTile, ExpandableTile, SelectableTile, Tile, TileAboveTheFoldContent, TileBelowTheFoldContent } from './components/Tile/Tile.js';
45
61
  export { default as TileGroup } from './components/TileGroup/index.js';
46
62
  export { default as ToggleSkeleton } from './components/Toggle/Toggle.Skeleton.js';
47
63
  export { default as ToggleSmallSkeleton } from './components/ToggleSmall/ToggleSmall.Skeleton.js';
@@ -68,9 +84,6 @@ export { default as unstable__FluidTextInput } from './components/FluidTextInput
68
84
  export { default as unstable__FluidTextInputSkeleton } from './components/FluidTextInput/FluidTextInput.Skeleton.js';
69
85
  export { default as unstable_PageSelector } from './components/Pagination/experimental/PageSelector.js';
70
86
  export { default as unstable_Pagination } from './components/Pagination/experimental/Pagination.js';
71
- export { default as AccordionItem } from './components/Accordion/AccordionItem.js';
72
- export { default as AccordionSkeleton } from './components/Accordion/Accordion.Skeleton.js';
73
- export { default as Accordion } from './components/Accordion/Accordion.js';
74
87
  export { default as BreadcrumbSkeleton } from './components/Breadcrumb/Breadcrumb.Skeleton.js';
75
88
  export { default as CheckboxGroup } from './components/CheckboxGroup/CheckboxGroup.js';
76
89
  export { default as CodeSnippetSkeleton } from './components/CodeSnippet/CodeSnippet.Skeleton.js';
@@ -95,7 +108,6 @@ export { default as Loading } from './components/Loading/Loading.js';
95
108
  export { default as ModalWrapper } from './components/ModalWrapper/ModalWrapper.js';
96
109
  export { default as NumberInputSkeleton } from './components/NumberInput/NumberInput.Skeleton.js';
97
110
  export { default as ProgressIndicatorSkeleton } from './components/ProgressIndicator/ProgressIndicator.Skeleton.js';
98
- export { default as TabsSkeleton } from './components/Tabs/Tabs.Skeleton.js';
99
111
  export { default as TextInputSkeleton } from './components/TextInput/TextInput.Skeleton.js';
100
112
  export { default as TextInput } from './components/TextInput/TextInput.js';
101
113
  export { Toggle } from './components/Toggle/Toggle.js';
@@ -132,14 +144,7 @@ export { Text as unstable_Text } from './components/Text/Text.js';
132
144
  export { TextDirection as unstable_TextDirection } from './components/Text/TextDirection.js';
133
145
  export { default as Breadcrumb } from './components/Breadcrumb/Breadcrumb.js';
134
146
  export { default as BreadcrumbItem } from './components/Breadcrumb/BreadcrumbItem.js';
135
- export { default as ButtonSkeleton } from './components/Button/Button.Skeleton.js';
136
- export { default as Button } from './components/Button/Button.js';
137
- export { default as ButtonSet } from './components/ButtonSet/ButtonSet.js';
138
147
  export { default as ComboBox } from './components/ComboBox/ComboBox.js';
139
- export { default as ComposedModal, ModalBody } from './components/ComposedModal/ComposedModal.js';
140
- export { ModalFooter } from './components/ComposedModal/ModalFooter.js';
141
- export { ModalHeader } from './components/ComposedModal/ModalHeader.js';
142
- export { default as DangerButton } from './components/DangerButton/DangerButton.js';
143
148
  export { default as DataTable } from './components/DataTable/DataTable.js';
144
149
  export { Table } from './components/DataTable/Table.js';
145
150
  export { default as TableActionList } from './components/DataTable/TableActionList.js';
@@ -169,7 +174,6 @@ export { Menu } from './components/Menu/Menu.js';
169
174
  export { MenuItem, MenuItemDivider, MenuItemGroup, MenuItemRadioGroup, MenuItemSelectable } from './components/Menu/MenuItem.js';
170
175
  export { default as Modal } from './components/Modal/Modal.js';
171
176
  export { default as MultiSelect } from './components/MultiSelect/MultiSelect.js';
172
- export { ActionableNotification, InlineNotification, NotificationActionButton, NotificationButton, ToastNotification } from './components/Notification/Notification.js';
173
177
  export { NumberInput } from './components/NumberInput/NumberInput.js';
174
178
  export { default as OverflowMenuItem } from './components/OverflowMenuItem/OverflowMenuItem.js';
175
179
  export { default as Pagination } from './components/Pagination/Pagination.js';
@@ -188,16 +192,12 @@ export { default as SelectItem } from './components/SelectItem/SelectItem.js';
188
192
  export { default as SelectItemGroup } from './components/SelectItemGroup/SelectItemGroup.js';
189
193
  export { default as SkeletonIcon } from './components/SkeletonIcon/SkeletonIcon.js';
190
194
  export { default as SkeletonPlaceholder } from './components/SkeletonPlaceholder/SkeletonPlaceholder.js';
191
- export { default as SkeletonText } from './components/SkeletonText/SkeletonText.js';
192
195
  export { default as SliderSkeleton } from './components/Slider/Slider.Skeleton.js';
193
196
  export { default as StructuredListSkeleton } from './components/StructuredList/StructuredList.Skeleton.js';
194
197
  export { StructuredListBody, StructuredListCell, StructuredListHead, StructuredListInput, StructuredListRow, StructuredListWrapper } from './components/StructuredList/StructuredList.js';
195
198
  export { default as Switch } from './components/Switch/Switch.js';
196
199
  export { default as IconSwitch } from './components/Switch/IconSwitch.js';
197
- export { IconTab, Tab, TabList, TabPanel, TabPanels, Tabs } from './components/Tabs/Tabs.js';
198
- export { default as TabContent } from './components/TabContent/TabContent.js';
199
200
  export { default as Tag, types } from './components/Tag/Tag.js';
200
- export { ClickableTile, ExpandableTile, SelectableTile, Tile, TileAboveTheFoldContent, TileBelowTheFoldContent } from './components/Tile/Tile.js';
201
201
  export { default as TimePicker } from './components/TimePicker/TimePicker.js';
202
202
  export { default as TimePickerSelect } from './components/TimePickerSelect/TimePickerSelect.js';
203
203
  export { default as Content } from './components/UIShell/Content.js';
@@ -26,7 +26,7 @@
26
26
  * }
27
27
  * }
28
28
  *
29
- * @param {Event} event
29
+ * @param {Event|React.SyntheticEvent} event
30
30
  * @param {Array<Key>} keysToMatch
31
31
  * @returns {boolean}
32
32
  */
@@ -53,7 +53,7 @@ function matches(event, keysToMatch) {
53
53
  * }
54
54
  * }
55
55
  *
56
- * @param {React.KeyboardEvent|Event|number|string} eventOrCode
56
+ * @param {React.SyntheticEvent|Event|number|string} eventOrCode
57
57
  * @param {Key} key
58
58
  * @returns {boolean}
59
59
  */
@@ -19,7 +19,7 @@ import { warning } from './warning.js';
19
19
  * uncontrolled, or vice-versa.
20
20
  *
21
21
  * @param {object} config
22
- * @param {string} config.name - the name of the custom component
22
+ * @param {string} [config.name] - the name of the custom component
23
23
  * @param {any} config.defaultValue - the default value used for the state. This will be
24
24
  * the fallback value used if `value` is not defined.
25
25
  * @param {Function} config.onChange - an optional function that is called when
@@ -27,7 +27,7 @@ import { warning } from './warning.js';
27
27
  * controlled components that the value is requesting to be changed.
28
28
  * @param {any} config.value - a controlled value. Omitting this means that the state is
29
29
  * uncontrolled
30
- * @returns {[any, Function]}
30
+ * @returns {[any, (v: any) => void]}
31
31
  */
32
32
  function useControllableState(_ref) {
33
33
  let {
@@ -24,12 +24,12 @@ function elementOrParentIsFloatingMenu(node) {
24
24
  /**
25
25
  * Ensures the focus is kept in the given `modalNode`, implementing "focus-wrap" behavior.
26
26
  * @param {object} options The options.
27
- * @param {Node} options.bodyNode
28
- * @param {Node} options.startTrapNode The DOM node of the focus sentinel the is placed earlier next to `modalNode`.
29
- * @param {Node} options.endTrapNode The DOM node of the focus sentinel the is placed next to `modalNode`.
30
- * @param {Node} options.currentActiveNode The DOM node that has focus.
31
- * @param {Node} options.oldActiveNode The DOM node that previously had focus.
32
- * @param {Node} [options.selectorsFloatingMenus] The CSS selectors that matches floating menus.
27
+ * @param {HTMLElement|null} options.bodyNode
28
+ * @param {HTMLElement|null} options.startTrapNode The DOM node of the focus sentinel the is placed earlier next to `modalNode`.
29
+ * @param {HTMLElement|null} options.endTrapNode The DOM node of the focus sentinel the is placed next to `modalNode`.
30
+ * @param {HTMLElement} options.currentActiveNode The DOM node that has focus.
31
+ * @param {HTMLElement} options.oldActiveNode The DOM node that previously had focus.
32
+ * @param {string[]} [options.selectorsFloatingMenus] The CSS selectors that matches floating menus.
33
33
  */
34
34
  function wrapFocus(_ref) {
35
35
  let {
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  /**
9
- * @param {Function} name The name of the prop that must exist to validate
9
+ * @param {string} name The name of the prop that must exist to validate
10
10
  * the current prop.
11
11
  * @param {Function} propType The original prop type checker.
12
12
  * @returns {Function} The new prop type checker for the current prop that
@@ -5,6 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
+ /**
9
+ * @deprecated use ButtonKinds export from Button component instead
10
+ */
8
11
  const ButtonKinds = ['primary', 'secondary', 'danger', 'ghost', 'danger--primary', 'danger--ghost', 'danger--tertiary', 'tertiary'];
9
12
 
10
13
  export { ButtonKinds };
@@ -0,0 +1,64 @@
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
+ /// <reference types="react" />
8
+ import PropTypes from 'prop-types';
9
+ interface AccordionSkeletonProps {
10
+ /**
11
+ * Specify the alignment of the accordion heading
12
+ * title and chevron.
13
+ */
14
+ align?: 'start' | 'end';
15
+ /**
16
+ * Specify an optional className to add.
17
+ */
18
+ className?: string;
19
+ /**
20
+ * Set number of items to render.
21
+ */
22
+ count?: number;
23
+ /**
24
+ * Specify whether an individual AccordionItem should
25
+ * be flush, default is false.
26
+ */
27
+ isFlush?: boolean;
28
+ /**
29
+ * `false` to not display the first item opened.
30
+ */
31
+ open?: boolean;
32
+ }
33
+ declare function AccordionSkeleton({ align, className, count, isFlush, open, ...rest }: AccordionSkeletonProps): JSX.Element;
34
+ declare namespace AccordionSkeleton {
35
+ var propTypes: {
36
+ /**
37
+ * Specify the alignment of the accordion heading title and chevron.
38
+ */
39
+ align: PropTypes.Requireable<string>;
40
+ /**
41
+ * Specify an optional className to add.
42
+ */
43
+ className: PropTypes.Requireable<string>;
44
+ /**
45
+ * Set number of items to render
46
+ */
47
+ count: PropTypes.Requireable<number>;
48
+ /**
49
+ * Specify whether an individual AccordionItem should be flush, default is false
50
+ */
51
+ isFlush: PropTypes.Requireable<boolean>;
52
+ /**
53
+ * `false` to not display the first item opened
54
+ */
55
+ open: PropTypes.Requireable<boolean>;
56
+ };
57
+ var defaultProps: {
58
+ open: boolean;
59
+ count: number;
60
+ align: string;
61
+ };
62
+ }
63
+ export default AccordionSkeleton;
64
+ export { AccordionSkeleton };
@@ -26,11 +26,11 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
26
26
  var _SkeletonText, _SkeletonText2, _SkeletonText3;
27
27
  function AccordionSkeleton(_ref) {
28
28
  let {
29
- align,
29
+ align = 'end',
30
30
  className,
31
- count,
31
+ count = 4,
32
32
  isFlush,
33
- open,
33
+ open = true,
34
34
  ...rest
35
35
  } = _ref;
36
36
  const prefix = usePrefix.usePrefix();
@@ -0,0 +1,65 @@
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
+ import PropTypes from 'prop-types';
8
+ import { PropsWithChildren } from 'react';
9
+ interface AccordionProps {
10
+ /**
11
+ * Specify the alignment of the accordion heading
12
+ * title and chevron. Defaults to `end`.
13
+ */
14
+ align?: 'start' | 'end';
15
+ /**
16
+ * Specify an optional className to be applied to
17
+ * the container node.
18
+ */
19
+ className?: string;
20
+ /**
21
+ * Specify whether an individual AccordionItem
22
+ * should be disabled.
23
+ */
24
+ disabled?: boolean;
25
+ /**
26
+ * Specify whether Accordion text should be flush,
27
+ * default is `false`, does not work with `align="start"`.
28
+ */
29
+ isFlush?: boolean;
30
+ /**
31
+ * Specify the size of the Accordion. Currently
32
+ * supports the following: `sm`, `md`, `lg`
33
+ */
34
+ size?: 'sm' | 'md' | 'lg';
35
+ }
36
+ declare function Accordion({ align, children, className: customClassName, disabled, isFlush, size, ...rest }: PropsWithChildren<AccordionProps>): JSX.Element;
37
+ declare namespace Accordion {
38
+ var propTypes: {
39
+ /**
40
+ * Specify the alignment of the accordion heading title and chevron.
41
+ */
42
+ align: PropTypes.Requireable<string>;
43
+ /**
44
+ * Pass in the children that will be rendered within the Accordion
45
+ */
46
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
47
+ /**
48
+ * Specify an optional className to be applied to the container node
49
+ */
50
+ className: PropTypes.Requireable<string>;
51
+ /**
52
+ * Specify whether an individual AccordionItem should be disabled
53
+ */
54
+ disabled: PropTypes.Requireable<boolean>;
55
+ /**
56
+ * Specify whether Accordion text should be flush, default is false, does not work with align="start"
57
+ */
58
+ isFlush: PropTypes.Requireable<boolean>;
59
+ /**
60
+ * Specify the size of the Accordion. Currently supports the following:
61
+ */
62
+ size: PropTypes.Requireable<string>;
63
+ };
64
+ }
65
+ export default Accordion;
@@ -14,6 +14,7 @@ var cx = require('classnames');
14
14
  var usePrefix = require('../../internal/usePrefix.js');
15
15
  var PropTypes = require('prop-types');
16
16
  var React = require('react');
17
+ var AccordionProvider = require('./AccordionProvider.js');
17
18
 
18
19
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
19
20
 
@@ -39,13 +40,11 @@ function Accordion(_ref) {
39
40
  [`${prefix}--layout--size-${size}`]: size,
40
41
  [`${prefix}--accordion--flush`]: isFlush && align !== 'start'
41
42
  });
42
- return /*#__PURE__*/React__default["default"].createElement("ul", _rollupPluginBabelHelpers["extends"]({
43
+ return /*#__PURE__*/React__default["default"].createElement(AccordionProvider.AccordionProvider, {
44
+ disabled: disabled
45
+ }, /*#__PURE__*/React__default["default"].createElement("ul", _rollupPluginBabelHelpers["extends"]({
43
46
  className: className
44
- }, rest), disabled ? React__default["default"].Children.toArray(children).map(child => {
45
- return /*#__PURE__*/React__default["default"].cloneElement(child, {
46
- disabled
47
- });
48
- }) : children);
47
+ }, rest), children));
49
48
  }
50
49
  Accordion.propTypes = {
51
50
  /**
@@ -0,0 +1,105 @@
1
+ import PropTypes from 'prop-types';
2
+ import { AnimationEventHandler, AriaAttributes, KeyboardEvent, MouseEventHandler, PropsWithChildren, ReactElement, ReactNode } from 'react';
3
+ interface AccordionItemProps {
4
+ /**
5
+ * Specify an optional className to be
6
+ * applied to the container node.
7
+ */
8
+ className?: string;
9
+ /**
10
+ * Specify whether an individual `AccordionItem` should
11
+ * be disabled (overrides the parent accordion state). If undefined,
12
+ * this value will be managed by the parent Accordion.
13
+ */
14
+ disabled?: boolean;
15
+ /**
16
+ * The handler of the massaged `click` event.
17
+ */
18
+ onClick?: MouseEventHandler<HTMLLIElement>;
19
+ /**
20
+ * The handler of the massaged `click` event on
21
+ * the heading.
22
+ */
23
+ onHeadingClick?: ({ isOpen, event, }: {
24
+ isOpen: boolean;
25
+ event: Parameters<MouseEventHandler<HTMLButtonElement>>[0];
26
+ }) => void;
27
+ /**
28
+ * `true` to open the expand.
29
+ */
30
+ open?: boolean;
31
+ /**
32
+ * @deprecated This prop has been deprecated and will be
33
+ * removed in the next major release of Carbon. Use the
34
+ * `renderToggle` prop instead.
35
+ */
36
+ renderExpando?: (props: PropsWithChildren<AccordionToggleProps>) => ReactElement;
37
+ /**
38
+ * The callback function to render the expand button.
39
+ * Can be a React component class.
40
+ */
41
+ renderToggle?: (props: PropsWithChildren<AccordionToggleProps>) => ReactElement;
42
+ /**
43
+ * The accordion title.
44
+ */
45
+ title?: ReactNode;
46
+ /**
47
+ * The callback function to run on the `onAnimationEnd`
48
+ * event for the list item.
49
+ */
50
+ handleAnimationEnd?: AnimationEventHandler<HTMLLIElement>;
51
+ }
52
+ interface AccordionToggleProps {
53
+ 'aria-controls'?: AriaAttributes['aria-controls'];
54
+ 'aria-expanded'?: AriaAttributes['aria-expanded'];
55
+ className?: string;
56
+ disabled?: boolean;
57
+ onClick?: MouseEventHandler<HTMLButtonElement>;
58
+ onKeyDown?: (event: KeyboardEvent<HTMLButtonElement>) => void;
59
+ type?: 'button';
60
+ }
61
+ declare function AccordionItem({ children, className: customClassName, open, onHeadingClick, renderExpando, // remove renderExpando in next major release
62
+ renderToggle, title, disabled: controlledDisabled, handleAnimationEnd, ...rest }: PropsWithChildren<AccordionItemProps>): JSX.Element;
63
+ declare namespace AccordionItem {
64
+ var propTypes: {
65
+ /**
66
+ * Provide the contents of your AccordionItem
67
+ */
68
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
69
+ /**
70
+ * Specify an optional className to be applied to the container node
71
+ */
72
+ className: PropTypes.Requireable<string>;
73
+ /**
74
+ * Specify whether an individual AccordionItem should be disabled
75
+ */
76
+ disabled: PropTypes.Requireable<boolean>;
77
+ /**
78
+ * The handler of the massaged `click` event.
79
+ */
80
+ onClick: PropTypes.Requireable<(...args: any[]) => any>;
81
+ /**
82
+ * The handler of the massaged `click` event on the heading.
83
+ */
84
+ onHeadingClick: PropTypes.Requireable<(...args: any[]) => any>;
85
+ /**
86
+ * `true` to open the expand.
87
+ */
88
+ open: PropTypes.Requireable<boolean>;
89
+ /**
90
+ * The callback function to render the expand button.
91
+ * Can be a React component class.
92
+ */
93
+ renderExpando: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
94
+ /**
95
+ * The callback function to render the expand button.
96
+ * Can be a React component class.
97
+ */
98
+ renderToggle: PropTypes.Requireable<(...args: any[]) => any>;
99
+ /**
100
+ * The accordion title.
101
+ */
102
+ title: PropTypes.Requireable<PropTypes.ReactNodeLike>;
103
+ };
104
+ }
105
+ export default AccordionItem;
@@ -18,6 +18,7 @@ require('../Text/index.js');
18
18
  var useId = require('../../internal/useId.js');
19
19
  var deprecate = require('../../prop-types/deprecate.js');
20
20
  var usePrefix = require('../../internal/usePrefix.js');
21
+ var AccordionProvider = require('./AccordionProvider.js');
21
22
  var Text = require('../Text/Text.js');
22
23
  var match = require('../../internal/keyboard/match.js');
23
24
  var keys = require('../../internal/keyboard/keys.js');
@@ -34,21 +35,23 @@ const defaultRenderToggle = props => /*#__PURE__*/React__default["default"].crea
34
35
  function AccordionItem(_ref) {
35
36
  let {
36
37
  children,
37
- className: customClassName,
38
- iconDescription,
39
- // eslint-disable-line
38
+ className: customClassName = '',
40
39
  open = false,
41
40
  onHeadingClick,
42
41
  renderExpando = defaultRenderToggle,
43
42
  // remove renderExpando in next major release
44
43
  renderToggle,
45
44
  title = 'title',
46
- disabled,
45
+ disabled: controlledDisabled,
46
+ handleAnimationEnd,
47
47
  ...rest
48
48
  } = _ref;
49
49
  const [isOpen, setIsOpen] = React.useState(open);
50
50
  const [prevIsOpen, setPrevIsOpen] = React.useState(open);
51
51
  const [animation, setAnimation] = React.useState('');
52
+ const accordionState = React.useContext(AccordionProvider.AccordionContext);
53
+ const disabledIsControlled = typeof controlledDisabled === 'boolean';
54
+ const disabled = disabledIsControlled ? controlledDisabled : accordionState.disabled;
52
55
  const id = useId.useId('accordion-item');
53
56
  const prefix = usePrefix.usePrefix();
54
57
  const className = cx__default["default"]({
@@ -88,16 +91,16 @@ function AccordionItem(_ref) {
88
91
  setIsOpen(false);
89
92
  }
90
93
  }
91
- function handleAnimationEnd(event) {
92
- if (rest.handleAnimationEnd) {
93
- rest.handleAnimationEnd(event);
94
+ function onAnimationEnd(event) {
95
+ if (handleAnimationEnd) {
96
+ handleAnimationEnd(event);
94
97
  }
95
98
  setAnimation('');
96
99
  }
97
100
  return /*#__PURE__*/React__default["default"].createElement("li", _rollupPluginBabelHelpers["extends"]({
98
101
  className: className
99
102
  }, rest, {
100
- onAnimationEnd: handleAnimationEnd
103
+ onAnimationEnd: onAnimationEnd
101
104
  }), /*#__PURE__*/React__default["default"].createElement(Toggle, {
102
105
  disabled: disabled,
103
106
  "aria-controls": id,
@@ -0,0 +1,20 @@
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
+ import React, { PropsWithChildren } from 'react';
8
+ type AccordionProviderProp = {
9
+ /**
10
+ * Global setting to disable all AccordionItems
11
+ * within the Accordion. Individual AccordionItems can be
12
+ * disabled by passing the `disabled` prop to the AccordionItem.
13
+ */
14
+ disabled: boolean;
15
+ };
16
+ export declare const AccordionContext: React.Context<{
17
+ disabled: boolean;
18
+ }>;
19
+ export declare const AccordionProvider: ({ disabled, children, }: PropsWithChildren<AccordionProviderProp>) => JSX.Element;
20
+ export {};
@@ -0,0 +1,34 @@
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
+ 'use strict';
9
+
10
+ Object.defineProperty(exports, '__esModule', { value: true });
11
+
12
+ var React = require('react');
13
+
14
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
+
16
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
17
+
18
+ const AccordionContext = /*#__PURE__*/React.createContext({
19
+ disabled: false
20
+ });
21
+ const AccordionProvider = _ref => {
22
+ let {
23
+ disabled,
24
+ children
25
+ } = _ref;
26
+ return /*#__PURE__*/React__default["default"].createElement(AccordionContext.Provider, {
27
+ value: {
28
+ disabled
29
+ }
30
+ }, children);
31
+ };
32
+
33
+ exports.AccordionContext = AccordionContext;
34
+ exports.AccordionProvider = AccordionProvider;
@@ -0,0 +1,11 @@
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
+ import Accordion from './Accordion';
8
+ export default Accordion;
9
+ export { Accordion };
10
+ export { default as AccordionItem } from './AccordionItem';
11
+ export { default as AccordionSkeleton } from './Accordion.Skeleton';