@ac-design/design-system 2.6.1 → 2.7.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 +2 -2
- package/dist/lib/charts/graph.d.ts +9 -15
- package/dist/lib/charts/graph.js +79 -75
- package/dist/lib/charts/index.d.ts +4 -2
- package/dist/lib/charts/index.js +2 -1
- package/dist/lib/charts/nodeSymbol.d.ts +15 -0
- package/dist/lib/charts/nodeSymbol.js +27 -0
- package/dist/lib/charts/tree.d.ts +15 -0
- package/dist/lib/charts/tree.js +89 -0
- package/dist/lib/compat.css +113 -0
- package/dist/lib/components/AcAccordionItem.vue.d.ts +3 -1
- package/dist/lib/components/AcAccordionItem.vue_vue_type_script_setup_true_lang.js +35 -26
- package/dist/lib/components/AcAlert.vue.d.ts +1 -1
- package/dist/lib/components/AcBadge.vue.d.ts +1 -1
- package/dist/lib/components/AcBanner.vue.d.ts +1 -1
- package/dist/lib/components/AcCard.vue.d.ts +1 -1
- package/dist/lib/components/AcCellValue.vue.d.ts +1 -1
- package/dist/lib/components/AcCheckList.vue.d.ts +1 -1
- package/dist/lib/components/AcConfirmModal.vue.d.ts +1 -1
- package/dist/lib/components/AcDropdownItem.vue.d.ts +1 -1
- package/dist/lib/components/AcFeatureCard.vue.d.ts +1 -1
- package/dist/lib/components/AcGraphChart.vue.d.ts +53 -3
- package/dist/lib/components/AcGraphChart.vue_vue_type_script_setup_true_lang.js +401 -233
- package/dist/lib/components/AcList.js +5 -0
- package/dist/lib/components/AcList.vue.d.ts +56 -0
- package/dist/lib/components/AcList.vue_vue_type_script_setup_true_lang.js +74 -0
- package/dist/lib/components/AcListItem.js +5 -0
- package/dist/lib/components/AcListItem.vue.d.ts +53 -0
- package/dist/lib/components/AcListItem.vue_vue_type_script_setup_true_lang.js +105 -0
- package/dist/lib/components/AcMapChart.vue.d.ts +66 -3
- package/dist/lib/components/AcMapChart.vue_vue_type_script_setup_true_lang.js +403 -201
- package/dist/lib/components/AcMonthPicker.js +5 -0
- package/dist/lib/components/AcMonthPicker.vue.d.ts +102 -0
- package/dist/lib/components/AcMonthPicker.vue_vue_type_script_setup_true_lang.js +595 -0
- package/dist/lib/components/AcNavbarItem.vue.d.ts +1 -1
- package/dist/lib/components/AcResourceCard.vue.d.ts +1 -1
- package/dist/lib/components/AcSideTabs.vue.d.ts +3 -1
- package/dist/lib/components/AcSideTabs.vue_vue_type_script_setup_true_lang.js +53 -33
- package/dist/lib/components/AcSidebarItem.vue.d.ts +1 -1
- package/dist/lib/components/AcStatCard.vue.d.ts +1 -1
- package/dist/lib/components/AcTreeChart.js +5 -0
- package/dist/lib/components/AcTreeChart.vue.d.ts +135 -0
- package/dist/lib/components/AcTreeChart.vue_vue_type_script_setup_true_lang.js +809 -0
- package/dist/lib/components/AcUsageCard.vue.d.ts +1 -1
- package/dist/lib/components/index.d.ts +5 -2
- package/dist/lib/composables/copyText.d.ts +5 -1
- package/dist/lib/composables/copyText.js +15 -3
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/index.js +85 -81
- package/package.json +1 -1
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
import { fixedFrame as e } from "./fixedFrame.js";
|
|
2
|
+
import { Fragment as t, Teleport as n, Transition as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, defineComponent as u, mergeModels as ee, mergeProps as d, nextTick as f, normalizeClass as p, onBeforeUnmount as te, onMounted as ne, openBlock as m, ref as h, renderList as g, renderSlot as re, resolveDynamicComponent as ie, toDisplayString as _, unref as v, useAttrs as ae, useId as oe, useModel as se, watch as ce, withCtx as le } from "vue";
|
|
3
|
+
import { Calendar as ue, CalendarRange as de, ChevronLeft as fe, ChevronRight as pe, X as me } from "@lucide/vue";
|
|
4
|
+
//#region src/lib/components/AcMonthPicker.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var he = ["for"], ge = { key: 0 }, _e = {
|
|
6
|
+
key: 1,
|
|
7
|
+
class: "text-danger",
|
|
8
|
+
"aria-hidden": "true"
|
|
9
|
+
}, ve = [
|
|
10
|
+
"id",
|
|
11
|
+
"disabled",
|
|
12
|
+
"aria-expanded",
|
|
13
|
+
"aria-labelledby",
|
|
14
|
+
"aria-describedby",
|
|
15
|
+
"aria-invalid",
|
|
16
|
+
"aria-required"
|
|
17
|
+
], ye = ["aria-label"], be = [
|
|
18
|
+
"role",
|
|
19
|
+
"aria-modal",
|
|
20
|
+
"aria-label",
|
|
21
|
+
"aria-describedby",
|
|
22
|
+
"inert"
|
|
23
|
+
], xe = {
|
|
24
|
+
key: 0,
|
|
25
|
+
class: "flex shrink-0 flex-wrap gap-1 border-b border-border p-2 sm:w-44 sm:flex-col sm:flex-nowrap sm:border-r sm:border-b-0",
|
|
26
|
+
role: "group",
|
|
27
|
+
"aria-label": "Presets"
|
|
28
|
+
}, Se = ["onClick"], Ce = { class: "p-3" }, we = { class: "mb-2 flex items-center justify-between gap-2" }, Te = ["aria-label", "aria-disabled"], Ee = ["aria-label"], De = {
|
|
29
|
+
key: 1,
|
|
30
|
+
class: "rounded-10 bg-accent px-4 py-2 text-base font-semibold text-heading tabular-nums",
|
|
31
|
+
"aria-hidden": "true"
|
|
32
|
+
}, Oe = ["aria-label", "aria-disabled"], ke = ["aria-label"], Ae = ["aria-selected"], je = [
|
|
33
|
+
"data-month",
|
|
34
|
+
"tabindex",
|
|
35
|
+
"aria-label",
|
|
36
|
+
"aria-disabled",
|
|
37
|
+
"aria-current",
|
|
38
|
+
"onClick",
|
|
39
|
+
"onFocus",
|
|
40
|
+
"onMouseenter"
|
|
41
|
+
], Me = ["aria-label"], Ne = ["aria-selected"], Pe = [
|
|
42
|
+
"data-year",
|
|
43
|
+
"tabindex",
|
|
44
|
+
"aria-label",
|
|
45
|
+
"aria-disabled",
|
|
46
|
+
"aria-current",
|
|
47
|
+
"onClick",
|
|
48
|
+
"onFocus"
|
|
49
|
+
], Fe = {
|
|
50
|
+
key: 0,
|
|
51
|
+
class: "flex flex-wrap items-center gap-2 border-t border-border px-3 py-3"
|
|
52
|
+
}, Ie = ["disabled"], Le = ["name", "value"], y = 12, b = /*@__PURE__*/ u({
|
|
53
|
+
inheritAttrs: !1,
|
|
54
|
+
__name: "AcMonthPicker",
|
|
55
|
+
props: /*@__PURE__*/ ee({
|
|
56
|
+
label: { default: "" },
|
|
57
|
+
placeholder: { default: "" },
|
|
58
|
+
range: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: !1
|
|
61
|
+
},
|
|
62
|
+
minMonth: { default: "" },
|
|
63
|
+
maxMonth: { default: "" },
|
|
64
|
+
minDate: { default: "" },
|
|
65
|
+
maxDate: { default: "" },
|
|
66
|
+
isMonthDisabled: {
|
|
67
|
+
type: Function,
|
|
68
|
+
default: void 0
|
|
69
|
+
},
|
|
70
|
+
presets: { default: () => [] },
|
|
71
|
+
locale: { default: void 0 },
|
|
72
|
+
clearable: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
default: !1
|
|
75
|
+
},
|
|
76
|
+
disabled: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: !1
|
|
79
|
+
},
|
|
80
|
+
required: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: !1
|
|
83
|
+
},
|
|
84
|
+
errorMsg: { default: "" },
|
|
85
|
+
hint: { default: "" },
|
|
86
|
+
size: { default: "normal" },
|
|
87
|
+
name: { default: "" },
|
|
88
|
+
inline: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
default: !1
|
|
91
|
+
},
|
|
92
|
+
valueType: { default: "string" },
|
|
93
|
+
fieldClass: {
|
|
94
|
+
type: [
|
|
95
|
+
Boolean,
|
|
96
|
+
null,
|
|
97
|
+
String,
|
|
98
|
+
Object,
|
|
99
|
+
Array
|
|
100
|
+
],
|
|
101
|
+
default: void 0
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
104
|
+
modelValue: { default: null },
|
|
105
|
+
modelModifiers: {},
|
|
106
|
+
open: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
default: !1
|
|
109
|
+
},
|
|
110
|
+
openModifiers: {}
|
|
111
|
+
}),
|
|
112
|
+
emits: ["update:modelValue", "update:open"],
|
|
113
|
+
setup(u, { expose: ee }) {
|
|
114
|
+
let b = u, x = se(u, "modelValue"), S = se(u, "open"), Re = /^(\d{4})-(\d{2})/, C = oe(), w = ae(), ze = i(() => ({
|
|
115
|
+
class: w.class,
|
|
116
|
+
style: w.style
|
|
117
|
+
})), Be = i(() => {
|
|
118
|
+
let { class: e, style: t, ...n } = w;
|
|
119
|
+
return n;
|
|
120
|
+
}), Ve = `${C}-label`, T = `${C}-value`, He = `${C}-title`, Ue = `${C}-msg`, We = `${C}-hint`, Ge = h(null), E = h(null), D = h(null), O = h({
|
|
121
|
+
left: 0,
|
|
122
|
+
maxHeight: 480,
|
|
123
|
+
minWidth: 0
|
|
124
|
+
}), k = h("months"), A = h(2026), j = h(2020), M = h("2026-01"), N = h(2026), P = h(null), F = h(null), I = h(null), L = h(!1), Ke = i(() => new Intl.DateTimeFormat(b.locale, {
|
|
125
|
+
month: "short",
|
|
126
|
+
timeZone: "UTC"
|
|
127
|
+
})), qe = i(() => new Intl.DateTimeFormat(b.locale, {
|
|
128
|
+
month: "long",
|
|
129
|
+
year: "numeric",
|
|
130
|
+
timeZone: "UTC"
|
|
131
|
+
})), Je = i(() => new Intl.DateTimeFormat(b.locale, {
|
|
132
|
+
month: "short",
|
|
133
|
+
year: "numeric",
|
|
134
|
+
timeZone: "UTC"
|
|
135
|
+
})), R = i(() => ft(/* @__PURE__ */ new Date())), z = i(() => K(b.minMonth) ?? K(b.minDate)), B = i(() => K(b.maxMonth) ?? K(b.maxDate)), V = i({
|
|
136
|
+
get() {
|
|
137
|
+
let e = x.value;
|
|
138
|
+
return e instanceof Date ? Number.isNaN(e.getTime()) ? null : ft(e) : e || null;
|
|
139
|
+
},
|
|
140
|
+
set(e) {
|
|
141
|
+
if (b.range || Array.isArray(e) || b.valueType !== "date" && !(x.value instanceof Date)) {
|
|
142
|
+
x.value = e;
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
x.value = e ? pt(K(e) ?? e) : null;
|
|
146
|
+
}
|
|
147
|
+
}), H = i(() => {
|
|
148
|
+
let e = V.value;
|
|
149
|
+
return b.range ? Array.isArray(e) ? [K(e[0]), K(e[1])] : [null, null] : [typeof e == "string" ? K(e) : null];
|
|
150
|
+
}), U = i(() => H.value.some(Boolean)), Ye = i(() => {
|
|
151
|
+
let [e, t] = H.value;
|
|
152
|
+
if (!e) return typeof V.value == "string" ? V.value : "";
|
|
153
|
+
if (!b.range) return qe.value.format(Y(e));
|
|
154
|
+
let n = Je.value.format(Y(e));
|
|
155
|
+
return t ? e === t ? n : `${n} – ${Je.value.format(Y(t))}` : `${n} –`;
|
|
156
|
+
}), Xe = i(() => H.value.filter(Boolean).join("/")), Ze = i(() => Array.from({ length: 12 }, (e, t) => {
|
|
157
|
+
let n = `${A.value}-${G(t + 1)}`;
|
|
158
|
+
return {
|
|
159
|
+
key: n,
|
|
160
|
+
text: Ke.value.format(Y(n)),
|
|
161
|
+
label: qe.value.format(Y(n)),
|
|
162
|
+
disabled: mt(n)
|
|
163
|
+
};
|
|
164
|
+
})), Qe = i(() => [
|
|
165
|
+
0,
|
|
166
|
+
3,
|
|
167
|
+
6,
|
|
168
|
+
9
|
|
169
|
+
].map((e) => Ze.value.slice(e, e + 3))), $e = i(() => q(M.value) === A.value ? M.value : Ze.value[0].key), et = i(() => Array.from({ length: y }, (e, t) => {
|
|
170
|
+
let n = j.value + t;
|
|
171
|
+
return {
|
|
172
|
+
year: n,
|
|
173
|
+
disabled: ht(n),
|
|
174
|
+
selected: n === A.value
|
|
175
|
+
};
|
|
176
|
+
})), tt = i(() => [
|
|
177
|
+
0,
|
|
178
|
+
3,
|
|
179
|
+
6,
|
|
180
|
+
9
|
|
181
|
+
].map((e) => et.value.slice(e, e + 3))), nt = i(() => et.value.some((e) => e.year === N.value) ? N.value : j.value), W = i(() => k.value === "months" ? String(A.value) : `${j.value}–${j.value + y - 1}`), rt = i(() => k.value === "months" ? ["Previous year", "Next year"] : ["Previous years", "Next years"]), it = i(() => z.value ? k.value === "months" ? `${A.value - 1}-12` < z.value : q(z.value) >= j.value : !1), at = i(() => B.value ? k.value === "months" ? `${A.value + 1}-01` > B.value : q(B.value) <= j.value + y - 1 : !1), ot = i(() => !b.range || !F.value ? null : I.value ?? P.value ?? null), st = i(() => b.clearable && U.value || !b.range && !b.inline), ct = i(() => S.value || L.value), lt = i(() => [b.hint && We, b.errorMsg && Ue].filter(Boolean).join(" ") || void 0), ut = i(() => {
|
|
182
|
+
let e = b.range ? "month range" : "month";
|
|
183
|
+
return b.label ? `${b.label}: choose ${e}` : `Choose ${e}`;
|
|
184
|
+
});
|
|
185
|
+
function G(e) {
|
|
186
|
+
return String(e).padStart(2, "0");
|
|
187
|
+
}
|
|
188
|
+
function K(e) {
|
|
189
|
+
let t = e ? Re.exec(e) : null;
|
|
190
|
+
if (!t) return null;
|
|
191
|
+
let n = Number(t[2]);
|
|
192
|
+
return n >= 1 && n <= 12 ? `${t[1]}-${t[2]}` : null;
|
|
193
|
+
}
|
|
194
|
+
function q(e) {
|
|
195
|
+
return Number(e.slice(0, 4));
|
|
196
|
+
}
|
|
197
|
+
function J(e) {
|
|
198
|
+
return Number(e.slice(5, 7)) - 1;
|
|
199
|
+
}
|
|
200
|
+
function dt(e, t) {
|
|
201
|
+
let n = q(e) * 12 + J(e) + t;
|
|
202
|
+
return `${Math.floor(n / 12)}-${G(n % 12 + 1)}`;
|
|
203
|
+
}
|
|
204
|
+
function Y(e) {
|
|
205
|
+
return new Date(Date.UTC(q(e), J(e), 1));
|
|
206
|
+
}
|
|
207
|
+
function ft(e) {
|
|
208
|
+
return `${e.getFullYear()}-${G(e.getMonth() + 1)}`;
|
|
209
|
+
}
|
|
210
|
+
function pt(e) {
|
|
211
|
+
return new Date(q(e), J(e), 1);
|
|
212
|
+
}
|
|
213
|
+
function mt(e) {
|
|
214
|
+
return z.value && e < z.value || B.value && e > B.value ? !0 : b.isMonthDisabled?.(e) ?? !1;
|
|
215
|
+
}
|
|
216
|
+
function ht(e) {
|
|
217
|
+
return !!z.value && `${e}-12` < z.value || !!B.value && `${e}-01` > B.value;
|
|
218
|
+
}
|
|
219
|
+
function gt(e) {
|
|
220
|
+
return e === F.value || b.range && e === (I.value ?? ot.value);
|
|
221
|
+
}
|
|
222
|
+
function _t(e) {
|
|
223
|
+
let t = F.value, n = ot.value;
|
|
224
|
+
if (!t || !n) return !1;
|
|
225
|
+
let [r, i] = t <= n ? [t, n] : [n, t];
|
|
226
|
+
return e >= r && e <= i;
|
|
227
|
+
}
|
|
228
|
+
function vt(e) {
|
|
229
|
+
let t = F.value, n = ot.value, [r, i] = t <= n ? [t, n] : [n, t];
|
|
230
|
+
return [e === r && "rounded-l-8", e === i && "rounded-r-8"];
|
|
231
|
+
}
|
|
232
|
+
function yt(e = !0) {
|
|
233
|
+
P.value = null, e && (k.value = "months");
|
|
234
|
+
let [t, n] = H.value;
|
|
235
|
+
F.value = t ?? null, I.value = b.range ? n ?? null : null;
|
|
236
|
+
let r = t ?? R.value;
|
|
237
|
+
!t && z.value && r < z.value && (r = z.value), !t && B.value && r > B.value && (r = B.value), M.value = r, A.value = q(r);
|
|
238
|
+
}
|
|
239
|
+
function bt() {
|
|
240
|
+
let t = E.value;
|
|
241
|
+
if (!t) return;
|
|
242
|
+
let n = t.getBoundingClientRect(), r = e(), i = D.value?.offsetWidth ?? 300, a = D.value?.offsetHeight ?? 320, o = r.bottom - n.bottom - 6 - 8, s = n.top - r.top - 6 - 8, c = o < a && s > o, l = Math.max(8, Math.min(n.left - r.left, r.width - i - 8)), u = Math.min(n.width, 448);
|
|
243
|
+
O.value = c ? {
|
|
244
|
+
bottom: r.bottom - n.top + 6,
|
|
245
|
+
left: l,
|
|
246
|
+
maxHeight: Math.max(200, s),
|
|
247
|
+
minWidth: u
|
|
248
|
+
} : {
|
|
249
|
+
top: n.bottom + 6 - r.top,
|
|
250
|
+
left: l,
|
|
251
|
+
maxHeight: Math.max(200, o),
|
|
252
|
+
minWidth: u
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
function xt() {
|
|
256
|
+
b.disabled || S.value || (S.value = !0);
|
|
257
|
+
}
|
|
258
|
+
function X(e = !0) {
|
|
259
|
+
S.value && (S.value = !1, e && E.value?.focus());
|
|
260
|
+
}
|
|
261
|
+
async function St() {
|
|
262
|
+
yt(), bt(), Lt(), await f(), bt(), Z();
|
|
263
|
+
}
|
|
264
|
+
function Z() {
|
|
265
|
+
f(() => D.value?.querySelector(`[data-month="${$e.value}"]`)?.focus());
|
|
266
|
+
}
|
|
267
|
+
function Ct() {
|
|
268
|
+
f(() => D.value?.querySelector(`[data-year="${nt.value}"]`)?.focus());
|
|
269
|
+
}
|
|
270
|
+
function Q(e) {
|
|
271
|
+
V.value = e, X();
|
|
272
|
+
}
|
|
273
|
+
function wt(e) {
|
|
274
|
+
if (!mt(e)) {
|
|
275
|
+
if (M.value = e, A.value = q(e), !b.range) {
|
|
276
|
+
F.value = e, Q(e);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
if (!F.value || I.value) {
|
|
280
|
+
F.value = e, I.value = null;
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
e < F.value ? (I.value = F.value, F.value = e) : I.value = e, P.value = null, Q([F.value, I.value]);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
function Tt(e) {
|
|
287
|
+
let t = e.value();
|
|
288
|
+
if (!Array.isArray(t)) return Q(K(t) ?? t);
|
|
289
|
+
let n = K(t[0]) ?? t[0], r = K(t[1]) ?? t[1];
|
|
290
|
+
Q(n <= r ? [n, r] : [r, n]);
|
|
291
|
+
}
|
|
292
|
+
function Et() {
|
|
293
|
+
if (V.value = null, b.inline) return Z();
|
|
294
|
+
X(!1), E.value?.focus();
|
|
295
|
+
}
|
|
296
|
+
function Dt(e) {
|
|
297
|
+
(e < 0 ? it.value : at.value) || (k.value === "months" ? (A.value += e, M.value = dt(M.value, 12 * e)) : (j.value += y * e, N.value += y * e));
|
|
298
|
+
}
|
|
299
|
+
function Ot() {
|
|
300
|
+
k.value = "months", Z();
|
|
301
|
+
}
|
|
302
|
+
function kt() {
|
|
303
|
+
k.value = "years", j.value = Math.floor(A.value / 10) * 10, N.value = A.value, Ct();
|
|
304
|
+
}
|
|
305
|
+
function At(e) {
|
|
306
|
+
e.disabled || (A.value = e.year, M.value = `${e.year}-${G(J(M.value) + 1)}`, Ot());
|
|
307
|
+
}
|
|
308
|
+
function jt(e, t) {
|
|
309
|
+
return {
|
|
310
|
+
ArrowLeft: -1,
|
|
311
|
+
ArrowRight: 1,
|
|
312
|
+
ArrowUp: -3,
|
|
313
|
+
ArrowDown: 3,
|
|
314
|
+
PageUp: -12,
|
|
315
|
+
PageDown: 12,
|
|
316
|
+
Home: -t,
|
|
317
|
+
End: 2 - t
|
|
318
|
+
}[e] ?? null;
|
|
319
|
+
}
|
|
320
|
+
function Mt(e) {
|
|
321
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
322
|
+
e.preventDefault(), wt(M.value);
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
let t = jt(e.key, J(M.value) % 3);
|
|
326
|
+
t !== null && (e.preventDefault(), M.value = dt(M.value, t), A.value = q(M.value), b.range && F.value && !I.value && (P.value = M.value), Z());
|
|
327
|
+
}
|
|
328
|
+
function Nt(e) {
|
|
329
|
+
if (e.key === "Escape") {
|
|
330
|
+
e.preventDefault(), e.stopPropagation(), Ot();
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
334
|
+
e.preventDefault();
|
|
335
|
+
let t = et.value.find((e) => e.year === N.value);
|
|
336
|
+
t && At(t);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
let t = jt(e.key, (N.value - j.value) % 3);
|
|
340
|
+
if (t === null) return;
|
|
341
|
+
e.preventDefault();
|
|
342
|
+
let n = N.value + t;
|
|
343
|
+
j.value += Math.floor((n - j.value) / y) * y, N.value = n, Ct();
|
|
344
|
+
}
|
|
345
|
+
function Pt(e) {
|
|
346
|
+
if (b.inline) return;
|
|
347
|
+
if (e.key === "Escape") {
|
|
348
|
+
e.preventDefault(), e.stopPropagation(), X();
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
if (e.key !== "Tab" || !D.value) return;
|
|
352
|
+
let t = [...D.value.querySelectorAll("button:not([disabled])")].filter((e) => e.tabIndex >= 0);
|
|
353
|
+
if (!t.length) return;
|
|
354
|
+
let n = t[0], r = t[t.length - 1];
|
|
355
|
+
e.shiftKey && document.activeElement === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && document.activeElement === r && (e.preventDefault(), n.focus());
|
|
356
|
+
}
|
|
357
|
+
function Ft(e) {
|
|
358
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp" && e.altKey) && (e.preventDefault(), xt());
|
|
359
|
+
}
|
|
360
|
+
function It(e) {
|
|
361
|
+
let t = e.target;
|
|
362
|
+
Ge.value?.contains(t) || D.value?.contains(t) || X(!1);
|
|
363
|
+
}
|
|
364
|
+
function $(e) {
|
|
365
|
+
e?.target instanceof Node && D.value?.contains(e.target) || bt();
|
|
366
|
+
}
|
|
367
|
+
function Lt() {
|
|
368
|
+
document.addEventListener("pointerdown", It, !0), window.addEventListener("scroll", $, !0), window.addEventListener("resize", $);
|
|
369
|
+
}
|
|
370
|
+
function Rt() {
|
|
371
|
+
document.removeEventListener("pointerdown", It, !0), window.removeEventListener("scroll", $, !0), window.removeEventListener("resize", $);
|
|
372
|
+
}
|
|
373
|
+
return ce(S, (e) => e ? St() : Rt()), ce(V, () => b.inline && yt(!1)), ne(() => {
|
|
374
|
+
b.inline ? yt() : S.value && St();
|
|
375
|
+
}), te(Rt), ee({ focus: () => b.inline ? Z() : E.value?.focus() }), (e, i) => (m(), s("div", d({
|
|
376
|
+
ref_key: "root",
|
|
377
|
+
ref: Ge
|
|
378
|
+
}, ze.value, {
|
|
379
|
+
class: ["w-full", u.disabled && "opacity-50"],
|
|
380
|
+
"data-ac-ds": "",
|
|
381
|
+
"data-testid": "ac-month-picker"
|
|
382
|
+
}), [
|
|
383
|
+
u.label || e.$slots["label-icon"] || e.$slots["label-extra"] ? (m(), s("label", {
|
|
384
|
+
key: 0,
|
|
385
|
+
id: Ve,
|
|
386
|
+
for: u.inline ? void 0 : `${v(C)}-trigger`,
|
|
387
|
+
class: "mb-2 flex items-center gap-1 text-base font-medium text-heading"
|
|
388
|
+
}, [
|
|
389
|
+
re(e.$slots, "label-icon"),
|
|
390
|
+
u.label ? (m(), s("span", ge, _(u.label), 1)) : o("", !0),
|
|
391
|
+
re(e.$slots, "label-extra"),
|
|
392
|
+
u.required ? (m(), s("span", _e, "*")) : o("", !0)
|
|
393
|
+
], 8, he)) : o("", !0),
|
|
394
|
+
u.hint ? (m(), s("p", {
|
|
395
|
+
key: 1,
|
|
396
|
+
id: We,
|
|
397
|
+
class: "mb-2 text-base text-muted"
|
|
398
|
+
}, _(u.hint), 1)) : o("", !0),
|
|
399
|
+
u.inline ? o("", !0) : (m(), s("div", {
|
|
400
|
+
key: 2,
|
|
401
|
+
class: p(["relative", u.fieldClass])
|
|
402
|
+
}, [c("button", d({
|
|
403
|
+
id: `${v(C)}-trigger`,
|
|
404
|
+
ref_key: "trigger",
|
|
405
|
+
ref: E
|
|
406
|
+
}, Be.value, {
|
|
407
|
+
type: "button",
|
|
408
|
+
disabled: u.disabled,
|
|
409
|
+
"aria-haspopup": "dialog",
|
|
410
|
+
"aria-expanded": S.value,
|
|
411
|
+
"aria-labelledby": u.label || e.$slots["label-icon"] || e.$slots["label-extra"] ? `${Ve} ${T}` : T,
|
|
412
|
+
"aria-describedby": lt.value,
|
|
413
|
+
"aria-invalid": !!u.errorMsg || void 0,
|
|
414
|
+
"aria-required": u.required || void 0,
|
|
415
|
+
class: ["flex w-full items-center rounded-10 border bg-background text-left text-heading transition-[color,background-color,border-color,box-shadow] duration-200 outline-none disabled:cursor-not-allowed", [
|
|
416
|
+
u.size === "small" ? "h-9 pl-3 text-base font-normal" : u.size === "large" ? "h-[50px] pl-4 text-lg font-medium" : "h-10.5 pl-4 text-base font-normal",
|
|
417
|
+
u.clearable && U.value && !u.disabled ? "pr-20" : "pr-10",
|
|
418
|
+
u.disabled ? "" : "cursor-pointer hover:bg-accent-hover",
|
|
419
|
+
u.errorMsg ? ["border-danger/60", ct.value && "border-danger shadow-[0_0_0_2px_color-mix(in_srgb,var(--color-danger)_20%,transparent)]"] : ct.value ? "focus-ring" : ["border-border", !u.disabled && "hover:border-accent-active"]
|
|
420
|
+
]],
|
|
421
|
+
onClick: i[0] ||= (e) => S.value ? X() : xt(),
|
|
422
|
+
onKeydown: Ft,
|
|
423
|
+
onFocus: i[1] ||= (e) => L.value = !0,
|
|
424
|
+
onBlur: i[2] ||= (e) => L.value = !1
|
|
425
|
+
}), [c("span", {
|
|
426
|
+
id: T,
|
|
427
|
+
class: p(["truncate tabular-nums", !Ye.value && "text-muted/80"])
|
|
428
|
+
}, _(Ye.value || u.placeholder || (u.range ? "Choose months" : "Choose month")), 3)], 16, ve), c("span", { class: p(["pointer-events-none absolute inset-y-0 flex items-center gap-4 text-muted", u.size === "small" ? "right-3" : "right-4"]) }, [u.clearable && U.value && !u.disabled ? (m(), s("button", {
|
|
429
|
+
key: 0,
|
|
430
|
+
type: "button",
|
|
431
|
+
class: "pointer-events-auto inline-flex cursor-pointer items-center justify-center rounded-full p-1 transition-colors duration-200 hover:bg-accent-hover hover:text-primary active:bg-accent-active focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
|
|
432
|
+
"aria-label": u.label ? `Clear ${u.label}` : "Clear",
|
|
433
|
+
onClick: Et
|
|
434
|
+
}, [l(v(me), {
|
|
435
|
+
class: "size-4",
|
|
436
|
+
"aria-hidden": "true"
|
|
437
|
+
})], 8, ye)) : o("", !0), (m(), a(ie(u.range ? v(de) : v(ue)), {
|
|
438
|
+
class: p(["size-4", S.value && "text-heading"]),
|
|
439
|
+
"aria-hidden": "true"
|
|
440
|
+
}, null, 8, ["class"]))], 2)], 2)),
|
|
441
|
+
(m(), a(n, {
|
|
442
|
+
to: "body",
|
|
443
|
+
disabled: u.inline
|
|
444
|
+
}, [l(r, {
|
|
445
|
+
"enter-active-class": "transition duration-150 ease-out motion-reduce:transition-opacity",
|
|
446
|
+
"enter-from-class": "opacity-0 scale-95",
|
|
447
|
+
"leave-active-class": "transition duration-100 ease-in",
|
|
448
|
+
"leave-to-class": "opacity-0"
|
|
449
|
+
}, {
|
|
450
|
+
default: le(() => [S.value || u.inline ? (m(), s("div", d({
|
|
451
|
+
key: 0,
|
|
452
|
+
ref_key: "panel",
|
|
453
|
+
ref: D,
|
|
454
|
+
role: u.inline ? "group" : "dialog",
|
|
455
|
+
"aria-modal": u.inline ? void 0 : "true",
|
|
456
|
+
"aria-label": ut.value,
|
|
457
|
+
"aria-describedby": u.inline ? lt.value : void 0,
|
|
458
|
+
inert: u.inline && u.disabled
|
|
459
|
+
}, u.inline ? Be.value : void 0, {
|
|
460
|
+
class: ["flex flex-col sm:flex-row", !u.inline && "ac-scrollbar fixed z-[90] max-w-[calc(100vw-16px)] rounded-10 border border-border bg-surface shadow-sm"],
|
|
461
|
+
style: u.inline ? void 0 : {
|
|
462
|
+
top: O.value.top === void 0 ? void 0 : `${O.value.top}px`,
|
|
463
|
+
bottom: O.value.bottom === void 0 ? void 0 : `${O.value.bottom}px`,
|
|
464
|
+
left: `${O.value.left}px`,
|
|
465
|
+
maxHeight: `${O.value.maxHeight}px`,
|
|
466
|
+
minWidth: `${O.value.minWidth}px`
|
|
467
|
+
},
|
|
468
|
+
"data-ac-ds": "",
|
|
469
|
+
"data-testid": "ac-month-picker-panel",
|
|
470
|
+
onKeydown: Pt
|
|
471
|
+
}), [u.presets.length ? (m(), s("div", xe, [(m(!0), s(t, null, g(u.presets, (e) => (m(), s("button", {
|
|
472
|
+
key: e.label,
|
|
473
|
+
type: "button",
|
|
474
|
+
class: "cursor-pointer rounded-8 px-3 py-2 text-left text-base text-heading transition-colors duration-200 hover:bg-accent-hover active:bg-accent-active focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none focus-visible:ring-inset max-sm:rounded-full max-sm:border max-sm:border-border max-sm:px-2.5 max-sm:py-1 max-sm:text-xs",
|
|
475
|
+
onClick: (t) => Tt(e)
|
|
476
|
+
}, _(e.label), 9, Se))), 128))])) : o("", !0), c("div", { class: p(["max-w-full min-w-0 flex-auto max-sm:w-auto", u.inline ? "w-full" : "w-[calc(296px*var(--ac-scale))]"]) }, [c("div", Ce, [c("div", we, [
|
|
477
|
+
c("button", {
|
|
478
|
+
type: "button",
|
|
479
|
+
class: p(["inline-flex items-center justify-center rounded-8 p-2 text-muted transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none", it.value ? "cursor-not-allowed opacity-50" : "cursor-pointer hover:bg-accent-hover hover:text-heading active:bg-accent-active"]),
|
|
480
|
+
"aria-label": rt.value[0],
|
|
481
|
+
"aria-disabled": it.value || void 0,
|
|
482
|
+
onClick: i[3] ||= (e) => Dt(-1)
|
|
483
|
+
}, [l(v(fe), {
|
|
484
|
+
class: "size-4",
|
|
485
|
+
"aria-hidden": "true"
|
|
486
|
+
})], 10, Te),
|
|
487
|
+
c("span", {
|
|
488
|
+
id: He,
|
|
489
|
+
class: "sr-only",
|
|
490
|
+
"aria-live": "polite"
|
|
491
|
+
}, _(W.value), 1),
|
|
492
|
+
k.value === "months" ? (m(), s("button", {
|
|
493
|
+
key: 0,
|
|
494
|
+
type: "button",
|
|
495
|
+
class: "cursor-pointer rounded-10 bg-accent px-4 py-2 text-base font-semibold text-heading tabular-nums transition-colors duration-200 hover:bg-accent-hover active:bg-accent-active focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
|
|
496
|
+
"aria-label": `${W.value}, choose year`,
|
|
497
|
+
onClick: kt
|
|
498
|
+
}, _(W.value), 9, Ee)) : (m(), s("span", De, _(W.value), 1)),
|
|
499
|
+
c("button", {
|
|
500
|
+
type: "button",
|
|
501
|
+
class: p(["inline-flex items-center justify-center rounded-8 p-2 text-muted transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none", at.value ? "cursor-not-allowed opacity-50" : "cursor-pointer hover:bg-accent-hover hover:text-heading active:bg-accent-active"]),
|
|
502
|
+
"aria-label": rt.value[1],
|
|
503
|
+
"aria-disabled": at.value || void 0,
|
|
504
|
+
onClick: i[4] ||= (e) => Dt(1)
|
|
505
|
+
}, [l(v(pe), {
|
|
506
|
+
class: "size-4",
|
|
507
|
+
"aria-hidden": "true"
|
|
508
|
+
})], 10, Oe)
|
|
509
|
+
]), k.value === "months" ? (m(), s("div", {
|
|
510
|
+
key: 0,
|
|
511
|
+
role: "grid",
|
|
512
|
+
"aria-label": `Months of ${A.value}`,
|
|
513
|
+
class: "grid gap-1",
|
|
514
|
+
onKeydown: Mt,
|
|
515
|
+
onMouseleave: i[5] ||= (e) => P.value = null
|
|
516
|
+
}, [(m(!0), s(t, null, g(Qe.value, (e, n) => (m(), s("div", {
|
|
517
|
+
key: n,
|
|
518
|
+
role: "row",
|
|
519
|
+
class: "grid grid-cols-3"
|
|
520
|
+
}, [(m(!0), s(t, null, g(e, (e) => (m(), s("div", {
|
|
521
|
+
key: e.key,
|
|
522
|
+
role: "gridcell",
|
|
523
|
+
"aria-selected": gt(e.key) || _t(e.key),
|
|
524
|
+
class: p(["px-1", _t(e.key) && ["bg-primary/10", ...vt(e.key)]])
|
|
525
|
+
}, [c("button", {
|
|
526
|
+
type: "button",
|
|
527
|
+
"data-month": e.key,
|
|
528
|
+
tabindex: e.key === $e.value ? 0 : -1,
|
|
529
|
+
"aria-label": e.label,
|
|
530
|
+
"aria-disabled": e.disabled || void 0,
|
|
531
|
+
"aria-current": e.key === R.value ? "date" : void 0,
|
|
532
|
+
class: p(["w-full rounded-8 px-2 py-3 text-base transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface motion-reduce:transition-none", e.disabled ? "cursor-not-allowed text-muted/50 line-through" : gt(e.key) ? "cursor-pointer bg-primary font-semibold text-white" : e.key === R.value ? "cursor-pointer bg-accent font-medium text-heading hover:bg-accent-hover active:bg-accent-active" : "cursor-pointer text-heading hover:bg-accent-hover hover:font-semibold active:bg-accent-active"]),
|
|
533
|
+
onClick: (t) => wt(e.key),
|
|
534
|
+
onFocus: (t) => M.value = e.key,
|
|
535
|
+
onMouseenter: (t) => u.range && F.value && !I.value && (P.value = e.key)
|
|
536
|
+
}, _(e.text), 43, je)], 10, Ae))), 128))]))), 128))], 40, ke)) : (m(), s("div", {
|
|
537
|
+
key: 1,
|
|
538
|
+
role: "grid",
|
|
539
|
+
"aria-label": `Years ${W.value}`,
|
|
540
|
+
class: "grid gap-1",
|
|
541
|
+
onKeydown: Nt
|
|
542
|
+
}, [(m(!0), s(t, null, g(tt.value, (e, n) => (m(), s("div", {
|
|
543
|
+
key: n,
|
|
544
|
+
role: "row",
|
|
545
|
+
class: "grid grid-cols-3"
|
|
546
|
+
}, [(m(!0), s(t, null, g(e, (e) => (m(), s("div", {
|
|
547
|
+
key: e.year,
|
|
548
|
+
role: "gridcell",
|
|
549
|
+
"aria-selected": e.selected,
|
|
550
|
+
class: "px-1"
|
|
551
|
+
}, [c("button", {
|
|
552
|
+
type: "button",
|
|
553
|
+
"data-year": e.year,
|
|
554
|
+
tabindex: e.year === nt.value ? 0 : -1,
|
|
555
|
+
"aria-label": String(e.year),
|
|
556
|
+
"aria-disabled": e.disabled || void 0,
|
|
557
|
+
"aria-current": e.year === q(R.value) ? "date" : void 0,
|
|
558
|
+
class: p(["w-full rounded-8 px-2 py-3 text-base tabular-nums transition-all duration-200 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface motion-reduce:transition-none", e.disabled ? "cursor-not-allowed text-muted/50 line-through" : e.selected ? "cursor-pointer bg-primary font-semibold text-white" : e.year === q(R.value) ? "cursor-pointer bg-accent font-medium text-heading hover:bg-accent-hover active:bg-accent-active" : "cursor-pointer text-heading hover:bg-accent-hover hover:font-semibold active:bg-accent-active"]),
|
|
559
|
+
onClick: (t) => At(e),
|
|
560
|
+
onFocus: (t) => N.value = e.year
|
|
561
|
+
}, _(e.year), 43, Pe)], 8, Ne))), 128))]))), 128))], 40, Me))]), st.value ? (m(), s("div", Fe, [
|
|
562
|
+
!u.range && !u.inline ? (m(), s("button", {
|
|
563
|
+
key: 0,
|
|
564
|
+
type: "button",
|
|
565
|
+
class: "cursor-pointer rounded-8 bg-accent px-3 py-1.5 text-xs font-medium text-heading transition-colors duration-200 hover:bg-accent-hover active:bg-accent-active focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
566
|
+
disabled: mt(R.value),
|
|
567
|
+
onClick: i[6] ||= (e) => wt(R.value)
|
|
568
|
+
}, " This month ", 8, Ie)) : o("", !0),
|
|
569
|
+
i[7] ||= c("span", { class: "flex-1" }, null, -1),
|
|
570
|
+
u.clearable && U.value ? (m(), s("button", {
|
|
571
|
+
key: 1,
|
|
572
|
+
type: "button",
|
|
573
|
+
class: "cursor-pointer rounded-8 px-3 py-1.5 text-xs font-medium text-muted transition-colors duration-200 hover:bg-accent-hover hover:text-heading active:bg-accent-active focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
|
|
574
|
+
onClick: Et
|
|
575
|
+
}, " Clear ")) : o("", !0)
|
|
576
|
+
])) : o("", !0)], 2)], 16, be)) : o("", !0)]),
|
|
577
|
+
_: 1
|
|
578
|
+
})], 8, ["disabled"])),
|
|
579
|
+
u.errorMsg ? (m(), s("p", {
|
|
580
|
+
key: 3,
|
|
581
|
+
id: Ue,
|
|
582
|
+
class: "mt-1 text-base text-danger-strong",
|
|
583
|
+
role: "alert"
|
|
584
|
+
}, _(u.errorMsg), 1)) : o("", !0),
|
|
585
|
+
u.name ? (m(), s("input", {
|
|
586
|
+
key: 4,
|
|
587
|
+
type: "hidden",
|
|
588
|
+
name: u.name,
|
|
589
|
+
value: Xe.value
|
|
590
|
+
}, null, 8, Le)) : o("", !0)
|
|
591
|
+
], 16));
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
//#endregion
|
|
595
|
+
export { b as default };
|
|
@@ -27,9 +27,9 @@ declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, i
|
|
|
27
27
|
onClick?: ((e: MouseEvent) => any) | undefined;
|
|
28
28
|
}>, {
|
|
29
29
|
disabled: boolean;
|
|
30
|
-
icon: Component;
|
|
31
30
|
href: string;
|
|
32
31
|
to: string | object;
|
|
32
|
+
icon: Component;
|
|
33
33
|
iconOnly: boolean;
|
|
34
34
|
active: boolean;
|
|
35
35
|
badge: string | number;
|
|
@@ -81,10 +81,10 @@ declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, i
|
|
|
81
81
|
}>, {
|
|
82
82
|
details: ResourceDetail[];
|
|
83
83
|
disabled: boolean;
|
|
84
|
-
icon: Component;
|
|
85
84
|
target: string;
|
|
86
85
|
href: string;
|
|
87
86
|
to: string | Record<string, unknown>;
|
|
87
|
+
icon: Component;
|
|
88
88
|
status: string;
|
|
89
89
|
loading: boolean;
|
|
90
90
|
subtitle: string;
|
|
@@ -5,6 +5,8 @@ export interface SideTabItem {
|
|
|
5
5
|
key: string;
|
|
6
6
|
/** Text of the item. */
|
|
7
7
|
label: string;
|
|
8
|
+
/** A muted second line under the label, e.g. "Sort, search, select". Truncated to one line; hidden in the collapsed rail and the phone row of tabs. */
|
|
9
|
+
description?: string;
|
|
8
10
|
/** A Lucide icon component, e.g. `:icon="Database"`. The collapsed rail shows only the icon. */
|
|
9
11
|
icon?: Component;
|
|
10
12
|
/** Route for `RouterLink` (needs vue-router in the app). The item for the current route becomes active by itself. */
|
|
@@ -25,7 +27,7 @@ export interface SideTabItem {
|
|
|
25
27
|
children?: SideTabItem[];
|
|
26
28
|
}
|
|
27
29
|
export interface Props {
|
|
28
|
-
/** The sections: `{ key, label, icon?, to?, href?, badge?, tone?, disabled?, group?, children? }`. */
|
|
30
|
+
/** The sections: `{ key, label, description?, icon?, to?, href?, badge?, tone?, disabled?, group?, children? }`. */
|
|
29
31
|
items: SideTabItem[];
|
|
30
32
|
/** Accessible name of the navigation, and the label of the select on phones. */
|
|
31
33
|
label?: string;
|