ads-nuxt 0.2.0 → 0.4.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.
Files changed (44) hide show
  1. package/README.md +6 -4
  2. package/app/assets/css/component-tokens.css +369 -367
  3. package/app/assets/css/main.css +26 -65
  4. package/app/components/AdsBadge.vue +3 -3
  5. package/app/components/AdsBroadcast.vue +1 -1
  6. package/app/components/AdsButton.vue +13 -5
  7. package/app/components/AdsButtonMenu.vue +2 -2
  8. package/app/components/AdsCharttip.vue +3 -2
  9. package/app/components/AdsCheckbox.vue +77 -77
  10. package/app/components/AdsDatePicker.vue +23 -6
  11. package/app/components/AdsEmptyState.vue +6 -3
  12. package/app/components/AdsHeavyTable.vue +4 -0
  13. package/app/components/AdsInput.vue +3 -2
  14. package/app/components/AdsMenuBar.vue +8 -1
  15. package/app/components/AdsMetricCard.vue +1 -1
  16. package/app/components/AdsModal.vue +7 -4
  17. package/app/components/AdsNavbarApp.vue +1 -1
  18. package/app/components/AdsNavbarDesk.vue +14 -9
  19. package/app/components/AdsNumberInput.vue +8 -8
  20. package/app/components/AdsPagination.vue +91 -91
  21. package/app/components/AdsPill.vue +1 -1
  22. package/app/components/AdsProductTag.vue +21 -2
  23. package/app/components/AdsRadio.vue +70 -70
  24. package/app/components/AdsSearchInput.vue +2 -2
  25. package/app/components/AdsSelect.vue +18 -1
  26. package/app/components/AdsSelectPanel.vue +103 -32
  27. package/app/components/AdsSteptip.vue +104 -101
  28. package/app/components/AdsSwitch.vue +59 -59
  29. package/app/components/AdsTable.vue +16 -1
  30. package/app/components/AdsTextarea.vue +2 -2
  31. package/app/components/AdsToast.vue +6 -5
  32. package/app/components/AdsTooltip.vue +2 -2
  33. package/app/components/OverlayLoading.vue +313 -173
  34. package/app/composables/useOverlayLoading.ts +31 -9
  35. package/app/theme/ads-theme.ts +1 -1
  36. package/app/theme/component-tokens.json +368 -366
  37. package/app/theme/component-tokens.ts +809 -807
  38. package/app/types/overlay-loading.types.ts +11 -2
  39. package/app/utils/ads-table.ts +3 -0
  40. package/package.json +56 -55
  41. package/app/assets/animations/Error.gif +0 -0
  42. package/app/assets/animations/Loading.gif +0 -0
  43. package/app/assets/animations/Search.gif +0 -0
  44. package/app/assets/animations/Success.gif +0 -0
