@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.
- package/dist/lib/compat.css +211 -0
- package/dist/lib/components/AcAppSwitcher.vue.d.ts +1 -1
- package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +23 -23
- package/dist/lib/components/AcAreaChart.vue.d.ts +1 -1
- package/dist/lib/components/AcBarChart.vue.d.ts +1 -1
- package/dist/lib/components/AcButton.vue.d.ts +7 -1
- package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +90 -69
- package/dist/lib/components/AcCellValue.vue.d.ts +3 -3
- package/dist/lib/components/AcCellValue.vue_vue_type_script_setup_true_lang.js +20 -20
- package/dist/lib/components/AcCheckBox.vue.d.ts +4 -1
- package/dist/lib/components/AcCheckBox.vue_vue_type_script_setup_true_lang.js +50 -50
- package/dist/lib/components/AcCircularProgress.vue.d.ts +1 -1
- package/dist/lib/components/AcCodeEditor.vue.d.ts +12 -0
- package/dist/lib/components/AcCodeEditor.vue_vue_type_script_setup_true_lang.js +240 -207
- package/dist/lib/components/AcColorInput.vue.d.ts +3 -3
- package/dist/lib/components/AcColorInput.vue_vue_type_script_setup_true_lang.js +72 -66
- package/dist/lib/components/AcCostSummary.vue.d.ts +1 -1
- package/dist/lib/components/AcDatePicker.vue.d.ts +14 -7
- package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +417 -372
- package/dist/lib/components/AcDeleteModal.vue.d.ts +1 -1
- package/dist/lib/components/AcDonutChart.vue.d.ts +2 -2
- package/dist/lib/components/AcDropdown.vue.d.ts +1 -1
- package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/lib/components/AcFormFooter.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/lib/components/AcGraphChart.vue.d.ts +2 -2
- package/dist/lib/components/AcInput.vue.d.ts +75 -54
- package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +253 -89
- package/dist/lib/components/AcKeyValueInput.vue.d.ts +34 -54
- package/dist/lib/components/AcKeyValueInput.vue_vue_type_script_setup_true_lang.js +134 -106
- package/dist/lib/components/AcLineChart.vue.d.ts +1 -1
- package/dist/lib/components/AcMapChart.vue.d.ts +2 -2
- package/dist/lib/components/AcModal.vue.d.ts +1 -1
- package/dist/lib/components/AcNotificationMenu.vue.d.ts +1 -1
- package/dist/lib/components/AcNotificationMenu.vue_vue_type_script_setup_true_lang.js +24 -24
- package/dist/lib/components/AcNumberInput.vue.d.ts +55 -45
- package/dist/lib/components/AcNumberInput.vue_vue_type_script_setup_true_lang.js +159 -99
- package/dist/lib/components/AcRadioCard.vue.d.ts +2 -2
- package/dist/lib/components/AcRadioCard.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/lib/components/AcSelect.vue.d.ts +35 -6
- package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +272 -176
- package/dist/lib/components/AcSidePanel.vue.d.ts +1 -1
- package/dist/lib/components/AcSlider.vue.d.ts +2 -2
- package/dist/lib/components/AcSwitch.vue_vue_type_script_setup_true_lang.js +23 -23
- package/dist/lib/components/AcTable.vue.d.ts +37 -4
- package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +239 -131
- package/dist/lib/components/AcTagInput.vue.d.ts +22 -3
- package/dist/lib/components/AcTagInput.vue_vue_type_script_setup_true_lang.js +126 -114
- package/dist/lib/components/AcTaintInput.js +5 -0
- package/dist/lib/components/AcTaintInput.vue.d.ts +44 -0
- package/dist/lib/components/AcTaintInput.vue_vue_type_script_setup_true_lang.js +208 -0
- package/dist/lib/components/AcTextarea.vue.d.ts +38 -4
- package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +113 -53
- package/dist/lib/components/AcTimePicker.vue.d.ts +15 -8
- package/dist/lib/components/AcTimePicker.vue_vue_type_script_setup_true_lang.js +102 -70
- package/dist/lib/components/AcTooltip.vue.d.ts +3 -3
- package/dist/lib/components/index.d.ts +1 -0
- package/dist/lib/composables/useToast.d.ts +2 -2
- package/dist/lib/index.d.ts +2 -1
- package/dist/lib/index.js +31 -30
- 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:
|
|
10
|
+
key: 1,
|
|
11
|
+
class: "text-muted"
|
|
12
|
+
}, Se = {
|
|
13
|
+
key: 2,
|
|
11
14
|
class: "text-danger",
|
|
12
15
|
"aria-hidden": "true"
|
|
13
|
-
},
|
|
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
|
-
],
|
|
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
|
-
],
|
|
33
|
+
], De = {
|
|
30
34
|
key: 2,
|
|
31
35
|
class: "truncate"
|
|
32
|
-
},
|
|
36
|
+
}, Oe = {
|
|
33
37
|
key: 3,
|
|
34
38
|
class: "truncate text-muted"
|
|
35
|
-
},
|
|
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
|
-
},
|
|
42
|
+
}, Me = {
|
|
39
43
|
key: 0,
|
|
40
44
|
class: "border-b border-border p-3"
|
|
41
|
-
},
|
|
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
|
-
},
|
|
49
|
+
}, Ie = [
|
|
46
50
|
"id",
|
|
47
51
|
"aria-selected",
|
|
48
52
|
"aria-disabled",
|
|
49
53
|
"onMouseenter",
|
|
50
54
|
"onClick"
|
|
51
|
-
],
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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:
|
|
128
|
-
let S = d, C =
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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
|
-
}),
|
|
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
|
-
}),
|
|
139
|
-
let e =
|
|
140
|
-
|
|
141
|
-
|
|
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
|
-
},
|
|
218
|
+
}, R = (e) => {
|
|
145
219
|
let t = S.by;
|
|
146
220
|
return String(typeof t == "string" && e && typeof e == "object" ? e[t] : e);
|
|
147
|
-
},
|
|
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
|
-
},
|
|
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:
|
|
153
|
-
})),
|
|
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
|
-
},
|
|
161
|
-
let e =
|
|
162
|
-
return
|
|
163
|
-
}),
|
|
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
|
|
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
|
-
}),
|
|
176
|
-
let e =
|
|
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 ||
|
|
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
|
-
}),
|
|
181
|
-
let e =
|
|
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
|
-
|
|
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
|
-
},
|
|
196
|
-
for (let n = e; n >= 0 && 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
|
-
},
|
|
199
|
-
S.disabled || S.loading ||
|
|
200
|
-
},
|
|
201
|
-
|
|
202
|
-
let e =
|
|
203
|
-
|
|
204
|
-
},
|
|
205
|
-
|
|
206
|
-
},
|
|
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 = [...
|
|
210
|
-
n >= 0 ? (t.splice(n, 1), C("remove", e)) : (t.push(e.value), C("select", e)),
|
|
211
|
-
} else
|
|
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
|
-
},
|
|
214
|
-
|
|
215
|
-
},
|
|
216
|
-
let e =
|
|
217
|
-
if (!
|
|
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 ? (
|
|
223
|
-
},
|
|
224
|
-
|
|
225
|
-
},
|
|
226
|
-
let t =
|
|
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 =
|
|
229
|
-
for (let r = 0; r < t && (n = (n + e + t) % t,
|
|
230
|
-
|
|
231
|
-
},
|
|
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 (!
|
|
312
|
+
if (!D.value) {
|
|
235
313
|
[
|
|
236
314
|
"Enter",
|
|
237
315
|
" ",
|
|
238
316
|
"ArrowDown",
|
|
239
317
|
"ArrowUp"
|
|
240
|
-
].includes(t) ? (e.preventDefault(),
|
|
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(),
|
|
244
|
-
else if (t === "ArrowUp") e.preventDefault(),
|
|
245
|
-
else if (t === "Home") e.preventDefault(),
|
|
246
|
-
else if (t === "End") e.preventDefault(),
|
|
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 =
|
|
250
|
-
t ?
|
|
251
|
-
} else if (t === "Escape") e.preventDefault(),
|
|
252
|
-
else if (t === "Tab")
|
|
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
|
-
|
|
255
|
-
let e =
|
|
256
|
-
e >= 0 && (
|
|
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
|
-
},
|
|
336
|
+
}, mt = (e) => {
|
|
259
337
|
let t = e.target;
|
|
260
|
-
|
|
261
|
-
},
|
|
262
|
-
e?.target instanceof Node &&
|
|
263
|
-
},
|
|
264
|
-
document.removeEventListener("pointerdown",
|
|
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(
|
|
267
|
-
if (e) return
|
|
268
|
-
|
|
269
|
-
}), b(
|
|
270
|
-
C("
|
|
271
|
-
}),
|
|
272
|
-
|
|
273
|
-
|
|
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:
|
|
276
|
-
},
|
|
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
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
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:
|
|
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(
|
|
380
|
+
id: `${y(O)}-trigger`,
|
|
292
381
|
ref_key: "trigger",
|
|
293
|
-
ref:
|
|
294
|
-
},
|
|
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":
|
|
299
|
-
"aria-controls":
|
|
300
|
-
"aria-labelledby": d.label ?
|
|
301
|
-
"aria-label": d.label ? void 0 : y(
|
|
302
|
-
"aria-describedby":
|
|
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": !!
|
|
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":
|
|
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
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
d.
|
|
312
|
-
d.
|
|
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:
|
|
315
|
-
onKeydown:
|
|
316
|
-
onFocus: a[2] ||= (e) =>
|
|
317
|
-
onBlur: a[3] ||= (e) =>
|
|
318
|
-
}), [l("div",
|
|
319
|
-
key:
|
|
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",
|
|
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) =>
|
|
422
|
+
onClick: x((t) => st(e), ["stop"])
|
|
327
423
|
}, [u(y(ye), {
|
|
328
424
|
class: "size-4",
|
|
329
425
|
"aria-hidden": "true"
|
|
330
|
-
})], 8,
|
|
426
|
+
})], 8, Ee)]))), 128)) : bt.value ? (m(), c("span", {
|
|
331
427
|
key: 1,
|
|
332
|
-
class: p(["min-w-0 flex-1",
|
|
333
|
-
}, [_(t.$slots, "selected", { option:
|
|
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,
|
|
348
|
-
d.clearable &&
|
|
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(
|
|
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",
|
|
359
|
-
])], 16,
|
|
360
|
-
|
|
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:
|
|
458
|
+
id: Ye,
|
|
363
459
|
class: "mt-1 text-base text-danger-strong",
|
|
364
460
|
role: "alert"
|
|
365
|
-
}, v(
|
|
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(() => [
|
|
468
|
+
default: fe(() => [D.value ? (m(), c("div", {
|
|
373
469
|
key: 0,
|
|
374
470
|
ref_key: "panel",
|
|
375
|
-
ref:
|
|
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:
|
|
379
|
-
bottom:
|
|
380
|
-
left: `${
|
|
381
|
-
width: `${
|
|
382
|
-
maxHeight: `${
|
|
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",
|
|
482
|
+
}, [d.searchable ? (m(), c("div", Me, [pe(l("input", {
|
|
387
483
|
ref_key: "searchInput",
|
|
388
|
-
ref:
|
|
389
|
-
"onUpdate:modelValue": a[4] ||= (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":
|
|
394
|
-
"aria-activedescendant":
|
|
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:
|
|
397
|
-
}, null, 40,
|
|
398
|
-
id:
|
|
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 ?
|
|
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(
|
|
405
|
-
id:
|
|
406
|
-
key:
|
|
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":
|
|
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 ===
|
|
411
|
-
onMouseenter: (t) => !e.disabled && (
|
|
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) =>
|
|
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",
|
|
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
|
-
}, [
|
|
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",
|
|
519
|
+
})) : s("", !0)], 2)) : s("", !0), l("span", Le, [_(t.$slots, "option", {
|
|
424
520
|
option: e,
|
|
425
|
-
selected:
|
|
426
|
-
active: n ===
|
|
427
|
-
}, () => [l("span",
|
|
428
|
-
|
|
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:
|
|
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",
|
|
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) =>
|
|
531
|
+
onMouseenter: a[6] ||= (e) => P.value = Y.value,
|
|
436
532
|
onMousedown: a[7] ||= x(() => {}, ["prevent"]),
|
|
437
|
-
onClick:
|
|
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",
|
|
442
|
-
!
|
|
443
|
-
], 8,
|
|
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 {
|
|
546
|
+
export { Ue as default };
|