@carbon/styles 1.105.0 → 1.106.0-rc.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.
@@ -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.
@@ -22,16 +22,31 @@
22
22
  @use '../../utilities/skeleton' as *;
23
23
  @use '../../utilities/convert';
24
24
  @use '../../utilities/button-reset';
25
+ @use '../../utilities/layout';
25
26
 
26
27
  /// Search styles
27
28
  /// @access public
28
29
  /// @group search
29
30
  @mixin search {
30
31
  .#{$prefix}--search {
32
+ @include layout.use('size', $default: 'md', $min: 'xs', $max: 'lg');
33
+
31
34
  position: relative;
32
35
  display: flex;
33
36
  align-items: center;
34
37
  inline-size: 100%;
38
+
39
+ .#{$prefix}--search-close,
40
+ ~ .#{$prefix}--search-button {
41
+ block-size: layout.size('height');
42
+ inline-size: layout.size('height');
43
+ }
44
+
45
+ &.#{$prefix}--search--expandable,
46
+ &.#{$prefix}--search--expandable .#{$prefix}--search-magnifier {
47
+ block-size: layout.size('height');
48
+ inline-size: layout.size('height');
49
+ }
35
50
  }
36
51
 
37
52
  .#{$prefix}--search .#{$prefix}--label {
@@ -39,15 +54,18 @@
39
54
  }
40
55
 
41
56
  .#{$prefix}--search-input {
57
+ @include layout.use('size', $default: 'md', $min: 'xs', $max: 'lg');
58
+ @include layout.use('density', $default: 'normal');
42
59
  @include reset;
43
60
  @include type.type-style('body-compact-01');
44
61
  @include focus-outline('reset');
45
62
 
46
63
  order: 1;
47
- padding: 0 $spacing-08;
64
+ padding: 0 layout.size('height');
48
65
  border: none;
49
66
  appearance: none;
50
67
  background-color: $field;
68
+ block-size: layout.size('height');
51
69
  border-block-end: 1px solid $border-strong;
52
70
  color: $text-primary;
53
71
 
@@ -97,42 +115,8 @@
97
115
  background: $field-02;
98
116
  }
99
117
 
100
- // Small styles
101
- .#{$prefix}--search--sm .#{$prefix}--search-input,
102
- .#{$prefix}--search--sm.#{$prefix}--search--expandable.#{$prefix}--search--expanded
103
- .#{$prefix}--search-input {
104
- // 8px padding on either side of icon + 16px icon (32px)
105
- padding: 0 $spacing-07;
106
- block-size: convert.to-rem(32px);
107
- }
108
-
109
- .#{$prefix}--search--sm .#{$prefix}--search-magnifier-icon {
110
- inset-inline-start: convert.to-rem(8px);
111
- }
112
-
113
- // Medium styles
114
- .#{$prefix}--search--md .#{$prefix}--search-input,
115
- .#{$prefix}--search--md.#{$prefix}--search--expandable.#{$prefix}--search--expanded
116
- .#{$prefix}--search-input {
117
- // 12px padding on either side of icon + 16px icon (40px)
118
- padding: 0 $spacing-08;
119
- block-size: convert.to-rem(40px);
120
- }
121
-
122
- .#{$prefix}--search--md .#{$prefix}--search-magnifier-icon {
123
- inset-inline-start: convert.to-rem(12px);
124
- }
125
-
126
- // Large styles
127
- .#{$prefix}--search--lg .#{$prefix}--search-input,
128
- .#{$prefix}--search--lg.#{$prefix}--search--expandable.#{$prefix}--search--expanded
129
- .#{$prefix}--search-input {
130
- // 16px padding on either side of icon + 16px icon (48px)
131
- padding: 0 $spacing-09;
132
- block-size: convert.to-rem(48px);
133
- }
134
-
135
118
  .#{$prefix}--search-magnifier-icon {
119
+ @include layout.use('size', $default: 'md', $min: 'xs', $max: 'lg');
136
120
  @include reset;
