@carbon/styles 1.42.1 → 1.43.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.
@@ -12,6 +12,7 @@
12
12
  @use '../../spacing' as *;
13
13
  @use '../../theme' as *;
14
14
  @use '../../type' as *;
15
+ @use '../../utilities/ai-gradient' as *;
15
16
  @use '../../utilities/skeleton' as *;
16
17
  @use '../../utilities/button-reset';
17
18
  @use '../../utilities/high-contrast-mode' as *;
@@ -159,26 +160,6 @@
159
160
  border-block-end: convert.to-rem(1px) solid $border-strong;
160
161
  color: $icon-primary;
161
162
 
162
- &::before,
163
- &::after {
164
- position: absolute;
165
- display: block;
166
- background-color: $field;
167
- // block-size: calc(100% - 4px) is calculated differently in Safari
168
- block-size: convert.to-rem(36px);
169
- content: '';
170
- inline-size: convert.to-rem(2px);
171
- inset-block-start: convert.to-rem(2px);
172
- }
173
-
174
- &::before {
175
- inset-inline-start: 0;
176
- }
177
-
178
- &::after {
179
- inset-inline-end: 0;
180
- }
181
-
182
163
  svg {
183
164
  fill: currentColor;
184
165
  }
@@ -195,18 +176,6 @@
195
176
  background-color: $field-hover;
196
177
  color: $icon-primary;
197
178
  cursor: pointer;
198
-
199
- &::before,
200
- &::after {
201
- background-color: $field-hover;
202
- }
203
- }
204
-
205
- &:focus::before,
206
- &:focus::after,
207
- &:hover:focus::before,
208
- &:hover:focus::after {
209
- background-color: transparent;
210
179
  }
211
180
 
212
181
  &:disabled {
@@ -225,56 +194,50 @@
225
194
  order: 2;
226
195
  }
227
196
 
228
- // add top and bottom outlines to number controls when input is focused
229
197
  .#{$prefix}--number
230
- input[type='number']:focus
198
+ input[type='number'][data-invalid]
231
199
  ~ .#{$prefix}--number__controls
232
200
  .#{$prefix}--number__control-btn {
233
- border-block-end-color: transparent;
234
-
235
- &:hover {
236
- @include focus-outline('outline');
237
- }
201
+ border-block-end-color: $support-error;
238
202
  }
239
203
 
204
+ // add top and bottom outlines to number controls when input is focused
240
205
  .#{$prefix}--number
241
- input[type='number'][data-invalid]
206
+ input[type='number']:focus
242
207
  ~ .#{$prefix}--number__controls
243
208
  .#{$prefix}--number__control-btn {
244
- border-block-end-color: transparent;
209
+ border-block-end-color: $focus;
210
+ box-shadow: inset 0 2px $focus, inset 0 -1px $focus;
245
211
  }
246
212
 
247
- // add invalid outline to number controls only when invalid input is not focused
248
213
  .#{$prefix}--number
249
- input[type='number'][data-invalid]:not(:focus)
214
+ input[type='number']:focus
250
215
  ~ .#{$prefix}--number__controls
251
- .#{$prefix}--number__control-btn:hover {
252
- @include focus-outline('invalid');
216
+ .#{$prefix}--number__control-btn:last-of-type {
217
+ box-shadow: inset 0 2px $focus, inset 0 -1px $focus, inset -2px 0 $focus;
253
218
  }
254
219
 
220
+ // add invalid box-shadow to number controls only when invalid input is not focused
255
221
  .#{$prefix}--number
256
- input[type='number']:focus
222
+ input[type='number'][data-invalid]:not(:focus)
257
223
  ~ .#{$prefix}--number__controls
258
- .#{$prefix}--number__control-btn.up-icon::after {
259
- background-color: transparent;
224
+ .#{$prefix}--number__control-btn:last-of-type:hover {
225
+ box-shadow: inset 0 2px $support-error, inset 0 -1px $support-error,
226
+ inset -2px 0 $support-error;
260
227
  }
261
228
 
262
229
  .#{$prefix}--number
263
- input[type='number'][data-invalid]
230
+ input[type='number'][data-invalid]:not(:focus)
264
231
  ~ .#{$prefix}--number__controls
