@supersoniks/concorde 3.1.98 → 3.1.100

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supersoniks/concorde",
3
- "version": "3.1.98",
3
+ "version": "3.1.100",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "",
@@ -37,6 +37,7 @@ declare type ModalCreateOptions = {
37
37
  fullScreen?: boolean;
38
38
  effect?: effectType;
39
39
  closeOnLocationChange?: boolean;
40
+ noCloseButton?: boolean;
40
41
  };
41
42
 
42
43
  type effectType = "fade" | "slide" | "none";
@@ -185,6 +186,7 @@ export class Modal extends Subscriber(LitElement) {
185
186
  ];
186
187
  static modals: Array<Modal> = [];
187
188
  @property({ type: Boolean }) forceAction = false;
189
+ @property({ type: Boolean }) noCloseButton = false;
188
190
  @property({ type: Boolean }) removeOnHide = false;
189
191
  @property({ type: Boolean }) removeHashOnHide = false;
190
192
  @property({ type: String, reflect: true }) align:
@@ -235,7 +237,7 @@ export class Modal extends Subscriber(LitElement) {
235
237
  if (options.forceAction) modal.forceAction = true;
236
238
  if (options.fullScreen) modal.fullScreen = options?.fullScreen;
237
239
  if (options.effect) modal.effect = options?.effect;
238
-
240
+ if (options.noCloseButton) modal.noCloseButton = true;
239
241
  if (options.paddingX) modal.paddingX = options?.paddingX;
240
242
  if (options.paddingY) modal.paddingY = options?.paddingY;
241
243
  if (options.zIndex) modal.zIndex = options?.zIndex;
@@ -352,7 +354,7 @@ export class Modal extends Subscriber(LitElement) {
352
354
  >
353
355
  ${this._animationState !== "hidden"
354
356
  ? html`<div id="modal-content">
355
- ${!this.forceAction
357
+ ${!this.forceAction && !this.noCloseButton
356
358
  ? html`<sonic-modal-close></sonic-modal-close>`
357
359
  : nothing}
358
360
  ${this.modalFragment("title")} ${this.modalFragment("subtitle")}
@@ -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 { Toast } from "@supersoniks/concorde/core/components/ui/toast/types";
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();