137
121
 
138
122
  position: absolute;
@@ -141,7 +125,7 @@
141
125
  fill: $icon-secondary;
142
126
  inline-size: convert.to-rem(16px);
143
127
  inset-block-start: 50%;
144
- inset-inline-start: $spacing-05;
128
+ inset-inline-start: calc((layout.size('height') - 1rem) / 2);
145
129
  pointer-events: none;
146
130
  transform: translateY(-50%);
147
131
  }
@@ -179,16 +163,18 @@
179
163
 
180
164
  .#{$prefix}--search-close,
181
165
  .#{$prefix}--search-button {
166
+ @include layout.use('size', $default: 'md', $min: 'xs', $max: 'lg');
167
+
182
168
  display: flex;
183
169
  align-items: center;
184
170
  justify-content: center;
185
171
  border-width: 0 0 1px;
186
172
  border-style: solid;
187
173
  border-color: transparent;
188
- block-size: convert.to-rem(40px);
174
+ block-size: layout.size('height');
189
175
  cursor: pointer;
190
176
  fill: $icon-primary;
191
- inline-size: convert.to-rem(40px);
177
+ inline-size: layout.size('height');
192
178
  opacity: 1;
193
179
  visibility: inherit;
194
180
 
@@ -243,59 +229,12 @@
243
229
  fill: $icon-on-color-disabled;
244
230
  }
245
231
 
246
- // Small
247
- .#{$prefix}--search--sm {
248
- .#{$prefix}--search-close,
249
- ~ .#{$prefix}--search-button,
250
- &.#{$prefix}--search--expandable,
251
- &.#{$prefix}--search--expandable .#{$prefix}--search-magnifier {
252
- block-size: convert.to-rem(32px);
253
- inline-size: convert.to-rem(32px);
254
- }
255
-
256
- &.#{$prefix}--search--expandable .#{$prefix}--search-input::placeholder {
257
- padding: 0 convert.to-rem(32px);
258
- }
259
- }
260
-
261
- // Medium
262
- .#{$prefix}--search--md {
263
- .#{$prefix}--search-close,
264
- ~ .#{$prefix}--search-button,
265
- &.#{$prefix}--search--expandable,
266
- &.#{$prefix}--search--expandable .#{$prefix}--search-magnifier {
267
- block-size: convert.to-rem(40px);
268
- inline-size: convert.to-rem(40px);
269
- }
270
-
271
- &.#{$prefix}--search--expandable .#{$prefix}--search-input::placeholder {
272
- padding: 0 convert.to-rem(40px);
273
- }
274
- }
275
-
276
- // Large
277
- .#{$prefix}--search--lg {
278
- .#{$prefix}--search-close,
279
- ~ .#{$prefix}--search-button,
280
- &.#{$prefix}--search--expandable,
281
- &.#{$prefix}--search--expandable .#{$prefix}--search-magnifier {
282
- block-size: convert.to-rem(48px);
283
- inline-size: convert.to-rem(48px);
284
- }
285
-
286
- &.#{$prefix}--search--expandable .#{$prefix}--search-input::placeholder {
287
- padding: 0 convert.to-rem(48px);
288
- }
289
- }
290
-
291
232
  .#{$prefix}--search-close--hidden {
292
233
  opacity: 0;
293
234
  visibility: hidden;
294
235
  }
295
236
 
296
- .#{$prefix}--search--lg.#{$prefix}--skeleton .#{$prefix}--search-input,
297
- .#{$prefix}--search--md.#{$prefix}--skeleton .#{$prefix}--search-input,
298
- .#{$prefix}--search--sm.#{$prefix}--skeleton .#{$prefix}--search-input {
237
+ .#{$prefix}--skeleton .#{$prefix}--search-input {
299
238
  @include skeleton;
300
239
 
301
240
  inline-size: 100%;
@@ -329,6 +268,7 @@
329
268
 
