@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.
Files changed (47) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/es/Menu/MenuItem/index.js +28 -21
  3. package/es/Menu/MenuItem/props.js +0 -23
  4. package/es/Menu/MenuItemGroup/index.js +17 -13
  5. package/es/Menu/MenuItemGroup/props.js +1 -30
  6. package/es/Menu/MenuItemSeparator/index.js +6 -2
  7. package/es/Menu/index.js +59 -56
  8. package/es/Menu/props.js +1 -113
  9. package/es/MenuContext.js +3 -3
  10. package/lib/Menu/MenuItem/index.js +28 -21
  11. package/lib/Menu/MenuItem/props.js +0 -23
  12. package/lib/Menu/MenuItemGroup/index.js +17 -13
  13. package/lib/Menu/MenuItemGroup/props.js +1 -30
  14. package/lib/Menu/MenuItemSeparator/index.js +6 -2
  15. package/lib/Menu/index.js +61 -56
  16. package/lib/Menu/props.js +1 -113
  17. package/lib/MenuContext.js +2 -2
  18. package/package.json +21 -22
  19. package/src/Menu/MenuItem/index.tsx +24 -34
  20. package/src/Menu/MenuItem/props.ts +36 -27
  21. package/src/Menu/MenuItemGroup/index.tsx +28 -48
  22. package/src/Menu/MenuItemGroup/props.ts +37 -30
  23. package/src/Menu/MenuItemSeparator/index.tsx +2 -4
  24. package/src/Menu/index.tsx +81 -135
  25. package/src/Menu/props.ts +79 -84
  26. package/src/MenuContext.ts +3 -2
  27. package/tsconfig.build.json +25 -2
  28. package/tsconfig.build.tsbuildinfo +1 -0
  29. package/types/Menu/MenuItem/MenuItemLocator.d.ts +52 -52
  30. package/types/Menu/MenuItem/index.d.ts +24 -23
  31. package/types/Menu/MenuItem/index.d.ts.map +1 -1
  32. package/types/Menu/MenuItem/props.d.ts +30 -7
  33. package/types/Menu/MenuItem/props.d.ts.map +1 -1
  34. package/types/Menu/MenuItemGroup/MenuItemGroupLocator.d.ts +182 -182
  35. package/types/Menu/MenuItemGroup/index.d.ts +22 -22
  36. package/types/Menu/MenuItemGroup/index.d.ts.map +1 -1
  37. package/types/Menu/MenuItemGroup/props.d.ts +33 -8
  38. package/types/Menu/MenuItemGroup/props.d.ts.map +1 -1
  39. package/types/Menu/MenuItemSeparator/index.d.ts.map +1 -1
  40. package/types/Menu/MenuLocator.d.ts +576 -576
  41. package/types/Menu/index.d.ts +58 -68
  42. package/types/Menu/index.d.ts.map +1 -1
  43. package/types/Menu/props.d.ts +94 -16
  44. package/types/Menu/props.d.ts.map +1 -1
  45. package/types/MenuContext.d.ts +3 -2
  46. package/types/MenuContext.d.ts.map +1 -1
  47. package/LICENSE.md +0 -27
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.14.0](https://github.com/instructure/instructure-ui/compare/v8.13.0...v8.14.0) (2021-12-16)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-menu
9
+
6
10
  # [8.13.0](https://github.com/instructure/instructure-ui/compare/v8.12.0...v8.13.0) (2021-12-01)
7
11
 
8
12
  **Note:** Version bump only for package @instructure/ui-menu
@@ -44,10 +44,12 @@ import { propTypes, allowedProps } from './props';
44
44
  parent: Menu
45
45
  id: Menu.Item
46
46
  ---
47
+ @tsProps
47
48
  **/
48
49
  let MenuItem = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_temp = _class2 = class MenuItem extends Component {
49
50
  constructor(props) {
50
- super();
51
+ super(props);
52
+ this.labelId = void 0;
51
53
  this.ref = null;
52
54
 
53
55
  this.handleRef = el => {
@@ -93,7 +95,8 @@ let MenuItem = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 =
93
95
 
94
96
  if (enterKey) {
95
97
  // handle space key on keyUp for FF
96
- findDOMNode(this.ref).click(); // eslint-disable-line react/no-find-dom-node
98
+ const refNode = findDOMNode(this.ref);
99
+ refNode.click();
97
100
  }
98
101
  }
99
102
  };
@@ -107,7 +110,8 @@ let MenuItem = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 =
107
110
  e.stopPropagation();
108
111
 
109
112
  if (spaceKey) {
110
- findDOMNode(this.ref).click(); // eslint-disable-line react/no-find-dom-node
113
+ const refNode = findDOMNode(this.ref);
114
+ refNode.click();
111
115
  }
112
116
  }
113
117
  };
