@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,257 @@
|
|
|
1
|
+
---
|
|
2
|
+
tags: [seedgrid, front, component, buttons]
|
|
3
|
+
fonte: front/seedgrid-fe-components/packages/seedgrid-fe-components/src/buttons
|
|
4
|
+
branch: main
|
|
5
|
+
commit: ad30fc11de
|
|
6
|
+
analisado-em: 2026-10-14
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# API — botões (`src/buttons`)
|
|
10
|
+
|
|
11
|
+
Visão geral: [[SeedGrid/SeedGrid-components/buttons/Visao-geral|Botões — visão geral]] · Exemplos: [[SeedGrid/SeedGrid-components/buttons/Exemplos|Exemplos de botões]]
|
|
12
|
+
|
|
13
|
+
> **Como ler as tabelas.** Geradas a partir do tipo TypeScript real do 1º parâmetro de cada componente (TS checker, commit `ad30fc11de`) — lista completa das props próprias. **Padrão**: valor sem marca = inicializador na desestruturação do componente (Confirmado); `ᶠ` = fallback interno `??` no corpo do componente (Confirmado, expressão pode estar abreviada); `ᵇ` = padrão aplicado pelo componente base para o qual a prop é repassada; `ᵐ` = declarado só no `*.meta.ts`; `ˢ` = declarado só na tabela de props do showcase (`ᵐ`/`ˢ` = Não confirmado no código); `—` = sem padrão. **Descrição**: JSDoc > `*.meta.ts` > tabela do showcase (textos originais, sem acento quando assim na fonte); *(Inferência)* = escrita a partir da leitura do código. **Obrigatória** = prop não opcional no tipo.
|
|
14
|
+
|
|
15
|
+
Todos os arquivos são `"use client"`. Textos padrão (aria-labels, "abrir/fechar") vêm do i18n do pacote via `useComponentsI18n()` — ver [[SeedGrid/SeedGrid-components/fundamentos/API|API › i18n]].
|
|
16
|
+
|
|
17
|
+
## SgButton
|
|
18
|
+
|
|
19
|
+
Botão de ação com severidade, aparência, formato, elevação, ícones e estado de carregamento. Fonte: `front/seedgrid-fe-components/packages/seedgrid-fe-components/src/buttons/SgButton.tsx` → `SgButton` (`React.forwardRef`).
|
|
20
|
+
|
|
21
|
+
### Import
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { SgButton, type SgButtonProps, type SgButtonCustomColors } from "@seedgrid/fe-components";
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Props
|
|
28
|
+
|
|
29
|
+
| Prop | Tipo | Padrão | Obrigatória | Descrição |
|
|
30
|
+
|---|---|---|---|---|
|
|
31
|
+
| `severity` | `Severity` = `"primary" \| "secondary" \| "success" \| "info" \| "warning" \| "help" \| "danger"` | `"primary"` | Não | Define o peso visual e semantico da acao. |
|
|
32
|
+
| `appearance` | `Appearance` = `"solid" \| "outline" \| "ghost"` | `"solid"` | Não | Variante visual base do botao. |
|
|
33
|
+
| `size` | `Size` = `"sm" \| "md" \| "lg"` | `?? (isIconOnly ? "sm" : "md")` ᶠ | Não | Tamanho do componente. |
|
|
34
|
+
| `shape` | `Shape` = `"default" \| "rounded" \| "square" \| "circle"` | `?? (isIconOnly ? "circle" : "default")` ᶠ | Não | Formato das bordas. |
|
|
35
|
+
| `elevation` | `Elevation` = `"sm" \| "md" \| "none"` | `"none"` | Não | Nível de elevação/sombra. |
|
|
36
|
+
| `label` | `React.ReactNode` | — | Não | Conteudo textual principal do botao. Usado apenas quando `children` não é informado (`children ?? label`). |
|
|
37
|
+
| `iconOnly` | `boolean` | inferido ᶠ | Não | Força o modo somente-ícone (quadrado, sem texto). Se omitido, é inferido como verdadeiro quando não há `children`/`label` e existe `leftIcon` ou `rightIcon`; afeta os padrões de `size` (`sm`) e `shape` (`circle`). *(Inferência)* |
|
|
38
|
+
| `leftIcon` | `React.ReactNode` | — | Não | Icone exibido antes do label. |
|
|
39
|
+
| `rightIcon` | `React.ReactNode` | — | Não | Icone exibido depois do label. |
|
|
40
|
+
| `loading` | `boolean` | `false` | Não | Exibe spinner e bloqueia interacao enquanto a acao esta em progresso. |
|
|
41
|
+
| `customColors` | `SgButtonCustomColors` | — | Não | Sobrescreve cores de fundo, texto, borda e foco. |
|
|
42
|
+
|
|
43
|
+
- **Atributos DOM herdados**: o tipo é `Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "color"> & { ... }`; acrescenta 287 props de `@types/react` (`ButtonHTMLAttributes` 10, `HTMLAttributes` 54, `AriaAttributes` 53, `DOMAttributes` 170), incluindo `children`. Não listadas individualmente — ver contrato base `React.ButtonHTMLAttributes` em `@types/react`.
|
|
44
|
+
- Aceita `ref` (via `React.forwardRef`) e `key`.
|
|
45
|
+
- Prop herdada com padrão próprio: `type` (de `ButtonHTMLAttributes`) tem padrão `"button"` na desestruturação — o botão **não** submete formulários a menos que se passe `type="submit"` (Confirmado).
|
|
46
|
+
- `disabled` (herdada) é combinada com `loading`: o `<button>` fica `disabled` se qualquer um for verdadeiro (Confirmado).
|
|
47
|
+
- `children` (herdada) tem prioridade sobre `label` (`children ?? label`). Demais atributos (`onClick`, `aria-*`, `form`, `name`…) são repassados ao `<button>` via `{...rest}` (Confirmado). `style` é mesclado depois das variáveis CSS de cor.
|
|
48
|
+
|
|
49
|
+
### Eventos e callbacks
|
|
50
|
+
|
|
51
|
+
- `onClick` e todos os eventos DOM de `<button>` (herdados) — repassados diretamente. Com `loading` ou `disabled`, o botão nativo fica desabilitado e não dispara cliques.
|
|
52
|
+
|
|
53
|
+
### Ref
|
|
54
|
+
|
|
55
|
+
`React.forwardRef<HTMLButtonElement, SgButtonProps>` — a ref aponta para o `<button>` nativo (Confirmado).
|
|
56
|
+
|
|
57
|
+
### Children, slots e composição
|
|
58
|
+
|
|
59
|
+
- Conteúdo: `children` ou `label`; slots `leftIcon` / `rightIcon`. Em `loading`, os ícones são substituídos por um spinner SVG (`aria-hidden`) e o texto continua visível.
|
|
60
|
+
- Modo somente-ícone: inferido quando não há texto e existe ícone (ou forçado com `iconOnly`) → `aspect-square`, padrão `size="sm"` e `shape="circle"`.
|
|
61
|
+
- `SgSplitButton` e vários outros componentes usam `SgButton` internamente.
|
|
62
|
+
|
|
63
|
+
### Contexto, providers e hooks
|
|
64
|
+
|
|
65
|
+
Nenhum contexto consumido.
|
|
66
|
+
|
|
67
|
+
### Acessibilidade
|
|
68
|
+
|
|
69
|
+
- Elemento nativo `<button>` (foco e teclado nativos); anel de foco `focus-visible` com a cor `ring` (Confirmado).
|
|
70
|
+
- Spinner com `aria-hidden="true"`. Botões somente-ícone **não** recebem `aria-label` automático — informe `aria-label` (Confirmado: nenhum aria-label é gerado no componente).
|
|
71
|
+
|
|
72
|
+
### Tipos auxiliares exportados
|
|
73
|
+
|
|
74
|
+
`SgButtonCustomColors` — todas opcionais, `string` (qualquer cor CSS), viram variáveis CSS `--sg-btn-*`:
|
|
75
|
+
|
|
76
|
+
| Campo | Uso |
|
|
77
|
+
|---|---|
|
|
78
|
+
| `bg` | fundo |
|
|
79
|
+
| `fg` | texto |
|
|
80
|
+
| `border` | borda |
|
|
81
|
+
| `hoverBg` | fundo em hover |
|
|
82
|
+
| `hoverFg` | texto em hover |
|
|
83
|
+
| `hoverBorder` | borda em hover |
|
|
84
|
+
| `activeBg` | fundo ativo |
|
|
85
|
+
| `ring` | anel de foco |
|
|
86
|
+
|
|
87
|
+
Os tipos `Severity`, `Appearance`, `Size`, `Shape`, `Elevation` são aliases **internos** (não exportados); os valores aceitos estão na tabela.
|
|
88
|
+
|
|
89
|
+
## SgSplitButton
|
|
90
|
+
|
|
91
|
+
Botão com ação principal + botão de seta que abre um menu de ações secundárias. Fonte: `src/buttons/SgSplitButton.tsx` → `SgSplitButton` (`React.forwardRef`). Compõe dois `SgButton`.
|
|
92
|
+
|
|
93
|
+
### Import
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
import { SgSplitButton, type SgSplitButtonProps, type SgSplitButtonItem } from "@seedgrid/fe-components";
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Props
|
|
100
|
+
|
|
101
|
+
| Prop | Tipo | Padrão | Obrigatória | Descrição |
|
|
102
|
+
|---|---|---|---|---|
|
|
103
|
+
| `label` | `string` | — | Não | Conteudo textual principal da acao. |
|
|
104
|
+
| `leftIcon` | `React.ReactNode` | — | Não | Icone exibido junto do label principal. |
|
|
105
|
+
| `severity` | `Severity` = `"primary" \| "secondary" \| "success" \| "info" \| "warning" \| "help" \| "danger"` | `"primary"` | Não | Peso visual e semantico da acao principal. |
|
|
106
|
+
| `appearance` | `Appearance` = `"solid" \| "outline" \| "ghost"` | `"solid"` | Não | Variante visual base do split button. |
|
|
107
|
+
| `size` | `Size` = `"sm" \| "md" \| "lg"` | `"md"` | Não | Tamanho do componente (repassado ao `SgButton`; também ajusta o menu). |
|
|
108
|
+
| `shape` | `Shape` = `"default" \| "rounded" \| "square"` | `"default"` | Não | Formato das bordas dos dois botões internos (repassado ao `SgButton`). *(Inferência)* |
|
|
109
|
+
| `elevation` | `Elevation` = `"sm" \| "md" \| "none"` | `"none"` | Não | Nível de elevação/sombra dos botões. |
|
|
110
|
+
| `disabled` | `boolean` | `false` | Não | Desabilita a acao principal e o menu secundario. |
|
|
111
|
+
| `loading` | `boolean` | `false` | Não | Exibe estado de carregamento na acao principal. |
|
|
112
|
+
| `onClick` | `() => void` | — | Não | Callback disparado na acao principal. |
|
|
113
|
+
| `items` | `SgSplitButtonItem[]` | — | Sim | Lista de acoes secundarias exibidas no menu dropdown. |
|
|
114
|
+
| `customColors` | `SgButtonCustomColors` | — | Não | Cores personalizadas repassadas aos dois `SgButton` internos (mesmo contrato `SgButtonCustomColors`). *(Inferência)* |
|
|
115
|
+
| `className` | `string` | — | Não | Visual customization of the split button container. |
|
|
116
|
+
| `style` | `React.CSSProperties` | — | Não | Estilo inline do container. |
|
|
117
|
+
|
|
118
|
+
- Aceita `ref` (via `React.forwardRef`) e `key`.
|
|
119
|
+
- Não há herança de atributos DOM: apenas `className` e `style` chegam ao `<div>` container (Confirmado).
|
|
120
|
+
|
|
121
|
+
### Eventos e callbacks
|
|
122
|
+
|
|
123
|
+
- `onClick: () => void` — clique no botão principal (repassado ao 1º `SgButton`).
|
|
124
|
+
- `items[i].onClick: () => void` — clique no item; em seguida o menu fecha. Itens com `disabled` são ignorados.
|
|
125
|
+
- O menu fecha em clique fora do container (`mousedown` no `document`) e em `Escape` (Confirmado; testado em `tests/buttons-menus-dom.test.mjs`).
|
|
126
|
+
|
|
127
|
+
### Ref
|
|
128
|
+
|
|
129
|
+
`React.forwardRef<HTMLDivElement, SgSplitButtonProps>` — exposta via `useImperativeHandle` como o `<div>` container (Confirmado).
|
|
130
|
+
|
|
131
|
+
### Children, slots e composição
|
|
132
|
+
|
|
133
|
+
Sem `children`. Slots: `label`, `leftIcon` (botão principal); itens do menu via `items`. O botão de seta fica desabilitado com `disabled` **ou** `loading`.
|
|
134
|
+
|
|
135
|
+
### Contexto, providers e hooks
|
|
136
|
+
|
|
137
|
+
Usa `useComponentsI18n()` para o `aria-label` do botão de seta (`components.actions.openList` / `components.actions.close`).
|
|
138
|
+
|
|
139
|
+
### Acessibilidade
|
|
140
|
+
|
|
141
|
+
- Botão de seta: `aria-haspopup="menu"`, `aria-expanded`, `aria-label` traduzido (Confirmado; testado em `tests/buttons-menus.test.mjs`).
|
|
142
|
+
- Menu: `role="menu"`; itens são `<button type="button" role="menuitem">`. Não há navegação por setas entre itens nem gestão de foco ao abrir (Confirmado: só `Escape` é tratado).
|
|
143
|
+
|
|
144
|
+
### Tipos auxiliares exportados
|
|
145
|
+
|
|
146
|
+
`SgSplitButtonItem`:
|
|
147
|
+
|
|
148
|
+
| Campo | Tipo | Obrigatório | Descrição |
|
|
149
|
+
|---|---|---|---|
|
|
150
|
+
| `label` | `string` | Sim | Texto do item |
|
|
151
|
+
| `icon` | `React.ReactNode` | Não | Ícone à esquerda |
|
|
152
|
+
| `onClick` | `() => void` | Não | Ação do item |
|
|
153
|
+
| `disabled` | `boolean` | Não | Desabilita o item |
|
|
154
|
+
| `separator` | `boolean` | Não | Desenha uma linha divisória **antes** do item (ignorado no 1º item) |
|
|
155
|
+
|
|
156
|
+
## SgFloatActionButton
|
|
157
|
+
|
|
158
|
+
Botão de ação flutuante (FAB) com ações secundárias em layout linear/circular, tooltip, animações, ocultação ao rolar e arrastar-e-soltar com posição persistida. Fonte: `src/buttons/SgFloatActionButton.tsx` → `SgFloatActionButton` (função, sem forwardRef).
|
|
159
|
+
|
|
160
|
+
### Import
|
|
161
|
+
|
|
162
|
+
```tsx
|
|
163
|
+
import {
|
|
164
|
+
SgFloatActionButton,
|
|
165
|
+
type SgFloatActionButtonProps, type SgFABAction,
|
|
166
|
+
type FABPosition, type FABSeverity, type FABSize, type FABShape,
|
|
167
|
+
type FABElevation, type FABAnimation, type FABAnimationTrigger, type FABLayoutType
|
|
168
|
+
} from "@seedgrid/fe-components";
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Props
|
|
172
|
+
|
|
173
|
+
| Prop | Tipo | Padrão | Obrigatória | Descrição |
|
|
174
|
+
|---|---|---|---|---|
|
|
175
|
+
| `hint` | `string` | — | Não | Texto do tooltip exibido após `hintDelay` ms de hover. Também é usado como `aria-label` do botão; sem `hint`, o `aria-label` usa os textos i18n de abrir/fechar. *(Inferência)* |
|
|
176
|
+
| `hintPosition` | `"top" \| "right" \| "bottom" \| "left"` | `?? DEFAULT_HINT[position]` ᶠ (lado oposto à borda; ex.: `right-bottom` → `left`) | Não | Configuracoes do tooltip de dica. |
|
|
177
|
+
| `hintDelay` | `number` | `300` | Não | Configuracoes do tooltip de dica. |
|
|
178
|
+
| `icon` | `React.ReactNode` | ícone `+` interno ᶠ | Não | Icone principal exibido no FAB. |
|
|
179
|
+
| `activeIcon` | `React.ReactNode` | — | Não | Icone principal e icone alternativo quando aberto. |
|
|
180
|
+
| `position` | `FABPosition` = `"left-top" \| "left-center" \| "left-bottom" \| "center-top" \| "center-bottom" \| "right-top" \| "right-center" \| "right-bottom"` | `"right-bottom"` | Não | Posicao do FAB na area visivel. |
|
|
181
|
+
| `offset` | `{ x?: number; y?: number }` | — | Não | Deslocamento em px aplicado à posição calculada (`x` desloca horizontalmente, `y` verticalmente, a partir da borda de ancoragem). *(Inferência)* |
|
|
182
|
+
| `enableDragDrop` | `boolean` | `false` | Não | Habilita o comportamento de arrastar e soltar. |
|
|
183
|
+
| `dragId` | `string` | — | Não | Habilita o comportamento de arrastar e soltar. |
|
|
184
|
+
| `severity` | `FABSeverity` = `"primary" \| "secondary" \| "success" \| "info" \| "warning" \| "help" \| "danger" \| "plain"` | `"primary"` | Não | Peso visual da acao flutuante. |
|
|
185
|
+
| `color` | `string` | cor da severidade ᶠ | Não | Cor de fundo personalizada do FAB (qualquer cor CSS); quando informada o texto fica branco e o anel de foco é derivado via `color-mix`. *(Inferência)* |
|
|
186
|
+
| `size` | `FABSize` = `"sm" \| "md" \| "lg"` | `"md"` | Não | Tamanho do FAB. |
|
|
187
|
+
| `shape` | `FABShape` = `"rounded" \| "square" \| "circle"` | `"circle"` | Não | Formato do botao. |
|
|
188
|
+
| `elevation` | `FABElevation` = `"sm" \| "md" \| "lg" \| "none"` | `"md"` | Não | Intensidade da sombra. |
|
|
189
|
+
| `disabled` | `boolean` | `false` | Não | Desabilita a acao principal e as acoes derivadas. |
|
|
190
|
+
| `loading` | `boolean` | `false` | Não | Exibe estado de carregamento no FAB. |
|
|
191
|
+
| `autoHideOnScroll` | `boolean` | `false` | Não | Oculta o FAB ao rolar a janela (listener em `window.scroll`, limiar de 5 px). *(Inferência)* |
|
|
192
|
+
| `hideDirection` | `"down" \| "up"` | `"down"` | Não | Sentido de rolagem que oculta o FAB quando `autoHideOnScroll` está ativo (`down` = ao rolar para baixo). *(Inferência)* |
|
|
193
|
+
| `animation` | `FABAnimation` = `"none" \| "scale" \| "slide" \| "fade" \| "rotate" \| "pulse"` | `"scale"` | Não | Configuracoes de animacao visual. |
|
|
194
|
+
| `animationOn` | `FABAnimationTrigger` = `"mount" \| "hover" \| "click"` | `"mount"` | Não | Configuracoes de animacao visual. |
|
|
195
|
+
| `animationDuration` | `number` | `200` | Não | Duração em ms das animações do FAB (também usada para encerrar o estado de clique). *(Inferência)* |
|
|
196
|
+
| `direction` | `"up" \| "down" \| "left" \| "right"` | `?? DEFAULT_DIR[position]` ᶠ (ex.: `right-bottom` → `up`) | Não | Direcao usada nos layouts linear e parcial. |
|
|
197
|
+
| `type` | `FABLayoutType` = `"circle" \| "linear" \| "semi-circle" \| "quarter-circle"` | `"linear"` | Não | Tipo de distribuicao do layout das acoes. |
|
|
198
|
+
| `radius` | `number` | `?? DEFAULT_RADIUS[size]` ᶠ (sm 100, md 120, lg 150) | Não | Raio (px) para layouts `circle`, `semi-circle` e `quarter-circle`. |
|
|
199
|
+
| `transitionDelay` | `number` | `30` | Não | Atraso em ms entre a entrada de cada ação (escalonamento; invertido ao fechar). *(Inferência)* |
|
|
200
|
+
| `actions` | `SgFABAction[]` | — | Não | Acoes secundarias exibidas a partir do botao flutuante. Se houver ações, o clique abre/fecha o menu em vez de chamar `onClick`. |
|
|
201
|
+
| `onClick` | `() => void` | — | Não | Callback da acao principal do FAB. |
|
|
202
|
+
| `className` | `string` | — | Não | Classes CSS extras do container posicionado. *(Inferência)* |
|
|
203
|
+
| `style` | `React.CSSProperties` | — | Não | Estilo inline do container posicionado. *(Inferência)* |
|
|
204
|
+
| `zIndex` | `number` | `50` | Não | `z-index` do container do FAB. *(Inferência)* |
|
|
205
|
+
| `absolute` | `boolean` | `false` | Não | Usa `position: absolute` (relativo ao ancestral posicionado) em vez de `fixed` (viewport). |
|
|
206
|
+
- Sem herança de atributos DOM: o tipo é um objeto literal fechado (Confirmado).
|
|
207
|
+
|
|
208
|
+
### Eventos e callbacks
|
|
209
|
+
|
|
210
|
+
- `onClick: () => void` — chamado no clique do botão principal **somente se não houver `actions`**; com ações, o clique alterna o menu (Confirmado).
|
|
211
|
+
- `actions[i].onClick` — chamado ao clicar na ação; o menu fecha em seguida.
|
|
212
|
+
- Clique é ignorado com `disabled`/`loading` e logo após um arraste (deslocamento > 3 px).
|
|
213
|
+
- Menu de ações fecha em clique fora e `Escape`.
|
|
214
|
+
- Botão direito (context menu): com `enableDragDrop` + `dragId` e posição salva, abre um `SgPopup` "redefinir posição" (Sim/Não); "Sim" limpa a posição persistida (Confirmado; testado em `tests/buttons-menus-dom.test.mjs`).
|
|
215
|
+
|
|
216
|
+
### Ref
|
|
217
|
+
|
|
218
|
+
Não aceita `ref` (função simples, sem `forwardRef`).
|
|
219
|
+
|
|
220
|
+
### Children, slots e composição
|
|
221
|
+
|
|
222
|
+
Sem `children`. Slots: `icon`, `activeIcon` (exibido quando aberto; sem ele, o ícone gira 45°), ícones das ações. Usa `SgPopup` internamente para o menu de redefinição.
|
|
223
|
+
|
|
224
|
+
### Contexto, providers e hooks
|
|
225
|
+
|
|
226
|
+
- **Persistência da posição arrastada** (`enableDragDrop` + `dragId`): chave `sg-fab-pos:<dragId>` (`buildFabStorageKey`). Se houver `SgEnvironmentProvider` acima, usa `useSgPersistence()` (load/save/clear da estratégia configurada); senão, `localStorage` direto (Confirmado). Ver [[SeedGrid/SeedGrid-components/providers/API|Providers › SgEnvironmentProvider]].
|
|
227
|
+
- Posição restaurada é limitada à viewport (ou ao `offsetParent` quando `absolute`).
|
|
228
|
+
|
|
229
|
+
### Acessibilidade
|
|
230
|
+
|
|
231
|
+
- Botão principal: `aria-label` = `hint` ou texto i18n abrir/fechar; `aria-expanded` quando há `actions` (Confirmado; testado).
|
|
232
|
+
- Ações: `<button>` com `aria-label={label}`; ações sem `label` ficam sem nome acessível.
|
|
233
|
+
- `Escape` fecha o menu. Os `<button>` internos não declaram `type="button"` (Confirmado) — dentro de `<form>` agiriam como submit (Inferência pelo comportamento HTML padrão).
|
|
234
|
+
|
|
235
|
+
### Tipos auxiliares exportados
|
|
236
|
+
|
|
237
|
+
`SgFABAction`:
|
|
238
|
+
|
|
239
|
+
| Campo | Tipo | Obrigatório | Descrição |
|
|
240
|
+
|---|---|---|---|
|
|
241
|
+
| `icon` | `React.ReactNode` | Sim | Ícone da ação |
|
|
242
|
+
| `label` | `string` | Não | Tooltip e `aria-label` |
|
|
243
|
+
| `onClick` | `() => void` | Não | Ação |
|
|
244
|
+
| `severity` | `FABSeverity` | Não | Cor da ação (padrão `"plain"`) |
|
|
245
|
+
| `floatActionButtonStyle` | `FABSeverity` | Não | Alias usado se `severity` ausente |
|
|
246
|
+
| `disabled` | `boolean` | Não | Desabilita a ação |
|
|
247
|
+
|
|
248
|
+
Aliases exportados: `FABPosition`, `FABSeverity`, `FABSize`, `FABShape`, `FABElevation`, `FABAnimation`, `FABAnimationTrigger`, `FABLayoutType` (valores na tabela de props).
|
|
249
|
+
|
|
250
|
+
## Funções auxiliares exportadas (`src/buttons/fab-helpers.ts`)
|
|
251
|
+
|
|
252
|
+
| Função | Assinatura | Comportamento |
|
|
253
|
+
|---|---|---|
|
|
254
|
+
| `buildFabStorageKey` | `(dragId?: string \| null) => string \| null` | `null` sem `dragId`; senão `` `sg-fab-pos:${dragId}` `` |
|
|
255
|
+
| `parseStoredFabDragPosition` | `(raw: unknown) => { x: number; y: number } \| null` | Aceita string JSON ou objeto; retorna `{x,y}` só se ambos forem números finitos, senão `null` |
|
|
256
|
+
|
|
257
|
+
Confirmado; cobertos por `tests/buttons-menus.test.mjs` ("FAB drag helpers normalize persisted positions deterministically").
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
---
|
|
2
|
+
tags: [seedgrid, front, component, buttons]
|
|
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
|
+
# Exemplos — botões
|
|
10
|
+
|
|
11
|
+
Copiados 1:1 dos `samples/*.tsx.sample` do showcase e verificados com type-check (TypeScript `strict`) contra `packages/seedgrid-fe-components/src/index.ts` em 2026-10-14 — todos sem erros. Ícones vêm de `lucide-react` (peer dependency do pacote). API: [[SeedGrid/SeedGrid-components/buttons/API|API dos botões]] · Visão geral: [[SeedGrid/SeedGrid-components/buttons/Visao-geral|Botões]].
|
|
12
|
+
|
|
13
|
+
## SgButton
|
|
14
|
+
|
|
15
|
+
### Básico com loading
|
|
16
|
+
|
|
17
|
+
Clique ativa `loading` por 1,2 s (spinner + botão desabilitado); o segundo botão usa `disabled`.
|
|
18
|
+
|
|
19
|
+
Fonte: `front/seedgrid-fe-components/apps/showcase/src/app/components/sg-button/samples/basico.tsx.sample`
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import React from "react";
|
|
23
|
+
import { SgButton } from "@seedgrid/fe-components";
|
|
24
|
+
|
|
25
|
+
export default function Example() {
|
|
26
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
27
|
+
|
|
28
|
+
const handleClick = () => {
|
|
29
|
+
setIsLoading(true);
|
|
30
|
+
window.setTimeout(() => setIsLoading(false), 1200);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
35
|
+
<SgButton onClick={handleClick} loading={isLoading}>
|
|
36
|
+
Submit
|
|
37
|
+
</SgButton>
|
|
38
|
+
<SgButton disabled>Disabled</SgButton>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Cores customizadas
|
|
45
|
+
|
|
46
|
+
`customColors` sobrescreve fundo, texto, borda, hover e anel de foco (inclusive com `appearance="outline"`).
|
|
47
|
+
|
|
48
|
+
Fonte: `front/seedgrid-fe-components/apps/showcase/src/app/components/sg-button/samples/custom-colors.tsx.sample`
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
import React from "react";
|
|
52
|
+
import { SgButton } from "@seedgrid/fe-components";
|
|
53
|
+
|
|
54
|
+
export default function Example() {
|
|
55
|
+
return (
|
|
56
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
57
|
+
<SgButton
|
|
58
|
+
customColors={{
|
|
59
|
+
bg: "#0f172a",
|
|
60
|
+
fg: "#ffffff",
|
|
61
|
+
hoverBg: "#020617",
|
|
62
|
+
ring: "rgba(15,23,42,.35)"
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
Brand Dark
|
|
66
|
+
</SgButton>
|
|
67
|
+
<SgButton
|
|
68
|
+
customColors={{
|
|
69
|
+
bg: "#ec4899",
|
|
70
|
+
fg: "#ffffff",
|
|
71
|
+
border: "#db2777",
|
|
72
|
+
hoverBg: "#db2777",
|
|
73
|
+
ring: "rgba(236,72,153,.35)"
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
Pink
|
|
77
|
+
</SgButton>
|
|
78
|
+
<SgButton
|
|
79
|
+
appearance="outline"
|
|
80
|
+
customColors={{
|
|
81
|
+
bg: "#8b5cf6",
|
|
82
|
+
fg: "#8b5cf6",
|
|
83
|
+
border: "#8b5cf6",
|
|
84
|
+
ring: "rgba(139,92,246,.35)"
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
Violet Outline
|
|
88
|
+
</SgButton>
|
|
89
|
+
</div>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Somente ícone
|
|
95
|
+
|
|
96
|
+
Sem `children`/`label` e com `leftIcon`, o modo somente-ícone é inferido. Em produção, acrescente `aria-label` (o componente não gera um).
|
|
97
|
+
|
|
98
|
+
Fonte: `front/seedgrid-fe-components/apps/showcase/src/app/components/sg-button/samples/rounded-icon-buttons.tsx.sample`
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
import React from "react";
|
|
102
|
+
import { Bookmark, Search, Users, Bell, Heart, X, Check } from "lucide-react";
|
|
103
|
+
import { SgButton } from "@seedgrid/fe-components";
|
|
104
|
+
|
|
105
|
+
const ICON_MAP = [
|
|
106
|
+
{ severity: "primary", icon: <Bookmark className="size-4" /> },
|
|
107
|
+
{ severity: "secondary", icon: <Search className="size-4" /> },
|
|
108
|
+
{ severity: "success", icon: <Users className="size-4" /> },
|
|
109
|
+
{ severity: "info", icon: <Bell className="size-4" /> },
|
|
110
|
+
{ severity: "help", icon: <Heart className="size-4" /> },
|
|
111
|
+
{ severity: "danger", icon: <X className="size-4" /> },
|
|
112
|
+
{ severity: "warning", icon: <Check className="size-4" /> },
|
|
113
|
+
] as const;
|
|
114
|
+
|
|
115
|
+
export default function Example() {
|
|
116
|
+
return (
|
|
117
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
118
|
+
{ICON_MAP.map(({ severity, icon }) => (
|
|
119
|
+
<SgButton key={severity} severity={severity} shape="rounded" leftIcon={icon} />
|
|
120
|
+
))}
|
|
121
|
+
</div>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## SgSplitButton
|
|
127
|
+
|
|
128
|
+
### Básico
|
|
129
|
+
|
|
130
|
+
Ação principal `Save` e três ações secundárias no menu.
|
|
131
|
+
|
|
132
|
+
Fonte: `front/seedgrid-fe-components/apps/showcase/src/app/components/sg-split-button/samples/basico.tsx.sample`
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
import React from "react";
|
|
136
|
+
import { Home, RefreshCw, Save, Trash2 } from "lucide-react";
|
|
137
|
+
import { SgSplitButton } from "@seedgrid/fe-components";
|
|
138
|
+
|
|
139
|
+
const items = [
|
|
140
|
+
{ label: "Update", icon: <RefreshCw className="size-4" />, onClick: () => {} },
|
|
141
|
+
{ label: "Delete", icon: <Trash2 className="size-4" />, onClick: () => {} },
|
|
142
|
+
{ label: "Homepage", icon: <Home className="size-4" />, onClick: () => {} }
|
|
143
|
+
];
|
|
144
|
+
|
|
145
|
+
export default function Example() {
|
|
146
|
+
return <SgSplitButton label="Save" leftIcon={<Save className="size-4" />} onClick={() => {}} items={items} style={{ minWidth: 180 }} />;
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Separador no menu
|
|
151
|
+
|
|
152
|
+
`separator: true` desenha uma divisória antes do item.
|
|
153
|
+
|
|
154
|
+
Fonte: `front/seedgrid-fe-components/apps/showcase/src/app/components/sg-split-button/samples/separadores-de-menu.tsx.sample`
|
|
155
|
+
|
|
156
|
+
```tsx
|
|
157
|
+
import React from "react";
|
|
158
|
+
import { FileText } from "lucide-react";
|
|
159
|
+
import { SgSplitButton } from "@seedgrid/fe-components";
|
|
160
|
+
|
|
161
|
+
export default function Example() {
|
|
162
|
+
return <SgSplitButton label="File" leftIcon={<FileText className="size-4" />} items={[{ label: "Copy" }, { separator: true, label: "Export as PDF" }]} onClick={() => {}} />;
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## SgFloatActionButton
|
|
167
|
+
|
|
168
|
+
### Layout linear com direções
|
|
169
|
+
|
|
170
|
+
`absolute` posiciona o FAB dentro do container `relative`; `direction` define para onde as ações se abrem.
|
|
171
|
+
|
|
172
|
+
Fonte: `front/seedgrid-fe-components/apps/showcase/src/app/components/sg-float-action-button/samples/actions-linear-layout.tsx.sample`
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
import React from "react";
|
|
176
|
+
import { UserPlus, FilePlus, FolderPlus } from "lucide-react";
|
|
177
|
+
import { SgFloatActionButton, type SgFABAction } from "@seedgrid/fe-components";
|
|
178
|
+
|
|
179
|
+
function DemoBox(props: { children: React.ReactNode; className?: string; height?: string }) {
|
|
180
|
+
return <div className={`relative w-full rounded-md border border-dashed border-border bg-muted/20 pt-10 ${props.height ?? "h-48"} ${props.className ?? ""}`}>{props.children}</div>;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const actions: SgFABAction[] = [
|
|
184
|
+
{ icon: <UserPlus className="size-4" />, label: "New user", onClick: () => {} },
|
|
185
|
+
{ icon: <FilePlus className="size-4" />, label: "New file", onClick: () => {} },
|
|
186
|
+
{ icon: <FolderPlus className="size-4" />, label: "New folder", onClick: () => {} }
|
|
187
|
+
];
|
|
188
|
+
|
|
189
|
+
const actionsNoLabel: SgFABAction[] = actions.map(({ label: _, ...rest }) => rest);
|
|
190
|
+
|
|
191
|
+
export default function Example() {
|
|
192
|
+
return (
|
|
193
|
+
<div className="grid grid-cols-2 gap-8 w-full">
|
|
194
|
+
<DemoBox height="h-72" className="flex items-end justify-center">
|
|
195
|
+
<SgFloatActionButton absolute position="center-bottom" actions={actions} type="linear" direction="up" />
|
|
196
|
+
</DemoBox>
|
|
197
|
+
<DemoBox height="h-72" className="flex items-start justify-center">
|
|
198
|
+
<SgFloatActionButton absolute position="center-top" actions={actions} type="linear" direction="down" />
|
|
199
|
+
</DemoBox>
|
|
200
|
+
<DemoBox height="h-24" className="flex items-center justify-end pt-14">
|
|
201
|
+
<SgFloatActionButton absolute position="right-center" actions={actionsNoLabel} type="linear" direction="left" />
|
|
202
|
+
</DemoBox>
|
|
203
|
+
<DemoBox height="h-24" className="flex items-center justify-start pt-14">
|
|
204
|
+
<SgFloatActionButton absolute position="left-center" actions={actionsNoLabel} type="linear" direction="right" />
|
|
205
|
+
</DemoBox>
|
|
206
|
+
</div>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Layout circular
|
|
212
|
+
|
|
213
|
+
`type="circle"` com `radius` explícito.
|
|
214
|
+
|
|
215
|
+
Fonte: `front/seedgrid-fe-components/apps/showcase/src/app/components/sg-float-action-button/samples/circle-layout.tsx.sample`
|
|
216
|
+
|
|
217
|
+
```tsx
|
|
218
|
+
import React from "react";
|
|
219
|
+
import { UserPlus, FilePlus, FolderPlus, Pencil } from "lucide-react";
|
|
220
|
+
import { SgFloatActionButton, type SgFABAction } from "@seedgrid/fe-components";
|
|
221
|
+
|
|
222
|
+
function DemoBox(props: { children: React.ReactNode }) {
|
|
223
|
+
return <div className="relative h-96 w-full rounded-md border border-dashed border-border bg-muted/20">{props.children}</div>;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const actions: SgFABAction[] = [
|
|
227
|
+
{ icon: <UserPlus className="size-4" />, label: "New user", onClick: () => {} },
|
|
228
|
+
{ icon: <FilePlus className="size-4" />, label: "New file", onClick: () => {} },
|
|
229
|
+
{ icon: <FolderPlus className="size-4" />, label: "New folder", onClick: () => {} },
|
|
230
|
+
{ icon: <Pencil className="size-4" />, label: "Edit", onClick: () => {} }
|
|
231
|
+
];
|
|
232
|
+
|
|
233
|
+
export default function Example() {
|
|
234
|
+
return (
|
|
235
|
+
<DemoBox>
|
|
236
|
+
<SgFloatActionButton absolute position="center-top" actions={[...actions, ...actions]} type="circle" radius={120} severity="secondary" />
|
|
237
|
+
</DemoBox>
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Arrastar e soltar com posição persistida
|
|
243
|
+
|
|
244
|
+
`enableDragDrop` + `dragId` salvam a posição (via `SgEnvironmentProvider`, se houver, ou `localStorage`). Botão direito no FAB oferece redefinir a posição.
|
|
245
|
+
|
|
246
|
+
Fonte: `front/seedgrid-fe-components/apps/showcase/src/app/components/sg-float-action-button/samples/drag-drop.tsx.sample`
|
|
247
|
+
|
|
248
|
+
```tsx
|
|
249
|
+
import React from "react";
|
|
250
|
+
import { UserPlus, FilePlus, FolderPlus } from "lucide-react";
|
|
251
|
+
import { SgFloatActionButton, type SgFABAction } from "@seedgrid/fe-components";
|
|
252
|
+
|
|
253
|
+
function DemoBox(props: { children: React.ReactNode }) {
|
|
254
|
+
return <div className="relative h-64 w-full rounded-md border border-dashed border-border bg-muted/20">{props.children}</div>;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const actions: SgFABAction[] = [
|
|
258
|
+
{ icon: <UserPlus className="size-4" />, label: "New user", onClick: () => {} },
|
|
259
|
+
{ icon: <FilePlus className="size-4" />, label: "New file", onClick: () => {} },
|
|
260
|
+
{ icon: <FolderPlus className="size-4" />, label: "New folder", onClick: () => {} }
|
|
261
|
+
];
|
|
262
|
+
|
|
263
|
+
export default function Example() {
|
|
264
|
+
return (
|
|
265
|
+
<DemoBox>
|
|
266
|
+
<SgFloatActionButton
|
|
267
|
+
enableDragDrop
|
|
268
|
+
dragId="showcase-fab-drag"
|
|
269
|
+
actions={actions}
|
|
270
|
+
type="linear"
|
|
271
|
+
direction="up"
|
|
272
|
+
severity="info"
|
|
273
|
+
absolute
|
|
274
|
+
position="right-bottom"
|
|
275
|
+
/>
|
|
276
|
+
</DemoBox>
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### Tooltip (hint)
|
|
282
|
+
|
|
283
|
+
Fonte: `front/seedgrid-fe-components/apps/showcase/src/app/components/sg-float-action-button/samples/hint.tsx.sample`
|
|
284
|
+
|
|
285
|
+
```tsx
|
|
286
|
+
import React from "react";
|
|
287
|
+
import { SgFloatActionButton } from "@seedgrid/fe-components";
|
|
288
|
+
|
|
289
|
+
export default function Example() {
|
|
290
|
+
return (
|
|
291
|
+
<div className="flex gap-8 items-center flex-wrap py-4">
|
|
292
|
+
{(["top", "right", "bottom", "left"] as const).map((hintPosition) => (
|
|
293
|
+
<div key={hintPosition} className="flex flex-col items-center gap-2">
|
|
294
|
+
<SgFloatActionButton
|
|
295
|
+
hint="Add new"
|
|
296
|
+
hintPosition={hintPosition}
|
|
297
|
+
hintDelay={0}
|
|
298
|
+
onClick={() => {}}
|
|
299
|
+
style={{ position: "relative" }}
|
|
300
|
+
/>
|
|
301
|
+
<span className="text-xs text-muted-foreground">hintPosition="{hintPosition}"</span>
|
|
302
|
+
</div>
|
|
303
|
+
))}
|
|
304
|
+
</div>
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
```
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
tags: [seedgrid, front, component, buttons]
|
|
3
|
+
fonte: front/seedgrid-fe-components/packages/seedgrid-fe-components/src/buttons
|
|
4
|
+
branch: main
|
|
5
|
+
commit: ad30fc11de
|
|
6
|
+
analisado-em: 2026-10-14
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Botões (`src/buttons`)
|
|
10
|
+
|
|
11
|
+
Componentes de ação do `@seedgrid/fe-components`: botão padrão, botão dividido (ação + menu) e botão de ação flutuante (FAB).
|
|
12
|
+
|
|
13
|
+
- API completa: [[SeedGrid/SeedGrid-components/buttons/API|API dos botões]]
|
|
14
|
+
- Exemplos: [[SeedGrid/SeedGrid-components/buttons/Exemplos|Exemplos de botões]]
|
|
15
|
+
- Fundamentos (instalação, CSS, i18n): [[SeedGrid/SeedGrid-components/fundamentos/Visao-geral|Fundamentos]]
|
|
16
|
+
|
|
17
|
+
## Componentes
|
|
18
|
+
|
|
19
|
+
| Componente | Exportado | Para que serve | Showcase |
|
|
20
|
+
|---|---|---|---|
|
|
21
|
+
| `SgButton` | sim | Botão de ação com `severity`, `appearance` (`solid`/`outline`/`ghost`), `size`, `shape`, `elevation`, ícones, `loading` e cores customizadas | `/components/sg-button` |
|
|
22
|
+
| `SgSplitButton` | sim | Ação principal + menu dropdown de ações secundárias (`items`) | `/components/sg-split-button` |
|
|
23
|
+
| `SgFloatActionButton` | sim | FAB fixo/absoluto com ações secundárias (layouts `linear`, `circle`, `semi-circle`, `quarter-circle`), tooltip, animações, auto-ocultar ao rolar e arrastar com posição persistida | `/components/sg-float-action-button` |
|
|
24
|
+
|
|
25
|
+
Todos estão no barrel `src/index.ts` (Confirmado). Rotas do showcase em `front/seedgrid-fe-components/apps/showcase/src/app/components/<rota>/` (cada uma com `samples/` e `*.tsx.playground`).
|
|
26
|
+
|
|
27
|
+
## Funções e tipos exportados relacionados
|
|
28
|
+
|
|
29
|
+
- Tipos: `SgButtonProps`, `SgButtonCustomColors`, `SgSplitButtonProps`, `SgSplitButtonItem`, `SgFloatActionButtonProps`, `SgFABAction`, `FABPosition`, `FABSeverity`, `FABSize`, `FABShape`, `FABElevation`, `FABAnimation`, `FABAnimationTrigger`, `FABLayoutType`.
|
|
30
|
+
- Funções puras: `buildFabStorageKey`, `parseStoredFabDragPosition` (`src/buttons/fab-helpers.ts`) — montam/validam a posição persistida do FAB.
|
|
31
|
+
- Interno (não exportado): aliases `Severity`/`Appearance`/`Size`/`Shape`/`Elevation` de `SgButton.tsx` e `SgSplitButton.tsx`.
|
|
32
|
+
|
|
33
|
+
## Composição e dependências
|
|
34
|
+
|
|
35
|
+
- `SgSplitButton` renderiza dois `SgButton`. `SgFloatActionButton` usa `SgPopup` (grupo [[SeedGrid/SeedGrid-components/navegacao-e-overlay/API|navegação e overlay]]) para o menu "redefinir posição".
|
|
36
|
+
- O FAB persiste a posição arrastada via `useSgPersistence()` quando há um `SgEnvironmentProvider` na árvore; sem provider, usa `localStorage` diretamente (chave `sg-fab-pos:<dragId>`). Ver [[SeedGrid/SeedGrid-components/providers/Visao-geral|Providers]].
|
|
37
|
+
- Textos padrão (aria-labels, tooltip do FAB, menu de reset) vêm do i18n interno (`useComponentsI18n`).
|
|
38
|
+
- Estilo: classes Tailwind + variáveis CSS (`--sg-btn-*`) com fallback para os tokens HSL do tema (`--primary`, `--secondary`…). Nenhuma dependência externa além de `react` (Confirmado: só imports internos).
|
|
39
|
+
|
|
40
|
+
## Testes existentes (não executados)
|
|
41
|
+
|
|
42
|
+
| Arquivo | Cobre |
|
|
43
|
+
|---|---|
|
|
44
|
+
| `packages/seedgrid-fe-components/tests/buttons-menus.test.mjs` | `SgButton` (estado disabled e label), `aria-label` traduzido do `SgSplitButton` e do `SgFloatActionButton`, helpers `buildFabStorageKey`/`parseStoredFabDragPosition` |
|
|
45
|
+
| `packages/seedgrid-fe-components/tests/buttons-menus-dom.test.mjs` (jsdom) | `SgSplitButton` abre o menu, ativa item e fecha com `Escape`; `SgFloatActionButton` persiste arraste em `localStorage` e abre o popup de reset limpando a posição |
|
|
46
|
+
|
|
47
|
+
## Limitações e pontos de atenção
|
|
48
|
+
|
|
49
|
+
- `SgButton` somente-ícone não gera `aria-label` automaticamente; os `<button>` do FAB não declaram `type="button"`.
|
|
50
|
+
- `SgSplitButton` não tem navegação por setas no menu (somente clique e `Escape`).
|
|
51
|
+
- O FAB não aceita `ref`.
|