265
- .#{$prefix}--number__control-btn.up-icon::after {
266
- background-color: $support-error;
232
+ .#{$prefix}--number__control-btn:hover {
233
+ box-shadow: inset 0 2px $support-error, inset 0 -1px $support-error;
267
234
  }
268
235
 
269
236
  .#{$prefix}--number
270
- input[type='number'][data-invalid]:focus
271
- ~ .#{$prefix}--number__controls
272
- .#{$prefix}--number__control-btn.up-icon::after,
273
- .#{$prefix}--number
274
- input[type='number'][data-invalid]
237
+ input[type='number'][data-invalid]:not(:focus)
275
238
  ~ .#{$prefix}--number__controls
276
- .#{$prefix}--number__control-btn.up-icon:focus::after {
277
- background-color: $focus;
239
+ .#{$prefix}--number__control-btn:focus:hover {
240
+ @include focus-outline('outline');
278
241
  }
279
242
 
280
243
  .#{$prefix}--number__rule-divider {
@@ -380,38 +343,6 @@
380
343
  opacity: 1;
381
344
  }
382
345
 
383
- // V11: Possibly deprecate
384
- .#{$prefix}--number--light input[type='number'] {
385
- background-color: $field-02;
386
- }
387
-
388
- // V11: Possibly deprecate
389
- .#{$prefix}--number--light input[type='number']:disabled {
390
- background-color: $field-02;
391
- }
392
-
393
- // V11: Possibly deprecate
394
- .#{$prefix}--number--light .#{$prefix}--number__control-btn::before,
395
- .#{$prefix}--number--light .#{$prefix}--number__control-btn::after {
396
- background-color: $field-02;
397
- }
398
-
399
- .#{$prefix}--number--light .#{$prefix}--number__control-btn:focus::before,
400
- .#{$prefix}--number--light .#{$prefix}--number__control-btn:focus::after {
401
- background-color: transparent;
402
- }
403
-
404
- // V11: Possibly deprecate
405
- // We include `:not(:focus)` here because the pseudo elements will overlap the
406
- // focus outline on the button if we set their background-color on focus
407
- .#{$prefix}--number--light .#{$prefix}--number__control-btn:hover,
408
- .#{$prefix}--number--light
409
- .#{$prefix}--number__control-btn:not(:focus):hover::before,
410
- .#{$prefix}--number--light
411
- .#{$prefix}--number__control-btn:not(:focus):hover::after {
412
- background-color: $layer-hover-02;
413
- }
414
-
415
346
  // Size Variant styles
416
347
  .#{$prefix}--number--lg input[type='number'] {
417
348
  block-size: convert.to-rem(48px);
@@ -423,12 +354,6 @@
423
354
 
424
355
  .#{$prefix}--number--lg .#{$prefix}--number__control-btn {
425
356
  inline-size: convert.to-rem(48px);
426
-
427
- &::before,
428
- &::after {
429
- // block-size: calc(100% - 4px) is calculated differently in Safari
430
- block-size: convert.to-rem(44px);
431
- }
432
357
  }
433
358
 
434
359
  .#{$prefix}--number--sm input[type='number'] {
@@ -441,12 +366,6 @@
441
366
 
442
367
  .#{$prefix}--number--sm .#{$prefix}--number__control-btn {
443
368
  inline-size: convert.to-rem(32px);
444
-
445
- &::before,
446
- &::after {
447
- // block-size: calc(100% - 4px) is calculated differently in Safari
448
- block-size: convert.to-rem(28px);
449
- }
450
369
  }
451
370
 
452
371
  //No label positioning adjustment
@@ -478,11 +397,6 @@
478
397
  &:hover {
479
398
  background-color: transparent;
480
399
  cursor: pointer;
481
-
482
- &::before,
483
- &::after {
484
- background-color: transparent;
485
- }
486
400
  }
487
401
  }
488
402
 
@@ -493,17 +407,43 @@
493
407
  outline: none;
494
408
  }
495
409
 
496
- .#{$prefix}--number--readonly .#{$prefix}--number__control-btn::before,
497
- .#{$prefix}--number--readonly .#{$prefix}--number__control-btn::after {
498
- background: transparent;
499
- }
500
-
501
410
  .#{$prefix}--number--readonly
