igniteui-theming 1.0.0-beta.6 → 1.0.0-beta.9

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,6 +1,6 @@
1
1
  {
2
2
  "name": "igniteui-theming",
3
- "version": "1.0.0-beta.6",
3
+ "version": "1.0.0-beta.9",
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
- /// @returns {Map} - A map consisting of color shades for the passed base colors(primary, secondary, gray, etc).
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} _color-shade
82
- /// @requires {function} _hsla-shade
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 Palettesreference
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
- }
@@ -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 [null] - The palette used to generate CSS variables.
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-#{meta.inspect($color)}-h: #{math.round(color.hue($value))};
31
- --ig-#{meta.inspect($color)}-s: #{math.round(color.saturation($value))};
32
- --ig-#{meta.inspect($color)}-l: #{math.round(color.lightness($value))};
33
- --ig-#{meta.inspect($color)}-a: #{color.alpha($value)};
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-#{meta.inspect($color)}-#{$variant}: #{$value};
39
+ --ig-#{$color}-#{$variant}: #{$value};
40
40
  }
41
41
 
42
42
  @if $_contrast and $contrast {
43
- --ig-#{meta.inspect($color)}-#{$shade}: #{$value};
43
+ --ig-#{$color}-#{$shade}: #{$value};
44
44
  }
45
45
  }
46
46
  }
@@ -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 elevations
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 elevations
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
- /// $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
- ///
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 - Umbra Shadows
9
- /// @type {Color} $_color-1 - The color used to generate umbra shadows.
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 - Penumbra Shadows
13
- /// @type {Color} $_color-2 - The color used to generate penumbra shadows.
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 - Ambient Shadows
17
- /// @type {Color} $_color-3 - The color used to generate ambient shadows.
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
- /// @type {Map} $elevations - А map of 24 shadow elevations with the umbra, penumbra and ambient shadows.
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 {map} $theme - The source theme to be used to read values from.
86
- /// @param {string} $property - A key from the theme map to assign as value to the property.
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
+ }
@@ -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 {map} $theme - The component theme to be used to generate css variables.
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
- /// Pixels to root relative values (rem).
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
- /// Relative value(em/rem) to pixel.
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 produces by type-style.
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 type-style-vars
81
- /// @requires type-style-classes
82
- /// @requires type-style-elements
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',
@@ -7,8 +7,9 @@
7
7
 
8
8
  /* stylelint-disable-next-line max-line-length */
9
9
  $typeface: "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'";
