@carbon/layout 10.30.0-rc.0 → 10.32.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 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.30.0-rc.0",
4
+ "version": "10.32.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.28.0-rc.0",
32
+ "@carbon/cli": "^10.29.0",
33
33
  "@carbon/cli-reporter": "^10.5.0",
34
34
  "@carbon/scss-generator": "^10.13.0",
35
- "@carbon/test-utils": "^10.18.0-rc.0",
35
+ "@carbon/test-utils": "^10.19.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": "2eac7d860eb728c8f0a3d3fd1fb0823f7a9623bb"
45
+ "gitHead": "3dd237d343adc0b378d12e933bd99b8beca7b250"
46
46
  }
@@ -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
+ }
@@ -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
+ }
@@ -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';
@@ -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 / $base-font-size) * 1rem;
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 / $base-font-size) * 1em;
41
+ @return math.div($px, $base-font-size) * 1em;
40
42
  }