@carbon/grid 10.0.0-rc.0 → 10.2.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.
@@ -0,0 +1,335 @@
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
+ // Helpers for defining columns, rows, and containers are heavily inspired by,
9
+ // and often derived from, bootstrap:
10
+ // https://github.com/twbs/bootstrap/blob/v4-dev/scss/mixins/_grid.scss
11
+
12
+ @import '../vendor/@carbon/layout/breakpoint';
13
+ @import 'prefix';
14
+
15
+ // -----------------------------------------------------------------------------
16
+ // Columns
17
+ // -----------------------------------------------------------------------------
18
+
19
+ /// Used to initialize the default properties for a column class, most notably
20
+ /// for setting width and default gutters when a column's breakpoint has not been
21
+ /// hit yet.
22
+ /// @param {Number} $gutter [$carbon--grid-gutter] - The gutter for the grid system
23
+ /// @param {Number} $collapsed-gutter [$carbon--grid-gutter--condensed] - The condensed mode gutter
24
+ /// @access private
25
+ /// @group @carbon/grid
26
+ @mixin carbon--make-col-ready(
27
+ $gutter: $carbon--grid-gutter,
28
+ $condensed-gutter: $carbon--grid-gutter--condensed
29
+ ) {
30
+ // Prevent columns from becoming too narrow when at smaller grid tiers by
31
+ // always setting `width: 100%;`. This works because we use `flex` values
32
+ // later on to override this initial width.
33
+ width: 100%;
34
+ padding-right: ($gutter / 2);
35
+ padding-left: ($gutter / 2);
36
+
37
+ // For our condensed use-case, our gutters collapse to 2px solid, 1px on each
38
+ // side.
39
+ .#{$prefix}--row--condensed &,
40
+ .#{$prefix}--grid--condensed & {
41
+ padding-right: ($condensed-gutter / 2);
42
+ padding-left: ($condensed-gutter / 2);
43
+ }
44
+ }
45
+
46
+ /// Define the width of the column for a given span and column count.
47
+ /// @param {Number} $span - The number of columns covered
48
+ /// @param {Number} $columns - The total number of columns available
49
+ /// @access private
50
+ /// @group @carbon/grid
51
+ @mixin carbon--make-col($span, $columns) {
52
+ flex: 0 0 percentage($span / $columns);
53
+ // Add a `max-width` to ensure content within each column does not blow out
54
+ // the width of the column. Applies to IE10+ and Firefox. Chrome and Safari
55
+ // do not appear to require this.
56
+ max-width: percentage($span / $columns);
57
+ }
58
+
59
+ /// Create a column offset for a given span and column count.
60
+ /// @param {Number} $span - The number of columns the offset should cover
61
+ /// @param {Number} $columns - The total number of columns available
62
+ /// @access private
63
+ /// @group @carbon/grid
64
+ @mixin carbon--make-col-offset($span, $columns) {
65
+ $offset: $span / $columns;
66
+ @if $offset == 0 {
67
+ margin-left: 0;
68
+ } @else {
69
+ margin-left: percentage($offset);
70
+ }
71
+ }
72
+
73
+ /// Output the CSS required for all the columns in a given grid system.
74
+ /// @param {Map} $breakpoints [$carbon--grid-breakpoints] - The breakpoints in the grid system
75
+ /// @param {Number} $gutter [$carbon--grid-gutter] - The gutter for the grid system
76
+ /// @access private
77
+ /// @group @carbon/grid
78
+ @mixin carbon--make-grid-columns(
79
+ $breakpoints: $carbon--grid-breakpoints,
80
+ $gutter: $carbon--grid-gutter
81
+ ) {
82
+ .#{$prefix}--col {
83
+ @include carbon--make-col-ready();
84
+ }
85
+
86
+ @each $breakpoint in map-keys($breakpoints) {
87
+ $infix: carbon--breakpoint-infix($breakpoint);
88
+ $columns: map-get(map-get($breakpoints, $breakpoint), columns);
89
+
90
+ // Allow columns to stretch full width below their breakpoints
91
+ @for $i from 1 through $columns {
92
+ .#{$prefix}--col#{$infix}-#{$i} {
93
+ @include carbon--make-col-ready();
94
+ }
95
+ }
96
+
97
+ .#{$prefix}--col#{$infix},
98
+ .#{$prefix}--col#{$infix}--auto {
99
+ @include carbon--make-col-ready();
100
+ }
101
+
102
+ @include carbon--breakpoint($breakpoint, $breakpoints) {
103
+ // Provide basic `.col-{bp}` classes for equal-width flexbox columns
104
+ .#{$prefix}--col,
105
+ .#{$prefix}--col#{$infix} {
106
+ flex-basis: 0;
107
+ flex-grow: 1;
108
+ max-width: 100%;
109
+ }
110
+
111
+ .#{$prefix}--col--auto,
112
+ .#{$prefix}--col#{$infix}--auto {
113
+ flex: 1 0 0%;
114
+ width: auto;
115
+ // Reset earlier grid tiers
116
+ max-width: 100%;
117
+ }
118
+
119
+ @for $i from 1 through $columns {
120
+ .#{$prefix}--col#{$infix}-#{$i} {
121
+ @include carbon--make-col($i, $columns);
122
+ }
123
+ }
124
+
125
+ @for $i from 0 through ($columns - 1) {
126
+ @if not($infix == '') {
127
+ .#{$prefix}--offset#{$infix}-#{$i} {
128
+ @include carbon--make-col-offset($i, $columns);
129
+ }
130
+ }
131
+ }
132
+ }
133
+ }
134
+ }
135
+
136
+ // -----------------------------------------------------------------------------
137
+ // Rows
138
+ // -----------------------------------------------------------------------------
139
+
140
+ /// Define the properties for a selector assigned to a row in the grid system.
141
+ /// @param {Number} $gutter [$carbon--grid-gutter] - The gutter in the grid system
142
+ /// @access private
143
+ /// @group @carbon/grid
144
+ @mixin carbon--make-row($gutter: $carbon--grid-gutter) {
145
+ display: flex;
146
+ flex-wrap: wrap;
147
+ margin-right: -1 * $gutter / 2;
148
+ margin-left: -1 * $gutter / 2;
149
+ }
150
+
151
+ // -----------------------------------------------------------------------------
152
+ // No gutter
153
+ // -----------------------------------------------------------------------------
154
+
155
+ /// Add `no-gutter` and `no-gutter--{left,right}` classes to the output CSS. These
156
+ /// classes are useful for dropping the gutter in fluid situations.
157
+ /// @access private
158
+ /// @group @carbon/grid
159
+ @mixin carbon--no-gutter {
160
+ .#{$prefix}--no-gutter,
161
+ .#{$prefix}--row.#{$prefix}--no-gutter [class*='#{$prefix}--col'] {
162
+ padding-left: 0;
163
+ padding-right: 0;
164
+ }
165
+
166
+ .#{$prefix}--no-gutter--left,
167
+ .#{$prefix}--row.#{$prefix}--no-gutter--left [class*='#{$prefix}--col'] {
168
+ padding-left: 0;
169
+ }
170
+
171
+ .#{$prefix}--no-gutter--right,
172
+ .#{$prefix}--row.#{$prefix}--no-gutter--right [class*='#{$prefix}--col'] {
173
+ padding-right: 0;
174
+ }
175
+ }
176
+
177
+ // -----------------------------------------------------------------------------
178
+ // Hang
179
+ // -----------------------------------------------------------------------------
180
+
181
+ /// Add `hang--left` and `hang--right` classes for a given gutter. These classes are
182
+ /// used alongside `no-gutter--left` and `no-gutter--right` to "hang" type.
183
+ /// @param {Number} $gutter [$carbon--grid-gutter] - The gutter in the grid system
184
+ /// @access private
185
+ /// @group @carbon/grid
186
+ @mixin carbon--hang($gutter: $carbon--grid-gutter) {
187
+ .#{$prefix}--hang--left {
188
+ padding-left: ($gutter / 2);
189
+ }
190
+
191
+ .#{$prefix}--hang--right {
192
+ padding-right: ($gutter / 2);
193
+ }
194
+ }
195
+
196
+ // -----------------------------------------------------------------------------
197
+ // Aspect ratio
198
+ // -----------------------------------------------------------------------------
199
+
200
+ /// The aspect ratios that are used to generate corresponding aspect ratio
201
+ /// classes in code
202
+ /// @type List
203
+ /// @access public
204
+ /// @group @carbon/grid
205
+ $carbon--aspect-ratios: ((16, 9), (2, 1), (4, 3), (1, 1));
206
+
207
+ /// Output the CSS classes for generating aspect ratio classes
208
+ /// @param {List} $aspect-ratios [$carbon--aspect-ratios] - A list of aspect ratios to generate
209
+ /// @access private
210
+ /// @group @carbon/grid
211
+ @mixin carbon--aspect-ratio($aspect-ratios: $carbon--aspect-ratios) {
212
+ .#{$prefix}--aspect-ratio {
213
+ height: 0;
214
+ position: relative;
215
+ }
216
+
217
+ .#{$prefix}--aspect-ratio--object {
218
+ position: absolute;
219
+ top: 0;
220
+ right: 0;
221
+ bottom: 0;
222
+ left: 0;
223
+ width: 100%;
224
+ height: 100%;
225
+ z-index: 100;
226
+ }
227
+
228
+ @each $ratio in $aspect-ratios {
229
+ $width: nth($ratio, 1);
230
+ $height: nth($ratio, 2);
231
+
232
+ .#{$prefix}--aspect-ratio--#{$width}x#{$height} {
233
+ padding-bottom: percentage($height / $width);
234
+ }
235
+ }
236
+ }
237
+
238
+ // -----------------------------------------------------------------------------
239
+ // Grid
240
+ // -----------------------------------------------------------------------------
241
+
242
+ /// Create the container for a grid. Will cause full-bleed for the grid unless
243
+ /// max-width properties are added with `make-container-max-widths`
244
+ /// @param {Map} $breakpoints [$carbon--grid-breakpoints] - A map of breakpoints where the key is the name
245
+ /// @access private
246
+ /// @group @carbon/grid
247
+ @mixin carbon--make-container($breakpoints: $carbon--grid-breakpoints) {
248
+ margin-right: auto;
249
+ margin-left: auto;
250
+
251
+ @include carbon--set-largest-breakpoint();
252
+
253
+ @each $name, $value in $breakpoints {
254
+ $prev-breakpoint: map-get($breakpoints, carbon--breakpoint-prev($name));
255
+ $margin: map-get($value, margin);
256
+
257
+ @if $prev-breakpoint {
258
+ $prev-margin: map-get($prev-breakpoint, margin);
259
+ @if $prev-margin != $margin {
260
+ @include carbon--breakpoint($name) {
261
+ padding-left: #{($carbon--grid-gutter / 2) + $margin};
262
+ padding-right: #{($carbon--grid-gutter / 2) + $margin};
263
+ }
264
+ }
265
+ } @else {
266
+ @include carbon--breakpoint($name) {
267
+ padding-left: #{($carbon--grid-gutter / 2) + $margin};
268
+ padding-right: #{($carbon--grid-gutter / 2) + $margin};
269
+ }
270
+ }
271
+ }
272
+ }
273
+
274
+ /// Get the last breakpoint width and set max-width to its value
275
+ /// @param {Map} $breakpoints [$carbon--grid-breakpoints] - A map of breakpoints where the key is the name
276
+ /// @access private
277
+ /// @group @carbon/grid
278
+ @mixin carbon--set-largest-breakpoint($breakpoints: $carbon--grid-breakpoints) {
279
+ $largest-breakpoint: last-map-item($breakpoints);
280
+
281
+ max-width: map-get($largest-breakpoint, 'width');
282
+ }
283
+
284
+ /// Add in the max-widths for each breakpoint to the container
285
+ /// @param {Map} $breakpoints [$carbon--grid-breakpoints] - A map of breakpoints where the key is the name
286
+ /// @access private
287
+ /// @group @carbon/grid
288
+ @mixin carbon--make-container-max-widths(
289
+ $breakpoints: $carbon--grid-breakpoints
290
+ ) {
291
+ @each $name, $value in $breakpoints {
292
+ @include carbon--breakpoint($name) {
293
+ max-width: map-get($value, width);
294
+ }
295
+ }
296
+ }
297
+
298
+ /// Generate the CSS for a grid for the given breakpoints and gutters
299
+ /// @param {Map} $breakpoints [$carbon--grid-breakpoints] - The default breakpoints
300
+ /// @param {Number} $grid-gutter [$carbon--grid-gutter] - The default gutters
301
+ /// @param {Number} $condensed-gutter [$carbon--grid-gutter--condensed] - The condensed mode gutter
302
+ /// @access public
303
+ /// @group @carbon/grid
304
+ @mixin carbon--grid(
305
+ $breakpoints: $carbon--grid-breakpoints,
306
+ $grid-gutter: $carbon--grid-gutter,
307
+ $condensed-gutter: $carbon--grid-gutter--condensed
308
+ ) {
309
+ .#{$prefix}--grid {
310
+ @include carbon--make-container($breakpoints);
311
+ }
312
+
313
+ @include carbon--largest-breakpoint($breakpoints) {
314
+ .#{$prefix}--grid--full-width {
315
+ max-width: 100%;
316
+ }
317
+ }
318
+
319
+ .#{$prefix}--row {
320
+ @include carbon--make-row();
321
+ }
322
+
323
+ .#{$prefix}--grid--condensed .#{$prefix}--row:not(:last-of-type) {
324
+ margin-bottom: $condensed-gutter;
325
+ }
326
+
327
+ .#{$prefix}--row--condensed + .#{$prefix}--row--condensed {
328
+ margin-top: $condensed-gutter;
329
+ }
330
+
331
+ @include carbon--make-grid-columns($breakpoints, $grid-gutter);
332
+ @include carbon--no-gutter();
333
+ @include carbon--hang($grid-gutter);
334
+ @include carbon--aspect-ratio();
335
+ }
@@ -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;
package/scss/_mixins.scss CHANGED
@@ -5,23 +5,24 @@
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  //
7
7
 
