@ac-design/design-system 2.2.0 → 2.3.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.
Files changed (54) hide show
  1. package/dist/lib/charts/ChartFrame.vue_vue_type_script_setup_true_lang.js +89 -88
  2. package/dist/lib/compat.css +210 -0
  3. package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +74 -73
  4. package/dist/lib/components/AcButton.vue.d.ts +18 -12
  5. package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +62 -32
  6. package/dist/lib/components/AcCard.vue.d.ts +11 -5
  7. package/dist/lib/components/AcCard.vue_vue_type_script_setup_true_lang.js +99 -51
  8. package/dist/lib/components/AcClusterSwitcher.vue_vue_type_script_setup_true_lang.js +151 -150
  9. package/dist/lib/components/AcColorInput.vue.d.ts +1 -1
  10. package/dist/lib/components/AcDatePicker.vue.d.ts +27 -3
  11. package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +518 -454
  12. package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +56 -55
  13. package/dist/lib/components/AcErrorState.vue.d.ts +1 -1
  14. package/dist/lib/components/AcFormFooter.vue_vue_type_script_setup_true_lang.js +39 -38
  15. package/dist/lib/components/AcHeader.vue.d.ts +1 -1
  16. package/dist/lib/components/AcInput.vue.d.ts +28 -7
  17. package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +149 -80
  18. package/dist/lib/components/AcKeyValueInput.vue.d.ts +1 -1
  19. package/dist/lib/components/AcLocaleSwitcher.vue.d.ts +6 -0
  20. package/dist/lib/components/AcLocaleSwitcher.vue_vue_type_script_setup_true_lang.js +74 -58
  21. package/dist/lib/components/AcModal.vue_vue_type_script_setup_true_lang.js +3 -1
  22. package/dist/lib/components/AcNavbar.vue.d.ts +2 -0
  23. package/dist/lib/components/AcNavbar.vue_vue_type_script_setup_true_lang.js +31 -25
  24. package/dist/lib/components/AcNotificationMenu.vue_vue_type_script_setup_true_lang.js +90 -89
  25. package/dist/lib/components/AcNumberInput.vue.d.ts +1 -1
  26. package/dist/lib/components/AcRadioCard.js +5 -0
  27. package/dist/lib/components/AcRadioCard.vue.d.ts +55 -0
  28. package/dist/lib/components/AcRadioCard.vue_vue_type_script_setup_true_lang.js +135 -0
  29. package/dist/lib/components/AcSelect.vue.d.ts +12 -1
  30. package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +237 -220
  31. package/dist/lib/components/AcSidePanel.vue_vue_type_script_setup_true_lang.js +3 -1
  32. package/dist/lib/components/AcSideTabs.vue.d.ts +1 -1
  33. package/dist/lib/components/AcSidebar.vue.d.ts +9 -0
  34. package/dist/lib/components/AcSidebar.vue_vue_type_script_setup_true_lang.js +113 -94
  35. package/dist/lib/components/AcSidebarSection.vue_vue_type_script_setup_true_lang.js +19 -18
  36. package/dist/lib/components/AcSlider.vue.d.ts +1 -1
  37. package/dist/lib/components/AcTable.vue.d.ts +13 -1
  38. package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +106 -86
  39. package/dist/lib/components/AcTagInput.vue.d.ts +1 -1
  40. package/dist/lib/components/AcTextarea.vue.d.ts +30 -4
  41. package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +92 -61
  42. package/dist/lib/components/AcThemeMode.vue.d.ts +10 -2
  43. package/dist/lib/components/AcThemeMode.vue_vue_type_script_setup_true_lang.js +53 -42
  44. package/dist/lib/components/AcTimePicker.vue.d.ts +21 -3
  45. package/dist/lib/components/AcTimePicker.vue_vue_type_script_setup_true_lang.js +234 -201
  46. package/dist/lib/components/AcTooltip.vue_vue_type_script_setup_true_lang.js +73 -72
  47. package/dist/lib/components/AcUserMenu.vue.d.ts +8 -0
  48. package/dist/lib/components/AcUserMenu.vue_vue_type_script_setup_true_lang.js +125 -107
  49. package/dist/lib/components/fixedFrame.d.ts +11 -0
  50. package/dist/lib/components/fixedFrame.js +24 -0
  51. package/dist/lib/components/index.d.ts +1 -0
  52. package/dist/lib/components/types.d.ts +2 -0
  53. package/dist/lib/index.js +34 -33
  54. package/package.json +1 -1
@@ -1,15 +1,16 @@
1
1
  import e from "./AcSpinner.js";
2
- import { Fragment as t, Teleport as n, Transition as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as ee, createVNode as l, defineComponent as u, mergeModels as d, mergeProps as te, nextTick as f, normalizeClass as p, normalizeStyle as ne, onBeforeUnmount as re, openBlock as m, ref as h, renderList as g, renderSlot as ie, resolveDynamicComponent as ae, toDisplayString as _, unref as v, useAttrs as oe, useId as se, useModel as ce, vModelText as le, watch as ue, withCtx as de, withDirectives as fe, withModifiers as y } from "vue";
3
- import { Check as pe, ChevronDown as me, ChevronUp as he, Plus as ge, RefreshCw as _e, X as ve } from "@lucide/vue";
2
+ import { fixedFrame as t } from "./fixedFrame.js";
3
+ import { Fragment as n, Teleport as r, Transition as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as ee, createVNode as u, defineComponent as d, mergeModels as f, mergeProps as te, nextTick as ne, normalizeClass as p, normalizeStyle as re, onBeforeUnmount as ie, onMounted as ae, openBlock as m, ref as h, renderList as g, renderSlot as _, resolveDynamicComponent as oe, toDisplayString as v, unref as y, useAttrs as se, useId as ce, useModel as le, useSlots as ue, vModelText as de, watch as b, withCtx as fe, withDirectives as pe, withModifiers as x } from "vue";
4
+ import { Check as me, ChevronDown as he, ChevronUp as ge, Plus as _e, RefreshCw as ve, X as ye } from "@lucide/vue";
4
5
  //#region src/lib/components/AcSelect.vue?vue&type=script&setup=true&lang.ts
