igniteui-theming 1.0.0-beta.5 → 1.0.0-beta.8
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 +1 -1
- package/sass/color/_functions.scss +47 -45
- package/sass/color/_mixins.scss +8 -8
- package/sass/color/_types.scss +27 -9
- package/sass/color/presets/dark/_material.scss +4 -0
- package/sass/color/presets/light/_material.scss +4 -0
- package/sass/elevations/_functions.scss +2 -1
- package/sass/elevations/_mixins.scss +8 -8
- package/sass/elevations/presets/_material.scss +8 -7
- package/sass/themes/_functions.scss +20 -2
- package/sass/themes/_mixins.scss +17 -1
- package/sass/typography/_functions.scss +5 -3
- package/sass/typography/_mixins.scss +11 -9
- package/sass/typography/_types.scss +12 -0
- package/sass/typography/presets/_bootstrap.scss +11 -0
- package/sass/typography/presets/_fluent.scss +13 -0
- package/sass/typography/presets/_indigo.scss +13 -3
- package/sass/typography/presets/_material.scss +16 -16
- package/sass/utils/_map.scss +1 -1
- package/sass/utils/_math.scss +5 -0
- package/sass/utils/_meta.scss +1 -1
- package/test/_typography.spec.scss +17 -0
- package/test/e2e/theme.scss +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "igniteui-theming",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.8",
|
|
4
4
|
"description": "A set of Sass variables, mixins, and functions for generating palettes, typography, and elevations used by Ignite UI components.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,7 +13,7 @@ $_enhanced-accessibility: false;
|
|
|
13
13
|
|
|
14
14
|
/// Configures the color module.
|
|
15
15
|
/// @access public
|
|
16
|
-
/// @param {Boolean} $enhanced-accessibility - Enables features like color blind palettes.
|
|
16
|
+
/// @param {Boolean} $enhanced-accessibility [null] - Enables features like color blind palettes.
|
|
17
17
|
@mixin configure($enhanced-accessibility: null) {
|
|
18
18
|
@if $enhanced-accessibility {
|
|
19
19
|
$_enhanced-accessibility: $enhanced-accessibility !global;
|
|
@@ -23,7 +23,6 @@ $_enhanced-accessibility: false;
|
|
|
23
23
|
/// Generates a color palette.
|
|
24
24
|
/// @access public
|
|
25
25
|
/// @group Palettes
|
|
26
|
-
/// @requires {function} _color-palette
|
|
27
26
|
/// @param {Color} $primary - The primary color used to generate the primary color palette (required).
|
|
28
27
|
/// @param {Color} $secondary - The secondary color used to generate the secondary color palette (required).
|
|
29
28
|
/// @param {Color} $surface - The color used as a background in components, such as cards, sheets, and menus (required).
|
|
@@ -33,7 +32,8 @@ $_enhanced-accessibility: false;
|
|
|
33
32
|
/// @param {Color} $warn [null] - The warning color used throughout the application (optional).
|
|
34
33
|
/// @param {Color} $error [null] - The error color used throughout the application (optional).
|
|
35
34
|
/// @param {String} $variant [null] - Used internally (optional).
|
|
36
|
-
/// @
|
|
35
|
+
/// @requires {function} shades
|
|
36
|
+
/// @returns {Map} - A map consisting of color shades for the passed base colors (primary, secondary, gray, etc).
|
|
37
37
|
@function palette(
|
|
38
38
|
$primary,
|
|
39
39
|
$secondary,
|
|
@@ -47,26 +47,26 @@ $_enhanced-accessibility: false;
|
|
|
47
47
|
) {
|
|
48
48
|
$color-shades: map.keys(types.$IColorShades);
|
|
49
49
|
$gray-shades: map.keys(types.$IGrayShades);
|
|
50
|
-
$primary-palette: shades(primary, $primary, $color-shades);
|
|
51
|
-
$secondary-palette: shades(secondary, $secondary, $color-shades);
|
|
52
|
-
$surface-palette: shades(surface, $surface, $color-shades);
|
|
53
|
-
$grayscale-palette: shades(gray, $gray, $gray-shades, $surface);
|
|
54
|
-
$info-palette: if($info, shades(info, $info, $color-shades), ());
|
|
55
|
-
$success-palette: if($success, shades(success, $success, $color-shades), ());
|
|
56
|
-
$warn-palette: if($warn, shades(warn, $warn, $color-shades), ());
|
|
57
|
-
$error-palette: if($success, shades(error, $error, $color-shades), ());
|
|
50
|
+
$primary-palette: shades('primary', $primary, $color-shades);
|
|
51
|
+
$secondary-palette: shades('secondary', $secondary, $color-shades);
|
|
52
|
+
$surface-palette: shades('surface', $surface, $color-shades);
|
|
53
|
+
$grayscale-palette: shades('gray', $gray, $gray-shades, $surface);
|
|
54
|
+
$info-palette: if($info, shades('info', $info, $color-shades), ());
|
|
55
|
+
$success-palette: if($success, shades('success', $success, $color-shades), ());
|
|
56
|
+
$warn-palette: if($warn, shades('warn', $warn, $color-shades), ());
|
|
57
|
+
$error-palette: if($success, shades('error', $error, $color-shades), ());
|
|
58
58
|
|
|
59
59
|
@return (
|
|
60
|
-
primary: $primary-palette,
|
|
61
|
-
secondary: $secondary-palette,
|
|
62
|
-
gray: $grayscale-palette,
|
|
63
|
-
surface: $surface-palette,
|
|
64
|
-
info: $info-palette,
|
|
65
|
-
success: $success-palette,
|
|
66
|
-
warn: $warn-palette,
|
|
67
|
-
error: $error-palette,
|
|
68
|
-
_meta: (
|
|
69
|
-
variant: $variant,
|
|
60
|
+
'primary': $primary-palette,
|
|
61
|
+
'secondary': $secondary-palette,
|
|
62
|
+
'gray': $grayscale-palette,
|
|
63
|
+
'surface': $surface-palette,
|
|
64
|
+
'info': $info-palette,
|
|
65
|
+
'success': $success-palette,
|
|
66
|
+
'warn': $warn-palette,
|
|
67
|
+
'error': $error-palette,
|
|
68
|
+
'_meta': (
|
|
69
|
+
'variant': $variant,
|
|
70
70
|
)
|
|
71
71
|
);
|
|
72
72
|
}
|
|
@@ -78,10 +78,8 @@ $_enhanced-accessibility: false;
|
|
|
78
78
|
/// @param {Color} $color - The base color used to generate the palette.
|
|
79
79
|
/// @param {List} $shades - The list of shades.
|
|
80
80
|
/// @param {Color} $surface [null] - The surface color. Usefull when generating shades of gray (optional).
|
|
81
|
-
/// @requires {function}
|
|
82
|
-
/// @requires {function}
|
|
83
|
-
/// @requires {function} contrast
|
|
84
|
-
/// @requires {function} to-opaque
|
|
81
|
+
/// @requires {function} shade
|
|
82
|
+
/// @requires {function} text-contrast
|
|
85
83
|
/// @returns {Map} - A map consisting of hsla color shades and thier respective contrast colors.
|
|
86
84
|
@function shades(
|
|
87
85
|
$name,
|
|
@@ -113,6 +111,8 @@ $_enhanced-accessibility: false;
|
|
|
113
111
|
/// @param {Color} $color - The color value to be used to generate a color shade.
|
|
114
112
|
/// @param {String | Number} $shade - The color shade variant.
|
|
115
113
|
/// @param {Color} $surface [null] - The surface color. Usefull when generating a shade of gray (optional).
|
|
114
|
+
/// @require {function} luminance
|
|
115
|
+
/// @require {function} to-fixed
|
|
116
116
|
/// @returns {Map} - A map containing a list of HSL values and a raw color value.
|
|
117
117
|
@function shade(
|
|
118
118
|
$name,
|
|
@@ -124,7 +124,7 @@ $_enhanced-accessibility: false;
|
|
|
124
124
|
$s: var(--ig-#{$name}-s);
|
|
125
125
|
$l: var(--ig-#{$name}-l);
|
|
126
126
|
|
|
127
|
-
@if $name == gray {
|
|
127
|
+
@if #{$name} == 'gray' {
|
|
128
128
|
$lum: luminance($surface);
|
|
129
129
|
$color: if($color, $color, if($lum > .5, #000, #fff));
|
|
130
130
|
$lmap: map.get(multipliers.$grayscale, 'l');
|
|
@@ -158,13 +158,13 @@ $_enhanced-accessibility: false;
|
|
|
158
158
|
/// Retrieves a color from a color palette.
|
|
159
159
|
/// @access public
|
|
160
160
|
/// @group Palettes
|
|
161
|
-
/// @param {Map} $palette [null]- The source palette map (optional).
|
|
162
|
-
/// @param {String} $color [primary]- The target color from the color palette.
|
|
161
|
+
/// @param {Map} $palette [null] - The source palette map (optional).
|
|
162
|
+
/// @param {String} $color [primary] - The target color from the color palette.
|
|
163
163
|
/// @param {Number | String} $variant [500] - The target color shade from the color palette.
|
|
164
164
|
/// @param {Number} $opacity [null] - Optional opacity to apply to the color shade.
|
|
165
165
|
/// @returns {Color | String} - The raw color shade or CSS variable reference from the palette.
|
|
166
|
-
@function color($palette: null, $color: primary, $variant: 500, $opacity: null) {
|
|
167
|
-
$c: map.get($palette or types.$IPalette, $color);
|
|
166
|
+
@function color($palette: null, $color: 'primary', $variant: 500, $opacity: null) {
|
|
167
|
+
$c: map.get($palette or types.$IPalette, #{$color});
|
|
168
168
|
$a: var(--ig-#{$color}-a);
|
|
169
169
|
$s: #{var(--ig-#{$color}-#{$variant})};
|
|
170
170
|
$contrast: if(
|
|
@@ -191,11 +191,11 @@ $_enhanced-accessibility: false;
|
|
|
191
191
|
|
|
192
192
|
/// Retrieves a contrast text color for a given color from a color palette.
|
|
193
193
|
/// @access public
|
|
194
|
-
/// @group
|
|
195
|
-
/// @param {Map} $palette [null]- The source palette map (optional).
|
|
196
|
-
/// @param {String} $color [primary]- The target color from the color palette.
|
|
194
|
+
/// @group Palettes
|
|
195
|
+
/// @param {Map} $palette [null] - The source palette map (optional).
|
|
196
|
+
/// @param {String} $color [primary] - The target color from the color palette.
|
|
197
197
|
/// @param {Number | String} $variant [500] - The target color shade from the color palette.
|
|
198
|
-
/// @requires color
|
|
198
|
+
/// @requires {function} color
|
|
199
199
|
/// @returns {Color | String} - The raw contrast color shade or CSS variable from the palette.
|
|
200
200
|
@function contrast-color($palette: null, $color: primary, $variant: 500) {
|
|
201
201
|
@return color($palette, $color, #{$variant}-contrast);
|
|
@@ -208,6 +208,7 @@ $_enhanced-accessibility: false;
|
|
|
208
208
|
/// @param {Color | List<Color>} $foreground [#fff] - A list of foreground colors
|
|
209
209
|
/// that can be used with the provided background.
|
|
210
210
|
/// @param {AAA | AA | A} $contrast [AAA] - The contrast level according to WCAG 2.0 standards.
|
|
211
|
+
/// @require {function} contrast
|
|
211
212
|
/// @returns {Color} - Returns either white, black, or the provided foreground
|
|
212
213
|
/// color if it meets the required contrast level.
|
|
213
214
|
/// @link https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html
|
|
@@ -261,6 +262,7 @@ $_enhanced-accessibility: false;
|
|
|
261
262
|
|
|
262
263
|
/// Mixes two colors to produce an opaque color.
|
|
263
264
|
/// @access public
|
|
265
|
+
/// @group Color
|
|
264
266
|
/// @param {Color} $color-1 - The first color, usually transparent.
|
|
265
267
|
/// @param {Color} $color-2 [#fff] - The second color, usually opaque.
|
|
266
268
|
/// @return {Color} - The color representation of the rgba value.
|
|
@@ -282,6 +284,7 @@ $_enhanced-accessibility: false;
|
|
|
282
284
|
|
|
283
285
|
/// Retruns a comma separated list of hue, saturation, and lightness values for a given color.
|
|
284
286
|
/// @access public
|
|
287
|
+
/// @group Color
|
|
285
288
|
/// @param {Color} $color - The color to be converted to an HSL list of values.
|
|
286
289
|
/// @example scss Turn #000 into an HSL list of values
|
|
287
290
|
/// $hsl-list: to-hsl(#000); // (0deg, 0%, 0%);
|
|
@@ -292,9 +295,12 @@ $_enhanced-accessibility: false;
|
|
|
292
295
|
|
|
293
296
|
/// Calculates the contrast ratio between two colors.
|
|
294
297
|
/// See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
|
|
295
|
-
///
|
|
298
|
+
/// @access public
|
|
299
|
+
/// @group Color
|
|
296
300
|
/// @param {Color} $background - The background color.
|
|
297
301
|
/// @param {Color} $foreground - The foreground color.
|
|
302
|
+
/// @require {function} luminance
|
|
303
|
+
/// @require {function} to-fixed
|
|
298
304
|
/// @returns {Number} - The contrast ratio between the background and foreground colors.
|
|
299
305
|
@function contrast($background, $foreground) {
|
|
300
306
|
$backLum: luminance($background) + .05;
|
|
@@ -305,8 +311,10 @@ $_enhanced-accessibility: false;
|
|
|
305
311
|
|
|
306
312
|
/// Calculates the luminance for a given color.
|
|
307
313
|
/// See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests.
|
|
308
|
-
///
|
|
314
|
+
/// @access public
|
|
315
|
+
/// @group Color
|
|
309
316
|
/// @param {Color} $color - The color to calculate luminance for.
|
|
317
|
+
/// @returns {Number | String} - The calculated luminance of a given color
|
|
310
318
|
@function luminance($color) {
|
|
311
319
|
@if meta.type-of($color) == 'color' {
|
|
312
320
|
$r: math.div(color.red($color), 255);
|
|
@@ -321,6 +329,9 @@ $_enhanced-accessibility: false;
|
|
|
321
329
|
|
|
322
330
|
/// Calculates the linear channel value for a given sRGB color.
|
|
323
331
|
/// @access private
|
|
332
|
+
/// @group Color
|
|
333
|
+
/// @param {Number} $value - The sRGB color
|
|
334
|
+
/// @returns {Number} - The calculated linear channel value
|
|
324
335
|
@function _lcv($value) {
|
|
325
336
|
/* stylelint-disable number-max-precision */
|
|
326
337
|
@return if(
|
|
@@ -337,12 +348,3 @@ $_enhanced-accessibility: false;
|
|
|
337
348
|
@function chart-brushes() {
|
|
338
349
|
@return if($_enhanced-accessibility, charts.$brushes-color-blind, charts.$brushes-regular);
|
|
339
350
|
}
|
|
340
|
-
|
|
341
|
-
/// Returns a list of H, S, L values for a given color.
|
|
342
|
-
/// @access public
|
|
343
|
-
/// @param {Color} $color - The color to generate HSL values for.
|
|
344
|
-
/// @group Palettes
|
|
345
|
-
/// @returns { List } - The list of values.
|
|
346
|
-
@function to-hsl($color) {
|
|
347
|
-
@return (color.hue($color), color.saturation($color), color.lightness($color));
|
|
348
|
-
}
|
package/sass/color/_mixins.scss
CHANGED
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
/// Generates CSS variables for a given palette.
|
|
9
9
|
/// @access public
|
|
10
10
|
/// @group Palettes
|
|
11
|
-
/// @param {Map} $palette
|
|
11
|
+
/// @param {Map} $palette - The palette used to generate CSS variables.
|
|
12
12
|
/// @param {Boolean} $contrast [true] - Specify if contrast colors should be included.
|
|
13
13
|
/// @example scss Generate css variables for a palette
|
|
14
14
|
/// $palette: palette($primary: red, $secondary: blue, $gray: #000);
|
|
15
15
|
/// @include palette($palette);
|
|
16
|
-
///
|
|
16
|
+
/// @require {function} is-root
|
|
17
17
|
@mixin palette($palette, $contrast: true) {
|
|
18
18
|
$scope: if(is-root(), ':root', '&');
|
|
19
19
|
|
|
@@ -27,20 +27,20 @@
|
|
|
27
27
|
$_contrast: if($_other-shade, string.index($shade, 'contrast'), false);
|
|
28
28
|
|
|
29
29
|
@if $_base-shade and $_valid-color {
|
|
30
|
-
--ig-#{
|
|
31
|
-
--ig-#{
|
|
32
|
-
--ig-#{
|
|
33
|
-
--ig-#{
|
|
30
|
+
--ig-#{$color}-h: #{math.round(color.hue($value))};
|
|
31
|
+
--ig-#{$color}-s: #{math.round(color.saturation($value))};
|
|
32
|
+
--ig-#{$color}-l: #{math.round(color.lightness($value))};
|
|
33
|
+
--ig-#{$color}-a: #{color.alpha($value)};
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
@if $_hsl {
|
|
37
37
|
$variant: string.slice($shade, 1, string.index($shade, '-hsl') - 1);
|
|
38
38
|
|
|
39
|
-
--ig-#{
|
|
39
|
+
--ig-#{$color}-#{$variant}: #{$value};
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
@if $_contrast and $contrast {
|
|
43
|
-
--ig-#{
|
|
43
|
+
--ig-#{$color}-#{$shade}: #{$value};
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
package/sass/color/_types.scss
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
@use 'sass:map';
|
|
2
2
|
|
|
3
|
+
////
|
|
4
|
+
/// @group Palettes
|
|
5
|
+
////
|
|
6
|
+
|
|
7
|
+
/// A list consisting of all generated gray shades
|
|
8
|
+
/// @type Map
|
|
3
9
|
$IGrayShades: (
|
|
4
10
|
50: '',
|
|
5
11
|
100: '',
|
|
@@ -12,6 +18,9 @@ $IGrayShades: (
|
|
|
12
18
|
800: '',
|
|
13
19
|
900: '',
|
|
14
20
|
);
|
|
21
|
+
|
|
22
|
+
/// A list consisting of all generated shades for palette colors
|
|
23
|
+
/// @type Map
|
|
15
24
|
$IColorShades: map.merge(
|
|
16
25
|
$IGrayShades,
|
|
17
26
|
(
|
|
@@ -21,17 +30,26 @@ $IColorShades: map.merge(
|
|
|
21
30
|
'A700': '',
|
|
22
31
|
)
|
|
23
32
|
);
|
|
33
|
+
|
|
34
|
+
/// All palette colors mapped with corresponding color shades
|
|
35
|
+
/// @type Map
|
|
24
36
|
$IPaletteColors: (
|
|
25
|
-
primary: $IColorShades,
|
|
26
|
-
secondary: $IColorShades,
|
|
27
|
-
gray: $IGrayShades,
|
|
28
|
-
surface: $IColorShades,
|
|
29
|
-
info: $IColorShades,
|
|
30
|
-
success: $IColorShades,
|
|
31
|
-
warn: $IColorShades,
|
|
32
|
-
error: $IColorShades,
|
|
37
|
+
'primary': $IColorShades,
|
|
38
|
+
'secondary': $IColorShades,
|
|
39
|
+
'gray': $IGrayShades,
|
|
40
|
+
'surface': $IColorShades,
|
|
41
|
+
'info': $IColorShades,
|
|
42
|
+
'success': $IColorShades,
|
|
43
|
+
'warn': $IColorShades,
|
|
44
|
+
'error': $IColorShades,
|
|
33
45
|
);
|
|
46
|
+
|
|
47
|
+
/// A list consisting of palette metadata
|
|
48
|
+
/// @type Map
|
|
34
49
|
$IPaletteMeta: (
|
|
35
|
-
variant: '',
|
|
50
|
+
'variant': '',
|
|
36
51
|
);
|
|
52
|
+
|
|
53
|
+
/// A map with all palette colors and palette meta
|
|
54
|
+
/// @type Map
|
|
37
55
|
$IPalette: map.merge($IPaletteColors, (_meta: $IPaletteMeta));
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
@use 'sass:list';
|
|
4
4
|
|
|
5
5
|
////
|
|
6
|
-
/// @group
|
|
6
|
+
/// @group Elevations
|
|
7
7
|
////
|
|
8
8
|
|
|
9
9
|
$factor: var(--ig-elevation-factor, 1);
|
|
@@ -82,6 +82,7 @@ $factor: var(--ig-elevation-factor, 1);
|
|
|
82
82
|
/// Gets a CSS elevation variable by name.
|
|
83
83
|
/// @access public
|
|
84
84
|
/// @param {String} $name - The name of the shadow.
|
|
85
|
+
/// @return {String} - The CSS elevation variable
|
|
85
86
|
@function elevation($name) {
|
|
86
87
|
@return var(--ig-elevation-#{$name});
|
|
87
88
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@use '../utils/meta' as *;
|
|
2
2
|
|
|
3
3
|
////
|
|
4
|
-
/// @group
|
|
4
|
+
/// @group Elevations
|
|
5
5
|
////
|
|
6
6
|
|
|
7
7
|
/// Generates CSS variables for a given elevations map.
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
/// @param {Map} $elevations - The elevations map to use to generate CSS variables.
|
|
10
10
|
///
|
|
11
11
|
/// @example scss Generate CSS variables for elevations.
|
|
12
|
-
///
|
|
13
|
-
///
|
|
14
|
-
///
|
|
15
|
-
///
|
|
16
|
-
///
|
|
17
|
-
///
|
|
18
|
-
///
|
|
12
|
+
/// $elevations: (
|
|
13
|
+
/// small: box-shadow(0 .125rem .25rem rgba(0 0 0 / 75%)),
|
|
14
|
+
/// medium: box-shadow(0 .25rem .5rem rgba(0 0 0 / 85%)),
|
|
15
|
+
/// large: box-shadow(0 .75rem 1rem rgba(0 0 0 / 95%))
|
|
16
|
+
/// );
|
|
17
|
+
/// @include elevations($elevations);
|
|
18
|
+
/// @require {function} is-root
|
|
19
19
|
@mixin elevations($elevations) {
|
|
20
20
|
$scope: if(is-root(), ':root', '&');
|
|
21
21
|
|
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
/// @author <a href="https://github.com/simeonoff" target="_blank">Simeon Simeonoff</a>
|
|
6
6
|
////
|
|
7
7
|
|
|
8
|
-
/// Level 1 -
|
|
9
|
-
/// @type
|
|
8
|
+
/// Level 1 - The color used to generate umbra shadows.
|
|
9
|
+
/// @type Color
|
|
10
10
|
$_color-1: rgba(0 0 0 / 26%);
|
|
11
11
|
|
|
12
|
-
/// Level 2 -
|
|
13
|
-
/// @type
|
|
12
|
+
/// Level 2 - The color used to generate penumbra shadows.
|
|
13
|
+
/// @type Color
|
|
14
14
|
$_color-2: rgba(0 0 0 / 12%);
|
|
15
15
|
|
|
16
|
-
/// Level 3 -
|
|
17
|
-
/// @type
|
|
16
|
+
/// Level 3 - The color used to generate ambient shadows.
|
|
17
|
+
/// @type Color
|
|
18
18
|
$_color-3: rgba(0 0 0 / 8%);
|
|
19
19
|
|
|
20
20
|
/// Allows user configration of this module.
|
|
@@ -32,7 +32,8 @@ $_color-3: rgba(0 0 0 / 8%);
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
///
|
|
35
|
+
/// А map of 24 shadow elevations with the umbra, penumbra and ambient shadows.
|
|
36
|
+
/// @type Map
|
|
36
37
|
$elevations: (
|
|
37
38
|
0: none,
|
|
38
39
|
1: box-shadow((0 1px 3px 0 $_color-1, 0 1px 1px 0 $_color-2, 0 2px 1px -1px $_color-3)),
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
/// @access private
|
|
10
10
|
/// @param {Map} $schema - A theme schema.
|
|
11
11
|
/// @requires {function} resolve-value
|
|
12
|
+
/// @requires {function} elevation
|
|
13
|
+
/// @requires {function} chart-brushes
|
|
12
14
|
/// @example scss Get the resolved theme for a schema
|
|
13
15
|
/// $custom-schema: (
|
|
14
16
|
/// foreground: (
|
|
@@ -82,8 +84,9 @@
|
|
|
82
84
|
|
|
83
85
|
/// Retrieves the CSS custom property reference for the given key in the component theme.
|
|
84
86
|
/// @access public
|
|
85
|
-
/// @param {
|
|
86
|
-
/// @param {
|
|
87
|
+
/// @param {Map} $theme - The source theme to be used to read values from.
|
|
88
|
+
/// @param {String} $property - A key from the theme map to assign as value to the property.
|
|
89
|
+
/// @param {String} $fallback [null] - A value to be used if the CSS property is not defined.
|
|
87
90
|
/// @example scss Assign the color property in a set of rules to a value from the theme.
|
|
88
91
|
/// [part='icon'] {
|
|
89
92
|
/// color: var-get($theme, 'icon-color', inherit); // var(--icon-color, inherit)
|
|
@@ -104,6 +107,21 @@
|
|
|
104
107
|
/// @param {Number} $radius - The preferred value.
|
|
105
108
|
/// @param {Number} $min [rem(0)] - The minimum value.
|
|
106
109
|
/// @param {Number} $max [$radius] - The maximum allowed value.
|
|
110
|
+
/// @return {Number} - The clamped value
|
|
107
111
|
@function border-radius($radius, $min: #{rem(0)}, $max: $radius) {
|
|
108
112
|
@return clamp(#{$min}, #{calc(var(--ig-radius-factor) * #{$radius})}, #{$max});
|
|
109
113
|
}
|
|
114
|
+
|
|
115
|
+
/// Used to switch between values based on the size of the component.
|
|
116
|
+
/// @access public
|
|
117
|
+
/// @param {Number} $sm - The preferred value when the component's size is small.
|
|
118
|
+
/// @param {Number} $md [$sm] - The preferred value when the component's size is medium.
|
|
119
|
+
/// @param {Number} $lg [$md] - The preferred value when the component's size is large.
|
|
120
|
+
/// @return {Function} - The evaluated value.
|
|
121
|
+
@function sizable($sm, $md: $sm, $lg: $md) {
|
|
122
|
+
@return max(
|
|
123
|
+
calc(var(--is-large, 1) * #{$lg}),
|
|
124
|
+
calc(var(--is-medium, 1) * #{$md}),
|
|
125
|
+
calc(var(--is-small, 1) * #{$sm})
|
|
126
|
+
);
|
|
127
|
+
}
|
package/sass/themes/_mixins.scss
CHANGED
|
@@ -10,12 +10,15 @@ $ignored-keys: ('name', 'palette', 'variant', 'selector');
|
|
|
10
10
|
|
|
11
11
|
/// Parses a map of key value pairs from component themes to css variables.
|
|
12
12
|
/// @access private
|
|
13
|
-
/// @param {
|
|
13
|
+
/// @param {Map} $theme - The component theme to be used to generate css variables.
|
|
14
|
+
/// @param {String} $name - The CSS variables name
|
|
15
|
+
/// @param {Map} $ignored [$ignored-keys] - A list of ignored keywords to be excluded when generating CSS variables
|
|
14
16
|
/// @example scss Convert theme colors to CSS variables.
|
|
15
17
|
/// $theme: digest-schema((background: color(primary, 500), foreground: contrast-color(color, 500));
|
|
16
18
|
/// :root {
|
|
17
19
|
/// @include css-vars-from-theme($theme);
|
|
18
20
|
/// }
|
|
21
|
+
/// @require {mixin} css-vars
|
|
19
22
|
@mixin css-vars-from-theme($theme, $name, $ignored: $ignored-keys) {
|
|
20
23
|
$themes: map.get($theme, 'themes');
|
|
21
24
|
|
|
@@ -69,6 +72,7 @@ $ignored-keys: ('name', 'palette', 'variant', 'selector');
|
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
/// Truncates text to a specific number of lines.
|
|
75
|
+
/// @access public
|
|
72
76
|
/// @param {number|string} $lines - The number of lines to show
|
|
73
77
|
/// @param {Boolean} $inline - Sets whether an element displays inline-box or box
|
|
74
78
|
/// @param {Boolean} $vertical - Sets whether an element lays out its contents horizontally or vertically
|
|
@@ -108,3 +112,15 @@ $ignored-keys: ('name', 'palette', 'variant', 'selector');
|
|
|
108
112
|
overflow: hidden;
|
|
109
113
|
appearance: none;
|
|
110
114
|
}
|
|
115
|
+
|
|
116
|
+
/// Adds the required CSS properties so that the scope can react to size changes.
|
|
117
|
+
/// @access public
|
|
118
|
+
@mixin sizable() {
|
|
119
|
+
--is-large: clamp(0, (var(--ig-size, 1) + 1) - var(--ig-size-large, 3), 1);
|
|
120
|
+
--is-medium:
|
|
121
|
+
min(
|
|
122
|
+
clamp(0, (var(--ig-size, 1) + 1) - var(--ig-size-medium, 2), 1),
|
|
123
|
+
clamp(0, var(--ig-size-large, 3) - var(--ig-size, 1), 1)
|
|
124
|
+
);
|
|
125
|
+
--is-small: clamp(0, var(--ig-size-medium) - var(--ig-size, 1), 1);
|
|
126
|
+
}
|
|
@@ -15,6 +15,7 @@ $browser-context: 16px;
|
|
|
15
15
|
/// @access public
|
|
16
16
|
/// @param {number|string} $pixels - The pixel value to be converted.
|
|
17
17
|
/// @param {number|string} $context [$browser-context] - The base context to convert against.
|
|
18
|
+
/// @return {number} - Returns the pixels value converted to em.
|
|
18
19
|
@function em($pixels, $context: $browser-context) {
|
|
19
20
|
@if math.is-unitless($pixels) {
|
|
20
21
|
$pixels: $pixels * 1px;
|
|
@@ -27,10 +28,11 @@ $browser-context: 16px;
|
|
|
27
28
|
@return math.div($pixels, $context) * 1em;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
///
|
|
31
|
+
/// Converts pixels to root relative values (rem).
|
|
31
32
|
/// @access public
|
|
32
33
|
/// @param {number|string} $pixels - The pixel value to be converted.
|
|
33
34
|
/// @param {number|string} $context [$browser-context] - The base context to convert against.
|
|
35
|
+
/// @return {number} - Returns the pixels value converted to rem.
|
|
34
36
|
@function rem($pixels, $context: $browser-context) {
|
|
35
37
|
@if math.is-unitless($pixels) {
|
|
36
38
|
$pixels: $pixels * 1px;
|
|
@@ -43,10 +45,11 @@ $browser-context: 16px;
|
|
|
43
45
|
@return math.div($pixels, $context) * 1rem;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
///
|
|
48
|
+
/// Converts relative value (em/rem) to pixel.
|
|
47
49
|
/// @access public
|
|
48
50
|
/// @param {number|string} $num - The relative value to be converted.
|
|
49
51
|
/// @param {number|string} $context [$browser-context] - The base context to convert against.
|
|
52
|
+
/// @return {number} - Returns the relative value converted to pixels.
|
|
50
53
|
@function px($num, $context: $browser-context) {
|
|
51
54
|
@if meta.type-of($num) == 'number' {
|
|
52
55
|
@return math.div($num, $num * 0 + 1) * 16px;
|
|
@@ -107,7 +110,6 @@ $browser-context: 16px;
|
|
|
107
110
|
/// @param {Map} $caption - A map containing type style properties as produces by the type-style function.
|
|
108
111
|
/// @param {Map} $overline - A map containing type style properties as produces by the type-style function.
|
|
109
112
|
/// @param {String} $_theme [null] - The theme related to this type scale. Internal use only.
|
|
110
|
-
/// @requires type-style
|
|
111
113
|
/// @requires $ITypeScale
|
|
112
114
|
/// @returns {Map} - A map of all defined type scales.
|
|
113
115
|
@function type-scale($_theme: null, $args...) {
|
|
@@ -10,13 +10,15 @@
|
|
|
10
10
|
|
|
11
11
|
/// Includes all category related styles into the current style block.
|
|
12
12
|
/// @param {String} $category - The type scale category.
|
|
13
|
+
/// @param {String} $check [true] - Toggles category checks against ITypeScale.
|
|
14
|
+
/// Set to false when using a custom type scale.
|
|
13
15
|
/// @example scss Add the `h1` styles to custom CSS selector.
|
|
14
16
|
/// .fancy-h1 {
|
|
15
17
|
/// @include type-style('h1');
|
|
16
18
|
/// color: mediumvioletred;
|
|
17
19
|
/// }
|
|
18
|
-
@mixin type-style($category) {
|
|
19
|
-
$valid: list.index(types.$ITypeScale, $category);
|
|
20
|
+
@mixin type-style($category, $check: true) {
|
|
21
|
+
$valid: if($check, list.index(types.$ITypeScale, $category), true);
|
|
20
22
|
|
|
21
23
|
@if $valid {
|
|
22
24
|
@each $key, $value in types.$ITypeStyle {
|
|
@@ -30,8 +32,7 @@
|
|
|
30
32
|
|
|
31
33
|
/// Transforms a type style map into css font variables.
|
|
32
34
|
/// @param {String} $name - The custom CSS variable name.
|
|
33
|
-
/// @param {Map} $type-style - A type style map reference as
|
|
34
|
-
/// @param {String} $prefix [null] - Optional prefix.
|
|
35
|
+
/// @param {Map} $type-style - A type style map reference as produced by type-style.
|
|
35
36
|
/// @example scss Assign the `h1` styles to custom CSS property using the CSS font shorthand syntax.
|
|
36
37
|
/// $h1-style: type-scale-category($type-scale, 'h1');
|
|
37
38
|
/// @include type-style-vars('h1', $h1-style);
|
|
@@ -42,7 +43,7 @@
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
/// Styles all native elements that match the IElementCategories map.
|
|
45
|
-
/// @requires type-style
|
|
46
|
+
/// @requires {mixin} type-style
|
|
46
47
|
/// @requires $ITypeScale
|
|
47
48
|
/// @requires $IElementCategories
|
|
48
49
|
@mixin type-style-elements() {
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
/// Creates CSS classes with style rules for all categories in the ITypeScale map.
|
|
64
|
-
/// @requires type-style
|
|
65
|
+
/// @requires {mixin} type-style
|
|
65
66
|
/// @requires $ITypeScale
|
|
66
67
|
@mixin type-style-classes() {
|
|
67
68
|
@each $category in types.$ITypeScale {
|
|
@@ -77,9 +78,10 @@
|
|
|
77
78
|
/// @access public
|
|
78
79
|
/// @param {String} $font-family - The font family to be used across all typographic elements.
|
|
79
80
|
/// @param {Map} $type-scale - A type scale map as produced by the type-scale function.
|
|
80
|
-
/// @requires
|
|
81
|
-
/// @requires type-style-
|
|
82
|
-
/// @requires type-style-
|
|
81
|
+
/// @requires {function} is-root
|
|
82
|
+
/// @requires {mixin} type-style-vars
|
|
83
|
+
/// @requires {mixin} type-style-classes
|
|
84
|
+
/// @requires {mixin} type-style-elements
|
|
83
85
|
@mixin typography($font-family, $type-scale) {
|
|
84
86
|
$scope: if(is-root(), ':root', '&');
|
|
85
87
|
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
////
|
|
2
|
+
/// @group Typography
|
|
3
|
+
////
|
|
4
|
+
|
|
5
|
+
/// A list consisting of 13 different category type styles
|
|
6
|
+
/// @type List
|
|
1
7
|
$ITypeScale: (
|
|
2
8
|
h1,
|
|
3
9
|
h2,
|
|
@@ -13,6 +19,9 @@ $ITypeScale: (
|
|
|
13
19
|
caption,
|
|
14
20
|
overline
|
|
15
21
|
);
|
|
22
|
+
|
|
23
|
+
/// A set of style rules for all categories
|
|
24
|
+
/// @type Map
|
|
16
25
|
$ITypeStyle: (
|
|
17
26
|
font-family: var(--ig-font-family),
|
|
18
27
|
font-size: null,
|
|
@@ -24,6 +33,9 @@ $ITypeStyle: (
|
|
|
24
33
|
margin-top: 0,
|
|
25
34
|
margin-bottom: 0
|
|
26
35
|
);
|
|
36
|
+
|
|
37
|
+
/// A list of all category type styles that can be maped to native elements
|
|
38
|
+
/// @type Map
|
|
27
39
|
$IElementCategories: (
|
|
28
40
|
h1: 'h1',
|
|
29
41
|
h2: 'h2',
|
|
@@ -11,6 +11,7 @@ $_base-scale: (
|
|
|
11
11
|
h1: type-style(
|
|
12
12
|
$font-size: rem(40px),
|
|
13
13
|
$font-weight: 500,
|
|
14
|
+
$letter-spacing: rem(-1.5px),
|
|
14
15
|
$line-height: rem(48px),
|
|
15
16
|
$text-transform: none,
|
|
16
17
|
$margin-top: 0,
|
|
@@ -19,6 +20,7 @@ $_base-scale: (
|
|
|
19
20
|
h2: type-style(
|
|
20
21
|
$font-size: rem(32px),
|
|
21
22
|
$font-weight: 500,
|
|
23
|
+
$letter-spacing: rem(-.5px),
|
|
22
24
|
$line-height: rem(38.4px),
|
|
23
25
|
$text-transform: none,
|
|
24
26
|
$margin-top: 0,
|
|
@@ -27,6 +29,7 @@ $_base-scale: (
|
|
|
27
29
|
h3: type-style(
|
|
28
30
|
$font-size: rem(28px),
|
|
29
31
|
$font-weight: 500,
|
|
32
|
+
$letter-spacing: 0,
|
|
30
33
|
$line-height: rem(33.6px),
|
|
31
34
|
$text-transform: none,
|
|
32
35
|
$margin-top: 0,
|
|
@@ -35,6 +38,7 @@ $_base-scale: (
|
|
|
35
38
|
h4: type-style(
|
|
36
39
|
$font-size: rem(24px),
|
|
37
40
|
$font-weight: 500,
|
|
41
|
+
$letter-spacing: rem(.25px),
|
|
38
42
|
$line-height: rem(28.8px),
|
|
39
43
|
$text-transform: none,
|
|
40
44
|
$margin-top: 0,
|
|
@@ -43,6 +47,7 @@ $_base-scale: (
|
|
|
43
47
|
h5: type-style(
|
|
44
48
|
$font-size: rem(20px),
|
|
45
49
|
$font-weight: 500,
|
|
50
|
+
$letter-spacing: 0,
|
|
46
51
|
$line-height: rem(24px),
|
|
47
52
|
$text-transform: none,
|
|
48
53
|
$margin-top: 0,
|
|
@@ -51,6 +56,7 @@ $_base-scale: (
|
|
|
51
56
|
h6: type-style(
|
|
52
57
|
$font-size: rem(16px),
|
|
53
58
|
$font-weight: 500,
|
|
59
|
+
$letter-spacing: rem(.15px),
|
|
54
60
|
$line-height: rem(19.2px),
|
|
55
61
|
$text-transform: none,
|
|
56
62
|
$margin-top: 0,
|
|
@@ -59,6 +65,7 @@ $_base-scale: (
|
|
|
59
65
|
body-1: type-style(
|
|
60
66
|
$font-size: rem(16px),
|
|
61
67
|
$font-weight: 400,
|
|
68
|
+
$letter-spacing: rem(.5px),
|
|
62
69
|
$line-height: rem(24px),
|
|
63
70
|
$text-transform: none,
|
|
64
71
|
$margin-top: 0,
|
|
@@ -67,6 +74,7 @@ $_base-scale: (
|
|
|
67
74
|
body-2: type-style(
|
|
68
75
|
$font-size: rem(14.4px),
|
|
69
76
|
$font-weight: 400,
|
|
77
|
+
$letter-spacing: rem(.25px),
|
|
70
78
|
$line-height: rem(24px),
|
|
71
79
|
$text-transform: none,
|
|
72
80
|
$margin-top: 0,
|
|
@@ -75,6 +83,7 @@ $_base-scale: (
|
|
|
75
83
|
subtitle-1: type-style(
|
|
76
84
|
$font-size: rem(14px),
|
|
77
85
|
$font-weight: 400,
|
|
86
|
+
$letter-spacing: rem(.15px),
|
|
78
87
|
$line-height: rem(24px),
|
|
79
88
|
$text-transform: none,
|
|
80
89
|
$margin-top: 0,
|
|
@@ -83,6 +92,7 @@ $_base-scale: (
|
|
|
83
92
|
subtitle-2: type-style(
|
|
84
93
|
$font-size: rem(14.4px),
|
|
85
94
|
$font-weight: 400,
|
|
95
|
+
$letter-spacing: rem(.1px),
|
|
86
96
|
$line-height: rem(21.6px),
|
|
87
97
|
$text-transform: none,
|
|
88
98
|
$margin-top: 0,
|
|
@@ -91,6 +101,7 @@ $_base-scale: (
|
|
|
91
101
|
button: type-style(
|
|
92
102
|
$font-size: rem(16px),
|
|
93
103
|
$font-weight: 500,
|
|
104
|
+
$letter-spacing: rem(.75px),
|
|
94
105
|
$line-height: rem(24px),
|
|
95
106
|
$text-transform: none,
|
|
96
107
|
$margin-top: 0,
|
|
@@ -8,6 +8,7 @@ $type-scale: (
|
|
|
8
8
|
h1: type-style(
|
|
9
9
|
$font-size: rem(68px),
|
|
10
10
|
$font-weight: 700,
|
|
11
|
+
$letter-spacing: rem(-1.5px),
|
|
11
12
|
$line-height: rem(76px),
|
|
12
13
|
$text-transform: none,
|
|
13
14
|
$margin-top: 0,
|
|
@@ -16,6 +17,7 @@ $type-scale: (
|
|
|
16
17
|
h2: type-style(
|
|
17
18
|
$font-size: rem(42px),
|
|
18
19
|
$font-weight: 700,
|
|
20
|
+
$letter-spacing: rem(-.5px),
|
|
19
21
|
$line-height: rem(52px),
|
|
20
22
|
$text-transform: none,
|
|
21
23
|
$margin-top: 0,
|
|
@@ -24,6 +26,7 @@ $type-scale: (
|
|
|
24
26
|
h3: type-style(
|
|
25
27
|
$font-size: rem(32px),
|
|
26
28
|
$font-weight: 600,
|
|
29
|
+
$letter-spacing: 0,
|
|
27
30
|
$line-height: rem(40px),
|
|
28
31
|
$text-transform: none,
|
|
29
32
|
$margin-top: 0,
|
|
@@ -32,6 +35,7 @@ $type-scale: (
|
|
|
32
35
|
h4: type-style(
|
|
33
36
|
$font-size: rem(28px),
|
|
34
37
|
$font-weight: 400,
|
|
38
|
+
$letter-spacing: rem(.25px),
|
|
35
39
|
$line-height: rem(36px),
|
|
36
40
|
$text-transform: none,
|
|
37
41
|
$margin-top: 0,
|
|
@@ -40,6 +44,7 @@ $type-scale: (
|
|
|
40
44
|
h5: type-style(
|
|
41
45
|
$font-size: rem(24px),
|
|
42
46
|
$font-weight: 400,
|
|
47
|
+
$letter-spacing: 0,
|
|
43
48
|
$line-height: rem(32px),
|
|
44
49
|
$text-transform: none,
|
|
45
50
|
$margin-top: 0,
|
|
@@ -48,6 +53,7 @@ $type-scale: (
|
|
|
48
53
|
h6: type-style(
|
|
49
54
|
$font-size: rem(20px),
|
|
50
55
|
$font-weight: 400,
|
|
56
|
+
$letter-spacing: rem(.15px),
|
|
51
57
|
$line-height: rem(28px),
|
|
52
58
|
$text-transform: none,
|
|
53
59
|
$margin-top: 0,
|
|
@@ -56,6 +62,7 @@ $type-scale: (
|
|
|
56
62
|
body-1: type-style(
|
|
57
63
|
$font-size: rem(16px),
|
|
58
64
|
$font-weight: 400,
|
|
65
|
+
$letter-spacing: rem(.5px),
|
|
59
66
|
$line-height: rem(22px),
|
|
60
67
|
$text-transform: none,
|
|
61
68
|
$margin-top: 0,
|
|
@@ -64,6 +71,7 @@ $type-scale: (
|
|
|
64
71
|
body-2: type-style(
|
|
65
72
|
$font-size: rem(14px),
|
|
66
73
|
$font-weight: 400,
|
|
74
|
+
$letter-spacing: rem(.25px),
|
|
67
75
|
$line-height: rem(20px),
|
|
68
76
|
$text-transform: none,
|
|
69
77
|
$margin-top: 0,
|
|
@@ -72,6 +80,7 @@ $type-scale: (
|
|
|
72
80
|
subtitle-1: type-style(
|
|
73
81
|
$font-size: rem(18px),
|
|
74
82
|
$font-weight: 400,
|
|
83
|
+
$letter-spacing: rem(.15px),
|
|
75
84
|
$line-height: rem(24px),
|
|
76
85
|
$text-transform: none,
|
|
77
86
|
$margin-top: 0,
|
|
@@ -80,6 +89,7 @@ $type-scale: (
|
|
|
80
89
|
subtitle-2: type-style(
|
|
81
90
|
$font-size: rem(14px),
|
|
82
91
|
$font-weight: 600,
|
|
92
|
+
$letter-spacing: rem(.1px),
|
|
83
93
|
$line-height: rem(20px),
|
|
84
94
|
$text-transform: none,
|
|
85
95
|
$margin-top: 0,
|
|
@@ -88,6 +98,7 @@ $type-scale: (
|
|
|
88
98
|
button: type-style(
|
|
89
99
|
$font-size: rem(14px),
|
|
90
100
|
$font-weight: 400,
|
|
101
|
+
$letter-spacing: rem(.75px),
|
|
91
102
|
$line-height: rem(14px),
|
|
92
103
|
$text-transform: capitalize,
|
|
93
104
|
$margin-top: 0,
|
|
@@ -104,7 +115,9 @@ $type-scale: (
|
|
|
104
115
|
overline: type-style(
|
|
105
116
|
$font-size: rem(10px),
|
|
106
117
|
$font-weight: 400,
|
|
118
|
+
$letter-spacing: rem(1.5px),
|
|
107
119
|
$line-height: rem(14px),
|
|
120
|
+
$text-transform: uppercase,
|
|
108
121
|
$margin-top: 0,
|
|
109
122
|
$margin-bottom: 0
|
|
110
123
|
)
|
|
@@ -8,8 +8,8 @@ $type-scale: (
|
|
|
8
8
|
h1: type-style(
|
|
9
9
|
$font-size: rem(96px),
|
|
10
10
|
$font-weight: 200,
|
|
11
|
-
$line-height: rem(112px),
|
|
12
11
|
$letter-spacing: rem(-1.5px),
|
|
12
|
+
$line-height: rem(112px),
|
|
13
13
|
$text-transform: none,
|
|
14
14
|
$margin-top: 0,
|
|
15
15
|
$margin-bottom: 0
|
|
@@ -17,8 +17,8 @@ $type-scale: (
|
|
|
17
17
|
h2: type-style(
|
|
18
18
|
$font-size: rem(60px),
|
|
19
19
|
$font-weight: 200,
|
|
20
|
-
$line-height: rem(72px),
|
|
21
20
|
$letter-spacing: rem(-.5px),
|
|
21
|
+
$line-height: rem(72px),
|
|
22
22
|
$text-transform: none,
|
|
23
23
|
$margin-top: 0,
|
|
24
24
|
$margin-bottom: 0
|
|
@@ -26,6 +26,7 @@ $type-scale: (
|
|
|
26
26
|
h3: type-style(
|
|
27
27
|
$font-size: rem(48px),
|
|
28
28
|
$font-weight: 200,
|
|
29
|
+
$letter-spacing: 0,
|
|
29
30
|
$line-height: rem(56px),
|
|
30
31
|
$text-transform: none,
|
|
31
32
|
$margin-top: 0,
|
|
@@ -34,6 +35,7 @@ $type-scale: (
|
|
|
34
35
|
h4: type-style(
|
|
35
36
|
$font-size: rem(36px),
|
|
36
37
|
$font-weight: 200,
|
|
38
|
+
$letter-spacing: rem(.25px),
|
|
37
39
|
$line-height: rem(42px),
|
|
38
40
|
$text-transform: none,
|
|
39
41
|
$margin-top: 0,
|
|
@@ -42,6 +44,7 @@ $type-scale: (
|
|
|
42
44
|
h5: type-style(
|
|
43
45
|
$font-size: rem(24px),
|
|
44
46
|
$font-weight: 200,
|
|
47
|
+
$letter-spacing: 0,
|
|
45
48
|
$line-height: rem(28px),
|
|
46
49
|
$text-transform: none,
|
|
47
50
|
$margin-top: 0,
|
|
@@ -50,6 +53,7 @@ $type-scale: (
|
|
|
50
53
|
h6: type-style(
|
|
51
54
|
$font-size: rem(20px),
|
|
52
55
|
$font-weight: 600,
|
|
56
|
+
$letter-spacing: rem(.15px),
|
|
53
57
|
$line-height: rem(26px),
|
|
54
58
|
$text-transform: none,
|
|
55
59
|
$margin-top: 0,
|
|
@@ -58,6 +62,7 @@ $type-scale: (
|
|
|
58
62
|
body-1: type-style(
|
|
59
63
|
$font-size: rem(16px),
|
|
60
64
|
$font-weight: 400,
|
|
65
|
+
$letter-spacing: rem(.5px),
|
|
61
66
|
$line-height: rem(20px),
|
|
62
67
|
$text-transform: none,
|
|
63
68
|
$margin-top: 0,
|
|
@@ -66,6 +71,7 @@ $type-scale: (
|
|
|
66
71
|
body-2: type-style(
|
|
67
72
|
$font-size: rem(14px),
|
|
68
73
|
$font-weight: 400,
|
|
74
|
+
$letter-spacing: rem(.25px),
|
|
69
75
|
$line-height: rem(20px),
|
|
70
76
|
$text-transform: none,
|
|
71
77
|
$margin-top: 0,
|
|
@@ -74,6 +80,7 @@ $type-scale: (
|
|
|
74
80
|
subtitle-1: type-style(
|
|
75
81
|
$font-size: rem(16px),
|
|
76
82
|
$font-weight: 600,
|
|
83
|
+
$letter-spacing: rem(.15px),
|
|
77
84
|
$line-height: rem(22px),
|
|
78
85
|
$text-transform: none,
|
|
79
86
|
$margin-top: 0,
|
|
@@ -82,6 +89,7 @@ $type-scale: (
|
|
|
82
89
|
subtitle-2: type-style(
|
|
83
90
|
$font-size: rem(14px),
|
|
84
91
|
$font-weight: 700,
|
|
92
|
+
$letter-spacing: rem(.1px),
|
|
85
93
|
$line-height: rem(20px),
|
|
86
94
|
$text-transform: none,
|
|
87
95
|
$margin-top: 0,
|
|
@@ -90,6 +98,7 @@ $type-scale: (
|
|
|
90
98
|
button: type-style(
|
|
91
99
|
$font-size: rem(12px),
|
|
92
100
|
$font-weight: 700,
|
|
101
|
+
$letter-spacing: rem(.75px),
|
|
93
102
|
$line-height: normal,
|
|
94
103
|
$text-transform: uppercase,
|
|
95
104
|
$margin-top: 0,
|
|
@@ -98,6 +107,7 @@ $type-scale: (
|
|
|
98
107
|
caption: type-style(
|
|
99
108
|
$font-size: rem(12px),
|
|
100
109
|
$font-weight: 400,
|
|
110
|
+
$letter-spacing: rem(.4px),
|
|
101
111
|
$line-height: rem(16px),
|
|
102
112
|
$text-transform: normal,
|
|
103
113
|
$margin-top: 0,
|
|
@@ -106,9 +116,9 @@ $type-scale: (
|
|
|
106
116
|
overline: type-style(
|
|
107
117
|
$font-size: rem(10px),
|
|
108
118
|
$font-weight: 700,
|
|
119
|
+
$letter-spacing: rem(.2px),
|
|
109
120
|
$line-height: rem(14px),
|
|
110
121
|
$text-transform: uppercase,
|
|
111
|
-
$letter-spacing: rem(.2px),
|
|
112
122
|
$margin-top: 0,
|
|
113
123
|
$margin-bottom: 0
|
|
114
124
|
)
|
|
@@ -66,22 +66,6 @@ $type-scale: (
|
|
|
66
66
|
$margin-top: 0,
|
|
67
67
|
$margin-bottom: 0
|
|
68
68
|
),
|
|
69
|
-
subtitle-1: type-style(
|
|
70
|
-
$font-size: rem(16px),
|
|
71
|
-
$font-weight: 400,
|
|
72
|
-
$font-style: normal,
|
|
73
|
-
$letter-spacing: rem(.15px),
|
|
74
|
-
$line-height: rem(24px),
|
|
75
|
-
$text-transform: none
|
|
76
|
-
),
|
|
77
|
-
subtitle-2: type-style(
|
|
78
|
-
$font-size: rem(14px),
|
|
79
|
-
$font-weight: 600,
|
|
80
|
-
$font-style: normal,
|
|
81
|
-
$letter-spacing: rem(.1px),
|
|
82
|
-
$line-height: rem(24px),
|
|
83
|
-
$text-transform: none
|
|
84
|
-
),
|
|
85
69
|
body-1: type-style(
|
|
86
70
|
$font-size: rem(16px),
|
|
87
71
|
$font-weight: 400,
|
|
@@ -100,6 +84,22 @@ $type-scale: (
|
|
|
100
84
|
$line-height: rem(20px),
|
|
101
85
|
$text-transform: none
|
|
102
86
|
),
|
|
87
|
+
subtitle-1: type-style(
|
|
88
|
+
$font-size: rem(16px),
|
|
89
|
+
$font-weight: 400,
|
|
90
|
+
$font-style: normal,
|
|
91
|
+
$letter-spacing: rem(.15px),
|
|
92
|
+
$line-height: rem(24px),
|
|
93
|
+
$text-transform: none
|
|
94
|
+
),
|
|
95
|
+
subtitle-2: type-style(
|
|
96
|
+
$font-size: rem(14px),
|
|
97
|
+
$font-weight: 600,
|
|
98
|
+
$font-style: normal,
|
|
99
|
+
$letter-spacing: rem(.1px),
|
|
100
|
+
$line-height: rem(24px),
|
|
101
|
+
$text-transform: none
|
|
102
|
+
),
|
|
103
103
|
button: type-style(
|
|
104
104
|
$font-size: rem(14px),
|
|
105
105
|
$font-weight: 600,
|
package/sass/utils/_map.scss
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
/// Extends a Map with the values of another Map, disregarding null values in the process.
|
|
25
25
|
/// @access public
|
|
26
26
|
/// @param {Map...} $maps - The maps to get extended.
|
|
27
|
-
/// @requires {function}
|
|
27
|
+
/// @requires {function} clean
|
|
28
28
|
/// @returns {Map} - Returns the merged maps.
|
|
29
29
|
@function extend($maps...) {
|
|
30
30
|
$result: ();
|
package/sass/utils/_math.scss
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
@use 'sass:math';
|
|
2
2
|
|
|
3
|
+
/// Rounds a number to a certain precision
|
|
4
|
+
/// @access public
|
|
5
|
+
/// @param {Number} $number - The number to be rounded
|
|
6
|
+
/// @param {Number} $precision [2] - Specifies the number of the digits after the decimal separator
|
|
7
|
+
/// @returns {Number} - The rounded number
|
|
3
8
|
@function to-fixed($number, $precision: 2) {
|
|
4
9
|
$pow: math.pow(10, $precision);
|
|
5
10
|
|
package/sass/utils/_meta.scss
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
@use 'sass:string';
|
|
9
9
|
@use '../node_modules/sass-true/' as *;
|
|
10
10
|
@use '../sass/typography/' as *;
|
|
11
|
+
@use '../sass/typography/presets' as presets;
|
|
11
12
|
|
|
12
13
|
$h1: (font-size: 96px);
|
|
13
14
|
$h2: (font-size: 70px);
|
|
@@ -157,6 +158,22 @@ $scale: type-scale(
|
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
|
|
161
|
+
@include it('should include all styles from a custom type category') {
|
|
162
|
+
@include assert() {
|
|
163
|
+
$custom-category: 'calendar-labels';
|
|
164
|
+
|
|
165
|
+
@include output() {
|
|
166
|
+
@include type-style($custom-category, $check: false);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@include expect() {
|
|
170
|
+
@each $key, $value in map.get(presets.$bootstrap-type-scale, $custom-category) {
|
|
171
|
+
#{$key}: var(--ig-#{$custom-category}-#{$key});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
160
177
|
@include it('should include type styles with CSS var refs as values for a specific category') {
|
|
161
178
|
$category: 'h1';
|
|
162
179
|
|
package/test/e2e/theme.scss
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
@use '../../index' as *;
|
|
2
|
+
@use '../../sass/color/presets' as *;
|
|
3
|
+
@use '../../sass/typography/presets' as *;
|
|
4
|
+
@use '../../sass/elevations/presets' as *;
|
|
2
5
|
@include palette($light-material-palette);
|
|
3
6
|
@include typography($material-typeface, $material-type-scale);
|
|
4
7
|
@include elevations($material-elevations);
|