10
- $_base-scale: (
11
- h1: type-style(
10
+ $_base-scale: type-scale(
11
+ $_theme: 'bootstrap',
12
+ $h1: type-style(
12
13
  $font-size: rem(40px),
13
14
  $font-weight: 500,
14
15
  $letter-spacing: rem(-1.5px),
@@ -17,7 +18,7 @@ $_base-scale: (
17
18
  $margin-top: 0,
18
19
  $margin-bottom: rem(8px)
19
20
  ),
20
- h2: type-style(
21
+ $h2: type-style(
21
22
  $font-size: rem(32px),
22
23
  $font-weight: 500,
23
24
  $letter-spacing: rem(-.5px),
@@ -26,7 +27,7 @@ $_base-scale: (
26
27
  $margin-top: 0,
27
28
  $margin-bottom: rem(8px)
28
29
  ),
29
- h3: type-style(
30
+ $h3: type-style(
30
31
  $font-size: rem(28px),
31
32
  $font-weight: 500,
32
33
  $letter-spacing: 0,
@@ -35,7 +36,7 @@ $_base-scale: (
35
36
  $margin-top: 0,
36
37
  $margin-bottom: rem(8px)
37
38
  ),
38
- h4: type-style(
39
+ $h4: type-style(
39
40
  $font-size: rem(24px),
40
41
  $font-weight: 500,
41
42
  $letter-spacing: rem(.25px),
@@ -44,7 +45,7 @@ $_base-scale: (
44
45
  $margin-top: 0,
45
46
  $margin-bottom: rem(8px)
46
47
  ),
47
- h5: type-style(
48
+ $h5: type-style(
48
49
  $font-size: rem(20px),
49
50
  $font-weight: 500,
50
51
  $letter-spacing: 0,
@@ -53,7 +54,7 @@ $_base-scale: (
53
54
  $margin-top: 0,
54
55
  $margin-bottom: rem(8px)
55
56
  ),
56
- h6: type-style(
57
+ $h6: type-style(
57
58
  $font-size: rem(16px),
58
59
  $font-weight: 500,
59
60
  $letter-spacing: rem(.15px),
@@ -62,7 +63,7 @@ $_base-scale: (
62
63
  $margin-top: 0,
63
64
  $margin-bottom: rem(8px)
64
65
  ),
65
- body-1: type-style(
66
+ $body-1: type-style(
66
67
  $font-size: rem(16px),
67
68
  $font-weight: 400,
68
69
  $letter-spacing: rem(.5px),
@@ -71,7 +72,7 @@ $_base-scale: (
71
72
  $margin-top: 0,
72
73
  $margin-bottom: 0
73
74
  ),
74
- body-2: type-style(
75
+ $body-2: type-style(
75
76
  $font-size: rem(14.4px),
76
77
  $font-weight: 400,
77
78
  $letter-spacing: rem(.25px),
@@ -80,7 +81,7 @@ $_base-scale: (
80
81
  $margin-top: 0,
81
82
  $margin-bottom: 0
82
83
  ),
83
- subtitle-1: type-style(
84
+ $subtitle-1: type-style(
84
85
  $font-size: rem(14px),
85
86
  $font-weight: 400,
86
87
  $letter-spacing: rem(.15px),
@@ -89,7 +90,7 @@ $_base-scale: (
89
90
  $margin-top: 0,
90
91
  $margin-bottom: 0
91
92
  ),
92
- subtitle-2: type-style(
93
+ $subtitle-2: type-style(
93
94
  $font-size: rem(14.4px),
94
95
  $font-weight: 400,
95
96
  $letter-spacing: rem(.1px),
@@ -98,7 +99,7 @@ $_base-scale: (
98
99
  $margin-top: 0,
99
100
  $margin-bottom: 0
100
101
  ),
101
- button: type-style(
102
+ $button: type-style(
102
103
  $font-size: rem(16px),
103
104
  $font-weight: 500,
104
105
  $letter-spacing: rem(.75px),
@@ -107,14 +108,14 @@ $_base-scale: (
107
108
  $margin-top: 0,
108
109
  $margin-bottom: 0
109
110
  ),
110
- caption: type-style(
111
+ $caption: type-style(
111
112
  $font-size: rem(12px),
112
113
  $font-weight: 400,
113
114
  $letter-spacing: rem(.4px),
114
115
  $line-height: rem(16px),
115
116
  $text-transform: none
116
117
  ),
117
- overline: type-style(
118
+ $overline: type-style(
118
119
  $font-size: rem(10px),
119
120
  $font-weight: 400,
120
121
  $letter-spacing: rem(1.5px),
@@ -4,8 +4,9 @@
4
4
  /// @group Typography
5
5
  ////
6
6
  $typeface: "'Open Sans', Helvetica, Arial, sans-serif";
7
- $type-scale: (
8
- h1: type-style(
7
+ $type-scale: type-scale(
8
+ $_theme: 'fluent',
9
+ $h1: type-style(
9
10
  $font-size: rem(68px),
10
11
  $font-weight: 700,
11
12
  $letter-spacing: rem(-1.5px),
@@ -14,7 +15,7 @@ $type-scale: (
14
15
  $margin-top: 0,
15
16
  $margin-bottom: 0
16
17
  ),
17
- h2: type-style(
18
+ $h2: type-style(
18
19
  $font-size: rem(42px),
19
20
  $font-weight: 700,
20
21
  $letter-spacing: rem(-.5px),
@@ -23,7 +24,7 @@ $type-scale: (
23
24
  $margin-top: 0,
24
25
  $margin-bottom: 0
25
26
  ),
26
- h3: type-style(
27
+ $h3: type-style(
27
28
  $font-size: rem(32px),
28
29
  $font-weight: 600,
29
30
  $letter-spacing: 0,
@@ -32,7 +33,7 @@ $type-scale: (
32
33
  $margin-top: 0,
33
34
  $margin-bottom: 0
34
35
  ),
35
- h4: type-style(
36
+ $h4: type-style(
36
37
  $font-size: rem(28px),
37
38
  $font-weight: 400,
38
39
  $letter-spacing: rem(.25px),
@@ -41,7 +42,7 @@ $type-scale: (
41
42
  $margin-top: 0,
42
43
  $margin-bottom: 0
43
44
  ),
44
- h5: type-style(
45
+ $h5: type-style(
45
46
  $font-size: rem(24px),
46
47
  $font-weight: 400,
47
48
  $letter-spacing: 0,
@@ -50,7 +51,7 @@ $type-scale: (
50
51
  $margin-top: 0,
51
52
  $margin-bottom: 0
52
53
  ),
53
- h6: type-style(
54
+ $h6: type-style(
54
55
  $font-size: rem(20px),
55
56
  $font-weight: 400,
56
57
  $letter-spacing: rem(.15px),
@@ -59,7 +60,7 @@ $type-scale: (
59
60
  $margin-top: 0,
60
61
  $margin-bottom: 0
61
62
  ),
62
- body-1: type-style(
63
+ $body-1: type-style(
63
64
  $font-size: rem(16px),
64
65
  $font-weight: 400,
65
66
  $letter-spacing: rem(.5px),
@@ -68,7 +69,7 @@ $type-scale: (
68
69
  $margin-top: 0,
69
70
  $margin-bottom: 0
70
71
  ),
71
- body-2: type-style(
72
+ $body-2: type-style(
72
73
  $font-size: rem(14px),
73
74
  $font-weight: 400,
74
75
  $letter-spacing: rem(.25px),
@@ -77,7 +78,7 @@ $type-scale: (
77
78
  $margin-top: 0,
78
79
  $margin-bottom: 0
79
80
  ),
80
- subtitle-1: type-style(
81
+ $subtitle-1: type-style(
81
82
  $font-size: rem(18px),
82
83
  $font-weight: 400,
83
84
  $letter-spacing: rem(.15px),
@@ -86,7 +87,7 @@ $type-scale: (
86
87
  $margin-top: 0,
87
88
  $margin-bottom: 0
88
89
  ),
89
- subtitle-2: type-style(
90
+ $subtitle-2: type-style(
90
91
  $font-size: rem(14px),
91
92
  $font-weight: 600,
92
93
  $letter-spacing: rem(.1px),
@@ -95,7 +96,7 @@ $type-scale: (
95
96
  $margin-top: 0,
96
97
  $margin-bottom: 0
97
98
  ),
98
- button: type-style(
99
+ $button: type-style(
99
100
  $font-size: rem(14px),
100
101
  $font-weight: 400,
101
102
  $letter-spacing: rem(.75px),
@@ -104,7 +105,7 @@ $type-scale: (
104
105
  $margin-top: 0,
105
106
  $margin-bottom: 0
106
107
  ),
107
- caption: type-style(
108
+ $caption: type-style(
108
109
  $font-size: rem(12px),
109
110
  $font-weight: 400,
110
111
  $font-style: normal,
@@ -112,7 +113,7 @@ $type-scale: (
112
113
  $line-height: rem(16px),
113
114
  $text-transform: none
114
115
  ),
115
- overline: type-style(
116
+ $overline: type-style(
116
117
  $font-size: rem(10px),
117
118
  $font-weight: 400,
118
119
  $letter-spacing: rem(1.5px),
@@ -4,8 +4,9 @@
4
4
  /// @group Typography
5
5
  ////
6
6
  $typeface: "'Nunito Sans', sans-serif";
7
- $type-scale: (
8
- h1: type-style(
7
+ $type-scale: type-scale(
8
+ $_theme: 'indigo',
9
+ $h1: type-style(
9
10
  $font-size: rem(96px),
10
11
  $font-weight: 200,
11
12
  $letter-spacing: rem(-1.5px),
@@ -14,7 +15,7 @@ $type-scale: (
14
15
  $margin-top: 0,
15
16
  $margin-bottom: 0
16
17
  ),
17
- h2: type-style(
18
+ $h2: type-style(
18
19
  $font-size: rem(60px),
19
20
  $font-weight: 200,
20
21
  $letter-spacing: rem(-.5px),
@@ -23,7 +24,7 @@ $type-scale: (
23
24
  $margin-top: 0,
24
25
  $margin-bottom: 0
25
26
  ),
26
- h3: type-style(
27
+ $h3: type-style(
27
28
  $font-size: rem(48px),
28
29
  $font-weight: 200,
29
30
  $letter-spacing: 0,
@@ -32,7 +33,7 @@ $type-scale: (
32
33
  $margin-top: 0,
33
34
  $margin-bottom: 0
34
35
  ),
35
- h4: type-style(
36
+ $h4: type-style(
36
37
  $font-size: rem(36px),
37
38
  $font-weight: 200,
38
39
  $letter-spacing: rem(.25px),
@@ -41,7 +42,7 @@ $type-scale: (
41
42
  $margin-top: 0,
42
43
  $margin-bottom: 0
43
44
  ),
44
- h5: type-style(
45
+ $h5: type-style(
45
46
  $font-size: rem(24px),
46
47
  $font-weight: 200,
47
48
  $letter-spacing: 0,
@@ -50,7 +51,7 @@ $type-scale: (
50
51
  $margin-top: 0,
51
52
  $margin-bottom: 0
52
53
  ),
53
- h6: type-style(
54
+ $h6: type-style(
54
55
  $font-size: rem(20px),
55
56
  $font-weight: 600,
56
57
  $letter-spacing: rem(.15px),
@@ -59,7 +60,7 @@ $type-scale: (
59
60
  $margin-top: 0,
60
61
  $margin-bottom: 0
61
62
  ),
62
- body-1: type-style(
63
+ $body-1: type-style(
63
64
  $font-size: rem(16px),
64
65
  $font-weight: 400,
65
66
  $letter-spacing: rem(.5px),
@@ -68,7 +69,7 @@ $type-scale: (
68
69
  $margin-top: 0,
69
70
  $margin-bottom: 0
70
71
  ),
71
- body-2: type-style(
72
+ $body-2: type-style(
72
73
  $font-size: rem(14px),
73
74
  $font-weight: 400,
74
75
  $letter-spacing: rem(.25px),
@@ -77,7 +78,7 @@ $type-scale: (
77
78
  $margin-top: 0,
78
79
  $margin-bottom: 0
79
80
  ),
80
- subtitle-1: type-style(
81
+ $subtitle-1: type-style(
81
82
  $font-size: rem(16px),
82
83
  $font-weight: 600,
83
84
  $letter-spacing: rem(.15px),
@@ -86,7 +87,7 @@ $type-scale: (
86
87
  $margin-top: 0,
87
88
  $margin-bottom: 0
88
89
  ),
89
- subtitle-2: type-style(
90
+ $subtitle-2: type-style(
90
91
  $font-size: rem(14px),
91
92
  $font-weight: 700,
92
93
  $letter-spacing: rem(.1px),
@@ -95,7 +96,7 @@ $type-scale: (
95
96
  $margin-top: 0,
96
97
  $margin-bottom: 0
97
98
  ),
98
- button: type-style(
99
+ $button: type-style(
99
100
  $font-size: rem(12px),
100
101
  $font-weight: 700,
101
102
  $letter-spacing: rem(.75px),
@@ -104,7 +105,7 @@ $type-scale: (
104
105
  $margin-top: 0,
105
106
  $margin-bottom: 0
106
107
  ),
107
- caption: type-style(
108
+ $caption: type-style(
108
109
  $font-size: rem(12px),
109
110
  $font-weight: 400,
110
111
  $letter-spacing: rem(.4px),
@@ -113,7 +114,7 @@ $type-scale: (
113
114
  $margin-top: 0,
114
115
  $margin-bottom: 0
115
116
  ),
116
- overline: type-style(
117
+ $overline: type-style(
117
118
  $font-size: rem(10px),
118
119
  $font-weight: 700,
119
120
  $letter-spacing: rem(.2px),
@@ -5,8 +5,9 @@
5
5
  ////
6
6
 
7
7
  $typeface: "'Titillium Web', sans-serif";
8
- $type-scale: (
9
- h1: type-style(
8
+ $type-scale: type-scale(
9
+ $_theme: 'material',
10
+ $h1: type-style(
10
11
  $font-size: rem(96px),
11
12
  $font-weight: 300,
12
13
  $font-style: normal,
@@ -16,7 +17,7 @@ $type-scale: (
16
17
  $margin-top: rem(28px),
17
18
  $margin-bottom: rem(56px)
18
19
  ),
19
- h2: type-style(
20
+ $h2: type-style(
20
21
  $font-size: rem(60px),
21
22
  $font-weight: 300,
22
23
  $font-style: normal,
@@ -26,7 +27,7 @@ $type-scale: (
26
27
  $margin-top: rem(28px),
27
28
  $margin-bottom: rem(28px)
28
29
  ),
29
- h3: type-style(
30
+ $h3: type-style(
30
31
  $font-size: rem(48px),
31
32
  $font-weight: 400,
32
33
  $font-style: normal,
@@ -36,7 +37,7 @@ $type-scale: (
36
37
  $margin-top: rem(28px),
37
38
  $margin-bottom: 0
38
39
  ),
39
- h4: type-style(
40
+ $h4: type-style(
40
41
  $font-size: rem(34px),
41
42
  $font-weight: 400,
42
43
  $font-style: normal,
@@ -46,7 +47,7 @@ $type-scale: (
46
47
  $margin-top: rem(28px),
47
48
  $margin-bottom: 0
48
49
  ),
49
- h5: type-style(
50
+ $h5: type-style(
50
51
  $font-size: rem(24px),
51
52
  $font-weight: 400,
52
53
  $font-style: normal,
@@ -56,7 +57,7 @@ $type-scale: (
56
57
  $margin-top: rem(28px),
57
58
  $margin-bottom: 0
58
59
  ),
59
- h6: type-style(
60
+ $h6: type-style(
60
61
  $font-size: rem(20px),
61
62
  $font-weight: 600,
62
63
  $font-style: normal,
@@ -66,7 +67,7 @@ $type-scale: (
66
67
  $margin-top: 0,
67
68
  $margin-bottom: 0
68
69
  ),
69
- body-1: type-style(
70
+ $body-1: type-style(
70
71
  $font-size: rem(16px),
71
72
  $font-weight: 400,
72
73
  $font-style: normal,
@@ -76,7 +77,7 @@ $type-scale: (
76
77
  $margin-top: rem(28px),
77
78
  $margin-bottom: rem(16)
78
79
  ),
79
- body-2: type-style(
80
+ $body-2: type-style(
80
81
  $font-size: rem(14px),
81
82
  $font-weight: 400,
82
83
  $font-style: normal,
@@ -84,7 +85,7 @@ $type-scale: (
84
85
  $line-height: rem(20px),
85
86
  $text-transform: none
86
87
  ),
87
- subtitle-1: type-style(
88
+ $subtitle-1: type-style(
88
89
  $font-size: rem(16px),
89
90
  $font-weight: 400,
90
91
  $font-style: normal,
@@ -92,7 +93,7 @@ $type-scale: (
92
93
  $line-height: rem(24px),
93
94
  $text-transform: none
94
95
  ),
95
- subtitle-2: type-style(
96
+ $subtitle-2: type-style(
96
97
  $font-size: rem(14px),
97
98
  $font-weight: 600,
98
99
  $font-style: normal,
@@ -100,7 +101,7 @@ $type-scale: (
100
101
  $line-height: rem(24px),
101
102
  $text-transform: none
102
103
  ),
103
- button: type-style(
104
+ $button: type-style(
104
105
  $font-size: rem(14px),
105
106
  $font-weight: 600,
106
107
  $font-style: normal,
@@ -108,7 +109,7 @@ $type-scale: (
108
109
  $line-height: rem(16px),
109
110
  $text-transform: uppercase
110
111
  ),
111
- caption: type-style(
112
+ $caption: type-style(
112
113
  $font-size: rem(12px),
113
114
  $font-weight: 400,
114
115
  $font-style: normal,
@@ -116,7 +117,7 @@ $type-scale: (
116
117
  $line-height: rem(16px),
117
118
  $text-transform: none
118
119
  ),
119
- overline: type-style(
120
+ $overline: type-style(
120
121
  $font-size: rem(10px),
121
122
  $font-weight: 400,
122
123
  $font-style: normal,
@@ -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} map-clean
27
+ /// @requires {function} clean
28
28
  /// @returns {Map} - Returns the merged maps.
29
29
  @function extend($maps...) {
30
30
  $result: ();
@@ -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
 
@@ -8,7 +8,7 @@
8
8
  /// /* style rules here */
9
9
  /// }
10
10
  /// }
11
- ///
11
+ /// @return {Boolean} - Returns a boolean depending on the scope where it's called
12
12
  @function is-root() {
13
13
  @each $selector in & {
14
14
  @return if($selector == null, true, false);
@@ -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
 
@@ -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);