8
- /// Helpers for defining columns, rows, and containers are heavily inspired by,
9
- /// and often derived from, bootstrap:
10
- /// https://github.com/twbs/bootstrap/blob/v4-dev/scss/mixins/_grid.scss
8
+ // Helpers for defining columns, rows, and containers are heavily inspired by,
9
+ // and often derived from, bootstrap:
10
+ // https://github.com/twbs/bootstrap/blob/v4-dev/scss/mixins/_grid.scss
11
11
 
12
12
  @import '@carbon/layout/scss/breakpoint';
13
13
  @import 'prefix';
14
14
 
15
- /// -----------------------------------------------------------------------------
16
- /// Columns
17
- /// -----------------------------------------------------------------------------
15
+ // -----------------------------------------------------------------------------
16
+ // Columns
17
+ // -----------------------------------------------------------------------------
18
18
 
19
- /// Used to intialize the default properties for a column class, most notably
19
+ /// Used to initialize the default properties for a column class, most notably
20
20
  /// for setting width and default gutters when a column's breakpoint has not been
21
21
  /// hit yet.
22
- /// @param {Number} $gutter - the default gutter used in the grid system
23
- /// @param {Number} $collapsed-gutter - the condensed mode gutter
22
+ /// @param {Number} $gutter [$carbon--grid-gutter] - The gutter for the grid system
23
+ /// @param {Number} $collapsed-gutter [$carbon--grid-gutter--condensed] - The condensed mode gutter
24
24
  /// @access private
