@praxisui/tabs 1.0.0-beta.8 → 2.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,57 @@
1
+ ---
2
+ title: "Tabs"
3
+ slug: "tabs-overview"
4
+ description: "Visao geral do @praxisui/tabs com modos group/nav, conteudo metadata-driven, persistencia por tabsId e editor integrado."
5
+ doc_type: "reference"
6
+ document_kind: "component-overview"
7
+ component: "tabs"
8
+ category: "components"
9
+ audience:
10
+ - "frontend"
11
+ - "host"
12
+ - "architect"
13
+ level: "intermediate"
14
+ status: "active"
15
+ owner: "praxis-ui"
16
+ tags:
17
+ - "tabs"
18
+ - "navigation"
19
+ - "metadata"
20
+ - "settings-panel"
21
+ - "runtime"
22
+ order: 34
23
+ icon: "tabs"
24
+ toc: true
25
+ sidebar: true
26
+ search_boost: 1.0
27
+ reading_time: 12
28
+ estimated_setup_time: 20
29
+ version: "1.0"
30
+ related_docs:
31
+ - "consumer-integration-quickstart"
32
+ - "host-integration-guide"
33
+ keywords:
34
+ - "tabs metadata"
35
+ - "mat-tab-group"
36
+ - "tab nav"
37
+ - "tabsId persistence"
38
+ last_updated: "2026-03-07"
39
+ ---
40
+
1
41
  # @praxisui/tabs — Praxis Tabs
2
42
 
43
+ ## Documentation
44
+
45
+ - Documentação oficial: https://praxisui.dev
46
+ - Aplicação de referência: https://github.com/codexrodrigues/praxis-ui-quickstart
47
+ - Indicado para: navegacao por abas metadata-driven com persistencia, widgets internos e editor em runtime
48
+
49
+ ## When to use
50
+
51
+ - Organizar conteudo em grupos ou navegacao por abas com metadados
52
+ - Persistir configuracao e comportamento por instancia de tabs
53
+ - Compor tabs com widgets e campos dinamicos sem implementar cada variacao manualmente
54
+
3
55
  Componente de abas (grupo e nav) configurável por metadados, com suporte a widgets internos, presets de estilo e editor integrado via Settings Panel.
4
56
 
5
57
  ## Visão Geral
@@ -7,9 +59,10 @@ Componente de abas (grupo e nav) configurável por metadados, com suporte a widg
7
59
  - Dois modos de renderização: `group` (mat-tab-group) e `nav` (mat-tab-nav-bar).
8
60
  - Suporte a conteúdo dinâmico por campo (`DynamicFieldLoader`) e por widget (`DynamicWidgetLoader`).
9
61
  - Integração com Settings Panel para edição/configuração em tempo de execução.
10
- - Persistência opcional de configuração por `tabsId` usando `ConfigStorage`.
62
+ - Persistência de configuração por `tabsId` usando `AsyncConfigStorage` (chave derivada via component_id).
11
63
  - Lazy load opcional do conteúdo para melhor desempenho.
12
64
  - Eventos reemitidos com contexto (para conexões entre widgets/páginas).
65
+ - Acessibilidade explícita por modo: `group.*` e `tabs[]` no modo group, `nav.*` no modo nav.
13
66
 
14
67
  ## API do Componente
15
68
 
@@ -18,10 +71,11 @@ Selector
18
71
 
19
72
  Inputs
20
73
  - `config: TabsMetadata | null` Metadados completos para aparência, comportamento e conteúdo.
21
- - `tabsId?: string` Identificador estável para persistir/restaurar a configuração.
74
+ - `tabsId: string` Identificador estável para persistir/restaurar a configuração.
75
+ - `componentInstanceId?: string` Opcional para desambiguar múltiplas instâncias com o mesmo `tabsId` na mesma rota.
22
76
  - `form?: FormGroup` FormGroup opcional para campos dinâmicos declarados em `content`.
23
77
  - `context?: any` Contexto propagado a widgets internos (via `DynamicWidgetLoader`).
24
- - `editModeEnabled?: boolean` Exibe botão de edição quando verdadeiro (abre o editor).
78
+ - `enableCustomization?: boolean` Exibe botão de edição quando verdadeiro (abre o editor).
25
79
 