502
411
  .#{$prefix}--number__controls:hover
503
412
  .#{$prefix}--number__rule-divider:not(:first-of-type) {
504
413
  background-color: $border-subtle;
505
414
  }
506
415
 
416
+ // Styles for `Slug` rendered inside `NumberInput`
417
+ .#{$prefix}--number__input-wrapper--slug .#{$prefix}--slug {
418
+ position: absolute;
419
+ inset-block-start: 50%;
420
+ inset-inline-end: convert.to-rem(88px);
421
+ transform: translateY(-50%);
422
+ }
423
+
424
+ .#{$prefix}--number__input-wrapper--slug
425
+ input[data-invalid]
426
+ ~ .#{$prefix}--slug,
427
+ .#{$prefix}--number__input-wrapper--slug.#{$prefix}--number__input-wrapper--warning
428
+ .#{$prefix}--slug {
429
+ inset-inline-end: convert.to-rem(120px);
430
+ }
431
+
432
+ .#{$prefix}--number
433
+ .#{$prefix}--number__input-wrapper--slug
434
+ input[data-invalid],
435
+ .#{$prefix}--number
436
+ .#{$prefix}--number__input-wrapper--slug.#{$prefix}--number__input-wrapper--warning
437
+ input {
438
+ padding-inline-end: convert.to-rem(144px);
439
+ }
440
+
441
+ .#{$prefix}--number__input-wrapper--slug input[type='number'] {
442
+ @include ai-gradient;
443
+
444
+ padding-inline-end: convert.to-rem(112px);
445
+ }
446
+
507
447
  // Skeleton State
508
448
  .#{$prefix}--number.#{$prefix}--skeleton {
509
449
  @include skeleton;
@@ -516,19 +456,19 @@
516
456
  }
517
457
  }
518
458
 
519
- // // Windows HCM fix
520
- // /* stylelint-disable */
521
- // .#{$prefix}--number__control-btn:hover,
522
- // .#{$prefix}--number__control-btn:focus {
523
- // @include high-contrast-mode('focus');
524
- // }
459
+ // Windows HCM fix
460
+ /* stylelint-disable */
461
+ .#{$prefix}--number__control-btn:hover,
462
+ .#{$prefix}--number__control-btn:focus {
463
+ @include high-contrast-mode('focus');
464
+ }
525
465
 
526
- // .#{$prefix}--number__control-btn {
527
- // @include high-contrast-mode('outline');
528
- // }
466
+ .#{$prefix}--number__control-btn {
467
+ @include high-contrast-mode('outline');
468
+ }
529
469
 
530
- // .#{$prefix}--number__control-btn svg {
531
- // @include high-contrast-mode('icon-fill');
532
- // }
533
- // /* stylelint-enable */
470
+ .#{$prefix}--number__control-btn svg {
471
+ @include high-contrast-mode('icon-fill');
472
+ }
473
+ /* stylelint-enable */
534
474
  }
@@ -6,12 +6,14 @@
6
6
  //
7
7
 
8
8
  @use '../form';
9
+ @use '../../colors' as *;
9
10
  @use '../../config' as *;
10
11
  @use '../../spacing' as *;
11
12
  @use '../../motion' as *;
12
13
  @use '../../type' as *;
13
14
  @use '../../breakpoint' as *;
14
15
  @use '../../theme' as *;
16
+ @use '../../utilities/ai-gradient' as *;
15
17
  @use '../../utilities/component-reset';
16
18
  @use '../../utilities/convert';
17
19
  @use '../../utilities/focus-outline' as *;
@@ -171,7 +173,7 @@
171
173
  }
172
174
 
173
175
  .#{$prefix}--select__invalid-icon--warning path[fill] {
174
- fill: $icon-primary;
176
+ fill: $black-100;
175
177
  opacity: 1;
176
178
  }
177
179
 
@@ -265,7 +267,7 @@
265
267
  fill: $icon-disabled;
266
268
  }
267
269
 
268
- //Skeleton State
270
+ // Skeleton State
269
271
  .#{$prefix}--select.#{$prefix}--skeleton {
