@instructure/ui-options 8.33.1 → 8.33.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 +4 -0
- package/es/Options/Item/OptionsItemLocator.js +2 -1
- package/es/Options/Item/__examples__/Item.examples.js +1 -4
- package/es/Options/Item/index.js +16 -25
- package/es/Options/Item/props.js +1 -0
- package/es/Options/Item/styles.js +11 -12
- package/es/Options/Item/theme.js +5 -5
- package/es/Options/OptionsLocator.js +2 -1
- package/es/Options/Separator/index.js +4 -12
- package/es/Options/Separator/styles.js +0 -1
- package/es/Options/Separator/theme.js +4 -4
- package/es/Options/__examples__/Options.examples.js +1 -0
- package/es/Options/index.js +7 -28
- package/es/Options/props.js +1 -0
- package/es/Options/styles.js +0 -1
- package/es/Options/theme.js +4 -4
- package/es/index.js +1 -0
- package/lib/Options/Item/OptionsItemLocator.js +1 -4
- package/lib/Options/Item/__examples__/Item.examples.js +0 -6
- package/lib/Options/Item/index.js +15 -33
- package/lib/Options/Item/locator.js +0 -2
- package/lib/Options/Item/props.js +1 -3
- package/lib/Options/Item/styles.js +10 -14
- package/lib/Options/Item/theme.js +5 -6
- package/lib/Options/OptionsLocator.js +1 -4
- package/lib/Options/Separator/index.js +3 -19
- package/lib/Options/Separator/props.js +1 -3
- package/lib/Options/Separator/styles.js +0 -2
- package/lib/Options/Separator/theme.js +4 -5
- package/lib/Options/__examples__/Options.examples.js +0 -5
- package/lib/Options/index.js +7 -41
- package/lib/Options/locator.js +0 -2
- package/lib/Options/props.js +1 -4
- package/lib/Options/styles.js +0 -2
- package/lib/Options/theme.js +4 -5
- package/lib/index.js +0 -4
- package/package.json +13 -13
- package/src/Options/README.md +13 -4
- package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [8.33.2](https://github.com/instructure/instructure-ui/compare/v8.33.1...v8.33.2) (2023-01-25)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-options
|
|
9
|
+
|
|
6
10
|
## [8.33.1](https://github.com/instructure/instructure-ui/compare/v8.33.0...v8.33.1) (2023-01-06)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @instructure/ui-options
|
|
@@ -23,8 +23,9 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import { locator } from '@instructure/ui-test-locator';
|
|
25
25
|
import { OptionsLocator } from '../OptionsLocator';
|
|
26
|
-
import { Item } from './index';
|
|
26
|
+
import { Item } from './index';
|
|
27
27
|
|
|
28
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
28
29
|
export const OptionsItemLocator = locator(Item.selector, {
|
|
29
30
|
findNestedOptions: function () {
|
|
30
31
|
return OptionsLocator.find(...arguments);
|
|
@@ -21,6 +21,7 @@
|
|
|
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
25
|
import { IconCheckSolid, IconArrowOpenEndSolid } from '@instructure/ui-icons';
|
|
25
26
|
export default {
|
|
26
27
|
maxExamplesPerPage: 50,
|
|
@@ -49,22 +50,18 @@ export default {
|
|
|
49
50
|
if (props.beforeLabelContentVAlign !== 'center' && (!props.renderBeforeLabel || props.renderAfterLabel)) {
|
|
50
51
|
return true;
|
|
51
52
|
}
|
|
52
|
-
|
|
53
53
|
if (props.afterLabelContentVAlign !== 'center' && (!props.renderAfterLabel || props.renderBeforeLabel)) {
|
|
54
54
|
return true;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
|
|
58
57
|
if (!props.description) {
|
|
59
58
|
if (props.afterLabelContentVAlign !== 'center' || props.beforeLabelContentVAlign !== 'center') {
|
|
60
59
|
return true;
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
|
-
|
|
64
62
|
if (props.href && (props.beforeLabelContentVAlign !== 'center' || props.afterLabelContentVAlign !== 'center' || props.description)) {
|
|
65
63
|
return true;
|
|
66
64
|
}
|
|
67
|
-
|
|
68
65
|
return false;
|
|
69
66
|
}
|
|
70
67
|
};
|
package/es/Options/Item/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var _dec, _dec2, _dec3, _class, _class2;
|
|
2
|
-
|
|
3
2
|
/*
|
|
4
3
|
* The MIT License (MIT)
|
|
5
4
|
*
|
|
@@ -32,6 +31,7 @@ import { withStyle, jsx } from '@instructure/emotion';
|
|
|
32
31
|
import generateStyles from './styles';
|
|
33
32
|
import generateComponentTheme from './theme';
|
|
34
33
|
import { allowedProps, propTypes } from './props';
|
|
34
|
+
|
|
35
35
|
/**
|
|
36
36
|
---
|
|
37
37
|
parent: Options
|
|
@@ -39,7 +39,6 @@ id: Options.Item
|
|
|
39
39
|
---
|
|
40
40
|
@tsProps
|
|
41
41
|
**/
|
|
42
|
-
|
|
43
42
|
let Item = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, generateComponentTheme), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class Item extends Component {
|
|
44
43
|
constructor(props) {
|
|
45
44
|
super(props);
|
|
@@ -47,26 +46,21 @@ let Item = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, gene
|
|
|
47
46
|
this._descriptionId = void 0;
|
|
48
47
|
this._descriptionId = props.deterministicId('OptionsItem-description');
|
|
49
48
|
}
|
|
50
|
-
|
|
51
49
|
componentDidMount() {
|
|
52
50
|
var _this$props$makeStyle, _this$props;
|
|
53
|
-
|
|
54
51
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
55
52
|
}
|
|
56
|
-
|
|
57
53
|
componentDidUpdate() {
|
|
58
54
|
var _this$props$makeStyle2, _this$props2;
|
|
59
|
-
|
|
60
55
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
61
56
|
}
|
|
62
|
-
|
|
63
57
|
renderContent(renderLabel, contentVariant) {
|
|
64
58
|
const _this$props3 = this.props,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
59
|
+
styles = _this$props3.styles,
|
|
60
|
+
variant = _this$props3.variant,
|
|
61
|
+
as = _this$props3.as,
|
|
62
|
+
role = _this$props3.role,
|
|
63
|
+
children = _this$props3.children;
|
|
70
64
|
return jsx("span", {
|
|
71
65
|
css: [styles === null || styles === void 0 ? void 0 : styles.content, contentVariant],
|
|
72
66
|
role: "presentation",
|
|
@@ -78,19 +72,18 @@ let Item = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, gene
|
|
|
78
72
|
children
|
|
79
73
|
}));
|
|
80
74
|
}
|
|
81
|
-
|
|
82
75
|
render() {
|
|
83
76
|
const _this$props4 = this.props,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
77
|
+
as = _this$props4.as,
|
|
78
|
+
href = _this$props4.href,
|
|
79
|
+
role = _this$props4.role,
|
|
80
|
+
styles = _this$props4.styles,
|
|
81
|
+
description = _this$props4.description,
|
|
82
|
+
descriptionRole = _this$props4.descriptionRole,
|
|
83
|
+
renderBeforeLabel = _this$props4.renderBeforeLabel,
|
|
84
|
+
renderAfterLabel = _this$props4.renderAfterLabel,
|
|
85
|
+
elementRef = _this$props4.elementRef,
|
|
86
|
+
children = _this$props4.children;
|
|
94
87
|
const ElementType = getElementType(Item, this.props, () => as);
|
|
95
88
|
const InnerElementType = href ? 'a' : 'span';
|
|
96
89
|
const passthroughProps = omitProps(this.props, Item.allowedProps);
|
|
@@ -101,7 +94,6 @@ let Item = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, gene
|
|
|
101
94
|
css: styles === null || styles === void 0 ? void 0 : styles.item,
|
|
102
95
|
ref: element => {
|
|
103
96
|
this.ref = element;
|
|
104
|
-
|
|
105
97
|
if (typeof elementRef === 'function') {
|
|
106
98
|
elementRef(element);
|
|
107
99
|
}
|
|
@@ -117,7 +109,6 @@ let Item = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, gene
|
|
|
117
109
|
id: this._descriptionId
|
|
118
110
|
}, descriptionContent)), 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));
|
|
119
111
|
}
|
|
120
|
-
|
|
121
112
|
}, _class2.displayName = "Item", _class2.componentId = 'Options.Item', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
|
|
122
113
|
as: 'span',
|
|
123
114
|
variant: 'default',
|
package/es/Options/Item/props.js
CHANGED
|
@@ -21,8 +21,8 @@
|
|
|
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 { matchComponentTypes } from '@instructure/ui-react-utils';
|
|
25
24
|
|
|
25
|
+
import { matchComponentTypes } from '@instructure/ui-react-utils';
|
|
26
26
|
/**
|
|
27
27
|
* ---
|
|
28
28
|
* private: true
|
|
@@ -35,14 +35,15 @@ import { matchComponentTypes } from '@instructure/ui-react-utils';
|
|
|
35
35
|
*/
|
|
36
36
|
const generateStyle = (componentTheme, props) => {
|
|
37
37
|
const variant = props.variant,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const containsList = matchComponentTypes(children, ['Options']);
|
|
38
|
+
children = props.children,
|
|
39
|
+
hasContentBeforeLabel = props.renderBeforeLabel,
|
|
40
|
+
hasContentAfterLabel = props.renderAfterLabel,
|
|
41
|
+
beforeLabelContentVAlign = props.beforeLabelContentVAlign,
|
|
42
|
+
afterLabelContentVAlign = props.afterLabelContentVAlign;
|
|
43
|
+
// TODO if children are () => ReactNode this wont match anything
|
|
44
|
+
const containsList = matchComponentTypes(children, ['Options']);
|
|
45
45
|
|
|
46
|
+
// used for label and description too
|
|
46
47
|
const variantVariants = {
|
|
47
48
|
highlighted: {
|
|
48
49
|
background: componentTheme.highlightedBackground,
|
|
@@ -64,7 +65,6 @@ const generateStyle = (componentTheme, props) => {
|
|
|
64
65
|
},
|
|
65
66
|
default: {}
|
|
66
67
|
};
|
|
67
|
-
|
|
68
68
|
const getContentVAlign = type => {
|
|
69
69
|
const vAlign = type === 'before' ? beforeLabelContentVAlign : afterLabelContentVAlign;
|
|
70
70
|
const vOffset = type === 'before' ? componentTheme.beforeLabelContentVOffset : componentTheme.afterLabelContentVOffset;
|
|
@@ -84,7 +84,6 @@ const generateStyle = (componentTheme, props) => {
|
|
|
84
84
|
}
|
|
85
85
|
}[vAlign];
|
|
86
86
|
};
|
|
87
|
-
|
|
88
87
|
const linkStyles = {
|
|
89
88
|
textDecoration: 'none',
|
|
90
89
|
color: 'currentColor'
|
|
@@ -110,7 +109,8 @@ const generateStyle = (componentTheme, props) => {
|
|
|
110
109
|
cursor: 'default'
|
|
111
110
|
}),
|
|
112
111
|
// for nested items
|
|
113
|
-
'[class*=-optionItem] &': {
|
|
112
|
+
'[class*=-optionItem] &': {
|
|
113
|
+
// except if it has icon before
|
|
114
114
|
...(!hasContentBeforeLabel && {
|
|
115
115
|
'[class$=-optionItem__container]': {
|
|
116
116
|
paddingInlineStart: componentTheme.nestedPadding
|
|
@@ -181,7 +181,6 @@ const generateStyle = (componentTheme, props) => {
|
|
|
181
181
|
color: componentTheme.descriptionColor,
|
|
182
182
|
...variantVariants[variant],
|
|
183
183
|
background: 'none' // needed to clear variant background
|
|
184
|
-
|
|
185
184
|
}
|
|
186
185
|
};
|
|
187
186
|
};
|
package/es/Options/Item/theme.js
CHANGED
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
31
|
const colors = theme.colors,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
typography = theme.typography,
|
|
33
|
+
spacing = theme.spacing,
|
|
34
|
+
themeName = theme.key;
|
|
35
35
|
const themeSpecificStyle = {
|
|
36
36
|
canvas: {
|
|
37
37
|
color: theme['ic-brand-font-color-dark'],
|
|
@@ -60,10 +60,10 @@ const generateComponentTheme = theme => {
|
|
|
60
60
|
descriptionPaddingStart: '0.25em',
|
|
61
61
|
descriptionColor: colors.textDark
|
|
62
62
|
};
|
|
63
|
-
return {
|
|
63
|
+
return {
|
|
64
|
+
...componentVariables,
|
|
64
65
|
...themeSpecificStyle[themeName]
|
|
65
66
|
};
|
|
66
67
|
};
|
|
67
|
-
|
|
68
68
|
export { generateComponentTheme as optionsItemThemeGenerator };
|
|
69
69
|
export default generateComponentTheme;
|
|
@@ -23,8 +23,9 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import { locator } from '@instructure/ui-test-locator';
|
|
25
25
|
import { Options } from './index';
|
|
26
|
-
import { OptionsItemLocator } from './Item/OptionsItemLocator';
|
|
26
|
+
import { OptionsItemLocator } from './Item/OptionsItemLocator';
|
|
27
27
|
|
|
28
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
28
29
|
export const OptionsLocator = locator(Options.selector, {
|
|
29
30
|
findAllItems: function () {
|
|
30
31
|
return OptionsItemLocator.findAll(...arguments);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
const _excluded = ["as", "styles"];
|
|
3
|
-
|
|
4
3
|
var _dec, _class, _class2;
|
|
5
|
-
|
|
6
4
|
/*
|
|
7
5
|
* The MIT License (MIT)
|
|
8
6
|
*
|
|
@@ -34,6 +32,7 @@ import { withStyle, jsx } from '@instructure/emotion';
|
|
|
34
32
|
import generateStyles from './styles';
|
|
35
33
|
import generateComponentTheme from './theme';
|
|
36
34
|
import { allowedProps, propTypes } from './props';
|
|
35
|
+
|
|
37
36
|
/**
|
|
38
37
|
---
|
|
39
38
|
parent: Options
|
|
@@ -42,26 +41,20 @@ id: Options.Separator
|
|
|
42
41
|
@module Separator
|
|
43
42
|
@tsProps
|
|
44
43
|
**/
|
|
45
|
-
|
|
46
44
|
let Separator = (_dec = withStyle(generateStyles, generateComponentTheme), _dec(_class = (_class2 = class Separator extends Component {
|
|
47
45
|
componentDidMount() {
|
|
48
46
|
var _this$props$makeStyle, _this$props;
|
|
49
|
-
|
|
50
47
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
51
48
|
}
|
|
52
|
-
|
|
53
49
|
componentDidUpdate() {
|
|
54
50
|
var _this$props$makeStyle2, _this$props2;
|
|
55
|
-
|
|
56
51
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
57
52
|
}
|
|
58
|
-
|
|
59
53
|
render() {
|
|
60
54
|
const _this$props3 = this.props,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
55
|
+
as = _this$props3.as,
|
|
56
|
+
styles = _this$props3.styles,
|
|
57
|
+
rest = _objectWithoutProperties(_this$props3, _excluded);
|
|
65
58
|
const ElementType = getElementType(Separator, this.props, () => as);
|
|
66
59
|
return jsx(ElementType, {
|
|
67
60
|
role: "none"
|
|
@@ -70,7 +63,6 @@ let Separator = (_dec = withStyle(generateStyles, generateComponentTheme), _dec(
|
|
|
70
63
|
role: "presentation"
|
|
71
64
|
})));
|
|
72
65
|
}
|
|
73
|
-
|
|
74
66
|
}, _class2.displayName = "Separator", _class2.componentId = 'Options.Separator', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
|
|
75
67
|
as: 'span'
|
|
76
68
|
}, _class2)) || _class);
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
31
|
const borders = theme.borders,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
colors = theme.colors,
|
|
33
|
+
spacing = theme.spacing;
|
|
34
34
|
const componentVariables = {
|
|
35
35
|
background: colors === null || colors === void 0 ? void 0 : colors.backgroundMedium,
|
|
36
36
|
height: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
|
|
37
37
|
margin: `0 ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`
|
|
38
38
|
};
|
|
39
|
-
return {
|
|
39
|
+
return {
|
|
40
|
+
...componentVariables
|
|
40
41
|
};
|
|
41
42
|
};
|
|
42
|
-
|
|
43
43
|
export { generateComponentTheme as optionsSeparatorThemeGenerator };
|
|
44
44
|
export default generateComponentTheme;
|
package/es/Options/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var _dec, _dec2, _dec3, _class, _class2;
|
|
2
|
-
|
|
3
2
|
/*
|
|
4
3
|
* The MIT License (MIT)
|
|
5
4
|
*
|
|
@@ -35,7 +34,6 @@ import generateComponentTheme from './theme';
|
|
|
35
34
|
import { Item } from './Item';
|
|
36
35
|
import { Separator } from './Separator';
|
|
37
36
|
import { allowedProps, propTypes } from './props';
|
|
38
|
-
|
|
39
37
|
/**
|
|
40
38
|
---
|
|
41
39
|
category: components
|
|
@@ -46,40 +44,30 @@ let Options = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, g
|
|
|
46
44
|
constructor() {
|
|
47
45
|
super(...arguments);
|
|
48
46
|
this.ref = null;
|
|
49
|
-
|
|
50
47
|
this.handleRef = el => {
|
|
51
48
|
this.ref = el;
|
|
52
49
|
};
|
|
53
|
-
|
|
54
50
|
this._labelId = this.props.deterministicId('Options-label');
|
|
55
51
|
}
|
|
56
|
-
|
|
57
52
|
componentDidMount() {
|
|
58
53
|
var _this$props$makeStyle, _this$props;
|
|
59
|
-
|
|
60
54
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
61
55
|
}
|
|
62
|
-
|
|
63
56
|
componentDidUpdate() {
|
|
64
57
|
var _this$props$makeStyle2, _this$props2;
|
|
65
|
-
|
|
66
58
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
67
59
|
}
|
|
68
|
-
|
|
69
60
|
get childAs() {
|
|
70
61
|
const as = this.props.as;
|
|
71
|
-
|
|
72
62
|
if (as === 'ul' || as === 'ol') {
|
|
73
63
|
return 'li';
|
|
74
64
|
}
|
|
75
|
-
|
|
76
65
|
return void 0;
|
|
77
66
|
}
|
|
78
|
-
|
|
79
67
|
renderLabel() {
|
|
80
68
|
const _this$props3 = this.props,
|
|
81
|
-
|
|
82
|
-
|
|
69
|
+
renderLabel = _this$props3.renderLabel,
|
|
70
|
+
styles = _this$props3.styles;
|
|
83
71
|
return jsx("span", {
|
|
84
72
|
id: this._labelId,
|
|
85
73
|
role: "presentation",
|
|
@@ -87,7 +75,6 @@ let Options = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, g
|
|
|
87
75
|
css: styles === null || styles === void 0 ? void 0 : styles.label
|
|
88
76
|
}, callRenderProp(renderLabel));
|
|
89
77
|
}
|
|
90
|
-
|
|
91
78
|
renderSubList(subOptions) {
|
|
92
79
|
const styles = this.props.styles;
|
|
93
80
|
return jsx(Item, {
|
|
@@ -96,44 +83,37 @@ let Options = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, g
|
|
|
96
83
|
css: styles === null || styles === void 0 ? void 0 : styles.label
|
|
97
84
|
}, subOptions);
|
|
98
85
|
}
|
|
99
|
-
|
|
100
86
|
renderChildren() {
|
|
101
87
|
const children = this.props.children;
|
|
102
88
|
return Children.map(children, child => {
|
|
103
89
|
if (matchComponentTypes(child, ['Options'])) {
|
|
104
90
|
return this.renderSubList(child);
|
|
105
91
|
}
|
|
106
|
-
|
|
107
92
|
if (matchComponentTypes(child, ['Item', 'Separator'])) {
|
|
108
93
|
return safeCloneElement(child, {
|
|
109
94
|
as: this.childAs || child.props.as
|
|
110
95
|
});
|
|
111
96
|
}
|
|
112
|
-
|
|
113
97
|
return void 0;
|
|
114
98
|
});
|
|
115
99
|
}
|
|
116
|
-
|
|
117
100
|
get ariaLabelledby() {
|
|
118
101
|
if (this.props.renderLabel) {
|
|
119
102
|
return this._labelId;
|
|
120
103
|
}
|
|
121
|
-
|
|
122
104
|
if (this.props['aria-labelledby']) {
|
|
123
105
|
return this.props['aria-labelledby'];
|
|
124
106
|
}
|
|
125
|
-
|
|
126
107
|
return void 0;
|
|
127
108
|
}
|
|
128
|
-
|
|
129
109
|
render() {
|
|
130
110
|
const passthroughProps = View.omitViewProps(omitProps(this.props, Options.allowedProps), Options);
|
|
131
111
|
const _this$props4 = this.props,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
112
|
+
as = _this$props4.as,
|
|
113
|
+
role = _this$props4.role,
|
|
114
|
+
renderLabel = _this$props4.renderLabel,
|
|
115
|
+
elementRef = _this$props4.elementRef,
|
|
116
|
+
styles = _this$props4.styles;
|
|
137
117
|
return jsx("div", {
|
|
138
118
|
css: styles === null || styles === void 0 ? void 0 : styles.options,
|
|
139
119
|
role: "presentation",
|
|
@@ -150,7 +130,6 @@ let Options = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, g
|
|
|
150
130
|
"aria-labelledby": this.ariaLabelledby
|
|
151
131
|
}), this.renderChildren()));
|
|
152
132
|
}
|
|
153
|
-
|
|
154
133
|
}, _class2.displayName = "Options", _class2.componentId = 'Options', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
|
|
155
134
|
as: 'span',
|
|
156
135
|
role: 'list',
|
package/es/Options/props.js
CHANGED
package/es/Options/styles.js
CHANGED
package/es/Options/theme.js
CHANGED
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
31
|
const colors = theme.colors,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
typography = theme.typography,
|
|
33
|
+
spacing = theme.spacing;
|
|
34
34
|
const componentVariables = {
|
|
35
35
|
labelFontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightBold,
|
|
36
36
|
background: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
|
|
@@ -38,9 +38,9 @@ const generateComponentTheme = theme => {
|
|
|
38
38
|
labelPadding: `${spacing === null || spacing === void 0 ? void 0 : spacing.xSmall} 0`,
|
|
39
39
|
nestedLabelPadding: `${spacing === null || spacing === void 0 ? void 0 : spacing.xSmall} ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`
|
|
40
40
|
};
|
|
41
|
-
return {
|
|
41
|
+
return {
|
|
42
|
+
...componentVariables
|
|
42
43
|
};
|
|
43
44
|
};
|
|
44
|
-
|
|
45
45
|
export { generateComponentTheme as optionsThemeGenerator };
|
|
46
46
|
export default generateComponentTheme;
|
package/es/index.js
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
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
25
|
export { Options } from './Options';
|
|
25
26
|
export { optionsThemeGenerator } from './Options/theme';
|
|
26
27
|
export { optionsItemThemeGenerator } from './Options/Item/theme';
|
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.OptionsItemLocator = void 0;
|
|
7
|
-
|
|
8
7
|
var _uiTestLocator = require("@instructure/ui-test-locator");
|
|
9
|
-
|
|
10
8
|
var _OptionsLocator = require("../OptionsLocator");
|
|
11
|
-
|
|
12
9
|
var _index = require("./index");
|
|
13
|
-
|
|
14
10
|
/*
|
|
15
11
|
* The MIT License (MIT)
|
|
16
12
|
*
|
|
@@ -34,6 +30,7 @@ var _index = require("./index");
|
|
|
34
30
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
31
|
* SOFTWARE.
|
|
36
32
|
*/
|
|
33
|
+
|
|
37
34
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
38
35
|
const OptionsItemLocator = (0, _uiTestLocator.locator)(_index.Item.selector, {
|
|
39
36
|
findNestedOptions: function () {
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _uiIcons = require("@instructure/ui-icons");
|
|
9
|
-
|
|
10
8
|
/*
|
|
11
9
|
* The MIT License (MIT)
|
|
12
10
|
*
|
|
@@ -57,22 +55,18 @@ var _default = {
|
|
|
57
55
|
if (props.beforeLabelContentVAlign !== 'center' && (!props.renderBeforeLabel || props.renderAfterLabel)) {
|
|
58
56
|
return true;
|
|
59
57
|
}
|
|
60
|
-
|
|
61
58
|
if (props.afterLabelContentVAlign !== 'center' && (!props.renderAfterLabel || props.renderBeforeLabel)) {
|
|
62
59
|
return true;
|
|
63
60
|
}
|
|
64
61
|
}
|
|
65
|
-
|
|
66
62
|
if (!props.description) {
|
|
67
63
|
if (props.afterLabelContentVAlign !== 'center' || props.beforeLabelContentVAlign !== 'center') {
|
|
68
64
|
return true;
|
|
69
65
|
}
|
|
70
66
|
}
|
|
71
|
-
|
|
72
67
|
if (props.href && (props.beforeLabelContentVAlign !== 'center' || props.afterLabelContentVAlign !== 'center' || props.description)) {
|
|
73
68
|
return true;
|
|
74
69
|
}
|
|
75
|
-
|
|
76
70
|
return false;
|
|
77
71
|
}
|
|
78
72
|
};
|