@carbon/elements 10.35.0 → 10.37.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/elements",
3
3
  "description": "A collection of design elements in code for the IBM Design Language",
4
- "version": "10.35.0",
4
+ "version": "10.37.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -35,21 +35,21 @@
35
35
  "clean": "rimraf es lib umd && node tasks/clean.js"
36
36
  },
37
37
  "dependencies": {
38
- "@carbon/colors": "^10.26.0",
39
- "@carbon/grid": "^10.28.0",
40
- "@carbon/icons": "^10.33.0",
38
+ "@carbon/colors": "^10.27.0",
39
+ "@carbon/grid": "^10.30.0",
40
+ "@carbon/icons": "^10.34.0",
41
41
  "@carbon/import-once": "^10.6.0",
42
- "@carbon/layout": "^10.25.0",
43
- "@carbon/motion": "^10.19.0",
44
- "@carbon/themes": "^10.35.0",
45
- "@carbon/type": "^10.29.0"
42
+ "@carbon/layout": "^10.26.0",
43
+ "@carbon/motion": "^10.20.0",
44
+ "@carbon/themes": "^10.37.0",
45
+ "@carbon/type": "^10.30.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@carbon/cli": "^10.24.0",
48
+ "@carbon/cli": "^10.25.0",
49
49
  "fs-extra": "^8.1.0",
50
50
  "klaw-sync": "^6.0.0",
51
51
  "replace-in-file": "^3.4.2",
52
52
  "rimraf": "^3.0.0"
53
53
  },
54
- "gitHead": "d02eacdefc2c94da1b7619a20df441e264bf884c"
54
+ "gitHead": "74da5c7df7a93263ed79ed9b3dd6dc2b52d80024"
55
55
  }
@@ -11,6 +11,7 @@
11
11
 
12
12
  @mixin css-grid() {
13
13
  display: grid;
14
+ max-width: 99rem;
14
15
  padding-right: calc(var(--cds-grid-margin) + var(--cds-grid-gutter) / 2);
15
16
  padding-left: calc(var(--cds-grid-margin) + var(--cds-grid-gutter) / 2);
16
17
  margin-right: auto;
@@ -35,6 +36,8 @@
35
36
  --cds-grid-columns: 4;
36
37
  --cds-grid-column-size: 1fr;
37
38
  --cds-grid-gutter: 2rem;
39
+ // Used to configure appropriate margins for condensed subgrids inside wide grids
40
+ --cds-grid-gutter-wide: 2rem;
38
41
  --cds-grid-hang: 1rem;
39
42
  --cds-grid-margin: 0;
40
43
 
@@ -67,20 +70,8 @@
67
70
  @include subgrid();
68
71
  }
69
72
 
70
- .#{$prefix}--css-grid--narrow .#{$prefix}--subgrid.#{$prefix}--css-grid {
71
- padding-right: 0;
72
- padding-left: 0;
73
- margin-right: 0;
74
- margin-left: 0;
75
- }
76
-
77
- .#{$prefix}--css-grid--condensed .#{$prefix}--subgrid.#{$prefix}--css-grid {
78
- --cds-grid-gutter: 2rem;
79
-
80
- padding-right: calc(var(--cds-grid-gutter) / 2);
81
- padding-left: calc(var(--cds-grid-gutter) / 2);
82
- margin-right: 0;
83
- margin-left: 0;
73
+ .#{$prefix}--subgrid[class*='col'] {
74
+ display: grid;
84
75
  }
85
76
 
86
77
  // -----------------------------------------------------------------------------
@@ -102,13 +93,17 @@
102
93
  margin-left: calc(var(--cds-grid-gutter) / 2 * -1);
103
94
  }
104
95
 
105
- // Narrow subgrid inside condensed
106
- .#{$prefix}--css-grid--condensed
96
+ // Narrow subgrid inside wide
97
+ .#{$prefix}--css-grid:not(.#{$prefix}--css-grid--condensed)
107
98
  .#{$prefix}--subgrid.#{$prefix}--css-grid--narrow {
108
- --cds-grid-gutter: 2rem;
99
+ padding: 0;
100
+ }
109
101
 
110
- padding-right: calc(var(--cds-grid-gutter) / 2);
111
- padding-left: calc(var(--cds-grid-gutter) / 2);
102
+ // Narrow subgrid column inside wide
103
+ .#{$prefix}--css-grid
104
+ .#{$prefix}--subgrid.#{$prefix}--css-grid--narrow
105
+ > [class*='col'] {
106
+ margin-left: calc(var(--cds-grid-gutter) / 2 * -1);
112
107
  }
113
108
 
114
109
  // -----------------------------------------------------------------------------
@@ -122,11 +117,10 @@
122
117
  }
123
118
 
124
119
  // condensed subgrid inside wide
