@carbon/styles 1.111.0 → 1.112.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.111.0",
4
+ "version": "1.112.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.54.0",
44
- "@carbon/feature-flags": "^1.5.0",
45
- "@carbon/grid": "^11.58.0",
46
- "@carbon/layout": "^11.55.0",
47
- "@carbon/motion": "^11.48.0",
48
- "@carbon/themes": "^11.77.0",
49
- "@carbon/type": "^11.63.0",
43
+ "@carbon/colors": "^11.55.0",
44
+ "@carbon/feature-flags": "^1.6.0",
45
+ "@carbon/grid": "^11.59.0",
46
+ "@carbon/layout": "^11.56.0",
47
+ "@carbon/motion": "^11.49.0",
48
+ "@carbon/themes": "^11.78.0",
49
+ "@carbon/type": "^11.64.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": "5102bd860864c2580048183ffaf50d1ffd4400b5"
78
+ "gitHead": "a57cf8a896fe3fe09c5ab27648cd58947f37360a"
79
79
  }
@@ -1,4 +1,4 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
2
 
3
3
  exports[`@carbon/styles/scss/motion Public API 1`] = `
4
4
  {
@@ -38,6 +38,101 @@ exports[`@carbon/styles/scss/motion Public API 1`] = `
38
38
  "slow-01": "400ms",
39
39
  "slow-02": "700ms",
40
40
  "standard-easing": "cubic-bezier(0.5, 0, 0.1, 1)",
41
+ "surfaces": {
42
+ "contextual": {
43
+ "duration": "fast-02",
44
+ "enter": {
45
+ "opacity": 1,
46
+ "transform": "scale(1)",
47
+ },
48
+ "enter-easing": [
49
+ "entrance",
50
+ "expressive",
51
+ ],
52
+ "exit": {
53
+ "opacity": 0,
54
+ "transform": "scale(0.96)",
55
+ },
56
+ "exit-easing": [
57
+ "exit",
58
+ "expressive",
59
+ ],
60
+ "kind": "reveal",
61
+ },
62
+ "disclosure": {
63
+ "duration": "moderate-01",
64
+ "enter": {
65
+ "block-size": "auto",
66
+ "opacity": 1,
67
+ },
68
+ "enter-easing": [
69
+ "entrance",
70
+ "productive",
71
+ ],
72
+ "exit": {
73
+ "block-size": 0,
74
+ "opacity": 0,
75
+ },
76
+ "exit-easing": [
77
+ "exit",
78
+ "productive",
79
+ ],
80
+ "kind": "reveal",
81
+ },
82
+ "expand": {
83
+ "duration": "moderate-02",
84
+ "enter": {
85
+ "opacity": 1,
86
+ "transform": "scale(1)",
87
+ },
88
+ "enter-easing": [
89
+ "standard",
90
+ "productive",
91
+ ],
92
+ "exit": {
93
+ "opacity": 0,
94
+ "transform": "scale(0.96)",
95
+ },
96
+ "exit-easing": [
97
+ "standard",
98
+ "productive",
99
+ ],
100
+ "kind": "shared-element",
101
+ },
102
+ "invoke": {
103
+ "duration": "moderate-02",
104
+ "enter-easing": [
105
+ "standard",
106
+ "expressive",
107
+ ],
108
+ "exit-easing": [
109
+ "standard",
110
+ "expressive",
111
+ ],
112
+ "kind": "shared-element",
113
+ "origin": "trigger",
114
+ },
115
+ "stretch": {
116
+ "duration": "slow-01",
117
+ "enter": {
118
+ "clip-path": "inset(0 0 0 0)",
119
+ "opacity": 1,
120
+ },
121
+ "enter-easing": [
122
+ "entrance",
123
+ "expressive",
124
+ ],
125
+ "exit": {
126
+ "clip-path": "inset(50% 0 50% 0)",
127
+ "opacity": 0,
128
+ },
129
+ "exit-easing": [
130
+ "exit",
131
+ "expressive",
132
+ ],
133
+ "kind": "reveal",
134
+ },
135
+ },
41
136
  "transition-base": "250ms",
