@instructure/ui-simple-select 8.56.1 → 8.56.2-pr-snapshot-1721749364069
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
CHANGED
@@ -3,6 +3,14 @@
|
|
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.56.2-pr-snapshot-1721749364069](https://github.com/instructure/instructure-ui/compare/v8.56.1...v8.56.2-pr-snapshot-1721749364069) (2024-07-23)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @instructure/ui-simple-select
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
6
14
|
## [8.56.1](https://github.com/instructure/instructure-ui/compare/v8.56.0...v8.56.1) (2024-06-13)
|
7
15
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-simple-select
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.propTypes = exports.allowedProps = void 0;
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
|
-
var
|
9
|
+
var _uiPropTypes = require("@instructure/ui-prop-types");
|
10
10
|
var _Option = require("../Option");
|
11
11
|
/*
|
12
12
|
* The MIT License (MIT)
|
@@ -34,6 +34,6 @@ var _Option = require("../Option");
|
|
34
34
|
|
35
35
|
const propTypes = exports.propTypes = {
|
36
36
|
renderLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
|
37
|
-
children:
|
37
|
+
children: _uiPropTypes.Children.oneOf([_Option.Option])
|
38
38
|
};
|
39
39
|
const allowedProps = exports.allowedProps = ['renderLabel', 'children'];
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.SimpleSelectLocator = void 0;
|
7
|
-
var
|
8
|
-
var _SelectLocator = require("@instructure/ui-select/
|
7
|
+
var _uiTestLocator = require("@instructure/ui-test-locator");
|
8
|
+
var _SelectLocator = require("@instructure/ui-select/es/Select/SelectLocator");
|
9
9
|
var _index = require("./index");
|
10
10
|
/*
|
11
11
|
* The MIT License (MIT)
|
@@ -37,7 +37,7 @@ var _index = require("./index");
|
|
37
37
|
/* eslint-enable no-restricted-imports */
|
38
38
|
|
39
39
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
40
|
-
const SimpleSelectLocator = exports.SimpleSelectLocator = (0,
|
40
|
+
const SimpleSelectLocator = exports.SimpleSelectLocator = (0, _uiTestLocator.locator)(_index.SimpleSelect.selector, {
|
41
41
|
findInput: _SelectLocator.SelectLocator.findInput,
|
42
42
|
// TODO these dont work because TS doesnt find its type declarations,
|
43
43
|
findOptionsList: _SelectLocator.SelectLocator.findOptionsList
|
@@ -8,13 +8,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
exports.default = exports.SimpleSelect = void 0;
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
11
|
-
var
|
12
|
-
var
|
13
|
-
var
|
14
|
-
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
15
|
-
var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
|
16
|
-
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
17
|
-
var _Select = require("@instructure/ui-select/lib/Select");
|
11
|
+
var _uiTestable = require("@instructure/ui-testable");
|
12
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
13
|
+
var _uiSelect = require("@instructure/ui-select");
|
18
14
|
var _Option = require("./Option");
|
19
15
|
var _Group = require("./Group");
|
20
16
|
var _props = require("./props");
|
@@ -51,7 +47,7 @@ category: components
|
|
51
47
|
tags: form, field, dropdown
|
52
48
|
---
|
53
49
|
**/
|
54
|
-
let SimpleSelect = exports.SimpleSelect = (_dec = (0,
|
50
|
+
let SimpleSelect = exports.SimpleSelect = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _uiTestable.testable)(), _dec(_class = _dec2(_class = (_class2 = class SimpleSelect extends _react.Component {
|
55
51
|
constructor(props) {
|
56
52
|
super(props);
|
57
53
|
this.ref = null;
|
@@ -61,11 +57,11 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _withDeterministicId.withD
|
|
61
57
|
let match;
|
62
58
|
for (let i = 0; i < children.length; ++i) {
|
63
59
|
const child = children[i];
|
64
|
-
if ((0,
|
60
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_Option.Option])) {
|
65
61
|
if (child.props[field] === value) {
|
66
62
|
match = child;
|
67
63
|
}
|
68
|
-
} else if ((0,
|
64
|
+
} else if ((0, _uiReactUtils.matchComponentTypes)(child, [_Group.Group])) {
|
69
65
|
const groupChildren = _react.Children.toArray(child.props.children);
|
70
66
|
for (let j = 0; j < groupChildren.length; ++j) {
|
71
67
|
const groupChild = groupChildren[j];
|
@@ -183,7 +179,7 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _withDeterministicId.withD
|
|
183
179
|
return typeof this.props.value !== 'undefined';
|
184
180
|
}
|
185
181
|
get interaction() {
|
186
|
-
return (0,
|
182
|
+
return (0, _uiReactUtils.getInteraction)({
|
187
183
|
props: this.props
|
188
184
|
});
|
189
185
|
}
|
@@ -220,9 +216,9 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _withDeterministicId.withD
|
|
220
216
|
let match;
|
221
217
|
for (let i = 0; i < children.length; i++) {
|
222
218
|
const child = children[i];
|
223
|
-
if ((0,
|
219
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_Option.Option])) {
|
224
220
|
match = child;
|
225
|
-
} else if ((0,
|
221
|
+
} else if ((0, _uiReactUtils.matchComponentTypes)(child, [_Group.Group])) {
|
226
222
|
// first child is a group, not an option, find first child in group
|
227
223
|
match = _react.Children.toArray(child.props.children)[0];
|
228
224
|
}
|
@@ -235,9 +231,9 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _withDeterministicId.withD
|
|
235
231
|
renderChildren() {
|
236
232
|
let children = _react.Children.toArray(this.props.children);
|
237
233
|
children = _react.Children.map(children, child => {
|
238
|
-
if ((0,
|
234
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_Option.Option])) {
|
239
235
|
return this.renderOption(child);
|
240
|
-
} else if ((0,
|
236
|
+
} else if ((0, _uiReactUtils.matchComponentTypes)(child, [_Group.Group])) {
|
241
237
|
return this.renderGroup(child);
|
242
238
|
}
|
243
239
|
return null;
|
@@ -249,11 +245,11 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _withDeterministicId.withD
|
|
249
245
|
return children;
|
250
246
|
}
|
251
247
|
renderEmptyOption() {
|
252
|
-
return /*#__PURE__*/_react.default.createElement(
|
248
|
+
return /*#__PURE__*/_react.default.createElement(_uiSelect.Select.Option, {
|
253
249
|
id: this._emptyOptionId,
|
254
250
|
isHighlighted: false,
|
255
251
|
isSelected: false
|
256
|
-
}, (0,
|
252
|
+
}, (0, _uiReactUtils.callRenderProp)(this.props.renderEmptyOption));
|
257
253
|
}
|
258
254
|
renderOption(option) {
|
259
255
|
const _option$props = option.props,
|
@@ -276,7 +272,7 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _withDeterministicId.withD
|
|
276
272
|
children
|
277
273
|
}) : renderLabel;
|
278
274
|
};
|
279
|
-
return /*#__PURE__*/_react.default.createElement(
|
275
|
+
return /*#__PURE__*/_react.default.createElement(_uiSelect.Select.Option, Object.assign({
|
280
276
|
id: id,
|
281
277
|
value: value,
|
282
278
|
key: option.key || id,
|
@@ -285,7 +281,7 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _withDeterministicId.withD
|
|
285
281
|
isDisabled: option.props.isDisabled,
|
286
282
|
renderBeforeLabel: getRenderLabel(renderBeforeLabel),
|
287
283
|
renderAfterLabel: getRenderLabel(renderAfterLabel)
|
288
|
-
}, (0,
|
284
|
+
}, (0, _uiReactUtils.passthroughProps)(rest)), children);
|
289
285
|
}
|
290
286
|
renderGroup(group) {
|
291
287
|
const _group$props = group.props,
|
@@ -293,10 +289,10 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _withDeterministicId.withD
|
|
293
289
|
renderLabel = _group$props.renderLabel,
|
294
290
|
children = _group$props.children,
|
295
291
|
rest = (0, _objectWithoutProperties2.default)(_group$props, _excluded2);
|
296
|
-
return /*#__PURE__*/_react.default.createElement(
|
292
|
+
return /*#__PURE__*/_react.default.createElement(_uiSelect.Select.Group, Object.assign({
|
297
293
|
renderLabel: renderLabel,
|
298
294
|
key: group.key || id
|
299
|
-
}, (0,
|
295
|
+
}, (0, _uiReactUtils.passthroughProps)(rest)), _react.Children.map(children, child => this.renderOption(child)));
|
300
296
|
}
|
301
297
|
render() {
|
302
298
|
const _this$props = this.props,
|
@@ -329,7 +325,7 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _withDeterministicId.withD
|
|
329
325
|
onHideOptions = _this$props.onHideOptions,
|
330
326
|
children = _this$props.children,
|
331
327
|
rest = (0, _objectWithoutProperties2.default)(_this$props, _excluded3);
|
332
|
-
return /*#__PURE__*/_react.default.createElement(
|
328
|
+
return /*#__PURE__*/_react.default.createElement(_uiSelect.Select, Object.assign({
|
333
329
|
renderLabel: renderLabel,
|
334
330
|
inputValue: this.state.inputValue,
|
335
331
|
isShowingOptions: this.state.isShowingOptions,
|
@@ -359,7 +355,7 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _withDeterministicId.withD
|
|
359
355
|
onRequestHideOptions: this.handleHideOptions,
|
360
356
|
onRequestHighlightOption: this.handleHighlightOption,
|
361
357
|
onRequestSelectOption: this.handleSelectOption
|
362
|
-
}, (0,
|
358
|
+
}, (0, _uiReactUtils.passthroughProps)(rest)), this.renderChildren());
|
363
359
|
}
|
364
360
|
}, _class2.displayName = "SimpleSelect", _class2.componentId = 'SimpleSelect', _class2.Option = _Option.Option, _class2.Group = _Group.Group, _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
365
361
|
size: 'medium',
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.propTypes = exports.allowedProps = void 0;
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
|
-
var
|
10
|
-
var
|
11
|
-
var
|
9
|
+
var _uiPropTypes = require("@instructure/ui-prop-types");
|
10
|
+
var _uiFormField = require("@instructure/ui-form-field");
|
11
|
+
var _uiPosition = require("@instructure/ui-position");
|
12
12
|
var _Group = require("./Group");
|
13
13
|
var _Option = require("./Option");
|
14
14
|
/*
|
@@ -51,10 +51,10 @@ const propTypes = exports.propTypes = {
|
|
51
51
|
visibleOptionsCount: _propTypes.default.number,
|
52
52
|
optionsMaxHeight: _propTypes.default.string,
|
53
53
|
optionsMaxWidth: _propTypes.default.string,
|
54
|
-
messages: _propTypes.default.arrayOf(
|
55
|
-
placement:
|
56
|
-
constrain:
|
57
|
-
mountNode:
|
54
|
+
messages: _propTypes.default.arrayOf(_uiFormField.FormPropTypes.message),
|
55
|
+
placement: _uiPosition.PositionPropTypes.placement,
|
56
|
+
constrain: _uiPosition.PositionPropTypes.constrain,
|
57
|
+
mountNode: _uiPosition.PositionPropTypes.mountNode,
|
58
58
|
onChange: _propTypes.default.func,
|
59
59
|
onFocus: _propTypes.default.func,
|
60
60
|
onBlur: _propTypes.default.func,
|
@@ -65,6 +65,6 @@ const propTypes = exports.propTypes = {
|
|
65
65
|
renderEmptyOption: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
66
66
|
renderBeforeInput: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
67
67
|
renderAfterInput: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
68
|
-
children:
|
68
|
+
children: _uiPropTypes.Children.oneOf([_Group.Group, _Option.Option])
|
69
69
|
};
|
70
70
|
const allowedProps = exports.allowedProps = ['renderLabel', 'value', 'defaultValue', 'id', 'size', 'assistiveText', 'placeholder', 'interaction', 'isRequired', 'isInline', 'width', 'visibleOptionsCount', 'optionsMaxHeight', 'optionsMaxWidth', 'messages', 'placement', 'constrain', 'mountNode', 'onChange', 'onFocus', 'onBlur', 'onShowOptions', 'onHideOptions', 'inputRef', 'listRef', 'renderEmptyOption', 'renderBeforeInput', 'renderAfterInput', 'children'];
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@instructure/ui-simple-select",
|
3
|
-
"version": "8.56.
|
3
|
+
"version": "8.56.2-pr-snapshot-1721749364069",
|
4
4
|
"description": "A component for standard select element behavior.",
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
6
6
|
"module": "./es/index.js",
|
@@ -24,23 +24,23 @@
|
|
24
24
|
"license": "MIT",
|
25
25
|
"dependencies": {
|
26
26
|
"@babel/runtime": "^7.23.2",
|
27
|
-
"@instructure/console": "8.56.
|
28
|
-
"@instructure/shared-types": "8.56.
|
29
|
-
"@instructure/ui-form-field": "8.56.
|
30
|
-
"@instructure/ui-position": "8.56.
|
31
|
-
"@instructure/ui-prop-types": "8.56.
|
32
|
-
"@instructure/ui-react-utils": "8.56.
|
33
|
-
"@instructure/ui-select": "8.56.
|
34
|
-
"@instructure/ui-testable": "8.56.
|
27
|
+
"@instructure/console": "8.56.2-pr-snapshot-1721749364069",
|
28
|
+
"@instructure/shared-types": "8.56.2-pr-snapshot-1721749364069",
|
29
|
+
"@instructure/ui-form-field": "8.56.2-pr-snapshot-1721749364069",
|
30
|
+
"@instructure/ui-position": "8.56.2-pr-snapshot-1721749364069",
|
31
|
+
"@instructure/ui-prop-types": "8.56.2-pr-snapshot-1721749364069",
|
32
|
+
"@instructure/ui-react-utils": "8.56.2-pr-snapshot-1721749364069",
|
33
|
+
"@instructure/ui-select": "8.56.2-pr-snapshot-1721749364069",
|
34
|
+
"@instructure/ui-testable": "8.56.2-pr-snapshot-1721749364069",
|
35
35
|
"prop-types": "^15.8.1"
|
36
36
|
},
|
37
37
|
"devDependencies": {
|
38
|
-
"@instructure/ui-babel-preset": "8.56.
|
39
|
-
"@instructure/ui-color-utils": "8.56.
|
40
|
-
"@instructure/ui-icons": "8.56.
|
41
|
-
"@instructure/ui-test-locator": "8.56.
|
42
|
-
"@instructure/ui-test-utils": "8.56.
|
43
|
-
"@instructure/ui-utils": "8.56.
|
38
|
+
"@instructure/ui-babel-preset": "8.56.2-pr-snapshot-1721749364069",
|
39
|
+
"@instructure/ui-color-utils": "8.56.2-pr-snapshot-1721749364069",
|
40
|
+
"@instructure/ui-icons": "8.56.2-pr-snapshot-1721749364069",
|
41
|
+
"@instructure/ui-test-locator": "8.56.2-pr-snapshot-1721749364069",
|
42
|
+
"@instructure/ui-test-utils": "8.56.2-pr-snapshot-1721749364069",
|
43
|
+
"@instructure/ui-utils": "8.56.2-pr-snapshot-1721749364069",
|
44
44
|
"@testing-library/jest-dom": "^6.1.4",
|
45
45
|
"@testing-library/react": "^14.1.2"
|
46
46
|
},
|