@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.
- package/README.md +1 -1
- package/es/components/Accordion/Accordion.Skeleton.d.ts +64 -0
- package/es/components/Accordion/Accordion.Skeleton.js +3 -3
- package/es/components/Accordion/Accordion.d.ts +65 -0
- package/es/components/Accordion/Accordion.js +5 -6
- package/es/components/Accordion/AccordionItem.d.ts +105 -0
- package/es/components/Accordion/AccordionItem.js +12 -9
- package/es/components/Accordion/AccordionProvider.d.ts +20 -0
- package/es/components/Accordion/AccordionProvider.js +25 -0
- package/es/components/Accordion/index.d.ts +11 -0
- package/es/components/Button/Button.Skeleton.d.ts +28 -0
- package/es/components/Button/Button.Skeleton.js +5 -3
- package/es/components/Button/Button.d.ts +72 -0
- package/es/components/Button/Button.js +13 -10
- package/es/components/Button/index.d.ts +11 -0
- package/es/components/Button/index.js +2 -1
- package/es/components/ButtonSet/ButtonSet.d.ts +17 -0
- package/es/components/ButtonSet/ButtonSet.js +1 -2
- package/es/components/ButtonSet/index.d.ts +9 -0
- package/es/components/CodeSnippet/CodeSnippet.js +1 -0
- package/es/components/ComboButton/index.js +1 -0
- package/es/components/ComposedModal/ComposedModal.d.ts +70 -0
- package/es/components/ComposedModal/ComposedModal.js +58 -67
- package/es/components/ComposedModal/ModalFooter.d.ts +71 -0
- package/es/components/ComposedModal/ModalFooter.js +22 -19
- package/es/components/ComposedModal/ModalHeader.d.ts +58 -0
- package/es/components/ComposedModal/ModalHeader.js +8 -25
- package/es/components/ComposedModal/index.d.ts +9 -0
- package/es/components/ContainedList/ContainedList.js +12 -1
- package/es/components/ContentSwitcher/ContentSwitcher.d.ts +109 -0
- package/es/components/ContentSwitcher/ContentSwitcher.js +14 -6
- package/es/components/DangerButton/DangerButton.d.ts +9 -0
- package/es/components/DangerButton/DangerButton.js +2 -2
- package/es/components/DangerButton/index.d.ts +9 -0
- package/es/components/DataTable/TableBatchAction.js +1 -0
- package/es/components/DataTable/TableBatchActions.js +1 -0
- package/es/components/DataTable/TableBody.d.ts +29 -0
- package/es/components/DataTable/TableBody.js +2 -3
- package/es/components/DataTable/TableContainer.d.ts +51 -0
- package/es/components/DataTable/TableContainer.js +3 -4
- package/es/components/DataTable/TableExpandHeader.d.ts +86 -0
- package/es/components/DataTable/TableExpandHeader.js +4 -5
- package/es/components/DatePicker/plugins/fixEventsPlugin.js +12 -16
- package/es/components/Dropdown/Dropdown.js +1 -0
- package/es/components/FluidTextInput/FluidTextInput.js +1 -0
- package/es/components/FormGroup/FormGroup.d.ts +80 -0
- package/es/components/IconButton/index.js +3 -2
- package/es/components/Layout/index.d.ts +74 -0
- package/es/components/Layout/index.js +14 -5
- package/es/components/Link/Link.d.ts +2 -2
- package/es/components/Link/Link.js +2 -1
- package/es/components/MenuButton/index.js +1 -0
- package/es/components/Modal/Modal.js +1 -0
- package/es/components/ModalWrapper/ModalWrapper.js +1 -0
- package/es/components/Notification/Notification.d.ts +531 -0
- package/es/components/Notification/Notification.js +40 -6
- package/es/components/Notification/index.d.ts +7 -0
- package/es/components/PrimaryButton/PrimaryButton.js +1 -0
- package/es/components/SecondaryButton/SecondaryButton.js +1 -0
- package/es/components/Select/Select.d.ts +1 -1
- package/es/components/SkeletonText/SkeletonText.d.ts +61 -0
- package/es/components/SkeletonText/SkeletonText.js +15 -17
- package/es/components/SkeletonText/index.d.ts +9 -0
- package/es/components/Switch/Switch.d.ts +56 -0
- package/es/components/Switch/Switch.js +4 -4
- package/es/components/Tab/index.d.ts +9 -0
- package/es/components/TabContent/TabContent.d.ts +40 -0
- package/es/components/TabContent/TabContent.js +6 -12
- package/es/components/TabContent/index.d.ts +10 -0
- package/es/components/Tabs/Tabs.Skeleton.d.ts +33 -0
- package/es/components/Tabs/Tabs.Skeleton.js +2 -2
- package/es/components/Tabs/Tabs.d.ts +303 -0
- package/es/components/Tabs/Tabs.js +136 -95
- package/es/components/Tabs/index.d.ts +10 -0
- package/es/components/Tabs/usePressable.js +11 -0
- package/es/components/TextInput/ControlledPasswordInput.d.ts +90 -0
- package/es/components/TextInput/ControlledPasswordInput.js +5 -6
- package/es/components/Tile/Tile.d.ts +153 -0
- package/es/components/Tile/Tile.js +62 -74
- package/es/components/Tile/index.d.ts +7 -0
- package/es/components/Toggle/Toggle.Skeleton.d.ts +3 -47
- package/es/components/Toggle/Toggle.Skeleton.js +24 -64
- package/es/components/Toggle/Toggle.js +1 -1
- package/es/components/UIShell/HeaderGlobalAction.js +1 -0
- package/es/components/UIShell/SideNav.d.ts +1 -1
- package/es/index.js +16 -16
- package/es/internal/keyboard/match.js +2 -2
- package/es/internal/useControllableState.js +2 -2
- package/es/internal/wrapFocus.js +6 -6
- package/es/prop-types/requiredIfGivenPropIsTruthy.js +1 -1
- package/es/prop-types/types.js +3 -0
- package/lib/components/Accordion/Accordion.Skeleton.d.ts +64 -0
- package/lib/components/Accordion/Accordion.Skeleton.js +3 -3
- package/lib/components/Accordion/Accordion.d.ts +65 -0
- package/lib/components/Accordion/Accordion.js +5 -6
- package/lib/components/Accordion/AccordionItem.d.ts +105 -0
- package/lib/components/Accordion/AccordionItem.js +11 -8
- package/lib/components/Accordion/AccordionProvider.d.ts +20 -0
- package/lib/components/Accordion/AccordionProvider.js +34 -0
- package/lib/components/Accordion/index.d.ts +11 -0
- package/lib/components/Button/Button.Skeleton.d.ts +28 -0
- package/lib/components/Button/Button.Skeleton.js +5 -3
- package/lib/components/Button/Button.d.ts +72 -0
- package/lib/components/Button/Button.js +18 -11
- package/lib/components/Button/index.d.ts +11 -0
- package/lib/components/Button/index.js +6 -0
- package/lib/components/ButtonSet/ButtonSet.d.ts +17 -0
- package/lib/components/ButtonSet/ButtonSet.js +1 -2
- package/lib/components/ButtonSet/index.d.ts +9 -0
- package/lib/components/CodeSnippet/CodeSnippet.js +1 -0
- package/lib/components/ComboButton/index.js +1 -0
- package/lib/components/ComposedModal/ComposedModal.d.ts +70 -0
- package/lib/components/ComposedModal/ComposedModal.js +58 -67
- package/lib/components/ComposedModal/ModalFooter.d.ts +71 -0
- package/lib/components/ComposedModal/ModalFooter.js +22 -19
- package/lib/components/ComposedModal/ModalHeader.d.ts +58 -0
- package/lib/components/ComposedModal/ModalHeader.js +8 -25
- package/lib/components/ComposedModal/index.d.ts +9 -0
- package/lib/components/ContainedList/ContainedList.js +12 -1
- package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +109 -0
- package/lib/components/ContentSwitcher/ContentSwitcher.js +14 -6
- package/lib/components/DangerButton/DangerButton.d.ts +9 -0
- package/lib/components/DangerButton/DangerButton.js +2 -2
- package/lib/components/DangerButton/index.d.ts +9 -0
- package/lib/components/DataTable/TableBatchAction.js +1 -0
- package/lib/components/DataTable/TableBatchActions.js +1 -0
- package/lib/components/DataTable/TableBody.d.ts +29 -0
- package/lib/components/DataTable/TableBody.js +3 -4
- package/lib/components/DataTable/TableContainer.d.ts +51 -0
- package/lib/components/DataTable/TableContainer.js +3 -4
- package/lib/components/DataTable/TableExpandHeader.d.ts +86 -0
- package/lib/components/DataTable/TableExpandHeader.js +4 -5
- package/lib/components/DatePicker/plugins/fixEventsPlugin.js +12 -16
- package/lib/components/Dropdown/Dropdown.js +1 -0
- package/lib/components/FluidTextInput/FluidTextInput.js +1 -0
- package/lib/components/FormGroup/FormGroup.d.ts +80 -0
- package/lib/components/IconButton/index.js +3 -2
- package/lib/components/Layout/index.d.ts +74 -0
- package/lib/components/Layout/index.js +14 -5
- package/lib/components/Link/Link.d.ts +2 -2
- package/lib/components/Link/Link.js +2 -1
- package/lib/components/MenuButton/index.js +1 -0
- package/lib/components/Modal/Modal.js +1 -0
- package/lib/components/ModalWrapper/ModalWrapper.js +1 -0
- package/lib/components/Notification/Notification.d.ts +531 -0
- package/lib/components/Notification/Notification.js +40 -6
- package/lib/components/Notification/index.d.ts +7 -0
- package/lib/components/PrimaryButton/PrimaryButton.js +1 -0
- package/lib/components/SecondaryButton/SecondaryButton.js +1 -0
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/SkeletonText/SkeletonText.d.ts +61 -0
- package/lib/components/SkeletonText/SkeletonText.js +15 -17
- package/lib/components/SkeletonText/index.d.ts +9 -0
- package/lib/components/Switch/Switch.d.ts +56 -0
- package/lib/components/Switch/Switch.js +4 -4
- package/lib/components/Tab/index.d.ts +9 -0
- package/lib/components/TabContent/TabContent.d.ts +40 -0
- package/lib/components/TabContent/TabContent.js +6 -12
- package/lib/components/TabContent/index.d.ts +10 -0
- package/lib/components/Tabs/Tabs.Skeleton.d.ts +33 -0
- package/lib/components/Tabs/Tabs.Skeleton.js +2 -2
- package/lib/components/Tabs/Tabs.d.ts +303 -0
- package/lib/components/Tabs/Tabs.js +135 -94
- package/lib/components/Tabs/index.d.ts +10 -0
- package/lib/components/Tabs/usePressable.js +11 -0
- package/lib/components/TextInput/ControlledPasswordInput.d.ts +90 -0
- package/lib/components/TextInput/ControlledPasswordInput.js +5 -6
- package/lib/components/Tile/Tile.d.ts +153 -0
- package/lib/components/Tile/Tile.js +62 -74
- package/lib/components/Tile/index.d.ts +7 -0
- package/lib/components/Toggle/Toggle.Skeleton.d.ts +3 -47
- package/lib/components/Toggle/Toggle.Skeleton.js +22 -62
- package/lib/components/Toggle/Toggle.js +1 -1
- package/lib/components/UIShell/HeaderGlobalAction.js +1 -0
- package/lib/components/UIShell/SideNav.d.ts +1 -1
- package/lib/index.js +51 -47
- package/lib/internal/keyboard/match.js +2 -2
- package/lib/internal/useControllableState.js +2 -2
- package/lib/internal/wrapFocus.js +6 -6
- package/lib/prop-types/requiredIfGivenPropIsTruthy.js +1 -1
- package/lib/prop-types/types.js +3 -0
- package/package.json +4 -3
- package/scss/components/contained-list/_contained-list.scss +9 -0
- 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" | "
|
|
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.
|
|
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,
|
|
30
|
+
* @returns {[any, (v: any) => void]}
|
|
31
31
|
*/
|
|
32
32
|
function useControllableState(_ref) {
|
|
33
33
|
let {
|
package/es/internal/wrapFocus.js
CHANGED
|
@@ -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 {
|
|
28
|
-
* @param {
|
|
29
|
-
* @param {
|
|
30
|
-
* @param {
|
|
31
|
-
* @param {
|
|
32
|
-
* @param {
|
|
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 {
|
|
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
|
package/es/prop-types/types.js
CHANGED
|
@@ -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(
|
|
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),
|
|
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
|
|
92
|
-
if (
|
|
93
|
-
|
|
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:
|
|
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';
|