25
+ /// @group @carbon/grid
25
26
  @mixin carbon--make-col-ready(
26
27
  $gutter: $carbon--grid-gutter,
27
28
  $condensed-gutter: $carbon--grid-gutter--condensed
@@ -43,9 +44,10 @@
43
44
  }
44
45
 
45
46
  /// Define the width of the column for a given span and column count.
46
- /// @param {Number} $span - the number of columns covered
47
- /// @param {Number} $columns - the total number of columns available
47
+ /// @param {Number} $span - The number of columns covered
48
+ /// @param {Number} $columns - The total number of columns available
48
49
  /// @access private
50
+ /// @group @carbon/grid
49
51
  @mixin carbon--make-col($span, $columns) {
50
52
  flex: 0 0 percentage($span / $columns);
51
53
  // Add a `max-width` to ensure content within each column does not blow out
@@ -55,9 +57,10 @@
55
57
  }
56
58
 
57
59
  /// Create a column offset for a given span and column count.
58
- /// @param {Number} $span - the number of columns the offset should cover
59
- /// @param {Number} $columns - the total number of columns available
60
+ /// @param {Number} $span - The number of columns the offset should cover
61
+ /// @param {Number} $columns - The total number of columns available
60
62
  /// @access private
63
+ /// @group @carbon/grid
61
64
  @mixin carbon--make-col-offset($span, $columns) {
62
65
  $offset: $span / $columns;
63
66
  @if $offset == 0 {
@@ -68,9 +71,10 @@
68
71
  }
69
72
 
70
73
  /// Output the CSS required for all the columns in a given grid system.
71
- /// @param {Map} $breakpoints - the breakpoints in the grid system
72
- /// @param {Number} $gutter - the gutter for the grid system
74
+ /// @param {Map} $breakpoints [$carbon--grid-breakpoints] - The breakpoints in the grid system
75
+ /// @param {Number} $gutter [$carbon--grid-gutter] - The gutter for the grid system
73
76
  /// @access private
77
+ /// @group @carbon/grid
74
78
  @mixin carbon--make-grid-columns(
75
79
  $breakpoints: $carbon--grid-breakpoints,
76
80
  $gutter: $carbon--grid-gutter
@@ -129,13 +133,14 @@
129
133
  }
130
134
  }
