better-toast 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/fesm2022/better-toast.mjs +242 -384
- package/fesm2022/better-toast.mjs.map +1 -1
- package/package.json +1 -2
- package/types/better-toast.d.ts +15 -33
|
@@ -1,6 +1,50 @@
|
|
|
1
|
-
import { NgComponentOutlet } from '@angular/common';
|
|
2
1
|
import * as i0 from '@angular/core';
|
|
3
|
-
import {
|
|
2
|
+
import { inject, ViewContainerRef, input, effect, untracked, Directive, signal, Injectable, ElementRef, output, computed, afterNextRender, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Tiny dynamic-component host used for headless toasts, custom bodies, and icon overrides.
|
|
6
|
+
* Uses signal inputs and recreates the guest only when the component type changes.
|
|
7
|
+
*/
|
|
8
|
+
class BetterToastOutlet {
|
|
9
|
+
viewContainer = inject(ViewContainerRef);
|
|
10
|
+
betterToastOutlet = input.required(/* @ts-ignore */
|
|
11
|
+
...(ngDevMode ? [{ debugName: "betterToastOutlet" }] : /* istanbul ignore next */ []));
|
|
12
|
+
betterToastOutletInputs = input(/* @ts-ignore */
|
|
13
|
+
...(ngDevMode ? [undefined, { debugName: "betterToastOutletInputs" }] : /* istanbul ignore next */ []));
|
|
14
|
+
ref;
|
|
15
|
+
currentType;
|
|
16
|
+
constructor() {
|
|
17
|
+
effect(() => {
|
|
18
|
+
const component = this.betterToastOutlet();
|
|
19
|
+
const inputs = this.betterToastOutletInputs();
|
|
20
|
+
untracked(() => this.sync(component, inputs));
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
sync(component, inputs) {
|
|
24
|
+
if (this.currentType !== component) {
|
|
25
|
+
this.viewContainer.clear();
|
|
26
|
+
this.ref = undefined;
|
|
27
|
+
this.currentType = component;
|
|
28
|
+
if (component) {
|
|
29
|
+
this.ref = this.viewContainer.createComponent(component);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (!this.ref || !inputs) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
for (const name of Object.keys(inputs)) {
|
|
36
|
+
this.ref.setInput(name, inputs[name]);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: BetterToastOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
40
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: BetterToastOutlet, isStandalone: true, selector: "[betterToastOutlet]", inputs: { betterToastOutlet: { classPropertyName: "betterToastOutlet", publicName: "betterToastOutlet", isSignal: true, isRequired: true, transformFunction: null }, betterToastOutletInputs: { classPropertyName: "betterToastOutletInputs", publicName: "betterToastOutletInputs", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
41
|
+
}
|
|
42
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: BetterToastOutlet, decorators: [{
|
|
43
|
+
type: Directive,
|
|
44
|
+
args: [{
|
|
45
|
+
selector: '[betterToastOutlet]',
|
|
46
|
+
}]
|
|
47
|
+
}], ctorParameters: () => [], propDecorators: { betterToastOutlet: [{ type: i0.Input, args: [{ isSignal: true, alias: "betterToastOutlet", required: true }] }], betterToastOutletInputs: [{ type: i0.Input, args: [{ isSignal: true, alias: "betterToastOutletInputs", required: false }] }] } });
|
|
4
48
|
|
|
5
49
|
/** Fallback when `<app-toaster [duration]>` is absent and a helper omits `durationMs`. */
|
|
6
50
|
const DEFAULT_TOAST_DURATION_MS = 4000;
|
|
@@ -23,6 +67,23 @@ function parseToasterDurationMs(value) {
|
|
|
23
67
|
}
|
|
24
68
|
return value;
|
|
25
69
|
}
|
|
70
|
+
function newToastId() {
|
|
71
|
+
return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
|
|
72
|
+
}
|
|
73
|
+
function chromeFromOptions(options) {
|
|
74
|
+
if (!options) {
|
|
75
|
+
return {};
|
|
76
|
+
}
|
|
77
|
+
const { icon, style, classNames, description, onDismiss, onAutoClose } = options;
|
|
78
|
+
return {
|
|
79
|
+
...(icon !== undefined ? { icon } : {}),
|
|
80
|
+
...(style !== undefined ? { style } : {}),
|
|
81
|
+
...(classNames !== undefined ? { classNames } : {}),
|
|
82
|
+
...(description !== undefined ? { description } : {}),
|
|
83
|
+
...(onDismiss !== undefined ? { onDismiss } : {}),
|
|
84
|
+
...(onAutoClose !== undefined ? { onAutoClose } : {}),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
26
87
|
function shouldScheduleAutoDismiss(durationMs) {
|
|
27
88
|
return Number.isFinite(durationMs) && durationMs > 0;
|
|
28
89
|
}
|
|
@@ -174,10 +235,10 @@ class ToasterService {
|
|
|
174
235
|
* Show a toast whose **message area** is a standalone Angular component while keeping normal toast chrome
|
|
175
236
|
* (surface, icon column when applicable, close button, stack motion).
|
|
176
237
|
*
|
|
177
|
-
* Pass {@link CustomToastOptions.inputs} for `input()`
|
|
238
|
+
* Pass {@link CustomToastOptions.inputs} for `input()` on that component.
|
|
178
239
|
* The component also receives **`toastId`** (matches the returned id) for programmatic dismiss.
|
|
179
240
|
*
|
|
180
|
-
* @param component The component class (must
|
|
241
|
+
* @param component The component class (must work with `ViewContainerRef.createComponent`).
|
|
181
242
|
* @param options Optional configuration object {@link CustomToastOptions}.
|
|
182
243
|
* @returns The toast ID, useful for programmatic dismissal.
|
|
183
244
|
*/
|
|
@@ -191,7 +252,7 @@ class ToasterService {
|
|
|
191
252
|
* Pass {@link HeadlessToastOptions.inputs} to feed `input()` on that component.
|
|
192
253
|
* The component also automatically receives **`toastId`** (matches the returned id) for programmatic dismiss inside the component.
|
|
193
254
|
*
|
|
194
|
-
* @param component The component class (must
|
|
255
|
+
* @param component The component class (must work with `ViewContainerRef.createComponent`).
|
|
195
256
|
* @param options Optional configuration object {@link HeadlessToastOptions}.
|
|
196
257
|
* @returns The toast ID, useful for programmatic dismissal.
|
|
197
258
|
*/
|
|
@@ -293,81 +354,48 @@ class ToasterService {
|
|
|
293
354
|
toast.onDismiss?.();
|
|
294
355
|
}
|
|
295
356
|
}
|
|
357
|
+
pushToast(item, durationMs) {
|
|
358
|
+
this._toasts.update((list) => [...list, item]);
|
|
359
|
+
this.scheduleAutoDismiss(item.id, durationMs);
|
|
360
|
+
return item.id;
|
|
361
|
+
}
|
|
296
362
|
add(message, variant, durationMs, options, toastAction) {
|
|
297
|
-
const id =
|
|
298
|
-
|
|
299
|
-
const style = options?.style;
|
|
300
|
-
const classNames = options?.classNames;
|
|
301
|
-
const onDismiss = options?.onDismiss;
|
|
302
|
-
const onAutoClose = options?.onAutoClose;
|
|
303
|
-
const description = options?.description;
|
|
304
|
-
const item = {
|
|
363
|
+
const id = newToastId();
|
|
364
|
+
return this.pushToast({
|
|
305
365
|
id,
|
|
306
366
|
message,
|
|
307
367
|
variant,
|
|
308
|
-
...(
|
|
309
|
-
...(style !== undefined ? { style } : {}),
|
|
310
|
-
...(classNames !== undefined ? { classNames } : {}),
|
|
311
|
-
...(description !== undefined ? { description } : {}),
|
|
312
|
-
...(onDismiss !== undefined ? { onDismiss } : {}),
|
|
313
|
-
...(onAutoClose !== undefined ? { onAutoClose } : {}),
|
|
368
|
+
...chromeFromOptions(options),
|
|
314
369
|
...(toastAction !== undefined ? { toastAction } : {}),
|
|
315
|
-
};
|
|
316
|
-
this._toasts.update((list) => [...list, item]);
|
|
317
|
-
this.scheduleAutoDismiss(id, durationMs);
|
|
318
|
-
return id;
|
|
370
|
+
}, durationMs);
|
|
319
371
|
}
|
|
320
372
|
addContentComponent(component, variant, durationMs, options) {
|
|
321
|
-
const id =
|
|
322
|
-
|
|
323
|
-
...(options?.inputs ?? {}),
|
|
324
|
-
toastId: id,
|
|
325
|
-
};
|
|
326
|
-
const icon = options?.icon;
|
|
327
|
-
const style = options?.style;
|
|
328
|
-
const classNames = options?.classNames;
|
|
329
|
-
const onDismiss = options?.onDismiss;
|
|
330
|
-
const onAutoClose = options?.onAutoClose;
|
|
331
|
-
const description = options?.description;
|
|
332
|
-
const item = {
|
|
373
|
+
const id = newToastId();
|
|
374
|
+
return this.pushToast({
|
|
333
375
|
id,
|
|
334
376
|
message: '',
|
|
335
377
|
variant,
|
|
336
378
|
contentComponent: component,
|
|
337
|
-
contentComponentInputs:
|
|
338
|
-
...(
|
|
339
|
-
|
|
340
|
-
...(classNames !== undefined ? { classNames } : {}),
|
|
341
|
-
...(description !== undefined ? { description } : {}),
|
|
342
|
-
...(onDismiss !== undefined ? { onDismiss } : {}),
|
|
343
|
-
...(onAutoClose !== undefined ? { onAutoClose } : {}),
|
|
344
|
-
};
|
|
345
|
-
this._toasts.update((list) => [...list, item]);
|
|
346
|
-
this.scheduleAutoDismiss(id, durationMs);
|
|
347
|
-
return id;
|
|
379
|
+
contentComponentInputs: { ...(options?.inputs ?? {}), toastId: id },
|
|
380
|
+
...chromeFromOptions(options),
|
|
381
|
+
}, durationMs);
|
|
348
382
|
}
|
|
349
383
|
addComponent(component, durationMs, options) {
|
|
350
|
-
const id =
|
|
351
|
-
|
|
352
|
-
...(options?.inputs ?? {}),
|
|
353
|
-
toastId: id,
|
|
354
|
-
};
|
|
355
|
-
const classNames = options?.classNames;
|
|
356
|
-
const onDismiss = options?.onDismiss;
|
|
357
|
-
const onAutoClose = options?.onAutoClose;
|
|
358
|
-
const item = {
|
|
384
|
+
const id = newToastId();
|
|
385
|
+
return this.pushToast({
|
|
359
386
|
id,
|
|
360
387
|
message: '',
|
|
361
388
|
variant: 'default',
|
|
362
389
|
component,
|
|
363
|
-
componentInputs,
|
|
364
|
-
...(
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
390
|
+
componentInputs: { ...(options?.inputs ?? {}), toastId: id },
|
|
391
|
+
...chromeFromOptions(options
|
|
392
|
+
? {
|
|
393
|
+
classNames: options.classNames,
|
|
394
|
+
onDismiss: options.onDismiss,
|
|
395
|
+
onAutoClose: options.onAutoClose,
|
|
396
|
+
}
|
|
397
|
+
: undefined),
|
|
398
|
+
}, durationMs);
|
|
371
399
|
}
|
|
372
400
|
updateToast(id, message, variant, durationMs) {
|
|
373
401
|
let found = false;
|
|
@@ -615,27 +643,9 @@ class BetterToastItem {
|
|
|
615
643
|
return true;
|
|
616
644
|
}, /* @ts-ignore */
|
|
617
645
|
...(ngDevMode ? [{ debugName: "shouldShowIconColumn" }] : /* istanbul ignore next */ []));
|
|
618
|
-
/** Bound to {@link ToasterItem.componentInputs} for headless (`NgComponentOutlet`) toasts. */
|
|
619
|
-
componentOutletInputs = computed(() => this.toast()?.componentInputs ?? {}, /* @ts-ignore */
|
|
620
|
-
...(ngDevMode ? [{ debugName: "componentOutletInputs" }] : /* istanbul ignore next */ []));
|
|
621
|
-
/** Bound to {@link ToasterItem.contentComponentInputs} for {@link ToasterService.custom} body components. */
|
|
622
|
-
contentComponentOutletInputs = computed(() => this.toast()?.contentComponentInputs ?? {}, /* @ts-ignore */
|
|
623
|
-
...(ngDevMode ? [{ debugName: "contentComponentOutletInputs" }] : /* istanbul ignore next */ []));
|
|
624
646
|
/** When true, host uses no default toast chrome (border, padding, surface) — only stack + motion. */
|
|
625
647
|
isHeadless = computed(() => this.toast()?.component != null, /* @ts-ignore */
|
|
626
648
|
...(ngDevMode ? [{ debugName: "isHeadless" }] : /* istanbul ignore next */ []));
|
|
627
|
-
/**
|
|
628
|
-
* Dismiss control stays on the front toast. Stacked toasts mount it only while the stack is
|
|
629
|
-
* expanded so `animate.enter` / `animate.leave` can run without moving the front control.
|
|
630
|
-
*/
|
|
631
|
-
showCloseButton = computed(() => this.closeButton() && !this.isHeadless() && (this.stackFront() || this.stackExpanded()), /* @ts-ignore */
|
|
632
|
-
...(ngDevMode ? [{ debugName: "showCloseButton" }] : /* istanbul ignore next */ []));
|
|
633
|
-
/** Enter class for stacked close buttons; the front control does not animate in. */
|
|
634
|
-
closeButtonEnterClass = computed(() => this.stackFront() ? null : 'close-enter', /* @ts-ignore */
|
|
635
|
-
...(ngDevMode ? [{ debugName: "closeButtonEnterClass" }] : /* istanbul ignore next */ []));
|
|
636
|
-
/** Leave class for stacked close buttons; the front control does not animate out. */
|
|
637
|
-
closeButtonLeaveClass = computed(() => this.stackFront() ? null : 'close-leave', /* @ts-ignore */
|
|
638
|
-
...(ngDevMode ? [{ debugName: "closeButtonLeaveClass" }] : /* istanbul ignore next */ []));
|
|
639
649
|
/** `down` when anchored to the bottom (dismiss by swiping down), `up` when anchored to the top. */
|
|
640
650
|
swipeDirection = computed(() => swipeDirectionForPosition(this.stackPosition()), /* @ts-ignore */
|
|
641
651
|
...(ngDevMode ? [{ debugName: "swipeDirection" }] : /* istanbul ignore next */ []));
|
|
@@ -655,10 +665,9 @@ class BetterToastItem {
|
|
|
655
665
|
tracking = false;
|
|
656
666
|
startY = 0;
|
|
657
667
|
pointerId = -1;
|
|
658
|
-
dragStartThreshold = 0;
|
|
659
668
|
swipeCloseThreshold = 30;
|
|
660
669
|
/** Transform applied when swipe-dismiss completes (matches leave direction / headless centering). */
|
|
661
|
-
swipeDismissTransform
|
|
670
|
+
swipeDismissTransform() {
|
|
662
671
|
const pos = this.stackPosition();
|
|
663
672
|
const down = this.swipeDirection() === 'down';
|
|
664
673
|
const y = down ? '130%' : '-130%';
|
|
@@ -666,8 +675,7 @@ class BetterToastItem {
|
|
|
666
675
|
return `translateX(-50%) translateY(${y})`;
|
|
667
676
|
}
|
|
668
677
|
return `translateY(${y})`;
|
|
669
|
-
}
|
|
670
|
-
...(ngDevMode ? [{ debugName: "swipeDismissTransform" }] : /* istanbul ignore next */ []));
|
|
678
|
+
}
|
|
671
679
|
/** Prevents swipe-to-dismiss from starting when pressing the row action / cancel control. */
|
|
672
680
|
onRowButtonPointerDown(event) {
|
|
673
681
|
event.stopPropagation();
|
|
@@ -736,13 +744,7 @@ class BetterToastItem {
|
|
|
736
744
|
const down = this.swipeDirection() === 'down';
|
|
737
745
|
const dragDy = down ? Math.max(0, rawDy) : Math.min(0, rawDy);
|
|
738
746
|
if (!this.isDragging()) {
|
|
739
|
-
const passed =
|
|
740
|
-
? down
|
|
741
|
-
? rawDy >= this.dragStartThreshold
|
|
742
|
-
: rawDy <= -this.dragStartThreshold
|
|
743
|
-
: down
|
|
744
|
-
? rawDy > 0
|
|
745
|
-
: rawDy < 0;
|
|
747
|
+
const passed = down ? rawDy > 0 : rawDy < 0;
|
|
746
748
|
if (passed) {
|
|
747
749
|
this.isDragging.set(true);
|
|
748
750
|
el.setPointerCapture(this.pointerId);
|
|
@@ -805,95 +807,50 @@ class BetterToastItem {
|
|
|
805
807
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: BetterToastItem, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
806
808
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: BetterToastItem, isStandalone: true, selector: "li[betterToastItem]", inputs: { toast: { classPropertyName: "toast", publicName: "toast", isSignal: true, isRequired: false, transformFunction: null }, toasterStyle: { classPropertyName: "toasterStyle", publicName: "toasterStyle", isSignal: true, isRequired: false, transformFunction: null }, toasterClassNames: { classPropertyName: "toasterClassNames", publicName: "toasterClassNames", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, closeButton: { classPropertyName: "closeButton", publicName: "closeButton", isSignal: true, isRequired: false, transformFunction: null }, customIcons: { classPropertyName: "customIcons", publicName: "customIcons", isSignal: true, isRequired: false, transformFunction: null }, dismissButtonAriaLabel: { classPropertyName: "dismissButtonAriaLabel", publicName: "dismissButtonAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, stackPosition: { classPropertyName: "stackPosition", publicName: "stackPosition", isSignal: true, isRequired: false, transformFunction: null }, stackExpanded: { classPropertyName: "stackExpanded", publicName: "stackExpanded", isSignal: true, isRequired: false, transformFunction: null }, stackFront: { classPropertyName: "stackFront", publicName: "stackFront", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { stackHover: "stackHover", heightChange: "heightChange" }, host: { attributes: { "role": "listitem", "tabindex": "0" }, listeners: { "pointerdown": "onPointerDown($event)", "pointermove": "onPointerMove($event)", "pointerup": "onPointerUp()", "pointercancel": "onPointerCancel()", "pointerenter": "onPointerEnter()", "pointerleave": "onPointerLeave($event)" }, properties: { "class": "resolvedClassNames()?.toast", "attr.data-variant": "variant()", "attr.data-icon": "shouldShowIconColumn() ? \"true\" : \"false\"", "attr.data-headless": "isHeadless() ? \"true\" : null", "attr.data-swipe-direction": "swipeDirection()", "attr.data-theme": "theme()", "style.--initial-height": "initialHeightCss()", "style": "isHeadless() ? undefined : hostStyle()", "animate.leave": "\"leave\"" }, classAttribute: "toast" }, ngImport: i0, template: `
|
|
807
809
|
@if (toast()?.component) {
|
|
808
|
-
<ng-container
|
|
810
|
+
<ng-container
|
|
811
|
+
[betterToastOutlet]="toast()!.component!"
|
|
812
|
+
[betterToastOutletInputs]="toast()?.componentInputs"
|
|
813
|
+
/>
|
|
809
814
|
} @else {
|
|
810
815
|
@if (shouldShowIconColumn()) {
|
|
811
816
|
<span class="toast-icon" aria-hidden="true">
|
|
812
817
|
@if (toast()?.icon) {
|
|
813
|
-
<ng-container
|
|
818
|
+
<ng-container [betterToastOutlet]="toast()!.icon!" />
|
|
814
819
|
} @else if (iconComponent(); as IconCmp) {
|
|
815
|
-
<ng-container
|
|
820
|
+
<ng-container [betterToastOutlet]="IconCmp" />
|
|
821
|
+
} @else if (variant() === 'loading') {
|
|
822
|
+
<div class="toast-icon-loading"></div>
|
|
816
823
|
} @else {
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
stroke-linejoin="round"
|
|
832
|
-
stroke-width="1.75"
|
|
833
|
-
/>
|
|
834
|
-
<path
|
|
835
|
-
stroke="currentColor"
|
|
836
|
-
stroke-linecap="round"
|
|
837
|
-
stroke-linejoin="round"
|
|
838
|
-
stroke-width="1.75"
|
|
839
|
-
d="M8.48 12.22 10.9 14.64 15.74 9.14"
|
|
840
|
-
/>
|
|
841
|
-
</svg>
|
|
842
|
-
}
|
|
843
|
-
@case ('error') {
|
|
844
|
-
<svg
|
|
845
|
-
aria-hidden="true"
|
|
846
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
847
|
-
viewBox="0 0 24 24"
|
|
848
|
-
fill="none"
|
|
849
|
-
stroke="currentColor"
|
|
850
|
-
stroke-width="2"
|
|
851
|
-
stroke-linecap="round"
|
|
852
|
-
stroke-linejoin="round"
|
|
853
|
-
>
|
|
824
|
+
<svg
|
|
825
|
+
fill="none"
|
|
826
|
+
viewBox="0 0 24 24"
|
|
827
|
+
stroke="currentColor"
|
|
828
|
+
stroke-linecap="round"
|
|
829
|
+
stroke-linejoin="round"
|
|
830
|
+
[attr.stroke-width]="variant() === 'error' ? 2 : 1.75"
|
|
831
|
+
>
|
|
832
|
+
@switch (variant()) {
|
|
833
|
+
@case ('success') {
|
|
834
|
+
<circle cx="12" cy="12" r="9" />
|
|
835
|
+
<path d="M8.48 12.22 10.9 14.64 15.74 9.14" />
|
|
836
|
+
}
|
|
837
|
+
@case ('error') {
|
|
854
838
|
<circle cx="12" cy="12" r="10" />
|
|
855
839
|
<line x1="9" y1="9" x2="15" y2="15" />
|
|
856
840
|
<line x1="15" y1="9" x2="9" y2="15" />
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
@case ('info') {
|
|
860
|
-
<svg
|
|
861
|
-
aria-hidden="true"
|
|
862
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
863
|
-
viewBox="0 0 24 24"
|
|
864
|
-
fill="none"
|
|
865
|
-
stroke="currentColor"
|
|
866
|
-
stroke-width="1.75"
|
|
867
|
-
stroke-linecap="round"
|
|
868
|
-
stroke-linejoin="round"
|
|
869
|
-
>
|
|
841
|
+
}
|
|
842
|
+
@case ('info') {
|
|
870
843
|
<circle cx="12" cy="12" r="10" />
|
|
871
844
|
<line x1="12" y1="16" x2="12" y2="12" />
|
|
872
845
|
<line x1="12" y1="8" x2="12.01" y2="8" />
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
@case ('warning') {
|
|
876
|
-
<svg
|
|
877
|
-
aria-hidden="true"
|
|
878
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
879
|
-
fill="none"
|
|
880
|
-
viewBox="0 0 24 24"
|
|
881
|
-
>
|
|
846
|
+
}
|
|
847
|
+
@case ('warning') {
|
|
882
848
|
<path
|
|
883
|
-
stroke="currentColor"
|
|
884
|
-
stroke-linecap="round"
|
|
885
|
-
stroke-linejoin="round"
|
|
886
|
-
stroke-width="1.75"
|
|
887
849
|
d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"
|
|
888
850
|
/>
|
|
889
|
-
|
|
851
|
+
}
|
|
890
852
|
}
|
|
891
|
-
|
|
892
|
-
<div class="toast-icon-loading" aria-hidden="true"></div>
|
|
893
|
-
}
|
|
894
|
-
@case ('description') {}
|
|
895
|
-
@case ('default') {}
|
|
896
|
-
}
|
|
853
|
+
</svg>
|
|
897
854
|
}
|
|
898
855
|
</span>
|
|
899
856
|
}
|
|
@@ -903,10 +860,8 @@ class BetterToastItem {
|
|
|
903
860
|
@if (toast()?.contentComponent) {
|
|
904
861
|
<div class="msg" [class]="resolvedClassNames()?.message">
|
|
905
862
|
<ng-container
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
inputs: contentComponentOutletInputs()
|
|
909
|
-
"
|
|
863
|
+
[betterToastOutlet]="toast()!.contentComponent!"
|
|
864
|
+
[betterToastOutletInputs]="toast()?.contentComponentInputs"
|
|
910
865
|
/>
|
|
911
866
|
</div>
|
|
912
867
|
} @else {
|
|
@@ -922,10 +877,8 @@ class BetterToastItem {
|
|
|
922
877
|
@if (toast()?.contentComponent) {
|
|
923
878
|
<div class="msg" [class]="resolvedClassNames()?.message">
|
|
924
879
|
<ng-container
|
|
925
|
-
|
|
926
|
-
toast()
|
|
927
|
-
inputs: contentComponentOutletInputs()
|
|
928
|
-
"
|
|
880
|
+
[betterToastOutlet]="toast()!.contentComponent!"
|
|
881
|
+
[betterToastOutletInputs]="toast()?.contentComponentInputs"
|
|
929
882
|
/>
|
|
930
883
|
</div>
|
|
931
884
|
} @else {
|
|
@@ -934,61 +887,53 @@ class BetterToastItem {
|
|
|
934
887
|
}
|
|
935
888
|
|
|
936
889
|
@if (toast()?.toastAction; as rowAction) {
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
(
|
|
945
|
-
(
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
class="toast-row-btn cancel-btn"
|
|
954
|
-
[class]="resolvedClassNames()?.cancelButton"
|
|
955
|
-
[attr.data-row-btn]="rowAction.role"
|
|
956
|
-
(pointerdown)="onRowButtonPointerDown($event)"
|
|
957
|
-
(click)="onToastRowClick($event)"
|
|
958
|
-
>
|
|
959
|
-
{{ rowAction.label }}
|
|
960
|
-
</button>
|
|
961
|
-
}
|
|
962
|
-
}
|
|
890
|
+
<button
|
|
891
|
+
type="button"
|
|
892
|
+
class="toast-row-btn"
|
|
893
|
+
[class.action-btn]="rowAction.role === 'action'"
|
|
894
|
+
[class.cancel-btn]="rowAction.role === 'cancel'"
|
|
895
|
+
[class]="
|
|
896
|
+
rowAction.role === 'action'
|
|
897
|
+
? resolvedClassNames()?.actionButton
|
|
898
|
+
: resolvedClassNames()?.cancelButton
|
|
899
|
+
"
|
|
900
|
+
[attr.data-row-btn]="rowAction.role"
|
|
901
|
+
(pointerdown)="onRowButtonPointerDown($event)"
|
|
902
|
+
(click)="onToastRowClick($event)"
|
|
903
|
+
>
|
|
904
|
+
{{ rowAction.label }}
|
|
905
|
+
</button>
|
|
963
906
|
}
|
|
964
907
|
}
|
|
965
908
|
|
|
966
|
-
@if (
|
|
909
|
+
@if (closeButton() && !isHeadless() && (stackFront() || stackExpanded())) {
|
|
967
910
|
<button
|
|
968
911
|
type="button"
|
|
969
912
|
class="close-btn"
|
|
970
913
|
[class]="resolvedClassNames()?.closeButton"
|
|
971
|
-
[animate.enter]="
|
|
972
|
-
[animate.leave]="
|
|
914
|
+
[animate.enter]="stackFront() ? null : 'close-enter'"
|
|
915
|
+
[animate.leave]="stackFront() ? null : 'close-leave'"
|
|
973
916
|
(click)="toaster.dismiss(toast()?.id ?? '')"
|
|
974
917
|
[attr.aria-label]="dismissButtonAriaLabel()"
|
|
975
918
|
>
|
|
976
|
-
<svg
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
919
|
+
<svg
|
|
920
|
+
fill="none"
|
|
921
|
+
viewBox="0 0 24 24"
|
|
922
|
+
stroke="currentColor"
|
|
923
|
+
stroke-linecap="round"
|
|
924
|
+
stroke-linejoin="round"
|
|
925
|
+
stroke-width="1.75"
|
|
926
|
+
aria-hidden="true"
|
|
927
|
+
>
|
|
928
|
+
<path d="M6 18 18 6M6 6l12 12" />
|
|
984
929
|
</svg>
|
|
985
930
|
</button>
|
|
986
931
|
}
|
|
987
|
-
`, isInline: true, styles: [":host{--_chrome-bg: var(--toast-bg);--_chrome-fg: var(--toast-color);--_chrome-border: var(--toast-border-color);--_icon-fill: light-dark(var(--toast-color), var(--toast-bg));--_icon-stroke: light-dark(var(--toast-bg), var(--toast-color));--_icon-color: var(--_icon-stroke);--_toast-x: 0%;--_toast-y: 0px;--_toast-enter-y: 0px;--_toast-leave-y: 0px;--toast-line-height: 1.35;--index: 0;--collapsed-peek: 14px;--offset: calc(var(--index, 0) * var(--collapsed-peek));display:flex;align-items:center;gap:.375rem;flex:1;min-width:0;width:100%;padding-inline:.75rem;padding-block:1rem;box-sizing:border-box;border:1px solid var(--_chrome-border);border-radius:.5rem;box-shadow:var(--toast-shadow);background:var(--_chrome-bg);color:var(--_chrome-fg);font:500 .875rem/var(--toast-line-height) system-ui,sans-serif;pointer-events:auto;touch-action:none;-webkit-user-select:none;user-select:none;position:absolute;opacity:1;height:var(--initial-height, auto);scale:1;z-index:calc(1000 - var(--index, 0));transform:translate(var(--_toast-x)) translateY(var(--_toast-y));transition:opacity .4s ease,transform .4s ease,scale .4s ease,height .4s ease,box-shadow .2s ease}@starting-style{:host{opacity:0;transform:translate(var(--_toast-x)) translateY(var(--_toast-enter-y))}}:host>*:not(.close-btn){transition:opacity .4s ease}:host([data-expanded=\"true\"]):after{content:\"\";position:absolute;left:0;width:100%;height:calc(var(--toast-gap, 16px) + 1px);bottom:100%;pointer-events:auto}:host([data-variant=\"loading\"]){touch-action:auto}:host([data-position^=\"bottom\"]){bottom:0;transform-origin:50% 100%;--_toast-y: calc(-1 * var(--offset, 0px));--_toast-enter-y: 100%}:host([data-position^=\"top\"]){top:0;transform-origin:50% 0;--_toast-y: calc(1 * var(--offset, 0px));--_toast-enter-y: -100%}:host([data-swipe-direction=\"down\"]){--_toast-leave-y: 100%}:host([data-swipe-direction=\"up\"]){--_toast-leave-y: -100%}:host([data-expanded=\"false\"]){scale:calc(1 - var(--index, 0) * .05)}:host([data-expanded=\"false\"]:not(:last-child)){height:var(--front-toast-height);overflow:hidden}:host([data-expanded=\"false\"]:not(:last-child):not([data-headless=\"true\"]))>*:not(.close-btn){opacity:0;pointer-events:none}:host([data-expanded=\"false\"]:nth-last-child(n + 4)){opacity:0;pointer-events:none}:host([data-rich-colors=\"true\"][data-variant=\"success\"]){--_chrome-bg: var(--toast-success-bg);--_chrome-fg: var(--toast-success-text);--_chrome-border: var(--toast-success-border)}:host([data-rich-colors=\"true\"][data-variant=\"error\"]){--_chrome-bg: var(--toast-error-bg);--_chrome-fg: var(--toast-error-text);--_chrome-border: var(--toast-error-border)}:host([data-rich-colors=\"true\"][data-variant=\"info\"]){--_chrome-bg: var(--toast-info-bg);--_chrome-fg: var(--toast-info-text);--_chrome-border: var(--toast-info-border)}:host([data-rich-colors=\"true\"][data-variant=\"warning\"]){--_chrome-bg: var(--toast-warning-bg);--_chrome-fg: var(--toast-warning-text);--_chrome-border: var(--toast-warning-border)}:host([data-rich-colors=\"true\"]:is([data-variant=\"success\"],[data-variant=\"error\"],[data-variant=\"info\"],[data-variant=\"warning\"])){--_icon-fill: light-dark(var(--_chrome-fg), var(--_chrome-bg));--_icon-stroke: light-dark(var(--_chrome-bg), var(--_chrome-fg));--_icon-color: var(--_icon-stroke)}:host([data-headless=\"true\"]){width:max-content;max-width:calc(100dvw - var(--toast-offset-mobile-left, 16px) - var(--toast-offset-mobile-right, 16px));padding:0;gap:0;border:none;border-radius:0;box-shadow:none;background:transparent;color:inherit;font:inherit;line-height:normal;--toast-line-height: inherit}@starting-style{:host([data-headless=\"true\"]){opacity:1}}:host([data-headless=\"true\"][data-position=\"bottom-center\"]),:host([data-headless=\"true\"][data-position=\"top-center\"]){left:50%;right:auto;--_toast-x: -50%}:host([data-headless=\"true\"][data-icon=\"false\"]){padding-left:0}:host([data-icon=\"false\"]){padding-left:.925rem}@media(width>=40rem){:host{width:var(--toast-width)}:host([data-headless=\"true\"]){max-width:calc(100dvw - var(--toast-offset-left, 24px) - var(--toast-offset-right, 24px))}:host([data-headless=\"true\"][data-position$=\"-right\"]){left:auto;right:0}:host([data-headless=\"true\"][data-position$=\"-left\"]){left:0;right:auto}}@media(width<40rem){:host([data-headless=\"true\"][data-position^=\"bottom\"]),:host([data-headless=\"true\"][data-position^=\"top\"]){left:50%;right:auto;--_toast-x: -50%}}.toast-icon,.toast-icon ::ng-deep{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:1.425rem;height:1.425rem}.toast-icon svg,.toast-icon ::ng-deep svg{display:block;margin-inline:auto;fill:var(--_icon-fill);stroke:var(--_icon-stroke);color:var(--_icon-color);width:95%;height:95%}:host([data-theme=\"dark\"]) .toast-icon svg,:host([data-theme=\"dark\"]) .toast-icon ::ng-deep svg{width:87.5%;height:87.5%}@media(prefers-color-scheme:dark){:host([data-theme=\"system\"]) .toast-icon svg,:host([data-theme=\"system\"]) .toast-icon ::ng-deep svg{width:87.5%;height:87.5%}}.toast-icon-loading{display:block;width:.9rem;height:.9rem;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;border-right-color:transparent;animation:spin .45s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.msg{flex:1;min-width:0;max-width:95%;margin:0;font-size:.825rem;font-weight:500;line-height:calc(1.25 / .875);letter-spacing:.01em}@media(width<40rem){.msg{max-width:90%;font-size:.8rem}}.stack{display:flex;flex-direction:column;align-items:flex-start;gap:.25rem;flex:1;min-width:0}.stack .msg{flex:0 1 auto;max-width:100%}:host([data-icon=\"false\"]) .stack .msg{max-width:90%}.description{margin:0;font-size:.825rem;font-weight:400;line-height:1.35;letter-spacing:.01em;opacity:.9;max-width:100%}@media(width<40rem){.description{font-size:.8rem}}.toast-row-btn{flex-shrink:0;margin:0;margin-inline-start:auto;padding:.35rem .65rem;border-radius:.375rem;border:1px solid transparent;font:inherit;font-size:.8rem;font-weight:600;letter-spacing:.01em;line-height:1.2;cursor:pointer;white-space:nowrap;transition:transform .2s ease}.toast-row-btn:focus-visible{outline:2px solid var(--toast-color);outline-offset:2px}.toast-row-btn:active{transform:scale(.95)}.action-btn{background:var(--toast-action-bg);color:var(--toast-action-text);border-color:var(--toast-action-border)}.cancel-btn{background:var(--toast-cancel-bg);color:var(--toast-color);border-color:var(--toast-cancel-border)}.
|
|
932
|
+
`, isInline: true, styles: [":host{--_chrome-bg: var(--toast-bg);--_chrome-fg: var(--toast-color);--_chrome-border: var(--toast-border-color);--_icon-fill: light-dark(var(--toast-color), var(--toast-bg));--_icon-stroke: light-dark(var(--toast-bg), var(--toast-color));--_icon-color: var(--_icon-stroke);--_toast-x: 0%;--_toast-y: 0px;--_toast-enter-y: 0px;--_toast-leave-y: 0px;--toast-line-height: 1.35;--index: 0;--collapsed-peek: 14px;--offset: calc(var(--index, 0) * var(--collapsed-peek));display:flex;align-items:center;gap:.375rem;flex:1;min-width:0;width:100%;padding-inline:.75rem;padding-block:1rem;box-sizing:border-box;border:1px solid var(--_chrome-border);border-radius:.5rem;box-shadow:var(--toast-shadow);background:var(--_chrome-bg);color:var(--_chrome-fg);font:500 .875rem/var(--toast-line-height) system-ui,sans-serif;pointer-events:auto;touch-action:none;-webkit-user-select:none;user-select:none;position:absolute;opacity:1;height:var(--initial-height, auto);scale:1;z-index:calc(1000 - var(--index, 0));transform:translate(var(--_toast-x)) translateY(var(--_toast-y));transition:opacity .4s ease,transform .4s ease,scale .4s ease,height .4s ease,box-shadow .2s ease}@starting-style{:host{opacity:0;transform:translate(var(--_toast-x)) translateY(var(--_toast-enter-y))}}:host>*:not(.close-btn){transition:opacity .4s ease}:host([data-expanded=\"true\"]):after{content:\"\";position:absolute;left:0;width:100%;height:calc(var(--toast-gap, 16px) + 1px);bottom:100%;pointer-events:auto}:host([data-variant=\"loading\"]){touch-action:auto}:host([data-position^=\"bottom\"]){bottom:0;transform-origin:50% 100%;--_toast-y: calc(-1 * var(--offset, 0px));--_toast-enter-y: 100%}:host([data-position^=\"top\"]){top:0;transform-origin:50% 0;--_toast-y: calc(1 * var(--offset, 0px));--_toast-enter-y: -100%}:host([data-swipe-direction=\"down\"]){--_toast-leave-y: 100%}:host([data-swipe-direction=\"up\"]){--_toast-leave-y: -100%}:host([data-expanded=\"false\"]){scale:calc(1 - var(--index, 0) * .05)}:host([data-expanded=\"false\"]:not(:last-child)){height:var(--front-toast-height);overflow:hidden}:host([data-expanded=\"false\"]:not(:last-child):not([data-headless=\"true\"]))>*:not(.close-btn){opacity:0;pointer-events:none}:host([data-expanded=\"false\"]:nth-last-child(n + 4)){opacity:0;pointer-events:none}:host([data-rich-colors=\"true\"][data-variant=\"success\"]){--_chrome-bg: var(--toast-success-bg);--_chrome-fg: var(--toast-success-text);--_chrome-border: var(--toast-success-border)}:host([data-rich-colors=\"true\"][data-variant=\"error\"]){--_chrome-bg: var(--toast-error-bg);--_chrome-fg: var(--toast-error-text);--_chrome-border: var(--toast-error-border)}:host([data-rich-colors=\"true\"][data-variant=\"info\"]){--_chrome-bg: var(--toast-info-bg);--_chrome-fg: var(--toast-info-text);--_chrome-border: var(--toast-info-border)}:host([data-rich-colors=\"true\"][data-variant=\"warning\"]){--_chrome-bg: var(--toast-warning-bg);--_chrome-fg: var(--toast-warning-text);--_chrome-border: var(--toast-warning-border)}:host([data-rich-colors=\"true\"]:is([data-variant=\"success\"],[data-variant=\"error\"],[data-variant=\"info\"],[data-variant=\"warning\"])){--_icon-fill: light-dark(var(--_chrome-fg), var(--_chrome-bg));--_icon-stroke: light-dark(var(--_chrome-bg), var(--_chrome-fg));--_icon-color: var(--_icon-stroke)}:host([data-headless=\"true\"]){width:max-content;max-width:calc(100dvw - var(--toast-offset-mobile-left, 16px) - var(--toast-offset-mobile-right, 16px));padding:0;gap:0;border:none;border-radius:0;box-shadow:none;background:transparent;color:inherit;font:inherit;line-height:normal;--toast-line-height: inherit}@starting-style{:host([data-headless=\"true\"]){opacity:1}}:host([data-headless=\"true\"][data-position=\"bottom-center\"]),:host([data-headless=\"true\"][data-position=\"top-center\"]){left:50%;right:auto;--_toast-x: -50%}:host([data-headless=\"true\"][data-icon=\"false\"]){padding-left:0}:host([data-icon=\"false\"]){padding-left:.925rem}@media(width>=40rem){:host{width:var(--toast-width)}:host([data-headless=\"true\"]){max-width:calc(100dvw - var(--toast-offset-left, 24px) - var(--toast-offset-right, 24px))}:host([data-headless=\"true\"][data-position$=\"-right\"]){left:auto;right:0}:host([data-headless=\"true\"][data-position$=\"-left\"]){left:0;right:auto}}@media(width<40rem){:host([data-headless=\"true\"][data-position^=\"bottom\"]),:host([data-headless=\"true\"][data-position^=\"top\"]){left:50%;right:auto;--_toast-x: -50%}}.toast-icon,.toast-icon ::ng-deep{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:1.425rem;height:1.425rem}.toast-icon svg,.toast-icon ::ng-deep svg{display:block;margin-inline:auto;fill:var(--_icon-fill);stroke:var(--_icon-stroke);color:var(--_icon-color);width:95%;height:95%}:host([data-theme=\"dark\"]) .toast-icon svg,:host([data-theme=\"dark\"]) .toast-icon ::ng-deep svg{width:87.5%;height:87.5%}@media(prefers-color-scheme:dark){:host([data-theme=\"system\"]) .toast-icon svg,:host([data-theme=\"system\"]) .toast-icon ::ng-deep svg{width:87.5%;height:87.5%}}.toast-icon-loading{display:block;width:.9rem;height:.9rem;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;border-right-color:transparent;animation:spin .45s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.msg{flex:1;min-width:0;max-width:95%;margin:0;font-size:.825rem;font-weight:500;line-height:calc(1.25 / .875);letter-spacing:.01em}@media(width<40rem){.msg{max-width:90%;font-size:.8rem}}.stack{display:flex;flex-direction:column;align-items:flex-start;gap:.25rem;flex:1;min-width:0}.stack .msg{flex:0 1 auto;max-width:100%}:host([data-icon=\"false\"]) .stack .msg{max-width:90%}.description{margin:0;font-size:.825rem;font-weight:400;line-height:1.35;letter-spacing:.01em;opacity:.9;max-width:100%}@media(width<40rem){.description{font-size:.8rem}}.toast-row-btn{flex-shrink:0;margin:0;margin-inline-start:auto;padding:.35rem .65rem;border-radius:.375rem;border:1px solid transparent;font:inherit;font-size:.8rem;font-weight:600;letter-spacing:.01em;line-height:1.2;cursor:pointer;white-space:nowrap;transition:transform .2s ease}.toast-row-btn:focus-visible{outline:2px solid var(--toast-color);outline-offset:2px}.toast-row-btn:active{transform:scale(.95)}.action-btn{background:var(--toast-action-bg);color:var(--toast-action-text);border-color:var(--toast-action-border)}.cancel-btn{background:var(--toast-cancel-bg);color:var(--toast-color);border-color:var(--toast-cancel-border)}.close-btn{position:absolute;top:-.3875rem;right:-.3875rem;flex-shrink:0;margin:-.15rem -.25rem -.15rem 0;border:1px solid var(--_chrome-border);box-shadow:var(--toast-shadow);background:var(--_chrome-bg);color:var(--_chrome-fg);cursor:pointer;line-height:1;padding:.25rem;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;opacity:1;scale:1;filter:blur(0)}.close-btn.close-enter{opacity:1;scale:1;filter:blur(0);transition:opacity .18s cubic-bezier(.19,1,.22,1),scale .18s cubic-bezier(.19,1,.22,1),filter .18s cubic-bezier(.19,1,.22,1)}@starting-style{.close-btn.close-enter{opacity:0;scale:.92;filter:blur(4px)}}.close-btn.close-leave{opacity:0;scale:.92;filter:blur(4px);pointer-events:none;transition:opacity .15s cubic-bezier(.19,1,.22,1),scale .15s cubic-bezier(.19,1,.22,1),filter .15s cubic-bezier(.19,1,.22,1)}.close-btn:focus-visible{outline:2px solid currentColor}.close-btn svg{display:block;width:.825rem;height:.825rem}:host(.leave){opacity:0;scale:.95;transform:translate(var(--_toast-x)) translateY(var(--_toast-leave-y))}@media(prefers-reduced-motion:reduce){:host{transition:none}:host([data-position]){--_toast-enter-y: var(--_toast-y);--_toast-leave-y: var(--_toast-y)}:host>*{transition:none}:host(.leave){scale:1}.toast-row-btn:active{transform:none}.close-btn.close-enter{scale:1;filter:none;transition:opacity .15s ease}@starting-style{.close-btn.close-enter{opacity:0;scale:1;filter:none}}.close-btn.close-leave{scale:1;filter:none;transition:opacity .15s ease}.toast-icon-loading{animation:none}}\n"], dependencies: [{ kind: "directive", type: BetterToastOutlet, selector: "[betterToastOutlet]", inputs: ["betterToastOutlet", "betterToastOutletInputs"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
988
933
|
}
|
|
989
934
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: BetterToastItem, decorators: [{
|
|
990
935
|
type: Component,
|
|
991
|
-
args: [{ selector: 'li[betterToastItem]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
936
|
+
args: [{ selector: 'li[betterToastItem]', changeDetection: ChangeDetectionStrategy.OnPush, imports: [BetterToastOutlet], host: {
|
|
992
937
|
role: 'listitem',
|
|
993
938
|
tabindex: '0',
|
|
994
939
|
class: 'toast',
|
|
@@ -1009,95 +954,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
1009
954
|
'(pointerleave)': 'onPointerLeave($event)',
|
|
1010
955
|
}, template: `
|
|
1011
956
|
@if (toast()?.component) {
|
|
1012
|
-
<ng-container
|
|
957
|
+
<ng-container
|
|
958
|
+
[betterToastOutlet]="toast()!.component!"
|
|
959
|
+
[betterToastOutletInputs]="toast()?.componentInputs"
|
|
960
|
+
/>
|
|
1013
961
|
} @else {
|
|
1014
962
|
@if (shouldShowIconColumn()) {
|
|
1015
963
|
<span class="toast-icon" aria-hidden="true">
|
|
1016
964
|
@if (toast()?.icon) {
|
|
1017
|
-
<ng-container
|
|
965
|
+
<ng-container [betterToastOutlet]="toast()!.icon!" />
|
|
1018
966
|
} @else if (iconComponent(); as IconCmp) {
|
|
1019
|
-
<ng-container
|
|
967
|
+
<ng-container [betterToastOutlet]="IconCmp" />
|
|
968
|
+
} @else if (variant() === 'loading') {
|
|
969
|
+
<div class="toast-icon-loading"></div>
|
|
1020
970
|
} @else {
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
stroke-linejoin="round"
|
|
1036
|
-
stroke-width="1.75"
|
|
1037
|
-
/>
|
|
1038
|
-
<path
|
|
1039
|
-
stroke="currentColor"
|
|
1040
|
-
stroke-linecap="round"
|
|
1041
|
-
stroke-linejoin="round"
|
|
1042
|
-
stroke-width="1.75"
|
|
1043
|
-
d="M8.48 12.22 10.9 14.64 15.74 9.14"
|
|
1044
|
-
/>
|
|
1045
|
-
</svg>
|
|
1046
|
-
}
|
|
1047
|
-
@case ('error') {
|
|
1048
|
-
<svg
|
|
1049
|
-
aria-hidden="true"
|
|
1050
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
1051
|
-
viewBox="0 0 24 24"
|
|
1052
|
-
fill="none"
|
|
1053
|
-
stroke="currentColor"
|
|
1054
|
-
stroke-width="2"
|
|
1055
|
-
stroke-linecap="round"
|
|
1056
|
-
stroke-linejoin="round"
|
|
1057
|
-
>
|
|
971
|
+
<svg
|
|
972
|
+
fill="none"
|
|
973
|
+
viewBox="0 0 24 24"
|
|
974
|
+
stroke="currentColor"
|
|
975
|
+
stroke-linecap="round"
|
|
976
|
+
stroke-linejoin="round"
|
|
977
|
+
[attr.stroke-width]="variant() === 'error' ? 2 : 1.75"
|
|
978
|
+
>
|
|
979
|
+
@switch (variant()) {
|
|
980
|
+
@case ('success') {
|
|
981
|
+
<circle cx="12" cy="12" r="9" />
|
|
982
|
+
<path d="M8.48 12.22 10.9 14.64 15.74 9.14" />
|
|
983
|
+
}
|
|
984
|
+
@case ('error') {
|
|
1058
985
|
<circle cx="12" cy="12" r="10" />
|
|
1059
986
|
<line x1="9" y1="9" x2="15" y2="15" />
|
|
1060
987
|
<line x1="15" y1="9" x2="9" y2="15" />
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
@case ('info') {
|
|
1064
|
-
<svg
|
|
1065
|
-
aria-hidden="true"
|
|
1066
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
1067
|
-
viewBox="0 0 24 24"
|
|
1068
|
-
fill="none"
|
|
1069
|
-
stroke="currentColor"
|
|
1070
|
-
stroke-width="1.75"
|
|
1071
|
-
stroke-linecap="round"
|
|
1072
|
-
stroke-linejoin="round"
|
|
1073
|
-
>
|
|
988
|
+
}
|
|
989
|
+
@case ('info') {
|
|
1074
990
|
<circle cx="12" cy="12" r="10" />
|
|
1075
991
|
<line x1="12" y1="16" x2="12" y2="12" />
|
|
1076
992
|
<line x1="12" y1="8" x2="12.01" y2="8" />
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
@case ('warning') {
|
|
1080
|
-
<svg
|
|
1081
|
-
aria-hidden="true"
|
|
1082
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
1083
|
-
fill="none"
|
|
1084
|
-
viewBox="0 0 24 24"
|
|
1085
|
-
>
|
|
993
|
+
}
|
|
994
|
+
@case ('warning') {
|
|
1086
995
|
<path
|
|
1087
|
-
stroke="currentColor"
|
|
1088
|
-
stroke-linecap="round"
|
|
1089
|
-
stroke-linejoin="round"
|
|
1090
|
-
stroke-width="1.75"
|
|
1091
996
|
d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"
|
|
1092
997
|
/>
|
|
1093
|
-
|
|
998
|
+
}
|
|
1094
999
|
}
|
|
1095
|
-
|
|
1096
|
-
<div class="toast-icon-loading" aria-hidden="true"></div>
|
|
1097
|
-
}
|
|
1098
|
-
@case ('description') {}
|
|
1099
|
-
@case ('default') {}
|
|
1100
|
-
}
|
|
1000
|
+
</svg>
|
|
1101
1001
|
}
|
|
1102
1002
|
</span>
|
|
1103
1003
|
}
|
|
@@ -1107,10 +1007,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
1107
1007
|
@if (toast()?.contentComponent) {
|
|
1108
1008
|
<div class="msg" [class]="resolvedClassNames()?.message">
|
|
1109
1009
|
<ng-container
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
inputs: contentComponentOutletInputs()
|
|
1113
|
-
"
|
|
1010
|
+
[betterToastOutlet]="toast()!.contentComponent!"
|
|
1011
|
+
[betterToastOutletInputs]="toast()?.contentComponentInputs"
|
|
1114
1012
|
/>
|
|
1115
1013
|
</div>
|
|
1116
1014
|
} @else {
|
|
@@ -1126,10 +1024,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
1126
1024
|
@if (toast()?.contentComponent) {
|
|
1127
1025
|
<div class="msg" [class]="resolvedClassNames()?.message">
|
|
1128
1026
|
<ng-container
|
|
1129
|
-
|
|
1130
|
-
toast()
|
|
1131
|
-
inputs: contentComponentOutletInputs()
|
|
1132
|
-
"
|
|
1027
|
+
[betterToastOutlet]="toast()!.contentComponent!"
|
|
1028
|
+
[betterToastOutletInputs]="toast()?.contentComponentInputs"
|
|
1133
1029
|
/>
|
|
1134
1030
|
</div>
|
|
1135
1031
|
} @else {
|
|
@@ -1138,57 +1034,49 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
1138
1034
|
}
|
|
1139
1035
|
|
|
1140
1036
|
@if (toast()?.toastAction; as rowAction) {
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
(
|
|
1149
|
-
(
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
class="toast-row-btn cancel-btn"
|
|
1158
|
-
[class]="resolvedClassNames()?.cancelButton"
|
|
1159
|
-
[attr.data-row-btn]="rowAction.role"
|
|
1160
|
-
(pointerdown)="onRowButtonPointerDown($event)"
|
|
1161
|
-
(click)="onToastRowClick($event)"
|
|
1162
|
-
>
|
|
1163
|
-
{{ rowAction.label }}
|
|
1164
|
-
</button>
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1037
|
+
<button
|
|
1038
|
+
type="button"
|
|
1039
|
+
class="toast-row-btn"
|
|
1040
|
+
[class.action-btn]="rowAction.role === 'action'"
|
|
1041
|
+
[class.cancel-btn]="rowAction.role === 'cancel'"
|
|
1042
|
+
[class]="
|
|
1043
|
+
rowAction.role === 'action'
|
|
1044
|
+
? resolvedClassNames()?.actionButton
|
|
1045
|
+
: resolvedClassNames()?.cancelButton
|
|
1046
|
+
"
|
|
1047
|
+
[attr.data-row-btn]="rowAction.role"
|
|
1048
|
+
(pointerdown)="onRowButtonPointerDown($event)"
|
|
1049
|
+
(click)="onToastRowClick($event)"
|
|
1050
|
+
>
|
|
1051
|
+
{{ rowAction.label }}
|
|
1052
|
+
</button>
|
|
1167
1053
|
}
|
|
1168
1054
|
}
|
|
1169
1055
|
|
|
1170
|
-
@if (
|
|
1056
|
+
@if (closeButton() && !isHeadless() && (stackFront() || stackExpanded())) {
|
|
1171
1057
|
<button
|
|
1172
1058
|
type="button"
|
|
1173
1059
|
class="close-btn"
|
|
1174
1060
|
[class]="resolvedClassNames()?.closeButton"
|
|
1175
|
-
[animate.enter]="
|
|
1176
|
-
[animate.leave]="
|
|
1061
|
+
[animate.enter]="stackFront() ? null : 'close-enter'"
|
|
1062
|
+
[animate.leave]="stackFront() ? null : 'close-leave'"
|
|
1177
1063
|
(click)="toaster.dismiss(toast()?.id ?? '')"
|
|
1178
1064
|
[attr.aria-label]="dismissButtonAriaLabel()"
|
|
1179
1065
|
>
|
|
1180
|
-
<svg
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1066
|
+
<svg
|
|
1067
|
+
fill="none"
|
|
1068
|
+
viewBox="0 0 24 24"
|
|
1069
|
+
stroke="currentColor"
|
|
1070
|
+
stroke-linecap="round"
|
|
1071
|
+
stroke-linejoin="round"
|
|
1072
|
+
stroke-width="1.75"
|
|
1073
|
+
aria-hidden="true"
|
|
1074
|
+
>
|
|
1075
|
+
<path d="M6 18 18 6M6 6l12 12" />
|
|
1188
1076
|
</svg>
|
|
1189
1077
|
</button>
|
|
1190
1078
|
}
|
|
1191
|
-
`, styles: [":host{--_chrome-bg: var(--toast-bg);--_chrome-fg: var(--toast-color);--_chrome-border: var(--toast-border-color);--_icon-fill: light-dark(var(--toast-color), var(--toast-bg));--_icon-stroke: light-dark(var(--toast-bg), var(--toast-color));--_icon-color: var(--_icon-stroke);--_toast-x: 0%;--_toast-y: 0px;--_toast-enter-y: 0px;--_toast-leave-y: 0px;--toast-line-height: 1.35;--index: 0;--collapsed-peek: 14px;--offset: calc(var(--index, 0) * var(--collapsed-peek));display:flex;align-items:center;gap:.375rem;flex:1;min-width:0;width:100%;padding-inline:.75rem;padding-block:1rem;box-sizing:border-box;border:1px solid var(--_chrome-border);border-radius:.5rem;box-shadow:var(--toast-shadow);background:var(--_chrome-bg);color:var(--_chrome-fg);font:500 .875rem/var(--toast-line-height) system-ui,sans-serif;pointer-events:auto;touch-action:none;-webkit-user-select:none;user-select:none;position:absolute;opacity:1;height:var(--initial-height, auto);scale:1;z-index:calc(1000 - var(--index, 0));transform:translate(var(--_toast-x)) translateY(var(--_toast-y));transition:opacity .4s ease,transform .4s ease,scale .4s ease,height .4s ease,box-shadow .2s ease}@starting-style{:host{opacity:0;transform:translate(var(--_toast-x)) translateY(var(--_toast-enter-y))}}:host>*:not(.close-btn){transition:opacity .4s ease}:host([data-expanded=\"true\"]):after{content:\"\";position:absolute;left:0;width:100%;height:calc(var(--toast-gap, 16px) + 1px);bottom:100%;pointer-events:auto}:host([data-variant=\"loading\"]){touch-action:auto}:host([data-position^=\"bottom\"]){bottom:0;transform-origin:50% 100%;--_toast-y: calc(-1 * var(--offset, 0px));--_toast-enter-y: 100%}:host([data-position^=\"top\"]){top:0;transform-origin:50% 0;--_toast-y: calc(1 * var(--offset, 0px));--_toast-enter-y: -100%}:host([data-swipe-direction=\"down\"]){--_toast-leave-y: 100%}:host([data-swipe-direction=\"up\"]){--_toast-leave-y: -100%}:host([data-expanded=\"false\"]){scale:calc(1 - var(--index, 0) * .05)}:host([data-expanded=\"false\"]:not(:last-child)){height:var(--front-toast-height);overflow:hidden}:host([data-expanded=\"false\"]:not(:last-child):not([data-headless=\"true\"]))>*:not(.close-btn){opacity:0;pointer-events:none}:host([data-expanded=\"false\"]:nth-last-child(n + 4)){opacity:0;pointer-events:none}:host([data-rich-colors=\"true\"][data-variant=\"success\"]){--_chrome-bg: var(--toast-success-bg);--_chrome-fg: var(--toast-success-text);--_chrome-border: var(--toast-success-border)}:host([data-rich-colors=\"true\"][data-variant=\"error\"]){--_chrome-bg: var(--toast-error-bg);--_chrome-fg: var(--toast-error-text);--_chrome-border: var(--toast-error-border)}:host([data-rich-colors=\"true\"][data-variant=\"info\"]){--_chrome-bg: var(--toast-info-bg);--_chrome-fg: var(--toast-info-text);--_chrome-border: var(--toast-info-border)}:host([data-rich-colors=\"true\"][data-variant=\"warning\"]){--_chrome-bg: var(--toast-warning-bg);--_chrome-fg: var(--toast-warning-text);--_chrome-border: var(--toast-warning-border)}:host([data-rich-colors=\"true\"]:is([data-variant=\"success\"],[data-variant=\"error\"],[data-variant=\"info\"],[data-variant=\"warning\"])){--_icon-fill: light-dark(var(--_chrome-fg), var(--_chrome-bg));--_icon-stroke: light-dark(var(--_chrome-bg), var(--_chrome-fg));--_icon-color: var(--_icon-stroke)}:host([data-headless=\"true\"]){width:max-content;max-width:calc(100dvw - var(--toast-offset-mobile-left, 16px) - var(--toast-offset-mobile-right, 16px));padding:0;gap:0;border:none;border-radius:0;box-shadow:none;background:transparent;color:inherit;font:inherit;line-height:normal;--toast-line-height: inherit}@starting-style{:host([data-headless=\"true\"]){opacity:1}}:host([data-headless=\"true\"][data-position=\"bottom-center\"]),:host([data-headless=\"true\"][data-position=\"top-center\"]){left:50%;right:auto;--_toast-x: -50%}:host([data-headless=\"true\"][data-icon=\"false\"]){padding-left:0}:host([data-icon=\"false\"]){padding-left:.925rem}@media(width>=40rem){:host{width:var(--toast-width)}:host([data-headless=\"true\"]){max-width:calc(100dvw - var(--toast-offset-left, 24px) - var(--toast-offset-right, 24px))}:host([data-headless=\"true\"][data-position$=\"-right\"]){left:auto;right:0}:host([data-headless=\"true\"][data-position$=\"-left\"]){left:0;right:auto}}@media(width<40rem){:host([data-headless=\"true\"][data-position^=\"bottom\"]),:host([data-headless=\"true\"][data-position^=\"top\"]){left:50%;right:auto;--_toast-x: -50%}}.toast-icon,.toast-icon ::ng-deep{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:1.425rem;height:1.425rem}.toast-icon svg,.toast-icon ::ng-deep svg{display:block;margin-inline:auto;fill:var(--_icon-fill);stroke:var(--_icon-stroke);color:var(--_icon-color);width:95%;height:95%}:host([data-theme=\"dark\"]) .toast-icon svg,:host([data-theme=\"dark\"]) .toast-icon ::ng-deep svg{width:87.5%;height:87.5%}@media(prefers-color-scheme:dark){:host([data-theme=\"system\"]) .toast-icon svg,:host([data-theme=\"system\"]) .toast-icon ::ng-deep svg{width:87.5%;height:87.5%}}.toast-icon-loading{display:block;width:.9rem;height:.9rem;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;border-right-color:transparent;animation:spin .45s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.msg{flex:1;min-width:0;max-width:95%;margin:0;font-size:.825rem;font-weight:500;line-height:calc(1.25 / .875);letter-spacing:.01em}@media(width<40rem){.msg{max-width:90%;font-size:.8rem}}.stack{display:flex;flex-direction:column;align-items:flex-start;gap:.25rem;flex:1;min-width:0}.stack .msg{flex:0 1 auto;max-width:100%}:host([data-icon=\"false\"]) .stack .msg{max-width:90%}.description{margin:0;font-size:.825rem;font-weight:400;line-height:1.35;letter-spacing:.01em;opacity:.9;max-width:100%}@media(width<40rem){.description{font-size:.8rem}}.toast-row-btn{flex-shrink:0;margin:0;margin-inline-start:auto;padding:.35rem .65rem;border-radius:.375rem;border:1px solid transparent;font:inherit;font-size:.8rem;font-weight:600;letter-spacing:.01em;line-height:1.2;cursor:pointer;white-space:nowrap;transition:transform .2s ease}.toast-row-btn:focus-visible{outline:2px solid var(--toast-color);outline-offset:2px}.toast-row-btn:active{transform:scale(.95)}.action-btn{background:var(--toast-action-bg);color:var(--toast-action-text);border-color:var(--toast-action-border)}.cancel-btn{background:var(--toast-cancel-bg);color:var(--toast-color);border-color:var(--toast-cancel-border)}.
|
|
1079
|
+
`, styles: [":host{--_chrome-bg: var(--toast-bg);--_chrome-fg: var(--toast-color);--_chrome-border: var(--toast-border-color);--_icon-fill: light-dark(var(--toast-color), var(--toast-bg));--_icon-stroke: light-dark(var(--toast-bg), var(--toast-color));--_icon-color: var(--_icon-stroke);--_toast-x: 0%;--_toast-y: 0px;--_toast-enter-y: 0px;--_toast-leave-y: 0px;--toast-line-height: 1.35;--index: 0;--collapsed-peek: 14px;--offset: calc(var(--index, 0) * var(--collapsed-peek));display:flex;align-items:center;gap:.375rem;flex:1;min-width:0;width:100%;padding-inline:.75rem;padding-block:1rem;box-sizing:border-box;border:1px solid var(--_chrome-border);border-radius:.5rem;box-shadow:var(--toast-shadow);background:var(--_chrome-bg);color:var(--_chrome-fg);font:500 .875rem/var(--toast-line-height) system-ui,sans-serif;pointer-events:auto;touch-action:none;-webkit-user-select:none;user-select:none;position:absolute;opacity:1;height:var(--initial-height, auto);scale:1;z-index:calc(1000 - var(--index, 0));transform:translate(var(--_toast-x)) translateY(var(--_toast-y));transition:opacity .4s ease,transform .4s ease,scale .4s ease,height .4s ease,box-shadow .2s ease}@starting-style{:host{opacity:0;transform:translate(var(--_toast-x)) translateY(var(--_toast-enter-y))}}:host>*:not(.close-btn){transition:opacity .4s ease}:host([data-expanded=\"true\"]):after{content:\"\";position:absolute;left:0;width:100%;height:calc(var(--toast-gap, 16px) + 1px);bottom:100%;pointer-events:auto}:host([data-variant=\"loading\"]){touch-action:auto}:host([data-position^=\"bottom\"]){bottom:0;transform-origin:50% 100%;--_toast-y: calc(-1 * var(--offset, 0px));--_toast-enter-y: 100%}:host([data-position^=\"top\"]){top:0;transform-origin:50% 0;--_toast-y: calc(1 * var(--offset, 0px));--_toast-enter-y: -100%}:host([data-swipe-direction=\"down\"]){--_toast-leave-y: 100%}:host([data-swipe-direction=\"up\"]){--_toast-leave-y: -100%}:host([data-expanded=\"false\"]){scale:calc(1 - var(--index, 0) * .05)}:host([data-expanded=\"false\"]:not(:last-child)){height:var(--front-toast-height);overflow:hidden}:host([data-expanded=\"false\"]:not(:last-child):not([data-headless=\"true\"]))>*:not(.close-btn){opacity:0;pointer-events:none}:host([data-expanded=\"false\"]:nth-last-child(n + 4)){opacity:0;pointer-events:none}:host([data-rich-colors=\"true\"][data-variant=\"success\"]){--_chrome-bg: var(--toast-success-bg);--_chrome-fg: var(--toast-success-text);--_chrome-border: var(--toast-success-border)}:host([data-rich-colors=\"true\"][data-variant=\"error\"]){--_chrome-bg: var(--toast-error-bg);--_chrome-fg: var(--toast-error-text);--_chrome-border: var(--toast-error-border)}:host([data-rich-colors=\"true\"][data-variant=\"info\"]){--_chrome-bg: var(--toast-info-bg);--_chrome-fg: var(--toast-info-text);--_chrome-border: var(--toast-info-border)}:host([data-rich-colors=\"true\"][data-variant=\"warning\"]){--_chrome-bg: var(--toast-warning-bg);--_chrome-fg: var(--toast-warning-text);--_chrome-border: var(--toast-warning-border)}:host([data-rich-colors=\"true\"]:is([data-variant=\"success\"],[data-variant=\"error\"],[data-variant=\"info\"],[data-variant=\"warning\"])){--_icon-fill: light-dark(var(--_chrome-fg), var(--_chrome-bg));--_icon-stroke: light-dark(var(--_chrome-bg), var(--_chrome-fg));--_icon-color: var(--_icon-stroke)}:host([data-headless=\"true\"]){width:max-content;max-width:calc(100dvw - var(--toast-offset-mobile-left, 16px) - var(--toast-offset-mobile-right, 16px));padding:0;gap:0;border:none;border-radius:0;box-shadow:none;background:transparent;color:inherit;font:inherit;line-height:normal;--toast-line-height: inherit}@starting-style{:host([data-headless=\"true\"]){opacity:1}}:host([data-headless=\"true\"][data-position=\"bottom-center\"]),:host([data-headless=\"true\"][data-position=\"top-center\"]){left:50%;right:auto;--_toast-x: -50%}:host([data-headless=\"true\"][data-icon=\"false\"]){padding-left:0}:host([data-icon=\"false\"]){padding-left:.925rem}@media(width>=40rem){:host{width:var(--toast-width)}:host([data-headless=\"true\"]){max-width:calc(100dvw - var(--toast-offset-left, 24px) - var(--toast-offset-right, 24px))}:host([data-headless=\"true\"][data-position$=\"-right\"]){left:auto;right:0}:host([data-headless=\"true\"][data-position$=\"-left\"]){left:0;right:auto}}@media(width<40rem){:host([data-headless=\"true\"][data-position^=\"bottom\"]),:host([data-headless=\"true\"][data-position^=\"top\"]){left:50%;right:auto;--_toast-x: -50%}}.toast-icon,.toast-icon ::ng-deep{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:1.425rem;height:1.425rem}.toast-icon svg,.toast-icon ::ng-deep svg{display:block;margin-inline:auto;fill:var(--_icon-fill);stroke:var(--_icon-stroke);color:var(--_icon-color);width:95%;height:95%}:host([data-theme=\"dark\"]) .toast-icon svg,:host([data-theme=\"dark\"]) .toast-icon ::ng-deep svg{width:87.5%;height:87.5%}@media(prefers-color-scheme:dark){:host([data-theme=\"system\"]) .toast-icon svg,:host([data-theme=\"system\"]) .toast-icon ::ng-deep svg{width:87.5%;height:87.5%}}.toast-icon-loading{display:block;width:.9rem;height:.9rem;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;border-right-color:transparent;animation:spin .45s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.msg{flex:1;min-width:0;max-width:95%;margin:0;font-size:.825rem;font-weight:500;line-height:calc(1.25 / .875);letter-spacing:.01em}@media(width<40rem){.msg{max-width:90%;font-size:.8rem}}.stack{display:flex;flex-direction:column;align-items:flex-start;gap:.25rem;flex:1;min-width:0}.stack .msg{flex:0 1 auto;max-width:100%}:host([data-icon=\"false\"]) .stack .msg{max-width:90%}.description{margin:0;font-size:.825rem;font-weight:400;line-height:1.35;letter-spacing:.01em;opacity:.9;max-width:100%}@media(width<40rem){.description{font-size:.8rem}}.toast-row-btn{flex-shrink:0;margin:0;margin-inline-start:auto;padding:.35rem .65rem;border-radius:.375rem;border:1px solid transparent;font:inherit;font-size:.8rem;font-weight:600;letter-spacing:.01em;line-height:1.2;cursor:pointer;white-space:nowrap;transition:transform .2s ease}.toast-row-btn:focus-visible{outline:2px solid var(--toast-color);outline-offset:2px}.toast-row-btn:active{transform:scale(.95)}.action-btn{background:var(--toast-action-bg);color:var(--toast-action-text);border-color:var(--toast-action-border)}.cancel-btn{background:var(--toast-cancel-bg);color:var(--toast-color);border-color:var(--toast-cancel-border)}.close-btn{position:absolute;top:-.3875rem;right:-.3875rem;flex-shrink:0;margin:-.15rem -.25rem -.15rem 0;border:1px solid var(--_chrome-border);box-shadow:var(--toast-shadow);background:var(--_chrome-bg);color:var(--_chrome-fg);cursor:pointer;line-height:1;padding:.25rem;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;opacity:1;scale:1;filter:blur(0)}.close-btn.close-enter{opacity:1;scale:1;filter:blur(0);transition:opacity .18s cubic-bezier(.19,1,.22,1),scale .18s cubic-bezier(.19,1,.22,1),filter .18s cubic-bezier(.19,1,.22,1)}@starting-style{.close-btn.close-enter{opacity:0;scale:.92;filter:blur(4px)}}.close-btn.close-leave{opacity:0;scale:.92;filter:blur(4px);pointer-events:none;transition:opacity .15s cubic-bezier(.19,1,.22,1),scale .15s cubic-bezier(.19,1,.22,1),filter .15s cubic-bezier(.19,1,.22,1)}.close-btn:focus-visible{outline:2px solid currentColor}.close-btn svg{display:block;width:.825rem;height:.825rem}:host(.leave){opacity:0;scale:.95;transform:translate(var(--_toast-x)) translateY(var(--_toast-leave-y))}@media(prefers-reduced-motion:reduce){:host{transition:none}:host([data-position]){--_toast-enter-y: var(--_toast-y);--_toast-leave-y: var(--_toast-y)}:host>*{transition:none}:host(.leave){scale:1}.toast-row-btn:active{transform:none}.close-btn.close-enter{scale:1;filter:none;transition:opacity .15s ease}@starting-style{.close-btn.close-enter{opacity:0;scale:1;filter:none}}.close-btn.close-leave{scale:1;filter:none;transition:opacity .15s ease}.toast-icon-loading{animation:none}}\n"] }]
|
|
1192
1080
|
}], ctorParameters: () => [], propDecorators: { toast: [{ type: i0.Input, args: [{ isSignal: true, alias: "toast", required: false }] }], toasterStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "toasterStyle", required: false }] }], toasterClassNames: [{ type: i0.Input, args: [{ isSignal: true, alias: "toasterClassNames", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], closeButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeButton", required: false }] }], customIcons: [{ type: i0.Input, args: [{ isSignal: true, alias: "customIcons", required: false }] }], dismissButtonAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "dismissButtonAriaLabel", required: false }] }], stackPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "stackPosition", required: false }] }], stackExpanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "stackExpanded", required: false }] }], stackFront: [{ type: i0.Input, args: [{ isSignal: true, alias: "stackFront", required: false }] }], stackHover: [{ type: i0.Output, args: ["stackHover"] }], theme: [{ type: i0.Input, args: [{ isSignal: true, alias: "theme", required: false }] }], heightChange: [{ type: i0.Output, args: ["heightChange"] }] } });
|
|
1193
1081
|
/**
|
|
1194
1082
|
* Renders the toaster stack. Add once near the root of your app (e.g. in `App`).
|
|
@@ -1214,11 +1102,7 @@ class BetterToaster {
|
|
|
1214
1102
|
* `0` still works. Does not apply to `loading()`. Defaults to the library default (4000ms).
|
|
1215
1103
|
*/
|
|
1216
1104
|
durationMs = input(DEFAULT_TOAST_DURATION_MS, { ...(ngDevMode ? { debugName: "durationMs" } : /* istanbul ignore next */ {}), alias: 'duration',
|
|
1217
|
-
transform:
|
|
1218
|
-
const durationMs = parseToasterDurationMs(value);
|
|
1219
|
-
this.toaster.setDefaultDurationMs(durationMs);
|
|
1220
|
-
return durationMs;
|
|
1221
|
-
} });
|
|
1105
|
+
transform: parseToasterDurationMs });
|
|
1222
1106
|
/** Where the stack is anchored on the viewport. */
|
|
1223
1107
|
position = input('bottom-right', /* @ts-ignore */
|
|
1224
1108
|
...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
@@ -1301,6 +1185,9 @@ class BetterToaster {
|
|
|
1301
1185
|
layoutExpanded = computed(() => !this.stacked() || this.expanded(), /* @ts-ignore */
|
|
1302
1186
|
...(ngDevMode ? [{ debugName: "layoutExpanded" }] : /* istanbul ignore next */ []));
|
|
1303
1187
|
constructor() {
|
|
1188
|
+
effect(() => {
|
|
1189
|
+
this.toaster.setDefaultDurationMs(this.durationMs());
|
|
1190
|
+
});
|
|
1304
1191
|
effect(() => {
|
|
1305
1192
|
if (this.toaster.toasts().length === 0) {
|
|
1306
1193
|
this.hovering.set(false);
|
|
@@ -1322,30 +1209,7 @@ class BetterToaster {
|
|
|
1322
1209
|
/** Resolved `aria-label` for each toast’s dismiss control. */
|
|
1323
1210
|
dismissButtonAriaLabel = computed(() => this.accessibilityLabels()?.dismissButton ?? DEFAULT_TOASTER_ARIA_DISMISS_BUTTON, /* @ts-ignore */
|
|
1324
1211
|
...(ngDevMode ? [{ debugName: "dismissButtonAriaLabel" }] : /* istanbul ignore next */ []));
|
|
1325
|
-
|
|
1326
|
-
offsetTop = computed(() => resolveToasterOffsetSide(this.offset(), 'top'), /* @ts-ignore */
|
|
1327
|
-
...(ngDevMode ? [{ debugName: "offsetTop" }] : /* istanbul ignore next */ []));
|
|
1328
|
-
/** Horizontal offset in px for the toast stack. */
|
|
1329
|
-
offsetRight = computed(() => resolveToasterOffsetSide(this.offset(), 'right'), /* @ts-ignore */
|
|
1330
|
-
...(ngDevMode ? [{ debugName: "offsetRight" }] : /* istanbul ignore next */ []));
|
|
1331
|
-
/** Vertical offset in px for the toast stack. */
|
|
1332
|
-
offsetBottom = computed(() => resolveToasterOffsetSide(this.offset(), 'bottom'), /* @ts-ignore */
|
|
1333
|
-
...(ngDevMode ? [{ debugName: "offsetBottom" }] : /* istanbul ignore next */ []));
|
|
1334
|
-
/** Horizontal offset in px for the toast stack. */
|
|
1335
|
-
offsetLeft = computed(() => resolveToasterOffsetSide(this.offset(), 'left'), /* @ts-ignore */
|
|
1336
|
-
...(ngDevMode ? [{ debugName: "offsetLeft" }] : /* istanbul ignore next */ []));
|
|
1337
|
-
/** Vertical offset in px for the toast stack on narrow layouts. */
|
|
1338
|
-
mobileOffsetTop = computed(() => resolveToasterOffsetSide(this.mobileOffset(), 'top'), /* @ts-ignore */
|
|
1339
|
-
...(ngDevMode ? [{ debugName: "mobileOffsetTop" }] : /* istanbul ignore next */ []));
|
|
1340
|
-
/** Horizontal offset in px for the toast stack on narrow layouts. */
|
|
1341
|
-
mobileOffsetRight = computed(() => resolveToasterOffsetSide(this.mobileOffset(), 'right'), /* @ts-ignore */
|
|
1342
|
-
...(ngDevMode ? [{ debugName: "mobileOffsetRight" }] : /* istanbul ignore next */ []));
|
|
1343
|
-
/** Vertical offset in px for the toast stack on narrow layouts. */
|
|
1344
|
-
mobileOffsetBottom = computed(() => resolveToasterOffsetSide(this.mobileOffset(), 'bottom'), /* @ts-ignore */
|
|
1345
|
-
...(ngDevMode ? [{ debugName: "mobileOffsetBottom" }] : /* istanbul ignore next */ []));
|
|
1346
|
-
/** Horizontal offset in px for the toast stack on narrow layouts. */
|
|
1347
|
-
mobileOffsetLeft = computed(() => resolveToasterOffsetSide(this.mobileOffset(), 'left'), /* @ts-ignore */
|
|
1348
|
-
...(ngDevMode ? [{ debugName: "mobileOffsetLeft" }] : /* istanbul ignore next */ []));
|
|
1212
|
+
offsetSide = resolveToasterOffsetSide;
|
|
1349
1213
|
/**
|
|
1350
1214
|
* `--index` is the stack depth: last item is 0 (front), older items count up.
|
|
1351
1215
|
* Collapsed peek, scale, front, and hidden layers are CSS from that index / `:last-child`.
|
|
@@ -1444,12 +1308,6 @@ class BetterToaster {
|
|
|
1444
1308
|
this.toaster.resumeAutoDismiss(toast.id);
|
|
1445
1309
|
}
|
|
1446
1310
|
}
|
|
1447
|
-
/**
|
|
1448
|
-
* Initializes the toaster service with the default duration.
|
|
1449
|
-
*/
|
|
1450
|
-
ngOnInit() {
|
|
1451
|
-
this.toaster.setDefaultDurationMs(this.durationMs());
|
|
1452
|
-
}
|
|
1453
1311
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: BetterToaster, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1454
1312
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: BetterToaster, isStandalone: true, selector: "better-toaster", inputs: { durationMs: { classPropertyName: "durationMs", publicName: "duration", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, stacked: { classPropertyName: "stacked", publicName: "stacked", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null }, mobileOffset: { classPropertyName: "mobileOffset", publicName: "mobileOffset", isSignal: true, isRequired: false, transformFunction: null }, richColors: { classPropertyName: "richColors", publicName: "richColors", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, icons: { classPropertyName: "icons", publicName: "icons", isSignal: true, isRequired: false, transformFunction: null }, toastOptions: { classPropertyName: "toastOptions", publicName: "toastOptions", isSignal: true, isRequired: false, transformFunction: null }, closeButton: { classPropertyName: "closeButton", publicName: "closeButton", isSignal: true, isRequired: false, transformFunction: null }, accessibilityLabels: { classPropertyName: "accessibilityLabels", publicName: "accessibilityLabels", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "document:pointerdown": "onDocumentPointerDown($event)" } }, ngImport: i0, template: `
|
|
1455
1313
|
<section
|
|
@@ -1461,14 +1319,14 @@ class BetterToaster {
|
|
|
1461
1319
|
>
|
|
1462
1320
|
<ol
|
|
1463
1321
|
class="toast-container"
|
|
1464
|
-
[style.--toast-offset-top]="
|
|
1465
|
-
[style.--toast-offset-right]="
|
|
1466
|
-
[style.--toast-offset-bottom]="
|
|
1467
|
-
[style.--toast-offset-left]="
|
|
1468
|
-
[style.--toast-offset-mobile-top]="
|
|
1469
|
-
[style.--toast-offset-mobile-right]="
|
|
1470
|
-
[style.--toast-offset-mobile-bottom]="
|
|
1471
|
-
[style.--toast-offset-mobile-left]="
|
|
1322
|
+
[style.--toast-offset-top]="offsetSide(offset(), 'top')"
|
|
1323
|
+
[style.--toast-offset-right]="offsetSide(offset(), 'right')"
|
|
1324
|
+
[style.--toast-offset-bottom]="offsetSide(offset(), 'bottom')"
|
|
1325
|
+
[style.--toast-offset-left]="offsetSide(offset(), 'left')"
|
|
1326
|
+
[style.--toast-offset-mobile-top]="offsetSide(mobileOffset(), 'top')"
|
|
1327
|
+
[style.--toast-offset-mobile-right]="offsetSide(mobileOffset(), 'right')"
|
|
1328
|
+
[style.--toast-offset-mobile-bottom]="offsetSide(mobileOffset(), 'bottom')"
|
|
1329
|
+
[style.--toast-offset-mobile-left]="offsetSide(mobileOffset(), 'left')"
|
|
1472
1330
|
[style.--toast-gap]="stackGapPx + 'px'"
|
|
1473
1331
|
[style.--front-toast-height]="frontToastHeightCss()"
|
|
1474
1332
|
[attr.data-position]="position()"
|
|
@@ -1508,7 +1366,7 @@ class BetterToaster {
|
|
|
1508
1366
|
}
|
|
1509
1367
|
</ol>
|
|
1510
1368
|
</section>
|
|
1511
|
-
`, isInline: true, styles: [":host{--toast-width: 356px;--toast-gap: 16px;--toast-z-index: 99999;--toast-offset-top: 24px;--toast-offset-bottom: 24px;--toast-offset-left: 24px;--toast-offset-right: 24px;--toast-offset-mobile-top: 16px;--toast-offset-mobile-bottom: 16px;--toast-offset-mobile-left: 16px;--toast-offset-mobile-right: 16px}.toast-container[data-theme=light]{color-scheme:light}.toast-container[data-theme=dark]{color-scheme:dark}.toast-container[data-theme=system]{color-scheme:light dark}.toast-container{--toast-bg: light-dark(oklch(100% 0 0), oklch(10% 0 0));--toast-color: light-dark(oklch(30% 0 0), oklch(98% 0 0));--toast-border-color: light-dark(hsl(0, 0%, 93%), hsl(0, 0%, 20%));--toast-shadow: 0px 4px 12px rgba(0, 0, 0, .1);--toast-success-bg: light-dark(oklch(97.9% .021 166.113), oklch(26.2% .051 172.552));--toast-success-text: light-dark(oklch(59.6% .145 163.225), oklch(92.5% .084 155.995));--toast-success-border: light-dark( oklch(69.6% .17 162.48 / .1), oklch(92.5% .084 155.995 / .1) );--toast-error-bg: light-dark(oklch(97.5% .012 25), oklch(25.8% .092 26.042));--toast-error-text: light-dark(oklch(57.7% .245 27.325), oklch(88.5% .062 18.334));--toast-error-border: light-dark( oklch(80.8% .114 19.571 / .1), oklch(88.5% .062 18.334 / .125) );--toast-info-bg: light-dark(oklch(97.7% .013 236.62), oklch(29.3% .066 243.157));--toast-info-text: light-dark(oklch(68.5% .169 237.323), oklch(90.1% .058 230.902));--toast-info-border: light-dark( oklch(82.8% .111 230.318 / .15), oklch(90.1% .058 230.902 / .125) );--toast-warning-bg: light-dark(oklch(98.7% .022 95.277), oklch(28.6% .066 53.813));--toast-warning-text: light-dark(oklch(66.6% .179 58.318), oklch(92.4% .12 95.746));--toast-warning-border: light-dark( oklch(76.9% .188 70.08 / .15), oklch(92.4% .12 95.746 / .125) );--toast-action-bg: light-dark(var(--color-black), var(--color-white));--toast-action-text: light-dark(var(--color-white), var(--color-black));--toast-action-border: light-dark(var(--color-black), var(--color-white));--toast-cancel-bg: light-dark(oklch(86.9% .005 56.366 / .3), oklch(26.8% .007 34.298 / .85));--toast-cancel-
|
|
1369
|
+
`, isInline: true, styles: [":host{--toast-width: 356px;--toast-gap: 16px;--toast-z-index: 99999;--toast-offset-top: 24px;--toast-offset-bottom: 24px;--toast-offset-left: 24px;--toast-offset-right: 24px;--toast-offset-mobile-top: 16px;--toast-offset-mobile-bottom: 16px;--toast-offset-mobile-left: 16px;--toast-offset-mobile-right: 16px}.toast-container[data-theme=light]{color-scheme:light}.toast-container[data-theme=dark]{color-scheme:dark}.toast-container[data-theme=system]{color-scheme:light dark}.toast-container{--toast-bg: light-dark(oklch(100% 0 0), oklch(10% 0 0));--toast-color: light-dark(oklch(30% 0 0), oklch(98% 0 0));--toast-border-color: light-dark(hsl(0, 0%, 93%), hsl(0, 0%, 20%));--toast-shadow: 0px 4px 12px rgba(0, 0, 0, .1);--toast-success-bg: light-dark(oklch(97.9% .021 166.113), oklch(26.2% .051 172.552));--toast-success-text: light-dark(oklch(59.6% .145 163.225), oklch(92.5% .084 155.995));--toast-success-border: light-dark( oklch(69.6% .17 162.48 / .1), oklch(92.5% .084 155.995 / .1) );--toast-error-bg: light-dark(oklch(97.5% .012 25), oklch(25.8% .092 26.042));--toast-error-text: light-dark(oklch(57.7% .245 27.325), oklch(88.5% .062 18.334));--toast-error-border: light-dark( oklch(80.8% .114 19.571 / .1), oklch(88.5% .062 18.334 / .125) );--toast-info-bg: light-dark(oklch(97.7% .013 236.62), oklch(29.3% .066 243.157));--toast-info-text: light-dark(oklch(68.5% .169 237.323), oklch(90.1% .058 230.902));--toast-info-border: light-dark( oklch(82.8% .111 230.318 / .15), oklch(90.1% .058 230.902 / .125) );--toast-warning-bg: light-dark(oklch(98.7% .022 95.277), oklch(28.6% .066 53.813));--toast-warning-text: light-dark(oklch(66.6% .179 58.318), oklch(92.4% .12 95.746));--toast-warning-border: light-dark( oklch(76.9% .188 70.08 / .15), oklch(92.4% .12 95.746 / .125) );--toast-action-bg: light-dark(var(--color-black), var(--color-white));--toast-action-text: light-dark(var(--color-white), var(--color-black));--toast-action-border: light-dark(var(--color-black), var(--color-white));--toast-cancel-bg: light-dark(oklch(86.9% .005 56.366 / .3), oklch(26.8% .007 34.298 / .85));--toast-cancel-border: light-dark( oklch(86.9% .005 56.366 / .1), oklch(26.8% .007 34.298 / .5) );position:fixed;z-index:var(--toast-z-index);width:auto;pointer-events:none;overflow:visible;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.toast-container[data-position^=top]{top:var(--toast-offset-mobile-top);left:var(--toast-offset-mobile-left);right:var(--toast-offset-mobile-right)}.toast-container[data-position^=bottom]{bottom:var(--toast-offset-mobile-bottom);left:var(--toast-offset-mobile-left);right:var(--toast-offset-mobile-right)}@media(width>=40rem){.toast-container{width:var(--toast-width)}.toast-container[data-position=top-left]{top:var(--toast-offset-top);left:var(--toast-offset-left);right:auto;align-items:flex-start}.toast-container[data-position=top-center]{top:var(--toast-offset-top);left:50%;transform:translate(-50%);align-items:center}.toast-container[data-position=top-right]{top:var(--toast-offset-top);right:var(--toast-offset-right);left:auto;align-items:flex-end}.toast-container[data-position=bottom-left]{bottom:var(--toast-offset-bottom);left:var(--toast-offset-left);right:auto;align-items:flex-start}.toast-container[data-position=bottom-center]{bottom:var(--toast-offset-bottom);left:50%;transform:translate(-50%);align-items:center}.toast-container[data-position=bottom-right]{bottom:var(--toast-offset-bottom);right:var(--toast-offset-right);left:auto;align-items:flex-end}}\n"], dependencies: [{ kind: "component", type: BetterToastItem, selector: "li[betterToastItem]", inputs: ["toast", "toasterStyle", "toasterClassNames", "variant", "closeButton", "customIcons", "dismissButtonAriaLabel", "stackPosition", "stackExpanded", "stackFront", "theme"], outputs: ["stackHover", "heightChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1512
1370
|
}
|
|
1513
1371
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: BetterToaster, decorators: [{
|
|
1514
1372
|
type: Component,
|
|
@@ -1524,14 +1382,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
1524
1382
|
>
|
|
1525
1383
|
<ol
|
|
1526
1384
|
class="toast-container"
|
|
1527
|
-
[style.--toast-offset-top]="
|
|
1528
|
-
[style.--toast-offset-right]="
|
|
1529
|
-
[style.--toast-offset-bottom]="
|
|
1530
|
-
[style.--toast-offset-left]="
|
|
1531
|
-
[style.--toast-offset-mobile-top]="
|
|
1532
|
-
[style.--toast-offset-mobile-right]="
|
|
1533
|
-
[style.--toast-offset-mobile-bottom]="
|
|
1534
|
-
[style.--toast-offset-mobile-left]="
|
|
1385
|
+
[style.--toast-offset-top]="offsetSide(offset(), 'top')"
|
|
1386
|
+
[style.--toast-offset-right]="offsetSide(offset(), 'right')"
|
|
1387
|
+
[style.--toast-offset-bottom]="offsetSide(offset(), 'bottom')"
|
|
1388
|
+
[style.--toast-offset-left]="offsetSide(offset(), 'left')"
|
|
1389
|
+
[style.--toast-offset-mobile-top]="offsetSide(mobileOffset(), 'top')"
|
|
1390
|
+
[style.--toast-offset-mobile-right]="offsetSide(mobileOffset(), 'right')"
|
|
1391
|
+
[style.--toast-offset-mobile-bottom]="offsetSide(mobileOffset(), 'bottom')"
|
|
1392
|
+
[style.--toast-offset-mobile-left]="offsetSide(mobileOffset(), 'left')"
|
|
1535
1393
|
[style.--toast-gap]="stackGapPx + 'px'"
|
|
1536
1394
|
[style.--front-toast-height]="frontToastHeightCss()"
|
|
1537
1395
|
[attr.data-position]="position()"
|
|
@@ -1571,7 +1429,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
|
|
|
1571
1429
|
}
|
|
1572
1430
|
</ol>
|
|
1573
1431
|
</section>
|
|
1574
|
-
`, styles: [":host{--toast-width: 356px;--toast-gap: 16px;--toast-z-index: 99999;--toast-offset-top: 24px;--toast-offset-bottom: 24px;--toast-offset-left: 24px;--toast-offset-right: 24px;--toast-offset-mobile-top: 16px;--toast-offset-mobile-bottom: 16px;--toast-offset-mobile-left: 16px;--toast-offset-mobile-right: 16px}.toast-container[data-theme=light]{color-scheme:light}.toast-container[data-theme=dark]{color-scheme:dark}.toast-container[data-theme=system]{color-scheme:light dark}.toast-container{--toast-bg: light-dark(oklch(100% 0 0), oklch(10% 0 0));--toast-color: light-dark(oklch(30% 0 0), oklch(98% 0 0));--toast-border-color: light-dark(hsl(0, 0%, 93%), hsl(0, 0%, 20%));--toast-shadow: 0px 4px 12px rgba(0, 0, 0, .1);--toast-success-bg: light-dark(oklch(97.9% .021 166.113), oklch(26.2% .051 172.552));--toast-success-text: light-dark(oklch(59.6% .145 163.225), oklch(92.5% .084 155.995));--toast-success-border: light-dark( oklch(69.6% .17 162.48 / .1), oklch(92.5% .084 155.995 / .1) );--toast-error-bg: light-dark(oklch(97.5% .012 25), oklch(25.8% .092 26.042));--toast-error-text: light-dark(oklch(57.7% .245 27.325), oklch(88.5% .062 18.334));--toast-error-border: light-dark( oklch(80.8% .114 19.571 / .1), oklch(88.5% .062 18.334 / .125) );--toast-info-bg: light-dark(oklch(97.7% .013 236.62), oklch(29.3% .066 243.157));--toast-info-text: light-dark(oklch(68.5% .169 237.323), oklch(90.1% .058 230.902));--toast-info-border: light-dark( oklch(82.8% .111 230.318 / .15), oklch(90.1% .058 230.902 / .125) );--toast-warning-bg: light-dark(oklch(98.7% .022 95.277), oklch(28.6% .066 53.813));--toast-warning-text: light-dark(oklch(66.6% .179 58.318), oklch(92.4% .12 95.746));--toast-warning-border: light-dark( oklch(76.9% .188 70.08 / .15), oklch(92.4% .12 95.746 / .125) );--toast-action-bg: light-dark(var(--color-black), var(--color-white));--toast-action-text: light-dark(var(--color-white), var(--color-black));--toast-action-border: light-dark(var(--color-black), var(--color-white));--toast-cancel-bg: light-dark(oklch(86.9% .005 56.366 / .3), oklch(26.8% .007 34.298 / .85));--toast-cancel-
|
|
1432
|
+
`, styles: [":host{--toast-width: 356px;--toast-gap: 16px;--toast-z-index: 99999;--toast-offset-top: 24px;--toast-offset-bottom: 24px;--toast-offset-left: 24px;--toast-offset-right: 24px;--toast-offset-mobile-top: 16px;--toast-offset-mobile-bottom: 16px;--toast-offset-mobile-left: 16px;--toast-offset-mobile-right: 16px}.toast-container[data-theme=light]{color-scheme:light}.toast-container[data-theme=dark]{color-scheme:dark}.toast-container[data-theme=system]{color-scheme:light dark}.toast-container{--toast-bg: light-dark(oklch(100% 0 0), oklch(10% 0 0));--toast-color: light-dark(oklch(30% 0 0), oklch(98% 0 0));--toast-border-color: light-dark(hsl(0, 0%, 93%), hsl(0, 0%, 20%));--toast-shadow: 0px 4px 12px rgba(0, 0, 0, .1);--toast-success-bg: light-dark(oklch(97.9% .021 166.113), oklch(26.2% .051 172.552));--toast-success-text: light-dark(oklch(59.6% .145 163.225), oklch(92.5% .084 155.995));--toast-success-border: light-dark( oklch(69.6% .17 162.48 / .1), oklch(92.5% .084 155.995 / .1) );--toast-error-bg: light-dark(oklch(97.5% .012 25), oklch(25.8% .092 26.042));--toast-error-text: light-dark(oklch(57.7% .245 27.325), oklch(88.5% .062 18.334));--toast-error-border: light-dark( oklch(80.8% .114 19.571 / .1), oklch(88.5% .062 18.334 / .125) );--toast-info-bg: light-dark(oklch(97.7% .013 236.62), oklch(29.3% .066 243.157));--toast-info-text: light-dark(oklch(68.5% .169 237.323), oklch(90.1% .058 230.902));--toast-info-border: light-dark( oklch(82.8% .111 230.318 / .15), oklch(90.1% .058 230.902 / .125) );--toast-warning-bg: light-dark(oklch(98.7% .022 95.277), oklch(28.6% .066 53.813));--toast-warning-text: light-dark(oklch(66.6% .179 58.318), oklch(92.4% .12 95.746));--toast-warning-border: light-dark( oklch(76.9% .188 70.08 / .15), oklch(92.4% .12 95.746 / .125) );--toast-action-bg: light-dark(var(--color-black), var(--color-white));--toast-action-text: light-dark(var(--color-white), var(--color-black));--toast-action-border: light-dark(var(--color-black), var(--color-white));--toast-cancel-bg: light-dark(oklch(86.9% .005 56.366 / .3), oklch(26.8% .007 34.298 / .85));--toast-cancel-border: light-dark( oklch(86.9% .005 56.366 / .1), oklch(26.8% .007 34.298 / .5) );position:fixed;z-index:var(--toast-z-index);width:auto;pointer-events:none;overflow:visible;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.toast-container[data-position^=top]{top:var(--toast-offset-mobile-top);left:var(--toast-offset-mobile-left);right:var(--toast-offset-mobile-right)}.toast-container[data-position^=bottom]{bottom:var(--toast-offset-mobile-bottom);left:var(--toast-offset-mobile-left);right:var(--toast-offset-mobile-right)}@media(width>=40rem){.toast-container{width:var(--toast-width)}.toast-container[data-position=top-left]{top:var(--toast-offset-top);left:var(--toast-offset-left);right:auto;align-items:flex-start}.toast-container[data-position=top-center]{top:var(--toast-offset-top);left:50%;transform:translate(-50%);align-items:center}.toast-container[data-position=top-right]{top:var(--toast-offset-top);right:var(--toast-offset-right);left:auto;align-items:flex-end}.toast-container[data-position=bottom-left]{bottom:var(--toast-offset-bottom);left:var(--toast-offset-left);right:auto;align-items:flex-start}.toast-container[data-position=bottom-center]{bottom:var(--toast-offset-bottom);left:50%;transform:translate(-50%);align-items:center}.toast-container[data-position=bottom-right]{bottom:var(--toast-offset-bottom);right:var(--toast-offset-right);left:auto;align-items:flex-end}}\n"] }]
|
|
1575
1433
|
}], ctorParameters: () => [], propDecorators: { durationMs: [{ type: i0.Input, args: [{ isSignal: true, alias: "duration", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], stacked: [{ type: i0.Input, args: [{ isSignal: true, alias: "stacked", required: false }] }], offset: [{ type: i0.Input, args: [{ isSignal: true, alias: "offset", required: false }] }], mobileOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "mobileOffset", required: false }] }], richColors: [{ type: i0.Input, args: [{ isSignal: true, alias: "richColors", required: false }] }], theme: [{ type: i0.Input, args: [{ isSignal: true, alias: "theme", required: false }] }], icons: [{ type: i0.Input, args: [{ isSignal: true, alias: "icons", required: false }] }], toastOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "toastOptions", required: false }] }], closeButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeButton", required: false }] }], accessibilityLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "accessibilityLabels", required: false }] }] } });
|
|
1576
1434
|
|
|
1577
1435
|
/*
|