5
- var ye = {
6
+ var be = {
6
7
  key: 0,
7
8
  class: "mb-2 flex items-center gap-1 text-base font-medium text-heading"
8
- }, be = {
9
+ }, xe = {
9
10
  key: 0,
10
11
  class: "text-danger",
11
12
  "aria-hidden": "true"
12
- }, xe = [
13
+ }, Se = [
13
14
  "id",
14
15
  "tabindex",
15
16
  "aria-expanded",
@@ -19,44 +20,45 @@ var ye = {
19
20
  "aria-disabled",
20
21
  "aria-invalid",
21
22
  "aria-required",
22
- "aria-activedescendant"
23
- ], Se = { class: "flex min-w-0 flex-1 flex-wrap items-center gap-2" }, Ce = { class: "truncate" }, we = [
23
+ "aria-activedescendant",
24
+ "aria-busy"
25
+ ], Ce = { class: "flex min-w-0 flex-1 flex-wrap items-center gap-2" }, we = { class: "truncate" }, Te = [
24
26
  "aria-label",
25
27
  "disabled",
26
28
  "onClick"
27
- ], Te = {
28
- key: 1,
29
- class: "truncate"
30
- }, Ee = {
29
+ ], Ee = {
31
30
  key: 2,
31
+ class: "truncate"
32
+ }, De = {
33
+ key: 3,
32
34
  class: "truncate text-muted"
33
- }, De = { class: "flex shrink-0 items-center gap-1 text-muted" }, Oe = ["disabled"], ke = {
35
+ }, Oe = { class: "flex shrink-0 items-center gap-1 text-muted" }, ke = ["disabled"], Ae = {
34
36
  class: "inline-flex rounded-full p-1 transition-colors hover:bg-accent-hover hover:text-primary",
35
37
  "aria-hidden": "true"
36
- }, Ae = {
38
+ }, je = {
37
39
  key: 0,
38
40
  class: "border-b border-border p-3"
39
- }, je = ["aria-activedescendant"], Me = ["aria-multiselectable", "aria-labelledby"], Ne = {
41
+ }, Me = ["aria-activedescendant"], Ne = ["aria-multiselectable", "aria-labelledby"], Pe = {
40
42
  key: 0,
41
43
  role: "presentation",
42
44
  class: "px-4 pt-2 pb-1 text-sm font-semibold tracking-[0.08em] text-muted uppercase"
43
- }, Pe = [
45
+ }, Fe = [
44
46
  "id",
45
47
  "aria-selected",
46
48
  "aria-disabled",
47
49
  "onMouseenter",
48
50
  "onClick"
49
- ], Fe = { class: "min-w-0 flex-1" }, Ie = { class: "block truncate" }, Le = {
51
+ ], Ie = { class: "min-w-0 flex-1" }, Le = { class: "block truncate" }, Re = {
50
52
  key: 0,
51
53
  class: "block truncate text-xs font-normal text-muted"
52
- }, Re = ["id"], ze = { class: "min-w-0 flex-1 truncate" }, Be = {
54
+ }, ze = ["id"], Be = { class: "min-w-0 flex-1 truncate" }, Ve = {
53
55
  key: 1,
54
56
  role: "presentation",
55
57
  class: "px-4 py-3 text-center text-base text-muted"
56
- }, b = /*@__PURE__*/ u({
58
+ }, He = /*@__PURE__*/ d({
57
59
  inheritAttrs: !1,
58
60
  __name: "AcSelect",
59
- props: /*@__PURE__*/ d({
61
+ props: /*@__PURE__*/ f({
60
62
  options: {},
61
63
  by: {
62
64
  type: [String, Function],
@@ -89,6 +91,10 @@ var ye = {
89
91
  type: Boolean,
90
92
  default: !1
91
93
  },
94
+ refreshing: {
95
+ type: Boolean,
96
+ default: !1
97
+ },
92
98
  disabled: {
93
99
  type: Boolean,
94
100
  default: !1
@@ -100,57 +106,63 @@ var ye = {
100
106
  errorMsg: { default: "" },
101
107
  hint: { default: "" },
102
108
  size: { default: "normal" },
103
- noResultText: { default: "No results" }
109
+ noResultText: { default: "No results" },
110
+ placement: { default: "bottom" }
104
111
  }, {
105
112
  modelValue: { default: null },
106
- modelModifiers: {}
113
+ modelModifiers: {},
114
+ open: {
115
+ type: Boolean,
116
+ default: !1
117
+ },
118
+ openModifiers: {}
107
119
  }),
108
- emits: /*@__PURE__*/ d([
120
+ emits: /*@__PURE__*/ f([
109
121
  "select",
110
122
  "create",
111
123
  "remove",
112
124
  "search",
113
125
  "refresh"
114
- ], ["update:modelValue"]),
115
- setup(u, { expose: d, emit: b }) {
116
- let x = u, S = b, C = ce(u, "modelValue"), w = se(), T = oe(), Ve = i(() => ({
117
- class: T.class,
118
- style: T.style
119
- })), He = i(() => {
120
- let { class: e, style: t, ...n } = T;
126
+ ], ["update:modelValue", "update:open"]),
127
+ setup(d, { expose: f, emit: He }) {
128
+ let S = d, C = He, Ue = ue(), w = le(d, "modelValue"), T = le(d, "open"), E = ce(), D = se(), We = a(() => ({
129
+ class: D.class,
130
+ style: D.style
131
+ })), Ge = a(() => {
132
+ let { class: e, style: t, ...n } = D;
121
133
  return n;
122
- }), E = `${w}-list`, D = `${w}-label`, Ue = `${w}-hint`, We = `${w}-msg`, Ge = h(null), O = h(null), k = h(null), Ke = h(null), A = h(!1), j = h(""), M = h(-1), N = h({
134
+ }), O = `${E}-list`, k = `${E}-label`, Ke = `${E}-hint`, qe = `${E}-msg`, Je = h(null), A = h(null), j = h(null), Ye = h(null), M = h(""), N = h(-1), P = h({
123
135
  left: 0,
124
136
  width: 0,
125
137
  maxHeight: 288
126
- }), P = i(() => {
127
- let e = C.value;
138
+ }), F = a(() => {
139
+ let e = w.value;
128
140
  return e == null || e === "" ? [] : Array.isArray(e) ? e : [e];
129
- }), F = (e, t) => {
130
- let n = x.by;
141
+ }), I = (e, t) => {
142
+ let n = S.by;
131
143
  return typeof n == "function" ? n(e, t) : n && e && t && typeof e == "object" && typeof t == "object" ? e[n] === t[n] : e === t;
132
- }, I = (e) => {
133
- let t = x.by;
144
+ }, L = (e) => {
145
+ let t = S.by;
134
146
  return String(typeof t == "string" && e && typeof e == "object" ? e[t] : e);
135
- }, qe = (e, t) => {
136
- let n = x.by;
147
+ }, Xe = (e, t) => {
148
+ let n = S.by;
137
149
  return e && typeof e == "object" ? typeof n == "string" ? String(e[n]) : `i${t}` : String(e);
138
- }, L = (e) => P.value.some((t) => F(t, e.value)), R = i(() => P.value.map((e) => x.options.find((t) => F(t.value, e)) ?? {
150
+ }, R = (e) => F.value.some((t) => I(t, e.value)), z = a(() => F.value.map((e) => S.options.find((t) => I(t.value, e)) ?? {
139
151
  value: e,
140
- label: I(e)
141
- })), z = i(() => P.value.length > 0), Je = (e) => {
152
+ label: L(e)
153
+ })), B = a(() => F.value.length > 0), Ze = (e) => {
142
154
  if (!e.some((e) => e.group)) return e;
143
155
  let t = [];
144
156
  return e.forEach((e) => {
145
157
  let n = e.group ?? "";
146
158
  t.includes(n) || t.push(n);
147
159
  }), [...e].sort((e, n) => t.indexOf(e.group ?? "") - t.indexOf(n.group ?? ""));
148
- }, B = i(() => {
149
- let e = j.value.trim().toLowerCase();
150
- return Je(e ? x.options.filter((t) => t.label.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e) || t.group?.toLowerCase().includes(e)) : x.options);
151
- }), Ye = i(() => {
160
+ }, V = a(() => {
161
+ let e = M.value.trim().toLowerCase();
162
+ return Ze(e ? S.options.filter((t) => t.label.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e) || t.group?.toLowerCase().includes(e)) : S.options);
163
+ }), Qe = a(() => {
152
164
  let e = [];
153
- return B.value.forEach((t, n) => {
165
+ return V.value.forEach((t, n) => {
154
166
  let r = t.group ?? "", i = e.find((e) => e.name === r);
155
167
  i || e.push(i = {
156
168
  name: r,
@@ -160,274 +172,279 @@ var ye = {
160
172
  index: n
161
173
  });
162
174
  }), e;
163
- }), V = (e) => `${w}-opt-${e}`, H = i(() => j.value.trim()), U = i(() => {
164
- let e = H.value.toLowerCase();
165
- if (!x.creatable || !x.searchable || !e) return !1;
166
- let t = x.options.some((t) => t.label.toLowerCase() === e || I(t.value).toLowerCase() === e), n = P.value.some((t) => I(t).toLowerCase() === e);
175
+ }), H = (e) => `${E}-opt-${e}`, U = a(() => M.value.trim()), W = a(() => {
176
+ let e = U.value.toLowerCase();
177
+ if (!S.creatable || !S.searchable || !e) return !1;
178
+ let t = S.options.some((t) => t.label.toLowerCase() === e || L(t.value).toLowerCase() === e), n = F.value.some((t) => L(t).toLowerCase() === e);
167
179
  return !t && !n;
168
- }), W = i(() => B.value.length + +!!U.value - 1), G = i(() => B.value.length), Xe = () => {
169
- let e = O.value;
180
+ }), G = a(() => V.value.length + +!!W.value - 1), K = a(() => V.value.length), $e = () => {
181
+ let e = A.value;
170
182
  if (!e) return;
171
- let t = e.getBoundingClientRect(), n = window.innerHeight - t.bottom - 4 - 8, r = t.top - 4 - 8;
172
- N.value = n < 180 && r > n ? {
173
- bottom: window.innerHeight - t.top + 4,
174
- left: t.left,
175
- width: t.width,
176
- maxHeight: Math.min(288, r)
183
+ let n = e.getBoundingClientRect(), r = t(), i = r.bottom - n.bottom - 4 - 8, a = n.top - r.top - 4 - 8, [o, s] = S.placement === "top" ? [a, i] : [i, a], c = o < 180 && s > o, l = S.placement === "top" ? !c : c;
184
+ P.value = l ? {
185
+ bottom: r.bottom - n.top + 4,
186
+ left: n.left - r.left,
187
+ width: n.width,
188
+ maxHeight: Math.min(288, a)
177
189
  } : {
178
- top: t.bottom + 4,
179
- left: t.left,
180
- width: t.width,
181
- maxHeight: Math.min(288, n)
190
+ top: n.bottom + 4 - r.top,
191
+ left: n.left - r.left,
192
+ width: n.width,
193
+ maxHeight: Math.min(288, i)
182
194
  };
183
- }, K = (e = 0, t = 1) => {
184
- for (let n = e; n >= 0 && n <= W.value; n += t) if (!B.value[n]?.disabled) return n;
195
+ }, q = (e = 0, t = 1) => {
196
+ for (let n = e; n >= 0 && n <= G.value; n += t) if (!V.value[n]?.disabled) return n;
185
197
  return -1;
186
- }, Ze = async () => {
187
- if (x.disabled || x.loading || A.value) return;
188
- A.value = !0, j.value = "", Xe();
189
- let e = B.value.findIndex((e) => L(e));
190
- M.value = e >= 0 ? e : K(), await f(), x.searchable && Ke.value?.focus(), X();
191
- }, q = (e = !0) => {
192
- A.value && (A.value = !1, M.value = -1, e && O.value?.focus());
193
- }, Qe = () => A.value ? q() : Ze(), $e = (e) => {
198
+ }, et = () => {
199
+ S.disabled || S.loading || T.value || (T.value = !0);
200
+ }, tt = async () => {
201
+ M.value = "", $e();
202
+ let e = V.value.findIndex((e) => R(e));
203
+ N.value = e >= 0 ? e : q(), document.addEventListener("pointerdown", Z, !0), window.addEventListener("scroll", Q, !0), window.addEventListener("resize", Q), await ne(), S.searchable && Ye.value?.focus(), X();
204
+ }, J = (e = !0) => {
205
+ T.value && (T.value = !1, N.value = -1, e && A.value?.focus());
206
+ }, nt = () => T.value ? J() : et(), rt = (e) => {
194
207
  if (!e.disabled) {
195
- if (x.multiple) {
196
- let t = [...P.value], n = t.findIndex((t) => F(t, e.value));
197
- n >= 0 ? (t.splice(n, 1), S("remove", e)) : (t.push(e.value), S("select", e)), C.value = t;
198
- } else C.value = e.value, S("select", e), q();
208
+ if (S.multiple) {
209
+ let t = [...F.value], n = t.findIndex((t) => I(t, e.value));
210
+ n >= 0 ? (t.splice(n, 1), C("remove", e)) : (t.push(e.value), C("select", e)), w.value = t;
211
+ } else w.value = e.value, C("select", e), J();
199
212
  }
200
- }, J = (e) => {
201
- C.value = x.multiple ? P.value.filter((t) => !F(t, e.value)) : null, S("remove", e);
202
- }, et = () => {
203
- let e = H.value;
204
- if (!U.value || !e) return;
213
+ }, it = (e) => {
214
+ w.value = S.multiple ? F.value.filter((t) => !I(t, e.value)) : null, C("remove", e);
215
+ }, at = () => {
216
+ let e = U.value;
217
+ if (!W.value || !e) return;
205
218
  let t = e, n = {
206
219
  value: t,
207
220
  label: e
208
221
  };
209
- x.multiple ? (C.value = [...P.value, t], j.value = "") : (C.value = t, q()), S("select", n), S("create", e);
210
- }, tt = () => {
211
- R.value.forEach((e) => S("remove", e)), C.value = x.multiple ? [] : null, O.value?.focus();
212
- }, Y = "", nt, X = () => f(() => k.value?.querySelector(`#${CSS.escape(V(M.value))}`)?.scrollIntoView({ block: "nearest" })), rt = (e) => {
213
- let t = W.value + 1;
222
+ S.multiple ? (w.value = [...F.value, t], M.value = "") : (w.value = t, J()), C("select", n), C("create", e);
223
+ }, ot = () => {
224
+ z.value.forEach((e) => C("remove", e)), w.value = S.multiple ? [] : null, A.value?.focus();
225
+ }, Y = "", st, X = () => ne(() => j.value?.querySelector(`#${CSS.escape(H(N.value))}`)?.scrollIntoView({ block: "nearest" })), ct = (e) => {
226
+ let t = G.value + 1;
214
227
  if (!t) return;
215
- let n = M.value;
216
- for (let r = 0; r < t && (n = (n + e + t) % t, B.value[n]?.disabled); r++);
217
- M.value = n, X();
218
- }, it = (e) => {
219
- if (x.disabled) return;
228
+ let n = N.value;
229
+ for (let r = 0; r < t && (n = (n + e + t) % t, V.value[n]?.disabled); r++);
230
+ N.value = n, X();
231
+ }, lt = (e) => {
232
+ if (S.disabled) return;
220
233
  let t = e.key;
221
- if (!A.value) {
234
+ if (!T.value) {
222
235
  [
223
236
  "Enter",
224
237
  " ",
225
238
  "ArrowDown",
226
239
  "ArrowUp"
227
- ].includes(t) ? (e.preventDefault(), Ze()) : t === "Backspace" && x.multiple && z.value && e.target === O.value && J(R.value[R.value.length - 1]);
240
+ ].includes(t) ? (e.preventDefault(), et()) : t === "Backspace" && S.multiple && B.value && e.target === A.value && it(z.value[z.value.length - 1]);
228
241
  return;
229
242
  }
230
- if (t === "ArrowDown") e.preventDefault(), rt(1);
231
- else if (t === "ArrowUp") e.preventDefault(), rt(-1);
232
- else if (t === "Home") e.preventDefault(), M.value = K(), X();
233
- else if (t === "End") e.preventDefault(), M.value = K(W.value, -1), X();
234
- else if (t === "Enter" || t === " " && !x.searchable) {
243
+ if (t === "ArrowDown") e.preventDefault(), ct(1);
244
+ else if (t === "ArrowUp") e.preventDefault(), ct(-1);
245
+ else if (t === "Home") e.preventDefault(), N.value = q(), X();
246
+ else if (t === "End") e.preventDefault(), N.value = q(G.value, -1), X();
247
+ else if (t === "Enter" || t === " " && !S.searchable) {
235
248
  e.preventDefault();
236
- let t = B.value[M.value];
237
- t ? $e(t) : U.value && et();
238
- } else if (t === "Escape") e.preventDefault(), q();
239
- else if (t === "Tab") q(!1);
240
- else if (!x.searchable && t.length === 1 && !e.metaKey && !e.ctrlKey) {
241
- Y += t.toLowerCase(), clearTimeout(nt), nt = setTimeout(() => Y = "", 500);
242
- let e = B.value.findIndex((e) => !e.disabled && e.label.toLowerCase().startsWith(Y));
243
- e >= 0 && (M.value = e, X());
249
+ let t = V.value[N.value];
250
+ t ? rt(t) : W.value && at();
251
+ } else if (t === "Escape") e.preventDefault(), J();
252
+ else if (t === "Tab") J(!1);
253
+ else if (!S.searchable && t.length === 1 && !e.metaKey && !e.ctrlKey) {
254
+ Y += t.toLowerCase(), clearTimeout(st), st = setTimeout(() => Y = "", 500);
255
+ let e = V.value.findIndex((e) => !e.disabled && e.label.toLowerCase().startsWith(Y));
256
+ e >= 0 && (N.value = e, X());
244
257
  }
245
- }, at = (e) => {
246
- let t = e.target;
247
- Ge.value?.contains(t) || k.value?.contains(t) || q(!1);
248
258
  }, Z = (e) => {
249
- e?.target instanceof Node && k.value?.contains(e.target) || Xe();
250
- }, ot = () => {
251
- document.removeEventListener("pointerdown", at, !0), window.removeEventListener("scroll", Z, !0), window.removeEventListener("resize", Z);
259
+ let t = e.target;
260
+ Je.value?.contains(t) || j.value?.contains(t) || J(!1);
261
+ }, Q = (e) => {
262
+ e?.target instanceof Node && j.value?.contains(e.target) || $e();
263
+ }, ut = () => {
264
+ document.removeEventListener("pointerdown", Z, !0), window.removeEventListener("scroll", Q, !0), window.removeEventListener("resize", Q);
252
265
  };
253
- ue(A, (e) => {
254
- if (!e) return ot();
255
- document.addEventListener("pointerdown", at, !0), window.addEventListener("scroll", Z, !0), window.addEventListener("resize", Z);
256
- }), ue(j, (e) => {
257
- S("search", e), M.value = K();
258
- }), re(ot);
259
- let Q = h(!1), st = i(() => A.value || Q.value), ct = i(() => [x.hint && Ue, x.errorMsg && We].filter(Boolean).join(" ") || void 0), $ = i(() => !x.multiple && R.value[0]?.label || "");
260
- return d({ focus: () => O.value?.focus() }), (i, d) => (m(), s("div", te({
266
+ b(T, (e) => {
267
+ if (e) return tt();
268
+ N.value = -1, ut();
269
+ }), b(M, (e) => {
270
+ C("search", e), N.value = q();
271
+ }), ae(() => T.value && tt()), ie(ut);
272
+ let $ = h(!1), dt = a(() => T.value || $.value), ft = a(() => [S.hint && Ke, S.errorMsg && qe].filter(Boolean).join(" ") || void 0), pt = a(() => !S.multiple && z.value[0]?.label || ""), mt = a(() => !S.multiple && Ue.selected && z.value[0] || null);
273
+ return f({ focus: () => A.value?.focus() }), (t, a) => (m(), c("div", te({
261
274
  ref_key: "root",
262
- ref: Ge
263
- }, Ve.value, {
264
- class: ["w-full", u.disabled && "opacity-50"],
275
+ ref: Je
276
+ }, We.value, {
277
+ class: ["w-full", d.disabled && "opacity-50"],
265
278
  "data-ac-ds": "",
266
279
  "data-testid": "ac-select"
267
280
  }), [
268
- u.label ? (m(), s("div", ye, [c("label", {
269
- id: D,
270
- onClick: d[0] ||= (e) => O.value?.focus()
271
- }, _(u.label), 1), u.required ? (m(), s("span", be, "*")) : o("", !0)])) : o("", !0),
272
- u.hint ? (m(), s("p", {
281
+ d.label ? (m(), c("div", be, [l("label", {
282
+ id: k,
283
+ onClick: a[0] ||= (e) => A.value?.focus()
284
+ }, v(d.label), 1), d.required ? (m(), c("span", xe, "*")) : s("", !0)])) : s("", !0),
285
+ d.hint ? (m(), c("p", {
273
286
  key: 1,
274
- id: Ue,
287
+ id: Ke,
275
288
  class: "mb-2 text-base text-muted"
276
- }, _(u.hint), 1)) : o("", !0),
277
- c("div", te({
278
- id: `${v(w)}-trigger`,
289
+ }, v(d.hint), 1)) : s("", !0),
290
+ l("div", te({
291
+ id: `${y(E)}-trigger`,
279
292
  ref_key: "trigger",
280
- ref: O
281
- }, He.value, {
293
+ ref: A
294
+ }, Ge.value, {
282
295
  role: "combobox",
283
- tabindex: u.disabled ? -1 : 0,
296
+ tabindex: d.disabled ? -1 : 0,
284
297
  "aria-haspopup": "listbox",
285
- "aria-expanded": A.value,
286
- "aria-controls": E,
287
- "aria-labelledby": u.label ? D : void 0,
288
- "aria-label": u.label ? void 0 : v(T)["aria-label"] ?? u.placeholder,
289
- "aria-describedby": ct.value,
290
- "aria-disabled": u.disabled || void 0,
291
- "aria-invalid": !!u.errorMsg || void 0,
292
- "aria-required": u.required || void 0,
293
- "aria-activedescendant": A.value && !u.searchable && M.value >= 0 ? V(M.value) : void 0,
298
+ "aria-expanded": T.value,
299
+ "aria-controls": O,
300
+ "aria-labelledby": d.label ? k : void 0,
301
+ "aria-label": d.label ? void 0 : y(D)["aria-label"] ?? d.placeholder,
302
+ "aria-describedby": ft.value,
303
+ "aria-disabled": d.disabled || void 0,
304
+ "aria-invalid": !!d.errorMsg || void 0,
305
+ "aria-required": d.required || void 0,
306
+ "aria-activedescendant": T.value && !d.searchable && N.value >= 0 ? H(N.value) : void 0,
307
+ "aria-busy": d.refreshing || void 0,
294
308
  class: ["group flex w-full items-center gap-2 rounded-10 border bg-background text-left text-base font-medium text-heading transition-[color,background-color,border-color,box-shadow] duration-200 outline-none", [
295
- u.size === "compact" ? "min-h-8 pr-1 pl-3" : u.size === "small" ? "min-h-9 pr-1 pl-4" : "min-h-10.5 pr-1 pl-5",
296
- u.multiple && z.value && (u.size === "normal" ? "py-1.5" : "py-1"),
297
- u.disabled || u.loading ? "cursor-not-allowed" : "cursor-pointer",
298
- u.errorMsg ? ["border-danger/50", st.value && "border-danger shadow-[0_0_0_2px_color-mix(in_srgb,var(--color-danger)_20%,transparent)]"] : st.value ? "focus-ring" : ["border-border", !u.disabled && "hover:border-accent-active"]
309
+ d.size === "compact" ? "min-h-8 pr-1 pl-3" : d.size === "small" ? "min-h-9 pr-1 pl-4" : "min-h-10.5 pr-1 pl-5",
310
+ d.multiple && B.value && (d.size === "normal" ? "py-1.5" : "py-1"),
311
+ d.disabled || d.loading ? "cursor-not-allowed" : "cursor-pointer",
312
+ d.errorMsg ? ["border-danger/50", dt.value && "border-danger shadow-[0_0_0_2px_color-mix(in_srgb,var(--color-danger)_20%,transparent)]"] : dt.value ? "focus-ring" : ["border-border", !d.disabled && "hover:border-accent-active"]
299
313
  ]],
300
- onClick: Qe,
301
- onKeydown: it,
302
- onFocus: d[2] ||= (e) => Q.value = !0,
303
- onBlur: d[3] ||= (e) => Q.value = !1
304
- }), [c("div", Se, [u.multiple && z.value ? (m(!0), s(t, { key: 0 }, g(R.value, (e, t) => (m(), s("span", {
305
- key: qe(e.value, t),
314
+ onClick: nt,
315
+ onKeydown: lt,
316
+ onFocus: a[2] ||= (e) => $.value = !0,
317
+ onBlur: a[3] ||= (e) => $.value = !1
318
+ }), [l("div", Ce, [d.multiple && B.value ? (m(!0), c(n, { key: 0 }, g(z.value, (e, t) => (m(), c("span", {
319
+ key: Xe(e.value, t),
306
320
  class: "inline-flex max-w-full items-center gap-2 rounded-10 bg-accent px-2 text-xs text-heading"
307
- }, [c("span", Ce, _(e.label), 1), c("button", {
321
+ }, [l("span", we, v(e.label), 1), l("button", {
308
322
  type: "button",
309
323
  class: "inline-flex shrink-0 cursor-pointer items-center justify-center rounded-full p-1 transition-colors hover:bg-accent-hover hover:text-primary focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
310
324
  "aria-label": `Remove ${e.label}`,
311
- disabled: u.disabled,
312
- onClick: y((t) => J(e), ["stop"])
313
- }, [l(v(ve), {
325
+ disabled: d.disabled,
326
+ onClick: x((t) => it(e), ["stop"])
327
+ }, [u(y(ye), {
314
328
  class: "size-4",
315
329
  "aria-hidden": "true"
316
- })], 8, we)]))), 128)) : $.value ? (m(), s("span", Te, _($.value), 1)) : (m(), s("span", Ee, _(u.placeholder), 1))]), c("span", De, [
317
- u.loading ? (m(), a(e, {
330
+ })], 8, Te)]))), 128)) : mt.value ? (m(), c("span", {
331
+ key: 1,
332
+ class: p(["min-w-0 flex-1", d.size === "normal" ? "py-2.5" : d.size === "small" ? "py-[7px]" : "py-[5px]"])
333
+ }, [_(t.$slots, "selected", { option: mt.value })], 2)) : pt.value ? (m(), c("span", Ee, v(pt.value), 1)) : (m(), c("span", De, v(d.placeholder), 1))]), l("span", Oe, [
334
+ d.loading ? (m(), o(e, {
318
335
  key: 0,
319
336
  class: "text-primary"
320
- })) : u.refreshable ? (m(), s("button", {
337
+ })) : d.refreshable ? (m(), c("button", {
321
338
  key: 1,
322
339
  type: "button",
323
340
  class: "inline-flex size-6 cursor-pointer items-center justify-center rounded-full transition-colors hover:bg-accent-hover hover:text-primary focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
324
341
  "aria-label": "Refresh options",
325
- disabled: u.disabled,
326
- onClick: d[1] ||= y((e) => S("refresh"), ["stop"])
327
- }, [l(v(_e), {
328
- class: "size-4",
342
+ disabled: d.disabled,
343
+ onClick: a[1] ||= x((e) => C("refresh"), ["stop"])
344
+ }, [u(y(ve), {
345
+ class: p(["size-4", d.refreshing && "motion-safe:animate-spin"]),
329
346
  "aria-hidden": "true"
330
- })], 8, Oe)) : o("", !0),
331
- u.clearable && z.value && !u.disabled && !u.loading ? (m(), s("button", {
347
+ }, null, 8, ["class"])], 8, ke)) : s("", !0),
348
+ d.clearable && B.value && !d.disabled && !d.loading ? (m(), c("button", {
332
349
  key: 2,
333
350
  type: "button",
334
351
  class: "inline-flex size-6 cursor-pointer items-center justify-center rounded-full transition-colors hover:bg-accent-hover hover:text-primary focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
335
352
  "aria-label": "Clear selection",
336
- onClick: y(tt, ["stop"])
337
- }, [l(v(ve), {
353
+ onClick: x(ot, ["stop"])
354
+ }, [u(y(ye), {
338
355
  class: "size-4",
339
356
  "aria-hidden": "true"
340
- })])) : o("", !0),
341
- c("span", ke, [(m(), a(ae(A.value ? v(he) : v(me)), { class: "size-4" }))])
342
- ])], 16, xe),
343
- u.errorMsg ? (m(), s("p", {
357
+ })])) : s("", !0),
358
+ l("span", Ae, [(m(), o(oe(T.value ? y(ge) : y(he)), { class: "size-4" }))])
359
+ ])], 16, Se),
360
+ d.errorMsg ? (m(), c("p", {
344
361
  key: 2,
345
- id: We,
362
+ id: qe,
346
363
  class: "mt-1 text-base text-danger-strong",
347
364
  role: "alert"
348
- }, _(u.errorMsg), 1)) : o("", !0),
349
- (m(), a(n, { to: "body" }, [l(r, {
365
+ }, v(d.errorMsg), 1)) : s("", !0),
366
+ (m(), o(r, { to: "body" }, [u(i, {
350
367
  "enter-active-class": "transition-opacity duration-100 ease-out motion-reduce:transition-none",
351
368
  "enter-from-class": "opacity-0",
352
369
  "leave-active-class": "transition-opacity duration-75 ease-in motion-reduce:transition-none",
353
370
  "leave-to-class": "opacity-0"
354
371
  }, {
355
- default: de(() => [A.value ? (m(), s("div", {
372
+ default: fe(() => [T.value ? (m(), c("div", {
356
373
  key: 0,
357
374
  ref_key: "panel",
358
- ref: k,
375
+ ref: j,
359
376
  class: "fixed z-[90] flex flex-col overflow-hidden rounded-10 border border-border bg-background shadow-lg",
360
- style: ne({
361
- top: N.value.top === void 0 ? void 0 : `${N.value.top}px`,
362
- bottom: N.value.bottom === void 0 ? void 0 : `${N.value.bottom}px`,
363
- left: `${N.value.left}px`,
364
- width: `${N.value.width}px`,
365
- maxHeight: `${N.value.maxHeight}px`
377
+ style: re({
378
+ top: P.value.top === void 0 ? void 0 : `${P.value.top}px`,
379
+ bottom: P.value.bottom === void 0 ? void 0 : `${P.value.bottom}px`,
380
+ left: `${P.value.left}px`,
381
+ width: `${P.value.width}px`,
382
+ maxHeight: `${P.value.maxHeight}px`
366
383
  }),
367
384
  "data-ac-ds": "",
368
385
  "data-testid": "ac-select-panel"
369
- }, [u.searchable ? (m(), s("div", Ae, [fe(c("input", {
386
+ }, [d.searchable ? (m(), c("div", je, [pe(l("input", {
370
387
  ref_key: "searchInput",
371
- ref: Ke,
372
- "onUpdate:modelValue": d[4] ||= (e) => j.value = e,
388
+ ref: Ye,
389
+ "onUpdate:modelValue": a[4] ||= (e) => M.value = e,
373
390
  type: "text",
374
391
  placeholder: "Search…",
375
392
  "aria-label": "Search options",
376
- "aria-controls": E,
377
- "aria-activedescendant": M.value >= 0 ? V(M.value) : void 0,
393
+ "aria-controls": O,
394
+ "aria-activedescendant": N.value >= 0 ? H(N.value) : void 0,
378
395
  class: "h-9.5 w-full rounded-10 border border-border bg-background px-3 text-base text-heading transition-[border-color,box-shadow] duration-200 outline-none placeholder:text-muted/80 hover:border-accent-active focus:focus-ring",
379
- onKeydown: it
380
- }, null, 40, je), [[le, j.value]])])) : o("", !0), c("ul", {
381
- id: E,
396
+ onKeydown: lt
397
+ }, null, 40, Me), [[de, M.value]])])) : s("", !0), l("ul", {
398
+ id: O,
382
399
  role: "listbox",
383
- "aria-multiselectable": u.multiple || void 0,
384
- "aria-labelledby": u.label ? D : void 0,
400
+ "aria-multiselectable": d.multiple || void 0,
401
+ "aria-labelledby": d.label ? k : void 0,
385
402
  class: "ac-scrollbar max-h-60 min-h-0 flex-1 p-1"
386
403
  }, [
387
- (m(!0), s(t, null, g(Ye.value, (e) => (m(), s(t, { key: e.name }, [e.name ? (m(), s("li", Ne, _(e.name), 1)) : o("", !0), (m(!0), s(t, null, g(e.items, ({ option: e, index: t }) => (m(), s("li", {
388
- id: V(t),
389
- key: qe(e.value, t),
404
+ (m(!0), c(n, null, g(Qe.value, (e) => (m(), c(n, { key: e.name }, [e.name ? (m(), c("li", Pe, v(e.name), 1)) : s("", !0), (m(!0), c(n, null, g(e.items, ({ option: e, index: n }) => (m(), c("li", {
405
+ id: H(n),
406
+ key: Xe(e.value, n),
390
407
  role: "option",
391
- "aria-selected": L(e),
408
+ "aria-selected": R(e),
392
409
  "aria-disabled": e.disabled || void 0,
393
- class: p(["flex cursor-pointer items-start gap-2.5 rounded-6 px-4 py-2 text-base text-heading transition-colors", [e.disabled && "cursor-not-allowed opacity-50", t === M.value ? "bg-accent-hover" : L(e) && "bg-accent"]]),
394
- onMouseenter: (n) => !e.disabled && (M.value = t),
395
- onMousedown: d[5] ||= y(() => {}, ["prevent"]),
396
- onClick: (t) => $e(e)
397
- }, [u.multiple ? (m(), s("span", {
410
+ class: p(["flex cursor-pointer items-start gap-2.5 rounded-6 px-4 py-2 text-base text-heading transition-colors", [e.disabled && "cursor-not-allowed opacity-50", n === N.value ? "bg-accent-hover" : R(e) && "bg-accent"]]),
411
+ onMouseenter: (t) => !e.disabled && (N.value = n),
412
+ onMousedown: a[5] ||= x(() => {}, ["prevent"]),
413
+ onClick: (t) => rt(e)
414
+ }, [d.multiple ? (m(), c("span", {
398
415
  key: 0,
399
- class: p(["mt-0.5 inline-flex size-4 shrink-0 items-center justify-center rounded-4 border transition-colors", L(e) ? "border-primary bg-primary text-white" : "border-muted/70 bg-surface"]),
416
+ class: p(["mt-0.5 inline-flex size-4 shrink-0 items-center justify-center rounded-4 border transition-colors", R(e) ? "border-primary bg-primary text-white" : "border-muted/70 bg-surface"]),
400
417
  "aria-hidden": "true"
401
- }, [L(e) ? (m(), a(v(pe), {
418
+ }, [R(e) ? (m(), o(y(me), {
402
419
  key: 0,
403
420
  class: "size-3",
404
421
  "stroke-width": 3,
405
422
  "aria-hidden": "true"
406
- })) : o("", !0)], 2)) : o("", !0), c("span", Fe, [ie(i.$slots, "option", {
423
+ })) : s("", !0)], 2)) : s("", !0), l("span", Ie, [_(t.$slots, "option", {
407
424
  option: e,
408
- selected: L(e),
409
- active: t === M.value
410
- }, () => [c("span", Ie, _(e.label), 1), e.description ? (m(), s("span", Le, _(e.description), 1)) : o("", !0)])])], 42, Pe))), 128))], 64))), 128)),
411
- U.value ? (m(), s("li", {
425
+ selected: R(e),
426
+ active: n === N.value
427
+ }, () => [l("span", Le, v(e.label), 1), e.description ? (m(), c("span", Re, v(e.description), 1)) : s("", !0)])])], 42, Fe))), 128))], 64))), 128)),
428
+ W.value ? (m(), c("li", {
412
429
  key: 0,
413
- id: V(G.value),
430
+ id: H(K.value),
414
431
  role: "option",
415
432
  "aria-selected": "false",
416
- class: p(["flex cursor-pointer items-center gap-2.5 rounded-6 px-4 py-2 text-base text-heading transition-colors", G.value === M.value && "bg-accent-hover"]),
433
+ class: p(["flex cursor-pointer items-center gap-2.5 rounded-6 px-4 py-2 text-base text-heading transition-colors", K.value === N.value && "bg-accent-hover"]),
417
434
  "data-testid": "ac-select-create",
418
- onMouseenter: d[6] ||= (e) => M.value = G.value,
419
- onMousedown: d[7] ||= y(() => {}, ["prevent"]),
420
- onClick: et
421
- }, [l(v(ge), {
435
+ onMouseenter: a[6] ||= (e) => N.value = K.value,
436
+ onMousedown: a[7] ||= x(() => {}, ["prevent"]),
437
+ onClick: at
438
+ }, [u(y(_e), {
422
439
  class: "size-4 shrink-0 text-primary-strong",
423
440
  "aria-hidden": "true"
424
- }), c("span", ze, _(u.createText) + " “" + _(H.value) + "”", 1)], 42, Re)) : o("", !0),
425
- !B.value.length && !U.value ? (m(), s("li", Be, [ie(i.$slots, "empty", { query: j.value }, () => [ee(_(j.value ? `${u.noResultText} for “${j.value}”` : "No options"), 1)])])) : o("", !0)
426
- ], 8, Me)], 4)) : o("", !0)]),
441
+ }), l("span", Be, v(d.createText) + " “" + v(U.value) + "”", 1)], 42, ze)) : s("", !0),
442
+ !V.value.length && !W.value ? (m(), c("li", Ve, [_(t.$slots, "empty", { query: M.value }, () => [ee(v(M.value ? `${d.noResultText} for “${M.value}”` : "No options"), 1)])])) : s("", !0)
443
+ ], 8, Ne)], 4)) : s("", !0)]),
427
444
  _: 3
428
445
  })]))
429
446
  ], 16));
430
447
  }
431
448
  });
432
449
  //#endregion
433
- export { b as default };
450
+ export { He as default };