131
135
 
132
- /// -----------------------------------------------------------------------------
133
- /// Rows
134
- /// -----------------------------------------------------------------------------
136
+ // -----------------------------------------------------------------------------
137
+ // Rows
138
+ // -----------------------------------------------------------------------------
135
139
 
136
140
  /// Define the properties for a selector assigned to a row in the grid system.
137
- /// @param {Number} $gutter - the gutter in the grid system
141
+ /// @param {Number} $gutter [$carbon--grid-gutter] - The gutter in the grid system
138
142
  /// @access private
143
+ /// @group @carbon/grid
139
144
  @mixin carbon--make-row($gutter: $carbon--grid-gutter) {
140
145
  display: flex;
141
146
  flex-wrap: wrap;
@@ -143,13 +148,14 @@
143
148
  margin-left: -1 * $gutter / 2;
144
149
  }
145
150
 
146
- /// -----------------------------------------------------------------------------
147
- /// No gutter
148
- /// -----------------------------------------------------------------------------
151
+ // -----------------------------------------------------------------------------
152
+ // No gutter
153
+ // -----------------------------------------------------------------------------
149
154
 
150
- /// Add no-gutter and no-gutter--{left,right} classes to the output CSS. These
155
+ /// Add `no-gutter` and `no-gutter--{left,right}` classes to the output CSS. These
151
156
  /// classes are useful for dropping the gutter in fluid situations.