42
137
  "transition-expansion": "300ms",
43
138
  },
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Copyright IBM Corp. 2026
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @jest-environment node
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ const postcss = require('postcss');
13
+ const { SassRenderer } = require('@carbon/test-utils/scss');
14
+
15
+ const { render } = SassRenderer.create(__dirname);
16
+
17
+ describe('scss/components/ai-label', () => {
18
+ test('guards shared AI Label and Slug hover selectors with any-hover media query', async () => {
19
+ const { result } = await render(`
20
+ @use '../ai-label';
21
+ `);
22
+ const guardedHoverRules = [];
23
+ const unguardedHoverRules = [];
24
+
25
+ postcss.parse(result.css.toString()).walkRules((rule) => {
26
+ if (
27
+ (rule.selector.includes('.cds--ai-label') ||
28
+ rule.selector.includes('.cds--slug')) &&
29
+ rule.selector.includes(':hover')
30
+ ) {
31
+ let parent = rule.parent;
32
+ let isGuarded = false;
33
+
34
+ while (parent) {
35
+ if (
36
+ parent.type === 'atrule' &&
37
+ parent.name === 'media' &&
38
+ parent.params.includes('(any-hover: hover)')
39
+ ) {
40
+ isGuarded = true;
41
+ break;
42
+ }
43
+
44
+ parent = parent.parent;
45
+ }
46
+
47
+ if (isGuarded) {
48
+ guardedHoverRules.push(rule);
49
+ } else {
50
+ unguardedHoverRules.push(rule);
51
+ }
52
+ }
53
+ });
54
+
55
+ expect(guardedHoverRules.length).toBeGreaterThan(0);
56
+ expect(unguardedHoverRules.map((rule) => rule.selector)).toEqual([]);
57
+ });
58
+ });
@@ -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);
@@ -41,4 +42,48 @@ describe('scss/components/code-snippet', () => {
41
42
  `);
42
43
  expect(unwrap('background-color')).toBe('#000');
43
44
  });
45
+
46
+ test('hover styles are only applied on devices that support hover', async () => {
47
+ const { result } = await render(`
48
+ @use '../code-snippet';
49
+ `);
50
+ const hoverRules = [];
51
+
52
+ postcss.parse(result.css.toString()).walkRules((rule) => {
53
+ if (
54
+ rule.selector.includes(':hover') &&
55
+ (rule.selector.includes('.cds--snippet') ||
56
+ rule.selector.includes('.cds--copy-btn:hover')) &&
57
+ !rule.selector.includes('.cds--skeleton')
58
+ ) {
59
+ hoverRules.push(rule);
60
+ }
61
+ });
62
+
63
+ expect(hoverRules.length).toBeGreaterThan(0);
64
+ expect(
65
+ hoverRules.some((rule) =>
66
+ rule.selector.includes('.cds--snippet-btn--expand:hover')
67
+ )
68
+ ).toBe(true);
69
+ expect(
70
+ hoverRules.every((rule) => {
71
+ let parent = rule.parent;
72
+
73
+ while (parent) {
74
+ if (
75
+ parent.type === 'atrule' &&
76
+ parent.name === 'media' &&
77
+ parent.params.includes('(any-hover: hover)')
78
+ ) {
79
+ return true;
80
+ }
81
+
82
+ parent = parent.parent;
83
+ }
84
+
85
+ return false;
86
+ })
87
+ ).toBe(true);
88
+ });
44
89
  });
@@ -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,48 @@ describe('scss/components/content-switcher', () => {
24
25
  `);
25
26
  expect(unwrap('mixin')).toBe(true);
26
27
  });
