@instructure/ui-select 8.53.3-snapshot-13 → 8.53.3-snapshot-15
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/Select/index.js +6 -4
- package/es/Select/props.js +3 -2
- package/lib/Select/index.js +6 -4
- package/lib/Select/props.js +3 -2
- package/package.json +22 -22
- package/src/Select/index.tsx +6 -3
- package/src/Select/props.ts +9 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Select/index.d.ts +3 -14
- package/types/Select/index.d.ts.map +1 -1
- package/types/Select/props.d.ts +4 -0
- package/types/Select/props.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
|
-
## [8.53.3-snapshot-
|
|
6
|
+
## [8.53.3-snapshot-15](https://github.com/instructure/instructure-ui/compare/v8.53.2...v8.53.3-snapshot-15) (2024-03-01)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **ui-select:** expose prop to control auto-scrolling in select component ([7cd4c22](https://github.com/instructure/instructure-ui/commit/7cd4c22c83bff1a55481e359199865b176dd26df))
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
|
package/es/Select/index.js
CHANGED
|
@@ -120,9 +120,10 @@ let Select = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gen
|
|
|
120
120
|
componentDidUpdate() {
|
|
121
121
|
var _this$props$makeStyle2, _this$props4;
|
|
122
122
|
(_this$props$makeStyle2 = (_this$props4 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props4);
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
if (this.props.scrollToHighlightedOption) {
|
|
124
|
+
// scroll option into view if needed
|
|
125
|
+
requestAnimationFrame(() => this.scrollToOption(this.highlightedOptionId));
|
|
126
|
+
}
|
|
126
127
|
}
|
|
127
128
|
focus() {
|
|
128
129
|
this._input && this._input.focus();
|
|
@@ -561,7 +562,8 @@ let Select = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gen
|
|
|
561
562
|
visibleOptionsCount: 8,
|
|
562
563
|
placement: 'bottom stretch',
|
|
563
564
|
constrain: 'window',
|
|
564
|
-
shouldNotWrap: false
|
|
565
|
+
shouldNotWrap: false,
|
|
566
|
+
scrollToHighlightedOption: false
|
|
565
567
|
}, _class2.Option = Option, _class2.Group = Group, _class2)) || _class) || _class) || _class);
|
|
566
568
|
export default Select;
|
|
567
569
|
export { Select };
|
package/es/Select/props.js
CHANGED
|
@@ -67,7 +67,8 @@ const propTypes = {
|
|
|
67
67
|
renderBeforeInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
68
68
|
renderAfterInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
69
69
|
children: ChildrenPropTypes.oneOf([Group, Option]),
|
|
70
|
-
shouldNotWrap: PropTypes.bool
|
|
70
|
+
shouldNotWrap: PropTypes.bool,
|
|
71
|
+
scrollToHighlightedOption: PropTypes.bool
|
|
71
72
|
};
|
|
72
|
-
const allowedProps = ['renderLabel', 'inputValue', 'isShowingOptions', 'id', 'size', 'assistiveText', 'placeholder', 'interaction', 'isRequired', 'isInline', 'width', 'htmlSize', 'visibleOptionsCount', 'optionsMaxHeight', 'optionsMaxWidth', 'messages', 'placement', 'constrain', 'mountNode', 'onFocus', 'onBlur', 'onInputChange', 'onRequestShowOptions', 'onRequestHideOptions', 'onRequestHighlightOption', 'onRequestSelectOption', 'inputRef', 'listRef', 'renderBeforeInput', 'renderAfterInput', 'children', 'shouldNotWrap'];
|
|
73
|
+
const allowedProps = ['renderLabel', 'inputValue', 'isShowingOptions', 'id', 'size', 'assistiveText', 'placeholder', 'interaction', 'isRequired', 'isInline', 'width', 'htmlSize', 'visibleOptionsCount', 'optionsMaxHeight', 'optionsMaxWidth', 'messages', 'placement', 'constrain', 'mountNode', 'onFocus', 'onBlur', 'onInputChange', 'onRequestShowOptions', 'onRequestHideOptions', 'onRequestHighlightOption', 'onRequestSelectOption', 'inputRef', 'listRef', 'renderBeforeInput', 'renderAfterInput', 'children', 'shouldNotWrap', 'scrollToHighlightedOption'];
|
|
73
74
|
export { propTypes, allowedProps };
|
package/lib/Select/index.js
CHANGED
|
@@ -132,9 +132,10 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
|
|
|
132
132
|
componentDidUpdate() {
|
|
133
133
|
var _this$props$makeStyle2, _this$props4;
|
|
134
134
|
(_this$props$makeStyle2 = (_this$props4 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props4);
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
if (this.props.scrollToHighlightedOption) {
|
|
136
|
+
// scroll option into view if needed
|
|
137
|
+
requestAnimationFrame(() => this.scrollToOption(this.highlightedOptionId));
|
|
138
|
+
}
|
|
138
139
|
}
|
|
139
140
|
focus() {
|
|
140
141
|
this._input && this._input.focus();
|
|
@@ -573,6 +574,7 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
|
|
|
573
574
|
visibleOptionsCount: 8,
|
|
574
575
|
placement: 'bottom stretch',
|
|
575
576
|
constrain: 'window',
|
|
576
|
-
shouldNotWrap: false
|
|
577
|
+
shouldNotWrap: false,
|
|
578
|
+
scrollToHighlightedOption: false
|
|
577
579
|
}, _class2.Option = _Option.Option, _class2.Group = _Group.Group, _class2)) || _class) || _class) || _class);
|
|
578
580
|
var _default = exports.default = Select;
|
package/lib/Select/props.js
CHANGED
|
@@ -73,6 +73,7 @@ const propTypes = exports.propTypes = {
|
|
|
73
73
|
renderBeforeInput: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
74
74
|
renderAfterInput: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
75
75
|
children: _Children.Children.oneOf([_Group.Group, _Option.Option]),
|
|
76
|
-
shouldNotWrap: _propTypes.default.bool
|
|
76
|
+
shouldNotWrap: _propTypes.default.bool,
|
|
77
|
+
scrollToHighlightedOption: _propTypes.default.bool
|
|
77
78
|
};
|
|
78
|
-
const allowedProps = exports.allowedProps = ['renderLabel', 'inputValue', 'isShowingOptions', 'id', 'size', 'assistiveText', 'placeholder', 'interaction', 'isRequired', 'isInline', 'width', 'htmlSize', 'visibleOptionsCount', 'optionsMaxHeight', 'optionsMaxWidth', 'messages', 'placement', 'constrain', 'mountNode', 'onFocus', 'onBlur', 'onInputChange', 'onRequestShowOptions', 'onRequestHideOptions', 'onRequestHighlightOption', 'onRequestSelectOption', 'inputRef', 'listRef', 'renderBeforeInput', 'renderAfterInput', 'children', 'shouldNotWrap'];
|
|
79
|
+
const allowedProps = exports.allowedProps = ['renderLabel', 'inputValue', 'isShowingOptions', 'id', 'size', 'assistiveText', 'placeholder', 'interaction', 'isRequired', 'isInline', 'width', 'htmlSize', 'visibleOptionsCount', 'optionsMaxHeight', 'optionsMaxWidth', 'messages', 'placement', 'constrain', 'mountNode', 'onFocus', 'onBlur', 'onInputChange', 'onRequestShowOptions', 'onRequestHideOptions', 'onRequestHighlightOption', 'onRequestSelectOption', 'inputRef', 'listRef', 'renderBeforeInput', 'renderAfterInput', 'children', 'shouldNotWrap', 'scrollToHighlightedOption'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-select",
|
|
3
|
-
"version": "8.53.3-snapshot-
|
|
3
|
+
"version": "8.53.3-snapshot-15",
|
|
4
4
|
"description": "A component for select and autocomplete behavior.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,32 +23,32 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.53.3-snapshot-
|
|
27
|
-
"@instructure/ui-color-utils": "8.53.3-snapshot-
|
|
28
|
-
"@instructure/ui-test-locator": "8.53.3-snapshot-
|
|
29
|
-
"@instructure/ui-test-utils": "8.53.3-snapshot-
|
|
30
|
-
"@instructure/ui-themes": "8.53.3-snapshot-
|
|
26
|
+
"@instructure/ui-babel-preset": "8.53.3-snapshot-15",
|
|
27
|
+
"@instructure/ui-color-utils": "8.53.3-snapshot-15",
|
|
28
|
+
"@instructure/ui-test-locator": "8.53.3-snapshot-15",
|
|
29
|
+
"@instructure/ui-test-utils": "8.53.3-snapshot-15",
|
|
30
|
+
"@instructure/ui-themes": "8.53.3-snapshot-15",
|
|
31
31
|
"@testing-library/jest-dom": "^6.1.4",
|
|
32
32
|
"@testing-library/react": "^14.0.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@babel/runtime": "^7.23.2",
|
|
36
|
-
"@instructure/emotion": "8.53.3-snapshot-
|
|
37
|
-
"@instructure/shared-types": "8.53.3-snapshot-
|
|
38
|
-
"@instructure/ui-dom-utils": "8.53.3-snapshot-
|
|
39
|
-
"@instructure/ui-form-field": "8.53.3-snapshot-
|
|
40
|
-
"@instructure/ui-icons": "8.53.3-snapshot-
|
|
41
|
-
"@instructure/ui-options": "8.53.3-snapshot-
|
|
42
|
-
"@instructure/ui-popover": "8.53.3-snapshot-
|
|
43
|
-
"@instructure/ui-position": "8.53.3-snapshot-
|
|
44
|
-
"@instructure/ui-prop-types": "8.53.3-snapshot-
|
|
45
|
-
"@instructure/ui-react-utils": "8.53.3-snapshot-
|
|
46
|
-
"@instructure/ui-selectable": "8.53.3-snapshot-
|
|
47
|
-
"@instructure/ui-testable": "8.53.3-snapshot-
|
|
48
|
-
"@instructure/ui-text-input": "8.53.3-snapshot-
|
|
49
|
-
"@instructure/ui-utils": "8.53.3-snapshot-
|
|
50
|
-
"@instructure/ui-view": "8.53.3-snapshot-
|
|
51
|
-
"@instructure/uid": "8.53.3-snapshot-
|
|
36
|
+
"@instructure/emotion": "8.53.3-snapshot-15",
|
|
37
|
+
"@instructure/shared-types": "8.53.3-snapshot-15",
|
|
38
|
+
"@instructure/ui-dom-utils": "8.53.3-snapshot-15",
|
|
39
|
+
"@instructure/ui-form-field": "8.53.3-snapshot-15",
|
|
40
|
+
"@instructure/ui-icons": "8.53.3-snapshot-15",
|
|
41
|
+
"@instructure/ui-options": "8.53.3-snapshot-15",
|
|
42
|
+
"@instructure/ui-popover": "8.53.3-snapshot-15",
|
|
43
|
+
"@instructure/ui-position": "8.53.3-snapshot-15",
|
|
44
|
+
"@instructure/ui-prop-types": "8.53.3-snapshot-15",
|
|
45
|
+
"@instructure/ui-react-utils": "8.53.3-snapshot-15",
|
|
46
|
+
"@instructure/ui-selectable": "8.53.3-snapshot-15",
|
|
47
|
+
"@instructure/ui-testable": "8.53.3-snapshot-15",
|
|
48
|
+
"@instructure/ui-text-input": "8.53.3-snapshot-15",
|
|
49
|
+
"@instructure/ui-utils": "8.53.3-snapshot-15",
|
|
50
|
+
"@instructure/ui-view": "8.53.3-snapshot-15",
|
|
51
|
+
"@instructure/uid": "8.53.3-snapshot-15",
|
|
52
52
|
"prop-types": "^15.8.1"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
package/src/Select/index.tsx
CHANGED
|
@@ -148,7 +148,8 @@ class Select extends Component<SelectProps> {
|
|
|
148
148
|
visibleOptionsCount: 8,
|
|
149
149
|
placement: 'bottom stretch',
|
|
150
150
|
constrain: 'window',
|
|
151
|
-
shouldNotWrap: false
|
|
151
|
+
shouldNotWrap: false,
|
|
152
|
+
scrollToHighlightedOption: false
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
static Option = Option
|
|
@@ -161,8 +162,10 @@ class Select extends Component<SelectProps> {
|
|
|
161
162
|
componentDidUpdate() {
|
|
162
163
|
this.props.makeStyles?.()
|
|
163
164
|
|
|
164
|
-
|
|
165
|
-
|
|
165
|
+
if (this.props.scrollToHighlightedOption) {
|
|
166
|
+
// scroll option into view if needed
|
|
167
|
+
requestAnimationFrame(() => this.scrollToOption(this.highlightedOptionId))
|
|
168
|
+
}
|
|
166
169
|
}
|
|
167
170
|
|
|
168
171
|
state = {
|
package/src/Select/props.ts
CHANGED
|
@@ -110,6 +110,11 @@ type SelectOwnProps = {
|
|
|
110
110
|
*/
|
|
111
111
|
listRef?: (listElement: HTMLUListElement | null) => void
|
|
112
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Enable/disable auto scroll to the highlighted option on every re-render
|
|
115
|
+
*/
|
|
116
|
+
scrollToHighlightedOption?: boolean
|
|
117
|
+
|
|
113
118
|
/**
|
|
114
119
|
* Children of type `<Select.Option />` or `<Select.Group />`.
|
|
115
120
|
*/
|
|
@@ -302,7 +307,8 @@ const propTypes: PropValidators<PropKeys> = {
|
|
|
302
307
|
renderBeforeInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
303
308
|
renderAfterInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
304
309
|
children: ChildrenPropTypes.oneOf([Group, Option]),
|
|
305
|
-
shouldNotWrap: PropTypes.bool
|
|
310
|
+
shouldNotWrap: PropTypes.bool,
|
|
311
|
+
scrollToHighlightedOption: PropTypes.bool
|
|
306
312
|
}
|
|
307
313
|
|
|
308
314
|
const allowedProps: AllowedPropKeys = [
|
|
@@ -337,7 +343,8 @@ const allowedProps: AllowedPropKeys = [
|
|
|
337
343
|
'renderBeforeInput',
|
|
338
344
|
'renderAfterInput',
|
|
339
345
|
'children',
|
|
340
|
-
'shouldNotWrap'
|
|
346
|
+
'shouldNotWrap',
|
|
347
|
+
'scrollToHighlightedOption'
|
|
341
348
|
]
|
|
342
349
|
|
|
343
350
|
export type { SelectProps, SelectOwnProps, SelectStyle }
|