@nanahoshi/mona-ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/README.md +25 -0
  2. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +590 -0
  3. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +168 -0
  4. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +220 -0
  5. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +225 -0
  6. package/fesm2022/nanahoshi-mona-ui-button.mjs +497 -0
  7. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +1569 -0
  8. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +339 -0
  9. package/fesm2022/nanahoshi-mona-ui-chip.mjs +453 -0
  10. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +200 -0
  11. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +853 -0
  12. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +923 -0
  13. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +495 -0
  14. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +686 -0
  15. package/fesm2022/nanahoshi-mona-ui-common.mjs +642 -0
  16. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +485 -0
  17. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +132 -0
  18. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +460 -0
  19. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +659 -0
  20. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +828 -0
  21. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +523 -0
  22. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +615 -0
  23. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +701 -0
  24. package/fesm2022/nanahoshi-mona-ui-editor.mjs +1400 -0
  25. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +245 -0
  26. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +170 -0
  27. package/fesm2022/nanahoshi-mona-ui-filter.mjs +680 -0
  28. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-cell.component-B9SQH5N-.mjs +105 -0
  29. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DlLwcCFT.mjs +42 -0
  30. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-Dgea-O0X.mjs +130 -0
  31. package/fesm2022/nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs +773 -0
  32. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DRHycGIh.mjs +240 -0
  33. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs +5374 -0
  34. package/fesm2022/nanahoshi-mona-ui-grid.mjs +2 -0
  35. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +87 -0
  36. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +154 -0
  37. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1356 -0
  38. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2263 -0
  39. package/fesm2022/nanahoshi-mona-ui-internal.mjs +379 -0
  40. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +630 -0
  41. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +527 -0
  42. package/fesm2022/nanahoshi-mona-ui-list.mjs +4 -0
  43. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +966 -0
  44. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +641 -0
  45. package/fesm2022/nanahoshi-mona-ui-notification.mjs +536 -0
  46. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +597 -0
  47. package/fesm2022/nanahoshi-mona-ui-pager.mjs +790 -0
  48. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +83 -0
  49. package/fesm2022/nanahoshi-mona-ui-popover.mjs +325 -0
  50. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +1559 -0
  51. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1321 -0
  52. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +294 -0
  53. package/fesm2022/nanahoshi-mona-ui-query.mjs +175 -0
  54. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +339 -0
  55. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +565 -0
  56. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1049 -0
  57. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +636 -0
  58. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +843 -0
  59. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +537 -0
  60. package/fesm2022/nanahoshi-mona-ui-switch.mjs +308 -0
  61. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +664 -0
  62. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +111 -0
  63. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +369 -0
  64. package/fesm2022/nanahoshi-mona-ui-theme.mjs +314 -0
  65. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +450 -0
  66. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +723 -0
  67. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +716 -0
  68. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +733 -0
  69. package/fesm2022/nanahoshi-mona-ui-window.mjs +1329 -0
  70. package/fesm2022/nanahoshi-mona-ui.mjs +9 -0
  71. package/package.json +289 -0
  72. package/types/nanahoshi-mona-ui-auto-complete.d.ts +223 -0
  73. package/types/nanahoshi-mona-ui-avatar.d.ts +642 -0
  74. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +70 -0
  75. package/types/nanahoshi-mona-ui-button-group.d.ts +77 -0
  76. package/types/nanahoshi-mona-ui-button.d.ts +111 -0
  77. package/types/nanahoshi-mona-ui-calendar.d.ts +262 -0
  78. package/types/nanahoshi-mona-ui-check-box.d.ts +133 -0
  79. package/types/nanahoshi-mona-ui-chip.d.ts +130 -0
  80. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +113 -0
  81. package/types/nanahoshi-mona-ui-color-gradient.d.ts +201 -0
  82. package/types/nanahoshi-mona-ui-color-palette.d.ts +102 -0
  83. package/types/nanahoshi-mona-ui-color-picker.d.ts +156 -0
  84. package/types/nanahoshi-mona-ui-combo-box.d.ts +232 -0
  85. package/types/nanahoshi-mona-ui-common.d.ts +386 -0
  86. package/types/nanahoshi-mona-ui-contextmenu.d.ts +129 -0
  87. package/types/nanahoshi-mona-ui-date-input.d.ts +60 -0
  88. package/types/nanahoshi-mona-ui-date-picker.d.ts +177 -0
  89. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +199 -0
  90. package/types/nanahoshi-mona-ui-dialog.d.ts +261 -0
  91. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +159 -0
  92. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +219 -0
  93. package/types/nanahoshi-mona-ui-dropdowns.d.ts +176 -0
  94. package/types/nanahoshi-mona-ui-editor.d.ts +113 -0
  95. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +87 -0
  96. package/types/nanahoshi-mona-ui-fieldset.d.ts +68 -0
  97. package/types/nanahoshi-mona-ui-filter.d.ts +115 -0
  98. package/types/nanahoshi-mona-ui-grid.d.ts +1114 -0
  99. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +25 -0
  100. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +28 -0
  101. package/types/nanahoshi-mona-ui-internal-list.d.ts +269 -0
  102. package/types/nanahoshi-mona-ui-internal-tree.d.ts +391 -0
  103. package/types/nanahoshi-mona-ui-internal.d.ts +136 -0
  104. package/types/nanahoshi-mona-ui-list-box.d.ts +225 -0
  105. package/types/nanahoshi-mona-ui-list-view.d.ts +188 -0
  106. package/types/nanahoshi-mona-ui-list.d.ts +1 -0
  107. package/types/nanahoshi-mona-ui-menubar.d.ts +198 -0
  108. package/types/nanahoshi-mona-ui-multi-select.d.ts +247 -0
  109. package/types/nanahoshi-mona-ui-notification.d.ts +106 -0
  110. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +161 -0
  111. package/types/nanahoshi-mona-ui-pager.d.ts +238 -0
  112. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -0
  113. package/types/nanahoshi-mona-ui-popover.d.ts +130 -0
  114. package/types/nanahoshi-mona-ui-popup-menu.d.ts +412 -0
  115. package/types/nanahoshi-mona-ui-popup.d.ts +485 -0
  116. package/types/nanahoshi-mona-ui-progress-bar.d.ts +139 -0
  117. package/types/nanahoshi-mona-ui-query.d.ts +89 -0
  118. package/types/nanahoshi-mona-ui-radio-button.d.ts +128 -0
  119. package/types/nanahoshi-mona-ui-scroll-view.d.ts +166 -0
  120. package/types/nanahoshi-mona-ui-slider.d.ts +305 -0
  121. package/types/nanahoshi-mona-ui-split-button.d.ts +182 -0
  122. package/types/nanahoshi-mona-ui-splitter.d.ts +70 -0
  123. package/types/nanahoshi-mona-ui-stepper.d.ts +173 -0
  124. package/types/nanahoshi-mona-ui-switch.d.ts +125 -0
  125. package/types/nanahoshi-mona-ui-tabs.d.ts +158 -0
  126. package/types/nanahoshi-mona-ui-text-area.d.ts +42 -0
  127. package/types/nanahoshi-mona-ui-text-box.d.ts +164 -0
  128. package/types/nanahoshi-mona-ui-theme.d.ts +23 -0
  129. package/types/nanahoshi-mona-ui-time-picker.d.ts +184 -0
  130. package/types/nanahoshi-mona-ui-time-selector.d.ts +143 -0
  131. package/types/nanahoshi-mona-ui-tooltip.d.ts +130 -0
  132. package/types/nanahoshi-mona-ui-tree-view.d.ts +274 -0
  133. package/types/nanahoshi-mona-ui-window.d.ts +295 -0
  134. package/types/nanahoshi-mona-ui.d.ts +2 -0
