@nanahoshi/mona-ui 0.24.7 → 0.24.9

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 (97) hide show
  1. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
  2. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +37 -9
  3. package/fesm2022/nanahoshi-mona-ui-button.mjs +8 -2
  4. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +4 -3
  5. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
  6. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +101 -47
  7. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +339 -101
  8. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +119 -69
  9. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1 -1
  10. package/fesm2022/nanahoshi-mona-ui-editor.mjs +2 -2
  11. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-vXXNWmEN.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DhKLnW06.mjs} +2 -2
  12. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-DDgNmgE0.mjs → nanahoshi-mona-ui-grid-grid-list.component-voGbKOiB.mjs} +4 -4
  13. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-Dzf6Vbs_.mjs → nanahoshi-mona-ui-grid-grid-row.component-HQ1Kv6R9.mjs} +2 -3
  14. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-DAPNqnWV.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-PNLJFcuH.mjs} +4 -4
  15. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-B9rmDLq8.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BO19AVwC.mjs} +10 -10
  16. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  17. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +44 -3
  18. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +20 -4
  19. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +335 -45
  20. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +565 -197
  21. package/fesm2022/nanahoshi-mona-ui-internal.mjs +465 -23
  22. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +598 -208
  23. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +193 -71
  24. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +29 -3
  25. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +33 -3
  26. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +33 -3
  27. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +40 -3
  28. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +29 -3
  29. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +33 -3
  30. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +29 -3
  31. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +29 -3
  32. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +33 -3
  33. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +49 -3
  34. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +29 -3
  35. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +29 -3
  36. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +29 -3
  37. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +127 -133
  38. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1 -1
  39. package/fesm2022/nanahoshi-mona-ui-notification.mjs +473 -240
  40. package/fesm2022/nanahoshi-mona-ui-popover.mjs +202 -90
  41. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +609 -256
  42. package/fesm2022/nanahoshi-mona-ui-popup.mjs +2 -0
  43. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +45 -10
  44. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +102 -58
  45. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +286 -443
  46. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +205 -140
  47. package/fesm2022/nanahoshi-mona-ui-window.mjs +591 -310
  48. package/i18n/catalogs/en-US.messages.json +32 -6
  49. package/locales/ar-sa/ar-sa.messages.json +29 -3
  50. package/locales/de-de/de-de.messages.json +29 -3
  51. package/locales/es-es/es-es.messages.json +29 -3
  52. package/locales/fr-fr/fr-fr.messages.json +29 -3
  53. package/locales/id-id/id-id.messages.json +29 -3
  54. package/locales/it-it/it-it.messages.json +29 -3
  55. package/locales/ja-jp/ja-jp.messages.json +29 -3
  56. package/locales/ko-kr/ko-kr.messages.json +29 -3
  57. package/locales/pt-br/pt-br.messages.json +29 -3
  58. package/locales/ru-ru/ru-ru.messages.json +29 -3
  59. package/locales/tr-tr/tr-tr.messages.json +29 -3
  60. package/locales/zh-cn/zh-cn.messages.json +29 -3
  61. package/locales/zh-tw/zh-tw.messages.json +29 -3
  62. package/package.json +1 -1
  63. package/types/nanahoshi-mona-ui-button-group.d.ts +13 -3
  64. package/types/nanahoshi-mona-ui-button.d.ts +20 -3
  65. package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -6
  66. package/types/nanahoshi-mona-ui-dialog.d.ts +131 -20
  67. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +75 -56
  68. package/types/nanahoshi-mona-ui-i18n.d.ts +69 -0
  69. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +14 -2
  70. package/types/nanahoshi-mona-ui-internal-list.d.ts +89 -10
  71. package/types/nanahoshi-mona-ui-internal-tree.d.ts +155 -40
  72. package/types/nanahoshi-mona-ui-internal.d.ts +128 -16
  73. package/types/nanahoshi-mona-ui-list-box.d.ts +148 -47
  74. package/types/nanahoshi-mona-ui-list-view.d.ts +112 -21
  75. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +26 -0
  76. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +26 -0
  77. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +26 -0
  78. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +26 -0
  79. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +26 -0
  80. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +26 -0
  81. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +26 -0
  82. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +26 -0
  83. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +26 -0
  84. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +26 -0
  85. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +26 -0
  86. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +26 -0
  87. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +26 -0
  88. package/types/nanahoshi-mona-ui-menubar.d.ts +65 -62
  89. package/types/nanahoshi-mona-ui-notification.d.ts +76 -16
  90. package/types/nanahoshi-mona-ui-popover.d.ts +44 -17
  91. package/types/nanahoshi-mona-ui-popup-menu.d.ts +110 -32
  92. package/types/nanahoshi-mona-ui-popup.d.ts +2 -0
  93. package/types/nanahoshi-mona-ui-sheet.d.ts +16 -5
  94. package/types/nanahoshi-mona-ui-split-button.d.ts +29 -7
  95. package/types/nanahoshi-mona-ui-tooltip.d.ts +43 -20
  96. package/types/nanahoshi-mona-ui-tree-view.d.ts +84 -40
  97. package/types/nanahoshi-mona-ui-window.d.ts +103 -14
@@ -1,16 +1,16 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Directive, inject, ElementRef, computed, afterNextRender, Component, signal, DOCUMENT, Injector, forwardRef, Injectable, DestroyRef, contentChild, TemplateRef, output, input, effect } from '@angular/core';
2
+ import { Directive, inject, ElementRef, Injector, viewChild, ViewContainerRef, computed, TemplateRef, effect, untracked, afterNextRender, isDevMode, Component, InjectionToken, signal, DOCUMENT, forwardRef, Injectable, DestroyRef, contentChild, output, input } from '@angular/core';
3
3
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
4
+ import { MonaI18nService, mergeMessages } from '@nanahoshi/mona-ui/i18n';
5
+ import { themeOverlaySurfaceClasses, createElementControlId, focusElement, positionGlobalOverlay, inertOutside } from '@nanahoshi/mona-ui/internal';
4
6
  import { PopupDataInjectionToken, PopupCloseEvent, PopupCloseSource, PopupService } from '@nanahoshi/mona-ui/popup';
5
- import { Subject, map, takeUntil, take } from 'rxjs';
6
- import { PreventableEvent, AnyPipe } from '@nanahoshi/mona-ui/common';
7
- import { themeOverlaySurfaceClasses, createElementControlId, focusElement, setWindowStyles } from '@nanahoshi/mona-ui/internal';
7
+ import { Subject, ReplaySubject, take, takeUntil, merge, map } from 'rxjs';
8
8
  import * as i1 from '@angular/cdk/a11y';
9
9
  import { CdkTrapFocus } from '@angular/cdk/a11y';
10
10
  import { NgTemplateOutlet } from '@angular/common';
11
11
  import { LucideOctagonAlert, LucideCircleCheckBig, LucideBadgeInfo, LucideOctagonX, LucideBadgeQuestionMark, LucideX, LucideDynamicIcon } from '@lucide/angular';
12
12
  import { ButtonDirective } from '@nanahoshi/mona-ui/button';
13
- import { MonaI18nService, mergeMessages } from '@nanahoshi/mona-ui/i18n';
13
+ import { AnyPipe, PreventableEvent } from '@nanahoshi/mona-ui/common';
14
14
  import { cva } from 'class-variance-authority';
