@carbon/grid 10.9.2 → 10.10.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/grid",
3
3
  "description": "Grid for digital and software products using the Carbon Design System",
4
- "version": "10.9.2",
4
+ "version": "10.10.0",
5
5
  "license": "Apache-2.0",
6
6
  "repository": "https://github.com/carbon-design-system/carbon/tree/master/packages/grid",
7
7
  "bugs": "https://github.com/carbon-design-system/carbon/issues",
@@ -28,10 +28,10 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@carbon/import-once": "^10.3.0",
31
- "@carbon/layout": "^10.8.2"
31
+ "@carbon/layout": "^10.9.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@carbon/bundler": "^10.6.0",
34
+ "@carbon/bundler": "^10.7.0",
35
35
  "rimraf": "^3.0.0"
36
36
  },
37
37
  "eyeglass": {
@@ -40,5 +40,5 @@
40
40
  "sassDir": "scss",
41
41
  "needs": "^1.3.0"
42
42
  },
43
- "gitHead": "319eca70647f2534a48f65cabf3c569b26b3eb51"
43
+ "gitHead": "6105a7b4c7f182f429109acbb1e6e01806de053f"
44
44
  }
@@ -209,36 +209,63 @@
209
209
  /// @type List
210
210
  /// @access public
211
211
  /// @group @carbon/grid
212
- $carbon--aspect-ratios: ((16, 9), (2, 1), (4, 3), (1, 1), (1, 2));
213
-
214
- /// Output the CSS classes for generating aspect ratio classes
215
- /// @param {List} $aspect-ratios [$carbon--aspect-ratios] - A list of aspect ratios to generate
212
+ $carbon--aspect-ratios: (
213
+ (16, 9),
214
+ (9, 16),
215
+ (2, 1),
216
+ (1, 2),
217
+ (4, 3),
218
+ (3, 4),
219
+ (1, 1)
220
+ );
221
+
222
+ /// Generates the CSS classname utilities for the aspect ratios
223
+ ///
224
+ /// CSS Tricks article on aspect ratios and all the different ways it can be done.
225
+ /// https://css-tricks.com/aspect-ratio-boxes/#article-header-id-6
226
+ ///
227
+ /// That article references an earlier article on the topic.
228
+ /// https://keithjgrant.com/posts/2017/03/aspect-ratios/
229
+ ///
230
+ /// @param {Number} $width width from an aspect ratio
231
+ /// @param {Number} $height height from an aspect ratio
216
232
  /// @access private
217
233
  /// @group @carbon/grid
218
234
  @mixin carbon--aspect-ratio($aspect-ratios: $carbon--aspect-ratios) {
219
235
  .#{$prefix}--aspect-ratio {
220
- height: 0;
221
236
  position: relative;
222
237
  }
223
238
 
239
+ .#{$prefix}--aspect-ratio::before {
240
+ content: '';
241
+ width: 1px;
242
+ margin-left: -1px;
243
+ float: left;
244
+ height: 0;
245
+ }
246
+
247
+ .#{$prefix}--aspect-ratio::after {
248
+ content: '';
249
+ display: table;
250
+ clear: both;
251
+ }
252
+
253
+ @each $aspect-ratio in $aspect-ratios {
254
+ $width: nth($aspect-ratio, 1);
255
+ $height: nth($aspect-ratio, 2);
256
+
257
+ .#{$prefix}--aspect-ratio--#{$width}x#{$height}::before {
258
+ padding-top: percentage($height / $width);
259
+ }
260
+ }
261
+
262
+ // leaving here for legacy support
224
263
  .#{$prefix}--aspect-ratio--object {
225
264
  position: absolute;
226
265
  top: 0;
227
- right: 0;
228
- bottom: 0;
229
266
  left: 0;
230
267
  width: 100%;
231
268
  height: 100%;
232
- z-index: 100;
233
- }
234
-
235
- @each $ratio in $aspect-ratios {
236
- $width: nth($ratio, 1);
237
- $height: nth($ratio, 2);
238
-
239
- .#{$prefix}--aspect-ratio--#{$width}x#{$height} {
240
- padding-bottom: percentage($height / $width);
241
- }
242
269
  }
243
270
  }
244
271
 
@@ -327,6 +354,12 @@ $carbon--aspect-ratios: ((16, 9), (2, 1), (4, 3), (1, 1), (1, 2));
327
354
  @include carbon--make-row();
328
355
  }
329
356
 
357
+ .#{$prefix}--row-padding [class*='#{$prefix}--col'],
358
+ .#{$prefix}--col-padding {
359
+ padding-top: $grid-gutter / 2;
360
+ padding-bottom: $grid-gutter / 2;
361
+ }
362
+
330
363
  .#{$prefix}--grid--condensed [class*='#{$prefix}--col'] {
