@instructure/ui-menu 8.8.0 → 8.8.1-snapshot.63
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 +27 -0
- package/es/Menu/MenuItem/index.js +14 -60
- package/es/Menu/MenuItem/props.js +67 -0
- package/es/Menu/MenuItemGroup/index.js +10 -57
- package/es/Menu/MenuItemGroup/props.js +71 -0
- package/es/Menu/MenuItemSeparator/index.js +5 -8
- package/{src/Menu/MenuItemSeparator/types.ts → es/Menu/MenuItemSeparator/props.js} +5 -5
- package/es/Menu/index.js +5 -151
- package/es/Menu/props.js +167 -0
- package/lib/Menu/MenuItem/index.js +15 -62
- package/lib/Menu/MenuItem/props.js +79 -0
- package/lib/Menu/MenuItemGroup/index.js +11 -62
- package/lib/Menu/MenuItemGroup/props.js +87 -0
- package/lib/Menu/MenuItemSeparator/index.js +6 -9
- package/{src/Menu/MenuItemGroup/types.ts → lib/Menu/MenuItemSeparator/props.js} +13 -16
- package/lib/Menu/index.js +6 -156
- package/lib/Menu/props.js +182 -0
- package/package.json +22 -21
- package/src/Menu/MenuItem/index.tsx +14 -56
- package/src/Menu/MenuItem/props.ts +109 -0
- package/src/Menu/MenuItem/styles.ts +1 -1
- package/src/Menu/MenuItem/theme.ts +1 -1
- package/src/Menu/MenuItemGroup/index.tsx +9 -56
- package/src/Menu/MenuItemGroup/props.ts +110 -0
- package/src/Menu/MenuItemGroup/theme.ts +1 -1
- package/src/Menu/MenuItemSeparator/index.tsx +6 -9
- package/src/Menu/{MenuItem/types.ts → MenuItemSeparator/props.ts} +19 -19
- package/src/Menu/MenuItemSeparator/theme.ts +1 -1
- package/src/Menu/index.tsx +6 -139
- package/src/Menu/props.ts +235 -0
- package/src/Menu/theme.ts +1 -1
- package/src/index.ts +4 -4
- package/types/Menu/MenuItem/index.d.ts +37 -45
- package/types/Menu/MenuItem/index.d.ts.map +1 -1
- package/types/Menu/MenuItem/props.d.ts +27 -0
- package/types/Menu/MenuItem/props.d.ts.map +1 -0
- package/types/Menu/MenuItem/styles.d.ts +1 -1
- package/types/Menu/MenuItem/theme.d.ts +1 -1
- package/types/Menu/MenuItem/theme.d.ts.map +1 -1
- package/types/Menu/MenuItemGroup/index.d.ts +29 -46
- package/types/Menu/MenuItemGroup/index.d.ts.map +1 -1
- package/types/Menu/MenuItemGroup/props.d.ts +25 -0
- package/types/Menu/MenuItemGroup/props.d.ts.map +1 -0
- package/types/Menu/MenuItemGroup/theme.d.ts +1 -1
- package/types/Menu/MenuItemGroup/theme.d.ts.map +1 -1
- package/types/Menu/MenuItemSeparator/index.d.ts +3 -6
- package/types/Menu/MenuItemSeparator/index.d.ts.map +1 -1
- package/types/Menu/MenuItemSeparator/props.d.ts +11 -0
- package/types/Menu/MenuItemSeparator/props.d.ts.map +1 -0
- package/types/Menu/MenuItemSeparator/theme.d.ts +1 -1
- package/types/Menu/MenuItemSeparator/theme.d.ts.map +1 -1
- package/types/Menu/index.d.ts +60 -122
- package/types/Menu/index.d.ts.map +1 -1
- package/types/Menu/{types.d.ts → props.d.ts} +13 -5
- package/types/Menu/props.d.ts.map +1 -0
- package/types/Menu/theme.d.ts +1 -1
- package/types/Menu/theme.d.ts.map +1 -1
- package/types/index.d.ts +4 -4
- package/es/Menu/MenuItem/types.js +0 -1
- package/es/Menu/MenuItemGroup/types.js +0 -1
- package/es/Menu/MenuItemSeparator/types.js +0 -1
- package/es/Menu/types.js +0 -1
- package/lib/Menu/MenuItem/types.js +0 -1
- package/lib/Menu/MenuItemGroup/types.js +0 -1
- package/lib/Menu/MenuItemSeparator/types.js +0 -1
- package/lib/Menu/types.js +0 -1
- package/src/Menu/types.ts +0 -63
- package/types/Menu/MenuItem/types.d.ts +0 -19
- package/types/Menu/MenuItem/types.d.ts.map +0 -1
- package/types/Menu/MenuItemGroup/types.d.ts +0 -17
- package/types/Menu/MenuItemGroup/types.d.ts.map +0 -1
- package/types/Menu/MenuItemSeparator/types.d.ts +0 -5
- package/types/Menu/MenuItemSeparator/types.d.ts.map +0 -1
- package/types/Menu/types.d.ts.map +0 -1
|
@@ -0,0 +1,235 @@
|
|
|
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 PropTypes from 'prop-types'
|
|
26
|
+
|
|
27
|
+
import { PositionPropTypes } from '@instructure/ui-position'
|
|
28
|
+
import {
|
|
29
|
+
controllable,
|
|
30
|
+
Children as ChildrenPropTypes
|
|
31
|
+
} from '@instructure/ui-prop-types'
|
|
32
|
+
|
|
33
|
+
import type { PropValidators } from '@instructure/shared-types'
|
|
34
|
+
import type { WithStyleProps } from '@instructure/emotion'
|
|
35
|
+
import type {
|
|
36
|
+
PlacementPropValues,
|
|
37
|
+
PositionConstraint,
|
|
38
|
+
PositionMountNode
|
|
39
|
+
} from '@instructure/ui-position'
|
|
40
|
+
|
|
41
|
+
type MenuOwnProps = {
|
|
42
|
+
children?: React.ReactNode // TODO: oneOf(['MenuItem', 'MenuItemGroup', 'MenuItemSeparator', 'Menu'])
|
|
43
|
+
label?: string
|
|
44
|
+
disabled?: boolean
|
|
45
|
+
trigger?: React.ReactNode
|
|
46
|
+
placement?: PlacementPropValues
|
|
47
|
+
defaultShow?: boolean
|
|
48
|
+
show?: any // TODO: controllable(PropTypes.bool, 'onToggle', 'defaultShow')
|
|
49
|
+
onToggle?: (...args: any[]) => any
|
|
50
|
+
onSelect?: (...args: any[]) => any
|
|
51
|
+
onDismiss?: (...args: any[]) => any
|
|
52
|
+
onBlur?: (...args: any[]) => any
|
|
53
|
+
onFocus?: (...args: any[]) => any
|
|
54
|
+
onMouseOver?: (...args: any[]) => any
|
|
55
|
+
onKeyDown?: (...args: any[]) => any
|
|
56
|
+
onKeyUp?: (...args: any[]) => any
|
|
57
|
+
menuRef?: (...args: any[]) => any
|
|
58
|
+
popoverRef?: (...args: any[]) => any
|
|
59
|
+
mountNode?: PositionMountNode
|
|
60
|
+
constrain?: PositionConstraint
|
|
61
|
+
liveRegion?:
|
|
62
|
+
| React.ReactElement[]
|
|
63
|
+
| React.ReactElement
|
|
64
|
+
| ((...args: any[]) => any)
|
|
65
|
+
shouldHideOnSelect?: boolean
|
|
66
|
+
shouldFocusTriggerOnClose?: boolean
|
|
67
|
+
type?: 'flyout'
|
|
68
|
+
id?: string
|
|
69
|
+
withArrow?: boolean
|
|
70
|
+
offsetX?: string | number
|
|
71
|
+
offsetY?: string | number
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
type PropKeys = keyof MenuOwnProps
|
|
75
|
+
|
|
76
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
77
|
+
|
|
78
|
+
type MenuProps = MenuOwnProps & WithStyleProps
|
|
79
|
+
|
|
80
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
81
|
+
/**
|
|
82
|
+
* Children of type `Menu.Item`, `Menu.Group`, `Menu.Separator`, or `Menu`
|
|
83
|
+
*/
|
|
84
|
+
children: ChildrenPropTypes.oneOf([
|
|
85
|
+
'MenuItem',
|
|
86
|
+
'MenuItemGroup',
|
|
87
|
+
'MenuItemSeparator',
|
|
88
|
+
'Menu'
|
|
89
|
+
]),
|
|
90
|
+
/**
|
|
91
|
+
* Description of the `<Menu />`
|
|
92
|
+
*/
|
|
93
|
+
label: PropTypes.string,
|
|
94
|
+
/**
|
|
95
|
+
* Is the `<Menu />` disabled
|
|
96
|
+
*/
|
|
97
|
+
disabled: PropTypes.bool,
|
|
98
|
+
/**
|
|
99
|
+
* The trigger element, if the `<Menu />` is to render as a popover
|
|
100
|
+
*/
|
|
101
|
+
trigger: PropTypes.node,
|
|
102
|
+
/**
|
|
103
|
+
* If a trigger is supplied, where should the `<Menu />` be placed (relative to the trigger)
|
|
104
|
+
*/
|
|
105
|
+
placement: PositionPropTypes.placement,
|
|
106
|
+
/**
|
|
107
|
+
* Should the `<Menu />` be open for the initial render
|
|
108
|
+
*/
|
|
109
|
+
defaultShow: PropTypes.bool,
|
|
110
|
+
/**
|
|
111
|
+
* Is the `<Menu />` open (should be accompanied by `onToggle`)
|
|
112
|
+
*/
|
|
113
|
+
show: controllable(PropTypes.bool, 'onToggle', 'defaultShow'),
|
|
114
|
+
/**
|
|
115
|
+
* Callback fired when the `<Menu />` is toggled open/closed. When used with `show`,
|
|
116
|
+
* the component will not control its own state.
|
|
117
|
+
*/
|
|
118
|
+
onToggle: PropTypes.func,
|
|
119
|
+
/**
|
|
120
|
+
* Callback fired when an item within the `<Menu />` is selected
|
|
121
|
+
*/
|
|
122
|
+
onSelect: PropTypes.func,
|
|
123
|
+
/**
|
|
124
|
+
* If a trigger is supplied, callback fired when the `<Menu />` is closed
|
|
125
|
+
*/
|
|
126
|
+
onDismiss: PropTypes.func,
|
|
127
|
+
/**
|
|
128
|
+
* If a trigger is supplied, callback fired when the `<Menu />` trigger is blurred
|
|
129
|
+
*/
|
|
130
|
+
onBlur: PropTypes.func,
|
|
131
|
+
/**
|
|
132
|
+
* If a trigger is supplied, callback fired when the `<Menu />` trigger is focused
|
|
133
|
+
*/
|
|
134
|
+
onFocus: PropTypes.func,
|
|
135
|
+
/**
|
|
136
|
+
* If a trigger is supplied, callback fired onMouseOver for the `<Menu />` trigger
|
|
137
|
+
*/
|
|
138
|
+
onMouseOver: PropTypes.func,
|
|
139
|
+
/**
|
|
140
|
+
* Callback fired on the onKeyDown of the `<Menu />`
|
|
141
|
+
*/
|
|
142
|
+
onKeyDown: PropTypes.func,
|
|
143
|
+
/**
|
|
144
|
+
* Callback fired on the onKeyUp of the `<Menu />`
|
|
145
|
+
*/
|
|
146
|
+
onKeyUp: PropTypes.func,
|
|
147
|
+
/**
|
|
148
|
+
* A function that returns a reference to the `<Menu />`
|
|
149
|
+
*/
|
|
150
|
+
menuRef: PropTypes.func,
|
|
151
|
+
/**
|
|
152
|
+
* A function that returns a reference to the `<Popover />`
|
|
153
|
+
*/
|
|
154
|
+
popoverRef: PropTypes.func,
|
|
155
|
+
/**
|
|
156
|
+
* If a trigger is supplied, an element or a function returning an element to use as the mount node
|
|
157
|
+
* for the `<Menu />` (defaults to `document.body`)
|
|
158
|
+
*/
|
|
159
|
+
mountNode: PositionPropTypes.mountNode,
|
|
160
|
+
/**
|
|
161
|
+
* The parent in which to constrain the menu.
|
|
162
|
+
* One of: 'window', 'scroll-parent', 'parent', 'none', an element,
|
|
163
|
+
* or a function returning an element
|
|
164
|
+
*/
|
|
165
|
+
constrain: PositionPropTypes.constrain,
|
|
166
|
+
/**
|
|
167
|
+
* If a trigger is supplied, an element, function returning an element, or array of elements that will not
|
|
168
|
+
* be hidden from the screen reader when the `<Menu />` is open
|
|
169
|
+
*/
|
|
170
|
+
liveRegion: PropTypes.oneOfType([
|
|
171
|
+
PropTypes.arrayOf(PropTypes.element),
|
|
172
|
+
PropTypes.element,
|
|
173
|
+
PropTypes.func
|
|
174
|
+
]),
|
|
175
|
+
/**
|
|
176
|
+
* If a trigger is supplied, should the `<Menu />` hide when an item is selected
|
|
177
|
+
*/
|
|
178
|
+
shouldHideOnSelect: PropTypes.bool,
|
|
179
|
+
/**
|
|
180
|
+
* If a trigger is supplied, should the `<Menu />` focus the trigger on after closing
|
|
181
|
+
*/
|
|
182
|
+
shouldFocusTriggerOnClose: PropTypes.bool,
|
|
183
|
+
/**
|
|
184
|
+
* The type of `<Menu />`
|
|
185
|
+
*/
|
|
186
|
+
type: PropTypes.oneOf(['flyout']),
|
|
187
|
+
id: PropTypes.string,
|
|
188
|
+
/**
|
|
189
|
+
* Whether or not an arrow pointing to the trigger should be rendered
|
|
190
|
+
*/
|
|
191
|
+
withArrow: PropTypes.bool,
|
|
192
|
+
/**
|
|
193
|
+
* The horizontal offset for the positioned content.
|
|
194
|
+
* Works only if `trigger` is provided.
|
|
195
|
+
*/
|
|
196
|
+
offsetX: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
197
|
+
/**
|
|
198
|
+
* The vertical offset for the positioned content.
|
|
199
|
+
* Works only if `trigger` is provided.
|
|
200
|
+
*/
|
|
201
|
+
offsetY: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const allowedProps: AllowedPropKeys = [
|
|
205
|
+
'children',
|
|
206
|
+
'label',
|
|
207
|
+
'disabled',
|
|
208
|
+
'trigger',
|
|
209
|
+
'placement',
|
|
210
|
+
'defaultShow',
|
|
211
|
+
'show',
|
|
212
|
+
'onToggle',
|
|
213
|
+
'onSelect',
|
|
214
|
+
'onDismiss',
|
|
215
|
+
'onBlur',
|
|
216
|
+
'onFocus',
|
|
217
|
+
'onMouseOver',
|
|
218
|
+
'onKeyDown',
|
|
219
|
+
'onKeyUp',
|
|
220
|
+
'menuRef',
|
|
221
|
+
'popoverRef',
|
|
222
|
+
'mountNode',
|
|
223
|
+
'constrain',
|
|
224
|
+
'liveRegion',
|
|
225
|
+
'shouldHideOnSelect',
|
|
226
|
+
'shouldFocusTriggerOnClose',
|
|
227
|
+
'type',
|
|
228
|
+
'id',
|
|
229
|
+
'withArrow',
|
|
230
|
+
'offsetX',
|
|
231
|
+
'offsetY'
|
|
232
|
+
]
|
|
233
|
+
|
|
234
|
+
export type { MenuProps }
|
|
235
|
+
export { propTypes, allowedProps }
|
package/src/Menu/theme.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
export { Menu, MenuItem, MenuItemGroup, MenuItemSeparator } from './Menu'
|
|
25
25
|
|
|
26
|
-
export type { MenuProps } from './Menu/
|
|
27
|
-
export type { MenuItemProps } from './Menu/MenuItem/
|
|
28
|
-
export type { MenuGroupProps } from './Menu/MenuItemGroup/
|
|
29
|
-
export type { MenuSeparatorProps } from './Menu/MenuItemSeparator/
|
|
26
|
+
export type { MenuProps } from './Menu/props'
|
|
27
|
+
export type { MenuItemProps } from './Menu/MenuItem/props'
|
|
28
|
+
export type { MenuGroupProps } from './Menu/MenuItemGroup/props'
|
|
29
|
+
export type { MenuSeparatorProps } from './Menu/MenuItemSeparator/props'
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { Component } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import { jsx } from '@instructure/emotion';
|
|
5
|
-
import { MenuItemProps } from './
|
|
4
|
+
import type { MenuItemProps } from './props';
|
|
6
5
|
/**
|
|
7
6
|
---
|
|
8
7
|
parent: Menu
|
|
@@ -11,49 +10,42 @@ id: Menu.Item
|
|
|
11
10
|
**/
|
|
12
11
|
declare class MenuItem extends Component<MenuItemProps> {
|
|
13
12
|
static readonly componentId = "Menu.Item";
|
|
14
|
-
static propTypes: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
13
|
+
static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
|
|
14
|
+
children: import("react").ReactNode;
|
|
15
|
+
defaultSelected?: boolean | undefined;
|
|
16
|
+
selected?: any;
|
|
17
|
+
onSelect?: ((...args: any[]) => any) | undefined;
|
|
18
|
+
onClick?: ((...args: any[]) => any) | undefined;
|
|
19
|
+
onKeyDown?: ((...args: any[]) => any) | undefined;
|
|
20
|
+
onKeyUp?: ((...args: any[]) => any) | undefined;
|
|
21
|
+
onMouseOver?: ((...args: any[]) => any) | undefined;
|
|
22
|
+
controls?: string | undefined;
|
|
23
|
+
disabled?: boolean | undefined;
|
|
24
|
+
as?: import("@instructure/shared-types/types/CommonProps").AsElementType | undefined;
|
|
25
|
+
type?: "button" | "checkbox" | "radio" | "flyout" | undefined;
|
|
26
|
+
value?: string | number | undefined;
|
|
27
|
+
href?: string | undefined;
|
|
28
|
+
}>;
|
|
29
|
+
static allowedProps: readonly (keyof {
|
|
30
|
+
children: import("react").ReactNode;
|
|
31
|
+
defaultSelected?: boolean | undefined;
|
|
32
|
+
selected?: any;
|
|
33
|
+
onSelect?: ((...args: any[]) => any) | undefined;
|
|
34
|
+
onClick?: ((...args: any[]) => any) | undefined;
|
|
35
|
+
onKeyDown?: ((...args: any[]) => any) | undefined;
|
|
36
|
+
onKeyUp?: ((...args: any[]) => any) | undefined;
|
|
37
|
+
onMouseOver?: ((...args: any[]) => any) | undefined;
|
|
38
|
+
controls?: string | undefined;
|
|
39
|
+
disabled?: boolean | undefined;
|
|
40
|
+
as?: import("@instructure/shared-types/types/CommonProps").AsElementType | undefined;
|
|
41
|
+
type?: "button" | "checkbox" | "radio" | "flyout" | undefined;
|
|
42
|
+
value?: string | number | undefined;
|
|
43
|
+
href?: string | undefined;
|
|
44
|
+
})[];
|
|
44
45
|
static defaultProps: {
|
|
45
|
-
type:
|
|
46
|
-
disabled:
|
|
47
|
-
onSelect: (e: any, value: any, selected: any, item: any) => void;
|
|
48
|
-
defaultSelected: undefined;
|
|
49
|
-
selected: undefined;
|
|
50
|
-
onClick: undefined;
|
|
51
|
-
onKeyDown: undefined;
|
|
52
|
-
onKeyUp: undefined;
|
|
53
|
-
onMouseOver: undefined;
|
|
54
|
-
controls: undefined;
|
|
55
|
-
value: undefined;
|
|
56
|
-
href: undefined;
|
|
46
|
+
readonly type: "button";
|
|
47
|
+
readonly disabled: false;
|
|
48
|
+
readonly onSelect: (e: any, value: any, selected: any, item: any) => void;
|
|
57
49
|
};
|
|
58
50
|
static contextType: import("react").Context<{
|
|
59
51
|
registerMenuItem: () => void;
|
|
@@ -67,7 +59,7 @@ declare class MenuItem extends Component<MenuItemProps> {
|
|
|
67
59
|
handleKeyDown: (e: any) => void;
|
|
68
60
|
handleKeyUp: (e: any) => void;
|
|
69
61
|
handleMouseOver: (event: any) => void;
|
|
70
|
-
get elementType():
|
|
62
|
+
get elementType(): import("@instructure/shared-types/types/CommonProps").AsElementType;
|
|
71
63
|
get role(): "button" | "menuitemcheckbox" | "menuitemradio" | "menuitem";
|
|
72
64
|
get selected(): any;
|
|
73
65
|
get focused(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Menu/MenuItem/index.tsx"],"names":[],"mappings":"AAuBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Menu/MenuItem/index.tsx"],"names":[],"mappings":"AAuBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AASjC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAQrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C;;;;;GAKG;AACH,cAEM,QAAS,SAAQ,SAAS,CAAC,aAAa,CAAC;IAC7C,MAAM,CAAC,QAAQ,CAAC,WAAW,eAAc;IAEzC,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;OAAY;IAC5B,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,YAAY;;;;MAKT;IAEV,MAAM,CAAC,WAAW;;;OAAc;gBAGpB,KAAK,KAAA;IAcjB,iBAAiB;IAUjB,kBAAkB;IAKlB,oBAAoB;IASpB,WAAW,mBAqBV;IAGD,aAAa,mBAcZ;IAGD,WAAW,mBAaV;IAGD,eAAe,uBAMd;IAED,IAAI,WAAW,wEAEd;IAED,IAAI,IAAI,iEAWP;IAED,IAAI,QAAQ,QAKX;IAED,IAAI,OAAO,YAGV;IAED,KAAK;IAKL,aAAa;IAuBb,MAAM;CAsCP;AAED,eAAe,QAAQ,CAAA;AACvB,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AsElementType, PropValidators } from '@instructure/shared-types';
|
|
3
|
+
import type { WithStyleProps } from '@instructure/emotion';
|
|
4
|
+
declare type MenuItemOwnProps = {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
defaultSelected?: boolean;
|
|
7
|
+
selected?: any;
|
|
8
|
+
onSelect?: (...args: any[]) => any;
|
|
9
|
+
onClick?: (...args: any[]) => any;
|
|
10
|
+
onKeyDown?: (...args: any[]) => any;
|
|
11
|
+
onKeyUp?: (...args: any[]) => any;
|
|
12
|
+
onMouseOver?: (...args: any[]) => any;
|
|
13
|
+
controls?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
as?: AsElementType;
|
|
16
|
+
type?: 'button' | 'checkbox' | 'radio' | 'flyout';
|
|
17
|
+
value?: string | number;
|
|
18
|
+
href?: string;
|
|
19
|
+
};
|
|
20
|
+
declare type PropKeys = keyof MenuItemOwnProps;
|
|
21
|
+
declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
|
|
22
|
+
declare type MenuItemProps = MenuItemOwnProps & WithStyleProps;
|
|
23
|
+
declare const propTypes: PropValidators<PropKeys>;
|
|
24
|
+
declare const allowedProps: AllowedPropKeys;
|
|
25
|
+
export type { MenuItemProps };
|
|
26
|
+
export { propTypes, allowedProps };
|
|
27
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/Menu/MenuItem/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,aAAK,gBAAgB,GAAG;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,EAAE,GAAG,CAAA;IACd,QAAQ,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IAClC,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACjC,SAAS,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACnC,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACjC,WAAW,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,EAAE,CAAC,EAAE,aAAa,CAAA;IAClB,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAA;IACjD,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,aAAK,QAAQ,GAAG,MAAM,gBAAgB,CAAA;AAEtC,aAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,aAAK,aAAa,GAAG,gBAAgB,GAAG,cAAc,CAAA;AAEtD,QAAA,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CAiCvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAenB,CAAA;AAED,YAAY,EAAE,aAAa,EAAE,CAAA;AAC7B,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MenuItemTheme } from '@instructure/shared-types';
|
|
2
|
-
import { Theme } from '@instructure/ui-themes';
|
|
2
|
+
import type { Theme } from '@instructure/ui-themes';
|
|
3
3
|
/**
|
|
4
4
|
* Generates the theme object for the component from the theme and provided additional information
|
|
5
5
|
* @param {Object} theme The actual theme object.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/Menu/MenuItem/theme.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,KAAK,EAAsB,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/Menu/MenuItem/theme.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,KAAK,EAAE,KAAK,EAAsB,MAAM,wBAAwB,CAAA;AAEvE;;;;GAIG;AACH,QAAA,MAAM,sBAAsB,UAAW,KAAK,KAAG,aAmC9C,CAAA;AAED,eAAe,sBAAsB,CAAA"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { Component } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import { jsx } from '@instructure/emotion';
|
|
5
|
-
import { MenuGroupProps } from './
|
|
4
|
+
import type { MenuGroupProps } from './props';
|
|
6
5
|
/**
|
|
7
6
|
---
|
|
8
7
|
parent: Menu
|
|
@@ -11,52 +10,36 @@ id: Menu.Group
|
|
|
11
10
|
**/
|
|
12
11
|
declare class MenuItemGroup extends Component<MenuGroupProps> {
|
|
13
12
|
static readonly componentId = "Menu.Group";
|
|
14
|
-
static propTypes: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
defaultSelected
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
*/
|
|
43
|
-
controls: PropTypes.Requireable<string>;
|
|
44
|
-
/**
|
|
45
|
-
* returns a reference to the `MenuItem`
|
|
46
|
-
*/
|
|
47
|
-
itemRef: PropTypes.Requireable<(...args: any[]) => any>;
|
|
48
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
49
|
-
/**
|
|
50
|
-
* should the group appear in the tab order (the first item will have a tabIndex of 0)
|
|
51
|
-
*/
|
|
52
|
-
isTabbable: PropTypes.Requireable<boolean>;
|
|
53
|
-
};
|
|
13
|
+
static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
|
|
14
|
+
label: import("react").ReactNode;
|
|
15
|
+
allowMultiple?: boolean | undefined;
|
|
16
|
+
children?: import("react").ReactNode;
|
|
17
|
+
selected?: any;
|
|
18
|
+
defaultSelected?: any[] | undefined;
|
|
19
|
+
onSelect?: ((...args: any[]) => any) | undefined;
|
|
20
|
+
onMouseOver?: ((...args: any[]) => any) | undefined;
|
|
21
|
+
onKeyDown?: ((...args: any[]) => any) | undefined;
|
|
22
|
+
controls?: string | undefined;
|
|
23
|
+
itemRef?: ((...args: any[]) => any) | undefined;
|
|
24
|
+
disabled?: boolean | undefined;
|
|
25
|
+
isTabbable?: boolean | undefined;
|
|
26
|
+
}>;
|
|
27
|
+
static allowedProps: readonly (keyof {
|
|
28
|
+
label: import("react").ReactNode;
|
|
29
|
+
allowMultiple?: boolean | undefined;
|
|
30
|
+
children?: import("react").ReactNode;
|
|
31
|
+
selected?: any;
|
|
32
|
+
defaultSelected?: any[] | undefined;
|
|
33
|
+
onSelect?: ((...args: any[]) => any) | undefined;
|
|
34
|
+
onMouseOver?: ((...args: any[]) => any) | undefined;
|
|
35
|
+
onKeyDown?: ((...args: any[]) => any) | undefined;
|
|
36
|
+
controls?: string | undefined;
|
|
37
|
+
itemRef?: ((...args: any[]) => any) | undefined;
|
|
38
|
+
disabled?: boolean | undefined;
|
|
39
|
+
isTabbable?: boolean | undefined;
|
|
40
|
+
})[];
|
|
54
41
|
static defaultProps: {
|
|
55
|
-
onMouseOver: undefined;
|
|
56
42
|
disabled: boolean;
|
|
57
|
-
controls: undefined;
|
|
58
|
-
onKeyDown: undefined;
|
|
59
|
-
selected: undefined;
|
|
60
43
|
children: null;
|
|
61
44
|
isTabbable: boolean;
|
|
62
45
|
allowMultiple: boolean;
|