@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.
@@ -1,254 +0,0 @@
1
- import le from "@nuxt/ui/components/Button.vue";
2
- import ne from "@nuxt/ui/runtime/vue/components/Icon.vue";
3
- import { defineComponent as ie, useModel as oe, ref as ce, computed as W, openBlock as c, createElementBlock as g, normalizeClass as s, unref as l, createElementVNode as h, renderSlot as M, createBlock as _, withCtx as C, normalizeProps as re, guardReactiveProps as ue, createCommentVNode as A, createVNode as G, Transition as de, toDisplayString as K, Fragment as H, renderList as N, mergeModels as X } from "vue";
4
- import { tv as me } from "tailwind-variants";
5
- import { _ as pe } 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__ */ X({
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__ */ X(["select", "section-select"], ["update:activeSection"]),
20
- setup(V, { emit: Y }) {
21
- const e = V, $ = Y, F = oe(V, "activeSection"), T = ce(!1), w = W(() => e.sections.find((t) => t.key === F.value)), a = me({
22
- slots: {
23
- root: "flex h-full min-h-0 flex-col overflow-hidden",
24
- header: "shrink-0 pl-0 pr-3 pl-1",
25
- logo: "flex h-11 items-center mb-1.5",
26
- viewport: "min-h-0 flex-1 overflow-y-auto pr-3 pl-1",
27
- panel: "flex min-h-full flex-col gap-1",
28
- sectionList: "flex flex-col",
29
- group: "flex flex-col",
30
- groupLabel: "px-2 py-2 text-[11px] uppercase tracking-wider text-muted/70",
31
- childList: "flex flex-col",
32
- nestedHeader: "flex items-center",
33
- footer: "shrink-0 pr-4 pb-1",
34
- sectionItem: "flex w-full items-center rounded-md px-2 py-2 text-sm font-normal mb-0.5 gap-2 text-left transition",
35
- sectionItemLeadingIcon: "size-4.5 shrink-0",
36
- sectionItemLabel: "min-w-0 flex-1 truncate text-left",
37
- sectionItemTrailingIcon: "size-4 shrink-0",
38
- childItem: "flex w-full items-center rounded-md px-2 py-1.5 font-normal text-sm mb-0.5 gap-2 text-left transition",
39
- childItemLeadingIcon: "size-4 shrink-0",
40
- childItemLabel: "min-w-0 flex-1 truncate text-left",
41
- backButton: "flex w-full items-center rounded-md px-2 py-2 gap-2 text-left transition",
42
- backButtonIcon: "size-4.5 shrink-0",
43
- backButtonLabel: "truncate text-sm font-medium flex-1 text-center pr-10"
44
- }
45
- })(), z = W(() => {
46
- var t, i, o, r, u, d, m, p, v, f, b, B;
47
- return {
48
- enterActive: ((i = (t = e.ui) == null ? void 0 : t.transition) == null ? void 0 : i.enterActive) ?? "transition duration-200 ease-out",
49
- leaveActive: ((r = (o = e.ui) == null ? void 0 : o.transition) == null ? void 0 : r.leaveActive) ?? "transition duration-200 ease-out pointer-events-none",
50
- enterFrom: T.value ? ((d = (u = e.ui) == null ? void 0 : u.transition) == null ? void 0 : d.backwardEnterFrom) ?? "-translate-x-2 opacity-0 blur-[2px]" : ((p = (m = e.ui) == null ? void 0 : m.transition) == null ? void 0 : p.forwardEnterFrom) ?? "translate-x-2 opacity-0 blur-[2px]",
51
- leaveTo: T.value ? ((f = (v = e.ui) == null ? void 0 : v.transition) == null ? void 0 : f.backwardLeaveTo) ?? "translate-x-2 opacity-0 blur-[2px]" : ((B = (b = e.ui) == null ? void 0 : b.transition) == null ? void 0 : B.forwardLeaveTo) ?? "-translate-x-2 opacity-0 blur-[2px]"
52
- };
53
- });
54
- function E(t) {
55
- return t.groups.flatMap((i) => i.items);
56
- }
57
- function P(t) {
58
- return E(t).some((i) => i.key === e.activeKey);
59
- }
60
- function Z(t) {
61
- var o, r, u, d, m, p, v, f;
62
- const i = P(t) ? ["font-medium", (r = (o = e.ui) == null ? void 0 : o.sectionItem) == null ? void 0 : r.active] : ["text-default", (d = (u = e.ui) == null ? void 0 : u.sectionItem) == null ? void 0 : d.inactive];
63
- return a.sectionItem({ class: [(p = (m = e.ui) == null ? void 0 : m.sectionItem) == null ? void 0 : p.base, i, (f = (v = e.ui) == null ? void 0 : v.sectionItem) == null ? void 0 : f.hover] });
64
- }
65
- function ee(t) {
66
- var o, r, u, d, m, p, v, f;
67
- const i = t.key === e.activeKey ? ["font-medium", (r = (o = e.ui) == null ? void 0 : o.childItem) == null ? void 0 : r.active] : ["text-default", (d = (u = e.ui) == null ? void 0 : u.childItem) == null ? void 0 : d.inactive];
68
- return a.childItem({ class: [(p = (m = e.ui) == null ? void 0 : m.childItem) == null ? void 0 : p.base, i, (f = (v = e.ui) == null ? void 0 : v.childItem) == null ? void 0 : f.hover] });
69
- }
70
- function te(t) {
71
- var o;
72
- const i = E(t);
73
- if (i.length === 1) {
74
- $("select", {
75
- source: "direct",
76
- item: i[0],
77
- sectionKey: t.key,
78
- groupKey: (o = t.groups[0]) == null ? void 0 : o.key
79
- });
80
- return;
81
- }
82
- T.value = !1, F.value = t.key, $("section-select", t);
83
- }
84
- function ae() {
85
- T.value = !0, F.value = void 0;
86
- }
87
- function se(t, i, o) {
88
- $("select", { source: "item", item: t, sectionKey: i, groupKey: o });
89
- }
90
- return (t, i) => {
91
- var u, d, m, p, v, f;
92
- const o = ne, r = le;
93
- return c(), g("aside", {
94
- class: s(l(a).root({ class: (u = e.ui) == null ? void 0 : u.root }))
95
- }, [
96
- h("header", {
97
- class: s(l(a).header({ class: (d = e.ui) == null ? void 0 : d.header }))
98
- }, [
99
- h("div", {
100
- class: s(l(a).logo({ class: (m = e.ui) == null ? void 0 : m.logo }))
101
- }, [
102
- M(t.$slots, "logo")
103
- ], 2),
104
- e.searchGroups.length ? (c(), _(pe, {
105
- key: 0,
106
- groups: e.searchGroups,
107
- shortcut: e.shortcut,
108
- ui: (p = e.ui) == null ? void 0 : p.search,
109
- onSelect: i[0] || (i[0] = (b) => $("select", b))
110
- }, {
111
- empty: C((b) => [
112
- M(t.$slots, "search-empty", re(ue(b)))
113
- ]),
114
- _: 3
115
- }, 8, ["groups", "shortcut", "ui"])) : A("", !0)
116
- ], 2),
117
- h("nav", {
118
- class: s(l(a).viewport({ class: (v = e.ui) == null ? void 0 : v.viewport }))
119
- }, [
120
- G(de, {
121
- mode: "out-in",
122
- "enter-active-class": z.value.enterActive,
123
- "leave-active-class": z.value.leaveActive,
124
- "enter-from-class": z.value.enterFrom,
125
- "leave-to-class": z.value.leaveTo
126
- }, {
127
- default: C(() => {
128
- var b, B, U, D, R, j, q, J;
129
- return [
130
- w.value ? (c(), g("div", {
131
- key: w.value.key,
132
- class: s(l(a).panel({ class: (b = e.ui) == null ? void 0 : b.panel }))
133
- }, [
134
- h("div", {
135
- class: s(l(a).nestedHeader({ class: (B = e.ui) == null ? void 0 : B.nestedHeader }))
136
- }, [
137
- G(r, {
138
- "data-testid": "back-button",
139
- color: "neutral",
140
- variant: "ghost",
141
- 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] })),
142
- onClick: ae
143
- }, {
144
- default: C(() => {
145
- var n, x, y, I;
146
- return [
147
- G(o, {
148
- name: "solar:alt-arrow-left-linear",
149
- class: s(l(a).backButtonIcon({ class: (x = (n = e.ui) == null ? void 0 : n.backButton) == null ? void 0 : x.icon }))
150
- }, null, 8, ["class"]),
151
- h("span", {
152
- class: s(l(a).backButtonLabel({ class: (I = (y = e.ui) == null ? void 0 : y.backButton) == null ? void 0 : I.label }))
153
- }, K(w.value.label), 3)
154
- ];
155
- }),
156
- _: 1
157
- }, 8, ["class"])
158
- ], 2),
159
- (c(!0), g(H, null, N(w.value.groups, (n) => {
160
- var x, y, I;
161
- return c(), g("div", {
162
- key: n.key,
163
- class: s(l(a).group({ class: (x = e.ui) == null ? void 0 : x.group }))
164
- }, [
165
- n.label ? (c(), g("p", {
166
- key: 0,
167
- class: s(l(a).groupLabel({ class: (y = e.ui) == null ? void 0 : y.groupLabel }))
168
- }, K(n.label), 3)) : A("", !0),
169
- h("div", {
170
- class: s(l(a).childList({ class: (I = e.ui) == null ? void 0 : I.childList }))
171
- }, [
172
- (c(!0), g(H, null, N(n.items, (k) => (c(), _(r, {
173
- key: k.key,
174
- "data-testid": `item-${k.key}`,
175
- "data-active": k.key === e.activeKey,
176
- color: "neutral",
177
- variant: "ghost",
178
- class: s(ee(k)),
179
- onClick: (L) => se(k, w.value.key, n.key)
180
- }, {
181
- default: C(() => {
182
- var L, S, O, Q;
183
- return [
184
- k.icon ? (c(), _(o, {
185
- key: 0,
186
- name: k.icon,
187
- class: s(l(a).childItemLeadingIcon({ class: (S = (L = e.ui) == null ? void 0 : L.childItem) == null ? void 0 : S.leadingIcon }))
188
- }, null, 8, ["name", "class"])) : A("", !0),
189
- h("span", {
190
- class: s(l(a).childItemLabel({ class: (Q = (O = e.ui) == null ? void 0 : O.childItem) == null ? void 0 : Q.label }))
191
- }, K(k.label), 3)
192
- ];
193
- }),
194
- _: 2
195
- }, 1032, ["data-testid", "data-active", "class", "onClick"]))), 128))
196
- ], 2)
197
- ], 2);
198
- }), 128))
199
- ], 2)) : (c(), g("div", {
200
- key: "root",
201
- class: s(l(a).panel({ class: (q = e.ui) == null ? void 0 : q.panel }))
202
- }, [
203
- h("div", {
204
- class: s(l(a).sectionList({ class: (J = e.ui) == null ? void 0 : J.sectionList }))
205
- }, [
206
- (c(!0), g(H, null, N(e.sections, (n) => (c(), _(r, {
207
- key: n.key,
208
- "data-testid": `section-${n.key}`,
209
- "data-section": n.key,
210
- "data-active": P(n),
211
- color: "neutral",
212
- variant: "ghost",
213
- class: s(Z(n)),
214
- onClick: (x) => te(n)
215
- }, {
216
- default: C(() => {
217
- var x, y, I, k, L, S;
218
- return [
219
- n.icon ? (c(), _(o, {
220
- key: 0,
221
- name: n.icon,
222
- class: s(l(a).sectionItemLeadingIcon({ class: (y = (x = e.ui) == null ? void 0 : x.sectionItem) == null ? void 0 : y.leadingIcon }))
223
- }, null, 8, ["name", "class"])) : A("", !0),
224
- h("span", {
225
- class: s(l(a).sectionItemLabel({ class: (k = (I = e.ui) == null ? void 0 : I.sectionItem) == null ? void 0 : k.label }))
226
- }, K(n.label), 3),
227
- E(n).length > 1 ? (c(), _(o, {
228
- key: 1,
229
- name: "solar:alt-arrow-right-linear",
230
- class: s(l(a).sectionItemTrailingIcon({ class: (S = (L = e.ui) == null ? void 0 : L.sectionItem) == null ? void 0 : S.trailingIcon }))
231
- }, null, 8, ["class"])) : A("", !0)
232
- ];
233
- }),
234
- _: 2
235
- }, 1032, ["data-testid", "data-section", "data-active", "class", "onClick"]))), 128))
236
- ], 2)
237
- ], 2))
238
- ];
239
- }),
240
- _: 1
241
- }, 8, ["enter-active-class", "leave-active-class", "enter-from-class", "leave-to-class"])
242
- ], 2),
243
- h("footer", {
244
- class: s(l(a).footer({ class: (f = e.ui) == null ? void 0 : f.footer }))
245
- }, [
246
- M(t.$slots, "footer")
247
- ], 2)
248
- ], 2);
249
- };
250
- }
251
- });
252
- export {
253
- xe as _
254
- };