@ac-design/design-system 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/charts/ChartFrame.vue_vue_type_script_setup_true_lang.js +89 -88
- package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +74 -73
- package/dist/lib/components/AcClusterSwitcher.vue_vue_type_script_setup_true_lang.js +151 -150
- package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +373 -372
- package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +56 -55
- package/dist/lib/components/AcFormFooter.vue_vue_type_script_setup_true_lang.js +39 -38
- package/dist/lib/components/AcModal.vue_vue_type_script_setup_true_lang.js +3 -1
- package/dist/lib/components/AcNotificationMenu.vue_vue_type_script_setup_true_lang.js +90 -89
- package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +146 -145
- package/dist/lib/components/AcSidePanel.vue_vue_type_script_setup_true_lang.js +3 -1
- package/dist/lib/components/AcSideTabs.vue.d.ts +1 -1
- package/dist/lib/components/AcTimePicker.vue_vue_type_script_setup_true_lang.js +156 -155
- package/dist/lib/components/AcTooltip.vue_vue_type_script_setup_true_lang.js +73 -72
- package/dist/lib/components/AcUserMenu.vue_vue_type_script_setup_true_lang.js +132 -131
- package/dist/lib/components/fixedFrame.d.ts +11 -0
- package/dist/lib/components/fixedFrame.js +24 -0
- package/package.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import e from "./AcButton.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { fixedFrame as t } from "./fixedFrame.js";
|
|
3
|
+
import { Teleport as n, Transition as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createVNode as c, defineComponent as l, mergeModels as u, nextTick as d, normalizeClass as f, normalizeStyle as ee, onBeforeUnmount as te, onMounted as p, onUpdated as m, openBlock as h, provide as g, ref as _, renderSlot as v, toRef as y, unref as b, useId as x, useModel as S, useSlots as C, watch as w, withCtx as T } from "vue";
|
|
4
|
+
import { ChevronDown as E, Ellipsis as D } from "@lucide/vue";
|
|
4
5
|
//#region src/lib/components/AcDropdown.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
-
var
|
|
6
|
+
var O = ["aria-label", "disabled"], k = ["aria-labelledby", "aria-label"], A = "[role=\"menuitem\"]:not([aria-disabled=\"true\"])", j = /*@__PURE__*/ l({
|
|
6
7
|
__name: "AcDropdown",
|
|
7
|
-
props: /*@__PURE__*/
|
|
8
|
+
props: /*@__PURE__*/ u({
|
|
8
9
|
label: { default: "" },
|
|
9
10
|
menuLabel: { default: "Actions" },
|
|
10
11
|
align: { default: "start" },
|
|
@@ -22,24 +23,24 @@ var ne = ["aria-label", "disabled"], re = ["aria-labelledby", "aria-label"], D =
|
|
|
22
23
|
openModifiers: {}
|
|
23
24
|
}),
|
|
24
25
|
emits: ["update:open"],
|
|
25
|
-
setup(
|
|
26
|
-
let
|
|
26
|
+
setup(l) {
|
|
27
|
+
let u = l, j = S(l, "open"), M = C(), ne = {
|
|
27
28
|
menu: 240,
|
|
28
29
|
panel: 320
|
|
29
|
-
},
|
|
30
|
+
}, re = {
|
|
30
31
|
"top-start": "origin-top-left",
|
|
31
32
|
"top-end": "origin-top-right",
|
|
32
33
|
"bottom-start": "origin-bottom-left",
|
|
33
34
|
"bottom-end": "origin-bottom-right"
|
|
34
|
-
},
|
|
35
|
+
}, ie = {
|
|
35
36
|
menu: "rounded-10 border-border py-1",
|
|
36
37
|
panel: "rounded-14 border-border/80 p-2"
|
|
37
|
-
}, N = x(), P = `${N}-menu`, F =
|
|
38
|
+
}, N = x(), P = `${N}-menu`, F = _(null), I = _(null), L = _({}), R = _(!1), z = _(""), B = null, V = "menu", H = "", U, W = i(() => re[`${R.value ? "top" : "bottom"}-${u.align}`]);
|
|
38
39
|
function G() {
|
|
39
|
-
B = F.value?.querySelector("button, a[href], [tabindex]") ?? null, B && (B.id || (B.id = `${N}-trigger`), z.value = B.id, B.setAttribute("aria-haspopup", "menu"), B.setAttribute("aria-expanded", String(
|
|
40
|
+
B = F.value?.querySelector("button, a[href], [tabindex]") ?? null, B && (B.id || (B.id = `${N}-trigger`), z.value = B.id, B.setAttribute("aria-haspopup", "menu"), B.setAttribute("aria-expanded", String(j.value)), j.value ? B.setAttribute("aria-controls", P) : B.removeAttribute("aria-controls"));
|
|
40
41
|
}
|
|
41
42
|
function K() {
|
|
42
|
-
return [...I.value?.querySelectorAll(
|
|
43
|
+
return [...I.value?.querySelectorAll(A) ?? []];
|
|
43
44
|
}
|
|
44
45
|
function q(e) {
|
|
45
46
|
let t = K();
|
|
@@ -47,44 +48,44 @@ var ne = ["aria-label", "disabled"], re = ["aria-labelledby", "aria-label"], D =
|
|
|
47
48
|
t[e === "first" ? 0 : e === "last" ? t.length - 1 : (e + t.length) % t.length]?.focus();
|
|
48
49
|
}
|
|
49
50
|
function J(e) {
|
|
50
|
-
|
|
51
|
+
u.disabled || (V = e, j.value = !0);
|
|
51
52
|
}
|
|
52
53
|
function Y(e = !0) {
|
|
53
|
-
|
|
54
|
+
j.value && (j.value = !1, e && B?.focus());
|
|
54
55
|
}
|
|
55
56
|
function X() {
|
|
56
57
|
if (!B || !I.value) return;
|
|
57
|
-
let e = B.getBoundingClientRect(), t = `${Math.min(Math.max(e.width,
|
|
58
|
-
I.value.style.minWidth =
|
|
59
|
-
let { offsetWidth:
|
|
60
|
-
R.value = !
|
|
61
|
-
[
|
|
62
|
-
left: `${Math.max(8, Math.min(
|
|
63
|
-
minWidth:
|
|
64
|
-
maxHeight: `${Math.max(
|
|
58
|
+
let e = B.getBoundingClientRect(), n = t(), r = `${Math.min(Math.max(e.width, ne[u.variant]), n.width - 16)}px`;
|
|
59
|
+
I.value.style.minWidth = r;
|
|
60
|
+
let { offsetWidth: i, offsetHeight: a } = I.value, o = n.bottom - e.bottom - 8 - 8, s = e.top - n.top - 8 - 8, c = u.placement === "top" ? s >= a || s > o : o < a && s > o, l = (u.align === "end" ? e.right - i : e.left) - n.left;
|
|
61
|
+
R.value = !c, L.value = {
|
|
62
|
+
[c ? "bottom" : "top"]: `${c ? n.bottom - e.top + 8 : e.bottom + 8 - n.top}px`,
|
|
63
|
+
left: `${Math.max(8, Math.min(l, n.width - i - 8))}px`,
|
|
64
|
+
minWidth: r,
|
|
65
|
+
maxHeight: `${Math.max(c ? s : o, 120)}px`
|
|
65
66
|
};
|
|
66
67
|
}
|
|
67
|
-
function
|
|
68
|
+
function ae(e) {
|
|
68
69
|
if (B?.contains(e.target)) {
|
|
69
|
-
if (
|
|
70
|
+
if (j.value) return Y();
|
|
70
71
|
J(e.detail === 0 ? "first" : "menu");
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
+
function oe(e) {
|
|
74
75
|
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
75
|
-
if (e.preventDefault(),
|
|
76
|
+
if (e.preventDefault(), j.value) return q(e.key === "ArrowDown" ? "first" : "last");
|
|
76
77
|
J(e.key === "ArrowDown" ? "first" : "last");
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
|
-
function
|
|
80
|
+
function se(e) {
|
|
80
81
|
let t = K(), n = t.indexOf(document.activeElement);
|
|
81
82
|
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
82
83
|
e.preventDefault();
|
|
83
84
|
let t = e.key === "ArrowDown" ? 1 : -1;
|
|
84
85
|
q(n < 0 ? t > 0 ? "first" : "last" : n + t);
|
|
85
|
-
} else e.key === "Home" || e.key === "End" ? (e.preventDefault(), q(e.key === "Home" ? "first" : "last")) : e.key === "Escape" ? (e.preventDefault(), Y()) : e.key === "Tab" ? Y() : e.key === " " && n >= 0 && t[n].tagName !== "BUTTON" ? (e.preventDefault(), t[n].click()) : e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey && e.key !== " " &&
|
|
86
|
+
} else e.key === "Home" || e.key === "End" ? (e.preventDefault(), q(e.key === "Home" ? "first" : "last")) : e.key === "Escape" ? (e.preventDefault(), Y()) : e.key === "Tab" ? Y() : e.key === " " && n >= 0 && t[n].tagName !== "BUTTON" ? (e.preventDefault(), t[n].click()) : e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey && e.key !== " " && ce(e.key, t, n);
|
|
86
87
|
}
|
|
87
|
-
function
|
|
88
|
+
function ce(e, t, n) {
|
|
88
89
|
H += e.toLowerCase(), clearTimeout(U), U = setTimeout(() => H = "", 500);
|
|
89
90
|
let r = (e) => (e.dataset.acLabel || e.textContent || "").trim().toLowerCase(), i = H.length === 1 ? n + 1 : Math.max(n, 0);
|
|
90
91
|
[...t.slice(i), ...t.slice(0, i)].find((e) => r(e).startsWith(H))?.focus();
|
|
@@ -99,49 +100,49 @@ var ne = ["aria-label", "disabled"], re = ["aria-labelledby", "aria-label"], D =
|
|
|
99
100
|
function $(e) {
|
|
100
101
|
e ? (document.addEventListener("pointerdown", Z, !0), window.addEventListener("scroll", Q, !0), window.addEventListener("resize", Q)) : (document.removeEventListener("pointerdown", Z, !0), window.removeEventListener("scroll", Q, !0), window.removeEventListener("resize", Q));
|
|
101
102
|
}
|
|
102
|
-
return
|
|
103
|
+
return g("ac-dropdown", {
|
|
103
104
|
close: Y,
|
|
104
105
|
focusMenu: () => I.value?.focus(),
|
|
105
|
-
variant:
|
|
106
|
-
}),
|
|
107
|
-
G(), $(e), e && (await
|
|
108
|
-
}),
|
|
106
|
+
variant: y(u, "variant")
|
|
107
|
+
}), w(j, async (e) => {
|
|
108
|
+
G(), $(e), e && (await d(), X(), V === "menu" ? I.value?.focus() : q(V), V = "menu");
|
|
109
|
+
}), p(G), m(G), te(() => {
|
|
109
110
|
$(!1), clearTimeout(U);
|
|
110
|
-
}), (
|
|
111
|
+
}), (t, i) => (h(), s("div", {
|
|
111
112
|
ref_key: "root",
|
|
112
113
|
ref: F,
|
|
113
114
|
class: "inline-flex",
|
|
114
115
|
"data-ac-ds": "",
|
|
115
116
|
"data-testid": "ac-dropdown",
|
|
116
|
-
onClick:
|
|
117
|
-
onKeydown:
|
|
118
|
-
}, [
|
|
117
|
+
onClick: ae,
|
|
118
|
+
onKeydown: oe
|
|
119
|
+
}, [M.trigger ? v(t.$slots, "trigger", { open: j.value }, void 0, void 0, 0) : l.label ? (h(), a(e, {
|
|
119
120
|
key: 1,
|
|
120
|
-
title:
|
|
121
|
+
title: l.label,
|
|
121
122
|
color: "white",
|
|
122
|
-
disabled:
|
|
123
|
+
disabled: l.disabled
|
|
123
124
|
}, {
|
|
124
|
-
default:
|
|
125
|
-
class:
|
|
125
|
+
default: T(() => [c(b(E), {
|
|
126
|
+
class: f(["-mr-1 text-muted transition-transform duration-200", j.value && "rotate-180"]),
|
|
126
127
|
"aria-hidden": "true"
|
|
127
128
|
}, null, 8, ["class"])]),
|
|
128
129
|
_: 1
|
|
129
|
-
}, 8, ["title", "disabled"])) : (
|
|
130
|
+
}, 8, ["title", "disabled"])) : (h(), s("button", {
|
|
130
131
|
key: 2,
|
|
131
132
|
type: "button",
|
|
132
|
-
"aria-label":
|
|
133
|
-
disabled:
|
|
134
|
-
class:
|
|
135
|
-
}, [
|
|
133
|
+
"aria-label": l.menuLabel,
|
|
134
|
+
disabled: l.disabled,
|
|
135
|
+
class: f(["inline-flex size-7 cursor-pointer items-center justify-center rounded-8 text-muted transition-colors duration-200 hover:bg-surface-sunken hover:text-heading focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-surface focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50", j.value && "bg-surface-sunken text-heading"])
|
|
136
|
+
}, [c(b(D), {
|
|
136
137
|
class: "size-4",
|
|
137
138
|
"aria-hidden": "true"
|
|
138
|
-
})], 10,
|
|
139
|
+
})], 10, O)), (h(), a(n, { to: "body" }, [c(r, {
|
|
139
140
|
"enter-active-class": "transition-[opacity,scale] duration-150 ease-out motion-reduce:transition-none",
|
|
140
141
|
"enter-from-class": "opacity-0 motion-safe:scale-95",
|
|
141
142
|
"leave-active-class": "transition-[opacity,scale] duration-100 ease-in motion-reduce:transition-none",
|
|
142
143
|
"leave-to-class": "opacity-0 motion-safe:scale-95"
|
|
143
144
|
}, {
|
|
144
|
-
default:
|
|
145
|
+
default: T(() => [j.value ? (h(), s("div", {
|
|
145
146
|
key: 0,
|
|
146
147
|
id: P,
|
|
147
148
|
ref_key: "panel",
|
|
@@ -149,17 +150,17 @@ var ne = ["aria-label", "disabled"], re = ["aria-labelledby", "aria-label"], D =
|
|
|
149
150
|
role: "menu",
|
|
150
151
|
tabindex: "-1",
|
|
151
152
|
"aria-orientation": "vertical",
|
|
152
|
-
"aria-labelledby": (
|
|
153
|
-
"aria-label":
|
|
154
|
-
class:
|
|
155
|
-
style:
|
|
153
|
+
"aria-labelledby": (M.trigger || l.label) && z.value ? z.value : void 0,
|
|
154
|
+
"aria-label": M.trigger || l.label ? void 0 : l.menuLabel,
|
|
155
|
+
class: f(["ac-scrollbar fixed z-[90] flex w-max max-w-[min(320px,calc(100vw-16px))] flex-col border bg-surface shadow-lg outline-none", [ie[l.variant], W.value]]),
|
|
156
|
+
style: ee(L.value),
|
|
156
157
|
"data-ac-ds": "",
|
|
157
158
|
"data-testid": "ac-dropdown-menu",
|
|
158
|
-
onKeydown:
|
|
159
|
-
}, [
|
|
159
|
+
onKeydown: se
|
|
160
|
+
}, [v(t.$slots, "default")], 46, k)) : o("", !0)]),
|
|
160
161
|
_: 3
|
|
161
162
|
})]))], 544));
|
|
162
163
|
}
|
|
163
164
|
});
|
|
164
165
|
//#endregion
|
|
165
|
-
export {
|
|
166
|
+
export { j as default };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import e from "./AcButton.js";
|
|
2
|
-
import {
|
|
2
|
+
import { fixedFrame as t } from "./fixedFrame.js";
|
|
3
|
+
import { computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createVNode as s, defineComponent as c, inject as l, normalizeClass as u, normalizeStyle as d, onBeforeUnmount as f, onMounted as p, openBlock as m, ref as h, renderSlot as g, watch as _ } from "vue";
|
|
3
4
|
//#region src/lib/components/AcFormFooter.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
-
var
|
|
5
|
+
var v = { class: "flex min-w-0 items-center gap-2 text-base text-muted" }, y = { class: "ml-auto flex items-center gap-3" }, b = /*@__PURE__*/ c({
|
|
5
6
|
__name: "AcFormFooter",
|
|
6
7
|
props: {
|
|
7
8
|
submitLabel: { default: "Save" },
|
|
@@ -22,58 +23,58 @@ var _ = { class: "flex min-w-0 items-center gap-2 text-base text-muted" }, v = {
|
|
|
22
23
|
form: { default: "" }
|
|
23
24
|
},
|
|
24
25
|
emits: ["cancel", "save"],
|
|
25
|
-
setup(
|
|
26
|
-
let
|
|
26
|
+
setup(c, { emit: b }) {
|
|
27
|
+
let x = c, S = b, C = l("ac-form", null), w = h(null), T = h(null), E = h({
|
|
27
28
|
left: 0,
|
|
28
29
|
width: 0,
|
|
29
30
|
height: 0
|
|
30
|
-
}),
|
|
31
|
-
function
|
|
32
|
-
e.currentTarget?.form ||
|
|
31
|
+
}), D, O = n(() => C?.widthClass.value ?? "");
|
|
32
|
+
function k(e) {
|
|
33
|
+
e.currentTarget?.form || S("save");
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
-
if (!
|
|
36
|
-
let e =
|
|
37
|
-
|
|
38
|
-
left: e.left,
|
|
35
|
+
function A() {
|
|
36
|
+
if (!w.value || !T.value) return;
|
|
37
|
+
let e = w.value.getBoundingClientRect();
|
|
38
|
+
E.value = {
|
|
39
|
+
left: e.left - t().left,
|
|
39
40
|
width: e.width,
|
|
40
|
-
height:
|
|
41
|
+
height: T.value.offsetHeight
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
|
-
function A() {
|
|
44
|
-
j(), b.sticky === "viewport" && C.value && w.value && (k(), E = new ResizeObserver(k), E.observe(C.value), E.observe(w.value), window.addEventListener("resize", k));
|
|
45
|
-
}
|
|
46
44
|
function j() {
|
|
47
|
-
|
|
45
|
+
M(), x.sticky === "viewport" && w.value && T.value && (A(), D = new ResizeObserver(A), D.observe(w.value), D.observe(T.value), window.addEventListener("resize", A));
|
|
48
46
|
}
|
|
49
|
-
|
|
47
|
+
function M() {
|
|
48
|
+
D?.disconnect(), D = void 0, window.removeEventListener("resize", A);
|
|
49
|
+
}
|
|
50
|
+
return _(() => x.sticky, j, { flush: "post" }), p(j), f(M), (t, n) => (m(), a("div", {
|
|
50
51
|
ref_key: "root",
|
|
51
|
-
ref:
|
|
52
|
-
class:
|
|
53
|
-
style:
|
|
52
|
+
ref: w,
|
|
53
|
+
class: u(["mt-4 w-full", [c.sticky === "container" && "sticky bottom-0 z-10", c.sticky !== "viewport" && O.value]]),
|
|
54
|
+
style: d(c.sticky === "viewport" ? { height: `${E.value.height}px` } : void 0),
|
|
54
55
|
"data-ac-ds": "",
|
|
55
56
|
"data-testid": "ac-form-footer"
|
|
56
|
-
}, [
|
|
57
|
+
}, [o("div", {
|
|
57
58
|
ref_key: "bar",
|
|
58
|
-
ref:
|
|
59
|
-
class:
|
|
60
|
-
style:
|
|
61
|
-
left: `${
|
|
62
|
-
width: `${
|
|
59
|
+
ref: T,
|
|
60
|
+
class: u(["border-t border-border bg-surface py-4", c.sticky === "viewport" && "fixed bottom-0 z-40 px-4"]),
|
|
61
|
+
style: d(c.sticky === "viewport" ? {
|
|
62
|
+
left: `${E.value.left}px`,
|
|
63
|
+
width: `${E.value.width}px`
|
|
63
64
|
} : void 0)
|
|
64
|
-
}, [
|
|
65
|
+
}, [o("div", { class: u(["flex w-full flex-wrap items-center justify-between gap-x-4 gap-y-2", O.value]) }, [o("div", v, [g(t.$slots, "left")]), o("div", y, [g(t.$slots, "right", {}, () => [c.hideCancel ? i("", !0) : (m(), r(e, {
|
|
65
66
|
key: 0,
|
|
66
|
-
title:
|
|
67
|
+
title: c.cancelLabel,
|
|
67
68
|
color: "white",
|
|
68
|
-
disabled:
|
|
69
|
-
onClick:
|
|
70
|
-
}, null, 8, ["title", "disabled"])),
|
|
71
|
-
title:
|
|
69
|
+
disabled: c.loading,
|
|
70
|
+
onClick: n[0] ||= (e) => S("cancel")
|
|
71
|
+
}, null, 8, ["title", "disabled"])), s(e, {
|
|
72
|
+
title: c.submitLabel,
|
|
72
73
|
type: "submit",
|
|
73
|
-
form:
|
|
74
|
-
loading:
|
|
75
|
-
disabled:
|
|
76
|
-
onClick:
|
|
74
|
+
form: c.form || void 0,
|
|
75
|
+
loading: c.loading,
|
|
76
|
+
disabled: c.disabled,
|
|
77
|
+
onClick: k
|
|
77
78
|
}, null, 8, [
|
|
78
79
|
"title",
|
|
79
80
|
"form",
|
|
@@ -83,4 +84,4 @@ var _ = { class: "flex min-w-0 items-center gap-2 text-base text-muted" }, v = {
|
|
|
83
84
|
}
|
|
84
85
|
});
|
|
85
86
|
//#endregion
|
|
86
|
-
export {
|
|
87
|
+
export { b as default };
|
|
@@ -82,7 +82,9 @@ var w = [
|
|
|
82
82
|
let t = document.body, n = Number(t.dataset.acModals ?? 0) + (e ? 1 : -1);
|
|
83
83
|
if (t.dataset.acModals = String(Math.max(n, 0)), e && n === 1) {
|
|
84
84
|
let e = window.innerWidth - document.documentElement.clientWidth;
|
|
85
|
-
t.style.overflow = "hidden"
|
|
85
|
+
t.style.overflow = "hidden";
|
|
86
|
+
let n = getComputedStyle(document.documentElement).scrollbarGutter.includes("stable");
|
|
87
|
+
e > 0 && !n && (t.style.paddingRight = `${e}px`);
|
|
86
88
|
} else !e && n <= 0 && (t.style.overflow = "", t.style.paddingRight = "");
|
|
87
89
|
}
|
|
88
90
|
return b(V, async (e, t) => {
|