@ac-design/design-system 2.3.0 → 2.4.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 (60) hide show
  1. package/dist/lib/compat.css +211 -0
  2. package/dist/lib/components/AcAppSwitcher.vue.d.ts +1 -1
  3. package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +23 -23
  4. package/dist/lib/components/AcAreaChart.vue.d.ts +1 -1
  5. package/dist/lib/components/AcBarChart.vue.d.ts +1 -1
  6. package/dist/lib/components/AcButton.vue.d.ts +7 -1
  7. package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +90 -69
  8. package/dist/lib/components/AcCellValue.vue.d.ts +3 -3
  9. package/dist/lib/components/AcCellValue.vue_vue_type_script_setup_true_lang.js +20 -20
  10. package/dist/lib/components/AcCheckBox.vue.d.ts +4 -1
  11. package/dist/lib/components/AcCheckBox.vue_vue_type_script_setup_true_lang.js +50 -50
  12. package/dist/lib/components/AcCircularProgress.vue.d.ts +1 -1
  13. package/dist/lib/components/AcCodeEditor.vue.d.ts +12 -0
  14. package/dist/lib/components/AcCodeEditor.vue_vue_type_script_setup_true_lang.js +240 -207
  15. package/dist/lib/components/AcColorInput.vue.d.ts +3 -3
  16. package/dist/lib/components/AcColorInput.vue_vue_type_script_setup_true_lang.js +72 -66
  17. package/dist/lib/components/AcCostSummary.vue.d.ts +1 -1
  18. package/dist/lib/components/AcDatePicker.vue.d.ts +14 -7
  19. package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +417 -372
  20. package/dist/lib/components/AcDeleteModal.vue.d.ts +1 -1
  21. package/dist/lib/components/AcDonutChart.vue.d.ts +2 -2
  22. package/dist/lib/components/AcDropdown.vue.d.ts +1 -1
  23. package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +8 -8
  24. package/dist/lib/components/AcFormFooter.vue_vue_type_script_setup_true_lang.js +8 -8
  25. package/dist/lib/components/AcGraphChart.vue.d.ts +2 -2
  26. package/dist/lib/components/AcInput.vue.d.ts +75 -54
  27. package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +253 -89
  28. package/dist/lib/components/AcKeyValueInput.vue.d.ts +34 -54
  29. package/dist/lib/components/AcKeyValueInput.vue_vue_type_script_setup_true_lang.js +134 -106
  30. package/dist/lib/components/AcLineChart.vue.d.ts +1 -1
  31. package/dist/lib/components/AcMapChart.vue.d.ts +2 -2
  32. package/dist/lib/components/AcModal.vue.d.ts +1 -1
  33. package/dist/lib/components/AcNotificationMenu.vue.d.ts +1 -1
  34. package/dist/lib/components/AcNotificationMenu.vue_vue_type_script_setup_true_lang.js +24 -24
  35. package/dist/lib/components/AcNumberInput.vue.d.ts +55 -45
  36. package/dist/lib/components/AcNumberInput.vue_vue_type_script_setup_true_lang.js +159 -99
  37. package/dist/lib/components/AcRadioCard.vue.d.ts +2 -2
  38. package/dist/lib/components/AcRadioCard.vue_vue_type_script_setup_true_lang.js +1 -1
  39. package/dist/lib/components/AcSelect.vue.d.ts +35 -6
  40. package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +272 -176
  41. package/dist/lib/components/AcSidePanel.vue.d.ts +1 -1
  42. package/dist/lib/components/AcSlider.vue.d.ts +2 -2
  43. package/dist/lib/components/AcSwitch.vue_vue_type_script_setup_true_lang.js +23 -23
  44. package/dist/lib/components/AcTable.vue.d.ts +37 -4
  45. package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +239 -131
  46. package/dist/lib/components/AcTagInput.vue.d.ts +22 -3
  47. package/dist/lib/components/AcTagInput.vue_vue_type_script_setup_true_lang.js +126 -114
  48. package/dist/lib/components/AcTaintInput.js +5 -0
  49. package/dist/lib/components/AcTaintInput.vue.d.ts +44 -0
  50. package/dist/lib/components/AcTaintInput.vue_vue_type_script_setup_true_lang.js +208 -0
  51. package/dist/lib/components/AcTextarea.vue.d.ts +38 -4
  52. package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +113 -53
  53. package/dist/lib/components/AcTimePicker.vue.d.ts +15 -8
  54. package/dist/lib/components/AcTimePicker.vue_vue_type_script_setup_true_lang.js +102 -70
  55. package/dist/lib/components/AcTooltip.vue.d.ts +3 -3
  56. package/dist/lib/components/index.d.ts +1 -0
  57. package/dist/lib/composables/useToast.d.ts +2 -2
  58. package/dist/lib/index.d.ts +2 -1
  59. package/dist/lib/index.js +31 -30
  60. package/package.json +1 -1
