@warp-ds/elements 2.1.1 → 2.2.0-next.2

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.
@@ -2297,7 +2297,6 @@ if (!customElements.get("w-icon-close-16")) {
2297
2297
 
2298
2298
  // packages/modal/modal-header.js
2299
2299
  import WarpElement2 from "@warp-ds/elements-core";
2300
- import { createRef, ref } from "lit/directives/ref.js";
2301
2300
 
2302
2301
  // packages/i18n.ts
2303
2302
  var supportedLocales3 = ["en", "nb", "fi", "da", "sv"];
@@ -2354,7 +2353,6 @@ var NO_CLOSE_BUTTON = "no-close";
2354
2353
  var ModalHeader = class extends CanCloseMixin(WarpElement2) {
2355
2354
  constructor() {
2356
2355
  super();
2357
- __publicField(this, "titleEl", createRef());
2358
2356
  activateI18n3(messages8, messages10, messages9, messages7, messages11);
2359
2357
  this._hasTopContent = false;
2360
2358
  }
@@ -2364,15 +2362,18 @@ var ModalHeader = class extends CanCloseMixin(WarpElement2) {
2364
2362
  <slot name="top" @slotchange=${this.handleTopSlotChange}></slot>
2365
2363
  <div class="${this._hasTopContent ? "" : modalElement.headerTitleBar}">
2366
2364
  ${this.backButton}
2367
- <h1 ${ref(this.titleEl)} class="${this.titleClasses}">${this.title}</h1>
2365
+ <h1 class="title-el ${this.titleClasses}">${this.title}</h1>
2368
2366
  ${this.closeButton}
2369
2367
  </div>
2370
2368
  </div>
2371
2369
  `;
2372
2370
  }
2371
+ get titleEl() {
2372
+ return this.shadowRoot.querySelector(".title-el");
2373
+ }
2373
2374
  async willUpdate(changedProperties) {
2374
2375
  if (changedProperties.has("back")) {
2375
- const move = new Move(this.titleEl.value);
2376
+ const move = new Move(this.titleEl);
2376
2377
  move.when(async () => {
2377
2378
  await this.updateComplete;
2378
2379
  });
@@ -2431,7 +2432,6 @@ __publicField(ModalHeader, "styles", [WarpElement2.styles]);
2431
2432
  // packages/modal/modal-main.js
2432
2433
  import { css, html as html5 } from "lit";
2433
2434
  import WarpElement3 from "@warp-ds/elements-core";
2434
- import { createRef as createRef2, ref as ref2 } from "lit/directives/ref.js";
2435
2435
 
2436
2436
  // node_modules/.pnpm/scroll-doctor@2.0.2/node_modules/scroll-doctor/dist/scroll-doctor.js
2437
2437
  var n = [];
@@ -2497,29 +2497,26 @@ var CONTENT_ID = "content-id";
2497
2497
  var ModalMain = class extends ProvidesCanCloseToSlotsMixin(WarpElement3) {
2498
2498
  constructor() {
2499
2499
  super();
2500
- __publicField(this, "dialogEl", createRef2());
2501
- __publicField(this, "dialogInnerEl", createRef2());
2502
- __publicField(this, "contentEl", createRef2());
2503
2500
  this.interceptEscape = this.interceptEscape.bind(this);
2504
2501
  this.closeOnBackdropClick = this.closeOnBackdropClick.bind(this);
2505
2502
  this.eventPreventer = this.eventPreventer.bind(this);
2506
2503
  this.modifyBorderRadius = this.modifyBorderRadius.bind(this);
2507
2504
  }
2508
2505
  async open() {
2509
- this.dialogEl.value.showModal();
2506
+ this.dialogEl.showModal();
2510
2507
  this.handleListeners();
2511
- E(this.contentEl.value);
2508
+ E(this.contentEl);
2512
2509
  await this.updateComplete;
2513
2510
  this.dispatchEvent(new CustomEvent("shown", { bubbles: true, composed: true }));
2514
2511
  }
2515
2512
  close() {
2516
2513
  this.handleListeners("removeEventListener");
2517
- this.dialogEl.value.classList.add("close");
2518
- this.dialogEl.value.addEventListener(
2514
+ this.dialogEl.classList.add("close");
2515
+ this.dialogEl.addEventListener(
2519
2516
  "animationend",
2520
2517
  async () => {
2521
- this.dialogEl.value.classList.remove("close");
2522
- this.dialogEl.value.close();
2518
+ this.dialogEl.classList.remove("close");
2519
+ this.dialogEl.close();
2523
2520
  T();
2524
2521
  await this.updateComplete;
2525
2522
  this.dispatchEvent(new CustomEvent("hidden", { bubbles: true, composed: true }));
@@ -2529,10 +2526,10 @@ var ModalMain = class extends ProvidesCanCloseToSlotsMixin(WarpElement3) {
2529
2526
  }
2530
2527
  render() {
2531
2528
  return html5`
2532
- <dialog ${ref2(this.dialogEl)} class="w-modal ${modalElement.dialogEl}">
2533
- <div ${ref2(this.dialogInnerEl)} class="${modalElement.dialogInner}">
2529
+ <dialog class="dialog-el w-modal ${modalElement.dialogEl}">
2530
+ <div class="dialog-inner-el ${modalElement.dialogInner}">
2534
2531
  <slot name="header" @slotchange="${this.handleSlotChange}"></slot>
2535
- <div ${ref2(this.contentEl)} class="${modalElement.contentSlot}" id=${this[CONTENT_ID]}>
2532
+ <div class="content-el ${modalElement.contentSlot}" id=${this[CONTENT_ID]}>
2536
2533
  <slot name="content" @slotchange="${this.handleSlotChange}"></slot>
2537
2534
  </div>
2538
2535
  <slot name="footer" @slotchange="${this.handleSlotChange}"></slot>
@@ -2540,15 +2537,24 @@ var ModalMain = class extends ProvidesCanCloseToSlotsMixin(WarpElement3) {
2540
2537
  </dialog>
2541
2538
  `;
2542
2539
  }
2543
- willUpdate(changedProperties) {
2540
+ get dialogEl() {
2541
+ return this.shadowRoot.querySelector(".dialog-el");
2542
+ }
2543
+ get dialogInnerEl() {
2544
+ return this.shadowRoot.querySelector(".dialog-inner-el");
2545
+ }
2546
+ get contentEl() {
2547
+ return this.shadowRoot.querySelector(".content-el");
2548
+ }
2549
+ updated(changedProperties) {
2544
2550
  if (changedProperties.has("show")) this[this.show ? "open" : "close"]();
2545
2551
  }
2546
2552
  handleListeners(verb = "addEventListener") {
2547
2553
  document[verb]("keydown", this.interceptEscape);
2548
- if (!this[NO_BACKDROP_CLICKS]) this.dialogEl.value[verb]("mousedown", this.closeOnBackdropClick);
2549
- this.dialogEl.value[verb]("close", this.eventPreventer);
2550
- this.dialogEl.value[verb]("cancel", this.eventPreventer);
2551
- this.dialogInnerEl.value[verb]("transitionend", this.modifyBorderRadius);
2554
+ if (!this[NO_BACKDROP_CLICKS]) this.dialogEl[verb]("mousedown", this.closeOnBackdropClick);
2555
+ this.dialogEl[verb]("close", this.eventPreventer);
2556
+ this.dialogEl[verb]("cancel", this.eventPreventer);
2557
+ this.dialogInnerEl[verb]("transitionend", this.modifyBorderRadius);
2552
2558
  }
2553
2559
  /** @param {Event} evt */
2554
2560
  eventPreventer(evt) {
@@ -2556,7 +2562,7 @@ var ModalMain = class extends ProvidesCanCloseToSlotsMixin(WarpElement3) {
2556
2562
  }
2557
2563
  /** @param {MouseEvent} evt */
2558
2564
  closeOnBackdropClick(evt) {
2559
- if (this.dialogEl.value === evt.target) this.close();
2565
+ if (this.dialogEl === evt.target) this.close();
2560
2566
  }
2561
2567
  /** @param {KeyboardEvent} evt */
2562
2568
  interceptEscape(evt) {
@@ -2566,8 +2572,8 @@ var ModalMain = class extends ProvidesCanCloseToSlotsMixin(WarpElement3) {
2566
2572
  }
2567
2573
  }
2568
2574
  modifyBorderRadius() {
2569
- if (this.dialogInnerEl.value.scrollHeight * 1.02 > innerHeight) this.dialogInnerEl.value.style.borderRadius = "0px";
2570
- else this.dialogInnerEl.value.style.borderRadius = null;
2575
+ if (this.dialogInnerEl.scrollHeight * 1.02 > innerHeight) this.dialogInnerEl.style.borderRadius = "0px";
2576
+ else this.dialogInnerEl.style.borderRadius = null;
2571
2577
  }
2572
2578
  };
2573
2579
  __publicField(ModalMain, "properties", {