@ptlm-azulejo/combobox 1.0.0-alpha.251 → 1.0.0

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.js CHANGED
@@ -2,15 +2,21 @@ import { Fragment as ke, computed as h, createBlock as K, createCommentVNode as
2
2
  import "@ptlm-azulejo/icons/style.css";
3
3
  function nt(e) {
4
4
  var o, t, a = "";
5
- if (typeof e == "string" || typeof e == "number") a += e;
6
- else if (typeof e == "object") if (Array.isArray(e)) {
7
- var l = e.length;
8
- for (o = 0; o < l; o++) e[o] && (t = nt(e[o])) && (a && (a += " "), a += t);
9
- } else for (t in e) e[t] && (a && (a += " "), a += t);
5
+ if (typeof e == "string" || typeof e == "number")
6
+ a += e;
7
+ else if (typeof e == "object")
8
+ if (Array.isArray(e)) {
9
+ var l = e.length;
10
+ for (o = 0; o < l; o++)
11
+ e[o] && (t = nt(e[o])) && (a && (a += " "), a += t);
12
+ } else
13
+ for (t in e)
14
+ e[t] && (a && (a += " "), a += t);
10
15
  return a;
11
16
  }
12
17
  function Tt() {
13
- for (var e, o, t = 0, a = "", l = arguments.length; t < l; t++) (e = arguments[t]) && (o = nt(e)) && (a && (a += " "), a += o);
18
+ for (var e, o, t = 0, a = "", l = arguments.length; t < l; t++)
19
+ (e = arguments[t]) && (o = nt(e)) && (a && (a += " "), a += o);
14
20
  return a;
15
21
  }
16
22
  function Se(e) {
@@ -22,11 +28,13 @@ function Se(e) {
22
28
  }, Se(e);
23
29
  }
24
30
  function Rt(e, o) {
25
- if (Se(e) != "object" || !e) return e;
31
+ if (Se(e) != "object" || !e)
32
+ return e;
26
33
  var t = e[Symbol.toPrimitive];
27
34
  if (t !== void 0) {
28
35
  var a = t.call(e, o || "default");
29
- if (Se(a) != "object") return a;
36
+ if (Se(a) != "object")
37
+ return a;
30
38
  throw new TypeError("@@toPrimitive must return a primitive value.");
31
39
  }
32
40
  return (o === "string" ? String : Number)(e);
@@ -66,8 +74,10 @@ function $t(e) {
66
74
  }
67
75
  var Pt = (e, o) => {
68
76
  const t = new Array(e.length + o.length);
69
- for (let a = 0; a < e.length; a++) t[a] = e[a];
70
- for (let a = 0; a < o.length; a++) t[e.length + a] = o[a];
77
+ for (let a = 0; a < e.length; a++)
78
+ t[a] = e[a];
79
+ for (let a = 0; a < o.length; a++)
80
+ t[e.length + a] = o[a];
71
81
  return t;
72
82
  }, Mt = (e, o) => ({
73
83
  classGroupId: e,
@@ -80,7 +90,8 @@ var Pt = (e, o) => {
80
90
  const o = Et(e), { conflictingClassGroups: t, conflictingClassGroupModifiers: a } = e;
81
91
  return {
82
92
  getClassGroupId: (r) => {
83
- if (r.startsWith("[") && r.endsWith("]")) return jt(r);
93
+ if (r.startsWith("[") && r.endsWith("]"))
94
+ return jt(r);
84
95
  const u = r.split(Me), n = u[0] === "" && u.length > 1 ? 1 : 0;
85
96
  return st(u, n, o);
86
97
  },
@@ -93,18 +104,22 @@ var Pt = (e, o) => {
93
104
  }
94
105
  };
95
106
  }, st = (e, o, t) => {
96
- if (e.length - o === 0) return t.classGroupId;
107
+ if (e.length - o === 0)
108
+ return t.classGroupId;
97
109
  const a = e[o], l = t.nextPart.get(a);
98
110
  if (l) {
99
111
  const n = st(e, o + 1, l);
100
- if (n) return n;
112
+ if (n)
113
+ return n;
101
114
  }
102
115
  const i = t.validators;
103
- if (i === null) return;
116
+ if (i === null)
117
+ return;
104
118
  const r = o === 0 ? e.join(Me) : e.slice(o).join(Me), u = i.length;
105
119
  for (let n = 0; n < u; n++) {
106
120
  const b = i[n];
107
- if (b.validator(r)) return b.classGroupId;
121
+ if (b.validator(r))
122
+ return b.classGroupId;
108
123
  }
109
124
  }, jt = (e) => e.slice(1, -1).indexOf(":") === -1 ? void 0 : (() => {
110
125
  const o = e.slice(1, -1), t = o.indexOf(":"), a = o.slice(0, t);
@@ -160,12 +175,13 @@ var Pt = (e, o) => {
160
175
  }
161
176
  return t;
162
177
  }, Qt = (e) => "isThemeGetter" in e && e.isThemeGetter === !0, Kt = (e) => {
163
- if (e < 1) return {
164
- get: () => {
165
- },
166
- set: () => {
167
- }
168
- };
178
+ if (e < 1)
179
+ return {
180
+ get: () => {
181
+ },
182
+ set: () => {
183
+ }
184
+ };
169
185
  let o = 0, t = /* @__PURE__ */ Object.create(null), a = /* @__PURE__ */ Object.create(null);
170
186
  const l = (i, r) => {
171
187
  t[i] = r, o++, o > e && (o = 0, a = t, t = /* @__PURE__ */ Object.create(null));
@@ -173,7 +189,8 @@ var Pt = (e, o) => {
173
189
  return {
174
190
  get(i) {
175
191
  let r = t[i];
176
- if (r !== void 0) return r;
192
+ if (r !== void 0)
193
+ return r;
177
194
  if ((r = a[i]) !== void 0)
178
195
  return l(i, r), r;
179
196
  },
@@ -245,7 +262,9 @@ var Pt = (e, o) => {
245
262
  postfixLookupClassGroupIds: Jt(e)
246
263
  }, Vt(e)), Jt = (e) => {
247
264
  const o = /* @__PURE__ */ Object.create(null), t = e.postfixLookupClassGroups;
248
- if (t) for (let a = 0; a < t.length; a++) o[t[a]] = !0;
265
+ if (t)
266
+ for (let a = 0; a < t.length; a++)
267
+ o[t[a]] = !0;
249
268
  return o;
250
269
  }, Zt = /\s+/, _t = (e, o) => {
251
270
  const { parseClassName: t, getClassGroupId: a, getConflictingClassGroupIds: l, sortModifiers: i, postfixLookupClassGroupIds: r } = o, u = [], n = e.trim().split(Zt);
@@ -261,7 +280,8 @@ var Pt = (e, o) => {
261
280
  A = a(I.substring(0, p));
262
281
  const D = A && r[A] ? a(I) : void 0;
263
282
  D && D !== A && (A = D, s = !1);
264
- } else A = a(I);
283
+ } else
284
+ A = a(I);
265
285
  if (!A) {
266
286
  if (!s) {
267
287
  b = k + (b.length > 0 ? " " + b : b);
@@ -274,7 +294,8 @@ var Pt = (e, o) => {
274
294
  s = !1;
275
295
  }
276
296
  const M = z.length === 0 ? "" : z.length === 1 ? z[0] : i(z).join(":"), B = w ? M + Ne : M, H = B + A;
277
- if (u.indexOf(H) > -1) continue;
297
+ if (u.indexOf(H) > -1)
298
+ continue;
278
299
  u.push(H);
279
300
  const Y = l(A, s);
280
301
  for (let D = 0; D < Y.length; ++D) {
@@ -286,12 +307,15 @@ var Pt = (e, o) => {
286
307
  return b;
287
308
  }, eo = (...e) => {
288
309
  let o = 0, t, a, l = "";
289
- for (; o < e.length; ) (t = e[o++]) && (a = dt(t)) && (l && (l += " "), l += a);
310
+ for (; o < e.length; )
311
+ (t = e[o++]) && (a = dt(t)) && (l && (l += " "), l += a);
290
312
  return l;
291
313
  }, dt = (e) => {
292
- if (typeof e == "string") return e;
314
+ if (typeof e == "string")
315
+ return e;
293
316
  let o, t = "";
294
- for (let a = 0; a < e.length; a++) e[a] && (o = dt(e[a])) && (t && (t += " "), t += o);
317
+ for (let a = 0; a < e.length; a++)
318
+ e[a] && (o = dt(e[a])) && (t && (t += " "), t += o);
295
319
  return t;
296
320
  }, _e = (e, ...o) => {
297
321
  let t, a, l, i;
@@ -300,7 +324,8 @@ var Pt = (e, o) => {
300
324
  return t = Xt(b), a = t.cache.get, l = t.cache.set, i = u, u(n);
301
325
  }, u = (n) => {
302
326
  const b = a(n);
303
- if (b) return b;
327
+ if (b)
328
+ return b;
304
329
  const v = _t(n, t);
305
330
  return l(n, v), v;
306
331
  };
@@ -1792,9 +1817,13 @@ var Pt = (e, o) => {
1792
1817
  }, Co = (e, { cacheSize: o, prefix: t, experimentalParseClassName: a, extend: l = {}, override: i = {} }) => (be(e, "cacheSize", o), be(e, "prefix", t), be(e, "experimentalParseClassName", a), Oe(e.theme, i.theme), Oe(e.classGroups, i.classGroups), Oe(e.conflictingClassGroups, i.conflictingClassGroups), Oe(e.conflictingClassGroupModifiers, i.conflictingClassGroupModifiers), be(e, "postfixLookupClassGroups", i.postfixLookupClassGroups), be(e, "orderSensitiveModifiers", i.orderSensitiveModifiers), $e(e.theme, l.theme), $e(e.classGroups, l.classGroups), $e(e.conflictingClassGroups, l.conflictingClassGroups), $e(e.conflictingClassGroupModifiers, l.conflictingClassGroupModifiers), Fe(e, l, "postfixLookupClassGroups"), Fe(e, l, "orderSensitiveModifiers"), e), be = (e, o, t) => {
1793
1818
  t !== void 0 && (e[o] = t);
1794
1819
  }, Oe = (e, o) => {
1795
- if (o) for (const t in o) be(e, t, o[t]);
1820
+ if (o)
1821
+ for (const t in o)
1822
+ be(e, t, o[t]);
1796
1823
  }, $e = (e, o) => {
1797
- if (o) for (const t in o) Fe(e, o, t);
1824
+ if (o)
1825
+ for (const t in o)
1826
+ Fe(e, o, t);
1798
1827
  }, Fe = (e, o, t) => {
1799
1828
  const a = o[t];
1800
1829
  a !== void 0 && (e[t] = e[t] ? e[t].concat(a) : a);
@@ -1824,7 +1853,8 @@ var Ke = (e) => e.type === "section", de = (e) => e.type !== "section" && e.valu
1824
1853
  const o = [];
1825
1854
  for (let t = 0; t < e.length; t++) {
1826
1855
  const a = e[t];
1827
- if (!a) continue;
1856
+ if (!a)
1857
+ continue;
1828
1858
  if (Ke(a)) {
1829
1859
  o.push({
1830
1860
  type: "section",
@@ -2594,7 +2624,8 @@ var qe = { size: {
2594
2624
  }), aa = oa, la = (e) => {
2595
2625
  const o = Z(""), t = h(() => {
2596
2626
  const r = o.value.trim().toLowerCase();
2597
- if (!r) return e.options;
2627
+ if (!r)
2628
+ return e.options;
2598
2629
  const u = [];
2599
2630
  let n = null, b = [];
2600
2631
  const v = (y) => {
@@ -2604,10 +2635,12 @@ var qe = { size: {
2604
2635
  if (n) {
2605
2636
  const y = n.label.toLowerCase().includes(r), z = b.filter(v);
2606
2637
  y ? u.push(n, ...b) : z.length > 0 && u.push(n, ...z);
2607
- } else u.push(...b.filter(v));
2638
+ } else
2639
+ u.push(...b.filter(v));
2608
2640
  n = null, b = [];
2609
2641
  };
2610
- for (const y of e.options) Ke(y) ? (k(), n = y) : b.push(y);
2642
+ for (const y of e.options)
2643
+ Ke(y) ? (k(), n = y) : b.push(y);
2611
2644
  return k(), u;
2612
2645
  }), a = h(() => t.value.filter((r) => de(r) && !r.disabled)), l = h(() => e.options.filter((r) => de(r) && !r.disabled).map(oe));
2613
2646
  return {
@@ -2621,7 +2654,8 @@ var qe = { size: {
2621
2654
  };
2622
2655
  }, ra = (e, o, t) => {
2623
2656
  const a = rt(), l = Z(null), i = Z(null), r = Z(null), u = Z(!1), n = Z(void 0), b = h(() => e.open !== void 0), v = h(() => b.value ? !!e.open : u.value), k = h(() => `${a}-listbox`), y = (m, L) => `${a}-option-${L}-${encodeURIComponent(String(m))}`, z = (m) => t.visibleOptions.value.indexOf(m), w = (m) => {
2624
- if (!de(m)) return;
2657
+ if (!de(m))
2658
+ return;
2625
2659
  const L = z(m);
2626
2660
  if (!(L < 0))
2627
2661
  return y(oe(m), L);
@@ -2640,12 +2674,14 @@ var qe = { size: {
2640
2674
  t.selectOption(m), e.multiple || s(!1);
2641
2675
  }, M = (m) => {
2642
2676
  const L = t.selectableVisible.value;
2643
- if (L.length === 0) return;
2677
+ if (L.length === 0)
2678
+ return;
2644
2679
  const P = n.value ? L.indexOf(n.value) : -1;
2645
2680
  let N;
2646
2681
  P < 0 ? N = m === 1 ? 0 : L.length - 1 : N = (P + m + L.length) % L.length;
2647
2682
  const X = L[N];
2648
- if (!X) return;
2683
+ if (!X)
2684
+ return;
2649
2685
  n.value = X;
2650
2686
  const ae = z(X);
2651
2687
  Ve(() => {
@@ -2660,7 +2696,8 @@ var qe = { size: {
2660
2696
  }, Y = () => {
2661
2697
  e.disabled || e.readonly || s(!v.value);
2662
2698
  }, D = (m) => {
2663
- if (e.disabled || e.readonly) return;
2699
+ if (e.disabled || e.readonly)
2700
+ return;
2664
2701
  const L = m.target, P = !!(L != null && L.closest('[data-testid="combobox-search"]'));
2665
2702
  if (!(P && m.key.length === 1 && !m.metaKey && !m.ctrlKey && !m.altKey) && !(L != null && L.closest("button") && (m.key === " " || m.key === "Enter")))
2666
2703
  switch (m.key) {
@@ -2679,16 +2716,19 @@ var qe = { size: {
2679
2716
  M(-1);
2680
2717
  break;
2681
2718
  case "Home":
2682
- if (!v.value) return;
2719
+ if (!v.value)
2720
+ return;
2683
2721
  m.preventDefault(), B("start");
2684
2722
  break;
2685
2723
  case "End":
2686
- if (!v.value) return;
2724
+ if (!v.value)
2725
+ return;
2687
2726
  m.preventDefault(), B("end");
2688
2727
  break;
2689
2728
  case "Enter":
2690
2729
  case " ":
2691
- if (P && m.key === " ") return;
2730
+ if (P && m.key === " ")
2731
+ return;
2692
2732
  if (m.preventDefault(), !v.value) {
2693
2733
  s(!0);
2694
2734
  return;
@@ -2696,14 +2736,16 @@ var qe = { size: {
2696
2736
  H();
2697
2737
  break;
2698
2738
  case "Escape":
2699
- if (!v.value) return;
2739
+ if (!v.value)
2740
+ return;
2700
2741
  m.preventDefault(), s(!1);
2701
2742
  break;
2702
2743
  case "Tab":
2703
2744
  v.value && s(!1);
2704
2745
  }
2705
2746
  }, f = (m) => {
2706
- if (!v.value) return;
2747
+ if (!v.value)
2748
+ return;
2707
2749
  const L = l.value;
2708
2750
  L && !L.contains(m.target) && s(!1);
2709
2751
  };
@@ -2720,7 +2762,8 @@ var qe = { size: {
2720
2762
  return (N = r.value) === null || N === void 0 ? void 0 : N.focus();
2721
2763
  });
2722
2764
  }, { immediate: !0 }), De(t.selectableVisible, () => {
2723
- if (!v.value) return;
2765
+ if (!v.value)
2766
+ return;
2724
2767
  const m = t.selectableVisible.value;
2725
2768
  (!n.value || !m.includes(n.value)) && (n.value = m[0]);
2726
2769
  }), Lt(() => {
@@ -2755,7 +2798,8 @@ var qe = { size: {
2755
2798
  }
2756
2799
  o("update:modelValue", (s = p[0]) !== null && s !== void 0 ? s : "");
2757
2800
  }, b = (p) => {
2758
- if (e.disabled || e.readonly || p.disabled || !de(p)) return;
2801
+ if (e.disabled || e.readonly || p.disabled || !de(p))
2802
+ return;
2759
2803
  const s = oe(p);
2760
2804
  if (e.multiple) {
2761
2805
  const A = a.value, M = A.includes(s) ? A.filter((B) => B !== s) : [...A, s];
@@ -2771,7 +2815,8 @@ var qe = { size: {
2771
2815
  const s = [], A = t.visibleOptions.value;
2772
2816
  for (let M = p + 1; M < A.length; M++) {
2773
2817
  const B = A[M];
2774
- if (!B || Ke(B)) break;
2818
+ if (!B || Ke(B))
2819
+ break;
2775
2820
  de(B) && s.push(B);
2776
2821
  }
2777
2822
  return s;
@@ -2790,14 +2835,17 @@ var qe = { size: {
2790
2835
  },
2791
2836
  sectionCheckState: (p) => {
2792
2837
  const s = y(p).filter((B) => !B.disabled);
2793
- if (s.length === 0) return "unchecked";
2838
+ if (s.length === 0)
2839
+ return "unchecked";
2794
2840
  const A = a.value, M = s.filter((B) => A.includes(oe(B))).length;
2795
2841
  return M === 0 ? "unchecked" : M === s.length ? "checked" : "indeterminate";
2796
2842
  },
2797
2843
  toggleSection: (p) => {
2798
- if (e.disabled || e.readonly || !e.multiple || !e.checkableSections) return;
2844
+ if (e.disabled || e.readonly || !e.multiple || !e.checkableSections)
2845
+ return;
2799
2846
  const s = y(p).filter((B) => !B.disabled).map(oe);
2800
- if (s.length === 0) return;
2847
+ if (s.length === 0)
2848
+ return;
2801
2849
  const A = a.value, M = s.every((B) => A.includes(B));
2802
2850
  n(M ? A.filter((B) => !s.includes(B)) : [.../* @__PURE__ */ new Set([...A, ...s])]);
2803
2851
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptlm-azulejo/combobox",
3
- "version": "1.0.0-alpha.251",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.umd.cjs",
6
6
  "module": "./dist/index.js",
package/CHANGELOG.md DELETED
@@ -1,10 +0,0 @@
1
- # Change Log
2
-
3
- ## 1.0.0
4
-
5
- ### Major Changes
6
-
7
- - f2ca149: Add `AzCombobox` — a select-from-list input with single or multiple selection, optional in-list search, grouped/checkable sections, clear and select-all actions, selected-row highlighting, tag overflow, and typed `:ui` overrides. Glyphs (check, cross, search, chevron) come from `@ptlm-azulejo/icons`, which is pulled in as a dependency. Combobox ARIA (`role`, `aria-expanded`, `aria-controls`, `aria-activedescendant`) follows focus: the trigger when closed or without search, the search input once the listbox is open. `role="listbox"` sits on the option list (not the popup panel) so search, actions, and other chrome are not listbox children; an empty result is a disabled option. All user-facing copy is overridable (including empty state, overflow chips, and aria labels, with `{count}` / `{label}` tokens). Published styles are scoped to `.az-combobox` BEM roots so the stylesheet does not leak global Tailwind utilities; those selectors are wrapped in `:where()` so they compile at zero specificity and a `:ui` utility always wins (including selected, disabled, invalid, and hover states).
8
-
9
- All notable changes to this project will be documented in this file.
10
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.