270
272
  @include skeleton;
271
273
 
@@ -278,6 +280,32 @@
278
280
  display: none;
279
281
  }
280
282
 
283
+ // Slug styles
284
+ .#{$prefix}--select--slug .#{$prefix}--slug {
285
+ position: absolute;
286
+ inset-block-start: 50%;
287
+ inset-inline-end: $spacing-08;
288
+ transform: translateY(-50%);
289
+ }
290
+
291
+ .#{$prefix}--select--slug .#{$prefix}--select-input {
292
+ @include ai-gradient;
293
+
294
+ padding-inline-end: $spacing-10;
295
+ }
296
+
297
+ .#{$prefix}--select--slug.#{$prefix}--select--invalid
298
+ .#{$prefix}--select-input,
299
+ .#{$prefix}--select--slug.#{$prefix}--select--warning
300
+ .#{$prefix}--select-input {
301
+ padding-inline-end: $spacing-12;
302
+ }
303
+
304
+ .#{$prefix}--select--slug.#{$prefix}--select--invalid .#{$prefix}--slug,
305
+ .#{$prefix}--select--slug.#{$prefix}--select--warning .#{$prefix}--slug {
306
+ inset-inline-end: $spacing-10;
307
+ }
308
+
281
309
  // Windows HCM fix
282
310
  // stylelint-disable-next-line no-duplicate-selectors
283
311
  .#{$prefix}--select__arrow {
@@ -1,6 +1,7 @@
1
1
  @use '../../config' as *;
2
2
  @use '../../colors' as *;
3
3
  @use '../../motion' as *;
4
+ @use '../../spacing' as *;
4
5
  @use '../../theme' as *;
5
6
  @use '../../type' as *;
6
7
  @use '../../utilities/convert';
@@ -65,6 +66,10 @@ $sizes: (
65
66
  display: flex;
66
67
  }
67
68
 
69
+ .#{$prefix}--slug:has(> .#{$prefix}--popover--open) {
70
+ z-index: 2;
71
+ }
72
+
68
73
  .#{$prefix}--slug .#{$prefix}--slug__button {
69
74
  position: relative;
70
75
  display: flex;
@@ -383,4 +388,18 @@ $sizes: (
383
388
  order: 1;
384
389
  border-end-end-radius: convert.to-rem(16px);
385
390
  }
391
+
392
+ // Revert styles
393
+ .#{$prefix}--slug.#{$prefix}--slug--revert {
394
+ transform: translate($spacing-03, -50%);
395
+ }
396
+
397
+ .#{$prefix}--slug--revert .#{$prefix}--btn--icon-only {
398
+ align-items: center;
399
+ padding-block-start: 0;
400
+ }
401
+
402
+ .#{$prefix}--slug--revert .#{$prefix}--btn--icon-only svg {
403
+ margin: 0;
404
+ }
386
405
  }
@@ -32,7 +32,7 @@
32
32
 
33
33
  display: table;
34
34
 
35
- background-color: transparent;
35
+ background-color: $layer transparent;
36
36
  border-collapse: collapse;
37
37
  border-spacing: 0;
38
38
  inline-size: 100%;
@@ -12,6 +12,7 @@
12
12
  @use '../../spacing' as *;
13
13
  @use '../../theme' as *;
14
14
  @use '../../type' as *;
15
+ @use '../../utilities/ai-gradient' as *;
15
16
  @use '../../utilities/component-reset';
16
17
  @use '../../utilities/convert';
17
18
  @use '../../utilities/focus-outline' as *;
@@ -121,9 +122,39 @@
121
122
  border-block-end-color: $border-subtle;
122
123
  }
123
124
 
