@govbr-ds/design 4.0.0-next.31
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/LICENSE +21 -0
- package/README.md +73 -0
- package/dist/govbr-ds.css +1588 -0
- package/dist/govbr-ds.min.css +1 -0
- package/dist/govbr-utilities-lite.css +2811 -0
- package/dist/govbr-utilities-lite.min.css +1 -0
- package/dist/govbr-utilities.css +12667 -0
- package/dist/govbr-utilities.min.css +1 -0
- package/dist/modules/color.css +5674 -0
- package/dist/modules/elevation.css +113 -0
- package/dist/modules/flexbox.css +696 -0
- package/dist/modules/grid.css +518 -0
- package/dist/modules/motion.css +95 -0
- package/dist/modules/spacing.css +3928 -0
- package/dist/modules/surface.css +646 -0
- package/dist/modules/typography.css +706 -0
- package/package.json +65 -0
- package/src/core/_contrast.scss +2 -0
- package/src/core/_foundation.scss +227 -0
- package/src/core/_responsive.scss +9 -0
- package/src/core/_states.scss +121 -0
- package/src/core/_theme.scss +7 -0
- package/src/core/_tokens.scss +2 -0
- package/src/core/_utils.scss +116 -0
- package/src/core/govbr-ds.scss +9 -0
- package/src/utilities/_color.scss +139 -0
- package/src/utilities/_elevation.scss +47 -0
- package/src/utilities/_flexbox.scss +147 -0
- package/src/utilities/_grid.scss +137 -0
- package/src/utilities/_lite-config.scss +41 -0
- package/src/utilities/_lite-helpers.scss +137 -0
- package/src/utilities/_motion.scss +50 -0
- package/src/utilities/_responsive.scss +49 -0
- package/src/utilities/_spacing.scss +148 -0
- package/src/utilities/_surface.scss +135 -0
- package/src/utilities/_typography.scss +150 -0
- package/src/utilities/_utilities-generator.scss +61 -0
- package/src/utilities/govbr-utilities-lite.scss +4 -0
- package/src/utilities/govbr-utilities.scss +8 -0
- package/src/utilities/modules/color.scss +5 -0
- package/src/utilities/modules/elevation.scss +13 -0
- package/src/utilities/modules/flexbox.scss +13 -0
- package/src/utilities/modules/grid.scss +13 -0
- package/src/utilities/modules/motion.scss +5 -0
- package/src/utilities/modules/spacing.scss +13 -0
- package/src/utilities/modules/surface.scss +13 -0
- package/src/utilities/modules/typography.scss +13 -0
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@govbr-ds/design",
|
|
3
|
+
"version": "4.0.0-next.31",
|
|
4
|
+
"description": "Estilos fundamentais e utilitários do Design System",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"css",
|
|
7
|
+
"design system",
|
|
8
|
+
"govbr-ds",
|
|
9
|
+
"scss",
|
|
10
|
+
"styles",
|
|
11
|
+
"utilities"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://gov.br/ds",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://gitlab.com/govbr-ds/govbr-ds/issues"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+ssh://git@gitlab.com/govbr-ds/govbr-ds.git",
|
|
20
|
+
"directory": "projects/design"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"author": "SERPRO (http://serpro.gov.br/)",
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"src/**/*.scss"
|
|
30
|
+
],
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@axe-core/puppeteer": "4.12.1",
|
|
33
|
+
"@govbr-ds/tokens": "4.0.0-next.31",
|
|
34
|
+
"autoprefixer": "10.5.4",
|
|
35
|
+
"css-tree": "3.2.1",
|
|
36
|
+
"cssnano": "8.0.2",
|
|
37
|
+
"jest": "30.4.2",
|
|
38
|
+
"npm-run-all2": "9.0.3",
|
|
39
|
+
"postcss": "8.5.25",
|
|
40
|
+
"postcss-cli": "11.0.1",
|
|
41
|
+
"puppeteer": "25.4.0",
|
|
42
|
+
"rimraf": "6.1.3",
|
|
43
|
+
"sass": "1.102.0",
|
|
44
|
+
"stylelint": "17.14.1",
|
|
45
|
+
"stylelint-config-standard-scss": "17.0.0"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "run-s clean sass postcss lint test",
|
|
49
|
+
"clean": "rimraf dist",
|
|
50
|
+
"lint": "stylelint 'src/**/*.scss'",
|
|
51
|
+
"lint:fix": "stylelint 'src/**/*.scss' --fix",
|
|
52
|
+
"postcss": "run-s postcss:process postcss:minify",
|
|
53
|
+
"postcss:minify": "postcss dist/*.css --dir dist --ext .min.css --env=minify",
|
|
54
|
+
"postcss:process": "postcss dist/*.css --dir dist",
|
|
55
|
+
"sass": "run-p sass:*",
|
|
56
|
+
"sass:core": "sass src/core/govbr-ds.scss dist/govbr-ds.css --no-source-map",
|
|
57
|
+
"sass:utilities": "sass src/utilities/govbr-utilities.scss dist/govbr-utilities.css --no-source-map",
|
|
58
|
+
"sass:utilities-all": "sass src/utilities/modules:dist/modules --no-source-map",
|
|
59
|
+
"sass:utilities-lite": "sass src/utilities/govbr-utilities-lite.scss dist/govbr-utilities-lite.css --no-source-map",
|
|
60
|
+
"test": "jest test/shared/build test/utilities",
|
|
61
|
+
"test:a11y": "jest test/a11y.test.js",
|
|
62
|
+
"test:build": "jest test/shared/build test/utilities/build",
|
|
63
|
+
"test:utilities": "jest test/utilities"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
// Reset CSS básico para garantir consistência entre navegadores
|
|
2
|
+
*,
|
|
3
|
+
*::before,
|
|
4
|
+
*::after {
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// Tipografia padrão
|
|
9
|
+
html {
|
|
10
|
+
font-size: var(--br-typography-font-size-font-base-secondary);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
body {
|
|
14
|
+
background-color: var(--br-color-background-main-primary);
|
|
15
|
+
border: 0;
|
|
16
|
+
color: var(--br-color-foreground-main-primary);
|
|
17
|
+
font: var(--br-typography-font-style-default);
|
|
18
|
+
margin: 0;
|
|
19
|
+
padding: 0;
|
|
20
|
+
|
|
21
|
+
// Força o browser a usar cor padrão no modo contraste
|
|
22
|
+
[data-contrast="enabled"] {
|
|
23
|
+
color: var(--br-color-foreground-main-primary);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Fonte sem serifa
|
|
28
|
+
.sans {
|
|
29
|
+
font-family: var(--br-typography-font-family-primary), sans-serif;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Fonte monoespaçada
|
|
33
|
+
.mono {
|
|
34
|
+
font-family: var(--br-typography-font-family-secondary), monospace;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Fonte com serifa
|
|
38
|
+
.serif {
|
|
39
|
+
font-family: var(--br-typography-font-family-tertiary), serif;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Links
|
|
43
|
+
a {
|
|
44
|
+
color: var(--br-state-interactive-color-main);
|
|
45
|
+
text-decoration: none;
|
|
46
|
+
|
|
47
|
+
// Links sublinhados dentro de parágrafos
|
|
48
|
+
p & {
|
|
49
|
+
text-decoration: underline;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Títulos
|
|
54
|
+
h1,
|
|
55
|
+
h2,
|
|
56
|
+
h3,
|
|
57
|
+
h4,
|
|
58
|
+
h5,
|
|
59
|
+
h6 {
|
|
60
|
+
margin: var(--br-spacing-layout-2) 0;
|
|
61
|
+
padding: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
h1,
|
|
65
|
+
.h1 {
|
|
66
|
+
font: var(--br-typography-font-style-heading1);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
h2,
|
|
70
|
+
.h2 {
|
|
71
|
+
font: var(--br-typography-font-style-heading2);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
h3,
|
|
75
|
+
.h3 {
|
|
76
|
+
font: var(--br-typography-font-style-heading3);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
h4,
|
|
80
|
+
.h4 {
|
|
81
|
+
font: var(--br-typography-font-style-heading4);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
h5,
|
|
85
|
+
.h5 {
|
|
86
|
+
font: var(--br-typography-font-style-heading5);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
h6,
|
|
90
|
+
.h6 {
|
|
91
|
+
font: var(--br-typography-font-style-heading6);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Parágrafos
|
|
95
|
+
p {
|
|
96
|
+
margin: 0 0 var(--br-spacing-layout-2);
|
|
97
|
+
padding: 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Parágrafos e listas
|
|
101
|
+
p,
|
|
102
|
+
ul,
|
|
103
|
+
ol,
|
|
104
|
+
li,
|
|
105
|
+
dl,
|
|
106
|
+
dd,
|
|
107
|
+
dt {
|
|
108
|
+
font: var(--br-typography-font-style-paragraph);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Formulários
|
|
112
|
+
button,
|
|
113
|
+
input,
|
|
114
|
+
select,
|
|
115
|
+
textarea {
|
|
116
|
+
background-color: var(--br-color-background-main-primary);
|
|
117
|
+
border: var(--br-form-border-style-default);
|
|
118
|
+
color: var(--br-color-foreground-main-primary);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
fieldset {
|
|
122
|
+
border: var(--br-form-border-style-default);
|
|
123
|
+
border-radius: var(--br-form-rounder-primary);
|
|
124
|
+
margin: 0 0 var(--br-spacing-layout-2);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.label,
|
|
128
|
+
label {
|
|
129
|
+
font: var(--br-typography-font-style-label);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.input,
|
|
133
|
+
input,
|
|
134
|
+
select,
|
|
135
|
+
textarea,
|
|
136
|
+
button,
|
|
137
|
+
input[type="checkbox"] ~ label,
|
|
138
|
+
input[type="radio"] ~ label {
|
|
139
|
+
font: var(--br-typography-font-style-input);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
textarea {
|
|
143
|
+
max-width: 100%;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
legend,
|
|
147
|
+
.legend {
|
|
148
|
+
font: var(--br-typography-font-style-legend);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
::placeholder {
|
|
152
|
+
color: var(--br-color-foreground-main-primary);
|
|
153
|
+
font: var(--br-typography-font-style-placeholder);
|
|
154
|
+
opacity: 1;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.placeholder {
|
|
158
|
+
font: var(--br-typography-font-style-placeholder);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Bloco de códigos
|
|
162
|
+
code,
|
|
163
|
+
.code {
|
|
164
|
+
background-color: var(--br-color-background-main-secondary);
|
|
165
|
+
border: var(--br-form-border-style-default);
|
|
166
|
+
border-color: color-mix(in srgb, var(--br-color-border-secondary), transparent 60%);
|
|
167
|
+
border-radius: var(--br-form-rounder-primary);
|
|
168
|
+
font: var(--br-typography-font-style-code);
|
|
169
|
+
padding: var(--br-spacing-adjust-1);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
pre {
|
|
173
|
+
background-color: var(--br-color-background-main-secondary);
|
|
174
|
+
border: var(--br-form-border-style-default);
|
|
175
|
+
border-color: color-mix(in srgb, var(--br-color-border-secondary), transparent 60%);
|
|
176
|
+
border-radius: var(--br-form-rounder-primary);
|
|
177
|
+
margin: var(--br-spacing-layout-2) 0;
|
|
178
|
+
overflow: auto;
|
|
179
|
+
padding: var(--br-spacing-layout-1);
|
|
180
|
+
|
|
181
|
+
code {
|
|
182
|
+
border: 0;
|
|
183
|
+
border-radius: 0;
|
|
184
|
+
padding: 0;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Imagens
|
|
189
|
+
img {
|
|
190
|
+
max-width: 100%;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
figure {
|
|
194
|
+
margin: 0 0 var(--br-spacing-layout-2);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
figcaption {
|
|
198
|
+
font: var(--br-typography-font-style-placeholder);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Tabelas
|
|
202
|
+
table {
|
|
203
|
+
border-collapse: collapse;
|
|
204
|
+
margin-bottom: var(--br-spacing-layout-2);
|
|
205
|
+
text-align: left;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
td,
|
|
209
|
+
th {
|
|
210
|
+
font: var(--br-typography-font-style-default);
|
|
211
|
+
padding: var(--br-spacing-layout-1);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
th {
|
|
215
|
+
background-color: var(--br-color-background-main-secondary);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
tr {
|
|
219
|
+
border-bottom: var(--br-form-border-style-default);
|
|
220
|
+
border-color: color-mix(in srgb, var(--br-color-border-secondary), transparent 60%);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
caption {
|
|
224
|
+
font: var(--br-typography-font-style-legend);
|
|
225
|
+
margin: 0 0 var(--br-spacing-layout-2);
|
|
226
|
+
text-align: left;
|
|
227
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// Input, select e textarea
|
|
2
|
+
input:not([type="checkbox"], [type="radio"]),
|
|
3
|
+
select,
|
|
4
|
+
textarea {
|
|
5
|
+
// Foco
|
|
6
|
+
&:focus {
|
|
7
|
+
outline: var(--br-state-focus-border-style-main-low);
|
|
8
|
+
outline-color: var(--br-state-focus-color-main);
|
|
9
|
+
transition-timing-function: var(--br-state-focus-easing-in);
|
|
10
|
+
transition-duration: var(--br-state-focus-duration-in);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Desabilitado
|
|
14
|
+
&:disabled,
|
|
15
|
+
&[disabled] {
|
|
16
|
+
opacity: var(--br-state-disabled-opacity);
|
|
17
|
+
cursor: not-allowed;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Somente leitura
|
|
21
|
+
&[readonly] {
|
|
22
|
+
background: var(--br-form-readonly-color-background);
|
|
23
|
+
border-width: var(--br-form-readonly-border-width);
|
|
24
|
+
color: var(--br-form-readonly-color-foreground-main);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Checkbox e radio
|
|
29
|
+
input[type="checkbox"],
|
|
30
|
+
input[type="radio"] {
|
|
31
|
+
// Interativo
|
|
32
|
+
&:not(:disabled),
|
|
33
|
+
&:not([disabled]) {
|
|
34
|
+
+ label {
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Foco
|
|
40
|
+
&:focus-visible {
|
|
41
|
+
outline: var(--br-state-focus-border-style-main-low);
|
|
42
|
+
outline-color: var(--br-state-focus-color-main);
|
|
43
|
+
transition-timing-function: var(--br-state-focus-easing-in);
|
|
44
|
+
transition-duration: var(--br-state-focus-duration-in);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Desabilitado
|
|
48
|
+
&:disabled,
|
|
49
|
+
&[disabled] {
|
|
50
|
+
+ label {
|
|
51
|
+
opacity: var(--br-state-disabled-opacity);
|
|
52
|
+
cursor: not-allowed;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Botões
|
|
58
|
+
input[type="button"],
|
|
59
|
+
input[type="submit"],
|
|
60
|
+
input[type="reset"],
|
|
61
|
+
button {
|
|
62
|
+
// Foco
|
|
63
|
+
&:focus-visible {
|
|
64
|
+
outline: var(--br-state-focus-border-style-main-high);
|
|
65
|
+
outline-color: var(--br-state-focus-color-main);
|
|
66
|
+
outline-offset: var(--br-state-focus-padding);
|
|
67
|
+
transition-timing-function: var(--br-state-focus-easing-in);
|
|
68
|
+
transition-duration: var(--br-state-focus-duration-in);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Desabilitado
|
|
72
|
+
&:disabled,
|
|
73
|
+
&[disabled] {
|
|
74
|
+
opacity: var(--br-state-disabled-opacity);
|
|
75
|
+
cursor: not-allowed;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Interativo
|
|
79
|
+
&:not(:disabled),
|
|
80
|
+
&:not([disabled]) {
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
transition-timing-function: var(--br-state-hover-easing-out);
|
|
83
|
+
transition-duration: var(--br-state-hover-duration-out);
|
|
84
|
+
|
|
85
|
+
// Pressionado
|
|
86
|
+
&:active {
|
|
87
|
+
box-shadow: var(--br-state-pressed-shadow-style);
|
|
88
|
+
transition-timing-function: var(--br-state-pressed-easing-in);
|
|
89
|
+
transition-duration: var(--br-state-pressed-duration-in);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Links
|
|
95
|
+
a {
|
|
96
|
+
transition-timing-function: var(--br-state-hover-easing-out);
|
|
97
|
+
transition-duration: var(--br-state-hover-duration-out);
|
|
98
|
+
|
|
99
|
+
// Hover
|
|
100
|
+
&:hover {
|
|
101
|
+
background-color: var(--br-state-hover-color-interactive-fg-main);
|
|
102
|
+
transition-timing-function: var(--br-state-hover-easing-in-default);
|
|
103
|
+
transition-duration: var(--br-state-hover-duration-in-default);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Foco
|
|
107
|
+
&:focus-visible {
|
|
108
|
+
outline: var(--br-state-focus-border-style-main-high);
|
|
109
|
+
outline-color: var(--br-state-focus-color-main);
|
|
110
|
+
outline-offset: var(--br-state-focus-padding);
|
|
111
|
+
transition-timing-function: var(--br-state-focus-easing-in);
|
|
112
|
+
transition-duration: var(--br-state-focus-duration-in);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Pressionado
|
|
116
|
+
&:active {
|
|
117
|
+
box-shadow: var(--br-state-pressed-shadow-style);
|
|
118
|
+
transition-timing-function: var(--br-state-pressed-easing-in);
|
|
119
|
+
transition-duration: var(--br-state-pressed-duration-in);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Cria os tokens temáticos
|
|
2
|
+
@use "../../../tokens/dist/css/theme/light/tokens.css" as light;
|
|
3
|
+
@use "../../../tokens/dist/css/theme/dark/tokens.css" as dark;
|
|
4
|
+
|
|
5
|
+
// Cria os tokens de preferência de esquema de cores do sistema
|
|
6
|
+
@use "../../../tokens/dist/css/theme/light/prefers-color-scheme.css" as prefers-light;
|
|
7
|
+
@use "../../../tokens/dist/css/theme/dark/prefers-color-scheme.css" as prefers-dark;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// Carrega os tokens do Design System
|
|
2
|
+
@use "../../../tokens/dist/scss/tokens";
|
|
3
|
+
|
|
4
|
+
// Módulos do Sass
|
|
5
|
+
@use "sass:map";
|
|
6
|
+
@use "sass:list";
|
|
7
|
+
@use "sass:string";
|
|
8
|
+
|
|
9
|
+
// Mapa de Tokens
|
|
10
|
+
$tokens: tokens.$tokens !default;
|
|
11
|
+
|
|
12
|
+
// Prefixo dos Tokens
|
|
13
|
+
$prefix: list.nth(map.keys(tokens.$tokens), 1) !default;
|
|
14
|
+
|
|
15
|
+
// Mapa de breakpoints
|
|
16
|
+
$map-breakpoints: map.get($tokens, $prefix, "grid", "breakpoint") !default;
|
|
17
|
+
$breakpoints: (
|
|
18
|
+
"xs": (
|
|
19
|
+
"width": map.get($tokens, $prefix, "grid", "breakpoint", "small", "default"),
|
|
20
|
+
"size": "small",
|
|
21
|
+
"columns": 4,
|
|
22
|
+
),
|
|
23
|
+
"sm": (
|
|
24
|
+
"width": map.get($tokens, $prefix, "grid", "breakpoint", "small", "extra"),
|
|
25
|
+
"size": "small",
|
|
26
|
+
"columns": 4,
|
|
27
|
+
),
|
|
28
|
+
"md": (
|
|
29
|
+
"width": map.get($tokens, $prefix, "grid", "breakpoint", "medium", "default"),
|
|
30
|
+
"size": "medium",
|
|
31
|
+
"columns": 8,
|
|
32
|
+
),
|
|
33
|
+
"lg": (
|
|
34
|
+
"width": map.get($tokens, $prefix, "grid", "breakpoint", "large", "default"),
|
|
35
|
+
"size": "large",
|
|
36
|
+
"columns": 12,
|
|
37
|
+
),
|
|
38
|
+
"xl": (
|
|
39
|
+
"width": map.get($tokens, $prefix, "grid", "breakpoint", "large", "extra"),
|
|
40
|
+
"size": "large",
|
|
41
|
+
"columns": 12,
|
|
42
|
+
),
|
|
43
|
+
) !default;
|
|
44
|
+
|
|
45
|
+
// Lista de breakpoints para iteração
|
|
46
|
+
$breakpoint-keys: [];
|
|
47
|
+
|
|
48
|
+
// Preenche a lista de breakpoints, excluindo "xs" que não precisa de media query
|
|
49
|
+
@each $breakpoint in map.keys($breakpoints) {
|
|
50
|
+
@if $breakpoint != "xs" {
|
|
51
|
+
$breakpoint-keys: list.join($breakpoint-keys, $breakpoint);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/// Obtém o breakpoint anterior no Mapa de Breakpoints.
|
|
56
|
+
/// @param {String} $breakpoint - Índice do Mapa de Breakpoints
|
|
57
|
+
@function get-previous-breakpoint($breakpoint) {
|
|
58
|
+
// Obtém os índices do mapa de breakpoints
|
|
59
|
+
$keys: map.keys($breakpoints);
|
|
60
|
+
|
|
61
|
+
// Obtém o índice do breakpoint atual na lista de índices
|
|
62
|
+
$index: list.index($keys, $breakpoint);
|
|
63
|
+
|
|
64
|
+
// Calcula o índice do breakpoint anterior
|
|
65
|
+
$previous-index: $index - 1;
|
|
66
|
+
|
|
67
|
+
// Se o índice calculado for menor que 1, ajusta para o último breakpoint na lista (torna o código circular)
|
|
68
|
+
@if $previous-index < 1 {
|
|
69
|
+
$previous-index: list.length($keys);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Retorna o nome do breakpoint anterior
|
|
73
|
+
@return list.nth($keys, $previous-index);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/// Converte string PascalCase para kebab-case
|
|
77
|
+
/// @param {String} $str String em PascalCase
|
|
78
|
+
/// @return {String} String em kebab-case
|
|
79
|
+
@function pascal-to-kebab($str) {
|
|
80
|
+
$result: "";
|
|
81
|
+
$len: string.length($str);
|
|
82
|
+
|
|
83
|
+
@for $i from 1 through $len {
|
|
84
|
+
$char: string.slice($str, $i, $i);
|
|
85
|
+
|
|
86
|
+
@if $i > 1 and string.index("ABCDEFGHIJKLMNOPQRSTUVWXYZ", $char) {
|
|
87
|
+
$result: $result + "-" + string.to-lower-case($char);
|
|
88
|
+
} @else {
|
|
89
|
+
$result: $result + string.to-lower-case($char);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@return $result;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/// Adiciona o prefixo de breakpoint ao nome da classe
|
|
97
|
+
/// @param {String} $class-name Nome da classe
|
|
98
|
+
/// @param {String} $breakpoint Nome do breakpoint (ex: sm, md, lg, xl)
|
|
99
|
+
/// @return {String} Nome da classe com prefixo de breakpoint
|
|
100
|
+
@function class-with-breakpoint($class-name, $breakpoint: null) {
|
|
101
|
+
@if $breakpoint {
|
|
102
|
+
$breakpoint: "from-#{$breakpoint}-";
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@return "#{$breakpoint}#{$class-name}";
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/// Mixin para media query acima do breakpoint
|
|
109
|
+
/// @param {String} $breakpoint Nome do breakpoint (ex: sm, md, lg, xl)
|
|
110
|
+
@mixin from-breakpoint($breakpoint) {
|
|
111
|
+
$width: map.get($breakpoints, $breakpoint, "width");
|
|
112
|
+
|
|
113
|
+
@media (min-width: $width) {
|
|
114
|
+
@content;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// Carrega os módulos do projeto
|
|
2
|
+
@use "../core/utils";
|
|
3
|
+
@use "lite-helpers";
|
|
4
|
+
|
|
5
|
+
// Carrega módulos do Sass
|
|
6
|
+
@use "sass:map";
|
|
7
|
+
@use "sass:meta";
|
|
8
|
+
|
|
9
|
+
// Configurações do módulo
|
|
10
|
+
$namespacing: "color";
|
|
11
|
+
$module-map: map.get(utils.$tokens, utils.$prefix, $namespacing);
|
|
12
|
+
$scope: #{utils.$prefix}-#{$namespacing};
|
|
13
|
+
|
|
14
|
+
// Mapa com todas as cores
|
|
15
|
+
$map-all-colors: map.remove($module-map, "foreground", "background", "border");
|
|
16
|
+
|
|
17
|
+
/// Gera classes para as cores de fundo do tema
|
|
18
|
+
@mixin make-theme-backgrounds {
|
|
19
|
+
$map-backgrounds: map.get($module-map, "background");
|
|
20
|
+
|
|
21
|
+
@each $mode in map.keys($map-backgrounds) {
|
|
22
|
+
@each $emphasis in map.keys(map.get($map-backgrounds, $mode)) {
|
|
23
|
+
// Ex: .background-main-primary
|
|
24
|
+
.background-#{$mode}-#{$emphasis} {
|
|
25
|
+
background-color: var(--#{$scope}-background-#{$mode}-#{$emphasis});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/// Gera classes para as cores de texto do tema
|
|
32
|
+
@mixin make-theme-foregrounds {
|
|
33
|
+
$map-foregrounds: map.get($module-map, "foreground");
|
|
34
|
+
|
|
35
|
+
@each $mode in map.keys($map-foregrounds) {
|
|
36
|
+
@each $emphasis in map.keys(map.get($map-foregrounds, $mode)) {
|
|
37
|
+
// Ex: .color-main-primary
|
|
38
|
+
.color-#{$mode}-#{$emphasis} {
|
|
39
|
+
color: var(--#{$scope}-foreground-#{$mode}-#{$emphasis});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/// Gera classes para as cores de borda do tema
|
|
46
|
+
@mixin make-theme-borders {
|
|
47
|
+
$map-borders: map.get($module-map, "border");
|
|
48
|
+
|
|
49
|
+
@each $emphasis in map.keys($map-borders) {
|
|
50
|
+
// Ex: .border-color-primary
|
|
51
|
+
.border-color-#{$emphasis} {
|
|
52
|
+
border-color: var(--#{$scope}-border-#{$emphasis});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/// Gera classes para as cores de estado (error, alert, success)
|
|
58
|
+
@mixin make-state-colors {
|
|
59
|
+
$states: "error", "alert", "success";
|
|
60
|
+
$interactives: "interactive", "cta";
|
|
61
|
+
|
|
62
|
+
@each $state in $states {
|
|
63
|
+
// Backgrounds
|
|
64
|
+
.background-#{$state} {
|
|
65
|
+
background-color: var(--#{utils.$prefix}-state-#{$state}-color-default);
|
|
66
|
+
color: var(--#{utils.$prefix}-state-#{$state}-color-foreground);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Foregrounds
|
|
70
|
+
.color-#{$state} {
|
|
71
|
+
color: var(--#{utils.$prefix}-state-#{$state}-color-default);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Borders
|
|
75
|
+
.border-color-#{$state} {
|
|
76
|
+
border-color: var(--#{utils.$prefix}-state-#{$state}-color-default);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@each $interactive in $interactives {
|
|
81
|
+
@each $emphasis in "main", "contrast" {
|
|
82
|
+
.background-#{$interactive}-#{$emphasis} {
|
|
83
|
+
background-color: var(--#{utils.$prefix}-state-#{$interactive}-color-#{$emphasis});
|
|
84
|
+
color: var(--#{utils.$prefix}-state-#{$interactive}-color-foreground-#{$emphasis});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Foregrounds
|
|
88
|
+
.color-#{$interactive}-#{$emphasis} {
|
|
89
|
+
color: var(--#{utils.$prefix}-state-#{$interactive}-color-#{$emphasis});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Borders
|
|
93
|
+
.border-color-#{$interactive}-#{$emphasis} {
|
|
94
|
+
border-color: var(--#{utils.$prefix}-state-#{$interactive}-color-#{$emphasis});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/// Gera classes para todas as cores definidas no mapa
|
|
101
|
+
@mixin make-all-colors {
|
|
102
|
+
@each $family-color in map.keys($map-all-colors) {
|
|
103
|
+
// Lista de luminâncias disponíveis para a família de cor
|
|
104
|
+
$lightness-keys: map.keys(map.get($map-all-colors, $family-color));
|
|
105
|
+
|
|
106
|
+
@each $lightness in $lightness-keys {
|
|
107
|
+
// Gera o nome da cor
|
|
108
|
+
$color-name: utils.pascal-to-kebab($family-color) + "-" + $lightness;
|
|
109
|
+
|
|
110
|
+
// Backgrounds
|
|
111
|
+
.background-#{$color-name} {
|
|
112
|
+
background-color: var(--#{$scope}-#{$color-name});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Foregrounds
|
|
116
|
+
.color-#{$color-name} {
|
|
117
|
+
color: var(--#{$scope}-#{$color-name});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Borders
|
|
121
|
+
.border-color-#{$color-name} {
|
|
122
|
+
border-color: var(--#{$scope}-#{$color-name});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/// Mixin para gerar todas as classes de cores
|
|
129
|
+
@mixin make-color {
|
|
130
|
+
@include make-theme-backgrounds;
|
|
131
|
+
@include make-theme-foregrounds;
|
|
132
|
+
@include make-theme-borders;
|
|
133
|
+
@include make-state-colors;
|
|
134
|
+
|
|
135
|
+
// Verifica se deve incluir as classes para todas as cores
|
|
136
|
+
@if lite-helpers.should-include-all-colors("color") {
|
|
137
|
+
@include make-all-colors;
|
|
138
|
+
}
|
|
139
|
+
}
|