@instructure/ui-select 8.22.0 → 8.22.1-snapshot.23
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/LICENSE.md +27 -0
- package/es/Select/index.js +7 -8
- package/lib/Select/index.js +7 -8
- package/package.json +24 -23
- 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
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: The MIT License (MIT)
|
|
3
|
+
category: Getting Started
|
|
4
|
+
order: 9
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# The MIT License (MIT)
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2015 Instructure, Inc.
|
|
10
|
+
|
|
11
|
+
**Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions.**
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
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.22.
|
|
3
|
+
"version": "8.22.1-snapshot.23+23720451b",
|
|
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.22.
|
|
27
|
-
"@instructure/ui-color-utils": "8.22.
|
|
28
|
-
"@instructure/ui-test-locator": "8.22.
|
|
29
|
-
"@instructure/ui-test-utils": "8.22.
|
|
30
|
-
"@instructure/ui-themes": "8.22.
|
|
26
|
+
"@instructure/ui-babel-preset": "8.22.1-snapshot.23+23720451b",
|
|
27
|
+
"@instructure/ui-color-utils": "8.22.1-snapshot.23+23720451b",
|
|
28
|
+
"@instructure/ui-test-locator": "8.22.1-snapshot.23+23720451b",
|
|
29
|
+
"@instructure/ui-test-utils": "8.22.1-snapshot.23+23720451b",
|
|
30
|
+
"@instructure/ui-themes": "8.22.1-snapshot.23+23720451b"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.13.10",
|
|
34
|
-
"@instructure/emotion": "8.22.
|
|
35
|
-
"@instructure/shared-types": "8.22.
|
|
36
|
-
"@instructure/ui-dom-utils": "8.22.
|
|
37
|
-
"@instructure/ui-form-field": "8.22.
|
|
38
|
-
"@instructure/ui-icons": "8.22.
|
|
39
|
-
"@instructure/ui-options": "8.22.
|
|
40
|
-
"@instructure/ui-popover": "8.22.
|
|
41
|
-
"@instructure/ui-position": "8.22.
|
|
42
|
-
"@instructure/ui-prop-types": "8.22.
|
|
43
|
-
"@instructure/ui-react-utils": "8.22.
|
|
44
|
-
"@instructure/ui-selectable": "8.22.
|
|
45
|
-
"@instructure/ui-testable": "8.22.
|
|
46
|
-
"@instructure/ui-text-input": "8.22.
|
|
47
|
-
"@instructure/ui-utils": "8.22.
|
|
48
|
-
"@instructure/ui-view": "8.22.
|
|
49
|
-
"@instructure/uid": "8.22.
|
|
34
|
+
"@instructure/emotion": "8.22.1-snapshot.23+23720451b",
|
|
35
|
+
"@instructure/shared-types": "8.22.1-snapshot.23+23720451b",
|
|
36
|
+
"@instructure/ui-dom-utils": "8.22.1-snapshot.23+23720451b",
|
|
37
|
+
"@instructure/ui-form-field": "8.22.1-snapshot.23+23720451b",
|
|
38
|
+
"@instructure/ui-icons": "8.22.1-snapshot.23+23720451b",
|
|
39
|
+
"@instructure/ui-options": "8.22.1-snapshot.23+23720451b",
|
|
40
|
+
"@instructure/ui-popover": "8.22.1-snapshot.23+23720451b",
|
|
41
|
+
"@instructure/ui-position": "8.22.1-snapshot.23+23720451b",
|
|
42
|
+
"@instructure/ui-prop-types": "8.22.1-snapshot.23+23720451b",
|
|
43
|
+
"@instructure/ui-react-utils": "8.22.1-snapshot.23+23720451b",
|
|
44
|
+
"@instructure/ui-selectable": "8.22.1-snapshot.23+23720451b",
|
|
45
|
+
"@instructure/ui-testable": "8.22.1-snapshot.23+23720451b",
|
|
46
|
+
"@instructure/ui-text-input": "8.22.1-snapshot.23+23720451b",
|
|
47
|
+
"@instructure/ui-utils": "8.22.1-snapshot.23+23720451b",
|
|
48
|
+
"@instructure/ui-view": "8.22.1-snapshot.23+23720451b",
|
|
49
|
+
"@instructure/uid": "8.22.1-snapshot.23+23720451b",
|
|
50
50
|
"prop-types": "^15"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
@@ -55,5 +55,6 @@
|
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
|
-
"sideEffects": false
|
|
58
|
+
"sideEffects": false,
|
|
59
|
+
"gitHead": "23720451b9e91fc1ba0b31b4f22fff32669a4d59"
|
|
59
60
|
}
|
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}
|