124
- // V11: Possibly deprecate
125
- .#{$prefix}--text-area.#{$prefix}--text-area--light:disabled {
126
- background-color: $field-02;
125
+ // Styles for `Slug` rendered inside `TextArea`
126
+ .#{$prefix}--text-area__wrapper--slug .#{$prefix}--slug {
127
+ position: absolute;
128
+ inset-block-start: $spacing-04;
129
+ inset-inline-end: $spacing-05;
130
+ }
131
+
132
+ .#{$prefix}--text-area__wrapper--slug
133
+ .#{$prefix}--slug.#{$prefix}--slug--revert {
134
+ inset-block-start: $spacing-02;
135
+ inset-inline-end: $spacing-03;
136
+ transform: translate(0);
137
+ }
138
+
139
+ .#{$prefix}--text-area__wrapper--slug .#{$prefix}--text-area {
140
+ @include ai-gradient;
141
+
142
+ padding-inline-end: $spacing-08;
143
+ }
144
+
145
+ .#{$prefix}--text-area--invalid:has(~ .#{$prefix}--slug),
146
+ .#{$prefix}--text-area--warn:has(~ .#{$prefix}--slug) {
147
+ padding-inline-end: $spacing-10;
148
+ }
149
+
150
+ .#{$prefix}--text-area--invalid ~ .#{$prefix}--slug,
151
+ .#{$prefix}--text-area--warn ~ .#{$prefix}--slug {
152
+ inset-inline-end: $spacing-08;
153
+ }
154
+
155
+ .#{$prefix}--text-area--invalid ~ .#{$prefix}--slug.#{$prefix}--slug--revert,
156
+ .#{$prefix}--text-area--warn ~ .#{$prefix}--slug.#{$prefix}--slug--revert {
157
+ inset-inline-end: $spacing-07;
127
158
  }
128
159
 
129
160
  // Skeleton State
@@ -131,7 +162,6 @@
131
162
  @include skeleton;
132
163
 
133
164
  block-size: convert.to-rem(100px);
134
-
135
165
  inline-size: 100%;
136
166
 
137
167
  &::placeholder {
@@ -15,6 +15,7 @@
15
15
  @use '../../type' as *;
16
16
  @use '../../spacing' as *;
17
17
  @use '../../motion' as *;
18
+ @use '../../utilities/ai-gradient' as *;
18
19
  @use '../../utilities/component-reset';
19
20
  @use '../../utilities/placeholder-colors' as *;
20
21
  @use '../../utilities/tooltip' as *;
@@ -414,6 +415,30 @@
414
415
  border-block-end-color: $border-subtle;
415
416
  }
416
417
 
418
+ // Styles for Slug rendered inside TextInput
419
+ .#{$prefix}--text-input__field-wrapper .#{$prefix}--slug {
420
+ position: absolute;
421
+ inset-block-start: 50%;
422
+ inset-inline-end: $spacing-05;
423
+ transform: translateY(-50%);
424
+ }
425
+
426
+ .#{$prefix}--text-input__field-wrapper--slug .#{$prefix}--text-input {
427
+ @include ai-gradient;
428
+
429
+ padding-inline-end: $spacing-08;
430
+ }
431
+
432
+ .#{$prefix}--text-input--invalid:has(~ .#{$prefix}--slug),
433
+ .#{$prefix}--text-input--warning:has(~ .#{$prefix}--slug) {
434
+ padding-inline-end: $spacing-10;
435
+ }
436
+
437
+ .#{$prefix}--text-input--invalid ~ .#{$prefix}--slug,
438
+ .#{$prefix}--text-input--warning ~ .#{$prefix}--slug {
439
+ inset-inline-end: $spacing-08;
440
+ }
441
+
417
442
  // Windows HCM fix
418
443
  .#{$prefix}--btn.#{$prefix}--btn--icon-only.#{$prefix}--text-input--password__visibility__toggle.#{$prefix}--tooltip__trigger
419
444
  svg,
@@ -12,10 +12,10 @@
12
12
  /// @access public
13
13
  /// @param {String} $direction - Direction of gradient from: `left`, `right`, `top`, and `bottom`
14
14
  /// @param {Number} $width - Percentage width of gradient with regards to parent component
15
- /// @example @include focus-outline('outline');
15
+ /// @example @include ai-gradient('right', '33%');
16
16
  /// @group utilities
17
17
 
18
- @mixin ai-gradient($direction: 'right', $width: 50%) {
18
+ @mixin ai-gradient($direction: 'right', $width: 33%) {
19
19
  $deg: 0;
20
20
  @if $direction == 'bottom' {
21
21
  $deg: 0deg;