@carbon/styles 1.109.0 → 1.110.0
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/css/styles.css +68 -45
- package/css/styles.min.css +1 -1
- package/package.json +9 -9
- package/scss/components/__tests__/accordion-test.js +81 -1
- package/scss/components/accordion/_accordion.scss +76 -51
- package/scss/components/link/_link.scss +0 -2
- package/scss/components/menu-button/_menu-button.scss +1 -1
- package/scss/components/multiselect/_multiselect.scss +2 -1
- package/scss/components/popover/_popover.scss +4 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/styles",
|
|
3
3
|
"description": "Styles for the Carbon Design System",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.110.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@carbon/colors": "^11.
|
|
44
|
-
"@carbon/feature-flags": "^1.
|
|
45
|
-
"@carbon/grid": "^11.
|
|
46
|
-
"@carbon/layout": "^11.
|
|
47
|
-
"@carbon/motion": "^11.
|
|
48
|
-
"@carbon/themes": "^11.
|
|
49
|
-
"@carbon/type": "^11.
|
|
43
|
+
"@carbon/colors": "^11.53.0",
|
|
44
|
+
"@carbon/feature-flags": "^1.4.0",
|
|
45
|
+
"@carbon/grid": "^11.57.0",
|
|
46
|
+
"@carbon/layout": "^11.54.0",
|
|
47
|
+
"@carbon/motion": "^11.47.0",
|
|
48
|
+
"@carbon/themes": "^11.76.0",
|
|
49
|
+
"@carbon/type": "^11.62.0",
|
|
50
50
|
"@ibm/plex": "6.4.1",
|
|
51
51
|
"@ibm/plex-mono": "1.1.0",
|
|
52
52
|
"@ibm/plex-sans": "1.1.0",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"scss/**/*.css",
|
|
76
76
|
"css/**/*.css"
|
|
77
77
|
],
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "30ca2b932469a5c89da10cb8d1fa82586ed14018"
|
|
79
79
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2018,
|
|
2
|
+
* Copyright IBM Corp. 2018, 2026
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
'use strict';
|
|
11
11
|
|
|
12
12
|
const { SassRenderer } = require('@carbon/test-utils/scss');
|
|
13
|
+
const css = require('css');
|
|
13
14
|
|
|
14
15
|
const { render } = SassRenderer.create(__dirname);
|
|
15
16
|
|
|
@@ -44,4 +45,83 @@ describe('scss/components/accordion', () => {
|
|
|
44
45
|
`);
|
|
45
46
|
expect(unwrap('direction')).toBe('row');
|
|
46
47
|
});
|
|
48
|
+
|
|
49
|
+
test('hover styles are only applied on devices that support hover', async () => {
|
|
50
|
+
const { result } = await render(`
|
|
51
|
+
@use '../accordion';
|
|
52
|
+
`);
|
|
53
|
+
const { stylesheet } = css.parse(
|
|
54
|
+
removeAtRule(result.css.toString(), '@starting-style')
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
function getAccordionHoverSelectors(rules, media = []) {
|
|
58
|
+
return rules.flatMap((rule) => {
|
|
59
|
+
if (rule.type === 'media') {
|
|
60
|
+
return getAccordionHoverSelectors(rule.rules, [...media, rule.media]);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (rule.type !== 'rule') {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return rule.selectors
|
|
68
|
+
.filter((selector) => {
|
|
69
|
+
return (
|
|
70
|
+
selector.includes('.cds--accordion') &&
|
|
71
|
+
selector.includes(':hover')
|
|
72
|
+
);
|
|
73
|
+
})
|
|
74
|
+
.map((selector) => {
|
|
75
|
+
return { media, selector };
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const hoverSelectors = getAccordionHoverSelectors(stylesheet.rules);
|
|
81
|
+
|
|
82
|
+
expect(hoverSelectors).toEqual(
|
|
83
|
+
expect.arrayContaining([
|
|
84
|
+
expect.objectContaining({
|
|
85
|
+
media: expect.arrayContaining([
|
|
86
|
+
expect.stringContaining('(any-hover: hover)'),
|
|
87
|
+
]),
|
|
88
|
+
selector: expect.stringContaining('.cds--accordion__heading:hover'),
|
|
89
|
+
}),
|
|
90
|
+
])
|
|
91
|
+
);
|
|
92
|
+
expect(
|
|
93
|
+
hoverSelectors.every(({ media }) => {
|
|
94
|
+
return media.some((query) => query.includes('(any-hover: hover)'));
|
|
95
|
+
})
|
|
96
|
+
).toBe(true);
|
|
97
|
+
});
|
|
47
98
|
});
|
|
99
|
+
|
|
100
|
+
function removeAtRule(cssText, atRule) {
|
|
101
|
+
const start = cssText.indexOf(atRule);
|
|
102
|
+
|
|
103
|
+
if (start === -1) {
|
|
104
|
+
return cssText;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const blockStart = cssText.indexOf('{', start);
|
|
108
|
+
let blockEnd = blockStart;
|
|
109
|
+
let depth = 0;
|
|
110
|
+
|
|
111
|
+
for (let i = blockStart; i < cssText.length; i++) {
|
|
112
|
+
if (cssText[i] === '{') {
|
|
113
|
+
depth++;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (cssText[i] === '}') {
|
|
117
|
+
depth--;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (depth === 0) {
|
|
121
|
+
blockEnd = i + 1;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return `${cssText.slice(0, start)}${cssText.slice(blockEnd)}`;
|
|
127
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright IBM Corp. 2018,
|
|
2
|
+
// Copyright IBM Corp. 2018, 2026
|
|
3
3
|
//
|
|
4
4
|
// This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
|
@@ -68,16 +68,18 @@ $content-padding: 0 0 0 $spacing-05 !default;
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
.#{$prefix}--accordion__item:not(.#{$prefix}--accordion__item--active) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
@media (any-hover: hover) {
|
|
72
|
+
// Blend border on hover
|
|
73
|
+
&:hover,
|
|
74
|
+
// Blend top border of the next component on hover
|
|
75
|
+
&:hover + .#{$prefix}--accordion__item {
|
|
76
|
+
border-block-start-color: $layer-hover;
|
|
77
|
+
}
|
|
77
78
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
// Blend bottom border of last item on hover
|
|
80
|
+
&:last-child:hover {
|
|
81
|
+
border-block-end-color: $layer-hover;
|
|
82
|
+
}
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
85
|
|
|
@@ -99,9 +101,11 @@ $content-padding: 0 0 0 $spacing-05 !default;
|
|
|
99
101
|
padding-inline-end: layout.density('padding-inline');
|
|
100
102
|
}
|
|
101
103
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
@media (any-hover: hover) {
|
|
105
|
+
&:hover {
|
|
106
|
+
background-color: $layer-hover;
|
|
107
|
+
outline: none;
|
|
108
|
+
}
|
|
105
109
|
}
|
|
106
110
|
|
|
107
111
|
&:focus {
|
|
@@ -137,8 +141,10 @@ $content-padding: 0 0 0 $spacing-05 !default;
|
|
|
137
141
|
fill: $icon-disabled;
|
|
138
142
|
}
|
|
139
143
|
|
|
140
|
-
|
|
141
|
-
|
|
144
|
+
@media (any-hover: hover) {
|
|
145
|
+
.#{$prefix}--accordion__heading[disabled]:hover::before {
|
|
146
|
+
background-color: transparent;
|
|
147
|
+
}
|
|
142
148
|
}
|
|
143
149
|
|
|
144
150
|
.#{$prefix}--accordion__item--disabled,
|
|
@@ -276,10 +282,7 @@ $content-padding: 0 0 0 $spacing-05 !default;
|
|
|
276
282
|
position: relative;
|
|
277
283
|
border-color: transparent;
|
|
278
284
|
|
|
279
|
-
&:last-child
|
|
280
|
-
&:hover,
|
|
281
|
-
&:last-child:hover,
|
|
282
|
-
&:hover + .#{$prefix}--accordion__item {
|
|
285
|
+
&:last-child {
|
|
283
286
|
border-color: transparent;
|
|
284
287
|
}
|
|
285
288
|
|
|
@@ -309,38 +312,50 @@ $content-padding: 0 0 0 $spacing-05 !default;
|
|
|
309
312
|
}
|
|
310
313
|
}
|
|
311
314
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
+
@media (any-hover: hover) {
|
|
316
|
+
.#{$prefix}--accordion--flush .#{$prefix}--accordion__item:hover,
|
|
317
|
+
.#{$prefix}--accordion--flush .#{$prefix}--accordion__item:last-child:hover,
|
|
318
|
+
.#{$prefix}--accordion--flush
|
|
319
|
+
.#{$prefix}--accordion__item:hover
|
|
320
|
+
+ .#{$prefix}--accordion__item {
|
|
321
|
+
border-color: transparent;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
315
324
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
display: block;
|
|
321
|
-
background: $layer-hover;
|
|
322
|
-
block-size: 1px;
|
|
323
|
-
content: '';
|
|
324
|
-
inline-size: 100%;
|
|
325
|
-
inset-inline-start: 0;
|
|
326
|
-
transition: background motion(standard, productive) $duration-fast-02;
|
|
325
|
+
@media (any-hover: hover) {
|
|
326
|
+
.#{$prefix}--accordion--flush .#{$prefix}--accordion__heading:hover {
|
|
327
|
+
position: relative;
|
|
328
|
+
z-index: 1;
|
|
327
329
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
+
// blend top/bottom border into heading hover state
|
|
331
|
+
&::before,
|
|
332
|
+
&::after {
|
|
333
|
+
position: absolute;
|
|
334
|
+
display: block;
|
|
335
|
+
background: $layer-hover;
|
|
336
|
+
block-size: 1px;
|
|
337
|
+
content: '';
|
|
338
|
+
inline-size: 100%;
|
|
339
|
+
inset-inline-start: 0;
|
|
340
|
+
transition: background motion(standard, productive) $duration-fast-02;
|
|
341
|
+
|
|
342
|
+
@media screen and (prefers-reduced-motion: reduce) {
|
|
343
|
+
transition: none;
|
|
344
|
+
}
|
|
330
345
|
}
|
|
331
|
-
}
|
|
332
346
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
347
|
+
&::before {
|
|
348
|
+
inset-block-start: -1px;
|
|
349
|
+
}
|
|
336
350
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
351
|
+
&::after {
|
|
352
|
+
inset-block-end: -1px;
|
|
353
|
+
}
|
|
340
354
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
355
|
+
&:focus::after,
|
|
356
|
+
&:focus::before {
|
|
357
|
+
background: none;
|
|
358
|
+
}
|
|
344
359
|
}
|
|
345
360
|
}
|
|
346
361
|
|
|
@@ -355,7 +370,6 @@ $content-padding: 0 0 0 $spacing-05 !default;
|
|
|
355
370
|
fill: $icon-primary;
|
|
356
371
|
pointer-events: none;
|
|
357
372
|
|
|
358
|
-
&:hover,
|
|
359
373
|
&:focus,
|
|
360
374
|
&:active {
|
|
361
375
|
border: none;
|
|
@@ -364,11 +378,22 @@ $content-padding: 0 0 0 $spacing-05 !default;
|
|
|
364
378
|
}
|
|
365
379
|
}
|
|
366
380
|
|
|
367
|
-
|
|
368
|
-
.#{$prefix}--
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
381
|
+
@media (any-hover: hover) {
|
|
382
|
+
.#{$prefix}--accordion.#{$prefix}--skeleton
|
|
383
|
+
.#{$prefix}--accordion__arrow:hover {
|
|
384
|
+
border: none;
|
|
385
|
+
cursor: default;
|
|
386
|
+
outline: none;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
@media (any-hover: hover) {
|
|
391
|
+
.#{$prefix}--accordion.#{$prefix}--skeleton
|
|
392
|
+
.#{$prefix}--accordion__heading:hover::before,
|
|
393
|
+
.#{$prefix}--accordion.#{$prefix}--skeleton
|
|
394
|
+
.#{$prefix}--accordion__heading:hover {
|
|
395
|
+
background-color: transparent;
|
|
396
|
+
}
|
|
372
397
|
}
|
|
373
398
|
|
|
374
399
|
.#{$prefix}--accordion--end.#{$prefix}--skeleton
|
|
@@ -85,12 +85,10 @@ $link-focus-text-color: custom-property.get-var(
|
|
|
85
85
|
text-decoration: none;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
.#{$prefix}--link.#{$prefix}--link--visited,
|
|
89
88
|
.#{$prefix}--link.#{$prefix}--link--visited:visited {
|
|
90
89
|
color: $link-visited-text-color;
|
|
91
90
|
}
|
|
92
91
|
|
|
93
|
-
.#{$prefix}--link.#{$prefix}--link--visited:hover,
|
|
94
92
|
.#{$prefix}--link.#{$prefix}--link--visited:visited:hover {
|
|
95
93
|
color: $link-hover-text-color;
|
|
96
94
|
}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
@use '../../theme' as *;
|
|
14
14
|
@use '../../utilities/convert';
|
|
15
15
|
@use '../../utilities/focus-outline' as *;
|
|
16
|
+
@use '../../utilities/layout';
|
|
16
17
|
|
|
17
18
|
/// Multi select styles
|
|
18
19
|
/// @access public
|
|
@@ -56,7 +57,7 @@
|
|
|
56
57
|
.#{$prefix}--multi-select.#{$prefix}--multi-select--selectall
|
|
57
58
|
.#{$prefix}--list-box__menu-item:first-child
|
|
58
59
|
.#{$prefix}--list-box__menu-item__option {
|
|
59
|
-
padding:
|
|
60
|
+
padding: calc((layout.size('height') - 1lh) / 2 - 1px) $spacing-05;
|
|
60
61
|
margin: 0;
|
|
61
62
|
border-block-end: 1px solid $border-subtle-01;
|
|
62
63
|
}
|
|
@@ -120,8 +120,10 @@ $popover-caret-height: custom-property.get-var(
|
|
|
120
120
|
@include focus-outline('outline');
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
@media (any-hover: hover) {
|
|
124
|
+
&:hover {
|
|
125
|
+
background-color: theme.$layer-hover;
|
|
126
|
+
}
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
svg {
|