@instructure/ui-select 10.26.1-snapshot-2 → 10.26.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 +5 -18
- package/es/Select/Group/index.js +2 -1
- package/es/Select/Group/props.js +8 -1
- package/es/Select/Option/index.js +2 -1
- package/es/Select/Option/props.js +11 -1
- package/es/Select/index.js +7 -10
- package/es/Select/props.js +45 -1
- package/lib/Select/Group/index.js +1 -0
- package/lib/Select/Group/props.js +9 -1
- package/lib/Select/Option/index.js +1 -0
- package/lib/Select/Option/props.js +12 -1
- package/lib/Select/index.js +6 -9
- package/lib/Select/props.js +45 -1
- package/package.json +24 -21
- package/src/Select/Group/index.tsx +2 -1
- package/src/Select/Group/props.ts +16 -2
- package/src/Select/Option/index.tsx +2 -1
- package/src/Select/Option/props.ts +19 -2
- package/src/Select/index.tsx +5 -6
- package/src/Select/props.ts +48 -1
- package/tsconfig.build.json +3 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Select/Group/index.d.ts +4 -0
- package/types/Select/Group/index.d.ts.map +1 -1
- package/types/Select/Group/props.d.ts +3 -2
- package/types/Select/Group/props.d.ts.map +1 -1
- package/types/Select/Option/index.d.ts +7 -0
- package/types/Select/Option/index.d.ts.map +1 -1
- package/types/Select/Option/props.d.ts +3 -2
- package/types/Select/Option/props.d.ts.map +1 -1
- package/types/Select/index.d.ts +33 -2
- package/types/Select/index.d.ts.map +1 -1
- package/types/Select/props.d.ts +3 -2
- package/types/Select/props.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,30 +3,17 @@
|
|
|
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.26.
|
|
6
|
+
## [10.26.2](https://github.com/instructure/instructure-ui/compare/v10.26.1...v10.26.2) (2025-10-13)
|
|
7
7
|
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-select
|
|
8
9
|
|
|
9
|
-
### Features
|
|
10
10
|
|
|
11
|
-
* **many:** instUI v11 release ([36f5438](https://github.com/instructure/instructure-ui/commit/36f54382669186227ba24798bbf7201ef2f5cd4c))
|
|
12
11
|
|
|
13
12
|
|
|
14
|
-
### BREAKING CHANGES
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- remove `CodeEditor` component
|
|
20
|
-
- remove `@instui/theme-registry` package
|
|
21
|
-
- remove `@testable`, `@experimental`, `@hack` decorators
|
|
22
|
-
- InstUISettingsProvider's `as` prop is removed
|
|
23
|
-
- `canvas.use()`, `canvasHighContrast.use()` functions are removed
|
|
24
|
-
- `canvasThemeLocal`, `canvasHighContrastThemeLocal` are removed
|
|
25
|
-
- `variables` field on theme objects are removed
|
|
26
|
-
- remove deprecated props from Table: Row's `isStacked`, Body's
|
|
27
|
-
`isStacked`, `hover`, and `headers`
|
|
28
|
-
- `Table`'s `caption` prop is now required
|
|
29
|
-
- `ui-dom-utils`'s `getComputedStyle` can now return `undefined`
|
|
14
|
+
## [10.26.1](https://github.com/instructure/instructure-ui/compare/v10.26.0...v10.26.1) (2025-10-06)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @instructure/ui-select
|
|
30
17
|
|
|
31
18
|
|
|
32
19
|
|
package/es/Select/Group/index.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import { Component } from 'react';
|
|
26
|
-
import { allowedProps } from './props';
|
|
26
|
+
import { allowedProps, propTypes } from './props';
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
---
|
|
@@ -43,6 +43,7 @@ class Group extends Component {
|
|
|
43
43
|
Group.displayName = "Group";
|
|
44
44
|
Group.componentId = 'Select.Group';
|
|
45
45
|
Group.allowedProps = allowedProps;
|
|
46
|
+
Group.propTypes = propTypes;
|
|
46
47
|
Group.defaultProps = {};
|
|
47
48
|
export default Group;
|
|
48
49
|
export { Group };
|
package/es/Select/Group/props.js
CHANGED
|
@@ -22,5 +22,12 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import PropTypes from 'prop-types';
|
|
26
|
+
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
|
|
27
|
+
import { Option } from '../Option';
|
|
28
|
+
const propTypes = {
|
|
29
|
+
renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
|
|
30
|
+
children: ChildrenPropTypes.oneOf([Option])
|
|
31
|
+
};
|
|
25
32
|
const allowedProps = ['renderLabel', 'children'];
|
|
26
|
-
export { allowedProps };
|
|
33
|
+
export { propTypes, allowedProps };
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import { Component } from 'react';
|
|
26
|
-
import { allowedProps } from './props';
|
|
26
|
+
import { allowedProps, propTypes } from './props';
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
---
|
|
@@ -43,6 +43,7 @@ class Option extends Component {
|
|
|
43
43
|
Option.displayName = "Option";
|
|
44
44
|
Option.componentId = 'Select.Option';
|
|
45
45
|
Option.allowedProps = allowedProps;
|
|
46
|
+
Option.propTypes = propTypes;
|
|
46
47
|
Option.defaultProps = {
|
|
47
48
|
isHighlighted: false,
|
|
48
49
|
isSelected: false,
|
|
@@ -22,5 +22,15 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import PropTypes from 'prop-types';
|
|
26
|
+
const propTypes = {
|
|
27
|
+
id: PropTypes.string.isRequired,
|
|
28
|
+
isHighlighted: PropTypes.bool,
|
|
29
|
+
isSelected: PropTypes.bool,
|
|
30
|
+
isDisabled: PropTypes.bool,
|
|
31
|
+
renderBeforeLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
32
|
+
renderAfterLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
33
|
+
children: PropTypes.node
|
|
34
|
+
};
|
|
25
35
|
const allowedProps = ['id', 'isHighlighted', 'isSelected', 'isDisabled', 'renderBeforeLabel', 'renderAfterLabel', 'children'];
|
|
26
|
-
export { allowedProps };
|
|
36
|
+
export { propTypes, allowedProps };
|
package/es/Select/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
2
2
|
const _excluded = ["id", "renderLabel", "children"],
|
|
3
3
|
_excluded2 = ["renderLabel", "inputValue", "placeholder", "isRequired", "shouldNotWrap", "size", "isInline", "width", "htmlSize", "messages", "renderBeforeInput", "renderAfterInput", "onFocus", "onBlur", "onInputChange", "onRequestHideOptions", "layout"],
|
|
4
4
|
_excluded3 = ["ref"];
|
|
5
|
-
var _dec, _dec2, _class, _Select, _Options$Separator, _Options$Separator2, _IconArrowOpenUpLine, _IconArrowOpenDownLin;
|
|
5
|
+
var _dec, _dec2, _dec3, _class, _Select, _Options$Separator, _Options$Separator2, _IconArrowOpenUpLine, _IconArrowOpenDownLin;
|
|
6
6
|
/*
|
|
7
7
|
* The MIT License (MIT)
|
|
8
8
|
*
|
|
@@ -29,7 +29,7 @@ var _dec, _dec2, _class, _Select, _Options$Separator, _Options$Separator2, _Icon
|
|
|
29
29
|
|
|
30
30
|
import { Children, Component, memo } from 'react';
|
|
31
31
|
import * as utils from '@instructure/ui-utils';
|
|
32
|
-
import {
|
|
32
|
+
import { testable } from '@instructure/ui-testable';
|
|
33
33
|
import { matchComponentTypes, omitProps, getInteraction, withDeterministicId } from '@instructure/ui-react-utils';
|
|
34
34
|
import { getBoundingClientRect, isActiveElement } from '@instructure/ui-dom-utils';
|
|
35
35
|
import { View } from '@instructure/ui-view';
|
|
@@ -43,7 +43,7 @@ import generateStyle from './styles';
|
|
|
43
43
|
import generateComponentTheme from './theme';
|
|
44
44
|
import { Group } from './Group';
|
|
45
45
|
import { Option } from './Option';
|
|
46
|
-
import { allowedProps } from './props';
|
|
46
|
+
import { allowedProps, propTypes } from './props';
|
|
47
47
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
48
48
|
// This memoed Option component is used to prevent unnecessary re-renders of
|
|
49
49
|
// Options.Item when the Select component is re-rendered. This is necessary
|
|
@@ -76,7 +76,7 @@ category: components
|
|
|
76
76
|
tags: autocomplete, typeahead, combobox, dropdown, search, form
|
|
77
77
|
---
|
|
78
78
|
**/
|
|
79
|
-
let Select = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec(_class = _dec2(_class = (_Select = class Select extends Component {
|
|
79
|
+
let Select = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_Select = class Select extends Component {
|
|
80
80
|
constructor(...args) {
|
|
81
81
|
super(...args);
|
|
82
82
|
this.SCROLL_TOLERANCE = 0.5;
|
|
@@ -630,10 +630,7 @@ let Select = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gen
|
|
|
630
630
|
...getRootProps({
|
|
631
631
|
css: styles === null || styles === void 0 ? void 0 : styles.select
|
|
632
632
|
}),
|
|
633
|
-
ref: el =>
|
|
634
|
-
this.ref = el;
|
|
635
|
-
},
|
|
636
|
-
"data-cid": combineDataCid('Select', this.props),
|
|
633
|
+
ref: el => this.ref = el,
|
|
637
634
|
children: [this.renderInput({
|
|
638
635
|
getInputProps,
|
|
639
636
|
getTriggerProps
|
|
@@ -663,7 +660,7 @@ let Select = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gen
|
|
|
663
660
|
})
|
|
664
661
|
});
|
|
665
662
|
}
|
|
666
|
-
}, _Select.displayName = "Select", _Select.componentId = 'Select', _Select.allowedProps = allowedProps, _Select.defaultProps = {
|
|
663
|
+
}, _Select.displayName = "Select", _Select.componentId = 'Select', _Select.allowedProps = allowedProps, _Select.propTypes = propTypes, _Select.defaultProps = {
|
|
667
664
|
inputValue: '',
|
|
668
665
|
isShowingOptions: false,
|
|
669
666
|
size: 'medium',
|
|
@@ -677,6 +674,6 @@ let Select = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gen
|
|
|
677
674
|
shouldNotWrap: false,
|
|
678
675
|
scrollToHighlightedOption: true,
|
|
679
676
|
isOptionContentAppliedToInput: false
|
|
680
|
-
}, _Select.Option = Option, _Select.Group = Group, _Select)) || _class) || _class);
|
|
677
|
+
}, _Select.Option = Option, _Select.Group = Group, _Select)) || _class) || _class) || _class);
|
|
681
678
|
export default Select;
|
|
682
679
|
export { Select };
|
package/es/Select/props.js
CHANGED
|
@@ -22,6 +22,13 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import PropTypes from 'prop-types';
|
|
26
|
+
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
|
|
27
|
+
import { FormPropTypes } from '@instructure/ui-form-field';
|
|
28
|
+
import { PositionPropTypes } from '@instructure/ui-position';
|
|
29
|
+
import { Group } from './Group';
|
|
30
|
+
import { Option } from './Option';
|
|
31
|
+
|
|
25
32
|
// These props are directly passed to Selectable
|
|
26
33
|
// TODO: import these from Selectable once TS types can be imported
|
|
27
34
|
|
|
@@ -31,5 +38,42 @@
|
|
|
31
38
|
// These props are directly passed to Popover
|
|
32
39
|
// TODO: import these from Popover once TS types can be imported
|
|
33
40
|
|
|
41
|
+
const propTypes = {
|
|
42
|
+
renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
|
|
43
|
+
inputValue: PropTypes.string,
|
|
44
|
+
id: PropTypes.string,
|
|
45
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
46
|
+
assistiveText: PropTypes.string,
|
|
47
|
+
placeholder: PropTypes.string,
|
|
48
|
+
interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
|
|
49
|
+
isRequired: PropTypes.bool,
|
|
50
|
+
isInline: PropTypes.bool,
|
|
51
|
+
width: PropTypes.string,
|
|
52
|
+
htmlSize: PropTypes.number,
|
|
53
|
+
visibleOptionsCount: PropTypes.number,
|
|
54
|
+
isOptionContentAppliedToInput: PropTypes.bool,
|
|
55
|
+
optionsMaxHeight: PropTypes.string,
|
|
56
|
+
optionsMaxWidth: PropTypes.string,
|
|
57
|
+
messages: PropTypes.arrayOf(FormPropTypes.message),
|
|
58
|
+
placement: PositionPropTypes.placement,
|
|
59
|
+
constrain: PositionPropTypes.constrain,
|
|
60
|
+
mountNode: PositionPropTypes.mountNode,
|
|
61
|
+
onFocus: PropTypes.func,
|
|
62
|
+
onBlur: PropTypes.func,
|
|
63
|
+
onInputChange: PropTypes.func,
|
|
64
|
+
isShowingOptions: PropTypes.bool,
|
|
65
|
+
onRequestShowOptions: PropTypes.func,
|
|
66
|
+
onRequestHideOptions: PropTypes.func,
|
|
67
|
+
onRequestHighlightOption: PropTypes.func,
|
|
68
|
+
onRequestSelectOption: PropTypes.func,
|
|
69
|
+
inputRef: PropTypes.func,
|
|
70
|
+
listRef: PropTypes.func,
|
|
71
|
+
renderBeforeInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
72
|
+
renderAfterInput: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
73
|
+
children: ChildrenPropTypes.oneOf([Group, Option]),
|
|
74
|
+
shouldNotWrap: PropTypes.bool,
|
|
75
|
+
scrollToHighlightedOption: PropTypes.bool,
|
|
76
|
+
layout: PropTypes.oneOf(['stacked', 'inline'])
|
|
77
|
+
};
|
|
34
78
|
const allowedProps = ['renderLabel', 'inputValue', 'isShowingOptions', 'id', 'size', 'assistiveText', 'placeholder', 'interaction', 'isRequired', 'isInline', 'width', 'htmlSize', 'visibleOptionsCount', 'isOptionContentAppliedToInput', 'optionsMaxHeight', 'optionsMaxWidth', 'messages', 'placement', 'constrain', 'mountNode', 'onFocus', 'onBlur', 'onInputChange', 'onRequestShowOptions', 'onRequestHideOptions', 'onRequestHighlightOption', 'onRequestSelectOption', 'inputRef', 'listRef', 'renderBeforeInput', 'renderAfterInput', 'children', 'shouldNotWrap', 'scrollToHighlightedOption', 'layout'];
|
|
35
|
-
export { allowedProps };
|
|
79
|
+
export { propTypes, allowedProps };
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.allowedProps = void 0;
|
|
7
|
+
exports.propTypes = exports.allowedProps = void 0;
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
|
10
|
+
var _Option = require("../Option");
|
|
7
11
|
/*
|
|
8
12
|
* The MIT License (MIT)
|
|
9
13
|
*
|
|
@@ -28,4 +32,8 @@ exports.allowedProps = void 0;
|
|
|
28
32
|
* SOFTWARE.
|
|
29
33
|
*/
|
|
30
34
|
|
|
35
|
+
const propTypes = exports.propTypes = {
|
|
36
|
+
renderLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
|
|
37
|
+
children: _Children.Children.oneOf([_Option.Option])
|
|
38
|
+
};
|
|
31
39
|
const allowedProps = exports.allowedProps = ['renderLabel', 'children'];
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.allowedProps = void 0;
|
|
7
|
+
exports.propTypes = exports.allowedProps = void 0;
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
7
9
|
/*
|
|
8
10
|
* The MIT License (MIT)
|
|
9
11
|
*
|
|
@@ -28,4 +30,13 @@ exports.allowedProps = void 0;
|
|
|
28
30
|
* SOFTWARE.
|
|
29
31
|
*/
|
|
30
32
|
|
|
33
|
+
const propTypes = exports.propTypes = {
|
|
34
|
+
id: _propTypes.default.string.isRequired,
|
|
35
|
+
isHighlighted: _propTypes.default.bool,
|
|
36
|
+
isSelected: _propTypes.default.bool,
|
|
37
|
+
isDisabled: _propTypes.default.bool,
|
|
38
|
+
renderBeforeLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
39
|
+
renderAfterLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
40
|
+
children: _propTypes.default.node
|
|
41
|
+
};
|
|
31
42
|
const allowedProps = exports.allowedProps = ['id', 'isHighlighted', 'isSelected', 'isDisabled', 'renderBeforeLabel', 'renderAfterLabel', 'children'];
|
package/lib/Select/index.js
CHANGED
|
@@ -9,7 +9,7 @@ exports.default = exports.Select = void 0;
|
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var utils = _interopRequireWildcard(require("@instructure/ui-utils"));
|
|
12
|
-
var
|
|
12
|
+
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
13
13
|
var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
|
|
14
14
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
15
15
|
var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
|
|
@@ -33,7 +33,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
|
33
33
|
const _excluded = ["id", "renderLabel", "children"],
|
|
34
34
|
_excluded2 = ["renderLabel", "inputValue", "placeholder", "isRequired", "shouldNotWrap", "size", "isInline", "width", "htmlSize", "messages", "renderBeforeInput", "renderAfterInput", "onFocus", "onBlur", "onInputChange", "onRequestHideOptions", "layout"],
|
|
35
35
|
_excluded3 = ["ref"];
|
|
36
|
-
var _dec, _dec2, _class, _Select, _Options$Separator, _Options$Separator2, _IconArrowOpenUpLine, _IconArrowOpenDownLin;
|
|
36
|
+
var _dec, _dec2, _dec3, _class, _Select, _Options$Separator, _Options$Separator2, _IconArrowOpenUpLine, _IconArrowOpenDownLin;
|
|
37
37
|
/*
|
|
38
38
|
* The MIT License (MIT)
|
|
39
39
|
*
|
|
@@ -88,7 +88,7 @@ category: components
|
|
|
88
88
|
tags: autocomplete, typeahead, combobox, dropdown, search, form
|
|
89
89
|
---
|
|
90
90
|
**/
|
|
91
|
-
let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_Select = class Select extends _react.Component {
|
|
91
|
+
let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_Select = class Select extends _react.Component {
|
|
92
92
|
constructor(...args) {
|
|
93
93
|
super(...args);
|
|
94
94
|
this.SCROLL_TOLERANCE = 0.5;
|
|
@@ -642,10 +642,7 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
|
|
|
642
642
|
...getRootProps({
|
|
643
643
|
css: styles === null || styles === void 0 ? void 0 : styles.select
|
|
644
644
|
}),
|
|
645
|
-
ref: el =>
|
|
646
|
-
this.ref = el;
|
|
647
|
-
},
|
|
648
|
-
"data-cid": (0, _combineDataCid.combineDataCid)('Select', this.props),
|
|
645
|
+
ref: el => this.ref = el,
|
|
649
646
|
children: [this.renderInput({
|
|
650
647
|
getInputProps,
|
|
651
648
|
getTriggerProps
|
|
@@ -675,7 +672,7 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
|
|
|
675
672
|
})
|
|
676
673
|
});
|
|
677
674
|
}
|
|
678
|
-
}, _Select.displayName = "Select", _Select.componentId = 'Select', _Select.allowedProps = _props.allowedProps, _Select.defaultProps = {
|
|
675
|
+
}, _Select.displayName = "Select", _Select.componentId = 'Select', _Select.allowedProps = _props.allowedProps, _Select.propTypes = _props.propTypes, _Select.defaultProps = {
|
|
679
676
|
inputValue: '',
|
|
680
677
|
isShowingOptions: false,
|
|
681
678
|
size: 'medium',
|
|
@@ -689,5 +686,5 @@ let Select = exports.Select = (_dec = (0, _withDeterministicId.withDeterministic
|
|
|
689
686
|
shouldNotWrap: false,
|
|
690
687
|
scrollToHighlightedOption: true,
|
|
691
688
|
isOptionContentAppliedToInput: false
|
|
692
|
-
}, _Select.Option = _Option.Option, _Select.Group = _Group.Group, _Select)) || _class) || _class);
|
|
689
|
+
}, _Select.Option = _Option.Option, _Select.Group = _Group.Group, _Select)) || _class) || _class) || _class);
|
|
693
690
|
var _default = exports.default = Select;
|
package/lib/Select/props.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.allowedProps = void 0;
|
|
7
|
+
exports.propTypes = exports.allowedProps = void 0;
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
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
|
+
var _Group = require("./Group");
|
|
13
|
+
var _Option = require("./Option");
|
|
7
14
|
/*
|
|
8
15
|
* The MIT License (MIT)
|
|
9
16
|
*
|
|
@@ -37,4 +44,41 @@ exports.allowedProps = void 0;
|
|
|
37
44
|
// These props are directly passed to Popover
|
|
38
45
|
// TODO: import these from Popover once TS types can be imported
|
|
39
46
|
|
|
47
|
+
const propTypes = exports.propTypes = {
|
|
48
|
+
renderLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]).isRequired,
|
|
49
|
+
inputValue: _propTypes.default.string,
|
|
50
|
+
id: _propTypes.default.string,
|
|
51
|
+
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
|
52
|
+
assistiveText: _propTypes.default.string,
|
|
53
|
+
placeholder: _propTypes.default.string,
|
|
54
|
+
interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
|
|
55
|
+
isRequired: _propTypes.default.bool,
|
|
56
|
+
isInline: _propTypes.default.bool,
|
|
57
|
+
width: _propTypes.default.string,
|
|
58
|
+
htmlSize: _propTypes.default.number,
|
|
59
|
+
visibleOptionsCount: _propTypes.default.number,
|
|
60
|
+
isOptionContentAppliedToInput: _propTypes.default.bool,
|
|
61
|
+
optionsMaxHeight: _propTypes.default.string,
|
|
62
|
+
optionsMaxWidth: _propTypes.default.string,
|
|
63
|
+
messages: _propTypes.default.arrayOf(_FormPropTypes.FormPropTypes.message),
|
|
64
|
+
placement: _PositionPropTypes.PositionPropTypes.placement,
|
|
65
|
+
constrain: _PositionPropTypes.PositionPropTypes.constrain,
|
|
66
|
+
mountNode: _PositionPropTypes.PositionPropTypes.mountNode,
|
|
67
|
+
onFocus: _propTypes.default.func,
|
|
68
|
+
onBlur: _propTypes.default.func,
|
|
69
|
+
onInputChange: _propTypes.default.func,
|
|
70
|
+
isShowingOptions: _propTypes.default.bool,
|
|
71
|
+
onRequestShowOptions: _propTypes.default.func,
|
|
72
|
+
onRequestHideOptions: _propTypes.default.func,
|
|
73
|
+
onRequestHighlightOption: _propTypes.default.func,
|
|
74
|
+
onRequestSelectOption: _propTypes.default.func,
|
|
75
|
+
inputRef: _propTypes.default.func,
|
|
76
|
+
listRef: _propTypes.default.func,
|
|
77
|
+
renderBeforeInput: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
78
|
+
renderAfterInput: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
79
|
+
children: _Children.Children.oneOf([_Group.Group, _Option.Option]),
|
|
80
|
+
shouldNotWrap: _propTypes.default.bool,
|
|
81
|
+
scrollToHighlightedOption: _propTypes.default.bool,
|
|
82
|
+
layout: _propTypes.default.oneOf(['stacked', 'inline'])
|
|
83
|
+
};
|
|
40
84
|
const allowedProps = exports.allowedProps = ['renderLabel', 'inputValue', 'isShowingOptions', 'id', 'size', 'assistiveText', 'placeholder', 'interaction', 'isRequired', 'isInline', 'width', 'htmlSize', 'visibleOptionsCount', 'isOptionContentAppliedToInput', 'optionsMaxHeight', 'optionsMaxWidth', 'messages', 'placement', 'constrain', 'mountNode', 'onFocus', 'onBlur', 'onInputChange', 'onRequestShowOptions', 'onRequestHideOptions', 'onRequestHighlightOption', 'onRequestSelectOption', 'inputRef', 'listRef', 'renderBeforeInput', 'renderAfterInput', 'children', 'shouldNotWrap', 'scrollToHighlightedOption', 'layout'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-select",
|
|
3
|
-
"version": "10.26.
|
|
3
|
+
"version": "10.26.2",
|
|
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,34 +23,37 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "10.26.
|
|
27
|
-
"@instructure/ui-color-utils": "10.26.
|
|
28
|
-
"@instructure/ui-scripts": "10.26.
|
|
29
|
-
"@instructure/ui-themes": "10.26.
|
|
26
|
+
"@instructure/ui-babel-preset": "10.26.2",
|
|
27
|
+
"@instructure/ui-color-utils": "10.26.2",
|
|
28
|
+
"@instructure/ui-scripts": "10.26.2",
|
|
29
|
+
"@instructure/ui-themes": "10.26.2",
|
|
30
30
|
"@testing-library/jest-dom": "^6.6.3",
|
|
31
|
-
"@testing-library/react": "
|
|
31
|
+
"@testing-library/react": "^16.0.1",
|
|
32
32
|
"@testing-library/user-event": "^14.6.1",
|
|
33
33
|
"vitest": "^3.2.2"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@babel/runtime": "^7.27.6",
|
|
37
|
-
"@instructure/emotion": "10.26.
|
|
38
|
-
"@instructure/shared-types": "10.26.
|
|
39
|
-
"@instructure/ui-dom-utils": "10.26.
|
|
40
|
-
"@instructure/ui-form-field": "10.26.
|
|
41
|
-
"@instructure/ui-icons": "10.26.
|
|
42
|
-
"@instructure/ui-options": "10.26.
|
|
43
|
-
"@instructure/ui-popover": "10.26.
|
|
44
|
-
"@instructure/ui-position": "10.26.
|
|
45
|
-
"@instructure/ui-
|
|
46
|
-
"@instructure/ui-
|
|
47
|
-
"@instructure/ui-
|
|
48
|
-
"@instructure/ui-
|
|
49
|
-
"@instructure/ui-
|
|
50
|
-
"@instructure/
|
|
37
|
+
"@instructure/emotion": "10.26.2",
|
|
38
|
+
"@instructure/shared-types": "10.26.2",
|
|
39
|
+
"@instructure/ui-dom-utils": "10.26.2",
|
|
40
|
+
"@instructure/ui-form-field": "10.26.2",
|
|
41
|
+
"@instructure/ui-icons": "10.26.2",
|
|
42
|
+
"@instructure/ui-options": "10.26.2",
|
|
43
|
+
"@instructure/ui-popover": "10.26.2",
|
|
44
|
+
"@instructure/ui-position": "10.26.2",
|
|
45
|
+
"@instructure/ui-prop-types": "10.26.2",
|
|
46
|
+
"@instructure/ui-react-utils": "10.26.2",
|
|
47
|
+
"@instructure/ui-selectable": "10.26.2",
|
|
48
|
+
"@instructure/ui-testable": "10.26.2",
|
|
49
|
+
"@instructure/ui-text-input": "10.26.2",
|
|
50
|
+
"@instructure/ui-utils": "10.26.2",
|
|
51
|
+
"@instructure/ui-view": "10.26.2",
|
|
52
|
+
"@instructure/uid": "10.26.2",
|
|
53
|
+
"prop-types": "^15.8.1"
|
|
51
54
|
},
|
|
52
55
|
"peerDependencies": {
|
|
53
|
-
"react": ">=
|
|
56
|
+
"react": ">=16.14 <=18"
|
|
54
57
|
},
|
|
55
58
|
"publishConfig": {
|
|
56
59
|
"access": "public"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
import { Component } from 'react'
|
|
26
26
|
import type { SelectGroupProps } from './props'
|
|
27
|
-
import { allowedProps } from './props'
|
|
27
|
+
import { allowedProps, propTypes } from './props'
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
---
|
|
@@ -37,6 +37,7 @@ class Group extends Component<SelectGroupProps> {
|
|
|
37
37
|
static readonly componentId = 'Select.Group'
|
|
38
38
|
|
|
39
39
|
static allowedProps = allowedProps
|
|
40
|
+
static propTypes = propTypes
|
|
40
41
|
|
|
41
42
|
static defaultProps = {}
|
|
42
43
|
|
|
@@ -22,8 +22,16 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
import React from 'react'
|
|
25
|
+
import PropTypes from 'prop-types'
|
|
25
26
|
|
|
26
|
-
import
|
|
27
|
+
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types'
|
|
28
|
+
import { Option } from '../Option'
|
|
29
|
+
|
|
30
|
+
import type {
|
|
31
|
+
OtherHTMLAttributes,
|
|
32
|
+
PropValidators,
|
|
33
|
+
Renderable
|
|
34
|
+
} from '@instructure/shared-types'
|
|
27
35
|
|
|
28
36
|
type SelectGroupOwnProps = {
|
|
29
37
|
/**
|
|
@@ -42,7 +50,13 @@ type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
|
42
50
|
|
|
43
51
|
type SelectGroupProps = SelectGroupOwnProps &
|
|
44
52
|
OtherHTMLAttributes<SelectGroupOwnProps>
|
|
53
|
+
|
|
54
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
55
|
+
renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
|
|
56
|
+
children: ChildrenPropTypes.oneOf([Option])
|
|
57
|
+
}
|
|
58
|
+
|
|
45
59
|
const allowedProps: AllowedPropKeys = ['renderLabel', 'children']
|
|
46
60
|
|
|
47
61
|
export type { SelectGroupProps }
|
|
48
|
-
export { allowedProps }
|
|
62
|
+
export { propTypes, allowedProps }
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
import { Component } from 'react'
|
|
26
26
|
import type { SelectOptionProps } from './props'
|
|
27
|
-
import { allowedProps } from './props'
|
|
27
|
+
import { allowedProps, propTypes } from './props'
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
---
|
|
@@ -37,6 +37,7 @@ class Option extends Component<SelectOptionProps> {
|
|
|
37
37
|
static readonly componentId = 'Select.Option'
|
|
38
38
|
|
|
39
39
|
static allowedProps = allowedProps
|
|
40
|
+
static propTypes = propTypes
|
|
40
41
|
|
|
41
42
|
static defaultProps = {
|
|
42
43
|
isHighlighted: false,
|
|
@@ -23,7 +23,13 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
-
import
|
|
26
|
+
import PropTypes from 'prop-types'
|
|
27
|
+
|
|
28
|
+
import type {
|
|
29
|
+
OtherHTMLAttributes,
|
|
30
|
+
PropValidators,
|
|
31
|
+
Renderable
|
|
32
|
+
} from '@instructure/shared-types'
|
|
27
33
|
|
|
28
34
|
type OptionProps = {
|
|
29
35
|
/**
|
|
@@ -68,6 +74,17 @@ type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
|
68
74
|
|
|
69
75
|
type SelectOptionProps = SelectOptionOwnProps &
|
|
70
76
|
OtherHTMLAttributes<SelectOptionOwnProps>
|
|
77
|
+
|
|
78
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
79
|
+
id: PropTypes.string.isRequired,
|
|
80
|
+
isHighlighted: PropTypes.bool,
|
|
81
|
+
isSelected: PropTypes.bool,
|
|
82
|
+
isDisabled: PropTypes.bool,
|
|
83
|
+
renderBeforeLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
84
|
+
renderAfterLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
85
|
+
children: PropTypes.node
|
|
86
|
+
}
|
|
87
|
+
|
|
71
88
|
const allowedProps: AllowedPropKeys = [
|
|
72
89
|
'id',
|
|
73
90
|
'isHighlighted',
|
|
@@ -79,4 +96,4 @@ const allowedProps: AllowedPropKeys = [
|
|
|
79
96
|
]
|
|
80
97
|
|
|
81
98
|
export type { SelectOptionProps, RenderSelectOptionLabel }
|
|
82
|
-
export { allowedProps }
|
|
99
|
+
export { propTypes, allowedProps }
|
package/src/Select/index.tsx
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
import { ComponentElement, Children, Component, memo, ReactNode } from 'react'
|
|
26
26
|
|
|
27
27
|
import * as utils from '@instructure/ui-utils'
|
|
28
|
-
import {
|
|
28
|
+
import { testable } from '@instructure/ui-testable'
|
|
29
29
|
import {
|
|
30
30
|
matchComponentTypes,
|
|
31
31
|
omitProps,
|
|
@@ -70,7 +70,7 @@ import { Option } from './Option'
|
|
|
70
70
|
import type { SelectOptionProps, RenderSelectOptionLabel } from './Option/props'
|
|
71
71
|
|
|
72
72
|
import type { SelectProps } from './props'
|
|
73
|
-
import { allowedProps } from './props'
|
|
73
|
+
import { allowedProps, propTypes } from './props'
|
|
74
74
|
import { Renderable } from '@instructure/shared-types'
|
|
75
75
|
|
|
76
76
|
type GroupChild = ComponentElement<SelectGroupProps, Group>
|
|
@@ -130,11 +130,13 @@ tags: autocomplete, typeahead, combobox, dropdown, search, form
|
|
|
130
130
|
**/
|
|
131
131
|
@withDeterministicId()
|
|
132
132
|
@withStyle(generateStyle, generateComponentTheme)
|
|
133
|
+
@testable()
|
|
133
134
|
class Select extends Component<SelectProps> {
|
|
134
135
|
static readonly componentId = 'Select'
|
|
135
136
|
private readonly SCROLL_TOLERANCE = 0.5
|
|
136
137
|
|
|
137
138
|
static allowedProps = allowedProps
|
|
139
|
+
static propTypes = propTypes
|
|
138
140
|
|
|
139
141
|
static defaultProps = {
|
|
140
142
|
inputValue: '',
|
|
@@ -821,10 +823,7 @@ class Select extends Component<SelectProps> {
|
|
|
821
823
|
}) => (
|
|
822
824
|
<span
|
|
823
825
|
{...getRootProps({ css: styles?.select })}
|
|
824
|
-
ref={(el) =>
|
|
825
|
-
this.ref = el
|
|
826
|
-
}}
|
|
827
|
-
data-cid={combineDataCid('Select', this.props)}
|
|
826
|
+
ref={(el) => (this.ref = el)}
|
|
828
827
|
>
|
|
829
828
|
{this.renderInput({ getInputProps, getTriggerProps })}
|
|
830
829
|
<span {...getDescriptionProps()} css={styles?.assistiveText}>
|