125
- .#{$prefix}--css-grid .bx--subgrid.#{$prefix}--css-grid--condensed {
126
- margin-right: calc(
127
- (var(--cds-grid-margin) + var(--cds-grid-gutter) / 2) * -1
128
- );
129
- margin-left: calc((var(--cds-grid-margin) + var(--cds-grid-gutter) / 2) * -1);
120
+ .#{$prefix}--css-grid:not(.#{$prefix}--css-grid--narrow)
121
+ .bx--subgrid.#{$prefix}--css-grid--condensed {
122
+ margin-right: calc((var(--cds-grid-gutter-wide) / 2) * -1);
123
+ margin-left: calc((var(--cds-grid-gutter-wide) / 2) * -1);
130
124
  }
131
125
 
132
126
  // -----------------------------------------------------------------------------
@@ -142,6 +136,13 @@
142
136
  column-gap: var(--cds-grid-gutter);
143
137
  }
144
138
 
139
+ // -----------------------------------------------------------------------------
140
+ // Full width
141
+ // -----------------------------------------------------------------------------
142
+ .#{$prefix}--css-grid--full-width {
143
+ max-width: 100%;
144
+ }
145
+
145
146
  // -----------------------------------------------------------------------------
146
147
  // Column span
147
148
  // -----------------------------------------------------------------------------
@@ -151,6 +152,7 @@
151
152
  } @else {
152
153
  --cds-grid-columns: #{$i};
153
154
 
155
+ display: block;
154
156
  grid-column: span $i / span $i;
155
157
  }
156
158
  }
@@ -268,7 +270,10 @@
268
270
  $columns: map.get($value, columns);
269
271
 
270
272
  @include breakpoint($name) {
271
- @for $i from 1 through $columns {
273
+ // The `grid-column-end` and `grid-column-start` properies are *not* inclusive.
274
+ // It starts/ends the column *at* the column, not *on* the column. We must
275
+ // ensure that there is one additional class available for each breakpoint.
276
+ @for $i from 1 through $columns + 1 {
272
277
  .#{$prefix}--#{$name}\:col-start-#{$i} {
273
278
  grid-column-start: $i;
274
279
  }
@@ -348,3 +353,67 @@
348
353
  .#{$prefix}--align-items-center {
349
354
  align-items: center;
350
355
  }
356
+
357
+ // -----------------------------------------------------------------------------
358
+ // Aspect ratio -- TODO: in v11 should this move to a new file to live alongside the AspectRatio component?
359
+ // -----------------------------------------------------------------------------
360
+
361
+ /// The aspect ratios that are used to generate corresponding aspect ratio
362
+ /// classes in code
363
+ /// @type List
364
+ /// @access public
365
+ /// @group @carbon/grid
366
+ $carbon--aspect-ratios: (
367
+ (16, 9),
368
+ (9, 16),
369
+ (2, 1),
370
+ (1, 2),
371
+ (4, 3),
372
+ (3, 4),
373
+ (3, 2),
374
+ (2, 3),
375
+ (1, 1)
376
+ );
377
+
378
+ /// Generates the CSS classname utilities for the aspect ratios
379
+ ///
380
+ /// CSS Tricks article on aspect ratios and all the different ways it can be done.
381
+ /// https://css-tricks.com/aspect-ratio-boxes/#article-header-id-6
382
+ ///
383
+ /// That article references an earlier article on the topic.
384
+ /// https://keithjgrant.com/posts/2017/03/aspect-ratios/
385
+ ///
386
+ /// @param {Number} $width width from an aspect ratio
387
+ /// @param {Number} $height height from an aspect ratio
388
+ /// @access private
389
+ /// @group @carbon/grid
390
+ @mixin carbon--aspect-ratio($aspect-ratios: $carbon--aspect-ratios) {
391
+ .#{$prefix}--aspect-ratio {
392
+ position: relative;
393
+ }
394
+
395
+ .#{$prefix}--aspect-ratio::before {
396
+ width: 1px;
397
+ height: 0;
398
+ margin-left: -1px;
399
+ content: '';
400
+ float: left;
401
+ }
402
+
403
+ .#{$prefix}--aspect-ratio::after {
404
+ display: table;
405
+ clear: both;
406
+ content: '';
407
+ }
408
+
409
+ @each $aspect-ratio in $aspect-ratios {
410
+ $width: nth($aspect-ratio, 1);
411
+ $height: nth($aspect-ratio, 2);
412
+
413
+ .#{$prefix}--aspect-ratio--#{$width}x#{$height}::before {
414
+ padding-top: percentage($height / $width);
415
+ }
416
+ }
417
+ }
418
+
419
+ @include carbon--aspect-ratio();
@@ -264,6 +264,87 @@
264
264
  $icon-size-01: map-get($theme, 'icon-size-01') !global;
265
265
  $icon-size-02: map-get($theme, 'icon-size-02') !global;
266
266
 
