@instructure/ui-menu 8.8.0 → 8.8.1-snapshot.63
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/LICENSE.md +27 -0
- package/es/Menu/MenuItem/index.js +14 -60
- package/es/Menu/MenuItem/props.js +67 -0
- package/es/Menu/MenuItemGroup/index.js +10 -57
- package/es/Menu/MenuItemGroup/props.js +71 -0
- package/es/Menu/MenuItemSeparator/index.js +5 -8
- package/{src/Menu/MenuItemSeparator/types.ts → es/Menu/MenuItemSeparator/props.js} +5 -5
- package/es/Menu/index.js +5 -151
- package/es/Menu/props.js +167 -0
- package/lib/Menu/MenuItem/index.js +15 -62
- package/lib/Menu/MenuItem/props.js +79 -0
- package/lib/Menu/MenuItemGroup/index.js +11 -62
- package/lib/Menu/MenuItemGroup/props.js +87 -0
- package/lib/Menu/MenuItemSeparator/index.js +6 -9
- package/{src/Menu/MenuItemGroup/types.ts → lib/Menu/MenuItemSeparator/props.js} +13 -16
- package/lib/Menu/index.js +6 -156
- package/lib/Menu/props.js +182 -0
- package/package.json +22 -21
- package/src/Menu/MenuItem/index.tsx +14 -56
- package/src/Menu/MenuItem/props.ts +109 -0
- package/src/Menu/MenuItem/styles.ts +1 -1
- package/src/Menu/MenuItem/theme.ts +1 -1
- package/src/Menu/MenuItemGroup/index.tsx +9 -56
- package/src/Menu/MenuItemGroup/props.ts +110 -0
- package/src/Menu/MenuItemGroup/theme.ts +1 -1
- package/src/Menu/MenuItemSeparator/index.tsx +6 -9
- package/src/Menu/{MenuItem/types.ts → MenuItemSeparator/props.ts} +19 -19
- package/src/Menu/MenuItemSeparator/theme.ts +1 -1
- package/src/Menu/index.tsx +6 -139
- package/src/Menu/props.ts +235 -0
- package/src/Menu/theme.ts +1 -1
- package/src/index.ts +4 -4
- package/types/Menu/MenuItem/index.d.ts +37 -45
- package/types/Menu/MenuItem/index.d.ts.map +1 -1
- package/types/Menu/MenuItem/props.d.ts +27 -0
- package/types/Menu/MenuItem/props.d.ts.map +1 -0
- package/types/Menu/MenuItem/styles.d.ts +1 -1
- package/types/Menu/MenuItem/theme.d.ts +1 -1
- package/types/Menu/MenuItem/theme.d.ts.map +1 -1
- package/types/Menu/MenuItemGroup/index.d.ts +29 -46
- package/types/Menu/MenuItemGroup/index.d.ts.map +1 -1
- package/types/Menu/MenuItemGroup/props.d.ts +25 -0
- package/types/Menu/MenuItemGroup/props.d.ts.map +1 -0
- package/types/Menu/MenuItemGroup/theme.d.ts +1 -1
- package/types/Menu/MenuItemGroup/theme.d.ts.map +1 -1
- package/types/Menu/MenuItemSeparator/index.d.ts +3 -6
- package/types/Menu/MenuItemSeparator/index.d.ts.map +1 -1
- package/types/Menu/MenuItemSeparator/props.d.ts +11 -0
- package/types/Menu/MenuItemSeparator/props.d.ts.map +1 -0
- package/types/Menu/MenuItemSeparator/theme.d.ts +1 -1
- package/types/Menu/MenuItemSeparator/theme.d.ts.map +1 -1
- package/types/Menu/index.d.ts +60 -122
- package/types/Menu/index.d.ts.map +1 -1
- package/types/Menu/{types.d.ts → props.d.ts} +13 -5
- package/types/Menu/props.d.ts.map +1 -0
- package/types/Menu/theme.d.ts +1 -1
- package/types/Menu/theme.d.ts.map +1 -1
- package/types/index.d.ts +4 -4
- package/es/Menu/MenuItem/types.js +0 -1
- package/es/Menu/MenuItemGroup/types.js +0 -1
- package/es/Menu/MenuItemSeparator/types.js +0 -1
- package/es/Menu/types.js +0 -1
- package/lib/Menu/MenuItem/types.js +0 -1
- package/lib/Menu/MenuItemGroup/types.js +0 -1
- package/lib/Menu/MenuItemSeparator/types.js +0 -1
- package/lib/Menu/types.js +0 -1
- package/src/Menu/types.ts +0 -63
- package/types/Menu/MenuItem/types.d.ts +0 -19
- package/types/Menu/MenuItem/types.d.ts.map +0 -1
- package/types/Menu/MenuItemGroup/types.d.ts +0 -17
- package/types/Menu/MenuItemGroup/types.d.ts.map +0 -1
- package/types/Menu/MenuItemSeparator/types.d.ts +0 -5
- package/types/Menu/MenuItemSeparator/types.d.ts.map +0 -1
- package/types/Menu/types.d.ts.map +0 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.allowedProps = exports.propTypes = void 0;
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* The MIT License (MIT)
|
|
16
|
+
*
|
|
17
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
18
|
+
*
|
|
19
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
20
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
21
|
+
* in the Software without restriction, including without limitation the rights
|
|
22
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
24
|
+
* furnished to do so, subject to the following conditions:
|
|
25
|
+
*
|
|
26
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
27
|
+
* copies or substantial portions of the Software.
|
|
28
|
+
*
|
|
29
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
30
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
31
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
32
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
33
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
34
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
|
+
* SOFTWARE.
|
|
36
|
+
*/
|
|
37
|
+
const propTypes = {
|
|
38
|
+
/**
|
|
39
|
+
* the menu item label
|
|
40
|
+
*/
|
|
41
|
+
children: _propTypes.default.node.isRequired,
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* whether to set the menu item state to selected or not on initial render
|
|
45
|
+
*/
|
|
46
|
+
defaultSelected: _propTypes.default.bool,
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* whether the menu item is selected or not (must be accompanied by an `onSelect` prop)
|
|
50
|
+
*/
|
|
51
|
+
selected: (0, _controllable.controllable)(_propTypes.default.bool, 'onSelect', 'defaultSelected'),
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* when used with the `selected` prop, the component will not control its own state
|
|
55
|
+
*/
|
|
56
|
+
onSelect: _propTypes.default.func,
|
|
57
|
+
onClick: _propTypes.default.func,
|
|
58
|
+
onKeyDown: _propTypes.default.func,
|
|
59
|
+
onKeyUp: _propTypes.default.func,
|
|
60
|
+
onMouseOver: _propTypes.default.func,
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* the id of the element that the menu item will act upon
|
|
64
|
+
*/
|
|
65
|
+
controls: _propTypes.default.string,
|
|
66
|
+
disabled: _propTypes.default.bool,
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* the element type to render as (will default to `<a>` if href is provided)
|
|
70
|
+
*/
|
|
71
|
+
as: _propTypes.default.elementType,
|
|
72
|
+
// eslint-disable-line react/require-default-props
|
|
73
|
+
type: _propTypes.default.oneOf(['button', 'checkbox', 'radio', 'flyout']),
|
|
74
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
75
|
+
href: _propTypes.default.string
|
|
76
|
+
};
|
|
77
|
+
exports.propTypes = propTypes;
|
|
78
|
+
const allowedProps = ['children', 'defaultSelected', 'selected', 'onSelect', 'onClick', 'onKeyDown', 'onKeyUp', 'onMouseOver', 'controls', 'disabled', 'as', 'type', 'value', 'href'];
|
|
79
|
+
exports.allowedProps = allowedProps;
|
|
@@ -9,14 +9,8 @@ exports.MenuItemGroup = exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
12
|
var _emotion = require("@instructure/emotion");
|
|
15
13
|
|
|
16
|
-
var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
17
|
-
|
|
18
|
-
var _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
|
19
|
-
|
|
20
14
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
21
15
|
|
|
22
16
|
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
@@ -31,12 +25,12 @@ var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
|
31
25
|
|
|
32
26
|
var _MenuItem = require("../MenuItem");
|
|
33
27
|
|
|
34
|
-
var _MenuItemSeparator = require("../MenuItemSeparator");
|
|
35
|
-
|
|
36
28
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
37
29
|
|
|
38
30
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
39
31
|
|
|
32
|
+
var _props = require("./props");
|
|
33
|
+
|
|
40
34
|
var _dec, _dec2, _class, _class2, _temp;
|
|
41
35
|
|
|
42
36
|
/**
|
|
@@ -130,9 +124,11 @@ let MenuItemGroup = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
130
124
|
}
|
|
131
125
|
|
|
132
126
|
renderLabel() {
|
|
127
|
+
var _this$props$styles;
|
|
128
|
+
|
|
133
129
|
const label = this.props.label;
|
|
134
130
|
return (0, _hasVisibleChildren.hasVisibleChildren)(label) ? (0, _emotion.jsx)("span", {
|
|
135
|
-
css: this.props.styles.label
|
|
131
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.label
|
|
136
132
|
}, label) : label;
|
|
137
133
|
}
|
|
138
134
|
|
|
@@ -169,71 +165,24 @@ let MenuItemGroup = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
169
165
|
}
|
|
170
166
|
|
|
171
167
|
render() {
|
|
168
|
+
var _this$props$styles2, _this$props$styles3;
|
|
169
|
+
|
|
172
170
|
const props = (0, _omitProps.omitProps)(this.props, MenuItemGroup.propTypes);
|
|
173
171
|
return (0, _emotion.jsx)("span", Object.assign({}, props, {
|
|
174
|
-
css: this.props.styles.menuItemGroup,
|
|
172
|
+
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.menuItemGroup,
|
|
175
173
|
role: "presentation"
|
|
176
174
|
}), (0, _emotion.jsx)("span", {
|
|
177
175
|
id: this._labelId
|
|
178
176
|
}, this.renderLabel()), (0, _emotion.jsx)("ul", {
|
|
179
177
|
role: "menu",
|
|
180
|
-
css: this.props.styles.items,
|
|
181
|
-
"aria-disabled": this.props.disabled ? 'true' :
|
|
178
|
+
css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.items,
|
|
179
|
+
"aria-disabled": this.props.disabled ? 'true' : void 0,
|
|
182
180
|
"aria-labelledby": this._labelId
|
|
183
181
|
}, this.renderChildren()));
|
|
184
182
|
}
|
|
185
183
|
|
|
186
|
-
}, _class2.displayName = "MenuItemGroup", _class2.componentId = 'Menu.Group', _class2.propTypes = {
|
|
187
|
-
// eslint-disable-next-line react/require-default-props
|
|
188
|
-
makeStyles: _propTypes.default.func,
|
|
189
|
-
// eslint-disable-next-line react/require-default-props
|
|
190
|
-
styles: _propTypes.default.object,
|
|
191
|
-
label: _propTypes.default.node.isRequired,
|
|
192
|
-
allowMultiple: _propTypes.default.bool,
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* children of type `Menu.Item`, `Menu.Separator`
|
|
196
|
-
*/
|
|
197
|
-
children: _Children.Children.oneOf([_MenuItem.MenuItem, _MenuItemSeparator.MenuItemSeparator]),
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* an array of the values (or indices by default) for the selected items
|
|
201
|
-
*/
|
|
202
|
-
selected: (0, _controllable.controllable)(_propTypes.default.array, 'onSelect', 'defaultSelected'),
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* an array of the values (or indices by default) for the selected items on initial render
|
|
206
|
-
*/
|
|
207
|
-
defaultSelected: _propTypes.default.array,
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* call this function when a menu item is selected
|
|
211
|
-
*/
|
|
212
|
-
onSelect: _propTypes.default.func,
|
|
213
|
-
onMouseOver: _propTypes.default.func,
|
|
214
|
-
onKeyDown: _propTypes.default.func,
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* the id of the element that the menu items will act upon
|
|
218
|
-
*/
|
|
219
|
-
controls: _propTypes.default.string,
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* returns a reference to the `MenuItem`
|
|
223
|
-
*/
|
|
224
|
-
itemRef: _propTypes.default.func,
|
|
225
|
-
disabled: _propTypes.default.bool,
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* should the group appear in the tab order (the first item will have a tabIndex of 0)
|
|
229
|
-
*/
|
|
230
|
-
isTabbable: _propTypes.default.bool
|
|
231
|
-
}, _class2.defaultProps = {
|
|
232
|
-
onMouseOver: void 0,
|
|
184
|
+
}, _class2.displayName = "MenuItemGroup", _class2.componentId = 'Menu.Group', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
233
185
|
disabled: false,
|
|
234
|
-
controls: void 0,
|
|
235
|
-
onKeyDown: void 0,
|
|
236
|
-
selected: void 0,
|
|
237
186
|
children: null,
|
|
238
187
|
isTabbable: false,
|
|
239
188
|
allowMultiple: false,
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.allowedProps = exports.propTypes = void 0;
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
13
|
+
|
|
14
|
+
var _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
|
15
|
+
|
|
16
|
+
var _MenuItem = require("../MenuItem");
|
|
17
|
+
|
|
18
|
+
var _MenuItemSeparator = require("../MenuItemSeparator");
|
|
19
|
+
|
|
20
|
+
/*
|
|
21
|
+
* The MIT License (MIT)
|
|
22
|
+
*
|
|
23
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
24
|
+
*
|
|
25
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
26
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
27
|
+
* in the Software without restriction, including without limitation the rights
|
|
28
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
29
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
30
|
+
* furnished to do so, subject to the following conditions:
|
|
31
|
+
*
|
|
32
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
33
|
+
* copies or substantial portions of the Software.
|
|
34
|
+
*
|
|
35
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
36
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
37
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
38
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
39
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
40
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
41
|
+
* SOFTWARE.
|
|
42
|
+
*/
|
|
43
|
+
const propTypes = {
|
|
44
|
+
label: _propTypes.default.node.isRequired,
|
|
45
|
+
allowMultiple: _propTypes.default.bool,
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* children of type `Menu.Item`, `Menu.Separator`
|
|
49
|
+
*/
|
|
50
|
+
children: _Children.Children.oneOf([_MenuItem.MenuItem, _MenuItemSeparator.MenuItemSeparator]),
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* an array of the values (or indices by default) for the selected items
|
|
54
|
+
*/
|
|
55
|
+
selected: (0, _controllable.controllable)(_propTypes.default.array, 'onSelect', 'defaultSelected'),
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* an array of the values (or indices by default) for the selected items on initial render
|
|
59
|
+
*/
|
|
60
|
+
defaultSelected: _propTypes.default.array,
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* call this function when a menu item is selected
|
|
64
|
+
*/
|
|
65
|
+
onSelect: _propTypes.default.func,
|
|
66
|
+
onMouseOver: _propTypes.default.func,
|
|
67
|
+
onKeyDown: _propTypes.default.func,
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* the id of the element that the menu items will act upon
|
|
71
|
+
*/
|
|
72
|
+
controls: _propTypes.default.string,
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* returns a reference to the `MenuItem`
|
|
76
|
+
*/
|
|
77
|
+
itemRef: _propTypes.default.func,
|
|
78
|
+
disabled: _propTypes.default.bool,
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* should the group appear in the tab order (the first item will have a tabIndex of 0)
|
|
82
|
+
*/
|
|
83
|
+
isTabbable: _propTypes.default.bool
|
|
84
|
+
};
|
|
85
|
+
exports.propTypes = propTypes;
|
|
86
|
+
const allowedProps = ['label', 'allowMultiple', 'children', 'selected', 'defaultSelected', 'onSelect', 'onMouseOver', 'onKeyDown', 'controls', 'itemRef', 'disabled', 'isTabbable'];
|
|
87
|
+
exports.allowedProps = allowedProps;
|
|
@@ -9,8 +9,6 @@ exports.MenuItemSeparator = exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
12
|
var _emotion = require("@instructure/emotion");
|
|
15
13
|
|
|
16
14
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
@@ -21,6 +19,8 @@ var _styles = _interopRequireDefault(require("./styles"));
|
|
|
21
19
|
|
|
22
20
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
23
21
|
|
|
22
|
+
var _props = require("./props");
|
|
23
|
+
|
|
24
24
|
var _dec, _dec2, _class, _class2, _temp;
|
|
25
25
|
|
|
26
26
|
/**
|
|
@@ -40,19 +40,16 @@ let MenuItemSeparator = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
render() {
|
|
43
|
+
var _this$props$styles;
|
|
44
|
+
|
|
43
45
|
const props = (0, _omitProps.omitProps)(this.props, MenuItemSeparator.propTypes);
|
|
44
46
|
return (0, _emotion.jsx)("div", Object.assign({}, props, {
|
|
45
47
|
role: "presentation",
|
|
46
|
-
css: this.props.styles.menuItemSeparator
|
|
48
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.menuItemSeparator
|
|
47
49
|
}));
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
}, _class2.displayName = "MenuItemSeparator", _class2.componentId = 'Menu.Separator', _class2.propTypes =
|
|
51
|
-
// eslint-disable-next-line react/require-default-props
|
|
52
|
-
makeStyles: _propTypes.default.func,
|
|
53
|
-
// eslint-disable-next-line react/require-default-props
|
|
54
|
-
styles: _propTypes.default.object
|
|
55
|
-
}, _temp)) || _class) || _class);
|
|
52
|
+
}, _class2.displayName = "MenuItemSeparator", _class2.componentId = 'Menu.Separator', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _temp)) || _class) || _class);
|
|
56
53
|
exports.MenuItemSeparator = MenuItemSeparator;
|
|
57
54
|
var _default = MenuItemSeparator;
|
|
58
55
|
exports.default = _default;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.allowedProps = exports.propTypes = void 0;
|
|
7
|
+
|
|
1
8
|
/*
|
|
2
9
|
* The MIT License (MIT)
|
|
3
10
|
*
|
|
@@ -21,19 +28,9 @@
|
|
|
21
28
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
29
|
* SOFTWARE.
|
|
23
30
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
selected?: any // TODO: controllable(PropTypes.array, 'onSelect', 'defaultSelected')
|
|
31
|
-
defaultSelected?: any[]
|
|
32
|
-
onSelect?: (...args: any[]) => any
|
|
33
|
-
onMouseOver?: (...args: any[]) => any
|
|
34
|
-
onKeyDown?: (...args: any[]) => any
|
|
35
|
-
controls?: string
|
|
36
|
-
itemRef?: (...args: any[]) => any
|
|
37
|
-
disabled?: boolean
|
|
38
|
-
isTabbable?: boolean
|
|
39
|
-
}
|
|
31
|
+
// keeping here to keep the structure of props.ts
|
|
32
|
+
// eslint-disable-next-line
|
|
33
|
+
const propTypes = {};
|
|
34
|
+
exports.propTypes = propTypes;
|
|
35
|
+
const allowedProps = [];
|
|
36
|
+
exports.allowedProps = allowedProps;
|
package/lib/Menu/index.js
CHANGED
|
@@ -27,20 +27,12 @@ exports.Menu = exports.default = void 0;
|
|
|
27
27
|
|
|
28
28
|
var _react = require("react");
|
|
29
29
|
|
|
30
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
|
-
|
|
32
30
|
var _keycode = _interopRequireDefault(require("keycode"));
|
|
33
31
|
|
|
34
32
|
var _Popover = require("@instructure/ui-popover/lib/Popover");
|
|
35
33
|
|
|
36
34
|
var _uid = require("@instructure/uid");
|
|
37
35
|
|
|
38
|
-
var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
39
|
-
|
|
40
|
-
var _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
|
41
|
-
|
|
42
|
-
var _PositionPropTypes = require("@instructure/ui-position/lib/PositionPropTypes.js");
|
|
43
|
-
|
|
44
36
|
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
45
37
|
|
|
46
38
|
var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
|
|
@@ -65,6 +57,8 @@ var _styles = _interopRequireDefault(require("./styles"));
|
|
|
65
57
|
|
|
66
58
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
67
59
|
|
|
60
|
+
var _props = require("./props");
|
|
61
|
+
|
|
68
62
|
var _dec, _dec2, _class, _class2, _temp;
|
|
69
63
|
|
|
70
64
|
/**
|
|
@@ -349,6 +343,8 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
349
343
|
}
|
|
350
344
|
|
|
351
345
|
renderMenu() {
|
|
346
|
+
var _this$props$styles;
|
|
347
|
+
|
|
352
348
|
const _this$props2 = this.props,
|
|
353
349
|
menuRef = _this$props2.menuRef,
|
|
354
350
|
disabled = _this$props2.disabled,
|
|
@@ -369,7 +365,7 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
369
365
|
role: "menu",
|
|
370
366
|
"aria-label": label,
|
|
371
367
|
tabIndex: "0",
|
|
372
|
-
css: this.props.styles.menu,
|
|
368
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.menu,
|
|
373
369
|
"aria-labelledby": labelledBy || trigger && this._labelId,
|
|
374
370
|
"aria-controls": controls,
|
|
375
371
|
"aria-disabled": disabled ? 'true' : null,
|
|
@@ -445,150 +441,7 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
445
441
|
}, this.renderMenu()) : this.renderMenu();
|
|
446
442
|
}
|
|
447
443
|
|
|
448
|
-
}, _class2.displayName = "Menu", _class2.componentId = 'Menu', _class2.propTypes = {
|
|
449
|
-
// eslint-disable-next-line react/require-default-props
|
|
450
|
-
makeStyles: _propTypes.default.func,
|
|
451
|
-
// eslint-disable-next-line react/require-default-props
|
|
452
|
-
styles: _propTypes.default.object,
|
|
453
|
-
|
|
454
|
-
/**
|
|
455
|
-
* Children of type `Menu.Item`, `Menu.Group`, `Menu.Separator`, or `Menu`
|
|
456
|
-
*/
|
|
457
|
-
children: _Children.Children.oneOf(['MenuItem', 'MenuItemGroup', 'MenuItemSeparator', 'Menu']),
|
|
458
|
-
|
|
459
|
-
/**
|
|
460
|
-
* Description of the `<Menu />`
|
|
461
|
-
*/
|
|
462
|
-
label: _propTypes.default.string,
|
|
463
|
-
|
|
464
|
-
/**
|
|
465
|
-
* Is the `<Menu />` disabled
|
|
466
|
-
*/
|
|
467
|
-
disabled: _propTypes.default.bool,
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* The trigger element, if the `<Menu />` is to render as a popover
|
|
471
|
-
*/
|
|
472
|
-
trigger: _propTypes.default.node,
|
|
473
|
-
|
|
474
|
-
/**
|
|
475
|
-
* If a trigger is supplied, where should the `<Menu />` be placed (relative to the trigger)
|
|
476
|
-
*/
|
|
477
|
-
placement: _PositionPropTypes.PositionPropTypes.placement,
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* Should the `<Menu />` be open for the initial render
|
|
481
|
-
*/
|
|
482
|
-
defaultShow: _propTypes.default.bool,
|
|
483
|
-
|
|
484
|
-
/**
|
|
485
|
-
* Is the `<Menu />` open (should be accompanied by `onToggle`)
|
|
486
|
-
*/
|
|
487
|
-
show: (0, _controllable.controllable)(_propTypes.default.bool, 'onToggle', 'defaultShow'),
|
|
488
|
-
|
|
489
|
-
/**
|
|
490
|
-
* Callback fired when the `<Menu />` is toggled open/closed. When used with `show`,
|
|
491
|
-
* the component will not control its own state.
|
|
492
|
-
*/
|
|
493
|
-
onToggle: _propTypes.default.func,
|
|
494
|
-
|
|
495
|
-
/**
|
|
496
|
-
* Callback fired when an item within the `<Menu />` is selected
|
|
497
|
-
*/
|
|
498
|
-
onSelect: _propTypes.default.func,
|
|
499
|
-
|
|
500
|
-
/**
|
|
501
|
-
* If a trigger is supplied, callback fired when the `<Menu />` is closed
|
|
502
|
-
*/
|
|
503
|
-
onDismiss: _propTypes.default.func,
|
|
504
|
-
|
|
505
|
-
/**
|
|
506
|
-
* If a trigger is supplied, callback fired when the `<Menu />` trigger is blurred
|
|
507
|
-
*/
|
|
508
|
-
onBlur: _propTypes.default.func,
|
|
509
|
-
|
|
510
|
-
/**
|
|
511
|
-
* If a trigger is supplied, callback fired when the `<Menu />` trigger is focused
|
|
512
|
-
*/
|
|
513
|
-
onFocus: _propTypes.default.func,
|
|
514
|
-
|
|
515
|
-
/**
|
|
516
|
-
* If a trigger is supplied, callback fired onMouseOver for the `<Menu />` trigger
|
|
517
|
-
*/
|
|
518
|
-
onMouseOver: _propTypes.default.func,
|
|
519
|
-
|
|
520
|
-
/**
|
|
521
|
-
* Callback fired on the onKeyDown of the `<Menu />`
|
|
522
|
-
*/
|
|
523
|
-
onKeyDown: _propTypes.default.func,
|
|
524
|
-
|
|
525
|
-
/**
|
|
526
|
-
* Callback fired on the onKeyUp of the `<Menu />`
|
|
527
|
-
*/
|
|
528
|
-
onKeyUp: _propTypes.default.func,
|
|
529
|
-
|
|
530
|
-
/*
|
|
531
|
-
* A function that returns a reference to the `<Menu />`
|
|
532
|
-
*/
|
|
533
|
-
menuRef: _propTypes.default.func,
|
|
534
|
-
|
|
535
|
-
/**
|
|
536
|
-
* A function that returns a reference to the `<Popover />`
|
|
537
|
-
*/
|
|
538
|
-
popoverRef: _propTypes.default.func,
|
|
539
|
-
|
|
540
|
-
/**
|
|
541
|
-
* If a trigger is supplied, an element or a function returning an element to use as the mount node
|
|
542
|
-
* for the `<Menu />` (defaults to `document.body`)
|
|
543
|
-
*/
|
|
544
|
-
mountNode: _PositionPropTypes.PositionPropTypes.mountNode,
|
|
545
|
-
|
|
546
|
-
/**
|
|
547
|
-
* The parent in which to constrain the menu.
|
|
548
|
-
* One of: 'window', 'scroll-parent', 'parent', 'none', an element,
|
|
549
|
-
* or a function returning an element
|
|
550
|
-
*/
|
|
551
|
-
constrain: _PositionPropTypes.PositionPropTypes.constrain,
|
|
552
|
-
|
|
553
|
-
/**
|
|
554
|
-
* If a trigger is supplied, an element, function returning an element, or array of elements that will not
|
|
555
|
-
* be hidden from the screen reader when the `<Menu />` is open
|
|
556
|
-
*/
|
|
557
|
-
liveRegion: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.element), _propTypes.default.element, _propTypes.default.func]),
|
|
558
|
-
|
|
559
|
-
/**
|
|
560
|
-
* If a trigger is supplied, should the `<Menu />` hide when an item is selected
|
|
561
|
-
*/
|
|
562
|
-
shouldHideOnSelect: _propTypes.default.bool,
|
|
563
|
-
|
|
564
|
-
/**
|
|
565
|
-
* If a trigger is supplied, should the `<Menu />` focus the trigger on after closing
|
|
566
|
-
*/
|
|
567
|
-
shouldFocusTriggerOnClose: _propTypes.default.bool,
|
|
568
|
-
|
|
569
|
-
/**
|
|
570
|
-
* The type of `<Menu />`
|
|
571
|
-
*/
|
|
572
|
-
type: _propTypes.default.oneOf(['flyout']),
|
|
573
|
-
id: _propTypes.default.string,
|
|
574
|
-
|
|
575
|
-
/**
|
|
576
|
-
* Whether or not an arrow pointing to the trigger should be rendered
|
|
577
|
-
*/
|
|
578
|
-
withArrow: _propTypes.default.bool,
|
|
579
|
-
|
|
580
|
-
/**
|
|
581
|
-
* The horizontal offset for the positioned content.
|
|
582
|
-
* Works only if `trigger` is provided.
|
|
583
|
-
*/
|
|
584
|
-
offsetX: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
585
|
-
|
|
586
|
-
/**
|
|
587
|
-
* The vertical offset for the positioned content.
|
|
588
|
-
* Works only if `trigger` is provided.
|
|
589
|
-
*/
|
|
590
|
-
offsetY: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number])
|
|
591
|
-
}, _class2.defaultProps = {
|
|
444
|
+
}, _class2.displayName = "Menu", _class2.componentId = 'Menu', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
592
445
|
children: null,
|
|
593
446
|
label: null,
|
|
594
447
|
disabled: false,
|
|
@@ -610,9 +463,6 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
610
463
|
liveRegion: null,
|
|
611
464
|
shouldHideOnSelect: true,
|
|
612
465
|
shouldFocusTriggerOnClose: true,
|
|
613
|
-
show: void 0,
|
|
614
|
-
id: void 0,
|
|
615
|
-
type: void 0,
|
|
616
466
|
withArrow: true,
|
|
617
467
|
offsetX: 0,
|
|
618
468
|
offsetY: 0
|