@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,897 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, ChangeDetectionStrategy, ViewEncapsulation, Component, Directive, inject, NgZone, ElementRef, ChangeDetectorRef, DOCUMENT, Injector, signal, afterNextRender, isDevMode, ViewChild, DestroyRef, TemplateRef, Injectable, NgModule } from '@angular/core';
3
+ import { CuteButton } from '@cute-widgets/base/button';
4
+ import { Subject, of } from 'rxjs';
5
+ import { CuteLayoutControl, CuteBaseControl } from '@cute-widgets/base/abstract';
6
+ import { BasePortalOutlet, CdkPortalOutlet, ComponentPortal, TemplatePortal } from '@angular/cdk/portal';
7
+ import { Platform } from '@angular/cdk/platform';
8
+ import { CuteThemeService, toTextBgCssClass } from '@cute-widgets/base/core';
9
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
10
+ import { _animationsDisabled } from '@cute-widgets/base/core/animation';
11
+ import { LiveAnnouncer } from '@angular/cdk/a11y';
12
+ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
13
+ import { Overlay, OverlayConfig } from '@angular/cdk/overlay';
14
+ import { takeUntil } from 'rxjs/operators';
15
+ import { CommonModule } from '@angular/common';
16
+
17
+ /** Maximum number of milliseconds that can be passed into setTimeout. */
18
+ const MAX_TIMEOUT = Math.pow(2, 31) - 1;
19
+ /**
20
+ * Reference to a snack bar dispatched from the snack bar service.
21
+ */
22
+ class CuteSnackBarRef {
23
+ constructor(containerInstance, _overlayRef) {
24
+ this._overlayRef = _overlayRef;
25
+ /** Subject for notifying the user that the snack bar has been dismissed. */
26
+ this._afterDismissed = new Subject();
27
+ /** Subject for notifying the user that the snack bar has opened and appeared. */
28
+ this._afterOpened = new Subject();
29
+ /** Subject for notifying the user that the snack bar action was called. */
30
+ this._onAction = new Subject();
31
+ /** Whether the snack bar was dismissed using the action button. */
32
+ this._dismissedByAction = false;
33
+ this.containerInstance = containerInstance;
34
+ containerInstance._onExit.subscribe(() => this._finishDismiss());
35
+ }
36
+ /** Dismisses the snack bar. */
37
+ dismiss() {
38
+ if (!this._afterDismissed.closed) {
39
+ this.containerInstance.exit();
40
+ }
41
+ clearTimeout(this._durationTimeoutId);
42
+ }
43
+ /** Marks the snackbar action clicked. */
44
+ dismissWithAction() {
45
+ if (!this._onAction.closed) {
46
+ this._dismissedByAction = true;
47
+ this._onAction.next();
48
+ this._onAction.complete();
49
+ this.dismiss();
50
+ }
51
+ clearTimeout(this._durationTimeoutId);
52
+ }
53
+ /** Dismisses the snack bar after some duration */
54
+ _dismissAfter(duration) {
55
+ // Note that we need to cap the duration to the maximum value for setTimeout, because
56
+ // it'll revert to 1 if somebody passes in something greater (e.g. `Infinity`). See #17234.
57
+ this._durationTimeoutId = setTimeout(() => this.dismiss(), Math.min(duration, MAX_TIMEOUT));
58
+ }
59
+ /** Marks the snackbar as opened */
60
+ _open() {
61
+ if (!this._afterOpened.closed) {
62
+ this._afterOpened.next();
63
+ this._afterOpened.complete();
64
+ }
65
+ }
66
+ /** Cleans up the DOM after closing. */
67
+ _finishDismiss() {
68
+ this._overlayRef.dispose();
69
+ if (!this._onAction.closed) {
70
+ this._onAction.complete();
71
+ }
72
+ this._afterDismissed.next({ dismissedByAction: this._dismissedByAction });
73
+ this._afterDismissed.complete();
74
+ this._dismissedByAction = false;
75
+ }
76
+ /** Gets an observable notified when the snack bar is finished closing. */
77
+ afterDismissed() {
78
+ return this._afterDismissed;
79
+ }
80
+ /** Gets an observable notified when the snack bar has opened and appeared. */
81
+ afterOpened() {
82
+ return this.containerInstance._onEnter;
83
+ }
84
+ /** Gets an observable notified when the snack bar action is called. */
85
+ onAction() {
86
+ return this._onAction;
87
+ }
88
+ }
89
+
90
+ /**
91
+ * @license Apache-2.0
92
+ *
93
+ * Copyright (c) 2025 CuteWidgets Team. All Rights Reserved.
94
+ *
95
+ * You may not use this file except in compliance with the License
96
+ * that can be found at http://www.apache.org/licenses/LICENSE-2.0
97
+ *
98
+ * This code is a modification of the `@angular/material` original
99
+ * code licensed under MIT-style License (https://angular.dev/license).
100
+ */
101
+ /** Injection token that can be used to access the data that was passed in to a snack bar. */
102
+ const CUTE_SNACK_BAR_DATA = new InjectionToken('CuteSnackBarData');
103
+ /**
104
+ * Configuration used when opening a snack-bar.
105
+ */
106
+ class CuteSnackBarConfig {
107
+ constructor() {
108
+ /** The politeness level for the LiveAnnouncer announcement. */
109
+ this.politeness = 'assertive';
110
+ /**
111
+ * Message to be announced by the LiveAnnouncer. When opening a snackbar without a custom
112
+ * component or template, the announcement message will default to the specified message.
113
+ */
114
+ this.announcementMessage = '';
115
+ /** The length of time in milliseconds to wait before automatically dismissing the snack bar. */
116
+ this.duration = 0;
117
+ /** Data being injected into the child component. */
118
+ this.data = null;
119
+ /** The horizontal position to place the snack bar. */
120
+ this.horizontalPosition = 'center';
121
+ /** The vertical position to place the snack bar. */
122
+ this.verticalPosition = 'bottom';
123
+ }
124
+ }
125
+
126
+ /**
127
+ * @license Apache-2.0
128
+ *
129
+ * Copyright (c) 2025 CuteWidgets Team. All Rights Reserved.
130
+ *
131
+ * You may not use this file except in compliance with the License
132
+ * that can be found at http://www.apache.org/licenses/LICENSE-2.0
133
+ *
134
+ * This code is a modification of the `@angular/material` original
135
+ * code licensed under MIT-style License (https://angular.dev/license).
136
+ */
137
+ /** Directive that should be applied to the element containing the snack bar's header elements. */
138
+ class CuteSnackBarHeader {
139
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSnackBarHeader, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
140
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: CuteSnackBarHeader, isStandalone: true, selector: "cute-snack-bar-header", host: { classAttribute: "cute-snack-bar-header toast-header" }, ngImport: i0, template: `
141
+ <ng-content></ng-content>
142
+ `, isInline: true, styles: [".cute-snack-bar-header{display:flex}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
143
+ }
144
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSnackBarHeader, decorators: [{
145
+ type: Component,
146
+ args: [{ selector: 'cute-snack-bar-header', template: `
147
+ <ng-content></ng-content>
148
+ `, host: {
149
+ 'class': 'cute-snack-bar-header toast-header',
150
+ }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".cute-snack-bar-header{display:flex}\n"] }]
151
+ }] });
152
+ /** Directive that should be applied to the element containing the snack bar's body elements. */
153
+ class CuteSnackBarBody {
154
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSnackBarBody, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
155
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.15", type: CuteSnackBarBody, isStandalone: true, selector: "[cuteSnackBarBody]", host: { classAttribute: "cute-snack-bar-body toast-body user-select-none" }, ngImport: i0 }); }
156
+ }
157
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSnackBarBody, decorators: [{
158
+ type: Directive,
159
+ args: [{
160
+ selector: `[cuteSnackBarBody]`,
161
+ host: {
162
+ 'class': 'cute-snack-bar-body toast-body user-select-none',
163
+ },
164
+ }]
165
+ }] });
166
+ /** Directive that should be applied to the text element to be rendered in the snack bar. */
167
+ class CuteSnackBarLabel {
168
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSnackBarLabel, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
169
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.15", type: CuteSnackBarLabel, isStandalone: true, selector: "[cuteSnackBarLabel]", host: { classAttribute: "cute-snack-bar-label" }, ngImport: i0 }); }
170
+ }
171
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSnackBarLabel, decorators: [{
172
+ type: Directive,
173
+ args: [{
174
+ selector: `[cuteSnackBarLabel]`,
175
+ host: {
176
+ 'class': 'cute-snack-bar-label',
177
+ },
178
+ }]
179
+ }] });
180
+ /** Directive that should be applied to the element containing the snack bar's action buttons. */
181
+ class CuteSnackBarActions {
182
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSnackBarActions, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
183
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.15", type: CuteSnackBarActions, isStandalone: true, selector: "[cuteSnackBarActions]", host: { classAttribute: "cute-snack-bar-actions" }, ngImport: i0 }); }
184
+ }
185
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSnackBarActions, decorators: [{
186
+ type: Directive,
187
+ args: [{
188
+ selector: `[cuteSnackBarActions]`,
189
+ host: {
190
+ 'class': 'cute-snack-bar-actions',
191
+ },
192
+ }]
193
+ }] });
194
+ /** Directive that should be applied to each of the snack bar's action buttons. */
195
+ class CuteSnackBarAction {
196
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSnackBarAction, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
197
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.15", type: CuteSnackBarAction, isStandalone: true, selector: "[cuteSnackBarAction]", host: { classAttribute: "cute-snack-bar-action" }, ngImport: i0 }); }
198
+ }
199
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSnackBarAction, decorators: [{
200
+ type: Directive,
201
+ args: [{
202
+ selector: `[cuteSnackBarAction]`,
203
+ host: {
204
+ 'class': 'cute-snack-bar-action',
205
+ },
206
+ }]
207
+ }] });
208
+
209
+ /**
210
+ * @license Apache-2.0
211
+ *
212
+ * Copyright (c) 2025 CuteWidgets Team. All Rights Reserved.
213
+ *
214
+ * You may not use this file except in compliance with the License
215
+ * that can be found at http://www.apache.org/licenses/LICENSE-2.0
216
+ *
217
+ * This code is a modification of the `@angular/material` original
218
+ * code licensed under MIT-style License (https://angular.dev/license).
219
+ */
220
+ let uniqueID = 0;
221
+ class SimpleSnackBar extends CuteLayoutControl {
222
+ constructor() {
223
+ super();
224
+ this.snackBarRef = inject(CuteSnackBarRef);
225
+ this.data = inject(CUTE_SNACK_BAR_DATA);
226
+ this.config = this.snackBarRef.containerInstance.snackBarConfig;
227
+ }
228
+ generateId() {
229
+ return `cute-simple-snack-bar-${uniqueID++}`;
230
+ }
231
+ /** Performs the action on the snack bar. */
232
+ action() {
233
+ this.snackBarRef.dismissWithAction();
234
+ }
235
+ /** If the action button should be shown. */
236
+ get hasAction() {
237
+ return !!this.data.action;
238
+ }
239
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: SimpleSnackBar, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
240
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: SimpleSnackBar, isStandalone: true, selector: "simple-snack-bar", host: { properties: { "attr.id": "id || null" }, classAttribute: "cute-simple-snack-bar" }, exportAs: ["cuteSnackBar"], usesInheritance: true, ngImport: i0, template: "<div cuteSnackBarBody>\r\n <div cuteSnackBarLabel>\r\n {{data.message}}\r\n </div>\r\n</div>\r\n\r\n<div class=\"cute-simple-snack-bar__buttons\">\r\n @if (hasAction) {\r\n <div cuteSnackBarActions>\r\n <button cuteSnackBarAction\r\n cuteButton=\"flat-button\"\r\n [color]=\"color ? color : 'secondary'\"\r\n magnitude=\"small\"\r\n (click)=\"action()\">\r\n {{data.action}}\r\n </button>\r\n </div>\r\n }\r\n @if (config.dismissible) {\r\n <button cuteSnackBarAction\r\n cuteButton=\"close-button\"\r\n magnitude=\"smaller\"\r\n aria-label=\"Close\"\r\n (click)=\"snackBarRef.dismiss()\">\r\n </button>\r\n<!-- i18n-aria-label=\"@@SnackBar.Close\"-->\r\n }\r\n</div>\r\n", styles: [".cute-simple-snack-bar{display:flex;position:relative;align-items:center;justify-content:space-between}.cute-simple-snack-bar .cute-simple-snack-bar__buttons{display:flex;align-items:center;gap:4px;margin-right:var(--bs-toast-padding-x)}\n"], dependencies: [{ kind: "component", type: CuteButton, selector: "button[cuteButton], button[cute-button], a[cuteButton], a[cute-button], ", exportAs: ["cuteButton"] }, { kind: "directive", type: CuteSnackBarLabel, selector: "[cuteSnackBarLabel]" }, { kind: "directive", type: CuteSnackBarActions, selector: "[cuteSnackBarActions]" }, { kind: "directive", type: CuteSnackBarAction, selector: "[cuteSnackBarAction]" }, { kind: "directive", type: CuteSnackBarBody, selector: "[cuteSnackBarBody]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
241
+ }
242
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: SimpleSnackBar, decorators: [{
243
+ type: Component,
244
+ args: [{ selector: 'simple-snack-bar', exportAs: 'cuteSnackBar', host: {
245
+ 'class': 'cute-simple-snack-bar',
246
+ '[attr.id]': 'id || null',
247
+ }, imports: [CuteButton, CuteSnackBarLabel, CuteSnackBarActions, CuteSnackBarAction, CuteSnackBarBody], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div cuteSnackBarBody>\r\n <div cuteSnackBarLabel>\r\n {{data.message}}\r\n </div>\r\n</div>\r\n\r\n<div class=\"cute-simple-snack-bar__buttons\">\r\n @if (hasAction) {\r\n <div cuteSnackBarActions>\r\n <button cuteSnackBarAction\r\n cuteButton=\"flat-button\"\r\n [color]=\"color ? color : 'secondary'\"\r\n magnitude=\"small\"\r\n (click)=\"action()\">\r\n {{data.action}}\r\n </button>\r\n </div>\r\n }\r\n @if (config.dismissible) {\r\n <button cuteSnackBarAction\r\n cuteButton=\"close-button\"\r\n magnitude=\"smaller\"\r\n aria-label=\"Close\"\r\n (click)=\"snackBarRef.dismiss()\">\r\n </button>\r\n<!-- i18n-aria-label=\"@@SnackBar.Close\"-->\r\n }\r\n</div>\r\n", styles: [".cute-simple-snack-bar{display:flex;position:relative;align-items:center;justify-content:space-between}.cute-simple-snack-bar .cute-simple-snack-bar__buttons{display:flex;align-items:center;gap:4px;margin-right:var(--bs-toast-padding-x)}\n"] }]
248
+ }], ctorParameters: () => [] });
249
+
250
+ /**
251
+ * @license Apache-2.0
252
+ *
253
+ * Copyright (c) 2025 CuteWidgets Team. All Rights Reserved.
254
+ *
255
+ * You may not use this file except in compliance with the License
256
+ * that can be found at http://www.apache.org/licenses/LICENSE-2.0
257
+ *
258
+ * This code is a modification of the `@angular/material` original
259
+ * code licensed under MIT-style License (https://angular.dev/license).
260
+ */
261
+ const ENTER_ANIMATION = '_cute-snack-bar-enter';
262
+ const EXIT_ANIMATION = '_cute-snack-bar-exit';
263
+ let uniqueId = 0;
264
+ /**
265
+ * Internal component that wraps user-provided snack bar content.
266
+ */
267
+ class CuteSnackBarContainer extends BasePortalOutlet {
268
+ constructor() {
269
+ super();
270
+ this._ngZone = inject(NgZone);
271
+ this._elementRef = inject(ElementRef);
272
+ this._changeDetectorRef = inject(ChangeDetectorRef);
273
+ this._platform = inject(Platform);
274
+ this._animationsDisabled = _animationsDisabled();
275
+ this.snackBarConfig = inject(CuteSnackBarConfig);
276
+ this._document = inject(DOCUMENT);
277
+ this._themeService = inject(CuteThemeService);
278
+ this._trackedModals = new Set();
279
+ this._injector = inject(Injector);
280
+ /** The number of milliseconds to wait before announcing the snack bar's content. */
281
+ this._announceDelay = 150;
282
+ /** The timeout for announcing the snack bar's content. */
283
+ this._announceTimeoutId = 0;
284
+ /** Whether the component has been destroyed. */
285
+ this._destroyed = false;
286
+ /** Subject for notifying that the snack bar has announced to screen readers. */
287
+ this._onAnnounce = new Subject();
288
+ /** Subject for notifying that the snack bar has exited from view. */
289
+ this._onExit = new Subject();
290
+ /** Subject for notifying that the snack bar has finished entering the view. */
291
+ this._onEnter = new Subject();
292
+ /** The state of the snack bar animations. */
293
+ this._animationState = 'void';
294
+ /** Unique ID of the aria-live element. */
295
+ this._liveElementId = `cute-snack-bar-container-live-${uniqueId++}`;
296
+ /**
297
+ * Attaches a DOM portal to the snack bar container.
298
+ * @deprecated To be turned into a method.
299
+ * @breaking-change 10.0.0
300
+ */
301
+ this.attachDomPortal = (portal) => {
302
+ this._assertNotAttached();
303
+ const result = this._portalOutlet.attachDomPortal(portal);
304
+ this._afterPortalAttached();
305
+ return result;
306
+ };
307
+ const config = this.snackBarConfig;
308
+ // Use aria-live rather than a live role like 'alert' or 'status'
309
+ // because NVDA and JAWS have show inconsistent behavior with live roles.
310
+ if (config.politeness === 'assertive' && !config.announcementMessage) {
311
+ this._live = 'assertive';
312
+ }
313
+ else if (config.politeness === 'off') {
314
+ this._live = 'off';
315
+ }
316
+ else {
317
+ this._live = 'polite';
318
+ }
319
+ // Only set a role for Firefox. Set role based on aria-live because setting role="alert" implies
320
+ // aria-live="assertive" which may cause issues if aria-live is set to "polite" above.
321
+ if (this._platform.FIREFOX) {
322
+ if (this._live === 'polite') {
323
+ this._role = 'status';
324
+ }
325
+ if (this._live === 'assertive') {
326
+ this._role = 'alert';
327
+ }
328
+ }
329
+ this.isLightTheme = signal(this._themeService.isLightTheme(), ...(ngDevMode ? [{ debugName: "isLightTheme" }] : []));
330
+ this._themeService.change
331
+ .pipe(takeUntilDestroyed())
332
+ .subscribe(event => {
333
+ this.isLightTheme.set(!event.matches);
334
+ });
335
+ }
336
+ /** Attach a component portal as content to this snack bar container. */
337
+ attachComponentPortal(portal) {
338
+ this._assertNotAttached();
339
+ const result = this._portalOutlet.attachComponentPortal(portal);
340
+ this._afterPortalAttached();
341
+ return result;
342
+ }
343
+ /** Attach a template portal as content to this snack bar container. */
344
+ attachTemplatePortal(portal) {
345
+ this._assertNotAttached();
346
+ const result = this._portalOutlet.attachTemplatePortal(portal);
347
+ this._afterPortalAttached();
348
+ return result;
349
+ }
350
+ /** Handle end of animations, updating the state of the snackbar. */
351
+ onAnimationEnd(animationName) {
352
+ if (animationName === EXIT_ANIMATION) {
353
+ this._completeExit();
354
+ }
355
+ else if (animationName === ENTER_ANIMATION) {
356
+ clearTimeout(this._enterFallback);
357
+ this._ngZone.run(() => {
358
+ this._onEnter.next();
359
+ this._onEnter.complete();
360
+ });
361
+ }
362
+ }
363
+ /** Begin animation of snack bar entrance into view. */
364
+ enter() {
365
+ if (!this._destroyed) {
366
+ this._animationState = 'visible';
367
+ // _animationState lives in host bindings and `detectChanges` does not refresh host bindings
368
+ // so we have to call `markForCheck` to ensure the host view is refreshed eventually.
369
+ this._changeDetectorRef.markForCheck();
370
+ this._changeDetectorRef.detectChanges();
371
+ this._screenReaderAnnounce();
372
+ if (this._animationsDisabled) {
373
+ afterNextRender(() => {
374
+ this._ngZone.run(() => queueMicrotask(() => this.onAnimationEnd(ENTER_ANIMATION)));
375
+ }, { injector: this._injector });
376
+ }
377
+ else {
378
+ clearTimeout(this._enterFallback);
379
+ this._enterFallback = setTimeout(() => {
380
+ // The snack bar will stay invisible if it fails to animate. Add a fallback class so it
381
+ // becomes visible. This can happen in some apps that do `* {animation: none !important}`.
382
+ this._elementRef.nativeElement.classList.add('mat-snack-bar-fallback-visible');
383
+ this.onAnimationEnd(ENTER_ANIMATION);
384
+ }, 200);
385
+ }
386
+ }
387
+ }
388
+ /** Begin animation of the snack bar exiting from view. */
389
+ exit() {
390
+ if (this._destroyed) {
391
+ return of(undefined);
392
+ }
393
+ // It's common for snack bars to be opened by random outside calls like HTTP requests or
394
+ // errors. Run inside the NgZone to ensure that it functions correctly.
395
+ this._ngZone.run(() => {
396
+ // Note: this one transitions to `hidden`, rather than `void`, in order to handle the case
397
+ // where multiple snack bars are opened in quick succession (e.g., two consecutive calls to
398
+ // `CuteSnackBar.open`).
399
+ this._animationState = 'hidden';
400
+ this._changeDetectorRef.markForCheck();
401
+ // Mark this element with an 'exit' attribute to indicate that the snackbar has
402
+ // been dismissed and will soon be removed from the DOM. This is used by the snackbar
403
+ // test harness.
404
+ this._elementRef.nativeElement.setAttribute('cute-exit', '');
405
+ // If the snack bar hasn't been announced by the time it exits, it wouldn't have been open
406
+ // long enough to visually read it too, so clear the timeout for announcing.
407
+ clearTimeout(this._announceTimeoutId);
408
+ if (this._animationsDisabled) {
409
+ afterNextRender(() => {
410
+ this._ngZone.run(() => queueMicrotask(() => this.onAnimationEnd(EXIT_ANIMATION)));
411
+ }, { injector: this._injector });
412
+ }
413
+ else {
414
+ clearTimeout(this._exitFallback);
415
+ this._exitFallback = setTimeout(() => this.onAnimationEnd(EXIT_ANIMATION), 200);
416
+ }
417
+ });
418
+ return this._onExit;
419
+ }
420
+ /** Makes sure the exit callbacks have been invoked when the element is destroyed. */
421
+ ngOnDestroy() {
422
+ this._destroyed = true;
423
+ this._clearFromModals();
424
+ this._completeExit();
425
+ }
426
+ /**
427
+ * Removes the element in a microtask. Helps prevent errors where we end up
428
+ * removing an element which is in the middle of an animation.
429
+ */
430
+ _completeExit() {
431
+ clearTimeout(this._exitFallback);
432
+ queueMicrotask(() => {
433
+ this._onExit.next();
434
+ this._onExit.complete();
435
+ });
436
+ }
437
+ /**
438
+ * Called after the portal contents have been attached. Can be
439
+ * used to modify the DOM once it's guaranteed to be in place.
440
+ */
441
+ _afterPortalAttached() {
442
+ const element = this._elementRef.nativeElement;
443
+ const panelClasses = this.snackBarConfig.panelClass;
444
+ if (panelClasses) {
445
+ if (Array.isArray(panelClasses)) {
446
+ // Note that we can't use a spread here, because IE doesn't support multiple arguments.
447
+ panelClasses.forEach(cssClass => element.classList.add(cssClass));
448
+ }
449
+ else {
450
+ element.classList.add(panelClasses);
451
+ }
452
+ }
453
+ this._exposeToModals();
454
+ // Check to see if the attached component or template uses the MDC template structure,
455
+ // specifically the MDC label. If not, the container should apply the MDC label class to this
456
+ // component's label container, which will apply MDC's label styles to the attached view.
457
+ // if (this._label) {
458
+ // const label = this._label.nativeElement;
459
+ // const labelClass = 'cute-snackbar__label';
460
+ // label.classList.toggle(labelClass, !label.querySelector(`.${labelClass}`));
461
+ // }
462
+ }
463
+ /**
464
+ * Some browsers won't expose the accessibility node of the live element if there is an
465
+ * `aria-modal` and the live element is outside of it. This method works around the issue by
466
+ * pointing the `aria-owns` of all modals to the live element.
467
+ */
468
+ _exposeToModals() {
469
+ // TODO(http://github.com/angular/components/issues/26853): consider de-duplicating this with the
470
+ // `LiveAnnouncer` and any other usages.
471
+ //
472
+ // Note that the selector here is limited to CDK overlays at the moment in order to reduce the
473
+ // section of the DOM we need to look through. This should cover all the cases we support, but
474
+ // the selector can be expanded if it turns out to be too narrow.
475
+ const id = this._liveElementId;
476
+ const modals = this._document.querySelectorAll('body > .cdk-overlay-container [aria-modal="true"]');
477
+ for (let i = 0; i < modals.length; i++) {
478
+ const modal = modals[i];
479
+ const ariaOwns = modal.getAttribute('aria-owns');
480
+ this._trackedModals.add(modal);
481
+ if (!ariaOwns) {
482
+ modal.setAttribute('aria-owns', id);
483
+ }
484
+ else if (ariaOwns.indexOf(id) === -1) {
485
+ modal.setAttribute('aria-owns', ariaOwns + ' ' + id);
486
+ }
487
+ }
488
+ }
489
+ /** Clears the references to the live element from any modals it was added to. */
490
+ _clearFromModals() {
491
+ this._trackedModals.forEach(modal => {
492
+ const ariaOwns = modal.getAttribute('aria-owns');
493
+ if (ariaOwns) {
494
+ const newValue = ariaOwns.replace(this._liveElementId, '').trim();
495
+ if (newValue.length > 0) {
496
+ modal.setAttribute('aria-owns', newValue);
497
+ }
498
+ else {
499
+ modal.removeAttribute('aria-owns');
500
+ }
501
+ }
502
+ });
503
+ this._trackedModals.clear();
504
+ }
505
+ /** Asserts that no content is already attached to the container. */
506
+ _assertNotAttached() {
507
+ if (this._portalOutlet.hasAttached() && isDevMode()) {
508
+ throw Error('Attempting to attach snack bar content after content is already attached');
509
+ }
510
+ }
511
+ /**
512
+ * Starts a timeout to move the snack bar content to the live region so screen readers will
513
+ * announce it.
514
+ */
515
+ _screenReaderAnnounce() {
516
+ if (this._announceTimeoutId) {
517
+ return;
518
+ }
519
+ this._ngZone.runOutsideAngular(() => {
520
+ this._announceTimeoutId = setTimeout(() => {
521
+ if (this._destroyed) {
522
+ return;
523
+ }
524
+ const element = this._elementRef.nativeElement;
525
+ const inertElement = element.querySelector('[aria-hidden]');
526
+ const liveElement = element.querySelector('[aria-live]');
527
+ if (inertElement && liveElement) {
528
+ // If an element in the snack bar content is focused before being moved
529
+ // track it and restore focus after moving to the live region.
530
+ let focusedElement = null;
531
+ if (this._platform.isBrowser &&
532
+ document.activeElement instanceof HTMLElement &&
533
+ inertElement.contains(document.activeElement)) {
534
+ focusedElement = document.activeElement;
535
+ }
536
+ inertElement.removeAttribute('aria-hidden');
537
+ liveElement.appendChild(inertElement);
538
+ focusedElement?.focus();
539
+ this._onAnnounce.next();
540
+ this._onAnnounce.complete();
541
+ }
542
+ }, this._announceDelay);
543
+ });
544
+ }
545
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSnackBarContainer, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
546
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: CuteSnackBarContainer, isStandalone: true, selector: "cute-snack-bar-container", host: { listeners: { "animationend": "onAnimationEnd($event.animationName)", "animationcancel": "onAnimationEnd($event.animationName)" }, properties: { "attr.data-bs-theme": "isLightTheme() ? \"dark\" : \"light\"", "class.cute-snack-bar-container-enter": "_animationState === \"visible\"", "class.cute-snack-bar-container-exit": "_animationState === \"hidden\"", "class.cute-snack-bar-container-animations-enabled": "!_animationsDisabled" }, classAttribute: "cute-snack-bar-container toast-container" }, viewQueries: [{ propertyName: "_portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true, static: true }, { propertyName: "_label", first: true, predicate: ["label"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<!--\r\n This outer label wrapper will have the class `mdc-snackbar__label` applied if\r\n the attached template/component does not contain it.\r\n -->\r\n<!--<div class=\"cute-snack-bar-label\" #label>-->\r\n <!-- Initially holds the snack bar content, will be empty after announcing to screen readers. -->\r\n <div aria-hidden=\"true\">\r\n <ng-template cdkPortalOutlet />\r\n </div>\r\n\r\n <!-- Will receive the snack bar content from the non-live div, move will happen a short delay after opening -->\r\n <div\r\n [attr.aria-live]=\"_live\"\r\n [attr.role]=\"_role\"\r\n [attr.id]=\"_liveElementId\">\r\n </div>\r\n<!--</div>-->\r\n", styles: ["cute-snack-bar-container.toast-container{position:relative;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0);margin:.5rem}.cute-snack-bar-handset cute-snack-bar-container.toast-container{width:100vw}cute-snack-bar-container.toast-container .toast{--bs-toast-color: var(--bs-body-color);--bs-toast-bg: rgba(var(--bs-body-bg-rgb), .95)}cute-snack-bar-container.toast-container .toast:has(.toast-header){flex-direction:column;align-items:normal}.cute-snack-bar-body{display:flex;flex-direction:column}.cute-snack-bar-actions{display:flex;flex-shrink:0;align-items:center;box-sizing:border-box}.cute-snack-bar-container-animations-enabled{opacity:0}.cute-snack-bar-container-animations-enabled.cute-snack-bar-fallback-visible{opacity:1}.cute-snack-bar-container-animations-enabled.cute-snack-bar-container-enter{animation:_cute-snack-bar-enter .15s cubic-bezier(0,0,.2,1) forwards}.cute-snack-bar-container-animations-enabled.cute-snack-bar-container-exit{animation:_cute-snack-bar-exit 75ms cubic-bezier(.4,0,1,1) forwards}@keyframes _cute-snack-bar-enter{0%{transform:scale(.8);opacity:0}to{transform:scale(1);opacity:.95}}@keyframes _cute-snack-bar-exit{0%{opacity:.95}to{opacity:0}}\n"], dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None }); }
547
+ }
548
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSnackBarContainer, decorators: [{
549
+ type: Component,
550
+ args: [{ selector: 'cute-snack-bar-container', changeDetection: ChangeDetectionStrategy.Default, encapsulation: ViewEncapsulation.None, imports: [CdkPortalOutlet], host: {
551
+ 'class': 'cute-snack-bar-container toast-container',
552
+ '[attr.data-bs-theme]': 'isLightTheme() ? "dark" : "light"',
553
+ '[class.cute-snack-bar-container-enter]': '_animationState === "visible"',
554
+ '[class.cute-snack-bar-container-exit]': '_animationState === "hidden"',
555
+ '[class.cute-snack-bar-container-animations-enabled]': '!_animationsDisabled',
556
+ '(animationend)': 'onAnimationEnd($event.animationName)',
557
+ '(animationcancel)': 'onAnimationEnd($event.animationName)',
558
+ }, template: "<!--\r\n This outer label wrapper will have the class `mdc-snackbar__label` applied if\r\n the attached template/component does not contain it.\r\n -->\r\n<!--<div class=\"cute-snack-bar-label\" #label>-->\r\n <!-- Initially holds the snack bar content, will be empty after announcing to screen readers. -->\r\n <div aria-hidden=\"true\">\r\n <ng-template cdkPortalOutlet />\r\n </div>\r\n\r\n <!-- Will receive the snack bar content from the non-live div, move will happen a short delay after opening -->\r\n <div\r\n [attr.aria-live]=\"_live\"\r\n [attr.role]=\"_role\"\r\n [attr.id]=\"_liveElementId\">\r\n </div>\r\n<!--</div>-->\r\n", styles: ["cute-snack-bar-container.toast-container{position:relative;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0);margin:.5rem}.cute-snack-bar-handset cute-snack-bar-container.toast-container{width:100vw}cute-snack-bar-container.toast-container .toast{--bs-toast-color: var(--bs-body-color);--bs-toast-bg: rgba(var(--bs-body-bg-rgb), .95)}cute-snack-bar-container.toast-container .toast:has(.toast-header){flex-direction:column;align-items:normal}.cute-snack-bar-body{display:flex;flex-direction:column}.cute-snack-bar-actions{display:flex;flex-shrink:0;align-items:center;box-sizing:border-box}.cute-snack-bar-container-animations-enabled{opacity:0}.cute-snack-bar-container-animations-enabled.cute-snack-bar-fallback-visible{opacity:1}.cute-snack-bar-container-animations-enabled.cute-snack-bar-container-enter{animation:_cute-snack-bar-enter .15s cubic-bezier(0,0,.2,1) forwards}.cute-snack-bar-container-animations-enabled.cute-snack-bar-container-exit{animation:_cute-snack-bar-exit 75ms cubic-bezier(.4,0,1,1) forwards}@keyframes _cute-snack-bar-enter{0%{transform:scale(.8);opacity:0}to{transform:scale(1);opacity:.95}}@keyframes _cute-snack-bar-exit{0%{opacity:.95}to{opacity:0}}\n"] }]
559
+ }], ctorParameters: () => [], propDecorators: { _portalOutlet: [{
560
+ type: ViewChild,
561
+ args: [CdkPortalOutlet, { static: true }]
562
+ }], _label: [{
563
+ type: ViewChild,
564
+ args: ['label', { static: true }]
565
+ }] } });
566
+
567
+ /**
568
+ * @license Apache-2.0
569
+ *
570
+ * Copyright (c) 2025 CuteWidgets Team. All Rights Reserved.
571
+ *
572
+ * You may not use this file except in compliance with the License
573
+ * that can be found at http://www.apache.org/licenses/LICENSE-2.0
574
+ *
575
+ * This code is a modification of the `@angular/material` original
576
+ * code licensed under MIT-style License (https://angular.dev/license).
577
+ */
578
+ /** Injection token that can be used to specify the default snack bar. */
579
+ const CUTE_SNACK_BAR_DEFAULT_OPTIONS = new InjectionToken('cute-snack-bar-default-options', {
580
+ providedIn: 'root',
581
+ factory: () => new CuteSnackBarConfig(),
582
+ });
583
+ /**
584
+ * Service to dispatch Cute snack bar messages.
585
+ */
586
+ class CuteSnackBar {
587
+ /** Reference to the currently opened snackbar at *any* level. */
588
+ get _openedSnackBarRef() {
589
+ const parent = this._parentSnackBar;
590
+ return parent ? parent._openedSnackBarRef : this._snackBarRefAtThisLevel;
591
+ }
592
+ set _openedSnackBarRef(value) {
593
+ if (this._parentSnackBar) {
594
+ this._parentSnackBar._openedSnackBarRef = value;
595
+ }
596
+ else {
597
+ this._snackBarRefAtThisLevel = value;
598
+ }
599
+ }
600
+ constructor() {
601
+ this._live = inject(LiveAnnouncer);
602
+ this._injector = inject(Injector);
603
+ this._overlay = inject(Overlay);
604
+ this._breakpointObserver = inject(BreakpointObserver);
605
+ this._parentSnackBar = inject(CuteSnackBar, { optional: true, skipSelf: true });
606
+ this._defaultConfig = inject(CUTE_SNACK_BAR_DEFAULT_OPTIONS);
607
+ this._animationsDisabled = _animationsDisabled();
608
+ this._destroyRef = inject(DestroyRef);
609
+ /**
610
+ * Reference to the current snack bar in the view *at this level* (in the Angular injector tree).
611
+ * If there is a parent snack-bar service, all operations should delegate to that parent
612
+ * via `_openedSnackBarRef`.
613
+ */
614
+ this._snackBarRefAtThisLevel = null;
615
+ /** The component that should be rendered as the snack bar's simple component. */
616
+ this._simpleSnackBarComponent = SimpleSnackBar;
617
+ /** The container component that attaches the provided template or component. */
618
+ this.snackBarContainerComponent = CuteSnackBarContainer;
619
+ /** The CSS class to apply for handset mode. */
620
+ this.handsetCssClass = 'cute-snack-bar-handset';
621
+ }
622
+ /**
623
+ * Creates and dispatches a snack bar with a custom component for the content, removing any
624
+ * currently opened snack bars.
625
+ *
626
+ * @param component Component to be instantiated.
627
+ * @param config Extra configuration for the snack bar.
628
+ */
629
+ openFromComponent(component, config) {
630
+ return this._attach(component, config);
631
+ }
632
+ /**
633
+ * Creates and dispatches a snack bar with a custom template for the content, removing any
634
+ * currently opened snack bars.
635
+ *
636
+ * @param template Template to be instantiated.
637
+ * @param config Extra configuration for the snack bar.
638
+ */
639
+ openFromTemplate(template, config) {
640
+ return this._attach(template, config);
641
+ }
642
+ /**
643
+ * Opens a snackbar with a message and an optional action.
644
+ * @param message The message to show in the snackbar.
645
+ * @param action The label for the snackbar action.
646
+ * @param config Additional configuration options for the snackbar.
647
+ */
648
+ open(message, action = '', config) {
649
+ const _config = { ...this._defaultConfig, ...config };
650
+ // Since the user doesn't have access to the component, we can
651
+ // override the data to pass in our own message and action.
652
+ _config.data = { message, action };
653
+ // Since the snack bar has `role="alert"`, we don't
654
+ // want to announce the same message twice.
655
+ if (_config.announcementMessage === message) {
656
+ _config.announcementMessage = undefined;
657
+ }
658
+ return this.openFromComponent(this._simpleSnackBarComponent, _config);
659
+ }
660
+ /**
661
+ * Dismisses the currently visible snack bar.
662
+ */
663
+ dismiss() {
664
+ if (this._openedSnackBarRef) {
665
+ this._openedSnackBarRef.dismiss();
666
+ }
667
+ }
668
+ ngOnDestroy() {
669
+ // Only dismiss the snack bar at the current level on destroy.
670
+ if (this._snackBarRefAtThisLevel) {
671
+ this._snackBarRefAtThisLevel.dismiss();
672
+ }
673
+ }
674
+ /**
675
+ * Attaches the snack bar container component to the overlay.
676
+ */
677
+ _attachSnackBarContainer(overlayRef, config) {
678
+ const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
679
+ const injector = Injector.create({
680
+ parent: userInjector || this._injector,
681
+ providers: [{ provide: CuteSnackBarConfig, useValue: config }],
682
+ });
683
+ const containerPortal = new ComponentPortal(this.snackBarContainerComponent, config.viewContainerRef, injector);
684
+ const containerRef = overlayRef.attach(containerPortal);
685
+ containerRef.instance.snackBarConfig = config;
686
+ return containerRef.instance;
687
+ }
688
+ /**
689
+ * Places a new component or a template as the content of the snack bar container.
690
+ */
691
+ _attach(content, userConfig) {
692
+ const config = { ...new CuteSnackBarConfig(), ...this._defaultConfig, ...userConfig };
693
+ const overlayRef = this._createOverlay(config);
694
+ const container = this._attachSnackBarContainer(overlayRef, config);
695
+ const snackBarRef = new CuteSnackBarRef(container, overlayRef);
696
+ let attachedElement;
697
+ if (content instanceof TemplateRef) {
698
+ const portal = new TemplatePortal(content, null, {
699
+ $implicit: config.data,
700
+ snackBarRef,
701
+ });
702
+ snackBarRef.instance = container.attachTemplatePortal(portal);
703
+ attachedElement = snackBarRef.instance.rootNodes[0];
704
+ }
705
+ else {
706
+ const injector = this._createInjector(config, snackBarRef);
707
+ const portal = new ComponentPortal(content, undefined, injector);
708
+ const contentRef = container.attachComponentPortal(portal);
709
+ // We can't pass this through the injector because the injector was created earlier
710
+ snackBarRef.instance = contentRef.instance;
711
+ if (snackBarRef.instance instanceof CuteBaseControl) {
712
+ const baseControl = snackBarRef.instance;
713
+ baseControl.color = config.color;
714
+ baseControl.gradientFill = config.gradientFill || false;
715
+ }
716
+ attachedElement = contentRef.location;
717
+ }
718
+ // CWT: Adding Bootstrap's classes dynamically
719
+ const cssClasses = ["toast", "show"];
720
+ if (config.color) {
721
+ //cssClasses.push("text-bg-"+config.color);
722
+ cssClasses.push(toTextBgCssClass(config.color));
723
+ }
724
+ if (config.gradientFill) {
725
+ cssClasses.push("bg-gradient");
726
+ }
727
+ addClasses(attachedElement.nativeElement, cssClasses);
728
+ // Subscribe to the breakpoint observer and attach the cute-snack-bar-handset class as
729
+ // appropriate. This class is applied to the overlay element because the overlay must expand to
730
+ // fill the width with the screen for full width snackbars.
731
+ this._breakpointObserver
732
+ .observe(Breakpoints.HandsetPortrait)
733
+ .pipe(takeUntil(overlayRef.detachments()))
734
+ .subscribe(state => {
735
+ overlayRef.overlayElement.classList.toggle(this.handsetCssClass, state.matches);
736
+ });
737
+ if (config.announcementMessage) {
738
+ // Wait until the snack bar contents have been announced, then deliver this message.
739
+ container._onAnnounce.subscribe(() => {
740
+ this._live.announce(config.announcementMessage, config.politeness);
741
+ });
742
+ }
743
+ this._animateSnackBar(snackBarRef, config);
744
+ this._openedSnackBarRef = snackBarRef;
745
+ return this._openedSnackBarRef;
746
+ }
747
+ /** Animates the old snack bar out and the new one in. */
748
+ _animateSnackBar(snackBarRef, config) {
749
+ // When the snackbar is dismissed, clear the reference to it.
750
+ snackBarRef.afterDismissed()
751
+ .pipe(takeUntilDestroyed(this._destroyRef))
752
+ .subscribe(() => {
753
+ // Clear the snackbar ref if it hasn't already been replaced by a newer snackbar.
754
+ if (this._openedSnackBarRef == snackBarRef) {
755
+ this._openedSnackBarRef = null;
756
+ }
757
+ if (config.announcementMessage) {
758
+ this._live.clear();
759
+ }
760
+ });
761
+ // If a dismiss timeout is provided, set up dismiss based on after the snackbar is opened.
762
+ if (config.duration && config.duration > 0) {
763
+ snackBarRef.afterOpened()
764
+ .pipe(takeUntilDestroyed(this._destroyRef))
765
+ .subscribe(() => snackBarRef._dismissAfter(config.duration));
766
+ }
767
+ if (this._openedSnackBarRef) {
768
+ // If a snack bar is already in view, dismiss it and enter the
769
+ // new snack bar after exit animation is complete.
770
+ this._openedSnackBarRef.afterDismissed()
771
+ .pipe(takeUntilDestroyed(this._destroyRef))
772
+ .subscribe(() => {
773
+ snackBarRef.containerInstance.enter();
774
+ });
775
+ this._openedSnackBarRef.dismiss();
776
+ }
777
+ else {
778
+ // If no snack bar is in view, enter the new snack bar.
779
+ snackBarRef.containerInstance.enter();
780
+ }
781
+ }
782
+ /**
783
+ * Creates a new overlay and places it in the correct location.
784
+ * @param config The user-specified snack bar config.
785
+ */
786
+ _createOverlay(config) {
787
+ const overlayConfig = new OverlayConfig();
788
+ overlayConfig.direction = config.direction;
789
+ let positionStrategy = this._overlay.position().global();
790
+ // Set horizontal position.
791
+ const isRtl = config.direction === 'rtl';
792
+ const isLeft = config.horizontalPosition === 'left' ||
793
+ (config.horizontalPosition === 'start' && !isRtl) ||
794
+ (config.horizontalPosition === 'end' && isRtl);
795
+ const isRight = !isLeft && config.horizontalPosition !== 'center';
796
+ const OFFSET = '0';
797
+ if (isLeft) {
798
+ positionStrategy.left(OFFSET);
799
+ }
800
+ else if (isRight) {
801
+ positionStrategy.right(OFFSET);
802
+ }
803
+ else {
804
+ positionStrategy.centerHorizontally();
805
+ }
806
+ // Set horizontal position.
807
+ if (config.verticalPosition === 'top') {
808
+ positionStrategy.top(OFFSET);
809
+ }
810
+ else {
811
+ positionStrategy.bottom(OFFSET);
812
+ }
813
+ overlayConfig.positionStrategy = positionStrategy;
814
+ overlayConfig.disableAnimations = this._animationsDisabled;
815
+ return this._overlay.create(overlayConfig);
816
+ }
817
+ /**
818
+ * Creates an injector to be used inside of a snack bar component.
819
+ * @param config Config that was used to create the snack bar.
820
+ * @param snackBarRef Reference to the snack bar.
821
+ */
822
+ _createInjector(config, snackBarRef) {
823
+ const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
824
+ return Injector.create({
825
+ parent: userInjector || this._injector,
826
+ providers: [
827
+ { provide: CuteSnackBarRef, useValue: snackBarRef },
828
+ { provide: CUTE_SNACK_BAR_DATA, useValue: config.data },
829
+ ],
830
+ });
831
+ }
832
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSnackBar, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
833
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSnackBar, providedIn: 'root' }); }
834
+ }
835
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSnackBar, decorators: [{
836
+ type: Injectable,
837
+ args: [{ providedIn: 'root' }]
838
+ }], ctorParameters: () => [] });
839
+ function addClasses(element, classes) {
840
+ if (classes) {
841
+ if (Array.isArray(classes)) {
842
+ // Note that we can't use a spread here, because IE doesn't support multiple arguments.
843
+ classes.forEach(cssClass => element.classList.add(cssClass));
844
+ }
845
+ else {
846
+ element.classList.add(classes);
847
+ }
848
+ }
849
+ }
850
+
851
+ /**
852
+ * @license Apache-2.0
853
+ *
854
+ * Copyright (c) 2025 CuteWidgets Team. All Rights Reserved.
855
+ *
856
+ * You may not use this file except in compliance with the License
857
+ * that can be found at http://www.apache.org/licenses/LICENSE-2.0
858
+ */
859
+ const TYPES = [
860
+ CuteSnackBarContainer,
861
+ CuteSnackBarActions,
862
+ CuteSnackBarAction,
863
+ CuteSnackBarBody,
864
+ CuteSnackBarHeader,
865
+ CuteSnackBarLabel,
866
+ ];
867
+ class CuteSnackbarModule {
868
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSnackbarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
869
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.15", ngImport: i0, type: CuteSnackbarModule, imports: [CommonModule, SimpleSnackBar, CuteSnackBarContainer,
870
+ CuteSnackBarActions,
871
+ CuteSnackBarAction,
872
+ CuteSnackBarBody,
873
+ CuteSnackBarHeader,
874
+ CuteSnackBarLabel], exports: [CuteSnackBarContainer,
875
+ CuteSnackBarActions,
876
+ CuteSnackBarAction,
877
+ CuteSnackBarBody,
878
+ CuteSnackBarHeader,
879
+ CuteSnackBarLabel] }); }
880
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSnackbarModule, providers: [CuteSnackBar], imports: [CommonModule, SimpleSnackBar] }); }
881
+ }
882
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: CuteSnackbarModule, decorators: [{
883
+ type: NgModule,
884
+ args: [{
885
+ imports: [CommonModule, SimpleSnackBar, ...TYPES],
886
+ exports: TYPES,
887
+ providers: [CuteSnackBar],
888
+ declarations: [],
889
+ }]
890
+ }] });
891
+
892
+ /**
893
+ * Generated bundle index. Do not edit.
894
+ */
895
+
896
+ export { CUTE_SNACK_BAR_DATA, CUTE_SNACK_BAR_DEFAULT_OPTIONS, CuteSnackBar, CuteSnackBarAction, CuteSnackBarActions, CuteSnackBarBody, CuteSnackBarConfig, CuteSnackBarContainer, CuteSnackBarHeader, CuteSnackBarLabel, CuteSnackBarRef, CuteSnackbarModule, SimpleSnackBar };
897
+ //# sourceMappingURL=cute-widgets-base-snack-bar.mjs.map