forlogic-core 2.2.6 → 2.2.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/features/import/attachment-idempotency-registry.md +8 -8
- package/.note/memory/features/import/attachment-strategy.md +30 -30
- package/.note/memory/patterns/admin-i18n-policy.md +20 -20
- package/.note/memory/patterns/alias-url-resolution.md +69 -69
- package/.note/memory/patterns/doc-sync-rule.md +35 -35
- package/.note/memory/patterns/documentation-standard.md +17 -17
- package/.note/memory/patterns/dynamic-supabase-config.md +4 -4
- package/.note/memory/patterns/environment-detection-logic.md +35 -35
- package/.note/memory/patterns/i18n-architecture.md +3 -3
- package/README.md +120 -120
- package/dist/README.md +1079 -0
- package/dist/bin/bootstrap.js +40 -0
- package/dist/bin/pull-docs.js +186 -0
- package/dist/components/ui/color-picker.d.ts +2 -0
- package/dist/components/ui/combo-tree.d.ts +3 -1
- package/dist/components/ui/combobox.d.ts +2 -1
- package/dist/components/ui/icon-picker.d.ts +2 -0
- package/dist/components/ui/select.d.ts +9 -2
- package/dist/docs/KNOWLEDGE.md +109 -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/docs/PUBLISH.md +168 -168
- package/docs/STORAGE_BUCKETS.md +456 -456
- package/docs/SUPABASE_SECRETS.md +122 -122
- package/docs/WORKSPACE_KNOWLEDGE.md +154 -154
- package/docs/design-system/buttons-actions.md +130 -130
- package/docs/design-system/charts-dashboards.md +301 -340
- package/docs/design-system/crud.md +114 -174
- package/docs/design-system/data-display.md +106 -106
- package/docs/design-system/dialogs.md +212 -212
- package/docs/design-system/domain.md +329 -319
- package/docs/design-system/examples.md +275 -275
- package/docs/design-system/foundation.md +1 -1
- package/docs/design-system/inputs.md +137 -132
- package/docs/design-system/layout.md +154 -202
- package/docs/design-system/navigation.md +331 -272
- package/docs/design-system/notifications-feedback.md +34 -34
- package/docs/design-system/patterns/README.md +53 -53
- package/docs/design-system/patterns/action-button.md +22 -22
- package/docs/design-system/patterns/alertdialog-deletion.md +46 -46
- package/docs/design-system/patterns/baseform-custom-fields.md +59 -59
- package/docs/design-system/patterns/baseform-usage.md +42 -42
- package/docs/design-system/patterns/body-content-scroll.md +56 -56
- package/docs/design-system/patterns/combo-tree.md +23 -23
- package/docs/design-system/patterns/components-registry.md +17 -17
- package/docs/design-system/patterns/core-providers.md +41 -41
- package/docs/design-system/patterns/crud-bulk-actions.md +12 -12
- package/docs/design-system/patterns/crud-config-props.md +16 -16
- package/docs/design-system/patterns/crud-defaults.md +17 -17
- package/docs/design-system/patterns/crud-toolbar.md +28 -28
- package/docs/design-system/patterns/delete-confirmation.md +40 -40
- package/docs/design-system/patterns/dialog-body-scroll.md +26 -26
- package/docs/design-system/patterns/dialog-structure.md +32 -32
- package/docs/design-system/patterns/dialog-variants.md +41 -41
- package/docs/design-system/patterns/feature-flags.md +81 -81
- package/docs/design-system/patterns/header-metadata.md +57 -57
- package/docs/design-system/patterns/i18n-setup.md +117 -117
- package/docs/design-system/patterns/pagination.md +27 -27
- package/docs/design-system/patterns/single-scroll.md +39 -39
- package/docs/design-system/patterns/vite-tailwind-setup.md +49 -49
- package/docs/design-system/platform.md +18 -18
- package/docs/design-system/selectors.md +296 -260
- package/docs/design-system/tables-grids.md +38 -95
- package/package.json +152 -152
- package/dist/assets/docs-BEwTKYu3.css +0 -1
- package/dist/assets/docs-Bgpz6ETN.js +0 -10752
- package/dist/assets/index-SqMwTzMJ.js +0 -97
- package/dist/index.html +0 -34
|
@@ -7,37 +7,47 @@ Categoria: **Seletores** | 7 componentes
|
|
|
7
7
|
|
|
8
8
|
### TreeSelect (ComboTree)
|
|
9
9
|
|
|
10
|
-
Componente de seleção hierárquica (tree view) com busca recursiva, expansão por chevron e seleção por label. Também disponível como TreeSelect.
|
|
10
|
+
Componente de seleção hierárquica (tree view) com busca recursiva, expansão por chevron e seleção por label. Também disponível como TreeSelect. O item selecionado é destacado com background accent, fonte medium e borda esquerda primary (mesmo padrão do Combobox). Use `showCheck` para adicionar o ícone de check à esquerda.
|
|
11
11
|
|
|
12
12
|
**Uso:**
|
|
13
13
|
```tsx
|
|
14
|
-
import { ComboTree, type ComboTreeOption } from 'forlogic-core';
|
|
15
|
-
// 💡 Alias disponível: import { TreeSelect, type TreeSelectProps } from 'forlogic-core';
|
|
16
|
-
import { Folder, FolderOpen, FileText } from 'lucide-react';
|
|
17
|
-
|
|
18
|
-
const options: ComboTreeOption[] = [
|
|
19
|
-
{
|
|
20
|
-
value: 'quality',
|
|
21
|
-
label: 'Qualidade',
|
|
22
|
-
icon: Folder,
|
|
23
|
-
iconOpen: FolderOpen,
|
|
24
|
-
children: [
|
|
25
|
-
{ value: 'docs', label: 'Documentos', icon: FileText },
|
|
26
|
-
{ value: 'occurrences', label: 'Ocorrências', icon: FileText },
|
|
27
|
-
],
|
|
28
|
-
},
|
|
29
|
-
{ value: 'hr', label: 'RH' },
|
|
30
|
-
];
|
|
31
|
-
|
|
32
|
-
<ComboTree
|
|
33
|
-
options={options}
|
|
34
|
-
value={selected}
|
|
35
|
-
onChange={setSelected}
|
|
36
|
-
label="Departamento"
|
|
37
|
-
placeholder="Selecione..."
|
|
14
|
+
import { ComboTree, type ComboTreeOption } from 'forlogic-core';
|
|
15
|
+
// 💡 Alias disponível: import { TreeSelect, type TreeSelectProps } from 'forlogic-core';
|
|
16
|
+
import { Folder, FolderOpen, FileText } from 'lucide-react';
|
|
17
|
+
|
|
18
|
+
const options: ComboTreeOption[] = [
|
|
19
|
+
{
|
|
20
|
+
value: 'quality',
|
|
21
|
+
label: 'Qualidade',
|
|
22
|
+
icon: Folder,
|
|
23
|
+
iconOpen: FolderOpen,
|
|
24
|
+
children: [
|
|
25
|
+
{ value: 'docs', label: 'Documentos', icon: FileText },
|
|
26
|
+
{ value: 'occurrences', label: 'Ocorrências', icon: FileText },
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
{ value: 'hr', label: 'RH' },
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
<ComboTree
|
|
33
|
+
options={options}
|
|
34
|
+
value={selected}
|
|
35
|
+
onChange={setSelected}
|
|
36
|
+
label="Departamento"
|
|
37
|
+
placeholder="Selecione..."
|
|
38
38
|
/>
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
+
**Exemplos:**
|
|
42
|
+
```tsx
|
|
43
|
+
<ComboTree
|
|
44
|
+
showCheck
|
|
45
|
+
options={options}
|
|
46
|
+
value={value}
|
|
47
|
+
onChange={(v) => setValue(v as string)}
|
|
48
|
+
label=
|
|
49
|
+
```
|
|
50
|
+
|
|
41
51
|
**Acessibilidade:**
|
|
42
52
|
- Navegação por teclado com Tab e Enter
|
|
43
53
|
- Aria-expanded indica estado de expansão dos nós
|
|
@@ -47,173 +57,181 @@ const options: ComboTreeOption[] = [
|
|
|
47
57
|
**Notas:**
|
|
48
58
|
- 💡 Alias: Também disponível como
|
|
49
59
|
- — import { TreeSelect } from
|
|
50
|
-
- ,
|
|
60
|
+
- ,
|
|
51
61
|
|
|
52
|
-
- ,
|
|
62
|
+
- ,
|
|
53
63
|
|
|
54
|
-
- ,
|
|
64
|
+
- ,
|
|
55
65
|
|
|
56
66
|
|
|
57
|
-
> Fonte: `src
|
|
67
|
+
> Fonte: `src\design-system\docs\components\ComboTreeDoc.tsx`
|
|
58
68
|
|
|
59
69
|
---
|
|
60
70
|
|
|
61
71
|
### AutoComplete (Combobox)
|
|
62
72
|
|
|
63
|
-
Componente versátil para seleção única ou múltipla com busca inteligente. Combina Popover e Command para autocomplete. Também disponível como AutoComplete. O
|
|
73
|
+
Componente versátil para seleção única ou múltipla com busca inteligente. Combina Popover e Command para autocomplete. Também disponível como AutoComplete. O item selecionado é destacado por uma cor de fundo (accent) e fonte em negrito; o ícone de check à esquerda é opcional via prop showCheck. Quando clearable está ativo, um botão X aparece dentro do controle, à esquerda do chevron, para limpar a seleção.
|
|
64
74
|
|
|
65
75
|
**Uso:**
|
|
66
76
|
```tsx
|
|
67
|
-
import { Combobox } from "forlogic-core"
|
|
68
|
-
|
|
69
|
-
const options = [
|
|
70
|
-
{ value: 'next.js', label: 'Next.js' },
|
|
71
|
-
{ value: 'sveltekit', label: 'SvelteKit' },
|
|
72
|
-
]
|
|
73
|
-
|
|
74
|
-
// Seleção única
|
|
75
|
-
<Combobox
|
|
76
|
-
options={options}
|
|
77
|
-
value={selected}
|
|
78
|
-
onChange={setSelected}
|
|
79
|
-
placeholder="Select..."
|
|
80
|
-
/>
|
|
81
|
-
|
|
82
|
-
// Seleção múltipla
|
|
83
|
-
<Combobox
|
|
84
|
-
multiple
|
|
85
|
-
options={options}
|
|
86
|
-
value={selectedArray}
|
|
87
|
-
onChange={setSelectedArray}
|
|
88
|
-
placeholder="Select multiple..."
|
|
89
|
-
/>
|
|
90
|
-
|
|
91
|
-
// Seleção única com botão limpar
|
|
92
|
-
<Combobox
|
|
93
|
-
options={options}
|
|
94
|
-
value={selected}
|
|
95
|
-
onChange={setSelected}
|
|
96
|
-
placeholder="Selecione..."
|
|
97
|
-
clearable
|
|
98
|
-
/>
|
|
99
|
-
|
|
100
|
-
//
|
|
101
|
-
<Combobox
|
|
102
|
-
options={options}
|
|
103
|
-
value={selected}
|
|
104
|
-
onChange={setSelected}
|
|
105
|
-
|
|
106
|
-
/>
|
|
107
|
-
|
|
108
|
-
//
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
<
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
</
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
</
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
77
|
+
import { Combobox } from "forlogic-core"
|
|
78
|
+
|
|
79
|
+
const options = [
|
|
80
|
+
{ value: 'next.js', label: 'Next.js' },
|
|
81
|
+
{ value: 'sveltekit', label: 'SvelteKit' },
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
// Seleção única
|
|
85
|
+
<Combobox
|
|
86
|
+
options={options}
|
|
87
|
+
value={selected}
|
|
88
|
+
onChange={setSelected}
|
|
89
|
+
placeholder="Select..."
|
|
90
|
+
/>
|
|
91
|
+
|
|
92
|
+
// Seleção múltipla
|
|
93
|
+
<Combobox
|
|
94
|
+
multiple
|
|
95
|
+
options={options}
|
|
96
|
+
value={selectedArray}
|
|
97
|
+
onChange={setSelectedArray}
|
|
98
|
+
placeholder="Select multiple..."
|
|
99
|
+
/>
|
|
100
|
+
|
|
101
|
+
// Seleção única com botão limpar
|
|
102
|
+
<Combobox
|
|
103
|
+
options={options}
|
|
104
|
+
value={selected}
|
|
105
|
+
onChange={setSelected}
|
|
106
|
+
placeholder="Selecione..."
|
|
107
|
+
clearable
|
|
108
|
+
/>
|
|
109
|
+
|
|
110
|
+
// Exibir ícone de check no item selecionado (padrão é false)
|
|
111
|
+
<Combobox
|
|
112
|
+
options={options}
|
|
113
|
+
value={selected}
|
|
114
|
+
onChange={setSelected}
|
|
115
|
+
showCheck
|
|
116
|
+
/>
|
|
117
|
+
|
|
118
|
+
// Desabilitar botão limpar
|
|
119
|
+
<Combobox
|
|
120
|
+
options={options}
|
|
121
|
+
value={selected}
|
|
122
|
+
onChange={setSelected}
|
|
123
|
+
clearable={false}
|
|
124
|
+
/>
|
|
125
|
+
|
|
126
|
+
// =====================
|
|
127
|
+
// POPOVER COM COMMAND
|
|
128
|
+
// =====================
|
|
129
|
+
import { Popover, PopoverTrigger, PopoverContent, Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, Button } from "forlogic-core"
|
|
130
|
+
|
|
131
|
+
<Popover open={open} onOpenChange={setOpen}>
|
|
132
|
+
<PopoverTrigger asChild>
|
|
133
|
+
<Button variant="outline">
|
|
134
|
+
{selectedStatus ? selectedStatus.label : "+ Definir status"}
|
|
135
|
+
</Button>
|
|
136
|
+
</PopoverTrigger>
|
|
137
|
+
<PopoverContent className="p-0 bg-popover" side="right" align="start">
|
|
138
|
+
<Command>
|
|
139
|
+
<CommandInput placeholder="Alterar status..." />
|
|
140
|
+
<CommandList>
|
|
141
|
+
<CommandEmpty>Nenhum resultado.</CommandEmpty>
|
|
142
|
+
<CommandGroup>
|
|
143
|
+
{statuses.map((status) => (
|
|
144
|
+
<CommandItem
|
|
145
|
+
key={status.value}
|
|
146
|
+
value={status.value}
|
|
147
|
+
onSelect={(value) => {
|
|
148
|
+
setSelectedStatus(statuses.find((s) => s.value === value))
|
|
149
|
+
setOpen(false)
|
|
150
|
+
}}
|
|
151
|
+
>
|
|
152
|
+
{status.label}
|
|
153
|
+
</CommandItem>
|
|
154
|
+
))}
|
|
155
|
+
</CommandGroup>
|
|
156
|
+
</CommandList>
|
|
157
|
+
</Command>
|
|
158
|
+
</PopoverContent>
|
|
159
|
+
</Popover>
|
|
160
|
+
|
|
161
|
+
// =====================
|
|
162
|
+
// DROPDOWN MENU COM COMMAND
|
|
163
|
+
// =====================
|
|
164
|
+
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent } from "forlogic-core"
|
|
165
|
+
|
|
166
|
+
<DropdownMenu open={open} onOpenChange={setOpen}>
|
|
167
|
+
<DropdownMenuTrigger asChild>
|
|
168
|
+
<Button variant="ghost" size="sm">
|
|
169
|
+
<MoreVertical className="h-4 w-4" />
|
|
170
|
+
</Button>
|
|
171
|
+
</DropdownMenuTrigger>
|
|
172
|
+
<DropdownMenuContent align="end" className="w-[200px] bg-popover">
|
|
173
|
+
<DropdownMenuLabel>Ações</DropdownMenuLabel>
|
|
174
|
+
<DropdownMenuSeparator />
|
|
175
|
+
<DropdownMenuSub>
|
|
176
|
+
<DropdownMenuSubTrigger>Aplicar label</DropdownMenuSubTrigger>
|
|
177
|
+
<DropdownMenuSubContent className="p-0 bg-popover">
|
|
178
|
+
<Command>
|
|
179
|
+
<CommandInput placeholder="Filtrar label..." />
|
|
180
|
+
<CommandList>
|
|
181
|
+
<CommandEmpty>Nenhum label encontrado.</CommandEmpty>
|
|
182
|
+
<CommandGroup>
|
|
183
|
+
{labels.map((label) => (
|
|
184
|
+
<CommandItem
|
|
185
|
+
key={label}
|
|
186
|
+
value={label}
|
|
187
|
+
onSelect={(value) => {
|
|
188
|
+
setLabel(value)
|
|
189
|
+
setOpen(false)
|
|
190
|
+
}}
|
|
191
|
+
>
|
|
192
|
+
{label}
|
|
193
|
+
</CommandItem>
|
|
194
|
+
))}
|
|
195
|
+
</CommandGroup>
|
|
196
|
+
</CommandList>
|
|
197
|
+
</Command>
|
|
198
|
+
</DropdownMenuSubContent>
|
|
199
|
+
</DropdownMenuSub>
|
|
200
|
+
</DropdownMenuContent>
|
|
201
|
+
</DropdownMenu>
|
|
202
|
+
|
|
203
|
+
// =====================
|
|
204
|
+
// RESPONSIVO (Popover/Drawer)
|
|
205
|
+
// =====================
|
|
206
|
+
import { useMediaQuery } from "@/design-system/hooks/useMediaQuery"
|
|
207
|
+
import { Drawer, DrawerTrigger, DrawerContent } from "forlogic-core"
|
|
208
|
+
|
|
209
|
+
function ResponsiveCombobox() {
|
|
210
|
+
const isDesktop = useMediaQuery("(min-width: 768px)")
|
|
211
|
+
|
|
212
|
+
if (isDesktop) {
|
|
213
|
+
return (
|
|
214
|
+
<Popover>
|
|
215
|
+
<PopoverTrigger asChild>
|
|
216
|
+
<Button>Definir status</Button>
|
|
217
|
+
</PopoverTrigger>
|
|
218
|
+
<PopoverContent className="p-0 bg-popover">
|
|
219
|
+
<StatusList />
|
|
220
|
+
</PopoverContent>
|
|
221
|
+
</Popover>
|
|
222
|
+
)
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return (
|
|
226
|
+
<Drawer>
|
|
227
|
+
<DrawerTrigger asChild>
|
|
228
|
+
<Button>Definir status</Button>
|
|
229
|
+
</DrawerTrigger>
|
|
230
|
+
<DrawerContent>
|
|
231
|
+
<StatusList />
|
|
232
|
+
</DrawerContent>
|
|
233
|
+
</Drawer>
|
|
234
|
+
)
|
|
217
235
|
}
|
|
218
236
|
```
|
|
219
237
|
|
|
@@ -228,46 +246,56 @@ function ResponsiveCombobox() {
|
|
|
228
246
|
**Notas:**
|
|
229
247
|
- 💡 Alias: Também disponível como
|
|
230
248
|
- — import { AutoComplete } from
|
|
231
|
-
- ,
|
|
249
|
+
- ,
|
|
232
250
|
|
|
233
251
|
|
|
234
|
-
> Fonte: `src
|
|
252
|
+
> Fonte: `src\design-system\docs\components\ComboboxDoc.tsx`
|
|
235
253
|
|
|
236
254
|
---
|
|
237
255
|
|
|
238
256
|
### TreeSelect (ComboTree)
|
|
239
257
|
|
|
240
|
-
Componente de seleção hierárquica (tree view) com busca recursiva, expansão por chevron e seleção por label. Também disponível como TreeSelect.
|
|
258
|
+
Componente de seleção hierárquica (tree view) com busca recursiva, expansão por chevron e seleção por label. Também disponível como TreeSelect. O item selecionado é destacado com background accent, fonte medium e borda esquerda primary (mesmo padrão do Combobox). Use `showCheck` para adicionar o ícone de check à esquerda.
|
|
241
259
|
|
|
242
260
|
**Uso:**
|
|
243
261
|
```tsx
|
|
244
|
-
import { ComboTree, type ComboTreeOption } from 'forlogic-core';
|
|
245
|
-
// 💡 Alias disponível: import { TreeSelect, type TreeSelectProps } from 'forlogic-core';
|
|
246
|
-
import { Folder, FolderOpen, FileText } from 'lucide-react';
|
|
247
|
-
|
|
248
|
-
const options: ComboTreeOption[] = [
|
|
249
|
-
{
|
|
250
|
-
value: 'quality',
|
|
251
|
-
label: 'Qualidade',
|
|
252
|
-
icon: Folder,
|
|
253
|
-
iconOpen: FolderOpen,
|
|
254
|
-
children: [
|
|
255
|
-
{ value: 'docs', label: 'Documentos', icon: FileText },
|
|
256
|
-
{ value: 'occurrences', label: 'Ocorrências', icon: FileText },
|
|
257
|
-
],
|
|
258
|
-
},
|
|
259
|
-
{ value: 'hr', label: 'RH' },
|
|
260
|
-
];
|
|
261
|
-
|
|
262
|
-
<ComboTree
|
|
263
|
-
options={options}
|
|
264
|
-
value={selected}
|
|
265
|
-
onChange={setSelected}
|
|
266
|
-
label="Departamento"
|
|
267
|
-
placeholder="Selecione..."
|
|
262
|
+
import { ComboTree, type ComboTreeOption } from 'forlogic-core';
|
|
263
|
+
// 💡 Alias disponível: import { TreeSelect, type TreeSelectProps } from 'forlogic-core';
|
|
264
|
+
import { Folder, FolderOpen, FileText } from 'lucide-react';
|
|
265
|
+
|
|
266
|
+
const options: ComboTreeOption[] = [
|
|
267
|
+
{
|
|
268
|
+
value: 'quality',
|
|
269
|
+
label: 'Qualidade',
|
|
270
|
+
icon: Folder,
|
|
271
|
+
iconOpen: FolderOpen,
|
|
272
|
+
children: [
|
|
273
|
+
{ value: 'docs', label: 'Documentos', icon: FileText },
|
|
274
|
+
{ value: 'occurrences', label: 'Ocorrências', icon: FileText },
|
|
275
|
+
],
|
|
276
|
+
},
|
|
277
|
+
{ value: 'hr', label: 'RH' },
|
|
278
|
+
];
|
|
279
|
+
|
|
280
|
+
<ComboTree
|
|
281
|
+
options={options}
|
|
282
|
+
value={selected}
|
|
283
|
+
onChange={setSelected}
|
|
284
|
+
label="Departamento"
|
|
285
|
+
placeholder="Selecione..."
|
|
268
286
|
/>
|
|
269
287
|
```
|
|
270
288
|
|
|
289
|
+
**Exemplos:**
|
|
290
|
+
```tsx
|
|
291
|
+
<ComboTree
|
|
292
|
+
showCheck
|
|
293
|
+
options={options}
|
|
294
|
+
value={value}
|
|
295
|
+
onChange={(v) => setValue(v as string)}
|
|
296
|
+
label=
|
|
297
|
+
```
|
|
298
|
+
|
|
271
299
|
**Acessibilidade:**
|
|
272
300
|
- Navegação por teclado com Tab e Enter
|
|
273
301
|
- Aria-expanded indica estado de expansão dos nós
|
|
@@ -277,14 +305,14 @@ const options: ComboTreeOption[] = [
|
|
|
277
305
|
**Notas:**
|
|
278
306
|
- 💡 Alias: Também disponível como
|
|
279
307
|
- — import { TreeSelect } from
|
|
280
|
-
- ,
|
|
308
|
+
- ,
|
|
281
309
|
|
|
282
|
-
- ,
|
|
310
|
+
- ,
|
|
283
311
|
|
|
284
|
-
- ,
|
|
312
|
+
- ,
|
|
285
313
|
|
|
286
314
|
|
|
287
|
-
> Fonte: `src
|
|
315
|
+
> Fonte: `src\design-system\docs\components\ComboTreeDoc.tsx`
|
|
288
316
|
|
|
289
317
|
---
|
|
290
318
|
|
|
@@ -294,15 +322,15 @@ Seletor de cores com paleta predefinida e seletor customizado.
|
|
|
294
322
|
|
|
295
323
|
**Uso:**
|
|
296
324
|
```tsx
|
|
297
|
-
import { ColorPicker } from "forlogic-core"
|
|
298
|
-
import { useState } from 'react'
|
|
299
|
-
|
|
300
|
-
const [color, setColor] = useState('#3b82f6')
|
|
301
|
-
|
|
302
|
-
<ColorPicker
|
|
303
|
-
value={color}
|
|
304
|
-
onChange={setColor}
|
|
305
|
-
label="Escolha uma cor"
|
|
325
|
+
import { ColorPicker } from "forlogic-core"
|
|
326
|
+
import { useState } from 'react'
|
|
327
|
+
|
|
328
|
+
const [color, setColor] = useState('#3b82f6')
|
|
329
|
+
|
|
330
|
+
<ColorPicker
|
|
331
|
+
value={color}
|
|
332
|
+
onChange={setColor}
|
|
333
|
+
label="Escolha uma cor"
|
|
306
334
|
/>
|
|
307
335
|
```
|
|
308
336
|
|
|
@@ -312,14 +340,19 @@ const [color, setColor] = useState('#3b82f6')
|
|
|
312
340
|
| `value` | `string` | #3b82f6 | Cor atual selecionada (formato hexadecimal). |
|
|
313
341
|
| `onChange` | `(color: string) => void` | - | Callback quando a cor é alterada. |
|
|
314
342
|
| `label` | `string` | - | Label opcional para o campo. |
|
|
343
|
+
| `showHexValue` | `boolean` | true | Exibe o valor hexadecimal ao lado do swatch. Quando false, mostra apenas a cor. |
|
|
315
344
|
|
|
316
345
|
**Acessibilidade:**
|
|
346
|
+
- Navegação por teclado completa: abre com Espaço ou ↓, navega com setas, seleciona com Enter
|
|
347
|
+
- Home/End pulam para a primeira/última cor da paleta
|
|
348
|
+
- Esc ou Tab fecham o popover sem alterar a seleção
|
|
349
|
+
- Popover fecha automaticamente ao clicar/selecionar uma cor
|
|
350
|
+
- Foco inicial na cor atualmente selecionada ao abrir o popover
|
|
317
351
|
- Botão com papel semântico correto
|
|
318
352
|
- Input de cor nativo acessível
|
|
319
353
|
- Labels descritivos para cores predefinidas
|
|
320
|
-
- Navegação por teclado completa
|
|
321
354
|
|
|
322
|
-
> Fonte: `src
|
|
355
|
+
> Fonte: `src\design-system\docs\components\ColorPickerDoc.tsx`
|
|
323
356
|
|
|
324
357
|
---
|
|
325
358
|
|
|
@@ -329,15 +362,16 @@ Seletor de ícones Material Symbols Outlined com opção 'sem ícone'.
|
|
|
329
362
|
|
|
330
363
|
**Uso:**
|
|
331
364
|
```tsx
|
|
332
|
-
import { IconPicker } from "forlogic-core"
|
|
333
|
-
import { useState } from 'react'
|
|
334
|
-
|
|
335
|
-
const [icon, setIcon] = useState<string | null>('star_rate')
|
|
336
|
-
|
|
337
|
-
<IconPicker
|
|
338
|
-
value={icon}
|
|
339
|
-
onChange={setIcon}
|
|
340
|
-
label="Escolha um ícone"
|
|
365
|
+
import { IconPicker } from "forlogic-core"
|
|
366
|
+
import { useState } from 'react'
|
|
367
|
+
|
|
368
|
+
const [icon, setIcon] = useState<string | null>('star_rate')
|
|
369
|
+
|
|
370
|
+
<IconPicker
|
|
371
|
+
value={icon}
|
|
372
|
+
onChange={setIcon}
|
|
373
|
+
label="Escolha um ícone"
|
|
374
|
+
color="text-blue-600"
|
|
341
375
|
/>
|
|
342
376
|
```
|
|
343
377
|
|
|
@@ -349,13 +383,15 @@ const [icon, setIcon] = useState<string | null>('star_rate')
|
|
|
349
383
|
| `label` | `string` | - | Label opcional para o campo. |
|
|
350
384
|
|
|
351
385
|
**Acessibilidade:**
|
|
352
|
-
-
|
|
386
|
+
- Navegação por teclado completa: abre com Espaço ou ↓, navega com setas, seleciona com Enter
|
|
387
|
+
- Home/End pulam para o primeiro/último ícone da grid
|
|
388
|
+
- Esc ou Tab fecham o popover sem alterar a seleção
|
|
353
389
|
- Títulos descritivos em cada ícone
|
|
354
390
|
- Indicador visual de seleção
|
|
355
391
|
- Scroll area com navegação adequada
|
|
356
392
|
- Opção para remover ícone selecionado
|
|
357
393
|
|
|
358
|
-
> Fonte: `src
|
|
394
|
+
> Fonte: `src\design-system\docs\components\IconPickerDoc.tsx`
|
|
359
395
|
|
|
360
396
|
---
|
|
361
397
|
|
|
@@ -365,24 +401,24 @@ Componentes para seleção de datas. O Calendar exibe um calendário interativo,
|
|
|
365
401
|
|
|
366
402
|
**Uso:**
|
|
367
403
|
```tsx
|
|
368
|
-
import { Calendar, DatePicker } from "forlogic-core"
|
|
369
|
-
import { useState } from "react"
|
|
370
|
-
|
|
371
|
-
// Calendar
|
|
372
|
-
const [date, setDate] = useState<Date | undefined>(new Date())
|
|
373
|
-
|
|
374
|
-
<Calendar
|
|
375
|
-
mode="single"
|
|
376
|
-
selected={date}
|
|
377
|
-
onSelect={setDate}
|
|
378
|
-
className="rounded-md border"
|
|
379
|
-
/>
|
|
380
|
-
|
|
381
|
-
// Date Picker
|
|
382
|
-
<DatePicker
|
|
383
|
-
date={date}
|
|
384
|
-
onDateChange={setDate}
|
|
385
|
-
placeholder="Selecione uma data"
|
|
404
|
+
import { Calendar, DatePicker } from "forlogic-core"
|
|
405
|
+
import { useState } from "react"
|
|
406
|
+
|
|
407
|
+
// Calendar
|
|
408
|
+
const [date, setDate] = useState<Date | undefined>(new Date())
|
|
409
|
+
|
|
410
|
+
<Calendar
|
|
411
|
+
mode="single"
|
|
412
|
+
selected={date}
|
|
413
|
+
onSelect={setDate}
|
|
414
|
+
className="rounded-md border"
|
|
415
|
+
/>
|
|
416
|
+
|
|
417
|
+
// Date Picker
|
|
418
|
+
<DatePicker
|
|
419
|
+
date={date}
|
|
420
|
+
onDateChange={setDate}
|
|
421
|
+
placeholder="Selecione uma data"
|
|
386
422
|
/>
|
|
387
423
|
```
|
|
388
424
|
|
|
@@ -393,7 +429,7 @@ const [date, setDate] = useState<Date | undefined>(new Date())
|
|
|
393
429
|
- Labels e roles ARIA apropriados
|
|
394
430
|
- Gerenciamento de foco adequado
|
|
395
431
|
|
|
396
|
-
> Fonte: `src
|
|
432
|
+
> Fonte: `src\design-system\docs\components\CalendarDoc.tsx`
|
|
397
433
|
|
|
398
434
|
---
|
|
399
435
|
|
|
@@ -403,12 +439,12 @@ Indica o progresso de preenchimento de campos obrigatórios em formulários com
|
|
|
403
439
|
|
|
404
440
|
**Uso:**
|
|
405
441
|
```tsx
|
|
406
|
-
import { RequiredFieldsCounter } from "@/design-system/components/RequiredFieldsCounter"
|
|
407
|
-
|
|
408
|
-
// Progresso parcial
|
|
409
|
-
<RequiredFieldsCounter filled={2} total={5} />
|
|
410
|
-
|
|
411
|
-
// Formulário completo
|
|
442
|
+
import { RequiredFieldsCounter } from "@/design-system/components/RequiredFieldsCounter"
|
|
443
|
+
|
|
444
|
+
// Progresso parcial
|
|
445
|
+
<RequiredFieldsCounter filled={2} total={5} />
|
|
446
|
+
|
|
447
|
+
// Formulário completo
|
|
412
448
|
<RequiredFieldsCounter filled={5} total={5} />
|
|
413
449
|
```
|
|
414
450
|
|
|
@@ -437,9 +473,9 @@ import { RequiredFieldsCounter } from "@/design-system/components/RequiredFields
|
|
|
437
473
|
- definida no tailwind.config.ts
|
|
438
474
|
- Importar de
|
|
439
475
|
- ou diretamente de
|
|
440
|
-
- ,
|
|
476
|
+
- ,
|
|
441
477
|
|
|
442
478
|
|
|
443
|
-
> Fonte: `src
|
|
479
|
+
> Fonte: `src\design-system\docs\components\RequiredFieldsCounterDoc.tsx`
|
|
444
480
|
|
|
445
481
|
---
|