@instructure/ui-options 11.6.0 → 11.6.1-pr-snapshot-1779894247159

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 CHANGED
@@ -3,6 +3,14 @@
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
+ ## [11.6.1-pr-snapshot-1779894247159](https://github.com/instructure/instructure-ui/compare/v11.6.0...v11.6.1-pr-snapshot-1779894247159) (2026-05-27)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-options
9
+
10
+
11
+
12
+
13
+
6
14
  # [11.6.0](https://github.com/instructure/instructure-ui/compare/v11.5.0...v11.6.0) (2026-02-18)
7
15
 
8
16
  **Note:** Version bump only for package @instructure/ui-options
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.allowedProps = void 0;
7
1
  /*
8
2
  * The MIT License (MIT)
9
3
  *
@@ -28,4 +22,14 @@ exports.allowedProps = void 0;
28
22
  * SOFTWARE.
29
23
  */
30
24
 
31
- const allowedProps = exports.allowedProps = ['as'];
25
+ module.exports = {
26
+ presets: [
27
+ [
28
+ require('@instructure/ui-babel-preset'),
29
+ {
30
+ coverage: Boolean(process.env.COVERAGE),
31
+ esModules: Boolean(process.env.ES_MODULES)
32
+ }
33
+ ]
34
+ ]
35
+ }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@instructure/ui-options",
3
- "version": "11.6.0",
3
+ "version": "11.6.1-pr-snapshot-1779894247159",
4
+ "type": "module",
4
5
  "description": "A view-only component for composing interactive lists and menus.",
5
6
  "author": "Instructure, Inc. Engineering and Product Design",
6
7
  "module": "./es/index.js",
7
- "main": "./lib/index.js",
8
8
  "types": "./types/index.d.ts",
