@instructure/ui-menu 8.16.1-snapshot.2 → 8.17.1-snapshot.14
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 +6 -0
- package/es/Menu/MenuItem/index.js +5 -6
- package/es/Menu/MenuItemGroup/index.js +5 -6
- package/es/Menu/index.js +6 -7
- package/lib/Menu/MenuItem/index.js +6 -6
- package/lib/Menu/MenuItemGroup/index.js +5 -5
- package/lib/Menu/index.js +7 -7
- package/package.json +20 -21
- package/src/Menu/MenuItem/index.tsx +7 -3
- package/src/Menu/MenuItem/props.ts +2 -1
- package/src/Menu/MenuItemGroup/index.tsx +4 -3
- package/src/Menu/MenuItemGroup/props.ts +4 -2
- package/src/Menu/index.tsx +6 -6
- package/src/Menu/props.ts +2 -1
- package/tsconfig.build.json +1 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Menu/MenuItem/index.d.ts.map +1 -1
- package/types/Menu/MenuItem/props.d.ts +2 -1
- package/types/Menu/MenuItem/props.d.ts.map +1 -1
- package/types/Menu/MenuItemGroup/index.d.ts.map +1 -1
- package/types/Menu/MenuItemGroup/props.d.ts +3 -2
- package/types/Menu/MenuItemGroup/props.d.ts.map +1 -1
- package/types/Menu/index.d.ts.map +1 -1
- package/types/Menu/props.d.ts +2 -1
- package/types/Menu/props.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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.17.0](https://github.com/instructure/instructure-ui/compare/v8.16.0...v8.17.0) (2022-02-07)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- remove type:"commonjs" from package.json files ([0b243be](https://github.com/instructure/instructure-ui/commit/0b243bee389ee14493e6b3dbb30a8b660c295d3d))
|
|
11
|
+
|
|
6
12
|
# [8.16.0](https://github.com/instructure/instructure-ui/compare/v8.15.0...v8.16.0) (2022-02-03)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @instructure/ui-menu
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2, _class, _class2, _temp, _IconCheckSolid, _IconArrowOpenEndSoli;
|
|
1
|
+
var _dec, _dec2, _dec3, _class, _class2, _temp, _IconCheckSolid, _IconArrowOpenEndSoli;
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* The MIT License (MIT)
|
|
@@ -28,8 +28,7 @@ var _dec, _dec2, _class, _class2, _temp, _IconCheckSolid, _IconArrowOpenEndSoli;
|
|
|
28
28
|
import { Component } from 'react';
|
|
29
29
|
import keycode from 'keycode';
|
|
30
30
|
import { IconCheckSolid, IconArrowOpenEndSolid } from '@instructure/ui-icons';
|
|
31
|
-
import {
|
|
32
|
-
import { omitProps, getElementType } from '@instructure/ui-react-utils';
|
|
31
|
+
import { omitProps, getElementType, withDeterministicId } from '@instructure/ui-react-utils';
|
|
33
32
|
import { createChainedFunction } from '@instructure/ui-utils';
|
|
34
33
|
import { isActiveElement, findDOMNode } from '@instructure/ui-dom-utils';
|
|
35
34
|
import { testable } from '@instructure/ui-testable';
|
|
@@ -46,7 +45,7 @@ id: Menu.Item
|
|
|
46
45
|
---
|
|
47
46
|
@tsProps
|
|
48
47
|
**/
|
|
49
|
-
let MenuItem = (_dec = withStyle(generateStyle, generateComponentTheme),
|
|
48
|
+
let MenuItem = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_temp = _class2 = class MenuItem extends Component {
|
|
50
49
|
constructor(props) {
|
|
51
50
|
super(props);
|
|
52
51
|
this.labelId = void 0;
|
|
@@ -130,7 +129,7 @@ let MenuItem = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 =
|
|
|
130
129
|
};
|
|
131
130
|
}
|
|
132
131
|
|
|
133
|
-
this.labelId =
|
|
132
|
+
this.labelId = props.deterministicId('MenuItem__label');
|
|
134
133
|
}
|
|
135
134
|
|
|
136
135
|
get _node() {
|
|
@@ -245,6 +244,6 @@ let MenuItem = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 =
|
|
|
245
244
|
}, _class2.displayName = "MenuItem", _class2.componentId = 'Menu.Item', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
246
245
|
type: 'button',
|
|
247
246
|
disabled: false
|
|
248
|
-
}, _class2.contextType = MenuContext, _temp)) || _class) || _class);
|
|
247
|
+
}, _class2.contextType = MenuContext, _temp)) || _class) || _class) || _class);
|
|
249
248
|
export default MenuItem;
|
|
250
249
|
export { MenuItem };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2, _class, _class2, _temp;
|
|
1
|
+
var _dec, _dec2, _dec3, _class, _class2, _temp;
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* The MIT License (MIT)
|
|
@@ -27,8 +27,7 @@ var _dec, _dec2, _class, _class2, _temp;
|
|
|
27
27
|
/** @jsx jsx */
|
|
28
28
|
import React, { Children, Component } from 'react';
|
|
29
29
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
30
|
-
import { omitProps, safeCloneElement, matchComponentTypes } from '@instructure/ui-react-utils';
|
|
31
|
-
import { uid } from '@instructure/uid';
|
|
30
|
+
import { omitProps, safeCloneElement, matchComponentTypes, withDeterministicId } from '@instructure/ui-react-utils';
|
|
32
31
|
import { hasVisibleChildren } from '@instructure/ui-a11y-utils';
|
|
33
32
|
import { testable } from '@instructure/ui-testable';
|
|
34
33
|
import { MenuItem } from '../MenuItem';
|
|
@@ -43,7 +42,7 @@ id: Menu.Group
|
|
|
43
42
|
---
|
|
44
43
|
@tsProps
|
|
45
44
|
**/
|
|
46
|
-
let MenuItemGroup = (_dec = withStyle(generateStyle, generateComponentTheme),
|
|
45
|
+
let MenuItemGroup = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_temp = _class2 = class MenuItemGroup extends Component {
|
|
47
46
|
constructor(props) {
|
|
48
47
|
super(props);
|
|
49
48
|
this._labelId = void 0;
|
|
@@ -97,7 +96,7 @@ let MenuItemGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _d
|
|
|
97
96
|
};
|
|
98
97
|
}
|
|
99
98
|
|
|
100
|
-
this._labelId =
|
|
99
|
+
this._labelId = props.deterministicId('MenuItemGroup');
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
componentDidMount() {
|
|
@@ -201,6 +200,6 @@ let MenuItemGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _d
|
|
|
201
200
|
isTabbable: false,
|
|
202
201
|
allowMultiple: false,
|
|
203
202
|
defaultSelected: []
|
|
204
|
-
}, _temp)) || _class) || _class);
|
|
203
|
+
}, _temp)) || _class) || _class) || _class);
|
|
205
204
|
export default MenuItemGroup;
|
|
206
205
|
export { MenuItemGroup };
|
package/es/Menu/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2, _class, _class2, _temp;
|
|
1
|
+
var _dec, _dec2, _dec3, _class, _class2, _temp;
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* The MIT License (MIT)
|
|
@@ -28,8 +28,7 @@ var _dec, _dec2, _class, _class2, _temp;
|
|
|
28
28
|
import React, { Children, Component } from 'react';
|
|
29
29
|
import keycode from 'keycode';
|
|
30
30
|
import { Popover } from '@instructure/ui-popover';
|
|
31
|
-
import {
|
|
32
|
-
import { safeCloneElement, matchComponentTypes } from '@instructure/ui-react-utils';
|
|
31
|
+
import { safeCloneElement, matchComponentTypes, withDeterministicId } from '@instructure/ui-react-utils';
|
|
33
32
|
import { logError as error } from '@instructure/console';
|
|
34
33
|
import { containsActiveElement } from '@instructure/ui-dom-utils';
|
|
35
34
|
import { testable } from '@instructure/ui-testable';
|
|
@@ -48,7 +47,7 @@ category: components
|
|
|
48
47
|
---
|
|
49
48
|
@tsProps
|
|
50
49
|
**/
|
|
51
|
-
let Menu = (_dec = withStyle(generateStyle, generateComponentTheme),
|
|
50
|
+
let Menu = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_temp = _class2 = class Menu extends Component {
|
|
52
51
|
constructor(props) {
|
|
53
52
|
super(props);
|
|
54
53
|
this.state = {
|
|
@@ -59,7 +58,7 @@ let Menu = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
|
|
|
59
58
|
this._popover = null;
|
|
60
59
|
this._trigger = null;
|
|
61
60
|
this._menu = null;
|
|
62
|
-
this._labelId =
|
|
61
|
+
this._labelId = this.props.deterministicId('Menu__label');
|
|
63
62
|
this._activeSubMenu = void 0;
|
|
64
63
|
this._id = void 0;
|
|
65
64
|
this.ref = null;
|
|
@@ -199,7 +198,7 @@ let Menu = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
|
|
|
199
198
|
}
|
|
200
199
|
};
|
|
201
200
|
|
|
202
|
-
this._id = this.props.id ||
|
|
201
|
+
this._id = this.props.id || props.deterministicId();
|
|
203
202
|
}
|
|
204
203
|
|
|
205
204
|
componentDidMount() {
|
|
@@ -449,6 +448,6 @@ let Menu = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
|
|
|
449
448
|
withArrow: true,
|
|
450
449
|
offsetX: 0,
|
|
451
450
|
offsetY: 0
|
|
452
|
-
}, _class2.Item = MenuItem, _class2.Group = MenuItemGroup, _class2.Separator = MenuItemSeparator, _class2.contextType = MenuContext, _temp)) || _class) || _class);
|
|
451
|
+
}, _class2.Item = MenuItem, _class2.Group = MenuItemGroup, _class2.Separator = MenuItemSeparator, _class2.contextType = MenuContext, _temp)) || _class) || _class) || _class);
|
|
453
452
|
export default Menu;
|
|
454
453
|
export { Menu, MenuItem, MenuItemGroup, MenuItemSeparator };
|
|
@@ -15,12 +15,12 @@ var _IconCheckSolid2 = require("@instructure/ui-icons/lib/IconCheckSolid.js");
|
|
|
15
15
|
|
|
16
16
|
var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/IconArrowOpenEndSolid.js");
|
|
17
17
|
|
|
18
|
-
var _uid = require("@instructure/uid");
|
|
19
|
-
|
|
20
18
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
21
19
|
|
|
22
20
|
var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
|
|
23
21
|
|
|
22
|
+
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
23
|
+
|
|
24
24
|
var _createChainedFunction = require("@instructure/ui-utils/lib/createChainedFunction.js");
|
|
25
25
|
|
|
26
26
|
var _isActiveElement = require("@instructure/ui-dom-utils/lib/isActiveElement.js");
|
|
@@ -39,7 +39,7 @@ var _theme = _interopRequireDefault(require("./theme"));
|
|
|
39
39
|
|
|
40
40
|
var _props = require("./props");
|
|
41
41
|
|
|
42
|
-
var _dec, _dec2, _class, _class2, _temp, _IconCheckSolid, _IconArrowOpenEndSoli;
|
|
42
|
+
var _dec, _dec2, _dec3, _class, _class2, _temp, _IconCheckSolid, _IconArrowOpenEndSoli;
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
---
|
|
@@ -48,7 +48,7 @@ id: Menu.Item
|
|
|
48
48
|
---
|
|
49
49
|
@tsProps
|
|
50
50
|
**/
|
|
51
|
-
let MenuItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
|
|
51
|
+
let MenuItem = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_temp = _class2 = class MenuItem extends _react.Component {
|
|
52
52
|
constructor(props) {
|
|
53
53
|
super(props);
|
|
54
54
|
this.labelId = void 0;
|
|
@@ -132,7 +132,7 @@ let MenuItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
|
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
this.labelId =
|
|
135
|
+
this.labelId = props.deterministicId('MenuItem__label');
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
get _node() {
|
|
@@ -247,7 +247,7 @@ let MenuItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
|
|
|
247
247
|
}, _class2.displayName = "MenuItem", _class2.componentId = 'Menu.Item', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
248
248
|
type: 'button',
|
|
249
249
|
disabled: false
|
|
250
|
-
}, _class2.contextType = _MenuContext.MenuContext, _temp)) || _class) || _class);
|
|
250
|
+
}, _class2.contextType = _MenuContext.MenuContext, _temp)) || _class) || _class) || _class);
|
|
251
251
|
exports.MenuItem = MenuItem;
|
|
252
252
|
var _default = MenuItem;
|
|
253
253
|
exports.default = _default;
|
|
@@ -19,7 +19,7 @@ var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElemen
|
|
|
19
19
|
|
|
20
20
|
var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
23
23
|
|
|
24
24
|
var _hasVisibleChildren = require("@instructure/ui-a11y-utils/lib/hasVisibleChildren.js");
|
|
25
25
|
|
|
@@ -33,7 +33,7 @@ var _theme = _interopRequireDefault(require("./theme"));
|
|
|
33
33
|
|
|
34
34
|
var _props = require("./props");
|
|
35
35
|
|
|
36
|
-
var _dec, _dec2, _class, _class2, _temp;
|
|
36
|
+
var _dec, _dec2, _dec3, _class, _class2, _temp;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
---
|
|
@@ -42,7 +42,7 @@ id: Menu.Group
|
|
|
42
42
|
---
|
|
43
43
|
@tsProps
|
|
44
44
|
**/
|
|
45
|
-
let MenuItemGroup = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
|
|
45
|
+
let MenuItemGroup = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_temp = _class2 = class MenuItemGroup extends _react.Component {
|
|
46
46
|
constructor(props) {
|
|
47
47
|
super(props);
|
|
48
48
|
this._labelId = void 0;
|
|
@@ -96,7 +96,7 @@ let MenuItemGroup = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
this._labelId =
|
|
99
|
+
this._labelId = props.deterministicId('MenuItemGroup');
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
componentDidMount() {
|
|
@@ -202,7 +202,7 @@ let MenuItemGroup = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
202
202
|
isTabbable: false,
|
|
203
203
|
allowMultiple: false,
|
|
204
204
|
defaultSelected: []
|
|
205
|
-
}, _temp)) || _class) || _class);
|
|
205
|
+
}, _temp)) || _class) || _class) || _class);
|
|
206
206
|
exports.MenuItemGroup = MenuItemGroup;
|
|
207
207
|
var _default = MenuItemGroup;
|
|
208
208
|
exports.default = _default;
|
package/lib/Menu/index.js
CHANGED
|
@@ -34,12 +34,12 @@ var _keycode = _interopRequireDefault(require("keycode"));
|
|
|
34
34
|
|
|
35
35
|
var _Popover = require("@instructure/ui-popover/lib/Popover");
|
|
36
36
|
|
|
37
|
-
var _uid = require("@instructure/uid");
|
|
38
|
-
|
|
39
37
|
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
40
38
|
|
|
41
39
|
var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
|
|
42
40
|
|
|
41
|
+
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
42
|
+
|
|
43
43
|
var _console = require("@instructure/console");
|
|
44
44
|
|
|
45
45
|
var _containsActiveElement = require("@instructure/ui-dom-utils/lib/containsActiveElement.js");
|
|
@@ -62,7 +62,7 @@ var _theme = _interopRequireDefault(require("./theme"));
|
|
|
62
62
|
|
|
63
63
|
var _props = require("./props");
|
|
64
64
|
|
|
65
|
-
var _dec, _dec2, _class, _class2, _temp;
|
|
65
|
+
var _dec, _dec2, _dec3, _class, _class2, _temp;
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
---
|
|
@@ -70,7 +70,7 @@ category: components
|
|
|
70
70
|
---
|
|
71
71
|
@tsProps
|
|
72
72
|
**/
|
|
73
|
-
let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
|
|
73
|
+
let Menu = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_temp = _class2 = class Menu extends _react.Component {
|
|
74
74
|
constructor(props) {
|
|
75
75
|
super(props);
|
|
76
76
|
this.state = {
|
|
@@ -81,7 +81,7 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
81
81
|
this._popover = null;
|
|
82
82
|
this._trigger = null;
|
|
83
83
|
this._menu = null;
|
|
84
|
-
this._labelId =
|
|
84
|
+
this._labelId = this.props.deterministicId('Menu__label');
|
|
85
85
|
this._activeSubMenu = void 0;
|
|
86
86
|
this._id = void 0;
|
|
87
87
|
this.ref = null;
|
|
@@ -221,7 +221,7 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
221
221
|
}
|
|
222
222
|
};
|
|
223
223
|
|
|
224
|
-
this._id = this.props.id ||
|
|
224
|
+
this._id = this.props.id || props.deterministicId();
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
componentDidMount() {
|
|
@@ -471,7 +471,7 @@ let Menu = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
471
471
|
withArrow: true,
|
|
472
472
|
offsetX: 0,
|
|
473
473
|
offsetY: 0
|
|
474
|
-
}, _class2.Item = _MenuItem.MenuItem, _class2.Group = _MenuItemGroup.MenuItemGroup, _class2.Separator = _MenuItemSeparator.MenuItemSeparator, _class2.contextType = _MenuContext.MenuContext, _temp)) || _class) || _class);
|
|
474
|
+
}, _class2.Item = _MenuItem.MenuItem, _class2.Group = _MenuItemGroup.MenuItemGroup, _class2.Separator = _MenuItemSeparator.MenuItemSeparator, _class2.contextType = _MenuContext.MenuContext, _temp)) || _class) || _class) || _class);
|
|
475
475
|
exports.Menu = Menu;
|
|
476
476
|
var _default = Menu;
|
|
477
477
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-menu",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.17.1-snapshot.14+f0b03679c",
|
|
4
4
|
"description": "A dropdown menu component",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,28 +23,27 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.
|
|
27
|
-
"@instructure/ui-color-utils": "8.
|
|
28
|
-
"@instructure/ui-test-locator": "8.
|
|
29
|
-
"@instructure/ui-test-queries": "8.
|
|
30
|
-
"@instructure/ui-test-utils": "8.
|
|
31
|
-
"@instructure/ui-themes": "8.
|
|
26
|
+
"@instructure/ui-babel-preset": "8.17.1-snapshot.14+f0b03679c",
|
|
27
|
+
"@instructure/ui-color-utils": "8.17.1-snapshot.14+f0b03679c",
|
|
28
|
+
"@instructure/ui-test-locator": "8.17.1-snapshot.14+f0b03679c",
|
|
29
|
+
"@instructure/ui-test-queries": "8.17.1-snapshot.14+f0b03679c",
|
|
30
|
+
"@instructure/ui-test-utils": "8.17.1-snapshot.14+f0b03679c",
|
|
31
|
+
"@instructure/ui-themes": "8.17.1-snapshot.14+f0b03679c"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.13.10",
|
|
35
|
-
"@instructure/console": "8.
|
|
36
|
-
"@instructure/emotion": "8.
|
|
37
|
-
"@instructure/shared-types": "8.
|
|
38
|
-
"@instructure/ui-a11y-utils": "8.
|
|
39
|
-
"@instructure/ui-dom-utils": "8.
|
|
40
|
-
"@instructure/ui-icons": "8.
|
|
41
|
-
"@instructure/ui-popover": "8.
|
|
42
|
-
"@instructure/ui-position": "8.
|
|
43
|
-
"@instructure/ui-prop-types": "8.
|
|
44
|
-
"@instructure/ui-react-utils": "8.
|
|
45
|
-
"@instructure/ui-testable": "8.
|
|
46
|
-
"@instructure/ui-utils": "8.
|
|
47
|
-
"@instructure/uid": "8.16.1-snapshot.2+25359e770",
|
|
35
|
+
"@instructure/console": "8.17.1-snapshot.14+f0b03679c",
|
|
36
|
+
"@instructure/emotion": "8.17.1-snapshot.14+f0b03679c",
|
|
37
|
+
"@instructure/shared-types": "8.17.1-snapshot.14+f0b03679c",
|
|
38
|
+
"@instructure/ui-a11y-utils": "8.17.1-snapshot.14+f0b03679c",
|
|
39
|
+
"@instructure/ui-dom-utils": "8.17.1-snapshot.14+f0b03679c",
|
|
40
|
+
"@instructure/ui-icons": "8.17.1-snapshot.14+f0b03679c",
|
|
41
|
+
"@instructure/ui-popover": "8.17.1-snapshot.14+f0b03679c",
|
|
42
|
+
"@instructure/ui-position": "8.17.1-snapshot.14+f0b03679c",
|
|
43
|
+
"@instructure/ui-prop-types": "8.17.1-snapshot.14+f0b03679c",
|
|
44
|
+
"@instructure/ui-react-utils": "8.17.1-snapshot.14+f0b03679c",
|
|
45
|
+
"@instructure/ui-testable": "8.17.1-snapshot.14+f0b03679c",
|
|
46
|
+
"@instructure/ui-utils": "8.17.1-snapshot.14+f0b03679c",
|
|
48
47
|
"keycode": "^2",
|
|
49
48
|
"prop-types": "^15"
|
|
50
49
|
},
|
|
@@ -55,5 +54,5 @@
|
|
|
55
54
|
"access": "public"
|
|
56
55
|
},
|
|
57
56
|
"sideEffects": false,
|
|
58
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "f0b03679c4c4d05d4d650d22646ac1dc6791e935"
|
|
59
58
|
}
|
|
@@ -26,8 +26,11 @@ import { Component } from 'react'
|
|
|
26
26
|
import keycode from 'keycode'
|
|
27
27
|
|
|
28
28
|
import { IconCheckSolid, IconArrowOpenEndSolid } from '@instructure/ui-icons'
|
|
29
|
-
import {
|
|
30
|
-
|
|
29
|
+
import {
|
|
30
|
+
omitProps,
|
|
31
|
+
getElementType,
|
|
32
|
+
withDeterministicId
|
|
33
|
+
} from '@instructure/ui-react-utils'
|
|
31
34
|
import { createChainedFunction } from '@instructure/ui-utils'
|
|
32
35
|
import { isActiveElement, findDOMNode } from '@instructure/ui-dom-utils'
|
|
33
36
|
import { testable } from '@instructure/ui-testable'
|
|
@@ -48,6 +51,7 @@ id: Menu.Item
|
|
|
48
51
|
---
|
|
49
52
|
@tsProps
|
|
50
53
|
**/
|
|
54
|
+
@withDeterministicId()
|
|
51
55
|
@withStyle(generateStyle, generateComponentTheme)
|
|
52
56
|
@testable()
|
|
53
57
|
class MenuItem extends Component<MenuItemProps, MenuItemState> {
|
|
@@ -71,7 +75,7 @@ class MenuItem extends Component<MenuItemProps, MenuItemState> {
|
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
77
|
|
|
74
|
-
this.labelId =
|
|
78
|
+
this.labelId = props.deterministicId!('MenuItem__label')
|
|
75
79
|
}
|
|
76
80
|
|
|
77
81
|
get _node() {
|
|
@@ -34,6 +34,7 @@ import type {
|
|
|
34
34
|
OtherHTMLAttributes
|
|
35
35
|
} from '@instructure/shared-types'
|
|
36
36
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
37
|
+
import type { WithDeterministicIdProps } from '@instructure/ui-react-utils'
|
|
37
38
|
|
|
38
39
|
type OnMenuItemSelect = (
|
|
39
40
|
e: React.MouseEvent,
|
|
@@ -83,7 +84,7 @@ type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
|
83
84
|
|
|
84
85
|
type MenuItemProps = MenuItemOwnProps &
|
|
85
86
|
WithStyleProps<MenuItemTheme, MenuItemStyle> &
|
|
86
|
-
OtherHTMLAttributes<MenuItemOwnProps>
|
|
87
|
+
OtherHTMLAttributes<MenuItemOwnProps> & WithDeterministicIdProps
|
|
87
88
|
|
|
88
89
|
type MenuItemStyle = ComponentStyle<'menuItem' | 'icon' | 'label'>
|
|
89
90
|
|
|
@@ -29,9 +29,9 @@ import { withStyle, jsx } from '@instructure/emotion'
|
|
|
29
29
|
import {
|
|
30
30
|
omitProps,
|
|
31
31
|
safeCloneElement,
|
|
32
|
-
matchComponentTypes
|
|
32
|
+
matchComponentTypes,
|
|
33
|
+
withDeterministicId
|
|
33
34
|
} from '@instructure/ui-react-utils'
|
|
34
|
-
import { uid } from '@instructure/uid'
|
|
35
35
|
import { hasVisibleChildren } from '@instructure/ui-a11y-utils'
|
|
36
36
|
import { testable } from '@instructure/ui-testable'
|
|
37
37
|
|
|
@@ -59,6 +59,7 @@ id: Menu.Group
|
|
|
59
59
|
---
|
|
60
60
|
@tsProps
|
|
61
61
|
**/
|
|
62
|
+
@withDeterministicId()
|
|
62
63
|
@withStyle(generateStyle, generateComponentTheme)
|
|
63
64
|
@testable()
|
|
64
65
|
class MenuItemGroup extends Component<MenuGroupProps, MenuGroupState> {
|
|
@@ -83,7 +84,7 @@ class MenuItemGroup extends Component<MenuGroupProps, MenuGroupState> {
|
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
this._labelId =
|
|
87
|
+
this._labelId = props.deterministicId!('MenuItemGroup')
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
private _labelId: string
|
|
@@ -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 {
|
|
@@ -39,7 +40,7 @@ import type {
|
|
|
39
40
|
} from '@instructure/shared-types'
|
|
40
41
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
41
42
|
import type { MenuItemProps } from '../MenuItem/props'
|
|
42
|
-
import
|
|
43
|
+
import type { WithDeterministicIdProps } from '@instructure/ui-react-utils'
|
|
43
44
|
|
|
44
45
|
type MenuGroupOwnProps = {
|
|
45
46
|
label: React.ReactNode
|
|
@@ -87,7 +88,8 @@ type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
|
87
88
|
|
|
88
89
|
type MenuGroupProps = MenuGroupOwnProps &
|
|
89
90
|
WithStyleProps<MenuGroupTheme, MenuGroupStyle> &
|
|
90
|
-
OtherHTMLAttributes<MenuGroupOwnProps>
|
|
91
|
+
OtherHTMLAttributes<MenuGroupOwnProps> &
|
|
92
|
+
WithDeterministicIdProps
|
|
91
93
|
|
|
92
94
|
type MenuGroupStyle = ComponentStyle<'menuItemGroup' | 'label' | 'items'>
|
|
93
95
|
|
package/src/Menu/index.tsx
CHANGED
|
@@ -26,10 +26,10 @@ import React, { Children, Component, ReactElement } from 'react'
|
|
|
26
26
|
import keycode from 'keycode'
|
|
27
27
|
|
|
28
28
|
import { Popover } from '@instructure/ui-popover'
|
|
29
|
-
import { uid } from '@instructure/uid'
|
|
30
29
|
import {
|
|
31
30
|
safeCloneElement,
|
|
32
|
-
matchComponentTypes
|
|
31
|
+
matchComponentTypes,
|
|
32
|
+
withDeterministicId
|
|
33
33
|
} from '@instructure/ui-react-utils'
|
|
34
34
|
import { logError as error } from '@instructure/console'
|
|
35
35
|
import { containsActiveElement } from '@instructure/ui-dom-utils'
|
|
@@ -64,11 +64,11 @@ category: components
|
|
|
64
64
|
---
|
|
65
65
|
@tsProps
|
|
66
66
|
**/
|
|
67
|
+
@withDeterministicId()
|
|
67
68
|
@withStyle(generateStyle, generateComponentTheme)
|
|
68
69
|
@testable()
|
|
69
70
|
class Menu extends Component<MenuProps> {
|
|
70
71
|
static readonly componentId = 'Menu'
|
|
71
|
-
|
|
72
72
|
static propTypes = propTypes
|
|
73
73
|
static allowedProps = allowedProps
|
|
74
74
|
static defaultProps = {
|
|
@@ -97,7 +97,8 @@ class Menu extends Component<MenuProps> {
|
|
|
97
97
|
_trigger: MenuItem | (React.ReactInstance & { focus?: () => void }) | null =
|
|
98
98
|
null
|
|
99
99
|
_menu: HTMLUListElement | null = null
|
|
100
|
-
_labelId =
|
|
100
|
+
_labelId = this.props.deterministicId!('Menu__label')
|
|
101
|
+
|
|
101
102
|
_activeSubMenu?: Menu | null
|
|
102
103
|
_id: string
|
|
103
104
|
|
|
@@ -114,9 +115,8 @@ class Menu extends Component<MenuProps> {
|
|
|
114
115
|
constructor(props: MenuProps) {
|
|
115
116
|
super(props)
|
|
116
117
|
|
|
117
|
-
this._id = this.props.id ||
|
|
118
|
+
this._id = this.props.id || props.deterministicId!()
|
|
118
119
|
}
|
|
119
|
-
|
|
120
120
|
componentDidMount() {
|
|
121
121
|
this.props.makeStyles?.()
|
|
122
122
|
}
|
package/src/Menu/props.ts
CHANGED
|
@@ -43,6 +43,7 @@ import type {
|
|
|
43
43
|
PositionMountNode
|
|
44
44
|
} from '@instructure/ui-position'
|
|
45
45
|
import type { Popover } from '@instructure/ui-popover'
|
|
46
|
+
import type { WithDeterministicIdProps } from '@instructure/ui-react-utils'
|
|
46
47
|
|
|
47
48
|
import { MenuItem } from './MenuItem'
|
|
48
49
|
import type { Menu } from './index'
|
|
@@ -171,7 +172,7 @@ type MenuProps = MenuOwnProps &
|
|
|
171
172
|
// controls can be passed in renderChildren and used later as aria-controls
|
|
172
173
|
Omit<OtherHTMLAttributes<MenuOwnProps>, 'controls'> & {
|
|
173
174
|
controls?: React.AriaAttributes['aria-controls']
|
|
174
|
-
}
|
|
175
|
+
} & WithDeterministicIdProps
|
|
175
176
|
|
|
176
177
|
type MenuStyle = ComponentStyle<'menu'>
|
|
177
178
|
|
package/tsconfig.build.json
CHANGED
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
{ "path": "../ui-prop-types/tsconfig.build.json" },
|
|
25
25
|
{ "path": "../ui-react-utils/tsconfig.build.json" },
|
|
26
26
|
{ "path": "../ui-testable/tsconfig.build.json" },
|
|
27
|
-
{ "path": "../ui-utils/tsconfig.build.json" }
|
|
28
|
-
{ "path": "../uid/tsconfig.build.json" }
|
|
27
|
+
{ "path": "../ui-utils/tsconfig.build.json" }
|
|
29
28
|
]
|
|
30
29
|
}
|