330
269
  .#{$prefix}--search--expandable.#{$prefix}--search--expanded
331
270
  .#{$prefix}--search-input {
271
+ padding: 0 layout.size('height');
332
272
  inline-size: 100%;
333
273
  transition: padding $duration-fast-01 motion(standard, productive);
334
274
 
@@ -17,6 +17,7 @@
17
17
  @use '../../utilities/component-reset';
18
18
  @use '../../utilities/convert';
19
19
  @use '../../utilities/focus-outline' as *;
20
+ @use '../../utilities/layout';
20
21
  @use '../../utilities/skeleton' as *;
21
22
 
22
23
  /// Select styles
@@ -25,6 +26,7 @@
25
26
  @mixin select {
26
27
  .#{$prefix}--select {
27
28
  @include component-reset.reset;
29
+ @include layout.use('size', $default: 'md', $min: 'xs', $max: 'lg');
28
30
 
29
31
  position: relative;
30
32
  display: flex;
@@ -43,13 +45,15 @@
43
45
  .#{$prefix}--select-input {
44
46
  @include type-style('body-compact-01');
45
47
  @include focus-outline('reset');
48
+ @include layout.use('size', $default: 'md', $min: 'xs', $max: 'lg');
49
+ @include layout.use('density', $default: 'normal');
46
50
 
47
51
  display: block;
48
52
  border: none;
49
53
  border-radius: 0;
50
54
  appearance: none;
51
55
  background-color: $field;
52
- block-size: convert.to-rem(40px);
56
+ block-size: layout.size('height');
53
57
  border-block-end: 1px solid $border-strong;
54
58
  color: $text-primary;
55
59
  cursor: pointer;
@@ -102,16 +106,6 @@
102
106
  }
103
107
  }
104
108
 
105
- .#{$prefix}--select-input--sm {
106
- block-size: convert.to-rem(32px);
107
- max-block-size: convert.to-rem(32px);
108
- }
109
-
110
- .#{$prefix}--select-input--lg {
111
- block-size: convert.to-rem(48px);
112
- max-block-size: convert.to-rem(48px);
113
- }
114
-
115
109
  .#{$prefix}--select--disabled .#{$prefix}--label,
116
110
  .#{$prefix}--select--disabled .#{$prefix}--form__helper-text {
117
111
  color: $text-disabled;
@@ -370,6 +364,21 @@
370
364
  inset-inline-end: -($divider-width);
371
365
  }
372
366
 
367
+ .#{$prefix}--select--decorator
368
+ .#{$prefix}--select-input__wrapper
369
+ .#{$prefix}--select-input
370
+ ~ .#{$prefix}--select__invalid-icon,
371
+ .#{$prefix}--select--slug
372
+ .#{$prefix}--select-input__wrapper[data-invalid]
373
+ .#{$prefix}--select-input
374
+ ~ .#{$prefix}--select__invalid-icon,
375
+ .#{$prefix}--select--slug
376
+ .#{$prefix}--select-input__wrapper
377
+ .#{$prefix}--select-input
378
+ ~ .#{$prefix}--select__invalid-icon {
379
+ inset-inline-end: $spacing-11;
380
+ }
381
+
373
382
  .#{$prefix}--select--decorator
374
383
  .#{$prefix}--select-input:has(
375
384
  ~ .#{$prefix}--select__inner-wrapper--decorator
@@ -421,19 +430,4 @@
421
430
  .#{$prefix}--slug::before {
422
431
  display: block;
423
432
  }
424
-
425
- .#{$prefix}--select--decorator
426
- .#{$prefix}--select-input__wrapper
427
- .#{$prefix}--select-input
428
- ~ .#{$prefix}--select__invalid-icon,
429
- .#{$prefix}--select--slug
430
- .#{$prefix}--select-input__wrapper[data-invalid]
431
- .#{$prefix}--select-input
432
- ~ .#{$prefix}--select__invalid-icon,
433
- .#{$prefix}--select--slug
434
- .#{$prefix}--select-input__wrapper
435
- .#{$prefix}--select-input
436
- ~ .#{$prefix}--select__invalid-icon {
437
- inset-inline-end: $spacing-11;
438
- }
439
433
  }
