@instructure/ui-options 11.6.0 → 11.6.1-snapshot-129
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 +36 -294
- package/es/Options/{Item → v1/Item}/index.js +1 -1
- package/es/Options/{Separator → v1/Separator}/index.js +1 -1
- package/es/Options/{index.js → v1/index.js} +2 -2
- package/es/Options/v2/Item/index.js +127 -0
- package/es/Options/v2/Item/props.js +26 -0
- package/es/Options/v2/Item/styles.js +189 -0
- package/es/Options/v2/Item/theme.js +72 -0
- package/es/Options/v2/Separator/index.js +69 -0
- package/es/Options/v2/Separator/props.js +26 -0
- package/es/Options/v2/Separator/styles.js +46 -0
- package/es/Options/v2/Separator/theme.js +45 -0
- package/es/Options/v2/index.js +147 -0
- package/es/Options/v2/props.js +26 -0
- package/es/Options/v2/styles.js +57 -0
- package/es/Options/v2/theme.js +47 -0
- package/es/{index.js → exports/a.js} +6 -6
- package/es/exports/b.js +29 -0
- package/lib/Options/{Item → v1/Item}/index.js +1 -1
- package/lib/Options/{Separator → v1/Separator}/index.js +1 -1
- package/lib/Options/v1/index.js +153 -0
- package/lib/Options/v2/Item/index.js +132 -0
- package/lib/Options/v2/Item/props.js +31 -0
- package/lib/Options/v2/Item/styles.js +195 -0
- package/lib/Options/v2/Item/theme.js +78 -0
- package/lib/Options/v2/Separator/index.js +74 -0
- package/lib/Options/v2/Separator/props.js +31 -0
- package/lib/Options/v2/Separator/styles.js +52 -0
- package/lib/Options/v2/Separator/theme.js +51 -0
- package/lib/Options/{index.js → v2/index.js} +4 -5
- package/lib/Options/v2/props.js +31 -0
- package/lib/Options/v2/styles.js +63 -0
- package/lib/Options/v2/theme.js +53 -0
- package/lib/{index.js → exports/a.js} +7 -7
- package/lib/exports/b.js +47 -0
- package/package.json +40 -18
- package/src/Options/{Item → v1/Item}/index.tsx +1 -1
- package/src/Options/{Separator → v1/Separator}/index.tsx +1 -1
- package/src/Options/{index.tsx → v1/index.tsx} +2 -2
- package/src/Options/v2/Item/index.tsx +180 -0
- package/src/Options/v2/Item/props.ts +136 -0
- package/src/Options/v2/Item/styles.ts +205 -0
- package/src/Options/v2/Item/theme.ts +79 -0
- package/src/Options/v2/README.md +409 -0
- package/src/Options/v2/Separator/index.tsx +79 -0
- package/src/Options/v2/Separator/props.ts +52 -0
- package/src/Options/v2/Separator/styles.ts +52 -0
- package/src/Options/v2/Separator/theme.ts +48 -0
- package/src/Options/v2/index.tsx +188 -0
- package/src/Options/v2/props.ts +76 -0
- package/src/Options/v2/styles.ts +63 -0
- package/src/Options/v2/theme.ts +52 -0
- package/src/{index.ts → exports/a.ts} +9 -9
- package/src/exports/b.ts +38 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Options/v1/Item/index.d.ts.map +1 -0
- package/types/Options/v1/Item/props.d.ts.map +1 -0
- package/types/Options/v1/Item/styles.d.ts.map +1 -0
- package/types/Options/v1/Item/theme.d.ts.map +1 -0
- package/types/Options/v1/Separator/index.d.ts.map +1 -0
- package/types/Options/v1/Separator/props.d.ts.map +1 -0
- package/types/Options/v1/Separator/styles.d.ts.map +1 -0
- package/types/Options/v1/Separator/theme.d.ts.map +1 -0
- package/types/Options/v1/index.d.ts.map +1 -0
- package/types/Options/v1/props.d.ts.map +1 -0
- package/types/Options/v1/styles.d.ts.map +1 -0
- package/types/Options/v1/theme.d.ts.map +1 -0
- package/types/Options/v2/Item/index.d.ts +31 -0
- package/types/Options/v2/Item/index.d.ts.map +1 -0
- package/types/Options/v2/Item/props.d.ts +70 -0
- package/types/Options/v2/Item/props.d.ts.map +1 -0
- package/types/Options/v2/Item/styles.d.ts +15 -0
- package/types/Options/v2/Item/styles.d.ts.map +1 -0
- package/types/Options/v2/Item/theme.d.ts +11 -0
- package/types/Options/v2/Item/theme.d.ts.map +1 -0
- package/types/Options/v2/Separator/index.d.ts +22 -0
- package/types/Options/v2/Separator/index.d.ts.map +1 -0
- package/types/Options/v2/Separator/props.d.ts +17 -0
- package/types/Options/v2/Separator/props.d.ts.map +1 -0
- package/types/Options/v2/Separator/styles.d.ts +15 -0
- package/types/Options/v2/Separator/styles.d.ts.map +1 -0
- package/types/Options/v2/Separator/theme.d.ts +11 -0
- package/types/Options/v2/Separator/theme.d.ts.map +1 -0
- package/types/Options/v2/index.d.ts +43 -0
- package/types/Options/v2/index.d.ts.map +1 -0
- package/types/Options/v2/props.d.ts +32 -0
- package/types/Options/v2/props.d.ts.map +1 -0
- package/types/Options/v2/styles.d.ts +15 -0
- package/types/Options/v2/styles.d.ts.map +1 -0
- package/types/Options/v2/theme.d.ts +11 -0
- package/types/Options/v2/theme.d.ts.map +1 -0
- package/types/exports/a.d.ts +10 -0
- package/types/exports/a.d.ts.map +1 -0
- package/types/exports/b.d.ts +10 -0
- package/types/exports/b.d.ts.map +1 -0
- package/types/Options/Item/index.d.ts.map +0 -1
- package/types/Options/Item/props.d.ts.map +0 -1
- package/types/Options/Item/styles.d.ts.map +0 -1
- package/types/Options/Item/theme.d.ts.map +0 -1
- package/types/Options/Separator/index.d.ts.map +0 -1
- package/types/Options/Separator/props.d.ts.map +0 -1
- package/types/Options/Separator/styles.d.ts.map +0 -1
- package/types/Options/Separator/theme.d.ts.map +0 -1
- package/types/Options/index.d.ts.map +0 -1
- package/types/Options/props.d.ts.map +0 -1
- package/types/Options/styles.d.ts.map +0 -1
- package/types/Options/theme.d.ts.map +0 -1
- package/types/index.d.ts +0 -10
- package/types/index.d.ts.map +0 -1
- /package/es/Options/{Item → v1/Item}/props.js +0 -0
- /package/es/Options/{Item → v1/Item}/styles.js +0 -0
- /package/es/Options/{Item → v1/Item}/theme.js +0 -0
- /package/es/Options/{Separator → v1/Separator}/props.js +0 -0
- /package/es/Options/{Separator → v1/Separator}/styles.js +0 -0
- /package/es/Options/{Separator → v1/Separator}/theme.js +0 -0
- /package/es/Options/{props.js → v1/props.js} +0 -0
- /package/es/Options/{styles.js → v1/styles.js} +0 -0
- /package/es/Options/{theme.js → v1/theme.js} +0 -0
- /package/lib/Options/{Item → v1/Item}/props.js +0 -0
- /package/lib/Options/{Item → v1/Item}/styles.js +0 -0
- /package/lib/Options/{Item → v1/Item}/theme.js +0 -0
- /package/lib/Options/{Separator → v1/Separator}/props.js +0 -0
- /package/lib/Options/{Separator → v1/Separator}/styles.js +0 -0
- /package/lib/Options/{Separator → v1/Separator}/theme.js +0 -0
- /package/lib/Options/{props.js → v1/props.js} +0 -0
- /package/lib/Options/{styles.js → v1/styles.js} +0 -0
- /package/lib/Options/{theme.js → v1/theme.js} +0 -0
- /package/src/Options/{Item → v1/Item}/props.ts +0 -0
- /package/src/Options/{Item → v1/Item}/styles.ts +0 -0
- /package/src/Options/{Item → v1/Item}/theme.ts +0 -0
- /package/src/Options/{README.md → v1/README.md} +0 -0
- /package/src/Options/{Separator → v1/Separator}/props.ts +0 -0
- /package/src/Options/{Separator → v1/Separator}/styles.ts +0 -0
- /package/src/Options/{Separator → v1/Separator}/theme.ts +0 -0
- /package/src/Options/{props.ts → v1/props.ts} +0 -0
- /package/src/Options/{styles.ts → v1/styles.ts} +0 -0
- /package/src/Options/{theme.ts → v1/theme.ts} +0 -0
- /package/types/Options/{Item → v1/Item}/index.d.ts +0 -0
- /package/types/Options/{Item → v1/Item}/props.d.ts +0 -0
- /package/types/Options/{Item → v1/Item}/styles.d.ts +0 -0
- /package/types/Options/{Item → v1/Item}/theme.d.ts +0 -0
- /package/types/Options/{Separator → v1/Separator}/index.d.ts +0 -0
- /package/types/Options/{Separator → v1/Separator}/props.d.ts +0 -0
- /package/types/Options/{Separator → v1/Separator}/styles.d.ts +0 -0
- /package/types/Options/{Separator → v1/Separator}/theme.d.ts +0 -0
- /package/types/Options/{index.d.ts → v1/index.d.ts} +0 -0
- /package/types/Options/{props.d.ts → v1/props.d.ts} +0 -0
- /package/types/Options/{styles.d.ts → v1/styles.d.ts} +0 -0
- /package/types/Options/{theme.d.ts → v1/theme.d.ts} +0 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
var _dec, _dec2, _class, _Item;
|
|
2
|
+
/*
|
|
3
|
+
* The MIT License (MIT)
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
* copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
* SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { Component } from 'react';
|
|
27
|
+
import { omitProps, getElementType, callRenderProp, withDeterministicId } from '@instructure/ui-react-utils';
|
|
28
|
+
import { withStyle } from '@instructure/emotion';
|
|
29
|
+
import generateStyles from "./styles.js";
|
|
30
|
+
import { allowedProps } from "./props.js";
|
|
31
|
+
/**
|
|
32
|
+
---
|
|
33
|
+
parent: Options
|
|
34
|
+
id: Options.Item
|
|
35
|
+
---
|
|
36
|
+
**/
|
|
37
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
38
|
+
let Item = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles), _dec(_class = _dec2(_class = (_Item = class Item extends Component {
|
|
39
|
+
constructor(props) {
|
|
40
|
+
super(props);
|
|
41
|
+
this.ref = null;
|
|
42
|
+
this._descriptionId = void 0;
|
|
43
|
+
this._descriptionId = props.deterministicId('OptionsItem-description');
|
|
44
|
+
}
|
|
45
|
+
componentDidMount() {
|
|
46
|
+
var _this$props$makeStyle, _this$props;
|
|
47
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
48
|
+
}
|
|
49
|
+
componentDidUpdate() {
|
|
50
|
+
var _this$props$makeStyle2, _this$props2;
|
|
51
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
52
|
+
}
|
|
53
|
+
renderContent(renderLabel, contentVariant) {
|
|
54
|
+
const _this$props3 = this.props,
|
|
55
|
+
styles = _this$props3.styles,
|
|
56
|
+
variant = _this$props3.variant,
|
|
57
|
+
as = _this$props3.as,
|
|
58
|
+
role = _this$props3.role,
|
|
59
|
+
children = _this$props3.children;
|
|
60
|
+
return _jsx("span", {
|
|
61
|
+
css: [styles === null || styles === void 0 ? void 0 : styles.content, contentVariant],
|
|
62
|
+
role: "presentation",
|
|
63
|
+
"aria-hidden": "true",
|
|
64
|
+
children: callRenderProp(renderLabel, {
|
|
65
|
+
variant,
|
|
66
|
+
as,
|
|
67
|
+
role,
|
|
68
|
+
children
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
render() {
|
|
73
|
+
const _this$props4 = this.props,
|
|
74
|
+
as = _this$props4.as,
|
|
75
|
+
href = _this$props4.href,
|
|
76
|
+
role = _this$props4.role,
|
|
77
|
+
styles = _this$props4.styles,
|
|
78
|
+
description = _this$props4.description,
|
|
79
|
+
descriptionRole = _this$props4.descriptionRole,
|
|
80
|
+
renderBeforeLabel = _this$props4.renderBeforeLabel,
|
|
81
|
+
renderAfterLabel = _this$props4.renderAfterLabel,
|
|
82
|
+
elementRef = _this$props4.elementRef,
|
|
83
|
+
children = _this$props4.children,
|
|
84
|
+
voiceoverRoleBugWorkaround = _this$props4.voiceoverRoleBugWorkaround;
|
|
85
|
+
const ElementType = getElementType(Item, this.props, () => as);
|
|
86
|
+
const InnerElementType = href ? 'a' : 'span';
|
|
87
|
+
const passthroughProps = omitProps(this.props, Item.allowedProps);
|
|
88
|
+
const childrenContent = callRenderProp(children);
|
|
89
|
+
const descriptionContent = callRenderProp(description);
|
|
90
|
+
const ariaDescribedBy = this.props['aria-describedby'] || (descriptionContent ? this._descriptionId : void 0);
|
|
91
|
+
return _jsxs(ElementType, {
|
|
92
|
+
role: voiceoverRoleBugWorkaround ? role : 'none',
|
|
93
|
+
"data-cid": "Options.Item",
|
|
94
|
+
css: styles === null || styles === void 0 ? void 0 : styles.item,
|
|
95
|
+
ref: element => {
|
|
96
|
+
this.ref = element;
|
|
97
|
+
if (typeof elementRef === 'function') {
|
|
98
|
+
elementRef(element);
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"aria-describedby": voiceoverRoleBugWorkaround ? ariaDescribedBy : void 0,
|
|
102
|
+
children: [_jsxs(InnerElementType, {
|
|
103
|
+
...passthroughProps,
|
|
104
|
+
css: styles === null || styles === void 0 ? void 0 : styles.container,
|
|
105
|
+
role: href || voiceoverRoleBugWorkaround ? void 0 : role,
|
|
106
|
+
href: href,
|
|
107
|
+
"aria-describedby": voiceoverRoleBugWorkaround ? void 0 : ariaDescribedBy,
|
|
108
|
+
children: [childrenContent, descriptionContent && _jsx("span", {
|
|
109
|
+
css: styles === null || styles === void 0 ? void 0 : styles.description,
|
|
110
|
+
role: descriptionRole,
|
|
111
|
+
id: this._descriptionId,
|
|
112
|
+
children: descriptionContent
|
|
113
|
+
})]
|
|
114
|
+
}), 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)]
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}, _Item.displayName = "Item", _Item.componentId = 'Options.Item', _Item.allowedProps = allowedProps, _Item.defaultProps = {
|
|
118
|
+
as: 'span',
|
|
119
|
+
variant: 'default',
|
|
120
|
+
role: 'listitem',
|
|
121
|
+
voiceoverRoleBugWorkaround: false,
|
|
122
|
+
beforeLabelContentVAlign: 'center',
|
|
123
|
+
afterLabelContentVAlign: 'center',
|
|
124
|
+
isSelected: false
|
|
125
|
+
}, _Item)) || _class) || _class);
|
|
126
|
+
export default Item;
|
|
127
|
+
export { Item };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const allowedProps = ['as', 'variant', 'role', 'renderBeforeLabel', 'renderAfterLabel', 'beforeLabelContentVAlign', 'afterLabelContentVAlign', 'description', 'descriptionRole', 'voiceoverRoleBugWorkaround', 'href', 'elementRef', 'children', 'isSelected'];
|
|
26
|
+
export { allowedProps };
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { matchComponentTypes } from '@instructure/ui-react-utils';
|
|
26
|
+
/**
|
|
27
|
+
* ---
|
|
28
|
+
* private: true
|
|
29
|
+
* ---
|
|
30
|
+
* Generates the style object from the theme and provided additional information
|
|
31
|
+
* @param {Object} componentTheme The theme variable object.
|
|
32
|
+
* @param {Object} props the props of the component, the style is applied to
|
|
33
|
+
* @param {Object} state the state of the component, the style is applied to
|
|
34
|
+
* @return {Object} The final style object, which will be used in the component
|
|
35
|
+
*/
|
|
36
|
+
const generateStyle = (componentTheme, props) => {
|
|
37
|
+
const variant = props.variant,
|
|
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
|
+
|
|
46
|
+
// used for label and description too
|
|
47
|
+
const variantVariants = {
|
|
48
|
+
highlighted: {
|
|
49
|
+
background: componentTheme.highlightedBackground,
|
|
50
|
+
color: componentTheme.highlightedLabelColor
|
|
51
|
+
},
|
|
52
|
+
selected: {
|
|
53
|
+
background: componentTheme.selectedBackground,
|
|
54
|
+
color: componentTheme.selectedLabelColor
|
|
55
|
+
},
|
|
56
|
+
disabled: {
|
|
57
|
+
cursor: 'not-allowed',
|
|
58
|
+
opacity: 0.68
|
|
59
|
+
},
|
|
60
|
+
'highlighted-disabled': {
|
|
61
|
+
background: componentTheme.highlightedBackground,
|
|
62
|
+
color: componentTheme.highlightedLabelColor,
|
|
63
|
+
cursor: 'not-allowed'
|
|
64
|
+
},
|
|
65
|
+
'selected-highlighted': {
|
|
66
|
+
background: componentTheme.selectedHighlightedBackground,
|
|
67
|
+
color: componentTheme.highlightedLabelColor
|
|
68
|
+
},
|
|
69
|
+
default: {
|
|
70
|
+
transition: 'background 200ms'
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const getContentVAlign = type => {
|
|
74
|
+
const vAlign = type === 'before' ? beforeLabelContentVAlign : afterLabelContentVAlign;
|
|
75
|
+
const vOffset = type === 'before' ? componentTheme.beforeLabelContentVOffset : componentTheme.afterLabelContentVOffset;
|
|
76
|
+
return {
|
|
77
|
+
start: {
|
|
78
|
+
alignItems: 'flex-start',
|
|
79
|
+
paddingBlockStart: vOffset
|
|
80
|
+
},
|
|
81
|
+
center: {
|
|
82
|
+
alignItems: 'center',
|
|
83
|
+
paddingBlockStart: vOffset,
|
|
84
|
+
paddingBlockEnd: vOffset
|
|
85
|
+
},
|
|
86
|
+
end: {
|
|
87
|
+
alignItems: 'flex-end',
|
|
88
|
+
paddingBlockEnd: vOffset
|
|
89
|
+
}
|
|
90
|
+
}[vAlign];
|
|
91
|
+
};
|
|
92
|
+
const linkStyles = {
|
|
93
|
+
textDecoration: 'none',
|
|
94
|
+
color: 'currentColor'
|
|
95
|
+
};
|
|
96
|
+
return {
|
|
97
|
+
item: {
|
|
98
|
+
label: 'optionItem',
|
|
99
|
+
background: componentTheme.background,
|
|
100
|
+
color: componentTheme.color,
|
|
101
|
+
cursor: 'pointer',
|
|
102
|
+
display: 'block',
|
|
103
|
+
fontSize: componentTheme.fontSize,
|
|
104
|
+
fontFamily: componentTheme.fontFamily,
|
|
105
|
+
fontWeight: props.isSelected ? componentTheme.fontWeightSelected : componentTheme.fontWeight,
|
|
106
|
+
lineHeight: componentTheme.lineHeight,
|
|
107
|
+
outline: 'none',
|
|
108
|
+
position: 'relative',
|
|
109
|
+
userSelect: 'none',
|
|
110
|
+
...variantVariants[variant],
|
|
111
|
+
...(containsList && {
|
|
112
|
+
cursor: 'default'
|
|
113
|
+
}),
|
|
114
|
+
// for nested items
|
|
115
|
+
'[class*=-optionItem] &': {
|
|
116
|
+
// except if it has icon before
|
|
117
|
+
...(!hasContentBeforeLabel && {
|
|
118
|
+
'[class$=-optionItem__container]': {
|
|
119
|
+
paddingInlineStart: componentTheme.nestedPadding
|
|
120
|
+
},
|
|
121
|
+
'[class$=-optionItem__content--before]': {
|
|
122
|
+
insetInlineStart: componentTheme.nestedPadding
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
container: {
|
|
128
|
+
label: 'optionItem__container',
|
|
129
|
+
display: 'block',
|
|
130
|
+
outline: 'none',
|
|
131
|
+
padding: `${componentTheme.paddingVertical} ${componentTheme.paddingHorizontal}`,
|
|
132
|
+
...(containsList && {
|
|
133
|
+
padding: '0'
|
|
134
|
+
}),
|
|
135
|
+
...(hasContentBeforeLabel && {
|
|
136
|
+
paddingInlineEnd: componentTheme.iconPadding,
|
|
137
|
+
paddingInlineStart: `calc(${componentTheme.iconPadding} * 2 + 1em)`
|
|
138
|
+
}),
|
|
139
|
+
...(hasContentAfterLabel && {
|
|
140
|
+
paddingInlineEnd: `calc(${componentTheme.iconPadding} * 2 + 1em)`,
|
|
141
|
+
paddingInlineStart: componentTheme.iconPadding
|
|
142
|
+
}),
|
|
143
|
+
...(hasContentBeforeLabel && hasContentAfterLabel && {
|
|
144
|
+
paddingInlineEnd: `calc(${componentTheme.iconPadding} * 2 + 1em)`,
|
|
145
|
+
paddingInlineStart: `calc(${componentTheme.iconPadding} * 2 + 1em)`
|
|
146
|
+
}),
|
|
147
|
+
// NOTE: needs separate groups for `:is()` and `:-webkit-any()` because of css selector group validation (see https://www.w3.org/TR/selectors-3/#grouping)
|
|
148
|
+
'&:is(a)': {
|
|
149
|
+
'&, &:link, &:visited, &:active, &:hover, &:focus': linkStyles
|
|
150
|
+
},
|
|
151
|
+
'&:-webkit-any(a)': {
|
|
152
|
+
'&, &:link, &:visited, &:active, &:hover, &:focus': linkStyles
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
content: {
|
|
156
|
+
label: 'optionItem__content',
|
|
157
|
+
display: 'flex',
|
|
158
|
+
height: '100%',
|
|
159
|
+
boxSizing: 'border-box',
|
|
160
|
+
pointerEvents: 'none',
|
|
161
|
+
position: 'absolute',
|
|
162
|
+
top: '0'
|
|
163
|
+
},
|
|
164
|
+
contentBefore: {
|
|
165
|
+
label: 'optionItem__content--before',
|
|
166
|
+
insetInlineEnd: 'auto',
|
|
167
|
+
insetInlineStart: componentTheme.iconPadding,
|
|
168
|
+
...getContentVAlign('before')
|
|
169
|
+
},
|
|
170
|
+
contentAfter: {
|
|
171
|
+
label: 'optionItem__content--after',
|
|
172
|
+
insetInlineEnd: componentTheme.iconPadding,
|
|
173
|
+
insetInlineStart: 'auto',
|
|
174
|
+
...getContentVAlign('after')
|
|
175
|
+
},
|
|
176
|
+
description: {
|
|
177
|
+
label: 'optionItem__description',
|
|
178
|
+
display: 'block',
|
|
179
|
+
paddingBlockStart: componentTheme.descriptionPaddingStart,
|
|
180
|
+
fontWeight: componentTheme.descriptionFontWeight,
|
|
181
|
+
fontSize: componentTheme.descriptionFontSize,
|
|
182
|
+
lineHeight: componentTheme.descriptionLineHeight,
|
|
183
|
+
color: componentTheme.descriptionColor,
|
|
184
|
+
...variantVariants[variant],
|
|
185
|
+
background: 'none' // needed to clear variant background
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
export default generateStyle;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Generates the theme object for the component from the theme and provided additional information
|
|
27
|
+
* @param {Object} theme The actual theme object.
|
|
28
|
+
* @return {Object} The final theme object with the overrides and component variables
|
|
29
|
+
*/
|
|
30
|
+
const generateComponentTheme = theme => {
|
|
31
|
+
var _colors$contrasts, _colors$contrasts2, _colors$contrasts3, _colors$contrasts4, _colors$contrasts5, _colors$contrasts6, _colors$contrasts7, _colors$contrasts8;
|
|
32
|
+
const colors = theme.colors,
|
|
33
|
+
typography = theme.typography,
|
|
34
|
+
spacing = theme.spacing,
|
|
35
|
+
themeName = theme.key;
|
|
36
|
+
const themeSpecificStyle = {
|
|
37
|
+
canvas: {
|
|
38
|
+
color: theme['ic-brand-font-color-dark'],
|
|
39
|
+
highlightedBackground: theme['ic-brand-primary']
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const componentVariables = {
|
|
43
|
+
fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
|
|
44
|
+
fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
|
|
45
|
+
fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
|
|
46
|
+
lineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeightCondensed,
|
|
47
|
+
fontWeightSelected: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
|
|
48
|
+
color: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.grey125125,
|
|
49
|
+
background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.white1010,
|
|
50
|
+
highlightedLabelColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts3 = colors.contrasts) === null || _colors$contrasts3 === void 0 ? void 0 : _colors$contrasts3.white1010,
|
|
51
|
+
highlightedBackground: colors === null || colors === void 0 ? void 0 : (_colors$contrasts4 = colors.contrasts) === null || _colors$contrasts4 === void 0 ? void 0 : _colors$contrasts4.blue4570,
|
|
52
|
+
selectedLabelColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts5 = colors.contrasts) === null || _colors$contrasts5 === void 0 ? void 0 : _colors$contrasts5.white1010,
|
|
53
|
+
selectedBackground: colors === null || colors === void 0 ? void 0 : (_colors$contrasts6 = colors.contrasts) === null || _colors$contrasts6 === void 0 ? void 0 : _colors$contrasts6.grey4570,
|
|
54
|
+
selectedHighlightedBackground: colors === null || colors === void 0 ? void 0 : (_colors$contrasts7 = colors.contrasts) === null || _colors$contrasts7 === void 0 ? void 0 : _colors$contrasts7.blue5782,
|
|
55
|
+
padding: `${spacing === null || spacing === void 0 ? void 0 : spacing.xSmall} ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`,
|
|
56
|
+
iconPadding: spacing === null || spacing === void 0 ? void 0 : spacing.small,
|
|
57
|
+
nestedPadding: spacing === null || spacing === void 0 ? void 0 : spacing.small,
|
|
58
|
+
beforeLabelContentVOffset: '0.625rem',
|
|
59
|
+
afterLabelContentVOffset: '0.625rem',
|
|
60
|
+
descriptionFontSize: typography.fontSizeSmall,
|
|
61
|
+
descriptionFontWeight: typography.fontWeightNormal,
|
|
62
|
+
descriptionLineHeight: typography.lineHeight,
|
|
63
|
+
descriptionPaddingStart: '0.25em',
|
|
64
|
+
descriptionColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts8 = colors.contrasts) === null || _colors$contrasts8 === void 0 ? void 0 : _colors$contrasts8.grey5782
|
|
65
|
+
};
|
|
66
|
+
return {
|
|
67
|
+
...componentVariables,
|
|
68
|
+
...themeSpecificStyle[themeName]
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
export { generateComponentTheme as optionsItemThemeGenerator };
|
|
72
|
+
export default generateComponentTheme;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
+
const _excluded = ["as", "styles"];
|
|
3
|
+
var _dec, _class, _Separator;
|
|
4
|
+
/*
|
|
5
|
+
* The MIT License (MIT)
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
* in the Software without restriction, including without limitation the rights
|
|
12
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
* furnished to do so, subject to the following conditions:
|
|
15
|
+
*
|
|
16
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
* copies or substantial portions of the Software.
|
|
18
|
+
*
|
|
19
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
* SOFTWARE.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import { Component } from 'react';
|
|
29
|
+
import { getElementType, omitProps } from '@instructure/ui-react-utils';
|
|
30
|
+
import { withStyle } from '@instructure/emotion';
|
|
31
|
+
import generateStyles from "./styles.js";
|
|
32
|
+
import { allowedProps } from "./props.js";
|
|
33
|
+
/**
|
|
34
|
+
---
|
|
35
|
+
parent: Options
|
|
36
|
+
id: Options.Separator
|
|
37
|
+
---
|
|
38
|
+
@module Separator
|
|
39
|
+
**/
|
|
40
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
41
|
+
let Separator = (_dec = withStyle(generateStyles), _dec(_class = (_Separator = class Separator extends Component {
|
|
42
|
+
componentDidMount() {
|
|
43
|
+
var _this$props$makeStyle, _this$props;
|
|
44
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
45
|
+
}
|
|
46
|
+
componentDidUpdate() {
|
|
47
|
+
var _this$props$makeStyle2, _this$props2;
|
|
48
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
49
|
+
}
|
|
50
|
+
render() {
|
|
51
|
+
const _this$props3 = this.props,
|
|
52
|
+
as = _this$props3.as,
|
|
53
|
+
styles = _this$props3.styles,
|
|
54
|
+
rest = _objectWithoutProperties(_this$props3, _excluded);
|
|
55
|
+
const ElementType = getElementType(Separator, this.props, () => as);
|
|
56
|
+
return _jsx(ElementType, {
|
|
57
|
+
role: "none",
|
|
58
|
+
children: _jsx("div", {
|
|
59
|
+
...omitProps(rest, ['styles', 'makeStyles', 'themeOverride']),
|
|
60
|
+
css: styles === null || styles === void 0 ? void 0 : styles.separator,
|
|
61
|
+
role: "presentation"
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}, _Separator.displayName = "Separator", _Separator.componentId = 'Options.Separator', _Separator.allowedProps = allowedProps, _Separator.defaultProps = {
|
|
66
|
+
as: 'span'
|
|
67
|
+
}, _Separator)) || _class);
|
|
68
|
+
export default Separator;
|
|
69
|
+
export { Separator };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const allowedProps = ['as'];
|
|
26
|
+
export { allowedProps };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* ---
|
|
27
|
+
* private: true
|
|
28
|
+
* ---
|
|
29
|
+
* Generates the style object from the theme and provided additional information
|
|
30
|
+
* @param {Object} componentTheme The theme variable object.
|
|
31
|
+
* @param {Object} props the props of the component, the style is applied to
|
|
32
|
+
* @param {Object} state the state of the component, the style is applied to
|
|
33
|
+
* @return {Object} The final style object, which will be used in the component
|
|
34
|
+
*/
|
|
35
|
+
const generateStyle = componentTheme => {
|
|
36
|
+
return {
|
|
37
|
+
separator: {
|
|
38
|
+
label: 'separator',
|
|
39
|
+
height: componentTheme.height,
|
|
40
|
+
margin: `${componentTheme.marginVertical} ${componentTheme.marginHorizontal}`,
|
|
41
|
+
overflow: 'hidden',
|
|
42
|
+
background: componentTheme.background
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export default generateStyle;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Generates the theme object for the component from the theme and provided additional information
|
|
27
|
+
* @param {Object} theme The actual theme object.
|
|
28
|
+
* @return {Object} The final theme object with the overrides and component variables
|
|
29
|
+
*/
|
|
30
|
+
const generateComponentTheme = theme => {
|
|
31
|
+
var _colors$contrasts;
|
|
32
|
+
const borders = theme.borders,
|
|
33
|
+
colors = theme.colors,
|
|
34
|
+
spacing = theme.spacing;
|
|
35
|
+
const componentVariables = {
|
|
36
|
+
background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.grey3045,
|
|
37
|
+
height: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
|
|
38
|
+
margin: `0 ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
...componentVariables
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export { generateComponentTheme as optionsSeparatorThemeGenerator };
|
|
45
|
+
export default generateComponentTheme;
|