15
15
 
16
16
  class DialogContentTemplateDirective {
@@ -68,23 +68,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
68
68
  }]
69
69
  }] });
70
70
 
71
- /**
72
- * @description Emitted when the user clicks a dialog action button. Call `preventDefault()` to keep the dialog open.
73
- */
74
- class DialogActionEvent extends PreventableEvent {
75
- #action;
76
- constructor(action) {
77
- super("dialogAction");
78
- this.#action = action;
79
- }
80
- /**
81
- * @description The action that was clicked.
82
- */
83
- get action() {
84
- return this.#action;
85
- }
86
- }
87
-
88
71
  // Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
89
72
  // Edit the JSON file and run `npm run generate:locale-catalogs`.
90
73
  const DIALOG_DEFAULT_MESSAGES = {
@@ -94,7 +77,7 @@ const DIALOG_DEFAULT_MESSAGES = {
94
77
  };
95
78
 
96
79
  const dialogBaseThemeVariants = cva(`
97
- flex h-full w-full flex-col gap-0.5 overflow-hidden
80
+ flex h-full max-h-[inherit] min-h-0 w-full flex-col gap-0.5 overflow-hidden
98
81
  ${themeOverlaySurfaceClasses} text-foreground
99
82
  border border-border shadow-(--shadow-overlay) outline-none
100
83
  `, {
@@ -111,10 +94,10 @@ const dialogBaseThemeVariants = cva(`
111
94
  }
112
95
  });
113
96
  const dialogContentContainerThemeVariants = cva(`
114
- flex flex-1 flex-row gap-1
97
+ flex min-h-0 flex-1 flex-row gap-1
115
98
  `);
116
99
  const dialogBodyThemeVariants = cva(`
117
- flex h-full w-full flex-col gap-0 pe-2 pb-2
100
+ flex h-full min-h-0 w-full flex-col gap-0 pe-2 pb-2
118
101
  `, {
119
102
  variants: {
120
103
  hasIcon: {
@@ -124,8 +107,7 @@ const dialogBodyThemeVariants = cva(`
124
107
  }
125
108
  });
126
109
  const dialogHeaderThemeVariants = cva(`
127
- flex flex-row gap-2 pt-4
128
- select-none
110
+ flex shrink-0 flex-row gap-2 pt-4
129
111
  `);
130
112
  const dialogIconContainerThemeVariants = cva(`
131
113
  flex items-start justify-center pt-8 pe-4 ps-6
@@ -151,7 +133,6 @@ const dialogIconThemeVariants = cva(`
151
133
  });
152
134
  const dialogTitleContainerThemeVariants = cva(`
153
135
  flex flex-1 items-center justify-start p-1
154
- select-none
155
136
  `);
156
137
  const dialogCloseButtonContainerThemeVariants = cva(`
157
138
  flex items-start justify-end
@@ -161,15 +142,13 @@ const dialogTitleThemeVariants = cva(`
161
142
  `);
162
143
  const dialogDescriptionThemeVariants = cva(`
163
144
  text-sm text-muted-foreground
164
- select-none
165
145
  `);
166
146
  const dialogContentThemeVariants = cva(`
167
- flex-1 overflow-auto p-1
147
+ min-h-0 flex-1 overflow-auto p-1
168
148
  [scrollbar-color:var(--color-scrollbar-thumb)_var(--color-scrollbar-track)] [scrollbar-width:thin]
169
149
  `);
170
150
  const dialogFooterThemeVariants = cva(`
171
- flex flex-row gap-2 px-4 py-2
172
- select-none
151
+ flex shrink-0 flex-row gap-2 px-4 py-2
173
152
  bg-surface-muted
174
153
  border-t border-border-subtle
175
154
  `, {
@@ -192,13 +171,36 @@ const dialogFooterThemeVariants = cva(`
192
171
  }
193
172
  });
194
173
 