26
80
  Outputs
27
81
  - `selectedIndexChange: number` Índice selecionado atualizado (ambos modos).
@@ -30,7 +84,18 @@ Outputs
30
84
  - `widgetEvent: { tabId?, tabIndex?, linkId?, linkIndex?, sourceId, output?, payload? }` Reemissão de eventos dos widgets internos com contexto da aba/link.
31
85
 
32
86
  Persistência
33
- - Quando `tabsId` é fornecido, a configuração é salva/recuperada de `ConfigStorage` na chave `tabs:<tabsId>`.
87
+ - Quando `tabsId` é fornecido, a configuração é salva/recuperada em `AsyncConfigStorage` na chave `tabs:<component_id>`.
88
+ - O `component_id` é derivado via `ComponentKeyService` (inclui rota, tipo de componente, `tabsId` e `componentInstanceId` quando informado).
89
+
90
+ ## Empty State e Quick Setup
91
+
92
+ Quando o componente inicia sem `tabs` e sem `nav.links`, o runtime exibe um empty state com atalhos de inicializacao:
93
+
94
+ - criar abas rapidamente via Quick Setup
95
+ - adicionar aba vazia imediatamente
96
+ - abrir editor completo de configuracao
97
+
98
+ No Quick Setup, ao aplicar/salvar, o componente gera uma `TabsMetadata` minima e passa a renderizar abas/links com persistencia normal.
34
99
 
35
100
  ## Estrutura de Metadados (resumo)
36
101
 
@@ -43,10 +108,10 @@ export interface TabsMetadata {
43
108
  tokens?: Partial<TabsStyleTokens>; // tokens -> CSS gerado em runtime
44
109
  };
45
110
  behavior?: { lazyLoad?: boolean; closeable?: boolean; reorderable?: boolean };
46
- accessibility?: { ariaLabels?: Record<string,string>; keyboardNavigation?: boolean; highContrast?: boolean; reduceMotion?: boolean };
47
- group?: { alignTabs?: 'start' | 'center' | 'end'; headerPosition?: 'above'|'below'; selectedIndex?: number; dynamicHeight?: boolean; disableRipple?: boolean; disablePagination?: boolean; fitInkBarToContent?: boolean; stretchTabs?: boolean; color?: 'primary'|'accent'|'warn'; backgroundColor?: 'primary'|'accent'|'warn'|undefined; animationDuration?: string; };
111
+ accessibility?: { highContrast?: boolean; reduceMotion?: boolean };
112
+ group?: { alignTabs?: 'start' | 'center' | 'end'; headerPosition?: 'above'|'below'; selectedIndex?: number; dynamicHeight?: boolean; disableRipple?: boolean; disablePagination?: boolean; fitInkBarToContent?: boolean; stretchTabs?: boolean; color?: 'primary'|'accent'|'warn'; backgroundColor?: 'primary'|'accent'|'warn'|undefined; animationDuration?: string; ariaLabel?: string; ariaLabelledby?: string; };
48
113
  tabs?: Array<{ id?: string; textLabel?: string; disabled?: boolean; labelClass?: string|string[]; bodyClass?: string|string[]; content?: any[]; widgets?: WidgetDefinition[] }>;
49
- nav?: { links: Array<{ id?: string; label: string; disabled?: boolean; content?: any[]; widgets?: WidgetDefinition[] }>; selectedIndex?: number; disableRipple?: boolean; disablePagination?: boolean; fitInkBarToContent?: boolean; stretchTabs?: boolean; color?: 'primary'|'accent'|'warn'; backgroundColor?: 'primary'|'accent'|'warn'|undefined; animationDuration?: string };
114
+ nav?: { links: Array<{ id?: string; label: string; disabled?: boolean; content?: any[]; widgets?: WidgetDefinition[] }>; selectedIndex?: number; disableRipple?: boolean; disablePagination?: boolean; fitInkBarToContent?: boolean; stretchTabs?: boolean; color?: 'primary'|'accent'|'warn'; backgroundColor?: 'primary'|'accent'|'warn'|undefined; animationDuration?: string; ariaLabel?: string; ariaLabelledby?: string };
50
115
  }
