@cute-widgets/base 20.0.1

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 (183) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/LICENSE.md +191 -0
  3. package/README.md +190 -0
  4. package/abstract/index.d.ts +327 -0
  5. package/alert/index.d.ts +68 -0
  6. package/autocomplete/index.d.ts +442 -0
  7. package/badge/index.d.ts +26 -0
  8. package/bottom-sheet/index.d.ts +231 -0
  9. package/button/index.d.ts +182 -0
  10. package/button-toggle/index.d.ts +225 -0
  11. package/card/index.d.ts +163 -0
  12. package/checkbox/index.d.ts +174 -0
  13. package/chips/index.d.ts +963 -0
  14. package/collapse/index.d.ts +97 -0
  15. package/core/animation/index.d.ts +43 -0
  16. package/core/datetime/index.d.ts +404 -0
  17. package/core/directives/index.d.ts +168 -0
  18. package/core/error/index.d.ts +74 -0
  19. package/core/index.d.ts +1039 -0
  20. package/core/interfaces/index.d.ts +114 -0
  21. package/core/layout/index.d.ts +53 -0
  22. package/core/line/index.d.ts +37 -0
  23. package/core/nav/index.d.ts +321 -0
  24. package/core/observers/index.d.ts +124 -0
  25. package/core/option/index.d.ts +185 -0
  26. package/core/pipes/index.d.ts +53 -0
  27. package/core/ripple/index.d.ts +66 -0
  28. package/core/testing/index.d.ts +154 -0
  29. package/core/theming/index.d.ts +118 -0
  30. package/core/types/index.d.ts +53 -0
  31. package/core/utils/index.d.ts +129 -0
  32. package/cute-widgets-base-20.0.1.tgz +0 -0
  33. package/datepicker/index.d.ts +1817 -0
  34. package/dialog/index.d.ts +484 -0
  35. package/divider/index.d.ts +24 -0
  36. package/expansion/README.md +8 -0
  37. package/expansion/index.d.ts +308 -0
  38. package/fesm2022/cute-widgets-base-abstract.mjs +547 -0
  39. package/fesm2022/cute-widgets-base-abstract.mjs.map +1 -0
  40. package/fesm2022/cute-widgets-base-alert.mjs +198 -0
  41. package/fesm2022/cute-widgets-base-alert.mjs.map +1 -0
  42. package/fesm2022/cute-widgets-base-autocomplete.mjs +1217 -0
  43. package/fesm2022/cute-widgets-base-autocomplete.mjs.map +1 -0
  44. package/fesm2022/cute-widgets-base-badge.mjs +75 -0
  45. package/fesm2022/cute-widgets-base-badge.mjs.map +1 -0
  46. package/fesm2022/cute-widgets-base-bottom-sheet.mjs +416 -0
  47. package/fesm2022/cute-widgets-base-bottom-sheet.mjs.map +1 -0
  48. package/fesm2022/cute-widgets-base-button-toggle.mjs +640 -0
  49. package/fesm2022/cute-widgets-base-button-toggle.mjs.map +1 -0
  50. package/fesm2022/cute-widgets-base-button.mjs +546 -0
  51. package/fesm2022/cute-widgets-base-button.mjs.map +1 -0
  52. package/fesm2022/cute-widgets-base-card.mjs +471 -0
  53. package/fesm2022/cute-widgets-base-card.mjs.map +1 -0
  54. package/fesm2022/cute-widgets-base-checkbox.mjs +390 -0
  55. package/fesm2022/cute-widgets-base-checkbox.mjs.map +1 -0
  56. package/fesm2022/cute-widgets-base-chips.mjs +2360 -0
  57. package/fesm2022/cute-widgets-base-chips.mjs.map +1 -0
  58. package/fesm2022/cute-widgets-base-collapse.mjs +259 -0
  59. package/fesm2022/cute-widgets-base-collapse.mjs.map +1 -0
  60. package/fesm2022/cute-widgets-base-core-animation.mjs +53 -0
  61. package/fesm2022/cute-widgets-base-core-animation.mjs.map +1 -0
  62. package/fesm2022/cute-widgets-base-core-datetime.mjs +568 -0
  63. package/fesm2022/cute-widgets-base-core-datetime.mjs.map +1 -0
  64. package/fesm2022/cute-widgets-base-core-directives.mjs +404 -0
  65. package/fesm2022/cute-widgets-base-core-directives.mjs.map +1 -0
  66. package/fesm2022/cute-widgets-base-core-error.mjs +105 -0
  67. package/fesm2022/cute-widgets-base-core-error.mjs.map +1 -0
  68. package/fesm2022/cute-widgets-base-core-interfaces.mjs +22 -0
  69. package/fesm2022/cute-widgets-base-core-interfaces.mjs.map +1 -0
  70. package/fesm2022/cute-widgets-base-core-layout.mjs +74 -0
  71. package/fesm2022/cute-widgets-base-core-layout.mjs.map +1 -0
  72. package/fesm2022/cute-widgets-base-core-line.mjs +87 -0
  73. package/fesm2022/cute-widgets-base-core-line.mjs.map +1 -0
  74. package/fesm2022/cute-widgets-base-core-nav.mjs +863 -0
  75. package/fesm2022/cute-widgets-base-core-nav.mjs.map +1 -0
  76. package/fesm2022/cute-widgets-base-core-observers.mjs +304 -0
  77. package/fesm2022/cute-widgets-base-core-observers.mjs.map +1 -0
  78. package/fesm2022/cute-widgets-base-core-option.mjs +373 -0
  79. package/fesm2022/cute-widgets-base-core-option.mjs.map +1 -0
  80. package/fesm2022/cute-widgets-base-core-pipes.mjs +97 -0
  81. package/fesm2022/cute-widgets-base-core-pipes.mjs.map +1 -0
  82. package/fesm2022/cute-widgets-base-core-ripple.mjs +172 -0
  83. package/fesm2022/cute-widgets-base-core-ripple.mjs.map +1 -0
  84. package/fesm2022/cute-widgets-base-core-testing.mjs +210 -0
  85. package/fesm2022/cute-widgets-base-core-testing.mjs.map +1 -0
  86. package/fesm2022/cute-widgets-base-core-theming.mjs +314 -0
  87. package/fesm2022/cute-widgets-base-core-theming.mjs.map +1 -0
  88. package/fesm2022/cute-widgets-base-core-types.mjs +22 -0
  89. package/fesm2022/cute-widgets-base-core-types.mjs.map +1 -0
  90. package/fesm2022/cute-widgets-base-core-utils.mjs +257 -0
  91. package/fesm2022/cute-widgets-base-core-utils.mjs.map +1 -0
  92. package/fesm2022/cute-widgets-base-core.mjs +1600 -0
  93. package/fesm2022/cute-widgets-base-core.mjs.map +1 -0
  94. package/fesm2022/cute-widgets-base-datepicker.mjs +4827 -0
  95. package/fesm2022/cute-widgets-base-datepicker.mjs.map +1 -0
  96. package/fesm2022/cute-widgets-base-dialog.mjs +1046 -0
  97. package/fesm2022/cute-widgets-base-dialog.mjs.map +1 -0
  98. package/fesm2022/cute-widgets-base-divider.mjs +86 -0
  99. package/fesm2022/cute-widgets-base-divider.mjs.map +1 -0
  100. package/fesm2022/cute-widgets-base-expansion.mjs +623 -0
  101. package/fesm2022/cute-widgets-base-expansion.mjs.map +1 -0
  102. package/fesm2022/cute-widgets-base-form-field.mjs +969 -0
  103. package/fesm2022/cute-widgets-base-form-field.mjs.map +1 -0
  104. package/fesm2022/cute-widgets-base-grid-list.mjs +715 -0
  105. package/fesm2022/cute-widgets-base-grid-list.mjs.map +1 -0
  106. package/fesm2022/cute-widgets-base-icon.mjs +1105 -0
  107. package/fesm2022/cute-widgets-base-icon.mjs.map +1 -0
  108. package/fesm2022/cute-widgets-base-input.mjs +726 -0
  109. package/fesm2022/cute-widgets-base-input.mjs.map +1 -0
  110. package/fesm2022/cute-widgets-base-layout-container.mjs +95 -0
  111. package/fesm2022/cute-widgets-base-layout-container.mjs.map +1 -0
  112. package/fesm2022/cute-widgets-base-layout-stack.mjs +166 -0
  113. package/fesm2022/cute-widgets-base-layout-stack.mjs.map +1 -0
  114. package/fesm2022/cute-widgets-base-layout.mjs +250 -0
  115. package/fesm2022/cute-widgets-base-layout.mjs.map +1 -0
  116. package/fesm2022/cute-widgets-base-list.mjs +1557 -0
  117. package/fesm2022/cute-widgets-base-list.mjs.map +1 -0
  118. package/fesm2022/cute-widgets-base-menu.mjs +1283 -0
  119. package/fesm2022/cute-widgets-base-menu.mjs.map +1 -0
  120. package/fesm2022/cute-widgets-base-navbar.mjs +359 -0
  121. package/fesm2022/cute-widgets-base-navbar.mjs.map +1 -0
  122. package/fesm2022/cute-widgets-base-paginator.mjs +485 -0
  123. package/fesm2022/cute-widgets-base-paginator.mjs.map +1 -0
  124. package/fesm2022/cute-widgets-base-progress.mjs +321 -0
  125. package/fesm2022/cute-widgets-base-progress.mjs.map +1 -0
  126. package/fesm2022/cute-widgets-base-radio.mjs +637 -0
  127. package/fesm2022/cute-widgets-base-radio.mjs.map +1 -0
  128. package/fesm2022/cute-widgets-base-select.mjs +1208 -0
  129. package/fesm2022/cute-widgets-base-select.mjs.map +1 -0
  130. package/fesm2022/cute-widgets-base-sidenav.mjs +1095 -0
  131. package/fesm2022/cute-widgets-base-sidenav.mjs.map +1 -0
  132. package/fesm2022/cute-widgets-base-slider.mjs +99 -0
  133. package/fesm2022/cute-widgets-base-slider.mjs.map +1 -0
  134. package/fesm2022/cute-widgets-base-snack-bar.mjs +897 -0
  135. package/fesm2022/cute-widgets-base-snack-bar.mjs.map +1 -0
  136. package/fesm2022/cute-widgets-base-sort.mjs +639 -0
  137. package/fesm2022/cute-widgets-base-sort.mjs.map +1 -0
  138. package/fesm2022/cute-widgets-base-spinner.mjs +154 -0
  139. package/fesm2022/cute-widgets-base-spinner.mjs.map +1 -0
  140. package/fesm2022/cute-widgets-base-stepper.mjs +673 -0
  141. package/fesm2022/cute-widgets-base-stepper.mjs.map +1 -0
  142. package/fesm2022/cute-widgets-base-table.mjs +1023 -0
  143. package/fesm2022/cute-widgets-base-table.mjs.map +1 -0
  144. package/fesm2022/cute-widgets-base-tabs.mjs +729 -0
  145. package/fesm2022/cute-widgets-base-tabs.mjs.map +1 -0
  146. package/fesm2022/cute-widgets-base-timepicker.mjs +965 -0
  147. package/fesm2022/cute-widgets-base-timepicker.mjs.map +1 -0
  148. package/fesm2022/cute-widgets-base-toolbar.mjs +120 -0
  149. package/fesm2022/cute-widgets-base-toolbar.mjs.map +1 -0
  150. package/fesm2022/cute-widgets-base-tooltip.mjs +947 -0
  151. package/fesm2022/cute-widgets-base-tooltip.mjs.map +1 -0
  152. package/fesm2022/cute-widgets-base-tree.mjs +598 -0
  153. package/fesm2022/cute-widgets-base-tree.mjs.map +1 -0
  154. package/fesm2022/cute-widgets-base.mjs +68 -0
  155. package/fesm2022/cute-widgets-base.mjs.map +1 -0
  156. package/form-field/index.d.ts +401 -0
  157. package/grid-list/index.d.ts +361 -0
  158. package/icon/index.d.ts +477 -0
  159. package/index.d.ts +3 -0
  160. package/input/index.d.ts +256 -0
  161. package/layout/container/index.d.ts +31 -0
  162. package/layout/index.d.ts +78 -0
  163. package/layout/stack/index.d.ts +52 -0
  164. package/list/index.d.ts +659 -0
  165. package/menu/index.d.ts +497 -0
  166. package/navbar/index.d.ts +91 -0
  167. package/package.json +279 -0
  168. package/paginator/index.d.ts +216 -0
  169. package/progress/index.d.ts +130 -0
  170. package/radio/index.d.ts +259 -0
  171. package/select/index.d.ts +426 -0
  172. package/sidenav/index.d.ts +369 -0
  173. package/slider/index.d.ts +48 -0
  174. package/snack-bar/index.d.ts +374 -0
  175. package/sort/index.d.ts +334 -0
  176. package/spinner/index.d.ts +70 -0
  177. package/stepper/index.d.ts +295 -0
  178. package/table/index.d.ts +395 -0
  179. package/tabs/index.d.ts +307 -0
  180. package/timepicker/index.d.ts +350 -0
  181. package/toolbar/index.d.ts +36 -0
  182. package/tooltip/index.d.ts +299 -0
  183. package/tree/index.d.ts +314 -0