@@ -122,7 +126,7 @@ let MenuItem = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 =
122
126
 
123
127
  if (typeof props.selected === 'undefined') {
124
128
  this.state = {
125
- selected: props.defaultSelected
129
+ selected: !!props.defaultSelected
126
130
  };
127
131
  }
128
132
 
@@ -134,7 +138,9 @@ let MenuItem = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 =
134
138
  }
135
139
 
136
140
  componentDidMount() {
137
- this.props.makeStyles();
141
+ var _this$props$makeStyle, _this$props2;
142
+
143
+ (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
138
144
  const context = this.context;
139
145
 
140
146
  if (context && context.registerMenuItem) {
@@ -143,7 +149,9 @@ let MenuItem = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 =
143
149
  }
144
150
 
145
151
  componentDidUpdate() {
146
- this.props.makeStyles();
152
+ var _this$props$makeStyle2, _this$props3;
153
+
154
+ (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
147
155
  }
148
156
 
149
157
  componentWillUnmount() {
@@ -183,15 +191,16 @@ let MenuItem = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 =
183
191
  }
184
192
 
185
193
  focus() {
186
- findDOMNode(this.ref).focus(); // eslint-disable-line react/no-find-dom-node
194
+ const refNode = findDOMNode(this.ref);
195
+ refNode.focus();
187
196
  }
188
197
 
189
198
  renderContent() {
190
199
  var _this$props$styles, _this$props$styles2, _this$props$styles3;
191
200
 
192
- const _this$props2 = this.props,
193
- children = _this$props2.children,
194
- type = _this$props2.type;
201
+ const _this$props4 = this.props,
202
+ children = _this$props4.children,
203
+ type = _this$props4.type;
195
204
  return jsx("span", null, (type === 'checkbox' || type === 'radio') && jsx("span", {
196
205
  css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.icon
197
206
  }, this.selected && (_IconCheckSolid || (_IconCheckSolid = jsx(IconCheckSolid, null)))), jsx("span", {
@@ -205,17 +214,16 @@ let MenuItem = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 =
205
214
  render() {
206
215
  var _this$props$styles4;
207
216
 
208
- const _this$props3 = this.props,
209
- disabled = _this$props3.disabled,
210
- controls = _this$props3.controls,
211
- onKeyDown = _this$props3.onKeyDown,
212
- onKeyUp = _this$props3.onKeyUp,
213
- type = _this$props3.type,
214
- href = _this$props3.href;
217
+ const _this$props5 = this.props,
218
+ disabled = _this$props5.disabled,
219
+ controls = _this$props5.controls,
220
+ onKeyDown = _this$props5.onKeyDown,
221
+ onKeyUp = _this$props5.onKeyUp,
222
+ type = _this$props5.type,
223
+ href = _this$props5.href;
215
224
  const props = omitProps(this.props, MenuItem.allowedProps);
216
225
  const ElementType = this.elementType;
217
- return jsx(ElementType // eslint-disable-line jsx-a11y/mouse-events-have-key-events
218
- , Object.assign({
226
+ return jsx(ElementType, Object.assign({
219
227
  tabIndex: -1 // note: tabIndex can be overridden by Menu or MenuItemGroup components
220
228
 
221
229
  }, props, {
@@ -236,8 +244,7 @@ let MenuItem = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 =
236
244
 
237
245
  }, _class2.displayName = "MenuItem", _class2.componentId = 'Menu.Item', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
238
246
  type: 'button',
239
- disabled: false,
240
- onSelect: function (e, value, selected, item) {}
247
+ disabled: false
241
248
  }, _class2.contextType = MenuContext, _temp)) || _class) || _class);
242
249
  export default MenuItem;
243
250
  export { MenuItem };
@@ -24,39 +24,16 @@
24
24
  import PropTypes from 'prop-types';
25
25
  import { controllable } from '@instructure/ui-prop-types';
26
26
  const propTypes = {
27
- /**
28
- * the menu item label
29
- */
30
27
  children: PropTypes.node.isRequired,
31
-
32
- /**
33
- * whether to set the menu item state to selected or not on initial render
34
- */
35
28
  defaultSelected: PropTypes.bool,
36
-
37
- /**
38
- * whether the menu item is selected or not (must be accompanied by an `onSelect` prop)
39
- */
40
29
  selected: controllable(PropTypes.bool, 'onSelect', 'defaultSelected'),
41
-
42
- /**
43
- * when used with the `selected` prop, the component will not control its own state
44
- */
45
30
  onSelect: PropTypes.func,
46
31
  onClick: PropTypes.func,
47
32
  onKeyDown: PropTypes.func,
48
33
  onKeyUp: PropTypes.func,
49
34
  onMouseOver: PropTypes.func,
50
-
51
- /**
52
- * the id of the element that the menu item will act upon
53
- */
54
35
  controls: PropTypes.string,
55
36
  disabled: PropTypes.bool,
56
-
57
- /**
58
- * the element type to render as (will default to `<a>` if href is provided)
59
- */
60
37
  as: PropTypes.elementType,
61
38
  // eslint-disable-line react/require-default-props
62
39
  type: PropTypes.oneOf(['button', 'checkbox', 'radio', 'flyout']),
@@ -41,10 +41,12 @@ import { propTypes, allowedProps } from './props';
41
41
  parent: Menu
42
42
  id: Menu.Group
43
43
  ---
44
+ @tsProps
44
45
  **/
45
46
  let MenuItemGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_temp = _class2 = class MenuItemGroup extends Component {
46
47
  constructor(props) {
47
- super();
48
+ super(props);
49
+ this._labelId = void 0;
48
50
  this.ref = null;
49
51
 
50
52
  this.handleRef = el => {
@@ -99,11 +101,15 @@ let MenuItemGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _d
99
101
  }
100
102
 
101
103
  componentDidMount() {
102
- this.props.makeStyles();
104
+ var _this$props$makeStyle, _this$props;
105
+
106
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
103
107
  }
104
108
 
105
109
  componentDidUpdate() {
106
- this.props.makeStyles();
110
+ var _this$props$makeStyle2, _this$props2;
111
+
112
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
107
113
  }
108
114
 
109
115
  selectedFromChildren(props) {
@@ -139,13 +145,13 @@ let MenuItemGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _d
139
145
  }
140
146
 
141
147
  renderChildren() {
142
- const _this$props = this.props,
143
- children = _this$props.children,
144
- disabled = _this$props.disabled,
145
- controls = _this$props.controls,
146
- allowMultiple = _this$props.allowMultiple,
147
- isTabbable = _this$props.isTabbable,
148
- onMouseOver = _this$props.onMouseOver;
148
+ const _this$props3 = this.props,
149
+ disabled = _this$props3.disabled,
150
+ controls = _this$props3.controls,
151
+ allowMultiple = _this$props3.allowMultiple,
152
+ isTabbable = _this$props3.isTabbable,
153
+ onMouseOver = _this$props3.onMouseOver;
154
+ const children = this.props.children;
149
155
  let index = -1;
150
156
  return Children.map(children, child => {
151
157
  if (matchComponentTypes(child, [MenuItem])) {
@@ -193,9 +199,7 @@ let MenuItemGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _d
193
199
  children: null,
194
200
  isTabbable: false,
195
201
  allowMultiple: false,
196
- defaultSelected: [],
197
- itemRef: function (item) {},
198
- onSelect: function (e, value, selected, item) {}
202
+ defaultSelected: []
199
203
  }, _temp)) || _class) || _class);
200
204
  export default MenuItemGroup;
201
205
  export { MenuItemGroup };
@@ -28,44 +28,15 @@ import { MenuItemSeparator } from '../MenuItemSeparator';
28
28
  const propTypes = {
29
29
  label: PropTypes.node.isRequired,
30
30
  allowMultiple: PropTypes.bool,
31
-
32
- /**
33
- * children of type `Menu.Item`, `Menu.Separator`
34
- */
35
31
  children: ChildrenPropTypes.oneOf([MenuItem, MenuItemSeparator]),
36
-
37
- /**
38
- * an array of the values (or indices by default) for the selected items
39
- */
40
32
  selected: controllable(PropTypes.array, 'onSelect', 'defaultSelected'),
41
-
42
- /**
43
- * an array of the values (or indices by default) for the selected items on initial render
44
- */
45
33
  defaultSelected: PropTypes.array,
46
-
47
- /**
48
- * call this function when a menu item is selected
49
- */
50
34
  onSelect: PropTypes.func,
51
35
  onMouseOver: PropTypes.func,
52
- onKeyDown: PropTypes.func,
53
-
54
- /**
55
- * the id of the element that the menu items will act upon
56
- */
57
36
  controls: PropTypes.string,
58
-
59
- /**
60
- * returns a reference to the `MenuItem`
61
- */
62
37
  itemRef: PropTypes.func,
63
38
  disabled: PropTypes.bool,
64
-
65
- /**
66
- * should the group appear in the tab order (the first item will have a tabIndex of 0)
67
- */
68
39
  isTabbable: PropTypes.bool
69
40
  };
70
- const allowedProps = ['label', 'allowMultiple', 'children', 'selected', 'defaultSelected', 'onSelect', 'onMouseOver', 'onKeyDown', 'controls', 'itemRef', 'disabled', 'isTabbable'];
41
+ const allowedProps = ['label', 'allowMultiple', 'children', 'selected', 'defaultSelected', 'onSelect', 'onMouseOver', 'controls', 'itemRef', 'disabled', 'isTabbable'];
71
42
  export { propTypes, allowedProps };
@@ -51,11 +51,15 @@ let MenuItemSeparator = (_dec = withStyle(generateStyle, generateComponentTheme)
51
51
  }
52
52
 
53
53
  componentDidMount() {
54
- this.props.makeStyles();
54
+ var _this$props$makeStyle, _this$props;
55
+
56
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
55
57
  }
56
58
 
57
59
  componentDidUpdate() {
58
- this.props.makeStyles();
60
+ var _this$props$makeStyle2, _this$props2;
61
+
62
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
59
63
  }
60
64
 
61
65
  render() {
package/es/Menu/index.js CHANGED
@@ -25,7 +25,7 @@ var _dec, _dec2, _class, _class2, _temp;
25
25
  */
26
26
 
27
27
  /** @jsx jsx */
28
- import { Children, Component } from 'react';
28
+ import React, { Children, Component } from 'react';
29
29
  import keycode from 'keycode';
30
30
  import { Popover } from '@instructure/ui-popover';
31
31
  import { uid } from '@instructure/uid';
@@ -46,6 +46,7 @@ import { propTypes, allowedProps } from './props';
46
46
  ---
47
47
  category: components
48
48
  ---
49
+ @tsProps
49
50
  **/
50
51
  let Menu = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_temp = _class2 = class Menu extends Component {
51
52
  constructor(props) {
@@ -59,7 +60,8 @@ let Menu = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
59
60
  this._trigger = null;
60
61
  this._menu = null;
61
62
  this._labelId = uid('Menu__label');
62
- this._activeSubMenu = null;
63
+ this._activeSubMenu = void 0;
64
+ this._id = void 0;
63
65
  this.ref = null;
64
66
 
65
67
  this.handleRef = el => {
@@ -91,13 +93,13 @@ let Menu = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
91
93
  this.handleTriggerKeyDown = event => {
92
94
  if (this.props.type === 'flyout' && event.keyCode === keycode.codes.right) {
93
95
  event.persist();
94
- this.show();
96
+ this.show(event);
95
97
  }
96
98
  };
97
99
 
98
- this.handleTriggerMouseOver = () => {
100
+ this.handleTriggerMouseOver = event => {
99
101
  if (this.props.type === 'flyout') {
100
- this.show();
102
+ this.show(event);
101
103
  }
102
104
  };
103
105
 
@@ -112,10 +114,10 @@ let Menu = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
112
114
  const _keycode$codes = keycode.codes,
113
115
  down = _keycode$codes.down,
114
116
  up = _keycode$codes.up,
115
- pgup = _keycode$codes.pgup,
116
- pgdn = _keycode$codes.pgdn,
117
117
  tab = _keycode$codes.tab,
118
118
  left = _keycode$codes.left;
119
+ const pgdn = keycode.codes['page down'];
120
+ const pgup = keycode.codes['page up'];
119
121
 
120
122
  if (key === down || key === pgdn) {
121
123
  event.preventDefault();
@@ -201,11 +203,15 @@ let Menu = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
201
203
  }
202
204
 
203
205
  componentDidMount() {
204
- this.props.makeStyles();
206
+ var _this$props$makeStyle, _this$props;
207
+
208
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
205
209
  }
206
210
 
207
- componentDidUpdate(prevProps) {
208
- this.props.makeStyles();
211
+ componentDidUpdate() {
212
+ var _this$props$makeStyle2, _this$props2;
213
+
214
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
209
215
  }
210
216
 
211
217
  get menuItems() {
@@ -214,11 +220,15 @@ let Menu = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
214
220
 
215
221
  focus() {
216
222
  if (this.shown) {
217
- error(this._menu && this._menu.focus, '[Menu] Could not focus the menu.');
223
+ var _this$_menu;
224
+
225
+ error(!!((_this$_menu = this._menu) !== null && _this$_menu !== void 0 && _this$_menu.focus), '[Menu] Could not focus the menu.');
218
226
 
219
227
  this._menu.focus();
220
228
  } else {
221
- error(this._trigger && this._trigger.focus, '[Menu] Could not focus the trigger.');
229
+ var _this$_trigger;
230
+
231
+ error(!!((_this$_trigger = this._trigger) !== null && _this$_trigger !== void 0 && _this$_trigger.focus), '[Menu] Could not focus the trigger.');
222
232
 
223
233
  this._trigger.focus();
224
234
  }
@@ -247,7 +257,7 @@ let Menu = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
247
257
 
248
258
  const current = this.focusedIndex < 0 && step < 0 ? 0 : this.focusedIndex;
249
259
  const nextItem = this.menuItems[(current + count + step) % count];
250
- error(nextItem && nextItem.focus, '[Menu] Could not focus next menu item.');
260
+ error(typeof nextItem !== 'undefined' && typeof nextItem.focus !== 'undefined', '[Menu] Could not focus next menu item.');
251
261
  nextItem.focus();
252
262
  }
253
263
 
@@ -256,9 +266,9 @@ let Menu = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
256
266
  }
257
267
 
258
268
  renderChildren() {
259
- const _this$props = this.props,
260
- children = _this$props.children,
261
- disabled = _this$props.disabled;
269
+ const _this$props3 = this.props,
270
+ children = _this$props3.children,
271
+ disabled = _this$props3.disabled;
262
272
  let count = 0;
263
273
  return Children.map(children, child => {
264
274
  if (!matchComponentTypes(child, ['MenuItemSeparator', 'MenuItem', 'MenuItemGroup', 'Menu'])) {
@@ -274,8 +284,8 @@ let Menu = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
274
284
  }, child);
275
285
  }
276
286
 
277
- const controls = child.props['aria-controls'] || child.props.controls || this.props['aria-controls'] || // eslint-disable-line react/prop-types
278
- this.props.controls; // eslint-disable-line react/prop-types
287
+ const menuItemChild = child;
288
+ const controls = menuItemChild.props['aria-controls'] || menuItemChild.props.controls || this.props['aria-controls'] || this.props.controls;
279
289
 
280
290
  if (matchComponentTypes(child, ['MenuItem'])) {
281
291
  return jsx("li", {
@@ -330,21 +340,21 @@ let Menu = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
330
340
  }, child.props.title || child.props.label)
331
341
  }));
332
342
  }
343
+
344
+ return;
333
345
  });
334
346
  }
335
347
 
336
348
  renderMenu() {
337
349
  var _this$props$styles;
338
350
 
339
- const _this$props2 = this.props,
340
- disabled = _this$props2.disabled,
341
- label = _this$props2.label,
342
- trigger = _this$props2.trigger,
343
- onKeyUp = _this$props2.onKeyUp;
344
- const labelledBy = this.props['aria-labelledby']; // eslint-disable-line react/prop-types
345
-
346
- const controls = this.props['aria-controls']; // eslint-disable-line react/prop-types
347
-
351
+ const _this$props4 = this.props,
352
+ disabled = _this$props4.disabled,
353
+ label = _this$props4.label,
354
+ trigger = _this$props4.trigger,
355
+ onKeyUp = _this$props4.onKeyUp;
356
+ const labelledBy = this.props['aria-labelledby'];
357
+ const controls = this.props['aria-controls'];
348
358
  return jsx(MenuContext.Provider, {
349
359
  value: {
350
360
  removeMenuItem: this.removeMenuItem,
@@ -355,7 +365,7 @@ let Menu = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
355
365
  "aria-label": label,
356
366
  tabIndex: 0,
357
367
  css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.menu,
358
- "aria-labelledby": labelledBy || trigger && this._labelId,
368
+ "aria-labelledby": labelledBy || (trigger ? this._labelId : void 0),
359
369
  "aria-controls": controls,
360
370
  "aria-disabled": disabled ? 'true' : void 0,
361
371
  onKeyDown: this.handleMenuKeyDown,
@@ -365,26 +375,30 @@ let Menu = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
365
375
  }
366
376
 
367
377
  render() {
368
- const _this$props3 = this.props,
369
- show = _this$props3.show,
370
- defaultShow = _this$props3.defaultShow,
371
- placement = _this$props3.placement,
372
- withArrow = _this$props3.withArrow,
373
- trigger = _this$props3.trigger,
374
- mountNode = _this$props3.mountNode,
375
- popoverRef = _this$props3.popoverRef,
376
- disabled = _this$props3.disabled,
377
- onDismiss = _this$props3.onDismiss,
378
- onFocus = _this$props3.onFocus,
379
- onMouseOver = _this$props3.onMouseOver,
380
- offsetX = _this$props3.offsetX,
381
- offsetY = _this$props3.offsetY;
378
+ const _this$props5 = this.props,
379
+ show = _this$props5.show,
380
+ defaultShow = _this$props5.defaultShow,
381
+ placement = _this$props5.placement,
382
+ withArrow = _this$props5.withArrow,
383
+ trigger = _this$props5.trigger,
384
+ mountNode = _this$props5.mountNode,
385
+ popoverRef = _this$props5.popoverRef,
386
+ disabled = _this$props5.disabled,
387
+ onDismiss = _this$props5.onDismiss,
388
+ onFocus = _this$props5.onFocus,
389
+ onMouseOver = _this$props5.onMouseOver,
390
+ offsetX = _this$props5.offsetX,
391
+ offsetY = _this$props5.offsetY;
382
392
  return trigger ? jsx(Popover, {
383
393
  isShowingContent: show,
384
394
  defaultIsShowingContent: defaultShow,
385
395
  onHideContent: (event, _ref) => {
386
396
  let documentClick = _ref.documentClick;
387
- onDismiss(event, documentClick);
397
+
398
+ if (typeof onDismiss === 'function') {
399
+ onDismiss(event, documentClick);
400
+ }
401
+
388
402
  this.handleToggle(false);
389
403
  },
390
404
  onShowContent: () => this.handleToggle(true),
@@ -408,7 +422,8 @@ let Menu = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
408
422
  },
409
423
  renderTrigger: safeCloneElement(trigger, {
410
424
  ref: el => {
411
- this.ref = el;
425
+ this._trigger = el;
426
+ this.ref = (el === null || el === void 0 ? void 0 : el.ref) || el;
412
427
  },
413
428
  'aria-haspopup': true,
414
429
  id: this._labelId,
@@ -420,25 +435,13 @@ let Menu = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
420
435
  }
421
436
 
422
437
  }, _class2.displayName = "Menu", _class2.componentId = 'Menu', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
423
- children: null,
424
438
  label: null,
425
439
  disabled: false,
426
440
  trigger: null,
427
441
  placement: 'bottom center',
428
442
  defaultShow: false,
429
- onToggle: (shown, menu) => {},
430
- onSelect: (event, value, selected, item) => {},
431
- onDismiss: (event, documentClick) => {},
432
- onBlur: event => {},
433
- onFocus: event => {},
434
- onMouseOver: event => {},
435
- onKeyDown: event => {},
436
- onKeyUp: event => {},
437
- menuRef: el => {},
438
- popoverRef: el => {},
439
443
  mountNode: null,
440
444
  constrain: 'window',
441
- liveRegion: null,
442
445
  shouldHideOnSelect: true,
443
446
  shouldFocusTriggerOnClose: true,
444
447
  withArrow: true,