267
+ @if global-variable-exists('feature-flags') ==
268
+ false or
269
+ global-variable-exists('feature-flags') and
270
+ map-get($feature-flags, 'enable-v11-release') !=
271
+ true
272
+ {
273
+ $background: $ui-background !global;
274
+ $layer: $ui-01 !global;
275
+ $layer-accent: $ui-03 !global;
276
+ $field: $field-01 !global;
277
+ $background-inverse: $inverse-02 !global;
278
+ $background-brand: $interactive-01 !global;
279
+ $interactive: $interactive-04 !global;
280
+ $border-subtle: $ui-03 !global;
281
+ $border-strong: $ui-04 !global;
282
+ $border-inverse: $ui-05 !global;
283
+ $border-interactive: $interactive-04 !global;
284
+ $text-primary: $text-01 !global;
285
+ $text-secondary: $text-02 !global;
286
+ $text-placeholder: $text-03 !global;
287
+ $text-helper: $text-05 !global;
288
+ $text-on-color: $text-04 !global;
289
+ $text-inverse: $inverse-01 !global;
290
+ $link-primary: $link-01 !global;
291
+ $link-secondary: $link-02 !global;
292
+ $link-visited: $visited-link !global;
293
+ $link-inverse: $inverse-link !global;
294
+ $icon-primary: $icon-01 !global;
295
+ $icon-secondary: $icon-02 !global;
296
+ $icon-on-color: $icon-03 !global;
297
+ $icon-inverse: $inverse-01 !global;
298
+ $support-error: $support-01 !global;
299
+ $support-success: $support-02 !global;
300
+ $support-warning: $support-03 !global;
301
+ $support-info: $support-04 !global;
302
+ $support-error-inverse: $inverse-support-01 !global;
303
+ $support-success-inverse: $inverse-support-02 !global;
304
+ $support-warning-inverse: $inverse-support-03 !global;
305
+ $support-info-inverse: $inverse-support-04 !global;
306
+ $overlay: $overlay-01 !global;
307
+ $toggle-off: $ui-04 !global;
308
+ $button-primary: $interactive-01 !global;
309
+ $button-secondary: $interactive-02 !global;
310
+ $button-tertiary: $interactive-03 !global;
311
+ $button-danger-primary: $danger-01 !global;
312
+ $button-danger-secondary: $danger-02 !global;
313
+ $background-active: $active-ui !global;
314
+ $layer-active: $active-ui !global;
315
+ $button-danger-active: $active-danger !global;
316
+ $button-primary-active: $active-primary !global;
317
+ $button-secondary-active: $active-secondary !global;
318
+ $button-tertiary-active: $active-tertiary !global;
319
+ $focus-inset: $inverse-01 !global;
320
+ $focus-inverse: $inverse-focus-ui !global;
321
+ $background-hover: $hover-ui !global;
322
+ $layer-hover: $hover-ui !global;
323
+ $field-hover: $hover-ui !global;
324
+ $background-inverse-hover: $inverse-hover-ui !global;
325
+ $link-primary-hover: $hover-primary-text !global;
326
+ $button-danger-hover: $hover-danger !global;
327
+ $button-primary-hover: $hover-primary !global;
328
+ $button-secondary-hover: $hover-secondary !global;
329
+ $button-tertiary-hover: $hover-tertiary !global;
330
+ $background-selected: $selected-ui !global;
331
+ $background-selected-hover: $hover-selected-ui !global;
332
+ $layer-selected: $selected-ui !global;
333
+ $layer-selected-hover: $hover-selected-ui !global;
334
+ $layer-selected-inverse: $ui-05 !global;
335
+ $border-subtle-selected: $active-ui !global;
336
+ $layer-disabled: $disabled-01 !global;
337
+ $field-disabled: $disabled-01 !global;
338
+ $border-disabled: $disabled-01 !global;
339
+ $text-disabled: $disabled-02 !global;
340
+ $button-disabled: $disabled-02 !global;
341
+ $icon-disabled: $disabled-02 !global;
342
+ $text-on-color-disabled: $disabled-03 !global;
343
+ $icon-on-color-disabled: $disabled-03 !global;
344
+ $layer-selected-disabled: $disabled-03 !global;
345
+ $skeleton-background: $skeleton-01 !global;
346
+ $skeleton-element: $skeleton-02 !global;
347
+ }
267
348
  @if global-variable-exists('feature-flags') and
268
349
  map-get($feature-flags, 'enable-css-custom-properties')
269
350
  {
@@ -14,7 +14,7 @@ $-custom-property-prefix: 'cds';
14
14
 
15
15
  /// @access public
16
16
  /// @group @carbon/themes
17
- @mixin theme($active-theme: $theme) {
17
+ @mixin theme($active-theme: $theme, $component-tokens...) {
18
18
  $parent-theme: $theme;
19
19
  $theme: $active-theme !global;
20
20
 
@@ -22,6 +22,12 @@ $-custom-property-prefix: 'cds';
22
22
  @include -custom-property($token, $value);
23
23
  }
24
24
 
25
+ @each $group in $component-tokens {
26
+ @each $token, $value in $group {
27
+ @include -custom-property($token, $value);
28
+ }
29
+ }
30
+
25
31
  @content;
26
32
 
27
33
  $theme: $parent-theme !global;