174
+ /** Targets that handle Enter themselves, so it doesn't trigger the dialog's default action. */
175
+ const HANDLES_ENTER = [
176
+ "a[href]",
177
+ "button",
178
+ "form",
179
+ "select",
180
+ "textarea",
181
+ "[contenteditable]:not([contenteditable='false'])",
182
+ "[role='button']",
183
+ "[role='checkbox']",
184
+ "[role='combobox']",
185
+ "[role='link']",
186
+ "[role='listbox']",
187
+ "[role='menu']",
188
+ "[role='menuitem']",
189
+ "[role='option']",
190
+ "[role='radio']",
191
+ "[role='switch']",
192
+ "[role='tab']",
193
+ "input:is([type='button'], [type='checkbox'], [type='color'], [type='file'], [type='image'], [type='radio'], [type='reset'], [type='submit'])"
194
+ ].join(", ");
195
195
  class DialogContentComponent {
196
196
  #hostElementRef;
197
197
  #i18n;
198
198
  #iconMap;
199
199
  #injectedData;
200
+ #injector;
200
201
  #localeMessages;
201
202
  #trapFocus;
203
+ #componentRef;
202
204
  constructor() {
203
205
  this.#hostElementRef = inject(ElementRef);
204
206
  this.#i18n = inject(MonaI18nService);
@@ -210,8 +212,11 @@ class DialogContentComponent {
210
212
  warning: { color: "var(--color-warning)", icon: LucideOctagonAlert }
211
213
  };
212
214
  this.#injectedData = inject(PopupDataInjectionToken);
215
+ this.#injector = inject(Injector);
213
216
  this.#localeMessages = this.#i18n.componentMessages("dialog", DIALOG_DEFAULT_MESSAGES);
214
217
  this.#trapFocus = inject(CdkTrapFocus);
218
+ this.#componentRef = null;
219
+ this.componentHost = viewChild("componentHost", { ...(ngDevMode ? { debugName: "componentHost" } : /* istanbul ignore next */ {}), read: ViewContainerRef });
215
220
  this.actions = computed(() => {
216
221
  const data = this.dialogData();
217
222
  if (data.actions != null) {
@@ -238,10 +243,20 @@ class DialogContentComponent {
238
243
  return dialogContentThemeVariants();
239
244
  }, /* @ts-ignore */
240
245
  ...(ngDevMode ? [{ debugName: "contentClass" }] : /* istanbul ignore next */ []));
246
+ this.contentComponent = computed(() => {
247
+ const content = this.dialogData().content;
248
+ return content && !(content instanceof TemplateRef) ? content : null;
249
+ }, /* @ts-ignore */
250
+ ...(ngDevMode ? [{ debugName: "contentComponent" }] : /* istanbul ignore next */ []));
241
251
  this.contentContainerClass = computed(() => {
242
252
  return dialogContentContainerThemeVariants();
243
253
  }, /* @ts-ignore */
244
254
  ...(ngDevMode ? [{ debugName: "contentContainerClass" }] : /* istanbul ignore next */ []));
255
+ this.contentTemplate = computed(() => {
256
+ const content = this.dialogData().content;
257
+ return content instanceof TemplateRef ? content : null;
258
+ }, /* @ts-ignore */
259
+ ...(ngDevMode ? [{ debugName: "contentTemplate" }] : /* istanbul ignore next */ []));
245
260
  this.describedById = computed(() => {
246
261
  const data = this.dialogData();
247
262
  return data.descriptionTemplate || data.description ? this.descriptionId : null;
@@ -254,6 +269,7 @@ class DialogContentComponent {
254
269
  this.descriptionId = createElementControlId();
255
270
  this.dialogData = computed(() => this.dialogReference.data(), /* @ts-ignore */
256
271
  ...(ngDevMode ? [{ debugName: "dialogData" }] : /* istanbul ignore next */ []));
272
+ this.dialogRef = this.#injectedData.dialogReference.dialogRef;
257
273
  this.dialogReference = this.#injectedData.dialogReference;
258
274
  this.footerClass = computed(() => {
259
275
  const layout = this.dialogData().actionsLayout;
@@ -261,6 +277,11 @@ class DialogContentComponent {
261
277
  return dialogFooterThemeVariants({ layout, rounded });
262
278
  }, /* @ts-ignore */
263
279
  ...(ngDevMode ? [{ debugName: "footerClass" }] : /* istanbul ignore next */ []));
280
+ this.hasTitle = computed(() => {
281
+ const data = this.dialogData();
282
+ return !!data.titleTemplate || !!data.title;
283
+ }, /* @ts-ignore */
284
+ ...(ngDevMode ? [{ debugName: "hasTitle" }] : /* istanbul ignore next */ []));
264
285
  this.headerClass = computed(() => {
265
286
  return dialogHeaderThemeVariants();
266
287
  }, /* @ts-ignore */
@@ -298,22 +319,63 @@ class DialogContentComponent {
298
319
  }, /* @ts-ignore */
299
320
  ...(ngDevMode ? [{ debugName: "titleContainerClass" }] : /* istanbul ignore next */ []));
300
321
  this.#trapFocus.autoCapture = true;
322
+ // A non-modal dialog leaves the page usable, so Tab can leave it too.
323
+ this.#trapFocus.enabled = this.dialogData().modal ?? true;
324
+ effect(() => {
325
+ const host = this.componentHost();
326
+ const type = this.contentComponent();
327
+ untracked(() => this.#renderComponent(host, type));
328
+ });
301
329
  afterNextRender({
302
- read: () => {
330
+ write: () => {
303
331
  this.focusElement();
332
+ if (isDevMode()) {
333
+ this.#warnIfUnnamed();
334
+ }
304
335
  }
305
336
  });
306
337
  }
307
338
  onActionClick(action) {
308
- this.dialogReference.dialogResult$.next({
309
- action,
310
- viaClose: false
311
- });
339
+ this.dialogReference.requestAction(action);
312
340
  }
313
341
  onCloseClick() {
314
- this.dialogReference.dialogResult$.next({
315
- viaClose: true
316
- });
342
+ this.dialogReference.requestClose();
343
+ }
344
+ /** Enter outside a control that handles it triggers the default action, as in a form. */
345
+ onKeydown(event) {
346
+ if (event.key !== "Enter" || event.defaultPrevented || event.isComposing) {
347
+ return;
348
+ }
349
+ if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey || this.dialogData().footerTemplate) {
350
+ return;
351
+ }
352
+ const target = event.target instanceof Element ? event.target : null;
353
+ if (target?.closest(HANDLES_ENTER)) {
354
+ return;
355
+ }
356
+ const action = Array.from(this.actions()).find(candidate => candidate.default);
357
+ if (action) {
358
+ event.preventDefault();
359
+ this.onActionClick(action);
360
+ }
361
+ }
362
+ #renderComponent(host, type) {
363
+ if (this.#componentRef && (!host || this.#componentRef.componentType !== type)) {
364
+ this.#componentRef.destroy();
365
+ this.#componentRef = null;
366
+ this.dialogReference.setComponentRef(undefined);
367
+ }
368
+ if (host && type && !this.#componentRef) {
369
+ host.clear();
370
+ this.#componentRef = host.createComponent(type, { injector: this.#injector });
371
+ this.dialogReference.setComponentRef(this.#componentRef);
372
+ }
373
+ }
374
+ #warnIfUnnamed() {
375
+ if (this.hasTitle() || this.dialogData().ariaLabel) {
376
+ return;
377
+ }
378
+ console.warn("[Mona Dialog] A dialog needs an accessible name. Set title, titleTemplate or ariaLabel.", this.#hostElementRef.nativeElement);
317
379
  }
318
380
  focusElement() {
319
381
  const element = this.dialogData().focusedElement;
@@ -324,32 +386,54 @@ class DialogContentComponent {
324
386
  focusElement(dialogElement, element);
325
387
  }
326
388
  getDefaultActions(type) {
389
+ const messages = this.messages();
390
+ const ok = { data: "ok", default: true, look: "primary", text: messages.ok };
327
391
  if (type === "confirm") {
328
- return [
329
- { cssClass: "", iconOnly: false, look: "primary", rounded: "medium", text: this.messages().ok },
330
- { cssClass: "", iconOnly: false, look: "default", rounded: "medium", text: this.messages().cancel }
331
- ];
392
+ return [ok, { data: "cancel", look: "default", text: messages.cancel }];
332
393
  }
333
- return [{ cssClass: "", iconOnly: false, look: "primary", rounded: "medium", text: this.messages().ok }];
394
+ return [ok];
334
395
  }
335
396
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
336
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: DialogContentComponent, isStandalone: true, selector: "ng-component", host: { properties: { "class": "baseClass()", "attr.aria-describedby": "describedById()", "attr.aria-labelledby": "headerId", "attr.role": "role()" } }, hostDirectives: [{ directive: i1.CdkTrapFocus }], ngImport: i0, template: "@let dialogIcon = icon();\n@let data = dialogData();\n\n<div [class]=\"contentContainerClass()\">\n @if (dialogIcon) {\n <div [class]=\"iconContainerClass()\">\n @if (data.iconTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.iconTemplate\"></ng-container>\n } @else {\n <div [class]=\"iconClass()\">\n <span aria-hidden=\"true\"></span>\n <svg [lucideIcon]=\"dialogIcon.icon\" [size]=\"24\" [style.color]=\"dialogIcon.color\"></svg>\n </div>\n }\n </div>\n }\n <div [class]=\"bodyClass()\">\n <div [class]=\"headerClass()\">\n <div [id]=\"headerId\" [class]=\"titleContainerClass()\">\n @if (data.titleTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.titleTemplate\"></ng-container>\n } @else {\n <h2 [class]=\"titleClass()\">{{ data.title }}</h2>\n }\n </div>\n @if (data.closable) {\n <div [class]=\"closeButtonContainerClass()\">\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"messages().closeDialog\"\n (click)=\"onCloseClick()\">\n <svg lucideX [size]=\"16\"></svg>\n </button>\n </div>\n }\n </div>\n\n @let descriptionTemplateId = data.descriptionTemplate ? descriptionId : undefined;\n <div class=\"p-1\" [attr.id]=\"descriptionTemplateId\">\n @if (data.descriptionTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.descriptionTemplate\"></ng-container>\n } @else if (data.description) {\n <p [id]=\"descriptionId\" [class]=\"descriptionClass()\">{{ data.description }}</p>\n }\n </div>\n\n <div [class]=\"contentClass()\">\n @if (data.content) {\n <ng-container [ngTemplateOutlet]=\"data.content\"></ng-container>\n } @else if (data.text) {\n <p class=\"select-none\">{{ data.text }}</p>\n }\n </div>\n </div>\n</div>\n\n@if (data.footerTemplate || (actions() | monaAny)) {\n @if (data.footerTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.footerTemplate\"></ng-container>\n } @else {\n <div [class]=\"footerClass()\">\n @for (action of actions(); track $index) {\n <button\n monaButton\n type=\"button\"\n [class]=\"action.cssClass || ''\"\n [iconOnly]=\"action.iconOnly || false\"\n [look]=\"action.look\"\n [rounded]=\"action.rounded || data.rounded\"\n (click)=\"onActionClick(action)\">\n {{ action.text }}\n </button>\n }\n </div>\n }\n}\n", dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "type", "class"], outputs: ["lookChange", "selectedChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LucideX, selector: "svg[lucideX]" }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }, { kind: "pipe", type: AnyPipe, name: "monaAny" }] }); }
397
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: DialogContentComponent, isStandalone: true, selector: "ng-component", host: { listeners: { "keydown": "onKeydown($event)" }, properties: { "class": "baseClass()", "attr.aria-describedby": "describedById()", "attr.aria-label": "hasTitle() ? null : dialogData().ariaLabel || null", "attr.aria-labelledby": "hasTitle() ? headerId : null", "attr.aria-modal": "dialogData().modal ? 'true' : null", "attr.role": "role()" } }, viewQueries: [{ propertyName: "componentHost", first: true, predicate: ["componentHost"], descendants: true, read: ViewContainerRef, isSignal: true }], hostDirectives: [{ directive: i1.CdkTrapFocus }], ngImport: i0, template: "@let dialogIcon = icon();\n@let data = dialogData();\n\n<div [class]=\"contentContainerClass()\">\n @if (dialogIcon) {\n <div [class]=\"iconContainerClass()\">\n @if (data.iconTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.iconTemplate\"></ng-container>\n } @else {\n <div [class]=\"iconClass()\">\n <span aria-hidden=\"true\"></span>\n <svg [lucideIcon]=\"dialogIcon.icon\" [size]=\"24\" [style.color]=\"dialogIcon.color\"></svg>\n </div>\n }\n </div>\n }\n <div [class]=\"bodyClass()\">\n <div [class]=\"headerClass()\">\n @if (hasTitle()) {\n <div [id]=\"headerId\" [class]=\"titleContainerClass()\">\n @if (data.titleTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.titleTemplate\"></ng-container>\n } @else {\n <h2 [class]=\"titleClass()\">{{ data.title }}</h2>\n }\n </div>\n } @else {\n <div class=\"flex-1\"></div>\n }\n @if (data.closable) {\n <div [class]=\"closeButtonContainerClass()\">\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"messages().closeDialog\"\n (click)=\"onCloseClick()\">\n <svg lucideX [size]=\"16\"></svg>\n </button>\n </div>\n }\n </div>\n\n @let descriptionTemplateId = data.descriptionTemplate ? descriptionId : undefined;\n <div class=\"p-1\" [attr.id]=\"descriptionTemplateId\">\n @if (data.descriptionTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.descriptionTemplate\"></ng-container>\n } @else if (data.description) {\n <p [id]=\"descriptionId\" [class]=\"descriptionClass()\">{{ data.description }}</p>\n }\n </div>\n\n <div [class]=\"contentClass()\">\n @if (contentTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: data.data, dialogRef: dialogRef }\"></ng-container>\n } @else if (contentComponent()) {\n <ng-container #componentHost></ng-container>\n } @else if (data.text) {\n <p>{{ data.text }}</p>\n }\n </div>\n </div>\n</div>\n\n@if (data.footerTemplate || (actions() | monaAny)) {\n @if (data.footerTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.footerTemplate\"></ng-container>\n } @else {\n <div [class]=\"footerClass()\">\n @for (action of actions(); track $index) {\n <button\n monaButton\n type=\"button\"\n [class]=\"action.cssClass || ''\"\n [iconOnly]=\"action.iconOnly || false\"\n [look]=\"action.look\"\n [rounded]=\"action.rounded || data.rounded\"\n (click)=\"onActionClick(action)\">\n {{ action.text }}\n </button>\n }\n </div>\n }\n}\n", dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "type", "class"], outputs: ["lookChange", "selectedChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LucideX, selector: "svg[lucideX]" }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }, { kind: "pipe", type: AnyPipe, name: "monaAny" }] }); }
337
398
  }
338
399
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogContentComponent, decorators: [{
339
400
  type: Component,
340
401
  args: [{ imports: [ButtonDirective, NgTemplateOutlet, AnyPipe, LucideX, LucideDynamicIcon], host: {
341
402
  "[class]": "baseClass()",
342
403
  "[attr.aria-describedby]": "describedById()",
343
- "[attr.aria-labelledby]": "headerId",
344
- "[attr.role]": "role()"
345
- }, hostDirectives: [CdkTrapFocus], template: "@let dialogIcon = icon();\n@let data = dialogData();\n\n<div [class]=\"contentContainerClass()\">\n @if (dialogIcon) {\n <div [class]=\"iconContainerClass()\">\n @if (data.iconTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.iconTemplate\"></ng-container>\n } @else {\n <div [class]=\"iconClass()\">\n <span aria-hidden=\"true\"></span>\n <svg [lucideIcon]=\"dialogIcon.icon\" [size]=\"24\" [style.color]=\"dialogIcon.color\"></svg>\n </div>\n }\n </div>\n }\n <div [class]=\"bodyClass()\">\n <div [class]=\"headerClass()\">\n <div [id]=\"headerId\" [class]=\"titleContainerClass()\">\n @if (data.titleTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.titleTemplate\"></ng-container>\n } @else {\n <h2 [class]=\"titleClass()\">{{ data.title }}</h2>\n }\n </div>\n @if (data.closable) {\n <div [class]=\"closeButtonContainerClass()\">\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"messages().closeDialog\"\n (click)=\"onCloseClick()\">\n <svg lucideX [size]=\"16\"></svg>\n </button>\n </div>\n }\n </div>\n\n @let descriptionTemplateId = data.descriptionTemplate ? descriptionId : undefined;\n <div class=\"p-1\" [attr.id]=\"descriptionTemplateId\">\n @if (data.descriptionTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.descriptionTemplate\"></ng-container>\n } @else if (data.description) {\n <p [id]=\"descriptionId\" [class]=\"descriptionClass()\">{{ data.description }}</p>\n }\n </div>\n\n <div [class]=\"contentClass()\">\n @if (data.content) {\n <ng-container [ngTemplateOutlet]=\"data.content\"></ng-container>\n } @else if (data.text) {\n <p class=\"select-none\">{{ data.text }}</p>\n }\n </div>\n </div>\n</div>\n\n@if (data.footerTemplate || (actions() | monaAny)) {\n @if (data.footerTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.footerTemplate\"></ng-container>\n } @else {\n <div [class]=\"footerClass()\">\n @for (action of actions(); track $index) {\n <button\n monaButton\n type=\"button\"\n [class]=\"action.cssClass || ''\"\n [iconOnly]=\"action.iconOnly || false\"\n [look]=\"action.look\"\n [rounded]=\"action.rounded || data.rounded\"\n (click)=\"onActionClick(action)\">\n {{ action.text }}\n </button>\n }\n </div>\n }\n}\n" }]
346
- }], ctorParameters: () => [] });
404
+ "[attr.aria-label]": "hasTitle() ? null : dialogData().ariaLabel || null",
405
+ "[attr.aria-labelledby]": "hasTitle() ? headerId : null",
406
+ "[attr.aria-modal]": "dialogData().modal ? 'true' : null",
407
+ "[attr.role]": "role()",
408
+ "(keydown)": "onKeydown($event)"
409
+ }, hostDirectives: [CdkTrapFocus], template: "@let dialogIcon = icon();\n@let data = dialogData();\n\n<div [class]=\"contentContainerClass()\">\n @if (dialogIcon) {\n <div [class]=\"iconContainerClass()\">\n @if (data.iconTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.iconTemplate\"></ng-container>\n } @else {\n <div [class]=\"iconClass()\">\n <span aria-hidden=\"true\"></span>\n <svg [lucideIcon]=\"dialogIcon.icon\" [size]=\"24\" [style.color]=\"dialogIcon.color\"></svg>\n </div>\n }\n </div>\n }\n <div [class]=\"bodyClass()\">\n <div [class]=\"headerClass()\">\n @if (hasTitle()) {\n <div [id]=\"headerId\" [class]=\"titleContainerClass()\">\n @if (data.titleTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.titleTemplate\"></ng-container>\n } @else {\n <h2 [class]=\"titleClass()\">{{ data.title }}</h2>\n }\n </div>\n } @else {\n <div class=\"flex-1\"></div>\n }\n @if (data.closable) {\n <div [class]=\"closeButtonContainerClass()\">\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"messages().closeDialog\"\n (click)=\"onCloseClick()\">\n <svg lucideX [size]=\"16\"></svg>\n </button>\n </div>\n }\n </div>\n\n @let descriptionTemplateId = data.descriptionTemplate ? descriptionId : undefined;\n <div class=\"p-1\" [attr.id]=\"descriptionTemplateId\">\n @if (data.descriptionTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.descriptionTemplate\"></ng-container>\n } @else if (data.description) {\n <p [id]=\"descriptionId\" [class]=\"descriptionClass()\">{{ data.description }}</p>\n }\n </div>\n\n <div [class]=\"contentClass()\">\n @if (contentTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: data.data, dialogRef: dialogRef }\"></ng-container>\n } @else if (contentComponent()) {\n <ng-container #componentHost></ng-container>\n } @else if (data.text) {\n <p>{{ data.text }}</p>\n }\n </div>\n </div>\n</div>\n\n@if (data.footerTemplate || (actions() | monaAny)) {\n @if (data.footerTemplate) {\n <ng-container [ngTemplateOutlet]=\"data.footerTemplate\"></ng-container>\n } @else {\n <div [class]=\"footerClass()\">\n @for (action of actions(); track $index) {\n <button\n monaButton\n type=\"button\"\n [class]=\"action.cssClass || ''\"\n [iconOnly]=\"action.iconOnly || false\"\n [look]=\"action.look\"\n [rounded]=\"action.rounded || data.rounded\"\n (click)=\"onActionClick(action)\">\n {{ action.text }}\n </button>\n }\n </div>\n }\n}\n" }]
410
+ }], ctorParameters: () => [], propDecorators: { componentHost: [{ type: i0.ViewChild, args: ["componentHost", { ...{ read: ViewContainerRef }, isSignal: true }] }] } });
411
+
412
+ /**
413
+ * The `data` a dialog was opened with, for a component given as its `content`.
414
+ * @example
415
+ * ```ts
416
+ * readonly #data = inject<{ name: string }>(DIALOG_DATA);
417
+ * ```
418
+ */
419
+ const DIALOG_DATA = new InjectionToken("DIALOG_DATA");
347
420
 
