@ac-design/design-system 2.7.0 → 2.8.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 +49 -10
- package/dist/lib/components/AcCard.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/lib/components/AcCheckBox.vue_vue_type_script_setup_true_lang.js +46 -43
- package/dist/lib/components/AcCheckRadio.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/lib/components/AcColorInput.vue.d.ts +4 -0
- package/dist/lib/components/AcColorInput.vue_vue_type_script_setup_true_lang.js +12 -2
- package/dist/lib/components/AcDatePicker.vue.d.ts +3 -0
- package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +12 -2
- package/dist/lib/components/AcHeader.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/lib/components/AcInput.vue.d.ts +2 -0
- package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +18 -8
- package/dist/lib/components/AcModal.vue_vue_type_script_setup_true_lang.js +12 -8
- package/dist/lib/components/AcMonthPicker.vue.d.ts +3 -0
- package/dist/lib/components/AcMonthPicker.vue_vue_type_script_setup_true_lang.js +12 -2
- package/dist/lib/components/AcNumberInput.vue.d.ts +3 -0
- package/dist/lib/components/AcNumberInput.vue_vue_type_script_setup_true_lang.js +11 -1
- package/dist/lib/components/AcSelect.vue.d.ts +3 -0
- package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +241 -218
- package/dist/lib/components/AcSidePanel.vue_vue_type_script_setup_true_lang.js +11 -7
- package/dist/lib/components/AcSidebar.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/lib/components/AcSteps.vue.d.ts +3 -0
- package/dist/lib/components/AcSteps.vue_vue_type_script_setup_true_lang.js +33 -29
- package/dist/lib/components/AcSwitch.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +83 -72
- package/dist/lib/components/AcTextarea.vue.d.ts +3 -0
- package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +11 -1
- package/dist/lib/components/AcTimePicker.vue.d.ts +3 -0
- package/dist/lib/components/AcTimePicker.vue_vue_type_script_setup_true_lang.js +12 -2
- package/dist/lib/components/AcToaster.vue.d.ts +3 -0
- package/dist/lib/components/AcToaster.vue_vue_type_script_setup_true_lang.js +71 -68
- package/dist/lib/theme.css +11 -0
- package/package.json +1 -1
|
@@ -42,6 +42,16 @@ var le = ["for"], ue = { key: 0 }, de = {
|
|
|
42
42
|
__name: "AcTimePicker",
|
|
43
43
|
props: /*@__PURE__*/ d({
|
|
44
44
|
label: { default: "" },
|
|
45
|
+
labelClass: {
|
|
46
|
+
type: [
|
|
47
|
+
Boolean,
|
|
48
|
+
null,
|
|
49
|
+
String,
|
|
50
|
+
Object,
|
|
51
|
+
Array
|
|
52
|
+
],
|
|
53
|
+
default: void 0
|
|
54
|
+
},
|
|
45
55
|
placeholder: { default: "Choose time" },
|
|
46
56
|
hourCycle: { default: 24 },
|
|
47
57
|
minuteStep: { default: 1 },
|
|
@@ -391,13 +401,13 @@ var le = ["for"], ue = { key: 0 }, de = {
|
|
|
391
401
|
key: 0,
|
|
392
402
|
id: k,
|
|
393
403
|
for: u.inline ? void 0 : `${b(E)}-trigger`,
|
|
394
|
-
class: "mb-2 flex items-center gap-1 text-base font-medium text-heading"
|
|
404
|
+
class: m(["mb-2 flex items-center gap-1 text-base font-medium text-heading", u.labelClass])
|
|
395
405
|
}, [
|
|
396
406
|
v(e.$slots, "label-icon"),
|
|
397
407
|
u.label ? (h(), s("span", ue, y(u.label), 1)) : o("", !0),
|
|
398
408
|
v(e.$slots, "label-extra"),
|
|
399
409
|
u.required ? (h(), s("span", de, "*")) : o("", !0)
|
|
400
|
-
],
|
|
410
|
+
], 10, le)) : o("", !0),
|
|
401
411
|
u.hint ? (h(), s("p", {
|
|
402
412
|
key: 1,
|
|
403
413
|
id: M,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export interface Props {
|
|
2
2
|
/** Corner of the screen. `top-right` sits 80px from the top, under an app navbar, as cloud-ui. On phones (under 640px) toasts span the width at the same edge. */
|
|
3
3
|
position?: "top-right" | "top-center" | "bottom-right" | "bottom-center";
|
|
4
|
+
/** Distance from the top (or bottom) edge, e.g. `"136px"` to clear a page header's buttons. Defaults to 80px at the top and 20px at the bottom; the `--ac-toaster-offset` CSS variable sets it app-wide. */
|
|
5
|
+
offset?: string;
|
|
4
6
|
/** How many toasts show at once (phones show at most 3). Newer ones queue behind and their timers wait until they're shown. */
|
|
5
7
|
max?: number;
|
|
6
8
|
/** Shows the shrinking 2px time bar on every toast. A toast's own `progress` option wins. */
|
|
@@ -12,6 +14,7 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
|
|
|
12
14
|
label: string;
|
|
13
15
|
progress: boolean;
|
|
14
16
|
max: number;
|
|
17
|
+
offset: string;
|
|
15
18
|
position: "top-right" | "top-center" | "bottom-right" | "bottom-center";
|
|
16
19
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
20
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import e from "./AcButton.js";
|
|
2
2
|
import { useToast as t } from "../composables/useToast.js";
|
|
3
|
-
import { Fragment as n, Teleport as r, TransitionGroup as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, nextTick as f, normalizeClass as p,
|
|
3
|
+
import { Fragment as n, Teleport as r, TransitionGroup as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, nextTick as f, normalizeClass as p, normalizeStyle as m, onBeforeUnmount as h, openBlock as g, ref as _, renderList as v, resolveDynamicComponent as y, toDisplayString as b, unref as x, watch as S, withCtx as ee } from "vue";
|
|
4
4
|
import { CircleCheck as C, CircleX as w, Info as T, TriangleAlert as E, X as D } from "@lucide/vue";
|
|
5
5
|
//#region src/lib/components/AcToaster.vue?vue&type=script&setup=true&lang.ts
|
|
6
6
|
var O = ["aria-label"], k = {
|
|
@@ -8,7 +8,7 @@ var O = ["aria-label"], k = {
|
|
|
8
8
|
role: "status",
|
|
9
9
|
"aria-live": "polite",
|
|
10
10
|
"aria-atomic": "true"
|
|
11
|
-
},
|
|
11
|
+
}, A = {
|
|
12
12
|
class: "sr-only",
|
|
13
13
|
role: "alert",
|
|
14
14
|
"aria-live": "assertive",
|
|
@@ -16,10 +16,11 @@ var O = ["aria-label"], k = {
|
|
|
16
16
|
}, te = ["data-tone"], ne = { class: "flex min-w-0 flex-1 flex-col gap-0.5" }, re = { class: "text-base leading-[1.35] font-semibold break-words text-heading" }, ie = {
|
|
17
17
|
key: 0,
|
|
18
18
|
class: "text-[13px] leading-[1.45] break-words text-muted"
|
|
19
|
-
},
|
|
19
|
+
}, j = ["aria-label", "onClick"], M = ["data-toast-bar"], N = 3, P = "transition-[opacity,translate] duration-300 ease-[cubic-bezier(0.21,1.02,0.73,1)] motion-reduce:duration-150", F = /*@__PURE__*/ d({
|
|
20
20
|
__name: "AcToaster",
|
|
21
21
|
props: {
|
|
22
22
|
position: { default: "top-right" },
|
|
23
|
+
offset: { default: "" },
|
|
23
24
|
max: { default: 5 },
|
|
24
25
|
progress: {
|
|
25
26
|
type: Boolean,
|
|
@@ -28,7 +29,7 @@ var O = ["aria-label"], k = {
|
|
|
28
29
|
label: { default: "Notifications" }
|
|
29
30
|
},
|
|
30
31
|
setup(d) {
|
|
31
|
-
let
|
|
32
|
+
let F = d, I = {
|
|
32
33
|
neutral: {
|
|
33
34
|
iconClass: "",
|
|
34
35
|
box: "border-border bg-surface",
|
|
@@ -58,137 +59,139 @@ var O = ["aria-label"], k = {
|
|
|
58
59
|
box: "border-border bg-surface",
|
|
59
60
|
bar: "bg-info"
|
|
60
61
|
}
|
|
61
|
-
},
|
|
62
|
-
"top-right": "top-
|
|
63
|
-
"top-center": "top-
|
|
64
|
-
"bottom-right": "bottom-
|
|
65
|
-
"bottom-center": "bottom-
|
|
66
|
-
}, { toasts:
|
|
67
|
-
function
|
|
68
|
-
return e.duration > 0 && (e.progress ??
|
|
69
|
-
}
|
|
70
|
-
function J(e) {
|
|
71
|
-
let t = V.get(e);
|
|
72
|
-
t && !H && (t.started = Date.now(), t.handle = setTimeout(() => L(e), t.remaining), oe(e));
|
|
62
|
+
}, L = {
|
|
63
|
+
"top-right": "top-[var(--ac-toaster-offset,80px)] sm:right-5",
|
|
64
|
+
"top-center": "top-[var(--ac-toaster-offset,80px)] sm:left-1/2 sm:-translate-x-1/2",
|
|
65
|
+
"bottom-right": "bottom-[var(--ac-toaster-offset,20px)] sm:right-5",
|
|
66
|
+
"bottom-center": "bottom-[var(--ac-toaster-offset,20px)] sm:left-1/2 sm:-translate-x-1/2"
|
|
67
|
+
}, { toasts: R, dismiss: z } = t(), B = _(null), V = _(""), H = _(""), U = /* @__PURE__ */ new Map(), W = !1, G = /* @__PURE__ */ new Set(), K = a(() => F.position.startsWith("top")), q = a(() => R.value.slice(-F.max)), J = a(() => F.position.endsWith("right") ? "opacity-0 motion-safe:translate-x-[120%]" : K.value ? "opacity-0 motion-safe:-translate-y-2" : "opacity-0 motion-safe:translate-y-2");
|
|
68
|
+
function ae(e) {
|
|
69
|
+
return e.duration > 0 && (e.progress ?? F.progress);
|
|
73
70
|
}
|
|
74
71
|
function Y(e) {
|
|
75
|
-
let t =
|
|
72
|
+
let t = U.get(e);
|
|
73
|
+
t && !W && (t.started = Date.now(), t.handle = setTimeout(() => z(e), t.remaining), oe(e));
|
|
74
|
+
}
|
|
75
|
+
function X(e) {
|
|
76
|
+
let t = U.get(e);
|
|
76
77
|
t?.handle && (clearTimeout(t.handle), t.handle = void 0, t.remaining -= Date.now() - t.started, t.bar?.pause());
|
|
77
78
|
}
|
|
78
79
|
async function oe(e) {
|
|
79
80
|
await f();
|
|
80
|
-
let t =
|
|
81
|
+
let t = U.get(e);
|
|
81
82
|
if (t?.handle) {
|
|
82
83
|
if (t.bar) return t.bar.play();
|
|
83
|
-
t.bar = (
|
|
84
|
+
t.bar = (B.value?.querySelector(`[data-toast-bar="${CSS.escape(e)}"]`))?.animate([{ transform: "scaleX(1)" }, { transform: "scaleX(0)" }], {
|
|
84
85
|
duration: t.duration,
|
|
85
86
|
fill: "forwards"
|
|
86
87
|
});
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
function Z() {
|
|
93
|
-
H = !0, V.forEach((e, t) => Y(t));
|
|
90
|
+
function Z(e, t = !1) {
|
|
91
|
+
X(e), t && U.get(e)?.bar?.cancel(), U.delete(e);
|
|
94
92
|
}
|
|
95
93
|
function Q() {
|
|
96
|
-
|
|
94
|
+
W = !0, U.forEach((e, t) => X(t));
|
|
97
95
|
}
|
|
98
|
-
function $(
|
|
99
|
-
|
|
96
|
+
function $() {
|
|
97
|
+
W = !1, U.forEach((e, t) => Y(t));
|
|
100
98
|
}
|
|
101
99
|
function se(e) {
|
|
100
|
+
e.currentTarget.contains(e.relatedTarget) || $();
|
|
101
|
+
}
|
|
102
|
+
function ce(e) {
|
|
102
103
|
let t = new Set(e.map((e) => e.id));
|
|
103
|
-
for (let [e] of
|
|
104
|
-
for (let t of e)
|
|
104
|
+
for (let [e] of U) t.has(e) || Z(e);
|
|
105
|
+
for (let t of e) U.get(t.id)?.version !== t.version && (Z(t.id, !0), t.duration > 0 && (U.set(t.id, {
|
|
105
106
|
version: t.version,
|
|
106
107
|
duration: t.duration,
|
|
107
108
|
remaining: t.duration,
|
|
108
109
|
started: 0
|
|
109
|
-
}),
|
|
110
|
+
}), Y(t.id)));
|
|
110
111
|
}
|
|
111
|
-
async function
|
|
112
|
-
let t = e.filter((e) => !
|
|
113
|
-
if (
|
|
112
|
+
async function le(e) {
|
|
113
|
+
let t = e.filter((e) => !G.has(`${e.id}:${e.version}`));
|
|
114
|
+
if (G = new Set(e.map((e) => `${e.id}:${e.version}`)), !t.length) return;
|
|
114
115
|
let n = (e) => /[.!?…]$/.test(e.trim()) ? e.trim() : `${e.trim()}.`, r = (e) => e.flatMap((e) => [e.title, e.description ?? ""].filter(Boolean).map(n)).join(" "), i = t.filter((e) => e.tone === "error"), a = t.filter((e) => e.tone !== "error");
|
|
115
|
-
|
|
116
|
+
V.value = "", H.value = "", await f(), a.length && (V.value = r(a)), i.length && (H.value = r(i));
|
|
116
117
|
}
|
|
117
|
-
function
|
|
118
|
-
e.action?.onClick(),
|
|
118
|
+
function ue(e) {
|
|
119
|
+
e.action?.onClick(), z(e.id);
|
|
119
120
|
}
|
|
120
|
-
return
|
|
121
|
-
|
|
122
|
-
}, { immediate: !0 }),
|
|
121
|
+
return S(q, (e) => {
|
|
122
|
+
ce(e), le(e);
|
|
123
|
+
}, { immediate: !0 }), h(() => U.forEach((e) => {
|
|
123
124
|
clearTimeout(e.handle), e.bar?.cancel();
|
|
124
|
-
})), (t, a) => (
|
|
125
|
+
})), (t, a) => (g(), o(r, { to: "body" }, [l("section", {
|
|
125
126
|
ref_key: "root",
|
|
126
|
-
ref:
|
|
127
|
+
ref: B,
|
|
127
128
|
"aria-label": d.label,
|
|
128
129
|
"data-ac-ds": "",
|
|
129
130
|
"data-testid": "ac-toaster"
|
|
130
131
|
}, [
|
|
131
|
-
l("div", k,
|
|
132
|
-
l("div",
|
|
132
|
+
l("div", k, b(V.value), 1),
|
|
133
|
+
l("div", A, b(H.value), 1),
|
|
133
134
|
u(i, {
|
|
134
135
|
tag: "ol",
|
|
135
|
-
class: p(["pointer-events-none fixed inset-x-5 z-[100] flex flex-col gap-3 sm:inset-x-auto sm:w-[384px]",
|
|
136
|
-
"
|
|
137
|
-
"enter-
|
|
138
|
-
"
|
|
139
|
-
"leave-
|
|
136
|
+
class: p(["pointer-events-none fixed inset-x-5 z-[100] flex flex-col gap-3 sm:inset-x-auto sm:w-[384px]", L[d.position]]),
|
|
137
|
+
style: m(d.offset ? { "--ac-toaster-offset": d.offset } : void 0),
|
|
138
|
+
"enter-active-class": P,
|
|
139
|
+
"enter-from-class": J.value,
|
|
140
|
+
"leave-active-class": P,
|
|
141
|
+
"leave-to-class": J.value,
|
|
140
142
|
"move-class": "motion-safe:transition-transform motion-safe:duration-200",
|
|
141
|
-
onPointerenter:
|
|
142
|
-
onPointerleave:
|
|
143
|
-
onFocusin:
|
|
144
|
-
onFocusout:
|
|
143
|
+
onPointerenter: Q,
|
|
144
|
+
onPointerleave: $,
|
|
145
|
+
onFocusin: Q,
|
|
146
|
+
onFocusout: se
|
|
145
147
|
}, {
|
|
146
|
-
default:
|
|
148
|
+
default: ee(() => [(g(!0), c(n, null, v(q.value, (t, n) => (g(), c("li", {
|
|
147
149
|
key: t.id,
|
|
148
150
|
class: p(["pointer-events-auto relative flex items-start gap-3 overflow-hidden rounded-10 border py-3.5 pl-4 shadow-md", [
|
|
149
|
-
|
|
151
|
+
I[t.tone].box,
|
|
150
152
|
t.dismissible ? "pr-10" : "pr-4",
|
|
151
|
-
|
|
153
|
+
q.value.length - 1 - n >= N && "max-sm:hidden"
|
|
152
154
|
]]),
|
|
153
155
|
"data-ac-ds": "",
|
|
154
156
|
"data-testid": "ac-toast",
|
|
155
157
|
"data-tone": t.tone
|
|
156
158
|
}, [
|
|
157
|
-
|
|
159
|
+
I[t.tone].icon ? (g(), o(y(I[t.tone].icon), {
|
|
158
160
|
key: 0,
|
|
159
|
-
class: p(["mt-px size-5 shrink-0",
|
|
161
|
+
class: p(["mt-px size-5 shrink-0", I[t.tone].iconClass]),
|
|
160
162
|
"stroke-width": 2.25,
|
|
161
163
|
"aria-hidden": "true"
|
|
162
164
|
}, null, 8, ["class"])) : s("", !0),
|
|
163
|
-
l("div", ne, [l("p", re,
|
|
164
|
-
t.action ? (
|
|
165
|
+
l("div", ne, [l("p", re, b(t.title), 1), t.description ? (g(), c("p", ie, b(t.description), 1)) : s("", !0)]),
|
|
166
|
+
t.action ? (g(), o(e, {
|
|
165
167
|
key: 1,
|
|
166
168
|
title: t.action.label,
|
|
167
169
|
size: "small",
|
|
168
170
|
color: "white",
|
|
169
171
|
class: "-my-1 shrink-0",
|
|
170
|
-
onClick: (e) =>
|
|
172
|
+
onClick: (e) => ue(t)
|
|
171
173
|
}, null, 8, ["title", "onClick"])) : s("", !0),
|
|
172
|
-
t.dismissible ? (
|
|
174
|
+
t.dismissible ? (g(), c("button", {
|
|
173
175
|
key: 2,
|
|
174
176
|
type: "button",
|
|
175
177
|
class: "absolute top-2 right-2 inline-flex size-6 cursor-pointer items-center justify-center rounded-6 text-muted transition-colors hover:bg-surface-sunken hover:text-heading focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
|
|
176
178
|
"aria-label": `Dismiss: ${t.title}`,
|
|
177
|
-
onClick: (e) =>
|
|
178
|
-
}, [u(
|
|
179
|
+
onClick: (e) => x(z)(t.id)
|
|
180
|
+
}, [u(x(D), {
|
|
179
181
|
class: "size-3.5",
|
|
180
182
|
"aria-hidden": "true"
|
|
181
|
-
})], 8,
|
|
182
|
-
|
|
183
|
+
})], 8, j)) : s("", !0),
|
|
184
|
+
ae(t) ? (g(), c("span", {
|
|
183
185
|
key: 3,
|
|
184
186
|
"data-toast-bar": t.id,
|
|
185
|
-
class: p(["absolute bottom-0 left-0 h-0.5 w-full origin-left opacity-70 motion-reduce:hidden",
|
|
187
|
+
class: p(["absolute bottom-0 left-0 h-0.5 w-full origin-left opacity-70 motion-reduce:hidden", I[t.tone].bar]),
|
|
186
188
|
"aria-hidden": "true"
|
|
187
|
-
}, null, 10,
|
|
189
|
+
}, null, 10, M)) : s("", !0)
|
|
188
190
|
], 10, te))), 128))]),
|
|
189
191
|
_: 1
|
|
190
192
|
}, 8, [
|
|
191
193
|
"class",
|
|
194
|
+
"style",
|
|
192
195
|
"enter-from-class",
|
|
193
196
|
"leave-to-class"
|
|
194
197
|
])
|
|
@@ -196,4 +199,4 @@ var O = ["aria-label"], k = {
|
|
|
196
199
|
}
|
|
197
200
|
});
|
|
198
201
|
//#endregion
|
|
199
|
-
export {
|
|
202
|
+
export { F as default };
|
package/dist/lib/theme.css
CHANGED
|
@@ -598,6 +598,17 @@
|
|
|
598
598
|
color: var(--color-heading);
|
|
599
599
|
}
|
|
600
600
|
|
|
601
|
+
/* Author HTML (v-html notes, descriptions, labels): links in primary, medium and underlined, so they never rely on colour alone. */
|
|
602
|
+
@utility ac-rich-text {
|
|
603
|
+
& a {
|
|
604
|
+
font-weight: 500;
|
|
605
|
+
color: var(--color-primary);
|
|
606
|
+
text-decoration-line: underline;
|
|
607
|
+
text-decoration-color: var(--color-primary);
|
|
608
|
+
text-underline-offset: 2px;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
|
|
601
612
|
/* The standard focus treatment for form controls: a solid primary border plus a 2px primary/20 halo. */
|
|
602
613
|
@utility focus-ring {
|
|
603
614
|
outline: none;
|