@supersoniks/concorde 3.2.4 → 3.2.5

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.2.4",
3
+ "version": "3.2.5",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -3,6 +3,7 @@ import { customElement, property } from "lit/decorators.js";
3
3
  import { Modal } from "@supersoniks/concorde/core/components/ui/modal/modal";
4
4
  import { ifDefined } from "lit/directives/if-defined.js";
5
5
  import HTML from "@supersoniks/concorde/core/utils/HTML";
6
+ import { ButtonType } from "../button/button";
6
7
  const tagName = "sonic-modal-close";
7
8
 
8
9
  @customElement(tagName)
@@ -16,6 +17,7 @@ export class ModalClose extends LitElement {
16
17
  };
17
18
 
18
19
  @property() reset?: string;
20
+ @property() type?: ButtonType;
19
21
 
20
22
  connectedCallback() {
21
23
  super.connectedCallback();
@@ -23,10 +25,12 @@ export class ModalClose extends LitElement {
23
25
  }
24
26
  render() {
25
27
  return html`<sonic-button
26
- aria-label=${this.translation[this.lang]}
28
+ noAutoFill
29
+ data-aria-label=${this.translation[this.lang]}
27
30
  reset=${ifDefined(this.reset)}
28
31
  shape="circle"
29
32
  @click=${this.handleClick}
33
+ type=${ifDefined(this.type)}
30
34
  ><sonic-icon name="cancel" size="lg"></sonic-icon
31
35
  ></sonic-button>`;
32
36
  }
@@ -17,6 +17,8 @@ import { DirectiveResult } from "lit/directive.js";
17
17
  import LocationHandler from "@supersoniks/concorde/core/utils/LocationHandler";
18
18
 
19
19
  import { unsafeHTML } from "lit/directives/unsafe-html.js";
20
+ import { ifDefined } from "lit/directives/if-defined.js";
21
+ import { ButtonType } from "../button/button";
20
22
 
21
23
  declare const window: ConcordeWindow;
22
24
  declare type ModalCreateOptions = {
@@ -38,6 +40,7 @@ declare type ModalCreateOptions = {
38
40
  effect?: effectType;
39
41
  closeOnLocationChange?: boolean;
40
42
  noCloseButton?: boolean;
43
+ closeButtonType?: ButtonType;
41
44
  };
42
45
 
43
46
  type effectType = "fade" | "slide" | "none";
@@ -156,32 +159,48 @@ export class Modal extends Subscriber(LitElement) {
156
159
  /* Close button */
157
160
  ::slotted(sonic-modal-close),
158
161
  sonic-modal-close {
159
- --sc_translate-x: calc(var(--sc-modal-px) - 0.25rem);
160
- --sc_translate-y: calc(-1 * var(--sc-modal-py) - 0.25rem);
161
162
  --sc_top: 0.25rem;
162
163
  --sc_x: 0.25rem;
163
164
  position: sticky;
164
165
  display: block;
165
- height: 0;
166
166
  top: var(--sc_top);
167
167
  margin-left: auto;
168
+ margin-bottom: -1rem;
168
169
  margin-top: calc(-1 * var(--sc-modal-py) - 0.25rem);
169
- margin-bottom: var(--sc-modal-py);
170
- transform: translateX(var(--sc_translate-x));
170
+ margin-right: calc(-1 * var(--sc-modal-px) + 0.25rem);
171
171
  z-index: 20;
172
+ opacity: 0;
173
+ transform: scale(0);
174
+ transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
175
+ opacity 0.1s linear;
176
+ transform-origin: center center;
177
+ display: flex;
178
+ align-items: center;
179
+ justify-content: center;
172
180
  }
173
181
  :host([align="right"]) ::slotted(sonic-modal-close),
174
182
  :host([align="right"]) sonic-modal-close {
175
183
  right: auto;
176
184
  margin-right: auto;
177
- margin-left: 0;
178
- transform: translateX(calc(-1 * var(--sc_translate-x)));
185
+ margin-left: calc(-1 * var(--sc-modal-px) + 0.25rem);
179
186
  }
180
187
 
181
188
  /* Border radius */
182
189
  :host([rounded="none"]) #modal {
183
190
  --sc-img-radius: 0 !important;
184
191
  }
192
+
193
+ sonic-modal-close.animate-in {
194
+ transform: scale(1);
195
+ opacity: 1 !important;
196
+ transition-delay: 0.2s;
197
+ }
198
+ sonic-modal-close.animate-out {
199
+ opacity: 0 !important;
200
+ transition-delay: 0s !important;
201
+ transform: scale(0) !important;
202
+ transition: 0.2s linear !important;
203
+ }
185
204
  `,
186
205
  ];
187
206
  static modals: Array<Modal> = [];
@@ -209,6 +228,7 @@ export class Modal extends Subscriber(LitElement) {
209
228
 
210
229
  @property({ type: Boolean, reflect: true }) fullScreen = false;
211
230
  @property({ type: Boolean, reflect: true }) visible = false;
231
+ @property({ type: String }) closeButtonType?: ButtonType;
212
232
 
213
233
  @query("#modal") _modalElement!: HTMLDialogElement;
214
234
 
@@ -238,6 +258,8 @@ export class Modal extends Subscriber(LitElement) {
238
258
  if (options.fullScreen) modal.fullScreen = options?.fullScreen;
239
259
  if (options.effect) modal.effect = options?.effect;
240
260
  if (options.noCloseButton) modal.noCloseButton = true;
261
+ if (options.closeButtonType)
262
+ modal.closeButtonType = options?.closeButtonType;
241
263
  if (options.paddingX) modal.paddingX = options?.paddingX;
242
264
  if (options.paddingY) modal.paddingY = options?.paddingY;
243
265
  if (options.zIndex) modal.zIndex = options?.zIndex;
@@ -355,7 +377,12 @@ export class Modal extends Subscriber(LitElement) {
355
377
  ${this._animationState !== "hidden"
356
378
  ? html`<div id="modal-content">
357
379
  ${!this.forceAction && !this.noCloseButton
358
- ? html`<sonic-modal-close></sonic-modal-close>`
380
+ ? html`<sonic-modal-close
381
+ class="${this._animationState == "visible"
382
+ ? "animate-in"
383
+ : "animate-out"}"
384
+ type=${ifDefined(this.closeButtonType)}
385
+ ></sonic-modal-close>`
359
386
  : nothing}
360
387
  ${this.modalFragment("title")} ${this.modalFragment("subtitle")}
361
388
  ${this.modalFragment("content")} ${this.modalFragment("actions")}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/vite.config.mts CHANGED
File without changes