@instructure/ui-simple-select 10.13.0 → 10.13.1-pr-snapshot-1741357986437
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
|
+
## [10.13.1-pr-snapshot-1741357986437](https://github.com/instructure/instructure-ui/compare/v10.13.0...v10.13.1-pr-snapshot-1741357986437) (2025-03-07)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @instructure/ui-simple-select
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
6
14
|
# [10.13.0](https://github.com/instructure/instructure-ui/compare/v10.12.0...v10.13.0) (2025-03-06)
|
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'];
|
@@ -8,8 +8,8 @@ var _vitest = require("vitest");
|
|
8
8
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
9
9
|
require("@testing-library/jest-dom");
|
10
10
|
var _generateA11yTests = require("@instructure/ui-scripts/lib/test/generateA11yTests");
|
11
|
-
var
|
12
|
-
var
|
11
|
+
var _uiIcons = require("@instructure/ui-icons");
|
12
|
+
var _uiAxeCheck = require("@instructure/ui-axe-check");
|
13
13
|
var _SimpleSelect7 = _interopRequireDefault(require("../__examples__/SimpleSelect.examples"));
|
14
14
|
var _index = _interopRequireDefault(require("../index"));
|
15
15
|
var _SimpleSelect, _SimpleSelect2, _SimpleSelect3, _SimpleSelect4, _SimpleSelect5, _SimpleSelect6, _IconCheckSolid;
|
@@ -189,7 +189,7 @@ describe('<SimpleSelect />', () => {
|
|
189
189
|
});
|
190
190
|
});
|
191
191
|
(0, _vitest.it)('should render icons before option and call renderBeforeLabel callback with necessary props', async () => {
|
192
|
-
const renderBeforeLabel = _vitest.vi.fn(() => _IconCheckSolid || (_IconCheckSolid = /*#__PURE__*/_react.default.createElement(
|
192
|
+
const renderBeforeLabel = _vitest.vi.fn(() => _IconCheckSolid || (_IconCheckSolid = /*#__PURE__*/_react.default.createElement(_uiIcons.IconCheckSolid, {
|
193
193
|
"data-testid": "option-icon"
|
194
194
|
})));
|
195
195
|
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.default, {
|
@@ -266,7 +266,7 @@ describe('<SimpleSelect />', () => {
|
|
266
266
|
}) => {
|
267
267
|
const _render = (0, _react2.render)(content),
|
268
268
|
container = _render.container;
|
269
|
-
const axeCheck = await (0,
|
269
|
+
const axeCheck = await (0, _uiAxeCheck.runAxeCheck)(container);
|
270
270
|
expect(axeCheck).toBe(true);
|
271
271
|
});
|
272
272
|
});
|
@@ -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 = (_SimpleSelect = 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
|
}
|
@@ -242,9 +238,9 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _withDeterministicId.withD
|
|
242
238
|
let match;
|
243
239
|
for (let i = 0; i < children.length; i++) {
|
244
240
|
const child = children[i];
|
245
|
-
if ((0,
|
241
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_Option.Option])) {
|
246
242
|
match = child;
|
247
|
-
} else if ((0,
|
243
|
+
} else if ((0, _uiReactUtils.matchComponentTypes)(child, [_Group.Group])) {
|
248
244
|
// first child is a group, not an option, find first child in group
|
249
245
|
match = _react.Children.toArray(child.props.children)[0];
|
250
246
|
}
|
@@ -257,9 +253,9 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _withDeterministicId.withD
|
|
257
253
|
renderChildren() {
|
258
254
|
let children = _react.Children.toArray(this.props.children);
|
259
255
|
children = _react.Children.map(children, child => {
|
260
|
-
if ((0,
|
256
|
+
if ((0, _uiReactUtils.matchComponentTypes)(child, [_Option.Option])) {
|
261
257
|
return this.renderOption(child);
|
262
|
-
} else if ((0,
|
258
|
+
} else if ((0, _uiReactUtils.matchComponentTypes)(child, [_Group.Group])) {
|
263
259
|
return this.renderGroup(child);
|
264
260
|
}
|
265
261
|
return null;
|
@@ -271,11 +267,11 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _withDeterministicId.withD
|
|
271
267
|
return children;
|
272
268
|
}
|
273
269
|
renderEmptyOption() {
|
274
|
-
return /*#__PURE__*/_react.default.createElement(
|
270
|
+
return /*#__PURE__*/_react.default.createElement(_uiSelect.Select.Option, {
|
275
271
|
id: this._emptyOptionId,
|
276
272
|
isHighlighted: false,
|
277
273
|
isSelected: false
|
278
|
-
}, (0,
|
274
|
+
}, (0, _uiReactUtils.callRenderProp)(this.props.renderEmptyOption));
|
279
275
|
}
|
280
276
|
renderOption(option) {
|
281
277
|
const _option$props = option.props,
|
@@ -298,7 +294,7 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _withDeterministicId.withD
|
|
298
294
|
children
|
299
295
|
}) : renderLabel;
|
300
296
|
};
|
301
|
-
return /*#__PURE__*/_react.default.createElement(
|
297
|
+
return /*#__PURE__*/_react.default.createElement(_uiSelect.Select.Option, Object.assign({
|
302
298
|
id: id,
|
303
299
|
value: value,
|
304
300
|
key: option.key || id,
|
@@ -307,7 +303,7 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _withDeterministicId.withD
|
|
307
303
|
isDisabled: option.props.isDisabled,
|
308
304
|
renderBeforeLabel: getRenderLabel(renderBeforeLabel),
|
309
305
|
renderAfterLabel: getRenderLabel(renderAfterLabel)
|
310
|
-
}, (0,
|
306
|
+
}, (0, _uiReactUtils.passthroughProps)(rest)), children);
|
311
307
|
}
|
312
308
|
renderGroup(group) {
|
313
309
|
const _group$props = group.props,
|
@@ -315,10 +311,10 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _withDeterministicId.withD
|
|
315
311
|
renderLabel = _group$props.renderLabel,
|
316
312
|
children = _group$props.children,
|
317
313
|
rest = (0, _objectWithoutProperties2.default)(_group$props, _excluded2);
|
318
|
-
return /*#__PURE__*/_react.default.createElement(
|
314
|
+
return /*#__PURE__*/_react.default.createElement(_uiSelect.Select.Group, Object.assign({
|
319
315
|
renderLabel: renderLabel,
|
320
316
|
key: group.key || id
|
321
|
-
}, (0,
|
317
|
+
}, (0, _uiReactUtils.passthroughProps)(rest)), _react.Children.map(children, child => this.renderOption(child)));
|
322
318
|
}
|
323
319
|
render() {
|
324
320
|
const _this$props = this.props,
|
@@ -351,7 +347,7 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _withDeterministicId.withD
|
|
351
347
|
onHideOptions = _this$props.onHideOptions,
|
352
348
|
children = _this$props.children,
|
353
349
|
rest = (0, _objectWithoutProperties2.default)(_this$props, _excluded3);
|
354
|
-
return /*#__PURE__*/_react.default.createElement(
|
350
|
+
return /*#__PURE__*/_react.default.createElement(_uiSelect.Select, Object.assign({
|
355
351
|
renderLabel: renderLabel,
|
356
352
|
inputValue: this.state.inputValue,
|
357
353
|
isShowingOptions: this.state.isShowingOptions,
|
@@ -382,7 +378,7 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _withDeterministicId.withD
|
|
382
378
|
onRequestHighlightOption: this.handleHighlightOption,
|
383
379
|
onRequestSelectOption: this.handleSelectOption,
|
384
380
|
isOptionContentAppliedToInput: this.props.isOptionContentAppliedToInput
|
385
|
-
}, (0,
|
381
|
+
}, (0, _uiReactUtils.passthroughProps)(rest)), this.renderChildren());
|
386
382
|
}
|
387
383
|
}, _SimpleSelect.displayName = "SimpleSelect", _SimpleSelect.componentId = 'SimpleSelect', _SimpleSelect.Option = _Option.Option, _SimpleSelect.Group = _Group.Group, _SimpleSelect.allowedProps = _props.allowedProps, _SimpleSelect.propTypes = _props.propTypes, _SimpleSelect.defaultProps = {
|
388
384
|
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,7 +65,7 @@ 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
|
isOptionContentAppliedToInput: _propTypes.default.bool
|
70
70
|
};
|
71
71
|
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": "10.13.
|
3
|
+
"version": "10.13.1-pr-snapshot-1741357986437",
|
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.26.0",
|
27
|
-
"@instructure/console": "10.13.
|
28
|
-
"@instructure/shared-types": "10.13.
|
29
|
-
"@instructure/ui-form-field": "10.13.
|
30
|
-
"@instructure/ui-position": "10.13.
|
31
|
-
"@instructure/ui-prop-types": "10.13.
|
32
|
-
"@instructure/ui-react-utils": "10.13.
|
33
|
-
"@instructure/ui-select": "10.13.
|
34
|
-
"@instructure/ui-testable": "10.13.
|
27
|
+
"@instructure/console": "10.13.1-pr-snapshot-1741357986437",
|
28
|
+
"@instructure/shared-types": "10.13.1-pr-snapshot-1741357986437",
|
29
|
+
"@instructure/ui-form-field": "10.13.1-pr-snapshot-1741357986437",
|
30
|
+
"@instructure/ui-position": "10.13.1-pr-snapshot-1741357986437",
|
31
|
+
"@instructure/ui-prop-types": "10.13.1-pr-snapshot-1741357986437",
|
32
|
+
"@instructure/ui-react-utils": "10.13.1-pr-snapshot-1741357986437",
|
33
|
+
"@instructure/ui-select": "10.13.1-pr-snapshot-1741357986437",
|
34
|
+
"@instructure/ui-testable": "10.13.1-pr-snapshot-1741357986437",
|
35
35
|
"prop-types": "^15.8.1"
|
36
36
|
},
|
37
37
|
"devDependencies": {
|
38
|
-
"@instructure/ui-axe-check": "10.13.
|
39
|
-
"@instructure/ui-babel-preset": "10.13.
|
40
|
-
"@instructure/ui-color-utils": "10.13.
|
41
|
-
"@instructure/ui-icons": "10.13.
|
42
|
-
"@instructure/ui-test-utils": "10.13.
|
43
|
-
"@instructure/ui-utils": "10.13.
|
38
|
+
"@instructure/ui-axe-check": "10.13.1-pr-snapshot-1741357986437",
|
39
|
+
"@instructure/ui-babel-preset": "10.13.1-pr-snapshot-1741357986437",
|
40
|
+
"@instructure/ui-color-utils": "10.13.1-pr-snapshot-1741357986437",
|
41
|
+
"@instructure/ui-icons": "10.13.1-pr-snapshot-1741357986437",
|
42
|
+
"@instructure/ui-test-utils": "10.13.1-pr-snapshot-1741357986437",
|
43
|
+
"@instructure/ui-utils": "10.13.1-pr-snapshot-1741357986437",
|
44
44
|
"@testing-library/jest-dom": "^6.6.3",
|
45
45
|
"@testing-library/react": "^16.0.1",
|
46
46
|
"@testing-library/user-event": "^14.5.2",
|