@praxisui/tabs 1.0.0-beta.5 → 1.0.0-beta.52

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,52 @@
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
+ ## 🔰 Exemplos / Quickstart
44
+
45
+ Para ver esta biblioteca em funcionamento em uma aplicação completa, utilize o projeto de exemplo (Quickstart):
46
+
47
+ - Repositório: https://github.com/codexrodrigues/praxis-ui-quickstart
48
+ - O Quickstart demonstra a integração das bibliotecas `@praxisui/*` em um app Angular, incluindo instalação, configuração e uso em telas reais.
49
+
3
50
  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
51
 
5
52
  ## Visão Geral
@@ -7,9 +54,10 @@ Componente de abas (grupo e nav) configurável por metadados, com suporte a widg
7
54
  - Dois modos de renderização: `group` (mat-tab-group) e `nav` (mat-tab-nav-bar).
8
55
  - Suporte a conteúdo dinâmico por campo (`DynamicFieldLoader`) e por widget (`DynamicWidgetLoader`).
9
56
  - 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`.
57
+ - Persistência de configuração por `tabsId` usando `AsyncConfigStorage` (chave derivada via component_id).
11
58
  - Lazy load opcional do conteúdo para melhor desempenho.
12
59
  - Eventos reemitidos com contexto (para conexões entre widgets/páginas).
60
+ - Acessibilidade explícita por modo: `group.*` e `tabs[]` no modo group, `nav.*` no modo nav.
13
61
 
14
62
  ## API do Componente
15
63
 
@@ -18,7 +66,8 @@ Selector
18
66
 
19
67
  Inputs
20
68
  - `config: TabsMetadata | null` Metadados completos para aparência, comportamento e conteúdo.
21
- - `tabsId?: string` Identificador estável para persistir/restaurar a configuração.
69
+ - `tabsId: string` Identificador estável para persistir/restaurar a configuração.
70
+ - `componentInstanceId?: string` Opcional para desambiguar múltiplas instâncias com o mesmo `tabsId` na mesma rota.
22
71
  - `form?: FormGroup` FormGroup opcional para campos dinâmicos declarados em `content`.
23
72
  - `context?: any` Contexto propagado a widgets internos (via `DynamicWidgetLoader`).
24
73
  - `editModeEnabled?: boolean` Exibe botão de edição quando verdadeiro (abre o editor).
@@ -30,7 +79,18 @@ Outputs
30
79
  - `widgetEvent: { tabId?, tabIndex?, linkId?, linkIndex?, sourceId, output?, payload? }` Reemissão de eventos dos widgets internos com contexto da aba/link.
31
80
 
32
81
  Persistência
33
- - Quando `tabsId` é fornecido, a configuração é salva/recuperada de `ConfigStorage` na chave `tabs:<tabsId>`.
82
+ - Quando `tabsId` é fornecido, a configuração é salva/recuperada em `AsyncConfigStorage` na chave `tabs:<component_id>`.
83
+ - O `component_id` é derivado via `ComponentKeyService` (inclui rota, tipo de componente, `tabsId` e `componentInstanceId` quando informado).
84
+
85
+ ## Empty State e Quick Setup
86
+
87
+ Quando o componente inicia sem `tabs` e sem `nav.links`, o runtime exibe um empty state com atalhos de inicializacao:
88
+
89
+ - criar abas rapidamente via Quick Setup
90
+ - adicionar aba vazia imediatamente
91
+ - abrir editor completo de configuracao
92
+
93
+ No Quick Setup, ao aplicar/salvar, o componente gera uma `TabsMetadata` minima e passa a renderizar abas/links com persistencia normal.
34
94
 
35
95
  ## Estrutura de Metadados (resumo)
36
96
 
@@ -43,10 +103,10 @@ export interface TabsMetadata {
43
103
  tokens?: Partial<TabsStyleTokens>; // tokens -> CSS gerado em runtime
44
104
  };
45
105
  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; };
106
+ accessibility?: { highContrast?: boolean; reduceMotion?: boolean };
107
+ 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
108
  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 };
109
+ 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
110
  }
51
111
  ```
52
112
 
@@ -75,6 +135,7 @@ Contrato do Editor (`PraxisTabsConfigEditor` implementa `SettingsValueProvider`)
75
135
  - JSON: editor de texto com validação e botão “Formatar”.
76
136
  - Estilo: presets de tokens, classe de tema, CSS customizado e snippet SCSS sugerido.
77
137
  - Abas/Links: adicionar/remover/reordenar, inserir widgets, presets rápidos (form/table/crud) usando `resourcePath`.
138
+ - O editor cobre apenas caminhos com binding real no runtime; campos sem efeito não são expostos na UI.
78
139
 
79
140
  Quick Setup
80
141
  - `openQuickSetup()` abre `TabsQuickSetupComponent` para criação rápida de abas/links.
@@ -117,11 +178,20 @@ const tabsCfg: TabsMetadata = {
117
178
 
118
179
  ## Acessibilidade
119
180
 
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`).
181
+ - Modo `group`: use `group.ariaLabel`, `group.ariaLabelledby`, `tabs[].ariaLabel` e `tabs[].ariaLabelledby`.
182
+ - Modo `nav`: use `nav.ariaLabel` e `nav.ariaLabelledby`.
183
+ - Opções top-level de acessibilidade com binding real: `accessibility.reduceMotion` e `accessibility.highContrast`.
122
184
 
123
185
  ## Notas
124
186
 
125
187
  - Para persistência por usuário/escopo, forneça `tabsId` estável e deixe o componente gerir `ConfigStorage`.
126
188
  - Tokens de estilo aceitam CSS vars ou cores (`#RRGGBB`/`rgb(...)`).
127
189
  - Em M2, `color` e `backgroundColor` seguem as opções do Angular Material; em M3, prefira tokens.
190
+ - A classe de tema é decisão do host (`.dark-theme` ou `.theme-dark`/`.theme-light`); mantenha tokens e componentes no mesmo escopo.
191
+ - `group.contentTabIndex`, `accessibility.ariaLabels` e `accessibility.keyboardNavigation` permanecem fora da superfície pública suportada enquanto não houver binding explícito no DOM.
192
+
193
+ ### Tokens M3 obrigatórios (host)
194
+
195
+ - Superfícies: `--md-sys-color-surface`, `--md-sys-color-surface-container`, `--md-sys-color-surface-variant`
196
+ - Texto/contorno: `--md-sys-color-on-surface`, `--md-sys-color-on-surface-variant`, `--md-sys-color-outline`, `--md-sys-color-outline-variant`
197
+ - Semânticos: `--md-sys-color-primary`, `--md-sys-color-secondary`, `--md-sys-color-tertiary`, `--md-sys-color-error`