@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.
Files changed (74) hide show
  1. package/LICENSE.md +27 -0
  2. package/es/Menu/MenuItem/index.js +14 -60
  3. package/es/Menu/MenuItem/props.js +67 -0
  4. package/es/Menu/MenuItemGroup/index.js +10 -57
  5. package/es/Menu/MenuItemGroup/props.js +71 -0
  6. package/es/Menu/MenuItemSeparator/index.js +5 -8
  7. package/{src/Menu/MenuItemSeparator/types.ts → es/Menu/MenuItemSeparator/props.js} +5 -5
  8. package/es/Menu/index.js +5 -151
  9. package/es/Menu/props.js +167 -0
  10. package/lib/Menu/MenuItem/index.js +15 -62
  11. package/lib/Menu/MenuItem/props.js +79 -0
  12. package/lib/Menu/MenuItemGroup/index.js +11 -62
  13. package/lib/Menu/MenuItemGroup/props.js +87 -0
  14. package/lib/Menu/MenuItemSeparator/index.js +6 -9
  15. package/{src/Menu/MenuItemGroup/types.ts → lib/Menu/MenuItemSeparator/props.js} +13 -16
  16. package/lib/Menu/index.js +6 -156
  17. package/lib/Menu/props.js +182 -0
  18. package/package.json +22 -21
  19. package/src/Menu/MenuItem/index.tsx +14 -56
  20. package/src/Menu/MenuItem/props.ts +109 -0
  21. package/src/Menu/MenuItem/styles.ts +1 -1
  22. package/src/Menu/MenuItem/theme.ts +1 -1
  23. package/src/Menu/MenuItemGroup/index.tsx +9 -56
  24. package/src/Menu/MenuItemGroup/props.ts +110 -0
  25. package/src/Menu/MenuItemGroup/theme.ts +1 -1
  26. package/src/Menu/MenuItemSeparator/index.tsx +6 -9
  27. package/src/Menu/{MenuItem/types.ts → MenuItemSeparator/props.ts} +19 -19
  28. package/src/Menu/MenuItemSeparator/theme.ts +1 -1
  29. package/src/Menu/index.tsx +6 -139
  30. package/src/Menu/props.ts +235 -0
  31. package/src/Menu/theme.ts +1 -1
  32. package/src/index.ts +4 -4
  33. package/types/Menu/MenuItem/index.d.ts +37 -45
  34. package/types/Menu/MenuItem/index.d.ts.map +1 -1
  35. package/types/Menu/MenuItem/props.d.ts +27 -0
  36. package/types/Menu/MenuItem/props.d.ts.map +1 -0
  37. package/types/Menu/MenuItem/styles.d.ts +1 -1
  38. package/types/Menu/MenuItem/theme.d.ts +1 -1
  39. package/types/Menu/MenuItem/theme.d.ts.map +1 -1
  40. package/types/Menu/MenuItemGroup/index.d.ts +29 -46
  41. package/types/Menu/MenuItemGroup/index.d.ts.map +1 -1
  42. package/types/Menu/MenuItemGroup/props.d.ts +25 -0
  43. package/types/Menu/MenuItemGroup/props.d.ts.map +1 -0
  44. package/types/Menu/MenuItemGroup/theme.d.ts +1 -1
  45. package/types/Menu/MenuItemGroup/theme.d.ts.map +1 -1
  46. package/types/Menu/MenuItemSeparator/index.d.ts +3 -6
  47. package/types/Menu/MenuItemSeparator/index.d.ts.map +1 -1
  48. package/types/Menu/MenuItemSeparator/props.d.ts +11 -0
  49. package/types/Menu/MenuItemSeparator/props.d.ts.map +1 -0
  50. package/types/Menu/MenuItemSeparator/theme.d.ts +1 -1
  51. package/types/Menu/MenuItemSeparator/theme.d.ts.map +1 -1
  52. package/types/Menu/index.d.ts +60 -122
  53. package/types/Menu/index.d.ts.map +1 -1
  54. package/types/Menu/{types.d.ts → props.d.ts} +13 -5
  55. package/types/Menu/props.d.ts.map +1 -0
  56. package/types/Menu/theme.d.ts +1 -1
  57. package/types/Menu/theme.d.ts.map +1 -1
  58. package/types/index.d.ts +4 -4
  59. package/es/Menu/MenuItem/types.js +0 -1
  60. package/es/Menu/MenuItemGroup/types.js +0 -1
  61. package/es/Menu/MenuItemSeparator/types.js +0 -1
  62. package/es/Menu/types.js +0 -1
  63. package/lib/Menu/MenuItem/types.js +0 -1
  64. package/lib/Menu/MenuItemGroup/types.js +0 -1
  65. package/lib/Menu/MenuItemSeparator/types.js +0 -1
  66. package/lib/Menu/types.js +0 -1
  67. package/src/Menu/types.ts +0 -63
  68. package/types/Menu/MenuItem/types.d.ts +0 -19
  69. package/types/Menu/MenuItem/types.d.ts.map +0 -1
  70. package/types/Menu/MenuItemGroup/types.d.ts +0 -17
  71. package/types/Menu/MenuItemGroup/types.d.ts.map +0 -1
  72. package/types/Menu/MenuItemSeparator/types.d.ts +0 -5
  73. package/types/Menu/MenuItemSeparator/types.d.ts.map +0 -1
  74. 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
