forlogic-core 2.0.6 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.note/memory/patterns/admin-i18n-policy.md +20 -0
- package/.note/memory/patterns/i18n-architecture.md +3 -0
- package/README.md +34 -269
- package/dist/action-plans/constants.d.ts +23 -3
- package/dist/audit-trail/utils.d.ts +5 -5
- package/dist/auth/components/EditProfileDialog.d.ts +12 -0
- package/dist/auth/contexts/AuthContext.d.ts +1 -1
- package/dist/auth/services/AuthService.d.ts +1 -1
- package/dist/components/dashboards/panels/panel-header.d.ts +1 -1
- package/dist/components/layout/SidebarActionTrigger.d.ts +3 -3
- package/dist/components/modules/ModuleAccessGuard.d.ts +1 -1
- package/dist/components/modules/icons/ModulesCardIcons.d.ts +2 -2
- package/dist/components/ui/color-picker.d.ts +2 -2
- package/dist/components/ui/combo-tree.d.ts +3 -1
- package/dist/components/ui/data-list.d.ts +2 -2
- package/dist/components/ui/dialog-wizard.d.ts +1 -1
- package/dist/components/ui/dialog.d.ts +1 -1
- package/dist/components/ui/disabled-menu-item.d.ts +1 -1
- package/dist/components/ui/empty-state.d.ts +9 -9
- package/dist/components/ui/onboarding-dialog.d.ts +1 -1
- package/dist/components/ui/popover.d.ts +1 -1
- package/dist/components/ui/split-button.d.ts +2 -2
- package/dist/components/ui/terms-of-use-dialog.d.ts +3 -3
- package/dist/config/index.d.ts +1 -1
- package/dist/contexts/PageMetadataContext.d.ts +2 -2
- package/dist/crud/components/CrudTable.d.ts +13 -1
- package/dist/crud/components/FilterBar.d.ts +2 -2
- package/dist/crud/primitives/Table.d.ts +3 -3
- package/dist/crud/primitives/types.d.ts +11 -1
- package/dist/i18n/index.d.ts +1 -10
- package/dist/i18n/utils.d.ts +14 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/leadership/components/LeadershipPage.d.ts +1 -1
- package/dist/media/components/ImageRenderer.d.ts +1 -1
- package/dist/media/components/VideoEditor.d.ts +0 -20
- package/dist/media/components/VideoRenderer.d.ts +0 -6
- package/dist/qualiex/components/QualiexUserField.d.ts +1 -1
- package/dist/types.d.ts +1 -0
- package/docs/WORKSPACE_KNOWLEDGE.md +254 -0
- package/docs/design-system/README.md +1 -1
- package/docs/design-system/patterns/README.md +53 -0
- package/{.note/memory/components/action-button-for-tables.md → docs/design-system/patterns/action-button.md} +1 -2
- package/{.note/memory/components/alertdialog-permanent-deletion.md → docs/design-system/patterns/alertdialog-deletion.md} +1 -2
- package/{.note/memory/components → docs/design-system/patterns}/baseform-custom-fields.md +2 -3
- package/{.note/memory/components → docs/design-system/patterns}/baseform-usage.md +1 -2
- package/{.note/memory/patterns/body-content-scroll-usage.md → docs/design-system/patterns/body-content-scroll.md} +1 -4
- package/{.note/memory/components → docs/design-system/patterns}/combo-tree.md +1 -2
- package/docs/design-system/patterns/components-registry.md +17 -0
- package/docs/design-system/patterns/crud-bulk-actions.md +12 -0
- package/docs/design-system/patterns/crud-config-props.md +16 -0
- package/docs/design-system/patterns/crud-defaults.md +17 -0
- package/{.note/memory/patterns/crud-toolbar-layout.md → docs/design-system/patterns/crud-toolbar.md} +8 -6
- package/{.note/memory/components/delete-confirmation-dialog.md → docs/design-system/patterns/delete-confirmation.md} +1 -9
- package/{.note/memory/patterns/dialog-body-scroll-pattern.md → docs/design-system/patterns/dialog-body-scroll.md} +3 -4
- package/{.note/memory/components/dialog-sizes-and-structure.md → docs/design-system/patterns/dialog-structure.md} +1 -2
- package/{.note/memory/components → docs/design-system/patterns}/dialog-variants.md +5 -8
- package/{.note/memory → docs/design-system}/patterns/feature-flags.md +1 -0
- package/{.note/memory/patterns/header-metadata-pattern.md → docs/design-system/patterns/header-metadata.md} +1 -6
- package/docs/design-system/patterns/i18n-setup.md +117 -0
- package/{.note/memory/components/pagination-usage.md → docs/design-system/patterns/pagination.md} +1 -2
- package/{.note/memory/patterns/single-scroll-pattern.md → docs/design-system/patterns/single-scroll.md} +1 -2
- package/{.note/memory → docs/design-system}/patterns/vite-tailwind-setup.md +1 -2
- package/package.json +1 -1
- package/.note/memory/features/crud-defaults-batteries-included.md +0 -14
- package/.note/memory/features/crud-standardized-config-props.md +0 -3
- package/.note/memory/patterns/components-registry.md +0 -18
- package/.note/memory/patterns/crud-action-bar-3-zone-layout.md +0 -3
- package/.note/memory/patterns/crud-bulk-actions-dropdown-standard.md +0 -3
- package/.note/memory/patterns/i18n-setup.md +0 -43
- package/docs/AUDIT_PROMPT.md +0 -74
- package/docs/KNOWLEDGE.md +0 -109
- package/docs/PROJECT_KNOWLEDGE_TEMPLATE.md +0 -117
- package/docs/PROMPT_TEMPLATE.md +0 -77
- package/docs/STARTER_TEMPLATE.md +0 -114
- /package/{.note/memory/patterns/core-providers-setup.md → docs/design-system/patterns/core-providers.md} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Política de Idioma — Admin, Design System e Lib
|
|
2
|
+
|
|
3
|
+
## Decisão
|
|
4
|
+
|
|
5
|
+
| Camada | Idioma | i18n (useTranslation) |
|
|
6
|
+
|--------|--------|-----------------------|
|
|
7
|
+
| **Projeto Admin (`src/`)** | Português (Brasil) — hardcoded | ❌ Não usa |
|
|
8
|
+
| **Design System (`src/design-system/`)** | Português (Brasil) — hardcoded | ❌ Não usa |
|
|
9
|
+
| **Lib (`lib/`)** | Multi-idioma (pt-BR, en-US, es-ES) | ✅ Usa `t()` + JSONs |
|
|
10
|
+
|
|
11
|
+
## Regras
|
|
12
|
+
|
|
13
|
+
1. **Nenhum arquivo em `src/`** deve importar `useTranslation` ou usar `t()` — todos os textos são strings fixas em português.
|
|
14
|
+
2. **A documentação interativa do Design System** (páginas `*Doc.tsx`, sidebar, home) é escrita diretamente em português, sem chaves de tradução.
|
|
15
|
+
3. **A lib (`lib/`)** mantém o sistema completo de i18n com namespaces, JSONs por idioma e integração com Tolgee, pois é consumida por projetos que precisam de múltiplos idiomas.
|
|
16
|
+
4. **Arquivos de tradução da lib** (`lib/i18n/locales/`) contêm apenas chaves usadas pelos componentes internos da lib.
|
|
17
|
+
|
|
18
|
+
## Contexto
|
|
19
|
+
|
|
20
|
+
O Admin é um painel interno da Forlogic usado exclusivamente em português. Manter i18n no Admin adiciona complexidade sem benefício. A lib, por outro lado, é distribuída para projetos consumidores que operam em múltiplos idiomas.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
# i18n Architecture
|
|
2
|
+
|
|
3
|
+
A internacionalização utiliza namespaces 'core' (lib) e 'app' (consumidor). Traduções do consumidor são modularizadas em arquivos JSON por feature e mescladas via `mergeTranslationFiles`. Usa apenas i18next + JSONs estáticos (sem serviço externo de tradução). É mandatório o uso do hook `useTranslation` da biblioteca, garantindo fallback e suporte a flags de depuração. Os arquivos de tradução da biblioteca (`lib/i18n/locales/`) são restritos exclusivamente a chaves utilizadas por seus componentes internos; chaves órfãs ou termos de domínio de negócio devem ser geridos e traduzidos nos projetos consumidores no namespace 'app'.
|
package/README.md
CHANGED
|
@@ -1,277 +1,63 @@
|
|
|
1
|
-
# forlogic-core
|
|
1
|
+
# forlogic-core
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
> Cole este conteúdo como Custom Knowledge no Lovable ou use como README.md com Claude Code.
|
|
3
|
+
> Biblioteca compartilhada de componentes, hooks, serviços e configuração para projetos Forlogic/Qualiex.
|
|
5
4
|
|
|
6
5
|
---
|
|
7
6
|
|
|
8
|
-
##
|
|
7
|
+
## Schema do Projeto
|
|
9
8
|
|
|
10
|
-
> **
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
| O que procurar | Caminho no Admin |
|
|
15
|
-
|----------------|------------------|
|
|
16
|
-
| Código-fonte dos componentes UI | `lib/components/ui/` |
|
|
17
|
-
| Sistema CRUD | `lib/crud/` |
|
|
18
|
-
| Barrel exports (lista completa) | `lib/exports/ui.ts`, `lib/exports/index.ts` |
|
|
19
|
-
| Documentação MD do Design System | `docs/design-system/` |
|
|
20
|
-
| Docs interativos (código-fonte) | `src/design-system/docs/` |
|
|
21
|
-
| Hooks compartilhados | `lib/hooks/` |
|
|
22
|
-
| Providers (CoreProviders) | `lib/providers/` |
|
|
23
|
-
| Serviços (Base, Email, Error) | `lib/services/` |
|
|
24
|
-
| Config Vite/Tailwind | `lib/vite/`, `lib/tailwind/` |
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## 0. Schema do Projeto
|
|
29
|
-
|
|
30
|
-
> ⚠️ **Substitua `SCHEMA_PADRAO` pelo schema do SEU projeto.**
|
|
9
|
+
> ⚠️ **SCHEMA = `common`**
|
|
10
|
+
>
|
|
11
|
+
> Este é o **único local** onde o schema é definido. Toda query Supabase **DEVE** usar `.schema('common')`.
|
|
31
12
|
|
|
32
13
|
```ts
|
|
33
14
|
// ✅ CORRETO
|
|
34
|
-
supabase.schema('
|
|
15
|
+
supabase.schema('common').from('tabela').select('*');
|
|
35
16
|
|
|
36
|
-
// ❌ ERRADO (vai falhar)
|
|
17
|
+
// ❌ ERRADO (vai falhar em produção)
|
|
37
18
|
supabase.from('tabela').select('*');
|
|
38
19
|
```
|
|
39
20
|
|
|
40
21
|
---
|
|
41
22
|
|
|
42
|
-
##
|
|
43
|
-
|
|
44
|
-
| Regra | Detalhe |
|
|
45
|
-
|-------|---------|
|
|
46
|
-
| Schema obrigatório | `.schema('SCHEMA_PADRAO')` em toda query Supabase |
|
|
47
|
-
| Sem DELETE físico | Soft delete com `deleted_at` + policy `FOR UPDATE` |
|
|
48
|
-
| Sem índices automáticos | Apenas com aprovação explícita + EXPLAIN ANALYZE |
|
|
49
|
-
| Sem modificar `.env` | Apenas com autorização do usuário |
|
|
50
|
-
| Sem hardcoded admin | Nunca localStorage/sessionStorage para roles |
|
|
51
|
-
| Lib-first | Usar `forlogic-core` antes de criar componente |
|
|
52
|
-
| Import do Supabase | Sempre `getSupabaseClient()` de `forlogic-core` |
|
|
53
|
-
| Import de i18n | Sempre `useTranslation` de `forlogic-core`, nunca de `react-i18next` |
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
## 2. RLS — Políticas de Segurança
|
|
58
|
-
|
|
59
|
-
### Sintaxe obrigatória
|
|
60
|
-
|
|
61
|
-
- `SELECT` → `USING` | `INSERT` → `WITH CHECK` | `UPDATE` → `USING` + `WITH CHECK`
|
|
62
|
-
- **Nunca** `FOR DELETE`
|
|
63
|
-
- **Sempre** `(SELECT auth.jwt())` com parênteses (evita re-execução por linha)
|
|
64
|
-
|
|
65
|
-
### Padrão JWT alias (multi-tenancy)
|
|
66
|
-
|
|
67
|
-
```sql
|
|
68
|
-
CREATE POLICY "table_select" ON SCHEMA_PADRAO.tabela
|
|
69
|
-
FOR SELECT USING (
|
|
70
|
-
((SELECT auth.jwt()) ->> 'alias'::text) = alias
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
CREATE POLICY "table_insert" ON SCHEMA_PADRAO.tabela
|
|
74
|
-
FOR INSERT WITH CHECK (
|
|
75
|
-
((SELECT auth.jwt()) ->> 'alias'::text) = alias
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
CREATE POLICY "table_update" ON SCHEMA_PADRAO.tabela
|
|
79
|
-
FOR UPDATE
|
|
80
|
-
USING (((SELECT auth.jwt()) ->> 'alias'::text) = alias)
|
|
81
|
-
WITH CHECK (((SELECT auth.jwt()) ->> 'alias'::text) = alias);
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Soft delete (padrão obrigatório)
|
|
85
|
-
|
|
86
|
-
```sql
|
|
87
|
-
ALTER TABLE SCHEMA_PADRAO.tabela ADD COLUMN deleted_at TIMESTAMP WITH TIME ZONE;
|
|
88
|
-
|
|
89
|
-
CREATE POLICY "table_select" ON SCHEMA_PADRAO.tabela
|
|
90
|
-
FOR SELECT USING (
|
|
91
|
-
deleted_at IS NULL
|
|
92
|
-
AND ((SELECT auth.jwt()) ->> 'alias'::text) = alias
|
|
93
|
-
);
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
## 3. Convenções SQL
|
|
99
|
-
|
|
100
|
-
| Tipo | Padrão | Exemplo |
|
|
101
|
-
|------|--------|---------|
|
|
102
|
-
| FK | `id_<singular>` | `id_process`, `id_user` |
|
|
103
|
-
| Boolean | `is_` / `has_` | `is_active`, `has_access` |
|
|
104
|
-
| Timestamps | `created_at`, `updated_at`, `deleted_at` | — |
|
|
105
|
-
| Tabelas | plural, snake_case | `processes`, `user_roles` |
|
|
106
|
-
|
|
107
|
-
---
|
|
108
|
-
|
|
109
|
-
## 4. Lib-First — forlogic-core
|
|
110
|
-
|
|
111
|
-
> Antes de criar qualquer componente, verificar se já existe em `forlogic-core`.
|
|
112
|
-
|
|
113
|
-
### Import correto
|
|
114
|
-
|
|
115
|
-
```ts
|
|
116
|
-
import {
|
|
117
|
-
Button, Dialog, Input, Combobox, SplitButton, RichTextEditor,
|
|
118
|
-
createCrudPage, CrudTable, CrudActionBar, BaseForm,
|
|
119
|
-
ActionButton, EmptyState, LoadingState, StepSelector,
|
|
120
|
-
cn, formatDatetime, useTranslation
|
|
121
|
-
} from 'forlogic-core';
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### Checklist
|
|
125
|
-
|
|
126
|
-
- [ ] Pesquisei se existe na forlogic-core?
|
|
127
|
-
- [ ] Verifiquei o Design System (`@Admin docs/design-system/`)?
|
|
128
|
-
- [ ] Pode ser alcançado com props/variantes existentes?
|
|
129
|
-
|
|
130
|
-
### Exceções (pode criar localmente)
|
|
131
|
-
|
|
132
|
-
1. Componente específico de negócio (ex: `InvoiceCard`)
|
|
133
|
-
2. Composição de componentes da lib (wrapper Dialog + Form)
|
|
134
|
-
3. Protótipo temporário que será migrado para a lib
|
|
135
|
-
|
|
136
|
-
---
|
|
137
|
-
|
|
138
|
-
## 5. Design System — Categorias
|
|
139
|
-
|
|
140
|
-
> Para ver props e exemplos: `@Admin docs/design-system/<arquivo>.md`
|
|
141
|
-
|
|
142
|
-
| Categoria | Arquivo |
|
|
143
|
-
|-----------|---------|
|
|
144
|
-
| Fundação | `foundation.md` |
|
|
145
|
-
| Botões & Ações | `buttons-actions.md` |
|
|
146
|
-
| Inputs | `inputs.md` |
|
|
147
|
-
| Seletores | `selectors.md` |
|
|
148
|
-
| Data Display | `data-display.md` |
|
|
149
|
-
| Data Grid | `tables-grids.md` |
|
|
150
|
-
| Gráficos & Dashboards | `charts-dashboards.md` |
|
|
151
|
-
| Navegação | `navigation.md` |
|
|
152
|
-
| Dialogs | `dialogs.md` |
|
|
153
|
-
| Notifications & Feedback | `notifications-feedback.md` |
|
|
154
|
-
| Layout | `layout.md` |
|
|
155
|
-
| CRUD | `crud.md` |
|
|
156
|
-
| Plataforma | `platform.md` |
|
|
157
|
-
| Business Components | `domain.md` |
|
|
158
|
-
| Developer Tools | `infra-utils.md` |
|
|
159
|
-
|
|
160
|
-
### Aliases disponíveis
|
|
161
|
-
|
|
162
|
-
| Original | Alias(es) |
|
|
163
|
-
|----------|-----------|
|
|
164
|
-
| Combobox | SelectSearch, MultiSelect, EntitySelect, AutoComplete |
|
|
165
|
-
| ComboTree | TreeSelect |
|
|
166
|
-
| StepSelector | Stepper |
|
|
167
|
-
| ActionButton | ActionMenu, RowActions |
|
|
168
|
-
| TruncatedCell | EllipsisText |
|
|
169
|
-
| CrudPrimitiveTable | DataTable |
|
|
170
|
-
| CrudPrimitivePagination | DataPagination |
|
|
171
|
-
| CrudPrimitiveFilterBar | DataFilterBar |
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
## 6. Padrões CRUD
|
|
176
|
-
|
|
177
|
-
### Toolbar — Layout obrigatório de 3 zonas
|
|
178
|
-
|
|
179
|
-
| Zona | Posição | Conteúdo |
|
|
180
|
-
|------|---------|----------|
|
|
181
|
-
| Esquerda | `justify-start` | Botão "Novo" + Dropdown ações em lote |
|
|
182
|
-
| Centro | `flex-1 max-w-md` | Campo de busca |
|
|
183
|
-
| Direita | `justify-end` | Filtros + Toggle view |
|
|
184
|
-
|
|
185
|
-
### Defaults
|
|
186
|
-
|
|
187
|
-
- Column resize/manager: ativados por padrão
|
|
188
|
-
- Paginação: 25 itens/página
|
|
189
|
-
- Busca: no header (na action bar com `showSearch=true`)
|
|
190
|
-
- Ações de linha: sempre usar `ActionButton` da lib
|
|
191
|
-
|
|
192
|
-
---
|
|
193
|
-
|
|
194
|
-
## 7. Padrões Deprecated
|
|
195
|
-
|
|
196
|
-
| ❌ Não usar | ✅ Usar |
|
|
197
|
-
|------------|--------|
|
|
198
|
-
| `BulkActionBar` separado | Dropdown no `CrudActionBar` |
|
|
199
|
-
| `<MoreHorizontal>` genérico | `ActionButton` |
|
|
200
|
-
| Paginação manual | `CrudPrimitivePagination` |
|
|
201
|
-
| `StatusSelect` | `Combobox` |
|
|
202
|
-
| `DeleteConfirmationDialog` | `Dialog` |
|
|
203
|
-
| `Searchbar` | `Input` com ícone |
|
|
204
|
-
| `public` schema | `.schema('SCHEMA_PADRAO')` |
|
|
205
|
-
|
|
206
|
-
---
|
|
207
|
-
|
|
208
|
-
## 8. Configuração — Vite
|
|
209
|
-
|
|
210
|
-
```ts
|
|
211
|
-
import { createSecurityHeadersPlugin } from 'forlogic-core/vite';
|
|
212
|
-
|
|
213
|
-
export default defineConfig(({ mode }) => ({
|
|
214
|
-
plugins: [
|
|
215
|
-
react(),
|
|
216
|
-
createSecurityHeadersPlugin(mode === 'development', {
|
|
217
|
-
supabaseUrls: ['https://SEU_PROJETO.supabase.co'],
|
|
218
|
-
additionalConnectSrc: ['https://*.qualiex.com'],
|
|
219
|
-
}),
|
|
220
|
-
],
|
|
221
|
-
resolve: { alias: { '@': path.resolve(__dirname, './src') } },
|
|
222
|
-
optimizeDeps: { force: true },
|
|
223
|
-
}));
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
---
|
|
227
|
-
|
|
228
|
-
## 9. Configuração — Tailwind
|
|
23
|
+
## Documentação
|
|
229
24
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
content: [...forlogicContentPaths],
|
|
236
|
-
} satisfies Config;
|
|
237
|
-
```
|
|
25
|
+
| Documento | Caminho | Conteúdo |
|
|
26
|
+
|-----------|---------|----------|
|
|
27
|
+
| **Constituição** | [`spec/constitution.md`](spec/constitution.md) | Regras, convenções e melhores práticas obrigatórias |
|
|
28
|
+
| **Design System** | `docs/design-system/` | Documentação de componentes, props e exemplos |
|
|
29
|
+
| **Design System (visual)** | Rota `/ds` no app | Documentação interativa |
|
|
238
30
|
|
|
239
31
|
---
|
|
240
32
|
|
|
241
|
-
##
|
|
33
|
+
## Cross-Project: Projeto Admin (DS + Lib)
|
|
242
34
|
|
|
243
|
-
|
|
244
|
-
import { CoreProviders } from 'forlogic-core';
|
|
245
|
-
import ptBR from './i18n/pt-BR.json';
|
|
35
|
+
> Para consultar componentes, props, tipos, exemplos e implementação: use cross-project (`@Admin`).
|
|
246
36
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
|
263
|
-
|----------|-----------|
|
|
264
|
-
| `VITE_SHOW_USER_PREFERENCES` | Preferências no menu do usuário |
|
|
265
|
-
| `VITE_I18N_DEBUG_MODE` | Debug de i18n (mostra chaves) |
|
|
266
|
-
| `VITE_IS_QUALIEX` | Logos Qualiex vs Forlogic |
|
|
37
|
+
| O que procurar | Caminho no Admin |
|
|
38
|
+
|----------------|------------------|
|
|
39
|
+
| Código-fonte dos componentes UI | `lib/components/ui/` |
|
|
40
|
+
| Sistema CRUD | `lib/crud/` |
|
|
41
|
+
| Barrel exports (lista completa) | `lib/exports/ui.ts`, `lib/exports/index.ts` |
|
|
42
|
+
| Documentação MD do Design System | `docs/design-system/` |
|
|
43
|
+
| Docs interativos (código-fonte) | `src/design-system/docs/` |
|
|
44
|
+
| Hooks compartilhados | `lib/hooks/` |
|
|
45
|
+
| Providers (CoreProviders) | `lib/providers/` |
|
|
46
|
+
| Serviços (Base, Email, Error) | `lib/services/` |
|
|
47
|
+
| Config Vite/Tailwind | `lib/vite/`, `lib/tailwind/` |
|
|
48
|
+
| Prompt template | `docs/PROMPT_TEMPLATE.md` |
|
|
49
|
+
| Project Knowledge template | `docs/PROJECT_KNOWLEDGE_TEMPLATE.md` |
|
|
50
|
+
| Starter template | `docs/STARTER_TEMPLATE.md` |
|
|
51
|
+
| Prompt de auditoria | `docs/AUDIT_PROMPT.md` |
|
|
52
|
+
| Golden snippets | `docs/design-system/examples.md` |
|
|
267
53
|
|
|
268
54
|
---
|
|
269
55
|
|
|
270
|
-
##
|
|
56
|
+
## Instrução para IA
|
|
271
57
|
|
|
272
58
|
**QUANDO** criar ou modificar qualquer arquivo `.tsx` com JSX:
|
|
273
59
|
|
|
274
|
-
- **SE** contém tabela, listagem ou CRUD → **LER** `@Admin docs/design-system/crud.md` e `@Admin docs/design-system/tables-grids.md` ANTES
|
|
60
|
+
- **SE** contém tabela, listagem ou CRUD → **LER** `@Admin docs/design-system/crud.md` e `@Admin docs/design-system/tables-grids.md` ANTES
|
|
275
61
|
- **SE** contém formulário, input ou campo → **LER** `@Admin docs/design-system/inputs.md` e `@Admin docs/design-system/selectors.md` ANTES
|
|
276
62
|
- **SE** contém modal ou confirmação → **LER** `@Admin docs/design-system/dialogs.md` ANTES
|
|
277
63
|
- **SE** contém botões ou ações de linha → **LER** `@Admin docs/design-system/buttons-actions.md` ANTES
|
|
@@ -279,25 +65,4 @@ function App() {
|
|
|
279
65
|
|
|
280
66
|
**SEMPRE** consultar `@Admin docs/design-system/examples.md` como referência de implementação.
|
|
281
67
|
|
|
282
|
-
**PROIBIDO** gerar JSX sem ter lido a documentação aplicável acima.
|
|
283
|
-
|
|
284
68
|
**VALIDAÇÃO pós-geração**: Todo import de componente visual DEVE vir de `forlogic-core`. Se criou componente local que existe na lib, refatore imediatamente.
|
|
285
|
-
|
|
286
|
-
---
|
|
287
|
-
|
|
288
|
-
## 13. Fontes de Contexto (Cross-Project)
|
|
289
|
-
|
|
290
|
-
| O que | Onde buscar via `@Admin` |
|
|
291
|
-
|-------|--------------------------|
|
|
292
|
-
| Props e tipos de componentes | `lib/components/ui/<componente>.tsx` |
|
|
293
|
-
| Implementação CRUD | `lib/crud/` |
|
|
294
|
-
| Documentação MD (para IA) | `docs/design-system/*.md` |
|
|
295
|
-
| Exemplos interativos (código) | `src/design-system/docs/*Doc.tsx` |
|
|
296
|
-
| Design System visual | Rota `/ds` no app Admin |
|
|
297
|
-
| Hooks compartilhados | `lib/hooks/` |
|
|
298
|
-
| Configuração de exports | `lib/exports/` |
|
|
299
|
-
| Prompt template | `docs/PROMPT_TEMPLATE.md` |
|
|
300
|
-
| Project Knowledge template | `docs/PROJECT_KNOWLEDGE_TEMPLATE.md` |
|
|
301
|
-
| Starter template | `docs/STARTER_TEMPLATE.md` |
|
|
302
|
-
| Prompt de auditoria | `docs/AUDIT_PROMPT.md` |
|
|
303
|
-
| Golden snippets | `docs/design-system/examples.md` |
|
|
@@ -14,18 +14,38 @@ export declare const STATUS_TEXT_COLORS: Record<ETaskPlanStatus, string>;
|
|
|
14
14
|
*/
|
|
15
15
|
export declare const STATUS_MAP: Record<ETaskPlanStatus, string>;
|
|
16
16
|
/**
|
|
17
|
-
* Labels
|
|
17
|
+
* Labels para status (i18n)
|
|
18
|
+
* Retorna um objeto traduzido — deve ser chamado em tempo de renderização.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getStatusLabels(): Record<ETaskPlanStatus, string>;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Use getStatusLabels() instead
|
|
18
23
|
*/
|
|
19
24
|
export declare const STATUS_LABELS: Record<ETaskPlanStatus, string>;
|
|
20
25
|
/**
|
|
21
|
-
* Tipos de ação
|
|
26
|
+
* Tipos de ação (i18n)
|
|
27
|
+
*/
|
|
28
|
+
export declare function getActionTypes(): {
|
|
29
|
+
id: string;
|
|
30
|
+
label: string;
|
|
31
|
+
}[];
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use getActionTypes() instead
|
|
22
34
|
*/
|
|
23
35
|
export declare const DEFAULT_ACTION_TYPES: {
|
|
24
36
|
id: string;
|
|
25
37
|
label: string;
|
|
26
38
|
}[];
|
|
27
39
|
/**
|
|
28
|
-
* Prioridades
|
|
40
|
+
* Prioridades (i18n)
|
|
41
|
+
*/
|
|
42
|
+
export declare function getPriorities(): {
|
|
43
|
+
id: ETaskPlanPriority;
|
|
44
|
+
label: string;
|
|
45
|
+
color: string;
|
|
46
|
+
}[];
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated Use getPriorities() instead
|
|
29
49
|
*/
|
|
30
50
|
export declare const PRIORITIES: {
|
|
31
51
|
id: ETaskPlanPriority;
|
|
@@ -18,18 +18,18 @@ export declare function camelToDash(str: string): string;
|
|
|
18
18
|
declare const DEFAULT_LABELS: {
|
|
19
19
|
readonly event: "Evento";
|
|
20
20
|
readonly entityName: "Item";
|
|
21
|
-
readonly description:
|
|
21
|
+
readonly description: string;
|
|
22
22
|
readonly justification: "Justificativa";
|
|
23
23
|
readonly status: "Status";
|
|
24
24
|
readonly type: "Tipo";
|
|
25
|
-
readonly references:
|
|
26
|
-
readonly security:
|
|
27
|
-
readonly electronicSigned:
|
|
25
|
+
readonly references: string;
|
|
26
|
+
readonly security: string;
|
|
27
|
+
readonly electronicSigned: string;
|
|
28
28
|
readonly accomplishedBy: "Realizado por";
|
|
29
29
|
readonly accomplishedIn: "Realizado em";
|
|
30
30
|
readonly changedFrom: "de";
|
|
31
31
|
readonly changedTo: "para";
|
|
32
|
-
readonly uninformed:
|
|
32
|
+
readonly uninformed: string;
|
|
33
33
|
readonly stateAdded: "(adicionado)";
|
|
34
34
|
readonly stateModified: "(modificado)";
|
|
35
35
|
readonly stateRemoved: "(removido)";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface EditProfileDialogProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onOpenChange: (open: boolean) => void;
|
|
5
|
+
user: {
|
|
6
|
+
name?: string | null;
|
|
7
|
+
};
|
|
8
|
+
userPhotoUrl: string | null;
|
|
9
|
+
userInitials: string;
|
|
10
|
+
}
|
|
11
|
+
declare const EditProfileDialog: React.FC<EditProfileDialogProps>;
|
|
12
|
+
export default EditProfileDialog;
|
|
@@ -37,7 +37,7 @@ export declare const AuthProvider: React.FC<{
|
|
|
37
37
|
* } = useAuth();
|
|
38
38
|
*
|
|
39
39
|
* if (isLoading) return <div>Carregando...</div>;
|
|
40
|
-
* if (!isAuthenticated) return <div>
|
|
40
|
+
* if (!isAuthenticated) return <div>{t('not_authenticated')}</div>;
|
|
41
41
|
*
|
|
42
42
|
* return (
|
|
43
43
|
* <div>
|
|
@@ -7,7 +7,7 @@ export interface PanelHeaderProps {
|
|
|
7
7
|
/** Extra content to render in a specific slot */
|
|
8
8
|
complement?: ReactNode;
|
|
9
9
|
complementPosition?: 'before-title' | 'after-title' | 'before-options' | 'after-options';
|
|
10
|
-
/** URL builder for the
|
|
10
|
+
/** URL builder for the t('dashboard_open_query') link */
|
|
11
11
|
queryUrlBuilder?: (config: PanelConfig) => string;
|
|
12
12
|
onRefresh?: () => void;
|
|
13
13
|
onExport?: () => void;
|
|
@@ -23,7 +23,7 @@ export interface SidebarActionTriggerProps {
|
|
|
23
23
|
* config={{
|
|
24
24
|
* triggerLabel: 'Criar',
|
|
25
25
|
* actions: [
|
|
26
|
-
* { id: 'new-item', label: '
|
|
26
|
+
* { id: 'new-item', label: t('new_item'), onClick: () => openDialog() }
|
|
27
27
|
* ]
|
|
28
28
|
* }}
|
|
29
29
|
* isCollapsed={!open}
|
|
@@ -34,8 +34,8 @@ export interface SidebarActionTriggerProps {
|
|
|
34
34
|
* config={{
|
|
35
35
|
* variant: 'split-button',
|
|
36
36
|
* actions: [
|
|
37
|
-
* { id: 'new-doc', label: '
|
|
38
|
-
* { id: 'new-folder', label: '
|
|
37
|
+
* { id: 'new-doc', label: t('new_document'), icon: FilePlus, onClick: handleNewDoc },
|
|
38
|
+
* { id: 'new-folder', label: t('new_folder'), icon: FolderPlus, onClick: handleNewFolder },
|
|
39
39
|
* ]
|
|
40
40
|
* }}
|
|
41
41
|
* isCollapsed={!open}
|
|
@@ -30,7 +30,7 @@ export interface ModuleAccessGuardProps {
|
|
|
30
30
|
* ```tsx
|
|
31
31
|
* // src/config/accessDeniedRoutes.tsx
|
|
32
32
|
* export const accessDeniedRoutes = {
|
|
33
|
-
* '/docs/matrix-link': <ModuleOfferContent title=
|
|
33
|
+
* '/docs/matrix-link': <ModuleOfferContent title={t('know_staff')} ... />,
|
|
34
34
|
* '/reports/*': <ModuleOfferContent title="Relatórios" ... />,
|
|
35
35
|
* };
|
|
36
36
|
* ```
|
|
@@ -3,12 +3,12 @@ interface IconProps {
|
|
|
3
3
|
}
|
|
4
4
|
/**
|
|
5
5
|
* Ícone outline do Qualiex para marca d'água
|
|
6
|
-
* Usado no card
|
|
6
|
+
* Usado no card t('learn_qualiex')
|
|
7
7
|
*/
|
|
8
8
|
export declare function QualiexOutlineIcon({ className }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
/**
|
|
10
10
|
* Ícone outline do Saber Gestão para marca d'água
|
|
11
|
-
* Usado no card
|
|
11
|
+
* Usado no card t('know_saber_gestao')
|
|
12
12
|
*/
|
|
13
13
|
export declare function SaberGestaoOutlineIcon({ className }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
/**
|
|
@@ -3,9 +3,9 @@ interface ColorPickerProps {
|
|
|
3
3
|
value?: string;
|
|
4
4
|
onChange?: (color: string) => void;
|
|
5
5
|
label?: string;
|
|
6
|
-
/** i18n: Label for custom color input (default:
|
|
6
|
+
/** i18n: Label for custom color input (default: t('custom_color')) */
|
|
7
7
|
customColorLabel?: string;
|
|
8
|
-
/** i18n: Label for preset colors section (default:
|
|
8
|
+
/** i18n: Label for preset colors section (default: t('preset_colors')) */
|
|
9
9
|
presetColorsLabel?: string;
|
|
10
10
|
}
|
|
11
11
|
export declare const ColorPicker: React.FC<ColorPickerProps>;
|
|
@@ -72,5 +72,7 @@ export interface ComboTreeProps {
|
|
|
72
72
|
popoverContainer?: HTMLElement | null;
|
|
73
73
|
onOpen?: () => void;
|
|
74
74
|
onClose?: () => void;
|
|
75
|
+
/** Whether parent nodes start expanded. Defaults to true. */
|
|
76
|
+
defaultExpanded?: boolean;
|
|
75
77
|
}
|
|
76
|
-
export declare function ComboTree({ multiple, options, value, onChange, placeholder, label, icon: Icon, emptyMessage, searchPlaceholder, disabled, required, isLoading, error, className, maxDisplayedBadges, popoverContainer, onOpen, onClose, }: ComboTreeProps): import("react/jsx-runtime").JSX.Element;
|
|
78
|
+
export declare function ComboTree({ multiple, options, value, onChange, placeholder, label, icon: Icon, emptyMessage, searchPlaceholder, disabled, required, isLoading, error, className, maxDisplayedBadges, popoverContainer, onOpen, onClose, defaultExpanded, }: ComboTreeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -56,12 +56,12 @@ declare function DataListField({ label, value, className }: DataListFieldProps):
|
|
|
56
56
|
* ```tsx
|
|
57
57
|
* <DataList.Root>
|
|
58
58
|
* <DataList.Item onClick={() => console.log('clicked')}>
|
|
59
|
-
* <DataList.Field label=
|
|
59
|
+
* <DataList.Field label=t('ap_name') value="João Silva" />
|
|
60
60
|
* <DataList.Field label="Email" value="joao@exemplo.com" />
|
|
61
61
|
* <DataList.Field label="Status" value={<Badge>Ativo</Badge>} />
|
|
62
62
|
* </DataList.Item>
|
|
63
63
|
* <DataList.Item>
|
|
64
|
-
* <DataList.Field label=
|
|
64
|
+
* <DataList.Field label=t('ap_name') value="Maria Santos" />
|
|
65
65
|
* <DataList.Field label="Email" value="maria@exemplo.com" />
|
|
66
66
|
* </DataList.Item>
|
|
67
67
|
* </DataList.Root>
|
|
@@ -15,7 +15,7 @@ import { type DialogVariant, type DialogSize } from './dialog';
|
|
|
15
15
|
* currentStep={step}
|
|
16
16
|
* onStepChange={setStep}
|
|
17
17
|
* steps={['Geral', 'Formulário', 'Configuração']}
|
|
18
|
-
* title=
|
|
18
|
+
* title={t('new_document')}
|
|
19
19
|
* onSave={handleSave}
|
|
20
20
|
* >
|
|
21
21
|
* {step === 1 && <StepOneContent />}
|
|
@@ -17,7 +17,7 @@ interface DialogContentProps extends React.ComponentPropsWithoutRef<typeof Dialo
|
|
|
17
17
|
customHeight?: string;
|
|
18
18
|
customMinHeight?: string;
|
|
19
19
|
customMaxHeight?: string;
|
|
20
|
-
/** i18n: Title for unsaved changes alert (default:
|
|
20
|
+
/** i18n: Title for unsaved changes alert (default: t('unsaved_changes')) */
|
|
21
21
|
unsavedChangesTitle?: string;
|
|
22
22
|
/** i18n: Description for unsaved changes alert */
|
|
23
23
|
unsavedChangesDescription?: string;
|
|
@@ -15,7 +15,7 @@ interface DisabledMenuItemProps {
|
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
17
|
* ```tsx
|
|
18
|
-
* <DisabledMenuItem disabledReason=
|
|
18
|
+
* <DisabledMenuItem disabledReason=t('select_at_least_one_item')>
|
|
19
19
|
* <Download className="mr-2 h-4 w-4" />
|
|
20
20
|
* Exportar Selecionados
|
|
21
21
|
* </DisabledMenuItem>
|
|
@@ -31,10 +31,10 @@ interface EmptyStateProps {
|
|
|
31
31
|
* ```tsx
|
|
32
32
|
* // Estado vazio padrão
|
|
33
33
|
* <EmptyState
|
|
34
|
-
* title=
|
|
35
|
-
* description=
|
|
34
|
+
* title={t('no_items_found_empty')}
|
|
35
|
+
* description=t('add_first_item')
|
|
36
36
|
* action={{
|
|
37
|
-
* label:
|
|
37
|
+
* label: t('add_item'),
|
|
38
38
|
* onClick: () => handleAddItem()
|
|
39
39
|
* }}
|
|
40
40
|
* />
|
|
@@ -42,17 +42,17 @@ interface EmptyStateProps {
|
|
|
42
42
|
* // Sem resultados de busca
|
|
43
43
|
* <EmptyState
|
|
44
44
|
* variant="search"
|
|
45
|
-
* title=
|
|
46
|
-
* description=
|
|
45
|
+
* title={t('no_results')}
|
|
46
|
+
* description=t('try_adjust_search')
|
|
47
47
|
* />
|
|
48
48
|
*
|
|
49
49
|
* // Estado de erro
|
|
50
50
|
* <EmptyState
|
|
51
51
|
* variant="error"
|
|
52
|
-
* title=
|
|
53
|
-
* description=
|
|
52
|
+
* title={t('error_loading_data')}
|
|
53
|
+
* description=t('could_not_load_info')
|
|
54
54
|
* action={{
|
|
55
|
-
* label:
|
|
55
|
+
* label: t('try_again'),
|
|
56
56
|
* onClick: () => refetch()
|
|
57
57
|
* }}
|
|
58
58
|
* />
|
|
@@ -60,7 +60,7 @@ interface EmptyStateProps {
|
|
|
60
60
|
* // Ícone customizado
|
|
61
61
|
* <EmptyState
|
|
62
62
|
* icon={<Package className="h-8 w-8" />}
|
|
63
|
-
* title=
|
|
63
|
+
* title={t('no_products')}
|
|
64
64
|
* />
|
|
65
65
|
* ```
|
|
66
66
|
*
|
|
@@ -26,7 +26,7 @@ export interface OnboardingDialogProps {
|
|
|
26
26
|
backButtonText?: string;
|
|
27
27
|
/** Texto do botão finalizar (default: "Concluir") */
|
|
28
28
|
finishButtonText?: string;
|
|
29
|
-
/** Texto do label de etapa (default:
|
|
29
|
+
/** Texto do label de etapa (default: t('approval_step_label')) */
|
|
30
30
|
stepLabel?: string;
|
|
31
31
|
/** Tamanho do dialog */
|
|
32
32
|
size?: "sm" | "md" | "lg";
|
|
@@ -9,7 +9,7 @@ import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
|
9
9
|
* ```tsx
|
|
10
10
|
* <Popover>
|
|
11
11
|
* <PopoverTrigger asChild>
|
|
12
|
-
* <Button variant="outline">
|
|
12
|
+
* <Button variant="outline">{t('open_popover')}</Button>
|
|
13
13
|
* </PopoverTrigger>
|
|
14
14
|
* <PopoverContent>
|
|
15
15
|
* <div className="space-y-2">
|