@ac-design/design-system 2.2.1 → 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/compat.css +210 -0
- 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/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 +432 -369
- package/dist/lib/components/AcErrorState.vue.d.ts +1 -1
- 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/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/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 +190 -174
- 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 +206 -174
- package/dist/lib/components/AcUserMenu.vue.d.ts +8 -0
- package/dist/lib/components/AcUserMenu.vue_vue_type_script_setup_true_lang.js +126 -109
- 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,6 +1,6 @@
|
|
|
1
1
|
import e from "./AcSpinner.js";
|
|
2
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
|
|
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
4
|
import { Check as me, ChevronDown as he, ChevronUp as ge, Plus as _e, RefreshCw as ve, X as ye } from "@lucide/vue";
|
|
5
5
|
//#region src/lib/components/AcSelect.vue?vue&type=script&setup=true&lang.ts
|
|
6
6
|
var be = {
|
|
@@ -20,16 +20,17 @@ var be = {
|
|
|
20
20
|
"aria-disabled",
|
|
21
21
|
"aria-invalid",
|
|
22
22
|
"aria-required",
|
|
23
|
-
"aria-activedescendant"
|
|
23
|
+
"aria-activedescendant",
|
|
24
|
+
"aria-busy"
|
|
24
25
|
], Ce = { class: "flex min-w-0 flex-1 flex-wrap items-center gap-2" }, we = { class: "truncate" }, Te = [
|
|
25
26
|
"aria-label",
|
|
26
27
|
"disabled",
|
|
27
28
|
"onClick"
|
|
28
29
|
], Ee = {
|
|
29
|
-
key:
|
|
30
|
+
key: 2,
|
|
30
31
|
class: "truncate"
|
|
31
32
|
}, De = {
|
|
32
|
-
key:
|
|
33
|
+
key: 3,
|
|
33
34
|
class: "truncate text-muted"
|
|
34
35
|
}, Oe = { class: "flex shrink-0 items-center gap-1 text-muted" }, ke = ["disabled"], Ae = {
|
|
35
36
|
class: "inline-flex rounded-full p-1 transition-colors hover:bg-accent-hover hover:text-primary",
|
|
@@ -54,7 +55,7 @@ var be = {
|
|
|
54
55
|
key: 1,
|
|
55
56
|
role: "presentation",
|
|
56
57
|
class: "px-4 py-3 text-center text-base text-muted"
|
|
57
|
-
},
|
|
58
|
+
}, He = /*@__PURE__*/ d({
|
|
58
59
|
inheritAttrs: !1,
|
|
59
60
|
__name: "AcSelect",
|
|
60
61
|
props: /*@__PURE__*/ f({
|
|
@@ -90,6 +91,10 @@ var be = {
|
|
|
90
91
|
type: Boolean,
|
|
91
92
|
default: !1
|
|
92
93
|
},
|
|
94
|
+
refreshing: {
|
|
95
|
+
type: Boolean,
|
|
96
|
+
default: !1
|
|
97
|
+
},
|
|
93
98
|
disabled: {
|
|
94
99
|
type: Boolean,
|
|
95
100
|
default: !1
|
|
@@ -101,10 +106,16 @@ var be = {
|
|
|
101
106
|
errorMsg: { default: "" },
|
|
102
107
|
hint: { default: "" },
|
|
103
108
|
size: { default: "normal" },
|
|
104
|
-
noResultText: { default: "No results" }
|
|
109
|
+
noResultText: { default: "No results" },
|
|
110
|
+
placement: { default: "bottom" }
|
|
105
111
|
}, {
|
|
106
112
|
modelValue: { default: null },
|
|
107
|
-
modelModifiers: {}
|
|
113
|
+
modelModifiers: {},
|
|
114
|
+
open: {
|
|
115
|
+
type: Boolean,
|
|
116
|
+
default: !1
|
|
117
|
+
},
|
|
118
|
+
openModifiers: {}
|
|
108
119
|
}),
|
|
109
120
|
emits: /*@__PURE__*/ f([
|
|
110
121
|
"select",
|
|
@@ -112,46 +123,46 @@ var be = {
|
|
|
112
123
|
"remove",
|
|
113
124
|
"search",
|
|
114
125
|
"refresh"
|
|
115
|
-
], ["update:modelValue"]),
|
|
116
|
-
setup(d, { expose: f, emit:
|
|
117
|
-
let
|
|
118
|
-
class:
|
|
119
|
-
style:
|
|
120
|
-
})),
|
|
121
|
-
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;
|
|
122
133
|
return n;
|
|
123
|
-
}),
|
|
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({
|
|
124
135
|
left: 0,
|
|
125
136
|
width: 0,
|
|
126
137
|
maxHeight: 288
|
|
127
|
-
}),
|
|
128
|
-
let e =
|
|
138
|
+
}), F = a(() => {
|
|
139
|
+
let e = w.value;
|
|
129
140
|
return e == null || e === "" ? [] : Array.isArray(e) ? e : [e];
|
|
130
|
-
}),
|
|
131
|
-
let n =
|
|
141
|
+
}), I = (e, t) => {
|
|
142
|
+
let n = S.by;
|
|
132
143
|
return typeof n == "function" ? n(e, t) : n && e && t && typeof e == "object" && typeof t == "object" ? e[n] === t[n] : e === t;
|
|
133
|
-
},
|
|
134
|
-
let t =
|
|
144
|
+
}, L = (e) => {
|
|
145
|
+
let t = S.by;
|
|
135
146
|
return String(typeof t == "string" && e && typeof e == "object" ? e[t] : e);
|
|
136
|
-
},
|
|
137
|
-
let n =
|
|
147
|
+
}, Xe = (e, t) => {
|
|
148
|
+
let n = S.by;
|
|
138
149
|
return e && typeof e == "object" ? typeof n == "string" ? String(e[n]) : `i${t}` : String(e);
|
|
139
|
-
},
|
|
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)) ?? {
|
|
140
151
|
value: e,
|
|
141
|
-
label:
|
|
142
|
-
})),
|
|
152
|
+
label: L(e)
|
|
153
|
+
})), B = a(() => F.value.length > 0), Ze = (e) => {
|
|
143
154
|
if (!e.some((e) => e.group)) return e;
|
|
144
155
|
let t = [];
|
|
145
156
|
return e.forEach((e) => {
|
|
146
157
|
let n = e.group ?? "";
|
|
147
158
|
t.includes(n) || t.push(n);
|
|
148
159
|
}), [...e].sort((e, n) => t.indexOf(e.group ?? "") - t.indexOf(n.group ?? ""));
|
|
149
|
-
},
|
|
150
|
-
let e =
|
|
151
|
-
return
|
|
152
|
-
}),
|
|
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(() => {
|
|
153
164
|
let e = [];
|
|
154
|
-
return
|
|
165
|
+
return V.value.forEach((t, n) => {
|
|
155
166
|
let r = t.group ?? "", i = e.find((e) => e.name === r);
|
|
156
167
|
i || e.push(i = {
|
|
157
168
|
name: r,
|
|
@@ -161,16 +172,16 @@ var be = {
|
|
|
161
172
|
index: n
|
|
162
173
|
});
|
|
163
174
|
}), e;
|
|
164
|
-
}),
|
|
165
|
-
let e =
|
|
166
|
-
if (!
|
|
167
|
-
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);
|
|
168
179
|
return !t && !n;
|
|
169
|
-
}),
|
|
170
|
-
let e =
|
|
180
|
+
}), G = a(() => V.value.length + +!!W.value - 1), K = a(() => V.value.length), $e = () => {
|
|
181
|
+
let e = A.value;
|
|
171
182
|
if (!e) return;
|
|
172
|
-
let n = e.getBoundingClientRect(), r = t(), i = r.bottom - n.bottom - 4 - 8, a = n.top - r.top - 4 - 8;
|
|
173
|
-
|
|
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 ? {
|
|
174
185
|
bottom: r.bottom - n.top + 4,
|
|
175
186
|
left: n.left - r.left,
|
|
176
187
|
width: n.width,
|
|
@@ -181,140 +192,145 @@ var be = {
|
|
|
181
192
|
width: n.width,
|
|
182
193
|
maxHeight: Math.min(288, i)
|
|
183
194
|
};
|
|
184
|
-
},
|
|
185
|
-
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;
|
|
186
197
|
return -1;
|
|
187
|
-
},
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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) => {
|
|
195
207
|
if (!e.disabled) {
|
|
196
|
-
if (
|
|
197
|
-
let t = [...
|
|
198
|
-
n >= 0 ? (t.splice(n, 1),
|
|
199
|
-
} 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();
|
|
200
212
|
}
|
|
201
|
-
},
|
|
202
|
-
|
|
203
|
-
},
|
|
204
|
-
let e =
|
|
205
|
-
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;
|
|
206
218
|
let t = e, n = {
|
|
207
219
|
value: t,
|
|
208
220
|
label: e
|
|
209
221
|
};
|
|
210
|
-
|
|
211
|
-
},
|
|
212
|
-
|
|
213
|
-
}, Y = "",
|
|
214
|
-
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;
|
|
215
227
|
if (!t) return;
|
|
216
|
-
let n =
|
|
217
|
-
for (let r = 0; r < t && (n = (n + e + t) % t,
|
|
218
|
-
|
|
219
|
-
},
|
|
220
|
-
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;
|
|
221
233
|
let t = e.key;
|
|
222
|
-
if (!
|
|
234
|
+
if (!T.value) {
|
|
223
235
|
[
|
|
224
236
|
"Enter",
|
|
225
237
|
" ",
|
|
226
238
|
"ArrowDown",
|
|
227
239
|
"ArrowUp"
|
|
228
|
-
].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]);
|
|
229
241
|
return;
|
|
230
242
|
}
|
|
231
|
-
if (t === "ArrowDown") e.preventDefault(),
|
|
232
|
-
else if (t === "ArrowUp") e.preventDefault(),
|
|
233
|
-
else if (t === "Home") e.preventDefault(),
|
|
234
|
-
else if (t === "End") e.preventDefault(),
|
|
235
|
-
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) {
|
|
236
248
|
e.preventDefault();
|
|
237
|
-
let t =
|
|
238
|
-
t ?
|
|
239
|
-
} else if (t === "Escape") e.preventDefault(),
|
|
240
|
-
else if (t === "Tab")
|
|
241
|
-
else if (!
|
|
242
|
-
Y += t.toLowerCase(), clearTimeout(
|
|
243
|
-
let e =
|
|
244
|
-
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());
|
|
245
257
|
}
|
|
246
|
-
}, ot = (e) => {
|
|
247
|
-
let t = e.target;
|
|
248
|
-
Ke.value?.contains(t) || k.value?.contains(t) || q(!1);
|
|
249
258
|
}, Z = (e) => {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
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);
|
|
253
265
|
};
|
|
254
|
-
|
|
255
|
-
if (
|
|
256
|
-
|
|
257
|
-
}),
|
|
258
|
-
|
|
259
|
-
}), ie(
|
|
260
|
-
let
|
|
261
|
-
return f({ focus: () =>
|
|
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({
|
|
262
274
|
ref_key: "root",
|
|
263
|
-
ref:
|
|
264
|
-
},
|
|
275
|
+
ref: Je
|
|
276
|
+
}, We.value, {
|
|
265
277
|
class: ["w-full", d.disabled && "opacity-50"],
|
|
266
278
|
"data-ac-ds": "",
|
|
267
279
|
"data-testid": "ac-select"
|
|
268
280
|
}), [
|
|
269
281
|
d.label ? (m(), c("div", be, [l("label", {
|
|
270
|
-
id:
|
|
271
|
-
onClick: a[0] ||= (e) =>
|
|
272
|
-
},
|
|
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),
|
|
273
285
|
d.hint ? (m(), c("p", {
|
|
274
286
|
key: 1,
|
|
275
|
-
id:
|
|
287
|
+
id: Ke,
|
|
276
288
|
class: "mb-2 text-base text-muted"
|
|
277
|
-
},
|
|
289
|
+
}, v(d.hint), 1)) : s("", !0),
|
|
278
290
|
l("div", te({
|
|
279
|
-
id: `${
|
|
291
|
+
id: `${y(E)}-trigger`,
|
|
280
292
|
ref_key: "trigger",
|
|
281
|
-
ref:
|
|
282
|
-
},
|
|
293
|
+
ref: A
|
|
294
|
+
}, Ge.value, {
|
|
283
295
|
role: "combobox",
|
|
284
296
|
tabindex: d.disabled ? -1 : 0,
|
|
285
297
|
"aria-haspopup": "listbox",
|
|
286
|
-
"aria-expanded":
|
|
287
|
-
"aria-controls":
|
|
288
|
-
"aria-labelledby": d.label ?
|
|
289
|
-
"aria-label": d.label ? void 0 :
|
|
290
|
-
"aria-describedby":
|
|
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,
|
|
291
303
|
"aria-disabled": d.disabled || void 0,
|
|
292
304
|
"aria-invalid": !!d.errorMsg || void 0,
|
|
293
305
|
"aria-required": d.required || void 0,
|
|
294
|
-
"aria-activedescendant":
|
|
306
|
+
"aria-activedescendant": T.value && !d.searchable && N.value >= 0 ? H(N.value) : void 0,
|
|
307
|
+
"aria-busy": d.refreshing || void 0,
|
|
295
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", [
|
|
296
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",
|
|
297
|
-
d.multiple &&
|
|
310
|
+
d.multiple && B.value && (d.size === "normal" ? "py-1.5" : "py-1"),
|
|
298
311
|
d.disabled || d.loading ? "cursor-not-allowed" : "cursor-pointer",
|
|
299
|
-
d.errorMsg ? ["border-danger/50",
|
|
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"]
|
|
300
313
|
]],
|
|
301
|
-
onClick:
|
|
302
|
-
onKeydown:
|
|
303
|
-
onFocus: a[2] ||= (e) =>
|
|
304
|
-
onBlur: a[3] ||= (e) =>
|
|
305
|
-
}), [l("div", Ce, [d.multiple &&
|
|
306
|
-
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),
|
|
307
320
|
class: "inline-flex max-w-full items-center gap-2 rounded-10 bg-accent px-2 text-xs text-heading"
|
|
308
|
-
}, [l("span", we,
|
|
321
|
+
}, [l("span", we, v(e.label), 1), l("button", {
|
|
309
322
|
type: "button",
|
|
310
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",
|
|
311
324
|
"aria-label": `Remove ${e.label}`,
|
|
312
325
|
disabled: d.disabled,
|
|
313
|
-
onClick:
|
|
314
|
-
}, [u(
|
|
326
|
+
onClick: x((t) => it(e), ["stop"])
|
|
327
|
+
}, [u(y(ye), {
|
|
315
328
|
class: "size-4",
|
|
316
329
|
"aria-hidden": "true"
|
|
317
|
-
})], 8, Te)]))), 128)) :
|
|
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, [
|
|
318
334
|
d.loading ? (m(), o(e, {
|
|
319
335
|
key: 0,
|
|
320
336
|
class: "text-primary"
|
|
@@ -324,106 +340,106 @@ var be = {
|
|
|
324
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",
|
|
325
341
|
"aria-label": "Refresh options",
|
|
326
342
|
disabled: d.disabled,
|
|
327
|
-
onClick: a[1] ||=
|
|
328
|
-
}, [u(
|
|
329
|
-
class: "size-4",
|
|
343
|
+
onClick: a[1] ||= x((e) => C("refresh"), ["stop"])
|
|
344
|
+
}, [u(y(ve), {
|
|
345
|
+
class: p(["size-4", d.refreshing && "motion-safe:animate-spin"]),
|
|
330
346
|
"aria-hidden": "true"
|
|
331
|
-
})], 8, ke)) : s("", !0),
|
|
332
|
-
d.clearable &&
|
|
347
|
+
}, null, 8, ["class"])], 8, ke)) : s("", !0),
|
|
348
|
+
d.clearable && B.value && !d.disabled && !d.loading ? (m(), c("button", {
|
|
333
349
|
key: 2,
|
|
334
350
|
type: "button",
|
|
335
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",
|
|
336
352
|
"aria-label": "Clear selection",
|
|
337
|
-
onClick:
|
|
338
|
-
}, [u(
|
|
353
|
+
onClick: x(ot, ["stop"])
|
|
354
|
+
}, [u(y(ye), {
|
|
339
355
|
class: "size-4",
|
|
340
356
|
"aria-hidden": "true"
|
|
341
357
|
})])) : s("", !0),
|
|
342
|
-
l("span", Ae, [(m(), o(oe(
|
|
358
|
+
l("span", Ae, [(m(), o(oe(T.value ? y(ge) : y(he)), { class: "size-4" }))])
|
|
343
359
|
])], 16, Se),
|
|
344
360
|
d.errorMsg ? (m(), c("p", {
|
|
345
361
|
key: 2,
|
|
346
|
-
id:
|
|
362
|
+
id: qe,
|
|
347
363
|
class: "mt-1 text-base text-danger-strong",
|
|
348
364
|
role: "alert"
|
|
349
|
-
},
|
|
365
|
+
}, v(d.errorMsg), 1)) : s("", !0),
|
|
350
366
|
(m(), o(r, { to: "body" }, [u(i, {
|
|
351
367
|
"enter-active-class": "transition-opacity duration-100 ease-out motion-reduce:transition-none",
|
|
352
368
|
"enter-from-class": "opacity-0",
|
|
353
369
|
"leave-active-class": "transition-opacity duration-75 ease-in motion-reduce:transition-none",
|
|
354
370
|
"leave-to-class": "opacity-0"
|
|
355
371
|
}, {
|
|
356
|
-
default: fe(() => [
|
|
372
|
+
default: fe(() => [T.value ? (m(), c("div", {
|
|
357
373
|
key: 0,
|
|
358
374
|
ref_key: "panel",
|
|
359
|
-
ref:
|
|
375
|
+
ref: j,
|
|
360
376
|
class: "fixed z-[90] flex flex-col overflow-hidden rounded-10 border border-border bg-background shadow-lg",
|
|
361
377
|
style: re({
|
|
362
|
-
top:
|
|
363
|
-
bottom:
|
|
364
|
-
left: `${
|
|
365
|
-
width: `${
|
|
366
|
-
maxHeight: `${
|
|
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`
|
|
367
383
|
}),
|
|
368
384
|
"data-ac-ds": "",
|
|
369
385
|
"data-testid": "ac-select-panel"
|
|
370
386
|
}, [d.searchable ? (m(), c("div", je, [pe(l("input", {
|
|
371
387
|
ref_key: "searchInput",
|
|
372
|
-
ref:
|
|
373
|
-
"onUpdate:modelValue": a[4] ||= (e) =>
|
|
388
|
+
ref: Ye,
|
|
389
|
+
"onUpdate:modelValue": a[4] ||= (e) => M.value = e,
|
|
374
390
|
type: "text",
|
|
375
391
|
placeholder: "Search…",
|
|
376
392
|
"aria-label": "Search options",
|
|
377
|
-
"aria-controls":
|
|
378
|
-
"aria-activedescendant":
|
|
393
|
+
"aria-controls": O,
|
|
394
|
+
"aria-activedescendant": N.value >= 0 ? H(N.value) : void 0,
|
|
379
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",
|
|
380
|
-
onKeydown:
|
|
381
|
-
}, null, 40, Me), [[
|
|
382
|
-
id:
|
|
396
|
+
onKeydown: lt
|
|
397
|
+
}, null, 40, Me), [[de, M.value]])])) : s("", !0), l("ul", {
|
|
398
|
+
id: O,
|
|
383
399
|
role: "listbox",
|
|
384
400
|
"aria-multiselectable": d.multiple || void 0,
|
|
385
|
-
"aria-labelledby": d.label ?
|
|
401
|
+
"aria-labelledby": d.label ? k : void 0,
|
|
386
402
|
class: "ac-scrollbar max-h-60 min-h-0 flex-1 p-1"
|
|
387
403
|
}, [
|
|
388
|
-
(m(!0), c(n, null, g(
|
|
389
|
-
id:
|
|
390
|
-
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),
|
|
391
407
|
role: "option",
|
|
392
|
-
"aria-selected":
|
|
408
|
+
"aria-selected": R(e),
|
|
393
409
|
"aria-disabled": e.disabled || void 0,
|
|
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 ===
|
|
395
|
-
onMouseenter: (t) => !e.disabled && (
|
|
396
|
-
onMousedown: a[5] ||=
|
|
397
|
-
onClick: (t) =>
|
|
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)
|
|
398
414
|
}, [d.multiple ? (m(), c("span", {
|
|
399
415
|
key: 0,
|
|
400
|
-
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"]),
|
|
401
417
|
"aria-hidden": "true"
|
|
402
|
-
}, [
|
|
418
|
+
}, [R(e) ? (m(), o(y(me), {
|
|
403
419
|
key: 0,
|
|
404
420
|
class: "size-3",
|
|
405
421
|
"stroke-width": 3,
|
|
406
422
|
"aria-hidden": "true"
|
|
407
|
-
})) : s("", !0)], 2)) : s("", !0), l("span", Ie, [
|
|
423
|
+
})) : s("", !0)], 2)) : s("", !0), l("span", Ie, [_(t.$slots, "option", {
|
|
408
424
|
option: e,
|
|
409
|
-
selected:
|
|
410
|
-
active: n ===
|
|
411
|
-
}, () => [l("span", Le,
|
|
412
|
-
|
|
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", {
|
|
413
429
|
key: 0,
|
|
414
|
-
id:
|
|
430
|
+
id: H(K.value),
|
|
415
431
|
role: "option",
|
|
416
432
|
"aria-selected": "false",
|
|
417
|
-
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"]),
|
|
418
434
|
"data-testid": "ac-select-create",
|
|
419
|
-
onMouseenter: a[6] ||= (e) =>
|
|
420
|
-
onMousedown: a[7] ||=
|
|
421
|
-
onClick:
|
|
422
|
-
}, [u(
|
|
435
|
+
onMouseenter: a[6] ||= (e) => N.value = K.value,
|
|
436
|
+
onMousedown: a[7] ||= x(() => {}, ["prevent"]),
|
|
437
|
+
onClick: at
|
|
438
|
+
}, [u(y(_e), {
|
|
423
439
|
class: "size-4 shrink-0 text-primary-strong",
|
|
424
440
|
"aria-hidden": "true"
|
|
425
|
-
}), l("span", Be,
|
|
426
|
-
!
|
|
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)
|
|
427
443
|
], 8, Ne)], 4)) : s("", !0)]),
|
|
428
444
|
_: 3
|
|
429
445
|
})]))
|
|
@@ -431,4 +447,4 @@ var be = {
|
|
|
431
447
|
}
|
|
432
448
|
});
|
|
433
449
|
//#endregion
|
|
434
|
-
export {
|
|
450
|
+
export { He as default };
|
|
@@ -13,6 +13,12 @@ export interface Props {
|
|
|
13
13
|
hoverExpand?: boolean;
|
|
14
14
|
/** Offset from the top of the viewport on desktop, e.g. `"72px"` under a full-width navbar. The height shrinks to match. */
|
|
15
15
|
top?: string;
|
|
16
|
+
/** Pins the sidebar to the viewport's left edge with `position: fixed` on desktop, instead of `sticky`. The page then makes room itself, e.g. cloud-ui's `lg:pl-52 xl:pl-64`. */
|
|
17
|
+
fixed?: boolean;
|
|
18
|
+
/** Puts the `footer` items at the end of the scrolling list instead of pinning them: they sit at the bottom while the list is short and scroll with it when it's long, as in cloud-ui. */
|
|
19
|
+
footerScrolls?: boolean;
|
|
20
|
+
/** Space between sections. `compact` is cloud-ui's console: 16px either side of the rule between sections, 24px-high section headings and 8px between sub-groups. */
|
|
21
|
+
spacing?: "normal" | "compact";
|
|
16
22
|
}
|
|
17
23
|
type __VLS_Props = Props;
|
|
18
24
|
type __VLS_Slots = {
|
|
@@ -48,13 +54,16 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
48
54
|
"onUpdate:collapsed"?: ((value: boolean) => any) | undefined;
|
|
49
55
|
"onUpdate:mobileOpen"?: ((value: boolean) => any) | undefined;
|
|
50
56
|
}>, {
|
|
57
|
+
fixed: boolean;
|
|
51
58
|
label: string;
|
|
59
|
+
spacing: "normal" | "compact";
|
|
52
60
|
top: string;
|
|
53
61
|
dark: boolean;
|
|
54
62
|
collapsible: boolean;
|
|
55
63
|
contained: boolean;
|
|
56
64
|
breakpoint: number;
|
|
57
65
|
hoverExpand: boolean;
|
|
66
|
+
footerScrolls: boolean;
|
|
58
67
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
59
68
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
60
69
|
declare const _default: typeof __VLS_export;
|