@carbon/styles 1.114.0-rc.0 → 1.114.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/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.114.0-rc.0",
4
+ "version": "1.114.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.57.0-rc.0",
44
- "@carbon/feature-flags": "^1.8.0-rc.0",
45
- "@carbon/grid": "^11.61.0-rc.0",
46
- "@carbon/layout": "^11.58.0-rc.0",
47
- "@carbon/motion": "^11.51.0-rc.0",
48
- "@carbon/themes": "^11.80.0-rc.0",
49
- "@carbon/type": "^11.66.0-rc.0",
43
+ "@carbon/colors": "^11.57.0",
44
+ "@carbon/feature-flags": "^1.8.0",
45
+ "@carbon/grid": "^11.61.0",
46
+ "@carbon/layout": "^11.58.0",
47
+ "@carbon/motion": "^11.51.0",
48
+ "@carbon/themes": "^11.80.0",
49
+ "@carbon/type": "^11.66.0",
50
50
  "@ibm/plex": "6.4.1",
51
51
  "@ibm/plex-mono": "2.5.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": "e848b98936051ac0026fb83551c91bfe603c589c"
78
+ "gitHead": "7518c84ffd00f22434fe19d83119692c12fccb2f"
79
79
  }
@@ -9,6 +9,7 @@
9
9
 
10
10
  'use strict';
11
11
 
12
+ const postcss = require('postcss');
12
13
  const { SassRenderer } = require('@carbon/test-utils/scss');
13
14
 
14
15
  const { render } = SassRenderer.create(__dirname);
@@ -69,4 +70,30 @@ describe('scss/components/button', () => {
69
70
  `);
70
71
  expect(unwrap('height')).toBe('2rem');
71
72
  });
73
+
74
+ test('icon-only ghost button does not apply active background on focus', async () => {
75
+ const { result } = await render(`
76
+ @use '../button';
77
+ `);
78
+
79
+ let focusRule;
80
+
81
+ postcss.parse(result.css.toString()).walkRules((rule) => {
82
+ if (rule.selector === '.cds--btn--icon-only.cds--btn--ghost:focus') {
83
+ focusRule = rule;
84
+ }
85
+ });
86
+
87
+ expect(focusRule).toBeDefined();
88
+
89
+ const declarations = focusRule.nodes
90
+ .filter((node) => node.type === 'decl')
91
+ .reduce((styles, node) => {
92
+ styles[node.prop] = node.value;
93
+ return styles;
94
+ }, {});
95
+
96
+ expect(declarations['background-color']).toBeUndefined();
97
+ expect(declarations['box-shadow']).toBeDefined();
98
+ });
72
99
  });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2018, 2023
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.
@@ -9,6 +9,7 @@
9
9
 
10
10
  'use strict';
11
11
 
12
+ const postcss = require('postcss');
12
13
  const { SassRenderer } = require('@carbon/test-utils/scss');
13
14
 
14
15
  const { render } = SassRenderer.create(__dirname);
@@ -24,4 +25,42 @@ describe('scss/components/overflow-menu', () => {
24
25
  `);
25
26
  expect(unwrap('mixin')).toBe(true);
26
27
  });
28
+
29
+ test('trigger hover styles are only applied on devices that support hover', async () => {
30
+ const { result } = await render(`
31
+ @use '../overflow-menu';
32
+ `);
33
+ const hoverRules = [];
34
+ const triggerSelector =
35
+ /\.cds--overflow-menu(?=[.:#\s>+~,\[]).*:hover|\.cds--overflow-menu__trigger(?=[.:#\s>+~,\[]).*:hover/;
36
+
37
+ postcss.parse(result.css.toString()).walkRules((rule) => {
38
+ if (triggerSelector.test(rule.selector)) {
39
+ hoverRules.push(rule);
40
+ }
41
+ });
42
+
43
+ expect(hoverRules.length).toBeGreaterThan(0);
44
+ expect(
45
+ hoverRules
46
+ .filter((rule) => {
47
+ let parent = rule.parent;
48
+
49
+ while (parent) {
50
+ if (
51
+ parent.type === 'atrule' &&
52
+ parent.name === 'media' &&
53
+ parent.params.includes('(any-hover: hover)')
54
+ ) {
55
+ return false;
56
+ }
57
+
58
+ parent = parent.parent;
59
+ }
60
+
61
+ return true;
62
+ })
63
+ .map((rule) => rule.selector)
64
+ ).toEqual([]);
65
+ });
27
66
  });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2018, 2023
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.
@@ -9,6 +9,7 @@
9
9
 
