@carbon/styles 0.10.0 → 0.12.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.
@@ -23,17 +23,19 @@
23
23
  @use '../../utilities/rotate' as *;
24
24
  @use '../../utilities/box-shadow' as *;
25
25
  @use '../../utilities/component-tokens' as *;
26
+ @use '../../utilities/custom-property';
26
27
  @use '../../utilities/skeleton' as *;
27
28
  @use '../../utilities/visually-hidden' as *;
28
29
  @use '../../utilities/button-reset';
29
30
  @use '../../utilities/high-contrast-mode' as *;
30
31
  @use '../../utilities/convert' as *;
31
32
 
33
+ $icon-tab-size: custom-property.get-var('icon-tab-size', rem(40px));
34
+
32
35
  /// Tabs styles
33
36
  /// @access public
34
37
  /// @group tabs
35
38
  @mixin tabs {
36
- // TODO: remove namespace and suffix in next major release
37
39
  .#{$prefix}--tabs {
38
40
  @include reset;
39
41
  @include type-style('body-short-01');
@@ -44,7 +46,7 @@
44
46
  min-height: rem(40px);
45
47
  color: $text-primary;
46
48
 
47
- &.#{$prefix}--tabs--container {
49
+ &.#{$prefix}--tabs--contained {
48
50
  min-height: rem(48px);
49
51
  }
50
52
 
@@ -95,11 +97,11 @@
95
97
  background-image: linear-gradient(to right, transparent, $layer);
96
98
  }
97
99
 
98
- &.#{$prefix}--tabs--container .#{$prefix}--tabs__overflow-indicator--left {
100
+ &.#{$prefix}--tabs--contained .#{$prefix}--tabs__overflow-indicator--left {
99
101
  background-image: linear-gradient(to left, transparent, $layer-accent);
100
102
  }
101
103
 
102
- &.#{$prefix}--tabs--container .#{$prefix}--tabs__overflow-indicator--right {
104
+ &.#{$prefix}--tabs--contained .#{$prefix}--tabs__overflow-indicator--right {
103
105
  background-image: linear-gradient(to right, transparent, $layer-accent);
104
106
  }
105
107
 
@@ -124,7 +126,7 @@
124
126
  );
125
127
  }
126
128
 
127
- &.#{$prefix}--tabs--container
129
+ &.#{$prefix}--tabs--contained
128
130
  .#{$prefix}--tabs__overflow-indicator--left {
129
131
  background-image: linear-gradient(
130
132
  to left,
@@ -133,7 +135,7 @@
133
135
  );
134
136
  }
135
137
 
136
- &.#{$prefix}--tabs--container
138
+ &.#{$prefix}--tabs--contained
137
139
  .#{$prefix}--tabs__overflow-indicator--right {
138
140
  background-image: linear-gradient(
139
141
  to right,
@@ -162,7 +164,7 @@
162
164
  display: none;
163
165
  }
164
166
 
165
- &.#{$prefix}--tabs--container .#{$prefix}--tab--overflow-nav-button {
167
+ &.#{$prefix}--tabs--contained .#{$prefix}--tab--overflow-nav-button {
166
168
  width: $spacing-09;
167
169
  margin: 0;
168
170
  background-color: $layer-accent;
@@ -189,11 +191,11 @@
189
191
  margin-left: rem(1px);
190
192
  }
191
193
 
192
- &.#{$prefix}--tabs--container .#{$prefix}--tabs__nav-item {
194
+ &.#{$prefix}--tabs--contained .#{$prefix}--tabs__nav-item {
193
195
  background-color: $layer-accent;
194
196
  }
195
197
 
196
- &.#{$prefix}--tabs--container
198
+ &.#{$prefix}--tabs--contained
197
199
  .#{$prefix}--tabs__nav-item
198
200
  + .#{$prefix}--tabs__nav-item {
199
201
  margin-left: 0;
@@ -201,87 +203,12 @@
201
203
  box-shadow: rem(-1px) 0 0 0 $border-strong;
