@carbon/grid 10.20.0-rc.0 → 10.21.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/README.md CHANGED
@@ -70,12 +70,6 @@ The `.bx--col-sm-1` class names tells us that this `<div>` should only span one
70
70
  column at our `sm` breakpoint. By default, as we scale beyond the breakpoint the
71
71
  layout will still take up a percentage of the overall width.
72
72
 
73
- ## 📖 API Documentation
74
-
75
- If you're looking for `@carbon/grid` API documentation, check out:
76
-
77
- - [Sass](./docs/sass.md)
78
-
79
73
  ## 🙌 Contributing
80
74
 
81
75
  We're always looking for contributors to help us fix bugs, build new features,
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.20.0-rc.0",
4
+ "version": "10.21.0",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -27,15 +27,15 @@
27
27
  "access": "public"
28
28
  },
29
29
  "scripts": {
30
- "build": "yarn clean && carbon-cli sassdoc \"scss/*.scss\" && carbon-cli inline && carbon-cli check \"scss/*.scss\"",
30
+ "build": "yarn clean && carbon-cli inline && carbon-cli check \"scss/*.scss\"",
31
31
  "clean": "rimraf scss/_inlined scss/vendor"
32
32
  },
33
33
  "dependencies": {
34
- "@carbon/import-once": "^10.5.0",
35
- "@carbon/layout": "^10.18.0-rc.0"
34
+ "@carbon/import-once": "^10.6.0",
35
+ "@carbon/layout": "^10.19.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@carbon/cli": "^10.19.0-rc.0",
38
+ "@carbon/cli": "^10.20.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": "f20d953bfdd69fd024f2b202fd7e62f3139d431c"
47
+ "gitHead": "f4f5ac5a33f77b799d9e4533287db8912e40cd1b"
48
48
  }
