@instructure/ui-menu 8.13.1-snapshot.37 → 8.13.1-snapshot.46

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/es/Menu/index.js CHANGED
@@ -93,13 +93,13 @@ let Menu = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
93
93
  this.handleTriggerKeyDown = event => {
94
94
  if (this.props.type === 'flyout' && event.keyCode === keycode.codes.right) {
95
95
  event.persist();
96
- this.show();
96
+ this.show(event);
97
97
  }
98
98
  };
99
99
 
100
- this.handleTriggerMouseOver = () => {
100
+ this.handleTriggerMouseOver = event => {
101
101
  if (this.props.type === 'flyout') {
102
- this.show();
102
+ this.show(event);
103
103
  }
104
104
  };
105
105
 
@@ -195,7 +195,6 @@ let Menu = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
195
195
 
196
196
  this.show = event => {
197
197
  if (this._popover) {
198
- //TODO make events consistents
199
198
  this._popover.show(event);
200
199
  }
201
200
  };
@@ -424,7 +423,7 @@ let Menu = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
424
423
  renderTrigger: safeCloneElement(trigger, {
425
424
  ref: el => {
426
425
  this._trigger = el;
427
- this.ref = el;
426
+ this.ref = (el === null || el === void 0 ? void 0 : el.ref) || el;
428
427
  },
429
428
  'aria-haspopup': true,
430
429
  id: this._labelId,
package/lib/Menu/index.js CHANGED
@@ -115,13 +115,13 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
115
115
  this.handleTriggerKeyDown = event => {
116
116
  if (this.props.type === 'flyout' && event.keyCode === _keycode.default.codes.right) {
117
117
  event.persist();
118
- this.show();
118
+ this.show(event);
119
119
  }
120
120
  };
121
121
 
122
- this.handleTriggerMouseOver = () => {
122
+ this.handleTriggerMouseOver = event => {
123
123
  if (this.props.type === 'flyout') {
124
- this.show();
124
+ this.show(event);
125
125
  }
126
126
  };
127
127
 
@@ -217,7 +217,6 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
217
217
 
218
218
  this.show = event => {
219
219
  if (this._popover) {
220
- //TODO make events consistents
221
220
  this._popover.show(event);
222
221
  }
223
222
  };
@@ -446,7 +445,7 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
446
445
  renderTrigger: (0, _safeCloneElement.safeCloneElement)(trigger, {
447
446
  ref: el => {
448
447
  this._trigger = el;
449
- this.ref = el;
448
+ this.ref = (el === null || el === void 0 ? void 0 : el.ref) || el;
450
449
  },
451
450
  'aria-haspopup': true,
452
451
  id: this._labelId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-menu",
3
- "version": "8.13.1-snapshot.37+cbf65d29c",
3
+ "version": "8.13.1-snapshot.46+e3a9f853c",
4
4
  "description": "A dropdown menu component",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "type": "commonjs",
@@ -24,28 +24,28 @@
24
24
  },
25
25
  "license": "MIT",
26
26
  "devDependencies": {
27
- "@instructure/ui-babel-preset": "8.13.1-snapshot.37+cbf65d29c",
28
- "@instructure/ui-color-utils": "8.13.1-snapshot.37+cbf65d29c",
29
- "@instructure/ui-test-locator": "8.13.1-snapshot.37+cbf65d29c",
30
- "@instructure/ui-test-queries": "8.13.1-snapshot.37+cbf65d29c",
31
- "@instructure/ui-test-utils": "8.13.1-snapshot.37+cbf65d29c",
32
- "@instructure/ui-themes": "8.13.1-snapshot.37+cbf65d29c"
27
+ "@instructure/ui-babel-preset": "8.13.1-snapshot.46+e3a9f853c",
28
+ "@instructure/ui-color-utils": "8.13.1-snapshot.46+e3a9f853c",
29
+ "@instructure/ui-test-locator": "8.13.1-snapshot.46+e3a9f853c",
30
+ "@instructure/ui-test-queries": "8.13.1-snapshot.46+e3a9f853c",
31
+ "@instructure/ui-test-utils": "8.13.1-snapshot.46+e3a9f853c",
32
+ "@instructure/ui-themes": "8.13.1-snapshot.46+e3a9f853c"
33
33
  },
34
34
  "dependencies": {
35
35
  "@babel/runtime": "^7.13.10",
36
- "@instructure/console": "8.13.1-snapshot.37+cbf65d29c",
37
- "@instructure/emotion": "8.13.1-snapshot.37+cbf65d29c",
38
- "@instructure/shared-types": "8.13.1-snapshot.37+cbf65d29c",
39
- "@instructure/ui-a11y-utils": "8.13.1-snapshot.37+cbf65d29c",
40
- "@instructure/ui-dom-utils": "8.13.1-snapshot.37+cbf65d29c",
41
- "@instructure/ui-icons": "8.13.1-snapshot.37+cbf65d29c",
42
- "@instructure/ui-popover": "8.13.1-snapshot.37+cbf65d29c",
43
- "@instructure/ui-position": "8.13.1-snapshot.37+cbf65d29c",
44
- "@instructure/ui-prop-types": "8.13.1-snapshot.37+cbf65d29c",
45
- "@instructure/ui-react-utils": "8.13.1-snapshot.37+cbf65d29c",
46
- "@instructure/ui-testable": "8.13.1-snapshot.37+cbf65d29c",
47
- "@instructure/ui-utils": "8.13.1-snapshot.37+cbf65d29c",
48
- "@instructure/uid": "8.13.1-snapshot.37+cbf65d29c",
36
+ "@instructure/console": "8.13.1-snapshot.46+e3a9f853c",
37
+ "@instructure/emotion": "8.13.1-snapshot.46+e3a9f853c",
38
+ "@instructure/shared-types": "8.13.1-snapshot.46+e3a9f853c",
39
+ "@instructure/ui-a11y-utils": "8.13.1-snapshot.46+e3a9f853c",
40
+ "@instructure/ui-dom-utils": "8.13.1-snapshot.46+e3a9f853c",
41
+ "@instructure/ui-icons": "8.13.1-snapshot.46+e3a9f853c",
42
+ "@instructure/ui-popover": "8.13.1-snapshot.46+e3a9f853c",
43
+ "@instructure/ui-position": "8.13.1-snapshot.46+e3a9f853c",
44
+ "@instructure/ui-prop-types": "8.13.1-snapshot.46+e3a9f853c",
45
+ "@instructure/ui-react-utils": "8.13.1-snapshot.46+e3a9f853c",
46
+ "@instructure/ui-testable": "8.13.1-snapshot.46+e3a9f853c",
47
+ "@instructure/ui-utils": "8.13.1-snapshot.46+e3a9f853c",
48
+ "@instructure/uid": "8.13.1-snapshot.46+e3a9f853c",
49
49
  "keycode": "^2",
50
50
  "prop-types": "^15"
51
51
  },
@@ -56,5 +56,5 @@
56
56
  "access": "public"
57
57
  },
58
58
  "sideEffects": false,
59
- "gitHead": "cbf65d29c90313e0216b5f9c592e90748e65cbf5"
59
+ "gitHead": "e3a9f853c19caa10ebd64106776b10980cc4f391"
60
60
  }
@@ -84,13 +84,14 @@ class Menu extends Component<MenuProps> {
84
84
  _rootNode = null
85
85
  _menuItems: MenuItem[] = []
86
86
  _popover: Popover | null = null
87
- _trigger: MenuItem | (ReactElement & { focus?: () => void }) | null = null
87
+ _trigger: MenuItem | (React.ReactInstance & { focus?: () => void }) | null =
88
+ null
88
89
  _menu: HTMLUListElement | null = null
89
90
  _labelId = uid('Menu__label')
90
91
  _activeSubMenu?: Menu | null
91
92
  _id: string
92
93
 
93
- ref: ReactElement | null = null
94
+ ref: Element | null = null
94
95
 
95
96
  handleRef = (el: HTMLUListElement | null) => {
96
97
  const { menuRef } = this.props
@@ -139,13 +140,13 @@ class Menu extends Component<MenuProps> {
139
140
  handleTriggerKeyDown = (event: React.KeyboardEvent) => {
140
141
  if (this.props.type === 'flyout' && event.keyCode === keycode.codes.right) {
141
142
  event.persist()
142
- this.show()
143
+ this.show(event)
143
144
  }
144
145
  }
145
146
 
146
- handleTriggerMouseOver = () => {
147
+ handleTriggerMouseOver = (event: React.MouseEvent) => {
147
148
  if (this.props.type === 'flyout') {
148
- this.show()
149
+ this.show(event)
149
150
  }
150
151
  }
151
152
 
@@ -155,7 +156,7 @@ class Menu extends Component<MenuProps> {
155
156
  }
156
157
  }
157
158
 
158
- handleMenuKeyDown = (event: React.KeyboardEvent) => {
159
+ handleMenuKeyDown = (event: React.KeyboardEvent<HTMLUListElement>) => {
159
160
  const key = event && event.keyCode
160
161
  const { down, up, tab, left } = keycode.codes
161
162
  const pgdn = keycode.codes['page down']
@@ -232,14 +233,13 @@ class Menu extends Component<MenuProps> {
232
233
 
233
234
  hide = (event: React.MouseEvent | React.KeyboardEvent) => {
234
235
  if (this._popover) {
235
- this._popover.hide(event as unknown as Event)
236
+ this._popover.hide(event)
236
237
  }
237
238
  }
238
239
 
239
- show = (event?: React.MouseEvent | React.KeyboardEvent) => {
240
+ show = (event: React.MouseEvent | React.KeyboardEvent) => {
240
241
  if (this._popover) {
241
- //TODO make events consistents
242
- this._popover.show(event as unknown as Event)
242
+ this._popover.show(event)
243
243
  }
244
244
  }
245
245
 
@@ -470,9 +470,9 @@ class Menu extends Component<MenuProps> {
470
470
  }
471
471
  }}
472
472
  renderTrigger={safeCloneElement(trigger as ReactElement, {
473
- ref: (el: ReactElement) => {
473
+ ref: (el: (React.ReactInstance & { ref?: Element }) | null) => {
474
474
  this._trigger = el
475
- this.ref = el
475
+ this.ref = el?.ref || (el as Element)
476
476
  },
477
477
  'aria-haspopup': true,
478
478
  id: this._labelId,
package/src/Menu/props.ts CHANGED
@@ -22,6 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ import React from 'react'
25
26
  import PropTypes from 'prop-types'
26
27
 
27
28
  import { PositionPropTypes } from '@instructure/ui-position'
@@ -44,7 +45,6 @@ import type {
44
45
  } from '@instructure/ui-position'
45
46
  import type { OnMenuItemSelect } from './MenuItem/props'
46
47
  import type { Popover } from '@instructure/ui-popover'
47
- import React from 'react'
48
48
 
49
49
  type MenuOwnProps = {
50
50
  /**
@@ -87,19 +87,22 @@ type MenuOwnProps = {
87
87
  /**
88
88
  * If a trigger is supplied, callback fired when the `<Menu />` is closed
89
89
  */
90
- onDismiss?: (event: Event, documentClick: boolean) => void
90
+ onDismiss?: (
91
+ event: React.UIEvent | React.FocusEvent,
92
+ documentClick: boolean
93
+ ) => void
91
94
  /**
92
95
  * If a trigger is supplied, callback fired when the `<Menu />` trigger is focused
93
96
  */
94
- onFocus?: (event: Event) => void
97
+ onFocus?: (event: React.FocusEvent) => void
95
98
  /**
96
99
  * If a trigger is supplied, callback fired onMouseOver for the `<Menu />` trigger
97
100
  */
98
- onMouseOver?: (event: Event) => void
101
+ onMouseOver?: (event: React.MouseEvent) => void
99
102
  /**
100
103
  * Callback fired on the onKeyDown of the `<Menu />`
101
104
  */
102
- onKeyDown?: (event: React.KeyboardEvent) => void
105
+ onKeyDown?: (event: React.KeyboardEvent<HTMLUListElement>) => void
103
106
  /**
104
107
  * Callback fired on the onKeyUp of the `<Menu />`
105
108
  */