@spartan-ng/brain 0.0.1-alpha.650 → 0.0.1-alpha.652
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/spartan-ng-brain-sonner.mjs +1170 -0
- package/fesm2022/spartan-ng-brain-sonner.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-tooltip.mjs +30 -4
- package/fesm2022/spartan-ng-brain-tooltip.mjs.map +1 -1
- package/hlm-tailwind-preset.css +3 -0
- package/package.json +5 -1
- package/sonner/README.md +3 -0
- package/sonner/index.d.ts +388 -0
- package/tooltip/index.d.ts +4 -0
|
@@ -0,0 +1,1170 @@
|
|
|
1
|
+
import { Directionality } from '@angular/cdk/bidi';
|
|
2
|
+
import { NgComponentOutlet, isPlatformBrowser, NgTemplateOutlet } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { input, ChangeDetectionStrategy, Component, booleanAttribute, InjectionToken, inject, Pipe, signal, computed, viewChild, linkedSignal, effect, afterRenderEffect, PLATFORM_ID, DOCUMENT, numberAttribute, contentChild, TemplateRef, DestroyRef, afterNextRender, ViewEncapsulation } from '@angular/core';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
|
|
7
|
+
class BrnSonnerIcon {
|
|
8
|
+
type = input('default', ...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
9
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: BrnSonnerIcon, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
10
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.17", type: BrnSonnerIcon, isStandalone: true, selector: "brn-sonner-icon", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
11
|
+
@switch (type()) {
|
|
12
|
+
@case ('success') {
|
|
13
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20">
|
|
14
|
+
<path
|
|
15
|
+
fill-rule="evenodd"
|
|
16
|
+
d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z"
|
|
17
|
+
clip-rule="evenodd"
|
|
18
|
+
/>
|
|
19
|
+
</svg>
|
|
20
|
+
}
|
|
21
|
+
@case ('error') {
|
|
22
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20">
|
|
23
|
+
<path
|
|
24
|
+
fill-rule="evenodd"
|
|
25
|
+
d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z"
|
|
26
|
+
clip-rule="evenodd"
|
|
27
|
+
/>
|
|
28
|
+
</svg>
|
|
29
|
+
}
|
|
30
|
+
@case ('info') {
|
|
31
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20">
|
|
32
|
+
<path
|
|
33
|
+
fill-rule="evenodd"
|
|
34
|
+
d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z"
|
|
35
|
+
clip-rule="evenodd"
|
|
36
|
+
/>
|
|
37
|
+
</svg>
|
|
38
|
+
}
|
|
39
|
+
@case ('warning') {
|
|
40
|
+
<svg viewBox="0 0 64 64" fill="currentColor" height="20" width="20" xmlns="http://www.w3.org/2000/svg">
|
|
41
|
+
<path
|
|
42
|
+
d="M32.427,7.987c2.183,0.124 4,1.165 5.096,3.281l17.936,36.208c1.739,3.66 -0.954,8.585 -5.373,8.656l-36.119,0c-4.022,-0.064 -7.322,-4.631 -5.352,-8.696l18.271,-36.207c0.342,-0.65 0.498,-0.838 0.793,-1.179c1.186,-1.375 2.483,-2.111 4.748,-2.063Zm-0.295,3.997c-0.687,0.034 -1.316,0.419 -1.659,1.017c-6.312,11.979 -12.397,24.081 -18.301,36.267c-0.546,1.225 0.391,2.797 1.762,2.863c12.06,0.195 24.125,0.195 36.185,0c1.325,-0.064 2.321,-1.584 1.769,-2.85c-5.793,-12.184 -11.765,-24.286 -17.966,-36.267c-0.366,-0.651 -0.903,-1.042 -1.79,-1.03Z"
|
|
43
|
+
/>
|
|
44
|
+
<path
|
|
45
|
+
d="M33.631,40.581l-3.348,0l-0.368,-16.449l4.1,0l-0.384,16.449Zm-3.828,5.03c0,-0.609 0.197,-1.113 0.592,-1.514c0.396,-0.4 0.935,-0.601 1.618,-0.601c0.684,0 1.223,0.201 1.618,0.601c0.395,0.401 0.593,0.905 0.593,1.514c0,0.587 -0.193,1.078 -0.577,1.473c-0.385,0.395 -0.929,0.593 -1.634,0.593c-0.705,0 -1.249,-0.198 -1.634,-0.593c-0.384,-0.395 -0.576,-0.886 -0.576,-1.473Z"
|
|
46
|
+
/>
|
|
47
|
+
</svg>
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
51
|
+
}
|
|
52
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: BrnSonnerIcon, decorators: [{
|
|
53
|
+
type: Component,
|
|
54
|
+
args: [{
|
|
55
|
+
selector: 'brn-sonner-icon',
|
|
56
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
57
|
+
template: `
|
|
58
|
+
@switch (type()) {
|
|
59
|
+
@case ('success') {
|
|
60
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20">
|
|
61
|
+
<path
|
|
62
|
+
fill-rule="evenodd"
|
|
63
|
+
d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z"
|
|
64
|
+
clip-rule="evenodd"
|
|
65
|
+
/>
|
|
66
|
+
</svg>
|
|
67
|
+
}
|
|
68
|
+
@case ('error') {
|
|
69
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20">
|
|
70
|
+
<path
|
|
71
|
+
fill-rule="evenodd"
|
|
72
|
+
d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z"
|
|
73
|
+
clip-rule="evenodd"
|
|
74
|
+
/>
|
|
75
|
+
</svg>
|
|
76
|
+
}
|
|
77
|
+
@case ('info') {
|
|
78
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20">
|
|
79
|
+
<path
|
|
80
|
+
fill-rule="evenodd"
|
|
81
|
+
d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z"
|
|
82
|
+
clip-rule="evenodd"
|
|
83
|
+
/>
|
|
84
|
+
</svg>
|
|
85
|
+
}
|
|
86
|
+
@case ('warning') {
|
|
87
|
+
<svg viewBox="0 0 64 64" fill="currentColor" height="20" width="20" xmlns="http://www.w3.org/2000/svg">
|
|
88
|
+
<path
|
|
89
|
+
d="M32.427,7.987c2.183,0.124 4,1.165 5.096,3.281l17.936,36.208c1.739,3.66 -0.954,8.585 -5.373,8.656l-36.119,0c-4.022,-0.064 -7.322,-4.631 -5.352,-8.696l18.271,-36.207c0.342,-0.65 0.498,-0.838 0.793,-1.179c1.186,-1.375 2.483,-2.111 4.748,-2.063Zm-0.295,3.997c-0.687,0.034 -1.316,0.419 -1.659,1.017c-6.312,11.979 -12.397,24.081 -18.301,36.267c-0.546,1.225 0.391,2.797 1.762,2.863c12.06,0.195 24.125,0.195 36.185,0c1.325,-0.064 2.321,-1.584 1.769,-2.85c-5.793,-12.184 -11.765,-24.286 -17.966,-36.267c-0.366,-0.651 -0.903,-1.042 -1.79,-1.03Z"
|
|
90
|
+
/>
|
|
91
|
+
<path
|
|
92
|
+
d="M33.631,40.581l-3.348,0l-0.368,-16.449l4.1,0l-0.384,16.449Zm-3.828,5.03c0,-0.609 0.197,-1.113 0.592,-1.514c0.396,-0.4 0.935,-0.601 1.618,-0.601c0.684,0 1.223,0.201 1.618,0.601c0.395,0.401 0.593,0.905 0.593,1.514c0,0.587 -0.193,1.078 -0.577,1.473c-0.385,0.395 -0.929,0.593 -1.634,0.593c-0.705,0 -1.249,-0.198 -1.634,-0.593c-0.384,-0.395 -0.576,-0.886 -0.576,-1.473Z"
|
|
93
|
+
/>
|
|
94
|
+
</svg>
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
`,
|
|
98
|
+
}]
|
|
99
|
+
}], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }] } });
|
|
100
|
+
|
|
101
|
+
class BrnSonnerLoader {
|
|
102
|
+
isVisible = input.required(...(ngDevMode ? [{ debugName: "isVisible", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
103
|
+
_bars = Array(12).fill(0);
|
|
104
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: BrnSonnerLoader, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
105
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.17", type: BrnSonnerLoader, isStandalone: true, selector: "brn-sonner-loader", inputs: { isVisible: { classPropertyName: "isVisible", publicName: "isVisible", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
|
106
|
+
<div class="sonner-loading-wrapper" [attr.data-visible]="isVisible()">
|
|
107
|
+
<div class="sonner-spinner">
|
|
108
|
+
@for (_ of _bars; track $index) {
|
|
109
|
+
<div class="sonner-loading-bar"></div>
|
|
110
|
+
}
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
114
|
+
}
|
|
115
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: BrnSonnerLoader, decorators: [{
|
|
116
|
+
type: Component,
|
|
117
|
+
args: [{
|
|
118
|
+
selector: 'brn-sonner-loader',
|
|
119
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
120
|
+
template: `
|
|
121
|
+
<div class="sonner-loading-wrapper" [attr.data-visible]="isVisible()">
|
|
122
|
+
<div class="sonner-spinner">
|
|
123
|
+
@for (_ of _bars; track $index) {
|
|
124
|
+
<div class="sonner-loading-bar"></div>
|
|
125
|
+
}
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
`,
|
|
129
|
+
}]
|
|
130
|
+
}], propDecorators: { isVisible: [{ type: i0.Input, args: [{ isSignal: true, alias: "isVisible", required: true }] }] } });
|
|
131
|
+
|
|
132
|
+
const defaultConfig = {
|
|
133
|
+
visibleToastsAmount: 3,
|
|
134
|
+
viewPortOffset: '32px',
|
|
135
|
+
toastLifetime: 4000,
|
|
136
|
+
toastWidth: 356,
|
|
137
|
+
gap: 14,
|
|
138
|
+
swipeThreshold: 20,
|
|
139
|
+
timeBeforeUnmount: 200,
|
|
140
|
+
};
|
|
141
|
+
const BrnSonnerToasterConfigToken = new InjectionToken('BrnSonnerToasterConfig');
|
|
142
|
+
function provideBrnSonnerToasterConfig(config) {
|
|
143
|
+
return { provide: BrnSonnerToasterConfigToken, useValue: { ...defaultConfig, ...config } };
|
|
144
|
+
}
|
|
145
|
+
function injectBrnSonnerToasterConfig() {
|
|
146
|
+
return inject(BrnSonnerToasterConfigToken, { optional: true }) ?? defaultConfig;
|
|
147
|
+
}
|
|
148
|
+
const defaultClasses = {
|
|
149
|
+
toast: '',
|
|
150
|
+
title: '',
|
|
151
|
+
description: '',
|
|
152
|
+
loader: '',
|
|
153
|
+
closeButton: '',
|
|
154
|
+
cancelButton: '',
|
|
155
|
+
actionButton: '',
|
|
156
|
+
action: '',
|
|
157
|
+
warning: '',
|
|
158
|
+
error: '',
|
|
159
|
+
success: '',
|
|
160
|
+
default: '',
|
|
161
|
+
info: '',
|
|
162
|
+
loading: '',
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
class AsComponentPipe {
|
|
166
|
+
transform(value) {
|
|
167
|
+
return value;
|
|
168
|
+
}
|
|
169
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AsComponentPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
170
|
+
/** @nocollapse */ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.17", ngImport: i0, type: AsComponentPipe, isStandalone: true, name: "asComponent" });
|
|
171
|
+
}
|
|
172
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: AsComponentPipe, decorators: [{
|
|
173
|
+
type: Pipe,
|
|
174
|
+
args: [{ name: 'asComponent' }]
|
|
175
|
+
}] });
|
|
176
|
+
|
|
177
|
+
class IsStringPipe {
|
|
178
|
+
transform(value) {
|
|
179
|
+
return typeof value === 'string';
|
|
180
|
+
}
|
|
181
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: IsStringPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
182
|
+
/** @nocollapse */ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.17", ngImport: i0, type: IsStringPipe, isStandalone: true, name: "isString" });
|
|
183
|
+
}
|
|
184
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: IsStringPipe, decorators: [{
|
|
185
|
+
type: Pipe,
|
|
186
|
+
args: [{ name: 'isString' }]
|
|
187
|
+
}] });
|
|
188
|
+
|
|
189
|
+
let toastsCounter = 0;
|
|
190
|
+
function createToastState() {
|
|
191
|
+
const toasts = signal([], ...(ngDevMode ? [{ debugName: "toasts" }] : []));
|
|
192
|
+
const heights = signal([], ...(ngDevMode ? [{ debugName: "heights" }] : []));
|
|
193
|
+
function addToast(data) {
|
|
194
|
+
toasts.update((prev) => [data, ...prev]);
|
|
195
|
+
}
|
|
196
|
+
function create(data) {
|
|
197
|
+
const { message, ...rest } = data;
|
|
198
|
+
const id = typeof data?.id === 'number' || (data.id && data.id?.length > 0) ? data.id : toastsCounter++;
|
|
199
|
+
const dismissible = data.dismissible ?? true;
|
|
200
|
+
const type = data.type ?? 'default';
|
|
201
|
+
const alreadyExists = toasts().find((toast) => toast.id === id);
|
|
202
|
+
if (alreadyExists) {
|
|
203
|
+
toasts.update((prev) => prev.map((toast) => {
|
|
204
|
+
if (toast.id === id) {
|
|
205
|
+
return {
|
|
206
|
+
...toast,
|
|
207
|
+
...data,
|
|
208
|
+
id,
|
|
209
|
+
title: message,
|
|
210
|
+
dismissible,
|
|
211
|
+
type,
|
|
212
|
+
updated: true,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
else
|
|
216
|
+
return { ...toast, updated: false };
|
|
217
|
+
}));
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
addToast({ ...rest, id, title: message, dismissible: dismissible, type });
|
|
221
|
+
}
|
|
222
|
+
return id;
|
|
223
|
+
}
|
|
224
|
+
function dismiss(id) {
|
|
225
|
+
if (id === undefined) {
|
|
226
|
+
toasts.set([]);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
toasts.update((prev) => prev.filter((toast) => toast.id !== id));
|
|
230
|
+
return id;
|
|
231
|
+
}
|
|
232
|
+
function message(message, data) {
|
|
233
|
+
return create({ ...data, type: 'default', message });
|
|
234
|
+
}
|
|
235
|
+
function error(message, data) {
|
|
236
|
+
return create({ ...data, type: 'error', message });
|
|
237
|
+
}
|
|
238
|
+
function success(message, data) {
|
|
239
|
+
return create({ ...data, type: 'success', message });
|
|
240
|
+
}
|
|
241
|
+
function info(message, data) {
|
|
242
|
+
return create({ ...data, type: 'info', message });
|
|
243
|
+
}
|
|
244
|
+
function warning(message, data) {
|
|
245
|
+
return create({ ...data, type: 'warning', message });
|
|
246
|
+
}
|
|
247
|
+
function loading(message, data) {
|
|
248
|
+
return create({ ...data, type: 'loading', message });
|
|
249
|
+
}
|
|
250
|
+
function promise(promise, data) {
|
|
251
|
+
if (!data)
|
|
252
|
+
return;
|
|
253
|
+
let id = undefined;
|
|
254
|
+
if (data.loading !== undefined) {
|
|
255
|
+
id = create({
|
|
256
|
+
...data,
|
|
257
|
+
promise,
|
|
258
|
+
type: 'loading',
|
|
259
|
+
message: data.loading,
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
const p = promise instanceof Promise ? promise : promise();
|
|
263
|
+
let shouldDismiss = id !== undefined;
|
|
264
|
+
p.then((response) => {
|
|
265
|
+
// @ts-expect-error: Incorrect response type
|
|
266
|
+
if (response && typeof response.ok === 'boolean' && !response.ok) {
|
|
267
|
+
shouldDismiss = false;
|
|
268
|
+
const message = typeof data.error === 'function'
|
|
269
|
+
? // @ts-expect-error: TODO: Better function checking
|
|
270
|
+
data.error(`HTTP error! status: ${response.status}`)
|
|
271
|
+
: data.error;
|
|
272
|
+
create({ id, type: 'error', message });
|
|
273
|
+
}
|
|
274
|
+
else if (data.success !== undefined) {
|
|
275
|
+
shouldDismiss = false;
|
|
276
|
+
const message = typeof data.success === 'function'
|
|
277
|
+
? // @ts-expect-error: TODO: Better function checking
|
|
278
|
+
data.success(response)
|
|
279
|
+
: data.success;
|
|
280
|
+
create({ id, type: 'success', message });
|
|
281
|
+
}
|
|
282
|
+
})
|
|
283
|
+
.catch((error) => {
|
|
284
|
+
if (data.error !== undefined) {
|
|
285
|
+
shouldDismiss = false;
|
|
286
|
+
const message =
|
|
287
|
+
// @ts-expect-error: TODO: Better function checking
|
|
288
|
+
typeof data.error === 'function' ? data.error(error) : data.error;
|
|
289
|
+
create({ id, type: 'error', message });
|
|
290
|
+
}
|
|
291
|
+
})
|
|
292
|
+
.finally(() => {
|
|
293
|
+
if (shouldDismiss) {
|
|
294
|
+
// Toast is still in load state (and will be indefinitely — dismiss it)
|
|
295
|
+
dismiss(id);
|
|
296
|
+
id = undefined;
|
|
297
|
+
}
|
|
298
|
+
data.finally?.();
|
|
299
|
+
});
|
|
300
|
+
return id;
|
|
301
|
+
}
|
|
302
|
+
function custom(component, data) {
|
|
303
|
+
const id = data?.id ?? toastsCounter++;
|
|
304
|
+
create({ component, id, ...data });
|
|
305
|
+
return id;
|
|
306
|
+
}
|
|
307
|
+
function removeHeight(id) {
|
|
308
|
+
heights.update((prev) => prev.filter((height) => height.toastId !== id));
|
|
309
|
+
}
|
|
310
|
+
function addHeight(height) {
|
|
311
|
+
heights.update((prev) => [height, ...prev].sort(sortHeights));
|
|
312
|
+
}
|
|
313
|
+
const sortHeights = (a, b) => toasts().findIndex((t) => t.id === a.toastId) - toasts().findIndex((t) => t.id === b.toastId);
|
|
314
|
+
function reset() {
|
|
315
|
+
toasts.set([]);
|
|
316
|
+
heights.set([]);
|
|
317
|
+
}
|
|
318
|
+
return {
|
|
319
|
+
//methods
|
|
320
|
+
create,
|
|
321
|
+
addToast,
|
|
322
|
+
dismiss,
|
|
323
|
+
message,
|
|
324
|
+
error,
|
|
325
|
+
success,
|
|
326
|
+
info,
|
|
327
|
+
warning,
|
|
328
|
+
loading,
|
|
329
|
+
promise,
|
|
330
|
+
custom,
|
|
331
|
+
removeHeight,
|
|
332
|
+
addHeight,
|
|
333
|
+
reset,
|
|
334
|
+
// signals
|
|
335
|
+
toasts: toasts.asReadonly(),
|
|
336
|
+
heights: heights.asReadonly(),
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
const toastState = createToastState();
|
|
340
|
+
// bind this to the toast function
|
|
341
|
+
function toastFunction(message, data) {
|
|
342
|
+
return toastState.create({
|
|
343
|
+
message,
|
|
344
|
+
...data,
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
const basicToast = toastFunction;
|
|
348
|
+
const toast = Object.assign(basicToast, {
|
|
349
|
+
success: toastState.success,
|
|
350
|
+
info: toastState.info,
|
|
351
|
+
warning: toastState.warning,
|
|
352
|
+
error: toastState.error,
|
|
353
|
+
custom: toastState.custom,
|
|
354
|
+
message: toastState.message,
|
|
355
|
+
promise: toastState.promise,
|
|
356
|
+
dismiss: toastState.dismiss,
|
|
357
|
+
loading: toastState.loading,
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
class BrnSonnerToast {
|
|
361
|
+
_config = injectBrnSonnerToasterConfig();
|
|
362
|
+
_toasts = computed(() => toastState.toasts().filter((t) => t.position === this.position()), ...(ngDevMode ? [{ debugName: "_toasts" }] : []));
|
|
363
|
+
_heights = computed(() => toastState.heights().filter((h) => h.position === this.position()), ...(ngDevMode ? [{ debugName: "_heights" }] : []));
|
|
364
|
+
_removeHeight = toastState.removeHeight;
|
|
365
|
+
_addHeight = toastState.addHeight;
|
|
366
|
+
_dismiss = toastState.dismiss;
|
|
367
|
+
toast = input.required(...(ngDevMode ? [{ debugName: "toast" }] : []));
|
|
368
|
+
index = input.required(...(ngDevMode ? [{ debugName: "index" }] : []));
|
|
369
|
+
expanded = input.required(...(ngDevMode ? [{ debugName: "expanded" }] : []));
|
|
370
|
+
invert = input.required(...(ngDevMode ? [{ debugName: "invert" }] : []));
|
|
371
|
+
position = input.required(...(ngDevMode ? [{ debugName: "position" }] : []));
|
|
372
|
+
visibleToasts = input.required(...(ngDevMode ? [{ debugName: "visibleToasts" }] : []));
|
|
373
|
+
expandByDefault = input.required(...(ngDevMode ? [{ debugName: "expandByDefault" }] : []));
|
|
374
|
+
closeButton = input.required(...(ngDevMode ? [{ debugName: "closeButton" }] : []));
|
|
375
|
+
interacting = input.required(...(ngDevMode ? [{ debugName: "interacting" }] : []));
|
|
376
|
+
cancelButtonStyle = input(...(ngDevMode ? [undefined, { debugName: "cancelButtonStyle" }] : []));
|
|
377
|
+
actionButtonStyle = input(...(ngDevMode ? [undefined, { debugName: "actionButtonStyle" }] : []));
|
|
378
|
+
duration = input(this._config.toastLifetime, ...(ngDevMode ? [{ debugName: "duration" }] : []));
|
|
379
|
+
descriptionClass = input('', ...(ngDevMode ? [{ debugName: "descriptionClass" }] : []));
|
|
380
|
+
classes = input({}, ...(ngDevMode ? [{ debugName: "classes" }] : []));
|
|
381
|
+
unstyled = input(false, ...(ngDevMode ? [{ debugName: "unstyled" }] : []));
|
|
382
|
+
userClass = input('', ...(ngDevMode ? [{ debugName: "userClass", alias: 'class' }] : [{ alias: 'class' }]));
|
|
383
|
+
style = input({}, ...(ngDevMode ? [{ debugName: "style" }] : []));
|
|
384
|
+
_mounted = signal(false, ...(ngDevMode ? [{ debugName: "_mounted" }] : []));
|
|
385
|
+
_removed = signal(false, ...(ngDevMode ? [{ debugName: "_removed" }] : []));
|
|
386
|
+
_swiping = signal(false, ...(ngDevMode ? [{ debugName: "_swiping" }] : []));
|
|
387
|
+
_swipeOut = signal(false, ...(ngDevMode ? [{ debugName: "_swipeOut" }] : []));
|
|
388
|
+
_offsetBeforeRemove = signal(0, ...(ngDevMode ? [{ debugName: "_offsetBeforeRemove" }] : []));
|
|
389
|
+
_initialHeight = signal(0, ...(ngDevMode ? [{ debugName: "_initialHeight" }] : []));
|
|
390
|
+
_toastRef = viewChild.required('toastRef');
|
|
391
|
+
_classes = computed(() => ({
|
|
392
|
+
...defaultClasses,
|
|
393
|
+
...this.classes(),
|
|
394
|
+
}), ...(ngDevMode ? [{ debugName: "_classes" }] : []));
|
|
395
|
+
_isFront = computed(() => this.index() === 0, ...(ngDevMode ? [{ debugName: "_isFront" }] : []));
|
|
396
|
+
_isVisible = computed(() => this.index() + 1 <= this.visibleToasts(), ...(ngDevMode ? [{ debugName: "_isVisible" }] : []));
|
|
397
|
+
_toastType = computed(() => this.toast().type ?? 'default', ...(ngDevMode ? [{ debugName: "_toastType" }] : []));
|
|
398
|
+
_toastClass = computed(() => this.toast().class ?? '', ...(ngDevMode ? [{ debugName: "_toastClass" }] : []));
|
|
399
|
+
_toastPosition = computed(() => this.toast().position ?? this.position(), ...(ngDevMode ? [{ debugName: "_toastPosition" }] : []));
|
|
400
|
+
_toastDescriptionClass = computed(() => this.toast().descriptionClass ?? '', ...(ngDevMode ? [{ debugName: "_toastDescriptionClass" }] : []));
|
|
401
|
+
_heightIndex = computed(() => this._heights().findIndex((height) => height.toastId === this.toast().id), ...(ngDevMode ? [{ debugName: "_heightIndex" }] : []));
|
|
402
|
+
_offset = linkedSignal(...(ngDevMode ? [{ debugName: "_offset", source: () => ({
|
|
403
|
+
heightIndex: this._heightIndex(),
|
|
404
|
+
toastsHeightBefore: this._toastsHeightBefore(),
|
|
405
|
+
}),
|
|
406
|
+
computation: ({ heightIndex, toastsHeightBefore }) => Math.round(heightIndex * this._config.gap + toastsHeightBefore) }] : [{
|
|
407
|
+
source: () => ({
|
|
408
|
+
heightIndex: this._heightIndex(),
|
|
409
|
+
toastsHeightBefore: this._toastsHeightBefore(),
|
|
410
|
+
}),
|
|
411
|
+
computation: ({ heightIndex, toastsHeightBefore }) => Math.round(heightIndex * this._config.gap + toastsHeightBefore),
|
|
412
|
+
}]));
|
|
413
|
+
_closeTimerStartTimeRef = 0;
|
|
414
|
+
_lastCloseTimerStartTimeRef = 0;
|
|
415
|
+
_pointerStartRef = null;
|
|
416
|
+
_coords = computed(() => this._toastPosition().split('-'), ...(ngDevMode ? [{ debugName: "_coords" }] : []));
|
|
417
|
+
_toastsHeightBefore = computed(() => this._heights().reduce((prev, curr, reducerIndex) => {
|
|
418
|
+
if (reducerIndex >= this._heightIndex())
|
|
419
|
+
return prev;
|
|
420
|
+
return prev + curr.height;
|
|
421
|
+
}, 0), ...(ngDevMode ? [{ debugName: "_toastsHeightBefore" }] : []));
|
|
422
|
+
_invert = computed(() => this.toast().invert ?? this.invert(), ...(ngDevMode ? [{ debugName: "_invert" }] : []));
|
|
423
|
+
_closeButton = computed(() => this.toast().closeButton ?? this.closeButton(), ...(ngDevMode ? [{ debugName: "_closeButton" }] : []));
|
|
424
|
+
_disabled = computed(() => this._toastType() === 'loading', ...(ngDevMode ? [{ debugName: "_disabled" }] : []));
|
|
425
|
+
_timeoutId;
|
|
426
|
+
_remainingTime = 0;
|
|
427
|
+
_isPromiseLoadingOrInfiniteDuration = computed(() => (this.toast().promise && this._toastType() === 'loading') || this.toast().duration === Number.POSITIVE_INFINITY, ...(ngDevMode ? [{ debugName: "_isPromiseLoadingOrInfiniteDuration" }] : []));
|
|
428
|
+
_toastClasses = computed(() => clsx(this.userClass(), this._toastClass(), this._classes().toast, this.toast().classes?.toast, this._classes()[this._toastType()], this.toast().classes?.[this._toastType()]), ...(ngDevMode ? [{ debugName: "_toastClasses" }] : []));
|
|
429
|
+
_toastStyle = computed(() => ({
|
|
430
|
+
'--index': `${this.index()}`,
|
|
431
|
+
'--toasts-before': `${this.index()}`,
|
|
432
|
+
'--z-index': `${this._toasts().length - this.index()}`,
|
|
433
|
+
'--offset': `${this._removed() ? this._offsetBeforeRemove() : this._offset()}px`,
|
|
434
|
+
'--initial-height': this.expandByDefault() ? 'auto' : `${this._initialHeight()}px`,
|
|
435
|
+
...this.style(),
|
|
436
|
+
}), ...(ngDevMode ? [{ debugName: "_toastStyle" }] : []));
|
|
437
|
+
_actionButtonClasses = computed(() => clsx(this._classes().actionButton, this.toast().classes?.actionButton), ...(ngDevMode ? [{ debugName: "_actionButtonClasses" }] : []));
|
|
438
|
+
_cancelButtonClasses = computed(() => clsx(this._classes().cancelButton, this.toast().classes?.cancelButton), ...(ngDevMode ? [{ debugName: "_cancelButtonClasses" }] : []));
|
|
439
|
+
_toastDescriptionClasses = computed(() => clsx(this.descriptionClass(), this._toastDescriptionClass(), this._classes().description, this.toast().classes?.description), ...(ngDevMode ? [{ debugName: "_toastDescriptionClasses" }] : []));
|
|
440
|
+
_titleClasses = computed(() => clsx(this._classes().title, this.toast().classes?.title), ...(ngDevMode ? [{ debugName: "_titleClasses" }] : []));
|
|
441
|
+
_closeButtonClasses = computed(() => clsx(this._classes().closeButton, this.toast().classes?.closeButton), ...(ngDevMode ? [{ debugName: "_closeButtonClasses" }] : []));
|
|
442
|
+
constructor() {
|
|
443
|
+
effect(() => {
|
|
444
|
+
if (this.toast().updated) {
|
|
445
|
+
// if the toast has been updated after the initial render,
|
|
446
|
+
// we want to reset the timer and set the remaining time to the
|
|
447
|
+
// new duration
|
|
448
|
+
clearTimeout(this._timeoutId);
|
|
449
|
+
this._remainingTime = this.toast().duration ?? this.duration() ?? this._config.toastLifetime;
|
|
450
|
+
this.startTimer();
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
afterRenderEffect((onCleanup) => {
|
|
454
|
+
if (!this._isPromiseLoadingOrInfiniteDuration()) {
|
|
455
|
+
if (this.expanded() || this.interacting()) {
|
|
456
|
+
this.pauseTimer();
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
this.startTimer();
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
onCleanup(() => clearTimeout(this._timeoutId));
|
|
463
|
+
});
|
|
464
|
+
effect(() => {
|
|
465
|
+
if (this.toast().delete) {
|
|
466
|
+
this.deleteToast();
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
ngAfterViewInit() {
|
|
471
|
+
this._remainingTime = this.toast().duration ?? this.duration() ?? this._config.toastLifetime;
|
|
472
|
+
this._mounted.set(true);
|
|
473
|
+
const height = this._toastRef().nativeElement.getBoundingClientRect().height;
|
|
474
|
+
this._initialHeight.set(height);
|
|
475
|
+
this._addHeight({ toastId: this.toast().id, height, position: this._toastPosition() });
|
|
476
|
+
}
|
|
477
|
+
ngOnDestroy() {
|
|
478
|
+
clearTimeout(this._timeoutId);
|
|
479
|
+
this._removeHeight(this.toast().id);
|
|
480
|
+
}
|
|
481
|
+
deleteToast() {
|
|
482
|
+
this._removed.set(true);
|
|
483
|
+
this._offsetBeforeRemove.set(this._offset());
|
|
484
|
+
this._removeHeight(this.toast().id);
|
|
485
|
+
setTimeout(() => {
|
|
486
|
+
this._dismiss(this.toast().id);
|
|
487
|
+
}, this._config.timeBeforeUnmount);
|
|
488
|
+
}
|
|
489
|
+
// If toast's duration changes, it will be out of sync with the
|
|
490
|
+
// remainingAtTimeout, so we know we need to restart the timer
|
|
491
|
+
// with the new duration
|
|
492
|
+
// Pause the timer on each hover
|
|
493
|
+
pauseTimer() {
|
|
494
|
+
if (this._lastCloseTimerStartTimeRef < this._closeTimerStartTimeRef) {
|
|
495
|
+
// Get the elapsed time since the timer started
|
|
496
|
+
const elapsedTime = new Date().getTime() - this._closeTimerStartTimeRef;
|
|
497
|
+
this._remainingTime = this._remainingTime - elapsedTime;
|
|
498
|
+
}
|
|
499
|
+
this._lastCloseTimerStartTimeRef = new Date().getTime();
|
|
500
|
+
}
|
|
501
|
+
startTimer() {
|
|
502
|
+
this._closeTimerStartTimeRef = new Date().getTime();
|
|
503
|
+
// Let the toast know it has started
|
|
504
|
+
this._timeoutId = setTimeout(() => {
|
|
505
|
+
this.toast().onAutoClose?.(this.toast());
|
|
506
|
+
this.deleteToast();
|
|
507
|
+
}, this._remainingTime);
|
|
508
|
+
}
|
|
509
|
+
onPointerDown(event) {
|
|
510
|
+
if (this._disabled() || !this.toast().dismissible)
|
|
511
|
+
return;
|
|
512
|
+
this._offsetBeforeRemove.set(this._offset());
|
|
513
|
+
const target = event.target;
|
|
514
|
+
// Ensure we maintain correct pointer capture even when going outside the toast (e.g. when swiping)
|
|
515
|
+
target.setPointerCapture(event.pointerId);
|
|
516
|
+
if (target.tagName === 'BUTTON') {
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
this._swiping.set(true);
|
|
520
|
+
this._pointerStartRef = { x: event.clientX, y: event.clientY };
|
|
521
|
+
}
|
|
522
|
+
onPointerUp() {
|
|
523
|
+
if (this._swipeOut() || !this.toast().dismissible)
|
|
524
|
+
return;
|
|
525
|
+
this._pointerStartRef = null;
|
|
526
|
+
const swipeAmount = Number(this._toastRef().nativeElement.style.getPropertyValue('--swipe-amount').replace('px', '') || 0);
|
|
527
|
+
// Remove only if threshold is met
|
|
528
|
+
if (Math.abs(swipeAmount) >= this._config.swipeThreshold) {
|
|
529
|
+
this._offsetBeforeRemove.set(this._offset());
|
|
530
|
+
this.toast().onDismiss?.(this.toast());
|
|
531
|
+
this.deleteToast();
|
|
532
|
+
this._swipeOut.set(true);
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
this._toastRef().nativeElement.style.setProperty('--swipe-amount', '0px');
|
|
536
|
+
this._swiping.set(false);
|
|
537
|
+
}
|
|
538
|
+
onPointerMove(event) {
|
|
539
|
+
if (!this._pointerStartRef || !this.toast().dismissible)
|
|
540
|
+
return;
|
|
541
|
+
const yPosition = event.clientY - this._pointerStartRef.y;
|
|
542
|
+
const xPosition = event.clientX - this._pointerStartRef.x;
|
|
543
|
+
const clamp = this._coords()[0] === 'top' ? Math.min : Math.max;
|
|
544
|
+
const clampedY = clamp(0, yPosition);
|
|
545
|
+
const swipeStartThreshold = event.pointerType === 'touch' ? 10 : 2;
|
|
546
|
+
const isAllowedToSwipe = Math.abs(clampedY) > swipeStartThreshold;
|
|
547
|
+
if (isAllowedToSwipe) {
|
|
548
|
+
this._toastRef().nativeElement.style.setProperty('--swipe-amount', `${yPosition}px`);
|
|
549
|
+
}
|
|
550
|
+
else if (Math.abs(xPosition) > swipeStartThreshold) {
|
|
551
|
+
// User is swiping in wrong direction, so we disable swipe gesture
|
|
552
|
+
// for the current pointer down interaction
|
|
553
|
+
this._pointerStartRef = null;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
onCloseButtonClick() {
|
|
557
|
+
if (this._disabled() || !this.toast().dismissible)
|
|
558
|
+
return;
|
|
559
|
+
this.deleteToast();
|
|
560
|
+
this.toast().onDismiss?.(this.toast());
|
|
561
|
+
}
|
|
562
|
+
onCancelClick() {
|
|
563
|
+
const toast = this.toast();
|
|
564
|
+
if (!toast.dismissible)
|
|
565
|
+
return;
|
|
566
|
+
this.deleteToast();
|
|
567
|
+
if (toast.cancel?.onClick) {
|
|
568
|
+
toast.cancel.onClick();
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
onActionClick(event) {
|
|
572
|
+
const toast = this.toast();
|
|
573
|
+
toast.action?.onClick(event);
|
|
574
|
+
if (event.defaultPrevented)
|
|
575
|
+
return;
|
|
576
|
+
this.deleteToast();
|
|
577
|
+
}
|
|
578
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: BrnSonnerToast, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
579
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.17", type: BrnSonnerToast, isStandalone: true, selector: "brn-sonner-toast", inputs: { toast: { classPropertyName: "toast", publicName: "toast", isSignal: true, isRequired: true, transformFunction: null }, index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: true, transformFunction: null }, expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: true, transformFunction: null }, invert: { classPropertyName: "invert", publicName: "invert", isSignal: true, isRequired: true, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: true, transformFunction: null }, visibleToasts: { classPropertyName: "visibleToasts", publicName: "visibleToasts", isSignal: true, isRequired: true, transformFunction: null }, expandByDefault: { classPropertyName: "expandByDefault", publicName: "expandByDefault", isSignal: true, isRequired: true, transformFunction: null }, closeButton: { classPropertyName: "closeButton", publicName: "closeButton", isSignal: true, isRequired: true, transformFunction: null }, interacting: { classPropertyName: "interacting", publicName: "interacting", isSignal: true, isRequired: true, transformFunction: null }, cancelButtonStyle: { classPropertyName: "cancelButtonStyle", publicName: "cancelButtonStyle", isSignal: true, isRequired: false, transformFunction: null }, actionButtonStyle: { classPropertyName: "actionButtonStyle", publicName: "actionButtonStyle", isSignal: true, isRequired: false, transformFunction: null }, duration: { classPropertyName: "duration", publicName: "duration", isSignal: true, isRequired: false, transformFunction: null }, descriptionClass: { classPropertyName: "descriptionClass", publicName: "descriptionClass", isSignal: true, isRequired: false, transformFunction: null }, classes: { classPropertyName: "classes", publicName: "classes", isSignal: true, isRequired: false, transformFunction: null }, unstyled: { classPropertyName: "unstyled", publicName: "unstyled", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, style: { classPropertyName: "style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "_toastRef", first: true, predicate: ["toastRef"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
580
|
+
<li
|
|
581
|
+
#toastRef
|
|
582
|
+
data-sonner-toast
|
|
583
|
+
[attr.aria-live]="toast().important ? 'assertive' : 'polite'"
|
|
584
|
+
aria-atomic="true"
|
|
585
|
+
role="status"
|
|
586
|
+
tabindex="0"
|
|
587
|
+
[class]="_toastClasses()"
|
|
588
|
+
[attr.data-styled]="!(toast().component || toast().unstyled || unstyled())"
|
|
589
|
+
[attr.data-mounted]="_mounted()"
|
|
590
|
+
[attr.data-promise]="!!toast().promise"
|
|
591
|
+
[attr.data-removed]="_removed()"
|
|
592
|
+
[attr.data-visible]="_isVisible()"
|
|
593
|
+
[attr.data-y-position]="_coords()[0]"
|
|
594
|
+
[attr.data-x-position]="_coords()[1]"
|
|
595
|
+
[attr.data-index]="index()"
|
|
596
|
+
[attr.data-front]="_isFront()"
|
|
597
|
+
[attr.data-swiping]="_swiping()"
|
|
598
|
+
[attr.data-dismissible]="toast().dismissible"
|
|
599
|
+
[attr.data-type]="_toastType()"
|
|
600
|
+
[attr.data-invert]="_invert()"
|
|
601
|
+
[attr.data-swipe-out]="_swipeOut()"
|
|
602
|
+
[attr.data-expanded]="expanded() || (expandByDefault() && _mounted())"
|
|
603
|
+
[style]="_toastStyle()"
|
|
604
|
+
(pointerdown)="onPointerDown($event)"
|
|
605
|
+
(pointerup)="onPointerUp()"
|
|
606
|
+
(pointermove)="onPointerMove($event)"
|
|
607
|
+
>
|
|
608
|
+
@if (_closeButton() && !toast().component) {
|
|
609
|
+
<button
|
|
610
|
+
aria-label="Close toast"
|
|
611
|
+
[attr.data-disabled]="_disabled()"
|
|
612
|
+
data-close-button
|
|
613
|
+
(click)="onCloseButtonClick()"
|
|
614
|
+
[class]="_closeButtonClasses()"
|
|
615
|
+
>
|
|
616
|
+
<svg
|
|
617
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
618
|
+
width="12"
|
|
619
|
+
height="12"
|
|
620
|
+
viewBox="0 0 24 24"
|
|
621
|
+
fill="none"
|
|
622
|
+
stroke="currentColor"
|
|
623
|
+
stroke-width="1.5"
|
|
624
|
+
stroke-linecap="round"
|
|
625
|
+
stroke-linejoin="round"
|
|
626
|
+
>
|
|
627
|
+
<line x1="18" y1="6" x2="6" y2="18" />
|
|
628
|
+
<line x1="6" y1="6" x2="18" y2="18" />
|
|
629
|
+
</svg>
|
|
630
|
+
</button>
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
@if (toast().component) {
|
|
634
|
+
<ng-container *ngComponentOutlet="toast().component | asComponent; inputs: toast().componentProps" />
|
|
635
|
+
} @else {
|
|
636
|
+
@if (_toastType() !== 'default' || toast().icon || toast().promise) {
|
|
637
|
+
<div data-icon>
|
|
638
|
+
@if (_toastType() === 'loading' && !toast().icon) {
|
|
639
|
+
<ng-content select="[loading-icon]" />
|
|
640
|
+
}
|
|
641
|
+
@if (toast().icon) {
|
|
642
|
+
<ng-container *ngComponentOutlet="toast().icon | asComponent; inputs: toast().componentProps" />
|
|
643
|
+
} @else {
|
|
644
|
+
@switch (_toastType()) {
|
|
645
|
+
@case ('success') {
|
|
646
|
+
<ng-content select="[success-icon]" />
|
|
647
|
+
}
|
|
648
|
+
@case ('error') {
|
|
649
|
+
<ng-content select="[error-icon]" />
|
|
650
|
+
}
|
|
651
|
+
@case ('warning') {
|
|
652
|
+
<ng-content select="[warning-icon]" />
|
|
653
|
+
}
|
|
654
|
+
@case ('info') {
|
|
655
|
+
<ng-content select="[info-icon]" />
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
</div>
|
|
660
|
+
}
|
|
661
|
+
<div data-content>
|
|
662
|
+
@if (toast().title; as title) {
|
|
663
|
+
<div data-title [class]="_titleClasses()">
|
|
664
|
+
@if (title | isString) {
|
|
665
|
+
{{ toast().title }}
|
|
666
|
+
} @else {
|
|
667
|
+
<ng-container *ngComponentOutlet="title | asComponent; inputs: toast().componentProps" />
|
|
668
|
+
}
|
|
669
|
+
</div>
|
|
670
|
+
}
|
|
671
|
+
@if (toast().description; as description) {
|
|
672
|
+
<div data-description [class]="_toastDescriptionClasses()">
|
|
673
|
+
@if (description | isString) {
|
|
674
|
+
{{ toast().description }}
|
|
675
|
+
} @else {
|
|
676
|
+
<ng-container *ngComponentOutlet="description | asComponent; inputs: toast().componentProps" />
|
|
677
|
+
}
|
|
678
|
+
</div>
|
|
679
|
+
}
|
|
680
|
+
</div>
|
|
681
|
+
@if (toast().cancel; as cancel) {
|
|
682
|
+
<button
|
|
683
|
+
data-button
|
|
684
|
+
data-cancel
|
|
685
|
+
[style]="cancelButtonStyle() ?? toast().cancelButtonStyle"
|
|
686
|
+
[class]="_cancelButtonClasses()"
|
|
687
|
+
(click)="onCancelClick()"
|
|
688
|
+
>
|
|
689
|
+
{{ cancel.label }}
|
|
690
|
+
</button>
|
|
691
|
+
}
|
|
692
|
+
@if (toast().action; as action) {
|
|
693
|
+
<button
|
|
694
|
+
data-button
|
|
695
|
+
[style]="actionButtonStyle() ?? toast().actionButtonStyle"
|
|
696
|
+
[class]="_actionButtonClasses()"
|
|
697
|
+
(click)="onActionClick($event)"
|
|
698
|
+
>
|
|
699
|
+
{{ action.label }}
|
|
700
|
+
</button>
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
</li>
|
|
704
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"], exportAs: ["ngComponentOutlet"] }, { kind: "pipe", type: IsStringPipe, name: "isString" }, { kind: "pipe", type: AsComponentPipe, name: "asComponent" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
705
|
+
}
|
|
706
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: BrnSonnerToast, decorators: [{
|
|
707
|
+
type: Component,
|
|
708
|
+
args: [{
|
|
709
|
+
selector: 'brn-sonner-toast',
|
|
710
|
+
imports: [NgComponentOutlet, IsStringPipe, AsComponentPipe],
|
|
711
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
712
|
+
template: `
|
|
713
|
+
<li
|
|
714
|
+
#toastRef
|
|
715
|
+
data-sonner-toast
|
|
716
|
+
[attr.aria-live]="toast().important ? 'assertive' : 'polite'"
|
|
717
|
+
aria-atomic="true"
|
|
718
|
+
role="status"
|
|
719
|
+
tabindex="0"
|
|
720
|
+
[class]="_toastClasses()"
|
|
721
|
+
[attr.data-styled]="!(toast().component || toast().unstyled || unstyled())"
|
|
722
|
+
[attr.data-mounted]="_mounted()"
|
|
723
|
+
[attr.data-promise]="!!toast().promise"
|
|
724
|
+
[attr.data-removed]="_removed()"
|
|
725
|
+
[attr.data-visible]="_isVisible()"
|
|
726
|
+
[attr.data-y-position]="_coords()[0]"
|
|
727
|
+
[attr.data-x-position]="_coords()[1]"
|
|
728
|
+
[attr.data-index]="index()"
|
|
729
|
+
[attr.data-front]="_isFront()"
|
|
730
|
+
[attr.data-swiping]="_swiping()"
|
|
731
|
+
[attr.data-dismissible]="toast().dismissible"
|
|
732
|
+
[attr.data-type]="_toastType()"
|
|
733
|
+
[attr.data-invert]="_invert()"
|
|
734
|
+
[attr.data-swipe-out]="_swipeOut()"
|
|
735
|
+
[attr.data-expanded]="expanded() || (expandByDefault() && _mounted())"
|
|
736
|
+
[style]="_toastStyle()"
|
|
737
|
+
(pointerdown)="onPointerDown($event)"
|
|
738
|
+
(pointerup)="onPointerUp()"
|
|
739
|
+
(pointermove)="onPointerMove($event)"
|
|
740
|
+
>
|
|
741
|
+
@if (_closeButton() && !toast().component) {
|
|
742
|
+
<button
|
|
743
|
+
aria-label="Close toast"
|
|
744
|
+
[attr.data-disabled]="_disabled()"
|
|
745
|
+
data-close-button
|
|
746
|
+
(click)="onCloseButtonClick()"
|
|
747
|
+
[class]="_closeButtonClasses()"
|
|
748
|
+
>
|
|
749
|
+
<svg
|
|
750
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
751
|
+
width="12"
|
|
752
|
+
height="12"
|
|
753
|
+
viewBox="0 0 24 24"
|
|
754
|
+
fill="none"
|
|
755
|
+
stroke="currentColor"
|
|
756
|
+
stroke-width="1.5"
|
|
757
|
+
stroke-linecap="round"
|
|
758
|
+
stroke-linejoin="round"
|
|
759
|
+
>
|
|
760
|
+
<line x1="18" y1="6" x2="6" y2="18" />
|
|
761
|
+
<line x1="6" y1="6" x2="18" y2="18" />
|
|
762
|
+
</svg>
|
|
763
|
+
</button>
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
@if (toast().component) {
|
|
767
|
+
<ng-container *ngComponentOutlet="toast().component | asComponent; inputs: toast().componentProps" />
|
|
768
|
+
} @else {
|
|
769
|
+
@if (_toastType() !== 'default' || toast().icon || toast().promise) {
|
|
770
|
+
<div data-icon>
|
|
771
|
+
@if (_toastType() === 'loading' && !toast().icon) {
|
|
772
|
+
<ng-content select="[loading-icon]" />
|
|
773
|
+
}
|
|
774
|
+
@if (toast().icon) {
|
|
775
|
+
<ng-container *ngComponentOutlet="toast().icon | asComponent; inputs: toast().componentProps" />
|
|
776
|
+
} @else {
|
|
777
|
+
@switch (_toastType()) {
|
|
778
|
+
@case ('success') {
|
|
779
|
+
<ng-content select="[success-icon]" />
|
|
780
|
+
}
|
|
781
|
+
@case ('error') {
|
|
782
|
+
<ng-content select="[error-icon]" />
|
|
783
|
+
}
|
|
784
|
+
@case ('warning') {
|
|
785
|
+
<ng-content select="[warning-icon]" />
|
|
786
|
+
}
|
|
787
|
+
@case ('info') {
|
|
788
|
+
<ng-content select="[info-icon]" />
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
</div>
|
|
793
|
+
}
|
|
794
|
+
<div data-content>
|
|
795
|
+
@if (toast().title; as title) {
|
|
796
|
+
<div data-title [class]="_titleClasses()">
|
|
797
|
+
@if (title | isString) {
|
|
798
|
+
{{ toast().title }}
|
|
799
|
+
} @else {
|
|
800
|
+
<ng-container *ngComponentOutlet="title | asComponent; inputs: toast().componentProps" />
|
|
801
|
+
}
|
|
802
|
+
</div>
|
|
803
|
+
}
|
|
804
|
+
@if (toast().description; as description) {
|
|
805
|
+
<div data-description [class]="_toastDescriptionClasses()">
|
|
806
|
+
@if (description | isString) {
|
|
807
|
+
{{ toast().description }}
|
|
808
|
+
} @else {
|
|
809
|
+
<ng-container *ngComponentOutlet="description | asComponent; inputs: toast().componentProps" />
|
|
810
|
+
}
|
|
811
|
+
</div>
|
|
812
|
+
}
|
|
813
|
+
</div>
|
|
814
|
+
@if (toast().cancel; as cancel) {
|
|
815
|
+
<button
|
|
816
|
+
data-button
|
|
817
|
+
data-cancel
|
|
818
|
+
[style]="cancelButtonStyle() ?? toast().cancelButtonStyle"
|
|
819
|
+
[class]="_cancelButtonClasses()"
|
|
820
|
+
(click)="onCancelClick()"
|
|
821
|
+
>
|
|
822
|
+
{{ cancel.label }}
|
|
823
|
+
</button>
|
|
824
|
+
}
|
|
825
|
+
@if (toast().action; as action) {
|
|
826
|
+
<button
|
|
827
|
+
data-button
|
|
828
|
+
[style]="actionButtonStyle() ?? toast().actionButtonStyle"
|
|
829
|
+
[class]="_actionButtonClasses()"
|
|
830
|
+
(click)="onActionClick($event)"
|
|
831
|
+
>
|
|
832
|
+
{{ action.label }}
|
|
833
|
+
</button>
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
</li>
|
|
837
|
+
`,
|
|
838
|
+
}]
|
|
839
|
+
}], ctorParameters: () => [], propDecorators: { toast: [{ type: i0.Input, args: [{ isSignal: true, alias: "toast", required: true }] }], index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: true }] }], expanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "expanded", required: true }] }], invert: [{ type: i0.Input, args: [{ isSignal: true, alias: "invert", required: true }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: true }] }], visibleToasts: [{ type: i0.Input, args: [{ isSignal: true, alias: "visibleToasts", required: true }] }], expandByDefault: [{ type: i0.Input, args: [{ isSignal: true, alias: "expandByDefault", required: true }] }], closeButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeButton", required: true }] }], interacting: [{ type: i0.Input, args: [{ isSignal: true, alias: "interacting", required: true }] }], cancelButtonStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "cancelButtonStyle", required: false }] }], actionButtonStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionButtonStyle", required: false }] }], duration: [{ type: i0.Input, args: [{ isSignal: true, alias: "duration", required: false }] }], descriptionClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "descriptionClass", required: false }] }], classes: [{ type: i0.Input, args: [{ isSignal: true, alias: "classes", required: false }] }], unstyled: [{ type: i0.Input, args: [{ isSignal: true, alias: "unstyled", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], style: [{ type: i0.Input, args: [{ isSignal: true, alias: "style", required: false }] }], _toastRef: [{ type: i0.ViewChild, args: ['toastRef', { isSignal: true }] }] } });
|
|
840
|
+
|
|
841
|
+
class ToastFilterPipe {
|
|
842
|
+
transform(toasts, index, position) {
|
|
843
|
+
return toasts.filter((toast) => (!toast.position && index === 0) || toast.position === position);
|
|
844
|
+
}
|
|
845
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: ToastFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
846
|
+
/** @nocollapse */ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.17", ngImport: i0, type: ToastFilterPipe, isStandalone: true, name: "toastFilter" });
|
|
847
|
+
}
|
|
848
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: ToastFilterPipe, decorators: [{
|
|
849
|
+
type: Pipe,
|
|
850
|
+
args: [{ name: 'toastFilter' }]
|
|
851
|
+
}] });
|
|
852
|
+
|
|
853
|
+
class BrnSonnerToaster {
|
|
854
|
+
_platformId = inject(PLATFORM_ID);
|
|
855
|
+
_config = injectBrnSonnerToasterConfig();
|
|
856
|
+
_document = inject(DOCUMENT);
|
|
857
|
+
_window = this._document.defaultView;
|
|
858
|
+
_dir = inject(Directionality);
|
|
859
|
+
_toasts = toastState.toasts;
|
|
860
|
+
_heights = toastState.heights;
|
|
861
|
+
_reset = toastState.reset;
|
|
862
|
+
invert = input(false, ...(ngDevMode ? [{ debugName: "invert", transform: booleanAttribute }] : [{
|
|
863
|
+
transform: booleanAttribute,
|
|
864
|
+
}]));
|
|
865
|
+
theme = input('light', ...(ngDevMode ? [{ debugName: "theme" }] : []));
|
|
866
|
+
position = input('bottom-right', ...(ngDevMode ? [{ debugName: "position" }] : []));
|
|
867
|
+
hotKey = input(['altKey', 'KeyT'], ...(ngDevMode ? [{ debugName: "hotKey" }] : []));
|
|
868
|
+
richColors = input(false, ...(ngDevMode ? [{ debugName: "richColors", transform: booleanAttribute }] : [{
|
|
869
|
+
transform: booleanAttribute,
|
|
870
|
+
}]));
|
|
871
|
+
expand = input(false, ...(ngDevMode ? [{ debugName: "expand", transform: booleanAttribute }] : [{
|
|
872
|
+
transform: booleanAttribute,
|
|
873
|
+
}]));
|
|
874
|
+
duration = input(this._config.toastLifetime, ...(ngDevMode ? [{ debugName: "duration", transform: numberAttribute }] : [{
|
|
875
|
+
transform: numberAttribute,
|
|
876
|
+
}]));
|
|
877
|
+
visibleToasts = input(this._config.visibleToastsAmount, ...(ngDevMode ? [{ debugName: "visibleToasts", transform: numberAttribute }] : [{
|
|
878
|
+
transform: numberAttribute,
|
|
879
|
+
}]));
|
|
880
|
+
closeButton = input(false, ...(ngDevMode ? [{ debugName: "closeButton", transform: booleanAttribute }] : [{
|
|
881
|
+
transform: booleanAttribute,
|
|
882
|
+
}]));
|
|
883
|
+
toastOptions = input({}, ...(ngDevMode ? [{ debugName: "toastOptions" }] : []));
|
|
884
|
+
offset = input(null, ...(ngDevMode ? [{ debugName: "offset" }] : []));
|
|
885
|
+
userClass = input('', ...(ngDevMode ? [{ debugName: "userClass", alias: 'class' }] : [{ alias: 'class' }]));
|
|
886
|
+
style = input({}, ...(ngDevMode ? [{ debugName: "style" }] : []));
|
|
887
|
+
_possiblePositions = computed(() => Array.from(new Set([
|
|
888
|
+
this.position(),
|
|
889
|
+
...this._toasts()
|
|
890
|
+
.filter((toast) => toast.position)
|
|
891
|
+
.map((toast) => toast.position),
|
|
892
|
+
].filter(Boolean))), ...(ngDevMode ? [{ debugName: "_possiblePositions" }] : []));
|
|
893
|
+
_expanded = linkedSignal(...(ngDevMode ? [{ debugName: "_expanded", source: this._toasts,
|
|
894
|
+
computation: (toasts) => toasts.length < 1 }] : [{
|
|
895
|
+
source: this._toasts,
|
|
896
|
+
computation: (toasts) => toasts.length < 1,
|
|
897
|
+
}]));
|
|
898
|
+
_actualTheme = linkedSignal(...(ngDevMode ? [{ debugName: "_actualTheme", source: this.theme,
|
|
899
|
+
computation: (newTheme) => this.getActualTheme(newTheme) }] : [{
|
|
900
|
+
source: this.theme,
|
|
901
|
+
computation: (newTheme) => this.getActualTheme(newTheme),
|
|
902
|
+
}]));
|
|
903
|
+
_interacting = signal(false, ...(ngDevMode ? [{ debugName: "_interacting" }] : []));
|
|
904
|
+
/** internal **/
|
|
905
|
+
direction = this._dir.valueSignal;
|
|
906
|
+
_listRef = viewChild('listRef', ...(ngDevMode ? [{ debugName: "_listRef" }] : []));
|
|
907
|
+
_lastFocusedElementRef = signal(null, ...(ngDevMode ? [{ debugName: "_lastFocusedElementRef" }] : []));
|
|
908
|
+
_isFocusWithinRef = signal(false, ...(ngDevMode ? [{ debugName: "_isFocusWithinRef" }] : []));
|
|
909
|
+
_hotKeyLabel = computed(() => this.hotKey().join('+').replace(/Key/g, '').replace(/Digit/g, ''), ...(ngDevMode ? [{ debugName: "_hotKeyLabel" }] : []));
|
|
910
|
+
_toasterStyles = computed(() => ({
|
|
911
|
+
'--front-toast-height': `${this._heights()[0]?.height}px`,
|
|
912
|
+
'--offset': typeof this.offset() === 'number' ? `${this.offset()}px` : (this.offset() ?? `${this._config.viewPortOffset}`),
|
|
913
|
+
'--width': `${this._config.toastWidth}px`,
|
|
914
|
+
'--gap': `${this._config.gap}px`,
|
|
915
|
+
...this.style(),
|
|
916
|
+
}), ...(ngDevMode ? [{ debugName: "_toasterStyles" }] : []));
|
|
917
|
+
_loadingIcon = contentChild('loadingIcon', ...(ngDevMode ? [{ debugName: "_loadingIcon", read: TemplateRef }] : [{ read: TemplateRef }]));
|
|
918
|
+
_successIcon = contentChild('successIcon', ...(ngDevMode ? [{ debugName: "_successIcon", read: TemplateRef }] : [{ read: TemplateRef }]));
|
|
919
|
+
_errorIcon = contentChild('errorIcon', ...(ngDevMode ? [{ debugName: "_errorIcon", read: TemplateRef }] : [{ read: TemplateRef }]));
|
|
920
|
+
_warningIcon = contentChild('warningIcon', ...(ngDevMode ? [{ debugName: "_warningIcon", read: TemplateRef }] : [{ read: TemplateRef }]));
|
|
921
|
+
_infoIcon = contentChild('infoIcon', ...(ngDevMode ? [{ debugName: "_infoIcon", read: TemplateRef }] : [{ read: TemplateRef }]));
|
|
922
|
+
constructor() {
|
|
923
|
+
this._reset();
|
|
924
|
+
const destroyRef = inject(DestroyRef);
|
|
925
|
+
afterNextRender(() => {
|
|
926
|
+
this._document.addEventListener('keydown', this.handleKeydown);
|
|
927
|
+
const window = this._window;
|
|
928
|
+
if (window) {
|
|
929
|
+
this._window
|
|
930
|
+
.matchMedia('(prefers-color-scheme: dark)')
|
|
931
|
+
.addEventListener('change', this.handleThemePreferenceChange);
|
|
932
|
+
}
|
|
933
|
+
destroyRef.onDestroy(() => {
|
|
934
|
+
this._document.removeEventListener('keydown', this.handleKeydown);
|
|
935
|
+
if (window) {
|
|
936
|
+
window
|
|
937
|
+
.matchMedia('(prefers-color-scheme: dark)')
|
|
938
|
+
.removeEventListener('change', this.handleThemePreferenceChange);
|
|
939
|
+
}
|
|
940
|
+
});
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
handleBlur(event) {
|
|
944
|
+
if (this._isFocusWithinRef() && !event.target.contains(event.relatedTarget)) {
|
|
945
|
+
this._isFocusWithinRef.set(false);
|
|
946
|
+
if (this._lastFocusedElementRef()) {
|
|
947
|
+
this._lastFocusedElementRef()?.focus({ preventScroll: true });
|
|
948
|
+
this._lastFocusedElementRef.set(null);
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
handleFocus(event) {
|
|
953
|
+
const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset['dismissible'] === 'false';
|
|
954
|
+
if (isNotDismissible)
|
|
955
|
+
return;
|
|
956
|
+
if (!this._isFocusWithinRef()) {
|
|
957
|
+
this._isFocusWithinRef.set(true);
|
|
958
|
+
this._lastFocusedElementRef.set(event.relatedTarget);
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
handlePointerDown(event) {
|
|
962
|
+
const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset['dismissible'] === 'false';
|
|
963
|
+
if (isNotDismissible)
|
|
964
|
+
return;
|
|
965
|
+
this._interacting.set(true);
|
|
966
|
+
}
|
|
967
|
+
handleMouseLeave() {
|
|
968
|
+
if (!this._interacting()) {
|
|
969
|
+
this._expanded.set(false);
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
handleKeydown = (event) => {
|
|
973
|
+
const listRef = this._listRef()?.nativeElement;
|
|
974
|
+
if (!listRef)
|
|
975
|
+
return;
|
|
976
|
+
const isHotkeyPressed = this.hotKey().every((key) => event[key] || event.code === key);
|
|
977
|
+
if (isHotkeyPressed) {
|
|
978
|
+
this._expanded.set(true);
|
|
979
|
+
listRef.focus();
|
|
980
|
+
}
|
|
981
|
+
if (event.code === 'Escape' &&
|
|
982
|
+
(this._document.activeElement === listRef || listRef.contains(this._document.activeElement))) {
|
|
983
|
+
this._expanded.set(false);
|
|
984
|
+
}
|
|
985
|
+
};
|
|
986
|
+
handleThemePreferenceChange = ({ matches }) => {
|
|
987
|
+
if (this.theme() === 'system') {
|
|
988
|
+
this._actualTheme.set(matches ? 'dark' : 'light');
|
|
989
|
+
}
|
|
990
|
+
};
|
|
991
|
+
getActualTheme(theme) {
|
|
992
|
+
if (theme !== 'system') {
|
|
993
|
+
return theme;
|
|
994
|
+
}
|
|
995
|
+
if (isPlatformBrowser(this._platformId) && this._window) {
|
|
996
|
+
const prefersDark = this._window.matchMedia?.('(prefers-color-scheme: dark)').matches;
|
|
997
|
+
return prefersDark ? 'dark' : 'light';
|
|
998
|
+
}
|
|
999
|
+
return 'light';
|
|
1000
|
+
}
|
|
1001
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: BrnSonnerToaster, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1002
|
+
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.17", type: BrnSonnerToaster, isStandalone: true, selector: "brn-sonner-toaster", inputs: { invert: { classPropertyName: "invert", publicName: "invert", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, hotKey: { classPropertyName: "hotKey", publicName: "hotKey", isSignal: true, isRequired: false, transformFunction: null }, richColors: { classPropertyName: "richColors", publicName: "richColors", isSignal: true, isRequired: false, transformFunction: null }, expand: { classPropertyName: "expand", publicName: "expand", isSignal: true, isRequired: false, transformFunction: null }, duration: { classPropertyName: "duration", publicName: "duration", isSignal: true, isRequired: false, transformFunction: null }, visibleToasts: { classPropertyName: "visibleToasts", publicName: "visibleToasts", isSignal: true, isRequired: false, transformFunction: null }, closeButton: { classPropertyName: "closeButton", publicName: "closeButton", isSignal: true, isRequired: false, transformFunction: null }, toastOptions: { classPropertyName: "toastOptions", publicName: "toastOptions", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, style: { classPropertyName: "style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "_loadingIcon", first: true, predicate: ["loadingIcon"], descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "_successIcon", first: true, predicate: ["successIcon"], descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "_errorIcon", first: true, predicate: ["errorIcon"], descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "_warningIcon", first: true, predicate: ["warningIcon"], descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "_infoIcon", first: true, predicate: ["infoIcon"], descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "_listRef", first: true, predicate: ["listRef"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
1003
|
+
@if (_toasts().length > 0) {
|
|
1004
|
+
<section [attr.aria-label]="'Notifications ' + _hotKeyLabel()" [tabIndex]="-1">
|
|
1005
|
+
@for (pos of _possiblePositions(); track pos) {
|
|
1006
|
+
<ol
|
|
1007
|
+
#listRef
|
|
1008
|
+
[tabIndex]="-1"
|
|
1009
|
+
[class]="userClass()"
|
|
1010
|
+
data-sonner-toaster
|
|
1011
|
+
[attr.data-theme]="_actualTheme()"
|
|
1012
|
+
[attr.data-rich-colors]="richColors()"
|
|
1013
|
+
[attr.dir]="direction()"
|
|
1014
|
+
[attr.data-y-position]="pos.split('-')[0]"
|
|
1015
|
+
[attr.data-x-position]="pos.split('-')[1]"
|
|
1016
|
+
[style]="_toasterStyles()"
|
|
1017
|
+
(blur)="handleBlur($event)"
|
|
1018
|
+
(focus)="handleFocus($event)"
|
|
1019
|
+
(mouseenter)="_expanded.set(true)"
|
|
1020
|
+
(mousemove)="_expanded.set(true)"
|
|
1021
|
+
(mouseleave)="handleMouseLeave()"
|
|
1022
|
+
(pointerdown)="handlePointerDown($event)"
|
|
1023
|
+
(pointerup)="_interacting.set(false)"
|
|
1024
|
+
>
|
|
1025
|
+
@for (toast of _toasts() | toastFilter: $index : pos; track toast.id) {
|
|
1026
|
+
<brn-sonner-toast
|
|
1027
|
+
[index]="$index"
|
|
1028
|
+
[toast]="toast"
|
|
1029
|
+
[invert]="invert()"
|
|
1030
|
+
[visibleToasts]="visibleToasts()"
|
|
1031
|
+
[closeButton]="closeButton()"
|
|
1032
|
+
[interacting]="_interacting()"
|
|
1033
|
+
[position]="pos"
|
|
1034
|
+
[expandByDefault]="expand()"
|
|
1035
|
+
[expanded]="_expanded()"
|
|
1036
|
+
[actionButtonStyle]="toastOptions().actionButtonStyle"
|
|
1037
|
+
[cancelButtonStyle]="toastOptions().cancelButtonStyle"
|
|
1038
|
+
[class]="toastOptions().class ?? ''"
|
|
1039
|
+
[descriptionClass]="toastOptions().descriptionClass ?? ''"
|
|
1040
|
+
[classes]="toastOptions().classes ?? {}"
|
|
1041
|
+
[duration]="toastOptions().duration ?? duration()"
|
|
1042
|
+
[unstyled]="toastOptions().unstyled ?? false"
|
|
1043
|
+
>
|
|
1044
|
+
@if (_loadingIcon(); as loadingIcon) {
|
|
1045
|
+
<ng-container *ngTemplateOutlet="loadingIcon" loading-icon />
|
|
1046
|
+
} @else {
|
|
1047
|
+
<brn-sonner-loader [isVisible]="toast.type === 'loading'" loading-icon />
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
@if (_successIcon(); as successIcon) {
|
|
1051
|
+
<ng-container *ngTemplateOutlet="successIcon" success-icon />
|
|
1052
|
+
} @else {
|
|
1053
|
+
<brn-sonner-icon type="success" success-icon />
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
@if (_errorIcon(); as errorIcon) {
|
|
1057
|
+
<ng-container *ngTemplateOutlet="errorIcon" error-icon />
|
|
1058
|
+
} @else {
|
|
1059
|
+
<brn-sonner-icon type="error" error-icon />
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
@if (_warningIcon(); as warningIcon) {
|
|
1063
|
+
<ng-container *ngTemplateOutlet="warningIcon" warning-icon />
|
|
1064
|
+
} @else {
|
|
1065
|
+
<brn-sonner-icon type="warning" warning-icon />
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
@if (_infoIcon(); as infoIcon) {
|
|
1069
|
+
<ng-container *ngTemplateOutlet="infoIcon" info-icon />
|
|
1070
|
+
} @else {
|
|
1071
|
+
<brn-sonner-icon type="info" info-icon />
|
|
1072
|
+
}
|
|
1073
|
+
</brn-sonner-toast>
|
|
1074
|
+
}
|
|
1075
|
+
</ol>
|
|
1076
|
+
}
|
|
1077
|
+
</section>
|
|
1078
|
+
}
|
|
1079
|
+
`, isInline: true, styles: ["html[dir=ltr],[data-sonner-toaster][dir=ltr]{--toast-icon-margin-start: var(--brn-sonner-toast-icon-margin-start, -3px);--toast-icon-margin-end: var(--brn-sonner-toast-icon-margin-end, 4px);--toast-svg-margin-start: var(--brn-sonner-toast-svg-margin-start, -1px);--toast-svg-margin-end: var(--brn-sonner-toast-svg-margin-end, 0px);--toast-button-margin-start: var(--brn-sonner-toast-button-margin-start, auto);--toast-button-margin-end: var(--brn-sonner-toast-button-margin-end, 0);--toast-close-button-start: var(--brn-sonner-toast-close-button-start, 0);--toast-close-button-end: var(--brn-sonner-toast-close-button-end, unset);--toast-close-button-transform: var(--brn-sonner-toast-close-button-transform, translate(-35%, -35%))}html[dir=rtl],[data-sonner-toaster][dir=rtl]{--toast-icon-margin-start: var(--brn-sonner-rtl-toast-icon-margin-start, 4px);--toast-icon-margin-end: var(--brn-sonner-rtl-toast-icon-margin-end, -3px);--toast-svg-margin-start: var(--brn-sonner-rtl-toast-svg-margin-start, 0px);--toast-svg-margin-end: var(--brn-sonner-rtl-toast-svg-margin-end, -1px);--toast-button-margin-start: var(--brn-sonner-rtl-toast-button-margin-start, 0);--toast-button-margin-end: var(--brn-sonner-rtl-toast-button-margin-end, auto);--toast-close-button-start: var(--brn-sonner-rtl-toast-close-button-start, unset);--toast-close-button-end: var(--brn-sonner-rtl-toast-close-button-end, 0);--toast-close-button-transform: var(--brn-sonner-rtl-toast-close-button-transform, translate(35%, -35%))}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:var( --brn-sonner-font-family, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji );--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: var(--brn-sonner-border-radius, 8px);box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}[data-sonner-toaster][data-x-position=right]{right:max(var(--offset),env(safe-area-inset-right))}[data-sonner-toaster][data-x-position=left]{left:max(var(--offset),env(safe-area-inset-left))}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translate(-50%)}[data-sonner-toaster][data-y-position=top]{top:max(var(--offset),env(safe-area-inset-top))}[data-sonner-toaster][data-y-position=bottom]{bottom:max(var(--offset),env(safe-area-inset-bottom))}[data-sonner-toast]{--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}[data-sonner-toast][data-y-position=top]{top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}[data-sonner-toast] [data-description]{font-weight:400;line-height:1.4;color:inherit}[data-sonner-toast] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast] [data-icon]>*{flex-shrink:0}[data-sonner-toast] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast] [data-button]:focus-visible{box-shadow:var(--brn-sonner-toast-focus-box-shadow, 0 0 0 2px rgba(0, 0, 0, .4))}[data-sonner-toast] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast] [data-cancel]{color:var(--normal-text);background:#00000014}[data-sonner-toast][data-theme=dark] [data-cancel]{background:#ffffff4d}[data-sonner-toast] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--brn-sonner-toast-close-button-background, var(--gray1));color:var(--brn-sonner-toast-close-button-color, var(--gray12));border:var(--brn-sonner-toast-close-button-border, 1px solid var(--gray4));transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]:focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}[data-sonner-toast] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast]:hover [data-close-button]:hover{background:var(--brn-sonner-toast-close-button-hover-background, var(--gray2));color:var(--brn-sonner-toast-close-button-hover-color, var(--gray12));border-color:var(--brn-sonner-toast-close-button-hover-border-color, var(--gray5))}[data-sonner-toast][data-swiping=true]:before{content:\"\";position:absolute;left:0;right:0;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]:before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]:before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]:before{content:\"\";position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast]:after{content:\"\";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y: translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y: translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]:before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - 32px)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: var(--brn-sonner-toast-normal-background, #fff);--normal-border: var(--brn-sonner-toast-normal-border-color, var(--gray4));--normal-text: var(--brn-sonner-toast-normal-color, var(--gray12));--success-bg: var(--brn-sonner-toast-success-background, hsl(143, 85%, 96%));--success-border: var(--brn-sonner-toast-success-border, hsl(145, 92%, 91%));--success-text: var(--brn-sonner-toast-success-color, hsl(140, 100%, 27%));--info-bg: var(--brn-sonner-toast-info-background, hsl(208, 100%, 97%));--info-border: var(--brn-sonner-toast-info-border, hsl(221, 91%, 91%));--info-text: var(--brn-sonner-toast-info-color, hsl(210, 92%, 45%));--warning-bg: var(--brn-sonner-toast-warning-background, hsl(49, 100%, 97%));--warning-border: var(--brn-sonner-toast-warning-border, hsl(49, 91%, 91%));--warning-text: var(--brn-sonner-toast-warning-color, hsl(31, 92%, 45%));--error-bg: var(--brn-sonner-toast-error-background, hsl(359, 100%, 97%));--error-border: var(--brn-sonner-toast-error-border, hsl(359, 100%, 94%));--error-text: var(--brn-sonner-toast-error-color, hsl(360, 100%, 45%))}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: var(--brn-sonner-toast-inverse-normal-background, #000);--normal-border: var(--brn-sonner-toast-inverse-normal-border-color, hsl(0, 0%, 20%));--normal-text: var(--brn-sonner-toast-inverse-normal-color, var(--gray1))}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: var(--brn-sonner-toast-inverse-dark-normal-background, #fff);--normal-border: var(--brn-sonner-toast-inverse-dark-normal-border-color, var(--gray3));--normal-text: var(--brn-sonner-toast-inverse-dark-normal-color, var(--gray12))}[data-sonner-toaster][data-theme=dark]{--normal-bg: var(--brn-sonner-toast-dark-normal-background, #000);--normal-border: var(--brn-sonner-toast-dark-normal-border-color, hsl(0, 0%, 20%));--normal-text: var(--brn-sonner-toast-dark-normal-color, var(--gray1));--success-bg: var(--brn-sonner-toast-dark-success-background, hsl(150, 100%, 6%));--success-border: var(--brn-sonner-toast-dark-success-border, hsl(147, 100%, 12%));--success-text: var(--brn-sonner-toast-dark-success-color, hsl(150, 86%, 65%));--info-bg: var(--brn-sonner-toast-dark-info-background, hsl(215, 100%, 6%));--info-border: var(--brn-sonner-toast-dark-info-border, hsl(223, 100%, 12%));--info-text: var(--brn-sonner-toast-dark-info-color, hsl(216, 87%, 65%));--warning-bg: var(--brn-sonner-toast-dark-warning-background, hsl(64, 100%, 6%));--warning-border: var(--brn-sonner-toast-dark-warning-border, hsl(60, 100%, 12%));--warning-text: var(--brn-sonner-toast-dark-warning-color, hsl(46, 87%, 65%));--error-bg: var(--brn-sonner-toast-dark-error-background, hsl(358, 76%, 10%));--error-border: var(--brn-sonner-toast-dark-error-border, hsl(357, 89%, 16%));--error-text: var(--brn-sonner-toast-dark-error-color, hsl(358, 100%, 81%))}[data-rich-colors=true] [data-sonner-toast][data-type=success],[data-rich-colors=true] [data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true] [data-sonner-toast][data-type=info],[data-rich-colors=true] [data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true] [data-sonner-toast][data-type=warning],[data-rich-colors=true] [data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true] [data-sonner-toast][data-type=error],[data-rich-colors=true] [data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}\n"], dependencies: [{ kind: "component", type: BrnSonnerToast, selector: "brn-sonner-toast", inputs: ["toast", "index", "expanded", "invert", "position", "visibleToasts", "expandByDefault", "closeButton", "interacting", "cancelButtonStyle", "actionButtonStyle", "duration", "descriptionClass", "classes", "unstyled", "class", "style"] }, { kind: "component", type: BrnSonnerIcon, selector: "brn-sonner-icon", inputs: ["type"] }, { kind: "component", type: BrnSonnerLoader, selector: "brn-sonner-loader", inputs: ["isVisible"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: ToastFilterPipe, name: "toastFilter" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1080
|
+
}
|
|
1081
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: BrnSonnerToaster, decorators: [{
|
|
1082
|
+
type: Component,
|
|
1083
|
+
args: [{ selector: 'brn-sonner-toaster', imports: [BrnSonnerToast, ToastFilterPipe, BrnSonnerIcon, BrnSonnerLoader, NgTemplateOutlet], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
1084
|
+
@if (_toasts().length > 0) {
|
|
1085
|
+
<section [attr.aria-label]="'Notifications ' + _hotKeyLabel()" [tabIndex]="-1">
|
|
1086
|
+
@for (pos of _possiblePositions(); track pos) {
|
|
1087
|
+
<ol
|
|
1088
|
+
#listRef
|
|
1089
|
+
[tabIndex]="-1"
|
|
1090
|
+
[class]="userClass()"
|
|
1091
|
+
data-sonner-toaster
|
|
1092
|
+
[attr.data-theme]="_actualTheme()"
|
|
1093
|
+
[attr.data-rich-colors]="richColors()"
|
|
1094
|
+
[attr.dir]="direction()"
|
|
1095
|
+
[attr.data-y-position]="pos.split('-')[0]"
|
|
1096
|
+
[attr.data-x-position]="pos.split('-')[1]"
|
|
1097
|
+
[style]="_toasterStyles()"
|
|
1098
|
+
(blur)="handleBlur($event)"
|
|
1099
|
+
(focus)="handleFocus($event)"
|
|
1100
|
+
(mouseenter)="_expanded.set(true)"
|
|
1101
|
+
(mousemove)="_expanded.set(true)"
|
|
1102
|
+
(mouseleave)="handleMouseLeave()"
|
|
1103
|
+
(pointerdown)="handlePointerDown($event)"
|
|
1104
|
+
(pointerup)="_interacting.set(false)"
|
|
1105
|
+
>
|
|
1106
|
+
@for (toast of _toasts() | toastFilter: $index : pos; track toast.id) {
|
|
1107
|
+
<brn-sonner-toast
|
|
1108
|
+
[index]="$index"
|
|
1109
|
+
[toast]="toast"
|
|
1110
|
+
[invert]="invert()"
|
|
1111
|
+
[visibleToasts]="visibleToasts()"
|
|
1112
|
+
[closeButton]="closeButton()"
|
|
1113
|
+
[interacting]="_interacting()"
|
|
1114
|
+
[position]="pos"
|
|
1115
|
+
[expandByDefault]="expand()"
|
|
1116
|
+
[expanded]="_expanded()"
|
|
1117
|
+
[actionButtonStyle]="toastOptions().actionButtonStyle"
|
|
1118
|
+
[cancelButtonStyle]="toastOptions().cancelButtonStyle"
|
|
1119
|
+
[class]="toastOptions().class ?? ''"
|
|
1120
|
+
[descriptionClass]="toastOptions().descriptionClass ?? ''"
|
|
1121
|
+
[classes]="toastOptions().classes ?? {}"
|
|
1122
|
+
[duration]="toastOptions().duration ?? duration()"
|
|
1123
|
+
[unstyled]="toastOptions().unstyled ?? false"
|
|
1124
|
+
>
|
|
1125
|
+
@if (_loadingIcon(); as loadingIcon) {
|
|
1126
|
+
<ng-container *ngTemplateOutlet="loadingIcon" loading-icon />
|
|
1127
|
+
} @else {
|
|
1128
|
+
<brn-sonner-loader [isVisible]="toast.type === 'loading'" loading-icon />
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
@if (_successIcon(); as successIcon) {
|
|
1132
|
+
<ng-container *ngTemplateOutlet="successIcon" success-icon />
|
|
1133
|
+
} @else {
|
|
1134
|
+
<brn-sonner-icon type="success" success-icon />
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
@if (_errorIcon(); as errorIcon) {
|
|
1138
|
+
<ng-container *ngTemplateOutlet="errorIcon" error-icon />
|
|
1139
|
+
} @else {
|
|
1140
|
+
<brn-sonner-icon type="error" error-icon />
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
@if (_warningIcon(); as warningIcon) {
|
|
1144
|
+
<ng-container *ngTemplateOutlet="warningIcon" warning-icon />
|
|
1145
|
+
} @else {
|
|
1146
|
+
<brn-sonner-icon type="warning" warning-icon />
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
@if (_infoIcon(); as infoIcon) {
|
|
1150
|
+
<ng-container *ngTemplateOutlet="infoIcon" info-icon />
|
|
1151
|
+
} @else {
|
|
1152
|
+
<brn-sonner-icon type="info" info-icon />
|
|
1153
|
+
}
|
|
1154
|
+
</brn-sonner-toast>
|
|
1155
|
+
}
|
|
1156
|
+
</ol>
|
|
1157
|
+
}
|
|
1158
|
+
</section>
|
|
1159
|
+
}
|
|
1160
|
+
`, styles: ["html[dir=ltr],[data-sonner-toaster][dir=ltr]{--toast-icon-margin-start: var(--brn-sonner-toast-icon-margin-start, -3px);--toast-icon-margin-end: var(--brn-sonner-toast-icon-margin-end, 4px);--toast-svg-margin-start: var(--brn-sonner-toast-svg-margin-start, -1px);--toast-svg-margin-end: var(--brn-sonner-toast-svg-margin-end, 0px);--toast-button-margin-start: var(--brn-sonner-toast-button-margin-start, auto);--toast-button-margin-end: var(--brn-sonner-toast-button-margin-end, 0);--toast-close-button-start: var(--brn-sonner-toast-close-button-start, 0);--toast-close-button-end: var(--brn-sonner-toast-close-button-end, unset);--toast-close-button-transform: var(--brn-sonner-toast-close-button-transform, translate(-35%, -35%))}html[dir=rtl],[data-sonner-toaster][dir=rtl]{--toast-icon-margin-start: var(--brn-sonner-rtl-toast-icon-margin-start, 4px);--toast-icon-margin-end: var(--brn-sonner-rtl-toast-icon-margin-end, -3px);--toast-svg-margin-start: var(--brn-sonner-rtl-toast-svg-margin-start, 0px);--toast-svg-margin-end: var(--brn-sonner-rtl-toast-svg-margin-end, -1px);--toast-button-margin-start: var(--brn-sonner-rtl-toast-button-margin-start, 0);--toast-button-margin-end: var(--brn-sonner-rtl-toast-button-margin-end, auto);--toast-close-button-start: var(--brn-sonner-rtl-toast-close-button-start, unset);--toast-close-button-end: var(--brn-sonner-rtl-toast-close-button-end, 0);--toast-close-button-transform: var(--brn-sonner-rtl-toast-close-button-transform, translate(35%, -35%))}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:var( --brn-sonner-font-family, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji );--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: var(--brn-sonner-border-radius, 8px);box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}[data-sonner-toaster][data-x-position=right]{right:max(var(--offset),env(safe-area-inset-right))}[data-sonner-toaster][data-x-position=left]{left:max(var(--offset),env(safe-area-inset-left))}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translate(-50%)}[data-sonner-toaster][data-y-position=top]{top:max(var(--offset),env(safe-area-inset-top))}[data-sonner-toaster][data-y-position=bottom]{bottom:max(var(--offset),env(safe-area-inset-bottom))}[data-sonner-toast]{--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}[data-sonner-toast][data-y-position=top]{top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}[data-sonner-toast] [data-description]{font-weight:400;line-height:1.4;color:inherit}[data-sonner-toast] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast] [data-icon]>*{flex-shrink:0}[data-sonner-toast] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast] [data-button]:focus-visible{box-shadow:var(--brn-sonner-toast-focus-box-shadow, 0 0 0 2px rgba(0, 0, 0, .4))}[data-sonner-toast] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast] [data-cancel]{color:var(--normal-text);background:#00000014}[data-sonner-toast][data-theme=dark] [data-cancel]{background:#ffffff4d}[data-sonner-toast] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--brn-sonner-toast-close-button-background, var(--gray1));color:var(--brn-sonner-toast-close-button-color, var(--gray12));border:var(--brn-sonner-toast-close-button-border, 1px solid var(--gray4));transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]:focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}[data-sonner-toast] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast]:hover [data-close-button]:hover{background:var(--brn-sonner-toast-close-button-hover-background, var(--gray2));color:var(--brn-sonner-toast-close-button-hover-color, var(--gray12));border-color:var(--brn-sonner-toast-close-button-hover-border-color, var(--gray5))}[data-sonner-toast][data-swiping=true]:before{content:\"\";position:absolute;left:0;right:0;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]:before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]:before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]:before{content:\"\";position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast]:after{content:\"\";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y: translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y: translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]:before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - 32px)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: var(--brn-sonner-toast-normal-background, #fff);--normal-border: var(--brn-sonner-toast-normal-border-color, var(--gray4));--normal-text: var(--brn-sonner-toast-normal-color, var(--gray12));--success-bg: var(--brn-sonner-toast-success-background, hsl(143, 85%, 96%));--success-border: var(--brn-sonner-toast-success-border, hsl(145, 92%, 91%));--success-text: var(--brn-sonner-toast-success-color, hsl(140, 100%, 27%));--info-bg: var(--brn-sonner-toast-info-background, hsl(208, 100%, 97%));--info-border: var(--brn-sonner-toast-info-border, hsl(221, 91%, 91%));--info-text: var(--brn-sonner-toast-info-color, hsl(210, 92%, 45%));--warning-bg: var(--brn-sonner-toast-warning-background, hsl(49, 100%, 97%));--warning-border: var(--brn-sonner-toast-warning-border, hsl(49, 91%, 91%));--warning-text: var(--brn-sonner-toast-warning-color, hsl(31, 92%, 45%));--error-bg: var(--brn-sonner-toast-error-background, hsl(359, 100%, 97%));--error-border: var(--brn-sonner-toast-error-border, hsl(359, 100%, 94%));--error-text: var(--brn-sonner-toast-error-color, hsl(360, 100%, 45%))}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: var(--brn-sonner-toast-inverse-normal-background, #000);--normal-border: var(--brn-sonner-toast-inverse-normal-border-color, hsl(0, 0%, 20%));--normal-text: var(--brn-sonner-toast-inverse-normal-color, var(--gray1))}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: var(--brn-sonner-toast-inverse-dark-normal-background, #fff);--normal-border: var(--brn-sonner-toast-inverse-dark-normal-border-color, var(--gray3));--normal-text: var(--brn-sonner-toast-inverse-dark-normal-color, var(--gray12))}[data-sonner-toaster][data-theme=dark]{--normal-bg: var(--brn-sonner-toast-dark-normal-background, #000);--normal-border: var(--brn-sonner-toast-dark-normal-border-color, hsl(0, 0%, 20%));--normal-text: var(--brn-sonner-toast-dark-normal-color, var(--gray1));--success-bg: var(--brn-sonner-toast-dark-success-background, hsl(150, 100%, 6%));--success-border: var(--brn-sonner-toast-dark-success-border, hsl(147, 100%, 12%));--success-text: var(--brn-sonner-toast-dark-success-color, hsl(150, 86%, 65%));--info-bg: var(--brn-sonner-toast-dark-info-background, hsl(215, 100%, 6%));--info-border: var(--brn-sonner-toast-dark-info-border, hsl(223, 100%, 12%));--info-text: var(--brn-sonner-toast-dark-info-color, hsl(216, 87%, 65%));--warning-bg: var(--brn-sonner-toast-dark-warning-background, hsl(64, 100%, 6%));--warning-border: var(--brn-sonner-toast-dark-warning-border, hsl(60, 100%, 12%));--warning-text: var(--brn-sonner-toast-dark-warning-color, hsl(46, 87%, 65%));--error-bg: var(--brn-sonner-toast-dark-error-background, hsl(358, 76%, 10%));--error-border: var(--brn-sonner-toast-dark-error-border, hsl(357, 89%, 16%));--error-text: var(--brn-sonner-toast-dark-error-color, hsl(358, 100%, 81%))}[data-rich-colors=true] [data-sonner-toast][data-type=success],[data-rich-colors=true] [data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true] [data-sonner-toast][data-type=info],[data-rich-colors=true] [data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true] [data-sonner-toast][data-type=warning],[data-rich-colors=true] [data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true] [data-sonner-toast][data-type=error],[data-rich-colors=true] [data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}\n"] }]
|
|
1161
|
+
}], ctorParameters: () => [], propDecorators: { invert: [{ type: i0.Input, args: [{ isSignal: true, alias: "invert", required: false }] }], theme: [{ type: i0.Input, args: [{ isSignal: true, alias: "theme", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], hotKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "hotKey", required: false }] }], richColors: [{ type: i0.Input, args: [{ isSignal: true, alias: "richColors", required: false }] }], expand: [{ type: i0.Input, args: [{ isSignal: true, alias: "expand", required: false }] }], duration: [{ type: i0.Input, args: [{ isSignal: true, alias: "duration", required: false }] }], visibleToasts: [{ type: i0.Input, args: [{ isSignal: true, alias: "visibleToasts", required: false }] }], closeButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeButton", required: false }] }], toastOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "toastOptions", required: false }] }], offset: [{ type: i0.Input, args: [{ isSignal: true, alias: "offset", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], style: [{ type: i0.Input, args: [{ isSignal: true, alias: "style", required: false }] }], _listRef: [{ type: i0.ViewChild, args: ['listRef', { isSignal: true }] }], _loadingIcon: [{ type: i0.ContentChild, args: ['loadingIcon', { ...{ read: TemplateRef }, isSignal: true }] }], _successIcon: [{ type: i0.ContentChild, args: ['successIcon', { ...{ read: TemplateRef }, isSignal: true }] }], _errorIcon: [{ type: i0.ContentChild, args: ['errorIcon', { ...{ read: TemplateRef }, isSignal: true }] }], _warningIcon: [{ type: i0.ContentChild, args: ['warningIcon', { ...{ read: TemplateRef }, isSignal: true }] }], _infoIcon: [{ type: i0.ContentChild, args: ['infoIcon', { ...{ read: TemplateRef }, isSignal: true }] }] } });
|
|
1162
|
+
|
|
1163
|
+
const BrnSonnerImports = [BrnSonnerToaster];
|
|
1164
|
+
|
|
1165
|
+
/**
|
|
1166
|
+
* Generated bundle index. Do not edit.
|
|
1167
|
+
*/
|
|
1168
|
+
|
|
1169
|
+
export { BrnSonnerImports, BrnSonnerToaster, defaultClasses, injectBrnSonnerToasterConfig, provideBrnSonnerToasterConfig, toast, toastState };
|
|
1170
|
+
//# sourceMappingURL=spartan-ng-brain-sonner.mjs.map
|