@@ -0,0 +1,828 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Directive, inject, ElementRef, computed, afterNextRender, ChangeDetectionStrategy, Component, signal, DOCUMENT, Injector, forwardRef, Injectable, DestroyRef, contentChild, TemplateRef, output, input, effect } from '@angular/core';
3
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
4
+ import { Subject, map, takeUntil, take } from 'rxjs';
5
+ import { PopupDataInjectionToken, PopupCloseEvent, PopupCloseSource, PopupService } from '@nanahoshi/mona-ui/popup';
6
+ import { PreventableEvent, AnyPipe } from '@nanahoshi/mona-ui/common';
7
+ import { createElementControlId, focusElement, setWindowStyles } from '@nanahoshi/mona-ui/internal';
8
+ import * as i1 from '@angular/cdk/a11y';
9
+ import { CdkTrapFocus } from '@angular/cdk/a11y';
10
+ import { NgTemplateOutlet } from '@angular/common';
11
+ import { LucideOctagonAlert, LucideCircleCheckBig, LucideBadgeInfo, LucideOctagonX, LucideBadgeQuestionMark, LucideX, LucideDynamicIcon } from '@lucide/angular';
12
+ import { ButtonDirective } from '@nanahoshi/mona-ui/button';
13
+ import { ThemeService } from '@nanahoshi/mona-ui/theme';
14
+ import { cva } from 'class-variance-authority';
15
+
16
+ class DialogContentTemplateDirective {
17
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogContentTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
18
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: DialogContentTemplateDirective, isStandalone: true, selector: "ng-template[monaDialogContentTemplate]", ngImport: i0 }); }
19
+ }
20
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogContentTemplateDirective, decorators: [{
21
+ type: Directive,
22
+ args: [{
23
+ selector: "ng-template[monaDialogContentTemplate]"
24
+ }]
25
+ }] });
26
+
27
+ class DialogDescriptionTemplateDirective {
28
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogDescriptionTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
29
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: DialogDescriptionTemplateDirective, isStandalone: true, selector: "ng-template[monaDialogDescriptionTemplate]", ngImport: i0 }); }
30
+ }
31
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogDescriptionTemplateDirective, decorators: [{
32
+ type: Directive,
33
+ args: [{
34
+ selector: "ng-template[monaDialogDescriptionTemplate]"
35
+ }]
36
+ }] });
37
+
38
+ class DialogFooterTemplateDirective {
39
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogFooterTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
40
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: DialogFooterTemplateDirective, isStandalone: true, selector: "ng-template[monaDialogFooterTemplate]", ngImport: i0 }); }
41
+ }
42
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogFooterTemplateDirective, decorators: [{
43
+ type: Directive,
44
+ args: [{
45
+ selector: "ng-template[monaDialogFooterTemplate]"
46
+ }]
47
+ }] });
48
+
49
+ class DialogIconTemplateDirective {
50
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogIconTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
51
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: DialogIconTemplateDirective, isStandalone: true, selector: "ng-template[monaDialogIconTemplate]", ngImport: i0 }); }
52
+ }
53
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogIconTemplateDirective, decorators: [{
54
+ type: Directive,
55
+ args: [{
56
+ selector: "ng-template[monaDialogIconTemplate]"
57
+ }]
58
+ }] });
59
+
60
+ class DialogTitleTemplateDirective {
61
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogTitleTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
62
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: DialogTitleTemplateDirective, isStandalone: true, selector: "ng-template[monaDialogTitleTemplate]", ngImport: i0 }); }
63
+ }
64
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogTitleTemplateDirective, decorators: [{
65
+ type: Directive,
66
+ args: [{
67
+ selector: "ng-template[monaDialogTitleTemplate]"
68
+ }]
69
+ }] });
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
+ const dialogBaseVariants = cva(`
89
+ flex flex-col gap-0.5
90
+ w-full h-full
91
+ bg-background
92
+ border border-border shadow-sm
93
+ outline-none overflow-hidden
94
+ `, {
95
+ variants: {
96
+ rounded: {
97
+ none: "rounded-none",
98
+ small: "rounded-sm",
99
+ medium: "rounded-md",
100
+ large: "rounded-lg"
101
+ }
102
+ },
103
+ defaultVariants: {
104
+ rounded: "medium"
105
+ }
106
+ });
107
+ const dialogContentContainerVariants = cva(`
108
+ flex flex-row gap-1 flex-1
109
+ `);
110
+ const dialogBodyVariants = cva(`
111
+ flex flex-col gap-0 pb-2
112
+ w-full h-full pr-2
113
+ `, {
114
+ variants: {
115
+ hasIcon: {
116
+ true: "",
117
+ false: "pl-5"
118
+ }
119
+ }
120
+ });
121
+ const dialogHeaderVariants = cva(`
122
+ flex flex-row gap-2
123
+ pt-4 select-none
124
+ `);
125
+ const dialogIconContainerVariants = cva(`
126
+ flex items-start justify-center pt-8 pr-4 pl-6
127
+ `);
128
+ const dialogIconVariants = cva(`
129
+ rounded-full w-fit h-fit p-1.5 border relative
130
+ [&>span]:absolute [&>span]:flex [&>span]:rounded-full
131
+ [&>span]:-top-3 [&>span]:-right-3 [&>span]:-bottom-3 [&>span]:-left-3
132
+ [&>span]:border [&>span]:min-w-full [&>span]:min-h-full
133
+ `, {
134
+ variants: {
135
+ type: {
136
+ confirm: "border-success/10 bg-success/10 [&>span]:border-success/5 [&>span]:bg-success/5",
137
+ error: "border-error/10 bg-error/10 [&>span]:border-error/5 [&>span]:bg-error/5",
138
+ warning: "border-warning/10 bg-warning/10 [&>span]:border-warning/5 [&>span]:bg-warning/5",
139
+ info: "border-info/10 bg-info/10 [&>span]:border-info/5 [&>span]:bg-info/5",
140
+ success: "border-success/10 bg-success/10 [&>span]:border-success/5 [&>span]:bg-success/5"
141
+ }
142
+ },
143
+ defaultVariants: {
144
+ type: "info"
145
+ }
146
+ });
147
+ const dialogTitleContainerVariants = cva(`
148
+ flex flex-1 items-center justify-start select-none p-1
149
+ `);
150
+ const dialogCloseButtonContainerVariants = cva(`
151
+ flex items-start justify-end
152
+ `);
153
+ const dialogTitleVariants = cva(`
154
+ text-lg font-semibold leading-none tracking-tight
155
+ `);
156
+ const dialogDescriptionVariants = cva(`
157
+ text-sm text-muted-foreground
158
+ select-none
159
+ `);
160
+ const dialogContentVariants = cva(`
161
+ flex-1 overflow-auto p-1
162
+ `);
163
+ const dialogFooterVariants = cva(`
164
+ flex flex-row
165
+ gap-2 px-4 py-2
166
+ border-t border-border
167
+ select-none
168
+ `, {
169
+ variants: {
170
+ layout: {
171
+ center: "justify-center",
172
+ end: "justify-end",
173
+ start: "justify-start",
174
+ stretched: "[&>*]:flex-1"
175
+ },
176
+ rounded: {
177
+ none: "rounded-none",
178
+ small: "rounded-es-sm rounded-ee-sm",
179
+ medium: "rounded-es-md rounded-ee-md",
180
+ large: "rounded-es-lg rounded-ee-lg"
181
+ }
182
+ },
183
+ defaultVariants: {
184
+ rounded: "medium"
185
+ }
186
+ });
187
+
188
+ const dialogBaseThemeVariants = (theme) => {
189
+ switch (theme) {
190
+ case "mona":
191
+ return dialogBaseVariants;
192
+ default:
193
+ return dialogBaseVariants;
194
+ }
195
+ };
196
+ const dialogIconThemeVariants = (theme) => {
197
+ switch (theme) {
198
+ case "mona":
199
+ return dialogIconVariants;
200
+ default:
201
+ return dialogIconVariants;
202
+ }
203
+ };
204
+ const dialogBodyThemeVariants = (theme) => {
205
+ switch (theme) {
206
+ case "mona":
207
+ return dialogBodyVariants;
208
+ default:
209
+ return dialogBodyVariants;
210
+ }
211
+ };
212
+ const dialogContentContainerThemeVariants = (theme) => {
213
+ switch (theme) {
214
+ case "mona":
215
+ return dialogContentContainerVariants;
216
+ default:
217
+ return dialogContentContainerVariants;
218
+ }
219
+ };
220
+ const dialogHeaderThemeVariants = (theme) => {
221
+ switch (theme) {
222
+ case "mona":
223
+ return dialogHeaderVariants;
224
+ default:
225
+ return dialogHeaderVariants;
226
+ }
227
+ };
228
+ const dialogIconContainerThemeVariants = (theme) => {
229
+ switch (theme) {
230
+ case "mona":
231
+ return dialogIconContainerVariants;
232
+ default:
233
+ return dialogIconContainerVariants;
234
+ }
235
+ };
236
+ const dialogTitleContainerThemeVariants = (theme) => {
237
+ switch (theme) {
238
+ case "mona":
239
+ return dialogTitleContainerVariants;
240
+ default:
241
+ return dialogTitleContainerVariants;
242
+ }
243
+ };
244
+ const dialogCloseButtonContainerThemeVariants = (theme) => {
245
+ switch (theme) {
246
+ case "mona":
247
+ return dialogCloseButtonContainerVariants;
248
+ default:
249
+ return dialogCloseButtonContainerVariants;
250
+ }
251
+ };
252
+ const dialogTitleThemeVariants = (theme) => {
253
+ switch (theme) {
254
+ case "mona":
255
+ return dialogTitleVariants;
256
+ default:
257
+ return dialogTitleVariants;
258
+ }
259
+ };
260
+ const dialogDescriptionThemeVariants = (theme) => {
261
+ switch (theme) {
262
+ case "mona":
263
+ return dialogDescriptionVariants;
264
+ default:
265
+ return dialogDescriptionVariants;
266
+ }
267
+ };
268
+ const dialogContentThemeVariants = (theme) => {
269
+ switch (theme) {
270
+ case "mona":
271
+ return dialogContentVariants;
272
+ default:
273
+ return dialogContentVariants;
274
+ }
275
+ };
276
+ const dialogFooterThemeVariants = (theme) => {
277
+ switch (theme) {
278
+ case "mona":
279
+ return dialogFooterVariants;
280
+ default:
281
+ return dialogFooterVariants;
282
+ }
283
+ };
284
+
285
+ class DialogContentComponent {
286
+ #hostElementRef;
287
+ #iconMap;
288
+ #injectedData;
289
+ #themeService;
290
+ #trapFocus;
291
+ constructor() {
292
+ this.#hostElementRef = inject(ElementRef);
293
+ this.#iconMap = {
294
+ confirm: { color: "var(--color-success)", icon: LucideBadgeQuestionMark },
295
+ error: { color: "var(--color-error)", icon: LucideOctagonX },
296
+ info: { color: "var(--color-info)", icon: LucideBadgeInfo },
297
+ success: { color: "var(--color-success)", icon: LucideCircleCheckBig },
298
+ warning: { color: "var(--color-warning)", icon: LucideOctagonAlert }
299
+ };
300
+ this.#injectedData = inject(PopupDataInjectionToken);
301
+ this.#themeService = inject(ThemeService);
302
+ this.#trapFocus = inject(CdkTrapFocus);
303
+ this.baseClass = computed(() => {
304
+ const theme = this.#themeService.theme();
305
+ const rounded = this.dialogData().rounded;
306
+ return dialogBaseThemeVariants(theme)({ rounded });
307
+ }, /* @ts-ignore */
308
+ ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
309
+ this.bodyClass = computed(() => {
310
+ const theme = this.#themeService.theme();
311
+ const hasIcon = this.dialogData().type != null;
312
+ return dialogBodyThemeVariants(theme)({ hasIcon });
313
+ }, /* @ts-ignore */
314
+ ...(ngDevMode ? [{ debugName: "bodyClass" }] : /* istanbul ignore next */ []));
315
+ this.closeButtonContainerClass = computed(() => {
316
+ const theme = this.#themeService.theme();
317
+ return dialogCloseButtonContainerThemeVariants(theme)();
318
+ }, /* @ts-ignore */
319
+ ...(ngDevMode ? [{ debugName: "closeButtonContainerClass" }] : /* istanbul ignore next */ []));
320
+ this.contentClass = computed(() => {
321
+ const theme = this.#themeService.theme();
322
+ return dialogContentThemeVariants(theme)();
323
+ }, /* @ts-ignore */
324
+ ...(ngDevMode ? [{ debugName: "contentClass" }] : /* istanbul ignore next */ []));
325
+ this.contentContainerClass = computed(() => {
326
+ const theme = this.#themeService.theme();
327
+ return dialogContentContainerThemeVariants(theme)();
328
+ }, /* @ts-ignore */
329
+ ...(ngDevMode ? [{ debugName: "contentContainerClass" }] : /* istanbul ignore next */ []));
330
+ this.describedById = computed(() => {
331
+ const data = this.dialogData();
332
+ return data.descriptionTemplate || data.description ? this.descriptionId : null;
333
+ }, /* @ts-ignore */
334
+ ...(ngDevMode ? [{ debugName: "describedById" }] : /* istanbul ignore next */ []));
335
+ this.descriptionClass = computed(() => {
336
+ const theme = this.#themeService.theme();
337
+ return dialogDescriptionThemeVariants(theme)();
338
+ }, /* @ts-ignore */
339
+ ...(ngDevMode ? [{ debugName: "descriptionClass" }] : /* istanbul ignore next */ []));
340
+ this.descriptionId = createElementControlId();
341
+ this.dialogData = computed(() => this.dialogReference.data(), /* @ts-ignore */
342
+ ...(ngDevMode ? [{ debugName: "dialogData" }] : /* istanbul ignore next */ []));
343
+ this.dialogReference = this.#injectedData.dialogReference;
344
+ this.footerClass = computed(() => {
345
+ const theme = this.#themeService.theme();
346
+ const layout = this.dialogData().actionsLayout;
347
+ const rounded = this.dialogData().rounded;
348
+ return dialogFooterThemeVariants(theme)({ layout, rounded });
349
+ }, /* @ts-ignore */
350
+ ...(ngDevMode ? [{ debugName: "footerClass" }] : /* istanbul ignore next */ []));
351
+ this.headerClass = computed(() => {
352
+ const theme = this.#themeService.theme();
353
+ return dialogHeaderThemeVariants(theme)();
354
+ }, /* @ts-ignore */
355
+ ...(ngDevMode ? [{ debugName: "headerClass" }] : /* istanbul ignore next */ []));
356
+ this.headerId = createElementControlId();
357
+ this.icon = computed(() => {
358
+ const { type } = this.dialogData();
359
+ return type ? this.#iconMap[type] : undefined;
360
+ }, /* @ts-ignore */
361
+ ...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
362
+ this.iconClass = computed(() => {
363
+ const theme = this.#themeService.theme();
364
+ const type = this.dialogData().type;
365
+ return dialogIconThemeVariants(theme)({ type });
366
+ }, /* @ts-ignore */
367
+ ...(ngDevMode ? [{ debugName: "iconClass" }] : /* istanbul ignore next */ []));
368
+ this.iconContainerClass = computed(() => {
369
+ const theme = this.#themeService.theme();
370
+ return dialogIconContainerThemeVariants(theme)();
371
+ }, /* @ts-ignore */
372
+ ...(ngDevMode ? [{ debugName: "iconContainerClass" }] : /* istanbul ignore next */ []));
373
+ this.role = computed(() => {
374
+ const type = this.dialogData().type;
375
+ return type === "confirm" || type === "error" || type === "warning" ? "alertdialog" : "dialog";
376
+ }, /* @ts-ignore */
377
+ ...(ngDevMode ? [{ debugName: "role" }] : /* istanbul ignore next */ []));
378
+ this.titleClass = computed(() => {
379
+ const theme = this.#themeService.theme();
380
+ return dialogTitleThemeVariants(theme)();
381
+ }, /* @ts-ignore */
382
+ ...(ngDevMode ? [{ debugName: "titleClass" }] : /* istanbul ignore next */ []));
383
+ this.titleContainerClass = computed(() => {
384
+ const theme = this.#themeService.theme();
385
+ return dialogTitleContainerThemeVariants(theme)();
386
+ }, /* @ts-ignore */
387
+ ...(ngDevMode ? [{ debugName: "titleContainerClass" }] : /* istanbul ignore next */ []));
388
+ this.#trapFocus.autoCapture = true;
389
+ afterNextRender({
390
+ read: () => {
391
+ this.focusElement();
392
+ }
393
+ });
394
+ }
395
+ onActionClick(action) {
396
+ this.dialogReference.dialogResult$.next({
397
+ action,
398
+ viaClose: false
399
+ });
400
+ }
401
+ onCloseClick() {
402
+ this.dialogReference.dialogResult$.next({
403
+ viaClose: true
404
+ });
405
+ }
406
+ focusElement() {
407
+ const element = this.dialogData().focusedElement;
408
+ if (!element) {
409
+ return;
410
+ }
411
+ const dialogElement = this.#hostElementRef.nativeElement;
412
+ focusElement(dialogElement, element);
413
+ }
414
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
415
+ 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();\r\n@let data = dialogData();\r\n\r\n<div [class]=\"contentContainerClass()\">\r\n @if (dialogIcon) {\r\n <div [class]=\"iconContainerClass()\">\r\n @if (data.iconTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"data.iconTemplate\"></ng-container>\r\n } @else {\r\n <div [class]=\"iconClass()\">\r\n <span aria-hidden=\"true\"></span>\r\n <svg [lucideIcon]=\"dialogIcon.icon\" [size]=\"24\" [style.color]=\"dialogIcon.color\"></svg>\r\n </div>\r\n }\r\n </div>\r\n }\r\n <div [class]=\"bodyClass()\">\r\n <div [class]=\"headerClass()\">\r\n <div [id]=\"headerId\" [class]=\"titleContainerClass()\">\r\n @if (data.titleTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"data.titleTemplate\"></ng-container>\r\n } @else {\r\n <h2 [class]=\"titleClass()\">{{ data.title }}</h2>\r\n }\r\n </div>\r\n @if (data.closable) {\r\n <div [class]=\"closeButtonContainerClass()\">\r\n <button\r\n monaButton\r\n look=\"ghost\"\r\n size=\"small\"\r\n [iconOnly]=\"true\"\r\n aria-label=\"Close dialog\"\r\n (click)=\"onCloseClick()\">\r\n <svg lucideX [size]=\"16\"></svg>\r\n </button>\r\n </div>\r\n }\r\n </div>\r\n\r\n @let descriptionTemplateId = data.descriptionTemplate ? descriptionId : undefined;\r\n <div class=\"p-1\" [attr.id]=\"descriptionTemplateId\">\r\n @if (data.descriptionTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"data.descriptionTemplate\"></ng-container>\r\n } @else if (data.description) {\r\n <p [id]=\"descriptionId\" [class]=\"descriptionClass()\">{{ data.description }}</p>\r\n }\r\n </div>\r\n\r\n <div [class]=\"contentClass()\">\r\n @if (data.content) {\r\n <ng-container [ngTemplateOutlet]=\"data.content\"></ng-container>\r\n } @else if (data.text) {\r\n <p class=\"select-none\">{{ data.text }}</p>\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n\r\n@if (data.footerTemplate || (data.actions | monaAny)) {\r\n @if (data.footerTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"data.footerTemplate\"></ng-container>\r\n } @else {\r\n <div [class]=\"footerClass()\">\r\n @for (action of data.actions; track $index) {\r\n <button\r\n monaButton\r\n type=\"button\"\r\n [class]=\"action.cssClass || ''\"\r\n [iconOnly]=\"action.iconOnly || false\"\r\n [look]=\"action.look\"\r\n [rounded]=\"action.rounded || data.rounded\"\r\n (click)=\"onActionClick(action)\">\r\n {{ action.text }}\r\n </button>\r\n }\r\n </div>\r\n }\r\n}\r\n", dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "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" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
416
+ }
417
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogContentComponent, decorators: [{
418
+ type: Component,
419
+ args: [{ imports: [ButtonDirective, NgTemplateOutlet, AnyPipe, LucideX, LucideDynamicIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: {
420
+ "[class]": "baseClass()",
421
+ "[attr.aria-describedby]": "describedById()",
422
+ "[attr.aria-labelledby]": "headerId",
423
+ "[attr.role]": "role()"
424
+ }, hostDirectives: [CdkTrapFocus], template: "@let dialogIcon = icon();\r\n@let data = dialogData();\r\n\r\n<div [class]=\"contentContainerClass()\">\r\n @if (dialogIcon) {\r\n <div [class]=\"iconContainerClass()\">\r\n @if (data.iconTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"data.iconTemplate\"></ng-container>\r\n } @else {\r\n <div [class]=\"iconClass()\">\r\n <span aria-hidden=\"true\"></span>\r\n <svg [lucideIcon]=\"dialogIcon.icon\" [size]=\"24\" [style.color]=\"dialogIcon.color\"></svg>\r\n </div>\r\n }\r\n </div>\r\n }\r\n <div [class]=\"bodyClass()\">\r\n <div [class]=\"headerClass()\">\r\n <div [id]=\"headerId\" [class]=\"titleContainerClass()\">\r\n @if (data.titleTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"data.titleTemplate\"></ng-container>\r\n } @else {\r\n <h2 [class]=\"titleClass()\">{{ data.title }}</h2>\r\n }\r\n </div>\r\n @if (data.closable) {\r\n <div [class]=\"closeButtonContainerClass()\">\r\n <button\r\n monaButton\r\n look=\"ghost\"\r\n size=\"small\"\r\n [iconOnly]=\"true\"\r\n aria-label=\"Close dialog\"\r\n (click)=\"onCloseClick()\">\r\n <svg lucideX [size]=\"16\"></svg>\r\n </button>\r\n </div>\r\n }\r\n </div>\r\n\r\n @let descriptionTemplateId = data.descriptionTemplate ? descriptionId : undefined;\r\n <div class=\"p-1\" [attr.id]=\"descriptionTemplateId\">\r\n @if (data.descriptionTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"data.descriptionTemplate\"></ng-container>\r\n } @else if (data.description) {\r\n <p [id]=\"descriptionId\" [class]=\"descriptionClass()\">{{ data.description }}</p>\r\n }\r\n </div>\r\n\r\n <div [class]=\"contentClass()\">\r\n @if (data.content) {\r\n <ng-container [ngTemplateOutlet]=\"data.content\"></ng-container>\r\n } @else if (data.text) {\r\n <p class=\"select-none\">{{ data.text }}</p>\r\n }\r\n </div>\r\n </div>\r\n</div>\r\n\r\n@if (data.footerTemplate || (data.actions | monaAny)) {\r\n @if (data.footerTemplate) {\r\n <ng-container [ngTemplateOutlet]=\"data.footerTemplate\"></ng-container>\r\n } @else {\r\n <div [class]=\"footerClass()\">\r\n @for (action of data.actions; track $index) {\r\n <button\r\n monaButton\r\n type=\"button\"\r\n [class]=\"action.cssClass || ''\"\r\n [iconOnly]=\"action.iconOnly || false\"\r\n [look]=\"action.look\"\r\n [rounded]=\"action.rounded || data.rounded\"\r\n (click)=\"onActionClick(action)\">\r\n {{ action.text }}\r\n </button>\r\n }\r\n </div>\r\n }\r\n}\r\n" }]
425
+ }], ctorParameters: () => [] });
426
+
427
+ class DialogRef {
428
+ #options;
429
+ constructor(options) {
430
+ this.#options = options;
431
+ }
432
+ close(result) {
433
+ this.#options.close(result);
434
+ }
435
+ /**
436
+ * @description Updates the dialog's content and appearance in place without closing and reopening it.
437
+ * Only the fields provided are changed; anything omitted keeps its current value.
438
+ */
439
+ update(data) {
440
+ this.#options.update(data);
441
+ }
442
+ get close$() {
443
+ return this.#options.close$;
444
+ }
445
+ get closed$() {
446
+ return this.#options.closed$;
447
+ }
448
+ get component() {
449
+ return this.#options.component;
450
+ }
451
+ get element() {
452
+ return this.#options.element;
453
+ }
454
+ get height() {
455
+ return this.#options.height;
456
+ }
457
+ get popupRef() {
458
+ return this.#options.popupRef;
459
+ }
460
+ get result() {
461
+ return this.#options.result;
462
+ }
463
+ get width() {
464
+ return this.#options.width;
465
+ }
466
+ }
467
+
468
+ class DialogReference {
469
+ #dialogRef;
470
+ constructor(options, initialData) {
471
+ this.options = options;
472
+ this.dialogResult$ = new Subject();
473
+ this.#dialogRef = new DialogRef(this);
474
+ this.data = signal(initialData, /* @ts-ignore */
475
+ ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
476
+ }
477
+ close(result) {
478
+ const event = result instanceof PopupCloseEvent
479
+ ? result
480
+ : new PopupCloseEvent({ result, via: PopupCloseSource.Programmatic });
481
+ this.#popupRefOrThrow.close(event);
482
+ }
483
+ initializePopupRef(popupRef) {
484
+ this.options.popupRef = popupRef;
485
+ }
486
+ update(data) {
487
+ this.data.update(current => ({ ...current, ...data }));
488
+ }
489
+ get close$() {
490
+ return this.#popupRefOrThrow.beforeClose.pipe(map(event => event));
491
+ }
492
+ get closed$() {
493
+ return this.#popupRefOrThrow.closed.pipe(map(() => undefined));
494
+ }
495
+ get component() {
496
+ const popupComponent = this.#popupRefOrThrow.component;
497
+ if (!popupComponent) {
498
+ return null;
499
+ }
500
+ return popupComponent.instance.componentRef ?? null;
501
+ }
502
+ get dialogRef() {
503
+ return this.#dialogRef;
504
+ }
505
+ get element() {
506
+ return this.#popupRefOrThrow.overlayRef.overlayElement;
507
+ }
508
+ get height() {
509
+ return this.element.offsetHeight;
510
+ }
511
+ get popupRef() {
512
+ return this.#popupRefOrThrow;
513
+ }
514
+ get #popupRefOrThrow() {
515
+ if (!this.options.popupRef) {
516
+ throw new Error("DialogReference: popupRef has not been initialized.");
517
+ }
518
+ return this.options.popupRef;
519
+ }
520
+ get result() {
521
+ return this.dialogResult$;
522
+ }
523
+ get width() {
524
+ return this.element.offsetWidth;
525
+ }
526
+ }
527
+
528
+ const createDialogInjectorData = (settings) => {
529
+ return {
530
+ actions: settings.actions ?? getDefaultActions(settings.type),
531
+ actionsLayout: settings.actionsLayout ?? "end",
532
+ closable: settings.closable ?? true,
533
+ closeOnEscape: settings.closeOnEscape ?? true,
534
+ content: settings.content,
535
+ description: settings.description,
536
+ descriptionTemplate: settings.descriptionTemplate,
537
+ dialogReference: null,
538
+ focusedElement: settings.focusedElement ?? null,
539
+ footerTemplate: settings.footerTemplate,
540
+ height: settings.height,
541
+ iconTemplate: settings.iconTemplate,
542
+ left: settings.left,
543
+ modal: settings.modal ?? true,
544
+ rounded: settings.rounded ?? "medium",
545
+ text: settings.text ?? "",
546
+ title: settings.title,
547
+ titleTemplate: settings.titleTemplate,
548
+ top: settings.top,
549
+ type: settings.type,
550
+ width: settings.width ?? 450
551
+ };
552
+ };
553
+ function getDefaultActions(type) {
554
+ if (type === "confirm") {
555
+ return [
556
+ { cssClass: "", iconOnly: false, look: "primary", rounded: "medium", text: "OK" },
557
+ { cssClass: "", iconOnly: false, look: "default", rounded: "medium", text: "Cancel" }
558
+ ];
559
+ }
560
+ return [{ cssClass: "", iconOnly: false, look: "primary", rounded: "medium", text: "OK" }];
561
+ }
562
+
563
+ class DialogService {
564
+ #document = inject(DOCUMENT);
565
+ #injector = inject(Injector);
566
+ #popupService = inject(PopupService);
567
+ show(settings) {
568
+ const injectorData = createDialogInjectorData(settings);
569
+ const dialogReference = new DialogReference({}, injectorData);
570
+ injectorData.dialogReference = dialogReference;
571
+ const popupRef = this.#popupService.create({
572
+ anchor: this.#document.body,
573
+ backdropClass: settings.modal
574
+ ? ["fixed", "inset-0", "bg-background/50", "transition-opacity", "z-40", "backdrop-blur-xs"]
575
+ : "transparent",
576
+ closeOnBackdropClick: false,
577
+ closeOnEscape: injectorData.closeOnEscape,
578
+ closeOnOutsideClick: false,
579
+ content: DialogContentComponent,
580
+ data: injectorData,
581
+ hasBackdrop: settings.modal ?? true,
582
+ height: settings.height ?? "fit-content",
583
+ maxHeight: settings.maxHeight,
584
+ maxWidth: settings.maxWidth,
585
+ minHeight: settings.minHeight,
586
+ minWidth: settings.minWidth,
587
+ positionStrategy: "global",
588
+ providers: [{ provide: DialogRef, useFactory: forwardRef(() => dialogReference.dialogRef) }],
589
+ width: settings.width
590
+ });
591
+ dialogReference.initializePopupRef(popupRef);
592
+ afterNextRender({
593
+ read: () => {
594
+ const element = popupRef.overlayRef.overlayElement;
595
+ setWindowStyles(element, settings);
596
+ }
597
+ }, { injector: this.#injector });
598
+ return dialogReference.dialogRef;
599
+ }
600
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
601
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogService, providedIn: "root" }); }
602
+ }
603
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogService, decorators: [{
604
+ type: Injectable,
605
+ args: [{
606
+ providedIn: "root"
607
+ }]
608
+ }] });
609
+
610
+ class DialogComponent {
611
+ #destroyRef;
612
+ #dialogService;
613
+ #dialogRef;
614
+ constructor() {
615
+ this.#destroyRef = inject(DestroyRef);
616
+ this.#dialogService = inject(DialogService);
617
+ this.contentTemplate = contentChild(DialogContentTemplateDirective, { ...(ngDevMode ? { debugName: "contentTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
618
+ this.descriptionTemplate = contentChild(DialogDescriptionTemplateDirective, { ...(ngDevMode ? { debugName: "descriptionTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
619
+ this.footerTemplate = contentChild(DialogFooterTemplateDirective, { ...(ngDevMode ? { debugName: "footerTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
620
+ this.iconTemplate = contentChild(DialogIconTemplateDirective, { ...(ngDevMode ? { debugName: "iconTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
621
+ this.titleTemplate = contentChild(DialogTitleTemplateDirective, { ...(ngDevMode ? { debugName: "titleTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
622
+ /**
623
+ * @description Emitted when the user clicks an action button. Call `event.preventDefault()` on the emitted
624
+ * `DialogActionEvent` to keep the dialog open.
625
+ */
626
+ this.action = output();
627
+ /**
628
+ * @description Sets the actions of the dialog.
629
+ * @default []
630
+ */
631
+ this.actions = input([], /* @ts-ignore */
632
+ ...(ngDevMode ? [{ debugName: "actions" }] : /* istanbul ignore next */ []));
633
+ /**
634
+ * @description Sets the layout of the actions in the dialog footer.
635
+ * @default "end"
636
+ */
637
+ this.actionsLayout = input("end", /* @ts-ignore */
638
+ ...(ngDevMode ? [{ debugName: "actionsLayout" }] : /* istanbul ignore next */ []));
639
+ /**
640
+ * @description Sets the visibility of the close button in the dialog header.
641
+ * @default true
642
+ */
643
+ this.closable = input(true, /* @ts-ignore */
644
+ ...(ngDevMode ? [{ debugName: "closable" }] : /* istanbul ignore next */ []));
645
+ /**
646
+ * @description Emits when the user clicks on the close button or presses the escape key.
647
+ * This event is preventable.
648
+ */
649
+ this.close = output();
650
+ /**
651
+ * @description Emits when the dialog is closed.
652
+ */
653
+ this.closed = output();
654
+ /**
655
+ * @description Sets whether the dialog should close when the escape key is pressed.
656
+ * @default true
657
+ */
658
+ this.closeOnEscape = input(true, /* @ts-ignore */
659
+ ...(ngDevMode ? [{ debugName: "closeOnEscape" }] : /* istanbul ignore next */ []));
660
+ /**
661
+ * @description Sets the description of the dialog.
662
+ */
663
+ this.description = input(/* @ts-ignore */
664
+ ...(ngDevMode ? [undefined, { debugName: "description" }] : /* istanbul ignore next */ []));
665
+ /**
666
+ * @description Sets the element that should receive focus when the dialog is opened. When omitted, focus
667
+ * moves to the first focusable element automatically.
668
+ */
669
+ this.focusedElement = input(/* @ts-ignore */
670
+ ...(ngDevMode ? [undefined, { debugName: "focusedElement" }] : /* istanbul ignore next */ []));
671
+ /**
672
+ * @description Sets the height of the dialog.
673
+ */
674
+ this.height = input(/* @ts-ignore */
675
+ ...(ngDevMode ? [undefined, { debugName: "height" }] : /* istanbul ignore next */ []));
676
+ /**
677
+ * @description Sets the left position of the dialog.
678
+ */
679
+ this.left = input(/* @ts-ignore */
680
+ ...(ngDevMode ? [undefined, { debugName: "left" }] : /* istanbul ignore next */ []));
681
+ /**
682
+ * @description Sets the maximum height of the dialog.
683
+ */
684
+ this.maxHeight = input(/* @ts-ignore */
685
+ ...(ngDevMode ? [undefined, { debugName: "maxHeight" }] : /* istanbul ignore next */ []));
686
+ /**
687
+ * @description Sets the maximum width of the dialog.
688
+ */
689
+ this.maxWidth = input(/* @ts-ignore */
690
+ ...(ngDevMode ? [undefined, { debugName: "maxWidth" }] : /* istanbul ignore next */ []));
691
+ /**
692
+ * @description Sets the minimum height of the dialog.
693
+ */
694
+ this.minHeight = input(/* @ts-ignore */
695
+ ...(ngDevMode ? [undefined, { debugName: "minHeight" }] : /* istanbul ignore next */ []));
696
+ /**
697
+ * @description Sets the minimum width of the dialog.
698
+ */
699
+ this.minWidth = input(/* @ts-ignore */
700
+ ...(ngDevMode ? [undefined, { debugName: "minWidth" }] : /* istanbul ignore next */ []));
701
+ /**
702
+ * @description Sets whether the dialog should have an overlay behind it.
703
+ * @default true
704
+ */
705
+ this.modal = input(true, /* @ts-ignore */
706
+ ...(ngDevMode ? [{ debugName: "modal" }] : /* istanbul ignore next */ []));
707
+ /**
708
+ * @description Border-radius preset applied to the component.
709
+ * @default "medium"
710
+ */
711
+ this.rounded = input("medium", /* @ts-ignore */
712
+ ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
713
+ /**
714
+ * @description Primary text content displayed by the component.
715
+ */
716
+ this.text = input(/* @ts-ignore */
717
+ ...(ngDevMode ? [undefined, { debugName: "text" }] : /* istanbul ignore next */ []));
718
+ /**
719
+ * @description Title text displayed in the component header or trigger.
720
+ */
721
+ this.title = input(/* @ts-ignore */
722
+ ...(ngDevMode ? [undefined, { debugName: "title" }] : /* istanbul ignore next */ []));
723
+ /**
724
+ * @description Sets the top position of the dialog.
725
+ */
726
+ this.top = input(/* @ts-ignore */
727
+ ...(ngDevMode ? [undefined, { debugName: "top" }] : /* istanbul ignore next */ []));
728
+ /**
729
+ * @description Visual severity type of the dialog, controlling its icon and semantic role. Set to `null` to
730
+ * render the dialog without an icon.
731
+ * @default "info"
732
+ */
733
+ this.type = input("info", /* @ts-ignore */
734
+ ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
735
+ /**
736
+ * @description Sets the width of the dialog.
737
+ */
738
+ this.width = input(/* @ts-ignore */
739
+ ...(ngDevMode ? [undefined, { debugName: "width" }] : /* istanbul ignore next */ []));
740
+ afterNextRender({
741
+ read: () => this.#openDialog()
742
+ });
743
+ effect(() => {
744
+ const actions = this.actions() ? [...this.actions()] : undefined;
745
+ const update = {
746
+ actions,
747
+ actionsLayout: this.actionsLayout(),
748
+ closable: this.closable(),
749
+ description: this.description(),
750
+ rounded: this.rounded(),
751
+ text: this.text(),
752
+ title: this.title(),
753
+ type: this.type()
754
+ };
755
+ this.#dialogRef?.update(update);
756
+ });
757
+ this.#destroyRef.onDestroy(() => this.#dialogRef?.close());
758
+ }
759
+ #openDialog() {
760
+ const actions = this.actions() ? [...this.actions()] : undefined;
761
+ this.#dialogRef = this.#dialogService.show({
762
+ actions,
763
+ actionsLayout: this.actionsLayout(),
764
+ closable: this.closable(),
765
+ closeOnEscape: this.closeOnEscape(),
766
+ content: this.contentTemplate(),
767
+ description: this.description(),
768
+ descriptionTemplate: this.descriptionTemplate(),
769
+ focusedElement: this.focusedElement(),
770
+ footerTemplate: this.footerTemplate(),
771
+ height: this.height(),
772
+ iconTemplate: this.iconTemplate(),
773
+ left: this.left(),
774
+ maxHeight: this.maxHeight(),
775
+ maxWidth: this.maxWidth(),
776
+ minHeight: this.minHeight(),
777
+ minWidth: this.minWidth(),
778
+ modal: this.modal(),
779
+ rounded: this.rounded(),
780
+ text: this.text(),
781
+ title: this.title(),
782
+ titleTemplate: this.titleTemplate(),
783
+ top: this.top(),
784
+ type: this.type(),
785
+ width: this.width()
786
+ });
787
+ this.#dialogRef.result.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(result => {
788
+ if (result.viaClose) {
789
+ this.#dialogRef?.close(new PopupCloseEvent({ via: PopupCloseSource.CloseButton }));
790
+ return;
791
+ }
792
+ const event = new DialogActionEvent(result.action);
793
+ this.action.emit(event);
794
+ if (!event.isDefaultPrevented()) {
795
+ this.#dialogRef?.close();
796
+ }
797
+ });
798
+ this.#dialogRef.close$.pipe(takeUntil(this.#dialogRef.popupRef.closed)).subscribe(event => {
799
+ this.close.emit(event);
800
+ });
801
+ this.#dialogRef.closed$.pipe(take(1)).subscribe(() => {
802
+ this.closed.emit();
803
+ });
804
+ }
805
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
806
+ 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 }, 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 }); }
807
+ }
808
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DialogComponent, decorators: [{
809
+ type: Component,
810
+ args: [{
811
+ selector: "mona-dialog",
812
+ template: ``,
813
+ host: {
814
+ class: "hidden"
815
+ }
816
+ }]
817
+ }], 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"] }], closed: [{ type: i0.Output, args: ["closed"] }], closeOnEscape: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnEscape", required: false }] }], 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 }] }], 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 }] }] } });
818
+
819
+ /*
820
+ * Public API Surface of @nanahoshi/mona-ui/dialog
821
+ */
822
+
823
+ /**
824
+ * Generated bundle index. Do not edit.
825
+ */
826
+
827
+ export { DialogActionEvent, DialogComponent, DialogContentTemplateDirective, DialogDescriptionTemplateDirective, DialogFooterTemplateDirective, DialogIconTemplateDirective, DialogRef, DialogService, DialogTitleTemplateDirective };
828
+ //# sourceMappingURL=nanahoshi-mona-ui-dialog.mjs.map