@instructure/ui-menu 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-menu
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-menu
@@ -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,16 @@ exports.allowedProps = void 0;
28
22
  * SOFTWARE.
29
23
  */
30
24
 
31
- const allowedProps = exports.allowedProps = ['label', 'allowMultiple', 'children', 'selected', 'defaultSelected', 'onSelect', 'onMouseOver', 'controls', 'itemRef', 'disabled', 'isTabbable'];
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
+ removeConsole: process.env.NODE_ENV === 'production',
33
+ transformImports: Boolean(process.env.TRANSFORM_IMPORTS)
34
+ }
35
+ ]
36
+ ]
37
+ }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@instructure/ui-menu",
3
- "version": "11.6.0",
3
+ "version": "11.6.1-pr-snapshot-1779894247159",
4
+ "type": "module",
4
5
  "description": "A dropdown menu component",
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",
@@ -16,27 +16,27 @@
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.27.6",
18
18
  "keycode": "^2",
19
- "@instructure/console": "11.6.0",
20
- "@instructure/emotion": "11.6.0",
21
- "@instructure/shared-types": "11.6.0",
22
- "@instructure/ui-dom-utils": "11.6.0",
23
- "@instructure/ui-a11y-utils": "11.6.0",
24
- "@instructure/ui-icons": "11.6.0",
25
- "@instructure/ui-react-utils": "11.6.0",
26
- "@instructure/ui-utils": "11.6.0",
27
- "@instructure/ui-view": "11.6.0",
28
- "@instructure/ui-popover": "11.6.0",
29
- "@instructure/ui-position": "11.6.0"
19
+ "@instructure/console": "11.6.1-pr-snapshot-1779894247159",
20
+ "@instructure/emotion": "11.6.1-pr-snapshot-1779894247159",
21
+ "@instructure/shared-types": "11.6.1-pr-snapshot-1779894247159",
22
+ "@instructure/ui-a11y-utils": "11.6.1-pr-snapshot-1779894247159",
23
+ "@instructure/ui-dom-utils": "11.6.1-pr-snapshot-1779894247159",
24
+ "@instructure/ui-icons": "11.6.1-pr-snapshot-1779894247159",
25
+ "@instructure/ui-popover": "11.6.1-pr-snapshot-1779894247159",
26
+ "@instructure/ui-position": "11.6.1-pr-snapshot-1779894247159",
27
+ "@instructure/ui-react-utils": "11.6.1-pr-snapshot-1779894247159",
28
+ "@instructure/ui-utils": "11.6.1-pr-snapshot-1779894247159",
29
+ "@instructure/ui-view": "11.6.1-pr-snapshot-1779894247159"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@testing-library/jest-dom": "^6.6.3",
33
33
  "@testing-library/react": "15.0.7",
34
34
  "@testing-library/user-event": "^14.6.1",
35
35
  "vitest": "^3.2.2",
36
- "@instructure/ui-axe-check": "11.6.0",
37
- "@instructure/ui-color-utils": "11.6.0",
38
- "@instructure/ui-babel-preset": "11.6.0",
39
- "@instructure/ui-themes": "11.6.0"
36
+ "@instructure/ui-axe-check": "11.6.1-pr-snapshot-1779894247159",
37
+ "@instructure/ui-babel-preset": "11.6.1-pr-snapshot-1779894247159",
38
+ "@instructure/ui-color-utils": "11.6.1-pr-snapshot-1779894247159",
39
+ "@instructure/ui-themes": "11.6.1-pr-snapshot-1779894247159"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": ">=18 <=19"
@@ -49,10 +49,8 @@
49
49
  ".": {
50
50
  "types": "./types/index.d.ts",
51
51
  "import": "./es/index.js",
52
- "require": "./lib/index.js",
53
52
  "default": "./es/index.js"
54
53
  },
55
- "./lib/*": "./lib/*",
56
54
  "./es/*": "./es/*",
57
55
  "./types/*": "./types/*",
