@carbon/grid 10.41.0 → 10.42.0-rc.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 +5 -5
- package/scss/_inlined/_mixins.import.scss +2 -2
- package/scss/_mixins.import.scss +2 -2
- package/scss/modules/_breakpoint.scss +3 -3
- package/scss/modules/_css-grid.scss +3 -3
- package/scss/modules/_flex-grid.scss +18 -18
- package/scss/modules/_mixins.scss +11 -11
- package/scss/vendor/@carbon/import-once/import-once.scss +1 -1
- package/scss/vendor/@carbon/layout/_key-height.import.scss +2 -2
- package/scss/vendor/@carbon/layout/modules/_utilities.scss +3 -3
- package/scss/vendor/@carbon/layout/modules/_breakpoint.scss +0 -232
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.42.0-rc.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"clean": "rimraf scss/_inlined scss/vendor"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@carbon/import-once": "^10.
|
|
36
|
-
"@carbon/layout": "^10.
|
|
35
|
+
"@carbon/import-once": "^10.7.0-rc.0",
|
|
36
|
+
"@carbon/layout": "^10.37.0-rc.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@carbon/cli": "^10.
|
|
39
|
+
"@carbon/cli": "^10.34.0-rc.0",
|
|
40
40
|
"rimraf": "^3.0.0"
|
|
41
41
|
},
|
|
42
42
|
"eyeglass": {
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"sassDir": "scss",
|
|
46
46
|
"needs": "^1.3.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "e41618f5aaa9a10ce93edd844f1a280dc29eaf50"
|
|
49
49
|
}
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
|
|
26
26
|
@use 'sass:meta';
|
|
27
27
|
@use 'sass:math';
|
|
28
|
-
@import '../vendor/@carbon/layout/breakpoint';
|
|
29
|
-
@import 'prefix';
|
|
28
|
+
@import '../vendor/@carbon/layout/breakpoint';
|
|
29
|
+
@import 'prefix';
|
|
30
30
|
|
|
31
31
|
// -----------------------------------------------------------------------------
|
|
32
32
|
// Columns
|
package/scss/_mixins.import.scss
CHANGED
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
|
|
26
26
|
@use 'sass:meta';
|
|
27
27
|
@use 'sass:math';
|
|
28
|
-
@import '@carbon/layout/scss/breakpoint';
|
|
29
|
-
@import 'prefix';
|
|
28
|
+
@import '@carbon/layout/scss/breakpoint';
|
|
29
|
+
@import 'prefix';
|
|
30
30
|
|
|
31
31
|
// -----------------------------------------------------------------------------
|
|
32
32
|
// Columns
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
/// @group @carbon/layout
|
|
21
21
|
@function map-deep-get($map, $keys...) {
|
|
22
22
|
@each $key in $keys {
|
|
23
|
-
$map: map
|
|
23
|
+
$map: map.get($map, $key);
|
|
24
24
|
}
|
|
25
25
|
@return $map;
|
|
26
26
|
}
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
/// @return {String} Desired value
|
|
33
33
|
/// @group @carbon/layout
|
|
34
34
|
@function key-by-index($map, $index) {
|
|
35
|
-
$keys: map
|
|
35
|
+
$keys: map.keys($map);
|
|
36
36
|
@return nth($keys, $index);
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
/// @return {*} Desired value
|
|
43
43
|
/// @group @carbon/layout
|
|
44
44
|
@function last-map-item($map) {
|
|
45
|
-
$total-length: length($map);
|
|
45
|
+
$total-length: list.length($map);
|
|
46
46
|
@return map-get($map, key-by-index($map, $total-length));
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
// the width of the column. Applies to IE10+ and Firefox. Chrome and Safari
|
|
71
71
|
// do not appear to require this.
|
|
72
72
|
@if meta.function-exists('div', 'math') {
|
|
73
|
-
max-width: percentage(math.div($span, $columns));
|
|
74
|
-
flex: 0 0 percentage(math.div($span, $columns));
|
|
73
|
+
max-width: math.percentage(math.div($span, $columns));
|
|
74
|
+
flex: 0 0 math.percentage(math.div($span, $columns));
|
|
75
75
|
} @else {
|
|
76
|
-
max-width: percentage(($span / $columns));
|
|
77
|
-
flex: 0 0 percentage(($span / $columns));
|
|
76
|
+
max-width: math.percentage(($span / $columns));
|
|
77
|
+
flex: 0 0 math.percentage(($span / $columns));
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
}
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
@if $offset == 0 {
|
|
95
95
|
margin-left: 0;
|
|
96
96
|
} @else {
|
|
97
|
-
margin-left: percentage($offset);
|
|
97
|
+
margin-left: math.percentage($offset);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
|
|
114
114
|
@each $breakpoint in map-keys($breakpoints) {
|
|
115
115
|
$infix: breakpoint-infix($breakpoint);
|
|
116
|
-
$columns: map
|
|
116
|
+
$columns: map.get(map.get($breakpoints, $breakpoint), columns);
|
|
117
117
|
|
|
118
118
|
// Allow columns to stretch full width below their breakpoints
|
|
119
119
|
@for $i from 0 through $columns {
|
|
@@ -257,11 +257,11 @@
|
|
|
257
257
|
@include -set-largest-breakpoint();
|
|
258
258
|
|
|
259
259
|
@each $name, $value in $breakpoints {
|
|
260
|
-
$prev-breakpoint: map
|
|
261
|
-
$margin: map
|
|
260
|
+
$prev-breakpoint: map.get($breakpoints, breakpoint-prev($name));
|
|
261
|
+
$margin: map.get($value, margin);
|
|
262
262
|
|
|
263
263
|
@if $prev-breakpoint {
|
|
264
|
-
$prev-margin: map
|
|
264
|
+
$prev-margin: map.get($prev-breakpoint, margin);
|
|
265
265
|
@if $prev-margin != $margin {
|
|
266
266
|
@include breakpoint($name) {
|
|
267
267
|
padding-right: #{($grid-gutter * 0.5) + $margin};
|
|
@@ -284,7 +284,7 @@
|
|
|
284
284
|
@mixin -set-largest-breakpoint($breakpoints: $grid-breakpoints) {
|
|
285
285
|
$largest-breakpoint: last-map-item($breakpoints);
|
|
286
286
|
|
|
287
|
-
max-width: map
|
|
287
|
+
max-width: map.get($largest-breakpoint, 'width');
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
/// Add in the max-widths for each breakpoint to the container
|
|
@@ -294,7 +294,7 @@
|
|
|
294
294
|
@mixin -make-container-max-widths($breakpoints: $grid-breakpoints) {
|
|
295
295
|
@each $name, $value in $breakpoints {
|
|
296
296
|
@include breakpoint($name) {
|
|
297
|
-
max-width: map
|
|
297
|
+
max-width: map.get($value, width);
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
}
|
|
@@ -341,26 +341,26 @@
|
|
|
341
341
|
}
|
|
342
342
|
|
|
343
343
|
@if $flex-grid-columns == 12 {
|
|
344
|
-
$flex-12-column-grid: map
|
|
344
|
+
$flex-12-column-grid: map.merge(
|
|
345
345
|
$grid-breakpoints,
|
|
346
346
|
(
|
|
347
347
|
lg:
|
|
348
|
-
map
|
|
349
|
-
map
|
|
348
|
+
map.merge(
|
|
349
|
+
map.get($grid-breakpoints, lg),
|
|
350
350
|
(
|
|
351
351
|
columns: 12,
|
|
352
352
|
)
|
|
353
353
|
),
|
|
354
354
|
xlg:
|
|
355
|
-
map
|
|
356
|
-
map
|
|
355
|
+
map.merge(
|
|
356
|
+
map.get($grid-breakpoints, xlg),
|
|
357
357
|
(
|
|
358
358
|
columns: 12,
|
|
359
359
|
)
|
|
360
360
|
),
|
|
361
361
|
max:
|
|
362
|
-
map
|
|
363
|
-
map
|
|
362
|
+
map.merge(
|
|
363
|
+
map.get($grid-breakpoints, max),
|
|
364
364
|
(
|
|
365
365
|
columns: 12,
|
|
366
366
|
)
|
|
@@ -65,11 +65,11 @@
|
|
|
65
65
|
// the width of the column. Applies to IE10+ and Firefox. Chrome and Safari
|
|
66
66
|
// do not appear to require this.
|
|
67
67
|
@if meta.function-exists('div', 'math') {
|
|
68
|
-
max-width: percentage(math.div($span, $columns));
|
|
69
|
-
flex: 0 0 percentage(math.div($span, $columns));
|
|
68
|
+
max-width: math.percentage(math.div($span, $columns));
|
|
69
|
+
flex: 0 0 math.percentage(math.div($span, $columns));
|
|
70
70
|
} @else {
|
|
71
|
-
max-width: percentage(($span / $columns));
|
|
72
|
-
flex: 0 0 percentage(($span / $columns));
|
|
71
|
+
max-width: math.percentage(($span / $columns));
|
|
72
|
+
flex: 0 0 math.percentage(($span / $columns));
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
@if $offset == 0 {
|
|
90
90
|
margin-left: 0;
|
|
91
91
|
} @else {
|
|
92
|
-
margin-left: percentage($offset);
|
|
92
|
+
margin-left: math.percentage($offset);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
|
|
109
109
|
@each $breakpoint in map-keys($breakpoints) {
|
|
110
110
|
$infix: breakpoint-infix($breakpoint);
|
|
111
|
-
$columns: map
|
|
111
|
+
$columns: map.get(map.get($breakpoints, $breakpoint), columns);
|
|
112
112
|
|
|
113
113
|
// Allow columns to stretch full width below their breakpoints
|
|
114
114
|
@for $i from 0 through $columns {
|
|
@@ -252,11 +252,11 @@
|
|
|
252
252
|
@include -set-largest-breakpoint();
|
|
253
253
|
|
|
254
254
|
@each $name, $value in $breakpoints {
|
|
255
|
-
$prev-breakpoint: map
|
|
256
|
-
$margin: map
|
|
255
|
+
$prev-breakpoint: map.get($breakpoints, breakpoint-prev($name));
|
|
256
|
+
$margin: map.get($value, margin);
|
|
257
257
|
|
|
258
258
|
@if $prev-breakpoint {
|
|
259
|
-
$prev-margin: map
|
|
259
|
+
$prev-margin: map.get($prev-breakpoint, margin);
|
|
260
260
|
@if $prev-margin != $margin {
|
|
261
261
|
@include breakpoint($name) {
|
|
262
262
|
padding-right: #{($grid-gutter * 0.5) + $margin};
|
|
@@ -279,7 +279,7 @@
|
|
|
279
279
|
@mixin -set-largest-breakpoint($breakpoints: $grid-breakpoints) {
|
|
280
280
|
$largest-breakpoint: last-map-item($breakpoints);
|
|
281
281
|
|
|
282
|
-
max-width: map
|
|
282
|
+
max-width: map.get($largest-breakpoint, 'width');
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
/// Add in the max-widths for each breakpoint to the container
|
|
@@ -289,7 +289,7 @@
|
|
|
289
289
|
@mixin -make-container-max-widths($breakpoints: $grid-breakpoints) {
|
|
290
290
|
@each $name, $value in $breakpoints {
|
|
291
291
|
@include breakpoint($name) {
|
|
292
|
-
max-width: map
|
|
292
|
+
max-width: map.get($value, width);
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
295
|
}
|
|
@@ -18,7 +18,7 @@ $imported-modules: () !default;
|
|
|
18
18
|
/// @content Declaration blocks to be imported
|
|
19
19
|
/// @group @carbon/import-once
|
|
20
20
|
@mixin exports($name, $warn: false) {
|
|
21
|
-
@if (index($imported-modules, $name)
|
|
21
|
+
@if not(index($imported-modules, $name)) {
|
|
22
22
|
$imported-modules: append($imported-modules, $name) !global;
|
|
23
23
|
@content;
|
|
24
24
|
} @else if $warn == true {
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
|
|
22
22
|
@use 'sass:meta';
|
|
23
23
|
@use "sass:math";
|
|
24
|
-
@import 'breakpoint';
|
|
25
|
-
@import 'utilities';
|
|
24
|
+
@import 'breakpoint';
|
|
25
|
+
@import 'utilities';
|
|
26
26
|
|
|
27
27
|
/// Get the column width for a given breakpoint
|
|
28
28
|
/// @param {String} $breakpoint
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
/// @group @carbon/layout
|
|
15
15
|
@function map-deep-get($map, $keys...) {
|
|
16
16
|
@each $key in $keys {
|
|
17
|
-
$map: map
|
|
17
|
+
$map: map.get($map, $key);
|
|
18
18
|
}
|
|
19
19
|
@return $map;
|
|
20
20
|
}
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
/// @return {String} Desired value
|
|
27
27
|
/// @group @carbon/layout
|
|
28
28
|
@function key-by-index($map, $index) {
|
|
29
|
-
$keys: map
|
|
29
|
+
$keys: map.keys($map);
|
|
30
30
|
@return nth($keys, $index);
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -36,6 +36,6 @@
|
|
|
36
36
|
/// @return {*} Desired value
|
|
37
37
|
/// @group @carbon/layout
|
|
38
38
|
@function last-map-item($map) {
|
|
39
|
-
$total-length: length($map);
|
|
39
|
+
$total-length: list.length($map);
|
|
40
40
|
@return map-get($map, carbon--key-by-index($map, $total-length));
|
|
41
41
|
}
|
|
@@ -1,232 +0,0 @@
|
|
|
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 'convert';
|
|
13
|
-
@use 'utilities';
|
|
14
|
-
|
|
15
|
-
/// Carbon gutter size in rem
|
|
16
|
-
/// @type Number
|
|
17
|
-
/// @access public
|
|
18
|
-
/// @group @carbon/layout
|
|
19
|
-
$grid-gutter: convert.rem(32px);
|
|
20
|
-
|
|
21
|
-
/// Carbon condensed gutter size in rem
|
|
22
|
-
/// @type Number
|
|
23
|
-
/// @access public
|
|
24
|
-
/// @group @carbon/layout
|
|
25
|
-
$grid-gutter--condensed: convert.rem(1px);
|
|
26
|
-
|
|
27
|
-
// Initial map of our breakpoints and their values
|
|
28
|
-
/// @type Map
|
|
29
|
-
/// @access public
|
|
30
|
-
/// @group @carbon/layout
|
|
31
|
-
$grid-breakpoints: (
|
|
32
|
-
sm: (
|
|
33
|
-
columns: 4,
|
|
34
|
-
margin: 0,
|
|
35
|
-
width: convert.rem(320px),
|
|
36
|
-
),
|
|
37
|
-
md: (
|
|
38
|
-
columns: 8,
|
|
39
|
-
margin: convert.rem(16px),
|
|
40
|
-
width: convert.rem(672px),
|
|
41
|
-
),
|
|
42
|
-
lg: (
|
|
43
|
-
columns: 16,
|
|
44
|
-
margin: convert.rem(16px),
|
|
45
|
-
width: convert.rem(1056px),
|
|
46
|
-
),
|
|
47
|
-
xlg: (
|
|
48
|
-
columns: 16,
|
|
49
|
-
margin: convert.rem(16px),
|
|
50
|
-
width: convert.rem(1312px),
|
|
51
|
-
),
|
|
52
|
-
max: (
|
|
53
|
-
columns: 16,
|
|
54
|
-
margin: convert.rem(24px),
|
|
55
|
-
width: convert.rem(1584px),
|
|
56
|
-
),
|
|
57
|
-
) !default;
|
|
58
|
-
|
|
59
|
-
/// Get the value of the next breakpoint, or null for the last breakpoint
|
|
60
|
-
/// @param {String} $name - The name of the breakpoint
|
|
61
|
-
/// @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
|
|
62
|
-
/// @param {List} $breakpoint-names [map-keys($breakpoints)] - A list of names from the `$breakpoints` map
|
|
63
|
-
/// @return {String}
|
|
64
|
-
/// @access public
|
|
65
|
-
/// @group @carbon/layout
|
|
66
|
-
@function breakpoint-next(
|
|
67
|
-
$name,
|
|
68
|
-
$breakpoints: $grid-breakpoints,
|
|
69
|
-
$breakpoint-names: map.keys($breakpoints)
|
|
70
|
-
) {
|
|
71
|
-
$n: list.index($breakpoint-names, $name);
|
|
72
|
-
@if $n != null and $n < list.length($breakpoint-names) {
|
|
73
|
-
@return list.nth($breakpoint-names, $n + 1);
|
|
74
|
-
}
|
|
75
|
-
@return null;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/// Get the value of the previous breakpoint, or null for the first breakpoint
|
|
79
|
-
/// @param {String} $name - The name of the breakpoint
|
|
80
|
-
/// @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
|
|
81
|
-
/// @param {List} $breakpoint-names [map-keys($breakpoints)] - A list of names from the `$breakpoints` map
|
|
82
|
-
/// @return {String}
|
|
83
|
-
/// @access public
|
|
84
|
-
/// @group @carbon/layout
|
|
85
|
-
@function breakpoint-prev(
|
|
86
|
-
$name,
|
|
87
|
-
$breakpoints: $grid-breakpoints,
|
|
88
|
-
$breakpoint-names: map.keys($breakpoints)
|
|
89
|
-
) {
|
|
90
|
-
$n: list.index($breakpoint-names, $name);
|
|
91
|
-
@if $n != null and $n > 1 {
|
|
92
|
-
@return list.nth($breakpoint-names, $n - 1);
|
|
93
|
-
}
|
|
94
|
-
@return null;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/// Check to see if the given breakpoint name
|
|
98
|
-
/// @param {String} $name - The name of the breakpoint
|
|
99
|
-
/// @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
|
|
100
|
-
/// @return {Bool}
|
|
101
|
-
/// @access public
|
|
102
|
-
/// @group @carbon/layout
|
|
103
|
-
@function is-smallest-breakpoint($name, $breakpoints: $grid-breakpoints) {
|
|
104
|
-
@return list.index(map.keys($breakpoints), $name) == 1;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/// Returns the largest breakpoint name
|
|
108
|
-
/// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
|
|
109
|
-
/// @return {String}
|
|
110
|
-
/// @access public
|
|
111
|
-
/// @group @carbon/layout
|
|
112
|
-
@function largest-breakpoint-name($breakpoints: $grid-breakpoints) {
|
|
113
|
-
$total-breakpoints: list.length($breakpoints);
|
|
114
|
-
@return key-by-index($breakpoints, $total-breakpoints);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/// Get the infix for a given breakpoint in a list of breakpoints. Useful for generating the size part in a selector, for example: `.prefix--col-sm-2`.
|
|
118
|
-
/// @param {String} $name - The name of the breakpoint
|
|
119
|
-
/// @return {String}
|
|
120
|
-
/// @access public
|
|
121
|
-
/// @group @carbon/layout
|
|
122
|
-
@function breakpoint-infix($name) {
|
|
123
|
-
@return '-#{$name}';
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/// Generate a media query from the width of the given breakpoint to infinity
|
|
127
|
-
/// @param {String | Number} $name
|
|
128
|
-
/// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
|
|
129
|
-
/// @content
|
|
130
|
-
/// @access public
|
|
131
|
-
/// @group @carbon/layout
|
|
132
|
-
@mixin breakpoint-up($name, $breakpoints: $grid-breakpoints) {
|
|
133
|
-
@if meta.type-of($name) == 'number' {
|
|
134
|
-
@media (min-width: $name) {
|
|
135
|
-
@content;
|
|
136
|
-
}
|
|
137
|
-
} @else if map.has-key($breakpoints, $name) {
|
|
138
|
-
$breakpoint: map.get($breakpoints, $name);
|
|
139
|
-
$width: map.get($breakpoint, width);
|
|
140
|
-
@if is-smallest-breakpoint($name, $breakpoints) {
|
|
141
|
-
@content;
|
|
142
|
-
} @else {
|
|
143
|
-
@media (min-width: $width) {
|
|
144
|
-
@content;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
} @else {
|
|
148
|
-
@error 'Unable to find a breakpoint with name `#{$name}`. Expected one of: (#{map.keys($breakpoints)})';
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/// Generate a media query for the maximum width of the given styles
|
|
153
|
-
/// @param {String | Number} $name
|
|
154
|
-
/// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
|
|
155
|
-
/// @content
|
|
156
|
-
/// @access public
|
|
157
|
-
/// @group @carbon/layout
|
|
158
|
-
@mixin breakpoint-down($name, $breakpoints: $grid-breakpoints) {
|
|
159
|
-
@if meta.type-of($name) == 'number' {
|
|
160
|
-
@media (max-width: $name) {
|
|
161
|
-
@content;
|
|
162
|
-
}
|
|
163
|
-
} @else if map.has-key($breakpoints, $name) {
|
|
164
|
-
// We borrow this logic from bootstrap for specifying the value of the
|
|
165
|
-
// max-width. The maximum width is calculated by finding the breakpoint and
|
|
166
|
-
// subtracting .02 from its value. This value is used instead of .01 to
|
|
167
|
-
// avoid rounding issues in Safari
|
|
168
|
-
// https://github.com/twbs/bootstrap/blob/c5b1919deaf5393fcca9e9b9d7ce9c338160d99d/scss/mixins/_breakpoints.scss#L34-L46
|
|
169
|
-
$breakpoint: map.get($breakpoints, $name);
|
|
170
|
-
$width: map.get($breakpoint, width) - 0.02;
|
|
171
|
-
@media (max-width: $width) {
|
|
172
|
-
@content;
|
|
173
|
-
}
|
|
174
|
-
} @else {
|
|
175
|
-
@error 'Unable to find a breakpoint with name `#{$name}`. Expected one of: (#{map.keys($breakpoints)})';
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/// Generate a media query for the range between the lower and upper breakpoints
|
|
180
|
-
/// @param {String | Number} $lower
|
|
181
|
-
/// @param {String | Number} $upper
|
|
182
|
-
/// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
|
|
183
|
-
/// @content
|
|
184
|
-
/// @access public
|
|
185
|
-
/// @group @carbon/layout
|
|
186
|
-
@mixin breakpoint-between($lower, $upper, $breakpoints: $grid-breakpoints) {
|
|
187
|
-
$is-number-lower: meta.type-of($lower) == 'number';
|
|
188
|
-
$is-number-upper: meta.type-of($upper) == 'number';
|
|
189
|
-
$min: if($is-number-lower, $lower, map.get($breakpoints, $lower));
|
|
190
|
-
$max: if($is-number-upper, $upper, map.get($breakpoints, $upper));
|
|
191
|
-
|
|
192
|
-
@if $min and $max {
|
|
193
|
-
$min-width: if(not $is-number-lower and $min, map.get($min, width), $min);
|
|
194
|
-
$max-width: if(not $is-number-upper and $max, map.get($max, width), $max);
|
|
195
|
-
@media (min-width: $min-width) and (max-width: $max-width) {
|
|
196
|
-
@content;
|
|
197
|
-
}
|
|
198
|
-
} @else if $min != null and $max == null {
|
|
199
|
-
@include breakpoint-up($lower) {
|
|
200
|
-
@content;
|
|
201
|
-
}
|
|
202
|
-
} @else if $min == null and $max != null {
|
|
203
|
-
@include breakpoint-down($upper) {
|
|
204
|
-
@content;
|
|
205
|
-
}
|
|
206
|
-
} @else {
|
|
207
|
-
@error 'Unable to find a breakpoint to satisfy: (#{$lower},#{$upper}). Expected both to be one of (#{map.keys($breakpoints)}).';
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/// Generate media query for the largest breakpoint
|
|
212
|
-
/// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
|
|
213
|
-
/// @content
|
|
214
|
-
/// @access public
|
|
215
|
-
/// @group @carbon/layout
|
|
216
|
-
@mixin largest-breakpoint($breakpoints: $grid-breakpoints) {
|
|
217
|
-
@include breakpoint(largest-breakpoint-name()) {
|
|
218
|
-
@content;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/// Generate a media query for a given breakpoint
|
|
223
|
-
/// @param {String | Number} $name
|
|
224
|
-
/// @param {Map} $breakpoints [$grid-breakpoints] - A map of breakpoints where the key is the name
|
|
225
|
-
/// @content
|
|
226
|
-
/// @access public
|
|
227
|
-
/// @group @carbon/layout
|
|
228
|
-
@mixin breakpoint($name, $breakpoints: $grid-breakpoints) {
|
|
229
|
-
@include breakpoint-up($name, $breakpoints) {
|
|
230
|
-
@content;
|
|
231
|
-
}
|
|
232
|
-
}
|