@proximus/lavender-autocomplete 1.4.21-alpha.2 → 1.4.21-alpha.4

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/dist/index.es.js CHANGED
@@ -72,13 +72,13 @@ var E = "bottom-left", fe = class extends n {
72
72
  <style>${this.css}</style>
73
73
  <slot name="trigger"></slot>
74
74
  <slot name="popover"></slot>`, this.isAboutToClose = !1, this.triggerPopoverDisplay = () => {
75
- this.isAboutToClose || (this.$popoverElement.togglePopover({ source: this.$trigger }), this.manualToggle || (this.$trigger.ariaExpanded = "true"));
75
+ this.isAboutToClose || (this.$popoverElement.togglePopover({ source: this.$trigger }), this.manualToggle || this.setTriggerAriaAttribute("aria-expanded", "true"));
76
76
  }, this.showPopover = () => {
77
77
  this.isAboutToClose || this.$popoverElement.showPopover();
78
78
  }, this.hidePopover = () => {
79
79
  this.$popoverElement.hidePopover();
80
80
  }, this.#t = () => {
81
- this.$popoverElement.matches(":popover-open") && (this.isAboutToClose = !0, this.manualToggle || (this.$trigger.ariaExpanded = "false"));
81
+ this.$popoverElement.matches(":popover-open") && (this.isAboutToClose = !0, this.manualToggle || this.setTriggerAriaAttribute("aria-expanded", "false"));
82
82
  }, this.#n = () => {
83
83
  this.$popoverElement.matches(":popover-open") || setTimeout(() => {
84
84
  this.isAboutToClose = !1;
@@ -105,7 +105,7 @@ var E = "bottom-left", fe = class extends n {
105
105
  w(this.$trigger, this.$popoverElement, this.anchorAlignment, getComputedStyle(this), this.usePolyfill);
106
106
  break;
107
107
  case "manual-toggle":
108
- n != null && this.$trigger?.removeAttribute("aria-expanded");
108
+ n != null && this.setTriggerAriaAttribute("aria-expanded", null);
109
109
  break;
110
110
  case "popover-height":
111
111
  case "popover-max-height":
@@ -117,6 +117,10 @@ var E = "bottom-left", fe = class extends n {
117
117
  default: super.attributeChangedCallback(e, t, n);
118
118
  }
119
119
  }
120
+ setTriggerAriaAttribute(e, n) {
121
+ let r = this.$trigger, i = r instanceof t ? `px-${e}` : e;
122
+ n === null ? r?.removeAttribute(i) : r?.setAttribute(i, n);
123
+ }
120
124
  updatePopoverMaxHeight(e) {
121
125
  e ? this.$popoverElement.style.setProperty("--px-popover-max-height", e) : this.$popoverElement.style.removeProperty("--px-popover-max-height");
122
126
  }
@@ -127,7 +131,7 @@ var E = "bottom-left", fe = class extends n {
127
131
  if (this.$trigger) {
128
132
  this.$trigger.setAttribute("popovertarget", this.popoverId);
129
133
  let e = this.getAttribute("id");
130
- e && this.$trigger.setAttribute("aria-controls", e), this.hasAttribute("manual-toggle") || this.$trigger.setAttribute("aria-expanded", "false"), this.$popoverElement.setAttribute("id", this.popoverId), this.$popoverElement.setAttribute("popover", ""), this.$style.innerHTML = this.css, this.#e(), this.#r();
134
+ e && this.setTriggerAriaAttribute("aria-controls", e), this.hasAttribute("manual-toggle") || this.setTriggerAriaAttribute("aria-expanded", "false"), this.$popoverElement.setAttribute("id", this.popoverId), this.$popoverElement.setAttribute("popover", ""), this.$style.innerHTML = this.css, this.#e(), this.#r();
131
135
  }
132
136
  }
133
137
  get popoverId() {
@@ -226,7 +230,10 @@ var O = /* @__PURE__ */ function(e) {
226
230
  ];
227
231
  }
228
232
  attributeChangedCallback(e, t, n) {
229
- e === "aria-describedby" && t !== n ? ce(this, this.$el, !1) : e === "state" && t !== n ? this.stateChangeCallback(t, n) : (e === "extended" || e === "extended--mobile" || e === "extended--tablet" || e === "extended--laptop" || e === "extended--desktop") && t !== n ? this.$el.classList.toggle(e) : super.attributeChangedCallback(e, t, n);
233
+ e === "aria-describedby" && t !== n ? (ce(this, this.$el, !1), this._syncPrefixedAccessibilityAttributes()) : e === "state" && t !== n ? this.stateChangeCallback(t, n) : (e === "extended" || e === "extended--mobile" || e === "extended--tablet" || e === "extended--laptop" || e === "extended--desktop") && t !== n ? this.$el.classList.toggle(e) : super.attributeChangedCallback(e, t, n);
234
+ }
235
+ _forwardPrefixedAccessibilityAttribute(e, t) {
236
+ super._forwardPrefixedAccessibilityAttribute(e, t), e === "aria-describedby" && (this.setupAriaDescribedBy(this.$slotHelper, this.$helperSlot, "helper"), this.setupAriaDescribedBy(this.$slotStatusText, this.$statusTextSlot, "status-text"));
230
237
  }
231
238
  stateChangeCallback(e, t) {
232
239
  this.$el.classList.remove(e), this.$el.classList.toggle(t), t === "error" ? (this.$statusTextSlot.classList.toggle("error"), this.$el.setAttribute("aria-invalid", "true"), this.internals && (this.internals.ariaInvalid = "true"), this.$statusTextSlot.classList.remove("success")) : t === "success" ? (this.$statusTextSlot.classList.remove("error"), this.$statusTextSlot.classList.toggle("success")) : (this.$el.removeAttribute("aria-invalid"), this.internals && (this.internals.ariaInvalid = null), this.$statusTextSlot.classList.remove("error", "success"), this.$labelSlot.classList.remove("error", "success"), this.$el.style.backgroundImage = ""), this.setupAriaDescribedBy(this.$slotHelper, this.$helperSlot, "helper"), this.setupAriaDescribedBy(this.$slotStatusText, this.$statusTextSlot, "status-text");
@@ -257,7 +264,7 @@ var O = /* @__PURE__ */ function(e) {
257
264
  setupAriaDescribedBy(e, t, n) {
258
265
  if (!this.$el?.hasAttribute("id")) return;
259
266
  let r = `${this.$el.id}-${n}`, i = (this.$el.getAttribute("aria-describedby") ?? "").split(" ").filter((e) => e && e !== r);
260
- e.length > 0 && (t.setAttribute("id", r), i.push(r)), i.sort((e, t) => this.ariaDescribedByRank(e) - this.ariaDescribedByRank(t)), i.length > 0 ? this.$el.setAttribute("aria-describedby", i.join(" ")) : this.$el.removeAttribute("aria-describedby");
267
+ e.length > 0 && (t.setAttribute("id", r), i.push(r)), i.sort((e, t) => this.ariaDescribedByRank(e) - this.ariaDescribedByRank(t)), i.length > 0 ? this.$el.setAttribute("aria-describedby", i.join(" ")) : this.getAttribute("px-aria-describedby") === "" ? this.$el.setAttribute("aria-describedby", "") : this.$el.removeAttribute("aria-describedby");
261
268
  }
262
269
  ariaDescribedByRank(e) {
263
270
  return e.endsWith("-status-text") ? 0 : e.endsWith("-helper") ? 1 : 2;
@@ -610,6 +617,9 @@ var j = class e extends k {
610
617
  }
611
618
  }
612
619
  }
620
+ _forwardPrefixedAccessibilityAttribute(e, t) {
621
+ super._forwardPrefixedAccessibilityAttribute(e, t), e === "aria-describedby" && this.$el.hasAttribute("id") && this.syncGroupAria();
622
+ }
613
623
  stateChangeCallback(e, t) {
614
624
  this.$inputs.forEach((n) => {
615
625
  n.classList.remove(e), n.classList.toggle(t), t === O.ERROR ? n.setAttribute("aria-invalid", "true") : n.removeAttribute("aria-invalid");
@@ -631,7 +641,7 @@ var j = class e extends k {
631
641
  let t = this.getValue(), n = parseInt(this.getAttribute("size") || "6", 10);
632
642
  if (e.innerHTML = "", e.style.setProperty("--code-cell-count", `${n}`), this.isCollapsed) e.appendChild(this.createSingleInput(n));
633
643
  else for (let t = 0; t < n; t++) e.appendChild(this.createCell(t, n));
634
- this.setValue(t || this.getAttribute("value") || ""), this.syncCellAttributes(), this.$inputs.forEach((e) => e.addEventListener("change", this.onNativeChange)), this.restoreLabelAssociation();
644
+ this.setValue(t || this.getAttribute("value") || ""), this.syncCellAttributes(), this._syncPrefixedAccessibilityAttributes(), this.$inputs.forEach((e) => e.addEventListener("change", this.onNativeChange)), this.restoreLabelAssociation();
635
645
  }
636
646
  syncCellAttributes() {
637
647
  for (let t of Object.keys(e.nativeAttributes)) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "@proximus/lavender-autocomplete",
4
- "version": "1.4.21-alpha.2",
4
+ "version": "1.4.21-alpha.4",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-autocomplete",
3
- "version": "1.4.21-alpha.2",
3
+ "version": "1.4.21-alpha.4",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",