@instructure/ui-options 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/Options/Item/index.js +6 -6
- package/es/Options/Item/props.js +18 -1
- package/es/Options/Separator/index.js +2 -2
- package/es/Options/Separator/props.js +5 -2
- package/es/Options/index.js +6 -6
- package/es/Options/props.js +10 -1
- package/lib/Options/Item/index.js +5 -5
- package/lib/Options/Item/props.js +19 -1
- package/lib/Options/Separator/index.js +1 -1
- package/lib/Options/Separator/props.js +6 -1
- package/lib/Options/index.js +5 -5
- package/lib/Options/props.js +11 -1
- package/package.json +16 -13
- package/src/Options/Item/index.tsx +4 -2
- package/src/Options/Item/props.ts +29 -1
- package/src/Options/Separator/index.tsx +2 -1
- package/src/Options/Separator/props.ts +8 -1
- package/src/Options/index.tsx +5 -7
- package/src/Options/props.ts +15 -1
- package/tsconfig.build.json +2 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Options/Item/index.d.ts +1 -0
- package/types/Options/Item/index.d.ts.map +1 -1
- package/types/Options/Item/props.d.ts +3 -2
- package/types/Options/Item/props.d.ts.map +1 -1
- package/types/Options/Separator/index.d.ts +1 -0
- package/types/Options/Separator/index.d.ts.map +1 -1
- package/types/Options/Separator/props.d.ts +3 -2
- package/types/Options/Separator/props.d.ts.map +1 -1
- package/types/Options/index.d.ts +7 -0
- package/types/Options/index.d.ts.map +1 -1
- package/types/Options/props.d.ts +3 -2
- package/types/Options/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-options
|
|
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-options
|
|
30
17
|
|
|
31
18
|
|
|
32
19
|
|
package/es/Options/Item/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2, _class, _Item;
|
|
1
|
+
var _dec, _dec2, _dec3, _class, _Item;
|
|
2
2
|
/*
|
|
3
3
|
* The MIT License (MIT)
|
|
4
4
|
*
|
|
@@ -25,10 +25,11 @@ var _dec, _dec2, _class, _Item;
|
|
|
25
25
|
|
|
26
26
|
import { Component } from 'react';
|
|
27
27
|
import { omitProps, getElementType, callRenderProp, withDeterministicId } from '@instructure/ui-react-utils';
|
|
28
|
+
import { testable } from '@instructure/ui-testable';
|
|
28
29
|
import { withStyle } from '@instructure/emotion';
|
|
29
30
|
import generateStyles from './styles';
|
|
30
31
|
import generateComponentTheme from './theme';
|
|
31
|
-
import { allowedProps } from './props';
|
|
32
|
+
import { allowedProps, propTypes } from './props';
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
35
|
---
|
|
@@ -37,7 +38,7 @@ id: Options.Item
|
|
|
37
38
|
---
|
|
38
39
|
**/
|
|
39
40
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
40
|
-
let Item = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, generateComponentTheme), _dec(_class = _dec2(_class = (_Item = class Item extends Component {
|
|
41
|
+
let Item = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, generateComponentTheme), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_Item = class Item extends Component {
|
|
41
42
|
constructor(props) {
|
|
42
43
|
super(props);
|
|
43
44
|
this.ref = null;
|
|
@@ -92,7 +93,6 @@ let Item = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, gene
|
|
|
92
93
|
const ariaDescribedBy = this.props['aria-describedby'] || (descriptionContent ? this._descriptionId : void 0);
|
|
93
94
|
return _jsxs(ElementType, {
|
|
94
95
|
role: voiceoverRoleBugWorkaround ? role : 'none',
|
|
95
|
-
"data-cid": "Options.Item",
|
|
96
96
|
css: styles === null || styles === void 0 ? void 0 : styles.item,
|
|
97
97
|
ref: element => {
|
|
98
98
|
this.ref = element;
|
|
@@ -116,7 +116,7 @@ let Item = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, gene
|
|
|
116
116
|
}), renderBeforeLabel && this.renderContent(renderBeforeLabel, styles === null || styles === void 0 ? void 0 : styles.contentBefore), renderAfterLabel && this.renderContent(renderAfterLabel, styles === null || styles === void 0 ? void 0 : styles.contentAfter)]
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
}, _Item.displayName = "Item", _Item.componentId = 'Options.Item', _Item.allowedProps = allowedProps, _Item.defaultProps = {
|
|
119
|
+
}, _Item.displayName = "Item", _Item.componentId = 'Options.Item', _Item.allowedProps = allowedProps, _Item.propTypes = propTypes, _Item.defaultProps = {
|
|
120
120
|
as: 'span',
|
|
121
121
|
variant: 'default',
|
|
122
122
|
role: 'listitem',
|
|
@@ -124,6 +124,6 @@ let Item = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, gene
|
|
|
124
124
|
beforeLabelContentVAlign: 'center',
|
|
125
125
|
afterLabelContentVAlign: 'center',
|
|
126
126
|
isSelected: false
|
|
127
|
-
}, _Item)) || _class) || _class);
|
|
127
|
+
}, _Item)) || _class) || _class) || _class);
|
|
128
128
|
export default Item;
|
|
129
129
|
export { Item };
|
package/es/Options/Item/props.js
CHANGED
|
@@ -22,5 +22,22 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import PropTypes from 'prop-types';
|
|
26
|
+
const propTypes = {
|
|
27
|
+
as: PropTypes.elementType,
|
|
28
|
+
variant: PropTypes.oneOf(['default', 'highlighted', 'selected', 'disabled', 'highlighted-disabled', 'selected-highlighted']),
|
|
29
|
+
role: PropTypes.string,
|
|
30
|
+
renderBeforeLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
31
|
+
renderAfterLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
32
|
+
beforeLabelContentVAlign: PropTypes.oneOf(['start', 'center', 'end']),
|
|
33
|
+
afterLabelContentVAlign: PropTypes.oneOf(['start', 'center', 'end']),
|
|
34
|
+
description: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
35
|
+
descriptionRole: PropTypes.string,
|
|
36
|
+
href: PropTypes.string,
|
|
37
|
+
voiceoverRoleBugWorkaround: PropTypes.bool,
|
|
38
|
+
elementRef: PropTypes.func,
|
|
39
|
+
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
40
|
+
isSelected: PropTypes.bool
|
|
41
|
+
};
|
|
25
42
|
const allowedProps = ['as', 'variant', 'role', 'renderBeforeLabel', 'renderAfterLabel', 'beforeLabelContentVAlign', 'afterLabelContentVAlign', 'description', 'descriptionRole', 'voiceoverRoleBugWorkaround', 'href', 'elementRef', 'children', 'isSelected'];
|
|
26
|
-
export { allowedProps };
|
|
43
|
+
export { propTypes, allowedProps };
|
|
@@ -30,7 +30,7 @@ import { getElementType, omitProps } from '@instructure/ui-react-utils';
|
|
|
30
30
|
import { withStyle } from '@instructure/emotion';
|
|
31
31
|
import generateStyles from './styles';
|
|
32
32
|
import generateComponentTheme from './theme';
|
|
33
|
-
import { allowedProps } from './props';
|
|
33
|
+
import { allowedProps, propTypes } from './props';
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
---
|
|
@@ -64,7 +64,7 @@ let Separator = (_dec = withStyle(generateStyles, generateComponentTheme), _dec(
|
|
|
64
64
|
})
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
}, _Separator.displayName = "Separator", _Separator.componentId = 'Options.Separator', _Separator.allowedProps = allowedProps, _Separator.defaultProps = {
|
|
67
|
+
}, _Separator.displayName = "Separator", _Separator.componentId = 'Options.Separator', _Separator.allowedProps = allowedProps, _Separator.propTypes = propTypes, _Separator.defaultProps = {
|
|
68
68
|
as: 'span'
|
|
69
69
|
}, _Separator)) || _class);
|
|
70
70
|
export default Separator;
|
|
@@ -21,6 +21,9 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
import PropTypes from 'prop-types';
|
|
25
|
+
const propTypes = {
|
|
26
|
+
as: PropTypes.elementType
|
|
27
|
+
};
|
|
25
28
|
const allowedProps = ['as'];
|
|
26
|
-
export { allowedProps };
|
|
29
|
+
export { propTypes, allowedProps };
|
package/es/Options/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2, _class, _Options;
|
|
1
|
+
var _dec, _dec2, _dec3, _class, _Options;
|
|
2
2
|
/*
|
|
3
3
|
* The MIT License (MIT)
|
|
4
4
|
*
|
|
@@ -25,13 +25,14 @@ var _dec, _dec2, _class, _Options;
|
|
|
25
25
|
|
|
26
26
|
import { Component, Children } from 'react';
|
|
27
27
|
import { omitProps, matchComponentTypes, callRenderProp, safeCloneElement, withDeterministicId } from '@instructure/ui-react-utils';
|
|
28
|
+
import { testable } from '@instructure/ui-testable';
|
|
28
29
|
import { View } from '@instructure/ui-view';
|
|
29
30
|
import { withStyle } from '@instructure/emotion';
|
|
30
31
|
import generateStyles from './styles';
|
|
31
32
|
import generateComponentTheme from './theme';
|
|
32
33
|
import { Item } from './Item';
|
|
33
34
|
import { Separator } from './Separator';
|
|
34
|
-
import { allowedProps } from './props';
|
|
35
|
+
import { allowedProps, propTypes } from './props';
|
|
35
36
|
import { isAndroidOrIOS } from '@instructure/ui-utils';
|
|
36
37
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
37
38
|
/**
|
|
@@ -39,7 +40,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
39
40
|
category: components
|
|
40
41
|
---
|
|
41
42
|
**/
|
|
42
|
-
let Options = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, generateComponentTheme), _dec(_class = _dec2(_class = (_Options = class Options extends Component {
|
|
43
|
+
let Options = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, generateComponentTheme), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_Options = class Options extends Component {
|
|
43
44
|
constructor(...args) {
|
|
44
45
|
super(...args);
|
|
45
46
|
this.ref = null;
|
|
@@ -121,7 +122,6 @@ let Options = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, g
|
|
|
121
122
|
css: styles === null || styles === void 0 ? void 0 : styles.options,
|
|
122
123
|
role: "presentation",
|
|
123
124
|
ref: this.handleRef,
|
|
124
|
-
"data-cid": "Options",
|
|
125
125
|
children: [renderLabel && this.renderLabel(), _jsx(View, {
|
|
126
126
|
...passthroughProps,
|
|
127
127
|
elementRef: elementRef,
|
|
@@ -137,12 +137,12 @@ let Options = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, g
|
|
|
137
137
|
})]
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
|
-
}, _Options.displayName = "Options", _Options.componentId = 'Options', _Options.allowedProps = allowedProps, _Options.defaultProps = {
|
|
140
|
+
}, _Options.displayName = "Options", _Options.componentId = 'Options', _Options.allowedProps = allowedProps, _Options.propTypes = propTypes, _Options.defaultProps = {
|
|
141
141
|
as: 'span',
|
|
142
142
|
role: 'list',
|
|
143
143
|
elementRef: () => {},
|
|
144
144
|
renderLabel: null,
|
|
145
145
|
children: null
|
|
146
|
-
}, _Options.Item = Item, _Options.Separator = Separator, _Options)) || _class) || _class);
|
|
146
|
+
}, _Options.Item = Item, _Options.Separator = Separator, _Options)) || _class) || _class) || _class);
|
|
147
147
|
export default Options;
|
|
148
148
|
export { Options };
|
package/es/Options/props.js
CHANGED
|
@@ -22,5 +22,14 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import PropTypes from 'prop-types';
|
|
26
|
+
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
|
|
27
|
+
const propTypes = {
|
|
28
|
+
as: PropTypes.elementType,
|
|
29
|
+
role: PropTypes.string,
|
|
30
|
+
elementRef: PropTypes.func,
|
|
31
|
+
renderLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
32
|
+
children: ChildrenPropTypes.oneOf(['Options', 'Item', 'Separator'])
|
|
33
|
+
};
|
|
25
34
|
const allowedProps = ['as', 'role', 'elementRef', 'renderLabel', 'children'];
|
|
26
|
-
export { allowedProps };
|
|
35
|
+
export { propTypes, allowedProps };
|
|
@@ -7,12 +7,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.Item = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
10
|
+
var _uiTestable = require("@instructure/ui-testable");
|
|
10
11
|
var _emotion = require("@instructure/emotion");
|
|
11
12
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
12
13
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
13
14
|
var _props = require("./props");
|
|
14
15
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
15
|
-
var _dec, _dec2, _class, _Item;
|
|
16
|
+
var _dec, _dec2, _dec3, _class, _Item;
|
|
16
17
|
/*
|
|
17
18
|
* The MIT License (MIT)
|
|
18
19
|
*
|
|
@@ -42,7 +43,7 @@ parent: Options
|
|
|
42
43
|
id: Options.Item
|
|
43
44
|
---
|
|
44
45
|
**/
|
|
45
|
-
let Item = exports.Item = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_Item = class Item extends _react.Component {
|
|
46
|
+
let Item = exports.Item = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _uiTestable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_Item = class Item extends _react.Component {
|
|
46
47
|
constructor(props) {
|
|
47
48
|
super(props);
|
|
48
49
|
this.ref = null;
|
|
@@ -97,7 +98,6 @@ let Item = exports.Item = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec
|
|
|
97
98
|
const ariaDescribedBy = this.props['aria-describedby'] || (descriptionContent ? this._descriptionId : void 0);
|
|
98
99
|
return (0, _jsxRuntime.jsxs)(ElementType, {
|
|
99
100
|
role: voiceoverRoleBugWorkaround ? role : 'none',
|
|
100
|
-
"data-cid": "Options.Item",
|
|
101
101
|
css: styles === null || styles === void 0 ? void 0 : styles.item,
|
|
102
102
|
ref: element => {
|
|
103
103
|
this.ref = element;
|
|
@@ -121,7 +121,7 @@ let Item = exports.Item = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec
|
|
|
121
121
|
}), renderBeforeLabel && this.renderContent(renderBeforeLabel, styles === null || styles === void 0 ? void 0 : styles.contentBefore), renderAfterLabel && this.renderContent(renderAfterLabel, styles === null || styles === void 0 ? void 0 : styles.contentAfter)]
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
|
-
}, _Item.displayName = "Item", _Item.componentId = 'Options.Item', _Item.allowedProps = _props.allowedProps, _Item.defaultProps = {
|
|
124
|
+
}, _Item.displayName = "Item", _Item.componentId = 'Options.Item', _Item.allowedProps = _props.allowedProps, _Item.propTypes = _props.propTypes, _Item.defaultProps = {
|
|
125
125
|
as: 'span',
|
|
126
126
|
variant: 'default',
|
|
127
127
|
role: 'listitem',
|
|
@@ -129,5 +129,5 @@ let Item = exports.Item = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec
|
|
|
129
129
|
beforeLabelContentVAlign: 'center',
|
|
130
130
|
afterLabelContentVAlign: 'center',
|
|
131
131
|
isSelected: false
|
|
132
|
-
}, _Item)) || _class) || _class);
|
|
132
|
+
}, _Item)) || _class) || _class) || _class);
|
|
133
133
|
var _default = exports.default = Item;
|
|
@@ -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,20 @@ exports.allowedProps = void 0;
|
|
|
28
30
|
* SOFTWARE.
|
|
29
31
|
*/
|
|
30
32
|
|
|
33
|
+
const propTypes = exports.propTypes = {
|
|
34
|
+
as: _propTypes.default.elementType,
|
|
35
|
+
variant: _propTypes.default.oneOf(['default', 'highlighted', 'selected', 'disabled', 'highlighted-disabled', 'selected-highlighted']),
|
|
36
|
+
role: _propTypes.default.string,
|
|
37
|
+
renderBeforeLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
38
|
+
renderAfterLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
39
|
+
beforeLabelContentVAlign: _propTypes.default.oneOf(['start', 'center', 'end']),
|
|
40
|
+
afterLabelContentVAlign: _propTypes.default.oneOf(['start', 'center', 'end']),
|
|
41
|
+
description: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
42
|
+
descriptionRole: _propTypes.default.string,
|
|
43
|
+
href: _propTypes.default.string,
|
|
44
|
+
voiceoverRoleBugWorkaround: _propTypes.default.bool,
|
|
45
|
+
elementRef: _propTypes.default.func,
|
|
46
|
+
children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
47
|
+
isSelected: _propTypes.default.bool
|
|
48
|
+
};
|
|
31
49
|
const allowedProps = exports.allowedProps = ['as', 'variant', 'role', 'renderBeforeLabel', 'renderAfterLabel', 'beforeLabelContentVAlign', 'afterLabelContentVAlign', 'description', 'descriptionRole', 'voiceoverRoleBugWorkaround', 'href', 'elementRef', 'children', 'isSelected'];
|
|
@@ -69,7 +69,7 @@ let Separator = exports.Separator = (_dec = (0, _emotion.withStyle)(_styles.defa
|
|
|
69
69
|
})
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
}, _Separator.displayName = "Separator", _Separator.componentId = 'Options.Separator', _Separator.allowedProps = _props.allowedProps, _Separator.defaultProps = {
|
|
72
|
+
}, _Separator.displayName = "Separator", _Separator.componentId = 'Options.Separator', _Separator.allowedProps = _props.allowedProps, _Separator.propTypes = _props.propTypes, _Separator.defaultProps = {
|
|
73
73
|
as: 'span'
|
|
74
74
|
}, _Separator)) || _class);
|
|
75
75
|
var _default = exports.default = Separator;
|
|
@@ -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,7 @@ exports.allowedProps = void 0;
|
|
|
28
30
|
* SOFTWARE.
|
|
29
31
|
*/
|
|
30
32
|
|
|
33
|
+
const propTypes = exports.propTypes = {
|
|
34
|
+
as: _propTypes.default.elementType
|
|
35
|
+
};
|
|
31
36
|
const allowedProps = exports.allowedProps = ['as'];
|
package/lib/Options/index.js
CHANGED
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.Options = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
10
|
+
var _uiTestable = require("@instructure/ui-testable");
|
|
10
11
|
var _uiView = require("@instructure/ui-view");
|
|
11
12
|
var _emotion = require("@instructure/emotion");
|
|
12
13
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
@@ -16,7 +17,7 @@ var _Separator = require("./Separator");
|
|
|
16
17
|
var _props = require("./props");
|
|
17
18
|
var _uiUtils = require("@instructure/ui-utils");
|
|
18
19
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
19
|
-
var _dec, _dec2, _class, _Options;
|
|
20
|
+
var _dec, _dec2, _dec3, _class, _Options;
|
|
20
21
|
/*
|
|
21
22
|
* The MIT License (MIT)
|
|
22
23
|
*
|
|
@@ -45,7 +46,7 @@ var _dec, _dec2, _class, _Options;
|
|
|
45
46
|
category: components
|
|
46
47
|
---
|
|
47
48
|
**/
|
|
48
|
-
let Options = exports.Options = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_Options = class Options extends _react.Component {
|
|
49
|
+
let Options = exports.Options = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _uiTestable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_Options = class Options extends _react.Component {
|
|
49
50
|
constructor(...args) {
|
|
50
51
|
super(...args);
|
|
51
52
|
this.ref = null;
|
|
@@ -127,7 +128,6 @@ let Options = exports.Options = (_dec = (0, _uiReactUtils.withDeterministicId)()
|
|
|
127
128
|
css: styles === null || styles === void 0 ? void 0 : styles.options,
|
|
128
129
|
role: "presentation",
|
|
129
130
|
ref: this.handleRef,
|
|
130
|
-
"data-cid": "Options",
|
|
131
131
|
children: [renderLabel && this.renderLabel(), (0, _jsxRuntime.jsx)(_uiView.View, {
|
|
132
132
|
...passthroughProps,
|
|
133
133
|
elementRef: elementRef,
|
|
@@ -143,11 +143,11 @@ let Options = exports.Options = (_dec = (0, _uiReactUtils.withDeterministicId)()
|
|
|
143
143
|
})]
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
|
-
}, _Options.displayName = "Options", _Options.componentId = 'Options', _Options.allowedProps = _props.allowedProps, _Options.defaultProps = {
|
|
146
|
+
}, _Options.displayName = "Options", _Options.componentId = 'Options', _Options.allowedProps = _props.allowedProps, _Options.propTypes = _props.propTypes, _Options.defaultProps = {
|
|
147
147
|
as: 'span',
|
|
148
148
|
role: 'list',
|
|
149
149
|
elementRef: () => {},
|
|
150
150
|
renderLabel: null,
|
|
151
151
|
children: null
|
|
152
|
-
}, _Options.Item = _Item.Item, _Options.Separator = _Separator.Separator, _Options)) || _class) || _class);
|
|
152
|
+
}, _Options.Item = _Item.Item, _Options.Separator = _Separator.Separator, _Options)) || _class) || _class) || _class);
|
|
153
153
|
var _default = exports.default = Options;
|
package/lib/Options/props.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
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 _uiPropTypes = require("@instructure/ui-prop-types");
|
|
7
10
|
/*
|
|
8
11
|
* The MIT License (MIT)
|
|
9
12
|
*
|
|
@@ -28,4 +31,11 @@ exports.allowedProps = void 0;
|
|
|
28
31
|
* SOFTWARE.
|
|
29
32
|
*/
|
|
30
33
|
|
|
34
|
+
const propTypes = exports.propTypes = {
|
|
35
|
+
as: _propTypes.default.elementType,
|
|
36
|
+
role: _propTypes.default.string,
|
|
37
|
+
elementRef: _propTypes.default.func,
|
|
38
|
+
renderLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
39
|
+
children: _uiPropTypes.Children.oneOf(['Options', 'Item', 'Separator'])
|
|
40
|
+
};
|
|
31
41
|
const allowedProps = exports.allowedProps = ['as', 'role', 'elementRef', 'renderLabel', 'children'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-options",
|
|
3
|
-
"version": "10.26.
|
|
3
|
+
"version": "10.26.2",
|
|
4
4
|
"description": "A view-only component for composing interactive lists and menus.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,26 +23,29 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-axe-check": "10.26.
|
|
27
|
-
"@instructure/ui-babel-preset": "10.26.
|
|
28
|
-
"@instructure/ui-color-utils": "10.26.
|
|
29
|
-
"@instructure/ui-themes": "10.26.
|
|
26
|
+
"@instructure/ui-axe-check": "10.26.2",
|
|
27
|
+
"@instructure/ui-babel-preset": "10.26.2",
|
|
28
|
+
"@instructure/ui-color-utils": "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-icons": "10.26.
|
|
40
|
-
"@instructure/ui-
|
|
41
|
-
"@instructure/ui-utils": "10.26.
|
|
42
|
-
"@instructure/ui-
|
|
37
|
+
"@instructure/emotion": "10.26.2",
|
|
38
|
+
"@instructure/shared-types": "10.26.2",
|
|
39
|
+
"@instructure/ui-icons": "10.26.2",
|
|
40
|
+
"@instructure/ui-prop-types": "10.26.2",
|
|
41
|
+
"@instructure/ui-react-utils": "10.26.2",
|
|
42
|
+
"@instructure/ui-testable": "10.26.2",
|
|
43
|
+
"@instructure/ui-utils": "10.26.2",
|
|
44
|
+
"@instructure/ui-view": "10.26.2",
|
|
45
|
+
"prop-types": "^15.8.1"
|
|
43
46
|
},
|
|
44
47
|
"peerDependencies": {
|
|
45
|
-
"react": ">=
|
|
48
|
+
"react": ">=16.14 <=18"
|
|
46
49
|
},
|
|
47
50
|
"publishConfig": {
|
|
48
51
|
"access": "public"
|
|
@@ -30,13 +30,14 @@ import {
|
|
|
30
30
|
callRenderProp,
|
|
31
31
|
withDeterministicId
|
|
32
32
|
} from '@instructure/ui-react-utils'
|
|
33
|
+
import { testable } from '@instructure/ui-testable'
|
|
33
34
|
|
|
34
35
|
import { withStyle } from '@instructure/emotion'
|
|
35
36
|
|
|
36
37
|
import generateStyles from './styles'
|
|
37
38
|
import generateComponentTheme from './theme'
|
|
38
39
|
import type { OptionsItemProps, OptionsItemStyle } from './props'
|
|
39
|
-
import { allowedProps } from './props'
|
|
40
|
+
import { allowedProps, propTypes } from './props'
|
|
40
41
|
|
|
41
42
|
/**
|
|
42
43
|
---
|
|
@@ -46,10 +47,12 @@ id: Options.Item
|
|
|
46
47
|
**/
|
|
47
48
|
@withDeterministicId()
|
|
48
49
|
@withStyle(generateStyles, generateComponentTheme)
|
|
50
|
+
@testable()
|
|
49
51
|
class Item extends Component<OptionsItemProps> {
|
|
50
52
|
static readonly componentId = 'Options.Item'
|
|
51
53
|
|
|
52
54
|
static allowedProps = allowedProps
|
|
55
|
+
static propTypes = propTypes
|
|
53
56
|
|
|
54
57
|
static defaultProps = {
|
|
55
58
|
as: 'span',
|
|
@@ -135,7 +138,6 @@ class Item extends Component<OptionsItemProps> {
|
|
|
135
138
|
return (
|
|
136
139
|
<ElementType
|
|
137
140
|
role={voiceoverRoleBugWorkaround ? role : 'none'}
|
|
138
|
-
data-cid="Options.Item"
|
|
139
141
|
css={styles?.item}
|
|
140
142
|
ref={(element: Element | null) => {
|
|
141
143
|
this.ref = element
|
|
@@ -22,8 +22,11 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import PropTypes from 'prop-types'
|
|
26
|
+
|
|
25
27
|
import type {
|
|
26
28
|
AsElementType,
|
|
29
|
+
PropValidators,
|
|
27
30
|
OptionsItemTheme,
|
|
28
31
|
OtherHTMLAttributes,
|
|
29
32
|
Renderable
|
|
@@ -115,6 +118,31 @@ type OptionsItemStyle = ComponentStyle<
|
|
|
115
118
|
| 'contentAfter'
|
|
116
119
|
| 'description'
|
|
117
120
|
>
|
|
121
|
+
|
|
122
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
123
|
+
as: PropTypes.elementType,
|
|
124
|
+
variant: PropTypes.oneOf([
|
|
125
|
+
'default',
|
|
126
|
+
'highlighted',
|
|
127
|
+
'selected',
|
|
128
|
+
'disabled',
|
|
129
|
+
'highlighted-disabled',
|
|
130
|
+
'selected-highlighted'
|
|
131
|
+
]),
|
|
132
|
+
role: PropTypes.string,
|
|
133
|
+
renderBeforeLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
134
|
+
renderAfterLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
135
|
+
beforeLabelContentVAlign: PropTypes.oneOf(['start', 'center', 'end']),
|
|
136
|
+
afterLabelContentVAlign: PropTypes.oneOf(['start', 'center', 'end']),
|
|
137
|
+
description: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
138
|
+
descriptionRole: PropTypes.string,
|
|
139
|
+
href: PropTypes.string,
|
|
140
|
+
voiceoverRoleBugWorkaround: PropTypes.bool,
|
|
141
|
+
elementRef: PropTypes.func,
|
|
142
|
+
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
143
|
+
isSelected: PropTypes.bool
|
|
144
|
+
}
|
|
145
|
+
|
|
118
146
|
const allowedProps: AllowedPropKeys = [
|
|
119
147
|
'as',
|
|
120
148
|
'variant',
|
|
@@ -133,4 +161,4 @@ const allowedProps: AllowedPropKeys = [
|
|
|
133
161
|
]
|
|
134
162
|
|
|
135
163
|
export type { OptionsItemProps, OptionsItemStyle, OptionsItemRenderProps }
|
|
136
|
-
export { allowedProps }
|
|
164
|
+
export { propTypes, allowedProps }
|
|
@@ -31,7 +31,7 @@ import { withStyle } from '@instructure/emotion'
|
|
|
31
31
|
import generateStyles from './styles'
|
|
32
32
|
import generateComponentTheme from './theme'
|
|
33
33
|
import type { OptionsSeparatorProps } from './props'
|
|
34
|
-
import { allowedProps } from './props'
|
|
34
|
+
import { allowedProps, propTypes } from './props'
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
---
|
|
@@ -45,6 +45,7 @@ class Separator extends Component<OptionsSeparatorProps> {
|
|
|
45
45
|
static readonly componentId = 'Options.Separator'
|
|
46
46
|
|
|
47
47
|
static allowedProps = allowedProps
|
|
48
|
+
static propTypes = propTypes
|
|
48
49
|
|
|
49
50
|
static defaultProps = {
|
|
50
51
|
as: 'span'
|
|
@@ -21,9 +21,11 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
import PropTypes from 'prop-types'
|
|
24
25
|
|
|
25
26
|
import type {
|
|
26
27
|
AsElementType,
|
|
28
|
+
PropValidators,
|
|
27
29
|
OptionsSeparatorTheme,
|
|
28
30
|
OtherHTMLAttributes
|
|
29
31
|
} from '@instructure/shared-types'
|
|
@@ -46,7 +48,12 @@ type OptionsSeparatorProps = OptionsSeparatorOwnProps &
|
|
|
46
48
|
OtherHTMLAttributes<OptionsSeparatorOwnProps, AllHTMLAttributes<any>>
|
|
47
49
|
|
|
48
50
|
type OptionsSeparatorStyle = ComponentStyle<'separator'>
|
|
51
|
+
|
|
52
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
53
|
+
as: PropTypes.elementType
|
|
54
|
+
}
|
|
55
|
+
|
|
49
56
|
const allowedProps: AllowedPropKeys = ['as']
|
|
50
57
|
|
|
51
58
|
export type { OptionsSeparatorProps, OptionsSeparatorStyle }
|
|
52
|
-
export { allowedProps }
|
|
59
|
+
export { propTypes, allowedProps }
|
package/src/Options/index.tsx
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
safeCloneElement,
|
|
32
32
|
withDeterministicId
|
|
33
33
|
} from '@instructure/ui-react-utils'
|
|
34
|
+
import { testable } from '@instructure/ui-testable'
|
|
34
35
|
|
|
35
36
|
import { View } from '@instructure/ui-view'
|
|
36
37
|
|
|
@@ -45,7 +46,7 @@ import { Separator } from './Separator'
|
|
|
45
46
|
import type { OptionsSeparatorProps } from './Separator/props'
|
|
46
47
|
|
|
47
48
|
import type { OptionsProps } from './props'
|
|
48
|
-
import { allowedProps } from './props'
|
|
49
|
+
import { allowedProps, propTypes } from './props'
|
|
49
50
|
import { isAndroidOrIOS } from '@instructure/ui-utils'
|
|
50
51
|
|
|
51
52
|
type ItemChild = ComponentElement<OptionsItemProps, Item>
|
|
@@ -60,10 +61,12 @@ category: components
|
|
|
60
61
|
**/
|
|
61
62
|
@withDeterministicId()
|
|
62
63
|
@withStyle(generateStyles, generateComponentTheme)
|
|
64
|
+
@testable()
|
|
63
65
|
class Options extends Component<OptionsProps> {
|
|
64
66
|
static readonly componentId = 'Options'
|
|
65
67
|
|
|
66
68
|
static allowedProps = allowedProps
|
|
69
|
+
static propTypes = propTypes
|
|
67
70
|
|
|
68
71
|
static defaultProps = {
|
|
69
72
|
as: 'span',
|
|
@@ -159,12 +162,7 @@ class Options extends Component<OptionsProps> {
|
|
|
159
162
|
const { as, role, renderLabel, elementRef, styles } = this.props
|
|
160
163
|
|
|
161
164
|
return (
|
|
162
|
-
<div
|
|
163
|
-
css={styles?.options}
|
|
164
|
-
role="presentation"
|
|
165
|
-
ref={this.handleRef}
|
|
166
|
-
data-cid="Options"
|
|
167
|
-
>
|
|
165
|
+
<div css={styles?.options} role="presentation" ref={this.handleRef}>
|
|
168
166
|
{renderLabel && this.renderLabel()}
|
|
169
167
|
<View
|
|
170
168
|
{...passthroughProps}
|