@@ -7,10 +7,13 @@ var be = {
7
7
  key: 0,
8
8
  class: "mb-2 flex items-center gap-1 text-base font-medium text-heading"
9
9
  }, xe = {
10
- key: 0,
10
+ key: 1,
11
+ class: "text-muted"
12
+ }, Se = {
13
+ key: 2,
11
14
  class: "text-danger",
12
15
  "aria-hidden": "true"
13
- }, Se = [
16
+ }, Ce = [
14
17
  "id",
15
18
  "tabindex",
16
19
  "aria-expanded",
@@ -19,43 +22,44 @@ var be = {
19
22
  "aria-describedby",
20
23
  "aria-disabled",
21
24
  "aria-invalid",
25
+ "aria-readonly",
22
26
  "aria-required",
23
27
  "aria-activedescendant",
24
28
  "aria-busy"
25
- ], Ce = { class: "flex min-w-0 flex-1 flex-wrap items-center gap-2" }, we = { class: "truncate" }, Te = [
29
+ ], we = { class: "flex min-w-0 flex-1 flex-wrap items-center gap-2" }, Te = { class: "truncate" }, Ee = [
26
30
  "aria-label",
27
31
  "disabled",
28
32
  "onClick"
29
- ], Ee = {
33
+ ], De = {
30
34
  key: 2,
31
35
  class: "truncate"
32
- }, De = {
36
+ }, Oe = {
33
37
  key: 3,
34
38
  class: "truncate text-muted"
35
- }, Oe = { class: "flex shrink-0 items-center gap-1 text-muted" }, ke = ["disabled"], Ae = {
39
+ }, ke = { class: "flex shrink-0 items-center gap-1 text-muted" }, Ae = ["disabled"], je = {
36
40
  class: "inline-flex rounded-full p-1 transition-colors hover:bg-accent-hover hover:text-primary",
37
41
  "aria-hidden": "true"
38
- }, je = {
42
+ }, Me = {
39
43
  key: 0,
40
44
  class: "border-b border-border p-3"
41
- }, Me = ["aria-activedescendant"], Ne = ["aria-multiselectable", "aria-labelledby"], Pe = {
45
+ }, Ne = ["aria-activedescendant"], Pe = ["aria-multiselectable", "aria-labelledby"], Fe = {
42
46
  key: 0,
43
47
  role: "presentation",
44
48
  class: "px-4 pt-2 pb-1 text-sm font-semibold tracking-[0.08em] text-muted uppercase"
45
- }, Fe = [
49
+ }, Ie = [
46
50
  "id",
47
51
  "aria-selected",
48
52
  "aria-disabled",
49
53
  "onMouseenter",
50
54
  "onClick"
51
- ], Ie = { class: "min-w-0 flex-1" }, Le = { class: "block truncate" }, Re = {
55
+ ], Le = { class: "min-w-0 flex-1" }, Re = { class: "block truncate" }, ze = {
52
56
  key: 0,
53
57
  class: "block truncate text-xs font-normal text-muted"
54
- }, ze = ["id"], Be = { class: "min-w-0 flex-1 truncate" }, Ve = {
58
+ }, Be = ["id"], Ve = { class: "min-w-0 flex-1 truncate" }, He = {
55
59
  key: 1,
56
60
  role: "presentation",
57
61
  class: "px-4 py-3 text-center text-base text-muted"
58
- }, He = /*@__PURE__*/ d({
62
+ }, Ue = /*@__PURE__*/ d({
59
63
  inheritAttrs: !1,
60
64
  __name: "AcSelect",
61
65
  props: /*@__PURE__*/ f({
@@ -106,6 +110,37 @@ var be = {
106
110
  errorMsg: { default: "" },
107
111
  hint: { default: "" },
108
112
  size: { default: "normal" },
113
+ variant: { default: "outline" },
114
+ highlight: {
115
+ type: Boolean,
116
+ default: !1
117
+ },
118
+ readonly: {
119
+ type: Boolean,
120
+ default: !1
121
+ },
122
+ validateRequired: {
123
+ type: Boolean,
124
+ default: !1
125
+ },
126
+ hideUnknownValues: {
127
+ type: Boolean,
128
+ default: !1
129
+ },
130
+ emptyValue: { default: null },
131
+ initEmptyArray: {
132
+ type: Boolean,
133
+ default: !1
134
+ },
135
+ emptyText: { default: "" },
136
+ hideRefreshWhenDisabled: {
137
+ type: Boolean,
138
+ default: !1
139
+ },
140
+ looseChips: {
141
+ type: Boolean,
142
+ default: !1
143
+ },
109
144
  noResultText: { default: "No results" },
110
145
  placement: { default: "bottom" }
111
146
  }, {
@@ -122,47 +157,90 @@ var be = {
122
157
  "create",
123
158
  "remove",
124
159
  "search",
125
- "refresh"
160
+ "refresh",
161
+ "change"
126
162
  ], ["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;
163
+ setup(d, { expose: f, emit: Ue }) {
164
+ let S = d, C = Ue, w = ue(), T = le(d, "modelValue"), E = (e) => T.value = e, D = le(d, "open"), We = {
165
+ xs: {
166
+ field: "min-h-[26px] pr-1 pl-2 text-xs",
167
+ chips: ["py-0", "py-1"],
168
+ custom: "py-1"
169
+ },
170
+ compact: {
171
+ field: "min-h-8 pr-1 pl-3 text-base",
172
+ chips: ["py-1", "py-1"],
173
+ custom: "py-[5px]"
174
+ },
175
+ xsmall: {
176
+ field: "min-h-[34px] pr-1 pl-3 text-base",
177
+ chips: ["py-1", "py-1.5"],
178
+ custom: "py-1.5"
179
+ },
180
+ small: {
181
+ field: "min-h-9 pr-1 pl-4 text-base",
182
+ chips: ["py-1", "py-1.5"],
183
+ custom: "py-[7px]"
184
+ },
185
+ medium: {
186
+ field: "min-h-[38px] pr-1 pl-4 text-base",
187
+ chips: ["py-1", "py-2"],
188
+ custom: "py-2"
189
+ },
190
+ normal: {
191
+ field: "min-h-10.5 pr-1 pl-5 text-base",
192
+ chips: ["py-1.5", "py-2.5"],
193
+ custom: "py-2.5"
194
+ },
195
+ large: {
196
+ field: "min-h-[50px] pr-1 pl-6 text-lg",
197
+ chips: ["py-1.5", "py-3"],
198
+ custom: "py-3"
199
+ }
200
+ }, O = ce(), k = se(), Ge = a(() => ({
201
+ class: k.class,
202
+ style: k.style
203
+ })), Ke = a(() => {
204
+ let { class: e, style: t, ...n } = k;
133
205
  return n;
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({
206
+ }), A = `${O}-list`, qe = `${O}-label`, Je = `${O}-hint`, Ye = `${O}-msg`, Xe = h(null), j = h(null), M = h(null), Ze = h(null), N = h(""), P = h(-1), F = h({
135
207
  left: 0,
136
208
  width: 0,
137
209
  maxHeight: 288
138
- }), F = a(() => {
139
- let e = w.value;
140
- return e == null || e === "" ? [] : Array.isArray(e) ? e : [e];
141
- }), I = (e, t) => {
210
+ }), I = a(() => {
211
+ let e = T.value;
212
+ if (e == null || e === "") return [];
213
+ let t = Array.isArray(e) ? e : [e];
214
+ return S.hideUnknownValues ? t.filter((e) => S.options.some((t) => L(t.value, e))) : t;
215
+ }), L = (e, t) => {
142
216
  let n = S.by;
143
217
  return typeof n == "function" ? n(e, t) : n && e && t && typeof e == "object" && typeof t == "object" ? e[n] === t[n] : e === t;
144
- }, L = (e) => {
218
+ }, R = (e) => {
145
219
  let t = S.by;
146
220
  return String(typeof t == "string" && e && typeof e == "object" ? e[t] : e);
147
- }, Xe = (e, t) => {
221
+ }, Qe = (e, t) => {
148
222
  let n = S.by;
149
223
  return e && typeof e == "object" ? typeof n == "string" ? String(e[n]) : `i${t}` : String(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)) ?? {
224
+ }, z = (e) => I.value.some((t) => L(t, e.value)), B = a(() => I.value.map((e) => S.options.find((t) => L(t.value, e)) ?? {
151
225
  value: e,
152
- label: L(e)
153
- })), B = a(() => F.value.length > 0), Ze = (e) => {
226
+ label: R(e)
227
+ })), V = a(() => I.value.length > 0), H = h(""), U = a(() => H.value || S.errorMsg);
228
+ function $e() {
229
+ S.validateRequired && S.required && !V.value ? H.value = `This field is required. Please select ${S.multiple ? "at least one option" : "an option"}.` : H.value = "";
230
+ }
231
+ let et = (e) => {
154
232
  if (!e.some((e) => e.group)) return e;
155
233
  let t = [];
156
234
  return e.forEach((e) => {
157
235
  let n = e.group ?? "";
158
236
  t.includes(n) || t.push(n);
159
237
  }), [...e].sort((e, n) => t.indexOf(e.group ?? "") - t.indexOf(n.group ?? ""));
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(() => {
238
+ }, W = a(() => {
239
+ let e = N.value.trim().toLowerCase();
240
+ return et(e ? S.options.filter((t) => t.label.toLowerCase().includes(e) || t.description?.toLowerCase().includes(e) || t.group?.toLowerCase().includes(e)) : S.options);
241
+ }), tt = a(() => {
164
242
  let e = [];
165
- return V.value.forEach((t, n) => {
243
+ return W.value.forEach((t, n) => {
166
244
  let r = t.group ?? "", i = e.find((e) => e.name === r);
167
245
  i || e.push(i = {
168
246
  name: r,
@@ -172,16 +250,16 @@ var be = {
172
250
  index: n
173
251
  });
174
252
  }), e;
175
- }), H = (e) => `${E}-opt-${e}`, U = a(() => M.value.trim()), W = a(() => {
176
- let e = U.value.toLowerCase();
253
+ }), G = (e) => `${O}-opt-${e}`, K = a(() => N.value.trim()), q = a(() => {
254
+ let e = K.value.toLowerCase();
177
255
  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);
256
+ let t = S.options.some((t) => t.label.toLowerCase() === e || R(t.value).toLowerCase() === e), n = I.value.some((t) => R(t).toLowerCase() === e);
179
257
  return !t && !n;
180
- }), G = a(() => V.value.length + +!!W.value - 1), K = a(() => V.value.length), $e = () => {
181
- let e = A.value;
258
+ }), J = a(() => W.value.length + +!!q.value - 1), Y = a(() => W.value.length), nt = () => {
259
+ let e = j.value;
182
260
  if (!e) return;
183
261
  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 ? {
262
+ F.value = l ? {
185
263
  bottom: r.bottom - n.top + 4,
186
264
  left: n.left - r.left,
187
265
  width: n.width,
@@ -192,149 +270,167 @@ var be = {
192
270
  width: n.width,
193
271
  maxHeight: Math.min(288, i)
194
272
  };
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;
273
+ }, X = (e = 0, t = 1) => {
274
+ for (let n = e; n >= 0 && n <= J.value; n += t) if (!W.value[n]?.disabled) return n;
197
275
  return -1;
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) => {
276
+ }, rt = () => {
277
+ S.disabled || S.loading || S.readonly || D.value || (D.value = !0);
278
+ }, it = async () => {
279
+ N.value = "", nt();
280
+ let e = W.value.findIndex((e) => z(e));
281
+ P.value = e >= 0 ? e : X(), document.addEventListener("pointerdown", mt, !0), window.addEventListener("scroll", $, !0), window.addEventListener("resize", $), await ne(), S.searchable && Ze.value?.focus(), Q();
282
+ }, Z = (e = !0) => {
283
+ D.value && (D.value = !1, P.value = -1, e && j.value?.focus());
284
+ }, at = () => D.value ? Z() : rt(), ot = (e) => {
207
285
  if (!e.disabled) {
208
286
  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();
287
+ let t = [...I.value], n = t.findIndex((t) => L(t, e.value));
288
+ n >= 0 ? (t.splice(n, 1), C("remove", e)) : (t.push(e.value), C("select", e)), E(t);
289
+ } else E(e.value), C("select", e), Z();
212
290
  }
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;
291
+ }, st = (e) => {
292
+ E(S.multiple ? I.value.filter((t) => !L(t, e.value)) : S.emptyValue), C("remove", e);
293
+ }, ct = () => {
294
+ let e = K.value;
295
+ if (!q.value || !e) return;
218
296
  let t = e, n = {
219
297
  value: t,
220
298
  label: e
221
299
  };
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;
300
+ S.multiple ? (E([...I.value, t]), N.value = "") : (E(t), Z()), C("select", n), C("create", e);
301
+ }, lt = () => {
302
+ B.value.forEach((e) => C("remove", e)), E(S.multiple ? [] : S.emptyValue), j.value?.focus();
303
+ }, ut = "", dt, Q = () => ne(() => M.value?.querySelector(`#${CSS.escape(G(P.value))}`)?.scrollIntoView({ block: "nearest" })), ft = (e) => {
304
+ let t = J.value + 1;
227
305
  if (!t) 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;
306
+ let n = P.value;
307
+ for (let r = 0; r < t && (n = (n + e + t) % t, W.value[n]?.disabled); r++);
308
+ P.value = n, Q();
309
+ }, pt = (e) => {
310
+ if (S.disabled || S.readonly) return;
233
311
  let t = e.key;
234
- if (!T.value) {
312
+ if (!D.value) {
235
313
  [
236
314
  "Enter",
237
315
  " ",
238
316
  "ArrowDown",
239
317
  "ArrowUp"
240
- ].includes(t) ? (e.preventDefault(), et()) : t === "Backspace" && S.multiple && B.value && e.target === A.value && it(z.value[z.value.length - 1]);
318
+ ].includes(t) ? (e.preventDefault(), rt()) : t === "Backspace" && S.multiple && V.value && e.target === j.value && st(B.value[B.value.length - 1]);
241
319
  return;
242
320
  }
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();
321
+ if (t === "ArrowDown") e.preventDefault(), ft(1);
322
+ else if (t === "ArrowUp") e.preventDefault(), ft(-1);
323
+ else if (t === "Home") e.preventDefault(), P.value = X(), Q();
324
+ else if (t === "End") e.preventDefault(), P.value = X(J.value, -1), Q();
247
325
  else if (t === "Enter" || t === " " && !S.searchable) {
248
326
  e.preventDefault();
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);
327
+ let t = W.value[P.value];
328
+ t ? ot(t) : q.value && ct();
329
+ } else if (t === "Escape") e.preventDefault(), Z();
330
+ else if (t === "Tab") Z(!1);
253
331
  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());
332
+ ut += t.toLowerCase(), clearTimeout(dt), dt = setTimeout(() => ut = "", 500);
333
+ let e = W.value.findIndex((e) => !e.disabled && e.label.toLowerCase().startsWith(ut));
334
+ e >= 0 && (P.value = e, Q());
257
335
  }
258
- }, Z = (e) => {
336
+ }, mt = (e) => {
259
337
  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);
338
+ Xe.value?.contains(t) || M.value?.contains(t) || Z(!1);
339
+ }, $ = (e) => {
340
+ e?.target instanceof Node && M.value?.contains(e.target) || nt();
341
+ }, ht = () => {
342
+ document.removeEventListener("pointerdown", mt, !0), window.removeEventListener("scroll", $, !0), window.removeEventListener("resize", $);
265
343
  };
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({
344
+ b(D, (e) => {
345
+ if (e) return it();
346
+ P.value = -1, ht(), $e();
347
+ }), b(() => T.value, (e) => {
348
+ $e(), C("change", e);
349
+ }), b(N, (e) => {
350
+ C("search", e), P.value = X();
351
+ }), ae(() => {
352
+ S.initEmptyArray && S.multiple && !T.value && E([]), D.value && it();
353
+ }), ie(ht);
354
+ let gt = h(!1), _t = a(() => D.value || gt.value), vt = a(() => [S.hint && Je, U.value && Ye].filter(Boolean).join(" ") || void 0), yt = a(() => !S.multiple && B.value[0]?.label || ""), bt = a(() => !S.multiple && (w.selected || w.content) && B.value[0] || null), xt = a(() => !!(S.label || S.readonly || w["label-icon"] || w["label-extra"])), St = a(() => We[S.size] ?? We.normal), Ct = a(() => S.readonly ? "bg-surface-muted" : S.variant === "soft" ? "bg-accent" : S.variant === "ghost" ? "bg-transparent" : "bg-background"), wt = a(() => S.variant !== "outline");
355
+ return f({ focus: () => j.value?.focus() }), (t, a) => (m(), c("div", te({
274
356
  ref_key: "root",
275
- ref: Je
276
- }, We.value, {
357
+ ref: Xe
358
+ }, Ge.value, {
277
359
  class: ["w-full", d.disabled && "opacity-50"],
278
360
  "data-ac-ds": "",
279
361
  "data-testid": "ac-select"
280
362
  }), [
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),
363
+ xt.value ? (m(), c("div", be, [
364
+ _(t.$slots, "label-icon"),
365
+ d.label ? (m(), c("label", {
366
+ key: 0,
367
+ id: qe,
368
+ onClick: a[0] ||= (e) => j.value?.focus()
369
+ }, v(d.label), 1)) : s("", !0),
370
+ d.readonly ? (m(), c("span", xe, "(read only)")) : s("", !0),
371
+ _(t.$slots, "label-extra"),
372
+ d.required ? (m(), c("span", Se, "*")) : s("", !0)
373
+ ])) : s("", !0),
285
374
  d.hint ? (m(), c("p", {
286
375
  key: 1,
287
- id: Ke,
376
+ id: Je,
288
377
  class: "mb-2 text-base text-muted"
289
378
  }, v(d.hint), 1)) : s("", !0),
290
379
  l("div", te({
291
- id: `${y(E)}-trigger`,
380
+ id: `${y(O)}-trigger`,
292
381
  ref_key: "trigger",
293
- ref: A
294
- }, Ge.value, {
382
+ ref: j
383
+ }, Ke.value, {
295
384
  role: "combobox",
296
385
  tabindex: d.disabled ? -1 : 0,
297
386
  "aria-haspopup": "listbox",
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,
387
+ "aria-expanded": D.value,
388
+ "aria-controls": A,
389
+ "aria-labelledby": d.label ? qe : void 0,
390
+ "aria-label": d.label ? void 0 : y(k)["aria-label"] ?? d.placeholder,
391
+ "aria-describedby": vt.value,
303
392
  "aria-disabled": d.disabled || void 0,
304
- "aria-invalid": !!d.errorMsg || void 0,
393
+ "aria-invalid": !!U.value || void 0,
394
+ "aria-readonly": d.readonly || void 0,
305
395
  "aria-required": d.required || void 0,
306
- "aria-activedescendant": T.value && !d.searchable && N.value >= 0 ? H(N.value) : void 0,
396
+ "aria-activedescendant": D.value && !d.searchable && P.value >= 0 ? G(P.value) : void 0,
307
397
  "aria-busy": d.refreshing || void 0,
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", [
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"]
398
+ class: ["group flex w-full items-center gap-2 rounded-10 border text-left font-medium text-heading transition-[color,background-color,border-color,box-shadow] duration-200 outline-none", [
399
+ St.value.field,
400
+ Ct.value,
401
+ d.multiple && V.value && St.value.chips[+!!d.looseChips],
402
+ d.disabled || d.loading || d.readonly ? "cursor-not-allowed" : "cursor-pointer",
403
+ d.highlight && "ring-2 ring-primary/20 ring-offset-2 ring-offset-surface",
404
+ U.value ? ["border-danger/50", _t.value && "border-danger shadow-[0_0_0_2px_color-mix(in_srgb,var(--color-danger)_20%,transparent)]"] : wt.value ? [
405
+ "border-transparent",
406
+ _t.value && "shadow-[0_0_0_2px_color-mix(in_srgb,var(--color-primary)_20%,transparent)]",
407
+ d.variant === "soft" && !d.disabled && "hover:bg-accent-hover"
408
+ ] : _t.value ? "focus-ring" : ["border-border", !d.disabled && !d.readonly && "hover:border-accent-active"]
313
409
  ]],
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),
410
+ onClick: at,
411
+ onKeydown: pt,
412
+ onFocus: a[2] ||= (e) => gt.value = !0,
413
+ onBlur: a[3] ||= (e) => gt.value = !1
414
+ }), [l("div", we, [d.multiple && V.value ? (m(!0), c(n, { key: 0 }, g(B.value, (e, t) => (m(), c("span", {
415
+ key: Qe(e.value, t),
320
416
  class: "inline-flex max-w-full items-center gap-2 rounded-10 bg-accent px-2 text-xs text-heading"
321
- }, [l("span", we, v(e.label), 1), l("button", {
417
+ }, [l("span", Te, v(e.label), 1), l("button", {
322
418
  type: "button",
323
419
  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",
324
420
  "aria-label": `Remove ${e.label}`,
325
421
  disabled: d.disabled,
326
- onClick: x((t) => it(e), ["stop"])
422
+ onClick: x((t) => st(e), ["stop"])
327
423
  }, [u(y(ye), {
328
424
  class: "size-4",
329
425
  "aria-hidden": "true"
330
- })], 8, Te)]))), 128)) : mt.value ? (m(), c("span", {
426
+ })], 8, Ee)]))), 128)) : bt.value ? (m(), c("span", {
331
427
  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, [
428
+ class: p(["min-w-0 flex-1", St.value.custom])
429
+ }, [_(t.$slots, "selected", { option: bt.value }, () => [_(t.$slots, "content", { option: bt.value })])], 2)) : yt.value ? (m(), c("span", De, v(yt.value), 1)) : (m(), c("span", Oe, v(d.placeholder), 1))]), l("span", ke, [
334
430
  d.loading ? (m(), o(e, {
335
431
  key: 0,
336
432
  class: "text-primary"
337
- })) : d.refreshable ? (m(), c("button", {
433
+ })) : d.refreshable && !(d.disabled && d.hideRefreshWhenDisabled) ? (m(), c("button", {
338
434
  key: 1,
339
435
  type: "button",
340
436
  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",
@@ -344,107 +440,107 @@ var be = {
344
440
  }, [u(y(ve), {
345
441
  class: p(["size-4", d.refreshing && "motion-safe:animate-spin"]),
346
442
  "aria-hidden": "true"
347
- }, null, 8, ["class"])], 8, ke)) : s("", !0),
348
- d.clearable && B.value && !d.disabled && !d.loading ? (m(), c("button", {
443
+ }, null, 8, ["class"])], 8, Ae)) : s("", !0),
444
+ d.clearable && V.value && !d.disabled && !d.loading && !d.readonly ? (m(), c("button", {
349
445
  key: 2,
350
446
  type: "button",
351
447
  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",
352
448
  "aria-label": "Clear selection",
353
- onClick: x(ot, ["stop"])
449
+ onClick: x(lt, ["stop"])
354
450
  }, [u(y(ye), {
355
451
  class: "size-4",
356
452
  "aria-hidden": "true"
357
453
  })])) : 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", {
454
+ l("span", je, [(m(), o(oe(D.value ? y(ge) : y(he)), { class: "size-4" }))])
455
+ ])], 16, Ce),
456
+ U.value ? (m(), c("p", {
361
457
  key: 2,
362
- id: qe,
458
+ id: Ye,
363
459
  class: "mt-1 text-base text-danger-strong",
364
460
  role: "alert"
365
- }, v(d.errorMsg), 1)) : s("", !0),
461
+ }, v(U.value), 1)) : s("", !0),
366
462
  (m(), o(r, { to: "body" }, [u(i, {
367
463
  "enter-active-class": "transition-opacity duration-100 ease-out motion-reduce:transition-none",
368
464
  "enter-from-class": "opacity-0",
369
465
  "leave-active-class": "transition-opacity duration-75 ease-in motion-reduce:transition-none",
370
466
  "leave-to-class": "opacity-0"
371
467
  }, {
372
- default: fe(() => [T.value ? (m(), c("div", {
468
+ default: fe(() => [D.value ? (m(), c("div", {
373
469
  key: 0,
374
470
  ref_key: "panel",
375
- ref: j,
471
+ ref: M,
376
472
  class: "fixed z-[90] flex flex-col overflow-hidden rounded-10 border border-border bg-background shadow-lg",
377
473
  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`
474
+ top: F.value.top === void 0 ? void 0 : `${F.value.top}px`,
475
+ bottom: F.value.bottom === void 0 ? void 0 : `${F.value.bottom}px`,
476
+ left: `${F.value.left}px`,
477
+ width: `${F.value.width}px`,
478
+ maxHeight: `${F.value.maxHeight}px`
383
479
  }),
384
480
  "data-ac-ds": "",
385
481
  "data-testid": "ac-select-panel"
386
- }, [d.searchable ? (m(), c("div", je, [pe(l("input", {
482
+ }, [d.searchable ? (m(), c("div", Me, [pe(l("input", {
387
483
  ref_key: "searchInput",
388
- ref: Ye,
389
- "onUpdate:modelValue": a[4] ||= (e) => M.value = e,
484
+ ref: Ze,
485
+ "onUpdate:modelValue": a[4] ||= (e) => N.value = e,
390
486
  type: "text",
391
487
  placeholder: "Search…",
392
488
  "aria-label": "Search options",
393
- "aria-controls": O,
394
- "aria-activedescendant": N.value >= 0 ? H(N.value) : void 0,
489
+ "aria-controls": A,
490
+ "aria-activedescendant": P.value >= 0 ? G(P.value) : void 0,
395
491
  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",
396
- onKeydown: lt
397
- }, null, 40, Me), [[de, M.value]])])) : s("", !0), l("ul", {
398
- id: O,
492
+ onKeydown: pt
493
+ }, null, 40, Ne), [[de, N.value]])])) : s("", !0), l("ul", {
494
+ id: A,
399
495
  role: "listbox",
400
496
  "aria-multiselectable": d.multiple || void 0,
401
- "aria-labelledby": d.label ? k : void 0,
497
+ "aria-labelledby": d.label ? qe : void 0,
402
498
  class: "ac-scrollbar max-h-60 min-h-0 flex-1 p-1"
403
499
  }, [
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),
500
+ (m(!0), c(n, null, g(tt.value, (e) => (m(), c(n, { key: e.name }, [e.name ? (m(), c("li", Fe, v(e.name), 1)) : s("", !0), (m(!0), c(n, null, g(e.items, ({ option: e, index: n }) => (m(), c("li", {
501
+ id: G(n),
502
+ key: Qe(e.value, n),
407
503
  role: "option",
408
- "aria-selected": R(e),
504
+ "aria-selected": z(e),
409
505
  "aria-disabled": e.disabled || void 0,
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),
506
+ 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 === P.value ? "bg-accent-hover" : z(e) && "bg-accent"]]),
507
+ onMouseenter: (t) => !e.disabled && (P.value = n),
412
508
  onMousedown: a[5] ||= x(() => {}, ["prevent"]),
413
- onClick: (t) => rt(e)
509
+ onClick: (t) => ot(e)
414
510
  }, [d.multiple ? (m(), c("span", {
415
511
  key: 0,
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"]),
512
+ class: p(["mt-0.5 inline-flex size-4 shrink-0 items-center justify-center rounded-4 border transition-colors", z(e) ? "border-primary bg-primary text-white" : "border-muted/70 bg-surface"]),
417
513
  "aria-hidden": "true"
418
- }, [R(e) ? (m(), o(y(me), {
514
+ }, [z(e) ? (m(), o(y(me), {
419
515
  key: 0,
420
516
  class: "size-3",
421
517
  "stroke-width": 3,
422
518
  "aria-hidden": "true"
423
- })) : s("", !0)], 2)) : s("", !0), l("span", Ie, [_(t.$slots, "option", {
519
+ })) : s("", !0)], 2)) : s("", !0), l("span", Le, [_(t.$slots, "option", {
424
520
  option: e,
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", {
521
+ selected: z(e),
522
+ active: n === P.value
523
+ }, () => [_(t.$slots, "content", { option: e }, () => [l("span", Re, v(e.label), 1), e.description ? (m(), c("span", ze, v(e.description), 1)) : s("", !0)])])])], 42, Ie))), 128))], 64))), 128)),
524
+ q.value ? (m(), c("li", {
429
525
  key: 0,
430
- id: H(K.value),
526
+ id: G(Y.value),
431
527
  role: "option",
432
528
  "aria-selected": "false",
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"]),
529
+ class: p(["flex cursor-pointer items-center gap-2.5 rounded-6 px-4 py-2 text-base text-heading transition-colors", Y.value === P.value && "bg-accent-hover"]),
434
530
  "data-testid": "ac-select-create",
435
- onMouseenter: a[6] ||= (e) => N.value = K.value,
531
+ onMouseenter: a[6] ||= (e) => P.value = Y.value,
436
532
  onMousedown: a[7] ||= x(() => {}, ["prevent"]),
437
- onClick: at
533
+ onClick: ct
438
534
  }, [u(y(_e), {
439
535
  class: "size-4 shrink-0 text-primary-strong",
440
536
  "aria-hidden": "true"
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)]),
537
+ }), l("span", Ve, v(d.createText) + " “" + v(K.value) + "”", 1)], 42, Be)) : s("", !0),
538
+ !W.value.length && !q.value ? (m(), c("li", He, [_(t.$slots, "empty", { query: N.value }, () => [ee(v(d.emptyText || (N.value ? `${d.noResultText} for “${N.value}”` : "No options")), 1)])])) : s("", !0)
539
+ ], 8, Pe)], 4)) : s("", !0)]),
444
540
  _: 3
445
541
  })]))
446
542
  ], 16));
447
543
  }
448
544
  });
449
545
  //#endregion
450
- export { He as default };
546
+ export { Ue as default };