@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
|
@@ -1,28 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = exports.Item = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = require("react");
|
|
11
|
-
|
|
12
9
|
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
13
|
-
|
|
14
10
|
var _uiTestable = require("@instructure/ui-testable");
|
|
15
|
-
|
|
16
11
|
var _emotion = require("@instructure/emotion");
|
|
17
|
-
|
|
18
12
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
19
|
-
|
|
20
13
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
21
|
-
|
|
22
14
|
var _props = require("./props");
|
|
23
|
-
|
|
24
15
|
var _dec, _dec2, _dec3, _class, _class2;
|
|
25
|
-
|
|
26
16
|
/**
|
|
27
17
|
---
|
|
28
18
|
parent: Options
|
|
@@ -37,26 +27,21 @@ let Item = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotio
|
|
|
37
27
|
this._descriptionId = void 0;
|
|
38
28
|
this._descriptionId = props.deterministicId('OptionsItem-description');
|
|
39
29
|
}
|
|
40
|
-
|
|
41
30
|
componentDidMount() {
|
|
42
31
|
var _this$props$makeStyle, _this$props;
|
|
43
|
-
|
|
44
32
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
45
33
|
}
|
|
46
|
-
|
|
47
34
|
componentDidUpdate() {
|
|
48
35
|
var _this$props$makeStyle2, _this$props2;
|
|
49
|
-
|
|
50
36
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
51
37
|
}
|
|
52
|
-
|
|
53
38
|
renderContent(renderLabel, contentVariant) {
|
|
54
39
|
const _this$props3 = this.props,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
40
|
+
styles = _this$props3.styles,
|
|
41
|
+
variant = _this$props3.variant,
|
|
42
|
+
as = _this$props3.as,
|
|
43
|
+
role = _this$props3.role,
|
|
44
|
+
children = _this$props3.children;
|
|
60
45
|
return (0, _emotion.jsx)("span", {
|
|
61
46
|
css: [styles === null || styles === void 0 ? void 0 : styles.content, contentVariant],
|
|
62
47
|
role: "presentation",
|
|
@@ -68,19 +53,18 @@ let Item = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotio
|
|
|
68
53
|
children
|
|
69
54
|
}));
|
|
70
55
|
}
|
|
71
|
-
|
|
72
56
|
render() {
|
|
73
57
|
const _this$props4 = this.props,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
58
|
+
as = _this$props4.as,
|
|
59
|
+
href = _this$props4.href,
|
|
60
|
+
role = _this$props4.role,
|
|
61
|
+
styles = _this$props4.styles,
|
|
62
|
+
description = _this$props4.description,
|
|
63
|
+
descriptionRole = _this$props4.descriptionRole,
|
|
64
|
+
renderBeforeLabel = _this$props4.renderBeforeLabel,
|
|
65
|
+
renderAfterLabel = _this$props4.renderAfterLabel,
|
|
66
|
+
elementRef = _this$props4.elementRef,
|
|
67
|
+
children = _this$props4.children;
|
|
84
68
|
const ElementType = (0, _uiReactUtils.getElementType)(Item, this.props, () => as);
|
|
85
69
|
const InnerElementType = href ? 'a' : 'span';
|
|
86
70
|
const passthroughProps = (0, _uiReactUtils.omitProps)(this.props, Item.allowedProps);
|
|
@@ -91,7 +75,6 @@ let Item = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotio
|
|
|
91
75
|
css: styles === null || styles === void 0 ? void 0 : styles.item,
|
|
92
76
|
ref: element => {
|
|
93
77
|
this.ref = element;
|
|
94
|
-
|
|
95
78
|
if (typeof elementRef === 'function') {
|
|
96
79
|
elementRef(element);
|
|
97
80
|
}
|
|
@@ -107,7 +90,6 @@ let Item = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotio
|
|
|
107
90
|
id: this._descriptionId
|
|
108
91
|
}, 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));
|
|
109
92
|
}
|
|
110
|
-
|
|
111
93
|
}, _class2.displayName = "Item", _class2.componentId = 'Options.Item', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
|
112
94
|
as: 'span',
|
|
113
95
|
variant: 'default',
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
/*
|
|
13
10
|
* The MIT License (MIT)
|
|
14
11
|
*
|
|
@@ -32,6 +29,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
32
29
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
30
|
* SOFTWARE.
|
|
34
31
|
*/
|
|
32
|
+
|
|
35
33
|
const propTypes = {
|
|
36
34
|
as: _propTypes.default.elementType,
|
|
37
35
|
variant: _propTypes.default.oneOf(['default', 'highlighted', 'selected', 'disabled', 'highlighted-disabled']),
|
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
9
|
-
|
|
10
8
|
/*
|
|
11
9
|
* The MIT License (MIT)
|
|
12
10
|
*
|
|
@@ -43,14 +41,15 @@ var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
|
43
41
|
*/
|
|
44
42
|
const generateStyle = (componentTheme, props) => {
|
|
45
43
|
const variant = props.variant,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const containsList = (0, _uiReactUtils.matchComponentTypes)(children, ['Options']);
|
|
44
|
+
children = props.children,
|
|
45
|
+
hasContentBeforeLabel = props.renderBeforeLabel,
|
|
46
|
+
hasContentAfterLabel = props.renderAfterLabel,
|
|
47
|
+
beforeLabelContentVAlign = props.beforeLabelContentVAlign,
|
|
48
|
+
afterLabelContentVAlign = props.afterLabelContentVAlign;
|
|
49
|
+
// TODO if children are () => ReactNode this wont match anything
|
|
50
|
+
const containsList = (0, _uiReactUtils.matchComponentTypes)(children, ['Options']);
|
|
53
51
|
|
|
52
|
+
// used for label and description too
|
|
54
53
|
const variantVariants = {
|
|
55
54
|
highlighted: {
|
|
56
55
|
background: componentTheme.highlightedBackground,
|
|
@@ -72,7 +71,6 @@ const generateStyle = (componentTheme, props) => {
|
|
|
72
71
|
},
|
|
73
72
|
default: {}
|
|
74
73
|
};
|
|
75
|
-
|
|
76
74
|
const getContentVAlign = type => {
|
|
77
75
|
const vAlign = type === 'before' ? beforeLabelContentVAlign : afterLabelContentVAlign;
|
|
78
76
|
const vOffset = type === 'before' ? componentTheme.beforeLabelContentVOffset : componentTheme.afterLabelContentVOffset;
|
|
@@ -92,7 +90,6 @@ const generateStyle = (componentTheme, props) => {
|
|
|
92
90
|
}
|
|
93
91
|
}[vAlign];
|
|
94
92
|
};
|
|
95
|
-
|
|
96
93
|
const linkStyles = {
|
|
97
94
|
textDecoration: 'none',
|
|
98
95
|
color: 'currentColor'
|
|
@@ -118,7 +115,8 @@ const generateStyle = (componentTheme, props) => {
|
|
|
118
115
|
cursor: 'default'
|
|
119
116
|
}),
|
|
120
117
|
// for nested items
|
|
121
|
-
'[class*=-optionItem] &': {
|
|
118
|
+
'[class*=-optionItem] &': {
|
|
119
|
+
// except if it has icon before
|
|
122
120
|
...(!hasContentBeforeLabel && {
|
|
123
121
|
'[class$=-optionItem__container]': {
|
|
124
122
|
paddingInlineStart: componentTheme.nestedPadding
|
|
@@ -189,10 +187,8 @@ const generateStyle = (componentTheme, props) => {
|
|
|
189
187
|
color: componentTheme.descriptionColor,
|
|
190
188
|
...variantVariants[variant],
|
|
191
189
|
background: 'none' // needed to clear variant background
|
|
192
|
-
|
|
193
190
|
}
|
|
194
191
|
};
|
|
195
192
|
};
|
|
196
|
-
|
|
197
193
|
var _default = generateStyle;
|
|
198
194
|
exports.default = _default;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.optionsItemThemeGenerator = exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* The MIT License (MIT)
|
|
10
9
|
*
|
|
@@ -36,9 +35,9 @@ exports.optionsItemThemeGenerator = exports.default = void 0;
|
|
|
36
35
|
*/
|
|
37
36
|
const generateComponentTheme = theme => {
|
|
38
37
|
const colors = theme.colors,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
typography = theme.typography,
|
|
39
|
+
spacing = theme.spacing,
|
|
40
|
+
themeName = theme.key;
|
|
42
41
|
const themeSpecificStyle = {
|
|
43
42
|
canvas: {
|
|
44
43
|
color: theme['ic-brand-font-color-dark'],
|
|
@@ -67,11 +66,11 @@ const generateComponentTheme = theme => {
|
|
|
67
66
|
descriptionPaddingStart: '0.25em',
|
|
68
67
|
descriptionColor: colors.textDark
|
|
69
68
|
};
|
|
70
|
-
return {
|
|
69
|
+
return {
|
|
70
|
+
...componentVariables,
|
|
71
71
|
...themeSpecificStyle[themeName]
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
|
-
|
|
75
74
|
exports.optionsItemThemeGenerator = generateComponentTheme;
|
|
76
75
|
var _default = generateComponentTheme;
|
|
77
76
|
exports.default = _default;
|
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.OptionsLocator = void 0;
|
|
7
|
-
|
|
8
7
|
var _uiTestLocator = require("@instructure/ui-test-locator");
|
|
9
|
-
|
|
10
8
|
var _index = require("./index");
|
|
11
|
-
|
|
12
9
|
var _OptionsItemLocator = require("./Item/OptionsItemLocator");
|
|
13
|
-
|
|
14
10
|
/*
|
|
15
11
|
* The MIT License (MIT)
|
|
16
12
|
*
|
|
@@ -34,6 +30,7 @@ var _OptionsItemLocator = require("./Item/OptionsItemLocator");
|
|
|
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 OptionsLocator = (0, _uiTestLocator.locator)(_index.Options.selector, {
|
|
39
36
|
findAllItems: function () {
|
|
@@ -1,30 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = exports.Separator = void 0;
|
|
9
|
-
|
|
10
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
-
|
|
12
9
|
var _react = require("react");
|
|
13
|
-
|
|
14
10
|
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
15
|
-
|
|
16
11
|
var _emotion = require("@instructure/emotion");
|
|
17
|
-
|
|
18
12
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
19
|
-
|
|
20
13
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
21
|
-
|
|
22
14
|
var _props = require("./props");
|
|
23
|
-
|
|
24
15
|
const _excluded = ["as", "styles"];
|
|
25
|
-
|
|
26
16
|
var _dec, _class, _class2;
|
|
27
|
-
|
|
28
17
|
/**
|
|
29
18
|
---
|
|
30
19
|
parent: Options
|
|
@@ -36,21 +25,17 @@ id: Options.Separator
|
|
|
36
25
|
let Separator = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_class2 = class Separator extends _react.Component {
|
|
37
26
|
componentDidMount() {
|
|
38
27
|
var _this$props$makeStyle, _this$props;
|
|
39
|
-
|
|
40
28
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
41
29
|
}
|
|
42
|
-
|
|
43
30
|
componentDidUpdate() {
|
|
44
31
|
var _this$props$makeStyle2, _this$props2;
|
|
45
|
-
|
|
46
32
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
47
33
|
}
|
|
48
|
-
|
|
49
34
|
render() {
|
|
50
35
|
const _this$props3 = this.props,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
36
|
+
as = _this$props3.as,
|
|
37
|
+
styles = _this$props3.styles,
|
|
38
|
+
rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
|
|
54
39
|
const ElementType = (0, _uiReactUtils.getElementType)(Separator, this.props, () => as);
|
|
55
40
|
return (0, _emotion.jsx)(ElementType, {
|
|
56
41
|
role: "none"
|
|
@@ -59,7 +44,6 @@ let Separator = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
59
44
|
role: "presentation"
|
|
60
45
|
})));
|
|
61
46
|
}
|
|
62
|
-
|
|
63
47
|
}, _class2.displayName = "Separator", _class2.componentId = 'Options.Separator', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
|
64
48
|
as: 'span'
|
|
65
49
|
}, _class2)) || _class);
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
/*
|
|
13
10
|
* The MIT License (MIT)
|
|
14
11
|
*
|
|
@@ -32,6 +29,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
32
29
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
30
|
* SOFTWARE.
|
|
34
31
|
*/
|
|
32
|
+
|
|
35
33
|
const propTypes = {
|
|
36
34
|
as: _propTypes.default.elementType
|
|
37
35
|
};
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* The MIT License (MIT)
|
|
10
9
|
*
|
|
@@ -50,6 +49,5 @@ const generateStyle = componentTheme => {
|
|
|
50
49
|
}
|
|
51
50
|
};
|
|
52
51
|
};
|
|
53
|
-
|
|
54
52
|
var _default = generateStyle;
|
|
55
53
|
exports.default = _default;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.optionsSeparatorThemeGenerator = exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* The MIT License (MIT)
|
|
10
9
|
*
|
|
@@ -36,17 +35,17 @@ exports.optionsSeparatorThemeGenerator = exports.default = void 0;
|
|
|
36
35
|
*/
|
|
37
36
|
const generateComponentTheme = theme => {
|
|
38
37
|
const borders = theme.borders,
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
colors = theme.colors,
|
|
39
|
+
spacing = theme.spacing;
|
|
41
40
|
const componentVariables = {
|
|
42
41
|
background: colors === null || colors === void 0 ? void 0 : colors.backgroundMedium,
|
|
43
42
|
height: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
|
|
44
43
|
margin: `0 ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`
|
|
45
44
|
};
|
|
46
|
-
return {
|
|
45
|
+
return {
|
|
46
|
+
...componentVariables
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
|
-
|
|
50
49
|
exports.optionsSeparatorThemeGenerator = generateComponentTheme;
|
|
51
50
|
var _default = generateComponentTheme;
|
|
52
51
|
exports.default = _default;
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _uiIcons = require("@instructure/ui-icons");
|
|
13
|
-
|
|
14
10
|
var _index = require("../index");
|
|
15
|
-
|
|
16
11
|
/*
|
|
17
12
|
* The MIT License (MIT)
|
|
18
13
|
*
|
package/lib/Options/index.js
CHANGED
|
@@ -1,36 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = exports.Options = void 0;
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
10
|
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
15
|
-
|
|
16
11
|
var _uiTestable = require("@instructure/ui-testable");
|
|
17
|
-
|
|
18
12
|
var _uiView = require("@instructure/ui-view");
|
|
19
|
-
|
|
20
13
|
var _emotion = require("@instructure/emotion");
|
|
21
|
-
|
|
22
14
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
23
|
-
|
|
24
15
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
25
|
-
|
|
26
16
|
var _Item = require("./Item");
|
|
27
|
-
|
|
28
17
|
var _Separator = require("./Separator");
|
|
29
|
-
|
|
30
18
|
var _props = require("./props");
|
|
31
|
-
|
|
32
19
|
var _dec, _dec2, _dec3, _class, _class2;
|
|
33
|
-
|
|
34
20
|
/**
|
|
35
21
|
---
|
|
36
22
|
category: components
|
|
@@ -41,40 +27,30 @@ let Options = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emo
|
|
|
41
27
|
constructor() {
|
|
42
28
|
super(...arguments);
|
|
43
29
|
this.ref = null;
|
|
44
|
-
|
|
45
30
|
this.handleRef = el => {
|
|
46
31
|
this.ref = el;
|
|
47
32
|
};
|
|
48
|
-
|
|
49
33
|
this._labelId = this.props.deterministicId('Options-label');
|
|
50
34
|
}
|
|
51
|
-
|
|
52
35
|
componentDidMount() {
|
|
53
36
|
var _this$props$makeStyle, _this$props;
|
|
54
|
-
|
|
55
37
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
56
38
|
}
|
|
57
|
-
|
|
58
39
|
componentDidUpdate() {
|
|
59
40
|
var _this$props$makeStyle2, _this$props2;
|
|
60
|
-
|
|
61
41
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
62
42
|
}
|
|
63
|
-
|
|
64
43
|
get childAs() {
|
|
65
44
|
const as = this.props.as;
|
|
66
|
-
|
|
67
45
|
if (as === 'ul' || as === 'ol') {
|
|
68
46
|
return 'li';
|
|
69
47
|
}
|
|
70
|
-
|
|
71
48
|
return void 0;
|
|
72
49
|
}
|
|
73
|
-
|
|
74
50
|
renderLabel() {
|
|
75
51
|
const _this$props3 = this.props,
|
|
76
|
-
|
|
77
|
-
|
|
52
|
+
renderLabel = _this$props3.renderLabel,
|
|
53
|
+
styles = _this$props3.styles;
|
|
78
54
|
return (0, _emotion.jsx)("span", {
|
|
79
55
|
id: this._labelId,
|
|
80
56
|
role: "presentation",
|
|
@@ -82,7 +58,6 @@ let Options = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emo
|
|
|
82
58
|
css: styles === null || styles === void 0 ? void 0 : styles.label
|
|
83
59
|
}, (0, _uiReactUtils.callRenderProp)(renderLabel));
|
|
84
60
|
}
|
|
85
|
-
|
|
86
61
|
renderSubList(subOptions) {
|
|
87
62
|
const styles = this.props.styles;
|
|
88
63
|
return (0, _emotion.jsx)(_Item.Item, {
|
|
@@ -91,45 +66,37 @@ let Options = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emo
|
|
|
91
66
|
css: styles === null || styles === void 0 ? void 0 : styles.label
|
|
92
67
|
}, subOptions);
|
|
93
68
|
}
|
|
94
|
-
|
|
95
69
|
renderChildren() {
|
|
96
70
|
const children = this.props.children;
|
|
97
71
|
return _react.Children.map(children, child => {
|
|
98
72
|
if ((0, _uiReactUtils.matchComponentTypes)(child, ['Options'])) {
|
|
99
73
|
return this.renderSubList(child);
|
|
100
74
|
}
|
|
101
|
-
|
|
102
75
|
if ((0, _uiReactUtils.matchComponentTypes)(child, ['Item', 'Separator'])) {
|
|
103
76
|
return (0, _uiReactUtils.safeCloneElement)(child, {
|
|
104
77
|
as: this.childAs || child.props.as
|
|
105
78
|
});
|
|
106
79
|
}
|
|
107
|
-
|
|
108
80
|
return void 0;
|
|
109
81
|
});
|
|
110
82
|
}
|
|
111
|
-
|
|
112
83
|
get ariaLabelledby() {
|
|
113
84
|
if (this.props.renderLabel) {
|
|
114
85
|
return this._labelId;
|
|
115
86
|
}
|
|
116
|
-
|
|
117
87
|
if (this.props['aria-labelledby']) {
|
|
118
88
|
return this.props['aria-labelledby'];
|
|
119
89
|
}
|
|
120
|
-
|
|
121
90
|
return void 0;
|
|
122
91
|
}
|
|
123
|
-
|
|
124
92
|
render() {
|
|
125
93
|
const passthroughProps = _uiView.View.omitViewProps((0, _uiReactUtils.omitProps)(this.props, Options.allowedProps), Options);
|
|
126
|
-
|
|
127
94
|
const _this$props4 = this.props,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
95
|
+
as = _this$props4.as,
|
|
96
|
+
role = _this$props4.role,
|
|
97
|
+
renderLabel = _this$props4.renderLabel,
|
|
98
|
+
elementRef = _this$props4.elementRef,
|
|
99
|
+
styles = _this$props4.styles;
|
|
133
100
|
return (0, _emotion.jsx)("div", {
|
|
134
101
|
css: styles === null || styles === void 0 ? void 0 : styles.options,
|
|
135
102
|
role: "presentation",
|
|
@@ -146,7 +113,6 @@ let Options = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emo
|
|
|
146
113
|
"aria-labelledby": this.ariaLabelledby
|
|
147
114
|
}), this.renderChildren()));
|
|
148
115
|
}
|
|
149
|
-
|
|
150
116
|
}, _class2.displayName = "Options", _class2.componentId = 'Options', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
|
151
117
|
as: 'span',
|
|
152
118
|
role: 'list',
|
package/lib/Options/locator.js
CHANGED
package/lib/Options/props.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _uiPropTypes = require("@instructure/ui-prop-types");
|
|
13
|
-
|
|
14
10
|
/*
|
|
15
11
|
* The MIT License (MIT)
|
|
16
12
|
*
|
|
@@ -34,6 +30,7 @@ var _uiPropTypes = require("@instructure/ui-prop-types");
|
|
|
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
|
const propTypes = {
|
|
38
35
|
as: _propTypes.default.elementType,
|
|
39
36
|
role: _propTypes.default.string,
|
package/lib/Options/styles.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* The MIT License (MIT)
|
|
10
9
|
*
|
|
@@ -61,6 +60,5 @@ const generateStyle = componentTheme => {
|
|
|
61
60
|
}
|
|
62
61
|
};
|
|
63
62
|
};
|
|
64
|
-
|
|
65
63
|
var _default = generateStyle;
|
|
66
64
|
exports.default = _default;
|
package/lib/Options/theme.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.optionsThemeGenerator = exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* The MIT License (MIT)
|
|
10
9
|
*
|
|
@@ -36,8 +35,8 @@ exports.optionsThemeGenerator = exports.default = void 0;
|
|
|
36
35
|
*/
|
|
37
36
|
const generateComponentTheme = theme => {
|
|
38
37
|
const colors = theme.colors,
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
typography = theme.typography,
|
|
39
|
+
spacing = theme.spacing;
|
|
41
40
|
const componentVariables = {
|
|
42
41
|
labelFontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightBold,
|
|
43
42
|
background: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
|
|
@@ -45,10 +44,10 @@ const generateComponentTheme = theme => {
|
|
|
45
44
|
labelPadding: `${spacing === null || spacing === void 0 ? void 0 : spacing.xSmall} 0`,
|
|
46
45
|
nestedLabelPadding: `${spacing === null || spacing === void 0 ? void 0 : spacing.xSmall} ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`
|
|
47
46
|
};
|
|
48
|
-
return {
|
|
47
|
+
return {
|
|
48
|
+
...componentVariables
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
|
-
|
|
52
51
|
exports.optionsThemeGenerator = generateComponentTheme;
|
|
53
52
|
var _default = generateComponentTheme;
|
|
54
53
|
exports.default = _default;
|
package/lib/index.js
CHANGED
|
@@ -27,11 +27,7 @@ Object.defineProperty(exports, "optionsThemeGenerator", {
|
|
|
27
27
|
return _theme.optionsThemeGenerator;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
|
|
31
30
|
var _Options = require("./Options");
|
|
32
|
-
|
|
33
31
|
var _theme = require("./Options/theme");
|
|
34
|
-
|
|
35
32
|
var _theme2 = require("./Options/Item/theme");
|
|
36
|
-
|
|
37
33
|
var _theme3 = require("./Options/Separator/theme");
|