forlogic-core 1.9.3 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -6412
- package/dist/DESIGN_SYSTEM.md +676 -0
- package/dist/README.md +101 -6412
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.esm.js +10 -1
- package/dist/index.js +10 -1
- package/package.json +25 -5
|
@@ -0,0 +1,676 @@
|
|
|
1
|
+
# 🎨 forlogic-core - Design System
|
|
2
|
+
|
|
3
|
+
> Documentação completa dos componentes, tokens e padrões do Design System
|
|
4
|
+
|
|
5
|
+
**Versão:** 1.9.3
|
|
6
|
+
**Última atualização:** 2025-11-24
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 🚀 Início Rápido
|
|
11
|
+
|
|
12
|
+
### Instalação
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install forlogic-core
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Uso Básico
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import { Button, Input, Card } from 'forlogic-core';
|
|
22
|
+
import 'forlogic-core/index.css';
|
|
23
|
+
|
|
24
|
+
function App() {
|
|
25
|
+
return (
|
|
26
|
+
<Card>
|
|
27
|
+
<Input placeholder="Digite algo..." />
|
|
28
|
+
<Button>Enviar</Button>
|
|
29
|
+
</Card>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 📖 Índice
|
|
37
|
+
|
|
38
|
+
### 🎨 Fundamentos (Tokens)
|
|
39
|
+
- [Colors](#colors) - Sistema de cores e temas
|
|
40
|
+
- [Typography](#typography) - Escala tipográfica
|
|
41
|
+
- [Spacing](#spacing) - Sistema de espaçamento
|
|
42
|
+
- [Shadows](#shadows) - Sombras e elevação
|
|
43
|
+
- [Radius](#radius) - Bordas arredondadas
|
|
44
|
+
- [Transitions](#transitions) - Animações e transições
|
|
45
|
+
- [Z-Index](#z-index) - Camadas de profundidade
|
|
46
|
+
- [Opacities](#opacities) - Transparências
|
|
47
|
+
|
|
48
|
+
### 🧩 Componentes UI
|
|
49
|
+
|
|
50
|
+
#### Formulários
|
|
51
|
+
- [Button](#button) - Botões e ações
|
|
52
|
+
- [Input](#input) - Campos de entrada
|
|
53
|
+
- [Textarea](#textarea) - Área de texto
|
|
54
|
+
- [Select](#select) - Seleção de opções
|
|
55
|
+
- [Checkbox](#checkbox) - Caixas de seleção
|
|
56
|
+
- [Radio Group](#radio-group) - Seleção exclusiva
|
|
57
|
+
- [Switch](#switch) - Interruptor on/off
|
|
58
|
+
- [Combobox](#combobox) - Seleção com busca
|
|
59
|
+
- [Date Picker](#date-picker) - Seletor de data
|
|
60
|
+
- [Color Picker](#color-picker) - Seletor de cor
|
|
61
|
+
- [Icon Picker](#icon-picker) - Seletor de ícones
|
|
62
|
+
|
|
63
|
+
#### Layout
|
|
64
|
+
- [Card](#card) - Cards e containers
|
|
65
|
+
- [Dialog](#dialog) - Modais e diálogos
|
|
66
|
+
- [Sheet](#sheet) - Painéis laterais
|
|
67
|
+
- [Tabs](#tabs) - Abas de navegação
|
|
68
|
+
- [Accordion](#accordion) - Conteúdo expansível
|
|
69
|
+
- [Separator](#separator) - Divisores
|
|
70
|
+
- [Scroll Area](#scroll-area) - Área com scroll
|
|
71
|
+
- [Resizable](#resizable) - Painéis redimensionáveis
|
|
72
|
+
- [Sidebar](#sidebar) - Barra lateral
|
|
73
|
+
|
|
74
|
+
#### Navegação
|
|
75
|
+
- [Breadcrumb](#breadcrumb) - Trilha de navegação
|
|
76
|
+
- [Pagination](#pagination) - Paginação
|
|
77
|
+
- [Dropdown Menu](#dropdown-menu) - Menu suspenso
|
|
78
|
+
- [Navigation Menu](#navigation-menu) - Menu de navegação
|
|
79
|
+
- [Menubar](#menubar) - Barra de menu
|
|
80
|
+
|
|
81
|
+
#### Feedback
|
|
82
|
+
- [Alert](#alert) - Alertas e avisos
|
|
83
|
+
- [Toast](#toast) - Notificações temporárias
|
|
84
|
+
- [Progress](#progress) - Barra de progresso
|
|
85
|
+
- [Skeleton](#skeleton) - Loading placeholder
|
|
86
|
+
- [Spinner](#spinner) - Indicador de carregamento
|
|
87
|
+
- [Badge](#badge) - Etiquetas e badges
|
|
88
|
+
- [Empty State](#empty-state) - Estado vazio
|
|
89
|
+
|
|
90
|
+
#### Dados
|
|
91
|
+
- [Table](#table) - Tabelas de dados
|
|
92
|
+
- [Data List](#data-list) - Listas de dados
|
|
93
|
+
|
|
94
|
+
#### Outros
|
|
95
|
+
- [Avatar](#avatar) - Avatares de usuário
|
|
96
|
+
- [Tooltip](#tooltip) - Dicas contextuais
|
|
97
|
+
- [Popover](#popover) - Popover
|
|
98
|
+
- [Hover Card](#hover-card) - Card ao hover
|
|
99
|
+
- [Context Menu](#context-menu) - Menu de contexto
|
|
100
|
+
- [Carousel](#carousel) - Carrossel
|
|
101
|
+
- [Aspect Ratio](#aspect-ratio) - Proporção de aspecto
|
|
102
|
+
|
|
103
|
+
### 🚀 Sistema CRUD
|
|
104
|
+
- [createCrudPage](#createcrudpage) - Páginas CRUD automáticas
|
|
105
|
+
- [BaseForm](#baseform) - Formulários dinâmicos
|
|
106
|
+
- [CrudTable](#crudtable) - Tabelas com ações
|
|
107
|
+
- [CrudCards](#crudcards) - Cards com ações
|
|
108
|
+
- [WizardForm](#wizardform) - Formulários em etapas
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## 🎨 FUNDAMENTOS (TOKENS)
|
|
113
|
+
|
|
114
|
+
### Colors
|
|
115
|
+
|
|
116
|
+
Sistema de cores baseado em HSL, totalmente compatível com temas claro/escuro.
|
|
117
|
+
|
|
118
|
+
**Importação:**
|
|
119
|
+
```tsx
|
|
120
|
+
import {
|
|
121
|
+
getColor,
|
|
122
|
+
lightSemanticColors,
|
|
123
|
+
darkSemanticColors,
|
|
124
|
+
neutralScale,
|
|
125
|
+
brandScale
|
|
126
|
+
} from 'forlogic-core/tokens';
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Escalas Disponíveis:**
|
|
130
|
+
|
|
131
|
+
- **neutralScale**: Cinzas de 0 a 1000
|
|
132
|
+
- **brandScale**: Cores da marca (primary, secondary, accent)
|
|
133
|
+
- **functionalColors**: Success, warning, danger, info
|
|
134
|
+
|
|
135
|
+
**Cores Semânticas (recomendadas):**
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
// Superfícies
|
|
139
|
+
surfaceBase // Fundo base
|
|
140
|
+
surfaceCard // Cards e containers
|
|
141
|
+
surfaceDialog // Modais e diálogos
|
|
142
|
+
surfaceHover // Hover states
|
|
143
|
+
|
|
144
|
+
// Texto
|
|
145
|
+
textPrimary // Texto principal
|
|
146
|
+
textSecondary // Texto secundário
|
|
147
|
+
textMuted // Texto desabilitado
|
|
148
|
+
|
|
149
|
+
// Bordas
|
|
150
|
+
borderDefault // Bordas padrão
|
|
151
|
+
borderInput // Bordas de inputs
|
|
152
|
+
borderFocus // Bordas em foco
|
|
153
|
+
|
|
154
|
+
// Ações
|
|
155
|
+
actionPrimary // Ação primária
|
|
156
|
+
actionSecondary // Ação secundária
|
|
157
|
+
actionDestructive // Ações destrutivas
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Uso em Componentes:**
|
|
161
|
+
|
|
162
|
+
```tsx
|
|
163
|
+
// Usar classes do Tailwind com tokens semânticos
|
|
164
|
+
<div className="bg-background text-foreground border border-border">
|
|
165
|
+
<h1 className="text-primary">Título</h1>
|
|
166
|
+
<p className="text-muted-foreground">Descrição</p>
|
|
167
|
+
</div>
|
|
168
|
+
|
|
169
|
+
// Ou via tokens TypeScript
|
|
170
|
+
const bgColor = lightSemanticColors.surfaceBase;
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
### Typography
|
|
176
|
+
|
|
177
|
+
Escala tipográfica consistente com presets para diferentes hierarquias.
|
|
178
|
+
|
|
179
|
+
**Importação:**
|
|
180
|
+
```tsx
|
|
181
|
+
import {
|
|
182
|
+
fontFamilies,
|
|
183
|
+
fontSizes,
|
|
184
|
+
fontWeights,
|
|
185
|
+
typographyPresets
|
|
186
|
+
} from 'forlogic-core/tokens';
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Famílias de Fonte:**
|
|
190
|
+
```typescript
|
|
191
|
+
fontFamilies.sans // Fonte sans-serif padrão
|
|
192
|
+
fontFamilies.mono // Fonte monoespaçada
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**Tamanhos:**
|
|
196
|
+
```typescript
|
|
197
|
+
fontSizes.xs // 0.75rem (12px)
|
|
198
|
+
fontSizes.sm // 0.875rem (14px)
|
|
199
|
+
fontSizes.base // 1rem (16px)
|
|
200
|
+
fontSizes.lg // 1.125rem (18px)
|
|
201
|
+
fontSizes.xl // 1.25rem (20px)
|
|
202
|
+
fontSizes['2xl'] // 1.5rem (24px)
|
|
203
|
+
fontSizes['3xl'] // 1.875rem (30px)
|
|
204
|
+
fontSizes['4xl'] // 2.25rem (36px)
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Presets Tipográficos:**
|
|
208
|
+
```tsx
|
|
209
|
+
// Usar classes do Tailwind
|
|
210
|
+
<h1 className="text-4xl font-bold">Heading 1</h1>
|
|
211
|
+
<h2 className="text-3xl font-semibold">Heading 2</h2>
|
|
212
|
+
<p className="text-base">Body text</p>
|
|
213
|
+
<small className="text-sm text-muted-foreground">Small text</small>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
### Spacing
|
|
219
|
+
|
|
220
|
+
Sistema de espaçamento consistente baseado em múltiplos de 4px.
|
|
221
|
+
|
|
222
|
+
**Importação:**
|
|
223
|
+
```tsx
|
|
224
|
+
import { spacing, semanticSpacing, getSpacing } from 'forlogic-core/tokens';
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**Escala:**
|
|
228
|
+
```typescript
|
|
229
|
+
spacing[0] // 0px
|
|
230
|
+
spacing[1] // 0.25rem (4px)
|
|
231
|
+
spacing[2] // 0.5rem (8px)
|
|
232
|
+
spacing[3] // 0.75rem (12px)
|
|
233
|
+
spacing[4] // 1rem (16px)
|
|
234
|
+
spacing[6] // 1.5rem (24px)
|
|
235
|
+
spacing[8] // 2rem (32px)
|
|
236
|
+
spacing[12] // 3rem (48px)
|
|
237
|
+
spacing[16] // 4rem (64px)
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**Uso:**
|
|
241
|
+
```tsx
|
|
242
|
+
<div className="p-4 m-2 space-y-4">
|
|
243
|
+
<Card className="p-6">Content</Card>
|
|
244
|
+
</div>
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
### Shadows
|
|
250
|
+
|
|
251
|
+
Sistema de sombras para criar profundidade e hierarquia.
|
|
252
|
+
|
|
253
|
+
**Importação:**
|
|
254
|
+
```tsx
|
|
255
|
+
import { shadows, elevation, getShadow } from 'forlogic-core/tokens';
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**Níveis:**
|
|
259
|
+
```tsx
|
|
260
|
+
<Card className="shadow-sm">Subtle shadow</Card>
|
|
261
|
+
<Card className="shadow">Default shadow</Card>
|
|
262
|
+
<Card className="shadow-md">Medium shadow</Card>
|
|
263
|
+
<Card className="shadow-lg">Large shadow</Card>
|
|
264
|
+
<Card className="shadow-xl">Extra large shadow</Card>
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
### Radius
|
|
270
|
+
|
|
271
|
+
Bordas arredondadas consistentes.
|
|
272
|
+
|
|
273
|
+
**Importação:**
|
|
274
|
+
```tsx
|
|
275
|
+
import { radius, getRadius } from 'forlogic-core/tokens';
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
**Valores:**
|
|
279
|
+
```tsx
|
|
280
|
+
<div className="rounded-none">No radius</div>
|
|
281
|
+
<div className="rounded-sm">Small radius</div>
|
|
282
|
+
<div className="rounded">Default radius</div>
|
|
283
|
+
<div className="rounded-md">Medium radius</div>
|
|
284
|
+
<div className="rounded-lg">Large radius</div>
|
|
285
|
+
<div className="rounded-full">Full radius</div>
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
### Transitions
|
|
291
|
+
|
|
292
|
+
Animações e transições suaves.
|
|
293
|
+
|
|
294
|
+
**Importação:**
|
|
295
|
+
```tsx
|
|
296
|
+
import { duration, easing, transitions } from 'forlogic-core/tokens';
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
**Uso:**
|
|
300
|
+
```tsx
|
|
301
|
+
<button className="transition-colors hover:bg-primary">
|
|
302
|
+
Hover me
|
|
303
|
+
</button>
|
|
304
|
+
|
|
305
|
+
<div className="transition-all duration-300 ease-in-out">
|
|
306
|
+
Animated
|
|
307
|
+
</div>
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## 🧩 COMPONENTES UI
|
|
313
|
+
|
|
314
|
+
### Button
|
|
315
|
+
|
|
316
|
+
Componente de botão com múltiplas variantes, tamanhos e estados.
|
|
317
|
+
|
|
318
|
+
**Importação:**
|
|
319
|
+
```tsx
|
|
320
|
+
import { Button } from 'forlogic-core';
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
**Uso Básico:**
|
|
324
|
+
```tsx
|
|
325
|
+
<Button>Default Button</Button>
|
|
326
|
+
<Button variant="destructive">Delete</Button>
|
|
327
|
+
<Button variant="outline" size="sm">Small</Button>
|
|
328
|
+
<Button variant="ghost">Ghost Button</Button>
|
|
329
|
+
<Button size="icon"><Icon /></Button>
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
**Props:**
|
|
333
|
+
| Prop | Tipo | Padrão | Descrição |
|
|
334
|
+
|------|------|--------|-----------|
|
|
335
|
+
| variant | "default" \| "destructive" \| "outline" \| "secondary" \| "ghost" \| "link" | "default" | Variante visual |
|
|
336
|
+
| size | "default" \| "sm" \| "lg" \| "icon" | "default" | Tamanho do botão |
|
|
337
|
+
| asChild | boolean | false | Compor com outro elemento |
|
|
338
|
+
| disabled | boolean | false | Desabilitar botão |
|
|
339
|
+
|
|
340
|
+
**Variantes:**
|
|
341
|
+
- `default`: Botão primário com fundo sólido
|
|
342
|
+
- `destructive`: Ações destrutivas (deletar, remover)
|
|
343
|
+
- `outline`: Botão com borda, fundo transparente
|
|
344
|
+
- `secondary`: Ação secundária
|
|
345
|
+
- `ghost`: Sem borda, hover sutil
|
|
346
|
+
- `link`: Estilo de link
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
### Input
|
|
351
|
+
|
|
352
|
+
Campo de entrada de texto.
|
|
353
|
+
|
|
354
|
+
**Importação:**
|
|
355
|
+
```tsx
|
|
356
|
+
import { Input } from 'forlogic-core';
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
**Uso:**
|
|
360
|
+
```tsx
|
|
361
|
+
<Input type="text" placeholder="Digite seu nome..." />
|
|
362
|
+
<Input type="email" placeholder="email@exemplo.com" />
|
|
363
|
+
<Input type="password" disabled />
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
### Select
|
|
369
|
+
|
|
370
|
+
Seleção de opções em dropdown.
|
|
371
|
+
|
|
372
|
+
**Importação:**
|
|
373
|
+
```tsx
|
|
374
|
+
import {
|
|
375
|
+
Select,
|
|
376
|
+
SelectTrigger,
|
|
377
|
+
SelectValue,
|
|
378
|
+
SelectContent,
|
|
379
|
+
SelectItem
|
|
380
|
+
} from 'forlogic-core';
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
**Uso:**
|
|
384
|
+
```tsx
|
|
385
|
+
<Select>
|
|
386
|
+
<SelectTrigger>
|
|
387
|
+
<SelectValue placeholder="Selecione..." />
|
|
388
|
+
</SelectTrigger>
|
|
389
|
+
<SelectContent>
|
|
390
|
+
<SelectItem value="1">Opção 1</SelectItem>
|
|
391
|
+
<SelectItem value="2">Opção 2</SelectItem>
|
|
392
|
+
</SelectContent>
|
|
393
|
+
</Select>
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
### Card
|
|
399
|
+
|
|
400
|
+
Container para agrupar conteúdo relacionado.
|
|
401
|
+
|
|
402
|
+
**Importação:**
|
|
403
|
+
```tsx
|
|
404
|
+
import {
|
|
405
|
+
Card,
|
|
406
|
+
CardHeader,
|
|
407
|
+
CardTitle,
|
|
408
|
+
CardDescription,
|
|
409
|
+
CardContent,
|
|
410
|
+
CardFooter
|
|
411
|
+
} from 'forlogic-core';
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
**Uso:**
|
|
415
|
+
```tsx
|
|
416
|
+
<Card>
|
|
417
|
+
<CardHeader>
|
|
418
|
+
<CardTitle>Título do Card</CardTitle>
|
|
419
|
+
<CardDescription>Descrição opcional</CardDescription>
|
|
420
|
+
</CardHeader>
|
|
421
|
+
<CardContent>
|
|
422
|
+
<p>Conteúdo do card</p>
|
|
423
|
+
</CardContent>
|
|
424
|
+
<CardFooter>
|
|
425
|
+
<Button>Ação</Button>
|
|
426
|
+
</CardFooter>
|
|
427
|
+
</Card>
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
---
|
|
431
|
+
|
|
432
|
+
### Dialog
|
|
433
|
+
|
|
434
|
+
Modais e diálogos.
|
|
435
|
+
|
|
436
|
+
**Importação:**
|
|
437
|
+
```tsx
|
|
438
|
+
import {
|
|
439
|
+
Dialog,
|
|
440
|
+
DialogTrigger,
|
|
441
|
+
DialogContent,
|
|
442
|
+
DialogHeader,
|
|
443
|
+
DialogTitle,
|
|
444
|
+
DialogDescription,
|
|
445
|
+
DialogFooter
|
|
446
|
+
} from 'forlogic-core';
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
**Uso:**
|
|
450
|
+
```tsx
|
|
451
|
+
<Dialog>
|
|
452
|
+
<DialogTrigger asChild>
|
|
453
|
+
<Button>Abrir Modal</Button>
|
|
454
|
+
</DialogTrigger>
|
|
455
|
+
<DialogContent>
|
|
456
|
+
<DialogHeader>
|
|
457
|
+
<DialogTitle>Título do Modal</DialogTitle>
|
|
458
|
+
<DialogDescription>Descrição</DialogDescription>
|
|
459
|
+
</DialogHeader>
|
|
460
|
+
<div>Conteúdo do modal</div>
|
|
461
|
+
<DialogFooter>
|
|
462
|
+
<Button>Confirmar</Button>
|
|
463
|
+
</DialogFooter>
|
|
464
|
+
</DialogContent>
|
|
465
|
+
</Dialog>
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
---
|
|
469
|
+
|
|
470
|
+
### Table
|
|
471
|
+
|
|
472
|
+
Tabelas de dados.
|
|
473
|
+
|
|
474
|
+
**Importação:**
|
|
475
|
+
```tsx
|
|
476
|
+
import {
|
|
477
|
+
Table,
|
|
478
|
+
TableHeader,
|
|
479
|
+
TableBody,
|
|
480
|
+
TableRow,
|
|
481
|
+
TableHead,
|
|
482
|
+
TableCell
|
|
483
|
+
} from 'forlogic-core';
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
**Uso:**
|
|
487
|
+
```tsx
|
|
488
|
+
<Table>
|
|
489
|
+
<TableHeader>
|
|
490
|
+
<TableRow>
|
|
491
|
+
<TableHead>Nome</TableHead>
|
|
492
|
+
<TableHead>Email</TableHead>
|
|
493
|
+
</TableRow>
|
|
494
|
+
</TableHeader>
|
|
495
|
+
<TableBody>
|
|
496
|
+
<TableRow>
|
|
497
|
+
<TableCell>João</TableCell>
|
|
498
|
+
<TableCell>joao@exemplo.com</TableCell>
|
|
499
|
+
</TableRow>
|
|
500
|
+
</TableBody>
|
|
501
|
+
</Table>
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
---
|
|
505
|
+
|
|
506
|
+
### Toast
|
|
507
|
+
|
|
508
|
+
Notificações temporárias.
|
|
509
|
+
|
|
510
|
+
**Importação:**
|
|
511
|
+
```tsx
|
|
512
|
+
import { useToast } from 'forlogic-core';
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
**Uso:**
|
|
516
|
+
```tsx
|
|
517
|
+
function MyComponent() {
|
|
518
|
+
const { toast } = useToast();
|
|
519
|
+
|
|
520
|
+
return (
|
|
521
|
+
<Button onClick={() => toast({
|
|
522
|
+
title: "Sucesso!",
|
|
523
|
+
description: "Operação concluída com sucesso",
|
|
524
|
+
})}>
|
|
525
|
+
Mostrar Toast
|
|
526
|
+
</Button>
|
|
527
|
+
);
|
|
528
|
+
}
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
---
|
|
532
|
+
|
|
533
|
+
## 🚀 SISTEMA CRUD
|
|
534
|
+
|
|
535
|
+
### createCrudPage
|
|
536
|
+
|
|
537
|
+
Função utilitária que cria páginas CRUD completas automaticamente.
|
|
538
|
+
|
|
539
|
+
**Importação:**
|
|
540
|
+
```tsx
|
|
541
|
+
import { createCrudPage } from 'forlogic-core';
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
**Exemplo Completo:**
|
|
545
|
+
```tsx
|
|
546
|
+
import { createCrudPage } from 'forlogic-core';
|
|
547
|
+
import { processService } from './processService';
|
|
548
|
+
import { processSchema } from './processValidation';
|
|
549
|
+
|
|
550
|
+
export const ProcessesPage = createCrudPage({
|
|
551
|
+
entity: 'process',
|
|
552
|
+
service: processService,
|
|
553
|
+
schema: processSchema,
|
|
554
|
+
fields: [
|
|
555
|
+
{ name: 'title', label: 'Título', type: 'text', required: true },
|
|
556
|
+
{ name: 'description', label: 'Descrição', type: 'textarea' }
|
|
557
|
+
],
|
|
558
|
+
columns: [
|
|
559
|
+
{ key: 'title', label: 'Título' },
|
|
560
|
+
{ key: 'created_at', label: 'Criado em', format: 'date' }
|
|
561
|
+
]
|
|
562
|
+
});
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
**Props:**
|
|
566
|
+
| Prop | Tipo | Descrição |
|
|
567
|
+
|------|------|-----------|
|
|
568
|
+
| entity | string | Nome da entidade (singular) |
|
|
569
|
+
| service | CrudService | Service com métodos CRUD |
|
|
570
|
+
| schema | ZodSchema | Schema de validação Zod |
|
|
571
|
+
| fields | FieldConfig[] | Configuração dos campos |
|
|
572
|
+
| columns | ColumnConfig[] | Configuração das colunas |
|
|
573
|
+
|
|
574
|
+
---
|
|
575
|
+
|
|
576
|
+
### BaseForm
|
|
577
|
+
|
|
578
|
+
Formulário dinâmico com validação.
|
|
579
|
+
|
|
580
|
+
**Importação:**
|
|
581
|
+
```tsx
|
|
582
|
+
import { BaseForm } from 'forlogic-core';
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
**Uso:**
|
|
586
|
+
```tsx
|
|
587
|
+
<BaseForm
|
|
588
|
+
fields={[
|
|
589
|
+
{ name: 'name', label: 'Nome', type: 'text', required: true },
|
|
590
|
+
{ name: 'email', label: 'Email', type: 'email' }
|
|
591
|
+
]}
|
|
592
|
+
onSubmit={handleSubmit}
|
|
593
|
+
defaultValues={initialData}
|
|
594
|
+
/>
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
---
|
|
598
|
+
|
|
599
|
+
### WizardForm
|
|
600
|
+
|
|
601
|
+
Formulário em etapas (wizard).
|
|
602
|
+
|
|
603
|
+
**Importação:**
|
|
604
|
+
```tsx
|
|
605
|
+
import { WizardForm } from 'forlogic-core';
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
**Uso:**
|
|
609
|
+
```tsx
|
|
610
|
+
<WizardForm
|
|
611
|
+
steps={[
|
|
612
|
+
{
|
|
613
|
+
title: 'Informações Básicas',
|
|
614
|
+
fields: [
|
|
615
|
+
{ name: 'name', label: 'Nome', type: 'text' }
|
|
616
|
+
]
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
title: 'Contato',
|
|
620
|
+
fields: [
|
|
621
|
+
{ name: 'email', label: 'Email', type: 'email' }
|
|
622
|
+
]
|
|
623
|
+
}
|
|
624
|
+
]}
|
|
625
|
+
onSubmit={handleSubmit}
|
|
626
|
+
/>
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
---
|
|
630
|
+
|
|
631
|
+
## 📝 Notas Importantes
|
|
632
|
+
|
|
633
|
+
### Peer Dependencies
|
|
634
|
+
|
|
635
|
+
Certifique-se de ter instalado:
|
|
636
|
+
- react@^18.0.0
|
|
637
|
+
- react-dom@^18.0.0
|
|
638
|
+
- lucide-react@>=0.400.0
|
|
639
|
+
- @tanstack/react-query@^5.0.0
|
|
640
|
+
- react-router-dom@^6.0.0
|
|
641
|
+
|
|
642
|
+
### CSS Global
|
|
643
|
+
|
|
644
|
+
Importe o CSS no seu arquivo principal:
|
|
645
|
+
```tsx
|
|
646
|
+
import 'forlogic-core/index.css';
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
### TypeScript
|
|
650
|
+
|
|
651
|
+
Os tipos estão incluídos automaticamente. Não é necessário instalar `@types`.
|
|
652
|
+
|
|
653
|
+
### Temas Claro/Escuro
|
|
654
|
+
|
|
655
|
+
O forlogic-core suporta temas automaticamente. Use o `next-themes`:
|
|
656
|
+
|
|
657
|
+
```tsx
|
|
658
|
+
import { ThemeProvider } from 'next-themes';
|
|
659
|
+
|
|
660
|
+
<ThemeProvider attribute="class" defaultTheme="system">
|
|
661
|
+
<App />
|
|
662
|
+
</ThemeProvider>
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
---
|
|
666
|
+
|
|
667
|
+
## 🔗 Links Úteis
|
|
668
|
+
|
|
669
|
+
- **Repositório**: [GitHub](https://github.com/your-org/forlogic-core)
|
|
670
|
+
- **Exemplos**: Veja `src/design-system/docs` para exemplos detalhados
|
|
671
|
+
- **Suporte**: Abra uma issue no GitHub
|
|
672
|
+
|
|
673
|
+
---
|
|
674
|
+
|
|
675
|
+
**Última atualização:** 2025-11-24
|
|
676
|
+
**Versão:** 1.9.3
|