@instructure/ui-select 7.14.1 → 7.17.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 +14 -0
- package/es/Select/index.js +15 -7
- package/lib/Select/index.js +15 -7
- package/package.json +20 -20
- package/src/Select/index.js +14 -6
- package/types/index.d.ts +9 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
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
|
+
# [7.17.0](https://github.com/instructure/instructure-ui/compare/v7.16.0...v7.17.0) (2022-03-22)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-select
|
|
9
|
+
|
|
10
|
+
# [7.16.0](https://github.com/instructure/instructure-ui/compare/v7.15.0...v7.16.0) (2022-02-08)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @instructure/ui-select
|
|
13
|
+
|
|
14
|
+
# [7.15.0](https://github.com/instructure/instructure-ui/compare/v7.14.1...v7.15.0) (2022-02-03)
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
- **ui-select:** add `optionsMaxHeight` prop to Select ([41f9016](https://github.com/instructure/instructure-ui/commit/41f9016))
|
|
19
|
+
|
|
6
20
|
## [7.14.1](https://github.com/instructure/instructure-ui/compare/v7.14.0...v7.14.1) (2021-12-06)
|
|
7
21
|
|
|
8
22
|
**Note:** Version bump only for package @instructure/ui-select
|
package/es/Select/index.js
CHANGED
|
@@ -342,13 +342,14 @@ var Select = (_dec = testable(), _dec2 = themeable(theme, styles), _dec(_class =
|
|
|
342
342
|
var _this$props2 = this.props,
|
|
343
343
|
isShowingOptions = _this$props2.isShowingOptions,
|
|
344
344
|
optionsMaxWidth = _this$props2.optionsMaxWidth,
|
|
345
|
+
optionsMaxHeight = _this$props2.optionsMaxHeight,
|
|
345
346
|
visibleOptionsCount = _this$props2.visibleOptionsCount,
|
|
346
347
|
children = _this$props2.children;
|
|
347
348
|
var lastWasGroup = false;
|
|
348
349
|
var viewProps = isShowingOptions ? {
|
|
349
350
|
display: 'block',
|
|
350
351
|
overflowY: 'auto',
|
|
351
|
-
maxHeight: this._optionHeight * visibleOptionsCount,
|
|
352
|
+
maxHeight: optionsMaxHeight || this._optionHeight * visibleOptionsCount,
|
|
352
353
|
maxWidth: optionsMaxWidth || this.width,
|
|
353
354
|
background: 'primary',
|
|
354
355
|
elementRef: function elementRef(node) {
|
|
@@ -654,15 +655,21 @@ var Select = (_dec = testable(), _dec2 = themeable(theme, styles), _dec(_class =
|
|
|
654
655
|
htmlSize: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
655
656
|
|
|
656
657
|
/**
|
|
657
|
-
* The
|
|
658
|
-
* set, the list will only display as wide as the text input.
|
|
658
|
+
* The number of options that should be visible before having to scroll. Works best when the options are the same height.
|
|
659
659
|
*/
|
|
660
|
-
|
|
660
|
+
visibleOptionsCount: PropTypes.number,
|
|
661
661
|
|
|
662
662
|
/**
|
|
663
|
-
* The
|
|
663
|
+
* The max height the options list can be before having to scroll. If
|
|
664
|
+
* set, it will __override__ the `visibleOptionsCount` prop.
|
|
664
665
|
*/
|
|
665
|
-
|
|
666
|
+
optionsMaxHeight: PropTypes.string,
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* The max width the options list can be before option text wraps. If not
|
|
670
|
+
* set, the list will only display as wide as the text input.
|
|
671
|
+
*/
|
|
672
|
+
optionsMaxWidth: PropTypes.string,
|
|
666
673
|
|
|
667
674
|
/**
|
|
668
675
|
* Displays messages and validation for the input. It should be an object
|
|
@@ -770,8 +777,9 @@ var Select = (_dec = testable(), _dec2 = themeable(theme, styles), _dec(_class =
|
|
|
770
777
|
isInline: false,
|
|
771
778
|
width: void 0,
|
|
772
779
|
htmlSize: void 0,
|
|
773
|
-
optionsMaxWidth: void 0,
|
|
774
780
|
visibleOptionsCount: 8,
|
|
781
|
+
optionsMaxHeight: void 0,
|
|
782
|
+
optionsMaxWidth: void 0,
|
|
775
783
|
messages: void 0,
|
|
776
784
|
placement: 'bottom stretch',
|
|
777
785
|
constrain: 'window',
|
package/lib/Select/index.js
CHANGED
|
@@ -361,13 +361,14 @@ var Select = (_dec = (0, _testable.testable)(), _dec2 = (0, _themeable.themeable
|
|
|
361
361
|
var _this$props2 = this.props,
|
|
362
362
|
isShowingOptions = _this$props2.isShowingOptions,
|
|
363
363
|
optionsMaxWidth = _this$props2.optionsMaxWidth,
|
|
364
|
+
optionsMaxHeight = _this$props2.optionsMaxHeight,
|
|
364
365
|
visibleOptionsCount = _this$props2.visibleOptionsCount,
|
|
365
366
|
children = _this$props2.children;
|
|
366
367
|
var lastWasGroup = false;
|
|
367
368
|
var viewProps = isShowingOptions ? {
|
|
368
369
|
display: 'block',
|
|
369
370
|
overflowY: 'auto',
|
|
370
|
-
maxHeight: this._optionHeight * visibleOptionsCount,
|
|
371
|
+
maxHeight: optionsMaxHeight || this._optionHeight * visibleOptionsCount,
|
|
371
372
|
maxWidth: optionsMaxWidth || this.width,
|
|
372
373
|
background: 'primary',
|
|
373
374
|
elementRef: function elementRef(node) {
|
|
@@ -674,15 +675,21 @@ var Select = (_dec = (0, _testable.testable)(), _dec2 = (0, _themeable.themeable
|
|
|
674
675
|
htmlSize: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
675
676
|
|
|
676
677
|
/**
|
|
677
|
-
* The
|
|
678
|
-
* set, the list will only display as wide as the text input.
|
|
678
|
+
* The number of options that should be visible before having to scroll. Works best when the options are the same height.
|
|
679
679
|
*/
|
|
680
|
-
|
|
680
|
+
visibleOptionsCount: _propTypes.default.number,
|
|
681
681
|
|
|
682
682
|
/**
|
|
683
|
-
* The
|
|
683
|
+
* The max height the options list can be before having to scroll. If
|
|
684
|
+
* set, it will __override__ the `visibleOptionsCount` prop.
|
|
684
685
|
*/
|
|
685
|
-
|
|
686
|
+
optionsMaxHeight: _propTypes.default.string,
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* The max width the options list can be before option text wraps. If not
|
|
690
|
+
* set, the list will only display as wide as the text input.
|
|
691
|
+
*/
|
|
692
|
+
optionsMaxWidth: _propTypes.default.string,
|
|
686
693
|
|
|
687
694
|
/**
|
|
688
695
|
* Displays messages and validation for the input. It should be an object
|
|
@@ -790,8 +797,9 @@ var Select = (_dec = (0, _testable.testable)(), _dec2 = (0, _themeable.themeable
|
|
|
790
797
|
isInline: false,
|
|
791
798
|
width: void 0,
|
|
792
799
|
htmlSize: void 0,
|
|
793
|
-
optionsMaxWidth: void 0,
|
|
794
800
|
visibleOptionsCount: 8,
|
|
801
|
+
optionsMaxHeight: void 0,
|
|
802
|
+
optionsMaxWidth: void 0,
|
|
795
803
|
messages: void 0,
|
|
796
804
|
placement: 'bottom stretch',
|
|
797
805
|
constrain: 'window',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-select",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.17.0",
|
|
4
4
|
"description": "A component for select and autocomplete behavior.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -23,28 +23,28 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "^7.
|
|
27
|
-
"@instructure/ui-color-utils": "^7.
|
|
28
|
-
"@instructure/ui-test-locator": "^7.
|
|
29
|
-
"@instructure/ui-test-utils": "^7.
|
|
26
|
+
"@instructure/ui-babel-preset": "^7.17.0",
|
|
27
|
+
"@instructure/ui-color-utils": "^7.17.0",
|
|
28
|
+
"@instructure/ui-test-locator": "^7.17.0",
|
|
29
|
+
"@instructure/ui-test-utils": "^7.17.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@babel/runtime": "^7.9.2",
|
|
33
|
-
"@instructure/ui-dom-utils": "^7.
|
|
34
|
-
"@instructure/ui-form-field": "^7.
|
|
35
|
-
"@instructure/ui-icons": "^7.
|
|
36
|
-
"@instructure/ui-options": "^7.
|
|
37
|
-
"@instructure/ui-popover": "^7.
|
|
38
|
-
"@instructure/ui-position": "^7.
|
|
39
|
-
"@instructure/ui-prop-types": "^7.
|
|
40
|
-
"@instructure/ui-react-utils": "^7.
|
|
41
|
-
"@instructure/ui-selectable": "^7.
|
|
42
|
-
"@instructure/ui-testable": "^7.
|
|
43
|
-
"@instructure/ui-text-input": "^7.
|
|
44
|
-
"@instructure/ui-themeable": "^7.
|
|
45
|
-
"@instructure/ui-utils": "^7.
|
|
46
|
-
"@instructure/ui-view": "^7.
|
|
47
|
-
"@instructure/uid": "^7.
|
|
33
|
+
"@instructure/ui-dom-utils": "^7.17.0",
|
|
34
|
+
"@instructure/ui-form-field": "^7.17.0",
|
|
35
|
+
"@instructure/ui-icons": "^7.17.0",
|
|
36
|
+
"@instructure/ui-options": "^7.17.0",
|
|
37
|
+
"@instructure/ui-popover": "^7.17.0",
|
|
38
|
+
"@instructure/ui-position": "^7.17.0",
|
|
39
|
+
"@instructure/ui-prop-types": "^7.17.0",
|
|
40
|
+
"@instructure/ui-react-utils": "^7.17.0",
|
|
41
|
+
"@instructure/ui-selectable": "^7.17.0",
|
|
42
|
+
"@instructure/ui-testable": "^7.17.0",
|
|
43
|
+
"@instructure/ui-text-input": "^7.17.0",
|
|
44
|
+
"@instructure/ui-themeable": "^7.17.0",
|
|
45
|
+
"@instructure/ui-utils": "^7.17.0",
|
|
46
|
+
"@instructure/ui-view": "^7.17.0",
|
|
47
|
+
"@instructure/uid": "^7.17.0",
|
|
48
48
|
"classnames": "^2",
|
|
49
49
|
"prop-types": "^15"
|
|
50
50
|
},
|
package/src/Select/index.js
CHANGED
|
@@ -127,15 +127,20 @@ class Select extends Component {
|
|
|
127
127
|
* provided via the `width` prop. Only applicable if `isInline={true}`.
|
|
128
128
|
*/
|
|
129
129
|
htmlSize: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
130
|
+
/**
|
|
131
|
+
* The number of options that should be visible before having to scroll. Works best when the options are the same height.
|
|
132
|
+
*/
|
|
133
|
+
visibleOptionsCount: PropTypes.number,
|
|
134
|
+
/**
|
|
135
|
+
* The max height the options list can be before having to scroll. If
|
|
136
|
+
* set, it will __override__ the `visibleOptionsCount` prop.
|
|
137
|
+
*/
|
|
138
|
+
optionsMaxHeight: PropTypes.string,
|
|
130
139
|
/**
|
|
131
140
|
* The max width the options list can be before option text wraps. If not
|
|
132
141
|
* set, the list will only display as wide as the text input.
|
|
133
142
|
*/
|
|
134
143
|
optionsMaxWidth: PropTypes.string,
|
|
135
|
-
/**
|
|
136
|
-
* The number of options that should be visible before having to scroll.
|
|
137
|
-
*/
|
|
138
|
-
visibleOptionsCount: PropTypes.number,
|
|
139
144
|
/**
|
|
140
145
|
* Displays messages and validation for the input. It should be an object
|
|
141
146
|
* with the following shape:
|
|
@@ -228,8 +233,9 @@ class Select extends Component {
|
|
|
228
233
|
isInline: false,
|
|
229
234
|
width: undefined,
|
|
230
235
|
htmlSize: undefined,
|
|
231
|
-
optionsMaxWidth: undefined,
|
|
232
236
|
visibleOptionsCount: 8,
|
|
237
|
+
optionsMaxHeight: undefined,
|
|
238
|
+
optionsMaxWidth: undefined,
|
|
233
239
|
messages: undefined,
|
|
234
240
|
placement: 'bottom stretch',
|
|
235
241
|
constrain: 'window',
|
|
@@ -535,6 +541,7 @@ class Select extends Component {
|
|
|
535
541
|
const {
|
|
536
542
|
isShowingOptions,
|
|
537
543
|
optionsMaxWidth,
|
|
544
|
+
optionsMaxHeight,
|
|
538
545
|
visibleOptionsCount,
|
|
539
546
|
children
|
|
540
547
|
} = this.props
|
|
@@ -544,7 +551,8 @@ class Select extends Component {
|
|
|
544
551
|
? {
|
|
545
552
|
display: 'block',
|
|
546
553
|
overflowY: 'auto',
|
|
547
|
-
maxHeight:
|
|
554
|
+
maxHeight:
|
|
555
|
+
optionsMaxHeight || this._optionHeight * visibleOptionsCount,
|
|
548
556
|
maxWidth: optionsMaxWidth || this.width,
|
|
549
557
|
background: 'primary',
|
|
550
558
|
elementRef: (node) => (this._listView = node)
|
package/types/index.d.ts
CHANGED
|
@@ -68,15 +68,20 @@ export interface SelectProps {
|
|
|
68
68
|
* provided via the `width` prop. Only applicable if `isInline={true}`.
|
|
69
69
|
*/
|
|
70
70
|
htmlSize?: SelectHtmlSize;
|
|
71
|
+
/**
|
|
72
|
+
* The number of options that should be visible before having to scroll. Works best when the options are the same height.
|
|
73
|
+
*/
|
|
74
|
+
visibleOptionsCount?: number;
|
|
75
|
+
/**
|
|
76
|
+
* The max height the options list can be before having to scroll. If
|
|
77
|
+
* set, it will __override__ the `visibleOptionsCount` prop.
|
|
78
|
+
*/
|
|
79
|
+
optionsMaxHeight?: string;
|
|
71
80
|
/**
|
|
72
81
|
* The max width the options list can be before option text wraps. If not
|
|
73
82
|
* set, the list will only display as wide as the text input.
|
|
74
83
|
*/
|
|
75
84
|
optionsMaxWidth?: string;
|
|
76
|
-
/**
|
|
77
|
-
* The number of options that should be visible before having to scroll.
|
|
78
|
-
*/
|
|
79
|
-
visibleOptionsCount?: number;
|
|
80
85
|
/**
|
|
81
86
|
* Displays messages and validation for the input. It should be an object
|
|
82
87
|
* with the following shape:
|