@wizco/fenixds-ngx 17.11.2 → 17.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/toast/toast.component.mjs +88 -0
- package/esm2022/lib/toast/toast.service.mjs +34 -0
- package/esm2022/lib/toast/toast.types.mjs +2 -0
- package/esm2022/public-api.mjs +5 -1
- package/fesm2022/wizco-fenixds-ngx.mjs +116 -2
- package/fesm2022/wizco-fenixds-ngx.mjs.map +1 -1
- package/lib/toast/toast.component.d.ts +32 -0
- package/lib/toast/toast.component.d.ts.map +1 -0
- package/lib/toast/toast.service.d.ts +13 -0
- package/lib/toast/toast.service.d.ts.map +1 -0
- package/lib/toast/toast.types.d.ts +49 -0
- package/lib/toast/toast.types.d.ts.map +1 -0
- package/package.json +1 -1
- package/public-api.d.ts +3 -0
- package/public-api.d.ts.map +1 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { Component, Input } from '@angular/core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import * as i1 from "@angular/platform-browser";
|
|
5
|
+
import * as i2 from "@angular/common";
|
|
6
|
+
export class WcoToastComponent {
|
|
7
|
+
sanitizer;
|
|
8
|
+
position = 'bottom-right';
|
|
9
|
+
configManual;
|
|
10
|
+
toasts = [];
|
|
11
|
+
constructor(sanitizer) {
|
|
12
|
+
this.sanitizer = sanitizer;
|
|
13
|
+
}
|
|
14
|
+
ngOnInit() { }
|
|
15
|
+
ngOnDestroy() {
|
|
16
|
+
this.toasts.forEach((t) => {
|
|
17
|
+
if (t.timer)
|
|
18
|
+
clearTimeout(t.timer);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
add(config) {
|
|
22
|
+
const id = 'wco-toast-' + Math.random().toString(36).substring(7);
|
|
23
|
+
const duration = config.duration ?? 4000;
|
|
24
|
+
const item = {
|
|
25
|
+
id,
|
|
26
|
+
config: { showIcon: true, type: 'info', ...config },
|
|
27
|
+
visible: true,
|
|
28
|
+
};
|
|
29
|
+
this.toasts.push(item);
|
|
30
|
+
setTimeout(() => {
|
|
31
|
+
const el = document.getElementById(id);
|
|
32
|
+
if (el && el.offsetHeight > 55)
|
|
33
|
+
item.tall = true;
|
|
34
|
+
}, 50);
|
|
35
|
+
if (duration > 0) {
|
|
36
|
+
item.timer = setTimeout(() => this.dismiss(id), duration);
|
|
37
|
+
}
|
|
38
|
+
return id;
|
|
39
|
+
}
|
|
40
|
+
dismiss(id) {
|
|
41
|
+
const item = this.toasts.find((t) => t.id === id);
|
|
42
|
+
if (!item)
|
|
43
|
+
return;
|
|
44
|
+
if (item.timer)
|
|
45
|
+
clearTimeout(item.timer);
|
|
46
|
+
item.visible = false;
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
this.toasts = this.toasts.filter((t) => t.id !== id);
|
|
49
|
+
}, 300);
|
|
50
|
+
}
|
|
51
|
+
getSafeHtml(value) {
|
|
52
|
+
return this.sanitizer.bypassSecurityTrustHtml(value || '');
|
|
53
|
+
}
|
|
54
|
+
getIconMaterial(config) {
|
|
55
|
+
switch (config.type) {
|
|
56
|
+
case 'error':
|
|
57
|
+
return { icon: 'error_outline', color: 'error' };
|
|
58
|
+
case 'warning':
|
|
59
|
+
return { icon: 'warning_amber', color: 'warning' };
|
|
60
|
+
case 'success':
|
|
61
|
+
return { icon: 'check_circle_outline', color: 'success' };
|
|
62
|
+
case 'loading':
|
|
63
|
+
return { icon: 'autorenew', color: 'loading' };
|
|
64
|
+
default:
|
|
65
|
+
return { icon: 'info', color: 'info' };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
getButtonClass(action) {
|
|
69
|
+
const extraClasse = action.extraClasse ?? 'wco-btn btn-sm btn-outline btn-link wco-toast-btn';
|
|
70
|
+
return `${extraClasse}`.trim();
|
|
71
|
+
}
|
|
72
|
+
trackById(_, item) {
|
|
73
|
+
return item.id;
|
|
74
|
+
}
|
|
75
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: WcoToastComponent, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
|
|
76
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: WcoToastComponent, isStandalone: true, selector: "wco-toast", inputs: { position: "position", configManual: "configManual", toasts: "toasts" }, ngImport: i0, template: "<dialog open class=\"wco-toast-container\" [class]=\"'wco-toast-container--' + position\">\n <span class=\"wco-toast__hover-zone\"></span>\n <div\n *ngFor=\"let toast of toasts; trackBy: trackById;let i = index\"\n class=\"wco-toast\"\n [id]=\"toast.id\"\n [class.wco-toast--visible]=\"toast.visible\"\n [class.wco-toast--start]=\"toast.tall\"\n [attr.data-position]=\"i\"\n [class]=\"'wco-toast wco-toast--mini wco-toast--' + getIconMaterial(toast.config).color + (toast.visible ? ' wco-toast--visible' : '')\"\n >\n <div class=\"wco-toast__body\">\n <ng-container *ngIf=\"toast.config.showIcon\">\n <span class=\"wco-toast__icon material-icons-round\">\n <ng-container *ngIf=\"toast.config.materialIcon; else defaultIcon\">\n {{ toast.config.materialIcon }}\n </ng-container>\n <ng-template #defaultIcon>\n {{ getIconMaterial(toast.config).icon }}\n </ng-template>\n </span>\n </ng-container>\n\n <div class=\"wco-toast__content\">\n <span>\n <p class=\"wco-toast__title\" *ngIf=\"toast.config.title\" [innerHTML]=\"getSafeHtml(toast.config.title)\"></p>\n <p class=\"wco-toast__message\" *ngIf=\"toast.config.message && toast.config.message.length \" [innerHTML]=\"getSafeHtml(toast.config.message)\"></p>\n </span>\n <div class=\"wco-toast__actions\" *ngIf=\"toast.config.actions && toast.config.actions.length > 0\">\n <button\n type=\"button\"\n *ngFor=\"let action of toast.config.actions\"\n [class]=\"getButtonClass(action)\"\n (click)=\"action.action(); dismiss(toast.id)\"\n >\n <span class=\"material-icons-round\" *ngIf=\"action.materialIconLeft\">{{ action.materialIconLeft }}</span>\n {{ action.text }}\n <span class=\"material-icons-round\" *ngIf=\"action.materialIconRight\">{{ action.materialIconRight }}</span>\n </button>\n </div>\n </div>\n </div>\n\n <button class=\"wco-toast__close\" *ngIf=\"toast.config.close !== false\" (click)=\"dismiss(toast.id)\" aria-label=\"Fechar\">\n <span class=\"material-icons\">close</span>\n </button>\n </div>\n \n</dialog>\n", styles: ["@layer state{.wco-toast-container{--wco-toast-padding: var(--wco-spacing-nano, 8px);--wco-toast-gap: var(--wco-spacing-nano, 8px);--wco-toast-radius: var(--wco-radius-md, 8px);--wco-toast-w-clamp: clamp(250px, 280px, 420px);--wco-toast-bg: var(--wco-color-panel) }}.wco-toast-container{margin:0;padding:0;border:none;background:transparent;max-width:none;max-height:none;overflow:visible;top:unset;right:unset;bottom:unset;left:unset;transition:all .1s linear .3s;opacity:1;transform:translateY(0);position:fixed;z-index:9999;display:flex;flex-direction:column;gap:var(--wco-spacing-xs);pointer-events:none}@starting-style{.wco-toast-container{opacity:0;transform:scaleY(12px)}}.wco-toast-container:has(.wco-toast-btn){--wco-toast-align-flex: flex- --wc-toast-align-direction: }.wco-toast-container::backdrop{display:none}.wco-toast-container--top-right{top:var(--wco-spacing-md);right:var(--wco-spacing-md);align-items:flex-end}.wco-toast-container--top-left{top:var(--wco-spacing-md);left:var(--wco-spacing-md);align-items:flex-start}.wco-toast-container--bottom-right{bottom:var(--wco-spacing-md);right:var(--wco-spacing-md);align-items:flex-end}.wco-toast-container--bottom-left{bottom:var(--wco-spacing-md);left:var(--wco-spacing-md);align-items:flex-start}.wco-toast-container--top-center{top:var(--wco-spacing-md);left:50%;transform:translate(-50%);align-items:center}.wco-toast-container--bottom-center{bottom:var(--wco-spacing-md);left:50%;transform:translate(-50%);align-items:center}@media (max-width: 600px){.wco-toast-container--top-right,.wco-toast-container--top-left,.wco-toast-container--top-center,.wco-toast-container--bottom-right,.wco-toast-container--bottom-left,.wco-toast-container--bottom-center{top:unset;right:unset;left:50%;bottom:var(--wco-spacing-xxs);transform:translate(-50%);align-items:center;width:calc(100vw - var(--wco-spacing-xxxs))}.wco-toast-container--top-right .wco-toast,.wco-toast-container--top-left .wco-toast,.wco-toast-container--top-center .wco-toast,.wco-toast-container--bottom-right .wco-toast,.wco-toast-container--bottom-left .wco-toast,.wco-toast-container--bottom-center .wco-toast{width:100%}}.wco-toast{pointer-events:all;display:flex;align-items:center;gap:var(--wco-toast-gap, 8px);width:var(--wco-toast-w-clamp, 250px);padding:var(--wco-toast-padding, 8px);border-radius:var(--wco-toast-radius, 8px);background:var(--wco-toast-bg, #fff);box-shadow:var(--wco-shadow-level-1);opacity:0;transform:translateY(-8px);transition:opacity .3s ease,transform .3s ease}.wco-toast.wco-toast--start{align-items:flex-start}.wco-toast.wco-toast--start:has(.btn-link) .wco-toast__close{margin-top:var(--wco-spacing-nano)}.wco-toast.wco-toast--start>.wco-toast__body,.wco-toast.wco-toast--start .wco-toast__content{align-items:flex-start}.wco-toast:has(.wco-toast__message) .wco-toast__title{font-weight:600}.wco-toast.wco-toast--mini{--wco-toast-w-clamp: fit-content;max-width:570px}.wco-toast--visible{opacity:1;transform:translateY(0)}.wco-toast--info{--wco-toast-color-type: var(--wco-color-info-600)}.wco-toast--success{--wco-toast-color-type: var(--wco-color-success-600)}.wco-toast--warning{--wco-toast-color-type: var(--wco-color-warning-600)}.wco-toast--error{--wco-toast-color-type: var(--wco-color-danger-600)}.wco-toast--loading{--wco-toast-color-type: var(--wco-color-secondary-600)}.wco-toast--loading .wco-toast__icon{animation:wco-toast-spin 1s linear infinite}@keyframes wco-toast-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.wco-toast__body{display:flex;align-items:center;gap:var(--wco-toast-gap, 8px);flex:1;min-width:0}.wco-toast__icon{font-size:var(--wco-iconography-size-xs);color:var(--wco-toast-color-type);flex-shrink:0;margin-top:0}.wco-toast__content{display:flex;flex-direction:row;align-items:center;gap:var(--wco-toast-gap, 8px);flex:1;min-width:0}.wco-toast__title{font-size:var(--wco-font-size-xs, 14px);font-weight:300;color:var(--wco-color-neutral-900);line-height:1.4;margin:0}.wco-toast__message{font-size:var(--wco-font-size-xxs, 12px);font-weight:400;color:var(--wco-color-neutral-700);line-height:1.5;margin:0}.wco-toast__actions{display:flex;flex-wrap:wrap;gap:var(--wco-spacing-nano)}.wco-toast__close{background:none;border:none;cursor:pointer;padding:0;color:var(--wco-color-neutral-500);display:flex;align-items:center;flex-shrink:0;line-height:1}.wco-toast__close span{font-size:18px}.wco-toast__close:hover{color:var(--wco-color-neutral-900)}.wco-toast-container .wco-toast__hover-zone{position:absolute;inset:-16px;pointer-events:auto;z-index:0}.wco-toast-container .wco-toast{position:relative;z-index:1;transition:transform .2s ease,opacity .2s ease,top .2s ease}@starting-style{.wco-toast-container .wco-toast{transform:translateY(24px)}}.wco-toast-container:not(:hover) .wco-toast:not(:last-child){position:absolute;box-shadow:none;width:100%;height:50px;overflow:hidden;transform:scale(.95)}.wco-toast-container:not(:hover) .wco-toast:not(:last-child)>*{opacity:0;transition:opacity .15s ease}.wco-toast-container:not(:hover) .wco-toast:nth-last-child(2){top:-10px;transform:scale(.95);box-shadow:var(--wco-shadow-level-3)}.wco-toast-container:not(:hover) .wco-toast:nth-last-child(3){top:-20px;transform:scale(.85);box-shadow:var(--wco-shadow-level-2)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
77
|
+
}
|
|
78
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: WcoToastComponent, decorators: [{
|
|
79
|
+
type: Component,
|
|
80
|
+
args: [{ selector: 'wco-toast', standalone: true, imports: [CommonModule], template: "<dialog open class=\"wco-toast-container\" [class]=\"'wco-toast-container--' + position\">\n <span class=\"wco-toast__hover-zone\"></span>\n <div\n *ngFor=\"let toast of toasts; trackBy: trackById;let i = index\"\n class=\"wco-toast\"\n [id]=\"toast.id\"\n [class.wco-toast--visible]=\"toast.visible\"\n [class.wco-toast--start]=\"toast.tall\"\n [attr.data-position]=\"i\"\n [class]=\"'wco-toast wco-toast--mini wco-toast--' + getIconMaterial(toast.config).color + (toast.visible ? ' wco-toast--visible' : '')\"\n >\n <div class=\"wco-toast__body\">\n <ng-container *ngIf=\"toast.config.showIcon\">\n <span class=\"wco-toast__icon material-icons-round\">\n <ng-container *ngIf=\"toast.config.materialIcon; else defaultIcon\">\n {{ toast.config.materialIcon }}\n </ng-container>\n <ng-template #defaultIcon>\n {{ getIconMaterial(toast.config).icon }}\n </ng-template>\n </span>\n </ng-container>\n\n <div class=\"wco-toast__content\">\n <span>\n <p class=\"wco-toast__title\" *ngIf=\"toast.config.title\" [innerHTML]=\"getSafeHtml(toast.config.title)\"></p>\n <p class=\"wco-toast__message\" *ngIf=\"toast.config.message && toast.config.message.length \" [innerHTML]=\"getSafeHtml(toast.config.message)\"></p>\n </span>\n <div class=\"wco-toast__actions\" *ngIf=\"toast.config.actions && toast.config.actions.length > 0\">\n <button\n type=\"button\"\n *ngFor=\"let action of toast.config.actions\"\n [class]=\"getButtonClass(action)\"\n (click)=\"action.action(); dismiss(toast.id)\"\n >\n <span class=\"material-icons-round\" *ngIf=\"action.materialIconLeft\">{{ action.materialIconLeft }}</span>\n {{ action.text }}\n <span class=\"material-icons-round\" *ngIf=\"action.materialIconRight\">{{ action.materialIconRight }}</span>\n </button>\n </div>\n </div>\n </div>\n\n <button class=\"wco-toast__close\" *ngIf=\"toast.config.close !== false\" (click)=\"dismiss(toast.id)\" aria-label=\"Fechar\">\n <span class=\"material-icons\">close</span>\n </button>\n </div>\n \n</dialog>\n", styles: ["@layer state{.wco-toast-container{--wco-toast-padding: var(--wco-spacing-nano, 8px);--wco-toast-gap: var(--wco-spacing-nano, 8px);--wco-toast-radius: var(--wco-radius-md, 8px);--wco-toast-w-clamp: clamp(250px, 280px, 420px);--wco-toast-bg: var(--wco-color-panel) }}.wco-toast-container{margin:0;padding:0;border:none;background:transparent;max-width:none;max-height:none;overflow:visible;top:unset;right:unset;bottom:unset;left:unset;transition:all .1s linear .3s;opacity:1;transform:translateY(0);position:fixed;z-index:9999;display:flex;flex-direction:column;gap:var(--wco-spacing-xs);pointer-events:none}@starting-style{.wco-toast-container{opacity:0;transform:scaleY(12px)}}.wco-toast-container:has(.wco-toast-btn){--wco-toast-align-flex: flex- --wc-toast-align-direction: }.wco-toast-container::backdrop{display:none}.wco-toast-container--top-right{top:var(--wco-spacing-md);right:var(--wco-spacing-md);align-items:flex-end}.wco-toast-container--top-left{top:var(--wco-spacing-md);left:var(--wco-spacing-md);align-items:flex-start}.wco-toast-container--bottom-right{bottom:var(--wco-spacing-md);right:var(--wco-spacing-md);align-items:flex-end}.wco-toast-container--bottom-left{bottom:var(--wco-spacing-md);left:var(--wco-spacing-md);align-items:flex-start}.wco-toast-container--top-center{top:var(--wco-spacing-md);left:50%;transform:translate(-50%);align-items:center}.wco-toast-container--bottom-center{bottom:var(--wco-spacing-md);left:50%;transform:translate(-50%);align-items:center}@media (max-width: 600px){.wco-toast-container--top-right,.wco-toast-container--top-left,.wco-toast-container--top-center,.wco-toast-container--bottom-right,.wco-toast-container--bottom-left,.wco-toast-container--bottom-center{top:unset;right:unset;left:50%;bottom:var(--wco-spacing-xxs);transform:translate(-50%);align-items:center;width:calc(100vw - var(--wco-spacing-xxxs))}.wco-toast-container--top-right .wco-toast,.wco-toast-container--top-left .wco-toast,.wco-toast-container--top-center .wco-toast,.wco-toast-container--bottom-right .wco-toast,.wco-toast-container--bottom-left .wco-toast,.wco-toast-container--bottom-center .wco-toast{width:100%}}.wco-toast{pointer-events:all;display:flex;align-items:center;gap:var(--wco-toast-gap, 8px);width:var(--wco-toast-w-clamp, 250px);padding:var(--wco-toast-padding, 8px);border-radius:var(--wco-toast-radius, 8px);background:var(--wco-toast-bg, #fff);box-shadow:var(--wco-shadow-level-1);opacity:0;transform:translateY(-8px);transition:opacity .3s ease,transform .3s ease}.wco-toast.wco-toast--start{align-items:flex-start}.wco-toast.wco-toast--start:has(.btn-link) .wco-toast__close{margin-top:var(--wco-spacing-nano)}.wco-toast.wco-toast--start>.wco-toast__body,.wco-toast.wco-toast--start .wco-toast__content{align-items:flex-start}.wco-toast:has(.wco-toast__message) .wco-toast__title{font-weight:600}.wco-toast.wco-toast--mini{--wco-toast-w-clamp: fit-content;max-width:570px}.wco-toast--visible{opacity:1;transform:translateY(0)}.wco-toast--info{--wco-toast-color-type: var(--wco-color-info-600)}.wco-toast--success{--wco-toast-color-type: var(--wco-color-success-600)}.wco-toast--warning{--wco-toast-color-type: var(--wco-color-warning-600)}.wco-toast--error{--wco-toast-color-type: var(--wco-color-danger-600)}.wco-toast--loading{--wco-toast-color-type: var(--wco-color-secondary-600)}.wco-toast--loading .wco-toast__icon{animation:wco-toast-spin 1s linear infinite}@keyframes wco-toast-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.wco-toast__body{display:flex;align-items:center;gap:var(--wco-toast-gap, 8px);flex:1;min-width:0}.wco-toast__icon{font-size:var(--wco-iconography-size-xs);color:var(--wco-toast-color-type);flex-shrink:0;margin-top:0}.wco-toast__content{display:flex;flex-direction:row;align-items:center;gap:var(--wco-toast-gap, 8px);flex:1;min-width:0}.wco-toast__title{font-size:var(--wco-font-size-xs, 14px);font-weight:300;color:var(--wco-color-neutral-900);line-height:1.4;margin:0}.wco-toast__message{font-size:var(--wco-font-size-xxs, 12px);font-weight:400;color:var(--wco-color-neutral-700);line-height:1.5;margin:0}.wco-toast__actions{display:flex;flex-wrap:wrap;gap:var(--wco-spacing-nano)}.wco-toast__close{background:none;border:none;cursor:pointer;padding:0;color:var(--wco-color-neutral-500);display:flex;align-items:center;flex-shrink:0;line-height:1}.wco-toast__close span{font-size:18px}.wco-toast__close:hover{color:var(--wco-color-neutral-900)}.wco-toast-container .wco-toast__hover-zone{position:absolute;inset:-16px;pointer-events:auto;z-index:0}.wco-toast-container .wco-toast{position:relative;z-index:1;transition:transform .2s ease,opacity .2s ease,top .2s ease}@starting-style{.wco-toast-container .wco-toast{transform:translateY(24px)}}.wco-toast-container:not(:hover) .wco-toast:not(:last-child){position:absolute;box-shadow:none;width:100%;height:50px;overflow:hidden;transform:scale(.95)}.wco-toast-container:not(:hover) .wco-toast:not(:last-child)>*{opacity:0;transition:opacity .15s ease}.wco-toast-container:not(:hover) .wco-toast:nth-last-child(2){top:-10px;transform:scale(.95);box-shadow:var(--wco-shadow-level-3)}.wco-toast-container:not(:hover) .wco-toast:nth-last-child(3){top:-20px;transform:scale(.85);box-shadow:var(--wco-shadow-level-2)}\n"] }]
|
|
81
|
+
}], ctorParameters: () => [{ type: i1.DomSanitizer }], propDecorators: { position: [{
|
|
82
|
+
type: Input
|
|
83
|
+
}], configManual: [{
|
|
84
|
+
type: Input
|
|
85
|
+
}], toasts: [{
|
|
86
|
+
type: Input
|
|
87
|
+
}] } });
|
|
88
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9hc3QuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvbmd4LWNvbXBvbmVudHMvc3JjL2xpYi90b2FzdC90b2FzdC5jb21wb25lbnQudHMiLCIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9uZ3gtY29tcG9uZW50cy9zcmMvbGliL3RvYXN0L3RvYXN0LmNvbXBvbmVudC5odG1sIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUMvQyxPQUFPLEVBQUUsU0FBUyxFQUFFLEtBQUssRUFBcUIsTUFBTSxlQUFlLENBQUM7Ozs7QUFtQnBFLE1BQU0sT0FBTyxpQk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VwiaVwiXG4gICAgW2NsYXNzXT1cIid3Y28tdG9hc3Qgd2NvLXRvYXN0LS1taW5pIHdjby10b2FzdC0tJyArIGdldEljb25NYXRlcmlhbCh0b2FzdC5jb25maWcpLmNvbG9yICsgKHRvYXN0LnZpc2libGUgPyAnIHdjby10b2FzdC0tdmlzaWJsZScgOiAnJylcIlxuICA+XG4gICAgPGRpdiBjbGFzcz1cIndjby10b2FzdF9fYm9keVwiPlxuICAgICAgPG5nLWNvbnRhaW5lciAqbmdJZj1cInRvYXN0LmNvbmZpZy5zaG93SWNvblwiPlxuICAgICAgICA8c3BhbiBjbGFzcz1cIndjby10b2FzdF9faWNvbiBtYXRlcmlhbC1pY29ucy1yb3VuZFwiPlxuICAgICAgICAgIDxuZy1jb250YWluZXIgKm5nSWY9XCJ0b2FzdC5jb25maWcubWF0ZXJpYWxJY29uOyBlbHNlIGRlZmF1bHRJY29uXCI+XG4gICAgICAgICAgICB7eyB0b2FzdC5jb25maWcubWF0ZXJpYWxJY29uIH19XG4gICAgICAgICAgPC9uZy1jb250YWluZXI+XG4gICAgICAgICAgPG5nLXRlbXBsYXRlICNkZWZhdWx0SWNvbj5cbiAgICAgICAgICAgIHt7IGdldEljb25NYXRlcmlhbCh0b2FzdC5jb25maWcpLmljb24gfX1cbiAgICAgICAgICA8L25nLXRlbXBsYXRlPlxuICAgICAgICA8L3NwYW4+XG4gICAgICA8L25nLWNvbnRhaW5lcj5cblxuICAgICAgPGRpdiBjbGFzcz1cIndjby10b2FzdF9fY29udGVudFwiPlxuICAgICAgICA8c3Bhbj5cbiAgICAgICAgICA8cCBjbGFzcz1cIndjby10b2FzdF9fdGl0bGVcIiAqbmdJZj1cInRvYXN0LmNvbmZpZy50aXRsZVwiIFtpbm5lckhUTUxdPVwiZ2V0U2FmZUh0bWwodG9hc3QuY29uZmlnLnRpdGxlKVwiPjwvcD5cbiAgICAgICAgICA8cCBjbGFzcz1cIndjby10b2FzdF9fbWVzc2FnZVwiICpuZ0lmPVwid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HRvbiBjbGFzcz1cIndjby10b2FzdF9fY2xvc2VcIiAqbmdJZj1cInRvYXN0LmNvbmZpZy5jbG9zZSAhPT0gZmFsc2VcIiAoY2xpY2spPVwiZGlzbWlzcyh0b2FzdC5pZClcIiBhcmlhLWxhYmVsPVwiRmVjaGFyXCI+XG4gICAgICA8c3BhbiBjbGFzcz1cIm1hdGVyaWFsLWljb25zXCI+Y2xvc2U8L3NwYW4+XG4gICAgPC9idXR0b24+XG4gIDwvZGl2PlxuICBcbjwvZGlhbG9nPlxuIl19
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ApplicationRef, createComponent, EnvironmentInjector, inject, Injectable, } from '@angular/core';
|
|
2
|
+
import { WcoToastComponent } from './toast.component';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export class WcoToastService {
|
|
5
|
+
appRef = inject(ApplicationRef);
|
|
6
|
+
injector = inject(EnvironmentInjector);
|
|
7
|
+
componentRef = null;
|
|
8
|
+
get instance() {
|
|
9
|
+
if (!this.componentRef) {
|
|
10
|
+
this.componentRef = createComponent(WcoToastComponent, {
|
|
11
|
+
environmentInjector: this.injector,
|
|
12
|
+
});
|
|
13
|
+
this.appRef.attachView(this.componentRef.hostView);
|
|
14
|
+
document.body.appendChild(this.componentRef.location.nativeElement);
|
|
15
|
+
}
|
|
16
|
+
return this.componentRef.instance;
|
|
17
|
+
}
|
|
18
|
+
show(config) {
|
|
19
|
+
if (config.position) {
|
|
20
|
+
this.instance.position = config.position;
|
|
21
|
+
}
|
|
22
|
+
return this.instance.add(config);
|
|
23
|
+
}
|
|
24
|
+
dismiss(id) {
|
|
25
|
+
this.componentRef?.instance.dismiss(id);
|
|
26
|
+
}
|
|
27
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: WcoToastService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
28
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: WcoToastService, providedIn: 'root' });
|
|
29
|
+
}
|
|
30
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: WcoToastService, decorators: [{
|
|
31
|
+
type: Injectable,
|
|
32
|
+
args: [{ providedIn: 'root' }]
|
|
33
|
+
}] });
|
|
34
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9hc3Quc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL25neC1jb21wb25lbnRzL3NyYy9saWIvdG9hc3QvdG9hc3Quc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0wsY0FBYyxFQUVkLGVBQWUsRUFDZixtQkFBbUIsRUFDbkIsTUFBTSxFQUNOLFVBQVUsR0FDWCxNQUFNLGVBQWUsQ0FBQztBQUN2QixPQUFPLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQzs7QUFJdEQsTUFBTSxPQUFPLGVBQWU7SUFDbEIsTUFBTSxHQUFHLE1BQU0sQ0FBQyxjQUFjLENBQUMsQ0FBQztJQUNoQyxRQUFRLEdBQUcsTUFBTSxDQUFDLG1CQUFtQixDQUFDLENBQUM7SUFFdkMsWUFBWSxHQUEyQyxJQUFJLENBQUM7SUFFcEUsSUFBWSxRQUFRO1FBQ2xCLElBQUksQ0FBQyxJQUFJLENBQUMsWUFBWSxFQUFFLENBQUM7WUFDdkIsSUFBSSxDQUFDLFlBQVksR0FBRyxlQUFlLENBQUMsaUJBQWlCLEVBQUU7Z0JBQ3JELG1CQUFtQixFQUFFLElBQUksQ0FBQyxRQUFRO2FBQ25DLENBQUMsQ0FBQztZQUVILElBQUksQ0FBQyxNQUFNLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxZ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86IHN0cmluZztcbiAgLyoqXG4gICAqIEBkZXNjcmlwdGlvbiBUw610dWxvIGRvIHRvYXN0IChhY2VpdGEgSFRNTClcbiAgICovXG4gIHRpdGxlPzogc3RyaW5nO1xuICAvKipcbiAgICogQGRlc2NyaXB0aW9uIE1lbnNhZ2VtIGRvIHRvYXN0IChhY2VpdGEgSFRNTClcbiAgICovXG4gIG1lc3NhZ2U/OiBzdHJpbmc7XG4gIC8qKlxuICAgKiBAZGVzY3JpcHRpb24gQcOnw7VlcyBkbyB0b2FzdFxuICAgKi9cbiAgYWN0aW9ucz86IFdjb1RvYXN0Q29uZmlnQWN0aW9uc1R5cGVzW107XG4gIC8qKlxuICAgKiBAZGVzY3JpcHRpb24gVGVtcG8gZW0gbXMgcGFyYSBmZWNoYXIgYXV0b21hdGljYW1lbnRlLiAwID0gbsOjbyBmZWNoYSBhdXRvbWF0aWNhbWVudGUuXG4gICAqIEBkZWZhdWx0IDQwMDBcbiAgICovXG4gIGR1cmF0aW9uPzogbnVtYmVyO1xuICAvKipcbiAgICogQGRlc2NyaXB0aW9uIFBvc2nDp8OjbyBkbyB0b2FzdCBuYSB0ZWxhXG4gICAqIEBkZWZhdWx0ICdib3R0b20tcmlnaHQnXG4gICAqL1xuICBwb3NpdGlvbj86ICd0b3AtcmlnaHQnIHwgJ3RvcC1sZWZ0JyB8ICdib3R0b20tcmlnaHQnIHwgJ2JvdHRvbS1sZWZ0JyB8ICd0b3AtY2VudGVyJyB8ICdib3R0b20tY2VudGVyJztcblxuXG4gIC8qKiBcbiAgICogQGRlc2NyaXB0aW9uIFBlcm1pdGUgb2N1bGFyIG8gaWNvbmUgZGUgZmVjaGFyIGRvIHRvYXN0LlxuICAgKiBAZGVmYXVsdCB0cnVlXG4gICAqL1xuICBjbG9zZT86IGJvb2xlYW47XG59XG4iXX0=
|
package/esm2022/public-api.mjs
CHANGED
|
@@ -30,6 +30,10 @@ export * from './lib/modal-alert/modal-alert.types';
|
|
|
30
30
|
// Table
|
|
31
31
|
export * from './lib/table/table.component';
|
|
32
32
|
export * from './lib/table/table.types';
|
|
33
|
+
// Toast
|
|
34
|
+
export * from './lib/toast/toast.component';
|
|
35
|
+
export * from './lib/toast/toast.service';
|
|
36
|
+
export * from './lib/toast/toast.types';
|
|
33
37
|
// Sub Tabs
|
|
34
38
|
export * from './lib/sub-tabs/sub-tabs.component';
|
|
35
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
39
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL25neC1jb21wb25lbnRzL3NyYy9wdWJsaWMtYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYywyQkFBMkIsQ0FBQztBQUMxQyxjQUFjLGlDQUFpQyxDQUFDO0FBQ2hELGNBQWMsNkNBQTZDLENBQUM7QUFDNUQsY0FBYywrQkFBK0IsQ0FBQztBQUM5QyxjQUFjLDJCQUEyQixDQUFDO0FBRTFDLG1CQUFtQjtBQUNuQixjQUFjLG1EQUFtRCxDQUFDO0FBQ2xFLGNBQWMsOENBQThDLENBQUM7QUFFN0QsYUFBYTtBQUNiLGNBQWMsMkJBQTJCLENBQUM7QUFDMUMsY0FBYyx1QkFBdUIsQ0FBQztBQUV0QyxZQUFZO0FBQ1osY0FBYyx1Q0FBdUMsQ0FBQztBQUV0RCxTQUFTO0FBQ1QsY0FBYyx5Q0FBeUMsQ0FBQztBQUV4RCxlQUFlO0FBQ2YsY0FBYywyQ0FBMkMsQ0FBQztBQUMxRCxjQUFjLG1EQUFtRCxDQUFDO0FBRWxFLFdBQVc7QUFDWCxjQUFjLG1DQUFtQyxDQUFDO0FBRWxELGVBQWU7QUFDZixjQUFjLDJDQUEyQyxDQUFDO0FBQzFELGNBQWMsdUNBQXVDLENBQUM7QUF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saWIvdG9hc3QvdG9hc3QudHlwZXMnO1xuLy8gU3ViIFRhYnNcbmV4cG9ydCAqIGZyb20gJy4vbGliL3N1Yi10YWJzL3N1Yi10YWJzLmNvbXBvbmVudCc7XG4iXX0=
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i1 from '@angular/common';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { EventEmitter, Component, ViewEncapsulation, Input, Output, ContentChildren, ViewChild, HostListener, SkipSelf, ChangeDetectionStrategy, forwardRef, signal } from '@angular/core';
|
|
4
|
+
import { EventEmitter, Component, ViewEncapsulation, Input, Output, ContentChildren, ViewChild, HostListener, SkipSelf, ChangeDetectionStrategy, forwardRef, signal, inject, ApplicationRef, EnvironmentInjector, createComponent, Injectable } from '@angular/core';
|
|
5
5
|
import * as i1$1 from '@angular/common/http';
|
|
6
6
|
import { HttpEventType, HttpClientModule } from '@angular/common/http';
|
|
7
7
|
import * as i1$2 from '@angular/router';
|
|
@@ -2187,6 +2187,120 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2187
2187
|
args: ['table']
|
|
2188
2188
|
}] } });
|
|
2189
2189
|
|
|
2190
|
+
class WcoToastComponent {
|
|
2191
|
+
sanitizer;
|
|
2192
|
+
position = 'bottom-right';
|
|
2193
|
+
configManual;
|
|
2194
|
+
toasts = [];
|
|
2195
|
+
constructor(sanitizer) {
|
|
2196
|
+
this.sanitizer = sanitizer;
|
|
2197
|
+
}
|
|
2198
|
+
ngOnInit() { }
|
|
2199
|
+
ngOnDestroy() {
|
|
2200
|
+
this.toasts.forEach((t) => {
|
|
2201
|
+
if (t.timer)
|
|
2202
|
+
clearTimeout(t.timer);
|
|
2203
|
+
});
|
|
2204
|
+
}
|
|
2205
|
+
add(config) {
|
|
2206
|
+
const id = 'wco-toast-' + Math.random().toString(36).substring(7);
|
|
2207
|
+
const duration = config.duration ?? 4000;
|
|
2208
|
+
const item = {
|
|
2209
|
+
id,
|
|
2210
|
+
config: { showIcon: true, type: 'info', ...config },
|
|
2211
|
+
visible: true,
|
|
2212
|
+
};
|
|
2213
|
+
this.toasts.push(item);
|
|
2214
|
+
setTimeout(() => {
|
|
2215
|
+
const el = document.getElementById(id);
|
|
2216
|
+
if (el && el.offsetHeight > 55)
|
|
2217
|
+
item.tall = true;
|
|
2218
|
+
}, 50);
|
|
2219
|
+
if (duration > 0) {
|
|
2220
|
+
item.timer = setTimeout(() => this.dismiss(id), duration);
|
|
2221
|
+
}
|
|
2222
|
+
return id;
|
|
2223
|
+
}
|
|
2224
|
+
dismiss(id) {
|
|
2225
|
+
const item = this.toasts.find((t) => t.id === id);
|
|
2226
|
+
if (!item)
|
|
2227
|
+
return;
|
|
2228
|
+
if (item.timer)
|
|
2229
|
+
clearTimeout(item.timer);
|
|
2230
|
+
item.visible = false;
|
|
2231
|
+
setTimeout(() => {
|
|
2232
|
+
this.toasts = this.toasts.filter((t) => t.id !== id);
|
|
2233
|
+
}, 300);
|
|
2234
|
+
}
|
|
2235
|
+
getSafeHtml(value) {
|
|
2236
|
+
return this.sanitizer.bypassSecurityTrustHtml(value || '');
|
|
2237
|
+
}
|
|
2238
|
+
getIconMaterial(config) {
|
|
2239
|
+
switch (config.type) {
|
|
2240
|
+
case 'error':
|
|
2241
|
+
return { icon: 'error_outline', color: 'error' };
|
|
2242
|
+
case 'warning':
|
|
2243
|
+
return { icon: 'warning_amber', color: 'warning' };
|
|
2244
|
+
case 'success':
|
|
2245
|
+
return { icon: 'check_circle_outline', color: 'success' };
|
|
2246
|
+
case 'loading':
|
|
2247
|
+
return { icon: 'autorenew', color: 'loading' };
|
|
2248
|
+
default:
|
|
2249
|
+
return { icon: 'info', color: 'info' };
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
getButtonClass(action) {
|
|
2253
|
+
const extraClasse = action.extraClasse ?? 'wco-btn btn-sm btn-outline btn-link wco-toast-btn';
|
|
2254
|
+
return `${extraClasse}`.trim();
|
|
2255
|
+
}
|
|
2256
|
+
trackById(_, item) {
|
|
2257
|
+
return item.id;
|
|
2258
|
+
}
|
|
2259
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: WcoToastComponent, deps: [{ token: i1$3.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
|
|
2260
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: WcoToastComponent, isStandalone: true, selector: "wco-toast", inputs: { position: "position", configManual: "configManual", toasts: "toasts" }, ngImport: i0, template: "<dialog open class=\"wco-toast-container\" [class]=\"'wco-toast-container--' + position\">\n <span class=\"wco-toast__hover-zone\"></span>\n <div\n *ngFor=\"let toast of toasts; trackBy: trackById;let i = index\"\n class=\"wco-toast\"\n [id]=\"toast.id\"\n [class.wco-toast--visible]=\"toast.visible\"\n [class.wco-toast--start]=\"toast.tall\"\n [attr.data-position]=\"i\"\n [class]=\"'wco-toast wco-toast--mini wco-toast--' + getIconMaterial(toast.config).color + (toast.visible ? ' wco-toast--visible' : '')\"\n >\n <div class=\"wco-toast__body\">\n <ng-container *ngIf=\"toast.config.showIcon\">\n <span class=\"wco-toast__icon material-icons-round\">\n <ng-container *ngIf=\"toast.config.materialIcon; else defaultIcon\">\n {{ toast.config.materialIcon }}\n </ng-container>\n <ng-template #defaultIcon>\n {{ getIconMaterial(toast.config).icon }}\n </ng-template>\n </span>\n </ng-container>\n\n <div class=\"wco-toast__content\">\n <span>\n <p class=\"wco-toast__title\" *ngIf=\"toast.config.title\" [innerHTML]=\"getSafeHtml(toast.config.title)\"></p>\n <p class=\"wco-toast__message\" *ngIf=\"toast.config.message && toast.config.message.length \" [innerHTML]=\"getSafeHtml(toast.config.message)\"></p>\n </span>\n <div class=\"wco-toast__actions\" *ngIf=\"toast.config.actions && toast.config.actions.length > 0\">\n <button\n type=\"button\"\n *ngFor=\"let action of toast.config.actions\"\n [class]=\"getButtonClass(action)\"\n (click)=\"action.action(); dismiss(toast.id)\"\n >\n <span class=\"material-icons-round\" *ngIf=\"action.materialIconLeft\">{{ action.materialIconLeft }}</span>\n {{ action.text }}\n <span class=\"material-icons-round\" *ngIf=\"action.materialIconRight\">{{ action.materialIconRight }}</span>\n </button>\n </div>\n </div>\n </div>\n\n <button class=\"wco-toast__close\" *ngIf=\"toast.config.close !== false\" (click)=\"dismiss(toast.id)\" aria-label=\"Fechar\">\n <span class=\"material-icons\">close</span>\n </button>\n </div>\n \n</dialog>\n", styles: ["@layer state{.wco-toast-container{--wco-toast-padding: var(--wco-spacing-nano, 8px);--wco-toast-gap: var(--wco-spacing-nano, 8px);--wco-toast-radius: var(--wco-radius-md, 8px);--wco-toast-w-clamp: clamp(250px, 280px, 420px);--wco-toast-bg: var(--wco-color-panel) }}.wco-toast-container{margin:0;padding:0;border:none;background:transparent;max-width:none;max-height:none;overflow:visible;top:unset;right:unset;bottom:unset;left:unset;transition:all .1s linear .3s;opacity:1;transform:translateY(0);position:fixed;z-index:9999;display:flex;flex-direction:column;gap:var(--wco-spacing-xs);pointer-events:none}@starting-style{.wco-toast-container{opacity:0;transform:scaleY(12px)}}.wco-toast-container:has(.wco-toast-btn){--wco-toast-align-flex: flex- --wc-toast-align-direction: }.wco-toast-container::backdrop{display:none}.wco-toast-container--top-right{top:var(--wco-spacing-md);right:var(--wco-spacing-md);align-items:flex-end}.wco-toast-container--top-left{top:var(--wco-spacing-md);left:var(--wco-spacing-md);align-items:flex-start}.wco-toast-container--bottom-right{bottom:var(--wco-spacing-md);right:var(--wco-spacing-md);align-items:flex-end}.wco-toast-container--bottom-left{bottom:var(--wco-spacing-md);left:var(--wco-spacing-md);align-items:flex-start}.wco-toast-container--top-center{top:var(--wco-spacing-md);left:50%;transform:translate(-50%);align-items:center}.wco-toast-container--bottom-center{bottom:var(--wco-spacing-md);left:50%;transform:translate(-50%);align-items:center}@media (max-width: 600px){.wco-toast-container--top-right,.wco-toast-container--top-left,.wco-toast-container--top-center,.wco-toast-container--bottom-right,.wco-toast-container--bottom-left,.wco-toast-container--bottom-center{top:unset;right:unset;left:50%;bottom:var(--wco-spacing-xxs);transform:translate(-50%);align-items:center;width:calc(100vw - var(--wco-spacing-xxxs))}.wco-toast-container--top-right .wco-toast,.wco-toast-container--top-left .wco-toast,.wco-toast-container--top-center .wco-toast,.wco-toast-container--bottom-right .wco-toast,.wco-toast-container--bottom-left .wco-toast,.wco-toast-container--bottom-center .wco-toast{width:100%}}.wco-toast{pointer-events:all;display:flex;align-items:center;gap:var(--wco-toast-gap, 8px);width:var(--wco-toast-w-clamp, 250px);padding:var(--wco-toast-padding, 8px);border-radius:var(--wco-toast-radius, 8px);background:var(--wco-toast-bg, #fff);box-shadow:var(--wco-shadow-level-1);opacity:0;transform:translateY(-8px);transition:opacity .3s ease,transform .3s ease}.wco-toast.wco-toast--start{align-items:flex-start}.wco-toast.wco-toast--start:has(.btn-link) .wco-toast__close{margin-top:var(--wco-spacing-nano)}.wco-toast.wco-toast--start>.wco-toast__body,.wco-toast.wco-toast--start .wco-toast__content{align-items:flex-start}.wco-toast:has(.wco-toast__message) .wco-toast__title{font-weight:600}.wco-toast.wco-toast--mini{--wco-toast-w-clamp: fit-content;max-width:570px}.wco-toast--visible{opacity:1;transform:translateY(0)}.wco-toast--info{--wco-toast-color-type: var(--wco-color-info-600)}.wco-toast--success{--wco-toast-color-type: var(--wco-color-success-600)}.wco-toast--warning{--wco-toast-color-type: var(--wco-color-warning-600)}.wco-toast--error{--wco-toast-color-type: var(--wco-color-danger-600)}.wco-toast--loading{--wco-toast-color-type: var(--wco-color-secondary-600)}.wco-toast--loading .wco-toast__icon{animation:wco-toast-spin 1s linear infinite}@keyframes wco-toast-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.wco-toast__body{display:flex;align-items:center;gap:var(--wco-toast-gap, 8px);flex:1;min-width:0}.wco-toast__icon{font-size:var(--wco-iconography-size-xs);color:var(--wco-toast-color-type);flex-shrink:0;margin-top:0}.wco-toast__content{display:flex;flex-direction:row;align-items:center;gap:var(--wco-toast-gap, 8px);flex:1;min-width:0}.wco-toast__title{font-size:var(--wco-font-size-xs, 14px);font-weight:300;color:var(--wco-color-neutral-900);line-height:1.4;margin:0}.wco-toast__message{font-size:var(--wco-font-size-xxs, 12px);font-weight:400;color:var(--wco-color-neutral-700);line-height:1.5;margin:0}.wco-toast__actions{display:flex;flex-wrap:wrap;gap:var(--wco-spacing-nano)}.wco-toast__close{background:none;border:none;cursor:pointer;padding:0;color:var(--wco-color-neutral-500);display:flex;align-items:center;flex-shrink:0;line-height:1}.wco-toast__close span{font-size:18px}.wco-toast__close:hover{color:var(--wco-color-neutral-900)}.wco-toast-container .wco-toast__hover-zone{position:absolute;inset:-16px;pointer-events:auto;z-index:0}.wco-toast-container .wco-toast{position:relative;z-index:1;transition:transform .2s ease,opacity .2s ease,top .2s ease}@starting-style{.wco-toast-container .wco-toast{transform:translateY(24px)}}.wco-toast-container:not(:hover) .wco-toast:not(:last-child){position:absolute;box-shadow:none;width:100%;height:50px;overflow:hidden;transform:scale(.95)}.wco-toast-container:not(:hover) .wco-toast:not(:last-child)>*{opacity:0;transition:opacity .15s ease}.wco-toast-container:not(:hover) .wco-toast:nth-last-child(2){top:-10px;transform:scale(.95);box-shadow:var(--wco-shadow-level-3)}.wco-toast-container:not(:hover) .wco-toast:nth-last-child(3){top:-20px;transform:scale(.85);box-shadow:var(--wco-shadow-level-2)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
2261
|
+
}
|
|
2262
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: WcoToastComponent, decorators: [{
|
|
2263
|
+
type: Component,
|
|
2264
|
+
args: [{ selector: 'wco-toast', standalone: true, imports: [CommonModule], template: "<dialog open class=\"wco-toast-container\" [class]=\"'wco-toast-container--' + position\">\n <span class=\"wco-toast__hover-zone\"></span>\n <div\n *ngFor=\"let toast of toasts; trackBy: trackById;let i = index\"\n class=\"wco-toast\"\n [id]=\"toast.id\"\n [class.wco-toast--visible]=\"toast.visible\"\n [class.wco-toast--start]=\"toast.tall\"\n [attr.data-position]=\"i\"\n [class]=\"'wco-toast wco-toast--mini wco-toast--' + getIconMaterial(toast.config).color + (toast.visible ? ' wco-toast--visible' : '')\"\n >\n <div class=\"wco-toast__body\">\n <ng-container *ngIf=\"toast.config.showIcon\">\n <span class=\"wco-toast__icon material-icons-round\">\n <ng-container *ngIf=\"toast.config.materialIcon; else defaultIcon\">\n {{ toast.config.materialIcon }}\n </ng-container>\n <ng-template #defaultIcon>\n {{ getIconMaterial(toast.config).icon }}\n </ng-template>\n </span>\n </ng-container>\n\n <div class=\"wco-toast__content\">\n <span>\n <p class=\"wco-toast__title\" *ngIf=\"toast.config.title\" [innerHTML]=\"getSafeHtml(toast.config.title)\"></p>\n <p class=\"wco-toast__message\" *ngIf=\"toast.config.message && toast.config.message.length \" [innerHTML]=\"getSafeHtml(toast.config.message)\"></p>\n </span>\n <div class=\"wco-toast__actions\" *ngIf=\"toast.config.actions && toast.config.actions.length > 0\">\n <button\n type=\"button\"\n *ngFor=\"let action of toast.config.actions\"\n [class]=\"getButtonClass(action)\"\n (click)=\"action.action(); dismiss(toast.id)\"\n >\n <span class=\"material-icons-round\" *ngIf=\"action.materialIconLeft\">{{ action.materialIconLeft }}</span>\n {{ action.text }}\n <span class=\"material-icons-round\" *ngIf=\"action.materialIconRight\">{{ action.materialIconRight }}</span>\n </button>\n </div>\n </div>\n </div>\n\n <button class=\"wco-toast__close\" *ngIf=\"toast.config.close !== false\" (click)=\"dismiss(toast.id)\" aria-label=\"Fechar\">\n <span class=\"material-icons\">close</span>\n </button>\n </div>\n \n</dialog>\n", styles: ["@layer state{.wco-toast-container{--wco-toast-padding: var(--wco-spacing-nano, 8px);--wco-toast-gap: var(--wco-spacing-nano, 8px);--wco-toast-radius: var(--wco-radius-md, 8px);--wco-toast-w-clamp: clamp(250px, 280px, 420px);--wco-toast-bg: var(--wco-color-panel) }}.wco-toast-container{margin:0;padding:0;border:none;background:transparent;max-width:none;max-height:none;overflow:visible;top:unset;right:unset;bottom:unset;left:unset;transition:all .1s linear .3s;opacity:1;transform:translateY(0);position:fixed;z-index:9999;display:flex;flex-direction:column;gap:var(--wco-spacing-xs);pointer-events:none}@starting-style{.wco-toast-container{opacity:0;transform:scaleY(12px)}}.wco-toast-container:has(.wco-toast-btn){--wco-toast-align-flex: flex- --wc-toast-align-direction: }.wco-toast-container::backdrop{display:none}.wco-toast-container--top-right{top:var(--wco-spacing-md);right:var(--wco-spacing-md);align-items:flex-end}.wco-toast-container--top-left{top:var(--wco-spacing-md);left:var(--wco-spacing-md);align-items:flex-start}.wco-toast-container--bottom-right{bottom:var(--wco-spacing-md);right:var(--wco-spacing-md);align-items:flex-end}.wco-toast-container--bottom-left{bottom:var(--wco-spacing-md);left:var(--wco-spacing-md);align-items:flex-start}.wco-toast-container--top-center{top:var(--wco-spacing-md);left:50%;transform:translate(-50%);align-items:center}.wco-toast-container--bottom-center{bottom:var(--wco-spacing-md);left:50%;transform:translate(-50%);align-items:center}@media (max-width: 600px){.wco-toast-container--top-right,.wco-toast-container--top-left,.wco-toast-container--top-center,.wco-toast-container--bottom-right,.wco-toast-container--bottom-left,.wco-toast-container--bottom-center{top:unset;right:unset;left:50%;bottom:var(--wco-spacing-xxs);transform:translate(-50%);align-items:center;width:calc(100vw - var(--wco-spacing-xxxs))}.wco-toast-container--top-right .wco-toast,.wco-toast-container--top-left .wco-toast,.wco-toast-container--top-center .wco-toast,.wco-toast-container--bottom-right .wco-toast,.wco-toast-container--bottom-left .wco-toast,.wco-toast-container--bottom-center .wco-toast{width:100%}}.wco-toast{pointer-events:all;display:flex;align-items:center;gap:var(--wco-toast-gap, 8px);width:var(--wco-toast-w-clamp, 250px);padding:var(--wco-toast-padding, 8px);border-radius:var(--wco-toast-radius, 8px);background:var(--wco-toast-bg, #fff);box-shadow:var(--wco-shadow-level-1);opacity:0;transform:translateY(-8px);transition:opacity .3s ease,transform .3s ease}.wco-toast.wco-toast--start{align-items:flex-start}.wco-toast.wco-toast--start:has(.btn-link) .wco-toast__close{margin-top:var(--wco-spacing-nano)}.wco-toast.wco-toast--start>.wco-toast__body,.wco-toast.wco-toast--start .wco-toast__content{align-items:flex-start}.wco-toast:has(.wco-toast__message) .wco-toast__title{font-weight:600}.wco-toast.wco-toast--mini{--wco-toast-w-clamp: fit-content;max-width:570px}.wco-toast--visible{opacity:1;transform:translateY(0)}.wco-toast--info{--wco-toast-color-type: var(--wco-color-info-600)}.wco-toast--success{--wco-toast-color-type: var(--wco-color-success-600)}.wco-toast--warning{--wco-toast-color-type: var(--wco-color-warning-600)}.wco-toast--error{--wco-toast-color-type: var(--wco-color-danger-600)}.wco-toast--loading{--wco-toast-color-type: var(--wco-color-secondary-600)}.wco-toast--loading .wco-toast__icon{animation:wco-toast-spin 1s linear infinite}@keyframes wco-toast-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.wco-toast__body{display:flex;align-items:center;gap:var(--wco-toast-gap, 8px);flex:1;min-width:0}.wco-toast__icon{font-size:var(--wco-iconography-size-xs);color:var(--wco-toast-color-type);flex-shrink:0;margin-top:0}.wco-toast__content{display:flex;flex-direction:row;align-items:center;gap:var(--wco-toast-gap, 8px);flex:1;min-width:0}.wco-toast__title{font-size:var(--wco-font-size-xs, 14px);font-weight:300;color:var(--wco-color-neutral-900);line-height:1.4;margin:0}.wco-toast__message{font-size:var(--wco-font-size-xxs, 12px);font-weight:400;color:var(--wco-color-neutral-700);line-height:1.5;margin:0}.wco-toast__actions{display:flex;flex-wrap:wrap;gap:var(--wco-spacing-nano)}.wco-toast__close{background:none;border:none;cursor:pointer;padding:0;color:var(--wco-color-neutral-500);display:flex;align-items:center;flex-shrink:0;line-height:1}.wco-toast__close span{font-size:18px}.wco-toast__close:hover{color:var(--wco-color-neutral-900)}.wco-toast-container .wco-toast__hover-zone{position:absolute;inset:-16px;pointer-events:auto;z-index:0}.wco-toast-container .wco-toast{position:relative;z-index:1;transition:transform .2s ease,opacity .2s ease,top .2s ease}@starting-style{.wco-toast-container .wco-toast{transform:translateY(24px)}}.wco-toast-container:not(:hover) .wco-toast:not(:last-child){position:absolute;box-shadow:none;width:100%;height:50px;overflow:hidden;transform:scale(.95)}.wco-toast-container:not(:hover) .wco-toast:not(:last-child)>*{opacity:0;transition:opacity .15s ease}.wco-toast-container:not(:hover) .wco-toast:nth-last-child(2){top:-10px;transform:scale(.95);box-shadow:var(--wco-shadow-level-3)}.wco-toast-container:not(:hover) .wco-toast:nth-last-child(3){top:-20px;transform:scale(.85);box-shadow:var(--wco-shadow-level-2)}\n"] }]
|
|
2265
|
+
}], ctorParameters: () => [{ type: i1$3.DomSanitizer }], propDecorators: { position: [{
|
|
2266
|
+
type: Input
|
|
2267
|
+
}], configManual: [{
|
|
2268
|
+
type: Input
|
|
2269
|
+
}], toasts: [{
|
|
2270
|
+
type: Input
|
|
2271
|
+
}] } });
|
|
2272
|
+
|
|
2273
|
+
class WcoToastService {
|
|
2274
|
+
appRef = inject(ApplicationRef);
|
|
2275
|
+
injector = inject(EnvironmentInjector);
|
|
2276
|
+
componentRef = null;
|
|
2277
|
+
get instance() {
|
|
2278
|
+
if (!this.componentRef) {
|
|
2279
|
+
this.componentRef = createComponent(WcoToastComponent, {
|
|
2280
|
+
environmentInjector: this.injector,
|
|
2281
|
+
});
|
|
2282
|
+
this.appRef.attachView(this.componentRef.hostView);
|
|
2283
|
+
document.body.appendChild(this.componentRef.location.nativeElement);
|
|
2284
|
+
}
|
|
2285
|
+
return this.componentRef.instance;
|
|
2286
|
+
}
|
|
2287
|
+
show(config) {
|
|
2288
|
+
if (config.position) {
|
|
2289
|
+
this.instance.position = config.position;
|
|
2290
|
+
}
|
|
2291
|
+
return this.instance.add(config);
|
|
2292
|
+
}
|
|
2293
|
+
dismiss(id) {
|
|
2294
|
+
this.componentRef?.instance.dismiss(id);
|
|
2295
|
+
}
|
|
2296
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: WcoToastService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2297
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: WcoToastService, providedIn: 'root' });
|
|
2298
|
+
}
|
|
2299
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: WcoToastService, decorators: [{
|
|
2300
|
+
type: Injectable,
|
|
2301
|
+
args: [{ providedIn: 'root' }]
|
|
2302
|
+
}] });
|
|
2303
|
+
|
|
2190
2304
|
class SubTabsComponent {
|
|
2191
2305
|
el;
|
|
2192
2306
|
selectedIndex = 0;
|
|
@@ -2302,5 +2416,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2302
2416
|
* Generated bundle index. Do not edit.
|
|
2303
2417
|
*/
|
|
2304
2418
|
|
|
2305
|
-
export { MsgBoxFeedbackComponent, PaginationComponent, PreviewFileComponent, SmartSelectComponent, SmartSelectOptionComponent, StepComponent, StepperComponent, StepperGroupComponent, SubTabsComponent, TableComponent, TabsComponent, TimelineComponent, UploadComponent, UserAvatarComponent, WcoModalAlertComponent };
|
|
2419
|
+
export { MsgBoxFeedbackComponent, PaginationComponent, PreviewFileComponent, SmartSelectComponent, SmartSelectOptionComponent, StepComponent, StepperComponent, StepperGroupComponent, SubTabsComponent, TableComponent, TabsComponent, TimelineComponent, UploadComponent, UserAvatarComponent, WcoModalAlertComponent, WcoToastComponent, WcoToastService };
|
|
2306
2420
|
//# sourceMappingURL=wizco-fenixds-ngx.mjs.map
|