@@ -13,6 +13,7 @@
13
13
  @use '../../type' as *;
14
14
  @use '../../utilities/ai-gradient' as *;
15
15
  @use '../../utilities/convert';
16
+ @use '../../utilities/custom-property';
16
17
  @use '../toggletip';
17
18
  @use '../popover';
18
19
 
@@ -1061,6 +1062,13 @@ $sizes: (
1061
1062
  // This sets the max size to the size of the action bar with 3 buttons
1062
1063
  padding-block: convert.to-rem(24px) convert.to-rem(80px);
1063
1064
  padding-inline: convert.to-rem(24px);
1065
+
1066
+ // Reset the custom properties of the link styles to initial for AI-label and slug. as the AI-label uses gradient backgrounds.
1067
+ @include custom-property.declaration('button-focus-color', initial);
1068
+ @include custom-property.declaration('link-text-color', initial);
1069
+ @include custom-property.declaration('link-hover-text-color', initial);
1070
+ @include custom-property.declaration('link-visited-text-color', initial);
1071
+ @include custom-property.declaration('link-focus-text-color', initial);
1064
1072
  }
1065
1073
 
1066
1074
  .#{$prefix}--ai-label
@@ -1,5 +1,5 @@
1
1
  //
2
- // Copyright IBM Corp. 2016, 2025
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.
@@ -31,7 +31,7 @@
31
31
  /// @group text-input
32
32
  @mixin text-input {
33
33
  .#{$prefix}--text-input {
34
- @include layout.use('size', $default: 'md', $min: 'sm', $max: 'lg');
34
+ @include layout.use('size', $default: 'md', $min: 'xs', $max: 'lg');
35
35
  @include layout.use('density', $default: 'normal');
36
36
  @include component-reset.reset;
37
37
  @include type-style('body-compact-01');
@@ -61,15 +61,7 @@
61
61
  }
62
62
 
63
63
  .#{$prefix}--password-input {
64
- padding-inline-end: $spacing-08;
65
- }
66
-
67
- .#{$prefix}--text-input--sm.#{$prefix}--password-input {
68
- padding-inline-end: $spacing-07;
69
- }
70
-
71
- .#{$prefix}--text-input--lg.#{$prefix}--password-input {
72
- padding-inline-end: $spacing-09;
64
+ padding-inline-end: layout.size('height');
73
65
  }
74
66
 
75
67
  .#{$prefix}--text-input::placeholder {
@@ -123,33 +115,26 @@
123
115
  justify-content: center;
124
116
  padding: 0;
125
117
  border: 0;
118
+ aspect-ratio: 1;
126
119
  background: none;
127
120
  block-size: 100%;
128
121
  cursor: pointer;
129
- inline-size: convert.to-rem(40px);
130
122
  inset-inline-end: 0;
131
123
  min-block-size: auto;
132
124
  transition: outline $duration-fast-01 motion(standard, productive);
133
125
  }
134
126
 
135
127
  .#{$prefix}--toggle-password-tooltip .#{$prefix}--popover {
136
- inset-inline-start: -($spacing-08);
128
+ @include layout.use('size', $default: 'md', $min: 'xs', $max: 'lg');
129
+
130
+ gap: $spacing-02;
131
+ inset-inline-start: calc(-1 * (layout.size('height')));
137
132
  }
138
133
 
139
134
  .#{$prefix}--toggle-password-tooltip .#{$prefix}--popover-content {
140
135
  min-inline-size: $spacing-08;
141
136
  }
142
137
 
