@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.
- package/dist/lib/charts/ChartFrame.vue_vue_type_script_setup_true_lang.js +89 -88
- package/dist/lib/compat.css +210 -0
- package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +74 -73
- package/dist/lib/components/AcButton.vue.d.ts +18 -12
- package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +62 -32
- package/dist/lib/components/AcCard.vue.d.ts +11 -5
- package/dist/lib/components/AcCard.vue_vue_type_script_setup_true_lang.js +99 -51
- package/dist/lib/components/AcClusterSwitcher.vue_vue_type_script_setup_true_lang.js +151 -150
- package/dist/lib/components/AcColorInput.vue.d.ts +1 -1
- package/dist/lib/components/AcDatePicker.vue.d.ts +27 -3
- package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +518 -454
- package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +56 -55
- package/dist/lib/components/AcErrorState.vue.d.ts +1 -1
- package/dist/lib/components/AcFormFooter.vue_vue_type_script_setup_true_lang.js +39 -38
- package/dist/lib/components/AcHeader.vue.d.ts +1 -1
- package/dist/lib/components/AcInput.vue.d.ts +28 -7
- package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +149 -80
- package/dist/lib/components/AcKeyValueInput.vue.d.ts +1 -1
- package/dist/lib/components/AcLocaleSwitcher.vue.d.ts +6 -0
- package/dist/lib/components/AcLocaleSwitcher.vue_vue_type_script_setup_true_lang.js +74 -58
- package/dist/lib/components/AcModal.vue_vue_type_script_setup_true_lang.js +3 -1
- package/dist/lib/components/AcNavbar.vue.d.ts +2 -0
- package/dist/lib/components/AcNavbar.vue_vue_type_script_setup_true_lang.js +31 -25
- package/dist/lib/components/AcNotificationMenu.vue_vue_type_script_setup_true_lang.js +90 -89
- package/dist/lib/components/AcNumberInput.vue.d.ts +1 -1
- package/dist/lib/components/AcRadioCard.js +5 -0
- package/dist/lib/components/AcRadioCard.vue.d.ts +55 -0
- package/dist/lib/components/AcRadioCard.vue_vue_type_script_setup_true_lang.js +135 -0
- package/dist/lib/components/AcSelect.vue.d.ts +12 -1
- package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +237 -220
- 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/AcSidebar.vue.d.ts +9 -0
- package/dist/lib/components/AcSidebar.vue_vue_type_script_setup_true_lang.js +113 -94
- package/dist/lib/components/AcSidebarSection.vue_vue_type_script_setup_true_lang.js +19 -18
- package/dist/lib/components/AcSlider.vue.d.ts +1 -1
- package/dist/lib/components/AcTable.vue.d.ts +13 -1
- package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +106 -86
- package/dist/lib/components/AcTagInput.vue.d.ts +1 -1
- package/dist/lib/components/AcTextarea.vue.d.ts +30 -4
- package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +92 -61
- package/dist/lib/components/AcThemeMode.vue.d.ts +10 -2
- package/dist/lib/components/AcThemeMode.vue_vue_type_script_setup_true_lang.js +53 -42
- package/dist/lib/components/AcTimePicker.vue.d.ts +21 -3
- package/dist/lib/components/AcTimePicker.vue_vue_type_script_setup_true_lang.js +234 -201
- package/dist/lib/components/AcTooltip.vue_vue_type_script_setup_true_lang.js +73 -72
- package/dist/lib/components/AcUserMenu.vue.d.ts +8 -0
- package/dist/lib/components/AcUserMenu.vue_vue_type_script_setup_true_lang.js +125 -107
- package/dist/lib/components/fixedFrame.d.ts +11 -0
- package/dist/lib/components/fixedFrame.js +24 -0
- package/dist/lib/components/index.d.ts +1 -0
- package/dist/lib/components/types.d.ts +2 -0
- package/dist/lib/index.js +34 -33
- 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, 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
|
|
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",
|
|
@@ -19,44 +20,45 @@ var ye = {
|
|
|
19
20
|
"aria-disabled",
|
|
20
21
|
"aria-invalid",
|
|
21
22
|
"aria-required",
|
|
22
|
-
"aria-activedescendant"
|
|
23
|
-
|
|
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
|
-
],
|
|
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
|
-
},
|
|
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
|
-
},
|
|
38
|
+
}, je = {
|
|
37
39
|
key: 0,
|
|
38
40
|
class: "border-b border-border p-3"
|
|
39
|
-
},
|
|
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
|
-
},
|
|
45
|
+
}, Fe = [
|
|
44
46
|
"id",
|
|
45
47
|
"aria-selected",
|
|
46
48
|
"aria-disabled",
|
|
47
49
|
"onMouseenter",
|
|
48
50
|
"onClick"
|
|
49
|
-
],
|
|
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
|
-
},
|
|
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
|
-
},
|
|
58
|
+
}, He = /*@__PURE__*/ d({
|
|
57
59
|
inheritAttrs: !1,
|
|
58
60
|
__name: "AcSelect",
|
|
59
|
-
props: /*@__PURE__*/
|
|
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__*/
|
|
120
|
+
emits: /*@__PURE__*/ f([
|
|
109
121
|
"select",
|
|
110
122
|
"create",
|
|
111
123
|
"remove",
|
|
112
124
|
"search",
|
|
113
125
|
"refresh"
|
|
114
|
-
], ["update:modelValue"]),
|
|
115
|
-
setup(
|
|
116
|
-
let
|
|
117
|
-
class:
|
|
118
|
-
style:
|
|
119
|
-
})),
|
|
120
|
-
let { class: e, style: t, ...n } =
|
|
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
|
-
}),
|
|
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
|
-
}),
|
|
127
|
-
let e =
|
|
138
|
+
}), F = a(() => {
|
|
139
|
+
let e = w.value;
|
|
128
140
|
return e == null || e === "" ? [] : Array.isArray(e) ? e : [e];
|
|
129
|
-
}),
|
|
130
|
-
let n =
|
|
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
|
-
},
|
|
133
|
-
let t =
|
|
144
|
+
}, L = (e) => {
|
|
145
|
+
let t = S.by;
|
|
134
146
|
return String(typeof t == "string" && e && typeof e == "object" ? e[t] : e);
|
|
135
|
-
},
|
|
136
|
-
let n =
|
|
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
|
-
},
|
|
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:
|
|
141
|
-
})),
|
|
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
|
-
},
|
|
149
|
-
let e =
|
|
150
|
-
return
|
|
151
|
-
}),
|
|
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
|
|
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
|
-
}),
|
|
164
|
-
let e =
|
|
165
|
-
if (!
|
|
166
|
-
let t =
|
|
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
|
-
}),
|
|
169
|
-
let e =
|
|
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
|
|
172
|
-
|
|
173
|
-
bottom:
|
|
174
|
-
left:
|
|
175
|
-
width:
|
|
176
|
-
maxHeight: Math.min(288,
|
|
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:
|
|
179
|
-
left:
|
|
180
|
-
width:
|
|
181
|
-
maxHeight: Math.min(288,
|
|
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
|
-
},
|
|
184
|
-
for (let n = e; n >= 0 && 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
|
-
},
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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 (
|
|
196
|
-
let t = [...
|
|
197
|
-
n >= 0 ? (t.splice(n, 1),
|
|
198
|
-
} else
|
|
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
|
-
},
|
|
201
|
-
|
|
202
|
-
},
|
|
203
|
-
let e =
|
|
204
|
-
if (!
|
|
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
|
-
|
|
210
|
-
},
|
|
211
|
-
|
|
212
|
-
}, Y = "",
|
|
213
|
-
let t =
|
|
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 =
|
|
216
|
-
for (let r = 0; r < t && (n = (n + e + t) % t,
|
|
217
|
-
|
|
218
|
-
},
|
|
219
|
-
if (
|
|
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 (!
|
|
234
|
+
if (!T.value) {
|
|
222
235
|
[
|
|
223
236
|
"Enter",
|
|
224
237
|
" ",
|
|
225
238
|
"ArrowDown",
|
|
226
239
|
"ArrowUp"
|
|
227
|
-
].includes(t) ? (e.preventDefault(),
|
|
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(),
|
|
231
|
-
else if (t === "ArrowUp") e.preventDefault(),
|
|
232
|
-
else if (t === "Home") e.preventDefault(),
|
|
233
|
-
else if (t === "End") e.preventDefault(),
|
|
234
|
-
else if (t === "Enter" || t === " " && !
|
|
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 =
|
|
237
|
-
t ?
|
|
238
|
-
} else if (t === "Escape") e.preventDefault(),
|
|
239
|
-
else if (t === "Tab")
|
|
240
|
-
else if (!
|
|
241
|
-
Y += t.toLowerCase(), clearTimeout(
|
|
242
|
-
let e =
|
|
243
|
-
e >= 0 && (
|
|
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
|
-
|
|
250
|
-
|
|
251
|
-
|
|
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
|
-
|
|
254
|
-
if (
|
|
255
|
-
|
|
256
|
-
}),
|
|
257
|
-
|
|
258
|
-
}),
|
|
259
|
-
let
|
|
260
|
-
return
|
|
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:
|
|
263
|
-
},
|
|
264
|
-
class: ["w-full",
|
|
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
|
-
|
|
269
|
-
id:
|
|
270
|
-
onClick:
|
|
271
|
-
},
|
|
272
|
-
|
|
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:
|
|
287
|
+
id: Ke,
|
|
275
288
|
class: "mb-2 text-base text-muted"
|
|
276
|
-
},
|
|
277
|
-
|
|
278
|
-
id: `${
|
|
289
|
+
}, v(d.hint), 1)) : s("", !0),
|
|
290
|
+
l("div", te({
|
|
291
|
+
id: `${y(E)}-trigger`,
|
|
279
292
|
ref_key: "trigger",
|
|
280
|
-
ref:
|
|
281
|
-
},
|
|
293
|
+
ref: A
|
|
294
|
+
}, Ge.value, {
|
|
282
295
|
role: "combobox",
|
|
283
|
-
tabindex:
|
|
296
|
+
tabindex: d.disabled ? -1 : 0,
|
|
284
297
|
"aria-haspopup": "listbox",
|
|
285
|
-
"aria-expanded":
|
|
286
|
-
"aria-controls":
|
|
287
|
-
"aria-labelledby":
|
|
288
|
-
"aria-label":
|
|
289
|
-
"aria-describedby":
|
|
290
|
-
"aria-disabled":
|
|
291
|
-
"aria-invalid": !!
|
|
292
|
-
"aria-required":
|
|
293
|
-
"aria-activedescendant":
|
|
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
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
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:
|
|
301
|
-
onKeydown:
|
|
302
|
-
onFocus:
|
|
303
|
-
onBlur:
|
|
304
|
-
}), [
|
|
305
|
-
key:
|
|
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
|
-
}, [
|
|
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:
|
|
312
|
-
onClick:
|
|
313
|
-
}, [
|
|
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,
|
|
317
|
-
|
|
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
|
-
})) :
|
|
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:
|
|
326
|
-
onClick:
|
|
327
|
-
}, [
|
|
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,
|
|
331
|
-
|
|
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:
|
|
337
|
-
}, [
|
|
353
|
+
onClick: x(ot, ["stop"])
|
|
354
|
+
}, [u(y(ye), {
|
|
338
355
|
class: "size-4",
|
|
339
356
|
"aria-hidden": "true"
|
|
340
|
-
})])) :
|
|
341
|
-
|
|
342
|
-
])], 16,
|
|
343
|
-
|
|
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:
|
|
362
|
+
id: qe,
|
|
346
363
|
class: "mt-1 text-base text-danger-strong",
|
|
347
364
|
role: "alert"
|
|
348
|
-
},
|
|
349
|
-
(m(),
|
|
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:
|
|
372
|
+
default: fe(() => [T.value ? (m(), c("div", {
|
|
356
373
|
key: 0,
|
|
357
374
|
ref_key: "panel",
|
|
358
|
-
ref:
|
|
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:
|
|
361
|
-
top:
|
|
362
|
-
bottom:
|
|
363
|
-
left: `${
|
|
364
|
-
width: `${
|
|
365
|
-
maxHeight: `${
|
|
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
|
-
}, [
|
|
386
|
+
}, [d.searchable ? (m(), c("div", je, [pe(l("input", {
|
|
370
387
|
ref_key: "searchInput",
|
|
371
|
-
ref:
|
|
372
|
-
"onUpdate:modelValue":
|
|
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":
|
|
377
|
-
"aria-activedescendant":
|
|
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:
|
|
380
|
-
}, null, 40,
|
|
381
|
-
id:
|
|
396
|
+
onKeydown: lt
|
|
397
|
+
}, null, 40, Me), [[de, M.value]])])) : s("", !0), l("ul", {
|
|
398
|
+
id: O,
|
|
382
399
|
role: "listbox",
|
|
383
|
-
"aria-multiselectable":
|
|
384
|
-
"aria-labelledby":
|
|
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),
|
|
388
|
-
id:
|
|
389
|
-
key:
|
|
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":
|
|
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",
|
|
394
|
-
onMouseenter: (
|
|
395
|
-
onMousedown:
|
|
396
|
-
onClick: (t) =>
|
|
397
|
-
}, [
|
|
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",
|
|
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
|
-
}, [
|
|
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
|
-
})) :
|
|
423
|
+
})) : s("", !0)], 2)) : s("", !0), l("span", Ie, [_(t.$slots, "option", {
|
|
407
424
|
option: e,
|
|
408
|
-
selected:
|
|
409
|
-
active:
|
|
410
|
-
}, () => [
|
|
411
|
-
|
|
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:
|
|
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",
|
|
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:
|
|
419
|
-
onMousedown:
|
|
420
|
-
onClick:
|
|
421
|
-
}, [
|
|
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
|
-
}),
|
|
425
|
-
!
|
|
426
|
-
], 8,
|
|
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 {
|
|
450
|
+
export { He as default };
|