@instructure/ui-simple-select 8.14.1-snapshot.19 → 8.14.1-snapshot.28
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/es/SimpleSelect/Group/index.js +2 -3
- package/es/SimpleSelect/Group/props.js +0 -7
- package/es/SimpleSelect/Option/index.js +2 -2
- package/es/SimpleSelect/Option/props.js +0 -23
- package/es/SimpleSelect/SimpleSelectLocator.js +3 -1
- package/es/SimpleSelect/index.js +74 -68
- package/es/SimpleSelect/props.js +0 -130
- package/lib/SimpleSelect/Group/index.js +2 -3
- package/lib/SimpleSelect/Group/props.js +0 -7
- package/lib/SimpleSelect/Option/index.js +2 -2
- package/lib/SimpleSelect/Option/props.js +0 -23
- package/lib/SimpleSelect/SimpleSelectLocator.js +2 -0
- package/lib/SimpleSelect/index.js +73 -70
- package/lib/SimpleSelect/props.js +0 -130
- package/package.json +15 -15
- package/src/SimpleSelect/Group/index.tsx +3 -4
- package/src/SimpleSelect/Group/props.ts +10 -8
- package/src/SimpleSelect/Option/index.tsx +2 -2
- package/src/SimpleSelect/Option/props.ts +35 -21
- package/src/SimpleSelect/index.tsx +92 -111
- package/src/SimpleSelect/props.ts +147 -94
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/SimpleSelect/Group/index.d.ts +4 -5
- package/types/SimpleSelect/Group/index.d.ts.map +1 -1
- package/types/SimpleSelect/Group/props.d.ts +7 -1
- package/types/SimpleSelect/Group/props.d.ts.map +1 -1
- package/types/SimpleSelect/Option/index.d.ts +7 -7
- package/types/SimpleSelect/Option/index.d.ts.map +1 -1
- package/types/SimpleSelect/Option/props.d.ts +30 -4
- package/types/SimpleSelect/Option/props.d.ts.map +1 -1
- package/types/SimpleSelect/index.d.ts +45 -61
- package/types/SimpleSelect/index.d.ts.map +1 -1
- package/types/SimpleSelect/props.d.ts +127 -16
- package/types/SimpleSelect/props.d.ts.map +1 -1
|
@@ -28,6 +28,7 @@ import { allowedProps, propTypes } from './props';
|
|
|
28
28
|
parent: SimpleSelect
|
|
29
29
|
id: SimpleSelect.Group
|
|
30
30
|
---
|
|
31
|
+
@tsProps
|
|
31
32
|
**/
|
|
32
33
|
|
|
33
34
|
class Group extends Component {
|
|
@@ -44,8 +45,6 @@ Group.displayName = "Group";
|
|
|
44
45
|
Group.componentId = 'SimpleSelect.Group';
|
|
45
46
|
Group.allowedProps = allowedProps;
|
|
46
47
|
Group.propTypes = propTypes;
|
|
47
|
-
Group.defaultProps = {
|
|
48
|
-
children: null
|
|
49
|
-
};
|
|
48
|
+
Group.defaultProps = {};
|
|
50
49
|
export default Group;
|
|
51
50
|
export { Group };
|
|
@@ -25,14 +25,7 @@ import PropTypes from 'prop-types';
|
|
|
25
25
|
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
|
|
26
26
|
import { Option } from '../Option';
|
|
27
27
|
const propTypes = {
|
|
28
|
-
/**
|
|
29
|
-
* The label associated with the group options.
|
|
30
|
-
*/
|
|
31
28
|
renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Children of type `<SimpleSelect.Option />` that will be considered part of the group.
|
|
35
|
-
*/
|
|
36
29
|
children: ChildrenPropTypes.oneOf([Option])
|
|
37
30
|
};
|
|
38
31
|
const allowedProps = ['renderLabel', 'children'];
|
|
@@ -28,6 +28,7 @@ import { allowedProps, propTypes } from './props';
|
|
|
28
28
|
parent: SimpleSelect
|
|
29
29
|
id: SimpleSelect.Option
|
|
30
30
|
---
|
|
31
|
+
@tsProps
|
|
31
32
|
**/
|
|
32
33
|
|
|
33
34
|
class Option extends Component {
|
|
@@ -45,8 +46,7 @@ Option.componentId = 'SimpleSelect.Option';
|
|
|
45
46
|
Option.allowedProps = allowedProps;
|
|
46
47
|
Option.propTypes = propTypes;
|
|
47
48
|
Option.defaultProps = {
|
|
48
|
-
isDisabled: false
|
|
49
|
-
children: null
|
|
49
|
+
isDisabled: false
|
|
50
50
|
};
|
|
51
51
|
export default Option;
|
|
52
52
|
export { Option };
|
|
@@ -23,34 +23,11 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import PropTypes from 'prop-types';
|
|
25
25
|
const propTypes = {
|
|
26
|
-
/**
|
|
27
|
-
* The id for the option.
|
|
28
|
-
*/
|
|
29
26
|
id: PropTypes.string.isRequired,
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* The value for the option.
|
|
33
|
-
*/
|
|
34
27
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Whether or not this option is disabled.
|
|
38
|
-
*/
|
|
39
28
|
isDisabled: PropTypes.bool,
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Content to display before the option label, such as an icon.
|
|
43
|
-
*/
|
|
44
29
|
renderBeforeLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Content to display after the option label, such as an icon.
|
|
48
|
-
*/
|
|
49
30
|
renderAfterLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Content to display as the option label.
|
|
53
|
-
*/
|
|
54
31
|
children: PropTypes.string
|
|
55
32
|
};
|
|
56
33
|
const allowedProps = ['id', 'value', 'isDisabled', 'renderBeforeLabel', 'renderAfterLabel', 'children'];
|
|
@@ -23,11 +23,13 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import { locator } from '@instructure/ui-test-locator';
|
|
25
25
|
/* eslint-disable no-restricted-imports */
|
|
26
|
+
// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module '@ins... Remove this comment to see the full error message
|
|
26
27
|
|
|
27
28
|
import { SelectLocator } from '@instructure/ui-select/es/Select/SelectLocator';
|
|
28
29
|
/* eslint-enable no-restricted-imports */
|
|
29
30
|
|
|
30
|
-
import { SimpleSelect } from './index';
|
|
31
|
+
import { SimpleSelect } from './index'; // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
32
|
+
|
|
31
33
|
export const SimpleSelectLocator = locator(SimpleSelect.selector, {
|
|
32
34
|
findInput: SelectLocator.findInput,
|
|
33
35
|
// TODO these dont work because TS doesnt find its type declarations,
|
package/es/SimpleSelect/index.js
CHANGED
|
@@ -36,18 +36,48 @@ import { Select } from '@instructure/ui-select';
|
|
|
36
36
|
import { Option } from './Option';
|
|
37
37
|
import { Group } from './Group';
|
|
38
38
|
import { allowedProps, propTypes } from './props';
|
|
39
|
+
|
|
39
40
|
/**
|
|
40
41
|
---
|
|
41
42
|
category: components
|
|
42
43
|
tags: form, field, dropdown
|
|
43
44
|
---
|
|
45
|
+
@tsProps
|
|
44
46
|
**/
|
|
45
|
-
|
|
46
47
|
let SimpleSelect = (_dec = testable(), _dec(_class = (_temp = _class2 = class SimpleSelect extends Component {
|
|
47
48
|
constructor(props) {
|
|
48
49
|
super(props);
|
|
49
50
|
this.ref = null;
|
|
50
|
-
this._emptyOptionId =
|
|
51
|
+
this._emptyOptionId = void 0;
|
|
52
|
+
|
|
53
|
+
this.getOption = (field, value) => {
|
|
54
|
+
let match;
|
|
55
|
+
|
|
56
|
+
for (let i = 0; i < this.childrenArray.length; ++i) {
|
|
57
|
+
const child = this.childrenArray[i];
|
|
58
|
+
|
|
59
|
+
if (matchComponentTypes(child, [Option])) {
|
|
60
|
+
if (child.props[field] === value) {
|
|
61
|
+
match = child;
|
|
62
|
+
}
|
|
63
|
+
} else if (matchComponentTypes(child, [Group])) {
|
|
64
|
+
const groupChildren = Children.toArray(child.props.children);
|
|
65
|
+
|
|
66
|
+
for (let j = 0; j < groupChildren.length; ++j) {
|
|
67
|
+
const groupChild = groupChildren[j];
|
|
68
|
+
|
|
69
|
+
if (groupChild.props[field] === value) {
|
|
70
|
+
match = groupChild;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (match) break;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return match;
|
|
80
|
+
};
|
|
51
81
|
|
|
52
82
|
this.handleRef = node => {
|
|
53
83
|
this.ref = node;
|
|
@@ -55,16 +85,22 @@ let SimpleSelect = (_dec = testable(), _dec(_class = (_temp = _class2 = class Si
|
|
|
55
85
|
|
|
56
86
|
this.handleBlur = event => {
|
|
57
87
|
this.setState({
|
|
58
|
-
highlightedOptionId:
|
|
88
|
+
highlightedOptionId: void 0
|
|
59
89
|
});
|
|
60
|
-
|
|
90
|
+
|
|
91
|
+
if (typeof this.props.onBlur === 'function') {
|
|
92
|
+
this.props.onBlur(event);
|
|
93
|
+
}
|
|
61
94
|
};
|
|
62
95
|
|
|
63
96
|
this.handleShowOptions = event => {
|
|
64
97
|
this.setState({
|
|
65
98
|
isShowingOptions: true
|
|
66
99
|
});
|
|
67
|
-
|
|
100
|
+
|
|
101
|
+
if (typeof this.props.onShowOptions === 'function') {
|
|
102
|
+
this.props.onShowOptions(event);
|
|
103
|
+
}
|
|
68
104
|
};
|
|
69
105
|
|
|
70
106
|
this.handleHideOptions = event => {
|
|
@@ -72,18 +108,21 @@ let SimpleSelect = (_dec = testable(), _dec(_class = (_temp = _class2 = class Si
|
|
|
72
108
|
const option = this.getOption('id', state.selectedOptionId);
|
|
73
109
|
return {
|
|
74
110
|
isShowingOptions: false,
|
|
75
|
-
highlightedOptionId:
|
|
111
|
+
highlightedOptionId: void 0,
|
|
76
112
|
inputValue: option ? option.props.children : ''
|
|
77
113
|
};
|
|
78
114
|
});
|
|
79
|
-
|
|
115
|
+
|
|
116
|
+
if (typeof this.props.onHideOptions === 'function') {
|
|
117
|
+
this.props.onHideOptions(event);
|
|
118
|
+
}
|
|
80
119
|
};
|
|
81
120
|
|
|
82
121
|
this.handleHighlightOption = (event, _ref) => {
|
|
83
122
|
let id = _ref.id;
|
|
84
123
|
if (id === this._emptyOptionId) return;
|
|
85
124
|
const option = this.getOption('id', id);
|
|
86
|
-
const label = option.props.children;
|
|
125
|
+
const label = option === null || option === void 0 ? void 0 : option.props.children;
|
|
87
126
|
const inputValue = event.type === 'keydown' ? label : this.state.inputValue;
|
|
88
127
|
this.setState({
|
|
89
128
|
highlightedOptionId: id,
|
|
@@ -118,12 +157,17 @@ let SimpleSelect = (_dec = testable(), _dec(_class = (_temp = _class2 = class Si
|
|
|
118
157
|
} // fire onChange if selected option changed
|
|
119
158
|
|
|
120
159
|
|
|
121
|
-
option && this.props.onChange
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
160
|
+
if (option && typeof this.props.onChange === 'function') {
|
|
161
|
+
this.props.onChange(event, {
|
|
162
|
+
value,
|
|
163
|
+
id
|
|
164
|
+
});
|
|
165
|
+
} // hide options list whenever selection is made
|
|
125
166
|
|
|
126
|
-
|
|
167
|
+
|
|
168
|
+
if (typeof this.props.onHideOptions === 'function') {
|
|
169
|
+
this.props.onHideOptions(event);
|
|
170
|
+
}
|
|
127
171
|
};
|
|
128
172
|
|
|
129
173
|
const _option = this.getInitialOption(props);
|
|
@@ -131,25 +175,30 @@ let SimpleSelect = (_dec = testable(), _dec(_class = (_temp = _class2 = class Si
|
|
|
131
175
|
this.state = {
|
|
132
176
|
inputValue: _option ? _option.props.children : '',
|
|
133
177
|
isShowingOptions: false,
|
|
134
|
-
highlightedOptionId:
|
|
135
|
-
selectedOptionId: _option ? _option.props.id :
|
|
178
|
+
highlightedOptionId: void 0,
|
|
179
|
+
selectedOptionId: _option ? _option.props.id : void 0
|
|
136
180
|
};
|
|
181
|
+
this._emptyOptionId = uid('Select-EmptyOption');
|
|
137
182
|
}
|
|
138
183
|
|
|
139
184
|
get _select() {
|
|
140
185
|
return this.ref;
|
|
141
186
|
}
|
|
142
187
|
|
|
188
|
+
get childrenArray() {
|
|
189
|
+
return Children.toArray(this.props.children);
|
|
190
|
+
}
|
|
191
|
+
|
|
143
192
|
focus() {
|
|
144
193
|
this.ref && this.ref.focus();
|
|
145
194
|
}
|
|
146
195
|
|
|
147
196
|
get focused() {
|
|
148
|
-
return this.ref
|
|
197
|
+
return this.ref ? this.ref.focused : false;
|
|
149
198
|
}
|
|
150
199
|
|
|
151
200
|
get id() {
|
|
152
|
-
return this.ref
|
|
201
|
+
return this.ref ? this.ref.id : void 0;
|
|
153
202
|
}
|
|
154
203
|
|
|
155
204
|
get isControlled() {
|
|
@@ -189,7 +238,7 @@ let SimpleSelect = (_dec = testable(), _dec(_class = (_temp = _class2 = class Si
|
|
|
189
238
|
} // otherwise get the first option
|
|
190
239
|
|
|
191
240
|
|
|
192
|
-
return this.
|
|
241
|
+
return this.getFirstOption();
|
|
193
242
|
}
|
|
194
243
|
|
|
195
244
|
getOptionLabelById(id) {
|
|
@@ -197,12 +246,11 @@ let SimpleSelect = (_dec = testable(), _dec(_class = (_temp = _class2 = class Si
|
|
|
197
246
|
return option ? option.props.children : '';
|
|
198
247
|
}
|
|
199
248
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
let match = null;
|
|
249
|
+
getFirstOption() {
|
|
250
|
+
let match;
|
|
203
251
|
|
|
204
|
-
for (let i = 0; i <
|
|
205
|
-
const child =
|
|
252
|
+
for (let i = 0; i < this.childrenArray.length; i++) {
|
|
253
|
+
const child = this.childrenArray[i];
|
|
206
254
|
|
|
207
255
|
if (matchComponentTypes(child, [Option])) {
|
|
208
256
|
match = child;
|
|
@@ -219,39 +267,8 @@ let SimpleSelect = (_dec = testable(), _dec(_class = (_temp = _class2 = class Si
|
|
|
219
267
|
return match;
|
|
220
268
|
}
|
|
221
269
|
|
|
222
|
-
getOption(field, value) {
|
|
223
|
-
const children = Children.toArray(this.props.children);
|
|
224
|
-
let match = null;
|
|
225
|
-
|
|
226
|
-
for (let i = 0; i < children.length; ++i) {
|
|
227
|
-
const child = children[i];
|
|
228
|
-
|
|
229
|
-
if (matchComponentTypes(child, [Option])) {
|
|
230
|
-
if (child.props[field] === value) {
|
|
231
|
-
match = child;
|
|
232
|
-
}
|
|
233
|
-
} else if (matchComponentTypes(child, [Group])) {
|
|
234
|
-
const groupChildren = Children.toArray(child.props.children);
|
|
235
|
-
|
|
236
|
-
for (let j = 0; j < groupChildren.length; ++j) {
|
|
237
|
-
const groupChild = groupChildren[j];
|
|
238
|
-
|
|
239
|
-
if (groupChild.props[field] === value) {
|
|
240
|
-
match = groupChild;
|
|
241
|
-
break;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
if (match) break;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return match;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
270
|
renderChildren() {
|
|
253
|
-
|
|
254
|
-
children = Children.map(children, child => {
|
|
271
|
+
const children = Children.map(this.childrenArray, child => {
|
|
255
272
|
if (matchComponentTypes(child, [Option])) {
|
|
256
273
|
return this.renderOption(child);
|
|
257
274
|
} else if (matchComponentTypes(child, [Group])) {
|
|
@@ -385,28 +402,17 @@ let SimpleSelect = (_dec = testable(), _dec(_class = (_temp = _class2 = class Si
|
|
|
385
402
|
onRequestHideOptions: this.handleHideOptions,
|
|
386
403
|
onRequestHighlightOption: this.handleHighlightOption,
|
|
387
404
|
onRequestSelectOption: this.handleSelectOption
|
|
388
|
-
}, passthroughProps(rest)), this.renderChildren(
|
|
405
|
+
}, passthroughProps(rest)), this.renderChildren());
|
|
389
406
|
}
|
|
390
407
|
|
|
391
408
|
}, _class2.displayName = "SimpleSelect", _class2.componentId = 'SimpleSelect', _class2.Option = Option, _class2.Group = Group, _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
|
|
392
409
|
size: 'medium',
|
|
393
|
-
placeholder: null,
|
|
394
410
|
isRequired: false,
|
|
395
411
|
isInline: false,
|
|
396
412
|
visibleOptionsCount: 8,
|
|
397
413
|
placement: 'bottom stretch',
|
|
398
414
|
constrain: 'window',
|
|
399
|
-
|
|
400
|
-
onFocus: event => {},
|
|
401
|
-
onBlur: event => {},
|
|
402
|
-
onShowOptions: event => {},
|
|
403
|
-
onHideOptions: event => {},
|
|
404
|
-
inputRef: node => {},
|
|
405
|
-
listRef: node => {},
|
|
406
|
-
renderEmptyOption: '---',
|
|
407
|
-
renderBeforeInput: null,
|
|
408
|
-
renderAfterInput: null,
|
|
409
|
-
children: null
|
|
415
|
+
renderEmptyOption: '---'
|
|
410
416
|
}, _temp)) || _class);
|
|
411
417
|
export { SimpleSelect };
|
|
412
418
|
export default SimpleSelect;
|
package/es/SimpleSelect/props.js
CHANGED
|
@@ -28,164 +28,34 @@ import { PositionPropTypes } from '@instructure/ui-position';
|
|
|
28
28
|
import { Group } from './Group';
|
|
29
29
|
import { Option } from './Option';
|
|
30
30
|
const propTypes = {
|
|
31
|
-
/**
|
|
32
|
-
* The form field label.
|
|
33
|
-
*/
|
|
34
31
|
renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* The value corresponding to the value of the selected option. If defined,
|
|
38
|
-
* the component will act controlled and will not manage its own state.
|
|
39
|
-
*/
|
|
40
32
|
// TODO: it was using the "controllable" util, in the TS migration mimic that behaviour
|
|
41
33
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* The value of the option to select by default, when uncontrolled.
|
|
45
|
-
*/
|
|
46
34
|
defaultValue: PropTypes.string,
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* The id of the text input. One is generated if not supplied.
|
|
50
|
-
*/
|
|
51
35
|
id: PropTypes.string,
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* The size of the text input.
|
|
55
|
-
*/
|
|
56
36
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Additional helpful text to provide to screen readers about the operation
|
|
60
|
-
* of the component. Provided via aria-describedby.
|
|
61
|
-
*/
|
|
62
37
|
assistiveText: PropTypes.string,
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Html placeholder text to display when the input has no value. This should
|
|
66
|
-
* be hint text, not a label replacement.
|
|
67
|
-
*/
|
|
68
38
|
placeholder: PropTypes.string,
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Specifies if interaction with the input is enabled, disabled, or readonly.
|
|
72
|
-
* When "disabled", the input changes visibly to indicate that it cannot
|
|
73
|
-
* receive user interactions. When "readonly" the input still cannot receive
|
|
74
|
-
* user interactions but it keeps the same styles as if it were enabled.
|
|
75
|
-
*/
|
|
76
39
|
interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Whether or not the text input is required.
|
|
80
|
-
*/
|
|
81
40
|
isRequired: PropTypes.bool,
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Whether the input is rendered inline with other elements or if it
|
|
85
|
-
* is rendered as a block level element.
|
|
86
|
-
*/
|
|
87
41
|
isInline: PropTypes.bool,
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* The width of the text input.
|
|
91
|
-
*/
|
|
92
42
|
width: PropTypes.string,
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* The max width the options list can be before option text wraps. If not
|
|
96
|
-
* set, the list will only display as wide as the text input.
|
|
97
|
-
*/
|
|
98
43
|
optionsMaxWidth: PropTypes.string,
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* The number of options that should be visible before having to scroll.
|
|
102
|
-
*/
|
|
103
44
|
visibleOptionsCount: PropTypes.number,
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Displays messages and validation for the input. It should be an object
|
|
107
|
-
* with the following shape:
|
|
108
|
-
* `{
|
|
109
|
-
* text: PropTypes.node,
|
|
110
|
-
* type: PropTypes.oneOf(['error', 'hint', 'success', 'screenreader-only'])
|
|
111
|
-
* }`
|
|
112
|
-
*/
|
|
113
45
|
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* The placement of the options list.
|
|
117
|
-
*/
|
|
118
46
|
placement: PositionPropTypes.placement,
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* The parent in which to constrain the placement.
|
|
122
|
-
*/
|
|
123
47
|
constrain: PositionPropTypes.constrain,
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* An element or a function returning an element to use mount the options
|
|
127
|
-
* list to in the DOM (defaults to `document.body`)
|
|
128
|
-
*/
|
|
129
48
|
mountNode: PositionPropTypes.mountNode,
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Callback fired when a new option is selected.
|
|
133
|
-
* @param {Object} event - the event object
|
|
134
|
-
* @param {Object} data - additional data
|
|
135
|
-
* @param data.value - the value of selected option
|
|
136
|
-
* @param data.id - the id of the selected option
|
|
137
|
-
*/
|
|
138
49
|
onChange: PropTypes.func,
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Callback fired when text input receives focus.
|
|
142
|
-
*/
|
|
143
50
|
onFocus: PropTypes.func,
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Callback fired when text input loses focus.
|
|
147
|
-
*/
|
|
148
51
|
onBlur: PropTypes.func,
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Callback fired when the options list is shown.
|
|
152
|
-
*/
|
|
153
52
|
onShowOptions: PropTypes.func,
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Callback fired when the options list is hidden.
|
|
157
|
-
*/
|
|
158
53
|
onHideOptions: PropTypes.func,
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* A ref to the html `input` element.
|
|
162
|
-
*/
|
|
163
54
|
inputRef: PropTypes.func,
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* A ref to the html `ul` element.
|
|
167
|
-
*/
|
|
168
55
|
listRef: PropTypes.func,
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Content to display in the list when no options are available.
|
|
172
|
-
*/
|
|
173
56
|
renderEmptyOption: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Content to display before the text input. This will commonly be an icon.
|
|
177
|
-
*/
|
|
178
57
|
renderBeforeInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Content to display after the text input. This content will replace the
|
|
182
|
-
* default arrow icons.
|
|
183
|
-
*/
|
|
184
58
|
renderAfterInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Children of type `<SimpleSelect.Option />` or `<SimpleSelect.Group />`.
|
|
188
|
-
*/
|
|
189
59
|
children: ChildrenPropTypes.oneOf([Group, Option])
|
|
190
60
|
};
|
|
191
61
|
const allowedProps = ['renderLabel', 'value', 'defaultValue', 'id', 'size', 'assistiveText', 'placeholder', 'interaction', 'isRequired', 'isInline', 'width', 'optionsMaxWidth', 'visibleOptionsCount', 'messages', 'placement', 'constrain', 'mountNode', 'onChange', 'onFocus', 'onBlur', 'onShowOptions', 'onHideOptions', 'inputRef', 'listRef', 'renderEmptyOption', 'renderBeforeInput', 'renderAfterInput', 'children'];
|
|
@@ -38,6 +38,7 @@ var _props = require("./props");
|
|
|
38
38
|
parent: SimpleSelect
|
|
39
39
|
id: SimpleSelect.Group
|
|
40
40
|
---
|
|
41
|
+
@tsProps
|
|
41
42
|
**/
|
|
42
43
|
class Group extends _react.Component {
|
|
43
44
|
/* istanbul ignore next */
|
|
@@ -54,8 +55,6 @@ Group.displayName = "Group";
|
|
|
54
55
|
Group.componentId = 'SimpleSelect.Group';
|
|
55
56
|
Group.allowedProps = _props.allowedProps;
|
|
56
57
|
Group.propTypes = _props.propTypes;
|
|
57
|
-
Group.defaultProps = {
|
|
58
|
-
children: null
|
|
59
|
-
};
|
|
58
|
+
Group.defaultProps = {};
|
|
60
59
|
var _default = Group;
|
|
61
60
|
exports.default = _default;
|
|
@@ -37,14 +37,7 @@ var _Option = require("../Option");
|
|
|
37
37
|
* SOFTWARE.
|
|
38
38
|
*/
|
|
39
39
|
const propTypes = {
|
|
40
|
-
/**
|
|
41
|
-
* The label associated with the group options.
|
|
42
|
-
*/
|
|
43
40
|
renderLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Children of type `<SimpleSelect.Option />` that will be considered part of the group.
|
|
47
|
-
*/
|
|
48
41
|
children: _Children.Children.oneOf([_Option.Option])
|
|
49
42
|
};
|
|
50
43
|
exports.propTypes = propTypes;
|
|
@@ -38,6 +38,7 @@ var _props = require("./props");
|
|
|
38
38
|
parent: SimpleSelect
|
|
39
39
|
id: SimpleSelect.Option
|
|
40
40
|
---
|
|
41
|
+
@tsProps
|
|
41
42
|
**/
|
|
42
43
|
class Option extends _react.Component {
|
|
43
44
|
/* istanbul ignore next */
|
|
@@ -55,8 +56,7 @@ Option.componentId = 'SimpleSelect.Option';
|
|
|
55
56
|
Option.allowedProps = _props.allowedProps;
|
|
56
57
|
Option.propTypes = _props.propTypes;
|
|
57
58
|
Option.defaultProps = {
|
|
58
|
-
isDisabled: false
|
|
59
|
-
children: null
|
|
59
|
+
isDisabled: false
|
|
60
60
|
};
|
|
61
61
|
var _default = Option;
|
|
62
62
|
exports.default = _default;
|
|
@@ -33,34 +33,11 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
33
33
|
* SOFTWARE.
|
|
34
34
|
*/
|
|
35
35
|
const propTypes = {
|
|
36
|
-
/**
|
|
37
|
-
* The id for the option.
|
|
38
|
-
*/
|
|
39
36
|
id: _propTypes.default.string.isRequired,
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* The value for the option.
|
|
43
|
-
*/
|
|
44
37
|
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]).isRequired,
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Whether or not this option is disabled.
|
|
48
|
-
*/
|
|
49
38
|
isDisabled: _propTypes.default.bool,
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Content to display before the option label, such as an icon.
|
|
53
|
-
*/
|
|
54
39
|
renderBeforeLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Content to display after the option label, such as an icon.
|
|
58
|
-
*/
|
|
59
40
|
renderAfterLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Content to display as the option label.
|
|
63
|
-
*/
|
|
64
41
|
children: _propTypes.default.string
|
|
65
42
|
};
|
|
66
43
|
exports.propTypes = propTypes;
|
|
@@ -36,8 +36,10 @@ var _index = require("./index");
|
|
|
36
36
|
*/
|
|
37
37
|
|
|
38
38
|
/* eslint-disable no-restricted-imports */
|
|
39
|
+
// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module '@ins... Remove this comment to see the full error message
|
|
39
40
|
|
|
40
41
|
/* eslint-enable no-restricted-imports */
|
|
42
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
41
43
|
const SimpleSelectLocator = (0, _locator.locator)(_index.SimpleSelect.selector, {
|
|
42
44
|
findInput: _SelectLocator.SelectLocator.findInput,
|
|
43
45
|
// TODO these dont work because TS doesnt find its type declarations,
|