carbon-react 117.5.0 → 117.6.1

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 (146) hide show
  1. package/esm/__internal__/input/input.component.d.ts +3 -3
  2. package/esm/components/advanced-color-picker/advanced-color-picker.component.js +8 -0
  3. package/esm/components/button-toggle/button-toggle.component.js +7 -0
  4. package/esm/components/checkbox/checkbox.component.js +6 -0
  5. package/esm/components/decimal/decimal.component.js +7 -0
  6. package/esm/components/grouped-character/grouped-character.component.js +6 -0
  7. package/esm/components/menu/__internal__/locators.d.ts +6 -6
  8. package/esm/components/menu/__internal__/spec-helper/index.d.ts +3 -0
  9. package/esm/components/menu/__internal__/submenu/index.d.ts +2 -0
  10. package/esm/components/menu/__internal__/submenu/index.js +1 -0
  11. package/esm/components/menu/__internal__/submenu/submenu.component.d.ts +42 -0
  12. package/esm/components/menu/__internal__/submenu/submenu.component.js +162 -85
  13. package/esm/components/menu/__internal__/submenu/submenu.context.d.ts +10 -0
  14. package/esm/components/menu/__internal__/submenu/submenu.style.d.ts +16 -0
  15. package/esm/components/menu/__internal__/submenu/submenu.style.js +4 -4
  16. package/esm/components/menu/index.d.ts +12 -6
  17. package/esm/components/menu/index.js +5 -5
  18. package/esm/components/menu/menu-divider/index.d.ts +2 -2
  19. package/esm/components/menu/menu-divider/index.js +1 -0
  20. package/esm/components/menu/menu-divider/menu-divider.component.d.ts +7 -0
  21. package/esm/components/menu/menu-divider/menu-divider.component.js +14 -7
  22. package/esm/components/menu/menu-divider/menu-divider.style.d.ts +6 -0
  23. package/esm/components/menu/menu-full-screen/index.d.ts +2 -2
  24. package/esm/components/menu/menu-full-screen/menu-full-screen.component.d.ts +14 -0
  25. package/esm/components/menu/menu-full-screen/menu-full-screen.component.js +20 -30
  26. package/esm/components/menu/menu-full-screen/menu-full-screen.style.d.ts +8 -0
  27. package/esm/components/menu/menu-full-screen/menu-full-screen.style.js +29 -27
  28. package/esm/components/menu/menu-item/index.d.ts +2 -2
  29. package/esm/components/menu/menu-item/menu-item.component.d.ts +67 -0
  30. package/esm/components/menu/menu-item/menu-item.component.js +2084 -121
  31. package/esm/components/menu/menu-item/menu-item.style.d.ts +21 -0
  32. package/esm/components/menu/menu-item/menu-item.style.js +188 -146
  33. package/esm/components/menu/menu-segment-title/index.d.ts +2 -2
  34. package/esm/components/menu/menu-segment-title/index.js +1 -0
  35. package/esm/components/menu/menu-segment-title/menu-segment-title.component.d.ts +10 -0
  36. package/esm/components/menu/menu-segment-title/menu-segment-title.component.js +13 -9
  37. package/esm/components/menu/menu-segment-title/menu-segment-title.style.d.ts +8 -0
  38. package/esm/components/menu/menu.component.d.ts +11 -9
  39. package/esm/components/menu/menu.component.js +1887 -18
  40. package/esm/components/menu/menu.config.d.ts +58 -94
  41. package/esm/components/menu/menu.context.d.ts +12 -6
  42. package/esm/components/menu/menu.style.d.ts +12 -2
  43. package/esm/components/menu/menu.style.js +11 -11
  44. package/esm/components/menu/scrollable-block/index.d.ts +2 -1
  45. package/esm/components/menu/scrollable-block/scrollable-block.component.d.ts +19 -0
  46. package/esm/components/menu/scrollable-block/scrollable-block.component.js +13 -20
  47. package/esm/components/menu/scrollable-block/scrollable-block.style.d.ts +8 -0
  48. package/esm/components/message/message-content/message-content.component.d.ts +4 -2
  49. package/esm/components/message/message-content/message-content.component.js +7 -2
  50. package/esm/components/message/message-content/message-content.style.d.ts +2 -1
  51. package/esm/components/message/message-content/message-content.style.js +4 -1
  52. package/esm/components/message/message.component.js +1 -0
  53. package/esm/components/number/number.component.js +6 -0
  54. package/esm/components/numeral-date/numeral-date.component.js +8 -0
  55. package/esm/components/radio-button/radio-button-group.component.js +8 -0
  56. package/esm/components/radio-button/radio-button.style.js +1 -1
  57. package/esm/components/search/search.component.js +6 -0
  58. package/esm/components/select/filterable-select/filterable-select.component.js +9 -1
  59. package/esm/components/select/multi-select/multi-select.component.js +9 -1
  60. package/esm/components/select/simple-select/simple-select.component.js +9 -1
  61. package/esm/components/simple-color-picker/simple-color-picker.component.js +8 -0
  62. package/esm/components/switch/switch.component.js +6 -0
  63. package/esm/components/textarea/textarea.component.js +6 -0
  64. package/esm/components/textbox/textbox.component.js +6 -0
  65. package/esm/components/toast/toast.style.d.ts +1 -1
  66. package/lib/__internal__/input/input.component.d.ts +3 -3
  67. package/lib/components/advanced-color-picker/advanced-color-picker.component.js +11 -0
  68. package/lib/components/button-toggle/button-toggle.component.js +10 -0
  69. package/lib/components/checkbox/checkbox.component.js +7 -0
  70. package/lib/components/decimal/decimal.component.js +8 -0
  71. package/lib/components/grouped-character/grouped-character.component.js +7 -0
  72. package/lib/components/menu/__internal__/locators.d.ts +6 -6
  73. package/lib/components/menu/__internal__/spec-helper/index.d.ts +3 -0
  74. package/lib/components/menu/__internal__/submenu/index.d.ts +2 -0
  75. package/lib/components/menu/__internal__/submenu/index.js +15 -0
  76. package/lib/components/menu/__internal__/submenu/package.json +6 -0
  77. package/lib/components/menu/__internal__/submenu/submenu.component.d.ts +42 -0
  78. package/lib/components/menu/__internal__/submenu/submenu.component.js +162 -86
  79. package/lib/components/menu/__internal__/submenu/submenu.context.d.ts +10 -0
  80. package/lib/components/menu/__internal__/submenu/submenu.style.d.ts +16 -0
  81. package/lib/components/menu/__internal__/submenu/submenu.style.js +4 -4
  82. package/lib/components/menu/index.d.ts +12 -6
  83. package/lib/components/menu/index.js +5 -5
  84. package/lib/components/menu/menu-divider/index.d.ts +2 -2
  85. package/lib/components/menu/menu-divider/index.js +15 -0
  86. package/lib/components/menu/menu-divider/menu-divider.component.d.ts +7 -0
  87. package/lib/components/menu/menu-divider/menu-divider.component.js +15 -7
  88. package/lib/components/menu/menu-divider/menu-divider.style.d.ts +6 -0
  89. package/lib/components/menu/menu-divider/package.json +6 -0
  90. package/lib/components/menu/menu-full-screen/index.d.ts +2 -2
  91. package/lib/components/menu/menu-full-screen/menu-full-screen.component.d.ts +14 -0
  92. package/lib/components/menu/menu-full-screen/menu-full-screen.component.js +22 -31
  93. package/lib/components/menu/menu-full-screen/menu-full-screen.style.d.ts +8 -0
  94. package/lib/components/menu/menu-full-screen/menu-full-screen.style.js +30 -28
  95. package/lib/components/menu/menu-item/index.d.ts +2 -2
  96. package/lib/components/menu/menu-item/menu-item.component.d.ts +67 -0
  97. package/lib/components/menu/menu-item/menu-item.component.js +2085 -122
  98. package/lib/components/menu/menu-item/menu-item.style.d.ts +21 -0
  99. package/lib/components/menu/menu-item/menu-item.style.js +191 -146
  100. package/lib/components/menu/menu-segment-title/index.d.ts +2 -2
  101. package/lib/components/menu/menu-segment-title/index.js +15 -0
  102. package/lib/components/menu/menu-segment-title/menu-segment-title.component.d.ts +10 -0
  103. package/lib/components/menu/menu-segment-title/menu-segment-title.component.js +14 -9
  104. package/lib/components/menu/menu-segment-title/menu-segment-title.style.d.ts +8 -0
  105. package/lib/components/menu/menu-segment-title/package.json +6 -0
  106. package/lib/components/menu/menu.component.d.ts +11 -9
  107. package/lib/components/menu/menu.component.js +1889 -20
  108. package/lib/components/menu/menu.config.d.ts +58 -94
  109. package/lib/components/menu/menu.context.d.ts +12 -6
  110. package/lib/components/menu/menu.style.d.ts +12 -2
  111. package/lib/components/menu/menu.style.js +12 -12
  112. package/lib/components/menu/scrollable-block/index.d.ts +2 -1
  113. package/lib/components/menu/scrollable-block/scrollable-block.component.d.ts +19 -0
  114. package/lib/components/menu/scrollable-block/scrollable-block.component.js +15 -21
  115. package/lib/components/menu/scrollable-block/scrollable-block.style.d.ts +8 -0
  116. package/lib/components/message/message-content/message-content.component.d.ts +4 -2
  117. package/lib/components/message/message-content/message-content.component.js +7 -2
  118. package/lib/components/message/message-content/message-content.style.d.ts +2 -1
  119. package/lib/components/message/message-content/message-content.style.js +4 -1
  120. package/lib/components/message/message.component.js +1 -0
  121. package/lib/components/number/number.component.js +7 -0
  122. package/lib/components/numeral-date/numeral-date.component.js +10 -0
  123. package/lib/components/radio-button/radio-button-group.component.js +11 -0
  124. package/lib/components/radio-button/radio-button.style.js +1 -1
  125. package/lib/components/search/search.component.js +7 -0
  126. package/lib/components/select/filterable-select/filterable-select.component.js +10 -1
  127. package/lib/components/select/multi-select/multi-select.component.js +10 -1
  128. package/lib/components/select/simple-select/simple-select.component.js +10 -1
  129. package/lib/components/simple-color-picker/simple-color-picker.component.js +11 -0
  130. package/lib/components/switch/switch.component.js +7 -0
  131. package/lib/components/textarea/textarea.component.js +7 -0
  132. package/lib/components/textbox/textbox.component.js +7 -0
  133. package/lib/components/toast/toast.style.d.ts +1 -1
  134. package/package.json +2 -2
  135. package/esm/components/menu/menu-divider/menu-divider.d.ts +0 -11
  136. package/esm/components/menu/menu-full-screen/menu-full-screen.d.ts +0 -16
  137. package/esm/components/menu/menu-item/menu-item.d.ts +0 -60
  138. package/esm/components/menu/menu-segment-title/menu-segment-title.d.ts +0 -12
  139. package/esm/components/menu/menu.d.ts +0 -28
  140. package/esm/components/menu/scrollable-block/scrollable-block.d.ts +0 -20
  141. package/lib/components/menu/menu-divider/menu-divider.d.ts +0 -11
  142. package/lib/components/menu/menu-full-screen/menu-full-screen.d.ts +0 -16
  143. package/lib/components/menu/menu-item/menu-item.d.ts +0 -60
  144. package/lib/components/menu/menu-segment-title/menu-segment-title.d.ts +0 -12
  145. package/lib/components/menu/menu.d.ts +0 -28
  146. 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