9
9
  "repository": {
10
10
  "type": "git",
@@ -15,22 +15,22 @@
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.27.6",
18
- "@instructure/shared-types": "11.6.0",
19
- "@instructure/ui-react-utils": "11.6.0",
20
- "@instructure/emotion": "11.6.0",
21
- "@instructure/ui-icons": "11.6.0",
22
- "@instructure/ui-utils": "11.6.0",
23
- "@instructure/ui-view": "11.6.0"
18
+ "@instructure/emotion": "11.6.1-pr-snapshot-1779894247159",
19
+ "@instructure/shared-types": "11.6.1-pr-snapshot-1779894247159",
20
+ "@instructure/ui-react-utils": "11.6.1-pr-snapshot-1779894247159",
21
+ "@instructure/ui-icons": "11.6.1-pr-snapshot-1779894247159",
22
+ "@instructure/ui-utils": "11.6.1-pr-snapshot-1779894247159",
23
+ "@instructure/ui-view": "11.6.1-pr-snapshot-1779894247159"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@testing-library/jest-dom": "^6.6.3",
27
27
  "@testing-library/react": "15.0.7",
28
28
  "@testing-library/user-event": "^14.6.1",
29
29
  "vitest": "^3.2.2",
30
- "@instructure/ui-axe-check": "11.6.0",
31
- "@instructure/ui-babel-preset": "11.6.0",
32
- "@instructure/ui-color-utils": "11.6.0",
33
- "@instructure/ui-themes": "11.6.0"
30
+ "@instructure/ui-axe-check": "11.6.1-pr-snapshot-1779894247159",
31
+ "@instructure/ui-babel-preset": "11.6.1-pr-snapshot-1779894247159",
32
+ "@instructure/ui-color-utils": "11.6.1-pr-snapshot-1779894247159",
33
+ "@instructure/ui-themes": "11.6.1-pr-snapshot-1779894247159"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": ">=18 <=19"
@@ -43,10 +43,8 @@
43
43
  ".": {
44
44
  "types": "./types/index.d.ts",
45
45
  "import": "./es/index.js",
46
- "require": "./lib/index.js",
47
46
  "default": "./es/index.js"
48
47
  },
49
- "./lib/*": "./lib/*",
50
48
  "./es/*": "./es/*",
51
49
  "./types/*": "./types/*",
52
50
  "./package.json": "./package.json",
@@ -56,7 +54,7 @@
56
54
  "lint": "ui-scripts lint",
57
55
  "lint:fix": "ui-scripts lint --fix",
58
56
  "clean": "ui-scripts clean",
59
- "build": "ui-scripts build --modules es,cjs",
57
+ "build": "ui-scripts build",
60
58
  "build:watch": "pnpm run ts:check -- --watch & ui-scripts build --watch",
61
59
  "build:types": "tsc -p tsconfig.build.json",
62
60
  "ts:check": "tsc -p tsconfig.build.json --noEmit --emitDeclarationOnly false"
@@ -1,133 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.Item = void 0;
8
- var _react = require("react");
9
- var _uiReactUtils = require("@instructure/ui-react-utils");
10
- var _emotion = require("@instructure/emotion");
11
- var _styles = _interopRequireDefault(require("./styles"));
12
- var _theme = _interopRequireDefault(require("./theme"));
13
- var _props = require("./props");
14
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
15
- var _dec, _dec2, _class, _Item;
16
- /*
17
- * The MIT License (MIT)
18
- *
19
- * Copyright (c) 2015 - present Instructure, Inc.
20
- *
21
- * Permission is hereby granted, free of charge, to any person obtaining a copy
22
- * of this software and associated documentation files (the "Software"), to deal
23
- * in the Software without restriction, including without limitation the rights
24
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
- * copies of the Software, and to permit persons to whom the Software is
26
- * furnished to do so, subject to the following conditions:
27
- *
28
- * The above copyright notice and this permission notice shall be included in all
29
- * copies or substantial portions of the Software.
30
- *
31
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
- * SOFTWARE.
38
- */
39
- /**
40
- ---
41
- parent: Options
42
- id: Options.Item
43
- ---
44
- **/
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
- constructor(props) {
47
- super(props);
48
- this.ref = null;
49
- this._descriptionId = void 0;
50
- this._descriptionId = props.deterministicId('OptionsItem-description');
51
- }
52
- componentDidMount() {
53
- var _this$props$makeStyle, _this$props;
54
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
55
- }
56
- componentDidUpdate() {
57
- var _this$props$makeStyle2, _this$props2;
58
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
59
- }
60
- renderContent(renderLabel, contentVariant) {
61
- const _this$props3 = this.props,
62
- styles = _this$props3.styles,
63
- variant = _this$props3.variant,
64
- as = _this$props3.as,
65
- role = _this$props3.role,
66
- children = _this$props3.children;
67
- return (0, _jsxRuntime.jsx)("span", {
68
- css: [styles === null || styles === void 0 ? void 0 : styles.content, contentVariant],
69
- role: "presentation",
70
- "aria-hidden": "true",
71
- children: (0, _uiReactUtils.callRenderProp)(renderLabel, {
72
- variant,
73
- as,
74
- role,
75
- children
76
- })
77
- });
78
- }
79
- render() {
80
- const _this$props4 = this.props,
81
- as = _this$props4.as,
82
- href = _this$props4.href,
83
- role = _this$props4.role,
84
- styles = _this$props4.styles,
85
- description = _this$props4.description,
86
- descriptionRole = _this$props4.descriptionRole,
87
- renderBeforeLabel = _this$props4.renderBeforeLabel,
88
- renderAfterLabel = _this$props4.renderAfterLabel,
89
- elementRef = _this$props4.elementRef,
90
- children = _this$props4.children,
91
- voiceoverRoleBugWorkaround = _this$props4.voiceoverRoleBugWorkaround;
92
- const ElementType = (0, _uiReactUtils.getElementType)(Item, this.props, () => as);
93
- const InnerElementType = href ? 'a' : 'span';
94
- const passthroughProps = (0, _uiReactUtils.omitProps)(this.props, Item.allowedProps);
95
- const childrenContent = (0, _uiReactUtils.callRenderProp)(children);
96
- const descriptionContent = (0, _uiReactUtils.callRenderProp)(description);
97
- const ariaDescribedBy = this.props['aria-describedby'] || (descriptionContent ? this._descriptionId : void 0);
98
- return (0, _jsxRuntime.jsxs)(ElementType, {
99
- role: voiceoverRoleBugWorkaround ? role : 'none',
100
- "data-cid": "Options.Item",
101
- css: styles === null || styles === void 0 ? void 0 : styles.item,
102
- ref: element => {
103
- this.ref = element;
104
- if (typeof elementRef === 'function') {
105
- elementRef(element);
106
- }
107
- },
108
- "aria-describedby": voiceoverRoleBugWorkaround ? ariaDescribedBy : void 0,
109
- children: [(0, _jsxRuntime.jsxs)(InnerElementType, {
110
- ...passthroughProps,
111
- css: styles === null || styles === void 0 ? void 0 : styles.container,
112
- role: href || voiceoverRoleBugWorkaround ? void 0 : role,
113
- href: href,
114
- "aria-describedby": voiceoverRoleBugWorkaround ? void 0 : ariaDescribedBy,
115
- children: [childrenContent, descriptionContent && (0, _jsxRuntime.jsx)("span", {
116
- css: styles === null || styles === void 0 ? void 0 : styles.description,
117
- role: descriptionRole,
118
- id: this._descriptionId,
119
- children: descriptionContent
120
- })]
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
- });
123
- }
124
- }, _Item.displayName = "Item", _Item.componentId = 'Options.Item', _Item.allowedProps = _props.allowedProps, _Item.defaultProps = {
125
- as: 'span',
126
- variant: 'default',
127
- role: 'listitem',
128
- voiceoverRoleBugWorkaround: false,
129
- beforeLabelContentVAlign: 'center',
130
- afterLabelContentVAlign: 'center',
131
- isSelected: false
132
- }, _Item)) || _class) || _class);
133
- var _default = exports.default = Item;
@@ -1,31 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.allowedProps = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- const allowedProps = exports.allowedProps = ['as', 'variant', 'role', 'renderBeforeLabel', 'renderAfterLabel', 'beforeLabelContentVAlign', 'afterLabelContentVAlign', 'description', 'descriptionRole', 'voiceoverRoleBugWorkaround', 'href', 'elementRef', 'children', 'isSelected'];
@@ -1,195 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _uiReactUtils = require("@instructure/ui-react-utils");
8
- /*
9
- * The MIT License (MIT)
10
- *
11
- * Copyright (c) 2015 - present Instructure, Inc.
12
- *
13
- * Permission is hereby granted, free of charge, to any person obtaining a copy
14
- * of this software and associated documentation files (the "Software"), to deal
15
- * in the Software without restriction, including without limitation the rights
16
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
- * copies of the Software, and to permit persons to whom the Software is
18
- * furnished to do so, subject to the following conditions:
19
- *
20
- * The above copyright notice and this permission notice shall be included in all
21
- * copies or substantial portions of the Software.
22
- *
23
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
- * SOFTWARE.
30
- */
31
-
32
- /**
33
- * ---
34
- * private: true
35
- * ---
36
- * Generates the style object from the theme and provided additional information
37
- * @param {Object} componentTheme The theme variable object.
38
- * @param {Object} props the props of the component, the style is applied to
39
- * @param {Object} state the state of the component, the style is applied to
40
- * @return {Object} The final style object, which will be used in the component
41
- */
42
- const generateStyle = (componentTheme, props) => {
43
- const variant = props.variant,
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']);
51
-
52
- // used for label and description too
53
- const variantVariants = {
54
- highlighted: {
55
- background: componentTheme.highlightedBackground,
56
- color: componentTheme.highlightedLabelColor
57
- },
58
- selected: {
59
- background: componentTheme.selectedBackground,
60
- color: componentTheme.highlightedLabelColor
61
- },
62
- disabled: {
63
- cursor: 'not-allowed',
64
- opacity: 0.68
65
- },
66
- 'highlighted-disabled': {
67
- background: componentTheme.highlightedBackground,
68
- color: componentTheme.highlightedLabelColor,
69
- cursor: 'not-allowed'
70
- },
71
- 'selected-highlighted': {
72
- background: componentTheme.selectedHighlightedBackground,
73
- color: componentTheme.highlightedLabelColor
74
- },
75
- default: {
76
- transition: 'background 200ms'
77
- }
78
- };
79
- const getContentVAlign = type => {
80
- const vAlign = type === 'before' ? beforeLabelContentVAlign : afterLabelContentVAlign;
81
- const vOffset = type === 'before' ? componentTheme.beforeLabelContentVOffset : componentTheme.afterLabelContentVOffset;
82
- return {
83
- start: {
84
- alignItems: 'flex-start',
85
- paddingBlockStart: vOffset
86
- },
87
- center: {
88
- alignItems: 'center',
89
- paddingBlockStart: vOffset,
90
- paddingBlockEnd: vOffset
91
- },
92
- end: {
93
- alignItems: 'flex-end',
94
- paddingBlockEnd: vOffset
95
- }
96
- }[vAlign];
97
- };
98
- const linkStyles = {
99
- textDecoration: 'none',
100
- color: 'currentColor'
101
- };
102
- return {
103
- item: {
104
- label: 'optionItem',
105
- background: componentTheme.background,
106
- color: componentTheme.color,
107
- cursor: 'pointer',
108
- display: 'block',
109
- fontSize: componentTheme.fontSize,
110
- fontFamily: componentTheme.fontFamily,
111
- fontWeight: props.isSelected ? componentTheme.fontWeightSelected : componentTheme.fontWeight,
112
- lineHeight: componentTheme.lineHeight,
113
- outline: 'none',
114
- position: 'relative',
115
- userSelect: 'none',
116
- ...variantVariants[variant],
117
- ...(containsList && {
118
- cursor: 'default'
119
- }),
120
- // for nested items
121
- '[class*=-optionItem] &': {
122
- // except if it has icon before
123
- ...(!hasContentBeforeLabel && {
124
- '[class$=-optionItem__container]': {
125
- paddingInlineStart: componentTheme.nestedPadding
126
- },
127
- '[class$=-optionItem__content--before]': {
128
- insetInlineStart: componentTheme.nestedPadding
129
- }
130
- })
131
- }
132
- },
133
- container: {
134
- label: 'optionItem__container',
135
- display: 'block',
136
- outline: 'none',
137
- padding: componentTheme.padding,
138
- ...(containsList && {
139
- padding: '0'
140
- }),
141
- ...(hasContentBeforeLabel && {
142
- paddingInlineEnd: componentTheme.iconPadding,
143
- paddingInlineStart: `calc(${componentTheme.iconPadding} * 2 + 1em)`
144
- }),
145
- ...(hasContentAfterLabel && {
146
- paddingInlineEnd: `calc(${componentTheme.iconPadding} * 2 + 1em)`,
147
- paddingInlineStart: componentTheme.iconPadding
148
- }),
149
- ...(hasContentBeforeLabel && hasContentAfterLabel && {
150
- paddingInlineEnd: `calc(${componentTheme.iconPadding} * 2 + 1em)`,
151
- paddingInlineStart: `calc(${componentTheme.iconPadding} * 2 + 1em)`
152
- }),
153
- // NOTE: needs separate groups for `:is()` and `:-webkit-any()` because of css selector group validation (see https://www.w3.org/TR/selectors-3/#grouping)
154
- '&:is(a)': {
155
- '&, &:link, &:visited, &:active, &:hover, &:focus': linkStyles
156
- },
157
- '&:-webkit-any(a)': {
158
- '&, &:link, &:visited, &:active, &:hover, &:focus': linkStyles
159
- }
160
- },
161
- content: {
162
- label: 'optionItem__content',
163
- display: 'flex',
164
- height: '100%',
165
- boxSizing: 'border-box',
166
- pointerEvents: 'none',
167
- position: 'absolute',
168
- top: '0'
169
- },
170
- contentBefore: {
171
- label: 'optionItem__content--before',
172
- insetInlineEnd: 'auto',
173
- insetInlineStart: componentTheme.iconPadding,
174
- ...getContentVAlign('before')
175
- },
176
- contentAfter: {
177
- label: 'optionItem__content--after',
178
- insetInlineEnd: componentTheme.iconPadding,
179
- insetInlineStart: 'auto',
180
- ...getContentVAlign('after')
181
- },
182
- description: {
183
- label: 'optionItem__description',
184
- display: 'block',
185
- paddingBlockStart: componentTheme.descriptionPaddingStart,
186
- fontWeight: componentTheme.descriptionFontWeight,
187
- fontSize: componentTheme.descriptionFontSize,
188
- lineHeight: componentTheme.descriptionLineHeight,
189
- color: componentTheme.descriptionColor,
190
- ...variantVariants[variant],
191
- background: 'none' // needed to clear variant background
192
- }
193
- };
194
- };
195
- var _default = exports.default = generateStyle;
@@ -1,78 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.optionsItemThemeGenerator = exports.default = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- /**
32
- * Generates the theme object for the component from the theme and provided additional information
33
- * @param {Object} theme The actual theme object.
34
- * @return {Object} The final theme object with the overrides and component variables
35
- */
36
- const generateComponentTheme = theme => {
37
- var _colors$contrasts, _colors$contrasts2, _colors$contrasts3, _colors$contrasts4, _colors$contrasts5, _colors$contrasts6, _colors$contrasts7, _colors$contrasts8;
38
- const colors = theme.colors,
39
- typography = theme.typography,
40
- spacing = theme.spacing,
41
- themeName = theme.key;
42
- const themeSpecificStyle = {
43
- canvas: {
44
- color: theme['ic-brand-font-color-dark'],
45
- highlightedBackground: theme['ic-brand-primary']
46
- }
47
- };
48
- const componentVariables = {
49
- fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
50
- fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
51
- fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
52
- lineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeightCondensed,
53
- fontWeightSelected: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
54
- color: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.grey125125,
55
- background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.white1010,
56
- highlightedLabelColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts3 = colors.contrasts) === null || _colors$contrasts3 === void 0 ? void 0 : _colors$contrasts3.white1010,
57
- highlightedBackground: colors === null || colors === void 0 ? void 0 : (_colors$contrasts4 = colors.contrasts) === null || _colors$contrasts4 === void 0 ? void 0 : _colors$contrasts4.blue4570,
58
- selectedLabelColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts5 = colors.contrasts) === null || _colors$contrasts5 === void 0 ? void 0 : _colors$contrasts5.white1010,
59
- selectedBackground: colors === null || colors === void 0 ? void 0 : (_colors$contrasts6 = colors.contrasts) === null || _colors$contrasts6 === void 0 ? void 0 : _colors$contrasts6.grey4570,
60
- selectedHighlightedBackground: colors === null || colors === void 0 ? void 0 : (_colors$contrasts7 = colors.contrasts) === null || _colors$contrasts7 === void 0 ? void 0 : _colors$contrasts7.blue5782,
61
- padding: `${spacing === null || spacing === void 0 ? void 0 : spacing.xSmall} ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`,
62
- iconPadding: spacing === null || spacing === void 0 ? void 0 : spacing.small,
63
- nestedPadding: spacing === null || spacing === void 0 ? void 0 : spacing.small,
64
- beforeLabelContentVOffset: '0.625rem',
65
- afterLabelContentVOffset: '0.625rem',
66
- descriptionFontSize: typography.fontSizeSmall,
67
- descriptionFontWeight: typography.fontWeightNormal,
68
- descriptionLineHeight: typography.lineHeight,
69
- descriptionPaddingStart: '0.25em',
70
- descriptionColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts8 = colors.contrasts) === null || _colors$contrasts8 === void 0 ? void 0 : _colors$contrasts8.grey5782
71
- };
72
- return {
73
- ...componentVariables,
74
- ...themeSpecificStyle[themeName]
75
- };
76
- };
77
- exports.optionsItemThemeGenerator = generateComponentTheme;
78
- var _default = exports.default = generateComponentTheme;
@@ -1,75 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.Separator = void 0;
8
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
- var _react = require("react");
10
- var _uiReactUtils = require("@instructure/ui-react-utils");
11
- var _emotion = require("@instructure/emotion");
12
- var _styles = _interopRequireDefault(require("./styles"));
13
- var _theme = _interopRequireDefault(require("./theme"));
14
- var _props = require("./props");
15
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
16
- const _excluded = ["as", "styles"];
17
- var _dec, _class, _Separator;
18
- /*
19
- * The MIT License (MIT)
20
- *
21
- * Copyright (c) 2015 - present Instructure, Inc.
22
- *
23
- * Permission is hereby granted, free of charge, to any person obtaining a copy
24
- * of this software and associated documentation files (the "Software"), to deal
25
- * in the Software without restriction, including without limitation the rights
26
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
27
- * copies of the Software, and to permit persons to whom the Software is
28
- * furnished to do so, subject to the following conditions:
29
- *
30
- * The above copyright notice and this permission notice shall be included in all
31
- * copies or substantial portions of the Software.
32
- *
33
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
36
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
37
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
38
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39
- * SOFTWARE.
40
- */
41
- /**
42
- ---
43
- parent: Options
44
- id: Options.Separator
45
- ---
46
- @module Separator
47
- **/
48
- let Separator = exports.Separator = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_Separator = class Separator extends _react.Component {
49
- componentDidMount() {
50
- var _this$props$makeStyle, _this$props;
51
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
52
- }
53
- componentDidUpdate() {
54
- var _this$props$makeStyle2, _this$props2;
55
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
56
- }
57
- render() {
58
- const _this$props3 = this.props,
59
- as = _this$props3.as,
60
- styles = _this$props3.styles,
61
- rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
62
- const ElementType = (0, _uiReactUtils.getElementType)(Separator, this.props, () => as);
63
- return (0, _jsxRuntime.jsx)(ElementType, {
64
- role: "none",
65
- children: (0, _jsxRuntime.jsx)("div", {
66
- ...(0, _uiReactUtils.omitProps)(rest, ['styles', 'makeStyles', 'themeOverride']),
67
- css: styles === null || styles === void 0 ? void 0 : styles.separator,
68
- role: "presentation"
69
- })
70
- });
71
- }
72
- }, _Separator.displayName = "Separator", _Separator.componentId = 'Options.Separator', _Separator.allowedProps = _props.allowedProps, _Separator.defaultProps = {
73
- as: 'span'
74
- }, _Separator)) || _class);
75
- var _default = exports.default = Separator;
@@ -1,52 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- /**
32
- * ---
33
- * private: true
34
- * ---
35
- * Generates the style object from the theme and provided additional information
36
- * @param {Object} componentTheme The theme variable object.
37
- * @param {Object} props the props of the component, the style is applied to
38
- * @param {Object} state the state of the component, the style is applied to
39
- * @return {Object} The final style object, which will be used in the component
40
- */
41
- const generateStyle = componentTheme => {
42
- return {
43
- separator: {
44
- label: 'separator',
45
- height: componentTheme.height,
46
- margin: componentTheme.margin,
47
- overflow: 'hidden',
48
- background: componentTheme.background
49
- }
50
- };
51
- };
52
- var _default = exports.default = generateStyle;
@@ -1,51 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.optionsSeparatorThemeGenerator = exports.default = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- /**
32
- * Generates the theme object for the component from the theme and provided additional information
33
- * @param {Object} theme The actual theme object.
34
- * @return {Object} The final theme object with the overrides and component variables
35
- */
36
- const generateComponentTheme = theme => {
37
- var _colors$contrasts;
38
- const borders = theme.borders,
39
- colors = theme.colors,
40
- spacing = theme.spacing;
41
- const componentVariables = {
42
- background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.grey3045,
43
- height: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
44
- margin: `0 ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`
45
- };
46
- return {
47
- ...componentVariables
48
- };
49
- };
50
- exports.optionsSeparatorThemeGenerator = generateComponentTheme;
51
- var _default = exports.default = generateComponentTheme;
@@ -1,153 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.Options = void 0;
8
- var _react = require("react");
9
- var _uiReactUtils = require("@instructure/ui-react-utils");
10
- var _uiView = require("@instructure/ui-view");
11
- var _emotion = require("@instructure/emotion");
12
- var _styles = _interopRequireDefault(require("./styles"));
13
- var _theme = _interopRequireDefault(require("./theme"));
14
- var _Item = require("./Item");
15
- var _Separator = require("./Separator");
16
- var _props = require("./props");
17
- var _uiUtils = require("@instructure/ui-utils");
18
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
19
- var _dec, _dec2, _class, _Options;
20
- /*
21
- * The MIT License (MIT)
22
- *
23
- * Copyright (c) 2015 - present Instructure, Inc.
24
- *
25
- * Permission is hereby granted, free of charge, to any person obtaining a copy
26
- * of this software and associated documentation files (the "Software"), to deal
27
- * in the Software without restriction, including without limitation the rights
28
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29
- * copies of the Software, and to permit persons to whom the Software is
30
- * furnished to do so, subject to the following conditions:
31
- *
32
- * The above copyright notice and this permission notice shall be included in all
33
- * copies or substantial portions of the Software.
34
- *
35
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
41
- * SOFTWARE.
42
- */
43
- /**
44
- ---
45
- category: components/utilities
46
- ---
47
- **/
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
- constructor(...args) {
50
- super(...args);
51
- this.ref = null;
52
- this.handleRef = el => {
53
- this.ref = el;
54
- };
55
- this._labelId = this.props.deterministicId('Options-label');
56
- }
57
- componentDidMount() {
58
- var _this$props$makeStyle, _this$props;
59
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
60
- }
61
- componentDidUpdate() {
62
- var _this$props$makeStyle2, _this$props2;
63
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
64
- }
65
- get childAs() {
66
- const as = this.props.as;
67
- if (as === 'ul' || as === 'ol') {
68
- return 'li';
69
- }
70
- return void 0;
71
- }
72
- renderLabel() {
73
- const _this$props3 = this.props,
74
- renderLabel = _this$props3.renderLabel,
75
- styles = _this$props3.styles;
76
- return (0, _jsxRuntime.jsx)("span", {
77
- id: this._labelId,
78
- role: "presentation"
79
- // because TalkBack and iOS VoiceOver don't announce sub-menu labels, aria-hidden needs to be false to achive that
80
- ,
81
- "aria-hidden": (0, _uiUtils.isAndroidOrIOS)() ? 'false' : 'true',
82
- css: styles === null || styles === void 0 ? void 0 : styles.label,
83
- children: (0, _uiReactUtils.callRenderProp)(renderLabel)
84
- });
85
- }
86
- renderSubList(subOptions) {
87
- const styles = this.props.styles;
88
- return (0, _jsxRuntime.jsx)(_Item.Item, {
89
- as: this.childAs,
90
- role: "presentation",
91
- css: styles === null || styles === void 0 ? void 0 : styles.label,
92
- children: subOptions
93
- });
94
- }
95
- renderChildren() {
96
- const children = this.props.children;
97
- return _react.Children.map(children, child => {
98
- if ((0, _uiReactUtils.matchComponentTypes)(child, ['Options'])) {
99
- return this.renderSubList(child);
100
- }
101
- if ((0, _uiReactUtils.matchComponentTypes)(child, ['Item', 'Separator'])) {
102
- return (0, _uiReactUtils.safeCloneElement)(child, {
103
- as: this.childAs || child.props.as
104
- });
105
- }
106
- return void 0;
107
- });
108
- }
109
- get ariaLabelledby() {
110
- if (this.props.renderLabel) {
111
- return this._labelId;
112
- }
113
- if (this.props['aria-labelledby']) {
114
- return this.props['aria-labelledby'];
115
- }
116
- return void 0;
117
- }
118
- render() {
119
- const passthroughProps = _uiView.View.omitViewProps((0, _uiReactUtils.omitProps)(this.props, Options.allowedProps), Options);
120
- const _this$props4 = this.props,
121
- as = _this$props4.as,
122
- role = _this$props4.role,
123
- renderLabel = _this$props4.renderLabel,
124
- elementRef = _this$props4.elementRef,
125
- styles = _this$props4.styles;
126
- return (0, _jsxRuntime.jsxs)("div", {
127
- css: styles === null || styles === void 0 ? void 0 : styles.options,
128
- role: "presentation",
129
- ref: this.handleRef,
130
- "data-cid": "Options",
131
- children: [renderLabel && this.renderLabel(), (0, _jsxRuntime.jsx)(_uiView.View, {
132
- ...passthroughProps,
133
- elementRef: elementRef,
134
- css: styles === null || styles === void 0 ? void 0 : styles.list,
135
- as: as,
136
- role: role,
137
- display: "block",
138
- margin: "none",
139
- padding: "none",
140
- background: "primary",
141
- "aria-labelledby": this.ariaLabelledby,
142
- children: this.renderChildren()
143
- })]
144
- });
145
- }
146
- }, _Options.displayName = "Options", _Options.componentId = 'Options', _Options.allowedProps = _props.allowedProps, _Options.defaultProps = {
147
- as: 'span',
148
- role: 'list',
149
- elementRef: () => {},
150
- renderLabel: null,
151
- children: null
152
- }, _Options.Item = _Item.Item, _Options.Separator = _Separator.Separator, _Options)) || _class) || _class);
153
- var _default = exports.default = Options;
@@ -1,31 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.allowedProps = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- const allowedProps = exports.allowedProps = ['as', 'role', 'elementRef', 'renderLabel', 'children'];
@@ -1,63 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- /**
32
- * ---
33
- * private: true
34
- * ---
35
- * Generates the style object from the theme and provided additional information
36
- * @param {Object} componentTheme The theme variable object.
37
- * @param {Object} props the props of the component, the style is applied to
38
- * @param {Object} state the state of the component, the style is applied to
39
- * @return {Object} The final style object, which will be used in the component
40
- */
41
- const generateStyle = componentTheme => {
42
- return {
43
- options: {
44
- label: 'options',
45
- boxSizing: 'border-box',
46
- wordWrap: 'break-word'
47
- },
48
- list: {
49
- label: 'options__list',
50
- listStyleType: 'none',
51
- position: 'relative'
52
- },
53
- label: {
54
- label: 'options__label',
55
- color: componentTheme.labelColor,
56
- cursor: 'default',
57
- display: 'block',
58
- fontWeight: componentTheme.labelFontWeight,
59
- padding: componentTheme.nestedLabelPadding
60
- }
61
- };
62
- };
63
- var _default = exports.default = generateStyle;
@@ -1,53 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.optionsThemeGenerator = exports.default = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- /**
32
- * Generates the theme object for the component from the theme and provided additional information
33
- * @param {Object} theme The actual theme object.
34
- * @return {Object} The final theme object with the overrides and component variables
35
- */
36
- const generateComponentTheme = theme => {
37
- var _colors$contrasts, _colors$contrasts2;
38
- const colors = theme.colors,
39
- typography = theme.typography,
40
- spacing = theme.spacing;
41
- const componentVariables = {
42
- labelFontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightBold,
43
- background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.white1010,
44
- labelColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.grey125125,
45
- labelPadding: `${spacing === null || spacing === void 0 ? void 0 : spacing.xSmall} 0`,
46
- nestedLabelPadding: `${spacing === null || spacing === void 0 ? void 0 : spacing.xSmall} ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`
47
- };
48
- return {
49
- ...componentVariables
50
- };
51
- };
52
- exports.optionsThemeGenerator = generateComponentTheme;
53
- var _default = exports.default = generateComponentTheme;
package/lib/index.js DELETED
@@ -1,47 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "OptionItem", {
7
- enumerable: true,
8
- get: function () {
9
- return _Item.Item;
10
- }
11
- });
12
- Object.defineProperty(exports, "OptionSeparator", {
13
- enumerable: true,
14
- get: function () {
15
- return _Separator.Separator;
16
- }
17
- });
18
- Object.defineProperty(exports, "Options", {
19
- enumerable: true,
20
- get: function () {
21
- return _Options.Options;
22
- }
23
- });
24
- Object.defineProperty(exports, "optionsItemThemeGenerator", {
25
- enumerable: true,
26
- get: function () {
27
- return _theme2.optionsItemThemeGenerator;
28
- }
29
- });
30
- Object.defineProperty(exports, "optionsSeparatorThemeGenerator", {
31
- enumerable: true,
32
- get: function () {
33
- return _theme3.optionsSeparatorThemeGenerator;
34
- }
35
- });
36
- Object.defineProperty(exports, "optionsThemeGenerator", {
37
- enumerable: true,
38
- get: function () {
39
- return _theme.optionsThemeGenerator;
40
- }
41
- });
42
- var _Options = require("./Options");
43
- var _Item = require("./Options/Item");
44
- var _Separator = require("./Options/Separator");
45
- var _theme = require("./Options/theme");
46
- var _theme2 = require("./Options/Item/theme");
47
- var _theme3 = require("./Options/Separator/theme");
package/lib/package.json DELETED
@@ -1 +0,0 @@
1
- {"type":"commonjs"}