@govbr-ds/tokens 4.0.0-next.1
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 +160 -0
- package/dist/css/themes/dark.css +54 -0
- package/dist/css/themes/light.css +54 -0
- package/dist/css/tokens.css +671 -0
- package/dist/js/themes/dark.js +52 -0
- package/dist/js/themes/light.js +52 -0
- package/dist/js/tokens.js +669 -0
- package/dist/json/themes/dark.json +1210 -0
- package/dist/json/themes/light.json +1210 -0
- package/dist/json/tokens.json +11942 -0
- package/dist/scss/_tokens.scss +674 -0
- package/dist/scss/themes/_dark.scss +55 -0
- package/dist/scss/themes/_light.scss +55 -0
- package/package.json +40 -0
- package/src/figma/tokens.json +3587 -0
- package/src/figma/variables/color.json +1948 -0
- package/src/figma/variables/manifest.json +16 -0
- package/src/figma/variables/spacing.json +52 -0
- package/src/figma/variables/surface.json +102 -0
- package/src/figma/variables/typography.json +148 -0
- package/src/style-dictionary/themes/dark.json +3313 -0
- package/src/style-dictionary/themes/light.json +3313 -0
- package/src/style-dictionary/tokens.json +3045 -0
package/README.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# *Tokens* de *Design*
|
|
2
|
+
|
|
3
|
+
Este é o repositório de *Tokens* para os projetos [GOVBR-DS](http://gov.br/ds/).
|
|
4
|
+
|
|
5
|
+
## Tecnologias
|
|
6
|
+
|
|
7
|
+
Esse projeto é desenvolvido usando:
|
|
8
|
+
|
|
9
|
+
- [Node.js](https://nodejs.org/)
|
|
10
|
+
- [Style Dictionary](https://amzn.github.io/style-dictionary/#/)
|
|
11
|
+
|
|
12
|
+
## Como usar nossa biblioteca em seu projeto?
|
|
13
|
+
|
|
14
|
+
### Instalação dos *tokens*
|
|
15
|
+
|
|
16
|
+
- Baixe o pacote de *tokens* usando o comando: `npm install --save @govbr-ds/tokens`;
|
|
17
|
+
- Dentro da pasta **dist** encontram-se vários formatos compilados;
|
|
18
|
+
- Carregue o formato adequado no seu projeto.
|
|
19
|
+
|
|
20
|
+
Exemplo **CSS**:
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<head>
|
|
24
|
+
<!-- Tokens -->
|
|
25
|
+
<link rel="stylesheet" href="diretorio-dos-tokens/dist/css/tokens.css" />
|
|
26
|
+
|
|
27
|
+
<!-- Temas -->
|
|
28
|
+
<link rel="stylesheet" href="diretorio-dos-tokens/dist/css/themes/light.css" />
|
|
29
|
+
<link rel="stylesheet" href="diretorio-dos-tokens/dist/css/themes/dark.css" />
|
|
30
|
+
</head>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Exemplo **SCSS**:
|
|
34
|
+
|
|
35
|
+
```scss
|
|
36
|
+
// Tokens
|
|
37
|
+
@import "diretorio-dos-tokens/dist/scss/tokens";
|
|
38
|
+
|
|
39
|
+
// Temas
|
|
40
|
+
@import "diretorio-dos-tokens/dist/scss/themes/light";
|
|
41
|
+
@import "diretorio-dos-tokens/dist/scss/themes/dark";
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Configuração do tema
|
|
45
|
+
|
|
46
|
+
Use o atributo **data-br-theme** para configurar o tema.
|
|
47
|
+
|
|
48
|
+
Recomendamos que ele seja aplicado na tag HTML de maior hierarquia. Veja os exemplos a seguir:
|
|
49
|
+
|
|
50
|
+
- Uso na tag HTML:
|
|
51
|
+
|
|
52
|
+
```html
|
|
53
|
+
<html data-br-theme="light">
|
|
54
|
+
<head>...</head>
|
|
55
|
+
<body>...</body>
|
|
56
|
+
</html>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
- Uso na tag BODY:
|
|
60
|
+
|
|
61
|
+
```html
|
|
62
|
+
<html>
|
|
63
|
+
<head>...</head>
|
|
64
|
+
<body data-br-theme="light">...</body>
|
|
65
|
+
</html>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- Uso na tag DIV:
|
|
69
|
+
|
|
70
|
+
```html
|
|
71
|
+
<html>
|
|
72
|
+
<head>...</head>
|
|
73
|
+
<body>
|
|
74
|
+
<div data-br-theme="light">...</div>
|
|
75
|
+
</body>
|
|
76
|
+
</html>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Aplique o exemplo mais adequável ao seu projeto.
|
|
80
|
+
|
|
81
|
+
### Uso dos *tokens*
|
|
82
|
+
|
|
83
|
+
O uso dos *tokens* varia de acordo da tecnologia, assim como a formação dos seus nomes.
|
|
84
|
+
|
|
85
|
+
- Em CSS e SCSS é usado o padrão [*kebab case*](https://developer.mozilla.org/en-US/docs/Glossary/Kebab_case)
|
|
86
|
+
- Em JS é usado o padrão [*camel case*](https://developer.mozilla.org/en-US/docs/Glossary/Camel_case).
|
|
87
|
+
|
|
88
|
+
#### Tokens no CSS
|
|
89
|
+
|
|
90
|
+
Os *tokens* CSS são usados como **variáveis CSS**. Aprenda mais sobre `var()` em <https://developer.mozilla.org/pt-BR/docs/Web/CSS/var>.
|
|
91
|
+
|
|
92
|
+
```css
|
|
93
|
+
.seletor-1 {
|
|
94
|
+
background-color: var(--color-red-50);
|
|
95
|
+
color: var(--color-pure-100);
|
|
96
|
+
margin: var(--spacing-layout-03);
|
|
97
|
+
padding: var(--spacing-layout-01);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.seletor-2 {
|
|
101
|
+
background-color: var(--theme-interactive-main);
|
|
102
|
+
color: var(--theme-interactive-text-main);
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
#### Tokens no SCSS
|
|
107
|
+
|
|
108
|
+
Recomendamos usar os *tokens* como **variáveis CSS** para manter a compatibilidade com os temas. Exemplo:
|
|
109
|
+
|
|
110
|
+
```scss
|
|
111
|
+
.seletor {
|
|
112
|
+
background-color: var(--color-pure-0);
|
|
113
|
+
color: var(--color-pure-100);
|
|
114
|
+
margin: var(--spacing-layout-03);
|
|
115
|
+
padding: var(--spacing-layout-01);
|
|
116
|
+
|
|
117
|
+
// Cria as variações
|
|
118
|
+
@each $type in "success", "alert", "error" {
|
|
119
|
+
&-#{$type} {
|
|
120
|
+
background-color: var(--theme-#{$type}-main);
|
|
121
|
+
color: var(--theme-#{$type}-text);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Caso haja necessidade, os *tokens* SCSS estão disponíveis no formato ***map***. Aprenda mais sobre esse formato em <https://sass-lang.com/documentation/values/maps/>.
|
|
128
|
+
|
|
129
|
+
### Customização dos *tokens*
|
|
130
|
+
|
|
131
|
+
1. Faça o clone deste repositório usando `git clone git@gitlab.com:govbr-ds/ds/govbr-ds-tokens.git`
|
|
132
|
+
2. Baixe todas as dependências do projeto usando `npm install`
|
|
133
|
+
3. Localize os *tokens* na pasta 'src' e faça as modificações necessárias
|
|
134
|
+
4. Compile os novos *tokens* usando `npm run build`
|
|
135
|
+
|
|
136
|
+
## Precisa de ajuda?
|
|
137
|
+
|
|
138
|
+
> Por favor **não** crie issues para fazer perguntas...
|
|
139
|
+
|
|
140
|
+
Use nossos canais abaixo para obter tirar suas dúvidas:
|
|
141
|
+
|
|
142
|
+
- Site do GovBR-DS <http://gov.br/ds>
|
|
143
|
+
|
|
144
|
+
- Pelo nosso email <govbr-ds@serpro.gov.br>
|
|
145
|
+
|
|
146
|
+
- Usando nosso canal no discord <https://discord.gg/U5GwPfqhUP>
|
|
147
|
+
|
|
148
|
+
## Commits
|
|
149
|
+
|
|
150
|
+
Nesse projeto usamos um padrão para branches e commits. Por favor observe a documentação na nossa [wiki](https://gov.br/ds/wiki/ 'Wiki') para aprender sobre os nossos padrões.
|
|
151
|
+
|
|
152
|
+
## Apêndice
|
|
153
|
+
|
|
154
|
+
## Créditos
|
|
155
|
+
|
|
156
|
+
Os Web Components do [GovBR-DS](https://gov.br/ds/ 'GovBR-DS') são criados pelo [SERPRO](https://www.serpro.gov.br/ 'SERPRO | Serviço Federal de Processamento de Dados') e [Dataprev](https://www.dataprev.gov.br/ 'Dataprev | Empresa de Tecnologia e Informações da Previdência') juntamente com a participação da comunidade.
|
|
157
|
+
|
|
158
|
+
## Licença
|
|
159
|
+
|
|
160
|
+
Nesse projeto usamos a licença MIT.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[data-br-theme="dark"] {
|
|
2
|
+
--theme-text-main-base: #FCFCFC;
|
|
3
|
+
--theme-text-main-alternative: #CCCCCC;
|
|
4
|
+
--theme-text-contrast-base: #FCFCFC;
|
|
5
|
+
--theme-text-contrast-alternative: #CCCCCC;
|
|
6
|
+
--theme-surface-main-base: #2D2E2F;
|
|
7
|
+
--theme-surface-main-alternative: #1C1D1F;
|
|
8
|
+
--theme-surface-contrast-base: #2D2E2F;
|
|
9
|
+
--theme-surface-contrast-alternative: #1C1D1F;
|
|
10
|
+
--theme-surface-text-main-base: #FCFCFC;
|
|
11
|
+
--theme-surface-text-main-alternative: #FCFCFC;
|
|
12
|
+
--theme-surface-text-contrast-base: #FCFCFC;
|
|
13
|
+
--theme-surface-text-contrast-alternative: #FCFCFC;
|
|
14
|
+
--theme-border-base: #4A4A4A;
|
|
15
|
+
--theme-border-alternative: #757575;
|
|
16
|
+
--theme-interactive-main: #81AEFC;
|
|
17
|
+
--theme-interactive-contrast: #81AEFC;
|
|
18
|
+
--theme-interactive-text-main: #000000;
|
|
19
|
+
--theme-interactive-text-contrast: #000000;
|
|
20
|
+
--theme-cta-main: #21C834;
|
|
21
|
+
--theme-cta-contrast: #21C834;
|
|
22
|
+
--theme-cta-text-main: #000000;
|
|
23
|
+
--theme-cta-text-contrast: #000000;
|
|
24
|
+
--theme-success-main: #538200;
|
|
25
|
+
--theme-success-text: #FFFFFF;
|
|
26
|
+
--theme-alert-main: #FFCD07;
|
|
27
|
+
--theme-alert-text: #000000;
|
|
28
|
+
--theme-error-main: #E52207;
|
|
29
|
+
--theme-error-text: #FFFFFF;
|
|
30
|
+
--theme-disabled-main: #A9AEB1;
|
|
31
|
+
--theme-disabled-contrast: #A9AEB1;
|
|
32
|
+
--theme-visited-main: #2F4668;
|
|
33
|
+
--theme-visited-contrast: #C5D4EB;
|
|
34
|
+
--theme-hover-bright: rgba(12, 50, 111, 0.6);
|
|
35
|
+
--theme-hover-dim: rgba(212, 229, 255, 0.8);
|
|
36
|
+
--theme-focus-main: #DA680B;
|
|
37
|
+
--theme-focus-contrast: #FF8C00;
|
|
38
|
+
--theme-active-main: #5992ED;
|
|
39
|
+
--theme-active-contrast: #5992ED;
|
|
40
|
+
--theme-active-text-main: #000000;
|
|
41
|
+
--theme-active-text-contrast: #000000;
|
|
42
|
+
--theme-selected-main: #2670E8;
|
|
43
|
+
--theme-selected-contrast: #2670E8;
|
|
44
|
+
--theme-selected-text-main: #FFFFFF;
|
|
45
|
+
--theme-selected-text-contrast: #FFFFFF;
|
|
46
|
+
--theme-on-main: #155BCB;
|
|
47
|
+
--theme-on-contrast: #155BCB;
|
|
48
|
+
--theme-on-text-main: #FFFFFF;
|
|
49
|
+
--theme-on-text-contrast: #FFFFFF;
|
|
50
|
+
--theme-off-main: #636363;
|
|
51
|
+
--theme-off-contrast: #636363;
|
|
52
|
+
--theme-off-text-main: #FFFFFF;
|
|
53
|
+
--theme-off-text-contrast: #FFFFFF;
|
|
54
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[data-br-theme="light"] {
|
|
2
|
+
--theme-text-main-base: #1B1B1B;
|
|
3
|
+
--theme-text-main-alternative: #636363;
|
|
4
|
+
--theme-text-contrast-base: #FCFCFC;
|
|
5
|
+
--theme-text-contrast-alternative: #CCCCCC;
|
|
6
|
+
--theme-surface-main-base: #FCFCFC;
|
|
7
|
+
--theme-surface-main-alternative: #F0F0F0;
|
|
8
|
+
--theme-surface-contrast-base: #252F3E;
|
|
9
|
+
--theme-surface-contrast-alternative: #2F4668;
|
|
10
|
+
--theme-surface-text-main-base: #1B1B1B;
|
|
11
|
+
--theme-surface-text-main-alternative: #1B1B1B;
|
|
12
|
+
--theme-surface-text-contrast-base: #FCFCFC;
|
|
13
|
+
--theme-surface-text-contrast-alternative: #FCFCFC;
|
|
14
|
+
--theme-border-base: #CCCCCC;
|
|
15
|
+
--theme-border-alternative: #888888;
|
|
16
|
+
--theme-interactive-main: #0040B4;
|
|
17
|
+
--theme-interactive-contrast: #ADCDFF;
|
|
18
|
+
--theme-interactive-text-main: #FFFFFF;
|
|
19
|
+
--theme-interactive-text-contrast: #000000;
|
|
20
|
+
--theme-cta-main: #216E1F;
|
|
21
|
+
--theme-cta-contrast: #70E17B;
|
|
22
|
+
--theme-cta-text-main: #FFFFFF;
|
|
23
|
+
--theme-cta-text-contrast: #000000;
|
|
24
|
+
--theme-success-main: #538200;
|
|
25
|
+
--theme-success-text: #FFFFFF;
|
|
26
|
+
--theme-alert-main: #FFCD07;
|
|
27
|
+
--theme-alert-text: #000000;
|
|
28
|
+
--theme-error-main: #E52207;
|
|
29
|
+
--theme-error-text: #FFFFFF;
|
|
30
|
+
--theme-disabled-main: #4A4A4A;
|
|
31
|
+
--theme-disabled-contrast: #CCCCCC;
|
|
32
|
+
--theme-visited-main: #2F4668;
|
|
33
|
+
--theme-visited-contrast: #C5D4EB;
|
|
34
|
+
--theme-hover-bright: rgba(212, 229, 255, 0.6);
|
|
35
|
+
--theme-hover-dim: rgba(12, 50, 111, 0.8);
|
|
36
|
+
--theme-focus-main: #DA680B;
|
|
37
|
+
--theme-focus-contrast: #FF8C00;
|
|
38
|
+
--theme-active-main: #0C326F;
|
|
39
|
+
--theme-active-contrast: #81AEFC;
|
|
40
|
+
--theme-active-text-main: #FFFFFF;
|
|
41
|
+
--theme-active-text-contrast: #000000;
|
|
42
|
+
--theme-selected-main: #2670E8;
|
|
43
|
+
--theme-selected-contrast: #5992ED;
|
|
44
|
+
--theme-selected-text-main: #FFFFFF;
|
|
45
|
+
--theme-selected-text-contrast: #000000;
|
|
46
|
+
--theme-on-main: #5992ED;
|
|
47
|
+
--theme-on-contrast: #2670E8;
|
|
48
|
+
--theme-on-text-main: #000000;
|
|
49
|
+
--theme-on-text-contrast: #FFFFFF;
|
|
50
|
+
--theme-off-main: #888888;
|
|
51
|
+
--theme-off-contrast: #757575;
|
|
52
|
+
--theme-off-text-main: #000000;
|
|
53
|
+
--theme-off-text-contrast: #FFFFFF;
|
|
54
|
+
}
|