10
10
  'use strict';
11
11
 
12
+ const postcss = require('postcss');
12
13
  const { SassRenderer } = require('@carbon/test-utils/scss');
13
14
 
14
15
  const { render } = SassRenderer.create(__dirname);
@@ -24,4 +25,40 @@ describe('scss/components/structured-list', () => {
24
25
  `);
25
26
  expect(unwrap('mixin')).toBe(true);
26
27
  });
28
+
29
+ test('row hover styles are only applied on devices that support hover', async () => {
30
+ const { result } = await render(`
31
+ @use '../structured-list';
32
+ `);
33
+ const hoverRules = [];
34
+
35
+ postcss.parse(result.css.toString()).walkRules((rule) => {
36
+ if (rule.selector.includes('.cds--structured-list-row:hover')) {
37
+ hoverRules.push(rule);
38
+ }
39
+ });
40
+
41
+ expect(hoverRules.length).toBeGreaterThan(0);
42
+ expect(
43
+ hoverRules
44
+ .filter((rule) => {
45
+ let parent = rule.parent;
46
+
47
+ while (parent) {
48
+ if (
49
+ parent.type === 'atrule' &&
50
+ parent.name === 'media' &&
51
+ parent.params.includes('(any-hover: hover)')
52
+ ) {
53
+ return false;
54
+ }
55
+
56
+ parent = parent.parent;
57
+ }
58
+
59
+ return true;
60
+ })
61
+ .map((rule) => rule.selector)
62
+ ).toEqual([]);
63
+ });
27
64
  });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2018, 2023
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.
@@ -8,7 +8,6 @@
8
8
  */
9
9
 
10
10
  'use strict';
11
-
12
11
  const { SassRenderer } = require('@carbon/test-utils/scss');
13
12
 
14
13
  const { render } = SassRenderer.create(__dirname);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2018, 2023
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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2018, 2023
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.
@@ -9,6 +9,7 @@
9
9
 
10
10
  'use strict';
11
11
 
12
+ const postcss = require('postcss');
12
13
  const { SassRenderer } = require('@carbon/test-utils/scss');
13
14
 
14
15
  const { render } = SassRenderer.create(__dirname);
@@ -22,4 +23,62 @@ describe('scss/components/treeview', () => {
22
23
  `);
23
24
  expect(unwrap('mixin')).toBe(true);
24
25
  });
26
+
27
+ test('hover styles are only applied on devices that support hover', async () => {
28
+ const { result } = await render(`
29
+ @use '../treeview';
30
+ `);
31
+ const hoverRules = [];
32
+
33
+ postcss.parse(result.css.toString()).walkRules((rule) => {
34
+ if (
35
+ rule.selector.includes('.cds--tree') &&
36
+ rule.selector.includes(':hover')
37
+ ) {
38
+ hoverRules.push(rule);
39
+ }
40
+ });
41
+
42
+ expect(hoverRules.length).toBeGreaterThan(0);
43
+ expect(
44
+ hoverRules.some((rule) =>
45
+ rule.selector.includes('.cds--tree-node__label:hover')
46
+ )
47
+ ).toBe(true);
48
+ expect(
49
+ hoverRules.some(
50
+ (rule) =>
51
+ rule.selector.includes('.cds--tree-node--disabled') &&
52
+ rule.selector.includes('.cds--tree-node__label:hover')
53
+ )
54
+ ).toBe(true);
55
+ expect(
56
+ hoverRules.some(
57
+ (rule) =>
58
+ rule.selector.includes('.cds--tree-node--selected') &&
59
+ rule.selector.includes('.cds--tree-node__label:hover')
60
+ )
61
+ ).toBe(true);
62
+ expect(
63
+ hoverRules
64
+ .filter((rule) => {
65
+ let parent = rule.parent;
66
+
67
+ while (parent) {
68
+ if (
69
+ parent.type === 'atrule' &&
70
+ parent.name === 'media' &&
71
+ parent.params.includes('(any-hover: hover)')
72
+ ) {
73
+ return false;
74
+ }
75
+
76
+ parent = parent.parent;
77
+ }
78
+
79
+ return true;
80
+ })
81
+ .map((rule) => rule.selector)
82
+ ).toEqual([]);
83
+ });
25
84
  });
