@praxisui/dialog 8.0.0-beta.104 → 8.0.0-beta.105

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
@@ -41,21 +41,34 @@ last_updated: "2026-03-07"
41
41
 
42
42
  # @praxisui/dialog
43
43
 
44
- > Unified dialog for Praxis built on Angular CDK. Provides a service API (MatDialog-like) and a tag mode (`<praxis-dialog>`) with theming, CSS-only animations, accessibility and metadata integration.
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.
45
45
 
46
- ## Documentation
46
+ ## O que publica por contrato
47
47
 
48
- - Official documentation: https://praxisui.dev
49
- - Quickstart reference app: https://github.com/codexrodrigues/praxis-ui-quickstart
50
- - Recommended for: Angular hosts that need an accessible overlay/dialog API aligned with Praxis theming and metadata workflows
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.
51
54
 
52
- ## When to use
55
+ ## O que resolve alem do equivalente basico
53
56
 
54
- - Open confirms, modals and side interactions with a consistent service API
55
- - Keep dialog behavior aligned with host theming, accessibility and metadata contracts
56
- - Replace ad hoc overlay implementations with a governed Praxis pattern
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.
57
62
 
58
- The diagram below shows the intended ownership model: the host triggers the dialog service, Praxis Dialog applies presets and accessibility semantics, and the final overlay stays aligned with host theme and policy.
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.
59
72
 
60
73
  ```mermaid
61
74
  flowchart LR
@@ -66,6 +79,27 @@ flowchart LR
66
79
  overlay --> result["afterClosed / host action"]
67
80
  ```
68
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)
102
+
69
103
  ## Install
70
104
 
71
105
  ```bash
@@ -722,6 +722,21 @@ class PraxisDialog {
722
722
  }
723
723
  catch { }
724
724
  const subAction = container.action.subscribe((a) => {
725
+ const shouldSubmitPrompt = !a.close &&
726
+ a.id === 'ok' &&
727
+ config?.data?.mode === 'prompt' &&
728
+ !config?.disableClose;
729
+ if (shouldSubmitPrompt) {
730
+ const content = ref.componentInstance;
731
+ const submit = content?.submit;
732
+ if (typeof submit === 'function') {
733
+ submit();
734
+ }
735
+ else {
736
+ ref.close((content?.value ?? ''));
737
+ }
738
+ return;
739
+ }
725
740
  if (a.close && !config?.disableClose) {
726
741
  ref.close(a.payload);
727
742
  }
@@ -1108,7 +1123,9 @@ function buildDialogConfig(payload) {
1108
1123
  function buildHostInputs(payload, context, options) {
1109
1124
  return {
1110
1125
  subtitle: options?.includeSubtitle === false ? undefined : payload.subtitle,
1126
+ beforeWidget: payload.beforeWidget,
1111
1127
  widget: payload.widget,
1128
+ afterWidget: payload.afterWidget,
1112
1129
  context: {
1113
1130
  ...(payload.context || {}),
1114
1131
  actionContext: context || null,
@@ -1116,9 +1133,40 @@ function buildHostInputs(payload, context, options) {
1116
1133
  pageContext: context?.pageContext,
1117
1134
  meta: context?.meta,
1118
1135
  runtime: context?.runtime,
1136
+ ...(options?.surfaceRuntime
1137
+ ? { surfaceRuntime: options.surfaceRuntime }
1138
+ : {}),
1119
1139
  },
1120
1140
  };
1121
1141
  }
1142
+ function buildDialogSurfaceRuntime(ref, resultSubject) {
1143
+ return {
1144
+ closed$: ref.afterClosed(),
1145
+ result$: resultSubject.asObservable(),
1146
+ emitResult: (result) => resultSubject.next(result),
1147
+ close: (result) => { void ref.close(result); },
1148
+ updateSize: (preset) => {
1149
+ const width = resolveDialogWidth(preset);
1150
+ if (width) {
1151
+ ref.updateSize(width);
1152
+ }
1153
+ },
1154
+ };
1155
+ }
1156
+ function resolveDialogWidth(preset) {
1157
+ switch (preset) {
1158
+ case 'narrow':
1159
+ return '420px';
1160
+ case 'default':
1161
+ return '720px';
1162
+ case 'wide':
1163
+ return '960px';
1164
+ case 'full':
1165
+ return '100vw';
1166
+ default:
1167
+ return preset || undefined;
1168
+ }
1169
+ }
1122
1170
  function applySurfaceHostInputs(ref, hostInputs) {
1123
1171
  const apply = () => {
1124
1172
  if (!ref.componentInstance)
@@ -1153,7 +1201,6 @@ function providePraxisSurfaceGlobalActions() {
1153
1201
  return {
1154
1202
  open: async (payload, context) => {
1155
1203
  const materializedPayload = await materializer.materialize(payload, context);
1156
- const hostInputs = buildHostInputs(materializedPayload, context);
1157
1204
  if (materializedPayload.presentation === 'drawer') {
1158
1205
  if (!surfaceDrawer) {
1159
1206
  throw new Error('Drawer surface service not available');
@@ -1179,6 +1226,13 @@ function providePraxisSurfaceGlobalActions() {
1179
1226
  return ref;
1180
1227
  }
1181
1228
  const ref = dialog.open(PraxisSurfaceHostComponent, buildDialogConfig(materializedPayload));
1229
+ const resultSubject = new Subject();
1230
+ ref.afterClosed().subscribe(() => resultSubject.complete());
1231
+ ref.result$ = resultSubject.asObservable();
1232
+ ref.emitResult = (result) => resultSubject.next(result);
1233
+ const hostInputs = buildHostInputs(materializedPayload, context, {
1234
+ surfaceRuntime: buildDialogSurfaceRuntime(ref, resultSubject),
1235
+ });
1182
1236
  applySurfaceHostInputs(ref, hostInputs);
1183
1237
  return ref;
1184
1238
  },
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@praxisui/dialog",
3
- "version": "8.0.0-beta.104",
3
+ "version": "8.0.0-beta.105",
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": "^8.0.0-beta.104",
10
+ "@praxisui/core": "^8.0.0-beta.105",
11
11
  "@angular/material": "^21.0.0",
12
12
  "@angular/platform-browser": "^21.0.0",
13
13
  "rxjs": "~7.8.0"