152
157
  /// @access private
158
+ /// @group @carbon/grid
153
159
  @mixin carbon--no-gutter {
154
160
  .#{$prefix}--no-gutter,
155
161
  .#{$prefix}--row.#{$prefix}--no-gutter [class*='#{$prefix}--col'] {
@@ -168,14 +174,15 @@
168
174
  }
169
175
  }
170
176
 
171
- /// -----------------------------------------------------------------------------
172
- /// Hang
173
- /// -----------------------------------------------------------------------------
177
+ // -----------------------------------------------------------------------------
178
+ // Hang
179
+ // -----------------------------------------------------------------------------
174
180
 
175
- /// Add hang--left and hang--right classes for a given gutter. These classes are
181
+ /// Add `hang--left` and `hang--right` classes for a given gutter. These classes are
176
182
  /// used alongside `no-gutter--left` and `no-gutter--right` to "hang" type.
177
- /// @param {Number} $gutter
183
+ /// @param {Number} $gutter [$carbon--grid-gutter] - The gutter in the grid system
178
184
  /// @access private
185
+ /// @group @carbon/grid
179
186
  @mixin carbon--hang($gutter: $carbon--grid-gutter) {
180
187
  .#{$prefix}--hang--left {
181
188
  padding-left: ($gutter / 2);
@@ -186,18 +193,21 @@
186
193
  }
187
194
  }
188
195
 
189
- /// -----------------------------------------------------------------------------
190
- /// Aspect ratio
191
- /// -----------------------------------------------------------------------------
196
+ // -----------------------------------------------------------------------------
197
+ // Aspect ratio
198
+ // -----------------------------------------------------------------------------
192
199
 
193
200
  /// The aspect ratios that are used to generate corresponding aspect ratio
194
201
  /// classes in code
202
+ /// @type List
195
203
  /// @access public
204
+ /// @group @carbon/grid
196
205
  $carbon--aspect-ratios: ((16, 9), (2, 1), (4, 3), (1, 1));
197
206
 
198
207
  /// Output the CSS classes for generating aspect ratio classes
199
- /// @param {List} $aspect-ratios - a list of aspect ratios to generate
208
+ /// @param {List} $aspect-ratios [$carbon--aspect-ratios] - A list of aspect ratios to generate
200
209
  /// @access private
210
+ /// @group @carbon/grid
201
211
  @mixin carbon--aspect-ratio($aspect-ratios: $carbon--aspect-ratios) {
202
212
  .#{$prefix}--aspect-ratio {
203
213
  height: 0;
@@ -225,14 +235,15 @@ $carbon--aspect-ratios: ((16, 9), (2, 1), (4, 3), (1, 1));
225
235
  }
226
236
  }
227
237
 
228
- /// -----------------------------------------------------------------------------
229
- /// Grid
230
- /// -----------------------------------------------------------------------------
238
+ // -----------------------------------------------------------------------------
239
+ // Grid
240
+ // -----------------------------------------------------------------------------
231
241
 
