carbon-react 114.5.1 → 114.6.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/i18n-provider/i18n-provider.component.js +5 -0
- package/esm/components/vertical-menu/index.d.ts +8 -0
- package/esm/components/vertical-menu/index.js +4 -0
- package/esm/components/vertical-menu/vertical-menu-full-screen.component.d.ts +16 -0
- package/esm/components/vertical-menu/vertical-menu-full-screen.component.js +79 -0
- package/esm/components/vertical-menu/vertical-menu-full-screen.context.d.ts +5 -0
- package/esm/components/vertical-menu/vertical-menu-full-screen.context.js +5 -0
- package/esm/components/vertical-menu/vertical-menu-item.component.d.ts +25 -0
- package/esm/components/vertical-menu/vertical-menu-item.component.js +267 -0
- package/esm/components/vertical-menu/vertical-menu-trigger.component.d.ts +13 -0
- package/esm/components/vertical-menu/vertical-menu-trigger.component.js +189 -0
- package/esm/components/vertical-menu/vertical-menu.component.d.ts +16 -0
- package/esm/components/vertical-menu/vertical-menu.component.js +41 -0
- package/esm/components/vertical-menu/vertical-menu.style.d.ts +15 -0
- package/esm/components/vertical-menu/vertical-menu.style.js +127 -0
- package/esm/locales/en-gb.js +5 -0
- package/esm/locales/locale.d.ts +5 -0
- package/esm/locales/pl-pl.js +5 -0
- package/lib/components/i18n-provider/i18n-provider.component.js +5 -0
- package/lib/components/vertical-menu/index.d.ts +8 -0
- package/lib/components/vertical-menu/index.js +39 -0
- package/lib/components/vertical-menu/package.json +6 -0
- package/lib/components/vertical-menu/vertical-menu-full-screen.component.d.ts +16 -0
- package/lib/components/vertical-menu/vertical-menu-full-screen.component.js +104 -0
- package/lib/components/vertical-menu/vertical-menu-full-screen.context.d.ts +5 -0
- package/lib/components/vertical-menu/vertical-menu-full-screen.context.js +17 -0
- package/lib/components/vertical-menu/vertical-menu-item.component.d.ts +25 -0
- package/lib/components/vertical-menu/vertical-menu-item.component.js +287 -0
- package/lib/components/vertical-menu/vertical-menu-trigger.component.d.ts +13 -0
- package/lib/components/vertical-menu/vertical-menu-trigger.component.js +203 -0
- package/lib/components/vertical-menu/vertical-menu.component.d.ts +16 -0
- package/lib/components/vertical-menu/vertical-menu.component.js +54 -0
- package/lib/components/vertical-menu/vertical-menu.style.d.ts +15 -0
- package/lib/components/vertical-menu/vertical-menu.style.js +153 -0
- package/lib/locales/en-gb.js +5 -0
- package/lib/locales/locale.d.ts +5 -0
- package/lib/locales/pl-pl.js +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
3
|
+
export interface VerticalMenuProps extends TagProps {
|
|
4
|
+
/** An aria-label attribute for the menu */
|
|
5
|
+
"aria-label"?: string;
|
|
6
|
+
/** An aria-labelledby attribute for the menu */
|
|
7
|
+
"aria-labelledby"?: string;
|
|
8
|
+
/** Width of the menu */
|
|
9
|
+
width?: string;
|
|
10
|
+
/** Content of the menu - VerticalMenuItem */
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
/** Height of the menu */
|
|
13
|
+
height?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const VerticalMenu: ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, width, children, height, ...rest }: VerticalMenuProps) => JSX.Element;
|
|
16
|
+
export default VerticalMenu;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import PropTypes from "prop-types";
|
|
5
|
+
import tagComponent from "../../__internal__/utils/helpers/tags";
|
|
6
|
+
import { StyledVerticalMenu, StyledList } from "./vertical-menu.style";
|
|
7
|
+
|
|
8
|
+
const VerticalMenu = ({
|
|
9
|
+
"aria-label": ariaLabel,
|
|
10
|
+
"aria-labelledby": ariaLabelledBy,
|
|
11
|
+
width = "322px",
|
|
12
|
+
children,
|
|
13
|
+
height = "100%",
|
|
14
|
+
...rest
|
|
15
|
+
}) => {
|
|
16
|
+
return /*#__PURE__*/React.createElement(StyledVerticalMenu, _extends({
|
|
17
|
+
boxSizing: "border-box",
|
|
18
|
+
scrollVariant: "light",
|
|
19
|
+
backgroundColor: "var(--colorsComponentsLeftnavWinterStandardBackground)",
|
|
20
|
+
width: width,
|
|
21
|
+
height: height,
|
|
22
|
+
py: 1,
|
|
23
|
+
as: "nav",
|
|
24
|
+
overflow: "auto",
|
|
25
|
+
"aria-label": ariaLabel,
|
|
26
|
+
"aria-labelledby": ariaLabelledBy
|
|
27
|
+
}, tagComponent("vertical-menu", rest)), /*#__PURE__*/React.createElement(StyledList, null, children));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
VerticalMenu.propTypes = {
|
|
31
|
+
"aria-label": PropTypes.string,
|
|
32
|
+
"aria-labelledby": PropTypes.string,
|
|
33
|
+
"children": PropTypes.node,
|
|
34
|
+
"data-component": PropTypes.string,
|
|
35
|
+
"data-element": PropTypes.string,
|
|
36
|
+
"data-role": PropTypes.string,
|
|
37
|
+
"height": PropTypes.string,
|
|
38
|
+
"width": PropTypes.string
|
|
39
|
+
};
|
|
40
|
+
export { VerticalMenu };
|
|
41
|
+
export default VerticalMenu;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PaddingProps } from "styled-system";
|
|
3
|
+
export declare const StyledList: import("styled-components").StyledComponent<"ul", any, {}, never>;
|
|
4
|
+
interface StyledVerticalMenuProps extends PaddingProps {
|
|
5
|
+
active?: boolean;
|
|
6
|
+
height: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const StyledVerticalMenuItem: import("styled-components").StyledComponent<"div", any, StyledVerticalMenuProps, never>;
|
|
9
|
+
export declare const StyledTitle: import("styled-components").StyledComponent<"h3", any, {}, never>;
|
|
10
|
+
export declare const StyledAdornment: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
|
+
export declare const StyledTitleIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon").IconProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
|
|
12
|
+
export declare const StyledChevronIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon").IconProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
|
|
13
|
+
export declare const StyledVerticalMenu: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps, never>;
|
|
14
|
+
export declare const StyledVerticalMenuFullScreen: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps, never>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import { padding } from "styled-system";
|
|
3
|
+
import StyledIcon from "../icon/icon.style";
|
|
4
|
+
import Icon from "../icon";
|
|
5
|
+
import Box from "../box";
|
|
6
|
+
export const StyledList = styled.ul`
|
|
7
|
+
list-style: none;
|
|
8
|
+
margin: 0;
|
|
9
|
+
padding: 0;
|
|
10
|
+
`;
|
|
11
|
+
export const StyledVerticalMenuItem = styled.div`
|
|
12
|
+
min-height: ${({
|
|
13
|
+
height
|
|
14
|
+
}) => height};
|
|
15
|
+
width: 100%;
|
|
16
|
+
display: flex;
|
|
17
|
+
border: none;
|
|
18
|
+
align-items: center;
|
|
19
|
+
font-weight: 600;
|
|
20
|
+
font-size: 14px;
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
color: var(--colorsComponentsLeftnavWinterStandardContent);
|
|
23
|
+
position: relative;
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
text-decoration: none;
|
|
26
|
+
background-color: var(--colorsComponentsLeftnavWinterStandardBackground);
|
|
27
|
+
|
|
28
|
+
${padding}
|
|
29
|
+
|
|
30
|
+
&:hover {
|
|
31
|
+
background-color: var(--colorsComponentsLeftnavWinterStandardHover);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:focus {
|
|
35
|
+
outline: 3px solid var(--colorsSemanticFocus500);
|
|
36
|
+
outline-offset: -3px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
${({
|
|
40
|
+
active
|
|
41
|
+
}) => active && css`
|
|
42
|
+
&:before {
|
|
43
|
+
background: var(--colorsComponentsLeftnavWinterStandardSelected);
|
|
44
|
+
content: "";
|
|
45
|
+
height: calc(100% - 16px);
|
|
46
|
+
left: 24px;
|
|
47
|
+
position: absolute;
|
|
48
|
+
top: 8px;
|
|
49
|
+
width: calc(100% - 48px);
|
|
50
|
+
z-index: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&:hover {
|
|
54
|
+
&:before {
|
|
55
|
+
background: var(--colorsComponentsLeftnavWinterStandardHover);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`}
|
|
59
|
+
|
|
60
|
+
${StyledIcon} {
|
|
61
|
+
width: 20px;
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
export const StyledTitle = styled.h3`
|
|
65
|
+
font-weight: 600;
|
|
66
|
+
font-size: 14px;
|
|
67
|
+
line-height: 21px;
|
|
68
|
+
margin: 0;
|
|
69
|
+
z-index: 1;
|
|
70
|
+
text-align: left;
|
|
71
|
+
`;
|
|
72
|
+
export const StyledAdornment = styled.div`
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
justify-content: flex-end;
|
|
76
|
+
flex: 1;
|
|
77
|
+
`;
|
|
78
|
+
export const StyledTitleIcon = styled(Icon)`
|
|
79
|
+
margin-right: 12px;
|
|
80
|
+
width: 20px;
|
|
81
|
+
color: var(--colorsComponentsLeftnavWinterStandardContent);
|
|
82
|
+
`;
|
|
83
|
+
export const StyledChevronIcon = styled(Icon)`
|
|
84
|
+
margin-left: auto;
|
|
85
|
+
padding-left: 12px;
|
|
86
|
+
width: 20px;
|
|
87
|
+
color: var(--colorsComponentsLeftnavWinterStandardContent);
|
|
88
|
+
`;
|
|
89
|
+
export const StyledVerticalMenu = styled(Box)`
|
|
90
|
+
// TODO remove hardcoded values when DS have had chance to review which token to use
|
|
91
|
+
&::-webkit-scrollbar-track {
|
|
92
|
+
background-color: #cccccc;
|
|
93
|
+
}
|
|
94
|
+
&::-webkit-scrollbar-thumb {
|
|
95
|
+
background-color: #808080;
|
|
96
|
+
}
|
|
97
|
+
&::-webkit-scrollbar {
|
|
98
|
+
width: 12px;
|
|
99
|
+
}
|
|
100
|
+
`;
|
|
101
|
+
export const StyledVerticalMenuFullScreen = styled(Box)`
|
|
102
|
+
position: fixed;
|
|
103
|
+
top: 0;
|
|
104
|
+
bottom: 0;
|
|
105
|
+
height: 100vh;
|
|
106
|
+
width: 100%;
|
|
107
|
+
outline: none;
|
|
108
|
+
padding: 8px 0px;
|
|
109
|
+
overflow: auto;
|
|
110
|
+
background-color: var(--colorsComponentsLeftnavWinterStandardBackground);
|
|
111
|
+
box-sizing: border-box;
|
|
112
|
+
transition: all 0.3s ease;
|
|
113
|
+
z-index: ${({
|
|
114
|
+
theme
|
|
115
|
+
}) => theme.zIndex.fullScreenModal};
|
|
116
|
+
|
|
117
|
+
// TODO remove hardcoded values when DS have had chance to review which token to use
|
|
118
|
+
&::-webkit-scrollbar-track {
|
|
119
|
+
background-color: #cccccc;
|
|
120
|
+
}
|
|
121
|
+
&::-webkit-scrollbar-thumb {
|
|
122
|
+
background-color: #808080;
|
|
123
|
+
}
|
|
124
|
+
&::-webkit-scrollbar {
|
|
125
|
+
width: 12px;
|
|
126
|
+
}
|
|
127
|
+
`;
|
package/esm/locales/en-gb.js
CHANGED
package/esm/locales/locale.d.ts
CHANGED
package/esm/locales/pl-pl.js
CHANGED
|
@@ -128,6 +128,11 @@ I18nProvider.propTypes = {
|
|
|
128
128
|
"ariaLabels": _propTypes.default.shape({
|
|
129
129
|
"close": _propTypes.default.func.isRequired
|
|
130
130
|
}).isRequired
|
|
131
|
+
}),
|
|
132
|
+
"verticalMenuFullScreen": _propTypes.default.shape({
|
|
133
|
+
"ariaLabels": _propTypes.default.shape({
|
|
134
|
+
"close": _propTypes.default.func.isRequired
|
|
135
|
+
}).isRequired
|
|
131
136
|
})
|
|
132
137
|
})
|
|
133
138
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as VerticalMenu } from "./vertical-menu.component";
|
|
2
|
+
export type { VerticalMenuProps } from "./vertical-menu.component";
|
|
3
|
+
export { default as VerticalMenuItem } from "./vertical-menu-item.component";
|
|
4
|
+
export type { VerticalMenuItemProps } from "./vertical-menu-item.component";
|
|
5
|
+
export { default as VerticalMenuFullScreen } from "./vertical-menu-full-screen.component";
|
|
6
|
+
export type { VerticalMenuFullScreenProps } from "./vertical-menu-full-screen.component";
|
|
7
|
+
export { default as VerticalMenuTrigger } from "./vertical-menu-trigger.component";
|
|
8
|
+
export type { VerticalMenuTriggerProps } from "./vertical-menu-trigger.component";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "VerticalMenu", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _verticalMenu.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "VerticalMenuItem", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _verticalMenuItem.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "VerticalMenuFullScreen", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _verticalMenuFullScreen.default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "VerticalMenuTrigger", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _verticalMenuTrigger.default;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
var _verticalMenu = _interopRequireDefault(require("./vertical-menu.component"));
|
|
32
|
+
|
|
33
|
+
var _verticalMenuItem = _interopRequireDefault(require("./vertical-menu-item.component"));
|
|
34
|
+
|
|
35
|
+
var _verticalMenuFullScreen = _interopRequireDefault(require("./vertical-menu-full-screen.component"));
|
|
36
|
+
|
|
37
|
+
var _verticalMenuTrigger = _interopRequireDefault(require("./vertical-menu-trigger.component"));
|
|
38
|
+
|
|
39
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
3
|
+
export interface VerticalMenuFullScreenProps extends TagProps {
|
|
4
|
+
/** An aria-label attribute for the menu */
|
|
5
|
+
"aria-label"?: string;
|
|
6
|
+
/** An aria-labelledby attribute for the menu */
|
|
7
|
+
"aria-labelledby"?: string;
|
|
8
|
+
/** Content of the menu - VerticalMenuItem */
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
/** Whether the menu is open or not */
|
|
11
|
+
isOpen: boolean;
|
|
12
|
+
/** A callback to be called when the close icon is clicked or enter is pressed when focused */
|
|
13
|
+
onClose: (ev: React.KeyboardEvent<HTMLButtonElement> | React.MouseEvent<HTMLButtonElement>) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const VerticalMenuFullScreen: ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, children, isOpen, onClose, ...rest }: VerticalMenuFullScreenProps) => JSX.Element | null;
|
|
16
|
+
export default VerticalMenuFullScreen;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.VerticalMenuFullScreen = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags"));
|
|
13
|
+
|
|
14
|
+
var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
|
|
15
|
+
|
|
16
|
+
var _portal = _interopRequireDefault(require("../portal"));
|
|
17
|
+
|
|
18
|
+
var _focusTrap = _interopRequireDefault(require("../../__internal__/focus-trap/focus-trap.component"));
|
|
19
|
+
|
|
20
|
+
var _iconButton = _interopRequireDefault(require("../icon-button"));
|
|
21
|
+
|
|
22
|
+
var _icon = _interopRequireDefault(require("../icon"));
|
|
23
|
+
|
|
24
|
+
var _box = _interopRequireDefault(require("../box"));
|
|
25
|
+
|
|
26
|
+
var _verticalMenu = require("./vertical-menu.style");
|
|
27
|
+
|
|
28
|
+
var _verticalMenuFullScreen = _interopRequireDefault(require("./vertical-menu-full-screen.context"));
|
|
29
|
+
|
|
30
|
+
var _events = _interopRequireDefault(require("../../__internal__/utils/helpers/events/events"));
|
|
31
|
+
|
|
32
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
|
+
|
|
34
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
35
|
+
|
|
36
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
|
+
|
|
38
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
39
|
+
|
|
40
|
+
const VerticalMenuFullScreen = ({
|
|
41
|
+
"aria-label": ariaLabel,
|
|
42
|
+
"aria-labelledby": ariaLabelledBy,
|
|
43
|
+
children,
|
|
44
|
+
isOpen,
|
|
45
|
+
onClose,
|
|
46
|
+
...rest
|
|
47
|
+
}) => {
|
|
48
|
+
const l = (0, _useLocale.default)();
|
|
49
|
+
const menuWrapperRef = (0, _react.useRef)(null);
|
|
50
|
+
const handleKeyDown = (0, _react.useCallback)(ev => {
|
|
51
|
+
// istanbul ignore else
|
|
52
|
+
if (_events.default.isEscKey(ev)) {
|
|
53
|
+
onClose(ev);
|
|
54
|
+
}
|
|
55
|
+
}, [onClose]); // TODO remove this as part of FE-5650
|
|
56
|
+
|
|
57
|
+
if (!isOpen) return null;
|
|
58
|
+
return /*#__PURE__*/_react.default.createElement(_portal.default, null, /*#__PURE__*/_react.default.createElement(_focusTrap.default, {
|
|
59
|
+
isOpen: isOpen,
|
|
60
|
+
wrapperRef: menuWrapperRef
|
|
61
|
+
}, /*#__PURE__*/_react.default.createElement(_verticalMenu.StyledVerticalMenuFullScreen, _extends({
|
|
62
|
+
ref: menuWrapperRef,
|
|
63
|
+
scrollVariant: "light",
|
|
64
|
+
as: "nav",
|
|
65
|
+
"aria-label": ariaLabel,
|
|
66
|
+
"aria-labelledby": ariaLabelledBy,
|
|
67
|
+
onKeyDown: handleKeyDown
|
|
68
|
+
}, (0, _tags.default)("vertical-menu-full-screen", rest)), /*#__PURE__*/_react.default.createElement(_box.default, {
|
|
69
|
+
display: "flex",
|
|
70
|
+
justifyContent: "flex-end",
|
|
71
|
+
height: "60px",
|
|
72
|
+
alignItems: "flex-start",
|
|
73
|
+
px: "20px",
|
|
74
|
+
pt: "20px",
|
|
75
|
+
boxSizing: "border-box"
|
|
76
|
+
}, /*#__PURE__*/_react.default.createElement(_iconButton.default, {
|
|
77
|
+
"aria-label": l.verticalMenuFullScreen.ariaLabels.close(),
|
|
78
|
+
onAction: onClose,
|
|
79
|
+
"data-element": "close"
|
|
80
|
+
}, /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
81
|
+
type: "close",
|
|
82
|
+
color: "var(--colorsComponentsLeftnavWinterStandardContent)",
|
|
83
|
+
bgSize: "small",
|
|
84
|
+
fontSize: "medium"
|
|
85
|
+
}))), /*#__PURE__*/_react.default.createElement(_verticalMenuFullScreen.default.Provider, {
|
|
86
|
+
value: {
|
|
87
|
+
isFullScreen: true
|
|
88
|
+
}
|
|
89
|
+
}, /*#__PURE__*/_react.default.createElement(_verticalMenu.StyledList, null, children)))));
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
exports.VerticalMenuFullScreen = VerticalMenuFullScreen;
|
|
93
|
+
VerticalMenuFullScreen.propTypes = {
|
|
94
|
+
"aria-label": _propTypes.default.string,
|
|
95
|
+
"aria-labelledby": _propTypes.default.string,
|
|
96
|
+
"children": _propTypes.default.node,
|
|
97
|
+
"data-component": _propTypes.default.string,
|
|
98
|
+
"data-element": _propTypes.default.string,
|
|
99
|
+
"data-role": _propTypes.default.string,
|
|
100
|
+
"isOpen": _propTypes.default.bool.isRequired,
|
|
101
|
+
"onClose": _propTypes.default.func.isRequired
|
|
102
|
+
};
|
|
103
|
+
var _default = VerticalMenuFullScreen;
|
|
104
|
+
exports.default = _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
const VerticalMenuFullScreenContext = /*#__PURE__*/_react.default.createContext({
|
|
13
|
+
isFullScreen: false
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
var _default = VerticalMenuFullScreenContext;
|
|
17
|
+
exports.default = _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PaddingProps } from "styled-system";
|
|
3
|
+
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
4
|
+
import { IconType } from "../icon";
|
|
5
|
+
export interface VerticalMenuItemProps<T = React.ElementType> extends PaddingProps, TagProps {
|
|
6
|
+
/** Children of the menu item - another level of VerticalMenuItems */
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
/** Title of the menu item */
|
|
9
|
+
title: string;
|
|
10
|
+
/** Adornment of the menu item meant to be rendered on the right side */
|
|
11
|
+
adornment?: React.ReactNode | ((isOpen: boolean) => React.ReactNode);
|
|
12
|
+
/** Icon meant to be rendered on the left side */
|
|
13
|
+
iconType?: IconType;
|
|
14
|
+
/** Whether the menu item is active or not */
|
|
15
|
+
active?: boolean | ((isOpen: boolean) => boolean);
|
|
16
|
+
/** Height of the menu item */
|
|
17
|
+
height?: string;
|
|
18
|
+
/** Href, when passed the menu item will be rendered as an anchor tag */
|
|
19
|
+
href?: string;
|
|
20
|
+
/** Optional component to render instead of the default div, useful for rendering router link components */
|
|
21
|
+
component?: T;
|
|
22
|
+
}
|
|
23
|
+
declare type InferredComponentProps<T extends React.ElementType> = Omit<React.ComponentProps<T>, keyof VerticalMenuItemProps<T>>;
|
|
24
|
+
export declare const VerticalMenuItem: <T>({ title, iconType, adornment, children, component, active, height, href, ...rest }: T extends React.ElementType<any> ? InferredComponentProps<T> & VerticalMenuItemProps<T> : VerticalMenuItemProps<React.ElementType<any>>) => JSX.Element;
|
|
25
|
+
export default VerticalMenuItem;
|