@tedi-design-system/core 2.0.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/README.md +14 -0
- package/_base.scss +93 -0
- package/_fonts.scss +253 -0
- package/_helpers.scss +43 -0
- package/_icons.scss +51 -0
- package/_mixins.scss +108 -0
- package/_print.scss +35 -0
- package/_typography.scss +220 -0
- package/bootstrap-utility/_breakpoints.scss +136 -0
- package/bootstrap-utility/_grid.scss +167 -0
- package/bootstrap-utility/_mixin-utilities.scss +95 -0
- package/bootstrap-utility/_utilities-api.scss +23 -0
- package/bootstrap-utility/_utilities.scss +104 -0
- package/fonts/README.md +34 -0
- package/fonts/material-symbols-outlined.woff2 +0 -0
- package/fonts/material-symbols-rounded.woff2 +0 -0
- package/fonts/material-symbols-sharp.woff2 +0 -0
- package/fonts/roboto-v30-cyrillic-300-italic.woff2 +0 -0
- package/fonts/roboto-v30-cyrillic-300.woff2 +0 -0
- package/fonts/roboto-v30-cyrillic-400-italic.woff2 +0 -0
- package/fonts/roboto-v30-cyrillic-400.woff2 +0 -0
- package/fonts/roboto-v30-cyrillic-700-italic.woff2 +0 -0
- package/fonts/roboto-v30-cyrillic-700.woff2 +0 -0
- package/fonts/roboto-v30-cyrillic-ext-300-italic.woff2 +0 -0
- package/fonts/roboto-v30-cyrillic-ext-300.woff2 +0 -0
- package/fonts/roboto-v30-cyrillic-ext-400-italic.woff2 +0 -0
- package/fonts/roboto-v30-cyrillic-ext-400.woff2 +0 -0
- package/fonts/roboto-v30-cyrillic-ext-700-italic.woff2 +0 -0
- package/fonts/roboto-v30-cyrillic-ext-700.woff2 +0 -0
- package/fonts/roboto-v30-latin-300-italic.woff2 +0 -0
- package/fonts/roboto-v30-latin-300.woff2 +0 -0
- package/fonts/roboto-v30-latin-400-italic.woff2 +0 -0
- package/fonts/roboto-v30-latin-400.woff2 +0 -0
- package/fonts/roboto-v30-latin-700-italic.woff2 +0 -0
- package/fonts/roboto-v30-latin-700.woff2 +0 -0
- package/fonts/roboto-v30-latin-ext-300-italic.woff2 +0 -0
- package/fonts/roboto-v30-latin-ext-300.woff2 +0 -0
- package/fonts/roboto-v30-latin-ext-400-italic.woff2 +0 -0
- package/fonts/roboto-v30-latin-ext-400.woff2 +0 -0
- package/fonts/roboto-v30-latin-ext-700-italic.woff2 +0 -0
- package/fonts/roboto-v30-latin-ext-700.woff2 +0 -0
- package/index.css +1 -0
- package/index.scss +17 -0
- package/package.json +63 -0
- package/tedi-storybook-styles.scss +172 -0
- package/variables/_base-variables.scss +168 -0
- package/variables/_bootstrap-variables.scss +30 -0
- package/variables/_color-variables.scss +1113 -0
- package/variables/_dimensional-variables.scss +1236 -0
- package/variables/_font-variables.scss +77 -0
- package/variables/_utility-variables.scss +11 -0
package/_typography.scss
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
@use 'mixins';
|
|
2
|
+
|
|
3
|
+
$headings: (h1, h2, h3, h4, h5, h6);
|
|
4
|
+
|
|
5
|
+
// Mixin for heading styles
|
|
6
|
+
@mixin heading-styles($level) {
|
|
7
|
+
@include mixins.responsive-styles(font-size, heading-#{$level}-size, $exclude: tablet);
|
|
8
|
+
@include mixins.responsive-styles(font-weight, heading-#{$level}-weight, $exclude: tablet);
|
|
9
|
+
@include mixins.responsive-styles(line-height, heading-#{$level}-line-height, $exclude: tablet);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@each $level in $headings {
|
|
13
|
+
#{$level},
|
|
14
|
+
.#{$level},
|
|
15
|
+
.tedi-#{$level},
|
|
16
|
+
.text-#{$level},
|
|
17
|
+
.tedi-text--#{$level} {
|
|
18
|
+
@include heading-styles($level);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.tedi-text {
|
|
23
|
+
@each $level in $headings {
|
|
24
|
+
&--#{$level} {
|
|
25
|
+
@include heading-styles($level);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&--default {
|
|
30
|
+
color: var(--general-text-primary);
|
|
31
|
+
|
|
32
|
+
@include mixins.responsive-styles(font-family, family-primary, $exclude: tablet);
|
|
33
|
+
@include mixins.responsive-styles(font-size, body-regular-size, $exclude: tablet);
|
|
34
|
+
@include mixins.responsive-styles(font-weight, body-regular-weight, $exclude: tablet);
|
|
35
|
+
@include mixins.responsive-styles(line-height, body-regular-line-height, $exclude: tablet);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&--small {
|
|
39
|
+
@include mixins.responsive-styles(font-size, body-small-regular-size, $exclude: tablet);
|
|
40
|
+
@include mixins.responsive-styles(font-weight, body-small-regular-weight, $exclude: tablet);
|
|
41
|
+
@include mixins.responsive-styles(line-height, body-small-regular-line-height, $exclude: tablet);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.text-subtitle {
|
|
46
|
+
text-transform: uppercase;
|
|
47
|
+
|
|
48
|
+
@include mixins.responsive-styles(font-size, heading-subtitle-regular-size, $exclude: tablet);
|
|
49
|
+
@include mixins.responsive-styles(font-weight, heading-subtitle-regular-weight, $exclude: tablet);
|
|
50
|
+
@include mixins.responsive-styles(line-height, heading-subtitle-regular-line-height, $exclude: tablet);
|
|
51
|
+
|
|
52
|
+
&.text-small {
|
|
53
|
+
@include mixins.responsive-styles(font-size, heading-subtitle-small-size, $exclude: tablet);
|
|
54
|
+
@include mixins.responsive-styles(font-weight, heading-subtitle-small-weight, $exclude: tablet);
|
|
55
|
+
@include mixins.responsive-styles(line-height, heading-subtitle-small-line-height, $exclude: tablet);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
label {
|
|
60
|
+
color: var(--general-text-secondary);
|
|
61
|
+
|
|
62
|
+
@include mixins.responsive-styles(line-height, body-regular-line-height);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.text-normal {
|
|
66
|
+
color: var(--general-text-primary);
|
|
67
|
+
|
|
68
|
+
@include mixins.responsive-styles(font-family, family-primary, $exclude: tablet);
|
|
69
|
+
@include mixins.responsive-styles(font-size, body-regular-size, $exclude: tablet);
|
|
70
|
+
@include mixins.responsive-styles(font-weight, body-regular-weight, $exclude: tablet);
|
|
71
|
+
@include mixins.responsive-styles(line-height, body-regular-line-height, $exclude: tablet);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
small,
|
|
75
|
+
.text-small {
|
|
76
|
+
@include mixins.responsive-styles(font-size, body-small-regular-size, $exclude: tablet);
|
|
77
|
+
@include mixins.responsive-styles(font-weight, body-small-regular-weight, $exclude: tablet);
|
|
78
|
+
@include mixins.responsive-styles(line-height, body-small-regular-line-height, $exclude: tablet);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@each $color,
|
|
82
|
+
$var
|
|
83
|
+
in (
|
|
84
|
+
'default': var(--general-text-primary),
|
|
85
|
+
'primary': var(--general-text-primary),
|
|
86
|
+
'secondary': var(--general-text-secondary),
|
|
87
|
+
'tertiary': var(--general-text-tertiary),
|
|
88
|
+
'white': var(--general-text-white),
|
|
89
|
+
'disabled': var(--general-text-disabled),
|
|
90
|
+
'brand': var(--general-text-brand),
|
|
91
|
+
'success': var(--general-status-success-text),
|
|
92
|
+
'warning': var(--general-status-warning-text),
|
|
93
|
+
'danger': var(--general-status-danger-text),
|
|
94
|
+
'info': var(--general-status-info-text),
|
|
95
|
+
'neutral': var(--general-status-neutral-text)
|
|
96
|
+
)
|
|
97
|
+
{
|
|
98
|
+
.tedi-text--#{$color} {
|
|
99
|
+
color: $var;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.text-nowrap {
|
|
104
|
+
white-space: nowrap;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.text-break-all {
|
|
108
|
+
word-break: break-all;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.text-break-word {
|
|
112
|
+
word-break: break-word;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.text-uppercase {
|
|
116
|
+
text-transform: uppercase;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.text-lowercase {
|
|
120
|
+
text-transform: lowercase;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.text-capitalize {
|
|
124
|
+
text-transform: capitalize;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.text-capitalize-first::first-letter {
|
|
128
|
+
text-transform: capitalize;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.text-break-spaces {
|
|
132
|
+
white-space: break-spaces;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.text-inline-block {
|
|
136
|
+
display: inline-block;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.text-inline {
|
|
140
|
+
display: inline;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
b,
|
|
144
|
+
strong,
|
|
145
|
+
.text-bold {
|
|
146
|
+
font-weight: 700;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.text-thin {
|
|
150
|
+
font-weight: 300;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
i,
|
|
154
|
+
.text-italic {
|
|
155
|
+
font-style: italic;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.text-center {
|
|
159
|
+
text-align: center;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.text-left {
|
|
163
|
+
text-align: left;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.text-right {
|
|
167
|
+
text-align: right;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.text-line-normal {
|
|
171
|
+
line-height: normal;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.text-line-condensed {
|
|
175
|
+
line-height: 1;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.text-default {
|
|
179
|
+
color: var(--general-text-primary);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.text-primary {
|
|
183
|
+
color: var(--general-text-brand);
|
|
184
|
+
|
|
185
|
+
@include mixins.print-grayscale;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.text-muted {
|
|
189
|
+
color: var(--general-text-secondary);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.text-subtle {
|
|
193
|
+
color: var(--general-text-tertiary);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.text-disabled {
|
|
197
|
+
color: var(--general-text-disabled);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.text-inverted {
|
|
201
|
+
color: var(--general-text-white);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.text-positive {
|
|
205
|
+
color: var(--general-status-success-text);
|
|
206
|
+
|
|
207
|
+
@include mixins.print-grayscale;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.text-important {
|
|
211
|
+
color: var(--general-status-danger-text);
|
|
212
|
+
|
|
213
|
+
@include mixins.print-grayscale;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.text-warning {
|
|
217
|
+
color: var(--general-status-warning-text);
|
|
218
|
+
|
|
219
|
+
@include mixins.print-grayscale;
|
|
220
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '../variables/bootstrap-variables' as vars;
|
|
3
|
+
|
|
4
|
+
// Breakpoint viewport sizes and media queries.
|
|
5
|
+
//
|
|
6
|
+
// Breakpoints are defined as a map of (name: minimum width), order from small to large:
|
|
7
|
+
//
|
|
8
|
+
// (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px)
|
|
9
|
+
//
|
|
10
|
+
// The map defined in the `$grid-breakpoints` global variable is used as the `$breakpoints` argument by default.
|
|
11
|
+
|
|
12
|
+
// Name of the next breakpoint, or null for the last breakpoint.
|
|
13
|
+
//
|
|
14
|
+
// >> breakpoint-next(sm)
|
|
15
|
+
// md
|
|
16
|
+
// >> breakpoint-next(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))
|
|
17
|
+
// md
|
|
18
|
+
// >> breakpoint-next(sm, $breakpoint-names: (xs sm md lg xl))
|
|
19
|
+
// md
|
|
20
|
+
@function breakpoint-next($name, $breakpoints: vars.$grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) {
|
|
21
|
+
$n: index($breakpoint-names, $name);
|
|
22
|
+
|
|
23
|
+
@if not $n {
|
|
24
|
+
@error 'breakpoint `#{$name}` not found in `#{$breakpoints}`';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@return if($n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Minimum breakpoint width. Null for the smallest (first) breakpoint.
|
|
31
|
+
//
|
|
32
|
+
// >> breakpoint-min(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))
|
|
33
|
+
// 576px
|
|
34
|
+
@function breakpoint-min($name, $breakpoints: vars.$grid-breakpoints) {
|
|
35
|
+
$min: map.get($breakpoints, $name);
|
|
36
|
+
|
|
37
|
+
@return if($min != 0, $min, null);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Maximum breakpoint width.
|
|
41
|
+
// The maximum value is reduced by 0.02px to work around the limitations of
|
|
42
|
+
// `min-` and `max-` prefixes and viewports with fractional widths.
|
|
43
|
+
// See https://www.w3.org/TR/mediaqueries-4/#mq-min-max
|
|
44
|
+
// Uses 0.02px rather than 0.01px to work around a current rounding bug in Safari.
|
|
45
|
+
// See https://bugs.webkit.org/show_bug.cgi?id=178261
|
|
46
|
+
//
|
|
47
|
+
// >> breakpoint-max(md, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))
|
|
48
|
+
// 767.98px
|
|
49
|
+
@function breakpoint-max($name, $breakpoints: vars.$grid-breakpoints) {
|
|
50
|
+
$max: map.get($breakpoints, $name);
|
|
51
|
+
|
|
52
|
+
@return if($max and $max > 0, $max - 0.02, null);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Returns a blank string if smallest breakpoint, otherwise returns the name with a dash in front.
|
|
56
|
+
// Useful for making responsive utilities.
|
|
57
|
+
//
|
|
58
|
+
// >> breakpoint-infix(xs, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))
|
|
59
|
+
// "" (Returns a blank string)
|
|
60
|
+
// >> breakpoint-infix(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))
|
|
61
|
+
// "-sm"
|
|
62
|
+
@function breakpoint-infix($name, $breakpoints: vars.$grid-breakpoints) {
|
|
63
|
+
@return if(breakpoint-min($name, $breakpoints) == null, '', '-#{$name}');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Media of at least the minimum breakpoint width. No query for the smallest breakpoint.
|
|
67
|
+
// Makes the @content apply to the given breakpoint and wider.
|
|
68
|
+
@mixin media-breakpoint-up($name, $breakpoints: vars.$grid-breakpoints) {
|
|
69
|
+
$min: breakpoint-min($name, $breakpoints);
|
|
70
|
+
|
|
71
|
+
@if $min {
|
|
72
|
+
@media (min-width: $min) {
|
|
73
|
+
@content;
|
|
74
|
+
}
|
|
75
|
+
} @else {
|
|
76
|
+
@content;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Media of at most the maximum breakpoint width. No query for the largest breakpoint.
|
|
81
|
+
// Makes the @content apply to the given breakpoint and narrower.
|
|
82
|
+
@mixin media-breakpoint-down($name, $breakpoints: vars.$grid-breakpoints) {
|
|
83
|
+
$max: breakpoint-max($name, $breakpoints);
|
|
84
|
+
|
|
85
|
+
@if $max {
|
|
86
|
+
@media (max-width: $max) {
|
|
87
|
+
@content;
|
|
88
|
+
}
|
|
89
|
+
} @else {
|
|
90
|
+
@content;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Media that spans multiple breakpoint widths.
|
|
95
|
+
// Makes the @content apply between the min and max breakpoints
|
|
96
|
+
@mixin media-breakpoint-between($lower, $upper, $breakpoints: vars.$grid-breakpoints) {
|
|
97
|
+
$min: breakpoint-min($lower, $breakpoints);
|
|
98
|
+
$max: breakpoint-max($upper, $breakpoints);
|
|
99
|
+
|
|
100
|
+
@if $min != null and $max != null {
|
|
101
|
+
@media (min-width: $min) and (max-width: $max) {
|
|
102
|
+
@content;
|
|
103
|
+
}
|
|
104
|
+
} @else if $max == null {
|
|
105
|
+
@include media-breakpoint-up($lower, $breakpoints) {
|
|
106
|
+
@content;
|
|
107
|
+
}
|
|
108
|
+
} @else if $min == null {
|
|
109
|
+
@include media-breakpoint-down($upper, $breakpoints) {
|
|
110
|
+
@content;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Media between the breakpoint's minimum and maximum widths.
|
|
116
|
+
// No minimum for the smallest breakpoint, and no maximum for the largest one.
|
|
117
|
+
// Makes the @content apply only to the given breakpoint, not viewports any wider or narrower.
|
|
118
|
+
@mixin media-breakpoint-only($name, $breakpoints: vars.$grid-breakpoints) {
|
|
119
|
+
$min: breakpoint-min($name, $breakpoints);
|
|
120
|
+
$next: breakpoint-next($name, $breakpoints);
|
|
121
|
+
$max: breakpoint-max($next);
|
|
122
|
+
|
|
123
|
+
@if $min != null and $max != null {
|
|
124
|
+
@media (min-width: $min) and (max-width: $max) {
|
|
125
|
+
@content;
|
|
126
|
+
}
|
|
127
|
+
} @else if $max == null {
|
|
128
|
+
@include media-breakpoint-up($name, $breakpoints) {
|
|
129
|
+
@content;
|
|
130
|
+
}
|
|
131
|
+
} @else if $min == null {
|
|
132
|
+
@include media-breakpoint-down($next, $breakpoints) {
|
|
133
|
+
@content;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
@use 'sass:map';
|
|
3
|
+
@use 'sass:meta';
|
|
4
|
+
@use '../variables/bootstrap-variables' as vars;
|
|
5
|
+
@use './breakpoints' as breakpoints;
|
|
6
|
+
@use './utilities' as utils;
|
|
7
|
+
@use './utilities-api' as utilsApi;
|
|
8
|
+
|
|
9
|
+
// Grid system
|
|
10
|
+
//
|
|
11
|
+
// Generate semantic grid columns with these mixins.
|
|
12
|
+
|
|
13
|
+
@mixin make-row($gutter: vars.$grid-gutter-width) {
|
|
14
|
+
--#{vars.$variable-prefix}gutter-x: #{$gutter};
|
|
15
|
+
--#{vars.$variable-prefix}gutter-y: 0;
|
|
16
|
+
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-wrap: wrap;
|
|
19
|
+
|
|
20
|
+
// TODO: Revisit calc order after https://github.com/react-bootstrap/react-bootstrap/issues/6039 is fixed
|
|
21
|
+
margin-top: calc(-1 * var(--#{vars.$variable-prefix}gutter-y)); // stylelint-disable-line function-disallowed-list
|
|
22
|
+
margin-right: calc(-0.5 * var(--#{vars.$variable-prefix}gutter-x)); // stylelint-disable-line function-disallowed-list
|
|
23
|
+
margin-left: calc(-0.5 * var(--#{vars.$variable-prefix}gutter-x)); // stylelint-disable-line function-disallowed-list
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@mixin make-col-ready() {
|
|
27
|
+
// Add box sizing if only the grid is loaded
|
|
28
|
+
box-sizing: if(meta.variable-exists(include-column-box-sizing) and $include-column-box-sizing, border-box, null);
|
|
29
|
+
|
|
30
|
+
// Prevent columns from becoming too narrow when at smaller grid tiers by
|
|
31
|
+
// always setting `width: 100%;`. This works because we set the width
|
|
32
|
+
// later on to override this initial width.
|
|
33
|
+
flex-shrink: 0;
|
|
34
|
+
width: 100%;
|
|
35
|
+
max-width: 100%; // Prevent `.col-auto`, `.col` (& responsive variants) from breaking out the grid
|
|
36
|
+
padding-right: calc(var(--#{vars.$variable-prefix}gutter-x) * 0.5); // stylelint-disable-line function-disallowed-list
|
|
37
|
+
padding-left: calc(var(--#{vars.$variable-prefix}gutter-x) * 0.5); // stylelint-disable-line function-disallowed-list
|
|
38
|
+
margin-top: var(--#{vars.$variable-prefix}gutter-y);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@mixin make-col($size: false, $columns: vars.$grid-columns) {
|
|
42
|
+
@if $size {
|
|
43
|
+
flex: 0 0 auto;
|
|
44
|
+
width: math.percentage(math.div($size, $columns));
|
|
45
|
+
} @else {
|
|
46
|
+
flex: 1 1 0;
|
|
47
|
+
max-width: 100%;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@mixin make-col-auto() {
|
|
52
|
+
flex: 0 0 auto;
|
|
53
|
+
width: auto;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@mixin make-col-offset($size, $columns: vars.$grid-columns) {
|
|
57
|
+
$num: math.div($size, $columns);
|
|
58
|
+
|
|
59
|
+
margin-left: if($num == 0, 0, math.percentage($num));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Row columns
|
|
63
|
+
//
|
|
64
|
+
// Specify on a parent element(e.g., .row) to force immediate children into NN
|
|
65
|
+
// numberof columns. Supports wrapping to new lines, but does not do a Masonry
|
|
66
|
+
// style grid.
|
|
67
|
+
@mixin row-cols($count) {
|
|
68
|
+
> * {
|
|
69
|
+
flex: 0 0 auto;
|
|
70
|
+
width: math.div(100%, $count);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Framework grid generation
|
|
75
|
+
//
|
|
76
|
+
// Used only by Bootstrap to generate the correct number of grid classes given
|
|
77
|
+
// any value of `$grid-columns`.
|
|
78
|
+
|
|
79
|
+
@mixin make-grid-columns(
|
|
80
|
+
$columns: vars.$grid-columns,
|
|
81
|
+
$gutter: vars.$grid-gutter-width,
|
|
82
|
+
$breakpoints: vars.$grid-breakpoints
|
|
83
|
+
) {
|
|
84
|
+
@each $breakpoint in map.keys($breakpoints) {
|
|
85
|
+
$infix: breakpoints.breakpoint-infix($breakpoint, $breakpoints);
|
|
86
|
+
|
|
87
|
+
@include breakpoints.media-breakpoint-up($breakpoint, $breakpoints) {
|
|
88
|
+
// Provide basic `.col-{bp}` classes for equal-width flexbox columns
|
|
89
|
+
.col#{$infix} {
|
|
90
|
+
flex: 1 0 0%; // Flexbugs #4: https://github.com/philipwalton/flexbugs#flexbug-4
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.row-cols#{$infix}-auto > * {
|
|
94
|
+
@include make-col-auto;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@if vars.$grid-row-columns > 0 {
|
|
98
|
+
@for $i from 1 through vars.$grid-row-columns {
|
|
99
|
+
.row-cols#{$infix}-#{$i} {
|
|
100
|
+
@include row-cols($i);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.col#{$infix}-auto {
|
|
106
|
+
@include make-col-auto;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@if $columns > 0 {
|
|
110
|
+
@for $i from 1 through $columns {
|
|
111
|
+
.col#{$infix}-#{$i} {
|
|
112
|
+
@include make-col($i, $columns);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// `$columns - 1` because offsetting by the width of an entire row isn't possible
|
|
117
|
+
@for $i from 0 through ($columns - 1) {
|
|
118
|
+
@if not($infix == '' and $i == 0) {
|
|
119
|
+
// Avoid emitting useless .offset-0
|
|
120
|
+
.offset#{$infix}-#{$i} {
|
|
121
|
+
@include make-col-offset($i, $columns);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Gutters
|
|
128
|
+
//
|
|
129
|
+
// Make use of `.g-*`, `.gx-*` or `.gy-*` utilities to change spacing between the columns.
|
|
130
|
+
@each $key, $value in vars.$gutters {
|
|
131
|
+
.g#{$infix}-#{$key},
|
|
132
|
+
.gx#{$infix}-#{$key} {
|
|
133
|
+
--#{vars.$variable-prefix}gutter-x: #{$value};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.g#{$infix}-#{$key},
|
|
137
|
+
.gy#{$infix}-#{$key} {
|
|
138
|
+
--#{vars.$variable-prefix}gutter-y: #{$value};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@mixin make-cssgrid($columns: $grid-columns, $breakpoints: vars.$grid-breakpoints) {
|
|
146
|
+
@each $breakpoint in map.keys($breakpoints) {
|
|
147
|
+
$infix: breakpoints.breakpoint-infix($breakpoint, $breakpoints);
|
|
148
|
+
|
|
149
|
+
@include breakpoints.media-breakpoint-up($breakpoint, $breakpoints) {
|
|
150
|
+
@if $columns > 0 {
|
|
151
|
+
@for $i from 1 through $columns {
|
|
152
|
+
.g-col#{$infix}-#{$i} {
|
|
153
|
+
grid-column: auto / span $i;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Start with `1` because `0` is and invalid value.
|
|
158
|
+
// Ends with `$columns - 1` because offsetting by the width of an entire row isn't possible.
|
|
159
|
+
@for $i from 1 through ($columns - 1) {
|
|
160
|
+
.g-start#{$infix}-#{$i} {
|
|
161
|
+
grid-column-start: $i;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use 'sass:meta';
|
|
3
|
+
@use 'sass:list';
|
|
4
|
+
@use '../variables/bootstrap-variables' as vars;
|
|
5
|
+
|
|
6
|
+
// Utility generator
|
|
7
|
+
// Used to generate utilities & print utilities
|
|
8
|
+
@mixin generate-utility($utility, $infix, $is-rfs-media-query: false) {
|
|
9
|
+
$values: map.get($utility, values);
|
|
10
|
+
|
|
11
|
+
// If the values are a list or string, convert it into a map
|
|
12
|
+
@if meta.type-of($values) == 'string' or meta.type-of(list.nth($values, 1)) != 'list' {
|
|
13
|
+
$values: list.zip($values, $values);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@each $key, $value in $values {
|
|
17
|
+
$properties: map.get($utility, property);
|
|
18
|
+
|
|
19
|
+
// Multiple properties are possible, for example with vertical or horizontal margins or paddings
|
|
20
|
+
@if meta.type-of($properties) == 'string' {
|
|
21
|
+
$properties: list.append((), $properties);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Use custom class if present
|
|
25
|
+
$property-class: if(map.has-key($utility, class), map.get($utility, class), list.nth($properties, 1));
|
|
26
|
+
$property-class: if($property-class == null, '', $property-class);
|
|
27
|
+
|
|
28
|
+
// State params to generate pseudo-classes
|
|
29
|
+
$state: if(map.has-key($utility, state), map.get($utility, state), ());
|
|
30
|
+
$infix: if($property-class == '' and str-slice($infix, 1, 1) == '-', str-slice($infix, 2), $infix);
|
|
31
|
+
|
|
32
|
+
// Don't prefix if value key is null (eg. with shadow class)
|
|
33
|
+
$property-class-modifier: if($key, if($property-class == '' and $infix == '', '', '-') + $key, '');
|
|
34
|
+
|
|
35
|
+
@if map.get($utility, rfs) {
|
|
36
|
+
// Inside the media query
|
|
37
|
+
@if $is-rfs-media-query {
|
|
38
|
+
$val: rfs-value($value);
|
|
39
|
+
|
|
40
|
+
// Do not render anything if fluid and non fluid values are the same
|
|
41
|
+
$value: if($val == rfs-fluid-value($value), null, $val);
|
|
42
|
+
} @else {
|
|
43
|
+
$value: rfs-fluid-value($value);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
$is-css-var: map.get($utility, css-var);
|
|
48
|
+
$is-local-vars: map.get($utility, local-vars);
|
|
49
|
+
$is-rtl: map.get($utility, rtl);
|
|
50
|
+
|
|
51
|
+
@if $value != null {
|
|
52
|
+
@if $is-rtl == false {
|
|
53
|
+
/* rtl:begin:remove */
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@if $is-css-var {
|
|
57
|
+
.#{$property-class + $infix + $property-class-modifier} {
|
|
58
|
+
--#{$variable-prefix}#{$property-class}: #{$value};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@each $pseudo in $state {
|
|
62
|
+
.#{$property-class + $infix + $property-class-modifier}-#{$pseudo}:#{$pseudo} {
|
|
63
|
+
--#{$variable-prefix}#{$property-class}: #{$value};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
} @else {
|
|
67
|
+
.#{$property-class + $infix + $property-class-modifier} {
|
|
68
|
+
@each $property in $properties {
|
|
69
|
+
@if $is-local-vars {
|
|
70
|
+
@each $local-var, $value in $is-local-vars {
|
|
71
|
+
--#{$variable-prefix}#{$local-var}: #{$value};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// stylelint-disable-next-line annotation-no-unknown
|
|
76
|
+
#{$property}: $value if(vars.$enable-important-utilities, !important, null);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@each $pseudo in $state {
|
|
81
|
+
.#{$property-class + $infix + $property-class-modifier}-#{$pseudo}:#{$pseudo} {
|
|
82
|
+
@each $property in $properties {
|
|
83
|
+
// stylelint-disable-next-line annotation-no-unknown
|
|
84
|
+
#{$property}: $value if($enable-important-utilities, !important, null);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@if $is-rtl == false {
|
|
91
|
+
/* rtl:end:remove */
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use 'sass:meta';
|
|
3
|
+
@use '../variables/bootstrap-variables' as vars;
|
|
4
|
+
@use './mixin-utilities' as mixins;
|
|
5
|
+
@use './breakpoints' as breakpoints;
|
|
6
|
+
@use './utilities' as utilities;
|
|
7
|
+
|
|
8
|
+
// Loop over each breakpoint
|
|
9
|
+
@each $breakpoint in map.keys(vars.$grid-breakpoints) {
|
|
10
|
+
// Generate media query if needed
|
|
11
|
+
@include breakpoints.media-breakpoint-up($breakpoint) {
|
|
12
|
+
$infix: breakpoints.breakpoint-infix($breakpoint, vars.$grid-breakpoints);
|
|
13
|
+
|
|
14
|
+
// Loop over each utility property
|
|
15
|
+
@each $key, $utility in utilities.$utilities {
|
|
16
|
+
// The utility can be disabled with `false`, thus check if the utility is a map first
|
|
17
|
+
// Only proceed if responsive media queries are enabled or if it's the base media query
|
|
18
|
+
@if meta.type-of($utility) == 'map' and (map.get($utility, responsive) or $infix == '') {
|
|
19
|
+
@include mixins.generate-utility($utility, $infix);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|