ads-nuxt 0.1.0 → 0.1.2

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 (74) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +567 -1
  3. package/app/app.config.ts +25 -25
  4. package/app/assets/ads/checkbox-check.svg +5 -5
  5. package/app/assets/ads/checkbox-minus.svg +5 -5
  6. package/app/assets/brand/farmarcas.svg +6 -6
  7. package/app/assets/brand/radar.svg +9 -9
  8. package/app/assets/css/component-tokens.css +403 -403
  9. package/app/assets/css/main.css +617 -617
  10. package/app/components/AdsBadge.vue +48 -48
  11. package/app/components/AdsBroadcast.vue +45 -45
  12. package/app/components/AdsButton.vue +569 -569
  13. package/app/components/AdsButtonGroup.vue +39 -39
  14. package/app/components/AdsButtonMenu.vue +48 -48
  15. package/app/components/AdsCard.vue +117 -117
  16. package/app/components/AdsCharttip.vue +78 -78
  17. package/app/components/AdsCheckbox.vue +77 -77
  18. package/app/components/AdsDatePicker.vue +473 -473
  19. package/app/components/AdsDropdownMenu.vue +19 -19
  20. package/app/components/AdsEmptyState.vue +58 -58
  21. package/app/components/AdsFarmarcasPill.vue +74 -74
  22. package/app/components/AdsFeatureCard.vue +217 -217
  23. package/app/components/AdsFileCard.vue +101 -101
  24. package/app/components/AdsFilterDropdown.vue +174 -174
  25. package/app/components/AdsFilterOption.vue +72 -72
  26. package/app/components/AdsFilterSelect.vue +202 -202
  27. package/app/components/AdsFooter.vue +25 -25
  28. package/app/components/AdsInput.vue +143 -143
  29. package/app/components/AdsListDropdown.vue +44 -44
  30. package/app/components/AdsLoading.vue +109 -109
  31. package/app/components/AdsMenuBar.vue +103 -103
  32. package/app/components/AdsMetricCard.vue +119 -119
  33. package/app/components/AdsMiniPill.vue +40 -40
  34. package/app/components/AdsModal.vue +157 -157
  35. package/app/components/AdsMonthPicker.vue +80 -80
  36. package/app/components/AdsNavbarApp.vue +67 -67
  37. package/app/components/AdsNavbarDesk.vue +62 -62
  38. package/app/components/AdsNotabilityPill.vue +27 -27
  39. package/app/components/AdsNumberInput.vue +166 -166
  40. package/app/components/AdsPagination.vue +91 -91
  41. package/app/components/AdsProductTag.vue +61 -61
  42. package/app/components/AdsRadio.vue +70 -70
  43. package/app/components/AdsSearchInput.vue +113 -113
  44. package/app/components/AdsSegmentedTabs.vue +28 -28
  45. package/app/components/AdsSideMenu.vue +101 -101
  46. package/app/components/AdsSmalltip.vue +44 -44
  47. package/app/components/AdsSteptip.vue +101 -101
  48. package/app/components/AdsSwitch.vue +59 -59
  49. package/app/components/AdsTable.vue +100 -100
  50. package/app/components/AdsTableToolbar.vue +44 -44
  51. package/app/components/AdsTabs.vue +51 -51
  52. package/app/components/AdsTextarea.vue +109 -109
  53. package/app/components/AdsToast.vue +181 -181
  54. package/app/components/AdsTooltip.vue +66 -66
  55. package/app/components/InvertedTooltip.vue +40 -40
  56. package/app/components/OverlayLoading.vue +173 -173
  57. package/app/components/ProgressBarLoading.vue +256 -256
  58. package/app/composables/useOverlayLoading.ts +66 -66
  59. package/app/locale/pt-br.ts +6 -6
  60. package/app/plugins/ads-toast.client.ts +24 -24
  61. package/app/theme/ads-theme.ts +370 -370
  62. package/app/theme/component-tokens.json +402 -402
  63. package/app/theme/component-tokens.ts +815 -815
  64. package/app/types/overlay-loading.types.ts +26 -26
  65. package/app/utils/ads-filter-select.ts +172 -172
  66. package/app/utils/ads-table.ts +204 -204
  67. package/app/utils/calendar-date.ts +128 -128
  68. package/app/utils/category-role.ts +45 -45
  69. package/app/utils/money.ts +77 -77
  70. package/app/utils/notability.ts +8 -8
  71. package/app/utils/parser.ts +134 -134
  72. package/app/utils/percentage.ts +54 -54
  73. package/nuxt.config.ts +31 -32
  74. package/package.json +48 -46
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Farmarcas
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Farmarcas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1 +1,567 @@
1
- "# alquimia-design-system"
1
+ # ads-nuxt
2
+
3
+ **Alquimia Design System (ADS)** para Nuxt, construído sobre o [Nuxt UI](https://ui.nuxt.com) v4 e o Tailwind CSS v4.
4
+
5
+ O pacote é uma **Nuxt Layer**: ao estendê-lo, seu projeto recebe de uma vez os componentes `Ads*`, os tokens de design (cores, espaçamento, raios, sombras, tipografia), o tema do Nuxt UI customizado, os utilitários de formatação em pt-BR e a fonte Inter.
6
+
7
+ [![npm](https://img.shields.io/npm/v/ads-nuxt.svg)](https://www.npmjs.com/package/ads-nuxt)
8
+ [![license](https://img.shields.io/npm/l/ads-nuxt.svg)](./LICENSE)
9
+
10
+ ---
11
+
12
+ ## Sumário
13
+
14
+ - [Recursos](#recursos)
15
+ - [Requisitos](#requisitos)
16
+ - [Instalação](#instalação)
17
+ - [Configuração](#configuração)
18
+ - [Uso rápido](#uso-rápido)
19
+ - [Componentes](#componentes)
20
+ - [Exemplos](#exemplos)
21
+ - [Tokens de design](#tokens-de-design)
22
+ - [Tema do Nuxt UI](#tema-do-nuxt-ui)
23
+ - [Composables](#composables)
24
+ - [Utilitários](#utilitários)
25
+ - [Localização (pt-BR)](#localização-pt-br)
26
+ - [Desenvolvimento](#desenvolvimento)
27
+ - [Estrutura do projeto](#estrutura-do-projeto)
28
+ - [Licença](#licença)
29
+
30
+ ---
31
+
32
+ ## Recursos
33
+
34
+ - **Mais de 50 componentes** prontos para produção, com prefixo `Ads` (auto-importados pelo Nuxt).
35
+ - **Tokens em três camadas** (primitivos → semânticos → de componente), expostos como variáveis CSS `--ads-*` e como cores do Tailwind (`ads-*`).
36
+ - **Tema do Nuxt UI** pré-configurado: botão, input, calendário, select, toast e tooltip já seguem o visual ADS.
37
+ - **Fonte Inter** configurada via `@nuxt/fonts`.
38
+ - **Ícones Lucide** via `@nuxt/icon` (use `i-lucide-*`).
39
+ - **Utilitários pt-BR**: moeda (BRL), porcentagem, datas, notabilidade e filtros.
40
+ - **Playground** com documentação viva de todos os componentes e tokens.
41
+ - Estados “congeláveis” (`state`) nos componentes, pensados para documentação e testes visuais.
42
+
43
+ ## Requisitos
44
+
45
+ | Dependência | Versão |
46
+ | ----------- | --------- |
47
+ | Node.js | 20+ (recomendado 22) |
48
+ | Nuxt | `^4.0.0` |
49
+ | Vue | `^3.5.18` |
50
+
51
+ `nuxt` e `vue` são *peer dependencies*. As demais (`@nuxt/ui`, `@nuxt/fonts`, `@nuxt/icon`, `@vueuse/nuxt`, `tailwindcss`, ícones Lucide) já vêm como dependências do pacote.
52
+
53
+ ## Instalação
54
+
55
+ ```bash
56
+ # pnpm
57
+ pnpm add ads-nuxt
58
+
59
+ # npm
60
+ npm install ads-nuxt
61
+
62
+ # yarn
63
+ yarn add ads-nuxt
64
+ ```
65
+
66
+ ### Skill para o agente de IA (opcional)
67
+
68
+ O repositório traz a skill `ads-nuxt`, que ensina o agente do seu projeto (Cursor, Claude Code e outros) a usar o ADS: componentes, tokens, utilitários e armadilhas conhecidas.
69
+
70
+ ```bash
71
+ npx skills add jbfarmarcas/alquimia-design-system --skill ads-nuxt # instalar
72
+ npx skills update ads-nuxt # atualizar
73
+ npx skills remove ads-nuxt # remover
74
+ ```
75
+
76
+ Rode na raiz do projeto que usa o `ads-nuxt`. A skill entra em `.agents/skills/ads-nuxt` e o projeto ganha um `skills-lock.json`. Faça commit dos dois e rode `update` depois de atualizar o pacote.
77
+
78
+ ## Configuração
79
+
80
+ Estenda a layer no `nuxt.config.ts` do seu projeto:
81
+
82
+ ```ts
83
+ // nuxt.config.ts
84
+ export default defineNuxtConfig({
85
+ extends: ["ads-nuxt"],
86
+ });
87
+ ```
88
+
89
+ Isso já registra automaticamente:
90
+
91
+ - os módulos `@nuxt/ui`, `@nuxt/fonts`, `@nuxt/icon` e `@vueuse/nuxt`;
92
+ - o CSS global (Tailwind, Nuxt UI, cores e tokens de componente);
93
+ - a fonte **Inter** (pesos 300, 400, 500, 700 e 800);
94
+ - a coleção de ícones **lucide**;
95
+ - o `app.config.ts` com o tema ADS para o Nuxt UI;
96
+ - o plugin de toast e o locale pt-BR.
97
+
98
+ > **Modo de cor:** a layer define `ui.colorMode: false` — o ADS é um sistema de tema claro. Se precisar sobrescrever, redefina no `nuxt.config.ts` do seu projeto.
99
+
100
+ ### Envolva o app com `UApp`
101
+
102
+ O Nuxt UI exige o componente `UApp` para toasts, tooltips e overlays funcionarem:
103
+
104
+ ```vue
105
+ <!-- app/app.vue -->
106
+ <template>
107
+ <UApp :locale="uiLocale" :tooltip="{ delayDuration: 400 }" :toaster="adsToaster">
108
+ <NuxtPage />
109
+ </UApp>
110
+ </template>
111
+
112
+ <script setup lang="ts">
113
+ import { uiLocale } from "ads-nuxt/app/locale/pt-br";
114
+ import { adsToaster } from "ads-nuxt/app/theme/ads-theme";
115
+ </script>
116
+ ```
117
+
118
+ `adsToaster` posiciona os toasts no canto superior direito, sem barra de progresso, no padrão ADS.
119
+
120
+ ## Uso rápido
121
+
122
+ Os componentes são auto-importados, sem `import` manual:
123
+
124
+ ```vue
125
+ <template>
126
+ <AdsCard title="Cadastro">
127
+ <div class="flex flex-col gap-4">
128
+ <AdsInput v-model="nome" label="Nome" placeholder="Digite seu nome" />
129
+ <AdsButton type="filled" label="Salvar" leading icon="i-lucide-save" />
130
+ </div>
131
+ </AdsCard>
132
+ </template>
133
+
134
+ <script setup lang="ts">
135
+ const nome = ref("");
136
+ </script>
137
+ ```
138
+
139
+ ## Componentes
140
+
141
+ ### Ações
142
+
143
+ | Componente | Descrição |
144
+ | ---------------- | --------- |
145
+ | `AdsButton` | Botão (`filled`, `outline`, `unfilled`, `secondary`, `ia`) em 2 tamanhos e 8 cores. Suporta ícones, `loading` e `to` (vira link). |
146
+ | `AdsButtonGroup` | Agrupa botões. |
147
+ | `AdsButtonMenu` | Botão com menu de ações. |
148
+
149
+ ### Formulários
150
+
151
+ | Componente | Descrição |
152
+ | ----------------- | --------- |
153
+ | `AdsInput` | Campo de texto/número com label, hint, erro, info, ícone e sufixo. |
154
+ | `AdsNumberInput` | Campo numérico dedicado. |
155
+ | `AdsTextarea` | Área de texto. |
156
+ | `AdsSearchInput` | Campo de busca. |
157
+ | `AdsCheckbox` | Checkbox com estado indeterminado. |
158
+ | `AdsRadio` | Botão de rádio. |
159
+ | `AdsSwitch` | Alternador (toggle). |
160
+ | `AdsDatePicker` | Seletor de data ou intervalo, com `min`, `max` e `maximumDays`. |
161
+ | `AdsMonthPicker` | Seletor de mês. |
162
+ | `AdsFilterSelect` | Filtro com seleção (checkbox, radio ou mês). |
163
+ | `AdsFilterDropdown` / `AdsFilterOption` | Dropdown de filtros e suas opções. |
164
+
165
+ ### Navegação
166
+
167
+ | Componente | Descrição |
168
+ | ----------------- | --------- |
169
+ | `AdsNavbarDesk` / `AdsNavbarApp` | Barra de navegação desktop e mobile. |
170
+ | `AdsSideMenu` | Menu lateral. |
171
+ | `AdsMenuBar` | Barra de menu. |
172
+ | `AdsTabs` | Abas em formato de link. |
173
+ | `AdsSegmentedTabs`| Abas segmentadas. |
174
+ | `AdsPagination` | Paginação com reticências automáticas (`v-model:page`). |
175
+ | `AdsDropdownMenu` / `AdsListDropdown` | Menus suspensos. |
176
+ | `AdsFooter` | Rodapé. |
177
+
178
+ ### Exibição de dados
179
+
180
+ | Componente | Descrição |
181
+ | ----------------- | --------- |
182
+ | `AdsTable` | Tabela baseada no `UTable`, com densidade, zebra, bordas, degradê por nível, `sticky`, loading e estado vazio. |
183
+ | `AdsTableToolbar` | Barra de ferramentas da tabela. |
184
+ | `AdsCard` | Cartão genérico. |
185
+ | `AdsMetricCard` | Cartão de métrica/indicador. |
186
+ | `AdsFeatureCard` | Cartão de funcionalidade. |
187
+ | `AdsFileCard` | Cartão de arquivo. |
188
+ | `AdsEmptyState` | Estado vazio. |
189
+
190
+ ### Indicadores e status
191
+
192
+ | Componente | Descrição |
193
+ | -------------------- | --------- |
194
+ | `AdsBadge` | Contador ou ponto (`mini`) em 7 cores. |
195
+ | `AdsPill` | Pílula de status (`default`, `success`, `attention`, `warning`, `new`, `blocked`, `innovation`, `neutral`) em tom `primary` ou `secondary`. |
196
+ | `AdsMiniPill` | Versão compacta da pílula. |
197
+ | `AdsNotabilityPill` | Pílula de notabilidade. |
198
+ | `AdsFarmarcasPill` | Pílula de marca Farmarcas. |
199
+ | `AdsProductTag` | Tag de produto. |
200
+
201
+ ### Feedback e overlays
202
+
203
+ | Componente | Descrição |
204
+ | ----------------- | --------- |
205
+ | `AdsModal` | Modal (`dialog` ou `sheet`) com 5 tamanhos, ações padrão e slots. |
206
+ | `AdsToast` | Aviso em faixa (`banner`) ou reporte escuro (`status`). |
207
+ | `AdsBroadcast` | Comunicado em destaque. |
208
+ | `AdsTooltip` | Tooltip. |
209
+ | `AdsSmalltip` / `AdsSteptip` / `AdsCharttip` | Variações de tooltip (compacta, em passos e para gráficos). |
210
+ | `AdsLoading` | Indicador de carregamento. |
211
+ | `ProgressBarLoading` | Barra de progresso. |
212
+ | `OverlayLoading` | Overlay de carregamento/sucesso/erro (usado por `useOverlayLoading`). |
213
+
214
+ ## Exemplos
215
+
216
+ ### Botões
217
+
218
+ ```vue
219
+ <AdsButton type="filled" label="Salvar" />
220
+ <AdsButton type="outline" color="success" label="Aprovar" />
221
+ <AdsButton type="unfilled" size="sm" label="Cancelar" />
222
+ <AdsButton type="ia" label="Gerar com IA" leading icon="i-lucide-sparkles" />
223
+ <AdsButton type="filled" label="Enviando" loading />
224
+ <AdsButton type="filled" label="Ir para o painel" to="/painel" />
225
+ ```
226
+
227
+ | Prop | Valores |
228
+ | ------------ | ------- |
229
+ | `type` | `filled` \| `outline` \| `unfilled` \| `secondary` \| `ia` |
230
+ | `color` | `primary` \| `success` \| `attention` \| `warning` \| `new` \| `innovation` \| `blocked` \| `neutral` |
231
+ | `size` | `md` \| `sm` |
232
+ | `nativeType` | `button` \| `submit` \| `reset` (a prop `type` é o visual do ADS) |
233
+
234
+ ### Campos de formulário
235
+
236
+ ```vue
237
+ <AdsInput
238
+ v-model="preco"
239
+ label="Preço"
240
+ hint="Valor unitário"
241
+ suffix="R$"
242
+ type="number"
243
+ :error="erro"
244
+ />
245
+ ```
246
+
247
+ Estados disponíveis via `state` (útil para documentação): `default`, `active`, `focus`, `error`, `disabled` e `ai`.
248
+
249
+ ### Modal
250
+
251
+ ```vue
252
+ <template>
253
+ <AdsButton label="Excluir" color="warning" @click="aberto = true" />
254
+
255
+ <AdsModal
256
+ v-model:open="aberto"
257
+ title="Excluir item"
258
+ description="Essa ação não pode ser desfeita."
259
+ cancel-label="Cancelar"
260
+ confirm-label="Excluir"
261
+ @confirm="excluir"
262
+ @cancel="aberto = false"
263
+ />
264
+ </template>
265
+
266
+ <script setup lang="ts">
267
+ const aberto = ref(false);
268
+ const excluir = () => {
269
+ /* ... */
270
+ aberto.value = false;
271
+ };
272
+ </script>
273
+ ```
274
+
275
+ Eventos: `confirm`, `cancel` e `dismiss` (com o motivo `"esc"` ou `"outside"`). Slots: `default`, `title` e `footer`.
276
+
277
+ ### Toast
278
+
279
+ Como componente em linha:
280
+
281
+ ```vue
282
+ <AdsToast status="success" title="Tudo certo" message="Alterações salvas." />
283
+ <AdsToast status="error" message="Falha ao salvar." action-label="Tentar novamente" />
284
+ <AdsToast appearance="status" status="neutral" title="Relatório" subtitle="Explicação opcional" />
285
+ ```
286
+
287
+ Como toast flutuante, usando o `useToast` do Nuxt UI (as cores de status e os ícones do ADS são aplicados automaticamente pelo plugin da layer):
288
+
289
+ ```ts
290
+ const toast = useToast();
291
+
292
+ toast.add({
293
+ title: "Salvo",
294
+ description: "Suas alterações foram salvas.",
295
+ color: "success",
296
+ });
297
+ ```
298
+
299
+ ### Pílulas e badges
300
+
301
+ ```vue
302
+ <AdsPill status="success" label="Ativo" />
303
+ <AdsPill status="warning" tone="secondary" label="Atrasado" icon="i-lucide-alert-triangle" />
304
+ <AdsBadge color="primary" :value="5" />
305
+ <AdsBadge color="warning" mini />
306
+ ```
307
+
308
+ ### Paginação e abas
309
+
310
+ ```vue
311
+ <AdsPagination v-model:page="pagina" :total-pages="20" />
312
+
313
+ <AdsTabs v-model="aba" :items="itens" />
314
+ ```
315
+
316
+ ### Tabela
317
+
318
+ ```vue
319
+ <AdsTable
320
+ :data="linhas"
321
+ :columns="colunas"
322
+ density="md"
323
+ striped
324
+ :loading="carregando"
325
+ empty-label="Nenhum resultado encontrado"
326
+ />
327
+ ```
328
+
329
+ Para montar colunas, a layer exporta helpers em `app/utils/ads-table.ts`, como `adsTableColumn`, `adsTablePinned`, `adsTableGroup`, `adsTableVariationClass` e `adsTableTreeIndent`.
330
+
331
+ ### Seletor de datas
332
+
333
+ ```vue
334
+ <!-- Data única -->
335
+ <AdsDatePicker v-model="data" min="2026-01-01" />
336
+
337
+ <!-- Intervalo (máximo de 31 dias) -->
338
+ <AdsDatePicker range v-model:start="inicio" v-model:end="fim" :maximum-days="31" />
339
+ ```
340
+
341
+ As datas trafegam como string `YYYY-MM-DD`.
342
+
343
+ ## Tokens de design
344
+
345
+ Os tokens vêm do Figma do ADS e estão organizados em três camadas:
346
+
347
+ 1. **Primitivos** — valores brutos (escalas de cor, espaçamentos).
348
+ 2. **Semânticos** — intenção de uso (`--ads-surface-*`, `--ads-text-*`, `--ads-border-*`, `--ads-status-*`).
349
+ 3. **De componente** — ajustes finos por componente (`--ads-button-*`, `--ads-modal-*`, `--ads-tooltip-*`…).
350
+
351
+ ### Variáveis CSS
352
+
353
+ ```css
354
+ .meu-card {
355
+ background: var(--ads-surface-main);
356
+ color: var(--ads-text-secondary);
357
+ border-radius: var(--ads-button-radius);
358
+ box-shadow: var(--ads-shadow-level-3);
359
+ }
360
+ ```
361
+
362
+ ### Classes Tailwind
363
+
364
+ As variáveis semânticas também estão mapeadas como cores do Tailwind (`--color-ads-*`):
365
+
366
+ ```html
367
+ <div class="bg-ads-surface-main border-ads-border-width-thin"></div>
368
+ ```
369
+
370
+ ### Escalas de cor
371
+
372
+ | Escala | Uso |
373
+ | ------------------ | --- |
374
+ | `primary` / `secondary` | Azul do Radar Pricing, de 50 a 950 (base `#006ff7`). |
375
+ | `success` | Verde de sucesso (base `#15c57e`). |
376
+ | Neutros | `neutralLight`, `neutralMid` e `neutralDark`. |
377
+ | Status | `success`, `attention`, `warning`, `new`, `innovation`, `blocked`. |
378
+
379
+ ### Espaçamento
380
+
381
+ | Token | px | Token | px | Token | px |
382
+ | ------ | --- | ------ | --- | ------ | --- |
383
+ | quark | 4 | sm | 32 | xxxl | 120 |
384
+ | nano | 8 | rg | 40 | huge | 160 |
385
+ | xxxs | 12 | md | 48 | giant | 200 |
386
+ | xxs | 16 | lg | 56 | | |
387
+ | xs | 24 | xl / xxl | 64 / 80 | | |
388
+
389
+ Os mesmos valores estão disponíveis em TypeScript, em `app/theme/ads-tokens.ts` (`adsSpacing`, `adsRadarPricing`, `adsRadarBase`, `adsNeutralLight`, `adsNeutralMid`, `adsNeutralDark`, `adsSuccess`…).
390
+
391
+ ### Personalizando tokens de componente
392
+
393
+ Os tokens de componente são gerados a partir de `app/theme/component-tokens.json` para `component-tokens.css`. Para ajustar no seu projeto sem editar o pacote, sobrescreva a variável CSS depois do CSS da layer:
394
+
395
+ ```css
396
+ :root {
397
+ --ads-button-radius: 4px;
398
+ --ads-button-primary: #0050b3;
399
+ }
400
+ ```
401
+
402
+ ## Tema do Nuxt UI
403
+
404
+ O `app.config.ts` da layer customiza os seguintes componentes do Nuxt UI para seguir o ADS:
405
+
406
+ `button`, `input`, `inputDate`, `calendar`, `select`, `selectMenu`, `toast`, `toaster` e `tooltip`.
407
+
408
+ Por ser uma layer, você pode estender ou sobrescrever no `app.config.ts` do seu projeto:
409
+
410
+ ```ts
411
+ // app/app.config.ts
412
+ export default defineAppConfig({
413
+ ui: {
414
+ button: {
415
+ slots: {
416
+ base: "rounded-md",
417
+ },
418
+ },
419
+ },
420
+ });
421
+ ```
422
+
423
+ ## Composables
424
+
425
+ ### `useOverlayLoading`
426
+
427
+ Exibe um overlay de tela cheia para carregamento, sucesso, erro, busca ou informação, com barra de progresso opcional.
428
+
429
+ ```ts
430
+ const overlay = useOverlayLoading();
431
+
432
+ overlay.show({
433
+ variant: "loading",
434
+ title: "Processando",
435
+ description: "Isso pode levar alguns segundos.",
436
+ showProgress: true,
437
+ progress: 10,
438
+ });
439
+
440
+ overlay.update({ progress: 60 });
441
+
442
+ overlay.update({ variant: "success", title: "Concluído!" });
443
+
444
+ overlay.close();
445
+ ```
446
+
447
+ | Método | Descrição |
448
+ | ----------------- | --------- |
449
+ | `show(options)` | Abre o overlay (fecha o anterior, se houver) e retorna o id. |
450
+ | `update(options)` | Mescla novas props no overlay aberto. |
451
+ | `close()` | Fecha o overlay. |
452
+ | `isOpen()` | Indica se há overlay aberto. |
453
+ | `getCurrentId()` | Retorna o id do overlay atual. |
454
+
455
+ Opções (`OverlayLoadingOptions`):
456
+
457
+ | Opção | Tipo |
458
+ | ----------------- | ---- |
459
+ | `variant` | `"loading"` \| `"success"` \| `"error"` \| `"search"` \| `"info"` |
460
+ | `title`, `description`, `hint` | `string` |
461
+ | `showProgress`, `progress` | `boolean`, `number` |
462
+ | `iconSrc` | `string` |
463
+ | `actionLabel`, `onAction` | rótulo e callback de ação |
464
+ | `onUserClose` | callback ao usuário fechar |
465
+ | `closableVariants`| `("success" \| "error")[]` — variantes que o usuário pode fechar |
466
+
467
+ ## Utilitários
468
+
469
+ Todos ficam em `app/utils` e são auto-importados pelo Nuxt.
470
+
471
+ | Arquivo | Funções principais |
472
+ | --------------------- | ------------------ |
473
+ | `money.ts` | `numberToBRL`, `numberToCompactBRL`, `parseStringMoneyToFloat`, `formatPriceInput`, `parsePriceInput` |
474
+ | `percentage.ts` | `formatPercentage`, `formatPercentageWithDecimals`, `formatPercentagePtBr` |
475
+ | `parser.ts` | `parseToPercentage`, `parsePercentageToFloat`, `getTodayDateString`, `formatDateOnlyToPtBr`, `formatDateToPtBr`, `daysBetweenDateOnly`, `daysFromTodayToDateOnly`, `normalizePercentage` |
476
+ | `calendar-date.ts` | Conversão entre `string` e `CalendarDate` (`@internationalized/date`) e helpers de intervalo |
477
+ | `notability.ts` | `formatNotability` |
478
+ | `category-role.ts` | `CATEGORY_ROLES`, `formatCategoryRole`, `parseCategoryRole` |
479
+ | `ads-filter-select.ts`| Helpers para `AdsFilterSelect` (agrupamento, seleção, rótulos, meses) |
480
+ | `ads-table.ts` | Helpers e tipos para `AdsTable` |
481
+
482
+ ```ts
483
+ numberToBRL(1234.5); // "R$ 1.234,50"
484
+ numberToBRL(-10); // "R$ -10,00"
485
+ numberToBRL(null); // "-"
486
+ numberToCompactBRL(2_500_000); // valor compacto em milhões
487
+ ```
488
+
489
+ ## Localização (pt-BR)
490
+
491
+ A layer inclui `app/locale/pt-br.ts`, que exporta o locale do Nuxt UI para português do Brasil (calendário, meses e rótulos):
492
+
493
+ ```ts
494
+ import { uiLocale, UI_LOCALE_CODE } from "ads-nuxt/app/locale/pt-br";
495
+ // UI_LOCALE_CODE === "pt-BR"
496
+ ```
497
+
498
+ Passe-o ao `UApp` como mostrado em [Configuração](#configuração).
499
+
500
+ ## Desenvolvimento
501
+
502
+ Este repositório usa **pnpm** e contém um **playground** Nuxt com a documentação interativa dos componentes e dos tokens.
503
+
504
+ ```bash
505
+ git clone https://github.com/jbfarmarcas/alquimia-design-system.git
506
+ cd alquimia-design-system
507
+ pnpm install
508
+
509
+ pnpm dev # playground em http://localhost:3010
510
+ pnpm build # build do playground
511
+ pnpm preview # preview do build
512
+
513
+ pnpm skill:reference # regenera skills/ads-nuxt/reference.md a partir de app/
514
+ pnpm skill:check # falha se o reference.md estiver desatualizado
515
+ ```
516
+
517
+ Páginas do playground:
518
+
519
+ | Rota | Conteúdo |
520
+ | ------------------------- | -------- |
521
+ | `/design-system/instalacao` | Manual de instalação da biblioteca |
522
+ | `/design-system` | Catálogo de componentes com demos e código |
523
+ | `/design-system/tabelas` | Variações de tabela |
524
+ | `/design-system/tokens` | Editor visual dos tokens de componente |
525
+
526
+ ### Docker
527
+
528
+ ```bash
529
+ docker compose up
530
+ ```
531
+
532
+ ### Publicação
533
+
534
+ O pacote publica apenas `app/` e `nuxt.config.ts` (campo `files`), com acesso público:
535
+
536
+ A publicação é feita pelo GitHub Actions (`.github/workflows/publish.yml`), com Trusted Publishing (sem token). Para lançar uma versão:
537
+
538
+ ```bash
539
+ npm version patch --ignore-scripts # ou minor / major: cria o commit e a tag vX.Y.Z
540
+ git push --follow-tags
541
+ ```
542
+
543
+ ## Estrutura do projeto
544
+
545
+ ```
546
+ .
547
+ ├── app/ # Conteúdo publicado no npm (a layer)
548
+ │ ├── app.config.ts # Tema do Nuxt UI
549
+ │ ├── assets/ # CSS, SVGs de marca e animações
550
+ │ ├── components/ # Componentes Ads*
551
+ │ ├── composables/ # useOverlayLoading
552
+ │ ├── constants/ # Constantes (swatches de cor)
553
+ │ ├── locale/ # Locale pt-BR
554
+ │ ├── plugins/ # Plugin de toast
555
+ │ ├── theme/ # Tokens e temas (TS/JSON)
556
+ │ ├── types/ # Tipos compartilhados
557
+ │ └── utils/ # Utilitários de formatação e helpers
558
+ ├── playground/ # App de documentação (não publicado)
559
+ ├── skills/ads-nuxt/ # Skill para agentes de IA (SKILL.md + reference.md gerado)
560
+ ├── scripts/ # generate-skill-reference.mjs (pnpm skill:reference)
561
+ ├── nuxt.config.ts # Entrada da layer
562
+ └── package.json
563
+ ```
564
+
565
+ ## Licença
566
+
567
+ [MIT](./LICENSE) © 2026 Farmarcas
package/app/app.config.ts CHANGED
@@ -1,25 +1,25 @@
1
- import {
2
- adsButtonTheme,
3
- adsCalendarTheme,
4
- adsInputDateTheme,
5
- adsInputTheme,
6
- adsSelectMenuTheme,
7
- adsSelectTheme,
8
- adsToastTheme,
9
- adsToasterTheme,
10
- adsTooltipTheme,
11
- } from "./theme/ads-theme";
12
-
13
- export default defineAppConfig({
14
- ui: {
15
- button: adsButtonTheme,
16
- input: adsInputTheme,
17
- inputDate: adsInputDateTheme,
18
- calendar: adsCalendarTheme,
19
- select: adsSelectTheme,
20
- selectMenu: adsSelectMenuTheme,
21
- toast: adsToastTheme,
22
- toaster: adsToasterTheme,
23
- tooltip: adsTooltipTheme,
24
- },
25
- });
1
+ import {
2
+ adsButtonTheme,
3
+ adsCalendarTheme,
4
+ adsInputDateTheme,
5
+ adsInputTheme,
6
+ adsSelectMenuTheme,
7
+ adsSelectTheme,
8
+ adsToastTheme,
9
+ adsToasterTheme,
10
+ adsTooltipTheme,
11
+ } from "./theme/ads-theme";
12
+
13
+ export default defineAppConfig({
14
+ ui: {
15
+ button: adsButtonTheme,
16
+ input: adsInputTheme,
17
+ inputDate: adsInputDateTheme,
18
+ calendar: adsCalendarTheme,
19
+ select: adsSelectTheme,
20
+ selectMenu: adsSelectMenuTheme,
21
+ toast: adsToastTheme,
22
+ toaster: adsToasterTheme,
23
+ tooltip: adsTooltipTheme,
24
+ },
25
+ });
@@ -1,5 +1,5 @@
1
- <svg preserveAspectRatio="none" overflow="visible" style="display: block;" width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g id="check">
3
- <path id="Vector" d="M10 3L4.5 8.5L2 6" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" stroke="white"/>
4
- </g>
5
- </svg>
1
+ <svg preserveAspectRatio="none" overflow="visible" style="display: block;" width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g id="check">
3
+ <path id="Vector" d="M10 3L4.5 8.5L2 6" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" stroke="white"/>
4
+ </g>
5
+ </svg>
@@ -1,5 +1,5 @@
1
- <svg preserveAspectRatio="none" overflow="visible" style="display: block;" width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g id="minus">
3
- <path id="Vector" d="M2.5 6H9.5" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" stroke="white"/>
4
- </g>
5
- </svg>
1
+ <svg preserveAspectRatio="none" overflow="visible" style="display: block;" width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g id="minus">
3
+ <path id="Vector" d="M2.5 6H9.5" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" stroke="white"/>
4
+ </g>
5
+ </svg>