28
+
29
+ test('hover styles are only applied on devices that support hover', async () => {
30
+ const { result } = await render(`
31
+ @use '../content-switcher';
32
+ `);
33
+ const hoverRules = [];
34
+
35
+ postcss.parse(result.css.toString()).walkRules((rule) => {
36
+ if (
37
+ rule.selector.includes('.cds--content-switcher') &&
38
+ rule.selector.includes(':hover')
39
+ ) {
40
+ hoverRules.push(rule);
41
+ }
42
+ });
43
+
44
+ expect(hoverRules.length).toBeGreaterThan(0);
45
+ expect(
46
+ hoverRules.some((rule) =>
47
+ rule.selector.includes('.cds--content-switcher-btn:hover')
48
+ )
49
+ ).toBe(true);
50
+ expect(
51
+ hoverRules
52
+ .filter((rule) => {
53
+ let parent = rule.parent;
54
+
55
+ while (parent) {
56
+ if (
57
+ parent.type === 'atrule' &&
58
+ parent.name === 'media' &&
59
+ parent.params.includes('(any-hover: hover)')
60
+ ) {
61
+ return false;
62
+ }
63
+
64
+ parent = parent.parent;
65
+ }
66
+
67
+ return true;
68
+ })
69
+ .map((rule) => rule.selector)
70
+ ).toEqual([]);
71
+ });
27
72
  });
@@ -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);
@@ -46,4 +47,43 @@ describe('scss/components/notification', () => {
46
47
  'notification-tokens',
47
48
  ]);
48
49
  });
50
+
51
+ test('button hover styles are only applied on devices that support hover', async () => {
52
+ const { result } = await render(`
53
+ @use '../notification';
54
+ `);
55
+ const hoverRules = [];
56
+
57
+ postcss.parse(result.css.toString()).walkRules((rule) => {
58
+ if (
59
+ rule.selector.includes('-notification__action-button') &&
60
+ rule.selector.includes(':hover')
61
+ ) {
62
+ hoverRules.push(rule);
63
+ }
64
+ });
65
+
66
+ expect(hoverRules.length).toBeGreaterThan(0);
67
+ expect(
68
+ hoverRules
69
+ .filter((rule) => {
70
+ let parent = rule.parent;
71
+
72
+ while (parent) {
73
+ if (
74
+ parent.type === 'atrule' &&
75
+ parent.name === 'media' &&
76
+ parent.params.includes('(any-hover: hover)')
77
+ ) {
78
+ return false;
79
+ }
80
+
81
+ parent = parent.parent;
82
+ }
83
+
84
+ return true;
85
+ })
86
+ .map((rule) => rule.selector)
87
+ ).toEqual([]);
88
+ });
49
89
  });
@@ -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.
@@ -44,14 +44,21 @@ $copy-btn-feedback: $background-inverse !default;
44
44
  color: $text-disabled;
45
45
  }
46
46
 
47
- .#{$prefix}--snippet--disabled .#{$prefix}--snippet-btn--expand:hover,
48
- .#{$prefix}--snippet--disabled .#{$prefix}--copy-btn,
49
- .#{$prefix}--snippet--disabled .#{$prefix}--copy-btn:hover {
47
+ .#{$prefix}--snippet--disabled .#{$prefix}--copy-btn {
50
48
  background-color: $layer;
51
49
  color: $text-disabled;
52
50
  cursor: not-allowed;
53
51
  }
54
52
 
53
+ @media (any-hover: hover) {
54
+ .#{$prefix}--snippet--disabled .#{$prefix}--snippet-btn--expand:hover,
55
+ .#{$prefix}--snippet--disabled .#{$prefix}--copy-btn:hover {
56
+ background-color: $layer;
57
+ color: $text-disabled;
58
+ cursor: not-allowed;
59
+ }
60
+ }
61
+
55
62
  .#{$prefix}--snippet--disabled .#{$prefix}--snippet__icon,
56
63
  .#{$prefix}--snippet--disabled
57
64
  .#{$prefix}--snippet-btn--expand