58
56
  "./package.json": "./package.json",
@@ -62,7 +60,7 @@
62
60
  "lint": "ui-scripts lint",
63
61
  "lint:fix": "ui-scripts lint --fix",
64
62
  "clean": "ui-scripts clean",
65
- "build": "ui-scripts build --modules es,cjs",
63
+ "build": "ui-scripts build",
66
64
  "build:watch": "pnpm run ts:check -- --watch & ui-scripts build --watch",
67
65
  "build:types": "tsc -p tsconfig.build.json",
68
66
  "ts:check": "tsc -p tsconfig.build.json --noEmit --emitDeclarationOnly false"
@@ -1,231 +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.MenuItem = void 0;
8
- var _react = require("react");
9
- var _keycode = _interopRequireDefault(require("keycode"));
10
- var _IconCheckSolid2 = require("@instructure/ui-icons/lib/IconCheckSolid.js");
11
- var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/IconArrowOpenEndSolid.js");
12
- var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
13
- var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
14
- var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
15
- var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
16
- var _createChainedFunction = require("@instructure/ui-utils/lib/createChainedFunction.js");
17
- var _isActiveElement = require("@instructure/ui-dom-utils/lib/isActiveElement.js");
18
- var _findDOMNode = require("@instructure/ui-dom-utils/lib/findDOMNode.js");
19
- var _emotion = require("@instructure/emotion");
20
- var _MenuContext = require("../../MenuContext");
21
- var _styles = _interopRequireDefault(require("./styles"));
22
- var _theme = _interopRequireDefault(require("./theme"));
23
- var _props = require("./props");
24
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
25
- var _dec, _dec2, _class, _MenuItem, _IconCheckSolid, _IconArrowOpenEndSoli;
26
- /*
27
- * The MIT License (MIT)
28
- *
29
- * Copyright (c) 2015 - present Instructure, Inc.
30
- *
31
- * Permission is hereby granted, free of charge, to any person obtaining a copy
32
- * of this software and associated documentation files (the "Software"), to deal
33
- * in the Software without restriction, including without limitation the rights
34
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
35
- * copies of the Software, and to permit persons to whom the Software is
36
- * furnished to do so, subject to the following conditions:
37
- *
38
- * The above copyright notice and this permission notice shall be included in all
39
- * copies or substantial portions of the Software.
40
- *
41
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
44
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
45
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
46
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
47
- * SOFTWARE.
48
- */
49
- /**
50
- ---
51
- parent: Menu
52
- id: Menu.Item
53
- ---
54
- **/
55
- let MenuItem = exports.MenuItem = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_MenuItem = class MenuItem extends _react.Component {
56
- constructor(props) {
57
- super(props);
58
- this.labelId = void 0;
59
- this.ref = null;
60
- this.handleRef = el => {
61
- this.ref = el;
62
- };
63
- this.handleClick = e => {
64
- const _this$props = this.props,
65
- onSelect = _this$props.onSelect,
66
- onClick = _this$props.onClick,
67
- disabled = _this$props.disabled,
68
- value = _this$props.value;
69
- const selected = !this.selected;
70
- if (disabled) {
71
- e.preventDefault();
72
- return;
73
- }
74
- if (typeof this.props.selected === 'undefined') {
75
- this.setState({
76
- selected
77
- });
78
- }
79
- if (typeof onSelect === 'function') {
80
- e.persist();
81
- onSelect(e, value, selected, this);
82
- }
83
- if (typeof onClick === 'function') {
84
- onClick(e);
85
- }
86
- };
87
- this.handleKeyDown = e => {
88
- const spaceKey = e.keyCode === _keycode.default.codes.space;
89
- const enterKey = e.keyCode === _keycode.default.codes.enter;
90
- if (spaceKey || enterKey) {
91
- e.preventDefault();
92
- e.stopPropagation();
93
- if (enterKey) {
94
- // handle space key on keyUp for FF
95
- const refNode = (0, _findDOMNode.findDOMNode)(this.ref);
96
- refNode.click();
97
- }
98
- }
99
- };
100
- this.handleKeyUp = e => {
101
- const spaceKey = e.keyCode === _keycode.default.codes.space;
102
- const enterKey = e.keyCode === _keycode.default.codes.enter;
103
- if (spaceKey || enterKey) {
104
- e.preventDefault();
105
- e.stopPropagation();
106
- if (spaceKey) {
107
- const refNode = (0, _findDOMNode.findDOMNode)(this.ref);
108
- refNode.click();
109
- }
110
- }
111
- };
112
- this.handleMouseOver = event => {
113
- if (!this.focused) {
114
- this.focus();
115
- }
116
- if (typeof this.props.onMouseOver === 'function') {
117
- this.props.onMouseOver(event, this);
118
- }
119
- };
120
- if (typeof props.selected === 'undefined') {
121
- this.state = {
122
- selected: !!props.defaultSelected
123
- };
124
- }
125
- this.labelId = props.deterministicId('MenuItem__label');
126
- }
127
- get _node() {
128
- return this.ref;
129
- }
130
- componentDidMount() {
131
- var _this$props$makeStyle, _this$props2;
132
- (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
133
- const context = this.context;
134
- if (context && context.registerMenuItem) {
135
- context.registerMenuItem(this);
136
- }
137
- }
138
- componentDidUpdate() {
139
- var _this$props$makeStyle2, _this$props3;
140
- (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
141
- }
142
- componentWillUnmount() {
143
- const context = this.context;
144
- if (context && context.removeMenuItem) {
145
- context.removeMenuItem(this);
146
- }
147
- }
148
- get elementType() {
149
- return (0, _getElementType.getElementType)(MenuItem, this.props);
150
- }
151
- get role() {
152
- switch (this.props.type) {
153
- case 'checkbox':
154
- return 'menuitemcheckbox';
155
- case 'radio':
156
- return 'menuitemradio';
157
- default:
158
- return 'menuitem';
159
- }
160
- }
161
- get selected() {
162
- return typeof this.props.selected === 'undefined' ? this.state.selected : this.props.selected;
163
- }
164
- get focused() {
165
- return (0, _isActiveElement.isActiveElement)(this.ref);
166
- }
167
- focus() {
168
- const refNode = (0, _findDOMNode.findDOMNode)(this.ref);
169
- refNode.focus();
170
- }
171
- renderContent() {
172
- var _this$props$styles, _this$props$styles2, _this$props$styles3, _this$props$styles4;
173
- const _this$props4 = this.props,
174
- children = _this$props4.children,
175
- type = _this$props4.type,
176
- renderLabelInfo = _this$props4.renderLabelInfo;
177
- return (0, _jsxRuntime.jsxs)("span", {
178
- children: [(type === 'checkbox' || type === 'radio') && (0, _jsxRuntime.jsx)("span", {
179
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.icon,
180
- children: this.selected && (_IconCheckSolid || (_IconCheckSolid = (0, _jsxRuntime.jsx)(_IconCheckSolid2.IconCheckSolid, {})))
181
- }), (0, _jsxRuntime.jsx)("span", {
182
- css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.label,
183
- id: this.labelId,
184
- children: children
185
- }), type === 'flyout' && (0, _jsxRuntime.jsx)("span", {
186
- css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.icon,
187
- children: _IconArrowOpenEndSoli || (_IconArrowOpenEndSoli = (0, _jsxRuntime.jsx)(_IconArrowOpenEndSolid.IconArrowOpenEndSolid, {}))
188
- }), renderLabelInfo && (0, _jsxRuntime.jsx)("span", {
189
- css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.labelInfo,
190
- children: (0, _callRenderProp.callRenderProp)(renderLabelInfo)
191
- })]
192
- });
193
- }
194
- render() {
195
- var _this$props$styles5;
196
- const _this$props5 = this.props,
197
- disabled = _this$props5.disabled,
198
- controls = _this$props5.controls,
199
- onKeyDown = _this$props5.onKeyDown,
200
- onKeyUp = _this$props5.onKeyUp,
201
- type = _this$props5.type,
202
- href = _this$props5.href,
203
- target = _this$props5.target;
204
- const props = (0, _omitProps.omitProps)(this.props, MenuItem.allowedProps);
205
- const ElementType = this.elementType;
206
- return (0, _jsxRuntime.jsx)(ElementType, {
207
- tabIndex: -1 // note: tabIndex can be overridden by Menu or MenuItemGroup components
208
- ,
209
- ...props,
210
- href: href,
211
- target: target,
212
- role: this.role,
213
- "aria-labelledby": this.labelId,
214
- "aria-disabled": disabled ? 'true' : void 0,
215
- "aria-controls": controls,
216
- "aria-checked": type === 'checkbox' || type === 'radio' ? this.selected ? 'true' : 'false' : void 0,
217
- onClick: this.handleClick,
218
- onKeyUp: (0, _createChainedFunction.createChainedFunction)(onKeyUp, this.handleKeyUp),
219
- onKeyDown: (0, _createChainedFunction.createChainedFunction)(onKeyDown, this.handleKeyDown),
220
- ref: this.handleRef,
221
- css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.menuItem,
222
- onMouseOver: this.handleMouseOver,
223
- "data-cid": "MenuItem",
224
- children: this.renderContent()
225
- });
226
- }
227
- }, _MenuItem.displayName = "MenuItem", _MenuItem.componentId = 'Menu.Item', _MenuItem.allowedProps = _props.allowedProps, _MenuItem.defaultProps = {
228
- type: 'button',
229
- disabled: false
230
- }, _MenuItem.contextType = _MenuContext.MenuContext, _MenuItem)) || _class) || _class);
231
- var _default = exports.default = MenuItem;
@@ -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 = ['children', 'defaultSelected', 'selected', 'onSelect', 'onClick', 'onKeyDown', 'onKeyUp', 'onMouseOver', 'controls', 'disabled', 'as', 'type', 'value', 'href', 'target', 'renderLabelInfo'];
@@ -1,140 +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, props) => {
42
- const type = props.type,
43
- disabled = props.disabled;
44
- const isRadioOrCheckbox = type === 'checkbox' || type === 'radio';
45
- const flyoutIconStyles = type === 'flyout' ? {
46
- insetInlineStart: 'auto',
47
- insetInlineEnd: componentTheme.iconPadding
48
- } : {};
49
- const roleStyles = isRadioOrCheckbox ? {
50
- paddingInlineStart: componentTheme.labelPadding
51
- } : {};
52
- const roleIconStyles = isRadioOrCheckbox ? {
53
- insetInlineStart: componentTheme.iconPadding,
54
- insetInlineEnd: 'auto'
55
- } : {};
56
- const disabledStyles = disabled ? {
57
- cursor: 'not-allowed',
58
- pointerEvents: 'none',
59
- opacity: 0.5
60
- } : {};
61
- const linkStyles = {
62
- textDecoration: 'none'
63
- };
64
- return {
65
- menuItem: {
66
- label: 'menuItem',
67
- position: 'relative',
68
- border: 'none',
69
- outline: 'none',
70
- padding: componentTheme.padding,
71
- margin: '0',
72
- width: '100%',
73
- borderRadius: 'initial',
74
- boxSizing: 'border-box',
75
- textAlign: 'start',
76
- cursor: 'pointer',
77
- userSelect: 'none',
78
- fontFamily: componentTheme.fontFamily,
79
- fontWeight: componentTheme.fontWeight,
80
- lineHeight: componentTheme.lineHeight,
81
- fontSize: componentTheme.fontSize,
82
- background: componentTheme.background,
83
- // Changing the following to display: flex; causes a VO
84
- // bug where items with role menuitem, menuitemcheckbox
85
- // and menuitemradio are selected twice with control+
86
- // option+space. So we set the display to block.
87
- display: 'block',
88
- textDecoration: 'none',
89
- ...roleStyles,
90
- '&:focus, &:active, &:hover': {
91
- background: componentTheme.activeBackground,
92
- '[class*="menuItem__label"]': {
93
- color: componentTheme.activeLabelColor
94
- },
95
- '[class*="menuItem__icon"]': {
96
- color: componentTheme.activeIconColor
97
- }
98
- },
99
- //removes extra ff button spacing
100
- '&::-moz-focus-inner': {
101
- padding: '0',
102
- margin: '0',
103
- border: '0'
104
- },
105
- ...disabledStyles,
106
- // NOTE: needs separate groups for `:is()` and `:-webkit-any()` because of css selector group validation (see https://www.w3.org/TR/selectors-3/#grouping)
107
- '&:is(a)': {
108
- '&, &:link, &:visited, &:active, &:hover, &:focus': linkStyles
109
- },
110
- '&:-webkit-any(a)': {
111
- '&, &:link, &:visited, &:active, &:hover, &:focus': linkStyles
112
- }
113
- },
114
- icon: {
115
- label: 'menuItem__icon',
116
- position: 'absolute',
117
- display: 'flex',
118
- alignItems: 'center',
119
- top: '0',
120
- width: '1em',
121
- height: '100%',
122
- color: componentTheme.iconColor,
123
- ...roleIconStyles,
124
- ...flyoutIconStyles
125
- },
126
- labelInfo: {
127
- label: 'menuItem__labelInfo',
128
- height: '100%',
129
- float: 'right',
130
- clear: 'right',
131
- paddingRight: '1.75rem',
132
- color: componentTheme.labelInfoColor
133
- },
134
- label: {
135
- label: 'menuItem__label',
136
- color: componentTheme.labelColor
137
- }
138
- };
139
- };
140
- var _default = exports.default = generateStyle;
@@ -1,70 +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
- * 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;
38
- const colors = theme.colors,
39
- typography = theme.typography,
40
- spacing = theme.spacing,
41
- themeName = theme.key;
42
- const themeSpecificStyle = {
43
- canvas: {
44
- labelColor: theme['ic-brand-font-color-dark'],
45
- iconColor: theme['ic-brand-font-color-dark'],
46
- activeBackground: theme['ic-brand-primary']
47
- }
48
- };
49
- const componentVariables = {
50
- padding: `${spacing === null || spacing === void 0 ? void 0 : spacing.xSmall} ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`,
51
- fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
52
- fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
53
- lineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeightCondensed,
54
- fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
55
- labelPadding: spacing === null || spacing === void 0 ? void 0 : spacing.large,
56
- labelColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.grey125125,
57
- background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.white1010,
58
- iconColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts3 = colors.contrasts) === null || _colors$contrasts3 === void 0 ? void 0 : _colors$contrasts3.grey125125,
59
- iconPadding: spacing === null || spacing === void 0 ? void 0 : spacing.small,
60
- activeBackground: colors === null || colors === void 0 ? void 0 : (_colors$contrasts4 = colors.contrasts) === null || _colors$contrasts4 === void 0 ? void 0 : _colors$contrasts4.blue4570,
61
- activeLabelColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts5 = colors.contrasts) === null || _colors$contrasts5 === void 0 ? void 0 : _colors$contrasts5.white1010,
62
- activeIconColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts6 = colors.contrasts) === null || _colors$contrasts6 === void 0 ? void 0 : _colors$contrasts6.white1010,
63
- labelInfoColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts7 = colors.contrasts) === null || _colors$contrasts7 === void 0 ? void 0 : _colors$contrasts7.grey5782
64
- };
65
- return {
66
- ...componentVariables,
67
- ...themeSpecificStyle[themeName]
68
- };
69
- };
70
- var _default = exports.default = generateComponentTheme;