202
204
  }
203
205
 
204
- &.#{$prefix}--tabs--container
205
- .#{$prefix}--tabs__nav-item
206
- + .#{$prefix}--tabs__nav-item.#{$prefix}--tabs__nav-item--selected,
207
- &.#{$prefix}--tabs--container
208
- .#{$prefix}--tabs__nav-item.#{$prefix}--tabs__nav-item--selected
209
- + .#{$prefix}--tabs__nav-item {
210
- box-shadow: none;
211
- }
212
-
213
206
  .#{$prefix}--tabs__nav-item .#{$prefix}--tabs__nav-link {
214
207
  transition: color $duration-fast-01 motion(standard, productive),
215
208
  border-bottom-color $duration-fast-01 motion(standard, productive),
216
209
  outline $duration-fast-01 motion(standard, productive);
217
210
  }
218
211
 
219
- //-----------------------------
220
- // Item Hover
221
- //-----------------------------
222
- &.#{$prefix}--tabs--container .#{$prefix}--tabs__nav-item:hover {
223
- background-color: $layer-selected-hover;
224
- }
225
-
226
- //---------------------------------------------
227
- // Item Disabled
228
- //---------------------------------------------
229
- .#{$prefix}--tabs__nav-item--disabled,
230
- .#{$prefix}--tabs__nav-item--disabled:hover {
231
- background-color: transparent;
232
- cursor: not-allowed;
233
- outline: none;
234
- }
235
-
236
- &.#{$prefix}--tabs--container
237
- .#{$prefix}--tabs__nav-item.#{$prefix}--tabs__nav-item--disabled,
238
- &.#{$prefix}--tabs--container
239
- .#{$prefix}--tabs__nav-item.#{$prefix}--tabs__nav-item--disabled:hover {
240
- background-color: button.$button-disabled;
241
- }
242
-
243
- //-----------------------------
244
- // Item Selected
245
- //-----------------------------
246
- .#{$prefix}--tabs__nav-item--selected {
247
- transition: color $duration-fast-01 motion(standard, productive);
248
- }
249
-
250
- .#{$prefix}--tabs__nav-item--selected .#{$prefix}--tabs__nav-link,
251
- .#{$prefix}--tabs__nav-item--selected .#{$prefix}--tabs__nav-link:focus,
252
- .#{$prefix}--tabs__nav-item--selected .#{$prefix}--tabs__nav-link:active {
253
- @include type-style('productive-heading-01');
254
-
255
- border-bottom: 2px solid $border-interactive;
256
- color: $text-primary;
257
- }
258
-
259
- &.#{$prefix}--tabs--container .#{$prefix}--tabs__nav-item--selected,
260
- &.#{$prefix}--tabs--container .#{$prefix}--tabs__nav-item--selected:hover {
261
- background-color: $layer;
262
-
263
- .#{$prefix}--tabs__nav-link:focus,
264
- .#{$prefix}--tabs__nav-link:active {
265
- box-shadow: none;
266
- }
267
- }
268
-
269
- &.#{$prefix}--tabs--container
270
- .#{$prefix}--tabs__nav-item--selected
271
- .#{$prefix}--tabs__nav-link {
272
- // Draws the border without affecting the inner-content
273
- box-shadow: inset 0 2px 0 0 $border-interactive;
274
- // height - vertical padding
275
- line-height: calc(#{rem(48px)} - (#{$spacing-03} * 2));
276
- }
277
-
278
- &.#{$prefix}--tabs--light.#{$prefix}--tabs--container
279
- .#{$prefix}--tabs__nav-item--selected,
280
- &.#{$prefix}--tabs--light.#{$prefix}--tabs--container
281
- .#{$prefix}--tabs__nav-item--selected:hover {
282
- background-color: $background;
283
- }
284
-
285
212
  //-----------------------------
286
213
  // Link
287
214
  //-----------------------------
@@ -295,10 +222,10 @@
295
222
  }
