@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
@@ -23,7 +23,7 @@
23
23
  */
24
24
 
25
25
  import { MenuItemTheme } from '@instructure/shared-types'
26
- import { MenuItemProps } from './types'
26
+ import { MenuItemProps } from './props'
27
27
 
28
28
  /**
29
29
  * ---
@@ -23,7 +23,7 @@
23
23
  */
24
24
 
25
25
  import { MenuItemTheme } from '@instructure/shared-types'
26
- import { Theme, ThemeSpecificStyle } from '@instructure/ui-themes'
26
+ import type { Theme, ThemeSpecificStyle } from '@instructure/ui-themes'
27
27
 
28
28
  /**
29
29
  * Generates the theme object for the component from the theme and provided additional information
@@ -24,13 +24,8 @@
24
24
 
25
25
  /** @jsx jsx */
26
26
  import { Children, Component, ReactElement } from 'react'
27
- import PropTypes from 'prop-types'
28
27
 
29
28
  import { withStyle, jsx } from '@instructure/emotion'
30
- import {
31
- controllable,
32
- Children as ChildrenPropTypes
33
- } from '@instructure/ui-prop-types'
34
29
  import {
35
30
  omitProps,
36
31
  safeCloneElement,
@@ -41,11 +36,12 @@ import { hasVisibleChildren } from '@instructure/ui-a11y-utils'
41
36
  import { testable } from '@instructure/ui-testable'
42
37
 
43
38
  import { MenuItem } from '../MenuItem'
44
- import { MenuItemSeparator } from '../MenuItemSeparator'
45
39
 
46
40
  import generateStyle from './styles'
47
41
  import generateComponentTheme from './theme'
48
- import { MenuGroupProps } from './types'
42
+
43
+ import { propTypes, allowedProps } from './props'
44
+ import type { MenuGroupProps } from './props'
49
45
 
50
46
  /**
51
47
  ---
@@ -58,52 +54,10 @@ id: Menu.Group
58
54
  class MenuItemGroup extends Component<MenuGroupProps> {
59
55
  static readonly componentId = 'Menu.Group'
60
56
 
61
- static propTypes = {
62
- // eslint-disable-next-line react/require-default-props
63
- makeStyles: PropTypes.func,
64
- // eslint-disable-next-line react/require-default-props
65
- styles: PropTypes.object,
66
- label: PropTypes.node.isRequired,
67
- allowMultiple: PropTypes.bool,
68
- /**
69
- * children of type `Menu.Item`, `Menu.Separator`
70
- */
71
- children: ChildrenPropTypes.oneOf([MenuItem, MenuItemSeparator]),
72
- /**
73
- * an array of the values (or indices by default) for the selected items
74
- */
75
- selected: controllable(PropTypes.array, 'onSelect', 'defaultSelected'),
76
- /**
77
- * an array of the values (or indices by default) for the selected items on initial render
78
- */
79
- defaultSelected: PropTypes.array,
80
- /**
81
- * call this function when a menu item is selected
82
- */
83
- onSelect: PropTypes.func,
84
- onMouseOver: PropTypes.func,
85
- onKeyDown: PropTypes.func,
86
- /**
87
- * the id of the element that the menu items will act upon
88
- */
89
- controls: PropTypes.string,
90
- /**
91
- * returns a reference to the `MenuItem`
92
- */
93
- itemRef: PropTypes.func,
94
- disabled: PropTypes.bool,
95
- /**
96
- * should the group appear in the tab order (the first item will have a tabIndex of 0)
97
- */
98
- isTabbable: PropTypes.bool
99
- }
100
-
57
+ static propTypes = propTypes
58
+ static allowedProps = allowedProps
101
59
  static defaultProps = {
102
- onMouseOver: undefined,
103
60
  disabled: false,
104
- controls: undefined,
105
- onKeyDown: undefined,
106
- selected: undefined,
107
61
  children: null,
108
62
  isTabbable: false,
109
63
  allowMultiple: false,
@@ -230,7 +184,7 @@ class MenuItemGroup extends Component<MenuGroupProps> {
230
184
  const { label } = this.props
231
185
 
232
186
  return hasVisibleChildren(label) ? (
233
- <span css={this.props.styles.label}>{label}</span>
187
+ <span css={this.props.styles?.label}>{label}</span>
234
188
  ) : (
235
189
  label
236
190
  )
@@ -282,16 +236,15 @@ class MenuItemGroup extends Component<MenuGroupProps> {
282
236
  return (
283
237
  <span
284
238
  {...props}
285
- css={this.props.styles.menuItemGroup}
239
+ css={this.props.styles?.menuItemGroup}
286
240
  role="presentation"
287
241
  >
288
242
  {/* @ts-expect-error ts-migrate(2339) FIXME: Property '_labelId' does not exist on type 'MenuIt... Remove this comment to see the full error message */}
289
243
  <span id={this._labelId}>{this.renderLabel()}</span>
290
244
  <ul
291
245
  role="menu"
292
- css={this.props.styles.items}
293
- // @ts-expect-error ts-migrate(2322) FIXME: Type '"true" | null' is not assignable to type 'bo... Remove this comment to see the full error message
294
- aria-disabled={this.props.disabled ? 'true' : null}
246
+ css={this.props.styles?.items}
247
+ aria-disabled={this.props.disabled ? 'true' : undefined}
295
248
  // @ts-expect-error ts-migrate(2339) FIXME: Property '_labelId' does not exist on type 'MenuIt... Remove this comment to see the full error message
296
249
  aria-labelledby={this._labelId}
297
250
  >
@@ -0,0 +1,110 @@
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 {
28
+ controllable,
29
+ Children as ChildrenPropTypes
30
+ } from '@instructure/ui-prop-types'
31
+ import { MenuItem } from '../MenuItem'
32
+ import { MenuItemSeparator } from '../MenuItemSeparator'
33
+
34
+ import type { PropValidators } from '@instructure/shared-types'
35
+ import type { WithStyleProps } from '@instructure/emotion'
36
+
37
+ type MenuGroupOwnProps = {
38
+ label: React.ReactNode
39
+ allowMultiple?: boolean
40
+ children?: React.ReactNode // TODO: oneOf([MenuItem, MenuItemSeparator])
41
+ selected?: any // TODO: controllable(PropTypes.array, 'onSelect', 'defaultSelected')
42
+ defaultSelected?: any[]
43
+ onSelect?: (...args: any[]) => any
44
+ onMouseOver?: (...args: any[]) => any
45
+ onKeyDown?: (...args: any[]) => any
46
+ controls?: string
47
+ itemRef?: (...args: any[]) => any
48
+ disabled?: boolean
49
+ isTabbable?: boolean
50
+ }
51
+
52
+ type PropKeys = keyof MenuGroupOwnProps
53
+
54
+ type AllowedPropKeys = Readonly<Array<PropKeys>>
55
+
56
+ type MenuGroupProps = MenuGroupOwnProps & WithStyleProps
57
+
58
+ const propTypes: PropValidators<PropKeys> = {
59
+ label: PropTypes.node.isRequired,
60
+ allowMultiple: PropTypes.bool,
61
+ /**
62
+ * children of type `Menu.Item`, `Menu.Separator`
63
+ */
64
+ children: ChildrenPropTypes.oneOf([MenuItem, MenuItemSeparator]),
65
+ /**
66
+ * an array of the values (or indices by default) for the selected items
67
+ */
68
+ selected: controllable(PropTypes.array, 'onSelect', 'defaultSelected'),
69
+ /**
70
+ * an array of the values (or indices by default) for the selected items on initial render
71
+ */
72
+ defaultSelected: PropTypes.array,
73
+ /**
74
+ * call this function when a menu item is selected
75
+ */
76
+ onSelect: PropTypes.func,
77
+ onMouseOver: PropTypes.func,
78
+ onKeyDown: PropTypes.func,
79
+ /**
80
+ * the id of the element that the menu items will act upon
81
+ */
82
+ controls: PropTypes.string,
83
+ /**
84
+ * returns a reference to the `MenuItem`
85
+ */
86
+ itemRef: PropTypes.func,
87
+ disabled: PropTypes.bool,
88
+ /**
89
+ * should the group appear in the tab order (the first item will have a tabIndex of 0)
90
+ */
91
+ isTabbable: PropTypes.bool
92
+ }
93
+
94
+ const allowedProps: AllowedPropKeys = [
95
+ 'label',
96
+ 'allowMultiple',
97
+ 'children',
98
+ 'selected',
99
+ 'defaultSelected',
100
+ 'onSelect',
101
+ 'onMouseOver',
102
+ 'onKeyDown',
103
+ 'controls',
104
+ 'itemRef',
105
+ 'disabled',
106
+ 'isTabbable'
107
+ ]
108
+
109
+ export type { MenuGroupProps }
110
+ export { propTypes, allowedProps }
@@ -22,7 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import { Theme, ThemeSpecificStyle } from '@instructure/ui-themes'
25
+ import type { Theme, ThemeSpecificStyle } from '@instructure/ui-themes'
26
26
  import { MenuGroupTheme } from '@instructure/shared-types'
27
27
 
28
28
  /**
@@ -24,7 +24,6 @@
24
24
 
25
25
  /** @jsx jsx */
26
26
  import { Component } from 'react'
27
- import PropTypes from 'prop-types'
28
27
 
29
28
  import { withStyle, jsx } from '@instructure/emotion'
30
29
  import { testable } from '@instructure/ui-testable'
@@ -32,7 +31,9 @@ import { omitProps } from '@instructure/ui-react-utils'
32
31
 
33
32
  import generateStyle from './styles'
34
33
  import generateComponentTheme from './theme'
35
- import { MenuSeparatorProps } from './types'
34
+
35
+ import { propTypes, allowedProps } from './props'
36
+ import type { MenuSeparatorProps } from './props'
36
37
 
37
38
  /**
38
39
  ---
@@ -46,12 +47,8 @@ id: Menu.Separator
46
47
  class MenuItemSeparator extends Component<MenuSeparatorProps> {
47
48
  static readonly componentId = 'Menu.Separator'
48
49
 
49
- static propTypes = {
50
- // eslint-disable-next-line react/require-default-props
51
- makeStyles: PropTypes.func,
52
- // eslint-disable-next-line react/require-default-props
53
- styles: PropTypes.object
54
- }
50
+ static propTypes = propTypes
51
+ static allowedProps = allowedProps
55
52
 
56
53
  componentDidMount() {
57
54
  // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
@@ -69,7 +66,7 @@ class MenuItemSeparator extends Component<MenuSeparatorProps> {
69
66
  <div
70
67
  {...props}
71
68
  role="presentation"
72
- css={this.props.styles.menuItemSeparator}
69
+ css={this.props.styles?.menuItemSeparator}
73
70
  />
74
71
  )
75
72
  }
@@ -22,22 +22,22 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import { AsElementType } from '@instructure/shared-types'
26
-
27
- export type MenuItemProps = {
28
- makeStyles?: (...args: any[]) => any
29
- styles?: any
30
- defaultSelected?: boolean
31
- selected?: any // TODO: controllable(PropTypes.bool, 'onSelect', 'defaultSelected')
32
- onSelect?: (...args: any[]) => any
33
- onClick?: (...args: any[]) => any
34
- onKeyDown?: (...args: any[]) => any
35
- onKeyUp?: (...args: any[]) => any
36
- onMouseOver?: (...args: any[]) => any
37
- controls?: string
38
- disabled?: boolean
39
- as?: AsElementType
40
- type?: 'button' | 'checkbox' | 'radio' | 'flyout'
41
- value?: string | number
42
- href?: string
43
- }
25
+ import type { WithStyleProps } from '@instructure/emotion'
26
+ import type { PropValidators } from '@instructure/shared-types'
27
+
28
+ // keeping here to keep the structure of props.ts
29
+ // eslint-disable-next-line
30
+ type MenuSeparatorOwnProps = {}
31
+
32
+ type PropKeys = keyof MenuSeparatorOwnProps
33
+
34
+ type AllowedPropKeys = Readonly<Array<PropKeys>>
35
+
36
+ type MenuSeparatorProps = MenuSeparatorOwnProps & WithStyleProps
37
+
38
+ const propTypes: PropValidators<PropKeys> = {}
39
+
40
+ const allowedProps: AllowedPropKeys = []
41
+
42
+ export type { MenuSeparatorProps }
43
+ export { propTypes, allowedProps }
@@ -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 { MenuSeparatorTheme } from '@instructure/shared-types'
27
27
 
28
28
  /**
@@ -23,16 +23,10 @@
23
23
  */
24
24
  /** @jsx jsx */
25
25
  import { Children, Component, ReactElement } from 'react'
26
- import PropTypes from 'prop-types'
27
26
  import keycode from 'keycode'
28
27
 
29
28
  import { Popover } from '@instructure/ui-popover'
30
29
  import { uid } from '@instructure/uid'
31
- import {
32
- controllable,
33
- Children as ChildrenPropTypes
34
- } from '@instructure/ui-prop-types'
35
- import { PositionPropTypes } from '@instructure/ui-position'
36
30
  import {
37
31
  safeCloneElement,
38
32
  matchComponentTypes
@@ -49,7 +43,9 @@ import { withStyle, jsx } from '@instructure/emotion'
49
43
 
50
44
  import generateStyle from './styles'
51
45
  import generateComponentTheme from './theme'
52
- import { MenuProps } from './types'
46
+
47
+ import { propTypes, allowedProps } from './props'
48
+ import type { MenuProps } from './props'
53
49
 
54
50
  /**
55
51
  ---
@@ -61,134 +57,8 @@ category: components
61
57
  class Menu extends Component<MenuProps> {
62
58
  static readonly componentId = 'Menu'
63
59
 
64
- static propTypes = {
65
- // eslint-disable-next-line react/require-default-props
66
- makeStyles: PropTypes.func,
67
- // eslint-disable-next-line react/require-default-props
68
- styles: PropTypes.object,
69
- /**
70
- * Children of type `Menu.Item`, `Menu.Group`, `Menu.Separator`, or `Menu`
71
- */
72
- children: ChildrenPropTypes.oneOf([
73
- 'MenuItem',
74
- 'MenuItemGroup',
75
- 'MenuItemSeparator',
76
- 'Menu'
77
- ]),
78
- /**
79
- * Description of the `<Menu />`
80
- */
81
- label: PropTypes.string,
82
- /**
83
- * Is the `<Menu />` disabled
84
- */
85
- disabled: PropTypes.bool,
86
- /**
87
- * The trigger element, if the `<Menu />` is to render as a popover
88
- */
89
- trigger: PropTypes.node,
90
- /**
91
- * If a trigger is supplied, where should the `<Menu />` be placed (relative to the trigger)
92
- */
93
- placement: PositionPropTypes.placement,
94
- /**
95
- * Should the `<Menu />` be open for the initial render
96
- */
97
- defaultShow: PropTypes.bool,
98
- /**
99
- * Is the `<Menu />` open (should be accompanied by `onToggle`)
100
- */
101
- show: controllable(PropTypes.bool, 'onToggle', 'defaultShow'),
102
- /**
103
- * Callback fired when the `<Menu />` is toggled open/closed. When used with `show`,
104
- * the component will not control its own state.
105
- */
106
- onToggle: PropTypes.func,
107
- /**
108
- * Callback fired when an item within the `<Menu />` is selected
109
- */
110
- onSelect: PropTypes.func,
111
- /**
112
- * If a trigger is supplied, callback fired when the `<Menu />` is closed
113
- */
114
- onDismiss: PropTypes.func,
115
- /**
116
- * If a trigger is supplied, callback fired when the `<Menu />` trigger is blurred
117
- */
118
- onBlur: PropTypes.func,
119
- /**
120
- * If a trigger is supplied, callback fired when the `<Menu />` trigger is focused
121
- */
122
- onFocus: PropTypes.func,
123
- /**
124
- * If a trigger is supplied, callback fired onMouseOver for the `<Menu />` trigger
125
- */
126
- onMouseOver: PropTypes.func,
127
- /**
128
- * Callback fired on the onKeyDown of the `<Menu />`
129
- */
130
- onKeyDown: PropTypes.func,
131
- /**
132
- * Callback fired on the onKeyUp of the `<Menu />`
133
- */
134
- onKeyUp: PropTypes.func,
135
- /*
136
- * A function that returns a reference to the `<Menu />`
137
- */
138
- menuRef: PropTypes.func,
139
- /**
140
- * A function that returns a reference to the `<Popover />`
141
- */
142
- popoverRef: PropTypes.func,
143
- /**
144
- * If a trigger is supplied, an element or a function returning an element to use as the mount node
145
- * for the `<Menu />` (defaults to `document.body`)
146
- */
147
- mountNode: PositionPropTypes.mountNode,
148
- /**
149
- * The parent in which to constrain the menu.
150
- * One of: 'window', 'scroll-parent', 'parent', 'none', an element,
151
- * or a function returning an element
152
- */
153
- constrain: PositionPropTypes.constrain,
154
- /**
155
- * If a trigger is supplied, an element, function returning an element, or array of elements that will not
156
- * be hidden from the screen reader when the `<Menu />` is open
157
- */
158
- liveRegion: PropTypes.oneOfType([
159
- PropTypes.arrayOf(PropTypes.element),
160
- PropTypes.element,
161
- PropTypes.func
162
- ]),
163
- /**
164
- * If a trigger is supplied, should the `<Menu />` hide when an item is selected
165
- */
166
- shouldHideOnSelect: PropTypes.bool,
167
- /**
168
- * If a trigger is supplied, should the `<Menu />` focus the trigger on after closing
169
- */
170
- shouldFocusTriggerOnClose: PropTypes.bool,
171
- /**
172
- * The type of `<Menu />`
173
- */
174
- type: PropTypes.oneOf(['flyout']),
175
- id: PropTypes.string,
176
- /**
177
- * Whether or not an arrow pointing to the trigger should be rendered
178
- */
179
- withArrow: PropTypes.bool,
180
- /**
181
- * The horizontal offset for the positioned content.
182
- * Works only if `trigger` is provided.
183
- */
184
- offsetX: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
185
- /**
186
- * The vertical offset for the positioned content.
187
- * Works only if `trigger` is provided.
188
- */
189
- offsetY: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
190
- }
191
-
60
+ static propTypes = propTypes
61
+ static allowedProps = allowedProps
192
62
  static defaultProps = {
193
63
  children: null,
194
64
  label: null,
@@ -221,9 +91,6 @@ class Menu extends Component<MenuProps> {
221
91
  liveRegion: null,
222
92
  shouldHideOnSelect: true,
223
93
  shouldFocusTriggerOnClose: true,
224
- show: undefined,
225
- id: undefined,
226
- type: undefined,
227
94
  withArrow: true,
228
95
  offsetX: 0,
229
96
  offsetY: 0
@@ -595,7 +462,7 @@ class Menu extends Component<MenuProps> {
595
462
  aria-label={label}
596
463
  // @ts-expect-error ts-migrate(2322) FIXME: Type 'string' is not assignable to type 'number | ... Remove this comment to see the full error message
597
464
  tabIndex="0"
598
- css={this.props.styles.menu}
465
+ css={this.props.styles?.menu}
599
466
  aria-labelledby={labelledBy || (trigger && this._labelId)}
600
467
  aria-controls={controls}
601
468
  // @ts-expect-error ts-migrate(2322) FIXME: Type '"true" | null' is not assignable to type 'bo... Remove this comment to see the full error message