@praxisui/dialog 9.0.0-beta.1 → 9.0.0-beta.2

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.
Files changed (2) hide show
  1. package/README.md +82 -206
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: "Dialog"
3
3
  slug: "dialog-overview"
4
- description: "Visao geral do @praxisui/dialog com service API, modo tag, presets globais, acessibilidade e integracao metadata-driven."
4
+ description: "Public npm documentation for @praxisui/dialog: service API, embedded tag mode, presets, registries, accessibility and metadata-driven global actions."
5
5
  doc_type: "reference"
6
6
  document_kind: "component-overview"
7
7
  component: "dialog"
@@ -24,7 +24,7 @@ icon: "panel-top"
24
24
  toc: true
25
25
  sidebar: true
26
26
  search_boost: 0.95
27
- reading_time: 10
27
+ reading_time: 5
28
28
  estimated_setup_time: 15
29
29
  version: "1.0"
30
30
  related_docs:
@@ -36,69 +36,14 @@ keywords:
36
36
  - "confirm dialog"
37
37
  - "dialog presets"
38
38
  - "overlay service"
39
- last_updated: "2026-03-07"
39
+ last_updated: "2026-06-16"
40
40
  ---
41
41
 
42
42
  # @praxisui/dialog
43
43
 
44
- `@praxisui/dialog` nao e apenas uma camada sobre Angular CDK. Ele publica uma superficie governada para overlays, confirmacoes, presets globais, componentes registrados e acoes de host que precisam manter acessibilidade, tema e politica operacional no mesmo contrato.
44
+ `@praxisui/dialog` is the governed dialog and overlay package for Praxis UI Angular applications. Install it when a host needs one institutional API for confirmations, alerts, prompts, custom component dialogs, embedded dialog shells, global presets, accessibility behavior and metadata-driven global actions.
45
45
 
46
- ## O que publica por contrato
47
-
48
- - `PraxisDialog` como service API para abrir confirms, componentes, templates e conteudo registrado.
49
- - tag mode `<praxis-dialog>` para hosts que precisam embutir uma surface controlada no template.
50
- - presets globais e variantes para padronizar tamanho, animacao, backdrop, close policy e tema.
51
- - registries de componentes/templates para resolver conteudo por identificador governado.
52
- - integracao com global actions para abrir dialogs a partir de fluxos metadata-driven.
53
- - outputs e refs de fechamento para devolver resultado ao host sem esconder o efeito de negocio.
54
-
55
- ## O que resolve alem do equivalente basico
56
-
57
- - centraliza confirms e overlays em uma API institucional, em vez de cada tela reimplementar `MatDialog`.
58
- - aplica presets e acessibilidade de forma consistente entre service, tag mode e acoes globais.
59
- - permite que dialogs participem de fluxos metadata-driven sem acoplar a tela ao componente concreto.
60
- - separa shell visual, conteudo hospedado e decisao de negocio final.
61
- - preserva uma fronteira clara entre runtime de overlay e politica corporativa do host.
62
-
63
- ## O que o host governa
64
-
65
- - quais componentes/templates entram nos registries.
66
- - autorizacao, efeitos de negocio, persistencia e handlers finais apos `afterClosed`.
67
- - politica de abertura para fluxos sensiveis, destrutivos ou dependentes de dominio.
68
- - tema global, tokens, textos e presets permitidos por produto.
69
- - quando usar service API, tag mode ou global action.
70
-
71
- O diagrama abaixo mostra o ownership esperado: o host dispara o service, Praxis Dialog aplica contrato, presets e acessibilidade, e o resultado volta para o host executar a decisao operacional.
72
-
73
- ```mermaid
74
- flowchart LR
75
- host["host component"] --> service["PraxisDialog service"]
76
- presets["global presets"] --> service
77
- registry["component/template registry"] --> service
78
- service --> overlay["accessible overlay runtime"]
79
- overlay --> result["afterClosed / host action"]
80
- ```
81
-
82
- ## Capacidades contratuais
83
-
84
- - confirm, alert e dialogs customizados via service.
85
- - abertura por componente, template ou registry id.
86
- - modo tag para overlays controlados pelo template do host.
87
- - presets globais por tipo e variante.
88
- - integracao com global actions e component metadata registry.
89
- - foco, ESC, restore focus, `aria-modal` e roles `dialog`/`alertdialog`.
90
-
91
- ## Limites e riscos reais
92
-
93
- - Dialog nao substitui autorizacao nem regra de negocio do host.
94
- - registries precisam ser governados; ids soltos viram acoplamento oculto.
95
- - presets globais devem padronizar UX, nao mascarar flows de dominio inconsistentes.
96
- - conteudo pesado ou multi-step pode exigir CRUD, Dynamic Form ou Stepper dentro do dialog, nao logica duplicada no overlay.
97
-
98
- ## Trilha documental
99
-
100
- - Hub publicado: [Dialog](/components/dialog)
101
- - Guia host: [Dialog host integration](/components/dialog/docs/integration)
46
+ It is not the source of business authorization or persistence. The host owns domain decisions, side effects, registry governance and the final action after a dialog closes.
102
47
 
