@instructure/ui-select 11.2.1-snapshot-9 → 11.3.1-snapshot-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 +12 -1
- package/package.json +19 -19
- package/src/Select/README.md +70 -58
- package/src/Select/index.tsx +1 -1
- package/src/Select/props.ts +6 -4
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Select/index.d.ts +5 -5
- package/types/Select/index.d.ts.map +1 -1
- package/types/Select/props.d.ts +4 -4
- package/types/Select/props.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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
|
-
## [11.
|
|
6
|
+
## [11.3.1-snapshot-0](https://github.com/instructure/instructure-ui/compare/v11.3.0...v11.3.1-snapshot-0) (2026-01-15)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-select
|
|
9
9
|
|
|
@@ -11,6 +11,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
+
# [11.3.0](https://github.com/instructure/instructure-ui/compare/v11.2.0...v11.3.0) (2026-01-12)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **ui-selectable,ui-select:** fix typing of Select and Selectable event types and TypeScript errors in the examples ([bde40cc](https://github.com/instructure/instructure-ui/commit/bde40cc121674666cceb7eb24e116a50e1879445))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
14
25
|
# [11.2.0](https://github.com/instructure/instructure-ui/compare/v11.0.1...v11.2.0) (2025-11-06)
|
|
15
26
|
|
|
16
27
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-select",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.3.1-snapshot-0",
|
|
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",
|
|
@@ -18,27 +18,27 @@
|
|
|
18
18
|
"@testing-library/react": "15.0.7",
|
|
19
19
|
"@testing-library/user-event": "^14.6.1",
|
|
20
20
|
"vitest": "^3.2.2",
|
|
21
|
-
"@instructure/ui-babel-preset": "11.
|
|
22
|
-
"@instructure/ui-color-utils": "11.
|
|
23
|
-
"@instructure/ui-
|
|
24
|
-
"@instructure/ui-
|
|
21
|
+
"@instructure/ui-babel-preset": "11.3.1-snapshot-0",
|
|
22
|
+
"@instructure/ui-color-utils": "11.3.1-snapshot-0",
|
|
23
|
+
"@instructure/ui-themes": "11.3.1-snapshot-0",
|
|
24
|
+
"@instructure/ui-scripts": "11.3.1-snapshot-0"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@babel/runtime": "^7.27.6",
|
|
28
|
-
"@instructure/emotion": "11.
|
|
29
|
-
"@instructure/shared-types": "11.
|
|
30
|
-
"@instructure/ui-dom-utils": "11.
|
|
31
|
-
"@instructure/ui-form-field": "11.
|
|
32
|
-
"@instructure/ui-icons": "11.
|
|
33
|
-
"@instructure/ui-options": "11.
|
|
34
|
-
"@instructure/ui-
|
|
35
|
-
"@instructure/ui-
|
|
36
|
-
"@instructure/ui-
|
|
37
|
-
"@instructure/ui-
|
|
38
|
-
"@instructure/ui-
|
|
39
|
-
"@instructure/ui-
|
|
40
|
-
"@instructure/ui-
|
|
41
|
-
"@instructure/uid": "11.
|
|
28
|
+
"@instructure/emotion": "11.3.1-snapshot-0",
|
|
29
|
+
"@instructure/shared-types": "11.3.1-snapshot-0",
|
|
30
|
+
"@instructure/ui-dom-utils": "11.3.1-snapshot-0",
|
|
31
|
+
"@instructure/ui-form-field": "11.3.1-snapshot-0",
|
|
32
|
+
"@instructure/ui-icons": "11.3.1-snapshot-0",
|
|
33
|
+
"@instructure/ui-options": "11.3.1-snapshot-0",
|
|
34
|
+
"@instructure/ui-selectable": "11.3.1-snapshot-0",
|
|
35
|
+
"@instructure/ui-react-utils": "11.3.1-snapshot-0",
|
|
36
|
+
"@instructure/ui-popover": "11.3.1-snapshot-0",
|
|
37
|
+
"@instructure/ui-utils": "11.3.1-snapshot-0",
|
|
38
|
+
"@instructure/ui-text-input": "11.3.1-snapshot-0",
|
|
39
|
+
"@instructure/ui-view": "11.3.1-snapshot-0",
|
|
40
|
+
"@instructure/ui-position": "11.3.1-snapshot-0",
|
|
41
|
+
"@instructure/uid": "11.3.1-snapshot-0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": ">=18 <=19"
|
package/src/Select/README.md
CHANGED
|
@@ -44,13 +44,15 @@ type: example
|
|
|
44
44
|
setIsShowingOptions(true)
|
|
45
45
|
if (inputValue || selectedOptionId || options.length === 0) return
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
if ('key' in event) {
|
|
48
|
+
switch (event.key) {
|
|
49
|
+
case 'ArrowDown':
|
|
50
|
+
return handleHighlightOption(event, { id: options[0].id })
|
|
51
|
+
case 'ArrowUp':
|
|
52
|
+
return handleHighlightOption(event, {
|
|
53
|
+
id: options[options.length - 1].id
|
|
54
|
+
})
|
|
55
|
+
}
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
|
|
@@ -234,13 +236,15 @@ type: example
|
|
|
234
236
|
)
|
|
235
237
|
if (inputValue || selectedOptionId || options.length === 0) return
|
|
236
238
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
239
|
+
if ('key' in event) {
|
|
240
|
+
switch (event.key) {
|
|
241
|
+
case 'ArrowDown':
|
|
242
|
+
return handleHighlightOption(event, { id: options[0].id })
|
|
243
|
+
case 'ArrowUp':
|
|
244
|
+
return handleHighlightOption(event, {
|
|
245
|
+
id: options[options.length - 1].id
|
|
246
|
+
})
|
|
247
|
+
}
|
|
244
248
|
}
|
|
245
249
|
}
|
|
246
250
|
|
|
@@ -436,21 +440,23 @@ type: example
|
|
|
436
440
|
|
|
437
441
|
if (inputValue || options.length === 0) return
|
|
438
442
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
.id
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
options
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
443
|
+
if ('key' in event) {
|
|
444
|
+
switch (event.key) {
|
|
445
|
+
case 'ArrowDown':
|
|
446
|
+
return handleHighlightOption(event, {
|
|
447
|
+
id: options.find((option) => !selectedOptionId.includes(option.id))
|
|
448
|
+
.id
|
|
449
|
+
})
|
|
450
|
+
case 'ArrowUp':
|
|
451
|
+
// Highlight last non-selected option
|
|
452
|
+
return handleHighlightOption(event, {
|
|
453
|
+
id: options[
|
|
454
|
+
options.findLastIndex(
|
|
455
|
+
(option) => !selectedOptionId.includes(option.id)
|
|
456
|
+
)
|
|
457
|
+
].id
|
|
458
|
+
})
|
|
459
|
+
}
|
|
454
460
|
}
|
|
455
461
|
}
|
|
456
462
|
|
|
@@ -489,13 +495,13 @@ type: example
|
|
|
489
495
|
const newOptions = filterOptions(value)
|
|
490
496
|
setInputValue(value)
|
|
491
497
|
setFilteredOptions(newOptions)
|
|
492
|
-
|
|
498
|
+
setHighlightedOptionId(newOptions.length > 0 ? newOptions[0].id : null)
|
|
493
499
|
setIsShowingOptions(true)
|
|
494
500
|
setAnnouncement(getOptionsChangedMessage(newOptions))
|
|
495
501
|
}
|
|
496
502
|
|
|
497
503
|
const handleKeyDown = (event) => {
|
|
498
|
-
if (event.keyCode === 8) {
|
|
504
|
+
if ('keyCode' in event && event.keyCode === 8) {
|
|
499
505
|
// when backspace key is pressed
|
|
500
506
|
if (inputValue === '' && selectedOptionId.length > 0) {
|
|
501
507
|
// remove last selected option, if input has no entered text
|
|
@@ -660,17 +666,19 @@ const GroupSelectExample = ({ options }) => {
|
|
|
660
666
|
const handleShowOptions = (event) => {
|
|
661
667
|
setIsShowingOptions(true)
|
|
662
668
|
setHighlightedOptionId(null)
|
|
663
|
-
if (inputValue || selectedOptionId || options.length === 0) return
|
|
669
|
+
if (inputValue || selectedOptionId || Object.keys(options).length === 0) return
|
|
664
670
|
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
671
|
+
if ('key' in event) {
|
|
672
|
+
switch (event.key) {
|
|
673
|
+
case 'ArrowDown':
|
|
674
|
+
return handleHighlightOption(event, {
|
|
675
|
+
id: options[Object.keys(options)[0]][0].id
|
|
676
|
+
})
|
|
677
|
+
case 'ArrowUp':
|
|
678
|
+
return handleHighlightOption(event, {
|
|
679
|
+
id: Object.values(options).at(-1)?.at(-1)?.id
|
|
680
|
+
})
|
|
681
|
+
}
|
|
674
682
|
}
|
|
675
683
|
}
|
|
676
684
|
|
|
@@ -840,17 +848,19 @@ const GroupSelectAutocompleteExample = ({ options }) => {
|
|
|
840
848
|
setIsShowingOptions(true)
|
|
841
849
|
setHighlightedOptionId(null)
|
|
842
850
|
|
|
843
|
-
if (inputValue || selectedOptionId || options.length === 0) return
|
|
851
|
+
if (inputValue || selectedOptionId || Object.keys(options).length === 0) return
|
|
844
852
|
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
853
|
+
if ('key' in event) {
|
|
854
|
+
switch (event.key) {
|
|
855
|
+
case 'ArrowDown':
|
|
856
|
+
return handleHighlightOption(event, {
|
|
857
|
+
id: options[Object.keys(options)[0]][0].id
|
|
858
|
+
})
|
|
859
|
+
case 'ArrowUp':
|
|
860
|
+
return handleHighlightOption(event, {
|
|
861
|
+
id: Object.values(options).at(-1)?.at(-1)?.id
|
|
862
|
+
})
|
|
863
|
+
}
|
|
854
864
|
}
|
|
855
865
|
}
|
|
856
866
|
|
|
@@ -1205,13 +1215,15 @@ const SingleSelectExample = ({ options }) => {
|
|
|
1205
1215
|
|
|
1206
1216
|
if (inputValue || selectedOptionId || options.length === 0) return
|
|
1207
1217
|
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1218
|
+
if ('key' in event) {
|
|
1219
|
+
switch (event.key) {
|
|
1220
|
+
case 'ArrowDown':
|
|
1221
|
+
return handleHighlightOption(event, { id: options[0].id })
|
|
1222
|
+
case 'ArrowUp':
|
|
1223
|
+
return handleHighlightOption(event, {
|
|
1224
|
+
id: options[options.length - 1].id
|
|
1225
|
+
})
|
|
1226
|
+
}
|
|
1215
1227
|
}
|
|
1216
1228
|
}
|
|
1217
1229
|
|
package/src/Select/index.tsx
CHANGED
|
@@ -308,7 +308,7 @@ class Select extends Component<SelectProps> {
|
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
highlightOption(event: React.
|
|
311
|
+
highlightOption(event: React.KeyboardEvent | React.MouseEvent, id: string) {
|
|
312
312
|
const { onRequestHighlightOption } = this.props
|
|
313
313
|
if (id) {
|
|
314
314
|
onRequestHighlightOption?.(event, { id })
|
package/src/Select/props.ts
CHANGED
|
@@ -142,18 +142,20 @@ type PropsFromSelectable = {
|
|
|
142
142
|
/**
|
|
143
143
|
* Callback fired requesting that the options list be shown.
|
|
144
144
|
*/
|
|
145
|
-
onRequestShowOptions?: (event: React.
|
|
145
|
+
onRequestShowOptions?: (event: React.KeyboardEvent | React.MouseEvent) => void
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
* Callback fired requesting that the options list be hidden.
|
|
149
149
|
*/
|
|
150
|
-
onRequestHideOptions?: (
|
|
150
|
+
onRequestHideOptions?: (
|
|
151
|
+
event: React.KeyboardEvent | React.MouseEvent | React.FocusEvent
|
|
152
|
+
) => void
|
|
151
153
|
|
|
152
154
|
/**
|
|
153
155
|
* Callback fired requesting a particular option be highlighted.
|
|
154
156
|
*/
|
|
155
157
|
onRequestHighlightOption?: (
|
|
156
|
-
event: React.
|
|
158
|
+
event: React.KeyboardEvent | React.MouseEvent,
|
|
157
159
|
data: { id?: string; direction?: 1 | -1 }
|
|
158
160
|
) => void
|
|
159
161
|
|
|
@@ -161,7 +163,7 @@ type PropsFromSelectable = {
|
|
|
161
163
|
* Callback fired requesting a particular option be selected.
|
|
162
164
|
*/
|
|
163
165
|
onRequestSelectOption?: (
|
|
164
|
-
event: React.
|
|
166
|
+
event: React.KeyboardEvent | React.MouseEvent,
|
|
165
167
|
data: { id?: string }
|
|
166
168
|
) => void
|
|
167
169
|
}
|