@carbon/grid 10.28.0 → 10.30.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 +4 -4
- package/scss/modules/_css-grid.scss +94 -25
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/grid",
|
|
3
3
|
"description": "Grid for digital and software products using the Carbon Design System",
|
|
4
|
-
"version": "10.
|
|
4
|
+
"version": "10.30.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@carbon/import-once": "^10.6.0",
|
|
35
|
-
"@carbon/layout": "^10.
|
|
35
|
+
"@carbon/layout": "^10.26.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@carbon/cli": "^10.
|
|
38
|
+
"@carbon/cli": "^10.25.0",
|
|
39
39
|
"rimraf": "^3.0.0"
|
|
40
40
|
},
|
|
41
41
|
"eyeglass": {
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"sassDir": "scss",
|
|
45
45
|
"needs": "^1.3.0"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "74da5c7df7a93263ed79ed9b3dd6dc2b52d80024"
|
|
48
48
|
}
|
|
@@ -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}--
|
|
71
|
-
|
|
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
|
|
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
|
-
|
|
99
|
+
padding: 0;
|
|
100
|
+
}
|
|
109
101
|
|
|
110
|
-
|
|
111
|
-
|
|
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
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
|
|
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();
|