421
+ /**
422
+ * A handle on an open dialog. The close contract:
423
+ * - `action$` emits when an action button is clicked, before the dialog closes; `preventDefault()` keeps it open.
424
+ * - `close$` emits before any close, and `preventDefault()` keeps the dialog open.
425
+ * - `result` emits how the dialog closed as soon as the close goes ahead, and `closed$` emits the same result once
426
+ * the dialog is gone. All of them complete when it closes.
427
+ */
348
428
  class DialogRef {
349
429
  #options;
350
430
  constructor(options) {
351
431
  this.#options = options;
352
432
  }
433
+ /**
434
+ * @description Closes the dialog. The value is the `value` of the result, which reports the close as
435
+ * programmatic.
436
+ */
353
437
  close(result) {
354
438
  this.#options.close(result);
355
439
  }
@@ -360,12 +444,30 @@ class DialogRef {
360
444
  update(data) {
361
445
  this.#options.update(data);
362
446
  }
447
+ /**
448
+ * @description Emits when an action button is clicked, before the dialog closes. Call `preventDefault()` on
449
+ * the event to keep the dialog open. Completes when the dialog closes.
450
+ */
451
+ get action$() {
452
+ return this.#options.action$;
453
+ }
454
+ /**
455
+ * @description Emits before the dialog closes, whatever closes it. Call `preventDefault()` to keep it open.
456
+ * Completes when the dialog closes.
457
+ */
363
458
  get close$() {
364
459
  return this.#options.close$;
365
460
  }
461
+ /**
462
+ * @description Emits the dialog's result once it has closed and its leave animation has finished, then
463
+ * completes.
464
+ */
366
465
  get closed$() {
367
466
  return this.#options.closed$;
368
467
  }
468
+ /**
469
+ * @description The component given as `content`, or `null` for template and text content.
470
+ */
369
471
  get component() {
370
472
  return this.#options.component;
371
473
  }
@@ -378,6 +480,11 @@ class DialogRef {
378
480
  get popupRef() {
379
481
  return this.#options.popupRef;
380
482
  }
483
+ /**
484
+ * @description Emits how the dialog closed (an action, the close button, Escape, a backdrop click or
485
+ * `close()`) as soon as the close goes ahead, then completes when the dialog is gone. Late subscribers get the
486
+ * result too.
487
+ */
381
488
  get result() {
382
489
  return this.#options.result;
383
490
  }
@@ -386,11 +493,37 @@ class DialogRef {
386
493
  }
387
494
  }
388
495
 
496
+ /**
497
+ * @description Emitted when the user clicks a dialog action button. Call `preventDefault()` to keep the dialog open.
498
+ */
499
+ class DialogActionEvent extends PreventableEvent {
500
+ #action;
501
+ constructor(action) {
502
+ super("dialogAction");
503
+ this.#action = action;
504
+ }
505
+ /**
506
+ * @description The action that was clicked.
507
+ */
508
+ get action() {
509
+ return this.#action;
510
+ }
511
+ }
512
+
513
+ /**
514
+ * @internal The dialog's own side of `DialogRef`: action buttons and the close button report here, so a dialog
515
+ * opened through `DialogService` and one declared with `<mona-dialog>` close the same way.
516
+ */
389
517
  class DialogReference {
518
+ #action$ = new Subject();
519
+ #closed$ = new ReplaySubject(1);
390
520
  #dialogRef;
521
+ #options;
522
+ #result$ = new ReplaySubject(1);
523
+ #pendingAction = null;
524
+ #resultValue = null;
391
525
  constructor(options, initialData) {
392
- this.options = options;
393
- this.dialogResult$ = new Subject();
526
+ this.#options = options;
394
527
  this.#dialogRef = new DialogRef(this);
395
528
  this.data = signal(initialData, /* @ts-ignore */
396
529
  ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
@@ -402,23 +535,73 @@ class DialogReference {
402
535
  this.#popupRefOrThrow.close(event);
403
536
  }
404
537
  initializePopupRef(popupRef) {
405
- this.options.popupRef = popupRef;
538
+ this.#options.popupRef = popupRef;
539
+ popupRef.closeStart.pipe(take(1)).subscribe(event => this.#settle(event));
540
+ popupRef.closed.pipe(take(1)).subscribe(event => {
541
+ const result = this.#settle(event);
542
+ this.#result$.complete();
543
+ this.#action$.complete();
544
+ this.#closed$.next(result);
545
+ this.#closed$.complete();
546
+ });
547
+ }
548
+ /**
549
+ * Reports a click on an action button: `action$` first, where it can be prevented, then the close.
550
+ */
551
+ requestAction(action) {
552
+ const event = new DialogActionEvent(action);
553
+ this.#action$.next(event);
554
+ if (event.isDefaultPrevented()) {
555
+ return;
556
+ }
557
+ this.#pendingAction = action;
558
+ if (!this.#popupRefOrThrow.close(new PopupCloseEvent({ via: PopupCloseSource.Action }))) {
559
+ this.#pendingAction = null;
560
+ }
561
+ }
562
+ /**
563
+ * Reports a click on the close button.
564
+ */
565
+ requestClose() {
566
+ this.#popupRefOrThrow.close(new PopupCloseEvent({ via: PopupCloseSource.CloseButton }));
567
+ }
568
+ setComponentRef(componentRef) {
569
+ this.#options.componentRef = componentRef;
406
570
  }
407
571
  update(data) {
408
572
  this.data.update(current => ({ ...current, ...data }));
409
573
  }
574
+ /** Works out the result once, when the close goes ahead, and publishes it on `result`. */
575
+ #settle(event) {
576
+ if (this.#resultValue) {
577
+ return this.#resultValue;
578
+ }
579
+ const action = this.#pendingAction;
580
+ const result = action && event.via === PopupCloseSource.Action
581
+ ? { action, via: PopupCloseSource.Action, viaClose: false }
582
+ : {
583
+ value: event.result,
584
+ via: event.via == null || event.via === PopupCloseSource.Action
585
+ ? PopupCloseSource.Programmatic
586
+ : event.via,
587
+ viaClose: true
588
+ };
589
+ this.#resultValue = result;
590
+ this.#result$.next(result);
591
+ return result;
592
+ }
593
+ get action$() {
594
+ return this.#action$.asObservable();
595
+ }
410
596
  get close$() {
411
- return this.#popupRefOrThrow.beforeClose.pipe(map(event => event));
597
+ const popupRef = this.#popupRefOrThrow;
598
+ return popupRef.beforeClose.pipe(takeUntil(merge(popupRef.closed, this.#closed$).pipe(take(1))), map(event => event));
412
599
  }
413
600
  get closed$() {
414
- return this.#popupRefOrThrow.closed.pipe(map(() => undefined));
601
+ return this.#closed$.asObservable();
415
602
  }
416
603
  get component() {
417
- const popupComponent = this.#popupRefOrThrow.component;
418
- if (!popupComponent) {
419
- return null;
420
- }
421
- return popupComponent.instance.componentRef ?? null;
604
+ return this.#options.componentRef ?? null;
422
605
  }
423
606
  get dialogRef() {
424
607
  return this.#dialogRef;
@@ -433,13 +616,13 @@ class DialogReference {
433
616
  return this.#popupRefOrThrow;
434
617
  }
435
618
  get #popupRefOrThrow() {
436
- if (!this.options.popupRef) {
619
+ if (!this.#options.popupRef) {
437
620
  throw new Error("DialogReference: popupRef has not been initialized.");
438
621
  }
439
- return this.options.popupRef;
622
+ return this.#options.popupRef;
440
623
  }
441
624
  get result() {
442
- return this.dialogResult$;
625
+ return this.#result$.asObservable();
443
626
  }
444
627
  get width() {
445
628
  return this.element.offsetWidth;
@@ -450,66 +633,110 @@ const createDialogInjectorData = (settings) => {
450
633
  return {
451
634
  actions: settings.actions,
452
635
  actionsLayout: settings.actionsLayout ?? "end",
636
+ ariaLabel: settings.ariaLabel,
453
637
  closable: settings.closable ?? true,
454
638
  closeOnEscape: settings.closeOnEscape ?? true,
455
639
  content: settings.content,
640
+ data: settings.data,
456
641
  description: settings.description,
457
642
  descriptionTemplate: settings.descriptionTemplate,
458
643
  dialogReference: null,
459
644
  focusedElement: settings.focusedElement ?? null,
460
645
  footerTemplate: settings.footerTemplate,
461
- height: settings.height,
462
646
  iconTemplate: settings.iconTemplate,
463
- left: settings.left,
464
647
  messages: settings.messages,
465
648
  modal: settings.modal ?? true,
466
649
  rounded: settings.rounded ?? "medium",
467
650
  text: settings.text ?? "",
468
651
  title: settings.title,
469
652
  titleTemplate: settings.titleTemplate,
470
- top: settings.top,
471
- type: settings.type,
472
- width: settings.width ?? 450
653
+ type: settings.type
473
654
  };
474
655
  };
475
656
 
657
+ /** Marks the buttons `confirm()` and `alert()` add, so their result can be read without comparing text. */
658
+ const DIALOG_OK = "ok";
659
+ const DIALOG_CANCEL = "cancel";
660
+ /** Keeps a dialog 1rem inside the viewport unless the settings give their own limits. */
661
+ const VIEWPORT_MARGIN = "2rem";
476
662
  class DialogService {
477
663
  #document = inject(DOCUMENT);
664
+ #i18n = inject(MonaI18nService);
478
665
  #injector = inject(Injector);
666
+ #localeMessages = this.#i18n.componentMessages("dialog", DIALOG_DEFAULT_MESSAGES);
479
667
  #popupService = inject(PopupService);
668
+ /**
669
+ * Opens a dialog with an OK button. Emits once it closes, however it closes, then completes.
670
+ * The dialog opens when `alert()` is called, whether or not the result is subscribed to.
671
+ */
672
+ alert(settings) {
673
+ const actions = this.#promptActions(settings, false);
674
+ return this.show({ type: "info", ...settings, actions }).result.pipe(map(() => undefined));
675
+ }
676
+ /**
677
+ * Opens a confirmation dialog with OK and Cancel buttons. Emits `true` for OK and `false` for anything else
678
+ * (Cancel, the close button, Escape), then completes. The dialog opens when `confirm()` is called, whether or
679
+ * not the result is subscribed to.
680
+ */
681
+ confirm(settings) {
682
+ const actions = this.#promptActions(settings, true);
683
+ return this.show({ type: "confirm", ...settings, actions }).result.pipe(map(result => !result.viaClose && result.action.data === DIALOG_OK));
684
+ }
685
+ /**
686
+ * Opens a dialog.
687
+ * @typeParam R the type of the value passed to `DialogRef.close(value)`
688
+ * @typeParam D the type of `data`
689
+ */
480
690
  show(settings) {
691
+ const modal = settings.modal ?? true;
481
692
  const injectorData = createDialogInjectorData(settings);
482
693
  const dialogReference = new DialogReference({}, injectorData);
483
694
  injectorData.dialogReference = dialogReference;
484
695
  const popupRef = this.#popupService.create({
485
696
  anchor: this.#document.body,
486
- backdropClass: settings.modal
697
+ backdropClass: modal
487
698
  ? ["fixed", "inset-0", "bg-background/50", "transition-opacity", "z-40", "backdrop-blur-xs"]
488
699
  : "transparent",
700
+ blockScroll: modal,
489
701
  closeOnBackdropClick: false,
490
702
  closeOnEscape: injectorData.closeOnEscape,
491
703
  closeOnOutsideClick: false,
492
704
  content: DialogContentComponent,
493
705
  data: injectorData,
494
- hasBackdrop: settings.modal ?? true,
706
+ hasBackdrop: modal,
495
707
  height: settings.height ?? "fit-content",
496
- maxHeight: settings.maxHeight,
497
- maxWidth: settings.maxWidth,
708
+ injector: settings.injector,
709
+ maxHeight: settings.maxHeight ?? `calc(100dvh - ${VIEWPORT_MARGIN})`,
710
+ maxWidth: settings.maxWidth ?? `calc(100dvw - ${VIEWPORT_MARGIN})`,
498
711
  minHeight: settings.minHeight,
499
712
  minWidth: settings.minWidth,
713
+ popupWrapperClass: "mona-popup-constrain-height",
500
714
  positionStrategy: "global",
501
- providers: [{ provide: DialogRef, useFactory: forwardRef(() => dialogReference.dialogRef) }],
715
+ providers: [
716
+ { provide: DialogRef, useFactory: forwardRef(() => dialogReference.dialogRef) },
717
+ { provide: DIALOG_DATA, useValue: settings.data }
718
+ ],
719
+ restoreFocus: (settings.restoreFocus ?? true) ? "auto" : false,
502
720
  width: settings.width
503
721
  });
504
722
  dialogReference.initializePopupRef(popupRef);
505
- afterNextRender({
506
- read: () => {
507
- const element = popupRef.overlayRef.overlayElement;
508
- setWindowStyles(element, settings);
509
- }
510
- }, { injector: this.#injector });
723
+ positionGlobalOverlay(popupRef.overlayRef, { left: settings.left, top: settings.top });
724
+ if (modal) {
725
+ const release = inertOutside(popupRef.overlayRef.hostElement);
726
+ merge(popupRef.closeStart, popupRef.closed)
727
+ .pipe(take(1))
728
+ .subscribe(() => release());
729
+ }
730
+ // Once rendered, center again from the real size, in case the content changed it.
731
+ afterNextRender({ write: () => popupRef.overlayRef.updatePosition() }, { injector: this.#injector });
511
732
  return dialogReference.dialogRef;
512
733
  }
734
+ #promptActions(settings, withCancel) {
735
+ const messages = mergeMessages(this.#localeMessages(), settings.messages);
736
+ const ok = { data: DIALOG_OK, default: true, look: "primary", text: messages.ok };
737
+ const cancel = { data: DIALOG_CANCEL, look: "default", text: messages.cancel };
738
+ return withCancel ? [ok, cancel] : [ok];
739
+ }
513
740
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
514
741
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogService, providedIn: "root" }); }
515
742
  }
@@ -523,10 +750,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
523
750
  class DialogComponent {
524
751
  #destroyRef;
525
752
  #dialogService;
753
+ #destroyed;
526
754
  #dialogRef;
527
755
  constructor() {
528
756
  this.#destroyRef = inject(DestroyRef);
529
757
  this.#dialogService = inject(DialogService);
758
+ this.#destroyed = false;
530
759
  this.contentTemplate = contentChild(DialogContentTemplateDirective, { ...(ngDevMode ? { debugName: "contentTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
531
760
  this.descriptionTemplate = contentChild(DialogDescriptionTemplateDirective, { ...(ngDevMode ? { debugName: "descriptionTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
532
761
  this.footerTemplate = contentChild(DialogFooterTemplateDirective, { ...(ngDevMode ? { debugName: "footerTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
@@ -549,6 +778,11 @@ class DialogComponent {
549
778
  */
550
779
  this.actionsLayout = input("end", /* @ts-ignore */
551
780
  ...(ngDevMode ? [{ debugName: "actionsLayout" }] : /* istanbul ignore next */ []));
781
+ /**
782
+ * @description Accessible name for the dialog when it has no `title` or title template.
783
+ */
784
+ this.ariaLabel = input(/* @ts-ignore */
785
+ ...(ngDevMode ? [undefined, { debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
552
786
  /**
553
787
  * @description Sets the visibility of the close button in the dialog header.
554
788
  * @default true
@@ -556,8 +790,9 @@ class DialogComponent {
556
790
  this.closable = input(true, /* @ts-ignore */
557
791
  ...(ngDevMode ? [{ debugName: "closable" }] : /* istanbul ignore next */ []));
558
792
  /**
559
- * @description Emits when the user clicks on the close button or presses the escape key.
560
- * This event is preventable.
793
+ * @description Emits before the dialog closes, whatever closes it: an action, the close button, Escape, or the
794
+ * component being destroyed. Call `preventDefault()` to keep it open (a close caused by destruction can't be
795
+ * kept).
561
796
  */
562
797
  // eslint-disable-next-line @angular-eslint/no-output-native
563
798
  this.close = output();
@@ -568,7 +803,7 @@ class DialogComponent {
568
803
  this.closeOnEscape = input(true, /* @ts-ignore */
569
804
  ...(ngDevMode ? [{ debugName: "closeOnEscape" }] : /* istanbul ignore next */ []));
570
805
  /**
571
- * @description Emits when the dialog is closed.
806
+ * @description Emits when the dialog has closed and its leave animation has finished.
572
807
  */
573
808
  this.closed = output();
574
809
  /**
@@ -618,7 +853,8 @@ class DialogComponent {
618
853
  this.minWidth = input(/* @ts-ignore */
619
854
  ...(ngDevMode ? [undefined, { debugName: "minWidth" }] : /* istanbul ignore next */ []));
620
855
  /**
621
- * @description Sets whether the dialog should have an overlay behind it.
856
+ * @description Whether the dialog is modal: a backdrop, `aria-modal="true"`, focus kept inside, page scroll
857
+ * locked, and the rest of the page inert.
622
858
  * @default true
623
859
  */
624
860
  this.modal = input(true, /* @ts-ignore */
@@ -657,13 +893,14 @@ class DialogComponent {
657
893
  this.width = input(/* @ts-ignore */
658
894
  ...(ngDevMode ? [undefined, { debugName: "width" }] : /* istanbul ignore next */ []));
659
895
  afterNextRender({
660
- read: () => this.#openDialog()
896
+ write: () => this.#openDialog()
661
897
  });
662
898
  effect(() => {
663
899
  const actions = this.actions() ? [...this.actions()] : undefined;
664
900
  const update = {
665
901
  actions,
666
902
  actionsLayout: this.actionsLayout(),
903
+ ariaLabel: this.ariaLabel(),
667
904
  closable: this.closable(),
668
905
  description: this.description(),
669
906
  messages: this.messages(),
@@ -674,13 +911,18 @@ class DialogComponent {
674
911
  };
675
912
  this.#dialogRef?.update(update);
676
913
  });
677
- this.#destroyRef.onDestroy(() => this.#dialogRef?.close());
914
+ this.#destroyRef.onDestroy(() => {
915
+ // Outputs can't emit once the component is destroyed, so this close is silent.
916
+ this.#destroyed = true;
917
+ this.#dialogRef?.close();
918
+ });
678
919
  }
679
920
  #openDialog() {
680
921
  const actions = this.actions() ? [...this.actions()] : undefined;
681
922
  this.#dialogRef = this.#dialogService.show({
682
923
  actions,
683
924
  actionsLayout: this.actionsLayout(),
925
+ ariaLabel: this.ariaLabel(),
684
926
  closable: this.closable(),
685
927
  closeOnEscape: this.closeOnEscape(),
686
928
  content: this.contentTemplate(),
@@ -705,26 +947,22 @@ class DialogComponent {
705
947
  type: this.type(),
706
948
  width: this.width()
707
949
  });
708
- this.#dialogRef.result.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(result => {
709
- if (result.viaClose) {
710
- this.#dialogRef?.close(new PopupCloseEvent({ via: PopupCloseSource.CloseButton }));
711
- return;
712
- }
713
- const event = new DialogActionEvent(result.action);
950
+ this.#dialogRef.action$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((event) => {
714
951
  this.action.emit(event);
715
- if (!event.isDefaultPrevented()) {
716
- this.#dialogRef?.close();
717
- }
718
952
  });
719
- this.#dialogRef.close$.pipe(takeUntil(this.#dialogRef.popupRef.closed)).subscribe(event => {
720
- this.close.emit(event);
953
+ this.#dialogRef.close$.subscribe((event) => {
954
+ if (!this.#destroyed) {
955
+ this.close.emit(event);
956
+ }
721
957
  });
722
- this.#dialogRef.closed$.pipe(take(1)).subscribe(() => {
723
- this.closed.emit();
958
+ this.#dialogRef.closed$.subscribe(() => {
959
+ if (!this.#destroyed) {
960
+ this.closed.emit();
961
+ }
724
962
  });
725
963
  }
726
964
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
727
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: DialogComponent, isStandalone: true, selector: "mona-dialog", inputs: { actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, actionsLayout: { classPropertyName: "actionsLayout", publicName: "actionsLayout", isSignal: true, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "closeOnEscape", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, focusedElement: { classPropertyName: "focusedElement", publicName: "focusedElement", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, left: { classPropertyName: "left", publicName: "left", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, messages: { classPropertyName: "messages", publicName: "messages", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, modal: { classPropertyName: "modal", publicName: "modal", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, top: { classPropertyName: "top", publicName: "top", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { action: "action", close: "close", closed: "closed" }, host: { classAttribute: "hidden" }, queries: [{ propertyName: "contentTemplate", first: true, predicate: DialogContentTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "descriptionTemplate", first: true, predicate: DialogDescriptionTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "footerTemplate", first: true, predicate: DialogFooterTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "iconTemplate", first: true, predicate: DialogIconTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "titleTemplate", first: true, predicate: DialogTitleTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: ``, isInline: true }); }
965
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: DialogComponent, isStandalone: true, selector: "mona-dialog", inputs: { actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, actionsLayout: { classPropertyName: "actionsLayout", publicName: "actionsLayout", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "closeOnEscape", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, focusedElement: { classPropertyName: "focusedElement", publicName: "focusedElement", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, left: { classPropertyName: "left", publicName: "left", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, messages: { classPropertyName: "messages", publicName: "messages", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, modal: { classPropertyName: "modal", publicName: "modal", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, top: { classPropertyName: "top", publicName: "top", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { action: "action", close: "close", closed: "closed" }, host: { classAttribute: "hidden" }, queries: [{ propertyName: "contentTemplate", first: true, predicate: DialogContentTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "descriptionTemplate", first: true, predicate: DialogDescriptionTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "footerTemplate", first: true, predicate: DialogFooterTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "iconTemplate", first: true, predicate: DialogIconTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "titleTemplate", first: true, predicate: DialogTitleTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: ``, isInline: true }); }
728
966
  }
729
967
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogComponent, decorators: [{
730
968
  type: Component,
@@ -735,7 +973,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
735
973
  class: "hidden"
736
974
  }
737
975
  }]
738
- }], ctorParameters: () => [], propDecorators: { contentTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DialogContentTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], descriptionTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DialogDescriptionTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], footerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DialogFooterTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], iconTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DialogIconTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], titleTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DialogTitleTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], action: [{ type: i0.Output, args: ["action"] }], actions: [{ type: i0.Input, args: [{ isSignal: true, alias: "actions", required: false }] }], actionsLayout: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionsLayout", required: false }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], close: [{ type: i0.Output, args: ["close"] }], closeOnEscape: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnEscape", required: false }] }], closed: [{ type: i0.Output, args: ["closed"] }], description: [{ type: i0.Input, args: [{ isSignal: true, alias: "description", required: false }] }], focusedElement: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusedElement", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], left: [{ type: i0.Input, args: [{ isSignal: true, alias: "left", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }], messages: [{ type: i0.Input, args: [{ isSignal: true, alias: "messages", required: false }] }], minHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "minHeight", required: false }] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], modal: [{ type: i0.Input, args: [{ isSignal: true, alias: "modal", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], top: [{ type: i0.Input, args: [{ isSignal: true, alias: "top", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
976
+ }], ctorParameters: () => [], propDecorators: { contentTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DialogContentTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], descriptionTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DialogDescriptionTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], footerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DialogFooterTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], iconTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DialogIconTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], titleTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DialogTitleTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], action: [{ type: i0.Output, args: ["action"] }], actions: [{ type: i0.Input, args: [{ isSignal: true, alias: "actions", required: false }] }], actionsLayout: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionsLayout", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], close: [{ type: i0.Output, args: ["close"] }], closeOnEscape: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnEscape", required: false }] }], closed: [{ type: i0.Output, args: ["closed"] }], description: [{ type: i0.Input, args: [{ isSignal: true, alias: "description", required: false }] }], focusedElement: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusedElement", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], left: [{ type: i0.Input, args: [{ isSignal: true, alias: "left", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }], messages: [{ type: i0.Input, args: [{ isSignal: true, alias: "messages", required: false }] }], minHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "minHeight", required: false }] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], modal: [{ type: i0.Input, args: [{ isSignal: true, alias: "modal", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], top: [{ type: i0.Input, args: [{ isSignal: true, alias: "top", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
739
977
 
740
978
  /*
741
979
  * Public API Surface of @nanahoshi/mona-ui/dialog
@@ -745,5 +983,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
745
983
  * Generated bundle index. Do not edit.
746
984
  */
747
985
 
748
- export { DIALOG_DEFAULT_MESSAGES, DialogActionEvent, DialogComponent, DialogContentTemplateDirective, DialogDescriptionTemplateDirective, DialogFooterTemplateDirective, DialogIconTemplateDirective, DialogRef, DialogService, DialogTitleTemplateDirective };
986
+ export { DIALOG_CANCEL, DIALOG_DATA, DIALOG_DEFAULT_MESSAGES, DIALOG_OK, DialogActionEvent, DialogComponent, DialogContentTemplateDirective, DialogDescriptionTemplateDirective, DialogFooterTemplateDirective, DialogIconTemplateDirective, DialogRef, DialogService, DialogTitleTemplateDirective };
749
987
  //# sourceMappingURL=nanahoshi-mona-ui-dialog.mjs.map