@instructure/ui-menu 8.33.1 → 8.33.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/CHANGELOG.md +4 -0
- package/es/Menu/MenuItem/MenuItemLocator.js +2 -1
- package/es/Menu/MenuItem/index.js +12 -53
- package/es/Menu/MenuItem/locator.js +1 -0
- package/es/Menu/MenuItem/props.js +1 -0
- package/es/Menu/MenuItem/styles.js +1 -2
- package/es/Menu/MenuItem/theme.js +5 -5
- package/es/Menu/MenuItemGroup/MenuItemGroupLocator.js +2 -1
- package/es/Menu/MenuItemGroup/index.js +6 -29
- package/es/Menu/MenuItemGroup/props.js +1 -0
- package/es/Menu/MenuItemGroup/styles.js +0 -1
- package/es/Menu/MenuItemGroup/theme.js +5 -5
- package/es/Menu/MenuItemSeparator/index.js +0 -10
- package/es/Menu/MenuItemSeparator/props.js +2 -0
- package/es/Menu/MenuItemSeparator/styles.js +0 -1
- package/es/Menu/MenuItemSeparator/theme.js +4 -4
- package/es/Menu/MenuLocator.js +12 -9
- package/es/Menu/index.js +26 -85
- package/es/Menu/locator.js +1 -0
- package/es/Menu/props.js +1 -0
- package/es/Menu/styles.js +0 -1
- package/es/Menu/theme.js +4 -4
- package/es/MenuContext.js +1 -1
- package/lib/Menu/MenuItem/MenuItemLocator.js +1 -3
- package/lib/Menu/MenuItem/index.js +12 -70
- package/lib/Menu/MenuItem/locator.js +0 -2
- package/lib/Menu/MenuItem/props.js +1 -4
- package/lib/Menu/MenuItem/styles.js +1 -3
- package/lib/Menu/MenuItem/theme.js +5 -6
- package/lib/Menu/MenuItemGroup/MenuItemGroupLocator.js +1 -4
- package/lib/Menu/MenuItemGroup/index.js +6 -45
- package/lib/Menu/MenuItemGroup/locator.js +0 -2
- package/lib/Menu/MenuItemGroup/props.js +1 -7
- package/lib/Menu/MenuItemGroup/styles.js +0 -2
- package/lib/Menu/MenuItemGroup/theme.js +5 -6
- package/lib/Menu/MenuItemSeparator/index.js +0 -18
- package/lib/Menu/MenuItemSeparator/props.js +2 -1
- package/lib/Menu/MenuItemSeparator/styles.js +0 -2
- package/lib/Menu/MenuItemSeparator/theme.js +4 -5
- package/lib/Menu/MenuLocator.js +11 -14
- package/lib/Menu/index.js +26 -103
- package/lib/Menu/locator.js +0 -2
- package/lib/Menu/props.js +1 -6
- package/lib/Menu/styles.js +0 -2
- package/lib/Menu/theme.js +4 -5
- package/lib/MenuContext.js +0 -2
- package/lib/index.js +0 -1
- package/package.json +19 -19
- package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [8.33.2](https://github.com/instructure/instructure-ui/compare/v8.33.1...v8.33.2) (2023-01-25)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-menu
|
|
9
|
+
|
|
6
10
|
## [8.33.1](https://github.com/instructure/instructure-ui/compare/v8.33.0...v8.33.1) (2023-01-06)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @instructure/ui-menu
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
import { locator } from '@instructure/ui-test-locator';
|
|
25
|
-
import { MenuItem } from './index';
|
|
25
|
+
import { MenuItem } from './index';
|
|
26
26
|
|
|
27
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
27
28
|
export const MenuItemLocator = locator(MenuItem.selector);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var _dec, _dec2, _dec3, _class, _class2, _IconCheckSolid, _IconArrowOpenEndSoli;
|
|
2
|
-
|
|
3
2
|
/*
|
|
4
3
|
* The MIT License (MIT)
|
|
5
4
|
*
|
|
@@ -23,7 +22,6 @@ var _dec, _dec2, _dec3, _class, _class2, _IconCheckSolid, _IconArrowOpenEndSoli;
|
|
|
23
22
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
23
|
* SOFTWARE.
|
|
25
24
|
*/
|
|
26
|
-
|
|
27
25
|
/** @jsx jsx */
|
|
28
26
|
import React, { Component } from 'react';
|
|
29
27
|
import keycode from 'keycode';
|
|
@@ -37,7 +35,6 @@ import { MenuContext } from '../../MenuContext';
|
|
|
37
35
|
import generateStyle from './styles';
|
|
38
36
|
import generateComponentTheme from './theme';
|
|
39
37
|
import { propTypes, allowedProps } from './props';
|
|
40
|
-
|
|
41
38
|
/**
|
|
42
39
|
---
|
|
43
40
|
parent: Menu
|
|
@@ -50,48 +47,39 @@ let MenuItem = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, g
|
|
|
50
47
|
super(props);
|
|
51
48
|
this.labelId = void 0;
|
|
52
49
|
this.ref = null;
|
|
53
|
-
|
|
54
50
|
this.handleRef = el => {
|
|
55
51
|
this.ref = el;
|
|
56
52
|
};
|
|
57
|
-
|
|
58
53
|
this.handleClick = e => {
|
|
59
54
|
const _this$props = this.props,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
onSelect = _this$props.onSelect,
|
|
56
|
+
onClick = _this$props.onClick,
|
|
57
|
+
disabled = _this$props.disabled,
|
|
58
|
+
value = _this$props.value;
|
|
64
59
|
const selected = !this.selected;
|
|
65
|
-
|
|
66
60
|
if (disabled) {
|
|
67
61
|
e.preventDefault();
|
|
68
62
|
return;
|
|
69
63
|
}
|
|
70
|
-
|
|
71
64
|
if (typeof this.props.selected === 'undefined') {
|
|
72
65
|
this.setState({
|
|
73
66
|
selected
|
|
74
67
|
});
|
|
75
68
|
}
|
|
76
|
-
|
|
77
69
|
if (typeof onSelect === 'function') {
|
|
78
70
|
e.persist();
|
|
79
71
|
onSelect(e, value, selected, this);
|
|
80
72
|
}
|
|
81
|
-
|
|
82
73
|
if (typeof onClick === 'function') {
|
|
83
74
|
onClick(e);
|
|
84
75
|
}
|
|
85
76
|
};
|
|
86
|
-
|
|
87
77
|
this.handleKeyDown = e => {
|
|
88
78
|
const spaceKey = e.keyCode === keycode.codes.space;
|
|
89
79
|
const enterKey = e.keyCode === keycode.codes.enter;
|
|
90
|
-
|
|
91
80
|
if (spaceKey || enterKey) {
|
|
92
81
|
e.preventDefault();
|
|
93
82
|
e.stopPropagation();
|
|
94
|
-
|
|
95
83
|
if (enterKey) {
|
|
96
84
|
// handle space key on keyUp for FF
|
|
97
85
|
const refNode = findDOMNode(this.ref);
|
|
@@ -99,107 +87,82 @@ let MenuItem = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, g
|
|
|
99
87
|
}
|
|
100
88
|
}
|
|
101
89
|
};
|
|
102
|
-
|
|
103
90
|
this.handleKeyUp = e => {
|
|
104
91
|
const spaceKey = e.keyCode === keycode.codes.space;
|
|
105
92
|
const enterKey = e.keyCode === keycode.codes.enter;
|
|
106
|
-
|
|
107
93
|
if (spaceKey || enterKey) {
|
|
108
94
|
e.preventDefault();
|
|
109
95
|
e.stopPropagation();
|
|
110
|
-
|
|
111
96
|
if (spaceKey) {
|
|
112
97
|
const refNode = findDOMNode(this.ref);
|
|
113
98
|
refNode.click();
|
|
114
99
|
}
|
|
115
100
|
}
|
|
116
101
|
};
|
|
117
|
-
|
|
118
102
|
this.handleMouseOver = event => {
|
|
119
103
|
this.focus();
|
|
120
|
-
|
|
121
104
|
if (typeof this.props.onMouseOver === 'function') {
|
|
122
105
|
this.props.onMouseOver(event, this);
|
|
123
106
|
}
|
|
124
107
|
};
|
|
125
|
-
|
|
126
108
|
if (typeof props.selected === 'undefined') {
|
|
127
109
|
this.state = {
|
|
128
110
|
selected: !!props.defaultSelected
|
|
129
111
|
};
|
|
130
112
|
}
|
|
131
|
-
|
|
132
113
|
this.labelId = props.deterministicId('MenuItem__label');
|
|
133
114
|
}
|
|
134
|
-
|
|
135
115
|
get _node() {
|
|
136
116
|
return this.ref;
|
|
137
117
|
}
|
|
138
|
-
|
|
139
118
|
componentDidMount() {
|
|
140
119
|
var _this$props$makeStyle, _this$props2;
|
|
141
|
-
|
|
142
120
|
(_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
|
|
143
121
|
const context = this.context;
|
|
144
|
-
|
|
145
122
|
if (context && context.registerMenuItem) {
|
|
146
123
|
context.registerMenuItem(this);
|
|
147
124
|
}
|
|
148
125
|
}
|
|
149
|
-
|
|
150
126
|
componentDidUpdate() {
|
|
151
127
|
var _this$props$makeStyle2, _this$props3;
|
|
152
|
-
|
|
153
128
|
(_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
|
|
154
129
|
}
|
|
155
|
-
|
|
156
130
|
componentWillUnmount() {
|
|
157
131
|
const context = this.context;
|
|
158
|
-
|
|
159
132
|
if (context && context.removeMenuItem) {
|
|
160
133
|
context.removeMenuItem(this);
|
|
161
134
|
}
|
|
162
135
|
}
|
|
163
|
-
|
|
164
136
|
get elementType() {
|
|
165
137
|
return getElementType(MenuItem, this.props);
|
|
166
138
|
}
|
|
167
|
-
|
|
168
139
|
get role() {
|
|
169
140
|
switch (this.props.type) {
|
|
170
141
|
case 'checkbox':
|
|
171
142
|
return 'menuitemcheckbox';
|
|
172
|
-
|
|
173
143
|
case 'radio':
|
|
174
144
|
return 'menuitemradio';
|
|
175
|
-
|
|
176
145
|
case 'flyout':
|
|
177
146
|
return 'button';
|
|
178
|
-
|
|
179
147
|
default:
|
|
180
148
|
return 'menuitem';
|
|
181
149
|
}
|
|
182
150
|
}
|
|
183
|
-
|
|
184
151
|
get selected() {
|
|
185
152
|
return typeof this.props.selected === 'undefined' ? this.state.selected : this.props.selected;
|
|
186
153
|
}
|
|
187
|
-
|
|
188
154
|
get focused() {
|
|
189
155
|
return isActiveElement(this.ref);
|
|
190
156
|
}
|
|
191
|
-
|
|
192
157
|
focus() {
|
|
193
158
|
const refNode = findDOMNode(this.ref);
|
|
194
159
|
refNode.focus();
|
|
195
160
|
}
|
|
196
|
-
|
|
197
161
|
renderContent() {
|
|
198
162
|
var _this$props$styles, _this$props$styles2, _this$props$styles3;
|
|
199
|
-
|
|
200
163
|
const _this$props4 = this.props,
|
|
201
|
-
|
|
202
|
-
|
|
164
|
+
children = _this$props4.children,
|
|
165
|
+
type = _this$props4.type;
|
|
203
166
|
return jsx("span", null, (type === 'checkbox' || type === 'radio') && jsx("span", {
|
|
204
167
|
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.icon
|
|
205
168
|
}, this.selected && (_IconCheckSolid || (_IconCheckSolid = jsx(IconCheckSolid, null)))), jsx("span", {
|
|
@@ -209,22 +172,19 @@ let MenuItem = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, g
|
|
|
209
172
|
css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.icon
|
|
210
173
|
}, _IconArrowOpenEndSoli || (_IconArrowOpenEndSoli = jsx(IconArrowOpenEndSolid, null))));
|
|
211
174
|
}
|
|
212
|
-
|
|
213
175
|
render() {
|
|
214
176
|
var _this$props$styles4;
|
|
215
|
-
|
|
216
177
|
const _this$props5 = this.props,
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
178
|
+
disabled = _this$props5.disabled,
|
|
179
|
+
controls = _this$props5.controls,
|
|
180
|
+
onKeyDown = _this$props5.onKeyDown,
|
|
181
|
+
onKeyUp = _this$props5.onKeyUp,
|
|
182
|
+
type = _this$props5.type,
|
|
183
|
+
href = _this$props5.href;
|
|
223
184
|
const props = omitProps(this.props, MenuItem.allowedProps);
|
|
224
185
|
const ElementType = this.elementType;
|
|
225
186
|
return jsx(ElementType, Object.assign({
|
|
226
187
|
tabIndex: -1 // note: tabIndex can be overridden by Menu or MenuItemGroup components
|
|
227
|
-
|
|
228
188
|
}, props, {
|
|
229
189
|
href: href,
|
|
230
190
|
role: this.role,
|
|
@@ -240,7 +200,6 @@ let MenuItem = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, g
|
|
|
240
200
|
onMouseOver: this.handleMouseOver
|
|
241
201
|
}), this.renderContent());
|
|
242
202
|
}
|
|
243
|
-
|
|
244
203
|
}, _class2.displayName = "MenuItem", _class2.componentId = 'Menu.Item', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
245
204
|
type: 'button',
|
|
246
205
|
disabled: false
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
*/
|
|
35
35
|
const generateStyle = (componentTheme, props) => {
|
|
36
36
|
const type = props.type,
|
|
37
|
-
|
|
37
|
+
disabled = props.disabled;
|
|
38
38
|
const isRadioOrCheckbox = type === 'checkbox' || type === 'radio';
|
|
39
39
|
const flyoutIconStyles = type === 'flyout' ? {
|
|
40
40
|
insetInlineStart: 'auto',
|
|
@@ -124,5 +124,4 @@ const generateStyle = (componentTheme, props) => {
|
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
126
|
};
|
|
127
|
-
|
|
128
127
|
export default generateStyle;
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
31
|
const colors = theme.colors,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
typography = theme.typography,
|
|
33
|
+
spacing = theme.spacing,
|
|
34
|
+
themeName = theme.key;
|
|
35
35
|
const themeSpecificStyle = {
|
|
36
36
|
canvas: {
|
|
37
37
|
labelColor: theme['ic-brand-font-color-dark'],
|
|
@@ -54,9 +54,9 @@ const generateComponentTheme = theme => {
|
|
|
54
54
|
activeLabelColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
|
|
55
55
|
activeIconColor: colors === null || colors === void 0 ? void 0 : colors.textLightest
|
|
56
56
|
};
|
|
57
|
-
return {
|
|
57
|
+
return {
|
|
58
|
+
...componentVariables,
|
|
58
59
|
...themeSpecificStyle[themeName]
|
|
59
60
|
};
|
|
60
61
|
};
|
|
61
|
-
|
|
62
62
|
export default generateComponentTheme;
|
|
@@ -23,8 +23,9 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import { locator } from '@instructure/ui-test-locator';
|
|
25
25
|
import { MenuItemGroup } from './index';
|
|
26
|
-
import { MenuItemLocator } from '../MenuItem/MenuItemLocator';
|
|
26
|
+
import { MenuItemLocator } from '../MenuItem/MenuItemLocator';
|
|
27
27
|
|
|
28
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
28
29
|
export const MenuItemGroupLocator = locator(MenuItemGroup.selector, {
|
|
29
30
|
findAllItems: function () {
|
|
30
31
|
return MenuItemLocator.findAll(...arguments);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var _dec, _dec2, _dec3, _class, _class2;
|
|
2
|
-
|
|
3
2
|
/*
|
|
4
3
|
* The MIT License (MIT)
|
|
5
4
|
*
|
|
@@ -34,7 +33,6 @@ import { MenuItem } from '../MenuItem';
|
|
|
34
33
|
import generateStyle from './styles';
|
|
35
34
|
import generateComponentTheme from './theme';
|
|
36
35
|
import { propTypes, allowedProps } from './props';
|
|
37
|
-
|
|
38
36
|
/**
|
|
39
37
|
---
|
|
40
38
|
parent: Menu
|
|
@@ -47,17 +45,14 @@ let MenuItemGroup = (_dec = withDeterministicId(), _dec2 = withStyle(generateSty
|
|
|
47
45
|
super(props);
|
|
48
46
|
this._labelId = void 0;
|
|
49
47
|
this.ref = null;
|
|
50
|
-
|
|
51
48
|
this.handleRef = el => {
|
|
52
49
|
this.ref = el;
|
|
53
50
|
};
|
|
54
|
-
|
|
55
51
|
this.handleSelect = (e, value, selected, item) => {
|
|
56
52
|
if (this.props.disabled) {
|
|
57
53
|
e.preventDefault();
|
|
58
54
|
return;
|
|
59
55
|
}
|
|
60
|
-
|
|
61
56
|
if (this.props.selected) {
|
|
62
57
|
this.updateSelected(e, value, this.props.selected, selected, item);
|
|
63
58
|
} else {
|
|
@@ -68,12 +63,10 @@ let MenuItemGroup = (_dec = withDeterministicId(), _dec2 = withStyle(generateSty
|
|
|
68
63
|
});
|
|
69
64
|
}
|
|
70
65
|
};
|
|
71
|
-
|
|
72
66
|
this.updateSelected = (e, value, items, selected, item) => {
|
|
73
67
|
const allowMultiple = this.props.allowMultiple;
|
|
74
68
|
let updated = allowMultiple ? [...items] : [];
|
|
75
69
|
const location = updated.indexOf(value);
|
|
76
|
-
|
|
77
70
|
if (selected === true && location < 0) {
|
|
78
71
|
updated.push(value);
|
|
79
72
|
} else if (selected === false && location !== -1) {
|
|
@@ -82,38 +75,29 @@ let MenuItemGroup = (_dec = withDeterministicId(), _dec2 = withStyle(generateSty
|
|
|
82
75
|
// don't allow nothing selected if it's not allowMultiple/checkbox
|
|
83
76
|
updated = [...items];
|
|
84
77
|
}
|
|
85
|
-
|
|
86
78
|
if (typeof this.props.onSelect === 'function') {
|
|
87
79
|
this.props.onSelect(e, updated, selected, item);
|
|
88
80
|
}
|
|
89
|
-
|
|
90
81
|
return updated;
|
|
91
82
|
};
|
|
92
|
-
|
|
93
83
|
if (typeof props.selected === 'undefined') {
|
|
94
84
|
this.state = {
|
|
95
85
|
selected: this.selectedFromChildren(props) || props.defaultSelected
|
|
96
86
|
};
|
|
97
87
|
}
|
|
98
|
-
|
|
99
88
|
this._labelId = props.deterministicId('MenuItemGroup');
|
|
100
89
|
}
|
|
101
|
-
|
|
102
90
|
componentDidMount() {
|
|
103
91
|
var _this$props$makeStyle, _this$props;
|
|
104
|
-
|
|
105
92
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
106
93
|
}
|
|
107
|
-
|
|
108
94
|
componentDidUpdate() {
|
|
109
95
|
var _this$props$makeStyle2, _this$props2;
|
|
110
|
-
|
|
111
96
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
112
97
|
}
|
|
113
|
-
|
|
114
98
|
selectedFromChildren(props) {
|
|
115
99
|
const children = props.children,
|
|
116
|
-
|
|
100
|
+
allowMultiple = props.allowMultiple;
|
|
117
101
|
const selected = [];
|
|
118
102
|
const items = Children.toArray(children).filter(child => {
|
|
119
103
|
return matchComponentTypes(child, [MenuItem]);
|
|
@@ -125,7 +109,6 @@ let MenuItemGroup = (_dec = withDeterministicId(), _dec2 = withStyle(generateSty
|
|
|
125
109
|
});
|
|
126
110
|
return selected.length > 0 ? selected : null;
|
|
127
111
|
}
|
|
128
|
-
|
|
129
112
|
get selected() {
|
|
130
113
|
if (typeof this.props.selected === 'undefined' && typeof this.state.selected === 'undefined') {
|
|
131
114
|
return [];
|
|
@@ -133,23 +116,20 @@ let MenuItemGroup = (_dec = withDeterministicId(), _dec2 = withStyle(generateSty
|
|
|
133
116
|
return typeof this.props.selected === 'undefined' ? [...this.state.selected] : [...this.props.selected];
|
|
134
117
|
}
|
|
135
118
|
}
|
|
136
|
-
|
|
137
119
|
renderLabel() {
|
|
138
120
|
var _this$props$styles;
|
|
139
|
-
|
|
140
121
|
const label = this.props.label;
|
|
141
122
|
return hasVisibleChildren(label) ? jsx("span", {
|
|
142
123
|
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.label
|
|
143
124
|
}, label) : label;
|
|
144
125
|
}
|
|
145
|
-
|
|
146
126
|
renderChildren() {
|
|
147
127
|
const _this$props3 = this.props,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
128
|
+
disabled = _this$props3.disabled,
|
|
129
|
+
controls = _this$props3.controls,
|
|
130
|
+
allowMultiple = _this$props3.allowMultiple,
|
|
131
|
+
isTabbable = _this$props3.isTabbable,
|
|
132
|
+
onMouseOver = _this$props3.onMouseOver;
|
|
153
133
|
const children = this.props.children;
|
|
154
134
|
let index = -1;
|
|
155
135
|
return Children.map(children, child => {
|
|
@@ -175,10 +155,8 @@ let MenuItemGroup = (_dec = withDeterministicId(), _dec2 = withStyle(generateSty
|
|
|
175
155
|
}
|
|
176
156
|
});
|
|
177
157
|
}
|
|
178
|
-
|
|
179
158
|
render() {
|
|
180
159
|
var _this$props$styles2, _this$props$styles3;
|
|
181
|
-
|
|
182
160
|
const props = omitProps(this.props, MenuItemGroup.allowedProps);
|
|
183
161
|
return jsx("span", Object.assign({}, props, {
|
|
184
162
|
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.menuItemGroup,
|
|
@@ -193,7 +171,6 @@ let MenuItemGroup = (_dec = withDeterministicId(), _dec2 = withStyle(generateSty
|
|
|
193
171
|
"aria-labelledby": this._labelId
|
|
194
172
|
}, this.renderChildren()));
|
|
195
173
|
}
|
|
196
|
-
|
|
197
174
|
}, _class2.displayName = "MenuItemGroup", _class2.componentId = 'Menu.Group', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
198
175
|
disabled: false,
|
|
199
176
|
children: null,
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
import PropTypes from 'prop-types';
|
|
25
26
|
import { controllable, Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
|
|
26
27
|
import { MenuItem } from '../MenuItem';
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
31
|
const colors = theme.colors,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
spacing = theme.spacing,
|
|
33
|
+
typography = theme.typography,
|
|
34
|
+
themeName = theme.key;
|
|
35
35
|
const themeSpecificStyle = {
|
|
36
36
|
canvas: {
|
|
37
37
|
color: theme['ic-brand-font-color-dark']
|
|
@@ -45,9 +45,9 @@ const generateComponentTheme = theme => {
|
|
|
45
45
|
color: colors === null || colors === void 0 ? void 0 : colors.textDarkest,
|
|
46
46
|
background: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest
|
|
47
47
|
};
|
|
48
|
-
return {
|
|
48
|
+
return {
|
|
49
|
+
...componentVariables,
|
|
49
50
|
...themeSpecificStyle[themeName]
|
|
50
51
|
};
|
|
51
52
|
};
|
|
52
|
-
|
|
53
53
|
export default generateComponentTheme;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var _dec, _dec2, _class, _class2;
|
|
2
|
-
|
|
3
2
|
/*
|
|
4
3
|
* The MIT License (MIT)
|
|
5
4
|
*
|
|
@@ -32,7 +31,6 @@ import { omitProps } from '@instructure/ui-react-utils';
|
|
|
32
31
|
import generateStyle from './styles';
|
|
33
32
|
import generateComponentTheme from './theme';
|
|
34
33
|
import { propTypes, allowedProps } from './props';
|
|
35
|
-
|
|
36
34
|
/**
|
|
37
35
|
---
|
|
38
36
|
parent: Menu
|
|
@@ -44,27 +42,20 @@ let MenuItemSeparator = (_dec = withStyle(generateStyle, generateComponentTheme)
|
|
|
44
42
|
constructor() {
|
|
45
43
|
super(...arguments);
|
|
46
44
|
this.ref = null;
|
|
47
|
-
|
|
48
45
|
this.handleRef = el => {
|
|
49
46
|
this.ref = el;
|
|
50
47
|
};
|
|
51
48
|
}
|
|
52
|
-
|
|
53
49
|
componentDidMount() {
|
|
54
50
|
var _this$props$makeStyle, _this$props;
|
|
55
|
-
|
|
56
51
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
57
52
|
}
|
|
58
|
-
|
|
59
53
|
componentDidUpdate() {
|
|
60
54
|
var _this$props$makeStyle2, _this$props2;
|
|
61
|
-
|
|
62
55
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
63
56
|
}
|
|
64
|
-
|
|
65
57
|
render() {
|
|
66
58
|
var _this$props$styles;
|
|
67
|
-
|
|
68
59
|
const props = omitProps(this.props, MenuItemSeparator.allowedProps);
|
|
69
60
|
return jsx("div", Object.assign({}, props, {
|
|
70
61
|
role: "presentation",
|
|
@@ -72,7 +63,6 @@ let MenuItemSeparator = (_dec = withStyle(generateStyle, generateComponentTheme)
|
|
|
72
63
|
ref: this.handleRef
|
|
73
64
|
}));
|
|
74
65
|
}
|
|
75
|
-
|
|
76
66
|
}, _class2.displayName = "MenuItemSeparator", _class2.componentId = 'Menu.Separator', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2)) || _class) || _class);
|
|
77
67
|
export default MenuItemSeparator;
|
|
78
68
|
export { MenuItemSeparator };
|
|
@@ -21,8 +21,10 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
// keeping here to keep the structure of props.ts
|
|
25
26
|
// eslint-disable-next-line
|
|
27
|
+
|
|
26
28
|
const propTypes = {};
|
|
27
29
|
const allowedProps = [];
|
|
28
30
|
export { propTypes, allowedProps };
|
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
31
|
const colors = theme.colors,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
spacing = theme.spacing,
|
|
33
|
+
borders = theme.borders;
|
|
34
34
|
const componentVariables = {
|
|
35
35
|
background: colors === null || colors === void 0 ? void 0 : colors.backgroundMedium,
|
|
36
36
|
height: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
|
|
37
37
|
margin: `0 ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`
|
|
38
38
|
};
|
|
39
|
-
return {
|
|
39
|
+
return {
|
|
40
|
+
...componentVariables
|
|
40
41
|
};
|
|
41
42
|
};
|
|
42
|
-
|
|
43
43
|
export default generateComponentTheme;
|
package/es/Menu/MenuLocator.js
CHANGED
|
@@ -22,9 +22,10 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
import { locator } from '@instructure/ui-test-locator';
|
|
25
|
-
import { parseQueryArguments } from '@instructure/ui-test-queries';
|
|
26
|
-
// eslint-disable-next-line no-restricted-imports
|
|
25
|
+
import { parseQueryArguments } from '@instructure/ui-test-queries';
|
|
27
26
|
|
|
27
|
+
// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module '@ins... Remove this comment to see the full error message
|
|
28
|
+
// eslint-disable-next-line no-restricted-imports
|
|
28
29
|
import { PopoverLocator } from '@instructure/ui-popover/es/Popover/PopoverLocator';
|
|
29
30
|
import { Menu } from './index';
|
|
30
31
|
import { MenuItemLocator } from './MenuItem/MenuItemLocator';
|
|
@@ -47,17 +48,19 @@ const customMethods = {
|
|
|
47
48
|
},
|
|
48
49
|
findPopoverContent: function () {
|
|
49
50
|
const _parseQueryArguments = parseQueryArguments(...arguments),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
customMethods: {
|
|
51
|
+
element = _parseQueryArguments.element,
|
|
52
|
+
selector = _parseQueryArguments.selector,
|
|
53
|
+
options = _parseQueryArguments.options;
|
|
54
|
+
return PopoverLocator.findContent(element, selector, {
|
|
55
|
+
...options,
|
|
56
|
+
customMethods: {
|
|
57
|
+
...options.customMethods,
|
|
56
58
|
...customMethods
|
|
57
59
|
}
|
|
58
60
|
});
|
|
59
61
|
}
|
|
60
|
-
};
|
|
62
|
+
};
|
|
61
63
|
|
|
64
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
62
65
|
const MenuLocator = locator(Menu.selector, customMethods);
|
|
63
66
|
export { MenuLocator, MenuItemLocator, MenuItemGroupLocator };
|