@editora/ui-core 0.1.20 → 0.1.21

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.
@@ -1,9 +1,9 @@
1
- import { E as f } from "./ElementBase-YlTLMsGk.mjs";
2
- const v = `
1
+ import { E as v } from "./ElementBase-YlTLMsGk.mjs";
2
+ const _ = `
3
3
  <svg viewBox="0 0 20 20" aria-hidden="true" focusable="false">
4
4
  <path d="m6 6 8 8M14 6l-8 8" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
5
5
  </svg>
6
- `, _ = `
6
+ `, y = `
7
7
  :host {
8
8
  --ui-textarea-bg: var(--ui-color-surface, #ffffff);
9
9
  --ui-textarea-text: var(--ui-color-text, #0f172a);
@@ -310,14 +310,20 @@ const v = `
310
310
  }
311
311
  }
312
312
  `;
313
- function d(l) {
314
- return l.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
313
+ function x(r) {
314
+ return r.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
315
315
  }
316
- function x(l, t) {
317
- const e = Number(l);
316
+ function b(r, t) {
317
+ const e = Number(r);
318
318
  return Number.isFinite(e) ? e : t;
319
319
  }
320
- class y extends f {
320
+ const A = 2147483647;
321
+ function c(r) {
322
+ if (!r) return null;
323
+ const t = Number(r);
324
+ return !Number.isFinite(t) || t < 0 || t > A ? null : Math.trunc(t);
325
+ }
326
+ class z extends v {
321
327
  constructor() {
322
328
  super(), this._uid = `ui-textarea-${Math.random().toString(36).slice(2, 9)}`, this._textarea = null, this._clearBtn = null, this._countEl = null, this._debounceTimer = null, this._formUnregister = null, this._onInput = this._onInput.bind(this), this._onChange = this._onChange.bind(this), this._onClear = this._onClear.bind(this);
323
329
  }
@@ -425,14 +431,14 @@ class y extends f {
425
431
  }
426
432
  _syncControlAttrs() {
427
433
  if (!this._textarea) return;
428
- const t = this.getAttribute("placeholder") || "", e = this.getAttribute("maxlength"), i = this.getAttribute("minlength"), r = x(this.getAttribute("rows"), 4), a = this.hasAttribute("disabled"), u = this.hasAttribute("readonly"), s = this.hasAttribute("required"), c = this.getAttribute("name") || "", h = this.getAttribute("resize") || "vertical", p = this.getAttribute("validation"), b = this.getAttribute("color"), o = this.getAttribute("radius");
429
- this._textarea.placeholder = t, this._textarea.disabled = a, this._textarea.readOnly = u, this._textarea.required = s, this._textarea.rows = Math.max(1, r), this._textarea.name = c, this._textarea.style.resize = h, e && Number.isFinite(Number(e)) ? this._textarea.maxLength = Number(e) : this._textarea.removeAttribute("maxlength"), i && Number.isFinite(Number(i)) ? this._textarea.minLength = Number(i) : this._textarea.removeAttribute("minlength"), p === "error" ? this._textarea.setAttribute("aria-invalid", "true") : this._textarea.removeAttribute("aria-invalid"), b ? this.style.setProperty("--ui-textarea-accent", b) : this.style.removeProperty("--ui-textarea-accent"), o && o !== "none" && o !== "large" && o !== "full" ? this.style.setProperty("--ui-textarea-radius", o) : this.style.removeProperty("--ui-textarea-radius");
430
- const n = [], g = !!(this.getAttribute("description") || this.querySelector('[slot="description"]')), m = !!(this.getAttribute("data-error") || this.querySelector('[slot="error"]'));
431
- g && n.push(`${this._uid}-description`), m && n.push(`${this._uid}-error`), (this.hasAttribute("show-count") || this.hasAttribute("maxlength")) && n.push(`${this._uid}-count`), !!(this.getAttribute("label") || this.querySelector('[slot="label"]')) ? this._textarea.setAttribute("aria-labelledby", `${this._uid}-label`) : this._textarea.removeAttribute("aria-labelledby"), n.length ? this._textarea.setAttribute("aria-describedby", n.join(" ")) : this._textarea.removeAttribute("aria-describedby");
434
+ const t = this.getAttribute("placeholder") || "", e = c(this.getAttribute("maxlength")), i = c(this.getAttribute("minlength")), s = b(this.getAttribute("rows"), 4), a = this.hasAttribute("disabled"), u = this.hasAttribute("readonly"), o = this.hasAttribute("required"), d = this.getAttribute("name") || "", h = this.getAttribute("resize") || "vertical", g = this.getAttribute("validation"), p = this.getAttribute("color"), n = this.getAttribute("radius");
435
+ this._textarea.placeholder = t, this._textarea.disabled = a, this._textarea.readOnly = u, this._textarea.required = o, this._textarea.rows = Math.max(1, s), this._textarea.name = d, this._textarea.style.resize = h, e !== null ? this._textarea.maxLength = e : this._textarea.removeAttribute("maxlength"), i !== null ? this._textarea.minLength = i : this._textarea.removeAttribute("minlength"), g === "error" ? this._textarea.setAttribute("aria-invalid", "true") : this._textarea.removeAttribute("aria-invalid"), p ? this.style.setProperty("--ui-textarea-accent", p) : this.style.removeProperty("--ui-textarea-accent"), n && n !== "none" && n !== "large" && n !== "full" ? this.style.setProperty("--ui-textarea-radius", n) : this.style.removeProperty("--ui-textarea-radius");
436
+ const l = [], m = !!(this.getAttribute("description") || this.querySelector('[slot="description"]')), f = !!(this.getAttribute("data-error") || this.querySelector('[slot="error"]'));
437
+ m && l.push(`${this._uid}-description`), f && l.push(`${this._uid}-error`), (this.hasAttribute("show-count") || c(this.getAttribute("maxlength")) !== null) && l.push(`${this._uid}-count`), !!(this.getAttribute("label") || this.querySelector('[slot="label"]')) ? this._textarea.setAttribute("aria-labelledby", `${this._uid}-label`) : this._textarea.removeAttribute("aria-labelledby"), l.length ? this._textarea.setAttribute("aria-describedby", l.join(" ")) : this._textarea.removeAttribute("aria-describedby");
432
438
  }
433
439
  _syncDynamicUi() {
434
- const t = this._textarea?.value || this.getAttribute("value") || "", e = this.getAttribute("maxlength"), i = this.hasAttribute("clearable");
435
- this._clearBtn && (i && t && !this.hasAttribute("disabled") && !this.hasAttribute("readonly") ? this._clearBtn.removeAttribute("hidden") : this._clearBtn.setAttribute("hidden", "")), this._countEl && (this.hasAttribute("show-count") || !!e ? (this._countEl.removeAttribute("hidden"), e && Number.isFinite(Number(e)) ? this._countEl.textContent = `${t.length} / ${Number(e)}` : this._countEl.textContent = `${t.length}`) : this._countEl.setAttribute("hidden", ""));
440
+ const t = this._textarea?.value || this.getAttribute("value") || "", e = c(this.getAttribute("maxlength")), i = this.hasAttribute("clearable");
441
+ this._clearBtn && (i && t && !this.hasAttribute("disabled") && !this.hasAttribute("readonly") ? this._clearBtn.removeAttribute("hidden") : this._clearBtn.setAttribute("hidden", "")), this._countEl && (this.hasAttribute("show-count") || e !== null ? (this._countEl.removeAttribute("hidden"), e !== null ? this._countEl.textContent = `${t.length} / ${e}` : this._countEl.textContent = `${t.length}`) : this._countEl.setAttribute("hidden", ""));
436
442
  }
437
443
  _applyAutosize() {
438
444
  if (!this._textarea) return;
@@ -441,9 +447,9 @@ class y extends f {
441
447
  return;
442
448
  }
443
449
  this._textarea.style.height = "auto";
444
- const t = this._textarea.scrollHeight, e = x(this.getAttribute("max-rows"), 0);
450
+ const t = this._textarea.scrollHeight, e = b(this.getAttribute("max-rows"), 0);
445
451
  if (e > 0) {
446
- const i = getComputedStyle(this._textarea), r = parseFloat(i.lineHeight || "20") || 20, a = parseFloat(i.borderTopWidth || "0") || 0, u = parseFloat(i.borderBottomWidth || "0") || 0, s = parseFloat(i.paddingTop || "0") || 0, c = parseFloat(i.paddingBottom || "0") || 0, h = r * e + a + u + s + c;
452
+ const i = getComputedStyle(this._textarea), s = parseFloat(i.lineHeight || "20") || 20, a = parseFloat(i.borderTopWidth || "0") || 0, u = parseFloat(i.borderBottomWidth || "0") || 0, o = parseFloat(i.paddingTop || "0") || 0, d = parseFloat(i.paddingBottom || "0") || 0, h = s * e + a + u + o + d;
447
453
  this._textarea.style.height = `${Math.min(t, h)}px`, this._textarea.style.overflowY = t > h ? "auto" : "hidden";
448
454
  return;
449
455
  }
@@ -465,7 +471,7 @@ class y extends f {
465
471
  _onInput(t) {
466
472
  const e = t.target.value;
467
473
  this.getAttribute("value") !== e && this.setAttribute("value", e), this._syncDynamicUi(), this._applyAutosize(), this._emit("input", e);
468
- const i = x(this.getAttribute("debounce"), 0);
474
+ const i = b(this.getAttribute("debounce"), 0);
469
475
  i > 0 ? (this._debounceTimer && clearTimeout(this._debounceTimer), this._debounceTimer = setTimeout(() => {
470
476
  this._emit("debounced-input", e), this._debounceTimer = null;
471
477
  }, i)) : this._emit("debounced-input", e);
@@ -478,22 +484,22 @@ class y extends f {
478
484
  t.preventDefault(), !(this.hasAttribute("disabled") || this.hasAttribute("readonly")) && (this.value = "", this._textarea && (this._textarea.value = "", this._textarea.focus()), this._syncDynamicUi(), this._applyAutosize(), this._emit("input", ""), this._emit("change", ""), this.dispatchEvent(new CustomEvent("clear", { bubbles: !0, composed: !0 })));
479
485
  }
480
486
  render() {
481
- const t = this.getAttribute("value") || "", e = this.getAttribute("label") || "", i = this.getAttribute("description") || "", r = this.getAttribute("data-error") || "", a = !!(e || i || this.querySelector('[slot="label"]') || this.querySelector('[slot="description"]')), s = this.hasAttribute("clearable") && !!t && !this.hasAttribute("disabled") && !this.hasAttribute("readonly");
487
+ const t = this.getAttribute("value") || "", e = this.getAttribute("label") || "", i = this.getAttribute("description") || "", s = this.getAttribute("data-error") || "", a = !!(e || i || this.querySelector('[slot="label"]') || this.querySelector('[slot="description"]')), o = this.hasAttribute("clearable") && !!t && !this.hasAttribute("disabled") && !this.hasAttribute("readonly");
482
488
  this.setContent(`
483
- <style>${_}</style>
489
+ <style>${y}</style>
484
490
  <div class="shell" part="shell">
485
491
  <div class="meta" part="meta" ${a ? "" : "hidden"}>
486
- <label id="${this._uid}-label" class="label" part="label"><slot name="label">${d(e)}</slot></label>
487
- <div id="${this._uid}-description" class="description" part="description"><slot name="description">${d(i)}</slot></div>
492
+ <label id="${this._uid}-label" class="label" part="label"><slot name="label">${x(e)}</slot></label>
493
+ <div id="${this._uid}-description" class="description" part="description"><slot name="description">${x(i)}</slot></div>
488
494
  </div>
489
495
 
490
496
  <div class="field" part="field">
491
497
  <textarea part="textarea"></textarea>
492
- <button type="button" part="clear" class="clear-btn" aria-label="Clear text" ${s ? "" : "hidden"}>${v}</button>
498
+ <button type="button" part="clear" class="clear-btn" aria-label="Clear text" ${o ? "" : "hidden"}>${_}</button>
493
499
  </div>
494
500
 
495
501
  <div class="footer" part="footer">
496
- <div id="${this._uid}-error" class="error" part="error"><slot name="error">${d(r)}</slot></div>
502
+ <div id="${this._uid}-error" class="error" part="error"><slot name="error">${x(s)}</slot></div>
497
503
  <div id="${this._uid}-count" class="count" part="count" hidden></div>
498
504
  </div>
499
505
  </div>
@@ -505,7 +511,7 @@ class y extends f {
505
511
  return t === "label" || t === "description" || t === "data-error";
506
512
  }
507
513
  }
508
- typeof customElements < "u" && !customElements.get("ui-textarea") && customElements.define("ui-textarea", y);
514
+ typeof customElements < "u" && !customElements.get("ui-textarea") && customElements.define("ui-textarea", z);
509
515
  export {
510
- y as UITextarea
516
+ z as UITextarea
511
517
  };
@@ -656,79 +656,79 @@
656
656
  min-inline-size: 0;
657
657
  }
658
658
  }
659
- `;function l(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function x(n){if(!n)return[];try{const e=JSON.parse(n);if(!Array.isArray(e))return[];const t=[];return e.forEach(r=>{if(!r||typeof r!="object")return;const a={value:String(r.value??""),label:String(r.label??r.value??""),disabled:!!r.disabled};r.description&&(a.description=String(r.description)),a.value&&t.push(a)}),t}catch{return[]}}function z(n){if(!n)return[];try{const e=JSON.parse(n);return Array.isArray(e)?e.map(t=>String(t)):[]}catch{return[]}}function y(n,e){return new Set(Array.from(n).filter(t=>e.has(t)))}function R(n){return n==="tick"||n==="none"?n:"checkbox"}function p(n,e){return n==null?e:n===""||n==="true"||n==="1"||n==="yes"?!0:n==="false"||n==="0"||n==="no"?!1:e}function _(n){return`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" focusable="false" aria-hidden="true"><path d="${n==="right"?"M9 6l6 6-6 6":"M15 6l-6 6 6 6"}"/></svg>`}class k extends q.ElementBase{constructor(){super(...arguments),this._options=[],this._value=[],this._selectedAvailable=new Set,this._selectedChosen=new Set,this._formUnregister=null,this._suppressValueAttr=!1,this._delegatedListenersAttached=!1,this._handleRootClick=e=>{const t=e.target;if(!t)return;const r=t.closest(".move-btn");if(r&&this.root.contains(r)){this._move(r.getAttribute("data-action"));return}const a=t.closest(".item");a&&this.root.contains(a)&&this._toggleItem(a)},this._handleRootKeyDown=e=>{const t=e.target;if(!t)return;const r=t.closest(".item");r&&this.root.contains(r)&&this._onItemKeyDown(e,r)}}static get observedAttributes(){return["options","value","label","description","error","name","disabled","variant","tone","size","radius","elevation","available-label","selected-label","available-empty-label","selected-empty-label","selection-indicator","add-action-label","remove-action-label","show-action-labels","show-action-counts","show-panel-counts"]}get value(){return[...this._value]}set value(e){this._applyValue(e,"api")}connectedCallback(){super.connectedCallback(),this._attachDelegatedListeners(),this._registerWithForm()}disconnectedCallback(){this._formUnregister&&this._formUnregister(),this._detachDelegatedListeners(),super.disconnectedCallback()}attributeChangedCallback(e,t,r){t!==r&&(e==="options"&&(this._options=x(r)),e==="value"&&!this._suppressValueAttr&&(this._value=z(r)),e==="name"&&this.isConnected&&this._registerWithForm(),e==="disabled"&&(this._selectedAvailable.clear(),this._selectedChosen.clear()),this.isConnected&&this.requestRender())}render(){this._options.length||(this._options=x(this.getAttribute("options"))),!this._value.length&&this.getAttribute("value")&&(this._value=z(this.getAttribute("value")));const e=new Set(this._value),t=this._options.filter(i=>!e.has(i.value)),r=this._options.filter(i=>e.has(i.value)),a=new Set(t.map(i=>i.value)),o=new Set(r.map(i=>i.value));this._selectedAvailable=y(this._selectedAvailable,a),this._selectedChosen=y(this._selectedChosen,o);const s=this.getAttribute("label")||"",c=this.getAttribute("description")||"",u=this.getAttribute("error")||"",w=this.getAttribute("available-label")||"Available",A=this.getAttribute("selected-label")||"Selected",$=this.getAttribute("available-empty-label")||"No items available to add.",S=this.getAttribute("selected-empty-label")||"No items selected yet.",C=R(this.getAttribute("selection-indicator")),L=this.getAttribute("add-action-label")||"Add selected",E=this.getAttribute("remove-action-label")||"Remove selected",d=p(this.getAttribute("show-action-labels"),!0),f=p(this.getAttribute("show-action-counts"),!0),b=p(this.getAttribute("show-panel-counts"),!0),h=this.getAttribute("radius"),I=h?` style="--ui-transfer-panel-radius:${l(h)};"`:"",m=()=>C==="none"?"":'<span class="indicator" part="indicator" aria-hidden="true"><span class="indicator-box"><span class="indicator-mark">✓</span></span></span>',g=i=>d?`<span class="move-btn-text">${l(i)}</span>`:"",v=i=>f?`<span class="move-btn-count">${i}</span>`:"",V=t.length?t.map(i=>`<div
659
+ `;function s(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function k(n){if(!n)return[];try{const e=JSON.parse(n);if(!Array.isArray(e))return[];const t=[];return e.forEach(r=>{if(!r||typeof r!="object")return;const a={value:String(r.value??""),label:String(r.label??r.value??""),disabled:!!r.disabled};r.description&&(a.description=String(r.description)),a.value&&t.push(a)}),t}catch{return[]}}function w(n){if(!n)return[];try{const e=JSON.parse(n);return Array.isArray(e)?e.map(t=>String(t)):[]}catch{return[]}}function A(n,e){return new Set(Array.from(n).filter(t=>e.has(t)))}function R(n){return n==="tick"||n==="none"?n:"checkbox"}function p(n,e){return n==null?e:n===""||n==="true"||n==="1"||n==="yes"?!0:n==="false"||n==="0"||n==="no"?!1:e}function $(n){return`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" focusable="false" aria-hidden="true"><path d="${n==="right"?"M9 6l6 6-6 6":"M15 6l-6 6 6 6"}"/></svg>`}class S extends q.ElementBase{constructor(){super(...arguments),this._options=[],this._value=[],this._selectedAvailable=new Set,this._selectedChosen=new Set,this._formUnregister=null,this._suppressValueAttr=!1,this._delegatedListenersAttached=!1,this._handleRootClick=e=>{const t=e.target;if(!t)return;const r=t.closest(".move-btn");if(r&&this.root.contains(r)){this._move(r.getAttribute("data-action"));return}const a=t.closest(".item");a&&this.root.contains(a)&&this._toggleItem(a)},this._handleRootKeyDown=e=>{const t=e.target;if(!t)return;const r=t.closest(".item");r&&this.root.contains(r)&&this._onItemKeyDown(e,r)}}static get observedAttributes(){return["options","value","label","description","error","name","disabled","variant","tone","size","radius","elevation","available-label","selected-label","available-empty-label","selected-empty-label","selection-indicator","add-action-label","remove-action-label","show-action-labels","show-action-counts","show-panel-counts"]}get value(){return[...this._value]}set value(e){this._applyValue(e,"api")}connectedCallback(){super.connectedCallback(),this._attachDelegatedListeners(),this._registerWithForm()}disconnectedCallback(){this._formUnregister&&this._formUnregister(),this._detachDelegatedListeners(),super.disconnectedCallback()}attributeChangedCallback(e,t,r){t!==r&&(e==="options"&&(this._options=k(r)),e==="value"&&!this._suppressValueAttr&&(this._value=w(r)),e==="name"&&this.isConnected&&this._registerWithForm(),e==="disabled"&&(this._selectedAvailable.clear(),this._selectedChosen.clear()),this.isConnected&&this.requestRender())}render(){this._options.length||(this._options=k(this.getAttribute("options"))),!this._value.length&&this.getAttribute("value")&&(this._value=w(this.getAttribute("value")));const e=new Set(this._value),t=this._options.filter(i=>!e.has(i.value)),r=this._options.filter(i=>e.has(i.value)),a=new Set(t.map(i=>i.value)),l=new Set(r.map(i=>i.value));this._selectedAvailable=A(this._selectedAvailable,a),this._selectedChosen=A(this._selectedChosen,l);const o=this.getAttribute("label")||"",c=this.getAttribute("description")||"",d=this.getAttribute("error")||"",b=this.getAttribute("available-label")||"Available",h=this.getAttribute("selected-label")||"Selected",C=this.getAttribute("available-empty-label")||"No items available to add.",L=this.getAttribute("selected-empty-label")||"No items selected yet.",E=R(this.getAttribute("selection-indicator")),m=this.getAttribute("add-action-label")||"Add selected",g=this.getAttribute("remove-action-label")||"Remove selected",u=p(this.getAttribute("show-action-labels"),!0),f=p(this.getAttribute("show-action-counts"),!0),v=p(this.getAttribute("show-panel-counts"),!0),x=this.getAttribute("radius"),I=x?` style="--ui-transfer-panel-radius:${s(x)};"`:"",z=()=>E==="none"?"":'<span class="indicator" part="indicator" aria-hidden="true"><span class="indicator-box"><span class="indicator-mark">✓</span></span></span>',y=i=>u?`<span class="move-btn-text">${s(i)}</span>`:"",_=i=>f?`<span class="move-btn-count">${i}</span>`:"",V=t.length?t.map(i=>`<div
660
660
  class="item"
661
661
  part="item available-item"
662
662
  role="option"
663
663
  data-side="available"
664
- data-value="${l(i.value)}"
664
+ data-value="${s(i.value)}"
665
665
  data-selected="${this._selectedAvailable.has(i.value)}"
666
666
  aria-selected="${this._selectedAvailable.has(i.value)?"true":"false"}"
667
667
  aria-disabled="${i.disabled?"true":"false"}"
668
668
  tabindex="${i.disabled?"-1":"0"}"
669
669
  >
670
- ${m()}
670
+ ${z()}
671
671
  <div class="item-copy">
672
- <span class="item-title">${l(i.label)}</span>
673
- ${i.description?`<span class="item-description">${l(i.description)}</span>`:""}
672
+ <span class="item-title">${s(i.label)}</span>
673
+ ${i.description?`<span class="item-description">${s(i.description)}</span>`:""}
674
674
  </div>
675
- </div>`).join(""):`<div class="empty" part="empty">${l($)}</div>`,D=r.length?r.map(i=>`<div
675
+ </div>`).join(""):`<div class="empty" part="empty">${s(C)}</div>`,D=r.length?r.map(i=>`<div
676
676
  class="item"
677
677
  part="item selected-item"
678
678
  role="option"
679
679
  data-side="chosen"
680
- data-value="${l(i.value)}"
680
+ data-value="${s(i.value)}"
681
681
  data-selected="${this._selectedChosen.has(i.value)}"
682
682
  aria-selected="${this._selectedChosen.has(i.value)?"true":"false"}"
683
683
  aria-disabled="${i.disabled?"true":"false"}"
684
684
  tabindex="${i.disabled?"-1":"0"}"
685
685
  >
686
- ${m()}
686
+ ${z()}
687
687
  <div class="item-copy">
688
- <span class="item-title">${l(i.label)}</span>
689
- ${i.description?`<span class="item-description">${l(i.description)}</span>`:""}
688
+ <span class="item-title">${s(i.label)}</span>
689
+ ${i.description?`<span class="item-description">${s(i.description)}</span>`:""}
690
690
  </div>
691
- </div>`).join(""):`<div class="empty" part="empty">${l(S)}</div>`;this.setContent(`
691
+ </div>`).join(""):`<div class="empty" part="empty">${s(L)}</div>`;this.setContent(`
692
692
  <style>${U}</style>
693
693
  <div class="root"${I} part="root">
694
- ${s?`<p class="label" part="label">${l(s)}</p>`:""}
695
- ${c?`<p class="description" part="description">${l(c)}</p>`:""}
694
+ ${o?`<p class="label" part="label">${s(o)}</p>`:""}
695
+ ${c?`<p class="description" part="description">${s(c)}</p>`:""}
696
696
  <div class="shell" part="shell">
697
697
  <section class="panel" part="panel panel-available">
698
698
  <div class="panel-header" part="panel-header">
699
699
  <div class="panel-heading">
700
- <div class="panel-title">${l(w)}</div>
701
- ${b?`<span class="panel-count" part="count">${t.length}</span>`:""}
700
+ <div class="panel-title">${s(b)}</div>
701
+ ${v?`<span class="panel-count" part="count">${t.length}</span>`:""}
702
702
  </div>
703
703
  <div class="panel-help">Choose entries to move into the selected list.</div>
704
704
  </div>
705
- <div class="list" part="list available-list" data-list="available" role="listbox" aria-multiselectable="true">${V}</div>
705
+ <div class="list" part="list available-list" data-list="available" role="listbox" aria-multiselectable="true" aria-label="${s(b)}">${V}</div>
706
706
  <div class="summary" part="summary">${t.length} available</div>
707
707
  </section>
708
708
  <div class="actions" part="actions">
709
- <button class="move-btn" part="action-button action-add" data-compact="${!d&&!f}" data-action="add" type="button"${this._selectedAvailable.size?"":" disabled"}>
710
- <span class="move-btn-icon" aria-hidden="true">${_("right")}</span>
711
- ${g(L)}
712
- ${v(this._selectedAvailable.size||0)}
709
+ <button class="move-btn" part="action-button action-add" data-compact="${!u&&!f}" data-action="add" type="button"${u?"":` aria-label="${s(m)}"`}${this._selectedAvailable.size?"":" disabled"}>
710
+ <span class="move-btn-icon" aria-hidden="true">${$("right")}</span>
711
+ ${y(m)}
712
+ ${_(this._selectedAvailable.size||0)}
713
713
  </button>
714
- <button class="move-btn" part="action-button action-remove" data-compact="${!d&&!f}" data-action="remove" type="button"${this._selectedChosen.size?"":" disabled"}>
715
- <span class="move-btn-icon" aria-hidden="true">${_("left")}</span>
716
- ${g(E)}
717
- ${v(this._selectedChosen.size||0)}
714
+ <button class="move-btn" part="action-button action-remove" data-compact="${!u&&!f}" data-action="remove" type="button"${u?"":` aria-label="${s(g)}"`}${this._selectedChosen.size?"":" disabled"}>
715
+ <span class="move-btn-icon" aria-hidden="true">${$("left")}</span>
716
+ ${y(g)}
717
+ ${_(this._selectedChosen.size||0)}
718
718
  </button>
719
719
  </div>
720
720
  <section class="panel" part="panel panel-selected">
721
721
  <div class="panel-header" part="panel-header">
722
722
  <div class="panel-heading">
723
- <div class="panel-title">${l(A)}</div>
724
- ${b?`<span class="panel-count" part="count">${r.length}</span>`:""}
723
+ <div class="panel-title">${s(h)}</div>
724
+ ${v?`<span class="panel-count" part="count">${r.length}</span>`:""}
725
725
  </div>
726
726
  <div class="panel-help">Use the remove action to send items back.</div>
727
727
  </div>
728
- <div class="list" part="list selected-list" data-list="chosen" role="listbox" aria-multiselectable="true">${D}</div>
728
+ <div class="list" part="list selected-list" data-list="chosen" role="listbox" aria-multiselectable="true" aria-label="${s(h)}">${D}</div>
729
729
  <div class="summary" part="summary">${r.length} selected</div>
730
730
  </section>
731
731
  </div>
732
- ${u?`<p class="error" part="error">${l(u)}</p>`:""}
732
+ ${d?`<p class="error" part="error">${s(d)}</p>`:""}
733
733
  </div>
734
- `)}_toggleItem(e){if(this.hasAttribute("disabled"))return;const t=e.getAttribute("data-side"),r=e.getAttribute("data-value")||"";if(!r)return;const a=t==="chosen"?this._selectedChosen:this._selectedAvailable;a.has(r)?a.delete(r):a.add(r),e.setAttribute("data-selected",a.has(r)?"true":"false"),e.setAttribute("aria-selected",a.has(r)?"true":"false"),this._syncActionButtons()}_onItemKeyDown(e,t){const r=t.getAttribute("data-side");if(!r)return;if(e.key==="Enter"||e.key===" "){e.preventDefault(),this._toggleItem(t);return}if(!["ArrowDown","ArrowUp","Home","End"].includes(e.key))return;e.preventDefault();const a=this.root.querySelector(`[data-list="${r}"]`),o=Array.from(a?.querySelectorAll('.item[tabindex="0"]')||[]);if(!o.length)return;const s=o.indexOf(t);if(e.key==="Home"){o[0]?.focus();return}if(e.key==="End"){o[o.length-1]?.focus();return}const c=e.key==="ArrowDown"?Math.min(o.length-1,s+1):Math.max(0,s-1);o[c]?.focus()}_move(e){if(!this.hasAttribute("disabled")){if(e==="add"){const t=[...this._value,...Array.from(this._selectedAvailable).filter(r=>!this._value.includes(r))];this._selectedAvailable.clear(),this._applyValue(t,"transfer-right");return}if(e==="remove"){const t=new Set(this._selectedChosen),r=this._value.filter(a=>!t.has(a));this._selectedChosen.clear(),this._applyValue(r,"transfer-left")}}}_attachDelegatedListeners(){this._delegatedListenersAttached||(this.root.addEventListener("click",this._handleRootClick),this.root.addEventListener("keydown",this._handleRootKeyDown),this._delegatedListenersAttached=!0)}_detachDelegatedListeners(){this._delegatedListenersAttached&&(this.root.removeEventListener("click",this._handleRootClick),this.root.removeEventListener("keydown",this._handleRootKeyDown),this._delegatedListenersAttached=!1)}_applyValue(e,t){const r=new Set(this._options.map(s=>s.value)),a=Array.from(new Set(e.filter(s=>s&&(r.size===0||r.has(s))))),o=[...this._value];this._value=a,this._suppressValueAttr=!0;try{a.length?this.setAttribute("value",JSON.stringify(a)):this.removeAttribute("value")}finally{this._suppressValueAttr=!1}a.length>0&&this.removeAttribute("invalid"),this.requestRender(),this.dispatchEvent(new CustomEvent("change",{detail:{value:[...this._value],previousValue:o,selectedItems:this._options.filter(s=>this._value.includes(s.value)),source:t},bubbles:!0,composed:!0}))}_syncActionButtons(){const e=this.root.querySelector('[data-action="add"]'),t=this.root.querySelector('[data-action="remove"]');if(e){e.disabled=this._selectedAvailable.size===0;const r=e.querySelector(".move-btn-count");r&&(r.textContent=String(this._selectedAvailable.size))}if(t){t.disabled=this._selectedChosen.size===0;const r=t.querySelector(".move-btn-count");r&&(r.textContent=String(this._selectedChosen.size))}}_registerWithForm(){this._formUnregister&&(this._formUnregister(),this._formUnregister=null);try{const a=this.getRootNode().host?.closest?.("ui-form")||null||this.closest("ui-form"),o=this.getAttribute("name");a&&typeof a.registerField=="function"&&o&&(this._formUnregister=a.registerField(o,{name:o,getValue:()=>[...this._value],setValue:s=>{const c=Array.isArray(s)?s.map(u=>String(u)):[];this._applyValue(c,"api")},validate:async()=>({valid:!this.hasAttribute("required")||this._value.length>0,message:"Select at least one item."}),setError:s=>{s?(this.setAttribute("error",s),this.setAttribute("invalid","")):(this.removeAttribute("error"),this.removeAttribute("invalid")),this.requestRender()}}))}catch{}}}typeof customElements<"u"&&!customElements.get("ui-transfer-list")&&customElements.define("ui-transfer-list",k);exports.UITransferList=k;
734
+ `)}_toggleItem(e){if(this.hasAttribute("disabled"))return;const t=e.getAttribute("data-side"),r=e.getAttribute("data-value")||"";if(!r)return;const a=t==="chosen"?this._selectedChosen:this._selectedAvailable;a.has(r)?a.delete(r):a.add(r),e.setAttribute("data-selected",a.has(r)?"true":"false"),e.setAttribute("aria-selected",a.has(r)?"true":"false"),this._syncActionButtons()}_onItemKeyDown(e,t){const r=t.getAttribute("data-side");if(!r)return;if(e.key==="Enter"||e.key===" "){e.preventDefault(),this._toggleItem(t);return}if(!["ArrowDown","ArrowUp","Home","End"].includes(e.key))return;e.preventDefault();const a=this.root.querySelector(`[data-list="${r}"]`),l=Array.from(a?.querySelectorAll('.item[tabindex="0"]')||[]);if(!l.length)return;const o=l.indexOf(t);if(e.key==="Home"){l[0]?.focus();return}if(e.key==="End"){l[l.length-1]?.focus();return}const c=e.key==="ArrowDown"?Math.min(l.length-1,o+1):Math.max(0,o-1);l[c]?.focus()}_move(e){if(!this.hasAttribute("disabled")){if(e==="add"){const t=[...this._value,...Array.from(this._selectedAvailable).filter(r=>!this._value.includes(r))];this._selectedAvailable.clear(),this._applyValue(t,"transfer-right");return}if(e==="remove"){const t=new Set(this._selectedChosen),r=this._value.filter(a=>!t.has(a));this._selectedChosen.clear(),this._applyValue(r,"transfer-left")}}}_attachDelegatedListeners(){this._delegatedListenersAttached||(this.root.addEventListener("click",this._handleRootClick),this.root.addEventListener("keydown",this._handleRootKeyDown),this._delegatedListenersAttached=!0)}_detachDelegatedListeners(){this._delegatedListenersAttached&&(this.root.removeEventListener("click",this._handleRootClick),this.root.removeEventListener("keydown",this._handleRootKeyDown),this._delegatedListenersAttached=!1)}_applyValue(e,t){const r=new Set(this._options.map(o=>o.value)),a=Array.from(new Set(e.filter(o=>o&&(r.size===0||r.has(o))))),l=[...this._value];this._value=a,this._suppressValueAttr=!0;try{a.length?this.setAttribute("value",JSON.stringify(a)):this.removeAttribute("value")}finally{this._suppressValueAttr=!1}a.length>0&&this.removeAttribute("invalid"),this.requestRender(),this.dispatchEvent(new CustomEvent("change",{detail:{value:[...this._value],previousValue:l,selectedItems:this._options.filter(o=>this._value.includes(o.value)),source:t},bubbles:!0,composed:!0}))}_syncActionButtons(){const e=this.root.querySelector('[data-action="add"]'),t=this.root.querySelector('[data-action="remove"]');if(e){e.disabled=this._selectedAvailable.size===0;const r=e.querySelector(".move-btn-count");r&&(r.textContent=String(this._selectedAvailable.size))}if(t){t.disabled=this._selectedChosen.size===0;const r=t.querySelector(".move-btn-count");r&&(r.textContent=String(this._selectedChosen.size))}}_registerWithForm(){this._formUnregister&&(this._formUnregister(),this._formUnregister=null);try{const a=this.getRootNode().host?.closest?.("ui-form")||null||this.closest("ui-form"),l=this.getAttribute("name");a&&typeof a.registerField=="function"&&l&&(this._formUnregister=a.registerField(l,{name:l,getValue:()=>[...this._value],setValue:o=>{const c=Array.isArray(o)?o.map(d=>String(d)):[];this._applyValue(c,"api")},validate:async()=>({valid:!this.hasAttribute("required")||this._value.length>0,message:"Select at least one item."}),setError:o=>{o?(this.setAttribute("error",o),this.setAttribute("invalid","")):(this.removeAttribute("error"),this.removeAttribute("invalid")),this.requestRender()}}))}catch{}}}typeof customElements<"u"&&!customElements.get("ui-transfer-list")&&customElements.define("ui-transfer-list",S);exports.UITransferList=S;
@@ -658,10 +658,10 @@ const q = `
658
658
  }
659
659
  }
660
660
  `;
661
- function l(n) {
661
+ function s(n) {
662
662
  return n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
663
663
  }
664
- function x(n) {
664
+ function k(n) {
665
665
  if (!n) return [];
666
666
  try {
667
667
  const e = JSON.parse(n);
@@ -680,7 +680,7 @@ function x(n) {
680
680
  return [];
681
681
  }
682
682
  }
683
- function z(n) {
683
+ function w(n) {
684
684
  if (!n) return [];
685
685
  try {
686
686
  const e = JSON.parse(n);
@@ -689,7 +689,7 @@ function z(n) {
689
689
  return [];
690
690
  }
691
691
  }
692
- function y(n, e) {
692
+ function A(n, e) {
693
693
  return new Set(Array.from(n).filter((t) => e.has(t)));
694
694
  }
695
695
  function R(n) {
@@ -698,7 +698,7 @@ function R(n) {
698
698
  function p(n, e) {
699
699
  return n == null ? e : n === "" || n === "true" || n === "1" || n === "yes" ? !0 : n === "false" || n === "0" || n === "no" ? !1 : e;
700
700
  }
701
- function _(n) {
701
+ function $(n) {
702
702
  return `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" focusable="false" aria-hidden="true"><path d="${n === "right" ? "M9 6l6 6-6 6" : "M15 6l-6 6 6 6"}"/></svg>`;
703
703
  }
704
704
  class U extends D {
@@ -759,91 +759,91 @@ class U extends D {
759
759
  this._formUnregister && this._formUnregister(), this._detachDelegatedListeners(), super.disconnectedCallback();
760
760
  }
761
761
  attributeChangedCallback(e, t, r) {
762
- t !== r && (e === "options" && (this._options = x(r)), e === "value" && !this._suppressValueAttr && (this._value = z(r)), e === "name" && this.isConnected && this._registerWithForm(), e === "disabled" && (this._selectedAvailable.clear(), this._selectedChosen.clear()), this.isConnected && this.requestRender());
762
+ t !== r && (e === "options" && (this._options = k(r)), e === "value" && !this._suppressValueAttr && (this._value = w(r)), e === "name" && this.isConnected && this._registerWithForm(), e === "disabled" && (this._selectedAvailable.clear(), this._selectedChosen.clear()), this.isConnected && this.requestRender());
763
763
  }
764
764
  render() {
765
- this._options.length || (this._options = x(this.getAttribute("options"))), !this._value.length && this.getAttribute("value") && (this._value = z(this.getAttribute("value")));
766
- const e = new Set(this._value), t = this._options.filter((i) => !e.has(i.value)), r = this._options.filter((i) => e.has(i.value)), a = new Set(t.map((i) => i.value)), o = new Set(r.map((i) => i.value));
767
- this._selectedAvailable = y(this._selectedAvailable, a), this._selectedChosen = y(this._selectedChosen, o);
768
- const s = this.getAttribute("label") || "", c = this.getAttribute("description") || "", u = this.getAttribute("error") || "", k = this.getAttribute("available-label") || "Available", w = this.getAttribute("selected-label") || "Selected", A = this.getAttribute("available-empty-label") || "No items available to add.", $ = this.getAttribute("selected-empty-label") || "No items selected yet.", C = R(this.getAttribute("selection-indicator")), S = this.getAttribute("add-action-label") || "Add selected", L = this.getAttribute("remove-action-label") || "Remove selected", d = p(this.getAttribute("show-action-labels"), !0), f = p(this.getAttribute("show-action-counts"), !0), b = p(this.getAttribute("show-panel-counts"), !0), h = this.getAttribute("radius"), E = h ? ` style="--ui-transfer-panel-radius:${l(h)};"` : "", m = () => C === "none" ? "" : '<span class="indicator" part="indicator" aria-hidden="true"><span class="indicator-box"><span class="indicator-mark">✓</span></span></span>', g = (i) => d ? `<span class="move-btn-text">${l(i)}</span>` : "", v = (i) => f ? `<span class="move-btn-count">${i}</span>` : "", I = t.length ? t.map(
765
+ this._options.length || (this._options = k(this.getAttribute("options"))), !this._value.length && this.getAttribute("value") && (this._value = w(this.getAttribute("value")));
766
+ const e = new Set(this._value), t = this._options.filter((i) => !e.has(i.value)), r = this._options.filter((i) => e.has(i.value)), a = new Set(t.map((i) => i.value)), l = new Set(r.map((i) => i.value));
767
+ this._selectedAvailable = A(this._selectedAvailable, a), this._selectedChosen = A(this._selectedChosen, l);
768
+ const o = this.getAttribute("label") || "", c = this.getAttribute("description") || "", d = this.getAttribute("error") || "", b = this.getAttribute("available-label") || "Available", h = this.getAttribute("selected-label") || "Selected", C = this.getAttribute("available-empty-label") || "No items available to add.", S = this.getAttribute("selected-empty-label") || "No items selected yet.", L = R(this.getAttribute("selection-indicator")), m = this.getAttribute("add-action-label") || "Add selected", g = this.getAttribute("remove-action-label") || "Remove selected", u = p(this.getAttribute("show-action-labels"), !0), f = p(this.getAttribute("show-action-counts"), !0), v = p(this.getAttribute("show-panel-counts"), !0), x = this.getAttribute("radius"), E = x ? ` style="--ui-transfer-panel-radius:${s(x)};"` : "", z = () => L === "none" ? "" : '<span class="indicator" part="indicator" aria-hidden="true"><span class="indicator-box"><span class="indicator-mark">✓</span></span></span>', y = (i) => u ? `<span class="move-btn-text">${s(i)}</span>` : "", _ = (i) => f ? `<span class="move-btn-count">${i}</span>` : "", I = t.length ? t.map(
769
769
  (i) => `<div
770
770
  class="item"
771
771
  part="item available-item"
772
772
  role="option"
773
773
  data-side="available"
774
- data-value="${l(i.value)}"
774
+ data-value="${s(i.value)}"
775
775
  data-selected="${this._selectedAvailable.has(i.value)}"
776
776
  aria-selected="${this._selectedAvailable.has(i.value) ? "true" : "false"}"
777
777
  aria-disabled="${i.disabled ? "true" : "false"}"
778
778
  tabindex="${i.disabled ? "-1" : "0"}"
779
779
  >
780
- ${m()}
780
+ ${z()}
781
781
  <div class="item-copy">
782
- <span class="item-title">${l(i.label)}</span>
783
- ${i.description ? `<span class="item-description">${l(i.description)}</span>` : ""}
782
+ <span class="item-title">${s(i.label)}</span>
783
+ ${i.description ? `<span class="item-description">${s(i.description)}</span>` : ""}
784
784
  </div>
785
785
  </div>`
786
- ).join("") : `<div class="empty" part="empty">${l(A)}</div>`, V = r.length ? r.map(
786
+ ).join("") : `<div class="empty" part="empty">${s(C)}</div>`, V = r.length ? r.map(
787
787
  (i) => `<div
788
788
  class="item"
789
789
  part="item selected-item"
790
790
  role="option"
791
791
  data-side="chosen"
792
- data-value="${l(i.value)}"
792
+ data-value="${s(i.value)}"
793
793
  data-selected="${this._selectedChosen.has(i.value)}"
794
794
  aria-selected="${this._selectedChosen.has(i.value) ? "true" : "false"}"
795
795
  aria-disabled="${i.disabled ? "true" : "false"}"
796
796
  tabindex="${i.disabled ? "-1" : "0"}"
797
797
  >
798
- ${m()}
798
+ ${z()}
799
799
  <div class="item-copy">
800
- <span class="item-title">${l(i.label)}</span>
801
- ${i.description ? `<span class="item-description">${l(i.description)}</span>` : ""}
800
+ <span class="item-title">${s(i.label)}</span>
801
+ ${i.description ? `<span class="item-description">${s(i.description)}</span>` : ""}
802
802
  </div>
803
803
  </div>`
804
- ).join("") : `<div class="empty" part="empty">${l($)}</div>`;
804
+ ).join("") : `<div class="empty" part="empty">${s(S)}</div>`;
805
805
  this.setContent(`
806
806
  <style>${q}</style>
807
807
  <div class="root"${E} part="root">
808
- ${s ? `<p class="label" part="label">${l(s)}</p>` : ""}
809
- ${c ? `<p class="description" part="description">${l(c)}</p>` : ""}
808
+ ${o ? `<p class="label" part="label">${s(o)}</p>` : ""}
809
+ ${c ? `<p class="description" part="description">${s(c)}</p>` : ""}
810
810
  <div class="shell" part="shell">
811
811
  <section class="panel" part="panel panel-available">
812
812
  <div class="panel-header" part="panel-header">
813
813
  <div class="panel-heading">
814
- <div class="panel-title">${l(k)}</div>
815
- ${b ? `<span class="panel-count" part="count">${t.length}</span>` : ""}
814
+ <div class="panel-title">${s(b)}</div>
815
+ ${v ? `<span class="panel-count" part="count">${t.length}</span>` : ""}
816
816
  </div>
817
817
  <div class="panel-help">Choose entries to move into the selected list.</div>
818
818
  </div>
819
- <div class="list" part="list available-list" data-list="available" role="listbox" aria-multiselectable="true">${I}</div>
819
+ <div class="list" part="list available-list" data-list="available" role="listbox" aria-multiselectable="true" aria-label="${s(b)}">${I}</div>
820
820
  <div class="summary" part="summary">${t.length} available</div>
821
821
  </section>
822
822
  <div class="actions" part="actions">
823
- <button class="move-btn" part="action-button action-add" data-compact="${!d && !f}" data-action="add" type="button"${this._selectedAvailable.size ? "" : " disabled"}>
824
- <span class="move-btn-icon" aria-hidden="true">${_("right")}</span>
825
- ${g(S)}
826
- ${v(this._selectedAvailable.size || 0)}
823
+ <button class="move-btn" part="action-button action-add" data-compact="${!u && !f}" data-action="add" type="button"${u ? "" : ` aria-label="${s(m)}"`}${this._selectedAvailable.size ? "" : " disabled"}>
824
+ <span class="move-btn-icon" aria-hidden="true">${$("right")}</span>
825
+ ${y(m)}
826
+ ${_(this._selectedAvailable.size || 0)}
827
827
  </button>
828
- <button class="move-btn" part="action-button action-remove" data-compact="${!d && !f}" data-action="remove" type="button"${this._selectedChosen.size ? "" : " disabled"}>
829
- <span class="move-btn-icon" aria-hidden="true">${_("left")}</span>
830
- ${g(L)}
831
- ${v(this._selectedChosen.size || 0)}
828
+ <button class="move-btn" part="action-button action-remove" data-compact="${!u && !f}" data-action="remove" type="button"${u ? "" : ` aria-label="${s(g)}"`}${this._selectedChosen.size ? "" : " disabled"}>
829
+ <span class="move-btn-icon" aria-hidden="true">${$("left")}</span>
830
+ ${y(g)}
831
+ ${_(this._selectedChosen.size || 0)}
832
832
  </button>
833
833
  </div>
834
834
  <section class="panel" part="panel panel-selected">
835
835
  <div class="panel-header" part="panel-header">
836
836
  <div class="panel-heading">
837
- <div class="panel-title">${l(w)}</div>
838
- ${b ? `<span class="panel-count" part="count">${r.length}</span>` : ""}
837
+ <div class="panel-title">${s(h)}</div>
838
+ ${v ? `<span class="panel-count" part="count">${r.length}</span>` : ""}
839
839
  </div>
840
840
  <div class="panel-help">Use the remove action to send items back.</div>
841
841
  </div>
842
- <div class="list" part="list selected-list" data-list="chosen" role="listbox" aria-multiselectable="true">${V}</div>
842
+ <div class="list" part="list selected-list" data-list="chosen" role="listbox" aria-multiselectable="true" aria-label="${s(h)}">${V}</div>
843
843
  <div class="summary" part="summary">${r.length} selected</div>
844
844
  </section>
845
845
  </div>
846
- ${u ? `<p class="error" part="error">${l(u)}</p>` : ""}
846
+ ${d ? `<p class="error" part="error">${s(d)}</p>` : ""}
847
847
  </div>
848
848
  `);
849
849
  }
@@ -863,19 +863,19 @@ class U extends D {
863
863
  }
864
864
  if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(e.key)) return;
865
865
  e.preventDefault();
866
- const a = this.root.querySelector(`[data-list="${r}"]`), o = Array.from(a?.querySelectorAll('.item[tabindex="0"]') || []);
867
- if (!o.length) return;
868
- const s = o.indexOf(t);
866
+ const a = this.root.querySelector(`[data-list="${r}"]`), l = Array.from(a?.querySelectorAll('.item[tabindex="0"]') || []);
867
+ if (!l.length) return;
868
+ const o = l.indexOf(t);
869
869
  if (e.key === "Home") {
870
- o[0]?.focus();
870
+ l[0]?.focus();
871
871
  return;
872
872
  }
873
873
  if (e.key === "End") {
874
- o[o.length - 1]?.focus();
874
+ l[l.length - 1]?.focus();
875
875
  return;
876
876
  }
877
- const c = e.key === "ArrowDown" ? Math.min(o.length - 1, s + 1) : Math.max(0, s - 1);
878
- o[c]?.focus();
877
+ const c = e.key === "ArrowDown" ? Math.min(l.length - 1, o + 1) : Math.max(0, o - 1);
878
+ l[c]?.focus();
879
879
  }
880
880
  _move(e) {
881
881
  if (!this.hasAttribute("disabled")) {
@@ -897,7 +897,7 @@ class U extends D {
897
897
  this._delegatedListenersAttached && (this.root.removeEventListener("click", this._handleRootClick), this.root.removeEventListener("keydown", this._handleRootKeyDown), this._delegatedListenersAttached = !1);
898
898
  }
899
899
  _applyValue(e, t) {
900
- const r = new Set(this._options.map((s) => s.value)), a = Array.from(new Set(e.filter((s) => s && (r.size === 0 || r.has(s))))), o = [...this._value];
900
+ const r = new Set(this._options.map((o) => o.value)), a = Array.from(new Set(e.filter((o) => o && (r.size === 0 || r.has(o))))), l = [...this._value];
901
901
  this._value = a, this._suppressValueAttr = !0;
902
902
  try {
903
903
  a.length ? this.setAttribute("value", JSON.stringify(a)) : this.removeAttribute("value");
@@ -908,8 +908,8 @@ class U extends D {
908
908
  new CustomEvent("change", {
909
909
  detail: {
910
910
  value: [...this._value],
911
- previousValue: o,
912
- selectedItems: this._options.filter((s) => this._value.includes(s.value)),
911
+ previousValue: l,
912
+ selectedItems: this._options.filter((o) => this._value.includes(o.value)),
913
913
  source: t
914
914
  },
915
915
  bubbles: !0,
@@ -933,17 +933,17 @@ class U extends D {
933
933
  _registerWithForm() {
934
934
  this._formUnregister && (this._formUnregister(), this._formUnregister = null);
935
935
  try {
936
- const a = this.getRootNode().host?.closest?.("ui-form") || null || this.closest("ui-form"), o = this.getAttribute("name");
937
- a && typeof a.registerField == "function" && o && (this._formUnregister = a.registerField(o, {
938
- name: o,
936
+ const a = this.getRootNode().host?.closest?.("ui-form") || null || this.closest("ui-form"), l = this.getAttribute("name");
937
+ a && typeof a.registerField == "function" && l && (this._formUnregister = a.registerField(l, {
938
+ name: l,
939
939
  getValue: () => [...this._value],
940
- setValue: (s) => {
941
- const c = Array.isArray(s) ? s.map((u) => String(u)) : [];
940
+ setValue: (o) => {
941
+ const c = Array.isArray(o) ? o.map((d) => String(d)) : [];
942
942
  this._applyValue(c, "api");
943
943
  },
944
944
  validate: async () => ({ valid: !this.hasAttribute("required") || this._value.length > 0, message: "Select at least one item." }),
945
- setError: (s) => {
946
- s ? (this.setAttribute("error", s), this.setAttribute("invalid", "")) : (this.removeAttribute("error"), this.removeAttribute("invalid")), this.requestRender();
945
+ setError: (o) => {
946
+ o ? (this.setAttribute("error", o), this.setAttribute("invalid", "")) : (this.removeAttribute("error"), this.removeAttribute("invalid")), this.requestRender();
947
947
  }
948
948
  }));
949
949
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@editora/ui-core",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "Framework-agnostic Web Components and primitives for the Editora UI ecosystem",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",