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