@instructure/ui-select 8.22.1-snapshot.4 → 8.23.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 +4 -0
- package/es/Select/index.js +7 -8
- package/lib/Select/index.js +7 -8
- package/package.json +23 -24
- package/src/Select/index.tsx +9 -14
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Select/index.d.ts +2 -2
- package/types/Select/index.d.ts.map +1 -1
- package/LICENSE.md +0 -27
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
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.23.0](https://github.com/instructure/instructure-ui/compare/v8.22.0...v8.23.0) (2022-04-07)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-select
|
|
9
|
+
|
|
6
10
|
# [8.22.0](https://github.com/instructure/instructure-ui/compare/v8.21.0...v8.22.0) (2022-03-31)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @instructure/ui-select
|
package/es/Select/index.js
CHANGED
|
@@ -62,6 +62,7 @@ let Select = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gen
|
|
|
62
62
|
hasInputRef: false
|
|
63
63
|
};
|
|
64
64
|
this.ref = null;
|
|
65
|
+
this._input = null;
|
|
65
66
|
this._defaultId = this.props.deterministicId();
|
|
66
67
|
this._inputContainer = null;
|
|
67
68
|
this._listView = null;
|
|
@@ -78,7 +79,7 @@ let Select = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gen
|
|
|
78
79
|
});
|
|
79
80
|
}
|
|
80
81
|
|
|
81
|
-
this.
|
|
82
|
+
this._input = node;
|
|
82
83
|
(_this$props$inputRef = (_this$props = this.props).inputRef) === null || _this$props$inputRef === void 0 ? void 0 : _this$props$inputRef.call(_this$props, node);
|
|
83
84
|
};
|
|
84
85
|
|
|
@@ -112,11 +113,7 @@ let Select = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gen
|
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
focus() {
|
|
115
|
-
this.
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
get _input() {
|
|
119
|
-
return this.ref;
|
|
116
|
+
this._input && this._input.focus();
|
|
120
117
|
}
|
|
121
118
|
|
|
122
119
|
get childrenArray() {
|
|
@@ -128,7 +125,7 @@ let Select = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gen
|
|
|
128
125
|
}
|
|
129
126
|
|
|
130
127
|
get focused() {
|
|
131
|
-
return this.
|
|
128
|
+
return this._input ? isActiveElement(this._input) : false;
|
|
132
129
|
}
|
|
133
130
|
|
|
134
131
|
get id() {
|
|
@@ -548,8 +545,10 @@ let Select = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gen
|
|
|
548
545
|
getOptionProps = _ref3.getOptionProps,
|
|
549
546
|
getDisabledOptionProps = _ref3.getDisabledOptionProps,
|
|
550
547
|
getDescriptionProps = _ref3.getDescriptionProps;
|
|
551
|
-
return jsx("span", getRootProps({
|
|
548
|
+
return jsx("span", Object.assign({}, getRootProps({
|
|
552
549
|
css: styles === null || styles === void 0 ? void 0 : styles.select
|
|
550
|
+
}), {
|
|
551
|
+
ref: el => this.ref = el
|
|
553
552
|
}), this.renderInput({
|
|
554
553
|
getInputProps,
|
|
555
554
|
getTriggerProps
|
package/lib/Select/index.js
CHANGED
|
@@ -75,6 +75,7 @@ let Select = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0
|
|
|
75
75
|
hasInputRef: false
|
|
76
76
|
};
|
|
77
77
|
this.ref = null;
|
|
78
|
+
this._input = null;
|
|
78
79
|
this._defaultId = this.props.deterministicId();
|
|
79
80
|
this._inputContainer = null;
|
|
80
81
|
this._listView = null;
|
|
@@ -91,7 +92,7 @@ let Select = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0
|
|
|
91
92
|
});
|
|
92
93
|
}
|
|
93
94
|
|
|
94
|
-
this.
|
|
95
|
+
this._input = node;
|
|
95
96
|
(_this$props$inputRef = (_this$props = this.props).inputRef) === null || _this$props$inputRef === void 0 ? void 0 : _this$props$inputRef.call(_this$props, node);
|
|
96
97
|
};
|
|
97
98
|
|
|
@@ -125,11 +126,7 @@ let Select = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0
|
|
|
125
126
|
}
|
|
126
127
|
|
|
127
128
|
focus() {
|
|
128
|
-
this.
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
get _input() {
|
|
132
|
-
return this.ref;
|
|
129
|
+
this._input && this._input.focus();
|
|
133
130
|
}
|
|
134
131
|
|
|
135
132
|
get childrenArray() {
|
|
@@ -141,7 +138,7 @@ let Select = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0
|
|
|
141
138
|
}
|
|
142
139
|
|
|
143
140
|
get focused() {
|
|
144
|
-
return this.
|
|
141
|
+
return this._input ? (0, _isActiveElement.isActiveElement)(this._input) : false;
|
|
145
142
|
}
|
|
146
143
|
|
|
147
144
|
get id() {
|
|
@@ -557,8 +554,10 @@ let Select = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0
|
|
|
557
554
|
getOptionProps = _ref3.getOptionProps,
|
|
558
555
|
getDisabledOptionProps = _ref3.getDisabledOptionProps,
|
|
559
556
|
getDescriptionProps = _ref3.getDescriptionProps;
|
|
560
|
-
return (0, _emotion.jsx)("span", getRootProps({
|
|
557
|
+
return (0, _emotion.jsx)("span", Object.assign({}, getRootProps({
|
|
561
558
|
css: styles === null || styles === void 0 ? void 0 : styles.select
|
|
559
|
+
}), {
|
|
560
|
+
ref: el => this.ref = el
|
|
562
561
|
}), this.renderInput({
|
|
563
562
|
getInputProps,
|
|
564
563
|
getTriggerProps
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-select",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.23.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",
|
|
@@ -23,30 +23,30 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.
|
|
27
|
-
"@instructure/ui-color-utils": "8.
|
|
28
|
-
"@instructure/ui-test-locator": "8.
|
|
29
|
-
"@instructure/ui-test-utils": "8.
|
|
30
|
-
"@instructure/ui-themes": "8.
|
|
26
|
+
"@instructure/ui-babel-preset": "8.23.0",
|
|
27
|
+
"@instructure/ui-color-utils": "8.23.0",
|
|
28
|
+
"@instructure/ui-test-locator": "8.23.0",
|
|
29
|
+
"@instructure/ui-test-utils": "8.23.0",
|
|
30
|
+
"@instructure/ui-themes": "8.23.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.13.10",
|
|
34
|
-
"@instructure/emotion": "8.
|
|
35
|
-
"@instructure/shared-types": "8.
|
|
36
|
-
"@instructure/ui-dom-utils": "8.
|
|
37
|
-
"@instructure/ui-form-field": "8.
|
|
38
|
-
"@instructure/ui-icons": "8.
|
|
39
|
-
"@instructure/ui-options": "8.
|
|
40
|
-
"@instructure/ui-popover": "8.
|
|
41
|
-
"@instructure/ui-position": "8.
|
|
42
|
-
"@instructure/ui-prop-types": "8.
|
|
43
|
-
"@instructure/ui-react-utils": "8.
|
|
44
|
-
"@instructure/ui-selectable": "8.
|
|
45
|
-
"@instructure/ui-testable": "8.
|
|
46
|
-
"@instructure/ui-text-input": "8.
|
|
47
|
-
"@instructure/ui-utils": "8.
|
|
48
|
-
"@instructure/ui-view": "8.
|
|
49
|
-
"@instructure/uid": "8.
|
|
34
|
+
"@instructure/emotion": "8.23.0",
|
|
35
|
+
"@instructure/shared-types": "8.23.0",
|
|
36
|
+
"@instructure/ui-dom-utils": "8.23.0",
|
|
37
|
+
"@instructure/ui-form-field": "8.23.0",
|
|
38
|
+
"@instructure/ui-icons": "8.23.0",
|
|
39
|
+
"@instructure/ui-options": "8.23.0",
|
|
40
|
+
"@instructure/ui-popover": "8.23.0",
|
|
41
|
+
"@instructure/ui-position": "8.23.0",
|
|
42
|
+
"@instructure/ui-prop-types": "8.23.0",
|
|
43
|
+
"@instructure/ui-react-utils": "8.23.0",
|
|
44
|
+
"@instructure/ui-selectable": "8.23.0",
|
|
45
|
+
"@instructure/ui-testable": "8.23.0",
|
|
46
|
+
"@instructure/ui-text-input": "8.23.0",
|
|
47
|
+
"@instructure/ui-utils": "8.23.0",
|
|
48
|
+
"@instructure/ui-view": "8.23.0",
|
|
49
|
+
"@instructure/uid": "8.23.0",
|
|
50
50
|
"prop-types": "^15"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
@@ -55,6 +55,5 @@
|
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
|
-
"sideEffects": false
|
|
59
|
-
"gitHead": "5809c01bc3fc6e7b468d18d44c22f364304561ed"
|
|
58
|
+
"sideEffects": false
|
|
60
59
|
}
|
package/src/Select/index.tsx
CHANGED
|
@@ -125,7 +125,8 @@ class Select extends Component<SelectProps> {
|
|
|
125
125
|
state = {
|
|
126
126
|
hasInputRef: false
|
|
127
127
|
}
|
|
128
|
-
ref:
|
|
128
|
+
ref: HTMLSpanElement | null = null
|
|
129
|
+
_input: HTMLInputElement | null = null
|
|
129
130
|
private _defaultId = this.props.deterministicId!()
|
|
130
131
|
private _inputContainer: HTMLSpanElement | null = null
|
|
131
132
|
private _listView: Element | null = null
|
|
@@ -135,15 +136,7 @@ class Select extends Component<SelectProps> {
|
|
|
135
136
|
private _optionHeight = 36
|
|
136
137
|
|
|
137
138
|
focus() {
|
|
138
|
-
this.
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
get _input() {
|
|
142
|
-
console.warn(
|
|
143
|
-
'_input property is deprecated and will be removed in v9, please use ref instead'
|
|
144
|
-
)
|
|
145
|
-
|
|
146
|
-
return this.ref
|
|
139
|
+
this._input && this._input.focus()
|
|
147
140
|
}
|
|
148
141
|
|
|
149
142
|
get childrenArray() {
|
|
@@ -155,7 +148,7 @@ class Select extends Component<SelectProps> {
|
|
|
155
148
|
}
|
|
156
149
|
|
|
157
150
|
get focused() {
|
|
158
|
-
return this.
|
|
151
|
+
return this._input ? isActiveElement(this._input) : false
|
|
159
152
|
}
|
|
160
153
|
|
|
161
154
|
get id() {
|
|
@@ -227,8 +220,7 @@ class Select extends Component<SelectProps> {
|
|
|
227
220
|
if (!this.state.hasInputRef) {
|
|
228
221
|
this.setState({ hasInputRef: true })
|
|
229
222
|
}
|
|
230
|
-
|
|
231
|
-
this.ref = node
|
|
223
|
+
this._input = node
|
|
232
224
|
this.props.inputRef?.(node)
|
|
233
225
|
}
|
|
234
226
|
|
|
@@ -646,7 +638,10 @@ class Select extends Component<SelectProps> {
|
|
|
646
638
|
getDisabledOptionProps,
|
|
647
639
|
getDescriptionProps
|
|
648
640
|
}) => (
|
|
649
|
-
<span
|
|
641
|
+
<span
|
|
642
|
+
{...getRootProps({ css: styles?.select })}
|
|
643
|
+
ref={(el) => (this.ref = el)}
|
|
644
|
+
>
|
|
650
645
|
{this.renderInput({ getInputProps, getTriggerProps })}
|
|
651
646
|
<span {...getDescriptionProps()} css={styles?.assistiveText}>
|
|
652
647
|
{assistiveText}
|