296
223
 
297
224
  overflow: hidden;
225
+ max-width: 10rem;
298
226
  padding: $spacing-04 $spacing-05 $spacing-03;
299
227
  border-bottom: $tab-underline-color;
300
228
  color: $text-secondary;
301
- text-align: left;
302
229
  text-decoration: none;
303
230
  text-overflow: ellipsis;
304
231
  transition: border $duration-fast-01 motion(standard, productive),
@@ -311,12 +238,88 @@
311
238
  }
312
239
  }
313
240
 
314
- &.#{$prefix}--tabs--container .#{$prefix}--tabs__nav-link {
241
+ &.#{$prefix}--tabs--contained .#{$prefix}--tabs__nav-link {
315
242
  height: rem(48px);
316
243
  padding: $spacing-03 $spacing-05;
317
244
  border-bottom: 0;
318
245
  // height - vertical padding
319
246
  line-height: calc(#{rem(48px)} - (#{$spacing-03} * 2));
247
+ text-align: left;
248
+ }
249
+
250
+ //-----------------------------
251
+ // Icon Item
252
+ //-----------------------------
253
+
254
+ .#{$prefix}--tabs__nav-item--icon,
255
+ &.#{$prefix}--tabs--contained .#{$prefix}--tabs__nav-item--icon {
256
+ display: flex;
257
+ width: $icon-tab-size;
258
+ height: $icon-tab-size;
259
+ align-items: center;
260
+ justify-content: center;
261
+ padding: 0;
262
+ }
263
+
264
+ &.#{$prefix}--tabs__icon--lg {
265
+ @include custom-property.declaration('icon-tab-size', rem(48px));
266
+ }
267
+
268
+ //-----------------------------
269
+ // Item Hover
270
+ //-----------------------------
271
+ &.#{$prefix}--tabs--contained .#{$prefix}--tabs__nav-item:hover {
272
+ background-color: $layer-selected-hover;
273
+ }
274
+
275
+ //-----------------------------
276
+ // Item Selected
277
+ //-----------------------------
278
+ .#{$prefix}--tabs__nav-item--selected {
279
+ border-bottom: 2px solid $border-interactive;
280
+ transition: color $duration-fast-01 motion(standard, productive);
281
+ }
282
+
283
+ &.#{$prefix}--tabs--contained
284
+ .#{$prefix}--tabs__nav-item--selected
285
+ + .#{$prefix}--tabs__nav-item {
286
+ box-shadow: none;
287
+ }
288
+
289
+ &.#{$prefix}--tabs--contained
290
+ .#{$prefix}--tabs__nav-item.#{$prefix}--tabs__nav-item--selected {
291
+ // Draws the border without affecting the inner-content
292
+ box-shadow: inset 0 2px 0 0 $border-interactive;
293
+ }
294
+
295
+ &.#{$prefix}--tabs--contained .#{$prefix}--tabs__nav-item--selected,
296
+ .#{$prefix}--tabs__nav-item--selected,
297
+ .#{$prefix}--tabs__nav-item--selected:focus
298
+ .#{$prefix}--tabs__nav-link:focus,
299
+ .#{$prefix}--tabs__nav-item--selected:active
300
+ .#{$prefix}--tabs__nav-link:active {
301
+ @include type-style('productive-heading-01');
302
+
303
+ color: $text-primary;
304
+ }
305
+
306
+ &.#{$prefix}--tabs--contained .#{$prefix}--tabs__nav-item--selected,
307
+ &.#{$prefix}--tabs--contained .#{$prefix}--tabs__nav-item--selected:hover {
308
+ background-color: $layer;
309
+ // height - vertical padding
310
+ line-height: calc(#{rem(48px)} - (#{$spacing-03} * 2));
311
+
312
+ .#{$prefix}--tabs__nav-link:focus,
313
+ .#{$prefix}--tabs__nav-link:active {
314
+ box-shadow: none;
315
+ }
316
+ }
317
+
318
+ &.#{$prefix}--tabs--light.#{$prefix}--tabs--contained
319
+ .#{$prefix}--tabs__nav-item--selected,
320
+ &.#{$prefix}--tabs--light.#{$prefix}--tabs--contained
321
+ .#{$prefix}--tabs__nav-item--selected:hover {
322
+ background-color: $background;
320
323
  }
