@instructure/ui-menu 11.6.0 → 11.6.1-snapshot-129
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 +41 -297
- package/es/Menu/{MenuItem → v1/MenuItem}/index.js +2 -2
- package/es/Menu/{MenuItemGroup → v1/MenuItemGroup}/index.js +1 -1
- package/es/Menu/{MenuItemSeparator → v1/MenuItemSeparator}/index.js +1 -1
- package/es/Menu/{index.js → v1/index.js} +3 -3
- package/es/Menu/v2/MenuItem/index.js +262 -0
- package/es/Menu/v2/MenuItem/props.js +26 -0
- package/es/Menu/v2/MenuItem/styles.js +146 -0
- package/es/Menu/v2/MenuItemGroup/index.js +175 -0
- package/es/Menu/v2/MenuItemGroup/props.js +26 -0
- package/es/Menu/v2/MenuItemGroup/styles.js +60 -0
- package/es/Menu/v2/MenuItemSeparator/index.js +70 -0
- package/es/Menu/v2/MenuItemSeparator/props.js +29 -0
- package/es/Menu/v2/MenuItemSeparator/styles.js +46 -0
- package/es/Menu/v2/index.js +405 -0
- package/es/Menu/v2/props.js +26 -0
- package/es/Menu/v2/styles.js +61 -0
- package/es/{index.js → exports/a.js} +1 -1
- package/es/exports/b.js +24 -0
- package/es/{MenuContext.js → utils/v1/MenuContext.js} +2 -0
- package/lib/Menu/{MenuItem → v1/MenuItem}/index.js +4 -4
- package/lib/Menu/{MenuItemGroup → v1/MenuItemGroup}/index.js +1 -1
- package/lib/Menu/{MenuItemSeparator → v1/MenuItemSeparator}/index.js +1 -1
- package/lib/Menu/v1/index.js +432 -0
- package/lib/Menu/v2/MenuItem/index.js +271 -0
- package/lib/Menu/v2/MenuItem/props.js +31 -0
- package/lib/Menu/v2/MenuItem/styles.js +152 -0
- package/lib/Menu/v2/MenuItemGroup/index.js +183 -0
- package/lib/Menu/v2/MenuItemGroup/props.js +31 -0
- package/lib/Menu/v2/MenuItemGroup/styles.js +66 -0
- package/lib/Menu/v2/MenuItemSeparator/index.js +75 -0
- package/lib/Menu/v2/MenuItemSeparator/props.js +34 -0
- package/lib/Menu/v2/MenuItemSeparator/styles.js +52 -0
- package/lib/Menu/{index.js → v2/index.js} +4 -5
- package/lib/Menu/v2/props.js +31 -0
- package/lib/Menu/v2/styles.js +66 -0
- package/lib/{index.js → exports/a.js} +5 -5
- package/lib/exports/b.js +30 -0
- package/lib/{MenuContext.js → utils/v1/MenuContext.js} +1 -0
- package/package.json +45 -23
- package/src/Menu/{MenuItem → v1/MenuItem}/index.tsx +2 -2
- package/src/Menu/{MenuItemGroup → v1/MenuItemGroup}/index.tsx +1 -1
- package/src/Menu/{MenuItemSeparator → v1/MenuItemSeparator}/index.tsx +1 -1
- package/src/Menu/{index.tsx → v1/index.tsx} +3 -3
- package/src/Menu/{props.ts → v1/props.ts} +1 -1
- package/src/Menu/v2/MenuItem/index.tsx +318 -0
- package/src/Menu/v2/MenuItem/props.ts +132 -0
- package/src/Menu/v2/MenuItem/styles.ts +172 -0
- package/src/Menu/v2/MenuItemGroup/index.tsx +245 -0
- package/src/Menu/v2/MenuItemGroup/props.ts +105 -0
- package/src/Menu/v2/MenuItemGroup/styles.ts +66 -0
- package/src/Menu/v2/MenuItemSeparator/index.tsx +79 -0
- package/src/Menu/v2/MenuItemSeparator/props.ts +48 -0
- package/src/Menu/v2/MenuItemSeparator/styles.ts +52 -0
- package/src/Menu/v2/README.md +104 -0
- package/src/Menu/v2/index.tsx +514 -0
- package/src/Menu/v2/props.ts +213 -0
- package/src/Menu/v2/styles.ts +68 -0
- package/src/{index.ts → exports/a.ts} +5 -5
- package/src/exports/b.ts +29 -0
- package/src/{MenuContext.ts → utils/v1/MenuContext.ts} +3 -3
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Menu/{MenuItem → v1/MenuItem}/index.d.ts +3 -3
- package/types/Menu/v1/MenuItem/index.d.ts.map +1 -0
- package/types/Menu/v1/MenuItem/props.d.ts.map +1 -0
- package/types/Menu/v1/MenuItem/styles.d.ts.map +1 -0
- package/types/Menu/v1/MenuItem/theme.d.ts.map +1 -0
- package/types/Menu/v1/MenuItemGroup/index.d.ts.map +1 -0
- package/types/Menu/v1/MenuItemGroup/props.d.ts.map +1 -0
- package/types/Menu/v1/MenuItemGroup/styles.d.ts.map +1 -0
- package/types/Menu/v1/MenuItemGroup/theme.d.ts.map +1 -0
- package/types/Menu/v1/MenuItemSeparator/index.d.ts.map +1 -0
- package/types/Menu/v1/MenuItemSeparator/props.d.ts.map +1 -0
- package/types/Menu/v1/MenuItemSeparator/styles.d.ts.map +1 -0
- package/types/Menu/v1/MenuItemSeparator/theme.d.ts.map +1 -0
- package/types/Menu/{index.d.ts → v1/index.d.ts} +3 -3
- package/types/Menu/v1/index.d.ts.map +1 -0
- package/types/Menu/{props.d.ts → v1/props.d.ts} +1 -1
- package/types/Menu/v1/props.d.ts.map +1 -0
- package/types/Menu/v1/styles.d.ts.map +1 -0
- package/types/Menu/v1/theme.d.ts.map +1 -0
- package/types/Menu/v2/MenuItem/index.d.ts +66 -0
- package/types/Menu/v2/MenuItem/index.d.ts.map +1 -0
- package/types/Menu/v2/MenuItem/props.d.ts +73 -0
- package/types/Menu/v2/MenuItem/props.d.ts.map +1 -0
- package/types/Menu/v2/MenuItem/styles.d.ts +15 -0
- package/types/Menu/v2/MenuItem/styles.d.ts.map +1 -0
- package/types/Menu/v2/MenuItemGroup/index.d.ts +52 -0
- package/types/Menu/v2/MenuItemGroup/index.d.ts.map +1 -0
- package/types/Menu/v2/MenuItemGroup/props.d.ts +51 -0
- package/types/Menu/v2/MenuItemGroup/props.d.ts.map +1 -0
- package/types/Menu/v2/MenuItemGroup/styles.d.ts +15 -0
- package/types/Menu/v2/MenuItemGroup/styles.d.ts.map +1 -0
- package/types/Menu/v2/MenuItemSeparator/index.d.ts +21 -0
- package/types/Menu/v2/MenuItemSeparator/index.d.ts.map +1 -0
- package/types/Menu/v2/MenuItemSeparator/props.d.ts +11 -0
- package/types/Menu/v2/MenuItemSeparator/props.d.ts.map +1 -0
- package/types/Menu/v2/MenuItemSeparator/styles.d.ts +15 -0
- package/types/Menu/v2/MenuItemSeparator/styles.d.ts.map +1 -0
- package/types/Menu/v2/index.d.ts +118 -0
- package/types/Menu/v2/index.d.ts.map +1 -0
- package/types/Menu/v2/props.d.ts +138 -0
- package/types/Menu/v2/props.d.ts.map +1 -0
- package/types/Menu/v2/styles.d.ts +15 -0
- package/types/Menu/v2/styles.d.ts.map +1 -0
- package/types/exports/a.d.ts +6 -0
- package/types/exports/a.d.ts.map +1 -0
- package/types/exports/b.d.ts +6 -0
- package/types/exports/b.d.ts.map +1 -0
- package/types/utils/v1/MenuContext.d.ts +13 -0
- package/types/utils/v1/MenuContext.d.ts.map +1 -0
- package/types/Menu/MenuItem/index.d.ts.map +0 -1
- package/types/Menu/MenuItem/props.d.ts.map +0 -1
- package/types/Menu/MenuItem/styles.d.ts.map +0 -1
- package/types/Menu/MenuItem/theme.d.ts.map +0 -1
- package/types/Menu/MenuItemGroup/index.d.ts.map +0 -1
- package/types/Menu/MenuItemGroup/props.d.ts.map +0 -1
- package/types/Menu/MenuItemGroup/styles.d.ts.map +0 -1
- package/types/Menu/MenuItemGroup/theme.d.ts.map +0 -1
- package/types/Menu/MenuItemSeparator/index.d.ts.map +0 -1
- package/types/Menu/MenuItemSeparator/props.d.ts.map +0 -1
- package/types/Menu/MenuItemSeparator/styles.d.ts.map +0 -1
- package/types/Menu/MenuItemSeparator/theme.d.ts.map +0 -1
- package/types/Menu/index.d.ts.map +0 -1
- package/types/Menu/props.d.ts.map +0 -1
- package/types/Menu/styles.d.ts.map +0 -1
- package/types/Menu/theme.d.ts.map +0 -1
- package/types/MenuContext.d.ts +0 -14
- package/types/MenuContext.d.ts.map +0 -1
- package/types/index.d.ts +0 -6
- package/types/index.d.ts.map +0 -1
- /package/es/Menu/{MenuItem → v1/MenuItem}/props.js +0 -0
- /package/es/Menu/{MenuItem → v1/MenuItem}/styles.js +0 -0
- /package/es/Menu/{MenuItem → v1/MenuItem}/theme.js +0 -0
- /package/es/Menu/{MenuItemGroup → v1/MenuItemGroup}/props.js +0 -0
- /package/es/Menu/{MenuItemGroup → v1/MenuItemGroup}/styles.js +0 -0
- /package/es/Menu/{MenuItemGroup → v1/MenuItemGroup}/theme.js +0 -0
- /package/es/Menu/{MenuItemSeparator → v1/MenuItemSeparator}/props.js +0 -0
- /package/es/Menu/{MenuItemSeparator → v1/MenuItemSeparator}/styles.js +0 -0
- /package/es/Menu/{MenuItemSeparator → v1/MenuItemSeparator}/theme.js +0 -0
- /package/es/Menu/{props.js → v1/props.js} +0 -0
- /package/es/Menu/{styles.js → v1/styles.js} +0 -0
- /package/es/Menu/{theme.js → v1/theme.js} +0 -0
- /package/lib/Menu/{MenuItem → v1/MenuItem}/props.js +0 -0
- /package/lib/Menu/{MenuItem → v1/MenuItem}/styles.js +0 -0
- /package/lib/Menu/{MenuItem → v1/MenuItem}/theme.js +0 -0
- /package/lib/Menu/{MenuItemGroup → v1/MenuItemGroup}/props.js +0 -0
- /package/lib/Menu/{MenuItemGroup → v1/MenuItemGroup}/styles.js +0 -0
- /package/lib/Menu/{MenuItemGroup → v1/MenuItemGroup}/theme.js +0 -0
- /package/lib/Menu/{MenuItemSeparator → v1/MenuItemSeparator}/props.js +0 -0
- /package/lib/Menu/{MenuItemSeparator → v1/MenuItemSeparator}/styles.js +0 -0
- /package/lib/Menu/{MenuItemSeparator → v1/MenuItemSeparator}/theme.js +0 -0
- /package/lib/Menu/{props.js → v1/props.js} +0 -0
- /package/lib/Menu/{styles.js → v1/styles.js} +0 -0
- /package/lib/Menu/{theme.js → v1/theme.js} +0 -0
- /package/src/Menu/{MenuItem → v1/MenuItem}/props.ts +0 -0
- /package/src/Menu/{MenuItem → v1/MenuItem}/styles.ts +0 -0
- /package/src/Menu/{MenuItem → v1/MenuItem}/theme.ts +0 -0
- /package/src/Menu/{MenuItemGroup → v1/MenuItemGroup}/props.ts +0 -0
- /package/src/Menu/{MenuItemGroup → v1/MenuItemGroup}/styles.ts +0 -0
- /package/src/Menu/{MenuItemGroup → v1/MenuItemGroup}/theme.ts +0 -0
- /package/src/Menu/{MenuItemSeparator → v1/MenuItemSeparator}/props.ts +0 -0
- /package/src/Menu/{MenuItemSeparator → v1/MenuItemSeparator}/styles.ts +0 -0
- /package/src/Menu/{MenuItemSeparator → v1/MenuItemSeparator}/theme.ts +0 -0
- /package/src/Menu/{README.md → v1/README.md} +0 -0
- /package/src/Menu/{styles.ts → v1/styles.ts} +0 -0
- /package/src/Menu/{theme.ts → v1/theme.ts} +0 -0
- /package/types/Menu/{MenuItem → v1/MenuItem}/props.d.ts +0 -0
- /package/types/Menu/{MenuItem → v1/MenuItem}/styles.d.ts +0 -0
- /package/types/Menu/{MenuItem → v1/MenuItem}/theme.d.ts +0 -0
- /package/types/Menu/{MenuItemGroup → v1/MenuItemGroup}/index.d.ts +0 -0
- /package/types/Menu/{MenuItemGroup → v1/MenuItemGroup}/props.d.ts +0 -0
- /package/types/Menu/{MenuItemGroup → v1/MenuItemGroup}/styles.d.ts +0 -0
- /package/types/Menu/{MenuItemGroup → v1/MenuItemGroup}/theme.d.ts +0 -0
- /package/types/Menu/{MenuItemSeparator → v1/MenuItemSeparator}/index.d.ts +0 -0
- /package/types/Menu/{MenuItemSeparator → v1/MenuItemSeparator}/props.d.ts +0 -0
- /package/types/Menu/{MenuItemSeparator → v1/MenuItemSeparator}/styles.d.ts +0 -0
- /package/types/Menu/{MenuItemSeparator → v1/MenuItemSeparator}/theme.d.ts +0 -0
- /package/types/Menu/{styles.d.ts → v1/styles.d.ts} +0 -0
- /package/types/Menu/{theme.d.ts → v1/theme.d.ts} +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { calcFocusOutlineStyles } from '@instructure/emotion';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* ---
|
|
29
|
+
* private: true
|
|
30
|
+
* ---
|
|
31
|
+
* Generates the style object from the theme and provided additional information
|
|
32
|
+
* @param {Object} componentTheme The theme variable object.
|
|
33
|
+
* @param {Object} props the props of the component, the style is applied to
|
|
34
|
+
* @param {Object} state the state of the component, the style is applied to
|
|
35
|
+
* @return {Object} The final style object, which will be used in the component
|
|
36
|
+
*/
|
|
37
|
+
const generateStyle = (componentTheme, props, sharedTokens) => {
|
|
38
|
+
const maxHeight = props.maxHeight ? {
|
|
39
|
+
maxHeight: props.maxHeight,
|
|
40
|
+
overflow: 'auto'
|
|
41
|
+
} : {};
|
|
42
|
+
return {
|
|
43
|
+
menu: {
|
|
44
|
+
label: 'menu',
|
|
45
|
+
minWidth: componentTheme.minWidth,
|
|
46
|
+
maxWidth: componentTheme.maxWidth,
|
|
47
|
+
listStyleType: 'none',
|
|
48
|
+
margin: '0',
|
|
49
|
+
padding: '0.25rem 0',
|
|
50
|
+
// TODO-rework
|
|
51
|
+
//background: componentTheme.background,
|
|
52
|
+
//borderRadius: componentTheme.borderRadius,
|
|
53
|
+
display: 'block',
|
|
54
|
+
position: 'relative',
|
|
55
|
+
overflow: 'hidden',
|
|
56
|
+
...maxHeight,
|
|
57
|
+
...calcFocusOutlineStyles(sharedTokens.focusOutline)
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export default generateStyle;
|
|
@@ -21,4 +21,4 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
-
export { Menu, MenuItem, MenuItemGroup, MenuItemSeparator } from "
|
|
24
|
+
export { Menu, MenuItem, MenuItemGroup, MenuItemSeparator } from "../Menu/v1/index.js";
|
package/es/exports/b.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
export { Menu, MenuItem, MenuItemGroup, MenuItemSeparator } from "../Menu/v2/index.js";
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import { createContext } from 'react';
|
|
26
|
+
|
|
26
27
|
/**
|
|
27
28
|
---
|
|
28
29
|
private: true
|
|
@@ -30,6 +31,7 @@ private: true
|
|
|
30
31
|
@module MenuContext
|
|
31
32
|
**/
|
|
32
33
|
const MenuContext = /*#__PURE__*/createContext({
|
|
34
|
+
// This is actually a `MenuItem`, but we dont want to version this one
|
|
33
35
|
registerMenuItem: _value => {},
|
|
34
36
|
removeMenuItem: _value => {}
|
|
35
37
|
});
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.MenuItem = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _keycode = _interopRequireDefault(require("keycode"));
|
|
10
|
-
var _IconCheckSolid2 = require("@instructure/ui-icons/lib/IconCheckSolid.js");
|
|
11
|
-
var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/IconArrowOpenEndSolid.js");
|
|
10
|
+
var _IconCheckSolid2 = require("@instructure/ui-icons/lib/generated/IconCheckSolid.js");
|
|
11
|
+
var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/generated/IconArrowOpenEndSolid.js");
|
|
12
12
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
13
13
|
var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
|
|
14
14
|
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
@@ -17,7 +17,7 @@ var _createChainedFunction = require("@instructure/ui-utils/lib/createChainedFun
|
|
|
17
17
|
var _isActiveElement = require("@instructure/ui-dom-utils/lib/isActiveElement.js");
|
|
18
18
|
var _findDOMNode = require("@instructure/ui-dom-utils/lib/findDOMNode.js");
|
|
19
19
|
var _emotion = require("@instructure/emotion");
|
|
20
|
-
var _MenuContext = require("
|
|
20
|
+
var _MenuContext = require("../../../utils/v1/MenuContext");
|
|
21
21
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
22
22
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
23
23
|
var _props = require("./props");
|
|
@@ -52,7 +52,7 @@ parent: Menu
|
|
|
52
52
|
id: Menu.Item
|
|
53
53
|
---
|
|
54
54
|
**/
|
|
55
|
-
let MenuItem = exports.MenuItem = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.
|
|
55
|
+
let MenuItem = exports.MenuItem = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_MenuItem = class MenuItem extends _react.Component {
|
|
56
56
|
constructor(props) {
|
|
57
57
|
super(props);
|
|
58
58
|
this.labelId = void 0;
|
|
@@ -47,7 +47,7 @@ parent: Menu
|
|
|
47
47
|
id: Menu.Group
|
|
48
48
|
---
|
|
49
49
|
**/
|
|
50
|
-
let MenuItemGroup = exports.MenuItemGroup = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.
|
|
50
|
+
let MenuItemGroup = exports.MenuItemGroup = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_MenuItemGroup = class MenuItemGroup extends _react.Component {
|
|
51
51
|
constructor(props) {
|
|
52
52
|
super(props);
|
|
53
53
|
this.ref = null;
|
|
@@ -43,7 +43,7 @@ id: Menu.Separator
|
|
|
43
43
|
---
|
|
44
44
|
@module MenuItemSeparator
|
|
45
45
|
**/
|
|
46
|
-
let MenuItemSeparator = exports.MenuItemSeparator = (_dec = (0, _emotion.
|
|
46
|
+
let MenuItemSeparator = exports.MenuItemSeparator = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = (_MenuItemSeparator = class MenuItemSeparator extends _react.Component {
|
|
47
47
|
constructor(...args) {
|
|
48
48
|
super(...args);
|
|
49
49
|
this.ref = null;
|
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.Menu = void 0;
|
|
8
|
+
Object.defineProperty(exports, "MenuItem", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () {
|
|
11
|
+
return _MenuItem.MenuItem;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "MenuItemGroup", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () {
|
|
17
|
+
return _MenuItemGroup.MenuItemGroup;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "MenuItemSeparator", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () {
|
|
23
|
+
return _MenuItemSeparator.MenuItemSeparator;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
exports.default = void 0;
|
|
27
|
+
var _react = require("react");
|
|
28
|
+
var _keycode = _interopRequireDefault(require("keycode"));
|
|
29
|
+
var _v11_ = require("@instructure/ui-popover/v11_6");
|
|
30
|
+
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
31
|
+
var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
|
|
32
|
+
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
33
|
+
var _console = require("@instructure/console");
|
|
34
|
+
var _containsActiveElement = require("@instructure/ui-dom-utils/lib/containsActiveElement.js");
|
|
35
|
+
var _MenuContext = require("../../utils/v1/MenuContext");
|
|
36
|
+
var _MenuItem = require("./MenuItem");
|
|
37
|
+
var _MenuItemGroup = require("./MenuItemGroup");
|
|
38
|
+
var _MenuItemSeparator = require("./MenuItemSeparator");
|
|
39
|
+
var _emotion = require("@instructure/emotion");
|
|
40
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
41
|
+
var _theme = _interopRequireDefault(require("./theme"));
|
|
42
|
+
var _props = require("./props");
|
|
43
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
44
|
+
var _dec, _dec2, _class, _Menu;
|
|
45
|
+
/*
|
|
46
|
+
* The MIT License (MIT)
|
|
47
|
+
*
|
|
48
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
49
|
+
*
|
|
50
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
51
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
52
|
+
* in the Software without restriction, including without limitation the rights
|
|
53
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
54
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
55
|
+
* furnished to do so, subject to the following conditions:
|
|
56
|
+
*
|
|
57
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
58
|
+
* copies or substantial portions of the Software.
|
|
59
|
+
*
|
|
60
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
61
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
62
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
63
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
64
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
65
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
66
|
+
* SOFTWARE.
|
|
67
|
+
*/
|
|
68
|
+
/**
|
|
69
|
+
---
|
|
70
|
+
category: components
|
|
71
|
+
---
|
|
72
|
+
**/
|
|
73
|
+
let Menu = exports.Menu = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_Menu = class Menu extends _react.Component {
|
|
74
|
+
constructor(props) {
|
|
75
|
+
super(props);
|
|
76
|
+
this.state = {
|
|
77
|
+
hasFocus: false
|
|
78
|
+
};
|
|
79
|
+
this._rootNode = null;
|
|
80
|
+
this._menuItems = [];
|
|
81
|
+
this._popover = null;
|
|
82
|
+
this._trigger = null;
|
|
83
|
+
this._menu = null;
|
|
84
|
+
this._labelId = this.props.deterministicId('Menu__label');
|
|
85
|
+
this._activeSubMenu = void 0;
|
|
86
|
+
this._id = void 0;
|
|
87
|
+
this.ref = null;
|
|
88
|
+
this.handleRef = el => {
|
|
89
|
+
const menuRef = this.props.menuRef;
|
|
90
|
+
this._menu = el;
|
|
91
|
+
if (typeof menuRef === 'function') {
|
|
92
|
+
menuRef(el);
|
|
93
|
+
}
|
|
94
|
+
// If there is no trigger `<ul>` is the ref, otherwise the trigger
|
|
95
|
+
if (!this.props.trigger) {
|
|
96
|
+
this.ref = el;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
this.registerMenuItem = item => {
|
|
100
|
+
this._menuItems.push(item);
|
|
101
|
+
};
|
|
102
|
+
this.removeMenuItem = item => {
|
|
103
|
+
const index = this.getMenuItemIndex(item);
|
|
104
|
+
(0, _console.logError)(index >= 0, '[Menu] Could not find registered menu item.');
|
|
105
|
+
if (index >= 0) {
|
|
106
|
+
this._menuItems.splice(index, 1);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
this.getMenuItemIndex = item => {
|
|
110
|
+
return this._menuItems.findIndex(i => i === item);
|
|
111
|
+
};
|
|
112
|
+
this.handleTriggerKeyDown = event => {
|
|
113
|
+
if (this.props.type === 'flyout' && event.keyCode === _keycode.default.codes.right) {
|
|
114
|
+
event.persist();
|
|
115
|
+
this.show(event);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
this.handleTriggerMouseOver = event => {
|
|
119
|
+
if (this.props.type === 'flyout') {
|
|
120
|
+
this.show(event);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
this.handleToggle = shown => {
|
|
124
|
+
if (typeof this.props.onToggle === 'function') {
|
|
125
|
+
this.props.onToggle(shown, this);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
this.handleMenuKeyDown = event => {
|
|
129
|
+
const key = event && event.keyCode;
|
|
130
|
+
const _keycode$codes = _keycode.default.codes,
|
|
131
|
+
down = _keycode$codes.down,
|
|
132
|
+
up = _keycode$codes.up,
|
|
133
|
+
tab = _keycode$codes.tab,
|
|
134
|
+
left = _keycode$codes.left;
|
|
135
|
+
const pgdn = _keycode.default.codes['page down'];
|
|
136
|
+
const pgup = _keycode.default.codes['page up'];
|
|
137
|
+
if (key === down || key === pgdn) {
|
|
138
|
+
event.preventDefault();
|
|
139
|
+
event.stopPropagation();
|
|
140
|
+
this.moveFocus(1);
|
|
141
|
+
this.hideActiveSubMenu(event);
|
|
142
|
+
} else if (key === up || key === pgup) {
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
event.stopPropagation();
|
|
145
|
+
this.moveFocus(-1);
|
|
146
|
+
this.hideActiveSubMenu(event);
|
|
147
|
+
} else if (key === tab || key === left) {
|
|
148
|
+
event.persist();
|
|
149
|
+
this.hide(event);
|
|
150
|
+
}
|
|
151
|
+
if (typeof this.props.onKeyDown === 'function') {
|
|
152
|
+
this.props.onKeyDown(event);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
this.handleMenuItemSelect = (event, value, selected, item) => {
|
|
156
|
+
if (this.props.shouldHideOnSelect) {
|
|
157
|
+
this.hide(event);
|
|
158
|
+
}
|
|
159
|
+
if (typeof this.props.onSelect === 'function') {
|
|
160
|
+
this.props.onSelect(event, value, selected, item);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
this.handleMenuItemFocus = () => {
|
|
164
|
+
this.setState({
|
|
165
|
+
hasFocus: true
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
this.handleMenuItemBlur = () => {
|
|
169
|
+
this.setState({
|
|
170
|
+
hasFocus: this.focusedIndex >= 0
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
this.handleMenuItemMouseOver = (event, menuItem) => {
|
|
174
|
+
if (this._activeSubMenu && menuItem !== this._activeSubMenu._trigger) {
|
|
175
|
+
this.hideActiveSubMenu(event);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
this.hideActiveSubMenu = event => {
|
|
179
|
+
if (this._activeSubMenu) {
|
|
180
|
+
this._activeSubMenu.hide(event);
|
|
181
|
+
this._activeSubMenu = null;
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
this.handleSubMenuToggle = (shown, subMenu) => {
|
|
185
|
+
if (shown) {
|
|
186
|
+
this._activeSubMenu = subMenu;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
this.handleSubMenuDismiss = (event, documentClick) => {
|
|
190
|
+
if (event && event.keyCode === _keycode.default.codes.tab || documentClick) {
|
|
191
|
+
this.hide(event);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
this.hide = event => {
|
|
195
|
+
if (this._popover) {
|
|
196
|
+
this._popover.hide(event);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
this.show = event => {
|
|
200
|
+
if (this._popover) {
|
|
201
|
+
this._popover.show(event);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
this._id = this.props.id || props.deterministicId();
|
|
205
|
+
}
|
|
206
|
+
componentDidMount() {
|
|
207
|
+
var _this$props$makeStyle, _this$props;
|
|
208
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
209
|
+
}
|
|
210
|
+
componentDidUpdate() {
|
|
211
|
+
var _this$props$makeStyle2, _this$props2;
|
|
212
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
213
|
+
}
|
|
214
|
+
get menuItems() {
|
|
215
|
+
return this._menuItems;
|
|
216
|
+
}
|
|
217
|
+
focus() {
|
|
218
|
+
if (this.shown) {
|
|
219
|
+
var _this$_menu;
|
|
220
|
+
(0, _console.logError)(!!((_this$_menu = this._menu) !== null && _this$_menu !== void 0 && _this$_menu.focus), '[Menu] Could not focus the menu.');
|
|
221
|
+
this._menu.focus();
|
|
222
|
+
} else {
|
|
223
|
+
var _this$_trigger;
|
|
224
|
+
(0, _console.logError)(!!((_this$_trigger = this._trigger) !== null && _this$_trigger !== void 0 && _this$_trigger.focus), '[Menu] Could not focus the trigger.');
|
|
225
|
+
this._trigger.focus();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
focused() {
|
|
229
|
+
if (this.shown) {
|
|
230
|
+
return (0, _containsActiveElement.containsActiveElement)(this._menu) || this.state.hasFocus;
|
|
231
|
+
} else {
|
|
232
|
+
return (0, _containsActiveElement.containsActiveElement)(this._trigger);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
get focusedIndex() {
|
|
236
|
+
return this.menuItems.findIndex(item => {
|
|
237
|
+
return item && item.focused === true;
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
moveFocus(step) {
|
|
241
|
+
const count = this.menuItems ? this.menuItems.length : 0;
|
|
242
|
+
if (count <= 0) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const current = this.focusedIndex < 0 && step < 0 ? 0 : this.focusedIndex;
|
|
246
|
+
const nextItem = this.menuItems[(current + count + step) % count];
|
|
247
|
+
(0, _console.logError)(typeof nextItem !== 'undefined' && typeof nextItem.focus !== 'undefined', '[Menu] Could not focus next menu item.');
|
|
248
|
+
nextItem.focus();
|
|
249
|
+
}
|
|
250
|
+
get shown() {
|
|
251
|
+
return this._popover ? this._popover.shown : true;
|
|
252
|
+
}
|
|
253
|
+
renderChildren() {
|
|
254
|
+
const _this$props3 = this.props,
|
|
255
|
+
children = _this$props3.children,
|
|
256
|
+
disabled = _this$props3.disabled;
|
|
257
|
+
let count = 0;
|
|
258
|
+
return _react.Children.map(children, child => {
|
|
259
|
+
if (!(0, _matchComponentTypes.matchComponentTypes)(child, ['MenuItemSeparator', 'MenuItem', 'MenuItemGroup', 'Menu'])) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
count += 1;
|
|
263
|
+
const isTabbable = !this.state.hasFocus && count === 1;
|
|
264
|
+
if ((0, _matchComponentTypes.matchComponentTypes)(child, ['MenuItemSeparator'])) {
|
|
265
|
+
return child;
|
|
266
|
+
}
|
|
267
|
+
const menuItemChild = child;
|
|
268
|
+
const controls = menuItemChild.props['aria-controls'] || menuItemChild.props.controls || this.props['aria-controls'] || this.props.controls;
|
|
269
|
+
if ((0, _matchComponentTypes.matchComponentTypes)(child, ['MenuItem'])) {
|
|
270
|
+
return (0, _safeCloneElement.safeCloneElement)(child, {
|
|
271
|
+
controls,
|
|
272
|
+
children: child.props.children,
|
|
273
|
+
disabled: disabled || child.props.disabled,
|
|
274
|
+
onFocus: this.handleMenuItemFocus,
|
|
275
|
+
onBlur: this.handleMenuItemBlur,
|
|
276
|
+
onSelect: this.handleMenuItemSelect,
|
|
277
|
+
onMouseOver: this.handleMenuItemMouseOver,
|
|
278
|
+
tabIndex: isTabbable ? 0 : -1
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
if ((0, _matchComponentTypes.matchComponentTypes)(child, ['MenuItemGroup'])) {
|
|
282
|
+
return (0, _safeCloneElement.safeCloneElement)(child, {
|
|
283
|
+
label: child.props.label,
|
|
284
|
+
controls,
|
|
285
|
+
disabled: disabled || child.props.disabled,
|
|
286
|
+
onFocus: this.handleMenuItemFocus,
|
|
287
|
+
onBlur: this.handleMenuItemBlur,
|
|
288
|
+
onSelect: this.handleMenuItemSelect,
|
|
289
|
+
onMouseOver: this.handleMenuItemMouseOver,
|
|
290
|
+
isTabbable
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
if ((0, _matchComponentTypes.matchComponentTypes)(child, ['Menu'])) {
|
|
294
|
+
const submenuDisabled = disabled || child.props.disabled;
|
|
295
|
+
return (0, _safeCloneElement.safeCloneElement)(child, {
|
|
296
|
+
type: 'flyout',
|
|
297
|
+
controls,
|
|
298
|
+
disabled: submenuDisabled,
|
|
299
|
+
onSelect: this.handleMenuItemSelect,
|
|
300
|
+
placement: 'end top',
|
|
301
|
+
offsetX: -5,
|
|
302
|
+
offsetY: 5,
|
|
303
|
+
withArrow: false,
|
|
304
|
+
onToggle: this.handleSubMenuToggle,
|
|
305
|
+
onDismiss: this.handleSubMenuDismiss,
|
|
306
|
+
trigger: (0, _jsxRuntime.jsx)(_MenuItem.MenuItem, {
|
|
307
|
+
onMouseOver: this.handleMenuItemMouseOver,
|
|
308
|
+
onFocus: this.handleMenuItemFocus,
|
|
309
|
+
onBlur: this.handleMenuItemBlur,
|
|
310
|
+
tabIndex: isTabbable ? 0 : -1,
|
|
311
|
+
type: "flyout",
|
|
312
|
+
disabled: submenuDisabled,
|
|
313
|
+
renderLabelInfo: child.props.renderLabelInfo,
|
|
314
|
+
children: child.props.title || child.props.label
|
|
315
|
+
})
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
return;
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
renderMenu() {
|
|
322
|
+
var _this$props$styles;
|
|
323
|
+
const _this$props4 = this.props,
|
|
324
|
+
disabled = _this$props4.disabled,
|
|
325
|
+
label = _this$props4.label,
|
|
326
|
+
trigger = _this$props4.trigger,
|
|
327
|
+
onKeyUp = _this$props4.onKeyUp;
|
|
328
|
+
const labelledBy = this.props['aria-labelledby'];
|
|
329
|
+
const controls = this.props['aria-controls'];
|
|
330
|
+
return (0, _jsxRuntime.jsx)(_MenuContext.MenuContext.Provider, {
|
|
331
|
+
value: {
|
|
332
|
+
removeMenuItem: this.removeMenuItem,
|
|
333
|
+
registerMenuItem: this.registerMenuItem
|
|
334
|
+
},
|
|
335
|
+
children: (0, _jsxRuntime.jsx)("div", {
|
|
336
|
+
role: "menu",
|
|
337
|
+
"aria-label": label,
|
|
338
|
+
tabIndex: 0,
|
|
339
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.menu,
|
|
340
|
+
"aria-labelledby": labelledBy || (trigger ? this._labelId : void 0),
|
|
341
|
+
"aria-controls": controls,
|
|
342
|
+
"aria-disabled": disabled ? 'true' : void 0,
|
|
343
|
+
onKeyDown: this.handleMenuKeyDown,
|
|
344
|
+
onKeyUp: onKeyUp,
|
|
345
|
+
ref: this.handleRef,
|
|
346
|
+
"data-cid": "Menu",
|
|
347
|
+
children: this.renderChildren()
|
|
348
|
+
})
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
render() {
|
|
352
|
+
const _this$props5 = this.props,
|
|
353
|
+
show = _this$props5.show,
|
|
354
|
+
defaultShow = _this$props5.defaultShow,
|
|
355
|
+
placement = _this$props5.placement,
|
|
356
|
+
withArrow = _this$props5.withArrow,
|
|
357
|
+
trigger = _this$props5.trigger,
|
|
358
|
+
mountNode = _this$props5.mountNode,
|
|
359
|
+
popoverRef = _this$props5.popoverRef,
|
|
360
|
+
disabled = _this$props5.disabled,
|
|
361
|
+
onDismiss = _this$props5.onDismiss,
|
|
362
|
+
onFocus = _this$props5.onFocus,
|
|
363
|
+
onMouseOver = _this$props5.onMouseOver,
|
|
364
|
+
positionContainerDisplay = _this$props5.positionContainerDisplay,
|
|
365
|
+
offsetX = _this$props5.offsetX,
|
|
366
|
+
offsetY = _this$props5.offsetY;
|
|
367
|
+
return trigger ? (0, _jsxRuntime.jsx)(_v11_.Popover, {
|
|
368
|
+
"data-cid": "Menu",
|
|
369
|
+
isShowingContent: show,
|
|
370
|
+
defaultIsShowingContent: defaultShow,
|
|
371
|
+
onHideContent: (event, {
|
|
372
|
+
documentClick
|
|
373
|
+
}) => {
|
|
374
|
+
if (typeof onDismiss === 'function') {
|
|
375
|
+
onDismiss(event, documentClick);
|
|
376
|
+
}
|
|
377
|
+
this.handleToggle(false);
|
|
378
|
+
},
|
|
379
|
+
onShowContent: () => this.handleToggle(true),
|
|
380
|
+
mountNode: mountNode,
|
|
381
|
+
placement: placement,
|
|
382
|
+
withArrow: withArrow,
|
|
383
|
+
id: this._id,
|
|
384
|
+
on: ['click'],
|
|
385
|
+
shouldContainFocus: true,
|
|
386
|
+
shouldReturnFocus: true,
|
|
387
|
+
onFocus: onFocus,
|
|
388
|
+
onMouseOver: onMouseOver,
|
|
389
|
+
positionContainerDisplay: positionContainerDisplay,
|
|
390
|
+
offsetX: offsetX,
|
|
391
|
+
offsetY: offsetY,
|
|
392
|
+
elementRef: element => {
|
|
393
|
+
this.ref = element;
|
|
394
|
+
},
|
|
395
|
+
ref: el => {
|
|
396
|
+
this._popover = el;
|
|
397
|
+
if (typeof popoverRef === 'function') {
|
|
398
|
+
popoverRef(el);
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
renderTrigger: (0, _safeCloneElement.safeCloneElement)(trigger, {
|
|
402
|
+
ref: el => {
|
|
403
|
+
this._trigger = el;
|
|
404
|
+
},
|
|
405
|
+
'aria-haspopup': true,
|
|
406
|
+
id: this._labelId,
|
|
407
|
+
onMouseOver: this.handleTriggerMouseOver,
|
|
408
|
+
onKeyDown: this.handleTriggerKeyDown,
|
|
409
|
+
disabled: trigger.props.disabled || disabled
|
|
410
|
+
}),
|
|
411
|
+
defaultFocusElement: () => {
|
|
412
|
+
var _this$_popover, _this$_popover$_conte;
|
|
413
|
+
return (_this$_popover = this._popover) === null || _this$_popover === void 0 ? void 0 : (_this$_popover$_conte = _this$_popover._contentElement) === null || _this$_popover$_conte === void 0 ? void 0 : _this$_popover$_conte.querySelector('[class$="menuItem"]');
|
|
414
|
+
},
|
|
415
|
+
children: this.renderMenu()
|
|
416
|
+
}) : this.renderMenu();
|
|
417
|
+
}
|
|
418
|
+
}, _Menu.displayName = "Menu", _Menu.componentId = 'Menu', _Menu.allowedProps = _props.allowedProps, _Menu.defaultProps = {
|
|
419
|
+
label: null,
|
|
420
|
+
disabled: false,
|
|
421
|
+
trigger: null,
|
|
422
|
+
placement: 'bottom center',
|
|
423
|
+
defaultShow: false,
|
|
424
|
+
mountNode: null,
|
|
425
|
+
constrain: 'window',
|
|
426
|
+
shouldHideOnSelect: true,
|
|
427
|
+
shouldFocusTriggerOnClose: true,
|
|
428
|
+
withArrow: true,
|
|
429
|
+
offsetX: 0,
|
|
430
|
+
offsetY: 0
|
|
431
|
+
}, _Menu.Item = _MenuItem.MenuItem, _Menu.Group = _MenuItemGroup.MenuItemGroup, _Menu.Separator = _MenuItemSeparator.MenuItemSeparator, _Menu.contextType = _MenuContext.MenuContext, _Menu)) || _class) || _class);
|
|
432
|
+
var _default = exports.default = Menu;
|