@carbon/elements 10.54.0-rc.0 → 10.54.2

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.
@@ -9,6 +9,7 @@
9
9
  // and often derived from, bootstrap:
10
10
  // https://github.com/twbs/bootstrap/blob/v4-dev/scss/mixins/_grid.scss
11
11
 
12
+ @use 'sass:list';
12
13
  @use 'sass:meta';
13
14
  @use 'sass:math';
14
15
  @use 'sass:map';
@@ -24,12 +25,12 @@
24
25
  /// for setting width and default gutters when a column's breakpoint has not been
25
26
  /// hit yet.
26
27
  /// @param {Number} $gutter [$grid-gutter] - The gutter for the grid system
27
- /// @param {Number} $collapsed-gutter [$grid-gutter--condensed] - The condensed mode gutter
28
+ /// @param {Number} $collapsed-gutter [$grid-gutter-condensed] - The condensed mode gutter
28
29
  /// @access private
29
30
  /// @group @carbon/grid
30
31
  @mixin -make-col-ready(
31
32
  $gutter: $grid-gutter,
32
- $condensed-gutter: $grid-gutter--condensed
33
+ $condensed-gutter: $grid-gutter-condensed
33
34
  ) {
34
35
  // Prevent columns from becoming too narrow when at smaller grid tiers by
35
36
  // always setting `width: 100%;`. This works because we use `flex` values
@@ -254,7 +255,7 @@
254
255
  margin-right: auto;
255
256
  margin-left: auto;
256
257
 
257
- @include -set-largest-breakpoint();
258
+ @include -set-largest-breakpoint($breakpoints);
258
259
 
259
260
  @each $name, $value in $breakpoints {
260
261
  $prev-breakpoint: map.get($breakpoints, breakpoint-prev($name));
@@ -282,7 +283,7 @@
282
283
  /// @access private
283
284
  /// @group @carbon/grid
284
285
  @mixin -set-largest-breakpoint($breakpoints: $grid-breakpoints) {
285
- $largest-breakpoint: last-map-item($breakpoints);
286
+ $largest-breakpoint: -last-map-item($breakpoints);
286
287
 
287
288
  max-width: map.get($largest-breakpoint, 'width');
288
289
  }
@@ -299,16 +300,37 @@
299
300
  }
300
301
  }
301
302
 
303
+ /// Pass in a map, and get the last one in the list back
304
+ /// @access public
305
+ /// @param {Map} $map - Map
306
+ /// @return {*} Desired value
307
+ /// @group @carbon/layout
308
+ @function -last-map-item($map) {
309
+ $total-length: list.length($map);
310
+ @return map-get($map, -key-by-index($map, $total-length));
311
+ }
312
+
313
+ /// Provide a map and index, and get back the relevant key value
314
+ /// @access public
315
+ /// @param {Map} $map - Map
316
+ /// @param {Integer} $index - Key chain
317
+ /// @return {String} Desired value
318
+ /// @group @carbon/layout
319
+ @function -key-by-index($map, $index) {
320
+ $keys: map.keys($map);
321
+ @return nth($keys, $index);
322
+ }
323
+
302
324
  /// Generate the CSS for a grid for the given breakpoints and gutters
303
325
  /// @param {Map} $breakpoints [$grid-breakpoints] - The default breakpoints
304
326
  /// @param {Number} $grid-gutter [$grid-gutter] - The default gutters
305
- /// @param {Number} $condensed-gutter [$grid-gutter--condensed] - The condensed mode gutter
327
+ /// @param {Number} $condensed-gutter [$grid-gutter-condensed] - The condensed mode gutter
306
328
  /// @access public
307
329
  /// @group @carbon/grid
308
330
  @mixin flex-grid(
309
331
  $breakpoints: $grid-breakpoints,
310
332
  $grid-gutter: $grid-gutter,
311
- $condensed-gutter: $grid-gutter--condensed
333
+ $condensed-gutter: $grid-gutter-condensed
312
334
  ) {
313
335
  .#{$prefix}--grid {
314
336
  @include -make-container($breakpoints);
@@ -339,36 +361,3 @@
339
361
  @include -no-gutter();
340
362
  @include -hang($grid-gutter);
341
363
  }
342
-
343
- @if $flex-grid-columns == 12 {
344
- $flex-12-column-grid: map.merge(
345
- $grid-breakpoints,
346
- (
347
- lg:
348
- map.merge(
349
- map.get($grid-breakpoints, lg),
350
- (
351
- columns: 12,
352
- )
353
- ),
354
- xlg:
355
- map.merge(
356
- map.get($grid-breakpoints, xlg),
357
- (
358
- columns: 12,
359
- )
360
- ),
361
- max:
362
- map.merge(
363
- map.get($grid-breakpoints, max),
364
- (
365
- columns: 12,
366
- )
367
- ),
368
- )
369
- );
370
-
371
- @include flex-grid($breakpoints: $flex-12-column-grid);
372
- } @else {
373
- @include flex-grid();
374
- }