143
- .#{$prefix}--text-input--sm
144
- + .#{$prefix}--btn.#{$prefix}--text-input--password__visibility__toggle.#{$prefix}--tooltip__trigger {
145
- inline-size: convert.to-rem(32px);
146
- }
147
-
148
- .#{$prefix}--text-input--lg
149
- + .#{$prefix}--btn.#{$prefix}--text-input--password__visibility__toggle.#{$prefix}--tooltip__trigger {
150
- inline-size: convert.to-rem(48px);
151
- }
152
-
153
138
  .#{$prefix}--btn.#{$prefix}--text-input--password__visibility__toggle.#{$prefix}--tooltip__trigger
154
139
  svg {
155
140
  fill: $icon-primary;
@@ -164,17 +149,15 @@
164
149
  padding-inline-end: $spacing-08;
165
150
  }
166
151
 
167
- .#{$prefix}--text-input--invalid.#{$prefix}--password-input {
168
- padding-inline-end: convert.to-rem(64px);
169
- }
170
-
171
- .#{$prefix}--text-input--invalid
172
- + .#{$prefix}--text-input--password__visibility__toggle {
173
- inset-inline-end: $spacing-05;
152
+ .#{$prefix}--text-input--invalid.#{$prefix}--password-input,
153
+ .#{$prefix}--text-input--warning.#{$prefix}--password-input {
154
+ padding-inline-end: calc(layout.size('height') + 1.5rem);
174
155
  }
175
156
 
176
157
  .#{$prefix}--password-input-wrapper .#{$prefix}--text-input__invalid-icon {
177
- inset-inline-end: $spacing-08;
158
+ @include layout.use('size', $default: 'md', $min: 'xs', $max: 'lg');
159
+
160
+ inset-inline-end: layout.size('height');
178
161
  }
179
162
 
180
163
  .#{$prefix}--text-input:disabled
@@ -251,10 +234,6 @@
251
234
  @include focus-outline('invalid');
252
235
 
253
236
  box-shadow: none;
254
-
255
- .#{$prefix}--text-input--password__visibility__toggle {
256
- inset-inline-end: $spacing-08;
257
- }
258
237
  }
259
238
 
260
239
  //-----------------------------
@@ -363,36 +342,43 @@
363
342
  //-----------------------------
364
343
 
365
344
  .#{$prefix}--text-input-wrapper.#{$prefix}--text-input-wrapper--inline {
366
- flex-flow: row wrap;
345
+ flex-flow: row nowrap;
346
+ align-items: center;
367
347
  }
368
348
 
369
349
  .#{$prefix}--text-input-wrapper .#{$prefix}--label--inline {
370
- flex: 1;
371
- margin: convert.to-rem(13px) 0 0 0;
350
+ flex: 0 1 auto;
351
+ margin: 0;
372
352
  overflow-wrap: break-word;
373
353
  word-break: break-word;
374
354
  }
375
355
 
376
- .#{$prefix}--text-input-wrapper .#{$prefix}--label--inline--sm {
377
- margin-block-start: convert.to-rem(9px);
378
- }
379
-
380
- .#{$prefix}--text-input-wrapper .#{$prefix}--label--inline--lg {
381
- margin-block-start: convert.to-rem(17px);
382
- }
383
-
384
356
  .#{$prefix}--text-input__label-helper-wrapper {
385
- flex: 2;
357
+ flex: 0 1 auto;
386
358
  flex-direction: column;
387
- margin-inline-end: convert.to-rem(24px);
388
- max-inline-size: convert.to-rem(128px);
359
+ max-inline-size: convert.to-rem(142px);
389
360
  overflow-wrap: break-word;
361
+
362
+ &:first-of-type {
363
+ margin-inline-end: $spacing-03;
364
+ }
365
+
366
+ &:last-of-type {
367
+ margin-inline-start: $spacing-03;
368
+ }
390
369
  }
391
370
 
392
371
  .#{$prefix}--text-input-wrapper .#{$prefix}--form__helper-text--inline {
393
372
  margin-block-start: convert.to-rem(2px);
