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.
Files changed (38) hide show
  1. package/esm/components/i18n-provider/i18n-provider.component.js +5 -0
  2. package/esm/components/vertical-menu/index.d.ts +8 -0
  3. package/esm/components/vertical-menu/index.js +4 -0
  4. package/esm/components/vertical-menu/vertical-menu-full-screen.component.d.ts +16 -0
  5. package/esm/components/vertical-menu/vertical-menu-full-screen.component.js +79 -0
  6. package/esm/components/vertical-menu/vertical-menu-full-screen.context.d.ts +5 -0
  7. package/esm/components/vertical-menu/vertical-menu-full-screen.context.js +5 -0
  8. package/esm/components/vertical-menu/vertical-menu-item.component.d.ts +25 -0
  9. package/esm/components/vertical-menu/vertical-menu-item.component.js +267 -0
  10. package/esm/components/vertical-menu/vertical-menu-trigger.component.d.ts +13 -0
  11. package/esm/components/vertical-menu/vertical-menu-trigger.component.js +189 -0
  12. package/esm/components/vertical-menu/vertical-menu.component.d.ts +16 -0
  13. package/esm/components/vertical-menu/vertical-menu.component.js +41 -0
  14. package/esm/components/vertical-menu/vertical-menu.style.d.ts +15 -0
  15. package/esm/components/vertical-menu/vertical-menu.style.js +127 -0
  16. package/esm/locales/en-gb.js +5 -0
  17. package/esm/locales/locale.d.ts +5 -0
  18. package/esm/locales/pl-pl.js +5 -0
  19. package/lib/components/i18n-provider/i18n-provider.component.js +5 -0
  20. package/lib/components/vertical-menu/index.d.ts +8 -0
  21. package/lib/components/vertical-menu/index.js +39 -0
  22. package/lib/components/vertical-menu/package.json +6 -0
  23. package/lib/components/vertical-menu/vertical-menu-full-screen.component.d.ts +16 -0
  24. package/lib/components/vertical-menu/vertical-menu-full-screen.component.js +104 -0
  25. package/lib/components/vertical-menu/vertical-menu-full-screen.context.d.ts +5 -0
  26. package/lib/components/vertical-menu/vertical-menu-full-screen.context.js +17 -0
  27. package/lib/components/vertical-menu/vertical-menu-item.component.d.ts +25 -0
  28. package/lib/components/vertical-menu/vertical-menu-item.component.js +287 -0
  29. package/lib/components/vertical-menu/vertical-menu-trigger.component.d.ts +13 -0
  30. package/lib/components/vertical-menu/vertical-menu-trigger.component.js +203 -0
  31. package/lib/components/vertical-menu/vertical-menu.component.d.ts +16 -0
  32. package/lib/components/vertical-menu/vertical-menu.component.js +54 -0
  33. package/lib/components/vertical-menu/vertical-menu.style.d.ts +15 -0
  34. package/lib/components/vertical-menu/vertical-menu.style.js +153 -0
  35. package/lib/locales/en-gb.js +5 -0
  36. package/lib/locales/locale.d.ts +5 -0
  37. package/lib/locales/pl-pl.js +5 -0
  38. package/package.json +1 -1
@@ -114,6 +114,11 @@ I18nProvider.propTypes = {
114
114
  "ariaLabels": PropTypes.shape({
115
115
  "close": PropTypes.func.isRequired
116
116
  }).isRequired
117
+ }),
118
+ "verticalMenuFullScreen": PropTypes.shape({
119
+ "ariaLabels": PropTypes.shape({
120
+ "close": PropTypes.func.isRequired
121
+ }).isRequired
117
122
  })
118
123
  })
119
124
  };