321
324
 
322
325
  //-----------------------------
@@ -327,31 +330,35 @@
327
330
  color: $text-primary;
328
331
  }
329
332
 
330
- &.#{$prefix}--tabs--container
331
- .#{$prefix}--tabs__nav-item
332
- .#{$prefix}--tabs__nav-link {
333
- border-bottom: none;
334
- }
335
-
336
333
  //-----------------------------
337
- // Link Disabled
334
+ // Item Disabled
338
335
  //-----------------------------
339
- .#{$prefix}--tabs__nav-item--disabled .#{$prefix}--tabs__nav-link {
336
+
337
+ .#{$prefix}--tabs__nav-item--disabled {
340
338
  border-bottom: $tab-underline-disabled;
339
+ background-color: transparent;
341
340
  color: $tab-text-disabled;
341
+ outline: none;
342
342
  }
343
343
 
344
- .#{$prefix}--tabs__nav-item--disabled:hover .#{$prefix}--tabs__nav-link {
344
+ .#{$prefix}--tabs__nav-item--disabled:hover {
345
345
  border-bottom: $tab-underline-disabled;
346
346
  color: $tab-text-disabled;
347
347
  cursor: not-allowed;
348
- pointer-events: none;
349
348
  }
350
349
 
351
- .#{$prefix}--tabs__nav-item--disabled .#{$prefix}--tabs__nav-link:focus,
352
- .#{$prefix}--tabs__nav-item--disabled .#{$prefix}--tabs__nav-link:active {
350
+ &.#{$prefix}--tabs--contained
351
+ .#{$prefix}--tabs__nav-item.#{$prefix}--tabs__nav-item--disabled,
352
+ &.#{$prefix}--tabs--contained
353
+ .#{$prefix}--tabs__nav-item.#{$prefix}--tabs__nav-item--disabled:hover {
354
+ background-color: button.$button-disabled;
355
+ }
356
+
357
+ .#{$prefix}--tabs__nav-item--disabled:focus,
358
+ .#{$prefix}--tabs__nav-item--disabled:active {
353
359
  border-bottom: $tab-underline-disabled;
354
360
  outline: none;
361
+ pointer-events: none;
355
362
  }
356
363
 
357
364
  .#{$prefix}--tabs--light
@@ -375,9 +382,7 @@
375
382
  border-bottom-color: $border-subtle;
376
383
  }
377
384
 
378
- &.#{$prefix}--tabs--container
379
- .#{$prefix}--tabs__nav-item--disabled
380
- .#{$prefix}--tabs__nav-link {
385
+ &.#{$prefix}--tabs--contained .#{$prefix}--tabs__nav-item--disabled {
381
386
  border-bottom: none;
382
387
  color: $text-on-color-disabled;
383
388
  }
@@ -401,7 +406,7 @@
401
406
  pointer-events: none;
402
407
  }
403
408
 
404
- .#{$prefix}--skeleton.#{$prefix}--tabs:not(.#{$prefix}--tabs--container)
409
+ .#{$prefix}--skeleton.#{$prefix}--tabs:not(.#{$prefix}--tabs--contained)
405
410
  .#{$prefix}--tabs__nav-link {
406
411
  border-bottom: 2px solid $skeleton-element;
407
412
  }
@@ -429,7 +434,6 @@
429
434
  @include high-contrast-mode('focus');
430
435
  }
431
436
 
432
- // stylelint-disable-next-line no-duplicate-selectors
433
437
  .#{$prefix}--tabs
434
438
  .#{$prefix}--tabs__nav-item--disabled
435
439
  .#{$prefix}--tabs__nav-link {