@@ -22,7 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import { Theme } from '@instructure/ui-themes'
25
+ import type { Theme } from '@instructure/ui-themes'
26
26
  import { MenuTheme } from '@instructure/shared-types'
27
27
 
28
28
  /**
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/types'
27
- export type { MenuItemProps } from './Menu/MenuItem/types'
28
- export type { MenuGroupProps } from './Menu/MenuItemGroup/types'
29
- export type { MenuSeparatorProps } from './Menu/MenuItemSeparator/types'
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 './types';
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
- makeStyles: PropTypes.Requireable<(...args: any[]) => any>;
16
- styles: PropTypes.Requireable<object>;
17
- children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
18
- defaultSelected: PropTypes.Requireable<boolean>;
19
- /**
20
- * whether the menu item is selected or not (must be accompanied by an `onSelect` prop)
21
- */
22
- selected: (props: Record<string, any>, propName: string, componentName: string) => Error | null;
23
- /**
24
- * when used with the `selected` prop, the component will not control its own state
25
- */
26
- onSelect: PropTypes.Requireable<(...args: any[]) => any>;
27
- onClick: PropTypes.Requireable<(...args: any[]) => any>;
28
- onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
29
- onKeyUp: PropTypes.Requireable<(...args: any[]) => any>;
30
- onMouseOver: PropTypes.Requireable<(...args: any[]) => any>;
31
- /**
32
- * the id of the element that the menu item will act upon
33
- */
34
- controls: PropTypes.Requireable<string>;
35
- disabled: PropTypes.Requireable<boolean>;
36
- /**
37
- * the element type to render as (will default to `<a>` if href is provided)
38
- */
39
- as: PropTypes.Requireable<PropTypes.ReactComponentLike>;
40
- type: PropTypes.Requireable<string>;
41
- value: PropTypes.Requireable<string | number>;
42
- href: PropTypes.Requireable<string>;
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: string;
46
- disabled: boolean;
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(): any;
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;AACjC,OAAO,SAAS,MAAM,YAAY,CAAA;AAUlC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAMrD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEvC;;;;;GAKG;AACH,cAEM,QAAS,SAAQ,SAAS,CAAC,aAAa,CAAC;IAC7C,MAAM,CAAC,QAAQ,CAAC,WAAW,eAAc;IAEzC,MAAM,CAAC,SAAS;;;;;QASd;;WAEG;;QAEH;;WAEG;;;;;;QAMH;;WAEG;;;QAGH;;WAEG;;;;;MAKJ;IAED,MAAM,CAAC,YAAY;;;;;;;;;;;;;MAclB;IAED,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,QAEd;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"}
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 { MenuItemProps } from './types';
2
+ import { MenuItemProps } from './props';
3
3
  /**
4
4
  * ---
5
5
  * private: true
@@ -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;AAElE;;;;GAIG;AACH,QAAA,MAAM,sBAAsB,UAAW,KAAK,KAAG,aAmC9C,CAAA;AAED,eAAe,sBAAsB,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 './types';
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
- makeStyles: PropTypes.Requireable<(...args: any[]) => any>;
16
- styles: PropTypes.Requireable<object>;
17
- label: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
18
- allowMultiple: PropTypes.Requireable<boolean>;
19
- /**
20
- * children of type `Menu.Item`, `Menu.Separator`
21
- */
22
- children: {
23
- (props: Record<string, any>, propName: string, componentName: string): Error | null;
24
- isRequired: (props: Record<string, any>, propName: string, componentName: string, location?: string | undefined, propFullName?: string | undefined) => Error | null;
25
- };
26
- /**
27
- * an array of the values (or indices by default) for the selected items
28
- */
29
- selected: (props: Record<string, any>, propName: string, componentName: string) => Error | null;
30
- /**
31
- * an array of the values (or indices by default) for the selected items on initial render
32
- */
33
- defaultSelected: PropTypes.Requireable<any[]>;
34
- /**
35
- * call this function when a menu item is selected
36
- */
37
- onSelect: PropTypes.Requireable<(...args: any[]) => any>;
38
- onMouseOver: PropTypes.Requireable<(...args: any[]) => any>;
39
- onKeyDown: PropTypes.Requireable<(...args: any[]) => any>;
40
- /**
41
- * the id of the element that the menu items will act upon
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;