@instructure/ui-menu 8.13.1-snapshot.9 → 8.14.0
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/index.js +28 -21
- package/es/Menu/MenuItem/props.js +0 -23
- package/es/Menu/MenuItemGroup/index.js +17 -13
- package/es/Menu/MenuItemGroup/props.js +1 -30
- package/es/Menu/MenuItemSeparator/index.js +6 -2
- package/es/Menu/index.js +59 -56
- package/es/Menu/props.js +1 -113
- package/es/MenuContext.js +3 -3
- package/lib/Menu/MenuItem/index.js +28 -21
- package/lib/Menu/MenuItem/props.js +0 -23
- package/lib/Menu/MenuItemGroup/index.js +17 -13
- package/lib/Menu/MenuItemGroup/props.js +1 -30
- package/lib/Menu/MenuItemSeparator/index.js +6 -2
- package/lib/Menu/index.js +61 -56
- package/lib/Menu/props.js +1 -113
- package/lib/MenuContext.js +2 -2
- package/package.json +21 -22
- package/src/Menu/MenuItem/index.tsx +24 -34
- package/src/Menu/MenuItem/props.ts +36 -27
- package/src/Menu/MenuItemGroup/index.tsx +28 -48
- package/src/Menu/MenuItemGroup/props.ts +37 -30
- package/src/Menu/MenuItemSeparator/index.tsx +2 -4
- package/src/Menu/index.tsx +81 -135
- package/src/Menu/props.ts +79 -84
- package/src/MenuContext.ts +3 -2
- package/tsconfig.build.json +25 -2
- package/tsconfig.build.tsbuildinfo +1 -0
- package/types/Menu/MenuItem/MenuItemLocator.d.ts +52 -52
- package/types/Menu/MenuItem/index.d.ts +24 -23
- package/types/Menu/MenuItem/index.d.ts.map +1 -1
- package/types/Menu/MenuItem/props.d.ts +30 -7
- package/types/Menu/MenuItem/props.d.ts.map +1 -1
- package/types/Menu/MenuItemGroup/MenuItemGroupLocator.d.ts +182 -182
- package/types/Menu/MenuItemGroup/index.d.ts +22 -22
- package/types/Menu/MenuItemGroup/index.d.ts.map +1 -1
- package/types/Menu/MenuItemGroup/props.d.ts +33 -8
- package/types/Menu/MenuItemGroup/props.d.ts.map +1 -1
- package/types/Menu/MenuItemSeparator/index.d.ts.map +1 -1
- package/types/Menu/MenuLocator.d.ts +576 -576
- package/types/Menu/index.d.ts +58 -68
- package/types/Menu/index.d.ts.map +1 -1
- package/types/Menu/props.d.ts +94 -16
- package/types/Menu/props.d.ts.map +1 -1
- package/types/MenuContext.d.ts +3 -2
- package/types/MenuContext.d.ts.map +1 -1
- package/LICENSE.md +0 -27
package/es/Menu/props.js
CHANGED
|
@@ -25,143 +25,31 @@ import PropTypes from 'prop-types';
|
|
|
25
25
|
import { PositionPropTypes } from '@instructure/ui-position';
|
|
26
26
|
import { controllable, Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
|
|
27
27
|
const propTypes = {
|
|
28
|
-
/**
|
|
29
|
-
* Children of type `Menu.Item`, `Menu.Group`, `Menu.Separator`, or `Menu`
|
|
30
|
-
*/
|
|
31
28
|
children: ChildrenPropTypes.oneOf(['MenuItem', 'MenuItemGroup', 'MenuItemSeparator', 'Menu']),
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Description of the `<Menu />`
|
|
35
|
-
*/
|
|
36
29
|
label: PropTypes.string,
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Is the `<Menu />` disabled
|
|
40
|
-
*/
|
|
41
30
|
disabled: PropTypes.bool,
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* The trigger element, if the `<Menu />` is to render as a popover
|
|
45
|
-
*/
|
|
46
31
|
trigger: PropTypes.node,
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* If a trigger is supplied, where should the `<Menu />` be placed (relative to the trigger)
|
|
50
|
-
*/
|
|
51
32
|
placement: PositionPropTypes.placement,
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Should the `<Menu />` be open for the initial render
|
|
55
|
-
*/
|
|
56
33
|
defaultShow: PropTypes.bool,
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Is the `<Menu />` open (should be accompanied by `onToggle`)
|
|
60
|
-
*/
|
|
61
34
|
show: controllable(PropTypes.bool, 'onToggle', 'defaultShow'),
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Callback fired when the `<Menu />` is toggled open/closed. When used with `show`,
|
|
65
|
-
* the component will not control its own state.
|
|
66
|
-
*/
|
|
67
35
|
onToggle: PropTypes.func,
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Callback fired when an item within the `<Menu />` is selected
|
|
71
|
-
*/
|
|
72
36
|
onSelect: PropTypes.func,
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* If a trigger is supplied, callback fired when the `<Menu />` is closed
|
|
76
|
-
*/
|
|
77
37
|
onDismiss: PropTypes.func,
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* If a trigger is supplied, callback fired when the `<Menu />` trigger is blurred
|
|
81
|
-
*/
|
|
82
|
-
onBlur: PropTypes.func,
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* If a trigger is supplied, callback fired when the `<Menu />` trigger is focused
|
|
86
|
-
*/
|
|
87
38
|
onFocus: PropTypes.func,
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* If a trigger is supplied, callback fired onMouseOver for the `<Menu />` trigger
|
|
91
|
-
*/
|
|
92
39
|
onMouseOver: PropTypes.func,
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Callback fired on the onKeyDown of the `<Menu />`
|
|
96
|
-
*/
|
|
97
40
|
onKeyDown: PropTypes.func,
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Callback fired on the onKeyUp of the `<Menu />`
|
|
101
|
-
*/
|
|
102
41
|
onKeyUp: PropTypes.func,
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* A function that returns a reference to the `<Menu />`
|
|
106
|
-
*/
|
|
107
42
|
menuRef: PropTypes.func,
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* A function that returns a reference to the `<Popover />`
|
|
111
|
-
*/
|
|
112
43
|
popoverRef: PropTypes.func,
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* If a trigger is supplied, an element or a function returning an element to use as the mount node
|
|
116
|
-
* for the `<Menu />` (defaults to `document.body`)
|
|
117
|
-
*/
|
|
118
44
|
mountNode: PositionPropTypes.mountNode,
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* The parent in which to constrain the menu.
|
|
122
|
-
* One of: 'window', 'scroll-parent', 'parent', 'none', an element,
|
|
123
|
-
* or a function returning an element
|
|
124
|
-
*/
|
|
125
45
|
constrain: PositionPropTypes.constrain,
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* If a trigger is supplied, an element, function returning an element, or array of elements that will not
|
|
129
|
-
* be hidden from the screen reader when the `<Menu />` is open
|
|
130
|
-
*/
|
|
131
|
-
liveRegion: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element, PropTypes.func]),
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* If a trigger is supplied, should the `<Menu />` hide when an item is selected
|
|
135
|
-
*/
|
|
136
46
|
shouldHideOnSelect: PropTypes.bool,
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* If a trigger is supplied, should the `<Menu />` focus the trigger on after closing
|
|
140
|
-
*/
|
|
141
47
|
shouldFocusTriggerOnClose: PropTypes.bool,
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* The type of `<Menu />`
|
|
145
|
-
*/
|
|
146
48
|
type: PropTypes.oneOf(['flyout']),
|
|
147
49
|
id: PropTypes.string,
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Whether or not an arrow pointing to the trigger should be rendered
|
|
151
|
-
*/
|
|
152
50
|
withArrow: PropTypes.bool,
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* The horizontal offset for the positioned content.
|
|
156
|
-
* Works only if `trigger` is provided.
|
|
157
|
-
*/
|
|
158
51
|
offsetX: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* The vertical offset for the positioned content.
|
|
162
|
-
* Works only if `trigger` is provided.
|
|
163
|
-
*/
|
|
164
52
|
offsetY: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
165
53
|
};
|
|
166
|
-
const allowedProps = ['children', 'label', 'disabled', 'trigger', 'placement', 'defaultShow', 'show', 'onToggle', 'onSelect', 'onDismiss', '
|
|
54
|
+
const allowedProps = ['children', 'label', 'disabled', 'trigger', 'placement', 'defaultShow', 'show', 'onToggle', 'onSelect', 'onDismiss', 'onFocus', 'onMouseOver', 'onKeyDown', 'onKeyUp', 'menuRef', 'popoverRef', 'mountNode', 'constrain', 'shouldHideOnSelect', 'shouldFocusTriggerOnClose', 'type', 'id', 'withArrow', 'offsetX', 'offsetY'];
|
|
167
55
|
export { propTypes, allowedProps };
|
package/es/MenuContext.js
CHANGED
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
import { createContext } from 'react';
|
|
25
|
+
|
|
25
26
|
/**
|
|
26
27
|
---
|
|
27
28
|
private: true
|
|
28
29
|
---
|
|
29
30
|
@module MenuContext
|
|
30
31
|
**/
|
|
31
|
-
|
|
32
32
|
const MenuContext = /*#__PURE__*/createContext({
|
|
33
|
-
registerMenuItem:
|
|
34
|
-
removeMenuItem:
|
|
33
|
+
registerMenuItem: _value => {},
|
|
34
|
+
removeMenuItem: _value => {}
|
|
35
35
|
});
|
|
36
36
|
export default MenuContext;
|
|
37
37
|
export { MenuContext };
|
|
@@ -46,10 +46,12 @@ var _dec, _dec2, _class, _class2, _temp, _IconCheckSolid, _IconArrowOpenEndSoli;
|
|
|
46
46
|
parent: Menu
|
|
47
47
|
id: Menu.Item
|
|
48
48
|
---
|
|
49
|
+
@tsProps
|
|
49
50
|
**/
|
|
50
51
|
let MenuItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_temp = _class2 = class MenuItem extends _react.Component {
|
|
51
52
|
constructor(props) {
|
|
52
|
-
super();
|
|
53
|
+
super(props);
|
|
54
|
+
this.labelId = void 0;
|
|
53
55
|
this.ref = null;
|
|
54
56
|
|
|
55
57
|
this.handleRef = el => {
|
|
@@ -95,7 +97,8 @@ let MenuItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
|
|
|
95
97
|
|
|
96
98
|
if (enterKey) {
|
|
97
99
|
// handle space key on keyUp for FF
|
|
98
|
-
(0, _findDOMNode.findDOMNode)(this.ref)
|
|
100
|
+
const refNode = (0, _findDOMNode.findDOMNode)(this.ref);
|
|
101
|
+
refNode.click();
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
104
|
};
|
|
@@ -109,7 +112,8 @@ let MenuItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
|
|
|
109
112
|
e.stopPropagation();
|
|
110
113
|
|
|
111
114
|
if (spaceKey) {
|
|
112
|
-
(0, _findDOMNode.findDOMNode)(this.ref)
|
|
115
|
+
const refNode = (0, _findDOMNode.findDOMNode)(this.ref);
|
|
116
|
+
refNode.click();
|
|
113
117
|
}
|
|
114
118
|
}
|
|
115
119
|
};
|
|
@@ -124,7 +128,7 @@ let MenuItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
|
|
|
124
128
|
|
|
125
129
|
if (typeof props.selected === 'undefined') {
|
|
126
130
|
this.state = {
|
|
127
|
-
selected: props.defaultSelected
|
|
131
|
+
selected: !!props.defaultSelected
|
|
128
132
|
};
|
|
129
133
|
}
|
|
130
134
|
|
|
@@ -136,7 +140,9 @@ let MenuItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
|
|
|
136
140
|
}
|
|
137
141
|
|
|
138
142
|
componentDidMount() {
|
|
139
|
-
|
|
143
|
+
var _this$props$makeStyle, _this$props2;
|
|
144
|
+
|
|
145
|
+
(_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
|
|
140
146
|
const context = this.context;
|
|
141
147
|
|
|
142
148
|
if (context && context.registerMenuItem) {
|
|
@@ -145,7 +151,9 @@ let MenuItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
|
|
|
145
151
|
}
|
|
146
152
|
|
|
147
153
|
componentDidUpdate() {
|
|
148
|
-
|
|
154
|
+
var _this$props$makeStyle2, _this$props3;
|
|
155
|
+
|
|
156
|
+
(_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
|
|
149
157
|
}
|
|
150
158
|
|
|
151
159
|
componentWillUnmount() {
|
|
@@ -185,15 +193,16 @@ let MenuItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
|
|
|
185
193
|
}
|
|
186
194
|
|
|
187
195
|
focus() {
|
|
188
|
-
(0, _findDOMNode.findDOMNode)(this.ref)
|
|
196
|
+
const refNode = (0, _findDOMNode.findDOMNode)(this.ref);
|
|
197
|
+
refNode.focus();
|
|
189
198
|
}
|
|
190
199
|
|
|
191
200
|
renderContent() {
|
|
192
201
|
var _this$props$styles, _this$props$styles2, _this$props$styles3;
|
|
193
202
|
|
|
194
|
-
const _this$
|
|
195
|
-
children = _this$
|
|
196
|
-
type = _this$
|
|
203
|
+
const _this$props4 = this.props,
|
|
204
|
+
children = _this$props4.children,
|
|
205
|
+
type = _this$props4.type;
|
|
197
206
|
return (0, _emotion.jsx)("span", null, (type === 'checkbox' || type === 'radio') && (0, _emotion.jsx)("span", {
|
|
198
207
|
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.icon
|
|
199
208
|
}, this.selected && (_IconCheckSolid || (_IconCheckSolid = (0, _emotion.jsx)(_IconCheckSolid2.IconCheckSolid, null)))), (0, _emotion.jsx)("span", {
|
|
@@ -207,17 +216,16 @@ let MenuItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
|
|
|
207
216
|
render() {
|
|
208
217
|
var _this$props$styles4;
|
|
209
218
|
|
|
210
|
-
const _this$
|
|
211
|
-
disabled = _this$
|
|
212
|
-
controls = _this$
|
|
213
|
-
onKeyDown = _this$
|
|
214
|
-
onKeyUp = _this$
|
|
215
|
-
type = _this$
|
|
216
|
-
href = _this$
|
|
219
|
+
const _this$props5 = this.props,
|
|
220
|
+
disabled = _this$props5.disabled,
|
|
221
|
+
controls = _this$props5.controls,
|
|
222
|
+
onKeyDown = _this$props5.onKeyDown,
|
|
223
|
+
onKeyUp = _this$props5.onKeyUp,
|
|
224
|
+
type = _this$props5.type,
|
|
225
|
+
href = _this$props5.href;
|
|
217
226
|
const props = (0, _omitProps.omitProps)(this.props, MenuItem.allowedProps);
|
|
218
227
|
const ElementType = this.elementType;
|
|
219
|
-
return (0, _emotion.jsx)(ElementType
|
|
220
|
-
, Object.assign({
|
|
228
|
+
return (0, _emotion.jsx)(ElementType, Object.assign({
|
|
221
229
|
tabIndex: -1 // note: tabIndex can be overridden by Menu or MenuItemGroup components
|
|
222
230
|
|
|
223
231
|
}, props, {
|
|
@@ -238,8 +246,7 @@ let MenuItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
|
|
|
238
246
|
|
|
239
247
|
}, _class2.displayName = "MenuItem", _class2.componentId = 'Menu.Item', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
240
248
|
type: 'button',
|
|
241
|
-
disabled: false
|
|
242
|
-
onSelect: function (e, value, selected, item) {}
|
|
249
|
+
disabled: false
|
|
243
250
|
}, _class2.contextType = _MenuContext.MenuContext, _temp)) || _class) || _class);
|
|
244
251
|
exports.MenuItem = MenuItem;
|
|
245
252
|
var _default = MenuItem;
|
|
@@ -35,39 +35,16 @@ var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
|
35
35
|
* SOFTWARE.
|
|
36
36
|
*/
|
|
37
37
|
const propTypes = {
|
|
38
|
-
/**
|
|
39
|
-
* the menu item label
|
|
40
|
-
*/
|
|
41
38
|
children: _propTypes.default.node.isRequired,
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* whether to set the menu item state to selected or not on initial render
|
|
45
|
-
*/
|
|
46
39
|
defaultSelected: _propTypes.default.bool,
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* whether the menu item is selected or not (must be accompanied by an `onSelect` prop)
|
|
50
|
-
*/
|
|
51
40
|
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
41
|
onSelect: _propTypes.default.func,
|
|
57
42
|
onClick: _propTypes.default.func,
|
|
58
43
|
onKeyDown: _propTypes.default.func,
|
|
59
44
|
onKeyUp: _propTypes.default.func,
|
|
60
45
|
onMouseOver: _propTypes.default.func,
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* the id of the element that the menu item will act upon
|
|
64
|
-
*/
|
|
65
46
|
controls: _propTypes.default.string,
|
|
66
47
|
disabled: _propTypes.default.bool,
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* the element type to render as (will default to `<a>` if href is provided)
|
|
70
|
-
*/
|
|
71
48
|
as: _propTypes.default.elementType,
|
|
72
49
|
// eslint-disable-line react/require-default-props
|
|
73
50
|
type: _propTypes.default.oneOf(['button', 'checkbox', 'radio', 'flyout']),
|
|
@@ -38,10 +38,12 @@ var _dec, _dec2, _class, _class2, _temp;
|
|
|
38
38
|
parent: Menu
|
|
39
39
|
id: Menu.Group
|
|
40
40
|
---
|
|
41
|
+
@tsProps
|
|
41
42
|
**/
|
|
42
43
|
let MenuItemGroup = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_temp = _class2 = class MenuItemGroup extends _react.Component {
|
|
43
44
|
constructor(props) {
|
|
44
|
-
super();
|
|
45
|
+
super(props);
|
|
46
|
+
this._labelId = void 0;
|
|
45
47
|
this.ref = null;
|
|
46
48
|
|
|
47
49
|
this.handleRef = el => {
|
|
@@ -96,11 +98,15 @@ let MenuItemGroup = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
96
98
|
}
|
|
97
99
|
|
|
98
100
|
componentDidMount() {
|
|
99
|
-
|
|
101
|
+
var _this$props$makeStyle, _this$props;
|
|
102
|
+
|
|
103
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
100
104
|
}
|
|
101
105
|
|
|
102
106
|
componentDidUpdate() {
|
|
103
|
-
|
|
107
|
+
var _this$props$makeStyle2, _this$props2;
|
|
108
|
+
|
|
109
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
104
110
|
}
|
|
105
111
|
|
|
106
112
|
selectedFromChildren(props) {
|
|
@@ -138,13 +144,13 @@ let MenuItemGroup = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
138
144
|
}
|
|
139
145
|
|
|
140
146
|
renderChildren() {
|
|
141
|
-
const _this$
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
const _this$props3 = this.props,
|
|
148
|
+
disabled = _this$props3.disabled,
|
|
149
|
+
controls = _this$props3.controls,
|
|
150
|
+
allowMultiple = _this$props3.allowMultiple,
|
|
151
|
+
isTabbable = _this$props3.isTabbable,
|
|
152
|
+
onMouseOver = _this$props3.onMouseOver;
|
|
153
|
+
const children = this.props.children;
|
|
148
154
|
let index = -1;
|
|
149
155
|
return _react.Children.map(children, child => {
|
|
150
156
|
if ((0, _matchComponentTypes.matchComponentTypes)(child, [_MenuItem.MenuItem])) {
|
|
@@ -192,9 +198,7 @@ let MenuItemGroup = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
192
198
|
children: null,
|
|
193
199
|
isTabbable: false,
|
|
194
200
|
allowMultiple: false,
|
|
195
|
-
defaultSelected: []
|
|
196
|
-
itemRef: function (item) {},
|
|
197
|
-
onSelect: function (e, value, selected, item) {}
|
|
201
|
+
defaultSelected: []
|
|
198
202
|
}, _temp)) || _class) || _class);
|
|
199
203
|
exports.MenuItemGroup = MenuItemGroup;
|
|
200
204
|
var _default = MenuItemGroup;
|
|
@@ -43,45 +43,16 @@ var _MenuItemSeparator = require("../MenuItemSeparator");
|
|
|
43
43
|
const propTypes = {
|
|
44
44
|
label: _propTypes.default.node.isRequired,
|
|
45
45
|
allowMultiple: _propTypes.default.bool,
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* children of type `Menu.Item`, `Menu.Separator`
|
|
49
|
-
*/
|
|
50
46
|
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
47
|
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
48
|
defaultSelected: _propTypes.default.array,
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* call this function when a menu item is selected
|
|
64
|
-
*/
|
|
65
49
|
onSelect: _propTypes.default.func,
|
|
66
50
|
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
51
|
controls: _propTypes.default.string,
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* returns a reference to the `MenuItem`
|
|
76
|
-
*/
|
|
77
52
|
itemRef: _propTypes.default.func,
|
|
78
53
|
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
54
|
isTabbable: _propTypes.default.bool
|
|
84
55
|
};
|
|
85
56
|
exports.propTypes = propTypes;
|
|
86
|
-
const allowedProps = ['label', 'allowMultiple', 'children', 'selected', 'defaultSelected', 'onSelect', 'onMouseOver', '
|
|
57
|
+
const allowedProps = ['label', 'allowMultiple', 'children', 'selected', 'defaultSelected', 'onSelect', 'onMouseOver', 'controls', 'itemRef', 'disabled', 'isTabbable'];
|
|
87
58
|
exports.allowedProps = allowedProps;
|
|
@@ -41,11 +41,15 @@ let MenuItemSeparator = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
componentDidMount() {
|
|
44
|
-
|
|
44
|
+
var _this$props$makeStyle, _this$props;
|
|
45
|
+
|
|
46
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
componentDidUpdate() {
|
|
48
|
-
|
|
50
|
+
var _this$props$makeStyle2, _this$props2;
|
|
51
|
+
|
|
52
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
render() {
|