@cas-smartdesign/snackbar 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +8 -0
- package/dist/docs/configurable_example.js +1 -0
- package/dist/docs/doc.css +1 -0
- package/dist/docs/doc.mjs +413 -0
- package/dist/docs/error.svg +12 -0
- package/dist/docs/index.html +26 -0
- package/dist/snackbar-provider.d.ts +39 -0
- package/dist/snackbar-with-externals.js +99 -0
- package/dist/snackbar-with-externals.js.map +7 -0
- package/dist/snackbar.d.ts +21 -0
- package/dist/snackbar.mjs +186 -0
- package/dist/snackbar.mjs.map +1 -0
- package/dist/types.d.ts +92 -0
- package/npm-third-party-licenses.json +192 -0
- package/package.json +33 -0
- package/readme.md +81 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LitElement, TemplateResult, PropertyValues } from "lit";
|
|
2
|
+
import type { IAnimationParams } from "./types";
|
|
3
|
+
declare global {
|
|
4
|
+
interface HTMLElementTagNameMap {
|
|
5
|
+
[Snackbar.ID]: Snackbar;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
declare class Snackbar extends LitElement {
|
|
9
|
+
static readonly ID = "sd-snackbar";
|
|
10
|
+
static ensureDefined: () => void;
|
|
11
|
+
animationIn: IAnimationParams;
|
|
12
|
+
animationOut: IAnimationParams;
|
|
13
|
+
static get styles(): import("lit").CSSResult[];
|
|
14
|
+
firstUpdated(changedProperties: PropertyValues): void;
|
|
15
|
+
close(): Promise<void>;
|
|
16
|
+
render(): TemplateResult;
|
|
17
|
+
private collapse;
|
|
18
|
+
}
|
|
19
|
+
export { Snackbar };
|
|
20
|
+
export * from "./snackbar-provider";
|
|
21
|
+
export type * from "./types";
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { LitElement as l, css as m, unsafeCSS as p, html as a, render as b } from "lit";
|
|
2
|
+
import { property as f } from "lit/decorators/property.js";
|
|
3
|
+
import { repeat as k } from "lit/directives/repeat.js";
|
|
4
|
+
import { ifDefined as S } from "lit/directives/if-defined.js";
|
|
5
|
+
const g = ":host{display:block;contain:layout;margin-top:6px;margin-bottom:6px;position:relative;transition:height var(--sd-snackbar-height-transition-duration, .4s)}.root{display:flex;width:100%;height:100%}", x = ":host{position:fixed;display:flex;flex-direction:column;box-sizing:border-box;max-height:100%;contain:layout}:host([vertical-position=bottom]){flex-direction:column-reverse;bottom:var(--sd-snackbar-vertical-offset, 14px)}:host([vertical-position=top]){top:var(--sd-snackbar-vertical-offset, 14px)}:host([horizontal-position=left]){left:var(--sd-snackbar-horizontal-offset, 20px)}:host([horizontal-position=center]){left:50%;transform:translate(-50%)}:host([horizontal-position=right]){right:var(--sd-snackbar-horizontal-offset, 20px)}";
|
|
6
|
+
var q = Object.defineProperty, y = Object.getOwnPropertyDescriptor, v = (h, e, t, i) => {
|
|
7
|
+
for (var s = i > 1 ? void 0 : i ? y(e, t) : e, o = h.length - 1, d; o >= 0; o--)
|
|
8
|
+
(d = h[o]) && (s = (i ? d(e, t, s) : d(s)) || s);
|
|
9
|
+
return i && s && q(e, t, s), s;
|
|
10
|
+
}, n;
|
|
11
|
+
const c = (n = class extends l {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments), this.verticalPosition = "bottom", this.horizontalPosition = "left", this.maxStack = 3, this.shouldCloseOldest = !1, this._queue = [], this._rendered = [];
|
|
14
|
+
}
|
|
15
|
+
static get styles() {
|
|
16
|
+
return [
|
|
17
|
+
m`
|
|
18
|
+
${p(x)}
|
|
19
|
+
`
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
return this.renderSnackbars(), a` <slot></slot> `;
|
|
24
|
+
}
|
|
25
|
+
renderSnackbars() {
|
|
26
|
+
b(
|
|
27
|
+
a`
|
|
28
|
+
${k(
|
|
29
|
+
this._rendered,
|
|
30
|
+
({ id: e }) => e,
|
|
31
|
+
(e) => this.renderSnackbar(e)
|
|
32
|
+
)}
|
|
33
|
+
`,
|
|
34
|
+
this
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
open(e) {
|
|
38
|
+
this._queue.push({ snackbar: e, direction: "in" }), this.updateQueue();
|
|
39
|
+
}
|
|
40
|
+
close(e) {
|
|
41
|
+
e ? this.requestSnackbarClose(e) : this._rendered.forEach(({ id: t }) => this.requestSnackbarClose(t));
|
|
42
|
+
}
|
|
43
|
+
renderSnackbar({ message: e, options: t = {} }) {
|
|
44
|
+
var i;
|
|
45
|
+
return a`
|
|
46
|
+
<sd-snackbar
|
|
47
|
+
class="${S(((i = t.classNames) == null ? void 0 : i.length) > 0 ? t.classNames.join(" ") : void 0)}"
|
|
48
|
+
.animationIn="${this.animationIn}"
|
|
49
|
+
.animationOut="${this.animationOut}"
|
|
50
|
+
>
|
|
51
|
+
${this.renderSnackbarContent(e, t == null ? void 0 : t.closeAction)}
|
|
52
|
+
</sd-snackbar>
|
|
53
|
+
`;
|
|
54
|
+
}
|
|
55
|
+
renderSnackbarContent(e, t) {
|
|
56
|
+
return a` ${e}${t || ""} `;
|
|
57
|
+
}
|
|
58
|
+
updateQueue() {
|
|
59
|
+
if (this._queue.length === 0)
|
|
60
|
+
return;
|
|
61
|
+
const { direction: e, snackbar: t } = this._queue[0];
|
|
62
|
+
e === "in" ? this._rendered.length === this.maxStack ? this.requestOldestSnackbarClose() : (this.prepareSnackbarForRender(t), this._rendered.push(t), this.renderSnackbars(), this._queue.shift(), this.updateQueue()) : this.requestSnackbarClose(t.id);
|
|
63
|
+
}
|
|
64
|
+
requestOldestSnackbarClose() {
|
|
65
|
+
const e = this._rendered.find(
|
|
66
|
+
({ requestClose: t, options: i }) => !t && (i == null ? void 0 : i.autoHideDuration)
|
|
67
|
+
);
|
|
68
|
+
e && (e.requestClose = !0, this._queue.unshift({ snackbar: e, direction: "out" }), this.updateQueue());
|
|
69
|
+
}
|
|
70
|
+
requestSnackbarClose(e) {
|
|
71
|
+
const t = this._rendered.findIndex((i) => i.id === e);
|
|
72
|
+
if (t !== -1) {
|
|
73
|
+
const i = this._rendered[t];
|
|
74
|
+
i.closing || (i.requestClose = !0, window.clearTimeout(i.timer), this.closeSnackbar(t));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
closeSnackbar(e) {
|
|
78
|
+
var s;
|
|
79
|
+
const t = this._rendered[e], i = this.children.item(e);
|
|
80
|
+
i && (t.closing = !0, (s = t.options) != null && s.waitOnHover && i.matches(":hover") ? i.addEventListener("mouseleave", () => {
|
|
81
|
+
i.close().then(() => {
|
|
82
|
+
this.removeSnackbarAndUpdate(t);
|
|
83
|
+
});
|
|
84
|
+
}) : i.close().then(() => {
|
|
85
|
+
this.removeSnackbarAndUpdate(t);
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
removeSnackbarAndUpdate(e) {
|
|
89
|
+
this.removeSnackbarFromQueue(e), this.removeSnackbarFromRendered(e), this.requestUpdate(), this.updateComplete.then(() => this.updateQueue());
|
|
90
|
+
}
|
|
91
|
+
removeSnackbarFromQueue(e) {
|
|
92
|
+
const t = this._queue.findIndex(({ snackbar: i }) => i.id === e.id);
|
|
93
|
+
t !== -1 && this._queue.splice(t, 1);
|
|
94
|
+
}
|
|
95
|
+
removeSnackbarFromRendered(e) {
|
|
96
|
+
const t = this._rendered.findIndex((i) => i.id == e.id);
|
|
97
|
+
t !== -1 && this._rendered.splice(t, 1);
|
|
98
|
+
}
|
|
99
|
+
setupTimeoutForAutoHideSnackbar(e) {
|
|
100
|
+
e.timer = window.setTimeout(() => {
|
|
101
|
+
this._queue.push({ snackbar: e, direction: "out" }), this.updateQueue();
|
|
102
|
+
}, e.options.autoHideDuration);
|
|
103
|
+
}
|
|
104
|
+
prepareSnackbarForRender(e) {
|
|
105
|
+
const { options: t, message: i } = e;
|
|
106
|
+
if (i.slot = "message", t) {
|
|
107
|
+
const { autoHideDuration: s, waitForMouseMove: o } = t;
|
|
108
|
+
s && (o ? this.listenForMouseMove(e) : this.setupTimeoutForAutoHideSnackbar(e)), this.setupAction(e);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
listenForMouseMove(e) {
|
|
112
|
+
window.addEventListener("mousemove", this.handleWindowMouseMove.bind(this, e), { once: !0 });
|
|
113
|
+
}
|
|
114
|
+
handleWindowMouseMove(e) {
|
|
115
|
+
this.setupTimeoutForAutoHideSnackbar(e);
|
|
116
|
+
}
|
|
117
|
+
setupAction(e) {
|
|
118
|
+
const {
|
|
119
|
+
options: { closeAction: t }
|
|
120
|
+
} = e;
|
|
121
|
+
t && (t.addEventListener("click", () => {
|
|
122
|
+
this._queue.unshift({ snackbar: e, direction: "out" }), this.updateQueue();
|
|
123
|
+
}), t.slot = "action");
|
|
124
|
+
}
|
|
125
|
+
}, n.ID = "sd-snackbar-provider", n.ensureDefined = () => {
|
|
126
|
+
u.ensureDefined(), customElements.get(n.ID) || customElements.define(n.ID, n);
|
|
127
|
+
}, n);
|
|
128
|
+
v([
|
|
129
|
+
f({ type: String, reflect: !0, attribute: "vertical-position" })
|
|
130
|
+
], c.prototype, "verticalPosition", 2);
|
|
131
|
+
v([
|
|
132
|
+
f({ type: String, reflect: !0, attribute: "horizontal-position" })
|
|
133
|
+
], c.prototype, "horizontalPosition", 2);
|
|
134
|
+
let F = c;
|
|
135
|
+
const r = class r extends l {
|
|
136
|
+
static get styles() {
|
|
137
|
+
return [
|
|
138
|
+
m`
|
|
139
|
+
${p(g)}
|
|
140
|
+
`
|
|
141
|
+
];
|
|
142
|
+
}
|
|
143
|
+
firstUpdated(e) {
|
|
144
|
+
if (super.firstUpdated(e), this.animationIn) {
|
|
145
|
+
const { keyframes: t, options: i } = this.animationIn;
|
|
146
|
+
this.animate(t, i);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
close() {
|
|
150
|
+
return new Promise((e) => {
|
|
151
|
+
if (this.animationOut) {
|
|
152
|
+
const { keyframes: t, options: i } = this.animationOut, s = this.animate(t, i);
|
|
153
|
+
s.onfinish = () => {
|
|
154
|
+
this.collapse(), this.addEventListener("transitionend", ({ propertyName: o }) => {
|
|
155
|
+
o === "height" && e();
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
} else
|
|
159
|
+
this.collapse(), e();
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
render() {
|
|
163
|
+
return a`
|
|
164
|
+
<div class="root">
|
|
165
|
+
<div class="message">
|
|
166
|
+
<slot name="message"></slot>
|
|
167
|
+
</div>
|
|
168
|
+
<div class="action">
|
|
169
|
+
<slot name="action"></slot>
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
`;
|
|
173
|
+
}
|
|
174
|
+
collapse() {
|
|
175
|
+
this.style.height = "0", this.style.opacity = "0";
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
r.ID = "sd-snackbar", r.ensureDefined = () => {
|
|
179
|
+
customElements.get(r.ID) || customElements.define(r.ID, r);
|
|
180
|
+
};
|
|
181
|
+
let u = r;
|
|
182
|
+
export {
|
|
183
|
+
u as Snackbar,
|
|
184
|
+
F as SnackbarProvider
|
|
185
|
+
};
|
|
186
|
+
//# sourceMappingURL=snackbar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snackbar.mjs","sources":["../snackbar-provider.ts","../snackbar.ts"],"sourcesContent":["import { LitElement, TemplateResult, html, unsafeCSS, css, render } from \"lit\";\nimport { property } from \"lit/decorators/property.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport type { VerticalPosition, HorizontalPosition, ISnackbar, IAnimationParams, IAction } from \"./types\";\nimport { Snackbar } from \"./snackbar\";\n\nimport style from \"./scss/provider.scss?inline\";\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [SnackbarProvider.ID]: SnackbarProvider;\n }\n}\n\nclass SnackbarProvider extends LitElement {\n public static readonly ID = \"sd-snackbar-provider\";\n public static ensureDefined = (): void => {\n Snackbar.ensureDefined();\n if (!customElements.get(SnackbarProvider.ID)) {\n customElements.define(SnackbarProvider.ID, SnackbarProvider);\n }\n };\n @property({ type: String, reflect: true, attribute: \"vertical-position\" })\n public verticalPosition: VerticalPosition = \"bottom\";\n @property({ type: String, reflect: true, attribute: \"horizontal-position\" })\n public horizontalPosition: HorizontalPosition = \"left\";\n public maxStack = 3;\n public animationIn: IAnimationParams;\n public animationOut: IAnimationParams;\n public shouldCloseOldest = false;\n\n private _queue: IAction[] = [];\n private _rendered: ISnackbar[] = [];\n\n static get styles() {\n return [\n css`\n ${unsafeCSS(style)}\n `,\n ];\n }\n\n public render(): TemplateResult {\n this.renderSnackbars();\n return html` <slot></slot> `;\n }\n\n public renderSnackbars(): void {\n render(\n html`\n ${repeat(\n this._rendered,\n ({ id }) => id,\n (snackbar) => this.renderSnackbar(snackbar),\n )}\n `,\n this,\n );\n }\n\n public open(snackbar: ISnackbar): void {\n this._queue.push({ snackbar, direction: \"in\" });\n this.updateQueue();\n }\n\n public close(snackId?: string): void {\n snackId\n ? this.requestSnackbarClose(snackId)\n : this._rendered.forEach(({ id }) => this.requestSnackbarClose(id));\n }\n\n private renderSnackbar({ message, options = {} }: ISnackbar): TemplateResult {\n return html`\n <sd-snackbar\n class=\"${ifDefined(options.classNames?.length > 0 ? options.classNames.join(\" \") : undefined)}\"\n .animationIn=\"${this.animationIn}\"\n .animationOut=\"${this.animationOut}\"\n >\n ${this.renderSnackbarContent(message, options?.closeAction)}\n </sd-snackbar>\n `;\n }\n\n private renderSnackbarContent(message: HTMLElement, action?: HTMLElement): TemplateResult {\n return html` ${message}${action ? action : \"\"} `;\n }\n\n private updateQueue(): void {\n if (this._queue.length === 0) {\n return;\n }\n\n const { direction, snackbar } = this._queue[0];\n if (direction === \"in\") {\n if (this._rendered.length === this.maxStack) {\n this.requestOldestSnackbarClose();\n } else {\n this.prepareSnackbarForRender(snackbar);\n this._rendered.push(snackbar);\n this.renderSnackbars();\n this._queue.shift();\n this.updateQueue();\n }\n } else {\n this.requestSnackbarClose(snackbar.id);\n }\n }\n\n private requestOldestSnackbarClose(): void {\n const oldestNotMarkedForLeave = this._rendered.find(\n ({ requestClose, options }) => !requestClose && options?.autoHideDuration,\n );\n if (oldestNotMarkedForLeave) {\n oldestNotMarkedForLeave.requestClose = true;\n this._queue.unshift({ snackbar: oldestNotMarkedForLeave, direction: \"out\" });\n this.updateQueue();\n }\n }\n\n private requestSnackbarClose(id?: string): void {\n const ind = this._rendered.findIndex((snack) => snack.id === id);\n if (ind !== -1) {\n const snackbar = this._rendered[ind];\n if (!snackbar.closing) {\n snackbar.requestClose = true;\n window.clearTimeout(snackbar.timer);\n this.closeSnackbar(ind);\n }\n }\n }\n\n private closeSnackbar(ind: number): void {\n const snackbar = this._rendered[ind];\n const snackbarElement = (this.children as HTMLCollectionOf<Snackbar>).item(ind);\n if (snackbarElement) {\n snackbar.closing = true;\n if (snackbar.options?.waitOnHover && snackbarElement.matches(\":hover\")) {\n snackbarElement.addEventListener(\"mouseleave\", () => {\n snackbarElement.close().then(() => {\n this.removeSnackbarAndUpdate(snackbar);\n });\n });\n } else {\n snackbarElement.close().then(() => {\n this.removeSnackbarAndUpdate(snackbar);\n });\n }\n }\n }\n\n private removeSnackbarAndUpdate(snackbar: ISnackbar): void {\n this.removeSnackbarFromQueue(snackbar);\n this.removeSnackbarFromRendered(snackbar);\n\n this.requestUpdate();\n this.updateComplete.then(() => this.updateQueue());\n }\n\n private removeSnackbarFromQueue(snack: ISnackbar): void {\n const ind = this._queue.findIndex(({ snackbar }) => snackbar.id === snack.id);\n if (ind !== -1) {\n this._queue.splice(ind, 1);\n }\n }\n\n private removeSnackbarFromRendered(snack: ISnackbar): void {\n const ind = this._rendered.findIndex((snackbar) => snackbar.id == snack.id);\n if (ind !== -1) {\n this._rendered.splice(ind, 1);\n }\n }\n\n private setupTimeoutForAutoHideSnackbar(snackbar: ISnackbar): void {\n snackbar.timer = window.setTimeout(() => {\n this._queue.push({ snackbar, direction: \"out\" });\n this.updateQueue();\n }, snackbar.options.autoHideDuration);\n }\n\n private prepareSnackbarForRender(snackbar: ISnackbar): void {\n const { options, message } = snackbar;\n message.slot = \"message\";\n if (options) {\n const { autoHideDuration, waitForMouseMove } = options;\n if (autoHideDuration) {\n if (waitForMouseMove) {\n this.listenForMouseMove(snackbar);\n } else {\n this.setupTimeoutForAutoHideSnackbar(snackbar);\n }\n }\n\n this.setupAction(snackbar);\n }\n }\n\n private listenForMouseMove(snackbar: ISnackbar): void {\n window.addEventListener(\"mousemove\", this.handleWindowMouseMove.bind(this, snackbar), { once: true });\n }\n\n private handleWindowMouseMove(snackbar: ISnackbar): void {\n this.setupTimeoutForAutoHideSnackbar(snackbar);\n }\n\n private setupAction(snackbar: ISnackbar): void {\n const {\n options: { closeAction: action },\n } = snackbar;\n if (action) {\n action.addEventListener(\"click\", () => {\n this._queue.unshift({ snackbar, direction: \"out\" });\n this.updateQueue();\n });\n action.slot = \"action\";\n }\n }\n}\n\nexport { SnackbarProvider };\n","import { LitElement, TemplateResult, html, unsafeCSS, PropertyValues, css } from \"lit\";\nimport type { IAnimationParams } from \"./types\";\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [Snackbar.ID]: Snackbar;\n }\n}\nimport style from \"./scss/snackbar.scss?inline\";\n\nclass Snackbar extends LitElement {\n public static readonly ID = \"sd-snackbar\";\n public static ensureDefined = (): void => {\n if (!customElements.get(Snackbar.ID)) {\n customElements.define(Snackbar.ID, Snackbar);\n }\n };\n\n public animationIn: IAnimationParams;\n public animationOut: IAnimationParams;\n\n static get styles() {\n return [\n css`\n ${unsafeCSS(style)}\n `,\n ];\n }\n\n public firstUpdated(changedProperties: PropertyValues): void {\n super.firstUpdated(changedProperties);\n if (this.animationIn) {\n const { keyframes, options } = this.animationIn;\n this.animate(keyframes, options);\n }\n }\n\n public close(): Promise<void> {\n return new Promise<void>((resolve) => {\n if (this.animationOut) {\n const { keyframes, options } = this.animationOut;\n const animation = this.animate(keyframes, options);\n animation.onfinish = () => {\n // height and opacity are needed to be set to 0\n // so that moving newer snackbars can be animated\n this.collapse();\n this.addEventListener(\"transitionend\", ({ propertyName }) => {\n if (propertyName === \"height\") {\n resolve();\n }\n });\n };\n } else {\n this.collapse();\n resolve();\n }\n });\n }\n\n public render(): TemplateResult {\n return html`\n <div class=\"root\">\n <div class=\"message\">\n <slot name=\"message\"></slot>\n </div>\n <div class=\"action\">\n <slot name=\"action\"></slot>\n </div>\n </div>\n `;\n }\n\n private collapse(): void {\n this.style.height = \"0\";\n this.style.opacity = \"0\";\n }\n}\n\nexport { Snackbar };\nexport * from \"./snackbar-provider\";\nexport type * from \"./types\";\n"],"names":["_SnackbarProvider","_a","LitElement","css","unsafeCSS","style","html","render","repeat","id","snackbar","snackId","message","options","ifDefined","action","direction","oldestNotMarkedForLeave","requestClose","ind","snack","snackbarElement","autoHideDuration","waitForMouseMove","Snackbar","__decorateClass","property","SnackbarProvider","_Snackbar","changedProperties","keyframes","resolve","animation","propertyName"],"mappings":";;;;;;;;;;AAeA,MAAMA,KAANC,IAAA,cAA+BC,EAAW;AAAA,EAA1C,cAAA;AAAA,UAAA,GAAA,SAAA,GASI,KAAO,mBAAqC,UAE5C,KAAO,qBAAyC,QAChD,KAAO,WAAW,GAGlB,KAAO,oBAAoB,IAE3B,KAAQ,SAAoB,IAC5B,KAAQ,YAAyB;EAAC;AAAA,EAElC,WAAW,SAAS;AACT,WAAA;AAAA,MACHC;AAAA,kBACMC,EAAUC,CAAK,CAAC;AAAA;AAAA,IAAA;AAAA,EAG9B;AAAA,EAEO,SAAyB;AAC5B,gBAAK,gBAAgB,GACdC;AAAA,EACX;AAAA,EAEO,kBAAwB;AAC3B,IAAAC;AAAA,MACID;AAAA,kBACME;AAAA,QACE,KAAK;AAAA,QACL,CAAC,EAAE,IAAAC,EAAA,MAASA;AAAA,QACZ,CAACC,MAAa,KAAK,eAAeA,CAAQ;AAAA,MAAA,CAC7C;AAAA;AAAA,MAEL;AAAA,IAAA;AAAA,EAER;AAAA,EAEO,KAAKA,GAA2B;AACnC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IsB,EAAuB,KAAK,eAC5BA,EAAc,gBAAgB,MAAY;AACtC,EAAK,eAAe,IAAIA,EAAS,EAAE,KAChB,eAAA,OAAOA,EAAS,IAAIA,CAAQ;AAC/C;AALR,IAAMJ,IAANI;"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The possible values for the vertical position of the snackbar provider.
|
|
3
|
+
*/
|
|
4
|
+
type VerticalPosition = "top" | "bottom";
|
|
5
|
+
/**
|
|
6
|
+
* The possible values for the horizontal position of the snackbar provider.
|
|
7
|
+
*/
|
|
8
|
+
type HorizontalPosition = "left" | "center" | "right";
|
|
9
|
+
/**
|
|
10
|
+
* The direction of an action.
|
|
11
|
+
*/
|
|
12
|
+
type ActionDirection = "in" | "out";
|
|
13
|
+
/**
|
|
14
|
+
* The object defining the content and configuration for a snackbar to be opened.
|
|
15
|
+
*/
|
|
16
|
+
interface ISnackbar {
|
|
17
|
+
/**
|
|
18
|
+
* The identifier of the snackbar.
|
|
19
|
+
*/
|
|
20
|
+
id: string;
|
|
21
|
+
/**
|
|
22
|
+
* The html element used for the message part of the snackbar.
|
|
23
|
+
*/
|
|
24
|
+
message: HTMLElement;
|
|
25
|
+
/**
|
|
26
|
+
* The id for the setTimout invoked for timing the auto hiding feature.
|
|
27
|
+
* This property is for internal use only.
|
|
28
|
+
*/
|
|
29
|
+
timer?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Defines whether if the snackbar is currently closing.
|
|
32
|
+
*/
|
|
33
|
+
closing?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Defines whether if the snackbar should close after other animations are done.
|
|
36
|
+
* This property is for internal use only.
|
|
37
|
+
*/
|
|
38
|
+
requestClose?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Defines whether if the snackbar is currently hovered on.
|
|
41
|
+
* This property is for internal use only.
|
|
42
|
+
*/
|
|
43
|
+
hovered?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The configuration options for the snackbar.
|
|
46
|
+
*/
|
|
47
|
+
options?: ISnackbarOptions;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The configuration options for a snackbar.
|
|
51
|
+
*/
|
|
52
|
+
interface ISnackbarOptions {
|
|
53
|
+
/**
|
|
54
|
+
* Defines the amount of milliseconds before auto hiding the snackbar.
|
|
55
|
+
* If omitted the snackbar will be persistent.
|
|
56
|
+
*/
|
|
57
|
+
autoHideDuration?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Defines the element that goes in the action slot of the snackbar.
|
|
60
|
+
* This is useful for adding a close button for a persistent snackbar.
|
|
61
|
+
*/
|
|
62
|
+
closeAction?: HTMLElement;
|
|
63
|
+
/**
|
|
64
|
+
* Defines whether if the snackbar should wait for a mouse move before setting up the timer for auto hiding.
|
|
65
|
+
*/
|
|
66
|
+
waitForMouseMove?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Defines the classes applied to the given snackbar.
|
|
69
|
+
* It is useful for applying styles for specific snackbars
|
|
70
|
+
*/
|
|
71
|
+
classNames?: string[];
|
|
72
|
+
/**
|
|
73
|
+
* Defines whether if the snackbar should wait if it is currently hovered.
|
|
74
|
+
*/
|
|
75
|
+
waitOnHover?: boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The parameters for the opening or closing animation of a snackbar.
|
|
79
|
+
*/
|
|
80
|
+
interface IAnimationParams {
|
|
81
|
+
keyframes: Keyframe[];
|
|
82
|
+
options: KeyframeAnimationOptions;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Defines an action that should be performed on a snackbar.
|
|
86
|
+
* This is for internal usage only.
|
|
87
|
+
*/
|
|
88
|
+
interface IAction {
|
|
89
|
+
snackbar: ISnackbar;
|
|
90
|
+
direction: ActionDirection;
|
|
91
|
+
}
|
|
92
|
+
export type { VerticalPosition, HorizontalPosition, ISnackbar, ISnackbarOptions, IAnimationParams, IAction };
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@cypress/vite-dev-server@5.0.7": {
|
|
3
|
+
"licenses": "MIT",
|
|
4
|
+
"repository": "https://github.com/cypress-io/cypress",
|
|
5
|
+
"licenseUrl": "https://github.com/cypress-io/cypress/tree/develop/npm/vite-dev-server#readme"
|
|
6
|
+
},
|
|
7
|
+
"@rollup/plugin-node-resolve@15.2.3": {
|
|
8
|
+
"licenses": "MIT",
|
|
9
|
+
"repository": "https://github.com/rollup/plugins",
|
|
10
|
+
"licenseUrl": "https://github.com/rollup/plugins/raw/HEAD/LICENSE"
|
|
11
|
+
},
|
|
12
|
+
"@types/node@20.10.6": {
|
|
13
|
+
"licenses": "MIT",
|
|
14
|
+
"repository": "https://github.com/DefinitelyTyped/DefinitelyTyped",
|
|
15
|
+
"licenseUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/raw/HEAD/LICENSE"
|
|
16
|
+
},
|
|
17
|
+
"@types/postcss-prefix-selector@1.16.3": {
|
|
18
|
+
"licenses": "MIT",
|
|
19
|
+
"repository": "https://github.com/DefinitelyTyped/DefinitelyTyped",
|
|
20
|
+
"licenseUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped/raw/HEAD/LICENSE"
|
|
21
|
+
},
|
|
22
|
+
"@typescript-eslint/eslint-plugin@6.17.0": {
|
|
23
|
+
"licenses": "MIT",
|
|
24
|
+
"repository": "https://github.com/typescript-eslint/typescript-eslint",
|
|
25
|
+
"licenseUrl": "https://github.com/typescript-eslint/typescript-eslint/raw/HEAD/LICENSE"
|
|
26
|
+
},
|
|
27
|
+
"@typescript-eslint/parser@6.17.0": {
|
|
28
|
+
"licenses": "BSD-2-Clause",
|
|
29
|
+
"repository": "https://github.com/typescript-eslint/typescript-eslint",
|
|
30
|
+
"licenseUrl": "https://github.com/typescript-eslint/typescript-eslint/raw/HEAD/LICENSE"
|
|
31
|
+
},
|
|
32
|
+
"@vitest/coverage-v8@1.1.1": {
|
|
33
|
+
"licenses": "MIT",
|
|
34
|
+
"repository": "https://github.com/vitest-dev/vitest",
|
|
35
|
+
"licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
|
|
36
|
+
},
|
|
37
|
+
"@vitest/ui@1.1.1": {
|
|
38
|
+
"licenses": "MIT",
|
|
39
|
+
"repository": "https://github.com/vitest-dev/vitest",
|
|
40
|
+
"licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE"
|
|
41
|
+
},
|
|
42
|
+
"axe-core@4.8.3": {
|
|
43
|
+
"licenses": "MPL-2.0",
|
|
44
|
+
"repository": "https://github.com/dequelabs/axe-core",
|
|
45
|
+
"licenseUrl": "https://github.com/dequelabs/axe-core/raw/HEAD/LICENSE"
|
|
46
|
+
},
|
|
47
|
+
"cypress-axe@1.5.0": {
|
|
48
|
+
"licenses": "MIT",
|
|
49
|
+
"repository": "https://github.com/component-driven/cypress-axe",
|
|
50
|
+
"licenseUrl": "https://github.com/component-driven/cypress-axe/raw/HEAD/License.md"
|
|
51
|
+
},
|
|
52
|
+
"cypress-real-events@1.13.0": {
|
|
53
|
+
"licenses": "MIT",
|
|
54
|
+
"repository": "https://github.com/dmtrKovalenko/cypress-real-events",
|
|
55
|
+
"licenseUrl": "https://github.com/dmtrKovalenko/cypress-real-events"
|
|
56
|
+
},
|
|
57
|
+
"cypress@13.6.2": {
|
|
58
|
+
"licenses": "MIT",
|
|
59
|
+
"repository": "https://github.com/cypress-io/cypress",
|
|
60
|
+
"licenseUrl": "https://cypress.io"
|
|
61
|
+
},
|
|
62
|
+
"esbuild@0.19.11": {
|
|
63
|
+
"licenses": "MIT",
|
|
64
|
+
"repository": "https://github.com/evanw/esbuild",
|
|
65
|
+
"licenseUrl": "https://github.com/evanw/esbuild/raw/HEAD/LICENSE.md"
|
|
66
|
+
},
|
|
67
|
+
"eslint-config-google@0.14.0": {
|
|
68
|
+
"licenses": "Apache-2.0",
|
|
69
|
+
"repository": "https://github.com/google/eslint-config-google",
|
|
70
|
+
"licenseUrl": "https://github.com/google/eslint-config-google/raw/HEAD/LICENSE"
|
|
71
|
+
},
|
|
72
|
+
"eslint-config-prettier@9.1.0": {
|
|
73
|
+
"licenses": "MIT",
|
|
74
|
+
"repository": "https://github.com/prettier/eslint-config-prettier",
|
|
75
|
+
"licenseUrl": "https://github.com/prettier/eslint-config-prettier/raw/HEAD/LICENSE"
|
|
76
|
+
},
|
|
77
|
+
"eslint@8.56.0": {
|
|
78
|
+
"licenses": "MIT",
|
|
79
|
+
"repository": "https://github.com/eslint/eslint",
|
|
80
|
+
"licenseUrl": "https://github.com/eslint/eslint/raw/HEAD/LICENSE"
|
|
81
|
+
},
|
|
82
|
+
"github-markdown-css@5.5.0": {
|
|
83
|
+
"licenses": "MIT",
|
|
84
|
+
"repository": "https://github.com/sindresorhus/github-markdown-css",
|
|
85
|
+
"licenseUrl": "https://github.com/sindresorhus/github-markdown-css/raw/HEAD/license"
|
|
86
|
+
},
|
|
87
|
+
"highlight.js@11.9.0": {
|
|
88
|
+
"licenses": "BSD-3-Clause",
|
|
89
|
+
"repository": "https://github.com/highlightjs/highlight.js",
|
|
90
|
+
"licenseUrl": "https://github.com/highlightjs/highlight.js/raw/HEAD/LICENSE"
|
|
91
|
+
},
|
|
92
|
+
"junit-report-builder@3.1.0": {
|
|
93
|
+
"licenses": "MIT",
|
|
94
|
+
"repository": "https://github.com/davidparsson/junit-report-builder",
|
|
95
|
+
"licenseUrl": "https://github.com/davidparsson/junit-report-builder/raw/HEAD/LICENSE"
|
|
96
|
+
},
|
|
97
|
+
"lint-staged@15.2.0": {
|
|
98
|
+
"licenses": "MIT",
|
|
99
|
+
"repository": "https://github.com/okonet/lint-staged",
|
|
100
|
+
"licenseUrl": "https://github.com/okonet/lint-staged/raw/HEAD/LICENSE"
|
|
101
|
+
},
|
|
102
|
+
"lit@2.8.0": {
|
|
103
|
+
"licenses": "BSD-3-Clause",
|
|
104
|
+
"repository": "https://github.com/lit/lit",
|
|
105
|
+
"licenseUrl": "https://github.com/lit/lit/raw/HEAD/LICENSE"
|
|
106
|
+
},
|
|
107
|
+
"marked@11.1.1": {
|
|
108
|
+
"licenses": "MIT",
|
|
109
|
+
"repository": "https://github.com/markedjs/marked",
|
|
110
|
+
"licenseUrl": "https://github.com/markedjs/marked/raw/HEAD/LICENSE.md"
|
|
111
|
+
},
|
|
112
|
+
"postcss-prefix-selector@1.16.0": {
|
|
113
|
+
"licenses": "MIT",
|
|
114
|
+
"repository": "https://github.com/RadValentin/postcss-prefix-selector",
|
|
115
|
+
"licenseUrl": "https://github.com/RadValentin/postcss-prefix-selector/raw/HEAD/LICENSE"
|
|
116
|
+
},
|
|
117
|
+
"postcss@8.4.32": {
|
|
118
|
+
"licenses": "MIT",
|
|
119
|
+
"repository": "https://github.com/postcss/postcss",
|
|
120
|
+
"licenseUrl": "https://github.com/postcss/postcss/raw/HEAD/LICENSE"
|
|
121
|
+
},
|
|
122
|
+
"prettier@3.1.1": {
|
|
123
|
+
"licenses": "MIT",
|
|
124
|
+
"repository": "https://github.com/prettier/prettier",
|
|
125
|
+
"licenseUrl": "https://github.com/prettier/prettier/raw/HEAD/LICENSE"
|
|
126
|
+
},
|
|
127
|
+
"resolve-pkg@2.0.0": {
|
|
128
|
+
"licenses": "MIT",
|
|
129
|
+
"repository": "https://github.com/sindresorhus/resolve-pkg",
|
|
130
|
+
"licenseUrl": "https://github.com/sindresorhus/resolve-pkg/raw/HEAD/license"
|
|
131
|
+
},
|
|
132
|
+
"sass@1.69.6": {
|
|
133
|
+
"licenses": "MIT",
|
|
134
|
+
"repository": "https://github.com/sass/dart-sass",
|
|
135
|
+
"licenseUrl": "https://github.com/sass/dart-sass/raw/HEAD/LICENSE"
|
|
136
|
+
},
|
|
137
|
+
"stylelint-config-recommended-scss@14.0.0": {
|
|
138
|
+
"licenses": "MIT",
|
|
139
|
+
"repository": "https://github.com/stylelint-scss/stylelint-config-recommended-scss",
|
|
140
|
+
"licenseUrl": "https://github.com/stylelint-scss/stylelint-config-recommended-scss/raw/HEAD/LICENSE"
|
|
141
|
+
},
|
|
142
|
+
"stylelint-config-standard@36.0.0": {
|
|
143
|
+
"licenses": "MIT",
|
|
144
|
+
"repository": "https://github.com/stylelint/stylelint-config-standard",
|
|
145
|
+
"licenseUrl": "https://github.com/stylelint/stylelint-config-standard/raw/HEAD/LICENSE"
|
|
146
|
+
},
|
|
147
|
+
"stylelint-scss@6.0.0": {
|
|
148
|
+
"licenses": "MIT",
|
|
149
|
+
"repository": "https://github.com/stylelint-scss/stylelint-scss",
|
|
150
|
+
"licenseUrl": "https://github.com/stylelint-scss/stylelint-scss/raw/HEAD/LICENSE"
|
|
151
|
+
},
|
|
152
|
+
"stylelint@16.1.0": {
|
|
153
|
+
"licenses": "MIT",
|
|
154
|
+
"repository": "https://github.com/stylelint/stylelint",
|
|
155
|
+
"licenseUrl": "https://github.com/stylelint/stylelint/raw/HEAD/LICENSE"
|
|
156
|
+
},
|
|
157
|
+
"tsup@8.0.1": {
|
|
158
|
+
"licenses": "MIT",
|
|
159
|
+
"repository": "https://github.com/egoist/tsup",
|
|
160
|
+
"licenseUrl": "https://github.com/egoist/tsup/raw/HEAD/LICENSE"
|
|
161
|
+
},
|
|
162
|
+
"turbo@1.11.2": {
|
|
163
|
+
"licenses": "MPL-2.0",
|
|
164
|
+
"repository": "https://github.com/vercel/turbo",
|
|
165
|
+
"licenseUrl": "https://github.com/vercel/turbo/raw/HEAD/LICENSE"
|
|
166
|
+
},
|
|
167
|
+
"typescript@5.3.3": {
|
|
168
|
+
"licenses": "Apache-2.0",
|
|
169
|
+
"repository": "https://github.com/Microsoft/TypeScript",
|
|
170
|
+
"licenseUrl": "https://github.com/Microsoft/TypeScript/raw/HEAD/LICENSE.txt"
|
|
171
|
+
},
|
|
172
|
+
"vite-tsconfig-paths@4.2.3": {
|
|
173
|
+
"licenses": "MIT",
|
|
174
|
+
"repository": "https://github.com/aleclarson/vite-tsconfig-paths",
|
|
175
|
+
"licenseUrl": "https://github.com/aleclarson/vite-tsconfig-paths/raw/HEAD/LICENSE"
|
|
176
|
+
},
|
|
177
|
+
"vite@5.0.10": {
|
|
178
|
+
"licenses": "MIT",
|
|
179
|
+
"repository": "https://github.com/vitejs/vite",
|
|
180
|
+
"licenseUrl": "https://github.com/vitejs/vite/raw/HEAD/LICENSE.md"
|
|
181
|
+
},
|
|
182
|
+
"vitest@1.1.1": {
|
|
183
|
+
"licenses": "MIT",
|
|
184
|
+
"repository": "https://github.com/vitest-dev/vitest",
|
|
185
|
+
"licenseUrl": "https://github.com/vitest-dev/vitest/raw/HEAD/LICENSE.md"
|
|
186
|
+
},
|
|
187
|
+
"yargs@17.7.2": {
|
|
188
|
+
"licenses": "MIT",
|
|
189
|
+
"repository": "https://github.com/yargs/yargs",
|
|
190
|
+
"licenseUrl": "https://github.com/yargs/yargs/raw/HEAD/LICENSE"
|
|
191
|
+
}
|
|
192
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cas-smartdesign/snackbar",
|
|
3
|
+
"version": "3.0.1",
|
|
4
|
+
"description": "A snackbar element based on LitElement",
|
|
5
|
+
"main": "dist/snackbar-with-externals.js",
|
|
6
|
+
"module": "dist/snackbar.mjs",
|
|
7
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
8
|
+
"types": "dist/snackbar.d.ts",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"lit": "^2.8.0"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"npm-third-party-licenses.json"
|
|
15
|
+
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"registry": "https://registry.npmjs.org/",
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@cas-smartdesign/element-preview": "^0.2.1",
|
|
22
|
+
"@cas-smartdesign/license-generator": "^1.6.1"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"version": "pnpm version",
|
|
26
|
+
"generate-declaration": "tsc -p tsconfig.types.json",
|
|
27
|
+
"build:no-license": "vite build && pnpm generate-declaration && vite build --mode documentation",
|
|
28
|
+
"build": "pnpm generate-license && pnpm build:no-license",
|
|
29
|
+
"watch": "vite build --watch",
|
|
30
|
+
"dev": "vite",
|
|
31
|
+
"generate-license": "sd-license-generator --r ../../"
|
|
32
|
+
}
|
|
33
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# @cas-smartdesign/snackbar
|
|
2
|
+
|
|
3
|
+
A highly configurable element for displaying toast notifications based on [lit-element](https://github.com/Polymer/lit-element).
|
|
4
|
+
|
|
5
|
+
## Attributes
|
|
6
|
+
|
|
7
|
+
- `vertical-position`: VerticalPosition
|
|
8
|
+
- Defines the vertical anchor position of the
|
|
9
|
+
- `horizontal-position`: HorizontalPosition
|
|
10
|
+
- Defines the horizontal anchor position
|
|
11
|
+
|
|
12
|
+
## Properties
|
|
13
|
+
|
|
14
|
+
- `verticalPosition`, `horizontalPosition`
|
|
15
|
+
- Reflects the corresponding attribute
|
|
16
|
+
- `maxStack`: number
|
|
17
|
+
- Defines the max number of visible snackbar at the same time
|
|
18
|
+
- `animationIn`: AnimationParams
|
|
19
|
+
- Defines the animation played when a snackbar enters the screen
|
|
20
|
+
- `animationOut`: AnimationParams
|
|
21
|
+
- Defines the animation played when a snackbar leaves the screen
|
|
22
|
+
|
|
23
|
+
## Public TypeScript Types
|
|
24
|
+
|
|
25
|
+
- `VerticalPosition`
|
|
26
|
+
- Defines the possible values for the vertical position
|
|
27
|
+
- Possible values: `top`, `bottom`
|
|
28
|
+
- `HorizontalPosition`
|
|
29
|
+
- Defines the possible values for the horizontal position
|
|
30
|
+
- Possible values: `left`, `center`, `right`
|
|
31
|
+
- `ISnackbar`
|
|
32
|
+
- `id`: string
|
|
33
|
+
- `message`: HTMLElement
|
|
34
|
+
- `options`: ISnackbarOptions
|
|
35
|
+
- `ISnackbarOptions`
|
|
36
|
+
- Defines the configurable properties
|
|
37
|
+
- `autoHideDuration`: number
|
|
38
|
+
- Defines the amount of milliseconds before auto hiding snackbar
|
|
39
|
+
- If omitted then the snackbar will be persistent
|
|
40
|
+
- `classNames`: string[]
|
|
41
|
+
- Defines the classes applied to the given snackbar
|
|
42
|
+
- It is useful for applying styles for specific snackbars
|
|
43
|
+
- `waitForMouseMove`: boolean
|
|
44
|
+
- Defines whether if the snackbar should wait for a mouse move before setting up the timer for auto hiding
|
|
45
|
+
- `closeAction`: HTMLElement
|
|
46
|
+
- Defines the element that goes in the action slot of the snackbar
|
|
47
|
+
- This is useful for adding a close button for a persistent snackbar
|
|
48
|
+
- `waitOnHover`: boolean
|
|
49
|
+
- Defines whether if the snackbar should wait before closing it is currently being hovered on.
|
|
50
|
+
- `AnimationParams`
|
|
51
|
+
- The element uses the Web Animations API for the animations, and this interface defines the parameters for the animations.
|
|
52
|
+
- Properties:
|
|
53
|
+
- keyframes: Keyframe[]
|
|
54
|
+
- options: KeyFrameAnimationOptions
|
|
55
|
+
|
|
56
|
+
## Custom CSS Properties
|
|
57
|
+
|
|
58
|
+
- `--sd-snackbar-height-transition-duration`: defines the duration of the collapsing animation of the snackbar which is played after the snackbar left the screen
|
|
59
|
+
- `--sd-snackbar-vertical-offset`: defines the vertical gap between the edge of the screen and the snackbar
|
|
60
|
+
- `--sd-snackbar-horizontal-offset`: defines the horizontal gap between the edge of the screen and the snackbar
|
|
61
|
+
|
|
62
|
+
## Public methods
|
|
63
|
+
|
|
64
|
+
- `open`: (snackbar: ISnackbar) => void
|
|
65
|
+
- Use for opening a snackbar
|
|
66
|
+
- `close`: (id?: string) => void
|
|
67
|
+
- Use for closing snackbar(s)
|
|
68
|
+
- If the id parameter is omitted then all snackbar are closed
|
|
69
|
+
- If a correct id is supplied then the snackbar with that specific id is closed
|
|
70
|
+
|
|
71
|
+
## Customization
|
|
72
|
+
|
|
73
|
+
- Style
|
|
74
|
+
- Custom styled snackbars can be achieved by applying css to sd-snackbar and to message and action HTML elements
|
|
75
|
+
- Animation
|
|
76
|
+
- Custom animations can be set using the [Web Animations API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API/Using_the_Web_Animations_API)
|
|
77
|
+
- The animation played when:
|
|
78
|
+
- opening a snackbar can be set by the animationIn property on the SnackbarProvider
|
|
79
|
+
- closing a snackbar can be set by the animationOut property on the SnackbarProvider
|
|
80
|
+
|
|
81
|
+
## Demo
|