@@ -0,0 +1,266 @@
1
+ //
2
+ // Copyright IBM Corp. 2018, 2018
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ // https://github.com/twbs/bootstrap/blob/v4-dev/scss/mixins/_breakpoints.scss
9
+ @use 'sass:list';
10
+ @use 'sass:map';
11
+ @use 'sass:meta';
12
+ @use '@carbon/layout/scss/modules/convert';
13
+
14
+ /// Map deep get
15
+ /// @author Hugo Giraudel
16
+ /// @access public
17
+ /// @param {Map} $map - Map
18
+ /// @param {Arglist} $keys - Key chain
19
+ /// @return {*} Desired value
20
+ /// @group @carbon/layout
21
+ @function map-deep-get($map, $keys...) {
22
+ @each $key in $keys {
23
+ $map: map-get($map, $key);
24
+ }
25
+ @return $map;
26
+ }
27
+
28
+ /// Provide a map and index, and get back the relevant key value
29
+ /// @access public
30
+ /// @param {Map} $map - Map
31
+ /// @param {Integer} $index - Key chain
32
+ /// @return {String} Desired value
33
+ /// @group @carbon/layout
34
+ @function key-by-index($map, $index) {
35
+ $keys: map-keys($map);
36
+ @return nth($keys, $index);
37
+ }
38
+
39
+ /// Pass in a map, and get the last one in the list back
40
+ /// @access public
41
+ /// @param {Map} $map - Map
42
+ /// @return {*} Desired value
43
+ /// @group @carbon/layout
44
+ @function last-map-item($map) {
45
+ $total-length: length($map);
46
+ @return map-get($map, key-by-index($map, $total-length));
47
+ }
48
+
49
+ /// Carbon gutter size in rem
50
+ /// @type Number
51
+ /// @access public
52
+ /// @group @carbon/layout
53
+ $grid-gutter: convert.rem(32px);
54
+
55
+ /// Carbon condensed gutter size in rem
56
+ /// @type Number
57
+ /// @access public
58
+ /// @group @carbon/layout
59
+ $grid-gutter--condensed: convert.rem(1px);
60
+
61
+ // Initial map of our breakpoints and their values
62
+ /// @type Map
63
+ /// @access public
64
+ /// @group @carbon/layout
65
+ $grid-breakpoints: (
66
+ sm: (
67
+ columns: 4,
68
+ margin: 0,
69
+ width: convert.rem(320px),
70
+ ),
71
+ md: (
72
+ columns: 8,
73
+ margin: convert.rem(16px),
74
+ width: convert.rem(672px),
75
+ ),
76
+ lg: (
77
+ columns: 16,
78
+ margin: convert.rem(16px),
79
+ width: convert.rem(1056px),
80
+ ),
81
+ xlg: (
82
+ columns: 16,
83
+ margin: convert.rem(16px),
84
+ width: convert.rem(1312px),
85
+ ),
86
+ max: (
87
+ columns: 16,
88
+ margin: convert.rem(24px),
89
+ width: convert.rem(1584px),
90
+ ),
91
+ ) !default;
92
+
93
+ /// Get the value of the next breakpoint, or null for the last breakpoint
94
+ /// @param {String} $name - The name of the brekapoint
95
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name of the breakpoint and the value is the values for the breakpoint
96
+ /// @param {List} $breakpoint-names [map-keys($breakpoints)] - A list of names from the `$breakpoints` map
97
+ /// @return {String}
98
+ /// @access public
99
+ /// @group @carbon/layout
100
+ @function breakpoint-next(
101
+ $name,
102
+ $breakpoints: $grid-breakpoints,
103
+ $breakpoint-names: map.keys($breakpoints)
104
+ ) {
105
+ $n: list.index($breakpoint-names, $name);
106
+ @if $n != null and $n < list.length($breakpoint-names) {
107
+ @return list.nth($breakpoint-names, $n + 1);
108
+ }
109
+ @return null;
110
+ }
111
+
112
+ /// Get the value of the previous breakpoint, or null for the first breakpoint
113
+ /// @param {String} $name - The name of the brekapoint
114
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name of the breakpoint and the value is the values for the breakpoint
115
+ /// @param {List} $breakpoint-names [map-keys($breakpoints)] - A list of names from the `$breakpoints` map
116
+ /// @return {String}
117
+ /// @access public
118
+ /// @group @carbon/layout
119
+ @function breakpoint-prev(
120
+ $name,
121
+ $breakpoints: $grid-breakpoints,
122
+ $breakpoint-names: map.keys($breakpoints)
123
+ ) {
124
+ $n: list.index($breakpoint-names, $name);
125
+ @if $n != null and $n > 1 {
126
+ @return list.nth($breakpoint-names, $n - 1);
127
+ }
128
+ @return null;
129
+ }
130
+
131
+ /// Check to see if the given breakpoint name
132
+ /// @param {String} $name - The name of the brekapoint
133
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name of the breakpoint and the value is the values for the breakpoint
134
+ /// @return {Bool}
135
+ /// @access public
136
+ /// @group @carbon/layout
137
+ @function is-smallest-breakpoint($name, $breakpoints: $grid-breakpoints) {
138
+ @return list.index(map.keys($breakpoints), $name) == 1;
139
+ }
140
+
141
+ /// Returns the largest breakpoint name
142
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
143
+ /// @return {String}
144
+ /// @access public
145
+ /// @group @carbon/layout
146
+ @function largest-breakpoint-name($breakpoints: $grid-breakpoints) {
147
+ $total-breakpoints: list.length($breakpoints);
148
+ @return key-by-index($breakpoints, $total-breakpoints);
149
+ }
150
+
151
+ /// Get the infix for a given breakpoint in a list of breakpoints. Usesful for generate the size part in a selector, for example: `.prefix--col-sm-2`.
152
+ /// @param {String} $name - The name of the breakpoint
153
+ /// @return {String}
154
+ /// @access public
155
+ /// @group @carbon/layout
156
+ @function breakpoint-infix($name) {
157
+ @return '-#{$name}';
158
+ }
159
+
160
+ /// Generate a media query from the width of the given breakpoint to infinity
161
+ /// @param {String | Number} $name
162
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
163
+ /// @content
164
+ /// @access public
165
+ /// @group @carbon/layout
166
+ @mixin breakpoint-up($name, $breakpoints: $grid-breakpoints) {
167
+ @if meta.type-of($name) == 'number' {
168
+ @media (min-width: $name) {
169
+ @content;
170
+ }
171
+ } @else if map.has-key($breakpoints, $name) {
172
+ $breakpoint: map.get($breakpoints, $name);
173
+ $width: map.get($breakpoint, width);
174
+ @if is-smallest-breakpoint($name, $breakpoints) {
175
+ @content;
176
+ } @else {
177
+ @media (min-width: $width) {
178
+ @content;
179
+ }
180
+ }
181
+ } @else {
182
+ @error 'Unable to find a breakpoint with name `#{$name}`. Expected one of: (#{map.keys($breakpoints)})';
183
+ }
184
+ }
185
+
186
+ /// Generate a media query for the maximum width of the given styles
187
+ /// @param {String | Number} $name
188
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
189
+ /// @content
190
+ /// @access public
191
+ /// @group @carbon/layout
192
+ @mixin breakpoint-down($name, $breakpoints: $grid-breakpoints) {
193
+ @if meta.type-of($name) == 'number' {
194
+ @media (max-width: $name) {
195
+ @content;
196
+ }
197
+ } @else if map.has-key($breakpoints, $name) {
198
+ // We borrow this logic from bootstrap for specifying the value of the
199
+ // max-width. The maximum width is calculated by finding the breakpoint and
200
+ // subtracting .02 from its value. This value is used instead of .01 to
201
+ // avoid rounding issues in Safari
202
+ // https://github.com/twbs/bootstrap/blob/c5b1919deaf5393fcca9e9b9d7ce9c338160d99d/scss/mixins/_breakpoints.scss#L34-L46
203
+ $breakpoint: map.get($breakpoints, $name);
204
+ $width: map.get($breakpoint, width) - 0.02;
205
+ @media (max-width: $width) {
206
+ @content;
207
+ }
208
+ } @else {
209
+ @error 'Unable to find a breakpoint with name `#{$name}`. Expected one of: (#{map.keys($breakpoints)})';
210
+ }
211
+ }
212
+
213
+ /// Generate a media query for the range between the lower and upper breakpoints
214
+ /// @param {String | Number} $lower
215
+ /// @param {String | Number} $upper
216
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
217
+ /// @content
218
+ /// @access public
219
+ /// @group @carbon/layout
220
+ @mixin breakpoint-between($lower, $upper, $breakpoints: $grid-breakpoints) {
221
+ $is-number-lower: meta.type-of($lower) == 'number';
222
+ $is-number-upper: meta.type-of($upper) == 'number';
223
+ $min: if($is-number-lower, $lower, map.get($breakpoints, $lower));
224
+ $max: if($is-number-upper, $upper, map.get($breakpoints, $upper));
225
+
226
+ @if $min and $max {
227
+ $min-width: if(not $is-number-lower and $min, map.get($min, width), $min);
228
+ $max-width: if(not $is-number-upper and $max, map.get($max, width), $max);
229
+ @media (min-width: $min-width) and (max-width: $max-width) {
230
+ @content;
231
+ }
232
+ } @else if $min != null and $max == null {
233
+ @include breakpoint-up($lower) {
234
+ @content;
235
+ }
236
+ } @else if $min == null and $max != null {
237
+ @include breakpoint-down($upper) {
238
+ @content;
239
+ }
240
+ } @else {
241
+ @error 'Unable to find a breakpoint to satisfy: (#{$lower},#{$upper}). Expected both to be one of (#{map.keys($breakpoints)}).';
242
+ }
243
+ }
244
+
245
+ /// Generate media query for the largest breakpoint
246
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
247
+ /// @content
248
+ /// @access public
249
+ /// @group @carbon/layout
250
+ @mixin largest-breakpoint($breakpoints: $grid-breakpoints) {
251
+ @include breakpoint(largest-breakpoint-name()) {
252
+ @content;
253
+ }
254
+ }
255
+
256
+ /// Generate a media query for a given breakpoint
257
+ /// @param {String | Number} $name
258
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
259
+ /// @content
260
+ /// @access public
261
+ /// @group @carbon/layout
262
+ @mixin breakpoint($name, $breakpoints: $grid-breakpoints) {
263
+ @include breakpoint-up($name, $breakpoints) {
264
+ @content;
265
+ }
266
+ }
@@ -0,0 +1,12 @@
1
+ //
2
+ // Copyright IBM Corp. 2018, 2018
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ /// Namespace prefix
9
+ /// @type String
10
+ /// @access public
11
+ /// @group @carbon/grid
12
+ $prefix: 'bx' !default;
@@ -0,0 +1,323 @@
1
+ //
2
+ // Copyright IBM Corp. 2018, 2018
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ @use 'config' as *;
9
+ @use 'breakpoint' as *;
10
+
11
+ // -----------------------------------------------------------------------------
12
+ // Columns
13
+ // -----------------------------------------------------------------------------
14
+
15
+ /// Used to initialize the default properties for a column class, most notably
16
+ /// for setting width and default gutters when a column's breakpoint has not been
17
+ /// hit yet.
18
+ /// @param {Number} $gutter [$grid-gutter] - The gutter for the grid system
19
+ /// @param {Number} $collapsed-gutter [$grid-gutter--condensed] - The condensed mode gutter
20
+ /// @access private
21
+ /// @group @carbon/grid
22
+ @mixin -make-col-ready(
23
+ $gutter: $grid-gutter,
24
+ $condensed-gutter: $grid-gutter--condensed
25
+ ) {
26
+ // Prevent columns from becoming too narrow when at smaller grid tiers by
27
+ // always setting `width: 100%;`. This works because we use `flex` values
28
+ // later on to override this initial width.
29
+ width: 100%;
30
+ padding-right: ($gutter / 2);
31
+ padding-left: ($gutter / 2);
32
+
33
+ // For our condensed use-case, our gutters collapse to 2px solid, 1px on each
34
+ // side.
35
+ .#{$prefix}--row--condensed &,
36
+ .#{$prefix}--grid--condensed & {
37
+ padding-right: ($condensed-gutter / 2);
38
+ padding-left: ($condensed-gutter / 2);
39
+ }
40
+
41
+ // For our narrow use-case, our container hangs 16px into the gutter
42
+ .#{$prefix}--row--narrow &,
43
+ .#{$prefix}--grid--narrow & {
44
+ padding-right: ($gutter / 2);
45
+ padding-left: 0;
46
+ }
47
+ }
48
+
49
+ /// Define the width of the column for a given span and column count.
50
+ /// A width of 0 will hide the column entirely.
51
+ /// @param {Number} $span - The number of columns covered
52
+ /// @param {Number} $columns - The total number of columns available
53
+ /// @access private
54
+ /// @group @carbon/grid
55
+ @mixin -make-col($span, $columns) {
56
+ @if $span == 0 {
57
+ display: none;
58
+ } @else {
59
+ // Explicitly include `display: block` to override
60
+ display: block;
61
+ flex: 0 0 percentage($span / $columns);
62
+ // Add a `max-width` to ensure content within each column does not blow out
63
+ // the width of the column. Applies to IE10+ and Firefox. Chrome and Safari
64
+ // do not appear to require this.
65
+ max-width: percentage($span / $columns);
66
+ }
67
+ }
68
+
69
+ /// Create a column offset for a given span and column count.
70
+ /// @param {Number} $span - The number of columns the offset should cover
71
+ /// @param {Number} $columns - The total number of columns available
72
+ /// @access private
73
+ /// @group @carbon/grid
74
+ @mixin -make-col-offset($span, $columns) {
75
+ $offset: $span / $columns;
76
+ @if $offset == 0 {
77
+ margin-left: 0;
78
+ } @else {
79
+ margin-left: percentage($offset);
80
+ }
81
+ }
82
+
83
+ /// Output the CSS required for all the columns in a given grid system.
84
+ /// @param {Map} $breakpoints [$grid-breakpoints] - The breakpoints in the grid system
85
+ /// @param {Number} $gutter [$grid-gutter] - The gutter for the grid system
86
+ /// @access private
87
+ /// @group @carbon/grid
88
+ @mixin -make-grid-columns(
89
+ $breakpoints: $grid-breakpoints,
90
+ $gutter: $grid-gutter
91
+ ) {
92
+ .#{$prefix}--col {
93
+ @include -make-col-ready($gutter);
94
+ }
95
+
96
+ @each $breakpoint in map-keys($breakpoints) {
97
+ $infix: breakpoint-infix($breakpoint);
98
+ $columns: map-get(map-get($breakpoints, $breakpoint), columns);
99
+
100
+ // Allow columns to stretch full width below their breakpoints
101
+ @for $i from 0 through $columns {
102
+ .#{$prefix}--col#{$infix}-#{$i} {
103
+ @include -make-col-ready($gutter);
104
+ }
105
+ }
106
+
107
+ .#{$prefix}--col#{$infix},
108
+ .#{$prefix}--col#{$infix}--auto {
109
+ @include -make-col-ready($gutter);
110
+ }
111
+
112
+ @include breakpoint($breakpoint, $breakpoints) {
113
+ // Provide basic `.col-{bp}` classes for equal-width flexbox columns
114
+ .#{$prefix}--col,
115
+ .#{$prefix}--col#{$infix} {
116
+ flex-basis: 0;
117
+ flex-grow: 1;
118
+ max-width: 100%;
119
+ }
120
+
121
+ .#{$prefix}--col--auto,
122
+ .#{$prefix}--col#{$infix}--auto {
123
+ flex: 1 0 0%;
124
+ width: auto;
125
+ // Reset earlier grid tiers
126
+ max-width: 100%;
127
+ }
128
+
129
+ @for $i from 0 through $columns {
130
+ .#{$prefix}--col#{$infix}-#{$i} {
131
+ @include -make-col($i, $columns);
132
+ }
133
+ }
134
+
135
+ @for $i from 0 through ($columns - 1) {
136
+ @if not($infix == '') {
137
+ .#{$prefix}--offset#{$infix}-#{$i} {
138
+ @include -make-col-offset($i, $columns);
139
+ }
140
+ }
141
+ }
142
+ }
143
+ }
144
+ }
145
+
146
+ // -----------------------------------------------------------------------------
147
+ // Rows
148
+ // -----------------------------------------------------------------------------
149
+
150
+ /// Define the properties for a selector assigned to a row in the grid system.
151
+ /// @param {Number} $gutter [$grid-gutter] - The gutter in the grid system
152
+ /// @access private
153
+ /// @group @carbon/grid
154
+ @mixin make-row($gutter: $grid-gutter) {
155
+ display: flex;
156
+ flex-wrap: wrap;
157
+ margin-right: -1 * $gutter / 2;
158
+ margin-left: -1 * $gutter / 2;
159
+ }
160
+
161
+ // -----------------------------------------------------------------------------
162
+ // No gutter
163
+ // -----------------------------------------------------------------------------
164
+
165
+ /// Add `no-gutter` and `no-gutter--{start,end}` classes to the output CSS. These
166
+ /// classes are useful for dropping the gutter in fluid situations.
167
+ /// @access private
168
+ /// @group @carbon/grid
169
+ @mixin -no-gutter {
170
+ .#{$prefix}--no-gutter,
171
+ .#{$prefix}--row.#{$prefix}--no-gutter [class*='#{$prefix}--col'] {
172
+ padding-right: 0;
173
+ padding-left: 0;
174
+ }
175
+
176
+ .#{$prefix}--no-gutter--start,
177
+ .#{$prefix}--row.#{$prefix}--no-gutter--start [class*='#{$prefix}--col'] {
178
+ padding-left: 0;
179
+ }
180
+
181
+ .#{$prefix}--no-gutter--end,
182
+ .#{$prefix}--row.#{$prefix}--no-gutter--end [class*='#{$prefix}--col'] {
183
+ padding-right: 0;
184
+ }
185
+
186
+ // Deprecated ☠️
187
+ .#{$prefix}--no-gutter--left,
188
+ .#{$prefix}--row.#{$prefix}--no-gutter--left [class*='#{$prefix}--col'] {
189
+ padding-left: 0;
190
+ }
191
+
192
+ .#{$prefix}--no-gutter--right,
193
+ .#{$prefix}--row.#{$prefix}--no-gutter--right [class*='#{$prefix}--col'] {
194
+ padding-right: 0;
195
+ }
196
+ }
197
+
198
+ // -----------------------------------------------------------------------------
199
+ // Hang
200
+ // -----------------------------------------------------------------------------
201
+
202
+ /// Add `hang--start` and `hang--end` classes for a given gutter. These classes are
203
+ /// used alongside `no-gutter--start` and `no-gutter--end` to "hang" type.
204
+ /// @param {Number} $gutter [$grid-gutter] - The gutter in the grid system
205
+ /// @access private
206
+ /// @group @carbon/grid
207
+ @mixin -hang($gutter: $grid-gutter) {
208
+ .#{$prefix}--hang--start {
209
+ padding-left: ($gutter / 2);
210
+ }
211
+
212
+ .#{$prefix}--hang--end {
213
+ padding-right: ($gutter / 2);
214
+ }
215
+
216
+ // Deprecated ☠️
217
+ .#{$prefix}--hang--left {
218
+ padding-left: ($gutter / 2);
219
+ }
220
+
221
+ .#{$prefix}--hang--right {
222
+ padding-right: ($gutter / 2);
223
+ }
224
+ }
225
+
226
+ // -----------------------------------------------------------------------------
227
+ // Grid
228
+ // -----------------------------------------------------------------------------
229
+
230
+ /// Create the container for a grid. Will cause full-bleed for the grid unless
231
+ /// max-width properties are added with `-make-container-max-widths`
232
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
233
+ /// @access private
234
+ /// @group @carbon/grid
235
+ @mixin -make-container($breakpoints: $grid-breakpoints) {
236
+ margin-right: auto;
237
+ margin-left: auto;
238
+
239
+ @include -set-largest-breakpoint();
240
+
241
+ @each $name, $value in $breakpoints {
242
+ $prev-breakpoint: map-get($breakpoints, breakpoint-prev($name));
243
+ $margin: map-get($value, margin);
244
+
245
+ @if $prev-breakpoint {
246
+ $prev-margin: map-get($prev-breakpoint, margin);
247
+ @if $prev-margin != $margin {
248
+ @include breakpoint($name) {
249
+ padding-right: #{($grid-gutter / 2) + $margin};
250
+ padding-left: #{($grid-gutter / 2) + $margin};
251
+ }
252
+ }
253
+ } @else {
254
+ @include breakpoint($name) {
255
+ padding-right: #{($grid-gutter / 2) + $margin};
256
+ padding-left: #{($grid-gutter / 2) + $margin};
257
+ }
258
+ }
259
+ }
260
+ }
261
+
262
+ /// Get the last breakpoint width and set max-width to its value
263
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
264
+ /// @access private
265
+ /// @group @carbon/grid
266
+ @mixin -set-largest-breakpoint($breakpoints: $grid-breakpoints) {
267
+ $largest-breakpoint: last-map-item($breakpoints);
268
+
269
+ max-width: map-get($largest-breakpoint, 'width');
270
+ }
271
+
272
+ /// Add in the max-widths for each breakpoint to the container
273
+ /// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
274
+ /// @access private
275
+ /// @group @carbon/grid
276
+ @mixin -make-container-max-widths($breakpoints: $grid-breakpoints) {
277
+ @each $name, $value in $breakpoints {
278
+ @include breakpoint($name) {
279
+ max-width: map-get($value, width);
280
+ }
281
+ }
282
+ }
283
+
284
+ /// Generate the CSS for a grid for the given breakpoints and gutters
285
+ /// @param {Map} $breakpoints [$grid-breakpoints] - The default breakpoints
286
+ /// @param {Number} $grid-gutter [$grid-gutter] - The default gutters
287
+ /// @param {Number} $condensed-gutter [$grid-gutter--condensed] - The condensed mode gutter
288
+ /// @access public
289
+ /// @group @carbon/grid
290
+ @mixin grid(
291
+ $breakpoints: $grid-breakpoints,
292
+ $grid-gutter: $grid-gutter,
293
+ $condensed-gutter: $grid-gutter--condensed
294
+ ) {
295
+ .#{$prefix}--grid {
296
+ @include -make-container($breakpoints);
297
+ }
298
+
299
+ @include largest-breakpoint($breakpoints) {
300
+ .#{$prefix}--grid--full-width {
301
+ max-width: 100%;
302
+ }
303
+ }
304
+
305
+ .#{$prefix}--row {
306
+ @include make-row();
307
+ }
308
+
309
+ .#{$prefix}--row-padding [class*='#{$prefix}--col'],
310
+ .#{$prefix}--col-padding {
311
+ padding-top: $grid-gutter / 2;
312
+ padding-bottom: $grid-gutter / 2;
313
+ }
314
+
315
+ .#{$prefix}--grid--condensed [class*='#{$prefix}--col'] {
316
+ padding-top: $condensed-gutter / 2;
317
+ padding-bottom: $condensed-gutter / 2;
318
+ }
319
+
320
+ @include -make-grid-columns($breakpoints, $grid-gutter);
321
+ @include -no-gutter();
322
+ @include -hang($grid-gutter);
323
+ }
@@ -26,12 +26,12 @@ $fluid-spacing-03: 5vw !default;
26
26
  /// @group @carbon/layout
