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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PaddingProps } from "styled-system";
|
|
3
|
+
import { MenuType } from "../menu.context";
|
|
4
|
+
import { MenuWithChildren } from "./menu-item.component";
|
|
5
|
+
interface StyledMenuItemWrapperProps extends Pick<MenuWithChildren, "href" | "variant" | "showDropdownArrow" | "overrideColor" | "clickToOpen" | "maxWidth">, PaddingProps {
|
|
6
|
+
menuType: MenuType;
|
|
7
|
+
selected?: boolean;
|
|
8
|
+
hasSubmenu?: boolean;
|
|
9
|
+
isOpen?: boolean;
|
|
10
|
+
inFullscreenView?: boolean;
|
|
11
|
+
asPassiveItem?: boolean;
|
|
12
|
+
placeholderTabIndex?: boolean;
|
|
13
|
+
icon?: string;
|
|
14
|
+
ariaLabel?: string;
|
|
15
|
+
asDiv?: boolean;
|
|
16
|
+
hasInput?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare const StyledMenuItemWrapper: import("styled-components").StyledComponent<"a", any, {
|
|
19
|
+
as: import("react").ForwardRefExoticComponent<import("../../link").LinkProps & import("react").RefAttributes<HTMLButtonElement | HTMLLinkElement>>;
|
|
20
|
+
} & StyledMenuItemWrapperProps, "as">;
|
|
21
|
+
export default StyledMenuItemWrapper;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
|
+
import { padding } from "styled-system";
|
|
2
3
|
import { StyledLink } from "../../link/link.style";
|
|
3
4
|
import StyledIcon from "../../icon/icon.style";
|
|
4
5
|
import StyledIconButton from "../../icon-button/icon-button.style";
|
|
5
6
|
import menuConfigVariants from "../menu.config";
|
|
6
|
-
|
|
7
|
+
import Link from "../../link";
|
|
8
|
+
import { baseTheme } from "../../../style/themes";
|
|
9
|
+
const StyledMenuItemWrapper = styled.a.attrs({
|
|
10
|
+
as: Link
|
|
11
|
+
})`
|
|
7
12
|
${({
|
|
8
13
|
menuType,
|
|
9
14
|
selected,
|
|
@@ -11,68 +16,81 @@ const StyledMenuItemWrapper = styled.a`
|
|
|
11
16
|
isOpen,
|
|
12
17
|
variant,
|
|
13
18
|
showDropdownArrow,
|
|
14
|
-
isSearch,
|
|
15
19
|
href,
|
|
16
20
|
clickToOpen,
|
|
17
21
|
maxWidth,
|
|
18
22
|
inFullscreenView,
|
|
19
23
|
overrideColor,
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
asPassiveItem,
|
|
25
|
+
asDiv,
|
|
26
|
+
hasInput
|
|
22
27
|
}) => css`
|
|
28
|
+
${padding}
|
|
29
|
+
|
|
23
30
|
display: inline-block;
|
|
24
31
|
font-size: 14px;
|
|
25
32
|
font-weight: 700;
|
|
26
33
|
height: 40px;
|
|
27
34
|
position: relative;
|
|
28
|
-
|
|
35
|
+
a,
|
|
36
|
+
button {
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
}
|
|
29
39
|
${!overrideColor && css`
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
background-color: ${menuConfigVariants[menuType].background};
|
|
41
|
+
`}
|
|
42
|
+
|
|
33
43
|
${overrideColor && css`
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
44
|
+
&&&& {
|
|
45
|
+
background-color: ${variant === "alternate" ? menuConfigVariants[menuType].alternate : menuConfigVariants[menuType].submenuItemBackground};
|
|
46
|
+
}
|
|
47
|
+
`}
|
|
38
48
|
|
|
39
49
|
${!inFullscreenView && css`
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
&& {
|
|
43
|
-
a,
|
|
44
|
-
button {
|
|
45
|
-
${maxWidth && css`
|
|
46
|
-
box-sizing: border-box;
|
|
47
|
-
max-width: inherit;
|
|
48
|
-
text-overflow: ellipsis;
|
|
49
|
-
overflow: hidden;
|
|
50
|
-
white-space: nowrap;
|
|
51
|
-
vertical-align: bottom;
|
|
52
|
-
`}
|
|
53
|
-
}
|
|
50
|
+
max-width: inherit;
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
&& {
|
|
53
|
+
a:focus,
|
|
54
|
+
button:focus {
|
|
55
|
+
box-shadow: inset 0 0 0 var(--borderWidth300)
|
|
56
|
+
var(--colorsSemanticFocus500);
|
|
57
|
+
background-color: ${menuConfigVariants[menuType].background};
|
|
58
|
+
color: ${menuConfigVariants[menuType].color};
|
|
59
|
+
z-index: 1;
|
|
60
|
+
position: relative;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&&& {
|
|
65
|
+
a,
|
|
66
|
+
button {
|
|
67
|
+
${maxWidth && css`
|
|
68
|
+
box-sizing: border-box;
|
|
69
|
+
max-width: inherit;
|
|
70
|
+
text-overflow: ellipsis;
|
|
71
|
+
overflow: hidden;
|
|
72
|
+
white-space: nowrap;
|
|
73
|
+
vertical-align: bottom;
|
|
74
|
+
`}
|
|
75
|
+
}
|
|
64
76
|
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
a:hover,
|
|
78
|
+
button:hover {
|
|
79
|
+
${!asDiv && css`
|
|
67
80
|
background-color: var(--colorsComponentsMenuAutumnStandard600);
|
|
68
81
|
color: var(--colorsComponentsMenuYang100);
|
|
69
82
|
|
|
70
83
|
[data-component="icon"] {
|
|
71
84
|
color: var(--colorsComponentsMenuYang100);
|
|
72
85
|
}
|
|
86
|
+
`}
|
|
87
|
+
|
|
88
|
+
::before {
|
|
89
|
+
border-top-color: var(--colorsComponentsMenuYang100);
|
|
73
90
|
}
|
|
74
91
|
}
|
|
75
|
-
|
|
92
|
+
}
|
|
93
|
+
`}
|
|
76
94
|
|
|
77
95
|
${asPassiveItem ? `
|
|
78
96
|
${StyledIconButton} {
|
|
@@ -105,7 +123,7 @@ const StyledMenuItemWrapper = styled.a`
|
|
|
105
123
|
text-align: left;
|
|
106
124
|
}
|
|
107
125
|
|
|
108
|
-
|
|
126
|
+
&&& {
|
|
109
127
|
a,
|
|
110
128
|
button,
|
|
111
129
|
[data-component="icon"],
|
|
@@ -114,7 +132,7 @@ const StyledMenuItemWrapper = styled.a`
|
|
|
114
132
|
${StyledLink} [data-component="icon"] {
|
|
115
133
|
font-weight: 700;
|
|
116
134
|
text-decoration: none;
|
|
117
|
-
color: ${menuConfigVariants[menuType].color}
|
|
135
|
+
${!hasInput && `color: ${menuConfigVariants[menuType].color};`}
|
|
118
136
|
}
|
|
119
137
|
|
|
120
138
|
${StyledIcon} {
|
|
@@ -123,123 +141,141 @@ const StyledMenuItemWrapper = styled.a`
|
|
|
123
141
|
}
|
|
124
142
|
|
|
125
143
|
${selected && css`
|
|
126
|
-
|
|
144
|
+
background-color: ${menuConfigVariants[menuType].selected};
|
|
127
145
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
146
|
+
a:focus,
|
|
147
|
+
button:focus {
|
|
148
|
+
background-color: ${menuConfigVariants[menuType].selected};
|
|
149
|
+
}
|
|
132
150
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
151
|
+
a:hover,
|
|
152
|
+
button:hover {
|
|
153
|
+
background-color: var(--colorsComponentsMenuAutumnStandard600);
|
|
154
|
+
}
|
|
155
|
+
`}
|
|
138
156
|
|
|
139
157
|
${variant === "alternate" && !inFullscreenView && css`
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
158
|
+
&&& {
|
|
159
|
+
background-color: ${menuConfigVariants[menuType].alternate};
|
|
160
|
+
}
|
|
143
161
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
162
|
+
&&& a:focus,
|
|
163
|
+
&&& button:focus {
|
|
164
|
+
background-color: ${menuConfigVariants[menuType].alternate};
|
|
165
|
+
}
|
|
148
166
|
|
|
167
|
+
${!hasInput && css`
|
|
149
168
|
&&& a:hover,
|
|
150
169
|
&&& button:hover {
|
|
151
170
|
background-color: ${menuConfigVariants[menuType].alternateHover};
|
|
152
171
|
}
|
|
153
172
|
`}
|
|
173
|
+
`}
|
|
154
174
|
|
|
155
175
|
${isOpen && css`
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
176
|
+
a,
|
|
177
|
+
button {
|
|
178
|
+
background-color: ${menuConfigVariants[menuType].submenuItemBackground};
|
|
179
|
+
color: ${menuConfigVariants[menuType].color};
|
|
180
|
+
}
|
|
181
|
+
`}
|
|
182
|
+
|
|
163
183
|
${hasSubmenu && css`
|
|
184
|
+
background-color: ${menuConfigVariants[menuType].submenuBackground};
|
|
185
|
+
|
|
186
|
+
a:focus,
|
|
187
|
+
button:focus {
|
|
164
188
|
background-color: ${menuConfigVariants[menuType].submenuBackground};
|
|
189
|
+
color: ${menuConfigVariants[menuType].color};
|
|
165
190
|
|
|
166
|
-
|
|
167
|
-
button:focus {
|
|
168
|
-
background-color: ${menuConfigVariants[menuType].submenuBackground};
|
|
191
|
+
[data-component="icon"] {
|
|
169
192
|
color: ${menuConfigVariants[menuType].color};
|
|
170
|
-
|
|
171
|
-
[data-component="icon"] {
|
|
172
|
-
color: ${menuConfigVariants[menuType].color};
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
${clickToOpen && isOpen && css`
|
|
176
|
-
background-color: ${menuConfigVariants[menuType].submenuOpenedBackground};
|
|
177
|
-
`}
|
|
178
193
|
}
|
|
179
194
|
|
|
180
|
-
|
|
181
|
-
button:hover {
|
|
195
|
+
${clickToOpen && isOpen && css`
|
|
182
196
|
background-color: ${menuConfigVariants[menuType].submenuOpenedBackground};
|
|
183
|
-
|
|
197
|
+
`}
|
|
198
|
+
}
|
|
184
199
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
`}
|
|
200
|
+
a:hover,
|
|
201
|
+
button:hover {
|
|
202
|
+
background-color: ${menuConfigVariants[menuType].submenuOpenedBackground};
|
|
203
|
+
color: var(--colorsComponentsMenuYang100);
|
|
190
204
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
205
|
+
${!(href || clickToOpen) && css`
|
|
206
|
+
cursor: default;
|
|
207
|
+
background-color: ${menuConfigVariants[menuType].submenuItemBackground};
|
|
208
|
+
color: ${menuConfigVariants[menuType].color};
|
|
209
|
+
`}
|
|
210
|
+
|
|
211
|
+
[data-component="icon"] {
|
|
212
|
+
color: ${menuConfigVariants[menuType].color};
|
|
194
213
|
}
|
|
214
|
+
}
|
|
195
215
|
|
|
196
|
-
|
|
216
|
+
${selected && css`
|
|
217
|
+
background-color: ${menuConfigVariants[menuType].submenuSelected};
|
|
218
|
+
|
|
219
|
+
a:focus,
|
|
220
|
+
button:focus {
|
|
197
221
|
background-color: ${menuConfigVariants[menuType].submenuSelected};
|
|
222
|
+
}
|
|
198
223
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
224
|
+
a:hover,
|
|
225
|
+
button:hover {
|
|
226
|
+
background-color: var(--colorsComponentsMenuAutumnStandard600);
|
|
227
|
+
color: var(--colorsComponentsMenuYang100);
|
|
228
|
+
}
|
|
229
|
+
`}
|
|
203
230
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
`}
|
|
231
|
+
${showDropdownArrow && css`
|
|
232
|
+
> a,
|
|
233
|
+
> button:not(${StyledIconButton}) {
|
|
234
|
+
padding-right: 32px;
|
|
235
|
+
}
|
|
210
236
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
237
|
+
a::before,
|
|
238
|
+
button::before {
|
|
239
|
+
display: block;
|
|
240
|
+
margin-top: -2px;
|
|
241
|
+
pointer-events: none;
|
|
242
|
+
position: absolute;
|
|
243
|
+
right: 16px;
|
|
244
|
+
top: 50%;
|
|
245
|
+
z-index: 2;
|
|
246
|
+
content: "";
|
|
247
|
+
width: 0;
|
|
248
|
+
height: 0;
|
|
249
|
+
border-width: 5px 4px 4px;
|
|
250
|
+
border-style: solid;
|
|
251
|
+
border-top-color: initial;
|
|
252
|
+
border-right-color: transparent;
|
|
253
|
+
border-bottom-color: transparent;
|
|
254
|
+
border-left-color: transparent;
|
|
255
|
+
}
|
|
256
|
+
`}
|
|
257
|
+
`}
|
|
258
|
+
|
|
259
|
+
${inFullscreenView && css`
|
|
260
|
+
${asDiv && css`
|
|
261
|
+
&&& {
|
|
262
|
+
> a,
|
|
263
|
+
> button {
|
|
264
|
+
color: ${menuConfigVariants[menuType].title};
|
|
265
|
+
outline: none;
|
|
266
|
+
}
|
|
216
267
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
top: 50%;
|
|
225
|
-
z-index: 2;
|
|
226
|
-
content: "";
|
|
227
|
-
width: 0;
|
|
228
|
-
height: 0;
|
|
229
|
-
border-top: 5px solid ${menuConfigVariants[menuType].text};
|
|
230
|
-
border-right: 4px solid transparent;
|
|
231
|
-
border-bottom: 4px solid transparent;
|
|
232
|
-
border-left: 4px solid transparent;
|
|
268
|
+
> button:hover,
|
|
269
|
+
> a:hover {
|
|
270
|
+
background-color: transparent;
|
|
271
|
+
cursor: default;
|
|
272
|
+
outline: none;
|
|
273
|
+
color: ${menuConfigVariants[menuType].title};
|
|
274
|
+
}
|
|
233
275
|
}
|
|
234
276
|
`}
|
|
235
|
-
`}
|
|
236
277
|
|
|
237
|
-
|
|
238
|
-
padding: 2px 16px;
|
|
239
|
-
`}
|
|
240
|
-
|
|
241
|
-
${inFullscreenView && css`
|
|
242
|
-
${as === "div" && css`
|
|
278
|
+
${asPassiveItem && css`
|
|
243
279
|
cursor: default;
|
|
244
280
|
padding: 0 16px;
|
|
245
281
|
|
|
@@ -248,34 +284,40 @@ const StyledMenuItemWrapper = styled.a`
|
|
|
248
284
|
}
|
|
249
285
|
`}
|
|
250
286
|
|
|
251
|
-
|
|
287
|
+
a,
|
|
252
288
|
${StyledLink} a,
|
|
253
289
|
button,
|
|
254
290
|
${StyledLink} button {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
291
|
+
width: 100vw;
|
|
292
|
+
box-sizing: border-box;
|
|
293
|
+
}
|
|
258
294
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
295
|
+
a:focus,
|
|
296
|
+
button:focus {
|
|
297
|
+
box-shadow: inset 0 0 0 var(--borderWidth300)
|
|
298
|
+
var(--colorsSemanticFocus500);
|
|
299
|
+
z-index: 1;
|
|
300
|
+
position: relative;
|
|
301
|
+
}
|
|
266
302
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
303
|
+
a:focus,
|
|
304
|
+
a:hover,
|
|
305
|
+
button:focus,
|
|
306
|
+
button:hover {
|
|
307
|
+
background-color: var(--colorsComponentsMenuAutumnStandard600);
|
|
308
|
+
color: var(--colorsComponentsMenuYang100);
|
|
273
309
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
310
|
+
${!hasInput && `
|
|
311
|
+
[data-component="icon"] {
|
|
312
|
+
color: var(--colorsComponentsMenuYang100);
|
|
313
|
+
}
|
|
314
|
+
`}
|
|
277
315
|
}
|
|
278
|
-
|
|
316
|
+
}
|
|
317
|
+
`}
|
|
279
318
|
`}
|
|
280
319
|
`;
|
|
320
|
+
StyledMenuItemWrapper.defaultProps = {
|
|
321
|
+
theme: baseTheme
|
|
322
|
+
};
|
|
281
323
|
export default StyledMenuItemWrapper;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from "./menu-segment-title";
|
|
2
|
-
export
|
|
1
|
+
export { default } from "./menu-segment-title.component";
|
|
2
|
+
export type { MenuTitleProps } from "./menu-segment-title.component";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./menu-segment-title.component";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { VariantType } from "../menu-item";
|
|
3
|
+
import { TagProps } from "../../../__internal__/utils/helpers/tags";
|
|
4
|
+
export interface MenuTitleProps extends TagProps {
|
|
5
|
+
children: string;
|
|
6
|
+
/** Set the colour variant for a menuType */
|
|
7
|
+
variant?: VariantType;
|
|
8
|
+
}
|
|
9
|
+
declare const MenuSegmentTitle: React.ForwardRefExoticComponent<MenuTitleProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export default MenuSegmentTitle;
|
|
@@ -1,27 +1,31 @@
|
|
|
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 StyledTitle from "./menu-segment-title.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 MenuSegmentTitle = /*#__PURE__*/React.forwardRef(({
|
|
7
10
|
children,
|
|
8
|
-
variant = "default"
|
|
11
|
+
variant = "default",
|
|
12
|
+
...rest
|
|
9
13
|
}, ref) => {
|
|
10
14
|
const menuContext = useContext(MenuContext);
|
|
11
15
|
return /*#__PURE__*/React.createElement(StyledMenuItem, {
|
|
12
16
|
inSubmenu: true
|
|
13
|
-
}, /*#__PURE__*/React.createElement(StyledTitle, {
|
|
14
|
-
"data-component": "menu-segment-title",
|
|
17
|
+
}, /*#__PURE__*/React.createElement(StyledTitle, _extends({}, tagComponent("menu-segment-title", rest), {
|
|
15
18
|
menuType: menuContext.menuType,
|
|
16
19
|
ref: ref,
|
|
17
20
|
variant: variant
|
|
18
|
-
}, children));
|
|
21
|
+
}), children));
|
|
19
22
|
});
|
|
20
23
|
MenuSegmentTitle.propTypes = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
"children": PropTypes.string.isRequired,
|
|
25
|
+
"data-component": PropTypes.string,
|
|
26
|
+
"data-element": PropTypes.string,
|
|
27
|
+
"data-role": PropTypes.string,
|
|
28
|
+
"variant": PropTypes.oneOf(["alternate", "default"])
|
|
26
29
|
};
|
|
30
|
+
MenuSegmentTitle.displayName = "MenuSegmentTitle";
|
|
27
31
|
export default MenuSegmentTitle;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { VariantType } from "../menu-item";
|
|
2
|
+
import { MenuType } from "../menu.context";
|
|
3
|
+
interface StyledTitleProps {
|
|
4
|
+
variant?: VariantType;
|
|
5
|
+
menuType: MenuType;
|
|
6
|
+
}
|
|
7
|
+
declare const StyledTitle: import("styled-components").StyledComponent<"div", any, StyledTitleProps, never>;
|
|
8
|
+
export default StyledTitle;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { LayoutProps, FlexboxProps } from "styled-system";
|
|
3
|
+
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
4
|
+
import MenuContext, { MenuType } from "./menu.context";
|
|
5
|
+
export interface MenuProps extends TagProps, LayoutProps, FlexboxProps {
|
|
6
|
+
/** Children elements */
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
/** Defines the color scheme of the component */
|
|
9
|
+
menuType?: MenuType;
|
|
10
|
+
}
|
|
11
|
+
export declare const Menu: ({ menuType, children, ...rest }: MenuProps) => JSX.Element;
|
|
1
12
|
export { MenuContext };
|
|
2
13
|
export default Menu;
|
|
3
|
-
import MenuContext from "./menu.context";
|
|
4
|
-
declare function Menu({ menuType, children, ...rest }: {
|
|
5
|
-
[x: string]: any;
|
|
6
|
-
menuType?: string | undefined;
|
|
7
|
-
children: any;
|
|
8
|
-
}): JSX.Element;
|
|
9
|
-
declare namespace Menu {
|
|
10
|
-
const propTypes: any;
|
|
11
|
-
}
|