carbon-react 151.3.0 → 151.5.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/esm/components/adaptive-sidebar/__internal__/utils.d.ts +6 -0
- package/esm/components/adaptive-sidebar/__internal__/utils.js +23 -0
- package/esm/components/adaptive-sidebar/adaptive-sidebar.component.d.ts +25 -0
- package/esm/components/adaptive-sidebar/adaptive-sidebar.component.js +56 -0
- package/esm/components/adaptive-sidebar/adaptive-sidebar.style.d.ts +12 -0
- package/esm/components/adaptive-sidebar/adaptive-sidebar.style.js +35 -0
- package/esm/components/adaptive-sidebar/index.d.ts +2 -0
- package/esm/components/adaptive-sidebar/index.js +1 -0
- package/esm/components/box/box.component.d.ts +2 -0
- package/esm/components/box/box.component.js +3 -1
- package/esm/components/menu/__internal__/submenu/submenu.component.d.ts +2 -0
- package/esm/components/menu/__internal__/submenu/submenu.component.js +2 -0
- package/esm/components/menu/__internal__/submenu/submenu.style.d.ts +1 -1
- package/esm/components/menu/__internal__/submenu/submenu.style.js +3 -2
- package/esm/components/menu/menu-item/menu-item.component.d.ts +13 -2
- package/esm/components/menu/menu-item/menu-item.component.js +3 -1
- package/esm/components/sidebar/sidebar.component.d.ts +6 -0
- package/esm/components/sidebar/sidebar.component.js +3 -1
- package/lib/components/adaptive-sidebar/__internal__/utils.d.ts +6 -0
- package/lib/components/adaptive-sidebar/__internal__/utils.js +31 -0
- package/lib/components/adaptive-sidebar/adaptive-sidebar.component.d.ts +25 -0
- package/lib/components/adaptive-sidebar/adaptive-sidebar.component.js +66 -0
- package/lib/components/adaptive-sidebar/adaptive-sidebar.style.d.ts +12 -0
- package/lib/components/adaptive-sidebar/adaptive-sidebar.style.js +43 -0
- package/lib/components/adaptive-sidebar/index.d.ts +2 -0
- package/lib/components/adaptive-sidebar/index.js +13 -0
- package/lib/components/adaptive-sidebar/package.json +6 -0
- package/lib/components/box/box.component.d.ts +2 -0
- package/lib/components/box/box.component.js +3 -1
- package/lib/components/menu/__internal__/submenu/submenu.component.d.ts +2 -0
- package/lib/components/menu/__internal__/submenu/submenu.component.js +2 -0
- package/lib/components/menu/__internal__/submenu/submenu.style.d.ts +1 -1
- package/lib/components/menu/__internal__/submenu/submenu.style.js +3 -2
- package/lib/components/menu/menu-item/menu-item.component.d.ts +13 -2
- package/lib/components/menu/menu-item/menu-item.component.js +3 -1
- package/lib/components/sidebar/sidebar.component.d.ts +6 -0
- package/lib/components/sidebar/sidebar.component.js +3 -1
- package/package.json +3 -3
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AdaptiveSidebarProps } from "../adaptive-sidebar.component";
|
|
2
|
+
export declare const getColors: (backgroundColor: AdaptiveSidebarProps["backgroundColor"]) => {
|
|
3
|
+
"background-color": string;
|
|
4
|
+
color: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const kebabToCamelCase: (str: string) => string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const getColors = backgroundColor => {
|
|
2
|
+
switch (backgroundColor) {
|
|
3
|
+
case "app":
|
|
4
|
+
return {
|
|
5
|
+
"background-color": "var(--colorsUtilityMajor025)",
|
|
6
|
+
color: "var(--colorsUtilityYin090)"
|
|
7
|
+
};
|
|
8
|
+
case "black":
|
|
9
|
+
return {
|
|
10
|
+
"background-color": "var(--colorsUtilityYin100)",
|
|
11
|
+
color: "var(--colorsUtilityYang100)"
|
|
12
|
+
};
|
|
13
|
+
case "white":
|
|
14
|
+
default:
|
|
15
|
+
return {
|
|
16
|
+
"background-color": "var(--colorsUtilityYang100)",
|
|
17
|
+
color: "var(--colorsUtilityYin090)"
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export const kebabToCamelCase = str => {
|
|
22
|
+
return str.replace(/-./g, match => match.charAt(1).toUpperCase());
|
|
23
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PaddingProps, MarginProps } from "styled-system";
|
|
3
|
+
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
4
|
+
export interface AdaptiveSidebarProps extends MarginProps, PaddingProps, Omit<TagProps, "data-component"> {
|
|
5
|
+
/** The breakpoint (in pixels) at which the sidebar will convert to a dialog-based sidebar */
|
|
6
|
+
adaptiveBreakpoint?: number;
|
|
7
|
+
/** The time in milliseconds for the sidebar to animate */
|
|
8
|
+
animationTimeout?: number;
|
|
9
|
+
/** The background color of the sidebar */
|
|
10
|
+
backgroundColor?: "white" | "black" | "app";
|
|
11
|
+
/** The color to use for the left-hand border of the sidebar. Should be a design token e.g. `--colorsUtilityYang100` */
|
|
12
|
+
borderColor?: string | "none";
|
|
13
|
+
/** The content of the sidebar */
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
/** The height of the sidebar, relative to the wrapping component */
|
|
16
|
+
height?: string;
|
|
17
|
+
/** Whether the sidebar is open or closed */
|
|
18
|
+
open: boolean;
|
|
19
|
+
/** Whether to render the sidebar as a modal component instead of as an inline sidebar */
|
|
20
|
+
renderAsModal?: boolean;
|
|
21
|
+
/** The width of the sidebar */
|
|
22
|
+
width?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare const AdaptiveSidebar: ({ adaptiveBreakpoint, backgroundColor, borderColor, children, height, open, renderAsModal, width, ...props }: AdaptiveSidebarProps) => React.JSX.Element | null;
|
|
25
|
+
export default AdaptiveSidebar;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
+
import React, { useEffect, useRef } from "react";
|
|
3
|
+
import { getColors, kebabToCamelCase } from "./__internal__/utils";
|
|
4
|
+
import Box from "../box";
|
|
5
|
+
import { filterStyledSystemMarginProps, filterStyledSystemPaddingProps } from "../../style/utils";
|
|
6
|
+
import useIsAboveBreakpoint from "../../hooks/__internal__/useIsAboveBreakpoint";
|
|
7
|
+
import { StyledAdaptiveSidebar, StyledSidebar } from "./adaptive-sidebar.style";
|
|
8
|
+
export const AdaptiveSidebar = ({
|
|
9
|
+
adaptiveBreakpoint = 768,
|
|
10
|
+
backgroundColor = "white",
|
|
11
|
+
borderColor = "none",
|
|
12
|
+
children,
|
|
13
|
+
height = "100%",
|
|
14
|
+
open,
|
|
15
|
+
renderAsModal = false,
|
|
16
|
+
width = "320px",
|
|
17
|
+
...props
|
|
18
|
+
}) => {
|
|
19
|
+
const largeScreen = useIsAboveBreakpoint(adaptiveBreakpoint);
|
|
20
|
+
const adaptiveSidebarRef = useRef(null);
|
|
21
|
+
const colours = Object.entries(getColors(backgroundColor)).reduce((acc, [key, value]) => {
|
|
22
|
+
acc[kebabToCamelCase(key)] = value;
|
|
23
|
+
return acc;
|
|
24
|
+
}, {});
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
/* istanbul ignore next */
|
|
27
|
+
if (adaptiveSidebarRef.current) {
|
|
28
|
+
adaptiveSidebarRef.current.focus();
|
|
29
|
+
}
|
|
30
|
+
}, [open]);
|
|
31
|
+
if (renderAsModal || !largeScreen) {
|
|
32
|
+
return /*#__PURE__*/React.createElement(StyledSidebar, {
|
|
33
|
+
backgroundColor: backgroundColor,
|
|
34
|
+
open: open,
|
|
35
|
+
p: 0,
|
|
36
|
+
ref: adaptiveSidebarRef
|
|
37
|
+
}, /*#__PURE__*/React.createElement(Box, _extends({
|
|
38
|
+
height: "100%",
|
|
39
|
+
"data-role": "adaptive-sidebar-content-wrapper"
|
|
40
|
+
}, colours), children));
|
|
41
|
+
}
|
|
42
|
+
return open ? /*#__PURE__*/React.createElement(StyledAdaptiveSidebar, _extends({
|
|
43
|
+
backgroundColor: backgroundColor,
|
|
44
|
+
borderColor: borderColor === "none" ? undefined : borderColor,
|
|
45
|
+
"data-element": "adaptive-sidebar",
|
|
46
|
+
"data-role": "adaptive-sidebar",
|
|
47
|
+
height: height,
|
|
48
|
+
ref: adaptiveSidebarRef,
|
|
49
|
+
role: "region",
|
|
50
|
+
tabIndex: -1,
|
|
51
|
+
width: width
|
|
52
|
+
}, filterStyledSystemMarginProps(props), filterStyledSystemPaddingProps(props)), /*#__PURE__*/React.createElement(Box, {
|
|
53
|
+
"data-role": "adaptive-sidebar-content-wrapper"
|
|
54
|
+
}, children)) : null;
|
|
55
|
+
};
|
|
56
|
+
export default AdaptiveSidebar;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MarginProps, PaddingProps } from "styled-system";
|
|
3
|
+
import { SidebarProps } from "../sidebar";
|
|
4
|
+
import { AdaptiveSidebarProps } from "./adaptive-sidebar.component";
|
|
5
|
+
declare const StyledAdaptiveSidebar: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../box").BoxProps & import("react").RefAttributes<HTMLDivElement>>, any, Pick<AdaptiveSidebarProps, "width" | "backgroundColor" | "height" | "borderColor"> & MarginProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & PaddingProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & {
|
|
6
|
+
tabIndex: number;
|
|
7
|
+
}, never>;
|
|
8
|
+
interface StyledSidebarProps extends SidebarProps {
|
|
9
|
+
backgroundColor: "app" | "black" | "white";
|
|
10
|
+
}
|
|
11
|
+
declare const StyledSidebar: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<SidebarProps & import("react").RefAttributes<HTMLDivElement>>, any, StyledSidebarProps, never>;
|
|
12
|
+
export { StyledAdaptiveSidebar, StyledSidebar };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import { margin, padding } from "styled-system";
|
|
3
|
+
import Box from "../box";
|
|
4
|
+
import Sidebar from "../sidebar";
|
|
5
|
+
import { getColors } from "./__internal__/utils";
|
|
6
|
+
const StyledAdaptiveSidebar = styled(Box)`
|
|
7
|
+
${({
|
|
8
|
+
backgroundColor,
|
|
9
|
+
borderColor,
|
|
10
|
+
height,
|
|
11
|
+
width
|
|
12
|
+
}) => css`
|
|
13
|
+
${getColors(backgroundColor)}
|
|
14
|
+
${borderColor && css`
|
|
15
|
+
border-left: 1px solid var(${borderColor});
|
|
16
|
+
`}
|
|
17
|
+
max-height: ${height};
|
|
18
|
+
max-width: ${width};
|
|
19
|
+
min-width: ${width};
|
|
20
|
+
overflow-y: auto;
|
|
21
|
+
|
|
22
|
+
${margin}
|
|
23
|
+
${padding}
|
|
24
|
+
`};
|
|
25
|
+
`;
|
|
26
|
+
const StyledSidebar = styled(Sidebar)`
|
|
27
|
+
${({
|
|
28
|
+
backgroundColor
|
|
29
|
+
}) => css`
|
|
30
|
+
div[data-element="sidebar-content"] {
|
|
31
|
+
${getColors(backgroundColor)}
|
|
32
|
+
}
|
|
33
|
+
`}
|
|
34
|
+
`;
|
|
35
|
+
export { StyledAdaptiveSidebar, StyledSidebar };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./adaptive-sidebar.component";
|
|
@@ -51,6 +51,8 @@ export interface BoxProps extends FlexboxProps, Omit<GridProps, "gridGap" | "gri
|
|
|
51
51
|
"aria-hidden"?: "true" | "false";
|
|
52
52
|
/** @private @internal @ignore */
|
|
53
53
|
"data-component"?: string;
|
|
54
|
+
/** @private @internal @ignore */
|
|
55
|
+
tabIndex?: number;
|
|
54
56
|
}
|
|
55
57
|
export declare const Box: React.ForwardRefExoticComponent<BoxProps & React.RefAttributes<HTMLDivElement>>;
|
|
56
58
|
export default Box;
|
|
@@ -5,6 +5,7 @@ import StyledBox from "./box.style";
|
|
|
5
5
|
import tagComponent from "../../__internal__/utils/helpers/tags";
|
|
6
6
|
export const Box = /*#__PURE__*/React.forwardRef(({
|
|
7
7
|
"data-component": dataComponent,
|
|
8
|
+
tabIndex,
|
|
8
9
|
as,
|
|
9
10
|
id,
|
|
10
11
|
role,
|
|
@@ -63,7 +64,8 @@ export const Box = /*#__PURE__*/React.forwardRef(({
|
|
|
63
64
|
borderRadius: borderRadius,
|
|
64
65
|
"aria-hidden": ariaHidden
|
|
65
66
|
}, tagComponent(dataComponent, rest), filterStyledSystemMarginProps(rest), filterStyledSystemPaddingProps(rest), filterStyledSystemFlexboxProps(rest), filterStyledSystemGridProps(rest), filterStyledSystemLayoutProps(rest), {
|
|
66
|
-
cssProps: cssProps
|
|
67
|
+
cssProps: cssProps,
|
|
68
|
+
tabIndex: tabIndex
|
|
67
69
|
}), children);
|
|
68
70
|
});
|
|
69
71
|
Box.displayName = "Box";
|
|
@@ -40,6 +40,8 @@ export interface SubmenuProps {
|
|
|
40
40
|
ariaLabel?: string;
|
|
41
41
|
/** Sets the max-width of the submenu container element */
|
|
42
42
|
submenuMaxWidth?: string;
|
|
43
|
+
/** Sets the min-width of the submenu container element */
|
|
44
|
+
submenuMinWidth?: string;
|
|
43
45
|
}
|
|
44
46
|
declare const Submenu: React.ForwardRefExoticComponent<SubmenuProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
45
47
|
export default Submenu;
|
|
@@ -28,6 +28,7 @@ const Submenu = /*#__PURE__*/React.forwardRef(({
|
|
|
28
28
|
onSubmenuClose,
|
|
29
29
|
onClick,
|
|
30
30
|
submenuMaxWidth,
|
|
31
|
+
submenuMinWidth,
|
|
31
32
|
...rest
|
|
32
33
|
}, ref) => {
|
|
33
34
|
const [submenuRef, setSubmenuRef] = useState(null);
|
|
@@ -324,6 +325,7 @@ const Submenu = /*#__PURE__*/React.forwardRef(({
|
|
|
324
325
|
applyFocusRadiusStyling: applyFocusRadius,
|
|
325
326
|
applyFocusRadiusStylingToLastItem: applyFocusRadiusToLastItem,
|
|
326
327
|
submenuMaxWidth: submenuMaxWidth,
|
|
328
|
+
submenuMinWidth: submenuMinWidth,
|
|
327
329
|
onBlur: handleSubmenuBlur
|
|
328
330
|
}, /*#__PURE__*/React.createElement(SubmenuContext.Provider, {
|
|
329
331
|
value: {
|
|
@@ -8,7 +8,7 @@ interface StyledSubmenuWrapperProps extends SharedStyleProps {
|
|
|
8
8
|
isSubmenuOpen?: boolean;
|
|
9
9
|
asPassiveItem?: boolean;
|
|
10
10
|
}
|
|
11
|
-
interface StyledSubmenuProps extends SharedStyleProps, Pick<SubmenuProps, "variant" | "submenuMaxWidth"> {
|
|
11
|
+
interface StyledSubmenuProps extends SharedStyleProps, Pick<SubmenuProps, "variant" | "submenuMaxWidth" | "submenuMinWidth"> {
|
|
12
12
|
submenuDirection?: string;
|
|
13
13
|
maxHeight?: string;
|
|
14
14
|
applyFocusRadiusStyling: boolean;
|
|
@@ -50,7 +50,8 @@ const StyledSubmenu = styled.ul`
|
|
|
50
50
|
maxHeight,
|
|
51
51
|
applyFocusRadiusStyling,
|
|
52
52
|
applyFocusRadiusStylingToLastItem,
|
|
53
|
-
submenuMaxWidth
|
|
53
|
+
submenuMaxWidth,
|
|
54
|
+
submenuMinWidth
|
|
54
55
|
}) => css`
|
|
55
56
|
${!inFullscreenView && menuType && css`
|
|
56
57
|
box-shadow: var(--boxShadow100);
|
|
@@ -58,7 +59,7 @@ const StyledSubmenu = styled.ul`
|
|
|
58
59
|
top: 100%;
|
|
59
60
|
background-color: ${variant === "default" ? menuConfigVariants[menuType].submenuItemBackground : menuConfigVariants[menuType].background};
|
|
60
61
|
|
|
61
|
-
min-width: 100
|
|
62
|
+
min-width: ${submenuMinWidth ?? "100%"};
|
|
62
63
|
|
|
63
64
|
${submenuMaxWidth && css`
|
|
64
65
|
width: max-content;
|
|
@@ -48,8 +48,19 @@ interface MenuItemBaseProps extends TagProps, Pick<LayoutProps, "width" | "maxWi
|
|
|
48
48
|
* Renders MenuItem as a div element
|
|
49
49
|
* */
|
|
50
50
|
as?: "div";
|
|
51
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Sets the maximum width for the item's submenu when it is opened.
|
|
53
|
+
* This prop is only applicable if the item has a submenu.
|
|
54
|
+
* Overrides the maximum width of any items within the submenu.
|
|
55
|
+
* Accepts any valid CSS width value (e.g. "200px", "50%").
|
|
56
|
+
* */
|
|
52
57
|
submenuMaxWidth?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Sets a minimum width for the item's submenu when it is opened.
|
|
60
|
+
* Accepts any valid CSS width value (e.g. "200px", "50%").
|
|
61
|
+
* This prop is only applicable if the item has a submenu.
|
|
62
|
+
* */
|
|
63
|
+
submenuMinWidth?: string;
|
|
53
64
|
}
|
|
54
65
|
export interface MenuWithChildren extends MenuItemBaseProps {
|
|
55
66
|
children?: React.ReactNode;
|
|
@@ -61,5 +72,5 @@ export interface MenuWithIcon extends MenuItemBaseProps {
|
|
|
61
72
|
icon: IconType;
|
|
62
73
|
children?: React.ReactNode;
|
|
63
74
|
}
|
|
64
|
-
export declare const MenuItem: ({ submenu, submenuMaxWidth, children, href, onClick, target, submenuDirection, icon, selected, onKeyDown, variant, showDropdownArrow, ariaLabel, clickToOpen, maxWidth, onSubmenuOpen, onSubmenuClose, overrideColor, rel, as, "data-element": dataElement, "data-role": dataRole, ...rest }: MenuWithChildren | MenuWithIcon) => React.JSX.Element;
|
|
75
|
+
export declare const MenuItem: ({ submenu, submenuMaxWidth, submenuMinWidth, children, href, onClick, target, submenuDirection, icon, selected, onKeyDown, variant, showDropdownArrow, ariaLabel, clickToOpen, maxWidth, onSubmenuOpen, onSubmenuClose, overrideColor, rel, as, "data-element": dataElement, "data-role": dataRole, ...rest }: MenuWithChildren | MenuWithIcon) => React.JSX.Element;
|
|
65
76
|
export default MenuItem;
|
|
@@ -14,6 +14,7 @@ import guid from "../../../__internal__/utils/helpers/guid";
|
|
|
14
14
|
export const MenuItem = ({
|
|
15
15
|
submenu,
|
|
16
16
|
submenuMaxWidth,
|
|
17
|
+
submenuMinWidth,
|
|
17
18
|
children,
|
|
18
19
|
href,
|
|
19
20
|
onClick,
|
|
@@ -145,7 +146,8 @@ export const MenuItem = ({
|
|
|
145
146
|
ariaLabel: ariaLabel,
|
|
146
147
|
onSubmenuOpen: onSubmenuOpen,
|
|
147
148
|
onSubmenuClose: onSubmenuClose,
|
|
148
|
-
submenuMaxWidth: submenuMaxWidth
|
|
149
|
+
submenuMaxWidth: submenuMaxWidth,
|
|
150
|
+
submenuMinWidth: submenuMinWidth
|
|
149
151
|
}, elementProps, {
|
|
150
152
|
variant: variant
|
|
151
153
|
}, rest), children));
|
|
@@ -52,6 +52,12 @@ export interface SidebarProps extends PaddingProps, TagProps, WidthProps, Pick<M
|
|
|
52
52
|
focusableSelectors?: string;
|
|
53
53
|
/** Padding to be set on the Sidebar header */
|
|
54
54
|
headerPadding?: PaddingProps;
|
|
55
|
+
/**
|
|
56
|
+
* @private
|
|
57
|
+
* @ignore
|
|
58
|
+
* @internal
|
|
59
|
+
* Sets className for component. INTERNAL USE ONLY. */
|
|
60
|
+
className?: string;
|
|
55
61
|
}
|
|
56
62
|
export declare const Sidebar: React.ForwardRefExoticComponent<SidebarProps & React.RefAttributes<HTMLDivElement>>;
|
|
57
63
|
export default Sidebar;
|
|
@@ -38,6 +38,7 @@ export const Sidebar = /*#__PURE__*/React.forwardRef(({
|
|
|
38
38
|
headerPadding = {},
|
|
39
39
|
topModalOverride,
|
|
40
40
|
restoreFocusOnClose = true,
|
|
41
|
+
className,
|
|
41
42
|
...rest
|
|
42
43
|
}, ref) => {
|
|
43
44
|
const locale = useLocale();
|
|
@@ -75,7 +76,8 @@ export const Sidebar = /*#__PURE__*/React.forwardRef(({
|
|
|
75
76
|
size: size,
|
|
76
77
|
onCancel: onCancel,
|
|
77
78
|
role: role,
|
|
78
|
-
width: width
|
|
79
|
+
width: width,
|
|
80
|
+
className: className
|
|
79
81
|
}, header && /*#__PURE__*/React.createElement(SidebarHeader, _extends({
|
|
80
82
|
closeIcon: closeIcon()
|
|
81
83
|
}, headerPadding, {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AdaptiveSidebarProps } from "../adaptive-sidebar.component";
|
|
2
|
+
export declare const getColors: (backgroundColor: AdaptiveSidebarProps["backgroundColor"]) => {
|
|
3
|
+
"background-color": string;
|
|
4
|
+
color: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const kebabToCamelCase: (str: string) => string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.kebabToCamelCase = exports.getColors = void 0;
|
|
7
|
+
const getColors = backgroundColor => {
|
|
8
|
+
switch (backgroundColor) {
|
|
9
|
+
case "app":
|
|
10
|
+
return {
|
|
11
|
+
"background-color": "var(--colorsUtilityMajor025)",
|
|
12
|
+
color: "var(--colorsUtilityYin090)"
|
|
13
|
+
};
|
|
14
|
+
case "black":
|
|
15
|
+
return {
|
|
16
|
+
"background-color": "var(--colorsUtilityYin100)",
|
|
17
|
+
color: "var(--colorsUtilityYang100)"
|
|
18
|
+
};
|
|
19
|
+
case "white":
|
|
20
|
+
default:
|
|
21
|
+
return {
|
|
22
|
+
"background-color": "var(--colorsUtilityYang100)",
|
|
23
|
+
color: "var(--colorsUtilityYin090)"
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.getColors = getColors;
|
|
28
|
+
const kebabToCamelCase = str => {
|
|
29
|
+
return str.replace(/-./g, match => match.charAt(1).toUpperCase());
|
|
30
|
+
};
|
|
31
|
+
exports.kebabToCamelCase = kebabToCamelCase;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PaddingProps, MarginProps } from "styled-system";
|
|
3
|
+
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
4
|
+
export interface AdaptiveSidebarProps extends MarginProps, PaddingProps, Omit<TagProps, "data-component"> {
|
|
5
|
+
/** The breakpoint (in pixels) at which the sidebar will convert to a dialog-based sidebar */
|
|
6
|
+
adaptiveBreakpoint?: number;
|
|
7
|
+
/** The time in milliseconds for the sidebar to animate */
|
|
8
|
+
animationTimeout?: number;
|
|
9
|
+
/** The background color of the sidebar */
|
|
10
|
+
backgroundColor?: "white" | "black" | "app";
|
|
11
|
+
/** The color to use for the left-hand border of the sidebar. Should be a design token e.g. `--colorsUtilityYang100` */
|
|
12
|
+
borderColor?: string | "none";
|
|
13
|
+
/** The content of the sidebar */
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
/** The height of the sidebar, relative to the wrapping component */
|
|
16
|
+
height?: string;
|
|
17
|
+
/** Whether the sidebar is open or closed */
|
|
18
|
+
open: boolean;
|
|
19
|
+
/** Whether to render the sidebar as a modal component instead of as an inline sidebar */
|
|
20
|
+
renderAsModal?: boolean;
|
|
21
|
+
/** The width of the sidebar */
|
|
22
|
+
width?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare const AdaptiveSidebar: ({ adaptiveBreakpoint, backgroundColor, borderColor, children, height, open, renderAsModal, width, ...props }: AdaptiveSidebarProps) => React.JSX.Element | null;
|
|
25
|
+
export default AdaptiveSidebar;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.AdaptiveSidebar = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _utils = require("./__internal__/utils");
|
|
9
|
+
var _box = _interopRequireDefault(require("../box"));
|
|
10
|
+
var _utils2 = require("../../style/utils");
|
|
11
|
+
var _useIsAboveBreakpoint = _interopRequireDefault(require("../../hooks/__internal__/useIsAboveBreakpoint"));
|
|
12
|
+
var _adaptiveSidebar = require("./adaptive-sidebar.style");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
17
|
+
const AdaptiveSidebar = ({
|
|
18
|
+
adaptiveBreakpoint = 768,
|
|
19
|
+
backgroundColor = "white",
|
|
20
|
+
borderColor = "none",
|
|
21
|
+
children,
|
|
22
|
+
height = "100%",
|
|
23
|
+
open,
|
|
24
|
+
renderAsModal = false,
|
|
25
|
+
width = "320px",
|
|
26
|
+
...props
|
|
27
|
+
}) => {
|
|
28
|
+
const largeScreen = (0, _useIsAboveBreakpoint.default)(adaptiveBreakpoint);
|
|
29
|
+
const adaptiveSidebarRef = (0, _react.useRef)(null);
|
|
30
|
+
const colours = Object.entries((0, _utils.getColors)(backgroundColor)).reduce((acc, [key, value]) => {
|
|
31
|
+
acc[(0, _utils.kebabToCamelCase)(key)] = value;
|
|
32
|
+
return acc;
|
|
33
|
+
}, {});
|
|
34
|
+
(0, _react.useEffect)(() => {
|
|
35
|
+
/* istanbul ignore next */
|
|
36
|
+
if (adaptiveSidebarRef.current) {
|
|
37
|
+
adaptiveSidebarRef.current.focus();
|
|
38
|
+
}
|
|
39
|
+
}, [open]);
|
|
40
|
+
if (renderAsModal || !largeScreen) {
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement(_adaptiveSidebar.StyledSidebar, {
|
|
42
|
+
backgroundColor: backgroundColor,
|
|
43
|
+
open: open,
|
|
44
|
+
p: 0,
|
|
45
|
+
ref: adaptiveSidebarRef
|
|
46
|
+
}, /*#__PURE__*/_react.default.createElement(_box.default, _extends({
|
|
47
|
+
height: "100%",
|
|
48
|
+
"data-role": "adaptive-sidebar-content-wrapper"
|
|
49
|
+
}, colours), children));
|
|
50
|
+
}
|
|
51
|
+
return open ? /*#__PURE__*/_react.default.createElement(_adaptiveSidebar.StyledAdaptiveSidebar, _extends({
|
|
52
|
+
backgroundColor: backgroundColor,
|
|
53
|
+
borderColor: borderColor === "none" ? undefined : borderColor,
|
|
54
|
+
"data-element": "adaptive-sidebar",
|
|
55
|
+
"data-role": "adaptive-sidebar",
|
|
56
|
+
height: height,
|
|
57
|
+
ref: adaptiveSidebarRef,
|
|
58
|
+
role: "region",
|
|
59
|
+
tabIndex: -1,
|
|
60
|
+
width: width
|
|
61
|
+
}, (0, _utils2.filterStyledSystemMarginProps)(props), (0, _utils2.filterStyledSystemPaddingProps)(props)), /*#__PURE__*/_react.default.createElement(_box.default, {
|
|
62
|
+
"data-role": "adaptive-sidebar-content-wrapper"
|
|
63
|
+
}, children)) : null;
|
|
64
|
+
};
|
|
65
|
+
exports.AdaptiveSidebar = AdaptiveSidebar;
|
|
66
|
+
var _default = exports.default = AdaptiveSidebar;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MarginProps, PaddingProps } from "styled-system";
|
|
3
|
+
import { SidebarProps } from "../sidebar";
|
|
4
|
+
import { AdaptiveSidebarProps } from "./adaptive-sidebar.component";
|
|
5
|
+
declare const StyledAdaptiveSidebar: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../box").BoxProps & import("react").RefAttributes<HTMLDivElement>>, any, Pick<AdaptiveSidebarProps, "width" | "backgroundColor" | "height" | "borderColor"> & MarginProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & PaddingProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & {
|
|
6
|
+
tabIndex: number;
|
|
7
|
+
}, never>;
|
|
8
|
+
interface StyledSidebarProps extends SidebarProps {
|
|
9
|
+
backgroundColor: "app" | "black" | "white";
|
|
10
|
+
}
|
|
11
|
+
declare const StyledSidebar: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<SidebarProps & import("react").RefAttributes<HTMLDivElement>>, any, StyledSidebarProps, never>;
|
|
12
|
+
export { StyledAdaptiveSidebar, StyledSidebar };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledSidebar = exports.StyledAdaptiveSidebar = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
|
+
var _styledSystem = require("styled-system");
|
|
9
|
+
var _box = _interopRequireDefault(require("../box"));
|
|
10
|
+
var _sidebar = _interopRequireDefault(require("../sidebar"));
|
|
11
|
+
var _utils = require("./__internal__/utils");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
|
+
const StyledAdaptiveSidebar = exports.StyledAdaptiveSidebar = (0, _styledComponents.default)(_box.default)`
|
|
16
|
+
${({
|
|
17
|
+
backgroundColor,
|
|
18
|
+
borderColor,
|
|
19
|
+
height,
|
|
20
|
+
width
|
|
21
|
+
}) => (0, _styledComponents.css)`
|
|
22
|
+
${(0, _utils.getColors)(backgroundColor)}
|
|
23
|
+
${borderColor && (0, _styledComponents.css)`
|
|
24
|
+
border-left: 1px solid var(${borderColor});
|
|
25
|
+
`}
|
|
26
|
+
max-height: ${height};
|
|
27
|
+
max-width: ${width};
|
|
28
|
+
min-width: ${width};
|
|
29
|
+
overflow-y: auto;
|
|
30
|
+
|
|
31
|
+
${_styledSystem.margin}
|
|
32
|
+
${_styledSystem.padding}
|
|
33
|
+
`};
|
|
34
|
+
`;
|
|
35
|
+
const StyledSidebar = exports.StyledSidebar = (0, _styledComponents.default)(_sidebar.default)`
|
|
36
|
+
${({
|
|
37
|
+
backgroundColor
|
|
38
|
+
}) => (0, _styledComponents.css)`
|
|
39
|
+
div[data-element="sidebar-content"] {
|
|
40
|
+
${(0, _utils.getColors)(backgroundColor)}
|
|
41
|
+
}
|
|
42
|
+
`}
|
|
43
|
+
`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _adaptiveSidebar.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _adaptiveSidebar = _interopRequireDefault(require("./adaptive-sidebar.component"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -51,6 +51,8 @@ export interface BoxProps extends FlexboxProps, Omit<GridProps, "gridGap" | "gri
|
|
|
51
51
|
"aria-hidden"?: "true" | "false";
|
|
52
52
|
/** @private @internal @ignore */
|
|
53
53
|
"data-component"?: string;
|
|
54
|
+
/** @private @internal @ignore */
|
|
55
|
+
tabIndex?: number;
|
|
54
56
|
}
|
|
55
57
|
export declare const Box: React.ForwardRefExoticComponent<BoxProps & React.RefAttributes<HTMLDivElement>>;
|
|
56
58
|
export default Box;
|
|
@@ -12,6 +12,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
12
12
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
13
13
|
const Box = exports.Box = /*#__PURE__*/_react.default.forwardRef(({
|
|
14
14
|
"data-component": dataComponent,
|
|
15
|
+
tabIndex,
|
|
15
16
|
as,
|
|
16
17
|
id,
|
|
17
18
|
role,
|
|
@@ -70,7 +71,8 @@ const Box = exports.Box = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
70
71
|
borderRadius: borderRadius,
|
|
71
72
|
"aria-hidden": ariaHidden
|
|
72
73
|
}, (0, _tags.default)(dataComponent, rest), (0, _utils.filterStyledSystemMarginProps)(rest), (0, _utils.filterStyledSystemPaddingProps)(rest), (0, _utils.filterStyledSystemFlexboxProps)(rest), (0, _utils.filterStyledSystemGridProps)(rest), (0, _utils.filterStyledSystemLayoutProps)(rest), {
|
|
73
|
-
cssProps: cssProps
|
|
74
|
+
cssProps: cssProps,
|
|
75
|
+
tabIndex: tabIndex
|
|
74
76
|
}), children);
|
|
75
77
|
});
|
|
76
78
|
Box.displayName = "Box";
|
|
@@ -40,6 +40,8 @@ export interface SubmenuProps {
|
|
|
40
40
|
ariaLabel?: string;
|
|
41
41
|
/** Sets the max-width of the submenu container element */
|
|
42
42
|
submenuMaxWidth?: string;
|
|
43
|
+
/** Sets the min-width of the submenu container element */
|
|
44
|
+
submenuMinWidth?: string;
|
|
43
45
|
}
|
|
44
46
|
declare const Submenu: React.ForwardRefExoticComponent<SubmenuProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
45
47
|
export default Submenu;
|
|
@@ -37,6 +37,7 @@ const Submenu = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
37
37
|
onSubmenuClose,
|
|
38
38
|
onClick,
|
|
39
39
|
submenuMaxWidth,
|
|
40
|
+
submenuMinWidth,
|
|
40
41
|
...rest
|
|
41
42
|
}, ref) => {
|
|
42
43
|
const [submenuRef, setSubmenuRef] = (0, _react.useState)(null);
|
|
@@ -333,6 +334,7 @@ const Submenu = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
333
334
|
applyFocusRadiusStyling: applyFocusRadius,
|
|
334
335
|
applyFocusRadiusStylingToLastItem: applyFocusRadiusToLastItem,
|
|
335
336
|
submenuMaxWidth: submenuMaxWidth,
|
|
337
|
+
submenuMinWidth: submenuMinWidth,
|
|
336
338
|
onBlur: handleSubmenuBlur
|
|
337
339
|
}, /*#__PURE__*/_react.default.createElement(_submenu2.default.Provider, {
|
|
338
340
|
value: {
|
|
@@ -8,7 +8,7 @@ interface StyledSubmenuWrapperProps extends SharedStyleProps {
|
|
|
8
8
|
isSubmenuOpen?: boolean;
|
|
9
9
|
asPassiveItem?: boolean;
|
|
10
10
|
}
|
|
11
|
-
interface StyledSubmenuProps extends SharedStyleProps, Pick<SubmenuProps, "variant" | "submenuMaxWidth"> {
|
|
11
|
+
interface StyledSubmenuProps extends SharedStyleProps, Pick<SubmenuProps, "variant" | "submenuMaxWidth" | "submenuMinWidth"> {
|
|
12
12
|
submenuDirection?: string;
|
|
13
13
|
maxHeight?: string;
|
|
14
14
|
applyFocusRadiusStyling: boolean;
|
|
@@ -59,7 +59,8 @@ const StyledSubmenu = exports.StyledSubmenu = _styledComponents.default.ul`
|
|
|
59
59
|
maxHeight,
|
|
60
60
|
applyFocusRadiusStyling,
|
|
61
61
|
applyFocusRadiusStylingToLastItem,
|
|
62
|
-
submenuMaxWidth
|
|
62
|
+
submenuMaxWidth,
|
|
63
|
+
submenuMinWidth
|
|
63
64
|
}) => (0, _styledComponents.css)`
|
|
64
65
|
${!inFullscreenView && menuType && (0, _styledComponents.css)`
|
|
65
66
|
box-shadow: var(--boxShadow100);
|
|
@@ -67,7 +68,7 @@ const StyledSubmenu = exports.StyledSubmenu = _styledComponents.default.ul`
|
|
|
67
68
|
top: 100%;
|
|
68
69
|
background-color: ${variant === "default" ? _menu2.default[menuType].submenuItemBackground : _menu2.default[menuType].background};
|
|
69
70
|
|
|
70
|
-
min-width: 100
|
|
71
|
+
min-width: ${submenuMinWidth ?? "100%"};
|
|
71
72
|
|
|
72
73
|
${submenuMaxWidth && (0, _styledComponents.css)`
|
|
73
74
|
width: max-content;
|
|
@@ -48,8 +48,19 @@ interface MenuItemBaseProps extends TagProps, Pick<LayoutProps, "width" | "maxWi
|
|
|
48
48
|
* Renders MenuItem as a div element
|
|
49
49
|
* */
|
|
50
50
|
as?: "div";
|
|
51
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Sets the maximum width for the item's submenu when it is opened.
|
|
53
|
+
* This prop is only applicable if the item has a submenu.
|
|
54
|
+
* Overrides the maximum width of any items within the submenu.
|
|
55
|
+
* Accepts any valid CSS width value (e.g. "200px", "50%").
|
|
56
|
+
* */
|
|
52
57
|
submenuMaxWidth?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Sets a minimum width for the item's submenu when it is opened.
|
|
60
|
+
* Accepts any valid CSS width value (e.g. "200px", "50%").
|
|
61
|
+
* This prop is only applicable if the item has a submenu.
|
|
62
|
+
* */
|
|
63
|
+
submenuMinWidth?: string;
|
|
53
64
|
}
|
|
54
65
|
export interface MenuWithChildren extends MenuItemBaseProps {
|
|
55
66
|
children?: React.ReactNode;
|
|
@@ -61,5 +72,5 @@ export interface MenuWithIcon extends MenuItemBaseProps {
|
|
|
61
72
|
icon: IconType;
|
|
62
73
|
children?: React.ReactNode;
|
|
63
74
|
}
|
|
64
|
-
export declare const MenuItem: ({ submenu, submenuMaxWidth, children, href, onClick, target, submenuDirection, icon, selected, onKeyDown, variant, showDropdownArrow, ariaLabel, clickToOpen, maxWidth, onSubmenuOpen, onSubmenuClose, overrideColor, rel, as, "data-element": dataElement, "data-role": dataRole, ...rest }: MenuWithChildren | MenuWithIcon) => React.JSX.Element;
|
|
75
|
+
export declare const MenuItem: ({ submenu, submenuMaxWidth, submenuMinWidth, children, href, onClick, target, submenuDirection, icon, selected, onKeyDown, variant, showDropdownArrow, ariaLabel, clickToOpen, maxWidth, onSubmenuOpen, onSubmenuClose, overrideColor, rel, as, "data-element": dataElement, "data-role": dataRole, ...rest }: MenuWithChildren | MenuWithIcon) => React.JSX.Element;
|
|
65
76
|
export default MenuItem;
|
|
@@ -23,6 +23,7 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
23
23
|
const MenuItem = ({
|
|
24
24
|
submenu,
|
|
25
25
|
submenuMaxWidth,
|
|
26
|
+
submenuMinWidth,
|
|
26
27
|
children,
|
|
27
28
|
href,
|
|
28
29
|
onClick,
|
|
@@ -154,7 +155,8 @@ const MenuItem = ({
|
|
|
154
155
|
ariaLabel: ariaLabel,
|
|
155
156
|
onSubmenuOpen: onSubmenuOpen,
|
|
156
157
|
onSubmenuClose: onSubmenuClose,
|
|
157
|
-
submenuMaxWidth: submenuMaxWidth
|
|
158
|
+
submenuMaxWidth: submenuMaxWidth,
|
|
159
|
+
submenuMinWidth: submenuMinWidth
|
|
158
160
|
}, elementProps, {
|
|
159
161
|
variant: variant
|
|
160
162
|
}, rest), children));
|
|
@@ -52,6 +52,12 @@ export interface SidebarProps extends PaddingProps, TagProps, WidthProps, Pick<M
|
|
|
52
52
|
focusableSelectors?: string;
|
|
53
53
|
/** Padding to be set on the Sidebar header */
|
|
54
54
|
headerPadding?: PaddingProps;
|
|
55
|
+
/**
|
|
56
|
+
* @private
|
|
57
|
+
* @ignore
|
|
58
|
+
* @internal
|
|
59
|
+
* Sets className for component. INTERNAL USE ONLY. */
|
|
60
|
+
className?: string;
|
|
55
61
|
}
|
|
56
62
|
export declare const Sidebar: React.ForwardRefExoticComponent<SidebarProps & React.RefAttributes<HTMLDivElement>>;
|
|
57
63
|
export default Sidebar;
|
|
@@ -46,6 +46,7 @@ const Sidebar = exports.Sidebar = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
46
46
|
headerPadding = {},
|
|
47
47
|
topModalOverride,
|
|
48
48
|
restoreFocusOnClose = true,
|
|
49
|
+
className,
|
|
49
50
|
...rest
|
|
50
51
|
}, ref) => {
|
|
51
52
|
const locale = (0, _useLocale.default)();
|
|
@@ -83,7 +84,8 @@ const Sidebar = exports.Sidebar = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
83
84
|
size: size,
|
|
84
85
|
onCancel: onCancel,
|
|
85
86
|
role: role,
|
|
86
|
-
width: width
|
|
87
|
+
width: width,
|
|
88
|
+
className: className
|
|
87
89
|
}, header && /*#__PURE__*/_react.default.createElement(_sidebarHeader.default, _extends({
|
|
88
90
|
closeIcon: closeIcon()
|
|
89
91
|
}, headerPadding, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "151.
|
|
3
|
+
"version": "151.5.0",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -148,8 +148,10 @@
|
|
|
148
148
|
"jsdom-testing-mocks": "^1.11.0",
|
|
149
149
|
"lint-staged": "^11.2.6",
|
|
150
150
|
"mockdate": "^2.0.5",
|
|
151
|
+
"monocart-coverage-reports": "^2.12.2",
|
|
151
152
|
"nock": "^13.3.8",
|
|
152
153
|
"node-fetch": "^3.3.2",
|
|
154
|
+
"nyc": "^17.1.0",
|
|
153
155
|
"prettier": "~3.3.3",
|
|
154
156
|
"raf": "^3.4.1",
|
|
155
157
|
"react": "^18.3.1",
|
|
@@ -185,8 +187,6 @@
|
|
|
185
187
|
"invariant": "^2.2.4",
|
|
186
188
|
"lexical": "^0.21.0",
|
|
187
189
|
"lodash": "^4.17.21",
|
|
188
|
-
"monocart-coverage-reports": "^2.11.4",
|
|
189
|
-
"nyc": "^17.1.0",
|
|
190
190
|
"polished": "^4.2.2",
|
|
191
191
|
"prop-types": "^15.8.1",
|
|
192
192
|
"react-day-picker": "^9.3.2",
|