232
242
  /// Create the container for a grid. Will cause full-bleed for the grid unless
233
243
  /// max-width properties are added with `make-container-max-widths`
234
- /// @param {Map} $breakpoints
244
+ /// @param {Map} $breakpoints [$carbon--grid-breakpoints] - A map of breakpoints where the key is the name
235
245
  /// @access private
246
+ /// @group @carbon/grid
236
247
  @mixin carbon--make-container($breakpoints: $carbon--grid-breakpoints) {
237
248
  margin-right: auto;
238
249
  margin-left: auto;
@@ -261,8 +272,9 @@ $carbon--aspect-ratios: ((16, 9), (2, 1), (4, 3), (1, 1));
261
272
  }
262
273
 
263
274
  /// Get the last breakpoint width and set max-width to its value
264
- /// @param {Map} $breakpoints
275
+ /// @param {Map} $breakpoints [$carbon--grid-breakpoints] - A map of breakpoints where the key is the name
265
276
  /// @access private
277
+ /// @group @carbon/grid
266
278
  @mixin carbon--set-largest-breakpoint($breakpoints: $carbon--grid-breakpoints) {
267
279
  $largest-breakpoint: last-map-item($breakpoints);
268
280
 
@@ -270,8 +282,9 @@ $carbon--aspect-ratios: ((16, 9), (2, 1), (4, 3), (1, 1));
270
282
  }
271
283
 
272
284
  /// Add in the max-widths for each breakpoint to the container
273
- /// @param {Map} $breakpoints
285
+ /// @param {Map} $breakpoints [$carbon--grid-breakpoints] - A map of breakpoints where the key is the name
274
286
  /// @access private
287
+ /// @group @carbon/grid
275
288
  @mixin carbon--make-container-max-widths(
276
289
  $breakpoints: $carbon--grid-breakpoints
277
290
  ) {
@@ -282,10 +295,12 @@ $carbon--aspect-ratios: ((16, 9), (2, 1), (4, 3), (1, 1));
282
295
  }
283
296
  }
284
297
 
285
- /// Generate the CSS for a grid for the given breakpoints and gutter
286
- /// @param {Map} $breakpoints
287
- /// @param {Number} $grid-gutter
298
+ /// Generate the CSS for a grid for the given breakpoints and gutters
299
+ /// @param {Map} $breakpoints [$carbon--grid-breakpoints] - The default breakpoints
300
+ /// @param {Number} $grid-gutter [$carbon--grid-gutter] - The default gutters
301
+ /// @param {Number} $condensed-gutter [$carbon--grid-gutter--condensed] - The condensed mode gutter
288
302
  /// @access public
303
+ /// @group @carbon/grid
289
304
  @mixin carbon--grid(
290
305
  $breakpoints: $carbon--grid-breakpoints,
291
306
  $grid-gutter: $carbon--grid-gutter,
package/scss/_prefix.scss CHANGED
@@ -5,4 +5,8 @@
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  //
7
7
 
8
+ /// Namespace prefix
9
+ /// @type String
10
+ /// @access public
11
+ /// @group @carbon/grid
8
12
  $prefix: 'bx' !default;
package/scss/grid.scss CHANGED
@@ -5,6 +5,6 @@
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  //
7
7
 
8
- @import 'mixins';
8
+ @import './_inlined/mixins';
9
9
 
10
10
  @include carbon--grid();
@@ -0,0 +1,10 @@
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
+ @import 'mixins';
9
+
10
+ @include carbon--grid();
@@ -0,0 +1,27 @@
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
+ /// Used by `exports` mixin to track which modules have been imported
9
+ /// @type Map
10
+ /// @access public
11
+ /// @group @carbon/import-once
12
+ $imported-modules: () !default;
13
+
14
+ /// Module export mixin that helps making sure a module is imported once and only once
15
+ /// @access public
16
+ /// @param {String} $name - Name of exported module
17
+ /// @param {Bool} $warn [false] - Warn when a module has been already imported
18
+ /// @content Declaration blocks to be imported
19
+ /// @group @carbon/import-once
20
+ @mixin exports($name, $warn: false) {
21
+ @if (index($imported-modules, $name) == null) {
22
+ $imported-modules: append($imported-modules, $name) !global;
23
+ @content;
24
+ } @else if $warn == true {
25
+ @warn 'Module `#{$name}` has already been imported.';
26
+ }
27
+ }
@@ -0,0 +1,8 @@
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
+ @import 'import-once';