@oneb/ui-vue 0.0.9 → 0.0.11

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.
@@ -0,0 +1,223 @@
1
+ import { defineComponent as h, computed as O, resolveComponent as L, openBlock as l, createBlock as u, normalizeClass as i, withCtx as j, createElementVNode as s, resolveDynamicComponent as B, createCommentVNode as d, toDisplayString as m, createElementBlock as p, Fragment as $, renderList as N, ref as A, watch as I, createVNode as c, unref as M, renderSlot as R } from "vue";
2
+ import { c as F, b as P } from "../OneBrowserMenu.vue_vue_type_script_setup_true_lang-197489be.js";
3
+ import "../common/index.js";
4
+ const C = {
5
+ items: {
6
+ required: !0,
7
+ type: Array
8
+ },
9
+ slim: {
10
+ type: Boolean,
11
+ default: !0
12
+ }
13
+ }, V = {
14
+ route: {
15
+ required: !1,
16
+ type: [Object, String]
17
+ },
18
+ routeName: {
19
+ required: !1,
20
+ type: String
21
+ },
22
+ handler: {
23
+ required: !1,
24
+ type: Function,
25
+ default() {
26
+ return () => {
27
+ };
28
+ }
29
+ },
30
+ label: {
31
+ type: String,
32
+ required: !0
33
+ },
34
+ icon: {
35
+ type: [Function, Object]
36
+ },
37
+ exact: {
38
+ type: Boolean,
39
+ required: !1,
40
+ default: !1
41
+ },
42
+ slim: {
43
+ type: Boolean,
44
+ default: !0
45
+ }
46
+ }, D = {
47
+ sidebarItems: C.items,
48
+ logoSrc: {
49
+ type: String
50
+ },
51
+ app: {
52
+ required: !0,
53
+ type: Object
54
+ },
55
+ user: {
56
+ type: Object,
57
+ required: !0
58
+ },
59
+ labels: {
60
+ type: Object
61
+ },
62
+ handlers: {
63
+ type: Object
64
+ }
65
+ }, E = /* @__PURE__ */ h({
66
+ __name: "OneSidebarLink",
67
+ props: V,
68
+ setup(r) {
69
+ const o = r, a = O(() => o.route != null ? o.route : o.routeName != null ? { name: o.routeName } : "/");
70
+ return (t, e) => {
71
+ const n = L("RouterLink");
72
+ return l(), u(n, {
73
+ to: a.value,
74
+ class: i(["flex items-center w-full p-[8px] rounded-lg text-sm font-medium hover:bg-primary-10-hover hover:text-primary-base transition-all text-primary-content", [t.slim ? "w-[44px] h-[44px] justify-center" : "h-[44px] justify-start"]]),
75
+ "active-class": t.exact ? "" : "bg-primary-10 !text-primary-base",
76
+ "exact-active-class": t.exact ? "bg-primary-10 !text-primary-base" : "",
77
+ exact: t.exact
78
+ }, {
79
+ default: j(() => [
80
+ s("div", {
81
+ class: i(["flex flex-nowrap items-center", [t.slim ? "w-[24px] h-[24px]" : "w-full"]])
82
+ }, [
83
+ t.icon ? (l(), u(B(t.icon), {
84
+ key: 0,
85
+ class: "w-[24px] h-[24px] flex-shrink-0"
86
+ })) : d("", !0),
87
+ s("div", {
88
+ class: i(["whitespace-nowrap overflow-hidden text-ellipsis transition-all text-left flex-shrink", [t.slim ? "w-0" : "pl-1.5 w-full"]])
89
+ }, m(t.label), 3)
90
+ ], 2)
91
+ ]),
92
+ _: 1
93
+ }, 8, ["to", "active-class", "exact-active-class", "exact", "class"]);
94
+ };
95
+ }
96
+ }), z = { class: "" }, G = { class: "space-y-2 p-2" }, H = /* @__PURE__ */ h({
97
+ __name: "OneSidebar",
98
+ props: C,
99
+ setup(r) {
100
+ return (o, a) => (l(), p("div", z, [
101
+ s("div", G, [
102
+ (l(!0), p($, null, N(o.items, (t) => (l(), u(E, {
103
+ key: t.label,
104
+ icon: t.icon,
105
+ label: t.label,
106
+ route: t.route,
107
+ "route-name": t.routeName,
108
+ exact: t.exact || !1,
109
+ slim: o.slim
110
+ }, null, 8, ["icon", "label", "route", "route-name", "exact", "slim"]))), 128))
111
+ ])
112
+ ]));
113
+ }
114
+ });
115
+ function J(r, o) {
116
+ return l(), p("svg", {
117
+ xmlns: "http://www.w3.org/2000/svg",
118
+ fill: "none",
119
+ viewBox: "0 0 24 24",
120
+ "stroke-width": "1.8",
121
+ stroke: "currentColor",
122
+ "aria-hidden": "true"
123
+ }, [
124
+ s("path", {
125
+ "stroke-linecap": "round",
126
+ "stroke-linejoin": "round",
127
+ d: "M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"
128
+ })
129
+ ]);
130
+ }
131
+ const K = { class: "min-h-screen relative" }, Q = { class: "header h-[56px] flex items-center flex-nowrap absolute top-0 left-0 w-screen" }, T = { class: "p-2 flex-shrink-0" }, U = { class: "w-10 h-10 bg-white rounded-lg border border-secondary-stroke flex items-center flex-shrink-0" }, W = ["src"], X = { class: "whitespace-nowrap" }, Y = { class: "text-xs whitespace-nowrap" }, Z = { class: "w-full" }, ee = { class: "w-full flex justify-end pr-2" }, te = { class: "flex items-center space-x-1" }, se = { class: "body w-full h-full" }, re = /* @__PURE__ */ h({
132
+ __name: "OneMainLayout",
133
+ props: D,
134
+ setup(r) {
135
+ const o = r, a = A(window.localStorage.getItem("sidebar-slim") === "1");
136
+ I(a, (e) => {
137
+ window.localStorage.setItem("sidebar-slim", String(e ? 1 : 0));
138
+ });
139
+ const t = O(() => {
140
+ var e, n;
141
+ return {
142
+ name: ((e = o.app) == null ? void 0 : e.workspace) || "",
143
+ photo_url: ((n = o.app) == null ? void 0 : n.photo_url) || ""
144
+ };
145
+ });
146
+ return (e, n) => {
147
+ var f, b, w, v, y, g, x, _, k, S;
148
+ const q = L("RouterLink");
149
+ return l(), p("div", K, [
150
+ s("div", Q, [
151
+ s("div", T, [
152
+ s("button", {
153
+ onClick: n[0] || (n[0] = (oe) => a.value = !a.value),
154
+ class: "w-[44px] h-[44px] p-[8px] flex items-center justify-center hover:text-secondary-content"
155
+ }, [
156
+ c(M(J), { class: "w-[24px] h-[24px]" })
157
+ ])
158
+ ]),
159
+ s("div", U, [
160
+ e.logoSrc != null ? (l(), p("img", {
161
+ key: 0,
162
+ src: e.logoSrc,
163
+ class: "w-8 h-8 mx-auto",
164
+ alt: "logo"
165
+ }, null, 8, W)) : d("", !0)
166
+ ]),
167
+ e.app != null ? (l(), u(q, {
168
+ key: 0,
169
+ to: "/",
170
+ class: "pl-2 max-w-xs"
171
+ }, {
172
+ default: j(() => [
173
+ s("div", X, m(e.app.name), 1),
174
+ s("div", Y, m(e.app.workspace), 1)
175
+ ]),
176
+ _: 1
177
+ })) : d("", !0),
178
+ s("div", Z, [
179
+ s("div", ee, [
180
+ s("div", te, [
181
+ c(F, {
182
+ workspace: t.value,
183
+ apps: ((f = e.app) == null ? void 0 : f.apps) || [],
184
+ "change-label": ((b = e.labels) == null ? void 0 : b.change) || "Change",
185
+ "apps-title": ((w = e.labels) == null ? void 0 : w.apps) || "Apps",
186
+ "on-app": (v = e.handlers) == null ? void 0 : v.onApp,
187
+ "on-change": (y = e.handlers) == null ? void 0 : y.onChange,
188
+ onOpen: (g = e.handlers) == null ? void 0 : g.onBrowse
189
+ }, null, 8, ["workspace", "apps", "change-label", "apps-title", "on-app", "on-change", "onOpen"]),
190
+ c(P, {
191
+ user: e.user,
192
+ "account-label": ((x = e.labels) == null ? void 0 : x.account) || "Account",
193
+ "logout-label": ((_ = e.labels) == null ? void 0 : _.logout) || "Logout",
194
+ "on-account": (k = e.handlers) == null ? void 0 : k.onAccount,
195
+ "on-logout": (S = e.handlers) == null ? void 0 : S.onLogout
196
+ }, null, 8, ["user", "account-label", "logout-label", "on-account", "on-logout"])
197
+ ])
198
+ ])
199
+ ])
200
+ ]),
201
+ s("div", {
202
+ class: i(["sidebar transition-all absolute top-[56px] left-0 h-full", [a.value ? "w-[60px]" : "w-60"]])
203
+ }, [
204
+ c(H, {
205
+ slim: a.value,
206
+ items: e.sidebarItems
207
+ }, null, 8, ["slim", "items"])
208
+ ], 2),
209
+ s("div", se, [
210
+ s("div", {
211
+ class: i(["content transition-all pt-[56px]", [a.value ? "pl-[60px]" : "pl-60"]])
212
+ }, [
213
+ R(e.$slots, "default")
214
+ ], 2)
215
+ ])
216
+ ]);
217
+ };
218
+ }
219
+ });
220
+ export {
221
+ re as OneMainLayout,
222
+ H as OneSidebar
223
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneb/ui-vue",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -41,6 +41,10 @@
41
41
  "types": "./dist/common/index.d.ts",
42
42
  "import": "./dist/common/index.js"
43
43
  },
44
+ "./layout": {
45
+ "types": "./dist/layout/index.d.ts",
46
+ "import": "./dist/layout/index.js"
47
+ },
44
48
  "./icons": {
45
49
  "types": "./dist/icons/outline/index.d.ts",
46
50
  "import": "./dist/icons/outline/esm/index.js",