@instructure/ui-menu 8.22.0 → 8.22.1-snapshot.21

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 ADDED
@@ -0,0 +1,27 @@
1
+ ---
2
+ title: The MIT License (MIT)
3
+ category: Getting Started
4
+ order: 9
5
+ ---
6
+
7
+ # The MIT License (MIT)
8
+
9
+ Copyright (c) 2015 Instructure, Inc.
10
+
11
+ **Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions.**
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
package/es/Menu/index.js CHANGED
@@ -69,6 +69,11 @@ let Menu = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gener
69
69
 
70
70
  if (typeof menuRef === 'function') {
71
71
  menuRef(el);
72
+ } // If there is no trigger `<ul>` is the ref, otherwise the trigger
73
+
74
+
75
+ if (!this.props.trigger) {
76
+ this.ref = el;
72
77
  }
73
78
  };
74
79
 
@@ -414,6 +419,9 @@ let Menu = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gener
414
419
  onMouseOver: onMouseOver,
415
420
  offsetX: offsetX,
416
421
  offsetY: offsetY,
422
+ elementRef: element => {
423
+ this.ref = element;
424
+ },
417
425
  ref: el => {
418
426
  this._popover = el;
419
427
 
@@ -424,7 +432,6 @@ let Menu = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gener
424
432
  renderTrigger: safeCloneElement(trigger, {
425
433
  ref: el => {
426
434
  this._trigger = el;
427
- this.ref = (el === null || el === void 0 ? void 0 : el.ref) || el;
428
435
  },
429
436
  'aria-haspopup': true,
430
437
  id: this._labelId,
package/lib/Menu/index.js CHANGED
@@ -92,6 +92,11 @@ let Menu = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0,
92
92
 
93
93
  if (typeof menuRef === 'function') {
94
94
  menuRef(el);
95
+ } // If there is no trigger `<ul>` is the ref, otherwise the trigger
96
+
97
+
98
+ if (!this.props.trigger) {
99
+ this.ref = el;
95
100
  }
96
101
  };
97
102
 
@@ -437,6 +442,9 @@ let Menu = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0,
437
442
  onMouseOver: onMouseOver,
438
443
  offsetX: offsetX,
439
444
  offsetY: offsetY,
445
+ elementRef: element => {
446
+ this.ref = element;
447
+ },
440
448
  ref: el => {
441
449
  this._popover = el;
442
450
 
@@ -447,7 +455,6 @@ let Menu = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0,
447
455
  renderTrigger: (0, _safeCloneElement.safeCloneElement)(trigger, {
448
456
  ref: el => {
449
457
  this._trigger = el;
450
- this.ref = (el === null || el === void 0 ? void 0 : el.ref) || el;
451
458
  },
452
459
  'aria-haspopup': true,
453
460
  id: this._labelId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-menu",
3
- "version": "8.22.0",
3
+ "version": "8.22.1-snapshot.21+7bdf07c83",
4
4
  "description": "A dropdown menu component",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -23,27 +23,27 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-babel-preset": "8.22.0",
27
- "@instructure/ui-color-utils": "8.22.0",
28
- "@instructure/ui-test-locator": "8.22.0",
29
- "@instructure/ui-test-queries": "8.22.0",
30
- "@instructure/ui-test-utils": "8.22.0",
31
- "@instructure/ui-themes": "8.22.0"
26
+ "@instructure/ui-babel-preset": "8.22.1-snapshot.21+7bdf07c83",
27
+ "@instructure/ui-color-utils": "8.22.1-snapshot.21+7bdf07c83",
28
+ "@instructure/ui-test-locator": "8.22.1-snapshot.21+7bdf07c83",
29
+ "@instructure/ui-test-queries": "8.22.1-snapshot.21+7bdf07c83",
30
+ "@instructure/ui-test-utils": "8.22.1-snapshot.21+7bdf07c83",
31
+ "@instructure/ui-themes": "8.22.1-snapshot.21+7bdf07c83"
32
32
  },
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.13.10",
35
- "@instructure/console": "8.22.0",
36
- "@instructure/emotion": "8.22.0",
37
- "@instructure/shared-types": "8.22.0",
38
- "@instructure/ui-a11y-utils": "8.22.0",
39
- "@instructure/ui-dom-utils": "8.22.0",
40
- "@instructure/ui-icons": "8.22.0",
41
- "@instructure/ui-popover": "8.22.0",
42
- "@instructure/ui-position": "8.22.0",
43
- "@instructure/ui-prop-types": "8.22.0",
44
- "@instructure/ui-react-utils": "8.22.0",
45
- "@instructure/ui-testable": "8.22.0",
46
- "@instructure/ui-utils": "8.22.0",
35
+ "@instructure/console": "8.22.1-snapshot.21+7bdf07c83",
36
+ "@instructure/emotion": "8.22.1-snapshot.21+7bdf07c83",
37
+ "@instructure/shared-types": "8.22.1-snapshot.21+7bdf07c83",
38
+ "@instructure/ui-a11y-utils": "8.22.1-snapshot.21+7bdf07c83",
39
+ "@instructure/ui-dom-utils": "8.22.1-snapshot.21+7bdf07c83",
40
+ "@instructure/ui-icons": "8.22.1-snapshot.21+7bdf07c83",
41
+ "@instructure/ui-popover": "8.22.1-snapshot.21+7bdf07c83",
42
+ "@instructure/ui-position": "8.22.1-snapshot.21+7bdf07c83",
43
+ "@instructure/ui-prop-types": "8.22.1-snapshot.21+7bdf07c83",
44
+ "@instructure/ui-react-utils": "8.22.1-snapshot.21+7bdf07c83",
45
+ "@instructure/ui-testable": "8.22.1-snapshot.21+7bdf07c83",
46
+ "@instructure/ui-utils": "8.22.1-snapshot.21+7bdf07c83",
47
47
  "keycode": "^2",
48
48
  "prop-types": "^15"
49
49
  },
@@ -53,5 +53,6 @@
53
53
  "publishConfig": {
54
54
  "access": "public"
55
55
  },
56
- "sideEffects": false
56
+ "sideEffects": false,
57
+ "gitHead": "7bdf07c834ffb614098415cbe0e3df6c0f6efdfb"
57
58
  }
@@ -110,6 +110,10 @@ class Menu extends Component<MenuProps> {
110
110
  if (typeof menuRef === 'function') {
111
111
  menuRef(el)
112
112
  }
113
+ // If there is no trigger `<ul>` is the ref, otherwise the trigger
114
+ if (!this.props.trigger) {
115
+ this.ref = el
116
+ }
113
117
  }
114
118
 
115
119
  constructor(props: MenuProps) {
@@ -487,6 +491,9 @@ class Menu extends Component<MenuProps> {
487
491
  onMouseOver={onMouseOver}
488
492
  offsetX={offsetX}
489
493
  offsetY={offsetY}
494
+ elementRef={(element) => {
495
+ this.ref = element
496
+ }}
490
497
  ref={(el) => {
491
498
  this._popover = el
492
499
  if (typeof popoverRef === 'function') {
@@ -496,7 +503,6 @@ class Menu extends Component<MenuProps> {
496
503
  renderTrigger={safeCloneElement(trigger as ReactElement, {
497
504
  ref: (el: (React.ReactInstance & { ref?: Element }) | null) => {
498
505
  this._trigger = el
499
- this.ref = el?.ref || (el as Element)
500
506
  },
501
507
  'aria-haspopup': true,
502
508
  id: this._labelId,
package/src/Menu/props.ts CHANGED
@@ -55,7 +55,8 @@ type MenuOwnProps = {
55
55
  */
56
56
  children?: React.ReactNode // TODO: oneOf(['MenuItem', 'MenuItemGroup', 'MenuItemSeparator', 'Menu'])
57
57
  /**
58
- * Description of the `<Menu />`
58
+ * Description of the `<Menu />`. The component uses it to add its value to
59
+ * the `aria-label` attribute.
59
60
  */
60
61
  label?: string
61
62
  /**