carbon-react 138.0.0 → 138.0.2
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-icon-toggle/input-icon-toggle.component.js +2 -1
- package/esm/components/menu/__internal__/submenu/submenu.component.js +1 -4
- package/esm/components/menu/__internal__/submenu/submenu.style.js +5 -0
- package/esm/components/menu/menu-full-screen/menu-full-screen.component.js +4 -1
- package/esm/components/menu/menu-item/menu-item.component.js +5 -1
- package/esm/components/menu/menu-item/menu-item.style.js +5 -0
- package/esm/components/menu/menu-segment-title/menu-segment-title.component.js +3 -1
- package/esm/components/menu/menu.style.js +2 -0
- package/esm/components/menu/scrollable-block/scrollable-block.component.js +2 -1
- package/esm/components/pill/pill.style.js +34 -76
- package/lib/__internal__/input-icon-toggle/input-icon-toggle.component.js +2 -1
- package/lib/components/menu/__internal__/submenu/submenu.component.js +1 -4
- package/lib/components/menu/__internal__/submenu/submenu.style.js +5 -0
- package/lib/components/menu/menu-full-screen/menu-full-screen.component.js +4 -1
- package/lib/components/menu/menu-item/menu-item.component.js +5 -1
- package/lib/components/menu/menu-item/menu-item.style.js +5 -0
- package/lib/components/menu/menu-segment-title/menu-segment-title.component.js +3 -1
- package/lib/components/menu/menu.style.js +2 -0
- package/lib/components/menu/scrollable-block/scrollable-block.component.js +2 -1
- package/lib/components/pill/pill.style.js +34 -76
- package/package.json +2 -2
- package/esm/components/menu/__internal__/spec-helper/index.d.ts +0 -3
- package/esm/components/menu/__internal__/spec-helper/index.js +0 -19
- package/lib/components/menu/__internal__/spec-helper/index.d.ts +0 -3
- package/lib/components/menu/__internal__/spec-helper/index.js +0 -26
- package/lib/components/menu/__internal__/spec-helper/package.json +0 -6
|
@@ -59,7 +59,8 @@ const InputIconToggle = ({
|
|
|
59
59
|
tabIndex: iconTabIndex,
|
|
60
60
|
"data-element": "input-icon-toggle",
|
|
61
61
|
disabled: disabled,
|
|
62
|
-
readOnly: readOnly
|
|
62
|
+
readOnly: readOnly,
|
|
63
|
+
"data-role": "input-icon-toggle"
|
|
63
64
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
64
65
|
disabled: disabled || readOnly,
|
|
65
66
|
type: type
|
|
@@ -229,10 +229,6 @@ const Submenu = /*#__PURE__*/React.forwardRef(({
|
|
|
229
229
|
the browser navigates to the specified href of the menu-item. */
|
|
230
230
|
setTimeout(() => closeSubmenu(), 0);
|
|
231
231
|
}
|
|
232
|
-
if (href && Events.isEnterKey(event)) {
|
|
233
|
-
closeSubmenu();
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
232
|
}
|
|
237
233
|
if (nextIndex !== index) {
|
|
238
234
|
setSubmenuFocusId(submenuItemIds[nextIndex]);
|
|
@@ -311,6 +307,7 @@ const Submenu = /*#__PURE__*/React.forwardRef(({
|
|
|
311
307
|
}
|
|
312
308
|
return /*#__PURE__*/React.createElement(StyledSubmenuWrapper, {
|
|
313
309
|
"data-component": "submenu-wrapper",
|
|
310
|
+
"data-role": "submenu-wrapper",
|
|
314
311
|
onMouseOver: !clickToOpen ? () => openSubmenu() : undefined,
|
|
315
312
|
onMouseLeave: () => closeSubmenu(),
|
|
316
313
|
isSubmenuOpen: submenuOpen,
|
|
@@ -122,6 +122,11 @@ const StyledSubmenu = styled.ul`
|
|
|
122
122
|
white-space: nowrap;
|
|
123
123
|
cursor: pointer;
|
|
124
124
|
|
|
125
|
+
${inFullscreenView && css`
|
|
126
|
+
white-space: normal;
|
|
127
|
+
height: auto;
|
|
128
|
+
`}
|
|
129
|
+
|
|
125
130
|
${!inFullscreenView && menuType && css`
|
|
126
131
|
background-color: ${menuConfigVariants[menuType].submenuItemBackground};
|
|
127
132
|
|
|
@@ -37,11 +37,14 @@ export const MenuFullscreen = ({
|
|
|
37
37
|
const flattenedChildren = React.Children.toArray(children);
|
|
38
38
|
const childArray = React.Children.toArray(flattenedChildren.map((child, index) => {
|
|
39
39
|
if (index < flattenedChildren.length - 1) {
|
|
40
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, child, /*#__PURE__*/React.createElement(MenuDivider,
|
|
40
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, child, /*#__PURE__*/React.createElement(MenuDivider, {
|
|
41
|
+
"data-role": "divider"
|
|
42
|
+
}));
|
|
41
43
|
}
|
|
42
44
|
return child;
|
|
43
45
|
}));
|
|
44
46
|
const closeModal = useCallback(ev => {
|
|
47
|
+
/* istanbul ignore else */
|
|
45
48
|
if (onClose && Events.isEscKey(ev)) {
|
|
46
49
|
ev.stopImmediatePropagation();
|
|
47
50
|
onClose(ev);
|
|
@@ -60,10 +60,13 @@ export const MenuItem = ({
|
|
|
60
60
|
const focusRef = inputRef.current ? inputRef : ref;
|
|
61
61
|
useEffect(() => {
|
|
62
62
|
const id = menuItemId.current;
|
|
63
|
+
|
|
64
|
+
/* istanbul ignore else */
|
|
63
65
|
if (registerItem) {
|
|
64
66
|
registerItem(id);
|
|
65
67
|
}
|
|
66
68
|
return () => {
|
|
69
|
+
/* istanbul ignore else */
|
|
67
70
|
if (unregisterItem) {
|
|
68
71
|
unregisterItem(id);
|
|
69
72
|
}
|
|
@@ -165,7 +168,8 @@ export const MenuItem = ({
|
|
|
165
168
|
onClick: updateFocusOnClick,
|
|
166
169
|
as: as
|
|
167
170
|
}), /*#__PURE__*/React.createElement(StyledMenuItemWrapper, _extends({
|
|
168
|
-
menuType: menuType
|
|
171
|
+
menuType: menuType,
|
|
172
|
+
"data-role": "menu-item-wrapper"
|
|
169
173
|
}, elementProps, {
|
|
170
174
|
ariaLabel: ariaLabel,
|
|
171
175
|
maxWidth: maxWidth,
|
|
@@ -22,7 +22,9 @@ const MenuSegmentTitle = /*#__PURE__*/React.forwardRef(({
|
|
|
22
22
|
menuType: menuContext.menuType,
|
|
23
23
|
ref: ref,
|
|
24
24
|
variant: variant
|
|
25
|
-
}), text), children && /*#__PURE__*/React.createElement(StyledSegmentChildren,
|
|
25
|
+
}), text), children && /*#__PURE__*/React.createElement(StyledSegmentChildren, {
|
|
26
|
+
"data-role": "menu-segment-children"
|
|
27
|
+
}, children));
|
|
26
28
|
});
|
|
27
29
|
if (process.env.NODE_ENV !== "production") {
|
|
28
30
|
MenuSegmentTitle.propTypes = {
|
|
@@ -31,7 +31,8 @@ export const ScrollableBlock = ({
|
|
|
31
31
|
overrideColor: true,
|
|
32
32
|
variant: parentVariant,
|
|
33
33
|
p: "2px 16px",
|
|
34
|
-
as: "div"
|
|
34
|
+
as: "div",
|
|
35
|
+
"data-role": "scrollable-block-parent-menu-item"
|
|
35
36
|
}, parent), /*#__PURE__*/React.createElement(Box, {
|
|
36
37
|
overflowY: "scroll",
|
|
37
38
|
scrollVariant: scrollVariants[menuType],
|
|
@@ -6,15 +6,6 @@ import { baseTheme } from "../../style/themes";
|
|
|
6
6
|
import StyledIcon from "../icon/icon.style";
|
|
7
7
|
import { toColor } from "../../style/utils/color";
|
|
8
8
|
import getColorValue from "../../style/utils/get-color-value";
|
|
9
|
-
function addStyleToPillIcon(fontSize) {
|
|
10
|
-
return `
|
|
11
|
-
${StyledIcon} {
|
|
12
|
-
&:before {
|
|
13
|
-
font-size: ${fontSize};
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
`;
|
|
17
|
-
}
|
|
18
9
|
const StyledPill = styled.span`
|
|
19
10
|
${margin}
|
|
20
11
|
${({
|
|
@@ -70,13 +61,16 @@ const StyledPill = styled.span`
|
|
|
70
61
|
border-radius: var(--borderRadius025);
|
|
71
62
|
`}
|
|
72
63
|
height: auto;
|
|
64
|
+
|
|
73
65
|
${!wrapText && css`
|
|
74
66
|
white-space: nowrap;
|
|
75
67
|
`}
|
|
68
|
+
|
|
76
69
|
${wrapText && css`
|
|
77
70
|
white-space: break-spaces;
|
|
78
71
|
hyphens: auto;
|
|
79
72
|
`}
|
|
73
|
+
|
|
80
74
|
color: ${contentColor};
|
|
81
75
|
|
|
82
76
|
${inFill && css`
|
|
@@ -91,13 +85,10 @@ const StyledPill = styled.span`
|
|
|
91
85
|
min-height: 16px;
|
|
92
86
|
line-height: 16px;
|
|
93
87
|
font-size: 12px;
|
|
88
|
+
padding: 0 8px;
|
|
94
89
|
|
|
95
90
|
${theme.roundedCornersOptOut && css`
|
|
96
91
|
border-radius: 12px;
|
|
97
|
-
|
|
98
|
-
button {
|
|
99
|
-
border-radius: 0 10px 10px 0;
|
|
100
|
-
}
|
|
101
92
|
`}
|
|
102
93
|
`}
|
|
103
94
|
|
|
@@ -105,13 +96,10 @@ const StyledPill = styled.span`
|
|
|
105
96
|
min-height: 20px;
|
|
106
97
|
line-height: 20px;
|
|
107
98
|
font-size: 14px;
|
|
99
|
+
padding: 0 8px;
|
|
108
100
|
|
|
109
101
|
${theme.roundedCornersOptOut && css`
|
|
110
102
|
border-radius: 12px;
|
|
111
|
-
|
|
112
|
-
button {
|
|
113
|
-
border-radius: 0 10px 10px 0;
|
|
114
|
-
}
|
|
115
103
|
`}
|
|
116
104
|
`}
|
|
117
105
|
|
|
@@ -119,13 +107,10 @@ const StyledPill = styled.span`
|
|
|
119
107
|
min-height: 24px;
|
|
120
108
|
line-height: 24px;
|
|
121
109
|
font-size: 14px;
|
|
110
|
+
padding: 0 8px;
|
|
122
111
|
|
|
123
112
|
${theme.roundedCornersOptOut && css`
|
|
124
113
|
border-radius: 13px;
|
|
125
|
-
|
|
126
|
-
button {
|
|
127
|
-
border-radius: 0 11px 11px 0;
|
|
128
|
-
}
|
|
129
114
|
`}
|
|
130
115
|
`}
|
|
131
116
|
|
|
@@ -133,13 +118,10 @@ const StyledPill = styled.span`
|
|
|
133
118
|
min-height: 28px;
|
|
134
119
|
line-height: 28px;
|
|
135
120
|
font-size: 16px;
|
|
121
|
+
padding: 0 12px;
|
|
136
122
|
|
|
137
123
|
${theme.roundedCornersOptOut && css`
|
|
138
124
|
border-radius: 15px;
|
|
139
|
-
|
|
140
|
-
button {
|
|
141
|
-
border-radius: 0 12px 12px 0;
|
|
142
|
-
}
|
|
143
125
|
`}
|
|
144
126
|
`}
|
|
145
127
|
|
|
@@ -172,12 +154,10 @@ const StyledPill = styled.span`
|
|
|
172
154
|
var(--borderRadius025) var(--borderRadius000);
|
|
173
155
|
`}
|
|
174
156
|
|
|
175
|
-
& {
|
|
176
|
-
color: ${contentColor};
|
|
177
|
-
}
|
|
178
157
|
::-moz-focus-inner {
|
|
179
158
|
border: 0;
|
|
180
159
|
}
|
|
160
|
+
|
|
181
161
|
${StyledIcon} {
|
|
182
162
|
color: ${contentColor};
|
|
183
163
|
}
|
|
@@ -187,6 +167,7 @@ const StyledPill = styled.span`
|
|
|
187
167
|
background-color: ${buttonFocusColor};
|
|
188
168
|
color: ${contentColor};
|
|
189
169
|
cursor: pointer;
|
|
170
|
+
|
|
190
171
|
${StyledIcon} {
|
|
191
172
|
color: ${contentColor};
|
|
192
173
|
}
|
|
@@ -197,17 +178,10 @@ const StyledPill = styled.span`
|
|
|
197
178
|
width: unset;
|
|
198
179
|
color: ${contentColor};
|
|
199
180
|
|
|
200
|
-
|
|
201
|
-
&:focus {
|
|
202
|
-
color: ${contentColor};
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
${!inFill && css`
|
|
207
|
-
${StyledIcon} {
|
|
181
|
+
${!inFill && css`
|
|
208
182
|
color: ${!isDarkBackground ? "var(--colorsUtilityYin090)" : "var(--colorsUtilityYang100)"};
|
|
209
|
-
}
|
|
210
|
-
|
|
183
|
+
`}
|
|
184
|
+
}
|
|
211
185
|
}
|
|
212
186
|
|
|
213
187
|
${size === "S" && css`
|
|
@@ -216,8 +190,17 @@ const StyledPill = styled.span`
|
|
|
216
190
|
button {
|
|
217
191
|
padding: 0;
|
|
218
192
|
line-height: 16px;
|
|
219
|
-
|
|
220
|
-
${
|
|
193
|
+
|
|
194
|
+
${StyledIcon} {
|
|
195
|
+
top: -2px;
|
|
196
|
+
&:before {
|
|
197
|
+
font-size: 16px;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
${theme.roundedCornersOptOut && css`
|
|
202
|
+
border-radius: 0 10px 10px 0;
|
|
203
|
+
`}
|
|
221
204
|
}
|
|
222
205
|
`}
|
|
223
206
|
|
|
@@ -228,6 +211,10 @@ const StyledPill = styled.span`
|
|
|
228
211
|
width: 24px;
|
|
229
212
|
padding: 0;
|
|
230
213
|
line-height: 15px;
|
|
214
|
+
|
|
215
|
+
${theme.roundedCornersOptOut && css`
|
|
216
|
+
border-radius: 0 10px 10px 0;
|
|
217
|
+
`}
|
|
231
218
|
}
|
|
232
219
|
`}
|
|
233
220
|
|
|
@@ -238,6 +225,10 @@ const StyledPill = styled.span`
|
|
|
238
225
|
width: 28px;
|
|
239
226
|
padding: 0;
|
|
240
227
|
line-height: 16px;
|
|
228
|
+
|
|
229
|
+
${theme.roundedCornersOptOut && css`
|
|
230
|
+
border-radius: 0 11px 11px 0;
|
|
231
|
+
`}
|
|
241
232
|
}
|
|
242
233
|
`}
|
|
243
234
|
|
|
@@ -248,43 +239,10 @@ const StyledPill = styled.span`
|
|
|
248
239
|
width: 32px;
|
|
249
240
|
padding: 0;
|
|
250
241
|
line-height: 18px;
|
|
251
|
-
}
|
|
252
|
-
`}
|
|
253
|
-
`}
|
|
254
|
-
|
|
255
|
-
${!isDeletable && css`
|
|
256
|
-
${size === "S" && css`
|
|
257
|
-
padding: 0 8px;
|
|
258
|
-
|
|
259
|
-
button {
|
|
260
|
-
padding: 0;
|
|
261
|
-
}
|
|
262
|
-
`}
|
|
263
242
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
button {
|
|
268
|
-
width: 24px;
|
|
269
|
-
padding: 0;
|
|
270
|
-
}
|
|
271
|
-
`}
|
|
272
|
-
|
|
273
|
-
${size === "L" && css`
|
|
274
|
-
padding: 0 8px;
|
|
275
|
-
|
|
276
|
-
button {
|
|
277
|
-
width: 28px;
|
|
278
|
-
padding: 0;
|
|
279
|
-
}
|
|
280
|
-
`}
|
|
281
|
-
|
|
282
|
-
${size === "XL" && css`
|
|
283
|
-
padding: 0 12px;
|
|
284
|
-
|
|
285
|
-
button {
|
|
286
|
-
width: 32px;
|
|
287
|
-
padding: 0;
|
|
243
|
+
${theme.roundedCornersOptOut && css`
|
|
244
|
+
border-radius: 0 12px 12px 0;
|
|
245
|
+
`}
|
|
288
246
|
}
|
|
289
247
|
`}
|
|
290
248
|
`}
|
|
@@ -66,7 +66,8 @@ const InputIconToggle = ({
|
|
|
66
66
|
tabIndex: iconTabIndex,
|
|
67
67
|
"data-element": "input-icon-toggle",
|
|
68
68
|
disabled: disabled,
|
|
69
|
-
readOnly: readOnly
|
|
69
|
+
readOnly: readOnly,
|
|
70
|
+
"data-role": "input-icon-toggle"
|
|
70
71
|
}, /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
71
72
|
disabled: disabled || readOnly,
|
|
72
73
|
type: type
|
|
@@ -238,10 +238,6 @@ const Submenu = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
238
238
|
the browser navigates to the specified href of the menu-item. */
|
|
239
239
|
setTimeout(() => closeSubmenu(), 0);
|
|
240
240
|
}
|
|
241
|
-
if (href && _events.default.isEnterKey(event)) {
|
|
242
|
-
closeSubmenu();
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
241
|
}
|
|
246
242
|
if (nextIndex !== index) {
|
|
247
243
|
setSubmenuFocusId(submenuItemIds[nextIndex]);
|
|
@@ -320,6 +316,7 @@ const Submenu = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
320
316
|
}
|
|
321
317
|
return /*#__PURE__*/_react.default.createElement(_submenu.StyledSubmenuWrapper, {
|
|
322
318
|
"data-component": "submenu-wrapper",
|
|
319
|
+
"data-role": "submenu-wrapper",
|
|
323
320
|
onMouseOver: !clickToOpen ? () => openSubmenu() : undefined,
|
|
324
321
|
onMouseLeave: () => closeSubmenu(),
|
|
325
322
|
isSubmenuOpen: submenuOpen,
|
|
@@ -131,6 +131,11 @@ const StyledSubmenu = exports.StyledSubmenu = _styledComponents.default.ul`
|
|
|
131
131
|
white-space: nowrap;
|
|
132
132
|
cursor: pointer;
|
|
133
133
|
|
|
134
|
+
${inFullscreenView && (0, _styledComponents.css)`
|
|
135
|
+
white-space: normal;
|
|
136
|
+
height: auto;
|
|
137
|
+
`}
|
|
138
|
+
|
|
134
139
|
${!inFullscreenView && menuType && (0, _styledComponents.css)`
|
|
135
140
|
background-color: ${_menu2.default[menuType].submenuItemBackground};
|
|
136
141
|
|
|
@@ -46,11 +46,14 @@ const MenuFullscreen = ({
|
|
|
46
46
|
const flattenedChildren = _react.default.Children.toArray(children);
|
|
47
47
|
const childArray = _react.default.Children.toArray(flattenedChildren.map((child, index) => {
|
|
48
48
|
if (index < flattenedChildren.length - 1) {
|
|
49
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, child, /*#__PURE__*/_react.default.createElement(_menuDivider.default,
|
|
49
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, child, /*#__PURE__*/_react.default.createElement(_menuDivider.default, {
|
|
50
|
+
"data-role": "divider"
|
|
51
|
+
}));
|
|
50
52
|
}
|
|
51
53
|
return child;
|
|
52
54
|
}));
|
|
53
55
|
const closeModal = (0, _react.useCallback)(ev => {
|
|
56
|
+
/* istanbul ignore else */
|
|
54
57
|
if (onClose && _events.default.isEscKey(ev)) {
|
|
55
58
|
ev.stopImmediatePropagation();
|
|
56
59
|
onClose(ev);
|
|
@@ -69,10 +69,13 @@ const MenuItem = ({
|
|
|
69
69
|
const focusRef = inputRef.current ? inputRef : ref;
|
|
70
70
|
(0, _react.useEffect)(() => {
|
|
71
71
|
const id = menuItemId.current;
|
|
72
|
+
|
|
73
|
+
/* istanbul ignore else */
|
|
72
74
|
if (registerItem) {
|
|
73
75
|
registerItem(id);
|
|
74
76
|
}
|
|
75
77
|
return () => {
|
|
78
|
+
/* istanbul ignore else */
|
|
76
79
|
if (unregisterItem) {
|
|
77
80
|
unregisterItem(id);
|
|
78
81
|
}
|
|
@@ -174,7 +177,8 @@ const MenuItem = ({
|
|
|
174
177
|
onClick: updateFocusOnClick,
|
|
175
178
|
as: as
|
|
176
179
|
}), /*#__PURE__*/_react.default.createElement(_menuItem.default, _extends({
|
|
177
|
-
menuType: menuType
|
|
180
|
+
menuType: menuType,
|
|
181
|
+
"data-role": "menu-item-wrapper"
|
|
178
182
|
}, elementProps, {
|
|
179
183
|
ariaLabel: ariaLabel,
|
|
180
184
|
maxWidth: maxWidth,
|
|
@@ -144,6 +144,11 @@ const StyledMenuItemWrapper = _styledComponents.default.a.attrs({
|
|
|
144
144
|
height: 40px;
|
|
145
145
|
margin: 0px;
|
|
146
146
|
text-align: left;
|
|
147
|
+
|
|
148
|
+
${inFullscreenView && (0, _styledComponents.css)`
|
|
149
|
+
height: auto;
|
|
150
|
+
white-space: normal;
|
|
151
|
+
`}
|
|
147
152
|
}
|
|
148
153
|
|
|
149
154
|
&&& {
|
|
@@ -31,7 +31,9 @@ const MenuSegmentTitle = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
31
31
|
menuType: menuContext.menuType,
|
|
32
32
|
ref: ref,
|
|
33
33
|
variant: variant
|
|
34
|
-
}), text), children && /*#__PURE__*/_react.default.createElement(_menuSegmentTitle.StyledSegmentChildren,
|
|
34
|
+
}), text), children && /*#__PURE__*/_react.default.createElement(_menuSegmentTitle.StyledSegmentChildren, {
|
|
35
|
+
"data-role": "menu-segment-children"
|
|
36
|
+
}, children));
|
|
35
37
|
});
|
|
36
38
|
if (process.env.NODE_ENV !== "production") {
|
|
37
39
|
MenuSegmentTitle.propTypes = {
|
|
@@ -40,7 +40,8 @@ const ScrollableBlock = ({
|
|
|
40
40
|
overrideColor: true,
|
|
41
41
|
variant: parentVariant,
|
|
42
42
|
p: "2px 16px",
|
|
43
|
-
as: "div"
|
|
43
|
+
as: "div",
|
|
44
|
+
"data-role": "scrollable-block-parent-menu-item"
|
|
44
45
|
}, parent), /*#__PURE__*/_react.default.createElement(_box.default, {
|
|
45
46
|
overflowY: "scroll",
|
|
46
47
|
scrollVariant: scrollVariants[menuType],
|
|
@@ -15,15 +15,6 @@ var _getColorValue = _interopRequireDefault(require("../../style/utils/get-color
|
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
-
function addStyleToPillIcon(fontSize) {
|
|
19
|
-
return `
|
|
20
|
-
${_icon.default} {
|
|
21
|
-
&:before {
|
|
22
|
-
font-size: ${fontSize};
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
`;
|
|
26
|
-
}
|
|
27
18
|
const StyledPill = _styledComponents.default.span`
|
|
28
19
|
${_styledSystem.margin}
|
|
29
20
|
${({
|
|
@@ -79,13 +70,16 @@ const StyledPill = _styledComponents.default.span`
|
|
|
79
70
|
border-radius: var(--borderRadius025);
|
|
80
71
|
`}
|
|
81
72
|
height: auto;
|
|
73
|
+
|
|
82
74
|
${!wrapText && (0, _styledComponents.css)`
|
|
83
75
|
white-space: nowrap;
|
|
84
76
|
`}
|
|
77
|
+
|
|
85
78
|
${wrapText && (0, _styledComponents.css)`
|
|
86
79
|
white-space: break-spaces;
|
|
87
80
|
hyphens: auto;
|
|
88
81
|
`}
|
|
82
|
+
|
|
89
83
|
color: ${contentColor};
|
|
90
84
|
|
|
91
85
|
${inFill && (0, _styledComponents.css)`
|
|
@@ -100,13 +94,10 @@ const StyledPill = _styledComponents.default.span`
|
|
|
100
94
|
min-height: 16px;
|
|
101
95
|
line-height: 16px;
|
|
102
96
|
font-size: 12px;
|
|
97
|
+
padding: 0 8px;
|
|
103
98
|
|
|
104
99
|
${theme.roundedCornersOptOut && (0, _styledComponents.css)`
|
|
105
100
|
border-radius: 12px;
|
|
106
|
-
|
|
107
|
-
button {
|
|
108
|
-
border-radius: 0 10px 10px 0;
|
|
109
|
-
}
|
|
110
101
|
`}
|
|
111
102
|
`}
|
|
112
103
|
|
|
@@ -114,13 +105,10 @@ const StyledPill = _styledComponents.default.span`
|
|
|
114
105
|
min-height: 20px;
|
|
115
106
|
line-height: 20px;
|
|
116
107
|
font-size: 14px;
|
|
108
|
+
padding: 0 8px;
|
|
117
109
|
|
|
118
110
|
${theme.roundedCornersOptOut && (0, _styledComponents.css)`
|
|
119
111
|
border-radius: 12px;
|
|
120
|
-
|
|
121
|
-
button {
|
|
122
|
-
border-radius: 0 10px 10px 0;
|
|
123
|
-
}
|
|
124
112
|
`}
|
|
125
113
|
`}
|
|
126
114
|
|
|
@@ -128,13 +116,10 @@ const StyledPill = _styledComponents.default.span`
|
|
|
128
116
|
min-height: 24px;
|
|
129
117
|
line-height: 24px;
|
|
130
118
|
font-size: 14px;
|
|
119
|
+
padding: 0 8px;
|
|
131
120
|
|
|
132
121
|
${theme.roundedCornersOptOut && (0, _styledComponents.css)`
|
|
133
122
|
border-radius: 13px;
|
|
134
|
-
|
|
135
|
-
button {
|
|
136
|
-
border-radius: 0 11px 11px 0;
|
|
137
|
-
}
|
|
138
123
|
`}
|
|
139
124
|
`}
|
|
140
125
|
|
|
@@ -142,13 +127,10 @@ const StyledPill = _styledComponents.default.span`
|
|
|
142
127
|
min-height: 28px;
|
|
143
128
|
line-height: 28px;
|
|
144
129
|
font-size: 16px;
|
|
130
|
+
padding: 0 12px;
|
|
145
131
|
|
|
146
132
|
${theme.roundedCornersOptOut && (0, _styledComponents.css)`
|
|
147
133
|
border-radius: 15px;
|
|
148
|
-
|
|
149
|
-
button {
|
|
150
|
-
border-radius: 0 12px 12px 0;
|
|
151
|
-
}
|
|
152
134
|
`}
|
|
153
135
|
`}
|
|
154
136
|
|
|
@@ -181,12 +163,10 @@ const StyledPill = _styledComponents.default.span`
|
|
|
181
163
|
var(--borderRadius025) var(--borderRadius000);
|
|
182
164
|
`}
|
|
183
165
|
|
|
184
|
-
& {
|
|
185
|
-
color: ${contentColor};
|
|
186
|
-
}
|
|
187
166
|
::-moz-focus-inner {
|
|
188
167
|
border: 0;
|
|
189
168
|
}
|
|
169
|
+
|
|
190
170
|
${_icon.default} {
|
|
191
171
|
color: ${contentColor};
|
|
192
172
|
}
|
|
@@ -196,6 +176,7 @@ const StyledPill = _styledComponents.default.span`
|
|
|
196
176
|
background-color: ${buttonFocusColor};
|
|
197
177
|
color: ${contentColor};
|
|
198
178
|
cursor: pointer;
|
|
179
|
+
|
|
199
180
|
${_icon.default} {
|
|
200
181
|
color: ${contentColor};
|
|
201
182
|
}
|
|
@@ -206,17 +187,10 @@ const StyledPill = _styledComponents.default.span`
|
|
|
206
187
|
width: unset;
|
|
207
188
|
color: ${contentColor};
|
|
208
189
|
|
|
209
|
-
|
|
210
|
-
&:focus {
|
|
211
|
-
color: ${contentColor};
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
${!inFill && (0, _styledComponents.css)`
|
|
216
|
-
${_icon.default} {
|
|
190
|
+
${!inFill && (0, _styledComponents.css)`
|
|
217
191
|
color: ${!isDarkBackground ? "var(--colorsUtilityYin090)" : "var(--colorsUtilityYang100)"};
|
|
218
|
-
}
|
|
219
|
-
|
|
192
|
+
`}
|
|
193
|
+
}
|
|
220
194
|
}
|
|
221
195
|
|
|
222
196
|
${size === "S" && (0, _styledComponents.css)`
|
|
@@ -225,8 +199,17 @@ const StyledPill = _styledComponents.default.span`
|
|
|
225
199
|
button {
|
|
226
200
|
padding: 0;
|
|
227
201
|
line-height: 16px;
|
|
228
|
-
|
|
229
|
-
${
|
|
202
|
+
|
|
203
|
+
${_icon.default} {
|
|
204
|
+
top: -2px;
|
|
205
|
+
&:before {
|
|
206
|
+
font-size: 16px;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
${theme.roundedCornersOptOut && (0, _styledComponents.css)`
|
|
211
|
+
border-radius: 0 10px 10px 0;
|
|
212
|
+
`}
|
|
230
213
|
}
|
|
231
214
|
`}
|
|
232
215
|
|
|
@@ -237,6 +220,10 @@ const StyledPill = _styledComponents.default.span`
|
|
|
237
220
|
width: 24px;
|
|
238
221
|
padding: 0;
|
|
239
222
|
line-height: 15px;
|
|
223
|
+
|
|
224
|
+
${theme.roundedCornersOptOut && (0, _styledComponents.css)`
|
|
225
|
+
border-radius: 0 10px 10px 0;
|
|
226
|
+
`}
|
|
240
227
|
}
|
|
241
228
|
`}
|
|
242
229
|
|
|
@@ -247,6 +234,10 @@ const StyledPill = _styledComponents.default.span`
|
|
|
247
234
|
width: 28px;
|
|
248
235
|
padding: 0;
|
|
249
236
|
line-height: 16px;
|
|
237
|
+
|
|
238
|
+
${theme.roundedCornersOptOut && (0, _styledComponents.css)`
|
|
239
|
+
border-radius: 0 11px 11px 0;
|
|
240
|
+
`}
|
|
250
241
|
}
|
|
251
242
|
`}
|
|
252
243
|
|
|
@@ -257,43 +248,10 @@ const StyledPill = _styledComponents.default.span`
|
|
|
257
248
|
width: 32px;
|
|
258
249
|
padding: 0;
|
|
259
250
|
line-height: 18px;
|
|
260
|
-
}
|
|
261
|
-
`}
|
|
262
|
-
`}
|
|
263
|
-
|
|
264
|
-
${!isDeletable && (0, _styledComponents.css)`
|
|
265
|
-
${size === "S" && (0, _styledComponents.css)`
|
|
266
|
-
padding: 0 8px;
|
|
267
|
-
|
|
268
|
-
button {
|
|
269
|
-
padding: 0;
|
|
270
|
-
}
|
|
271
|
-
`}
|
|
272
251
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
button {
|
|
277
|
-
width: 24px;
|
|
278
|
-
padding: 0;
|
|
279
|
-
}
|
|
280
|
-
`}
|
|
281
|
-
|
|
282
|
-
${size === "L" && (0, _styledComponents.css)`
|
|
283
|
-
padding: 0 8px;
|
|
284
|
-
|
|
285
|
-
button {
|
|
286
|
-
width: 28px;
|
|
287
|
-
padding: 0;
|
|
288
|
-
}
|
|
289
|
-
`}
|
|
290
|
-
|
|
291
|
-
${size === "XL" && (0, _styledComponents.css)`
|
|
292
|
-
padding: 0 12px;
|
|
293
|
-
|
|
294
|
-
button {
|
|
295
|
-
width: 32px;
|
|
296
|
-
padding: 0;
|
|
252
|
+
${theme.roundedCornersOptOut && (0, _styledComponents.css)`
|
|
253
|
+
border-radius: 0 12px 12px 0;
|
|
254
|
+
`}
|
|
297
255
|
}
|
|
298
256
|
`}
|
|
299
257
|
`}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "138.0.
|
|
3
|
+
"version": "138.0.2",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"@typescript-eslint/parser": "^5.59.5",
|
|
113
113
|
"@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
|
|
114
114
|
"axe-core": "^4.8.2",
|
|
115
|
-
"babel-jest": "^
|
|
115
|
+
"babel-jest": "^29.7.0",
|
|
116
116
|
"babel-plugin-dev-expression": "^0.2.3",
|
|
117
117
|
"browserslist": "^4.22.1",
|
|
118
118
|
"chromatic": "^6.17.4",
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { act } from "react-dom/test-utils";
|
|
2
|
-
import StyledMenuItemWrapper from "../../menu-item/menu-item.style";
|
|
3
|
-
import { StyledSubmenuWrapper } from "../submenu/submenu.style";
|
|
4
|
-
const events = {
|
|
5
|
-
space: {
|
|
6
|
-
key: " ",
|
|
7
|
-
preventDefault: jest.fn()
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
const openSubmenu = (wrapper, index = 0) => {
|
|
11
|
-
const menuWrapper = wrapper.find(StyledSubmenuWrapper).at(index);
|
|
12
|
-
const menuItem = menuWrapper.exists("a") ? menuWrapper.find("a") : menuWrapper.find("button");
|
|
13
|
-
menuItem.getDOMNode().focus();
|
|
14
|
-
act(() => {
|
|
15
|
-
menuWrapper.find(StyledMenuItemWrapper).props().onKeyDown(events.space);
|
|
16
|
-
});
|
|
17
|
-
wrapper.update();
|
|
18
|
-
};
|
|
19
|
-
export default openSubmenu;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _testUtils = require("react-dom/test-utils");
|
|
8
|
-
var _menuItem = _interopRequireDefault(require("../../menu-item/menu-item.style"));
|
|
9
|
-
var _submenu = require("../submenu/submenu.style");
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
const events = {
|
|
12
|
-
space: {
|
|
13
|
-
key: " ",
|
|
14
|
-
preventDefault: jest.fn()
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const openSubmenu = (wrapper, index = 0) => {
|
|
18
|
-
const menuWrapper = wrapper.find(_submenu.StyledSubmenuWrapper).at(index);
|
|
19
|
-
const menuItem = menuWrapper.exists("a") ? menuWrapper.find("a") : menuWrapper.find("button");
|
|
20
|
-
menuItem.getDOMNode().focus();
|
|
21
|
-
(0, _testUtils.act)(() => {
|
|
22
|
-
menuWrapper.find(_menuItem.default).props().onKeyDown(events.space);
|
|
23
|
-
});
|
|
24
|
-
wrapper.update();
|
|
25
|
-
};
|
|
26
|
-
var _default = exports.default = openSubmenu;
|