@instructure/ui-menu 9.0.2-snapshot-13 → 9.0.2-snapshot-16
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 +5 -2
- package/es/Menu/props.js +3 -2
- package/es/Menu/styles.js +6 -1
- package/lib/Menu/props.js +3 -2
- package/lib/Menu/styles.js +6 -1
- package/package.json +19 -19
- package/src/Menu/props.ts +9 -2
- package/src/Menu/styles.ts +10 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Menu/index.d.ts +2 -0
- package/types/Menu/index.d.ts.map +1 -1
- package/types/Menu/props.d.ts +5 -0
- package/types/Menu/props.d.ts.map +1 -1
- package/types/Menu/styles.d.ts +2 -2
- package/types/Menu/styles.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [9.0.2-snapshot-
|
|
6
|
+
## [9.0.2-snapshot-16](https://github.com/instructure/instructure-ui/compare/v9.0.1...v9.0.2-snapshot-16) (2024-06-13)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **ui-menu:** add maxHeight functionality to Menu ([6494c4a](https://github.com/instructure/instructure-ui/commit/6494c4a78522e5c2a16d55ed5f000b8b7647c47d))
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
|
package/es/Menu/props.js
CHANGED
|
@@ -51,7 +51,8 @@ const propTypes = {
|
|
|
51
51
|
id: PropTypes.string,
|
|
52
52
|
withArrow: PropTypes.bool,
|
|
53
53
|
offsetX: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
54
|
-
offsetY: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
54
|
+
offsetY: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
55
|
+
maxHeight: PropTypes.string
|
|
55
56
|
};
|
|
56
|
-
const 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'];
|
|
57
|
+
const 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'];
|
|
57
58
|
export { propTypes, allowedProps };
|
package/es/Menu/styles.js
CHANGED
|
@@ -32,10 +32,15 @@
|
|
|
32
32
|
* @param {Object} state the state of the component, the style is applied to
|
|
33
33
|
* @return {Object} The final style object, which will be used in the component
|
|
34
34
|
*/
|
|
35
|
-
const generateStyle = componentTheme => {
|
|
35
|
+
const generateStyle = (componentTheme, props) => {
|
|
36
|
+
const maxHeight = props.maxHeight ? {
|
|
37
|
+
maxHeight: props.maxHeight,
|
|
38
|
+
overflow: 'auto'
|
|
39
|
+
} : {};
|
|
36
40
|
return {
|
|
37
41
|
menu: {
|
|
38
42
|
label: 'menu',
|
|
43
|
+
...maxHeight,
|
|
39
44
|
minWidth: componentTheme.minWidth,
|
|
40
45
|
maxWidth: componentTheme.maxWidth,
|
|
41
46
|
listStyleType: 'none',
|
package/lib/Menu/props.js
CHANGED
|
@@ -59,6 +59,7 @@ const propTypes = exports.propTypes = {
|
|
|
59
59
|
id: _propTypes.default.string,
|
|
60
60
|
withArrow: _propTypes.default.bool,
|
|
61
61
|
offsetX: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
62
|
-
offsetY: _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
|
|
63
64
|
};
|
|
64
|
-
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'];
|
|
65
|
+
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'];
|
package/lib/Menu/styles.js
CHANGED
|
@@ -38,10 +38,15 @@ exports.default = void 0;
|
|
|
38
38
|
* @param {Object} state the state of the component, the style is applied to
|
|
39
39
|
* @return {Object} The final style object, which will be used in the component
|
|
40
40
|
*/
|
|
41
|
-
const generateStyle = componentTheme => {
|
|
41
|
+
const generateStyle = (componentTheme, props) => {
|
|
42
|
+
const maxHeight = props.maxHeight ? {
|
|
43
|
+
maxHeight: props.maxHeight,
|
|
44
|
+
overflow: 'auto'
|
|
45
|
+
} : {};
|
|
42
46
|
return {
|
|
43
47
|
menu: {
|
|
44
48
|
label: 'menu',
|
|
49
|
+
...maxHeight,
|
|
45
50
|
minWidth: componentTheme.minWidth,
|
|
46
51
|
maxWidth: componentTheme.maxWidth,
|
|
47
52
|
listStyleType: 'none',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-menu",
|
|
3
|
-
"version": "9.0.2-snapshot-
|
|
3
|
+
"version": "9.0.2-snapshot-16",
|
|
4
4
|
"description": "A dropdown menu component",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,30 +23,30 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-axe-check": "9.0.2-snapshot-
|
|
27
|
-
"@instructure/ui-babel-preset": "9.0.2-snapshot-
|
|
28
|
-
"@instructure/ui-color-utils": "9.0.2-snapshot-
|
|
29
|
-
"@instructure/ui-test-utils": "9.0.2-snapshot-
|
|
30
|
-
"@instructure/ui-themes": "9.0.2-snapshot-
|
|
26
|
+
"@instructure/ui-axe-check": "9.0.2-snapshot-16",
|
|
27
|
+
"@instructure/ui-babel-preset": "9.0.2-snapshot-16",
|
|
28
|
+
"@instructure/ui-color-utils": "9.0.2-snapshot-16",
|
|
29
|
+
"@instructure/ui-test-utils": "9.0.2-snapshot-16",
|
|
30
|
+
"@instructure/ui-themes": "9.0.2-snapshot-16",
|
|
31
31
|
"@testing-library/jest-dom": "^6.4.5",
|
|
32
32
|
"@testing-library/react": "^15.0.7",
|
|
33
33
|
"@testing-library/user-event": "^14.5.2"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@babel/runtime": "^7.24.5",
|
|
37
|
-
"@instructure/console": "9.0.2-snapshot-
|
|
38
|
-
"@instructure/emotion": "9.0.2-snapshot-
|
|
39
|
-
"@instructure/shared-types": "9.0.2-snapshot-
|
|
40
|
-
"@instructure/ui-a11y-utils": "9.0.2-snapshot-
|
|
41
|
-
"@instructure/ui-dom-utils": "9.0.2-snapshot-
|
|
42
|
-
"@instructure/ui-icons": "9.0.2-snapshot-
|
|
43
|
-
"@instructure/ui-popover": "9.0.2-snapshot-
|
|
44
|
-
"@instructure/ui-position": "9.0.2-snapshot-
|
|
45
|
-
"@instructure/ui-prop-types": "9.0.2-snapshot-
|
|
46
|
-
"@instructure/ui-react-utils": "9.0.2-snapshot-
|
|
47
|
-
"@instructure/ui-testable": "9.0.2-snapshot-
|
|
48
|
-
"@instructure/ui-utils": "9.0.2-snapshot-
|
|
49
|
-
"@instructure/ui-view": "9.0.2-snapshot-
|
|
37
|
+
"@instructure/console": "9.0.2-snapshot-16",
|
|
38
|
+
"@instructure/emotion": "9.0.2-snapshot-16",
|
|
39
|
+
"@instructure/shared-types": "9.0.2-snapshot-16",
|
|
40
|
+
"@instructure/ui-a11y-utils": "9.0.2-snapshot-16",
|
|
41
|
+
"@instructure/ui-dom-utils": "9.0.2-snapshot-16",
|
|
42
|
+
"@instructure/ui-icons": "9.0.2-snapshot-16",
|
|
43
|
+
"@instructure/ui-popover": "9.0.2-snapshot-16",
|
|
44
|
+
"@instructure/ui-position": "9.0.2-snapshot-16",
|
|
45
|
+
"@instructure/ui-prop-types": "9.0.2-snapshot-16",
|
|
46
|
+
"@instructure/ui-react-utils": "9.0.2-snapshot-16",
|
|
47
|
+
"@instructure/ui-testable": "9.0.2-snapshot-16",
|
|
48
|
+
"@instructure/ui-utils": "9.0.2-snapshot-16",
|
|
49
|
+
"@instructure/ui-view": "9.0.2-snapshot-16",
|
|
50
50
|
"keycode": "^2.2.1",
|
|
51
51
|
"prop-types": "^15.8.1"
|
|
52
52
|
},
|
package/src/Menu/props.ts
CHANGED
|
@@ -166,6 +166,11 @@ type MenuOwnProps = {
|
|
|
166
166
|
* Works only if `trigger` is provided.
|
|
167
167
|
*/
|
|
168
168
|
offsetY?: string | number
|
|
169
|
+
/**
|
|
170
|
+
* The maximum height the menu can be. If not set, the menu won't
|
|
171
|
+
* scroll and will be as tall as the content requires
|
|
172
|
+
*/
|
|
173
|
+
maxHeight?: string | number
|
|
169
174
|
}
|
|
170
175
|
|
|
171
176
|
type PropKeys = keyof MenuOwnProps
|
|
@@ -212,7 +217,8 @@ const propTypes: PropValidators<PropKeys> = {
|
|
|
212
217
|
id: PropTypes.string,
|
|
213
218
|
withArrow: PropTypes.bool,
|
|
214
219
|
offsetX: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
215
|
-
offsetY: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
220
|
+
offsetY: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
221
|
+
maxHeight: PropTypes.string
|
|
216
222
|
}
|
|
217
223
|
|
|
218
224
|
const allowedProps: AllowedPropKeys = [
|
|
@@ -241,7 +247,8 @@ const allowedProps: AllowedPropKeys = [
|
|
|
241
247
|
'id',
|
|
242
248
|
'withArrow',
|
|
243
249
|
'offsetX',
|
|
244
|
-
'offsetY'
|
|
250
|
+
'offsetY',
|
|
251
|
+
'maxHeight'
|
|
245
252
|
]
|
|
246
253
|
|
|
247
254
|
export type { MenuProps, MenuStyle }
|
package/src/Menu/styles.ts
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import type { MenuTheme } from '@instructure/shared-types'
|
|
26
|
-
import type { MenuStyle } from './props'
|
|
26
|
+
import type { MenuStyle, MenuProps } from './props'
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* ---
|
|
@@ -35,10 +35,18 @@ import type { MenuStyle } from './props'
|
|
|
35
35
|
* @param {Object} state the state of the component, the style is applied to
|
|
36
36
|
* @return {Object} The final style object, which will be used in the component
|
|
37
37
|
*/
|
|
38
|
-
const generateStyle = (
|
|
38
|
+
const generateStyle = (
|
|
39
|
+
componentTheme: MenuTheme,
|
|
40
|
+
props: MenuProps
|
|
41
|
+
): MenuStyle => {
|
|
42
|
+
const maxHeight = props.maxHeight
|
|
43
|
+
? { maxHeight: props.maxHeight, overflow: 'auto' }
|
|
44
|
+
: {}
|
|
45
|
+
|
|
39
46
|
return {
|
|
40
47
|
menu: {
|
|
41
48
|
label: 'menu',
|
|
49
|
+
...maxHeight,
|
|
42
50
|
minWidth: componentTheme.minWidth,
|
|
43
51
|
maxWidth: componentTheme.maxWidth,
|
|
44
52
|
listStyleType: 'none',
|