@seedgrid/ai-toolkit 0.0.0-stage → 0.3.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/LICENSE +21 -0
- package/README.md +151 -2
- package/dist/adapters/claude.js +114 -0
- package/dist/adapters/codex.js +108 -0
- package/dist/adapters/index.js +17 -0
- package/dist/adapters/shared.js +142 -0
- package/dist/adapters/types.js +1 -0
- package/dist/cli.js +203 -0
- package/dist/commands/common.js +98 -0
- package/dist/commands/doctor.js +290 -0
- package/dist/commands/init.js +9 -0
- package/dist/commands/install.js +107 -0
- package/dist/commands/remove.js +54 -0
- package/dist/commands/review.js +127 -0
- package/dist/commands/status.js +73 -0
- package/dist/commands/update.js +8 -0
- package/dist/commands/validate.js +27 -0
- package/dist/core/apply.js +181 -0
- package/dist/core/blocks.js +64 -0
- package/dist/core/content.js +528 -0
- package/dist/core/env.js +40 -0
- package/dist/core/frontmatter.js +29 -0
- package/dist/core/hash.js +14 -0
- package/dist/core/inspect.js +51 -0
- package/dist/core/lock.js +124 -0
- package/dist/core/paths.js +65 -0
- package/dist/core/plan.js +242 -0
- package/dist/core/tools.js +62 -0
- package/dist/core/types.js +11 -0
- package/dist/core/updates.js +121 -0
- package/docs/arquitetura.md +80 -0
- package/docs/compatibilidade.md +50 -0
- package/docs/formato.md +155 -0
- package/docs/instalacao.md +105 -0
- package/docs/manutencao.md +115 -0
- package/package.json +43 -4
- package/seedgridKB/SeedGrid/Extensions/Catalogo-de-enums.md +161 -0
- package/seedgridKB/SeedGrid/Extensions/Catalogo-de-propriedades.md +971 -0
- package/seedgridKB/SeedGrid/Extensions/Indice.md +63 -0
- package/seedgridKB/SeedGrid/Extensions/ai-pricing/Configuracao.md +124 -0
- package/seedgridKB/SeedGrid/Extensions/ai-pricing/Enums.md +40 -0
- package/seedgridKB/SeedGrid/Extensions/ai-pricing/Exemplos.md +97 -0
- package/seedgridKB/SeedGrid/Extensions/ai-pricing/Visao-geral.md +114 -0
- package/seedgridKB/SeedGrid/Extensions/apikeys/Configuracao-Rust.md +69 -0
- package/seedgridKB/SeedGrid/Extensions/apikeys/Configuracao.md +88 -0
- package/seedgridKB/SeedGrid/Extensions/apikeys/Enums.md +33 -0
- package/seedgridKB/SeedGrid/Extensions/apikeys/Exemplos.md +121 -0
- package/seedgridKB/SeedGrid/Extensions/apikeys/Rust.md +126 -0
- package/seedgridKB/SeedGrid/Extensions/apikeys/Visao-geral.md +111 -0
- package/seedgridKB/SeedGrid/Extensions/audit/Configuracao-Rust.md +93 -0
- package/seedgridKB/SeedGrid/Extensions/audit/Configuracao.md +127 -0
- package/seedgridKB/SeedGrid/Extensions/audit/Enums.md +66 -0
- package/seedgridKB/SeedGrid/Extensions/audit/Exemplos.md +151 -0
- package/seedgridKB/SeedGrid/Extensions/audit/Rust.md +120 -0
- package/seedgridKB/SeedGrid/Extensions/audit/Visao-geral.md +114 -0
- package/seedgridKB/SeedGrid/Extensions/backup/Configuracao-Rust.md +136 -0
- package/seedgridKB/SeedGrid/Extensions/backup/Configuracao.md +319 -0
- package/seedgridKB/SeedGrid/Extensions/backup/Enums.md +131 -0
- package/seedgridKB/SeedGrid/Extensions/backup/Exemplos.md +210 -0
- package/seedgridKB/SeedGrid/Extensions/backup/Rust.md +135 -0
- package/seedgridKB/SeedGrid/Extensions/backup/Visao-geral.md +150 -0
- package/seedgridKB/SeedGrid/Extensions/billing/Configuracao-Rust.md +86 -0
- package/seedgridKB/SeedGrid/Extensions/billing/Configuracao.md +243 -0
- package/seedgridKB/SeedGrid/Extensions/billing/Enums.md +165 -0
- package/seedgridKB/SeedGrid/Extensions/billing/Exemplos.md +205 -0
- package/seedgridKB/SeedGrid/Extensions/billing/Rust.md +109 -0
- package/seedgridKB/SeedGrid/Extensions/billing/Visao-geral.md +181 -0
- package/seedgridKB/SeedGrid/Extensions/broker/Configuracao-Rust.md +40 -0
- package/seedgridKB/SeedGrid/Extensions/broker/Visao-geral.md +114 -0
- package/seedgridKB/SeedGrid/Extensions/cache/Configuracao-Rust.md +73 -0
- package/seedgridKB/SeedGrid/Extensions/cache/Configuracao.md +112 -0
- package/seedgridKB/SeedGrid/Extensions/cache/Enums.md +36 -0
- package/seedgridKB/SeedGrid/Extensions/cache/Exemplos.md +149 -0
- package/seedgridKB/SeedGrid/Extensions/cache/Rust.md +81 -0
- package/seedgridKB/SeedGrid/Extensions/cache/Visao-geral.md +90 -0
- package/seedgridKB/SeedGrid/Extensions/commons/Configuracao.md +107 -0
- package/seedgridKB/SeedGrid/Extensions/commons/Enums.md +105 -0
- package/seedgridKB/SeedGrid/Extensions/commons/Exemplos.md +141 -0
- package/seedgridKB/SeedGrid/Extensions/commons/Visao-geral.md +99 -0
- package/seedgridKB/SeedGrid/Extensions/exchange/Configuracao.md +122 -0
- package/seedgridKB/SeedGrid/Extensions/exchange/Enums.md +29 -0
- package/seedgridKB/SeedGrid/Extensions/exchange/Exemplos.md +82 -0
- package/seedgridKB/SeedGrid/Extensions/exchange/Visao-geral.md +118 -0
- package/seedgridKB/SeedGrid/Extensions/filemanagement/Configuracao-Rust.md +110 -0
- package/seedgridKB/SeedGrid/Extensions/filemanagement/Configuracao.md +157 -0
- package/seedgridKB/SeedGrid/Extensions/filemanagement/Exemplos.md +157 -0
- package/seedgridKB/SeedGrid/Extensions/filemanagement/Rust.md +70 -0
- package/seedgridKB/SeedGrid/Extensions/filemanagement/Visao-geral.md +88 -0
- package/seedgridKB/SeedGrid/Extensions/login-tenancy/Configuracao-Rust.md +124 -0
- package/seedgridKB/SeedGrid/Extensions/login-tenancy/Configuracao.md +195 -0
- package/seedgridKB/SeedGrid/Extensions/login-tenancy/Enums.md +71 -0
- package/seedgridKB/SeedGrid/Extensions/login-tenancy/Exemplos.md +149 -0
- package/seedgridKB/SeedGrid/Extensions/login-tenancy/Rust.md +139 -0
- package/seedgridKB/SeedGrid/Extensions/login-tenancy/Visao-geral.md +130 -0
- package/seedgridKB/SeedGrid/Extensions/notification/Configuracao.md +141 -0
- package/seedgridKB/SeedGrid/Extensions/notification/Enums.md +52 -0
- package/seedgridKB/SeedGrid/Extensions/notification/Exemplos.md +141 -0
- package/seedgridKB/SeedGrid/Extensions/notification/Visao-geral.md +113 -0
- package/seedgridKB/SeedGrid/Extensions/privacy/Configuracao-Rust.md +67 -0
- package/seedgridKB/SeedGrid/Extensions/privacy/Configuracao.md +94 -0
- package/seedgridKB/SeedGrid/Extensions/privacy/Enums.md +79 -0
- package/seedgridKB/SeedGrid/Extensions/privacy/Exemplos.md +172 -0
- package/seedgridKB/SeedGrid/Extensions/privacy/Rust.md +107 -0
- package/seedgridKB/SeedGrid/Extensions/privacy/Visao-geral.md +90 -0
- package/seedgridKB/SeedGrid/Extensions/realtime/Configuracao-Rust.md +72 -0
- package/seedgridKB/SeedGrid/Extensions/realtime/Configuracao.md +104 -0
- package/seedgridKB/SeedGrid/Extensions/realtime/Exemplos.md +104 -0
- package/seedgridKB/SeedGrid/Extensions/realtime/Rust.md +69 -0
- package/seedgridKB/SeedGrid/Extensions/realtime/Visao-geral.md +105 -0
- package/seedgridKB/SeedGrid/Extensions/resilience/Configuracao-Rust.md +68 -0
- package/seedgridKB/SeedGrid/Extensions/resilience/Configuracao.md +186 -0
- package/seedgridKB/SeedGrid/Extensions/resilience/Enums.md +96 -0
- package/seedgridKB/SeedGrid/Extensions/resilience/Exemplos.md +229 -0
- package/seedgridKB/SeedGrid/Extensions/resilience/Rust.md +80 -0
- package/seedgridKB/SeedGrid/Extensions/resilience/Visao-geral.md +112 -0
- package/seedgridKB/SeedGrid/Extensions/runtime/Configuracao-Rust.md +90 -0
- package/seedgridKB/SeedGrid/Extensions/runtime/Visao-geral.md +114 -0
- package/seedgridKB/SeedGrid/Extensions/security/Configuracao-Rust.md +327 -0
- package/seedgridKB/SeedGrid/Extensions/security/Configuracao.md +510 -0
- package/seedgridKB/SeedGrid/Extensions/security/Enums.md +95 -0
- package/seedgridKB/SeedGrid/Extensions/security/Exemplos.md +218 -0
- package/seedgridKB/SeedGrid/Extensions/security/Rust.md +203 -0
- package/seedgridKB/SeedGrid/Extensions/security/Visao-geral.md +131 -0
- package/seedgridKB/SeedGrid/Extensions/subdomain-tenancy/Configuracao-Rust.md +188 -0
- package/seedgridKB/SeedGrid/Extensions/subdomain-tenancy/Configuracao.md +345 -0
- package/seedgridKB/SeedGrid/Extensions/subdomain-tenancy/Enums.md +117 -0
- package/seedgridKB/SeedGrid/Extensions/subdomain-tenancy/Exemplos.md +205 -0
- package/seedgridKB/SeedGrid/Extensions/subdomain-tenancy/Rust.md +161 -0
- package/seedgridKB/SeedGrid/Extensions/subdomain-tenancy/Visao-geral.md +142 -0
- package/seedgridKB/SeedGrid/Extensions/whatsapp/Configuracao-Rust.md +75 -0
- package/seedgridKB/SeedGrid/Extensions/whatsapp/Configuracao.md +152 -0
- package/seedgridKB/SeedGrid/Extensions/whatsapp/Enums.md +198 -0
- package/seedgridKB/SeedGrid/Extensions/whatsapp/Exemplos.md +173 -0
- package/seedgridKB/SeedGrid/Extensions/whatsapp/Rust.md +83 -0
- package/seedgridKB/SeedGrid/Extensions/whatsapp/Visao-geral.md +99 -0
- package/seedgridKB/SeedGrid/Mapa-dos-repositorios.md +112 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/Indice.md +323 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/buttons/API.md +257 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/buttons/Exemplos.md +307 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/buttons/Visao-geral.md +51 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/datatable/API.md +174 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/datatable/Exemplos.md +236 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/datatable/Visao-geral.md +76 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/digits/API.md +339 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/digits/Exemplos.md +311 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/digits/Visao-geral.md +57 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/editor/API.md +125 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/editor/Exemplos.md +116 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/editor/Visao-geral.md +86 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/feedback-e-exibicao/API.md +490 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/feedback-e-exibicao/Exemplos.md +544 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/feedback-e-exibicao/Visao-geral.md +69 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/fundamentos/API.md +113 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/fundamentos/Exemplos.md +159 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/fundamentos/Visao-geral.md +92 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/gadgets/API.md +516 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/gadgets/Exemplos.md +629 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/gadgets/Visao-geral.md +80 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/inputs-selecao/API.md +615 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/inputs-selecao/Exemplos.md +384 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/inputs-selecao/Visao-geral.md +111 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/inputs-texto/API.md +661 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/inputs-texto/Exemplos.md +312 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/inputs-texto/Visao-geral.md +123 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/layout/API.md +1090 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/layout/Exemplos.md +1172 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/layout/Visao-geral.md +98 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/modulos/Visao-geral.md +98 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/modulos/fe-apikeys.md +118 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/modulos/fe-audit.md +88 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/modulos/fe-backup.md +131 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/modulos/fe-billing-platform.md +132 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/modulos/fe-billing-user.md +120 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/modulos/fe-login-tenancy.md +119 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/modulos/fe-security.md +427 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/modulos/fe-self-enter.md +104 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/modulos/fe-subdomain-tenancy.md +110 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/navegacao-e-overlay/API.md +490 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/navegacao-e-overlay/Exemplos.md +561 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/navegacao-e-overlay/Visao-geral.md +82 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/pacotes/Visao-geral.md +68 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/pacotes/fe-commons.md +61 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/pacotes/fe-core.md +140 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/pacotes/fe-playground.md +112 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/pacotes/fe-theme.md +97 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/providers/API.md +177 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/providers/Exemplos.md +332 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/providers/Visao-geral.md +106 -0
- package/seedgridKB/SeedGrid/SeedGrid-components/showcase.md +70 -0
- package/seedgridKB/SeedGrid/Toolkit/agents/arquiteto.md +53 -0
- package/seedgridKB/SeedGrid/Toolkit/agents/backend-java.md +45 -0
- package/seedgridKB/SeedGrid/Toolkit/agents/backend-rust.md +43 -0
- package/seedgridKB/SeedGrid/Toolkit/agents/frontend-react.md +41 -0
- package/seedgridKB/SeedGrid/Toolkit/agents/qa.md +44 -0
- package/seedgridKB/SeedGrid/Toolkit/agents/revisor.md +40 -0
- package/seedgridKB/SeedGrid/Toolkit/references/fluxo-de-trabalho.md +78 -0
- package/seedgridKB/SeedGrid/Toolkit/references/glossario.md +15 -0
- package/seedgridKB/SeedGrid/Toolkit/references/modos-shared-native.md +27 -0
- package/seedgridKB/SeedGrid/Toolkit/rules/backend-java-seedgrid.md +54 -0
- package/seedgridKB/SeedGrid/Toolkit/rules/coordenacao.md +39 -0
- package/seedgridKB/SeedGrid/Toolkit/rules/formato-entrega.md +29 -0
- package/seedgridKB/SeedGrid/Toolkit/rules/frontend-seedgrid.md +47 -0
- package/seedgridKB/SeedGrid/Toolkit/rules/personalizacao-local.md +22 -0
- package/seedgridKB/SeedGrid/Toolkit/skills/planejar-mudanca/SKILL.md +38 -0
- package/seedgridKB/SeedGrid/Toolkit/skills/revisar-codigo/SKILL.md +33 -0
- package/seedgridKB/SeedGrid/Toolkit/skills/revisar-codigo/references/checklist.md +25 -0
- package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-backend-crud/SKILL.md +29 -0
- package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-bump/SKILL.md +26 -0
- package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-crud/SKILL.md +221 -0
- package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-crud/agents/openai.yaml +4 -0
- package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-crud/references/checklist.md +31 -0
- package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-crud/references/patterns.md +185 -0
- package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-crud/references/routing.md +66 -0
- package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-new-screen/SKILL.md +56 -0
- package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-new-screen/agents/openai.yaml +4 -0
- package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-new-screen/references/checklist.md +32 -0
- package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-new-screen/references/steps.md +114 -0
- package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-review/SKILL.md +61 -0
- package/seedgridKB/SeedGrid/Toolkit/skills/validar-mudanca/SKILL.md +29 -0
- package/seedgridKB/SeedGrid/Toolkit/templates/decisao-arquitetura.md +29 -0
- package/seedgridKB/SeedGrid/Toolkit/templates/especificacao-tarefa.md +32 -0
- package/seedgridKB/SeedGrid/Toolkit/templates/relatorio-validacao.md +30 -0
- package/seedgridKB/SeedGrid/Versoes.md +64 -0
- package/seedgridKB/SeedGrid/Visao-geral.md +35 -0
- package/seedgridKB/manifest.json +142 -0
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
---
|
|
2
|
+
tags: [seedgrid, component, frontend, react, inputs-selecao, exemplos]
|
|
3
|
+
fonte: front/seedgrid-fe-components/apps/showcase/src/app/components
|
|
4
|
+
branch: main
|
|
5
|
+
commit: ad30fc11de
|
|
6
|
+
analisado-em: 2026-10-14
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Inputs de seleção: exemplos
|
|
10
|
+
|
|
11
|
+
Todos os exemplos foram conferidos contra [[SeedGrid/SeedGrid-components/inputs-selecao/API|API dos inputs de seleção]]. As fontes são relativas a `front/seedgrid-fe-components/apps/showcase/src/app/components/`. Os exemplos não foram compilados nem executados.
|
|
12
|
+
|
|
13
|
+
## SgAutocomplete com fonte assíncrona e `control`
|
|
14
|
+
|
|
15
|
+
Fonte: `sg-autocomplete/samples/basico.tsx.sample`. O formulário guarda o **texto** selecionado; o objeto completo chega por `onSelect`.
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import React from "react";
|
|
19
|
+
import { useForm } from "react-hook-form";
|
|
20
|
+
import { SgAutocomplete, type SgAutocompleteItem } from "@seedgrid/fe-components";
|
|
21
|
+
|
|
22
|
+
type Country = { id: number; description: string; code: string };
|
|
23
|
+
|
|
24
|
+
const COUNTRIES: Country[] = [
|
|
25
|
+
{ id: 1, description: "Afghanistan", code: "AF" },
|
|
26
|
+
{ id: 2, description: "Albania", code: "AL" },
|
|
27
|
+
{ id: 3, description: "Brazil", code: "BR" },
|
|
28
|
+
{ id: 4, description: "South Africa", code: "ZA" }
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const source = async (query: string) => {
|
|
32
|
+
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
33
|
+
const q = query.toLowerCase();
|
|
34
|
+
return COUNTRIES.filter((c) => c.description.toLowerCase().includes(q));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default function Example() {
|
|
38
|
+
const { control } = useForm({ defaultValues: { country: "" } });
|
|
39
|
+
const [selected, setSelected] = React.useState<SgAutocompleteItem | null>(null);
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<form>
|
|
43
|
+
<SgAutocomplete
|
|
44
|
+
id="country"
|
|
45
|
+
name="country"
|
|
46
|
+
control={control}
|
|
47
|
+
label="Country"
|
|
48
|
+
source={source}
|
|
49
|
+
mapItem={(raw) => ({ id: raw.id, label: raw.description })}
|
|
50
|
+
minLengthForSearch={1}
|
|
51
|
+
onSelect={(item) => setSelected(item)}
|
|
52
|
+
/>
|
|
53
|
+
{selected ? <pre>{JSON.stringify(selected, null, 2)}</pre> : null}
|
|
54
|
+
</form>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## SgCombobox com lista local agrupada
|
|
60
|
+
|
|
61
|
+
Fonte: `sg-combobox/samples/basico-com-lista-de-objetos.tsx.sample`, com a lista encurtada. O `value`/`onValueChange` trabalham com o **id**; `onSelect` entrega o objeto original.
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import * as React from "react";
|
|
65
|
+
import { SgCombobox } from "@seedgrid/fe-components";
|
|
66
|
+
|
|
67
|
+
type Country = { id: number; description: string; code: string; region: string };
|
|
68
|
+
|
|
69
|
+
const COUNTRIES: Country[] = [
|
|
70
|
+
{ id: 1, description: "Brazil", code: "BR", region: "Americas" },
|
|
71
|
+
{ id: 2, description: "Argentina", code: "AR", region: "Americas" },
|
|
72
|
+
{ id: 5, description: "Germany", code: "DE", region: "Europe" },
|
|
73
|
+
{ id: 7, description: "Portugal", code: "PT", region: "Europe" }
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
export default function Example() {
|
|
77
|
+
const [countryId, setCountryId] = React.useState<string | number | null>(null);
|
|
78
|
+
const [selectedCountry, setSelectedCountry] = React.useState<Country | null>(null);
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<>
|
|
82
|
+
<SgCombobox<Country>
|
|
83
|
+
id="cb-basic"
|
|
84
|
+
label="Country"
|
|
85
|
+
source={COUNTRIES}
|
|
86
|
+
value={countryId}
|
|
87
|
+
onValueChange={setCountryId}
|
|
88
|
+
grouped
|
|
89
|
+
mapItem={(raw) => ({ id: raw.id, label: raw.description, value: raw.code, group: raw.region })}
|
|
90
|
+
onSelect={(value) => setSelectedCountry(value)}
|
|
91
|
+
/>
|
|
92
|
+
<div>{selectedCountry ? JSON.stringify(selectedCountry, null, 2) : "No item selected"}</div>
|
|
93
|
+
</>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## SgCheckboxGroup controlado e via ref
|
|
99
|
+
|
|
100
|
+
Fontes: `sg-checkbox-group/samples/basico.tsx.sample` e `sg-checkbox-group/samples/ref-imperativo.tsx.sample`.
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
import React from "react";
|
|
104
|
+
import { SgButton, SgCheckboxGroup, SgGrid, type SgCheckboxGroupOption, type SgCheckboxGroupRef } from "@seedgrid/fe-components";
|
|
105
|
+
|
|
106
|
+
const BASIC_OPTIONS: SgCheckboxGroupOption[] = [
|
|
107
|
+
{ label: "Option 1", value: "option1" },
|
|
108
|
+
{ label: "Option 2", value: "option2" },
|
|
109
|
+
{ label: "Option 3", value: "option3" }
|
|
110
|
+
];
|
|
111
|
+
|
|
112
|
+
export default function Example() {
|
|
113
|
+
const [selected, setSelected] = React.useState<(string | number)[]>(["option1"]);
|
|
114
|
+
const checkboxRef = React.useRef<SgCheckboxGroupRef>(null);
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<>
|
|
118
|
+
<SgCheckboxGroup id="basic" title="Choose options" source={BASIC_OPTIONS} value={selected} onChange={setSelected} />
|
|
119
|
+
<SgCheckboxGroup ref={checkboxRef} id="ref-example" title="Select options" source={BASIC_OPTIONS} showCheckAll />
|
|
120
|
+
<SgGrid columns={{ base: 2, md: 4 }} gap={8}>
|
|
121
|
+
<SgButton onClick={() => console.log(checkboxRef.current?.getChecked())}>getChecked()</SgButton>
|
|
122
|
+
<SgButton onClick={() => checkboxRef.current?.checkAll()}>checkAll()</SgButton>
|
|
123
|
+
<SgButton onClick={() => checkboxRef.current?.clearAll()}>clearAll()</SgButton>
|
|
124
|
+
<SgButton onClick={() => checkboxRef.current?.setChecked(["option2"])}>setChecked</SgButton>
|
|
125
|
+
</SgGrid>
|
|
126
|
+
</>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## SgRadioGroup com `register`
|
|
132
|
+
|
|
133
|
+
Fonte: `sg-radio-group/samples/react-hook-form-register.tsx.sample`.
|
|
134
|
+
|
|
135
|
+
```tsx
|
|
136
|
+
import React from "react";
|
|
137
|
+
import { useForm } from "react-hook-form";
|
|
138
|
+
import { SgButton, SgRadioGroup, type SgRadioGroupOption } from "@seedgrid/fe-components";
|
|
139
|
+
|
|
140
|
+
const FRUIT_OPTIONS: SgRadioGroupOption[] = [
|
|
141
|
+
{ label: "Apple", value: "apple" },
|
|
142
|
+
{ label: "Banana", value: "banana" },
|
|
143
|
+
{ label: "Orange", value: "orange" },
|
|
144
|
+
{ label: "Uva", value: "grape" }
|
|
145
|
+
];
|
|
146
|
+
|
|
147
|
+
export default function Example() {
|
|
148
|
+
const { register, handleSubmit } = useForm();
|
|
149
|
+
return (
|
|
150
|
+
<form onSubmit={handleSubmit((data) => alert(JSON.stringify(data, null, 2)))} className="space-y-4">
|
|
151
|
+
<SgRadioGroup name="fruit" title="Choose your fruit" source={FRUIT_OPTIONS} register={register} />
|
|
152
|
+
<SgButton type="submit">Submit</SgButton>
|
|
153
|
+
</form>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## SgMultiSelect e SgMultiSelectChips
|
|
159
|
+
|
|
160
|
+
Fontes: `sg-multi-select/samples/limpavel-e-com-limite.tsx.sample` e `sg-multi-select-chips/samples/rotulo-curto.tsx.sample`.
|
|
161
|
+
|
|
162
|
+
```tsx
|
|
163
|
+
import * as React from "react";
|
|
164
|
+
import { SgButton, SgMultiSelect, SgMultiSelectChips, type SgMultiSelectOptionValue } from "@seedgrid/fe-components";
|
|
165
|
+
|
|
166
|
+
const COMPANIES = [
|
|
167
|
+
{ label: "Empresa 1", value: "e1" },
|
|
168
|
+
{ label: "Empresa 2", value: "e2" },
|
|
169
|
+
{ label: "Empresa 3", value: "e3" }
|
|
170
|
+
];
|
|
171
|
+
|
|
172
|
+
const BRANCHES = [
|
|
173
|
+
{ label: "1 - Matriz Sao Paulo", chipLabel: "1", value: 1 },
|
|
174
|
+
{ label: "2 - Filial Campinas", chipLabel: "2", value: 2 },
|
|
175
|
+
{ label: "3 - Filial Centro", chipLabel: "3", value: 3 }
|
|
176
|
+
];
|
|
177
|
+
|
|
178
|
+
export default function App() {
|
|
179
|
+
const [capped, setCapped] = React.useState<SgMultiSelectOptionValue[]>([]);
|
|
180
|
+
const [branches, setBranches] = React.useState<SgMultiSelectOptionValue[]>([1, 3]);
|
|
181
|
+
return (
|
|
182
|
+
<>
|
|
183
|
+
<SgMultiSelect
|
|
184
|
+
id="ms-capped"
|
|
185
|
+
label="Empresas (max 2)"
|
|
186
|
+
placeholder="Selecione ate 2 empresas"
|
|
187
|
+
options={COMPANIES}
|
|
188
|
+
value={capped}
|
|
189
|
+
onChange={setCapped}
|
|
190
|
+
clearable
|
|
191
|
+
maxSelected={2}
|
|
192
|
+
/>
|
|
193
|
+
<SgButton size="sm" appearance="outline" onClick={() => setCapped([])}>Clear</SgButton>
|
|
194
|
+
|
|
195
|
+
<SgMultiSelectChips
|
|
196
|
+
id="msc-chip-label"
|
|
197
|
+
label="Filiais"
|
|
198
|
+
placeholder="Selecione as empresas"
|
|
199
|
+
options={BRANCHES}
|
|
200
|
+
value={branches}
|
|
201
|
+
onChange={setBranches}
|
|
202
|
+
searchable
|
|
203
|
+
/>
|
|
204
|
+
</>
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## SgOrderList com controles externos por ref
|
|
210
|
+
|
|
211
|
+
Fonte: `sg-order-list/samples/selecao-multipla-controles-externos-ref.tsx.sample`.
|
|
212
|
+
|
|
213
|
+
```tsx
|
|
214
|
+
import React from "react";
|
|
215
|
+
import { SgButton, SgGrid, SgOrderList, type SgOrderListItem, type SgOrderListRef } from "@seedgrid/fe-components";
|
|
216
|
+
|
|
217
|
+
const PIPELINE_STEPS: SgOrderListItem[] = [
|
|
218
|
+
{ label: "Prospeccao", value: "lead" },
|
|
219
|
+
{ label: "Qualificacao", value: "qualify" },
|
|
220
|
+
{ label: "Proposta", value: "proposal" },
|
|
221
|
+
{ label: "Negociacao", value: "negotiation" },
|
|
222
|
+
{ label: "Fechamento", value: "close" }
|
|
223
|
+
];
|
|
224
|
+
|
|
225
|
+
export default function Example() {
|
|
226
|
+
const [pipelineItems, setPipelineItems] = React.useState<SgOrderListItem[]>(PIPELINE_STEPS);
|
|
227
|
+
const pipelineRef = React.useRef<SgOrderListRef>(null);
|
|
228
|
+
|
|
229
|
+
return (
|
|
230
|
+
<div className="space-y-4">
|
|
231
|
+
<SgOrderList
|
|
232
|
+
ref={pipelineRef}
|
|
233
|
+
id="order-ref"
|
|
234
|
+
title="Etapas do pipeline"
|
|
235
|
+
source={PIPELINE_STEPS}
|
|
236
|
+
value={pipelineItems}
|
|
237
|
+
onChange={setPipelineItems}
|
|
238
|
+
selectionMode="multiple"
|
|
239
|
+
showControls={false}
|
|
240
|
+
/>
|
|
241
|
+
<SgGrid columns={{ base: 2, md: 5 }} gap={8}>
|
|
242
|
+
<SgButton onClick={() => pipelineRef.current?.moveTop()}>Move Top</SgButton>
|
|
243
|
+
<SgButton onClick={() => pipelineRef.current?.moveUp()}>Move Up</SgButton>
|
|
244
|
+
<SgButton onClick={() => pipelineRef.current?.moveDown()}>Move Down</SgButton>
|
|
245
|
+
<SgButton onClick={() => pipelineRef.current?.moveBottom()}>Move Bottom</SgButton>
|
|
246
|
+
<SgButton onClick={() => pipelineRef.current?.clearSelection()}>Clear Selection</SgButton>
|
|
247
|
+
</SgGrid>
|
|
248
|
+
</div>
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## SgPickList controlado com filtros
|
|
254
|
+
|
|
255
|
+
Fonte: `sg-pick-list/samples/com-filtros.tsx.sample`.
|
|
256
|
+
|
|
257
|
+
```tsx
|
|
258
|
+
import React from "react";
|
|
259
|
+
import { SgPickList, type SgPickListItem } from "@seedgrid/fe-components";
|
|
260
|
+
|
|
261
|
+
export default function Example() {
|
|
262
|
+
const [filterValue, setFilterValue] = React.useState({
|
|
263
|
+
source: [
|
|
264
|
+
{ label: "Berlin", value: "berlin" },
|
|
265
|
+
{ label: "Boston", value: "boston" },
|
|
266
|
+
{ label: "Lisbon", value: "lisbon" },
|
|
267
|
+
{ label: "Madrid", value: "madrid" },
|
|
268
|
+
{ label: "Sao Paulo", value: "sao-paulo" }
|
|
269
|
+
] as SgPickListItem[],
|
|
270
|
+
target: [] as SgPickListItem[]
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
return (
|
|
274
|
+
<SgPickList
|
|
275
|
+
id="pick-filter"
|
|
276
|
+
title="Cities"
|
|
277
|
+
source={filterValue.source}
|
|
278
|
+
target={filterValue.target}
|
|
279
|
+
value={filterValue}
|
|
280
|
+
onChange={(event) => setFilterValue({ source: event.source, target: event.target })}
|
|
281
|
+
showSourceFilter
|
|
282
|
+
showTargetFilter
|
|
283
|
+
sourceHeader="Available"
|
|
284
|
+
targetHeader="Selected"
|
|
285
|
+
/>
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## SgPeriodSelector e SgYearPartSelector
|
|
291
|
+
|
|
292
|
+
Fontes: `sg-period-selector/samples/basico.tsx.sample` e `sg-year-part-selector/samples/so-semestre.tsx.sample`. Os dois entregam `startDate`/`endDate` já resolvidos.
|
|
293
|
+
|
|
294
|
+
```tsx
|
|
295
|
+
import * as React from "react";
|
|
296
|
+
import {
|
|
297
|
+
SgPeriodSelector,
|
|
298
|
+
SgYearPartSelector,
|
|
299
|
+
YearPartKind,
|
|
300
|
+
type ResolvedPeriod,
|
|
301
|
+
type ResolvedYearPart
|
|
302
|
+
} from "@seedgrid/fe-components";
|
|
303
|
+
|
|
304
|
+
export default function Example() {
|
|
305
|
+
const [period, setPeriod] = React.useState<ResolvedPeriod | null>(null);
|
|
306
|
+
const [resolved, setResolved] = React.useState<ResolvedYearPart | null>(null);
|
|
307
|
+
|
|
308
|
+
return (
|
|
309
|
+
<div className="w-full max-w-xl space-y-4">
|
|
310
|
+
<SgPeriodSelector id="ps-basic" label="Periodo" locale="pt-BR" onChange={setPeriod} />
|
|
311
|
+
<pre className="text-xs">
|
|
312
|
+
{period ? JSON.stringify({ preset: period.preset, start: period.startDate, end: period.endDate }, null, 2) : "Nenhum periodo selecionado"}
|
|
313
|
+
</pre>
|
|
314
|
+
|
|
315
|
+
<SgYearPartSelector
|
|
316
|
+
id="yps-semester"
|
|
317
|
+
label="Semestre de apuracao"
|
|
318
|
+
locale="pt-BR"
|
|
319
|
+
allowedKinds={[YearPartKind.SEMESTER]}
|
|
320
|
+
onChange={setResolved}
|
|
321
|
+
/>
|
|
322
|
+
<p className="text-xs">{resolved ? resolved.label : "Nenhum recorte confirmado ainda"}</p>
|
|
323
|
+
</div>
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
Uso sem componente, com a mesma lógica (exportada):
|
|
329
|
+
|
|
330
|
+
```ts
|
|
331
|
+
import { PeriodPreset, resolvePeriod, resolveYearPart, YearPartKind } from "@seedgrid/fe-components";
|
|
332
|
+
|
|
333
|
+
const mes = resolvePeriod(PeriodPreset.LAST_MONTH, new Date(), { locale: "pt-BR" });
|
|
334
|
+
const semestre = resolveYearPart({ year: 2024, kind: YearPartKind.SEMESTER, part: 1 }, "pt-BR");
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
## SgToggleSwitch com `register` e `control`
|
|
338
|
+
|
|
339
|
+
Fonte: `sg-toggle-switch/samples/react-hook-form.tsx.sample`.
|
|
340
|
+
|
|
341
|
+
```tsx
|
|
342
|
+
import * as React from "react";
|
|
343
|
+
import { Check, X } from "lucide-react";
|
|
344
|
+
import { useForm, type FieldValues } from "react-hook-form";
|
|
345
|
+
import { SgButton, SgToggleSwitch } from "@seedgrid/fe-components";
|
|
346
|
+
|
|
347
|
+
export default function Example() {
|
|
348
|
+
const { register, control, handleSubmit } = useForm<FieldValues>({
|
|
349
|
+
defaultValues: { notifications: false, active: true } as FieldValues
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
return (
|
|
353
|
+
<form onSubmit={handleSubmit((data) => console.log(data))}>
|
|
354
|
+
<SgToggleSwitch id="demo-rhf-register" name="notifications" label="Receber notificacoes por email" register={register} />
|
|
355
|
+
<SgToggleSwitch id="demo-rhf-control" name="active" label="Conta ativa" control={control} onIcon={<Check size={12} />} offIcon={<X size={12} />} />
|
|
356
|
+
<SgButton type="submit">Enviar</SgButton>
|
|
357
|
+
</form>
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
## SgRating, SgSlider e SgStepperInput (controlados)
|
|
363
|
+
|
|
364
|
+
Fontes: `sg-rating/samples/react-hook-form.tsx.sample` (com `control`), `sg-slider/samples/controle-externo.tsx.sample` e `sg-stepper-input/samples/controle-externo.tsx.sample`.
|
|
365
|
+
|
|
366
|
+
```tsx
|
|
367
|
+
import React from "react";
|
|
368
|
+
import { useForm, type FieldValues } from "react-hook-form";
|
|
369
|
+
import { SgRating, SgSlider, SgStepperInput } from "@seedgrid/fe-components";
|
|
370
|
+
|
|
371
|
+
export default function Example() {
|
|
372
|
+
const { control } = useForm<FieldValues>({ defaultValues: { productRating: 4 } });
|
|
373
|
+
const [volume, setVolume] = React.useState(35);
|
|
374
|
+
const [idade, setIdade] = React.useState(18);
|
|
375
|
+
|
|
376
|
+
return (
|
|
377
|
+
<div className="max-w-sm space-y-3">
|
|
378
|
+
<SgRating label="Rate the product" name="productRating" control={control} allowHalf />
|
|
379
|
+
<SgSlider id="slider-controlled" minValue={0} maxValue={100} value={volume} onChange={setVolume} ariaLabel="Volume" />
|
|
380
|
+
<SgStepperInput id="stepper-controlled" minValue={10} maxValue={30} step={1} value={idade} width={210} onChange={setIdade} />
|
|
381
|
+
</div>
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
```
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
tags: [seedgrid, component, frontend, react, inputs-selecao]
|
|
3
|
+
fonte: front/seedgrid-fe-components/packages/seedgrid-fe-components/src/inputs
|
|
4
|
+
branch: main
|
|
5
|
+
commit: ad30fc11de
|
|
6
|
+
analisado-em: 2026-10-14
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Inputs de seleção
|
|
10
|
+
|
|
11
|
+
São 15 componentes públicos de escolha (de lista, booleana, numérica ou de período) do pacote `@seedgrid/fe-components` (v`2026.7.1`), mais 2 peças internas (`SgMultiSelectDropdown`, `useSgMultiSelect`). Props completas, eventos e refs: [[SeedGrid/SeedGrid-components/inputs-selecao/API|API dos inputs de seleção]]. Código: [[SeedGrid/SeedGrid-components/inputs-selecao/Exemplos|Exemplos dos inputs de seleção]]. Base compartilhada: [[SeedGrid/SeedGrid-components/inputs-texto/Visao-geral|inputs de texto]].
|
|
12
|
+
|
|
13
|
+
## Quando usar cada um
|
|
14
|
+
|
|
15
|
+
| Componente | Use para | Valor emitido |
|
|
16
|
+
|---|---|---|
|
|
17
|
+
| `SgAutocomplete` | Busca em fonte grande ou remota, com sugestões enquanto o usuário digita (debounce, cache, agrupamento) | texto do item (`string`); objeto via `onSelect` |
|
|
18
|
+
| `SgCombobox` | Select de uma opção a partir de lista fixa ou carregada uma vez (type-ahead, agrupamento) | `id` do item (`string \| number \| null`); objeto cru via `onSelect` |
|
|
19
|
+
| `SgCheckboxGroup` | Poucas opções, várias escolhas, todas visíveis; "selecionar todos" | `(string \| number)[]` |
|
|
20
|
+
| `SgRadioGroup` | Poucas opções, uma escolha, todas visíveis | `string \| number \| null` |
|
|
21
|
+
| `SgMultiSelect` | Várias escolhas em dropdown compacto (resumo "N selecionadas") | `(string \| number)[]` |
|
|
22
|
+
| `SgMultiSelectChips` | Várias escolhas exibidas como chips removíveis | `(string \| number)[]` |
|
|
23
|
+
| `SgOrderList` | Ordenar uma lista (prioridade, etapas) | `SgOrderListItem[]` |
|
|
24
|
+
| `SgPickList` | Transferir itens entre "disponíveis" e "selecionados" | `{source, target, type}` |
|
|
25
|
+
| `SgPeriodSelector` | Filtro de período relativo a hoje ("este mês", "últimos…", personalizado) | `ResolvedPeriod` (RHF guarda o preset) |
|
|
26
|
+
| `SgYearPartSelector` | Recorte absoluto do ano (semestre, trimestre ou bimestre de um ano X) | `ResolvedYearPart` |
|
|
27
|
+
| `SgToggleSwitch` | Liga/desliga booleano | `boolean` |
|
|
28
|
+
| `SgRating` | Avaliação por estrelas (inteiras ou meias) | `number` |
|
|
29
|
+
| `SgSlider` | Número em faixa contínua (range nativo) | `number` |
|
|
30
|
+
| `SgStepperInput` | Número inteiro ou com passo, com botões +/− | `number` |
|
|
31
|
+
|
|
32
|
+
A grafia antiga `groupped` ainda é aceita como alias de `grouped` em `SgAutocomplete` e `SgCombobox`. **Confirmado**.
|
|
33
|
+
|
|
34
|
+
## Composição
|
|
35
|
+
|
|
36
|
+
```mermaid
|
|
37
|
+
graph TD
|
|
38
|
+
IT[SgInputText] --> AC[SgAutocomplete]
|
|
39
|
+
IT --> CB[SgCombobox]
|
|
40
|
+
IT --> MS[SgMultiSelect]
|
|
41
|
+
H[useSgMultiSelect - interno] --> MS
|
|
42
|
+
H --> MSC[SgMultiSelectChips]
|
|
43
|
+
DD[SgMultiSelectDropdown - interno] --> MS
|
|
44
|
+
DD --> MSC
|
|
45
|
+
CB --> PS[SgPeriodSelector]
|
|
46
|
+
ID[SgInputDate] --> PS
|
|
47
|
+
CB --> YP[SgYearPartSelector]
|
|
48
|
+
YPM[yearPart.ts - funções puras] --> YP
|
|
49
|
+
GB[SgGroupBox] --> CG[SgCheckboxGroup]
|
|
50
|
+
GB --> RG[SgRadioGroup]
|
|
51
|
+
GB --> OL[SgOrderList]
|
|
52
|
+
GB --> PL[SgPickList]
|
|
53
|
+
BT[SgButton] --> OL
|
|
54
|
+
BT --> PL
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- **Dropdowns:** são renderizados em **portal** em `document.body`, com `position: fixed` e `z-index` 1100. A posição é recalculada em `resize` e `scroll` (captura). Vale para Autocomplete, Combobox e MultiSelect/Chips.
|
|
58
|
+
- **Lógica pura reaproveitável:** `resolvePeriod`/`buildPeriodOptions` e as funções de `yearPart.ts` são exportadas e funcionam sem React.
|
|
59
|
+
|
|
60
|
+
**Confirmado**.
|
|
61
|
+
|
|
62
|
+
## Dependências
|
|
63
|
+
|
|
64
|
+
- **Peers:** `react`, `react-hook-form` (importado estaticamente) e `lucide-react` (ícones `ChevronDown`, `Check`, `X`). `react-dom` é usado via `createPortal`. Ele não está em `peerDependencies`, só em devDependencies (**Confirmado**). Na prática vem junto com o React DOM da aplicação (**Inferência**).
|
|
65
|
+
- **Componentes internos do pacote:** `SgInputText`, `SgInputDate`, `SgGroupBox` (`src/layout/SgGroupBox`) e `SgButton` (`src/buttons/SgButton`).
|
|
66
|
+
|
|
67
|
+
## Tema e estilos
|
|
68
|
+
|
|
69
|
+
- O CSS é injetado automaticamente na importação do pacote; também existe `@seedgrid/fe-components/style.css`. Ver [[SeedGrid/SeedGrid-components/inputs-texto/Visao-geral#Tema e estilos|Tema e estilos]].
|
|
70
|
+
- **Variáveis do tema:**
|
|
71
|
+
- Listas e grupos usam variáveis RGB: `--sg-surface`, `--sg-bg`, `--sg-text`, `--sg-fg`, `--sg-border`, `--sg-primary-500`, `--sg-ring`, `--sg-muted`.
|
|
72
|
+
- Inputs usam as HSL do tema (`--primary`, `--destructive`, `--muted-foreground`).
|
|
73
|
+
- `SgRating` usa `hsl(var(--primary))` e `hsl(var(--muted-foreground))` como cores padrão.
|
|
74
|
+
- **Customização:** `className`, `style`, `optionClassName`, `listClassName`, `itemClassName`, `groupBoxProps`, além dos `*ClassName` do switch.
|
|
75
|
+
|
|
76
|
+
**Confirmado**.
|
|
77
|
+
|
|
78
|
+
## Internacionalização
|
|
79
|
+
|
|
80
|
+
- **Provider:** textos padrão via `useComponentsI18n()`. Chaves usadas por este grupo:
|
|
81
|
+
- `components.autocomplete.{empty,loading}`;
|
|
82
|
+
- `components.actions.{openList,clearSelection,search,top,up,down,bottom}`;
|
|
83
|
+
- `components.inputs.{select.placeholder,multiSelect.summary,multiSelect.removeChip,toggle.ariaLabel,stepper.increase,stepper.decrease,required}`;
|
|
84
|
+
- `components.checkboxgroup.checkAll`, `components.orderlist.*`, `components.picklist.*`, `components.rating.{cancel,required}`.
|
|
85
|
+
- **Exceção:** `SgPeriodSelector` e `SgYearPartSelector` **não** usam o provider. Eles têm tabelas próprias de rótulos (pt-BR, en-US, es, pt-PT, fr) e um prop `locale`, que por padrão é `"pt-BR"`.
|
|
86
|
+
|
|
87
|
+
**Confirmado**.
|
|
88
|
+
|
|
89
|
+
## Testes existentes (lidos, **não executados**)
|
|
90
|
+
|
|
91
|
+
- `tests/inputs-dom.test.mjs`: `SgAutocomplete` (4 cenários), `SgMultiSelect` (6), `SgMultiSelectChips` (6).
|
|
92
|
+
- `tests/inputs-i18n.test.mjs`: `aria-label` do `SgToggleSwitch`.
|
|
93
|
+
- `tests/rhf-components-contract.test.mjs`: confere, por regex no código-fonte, os caminhos RHF de Autocomplete, Slider, StepperInput, Combobox, MultiSelect, MultiSelectChips, OrderList e PickList.
|
|
94
|
+
- `tests/period-resolver.test.mjs` e `tests/year-part-resolver.test.mjs`: lógica de datas.
|
|
95
|
+
|
|
96
|
+
## Limitações e pontos de atenção
|
|
97
|
+
|
|
98
|
+
- **Abertura das listas:** `SgCombobox` e `SgMultiSelect` abrem no clique (`onMouseDown`) ou pelo teclado (↓/Enter/Espaço). O `SgAutocomplete` abre ao digitar ou pelo botão dropdown. Abrir ao receber foco não é suportado: o `SgInputText` sobrescreve o `inputProps.onFocus`. **Confirmado** pela ordem dos atributos no JSX.
|
|
99
|
+
- **Integração com RHF incompleta:**
|
|
100
|
+
- `SgCombobox`, `SgMultiSelect`, `SgMultiSelectChips`, `SgOrderList`, `SgPickList`, `SgPeriodSelector` e `SgRating` integram só por `control` + `name`.
|
|
101
|
+
- `SgYearPartSelector` não tem integração.
|
|
102
|
+
- `required` só vira regra RHF automaticamente em Autocomplete, CheckboxGroup, RadioGroup, ToggleSwitch e Rating.
|
|
103
|
+
|
|
104
|
+
**Confirmado**.
|
|
105
|
+
- **Ref:** o `SgCheckboxGroup` perde o ref imperativo quando usado com `control`. **Confirmado**.
|
|
106
|
+
- **Acessibilidade:**
|
|
107
|
+
- `SgRating` não é operável por teclado.
|
|
108
|
+
- `SgAutocomplete` e `SgCombobox` não expõem roles ARIA de combobox/listbox, ao contrário de `SgMultiSelect`/`SgMultiSelectChips`.
|
|
109
|
+
|
|
110
|
+
**Confirmado**.
|
|
111
|
+
- **`inputProps` espalhado por último:** em `SgSlider`/`SgStepperInput`, o `{...inputProps}` vem depois dos handlers internos, o que pode anular o `onChange` interno no caminho `register`. **Inferência**.
|