@energycap/components 0.45.1 → 0.45.2-multi-select-component.20260303-0733
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 +188 -188
- package/fesm2022/energycap-components.mjs +681 -163
- package/fesm2022/energycap-components.mjs.map +1 -1
- package/package.json +1 -1
- package/schematics/collection.json +4 -4
- package/src/assets/images/favicon-ech.svg +14 -14
- package/src/assets/images/favicon-esa.svg +6 -6
- package/src/assets/images/favicon-eum.svg +13 -13
- package/src/assets/images/favicon-whitelabel.svg +4 -4
- package/src/assets/images/favicon.svg +12 -12
- package/src/assets/images/icon-carbonhub.svg +10 -10
- package/src/assets/images/icon-eum.svg +5 -5
- package/src/assets/images/icon-ucp.svg +12 -12
- package/src/assets/images/icon-wattics.svg +5 -5
- package/src/assets/images/icon.svg +11 -11
- package/src/assets/images/logo.svg +10 -10
- package/src/assets/images/splash-electric.svg +3 -3
- package/src/assets/images/splash-interval.svg +3 -3
- package/src/assets/images/splash-seedling.svg +11 -11
- package/src/assets/images/splash-water.svg +3 -3
- package/src/assets/locales/en_US.json +60 -60
- package/src/assets/scripts/unsupported-browser.js +17 -17
- package/src/styles/_base.scss +38 -38
- package/src/styles/_colors.scss +96 -96
- package/src/styles/_core.scss +3 -3
- package/src/styles/_functions.scss +114 -114
- package/src/styles/_global-variables.scss +230 -230
- package/src/styles/_icons.scss +23 -23
- package/src/styles/bootstrap/_grid.scss +33 -33
- package/src/styles/bootstrap/_reboot.scss +322 -322
- package/src/styles/components/_badge.scss +14 -14
- package/src/styles/components/_card.scss +21 -21
- package/src/styles/components/_link-icons.scss +37 -37
- package/src/styles/components/_splash.scss +188 -188
- package/src/styles/components/_tag.scss +18 -18
- package/src/styles/components/_unsupported-browsers.scss +23 -23
- package/src/styles/email/_email-base.scss +227 -227
- package/src/styles/email/email.scss +42 -42
- package/src/styles/index.scss +29 -29
- package/src/styles/mixins/_animations.scss +17 -17
- package/src/styles/mixins/_button-base.scss +206 -206
- package/src/styles/mixins/_card-base.scss +40 -40
- package/src/styles/mixins/_common.scss +51 -51
- package/src/styles/mixins/_dialog-base.scss +95 -95
- package/src/styles/mixins/_form-control-base.scss +662 -662
- package/src/styles/mixins/_login.scss +74 -74
- package/src/styles/mixins/_menu-base.scss +153 -153
- package/src/styles/mixins/_overlay-base.scss +32 -32
- package/src/styles/mixins/_resizable-base.scss +57 -57
- package/src/styles/mixins/_spinner-base.scss +34 -34
- package/src/styles/mixins/_table-base.scss +297 -297
- package/src/styles/mixins/_tabs-base.scss +146 -146
- package/src/styles/mixins/_tags-base.scss +121 -121
- package/src/styles/mixins/_text.scss +89 -89
- package/src/styles/mixins.scss +14 -14
- package/src/styles/utilities/_borders.scss +29 -29
- package/src/styles/utilities/_common.scss +49 -49
- package/src/styles/utilities/_layout.scss +115 -115
- package/src/styles/utilities/_spacing.scss +64 -64
- package/src/styles/utilities/_text.scss +139 -139
- package/types/energycap-components.d.ts +208 -9
package/src/styles/_colors.scss
CHANGED
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
// Variables for the EnergyCAP brand color pallette
|
|
2
|
-
// Colors go from lighter (1) to darker (8).
|
|
3
|
-
$black: rgb(26, 26, 35);
|
|
4
|
-
$white: rgb(255, 255, 255);
|
|
5
|
-
|
|
6
|
-
$gray-1: rgb(218, 228, 233);
|
|
7
|
-
$gray-2: rgb(172, 188, 195);
|
|
8
|
-
$gray-3: rgb(140, 156, 165);
|
|
9
|
-
$gray-4: rgb(117, 132, 143);
|
|
10
|
-
$gray-5: rgb(94, 109, 121);
|
|
11
|
-
$gray-6: rgb(73, 89, 99);
|
|
12
|
-
$gray-7: rgb(53, 71, 81);
|
|
13
|
-
$gray-8: rgb(22, 47, 59);
|
|
14
|
-
|
|
15
|
-
$red-1: rgb(255, 225, 231);
|
|
16
|
-
$red-2: rgb(255, 178, 192);
|
|
17
|
-
$red-3: rgb(255, 138, 159);
|
|
18
|
-
$red-4: rgb(254, 88, 117);
|
|
19
|
-
$red-5: rgb(237, 56, 88);
|
|
20
|
-
$red-6: rgb(219, 11, 48);
|
|
21
|
-
$red-7: rgb(197, 1, 36);
|
|
22
|
-
$red-8: rgb(150, 0, 27);
|
|
23
|
-
|
|
24
|
-
$orange-1: rgb(253, 195, 161);
|
|
25
|
-
$orange-2: rgb(255, 181, 137);
|
|
26
|
-
$orange-3: rgb(255, 147, 83);
|
|
27
|
-
$orange-4: rgb(255, 131, 57);
|
|
28
|
-
$orange-5: rgb(249, 106, 21);
|
|
29
|
-
$orange-6: rgb(235, 91, 6);
|
|
30
|
-
$orange-7: rgb(214, 80, 2);
|
|
31
|
-
$orange-8: rgb(194, 72, 0);
|
|
32
|
-
|
|
33
|
-
$yellow-1: rgb(255, 249, 195);
|
|
34
|
-
$yellow-2: rgb(255, 239, 155);
|
|
35
|
-
$yellow-3: rgb(255, 230, 100);
|
|
36
|
-
$yellow-4: rgb(255, 222, 50);
|
|
37
|
-
$yellow-5: rgb(245, 207, 8);
|
|
38
|
-
$yellow-6: rgb(232, 182, 4);
|
|
39
|
-
$yellow-7: rgb(214, 150, 4);
|
|
40
|
-
$yellow-8: rgb(178, 124, 0);
|
|
41
|
-
|
|
42
|
-
$green-1: rgb(227, 251, 214);
|
|
43
|
-
$green-2: rgb(194, 236, 172);
|
|
44
|
-
$green-3: rgb(153, 216, 120);
|
|
45
|
-
$green-4: rgb(99, 184, 54);
|
|
46
|
-
$green-5: rgb(43, 154, 3);
|
|
47
|
-
$green-6: rgb(39, 134, 4);
|
|
48
|
-
$green-7: rgb(40, 111, 15);
|
|
49
|
-
$green-8: rgb(24, 86, 2);
|
|
50
|
-
|
|
51
|
-
$blue-1: rgb(185, 237, 252);
|
|
52
|
-
$blue-2: rgb(172, 228, 243);
|
|
53
|
-
$blue-3: rgb(118, 206, 230);
|
|
54
|
-
$blue-4: rgb(64, 183, 216);
|
|
55
|
-
$blue-5: rgb(42, 163, 196);
|
|
56
|
-
$blue-6: rgb(36, 143, 172);
|
|
57
|
-
$blue-7: rgb(26, 111, 135);
|
|
58
|
-
$blue-8: rgb(10, 74, 92);
|
|
59
|
-
|
|
60
|
-
$purple-1: rgb(237, 220, 255);
|
|
61
|
-
$purple-2: rgb(215, 180, 253);
|
|
62
|
-
$purple-3: rgb(188, 140, 239);
|
|
63
|
-
$purple-4: rgb(165, 114, 220);
|
|
64
|
-
$purple-5: rgb(147, 85, 214);
|
|
65
|
-
$purple-6: rgb(118, 48, 193);
|
|
66
|
-
$purple-7: rgb(95, 20, 175);
|
|
67
|
-
$purple-8: rgb(75, 7, 147);
|
|
68
|
-
|
|
69
|
-
$cobalt-1: rgb(218, 229, 251);
|
|
70
|
-
$cobalt-2: rgb(153, 185, 251);
|
|
71
|
-
$cobalt-3: rgb(109, 164, 254);
|
|
72
|
-
$cobalt-4: rgb(70, 132, 232);
|
|
73
|
-
$cobalt-5: rgb(66, 117, 216);
|
|
74
|
-
$cobalt-6: rgb(45, 92, 184);
|
|
75
|
-
$cobalt-7: rgb(22, 63, 140);
|
|
76
|
-
$cobalt-8: rgb(6, 47, 125);
|
|
77
|
-
|
|
78
|
-
$aqua-1: rgb(219, 255, 246);
|
|
79
|
-
$aqua-2: rgb(196, 250, 237);
|
|
80
|
-
$aqua-3: rgb(121, 232, 205);
|
|
81
|
-
$aqua-4: rgb(55, 213, 175);
|
|
82
|
-
$aqua-5: rgb(45, 184, 151);
|
|
83
|
-
$aqua-6: rgb(34, 153, 125);
|
|
84
|
-
$aqua-7: rgb(30, 116, 96);
|
|
85
|
-
$aqua-8: rgb(28, 89, 75);
|
|
86
|
-
|
|
87
|
-
$pink-1: rgb(255, 223, 244);
|
|
88
|
-
$pink-2: rgb(255, 194, 235);
|
|
89
|
-
$pink-3: rgb(232, 127, 197);
|
|
90
|
-
$pink-4: rgb(228, 85, 180);
|
|
91
|
-
$pink-5: rgb(207, 61, 158);
|
|
92
|
-
$pink-6: rgb(185, 13, 127);
|
|
93
|
-
$pink-7: rgb(182, 10, 124);
|
|
94
|
-
$pink-8: rgb(151, 3, 101);
|
|
95
|
-
|
|
96
|
-
$ec-color-accrual: rgb(35, 195, 205);
|
|
1
|
+
// Variables for the EnergyCAP brand color pallette
|
|
2
|
+
// Colors go from lighter (1) to darker (8).
|
|
3
|
+
$black: rgb(26, 26, 35);
|
|
4
|
+
$white: rgb(255, 255, 255);
|
|
5
|
+
|
|
6
|
+
$gray-1: rgb(218, 228, 233);
|
|
7
|
+
$gray-2: rgb(172, 188, 195);
|
|
8
|
+
$gray-3: rgb(140, 156, 165);
|
|
9
|
+
$gray-4: rgb(117, 132, 143);
|
|
10
|
+
$gray-5: rgb(94, 109, 121);
|
|
11
|
+
$gray-6: rgb(73, 89, 99);
|
|
12
|
+
$gray-7: rgb(53, 71, 81);
|
|
13
|
+
$gray-8: rgb(22, 47, 59);
|
|
14
|
+
|
|
15
|
+
$red-1: rgb(255, 225, 231);
|
|
16
|
+
$red-2: rgb(255, 178, 192);
|
|
17
|
+
$red-3: rgb(255, 138, 159);
|
|
18
|
+
$red-4: rgb(254, 88, 117);
|
|
19
|
+
$red-5: rgb(237, 56, 88);
|
|
20
|
+
$red-6: rgb(219, 11, 48);
|
|
21
|
+
$red-7: rgb(197, 1, 36);
|
|
22
|
+
$red-8: rgb(150, 0, 27);
|
|
23
|
+
|
|
24
|
+
$orange-1: rgb(253, 195, 161);
|
|
25
|
+
$orange-2: rgb(255, 181, 137);
|
|
26
|
+
$orange-3: rgb(255, 147, 83);
|
|
27
|
+
$orange-4: rgb(255, 131, 57);
|
|
28
|
+
$orange-5: rgb(249, 106, 21);
|
|
29
|
+
$orange-6: rgb(235, 91, 6);
|
|
30
|
+
$orange-7: rgb(214, 80, 2);
|
|
31
|
+
$orange-8: rgb(194, 72, 0);
|
|
32
|
+
|
|
33
|
+
$yellow-1: rgb(255, 249, 195);
|
|
34
|
+
$yellow-2: rgb(255, 239, 155);
|
|
35
|
+
$yellow-3: rgb(255, 230, 100);
|
|
36
|
+
$yellow-4: rgb(255, 222, 50);
|
|
37
|
+
$yellow-5: rgb(245, 207, 8);
|
|
38
|
+
$yellow-6: rgb(232, 182, 4);
|
|
39
|
+
$yellow-7: rgb(214, 150, 4);
|
|
40
|
+
$yellow-8: rgb(178, 124, 0);
|
|
41
|
+
|
|
42
|
+
$green-1: rgb(227, 251, 214);
|
|
43
|
+
$green-2: rgb(194, 236, 172);
|
|
44
|
+
$green-3: rgb(153, 216, 120);
|
|
45
|
+
$green-4: rgb(99, 184, 54);
|
|
46
|
+
$green-5: rgb(43, 154, 3);
|
|
47
|
+
$green-6: rgb(39, 134, 4);
|
|
48
|
+
$green-7: rgb(40, 111, 15);
|
|
49
|
+
$green-8: rgb(24, 86, 2);
|
|
50
|
+
|
|
51
|
+
$blue-1: rgb(185, 237, 252);
|
|
52
|
+
$blue-2: rgb(172, 228, 243);
|
|
53
|
+
$blue-3: rgb(118, 206, 230);
|
|
54
|
+
$blue-4: rgb(64, 183, 216);
|
|
55
|
+
$blue-5: rgb(42, 163, 196);
|
|
56
|
+
$blue-6: rgb(36, 143, 172);
|
|
57
|
+
$blue-7: rgb(26, 111, 135);
|
|
58
|
+
$blue-8: rgb(10, 74, 92);
|
|
59
|
+
|
|
60
|
+
$purple-1: rgb(237, 220, 255);
|
|
61
|
+
$purple-2: rgb(215, 180, 253);
|
|
62
|
+
$purple-3: rgb(188, 140, 239);
|
|
63
|
+
$purple-4: rgb(165, 114, 220);
|
|
64
|
+
$purple-5: rgb(147, 85, 214);
|
|
65
|
+
$purple-6: rgb(118, 48, 193);
|
|
66
|
+
$purple-7: rgb(95, 20, 175);
|
|
67
|
+
$purple-8: rgb(75, 7, 147);
|
|
68
|
+
|
|
69
|
+
$cobalt-1: rgb(218, 229, 251);
|
|
70
|
+
$cobalt-2: rgb(153, 185, 251);
|
|
71
|
+
$cobalt-3: rgb(109, 164, 254);
|
|
72
|
+
$cobalt-4: rgb(70, 132, 232);
|
|
73
|
+
$cobalt-5: rgb(66, 117, 216);
|
|
74
|
+
$cobalt-6: rgb(45, 92, 184);
|
|
75
|
+
$cobalt-7: rgb(22, 63, 140);
|
|
76
|
+
$cobalt-8: rgb(6, 47, 125);
|
|
77
|
+
|
|
78
|
+
$aqua-1: rgb(219, 255, 246);
|
|
79
|
+
$aqua-2: rgb(196, 250, 237);
|
|
80
|
+
$aqua-3: rgb(121, 232, 205);
|
|
81
|
+
$aqua-4: rgb(55, 213, 175);
|
|
82
|
+
$aqua-5: rgb(45, 184, 151);
|
|
83
|
+
$aqua-6: rgb(34, 153, 125);
|
|
84
|
+
$aqua-7: rgb(30, 116, 96);
|
|
85
|
+
$aqua-8: rgb(28, 89, 75);
|
|
86
|
+
|
|
87
|
+
$pink-1: rgb(255, 223, 244);
|
|
88
|
+
$pink-2: rgb(255, 194, 235);
|
|
89
|
+
$pink-3: rgb(232, 127, 197);
|
|
90
|
+
$pink-4: rgb(228, 85, 180);
|
|
91
|
+
$pink-5: rgb(207, 61, 158);
|
|
92
|
+
$pink-6: rgb(185, 13, 127);
|
|
93
|
+
$pink-7: rgb(182, 10, 124);
|
|
94
|
+
$pink-8: rgb(151, 3, 101);
|
|
95
|
+
|
|
96
|
+
$ec-color-accrual: rgb(35, 195, 205);
|
package/src/styles/_core.scss
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import 'functions';
|
|
2
|
-
@import 'colors';
|
|
3
|
-
@import 'mixins/common';
|
|
1
|
+
@import 'functions';
|
|
2
|
+
@import 'colors';
|
|
3
|
+
@import 'mixins/common';
|
|
4
4
|
@import 'icons';
|
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
// Common functions
|
|
2
|
-
|
|
3
|
-
// Returns the measurement of an inner radius by subtracting 1px from the outer-radius given
|
|
4
|
-
@use "sass:math";
|
|
5
|
-
|
|
6
|
-
@function inner-radius($outer-radius) {
|
|
7
|
-
@return calc(#{$outer-radius} - 1px);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/// Replace every instance of $search in a giving $string with the value of $replace
|
|
11
|
-
/// @param {string} $string
|
|
12
|
-
@function str-replace($string, $search, $replace: "") {
|
|
13
|
-
$index: str-index($string, $search);
|
|
14
|
-
|
|
15
|
-
@if $index {
|
|
16
|
-
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@return $string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/// Removes the unit (e.g. px, em, rem) from a value, returning the number only.
|
|
23
|
-
/// @param {Number} $num - Number to strip unit from.
|
|
24
|
-
/// @returns {Number} The same number, sans unit.
|
|
25
|
-
/// @source https://github.com/zurb/foundation-apps/blob/master/scss/helpers/_functions.scss
|
|
26
|
-
@function strip-unit($num) {
|
|
27
|
-
@return math.div($num, $num * 0 + 1);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/// Converts one or more pixel values into matching rem values.
|
|
31
|
-
/// @param {Number|List} $values - One or more values to convert. Be sure to separate them with spaces and not commas. If you need to convert a comma-separated list, wrap the list in parentheses.
|
|
32
|
-
/// @param {Number} $base [null] - The base value to use when calculating the `rem`. If you're using Foundation out of the box, this is 16px. If this parameter is `null`, the function will reference the `$base-font-size` variable as the base.
|
|
33
|
-
///
|
|
34
|
-
/// @returns {List} A list of converted values.
|
|
35
|
-
/// @source https://github.com/zurb/foundation-apps/blob/master/scss/helpers/_functions.scss
|
|
36
|
-
@function rem-calc($values, $base: null) {
|
|
37
|
-
$rem-values: ();
|
|
38
|
-
$count: length($values);
|
|
39
|
-
|
|
40
|
-
// If no base is defined, defer to the global font size
|
|
41
|
-
@if $base == null {
|
|
42
|
-
$base: 100%;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// If the base font size is a %, then multiply it by 16px
|
|
46
|
-
// This is because 100% font size = 16px in most all browsers
|
|
47
|
-
@if unit($base) == '%' {
|
|
48
|
-
$base: math.div($base, 100%) * 16px;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Using rem as base allows correct scaling
|
|
52
|
-
@if unit($base) == 'rem' {
|
|
53
|
-
$base: strip-unit($base) * 16px;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
@if $count == 1 {
|
|
57
|
-
@return px-to-rem($values, $base);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@for $i from 1 through $count {
|
|
61
|
-
$rem-values: append($rem-values, px-to-rem(nth($values, $i), $base));
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
@return $rem-values;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/// Helper function used by rem-calc. Converts a pixel value to matching rem value. *Any* value passed, regardless of unit,
|
|
68
|
-
/// is assumed to be a pixel value. By default, the base pixel value used to calculate the rem value is 100% or 16px,
|
|
69
|
-
/// which is the default for most all browsers.
|
|
70
|
-
/// @access private
|
|
71
|
-
/// @param {Number} $value - Pixel number to convert without units.
|
|
72
|
-
/// @param {Number} $base [null] - Base for pixel conversion.
|
|
73
|
-
/// @returns {Number} A number in rems, calculated based on the given value and the base pixel value. rem values are passed through as is.
|
|
74
|
-
@function px-to-rem($value, $base: null) {
|
|
75
|
-
// Check if the value is a number
|
|
76
|
-
@if type-of($value) != 'number' {
|
|
77
|
-
@warn inspect($value) + ' was passed to rem-calc(), which is not a number.';
|
|
78
|
-
@return $value;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Transform em into rem if someone hands over 'em's
|
|
82
|
-
@if unit($value) == 'em' {
|
|
83
|
-
$value: strip-unit($value) * 1rem;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Calculate rem if units for $value is not rem or em
|
|
87
|
-
@if unit($value) != 'rem' {
|
|
88
|
-
$value: math.div(strip-unit($value), strip-unit($base)) * 1rem;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Turn 0rem into 0
|
|
92
|
-
@if $value == 0rem {
|
|
93
|
-
$value: 0;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
@return $value;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
@function em-to-rem($value, $rem-base: 1rem) {
|
|
100
|
-
$value: strip-unit($value) * $rem-base;
|
|
101
|
-
@return $value;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
@function rem-to-em($value, $rem-base: 1rem) {
|
|
105
|
-
$value: strip-unit(math.div($value, $rem-base)) * 1em;
|
|
106
|
-
@return $value;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
@function get-icon-unicode($icons, $iconName) {
|
|
110
|
-
$icon: map-get($icons, $iconName);
|
|
111
|
-
$content: map-get($icon, 'content');
|
|
112
|
-
$code: map-get($content, 'unicode');
|
|
113
|
-
@return $code;
|
|
114
|
-
}
|
|
1
|
+
// Common functions
|
|
2
|
+
|
|
3
|
+
// Returns the measurement of an inner radius by subtracting 1px from the outer-radius given
|
|
4
|
+
@use "sass:math";
|
|
5
|
+
|
|
6
|
+
@function inner-radius($outer-radius) {
|
|
7
|
+
@return calc(#{$outer-radius} - 1px);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/// Replace every instance of $search in a giving $string with the value of $replace
|
|
11
|
+
/// @param {string} $string
|
|
12
|
+
@function str-replace($string, $search, $replace: "") {
|
|
13
|
+
$index: str-index($string, $search);
|
|
14
|
+
|
|
15
|
+
@if $index {
|
|
16
|
+
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@return $string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/// Removes the unit (e.g. px, em, rem) from a value, returning the number only.
|
|
23
|
+
/// @param {Number} $num - Number to strip unit from.
|
|
24
|
+
/// @returns {Number} The same number, sans unit.
|
|
25
|
+
/// @source https://github.com/zurb/foundation-apps/blob/master/scss/helpers/_functions.scss
|
|
26
|
+
@function strip-unit($num) {
|
|
27
|
+
@return math.div($num, $num * 0 + 1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/// Converts one or more pixel values into matching rem values.
|
|
31
|
+
/// @param {Number|List} $values - One or more values to convert. Be sure to separate them with spaces and not commas. If you need to convert a comma-separated list, wrap the list in parentheses.
|
|
32
|
+
/// @param {Number} $base [null] - The base value to use when calculating the `rem`. If you're using Foundation out of the box, this is 16px. If this parameter is `null`, the function will reference the `$base-font-size` variable as the base.
|
|
33
|
+
///
|
|
34
|
+
/// @returns {List} A list of converted values.
|
|
35
|
+
/// @source https://github.com/zurb/foundation-apps/blob/master/scss/helpers/_functions.scss
|
|
36
|
+
@function rem-calc($values, $base: null) {
|
|
37
|
+
$rem-values: ();
|
|
38
|
+
$count: length($values);
|
|
39
|
+
|
|
40
|
+
// If no base is defined, defer to the global font size
|
|
41
|
+
@if $base == null {
|
|
42
|
+
$base: 100%;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// If the base font size is a %, then multiply it by 16px
|
|
46
|
+
// This is because 100% font size = 16px in most all browsers
|
|
47
|
+
@if unit($base) == '%' {
|
|
48
|
+
$base: math.div($base, 100%) * 16px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Using rem as base allows correct scaling
|
|
52
|
+
@if unit($base) == 'rem' {
|
|
53
|
+
$base: strip-unit($base) * 16px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@if $count == 1 {
|
|
57
|
+
@return px-to-rem($values, $base);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@for $i from 1 through $count {
|
|
61
|
+
$rem-values: append($rem-values, px-to-rem(nth($values, $i), $base));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@return $rem-values;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/// Helper function used by rem-calc. Converts a pixel value to matching rem value. *Any* value passed, regardless of unit,
|
|
68
|
+
/// is assumed to be a pixel value. By default, the base pixel value used to calculate the rem value is 100% or 16px,
|
|
69
|
+
/// which is the default for most all browsers.
|
|
70
|
+
/// @access private
|
|
71
|
+
/// @param {Number} $value - Pixel number to convert without units.
|
|
72
|
+
/// @param {Number} $base [null] - Base for pixel conversion.
|
|
73
|
+
/// @returns {Number} A number in rems, calculated based on the given value and the base pixel value. rem values are passed through as is.
|
|
74
|
+
@function px-to-rem($value, $base: null) {
|
|
75
|
+
// Check if the value is a number
|
|
76
|
+
@if type-of($value) != 'number' {
|
|
77
|
+
@warn inspect($value) + ' was passed to rem-calc(), which is not a number.';
|
|
78
|
+
@return $value;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Transform em into rem if someone hands over 'em's
|
|
82
|
+
@if unit($value) == 'em' {
|
|
83
|
+
$value: strip-unit($value) * 1rem;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Calculate rem if units for $value is not rem or em
|
|
87
|
+
@if unit($value) != 'rem' {
|
|
88
|
+
$value: math.div(strip-unit($value), strip-unit($base)) * 1rem;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Turn 0rem into 0
|
|
92
|
+
@if $value == 0rem {
|
|
93
|
+
$value: 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@return $value;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@function em-to-rem($value, $rem-base: 1rem) {
|
|
100
|
+
$value: strip-unit($value) * $rem-base;
|
|
101
|
+
@return $value;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@function rem-to-em($value, $rem-base: 1rem) {
|
|
105
|
+
$value: strip-unit(math.div($value, $rem-base)) * 1em;
|
|
106
|
+
@return $value;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@function get-icon-unicode($icons, $iconName) {
|
|
110
|
+
$icon: map-get($icons, $iconName);
|
|
111
|
+
$content: map-get($icon, 'content');
|
|
112
|
+
$code: map-get($content, 'unicode');
|
|
113
|
+
@return $code;
|
|
114
|
+
}
|