@instructure/ui-options 11.7.8 → 11.7.9-pr-snapshot-1792147648392

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/es/Options/v1/Item/index.js +100 -129
  3. package/es/Options/v1/Item/props.js +17 -26
  4. package/es/Options/v1/Item/styles.js +143 -188
  5. package/es/Options/v1/Item/theme.js +37 -71
  6. package/es/Options/v1/Separator/index.js +44 -65
  7. package/es/Options/v1/Separator/props.js +4 -26
  8. package/es/Options/v1/Separator/styles.js +11 -45
  9. package/es/Options/v1/Separator/theme.js +11 -44
  10. package/es/Options/v1/index.js +125 -147
  11. package/es/Options/v1/props.js +8 -26
  12. package/es/Options/v1/styles.js +22 -56
  13. package/es/Options/v1/theme.js +13 -46
  14. package/es/Options/v2/Item/index.js +100 -129
  15. package/es/Options/v2/Item/props.js +17 -26
  16. package/es/Options/v2/Item/styles.js +143 -188
  17. package/es/Options/v2/Separator/index.js +44 -65
  18. package/es/Options/v2/Separator/props.js +4 -26
  19. package/es/Options/v2/Separator/styles.js +11 -45
  20. package/es/Options/v2/index.js +125 -147
  21. package/es/Options/v2/props.js +8 -26
  22. package/es/Options/v2/styles.js +22 -56
  23. package/es/exports/a.js +1 -25
  24. package/es/exports/b.js +1 -25
  25. package/package.json +13 -19
  26. package/tsconfig.build.json +0 -1
  27. package/tsconfig.build.tsbuildinfo +1 -1
  28. package/lib/Options/v1/Item/index.js +0 -142
  29. package/lib/Options/v1/Item/props.js +0 -31
  30. package/lib/Options/v1/Item/styles.js +0 -197
  31. package/lib/Options/v1/Item/theme.js +0 -79
  32. package/lib/Options/v1/Separator/index.js +0 -76
  33. package/lib/Options/v1/Separator/props.js +0 -31
  34. package/lib/Options/v1/Separator/styles.js +0 -52
  35. package/lib/Options/v1/Separator/theme.js +0 -52
  36. package/lib/Options/v1/index.js +0 -168
  37. package/lib/Options/v1/props.js +0 -31
  38. package/lib/Options/v1/styles.js +0 -63
  39. package/lib/Options/v1/theme.js +0 -54
  40. package/lib/Options/v2/Item/index.js +0 -141
  41. package/lib/Options/v2/Item/props.js +0 -31
  42. package/lib/Options/v2/Item/styles.js +0 -197
  43. package/lib/Options/v2/Separator/index.js +0 -75
  44. package/lib/Options/v2/Separator/props.js +0 -31
  45. package/lib/Options/v2/Separator/styles.js +0 -52
  46. package/lib/Options/v2/index.js +0 -167
  47. package/lib/Options/v2/props.js +0 -31
  48. package/lib/Options/v2/styles.js +0 -63
  49. package/lib/exports/a.js +0 -47
  50. package/lib/exports/b.js +0 -26
  51. package/lib/package.json +0 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,19 @@
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.7.9-pr-snapshot-1792147648392](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-pr-snapshot-1792147648392) (2026-10-16)
7
+
8
+ ### Build System
9
+
10
+ * **many:** replace babel with swc ([7e36c54](https://github.com/instructure/instructure-ui/commit/7e36c54d240b4fa483801c03ab18e7f860f561e2))
11
+
12
+ ### BREAKING CHANGES
13
+
14
+ * **many:** `@instructure/ui-babel-preset` and
15
+ `@instructure/browserslist-config-instui` are removed and will no longer be
16
+ published. Packages depend on `@swc/helpers` instead of `@babel/runtime`.
17
+
18
+
6
19
  ## [11.7.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
7
20
 
8
21
  **Note:** Version bump only for package @instructure/ui-options
@@ -1,138 +1,109 @@
1
- var _dec, _dec2, _class;
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
-
1
+ import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
26
3
  import { Component, createElement } from 'react';
27
4
  import { omitProps, getElementType, callRenderProp, withDeterministicId } from '@instructure/ui-react-utils';
28
5
  import { withStyle } from '@instructure/emotion';
29
6
  import generateStyles from './styles.js';
30
7
  import generateComponentTheme from './theme.js';
31
8
  import { allowedProps } from './props.js';
32
-
33
- /**
34
- ---
35
- parent: Options
36
- id: Options.Item
37
- ---
38
- **/
39
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
40
- let Item = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyles, generateComponentTheme), _dec(_class = _dec2(_class = class Item extends Component {
41
- static displayName = 'Item';
42
- static componentId = 'Options.Item';
43
- static allowedProps = allowedProps;
44
- static defaultProps = {
45
- as: 'span',
46
- variant: 'default',
47
- role: 'listitem',
48
- voiceoverRoleBugWorkaround: false,
49
- beforeLabelContentVAlign: 'center',
50
- afterLabelContentVAlign: 'center',
51
- isSelected: false
52
- };
53
- ref = null;
54
- _descriptionId;
55
- constructor(props) {
56
- super(props);
57
- this._descriptionId = props.deterministicId('OptionsItem-description');
58
- }
59
- componentDidMount() {
60
- this.props.makeStyles?.();
61
- }
62
- componentDidUpdate() {
63
- this.props.makeStyles?.();
64
- }
65
- renderContent(renderLabel, contentVariant) {
66
- const {
67
- styles,
68
- variant,
69
- as,
70
- role,
71
- children
72
- } = this.props;
73
- let labelContent;
74
- if (typeof renderLabel === 'function') {
75
- labelContent = /*#__PURE__*/createElement(renderLabel, {
76
- variant,
77
- as,
78
- role
79
- }, children);
80
- } else {
81
- labelContent = renderLabel;
9
+ class Item extends Component {
10
+ static{
11
+ this.displayName = 'Item';
12
+ }
13
+ static{
14
+ this.componentId = 'Options.Item';
15
+ }
16
+ static{
17
+ this.allowedProps = allowedProps;
18
+ }
19
+ static{
20
+ this.defaultProps = {
21
+ as: 'span',
22
+ variant: 'default',
23
+ role: 'listitem',
24
+ voiceoverRoleBugWorkaround: false,
25
+ beforeLabelContentVAlign: 'center',
26
+ afterLabelContentVAlign: 'center',
27
+ isSelected: false
28
+ };
82
29
  }
83
- return _jsx("span", {
84
- css: [styles?.content, contentVariant],
85
- role: "presentation",
86
- "aria-hidden": "true",
87
- children: labelContent
88
- });
89
- }
90
- render() {
91
- const {
92
- as,
93
- href,
94
- role,
95
- styles,
96
- description,
97
- descriptionRole,
98
- renderBeforeLabel,
99
- renderAfterLabel,
100
- elementRef,
101
- children,
102
- voiceoverRoleBugWorkaround
103
- } = this.props;
104
- const ElementType = getElementType(Item, this.props, () => as);
105
- const InnerElementType = href ? 'a' : 'span';
106
- const passthroughProps = omitProps(this.props, Item.allowedProps);
107
- const childrenContent = callRenderProp(children);
108
- const descriptionContent = callRenderProp(description);
109
- const ariaDescribedBy = this.props['aria-describedby'] || (descriptionContent ? this._descriptionId : undefined);
110
- return _jsxs(ElementType, {
111
- role: voiceoverRoleBugWorkaround ? role : 'none',
112
- "data-cid": "Options.Item",
113
- css: styles?.item,
114
- ref: element => {
115
- this.ref = element;
116
- if (typeof elementRef === 'function') {
117
- elementRef(element);
30
+ constructor(props){
31
+ super(props), this.ref = null;
32
+ this._descriptionId = props.deterministicId('OptionsItem-description');
33
+ }
34
+ componentDidMount() {
35
+ this.props.makeStyles?.();
36
+ }
37
+ componentDidUpdate() {
38
+ this.props.makeStyles?.();
39
+ }
40
+ renderContent(renderLabel, contentVariant) {
41
+ const { styles, variant, as, role, children } = this.props;
42
+ let labelContent;
43
+ if (typeof renderLabel === 'function') {
44
+ labelContent = /*#__PURE__*/ createElement(renderLabel, {
45
+ variant,
46
+ as,
47
+ role
48
+ }, children);
49
+ } else {
50
+ labelContent = renderLabel;
118
51
  }
119
- },
120
- "aria-describedby": voiceoverRoleBugWorkaround ? ariaDescribedBy : undefined,
121
- children: [_jsxs(InnerElementType, {
122
- ...passthroughProps,
123
- css: styles?.container,
124
- role: href || voiceoverRoleBugWorkaround ? undefined : role,
125
- href: href,
126
- "aria-describedby": voiceoverRoleBugWorkaround ? undefined : ariaDescribedBy,
127
- children: [childrenContent, descriptionContent && _jsx("span", {
128
- css: styles?.description,
129
- role: descriptionRole,
130
- id: this._descriptionId,
131
- children: descriptionContent
132
- })]
133
- }), renderBeforeLabel && this.renderContent(renderBeforeLabel, styles?.contentBefore), renderAfterLabel && this.renderContent(renderAfterLabel, styles?.contentAfter)]
134
- });
135
- }
136
- }) || _class) || _class);
52
+ return /*#__PURE__*/ _jsx("span", {
53
+ css: [
54
+ styles?.content,
55
+ contentVariant
56
+ ],
57
+ role: "presentation",
58
+ "aria-hidden": "true",
59
+ children: labelContent
60
+ });
61
+ }
62
+ render() {
63
+ const { as, href, role, styles, description, descriptionRole, renderBeforeLabel, renderAfterLabel, elementRef, children, voiceoverRoleBugWorkaround } = this.props;
64
+ const ElementType = getElementType(Item, this.props, ()=>as);
65
+ const InnerElementType = href ? 'a' : 'span';
66
+ const passthroughProps = omitProps(this.props, Item.allowedProps);
67
+ const childrenContent = callRenderProp(children);
68
+ const descriptionContent = callRenderProp(description);
69
+ const ariaDescribedBy = this.props['aria-describedby'] || (descriptionContent ? this._descriptionId : undefined);
70
+ return /*#__PURE__*/ _jsxs(ElementType, {
71
+ role: voiceoverRoleBugWorkaround ? role : 'none',
72
+ "data-cid": "Options.Item",
73
+ css: styles?.item,
74
+ ref: (element)=>{
75
+ this.ref = element;
76
+ if (typeof elementRef === 'function') {
77
+ elementRef(element);
78
+ }
79
+ },
80
+ "aria-describedby": voiceoverRoleBugWorkaround ? ariaDescribedBy : undefined,
81
+ children: [
82
+ /*#__PURE__*/ _jsxs(InnerElementType, {
83
+ ...passthroughProps,
84
+ css: styles?.container,
85
+ role: href || voiceoverRoleBugWorkaround ? undefined : role,
86
+ href: href,
87
+ "aria-describedby": voiceoverRoleBugWorkaround ? undefined : ariaDescribedBy,
88
+ children: [
89
+ childrenContent,
90
+ descriptionContent && /*#__PURE__*/ _jsx("span", {
91
+ css: styles?.description,
92
+ role: descriptionRole,
93
+ id: this._descriptionId,
94
+ children: descriptionContent
95
+ })
96
+ ]
97
+ }),
98
+ renderBeforeLabel && this.renderContent(renderBeforeLabel, styles?.contentBefore),
99
+ renderAfterLabel && this.renderContent(renderAfterLabel, styles?.contentAfter)
100
+ ]
101
+ });
102
+ }
103
+ }
104
+ Item = _ts_decorate([
105
+ withDeterministicId(),
106
+ withStyle(generateStyles, generateComponentTheme)
107
+ ], Item);
137
108
  export default Item;
138
- export { Item };
109
+ export { Item };
@@ -1,26 +1,17 @@
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 };
1
+ const allowedProps = [
2
+ 'as',
3
+ 'variant',
4
+ 'role',
5
+ 'renderBeforeLabel',
6
+ 'renderAfterLabel',
7
+ 'beforeLabelContentVAlign',
8
+ 'afterLabelContentVAlign',
9
+ 'description',
10
+ 'descriptionRole',
11
+ 'voiceoverRoleBugWorkaround',
12
+ 'href',
13
+ 'elementRef',
14
+ 'children',
15
+ 'isSelected'
16
+ ];
17
+ export { allowedProps };
@@ -1,191 +1,146 @@
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
1
  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 {
38
- variant,
39
- children,
40
- renderBeforeLabel: hasContentBeforeLabel,
41
- renderAfterLabel: hasContentAfterLabel,
42
- beforeLabelContentVAlign,
43
- afterLabelContentVAlign
44
- } = props;
45
- // TODO if children are () => ReactNode this wont match anything
46
- const containsList = matchComponentTypes(children, ['Options']);
47
-
48
- // used for label and description too
49
- const variantVariants = {
50
- highlighted: {
51
- background: componentTheme.highlightedBackground,
52
- color: componentTheme.highlightedLabelColor
53
- },
54
- selected: {
55
- background: componentTheme.selectedBackground,
56
- color: componentTheme.highlightedLabelColor
57
- },
58
- disabled: {
59
- cursor: 'not-allowed',
60
- opacity: 0.68
61
- },
62
- 'highlighted-disabled': {
63
- background: componentTheme.highlightedBackground,
64
- color: componentTheme.highlightedLabelColor,
65
- cursor: 'not-allowed'
66
- },
67
- 'selected-highlighted': {
68
- background: componentTheme.selectedHighlightedBackground,
69
- color: componentTheme.highlightedLabelColor
70
- },
71
- default: {
72
- transition: 'background 200ms'
73
- }
74
- };
75
- const getContentVAlign = type => {
76
- const vAlign = type === 'before' ? beforeLabelContentVAlign : afterLabelContentVAlign;
77
- const vOffset = type === 'before' ? componentTheme.beforeLabelContentVOffset : componentTheme.afterLabelContentVOffset;
2
+ const generateStyle = (componentTheme, props)=>{
3
+ const { variant, children, renderBeforeLabel: hasContentBeforeLabel, renderAfterLabel: hasContentAfterLabel, beforeLabelContentVAlign, afterLabelContentVAlign } = props;
4
+ const containsList = matchComponentTypes(children, [
5
+ 'Options'
6
+ ]);
7
+ const variantVariants = {
8
+ highlighted: {
9
+ background: componentTheme.highlightedBackground,
10
+ color: componentTheme.highlightedLabelColor
11
+ },
12
+ selected: {
13
+ background: componentTheme.selectedBackground,
14
+ color: componentTheme.highlightedLabelColor
15
+ },
16
+ disabled: {
17
+ cursor: 'not-allowed',
18
+ opacity: 0.68
19
+ },
20
+ 'highlighted-disabled': {
21
+ background: componentTheme.highlightedBackground,
22
+ color: componentTheme.highlightedLabelColor,
23
+ cursor: 'not-allowed'
24
+ },
25
+ 'selected-highlighted': {
26
+ background: componentTheme.selectedHighlightedBackground,
27
+ color: componentTheme.highlightedLabelColor
28
+ },
29
+ default: {
30
+ transition: 'background 200ms'
31
+ }
32
+ };
33
+ const getContentVAlign = (type)=>{
34
+ const vAlign = type === 'before' ? beforeLabelContentVAlign : afterLabelContentVAlign;
35
+ const vOffset = type === 'before' ? componentTheme.beforeLabelContentVOffset : componentTheme.afterLabelContentVOffset;
36
+ return ({
37
+ start: {
38
+ alignItems: 'flex-start',
39
+ paddingBlockStart: vOffset
40
+ },
41
+ center: {
42
+ alignItems: 'center',
43
+ paddingBlockStart: vOffset,
44
+ paddingBlockEnd: vOffset
45
+ },
46
+ end: {
47
+ alignItems: 'flex-end',
48
+ paddingBlockEnd: vOffset
49
+ }
50
+ })[vAlign];
51
+ };
52
+ const linkStyles = {
53
+ textDecoration: 'none',
54
+ color: 'currentColor'
55
+ };
78
56
  return {
79
- start: {
80
- alignItems: 'flex-start',
81
- paddingBlockStart: vOffset
82
- },
83
- center: {
84
- alignItems: 'center',
85
- paddingBlockStart: vOffset,
86
- paddingBlockEnd: vOffset
87
- },
88
- end: {
89
- alignItems: 'flex-end',
90
- paddingBlockEnd: vOffset
91
- }
92
- }[vAlign];
93
- };
94
- const linkStyles = {
95
- textDecoration: 'none',
96
- color: 'currentColor'
97
- };
98
- return {
99
- item: {
100
- label: 'optionItem',
101
- background: componentTheme.background,
102
- color: componentTheme.color,
103
- cursor: 'pointer',
104
- display: 'block',
105
- fontSize: componentTheme.fontSize,
106
- fontFamily: componentTheme.fontFamily,
107
- fontWeight: props.isSelected ? componentTheme.fontWeightSelected : componentTheme.fontWeight,
108
- lineHeight: componentTheme.lineHeight,
109
- outline: 'none',
110
- position: 'relative',
111
- userSelect: 'none',
112
- ...variantVariants[variant],
113
- ...(containsList && {
114
- cursor: 'default'
115
- }),
116
- // for nested items
117
- '[class*=-optionItem] &': {
118
- // except if it has icon before
119
- ...(!hasContentBeforeLabel && {
120
- '[class$=-optionItem__container]': {
121
- paddingInlineStart: componentTheme.nestedPadding
122
- },
123
- '[class$=-optionItem__content--before]': {
124
- insetInlineStart: componentTheme.nestedPadding
125
- }
126
- })
127
- }
128
- },
129
- container: {
130
- label: 'optionItem__container',
131
- display: 'block',
132
- outline: 'none',
133
- padding: componentTheme.padding,
134
- ...(containsList && {
135
- padding: '0'
136
- }),
137
- ...(hasContentBeforeLabel && {
138
- paddingInlineEnd: componentTheme.iconPadding,
139
- paddingInlineStart: `calc(${componentTheme.iconPadding} * 2 + 1em)`
140
- }),
141
- ...(hasContentAfterLabel && {
142
- paddingInlineEnd: `calc(${componentTheme.iconPadding} * 2 + 1em)`,
143
- paddingInlineStart: componentTheme.iconPadding
144
- }),
145
- ...(hasContentBeforeLabel && hasContentAfterLabel && {
146
- paddingInlineEnd: `calc(${componentTheme.iconPadding} * 2 + 1em)`,
147
- paddingInlineStart: `calc(${componentTheme.iconPadding} * 2 + 1em)`
148
- }),
149
- // NOTE: needs separate groups for `:is()` and `:-webkit-any()` because of css selector group validation (see https://www.w3.org/TR/selectors-3/#grouping)
150
- '&:is(a)': {
151
- '&, &:link, &:visited, &:active, &:hover, &:focus': linkStyles
152
- },
153
- '&:-webkit-any(a)': {
154
- '&, &:link, &:visited, &:active, &:hover, &:focus': linkStyles
155
- }
156
- },
157
- content: {
158
- label: 'optionItem__content',
159
- display: 'flex',
160
- height: '100%',
161
- boxSizing: 'border-box',
162
- pointerEvents: 'none',
163
- position: 'absolute',
164
- top: '0'
165
- },
166
- contentBefore: {
167
- label: 'optionItem__content--before',
168
- insetInlineEnd: 'auto',
169
- insetInlineStart: componentTheme.iconPadding,
170
- ...getContentVAlign('before')
171
- },
172
- contentAfter: {
173
- label: 'optionItem__content--after',
174
- insetInlineEnd: componentTheme.iconPadding,
175
- insetInlineStart: 'auto',
176
- ...getContentVAlign('after')
177
- },
178
- description: {
179
- label: 'optionItem__description',
180
- display: 'block',
181
- paddingBlockStart: componentTheme.descriptionPaddingStart,
182
- fontWeight: componentTheme.descriptionFontWeight,
183
- fontSize: componentTheme.descriptionFontSize,
184
- lineHeight: componentTheme.descriptionLineHeight,
185
- color: componentTheme.descriptionColor,
186
- ...variantVariants[variant],
187
- background: 'none' // needed to clear variant background
188
- }
189
- };
57
+ item: {
58
+ label: 'optionItem',
59
+ background: componentTheme.background,
60
+ color: componentTheme.color,
61
+ cursor: 'pointer',
62
+ display: 'block',
63
+ fontSize: componentTheme.fontSize,
64
+ fontFamily: componentTheme.fontFamily,
65
+ fontWeight: props.isSelected ? componentTheme.fontWeightSelected : componentTheme.fontWeight,
66
+ lineHeight: componentTheme.lineHeight,
67
+ outline: 'none',
68
+ position: 'relative',
69
+ userSelect: 'none',
70
+ ...variantVariants[variant],
71
+ ...containsList && {
72
+ cursor: 'default'
73
+ },
74
+ '[class*=-optionItem] &': {
75
+ ...!hasContentBeforeLabel && {
76
+ '[class$=-optionItem__container]': {
77
+ paddingInlineStart: componentTheme.nestedPadding
78
+ },
79
+ '[class$=-optionItem__content--before]': {
80
+ insetInlineStart: componentTheme.nestedPadding
81
+ }
82
+ }
83
+ }
84
+ },
85
+ container: {
86
+ label: 'optionItem__container',
87
+ display: 'block',
88
+ outline: 'none',
89
+ padding: componentTheme.padding,
90
+ ...containsList && {
91
+ padding: '0'
92
+ },
93
+ ...hasContentBeforeLabel && {
94
+ paddingInlineEnd: componentTheme.iconPadding,
95
+ paddingInlineStart: `calc(${componentTheme.iconPadding} * 2 + 1em)`
96
+ },
97
+ ...hasContentAfterLabel && {
98
+ paddingInlineEnd: `calc(${componentTheme.iconPadding} * 2 + 1em)`,
99
+ paddingInlineStart: componentTheme.iconPadding
100
+ },
101
+ ...hasContentBeforeLabel && hasContentAfterLabel && {
102
+ paddingInlineEnd: `calc(${componentTheme.iconPadding} * 2 + 1em)`,
103
+ paddingInlineStart: `calc(${componentTheme.iconPadding} * 2 + 1em)`
104
+ },
105
+ '&:is(a)': {
106
+ '&, &:link, &:visited, &:active, &:hover, &:focus': linkStyles
107
+ },
108
+ '&:-webkit-any(a)': {
109
+ '&, &:link, &:visited, &:active, &:hover, &:focus': linkStyles
110
+ }
111
+ },
112
+ content: {
113
+ label: 'optionItem__content',
114
+ display: 'flex',
115
+ height: '100%',
116
+ boxSizing: 'border-box',
117
+ pointerEvents: 'none',
118
+ position: 'absolute',
119
+ top: '0'
120
+ },
121
+ contentBefore: {
122
+ label: 'optionItem__content--before',
123
+ insetInlineEnd: 'auto',
124
+ insetInlineStart: componentTheme.iconPadding,
125
+ ...getContentVAlign('before')
126
+ },
127
+ contentAfter: {
128
+ label: 'optionItem__content--after',
129
+ insetInlineEnd: componentTheme.iconPadding,
130
+ insetInlineStart: 'auto',
131
+ ...getContentVAlign('after')
132
+ },
133
+ description: {
134
+ label: 'optionItem__description',
135
+ display: 'block',
136
+ paddingBlockStart: componentTheme.descriptionPaddingStart,
137
+ fontWeight: componentTheme.descriptionFontWeight,
138
+ fontSize: componentTheme.descriptionFontSize,
139
+ lineHeight: componentTheme.descriptionLineHeight,
140
+ color: componentTheme.descriptionColor,
141
+ ...variantVariants[variant],
142
+ background: 'none'
143
+ }
144
+ };
190
145
  };
191
- export default generateStyle;
146
+ export default generateStyle;