331
364
  padding-top: $condensed-gutter / 2;
332
365
  padding-bottom: $condensed-gutter / 2;
package/scss/_mixins.scss CHANGED
@@ -209,36 +209,63 @@
209
209
  /// @type List
210
210
  /// @access public
211
211
  /// @group @carbon/grid
212
- $carbon--aspect-ratios: ((16, 9), (2, 1), (4, 3), (1, 1), (1, 2));
213
-
214
- /// Output the CSS classes for generating aspect ratio classes
215
- /// @param {List} $aspect-ratios [$carbon--aspect-ratios] - A list of aspect ratios to generate
212
+ $carbon--aspect-ratios: (
213
+ (16, 9),
214
+ (9, 16),
215
+ (2, 1),
216
+ (1, 2),
217
+ (4, 3),
218
+ (3, 4),
219
+ (1, 1)
220
+ );
221
+
222
+ /// Generates the CSS classname utilities for the aspect ratios
223
+ ///
224
+ /// CSS Tricks article on aspect ratios and all the different ways it can be done.
225
+ /// https://css-tricks.com/aspect-ratio-boxes/#article-header-id-6
226
+ ///
227
+ /// That article references an earlier article on the topic.
228
+ /// https://keithjgrant.com/posts/2017/03/aspect-ratios/
229
+ ///
230
+ /// @param {Number} $width width from an aspect ratio
231
+ /// @param {Number} $height height from an aspect ratio
216
232
  /// @access private
217
233
  /// @group @carbon/grid
218
234
  @mixin carbon--aspect-ratio($aspect-ratios: $carbon--aspect-ratios) {
219
235
  .#{$prefix}--aspect-ratio {
220
- height: 0;
221
236
  position: relative;
222
237
  }
223
238
 
239
+ .#{$prefix}--aspect-ratio::before {
240
+ content: '';
241
+ width: 1px;
242
+ margin-left: -1px;
243
+ float: left;
244
+ height: 0;
245
+ }
246
+
247
+ .#{$prefix}--aspect-ratio::after {
248
+ content: '';
249
+ display: table;
250
+ clear: both;
251
+ }
252
+
253
+ @each $aspect-ratio in $aspect-ratios {
254
+ $width: nth($aspect-ratio, 1);
255
+ $height: nth($aspect-ratio, 2);
256
+
257
+ .#{$prefix}--aspect-ratio--#{$width}x#{$height}::before {
258
+ padding-top: percentage($height / $width);
259
+ }
260
+ }
261
+
262
+ // leaving here for legacy support
224
263
  .#{$prefix}--aspect-ratio--object {
225
264
  position: absolute;
226
265
  top: 0;
227
- right: 0;
228
- bottom: 0;
229
266
  left: 0;
230
267
  width: 100%;
231
268
  height: 100%;
232
- z-index: 100;
233
- }
234
-
235
- @each $ratio in $aspect-ratios {
236
- $width: nth($ratio, 1);
237
- $height: nth($ratio, 2);
238
-
239
- .#{$prefix}--aspect-ratio--#{$width}x#{$height} {
240
- padding-bottom: percentage($height / $width);
241
- }
242
269
  }
243
270
  }
244
271
 
@@ -327,6 +354,12 @@ $carbon--aspect-ratios: ((16, 9), (2, 1), (4, 3), (1, 1), (1, 2));
327
354
  @include carbon--make-row();
328
355
  }
329
356
 
357
+ .#{$prefix}--row-padding [class*='#{$prefix}--col'],
358
+ .#{$prefix}--col-padding {
359
+ padding-top: $grid-gutter / 2;
360
+ padding-bottom: $grid-gutter / 2;
361
+ }
362
+
330
363
  .#{$prefix}--grid--condensed [class*='#{$prefix}--col'] {
331
364
  padding-top: $condensed-gutter / 2;
332
365
  padding-bottom: $condensed-gutter / 2;
@@ -163,8 +163,13 @@ $carbon--grid-breakpoints: (
163
163
  @content;
164
164
  }
165
165
  } @else if map-has-key($breakpoints, $name) {
166
+ // We borrow this logic from bootstrap for specifying the value of the
167
+ // max-width. The maximum width is calculated by finding the breakpoint and
168
+ // subtracting .02 from its value. This value is used instead of .01 to
169
+ // avoid rounding issues in Safari
170
+ // https://github.com/twbs/bootstrap/blob/c5b1919deaf5393fcca9e9b9d7ce9c338160d99d/scss/mixins/_breakpoints.scss#L34-L46
166
171
  $breakpoint: map-get($breakpoints, $name);
167
- $width: map-get($breakpoint, width);
172
+ $width: map-get($breakpoint, width) - 0.02;
168
173
  @media (max-width: $width) {
169
174
  @content;
170
175
  }