@@ -76,8 +83,10 @@ $copy-btn-feedback: $background-inverse !default;
76
83
  color: $text-primary;
77
84
  cursor: pointer;
78
85
 
79
- &:hover {
80
- background-color: $layer-hover;
86
+ @media (any-hover: hover) {
87
+ &:hover {
88
+ background-color: $layer-hover;
89
+ }
81
90
  }
82
91
 
83
92
  &:active {
@@ -133,15 +142,19 @@ $copy-btn-feedback: $background-inverse !default;
133
142
  .#{$prefix}--snippet--inline.#{$prefix}--snippet--no-copy {
134
143
  display: inline-block;
135
144
 
136
- &:hover {
137
- background-color: $layer;
138
- cursor: auto;
145
+ @media (any-hover: hover) {
146
+ &:hover {
147
+ background-color: $layer;
148
+ cursor: auto;
149
+ }
139
150
  }
140
151
  }
141
152
 
142
- .#{$prefix}--snippet--light.#{$prefix}--snippet--inline.#{$prefix}--snippet--no-copy:hover {
143
- background-color: $layer-hover;
144
- cursor: auto;
153
+ @media (any-hover: hover) {
154
+ .#{$prefix}--snippet--light.#{$prefix}--snippet--inline.#{$prefix}--snippet--no-copy:hover {
155
+ background-color: $layer-hover;
156
+ cursor: auto;
157
+ }
145
158
  }
146
159
 
147
160
  // Single Line Snippet
@@ -297,8 +310,10 @@ $copy-btn-feedback: $background-inverse !default;
297
310
  padding-inline: 0;
298
311
  }
299
312
 
300
- .#{$prefix}--snippet--inline.#{$prefix}--btn.#{$prefix}--btn--primary:hover {
301
- color: $text-primary;
313
+ @media (any-hover: hover) {
314
+ .#{$prefix}--snippet--inline.#{$prefix}--btn.#{$prefix}--btn--primary:hover {
315
+ color: $text-primary;
316
+ }
302
317
  }
303
318
 
304
319
  // override multi copy btn styles
@@ -347,9 +362,11 @@ $copy-btn-feedback: $background-inverse !default;
347
362
  transition: $duration-moderate-01 motion(standard, productive);
348
363
  }
349
364
 
350
- .#{$prefix}--snippet-btn--expand:hover {
351
- background: $layer-hover;
352
- color: $text-primary;
365
+ @media (any-hover: hover) {
366
+ .#{$prefix}--snippet-btn--expand:hover {
367
+ background: $layer-hover;
368
+ color: $text-primary;
369
+ }
353
370
  }
354
371
 
355
372
  .#{$prefix}--snippet-btn--expand:active {
@@ -377,12 +394,14 @@ $copy-btn-feedback: $background-inverse !default;
377
394
  background-color: $layer;
378
395
  }
379
396
 
380
- .#{$prefix}--snippet--light.#{$prefix}--snippet--inline:hover,
381
- .#{$prefix}--snippet--light .#{$prefix}--snippet-button:hover,
382
- .#{$prefix}--snippet--light
383
- .#{$prefix}--btn.#{$prefix}--snippet-btn--expand:hover,
384
- .#{$prefix}--snippet--light .#{$prefix}--copy-btn:hover {
385
- background-color: $layer-hover;
397
+ @media (any-hover: hover) {
398
+ .#{$prefix}--snippet--light.#{$prefix}--snippet--inline:hover,
399
+ .#{$prefix}--snippet--light .#{$prefix}--snippet-button:hover,
400
+ .#{$prefix}--snippet--light
401
+ .#{$prefix}--btn.#{$prefix}--snippet-btn--expand:hover,
402
+ .#{$prefix}--snippet--light .#{$prefix}--copy-btn:hover {
403
+ background-color: $layer-hover;
404
+ }
386
405
  }
387
406
 
388
407
  .#{$prefix}--snippet--light.#{$prefix}--snippet--inline:active,