51
116
  ```
52
117
 
@@ -75,6 +140,7 @@ Contrato do Editor (`PraxisTabsConfigEditor` implementa `SettingsValueProvider`)
75
140
  - JSON: editor de texto com validação e botão “Formatar”.
76
141
  - Estilo: presets de tokens, classe de tema, CSS customizado e snippet SCSS sugerido.
77
142
  - Abas/Links: adicionar/remover/reordenar, inserir widgets, presets rápidos (form/table/crud) usando `resourcePath`.
143
+ - O editor cobre apenas caminhos com binding real no runtime; campos sem efeito não são expostos na UI.
78
144
 
79
145
  Quick Setup
80
146
  - `openQuickSetup()` abre `TabsQuickSetupComponent` para criação rápida de abas/links.
@@ -101,7 +167,7 @@ Quick Setup
101
167
  ## Exemplo Mínimo
102
168
 
103
169
  ```html
104
- <praxis-tabs [config]="tabsCfg" [tabsId]="'cliente-tabs'" [editModeEnabled]="true" (widgetEvent)="onWidgetEvent($event)"></praxis-tabs>
170
+ <praxis-tabs [config]="tabsCfg" [tabsId]="'cliente-tabs'" [enableCustomization]="true" (widgetEvent)="onWidgetEvent($event)"></praxis-tabs>
105
171
  ```
106
172
 
107
173
  ```ts
@@ -115,13 +181,27 @@ const tabsCfg: TabsMetadata = {
115
181
  };
116
182
  ```
117
183
 
184
+ Observacao de host:
185
+ - `praxis-table` se auto-hospeda para `GenericCrudService`.
186
+ - `praxis-dynamic-form` remoto continua dependendo de `GenericCrudService` provido pelo host efetivo quando usar `resourcePath`, `resourceId`, schema remoto ou submit remoto.
187
+ - ao embutir `praxis-dynamic-form` em tabs, stepper ou shells equivalentes, nao presumir que o widget sozinho resolve a DI de CRUD.
188
+
118
189
  ## Acessibilidade
119
190
 
120
- - Suporte a `aria-label`/`aria-labelledby` em grupo e abas/links.
121
- - Opções para reduzir animações (`accessibility.reduceMotion`) e alto contraste (`accessibility.highContrast`).
191
+ - Modo `group`: use `group.ariaLabel`, `group.ariaLabelledby`, `tabs[].ariaLabel` e `tabs[].ariaLabelledby`.
192
+ - Modo `nav`: use `nav.ariaLabel` e `nav.ariaLabelledby`.
193
+ - Opções top-level de acessibilidade com binding real: `accessibility.reduceMotion` e `accessibility.highContrast`.
122
194
 
123
195
  ## Notas
124
196
 
125
197
  - Para persistência por usuário/escopo, forneça `tabsId` estável e deixe o componente gerir `ConfigStorage`.
126
198
  - Tokens de estilo aceitam CSS vars ou cores (`#RRGGBB`/`rgb(...)`).
127
199
  - Em M2, `color` e `backgroundColor` seguem as opções do Angular Material; em M3, prefira tokens.
200
+ - A classe de tema é decisão do host (`.dark-theme` ou `.theme-dark`/`.theme-light`); mantenha tokens e componentes no mesmo escopo.
201
+ - `group.contentTabIndex`, `accessibility.ariaLabels` e `accessibility.keyboardNavigation` permanecem fora da superfície pública suportada enquanto não houver binding explícito no DOM.
202
+
203
+ ### Tokens M3 obrigatórios (host)
204
+
205
+ - Superfícies: `--md-sys-color-surface`, `--md-sys-color-surface-container`, `--md-sys-color-surface-variant`
206
+ - Texto/contorno: `--md-sys-color-on-surface`, `--md-sys-color-on-surface-variant`, `--md-sys-color-outline`, `--md-sys-color-outline-variant`
207
+ - Semânticos: `--md-sys-color-primary`, `--md-sys-color-secondary`, `--md-sys-color-tertiary`, `--md-sys-color-error`