@nice-digital/nds-core 1.3.2 → 1.3.5-alpha.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 +5 -5
- package/scss/colours/_index.scss +2 -0
- package/scss/{settings/_settings-colours-nice.scss → colours/_nice-brand.scss} +17 -17
- package/scss/{settings/_settings-colours-semantic.scss → colours/_semantic.scss} +58 -58
- package/scss/{helpers/_helpers-focus.scss → focus/_index.scss} +15 -11
- package/scss/{helpers/_helpers-glyphs.scss → glyphs/_index.scss} +10 -10
- package/scss/layout/_index.scss +43 -0
- package/scss/media-queries/_index.scss +29 -0
- package/scss/media-queries/vendor/_mq.scss +307 -0
- package/scss/{settings/_settings-modular-scale.scss → modular-scale/_index.scss} +6 -6
- package/scss/settings/_settings-colour-alias-tokens.scss +53 -0
- package/scss/settings/_settings-colour-global-tokens.scss +44 -0
- package/scss/spacing/_index.scss +31 -0
- package/scss/typography/{_typography-headings.scss → _headings.scss} +22 -16
- package/scss/typography/_helpers.scss +171 -0
- package/scss/typography/_index.scss +4 -0
- package/scss/typography/_links.scss +76 -0
- package/scss/{settings/_settings-typography.scss → typography/_settings.scss} +42 -38
- package/scss/{helpers/_helpers-utils.scss → utils/_index.scss} +16 -12
- package/scss/{vendor/_vendor-is.scss → utils/vendor/_is.scss} +0 -0
- package/scss/{vendor/_vendor-math.scss → utils/vendor/_math.scss} +0 -0
- package/scss/visibility/_index.scss +65 -0
- package/scss/core.scss +0 -4
- package/scss/helpers/_helpers-clearfix.scss +0 -23
- package/scss/helpers/_helpers-lists.scss +0 -45
- package/scss/helpers/_helpers-print.scss +0 -35
- package/scss/helpers/_helpers-text.scss +0 -21
- package/scss/helpers/_helpers-visibility.scss +0 -37
- package/scss/helpers/_helpers.scss +0 -2
- package/scss/layout/_layout-container.scss +0 -12
- package/scss/layout/_layout.scss +0 -1
- package/scss/settings/_settings-breakpoints.scss +0 -25
- package/scss/settings/_settings-glyphs.scss +0 -3
- package/scss/settings/_settings-layout.scss +0 -15
- package/scss/settings/_settings-mq.scss +0 -17
- package/scss/settings/_settings-print.scss +0 -5
- package/scss/settings/_settings-spacing.scss +0 -43
- package/scss/settings/_settings.scss +0 -4
- package/scss/typography/_typography-helpers.scss +0 -148
- package/scss/typography/_typography-links.scss +0 -73
- package/scss/typography/_typography.scss +0 -1
- package/scss/vendor/_vendor.scss +0 -2
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
@use "settings" as typography-settings;
|
|
2
|
+
@use "../spacing";
|
|
3
|
+
@use "../colours";
|
|
4
|
+
@use "../utils";
|
|
5
|
+
|
|
6
|
+
////
|
|
7
|
+
/// @group Typography
|
|
8
|
+
////
|
|
9
|
+
|
|
10
|
+
/// Gets a font family from the `$font-families` map, given a name
|
|
11
|
+
/// @param {String} $stack The stack name e.g. sans, serif or mono
|
|
12
|
+
/// @since 0.1.0
|
|
13
|
+
@function get-font-family($stack) {
|
|
14
|
+
$result: map-get(typography-settings.$font-families, $stack);
|
|
15
|
+
@return unquote($result);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/// Gets a numeric scale
|
|
19
|
+
/// @param $scale {Integer|Name} The integer ratio or named font-size.
|
|
20
|
+
/// @since 0.1.0
|
|
21
|
+
@function get-scale-integer($scale) {
|
|
22
|
+
@if map-has-key(typography-settings.$named-font-sizes, $scale) {
|
|
23
|
+
@return map-get(typography-settings.$named-font-sizes, $scale);
|
|
24
|
+
} @else if is-integer($scale) {
|
|
25
|
+
@return $scale;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@error '`$scale` must either be an integer or exist as a named font size in `$named-font-sizes`';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/// Gets a numeric font size (in px) from a given scale multiplier.
|
|
32
|
+
/// Usually not used directly - the font-size or font mixin is usually used instead.
|
|
33
|
+
/// @param $scale {Integer|Name} The integer ratio or named font-size.
|
|
34
|
+
/// @return {Number} Numeric font size (in px)
|
|
35
|
+
/// @example
|
|
36
|
+
/// $font-size: get-font-size(2)
|
|
37
|
+
/// @example
|
|
38
|
+
/// $font-size: get-font-size(h1)
|
|
39
|
+
/// @since 0.1.0
|
|
40
|
+
@function get-font-size($scale) {
|
|
41
|
+
$scale-integer: get-scale-integer($scale);
|
|
42
|
+
$font-map: map-get(typography-settings.$font-sizes, $scale-integer);
|
|
43
|
+
@return map-get($font-map, fs);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/// Gets a numeric line height (in px) from a given scale multiplier.
|
|
47
|
+
/// Usually not used directly - the font-size or font mixin is usually used instead.
|
|
48
|
+
/// @param $scale {Integer|Name} The integer ratio or named font-size.
|
|
49
|
+
/// @return {Number} Numeric line-height (in px)
|
|
50
|
+
/// @example
|
|
51
|
+
/// $line-height: get-line-height(2)
|
|
52
|
+
/// @example
|
|
53
|
+
/// $line-height: get-line-height(h1)
|
|
54
|
+
/// @since 0.1.0
|
|
55
|
+
@function get-line-height($scale) {
|
|
56
|
+
$scale-integer: get-scale-integer($scale);
|
|
57
|
+
$font-map: map-get(typography-settings.$font-sizes, $scale-integer);
|
|
58
|
+
@return map-get($font-map, lh);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/// Applies font size and line-height for the given scale.
|
|
62
|
+
/// @param $scale {Integer|Name} The integer ratio or named font-size.
|
|
63
|
+
/// @param $important {Boolean} Whether to add an important declaration to the CSS rules.
|
|
64
|
+
/// @example
|
|
65
|
+
/// .test {
|
|
66
|
+
/// @include font-size(-2);
|
|
67
|
+
/// }
|
|
68
|
+
/// @example
|
|
69
|
+
/// .test {
|
|
70
|
+
/// @include font-size(h1, true);
|
|
71
|
+
/// }
|
|
72
|
+
/// @since 0.1.0
|
|
73
|
+
@mixin font-size($scale: 0, $important: false) {
|
|
74
|
+
$font-size: get-font-size($scale);
|
|
75
|
+
$line-height: get-line-height($scale);
|
|
76
|
+
|
|
77
|
+
@if $important {
|
|
78
|
+
font-size: utils.rem($font-size) !important;
|
|
79
|
+
line-height: utils.rem($line-height) !important;
|
|
80
|
+
} @else {
|
|
81
|
+
font-size: utils.rem($font-size);
|
|
82
|
+
line-height: utils.rem($line-height);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/// Nice font: includes font size, line height, and margins.
|
|
87
|
+
/// @param $scale {Integer|Name} The integer ratio or named font-size.
|
|
88
|
+
/// @param $important {Boolean} Whether to add an important declaration to the CSS rules.
|
|
89
|
+
/// @example
|
|
90
|
+
/// .test {
|
|
91
|
+
/// @include font(3);
|
|
92
|
+
/// }
|
|
93
|
+
/// @example
|
|
94
|
+
/// .test {
|
|
95
|
+
/// @include font(h1, true);
|
|
96
|
+
/// }
|
|
97
|
+
/// @since 0.1.0
|
|
98
|
+
@mixin font($scale, $important: false) {
|
|
99
|
+
$scale-integer: get-scale-integer($scale);
|
|
100
|
+
$font-map: map-get(typography-settings.$font-sizes, $scale-integer);
|
|
101
|
+
@include font-size($scale, $important);
|
|
102
|
+
|
|
103
|
+
@if $important {
|
|
104
|
+
margin-bottom: utils.rem(map-get($font-map, mb)) !important;
|
|
105
|
+
margin-top: utils.rem(map-get($font-map, mt)) !important;
|
|
106
|
+
} @else {
|
|
107
|
+
margin-bottom: utils.rem(map-get($font-map, mb));
|
|
108
|
+
margin-top: utils.rem(map-get($font-map, mt));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/// Default paragraph style
|
|
113
|
+
/// @since 0.5.2
|
|
114
|
+
@mixin p {
|
|
115
|
+
@include font(p);
|
|
116
|
+
font-feature-settings: 'kern', 'onum', 'liga';
|
|
117
|
+
font-weight: normal;
|
|
118
|
+
max-width: 66ch;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/// Lead paragraph style
|
|
122
|
+
/// @since 0.2.12
|
|
123
|
+
@mixin lead {
|
|
124
|
+
@include font(lead);
|
|
125
|
+
font-weight: normal;
|
|
126
|
+
max-width: 66ch;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/// Base list style
|
|
130
|
+
/// @since 0.1.0
|
|
131
|
+
@mixin list {
|
|
132
|
+
font-feature-settings: 'kern', 'onum', 'liga';
|
|
133
|
+
margin-left: utils.rem(spacing.$medium);
|
|
134
|
+
max-width: 66ch;
|
|
135
|
+
padding: 0;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/// Text truncate
|
|
139
|
+
/// Requires inline-block or block for proper styling
|
|
140
|
+
/// @since 0.1.0
|
|
141
|
+
@mixin text-truncate {
|
|
142
|
+
overflow: hidden;
|
|
143
|
+
text-overflow: ellipsis;
|
|
144
|
+
white-space: nowrap;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/// Set and element to display as block and align
|
|
148
|
+
/// centrally via auto left/right margins
|
|
149
|
+
/// @since 0.1.0
|
|
150
|
+
@mixin center-block {
|
|
151
|
+
display: block;
|
|
152
|
+
margin-left: auto;
|
|
153
|
+
margin-right: auto;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// TODO: default-error-style probably belongs elsewhere?
|
|
157
|
+
|
|
158
|
+
/// The highlight style used for elements like inputs and textareas
|
|
159
|
+
/// if there's an error on the field
|
|
160
|
+
/// @param {Boolean} $rounded whether to use box shadow for border (outline can't be styled to have radius corners)
|
|
161
|
+
/// @output default styling for form elements in an errored state
|
|
162
|
+
/// @since 1.0
|
|
163
|
+
@mixin default-error-style($rounded: false) {
|
|
164
|
+
@if $rounded {
|
|
165
|
+
box-shadow: 0 0 0 utils.rem(spacing.$x-small) colours.$error;
|
|
166
|
+
outline: spacing.$x-small solid transparent;
|
|
167
|
+
outline-offset: spacing.$x-small;
|
|
168
|
+
} @else {
|
|
169
|
+
outline: utils.rem(spacing.$x-small) solid colours.$error;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
@use "../colours";
|
|
2
|
+
@use "../focus";
|
|
3
|
+
|
|
4
|
+
////
|
|
5
|
+
/// @group Typography
|
|
6
|
+
////
|
|
7
|
+
|
|
8
|
+
/// Default link style for use on a normal (light) background
|
|
9
|
+
/// @since 0.3.1
|
|
10
|
+
@mixin link-default {
|
|
11
|
+
color: colours.$link;
|
|
12
|
+
-webkit-tap-highlight-color: rgba(colours.$focus, 0.333);
|
|
13
|
+
text-decoration: underline;
|
|
14
|
+
text-decoration-skip-ink: auto;
|
|
15
|
+
|
|
16
|
+
&:visited {
|
|
17
|
+
color: colours.$link-visited;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&:hover {
|
|
21
|
+
color: colours.$link-hover;
|
|
22
|
+
text-decoration-thickness: 0.15rem;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&:focus {
|
|
26
|
+
@include focus.default-focus-style;
|
|
27
|
+
color: colours.$link-focus-text;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&:active {
|
|
31
|
+
color: colours.$link-active;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/// Default links for use on a light background
|
|
35
|
+
/// @require {mixin} link-default
|
|
36
|
+
/// @since 0.5.0
|
|
37
|
+
@mixin links-default {
|
|
38
|
+
a {
|
|
39
|
+
@include link-default;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/// Inverse link style for use on an inverse (dark) background
|
|
44
|
+
/// @since 0.3.1
|
|
45
|
+
@mixin link-inverse {
|
|
46
|
+
color: colours.$link-inverse;
|
|
47
|
+
-webkit-tap-highlight-color: rgba(colours.$focus, 0.333);
|
|
48
|
+
text-decoration: underline;
|
|
49
|
+
text-decoration-skip-ink: auto;
|
|
50
|
+
|
|
51
|
+
&:visited {
|
|
52
|
+
color: colours.$link-inverse-visited;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&:hover {
|
|
56
|
+
color: colours.$link-inverse-hover;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:focus {
|
|
60
|
+
@include focus.inverse-focus-style;
|
|
61
|
+
color: colours.$link-inverse-focus-text;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&:active {
|
|
65
|
+
color: colours.$link-inverse-active;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/// Inverse links for use on a dark background
|
|
70
|
+
/// @require {mixin} link-inverse
|
|
71
|
+
/// @since 0.3.1
|
|
72
|
+
@mixin links-inverse {
|
|
73
|
+
a {
|
|
74
|
+
@include link-inverse;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -1,60 +1,64 @@
|
|
|
1
|
+
@use '../media-queries';
|
|
2
|
+
@use '../spacing';
|
|
3
|
+
@use '../modular-scale';
|
|
4
|
+
|
|
1
5
|
/// Baseline, in pixels
|
|
2
6
|
/// @since 0.2.0
|
|
3
|
-
$
|
|
7
|
+
$baseline: 4 !default;
|
|
4
8
|
|
|
5
9
|
/// Base font size, in pixels
|
|
6
10
|
/// @since 0.2.0
|
|
7
|
-
$
|
|
11
|
+
$base-font-size: $baseline * 4 !default;
|
|
8
12
|
|
|
9
13
|
/// Base line height, in pixels
|
|
10
14
|
/// @since 0.2.0
|
|
11
|
-
$
|
|
15
|
+
$base-line-height: $baseline * 6 !default;
|
|
12
16
|
|
|
13
17
|
/// Sans-serif font stack
|
|
14
|
-
/// @since
|
|
15
|
-
$
|
|
18
|
+
/// @since 2.0.0
|
|
19
|
+
$font-family-sans: 'Inter, "Helvetica Neue", Helvetica, Arial, sans-serif' !default;
|
|
16
20
|
|
|
17
21
|
/// Serif font stack
|
|
18
|
-
/// @since
|
|
19
|
-
$
|
|
22
|
+
/// @since 2.0.0
|
|
23
|
+
$font-family-serif: 'Lora, Georgia, Times, serif' !default;
|
|
20
24
|
|
|
21
25
|
/// Mono font stack
|
|
22
26
|
/// @since 0.2.0
|
|
23
|
-
$
|
|
27
|
+
$font-family-mono: 'Monaco, Menlo, Consolas, "Courier New", monospace' !default;
|
|
24
28
|
|
|
25
29
|
/// The font families in use across NICE.
|
|
26
|
-
/// @prop {Font stack} sans [
|
|
27
|
-
/// @prop {Font stack} serif [
|
|
30
|
+
/// @prop {Font stack} sans [Inter, Helvetica Neue, Helvetica, Arial, sans-serif] The sans-serif font stack
|
|
31
|
+
/// @prop {Font stack} serif [Lora, Georgia, Times, serif] The serif font stack
|
|
28
32
|
/// @prop {Font stack} mono [Monaco, Menlo, Consolas, "Courier New", monospace] The monospace font stack
|
|
29
33
|
/// @see font-family
|
|
30
34
|
/// @since 0.2.0
|
|
31
|
-
$
|
|
32
|
-
sans: $
|
|
33
|
-
serif: $
|
|
34
|
-
mono: $
|
|
35
|
+
$font-families: (
|
|
36
|
+
sans: $font-family-sans,
|
|
37
|
+
serif: $font-family-serif,
|
|
38
|
+
mono: $font-family-mono
|
|
35
39
|
) !default;
|
|
36
40
|
|
|
37
41
|
/// The modular scale ratio to use for typography
|
|
38
42
|
/// @since 0.2.0
|
|
39
|
-
$
|
|
43
|
+
$type-ratio: modular-scale.get-ratio(fourth) !default;
|
|
40
44
|
|
|
41
45
|
/// The minimum root font size, in pixels
|
|
42
46
|
/// @since 0.2.13
|
|
43
|
-
$
|
|
47
|
+
$root-font-size-min: 15;
|
|
44
48
|
|
|
45
|
-
/// The maximum root font size, used from breakpoint `$
|
|
49
|
+
/// The maximum root font size, used from breakpoint `$root-font-size-max-breakpoint`
|
|
46
50
|
/// @since 0.2.13
|
|
47
|
-
$
|
|
51
|
+
$root-font-size-max: 18;
|
|
48
52
|
|
|
49
53
|
/// The breakpoint at which the root font size starts changing from minimum
|
|
50
54
|
/// towards maximum.
|
|
51
55
|
/// @since 0.2.13
|
|
52
|
-
$
|
|
56
|
+
$root-font-size-min-breakpoint: media-queries.$md;
|
|
53
57
|
|
|
54
58
|
/// The breakpoint at which the root font size stops changing and is at its maximum
|
|
55
59
|
/// towards maximum.
|
|
56
60
|
/// @since 0.2.13
|
|
57
|
-
$
|
|
61
|
+
$root-font-size-max-breakpoint: media-queries.$lg;
|
|
58
62
|
|
|
59
63
|
/// A map of named font sizes to their corresponding modular scale factor
|
|
60
64
|
/// @prop {Integer} h1 [5] Heading 1
|
|
@@ -66,7 +70,7 @@ $nds-root-font-size-max-breakpoint: $nds-breakpoint-lg;
|
|
|
66
70
|
/// @prop {Integer} lead [2] Lead
|
|
67
71
|
/// @prop {Integer} p [0] Paragraph
|
|
68
72
|
/// @since 0.1.0
|
|
69
|
-
$
|
|
73
|
+
$named-font-sizes: (
|
|
70
74
|
h1: 5,
|
|
71
75
|
h2: 4,
|
|
72
76
|
h3: 3,
|
|
@@ -79,59 +83,59 @@ $nds-named-font-sizes: (
|
|
|
79
83
|
|
|
80
84
|
/// Numeric font sizes
|
|
81
85
|
/// @since 0.2.0
|
|
82
|
-
$
|
|
86
|
+
$font-sizes: (
|
|
83
87
|
-2: (
|
|
84
88
|
fs: 12,
|
|
85
89
|
lh: 18,
|
|
86
|
-
mb:
|
|
87
|
-
mt:
|
|
90
|
+
mb: spacing.$small,
|
|
91
|
+
mt: spacing.$small
|
|
88
92
|
),
|
|
89
93
|
-1: (
|
|
90
94
|
fs: 14,
|
|
91
95
|
lh: 20,
|
|
92
|
-
mb:
|
|
93
|
-
mt:
|
|
96
|
+
mb: spacing.$medium,
|
|
97
|
+
mt: spacing.$medium
|
|
94
98
|
),
|
|
95
99
|
0: (
|
|
96
100
|
fs: 16,
|
|
97
101
|
lh: 24,
|
|
98
|
-
mb:
|
|
99
|
-
mt:
|
|
102
|
+
mb: spacing.$medium,
|
|
103
|
+
mt: spacing.$medium
|
|
100
104
|
),
|
|
101
105
|
1: (
|
|
102
106
|
fs: 18,
|
|
103
107
|
lh: 24,
|
|
104
|
-
mb:
|
|
105
|
-
mt:
|
|
108
|
+
mb: spacing.$medium,
|
|
109
|
+
mt: spacing.$large
|
|
106
110
|
),
|
|
107
111
|
2: (
|
|
108
112
|
fs: 20,
|
|
109
113
|
lh: 28,
|
|
110
|
-
mb:
|
|
111
|
-
mt:
|
|
114
|
+
mb: spacing.$medium,
|
|
115
|
+
mt: spacing.$large
|
|
112
116
|
),
|
|
113
117
|
3: (
|
|
114
118
|
fs: 28,
|
|
115
119
|
lh: 32,
|
|
116
|
-
mb:
|
|
117
|
-
mt:
|
|
120
|
+
mb: spacing.$medium,
|
|
121
|
+
mt: spacing.$large
|
|
118
122
|
),
|
|
119
123
|
4: (
|
|
120
124
|
fs: 36,
|
|
121
125
|
lh: 40,
|
|
122
|
-
mb:
|
|
123
|
-
mt:
|
|
126
|
+
mb: spacing.$medium,
|
|
127
|
+
mt: spacing.$large
|
|
124
128
|
),
|
|
125
129
|
5: (
|
|
126
130
|
fs: 44,
|
|
127
131
|
lh: 56,
|
|
128
|
-
mb:
|
|
132
|
+
mb: spacing.$medium,
|
|
129
133
|
mt: 0
|
|
130
134
|
),
|
|
131
135
|
6: (
|
|
132
136
|
fs: 52,
|
|
133
137
|
lh: 60,
|
|
134
|
-
mb:
|
|
138
|
+
mb: spacing.$large,
|
|
135
139
|
mt: 0
|
|
136
140
|
)
|
|
137
141
|
);
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
@use "sass:math";
|
|
2
|
+
@use "../typography/settings" as typography-settings;
|
|
3
|
+
|
|
4
|
+
@forward "vendor/is";
|
|
5
|
+
@forward "vendor/math";
|
|
6
|
+
|
|
1
7
|
////
|
|
2
8
|
/// @group helpers
|
|
3
9
|
////
|
|
@@ -6,28 +12,26 @@
|
|
|
6
12
|
/// @param {Number} $num The number whose units you wish to strip.
|
|
7
13
|
/// @since 0.2.0
|
|
8
14
|
/// @link https://davidtheclark.github.io/scut/strip-unit.html
|
|
9
|
-
@
|
|
10
|
-
|
|
11
|
-
@function nds-strip-unit($num) {
|
|
15
|
+
@function strip-unit($num) {
|
|
12
16
|
@return math.div($num, $num * 0 + 1);
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
/// Convert pixel-values to em-values.
|
|
16
20
|
/// @param {Number} $pixels - The px-value you wish to convert to ems. No px unit necessary (e.g. 20 is fine, so is 20px). Passing a list will result in a list of em values (see examples).
|
|
17
|
-
/// @param {Number} $base [
|
|
21
|
+
/// @param {Number} $base [typography.$base-font-size] - A base-value with which to calculate the em-value
|
|
18
22
|
/// @since 0.2.0
|
|
19
23
|
/// @link https://davidtheclark.github.io/scut/em.html
|
|
20
|
-
@function em($pixels, $base:
|
|
24
|
+
@function em($pixels, $base: typography-settings.$base-font-size) {
|
|
21
25
|
// $base could be in em or px (no unit = px).
|
|
22
26
|
// Adjust accordingly to create a $divisor that
|
|
23
27
|
// serves as context for $pixels.
|
|
24
28
|
$multiplier: if(unit($base) == em, 16, 1);
|
|
25
|
-
$divisor:
|
|
29
|
+
$divisor: strip-unit($base) * $multiplier;
|
|
26
30
|
|
|
27
31
|
$em-vals: ();
|
|
28
32
|
|
|
29
33
|
@each $val in $pixels {
|
|
30
|
-
$val-in-ems: math.div(
|
|
34
|
+
$val-in-ems: math.div(strip-unit($val), $divisor) * 1em;
|
|
31
35
|
$em-vals: append($em-vals, $val-in-ems);
|
|
32
36
|
}
|
|
33
37
|
|
|
@@ -42,13 +46,13 @@
|
|
|
42
46
|
|
|
43
47
|
/// Convert pixel-values to rem-values.
|
|
44
48
|
/// @param {Number} $pixels - The px-value you wish to convert to rems. No px unit necessary (e.g. 20 is fine, so is 20px). Passing a list will result in a list of rem values (see examples).
|
|
45
|
-
/// @param {Number} $base [
|
|
49
|
+
/// @param {Number} $base [typography.$base-font-size] - A base-value with which to calculate the em-value
|
|
46
50
|
/// @since 0.2.0
|
|
47
51
|
/// @link https://davidtheclark.github.io/scut/rem.html
|
|
48
|
-
@function rem($pixels, $base:
|
|
52
|
+
@function rem($pixels, $base: typography-settings.$base-font-size) {
|
|
49
53
|
$rem-vals: ();
|
|
50
54
|
@each $val in $pixels {
|
|
51
|
-
$val-in-rems: math.div(
|
|
55
|
+
$val-in-rems: math.div(strip-unit($val), $base) * 1rem;
|
|
52
56
|
$rem-vals: append($rem-vals, $val-in-rems);
|
|
53
57
|
}
|
|
54
58
|
|
|
@@ -71,11 +75,11 @@
|
|
|
71
75
|
/// .something {
|
|
72
76
|
/// color: red;
|
|
73
77
|
|
|
74
|
-
/// @include
|
|
78
|
+
/// @include when-is(a, button) {
|
|
75
79
|
/// color: blue;
|
|
76
80
|
/// }
|
|
77
81
|
/// }
|
|
78
|
-
@mixin
|
|
82
|
+
@mixin when-is($element-selectors...) {
|
|
79
83
|
$selectors: ();
|
|
80
84
|
@each $element-selector in $element-selectors {
|
|
81
85
|
$selectors: append($selectors, $element-selector + &);
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
////
|
|
2
|
+
/// @group visibility
|
|
3
|
+
////
|
|
4
|
+
|
|
5
|
+
/// Portrait media query
|
|
6
|
+
@mixin portrait {
|
|
7
|
+
@media screen and (orientation: portrait) {
|
|
8
|
+
@content;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/// Landscape media query
|
|
13
|
+
@mixin landscape {
|
|
14
|
+
@media screen and (orientation: landscape) {
|
|
15
|
+
@content;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/// Makes an element visually hidden, but still accessible to keyboards and assistive devices.
|
|
20
|
+
@mixin invisible {
|
|
21
|
+
clip: rect(0, 0, 0, 0);
|
|
22
|
+
height: 1px;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
position: absolute !important;
|
|
25
|
+
width: 1px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/// Reverses the CSS output created by the `invisible()` mixin.
|
|
29
|
+
@mixin invisible-off {
|
|
30
|
+
clip: auto;
|
|
31
|
+
height: auto;
|
|
32
|
+
overflow: visible;
|
|
33
|
+
position: static !important;
|
|
34
|
+
width: auto;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/// Hide the element when printing
|
|
38
|
+
/// @output the CSS to hide on the print stylesheet
|
|
39
|
+
/// @since 1.0.0
|
|
40
|
+
@mixin hide-print {
|
|
41
|
+
@media print {
|
|
42
|
+
display: none !important;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/// Only show the element when printing (not for other media)
|
|
47
|
+
/// @output the CSS to hide on all media except print
|
|
48
|
+
/// @since 1.0.0
|
|
49
|
+
@mixin show-print {
|
|
50
|
+
display: none !important;
|
|
51
|
+
@media print {
|
|
52
|
+
display: block !important;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/// Remove an appended link URL
|
|
57
|
+
/// @output removes content attribute
|
|
58
|
+
/// @since 1.0.0
|
|
59
|
+
@mixin remove-appended-print-link {
|
|
60
|
+
@media print {
|
|
61
|
+
&:after {
|
|
62
|
+
content: none !important;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
package/scss/core.scss
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
////
|
|
2
|
-
/// @group helpers
|
|
3
|
-
////
|
|
4
|
-
|
|
5
|
-
/// Make an element adapt its height to fit floated children, and clear floats in both directions.
|
|
6
|
-
/// @since 0.1.0
|
|
7
|
-
@mixin nds-clearfix {
|
|
8
|
-
&:before,
|
|
9
|
-
&:after {
|
|
10
|
-
content: ' ';
|
|
11
|
-
display: table;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
&:after {
|
|
15
|
-
clear: both;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/// Placeholder for clearfix
|
|
20
|
-
/// @since 0.1.0
|
|
21
|
-
%nds-clearfix {
|
|
22
|
-
@include nds-clearfix;
|
|
23
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
////
|
|
2
|
-
/// @group helpers
|
|
3
|
-
////
|
|
4
|
-
|
|
5
|
-
/// Shortcut for getting the first item from a list
|
|
6
|
-
/// @link http://hugogiraudel.com/2013/08/08/advanced-sass-list-functions/#selecting-values-from-list
|
|
7
|
-
/// @since 0.1.0
|
|
8
|
-
@function nds-first($list) {
|
|
9
|
-
@return nth($list, 1);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/// Shortcut for getting the last item from a list
|
|
13
|
-
/// @link http://hugogiraudel.com/2013/08/08/advanced-sass-list-functions/#selecting-values-from-list
|
|
14
|
-
/// @since 0.1.0
|
|
15
|
-
@function nds-last($list) {
|
|
16
|
-
@return nth($list, length($list));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/// Returns last index of `$value` in `$list`.
|
|
20
|
-
///
|
|
21
|
-
/// @ignore Documentation: http://at-import.github.io/SassyLists/documentation/#function-sl-last-index
|
|
22
|
-
///
|
|
23
|
-
/// @param {List} $list - list to search
|
|
24
|
-
/// @param {*} $value - value to be searched for
|
|
25
|
-
///
|
|
26
|
-
/// @example
|
|
27
|
-
/// sl-last-index(a b a, a)
|
|
28
|
-
/// // 3
|
|
29
|
-
///
|
|
30
|
-
/// @example
|
|
31
|
-
/// sl-last-index(a b a, z)
|
|
32
|
-
/// // null
|
|
33
|
-
///
|
|
34
|
-
/// @return {Number | Null}
|
|
35
|
-
///
|
|
36
|
-
/// @since 0.1.0
|
|
37
|
-
@function nds-last-index($list, $value) {
|
|
38
|
-
@for $i from length($list) through 1 {
|
|
39
|
-
@if nth($list, $i) == $value {
|
|
40
|
-
@return $i;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@return null;
|
|
45
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
////
|
|
2
|
-
/// @group helpers
|
|
3
|
-
////
|
|
4
|
-
|
|
5
|
-
/// Styles to hide and show under the print media query
|
|
6
|
-
|
|
7
|
-
/// Hide the element when printing
|
|
8
|
-
/// @output the CSS to hide on the print stylesheet
|
|
9
|
-
/// @since 1.0.0
|
|
10
|
-
@mixin nds-hide-print {
|
|
11
|
-
@media print {
|
|
12
|
-
display: none !important;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
///Only show the element when printing (not for other media)
|
|
17
|
-
/// @output the CSS to hide on all media except print
|
|
18
|
-
/// @since 1.0.0
|
|
19
|
-
@mixin nds-show-print {
|
|
20
|
-
display: none !important;
|
|
21
|
-
@media print {
|
|
22
|
-
display: block !important;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
///Remove an appended link URL
|
|
27
|
-
/// @output removes content attribute
|
|
28
|
-
/// @since 1.0.0
|
|
29
|
-
@mixin nds-remove-appended-print-link {
|
|
30
|
-
@media print {
|
|
31
|
-
&:after {
|
|
32
|
-
content: none !important;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|