27
27
  $fluid-spacing-04: 10vw !default;
28
28
 
29
- /// @type List
29
+ /// @type Map
30
30
  /// @access public
31
31
  /// @group @carbon/layout
32
32
  $fluid-spacing: (
33
- $fluid-spacing-01,
34
- $fluid-spacing-02,
35
- $fluid-spacing-03,
36
- $fluid-spacing-04
33
+ fluid-spacing-01: $fluid-spacing-01,
34
+ fluid-spacing-02: $fluid-spacing-02,
35
+ fluid-spacing-03: $fluid-spacing-03,
36
+ fluid-spacing-04: $fluid-spacing-04,
37
37
  );
@@ -66,20 +66,20 @@ $spacing-11: 5rem !default;
66
66
  /// @group @carbon/layout
67
67
  $spacing-12: 6rem !default;
68
68
 
69
- /// @type List
69
+ /// @type Map
70
70
  /// @access public
71
71
  /// @group @carbon/layout
72
72
  $spacing: (
73
- $spacing-01,
74
- $spacing-02,
75
- $spacing-03,
76
- $spacing-04,
77
- $spacing-05,
78
- $spacing-06,
79
- $spacing-07,
80
- $spacing-08,
81
- $spacing-09,
82
- $spacing-10,
83
- $spacing-11,
84
- $spacing-12
73
+ spacing-01: $spacing-01,
74
+ spacing-02: $spacing-02,
75
+ spacing-03: $spacing-03,
76
+ spacing-04: $spacing-04,
77
+ spacing-05: $spacing-05,
78
+ spacing-06: $spacing-06,
79
+ spacing-07: $spacing-07,
80
+ spacing-08: $spacing-08,
81
+ spacing-09: $spacing-09,
82
+ spacing-10: $spacing-10,
83
+ spacing-11: $spacing-11,
84
+ spacing-12: $spacing-12,
85
85
  );