@proximus/lavender 2.0.0-alpha.55 → 2.0.0-alpha.57

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.
@@ -2003,7 +2003,7 @@ class Icon extends WithExtraAttributes {
2003
2003
  __privateAdd(this, _src);
2004
2004
  __privateAdd(this, _internals);
2005
2005
  __privateAdd(this, _template, () => `<svg aria-hidden="true">
2006
- <use xlink:href=""></use>
2006
+ <use></use>
2007
2007
  </svg>`);
2008
2008
  this.shadowRoot.innerHTML = __privateGet(this, _template).call(this);
2009
2009
  __privateSet(this, _internals, (_a = this.attachInternals) == null ? void 0 : _a.call(this));
@@ -2055,12 +2055,6 @@ class Icon extends WithExtraAttributes {
2055
2055
  }
2056
2056
  connectedCallback() {
2057
2057
  this.role = "img";
2058
- if (this.name) {
2059
- this.$el.firstElementChild.setAttribute(
2060
- "xlink:href",
2061
- `#icon-${this.name}`
2062
- );
2063
- }
2064
2058
  const iconSet = document.querySelectorAll("px-icon-set");
2065
2059
  if (!iconSet) {
2066
2060
  console.log("<px-icon-set> component not found");
@@ -2073,7 +2067,7 @@ class Icon extends WithExtraAttributes {
2073
2067
  if (icon.getAttribute("name") === this.from && icon.getAttribute("type") !== "font") {
2074
2068
  __privateSet(this, _src, icon.getAttribute("src"));
2075
2069
  this.$el.firstElementChild.setAttribute(
2076
- "xlink:href",
2070
+ "href",
2077
2071
  `${__privateGet(this, _src)}#icon-${this.name}`
2078
2072
  );
2079
2073
  }
@@ -2107,7 +2101,7 @@ class Icon extends WithExtraAttributes {
2107
2101
  updateName(oldValue, newValue) {
2108
2102
  if (__privateGet(this, _src)) {
2109
2103
  this.$el.firstElementChild.setAttribute(
2110
- "xlink:href",
2104
+ "href",
2111
2105
  `${__privateGet(this, _src)}#icon-${newValue}`
2112
2106
  );
2113
2107
  }
@@ -3740,6 +3734,14 @@ const _Banner = class _Banner extends VerticallyExtendedElement {
3740
3734
  }
3741
3735
  this.createGridTemplateAreas();
3742
3736
  this.createGridding();
3737
+ this.observer = new MutationObserver(() => {
3738
+ this.createGridTemplateAreas();
3739
+ this.createGridding();
3740
+ });
3741
+ this.observer.observe(this, {
3742
+ childList: true,
3743
+ subtree: true
3744
+ });
3743
3745
  }
3744
3746
  attributeChangedCallback(attrName, oldValue, newValue) {
3745
3747
  if (oldValue !== newValue) {
@@ -3792,6 +3794,9 @@ const _Banner = class _Banner extends VerticallyExtendedElement {
3792
3794
  }
3793
3795
  }
3794
3796
  }
3797
+ disconnectedCallback() {
3798
+ this.observer.disconnect();
3799
+ }
3795
3800
  createGridTemplateAreas() {
3796
3801
  const grid = this.shadowRoot.querySelector(
3797
3802
  ".banner-content"
@@ -11757,24 +11762,53 @@ const _Input = class _Input extends AbstractInputElement {
11757
11762
  }
11758
11763
  connectedCallback() {
11759
11764
  super.connectedCallback();
11765
+ }
11766
+ static get observedAttributes() {
11767
+ return [...super.observedAttributes, "type"];
11768
+ }
11769
+ attributeChangedCallback(attrName, oldValue, newValue) {
11770
+ if (oldValue !== newValue) {
11771
+ super.attributeChangedCallback(attrName, oldValue, newValue);
11772
+ switch (attrName) {
11773
+ case "type":
11774
+ this.updateSearchBehavior();
11775
+ this.$el.setAttribute("type", this.type ?? "text");
11776
+ break;
11777
+ }
11778
+ }
11779
+ }
11780
+ updateSearchBehavior() {
11760
11781
  if (this.$el.type === "search") {
11761
- this.$el.setAttribute("list", "suggestions");
11762
- this.syncDataList();
11782
+ this.enableSearchMode();
11783
+ return;
11784
+ }
11785
+ this.disableSearchMode();
11786
+ }
11787
+ enableSearchMode() {
11788
+ this.$el.setAttribute("list", "suggestions");
11789
+ this.syncDataList();
11790
+ if (!this.observer) {
11763
11791
  this.observer = new MutationObserver(() => {
11764
11792
  this.syncDataList();
11765
11793
  });
11766
- this.observer.observe(this, {
11767
- childList: true,
11768
- subtree: true
11769
- });
11770
11794
  }
11771
- if (this.type === "search") {
11772
- if (navigator.userAgent.includes("Chrome")) {
11773
- this.$el.style.setProperty("--search-icon-focus-width", "2.5rem");
11774
- this.$el.style.setProperty("--search-icon-datalist-width", "1rem");
11775
- }
11795
+ this.observer.observe(this, {
11796
+ childList: true,
11797
+ subtree: true
11798
+ });
11799
+ if (navigator.userAgent.includes("Chrome")) {
11800
+ this.$el.style.setProperty("--search-icon-focus-width", "2.5rem");
11801
+ this.$el.style.setProperty("--search-icon-datalist-width", "1rem");
11776
11802
  }
11777
11803
  }
11804
+ disableSearchMode() {
11805
+ var _a, _b;
11806
+ (_a = this.observer) == null ? void 0 : _a.disconnect();
11807
+ this.$el.removeAttribute("list");
11808
+ (_b = this.$shadowSuggestions) == null ? void 0 : _b.remove();
11809
+ this.$el.style.removeProperty("--search-icon-focus-width");
11810
+ this.$el.style.removeProperty("--search-icon-datalist-width");
11811
+ }
11778
11812
  syncDataList() {
11779
11813
  var _a, _b;
11780
11814
  const newSuggestions = (_a = this.$lightSuggestions) == null ? void 0 : _a.cloneNode(
@@ -11802,13 +11836,26 @@ const _Input = class _Input extends AbstractInputElement {
11802
11836
  return this.querySelector("datalist");
11803
11837
  }
11804
11838
  get $shadowSuggestions() {
11805
- return this.shadowRoot.querySelector("datalist");
11839
+ var _a;
11840
+ return ((_a = this.shadowRoot) == null ? void 0 : _a.querySelector("datalist")) ?? null;
11806
11841
  }
11807
11842
  get $container() {
11808
- return this.shadowRoot.querySelector("div");
11843
+ var _a;
11844
+ return ((_a = this.shadowRoot) == null ? void 0 : _a.querySelector("div")) ?? null;
11845
+ }
11846
+ get type() {
11847
+ return this.getAttribute("type");
11848
+ }
11849
+ set type(value) {
11850
+ if (value) {
11851
+ this.setAttribute("type", value);
11852
+ } else {
11853
+ this.removeAttribute("type");
11854
+ }
11809
11855
  }
11810
11856
  };
11811
11857
  _Input.nativeName = "input";
11858
+ _Input.accessorExclusions = ["type"];
11812
11859
  let Input = _Input;
11813
11860
  if (!customElements.get("px-input")) {
11814
11861
  customElements.define("px-input", Input);
@@ -13374,6 +13421,20 @@ class SelectableBox extends WithExtraAttributes {
13374
13421
  if (!customElements.get("px-selectable-box")) {
13375
13422
  customElements.define("px-selectable-box", SelectableBox);
13376
13423
  }
13424
+ const DEFAULT_IGNORED_TAGS = ["px-a", "px-button"];
13425
+ function shouldIgnoreSelectableBoxClick(event, host, ignoredTags = DEFAULT_IGNORED_TAGS) {
13426
+ const ignored = new Set(ignoredTags);
13427
+ const eventPath = event.composedPath();
13428
+ for (const pathPart of eventPath) {
13429
+ if (pathPart === host) {
13430
+ break;
13431
+ }
13432
+ if (pathPart instanceof Element && ignored.has(pathPart.tagName.toLowerCase())) {
13433
+ return true;
13434
+ }
13435
+ }
13436
+ return false;
13437
+ }
13377
13438
  const styles$f = ':host{display:block;outline:none}:host *{box-sizing:border-box}.selectable-box-checkbox,.selectable-box-radio{box-sizing:border-box;height:100%;cursor:pointer;border-radius:var(--px-radius-main);overflow:hidden;--btn-transition: all .2s ease-in-out 0s;transition:var(--btn-transition);border:var(--px-size-border-m) solid var(--px-color-border-main-default);outline-color:var(--px-color-border-focus-outline-default);outline-width:var(--px-focus-outline-mobile)}.selectable-box-checkbox px-selectable-box,.selectable-box-radio px-selectable-box{height:100%;background-color:var(--px-color-background-container-light-default)}:host([parent-has-anchor-full]) .selectable-box-checkbox,:host([parent-has-anchor-full]) .selectable-box-radio{border-radius:0 0 var(--px-radius-main) var(--px-radius-main)}:host(:not([disabled])):host(:hover) .selectable-box-checkbox,:host(:not([disabled])):host(:hover) .selectable-box-radio{border-color:var(--px-color-border-state-hover-default)}:host(:not([disabled])):host(:hover) .selectable-box-checkbox px-selectable-box,:host(:not([disabled])):host(:hover) .selectable-box-radio px-selectable-box{background-color:var( --px-color-background-state-hover-bordered-default )}:host(:not([disabled])):host(:focus-visible) .selectable-box-checkbox,:host(:not([disabled])):host(:focus-visible) .selectable-box-radio{outline-offset:var(--px-focus-offset-mobile);outline-style:solid}:host([checked]) .selectable-box-checkbox,:host([checked]) .selectable-box-radio{border-color:var(--px-color-border-state-active-default)}:host([disabled]) .selectable-box-checkbox,:host([disabled]) .selectable-box-radio{cursor:default;pointer-events:none;border-color:transparent}:host([disabled]) .selectable-box-checkbox px-selectable-box,:host([disabled]) .selectable-box-radio px-selectable-box{background-color:var(--px-color-background-state-disabled-default)}:host([disabled]) ::slotted([slot="title"]),:host([disabled]) ::slotted([slot="description"]),:host([disabled]) ::slotted([slot="content"]){color:var(--px-color-text-state-disabled-default)}@media only screen and (min-width: 48em){.selectable-box-checkbox,.selectable-box-radio{outline-width:var(--px-focus-outline-tablet)}}@media only screen and (min-width: 64.0625em){.selectable-box-checkbox,.selectable-box-radio{outline-width:var(--px-focus-outline-laptop)}}@media only screen and (min-width: 90.0625em){.selectable-box-checkbox,.selectable-box-radio{outline-width:var(--px-focus-outline-desktop)}}:host([inverted]) .selectable-box-checkbox,:host([inverted]) .selectable-box-radio{border-color:var(--px-color-border-main-inverted);outline-color:var(--px-color-border-focus-outline-inverted)}:host([inverted]) .selectable-box-checkbox px-selectable-box,:host([inverted]) .selectable-box-radio px-selectable-box{background-color:var(--px-color-background-container-light-inverted)}:host([inverted]):host(:not([disabled])):host(:hover) .selectable-box-checkbox,:host([inverted]):host(:not([disabled])):host(:hover) .selectable-box-radio{border-color:var(--px-color-border-state-hover-inverted)}:host([inverted]):host(:not([disabled])):host(:hover) .selectable-box-checkbox px-selectable-box,:host([inverted]):host(:not([disabled])):host(:hover) .selectable-box-radio px-selectable-box{background-color:var( --px-color-background-state-hover-bordered-inverted )}:host([inverted]):host([checked]) .selectable-box-checkbox,:host([inverted]):host([checked]) .selectable-box-radio{border-color:var(--px-color-border-state-active-inverted)}:host([inverted]):host([disabled]) .selectable-box-checkbox,:host([inverted]):host([disabled]) .selectable-box-radio{border-color:transparent}:host([inverted]):host([disabled]) .selectable-box-checkbox px-selectable-box,:host([inverted]):host([disabled]) .selectable-box-radio px-selectable-box{background-color:var(--px-color-background-state-disabled-inverted)}:host([inverted]):host([disabled]) ::slotted([slot="title"]),:host([inverted]):host([disabled]) ::slotted([slot="description"]),:host([inverted]):host([disabled]) ::slotted([slot="content"]){color:var(--px-color-text-state-disabled-inverted)}';
13378
13439
  const styleSheet$g = new CSSStyleSheet();
13379
13440
  styleSheet$g.replaceSync(styles$f);
@@ -13492,6 +13553,9 @@ class SelectableBoxCheckbox extends WithExtraAttributes {
13492
13553
  }
13493
13554
  }
13494
13555
  setClickEvent(event) {
13556
+ if (shouldIgnoreSelectableBoxClick(event, this)) {
13557
+ return;
13558
+ }
13495
13559
  this.checked = !this.checked;
13496
13560
  event.stopPropagation();
13497
13561
  event.preventDefault();
@@ -13765,6 +13829,9 @@ class SelectableBoxRadio extends WithExtraAttributes {
13765
13829
  }
13766
13830
  }
13767
13831
  setClickEvent(event) {
13832
+ if (shouldIgnoreSelectableBoxClick(event, this)) {
13833
+ return;
13834
+ }
13768
13835
  if (!this.checked) {
13769
13836
  this.checked = true;
13770
13837
  }