@@ -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,4 @@
1
+ export { default as VerticalMenu } from "./vertical-menu.component";
2
+ export { default as VerticalMenuItem } from "./vertical-menu-item.component";
3
+ export { default as VerticalMenuFullScreen } from "./vertical-menu-full-screen.component";
4
+ export { default as VerticalMenuTrigger } from "./vertical-menu-trigger.component";
@@ -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,79 @@
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, { useCallback, useRef } from "react";
4
+ import PropTypes from "prop-types";
5
+ import tagComponent from "../../__internal__/utils/helpers/tags";
6
+ import useLocale from "../../hooks/__internal__/useLocale";
7
+ import Portal from "../portal";
8
+ import FocusTrap from "../../__internal__/focus-trap/focus-trap.component";
9
+ import IconButton from "../icon-button";
10
+ import Icon from "../icon";
11
+ import Box from "../box";
12
+ import { StyledList, StyledVerticalMenuFullScreen } from "./vertical-menu.style";
13
+ import VerticalMenuFullScreenContext from "./vertical-menu-full-screen.context";
14
+ import Events from "../../__internal__/utils/helpers/events/events";
15
+
16
+ const VerticalMenuFullScreen = ({
17
+ "aria-label": ariaLabel,
18
+ "aria-labelledby": ariaLabelledBy,
19
+ children,
20
+ isOpen,
21
+ onClose,
22
+ ...rest
23
+ }) => {
24
+ const l = useLocale();
25
+ const menuWrapperRef = useRef(null);
26
+ const handleKeyDown = useCallback(ev => {
27
+ // istanbul ignore else
28
+ if (Events.isEscKey(ev)) {
29
+ onClose(ev);
30
+ }
31
+ }, [onClose]); // TODO remove this as part of FE-5650
32
+
33
+ if (!isOpen) return null;
34
+ return /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(FocusTrap, {
35
+ isOpen: isOpen,
36
+ wrapperRef: menuWrapperRef
37
+ }, /*#__PURE__*/React.createElement(StyledVerticalMenuFullScreen, _extends({
38
+ ref: menuWrapperRef,
39
+ scrollVariant: "light",
40
+ as: "nav",
41
+ "aria-label": ariaLabel,
42
+ "aria-labelledby": ariaLabelledBy,
43
+ onKeyDown: handleKeyDown
44
+ }, tagComponent("vertical-menu-full-screen", rest)), /*#__PURE__*/React.createElement(Box, {
45
+ display: "flex",
46
+ justifyContent: "flex-end",
47
+ height: "60px",
48
+ alignItems: "flex-start",
49
+ px: "20px",
50
+ pt: "20px",
51
+ boxSizing: "border-box"
52
+ }, /*#__PURE__*/React.createElement(IconButton, {
53
+ "aria-label": l.verticalMenuFullScreen.ariaLabels.close(),
54
+ onAction: onClose,
55
+ "data-element": "close"
56
+ }, /*#__PURE__*/React.createElement(Icon, {
57
+ type: "close",
58
+ color: "var(--colorsComponentsLeftnavWinterStandardContent)",
59
+ bgSize: "small",
60
+ fontSize: "medium"
61
+ }))), /*#__PURE__*/React.createElement(VerticalMenuFullScreenContext.Provider, {
62
+ value: {
63
+ isFullScreen: true
64
+ }
65
+ }, /*#__PURE__*/React.createElement(StyledList, null, children)))));
66
+ };
67
+
68
+ VerticalMenuFullScreen.propTypes = {
69
+ "aria-label": PropTypes.string,
70
+ "aria-labelledby": PropTypes.string,
71
+ "children": PropTypes.node,
72
+ "data-component": PropTypes.string,
73
+ "data-element": PropTypes.string,
74
+ "data-role": PropTypes.string,
75
+ "isOpen": PropTypes.bool.isRequired,
76
+ "onClose": PropTypes.func.isRequired
77
+ };
78
+ export { VerticalMenuFullScreen };
79
+ export default VerticalMenuFullScreen;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ declare const VerticalMenuFullScreenContext: React.Context<{
3
+ isFullScreen: boolean;
4
+ }>;
5
+ export default VerticalMenuFullScreenContext;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ const VerticalMenuFullScreenContext = /*#__PURE__*/React.createContext({
3
+ isFullScreen: false
4
+ });
5
+ export default VerticalMenuFullScreenContext;
@@ -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;
@@ -0,0 +1,267 @@
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, { useState, useContext } from "react";
4
+ import PropTypes from "prop-types";
5
+ import tagComponent from "../../__internal__/utils/helpers/tags";
6
+ import { filterStyledSystemPaddingProps } from "../../style/utils";
7
+ import VerticalMenuFullScreenContext from "./vertical-menu-full-screen.context";
8
+ import { StyledVerticalMenuItem, StyledTitle, StyledAdornment, StyledList, StyledChevronIcon, StyledTitleIcon } from "./vertical-menu.style";
9
+ const MenuItemContext = /*#__PURE__*/React.createContext({
10
+ level: 0
11
+ });
12
+
13
+ const VerticalMenuItem = ({
14
+ title,
15
+ iconType,
16
+ adornment,
17
+ children,
18
+ component,
19
+ active,
20
+ height = "56px",
21
+ href,
22
+ ...rest
23
+ }) => {
24
+ const [isOpen, setIsOpen] = useState(false);
25
+
26
+ const handleOnClick = () => {
27
+ setIsOpen(state => !state);
28
+ };
29
+
30
+ const {
31
+ level
32
+ } = useContext(MenuItemContext);
33
+ const {
34
+ isFullScreen
35
+ } = useContext(VerticalMenuFullScreenContext);
36
+
37
+ const renderAdornment = () => typeof adornment === "function" ? adornment(isOpen) : adornment;
38
+
39
+ const shouldDisplayActiveState = typeof active === "function" ? active(isOpen) : active;
40
+ let itemProps = {};
41
+
42
+ if (href) {
43
+ itemProps = {
44
+ as: "a",
45
+ href
46
+ };
47
+ }
48
+
49
+ if (component) {
50
+ itemProps = {
51
+ as: component,
52
+ href,
53
+ tabIndex: 0,
54
+ ...rest
55
+ };
56
+ }
57
+
58
+ if (children) {
59
+ itemProps = {
60
+ as: "button",
61
+ type: "button",
62
+ "aria-expanded": isOpen,
63
+ onClick: handleOnClick
64
+ };
65
+ }
66
+
67
+ const paddingX = `calc(var(--spacing500) + (${level} * var(--spacing400)))`;
68
+ return /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(StyledVerticalMenuItem, _extends({
69
+ height: height,
70
+ px: paddingX,
71
+ py: 2,
72
+ active: shouldDisplayActiveState
73
+ }, itemProps, filterStyledSystemPaddingProps(rest), tagComponent("vertical-menu-item", rest)), iconType && /*#__PURE__*/React.createElement(StyledTitleIcon, {
74
+ type: iconType
75
+ }), /*#__PURE__*/React.createElement(StyledTitle, null, title), adornment && /*#__PURE__*/React.createElement(StyledAdornment, null, renderAdornment()), children && !isFullScreen && /*#__PURE__*/React.createElement(StyledChevronIcon, {
76
+ type: isOpen ? "chevron_up_thick" : "chevron_down_thick"
77
+ })), (isOpen || isFullScreen) && /*#__PURE__*/React.createElement(MenuItemContext.Provider, {
78
+ value: {
79
+ level: level + 1
80
+ }
81
+ }, /*#__PURE__*/React.createElement(StyledList, null, children)));
82
+ };
83
+
84
+ VerticalMenuItem.propTypes = {
85
+ "active": PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
86
+ "adornment": PropTypes.oneOfType([PropTypes.element, PropTypes.func, PropTypes.number, PropTypes.object, PropTypes.shape({
87
+ "__@iterator": PropTypes.func.isRequired
88
+ }), PropTypes.string, PropTypes.bool]),
89
+ "children": PropTypes.node,
90
+ "component": PropTypes.oneOfType([PropTypes.oneOf(["a", "abbr", "address", "animate", "animateMotion", "animateTransform", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "circle", "cite", "clipPath", "code", "col", "colgroup", "data", "datalist", "dd", "defs", "del", "desc", "details", "dfn", "dialog", "div", "dl", "dt", "ellipse", "em", "embed", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "fieldset", "figcaption", "figure", "filter", "footer", "foreignObject", "form", "g", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "line", "linearGradient", "link", "main", "map", "mark", "marker", "mask", "menu", "menuitem", "meta", "metadata", "meter", "mpath", "nav", "noindex", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "path", "pattern", "picture", "polygon", "polyline", "pre", "progress", "q", "radialGradient", "rect", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "slot", "small", "source", "span", "stop", "strong", "style", "sub", "summary", "sup", "svg", "switch", "symbol", "table", "tbody", "td", "template", "text", "textarea", "textPath", "tfoot", "th", "thead", "time", "title", "tr", "track", "tspan", "u", "ul", "use", "var", "video", "view", "wbr", "webview"]), PropTypes.func, PropTypes.shape({
91
+ "childContextTypes": PropTypes.object,
92
+ "contextType": PropTypes.shape({
93
+ "Consumer": PropTypes.func.isRequired,
94
+ "displayName": PropTypes.string,
95
+ "Provider": PropTypes.func.isRequired
96
+ }),
97
+ "contextTypes": PropTypes.object,
98
+ "defaultProps": PropTypes.object,
99
+ "displayName": PropTypes.string,
100
+ "getDerivedStateFromError": PropTypes.func,
101
+ "getDerivedStateFromProps": PropTypes.func,
102
+ "propTypes": PropTypes.object
103
+ })]),
104
+ "data-component": PropTypes.string,
105
+ "data-element": PropTypes.string,
106
+ "data-role": PropTypes.string,
107
+ "height": PropTypes.string,
108
+ "href": PropTypes.string,
109
+ "iconType": PropTypes.oneOf(["add", "admin", "alert_on", "alert", "analysis", "arrow_bottom_right_circle", "arrow_down", "arrow_left_boxed", "arrow_left_right_small", "arrow_left_small", "arrow_left", "arrow_right_small", "arrow_right", "arrow_top_left_circle", "arrow_up", "arrow", "arrows_left_right", "attach", "bank_with_card", "bank", "basket_with_squares", "basket", "bed", "bin", "block_arrow_right", "blocked_square", "blocked", "bold", "box_arrow_left", "boxed_shapes", "bulk_destroy", "bullet_list_dotted", "bullet_list_numbers", "bullet_list", "business", "calendar_today", "calendar", "call", "camera", "car_lock", "car_money", "car_repair", "card_view", "caret_down", "caret_large_down", "caret_large_left", "caret_large_right", "caret_large_up", "caret_left", "caret_right", "caret_up", "cart", "cash", "chart_bar", "chart_line", "chart_pie", "chat_notes", "chat", "chevron_down_thick", "chevron_down", "chevron_left_thick", "chevron_left", "chevron_right_thick", "chevron_right", "chevron_up_thick", "chevron_up", "circle_with_dots", "circles_connection", "clock", "close", "coins", "collaborate", "computer_clock", "connect", "construction", "contacts", "copy", "create", "credit_card_slash", "credit_card", "cross_circle", "cross", "csv", "dashboard", "delete", "delivery", "disconnect", "disputed", "document_right_align", "document_tick", "document_vertical_lines", "download", "draft", "drag_vertical", "drag", "drill", "dropdown", "duplicate", "edit", "edited", "ellipsis_horizontal", "ellipsis_vertical", "email_switch", "email", "entry", "envelope_dollar", "envelope_euro", "error_square", "error", "euro", "expand", "factory", "favourite_lined", "favourite", "fax", "feedback", "file_excel", "file_generic", "file_image", "file_pdf", "file_word", "files_leaning", "filter_new", "filter", "fit_height", "fit_width", "flag", "folder", "form_refresh", "gift", "go", "graduation_hat", "graph", "grid", "hand_cash_coins", "hand_cash_note", "help", "hide", "home", "image", "in_progress", "in_transit", "individual", "info", "italic", "key", "laptop", "ledger_arrow_left", "ledger_arrow_right", "ledger", "lightbulb_off", "lightbulb_on", "link", "list_view", "location", "locked", "logout", "lookup", "marker", "message", "minus_large", "minus", "mobile", "money_bag", "none", "old_warning", "palm_tree", "pause_circle", "pause", "pdf", "people_switch", "people", "percentage_boxed", "person_info", "person_tick", "person", "petrol_pump", "phone", "piggy_bank", "plane", "play_circle", "play", "plus_large", "plus", "pound", "print", "progress", "progressed", "question_hollow", "question_mark", "question", "refresh_clock", "refresh", "remove", "sage_coin", "save", "scan", "search", "services", "settings_old", "settings", "share", "shop", "sort_down", "sort_up", "spanner", "split_container", "split", "square_dot", "squares_nine", "stacked_boxes", "stacked_squares", "submitted", "sync", "tag", "talk", "theatre_masks", "three_boxes", "tick_circle", "tick_thick", "tick", "true_tick", "u_turn_left", "u_turn_right", "undo", "unlocked", "upload", "uploaded", "video", "view", "warning"]),
110
+ "p": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
111
+ "__@toStringTag": PropTypes.string.isRequired,
112
+ "description": PropTypes.string,
113
+ "toString": PropTypes.func.isRequired,
114
+ "valueOf": PropTypes.func.isRequired
115
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
116
+ "__@toStringTag": PropTypes.string.isRequired,
117
+ "description": PropTypes.string,
118
+ "toString": PropTypes.func.isRequired,
119
+ "valueOf": PropTypes.func.isRequired
120
+ }), PropTypes.string]),
121
+ "padding": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
122
+ "__@toStringTag": PropTypes.string.isRequired,
123
+ "description": PropTypes.string,
124
+ "toString": PropTypes.func.isRequired,
125
+ "valueOf": PropTypes.func.isRequired
126
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
127
+ "__@toStringTag": PropTypes.string.isRequired,
128
+ "description": PropTypes.string,
129
+ "toString": PropTypes.func.isRequired,
130
+ "valueOf": PropTypes.func.isRequired
131
+ }), PropTypes.string]),
132
+ "paddingBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
133
+ "__@toStringTag": PropTypes.string.isRequired,
134
+ "description": PropTypes.string,
135
+ "toString": PropTypes.func.isRequired,
136
+ "valueOf": PropTypes.func.isRequired
137
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
138
+ "__@toStringTag": PropTypes.string.isRequired,
139
+ "description": PropTypes.string,
140
+ "toString": PropTypes.func.isRequired,
141
+ "valueOf": PropTypes.func.isRequired
142
+ }), PropTypes.string]),
143
+ "paddingLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
144
+ "__@toStringTag": PropTypes.string.isRequired,
145
+ "description": PropTypes.string,
146
+ "toString": PropTypes.func.isRequired,
147
+ "valueOf": PropTypes.func.isRequired
148
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
149
+ "__@toStringTag": PropTypes.string.isRequired,
150
+ "description": PropTypes.string,
151
+ "toString": PropTypes.func.isRequired,
152
+ "valueOf": PropTypes.func.isRequired
153
+ }), PropTypes.string]),
154
+ "paddingRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
155
+ "__@toStringTag": PropTypes.string.isRequired,
156
+ "description": PropTypes.string,
157
+ "toString": PropTypes.func.isRequired,
158
+ "valueOf": PropTypes.func.isRequired
159
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
160
+ "__@toStringTag": PropTypes.string.isRequired,
161
+ "description": PropTypes.string,
162
+ "toString": PropTypes.func.isRequired,
163
+ "valueOf": PropTypes.func.isRequired
164
+ }), PropTypes.string]),
165
+ "paddingTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
166
+ "__@toStringTag": PropTypes.string.isRequired,
167
+ "description": PropTypes.string,
168
+ "toString": PropTypes.func.isRequired,
169
+ "valueOf": PropTypes.func.isRequired
170
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
171
+ "__@toStringTag": PropTypes.string.isRequired,
172
+ "description": PropTypes.string,
173
+ "toString": PropTypes.func.isRequired,
174
+ "valueOf": PropTypes.func.isRequired
175
+ }), PropTypes.string]),
176
+ "paddingX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
177
+ "__@toStringTag": PropTypes.string.isRequired,
178
+ "description": PropTypes.string,
179
+ "toString": PropTypes.func.isRequired,
180
+ "valueOf": PropTypes.func.isRequired
181
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
182
+ "__@toStringTag": PropTypes.string.isRequired,
183
+ "description": PropTypes.string,
184
+ "toString": PropTypes.func.isRequired,
185
+ "valueOf": PropTypes.func.isRequired
186
+ }), PropTypes.string]),
187
+ "paddingY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
188
+ "__@toStringTag": PropTypes.string.isRequired,
189
+ "description": PropTypes.string,
190
+ "toString": PropTypes.func.isRequired,
191
+ "valueOf": PropTypes.func.isRequired
192
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
193
+ "__@toStringTag": PropTypes.string.isRequired,
194
+ "description": PropTypes.string,
195
+ "toString": PropTypes.func.isRequired,
196
+ "valueOf": PropTypes.func.isRequired
197
+ }), PropTypes.string]),
198
+ "pb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
199
+ "__@toStringTag": PropTypes.string.isRequired,
200
+ "description": PropTypes.string,
201
+ "toString": PropTypes.func.isRequired,
202
+ "valueOf": PropTypes.func.isRequired
203
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
204
+ "__@toStringTag": PropTypes.string.isRequired,
205
+ "description": PropTypes.string,
206
+ "toString": PropTypes.func.isRequired,
207
+ "valueOf": PropTypes.func.isRequired
208
+ }), PropTypes.string]),
209
+ "pl": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
210
+ "__@toStringTag": PropTypes.string.isRequired,
211
+ "description": PropTypes.string,
212
+ "toString": PropTypes.func.isRequired,
213
+ "valueOf": PropTypes.func.isRequired
214
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
215
+ "__@toStringTag": PropTypes.string.isRequired,
216
+ "description": PropTypes.string,
217
+ "toString": PropTypes.func.isRequired,
218
+ "valueOf": PropTypes.func.isRequired
219
+ }), PropTypes.string]),
220
+ "pr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
221
+ "__@toStringTag": PropTypes.string.isRequired,
222
+ "description": PropTypes.string,
223
+ "toString": PropTypes.func.isRequired,
224
+ "valueOf": PropTypes.func.isRequired
225
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
226
+ "__@toStringTag": PropTypes.string.isRequired,
227
+ "description": PropTypes.string,
228
+ "toString": PropTypes.func.isRequired,
229
+ "valueOf": PropTypes.func.isRequired
230
+ }), PropTypes.string]),
231
+ "pt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
232
+ "__@toStringTag": PropTypes.string.isRequired,
233
+ "description": PropTypes.string,
234
+ "toString": PropTypes.func.isRequired,
235
+ "valueOf": PropTypes.func.isRequired
236
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
237
+ "__@toStringTag": PropTypes.string.isRequired,
238
+ "description": PropTypes.string,
239
+ "toString": PropTypes.func.isRequired,
240
+ "valueOf": PropTypes.func.isRequired
241
+ }), PropTypes.string]),
242
+ "px": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
243
+ "__@toStringTag": PropTypes.string.isRequired,
244
+ "description": PropTypes.string,
245
+ "toString": PropTypes.func.isRequired,
246
+ "valueOf": PropTypes.func.isRequired
247
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
248
+ "__@toStringTag": PropTypes.string.isRequired,
249
+ "description": PropTypes.string,
250
+ "toString": PropTypes.func.isRequired,
251
+ "valueOf": PropTypes.func.isRequired
252
+ }), PropTypes.string]),
253
+ "py": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
254
+ "__@toStringTag": PropTypes.string.isRequired,
255
+ "description": PropTypes.string,
256
+ "toString": PropTypes.func.isRequired,
257
+ "valueOf": PropTypes.func.isRequired
258
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
259
+ "__@toStringTag": PropTypes.string.isRequired,
260
+ "description": PropTypes.string,
261
+ "toString": PropTypes.func.isRequired,
262
+ "valueOf": PropTypes.func.isRequired
263
+ }), PropTypes.string]),
264
+ "title": PropTypes.string.isRequired
265
+ };
266
+ export { VerticalMenuItem };
267
+ export default VerticalMenuItem;
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import { PaddingProps } from "styled-system";
3
+ import { TagProps } from "../../__internal__/utils/helpers/tags";
4
+ export interface VerticalMenuTriggerProps extends PaddingProps, TagProps {
5
+ /** Height of the menu trigger */
6
+ height?: string;
7
+ /** Title of the menu trigger */
8
+ children: string;
9
+ /** Callback passed to the menu trigger */
10
+ onClick: (ev: React.MouseEvent<HTMLButtonElement>) => void;
11
+ }
12
+ export declare const VerticalMenuTrigger: ({ height, p, onClick, children, ...rest }: VerticalMenuTriggerProps) => JSX.Element;
13
+ export default VerticalMenuTrigger;
@@ -0,0 +1,189 @@
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 { filterStyledSystemPaddingProps } from "../../style/utils";
7
+ import { StyledVerticalMenuItem, StyledTitle } from "./vertical-menu.style";
8
+
9
+ const VerticalMenuTrigger = ({
10
+ height = "40px",
11
+ p = 2,
12
+ onClick,
13
+ children,
14
+ ...rest
15
+ }) => {
16
+ const paddingProps = filterStyledSystemPaddingProps(rest);
17
+ return /*#__PURE__*/React.createElement(StyledVerticalMenuItem, _extends({
18
+ onClick: onClick,
19
+ as: "button",
20
+ height: height,
21
+ p: p,
22
+ tabIndex: 0
23
+ }, paddingProps, tagComponent("vertical-menu-trigger", rest)), /*#__PURE__*/React.createElement(StyledTitle, null, children));
24
+ };
25
+
26
+ VerticalMenuTrigger.propTypes = {
27
+ "children": PropTypes.string.isRequired,
28
+ "data-component": PropTypes.string,
29
+ "data-element": PropTypes.string,
30
+ "data-role": PropTypes.string,
31
+ "height": PropTypes.string,
32
+ "onClick": PropTypes.func.isRequired,
33
+ "p": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
34
+ "__@toStringTag": PropTypes.string.isRequired,
35
+ "description": PropTypes.string,
36
+ "toString": PropTypes.func.isRequired,
37
+ "valueOf": PropTypes.func.isRequired
38
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
39
+ "__@toStringTag": PropTypes.string.isRequired,
40
+ "description": PropTypes.string,
41
+ "toString": PropTypes.func.isRequired,
42
+ "valueOf": PropTypes.func.isRequired
43
+ }), PropTypes.string]),
44
+ "padding": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
45
+ "__@toStringTag": PropTypes.string.isRequired,
46
+ "description": PropTypes.string,
47
+ "toString": PropTypes.func.isRequired,
48
+ "valueOf": PropTypes.func.isRequired
49
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
50
+ "__@toStringTag": PropTypes.string.isRequired,
51
+ "description": PropTypes.string,
52
+ "toString": PropTypes.func.isRequired,
53
+ "valueOf": PropTypes.func.isRequired
54
+ }), PropTypes.string]),
55
+ "paddingBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
56
+ "__@toStringTag": PropTypes.string.isRequired,
57
+ "description": PropTypes.string,
58
+ "toString": PropTypes.func.isRequired,
59
+ "valueOf": PropTypes.func.isRequired
60
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
61
+ "__@toStringTag": PropTypes.string.isRequired,
62
+ "description": PropTypes.string,
63
+ "toString": PropTypes.func.isRequired,
64
+ "valueOf": PropTypes.func.isRequired
65
+ }), PropTypes.string]),
66
+ "paddingLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
67
+ "__@toStringTag": PropTypes.string.isRequired,
68
+ "description": PropTypes.string,
69
+ "toString": PropTypes.func.isRequired,
70
+ "valueOf": PropTypes.func.isRequired
71
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
72
+ "__@toStringTag": PropTypes.string.isRequired,
73
+ "description": PropTypes.string,
74
+ "toString": PropTypes.func.isRequired,
75
+ "valueOf": PropTypes.func.isRequired
76
+ }), PropTypes.string]),
77
+ "paddingRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
78
+ "__@toStringTag": PropTypes.string.isRequired,
79
+ "description": PropTypes.string,
80
+ "toString": PropTypes.func.isRequired,
81
+ "valueOf": PropTypes.func.isRequired
82
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
83
+ "__@toStringTag": PropTypes.string.isRequired,
84
+ "description": PropTypes.string,
85
+ "toString": PropTypes.func.isRequired,
86
+ "valueOf": PropTypes.func.isRequired
87
+ }), PropTypes.string]),
88
+ "paddingTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
89
+ "__@toStringTag": PropTypes.string.isRequired,
90
+ "description": PropTypes.string,
91
+ "toString": PropTypes.func.isRequired,
92
+ "valueOf": PropTypes.func.isRequired
93
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
94
+ "__@toStringTag": PropTypes.string.isRequired,
95
+ "description": PropTypes.string,
96
+ "toString": PropTypes.func.isRequired,
97
+ "valueOf": PropTypes.func.isRequired
98
+ }), PropTypes.string]),
99
+ "paddingX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
100
+ "__@toStringTag": PropTypes.string.isRequired,
101
+ "description": PropTypes.string,
102
+ "toString": PropTypes.func.isRequired,
103
+ "valueOf": PropTypes.func.isRequired
104
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
105
+ "__@toStringTag": PropTypes.string.isRequired,
106
+ "description": PropTypes.string,
107
+ "toString": PropTypes.func.isRequired,
108
+ "valueOf": PropTypes.func.isRequired
109
+ }), PropTypes.string]),
110
+ "paddingY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
111
+ "__@toStringTag": PropTypes.string.isRequired,
112
+ "description": PropTypes.string,
113
+ "toString": PropTypes.func.isRequired,
114
+ "valueOf": PropTypes.func.isRequired
115
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
116
+ "__@toStringTag": PropTypes.string.isRequired,
117
+ "description": PropTypes.string,
118
+ "toString": PropTypes.func.isRequired,
119
+ "valueOf": PropTypes.func.isRequired
120
+ }), PropTypes.string]),
121
+ "pb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
122
+ "__@toStringTag": PropTypes.string.isRequired,
123
+ "description": PropTypes.string,
124
+ "toString": PropTypes.func.isRequired,
125
+ "valueOf": PropTypes.func.isRequired
126
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
127
+ "__@toStringTag": PropTypes.string.isRequired,
128
+ "description": PropTypes.string,
129
+ "toString": PropTypes.func.isRequired,
130
+ "valueOf": PropTypes.func.isRequired
131
+ }), PropTypes.string]),
132
+ "pl": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
133
+ "__@toStringTag": PropTypes.string.isRequired,
134
+ "description": PropTypes.string,
135
+ "toString": PropTypes.func.isRequired,
136
+ "valueOf": PropTypes.func.isRequired
137
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
138
+ "__@toStringTag": PropTypes.string.isRequired,
139
+ "description": PropTypes.string,
140
+ "toString": PropTypes.func.isRequired,
141
+ "valueOf": PropTypes.func.isRequired
142
+ }), PropTypes.string]),
143
+ "pr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
144
+ "__@toStringTag": PropTypes.string.isRequired,
145
+ "description": PropTypes.string,
146
+ "toString": PropTypes.func.isRequired,
147
+ "valueOf": PropTypes.func.isRequired
148
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
149
+ "__@toStringTag": PropTypes.string.isRequired,
150
+ "description": PropTypes.string,
151
+ "toString": PropTypes.func.isRequired,
152
+ "valueOf": PropTypes.func.isRequired
153
+ }), PropTypes.string]),
154
+ "pt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
155
+ "__@toStringTag": PropTypes.string.isRequired,
156
+ "description": PropTypes.string,
157
+ "toString": PropTypes.func.isRequired,
158
+ "valueOf": PropTypes.func.isRequired
159
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
160
+ "__@toStringTag": PropTypes.string.isRequired,
161
+ "description": PropTypes.string,
162
+ "toString": PropTypes.func.isRequired,
163
+ "valueOf": PropTypes.func.isRequired
164
+ }), PropTypes.string]),
165
+ "px": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
166
+ "__@toStringTag": PropTypes.string.isRequired,
167
+ "description": PropTypes.string,
168
+ "toString": PropTypes.func.isRequired,
169
+ "valueOf": PropTypes.func.isRequired
170
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
171
+ "__@toStringTag": PropTypes.string.isRequired,
172
+ "description": PropTypes.string,
173
+ "toString": PropTypes.func.isRequired,
174
+ "valueOf": PropTypes.func.isRequired
175
+ }), PropTypes.string]),
176
+ "py": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
177
+ "__@toStringTag": PropTypes.string.isRequired,
178
+ "description": PropTypes.string,
179
+ "toString": PropTypes.func.isRequired,
180
+ "valueOf": PropTypes.func.isRequired
181
+ }), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
182
+ "__@toStringTag": PropTypes.string.isRequired,
183
+ "description": PropTypes.string,
184
+ "toString": PropTypes.func.isRequired,
185
+ "valueOf": PropTypes.func.isRequired
186
+ }), PropTypes.string])
187
+ };
188
+ export { VerticalMenuTrigger };
189
+ export default VerticalMenuTrigger;