@@ -1,807 +1,809 @@
1
- export type TokenKind = "color" | "length" | "weight" | "line";
2
-
3
- export type TokenField = {
4
- name: string;
5
- label: string;
6
- kind: TokenKind;
7
- group: string;
8
- fallback: string;
9
- };
10
-
11
- export type TokenComponent = {
12
- id: string;
13
- /** Id da seção na página de tokens e no menu. */
14
- section: string;
15
- /** Id da seção do catálogo (catalog-sections.ts). O menu de tokens segue os grupos do catálogo. */
16
- catalog: string;
17
- label: string;
18
- note?: string;
19
- fields: readonly TokenField[];
20
- };
21
-
22
- const length = (name: string, label: string, group: string, fallback: string): TokenField => ({
23
- name,
24
- label,
25
- kind: "length",
26
- group,
27
- fallback,
28
- });
29
-
30
- const color = (name: string, label: string, group: string, fallback: string): TokenField => ({
31
- name,
32
- label,
33
- kind: "color",
34
- group,
35
- fallback,
36
- });
37
-
38
- const weight = (name: string, label: string, group: string, fallback: string): TokenField => ({
39
- name,
40
- label,
41
- kind: "weight",
42
- group,
43
- fallback,
44
- });
45
-
46
- const line = (name: string, label: string, group: string, fallback: string): TokenField => ({
47
- name,
48
- label,
49
- kind: "line",
50
- group,
51
- fallback,
52
- });
53
-
54
- export const componentTokenCatalog: readonly TokenComponent[] = [
55
- {
56
- id: "button",
57
- section: "botao",
58
- catalog: "button",
59
- label: "Botão",
60
- note: "Outline, unfilled e as cores de status continuam nos tokens semânticos. O tipo IA usa fundo, borda e brilho próprios; o texto usa --ads-text-ai.",
61
- fields: [
62
- length("--ads-button-radius", "Raio", "Forma", "8px"),
63
- weight("--ads-button-weight", "Peso", "Forma", "700"),
64
- length("--ads-button-sm-height", "Altura", "Tamanho SM", "32px"),
65
- length("--ads-button-sm-padding-x", "Padding horizontal", "Tamanho SM", "12px"),
66
- length("--ads-button-sm-gap", "Espaço do ícone", "Tamanho SM", "8px"),
67
- length("--ads-button-sm-font-size", "Fonte", "Tamanho SM", "12px"),
68
- line("--ads-button-sm-line-height", "Altura de linha", "Tamanho SM", "1.2"),
69
- length("--ads-button-sm-icon", "Ícone", "Tamanho SM", "16px"),
70
- length("--ads-button-sm-icon-box", "Caixa do ícone", "Tamanho SM", "32px"),
71
- length("--ads-button-md-padding-x", "Padding horizontal", "Tamanho MD", "16px"),
72
- length("--ads-button-md-padding-y", "Padding vertical", "Tamanho MD", "12px"),
73
- length("--ads-button-md-gap", "Espaço do ícone", "Tamanho MD", "8px"),
74
- length("--ads-button-md-font-size", "Fonte", "Tamanho MD", "14px"),
75
- line("--ads-button-md-line-height", "Altura de linha", "Tamanho MD", "1.3"),
76
- length("--ads-button-md-icon", "Ícone", "Tamanho MD", "18px"),
77
- length("--ads-button-md-icon-box", "Caixa do ícone", "Tamanho MD", "40px"),
78
- color("--ads-button-primary", "Fundo", "Primário preenchido", "#006ff7"),
79
- color("--ads-button-primary-hover", "Fundo no hover", "Primário preenchido", "#074ac6"),
80
- color("--ads-button-primary-pressed", "Fundo no pressed", "Primário preenchido", "#00389e"),
81
- color("--ads-button-primary-disabled", "Fundo desabilitado", "Primário preenchido", "#89c9ff"),
82
- color("--ads-button-primary-text", "Texto", "Primário preenchido", "#ffffff"),
83
- color("--ads-button-secondary", "Fundo", "Secundário", "#e4f2ff"),
84
- color("--ads-button-secondary-hover", "Fundo no hover", "Secundário", "#c7e4ff"),
85
- color("--ads-button-secondary-pressed", "Fundo no pressed", "Secundário", "#89c9ff"),
86
- color("--ads-button-secondary-disabled", "Fundo desabilitado", "Secundário", "#d3d8dd"),
87
- color("--ads-button-secondary-text", "Texto", "Secundário", "#006ff7"),
88
- color("--ads-button-secondary-disabled-text", "Texto desabilitado", "Secundário", "#ffffff"),
89
- color("--ads-button-ia-background", "Fundo", "IA", "#f3f0ff"),
90
- color("--ads-button-ia-border", "Borda", "IA", "#7358cc"),
91
- color("--ads-button-ia-glow", "Brilho", "IA", "#ae96ff"),
92
- length("--ads-button-ia-radius", "Raio", "IA", "4px"),
93
- length("--ads-button-ia-line-height", "Altura de linha", "IA", "24px"),
94
- ],
95
- },
96
- {
97
- id: "input",
98
- section: "campo",
99
- catalog: "input",
100
- label: "Input",
101
- note: "Vale para o AdsInput. O estado de IA usa os tokens do botão IA (--ads-button-ia-background e --ads-button-ia-border), também nos campos de busca e no AdsSelect.",
102
- fields: [
103
- length("--ads-input-height", "Altura", "Medida", "40px"),
104
- length("--ads-input-padding-x", "Padding horizontal", "Medida", "12px"),
105
- length("--ads-input-gap", "Espaço interno", "Medida", "8px"),
106
- length("--ads-input-radius", "Raio", "Medida", "8px"),
107
- length("--ads-input-font-size", "Fonte", "Medida", "14px"),
108
- length("--ads-input-label-size", "Fonte do rótulo", "Medida", "12px"),
109
- color("--ads-input-border", "Borda", "Cores", "#c1c7d0"),
110
- color("--ads-input-background", "Fundo", "Cores", "#ffffff"),
111
- color("--ads-input-text", "Texto", "Cores", "#505f79"),
112
- color("--ads-input-focus-border", "Borda em foco", "Cores", "#0091ff"),
113
- color("--ads-input-hover-border", "Borda no hover", "Cores", "#006ff7"),
114
- color("--ads-input-error-border", "Borda de erro", "Cores", "#ff507a"),
115
- color("--ads-input-disabled-border", "Borda desabilitada", "Cores", "#a5adba"),
116
- color("--ads-input-disabled-background", "Fundo desabilitado", "Cores", "#f0f3f6"),
117
- color("--ads-input-disabled-text", "Texto desabilitado", "Cores", "#a5adba"),
118
- ],
119
- },
120
- {
121
- id: "number",
122
- section: "numero",
123
- catalog: "number-input",
124
- label: "Número",
125
- fields: [
126
- length("--ads-number-height", "Altura", "Medida", "40px"),
127
- length("--ads-number-padding-x", "Padding horizontal", "Medida", "12px"),
128
- length("--ads-number-gap", "Espaço interno", "Medida", "8px"),
129
- length("--ads-number-radius", "Raio", "Medida", "8px"),
130
- length("--ads-number-font-size", "Fonte", "Medida", "14px"),
131
- length("--ads-number-label-size", "Fonte do rótulo", "Medida", "12px"),
132
- color("--ads-number-border", "Borda", "Cores", "#e5e8eb"),
133
- color("--ads-number-background", "Fundo", "Cores", "#ffffff"),
134
- color("--ads-number-text", "Texto", "Cores", "#505f79"),
135
- color("--ads-number-focus-border", "Borda em foco", "Cores", "#0091ff"),
136
- color("--ads-number-hover-border", "Borda no hover", "Cores", "#006ff7"),
137
- color("--ads-number-error-border", "Borda de erro", "Cores", "#ff507a"),
138
- color("--ads-number-disabled-border", "Borda desabilitada", "Cores", "#a5adba"),
139
- color("--ads-number-disabled-background", "Fundo desabilitado", "Cores", "#f0f3f6"),
140
- color("--ads-number-disabled-text", "Texto desabilitado", "Cores", "#a5adba"),
141
- ],
142
- },
143
- {
144
- id: "search",
145
- section: "busca",
146
- catalog: "search-input",
147
- label: "Busca",
148
- fields: [
149
- length("--ads-search-sm-height", "Altura SM", "Medida", "40px"),
150
- length("--ads-search-md-height", "Altura MD", "Medida", "45px"),
151
- length("--ads-search-padding-x", "Padding horizontal", "Medida", "12px"),
152
- length("--ads-search-radius", "Raio", "Medida", "500px"),
153
- length("--ads-search-sm-font-size", "Fonte SM", "Medida", "14px"),
154
- length("--ads-search-md-font-size", "Fonte MD", "Medida", "16px"),
155
- color("--ads-search-border", "Borda", "Cores", "#c1c7d0"),
156
- color("--ads-search-background", "Fundo", "Cores", "#ffffff"),
157
- color("--ads-search-text", "Texto", "Cores", "#505f79"),
158
- color("--ads-search-placeholder", "Placeholder", "Cores", "#a5adba"),
159
- color("--ads-search-focus-border", "Borda em foco", "Cores", "#006ff7"),
160
- color("--ads-search-hover-border", "Borda no hover", "Cores", "#006ff7"),
161
- color("--ads-search-disabled-border", "Borda desabilitada", "Cores", "#a5adba"),
162
- color("--ads-search-disabled-background", "Fundo desabilitado", "Cores", "#f0f3f6"),
163
- ],
164
- },
165
- {
166
- id: "textarea",
167
- section: "texto",
168
- catalog: "textarea",
169
- label: "Texto longo",
170
- fields: [
171
- length("--ads-textarea-min-height", "Altura mínima", "Medida", "153px"),
172
- length("--ads-textarea-padding", "Padding", "Medida", "12px"),
173
- length("--ads-textarea-radius", "Raio", "Medida", "8px"),
174
- length("--ads-textarea-font-size", "Fonte", "Medida", "16px"),
175
- length("--ads-textarea-label-size", "Fonte do rótulo", "Medida", "12px"),
176
- color("--ads-textarea-border", "Borda", "Cores", "#c1c7d0"),
177
- color("--ads-textarea-background", "Fundo", "Cores", "#ffffff"),
178
- color("--ads-textarea-text", "Texto", "Cores", "#505f79"),
179
- color("--ads-textarea-placeholder", "Placeholder", "Cores", "#a5adba"),
180
- color("--ads-textarea-focus-border", "Borda em foco", "Cores", "#0091ff"),
181
- color("--ads-textarea-hover-border", "Borda no hover", "Cores", "#006ff7"),
182
- color("--ads-textarea-error-border", "Borda de erro", "Cores", "#ff507a"),
183
- color("--ads-textarea-disabled-border", "Borda desabilitada", "Cores", "#c1c7d0"),
184
- color("--ads-textarea-disabled-background", "Fundo desabilitado", "Cores", "#f0f3f6"),
185
- ],
186
- },
187
- {
188
- id: "date",
189
- section: "data",
190
- catalog: "date-picker",
191
- label: "Data",
192
- fields: [
193
- length("--ads-date-height", "Altura", "Medida", "40px"),
194
- length("--ads-date-padding-x", "Padding horizontal", "Medida", "12px"),
195
- length("--ads-date-radius", "Raio", "Medida", "8px"),
196
- length("--ads-date-font-size", "Fonte", "Fonte", "14px"),
197
- weight("--ads-date-weight", "Peso", "Fonte", "400"),
198
- line("--ads-date-line-height", "Altura de linha", "Fonte", "1.429"),
199
- color("--ads-date-border", "Borda", "Cores", "#cad5e2"),
200
- color("--ads-date-background", "Fundo", "Cores", "#ffffff"),
201
- color("--ads-date-text", "Texto", "Cores", "#0f172b"),
202
- color("--ads-date-placeholder", "Placeholder", "Cores", "#90a1b9"),
203
- color("--ads-date-separator", "Separador", "Cores", "#62748e"),
204
- color("--ads-date-focus-border", "Borda em foco", "Cores", "#006ff7"),
205
- color("--ads-date-hover-border", "Borda no hover", "Cores", "#006ff7"),
206
- /* Mesmo azul do hover do dia no calendário (--color-ads-radar-25). O editor só aceita #rrggbb, então vai o hex. */
207
- color("--ads-month-hover-bg", "Fundo no hover", "Mês", "#e4f2ff"),
208
- ],
209
- },
210
- {
211
- id: "select",
212
- section: "select",
213
- catalog: "select",
214
- label: "Select",
215
- note: "Campo (Select), lista (Super dropdown) e itens (_Dropdown Item) do AdsSelect. Os tokens do campo mantêm o prefixo --ads-filter.",
216
- fields: [
217
- length("--ads-filter-height", "Altura", "Medida", "40px"),
218
- length("--ads-filter-padding-x", "Padding horizontal", "Medida", "12px"),
219
- length("--ads-filter-radius", "Raio", "Medida", "8px"),
220
- length("--ads-filter-font-size", "Fonte", "Medida", "14px"),
221
- length("--ads-filter-label-size", "Fonte do rótulo", "Medida", "12px"),
222
- color("--ads-filter-border", "Borda", "Cores", "#505f79"),
223
- color("--ads-filter-background", "Fundo", "Cores", "#ffffff"),
224
- color("--ads-filter-text", "Texto", "Cores", "#505f79"),
225
- color("--ads-filter-focus-border", "Borda em foco", "Cores", "#006ff7"),
226
- color("--ads-filter-hover-border", "Borda no hover", "Cores", "#006ff7"),
227
- color("--ads-filter-error-border", "Borda de erro", "Cores", "#ff6783"),
228
- color("--ads-filter-disabled-border", "Borda desabilitada", "Cores", "#b3bac5"),
229
- color("--ads-filter-disabled-background", "Fundo desabilitado", "Cores", "#f0f3f6"),
230
- color("--ads-filter-disabled-text", "Texto desabilitado", "Cores", "#a5adba"),
231
- length("--ads-select-panel-width", "Largura da lista", "Lista", "320px"),
232
- length("--ads-select-panel-max-height", "Altura máxima da lista", "Lista", "320px"),
233
- length("--ads-select-item-padding", "Padding do item", "Lista", "16px"),
234
- color("--ads-select-panel-border", "Borda da lista", "Lista", "#e5e8eb"),
235
- color("--ads-select-divider", "Divisória", "Lista", "#e5e8eb"),
236
- color("--ads-select-item-hover", "Item no hover", "Lista", "#f0f3f6"),
237
- color("--ads-select-item-selected", "Item selecionado (simples)", "Lista", "#e4f2ff"),
238
- color("--ads-select-badge", "Selo", "Lista", "#006ff7"),
239
- color("--ads-select-badge-ai", "Selo de IA", "Lista", "#613dda"),
240
- ],
241
- },
242
- {
243
- id: "tabs",
244
- section: "abas",
245
- catalog: "tabs",
246
- label: "Abas",
247
- fields: [
248
- length("--ads-tabs-height", "Altura", "Medida", "39px"),
249
- length("--ads-tabs-padding-x", "Padding horizontal", "Medida", "12px"),
250
- length("--ads-tabs-font-size", "Fonte", "Medida", "14px"),
251
- length("--ads-tabs-indicator", "Indicador", "Medida", "4px"),
252
- weight("--ads-tabs-weight", "Peso inativo", "Medida", "500"),
253
- color("--ads-tabs-inactive", "Texto inativo", "Cores", "#505f79"),
254
- color("--ads-tabs-active", "Texto ativo", "Cores", "#061938"),
255
- color("--ads-tabs-indicator-color", "Indicador", "Cores", "#006ff7"),
256
- color("--ads-tabs-border", "Linha", "Cores", "#c1c7d0"),
257
- ],
258
- },
259
- {
260
- id: "segmented",
261
- section: "segmentadas",
262
- catalog: "segmented-tabs",
263
- label: "Segmented",
264
- fields: [
265
- length("--ads-segmented-height", "Altura da trilha", "Medida", "37px"),
266
- length("--ads-segmented-item-height", "Altura do item", "Medida", "30px"),
267
- length("--ads-segmented-padding-x", "Padding horizontal", "Medida", "16px"),
268
- length("--ads-segmented-radius", "Raio", "Medida", "4px"),
269
- length("--ads-segmented-font-size", "Fonte", "Medida", "12px"),
270
- color("--ads-segmented-track", "Fundo da trilha", "Cores", "#f0f3f6"),
271
- color("--ads-segmented-active-bg", "Fundo ativo", "Cores", "#ffffff"),
272
- color("--ads-segmented-text", "Texto", "Cores", "#061938"),
273
- color("--ads-segmented-active-text", "Texto ativo", "Cores", "#000000"),
274
- ],
275
- },
276
- {
277
- id: "toast",
278
- section: "aviso",
279
- catalog: "toast",
280
- label: "Toast",
281
- fields: [
282
- length("--ads-toast-radius", "Raio", "Medida", "8px"),
283
- length("--ads-toast-padding", "Padding", "Medida", "12px"),
284
- length("--ads-toast-gap", "Espaço", "Medida", "12px"),
285
- length("--ads-toast-icon", "Ícone", "Medida", "18px"),
286
- length("--ads-toast-font-size", "Fonte", "Medida", "14px"),
287
- weight("--ads-toast-weight", "Peso", "Medida", "500"),
288
- color("--ads-toast-text", "Texto", "Cores", "#061938"),
289
- color("--ads-toast-primary-bg", "Fundo primário", "Cores", "#e4f2ff"),
290
- color("--ads-toast-error-bg", "Fundo de erro", "Cores", "#ffbdcd"),
291
- color("--ads-toast-warning-bg", "Fundo de alerta", "Cores", "#ffe7b9"),
292
- color("--ads-toast-neutral-bg", "Fundo neutro", "Cores", "#e4f2ff"),
293
- color("--ads-toast-primary-icon", "Ícone primário", "Cores", "#006ff7"),
294
- color("--ads-toast-success-icon", "Ícone de sucesso", "Cores", "#0e5a3b"),
295
- color("--ads-toast-error-icon", "Ícone de erro", "Cores", "#840221"),
296
- color("--ads-toast-warning-icon", "Ícone de alerta", "Cores", "#7a5600"),
297
- color("--ads-toast-neutral-icon", "Ícone neutro", "Cores", "#505f79"),
298
- length("--ads-toast-status-width", "Largura", "Reporte", "331px"),
299
- length("--ads-toast-status-icon", "Ícone", "Reporte", "24px"),
300
- length("--ads-toast-status-title-size", "Fonte do título", "Reporte", "14px"),
301
- length("--ads-toast-status-subtitle-size", "Fonte do subtítulo", "Reporte", "10px"),
302
- color("--ads-toast-status-bg", "Fundo", "Reporte", "#061938"),
303
- color("--ads-toast-status-text", "Texto", "Reporte", "#ffffff"),
304
- color("--ads-toast-status-success", "Ícone de sucesso", "Reporte", "#06eb8f"),
305
- color("--ads-toast-status-error", "Ícone de erro", "Reporte", "#ef164a"),
306
- color("--ads-toast-status-warning", "Ícone de atenção", "Reporte", "#ffb905"),
307
- color("--ads-toast-status-loading", "Ícone de carga", "Reporte", "#49d8f4"),
308
- ],
309
- },
310
- {
311
- id: "file",
312
- section: "arquivo",
313
- catalog: "file-card",
314
- label: "Arquivo",
315
- fields: [
316
- length("--ads-file-min-height", "Altura mínima", "Medida", "64px"),
317
- length("--ads-file-radius", "Raio", "Medida", "8px"),
318
- length("--ads-file-padding-x", "Padding horizontal", "Medida", "12px"),
319
- length("--ads-file-padding-y", "Padding vertical", "Medida", "12px"),
320
- length("--ads-file-title-size", "Fonte do nome", "Medida", "14px"),
321
- length("--ads-file-detail-size", "Fonte do detalhe", "Medida", "12px"),
322
- length("--ads-file-icon-box", "Caixa do ícone", "Medida", "40px"),
323
- ],
324
- },
325
- {
326
- id: "tooltip",
327
- section: "tooltip",
328
- catalog: "tooltip",
329
- label: "Tooltip",
330
- fields: [
331
- length("--ads-tooltip-radius", "Raio", "Medida", "12px"),
332
- length("--ads-tooltip-padding-x", "Padding horizontal", "Medida", "16px"),
333
- length("--ads-tooltip-padding-y", "Padding vertical", "Medida", "12px"),
334
- length("--ads-tooltip-font-size", "Fonte", "Medida", "14px"),
335
- color("--ads-tooltip-bg", "Fundo", "Cores", "#061938"),
336
- color("--ads-tooltip-text", "Texto", "Cores", "#c1c7d0"),
337
- color("--ads-tooltip-title", "Título", "Cores", "#ffffff"),
338
- length("--ads-tooltip-title-size", "Fonte do título", "Medida", "16px"),
339
- length("--ads-tooltip-small-font-size", "Fonte do smalltip", "Smalltip", "10px"),
340
- length("--ads-tooltip-small-padding", "Padding do smalltip", "Smalltip", "8px"),
341
- length("--ads-steptip-width", "Largura do steptip", "Steptip", "328px"),
342
- color("--ads-steptip-skip", "Texto pular", "Steptip", "#b3bac5"),
343
- length("--ads-charttip-min-width", "Largura mínima", "Charttip", "180px"),
344
- length("--ads-charttip-swatch", "Amostra", "Charttip", "16px"),
345
- ],
346
- },
347
- {
348
- id: "loading",
349
- section: "carregando",
350
- catalog: "loading",
351
- label: "Loading",
352
- fields: [
353
- length("--ads-loading-radius", "Raio do skeleton", "Medida", "4px"),
354
- length("--ads-loading-bar", "Linha do skeleton médio", "Medida", "12px"),
355
- length("--ads-loading-spinner", "Spinner médio", "Medida", "24px"),
356
- length("--ads-loading-label-size", "Fonte do rótulo", "Medida", "14px"),
357
- color("--ads-loading-skeleton", "Skeleton", "Cores", "#e5e8eb"),
358
- color("--ads-loading-skeleton-muted", "Skeleton muted", "Cores", "#f0f3f6"),
359
- color("--ads-loading-spinner-color", "Arco do spinner", "Cores", "#006ff7"),
360
- color("--ads-loading-spinner-track", "Trilha do spinner", "Cores", "#c7e4ff"),
361
- ],
362
- },
363
- {
364
- id: "progress",
365
- section: "progresso",
366
- catalog: "progress-bar-loading",
367
- label: "Barra de progresso",
368
- fields: [
369
- length("--ads-progress-height", "Altura", "Medida", "8px"),
370
- length("--ads-progress-radius", "Raio", "Medida", "4px"),
371
- color("--ads-progress-track", "Trilha", "Cores", "#e5e8eb"),
372
- color("--ads-progress-fill", "Preenchimento", "Cores", "#006ff7"),
373
- color("--ads-progress-success", "Sucesso", "Cores", "#1c9f6a"),
374
- ],
375
- },
376
- {
377
- id: "badge",
378
- section: "badge",
379
- catalog: "badge",
380
- label: "Badge",
381
- note: "O fundo de cada cor continua na escala de status. Aqui ficam a medida e o texto.",
382
- fields: [
383
- length("--ads-badge-size", "Tamanho", "Medida", "24px"),
384
- length("--ads-badge-dot", "Ponto", "Medida", "8px"),
385
- length("--ads-badge-font-size", "Fonte", "Medida", "12px"),
386
- weight("--ads-badge-weight", "Peso", "Medida", "700"),
387
- color("--ads-badge-text", "Texto", "Cores", "#ffffff"),
388
- ],
389
- },
390
- {
391
- id: "pill",
392
- section: "pill",
393
- catalog: "pill",
394
- label: "Pill",
395
- note: "Os outros status continuam no mapa de cor da pill. O editor muda a medida e o primário.",
396
- fields: [
397
- length("--ads-pill-height", "Altura", "Medida", "24px"),
398
- length("--ads-pill-min-width", "Largura mínima", "Medida", "100px"),
399
- length("--ads-pill-padding-x", "Padding horizontal", "Medida", "8px"),
400
- length("--ads-pill-font-size", "Fonte", "Medida", "12px"),
401
- weight("--ads-pill-weight", "Peso", "Medida", "700"),
402
- color("--ads-pill-primary-bg", "Fundo primário", "Cores", "#006ff7"),
403
- color("--ads-pill-primary-text", "Texto primário", "Cores", "#ffffff"),
404
- ],
405
- },
406
- {
407
- id: "notability",
408
- section: "notabilidade",
409
- catalog: "notability-pill",
410
- label: "Pill de notabilidade",
411
- note: "As cores seguem o status. Aqui ficam a medida e o tipo.",
412
- fields: [
413
- length("--ads-notability-height", "Altura", "Medida", "24px"),
414
- length("--ads-notability-min-width", "Largura mínima", "Medida", "100px"),
415
- length("--ads-notability-padding-x", "Padding horizontal", "Medida", "8px"),
416
- length("--ads-notability-font-size", "Fonte", "Medida", "12px"),
417
- weight("--ads-notability-weight", "Peso", "Medida", "700"),
418
- ],
419
- },
420
- {
421
- id: "broadcast",
422
- section: "broadcast",
423
- catalog: "pill",
424
- label: "Pill broadcast",
425
- note: "Variante broadcast do AdsPill (variant=\"broadcast\"). O AdsBroadcast é um atalho para ela.",
426
- fields: [
427
- length("--ads-broadcast-height", "Altura", "Medida", "24px"),
428
- length("--ads-broadcast-padding-x", "Padding horizontal", "Medida", "8px"),
429
- length("--ads-broadcast-font-size", "Fonte", "Medida", "12px"),
430
- length("--ads-broadcast-mark", "Marca", "Medida", "8px"),
431
- color("--ads-broadcast-warning-bg", "Fundo de alerta", "Cores", "#ffbdcd"),
432
- color("--ads-broadcast-warning", "Alerta", "Cores", "#dc0034"),
433
- color("--ads-broadcast-success-bg", "Fundo de sucesso", "Cores", "#c3ffe6"),
434
- color("--ads-broadcast-success", "Sucesso", "Cores", "#15c57e"),
435
- ],
436
- },
437
- {
438
- id: "mini",
439
- section: "mini",
440
- catalog: "pill",
441
- label: "Mini pill",
442
- fields: [
443
- length("--ads-mini-height", "Altura", "Medida", "18px"),
444
- length("--ads-mini-padding-x", "Padding horizontal", "Medida", "8px"),
445
- length("--ads-mini-font-size", "Fonte", "Medida", "10px"),
446
- weight("--ads-mini-weight", "Peso", "Medida", "700"),
447
- color("--ads-mini-idle-bg", "Fundo não iniciado", "Cores", "#d1d9ed"),
448
- color("--ads-mini-idle-text", "Texto não iniciado", "Cores", "#18224b"),
449
- color("--ads-mini-paused-bg", "Fundo pausado", "Cores", "#ffe7b9"),
450
- color("--ads-mini-paused-text", "Texto pausado", "Cores", "#7a5600"),
451
- color("--ads-mini-new-bg", "Fundo novo", "Cores", "#79e9ff"),
452
- color("--ads-mini-new-text", "Texto novo", "Cores", "#006478"),
453
- ],
454
- },
455
- {
456
- id: "switch",
457
- section: "switch",
458
- catalog: "switch",
459
- label: "Switch",
460
- fields: [
461
- length("--ads-switch-width", "Largura", "Medida", "32px"),
462
- length("--ads-switch-height", "Altura", "Medida", "18px"),
463
- length("--ads-switch-thumb", "Botão", "Medida", "12px"),
464
- length("--ads-switch-inset", "Respiro", "Medida", "3px"),
465
- length("--ads-switch-radius", "Raio", "Medida", "9px"),
466
- length("--ads-switch-label-size", "Fonte do rótulo", "Medida", "14px"),
467
- length("--ads-switch-gap", "Espaço", "Medida", "8px"),
468
- color("--ads-switch-off", "Desligado", "Cores", "#c1c7d0"),
469
- color("--ads-switch-on", "Ligado", "Cores", "#006ff7"),
470
- color("--ads-switch-disabled", "Desabilitado", "Cores", "#e5e8eb"),
471
- color("--ads-switch-disabled-on", "Ligado desabilitado", "Cores", "#89c9ff"),
472
- color("--ads-switch-thumb-color", "Botão", "Cores", "#ffffff"),
473
- color("--ads-switch-label", "Rótulo", "Cores", "#505f79"),
474
- ],
475
- },
476
- {
477
- id: "checkbox",
478
- section: "checkbox",
479
- catalog: "checkbox",
480
- label: "Checkbox",
481
- fields: [
482
- length("--ads-checkbox-size", "Tamanho", "Medida", "16px"),
483
- length("--ads-checkbox-radius", "Raio", "Medida", "4px"),
484
- length("--ads-checkbox-border-width", "Borda", "Medida", "2px"),
485
- length("--ads-checkbox-label-size", "Fonte do rótulo", "Medida", "14px"),
486
- length("--ads-checkbox-gap", "Espaço", "Medida", "8px"),
487
- color("--ads-checkbox-border", "Borda", "Cores", "#006ff7"),
488
- color("--ads-checkbox-checked", "Marcado", "Cores", "#006ff7"),
489
- color("--ads-checkbox-disabled", "Desabilitado", "Cores", "#89c9ff"),
490
- color("--ads-checkbox-background", "Fundo", "Cores", "#ffffff"),
491
- color("--ads-checkbox-label", "Rótulo", "Cores", "#505f79"),
492
- ],
493
- },
494
- {
495
- id: "radio",
496
- section: "radio",
497
- catalog: "radio",
498
- label: "Radio",
499
- fields: [
500
- length("--ads-radio-size", "Tamanho", "Medida", "16px"),
501
- length("--ads-radio-dot", "Miolo", "Medida", "8px"),
502
- length("--ads-radio-border-width", "Borda", "Medida", "2px"),
503
- length("--ads-radio-label-size", "Fonte do rótulo", "Medida", "14px"),
504
- length("--ads-radio-gap", "Espaço", "Medida", "8px"),
505
- color("--ads-radio-border", "Borda", "Cores", "#006ff7"),
506
- color("--ads-radio-disabled", "Desabilitado", "Cores", "#89c9ff"),
507
- color("--ads-radio-background", "Fundo", "Cores", "#ffffff"),
508
- color("--ads-radio-dot-color", "Miolo", "Cores", "#ffffff"),
509
- color("--ads-radio-label", "Rótulo", "Cores", "#505f79"),
510
- ],
511
- },
512
- {
513
- id: "modal",
514
- section: "modal",
515
- catalog: "modal",
516
- label: "Modal",
517
- fields: [
518
- length("--ads-modal-radius", "Raio", "Medida", "8px"),
519
- length("--ads-modal-padding", "Padding", "Medida", "24px"),
520
- length("--ads-modal-title-size", "Fonte do título", "Medida", "20px"),
521
- length("--ads-modal-body-size", "Fonte do texto", "Medida", "14px"),
522
- color("--ads-modal-background", "Fundo", "Cores", "#ffffff"),
523
- color("--ads-modal-border", "Borda", "Cores", "#c1c7d0"),
524
- color("--ads-modal-title", "Título", "Cores", "#061938"),
525
- color("--ads-modal-body", "Texto", "Cores", "#505f79"),
526
- ],
527
- },
528
- {
529
- id: "feature",
530
- section: "feature",
531
- catalog: "feature-card",
532
- label: "Feature card",
533
- fields: [
534
- length("--ads-feature-width", "Largura", "Medida", "396px"),
535
- length("--ads-feature-gap", "Espaço", "Medida", "16px"),
536
- length("--ads-feature-icon-box", "Caixa do ícone", "Medida", "48px"),
537
- length("--ads-feature-title-size", "Fonte do título", "Medida", "16px"),
538
- length("--ads-feature-body-size", "Fonte do texto", "Medida", "14px"),
539
- color("--ads-feature-title", "Título", "Cores", "#061938"),
540
- color("--ads-feature-body", "Texto", "Cores", "#505f79"),
541
- ],
542
- },
543
- {
544
- id: "card",
545
- section: "card",
546
- catalog: "card",
547
- label: "Card",
548
- fields: [
549
- length("--ads-card-padding", "Padding", "Medida", "16px"),
550
- length("--ads-card-radius", "Raio", "Medida", "12px"),
551
- length("--ads-card-radius-sm", "Raio pequeno", "Medida", "8px"),
552
- length("--ads-card-body-size", "Fonte do texto", "Medida", "14px"),
553
- color("--ads-card-border", "Borda", "Cores", "#e5e8eb"),
554
- color("--ads-card-background", "Fundo", "Cores", "#ffffff"),
555
- color("--ads-card-hover-border", "Borda no hover", "Cores", "#c1c7d0"),
556
- color("--ads-card-selected-border", "Borda selecionada", "Cores", "#006ff7"),
557
- color("--ads-card-selected-background", "Fundo selecionado", "Cores", "#e4f2ff"),
558
- color("--ads-card-title", "Título", "Cores", "#061938"),
559
- color("--ads-card-body", "Texto", "Cores", "#505f79"),
560
- ],
561
- },
562
- {
563
- id: "metric",
564
- section: "metric",
565
- catalog: "metric-card",
566
- label: "Card de métrica",
567
- fields: [
568
- length("--ads-metric-padding", "Padding", "Medida", "16px"),
569
- length("--ads-metric-radius", "Raio", "Medida", "12px"),
570
- length("--ads-metric-gap", "Espaço", "Medida", "8px"),
571
- length("--ads-metric-label-size", "Fonte do rótulo", "Medida", "14px"),
572
- length("--ads-metric-value-size", "Fonte do valor", "Medida", "20px"),
573
- length("--ads-metric-caption-size", "Fonte da legenda", "Medida", "12px"),
574
- color("--ads-metric-border", "Borda", "Cores", "#e5e8eb"),
575
- color("--ads-metric-background", "Fundo", "Cores", "#ffffff"),
576
- color("--ads-metric-label", "Título", "Cores", "#061938"),
577
- color("--ads-metric-value", "Valor", "Cores", "#061938"),
578
- ],
579
- },
580
- {
581
- id: "menu",
582
- section: "menu",
583
- catalog: "menu-bar",
584
- label: "Menu bar",
585
- fields: [
586
- length("--ads-menu-width", "Largura", "Medida", "100px"),
587
- length("--ads-menu-padding-y", "Padding vertical", "Medida", "16px"),
588
- length("--ads-menu-gap", "Espaço", "Medida", "16px"),
589
- length("--ads-menu-icon", "Ícone", "Medida", "18px"),
590
- length("--ads-menu-icon-box", "Caixa do ícone", "Medida", "40px"),
591
- length("--ads-menu-label-size", "Fonte", "Medida", "12px"),
592
- color("--ads-menu-divider", "Divisor", "Cores", "#c1c7d0"),
593
- ],
594
- },
595
- {
596
- id: "navbar-app",
597
- section: "navbar-app",
598
- catalog: "navbar-app",
599
- label: "Navbar app",
600
- fields: [
601
- length("--ads-navbar-app-height", "Altura", "Medida", "88px"),
602
- length("--ads-navbar-app-gap", "Espaço", "Medida", "33px"),
603
- length("--ads-navbar-app-item-width", "Largura do item", "Medida", "39px"),
604
- length("--ads-navbar-app-well", "Caixa do ícone", "Medida", "28px"),
605
- length("--ads-navbar-app-font-size", "Fonte", "Medida", "10px"),
606
- color("--ads-navbar-app-active", "Ativo", "Cores", "#344563"),
607
- ],
608
- },
609
- {
610
- id: "navbar-desk",
611
- section: "navbar-desk",
612
- catalog: "navbar-desk",
613
- label: "Navbar desk",
614
- fields: [
615
- length("--ads-navbar-desk-height", "Altura", "Medida", "64px"),
616
- length("--ads-navbar-desk-padding-x", "Padding horizontal", "Medida", "44px"),
617
- length("--ads-navbar-desk-action", "Botão", "Medida", "40px"),
618
- length("--ads-navbar-desk-avatar", "Avatar", "Medida", "32px"),
619
- color("--ads-navbar-desk-border", "Borda", "Cores", "#d3d8dd"),
620
- ],
621
- },
622
- {
623
- id: "side",
624
- section: "menu-lateral",
625
- catalog: "side-menu",
626
- label: "Menu lateral",
627
- fields: [
628
- length("--ads-side-width", "Largura", "Medida", "224px"),
629
- length("--ads-side-row-height", "Altura da linha", "Medida", "48px"),
630
- length("--ads-side-badge", "Badge", "Medida", "8px"),
631
- color("--ads-side-border", "Borda", "Cores", "#c1c7d0"),
632
- color("--ads-side-open-bg", "Mãe aberta", "Cores", "#e5e8eb"),
633
- color("--ads-side-child-bg", "Filho", "Cores", "#f0f3f6"),
634
- ],
635
- },
636
- {
637
- id: "footer",
638
- section: "footer",
639
- catalog: "footer",
640
- label: "Footer",
641
- fields: [
642
- length("--ads-footer-min-height", "Altura mínima", "Medida", "32px"),
643
- length("--ads-footer-logo-height", "Logo", "Medida", "12px"),
644
- color("--ads-footer-text", "Texto", "Cores", "#7a869a"),
645
- ],
646
- },
647
- {
648
- id: "product-tag",
649
- section: "product-tag",
650
- catalog: "product-tag",
651
- label: "Tag de produto",
652
- fields: [
653
- length("--ads-product-tag-height", "Altura", "Medida", "16px"),
654
- length("--ads-product-tag-font-size", "Fonte", "Medida", "11px"),
655
- ],
656
- },
657
- {
658
- id: "button-group",
659
- section: "grupo",
660
- catalog: "button-group",
661
- label: "Grupo de botões",
662
- fields: [
663
- length("--ads-button-group-height", "Altura", "Medida", "30px"),
664
- length("--ads-button-group-font-size", "Fonte", "Medida", "12px"),
665
- color("--ads-button-group-border", "Borda", "Cores", "#c1c7d0"),
666
- color("--ads-button-group-selected", "Selecionado", "Cores", "#e5e8eb"),
667
- ],
668
- },
669
- {
670
- id: "button-menu",
671
- section: "menu-botao",
672
- catalog: "button-menu",
673
- label: "Menu de botão",
674
- fields: [
675
- length("--ads-button-menu-width", "Largura", "Medida", "264px"),
676
- length("--ads-button-menu-title-size", "Fonte do título", "Medida", "16px"),
677
- length("--ads-button-menu-subtitle-size", "Fonte do subtítulo", "Medida", "12px"),
678
- color("--ads-button-menu-title", "Título", "Cores", "#42526e"),
679
- color("--ads-button-menu-subtitle", "Subtítulo", "Cores", "#5e6c84"),
680
- color("--ads-button-menu-border", "Borda", "Cores", "#c1c7d0"),
681
- ],
682
- },
683
- {
684
- id: "pagination",
685
- section: "paginacao",
686
- catalog: "pagination",
687
- label: "Paginação",
688
- fields: [
689
- length("--ads-pagination-cell", "Célula", "Medida", "24px"),
690
- length("--ads-pagination-gap", "Espaço", "Medida", "12px"),
691
- length("--ads-pagination-number-gap", "Espaço dos números", "Medida", "4px"),
692
- color("--ads-pagination-selected", "Selecionada", "Cores", "#006ff7"),
693
- color("--ads-pagination-number", "Número", "Cores", "#344563"),
694
- ],
695
- },
696
- {
697
- id: "empty",
698
- section: "vazio",
699
- catalog: "empty-state",
700
- label: "Empty state",
701
- fields: [
702
- length("--ads-empty-icon", "Ícone", "Medida", "90px"),
703
- length("--ads-empty-icon-sm", "Ícone pequeno", "Medida", "60px"),
704
- length("--ads-empty-title-size", "Fonte do título", "Medida", "18px"),
705
- length("--ads-empty-title-size-sm", "Fonte do título pequeno", "Medida", "16px"),
706
- length("--ads-empty-subtitle-size", "Fonte do apoio", "Medida", "12px"),
707
- length("--ads-empty-gap", "Espaço", "Medida", "24px"),
708
- length("--ads-empty-gap-sm", "Espaço pequeno", "Medida", "32px"),
709
- length("--ads-empty-text-gap", "Espaço do texto", "Medida", "32px"),
710
- color("--ads-empty-icon-color", "Ícone", "Cores", "#c1c7d0"),
711
- ],
712
- },
713
- {
714
- id: "funcional",
715
- section: "funcional",
716
- catalog: "cores",
717
- label: "Cores funcionais",
718
- note: "Cores do arquivo de componentes sem degrau na escala publicada. O badge do menu lateral usa opportunity 200. A borda de erro do AdsSelect repete warning 200.",
719
- fields: [
720
- color("--ads-funcional-warning-200", "Warning 200", "Cores", "#ff6783"),
721
- color("--ads-funcional-opportunity-200", "Opportunity 200", "Cores", "#0ebbda"),
722
- ],
723
- },
724
- ];
725
-
726
- export const allTokenFields = () => componentTokenCatalog.flatMap((component) => component.fields);
727
-
728
- export const componentTokenDefaults = (): Record<string, string> =>
729
- Object.fromEntries(allTokenFields().map((field) => [field.name, field.fallback]));
730
-
731
- export const tokenGroups = (component: TokenComponent) => {
732
- const groups: { label: string; fields: TokenField[] }[] = [];
733
- for (const field of component.fields) {
734
- const current = groups.find((group) => group.label === field.group);
735
- if (current) current.fields.push(field);
736
- else groups.push({ label: field.group, fields: [field] });
737
- }
738
- return groups;
739
- };
740
-
741
- const lengthPattern = /^(?:\d{1,4})(?:\.\d+)?(?:px|rem)$/;
742
- const colorPattern = /^#[0-9a-f]{6}$/;
743
- const weightPattern = /^(?:300|400|500|700|800)$/;
744
-
745
- export const tokenValueValid = (kind: TokenKind, value: string) => {
746
- if (kind === "color") return colorPattern.test(value);
747
- if (kind === "length") return lengthPattern.test(value);
748
- if (kind === "weight") return weightPattern.test(value);
749
- if (!/^\d(?:\.\d{1,3})?$/.test(value)) return false;
750
- const line = Number(value);
751
- return line >= 1 && line <= 2;
752
- };
753
-
754
- const normalizeValue = (field: TokenField, value: string) =>
755
- field.kind === "color" ? value.toLowerCase() : value;
756
-
757
- export const normalizeStoredTokens = (input: unknown): Record<string, string> => {
758
- const tokens = componentTokenDefaults();
759
- if (!input || typeof input !== "object" || Array.isArray(input)) return tokens;
760
- const record = input as Record<string, unknown>;
761
- for (const field of allTokenFields()) {
762
- const value = record[field.name];
763
- if (typeof value !== "string") continue;
764
- const normalized = normalizeValue(field, value.trim());
765
- if (tokenValueValid(field.kind, normalized)) tokens[field.name] = normalized;
766
- }
767
- return tokens;
768
- };
769
-
770
- export const assertComponentTokens = (input: unknown): Record<string, string> => {
771
- if (!input || typeof input !== "object" || Array.isArray(input)) {
772
- throw new Error("O corpo precisa ser o mapa de tokens.");
773
- }
774
- const record = input as Record<string, unknown>;
775
- const tokens: Record<string, string> = {};
776
- const invalid: string[] = [];
777
- for (const field of allTokenFields()) {
778
- const value = record[field.name];
779
- if (typeof value !== "string") {
780
- invalid.push(field.label);
781
- continue;
782
- }
783
- const normalized = normalizeValue(field, value.trim());
784
- if (!tokenValueValid(field.kind, normalized)) {
785
- invalid.push(field.label);
786
- continue;
787
- }
788
- tokens[field.name] = normalized;
789
- }
790
- if (invalid.length) {
791
- throw new Error(`Valores inválidos: ${invalid.join(", ")}.`);
792
- }
793
- return tokens;
794
- };
795
-
796
- export const componentTokensCss = (tokens: Record<string, string>) => {
797
- const lines = allTokenFields().map((field) => ` ${field.name}: ${tokens[field.name]};`);
798
- return [
799
- "/* Gerado pela tela /design-system/tokens. Fonte: app/theme/component-tokens.json */",
800
- ":root {",
801
- ...lines,
802
- "}",
803
- "",
804
- ].join("\n");
805
- };
806
-
807
- export const PREVIEW_STYLE_ID = "ads-component-token-preview";
1
+ export type TokenKind = "color" | "length" | "weight" | "line";
2
+
3
+ export type TokenField = {
4
+ name: string;
5
+ label: string;
6
+ kind: TokenKind;
7
+ group: string;
8
+ fallback: string;
9
+ };
10
+
11
+ export type TokenComponent = {
12
+ id: string;
13
+ /** Id da seção na página de tokens e no menu. */
14
+ section: string;
15
+ /** Id da seção do catálogo (catalog-sections.ts). O menu de tokens segue os grupos do catálogo. */
16
+ catalog: string;
17
+ label: string;
18
+ note?: string;
19
+ fields: readonly TokenField[];
20
+ };
21
+
22
+ const length = (name: string, label: string, group: string, fallback: string): TokenField => ({
23
+ name,
24
+ label,
25
+ kind: "length",
26
+ group,
27
+ fallback,
28
+ });
29
+
30
+ const color = (name: string, label: string, group: string, fallback: string): TokenField => ({
31
+ name,
32
+ label,
33
+ kind: "color",
34
+ group,
35
+ fallback,
36
+ });
37
+
38
+ const weight = (name: string, label: string, group: string, fallback: string): TokenField => ({
39
+ name,
40
+ label,
41
+ kind: "weight",
42
+ group,
43
+ fallback,
44
+ });
45
+
46
+ const line = (name: string, label: string, group: string, fallback: string): TokenField => ({
47
+ name,
48
+ label,
49
+ kind: "line",
50
+ group,
51
+ fallback,
52
+ });
53
+
54
+ export const componentTokenCatalog: readonly TokenComponent[] = [
55
+ {
56
+ id: "button",
57
+ section: "botao",
58
+ catalog: "button",
59
+ label: "Botão",
60
+ note: "Outline, unfilled e as cores de status continuam nos tokens semânticos. O tipo IA usa fundo, borda e brilho próprios; o texto usa --ads-text-ai.",
61
+ fields: [
62
+ length("--ads-button-radius", "Raio", "Forma", "8px"),
63
+ weight("--ads-button-weight", "Peso", "Forma", "700"),
64
+ length("--ads-button-sm-height", "Altura", "Tamanho SM", "32px"),
65
+ length("--ads-button-sm-padding-x", "Padding horizontal", "Tamanho SM", "12px"),
66
+ length("--ads-button-sm-gap", "Espaço do ícone", "Tamanho SM", "8px"),
67
+ length("--ads-button-sm-font-size", "Fonte", "Tamanho SM", "12px"),
68
+ line("--ads-button-sm-line-height", "Altura de linha", "Tamanho SM", "1.2"),
69
+ length("--ads-button-sm-icon", "Ícone", "Tamanho SM", "16px"),
70
+ length("--ads-button-sm-icon-box", "Caixa do ícone", "Tamanho SM", "32px"),
71
+ length("--ads-button-md-padding-x", "Padding horizontal", "Tamanho MD", "16px"),
72
+ length("--ads-button-md-padding-y", "Padding vertical", "Tamanho MD", "12px"),
73
+ length("--ads-button-md-gap", "Espaço do ícone", "Tamanho MD", "8px"),
74
+ length("--ads-button-md-font-size", "Fonte", "Tamanho MD", "14px"),
75
+ line("--ads-button-md-line-height", "Altura de linha", "Tamanho MD", "1.3"),
76
+ length("--ads-button-md-icon", "Ícone", "Tamanho MD", "18px"),
77
+ length("--ads-button-md-icon-box", "Caixa do ícone", "Tamanho MD", "40px"),
78
+ color("--ads-button-primary", "Fundo", "Primário preenchido", "#006ff7"),
79
+ color("--ads-button-primary-hover", "Fundo no hover", "Primário preenchido", "#074ac6"),
80
+ color("--ads-button-primary-pressed", "Fundo no pressed", "Primário preenchido", "#00389e"),
81
+ color("--ads-button-primary-disabled", "Fundo desabilitado", "Primário preenchido", "#89c9ff"),
82
+ color("--ads-button-primary-text", "Texto", "Primário preenchido", "#ffffff"),
83
+ color("--ads-button-secondary", "Fundo", "Secundário", "#e4f2ff"),
84
+ color("--ads-button-secondary-hover", "Fundo no hover", "Secundário", "#c7e4ff"),
85
+ color("--ads-button-secondary-pressed", "Fundo no pressed", "Secundário", "#89c9ff"),
86
+ color("--ads-button-secondary-disabled", "Fundo desabilitado", "Secundário", "#d3d8dd"),
87
+ color("--ads-button-secondary-text", "Texto", "Secundário", "#074ac6"),
88
+ color("--ads-button-secondary-disabled-text", "Texto desabilitado", "Secundário", "#ffffff"),
89
+ color("--ads-button-ia-background", "Fundo", "IA", "#f3f0ff"),
90
+ color("--ads-button-ia-border", "Borda", "IA", "#7358cc"),
91
+ color("--ads-button-ia-glow", "Brilho", "IA", "#ae96ff"),
92
+ length("--ads-button-ia-radius", "Raio", "IA", "4px"),
93
+ length("--ads-button-ia-line-height", "Altura de linha", "IA", "24px"),
94
+ ],
95
+ },
96
+ {
97
+ id: "input",
98
+ section: "campo",
99
+ catalog: "input",
100
+ label: "Input",
101
+ note: "Vale para o AdsInput. O estado de IA (Figma AI Mode) usa --ads-surface-ai no fundo e --ads-text-ai na borda, igual em todos os campos (número, busca, texto longo, data e AdsSelect).",
102
+ fields: [
103
+ length("--ads-input-height", "Altura", "Medida", "40px"),
104
+ length("--ads-input-padding-x", "Padding horizontal", "Medida", "12px"),
105
+ length("--ads-input-gap", "Espaço interno", "Medida", "8px"),
106
+ length("--ads-input-radius", "Raio", "Medida", "8px"),
107
+ length("--ads-input-font-size", "Fonte", "Medida", "14px"),
108
+ length("--ads-input-label-size", "Fonte do rótulo", "Medida", "12px"),
109
+ color("--ads-input-border", "Borda", "Cores", "#c1c7d0"),
110
+ color("--ads-input-background", "Fundo", "Cores", "#ffffff"),
111
+ color("--ads-input-text", "Texto", "Cores", "#505f79"),
112
+ color("--ads-input-focus-border", "Borda em foco", "Cores", "#0091ff"),
113
+ color("--ads-input-hover-border", "Borda no hover", "Cores", "#006ff7"),
114
+ color("--ads-input-error-border", "Borda de erro", "Cores", "#ff507a"),
115
+ color("--ads-input-disabled-border", "Borda desabilitada", "Cores", "#a5adba"),
116
+ color("--ads-input-disabled-background", "Fundo desabilitado", "Cores", "#f0f3f6"),
117
+ color("--ads-input-disabled-text", "Texto desabilitado", "Cores", "#a5adba"),
118
+ ],
119
+ },
120
+ {
121
+ id: "number",
122
+ section: "numero",
123
+ catalog: "number-input",
124
+ label: "Número",
125
+ fields: [
126
+ length("--ads-number-height", "Altura", "Medida", "40px"),
127
+ length("--ads-number-padding-x", "Padding horizontal", "Medida", "12px"),
128
+ length("--ads-number-gap", "Espaço interno", "Medida", "8px"),
129
+ length("--ads-number-radius", "Raio", "Medida", "8px"),
130
+ length("--ads-number-font-size", "Fonte", "Medida", "14px"),
131
+ length("--ads-number-label-size", "Fonte do rótulo", "Medida", "12px"),
132
+ color("--ads-number-border", "Borda", "Cores", "#c1c7d0"),
133
+ color("--ads-number-background", "Fundo", "Cores", "#ffffff"),
134
+ color("--ads-number-text", "Texto", "Cores", "#505f79"),
135
+ color("--ads-number-focus-border", "Borda em foco", "Cores", "#0091ff"),
136
+ color("--ads-number-hover-border", "Borda no hover", "Cores", "#006ff7"),
137
+ color("--ads-number-error-border", "Borda de erro", "Cores", "#ff507a"),
138
+ color("--ads-number-disabled-border", "Borda desabilitada", "Cores", "#a5adba"),
139
+ color("--ads-number-disabled-background", "Fundo desabilitado", "Cores", "#f0f3f6"),
140
+ color("--ads-number-disabled-text", "Texto desabilitado", "Cores", "#a5adba"),
141
+ ],
142
+ },
143
+ {
144
+ id: "search",
145
+ section: "busca",
146
+ catalog: "search-input",
147
+ label: "Busca",
148
+ fields: [
149
+ length("--ads-search-sm-height", "Altura SM", "Medida", "40px"),
150
+ length("--ads-search-md-height", "Altura MD", "Medida", "45px"),
151
+ length("--ads-search-padding-x", "Padding horizontal", "Medida", "12px"),
152
+ length("--ads-search-radius", "Raio", "Medida", "500px"),
153
+ length("--ads-search-sm-font-size", "Fonte SM", "Medida", "14px"),
154
+ length("--ads-search-md-font-size", "Fonte MD", "Medida", "16px"),
155
+ color("--ads-search-border", "Borda", "Cores", "#c1c7d0"),
156
+ color("--ads-search-background", "Fundo", "Cores", "#ffffff"),
157
+ color("--ads-search-text", "Texto", "Cores", "#505f79"),
158
+ color("--ads-search-placeholder", "Placeholder", "Cores", "#a5adba"),
159
+ color("--ads-search-focus-border", "Borda em foco", "Cores", "#006ff7"),
160
+ color("--ads-search-hover-border", "Borda no hover", "Cores", "#006ff7"),
161
+ color("--ads-search-disabled-border", "Borda desabilitada", "Cores", "#a5adba"),
162
+ color("--ads-search-disabled-background", "Fundo desabilitado", "Cores", "#f0f3f6"),
163
+ ],
164
+ },
165
+ {
166
+ id: "textarea",
167
+ section: "texto",
168
+ catalog: "textarea",
169
+ label: "Texto longo",
170
+ fields: [
171
+ length("--ads-textarea-min-height", "Altura mínima", "Medida", "153px"),
172
+ length("--ads-textarea-padding", "Padding", "Medida", "12px"),
173
+ length("--ads-textarea-radius", "Raio", "Medida", "8px"),
174
+ length("--ads-textarea-font-size", "Fonte", "Medida", "16px"),
175
+ length("--ads-textarea-label-size", "Fonte do rótulo", "Medida", "12px"),
176
+ color("--ads-textarea-border", "Borda", "Cores", "#c1c7d0"),
177
+ color("--ads-textarea-background", "Fundo", "Cores", "#ffffff"),
178
+ color("--ads-textarea-text", "Texto", "Cores", "#505f79"),
179
+ color("--ads-textarea-placeholder", "Placeholder", "Cores", "#a5adba"),
180
+ color("--ads-textarea-focus-border", "Borda em foco", "Cores", "#0091ff"),
181
+ color("--ads-textarea-hover-border", "Borda no hover", "Cores", "#006ff7"),
182
+ color("--ads-textarea-error-border", "Borda de erro", "Cores", "#ff507a"),
183
+ color("--ads-textarea-disabled-border", "Borda desabilitada", "Cores", "#c1c7d0"),
184
+ color("--ads-textarea-disabled-background", "Fundo desabilitado", "Cores", "#f0f3f6"),
185
+ ],
186
+ },
187
+ {
188
+ id: "date",
189
+ section: "data",
190
+ catalog: "date-picker",
191
+ label: "Data",
192
+ fields: [
193
+ length("--ads-date-height", "Altura", "Medida", "40px"),
194
+ length("--ads-date-padding-x", "Padding horizontal", "Medida", "12px"),
195
+ length("--ads-date-radius", "Raio", "Medida", "8px"),
196
+ length("--ads-date-font-size", "Fonte", "Fonte", "14px"),
197
+ weight("--ads-date-weight", "Peso", "Fonte", "400"),
198
+ line("--ads-date-line-height", "Altura de linha", "Fonte", "1.429"),
199
+ color("--ads-date-border", "Borda", "Cores", "#cad5e2"),
200
+ color("--ads-date-background", "Fundo", "Cores", "#ffffff"),
201
+ color("--ads-date-text", "Texto", "Cores", "#0f172b"),
202
+ color("--ads-date-placeholder", "Placeholder", "Cores", "#90a1b9"),
203
+ color("--ads-date-separator", "Separador", "Cores", "#62748e"),
204
+ color("--ads-date-focus-border", "Borda em foco", "Cores", "#006ff7"),
205
+ color("--ads-date-hover-border", "Borda no hover", "Cores", "#006ff7"),
206
+ /* Mesmo azul do hover do dia no calendário (--color-ads-radar-25). O editor só aceita #rrggbb, então vai o hex. */
207
+ color("--ads-month-hover-bg", "Fundo no hover", "Mês", "#e4f2ff"),
208
+ ],
209
+ },
210
+ {
211
+ id: "select",
212
+ section: "select",
213
+ catalog: "select",
214
+ label: "Select",
215
+ note: "Campo (Select), lista (Super dropdown) e itens (_Dropdown Item) do AdsSelect. Os tokens do campo mantêm o prefixo --ads-filter.",
216
+ fields: [
217
+ length("--ads-filter-height", "Altura", "Medida", "40px"),
218
+ length("--ads-filter-padding-x", "Padding horizontal", "Medida", "12px"),
219
+ length("--ads-filter-radius", "Raio", "Medida", "8px"),
220
+ length("--ads-filter-font-size", "Fonte", "Medida", "14px"),
221
+ length("--ads-filter-label-size", "Fonte do rótulo", "Medida", "12px"),
222
+ color("--ads-filter-border", "Borda", "Cores", "#505f79"),
223
+ color("--ads-filter-background", "Fundo", "Cores", "#ffffff"),
224
+ color("--ads-filter-text", "Texto", "Cores", "#505f79"),
225
+ color("--ads-filter-focus-border", "Borda em foco", "Cores", "#006ff7"),
226
+ color("--ads-filter-hover-border", "Borda no hover", "Cores", "#006ff7"),
227
+ color("--ads-filter-error-border", "Borda de erro", "Cores", "#ff6783"),
228
+ color("--ads-filter-disabled-border", "Borda desabilitada", "Cores", "#b3bac5"),
229
+ color("--ads-filter-disabled-background", "Fundo desabilitado", "Cores", "#f0f3f6"),
230
+ color("--ads-filter-disabled-text", "Texto desabilitado", "Cores", "#a5adba"),
231
+ length("--ads-select-panel-width", "Largura da lista", "Lista", "320px"),
232
+ length("--ads-select-panel-max-height", "Altura máxima da lista", "Lista", "320px"),
233
+ length("--ads-select-item-padding", "Padding do item", "Lista", "16px"),
234
+ color("--ads-select-panel-border", "Borda da lista", "Lista", "#e5e8eb"),
235
+ color("--ads-select-divider", "Divisória", "Lista", "#e5e8eb"),
236
+ color("--ads-select-item-hover", "Item no hover", "Lista", "#f0f3f6"),
237
+ color("--ads-select-item-selected", "Item selecionado (simples)", "Lista", "#e4f2ff"),
238
+ color("--ads-select-badge", "Selo", "Lista", "#006ff7"),
239
+ color("--ads-select-badge-ai", "Selo de IA", "Lista", "#613dda"),
240
+ ],
241
+ },
242
+ {
243
+ id: "tabs",
244
+ section: "abas",
245
+ catalog: "tabs",
246
+ label: "Abas",
247
+ fields: [
248
+ length("--ads-tabs-height", "Altura", "Medida", "39px"),
249
+ length("--ads-tabs-padding-x", "Padding horizontal", "Medida", "12px"),
250
+ length("--ads-tabs-font-size", "Fonte", "Medida", "14px"),
251
+ length("--ads-tabs-indicator", "Indicador", "Medida", "4px"),
252
+ weight("--ads-tabs-weight", "Peso inativo", "Medida", "500"),
253
+ color("--ads-tabs-inactive", "Texto inativo", "Cores", "#505f79"),
254
+ color("--ads-tabs-active", "Texto ativo", "Cores", "#061938"),
255
+ color("--ads-tabs-indicator-color", "Indicador", "Cores", "#006ff7"),
256
+ color("--ads-tabs-border", "Linha", "Cores", "#c1c7d0"),
257
+ ],
258
+ },
259
+ {
260
+ id: "segmented",
261
+ section: "segmentadas",
262
+ catalog: "segmented-tabs",
263
+ label: "Segmented",
264
+ fields: [
265
+ length("--ads-segmented-height", "Altura da trilha", "Medida", "37px"),
266
+ length("--ads-segmented-item-height", "Altura do item", "Medida", "30px"),
267
+ length("--ads-segmented-padding-x", "Padding horizontal", "Medida", "16px"),
268
+ length("--ads-segmented-radius", "Raio", "Medida", "4px"),
269
+ length("--ads-segmented-font-size", "Fonte", "Medida", "12px"),
270
+ color("--ads-segmented-track", "Fundo da trilha", "Cores", "#f0f3f6"),
271
+ color("--ads-segmented-active-bg", "Fundo ativo", "Cores", "#ffffff"),
272
+ color("--ads-segmented-text", "Texto", "Cores", "#061938"),
273
+ color("--ads-segmented-active-text", "Texto ativo", "Cores", "#000000"),
274
+ ],
275
+ },
276
+ {
277
+ id: "toast",
278
+ section: "aviso",
279
+ catalog: "toast",
280
+ label: "Toast",
281
+ fields: [
282
+ length("--ads-toast-radius", "Raio", "Medida", "8px"),
283
+ length("--ads-toast-padding", "Padding", "Medida", "12px"),
284
+ length("--ads-toast-gap", "Espaço", "Medida", "16px"),
285
+ length("--ads-toast-icon", "Ícone", "Medida", "18px"),
286
+ length("--ads-toast-font-size", "Fonte", "Medida", "14px"),
287
+ weight("--ads-toast-weight", "Peso", "Medida", "500"),
288
+ color("--ads-toast-text", "Texto", "Cores", "#061938"),
289
+ color("--ads-toast-primary-bg", "Fundo primário", "Cores", "#e4f2ff"),
290
+ color("--ads-toast-error-bg", "Fundo de erro", "Cores", "rgba(255, 189, 205, 0.5)"),
291
+ color("--ads-toast-warning-bg", "Fundo de alerta", "Cores", "#ffe7b9"),
292
+ color("--ads-toast-neutral-bg", "Fundo neutro", "Cores", "#e4f2ff"),
293
+ color("--ads-toast-primary-icon", "Ícone primário", "Cores", "#006ff7"),
294
+ color("--ads-toast-success-icon", "Ícone de sucesso", "Cores", "#0e5a3b"),
295
+ color("--ads-toast-error-icon", "Ícone de erro", "Cores", "#840221"),
296
+ color("--ads-toast-warning-icon", "Ícone de alerta", "Cores", "#7a5600"),
297
+ color("--ads-toast-neutral-icon", "Ícone neutro", "Cores", "#006ff7"),
298
+ length("--ads-toast-status-width", "Largura", "Reporte", "331px"),
299
+ length("--ads-toast-status-icon", "Ícone", "Reporte", "24px"),
300
+ length("--ads-toast-status-title-size", "Fonte do título", "Reporte", "14px"),
301
+ length("--ads-toast-status-subtitle-size", "Fonte do subtítulo", "Reporte", "10px"),
302
+ color("--ads-toast-status-bg", "Fundo", "Reporte", "#061938"),
303
+ color("--ads-toast-status-text", "Texto", "Reporte", "#ffffff"),
304
+ color("--ads-toast-status-success", "Ícone de sucesso", "Reporte", "#06eb8f"),
305
+ color("--ads-toast-status-error", "Ícone de erro", "Reporte", "#ef164a"),
306
+ color("--ads-toast-status-warning", "Ícone de atenção", "Reporte", "#ffb905"),
307
+ color("--ads-toast-status-loading", "Ícone de carga", "Reporte", "#49d8f4"),
308
+ ],
309
+ },
310
+ {
311
+ id: "file",
312
+ section: "arquivo",
313
+ catalog: "file-card",
314
+ label: "Arquivo",
315
+ fields: [
316
+ length("--ads-file-min-height", "Altura mínima", "Medida", "64px"),
317
+ length("--ads-file-radius", "Raio", "Medida", "8px"),
318
+ length("--ads-file-padding-x", "Padding horizontal", "Medida", "12px"),
319
+ length("--ads-file-padding-y", "Padding vertical", "Medida", "12px"),
320
+ length("--ads-file-title-size", "Fonte do nome", "Medida", "14px"),
321
+ length("--ads-file-detail-size", "Fonte do detalhe", "Medida", "12px"),
322
+ length("--ads-file-icon-box", "Caixa do ícone", "Medida", "40px"),
323
+ ],
324
+ },
325
+ {
326
+ id: "tooltip",
327
+ section: "tooltip",
328
+ catalog: "tooltip",
329
+ label: "Tooltip",
330
+ fields: [
331
+ length("--ads-tooltip-radius", "Raio", "Medida", "12px"),
332
+ length("--ads-tooltip-padding-x", "Padding horizontal", "Medida", "16px"),
333
+ length("--ads-tooltip-padding-y", "Padding vertical", "Medida", "12px"),
334
+ length("--ads-tooltip-font-size", "Fonte", "Medida", "14px"),
335
+ color("--ads-tooltip-bg", "Fundo", "Cores", "#061938"),
336
+ color("--ads-tooltip-text", "Texto", "Cores", "#c1c7d0"),
337
+ color("--ads-tooltip-title", "Título", "Cores", "#ffffff"),
338
+ length("--ads-tooltip-title-size", "Fonte do título", "Medida", "16px"),
339
+ length("--ads-tooltip-small-font-size", "Fonte do smalltip", "Smalltip", "10px"),
340
+ length("--ads-tooltip-small-padding", "Padding do smalltip", "Smalltip", "8px"),
341
+ length("--ads-steptip-width", "Largura do steptip", "Steptip", "328px"),
342
+ color("--ads-steptip-skip", "Texto pular", "Steptip", "#b3bac5"),
343
+ length("--ads-charttip-min-width", "Largura mínima", "Charttip", "328px"),
344
+ length("--ads-charttip-swatch", "Amostra", "Charttip", "16px"),
345
+ ],
346
+ },
347
+ {
348
+ id: "loading",
349
+ section: "carregando",
350
+ catalog: "loading",
351
+ label: "Loading",
352
+ fields: [
353
+ length("--ads-loading-radius", "Raio do skeleton", "Medida", "4px"),
354
+ length("--ads-loading-bar", "Linha do skeleton médio", "Medida", "12px"),
355
+ length("--ads-loading-spinner", "Spinner médio", "Medida", "24px"),
356
+ length("--ads-loading-label-size", "Fonte do rótulo", "Medida", "14px"),
357
+ color("--ads-loading-skeleton", "Skeleton", "Cores", "#e5e8eb"),
358
+ color("--ads-loading-skeleton-muted", "Skeleton muted", "Cores", "#f0f3f6"),
359
+ color("--ads-loading-spinner-color", "Arco do spinner", "Cores", "#006ff7"),
360
+ color("--ads-loading-spinner-track", "Trilha do spinner", "Cores", "#c7e4ff"),
361
+ ],
362
+ },
363
+ {
364
+ id: "progress",
365
+ section: "progresso",
366
+ catalog: "progress-bar-loading",
367
+ label: "Barra de progresso",
368
+ fields: [
369
+ length("--ads-progress-height", "Altura", "Medida", "8px"),
370
+ length("--ads-progress-radius", "Raio", "Medida", "4px"),
371
+ color("--ads-progress-track", "Trilha", "Cores", "#e5e8eb"),
372
+ color("--ads-progress-fill", "Preenchimento", "Cores", "#006ff7"),
373
+ color("--ads-progress-success", "Sucesso", "Cores", "#1c9f6a"),
374
+ ],
375
+ },
376
+ {
377
+ id: "badge",
378
+ section: "badge",
379
+ catalog: "badge",
380
+ label: "Badge",
381
+ note: "O fundo de cada cor continua na escala de status. Aqui ficam a medida e o texto.",
382
+ fields: [
383
+ length("--ads-badge-size", "Tamanho", "Medida", "24px"),
384
+ length("--ads-badge-dot", "Ponto", "Medida", "8px"),
385
+ length("--ads-badge-font-size", "Fonte", "Medida", "12px"),
386
+ weight("--ads-badge-weight", "Peso", "Medida", "700"),
387
+ color("--ads-badge-text", "Texto", "Cores", "#ffffff"),
388
+ ],
389
+ },
390
+ {
391
+ id: "pill",
392
+ section: "pill",
393
+ catalog: "pill",
394
+ label: "Pill",
395
+ note: "Os outros status continuam no mapa de cor da pill. O editor muda a medida e o primário.",
396
+ fields: [
397
+ length("--ads-pill-height", "Altura", "Medida", "24px"),
398
+ length("--ads-pill-min-width", "Largura mínima", "Medida", "100px"),
399
+ length("--ads-pill-padding-x", "Padding horizontal", "Medida", "8px"),
400
+ length("--ads-pill-font-size", "Fonte", "Medida", "12px"),
401
+ weight("--ads-pill-weight", "Peso", "Medida", "700"),
402
+ color("--ads-pill-primary-bg", "Fundo primário", "Cores", "#006ff7"),
403
+ color("--ads-pill-primary-text", "Texto primário", "Cores", "#ffffff"),
404
+ ],
405
+ },
406
+ {
407
+ id: "notability",
408
+ section: "notabilidade",
409
+ catalog: "notability-pill",
410
+ label: "Pill de notabilidade",
411
+ note: "As cores seguem o status. Aqui ficam a medida e o tipo.",
412
+ fields: [
413
+ length("--ads-notability-height", "Altura", "Medida", "24px"),
414
+ length("--ads-notability-min-width", "Largura mínima", "Medida", "100px"),
415
+ length("--ads-notability-padding-x", "Padding horizontal", "Medida", "8px"),
416
+ length("--ads-notability-font-size", "Fonte", "Medida", "12px"),
417
+ weight("--ads-notability-weight", "Peso", "Medida", "700"),
418
+ ],
419
+ },
420
+ {
421
+ id: "broadcast",
422
+ section: "broadcast",
423
+ catalog: "pill",
424
+ label: "Pill broadcast",
425
+ note: "Variante broadcast do AdsPill (variant=\"broadcast\"). O AdsBroadcast é um atalho para ela.",
426
+ fields: [
427
+ length("--ads-broadcast-height", "Altura", "Medida", "24px"),
428
+ length("--ads-broadcast-padding-x", "Padding horizontal", "Medida", "8px"),
429
+ length("--ads-broadcast-font-size", "Fonte", "Medida", "12px"),
430
+ length("--ads-broadcast-mark", "Marca", "Medida", "8px"),
431
+ color("--ads-broadcast-warning-bg", "Fundo de alerta", "Cores", "#ffbdcd"),
432
+ color("--ads-broadcast-warning", "Alerta", "Cores", "#dc0034"),
433
+ color("--ads-broadcast-success-bg", "Fundo de sucesso", "Cores", "#c3ffe6"),
434
+ color("--ads-broadcast-success", "Sucesso", "Cores", "#15c57e"),
435
+ ],
436
+ },
437
+ {
438
+ id: "mini",
439
+ section: "mini",
440
+ catalog: "pill",
441
+ label: "Mini pill",
442
+ fields: [
443
+ length("--ads-mini-height", "Altura", "Medida", "18px"),
444
+ length("--ads-mini-padding-x", "Padding horizontal", "Medida", "8px"),
445
+ length("--ads-mini-font-size", "Fonte", "Medida", "10px"),
446
+ weight("--ads-mini-weight", "Peso", "Medida", "700"),
447
+ color("--ads-mini-idle-bg", "Fundo não iniciado", "Cores", "#d1d9ed"),
448
+ color("--ads-mini-idle-text", "Texto não iniciado", "Cores", "#18224b"),
449
+ color("--ads-mini-paused-bg", "Fundo pausado", "Cores", "#ffe7b9"),
450
+ color("--ads-mini-paused-text", "Texto pausado", "Cores", "#7a5600"),
451
+ color("--ads-mini-new-bg", "Fundo novo", "Cores", "#79e9ff"),
452
+ color("--ads-mini-new-text", "Texto novo", "Cores", "#006478"),
453
+ ],
454
+ },
455
+ {
456
+ id: "switch",
457
+ section: "switch",
458
+ catalog: "switch",
459
+ label: "Switch",
460
+ fields: [
461
+ length("--ads-switch-width", "Largura", "Medida", "32px"),
462
+ length("--ads-switch-height", "Altura", "Medida", "18px"),
463
+ length("--ads-switch-thumb", "Botão", "Medida", "12px"),
464
+ length("--ads-switch-inset", "Respiro", "Medida", "3px"),
465
+ length("--ads-switch-radius", "Raio", "Medida", "9px"),
466
+ length("--ads-switch-label-size", "Fonte do rótulo", "Medida", "14px"),
467
+ length("--ads-switch-gap", "Espaço", "Medida", "8px"),
468
+ color("--ads-switch-off", "Desligado", "Cores", "#c1c7d0"),
469
+ color("--ads-switch-on", "Ligado", "Cores", "#006ff7"),
470
+ color("--ads-switch-disabled", "Desabilitado", "Cores", "#e5e8eb"),
471
+ color("--ads-switch-disabled-on", "Ligado desabilitado", "Cores", "#89c9ff"),
472
+ color("--ads-switch-thumb-color", "Botão", "Cores", "#ffffff"),
473
+ color("--ads-switch-label", "Rótulo", "Cores", "#505f79"),
474
+ ],
475
+ },
476
+ {
477
+ id: "checkbox",
478
+ section: "checkbox",
479
+ catalog: "checkbox",
480
+ label: "Checkbox",
481
+ fields: [
482
+ length("--ads-checkbox-size", "Tamanho", "Medida", "16px"),
483
+ length("--ads-checkbox-radius", "Raio", "Medida", "4px"),
484
+ length("--ads-checkbox-border-width", "Borda", "Medida", "2px"),
485
+ length("--ads-checkbox-label-size", "Fonte do rótulo", "Medida", "14px"),
486
+ length("--ads-checkbox-gap", "Espaço", "Medida", "8px"),
487
+ color("--ads-checkbox-border", "Borda", "Cores", "#006ff7"),
488
+ color("--ads-checkbox-checked", "Marcado", "Cores", "#006ff7"),
489
+ color("--ads-checkbox-disabled", "Desabilitado", "Cores", "#89c9ff"),
490
+ color("--ads-checkbox-background", "Fundo", "Cores", "#ffffff"),
491
+ color("--ads-checkbox-label", "Rótulo", "Cores", "#505f79"),
492
+ ],
493
+ },
494
+ {
495
+ id: "radio",
496
+ section: "radio",
497
+ catalog: "radio",
498
+ label: "Radio",
499
+ fields: [
500
+ length("--ads-radio-size", "Tamanho", "Medida", "16px"),
501
+ length("--ads-radio-dot", "Miolo", "Medida", "8px"),
502
+ length("--ads-radio-border-width", "Borda", "Medida", "2px"),
503
+ length("--ads-radio-label-size", "Fonte do rótulo", "Medida", "14px"),
504
+ length("--ads-radio-gap", "Espaço", "Medida", "8px"),
505
+ color("--ads-radio-border", "Borda", "Cores", "#006ff7"),
506
+ color("--ads-radio-disabled", "Desabilitado", "Cores", "#89c9ff"),
507
+ color("--ads-radio-background", "Fundo", "Cores", "#ffffff"),
508
+ color("--ads-radio-dot-color", "Miolo", "Cores", "#ffffff"),
509
+ color("--ads-radio-label", "Rótulo", "Cores", "#505f79"),
510
+ ],
511
+ },
512
+ {
513
+ id: "modal",
514
+ section: "modal",
515
+ catalog: "modal",
516
+ label: "Modal",
517
+ fields: [
518
+ length("--ads-modal-radius", "Raio", "Medida", "8px"),
519
+ length("--ads-modal-padding", "Padding", "Medida", "24px"),
520
+ length("--ads-modal-title-size", "Fonte do título", "Medida", "20px"),
521
+ length("--ads-modal-body-size", "Fonte do texto", "Medida", "14px"),
522
+ color("--ads-modal-background", "Fundo", "Cores", "#ffffff"),
523
+ color("--ads-modal-border", "Borda", "Cores", "#c1c7d0"),
524
+ color("--ads-modal-title", "Título", "Cores", "#061938"),
525
+ color("--ads-modal-body", "Texto", "Cores", "#505f79"),
526
+ ],
527
+ },
528
+ {
529
+ id: "feature",
530
+ section: "feature",
531
+ catalog: "feature-card",
532
+ label: "Feature card",
533
+ fields: [
534
+ length("--ads-feature-width", "Largura", "Medida", "396px"),
535
+ length("--ads-feature-gap", "Espaço", "Medida", "16px"),
536
+ length("--ads-feature-icon-box", "Caixa do ícone", "Medida", "48px"),
537
+ length("--ads-feature-title-size", "Fonte do título", "Medida", "16px"),
538
+ length("--ads-feature-body-size", "Fonte do texto", "Medida", "14px"),
539
+ color("--ads-feature-title", "Título", "Cores", "#061938"),
540
+ color("--ads-feature-body", "Texto", "Cores", "#505f79"),
541
+ ],
542
+ },
543
+ {
544
+ id: "card",
545
+ section: "card",
546
+ catalog: "card",
547
+ label: "Card",
548
+ fields: [
549
+ length("--ads-card-padding", "Padding", "Medida", "16px"),
550
+ length("--ads-card-radius", "Raio", "Medida", "12px"),
551
+ length("--ads-card-radius-sm", "Raio pequeno", "Medida", "8px"),
552
+ length("--ads-card-body-size", "Fonte do texto", "Medida", "14px"),
553
+ color("--ads-card-border", "Borda", "Cores", "#e5e8eb"),
554
+ color("--ads-card-background", "Fundo", "Cores", "#ffffff"),
555
+ color("--ads-card-hover-border", "Borda no hover", "Cores", "#c1c7d0"),
556
+ color("--ads-card-selected-border", "Borda selecionada", "Cores", "#006ff7"),
557
+ color("--ads-card-selected-background", "Fundo selecionado", "Cores", "#e4f2ff"),
558
+ color("--ads-card-title", "Título", "Cores", "#061938"),
559
+ color("--ads-card-body", "Texto", "Cores", "#505f79"),
560
+ ],
561
+ },
562
+ {
563
+ id: "metric",
564
+ section: "metric",
565
+ catalog: "metric-card",
566
+ label: "Card de métrica",
567
+ fields: [
568
+ length("--ads-metric-padding", "Padding", "Medida", "16px"),
569
+ length("--ads-metric-radius", "Raio", "Medida", "12px"),
570
+ length("--ads-metric-gap", "Espaço", "Medida", "8px"),
571
+ length("--ads-metric-label-size", "Fonte do rótulo", "Medida", "14px"),
572
+ length("--ads-metric-value-size", "Fonte do valor", "Medida", "20px"),
573
+ length("--ads-metric-caption-size", "Fonte da legenda", "Medida", "12px"),
574
+ color("--ads-metric-border", "Borda", "Cores", "#e5e8eb"),
575
+ color("--ads-metric-background", "Fundo", "Cores", "#ffffff"),
576
+ color("--ads-metric-label", "Título", "Cores", "#061938"),
577
+ color("--ads-metric-value", "Valor", "Cores", "#061938"),
578
+ ],
579
+ },
580
+ {
581
+ id: "menu",
582
+ section: "menu",
583
+ catalog: "menu-bar",
584
+ label: "Menu bar",
585
+ fields: [
586
+ length("--ads-menu-width", "Largura", "Medida", "100px"),
587
+ length("--ads-menu-padding-y", "Padding vertical", "Medida", "16px"),
588
+ length("--ads-menu-gap", "Espaço", "Medida", "16px"),
589
+ length("--ads-menu-icon", "Ícone", "Medida", "18px"),
590
+ length("--ads-menu-icon-box", "Caixa do ícone", "Medida", "40px"),
591
+ length("--ads-menu-label-size", "Fonte", "Medida", "12px"),
592
+ color("--ads-menu-divider", "Divisor", "Cores", "#e5e8eb"),
593
+ ],
594
+ },
595
+ {
596
+ id: "navbar-app",
597
+ section: "navbar-app",
598
+ catalog: "navbar-app",
599
+ label: "Navbar app",
600
+ fields: [
601
+ length("--ads-navbar-app-height", "Altura", "Medida", "88px"),
602
+ length("--ads-navbar-app-gap", "Espaço", "Medida", "33px"),
603
+ length("--ads-navbar-app-item-width", "Largura do item", "Medida", "39px"),
604
+ length("--ads-navbar-app-well", "Caixa do ícone", "Medida", "28px"),
605
+ length("--ads-navbar-app-font-size", "Fonte", "Medida", "10px"),
606
+ color("--ads-navbar-app-active", "Ativo", "Cores", "#344563"),
607
+ ],
608
+ },
609
+ {
610
+ id: "navbar-desk",
611
+ section: "navbar-desk",
612
+ catalog: "navbar-desk",
613
+ label: "Navbar desk",
614
+ fields: [
615
+ length("--ads-navbar-desk-height", "Altura", "Medida", "64px"),
616
+ length("--ads-navbar-desk-padding-x", "Padding horizontal", "Medida", "44px"),
617
+ length("--ads-navbar-desk-padding-end", "Padding à direita", "Medida", "48px"),
618
+ length("--ads-navbar-desk-action", "Botão", "Medida", "40px"),
619
+ length("--ads-navbar-desk-avatar", "Avatar", "Medida", "32px"),
620
+ color("--ads-navbar-desk-border", "Borda", "Cores", "#d3d8dd"),
621
+ ],
622
+ },
623
+ {
624
+ id: "side",
625
+ section: "menu-lateral",
626
+ catalog: "side-menu",
627
+ label: "Menu lateral",
628
+ fields: [
629
+ length("--ads-side-width", "Largura", "Medida", "224px"),
630
+ length("--ads-side-row-height", "Altura da linha", "Medida", "48px"),
631
+ length("--ads-side-badge", "Badge", "Medida", "8px"),
632
+ color("--ads-side-border", "Borda", "Cores", "#e5e8eb"),
633
+ color("--ads-side-open-bg", "Mãe aberta", "Cores", "#e5e8eb"),
634
+ color("--ads-side-child-bg", "Filho", "Cores", "#f0f3f6"),
635
+ ],
636
+ },
637
+ {
638
+ id: "footer",
639
+ section: "footer",
640
+ catalog: "footer",
641
+ label: "Footer",
642
+ fields: [
643
+ length("--ads-footer-min-height", "Altura mínima", "Medida", "32px"),
644
+ length("--ads-footer-logo-height", "Logo", "Medida", "12px"),
645
+ color("--ads-footer-text", "Texto", "Cores", "#7a869a"),
646
+ ],
647
+ },
648
+ {
649
+ id: "product-tag",
650
+ section: "product-tag",
651
+ catalog: "product-tag",
652
+ label: "Tag de produto",
653
+ fields: [
654
+ length("--ads-product-tag-height", "Altura", "Medida", "16px"),
655
+ length("--ads-product-tag-font-size", "Fonte", "Medida", "11px"),
656
+ ],
657
+ },
658
+ {
659
+ id: "button-group",
660
+ section: "grupo",
661
+ catalog: "button-group",
662
+ label: "Grupo de botões",
663
+ fields: [
664
+ length("--ads-button-group-height", "Altura", "Medida", "30px"),
665
+ length("--ads-button-group-font-size", "Fonte", "Medida", "12px"),
666
+ color("--ads-button-group-border", "Borda", "Cores", "#c1c7d0"),
667
+ color("--ads-button-group-selected", "Selecionado", "Cores", "#e5e8eb"),
668
+ ],
669
+ },
670
+ {
671
+ id: "button-menu",
672
+ section: "menu-botao",
673
+ catalog: "button-menu",
674
+ label: "Menu de botão",
675
+ fields: [
676
+ length("--ads-button-menu-width", "Largura", "Medida", "264px"),
677
+ length("--ads-button-menu-title-size", "Fonte do título", "Medida", "16px"),
678
+ length("--ads-button-menu-subtitle-size", "Fonte do subtítulo", "Medida", "12px"),
679
+ color("--ads-button-menu-title", "Título", "Cores", "#061938"),
680
+ color("--ads-button-menu-subtitle", "Subtítulo", "Cores", "#505f79"),
681
+ color("--ads-button-menu-border", "Borda", "Cores", "#e5e8eb"),
682
+ ],
683
+ },
684
+ {
685
+ id: "pagination",
686
+ section: "paginacao",
687
+ catalog: "pagination",
688
+ label: "Paginação",
689
+ fields: [
690
+ length("--ads-pagination-cell", "Célula", "Medida", "24px"),
691
+ length("--ads-pagination-gap", "Espaço", "Medida", "12px"),
692
+ length("--ads-pagination-number-gap", "Espaço dos números", "Medida", "4px"),
693
+ color("--ads-pagination-selected", "Selecionada", "Cores", "#006ff7"),
694
+ color("--ads-pagination-number", "Número", "Cores", "#344563"),
695
+ ],
696
+ },
697
+ {
698
+ id: "empty",
699
+ section: "vazio",
700
+ catalog: "empty-state",
701
+ label: "Empty state",
702
+ fields: [
703
+ length("--ads-empty-icon", "Ícone", "Medida", "90px"),
704
+ length("--ads-empty-icon-sm", "Ícone pequeno", "Medida", "60px"),
705
+ length("--ads-empty-title-size", "Fonte do título", "Medida", "18px"),
706
+ length("--ads-empty-title-size-sm", "Fonte do título pequeno", "Medida", "16px"),
707
+ length("--ads-empty-subtitle-size", "Fonte do apoio", "Medida", "12px"),
708
+ length("--ads-empty-gap", "Espaço", "Medida", "24px"),
709
+ length("--ads-empty-gap-sm", "Espaço pequeno", "Medida", "16px"),
710
+ length("--ads-empty-text-gap", "Espaço do texto", "Medida", "8px"),
711
+ length("--ads-empty-text-gap-sm", "Espaço do texto pequeno", "Medida", "4px"),
712
+ color("--ads-empty-icon-color", "Ícone", "Cores", "#7a869a"),
713
+ ],
714
+ },
715
+ {
716
+ id: "funcional",
717
+ section: "funcional",
718
+ catalog: "cores",
719
+ label: "Cores funcionais",
720
+ note: "Cores do arquivo de componentes sem degrau na escala publicada. O badge do menu lateral usa opportunity 200. A borda de erro do AdsSelect repete warning 200.",
721
+ fields: [
722
+ color("--ads-funcional-warning-200", "Warning 200", "Cores", "#ff6783"),
723
+ color("--ads-funcional-opportunity-200", "Opportunity 200", "Cores", "#0ebbda"),
724
+ ],
725
+ },
726
+ ];
727
+
728
+ export const allTokenFields = () => componentTokenCatalog.flatMap((component) => component.fields);
729
+
730
+ export const componentTokenDefaults = (): Record<string, string> =>
731
+ Object.fromEntries(allTokenFields().map((field) => [field.name, field.fallback]));
732
+
733
+ export const tokenGroups = (component: TokenComponent) => {
734
+ const groups: { label: string; fields: TokenField[] }[] = [];
735
+ for (const field of component.fields) {
736
+ const current = groups.find((group) => group.label === field.group);
737
+ if (current) current.fields.push(field);
738
+ else groups.push({ label: field.group, fields: [field] });
739
+ }
740
+ return groups;
741
+ };
742
+
743
+ const lengthPattern = /^(?:\d{1,4})(?:\.\d+)?(?:px|rem)$/;
744
+ const colorPattern = /^#[0-9a-f]{6}$/;
745
+ const weightPattern = /^(?:300|400|500|700|800)$/;
746
+
747
+ export const tokenValueValid = (kind: TokenKind, value: string) => {
748
+ if (kind === "color") return colorPattern.test(value);
749
+ if (kind === "length") return lengthPattern.test(value);
750
+ if (kind === "weight") return weightPattern.test(value);
751
+ if (!/^\d(?:\.\d{1,3})?$/.test(value)) return false;
752
+ const line = Number(value);
753
+ return line >= 1 && line <= 2;
754
+ };
755
+
756
+ const normalizeValue = (field: TokenField, value: string) =>
757
+ field.kind === "color" ? value.toLowerCase() : value;
758
+
759
+ export const normalizeStoredTokens = (input: unknown): Record<string, string> => {
760
+ const tokens = componentTokenDefaults();
761
+ if (!input || typeof input !== "object" || Array.isArray(input)) return tokens;
762
+ const record = input as Record<string, unknown>;
763
+ for (const field of allTokenFields()) {
764
+ const value = record[field.name];
765
+ if (typeof value !== "string") continue;
766
+ const normalized = normalizeValue(field, value.trim());
767
+ if (tokenValueValid(field.kind, normalized)) tokens[field.name] = normalized;
768
+ }
769
+ return tokens;
770
+ };
771
+
772
+ export const assertComponentTokens = (input: unknown): Record<string, string> => {
773
+ if (!input || typeof input !== "object" || Array.isArray(input)) {
774
+ throw new Error("O corpo precisa ser o mapa de tokens.");
775
+ }
776
+ const record = input as Record<string, unknown>;
777
+ const tokens: Record<string, string> = {};
778
+ const invalid: string[] = [];
779
+ for (const field of allTokenFields()) {
780
+ const value = record[field.name];
781
+ if (typeof value !== "string") {
782
+ invalid.push(field.label);
783
+ continue;
784
+ }
785
+ const normalized = normalizeValue(field, value.trim());
786
+ if (!tokenValueValid(field.kind, normalized)) {
787
+ invalid.push(field.label);
788
+ continue;
789
+ }
790
+ tokens[field.name] = normalized;
791
+ }
792
+ if (invalid.length) {
793
+ throw new Error(`Valores inválidos: ${invalid.join(", ")}.`);
794
+ }
795
+ return tokens;
796
+ };
797
+
798
+ export const componentTokensCss = (tokens: Record<string, string>) => {
799
+ const lines = allTokenFields().map((field) => ` ${field.name}: ${tokens[field.name]};`);
800
+ return [
801
+ "/* Gerado pela tela /design-system/tokens. Fonte: app/theme/component-tokens.json */",
802
+ ":root {",
803
+ ...lines,
804
+ "}",
805
+ "",
806
+ ].join("\n");
807
+ };
808
+
809
+ export const PREVIEW_STYLE_ID = "ads-component-token-preview";