@supersoniks/concorde 3.1.21 → 3.1.22

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.21",
3
+ "version": "3.1.22",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "",
@@ -1,4 +1,4 @@
1
- import { animate, fadeIn, fadeOut } from "@lit-labs/motion";
1
+ import { animate, fadeIn, fadeOut, Options } from "@lit-labs/motion";
2
2
  import { customScroll } from "@supersoniks/concorde/core/components/ui/_css/scroll";
3
3
  import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
4
4
  import { css, html, LitElement, nothing, PropertyValues } from "lit";
@@ -39,7 +39,12 @@ declare type ModalCreateOptions = {
39
39
  removeOnHide?: boolean;
40
40
  forceAction?: boolean;
41
41
  removeHashOnHide?: boolean;
42
+ fullScreen?: boolean;
43
+ effect?: effectType;
42
44
  };
45
+
46
+ type effectType = "fade" | "slide" | "none";
47
+
43
48
  const tagName = "sonic-modal";
44
49
 
45
50
  @customElement(tagName)
@@ -180,10 +185,13 @@ export class Modal extends Subscriber(LitElement) {
180
185
  @property({ type: String }) width = "100%";
181
186
  @property({ type: String }) height = "auto";
182
187
  @property({ type: String }) zIndex = "var(--sc-modal-z-index)";
188
+ @property({ type: String }) effect?: effectType;
183
189
  @property({ type: Object }) options?: ModalCreateOptions;
184
190
  @property({ type: Boolean, reflect: true }) fullScreen = false;
185
191
  @property({ type: Boolean, reflect: true }) visible = false;
186
192
 
193
+ @property({ type: Object }) animation?: Options;
194
+
187
195
  @query(".modal-wrapper") modalWrapper!: HTMLDivElement;
188
196
  @query(".modal") modalElement!: HTMLDivElement;
189
197
 
@@ -204,6 +212,8 @@ export class Modal extends Subscriber(LitElement) {
204
212
  if (options.maxHeight) modal.maxHeight = options?.maxHeight;
205
213
  if (options.height) modal.height = options?.height;
206
214
  if (options.forceAction) modal.forceAction = true;
215
+ if (options.fullScreen) modal.fullScreen = options?.fullScreen;
216
+ if (options.effect) modal.effect = options?.effect;
207
217
 
208
218
  if (options.paddingX)
209
219
  modal.style.setProperty("--sc-modal-px", options?.paddingX);
@@ -248,6 +258,40 @@ export class Modal extends Subscriber(LitElement) {
248
258
  if (_changedProperties.has("fullScreen")) {
249
259
  this.handleFullsceen();
250
260
  }
261
+ if (_changedProperties.has("effect")) {
262
+ if (this.effect == "fade") {
263
+ this.animation = {
264
+ keyframeOptions: {
265
+ duration: 400,
266
+ },
267
+ in: fadeIn,
268
+ out: fadeOut,
269
+ };
270
+ } else if (this.effect == "none") {
271
+ this.animation = undefined;
272
+ } else {
273
+ this.animation = {
274
+ keyframeOptions: {
275
+ duration: 400,
276
+ easing: `cubic-bezier(0.250, 0.250, 0.420, 1.225)`,
277
+ },
278
+ in: [
279
+ {
280
+ transform: "translateY(25%) scale(1)",
281
+ boxShadow: "0 0 0 rgba(0,0,0,0)",
282
+ opacity: 0,
283
+ },
284
+ ],
285
+ out: [
286
+ {
287
+ transform: "translateY(20%) scale(1)",
288
+ boxShadow: "0 0 0 rgba(0,0,0,0)",
289
+ opacity: 0,
290
+ },
291
+ ],
292
+ };
293
+ }
294
+ }
251
295
  super.willUpdate(_changedProperties);
252
296
  }
253
297
 
@@ -284,26 +328,7 @@ export class Modal extends Subscriber(LitElement) {
284
328
  part="modal"
285
329
  class="modal custom-scroll"
286
330
  style=${styleMap(modalStyles)}
287
- ${animate({
288
- keyframeOptions: {
289
- duration: 400,
290
- easing: `cubic-bezier(0.250, 0.250, 0.420, 1.225)`,
291
- },
292
- in: [
293
- {
294
- transform: "translateY(25%) scale(1)",
295
- boxShadow: "0 0 0 rgba(0,0,0,0)",
296
- opacity: 0,
297
- },
298
- ],
299
- out: [
300
- {
301
- transform: "translateY(20%) scale(1)",
302
- boxShadow: "0 0 0 rgba(0,0,0,0)",
303
- opacity: 0,
304
- },
305
- ],
306
- })}
331
+ ${animate(this.animation)}
307
332
  >
308
333
  <div class="modal-content">
309
334
  ${!this.options?.forceAction