@proximus/lavender 1.4.7-alpha.4 → 1.4.7-alpha.6

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.
@@ -7873,7 +7873,7 @@ class CellRadio extends WithExtraAttributes {
7873
7873
  }
7874
7874
  connectedCallback() {
7875
7875
  var _a;
7876
- this.tabIndex = ((_a = this.parentElement) == null ? void 0 : _a.firstElementChild) === this ? 0 : -1;
7876
+ this.tabIndex = ((_a = this.parentElement) == null ? void 0 : _a.querySelector("px-cell-radio")) === this ? 0 : -1;
7877
7877
  this.role = "radio";
7878
7878
  if (this.internals) {
7879
7879
  this.internals.role = "radio";
@@ -9570,19 +9570,14 @@ class Drawer extends HTMLElement {
9570
9570
  connectedCallback() {
9571
9571
  var _a;
9572
9572
  this.toggleFooterVisibility = this.toggleFooterVisibility.bind(this);
9573
- if (!this.hasAttribute("showfrom")) {
9574
- this.setAttribute("showfrom", "bottom");
9573
+ if (this.$opener) {
9574
+ this.addOpenListener();
9575
9575
  }
9576
- if (this.hasAttribute("closedby")) {
9577
- const $closer = document.querySelector(
9578
- `#${this.getAttribute("closedby")}`
9579
- );
9580
- $closer == null ? void 0 : $closer.addEventListener("click", () => {
9581
- this.hide();
9582
- });
9576
+ if (this.$closer) {
9577
+ this.addCloseListener();
9583
9578
  }
9584
- if (this.hasAttribute("openedby")) {
9585
- this.addOpenListener();
9579
+ if (!this.hasAttribute("showfrom")) {
9580
+ this.setAttribute("showfrom", "bottom");
9586
9581
  }
9587
9582
  this.$closeButton.addEventListener("click", () => {
9588
9583
  this.hide();
@@ -9594,36 +9589,56 @@ class Drawer extends HTMLElement {
9594
9589
  );
9595
9590
  }
9596
9591
  static get observedAttributes() {
9597
- return ["open", "aria-label-close-button", "openedby"];
9592
+ return ["open", "aria-label-close-button", "openedby", "closedby"];
9598
9593
  }
9599
- attributeChangedCallback(name, oldValue, newValue) {
9594
+ attributeChangedCallback(attrName, oldValue, newValue) {
9600
9595
  var _a, _b, _c;
9601
- if (name === "open") {
9602
- if (newValue !== null) {
9603
- this.show();
9604
- } else {
9605
- this.hide();
9606
- }
9607
- } else if (name === "aria-label-close-button") {
9608
- if (!newValue) {
9609
- (_a = this.$closeButton) == null ? void 0 : _a.removeAttribute("aria-label");
9610
- } else {
9611
- (_c = (_b = this.$closeButton) == null ? void 0 : _b.setAttribute) == null ? void 0 : _c.call(
9612
- _b,
9613
- "aria-label",
9614
- newValue || "Close drawer"
9615
- );
9616
- }
9617
- } else if (name === "openedby") {
9618
- this.addOpenListener();
9596
+ switch (attrName) {
9597
+ case "open":
9598
+ if (newValue !== null) {
9599
+ this.show();
9600
+ } else {
9601
+ this.hide();
9602
+ }
9603
+ break;
9604
+ case "aria-label-close-button":
9605
+ if (!newValue) {
9606
+ (_a = this.$closeButton) == null ? void 0 : _a.removeAttribute("aria-label");
9607
+ } else {
9608
+ (_c = (_b = this.$closeButton) == null ? void 0 : _b.setAttribute) == null ? void 0 : _c.call(
9609
+ _b,
9610
+ "aria-label",
9611
+ newValue || "Close drawer"
9612
+ );
9613
+ }
9614
+ break;
9615
+ case "openedby":
9616
+ if (newValue !== oldValue) {
9617
+ if (oldValue) {
9618
+ const oldOpener = document.querySelector(`#${oldValue}`);
9619
+ oldOpener == null ? void 0 : oldOpener.removeEventListener("click", () => this.show());
9620
+ }
9621
+ this.addOpenListener();
9622
+ }
9623
+ break;
9624
+ case "closedby":
9625
+ this.addCloseListener();
9626
+ break;
9619
9627
  }
9620
9628
  }
9621
9629
  disconnectedCallback() {
9622
- var _a;
9630
+ var _a, _b;
9623
9631
  (_a = this.$slotFooter) == null ? void 0 : _a.removeEventListener(
9624
9632
  "slotchange",
9625
9633
  this.toggleFooterVisibility
9626
9634
  );
9635
+ (_b = this.observer) == null ? void 0 : _b.disconnect();
9636
+ if (this.$opener) {
9637
+ this.$opener.removeEventListener("click", () => this.show());
9638
+ }
9639
+ if (this.$closer) {
9640
+ this.$closer.removeEventListener("click", () => this.hide());
9641
+ }
9627
9642
  }
9628
9643
  show() {
9629
9644
  var _a, _b;
@@ -9649,15 +9664,41 @@ class Drawer extends HTMLElement {
9649
9664
  }
9650
9665
  }
9651
9666
  addOpenListener() {
9652
- var _a, _b, _c;
9653
- if (((_a = this.$opener) == null ? void 0 : _a.getAttribute("data-has-opener")) !== "true") {
9654
- (_b = this.$opener) == null ? void 0 : _b.setAttribute("data-has-opener", "true");
9655
- (_c = this.$opener) == null ? void 0 : _c.addEventListener("click", () => this.show());
9667
+ if (this.$opener) {
9668
+ if (this.$opener.getAttribute("data-has-opener") !== "true") {
9669
+ this.$opener.setAttribute("data-has-opener", "true");
9670
+ this.$opener.addEventListener("click", () => this.show());
9671
+ }
9672
+ } else {
9673
+ this.observer = new MutationObserver(() => {
9674
+ if (this.$opener) {
9675
+ this.observer.disconnect();
9676
+ this.observer = null;
9677
+ this.addOpenListener();
9678
+ }
9679
+ });
9680
+ this.observer.observe(document.body, {
9681
+ childList: true,
9682
+ subtree: true
9683
+ });
9684
+ }
9685
+ }
9686
+ addCloseListener() {
9687
+ var _a;
9688
+ if (this.$closer) {
9689
+ (_a = this.$closer) == null ? void 0 : _a.addEventListener("click", () => {
9690
+ this.hide();
9691
+ });
9656
9692
  }
9657
9693
  }
9658
9694
  get $opener() {
9659
9695
  return document.querySelector(
9660
- `px-button#${this.getAttribute("openedby")}`
9696
+ `#${this.getAttribute("openedby")}`
9697
+ );
9698
+ }
9699
+ get $closer() {
9700
+ return document.querySelector(
9701
+ `#${this.getAttribute("closedby")}`
9661
9702
  );
9662
9703
  }
9663
9704
  get $closeButton() {
@@ -9687,10 +9728,10 @@ class Drawer extends HTMLElement {
9687
9728
  this.removeAttribute("open");
9688
9729
  }
9689
9730
  }
9690
- get ariaLabelCloseButton() {
9731
+ get AriaLabelCloseButton() {
9691
9732
  return this.getAttribute("aria-label-close-button");
9692
9733
  }
9693
- set ariaLabelCloseButton(value) {
9734
+ set AriaLabelCloseButton(value) {
9694
9735
  this.setAttribute("aria-label-close-button", value);
9695
9736
  }
9696
9737
  get openedby() {
@@ -9699,6 +9740,12 @@ class Drawer extends HTMLElement {
9699
9740
  set openedby(value) {
9700
9741
  this.setAttribute("openedby", value);
9701
9742
  }
9743
+ get closedby() {
9744
+ return this.getAttribute("closedby");
9745
+ }
9746
+ set closedby(value) {
9747
+ this.setAttribute("closedby", value);
9748
+ }
9702
9749
  }
9703
9750
  if (!customElements.get("px-drawer")) {
9704
9751
  customElements.define("px-drawer", Drawer);
@@ -12693,6 +12740,7 @@ class Modal extends HTMLElement {
12693
12740
  this.onOpenClick = () => this.show();
12694
12741
  this.onCloseClick = () => this.close();
12695
12742
  this.commandButtonCleanups = [];
12743
+ this.opener = null;
12696
12744
  this.openerElement = null;
12697
12745
  this.closerElement = null;
12698
12746
  this.template = `<dialog>
@@ -12897,12 +12945,29 @@ class Modal extends HTMLElement {
12897
12945
  addOpenListener() {
12898
12946
  var _a;
12899
12947
  this.removeOpenListener();
12900
- this.openerElement = this.$opener;
12901
- (_a = this.openerElement) == null ? void 0 : _a.addEventListener("click", this.onOpenClick);
12948
+ if (this.$opener) {
12949
+ this.openerElement = this.$opener;
12950
+ this.openerElement.addEventListener("click", this.onOpenClick);
12951
+ } else {
12952
+ (_a = this.opener) == null ? void 0 : _a.disconnect();
12953
+ this.opener = new MutationObserver(() => {
12954
+ if (this.$opener) {
12955
+ this.opener.disconnect();
12956
+ this.opener = null;
12957
+ this.addOpenListener();
12958
+ }
12959
+ });
12960
+ this.opener.observe(document.body, {
12961
+ childList: true,
12962
+ subtree: true
12963
+ });
12964
+ }
12902
12965
  }
12903
12966
  removeOpenListener() {
12904
- var _a;
12905
- (_a = this.openerElement) == null ? void 0 : _a.removeEventListener("click", this.onOpenClick);
12967
+ var _a, _b;
12968
+ (_a = this.opener) == null ? void 0 : _a.disconnect();
12969
+ this.opener = null;
12970
+ (_b = this.openerElement) == null ? void 0 : _b.removeEventListener("click", this.onOpenClick);
12906
12971
  this.openerElement = null;
12907
12972
  }
12908
12973
  addCloseListener(value) {
@@ -13829,7 +13894,7 @@ class SelectableBoxRadio extends WithExtraAttributes {
13829
13894
  this.internals.ariaChecked = `${this.checked}`;
13830
13895
  }
13831
13896
  this.ariaChecked = `${this.checked}`;
13832
- this.tabIndex = ((_a = this.parentElement) == null ? void 0 : _a.firstElementChild) === this ? 0 : -1;
13897
+ this.tabIndex = ((_a = this.parentElement) == null ? void 0 : _a.querySelector("px-selectable-box-radio")) === this ? 0 : -1;
13833
13898
  this.toggleFooterVisibility();
13834
13899
  this.$slotFooter.addEventListener(
13835
13900
  "slotchange",
@@ -16176,7 +16241,7 @@ class TileRadio extends WithExtraAttributes {
16176
16241
  this.internals.ariaChecked = `${this.checked}`;
16177
16242
  }
16178
16243
  this.ariaChecked = `${this.checked}`;
16179
- this.tabIndex = ((_a = this.parentElement) == null ? void 0 : _a.firstElementChild) === this ? 0 : -1;
16244
+ this.tabIndex = ((_a = this.parentElement) == null ? void 0 : _a.querySelector("px-tile-radio")) === this ? 0 : -1;
16180
16245
  if (this.$slotPrefix) {
16181
16246
  const prefixImg = this.querySelector('px-img[slot="prefix"]');
16182
16247
  if (prefixImg) {