@thecodecodex/design-system 0.1.0 → 0.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/README.md +64 -2
- package/dist/components/AppShell.d.ts +32 -0
- package/dist/components/AppShell.js +28 -0
- package/dist/components/Button.d.ts +10 -0
- package/dist/components/Button.js +20 -0
- package/dist/components/ChipToggles.d.ts +11 -0
- package/dist/components/ChipToggles.js +9 -0
- package/dist/components/ConfirmDialog.d.ts +14 -0
- package/dist/components/ConfirmDialog.js +10 -0
- package/dist/components/CopyButton.d.ts +10 -0
- package/dist/components/CopyButton.js +12 -0
- package/dist/components/DataGrid.d.ts +15 -0
- package/dist/components/DataGrid.js +54 -0
- package/dist/components/Dialog.d.ts +15 -0
- package/dist/components/Dialog.js +26 -0
- package/dist/components/Disclosure.d.ts +25 -0
- package/dist/components/Disclosure.js +12 -0
- package/dist/components/LogView.d.ts +14 -0
- package/dist/components/LogView.js +36 -0
- package/dist/components/Markdown.d.ts +4 -0
- package/dist/components/Markdown.js +119 -0
- package/dist/components/Meter.d.ts +7 -0
- package/dist/components/Meter.js +7 -0
- package/dist/components/Notice.d.ts +9 -0
- package/dist/components/Notice.js +19 -0
- package/dist/components/PageHeader.d.ts +7 -0
- package/dist/components/PageHeader.js +5 -0
- package/dist/components/Popover.d.ts +16 -0
- package/dist/components/Popover.js +31 -0
- package/dist/components/SearchField.d.ts +8 -0
- package/dist/components/SearchField.js +8 -0
- package/dist/components/SectionPanel.d.ts +13 -0
- package/dist/components/SectionPanel.js +9 -0
- package/dist/components/Segmented.d.ts +12 -6
- package/dist/components/Segmented.js +7 -3
- package/dist/components/Stat.d.ts +12 -0
- package/dist/components/Stat.js +7 -0
- package/dist/components/StatusTag.d.ts +15 -0
- package/dist/components/StatusTag.js +28 -0
- package/dist/components/Tabs.d.ts +12 -0
- package/dist/components/Tabs.js +12 -0
- package/dist/components/ThemeMenu.d.ts +4 -0
- package/dist/components/ThemeMenu.js +52 -0
- package/dist/components/Toast.d.ts +5 -0
- package/dist/components/Toast.js +6 -0
- package/dist/components/icons.d.ts +19 -0
- package/dist/components/icons.js +17 -0
- package/dist/components/index.d.ts +21 -0
- package/dist/components/index.js +21 -0
- package/dist/components/labels.d.ts +42 -0
- package/dist/components/labels.js +34 -0
- package/package.json +24 -9
- package/src/styles/base.css +1 -37
- package/src/styles/content.css +39 -0
- package/src/styles/index.css +1 -0
- package/src/styles/raw.d.ts +5 -0
- package/src/styles/themes.css +30 -0
- package/src/styles/themes.test.ts +25 -0
- package/src/styles/tokens.css +10 -0
package/src/styles/base.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Base: barras de rolagem, foco
|
|
1
|
+
/* Base: barras de rolagem, foco e seleção. Serve a sites e a apps (títulos e tabelas de conteúdo ficam em content.css) */
|
|
2
2
|
@layer base {
|
|
3
3
|
|
|
4
4
|
/* Barras de rolagem: padrão (Firefox, Chrome/Edge 121+); a da página usa o fundo como trilho,
|
|
@@ -69,42 +69,6 @@
|
|
|
69
69
|
outline-offset: 2px;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
h1 {
|
|
73
|
-
@apply font-display uppercase font-black leading-none mb-6 mt-12;
|
|
74
|
-
font-size: clamp(2rem, 4vw, 2.5rem);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
h2 {
|
|
78
|
-
@apply font-display uppercase font-extrabold leading-none mb-5 mt-10;
|
|
79
|
-
font-size: clamp(1.6rem, 3vw, 2rem);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
h3 {
|
|
83
|
-
@apply font-display font-bold leading-none mb-4 mt-8;
|
|
84
|
-
font-size: clamp(1.35rem, 2.5vw, 1.75rem);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
h4 {
|
|
88
|
-
@apply font-display tracking-wide font-semibold leading-none mb-4 mt-6;
|
|
89
|
-
font-size: clamp(1.2rem, 2vw, 1.6rem);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
h5 {
|
|
93
|
-
@apply font-display tracking-wide font-medium leading-none mb-3 mt-5;
|
|
94
|
-
font-size: clamp(1.125rem, 1.5vw, 1.5rem);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
h6 {
|
|
98
|
-
@apply font-display font-normal leading-none mb-2 mt-4;
|
|
99
|
-
font-size: clamp(1.125rem, 1.5vw, 1.5rem);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
table:not(.plain),
|
|
103
|
-
table:not(.plain) th,
|
|
104
|
-
table:not(.plain) td {
|
|
105
|
-
border: 1px solid var(--border);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
72
|
::selection {
|
|
109
73
|
color: var(--bg-primary);
|
|
110
74
|
background: var(--contrast);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* Conteúdo editorial: títulos com escala e margens de artigo, bordas em toda tabela.
|
|
2
|
+
* Faz parte de styles.css (sites). Apps/painéis costumam dispensar: importe tokens.css + themes.css + base.css. */
|
|
3
|
+
@layer base {
|
|
4
|
+
h1 {
|
|
5
|
+
@apply font-display uppercase font-black leading-none mb-6 mt-12;
|
|
6
|
+
font-size: clamp(2rem, 4vw, 2.5rem);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
h2 {
|
|
10
|
+
@apply font-display uppercase font-extrabold leading-none mb-5 mt-10;
|
|
11
|
+
font-size: clamp(1.6rem, 3vw, 2rem);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
h3 {
|
|
15
|
+
@apply font-display font-bold leading-none mb-4 mt-8;
|
|
16
|
+
font-size: clamp(1.35rem, 2.5vw, 1.75rem);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
h4 {
|
|
20
|
+
@apply font-display tracking-wide font-semibold leading-none mb-4 mt-6;
|
|
21
|
+
font-size: clamp(1.2rem, 2vw, 1.6rem);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
h5 {
|
|
25
|
+
@apply font-display tracking-wide font-medium leading-none mb-3 mt-5;
|
|
26
|
+
font-size: clamp(1.125rem, 1.5vw, 1.5rem);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
h6 {
|
|
30
|
+
@apply font-display font-normal leading-none mb-2 mt-4;
|
|
31
|
+
font-size: clamp(1.125rem, 1.5vw, 1.5rem);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
table:not(.plain),
|
|
35
|
+
table:not(.plain) th,
|
|
36
|
+
table:not(.plain) td {
|
|
37
|
+
border: 1px solid var(--border);
|
|
38
|
+
}
|
|
39
|
+
}
|
package/src/styles/index.css
CHANGED
package/src/styles/themes.css
CHANGED
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
/* gráficos: slots 1 e 2 da paleta de dataviz, validados (CVD e contraste) contra a superfície deste tema */
|
|
17
17
|
--chart-1: #2a78d6;
|
|
18
18
|
--chart-2: #eb6834;
|
|
19
|
+
/* status (ligado/desligado, ok/atenção/erro): texto, contorno e ponto; ≥ 4.5:1 sobre bg-primary e sobre o -soft */
|
|
20
|
+
--ok: #166534;
|
|
21
|
+
--warn: #854d0e;
|
|
22
|
+
--danger: #be123c;
|
|
23
|
+
--info: #1d4ed8;
|
|
19
24
|
/* diff: fundo da linha e realce do trecho alterado; texto do tema ≥ 4.5:1 sobre todos */
|
|
20
25
|
--diff-add: #dcfce7;
|
|
21
26
|
--diff-add-strong: #86efac;
|
|
@@ -50,6 +55,11 @@
|
|
|
50
55
|
/* gráficos: slots 1 e 2 da paleta de dataviz, validados (CVD e contraste) contra a superfície deste tema */
|
|
51
56
|
--chart-1: #2a78d6;
|
|
52
57
|
--chart-2: #eb6834;
|
|
58
|
+
/* status (ligado/desligado, ok/atenção/erro): texto, contorno e ponto; ≥ 4.5:1 sobre bg-primary e sobre o -soft */
|
|
59
|
+
--ok: #166534;
|
|
60
|
+
--warn: #854d0e;
|
|
61
|
+
--danger: #9f1239;
|
|
62
|
+
--info: #1e40af;
|
|
53
63
|
/* diff: fundo da linha e realce do trecho alterado; texto do tema ≥ 4.5:1 sobre todos */
|
|
54
64
|
--diff-add: #dcefd4;
|
|
55
65
|
--diff-add-strong: #9fd18a;
|
|
@@ -84,6 +94,11 @@
|
|
|
84
94
|
/* gráficos: slots 1 e 2 da paleta de dataviz, validados (CVD e contraste) contra a superfície deste tema */
|
|
85
95
|
--chart-1: #3987e5;
|
|
86
96
|
--chart-2: #d95926;
|
|
97
|
+
/* status (ligado/desligado, ok/atenção/erro): texto, contorno e ponto; ≥ 4.5:1 sobre bg-primary e sobre o -soft */
|
|
98
|
+
--ok: #6ee7a0;
|
|
99
|
+
--warn: #f2c35a;
|
|
100
|
+
--danger: #ff8fa3;
|
|
101
|
+
--info: #93c5fd;
|
|
87
102
|
/* diff: fundo da linha e realce do trecho alterado; texto do tema ≥ 4.5:1 sobre todos */
|
|
88
103
|
--diff-add: #1f3a2a;
|
|
89
104
|
--diff-add-strong: #2f6b45;
|
|
@@ -118,6 +133,11 @@
|
|
|
118
133
|
/* gráficos: slots 1 e 2 da paleta de dataviz, validados (CVD e contraste) contra a superfície deste tema */
|
|
119
134
|
--chart-1: #3987e5;
|
|
120
135
|
--chart-2: #d95926;
|
|
136
|
+
/* status (ligado/desligado, ok/atenção/erro): texto, contorno e ponto; ≥ 4.5:1 sobre bg-primary e sobre o -soft */
|
|
137
|
+
--ok: #4ade80;
|
|
138
|
+
--warn: #facc15;
|
|
139
|
+
--danger: #f87171;
|
|
140
|
+
--info: #60a5fa;
|
|
121
141
|
/* diff: fundo da linha e realce do trecho alterado; texto do tema ≥ 4.5:1 sobre todos */
|
|
122
142
|
--diff-add: #12341f;
|
|
123
143
|
--diff-add-strong: #1d6b3a;
|
|
@@ -152,6 +172,11 @@
|
|
|
152
172
|
/* gráficos: slots 1 e 2 da paleta de dataviz, validados (CVD e contraste) contra a superfície deste tema */
|
|
153
173
|
--chart-1: #3987e5;
|
|
154
174
|
--chart-2: #d95926;
|
|
175
|
+
/* status (ligado/desligado, ok/atenção/erro): texto, contorno e ponto; ≥ 4.5:1 sobre bg-primary e sobre o -soft */
|
|
176
|
+
--ok: #3efd2d;
|
|
177
|
+
--warn: #ffe500;
|
|
178
|
+
--danger: #ff7a93;
|
|
179
|
+
--info: #7cc4ff;
|
|
155
180
|
/* diff: fundo da linha e realce do trecho alterado; texto do tema ≥ 4.5:1 sobre todos */
|
|
156
181
|
--diff-add: #003d1a;
|
|
157
182
|
--diff-add-strong: #00692c;
|
|
@@ -177,6 +202,11 @@
|
|
|
177
202
|
/* borda suave: derivada da borda do tema (o alto contraste define a sua) */
|
|
178
203
|
:where(:root) {
|
|
179
204
|
--soft: color-mix(in srgb, var(--border) 18%, transparent);
|
|
205
|
+
/* fundos suaves de status (avisos): derivados do tom e da superfície do tema */
|
|
206
|
+
--ok-soft: color-mix(in srgb, var(--ok) 10%, var(--bg-primary));
|
|
207
|
+
--warn-soft: color-mix(in srgb, var(--warn) 10%, var(--bg-primary));
|
|
208
|
+
--danger-soft: color-mix(in srgb, var(--danger) 10%, var(--bg-primary));
|
|
209
|
+
--info-soft: color-mix(in srgb, var(--info) 10%, var(--bg-primary));
|
|
180
210
|
/* barras de rolagem: derivadas do texto secundário (o alto contraste define as suas) */
|
|
181
211
|
--scrollbar-thumb: color-mix(in srgb, var(--text-secondary) 55%, transparent);
|
|
182
212
|
--scrollbar-thumb-hover: var(--text-secondary);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest"
|
|
2
|
+
import { THEMES } from "../theme/theme.js"
|
|
3
|
+
import css from "./themes.css?raw"
|
|
4
|
+
import tokens from "./tokens.css?raw"
|
|
5
|
+
|
|
6
|
+
// Bloco de declarações de um tema (o claro também vale para :root)
|
|
7
|
+
function block(theme: string): string {
|
|
8
|
+
const start = css.indexOf(`.theme-${theme} {`)
|
|
9
|
+
return css.slice(start, css.indexOf("}", start))
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
describe("cores de status", () => {
|
|
13
|
+
it.each(THEMES)("o tema %s define ok, warn, danger e info", (theme) => {
|
|
14
|
+
for (const name of ["ok", "warn", "danger", "info"]) {
|
|
15
|
+
expect(block(theme)).toMatch(new RegExp(`--${name}: #[0-9a-f]{6};`))
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it("gera utilidades para cada tom e seu fundo suave", () => {
|
|
20
|
+
for (const name of ["ok", "warn", "danger", "info"]) {
|
|
21
|
+
expect(tokens).toContain(`--color-${name}: var(--${name});`)
|
|
22
|
+
expect(tokens).toContain(`--color-${name}-soft: var(--${name}-soft);`)
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
})
|
package/src/styles/tokens.css
CHANGED
|
@@ -31,6 +31,16 @@
|
|
|
31
31
|
--color-inset: var(--bg-secondary);
|
|
32
32
|
--color-soft: var(--soft);
|
|
33
33
|
|
|
34
|
+
/* Status: texto, contorno e ponto (ok/warn/danger/info); -soft é o fundo de avisos */
|
|
35
|
+
--color-ok: var(--ok);
|
|
36
|
+
--color-ok-soft: var(--ok-soft);
|
|
37
|
+
--color-warn: var(--warn);
|
|
38
|
+
--color-warn-soft: var(--warn-soft);
|
|
39
|
+
--color-danger: var(--danger);
|
|
40
|
+
--color-danger-soft: var(--danger-soft);
|
|
41
|
+
--color-info: var(--info);
|
|
42
|
+
--color-info-soft: var(--info-soft);
|
|
43
|
+
|
|
34
44
|
/* Cores de categoria (docs/redesign/01-tokens-e-temas.md) */
|
|
35
45
|
--color-cat-guide: var(--cat-guide);
|
|
36
46
|
--color-cat-guide-fg: var(--cat-guide-fg);
|