@instructure/ui-menu 11.7.3-snapshot-7 → 11.7.3-snapshot-26
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/CHANGELOG.md +5 -2
- package/es/Menu/v1/MenuItem/index.js +99 -95
- package/es/Menu/v1/MenuItem/styles.js +4 -2
- package/es/Menu/v1/MenuItem/theme.js +20 -19
- package/es/Menu/v1/MenuItemGroup/index.js +71 -64
- package/es/Menu/v1/MenuItemGroup/theme.js +12 -11
- package/es/Menu/v1/MenuItemSeparator/index.js +13 -16
- package/es/Menu/v1/MenuItemSeparator/theme.js +8 -7
- package/es/Menu/v1/index.js +189 -183
- package/es/Menu/v1/theme.js +13 -12
- package/es/Menu/v2/MenuItem/index.js +128 -122
- package/es/Menu/v2/MenuItem/styles.js +5 -3
- package/es/Menu/v2/MenuItemGroup/index.js +71 -64
- package/es/Menu/v2/MenuItemSeparator/index.js +13 -16
- package/es/Menu/v2/index.js +189 -183
- package/lib/Menu/v1/MenuItem/index.js +100 -96
- package/lib/Menu/v1/MenuItem/styles.js +4 -2
- package/lib/Menu/v1/MenuItem/theme.js +20 -19
- package/lib/Menu/v1/MenuItemGroup/index.js +71 -64
- package/lib/Menu/v1/MenuItemGroup/theme.js +12 -11
- package/lib/Menu/v1/MenuItemSeparator/index.js +13 -16
- package/lib/Menu/v1/MenuItemSeparator/theme.js +8 -7
- package/lib/Menu/v1/index.js +189 -183
- package/lib/Menu/v1/theme.js +13 -12
- package/lib/Menu/v2/MenuItem/index.js +128 -122
- package/lib/Menu/v2/MenuItem/styles.js +5 -3
- package/lib/Menu/v2/MenuItemGroup/index.js +71 -64
- package/lib/Menu/v2/MenuItemSeparator/index.js +13 -16
- package/lib/Menu/v2/index.js +189 -183
- package/package.json +17 -17
- package/tsconfig.build.tsbuildinfo +1 -1
package/es/Menu/v1/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2, _class
|
|
1
|
+
var _dec, _dec2, _class;
|
|
2
2
|
/*
|
|
3
3
|
* The MIT License (MIT)
|
|
4
4
|
*
|
|
@@ -43,158 +43,178 @@ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
|
43
43
|
category: components
|
|
44
44
|
---
|
|
45
45
|
**/
|
|
46
|
-
let Menu = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec(_class = _dec2(_class =
|
|
46
|
+
let Menu = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec(_class = _dec2(_class = class Menu extends Component {
|
|
47
|
+
static displayName = "Menu";
|
|
48
|
+
static componentId = 'Menu';
|
|
49
|
+
static allowedProps = allowedProps;
|
|
50
|
+
static defaultProps = {
|
|
51
|
+
label: null,
|
|
52
|
+
disabled: false,
|
|
53
|
+
trigger: null,
|
|
54
|
+
placement: 'bottom center',
|
|
55
|
+
defaultShow: false,
|
|
56
|
+
mountNode: null,
|
|
57
|
+
constrain: 'window',
|
|
58
|
+
shouldHideOnSelect: true,
|
|
59
|
+
shouldFocusTriggerOnClose: true,
|
|
60
|
+
withArrow: true,
|
|
61
|
+
offsetX: 0,
|
|
62
|
+
offsetY: 0
|
|
63
|
+
};
|
|
64
|
+
static Item = MenuItem;
|
|
65
|
+
static Group = MenuItemGroup;
|
|
66
|
+
static Separator = MenuItemSeparator;
|
|
67
|
+
state = {
|
|
68
|
+
hasFocus: false
|
|
69
|
+
};
|
|
70
|
+
_rootNode = null;
|
|
71
|
+
_menuItems = [];
|
|
72
|
+
_popover = null;
|
|
73
|
+
_trigger = null;
|
|
74
|
+
_menu = null;
|
|
75
|
+
_labelId = this.props.deterministicId('Menu__label');
|
|
76
|
+
_activeSubMenu;
|
|
77
|
+
_id;
|
|
78
|
+
ref = null;
|
|
79
|
+
handleRef = el => {
|
|
80
|
+
const {
|
|
81
|
+
menuRef
|
|
82
|
+
} = this.props;
|
|
83
|
+
this._menu = el;
|
|
84
|
+
if (typeof menuRef === 'function') {
|
|
85
|
+
menuRef(el);
|
|
86
|
+
}
|
|
87
|
+
// If there is no trigger `<ul>` is the ref, otherwise the trigger
|
|
88
|
+
if (!this.props.trigger) {
|
|
89
|
+
this.ref = el;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
47
92
|
constructor(props) {
|
|
48
93
|
super(props);
|
|
49
|
-
this.state = {
|
|
50
|
-
hasFocus: false
|
|
51
|
-
};
|
|
52
|
-
this._rootNode = null;
|
|
53
|
-
this._menuItems = [];
|
|
54
|
-
this._popover = null;
|
|
55
|
-
this._trigger = null;
|
|
56
|
-
this._menu = null;
|
|
57
|
-
this._labelId = this.props.deterministicId('Menu__label');
|
|
58
|
-
this._activeSubMenu = void 0;
|
|
59
|
-
this._id = void 0;
|
|
60
|
-
this.ref = null;
|
|
61
|
-
this.handleRef = el => {
|
|
62
|
-
const menuRef = this.props.menuRef;
|
|
63
|
-
this._menu = el;
|
|
64
|
-
if (typeof menuRef === 'function') {
|
|
65
|
-
menuRef(el);
|
|
66
|
-
}
|
|
67
|
-
// If there is no trigger `<ul>` is the ref, otherwise the trigger
|
|
68
|
-
if (!this.props.trigger) {
|
|
69
|
-
this.ref = el;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
this.registerMenuItem = item => {
|
|
73
|
-
this._menuItems.push(item);
|
|
74
|
-
};
|
|
75
|
-
this.removeMenuItem = item => {
|
|
76
|
-
const index = this.getMenuItemIndex(item);
|
|
77
|
-
error(index >= 0, '[Menu] Could not find registered menu item.');
|
|
78
|
-
if (index >= 0) {
|
|
79
|
-
this._menuItems.splice(index, 1);
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
this.getMenuItemIndex = item => {
|
|
83
|
-
return this._menuItems.findIndex(i => i === item);
|
|
84
|
-
};
|
|
85
|
-
this.handleTriggerKeyDown = event => {
|
|
86
|
-
if (this.props.type === 'flyout' && event.keyCode === keycode.codes.right) {
|
|
87
|
-
event.persist();
|
|
88
|
-
this.show(event);
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
this.handleTriggerMouseOver = event => {
|
|
92
|
-
if (this.props.type === 'flyout') {
|
|
93
|
-
this.show(event);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
this.handleToggle = shown => {
|
|
97
|
-
if (typeof this.props.onToggle === 'function') {
|
|
98
|
-
this.props.onToggle(shown, this);
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
this.handleMenuKeyDown = event => {
|
|
102
|
-
const key = event && event.keyCode;
|
|
103
|
-
const _keycode$codes = keycode.codes,
|
|
104
|
-
down = _keycode$codes.down,
|
|
105
|
-
up = _keycode$codes.up,
|
|
106
|
-
tab = _keycode$codes.tab,
|
|
107
|
-
left = _keycode$codes.left;
|
|
108
|
-
const pgdn = keycode.codes['page down'];
|
|
109
|
-
const pgup = keycode.codes['page up'];
|
|
110
|
-
if (key === down || key === pgdn) {
|
|
111
|
-
event.preventDefault();
|
|
112
|
-
event.stopPropagation();
|
|
113
|
-
this.moveFocus(1);
|
|
114
|
-
this.hideActiveSubMenu(event);
|
|
115
|
-
} else if (key === up || key === pgup) {
|
|
116
|
-
event.preventDefault();
|
|
117
|
-
event.stopPropagation();
|
|
118
|
-
this.moveFocus(-1);
|
|
119
|
-
this.hideActiveSubMenu(event);
|
|
120
|
-
} else if (key === tab || key === left) {
|
|
121
|
-
event.persist();
|
|
122
|
-
this.hide(event);
|
|
123
|
-
}
|
|
124
|
-
if (typeof this.props.onKeyDown === 'function') {
|
|
125
|
-
this.props.onKeyDown(event);
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
this.handleMenuItemSelect = (event, value, selected, item) => {
|
|
129
|
-
if (this.props.shouldHideOnSelect) {
|
|
130
|
-
this.hide(event);
|
|
131
|
-
}
|
|
132
|
-
if (typeof this.props.onSelect === 'function') {
|
|
133
|
-
this.props.onSelect(event, value, selected, item);
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
this.handleMenuItemFocus = () => {
|
|
137
|
-
this.setState({
|
|
138
|
-
hasFocus: true
|
|
139
|
-
});
|
|
140
|
-
};
|
|
141
|
-
this.handleMenuItemBlur = () => {
|
|
142
|
-
this.setState({
|
|
143
|
-
hasFocus: this.focusedIndex >= 0
|
|
144
|
-
});
|
|
145
|
-
};
|
|
146
|
-
this.handleMenuItemMouseOver = (event, menuItem) => {
|
|
147
|
-
if (this._activeSubMenu && menuItem !== this._activeSubMenu._trigger) {
|
|
148
|
-
this.hideActiveSubMenu(event);
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
this.hideActiveSubMenu = event => {
|
|
152
|
-
if (this._activeSubMenu) {
|
|
153
|
-
this._activeSubMenu.hide(event);
|
|
154
|
-
this._activeSubMenu = null;
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
this.handleSubMenuToggle = (shown, subMenu) => {
|
|
158
|
-
if (shown) {
|
|
159
|
-
this._activeSubMenu = subMenu;
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
this.handleSubMenuDismiss = (event, documentClick) => {
|
|
163
|
-
if (event && event.keyCode === keycode.codes.tab || documentClick) {
|
|
164
|
-
this.hide(event);
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
this.hide = event => {
|
|
168
|
-
if (this._popover) {
|
|
169
|
-
this._popover.hide(event);
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
this.show = event => {
|
|
173
|
-
if (this._popover) {
|
|
174
|
-
this._popover.show(event);
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
94
|
this._id = this.props.id || props.deterministicId();
|
|
178
95
|
}
|
|
179
96
|
componentDidMount() {
|
|
180
|
-
|
|
181
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
97
|
+
this.props.makeStyles?.();
|
|
182
98
|
}
|
|
183
99
|
componentDidUpdate() {
|
|
184
|
-
|
|
185
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
100
|
+
this.props.makeStyles?.();
|
|
186
101
|
}
|
|
102
|
+
static contextType = MenuContext;
|
|
103
|
+
registerMenuItem = item => {
|
|
104
|
+
this._menuItems.push(item);
|
|
105
|
+
};
|
|
106
|
+
removeMenuItem = item => {
|
|
107
|
+
const index = this.getMenuItemIndex(item);
|
|
108
|
+
error(index >= 0, '[Menu] Could not find registered menu item.');
|
|
109
|
+
if (index >= 0) {
|
|
110
|
+
this._menuItems.splice(index, 1);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
187
113
|
get menuItems() {
|
|
188
114
|
return this._menuItems;
|
|
189
115
|
}
|
|
116
|
+
getMenuItemIndex = item => {
|
|
117
|
+
return this._menuItems.findIndex(i => i === item);
|
|
118
|
+
};
|
|
119
|
+
handleTriggerKeyDown = event => {
|
|
120
|
+
if (this.props.type === 'flyout' && event.keyCode === keycode.codes.right) {
|
|
121
|
+
event.persist();
|
|
122
|
+
this.show(event);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
handleTriggerMouseOver = event => {
|
|
126
|
+
if (this.props.type === 'flyout') {
|
|
127
|
+
this.show(event);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
handleToggle = shown => {
|
|
131
|
+
if (typeof this.props.onToggle === 'function') {
|
|
132
|
+
this.props.onToggle(shown, this);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
handleMenuKeyDown = event => {
|
|
136
|
+
const key = event && event.keyCode;
|
|
137
|
+
const {
|
|
138
|
+
down,
|
|
139
|
+
up,
|
|
140
|
+
tab,
|
|
141
|
+
left
|
|
142
|
+
} = keycode.codes;
|
|
143
|
+
const pgdn = keycode.codes['page down'];
|
|
144
|
+
const pgup = keycode.codes['page up'];
|
|
145
|
+
if (key === down || key === pgdn) {
|
|
146
|
+
event.preventDefault();
|
|
147
|
+
event.stopPropagation();
|
|
148
|
+
this.moveFocus(1);
|
|
149
|
+
this.hideActiveSubMenu(event);
|
|
150
|
+
} else if (key === up || key === pgup) {
|
|
151
|
+
event.preventDefault();
|
|
152
|
+
event.stopPropagation();
|
|
153
|
+
this.moveFocus(-1);
|
|
154
|
+
this.hideActiveSubMenu(event);
|
|
155
|
+
} else if (key === tab || key === left) {
|
|
156
|
+
event.persist();
|
|
157
|
+
this.hide(event);
|
|
158
|
+
}
|
|
159
|
+
if (typeof this.props.onKeyDown === 'function') {
|
|
160
|
+
this.props.onKeyDown(event);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
handleMenuItemSelect = (event, value, selected, item) => {
|
|
164
|
+
if (this.props.shouldHideOnSelect) {
|
|
165
|
+
this.hide(event);
|
|
166
|
+
}
|
|
167
|
+
if (typeof this.props.onSelect === 'function') {
|
|
168
|
+
this.props.onSelect(event, value, selected, item);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
handleMenuItemFocus = () => {
|
|
172
|
+
this.setState({
|
|
173
|
+
hasFocus: true
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
handleMenuItemBlur = () => {
|
|
177
|
+
this.setState({
|
|
178
|
+
hasFocus: this.focusedIndex >= 0
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
handleMenuItemMouseOver = (event, menuItem) => {
|
|
182
|
+
if (this._activeSubMenu && menuItem !== this._activeSubMenu._trigger) {
|
|
183
|
+
this.hideActiveSubMenu(event);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
hideActiveSubMenu = event => {
|
|
187
|
+
if (this._activeSubMenu) {
|
|
188
|
+
this._activeSubMenu.hide(event);
|
|
189
|
+
this._activeSubMenu = null;
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
handleSubMenuToggle = (shown, subMenu) => {
|
|
193
|
+
if (shown) {
|
|
194
|
+
this._activeSubMenu = subMenu;
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
handleSubMenuDismiss = (event, documentClick) => {
|
|
198
|
+
if (event && event.keyCode === keycode.codes.tab || documentClick) {
|
|
199
|
+
this.hide(event);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
hide = event => {
|
|
203
|
+
if (this._popover) {
|
|
204
|
+
this._popover.hide(event);
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
show = event => {
|
|
208
|
+
if (this._popover) {
|
|
209
|
+
this._popover.show(event);
|
|
210
|
+
}
|
|
211
|
+
};
|
|
190
212
|
focus() {
|
|
191
213
|
if (this.shown) {
|
|
192
|
-
|
|
193
|
-
error(!!((_this$_menu = this._menu) !== null && _this$_menu !== void 0 && _this$_menu.focus), '[Menu] Could not focus the menu.');
|
|
214
|
+
error(!!this._menu?.focus, '[Menu] Could not focus the menu.');
|
|
194
215
|
this._menu.focus();
|
|
195
216
|
} else {
|
|
196
|
-
|
|
197
|
-
error(!!((_this$_trigger = this._trigger) !== null && _this$_trigger !== void 0 && _this$_trigger.focus), '[Menu] Could not focus the trigger.');
|
|
217
|
+
error(!!this._trigger?.focus, '[Menu] Could not focus the trigger.');
|
|
198
218
|
this._trigger.focus();
|
|
199
219
|
}
|
|
200
220
|
}
|
|
@@ -224,9 +244,10 @@ let Menu = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gener
|
|
|
224
244
|
return this._popover ? this._popover.shown : true;
|
|
225
245
|
}
|
|
226
246
|
renderChildren() {
|
|
227
|
-
const
|
|
228
|
-
children
|
|
229
|
-
disabled
|
|
247
|
+
const {
|
|
248
|
+
children,
|
|
249
|
+
disabled
|
|
250
|
+
} = this.props;
|
|
230
251
|
let count = 0;
|
|
231
252
|
return Children.map(children, child => {
|
|
232
253
|
if (!matchComponentTypes(child, ['MenuItemSeparator', 'MenuItem', 'MenuItemGroup', 'Menu'])) {
|
|
@@ -292,12 +313,12 @@ let Menu = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gener
|
|
|
292
313
|
});
|
|
293
314
|
}
|
|
294
315
|
renderMenu() {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
316
|
+
const {
|
|
317
|
+
disabled,
|
|
318
|
+
label,
|
|
319
|
+
trigger,
|
|
320
|
+
onKeyUp
|
|
321
|
+
} = this.props;
|
|
301
322
|
const labelledBy = this.props['aria-labelledby'];
|
|
302
323
|
const controls = this.props['aria-controls'];
|
|
303
324
|
return _jsx(MenuContext.Provider, {
|
|
@@ -309,10 +330,10 @@ let Menu = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gener
|
|
|
309
330
|
role: "menu",
|
|
310
331
|
"aria-label": label,
|
|
311
332
|
tabIndex: 0,
|
|
312
|
-
css:
|
|
313
|
-
"aria-labelledby": labelledBy || (trigger ? this._labelId :
|
|
333
|
+
css: this.props.styles?.menu,
|
|
334
|
+
"aria-labelledby": labelledBy || (trigger ? this._labelId : undefined),
|
|
314
335
|
"aria-controls": controls,
|
|
315
|
-
"aria-disabled": disabled ? 'true' :
|
|
336
|
+
"aria-disabled": disabled ? 'true' : undefined,
|
|
316
337
|
onKeyDown: this.handleMenuKeyDown,
|
|
317
338
|
onKeyUp: onKeyUp,
|
|
318
339
|
ref: this.handleRef,
|
|
@@ -322,21 +343,22 @@ let Menu = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gener
|
|
|
322
343
|
});
|
|
323
344
|
}
|
|
324
345
|
render() {
|
|
325
|
-
const
|
|
326
|
-
show
|
|
327
|
-
defaultShow
|
|
328
|
-
placement
|
|
329
|
-
withArrow
|
|
330
|
-
trigger
|
|
331
|
-
mountNode
|
|
332
|
-
popoverRef
|
|
333
|
-
disabled
|
|
334
|
-
onDismiss
|
|
335
|
-
onFocus
|
|
336
|
-
onMouseOver
|
|
337
|
-
positionContainerDisplay
|
|
338
|
-
offsetX
|
|
339
|
-
offsetY
|
|
346
|
+
const {
|
|
347
|
+
show,
|
|
348
|
+
defaultShow,
|
|
349
|
+
placement,
|
|
350
|
+
withArrow,
|
|
351
|
+
trigger,
|
|
352
|
+
mountNode,
|
|
353
|
+
popoverRef,
|
|
354
|
+
disabled,
|
|
355
|
+
onDismiss,
|
|
356
|
+
onFocus,
|
|
357
|
+
onMouseOver,
|
|
358
|
+
positionContainerDisplay,
|
|
359
|
+
offsetX,
|
|
360
|
+
offsetY
|
|
361
|
+
} = this.props;
|
|
340
362
|
return trigger ? _jsx(Popover, {
|
|
341
363
|
"data-cid": "Menu",
|
|
342
364
|
isShowingContent: show,
|
|
@@ -381,26 +403,10 @@ let Menu = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gener
|
|
|
381
403
|
onKeyDown: this.handleTriggerKeyDown,
|
|
382
404
|
disabled: trigger.props.disabled || disabled
|
|
383
405
|
}),
|
|
384
|
-
defaultFocusElement: () =>
|
|
385
|
-
var _this$_popover, _this$_popover$_conte;
|
|
386
|
-
return (_this$_popover = this._popover) === null || _this$_popover === void 0 ? void 0 : (_this$_popover$_conte = _this$_popover._contentElement) === null || _this$_popover$_conte === void 0 ? void 0 : _this$_popover$_conte.querySelector('[class$="menuItem"]');
|
|
387
|
-
},
|
|
406
|
+
defaultFocusElement: () => this._popover?._contentElement?.querySelector('[class$="menuItem"]'),
|
|
388
407
|
children: this.renderMenu()
|
|
389
408
|
}) : this.renderMenu();
|
|
390
409
|
}
|
|
391
|
-
}
|
|
392
|
-
label: null,
|
|
393
|
-
disabled: false,
|
|
394
|
-
trigger: null,
|
|
395
|
-
placement: 'bottom center',
|
|
396
|
-
defaultShow: false,
|
|
397
|
-
mountNode: null,
|
|
398
|
-
constrain: 'window',
|
|
399
|
-
shouldHideOnSelect: true,
|
|
400
|
-
shouldFocusTriggerOnClose: true,
|
|
401
|
-
withArrow: true,
|
|
402
|
-
offsetX: 0,
|
|
403
|
-
offsetY: 0
|
|
404
|
-
}, _Menu.Item = MenuItem, _Menu.Group = MenuItemGroup, _Menu.Separator = MenuItemSeparator, _Menu.contextType = MenuContext, _Menu)) || _class) || _class);
|
|
410
|
+
}) || _class) || _class);
|
|
405
411
|
export default Menu;
|
|
406
412
|
export { Menu, MenuItem, MenuItemGroup, MenuItemSeparator };
|
package/es/Menu/v1/theme.js
CHANGED
|
@@ -28,19 +28,20 @@
|
|
|
28
28
|
* @return {Object} The final theme object with the overrides and component variables
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
breakpoints
|
|
34
|
-
borders
|
|
31
|
+
const {
|
|
32
|
+
colors,
|
|
33
|
+
breakpoints,
|
|
34
|
+
borders
|
|
35
|
+
} = theme;
|
|
35
36
|
const componentVariables = {
|
|
36
|
-
minWidth: breakpoints
|
|
37
|
-
maxWidth: breakpoints
|
|
38
|
-
background: colors
|
|
39
|
-
borderRadius: borders
|
|
40
|
-
focusBorderStyle: borders
|
|
41
|
-
focusBorderWidth: borders
|
|
42
|
-
focusBorderColor: colors
|
|
43
|
-
focusBorderRadius: borders
|
|
37
|
+
minWidth: breakpoints?.xxSmall,
|
|
38
|
+
maxWidth: breakpoints?.xSmall,
|
|
39
|
+
background: colors?.contrasts?.white1010,
|
|
40
|
+
borderRadius: borders?.radiusMedium,
|
|
41
|
+
focusBorderStyle: borders?.style,
|
|
42
|
+
focusBorderWidth: borders?.widthMedium,
|
|
43
|
+
focusBorderColor: colors?.contrasts?.blue4570,
|
|
44
|
+
focusBorderRadius: borders?.radiusMedium
|
|
44
45
|
};
|
|
45
46
|
return {
|
|
46
47
|
...componentVariables
|