@@ -260,7 +260,6 @@
260
260
 
261
261
  &.#{$prefix}--btn--ghost {
262
262
  &:focus {
263
- background-color: $background-active;
264
263
  box-shadow: inset 0 0 0 $button-outline-width $button-focus-color;
265
264
  }
266
265
  }
@@ -1,5 +1,5 @@
1
1
  //
2
- // Copyright IBM Corp. 2016, 2023
2
+ // Copyright IBM Corp. 2016, 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.
@@ -122,8 +122,10 @@
122
122
  color: $text-disabled;
123
123
  }
124
124
 
125
- &:disabled:hover {
126
- border-block-end: 1px solid transparent;
125
+ @media (any-hover: hover) {
126
+ &:disabled:hover {
127
+ border-block-end: 1px solid transparent;
128
+ }
127
129
  }
128
130
 
129
131
  &::placeholder {
@@ -1,5 +1,5 @@
1
1
  //
2
- // Copyright IBM Corp. 2016, 2023
2
+ // Copyright IBM Corp. 2016, 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.
@@ -236,8 +236,10 @@
236
236
  transition: none;
237
237
  }
238
238
 
239
- &:hover {
240
- background-color: $layer-hover;
239
+ @media (any-hover: hover) {
240
+ &:hover {
241
+ background-color: $layer-hover;
242
+ }
241
243
  }
242
244
  }
243
245
 
@@ -247,9 +249,11 @@
247
249
  fill: $icon-disabled;
248
250
  }
249
251
 
