@owocow/saber-ui 0.1.11 → 0.1.13
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/SaberAppLayout.vue_vue_type_script_setup_true_lang-R7F5K7kj.js +418 -0
- package/dist/SaberAppSidebar.vue_vue_type_script_setup_true_lang-Cwuj9VNi.js +263 -0
- package/dist/components/SaberAppLayout.mjs +4 -0
- package/dist/components/SaberAppSidebar.mjs +1 -1
- package/dist/components/layout/SaberAppLayout.types.d.ts +51 -0
- package/dist/components/layout/SaberAppLayout.vue.d.ts +78 -0
- package/dist/components/navigation/SaberAppSidebar.types.d.ts +1 -0
- package/dist/components/navigation/SaberAppSidebar.vue.d.ts +1 -0
- package/dist/composables/use-page-header.mjs +10 -8
- package/dist/forms/components/fields/SaberPopSelect.vue.d.ts +1 -1
- package/dist/forms/components/fields/SaberUploadImage.vue.d.ts +2 -2
- package/dist/index.d.ts +4 -1
- package/dist/index.mjs +45 -43
- package/package.json +7 -2
- package/dist/SaberAppSidebar.vue_vue_type_script_setup_true_lang-CEWQTjEi.js +0 -254
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
import Oe from "@nuxt/ui/components/Button.vue";
|
|
2
|
+
import $e from "@nuxt/ui/components/Drawer.vue";
|
|
3
|
+
import { getCurrentInstance as se, getCurrentScope as Be, hasInjectionContext as ue, inject as De, watch as z, shallowRef as T, watchEffect as Me, toValue as M, computed as u, onMounted as Le, unref as Ue, defineComponent as je, useSlots as Fe, useModel as te, ref as ae, useId as Ie, nextTick as ze, openBlock as x, createElementBlock as S, normalizeStyle as A, normalizeClass as d, renderSlot as h, normalizeProps as $, guardReactiveProps as B, Fragment as H, createCommentVNode as D, createVNode as G, withCtx as ne, createElementVNode as f, toDisplayString as oe, createBlock as Te, mergeModels as le } from "vue";
|
|
4
|
+
import { tv as R } from "tailwind-variants";
|
|
5
|
+
import { providePageHeader as Ne } from "./composables/use-page-header.mjs";
|
|
6
|
+
import { _ as Ee } from "./SaberNavigationSearch.vue_vue_type_script_setup_true_lang-Bj96kMla.js";
|
|
7
|
+
const V = /* @__PURE__ */ new WeakMap(), Pe = /* @__NO_SIDE_EFFECTS__ */ (...t) => {
|
|
8
|
+
var r;
|
|
9
|
+
const e = t[0], l = (r = se()) === null || r === void 0 ? void 0 : r.proxy, n = l ?? Be();
|
|
10
|
+
if (n == null && !ue()) throw new Error("injectLocal must be called in setup");
|
|
11
|
+
return n && V.has(n) && e in V.get(n) ? V.get(n)[e] : De(...t);
|
|
12
|
+
}, Ae = typeof window < "u" && typeof document < "u";
|
|
13
|
+
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
14
|
+
const He = Object.prototype.toString, Ge = (t) => He.call(t) === "[object Object]";
|
|
15
|
+
function ie(t) {
|
|
16
|
+
return t.endsWith("rem") ? Number.parseFloat(t) * 16 : Number.parseFloat(t);
|
|
17
|
+
}
|
|
18
|
+
function K(t) {
|
|
19
|
+
return Array.isArray(t) ? t : [t];
|
|
20
|
+
}
|
|
21
|
+
function Re(t, r, e) {
|
|
22
|
+
return z(t, r, {
|
|
23
|
+
...e,
|
|
24
|
+
immediate: !0
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
const de = Ae ? window : void 0;
|
|
28
|
+
function Ve(t) {
|
|
29
|
+
var r;
|
|
30
|
+
const e = M(t);
|
|
31
|
+
return (r = e == null ? void 0 : e.$el) !== null && r !== void 0 ? r : e;
|
|
32
|
+
}
|
|
33
|
+
function Ke(...t) {
|
|
34
|
+
const r = (l, n, c, o) => (l.addEventListener(n, c, o), () => l.removeEventListener(n, c, o)), e = u(() => {
|
|
35
|
+
const l = K(M(t[0])).filter((n) => n != null);
|
|
36
|
+
return l.every((n) => typeof n != "string") ? l : void 0;
|
|
37
|
+
});
|
|
38
|
+
return Re(() => {
|
|
39
|
+
var l, n;
|
|
40
|
+
return [
|
|
41
|
+
(l = (n = e.value) === null || n === void 0 ? void 0 : n.map((c) => Ve(c))) !== null && l !== void 0 ? l : [de].filter((c) => c != null),
|
|
42
|
+
K(M(e.value ? t[1] : t[0])),
|
|
43
|
+
K(Ue(e.value ? t[2] : t[1])),
|
|
44
|
+
M(e.value ? t[3] : t[2])
|
|
45
|
+
];
|
|
46
|
+
}, ([l, n, c, o], b, L) => {
|
|
47
|
+
if (!(l != null && l.length) || !(n != null && n.length) || !(c != null && c.length)) return;
|
|
48
|
+
const k = Ge(o) ? { ...o } : o, p = l.flatMap((g) => n.flatMap((i) => c.map((w) => r(g, i, w, k))));
|
|
49
|
+
L(() => {
|
|
50
|
+
p.forEach((g) => g());
|
|
51
|
+
});
|
|
52
|
+
}, { flush: "post" });
|
|
53
|
+
}
|
|
54
|
+
// @__NO_SIDE_EFFECTS__
|
|
55
|
+
function Qe() {
|
|
56
|
+
const t = T(!1), r = se();
|
|
57
|
+
return r && Le(() => {
|
|
58
|
+
t.value = !0;
|
|
59
|
+
}, r), t;
|
|
60
|
+
}
|
|
61
|
+
// @__NO_SIDE_EFFECTS__
|
|
62
|
+
function Je(t) {
|
|
63
|
+
const r = /* @__PURE__ */ Qe();
|
|
64
|
+
return u(() => (r.value, !!t()));
|
|
65
|
+
}
|
|
66
|
+
const Xe = Symbol("vueuse-ssr-width");
|
|
67
|
+
// @__NO_SIDE_EFFECTS__
|
|
68
|
+
function Ye() {
|
|
69
|
+
const t = ue() ? /* @__PURE__ */ Pe(Xe, null) : null;
|
|
70
|
+
return typeof t == "number" ? t : void 0;
|
|
71
|
+
}
|
|
72
|
+
function re(t, r = {}) {
|
|
73
|
+
const { window: e = de, ssrWidth: l = /* @__PURE__ */ Ye() } = r, n = /* @__PURE__ */ Je(() => e && "matchMedia" in e && typeof e.matchMedia == "function"), c = T(typeof l == "number"), o = T(), b = T(!1), L = (k) => {
|
|
74
|
+
b.value = k.matches;
|
|
75
|
+
};
|
|
76
|
+
return Me(() => {
|
|
77
|
+
if (c.value) {
|
|
78
|
+
c.value = !n.value;
|
|
79
|
+
const k = M(t).split(",");
|
|
80
|
+
b.value = k.some((p) => {
|
|
81
|
+
const g = p.includes("not all"), i = p.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), w = p.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
|
|
82
|
+
let y = !!(i || w);
|
|
83
|
+
return i && y && (y = l >= ie(i[1])), w && y && (y = l <= ie(w[1])), g ? !y : y;
|
|
84
|
+
});
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
n.value && (o.value = e.matchMedia(M(t)), b.value = o.value.matches);
|
|
88
|
+
}), Ke(o, "change", L, { passive: !0 }), u(() => b.value);
|
|
89
|
+
}
|
|
90
|
+
const nt = /* @__PURE__ */ je({
|
|
91
|
+
name: "SaberAppLayout",
|
|
92
|
+
__name: "SaberAppLayout",
|
|
93
|
+
props: /* @__PURE__ */ le({
|
|
94
|
+
title: { default: void 0 },
|
|
95
|
+
description: { default: void 0 },
|
|
96
|
+
maxWidth: { type: [Number, String, Boolean], default: void 0 },
|
|
97
|
+
navigationKey: { default: void 0 },
|
|
98
|
+
sidebarWidth: { default: 240 },
|
|
99
|
+
phoneBreakpoint: { default: 768 },
|
|
100
|
+
padBreakpoint: { default: 1024 },
|
|
101
|
+
searchGroups: { default: () => [] },
|
|
102
|
+
searchShortcut: { default: "meta_k" },
|
|
103
|
+
searchLabel: { default: "搜索" },
|
|
104
|
+
menuOpenLabel: { default: "菜单" },
|
|
105
|
+
menuCloseLabel: { default: "关闭" },
|
|
106
|
+
menuOpenIcon: { default: "solar:hamburger-menu-linear" },
|
|
107
|
+
menuCloseIcon: { default: "solar:close-circle-linear" },
|
|
108
|
+
ui: { default: () => ({}) }
|
|
109
|
+
}, {
|
|
110
|
+
drawerOpen: { type: Boolean, default: !1 },
|
|
111
|
+
drawerOpenModifiers: {},
|
|
112
|
+
searchOpen: { type: Boolean, default: !1 },
|
|
113
|
+
searchOpenModifiers: {}
|
|
114
|
+
}),
|
|
115
|
+
emits: /* @__PURE__ */ le(["searchSelect"], ["update:drawerOpen", "update:searchOpen"]),
|
|
116
|
+
setup(t, { emit: r }) {
|
|
117
|
+
const e = t, l = r, n = Fe(), c = R({
|
|
118
|
+
slots: {
|
|
119
|
+
root: "flex h-dvh items-start gap-2 overflow-hidden p-1.5 text-default",
|
|
120
|
+
desktopSidebar: "sticky top-0 h-full shrink-0 self-start",
|
|
121
|
+
main: "relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-y-auto rounded-lg border border-default bg-default",
|
|
122
|
+
header: "sticky top-0 z-10 mx-auto flex w-full shrink-0 items-center justify-between gap-4 overflow-hidden bg-default/70 backdrop-blur-md",
|
|
123
|
+
headerHeading: "min-w-0",
|
|
124
|
+
title: "truncate text-xl",
|
|
125
|
+
description: "mt-1 text-sm text-muted",
|
|
126
|
+
headerSuffix: "flex shrink-0 items-center gap-2",
|
|
127
|
+
pageHeaderSuffixTarget: "contents",
|
|
128
|
+
content: "mx-auto w-full flex-1",
|
|
129
|
+
phoneDrawerContent: "h-full min-h-0 w-full min-w-0 p-2",
|
|
130
|
+
phoneSidebarFrame: "h-full min-h-0 w-full",
|
|
131
|
+
padDrawerContent: "h-full min-h-0 w-full min-w-0 p-2",
|
|
132
|
+
padSidebarFrame: "mx-auto h-full min-h-0",
|
|
133
|
+
overlay: "fixed inset-0 z-40 border-0 bg-black/35 p-0 backdrop-blur-[1px]",
|
|
134
|
+
dock: "fixed bottom-[calc(0.75rem+env(safe-area-inset-bottom))] left-1/2 z-60 flex w-42 -translate-x-1/2 items-center gap-1 rounded-2xl border border-default bg-default/95 p-1 shadow-lg backdrop-blur-md"
|
|
135
|
+
},
|
|
136
|
+
variants: {
|
|
137
|
+
mode: {
|
|
138
|
+
phone: {
|
|
139
|
+
root: "p-1.5",
|
|
140
|
+
header: "p-4",
|
|
141
|
+
title: "text-xl",
|
|
142
|
+
content: "px-3 pb-[calc(6rem+env(safe-area-inset-bottom))]"
|
|
143
|
+
},
|
|
144
|
+
pad: {
|
|
145
|
+
root: "p-1.5",
|
|
146
|
+
header: "p-4",
|
|
147
|
+
title: "text-2xl",
|
|
148
|
+
content: "px-4 pb-[calc(6rem+env(safe-area-inset-bottom))]"
|
|
149
|
+
},
|
|
150
|
+
desktop: {
|
|
151
|
+
root: "p-2",
|
|
152
|
+
header: "px-6 py-4.5 min-[1441px]:px-8 min-[1441px]:py-6",
|
|
153
|
+
title: "text-2xl",
|
|
154
|
+
content: "px-6 pb-0 min-[1441px]:px-8"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}), o = te(t, "drawerOpen"), b = te(t, "searchOpen"), L = re(`(max-width: ${e.phoneBreakpoint}px)`), k = re(`(max-width: ${e.padBreakpoint}px)`), p = u(() => L.value ? "phone" : k.value ? "pad" : "desktop"), g = u(() => p.value !== "desktop"), i = u(() => c({ mode: p.value })), w = ae(null), y = Ne(w), N = u(() => y.title ?? e.title), E = u(() => y.description ?? e.description), Q = u(() => {
|
|
159
|
+
if (typeof e.maxWidth == "number")
|
|
160
|
+
return Number.isFinite(e.maxWidth) && e.maxWidth > 0 ? `${e.maxWidth}px` : void 0;
|
|
161
|
+
if (!(e.maxWidth === "full" || e.maxWidth === !1 || e.maxWidth === void 0))
|
|
162
|
+
return e.maxWidth.trim() || void 0;
|
|
163
|
+
}), ce = u(
|
|
164
|
+
() => e.maxWidth === void 0 || typeof e.maxWidth == "number" && (!Number.isFinite(e.maxWidth) || e.maxWidth <= 0)
|
|
165
|
+
), J = u(
|
|
166
|
+
() => Q.value ? { maxWidth: Q.value } : void 0
|
|
167
|
+
), X = u(() => ce.value ? "min-[1921px]:max-w-[1620px]" : void 0), pe = u(() => typeof e.sidebarWidth == "number" ? Number.isFinite(e.sidebarWidth) && e.sidebarWidth > 0 ? `${e.sidebarWidth}px` : "240px" : e.sidebarWidth.trim() || "240px"), fe = u(() => ({ "--saber-app-layout-sidebar-width": pe.value })), me = { width: "var(--saber-app-layout-sidebar-width)" }, ve = { width: "var(--saber-app-layout-sidebar-width)" }, P = `saber-app-layout-navigation-${Ie().replaceAll(":", "")}`, Y = ae(null);
|
|
168
|
+
function F(a) {
|
|
169
|
+
return typeof a == "object" && a !== null && !Array.isArray(a);
|
|
170
|
+
}
|
|
171
|
+
function he(a) {
|
|
172
|
+
return F(a) && Object.values(a).every((s) => typeof s == "boolean");
|
|
173
|
+
}
|
|
174
|
+
function be(a) {
|
|
175
|
+
return typeof a == "function";
|
|
176
|
+
}
|
|
177
|
+
function ye(a, s) {
|
|
178
|
+
return s === void 0 ? a : be(s) ? (m) => s(R({ base: m })({ class: a })) : R({ base: a })({ class: s });
|
|
179
|
+
}
|
|
180
|
+
function U(a, s) {
|
|
181
|
+
const m = {}, O = /* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(s ?? {})]);
|
|
182
|
+
for (const v of O) {
|
|
183
|
+
const j = a[v], I = s == null ? void 0 : s[v], _ = F(I) && !he(I);
|
|
184
|
+
if (F(j) || j === void 0 && _)
|
|
185
|
+
m[v] = U(
|
|
186
|
+
F(j) ? j : {},
|
|
187
|
+
_ ? I : void 0
|
|
188
|
+
);
|
|
189
|
+
else {
|
|
190
|
+
const ee = ye(j, I);
|
|
191
|
+
ee !== void 0 && (m[v] = ee);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return m;
|
|
195
|
+
}
|
|
196
|
+
const xe = {
|
|
197
|
+
root: "mb-0 min-w-0 flex-1",
|
|
198
|
+
button: {
|
|
199
|
+
base: "h-10 w-20 rounded-full border-0 bg-transparent px-3 shadow-none",
|
|
200
|
+
trailing: "hidden",
|
|
201
|
+
label: "text-(--ui-text) text-sm",
|
|
202
|
+
leadingIcon: "text-(--ui-text)"
|
|
203
|
+
}
|
|
204
|
+
}, ge = {
|
|
205
|
+
base: "h-10 shrink-0 rounded-full px-3 font-normal"
|
|
206
|
+
}, we = u(
|
|
207
|
+
() => U(
|
|
208
|
+
{ content: "z-50 h-[calc(100dvh-4rem)] max-h-none rounded-t-lg bg-default" },
|
|
209
|
+
e.ui.phoneDrawer
|
|
210
|
+
)
|
|
211
|
+
), Se = u(
|
|
212
|
+
() => U(
|
|
213
|
+
{ content: "z-50 h-dvh max-w-none rounded-r-lg bg-default" },
|
|
214
|
+
e.ui.padDrawer
|
|
215
|
+
)
|
|
216
|
+
), ke = u(
|
|
217
|
+
() => U(xe, e.ui.search)
|
|
218
|
+
), We = u(
|
|
219
|
+
() => U(ge, e.ui.menuButton)
|
|
220
|
+
);
|
|
221
|
+
function Z() {
|
|
222
|
+
g.value && (o.value = !0);
|
|
223
|
+
}
|
|
224
|
+
function W() {
|
|
225
|
+
o.value = !1;
|
|
226
|
+
}
|
|
227
|
+
function q() {
|
|
228
|
+
o.value ? W() : Z();
|
|
229
|
+
}
|
|
230
|
+
function Ce(a) {
|
|
231
|
+
l("searchSelect", a), b.value = !1, W();
|
|
232
|
+
}
|
|
233
|
+
z(() => e.navigationKey, W), z(p, W), z(o, async (a, s) => {
|
|
234
|
+
var m, O;
|
|
235
|
+
a || !s || (await ze(), (O = (m = Y.value) == null ? void 0 : m.$el) == null || O.focus());
|
|
236
|
+
});
|
|
237
|
+
const C = u(() => ({
|
|
238
|
+
mode: p.value,
|
|
239
|
+
drawerOpen: o.value,
|
|
240
|
+
openDrawer: Z,
|
|
241
|
+
closeDrawer: W,
|
|
242
|
+
toggleDrawer: q
|
|
243
|
+
}));
|
|
244
|
+
return (a, s) => {
|
|
245
|
+
const m = $e, O = Oe;
|
|
246
|
+
return x(), S("div", {
|
|
247
|
+
"data-testid": "app-layout",
|
|
248
|
+
class: d(i.value.root({ class: e.ui.root })),
|
|
249
|
+
style: A(fe.value)
|
|
250
|
+
}, [
|
|
251
|
+
p.value === "desktop" ? (x(), S("aside", {
|
|
252
|
+
key: 0,
|
|
253
|
+
"data-testid": "desktop-sidebar",
|
|
254
|
+
class: d(i.value.desktopSidebar({ class: e.ui.desktopSidebar })),
|
|
255
|
+
style: me
|
|
256
|
+
}, [
|
|
257
|
+
h(a.$slots, "sidebar", $(B(C.value)))
|
|
258
|
+
], 2)) : p.value === "phone" ? (x(), S(H, { key: 1 }, [
|
|
259
|
+
o.value ? (x(), S("button", {
|
|
260
|
+
key: 0,
|
|
261
|
+
"data-testid": "compact-nav-overlay",
|
|
262
|
+
type: "button",
|
|
263
|
+
tabindex: "-1",
|
|
264
|
+
"aria-label": "关闭导航",
|
|
265
|
+
class: d(i.value.overlay({ class: e.ui.overlay })),
|
|
266
|
+
onClick: W
|
|
267
|
+
}, null, 2)) : D("", !0),
|
|
268
|
+
G(m, {
|
|
269
|
+
open: o.value,
|
|
270
|
+
"onUpdate:open": s[0] || (s[0] = (v) => o.value = v),
|
|
271
|
+
direction: "bottom",
|
|
272
|
+
modal: !1,
|
|
273
|
+
overlay: !1,
|
|
274
|
+
handle: !0,
|
|
275
|
+
title: t.menuOpenLabel,
|
|
276
|
+
ui: we.value
|
|
277
|
+
}, {
|
|
278
|
+
content: ne(() => [
|
|
279
|
+
f("div", {
|
|
280
|
+
id: P,
|
|
281
|
+
"data-testid": "phone-drawer-content",
|
|
282
|
+
class: d(i.value.phoneDrawerContent({ class: e.ui.phoneDrawerContent }))
|
|
283
|
+
}, [
|
|
284
|
+
f("div", {
|
|
285
|
+
"data-testid": "phone-sidebar-frame",
|
|
286
|
+
class: d(i.value.phoneSidebarFrame({ class: e.ui.phoneSidebarFrame }))
|
|
287
|
+
}, [
|
|
288
|
+
n["phone-sidebar"] ? h(a.$slots, "phone-sidebar", $(B(C.value)), void 0, void 0, 0) : h(a.$slots, "sidebar", $(B(C.value)), void 0, void 0, 1)
|
|
289
|
+
], 2)
|
|
290
|
+
], 2)
|
|
291
|
+
]),
|
|
292
|
+
_: 3
|
|
293
|
+
}, 8, ["open", "title", "ui"])
|
|
294
|
+
], 64)) : (x(), S(H, { key: 2 }, [
|
|
295
|
+
o.value ? (x(), S("button", {
|
|
296
|
+
key: 0,
|
|
297
|
+
"data-testid": "compact-nav-overlay",
|
|
298
|
+
type: "button",
|
|
299
|
+
tabindex: "-1",
|
|
300
|
+
"aria-label": "关闭导航",
|
|
301
|
+
class: d(i.value.overlay({ class: e.ui.overlay })),
|
|
302
|
+
onClick: W
|
|
303
|
+
}, null, 2)) : D("", !0),
|
|
304
|
+
G(m, {
|
|
305
|
+
open: o.value,
|
|
306
|
+
"onUpdate:open": s[1] || (s[1] = (v) => o.value = v),
|
|
307
|
+
direction: "left",
|
|
308
|
+
modal: !1,
|
|
309
|
+
overlay: !1,
|
|
310
|
+
handle: !1,
|
|
311
|
+
title: t.menuOpenLabel,
|
|
312
|
+
ui: Se.value
|
|
313
|
+
}, {
|
|
314
|
+
content: ne(() => [
|
|
315
|
+
f("div", {
|
|
316
|
+
id: P,
|
|
317
|
+
"data-testid": "pad-drawer-content",
|
|
318
|
+
class: d(i.value.padDrawerContent({ class: e.ui.padDrawerContent }))
|
|
319
|
+
}, [
|
|
320
|
+
f("div", {
|
|
321
|
+
"data-testid": "pad-sidebar-frame",
|
|
322
|
+
class: d(i.value.padSidebarFrame({ class: e.ui.padSidebarFrame })),
|
|
323
|
+
style: ve
|
|
324
|
+
}, [
|
|
325
|
+
n["pad-sidebar"] ? h(a.$slots, "pad-sidebar", $(B(C.value)), void 0, void 0, 0) : h(a.$slots, "sidebar", $(B(C.value)), void 0, void 0, 1)
|
|
326
|
+
], 2)
|
|
327
|
+
], 2)
|
|
328
|
+
]),
|
|
329
|
+
_: 3
|
|
330
|
+
}, 8, ["open", "title", "ui"])
|
|
331
|
+
], 64)),
|
|
332
|
+
f("main", {
|
|
333
|
+
"data-testid": "app-layout-main",
|
|
334
|
+
class: d(i.value.main({ class: e.ui.main }))
|
|
335
|
+
}, [
|
|
336
|
+
f("header", {
|
|
337
|
+
"data-testid": "app-layout-header",
|
|
338
|
+
class: d([i.value.header({ class: e.ui.header }), X.value]),
|
|
339
|
+
style: A(J.value)
|
|
340
|
+
}, [
|
|
341
|
+
f("div", {
|
|
342
|
+
"data-testid": "app-layout-header-heading",
|
|
343
|
+
class: d(i.value.headerHeading({ class: e.ui.headerHeading }))
|
|
344
|
+
}, [
|
|
345
|
+
N.value ? h(a.$slots, "header-title", { title: N.value }, () => [
|
|
346
|
+
f("h1", {
|
|
347
|
+
"data-testid": "app-layout-title",
|
|
348
|
+
class: d(i.value.title({ class: e.ui.title }))
|
|
349
|
+
}, oe(N.value), 3)
|
|
350
|
+
], void 0, 0) : D("", !0),
|
|
351
|
+
E.value ? h(a.$slots, "header-description", { description: E.value }, () => [
|
|
352
|
+
f("p", {
|
|
353
|
+
"data-testid": "app-layout-description",
|
|
354
|
+
class: d(i.value.description({ class: e.ui.description }))
|
|
355
|
+
}, oe(E.value), 3)
|
|
356
|
+
], void 0, 1) : D("", !0)
|
|
357
|
+
], 2),
|
|
358
|
+
f("div", {
|
|
359
|
+
"data-testid": "app-layout-header-suffix",
|
|
360
|
+
class: d(i.value.headerSuffix({ class: e.ui.headerSuffix }))
|
|
361
|
+
}, [
|
|
362
|
+
h(a.$slots, "header-suffix"),
|
|
363
|
+
f("div", {
|
|
364
|
+
ref_key: "suffixTarget",
|
|
365
|
+
ref: w,
|
|
366
|
+
"data-testid": "app-layout-suffix-target",
|
|
367
|
+
class: d(i.value.pageHeaderSuffixTarget({ class: e.ui.pageHeaderSuffixTarget }))
|
|
368
|
+
}, null, 2)
|
|
369
|
+
], 2)
|
|
370
|
+
], 6),
|
|
371
|
+
f("div", {
|
|
372
|
+
"data-testid": "app-layout-content",
|
|
373
|
+
class: d([i.value.content({ class: e.ui.content }), X.value]),
|
|
374
|
+
style: A(J.value)
|
|
375
|
+
}, [
|
|
376
|
+
h(a.$slots, "default")
|
|
377
|
+
], 6)
|
|
378
|
+
], 2),
|
|
379
|
+
g.value ? (x(), S("div", {
|
|
380
|
+
key: 3,
|
|
381
|
+
"data-testid": "compact-nav-dock",
|
|
382
|
+
class: d(i.value.dock({ class: e.ui.dock }))
|
|
383
|
+
}, [
|
|
384
|
+
n.dock ? h(a.$slots, "dock", $(B(C.value)), void 0, void 0, 0) : (x(), S(H, { key: 1 }, [
|
|
385
|
+
t.searchGroups.length ? (x(), Te(Ee, {
|
|
386
|
+
key: 0,
|
|
387
|
+
open: b.value,
|
|
388
|
+
"onUpdate:open": s[2] || (s[2] = (v) => b.value = v),
|
|
389
|
+
groups: t.searchGroups,
|
|
390
|
+
label: t.searchLabel,
|
|
391
|
+
shortcut: t.searchShortcut,
|
|
392
|
+
kbds: [],
|
|
393
|
+
ui: ke.value,
|
|
394
|
+
onSelect: Ce
|
|
395
|
+
}, null, 8, ["open", "groups", "label", "shortcut", "ui"])) : D("", !0),
|
|
396
|
+
G(O, {
|
|
397
|
+
ref_key: "menuButton",
|
|
398
|
+
ref: Y,
|
|
399
|
+
"data-testid": "compact-menu-button",
|
|
400
|
+
color: "neutral",
|
|
401
|
+
variant: "ghost",
|
|
402
|
+
icon: o.value ? t.menuCloseIcon : t.menuOpenIcon,
|
|
403
|
+
label: o.value ? t.menuCloseLabel : t.menuOpenLabel,
|
|
404
|
+
"aria-controls": P,
|
|
405
|
+
"aria-expanded": o.value,
|
|
406
|
+
"aria-haspopup": "dialog",
|
|
407
|
+
ui: We.value,
|
|
408
|
+
onClick: q
|
|
409
|
+
}, null, 8, ["icon", "label", "aria-expanded", "ui"])
|
|
410
|
+
], 64))
|
|
411
|
+
], 2)) : D("", !0)
|
|
412
|
+
], 6);
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
export {
|
|
417
|
+
nt as _
|
|
418
|
+
};
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import oe from "@nuxt/ui/components/Button.vue";
|
|
2
|
+
import ne from "@nuxt/ui/runtime/vue/components/Icon.vue";
|
|
3
|
+
import { defineComponent as ie, useModel as ce, ref as re, computed as X, openBlock as c, createElementBlock as x, normalizeClass as s, unref as l, createElementVNode as h, renderSlot as T, createBlock as w, withCtx as $, normalizeProps as ue, guardReactiveProps as de, createCommentVNode as _, createVNode as G, Transition as me, toDisplayString as K, Fragment as H, renderList as N, mergeModels as Y } from "vue";
|
|
4
|
+
import { tv as ve } from "tailwind-variants";
|
|
5
|
+
import { _ as fe } from "./SaberNavigationSearch.vue_vue_type_script_setup_true_lang-Bj96kMla.js";
|
|
6
|
+
const xe = /* @__PURE__ */ ie({
|
|
7
|
+
name: "SaberAppSidebar",
|
|
8
|
+
__name: "SaberAppSidebar",
|
|
9
|
+
props: /* @__PURE__ */ Y({
|
|
10
|
+
sections: {},
|
|
11
|
+
searchGroups: { default: () => [] },
|
|
12
|
+
activeKey: {},
|
|
13
|
+
shortcut: { default: "meta_k" },
|
|
14
|
+
ui: {}
|
|
15
|
+
}, {
|
|
16
|
+
activeSection: { default: void 0 },
|
|
17
|
+
activeSectionModifiers: {}
|
|
18
|
+
}),
|
|
19
|
+
emits: /* @__PURE__ */ Y(["select", "section-select"], ["update:activeSection"]),
|
|
20
|
+
setup(V, { emit: Z }) {
|
|
21
|
+
const e = V, A = Z, E = ce(V, "activeSection"), F = re(!1), B = X(() => e.sections.find((t) => t.key === E.value)), a = ve({
|
|
22
|
+
slots: {
|
|
23
|
+
root: "flex h-full min-h-0 flex-col overflow-hidden",
|
|
24
|
+
header: "shrink-0",
|
|
25
|
+
logo: "flex h-11 items-center mb-2",
|
|
26
|
+
viewport: "min-h-0 flex-1 overflow-y-auto",
|
|
27
|
+
panel: "flex min-h-full flex-col gap-1.5",
|
|
28
|
+
sectionList: "flex flex-col",
|
|
29
|
+
rootFooter: "shrink-0",
|
|
30
|
+
group: "flex flex-col",
|
|
31
|
+
groupLabel: "px-2 py-2 text-[11px] uppercase tracking-wider text-muted/70",
|
|
32
|
+
childList: "flex flex-col",
|
|
33
|
+
nestedHeader: "flex items-center",
|
|
34
|
+
footer: "shrink-0",
|
|
35
|
+
sectionItem: "flex w-full items-center rounded-md px-2 py-2 text-sm font-normal mb-0.5 gap-2 text-left transition",
|
|
36
|
+
sectionItemLeadingIcon: "size-4.5 shrink-0",
|
|
37
|
+
sectionItemLabel: "min-w-0 flex-1 truncate text-left",
|
|
38
|
+
sectionItemTrailingIcon: "size-4 shrink-0",
|
|
39
|
+
childItem: "flex w-full items-center rounded-md px-2 py-2 font-normal text-sm mb-0.5 gap-2 text-left transition",
|
|
40
|
+
childItemLeadingIcon: "size-4 shrink-0",
|
|
41
|
+
childItemLabel: "min-w-0 flex-1 truncate text-left",
|
|
42
|
+
backButton: "flex w-full items-center rounded-md h-9 px-2 gap-2 text-left transition ",
|
|
43
|
+
backButtonIcon: "size-4 shrink-0",
|
|
44
|
+
backButtonLabel: "truncate text-sm font-normal flex-1 text-center"
|
|
45
|
+
}
|
|
46
|
+
})(), z = X(() => {
|
|
47
|
+
var t, o, i, r, u, d, m, v, f, p, b, S;
|
|
48
|
+
return {
|
|
49
|
+
enterActive: ((o = (t = e.ui) == null ? void 0 : t.transition) == null ? void 0 : o.enterActive) ?? "transition duration-100 ease-out",
|
|
50
|
+
leaveActive: ((r = (i = e.ui) == null ? void 0 : i.transition) == null ? void 0 : r.leaveActive) ?? "transition duration-100 ease-out pointer-events-none",
|
|
51
|
+
enterFrom: F.value ? ((d = (u = e.ui) == null ? void 0 : u.transition) == null ? void 0 : d.backwardEnterFrom) ?? "-translate-x-2 opacity-0 blur-[2px]" : ((v = (m = e.ui) == null ? void 0 : m.transition) == null ? void 0 : v.forwardEnterFrom) ?? "translate-x-2 opacity-0 blur-[2px]",
|
|
52
|
+
leaveTo: F.value ? ((p = (f = e.ui) == null ? void 0 : f.transition) == null ? void 0 : p.backwardLeaveTo) ?? "translate-x-2 opacity-0 blur-[2px]" : ((S = (b = e.ui) == null ? void 0 : b.transition) == null ? void 0 : S.forwardLeaveTo) ?? "-translate-x-2 opacity-0 blur-[2px]"
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
function M(t) {
|
|
56
|
+
return t.groups.flatMap((o) => o.items);
|
|
57
|
+
}
|
|
58
|
+
function P(t) {
|
|
59
|
+
return M(t).some((o) => o.key === e.activeKey);
|
|
60
|
+
}
|
|
61
|
+
function ee(t) {
|
|
62
|
+
var i, r, u, d, m, v, f, p;
|
|
63
|
+
const o = P(t) ? ["font-medium", (r = (i = e.ui) == null ? void 0 : i.sectionItem) == null ? void 0 : r.active] : ["text-default", (d = (u = e.ui) == null ? void 0 : u.sectionItem) == null ? void 0 : d.inactive];
|
|
64
|
+
return a.sectionItem({ class: [(v = (m = e.ui) == null ? void 0 : m.sectionItem) == null ? void 0 : v.base, o, (p = (f = e.ui) == null ? void 0 : f.sectionItem) == null ? void 0 : p.hover] });
|
|
65
|
+
}
|
|
66
|
+
function te(t) {
|
|
67
|
+
var i, r, u, d, m, v, f, p;
|
|
68
|
+
const o = t.key === e.activeKey ? ["font-medium", (r = (i = e.ui) == null ? void 0 : i.childItem) == null ? void 0 : r.active] : ["text-default", (d = (u = e.ui) == null ? void 0 : u.childItem) == null ? void 0 : d.inactive];
|
|
69
|
+
return a.childItem({ class: [(v = (m = e.ui) == null ? void 0 : m.childItem) == null ? void 0 : v.base, o, (p = (f = e.ui) == null ? void 0 : f.childItem) == null ? void 0 : p.hover] });
|
|
70
|
+
}
|
|
71
|
+
function ae(t) {
|
|
72
|
+
var i;
|
|
73
|
+
const o = M(t);
|
|
74
|
+
if (o.length === 1) {
|
|
75
|
+
A("select", {
|
|
76
|
+
source: "direct",
|
|
77
|
+
item: o[0],
|
|
78
|
+
sectionKey: t.key,
|
|
79
|
+
groupKey: (i = t.groups[0]) == null ? void 0 : i.key
|
|
80
|
+
});
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
F.value = !1, E.value = t.key, A("section-select", t);
|
|
84
|
+
}
|
|
85
|
+
function se() {
|
|
86
|
+
F.value = !0, E.value = void 0;
|
|
87
|
+
}
|
|
88
|
+
function le(t, o, i) {
|
|
89
|
+
A("select", { source: "item", item: t, sectionKey: o, groupKey: i });
|
|
90
|
+
}
|
|
91
|
+
return (t, o) => {
|
|
92
|
+
var u, d, m, v, f, p;
|
|
93
|
+
const i = ne, r = oe;
|
|
94
|
+
return c(), x("aside", {
|
|
95
|
+
class: s(l(a).root({ class: (u = e.ui) == null ? void 0 : u.root }))
|
|
96
|
+
}, [
|
|
97
|
+
h("header", {
|
|
98
|
+
class: s(l(a).header({ class: (d = e.ui) == null ? void 0 : d.header }))
|
|
99
|
+
}, [
|
|
100
|
+
h("div", {
|
|
101
|
+
class: s(l(a).logo({ class: (m = e.ui) == null ? void 0 : m.logo }))
|
|
102
|
+
}, [
|
|
103
|
+
T(t.$slots, "logo")
|
|
104
|
+
], 2),
|
|
105
|
+
e.searchGroups.length ? (c(), w(fe, {
|
|
106
|
+
key: 0,
|
|
107
|
+
groups: e.searchGroups,
|
|
108
|
+
shortcut: e.shortcut,
|
|
109
|
+
ui: (v = e.ui) == null ? void 0 : v.search,
|
|
110
|
+
onSelect: o[0] || (o[0] = (b) => A("select", b))
|
|
111
|
+
}, {
|
|
112
|
+
empty: $((b) => [
|
|
113
|
+
T(t.$slots, "search-empty", ue(de(b)))
|
|
114
|
+
]),
|
|
115
|
+
_: 3
|
|
116
|
+
}, 8, ["groups", "shortcut", "ui"])) : _("", !0)
|
|
117
|
+
], 2),
|
|
118
|
+
h("nav", {
|
|
119
|
+
class: s(l(a).viewport({ class: (f = e.ui) == null ? void 0 : f.viewport }))
|
|
120
|
+
}, [
|
|
121
|
+
G(me, {
|
|
122
|
+
mode: "out-in",
|
|
123
|
+
"enter-active-class": z.value.enterActive,
|
|
124
|
+
"leave-active-class": z.value.leaveActive,
|
|
125
|
+
"enter-from-class": z.value.enterFrom,
|
|
126
|
+
"leave-to-class": z.value.leaveTo
|
|
127
|
+
}, {
|
|
128
|
+
default: $(() => {
|
|
129
|
+
var b, S, U, D, R, j, q, J, O;
|
|
130
|
+
return [
|
|
131
|
+
B.value ? (c(), x("div", {
|
|
132
|
+
key: B.value.key,
|
|
133
|
+
class: s(l(a).panel({ class: (b = e.ui) == null ? void 0 : b.panel }))
|
|
134
|
+
}, [
|
|
135
|
+
h("div", {
|
|
136
|
+
class: s(l(a).nestedHeader({ class: (S = e.ui) == null ? void 0 : S.nestedHeader }))
|
|
137
|
+
}, [
|
|
138
|
+
G(r, {
|
|
139
|
+
"data-testid": "back-button",
|
|
140
|
+
color: "neutral",
|
|
141
|
+
variant: "ghost",
|
|
142
|
+
class: s(l(a).backButton({ class: [(D = (U = e.ui) == null ? void 0 : U.backButton) == null ? void 0 : D.base, (j = (R = e.ui) == null ? void 0 : R.backButton) == null ? void 0 : j.hover] })),
|
|
143
|
+
onClick: se
|
|
144
|
+
}, {
|
|
145
|
+
default: $(() => {
|
|
146
|
+
var n, y, I, g;
|
|
147
|
+
return [
|
|
148
|
+
G(i, {
|
|
149
|
+
name: "solar:alt-arrow-left-linear",
|
|
150
|
+
class: s(l(a).backButtonIcon({ class: (y = (n = e.ui) == null ? void 0 : n.backButton) == null ? void 0 : y.icon }))
|
|
151
|
+
}, null, 8, ["class"]),
|
|
152
|
+
h("span", {
|
|
153
|
+
class: s(l(a).backButtonLabel({ class: (g = (I = e.ui) == null ? void 0 : I.backButton) == null ? void 0 : g.label }))
|
|
154
|
+
}, K(B.value.label), 3),
|
|
155
|
+
o[1] || (o[1] = h("span", { class: "size-4.5 shrink-0" }, null, -1))
|
|
156
|
+
];
|
|
157
|
+
}),
|
|
158
|
+
_: 1
|
|
159
|
+
}, 8, ["class"])
|
|
160
|
+
], 2),
|
|
161
|
+
(c(!0), x(H, null, N(B.value.groups, (n) => {
|
|
162
|
+
var y, I, g;
|
|
163
|
+
return c(), x("div", {
|
|
164
|
+
key: n.key,
|
|
165
|
+
class: s(l(a).group({ class: (y = e.ui) == null ? void 0 : y.group }))
|
|
166
|
+
}, [
|
|
167
|
+
n.label ? (c(), x("p", {
|
|
168
|
+
key: 0,
|
|
169
|
+
class: s(l(a).groupLabel({ class: (I = e.ui) == null ? void 0 : I.groupLabel }))
|
|
170
|
+
}, K(n.label), 3)) : _("", !0),
|
|
171
|
+
h("div", {
|
|
172
|
+
class: s(l(a).childList({ class: (g = e.ui) == null ? void 0 : g.childList }))
|
|
173
|
+
}, [
|
|
174
|
+
(c(!0), x(H, null, N(n.items, (k) => (c(), w(r, {
|
|
175
|
+
key: k.key,
|
|
176
|
+
"data-testid": `item-${k.key}`,
|
|
177
|
+
"data-active": k.key === e.activeKey,
|
|
178
|
+
color: "neutral",
|
|
179
|
+
variant: "ghost",
|
|
180
|
+
class: s(te(k)),
|
|
181
|
+
onClick: (L) => le(k, B.value.key, n.key)
|
|
182
|
+
}, {
|
|
183
|
+
default: $(() => {
|
|
184
|
+
var L, C, Q, W;
|
|
185
|
+
return [
|
|
186
|
+
k.icon ? (c(), w(i, {
|
|
187
|
+
key: 0,
|
|
188
|
+
name: k.icon,
|
|
189
|
+
class: s(l(a).childItemLeadingIcon({ class: (C = (L = e.ui) == null ? void 0 : L.childItem) == null ? void 0 : C.leadingIcon }))
|
|
190
|
+
}, null, 8, ["name", "class"])) : _("", !0),
|
|
191
|
+
h("span", {
|
|
192
|
+
class: s(l(a).childItemLabel({ class: (W = (Q = e.ui) == null ? void 0 : Q.childItem) == null ? void 0 : W.label }))
|
|
193
|
+
}, K(k.label), 3)
|
|
194
|
+
];
|
|
195
|
+
}),
|
|
196
|
+
_: 2
|
|
197
|
+
}, 1032, ["data-testid", "data-active", "class", "onClick"]))), 128))
|
|
198
|
+
], 2)
|
|
199
|
+
], 2);
|
|
200
|
+
}), 128))
|
|
201
|
+
], 2)) : (c(), x("div", {
|
|
202
|
+
key: "root",
|
|
203
|
+
class: s(l(a).panel({ class: (q = e.ui) == null ? void 0 : q.panel }))
|
|
204
|
+
}, [
|
|
205
|
+
h("div", {
|
|
206
|
+
class: s(l(a).sectionList({ class: (J = e.ui) == null ? void 0 : J.sectionList }))
|
|
207
|
+
}, [
|
|
208
|
+
(c(!0), x(H, null, N(e.sections, (n) => (c(), w(r, {
|
|
209
|
+
key: n.key,
|
|
210
|
+
"data-testid": `section-${n.key}`,
|
|
211
|
+
"data-section": n.key,
|
|
212
|
+
"data-active": P(n),
|
|
213
|
+
color: "neutral",
|
|
214
|
+
variant: "ghost",
|
|
215
|
+
class: s(ee(n)),
|
|
216
|
+
onClick: (y) => ae(n)
|
|
217
|
+
}, {
|
|
218
|
+
default: $(() => {
|
|
219
|
+
var y, I, g, k, L, C;
|
|
220
|
+
return [
|
|
221
|
+
n.icon ? (c(), w(i, {
|
|
222
|
+
key: 0,
|
|
223
|
+
name: n.icon,
|
|
224
|
+
class: s(l(a).sectionItemLeadingIcon({ class: (I = (y = e.ui) == null ? void 0 : y.sectionItem) == null ? void 0 : I.leadingIcon }))
|
|
225
|
+
}, null, 8, ["name", "class"])) : _("", !0),
|
|
226
|
+
h("span", {
|
|
227
|
+
class: s(l(a).sectionItemLabel({ class: (k = (g = e.ui) == null ? void 0 : g.sectionItem) == null ? void 0 : k.label }))
|
|
228
|
+
}, K(n.label), 3),
|
|
229
|
+
M(n).length > 1 ? (c(), w(i, {
|
|
230
|
+
key: 1,
|
|
231
|
+
name: "solar:alt-arrow-right-linear",
|
|
232
|
+
class: s(l(a).sectionItemTrailingIcon({ class: (C = (L = e.ui) == null ? void 0 : L.sectionItem) == null ? void 0 : C.trailingIcon }))
|
|
233
|
+
}, null, 8, ["class"])) : _("", !0)
|
|
234
|
+
];
|
|
235
|
+
}),
|
|
236
|
+
_: 2
|
|
237
|
+
}, 1032, ["data-testid", "data-section", "data-active", "class", "onClick"]))), 128))
|
|
238
|
+
], 2),
|
|
239
|
+
t.$slots["root-footer"] ? (c(), x("div", {
|
|
240
|
+
key: 0,
|
|
241
|
+
"data-testid": "root-footer",
|
|
242
|
+
class: s(l(a).rootFooter({ class: (O = e.ui) == null ? void 0 : O.rootFooter }))
|
|
243
|
+
}, [
|
|
244
|
+
T(t.$slots, "root-footer")
|
|
245
|
+
], 2)) : _("", !0)
|
|
246
|
+
], 2))
|
|
247
|
+
];
|
|
248
|
+
}),
|
|
249
|
+
_: 3
|
|
250
|
+
}, 8, ["enter-active-class", "leave-active-class", "enter-from-class", "leave-to-class"])
|
|
251
|
+
], 2),
|
|
252
|
+
h("footer", {
|
|
253
|
+
class: s(l(a).footer({ class: (p = e.ui) == null ? void 0 : p.footer }))
|
|
254
|
+
}, [
|
|
255
|
+
T(t.$slots, "footer")
|
|
256
|
+
], 2)
|
|
257
|
+
], 2);
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
export {
|
|
262
|
+
xe as _
|
|
263
|
+
};
|