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
|
@@ -13,7 +13,7 @@ export interface LeadershipPageProps {
|
|
|
13
13
|
columns?: TreeTableColumn<LeaderNode>[];
|
|
14
14
|
/** Header da coluna de nome (default: "Líder") */
|
|
15
15
|
nameHeader?: string;
|
|
16
|
-
/** Texto da zona de drop raiz (default:
|
|
16
|
+
/** Texto da zona de drop raiz (default: t('leadership_make_root')) */
|
|
17
17
|
rootDropLabel?: string;
|
|
18
18
|
}
|
|
19
19
|
export declare function LeadershipPage({ unassociatedUsers, onAssociateUser, onMoveNode: customMoveNode, onMoveNodes: customMoveNodes, columns: customColumns, nameHeader, rootDropLabel, }?: LeadershipPageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,22 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Video Editor Component
|
|
3
|
-
*
|
|
4
|
-
* Editor genérico de vídeo para forlogic-core.
|
|
5
|
-
* Suporta URL, upload e código embed.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```tsx
|
|
9
|
-
* import { VideoEditor } from 'forlogic-core';
|
|
10
|
-
*
|
|
11
|
-
* <VideoEditor
|
|
12
|
-
* value={videoData}
|
|
13
|
-
* onChange={setVideoData}
|
|
14
|
-
* onSubmit={handleSave}
|
|
15
|
-
* onCancel={handleCancel}
|
|
16
|
-
* uploadFunction={myUploadFunction}
|
|
17
|
-
* uploadOptions={{ bucket: 'videos', folder: 'content' }}
|
|
18
|
-
* />
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
1
|
import type { MediaEditorProps, VideoBlockContent } from '../types';
|
|
22
2
|
export declare function VideoEditor({ value, onChange, onSubmit, onCancel, uploadFunction, deleteFunction, uploadOptions }: MediaEditorProps<VideoBlockContent>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Video Renderer Component
|
|
3
|
-
*
|
|
4
|
-
* Renderizador genérico de vídeo para forlogic-core.
|
|
5
|
-
* Suporta YouTube, Vimeo e arquivos diretos.
|
|
6
|
-
*/
|
|
7
1
|
import type { MediaRendererProps, VideoBlockContent } from '../types';
|
|
8
2
|
export declare function VideoRenderer({ content, className, style }: MediaRendererProps<VideoBlockContent>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -52,7 +52,7 @@ export type QualiexUserDisplayFormat = 'name' | 'name-email' | 'name-role' | 'cu
|
|
|
52
52
|
* // Display customizado
|
|
53
53
|
* <QualiexUserField
|
|
54
54
|
* displayFormat="custom"
|
|
55
|
-
* customDisplayFn={(user) => `${user.userName} - ${user.placeName || '
|
|
55
|
+
* customDisplayFn={(user) => `${user.userName} - ${user.placeName || t('no_place_selected')}`}
|
|
56
56
|
* value={userId}
|
|
57
57
|
* onChange={setUserId}
|
|
58
58
|
* />
|
package/dist/types.d.ts
CHANGED
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
# forlogic-core — Workspace Knowledge
|
|
2
|
+
|
|
3
|
+
> **Documento de referência** para todos os projetos que consomem `forlogic-core`.
|
|
4
|
+
> Cole este conteúdo como **Workspace Knowledge** no Lovable.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 🔗 Cross-Project: Projeto Admin (DS + Lib)
|
|
9
|
+
|
|
10
|
+
> **Para consultar componentes, props, tipos, exemplos e implementação**: use cross-project (`@Admin`) para ler arquivos do projeto **"Admin"** (`qualiex-admin`).
|
|
11
|
+
|
|
12
|
+
### Caminhos úteis no projeto Admin
|
|
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
|
+
| Constituição (regras canônicas) | `spec/constitution.md` |
|
|
26
|
+
| Prompt template | `docs/PROMPT_TEMPLATE.md` |
|
|
27
|
+
| Project Knowledge template | `docs/PROJECT_KNOWLEDGE_TEMPLATE.md` |
|
|
28
|
+
| Starter template | `docs/STARTER_TEMPLATE.md` |
|
|
29
|
+
| Golden snippets | `docs/design-system/examples.md` |
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 0. Schema do Projeto
|
|
34
|
+
|
|
35
|
+
> ⚠️ **O schema é definido no `README.md` de cada projeto.** Consulte-o antes de qualquer query.
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
// ✅ CORRETO — substituir pelo schema do projeto (ex: 'common', 'docs', etc.)
|
|
39
|
+
supabase.schema('SCHEMA_DO_PROJETO').from('tabela').select('*');
|
|
40
|
+
|
|
41
|
+
// ❌ ERRADO (vai falhar em produção)
|
|
42
|
+
supabase.from('tabela').select('*');
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
> Nunca usar o schema `public`. Cada projeto tem seu próprio schema documentado no `README.md`.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 1. Constituição — Regras Canônicas
|
|
50
|
+
|
|
51
|
+
> 📖 **Todas as regras, convenções e melhores práticas estão em `spec/constitution.md`** no projeto Admin.
|
|
52
|
+
|
|
53
|
+
Antes de implementar qualquer funcionalidade, consulte a constituição via cross-project:
|
|
54
|
+
```
|
|
55
|
+
@Admin spec/constitution.md
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Resumo das regras invioláveis
|
|
59
|
+
|
|
60
|
+
| Regra | Detalhe |
|
|
61
|
+
|-------|---------|
|
|
62
|
+
| Schema obrigatório | `.schema('...')` em toda query Supabase (schema do `README.md`) |
|
|
63
|
+
| Sem DELETE físico | Soft delete com `deleted_at` + policy `FOR UPDATE` |
|
|
64
|
+
| Sem índices automáticos | Apenas com aprovação explícita + `EXPLAIN ANALYZE` |
|
|
65
|
+
| Sem modificar `.env` | Apenas com autorização do usuário |
|
|
66
|
+
| Sem hardcoded admin | Nunca localStorage/sessionStorage para roles |
|
|
67
|
+
| Lib-first | Usar `forlogic-core` antes de criar componente |
|
|
68
|
+
| Import do Supabase | Sempre `getSupabaseClient()` de `forlogic-core` |
|
|
69
|
+
| Import de i18n | Sempre `useTranslation` de `forlogic-core`, nunca de `react-i18next` |
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 2. Lib-First — forlogic-core
|
|
74
|
+
|
|
75
|
+
> Antes de criar qualquer componente, **verificar se já existe em `forlogic-core`**.
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
// ✅ CORRETO
|
|
79
|
+
import { Button, Dialog, Input, Combobox, ActionButton, useTranslation } from 'forlogic-core';
|
|
80
|
+
|
|
81
|
+
// ❌ PROIBIDO — criar componente local que já existe na lib
|
|
82
|
+
import { MyCustomButton } from '@/components/MyCustomButton';
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Checklist
|
|
86
|
+
|
|
87
|
+
- [ ] Pesquisei se existe na forlogic-core?
|
|
88
|
+
- [ ] Verifiquei o Design System (`@Admin docs/design-system/`)?
|
|
89
|
+
- [ ] Pode ser alcançado com props/variantes existentes?
|
|
90
|
+
|
|
91
|
+
### Exceções permitidas
|
|
92
|
+
|
|
93
|
+
1. Componente específico de domínio de negócio (ex: `InvoiceCard`)
|
|
94
|
+
2. Composição de componentes da lib (wrapper Dialog + Form)
|
|
95
|
+
3. Protótipo temporário que será migrado para a lib
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## 3. Design System — Categorias
|
|
100
|
+
|
|
101
|
+
> Para ver props e exemplos: `@Admin docs/design-system/<arquivo>.md`
|
|
102
|
+
|
|
103
|
+
| Categoria | Arquivo |
|
|
104
|
+
|-----------|---------|
|
|
105
|
+
| Fundação | `foundation.md` |
|
|
106
|
+
| Botões & Ações | `buttons-actions.md` |
|
|
107
|
+
| Inputs | `inputs.md` |
|
|
108
|
+
| Seletores | `selectors.md` |
|
|
109
|
+
| Data Display | `data-display.md` |
|
|
110
|
+
| Data Grid | `tables-grids.md` |
|
|
111
|
+
| Gráficos & Dashboards | `charts-dashboards.md` |
|
|
112
|
+
| Navegação | `navigation.md` |
|
|
113
|
+
| Dialogs | `dialogs.md` |
|
|
114
|
+
| Notifications & Feedback | `notifications-feedback.md` |
|
|
115
|
+
| Layout | `layout.md` |
|
|
116
|
+
| CRUD | `crud.md` |
|
|
117
|
+
| Plataforma | `platform.md` |
|
|
118
|
+
| Business Components | `domain.md` |
|
|
119
|
+
| Developer Tools | `infra-utils.md` |
|
|
120
|
+
|
|
121
|
+
### Aliases disponíveis
|
|
122
|
+
|
|
123
|
+
| Original | Alias(es) |
|
|
124
|
+
|----------|-----------|
|
|
125
|
+
| Combobox | SelectSearch, MultiSelect, EntitySelect, AutoComplete |
|
|
126
|
+
| ComboTree | TreeSelect |
|
|
127
|
+
| StepSelector | Stepper |
|
|
128
|
+
| ActionButton | ActionMenu, RowActions |
|
|
129
|
+
| TruncatedCell | EllipsisText |
|
|
130
|
+
| CrudPrimitiveTable | DataTable |
|
|
131
|
+
| CrudPrimitivePagination | DataPagination |
|
|
132
|
+
| CrudPrimitiveFilterBar | DataFilterBar |
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 4. Instrução para IA — Leitura Obrigatória
|
|
137
|
+
|
|
138
|
+
**QUANDO** criar ou modificar qualquer arquivo `.tsx` com JSX:
|
|
139
|
+
|
|
140
|
+
- **SE** contém tabela, listagem ou CRUD → **LER** `@Admin docs/design-system/crud.md` e `@Admin docs/design-system/tables-grids.md` ANTES
|
|
141
|
+
- **SE** contém formulário, input ou campo → **LER** `@Admin docs/design-system/inputs.md` e `@Admin docs/design-system/selectors.md` ANTES
|
|
142
|
+
- **SE** contém modal ou confirmação → **LER** `@Admin docs/design-system/dialogs.md` ANTES
|
|
143
|
+
- **SE** contém botões ou ações de linha → **LER** `@Admin docs/design-system/buttons-actions.md` ANTES
|
|
144
|
+
- **SE** é estrutura de página/layout → **LER** `@Admin docs/design-system/layout.md` ANTES
|
|
145
|
+
|
|
146
|
+
**SEMPRE** consultar `@Admin docs/design-system/examples.md` como referência de implementação.
|
|
147
|
+
|
|
148
|
+
**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.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 5. Padrões CRUD
|
|
153
|
+
|
|
154
|
+
### Toolbar — Layout obrigatório de 3 zonas
|
|
155
|
+
|
|
156
|
+
| Zona | Posição | Conteúdo |
|
|
157
|
+
|------|---------|----------|
|
|
158
|
+
| Esquerda | `justify-start` | Botão "Novo" + Dropdown ações em lote |
|
|
159
|
+
| Centro | `flex-1 max-w-md` | Campo de busca |
|
|
160
|
+
| Direita | `justify-end` | Filtros + Toggle view |
|
|
161
|
+
|
|
162
|
+
### Defaults obrigatórios
|
|
163
|
+
|
|
164
|
+
- Paginação: `CrudPrimitivePagination variant="full"`, **10 itens/página** (menor opção)
|
|
165
|
+
- Column resize: ativado por padrão
|
|
166
|
+
- Column manager: ativado por padrão
|
|
167
|
+
- Ordenação: ativada em todas as colunas por padrão
|
|
168
|
+
- Busca: na action bar com `showSearch=true`
|
|
169
|
+
- Ações de linha: sempre usar `ActionButton` da lib
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 6. Padrões Deprecated
|
|
174
|
+
|
|
175
|
+
| ❌ Não usar | ✅ Usar |
|
|
176
|
+
|------------|--------|
|
|
177
|
+
| `BulkActionBar` separado | Dropdown no `CrudActionBar` |
|
|
178
|
+
| `<MoreHorizontal>` genérico | `ActionButton` |
|
|
179
|
+
| Paginação manual | `CrudPrimitivePagination` |
|
|
180
|
+
| `StatusSelect` | `Combobox` |
|
|
181
|
+
| `DeleteConfirmationDialog` | `Dialog` |
|
|
182
|
+
| `Searchbar` | `Input` com ícone |
|
|
183
|
+
| Schema `public` | `.schema('...')` com schema do projeto |
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## 7. Feature Flags
|
|
188
|
+
|
|
189
|
+
| Variável | Descrição | Padrão |
|
|
190
|
+
|----------|-----------|--------|
|
|
191
|
+
| `VITE_SHOW_USER_PREFERENCES` | Exibe "Preferências" no menu do usuário (idioma, timezone, formato de data) | Não exibe |
|
|
192
|
+
| `VITE_I18N_DEBUG_MODE` | Modo debug de i18n (mostra `🔑 chave` ao invés de traduções) | `"false"` |
|
|
193
|
+
| `VITE_IS_QUALIEX` | Usa logos Qualiex ao invés de Forlogic | `"false"` |
|
|
194
|
+
| `VITE_SHOW_EDIT_PROFILE` | Exibe "Editar Perfil" no menu do usuário (foto e idioma) | Não exibe |
|
|
195
|
+
|
|
196
|
+
Todas precisam do prefixo `VITE_` para serem expostas ao cliente.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## 8. Configuração — Setup do Projeto
|
|
201
|
+
|
|
202
|
+
### CoreProviders
|
|
203
|
+
|
|
204
|
+
```tsx
|
|
205
|
+
import { CoreProviders } from 'forlogic-core';
|
|
206
|
+
import ptBR from './i18n/pt-BR.json';
|
|
207
|
+
|
|
208
|
+
function App() {
|
|
209
|
+
return (
|
|
210
|
+
<CoreProviders moduleAlias="seu-modulo" appTranslations={{ 'pt-BR': ptBR, 'en-US': enUS }}>
|
|
211
|
+
<BrowserRouter><Routes /></BrowserRouter>
|
|
212
|
+
</CoreProviders>
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Vite
|
|
218
|
+
|
|
219
|
+
```ts
|
|
220
|
+
import { createSecurityHeadersPlugin } from 'forlogic-core/vite';
|
|
221
|
+
|
|
222
|
+
export default defineConfig(({ mode }) => ({
|
|
223
|
+
plugins: [
|
|
224
|
+
react(),
|
|
225
|
+
createSecurityHeadersPlugin(mode === 'development', {
|
|
226
|
+
supabaseUrls: ['https://SEU_PROJETO.supabase.co'],
|
|
227
|
+
additionalConnectSrc: ['https://*.qualiex.com'],
|
|
228
|
+
}),
|
|
229
|
+
],
|
|
230
|
+
resolve: { alias: { '@': path.resolve(__dirname, './src') } },
|
|
231
|
+
}));
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Tailwind
|
|
235
|
+
|
|
236
|
+
```ts
|
|
237
|
+
import { forlogicTailwindPreset, forlogicContentPaths } from 'forlogic-core/tailwind';
|
|
238
|
+
|
|
239
|
+
export default {
|
|
240
|
+
presets: [forlogicTailwindPreset],
|
|
241
|
+
content: [...forlogicContentPaths],
|
|
242
|
+
} satisfies Config;
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## 9. Estrutura de Documentação
|
|
248
|
+
|
|
249
|
+
| Local | Responsabilidade |
|
|
250
|
+
|-------|-----------------|
|
|
251
|
+
| `README.md` (raiz de cada projeto) | **Schema do projeto** — única fonte canônica |
|
|
252
|
+
| `spec/constitution.md` (projeto Admin) | **Regras e convenções** — fonte canônica para todos os projetos |
|
|
253
|
+
| `docs/design-system/` (projeto Admin) | **Design System** — documentação de componentes |
|
|
254
|
+
| Rota `/ds` no app Admin | **Design System visual** — documentação interativa |
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Design System — Padrões Universais
|
|
2
|
+
|
|
3
|
+
> Padrões obrigatórios para todos os projetos que consomem `forlogic-core`.
|
|
4
|
+
> Acessível via cross-project: `@Admin docs/design-system/patterns/`
|
|
5
|
+
|
|
6
|
+
## Índice
|
|
7
|
+
|
|
8
|
+
### Componentes
|
|
9
|
+
|
|
10
|
+
| Arquivo | Descrição |
|
|
11
|
+
|---------|-----------|
|
|
12
|
+
| [action-button.md](action-button.md) | Uso obrigatório do ActionButton em tabelas |
|
|
13
|
+
| [alertdialog-deletion.md](alertdialog-deletion.md) | AlertDialog para exclusões permanentes |
|
|
14
|
+
| [baseform-usage.md](baseform-usage.md) | BaseForm — formulário dinâmico CRUD |
|
|
15
|
+
| [baseform-custom-fields.md](baseform-custom-fields.md) | Campos customizados no BaseForm |
|
|
16
|
+
| [combo-tree.md](combo-tree.md) | ComboTree — seleção hierárquica |
|
|
17
|
+
| [delete-confirmation.md](delete-confirmation.md) | Dialog de confirmação de exclusão |
|
|
18
|
+
| [dialog-structure.md](dialog-structure.md) | Tamanhos e estrutura obrigatória do Dialog |
|
|
19
|
+
| [dialog-variants.md](dialog-variants.md) | Variantes semânticas do Dialog |
|
|
20
|
+
| [pagination.md](pagination.md) | Paginação padronizada |
|
|
21
|
+
|
|
22
|
+
### Padrões de Layout & Scroll
|
|
23
|
+
|
|
24
|
+
| Arquivo | Descrição |
|
|
25
|
+
|---------|-----------|
|
|
26
|
+
| [dialog-body-scroll.md](dialog-body-scroll.md) | Scroll interno em Dialogs |
|
|
27
|
+
| [body-content-scroll.md](body-content-scroll.md) | Scroll em páginas (BodyContent) |
|
|
28
|
+
| [single-scroll.md](single-scroll.md) | Padrão de scroll único no viewport |
|
|
29
|
+
|
|
30
|
+
### Padrões CRUD
|
|
31
|
+
|
|
32
|
+
| Arquivo | Descrição |
|
|
33
|
+
|---------|-----------|
|
|
34
|
+
| [crud-toolbar.md](crud-toolbar.md) | Layout 3 zonas da toolbar |
|
|
35
|
+
| [crud-bulk-actions.md](crud-bulk-actions.md) | Ações em lote via dropdown |
|
|
36
|
+
| [crud-defaults.md](crud-defaults.md) | Defaults obrigatórios (resize, sort, etc.) |
|
|
37
|
+
| [crud-config-props.md](crud-config-props.md) | Props padronizadas de configuração |
|
|
38
|
+
|
|
39
|
+
### Setup & Configuração
|
|
40
|
+
|
|
41
|
+
| Arquivo | Descrição |
|
|
42
|
+
|---------|-----------|
|
|
43
|
+
| [core-providers.md](core-providers.md) | Setup obrigatório do CoreProviders |
|
|
44
|
+
| [vite-tailwind-setup.md](vite-tailwind-setup.md) | Configuração Vite + Tailwind |
|
|
45
|
+
| [i18n-setup.md](i18n-setup.md) | Setup de internacionalização |
|
|
46
|
+
| [feature-flags.md](feature-flags.md) | Feature flags disponíveis |
|
|
47
|
+
| [header-metadata.md](header-metadata.md) | Padrão de título/subtítulo via header |
|
|
48
|
+
|
|
49
|
+
### Referência
|
|
50
|
+
|
|
51
|
+
| Arquivo | Descrição |
|
|
52
|
+
|---------|-----------|
|
|
53
|
+
| [components-registry.md](components-registry.md) | Registry de componentes consolidados |
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
Updated: now
|
|
1
|
+
# Padrão: BaseForm — Campos Customizados
|
|
3
2
|
|
|
4
3
|
Campos customizados no BaseForm usam `type: 'custom'` com `component` ou `render`:
|
|
5
4
|
|
|
@@ -23,7 +22,7 @@ Campos customizados no BaseForm usam `type: 'custom'` com `component` ou `render
|
|
|
23
22
|
type: 'custom',
|
|
24
23
|
component: FileUpload,
|
|
25
24
|
componentProps: (formData) => ({
|
|
26
|
-
required: !formData?.id,
|
|
25
|
+
required: !formData?.id,
|
|
27
26
|
accept: '.pdf,.doc',
|
|
28
27
|
}),
|
|
29
28
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
Updated: now
|
|
1
|
+
# Padrão: Scroll em Páginas (BodyContent)
|
|
3
2
|
|
|
4
3
|
## Quando Usar Cada Abordagem
|
|
5
4
|
|
|
@@ -30,14 +29,12 @@ import { BodyContent } from 'forlogic-core';
|
|
|
30
29
|
{/* Conteúdo original mantido sem alterações */}
|
|
31
30
|
<div className="p-6">
|
|
32
31
|
<h1>Título Original</h1>
|
|
33
|
-
{/* ... */}
|
|
34
32
|
</div>
|
|
35
33
|
</BodyContent>
|
|
36
34
|
```
|
|
37
35
|
|
|
38
36
|
### ✅ Container Mínimo (Sem BodyContent)
|
|
39
37
|
```tsx
|
|
40
|
-
// Apenas scroll, sem dependência do forlogic-core
|
|
41
38
|
<div className="h-full overflow-y-auto">
|
|
42
39
|
{/* Conteúdo original */}
|
|
43
40
|
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Referência: Registry de Componentes Consolidados
|
|
2
|
+
|
|
3
|
+
Design System mantém um registro de componentes documentados em conjunto sob entradas únicas:
|
|
4
|
+
|
|
5
|
+
- **Breadcrumb** (documenta Breadcrumb e PageBreadcrumb)
|
|
6
|
+
- **Calendar & Date Picker** (documenta Calendar e DatePicker)
|
|
7
|
+
- **Combobox** (documenta Combobox com Command usado internamente)
|
|
8
|
+
- **Toggle & Group** (documenta Toggle e ToggleGroup)
|
|
9
|
+
- **Skeleton** (documenta base Skeleton e todas as variantes)
|
|
10
|
+
- **AppSidebar** (documenta AppSidebar, Sidebar base, SidebarProvider, SidebarMenu*, Collapsible)
|
|
11
|
+
- **Accordion** (documenta Accordion e Collapsible)
|
|
12
|
+
- **Input** (documenta Input, InputGroup, InputGroupAddon, InputGroupButton)
|
|
13
|
+
- **Grid & Stack** (documenta Grid e Stack layout components)
|
|
14
|
+
- **Dialog** (documenta Dialog, AlertDialog, Sheet, Drawer)
|
|
15
|
+
- **Tabs** (documenta Tabs e TabPageLayout)
|
|
16
|
+
|
|
17
|
+
Este registro deve ser consultado antes de criar nova documentação para evitar duplicatas.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Padrão: CRUD — Ações em Lote
|
|
2
|
+
|
|
3
|
+
As ações em lote foram unificadas em um dropdown "Ações em lote" no CrudActionBar.
|
|
4
|
+
|
|
5
|
+
**Comportamento:**
|
|
6
|
+
- O menu permanece visível se habilitado
|
|
7
|
+
- Exibe um badge com a contagem de itens selecionados
|
|
8
|
+
- As opções internas são desabilitadas se a seleção for zero
|
|
9
|
+
|
|
10
|
+
**Regras:**
|
|
11
|
+
- O componente `BulkActionBar` foi **removido** para evitar barras duplicadas e layout shifts
|
|
12
|
+
- Na CrudTable, a coluna de ações de linha não deve ter label no cabeçalho (usar apenas ícone ⋮ ou tooltip) para evitar confusão com o menu de ações em lote da toolbar
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Padrão: CRUD — Props Padronizadas de Configuração
|
|
2
|
+
|
|
3
|
+
A interface CrudPageConfig foi estendida para padronizar a UX em todos os CRUDs (createCrudPage, CrudTable, CrudGrid).
|
|
4
|
+
|
|
5
|
+
**Props disponíveis:**
|
|
6
|
+
|
|
7
|
+
| Prop | Default | Descrição |
|
|
8
|
+
|------|---------|-----------|
|
|
9
|
+
| `showNewButton` | `true` | Exibe botão de criação |
|
|
10
|
+
| `showSearch` | `true` | Exibe campo de busca |
|
|
11
|
+
| `showBulkActions` | — | Alias para `enableBulkActions` |
|
|
12
|
+
| `showActionBar` | `true` | Exibe a barra de ações (substitui `hideActionBar`) |
|
|
13
|
+
| `newButtonLabel` | — | Customiza texto do botão de criação |
|
|
14
|
+
| `searchPlaceholder` | — | Customiza placeholder da busca |
|
|
15
|
+
|
|
16
|
+
Esta padronização garante que todos os CRUDs ofereçam as mesmas capacidades de busca, criação e ações em lote de forma consistente.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Padrão: CRUD — Defaults Obrigatórios
|
|
2
|
+
|
|
3
|
+
Todos os CRUDs (CrudTable, createCrudPage) incluem por padrão:
|
|
4
|
+
|
|
5
|
+
| Feature | Default | Nota |
|
|
6
|
+
|---------|---------|------|
|
|
7
|
+
| Column resize | `true` ✓ | Já obrigatório |
|
|
8
|
+
| Column manager | `true` ✓ | Botão ⋮ no header da coluna "Ações" |
|
|
9
|
+
| Sort | `true` ✓ | Todas as colunas ordenáveis por padrão. Use `sortable: false` para desabilitar |
|
|
10
|
+
| Busca | Header global | Para busca na action bar, usar `showSearch=true` |
|
|
11
|
+
| Paginação | 25 itens/página | — |
|
|
12
|
+
|
|
13
|
+
**NÃO vem por padrão:**
|
|
14
|
+
- **Agrupamento** (`enableGrouping=false`) — precisa ser habilitado explicitamente
|
|
15
|
+
- **Busca na action bar** (`showSearch=false`) — padrão é busca no header
|
|
16
|
+
|
|
17
|
+
**Storage keys:** `createCrudPage` gera automaticamente `columnManagerStorageKey` e `resizeStorageKey` a partir do `entityName`.
|
package/{.note/memory/patterns/crud-toolbar-layout.md → docs/design-system/patterns/crud-toolbar.md}
RENAMED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
#
|
|
2
|
-
Updated: now
|
|
1
|
+
# Padrão: CRUD Toolbar — Layout 3 Zonas
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
O CrudActionBar implementa um layout rígido de 3 zonas:
|
|
5
4
|
|
|
6
5
|
| Zona | Posição | Conteúdo |
|
|
7
6
|
|------|---------|----------|
|
|
8
|
-
| Esquerda | `justify-start` | Botão "Novo" (ação principal) |
|
|
7
|
+
| Esquerda | `justify-start` | Botão "Novo" (ação principal) + Dropdown ações em lote |
|
|
9
8
|
| Centro | `flex-1 max-w-md` | Campo de busca (FilterBar/Input) |
|
|
10
|
-
| Direita | `justify-end` |
|
|
9
|
+
| Direita | `justify-end` | Filtros customizados + Toggle de visualização |
|
|
11
10
|
|
|
12
11
|
```tsx
|
|
13
12
|
// ✅ CORRETO
|
|
@@ -23,4 +22,7 @@ Toolbar CRUD segue layout obrigatório de 3 zonas:
|
|
|
23
22
|
</div>
|
|
24
23
|
```
|
|
25
24
|
|
|
26
|
-
**
|
|
25
|
+
**Regras:**
|
|
26
|
+
- Botão de criação NUNCA deve ficar isolado no cabeçalho do Card
|
|
27
|
+
- Este componente substitui implementações locais de barra de ferramentas
|
|
28
|
+
- Garante visual consistente (bg-muted/50), comportamento e espaçamento em todos os CRUDs
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
Updated: now
|
|
1
|
+
# Padrão: Dialog de Confirmação de Exclusão
|
|
3
2
|
|
|
4
3
|
Dialog de exclusão segue padrão visual específico (NÃO usar AlertDialog para deleções simples):
|
|
5
4
|
|
|
@@ -10,24 +9,17 @@ Dialog de exclusão segue padrão visual específico (NÃO usar AlertDialog para
|
|
|
10
9
|
<DialogTitle className="sr-only">Confirmação</DialogTitle>
|
|
11
10
|
</DialogHeader>
|
|
12
11
|
|
|
13
|
-
{/* Conteúdo centralizado */}
|
|
14
12
|
<div className="flex flex-col items-center text-center space-y-3 py-4">
|
|
15
|
-
{/* Ícone de alerta */}
|
|
16
13
|
<div className="w-12 h-12 rounded-full bg-destructive/10 flex items-center justify-center">
|
|
17
14
|
<AlertTriangle className="h-6 w-6 text-destructive" />
|
|
18
15
|
</div>
|
|
19
|
-
|
|
20
|
-
{/* Título */}
|
|
21
16
|
<h3 className="text-lg font-semibold">Tem certeza?</h3>
|
|
22
|
-
|
|
23
|
-
{/* Mensagem em duas linhas */}
|
|
24
17
|
<p className="text-sm text-muted-foreground">
|
|
25
18
|
Você está prestes a excluir este registro.<br />
|
|
26
19
|
Esta ação não pode ser desfeita.
|
|
27
20
|
</p>
|
|
28
21
|
</div>
|
|
29
22
|
|
|
30
|
-
{/* Botões centralizados */}
|
|
31
23
|
<DialogFooter className="justify-center gap-2 mt-6">
|
|
32
24
|
<Button variant="outline" onClick={() => setOpen(false)}>
|
|
33
25
|
Cancelar
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
#
|
|
2
|
-
Updated: now
|
|
1
|
+
# Padrão: Scroll Interno em Dialogs
|
|
3
2
|
|
|
4
3
|
Conteúdo de Dialog/Sheet com scroll interno **DEVE** usar o padrão responsivo:
|
|
5
4
|
|
|
6
5
|
```tsx
|
|
7
6
|
// ✅ CORRETO - padrão obrigatório
|
|
8
|
-
<div className="flex-1 min-h-0 overflow-auto py-4 px-
|
|
7
|
+
<div className="flex-1 min-h-0 overflow-auto py-4 px-2 -mx-2">
|
|
9
8
|
{/* Conteúdo scrollável */}
|
|
10
9
|
</div>
|
|
11
10
|
|
|
@@ -22,6 +21,6 @@ Conteúdo de Dialog/Sheet com scroll interno **DEVE** usar o padrão responsivo:
|
|
|
22
21
|
| `min-h-0` | Permite shrink em flex container |
|
|
23
22
|
| `overflow-auto` | Habilita scroll quando necessário |
|
|
24
23
|
| `py-4` | Padding vertical padrão (16px) |
|
|
25
|
-
| `px-
|
|
24
|
+
| `px-2 -mx-2` | Previne corte de focus rings (8px de respiro) |
|
|
26
25
|
|
|
27
26
|
**Aplica-se a:** Dialog, Sheet, Drawer, AlertDialog
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
#
|
|
2
|
-
Updated: 2026-02-26
|
|
3
|
-
|
|
4
|
-
## Variantes Semânticas do Dialog
|
|
1
|
+
# Padrão: Dialog — Variantes Semânticas
|
|
5
2
|
|
|
6
3
|
O `DialogContent` possui uma prop `variant` que controla o comportamento de fechamento:
|
|
7
4
|
|
|
8
|
-
|
|
5
|
+
## Variantes
|
|
9
6
|
|
|
10
7
|
| Variante | Clique externo | ESC | Botão X | Uso |
|
|
11
8
|
|----------|---------------|-----|---------|-----|
|
|
@@ -15,7 +12,7 @@ O `DialogContent` possui uma prop `variant` que controla o comportamento de fech
|
|
|
15
12
|
|
|
16
13
|
\* Com `isDirty={true}`, exibe `window.confirm` antes de fechar.
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
## Props
|
|
19
16
|
|
|
20
17
|
```typescript
|
|
21
18
|
interface DialogContentProps {
|
|
@@ -24,7 +21,7 @@ interface DialogContentProps {
|
|
|
24
21
|
}
|
|
25
22
|
```
|
|
26
23
|
|
|
27
|
-
|
|
24
|
+
## Padrão de uso
|
|
28
25
|
|
|
29
26
|
```tsx
|
|
30
27
|
// Formulários
|
|
@@ -37,7 +34,7 @@ interface DialogContentProps {
|
|
|
37
34
|
<DialogContent variant="informative">
|
|
38
35
|
```
|
|
39
36
|
|
|
40
|
-
|
|
37
|
+
## Regras
|
|
41
38
|
- Default é `'informative'` para compatibilidade com dialogs existentes
|
|
42
39
|
- `destructive` oculta o botão X — fechamento apenas por botões no DialogFooter
|
|
43
40
|
- `form` com `isDirty` usa `window.confirm` nativo para confirmação
|