250
- .flatpickr-next-month.disabled:hover svg,
251
- .flatpickr-prev-month.disabled:hover svg {
252
- fill: $icon-disabled;
252
+ @media (any-hover: hover) {
253
+ .flatpickr-next-month.disabled:hover svg,
254
+ .flatpickr-prev-month.disabled:hover svg {
255
+ fill: $icon-disabled;
256
+ }
253
257
  }
254
258
 
255
259
  .flatpickr-current-month {
@@ -265,8 +269,10 @@
265
269
  .flatpickr-current-month .cur-month {
266
270
  margin-inline: $spacing-02 $spacing-02;
267
271
 
268
- &:hover {
269
- background-color: $layer-hover;
272
+ @media (any-hover: hover) {
273
+ &:hover {
274
+ background-color: $layer-hover;
275
+ }
270
276
  }
271
277
  }
272
278
 
@@ -274,8 +280,10 @@
274
280
  position: relative;
275
281
  inline-size: convert.to-rem(60px);
276
282
 
277
- &:hover {
278
- background-color: $background-hover;
283
+ @media (any-hover: hover) {
284
+ &:hover {
285
+ background-color: $background-hover;
286
+ }
279
287
  }
280
288
  }
281
289
 
@@ -351,9 +359,11 @@
351
359
  inset-block-start: 33%;
352
360
  }
353
361
 
354
- &:hover::after {
355
- border-block-end-color: $button-primary;
356
- border-block-start-color: $button-primary;
362
+ @media (any-hover: hover) {
363
+ &:hover::after {
364
+ border-block-end-color: $button-primary;
365
+ border-block-start-color: $button-primary;
366
+ }
357
367
  }
358
368
 
359
369
  &:active::after {
@@ -370,14 +380,16 @@
370
380
  border-block-start-color: $text-disabled;
371
381
  }
372
382
 
373
- .numInputWrapper:hover .arrowUp,
374
- .numInputWrapper:hover .arrowDown {
375
- opacity: 1;
376
- }
383
+ @media (any-hover: hover) {
384
+ .numInputWrapper:hover .arrowUp,
385
+ .numInputWrapper:hover .arrowDown {
386
+ opacity: 1;
387
+ }
377
388
 
378
- .numInputWrapper:hover .numInput[disabled] ~ .arrowUp,
379
- .numInputWrapper:hover .numInput[disabled] ~ .arrowDown {
380
- opacity: 0;
389
+ .numInputWrapper:hover .numInput[disabled] ~ .arrowUp,
390
+ .numInputWrapper:hover .numInput[disabled] ~ .arrowDown {
391
+ opacity: 0;
392
+ }
381
393
  }
382
394
 
383
395
  .flatpickr-weekdays {
@@ -445,8 +457,10 @@
445
457
  inline-size: convert.to-rem(40px);
446
458
  transition: all $duration-fast-01 motion(standard, productive);
447
459
 
448
- &:hover {
449
- background: $layer-hover;
460
+ @media (any-hover: hover) {
461
+ &:hover {
462
+ background: $layer-hover;
463
+ }
450
464
  }
451
465
 
452
466
  &:focus {
@@ -522,11 +536,13 @@
522
536
  background: $layer-01;
523
537
  }
524
538
 
525
- .flatpickr-day.endRange:hover {
526
- @include focus-outline('outline');
539
+ @media (any-hover: hover) {
540
+ .flatpickr-day.endRange:hover {
541
+ @include focus-outline('outline');
527
542
 
528
- background: $layer-01;
529
- color: $text-primary;
543
+ background: $layer-01;
544
+ color: $text-primary;
545
+ }
530
546
  }
531
547
 
532
548
  .flatpickr-day.endRange.inRange.selected {
@@ -538,8 +554,10 @@
538
554
  color: $text-disabled;
539
555
  cursor: not-allowed;
540
556
 
541
- &:hover {
542
- background-color: transparent;
557
+ @media (any-hover: hover) {
558
+ &:hover {
559
+ background-color: transparent;
560
+ }
543
561
  }
544
562
  }
545
563
 
@@ -1,5 +1,5 @@
1
1
  //
2
- // Copyright IBM Corp. 2016, 2023
2
+ // Copyright IBM Corp. 2016, 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.
@@ -72,13 +72,18 @@
72
72
  outline-offset: -2px;
73
73
  transition: $duration-fast-02 motion(standard, productive);
74
74
 
75
- &:focus,
76
- &:hover {
75
+ @media (any-hover: hover) {
76
+ &:hover {
77
+ outline: 2px solid $focus;
78
+ text-decoration: underline;
79
+ }
80
+ }
81
+
82
+ &:focus {
77
83
  outline: 2px solid $focus;
84
+ text-decoration: underline;
78
85
  }
79
86
 
80
- &:hover,
81
- &:focus,
82
87
  &:active,
83
88
  &:active:visited {
84
89
  text-decoration: underline;
@@ -94,8 +99,14 @@
94
99
  cursor: no-drop;
95
100
  text-decoration: none;
96
101
  transition: none;
102
+ @media (any-hover: hover) {
103
+ &:hover {
104
+ color: $text-disabled;
105
+ outline: none;
106
+ text-decoration: none;
107
+ }
108
+ }
97
109
 
98
- &:hover,
99
110
  &:focus {
100
111
  color: $text-disabled;
101
112
  outline: none;
@@ -1,5 +1,5 @@
1
1
  //
2
- // Copyright IBM Corp. 2016, 2023
2
+ // Copyright IBM Corp. 2016, 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.
@@ -96,6 +96,7 @@
96
96
  inset-block-start: 0;
97
97
  inset-inline-start: 0;
98
98
  transition: background-color $duration-slow-02 motion(standard, expressive);
99
+ user-select: none;
99
100
  }
100
101
 
101
102
  .#{$prefix}--loading-overlay--stop {
@@ -50,8 +50,10 @@
50
50
  @include focus-outline('outline');
51
51
  }
52
52
 
53
- &:hover {
54
- background-color: $background-hover;
53
+ @media (any-hover: hover) {
54
+ &:hover {
55
+ background-color: $background-hover;
56
+ }
55
57
  }
56
58
  }
57
59
 
@@ -123,8 +125,10 @@
123
125
  }
124
126
  }
125
127
 
126
- .#{$prefix}--overflow-menu.#{$prefix}--overflow-menu--open:hover {
127
- background-color: $layer;
128
+ @media (any-hover: hover) {
129
+ .#{$prefix}--overflow-menu.#{$prefix}--overflow-menu--open:hover {
130
+ background-color: $layer;
131
+ }
128
132
  }
129
133
 
130
134
  .#{$prefix}--overflow-menu-options--light {
@@ -135,8 +139,10 @@
135
139
  }
136
140
  }
137
141
 
138
- .#{$prefix}--overflow-menu.#{$prefix}--overflow-menu--light.#{$prefix}--overflow-menu--open:hover {
139
- background-color: $layer-hover;
142
+ @media (any-hover: hover) {
143
+ .#{$prefix}--overflow-menu.#{$prefix}--overflow-menu--light.#{$prefix}--overflow-menu--open:hover {
144
+ background-color: $layer-hover;
145
+ }
140
146
  }
141
147
 
142
148
  .#{$prefix}--overflow-menu-options[data-floating-menu-direction='bottom']:not(
@@ -134,6 +134,14 @@
134
134
 
135
135
  .#{$prefix}--pagination__right {
136
136
  border-inline-start: 1px solid $border-subtle;
137
+
138
+ @container pagination (max-width: 42rem) {
139
+ border-inline-start: 0;
140
+ }
141
+
142
+ &.#{$prefix}--pagination__right--no-content {
143
+ border-inline-start: 0;
144
+ }
137
145
  }
138
146
 
139
147
  .#{$prefix}--pagination__left,
@@ -178,6 +186,10 @@
178
186
  .#{$prefix}--pagination__left {
179
187
  padding: 0 $spacing-05 0 0;
180
188
 
189
+ &.#{$prefix}--pagination__left--no-sizer {
190
+ padding: 0;
191
+ }
192
+
181
193
  // 42rem = 'md' breakpoint width
