carbon-react 117.4.1 → 117.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/__internal__/input/input.component.d.ts +3 -3
- package/esm/components/advanced-color-picker/advanced-color-picker.component.js +8 -0
- package/esm/components/button-toggle/button-toggle.component.js +7 -0
- package/esm/components/checkbox/checkbox.component.js +6 -0
- package/esm/components/decimal/decimal.component.js +7 -0
- package/esm/components/grouped-character/grouped-character.component.js +6 -0
- package/esm/components/menu/__internal__/locators.d.ts +6 -6
- package/esm/components/menu/__internal__/spec-helper/index.d.ts +3 -0
- package/esm/components/menu/__internal__/submenu/index.d.ts +2 -0
- package/esm/components/menu/__internal__/submenu/index.js +1 -0
- package/esm/components/menu/__internal__/submenu/submenu.component.d.ts +42 -0
- package/esm/components/menu/__internal__/submenu/submenu.component.js +162 -85
- package/esm/components/menu/__internal__/submenu/submenu.context.d.ts +10 -0
- package/esm/components/menu/__internal__/submenu/submenu.style.d.ts +16 -0
- package/esm/components/menu/__internal__/submenu/submenu.style.js +4 -4
- package/esm/components/menu/index.d.ts +12 -6
- package/esm/components/menu/index.js +5 -5
- package/esm/components/menu/menu-divider/index.d.ts +2 -2
- package/esm/components/menu/menu-divider/index.js +1 -0
- package/esm/components/menu/menu-divider/menu-divider.component.d.ts +7 -0
- package/esm/components/menu/menu-divider/menu-divider.component.js +14 -7
- package/esm/components/menu/menu-divider/menu-divider.style.d.ts +6 -0
- package/esm/components/menu/menu-full-screen/index.d.ts +2 -2
- package/esm/components/menu/menu-full-screen/menu-full-screen.component.d.ts +14 -0
- package/esm/components/menu/menu-full-screen/menu-full-screen.component.js +20 -30
- package/esm/components/menu/menu-full-screen/menu-full-screen.style.d.ts +8 -0
- package/esm/components/menu/menu-full-screen/menu-full-screen.style.js +29 -27
- package/esm/components/menu/menu-item/index.d.ts +2 -2
- package/esm/components/menu/menu-item/menu-item.component.d.ts +67 -0
- package/esm/components/menu/menu-item/menu-item.component.js +2084 -121
- package/esm/components/menu/menu-item/menu-item.style.d.ts +21 -0
- package/esm/components/menu/menu-item/menu-item.style.js +188 -146
- package/esm/components/menu/menu-segment-title/index.d.ts +2 -2
- package/esm/components/menu/menu-segment-title/index.js +1 -0
- package/esm/components/menu/menu-segment-title/menu-segment-title.component.d.ts +10 -0
- package/esm/components/menu/menu-segment-title/menu-segment-title.component.js +13 -9
- package/esm/components/menu/menu-segment-title/menu-segment-title.style.d.ts +8 -0
- package/esm/components/menu/menu.component.d.ts +11 -9
- package/esm/components/menu/menu.component.js +1887 -18
- package/esm/components/menu/menu.config.d.ts +58 -94
- package/esm/components/menu/menu.context.d.ts +12 -6
- package/esm/components/menu/menu.style.d.ts +12 -2
- package/esm/components/menu/menu.style.js +11 -11
- package/esm/components/menu/scrollable-block/index.d.ts +2 -1
- package/esm/components/menu/scrollable-block/scrollable-block.component.d.ts +19 -0
- package/esm/components/menu/scrollable-block/scrollable-block.component.js +13 -20
- package/esm/components/menu/scrollable-block/scrollable-block.style.d.ts +8 -0
- package/esm/components/number/number.component.js +6 -0
- package/esm/components/numeral-date/numeral-date.component.js +8 -0
- package/esm/components/radio-button/radio-button-group.component.js +8 -0
- package/esm/components/radio-button/radio-button.style.js +1 -1
- package/esm/components/search/search.component.js +6 -0
- package/esm/components/select/filterable-select/filterable-select.component.js +9 -1
- package/esm/components/select/multi-select/multi-select.component.js +9 -1
- package/esm/components/select/simple-select/simple-select.component.js +9 -1
- package/esm/components/simple-color-picker/simple-color-picker.component.js +8 -0
- package/esm/components/switch/switch.component.js +6 -0
- package/esm/components/textarea/textarea.component.js +6 -0
- package/esm/components/textbox/textbox.component.js +6 -0
- package/esm/components/vertical-menu/vertical-menu-item.component.d.ts +3 -1
- package/esm/components/vertical-menu/vertical-menu-item.component.js +3 -1
- package/lib/__internal__/input/input.component.d.ts +3 -3
- package/lib/components/advanced-color-picker/advanced-color-picker.component.js +11 -0
- package/lib/components/button-toggle/button-toggle.component.js +10 -0
- package/lib/components/checkbox/checkbox.component.js +7 -0
- package/lib/components/decimal/decimal.component.js +8 -0
- package/lib/components/grouped-character/grouped-character.component.js +7 -0
- package/lib/components/menu/__internal__/locators.d.ts +6 -6
- package/lib/components/menu/__internal__/spec-helper/index.d.ts +3 -0
- package/lib/components/menu/__internal__/submenu/index.d.ts +2 -0
- package/lib/components/menu/__internal__/submenu/index.js +15 -0
- package/lib/components/menu/__internal__/submenu/package.json +6 -0
- package/lib/components/menu/__internal__/submenu/submenu.component.d.ts +42 -0
- package/lib/components/menu/__internal__/submenu/submenu.component.js +162 -86
- package/lib/components/menu/__internal__/submenu/submenu.context.d.ts +10 -0
- package/lib/components/menu/__internal__/submenu/submenu.style.d.ts +16 -0
- package/lib/components/menu/__internal__/submenu/submenu.style.js +4 -4
- package/lib/components/menu/index.d.ts +12 -6
- package/lib/components/menu/index.js +5 -5
- package/lib/components/menu/menu-divider/index.d.ts +2 -2
- package/lib/components/menu/menu-divider/index.js +15 -0
- package/lib/components/menu/menu-divider/menu-divider.component.d.ts +7 -0
- package/lib/components/menu/menu-divider/menu-divider.component.js +15 -7
- package/lib/components/menu/menu-divider/menu-divider.style.d.ts +6 -0
- package/lib/components/menu/menu-divider/package.json +6 -0
- package/lib/components/menu/menu-full-screen/index.d.ts +2 -2
- package/lib/components/menu/menu-full-screen/menu-full-screen.component.d.ts +14 -0
- package/lib/components/menu/menu-full-screen/menu-full-screen.component.js +22 -31
- package/lib/components/menu/menu-full-screen/menu-full-screen.style.d.ts +8 -0
- package/lib/components/menu/menu-full-screen/menu-full-screen.style.js +30 -28
- package/lib/components/menu/menu-item/index.d.ts +2 -2
- package/lib/components/menu/menu-item/menu-item.component.d.ts +67 -0
- package/lib/components/menu/menu-item/menu-item.component.js +2085 -122
- package/lib/components/menu/menu-item/menu-item.style.d.ts +21 -0
- package/lib/components/menu/menu-item/menu-item.style.js +191 -146
- package/lib/components/menu/menu-segment-title/index.d.ts +2 -2
- package/lib/components/menu/menu-segment-title/index.js +15 -0
- package/lib/components/menu/menu-segment-title/menu-segment-title.component.d.ts +10 -0
- package/lib/components/menu/menu-segment-title/menu-segment-title.component.js +14 -9
- package/lib/components/menu/menu-segment-title/menu-segment-title.style.d.ts +8 -0
- package/lib/components/menu/menu-segment-title/package.json +6 -0
- package/lib/components/menu/menu.component.d.ts +11 -9
- package/lib/components/menu/menu.component.js +1889 -20
- package/lib/components/menu/menu.config.d.ts +58 -94
- package/lib/components/menu/menu.context.d.ts +12 -6
- package/lib/components/menu/menu.style.d.ts +12 -2
- package/lib/components/menu/menu.style.js +12 -12
- package/lib/components/menu/scrollable-block/index.d.ts +2 -1
- package/lib/components/menu/scrollable-block/scrollable-block.component.d.ts +19 -0
- package/lib/components/menu/scrollable-block/scrollable-block.component.js +15 -21
- package/lib/components/menu/scrollable-block/scrollable-block.style.d.ts +8 -0
- package/lib/components/number/number.component.js +7 -0
- package/lib/components/numeral-date/numeral-date.component.js +10 -0
- package/lib/components/radio-button/radio-button-group.component.js +11 -0
- package/lib/components/radio-button/radio-button.style.js +1 -1
- package/lib/components/search/search.component.js +7 -0
- package/lib/components/select/filterable-select/filterable-select.component.js +10 -1
- package/lib/components/select/multi-select/multi-select.component.js +10 -1
- package/lib/components/select/simple-select/simple-select.component.js +10 -1
- package/lib/components/simple-color-picker/simple-color-picker.component.js +11 -0
- package/lib/components/switch/switch.component.js +7 -0
- package/lib/components/textarea/textarea.component.js +7 -0
- package/lib/components/textbox/textbox.component.js +7 -0
- package/lib/components/vertical-menu/vertical-menu-item.component.d.ts +3 -1
- package/lib/components/vertical-menu/vertical-menu-item.component.js +3 -1
- package/package.json +2 -2
- package/esm/components/menu/menu-divider/menu-divider.d.ts +0 -11
- package/esm/components/menu/menu-full-screen/menu-full-screen.d.ts +0 -16
- package/esm/components/menu/menu-item/menu-item.d.ts +0 -60
- package/esm/components/menu/menu-segment-title/menu-segment-title.d.ts +0 -12
- package/esm/components/menu/menu.d.ts +0 -28
- package/esm/components/menu/scrollable-block/scrollable-block.d.ts +0 -20
- package/lib/components/menu/menu-divider/menu-divider.d.ts +0 -11
- package/lib/components/menu/menu-full-screen/menu-full-screen.d.ts +0 -16
- package/lib/components/menu/menu-item/menu-item.d.ts +0 -60
- package/lib/components/menu/menu-segment-title/menu-segment-title.d.ts +0 -12
- package/lib/components/menu/menu.d.ts +0 -28
- package/lib/components/menu/scrollable-block/scrollable-block.d.ts +0 -20
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { default as Menu } from "./menu.component";
|
|
2
|
-
export { default as MenuItem } from "./menu-item
|
|
3
|
-
export { default as MenuDivider } from "./menu-divider
|
|
4
|
-
export { default as MenuSegmentTitle } from "./menu-segment-title
|
|
5
|
-
export { default as MenuFullscreen } from "./menu-full-screen
|
|
6
|
-
export { default as ScrollableBlock } from "./scrollable-block
|
|
2
|
+
export { default as MenuItem } from "./menu-item";
|
|
3
|
+
export { default as MenuDivider } from "./menu-divider";
|
|
4
|
+
export { default as MenuSegmentTitle } from "./menu-segment-title";
|
|
5
|
+
export { default as MenuFullscreen } from "./menu-full-screen";
|
|
6
|
+
export { default as ScrollableBlock } from "./scrollable-block";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from "./menu-divider";
|
|
2
|
-
export
|
|
1
|
+
export { default } from "./menu-divider.component";
|
|
2
|
+
export type { MenuDividerProps } from "./menu-divider.component";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./menu-divider.component";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TagProps } from "../../../__internal__/utils/helpers/tags";
|
|
3
|
+
export interface MenuDividerProps extends TagProps {
|
|
4
|
+
size?: "default" | "large";
|
|
5
|
+
}
|
|
6
|
+
declare const MenuDivider: React.ForwardRefExoticComponent<MenuDividerProps & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export default MenuDivider;
|
|
@@ -1,23 +1,30 @@
|
|
|
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
|
+
|
|
1
3
|
import React, { useContext } from "react";
|
|
2
4
|
import PropTypes from "prop-types";
|
|
3
5
|
import StyledDivider from "./menu-divider.style";
|
|
4
6
|
import MenuContext from "../menu.context";
|
|
5
7
|
import { StyledMenuItem } from "../menu.style";
|
|
8
|
+
import tagComponent from "../../../__internal__/utils/helpers/tags";
|
|
6
9
|
const MenuDivider = /*#__PURE__*/React.forwardRef(({
|
|
7
|
-
size = "default"
|
|
10
|
+
size = "default",
|
|
11
|
+
...rest
|
|
8
12
|
}, ref) => {
|
|
9
13
|
const menuContext = useContext(MenuContext);
|
|
10
14
|
return /*#__PURE__*/React.createElement(StyledMenuItem, {
|
|
11
15
|
inSubmenu: true
|
|
12
|
-
}, /*#__PURE__*/React.createElement(StyledDivider, {
|
|
13
|
-
size: size
|
|
14
|
-
|
|
16
|
+
}, /*#__PURE__*/React.createElement(StyledDivider, _extends({
|
|
17
|
+
size: size
|
|
18
|
+
}, tagComponent("menu-divider", rest), {
|
|
15
19
|
menuType: menuContext.menuType,
|
|
16
20
|
ref: ref
|
|
17
|
-
}));
|
|
21
|
+
})));
|
|
18
22
|
});
|
|
19
23
|
MenuDivider.propTypes = {
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
"data-component": PropTypes.string,
|
|
25
|
+
"data-element": PropTypes.string,
|
|
26
|
+
"data-role": PropTypes.string,
|
|
27
|
+
"size": PropTypes.oneOf(["default", "large"])
|
|
22
28
|
};
|
|
29
|
+
MenuDivider.displayName = "MenuDivider";
|
|
23
30
|
export default MenuDivider;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MenuDividerProps } from "./menu-divider.component";
|
|
2
|
+
import { MenuType } from "../menu.context";
|
|
3
|
+
declare const StyledDivider: import("styled-components").StyledComponent<"div", any, MenuDividerProps & {
|
|
4
|
+
menuType: MenuType;
|
|
5
|
+
}, never>;
|
|
6
|
+
export default StyledDivider;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from "./menu-full-screen";
|
|
2
|
-
export
|
|
1
|
+
export { default } from "./menu-full-screen.component";
|
|
2
|
+
export type { MenuFullscreenProps } from "./menu-full-screen.component";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TagProps } from "../../../__internal__/utils/helpers/tags";
|
|
3
|
+
export interface MenuFullscreenProps extends TagProps {
|
|
4
|
+
/** The child elements to render */
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
/** Sets whether the component is open or closed */
|
|
7
|
+
isOpen?: boolean;
|
|
8
|
+
/** The start position for the component to open from */
|
|
9
|
+
startPosition?: "left" | "right";
|
|
10
|
+
/** A callback to be called when the close icon is clicked or enter is pressed when focused */
|
|
11
|
+
onClose: (ev: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLButtonElement>) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const MenuFullscreen: ({ children, isOpen, startPosition, onClose, ...rest }: MenuFullscreenProps) => JSX.Element;
|
|
14
|
+
export default MenuFullscreen;
|
|
@@ -12,6 +12,7 @@ import IconButton from "../../icon-button";
|
|
|
12
12
|
import Icon from "../../icon";
|
|
13
13
|
import Portal from "../../portal";
|
|
14
14
|
import MenuDivider from "../menu-divider/menu-divider.component";
|
|
15
|
+
import tagComponent from "../../../__internal__/utils/helpers/tags";
|
|
15
16
|
|
|
16
17
|
const MenuFullscreen = ({
|
|
17
18
|
children,
|
|
@@ -20,11 +21,12 @@ const MenuFullscreen = ({
|
|
|
20
21
|
onClose,
|
|
21
22
|
...rest
|
|
22
23
|
}) => {
|
|
23
|
-
const menuWrapperRef = useRef();
|
|
24
|
-
const menuContentRef = useRef();
|
|
24
|
+
const menuWrapperRef = useRef(null);
|
|
25
|
+
const menuContentRef = useRef(null);
|
|
25
26
|
const {
|
|
26
27
|
menuType
|
|
27
28
|
} = useContext(MenuContext);
|
|
29
|
+
const isDarkVariant = ["dark", "black"].includes(menuType);
|
|
28
30
|
|
|
29
31
|
const handleKeyDown = ev => {
|
|
30
32
|
/* istanbul ignore else */
|
|
@@ -33,31 +35,18 @@ const MenuFullscreen = ({
|
|
|
33
35
|
}
|
|
34
36
|
};
|
|
35
37
|
|
|
36
|
-
const scrollVariants = {
|
|
37
|
-
light: "light",
|
|
38
|
-
dark: "dark",
|
|
39
|
-
white: "light",
|
|
40
|
-
black: "dark"
|
|
41
|
-
};
|
|
42
|
-
const iconColors = {
|
|
43
|
-
light: undefined,
|
|
44
|
-
dark: "#FFFFFF",
|
|
45
|
-
white: undefined,
|
|
46
|
-
black: "#FFFFFF"
|
|
47
|
-
};
|
|
48
38
|
return /*#__PURE__*/React.createElement("li", {
|
|
49
39
|
"aria-label": "menu-fullscreen"
|
|
50
40
|
}, /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(FocusTrap, {
|
|
51
41
|
wrapperRef: menuWrapperRef,
|
|
52
42
|
isOpen: isOpen
|
|
53
43
|
}, /*#__PURE__*/React.createElement(StyledMenuFullscreen, _extends({
|
|
54
|
-
"data-component": "menu-fullscreen",
|
|
55
44
|
ref: menuWrapperRef,
|
|
56
45
|
isOpen: isOpen,
|
|
57
46
|
menuType: menuType,
|
|
58
47
|
startPosition: startPosition,
|
|
59
48
|
onKeyDown: handleKeyDown
|
|
60
|
-
}, rest), /*#__PURE__*/React.createElement(StyledMenuFullscreenHeader, {
|
|
49
|
+
}, rest, tagComponent("menu-fullscreen", rest)), /*#__PURE__*/React.createElement(StyledMenuFullscreenHeader, {
|
|
61
50
|
isOpen: isOpen,
|
|
62
51
|
menuType: menuType,
|
|
63
52
|
startPosition: startPosition
|
|
@@ -67,10 +56,10 @@ const MenuFullscreen = ({
|
|
|
67
56
|
"data-element": "close"
|
|
68
57
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
69
58
|
type: "close",
|
|
70
|
-
color:
|
|
59
|
+
color: isDarkVariant ? "--colorsYang100" : undefined
|
|
71
60
|
}))), /*#__PURE__*/React.createElement(Box, {
|
|
72
61
|
overflowY: "auto",
|
|
73
|
-
scrollVariant:
|
|
62
|
+
scrollVariant: isDarkVariant ? "dark" : "light",
|
|
74
63
|
width: "100%",
|
|
75
64
|
height: "calc(100% - 40px)"
|
|
76
65
|
}, /*#__PURE__*/React.createElement(StyledMenuWrapper, {
|
|
@@ -85,22 +74,23 @@ const MenuFullscreen = ({
|
|
|
85
74
|
value: {
|
|
86
75
|
inFullscreenView: true,
|
|
87
76
|
menuType,
|
|
88
|
-
inMenu: true
|
|
77
|
+
inMenu: true,
|
|
78
|
+
openSubmenuId: null,
|
|
79
|
+
setOpenSubmenuId:
|
|
80
|
+
/* istanbul ignore next */
|
|
81
|
+
() => {}
|
|
89
82
|
}
|
|
90
83
|
}, React.Children.map(children, (child, index) => /*#__PURE__*/React.createElement(React.Fragment, null, child, index < React.Children.count(children) - 1 && /*#__PURE__*/React.createElement(MenuDivider, null))))))))));
|
|
91
84
|
};
|
|
92
85
|
|
|
93
86
|
MenuFullscreen.propTypes = {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
isOpen: PropTypes.bool,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
startPosition: PropTypes.oneOf(["left", "right"]),
|
|
102
|
-
|
|
103
|
-
/** A callback to be called when the close icon is clicked or enter is pressed when focused */
|
|
104
|
-
onClose: PropTypes.func.isRequired
|
|
87
|
+
"children": PropTypes.node,
|
|
88
|
+
"data-component": PropTypes.string,
|
|
89
|
+
"data-element": PropTypes.string,
|
|
90
|
+
"data-role": PropTypes.string,
|
|
91
|
+
"isOpen": PropTypes.bool,
|
|
92
|
+
"onClose": PropTypes.func.isRequired,
|
|
93
|
+
"startPosition": PropTypes.oneOf(["left", "right"])
|
|
105
94
|
};
|
|
95
|
+
export { MenuFullscreen };
|
|
106
96
|
export default MenuFullscreen;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MenuFullscreenProps } from "./menu-full-screen.component";
|
|
2
|
+
import { MenuType } from "../menu.context";
|
|
3
|
+
interface StyledMenuFullScreenProps extends Pick<MenuFullscreenProps, "isOpen" | "startPosition"> {
|
|
4
|
+
menuType: MenuType;
|
|
5
|
+
}
|
|
6
|
+
declare const StyledMenuFullscreen: import("styled-components").StyledComponent<"div", any, StyledMenuFullScreenProps, never>;
|
|
7
|
+
declare const StyledMenuFullscreenHeader: import("styled-components").StyledComponent<"div", any, StyledMenuFullScreenProps, never>;
|
|
8
|
+
export { StyledMenuFullscreen, StyledMenuFullscreenHeader };
|
|
@@ -29,41 +29,43 @@ const StyledMenuFullscreen = styled.div`
|
|
|
29
29
|
background-color: ${menuConfigVariants[menuType].background};
|
|
30
30
|
z-index: ${theme.zIndex.fullScreenModal};
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
${
|
|
34
|
-
|
|
32
|
+
&& {
|
|
33
|
+
${menuType === "dark" && css`
|
|
34
|
+
${StyledSearch} span > [data-component="icon"] {
|
|
35
|
+
color: var(--colorsUtilityMajor200);
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
&:hover {
|
|
38
|
+
color: var(--colorsUtilityMajor150);
|
|
39
|
+
}
|
|
38
40
|
}
|
|
39
|
-
}
|
|
40
|
-
`}
|
|
41
|
+
`}
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
${menuType === "light" && css`
|
|
44
|
+
${StyledSearch} span > [data-component="icon"] {
|
|
45
|
+
color: var(--colorsUtilityMajor200);
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
&:hover {
|
|
48
|
+
color: var(--colorsUtilityMajor400);
|
|
49
|
+
}
|
|
48
50
|
}
|
|
49
|
-
}
|
|
50
|
-
`}
|
|
51
|
+
`}
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
${StyledSearch} {
|
|
54
|
+
${StyledIcon} {
|
|
55
|
+
display: inline-flex;
|
|
56
|
+
margin-right: 0;
|
|
57
|
+
bottom: auto;
|
|
58
|
+
}
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
${StyledButton} {
|
|
61
|
+
display: flex;
|
|
62
|
+
line-height: normal;
|
|
63
|
+
padding-bottom: 0;
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
&:focus {
|
|
66
|
+
outline: solid 3px var(--colorsSemanticFocus500);
|
|
67
|
+
box-shadow: none;
|
|
68
|
+
}
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from "./menu-item";
|
|
2
|
-
export
|
|
1
|
+
export { default } from "./menu-item.component";
|
|
2
|
+
export type { MenuWithChildren, MenuWithIcon, VariantType, } from "./menu-item.component";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FlexboxProps, LayoutProps, MaxWidthProps, PaddingProps } from "styled-system";
|
|
3
|
+
import { IconType } from "../../icon";
|
|
4
|
+
import { TagProps } from "../../../__internal__/utils/helpers/tags";
|
|
5
|
+
export declare type VariantType = "default" | "alternate";
|
|
6
|
+
interface MenuItemBaseProps extends TagProps, LayoutProps, FlexboxProps, PaddingProps {
|
|
7
|
+
/** Custom className */
|
|
8
|
+
className?: string;
|
|
9
|
+
/** onClick handler */
|
|
10
|
+
onClick?: (event: React.MouseEvent<HTMLAnchorElement> | React.MouseEvent<HTMLButtonElement>) => void;
|
|
11
|
+
/** Defines which direction the submenu will hang eg. left/right */
|
|
12
|
+
submenuDirection?: string;
|
|
13
|
+
/** Is the menu item the currently selected item. */
|
|
14
|
+
selected?: boolean;
|
|
15
|
+
/** A title for the menu item that has a submenu. */
|
|
16
|
+
submenu?: string | boolean;
|
|
17
|
+
/** The href to use for the menu item. */
|
|
18
|
+
href?: string;
|
|
19
|
+
/** onKeyDown handler */
|
|
20
|
+
onKeyDown?: (event: React.KeyboardEvent<HTMLAnchorElement> | React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
21
|
+
/** The target to use for the menu item. */
|
|
22
|
+
target?: string;
|
|
23
|
+
/** The rel attribute to be used for the underlying <a> tag */
|
|
24
|
+
rel?: string;
|
|
25
|
+
/** set the colour variant for a menuType */
|
|
26
|
+
variant?: VariantType;
|
|
27
|
+
/** Flag to display the dropdown arrow when an item has a submenu */
|
|
28
|
+
showDropdownArrow?: boolean;
|
|
29
|
+
/** If no text is provided an ariaLabel should be given to facilitate accessibility. */
|
|
30
|
+
ariaLabel?: string;
|
|
31
|
+
/** Callback triggered when submenu opens. Only valid with submenu prop */
|
|
32
|
+
onSubmenuOpen?: () => void;
|
|
33
|
+
/** Callback triggered when submenu closes. Only valid with submenu prop */
|
|
34
|
+
onSubmenuClose?: () => void;
|
|
35
|
+
/**
|
|
36
|
+
@ignore @private
|
|
37
|
+
private prop, used inside ScrollableBlock to ensure the MenuItem's color variant overrides the CSS
|
|
38
|
+
for other MenuItems inside the block
|
|
39
|
+
*/
|
|
40
|
+
overrideColor?: boolean;
|
|
41
|
+
/** @private @ignore */
|
|
42
|
+
"data-component"?: string;
|
|
43
|
+
/** When set the submenu opens by click instead of hover */
|
|
44
|
+
clickToOpen?: boolean;
|
|
45
|
+
/** Sets the maxWidth of the MenuItem */
|
|
46
|
+
maxWidth?: MaxWidthProps["maxWidth"];
|
|
47
|
+
/**
|
|
48
|
+
* @private @ignore
|
|
49
|
+
* Renders MenuItem as a div element
|
|
50
|
+
* */
|
|
51
|
+
as?: "div";
|
|
52
|
+
}
|
|
53
|
+
export interface MenuWithChildren extends MenuItemBaseProps {
|
|
54
|
+
children?: React.ReactNode;
|
|
55
|
+
/** Either prop `icon` must be defined or this node must have children. */
|
|
56
|
+
icon?: IconType;
|
|
57
|
+
}
|
|
58
|
+
export interface MenuWithIcon extends MenuItemBaseProps {
|
|
59
|
+
/** Either prop `icon` must be defined or this node must have children. */
|
|
60
|
+
icon: IconType;
|
|
61
|
+
children?: React.ReactNode;
|
|
62
|
+
}
|
|
63
|
+
export declare const MenuItem: {
|
|
64
|
+
({ submenu, children, href, onClick, target, submenuDirection, icon, selected, onKeyDown, variant, showDropdownArrow, ariaLabel, clickToOpen, maxWidth, onSubmenuOpen, onSubmenuClose, overrideColor, rel, as, ...rest }: MenuWithChildren | MenuWithIcon): JSX.Element;
|
|
65
|
+
displayName: string;
|
|
66
|
+
};
|
|
67
|
+
export default MenuItem;
|