@carbon/layout 10.29.0 → 10.31.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 +4 -4
- package/scss/_breakpoint.scss +4 -4
- package/scss/_convert.import.scss +56 -0
- package/scss/_convert.scss +14 -0
- package/scss/_key-height.import.scss +112 -0
- package/scss/_key-height.scss +14 -0
- package/scss/modules/_breakpoint.scss +4 -4
- package/scss/modules/_convert.scss +4 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/layout",
|
|
3
3
|
"description": "Layout helpers for digital and software products using the Carbon Design System",
|
|
4
|
-
"version": "10.
|
|
4
|
+
"version": "10.31.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"clean": "rimraf es lib umd scss/generated scss/modules/generated"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@carbon/cli": "^10.
|
|
32
|
+
"@carbon/cli": "^10.28.0",
|
|
33
33
|
"@carbon/cli-reporter": "^10.5.0",
|
|
34
34
|
"@carbon/scss-generator": "^10.13.0",
|
|
35
|
-
"@carbon/test-utils": "^10.
|
|
35
|
+
"@carbon/test-utils": "^10.18.0",
|
|
36
36
|
"core-js": "^3.16.0",
|
|
37
37
|
"rimraf": "^3.0.0"
|
|
38
38
|
},
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"sassDir": "scss",
|
|
43
43
|
"needs": "^1.3.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "8ce0b4c0e5547837888b4050fa8630a7692df79b"
|
|
46
46
|
}
|
package/scss/_breakpoint.scss
CHANGED
|
@@ -54,7 +54,7 @@ $carbon--grid-breakpoints: (
|
|
|
54
54
|
) !default;
|
|
55
55
|
|
|
56
56
|
/// Get the value of the next breakpoint, or null for the last breakpoint
|
|
57
|
-
/// @param {String} $name - The name of the
|
|
57
|
+
/// @param {String} $name - The name of the breakpoint
|
|
58
58
|
/// @param {Map} $breakpoints [$carbon--grid-breakpoints] - A map of breakpoints where the key is the name of the breakpoint and the value is the values for the breakpoint
|
|
59
59
|
/// @param {List} $breakpoint-names [map-keys($breakpoints)] - A list of names from the `$breakpoints` map
|
|
60
60
|
/// @return {String}
|
|
@@ -73,7 +73,7 @@ $carbon--grid-breakpoints: (
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/// Get the value of the previous breakpoint, or null for the first breakpoint
|
|
76
|
-
/// @param {String} $name - The name of the
|
|
76
|
+
/// @param {String} $name - The name of the breakpoint
|
|
77
77
|
/// @param {Map} $breakpoints [$carbon--grid-breakpoints] - A map of breakpoints where the key is the name of the breakpoint and the value is the values for the breakpoint
|
|
78
78
|
/// @param {List} $breakpoint-names [map-keys($breakpoints)] - A list of names from the `$breakpoints` map
|
|
79
79
|
/// @return {String}
|
|
@@ -92,7 +92,7 @@ $carbon--grid-breakpoints: (
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
/// Check to see if the given breakpoint name
|
|
95
|
-
/// @param {String} $name - The name of the
|
|
95
|
+
/// @param {String} $name - The name of the breakpoint
|
|
96
96
|
/// @param {Map} $breakpoints [$carbon--grid-breakpoints] - A map of breakpoints where the key is the name of the breakpoint and the value is the values for the breakpoint
|
|
97
97
|
/// @return {Bool}
|
|
98
98
|
/// @access public
|
|
@@ -116,7 +116,7 @@ $carbon--grid-breakpoints: (
|
|
|
116
116
|
@return carbon--key-by-index($breakpoints, $total-breakpoints);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
/// Get the infix for a given breakpoint in a list of breakpoints.
|
|
119
|
+
/// 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`.
|
|
120
120
|
/// @param {String} $name - The name of the breakpoint
|
|
121
121
|
/// @return {String}
|
|
122
122
|
/// @access public
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
// Compatibility notes (*.import.scss)
|
|
9
|
+
// ------------------------------------------
|
|
10
|
+
//
|
|
11
|
+
// This file is intended to be consumed and processed with dart-sass.
|
|
12
|
+
// It is incompatible with node-sass/libsass as it contains sass language features
|
|
13
|
+
// or functions that are unavailable in node-sass/libsass, such as `math.div`.
|
|
14
|
+
//
|
|
15
|
+
// The non-`.import` suffixed version of this file eg. `_filename.scss`
|
|
16
|
+
// is intended to be compatible with node-sass/libsass.
|
|
17
|
+
//
|
|
18
|
+
// Styles authored within this file must be duplicated to the corresponding
|
|
19
|
+
// compatibility file to ensure we continue to support node-sass and dart-sass
|
|
20
|
+
// in v10.
|
|
21
|
+
|
|
22
|
+
@use 'sass:math';
|
|
23
|
+
|
|
24
|
+
/// Default font size
|
|
25
|
+
/// @type Number
|
|
26
|
+
/// @access public
|
|
27
|
+
/// @group @carbon/layout
|
|
28
|
+
$carbon--base-font-size: 16px !default;
|
|
29
|
+
|
|
30
|
+
/// Convert a given px unit to a rem unit
|
|
31
|
+
/// @param {Number} $px - Number with px unit
|
|
32
|
+
/// @return {Number} Number with rem unit
|
|
33
|
+
/// @access public
|
|
34
|
+
/// @group @carbon/layout
|
|
35
|
+
@function carbon--rem($px) {
|
|
36
|
+
@if unit($px) != 'px' {
|
|
37
|
+
// TODO: update to @error in v11
|
|
38
|
+
@warn "Expected argument $px to be of type `px`, instead received: `#{unit($px)}`";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@return math.div($px, $carbon--base-font-size) * 1rem;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/// Convert a given px unit to a em unit
|
|
45
|
+
/// @param {Number} $px - Number with px unit
|
|
46
|
+
/// @return {Number} Number with em unit
|
|
47
|
+
/// @access public
|
|
48
|
+
/// @group @carbon/layout
|
|
49
|
+
@function carbon--em($px) {
|
|
50
|
+
@if unit($px) != 'px' {
|
|
51
|
+
// TODO: update to @error in v11
|
|
52
|
+
@warn "Expected argument $px to be of type `px`, instead received: `#{unit($px)}`";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@return math.div($px, $carbon--base-font-size) * 1em;
|
|
56
|
+
}
|
package/scss/_convert.scss
CHANGED
|
@@ -4,6 +4,20 @@
|
|
|
4
4
|
// This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
|
6
6
|
//
|
|
7
|
+
//-------------------------------------------
|
|
8
|
+
// Compatibility notes
|
|
9
|
+
// ------------------------------------------
|
|
10
|
+
//
|
|
11
|
+
// This file is intended to be consumed and processed with node-sass/libsass.
|
|
12
|
+
// Sass language features only available in dart-sass, such as `math.div`,
|
|
13
|
+
// should not be used.
|
|
14
|
+
//
|
|
15
|
+
// The `.import` suffixed version of this file eg. `_filename.import.scss`
|
|
16
|
+
// is intended to be compatible with dart-sass.
|
|
17
|
+
//
|
|
18
|
+
// Styles authored within this file must be duplicated to the corresponding
|
|
19
|
+
// compatibility file to ensure we continue to support node-sass and dart-sass
|
|
20
|
+
// in v10.
|
|
7
21
|
|
|
8
22
|
/// Default font size
|
|
9
23
|
/// @type Number
|
|
@@ -0,0 +1,112 @@
|
|
|
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
|
+
// Compatibility notes (*.import.scss)
|
|
9
|
+
// ------------------------------------------
|
|
10
|
+
//
|
|
11
|
+
// This file is intended to be consumed and processed with dart-sass.
|
|
12
|
+
// It is incompatible with node-sass/libsass as it contains sass language features
|
|
13
|
+
// or functions that are unavailable in node-sass/libsass, such as `math.div`.
|
|
14
|
+
//
|
|
15
|
+
// The non-`.import` suffixed version of this file eg. `_filename.scss`
|
|
16
|
+
// is intended to be compatible with node-sass/libsass.
|
|
17
|
+
//
|
|
18
|
+
// Styles authored within this file must be duplicated to the corresponding
|
|
19
|
+
// compatibility file to ensure we continue to support node-sass and dart-sass
|
|
20
|
+
// in v10.
|
|
21
|
+
|
|
22
|
+
@use "sass:math";
|
|
23
|
+
@import 'breakpoint'; /* stylelint-disable-line no-invalid-position-at-import-rule */
|
|
24
|
+
@import 'utilities'; /* stylelint-disable-line no-invalid-position-at-import-rule */
|
|
25
|
+
|
|
26
|
+
/// Get the column width for a given breakpoint
|
|
27
|
+
/// @param {String} $breakpoint
|
|
28
|
+
/// @param {Map} $breakpoints [$carbon--grid-breakpoints]
|
|
29
|
+
/// @return {Number} In rem
|
|
30
|
+
/// @access public
|
|
31
|
+
/// @group @carbon/layout
|
|
32
|
+
@function carbon--get-column-width(
|
|
33
|
+
$breakpoint,
|
|
34
|
+
$breakpoints: $carbon--grid-breakpoints
|
|
35
|
+
) {
|
|
36
|
+
@if map-has-key($breakpoints, $breakpoint) {
|
|
37
|
+
$values: map-get($breakpoints, $breakpoint);
|
|
38
|
+
$width: map-get($values, width);
|
|
39
|
+
$margin: map-get($values, margin);
|
|
40
|
+
$columns: map-get($values, columns);
|
|
41
|
+
|
|
42
|
+
@return math.div($width - (2 * $margin), $columns);
|
|
43
|
+
} @else {
|
|
44
|
+
@warn 'Breakpoint: `#{$breakpoint}` is not a valid breakpoint.';
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/// @type Map
|
|
49
|
+
/// @access public
|
|
50
|
+
/// @group @carbon/layout
|
|
51
|
+
$carbon--key-height-scales: (
|
|
52
|
+
sm: (
|
|
53
|
+
carbon--get-column-width(sm),
|
|
54
|
+
carbon--get-column-width(sm) * 2,
|
|
55
|
+
carbon--get-column-width(sm) * 3,
|
|
56
|
+
carbon--get-column-width(sm) * 4,
|
|
57
|
+
carbon--get-column-width(sm) * 5,
|
|
58
|
+
carbon--get-column-width(sm) * 6,
|
|
59
|
+
),
|
|
60
|
+
md: (
|
|
61
|
+
carbon--get-column-width(md),
|
|
62
|
+
carbon--get-column-width(md) * 2,
|
|
63
|
+
carbon--get-column-width(md) * 3,
|
|
64
|
+
carbon--get-column-width(md) * 4,
|
|
65
|
+
carbon--get-column-width(md) * 5,
|
|
66
|
+
carbon--get-column-width(md) * 6,
|
|
67
|
+
),
|
|
68
|
+
lg: (
|
|
69
|
+
carbon--get-column-width(lg),
|
|
70
|
+
carbon--get-column-width(lg) * 2,
|
|
71
|
+
carbon--get-column-width(lg) * 3,
|
|
72
|
+
carbon--get-column-width(lg) * 4,
|
|
73
|
+
carbon--get-column-width(lg) * 5,
|
|
74
|
+
carbon--get-column-width(lg) * 6,
|
|
75
|
+
carbon--get-column-width(lg) * 7,
|
|
76
|
+
carbon--get-column-width(lg) * 8,
|
|
77
|
+
),
|
|
78
|
+
xlg: (
|
|
79
|
+
carbon--get-column-width(xlg),
|
|
80
|
+
carbon--get-column-width(xlg) * 2,
|
|
81
|
+
carbon--get-column-width(xlg) * 3,
|
|
82
|
+
carbon--get-column-width(xlg) * 4,
|
|
83
|
+
carbon--get-column-width(xlg) * 5,
|
|
84
|
+
carbon--get-column-width(xlg) * 6,
|
|
85
|
+
carbon--get-column-width(xlg) * 7,
|
|
86
|
+
carbon--get-column-width(xlg) * 8,
|
|
87
|
+
),
|
|
88
|
+
max: (
|
|
89
|
+
carbon--get-column-width(max),
|
|
90
|
+
carbon--get-column-width(max) * 2,
|
|
91
|
+
carbon--get-column-width(max) * 3,
|
|
92
|
+
carbon--get-column-width(max) * 4,
|
|
93
|
+
carbon--get-column-width(max) * 5,
|
|
94
|
+
carbon--get-column-width(max) * 6,
|
|
95
|
+
carbon--get-column-width(max) * 7,
|
|
96
|
+
carbon--get-column-width(max) * 8,
|
|
97
|
+
),
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
/// Get the value of a key height step at a given breakpoint
|
|
101
|
+
/// @param {String} $breakpoint
|
|
102
|
+
/// @param {Number} $step
|
|
103
|
+
/// @return {Number} In rem
|
|
104
|
+
/// @access public
|
|
105
|
+
/// @group @carbon/layout
|
|
106
|
+
@function carbon--key-height($breakpoint, $step) {
|
|
107
|
+
@if map-has-key($carbon--key-height-scales, $breakpoint) {
|
|
108
|
+
@return nth(map-get($carbon--key-height-scales, $breakpoint), $step);
|
|
109
|
+
} @else {
|
|
110
|
+
@warn 'Breakpoint: `#{$breakpoint}` is not a valid breakpoint.';
|
|
111
|
+
}
|
|
112
|
+
}
|
package/scss/_key-height.scss
CHANGED
|
@@ -4,6 +4,20 @@
|
|
|
4
4
|
// This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
|
6
6
|
//
|
|
7
|
+
//-------------------------------------------
|
|
8
|
+
// Compatibility notes
|
|
9
|
+
// ------------------------------------------
|
|
10
|
+
//
|
|
11
|
+
// This file is intended to be consumed and processed with node-sass/libsass.
|
|
12
|
+
// Sass language features only available in dart-sass, such as `math.div`,
|
|
13
|
+
// should not be used.
|
|
14
|
+
//
|
|
15
|
+
// The `.import` suffixed version of this file eg. `_filename.import.scss`
|
|
16
|
+
// is intended to be compatible with dart-sass.
|
|
17
|
+
//
|
|
18
|
+
// Styles authored within this file must be duplicated to the corresponding
|
|
19
|
+
// compatibility file to ensure we continue to support node-sass and dart-sass
|
|
20
|
+
// in v10.
|
|
7
21
|
|
|
8
22
|
@import 'breakpoint';
|
|
9
23
|
@import 'utilities';
|
|
@@ -57,7 +57,7 @@ $grid-breakpoints: (
|
|
|
57
57
|
) !default;
|
|
58
58
|
|
|
59
59
|
/// Get the value of the next breakpoint, or null for the last breakpoint
|
|
60
|
-
/// @param {String} $name - The name of the
|
|
60
|
+
/// @param {String} $name - The name of the breakpoint
|
|
61
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
62
|
/// @param {List} $breakpoint-names [map-keys($breakpoints)] - A list of names from the `$breakpoints` map
|
|
63
63
|
/// @return {String}
|
|
@@ -76,7 +76,7 @@ $grid-breakpoints: (
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
/// Get the value of the previous breakpoint, or null for the first breakpoint
|
|
79
|
-
/// @param {String} $name - The name of the
|
|
79
|
+
/// @param {String} $name - The name of the breakpoint
|
|
80
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
81
|
/// @param {List} $breakpoint-names [map-keys($breakpoints)] - A list of names from the `$breakpoints` map
|
|
82
82
|
/// @return {String}
|
|
@@ -95,7 +95,7 @@ $grid-breakpoints: (
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
/// Check to see if the given breakpoint name
|
|
98
|
-
/// @param {String} $name - The name of the
|
|
98
|
+
/// @param {String} $name - The name of the breakpoint
|
|
99
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
100
|
/// @return {Bool}
|
|
101
101
|
/// @access public
|
|
@@ -114,7 +114,7 @@ $grid-breakpoints: (
|
|
|
114
114
|
@return key-by-index($breakpoints, $total-breakpoints);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
/// Get the infix for a given breakpoint in a list of breakpoints.
|
|
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
118
|
/// @param {String} $name - The name of the breakpoint
|
|
119
119
|
/// @return {String}
|
|
120
120
|
/// @access public
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
+
@use 'sass:math';
|
|
9
|
+
|
|
8
10
|
/// Default font size
|
|
9
11
|
/// @type Number
|
|
10
12
|
/// @access public
|
|
@@ -22,7 +24,7 @@ $base-font-size: 16px !default;
|
|
|
22
24
|
@warn "Expected argument $px to be of type `px`, instead received: `#{unit($px)}`";
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
@return ($px
|
|
27
|
+
@return math.div($px, $base-font-size) * 1rem;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
/// Convert a given px unit to a em unit
|
|
@@ -36,5 +38,5 @@ $base-font-size: 16px !default;
|
|
|
36
38
|
@warn "Expected argument $px to be of type `px`, instead received: `#{unit($px)}`";
|
|
37
39
|
}
|
|
38
40
|
|
|
39
|
-
@return ($px
|
|
41
|
+
@return math.div($px, $base-font-size) * 1em;
|
|
40
42
|
}
|