182
194
  @container pagination (min-width: 42rem) {
183
195
  padding: 0 $spacing-05;
@@ -92,9 +92,11 @@
92
92
  color $duration-fast-02 motion(standard, productive);
93
93
  user-select: none;
94
94
 
95
- &:hover {
96
- background-color: $background-color-hover;
97
- color: $text-primary;
95
+ @media (any-hover: hover) {
96
+ &:hover {
97
+ background-color: $background-color-hover;
98
+ color: $text-primary;
99
+ }
98
100
  }
99
101
 
100
102
  &:focus {
@@ -1,5 +1,5 @@
1
1
  //
2
- // Copyright IBM Corp. 2016, 2023
2
+ // Copyright IBM Corp. 2016, 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.
@@ -87,21 +87,23 @@
87
87
  border: none;
88
88
  }
89
89
 
90
- .#{$prefix}--structured-list--selection
91
- .#{$prefix}--structured-list-row:hover:not(
92
- .#{$prefix}--structured-list-row--header-row
93
- ):not(.#{$prefix}--structured-list-row--selected) {
94
- border-color: $layer-hover;
95
- background-color: $layer-hover;
96
- cursor: pointer;
97
- }
90
+ @media (any-hover: hover) {
91
+ .#{$prefix}--structured-list--selection
92
+ .#{$prefix}--structured-list-row:hover:not(
93
+ .#{$prefix}--structured-list-row--header-row
94
+ ):not(.#{$prefix}--structured-list-row--selected) {
95
+ border-color: $layer-hover;
96
+ background-color: $layer-hover;
97
+ cursor: pointer;
98
+ }
98
99
 
99
- .#{$prefix}--structured-list--selection
100
- .#{$prefix}--structured-list-row:hover:not(
101
- .#{$prefix}--structured-list-row--header-row
102
- ):not(.#{$prefix}--structured-list-row--selected)
103
- + .#{$prefix}--structured-list-row {
104
- border-color: $layer-hover;
100
+ .#{$prefix}--structured-list--selection
101
+ .#{$prefix}--structured-list-row:hover:not(
102
+ .#{$prefix}--structured-list-row--header-row
103
+ ):not(.#{$prefix}--structured-list-row--selected)
104
+ + .#{$prefix}--structured-list-row {
105
+ border-color: $layer-hover;
106
+ }
105
107
  }
106
108
 
107
109
  .#{$prefix}--structured-list--selection
@@ -126,11 +128,16 @@
126
128
  cursor: inherit;
127
129
  }
128
130
 
129
- .#{$prefix}--structured-list--selection
130
- .#{$prefix}--structured-list-row:hover:not(
131
- .#{$prefix}--structured-list-row--header-row
132
- )
133
- > .#{$prefix}--structured-list-td,
131
+ @media (any-hover: hover) {
132
+ .#{$prefix}--structured-list--selection
133
+ .#{$prefix}--structured-list-row:hover:not(
134
+ .#{$prefix}--structured-list-row--header-row
135
+ )
136
+ > .#{$prefix}--structured-list-td {
137
+ color: $text-primary;
138
+ }
139
+ }
140
+
134
141
  .#{$prefix}--structured-list--selection
135
142
  .#{$prefix}--structured-list-row.#{$prefix}--structured-list-row--selected
136
143
  > .#{$prefix}--structured-list-td {