- const StyledMenuItemWrapper = styled.a`
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
- as,
21
- asPassiveItem
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
- cursor: pointer;
35
+ a,
36
+ button {
37
+ cursor: pointer;
38
+ }
29
39
  ${!overrideColor && css`
30
- background-color: ${menuConfigVariants[menuType].background};
31
- `}};
32
-
40
+ background-color: ${menuConfigVariants[menuType].background};
41
+ `}
42
+
33
43
  ${overrideColor && css`
34
- &&&& {
35
- background-color: ${variant === "alternate" ? menuConfigVariants[menuType].alternate : menuConfigVariants[menuType].submenuItemBackground};
36
- }
37
- `}
44
+ &&&& {
45
+ background-color: ${variant === "alternate" ? menuConfigVariants[menuType].alternate : menuConfigVariants[menuType].submenuItemBackground};
46
+ }
47
+ `}
38
48
 
39
49
  ${!inFullscreenView && css`
40
- max-width: inherit;
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
- a:focus,
56
- button:focus {
57
- box-shadow: inset 0 0 0 var(--borderWidth300)
58
- var(--colorsSemanticFocus500);
59
- background-color: ${menuConfigVariants[menuType].background};
60
- color: ${menuConfigVariants[menuType].color};
61
- z-index: 1;
62
- position: relative;
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
- a:hover,
66
- button:hover {
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
- background-color: ${menuConfigVariants[menuType].selected};
144
+ background-color: ${menuConfigVariants[menuType].selected};
127
145
 
128
- a:focus,
129
- button:focus {
130
- background-color: ${menuConfigVariants[menuType].selected};
131
- }
146
+ a:focus,
147
+ button:focus {
148
+ background-color: ${menuConfigVariants[menuType].selected};
149
+ }
132
150
 
133
- a:hover,
134
- button:hover {
135
- background-color: var(--colorsComponentsMenuAutumnStandard600);
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
- background-color: ${menuConfigVariants[menuType].alternate};
142
- }
158
+ &&& {
159
+ background-color: ${menuConfigVariants[menuType].alternate};
160
+ }
143
161
 
144
- &&& a:focus,
145
- &&& button:focus {
146
- background-color: ${menuConfigVariants[menuType].alternate};
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
- a,
157
- button {
158
- background-color: ${menuConfigVariants[menuType].submenuItemBackground};
159
- color: ${menuConfigVariants[menuType].color};
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
- a:focus,
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
- a:hover,
181
- button:hover {
195
+ ${clickToOpen && isOpen && css`
182
196
  background-color: ${menuConfigVariants[menuType].submenuOpenedBackground};
183
- color: var(--colorsComponentsMenuYang100);
197
+ `}
198
+ }
184
199
 
185
- ${!(href || clickToOpen) && css`
186
- cursor: default;
187
- background-color: ${menuConfigVariants[menuType].submenuItemBackground};
188
- color: ${menuConfigVariants[menuType].color};
189
- `}
200
+ a:hover,
201
+ button:hover {
202
+ background-color: ${menuConfigVariants[menuType].submenuOpenedBackground};
203
+ color: var(--colorsComponentsMenuYang100);
190
204
 
191
- [data-component="icon"] {
192
- color: ${menuConfigVariants[menuType].color};
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
- ${selected && css`
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
- a:focus,
200
- button:focus {
201
- background-color: ${menuConfigVariants[menuType].submenuSelected};
202
- }
224
+ a:hover,
225
+ button:hover {
226
+ background-color: var(--colorsComponentsMenuAutumnStandard600);
227
+ color: var(--colorsComponentsMenuYang100);
228
+ }
229
+ `}
203
230
 
204
- a:hover,
205
- button:hover {
206
- background-color: var(--colorsComponentsMenuAutumnStandard600);
207
- color: var(--colorsComponentsMenuYang100);
208
- }
209
- `}
231
+ ${showDropdownArrow && css`
232
+ > a,
233
+ > button:not(${StyledIconButton}) {
234
+ padding-right: 32px;
235
+ }
210
236
 
211
- ${showDropdownArrow && css`
212
- > a,
213
- > button:not(${StyledIconButton}) {
214
- padding-right: 32px;
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
- a::before,
218
- button::before {
219
- display: block;
220
- margin-top: -2px;
221
- pointer-events: none;
222
- position: absolute;
223
- right: 16px;
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
- ${isSearch && css`
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
- a,
287
+ a,
252
288
  ${StyledLink} a,
253
289
  button,
254
290
  ${StyledLink} button {
255
- width: 100vw;
256
- box-sizing: border-box;
257
- }
291
+ width: 100vw;
292
+ box-sizing: border-box;
293
+ }
258
294
 
259
- a:focus,
260
- button:focus {
261
- box-shadow: inset 0 0 0 var(--borderWidth300)
262
- var(--colorsSemanticFocus500);
263
- z-index: 1;
264
- position: relative;
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
- a:focus,
268
- a:hover,
269
- button:focus,
270
- button:hover {
271
- background-color: var(--colorsComponentsMenuAutumnStandard600);
272
- color: var(--colorsComponentsMenuYang100);
303
+ a:focus,
304
+ a:hover,
305
+ button:focus,
306
+ button:hover {
307
+ background-color: var(--colorsComponentsMenuAutumnStandard600);
308
+ color: var(--colorsComponentsMenuYang100);
273
309
 
274
- [data-component="icon"] {
275
- color: var(--colorsComponentsMenuYang100);
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 * from "./menu-segment-title";
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
- /** set the colour variant for a menuType */
22
- variant: PropTypes.oneOf(["default", "alternate"]),
23
-
24
- /** the text to be displayed */
25
- children: PropTypes.string.isRequired
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
- }