394
373
  }
395
374
 
375
+ .#{$prefix}--text-input-wrapper--inline {
376
+ .#{$prefix}--form__helper-text--inline,
377
+ .#{$prefix}--form-requirement {
378
+ margin: 0;
379
+ }
380
+ }
381
+
396
382
  .#{$prefix}--text-input__field-outer-wrapper {
397
383
  display: flex;
398
384
  flex: 1 1 auto;
@@ -460,15 +446,18 @@
460
446
  ) {
461
447
  @include ai-gradient;
462
448
  }
463
-
464
449
  .#{$prefix}--text-input__field-wrapper--decorator
465
- .#{$prefix}--text-input:has(
466
- ~ .#{$prefix}--text-input__field-inner-wrapper--decorator > *
467
- ),
450
+ .#{$prefix}--text-input:not(.#{$prefix}--text-input--invalid):not(
451
+ .#{$prefix}--text-input--warning
452
+ ):has(~ .#{$prefix}--text-input__field-inner-wrapper--decorator > *),
468
453
  .#{$prefix}--text-input__field-wrapper--slug
469
- .#{$prefix}--text-input:has(~ .#{$prefix}--ai-label),
454
+ .#{$prefix}--text-input:not(.#{$prefix}--text-input--invalid):not(
455
+ .#{$prefix}--text-input--warning
456
+ ):has(~ .#{$prefix}--ai-label),
470
457
  .#{$prefix}--text-input__field-wrapper--slug
471
- .#{$prefix}--text-input:has(~ .#{$prefix}--slug) {
458
+ .#{$prefix}--text-input:not(.#{$prefix}--text-input--invalid):not(
459
+ .#{$prefix}--text-input--warning
460
+ ):has(~ .#{$prefix}--slug) {
472
461
  padding-inline-end: $spacing-08;
473
462
  }
474
463
 
@@ -485,17 +474,25 @@
485
474
  padding-inline-end: $spacing-10;
486
475
  }
487
476
 
488
- .#{$prefix}--text-input--invalid
489
- ~ .#{$prefix}--text-input__field-inner-wrapper--decorator
490
- > *,
491
- .#{$prefix}--text-input--warning
492
- ~ .#{$prefix}--text-input__field-inner-wrapper--decorator
493
- > *,
494
- .#{$prefix}--text-input--invalid ~ .#{$prefix}--ai-label,
495
- .#{$prefix}--text-input--warning ~ .#{$prefix}--ai-label,
496
- .#{$prefix}--text-input--invalid ~ .#{$prefix}--slug,
497
- .#{$prefix}--text-input--warning ~ .#{$prefix}--slug {
498
- inset-inline-end: $spacing-08;
477
+ .#{$prefix}--text-input__field-wrapper--decorator,
478
+ .#{$prefix}--text-input__field-wrapper--slug {
479
+ .#{$prefix}--text-input--invalid ~ .#{$prefix}--text-input__invalid-icon,
480
+ .#{$prefix}--text-input--warning ~ .#{$prefix}--text-input__invalid-icon {
481
+ inset-inline-end: $spacing-08;
482
+ }
483
+
484
+ .#{$prefix}--text-input--invalid
485
+ ~ .#{$prefix}--text-input__field-inner-wrapper--decorator
486
+ > *,
487
+ .#{$prefix}--text-input--warning
488
+ ~ .#{$prefix}--text-input__field-inner-wrapper--decorator
489
+ > *,
490
+ .#{$prefix}--text-input--invalid ~ .#{$prefix}--ai-label,
491
+ .#{$prefix}--text-input--warning ~ .#{$prefix}--ai-label,
492
+ .#{$prefix}--text-input--invalid ~ .#{$prefix}--slug,
493
+ .#{$prefix}--text-input--warning ~ .#{$prefix}--slug {
494
+ inset-inline-end: $spacing-05;
495
+ }
499
496
  }
500
497
 
501
498
  // Decorator