@carbon/react 1.41.2 → 1.42.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/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +2194 -1863
- package/es/components/Breadcrumb/Breadcrumb.Skeleton.d.ts +25 -0
- package/es/components/Breadcrumb/Breadcrumb.d.ts +24 -0
- package/es/components/Breadcrumb/Breadcrumb.js +1 -2
- package/es/components/Breadcrumb/BreadcrumbItem.d.ts +25 -0
- package/es/components/Breadcrumb/BreadcrumbItem.js +8 -7
- package/es/components/ComboBox/ComboBox.d.ts +7 -1
- package/es/components/ComboBox/ComboBox.js +30 -2
- package/es/components/ContentSwitcher/ContentSwitcher.d.ts +1 -1
- package/es/components/DataTable/TableBatchAction.d.ts +46 -0
- package/es/components/DataTable/TableBatchAction.js +1 -2
- package/es/components/DataTable/TableExpandRow.d.ts +2 -46
- package/es/components/DataTable/TableExpandRow.js +6 -2
- package/es/components/Dropdown/Dropdown.d.ts +1 -1
- package/es/components/FluidMultiSelect/FluidMultiSelect.js +72 -9
- package/es/components/Notification/Notification.js +48 -6
- package/es/components/Tabs/Tabs.js +1 -2
- package/es/components/TreeView/TreeNode.js +7 -4
- package/es/components/UIShell/HeaderMenu.js +2 -2
- package/es/components/UIShell/SideNav.d.ts +1 -1
- package/es/components/UIShell/SideNavFooter.d.ts +52 -0
- package/es/components/UIShell/SideNavFooter.js +0 -1
- package/es/components/UIShell/SideNavItem.d.ts +24 -0
- package/es/components/UIShell/SideNavItem.js +2 -2
- package/es/components/UIShell/SideNavItems.d.ts +25 -0
- package/es/components/UIShell/SideNavItems.js +9 -7
- package/es/components/UIShell/SideNavMenu.js +4 -5
- package/es/components/UIShell/SideNavMenuItem.d.ts +25 -0
- package/es/components/UIShell/SideNavMenuItem.js +1 -2
- package/es/index.js +1 -1
- package/icons/index.d.ts +7 -0
- package/lib/components/Breadcrumb/Breadcrumb.Skeleton.d.ts +25 -0
- package/lib/components/Breadcrumb/Breadcrumb.d.ts +24 -0
- package/lib/components/Breadcrumb/Breadcrumb.js +1 -2
- package/lib/components/Breadcrumb/BreadcrumbItem.d.ts +25 -0
- package/lib/components/Breadcrumb/BreadcrumbItem.js +8 -7
- package/lib/components/ComboBox/ComboBox.d.ts +7 -1
- package/lib/components/ComboBox/ComboBox.js +30 -2
- package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +1 -1
- package/lib/components/DataTable/TableBatchAction.d.ts +46 -0
- package/lib/components/DataTable/TableBatchAction.js +1 -2
- package/lib/components/DataTable/TableExpandRow.d.ts +2 -46
- package/lib/components/DataTable/TableExpandRow.js +6 -2
- package/lib/components/Dropdown/Dropdown.d.ts +1 -1
- package/lib/components/FluidMultiSelect/FluidMultiSelect.js +72 -9
- package/lib/components/Notification/Notification.js +48 -6
- package/lib/components/Tabs/Tabs.js +1 -2
- package/lib/components/TreeView/TreeNode.js +7 -4
- package/lib/components/UIShell/HeaderMenu.js +2 -2
- package/lib/components/UIShell/SideNav.d.ts +1 -1
- package/lib/components/UIShell/SideNavFooter.d.ts +52 -0
- package/lib/components/UIShell/SideNavFooter.js +0 -1
- package/lib/components/UIShell/SideNavItem.d.ts +24 -0
- package/lib/components/UIShell/SideNavItem.js +2 -2
- package/lib/components/UIShell/SideNavItems.d.ts +25 -0
- package/lib/components/UIShell/SideNavItems.js +9 -7
- package/lib/components/UIShell/SideNavMenu.js +4 -5
- package/lib/components/UIShell/SideNavMenuItem.d.ts +25 -0
- package/lib/components/UIShell/SideNavMenuItem.js +1 -2
- package/lib/index.js +2 -2
- package/package.json +8 -7
|
@@ -148,7 +148,7 @@ class HeaderMenu extends React__default.Component {
|
|
|
148
148
|
onKeyDown,
|
|
149
149
|
...rest
|
|
150
150
|
} = this.props;
|
|
151
|
-
const
|
|
151
|
+
const hasActiveDescendant = childrenArg => React__default.Children.toArray(childrenArg).some(child => child.props.isActive || child.props.isCurrentPage || child.props.children instanceof Array && hasActiveDescendant(child.props.children));
|
|
152
152
|
const accessibilityLabel = {
|
|
153
153
|
'aria-label': ariaLabel,
|
|
154
154
|
'aria-labelledby': ariaLabelledBy
|
|
@@ -163,7 +163,7 @@ class HeaderMenu extends React__default.Component {
|
|
|
163
163
|
[`${prefix}--header__menu-title`]: true,
|
|
164
164
|
// We set the current class only if `isActive` is passed in and we do
|
|
165
165
|
// not have an `aria-current="page"` set for the breadcrumb item
|
|
166
|
-
[`${prefix}--header__menu-item--current`]: isActivePage ||
|
|
166
|
+
[`${prefix}--header__menu-item--current`]: isActivePage || hasActiveDescendant(children) && !this.state.expanded
|
|
167
167
|
});
|
|
168
168
|
|
|
169
169
|
// Notes on eslint comments and based on the examples in:
|
|
@@ -25,5 +25,5 @@ interface SideNavContextData {
|
|
|
25
25
|
isRail?: boolean | undefined;
|
|
26
26
|
}
|
|
27
27
|
export declare const SideNavContext: React.Context<SideNavContextData>;
|
|
28
|
-
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" | "tabIndex" | "color" | "lang" | "role" | "href" | "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" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "expanded" | "enterDelayMs" | "defaultExpanded" | "addFocusListeners" | "isChildOfHeader" | "isFixedNav" | "isRail" | "isPersistent" | "addMouseListeners" | "onOverlayClick" | "onSideNavBlur"
|
|
28
|
+
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" | "tabIndex" | "color" | "lang" | "role" | "href" | "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" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "expanded" | "enterDelayMs" | "defaultExpanded" | "inert" | "addFocusListeners" | "isChildOfHeader" | "isFixedNav" | "isRail" | "isPersistent" | "addMouseListeners" | "onOverlayClick" | "onSideNavBlur"> & React.RefAttributes<HTMLElement>>;
|
|
29
29
|
export default SideNav;
|
|
@@ -0,0 +1,52 @@
|
|
|
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 from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
export interface SideNavFooterProps {
|
|
10
|
+
/**
|
|
11
|
+
* Provide text to be read to screen readers and shown as a tooltip when
|
|
12
|
+
* interacting with the toggle button in the footer
|
|
13
|
+
*/
|
|
14
|
+
assistiveText: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Specify whether the side navigation is expanded or collapsed
|
|
18
|
+
*/
|
|
19
|
+
expanded: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Provide a function that is called when the toggle button is interacted
|
|
22
|
+
* with. Useful for controlling the expansion state of the side navigation.
|
|
23
|
+
*/
|
|
24
|
+
onToggle: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* SideNavFooter is used for rendering the button at the bottom of the side
|
|
28
|
+
* navigation that is a part of the UI Shell. It is responsible for handling the
|
|
29
|
+
* user interaction to expand or collapse the side navigation.
|
|
30
|
+
*/
|
|
31
|
+
declare function SideNavFooter({ assistiveText, className: customClassName, expanded, onToggle, }: SideNavFooterProps): JSX.Element;
|
|
32
|
+
declare namespace SideNavFooter {
|
|
33
|
+
var displayName: string;
|
|
34
|
+
var propTypes: {
|
|
35
|
+
/**
|
|
36
|
+
* Provide text to be read to screen readers and shown as a tooltip when
|
|
37
|
+
* interacting with the toggle button in the footer
|
|
38
|
+
*/
|
|
39
|
+
assistiveText: PropTypes.Requireable<string>;
|
|
40
|
+
className: PropTypes.Requireable<string>;
|
|
41
|
+
/**
|
|
42
|
+
* Specify whether the side navigation is expanded or collapsed
|
|
43
|
+
*/
|
|
44
|
+
expanded: PropTypes.Validator<boolean>;
|
|
45
|
+
/**
|
|
46
|
+
* Provide a function that is called when the toggle button is interacted
|
|
47
|
+
* with. Useful for controlling the expansion state of the side navigation.
|
|
48
|
+
*/
|
|
49
|
+
onToggle: PropTypes.Validator<(...args: any[]) => any>;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export default SideNavFooter;
|
|
@@ -12,7 +12,6 @@ import PropTypes from 'prop-types';
|
|
|
12
12
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
13
13
|
|
|
14
14
|
var _Close, _ChevronRight;
|
|
15
|
-
|
|
16
15
|
/**
|
|
17
16
|
* SideNavFooter is used for rendering the button at the bottom of the side
|
|
18
17
|
* navigation that is a part of the UI Shell. It is responsible for handling the
|
|
@@ -0,0 +1,24 @@
|
|
|
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 from 'react';
|
|
8
|
+
interface SideNavItemProps {
|
|
9
|
+
/**
|
|
10
|
+
* Provide a single icon as the child to `SideNavItem` to render in the
|
|
11
|
+
* container
|
|
12
|
+
*/
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Provide an optional class to be applied to the containing node
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Specify if this is a large variation of the SideNavItem
|
|
20
|
+
*/
|
|
21
|
+
large?: boolean;
|
|
22
|
+
}
|
|
23
|
+
declare const SideNavItem: React.FC<SideNavItemProps>;
|
|
24
|
+
export default SideNavItem;
|
|
@@ -10,7 +10,7 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
import React__default from 'react';
|
|
11
11
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
const SideNavItem = _ref => {
|
|
14
14
|
let {
|
|
15
15
|
className: customClassName,
|
|
16
16
|
children,
|
|
@@ -25,7 +25,7 @@ function SideNavItem(_ref) {
|
|
|
25
25
|
return /*#__PURE__*/React__default.createElement("li", {
|
|
26
26
|
className: className
|
|
27
27
|
}, children);
|
|
28
|
-
}
|
|
28
|
+
};
|
|
29
29
|
SideNavItem.propTypes = {
|
|
30
30
|
/**
|
|
31
31
|
* Provide a single icon as the child to `SideNavItem` to render in the
|
|
@@ -0,0 +1,25 @@
|
|
|
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 from 'react';
|
|
8
|
+
interface SideNavItemsProps {
|
|
9
|
+
/**
|
|
10
|
+
* Provide a single icon as the child to `SideNavIcon` to render in the
|
|
11
|
+
* container
|
|
12
|
+
*/
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Provide an optional class to be applied to the containing node
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Property to indicate if the side nav container is open (or not). Use to
|
|
20
|
+
* keep local state and styling in step with the SideNav expansion state.
|
|
21
|
+
*/
|
|
22
|
+
isSideNavExpanded?: boolean;
|
|
23
|
+
}
|
|
24
|
+
declare const SideNavItems: React.FC<SideNavItemsProps>;
|
|
25
|
+
export default SideNavItems;
|
|
@@ -22,11 +22,14 @@ const SideNavItems = _ref => {
|
|
|
22
22
|
const childrenWithExpandedState = React__default.Children.map(children, child => {
|
|
23
23
|
if ( /*#__PURE__*/React__default.isValidElement(child)) {
|
|
24
24
|
// avoid spreading `isSideNavExpanded` to non-Carbon UI Shell children
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
const childType = child.type;
|
|
26
|
+
if (childType && childType.displayName) {
|
|
27
|
+
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
28
|
+
...(CARBON_SIDENAV_ITEMS.includes(childType.displayName) ? {
|
|
29
|
+
isSideNavExpanded
|
|
30
|
+
} : {})
|
|
31
|
+
});
|
|
32
|
+
}
|
|
30
33
|
}
|
|
31
34
|
});
|
|
32
35
|
return /*#__PURE__*/React__default.createElement("ul", {
|
|
@@ -50,6 +53,5 @@ SideNavItems.propTypes = {
|
|
|
50
53
|
*/
|
|
51
54
|
isSideNavExpanded: PropTypes.bool
|
|
52
55
|
};
|
|
53
|
-
var SideNavItems$1 = SideNavItems;
|
|
54
56
|
|
|
55
|
-
export { SideNavItems
|
|
57
|
+
export { SideNavItems as default };
|
|
@@ -34,7 +34,7 @@ const SideNavMenu = /*#__PURE__*/React__default.forwardRef(function SideNavMenu(
|
|
|
34
34
|
const [prevExpanded, setPrevExpanded] = useState(defaultExpanded);
|
|
35
35
|
const className = cx({
|
|
36
36
|
[`${prefix}--side-nav__item`]: true,
|
|
37
|
-
[`${prefix}--side-nav__item--active`]: isActive ||
|
|
37
|
+
[`${prefix}--side-nav__item--active`]: isActive || hasActiveDescendant(children) && !isExpanded,
|
|
38
38
|
[`${prefix}--side-nav__item--icon`]: IconElement,
|
|
39
39
|
[`${prefix}--side-nav__item--large`]: large,
|
|
40
40
|
[customClassName]: !!customClassName
|
|
@@ -66,8 +66,7 @@ const SideNavMenu = /*#__PURE__*/React__default.forwardRef(function SideNavMenu(
|
|
|
66
66
|
type: "button",
|
|
67
67
|
tabIndex: tabIndex === undefined ? !isSideNavExpanded && !isRail ? -1 : 0 : tabIndex
|
|
68
68
|
}, IconElement && /*#__PURE__*/React__default.createElement(SideNavIcon, null, /*#__PURE__*/React__default.createElement(IconElement, null)), /*#__PURE__*/React__default.createElement("span", {
|
|
69
|
-
className: `${prefix}--side-nav__submenu-title
|
|
70
|
-
title: title
|
|
69
|
+
className: `${prefix}--side-nav__submenu-title`
|
|
71
70
|
}, title), /*#__PURE__*/React__default.createElement(SideNavIcon, {
|
|
72
71
|
className: `${prefix}--side-nav__submenu-chevron`,
|
|
73
72
|
small: true
|
|
@@ -127,7 +126,7 @@ SideNavMenu.propTypes = {
|
|
|
127
126
|
Defining the children parameter with the type ReactNode | ReactNode[]. This allows for various possibilities:
|
|
128
127
|
a single element, an array of elements, or null or undefined.
|
|
129
128
|
**/
|
|
130
|
-
function
|
|
129
|
+
function hasActiveDescendant(children) {
|
|
131
130
|
if (Array.isArray(children)) {
|
|
132
131
|
return children.some(child => {
|
|
133
132
|
if (! /*#__PURE__*/React__default.isValidElement(child)) {
|
|
@@ -138,7 +137,7 @@ function hasActiveChild(children) {
|
|
|
138
137
|
safety when accessing their props.
|
|
139
138
|
**/
|
|
140
139
|
const props = child.props;
|
|
141
|
-
if (props.isActive === true || props['aria-current']) {
|
|
140
|
+
if (props.isActive === true || props['aria-current'] || props.children instanceof Array && hasActiveDescendant(props.children)) {
|
|
142
141
|
return true;
|
|
143
142
|
}
|
|
144
143
|
return false;
|
|
@@ -0,0 +1,25 @@
|
|
|
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, { HTMLAttributes } from 'react';
|
|
8
|
+
interface SideNavMenuItemProps extends HTMLAttributes<HTMLElement> {
|
|
9
|
+
/**
|
|
10
|
+
* Specify the children to be rendered inside of the `SideNavMenuItem`
|
|
11
|
+
*/
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Provide an optional class to be applied to the containing node
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Optionally specify whether the link is "active". An active link is one that
|
|
19
|
+
* has an href that is the same as the current page. Can also pass in
|
|
20
|
+
* `aria-current="page"`, as well.
|
|
21
|
+
*/
|
|
22
|
+
isActive?: boolean;
|
|
23
|
+
}
|
|
24
|
+
declare const SideNavMenuItem: React.ForwardRefExoticComponent<SideNavMenuItemProps & React.RefAttributes<HTMLElement>>;
|
|
25
|
+
export default SideNavMenuItem;
|
package/es/index.js
CHANGED
|
@@ -161,7 +161,6 @@ export { default as ModalWrapper } from './components/ModalWrapper/ModalWrapper.
|
|
|
161
161
|
export { default as ProgressIndicatorSkeleton } from './components/ProgressIndicator/ProgressIndicator.Skeleton.js';
|
|
162
162
|
export { default as TextInputSkeleton } from './components/TextInput/TextInput.Skeleton.js';
|
|
163
163
|
export { default as TextInput } from './components/TextInput/TextInput.js';
|
|
164
|
-
export { default as TreeNode } from './components/TreeView/TreeNode.js';
|
|
165
164
|
export { default as TreeView } from './components/TreeView/TreeView.js';
|
|
166
165
|
export { default as ProgressBar } from './components/ProgressBar/ProgressBar.js';
|
|
167
166
|
export { default as unstable__FluidComboBox } from './components/FluidComboBox/FluidComboBox.js';
|
|
@@ -219,4 +218,5 @@ export { default as SkeletonIcon } from './components/SkeletonIcon/SkeletonIcon.
|
|
|
219
218
|
export { default as SliderSkeleton } from './components/Slider/Slider.Skeleton.js';
|
|
220
219
|
export { default as Switch } from './components/Switch/Switch.js';
|
|
221
220
|
export { default as IconSwitch } from './components/Switch/IconSwitch.js';
|
|
221
|
+
export { default as TreeNode } from './components/TreeView/TreeNode.js';
|
|
222
222
|
export { Stack } from './components/Stack/Stack.js';
|
package/icons/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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 React from 'react';
|
|
9
|
+
export interface BreadcrumbSkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Specify an optional className to add.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
declare function BreadcrumbSkeleton({ className, ...rest }: BreadcrumbSkeletonProps): JSX.Element;
|
|
16
|
+
declare namespace BreadcrumbSkeleton {
|
|
17
|
+
var propTypes: {
|
|
18
|
+
/**
|
|
19
|
+
* Specify an optional className to add.
|
|
20
|
+
*/
|
|
21
|
+
className: PropTypes.Requireable<string>;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export default BreadcrumbSkeleton;
|
|
25
|
+
export { BreadcrumbSkeleton };
|
|
@@ -0,0 +1,24 @@
|
|
|
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 from 'react';
|
|
8
|
+
import { ForwardRefReturn } from '../../types/common';
|
|
9
|
+
export interface BreadcrumbProps extends React.HTMLAttributes<HTMLElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Specify the label for the breadcrumb container
|
|
12
|
+
*/
|
|
13
|
+
'aria-label'?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Specify an optional className to be applied to the container node
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Optional prop to omit the trailing slash for the breadcrumbs
|
|
20
|
+
*/
|
|
21
|
+
noTrailingSlash?: boolean;
|
|
22
|
+
}
|
|
23
|
+
declare const Breadcrumb: ForwardRefReturn<HTMLElement, BreadcrumbProps>;
|
|
24
|
+
export default Breadcrumb;
|
|
@@ -0,0 +1,25 @@
|
|
|
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, { AriaAttributes } from 'react';
|
|
8
|
+
import { ForwardRefReturn } from '../../types/common';
|
|
9
|
+
export interface BreadcrumbItemProps extends React.HTMLAttributes<HTMLLIElement> {
|
|
10
|
+
'aria-current'?: AriaAttributes['aria-current'];
|
|
11
|
+
/**
|
|
12
|
+
* Specify an optional className to be applied to the container node
|
|
13
|
+
*/
|
|
14
|
+
className?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Optional string representing the link location for the BreadcrumbItem
|
|
17
|
+
*/
|
|
18
|
+
href?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Provide if this breadcrumb item represents the current page
|
|
21
|
+
*/
|
|
22
|
+
isCurrentPage?: boolean;
|
|
23
|
+
}
|
|
24
|
+
declare const BreadcrumbItem: ForwardRefReturn<HTMLLIElement, BreadcrumbItemProps>;
|
|
25
|
+
export default BreadcrumbItem;
|
|
@@ -29,7 +29,7 @@ const BreadcrumbItem = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
29
29
|
let {
|
|
30
30
|
'aria-current': ariaCurrent,
|
|
31
31
|
children,
|
|
32
|
-
className: customClassName,
|
|
32
|
+
className: customClassName = '',
|
|
33
33
|
href,
|
|
34
34
|
isCurrentPage,
|
|
35
35
|
...rest
|
|
@@ -42,13 +42,14 @@ const BreadcrumbItem = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
42
42
|
[`${prefix}--breadcrumb-item--current`]: isCurrentPage && ariaCurrent !== 'page',
|
|
43
43
|
[customClassName]: !!customClassName
|
|
44
44
|
});
|
|
45
|
-
|
|
45
|
+
const child = children;
|
|
46
|
+
if (child.type && child.type.displayName !== undefined && child.type.displayName.includes('OverflowMenu')) {
|
|
46
47
|
const horizontalOverflowIcon = /*#__PURE__*/React__default["default"].createElement(iconsReact.OverflowMenuHorizontal, {
|
|
47
48
|
className: `${prefix}--overflow-menu__icon`
|
|
48
49
|
});
|
|
49
50
|
return /*#__PURE__*/React__default["default"].createElement("li", _rollupPluginBabelHelpers["extends"]({
|
|
50
51
|
className: className
|
|
51
|
-
}, rest), /*#__PURE__*/React__default["default"].cloneElement(
|
|
52
|
+
}, rest), /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
52
53
|
menuOptionsClass: `${prefix}--breadcrumb-menu-options`,
|
|
53
54
|
menuOffset: {
|
|
54
55
|
top: 10,
|
|
@@ -71,13 +72,14 @@ const BreadcrumbItem = /*#__PURE__*/React__default["default"].forwardRef(functio
|
|
|
71
72
|
return /*#__PURE__*/React__default["default"].createElement("li", _rollupPluginBabelHelpers["extends"]({
|
|
72
73
|
className: className,
|
|
73
74
|
ref: ref
|
|
74
|
-
}, rest), /*#__PURE__*/React__default["default"].cloneElement(
|
|
75
|
+
}, rest), /*#__PURE__*/React__default["default"].cloneElement(child, {
|
|
75
76
|
'aria-current': ariaCurrent,
|
|
76
|
-
className: cx__default["default"](`${prefix}--link`,
|
|
77
|
+
className: cx__default["default"](`${prefix}--link`, child.props.className)
|
|
77
78
|
}));
|
|
78
79
|
});
|
|
79
80
|
BreadcrumbItem.displayName = 'BreadcrumbItem';
|
|
80
81
|
BreadcrumbItem.propTypes = {
|
|
82
|
+
// @ts-expect-error - v12 TODO: BREAKING: This should match AriaAttributes['aria-current']
|
|
81
83
|
'aria-current': PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].bool]),
|
|
82
84
|
/**
|
|
83
85
|
* Pass in content that will be inside of the BreadcrumbItem
|
|
@@ -96,6 +98,5 @@ BreadcrumbItem.propTypes = {
|
|
|
96
98
|
*/
|
|
97
99
|
isCurrentPage: PropTypes__default["default"].bool
|
|
98
100
|
};
|
|
99
|
-
var BreadcrumbItem$1 = BreadcrumbItem;
|
|
100
101
|
|
|
101
|
-
exports["default"] = BreadcrumbItem
|
|
102
|
+
exports["default"] = BreadcrumbItem;
|
|
@@ -9,10 +9,16 @@ import { type ComponentProps, type ReactNode, type ComponentType, type ReactElem
|
|
|
9
9
|
import { ListBoxSize } from '../ListBox';
|
|
10
10
|
type ExcludedAttributes = 'id' | 'onChange' | 'onClick' | 'type' | 'size';
|
|
11
11
|
interface OnChangeData<ItemType> {
|
|
12
|
-
selectedItem: ItemType | null;
|
|
12
|
+
selectedItem: ItemType | null | undefined;
|
|
13
|
+
inputValue?: string | null;
|
|
13
14
|
}
|
|
14
15
|
type ItemToStringHandler<ItemType> = (item: ItemType | null) => string;
|
|
15
16
|
export interface ComboBoxProps<ItemType> extends Omit<InputHTMLAttributes<HTMLInputElement>, ExcludedAttributes> {
|
|
17
|
+
/**
|
|
18
|
+
* Specify whether or not the ComboBox should allow a value that is
|
|
19
|
+
* not in the list to be entered in the input
|
|
20
|
+
*/
|
|
21
|
+
allowCustomValue?: boolean;
|
|
16
22
|
/**
|
|
17
23
|
* Specify a label to be read by screen readers on the container node
|
|
18
24
|
* 'aria-label' of the ListBox component.
|
|
@@ -43,7 +43,8 @@ const {
|
|
|
43
43
|
keyDownEscape,
|
|
44
44
|
clickButton,
|
|
45
45
|
blurButton,
|
|
46
|
-
changeInput
|
|
46
|
+
changeInput,
|
|
47
|
+
blurInput
|
|
47
48
|
} = Downshift__default["default"].stateChangeTypes;
|
|
48
49
|
const defaultItemToString = item => {
|
|
49
50
|
if (typeof item === 'string') {
|
|
@@ -121,6 +122,7 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
121
122
|
translateWithId,
|
|
122
123
|
warn,
|
|
123
124
|
warnText,
|
|
125
|
+
allowCustomValue = false,
|
|
124
126
|
...rest
|
|
125
127
|
} = props;
|
|
126
128
|
const prefix = usePrefix.usePrefix();
|
|
@@ -215,6 +217,17 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
215
217
|
case changeInput:
|
|
216
218
|
updateHighlightedIndex(getHighlightedIndex(changes));
|
|
217
219
|
break;
|
|
220
|
+
case blurInput:
|
|
221
|
+
if (allowCustomValue) {
|
|
222
|
+
setInputValue(inputValue);
|
|
223
|
+
if (onChange) {
|
|
224
|
+
onChange({
|
|
225
|
+
selectedItem,
|
|
226
|
+
inputValue
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
break;
|
|
218
231
|
}
|
|
219
232
|
};
|
|
220
233
|
const handleToggleClick = isOpen => event => {
|
|
@@ -313,8 +326,18 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
313
326
|
if (match.match(event, keys.Space)) {
|
|
314
327
|
event.stopPropagation();
|
|
315
328
|
}
|
|
316
|
-
if (match.match(event, keys.Enter) && !inputValue) {
|
|
329
|
+
if (match.match(event, keys.Enter) && (!inputValue || allowCustomValue)) {
|
|
317
330
|
toggleMenu();
|
|
331
|
+
|
|
332
|
+
// Since `onChange` does not normally fire when the menu is closed, we should
|
|
333
|
+
// manually fire it when `allowCustomValue` is provided, the menu is closing,
|
|
334
|
+
// and there is a value.
|
|
335
|
+
if (allowCustomValue && isOpen && inputValue) {
|
|
336
|
+
onChange({
|
|
337
|
+
selectedItem,
|
|
338
|
+
inputValue
|
|
339
|
+
});
|
|
340
|
+
}
|
|
318
341
|
}
|
|
319
342
|
if (match.match(event, keys.Escape) && inputValue) {
|
|
320
343
|
if (event.target === textInput.current && isOpen) {
|
|
@@ -422,6 +445,11 @@ const ComboBox = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
422
445
|
});
|
|
423
446
|
ComboBox.displayName = 'ComboBox';
|
|
424
447
|
ComboBox.propTypes = {
|
|
448
|
+
/**
|
|
449
|
+
* Specify whether or not the ComboBox should allow a value that is
|
|
450
|
+
* not in the list to be entered in the input
|
|
451
|
+
*/
|
|
452
|
+
allowCustomValue: PropTypes__default["default"].bool,
|
|
425
453
|
/**
|
|
426
454
|
* 'aria-label' of the ListBox component.
|
|
427
455
|
* Specify a label to be read by screen readers on the container node
|
|
@@ -40,7 +40,7 @@ export interface ContentSwitcherProps extends Omit<HTMLAttributes<HTMLElement>,
|
|
|
40
40
|
/**
|
|
41
41
|
* Choose whether or not to automatically change selection on focus
|
|
42
42
|
*/
|
|
43
|
-
selectionMode
|
|
43
|
+
selectionMode?: 'automatic' | 'manual';
|
|
44
44
|
/**
|
|
45
45
|
* Specify the size of the Content Switcher. Currently supports either `sm`, 'md' (default) or 'lg` as an option.
|
|
46
46
|
*/
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2016, 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
export interface TableBatchActionProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
10
|
+
/**
|
|
11
|
+
* Specify if the button is an icon-only button
|
|
12
|
+
*/
|
|
13
|
+
hasIconOnly?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* If specifying the `renderIcon` prop, provide a description for that icon that can
|
|
16
|
+
* be read by screen readers
|
|
17
|
+
*/
|
|
18
|
+
iconDescription?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Optional function to render your own icon in the underlying button
|
|
21
|
+
*/
|
|
22
|
+
renderIcon?: React.ElementType;
|
|
23
|
+
}
|
|
24
|
+
declare const TableBatchAction: {
|
|
25
|
+
({ renderIcon, iconDescription, ...props }: {
|
|
26
|
+
[x: string]: any;
|
|
27
|
+
renderIcon?: import("@carbon/icons-react/lib/CarbonIcon").CarbonIconType | undefined;
|
|
28
|
+
iconDescription?: string | undefined;
|
|
29
|
+
}): JSX.Element;
|
|
30
|
+
propTypes: {
|
|
31
|
+
/**
|
|
32
|
+
* Specify if the button is an icon-only button
|
|
33
|
+
*/
|
|
34
|
+
hasIconOnly: PropTypes.Requireable<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* If specifying the `renderIcon` prop, provide a description for that icon that can
|
|
37
|
+
* be read by screen readers
|
|
38
|
+
*/
|
|
39
|
+
iconDescription: (props: any) => Error | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Optional function to render your own icon in the underlying button
|
|
42
|
+
*/
|
|
43
|
+
renderIcon: PropTypes.Requireable<object>;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export default TableBatchAction;
|
|
@@ -52,6 +52,5 @@ TableBatchAction.propTypes = {
|
|
|
52
52
|
*/
|
|
53
53
|
renderIcon: PropTypes__default["default"].oneOfType([PropTypes__default["default"].func, PropTypes__default["default"].object])
|
|
54
54
|
};
|
|
55
|
-
var TableBatchAction$1 = TableBatchAction;
|
|
56
55
|
|
|
57
|
-
exports["default"] = TableBatchAction
|
|
56
|
+
exports["default"] = TableBatchAction;
|