@@ -0,0 +1,1046 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Directive, Input, ChangeDetectionStrategy, ViewEncapsulation, Component, EventEmitter, inject, InjectionToken, Injectable, Optional, booleanAttribute, HostListener, ViewChild, NgModule } from '@angular/core';
3
+ import { CuteButton } from '@cute-widgets/base/button';
4
+ import { CdkDrag } from '@angular/cdk/drag-drop';
5
+ import { Subject, merge, defer } from 'rxjs';
6
+ import { filter, take, startWith } from 'rxjs/operators';
7
+ import { ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';
8
+ import { OverlayRef, Overlay } from '@angular/cdk/overlay';
9
+ import { CdkDialogContainer, Dialog, DialogConfig } from '@angular/cdk/dialog';
10
+ import * as i1 from '@angular/cdk/portal';
11
+ import { PortalModule } from '@angular/cdk/portal';
12
+ import { CuteLayoutControl } from '@cute-widgets/base/abstract';
13
+ import { coerceNumberProperty } from '@angular/cdk/coercion';
14
+ import { _animationsDisabled, bsBreakpoints } from '@cute-widgets/base/core';
15
+ import { BreakpointObserver } from '@angular/cdk/layout';
16
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
17
+ import { CommonModule } from '@angular/common';
18
+
19
+ /**
20
+ * @license Apache-2.0
21
+ *
22
+ * Copyright (c) 2025 CuteWidgets Team. All Rights Reserved.
23
+ *
24
+ * You may not use this file except in compliance with the License
25
+ * that can be found at http://www.apache.org/licenses/LICENSE-2.0
26
+ */
27
+ class CuteDialogBody {
28
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteDialogBody, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
29
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.15", type: CuteDialogBody, isStandalone: true, selector: "cute-dialog-body, [cute-dialog-body], [cuteDialogBody],\n cute-dialog-content, [cute-dialog-content], [cuteDialogContent]\n ", host: { classAttribute: "cute-dialog-body modal-body" }, exportAs: ["cuteDialogBody"], ngImport: i0 }); }
30
+ }
31
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteDialogBody, decorators: [{
32
+ type: Directive,
33
+ args: [{
34
+ selector: `cute-dialog-body, [cute-dialog-body], [cuteDialogBody],
35
+ cute-dialog-content, [cute-dialog-content], [cuteDialogContent]
36
+ `,
37
+ exportAs: 'cuteDialogBody',
38
+ host: {
39
+ 'class': 'cute-dialog-body modal-body'
40
+ },
41
+ standalone: true,
42
+ }]
43
+ }] });
44
+
45
+ /**
46
+ * @license Apache-2.0
47
+ *
48
+ * Copyright (c) 2025 CuteWidgets Team. All Rights Reserved.
49
+ *
50
+ * You may not use this file except in compliance with the License
51
+ * that can be found at http://www.apache.org/licenses/LICENSE-2.0
52
+ *
53
+ * This code is a modification of the `@angular/material` original
54
+ * code licensed under MIT-style License (https://angular.dev/license).
55
+ */
56
+ class CuteDialogFooter {
57
+ constructor() {
58
+ /** Horizontal alignment of the footer's content */
59
+ this.align = 'start';
60
+ }
61
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteDialogFooter, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
62
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.15", type: CuteDialogFooter, isStandalone: true, selector: "cute-dialog-footer, [cute-dialog-footer], [cuteDialogFooter],\n cute-dialog-actions, [cute-dialog-actions], [cuteDialogActions]\n ", inputs: { align: "align" }, host: { properties: { "style.justify-content": "align" }, classAttribute: "cute-dialog-footer cute-dialog-actions modal-footer" }, exportAs: ["cuteDialogFooter", "cuteDialogActions"], ngImport: i0 }); }
63
+ }
64
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteDialogFooter, decorators: [{
65
+ type: Directive,
66
+ args: [{
67
+ selector: `cute-dialog-footer, [cute-dialog-footer], [cuteDialogFooter],
68
+ cute-dialog-actions, [cute-dialog-actions], [cuteDialogActions]
69
+ `,
70
+ exportAs: 'cuteDialogFooter, cuteDialogActions',
71
+ host: {
72
+ 'class': 'cute-dialog-footer cute-dialog-actions modal-footer',
73
+ '[style.justify-content]': 'align',
74
+ },
75
+ standalone: true,
76
+ }]
77
+ }], propDecorators: { align: [{
78
+ type: Input
79
+ }] } });
80
+
81
+ /**
82
+ * @license Apache-2.0
83
+ *
84
+ * Copyright (c) 2025 CuteWidgets Team. All Rights Reserved.
85
+ *
86
+ * You may not use this file except in compliance with the License
87
+ * that can be found at http://www.apache.org/licenses/LICENSE-2.0
88
+ *
89
+ * This code is a modification of the `@angular/material` original
90
+ * code licensed under MIT-style License (https://angular.dev/license).
91
+ */
92
+ var CuteDialogState;
93
+ (function (CuteDialogState) {
94
+ CuteDialogState[CuteDialogState["OPEN"] = 0] = "OPEN";
95
+ CuteDialogState[CuteDialogState["CLOSING"] = 1] = "CLOSING";
96
+ CuteDialogState[CuteDialogState["CLOSED"] = 2] = "CLOSED";
97
+ })(CuteDialogState || (CuteDialogState = {}));
98
+ /**
99
+ * Reference to a dialog opened via the CuteDialog service.
100
+ */
101
+ class CuteDialogRef {
102
+ constructor(_ref, _config, _containerInstance) {
103
+ this._ref = _ref;
104
+ this._config = _config;
105
+ this._containerInstance = _containerInstance;
106
+ /**
107
+ * `ComponentRef` of the component opened into the dialog. Will be
108
+ * null when the dialog is opened using a `TemplateRef`.
109
+ */
110
+ this.componentRef = null;
111
+ /** Subject for notifying the user that the dialog has finished opening. */
112
+ this._afterOpened = new Subject();
113
+ /** Subject for notifying the user that the dialog has started closing. */
114
+ this._beforeClosed = new Subject();
115
+ /** Current state of the dialog. */
116
+ this._state = CuteDialogState.OPEN;
117
+ this.disableClose = _config.disableClose;
118
+ this.id = _ref.id;
119
+ // Used to target panels specifically tied to dialogs.
120
+ _ref.addPanelClass('cute-dialog-panel');
121
+ // Emit when opening animation completes
122
+ _containerInstance._animationStateChanged
123
+ .pipe(filter(event => event.state === 'opened'), take(1))
124
+ .subscribe(() => {
125
+ this._afterOpened.next();
126
+ this._afterOpened.complete();
127
+ });
128
+ // Dispose overlay when closing animation is complete
129
+ _containerInstance._animationStateChanged
130
+ .pipe(filter(event => event.state === 'closed'), take(1))
131
+ .subscribe(() => {
132
+ clearTimeout(this._closeFallbackTimeout);
133
+ this._finishDialogClose();
134
+ });
135
+ _ref.overlayRef.detachments().subscribe(() => {
136
+ this._beforeClosed.next(this._result);
137
+ this._beforeClosed.complete();
138
+ this._finishDialogClose();
139
+ });
140
+ merge(this.backdropClick(), this.keydownEvents().pipe(filter(event => event.keyCode === ESCAPE && !this.disableClose && !hasModifierKey(event)))).subscribe(event => {
141
+ if (!this.disableClose) {
142
+ event.preventDefault();
143
+ _closeDialogVia(this, event.type === 'keydown' ? 'keyboard' : 'mouse');
144
+ }
145
+ });
146
+ }
147
+ /**
148
+ * Close the dialog.
149
+ * @param dialogResult Optional result to return to the dialog opener.
150
+ */
151
+ close(dialogResult) {
152
+ const closePredicate = this._config.closePredicate;
153
+ if (closePredicate && !closePredicate(dialogResult, this._config, this.componentInstance)) {
154
+ return;
155
+ }
156
+ this._result = dialogResult;
157
+ // Transition the backdrop in parallel to the dialog.
158
+ this._containerInstance._animationStateChanged
159
+ .pipe(filter(event => event.state === 'closing'), take(1))
160
+ .subscribe(event => {
161
+ this._beforeClosed.next(dialogResult);
162
+ this._beforeClosed.complete();
163
+ this._ref.overlayRef.detachBackdrop();
164
+ // The logic that disposes of the overlay depends on the exit animation completing, however,
165
+ // it isn't guaranteed if the parent view is destroyed while it's running. Add a fallback
166
+ // timeout which will clean everything up if the animation hasn't fired within the specified
167
+ // amount of time plus 100ms. We don't need to run this outside the NgZone, because for the
168
+ // vast majority of cases the timeout will have been cleared before it has the chance to fire.
169
+ this._closeFallbackTimeout = setTimeout(() => this._finishDialogClose(), event.totalTime + 100);
170
+ });
171
+ this._state = CuteDialogState.CLOSING;
172
+ this._containerInstance._startExitAnimation();
173
+ }
174
+ /**
175
+ * Gets an observable notified when the dialog is finished opening.
176
+ */
177
+ afterOpened() {
178
+ return this._afterOpened;
179
+ }
180
+ /**
181
+ * Gets an observable notified when the dialog is finished closing.
182
+ */
183
+ afterClosed() {
184
+ return this._ref.closed;
185
+ }
186
+ /**
187
+ * Gets an observable notified when the dialog has started closing.
188
+ */
189
+ beforeClosed() {
190
+ return this._beforeClosed;
191
+ }
192
+ /**
193
+ * Gets an observable that emits when the overlay's backdrop has been clicked.
194
+ */
195
+ backdropClick() {
196
+ return this._ref.backdropClick;
197
+ }
198
+ /**
199
+ * Gets an observable that emits when keydown events are targeted on the overlay.
200
+ */
201
+ keydownEvents() {
202
+ return this._ref.keydownEvents;
203
+ }
204
+ /**
205
+ * Updates the dialog's position.
206
+ * @param position New dialog position.
207
+ */
208
+ updatePosition(position) {
209
+ let strategy = this._ref.config.positionStrategy;
210
+ if (position && (position.left || position.right)) {
211
+ position.left ? strategy.left(position.left) : strategy.right(position.right);
212
+ }
213
+ else {
214
+ strategy.centerHorizontally();
215
+ }
216
+ if (position && (position.top || position.bottom)) {
217
+ position.top ? strategy.top(position.top) : strategy.bottom(position.bottom);
218
+ }
219
+ else {
220
+ strategy.centerVertically();
221
+ }
222
+ this._ref.updatePosition();
223
+ return this;
224
+ }
225
+ /**
226
+ * Updates the dialog's width and height.
227
+ * @param width New width of the dialog.
228
+ * @param height New height of the dialog.
229
+ */
230
+ updateSize(width = '', height = '') {
231
+ this._ref.updateSize(width, height);
232
+ return this;
233
+ }
234
+ /** Add a CSS class or an array of classes to the overlay pane. */
235
+ addPanelClass(classes) {
236
+ this._ref.addPanelClass(classes);
237
+ return this;
238
+ }
239
+ /** Remove a CSS class or an array of classes from the overlay pane. */
240
+ removePanelClass(classes) {
241
+ this._ref.removePanelClass(classes);
242
+ return this;
243
+ }
244
+ /** Checks if the panel contains the specified CSS class */
245
+ hasPanelClass(className) {
246
+ return this._ref.overlayRef.overlayElement.classList.contains(className);
247
+ }
248
+ /** Gets the current state of the dialog's lifecycle. */
249
+ getState() {
250
+ return this._state;
251
+ }
252
+ /**
253
+ * Finishes the dialog close by updating the state of the dialog
254
+ * and disposing the overlay.
255
+ */
256
+ _finishDialogClose() {
257
+ this._state = CuteDialogState.CLOSED;
258
+ this._ref.close(this._result, { focusOrigin: this._closeInteractionType });
259
+ this.componentInstance = null;
260
+ }
261
+ }
262
+ /**
263
+ * Closes the dialog with the specified interaction type. This is currently not part of
264
+ * `CuteDialogRef` as that would conflict with custom dialog ref mocks provided in tests.
265
+ * More details. See: https://github.com/angular/components/pull/9257#issuecomment-651342226.
266
+ */
267
+ // TODO: Move this back into `CuteDialogRef` when we provide an official mock dialog ref.
268
+ function _closeDialogVia(ref, interactionType, result) {
269
+ ref._closeInteractionType = interactionType;
270
+ return ref.close(result);
271
+ }
272
+
273
+ /**
274
+ * Configuration for opening a modal dialog with the `CuteDialog` service.
275
+ */
276
+ class CuteDialogConfig {
277
+ constructor() {
278
+ /** The ARIA role of the dialog element. */
279
+ this.role = 'dialog';
280
+ /** Custom class for the overlay pane. */
281
+ this.panelClass = '';
282
+ /** Whether the dialog has a backdrop. */
283
+ this.hasBackdrop = true;
284
+ /** Custom class for the backdrop. */
285
+ this.backdropClass = '';
286
+ /** Whether the user can use escape or clicking on the backdrop to close the modal. */
287
+ this.disableClose = false;
288
+ /** Width of the dialog. */
289
+ this.width = '';
290
+ /** Height of the dialog. */
291
+ this.height = '';
292
+ /** Max-width of the dialog. If a number is provided, assumes pixel units. Defaults to 80vw. */
293
+ this.maxWidth = '80vw';
294
+ /** Max-height of the dialog. If a number is provided, assumes pixel units. */
295
+ this.maxHeight = '95vh';
296
+ /** Whether the dialog can be dragged at runtime and optionally restrict dragging to a specific axis */
297
+ this.draggable = false;
298
+ /** Data being injected into the child component. */
299
+ this.data = null;
300
+ /** ID of the element that describes the dialog. */
301
+ this.ariaDescribedBy = null;
302
+ /** ID of the element that labels the dialog. */
303
+ this.ariaLabelledBy = null;
304
+ /** Aria label to assign to the dialog element. */
305
+ this.ariaLabel = null;
306
+ /** Whether this is a modal dialog. Used to set the `aria-modal` attribute. */
307
+ this.ariaModal = true;
308
+ /**
309
+ * Where the dialog should focus on open.
310
+ */
311
+ this.autoFocus = 'first-tabbable';
312
+ /**
313
+ * Whether the dialog should restore focus to the
314
+ * previously focused element, after it's closed.
315
+ */
316
+ this.restoreFocus = true;
317
+ /** Whether to wait for the opening animation to finish before trapping focus. */
318
+ this.delayFocusTrap = true;
319
+ /**
320
+ * Whether the dialog should close when the user goes backwards/forwards in history.
321
+ * Note that this usually doesn't include clicking on links (unless the user is using
322
+ * the `HashLocationStrategy`).
323
+ */
324
+ this.closeOnNavigation = true;
325
+ }
326
+ }
327
+
328
+ /**
329
+ * @license Apache-2.0
330
+ *
331
+ * Copyright (c) 2025 CuteWidgets Team. All Rights Reserved.
332
+ *
333
+ * You may not use this file except in compliance with the License
334
+ * that can be found at http://www.apache.org/licenses/LICENSE-2.0
335
+ */
336
+ let uniqueId$1 = 0;
337
+ class CuteDialogStage extends CuteLayoutControl {
338
+ constructor() {
339
+ super();
340
+ }
341
+ generateId() {
342
+ return `cute-dialog-stage-${uniqueId$1++}`;
343
+ }
344
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteDialogStage, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
345
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: CuteDialogStage, isStandalone: true, selector: "cute-dialog-stage", host: { properties: { "attr.id": "id || null" }, classAttribute: "cute-dialog-stage modal-dialog modal-dialog-scrollable" }, usesInheritance: true, ngImport: i0, template: "<div class=\"modal-content\">\r\n <ng-content select=\"cute-dialog-header,\r\n [cute-dialog-header],\r\n [cuteDialogHeader]\"></ng-content>\r\n <ng-content select=\"cute-dialog-body,\r\n [cute-dialog-body],\r\n [cuteDialogBody]\"></ng-content>\r\n <ng-content></ng-content>\r\n <ng-content select=\"cute-dialog-footer,\r\n [cute-dialog-footer],\r\n [cuteDialogFooter]\"></ng-content>\r\n</div>\r\n", styles: [".modal-dialog{display:block;position:static;width:100%;height:100%;min-width:300px;margin:0}.modal-content{--bs-border-color-translucent: none;width:100%;height:100%}.fullscreen-dialog{--bs-border-radius-lg: 0;transform:none!important;width:100vw;max-width:none;height:100%;min-width:100%;min-height:100%}.cdk-global-scrollblock:has(.fullscreen-dialog){overflow:hidden}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
346
+ }
347
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteDialogStage, decorators: [{
348
+ type: Component,
349
+ args: [{ selector: 'cute-dialog-stage', host: {
350
+ 'class': 'cute-dialog-stage modal-dialog modal-dialog-scrollable',
351
+ '[attr.id]': 'id || null',
352
+ }, standalone: true, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"modal-content\">\r\n <ng-content select=\"cute-dialog-header,\r\n [cute-dialog-header],\r\n [cuteDialogHeader]\"></ng-content>\r\n <ng-content select=\"cute-dialog-body,\r\n [cute-dialog-body],\r\n [cuteDialogBody]\"></ng-content>\r\n <ng-content></ng-content>\r\n <ng-content select=\"cute-dialog-footer,\r\n [cute-dialog-footer],\r\n [cuteDialogFooter]\"></ng-content>\r\n</div>\r\n", styles: [".modal-dialog{display:block;position:static;width:100%;height:100%;min-width:300px;margin:0}.modal-content{--bs-border-color-translucent: none;width:100%;height:100%}.fullscreen-dialog{--bs-border-radius-lg: 0;transform:none!important;width:100vw;max-width:none;height:100%;min-width:100%;min-height:100%}.cdk-global-scrollblock:has(.fullscreen-dialog){overflow:hidden}\n"] }]
353
+ }], ctorParameters: () => [] });
354
+
355
+ /**
356
+ * @license Apache-2.0
357
+ *
358
+ * Copyright (c) 2025 CuteWidgets Team. All Rights Reserved.
359
+ *
360
+ * You may not use this file except in compliance with the License
361
+ * that can be found at http://www.apache.org/licenses/LICENSE-2.0
362
+ *
363
+ * This code is a modification of the `@angular/material` original
364
+ * code licensed under MIT-style License (https://angular.dev/license).
365
+ */
366
+ const TRANSITION_DURATION_PROPERTY = '--cute-dialog-transition-duration';
367
+ const FULLSCREEN_CLASS = "fullscreen-dialog";
368
+ /** Class added when the dialog is open. */
369
+ const OPEN_CLASS = 'show'; //'cute-dialog--open';
370
+ /** Class added while the dialog is opening. */
371
+ const OPENING_CLASS = 'show'; //'cute-dialog--opening';
372
+ /** Class added while the dialog is closing. */
373
+ const CLOSING_CLASS = 'hide'; // 'cute-dialog--closing';
374
+ /** Duration of the opening animation in milliseconds. */
375
+ const OPEN_ANIMATION_DURATION = 300; //150
376
+ /** Duration of the closing animation in milliseconds. */
377
+ const CLOSE_ANIMATION_DURATION = 300; //75
378
+ class CuteDialogContainer extends CdkDialogContainer {
379
+ constructor() {
380
+ super();
381
+ /** Emits when an animation state changes. */
382
+ this._animationStateChanged = new EventEmitter();
383
+ /** Whether animations are enabled. */
384
+ this._animationsEnabled = !_animationsDisabled();
385
+ this._overlayRef = inject(OverlayRef);
386
+ /** Number of actions projected in the dialog. */
387
+ this._actionSectionCount = 0;
388
+ /** Host element of the dialog container component. */
389
+ this._hostElement = this._elementRef.nativeElement;
390
+ /** Duration of the dialog open animation. */
391
+ this._enterAnimationDuration = this._animationsEnabled
392
+ ? (parseCssTime(this._config.enterAnimationDuration) ?? OPEN_ANIMATION_DURATION)
393
+ : 0;
394
+ /** Duration of the dialog close animation. */
395
+ this._exitAnimationDuration = this._animationsEnabled
396
+ ? (parseCssTime(this._config.exitAnimationDuration) ?? CLOSE_ANIMATION_DURATION)
397
+ : 0;
398
+ /** Current timer for dialog animations. */
399
+ this._animationTimer = null;
400
+ /**
401
+ * Completes the dialog open by clearing potential animation classes, trapping
402
+ * focus and emitting an opened event.
403
+ */
404
+ this._finishDialogOpen = () => {
405
+ //this._clearAnimationClasses();
406
+ this._openAnimationDone(this._enterAnimationDuration);
407
+ };
408
+ /**
409
+ * Completes the dialog close by clearing potential animation classes, restoring
410
+ * focus and emitting a closed event.
411
+ */
412
+ this._finishDialogClose = () => {
413
+ this._clearAnimationClasses();
414
+ this._animationStateChanged.emit({ state: 'closed', totalTime: this._exitAnimationDuration });
415
+ };
416
+ const dialogConfig = inject(CuteDialogConfig);
417
+ const breakpointObserver = inject(BreakpointObserver);
418
+ const BREAKPOINT_KEY = "fullscreen-";
419
+ if (dialogConfig.fullscreenStrategy && dialogConfig.fullscreenStrategy.startsWith(BREAKPOINT_KEY)) {
420
+ const bpName = bsBreakpoints.getLabel(dialogConfig.fullscreenStrategy.substring(BREAKPOINT_KEY.length));
421
+ breakpointObserver
422
+ .observe([
423
+ bsBreakpoints[bpName + 'AndDown'],
424
+ ])
425
+ .pipe(takeUntilDestroyed())
426
+ .subscribe(result => {
427
+ //console.log(result.breakpoints);
428
+ if (result.matches) {
429
+ this._overlayRef.addPanelClass(FULLSCREEN_CLASS);
430
+ }
431
+ else {
432
+ this._overlayRef.removePanelClass(FULLSCREEN_CLASS);
433
+ }
434
+ });
435
+ }
436
+ }
437
+ /**
438
+ * Whether the Dialog box is opened to the full screen
439
+ */
440
+ isFullScreenDialog() {
441
+ return this._overlayRef.overlayElement.classList.contains(FULLSCREEN_CLASS);
442
+ }
443
+ _contentAttached() {
444
+ // Delegate to the original dialog-container initialization (i.e. saving the
445
+ // previous element, setting up the focus trap and moving focus to the container).
446
+ super._contentAttached();
447
+ // Note: Usually we would be able to use the MDC dialog foundation here to handle
448
+ // the dialog animation for us, but there are a few reasons why we just leverage
449
+ // their styles and not use the runtime foundation code:
450
+ // 1. Foundation does not allow us to disable animations.
451
+ // 2. Foundation contains unnecessary features we don't need and aren't
452
+ // tree-shakeable. e.g. background scrim, keyboard event handlers for ESC button.
453
+ this._startOpenAnimation();
454
+ }
455
+ /** Starts the dialog open animation if enabled. */
456
+ _startOpenAnimation() {
457
+ this._animationStateChanged.emit({ state: 'opening', totalTime: this._enterAnimationDuration });
458
+ if (this._animationsEnabled) {
459
+ this._hostElement.style.setProperty(TRANSITION_DURATION_PROPERTY, `${this._enterAnimationDuration}ms`);
460
+ // We need to give the `setProperty` call from above some time to be applied.
461
+ // One would expect that the open class is added once the animation finished, but MDC
462
+ // uses the open class in combination with the opening class to start the animation.
463
+ this._requestAnimationFrame(() => this._hostElement.classList.add(/*OPENING_CLASS,*/ OPEN_CLASS));
464
+ this._waitForAnimationToComplete(this._enterAnimationDuration, this._finishDialogOpen);
465
+ }
466
+ else {
467
+ this._hostElement.classList.add(OPEN_CLASS);
468
+ // Note: We could immediately finish the dialog opening here with noop animations,
469
+ // but we defer until next tick so that consumers can subscribe to `afterOpened`.
470
+ // Executing this immediately would mean that `afterOpened` emits synchronously
471
+ // on `dialog.open` before the consumer had a change to subscribe to `afterOpened`.
472
+ Promise.resolve().then(() => this._finishDialogOpen());
473
+ }
474
+ }
475
+ /**
476
+ * Starts the exit animation of the dialog if enabled. This method is
477
+ * called by the dialog ref.
478
+ */
479
+ _startExitAnimation() {
480
+ this._animationStateChanged.emit({ state: 'closing', totalTime: this._exitAnimationDuration });
481
+ this._hostElement.classList.remove(OPEN_CLASS);
482
+ if (this._animationsEnabled) {
483
+ this._hostElement.style.setProperty(TRANSITION_DURATION_PROPERTY, `${this._exitAnimationDuration}ms`);
484
+ // We need to give the `setProperty` call from above some time to be applied.
485
+ this._requestAnimationFrame(() => this._hostElement.classList.add(CLOSING_CLASS));
486
+ this._waitForAnimationToComplete(this._exitAnimationDuration, this._finishDialogClose);
487
+ }
488
+ else {
489
+ // This subscription to the `OverlayRef#backdropClick` observable in the `DialogRef` is
490
+ // set up before any user can subscribe to the backdrop click. The subscription triggers
491
+ // the dialog close and this method synchronously. If we'd synchronously emit the `CLOSED`
492
+ // animation state event if animations are disabled, the overlay would be disposed
493
+ // immediately and all other subscriptions to `DialogRef#backdropClick` would be silently
494
+ // skipped. We work around this by waiting with the dialog close until the next tick when
495
+ // all subscriptions have been fired as expected. This is not an ideal solution, but
496
+ // there doesn't seem to be any other good way. Alternatives that have been considered:
497
+ // 1. Deferring `DialogRef.close`. This could be a breaking change due to a new microtask.
498
+ // Also this issue is specific to the MDC implementation where the dialog could
499
+ // technically be closed synchronously. In the non-MDC one, Angular animations are used
500
+ // and closing always takes at least a tick.
501
+ // 2. Ensuring that user subscriptions to `backdropClick`, `keydownEvents` in the dialog
502
+ // ref are first. This would solve the issue, but has the risk of memory leaks and also
503
+ // doesn't solve the case where consumers call `DialogRef.close` in their subscriptions.
504
+ // Based on the fact that this is specific to the MDC-based implementation of the dialog
505
+ // animations, the defer is applied here.
506
+ Promise.resolve().then(() => this._finishDialogClose());
507
+ }
508
+ }
509
+ /**
510
+ * Updates the number action sections.
511
+ * @param delta Increase/decrease in the number of sections.
512
+ */
513
+ _updateActionSectionCount(delta) {
514
+ this._actionSectionCount += delta;
515
+ this._changeDetectorRef.markForCheck();
516
+ }
517
+ /** Clears all dialog animation classes. */
518
+ _clearAnimationClasses() {
519
+ this._hostElement.classList.remove(OPENING_CLASS, CLOSING_CLASS);
520
+ }
521
+ _waitForAnimationToComplete(duration, callback) {
522
+ if (this._animationTimer !== null) {
523
+ clearTimeout(this._animationTimer);
524
+ }
525
+ // Note that we want this timer to run inside the NgZone, because we want
526
+ // the related events like `afterClosed` to be inside the zone as well.
527
+ this._animationTimer = setTimeout(callback, duration);
528
+ }
529
+ /** Runs a callback in `requestAnimationFrame`, if available. */
530
+ _requestAnimationFrame(callback) {
531
+ this._ngZone.runOutsideAngular(() => {
532
+ if (typeof requestAnimationFrame === 'function') {
533
+ requestAnimationFrame(callback);
534
+ }
535
+ else {
536
+ callback();
537
+ }
538
+ });
539
+ }
540
+ _captureInitialFocus() {
541
+ if (!this._config.delayFocusTrap) {
542
+ this._trapFocus();
543
+ }
544
+ }
545
+ /**
546
+ * Callback for when the open dialog animation has finished. Intended to
547
+ * be called by sub-classes that use different animation implementations.
548
+ */
549
+ _openAnimationDone(totalTime) {
550
+ if (this._config.delayFocusTrap) {
551
+ this._trapFocus();
552
+ }
553
+ this._animationStateChanged.next({ state: 'opened', totalTime });
554
+ }
555
+ ngOnDestroy() {
556
+ super.ngOnDestroy();
557
+ if (this._animationTimer !== null) {
558
+ clearTimeout(this._animationTimer);
559
+ }
560
+ }
561
+ attachComponentPortal(portal) {
562
+ // When a component is passed into the dialog, the host element interrupts
563
+ // the `display:flex` from affecting the dialog title, content, and
564
+ // actions. To fix this, we make the component host `display: contents` by
565
+ // marking its host with the `mat-mdc-dialog-component-host` class.
566
+ //
567
+ // Note that this problem does not exist when a template ref is used since
568
+ // the title, contents, and actions are then nested directly under the
569
+ // dialog surface.
570
+ const ref = super.attachComponentPortal(portal);
571
+ ref.location.nativeElement.classList.add('cute-dialog-component-host');
572
+ return ref;
573
+ }
574
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteDialogContainer, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
575
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: CuteDialogContainer, isStandalone: true, selector: "cute-dialog-container", host: { attributes: { "tabindex": "-1" }, properties: { "attr.aria-modal": "_config.ariaModal", "id": "_config.id", "attr.role": "_config.role", "attr.aria-labelledby": "_config.ariaLabel ? null : _ariaLabelledByQueue[0]", "attr.aria-label": "_config.ariaLabel", "attr.aria-describedby": "_config.ariaDescribedBy || null", "class._cute-animation-noopable": "!_animationsEnabled", "class.cute-dialog-container-with-actions": "_actionSectionCount > 0" }, classAttribute: "cute-dialog-container cute-dialog modal fade" }, usesInheritance: true, ngImport: i0, template: " <cute-dialog-stage>\r\n <ng-template cdkPortalOutlet />\r\n </cute-dialog-stage>\r\n", styles: [".cute-dialog-container{--bs-modal-width: 100%;display:block;position:static;width:100%;height:auto;min-height:inherit;max-height:inherit;min-width:inherit;max-width:inherit}.cute-dialog-component-host{display:contents}\n"], dependencies: [{ kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i1.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "component", type: CuteDialogStage, selector: "cute-dialog-stage" }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None }); }
576
+ }
577
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteDialogContainer, decorators: [{
578
+ type: Component,
579
+ args: [{ selector: 'cute-dialog-container', host: {
580
+ 'class': 'cute-dialog-container cute-dialog modal fade',
581
+ 'tabindex': '-1',
582
+ '[attr.aria-modal]': '_config.ariaModal',
583
+ '[id]': '_config.id',
584
+ '[attr.role]': '_config.role',
585
+ '[attr.aria-labelledby]': '_config.ariaLabel ? null : _ariaLabelledByQueue[0]',
586
+ '[attr.aria-label]': '_config.ariaLabel',
587
+ '[attr.aria-describedby]': '_config.ariaDescribedBy || null',
588
+ '[class._cute-animation-noopable]': '!_animationsEnabled',
589
+ '[class.cute-dialog-container-with-actions]': '_actionSectionCount > 0',
590
+ }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Default, imports: [PortalModule, CuteDialogStage], template: " <cute-dialog-stage>\r\n <ng-template cdkPortalOutlet />\r\n </cute-dialog-stage>\r\n", styles: [".cute-dialog-container{--bs-modal-width: 100%;display:block;position:static;width:100%;height:auto;min-height:inherit;max-height:inherit;min-width:inherit;max-width:inherit}.cute-dialog-component-host{display:contents}\n"] }]
591
+ }], ctorParameters: () => [] });
592
+ // TODO(mmalerba): Remove this function after animation durations are required
593
+ // to be numbers.
594
+ /**
595
+ * Converts a CSS time string to a number in ms. If the given time is already a
596
+ * number, it is assumed to be in ms.
597
+ */
598
+ function parseCssTime(time) {
599
+ if (time == null) {
600
+ return null;
601
+ }
602
+ if (typeof time === 'number') {
603
+ return time;
604
+ }
605
+ if (time.endsWith('ms')) {
606
+ return coerceNumberProperty(time.substring(0, time.length - 2));
607
+ }
608
+ if (time.endsWith('s')) {
609
+ return coerceNumberProperty(time.substring(0, time.length - 1)) * 1000;
610
+ }
611
+ if (time === '0') {
612
+ return 0;
613
+ }
614
+ return null; // anything else is invalid.
615
+ }
616
+
617
+ /**
618
+ * @license Apache-2.0
619
+ *
620
+ * Copyright (c) 2025 CuteWidgets Team. All Rights Reserved.
621
+ *
622
+ * You may not use this file except in compliance with the License
623
+ * that can be found at http://www.apache.org/licenses/LICENSE-2.0
624
+ *
625
+ * This code is a modification of the `@angular/material` original
626
+ * code licensed under MIT-style License (https://angular.dev/license).
627
+ */
628
+ /** Injection token that can be used to access the data that was passed in to a dialog. */
629
+ const CUTE_DIALOG_DATA = new InjectionToken('CuteDialogData');
630
+ /** Injection token that can be used to specify default dialog options. */
631
+ const CUTE_DIALOG_DEFAULT_OPTIONS = new InjectionToken('cute-dialog-default-options');
632
+ /** Injection token that determines the scroll handling while the dialog is open. */
633
+ const CUTE_DIALOG_SCROLL_STRATEGY = new InjectionToken('cute-dialog-scroll-strategy', {
634
+ providedIn: 'root',
635
+ factory: () => {
636
+ const overlay = inject(Overlay);
637
+ return () => overlay.scrollStrategies.block();
638
+ },
639
+ });
640
+ // Counter for unique dialog ids.
641
+ let uniqueId = 0;
642
+ /**
643
+ * Service to open `Bootstrap` modal controls
644
+ */
645
+ class CuteDialog {
646
+ /** Keeps track of the currently open dialogs. */
647
+ get openDialogs() {
648
+ return this._parentDialog ? this._parentDialog.openDialogs : this._openDialogsAtThisLevel;
649
+ }
650
+ /** Stream that emits when a dialog has been opened. */
651
+ get afterOpened() {
652
+ return (this._parentDialog ? this._parentDialog.afterOpened : this._afterOpenedAtThisLevel);
653
+ }
654
+ _getAfterAllClosed() {
655
+ const parent = this._parentDialog;
656
+ return parent ? parent._getAfterAllClosed() : this._afterAllClosedAtThisLevel;
657
+ }
658
+ constructor() {
659
+ this._overlay = inject(Overlay);
660
+ this._defaultOptions = inject(CUTE_DIALOG_DEFAULT_OPTIONS, { optional: true });
661
+ this._scrollStrategy = inject(CUTE_DIALOG_SCROLL_STRATEGY);
662
+ this._parentDialog = inject(CuteDialog, { optional: true, skipSelf: true });
663
+ this._dialog = inject(Dialog);
664
+ this._openDialogsAtThisLevel = [];
665
+ this._afterAllClosedAtThisLevel = new Subject();
666
+ this._afterOpenedAtThisLevel = new Subject();
667
+ this.dialogConfigClass = CuteDialogConfig;
668
+ /**
669
+ * Stream that emits when all open dialogs have finished closing.
670
+ * Will emit on subscribing if there are no open dialogs to begin with.
671
+ */
672
+ this.afterAllClosed = defer(() => this.openDialogs.length
673
+ ? this._getAfterAllClosed()
674
+ : this._getAfterAllClosed().pipe(startWith(undefined)));
675
+ this._dialogRefConstructor = CuteDialogRef;
676
+ this._dialogContainerType = CuteDialogContainer;
677
+ this._dialogDataToken = CUTE_DIALOG_DATA;
678
+ }
679
+ open(componentOrTemplateRef, config) {
680
+ let dialogRef;
681
+ config = { ...(this._defaultOptions || new CuteDialogConfig()), ...config };
682
+ config.id = config.id || `cute-dialog-${uniqueId++}`;
683
+ config.scrollStrategy = config.scrollStrategy || this._scrollStrategy();
684
+ const cdkRef = this._dialog.open(componentOrTemplateRef, {
685
+ ...config,
686
+ positionStrategy: this._overlay.position().global().centerHorizontally().centerVertically(),
687
+ // Disable closing since we need to sync it up to the animation ourselves.
688
+ disableClose: true,
689
+ // Disable closing on destroying, because this service cleans up its open dialogs as well.
690
+ // We want to do the cleanup here, rather than the CDK service, because the CDK destroys
691
+ // the dialogs immediately whereas we want it to wait for the animations to finish.
692
+ closeOnDestroy: false,
693
+ // Disable closing on detachments so that we can sync up the animation.
694
+ // The Material dialog ref handles this manually.
695
+ closeOnOverlayDetachments: false,
696
+ container: {
697
+ type: this._dialogContainerType,
698
+ providers: () => [
699
+ // Provide our config as the CDK config as well since it has the same interface as the
700
+ // CDK one. However, it contains the actual values passed in by the user for things like
701
+ // `disableClose` which we disable for the CDK dialog since we handle it ourselves.
702
+ { provide: this.dialogConfigClass, useValue: config },
703
+ { provide: DialogConfig, useValue: config },
704
+ ],
705
+ },
706
+ templateContext: () => ({ dialogRef }),
707
+ providers: (ref, cdkConfig, dialogContainer) => {
708
+ dialogRef = new this._dialogRefConstructor(ref, config, dialogContainer);
709
+ dialogRef.updatePosition(config?.position);
710
+ if (config?.fullscreenStrategy === "fullscreen") {
711
+ dialogRef.addPanelClass("fullscreen-dialog");
712
+ }
713
+ return [
714
+ { provide: this._dialogContainerType, useValue: dialogContainer },
715
+ { provide: this._dialogDataToken, useValue: cdkConfig.data },
716
+ { provide: this._dialogRefConstructor, useValue: dialogRef },
717
+ ];
718
+ },
719
+ });
720
+ // This can't be assigned in the `providers` callback, because
721
+ // the instance hasn't been assigned to the CDK ref yet.
722
+ dialogRef.componentRef = cdkRef.componentRef;
723
+ dialogRef.componentInstance = cdkRef.componentInstance;
724
+ this.openDialogs.push(dialogRef);
725
+ this.afterOpened.next(dialogRef);
726
+ dialogRef.afterClosed().subscribe(() => {
727
+ const index = this.openDialogs.indexOf(dialogRef);
728
+ if (index > -1) {
729
+ this.openDialogs.splice(index, 1);
730
+ if (!this.openDialogs.length) {
731
+ this._getAfterAllClosed().next();
732
+ }
733
+ }
734
+ });
735
+ return dialogRef;
736
+ }
737
+ /**
738
+ * Closes all the currently open dialogs.
739
+ */
740
+ closeAll() {
741
+ this._closeDialogs(this.openDialogs);
742
+ }
743
+ /**
744
+ * Finds an open dialog by its id.
745
+ * @param id ID to use when looking up the dialog.
746
+ */
747
+ getDialogById(id) {
748
+ return this.openDialogs.find(dialog => dialog.id === id);
749
+ }
750
+ ngOnDestroy() {
751
+ // Only close the dialogs at this level on destroy
752
+ // since the parent service may still be active.
753
+ this._closeDialogs(this._openDialogsAtThisLevel);
754
+ this._afterAllClosedAtThisLevel.complete();
755
+ this._afterOpenedAtThisLevel.complete();
756
+ }
757
+ _closeDialogs(dialogs) {
758
+ let i = dialogs.length;
759
+ while (i--) {
760
+ dialogs[i].close();
761
+ }
762
+ }
763
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteDialog, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
764
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteDialog, providedIn: 'root' }); }
765
+ }
766
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteDialog, decorators: [{
767
+ type: Injectable,
768
+ args: [{ providedIn: 'root' }]
769
+ }], ctorParameters: () => [] });
770
+
771
+ /**
772
+ * @license Apache-2.0
773
+ *
774
+ * Copyright (c) 2025 CuteWidgets Team. All Rights Reserved.
775
+ *
776
+ * You may not use this file except in compliance with the License
777
+ * that can be found at http://www.apache.org/licenses/LICENSE-2.0
778
+ *
779
+ * This code is a modification of the `@angular/material` original
780
+ * code licensed under MIT-style License (https://angular.dev/license).
781
+ */
782
+ /**
783
+ * Button that will close the current dialog.
784
+ */
785
+ class CuteDialogClose {
786
+ constructor(
787
+ // The dialog title directive is always used in combination with a `CuteDialogRef`.
788
+ dialogRef, _elementRef, _dialog) {
789
+ this.dialogRef = dialogRef;
790
+ this._elementRef = _elementRef;
791
+ this._dialog = _dialog;
792
+ /** Default to "button" to prevent accidental form submits. */
793
+ this.type = 'button';
794
+ /** Dialog close input. */
795
+ this.dialogResult = undefined;
796
+ this._cuteDialogClose = undefined; // Handled in `ngOnChanges`
797
+ }
798
+ ngOnInit() {
799
+ if (!this.dialogRef) {
800
+ // When this directive is included in a dialog via TemplateRef (rather than being
801
+ // in a Component), the DialogRef isn't available via injection because embedded
802
+ // views cannot be given a custom injector. Instead, we look up the `DialogRef` by
803
+ // ID. This must occur in `onInit`, as the ID binding for the dialog container won't
804
+ // be resolved at constructor time.
805
+ this.dialogRef = getClosestDialog(this._elementRef, this._dialog.openDialogs);
806
+ }
807
+ }
808
+ ngOnChanges(changes) {
809
+ const proxiedChange = changes['_cuteDialogClose'];
810
+ if (proxiedChange) {
811
+ this.dialogResult = proxiedChange.currentValue;
812
+ }
813
+ }
814
+ _onButtonClick(event) {
815
+ // Determinate the focus origin using the click event, because using the FocusMonitor will
816
+ // result in incorrect origins. Most of the time, close buttons will be auto focused in the
817
+ // dialog, and therefore clicking the button won't result in a focus change. This means that
818
+ // the FocusMonitor won't detect any origin change, and will always output `program`.
819
+ _closeDialogVia(this.dialogRef, event.screenX === 0 && event.screenY === 0 ? 'keyboard' : 'mouse', this.dialogResult);
820
+ }
821
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteDialogClose, deps: [{ token: CuteDialogRef, optional: true }, { token: i0.ElementRef }, { token: CuteDialog }], target: i0.ɵɵFactoryTarget.Directive }); }
822
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.15", type: CuteDialogClose, isStandalone: true, selector: "[cute-dialog-close], [cuteDialogClose]", inputs: { ariaLabel: ["aria-label", "ariaLabel"], type: "type", dialogResult: ["cute-dialog-close", "dialogResult"], _cuteDialogClose: ["cuteDialogClose", "_cuteDialogClose"] }, host: { listeners: { "click": "_onButtonClick($event)" }, properties: { "attr.aria-label": "ariaLabel || null", "attr.type": "type" } }, exportAs: ["cuteDialogClose"], usesOnChanges: true, ngImport: i0 }); }
823
+ }
824
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteDialogClose, decorators: [{
825
+ type: Directive,
826
+ args: [{
827
+ selector: '[cute-dialog-close], [cuteDialogClose]',
828
+ exportAs: 'cuteDialogClose',
829
+ standalone: true,
830
+ host: {
831
+ '(click)': '_onButtonClick($event)',
832
+ '[attr.aria-label]': 'ariaLabel || null',
833
+ '[attr.type]': 'type',
834
+ },
835
+ }]
836
+ }], ctorParameters: () => [{ type: CuteDialogRef, decorators: [{
837
+ type: Optional
838
+ }] }, { type: i0.ElementRef }, { type: CuteDialog }], propDecorators: { ariaLabel: [{
839
+ type: Input,
840
+ args: ['aria-label']
841
+ }], type: [{
842
+ type: Input
843
+ }], dialogResult: [{
844
+ type: Input,
845
+ args: ['cute-dialog-close']
846
+ }], _cuteDialogClose: [{
847
+ type: Input,
848
+ args: ['cuteDialogClose']
849
+ }] } });
850
+ /**
851
+ * Finds the closest CuteDialogRef to an element by looking at the DOM.
852
+ * @param element Element relative to which to look for a dialog.
853
+ * @param openDialogs References to the currently open dialogs.
854
+ */
855
+ function getClosestDialog(element, openDialogs) {
856
+ let parent = element.nativeElement.parentElement;
857
+ while (parent && !parent.classList.contains('cute-dialog-container')) {
858
+ parent = parent.parentElement;
859
+ }
860
+ return parent ? openDialogs.find(dialog => dialog.id === parent.id) : null;
861
+ }
862
+
863
+ /**
864
+ * @license Apache-2.0
865
+ *
866
+ * Copyright (c) 2025 CuteWidgets Team. All Rights Reserved.
867
+ *
868
+ * You may not use this file except in compliance with the License
869
+ * that can be found at http://www.apache.org/licenses/LICENSE-2.0
870
+ *
871
+ * This code is a modification of the `@angular/material` original
872
+ * code licensed under MIT-style License (https://angular.dev/license).
873
+ */
874
+ class CuteDialogHeader {
875
+ /**
876
+ * Whether it is possible to drag the `Dialog` by grabbing the header section.
877
+ * The default value is the value of the `draggable` property from the `CuteDialogConfig` object,
878
+ * or _false_ if the value is not defined.
879
+ */
880
+ get draggable() { return this._draggable; }
881
+ set draggable(value) { this._draggable = value; }
882
+ constructor(container) {
883
+ this.container = container;
884
+ this.isMouseDown = false;
885
+ this._draggable = false;
886
+ this.config = container._config;
887
+ // Assign an initial value based on the `draggable` property of the `CuteDialogConfig` object.
888
+ // User can override this value by setting his/her value to the `draggable` input property
889
+ this.draggable = !!this.config.draggable;
890
+ }
891
+ getCursorStyle() {
892
+ if (this.draggable && !this.container.isFullScreenDialog()) {
893
+ return this.isMouseDown ? 'grabbing' : 'move'; //'grab';
894
+ }
895
+ return "default";
896
+ }
897
+ onMouseDown(event) {
898
+ this.isMouseDown = true;
899
+ }
900
+ onMouseUp(event) {
901
+ this.isMouseDown = false;
902
+ }
903
+ ngOnInit() {
904
+ if (this.cdkDragEl && typeof (this.config.draggable) == "string") {
905
+ // Drag constraints: x-axis | y-axis
906
+ this.cdkDragEl.lockAxis = (this.config.draggable.charAt(0));
907
+ }
908
+ }
909
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteDialogHeader, deps: [{ token: CuteDialogContainer }], target: i0.ɵɵFactoryTarget.Component }); }
910
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "20.3.15", type: CuteDialogHeader, isStandalone: true, selector: "cute-dialog-header", inputs: { draggable: ["draggable", "draggable", booleanAttribute] }, host: { listeners: { "mousedown": "onMouseDown($event)", "mouseup": "onMouseUp($event)" }, classAttribute: "cute-dialog-header" }, viewQueries: [{ propertyName: "cdkDragEl", first: true, predicate: ["header"], descendants: true, read: CdkDrag, static: true }], exportAs: ["cuteDialogHeader"], ngImport: i0, template: `
911
+ <div #header
912
+ class="modal-header"
913
+ role="heading"
914
+ cdkDrag
915
+ cdkDragRootElement=".cdk-overlay-pane"
916
+ [cdkDragDisabled]="!draggable || container.isFullScreenDialog()"
917
+ [style.cursor]="getCursorStyle()"
918
+ >
919
+ <ng-content select="[cute-dialog-title], [cuteDialogTitle]"></ng-content>
920
+ <ng-content></ng-content>
921
+ <button cuteButton="close-button" tabindex="-1" color="light" magnitude="smaller" cute-dialog-close></button>
922
+ </div>
923
+ <!-- cdkDragHandle-->
924
+ `, isInline: true, dependencies: [{ kind: "component", type: CuteButton, selector: "button[cuteButton], button[cute-button], a[cuteButton], a[cute-button], ", exportAs: ["cuteButton"] }, { kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: CuteDialogClose, selector: "[cute-dialog-close], [cuteDialogClose]", inputs: ["aria-label", "type", "cute-dialog-close", "cuteDialogClose"], exportAs: ["cuteDialogClose"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
925
+ }
926
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteDialogHeader, decorators: [{
927
+ type: Component,
928
+ args: [{
929
+ selector: 'cute-dialog-header',
930
+ exportAs: 'cuteDialogHeader',
931
+ template: `
932
+ <div #header
933
+ class="modal-header"
934
+ role="heading"
935
+ cdkDrag
936
+ cdkDragRootElement=".cdk-overlay-pane"
937
+ [cdkDragDisabled]="!draggable || container.isFullScreenDialog()"
938
+ [style.cursor]="getCursorStyle()"
939
+ >
940
+ <ng-content select="[cute-dialog-title], [cuteDialogTitle]"></ng-content>
941
+ <ng-content></ng-content>
942
+ <button cuteButton="close-button" tabindex="-1" color="light" magnitude="smaller" cute-dialog-close></button>
943
+ </div>
944
+ <!-- cdkDragHandle-->
945
+ `,
946
+ host: {
947
+ 'class': 'cute-dialog-header',
948
+ },
949
+ encapsulation: ViewEncapsulation.None,
950
+ changeDetection: ChangeDetectionStrategy.OnPush,
951
+ imports: [
952
+ CuteButton,
953
+ CdkDrag,
954
+ CuteDialogClose
955
+ ]
956
+ }]
957
+ }], ctorParameters: () => [{ type: CuteDialogContainer }], propDecorators: { cdkDragEl: [{
958
+ type: ViewChild,
959
+ args: ['header', { read: CdkDrag, static: true }]
960
+ }], draggable: [{
961
+ type: Input,
962
+ args: [{ transform: booleanAttribute }]
963
+ }], onMouseDown: [{
964
+ type: HostListener,
965
+ args: ["mousedown", ["$event"]]
966
+ }], onMouseUp: [{
967
+ type: HostListener,
968
+ args: ["mouseup", ["$event"]]
969
+ }] } });
970
+
971
+ /**
972
+ * @license Apache-2.0
973
+ *
974
+ * Copyright (c) 2025 CuteWidgets Team. All Rights Reserved.
975
+ *
976
+ * You may not use this file except in compliance with the License
977
+ * that can be found at http://www.apache.org/licenses/LICENSE-2.0
978
+ */
979
+ class CuteDialogTitle {
980
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteDialogTitle, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
981
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.15", type: CuteDialogTitle, isStandalone: true, selector: "[cute-dialog-title], [cuteDialogTitle]", inputs: { id: "id" }, host: { properties: { "id": "id || null", "style.pointer-events": "\"none\"" }, classAttribute: "cute-dialog-title modal-title user-select-none" }, exportAs: ["cuteDialogTitle"], ngImport: i0 }); }
982
+ }
983
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteDialogTitle, decorators: [{
984
+ type: Directive,
985
+ args: [{
986
+ selector: '[cute-dialog-title], [cuteDialogTitle]',
987
+ exportAs: 'cuteDialogTitle',
988
+ host: {
989
+ 'class': 'cute-dialog-title modal-title user-select-none',
990
+ '[id]': 'id || null',
991
+ '[style.pointer-events]': '"none"',
992
+ },
993
+ standalone: true,
994
+ }]
995
+ }], propDecorators: { id: [{
996
+ type: Input
997
+ }] } });
998
+
999
+ /**
1000
+ * @license Apache-2.0
1001
+ *
1002
+ * Copyright (c) 2025 CuteWidgets Team. All Rights Reserved.
1003
+ *
1004
+ * You may not use this file except in compliance with the License
1005
+ * that can be found at http://www.apache.org/licenses/LICENSE-2.0
1006
+ */
1007
+ const TYPES = [
1008
+ CuteDialogBody,
1009
+ CuteDialogClose,
1010
+ CuteDialogFooter,
1011
+ CuteDialogHeader,
1012
+ CuteDialogTitle,
1013
+ CuteDialogContainer,
1014
+ ];
1015
+ class CuteDialogModule {
1016
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1017
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.15", ngImport: i0, type: CuteDialogModule, imports: [CommonModule, CuteDialogBody,
1018
+ CuteDialogClose,
1019
+ CuteDialogFooter,
1020
+ CuteDialogHeader,
1021
+ CuteDialogTitle,
1022
+ CuteDialogContainer], exports: [CuteDialogBody,
1023
+ CuteDialogClose,
1024
+ CuteDialogFooter,
1025
+ CuteDialogHeader,
1026
+ CuteDialogTitle,
1027
+ CuteDialogContainer] }); }
1028
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteDialogModule, providers: [CuteDialog], imports: [CommonModule, CuteDialogHeader,
1029
+ CuteDialogContainer] }); }
1030
+ }
1031
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteDialogModule, decorators: [{
1032
+ type: NgModule,
1033
+ args: [{
1034
+ imports: [CommonModule, ...TYPES],
1035
+ exports: TYPES,
1036
+ declarations: [],
1037
+ providers: [CuteDialog],
1038
+ }]
1039
+ }] });
1040
+
1041
+ /**
1042
+ * Generated bundle index. Do not edit.
1043
+ */
1044
+
1045
+ export { CUTE_DIALOG_DATA, CUTE_DIALOG_DEFAULT_OPTIONS, CUTE_DIALOG_SCROLL_STRATEGY, CuteDialog, CuteDialogBody, CuteDialogClose, CuteDialogConfig, CuteDialogContainer, CuteDialogFooter, CuteDialogHeader, CuteDialogModule, CuteDialogRef, CuteDialogState, CuteDialogTitle, _closeDialogVia };
1046
+ //# sourceMappingURL=cute-widgets-base-dialog.mjs.map