igniteui-theming 1.1.4 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/sass/bem/_index.scss +36 -2
- package/sass/color/_functions.scss +48 -13
- package/sass/elevations/_functions.scss +10 -0
- package/sass/elevations/_mixins.scss +7 -2
- package/sass/themes/_functions.scss +14 -0
- package/sass/themes/_mixins.scss +23 -2
- package/sass/typography/_functions.scss +37 -0
- package/sass/typography/_mixins.scss +2 -0
package/package.json
CHANGED
package/sass/bem/_index.scss
CHANGED
|
@@ -138,7 +138,7 @@ $bem--sep-mod-val: if(meta.variable-exists(bem--sep-mod-val), $bem--sep-mod-val,
|
|
|
138
138
|
/// @example scss Include a block and an element
|
|
139
139
|
/// @include bem-selector(block, $e:elem); // outputs .block__elem
|
|
140
140
|
/// @example scss Include block, element, and element modifier
|
|
141
|
-
/// @include bem-selector(block, $e:(elem,
|
|
141
|
+
/// @include bem-selector(block, $e:(elem, $mod); // outputs .block__elem-emod
|
|
142
142
|
/// @example scss Include block and block modifier
|
|
143
143
|
/// @include bem-selector(block, $m:mod) // outputs .block--mod
|
|
144
144
|
/// @example scss Include block and modifier value
|
|
@@ -191,8 +191,14 @@ $bem--sep-mod-val: if(meta.variable-exists(bem--sep-mod-val), $bem--sep-mod-val,
|
|
|
191
191
|
|
|
192
192
|
/// Simply unrolls into a class-selector. The main purpose of using this mixin
|
|
193
193
|
/// is to clearly denote the start of a BEM block.
|
|
194
|
-
/// @access public
|
|
194
|
+
/// @access public scss
|
|
195
195
|
/// @param {String} $block - The block name.
|
|
196
|
+
/// @example
|
|
197
|
+
/// @include bem-block(block) {
|
|
198
|
+
/// background: green;
|
|
199
|
+
/// }
|
|
200
|
+
/// // Return
|
|
201
|
+
/// .block { background: green; }
|
|
196
202
|
@mixin bem-block($block) {
|
|
197
203
|
@at-root {
|
|
198
204
|
#{bem-selector($block)} {
|
|
@@ -210,6 +216,14 @@ $bem--sep-mod-val: if(meta.variable-exists(bem--sep-mod-val), $bem--sep-mod-val,
|
|
|
210
216
|
/// @param {String} $elem - The sub-element name.
|
|
211
217
|
/// @param {String} $m - The modifier name.
|
|
212
218
|
/// @param {String} $mod - An alias of `$m`.
|
|
219
|
+
/// @example scss
|
|
220
|
+
/// @include bem-block(block) {
|
|
221
|
+
/// @include bem-elem(element) {
|
|
222
|
+
/// background: blue;
|
|
223
|
+
/// }
|
|
224
|
+
/// }
|
|
225
|
+
/// // Return
|
|
226
|
+
/// .block__element { background: blue; }
|
|
213
227
|
@mixin bem-elem($elem, $m: null, $mod: null, $mods: null) {
|
|
214
228
|
$this: bem--selector-to-string(&);
|
|
215
229
|
$block: bem--extract-block($this);
|
|
@@ -272,6 +286,14 @@ $bem--sep-mod-val: if(meta.variable-exists(bem--sep-mod-val), $bem--sep-mod-val,
|
|
|
272
286
|
/// that should mean isn't clear.
|
|
273
287
|
/// @access public
|
|
274
288
|
/// @param {String} $mod - The modifier name.
|
|
289
|
+
/// @example scss
|
|
290
|
+
/// @include bem-block(block) {
|
|
291
|
+
/// @include bem-mod(modifier) {
|
|
292
|
+
/// background: red;
|
|
293
|
+
/// }
|
|
294
|
+
/// }
|
|
295
|
+
/// // Return
|
|
296
|
+
/// .block--modifier { background: red; }
|
|
275
297
|
@mixin bem-mod($mod) {
|
|
276
298
|
$skip: false;
|
|
277
299
|
$this: bem--selector-to-string(&);
|
|
@@ -300,6 +322,18 @@ $bem--sep-mod-val: if(meta.variable-exists(bem--sep-mod-val), $bem--sep-mod-val,
|
|
|
300
322
|
/// or block element when two or more modifiers are applied in tandem
|
|
301
323
|
/// @access public
|
|
302
324
|
/// @param {List} $mods - A list of modifiers
|
|
325
|
+
/// @example scss
|
|
326
|
+
/// @include bem-block(block) {
|
|
327
|
+
/// @include bem-mods(error, warn) {
|
|
328
|
+
/// position: absolute;
|
|
329
|
+
/// }
|
|
330
|
+
/// }
|
|
331
|
+
/// // Return
|
|
332
|
+
/// .block--error,
|
|
333
|
+
/// .block--warn {
|
|
334
|
+
/// position: absolute;
|
|
335
|
+
/// }
|
|
336
|
+
///
|
|
303
337
|
@mixin bem-mods($mods...) {
|
|
304
338
|
$this: bem--selector-to-string(&);
|
|
305
339
|
$mod-classes: ();
|
|
@@ -15,6 +15,10 @@ $_enhanced-accessibility: false;
|
|
|
15
15
|
/// @access public
|
|
16
16
|
/// @group color
|
|
17
17
|
/// @param {Boolean} $enhanced-accessibility [null] - Enables features like color blind palettes.
|
|
18
|
+
/// @example scss
|
|
19
|
+
/// .enhanced-accessibility {
|
|
20
|
+
/// @include configure-colors(true);
|
|
21
|
+
/// }
|
|
18
22
|
@mixin configure-colors($enhanced-accessibility: null) {
|
|
19
23
|
@if $enhanced-accessibility {
|
|
20
24
|
$_enhanced-accessibility: $enhanced-accessibility !global;
|
|
@@ -28,22 +32,25 @@ $_enhanced-accessibility: false;
|
|
|
28
32
|
/// @param {Color} $secondary - The secondary color used to generate the secondary color palette (required).
|
|
29
33
|
/// @param {Color} $surface - The color used as a background in components, such as cards, sheets, and menus (required).
|
|
30
34
|
/// @param {Color} $gray [null] - The color used for generating the grayscale palette (optional).
|
|
31
|
-
/// @param {Color} $info [
|
|
32
|
-
/// @param {Color} $success [
|
|
33
|
-
/// @param {Color} $warn [
|
|
34
|
-
/// @param {Color} $error [
|
|
35
|
+
/// @param {Color} $info [#1377d5] - The information color used throughout the application (optional).
|
|
36
|
+
/// @param {Color} $success [#4eb862] - The success color used throughout the application (optional).
|
|
37
|
+
/// @param {Color} $warn [#faa419] - The warning color used throughout the application (optional).
|
|
38
|
+
/// @param {Color} $error [#ff134a] - The error color used throughout the application (optional).
|
|
35
39
|
/// @param {String} $variant [null] - Used internally (optional).
|
|
36
40
|
/// @requires {function} shades
|
|
37
41
|
/// @returns {Map} - A map consisting of color shades for the passed base colors (primary, secondary, gray, etc).
|
|
42
|
+
/// @example scss
|
|
43
|
+
/// // $primary, $secondary, $surface are required parameters.
|
|
44
|
+
/// $my-palette: palette($primary: #09f,$secondary #222, $surface: #fff);
|
|
38
45
|
@function palette(
|
|
39
46
|
$primary,
|
|
40
47
|
$secondary,
|
|
41
48
|
$surface,
|
|
42
49
|
$gray: null,
|
|
43
|
-
$info:
|
|
44
|
-
$success:
|
|
45
|
-
$warn:
|
|
46
|
-
$error:
|
|
50
|
+
$info: #1377d5,
|
|
51
|
+
$success: #4eb862,
|
|
52
|
+
$warn: #faa419,
|
|
53
|
+
$error: #ff134a,
|
|
47
54
|
$variant: null,
|
|
48
55
|
) {
|
|
49
56
|
$color-shades: types.$IColorShades;
|
|
@@ -78,10 +85,12 @@ $_enhanced-accessibility: false;
|
|
|
78
85
|
/// @param {String} $name - The name of the color.
|
|
79
86
|
/// @param {Color} $color - The base color used to generate the palette.
|
|
80
87
|
/// @param {List} $shades - The list of shades.
|
|
81
|
-
/// @param {Color} $surface [null] - The surface color.
|
|
88
|
+
/// @param {Color} $surface [null] - The surface color. Useful when generating shades of gray (optional).
|
|
82
89
|
/// @requires {function} shade
|
|
83
90
|
/// @requires {function} text-contrast
|
|
84
|
-
/// @returns {Map} - A map consisting of hsla color shades and
|
|
91
|
+
/// @returns {Map} - A map consisting of hsla color shades and their respective contrast colors.
|
|
92
|
+
/// @example scss
|
|
93
|
+
/// $special-color-shades: shades('accent', #09f, (50,100,200,300,400,500,600,700,800,900))
|
|
85
94
|
@function shades(
|
|
86
95
|
$name,
|
|
87
96
|
$color,
|
|
@@ -111,7 +120,7 @@ $_enhanced-accessibility: false;
|
|
|
111
120
|
/// @param {String} $name - The base color name (primary, secondary, etc.) to be used to generate a color variant.
|
|
112
121
|
/// @param {Color} $color - The color value to be used to generate a color shade.
|
|
113
122
|
/// @param {String | Number} $shade - The color shade variant.
|
|
114
|
-
/// @param {Color} $surface [null] - The surface color.
|
|
123
|
+
/// @param {Color} $surface [null] - The surface color. Useful when generating a shade of gray (optional).
|
|
115
124
|
/// @require {function} luminance
|
|
116
125
|
/// @require {function} to-fixed
|
|
117
126
|
/// @returns {Map} - A map containing a list of HSL values and a raw color value.
|
|
@@ -156,6 +165,9 @@ $_enhanced-accessibility: false;
|
|
|
156
165
|
}
|
|
157
166
|
}
|
|
158
167
|
|
|
168
|
+
// $special-color-shades: shades('accent', #09f, (50,100,200,300,400,500,600,700,800,900));
|
|
169
|
+
// @debug $special-color-shades;
|
|
170
|
+
|
|
159
171
|
/// Retrieves a color from a color palette.
|
|
160
172
|
/// @access public
|
|
161
173
|
/// @group Palettes
|
|
@@ -164,6 +176,15 @@ $_enhanced-accessibility: false;
|
|
|
164
176
|
/// @param {Number | String} $variant [500] - The target color shade from the color palette.
|
|
165
177
|
/// @param {Number} $opacity [null] - Optional opacity to apply to the color shade.
|
|
166
178
|
/// @returns {Color | String} - The raw color shade or CSS variable reference from the palette.
|
|
179
|
+
/// @example scss
|
|
180
|
+
/// // No palette
|
|
181
|
+
/// .my-component-1 {
|
|
182
|
+
/// background: color($color: 'primary', $variant: 200);
|
|
183
|
+
/// }
|
|
184
|
+
/// // Using certain palette and adding .5% opacity to the color variant
|
|
185
|
+
/// .my-component-2 {
|
|
186
|
+
/// background: color($my-palette, 'primary', 200, .5);
|
|
187
|
+
/// }
|
|
167
188
|
@function color($palette: null, $color: 'primary', $variant: 500, $opacity: null) {
|
|
168
189
|
$c: map.get($palette or types.$IPalette, #{$color});
|
|
169
190
|
$a: var(--ig-#{$color}-a);
|
|
@@ -190,7 +211,7 @@ $_enhanced-accessibility: false;
|
|
|
190
211
|
@return rgba(map.get($c, $variant), $alpha: if($opacity, $opacity, 1));
|
|
191
212
|
}
|
|
192
213
|
|
|
193
|
-
/// Retrieves a contrast text color for a given color from a color palette.
|
|
214
|
+
/// Retrieves a contrast text color for a given color variant from a color palette.
|
|
194
215
|
/// @access public
|
|
195
216
|
/// @group Palettes
|
|
196
217
|
/// @param {Map} $palette [null] - The source palette map (optional).
|
|
@@ -198,6 +219,11 @@ $_enhanced-accessibility: false;
|
|
|
198
219
|
/// @param {Number | String} $variant [500] - The target color shade from the color palette.
|
|
199
220
|
/// @requires {function} color
|
|
200
221
|
/// @returns {Color | String} - The raw contrast color shade or CSS variable from the palette.
|
|
222
|
+
/// @example scss without passing a palette
|
|
223
|
+
/// .my-component {
|
|
224
|
+
/// background: color($color: 'primary', $variant: 200);
|
|
225
|
+
/// color: contrast-color($color: 'primary', $variant: 200);
|
|
226
|
+
/// }
|
|
201
227
|
@function contrast-color($palette: null, $color: primary, $variant: 500) {
|
|
202
228
|
@return color($palette, $color, #{$variant}-contrast);
|
|
203
229
|
}
|
|
@@ -213,6 +239,11 @@ $_enhanced-accessibility: false;
|
|
|
213
239
|
/// @returns {Color} - Returns either white, black, or the provided foreground
|
|
214
240
|
/// color if it meets the required contrast level.
|
|
215
241
|
/// @link https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html
|
|
242
|
+
/// @example scss
|
|
243
|
+
/// .my-component {
|
|
244
|
+
/// background: #09f
|
|
245
|
+
/// color: text-contrast(#09f)
|
|
246
|
+
/// }
|
|
216
247
|
@function text-contrast(
|
|
217
248
|
$background,
|
|
218
249
|
$foreground: white,
|
|
@@ -232,7 +263,7 @@ $_enhanced-accessibility: false;
|
|
|
232
263
|
);
|
|
233
264
|
|
|
234
265
|
@if not($level) {
|
|
235
|
-
@error
|
|
266
|
+
@error '$contrast must be \'A\', \'AA\', or \'AAA\'';
|
|
236
267
|
}
|
|
237
268
|
|
|
238
269
|
$candidates: ();
|
|
@@ -302,6 +333,8 @@ $_enhanced-accessibility: false;
|
|
|
302
333
|
/// @param {Color} $foreground - The foreground color.
|
|
303
334
|
/// @require {function} luminance
|
|
304
335
|
/// @require {function} to-fixed
|
|
336
|
+
/// @example scss
|
|
337
|
+
/// contrast(#09f, #000);
|
|
305
338
|
/// @returns {Number} - The contrast ratio between the background and foreground colors.
|
|
306
339
|
@function contrast($background, $foreground) {
|
|
307
340
|
$backLum: luminance($background) + .05;
|
|
@@ -315,6 +348,8 @@ $_enhanced-accessibility: false;
|
|
|
315
348
|
/// @access public
|
|
316
349
|
/// @group Color
|
|
317
350
|
/// @param {Color} $color - The color to calculate luminance for.
|
|
351
|
+
/// @example scss
|
|
352
|
+
/// luminance(#09f);
|
|
318
353
|
/// @returns {Number | String} - The calculated luminance of a given color
|
|
319
354
|
@function luminance($color) {
|
|
320
355
|
@if meta.type-of($color) == 'color' {
|
|
@@ -51,6 +51,12 @@ $factor: var(--ig-elevation-factor, 1);
|
|
|
51
51
|
/// Sorts out a list of valid only box-shadows.
|
|
52
52
|
/// @access public
|
|
53
53
|
/// @param {List} $shadows - A list of shadow values.
|
|
54
|
+
/// @example scss
|
|
55
|
+
/// box-shadow((0 0 2px 3px black, 0 6px 9px orange));
|
|
56
|
+
/// // Return
|
|
57
|
+
/// box-shadow:
|
|
58
|
+
/// 0 0 calc(--ig-elevation-factor * 2px) calc(--ig-elevation-factor * 3px) black,
|
|
59
|
+
/// 0 calc(--ig-elevation-factor * 6px) calc(--ig-elevation-factor * 9px) orange;
|
|
54
60
|
/// @return {List} - The transformed shadow list.
|
|
55
61
|
/// @requires {function} _is-shadow
|
|
56
62
|
/// @requires {function} _transform-shadow
|
|
@@ -82,6 +88,10 @@ $factor: var(--ig-elevation-factor, 1);
|
|
|
82
88
|
/// Gets a CSS elevation variable by name.
|
|
83
89
|
/// @access public
|
|
84
90
|
/// @param {String} $name - The name of the shadow.
|
|
91
|
+
/// @example scss
|
|
92
|
+
/// .my-class {
|
|
93
|
+
/// box-shadow: elevation(5);
|
|
94
|
+
/// }
|
|
85
95
|
/// @return {String} - The CSS elevation variable
|
|
86
96
|
@function elevation($name) {
|
|
87
97
|
@return var(--ig-elevation-#{$name});
|
|
@@ -7,14 +7,15 @@
|
|
|
7
7
|
/// Generates CSS variables for a given elevations map.
|
|
8
8
|
/// @access public
|
|
9
9
|
/// @param {Map} $elevations - The elevations map to use to generate CSS variables.
|
|
10
|
-
///
|
|
11
10
|
/// @example scss Generate CSS variables for elevations.
|
|
12
11
|
/// $elevations: (
|
|
13
12
|
/// small: box-shadow(0 .125rem .25rem rgba(0 0 0 / 75%)),
|
|
14
13
|
/// medium: box-shadow(0 .25rem .5rem rgba(0 0 0 / 85%)),
|
|
15
14
|
/// large: box-shadow(0 .75rem 1rem rgba(0 0 0 / 95%))
|
|
16
15
|
/// );
|
|
17
|
-
///
|
|
16
|
+
/// :root {
|
|
17
|
+
/// @include elevations($elevations);
|
|
18
|
+
/// }
|
|
18
19
|
/// @require {function} is-root
|
|
19
20
|
@mixin elevations($elevations) {
|
|
20
21
|
$scope: if(is-root(), ':root', '&');
|
|
@@ -29,6 +30,10 @@
|
|
|
29
30
|
/// Includes box-shadow styles for an elevation by name
|
|
30
31
|
/// @access public
|
|
31
32
|
/// @param {String} $name - The name of the shadow.
|
|
33
|
+
/// @example scss Include a box shadow by its name.
|
|
34
|
+
/// .my-class {
|
|
35
|
+
/// @include elevation(small);
|
|
36
|
+
/// }
|
|
32
37
|
@mixin elevation($name) {
|
|
33
38
|
box-shadow: var(--ig-elevation-#{$name});
|
|
34
39
|
}
|
|
@@ -131,6 +131,8 @@
|
|
|
131
131
|
/// @param {Number} $sm - The preferred value when the component's size is small.
|
|
132
132
|
/// @param {Number} $md [$sm] - The preferred value when the component's size is medium.
|
|
133
133
|
/// @param {Number} $lg [$md] - The preferred value when the component's size is large.
|
|
134
|
+
/// @example
|
|
135
|
+
/// --size: #{sizable(rem(40px), rem(64px), rem(88px))};
|
|
134
136
|
/// @return {Function} - The evaluated value.
|
|
135
137
|
@function sizable($sm, $md: $sm, $lg: $md) {
|
|
136
138
|
@return max(
|
|
@@ -147,6 +149,10 @@
|
|
|
147
149
|
/// @param {Number} $md [$sm] - The preferred value when the component's size is medium.
|
|
148
150
|
/// @param {Number} $lg [$md] - The preferred value when the component's size is large.
|
|
149
151
|
/// @param {Number} $dir [null] - The preferred direction - inline or block.
|
|
152
|
+
/// @example
|
|
153
|
+
/// .my-component {
|
|
154
|
+
/// padding: pad(4px, 8px, 16px);
|
|
155
|
+
/// }
|
|
150
156
|
/// @return {Function} - The evaluated value.
|
|
151
157
|
@function pad($sm, $md: $sm, $lg: $md, $dir: null) {
|
|
152
158
|
$spacing: if($dir, --ig-spacing-#{$dir}, --ig-spacing);
|
|
@@ -164,6 +170,10 @@
|
|
|
164
170
|
/// @param {Number} $sm - The preferred value when the component's size is small.
|
|
165
171
|
/// @param {Number} $md [$sm] - The preferred value when the component's size is medium.
|
|
166
172
|
/// @param {Number} $lg [$md] - The preferred value when the component's size is large.
|
|
173
|
+
/// @example
|
|
174
|
+
/// .my-component {
|
|
175
|
+
/// padding: pad-inline(4px, 8px, 16px);
|
|
176
|
+
/// }
|
|
167
177
|
/// @return {Function} - The evaluated value.
|
|
168
178
|
@function pad-inline($sm, $md: $sm, $lg: $md) {
|
|
169
179
|
@return pad($sm, $md, $lg, $dir: inline);
|
|
@@ -175,6 +185,10 @@
|
|
|
175
185
|
/// @param {Number} $sm - The preferred value when the component's size is small.
|
|
176
186
|
/// @param {Number} $md [$sm] - The preferred value when the component's size is medium.
|
|
177
187
|
/// @param {Number} $lg [$md] - The preferred value when the component's size is large.
|
|
188
|
+
/// @example
|
|
189
|
+
/// .my-component {
|
|
190
|
+
/// padding: pad-block(4px, 8px, 16px);
|
|
191
|
+
/// }
|
|
178
192
|
/// @return {Function} - The evaluated value.
|
|
179
193
|
@function pad-block($sm, $md: $sm, $lg: $md) {
|
|
180
194
|
@return pad($sm, $md, $lg, $dir: block);
|
package/sass/themes/_mixins.scss
CHANGED
|
@@ -22,6 +22,7 @@ $ignored-keys: ('name', 'palette', 'variant', 'selector');
|
|
|
22
22
|
/// @require {mixin} css-vars
|
|
23
23
|
@mixin css-vars-from-theme($theme, $name, $ignored: $ignored-keys) {
|
|
24
24
|
$themes: map.get($theme, 'themes');
|
|
25
|
+
$prefix: map.get($theme, 'prefix');
|
|
25
26
|
|
|
26
27
|
// This is here only because the button theme consists of 4 nested themes.
|
|
27
28
|
@if $themes and meta.type-of($themes) == 'map' {
|
|
@@ -31,8 +32,10 @@ $ignored-keys: ('name', 'palette', 'variant', 'selector');
|
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
@each $key, $value in map.remove($theme, $ignored...) {
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
$variable: if($prefix, #{$prefix}-#{$key}, #{$key});
|
|
36
|
+
|
|
37
|
+
@if meta.type-of($value) != 'map' and $key != 'prefix' {
|
|
38
|
+
--#{$variable}: var(--#{$name}-#{$key}, #{$value});
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
}
|
|
@@ -43,6 +46,14 @@ $ignored-keys: ('name', 'palette', 'variant', 'selector');
|
|
|
43
46
|
/// @param {map} $theme - The component theme to be used.
|
|
44
47
|
/// @param {map} $scope [null] - The CSS variables scope to be used. (optional)
|
|
45
48
|
/// @requires {mixin} css-vars-from-theme
|
|
49
|
+
/// @example scss Convert grid theme colors to css variables
|
|
50
|
+
/// $my-grid-theme grid-theme(
|
|
51
|
+
/// $header-background: red,
|
|
52
|
+
/// $content-background: #222
|
|
53
|
+
/// );
|
|
54
|
+
/// .my-grid {
|
|
55
|
+
/// @include css-vars($my-grid-theme);
|
|
56
|
+
/// }
|
|
46
57
|
@mixin css-vars($theme, $scope: null) {
|
|
47
58
|
$s: map.get($theme, 'selector');
|
|
48
59
|
$n: map.get($theme, 'name');
|
|
@@ -69,6 +80,8 @@ $ignored-keys: ('name', 'palette', 'variant', 'selector');
|
|
|
69
80
|
/// @param {Number} $radius - The preferred value.
|
|
70
81
|
/// @param {Number} $min [rem(0)] - The minimum value.
|
|
71
82
|
/// @param {Number} $max [$radius] - The maximum allowed value.
|
|
83
|
+
/// @example scss
|
|
84
|
+
/// @include border-radius(4px);
|
|
72
85
|
@mixin border-radius($radius, $min: #{rem(0)}, $max: $radius) {
|
|
73
86
|
border-radius: clamp(#{$min}, #{calc(var(--ig-radius-factor) * #{$radius})}, #{$max});
|
|
74
87
|
}
|
|
@@ -92,6 +105,10 @@ $ignored-keys: ('name', 'palette', 'variant', 'selector');
|
|
|
92
105
|
/// This won't work on display flex elements.
|
|
93
106
|
/// @group utilities
|
|
94
107
|
/// @access public
|
|
108
|
+
/// @example scss
|
|
109
|
+
/// .my-class {
|
|
110
|
+
/// @include ellipsis();
|
|
111
|
+
/// }
|
|
95
112
|
@mixin ellipsis() {
|
|
96
113
|
white-space: nowrap;
|
|
97
114
|
text-overflow: ellipsis;
|
|
@@ -121,6 +138,10 @@ $ignored-keys: ('name', 'palette', 'variant', 'selector');
|
|
|
121
138
|
/// Adds the required CSS properties so that the scope can react to size changes.
|
|
122
139
|
/// @group themes
|
|
123
140
|
/// @access public
|
|
141
|
+
/// @example scss - Sample usage
|
|
142
|
+
/// .my-component {
|
|
143
|
+
/// @include sizable();
|
|
144
|
+
/// }
|
|
124
145
|
@mixin sizable() {
|
|
125
146
|
--is-large: clamp(0, (var(--component-size, 1) + 1) - var(--ig-size-large, 3), 1);
|
|
126
147
|
--is-medium:
|
|
@@ -15,6 +15,10 @@ $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
|
+
/// @example
|
|
19
|
+
/// .my-component {
|
|
20
|
+
/// margin: em(10px) em(5px);
|
|
21
|
+
/// }
|
|
18
22
|
/// @return {number} - Returns the pixels value converted to em.
|
|
19
23
|
@function em($pixels, $context: $browser-context) {
|
|
20
24
|
@if math.is-unitless($pixels) {
|
|
@@ -32,6 +36,10 @@ $browser-context: 16px;
|
|
|
32
36
|
/// @access public
|
|
33
37
|
/// @param {number|string} $pixels - The pixel value to be converted.
|
|
34
38
|
/// @param {number|string} $context [$browser-context] - The base context to convert against.
|
|
39
|
+
/// @example
|
|
40
|
+
/// .my-component {
|
|
41
|
+
/// margin: rem(10px) rem(5px);
|
|
42
|
+
/// }
|
|
35
43
|
/// @return {number} - Returns the pixels value converted to rem.
|
|
36
44
|
@function rem($pixels, $context: $browser-context) {
|
|
37
45
|
@if math.is-unitless($pixels) {
|
|
@@ -49,6 +57,10 @@ $browser-context: 16px;
|
|
|
49
57
|
/// @access public
|
|
50
58
|
/// @param {number|string} $num - The relative value to be converted.
|
|
51
59
|
/// @param {number|string} $context [$browser-context] - The base context to convert against.
|
|
60
|
+
/// @example
|
|
61
|
+
/// .my-component {
|
|
62
|
+
/// margin: px(3.23rem);
|
|
63
|
+
/// }
|
|
52
64
|
/// @return {number} - Returns the relative value converted to pixels.
|
|
53
65
|
@function px($num, $context: $browser-context) {
|
|
54
66
|
@if meta.type-of($num) == 'number' {
|
|
@@ -70,6 +82,19 @@ $browser-context: 16px;
|
|
|
70
82
|
/// @param {Number} $margin-top [0] - The margin-top property of the type style.
|
|
71
83
|
/// @param {Number} $margin-bottom [0] - The margin-bottom property of the type style.
|
|
72
84
|
/// @requires $ITypeStyle
|
|
85
|
+
/// @example
|
|
86
|
+
/// $main_navigation: type-style(
|
|
87
|
+
/// $font-size: rem(14px),
|
|
88
|
+
/// $font-weight: 600,
|
|
89
|
+
/// $letter-spacing: rem(.1px),
|
|
90
|
+
/// $line-height: rem(14px),
|
|
91
|
+
/// $text-transform: none,
|
|
92
|
+
/// );
|
|
93
|
+
///
|
|
94
|
+
/// // Use the type-style() mixin to consume the new type style produced from the type-style() function.
|
|
95
|
+
/// .main-nav {
|
|
96
|
+
/// @include type-style($main_navigation);
|
|
97
|
+
/// }
|
|
73
98
|
/// @returns {Map} - A map of all defined type style properties.
|
|
74
99
|
@function type-style($args...) {
|
|
75
100
|
$keywords: meta.keywords($args);
|
|
@@ -111,6 +136,18 @@ $browser-context: 16px;
|
|
|
111
136
|
/// @param {Map} $overline - A map containing type style properties as produces by the type-style function.
|
|
112
137
|
/// @param {String} $_theme [null] - The theme related to this type scale. Internal use only.
|
|
113
138
|
/// @requires $ITypeScale
|
|
139
|
+
/// @example
|
|
140
|
+
/// // First define type styles to use
|
|
141
|
+
/// $my-body-1: type-style(
|
|
142
|
+
/// $font-size: rem(14px),
|
|
143
|
+
/// );
|
|
144
|
+
///
|
|
145
|
+
/// // Use the type style map to override one of the existing maps
|
|
146
|
+
/// $type-scale: type-scale(
|
|
147
|
+
/// ...
|
|
148
|
+
/// $body-1: $my-body-1,
|
|
149
|
+
/// ...
|
|
150
|
+
/// );
|
|
114
151
|
/// @returns {Map} - A map of all defined type scales.
|
|
115
152
|
@function type-scale($_theme: null, $args...) {
|
|
116
153
|
$style_fn: meta.get-function('type-style');
|
|
@@ -108,6 +108,8 @@
|
|
|
108
108
|
/// @requires {mixin} type-style-vars
|
|
109
109
|
/// @requires {mixin} type-style-classes
|
|
110
110
|
/// @requires {mixin} type-style-elements
|
|
111
|
+
/// @example scss
|
|
112
|
+
/// @include typography('Roboto', $my-type-scale);
|
|
111
113
|
@mixin typography($font-family, $type-scale) {
|
|
112
114
|
$scope: if(is-root(), ':root', '&');
|
|
113
115
|
|