@instructure/ui-menu 8.13.1-snapshot.2 → 8.13.1-snapshot.27

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 (45) hide show
  1. package/es/Menu/MenuItem/index.js +28 -21
  2. package/es/Menu/MenuItem/props.js +0 -23
  3. package/es/Menu/MenuItemGroup/index.js +17 -13
  4. package/es/Menu/MenuItemGroup/props.js +1 -30
  5. package/es/Menu/MenuItemSeparator/index.js +6 -2
  6. package/es/Menu/index.js +56 -52
  7. package/es/Menu/props.js +1 -113
  8. package/es/MenuContext.js +3 -3
  9. package/lib/Menu/MenuItem/index.js +28 -21
  10. package/lib/Menu/MenuItem/props.js +0 -23
  11. package/lib/Menu/MenuItemGroup/index.js +17 -13
  12. package/lib/Menu/MenuItemGroup/props.js +1 -30
  13. package/lib/Menu/MenuItemSeparator/index.js +6 -2
  14. package/lib/Menu/index.js +58 -52
  15. package/lib/Menu/props.js +1 -113
  16. package/lib/MenuContext.js +2 -2
  17. package/package.json +21 -21
  18. package/src/Menu/MenuItem/index.tsx +24 -34
  19. package/src/Menu/MenuItem/props.ts +36 -27
  20. package/src/Menu/MenuItemGroup/index.tsx +28 -48
  21. package/src/Menu/MenuItemGroup/props.ts +37 -30
  22. package/src/Menu/MenuItemSeparator/index.tsx +2 -4
  23. package/src/Menu/index.tsx +79 -133
  24. package/src/Menu/props.ts +76 -84
  25. package/src/MenuContext.ts +3 -2
  26. package/tsconfig.build.json +25 -2
  27. package/tsconfig.build.tsbuildinfo +1 -0
  28. package/types/Menu/MenuItem/MenuItemLocator.d.ts +52 -52
  29. package/types/Menu/MenuItem/index.d.ts +24 -23
  30. package/types/Menu/MenuItem/index.d.ts.map +1 -1
  31. package/types/Menu/MenuItem/props.d.ts +30 -7
  32. package/types/Menu/MenuItem/props.d.ts.map +1 -1
  33. package/types/Menu/MenuItemGroup/MenuItemGroupLocator.d.ts +182 -182
  34. package/types/Menu/MenuItemGroup/index.d.ts +22 -22
  35. package/types/Menu/MenuItemGroup/index.d.ts.map +1 -1
  36. package/types/Menu/MenuItemGroup/props.d.ts +33 -8
  37. package/types/Menu/MenuItemGroup/props.d.ts.map +1 -1
  38. package/types/Menu/MenuItemSeparator/index.d.ts.map +1 -1
  39. package/types/Menu/MenuLocator.d.ts +576 -576
  40. package/types/Menu/index.d.ts +57 -67
  41. package/types/Menu/index.d.ts.map +1 -1
  42. package/types/Menu/props.d.ts +94 -16
  43. package/types/Menu/props.d.ts.map +1 -1
  44. package/types/MenuContext.d.ts +3 -2
  45. package/types/MenuContext.d.ts.map +1 -1
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).click(); // eslint-disable-line react/no-find-dom-node
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).click(); // eslint-disable-line react/no-find-dom-node
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
- this.props.makeStyles();
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
- this.props.makeStyles();
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).focus(); // eslint-disable-line react/no-find-dom-node
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$props2 = this.props,
195
- children = _this$props2.children,
196
- type = _this$props2.type;
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$props3 = this.props,
211
- disabled = _this$props3.disabled,
212
- controls = _this$props3.controls,
213
- onKeyDown = _this$props3.onKeyDown,
214
- onKeyUp = _this$props3.onKeyUp,
215
- type = _this$props3.type,
216
- href = _this$props3.href;
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 // eslint-disable-line jsx-a11y/mouse-events-have-key-events
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
- this.props.makeStyles();
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
- this.props.makeStyles();
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$props = this.props,
142
- children = _this$props.children,
143
- disabled = _this$props.disabled,
144
- controls = _this$props.controls,
145
- allowMultiple = _this$props.allowMultiple,
146
- isTabbable = _this$props.isTabbable,
147
- onMouseOver = _this$props.onMouseOver;
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', 'onKeyDown', 'controls', 'itemRef', 'disabled', 'isTabbable'];
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
- this.props.makeStyles();
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
- this.props.makeStyles();
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() {
package/lib/Menu/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+
3
5
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
6
 
5
7
  Object.defineProperty(exports, "__esModule", {
@@ -26,7 +28,7 @@ Object.defineProperty(exports, "MenuItemSeparator", {
26
28
  });
27
29
  exports.default = void 0;
28
30
 
29
- var _react = require("react");
31
+ var _react = _interopRequireWildcard(require("react"));
30
32
 
31
33
  var _keycode = _interopRequireDefault(require("keycode"));
32
34
 
@@ -66,6 +68,7 @@ var _dec, _dec2, _class, _class2, _temp;
66
68
  ---
67
69
  category: components
68
70
  ---
71
+ @tsProps
69
72
  **/
70
73
  let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_temp = _class2 = class Menu extends _react.Component {
71
74
  constructor(props) {
@@ -79,7 +82,8 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
79
82
  this._trigger = null;
80
83
  this._menu = null;
81
84
  this._labelId = (0, _uid.uid)('Menu__label');
82
- this._activeSubMenu = null;
85
+ this._activeSubMenu = void 0;
86
+ this._id = void 0;
83
87
  this.ref = null;
84
88
 
85
89
  this.handleRef = el => {
@@ -132,10 +136,10 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
132
136
  const _keycode$codes = _keycode.default.codes,
133
137
  down = _keycode$codes.down,
134
138
  up = _keycode$codes.up,
135
- pgup = _keycode$codes.pgup,
136
- pgdn = _keycode$codes.pgdn,
137
139
  tab = _keycode$codes.tab,
138
140
  left = _keycode$codes.left;
141
+ const pgdn = _keycode.default.codes['page down'];
142
+ const pgup = _keycode.default.codes['page up'];
139
143
 
140
144
  if (key === down || key === pgdn) {
141
145
  event.preventDefault();
@@ -213,6 +217,7 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
213
217
 
214
218
  this.show = event => {
215
219
  if (this._popover) {
220
+ //TODO make events consistents
216
221
  this._popover.show(event);
217
222
  }
218
223
  };
@@ -221,11 +226,15 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
221
226
  }
222
227
 
223
228
  componentDidMount() {
224
- this.props.makeStyles();
229
+ var _this$props$makeStyle, _this$props;
230
+
231
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
225
232
  }
226
233
 
227
- componentDidUpdate(prevProps) {
228
- this.props.makeStyles();
234
+ componentDidUpdate() {
235
+ var _this$props$makeStyle2, _this$props2;
236
+
237
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
229
238
  }
230
239
 
231
240
  get menuItems() {
@@ -234,11 +243,15 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
234
243
 
235
244
  focus() {
236
245
  if (this.shown) {
237
- (0, _console.logError)(this._menu && this._menu.focus, '[Menu] Could not focus the menu.');
246
+ var _this$_menu;
247
+
248
+ (0, _console.logError)(!!((_this$_menu = this._menu) !== null && _this$_menu !== void 0 && _this$_menu.focus), '[Menu] Could not focus the menu.');
238
249
 
239
250
  this._menu.focus();
240
251
  } else {
241
- (0, _console.logError)(this._trigger && this._trigger.focus, '[Menu] Could not focus the trigger.');
252
+ var _this$_trigger;
253
+
254
+ (0, _console.logError)(!!((_this$_trigger = this._trigger) !== null && _this$_trigger !== void 0 && _this$_trigger.focus), '[Menu] Could not focus the trigger.');
242
255
 
243
256
  this._trigger.focus();
244
257
  }
@@ -267,7 +280,7 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
267
280
 
268
281
  const current = this.focusedIndex < 0 && step < 0 ? 0 : this.focusedIndex;
269
282
  const nextItem = this.menuItems[(current + count + step) % count];
270
- (0, _console.logError)(nextItem && nextItem.focus, '[Menu] Could not focus next menu item.');
283
+ (0, _console.logError)(typeof nextItem !== 'undefined' && typeof nextItem.focus !== 'undefined', '[Menu] Could not focus next menu item.');
271
284
  nextItem.focus();
272
285
  }
273
286
 
@@ -276,9 +289,9 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
276
289
  }
277
290
 
278
291
  renderChildren() {
279
- const _this$props = this.props,
280
- children = _this$props.children,
281
- disabled = _this$props.disabled;
292
+ const _this$props3 = this.props,
293
+ children = _this$props3.children,
294
+ disabled = _this$props3.disabled;
282
295
  let count = 0;
283
296
  return _react.Children.map(children, child => {
284
297
  if (!(0, _matchComponentTypes.matchComponentTypes)(child, ['MenuItemSeparator', 'MenuItem', 'MenuItemGroup', 'Menu'])) {
@@ -294,8 +307,8 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
294
307
  }, child);
295
308
  }
296
309
 
297
- const controls = child.props['aria-controls'] || child.props.controls || this.props['aria-controls'] || // eslint-disable-line react/prop-types
298
- this.props.controls; // eslint-disable-line react/prop-types
310
+ const menuItemChild = child;
311
+ const controls = menuItemChild.props['aria-controls'] || menuItemChild.props.controls || this.props['aria-controls'] || this.props.controls;
299
312
 
300
313
  if ((0, _matchComponentTypes.matchComponentTypes)(child, ['MenuItem'])) {
301
314
  return (0, _emotion.jsx)("li", {
@@ -350,21 +363,21 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
350
363
  }, child.props.title || child.props.label)
351
364
  }));
352
365
  }
366
+
367
+ return;
353
368
  });
354
369
  }
355
370
 
356
371
  renderMenu() {
357
372
  var _this$props$styles;
358
373
 
359
- const _this$props2 = this.props,
360
- disabled = _this$props2.disabled,
361
- label = _this$props2.label,
362
- trigger = _this$props2.trigger,
363
- onKeyUp = _this$props2.onKeyUp;
364
- const labelledBy = this.props['aria-labelledby']; // eslint-disable-line react/prop-types
365
-
366
- const controls = this.props['aria-controls']; // eslint-disable-line react/prop-types
367
-
374
+ const _this$props4 = this.props,
375
+ disabled = _this$props4.disabled,
376
+ label = _this$props4.label,
377
+ trigger = _this$props4.trigger,
378
+ onKeyUp = _this$props4.onKeyUp;
379
+ const labelledBy = this.props['aria-labelledby'];
380
+ const controls = this.props['aria-controls'];
368
381
  return (0, _emotion.jsx)(_MenuContext.MenuContext.Provider, {
369
382
  value: {
370
383
  removeMenuItem: this.removeMenuItem,
@@ -375,7 +388,7 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
375
388
  "aria-label": label,
376
389
  tabIndex: 0,
377
390
  css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.menu,
378
- "aria-labelledby": labelledBy || trigger && this._labelId,
391
+ "aria-labelledby": labelledBy || (trigger ? this._labelId : void 0),
379
392
  "aria-controls": controls,
380
393
  "aria-disabled": disabled ? 'true' : void 0,
381
394
  onKeyDown: this.handleMenuKeyDown,
@@ -385,26 +398,30 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
385
398
  }
386
399
 
387
400
  render() {
388
- const _this$props3 = this.props,
389
- show = _this$props3.show,
390
- defaultShow = _this$props3.defaultShow,
391
- placement = _this$props3.placement,
392
- withArrow = _this$props3.withArrow,
393
- trigger = _this$props3.trigger,
394
- mountNode = _this$props3.mountNode,
395
- popoverRef = _this$props3.popoverRef,
396
- disabled = _this$props3.disabled,
397
- onDismiss = _this$props3.onDismiss,
398
- onFocus = _this$props3.onFocus,
399
- onMouseOver = _this$props3.onMouseOver,
400
- offsetX = _this$props3.offsetX,
401
- offsetY = _this$props3.offsetY;
401
+ const _this$props5 = this.props,
402
+ show = _this$props5.show,
403
+ defaultShow = _this$props5.defaultShow,
404
+ placement = _this$props5.placement,
405
+ withArrow = _this$props5.withArrow,
406
+ trigger = _this$props5.trigger,
407
+ mountNode = _this$props5.mountNode,
408
+ popoverRef = _this$props5.popoverRef,
409
+ disabled = _this$props5.disabled,
410
+ onDismiss = _this$props5.onDismiss,
411
+ onFocus = _this$props5.onFocus,
412
+ onMouseOver = _this$props5.onMouseOver,
413
+ offsetX = _this$props5.offsetX,
414
+ offsetY = _this$props5.offsetY;
402
415
  return trigger ? (0, _emotion.jsx)(_Popover.Popover, {
403
416
  isShowingContent: show,
404
417
  defaultIsShowingContent: defaultShow,
405
418
  onHideContent: (event, _ref) => {
406
419
  let documentClick = _ref.documentClick;
407
- onDismiss(event, documentClick);
420
+
421
+ if (typeof onDismiss === 'function') {
422
+ onDismiss(event, documentClick);
423
+ }
424
+
408
425
  this.handleToggle(false);
409
426
  },
410
427
  onShowContent: () => this.handleToggle(true),
@@ -428,6 +445,7 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
428
445
  },
429
446
  renderTrigger: (0, _safeCloneElement.safeCloneElement)(trigger, {
430
447
  ref: el => {
448
+ this._trigger = el;
431
449
  this.ref = el;
432
450
  },
433
451
  'aria-haspopup': true,
@@ -440,25 +458,13 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
440
458
  }
441
459
 
442
460
  }, _class2.displayName = "Menu", _class2.componentId = 'Menu', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
443
- children: null,
444
461
  label: null,
445
462
  disabled: false,
446
463
  trigger: null,
447
464
  placement: 'bottom center',
448
465
  defaultShow: false,
449
- onToggle: (shown, menu) => {},
450
- onSelect: (event, value, selected, item) => {},
451
- onDismiss: (event, documentClick) => {},
452
- onBlur: event => {},
453
- onFocus: event => {},
454
- onMouseOver: event => {},
455
- onKeyDown: event => {},
456
- onKeyUp: event => {},
457
- menuRef: el => {},
458
- popoverRef: el => {},
459
466
  mountNode: null,
460
467
  constrain: 'window',
461
- liveRegion: null,
462
468
  shouldHideOnSelect: true,
463
469
  shouldFocusTriggerOnClose: true,
464
470
  withArrow: true,