@supersoniks/concorde 3.1.98 → 3.1.99
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/build-infos.json +1 -1
- package/concorde-core.bundle.js +122 -121
- package/concorde-core.es.js +175 -153
- package/dist/concorde-core.bundle.js +122 -121
- package/dist/concorde-core.es.js +175 -153
- package/package.json +1 -1
- package/src/core/components/ui/toast/toast.ts +43 -1
package/package.json
CHANGED
|
@@ -8,7 +8,10 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|
|
8
8
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
9
9
|
import { styleMap, StyleInfo } from "lit/directives/style-map.js";
|
|
10
10
|
import "@supersoniks/concorde/core/components/ui/toast/toast-item";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
Toast,
|
|
13
|
+
ToastStatus,
|
|
14
|
+
} from "@supersoniks/concorde/core/components/ui/toast/types";
|
|
12
15
|
import { ConcordeWindow } from "@supersoniks/concorde/core/_types/types";
|
|
13
16
|
import { Theme } from "@supersoniks/concorde/core/components/ui/theme/theme";
|
|
14
17
|
import { sonicClassPrefix } from "@supersoniks/concorde/core/utils/Utils";
|
|
@@ -110,6 +113,36 @@ export class SonicToast extends LitElement {
|
|
|
110
113
|
toastComponent.toasts = toastComponent.toasts.filter((item) => item.ghost);
|
|
111
114
|
}
|
|
112
115
|
|
|
116
|
+
static removeItemsByStatus(status: ToastStatus) {
|
|
117
|
+
if (SonicToast.delegateToasts) {
|
|
118
|
+
SonicToast.handleExistingToastDelegation();
|
|
119
|
+
window.parent.postMessage({ type: "removeItemsByStatus", status }, "*");
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const toastComponent: SonicToast = SonicToast.getInstance();
|
|
123
|
+
if (!toastComponent) return;
|
|
124
|
+
|
|
125
|
+
// Filtrer pour garder seulement les toasts qui ne correspondent pas au statut donné
|
|
126
|
+
toastComponent.toasts = toastComponent.toasts.filter(
|
|
127
|
+
(toast) => toast.status !== status
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// retire les items qui ne sont pas en preserve
|
|
132
|
+
static removeTemporaryItems() {
|
|
133
|
+
if (SonicToast.delegateToasts) {
|
|
134
|
+
SonicToast.handleExistingToastDelegation();
|
|
135
|
+
window.parent.postMessage({ type: "removeTemporaryItems" }, "*");
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const toastComponent: SonicToast = SonicToast.getInstance();
|
|
139
|
+
if (!toastComponent) return;
|
|
140
|
+
|
|
141
|
+
toastComponent.toasts = toastComponent.toasts.filter(
|
|
142
|
+
(item) => item.preserve
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
113
146
|
// ADD TOAST
|
|
114
147
|
static instance?: SonicToast;
|
|
115
148
|
static getInstance() {
|
|
@@ -219,6 +252,15 @@ function handleIframeContexts() {
|
|
|
219
252
|
if (e.data.type == "querySonicToastAvailability") {
|
|
220
253
|
(e.source as Window).postMessage({ type: "sonicToastAvailable" }, "*");
|
|
221
254
|
}
|
|
255
|
+
|
|
256
|
+
if (e.data.type == "removeItemsByStatus") {
|
|
257
|
+
SonicToast.removeItemsByStatus(e.data.status);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (e.data.type == "removeTemporaryItems") {
|
|
261
|
+
SonicToast.removeTemporaryItems();
|
|
262
|
+
}
|
|
263
|
+
|
|
222
264
|
if (e.data.type == "sonicToastAvailable") {
|
|
223
265
|
SonicToast.delegateToasts = true;
|
|
224
266
|
SonicToast.handleExistingToastDelegation();
|