vlite3 0.1.2 → 0.1.4
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/components/Button.vue.js +8 -8
- package/components/DataTable/DataTable.vue.d.ts +4 -1
- package/components/DataTable/DataTable.vue.js +3 -3
- package/components/DataTable/DataTable.vue2.js +177 -170
- package/components/DataTable/DataTableHeader.vue.d.ts +2 -0
- package/components/DataTable/DataTableHeader.vue.js +15 -14
- package/components/DataTable/DataTableRow.vue.js +1 -1
- package/components/DataTable/types.d.ts +4 -1
- package/components/DatePicker.vue.d.ts +2 -2
- package/components/DatePicker.vue.js +13 -13
- package/components/FilePicker/FilePicker.vue.js +3 -3
- package/components/Form/Form.vue.d.ts +5 -2
- package/components/Form/Form.vue.js +2 -2
- package/components/Form/Form.vue2.js +128 -119
- package/components/Form/FormField.vue.js +21 -30
- package/components/Form/composables/useForm.d.ts +1 -0
- package/components/Form/composables/useForm.js +11 -11
- package/components/Form/types.d.ts +2 -0
- package/components/Input.vue.js +1 -1
- package/components/Modal.vue.js +50 -47
- package/components/Navbar/Navbar.vue.d.ts +1 -0
- package/components/Navbar/Navbar.vue.js +89 -68
- package/components/SidePanel.vue.js +1 -1
- package/components/SidePanel.vue2.js +42 -41
- package/components/Slider.vue.js +64 -56
- package/package.json +1 -1
- package/style.css +11 -8
- package/types/navbar.type.d.ts +1 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as k, defineAsyncComponent as t, computed as
|
|
2
|
-
import { isComponent as
|
|
3
|
-
import
|
|
1
|
+
import { defineComponent as k, defineAsyncComponent as t, computed as i, markRaw as V, openBlock as w, createBlock as x, resolveDynamicComponent as C, mergeProps as P, toHandlers as U } from "vue";
|
|
2
|
+
import { isComponent as o } from "./utils/form.utils.js";
|
|
3
|
+
import d from "../Input.vue.js";
|
|
4
4
|
import z from "../Switch.vue.js";
|
|
5
5
|
import S from "../CheckBox.vue.js";
|
|
6
6
|
import F from "../Textarea.vue.js";
|
|
@@ -21,26 +21,14 @@ const M = /* @__PURE__ */ k({
|
|
|
21
21
|
isUpdate: { type: Boolean, default: !1 }
|
|
22
22
|
},
|
|
23
23
|
emits: ["change"],
|
|
24
|
-
setup(
|
|
25
|
-
const u = t(
|
|
26
|
-
(
|
|
27
|
-
|
|
28
|
-
(
|
|
29
|
-
|
|
30
|
-
() => import("../DatePicker.vue2.js")
|
|
31
|
-
), m = t(
|
|
32
|
-
() => import("../ColorPicker/ColorPicker.vue2.js")
|
|
33
|
-
), h = t(
|
|
34
|
-
() => import("../IconPicker.vue2.js")
|
|
35
|
-
), v = t(
|
|
36
|
-
() => import("./CustomFields.vue.js")
|
|
37
|
-
), r = d, n = c, l = (e, a) => {
|
|
38
|
-
n("change", { value: e, data: a });
|
|
39
|
-
}, _ = (e) => {
|
|
40
|
-
n("change", { value: e });
|
|
41
|
-
}, y = o(() => {
|
|
24
|
+
setup(n, { emit: c }) {
|
|
25
|
+
const u = t(() => import("../Dropdown/Dropdown.vue2.js")), f = t(() => import("../MultiSelect/MultiSelect.vue2.js")), p = t(() => import("../DatePicker.vue2.js")), m = t(() => import("../ColorPicker/ColorPicker.vue2.js")), h = t(() => import("../IconPicker.vue2.js")), v = t(() => import("./CustomFields.vue.js")), r = n, s = c, l = (e, a) => {
|
|
26
|
+
s("change", { value: e, data: a });
|
|
27
|
+
}, y = (e) => {
|
|
28
|
+
s("change", { value: e });
|
|
29
|
+
}, g = i(() => {
|
|
42
30
|
const e = r.field.type;
|
|
43
|
-
if (
|
|
31
|
+
if (o(e))
|
|
44
32
|
return V(e);
|
|
45
33
|
switch (e) {
|
|
46
34
|
case "text":
|
|
@@ -50,7 +38,7 @@ const M = /* @__PURE__ */ k({
|
|
|
50
38
|
case "tel":
|
|
51
39
|
case "url":
|
|
52
40
|
case "search":
|
|
53
|
-
return
|
|
41
|
+
return d;
|
|
54
42
|
case "textarea":
|
|
55
43
|
return F;
|
|
56
44
|
case "switch":
|
|
@@ -76,9 +64,9 @@ const M = /* @__PURE__ */ k({
|
|
|
76
64
|
case "customFields":
|
|
77
65
|
return v;
|
|
78
66
|
default:
|
|
79
|
-
return
|
|
67
|
+
return d;
|
|
80
68
|
}
|
|
81
|
-
}),
|
|
69
|
+
}), _ = i(() => {
|
|
82
70
|
const e = r.field.type, a = {
|
|
83
71
|
disabled: r.disabled || r.field.disabled === !0,
|
|
84
72
|
...r.field.props || {}
|
|
@@ -162,15 +150,15 @@ const M = /* @__PURE__ */ k({
|
|
|
162
150
|
size: r.size,
|
|
163
151
|
rounded: r.rounded,
|
|
164
152
|
isUpdate: r.isUpdate
|
|
165
|
-
} :
|
|
153
|
+
} : o(e) ? {
|
|
166
154
|
...a,
|
|
167
155
|
value: r.value,
|
|
168
156
|
values: r.values
|
|
169
157
|
} : a;
|
|
170
|
-
}), b =
|
|
158
|
+
}), b = i(() => {
|
|
171
159
|
const e = r.field.type;
|
|
172
160
|
return e === "text" || e === "email" || e === "password" || e === "number" || e === "tel" || e === "url" || e === "search" || e === "textarea" || e === "switch" || e === "check" || !e ? {
|
|
173
|
-
"update:modelValue":
|
|
161
|
+
"update:modelValue": y
|
|
174
162
|
} : e === "select" ? {
|
|
175
163
|
onSelect: (a) => {
|
|
176
164
|
l(a.value, a.data);
|
|
@@ -193,13 +181,16 @@ const M = /* @__PURE__ */ k({
|
|
|
193
181
|
onSelect: (a) => l(a)
|
|
194
182
|
} : e === "customFields" ? {
|
|
195
183
|
change: (a) => l(a)
|
|
196
|
-
} :
|
|
184
|
+
} : o(e) ? {
|
|
197
185
|
onChange: (a) => {
|
|
198
186
|
l(a.value, a.data);
|
|
199
187
|
}
|
|
200
188
|
} : {};
|
|
201
189
|
});
|
|
202
|
-
return (e, a) => (w(), x(C(
|
|
190
|
+
return (e, a) => (w(), x(C(g.value), P({
|
|
191
|
+
..._.value,
|
|
192
|
+
...n.field?.props || {}
|
|
193
|
+
}, U(b.value)), null, 16));
|
|
203
194
|
}
|
|
204
195
|
});
|
|
205
196
|
export {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ref as u, computed as $, watch as k } from "vue";
|
|
2
2
|
import { initializeFormValues as j, deepClone as c, getNestedValue as N, evaluateConditional as y, setNestedValue as h, collectFileFields as B, filterNullCustomFields as G } from "../utils/form.utils.js";
|
|
3
3
|
import { useFileUpload as H } from "./useFileUpload.js";
|
|
4
|
-
function
|
|
5
|
-
const { schema: i, values: V, isUpdate: d = !1, onSubmit: b } = q, { handleUploadFile:
|
|
4
|
+
function Y(q) {
|
|
5
|
+
const { schema: i, values: V, isUpdate: d = !1, folderId: x, onSubmit: b } = q, { handleUploadFile: D, loading: J } = H(), t = u(j(i, V)), r = u({}), v = u(!1), n = u(!1), m = u(c(t.value)), f = $(() => i ? Array.isArray(i[0]) ? i.flat() : i : []);
|
|
6
6
|
k(
|
|
7
7
|
() => V,
|
|
8
8
|
(e) => {
|
|
@@ -13,11 +13,11 @@ function X(q) {
|
|
|
13
13
|
const p = () => ({
|
|
14
14
|
values: t.value,
|
|
15
15
|
isUpdate: d
|
|
16
|
-
}), g = (e) => N(t.value, e),
|
|
16
|
+
}), g = (e) => N(t.value, e), O = (e) => r.value[e] || "", A = (e, l) => {
|
|
17
17
|
l ? r.value[e] = l : delete r.value[e];
|
|
18
18
|
}, F = () => {
|
|
19
19
|
r.value = {};
|
|
20
|
-
}, S = (e) => e.when ? y(e.when, p()) : !0, w = (e) => y(e.disabled, p()),
|
|
20
|
+
}, S = (e) => e.when ? y(e.when, p()) : !0, w = (e) => y(e.disabled, p()), z = (e) => y(e.readonly, p()), C = (e) => {
|
|
21
21
|
const l = g(e.name);
|
|
22
22
|
let a = "";
|
|
23
23
|
return e.required && (l == null || l === "" || Array.isArray(l) && l.length === 0) && (a = `${e.label || e.name} is required`), !a && e.validation && (a = e.validation({
|
|
@@ -33,7 +33,7 @@ function X(q) {
|
|
|
33
33
|
C(l) && (e = !1);
|
|
34
34
|
}
|
|
35
35
|
return e;
|
|
36
|
-
},
|
|
36
|
+
}, I = (e, l, a) => {
|
|
37
37
|
t.value = h(t.value, e, l), n.value = !0, delete r.value[e];
|
|
38
38
|
const o = f.value.find((s) => s.name === e);
|
|
39
39
|
if (o?.updateValues) {
|
|
@@ -48,9 +48,9 @@ function X(q) {
|
|
|
48
48
|
}, L = async () => {
|
|
49
49
|
const e = c(t.value), l = B(i, e);
|
|
50
50
|
for (const a of l) {
|
|
51
|
-
const { name: o, value: s, type:
|
|
51
|
+
const { name: o, value: s, type: P } = a;
|
|
52
52
|
if (s instanceof File || s && typeof s == "object" && s.file instanceof File) {
|
|
53
|
-
const U = await
|
|
53
|
+
const U = await D(s, x);
|
|
54
54
|
U && Object.assign(e, h(e, o, U));
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -72,14 +72,14 @@ function X(q) {
|
|
|
72
72
|
errors: r,
|
|
73
73
|
isSubmitting: v,
|
|
74
74
|
isDirty: n,
|
|
75
|
-
handleFieldChange:
|
|
75
|
+
handleFieldChange: I,
|
|
76
76
|
validateField: C,
|
|
77
77
|
validateAll: E,
|
|
78
78
|
isFieldVisible: S,
|
|
79
79
|
isFieldDisabled: w,
|
|
80
|
-
isFieldReadonly:
|
|
80
|
+
isFieldReadonly: z,
|
|
81
81
|
getFieldValue: g,
|
|
82
|
-
getFieldError:
|
|
82
|
+
getFieldError: O,
|
|
83
83
|
setFieldError: A,
|
|
84
84
|
clearErrors: F,
|
|
85
85
|
resetForm: () => {
|
|
@@ -105,5 +105,5 @@ function X(q) {
|
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
export {
|
|
108
|
-
|
|
108
|
+
Y as useForm
|
|
109
109
|
};
|
|
@@ -140,6 +140,8 @@ export interface IFormProps {
|
|
|
140
140
|
showCancel?: boolean;
|
|
141
141
|
/** Whether this is an update operation */
|
|
142
142
|
isUpdate?: boolean;
|
|
143
|
+
/** Folder ID for file uploads */
|
|
144
|
+
folderId?: string;
|
|
143
145
|
/** Custom class for form element */
|
|
144
146
|
class?: string;
|
|
145
147
|
/** Custom class for the grid layout (overrides columns) */
|
package/components/Input.vue.js
CHANGED
|
@@ -41,7 +41,7 @@ const Y = ["type", "value", "placeholder", "disabled", "min", "max"], Z = { clas
|
|
|
41
41
|
].join(" ")), T = u(() => ["relative flex w-full items-stretch", e.labelPosition !== "top" ? "flex-1" : ""].join(
|
|
42
42
|
" "
|
|
43
43
|
)), R = u(() => {
|
|
44
|
-
const l = "block w-full bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground/50 disabled:cursor-not-allowed disabled:opacity-50
|
|
44
|
+
const l = "block w-full bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground/50 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none", o = {
|
|
45
45
|
solid: "bg-muted border-transparent focus-visible:border-primary",
|
|
46
46
|
outline: "border border-input focus-visible:border-primary",
|
|
47
47
|
"outline-b": "border-b border-input bg-transparent rounded-none focus-visible:border-primary",
|
package/components/Modal.vue.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { useKeyStroke as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as w, ref as $, watch as m, provide as B, onUnmounted as O, openBlock as s, createElementBlock as a, Fragment as S, createElementVNode as n, mergeProps as y, withModifiers as b, renderSlot as i, createCommentVNode as r, createBlock as h, Teleport as z, createVNode as v, Transition as E, withCtx as N, normalizeClass as d, toDisplayString as p, resolveDynamicComponent as P } from "vue";
|
|
2
|
+
import V from "./Button.vue.js";
|
|
3
|
+
import { useKeyStroke as j } from "../composables/useKeyStroke.js";
|
|
4
|
+
const D = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "flex-none flex flex-col space-y-1.5 pb-0 border-b"
|
|
7
|
-
},
|
|
7
|
+
}, K = { class: "text-lg font-semibold leading-none tracking-tight" }, M = {
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "text-sm text-muted-foreground mb-2"
|
|
10
|
-
}, F = /* @__PURE__ */
|
|
10
|
+
}, F = /* @__PURE__ */ w({
|
|
11
|
+
inheritAttrs: !1,
|
|
11
12
|
__name: "Modal",
|
|
12
13
|
props: {
|
|
13
14
|
show: { type: Boolean, default: !1 },
|
|
@@ -24,36 +25,38 @@ const j = {
|
|
|
24
25
|
bodyProps: {}
|
|
25
26
|
},
|
|
26
27
|
emits: ["close", "update:show", "onOpen"],
|
|
27
|
-
setup(e, { emit:
|
|
28
|
-
const c = e, u =
|
|
28
|
+
setup(e, { emit: g }) {
|
|
29
|
+
const c = e, u = g, l = $(c.show);
|
|
29
30
|
m(
|
|
30
31
|
() => c.show,
|
|
31
32
|
(t) => {
|
|
32
|
-
|
|
33
|
+
l.value = t, t && u("onOpen");
|
|
33
34
|
}
|
|
34
35
|
);
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
const x = () => {
|
|
37
|
+
l.value = !0;
|
|
38
|
+
}, o = () => {
|
|
39
|
+
l.value = !1, u("update:show", !1), u("close");
|
|
40
|
+
};
|
|
41
|
+
B("modal-context", { close: o });
|
|
42
|
+
const k = () => {
|
|
43
|
+
c.closeOutside && o();
|
|
44
|
+
}, { onKeyStroke: C } = j();
|
|
45
|
+
return C("Escape", o), m(l, (t) => {
|
|
43
46
|
t ? document.body.style.overflow = "hidden" : document.body.style.overflow = "";
|
|
44
|
-
}),
|
|
47
|
+
}), O(() => {
|
|
45
48
|
document.body.style.overflow = "";
|
|
46
|
-
}), (t, f) => (
|
|
47
|
-
|
|
48
|
-
onClick:
|
|
49
|
-
class:
|
|
50
|
-
}, [
|
|
49
|
+
}), (t, f) => (s(), a(S, null, [
|
|
50
|
+
n("span", y({
|
|
51
|
+
onClick: b(x, ["stop"]),
|
|
52
|
+
class: `${e.triggerClass}`
|
|
53
|
+
}, t.$attrs), [
|
|
51
54
|
i(t.$slots, "trigger", {}, () => [
|
|
52
55
|
e.body ? i(t.$slots, "default", { key: 0 }) : r("", !0)
|
|
53
56
|
])
|
|
54
|
-
],
|
|
55
|
-
(
|
|
56
|
-
|
|
57
|
+
], 16),
|
|
58
|
+
(s(), h(z, { to: "body" }, [
|
|
59
|
+
v(E, {
|
|
57
60
|
"enter-active-class": "transition duration-200 ease-out",
|
|
58
61
|
"enter-from-class": "opacity-0",
|
|
59
62
|
"enter-to-class": "opacity-100",
|
|
@@ -61,46 +64,46 @@ const j = {
|
|
|
61
64
|
"leave-from-class": "opacity-100",
|
|
62
65
|
"leave-to-class": "opacity-0"
|
|
63
66
|
}, {
|
|
64
|
-
default:
|
|
65
|
-
|
|
67
|
+
default: N(() => [
|
|
68
|
+
l.value ? (s(), a("div", {
|
|
66
69
|
key: 0,
|
|
67
|
-
class:
|
|
68
|
-
onClick:
|
|
70
|
+
class: d(["fixed inset-0 z-50 flex items-center justify-center bg-[#00000051] p-4", e.backdrop && "backdrop-blur-[2px]"]),
|
|
71
|
+
onClick: k
|
|
69
72
|
}, [
|
|
70
|
-
|
|
71
|
-
class:
|
|
72
|
-
onClick: f[0] || (f[0] =
|
|
73
|
+
n("div", {
|
|
74
|
+
class: d(["modal-body relative w-full rounded border border-border bg-body text-foreground shadow-lg flex flex-col max-h-[85vh] sm:max-h-[90vh]", [e.maxWidth]]),
|
|
75
|
+
onClick: f[0] || (f[0] = b(() => {
|
|
73
76
|
}, ["stop"]))
|
|
74
77
|
}, [
|
|
75
|
-
e.title ? (
|
|
76
|
-
|
|
77
|
-
class:
|
|
78
|
+
e.title ? (s(), a("div", D, [
|
|
79
|
+
n("div", {
|
|
80
|
+
class: d(["flex items-center justify-between bg-muted-light py-1 px-4 rounded-t-md", e.headerClass])
|
|
78
81
|
}, [
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
n("h3", K, p(e.title), 1),
|
|
83
|
+
v(V, {
|
|
81
84
|
rounded: "full",
|
|
82
85
|
size: "sm",
|
|
83
86
|
icon: "lucide:x",
|
|
84
87
|
variant: "ghost",
|
|
85
88
|
class: "hover:bg-gray-250/25!",
|
|
86
|
-
onClick:
|
|
89
|
+
onClick: o
|
|
87
90
|
})
|
|
88
91
|
], 2)
|
|
89
92
|
])) : r("", !0),
|
|
90
|
-
|
|
91
|
-
class:
|
|
93
|
+
n("div", {
|
|
94
|
+
class: d(["flex-1 overflow-y-auto px-4 pt-4 pb-3.5 min-h-0 shadow-xl", e.bodyClass])
|
|
92
95
|
}, [
|
|
93
|
-
e.description ? (
|
|
94
|
-
e.body ? (
|
|
96
|
+
e.description ? (s(), a("p", M, p(e.description), 1)) : r("", !0),
|
|
97
|
+
e.body ? (s(), h(P(e.body), y({ key: 1 }, { ...e.bodyProps, ...t.$attrs }, { close: o }), null, 16)) : i(t.$slots, "default", {
|
|
95
98
|
key: 2,
|
|
96
|
-
close:
|
|
99
|
+
close: o
|
|
97
100
|
})
|
|
98
101
|
], 2),
|
|
99
|
-
t.$slots.footer ? (
|
|
102
|
+
t.$slots.footer ? (s(), a("div", {
|
|
100
103
|
key: 1,
|
|
101
|
-
class:
|
|
104
|
+
class: d([e.footerClass, "flex-none flex items-center px-4 py-2.5 border-t rounded-b-xl"])
|
|
102
105
|
}, [
|
|
103
|
-
i(t.$slots, "footer", { close:
|
|
106
|
+
i(t.$slots, "footer", { close: o })
|
|
104
107
|
], 2)) : r("", !0)
|
|
105
108
|
], 2)
|
|
106
109
|
], 2)) : r("", !0)
|
|
@@ -41,6 +41,7 @@ declare const __VLS_component: import('vue').DefineComponent<NavbarProps, {}, {}
|
|
|
41
41
|
centerPosition: import('../../types/navbar.type').NavbarCenterPosition;
|
|
42
42
|
glass: boolean;
|
|
43
43
|
floating: boolean;
|
|
44
|
+
mobileBreakpoint: "sm" | "md" | "lg" | "xl";
|
|
44
45
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLElement>;
|
|
45
46
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
46
47
|
export default _default;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as z, ref as h, useSlots as S, onMounted as j, onUnmounted as M, computed as f, provide as N, openBlock as r, createElementBlock as i, normalizeClass as a, Fragment as y, createElementVNode as s, renderSlot as l, createVNode as p, createBlock as k, resolveDynamicComponent as P, withCtx as g, createCommentVNode as w, toDisplayString as T, createTextVNode as E } from "vue";
|
|
2
|
+
import $ from "../Icon.vue.js";
|
|
3
|
+
import L from "../SidePanel.vue.js";
|
|
4
|
+
import V from "../Logo.vue.js";
|
|
5
|
+
const A = { class: "flex items-center gap-4 shrink-0 z-10" }, O = { class: "shrink-0" }, D = { key: 1 }, H = { key: 2 }, U = { class: "h-16 flex items-center px-6 shrink-0 z-10" }, F = { class: "flex-1 px-4 py-4 overflow-y-auto space-y-4 scrollbar-thin" }, Y = { class: "p-4 border-t border-border shrink-0 bg-background mt-auto" }, q = { class: "flex flex-col space-y-6 pt-4 h-full" }, G = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "flex flex-col space-y-1"
|
|
8
|
-
},
|
|
8
|
+
}, I = {
|
|
9
9
|
key: 1,
|
|
10
10
|
class: "flex flex-col space-y-4 flex-1 overflow-y-auto"
|
|
11
|
-
},
|
|
11
|
+
}, J = { class: "mt-auto pt-4 border-t border-border" }, Z = /* @__PURE__ */ z({
|
|
12
12
|
__name: "Navbar",
|
|
13
13
|
props: {
|
|
14
14
|
variant: { default: "header" },
|
|
@@ -22,35 +22,50 @@ const O = { class: "flex items-center gap-4 shrink-0 z-10" }, D = { class: "shri
|
|
|
22
22
|
width: { default: "w-64" },
|
|
23
23
|
compact: { type: Boolean, default: !1 },
|
|
24
24
|
logo: {},
|
|
25
|
-
logoAlt: {}
|
|
25
|
+
logoAlt: {},
|
|
26
|
+
mobileBreakpoint: { default: "md" }
|
|
26
27
|
},
|
|
27
28
|
emits: ["toggle-mobile"],
|
|
28
|
-
setup(
|
|
29
|
-
const t =
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
29
|
+
setup(d, { emit: K }) {
|
|
30
|
+
const t = d, c = h(!1), m = h(!1);
|
|
31
|
+
S();
|
|
32
|
+
const v = () => {
|
|
33
|
+
m.value = window.scrollY > 10;
|
|
33
34
|
};
|
|
34
|
-
|
|
35
|
-
window.addEventListener("scroll",
|
|
36
|
-
}),
|
|
37
|
-
window.removeEventListener("scroll",
|
|
35
|
+
j(() => {
|
|
36
|
+
window.addEventListener("scroll", v, { passive: !0 });
|
|
37
|
+
}), M(() => {
|
|
38
|
+
window.removeEventListener("scroll", v);
|
|
38
39
|
});
|
|
39
|
-
const
|
|
40
|
+
const x = f(() => {
|
|
40
41
|
const e = t.variant === "sidebar", o = {
|
|
41
42
|
fixed: "fixed top-0 left-0 z-40",
|
|
42
43
|
sticky: "sticky top-0 z-40",
|
|
43
44
|
relative: "relative z-10",
|
|
44
45
|
absolute: "absolute top-0 left-0 w-full z-40"
|
|
45
|
-
},
|
|
46
|
-
t.glass && (
|
|
46
|
+
}, u = "transition-all duration-300 ease-in-out bg-body", B = [
|
|
47
|
+
t.glass && (m.value || e || t.floating) ? "backdrop-blur-md bg-background/80 supports-[backdrop-filter]:bg-background/60" : "bg-background",
|
|
47
48
|
t.border && !t.floating ? e ? "border-r border-border" : "border-b border-border" : "",
|
|
48
49
|
t.floating ? "m-4 rounded-xl shadow-lg border border-border/50" : "",
|
|
49
|
-
|
|
50
|
+
m.value && !t.floating && !e && t.position === "sticky" ? "shadow-sm" : ""
|
|
50
51
|
];
|
|
51
|
-
let
|
|
52
|
-
return e ?
|
|
53
|
-
}),
|
|
52
|
+
let b = "";
|
|
53
|
+
return e ? b = n.value.sidebarLayout : b = `flex items-center gap-4 w-full px-4 sm:px-6 lg:px-8 ${t.height}`, [u, o[t.position], ...B, b, t.class].join(" ");
|
|
54
|
+
}), n = f(() => {
|
|
55
|
+
const e = t.mobileBreakpoint || "md";
|
|
56
|
+
return {
|
|
57
|
+
// Show on mobile (up to breakpoint), hide on desktop (breakpoint and up)
|
|
58
|
+
mobileTrigger: `${e}:hidden`,
|
|
59
|
+
// Hide on mobile, show on desktop
|
|
60
|
+
desktopContent: `hidden ${e}:flex`,
|
|
61
|
+
// Sidebar: Mobile (auto height, full width) -> Desktop (fixed width based on prop, full height constrained to viewport)
|
|
62
|
+
sidebarLayout: `flex flex-col max-${e}:w-full ${t.compact ? "w-20" : t.width} h-auto ${e}:h-full ${e}:max-h-screen`,
|
|
63
|
+
// Mobile Header (visible only on small screens)
|
|
64
|
+
mobileHeader: `${e}:hidden flex items-center justify-between px-4 py-3 shrink-0 bg-background`,
|
|
65
|
+
// Desktop Sidebar Content (hidden on small screens)
|
|
66
|
+
desktopSidebar: `hidden ${e}:flex flex-col h-full w-full overflow-hidden`
|
|
67
|
+
};
|
|
68
|
+
}), C = f(() => {
|
|
54
69
|
if (t.variant === "sidebar") return "flex-1 py-4 overflow-y-auto";
|
|
55
70
|
switch (t.centerPosition) {
|
|
56
71
|
case "left":
|
|
@@ -58,54 +73,56 @@ const O = { class: "flex items-center gap-4 shrink-0 z-10" }, D = { class: "shri
|
|
|
58
73
|
case "right":
|
|
59
74
|
return "flex items-center justify-end ml-auto";
|
|
60
75
|
default:
|
|
61
|
-
return
|
|
76
|
+
return `${n.value.desktopContent} items-center justify-center mx-auto`;
|
|
62
77
|
}
|
|
63
78
|
});
|
|
64
|
-
return
|
|
79
|
+
return N("navbar-context", {
|
|
65
80
|
compact: f(() => t.compact)
|
|
66
|
-
}), (e, o) => (
|
|
67
|
-
class:
|
|
81
|
+
}), (e, o) => (r(), i("nav", {
|
|
82
|
+
class: a(x.value),
|
|
68
83
|
role: "navigation"
|
|
69
84
|
}, [
|
|
70
|
-
|
|
71
|
-
s("div",
|
|
85
|
+
d.variant === "header" ? (r(), i(y, { key: 0 }, [
|
|
86
|
+
s("div", A, [
|
|
72
87
|
l(e.$slots, "mobile-trigger", {}, () => [
|
|
73
88
|
s("button", {
|
|
74
89
|
type: "button",
|
|
75
|
-
class: "
|
|
76
|
-
onClick: o[0] || (o[0] = (
|
|
90
|
+
class: a(["p-2 -ml-2 text-muted-foreground hover:bg-accent rounded-md shrink-0", n.value.mobileTrigger]),
|
|
91
|
+
onClick: o[0] || (o[0] = (u) => c.value = !0)
|
|
77
92
|
}, [
|
|
78
|
-
p(
|
|
93
|
+
p($, {
|
|
79
94
|
icon: "lucide:menu",
|
|
80
95
|
class: "w-5 h-5"
|
|
81
96
|
}),
|
|
82
97
|
o[3] || (o[3] = s("span", { class: "sr-only" }, "Open Menu", -1))
|
|
83
|
-
])
|
|
98
|
+
], 2)
|
|
84
99
|
]),
|
|
85
|
-
s("div",
|
|
100
|
+
s("div", O, [
|
|
86
101
|
l(e.$slots, "logo", {}, () => [
|
|
87
|
-
(
|
|
102
|
+
(r(), k(P(t.logo ? "img" : "div"), {
|
|
88
103
|
src: t.logo,
|
|
89
104
|
class: "h-8 w-auto font-bold text-xl flex items-center gap-2"
|
|
90
105
|
}, {
|
|
91
|
-
default:
|
|
92
|
-
t.logo ? w("", !0) : (
|
|
106
|
+
default: g(() => [
|
|
107
|
+
t.logo ? w("", !0) : (r(), k(V, {
|
|
93
108
|
key: 0,
|
|
94
109
|
class: "h-6 w-6"
|
|
95
110
|
})),
|
|
96
|
-
!t.logo && t.logoAlt ? (
|
|
111
|
+
!t.logo && t.logoAlt ? (r(), i("span", D, T(t.logoAlt), 1)) : t.logo ? w("", !0) : (r(), i("span", H, "Brand"))
|
|
97
112
|
]),
|
|
98
113
|
_: 1
|
|
99
114
|
}, 8, ["src"]))
|
|
100
115
|
])
|
|
101
116
|
]),
|
|
102
|
-
s("div",
|
|
117
|
+
s("div", {
|
|
118
|
+
class: a(["items-center gap-1 overflow-x-auto no-scrollbar mask-gradient", n.value.desktopContent])
|
|
119
|
+
}, [
|
|
103
120
|
l(e.$slots, "left")
|
|
104
|
-
])
|
|
121
|
+
], 2)
|
|
105
122
|
]),
|
|
106
123
|
s("div", {
|
|
107
|
-
class:
|
|
108
|
-
|
|
124
|
+
class: a([
|
|
125
|
+
C.value,
|
|
109
126
|
// Width constraint to ensure it doesn't crush others, but allows simple resizing
|
|
110
127
|
"max-w-full"
|
|
111
128
|
])
|
|
@@ -113,86 +130,90 @@ const O = { class: "flex items-center gap-4 shrink-0 z-10" }, D = { class: "shri
|
|
|
113
130
|
l(e.$slots, "center")
|
|
114
131
|
], 2),
|
|
115
132
|
s("div", {
|
|
116
|
-
class:
|
|
133
|
+
class: a(["flex items-center gap-2 shrink-0 max-w-[40%] z-10", {
|
|
117
134
|
// Always push to end unless Center is pushing it.
|
|
118
135
|
// If Center is 'center' (mx-auto) or 'right' (ml-auto), this naturally falls to end.
|
|
119
136
|
// If Center is 'left', we MUST have ml-auto here.
|
|
120
|
-
"ml-auto":
|
|
137
|
+
"ml-auto": d.centerPosition === "left" || d.centerPosition === "center"
|
|
121
138
|
// If center is 'right', Center has ml-auto. Right just sits next to it.
|
|
122
139
|
// But if we add ml-auto here too, they might split space? No, flexbox parses strictly.
|
|
123
140
|
}])
|
|
124
141
|
}, [
|
|
125
142
|
l(e.$slots, "right")
|
|
126
143
|
], 2)
|
|
127
|
-
], 64)) : (
|
|
128
|
-
s("div",
|
|
144
|
+
], 64)) : (r(), i(y, { key: 1 }, [
|
|
145
|
+
s("div", {
|
|
146
|
+
class: a(n.value.mobileHeader)
|
|
147
|
+
}, [
|
|
129
148
|
l(e.$slots, "logo", {}, () => [
|
|
130
149
|
o[4] || (o[4] = s("div", { class: "font-bold text-xl truncate" }, "Brand", -1))
|
|
131
150
|
]),
|
|
132
151
|
s("button", {
|
|
133
152
|
type: "button",
|
|
134
153
|
class: "p-2 -mr-2 text-muted-foreground hover:bg-accent rounded-md",
|
|
135
|
-
onClick: o[1] || (o[1] = (
|
|
154
|
+
onClick: o[1] || (o[1] = (u) => c.value = !0)
|
|
136
155
|
}, [
|
|
137
|
-
p(
|
|
156
|
+
p($, {
|
|
138
157
|
icon: "lucide:menu",
|
|
139
158
|
class: "w-5 h-5"
|
|
140
159
|
}),
|
|
141
160
|
o[5] || (o[5] = s("span", { class: "sr-only" }, "Open Menu", -1))
|
|
142
161
|
])
|
|
143
|
-
]),
|
|
144
|
-
s("div",
|
|
145
|
-
|
|
162
|
+
], 2),
|
|
163
|
+
s("div", {
|
|
164
|
+
class: a(n.value.desktopSidebar)
|
|
165
|
+
}, [
|
|
166
|
+
s("div", U, [
|
|
146
167
|
l(e.$slots, "logo", {}, () => [
|
|
147
168
|
o[6] || (o[6] = s("div", { class: "font-bold text-xl truncate" }, "Brand", -1))
|
|
148
169
|
])
|
|
149
170
|
]),
|
|
150
|
-
s("div",
|
|
171
|
+
s("div", F, [
|
|
151
172
|
l(e.$slots, "left"),
|
|
152
173
|
l(e.$slots, "default"),
|
|
153
174
|
l(e.$slots, "center")
|
|
154
175
|
]),
|
|
155
|
-
s("div",
|
|
176
|
+
s("div", Y, [
|
|
156
177
|
l(e.$slots, "right")
|
|
157
178
|
])
|
|
158
|
-
])
|
|
179
|
+
], 2)
|
|
159
180
|
], 64)),
|
|
160
|
-
p(
|
|
161
|
-
show:
|
|
162
|
-
"onUpdate:show": o[2] || (o[2] = (
|
|
181
|
+
p(L, {
|
|
182
|
+
show: c.value,
|
|
183
|
+
"onUpdate:show": o[2] || (o[2] = (u) => c.value = u),
|
|
163
184
|
position: "left",
|
|
164
185
|
size: "sm",
|
|
165
|
-
triggerClass:
|
|
166
|
-
class: "z-60
|
|
186
|
+
triggerClass: n.value.mobileTrigger,
|
|
187
|
+
class: a(["z-60", n.value.mobileTrigger])
|
|
167
188
|
}, {
|
|
168
|
-
header:
|
|
189
|
+
header: g(() => [
|
|
169
190
|
l(e.$slots, "logo", {}, () => [
|
|
170
191
|
o[7] || (o[7] = E("Brand", -1))
|
|
171
192
|
])
|
|
172
193
|
]),
|
|
173
|
-
default:
|
|
174
|
-
s("div",
|
|
175
|
-
|
|
194
|
+
default: g(() => [
|
|
195
|
+
s("div", q, [
|
|
196
|
+
d.variant === "header" ? (r(), i("div", G, [
|
|
176
197
|
l(e.$slots, "mobile-menu", {}, () => [
|
|
177
198
|
l(e.$slots, "left"),
|
|
178
199
|
o[8] || (o[8] = s("div", { class: "h-px bg-border my-2" }, null, -1)),
|
|
179
200
|
l(e.$slots, "center")
|
|
180
201
|
])
|
|
181
|
-
])) : (
|
|
202
|
+
])) : (r(), i("div", I, [
|
|
182
203
|
l(e.$slots, "left"),
|
|
183
204
|
l(e.$slots, "default"),
|
|
184
205
|
l(e.$slots, "center")
|
|
185
206
|
])),
|
|
186
|
-
s("div",
|
|
207
|
+
s("div", J, [
|
|
187
208
|
l(e.$slots, "right")
|
|
188
209
|
])
|
|
189
210
|
])
|
|
190
211
|
]),
|
|
191
212
|
_: 3
|
|
192
|
-
}, 8, ["show"])
|
|
213
|
+
}, 8, ["show", "triggerClass", "class"])
|
|
193
214
|
], 2));
|
|
194
215
|
}
|
|
195
216
|
});
|
|
196
217
|
export {
|
|
197
|
-
|
|
218
|
+
Z as default
|
|
198
219
|
};
|