@instructure/ui-menu 10.26.1 → 11.0.0
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 +23 -2
- package/es/Menu/MenuItem/index.js +6 -6
- package/es/Menu/MenuItem/props.js +1 -21
- package/es/Menu/MenuItemGroup/index.js +6 -6
- package/es/Menu/MenuItemGroup/props.js +1 -18
- package/es/Menu/MenuItemSeparator/index.js +6 -6
- package/es/Menu/MenuItemSeparator/props.js +1 -2
- package/es/Menu/index.js +7 -6
- package/es/Menu/props.js +1 -34
- package/lib/Menu/MenuItem/index.js +5 -5
- package/lib/Menu/MenuItem/props.js +1 -22
- package/lib/Menu/MenuItemGroup/index.js +5 -5
- package/lib/Menu/MenuItemGroup/props.js +1 -20
- package/lib/Menu/MenuItemSeparator/index.js +5 -5
- package/lib/Menu/MenuItemSeparator/props.js +1 -2
- package/lib/Menu/index.js +6 -5
- package/lib/Menu/props.js +1 -36
- package/package.json +19 -22
- package/src/Menu/MenuItem/index.tsx +2 -4
- package/src/Menu/MenuItem/props.ts +1 -24
- package/src/Menu/MenuItemGroup/index.tsx +2 -4
- package/src/Menu/MenuItemGroup/props.ts +1 -24
- package/src/Menu/MenuItemSeparator/index.tsx +2 -4
- package/src/Menu/MenuItemSeparator/props.ts +1 -4
- package/src/Menu/index.tsx +4 -5
- package/src/Menu/props.ts +2 -50
- package/tsconfig.build.json +0 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Menu/MenuItem/index.d.ts +1 -19
- package/types/Menu/MenuItem/index.d.ts.map +1 -1
- package/types/Menu/MenuItem/props.d.ts +2 -3
- package/types/Menu/MenuItem/props.d.ts.map +1 -1
- package/types/Menu/MenuItemGroup/index.d.ts +0 -13
- package/types/Menu/MenuItemGroup/index.d.ts.map +1 -1
- package/types/Menu/MenuItemGroup/props.d.ts +2 -3
- package/types/Menu/MenuItemGroup/props.d.ts.map +1 -1
- package/types/Menu/MenuItemSeparator/index.d.ts +0 -1
- package/types/Menu/MenuItemSeparator/index.d.ts.map +1 -1
- package/types/Menu/MenuItemSeparator/props.d.ts +2 -3
- package/types/Menu/MenuItemSeparator/props.d.ts.map +1 -1
- package/types/Menu/index.d.ts +0 -30
- package/types/Menu/index.d.ts.map +1 -1
- package/types/Menu/props.d.ts +2 -3
- package/types/Menu/props.d.ts.map +1 -1
package/lib/Menu/props.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _PositionPropTypes = require("@instructure/ui-position/lib/PositionPropTypes.js");
|
|
10
|
-
var _controllable = require("@instructure/ui-prop-types/lib/controllable.js");
|
|
11
|
-
var _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
|
6
|
+
exports.allowedProps = void 0;
|
|
12
7
|
/*
|
|
13
8
|
* The MIT License (MIT)
|
|
14
9
|
*
|
|
@@ -33,34 +28,4 @@ var _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
|
|
33
28
|
* SOFTWARE.
|
|
34
29
|
*/
|
|
35
30
|
|
|
36
|
-
const propTypes = exports.propTypes = {
|
|
37
|
-
children: _Children.Children.oneOf(['MenuItem', 'MenuItemGroup', 'MenuItemSeparator', 'Menu']),
|
|
38
|
-
label: _propTypes.default.string,
|
|
39
|
-
disabled: _propTypes.default.bool,
|
|
40
|
-
trigger: _propTypes.default.node,
|
|
41
|
-
placement: _PositionPropTypes.PositionPropTypes.placement,
|
|
42
|
-
defaultShow: _propTypes.default.bool,
|
|
43
|
-
show: (0, _controllable.controllable)(_propTypes.default.bool, 'onToggle', 'defaultShow'),
|
|
44
|
-
onToggle: _propTypes.default.func,
|
|
45
|
-
onSelect: _propTypes.default.func,
|
|
46
|
-
onDismiss: _propTypes.default.func,
|
|
47
|
-
onFocus: _propTypes.default.func,
|
|
48
|
-
onMouseOver: _propTypes.default.func,
|
|
49
|
-
onKeyDown: _propTypes.default.func,
|
|
50
|
-
onKeyUp: _propTypes.default.func,
|
|
51
|
-
menuRef: _propTypes.default.func,
|
|
52
|
-
popoverRef: _propTypes.default.func,
|
|
53
|
-
mountNode: _PositionPropTypes.PositionPropTypes.mountNode,
|
|
54
|
-
constrain: _PositionPropTypes.PositionPropTypes.constrain,
|
|
55
|
-
shouldHideOnSelect: _propTypes.default.bool,
|
|
56
|
-
shouldFocusTriggerOnClose: _propTypes.default.bool,
|
|
57
|
-
positionContainerDisplay: _propTypes.default.oneOf(['inline-block', 'block']),
|
|
58
|
-
type: _propTypes.default.oneOf(['flyout']),
|
|
59
|
-
id: _propTypes.default.string,
|
|
60
|
-
withArrow: _propTypes.default.bool,
|
|
61
|
-
offsetX: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
62
|
-
offsetY: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
63
|
-
maxHeight: _propTypes.default.string,
|
|
64
|
-
renderLabelInfo: _propTypes.default.node
|
|
65
|
-
};
|
|
66
31
|
const allowedProps = exports.allowedProps = ['children', 'label', 'disabled', 'trigger', 'placement', 'defaultShow', 'show', 'onToggle', 'onSelect', 'onDismiss', 'onFocus', 'onMouseOver', 'onKeyDown', 'onKeyUp', 'menuRef', 'popoverRef', 'mountNode', 'constrain', 'shouldHideOnSelect', 'shouldFocusTriggerOnClose', 'positionContainerDisplay', 'type', 'id', 'withArrow', 'offsetX', 'offsetY', 'maxHeight', 'renderLabelInfo'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-menu",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0",
|
|
4
4
|
"description": "A dropdown menu component",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,35 +23,32 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-axe-check": "
|
|
27
|
-
"@instructure/ui-babel-preset": "
|
|
28
|
-
"@instructure/ui-color-utils": "
|
|
29
|
-
"@instructure/ui-themes": "
|
|
26
|
+
"@instructure/ui-axe-check": "11.0.0",
|
|
27
|
+
"@instructure/ui-babel-preset": "11.0.0",
|
|
28
|
+
"@instructure/ui-color-utils": "11.0.0",
|
|
29
|
+
"@instructure/ui-themes": "11.0.0",
|
|
30
30
|
"@testing-library/jest-dom": "^6.6.3",
|
|
31
|
-
"@testing-library/react": "
|
|
31
|
+
"@testing-library/react": "15.0.7",
|
|
32
32
|
"@testing-library/user-event": "^14.6.1",
|
|
33
33
|
"vitest": "^3.2.2"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@babel/runtime": "^7.27.6",
|
|
37
|
-
"@instructure/console": "
|
|
38
|
-
"@instructure/emotion": "
|
|
39
|
-
"@instructure/shared-types": "
|
|
40
|
-
"@instructure/ui-a11y-utils": "
|
|
41
|
-
"@instructure/ui-dom-utils": "
|
|
42
|
-
"@instructure/ui-icons": "
|
|
43
|
-
"@instructure/ui-popover": "
|
|
44
|
-
"@instructure/ui-position": "
|
|
45
|
-
"@instructure/ui-
|
|
46
|
-
"@instructure/ui-
|
|
47
|
-
"@instructure/ui-
|
|
48
|
-
"
|
|
49
|
-
"@instructure/ui-view": "10.26.1",
|
|
50
|
-
"keycode": "^2",
|
|
51
|
-
"prop-types": "^15.8.1"
|
|
37
|
+
"@instructure/console": "11.0.0",
|
|
38
|
+
"@instructure/emotion": "11.0.0",
|
|
39
|
+
"@instructure/shared-types": "11.0.0",
|
|
40
|
+
"@instructure/ui-a11y-utils": "11.0.0",
|
|
41
|
+
"@instructure/ui-dom-utils": "11.0.0",
|
|
42
|
+
"@instructure/ui-icons": "11.0.0",
|
|
43
|
+
"@instructure/ui-popover": "11.0.0",
|
|
44
|
+
"@instructure/ui-position": "11.0.0",
|
|
45
|
+
"@instructure/ui-react-utils": "11.0.0",
|
|
46
|
+
"@instructure/ui-utils": "11.0.0",
|
|
47
|
+
"@instructure/ui-view": "11.0.0",
|
|
48
|
+
"keycode": "^2"
|
|
52
49
|
},
|
|
53
50
|
"peerDependencies": {
|
|
54
|
-
"react": ">=
|
|
51
|
+
"react": ">=18 <=19"
|
|
55
52
|
},
|
|
56
53
|
"publishConfig": {
|
|
57
54
|
"access": "public"
|
|
@@ -34,7 +34,6 @@ import {
|
|
|
34
34
|
} from '@instructure/ui-react-utils'
|
|
35
35
|
import { createChainedFunction } from '@instructure/ui-utils'
|
|
36
36
|
import { isActiveElement, findDOMNode } from '@instructure/ui-dom-utils'
|
|
37
|
-
import { testable } from '@instructure/ui-testable'
|
|
38
37
|
import { withStyle } from '@instructure/emotion'
|
|
39
38
|
|
|
40
39
|
import { MenuContext } from '../../MenuContext'
|
|
@@ -42,7 +41,7 @@ import { MenuContext } from '../../MenuContext'
|
|
|
42
41
|
import generateStyle from './styles'
|
|
43
42
|
import generateComponentTheme from './theme'
|
|
44
43
|
|
|
45
|
-
import {
|
|
44
|
+
import { allowedProps } from './props'
|
|
46
45
|
import type { MenuItemProps, MenuItemState } from './props'
|
|
47
46
|
|
|
48
47
|
/**
|
|
@@ -53,11 +52,9 @@ id: Menu.Item
|
|
|
53
52
|
**/
|
|
54
53
|
@withDeterministicId()
|
|
55
54
|
@withStyle(generateStyle, generateComponentTheme)
|
|
56
|
-
@testable()
|
|
57
55
|
class MenuItem extends Component<MenuItemProps, MenuItemState> {
|
|
58
56
|
static readonly componentId = 'Menu.Item'
|
|
59
57
|
|
|
60
|
-
static propTypes = propTypes
|
|
61
58
|
static allowedProps = allowedProps
|
|
62
59
|
static defaultProps = {
|
|
63
60
|
type: 'button',
|
|
@@ -266,6 +263,7 @@ class MenuItem extends Component<MenuItemProps, MenuItemState> {
|
|
|
266
263
|
ref={this.handleRef}
|
|
267
264
|
css={this.props.styles?.menuItem}
|
|
268
265
|
onMouseOver={this.handleMouseOver}
|
|
266
|
+
data-cid="MenuItem"
|
|
269
267
|
>
|
|
270
268
|
{this.renderContent()}
|
|
271
269
|
</ElementType>
|
|
@@ -23,13 +23,10 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
26
|
import MenuItem from '../MenuItem'
|
|
28
|
-
import { controllable } from '@instructure/ui-prop-types'
|
|
29
27
|
|
|
30
28
|
import type {
|
|
31
29
|
AsElementType,
|
|
32
|
-
PropValidators,
|
|
33
30
|
MenuItemTheme,
|
|
34
31
|
OtherHTMLAttributes
|
|
35
32
|
} from '@instructure/shared-types'
|
|
@@ -108,26 +105,6 @@ type MenuItemProps = MenuItemOwnProps &
|
|
|
108
105
|
WithDeterministicIdProps
|
|
109
106
|
|
|
110
107
|
type MenuItemStyle = ComponentStyle<'menuItem' | 'icon' | 'labelInfo' | 'label'>
|
|
111
|
-
|
|
112
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
113
|
-
children: PropTypes.node.isRequired,
|
|
114
|
-
defaultSelected: PropTypes.bool,
|
|
115
|
-
selected: controllable(PropTypes.bool, 'onSelect', 'defaultSelected'),
|
|
116
|
-
onSelect: PropTypes.func,
|
|
117
|
-
onClick: PropTypes.func,
|
|
118
|
-
onKeyDown: PropTypes.func,
|
|
119
|
-
onKeyUp: PropTypes.func,
|
|
120
|
-
onMouseOver: PropTypes.func,
|
|
121
|
-
controls: PropTypes.string,
|
|
122
|
-
disabled: PropTypes.bool,
|
|
123
|
-
as: PropTypes.elementType,
|
|
124
|
-
type: PropTypes.oneOf(['button', 'checkbox', 'radio', 'flyout']),
|
|
125
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
126
|
-
href: PropTypes.string,
|
|
127
|
-
target: PropTypes.string,
|
|
128
|
-
renderLabelInfo: PropTypes.node
|
|
129
|
-
}
|
|
130
|
-
|
|
131
108
|
const allowedProps: AllowedPropKeys = [
|
|
132
109
|
'children',
|
|
133
110
|
'defaultSelected',
|
|
@@ -150,4 +127,4 @@ type MenuItemState = {
|
|
|
150
127
|
selected: boolean
|
|
151
128
|
}
|
|
152
129
|
export type { MenuItemProps, MenuItemStyle, MenuItemState, OnMenuItemSelect }
|
|
153
|
-
export {
|
|
130
|
+
export { allowedProps }
|
|
@@ -32,7 +32,6 @@ import {
|
|
|
32
32
|
withDeterministicId
|
|
33
33
|
} from '@instructure/ui-react-utils'
|
|
34
34
|
import { hasVisibleChildren } from '@instructure/ui-a11y-utils'
|
|
35
|
-
import { testable } from '@instructure/ui-testable'
|
|
36
35
|
|
|
37
36
|
import { MenuItem } from '../MenuItem'
|
|
38
37
|
import type { OnMenuItemSelect, MenuItemProps } from '../MenuItem/props'
|
|
@@ -42,7 +41,7 @@ import type { MenuSeparatorProps } from '../MenuItemSeparator/props'
|
|
|
42
41
|
import generateStyle from './styles'
|
|
43
42
|
import generateComponentTheme from './theme'
|
|
44
43
|
|
|
45
|
-
import {
|
|
44
|
+
import { allowedProps } from './props'
|
|
46
45
|
import type { MenuGroupProps, MenuGroupState } from './props'
|
|
47
46
|
|
|
48
47
|
type MenuItemChild = ComponentElement<MenuItemProps, MenuItem>
|
|
@@ -59,11 +58,9 @@ id: Menu.Group
|
|
|
59
58
|
**/
|
|
60
59
|
@withDeterministicId()
|
|
61
60
|
@withStyle(generateStyle, generateComponentTheme)
|
|
62
|
-
@testable()
|
|
63
61
|
class MenuItemGroup extends Component<MenuGroupProps, MenuGroupState> {
|
|
64
62
|
static readonly componentId = 'Menu.Group'
|
|
65
63
|
|
|
66
|
-
static propTypes = propTypes
|
|
67
64
|
static allowedProps = allowedProps
|
|
68
65
|
static defaultProps = {
|
|
69
66
|
disabled: false,
|
|
@@ -231,6 +228,7 @@ class MenuItemGroup extends Component<MenuGroupProps, MenuGroupState> {
|
|
|
231
228
|
{...props}
|
|
232
229
|
css={this.props.styles?.menuItemGroup}
|
|
233
230
|
ref={this.handleRef}
|
|
231
|
+
data-cid="MenuItemGroup"
|
|
234
232
|
>
|
|
235
233
|
{this.renderLabel()}
|
|
236
234
|
<div
|
|
@@ -23,18 +23,10 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
|
-
|
|
28
|
-
import {
|
|
29
|
-
controllable,
|
|
30
|
-
Children as ChildrenPropTypes
|
|
31
|
-
} from '@instructure/ui-prop-types'
|
|
32
26
|
|
|
33
27
|
import { MenuItem } from '../MenuItem'
|
|
34
|
-
import { MenuItemSeparator } from '../MenuItemSeparator'
|
|
35
28
|
|
|
36
29
|
import type {
|
|
37
|
-
PropValidators,
|
|
38
30
|
MenuGroupTheme,
|
|
39
31
|
OtherHTMLAttributes
|
|
40
32
|
} from '@instructure/shared-types'
|
|
@@ -92,21 +84,6 @@ type MenuGroupProps = MenuGroupOwnProps &
|
|
|
92
84
|
WithDeterministicIdProps
|
|
93
85
|
|
|
94
86
|
type MenuGroupStyle = ComponentStyle<'menuItemGroup' | 'label' | 'items'>
|
|
95
|
-
|
|
96
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
97
|
-
label: PropTypes.node.isRequired,
|
|
98
|
-
allowMultiple: PropTypes.bool,
|
|
99
|
-
children: ChildrenPropTypes.oneOf([MenuItem, MenuItemSeparator]),
|
|
100
|
-
selected: controllable(PropTypes.array, 'onSelect', 'defaultSelected'),
|
|
101
|
-
defaultSelected: PropTypes.array,
|
|
102
|
-
onSelect: PropTypes.func,
|
|
103
|
-
onMouseOver: PropTypes.func,
|
|
104
|
-
controls: PropTypes.string,
|
|
105
|
-
itemRef: PropTypes.func,
|
|
106
|
-
disabled: PropTypes.bool,
|
|
107
|
-
isTabbable: PropTypes.bool
|
|
108
|
-
}
|
|
109
|
-
|
|
110
87
|
const allowedProps: AllowedPropKeys = [
|
|
111
88
|
'label',
|
|
112
89
|
'allowMultiple',
|
|
@@ -125,4 +102,4 @@ type MenuGroupState = {
|
|
|
125
102
|
selected: (string | number)[]
|
|
126
103
|
}
|
|
127
104
|
export type { MenuGroupProps, MenuGroupStyle, MenuGroupState }
|
|
128
|
-
export {
|
|
105
|
+
export { allowedProps }
|
|
@@ -25,13 +25,12 @@
|
|
|
25
25
|
import { Component } from 'react'
|
|
26
26
|
|
|
27
27
|
import { withStyle } from '@instructure/emotion'
|
|
28
|
-
import { testable } from '@instructure/ui-testable'
|
|
29
28
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
30
29
|
|
|
31
30
|
import generateStyle from './styles'
|
|
32
31
|
import generateComponentTheme from './theme'
|
|
33
32
|
|
|
34
|
-
import {
|
|
33
|
+
import { allowedProps } from './props'
|
|
35
34
|
import type { MenuSeparatorProps } from './props'
|
|
36
35
|
|
|
37
36
|
/**
|
|
@@ -42,11 +41,9 @@ id: Menu.Separator
|
|
|
42
41
|
@module MenuItemSeparator
|
|
43
42
|
**/
|
|
44
43
|
@withStyle(generateStyle, generateComponentTheme)
|
|
45
|
-
@testable()
|
|
46
44
|
class MenuItemSeparator extends Component<MenuSeparatorProps> {
|
|
47
45
|
static readonly componentId = 'Menu.Separator'
|
|
48
46
|
|
|
49
|
-
static propTypes = propTypes
|
|
50
47
|
static allowedProps = allowedProps
|
|
51
48
|
|
|
52
49
|
ref: Element | null = null
|
|
@@ -73,6 +70,7 @@ class MenuItemSeparator extends Component<MenuSeparatorProps> {
|
|
|
73
70
|
role="presentation"
|
|
74
71
|
css={this.props.styles?.menuItemSeparator}
|
|
75
72
|
ref={this.handleRef}
|
|
73
|
+
data-cid="MenuItemSeparator"
|
|
76
74
|
/>
|
|
77
75
|
)
|
|
78
76
|
}
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
|
|
25
25
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
26
26
|
import type {
|
|
27
|
-
PropValidators,
|
|
28
27
|
MenuSeparatorTheme,
|
|
29
28
|
OtherHTMLAttributes
|
|
30
29
|
} from '@instructure/shared-types'
|
|
@@ -43,9 +42,7 @@ type MenuSeparatorProps = MenuSeparatorOwnProps &
|
|
|
43
42
|
|
|
44
43
|
type MenuSeparatorStyle = ComponentStyle<'menuItemSeparator'>
|
|
45
44
|
|
|
46
|
-
const propTypes: PropValidators<PropKeys> = {}
|
|
47
|
-
|
|
48
45
|
const allowedProps: AllowedPropKeys = []
|
|
49
46
|
|
|
50
47
|
export type { MenuSeparatorProps, MenuSeparatorStyle }
|
|
51
|
-
export {
|
|
48
|
+
export { allowedProps }
|
package/src/Menu/index.tsx
CHANGED
|
@@ -33,7 +33,6 @@ import {
|
|
|
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'
|
|
36
|
-
import { testable } from '@instructure/ui-testable'
|
|
37
36
|
|
|
38
37
|
import { MenuContext } from '../MenuContext'
|
|
39
38
|
import { MenuItem } from './MenuItem'
|
|
@@ -47,7 +46,7 @@ import { withStyle } from '@instructure/emotion'
|
|
|
47
46
|
import generateStyle from './styles'
|
|
48
47
|
import generateComponentTheme from './theme'
|
|
49
48
|
|
|
50
|
-
import {
|
|
49
|
+
import { allowedProps } from './props'
|
|
51
50
|
import type { MenuProps } from './props'
|
|
52
51
|
|
|
53
52
|
type MenuChild = ComponentElement<MenuProps, Menu>
|
|
@@ -65,10 +64,8 @@ category: components
|
|
|
65
64
|
**/
|
|
66
65
|
@withDeterministicId()
|
|
67
66
|
@withStyle(generateStyle, generateComponentTheme)
|
|
68
|
-
@testable()
|
|
69
67
|
class Menu extends Component<MenuProps> {
|
|
70
68
|
static readonly componentId = 'Menu'
|
|
71
|
-
static propTypes = propTypes
|
|
72
69
|
static allowedProps = allowedProps
|
|
73
70
|
static defaultProps = {
|
|
74
71
|
label: null,
|
|
@@ -433,6 +430,7 @@ class Menu extends Component<MenuProps> {
|
|
|
433
430
|
onKeyDown={this.handleMenuKeyDown}
|
|
434
431
|
onKeyUp={onKeyUp}
|
|
435
432
|
ref={this.handleRef}
|
|
433
|
+
data-cid="Menu"
|
|
436
434
|
>
|
|
437
435
|
{this.renderChildren()}
|
|
438
436
|
</div>
|
|
@@ -460,6 +458,7 @@ class Menu extends Component<MenuProps> {
|
|
|
460
458
|
|
|
461
459
|
return trigger ? (
|
|
462
460
|
<Popover
|
|
461
|
+
data-cid="Menu"
|
|
463
462
|
isShowingContent={show}
|
|
464
463
|
defaultIsShowingContent={defaultShow}
|
|
465
464
|
onHideContent={(event, { documentClick }) => {
|
|
@@ -498,7 +497,7 @@ class Menu extends Component<MenuProps> {
|
|
|
498
497
|
id: this._labelId,
|
|
499
498
|
onMouseOver: this.handleTriggerMouseOver,
|
|
500
499
|
onKeyDown: this.handleTriggerKeyDown,
|
|
501
|
-
disabled: (trigger as ReactElement).props.disabled || disabled
|
|
500
|
+
disabled: (trigger as ReactElement<any>).props.disabled || disabled
|
|
502
501
|
})}
|
|
503
502
|
defaultFocusElement={() =>
|
|
504
503
|
this._popover?._contentElement?.querySelector('[class$="menuItem"]')
|
package/src/Menu/props.ts
CHANGED
|
@@ -23,19 +23,8 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
26
|
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
controllable,
|
|
31
|
-
Children as ChildrenPropTypes
|
|
32
|
-
} from '@instructure/ui-prop-types'
|
|
33
|
-
|
|
34
|
-
import type {
|
|
35
|
-
PropValidators,
|
|
36
|
-
MenuTheme,
|
|
37
|
-
OtherHTMLAttributes
|
|
38
|
-
} from '@instructure/shared-types'
|
|
27
|
+
import type { MenuTheme, OtherHTMLAttributes } from '@instructure/shared-types'
|
|
39
28
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
40
29
|
import type {
|
|
41
30
|
PlacementPropValues,
|
|
@@ -189,43 +178,6 @@ type MenuProps = MenuOwnProps &
|
|
|
189
178
|
} & WithDeterministicIdProps
|
|
190
179
|
|
|
191
180
|
type MenuStyle = ComponentStyle<'menu'>
|
|
192
|
-
|
|
193
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
194
|
-
children: ChildrenPropTypes.oneOf([
|
|
195
|
-
'MenuItem',
|
|
196
|
-
'MenuItemGroup',
|
|
197
|
-
'MenuItemSeparator',
|
|
198
|
-
'Menu'
|
|
199
|
-
]),
|
|
200
|
-
label: PropTypes.string,
|
|
201
|
-
disabled: PropTypes.bool,
|
|
202
|
-
trigger: PropTypes.node,
|
|
203
|
-
placement: PositionPropTypes.placement,
|
|
204
|
-
defaultShow: PropTypes.bool,
|
|
205
|
-
show: controllable(PropTypes.bool, 'onToggle', 'defaultShow'),
|
|
206
|
-
onToggle: PropTypes.func,
|
|
207
|
-
onSelect: PropTypes.func,
|
|
208
|
-
onDismiss: PropTypes.func,
|
|
209
|
-
onFocus: PropTypes.func,
|
|
210
|
-
onMouseOver: PropTypes.func,
|
|
211
|
-
onKeyDown: PropTypes.func,
|
|
212
|
-
onKeyUp: PropTypes.func,
|
|
213
|
-
menuRef: PropTypes.func,
|
|
214
|
-
popoverRef: PropTypes.func,
|
|
215
|
-
mountNode: PositionPropTypes.mountNode,
|
|
216
|
-
constrain: PositionPropTypes.constrain,
|
|
217
|
-
shouldHideOnSelect: PropTypes.bool,
|
|
218
|
-
shouldFocusTriggerOnClose: PropTypes.bool,
|
|
219
|
-
positionContainerDisplay: PropTypes.oneOf(['inline-block', 'block']),
|
|
220
|
-
type: PropTypes.oneOf(['flyout']),
|
|
221
|
-
id: PropTypes.string,
|
|
222
|
-
withArrow: PropTypes.bool,
|
|
223
|
-
offsetX: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
224
|
-
offsetY: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
225
|
-
maxHeight: PropTypes.string,
|
|
226
|
-
renderLabelInfo: PropTypes.node
|
|
227
|
-
}
|
|
228
|
-
|
|
229
181
|
const allowedProps: AllowedPropKeys = [
|
|
230
182
|
'children',
|
|
231
183
|
'label',
|
|
@@ -258,4 +210,4 @@ const allowedProps: AllowedPropKeys = [
|
|
|
258
210
|
]
|
|
259
211
|
|
|
260
212
|
export type { MenuProps, MenuStyle }
|
|
261
|
-
export {
|
|
213
|
+
export { allowedProps }
|
package/tsconfig.build.json
CHANGED
|
@@ -18,9 +18,7 @@
|
|
|
18
18
|
{ "path": "../ui-icons/tsconfig.build.json" },
|
|
19
19
|
{ "path": "../ui-popover/tsconfig.build.json" },
|
|
20
20
|
{ "path": "../ui-position/tsconfig.build.json" },
|
|
21
|
-
{ "path": "../ui-prop-types/tsconfig.build.json" },
|
|
22
21
|
{ "path": "../ui-react-utils/tsconfig.build.json" },
|
|
23
|
-
{ "path": "../ui-testable/tsconfig.build.json" },
|
|
24
22
|
{ "path": "../ui-utils/tsconfig.build.json" },
|
|
25
23
|
{ "path": "../ui-axe-check/tsconfig.build.json" },
|
|
26
24
|
{ "path": "../ui-view/tsconfig.build.json" }
|