@instructure/ui-simple-select 10.13.1-pr-snapshot-1741357986437 → 10.13.1-snapshot-2
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,7 +3,7 @@
|
|
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-
|
6
|
+
## [10.13.1-snapshot-2](https://github.com/instructure/instructure-ui/compare/v10.13.0...v10.13.1-snapshot-2) (2025-03-12)
|
7
7
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-simple-select
|
9
9
|
|
@@ -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 _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
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: _Children.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 _IconCheckSolid2 = require("@instructure/ui-icons/lib/IconCheckSolid.js");
|
12
|
+
var _runAxeCheck = require("@instructure/ui-axe-check/lib/runAxeCheck.js");
|
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(_IconCheckSolid2.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, _runAxeCheck.runAxeCheck)(container);
|
270
270
|
expect(axeCheck).toBe(true);
|
271
271
|
});
|
272
272
|
});
|
@@ -8,9 +8,13 @@ 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
|
11
|
+
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
12
|
+
var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
|
13
|
+
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
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");
|
14
18
|
var _Option = require("./Option");
|
15
19
|
var _Group = require("./Group");
|
16
20
|
var _props = require("./props");
|
@@ -47,7 +51,7 @@ category: components
|
|
47
51
|
tags: form, field, dropdown
|
48
52
|
---
|
49
53
|
**/
|
50
|
-
let SimpleSelect = exports.SimpleSelect = (_dec = (0,
|
54
|
+
let SimpleSelect = exports.SimpleSelect = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_SimpleSelect = class SimpleSelect extends _react.Component {
|
51
55
|
constructor(props) {
|
52
56
|
super(props);
|
53
57
|
this.ref = null;
|
@@ -57,11 +61,11 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _uiReactUtils.withDetermin
|
|
57
61
|
let match;
|
58
62
|
for (let i = 0; i < children.length; ++i) {
|
59
63
|
const child = children[i];
|
60
|
-
if ((0,
|
64
|
+
if ((0, _matchComponentTypes.matchComponentTypes)(child, [_Option.Option])) {
|
61
65
|
if (child.props[field] === value) {
|
62
66
|
match = child;
|
63
67
|
}
|
64
|
-
} else if ((0,
|
68
|
+
} else if ((0, _matchComponentTypes.matchComponentTypes)(child, [_Group.Group])) {
|
65
69
|
const groupChildren = _react.Children.toArray(child.props.children);
|
66
70
|
for (let j = 0; j < groupChildren.length; ++j) {
|
67
71
|
const groupChild = groupChildren[j];
|
@@ -179,7 +183,7 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _uiReactUtils.withDetermin
|
|
179
183
|
return typeof this.props.value !== 'undefined';
|
180
184
|
}
|
181
185
|
get interaction() {
|
182
|
-
return (0,
|
186
|
+
return (0, _getInteraction.getInteraction)({
|
183
187
|
props: this.props
|
184
188
|
});
|
185
189
|
}
|
@@ -238,9 +242,9 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _uiReactUtils.withDetermin
|
|
238
242
|
let match;
|
239
243
|
for (let i = 0; i < children.length; i++) {
|
240
244
|
const child = children[i];
|
241
|
-
if ((0,
|
245
|
+
if ((0, _matchComponentTypes.matchComponentTypes)(child, [_Option.Option])) {
|
242
246
|
match = child;
|
243
|
-
} else if ((0,
|
247
|
+
} else if ((0, _matchComponentTypes.matchComponentTypes)(child, [_Group.Group])) {
|
244
248
|
// first child is a group, not an option, find first child in group
|
245
249
|
match = _react.Children.toArray(child.props.children)[0];
|
246
250
|
}
|
@@ -253,9 +257,9 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _uiReactUtils.withDetermin
|
|
253
257
|
renderChildren() {
|
254
258
|
let children = _react.Children.toArray(this.props.children);
|
255
259
|
children = _react.Children.map(children, child => {
|
256
|
-
if ((0,
|
260
|
+
if ((0, _matchComponentTypes.matchComponentTypes)(child, [_Option.Option])) {
|
257
261
|
return this.renderOption(child);
|
258
|
-
} else if ((0,
|
262
|
+
} else if ((0, _matchComponentTypes.matchComponentTypes)(child, [_Group.Group])) {
|
259
263
|
return this.renderGroup(child);
|
260
264
|
}
|
261
265
|
return null;
|
@@ -267,11 +271,11 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _uiReactUtils.withDetermin
|
|
267
271
|
return children;
|
268
272
|
}
|
269
273
|
renderEmptyOption() {
|
270
|
-
return /*#__PURE__*/_react.default.createElement(
|
274
|
+
return /*#__PURE__*/_react.default.createElement(_Select.Select.Option, {
|
271
275
|
id: this._emptyOptionId,
|
272
276
|
isHighlighted: false,
|
273
277
|
isSelected: false
|
274
|
-
}, (0,
|
278
|
+
}, (0, _callRenderProp.callRenderProp)(this.props.renderEmptyOption));
|
275
279
|
}
|
276
280
|
renderOption(option) {
|
277
281
|
const _option$props = option.props,
|
@@ -294,7 +298,7 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _uiReactUtils.withDetermin
|
|
294
298
|
children
|
295
299
|
}) : renderLabel;
|
296
300
|
};
|
297
|
-
return /*#__PURE__*/_react.default.createElement(
|
301
|
+
return /*#__PURE__*/_react.default.createElement(_Select.Select.Option, Object.assign({
|
298
302
|
id: id,
|
299
303
|
value: value,
|
300
304
|
key: option.key || id,
|
@@ -303,7 +307,7 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _uiReactUtils.withDetermin
|
|
303
307
|
isDisabled: option.props.isDisabled,
|
304
308
|
renderBeforeLabel: getRenderLabel(renderBeforeLabel),
|
305
309
|
renderAfterLabel: getRenderLabel(renderAfterLabel)
|
306
|
-
}, (0,
|
310
|
+
}, (0, _passthroughProps.passthroughProps)(rest)), children);
|
307
311
|
}
|
308
312
|
renderGroup(group) {
|
309
313
|
const _group$props = group.props,
|
@@ -311,10 +315,10 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _uiReactUtils.withDetermin
|
|
311
315
|
renderLabel = _group$props.renderLabel,
|
312
316
|
children = _group$props.children,
|
313
317
|
rest = (0, _objectWithoutProperties2.default)(_group$props, _excluded2);
|
314
|
-
return /*#__PURE__*/_react.default.createElement(
|
318
|
+
return /*#__PURE__*/_react.default.createElement(_Select.Select.Group, Object.assign({
|
315
319
|
renderLabel: renderLabel,
|
316
320
|
key: group.key || id
|
317
|
-
}, (0,
|
321
|
+
}, (0, _passthroughProps.passthroughProps)(rest)), _react.Children.map(children, child => this.renderOption(child)));
|
318
322
|
}
|
319
323
|
render() {
|
320
324
|
const _this$props = this.props,
|
@@ -347,7 +351,7 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _uiReactUtils.withDetermin
|
|
347
351
|
onHideOptions = _this$props.onHideOptions,
|
348
352
|
children = _this$props.children,
|
349
353
|
rest = (0, _objectWithoutProperties2.default)(_this$props, _excluded3);
|
350
|
-
return /*#__PURE__*/_react.default.createElement(
|
354
|
+
return /*#__PURE__*/_react.default.createElement(_Select.Select, Object.assign({
|
351
355
|
renderLabel: renderLabel,
|
352
356
|
inputValue: this.state.inputValue,
|
353
357
|
isShowingOptions: this.state.isShowingOptions,
|
@@ -378,7 +382,7 @@ let SimpleSelect = exports.SimpleSelect = (_dec = (0, _uiReactUtils.withDetermin
|
|
378
382
|
onRequestHighlightOption: this.handleHighlightOption,
|
379
383
|
onRequestSelectOption: this.handleSelectOption,
|
380
384
|
isOptionContentAppliedToInput: this.props.isOptionContentAppliedToInput
|
381
|
-
}, (0,
|
385
|
+
}, (0, _passthroughProps.passthroughProps)(rest)), this.renderChildren());
|
382
386
|
}
|
383
387
|
}, _SimpleSelect.displayName = "SimpleSelect", _SimpleSelect.componentId = 'SimpleSelect', _SimpleSelect.Option = _Option.Option, _SimpleSelect.Group = _Group.Group, _SimpleSelect.allowedProps = _props.allowedProps, _SimpleSelect.propTypes = _props.propTypes, _SimpleSelect.defaultProps = {
|
384
388
|
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 _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
10
|
+
var _FormPropTypes = require("@instructure/ui-form-field/lib/FormPropTypes.js");
|
11
|
+
var _PositionPropTypes = require("@instructure/ui-position/lib/PositionPropTypes.js");
|
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(_FormPropTypes.FormPropTypes.message),
|
55
|
+
placement: _PositionPropTypes.PositionPropTypes.placement,
|
56
|
+
constrain: _PositionPropTypes.PositionPropTypes.constrain,
|
57
|
+
mountNode: _PositionPropTypes.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: _Children.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.1-
|
3
|
+
"version": "10.13.1-snapshot-2",
|
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.1-
|
28
|
-
"@instructure/shared-types": "10.13.1-
|
29
|
-
"@instructure/ui-form-field": "10.13.1-
|
30
|
-
"@instructure/ui-position": "10.13.1-
|
31
|
-
"@instructure/ui-prop-types": "10.13.1-
|
32
|
-
"@instructure/ui-react-utils": "10.13.1-
|
33
|
-
"@instructure/ui-select": "10.13.1-
|
34
|
-
"@instructure/ui-testable": "10.13.1-
|
27
|
+
"@instructure/console": "10.13.1-snapshot-2",
|
28
|
+
"@instructure/shared-types": "10.13.1-snapshot-2",
|
29
|
+
"@instructure/ui-form-field": "10.13.1-snapshot-2",
|
30
|
+
"@instructure/ui-position": "10.13.1-snapshot-2",
|
31
|
+
"@instructure/ui-prop-types": "10.13.1-snapshot-2",
|
32
|
+
"@instructure/ui-react-utils": "10.13.1-snapshot-2",
|
33
|
+
"@instructure/ui-select": "10.13.1-snapshot-2",
|
34
|
+
"@instructure/ui-testable": "10.13.1-snapshot-2",
|
35
35
|
"prop-types": "^15.8.1"
|
36
36
|
},
|
37
37
|
"devDependencies": {
|
38
|
-
"@instructure/ui-axe-check": "10.13.1-
|
39
|
-
"@instructure/ui-babel-preset": "10.13.1-
|
40
|
-
"@instructure/ui-color-utils": "10.13.1-
|
41
|
-
"@instructure/ui-icons": "10.13.1-
|
42
|
-
"@instructure/ui-test-utils": "10.13.1-
|
43
|
-
"@instructure/ui-utils": "10.13.1-
|
38
|
+
"@instructure/ui-axe-check": "10.13.1-snapshot-2",
|
39
|
+
"@instructure/ui-babel-preset": "10.13.1-snapshot-2",
|
40
|
+
"@instructure/ui-color-utils": "10.13.1-snapshot-2",
|
41
|
+
"@instructure/ui-icons": "10.13.1-snapshot-2",
|
42
|
+
"@instructure/ui-test-utils": "10.13.1-snapshot-2",
|
43
|
+
"@instructure/ui-utils": "10.13.1-snapshot-2",
|
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",
|