103
48
  ## Install
104
49
 
@@ -106,190 +51,121 @@ flowchart LR
106
51
  npm i @praxisui/dialog@latest
107
52
  ```
108
53
 
109
- Peer dependencies (Angular v20):
110
- - `@angular/core` `^20.0.0`
111
- - `@angular/common` `^20.0.0`
112
- - `@angular/cdk` `^20.0.0`
113
- - `@angular/forms` `^20.0.0`
54
+ Peer dependencies:
114
55
 
115
- ## Quick Start
56
+ - `@angular/common`, `@angular/core`, `@angular/cdk`, `@angular/forms`, `@angular/material`, `@angular/platform-browser` `^21.0.0`
57
+ - `@praxisui/core` `^9.0.0-beta.1`
58
+ - `rxjs` `~7.8.0`
116
59
 
117
- ### Service (recommended)
60
+ ## Use The Service API
118
61
 
119
62
  ```ts
120
63
  import { Component } from '@angular/core';
121
64
  import { PraxisDialog } from '@praxisui/dialog';
122
65
 
123
- @Component({ selector: 'app-users', standalone: true })
66
+ @Component({
67
+ selector: 'app-users',
68
+ standalone: true,
69
+ template: `<button type="button" (click)="deleteUser()">Delete</button>`,
70
+ })
124
71
  export class UsersComponent {
125
- constructor(private dialog: PraxisDialog) {}
126
-
127
- deleteUser() {
128
- const ref = this.dialog.confirm({
129
- title: 'Confirmar Exclusão',
130
- message: 'Deseja excluir este item?',
131
- disableClose: true,
132
- }, 'question'); // variant: question
133
-
134
- ref.afterClosed().subscribe((ok) => { if (ok) this.doDelete(); });
72
+ constructor(private readonly dialog: PraxisDialog) {}
73
+
74
+ deleteUser(): void {
75
+ const ref = this.dialog.confirm(
76
+ {
77
+ title: 'Delete user',
78
+ message: 'This action cannot be undone.',
79
+ confirmLabel: 'Delete',
80
+ cancelLabel: 'Cancel',
81
+ disableClose: true,
82
+ },
83
+ 'destructive',
84
+ );
85
+
86
+ ref.afterClosed().subscribe((confirmed) => {
87
+ if (confirmed) {
88
+ this.deleteSelectedUser();
89
+ }
90
+ });
135
91
  }
136
92
 
137
- private doDelete() {/* ... */}
93
+ private deleteSelectedUser(): void {
94
+ // Execute the host-owned domain action here.
95
+ }
138
96
  }
139
97
  ```
140
98
 
141
- Open custom component or template:
142
-
143
- ```ts
144
- this.dialog.open(CustomerFormComponent, { width: 720, data: customer });
145
- // or template:
146
- this.dialog.open(this.templateRef, { ariaRole: 'alertdialog' });
147
- ```
148
-
149
- ## Global Actions Integration
150
-
151
- Para integrar com o sistema de ações globais do Praxis:
152
-
153
- ```ts
154
- import { providePraxisDialogGlobalActions } from '@praxisui/dialog';
155
-
156
- providers: [
157
- providePraxisDialogGlobalActions(),
158
- ]
159
- ```
160
-
161
- ### Payload esperado para `dialog.open`
99
+ ## Custom Content And Tag Mode
162
100
 
163
101
  ```ts
164
- {
165
- componentId: 'praxis-dynamic-page',
166
- title: 'Configurar',
167
- inputs: { enableCustomization: true },
168
- data: { pageId: 'clientes-novo' },
169
- size: { width: '860px', height: '640px' }
170
- }
102
+ this.dialog.open(CustomerFormComponent, {
103
+ title: 'Edit customer',
104
+ width: '720px',
105
+ data: customer,
106
+ });
171
107
  ```
172
108
 
173
- O `componentId` é resolvido via `ComponentMetadataRegistry` (preferencial) ou via registry interno do dialog.
174
-
175
- ### Tag (embedded)
109
+ Use `openByRegistry(id, config)` or `openTemplateById(id, config)` for governed registries. Use `<praxis-dialog>` when the host template controls the shell instead of the overlay service.
176
110
 
177
111
  ```html
178
- <praxis-dialog [open]="open" (close)="open=false" [themeColor]="'light'">
179
- <ng-template praxisDialogTitle>Diálogo</ng-template>
180
- <ng-template praxisDialogContent>Conteúdo</ng-template>
112
+ <praxis-dialog [open]="open" title="Details" (close)="open = false">
113
+ <ng-template praxisDialogContent>
114
+ <app-details-panel />
115
+ </ng-template>
116
+
181
117
  <ng-template praxisDialogActions>
182
- <button class="pdx-dialog__action-btn" (click)="open=false">Fechar</button>
118
+ <button type="button" (click)="open = false">Close</button>
183
119
  </ng-template>
184
120
  </praxis-dialog>
185
121
  ```
186
122
 
187
- ## Global Presets
123
+ ## Global Actions
188
124
 
189
- Provide presets app‑wide:
125
+ Register the global dialog bridge when metadata-driven surfaces need to open alerts, confirmations, prompts or registered component dialogs through `GLOBAL_DIALOG_SERVICE`.
190
126
 
191
127
  ```ts
192
- import { PRAXIS_DIALOG_GLOBAL_PRESETS } from '@praxisui/dialog';
128
+ import { ApplicationConfig } from '@angular/core';
129
+ import { providePraxisDialogGlobalActions } from '@praxisui/dialog';
193
130
 
194
- providers: [{
195
- provide: PRAXIS_DIALOG_GLOBAL_PRESETS,
196
- useValue: {
197
- confirm: { themeColor: 'light', animation: { type: 'translate', duration: 200 } },
198
- variants: { question: { themeColor: 'dark', animation: { type: 'fade', duration: 150 } } },
199
- },
200
- }]
131
+ export const appConfig: ApplicationConfig = {
132
+ providers: [providePraxisDialogGlobalActions()],
133
+ };
201
134
  ```
202
135
 
203
- Merge order: type variant (optional) local config.
204
-
205
- ## Template/Component Registry
136
+ For `dialog.open`, provide `componentId`, optional `inputs`, `data`, and `size`. The id is resolved through `ComponentMetadataRegistry` first, then through the dialog content registry.
206
137
 
207
- - Component registry: `PRAXIS_DIALOG_CONTENT_REGISTRY` (string → ComponentType)
208
- - Template registry: `PRAXIS_DIALOG_TEMPLATE_REGISTRY` (string → TemplateRef)
209
-
210
- Register via `ENVIRONMENT_INITIALIZER` and open by id:
138
+ ## Presets And Host Policy
211
139
 
212
140
  ```ts
213
- providers: [{
214
- provide: ENVIRONMENT_INITIALIZER,
215
- multi: true,
216
- useFactory: (reg: Record<string, any>) => () => reg['CustomerForm'] = CustomerFormComponent,
217
- deps: [PRAXIS_DIALOG_CONTENT_REGISTRY],
218
- }]
219
-
220
- this.dialog.openByRegistry('CustomerForm', { width: 720 });
141
+ import { PRAXIS_DIALOG_GLOBAL_PRESETS } from '@praxisui/dialog';
142
+
143
+ providers: [
144
+ {
145
+ provide: PRAXIS_DIALOG_GLOBAL_PRESETS,
146
+ useValue: {
147
+ confirm: { themeColor: 'light', animation: { type: 'translate', duration: 200 } },
148
+ variants: {
149
+ destructive: { ariaRole: 'alertdialog', themeColor: 'primary', disableClose: true },
150
+ },
151
+ },
152
+ },
153
+ ];
221
154
  ```
222
155
 
223
- ## Internal Example (Long Content)
156
+ Preset merge order is `type -> variant -> local config`. Use presets for UX policy such as size, animation, backdrop and close behavior. Do not use presets to hide inconsistent domain workflows.
224
157
 
225
- For local validation of scroll behavior, you can register and open a built-in long content example:
158
+ ## Public API Snapshot
226
159
 
227
- ```ts
228
- import { providePraxisDialogExamples, PRAXIS_DIALOG_EXAMPLE_LONG_CONTENT } from '@praxisui/dialog';
160
+ Main exports: `PraxisDialog`, `PraxisDialogComponent`, template directives, `PraxisDialogRef`, dialog config types, dialog tokens, `providePraxisDialogGlobalActions`, `provideDialogGlobalPresetsFromGlobalConfig`, `PRAXIS_DIALOG_METADATA`, and `PRAXIS_DIALOG_AUTHORING_MANIFEST`.
229
161
 
230
- providers: [providePraxisDialogExamples()]
231
- ```
162
+ ## Accessibility
232
163
 
233
- ```ts
234
- this.dialog.openByRegistry(PRAXIS_DIALOG_EXAMPLE_LONG_CONTENT, {
235
- title: 'Long content example',
236
- actions: [
237
- { text: 'Close', role: 'primary', close: true },
238
- ],
239
- });
240
- ```
164
+ `PraxisDialog` configures dialog roles, backdrop behavior, Escape handling, focus restoration and `aria-*` fields. Use `ariaRole: 'alertdialog'` for destructive or blocking confirmations, and always provide a visible title or accessible label.
241
165
 
242
- ## Accessibility
166
+ ## Official Links
243
167
 
244
- - `role="dialog|alertdialog"`, `aria-modal`, `aria-*` inputs
245
- - Focus trap + ESC (respects `disableClose`)
246
- - In `alertdialog`, focuses the primary action when present
247
- - Restores focus on close (service and tag)
248
-
249
- ## Agentic Authoring Contract
250
-
251
- `@praxisui/dialog` publishes an executable authoring manifest for the
252
- `praxis-dialog` shell. The manifest governs overlay configuration such as size,
253
- position, backdrop, close policy, presets, accessibility fields and the child
254
- host envelope.
255
-
256
- Dialog authoring intentionally separates shell semantics from child component
257
- semantics:
258
-
259
- - shell operations edit `PraxisDialogConfig`
260
- - size, position and backdrop operations are visual overlay changes
261
- - close policy edits are explicit, confirmation-gated shell configuration
262
- - preset operations preserve the merge order `type -> variant -> local config`
263
- - child host operations resolve component/template ids through governed
264
- registries
265
- - child component config edits must be delegated to the child component
266
- manifest through `childOperation.delegate`
267
-
268
- This prevents the dialog manifest from becoming an ad hoc facade over table,
269
- form, page or custom component configuration.
270
- Each operation declares its editable target, resolver, ambiguity policy,
271
- preconditions, validators, effects, affected paths and typed
272
- `submissionImpact`.
273
-
274
- ## Theming & Styles
275
-
276
- - `themeColor: 'light' | 'dark' | 'primary'`
277
- - Style tokens via `styles` map to CSS vars (e.g. `containerShape`, `contentPadding`, `typography` fields)
278
- - Size props (`width/height/min/max`) are top‑level inputs
279
-
280
- ## API (quick reference)
281
-
282
- Exports:
283
- - Service: `PraxisDialog`
284
- - Component + directives: `PraxisDialogComponent`, `PraxisDialogTitleDirective`, `PraxisDialogContentDirective`, `PraxisDialogActionsDirective`
285
- - Ref: `PraxisDialogRef`
286
- - Tokens: `PRAXIS_DIALOG_DATA`, `PRAXIS_DIALOG_DEFAULTS`, `PRAXIS_DIALOG_GLOBAL_PRESETS`, `PRAXIS_DIALOG_I18N`, registries
287
- - Types: `PraxisDialogConfig`, `PraxisConfirmConfig`, `PraxisAlertConfig`, `PraxisPromptConfig`
288
-
289
- Highlights:
290
- - `afterAllClosed`, `afterOpened`, `openDialogs`, `closeAll()`, `getDialogById(id)`
291
- - `PraxisDialogRef`: `afterOpened/beforeClosed/afterClosed`, `backdropClick`, `keydownEvents`, `close()`, `updateSize/Position()`
292
-
293
- ## Links
294
- - Repo: https://github.com/codexrodrigues/praxis
295
- - Issues: https://github.com/codexrodrigues/praxis/issues
168
+ - Documentation: https://praxisui.dev/components/dialog
169
+ - Live demo: https://praxis-ui-4e602.web.app
170
+ - Quickstart repository: https://github.com/codexrodrigues/praxis-ui-quickstart
171
+ - Source and issues: https://github.com/codexrodrigues/praxis-ui-angular
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@praxisui/dialog",
3
- "version": "9.0.0-beta.1",
3
+ "version": "9.0.0-beta.2",
4
4
  "description": "Dialog helpers and components for Praxis UI with Angular Material integration.",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^21.0.0",
7
7
  "@angular/core": "^21.0.0",
8
8
  "@angular/cdk": "^21.0.0",
9
9
  "@angular/forms": "^21.0.0",
10
- "@praxisui/core": "^9.0.0-beta.1",
10
+ "@praxisui/core": "^9.0.0-beta.2",
11
11
  "@angular/material": "^21.0.0",
12
12
  "@angular/platform-browser": "^21.0.0",
13
13
  "rxjs": "~7.8.0"
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "repository": {
23
23
  "type": "git",
24
- "url": "https://github.com/codexrodrigues/praxis-ui-angular"
24
+ "url": "git+https://github.com/codexrodrigues/praxis-ui-angular.git"
25
25
  },
26
26
  "homepage": "https://praxisui.dev",
27
27
  "bugs": {