@oneb/ui-vue 0.0.6 → 0.0.8
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/dropdown/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index-f88ecb85.cjs");require("vue");require("../_plugin-vue_export-helper-f246444f.cjs");exports.OneBrowserMenu=e._sfc_main$3;exports.OneDropdown=e._sfc_main;exports.OneDropdownDivider=e.OneDropdownDivider;exports.OneDropdownItem=e._sfc_main$1;exports.OneUserMenu=e._sfc_main$2;
|
package/dist/dropdown/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as x, ref as
|
|
2
|
-
import { _ as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as x, ref as z, provide as M, computed as g, openBlock as l, createElementBlock as u, renderSlot as A, normalizeProps as L, guardReactiveProps as O, createCommentVNode as m, createVNode as y, Transition as P, withCtx as v, normalizeClass as _, toDisplayString as h, inject as F, withModifiers as T, createBlock as k, resolveDynamicComponent as q, createElementVNode as t, normalizeStyle as w, unref as S, Fragment as j, renderList as B, mergeProps as N } from "vue";
|
|
2
|
+
import { _ as R } from "./_plugin-vue_export-helper-dad06003.js";
|
|
3
|
+
const V = {
|
|
4
4
|
title: {
|
|
5
5
|
type: String
|
|
6
6
|
},
|
|
@@ -8,7 +8,7 @@ const R = {
|
|
|
8
8
|
type: String,
|
|
9
9
|
default: "right"
|
|
10
10
|
}
|
|
11
|
-
},
|
|
11
|
+
}, E = {
|
|
12
12
|
variant: {
|
|
13
13
|
type: String,
|
|
14
14
|
default: "primary"
|
|
@@ -19,18 +19,18 @@ const R = {
|
|
|
19
19
|
icon: {
|
|
20
20
|
type: [Function, Object]
|
|
21
21
|
}
|
|
22
|
-
},
|
|
22
|
+
}, H = ["data-opened"], I = {
|
|
23
23
|
key: 0,
|
|
24
24
|
class: "text-sm text-secondary-content px-3 py-2 text-left"
|
|
25
|
-
},
|
|
25
|
+
}, D = /* @__PURE__ */ x({
|
|
26
26
|
__name: "OneDropdown",
|
|
27
|
-
props:
|
|
27
|
+
props: V,
|
|
28
28
|
emits: ["open"],
|
|
29
29
|
setup(p, { emit: n }) {
|
|
30
|
-
const d = p, c =
|
|
30
|
+
const d = p, c = z(!1), r = z(null), s = () => {
|
|
31
31
|
c.value = !c.value, c.value && n("open");
|
|
32
32
|
};
|
|
33
|
-
|
|
33
|
+
M("OneDropdown", {
|
|
34
34
|
onToggle: s
|
|
35
35
|
});
|
|
36
36
|
const e = g(() => {
|
|
@@ -50,13 +50,13 @@ const R = {
|
|
|
50
50
|
ref: r,
|
|
51
51
|
"data-opened": c.value
|
|
52
52
|
}, [
|
|
53
|
-
|
|
53
|
+
A(o.$slots, "button", L(O({ onToggle: s, isExpanded: c.value }))),
|
|
54
54
|
c.value ? (l(), u("div", {
|
|
55
55
|
key: 0,
|
|
56
56
|
class: "fixed top-0 left-0 w-screen h-screen z-10",
|
|
57
57
|
onClick: s
|
|
58
58
|
})) : m("", !0),
|
|
59
|
-
y(
|
|
59
|
+
y(P, {
|
|
60
60
|
"enter-active-class": "transition ease-out duration-100",
|
|
61
61
|
"enter-from-class": "transform opacity-0 scale-95",
|
|
62
62
|
"enter-to-class": "transform opacity-100 scale-100",
|
|
@@ -72,20 +72,20 @@ const R = {
|
|
|
72
72
|
"aria-orientation": "vertical",
|
|
73
73
|
tabindex: "-1"
|
|
74
74
|
}, [
|
|
75
|
-
o.title ? (l(), u("div",
|
|
76
|
-
|
|
75
|
+
o.title ? (l(), u("div", I, h(o.title), 1)) : m("", !0),
|
|
76
|
+
A(o.$slots, "menu", L(O({ onToggle: s })))
|
|
77
77
|
], 2)) : m("", !0)
|
|
78
78
|
]),
|
|
79
79
|
_: 3
|
|
80
80
|
})
|
|
81
|
-
], 8,
|
|
81
|
+
], 8, H));
|
|
82
82
|
}
|
|
83
|
-
}),
|
|
83
|
+
}), U = ["onClick"], $ = /* @__PURE__ */ x({
|
|
84
84
|
__name: "OneDropdownItem",
|
|
85
|
-
props:
|
|
85
|
+
props: E,
|
|
86
86
|
emits: ["click"],
|
|
87
87
|
setup(p, { emit: n }) {
|
|
88
|
-
const d = p, c =
|
|
88
|
+
const d = p, c = F("OneDropdown"), r = () => {
|
|
89
89
|
c !== void 0 && c.onToggle(), n("click");
|
|
90
90
|
}, s = g(() => {
|
|
91
91
|
const e = [];
|
|
@@ -93,20 +93,20 @@ const R = {
|
|
|
93
93
|
});
|
|
94
94
|
return (e, i) => (l(), u("button", {
|
|
95
95
|
class: _(["px-3 py-1.5 flex items-center space-x-3 w-full whitespace-nowrap", s.value]),
|
|
96
|
-
onClick:
|
|
96
|
+
onClick: T(r, ["prevent"])
|
|
97
97
|
}, [
|
|
98
|
-
e.icon ? (l(), k(
|
|
98
|
+
e.icon ? (l(), k(q(e.icon), {
|
|
99
99
|
key: 0,
|
|
100
100
|
class: "w-4 h-4"
|
|
101
101
|
})) : m("", !0),
|
|
102
|
-
t("span", null,
|
|
103
|
-
], 10,
|
|
102
|
+
t("span", null, h(e.label), 1)
|
|
103
|
+
], 10, U));
|
|
104
104
|
}
|
|
105
|
-
}),
|
|
106
|
-
function
|
|
107
|
-
return l(), u("div",
|
|
105
|
+
}), G = {}, J = { class: "border-t border-secondary-stroke my-1" };
|
|
106
|
+
function K(p, n) {
|
|
107
|
+
return l(), u("div", J);
|
|
108
108
|
}
|
|
109
|
-
const
|
|
109
|
+
const xe = /* @__PURE__ */ R(G, [["render", K]]), Q = {
|
|
110
110
|
size: {
|
|
111
111
|
type: [String, Number],
|
|
112
112
|
default: "50"
|
|
@@ -124,9 +124,9 @@ const ve = /* @__PURE__ */ N(U, [["render", J]]), K = {
|
|
|
124
124
|
type: [String, null],
|
|
125
125
|
required: !1
|
|
126
126
|
}
|
|
127
|
-
},
|
|
127
|
+
}, W = ["src"], b = /* @__PURE__ */ x({
|
|
128
128
|
__name: "OneAvatar",
|
|
129
|
-
props:
|
|
129
|
+
props: Q,
|
|
130
130
|
setup(p) {
|
|
131
131
|
const n = p, d = g(() => {
|
|
132
132
|
const e = n.text.trim().split(" ");
|
|
@@ -135,7 +135,7 @@ const ve = /* @__PURE__ */ N(U, [["render", J]]), K = {
|
|
|
135
135
|
fill: "rgba(255, 255, 255, .75)",
|
|
136
136
|
fontSize: `${Number(n.size) * 0.4}px`
|
|
137
137
|
})), r = g(() => {
|
|
138
|
-
const e = n.text.split("").map((a) => a.charCodeAt(0)).reduce((a,
|
|
138
|
+
const e = n.text.split("").map((a) => a.charCodeAt(0)).reduce((a, f) => a + f, 0), o = `hsl(${360 / 26 * e}, 68%, 48%)`;
|
|
139
139
|
return {
|
|
140
140
|
width: `${n.size}px`,
|
|
141
141
|
height: `${n.size}px`,
|
|
@@ -156,7 +156,7 @@ const ve = /* @__PURE__ */ N(U, [["render", J]]), K = {
|
|
|
156
156
|
src: e.src,
|
|
157
157
|
alt: "",
|
|
158
158
|
class: "w-full h-full"
|
|
159
|
-
}, null, 8,
|
|
159
|
+
}, null, 8, W)) : (l(), u("svg", {
|
|
160
160
|
key: 1,
|
|
161
161
|
style: w(r.value),
|
|
162
162
|
class: "block"
|
|
@@ -169,12 +169,12 @@ const ve = /* @__PURE__ */ N(U, [["render", J]]), K = {
|
|
|
169
169
|
"dominant-baseline": "central",
|
|
170
170
|
class: "font-light",
|
|
171
171
|
style: w(c.value)
|
|
172
|
-
},
|
|
172
|
+
}, h(d.value), 5)) : m("", !0)
|
|
173
173
|
], 4))
|
|
174
174
|
], 4));
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
|
-
function
|
|
177
|
+
function X(p, n) {
|
|
178
178
|
return l(), u("svg", {
|
|
179
179
|
xmlns: "http://www.w3.org/2000/svg",
|
|
180
180
|
fill: "none",
|
|
@@ -190,7 +190,7 @@ function W(p, n) {
|
|
|
190
190
|
})
|
|
191
191
|
]);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function Y(p, n) {
|
|
194
194
|
return l(), u("svg", {
|
|
195
195
|
xmlns: "http://www.w3.org/2000/svg",
|
|
196
196
|
fill: "none",
|
|
@@ -206,7 +206,7 @@ function X(p, n) {
|
|
|
206
206
|
})
|
|
207
207
|
]);
|
|
208
208
|
}
|
|
209
|
-
const
|
|
209
|
+
const Z = {
|
|
210
210
|
user: {
|
|
211
211
|
type: Object,
|
|
212
212
|
required: !0
|
|
@@ -233,7 +233,7 @@ const Y = {
|
|
|
233
233
|
onLogout: {
|
|
234
234
|
type: Function
|
|
235
235
|
}
|
|
236
|
-
},
|
|
236
|
+
}, ee = {
|
|
237
237
|
workspace: {
|
|
238
238
|
type: Object,
|
|
239
239
|
required: !0
|
|
@@ -244,7 +244,7 @@ const Y = {
|
|
|
244
244
|
},
|
|
245
245
|
iconSize: {
|
|
246
246
|
type: String,
|
|
247
|
-
default: "
|
|
247
|
+
default: "24"
|
|
248
248
|
},
|
|
249
249
|
appsTitle: {
|
|
250
250
|
type: String,
|
|
@@ -260,12 +260,12 @@ const Y = {
|
|
|
260
260
|
onApp: {
|
|
261
261
|
type: Function
|
|
262
262
|
}
|
|
263
|
-
},
|
|
263
|
+
}, te = ["onClick"], ne = {
|
|
264
264
|
class: "space-y-2 text-center py-6",
|
|
265
265
|
style: { width: "240px" }
|
|
266
|
-
},
|
|
266
|
+
}, oe = { class: "text-sm text-secondary-content" }, re = { class: "px-2" }, we = /* @__PURE__ */ x({
|
|
267
267
|
__name: "OneUserMenu",
|
|
268
|
-
props:
|
|
268
|
+
props: Z,
|
|
269
269
|
setup(p) {
|
|
270
270
|
const n = p, d = g(() => {
|
|
271
271
|
var s;
|
|
@@ -285,9 +285,9 @@ const Y = {
|
|
|
285
285
|
}, r = () => {
|
|
286
286
|
typeof n.onLogout == "function" && n.onLogout();
|
|
287
287
|
};
|
|
288
|
-
return (s, e) => (l(), k(
|
|
288
|
+
return (s, e) => (l(), k(D, { stick: "right" }, {
|
|
289
289
|
button: v(({ onToggle: i, isExpanded: o }) => {
|
|
290
|
-
var a,
|
|
290
|
+
var a, f;
|
|
291
291
|
return [
|
|
292
292
|
t("button", {
|
|
293
293
|
onClick: i,
|
|
@@ -296,43 +296,44 @@ const Y = {
|
|
|
296
296
|
y(b, {
|
|
297
297
|
text: ((a = s.user) == null ? void 0 : a.name) || "",
|
|
298
298
|
size: s.iconSize,
|
|
299
|
-
src: (
|
|
299
|
+
src: (f = s.user) == null ? void 0 : f.photo_url,
|
|
300
300
|
rounded: !0
|
|
301
301
|
}, null, 8, ["text", "size", "src"])
|
|
302
|
-
], 10,
|
|
302
|
+
], 10, te)
|
|
303
303
|
];
|
|
304
304
|
}),
|
|
305
305
|
menu: v(() => {
|
|
306
|
-
var i, o, a;
|
|
306
|
+
var i, o, a, f;
|
|
307
307
|
return [
|
|
308
|
-
t("div",
|
|
308
|
+
t("div", ne, [
|
|
309
309
|
t("div", null, [
|
|
310
310
|
y(b, {
|
|
311
311
|
text: ((i = s.user) == null ? void 0 : i.name) || "",
|
|
312
312
|
size: 80,
|
|
313
|
+
src: (o = s.user) == null ? void 0 : o.photo_url,
|
|
313
314
|
rounded: !0,
|
|
314
315
|
class: "mx-auto"
|
|
315
|
-
}, null, 8, ["text"])
|
|
316
|
+
}, null, 8, ["text", "src"])
|
|
316
317
|
]),
|
|
317
318
|
t("div", null, [
|
|
318
|
-
t("div", null,
|
|
319
|
-
t("div",
|
|
319
|
+
t("div", null, h((a = s.user) == null ? void 0 : a.name), 1),
|
|
320
|
+
t("div", oe, h((f = s.user) == null ? void 0 : f.email), 1)
|
|
320
321
|
])
|
|
321
322
|
]),
|
|
322
|
-
t("div",
|
|
323
|
-
y(
|
|
324
|
-
icon:
|
|
323
|
+
t("div", re, [
|
|
324
|
+
y($, {
|
|
325
|
+
icon: S(X),
|
|
325
326
|
label: s.accountLabel,
|
|
326
327
|
class: "rounded",
|
|
327
328
|
onClick: c
|
|
328
329
|
}, null, 8, ["icon", "label"]),
|
|
329
|
-
(l(!0), u(
|
|
330
|
-
key:
|
|
331
|
-
},
|
|
332
|
-
onClick:
|
|
330
|
+
(l(!0), u(j, null, B(d.value, (C) => (l(), k($, N({
|
|
331
|
+
key: C.key
|
|
332
|
+
}, C.args, {
|
|
333
|
+
onClick: C.click
|
|
333
334
|
}), null, 16, ["onClick"]))), 128)),
|
|
334
|
-
y(
|
|
335
|
-
icon:
|
|
335
|
+
y($, {
|
|
336
|
+
icon: S(Y),
|
|
336
337
|
label: s.logoutLabel,
|
|
337
338
|
class: "rounded",
|
|
338
339
|
onClick: r
|
|
@@ -344,7 +345,7 @@ const Y = {
|
|
|
344
345
|
}));
|
|
345
346
|
}
|
|
346
347
|
});
|
|
347
|
-
function
|
|
348
|
+
function se(p, n) {
|
|
348
349
|
return l(), u("svg", {
|
|
349
350
|
xmlns: "http://www.w3.org/2000/svg",
|
|
350
351
|
fill: "none",
|
|
@@ -436,35 +437,35 @@ function re(p, n) {
|
|
|
436
437
|
})
|
|
437
438
|
]);
|
|
438
439
|
}
|
|
439
|
-
const
|
|
440
|
+
const ie = ["onClick"], le = {
|
|
440
441
|
class: "space-x-2 flex items-center px-3 py-2",
|
|
441
442
|
style: { width: "300px" }
|
|
442
|
-
},
|
|
443
|
+
}, ce = { class: "flex-shrink-0" }, ae = { class: "w-full text-left" }, ue = { class: "flex-shrink-0" }, de = { class: "px-3 py-2 border-t border-secondary-stroke" }, pe = { class: "text-secondary-content text-left pb-1 text-sm" }, he = { class: "grid grid-cols-3 gap-1" }, fe = ["onClick"], ge = { class: "block bg-white mx-auto flex-shrink-0 border border-secondary-stroke p-1 rounded-lg" }, ye = { class: "w-full overflow-hidden text-ellipsis whitespace-nowrap text-center text-sm mt-1" }, ke = /* @__PURE__ */ x({
|
|
443
444
|
__name: "OneBrowserMenu",
|
|
444
|
-
props:
|
|
445
|
+
props: ee,
|
|
445
446
|
setup(p) {
|
|
446
447
|
const n = p, d = () => {
|
|
447
448
|
typeof n.onChange == "function" && n.onChange();
|
|
448
449
|
}, c = (r) => {
|
|
449
450
|
typeof n.onApp == "function" && n.onApp(r);
|
|
450
451
|
};
|
|
451
|
-
return (r, s) => (l(), k(
|
|
452
|
+
return (r, s) => (l(), k(D, { stick: "right" }, {
|
|
452
453
|
button: v(({ onToggle: e, isExpanded: i }) => [
|
|
453
454
|
t("button", {
|
|
454
455
|
onClick: e,
|
|
455
456
|
class: _(["p-1 rounded-md hover:bg-secondary-10", [i ? "bg-secondary-25" : ""]])
|
|
456
457
|
}, [
|
|
457
|
-
y(
|
|
458
|
+
y(S(se), {
|
|
458
459
|
class: "text-secondary-base",
|
|
459
460
|
style: w(`width: ${r.iconSize}px; height: ${r.iconSize}px`)
|
|
460
461
|
}, null, 8, ["style"])
|
|
461
|
-
], 10,
|
|
462
|
+
], 10, ie)
|
|
462
463
|
]),
|
|
463
464
|
menu: v(() => {
|
|
464
465
|
var e, i, o;
|
|
465
466
|
return [
|
|
466
|
-
t("div",
|
|
467
|
-
t("div",
|
|
467
|
+
t("div", le, [
|
|
468
|
+
t("div", ce, [
|
|
468
469
|
y(b, {
|
|
469
470
|
text: ((e = r.workspace) == null ? void 0 : e.name) || "",
|
|
470
471
|
src: (i = r.workspace) == null ? void 0 : i.photo_url,
|
|
@@ -473,24 +474,24 @@ const se = ["onClick"], ie = {
|
|
|
473
474
|
class: "mx-auto"
|
|
474
475
|
}, null, 8, ["text", "src"])
|
|
475
476
|
]),
|
|
476
|
-
t("div",
|
|
477
|
-
t("div",
|
|
477
|
+
t("div", ae, h((o = r.workspace) == null ? void 0 : o.name), 1),
|
|
478
|
+
t("div", ue, [
|
|
478
479
|
t("button", {
|
|
479
480
|
class: "text-sm border border-secondary-stroke rounded px-2 py-0.5 text-secondary-content hover:text-primary-content",
|
|
480
481
|
onClick: d
|
|
481
|
-
},
|
|
482
|
+
}, h(r.changeLabel), 1)
|
|
482
483
|
])
|
|
483
484
|
]),
|
|
484
|
-
t("div",
|
|
485
|
-
t("div",
|
|
486
|
-
t("div",
|
|
487
|
-
(l(!0), u(
|
|
485
|
+
t("div", de, [
|
|
486
|
+
t("div", pe, h(r.appsTitle), 1),
|
|
487
|
+
t("div", he, [
|
|
488
|
+
(l(!0), u(j, null, B(r.apps, (a) => (l(), u("button", {
|
|
488
489
|
key: a.id,
|
|
489
|
-
onClick: (
|
|
490
|
+
onClick: (f) => c(a),
|
|
490
491
|
class: "p-1.5 flex flex-col items-center justify-center rounded hover:bg-secondary-10",
|
|
491
492
|
style: { width: "88px", height: "88px" }
|
|
492
493
|
}, [
|
|
493
|
-
t("span",
|
|
494
|
+
t("span", ge, [
|
|
494
495
|
y(b, {
|
|
495
496
|
text: a.name,
|
|
496
497
|
src: a.photo_url,
|
|
@@ -498,8 +499,8 @@ const se = ["onClick"], ie = {
|
|
|
498
499
|
rounded: !1
|
|
499
500
|
}, null, 8, ["text", "src"])
|
|
500
501
|
]),
|
|
501
|
-
t("span",
|
|
502
|
-
], 8,
|
|
502
|
+
t("span", ye, h(a.name), 1)
|
|
503
|
+
], 8, fe))), 128))
|
|
503
504
|
])
|
|
504
505
|
])
|
|
505
506
|
];
|
|
@@ -509,10 +510,10 @@ const se = ["onClick"], ie = {
|
|
|
509
510
|
}
|
|
510
511
|
});
|
|
511
512
|
export {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
513
|
+
xe as O,
|
|
514
|
+
D as _,
|
|
515
|
+
$ as a,
|
|
516
|
+
we as b,
|
|
517
|
+
ke as c,
|
|
517
518
|
b as d
|
|
518
519
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),g=require("./_plugin-vue_export-helper-f246444f.cjs"),k={title:{type:String},stick:{type:String,default:"right"}},y={variant:{type:String,default:"primary"},label:{type:String},icon:{type:[Function,Object]}},v=["data-opened"],w={key:0,class:"text-sm text-secondary-content px-3 py-2 text-left"},f=e.defineComponent({__name:"OneDropdown",props:k,emits:["open"],setup(d,{emit:o}){const a=d,c=e.ref(!1),r=e.ref(null),l=()=>{c.value=!c.value,c.value&&o("open")};e.provide("OneDropdown",{onToggle:l});const t=e.computed(()=>{const n=r.value!=null&&r.value.offsetLeft<270;return r.value!=null&&r.value.offsetTop+270>window.innerHeight?"up"+(n?"-right":"-left"):"down"+(n?"-right":"-left")}),s=e.computed(()=>{const n=["absolute z-10 w-fit rounded-md bg-white","py-1 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none","overflow-auto max-h-[540px] min-w-[150px] max-w-[540px]"];return t.value==="up"?n.push("bottom-1 mb-10"):t.value==="down"?n.push("top-1 mt-10"):t.value==="up-right"?n.push("left-0 bottom-1 mb-10"):t.value==="down-right"&&n.push("left-0 top-1 mt-10"),a.stick==="right"?n.push("right-0"):a.stick==="left"&&n.push("left-0"),n});return(n,i)=>(e.openBlock(),e.createElementBlock("div",{class:"relative inline-block",ref_key:"menuRef",ref:r,"data-opened":c.value},[e.renderSlot(n.$slots,"button",e.normalizeProps(e.guardReactiveProps({onToggle:l,isExpanded:c.value}))),c.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed top-0 left-0 w-screen h-screen z-10",onClick:l})):e.createCommentVNode("",!0),e.createVNode(e.Transition,{"enter-active-class":"transition ease-out duration-100","enter-from-class":"transform opacity-0 scale-95","enter-to-class":"transform opacity-100 scale-100","leave-active-class":"transition ease-in duration-75","leave-from-class":"transform opacity-100 scale-100","leave-to-class":"transform opacity-0 scale-95"},{default:e.withCtx(()=>[c.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["menu",s.value]),role:"menu","aria-orientation":"vertical",tabindex:"-1"},[n.title?(e.openBlock(),e.createElementBlock("div",w,e.toDisplayString(n.title),1)):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"menu",e.normalizeProps(e.guardReactiveProps({onToggle:l})))],2)):e.createCommentVNode("",!0)]),_:3})],8,v))}}),x=["onClick"],m=e.defineComponent({__name:"OneDropdownItem",props:y,emits:["click"],setup(d,{emit:o}){const a=d,c=e.inject("OneDropdown"),r=()=>{c!==void 0&&c.onToggle(),o("click")},l=e.computed(()=>{const t=[];return a.variant==="secondary"?t.push("text-secondary-content hover:bg-secondary-body-hover"):a.variant==="danger"?t.push("text-danger-content hover:bg-danger-10"):a.variant==="warning"?t.push("text-warning-content hover:bg-warning-10"):a.variant==="info"?t.push("text-info-content hover:bg-info-10"):t.push("hover:bg-secondary-body-hover"),t});return(t,s)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["px-3 py-1.5 flex items-center space-x-3 w-full whitespace-nowrap",l.value]),onClick:e.withModifiers(r,["prevent"])},[t.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.icon),{key:0,class:"w-4 h-4"})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(t.label),1)],10,x))}}),_={},b={class:"border-t border-secondary-stroke my-1"};function C(d,o){return e.openBlock(),e.createElementBlock("div",b)}const E=g._export_sfc(_,[["render",C]]),V={size:{type:[String,Number],default:"50"},rounded:{type:Boolean,default:!1},text:{type:String,required:!1,default:""},src:{type:[String,null],required:!1}},B=["src"],p=e.defineComponent({__name:"OneAvatar",props:V,setup(d){const o=d,a=e.computed(()=>{const t=o.text.trim().split(" ");return t.length<2?o.text.slice(0,2).toUpperCase():t.map(s=>s.slice(0,1)).join("").toUpperCase()}),c=e.computed(()=>({fill:"rgba(255, 255, 255, .75)",fontSize:`${Number(o.size)*.4}px`})),r=e.computed(()=>{const t=o.text.split("").map(i=>i.charCodeAt(0)).reduce((i,u)=>i+u,0),n=`hsl(${360/26*t}, 68%, 48%)`;return{width:`${o.size}px`,height:`${o.size}px`,borderRadius:o.rounded?"100%":"9%",background:n}}),l=e.computed(()=>({width:`${o.size}px`,height:`${o.size}px`,borderRadius:o.rounded?"100%":"9%"}));return(t,s)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(l.value),class:"overflow-hidden"},[t.src?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.src,alt:"",class:"w-full h-full"},null,8,B)):(e.openBlock(),e.createElementBlock("svg",{key:1,style:e.normalizeStyle(r.value),class:"block"},[a.value?(e.openBlock(),e.createElementBlock("text",{key:0,x:"50%",y:"50%","text-anchor":"middle","dominant-baseline":"central",class:"font-light",style:e.normalizeStyle(c.value)},e.toDisplayString(a.value),5)):e.createCommentVNode("",!0)],4))],4))}});function N(d,o){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"})])}function S(d,o){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15m3 0l3-3m0 0l-3-3m3 3H9"})])}const z={user:{type:Object,required:!0},menu:{type:Array,default:()=>[]},iconSize:{type:String,default:"34"},accountLabel:{type:String,default:"Account"},logoutLabel:{type:String,default:"Logout"},onAccount:{type:Function},onLogout:{type:Function}},$={workspace:{type:Object,required:!0},apps:{type:Array,required:!0},iconSize:{type:String,default:"24"},appsTitle:{type:String,default:"Apps"},changeLabel:{type:String,default:"Change"},onChange:{type:Function},onApp:{type:Function}},D=["onClick"],A={class:"space-y-2 text-center py-6",style:{width:"240px"}},L={class:"text-sm text-secondary-content"},O={class:"px-2"},P=e.defineComponent({__name:"OneUserMenu",props:z,setup(d){const o=d,a=e.computed(()=>{var l;return(l=o.menu)==null?void 0:l.map(t=>{let s={label:t.label};t.icon!=null&&(s={...s,icon:t.icon});const n=typeof t.click=="function"?t.click:()=>{};return{key:t.label,args:s,click:n}})}),c=()=>{typeof o.onAccount=="function"&&o.onAccount()},r=()=>{typeof o.onLogout=="function"&&o.onLogout()};return(l,t)=>(e.openBlock(),e.createBlock(f,{stick:"right"},{button:e.withCtx(({onToggle:s,isExpanded:n})=>{var i,u;return[e.createElementVNode("button",{onClick:s,class:e.normalizeClass(["p-1 rounded-full hover:bg-secondary-10",[n?"bg-secondary-25":""]])},[e.createVNode(p,{text:((i=l.user)==null?void 0:i.name)||"",size:l.iconSize,src:(u=l.user)==null?void 0:u.photo_url,rounded:!0},null,8,["text","size","src"])],10,D)]}),menu:e.withCtx(()=>{var s,n,i,u;return[e.createElementVNode("div",A,[e.createElementVNode("div",null,[e.createVNode(p,{text:((s=l.user)==null?void 0:s.name)||"",size:80,src:(n=l.user)==null?void 0:n.photo_url,rounded:!0,class:"mx-auto"},null,8,["text","src"])]),e.createElementVNode("div",null,[e.createElementVNode("div",null,e.toDisplayString((i=l.user)==null?void 0:i.name),1),e.createElementVNode("div",L,e.toDisplayString((u=l.user)==null?void 0:u.email),1)])]),e.createElementVNode("div",O,[e.createVNode(m,{icon:e.unref(N),label:l.accountLabel,class:"rounded",onClick:c},null,8,["icon","label"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,h=>(e.openBlock(),e.createBlock(m,e.mergeProps({key:h.key},h.args,{onClick:h.click}),null,16,["onClick"]))),128)),e.createVNode(m,{icon:e.unref(S),label:l.logoutLabel,class:"rounded",onClick:r},null,8,["icon","label"])])]}),_:1}))}});function j(d,o){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"17.16",y:"3.9",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"10.53",y:"3.9",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"3.9",y:"3.9",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"17.16",y:"10.53",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"10.53",y:"10.53",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"3.9",y:"10.53",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"17.16",y:"17.16",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"10.53",y:"17.16",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"3.9",y:"17.16",fill:"currentColor","stroke-width":"1.8",rx:"1.1"})])}const M=["onClick"],q={class:"space-x-2 flex items-center px-3 py-2",style:{width:"300px"}},F={class:"flex-shrink-0"},R={class:"w-full text-left"},T={class:"flex-shrink-0"},H={class:"px-3 py-2 border-t border-secondary-stroke"},I={class:"text-secondary-content text-left pb-1 text-sm"},U={class:"grid grid-cols-3 gap-1"},G=["onClick"],J={class:"block bg-white mx-auto flex-shrink-0 border border-secondary-stroke p-1 rounded-lg"},K={class:"w-full overflow-hidden text-ellipsis whitespace-nowrap text-center text-sm mt-1"},Q=e.defineComponent({__name:"OneBrowserMenu",props:$,setup(d){const o=d,a=()=>{typeof o.onChange=="function"&&o.onChange()},c=r=>{typeof o.onApp=="function"&&o.onApp(r)};return(r,l)=>(e.openBlock(),e.createBlock(f,{stick:"right"},{button:e.withCtx(({onToggle:t,isExpanded:s})=>[e.createElementVNode("button",{onClick:t,class:e.normalizeClass(["p-1 rounded-md hover:bg-secondary-10",[s?"bg-secondary-25":""]])},[e.createVNode(e.unref(j),{class:"text-secondary-base",style:e.normalizeStyle(`width: ${r.iconSize}px; height: ${r.iconSize}px`)},null,8,["style"])],10,M)]),menu:e.withCtx(()=>{var t,s,n;return[e.createElementVNode("div",q,[e.createElementVNode("div",F,[e.createVNode(p,{text:((t=r.workspace)==null?void 0:t.name)||"",src:(s=r.workspace)==null?void 0:s.photo_url,size:44,rounded:!1,class:"mx-auto"},null,8,["text","src"])]),e.createElementVNode("div",R,e.toDisplayString((n=r.workspace)==null?void 0:n.name),1),e.createElementVNode("div",T,[e.createElementVNode("button",{class:"text-sm border border-secondary-stroke rounded px-2 py-0.5 text-secondary-content hover:text-primary-content",onClick:a},e.toDisplayString(r.changeLabel),1)])]),e.createElementVNode("div",H,[e.createElementVNode("div",I,e.toDisplayString(r.appsTitle),1),e.createElementVNode("div",U,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.apps,i=>(e.openBlock(),e.createElementBlock("button",{key:i.id,onClick:u=>c(i),class:"p-1.5 flex flex-col items-center justify-center rounded hover:bg-secondary-10",style:{width:"88px",height:"88px"}},[e.createElementVNode("span",J,[e.createVNode(p,{text:i.name,src:i.photo_url,size:44,rounded:!1},null,8,["text","src"])]),e.createElementVNode("span",K,e.toDisplayString(i.name),1)],8,G))),128))])])]}),_:1}))}});exports.OneDropdownDivider=E;exports._sfc_main=f;exports._sfc_main$1=m;exports._sfc_main$2=P;exports._sfc_main$3=Q;exports._sfc_main$4=p;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./button/index.cjs"),n=require("./card/index.cjs"),r=require("./form/index.cjs"),e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./button/index.cjs"),n=require("./card/index.cjs"),r=require("./form/index.cjs"),e=require("./index-f88ecb85.cjs");require("vue");require("./_plugin-vue_export-helper-f246444f.cjs");exports.OneButton=o.OneButton;exports.OneCard=n.OneCard;exports.OneCardBody=n.OneCardBody;exports.OneCardFooter=n.OneCardFooter;exports.OneCardHeader=n.OneCardHeader;exports.OneForm=r.OneForm;exports.OneFormFeedback=r.OneFormFeedback;exports.OneFormField=r.OneFormField;exports.OneFormInput=r.OneFormInput;exports.OneFormLabel=r.OneFormLabel;exports.OneAvatar=e._sfc_main$4;exports.OneBrowserMenu=e._sfc_main$3;exports.OneDropdown=e._sfc_main;exports.OneDropdownDivider=e.OneDropdownDivider;exports.OneDropdownItem=e._sfc_main$1;exports.OneUserMenu=e._sfc_main$2;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OneButton as O } from "./button/index.js";
|
|
2
2
|
import { OneCard as d, OneCardBody as m, OneCardFooter as t, OneCardHeader as p } from "./card/index.js";
|
|
3
3
|
import { OneForm as F, OneFormFeedback as i, OneFormField as f, OneFormInput as u, OneFormLabel as w } from "./form/index.js";
|
|
4
|
-
import { d as C, c as D, _ as b, O as B, a as c, b as l } from "./index-
|
|
4
|
+
import { d as C, c as D, _ as b, O as B, a as c, b as l } from "./index-8ee43fa4.js";
|
|
5
5
|
import "vue";
|
|
6
6
|
import "./_plugin-vue_export-helper-dad06003.js";
|
|
7
7
|
export {
|
package/package.json
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneb/ui-vue",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
8
8
|
],
|
|
9
9
|
"module": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
10
11
|
"exports": {
|
|
11
12
|
".": {
|
|
12
|
-
"import": "./dist/index.js"
|
|
13
|
-
|
|
14
|
-
"./style.css": {
|
|
15
|
-
"default": "./dist/style.css"
|
|
16
|
-
},
|
|
17
|
-
"./package.json": {
|
|
18
|
-
"default": "./package.json"
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts"
|
|
19
15
|
},
|
|
16
|
+
"./package.json": "./package.json",
|
|
17
|
+
"./style.css": "./dist/style.css",
|
|
18
|
+
"./dist/style.css": "./dist/style.css",
|
|
20
19
|
"./tailwind.config": {
|
|
21
20
|
"types": "./dist/tailwind.config.d.ts",
|
|
22
21
|
"import": "./dist/tailwind.config.js",
|
|
@@ -49,7 +48,7 @@
|
|
|
49
48
|
"require": "./dist/icons/outline/*.js"
|
|
50
49
|
},
|
|
51
50
|
"./icons/outline": {
|
|
52
|
-
"types": "./dist/icons/outline/index.d.ts",
|
|
51
|
+
"types": "./dist/icons/outline/esm/index.d.ts",
|
|
53
52
|
"import": "./dist/icons/outline/esm/index.js",
|
|
54
53
|
"require": "./dist/icons/outline/index.js"
|
|
55
54
|
},
|
|
@@ -59,7 +58,6 @@
|
|
|
59
58
|
"require": "./dist/icons/outline/*.js"
|
|
60
59
|
}
|
|
61
60
|
},
|
|
62
|
-
"types": "./dist/index.d.ts",
|
|
63
61
|
"scripts": {
|
|
64
62
|
"build": "run-p type-check build-only",
|
|
65
63
|
"type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
|
package/dist/index-3196cf32.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),f=require("./_plugin-vue_export-helper-f246444f.cjs"),g={title:{type:String},stick:{type:String,default:"right"}},k={variant:{type:String,default:"primary"},label:{type:String},icon:{type:[Function,Object]}},y=["data-opened"],v={key:0,class:"text-sm text-secondary-content px-3 py-2 text-left"},h=e.defineComponent({__name:"OneDropdown",props:g,emits:["open"],setup(d,{emit:o}){const a=d,c=e.ref(!1),r=e.ref(null),l=()=>{c.value=!c.value,c.value&&o("open")};e.provide("OneDropdown",{onToggle:l});const t=e.computed(()=>{const n=r.value!=null&&r.value.offsetLeft<270;return r.value!=null&&r.value.offsetTop+270>window.innerHeight?"up"+(n?"-right":"-left"):"down"+(n?"-right":"-left")}),s=e.computed(()=>{const n=["absolute z-10 w-fit rounded-md bg-white","py-1 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none","overflow-auto max-h-[540px] min-w-[150px] max-w-[540px]"];return t.value==="up"?n.push("bottom-1 mb-10"):t.value==="down"?n.push("top-1 mt-10"):t.value==="up-right"?n.push("left-0 bottom-1 mb-10"):t.value==="down-right"&&n.push("left-0 top-1 mt-10"),a.stick==="right"?n.push("right-0"):a.stick==="left"&&n.push("left-0"),n});return(n,i)=>(e.openBlock(),e.createElementBlock("div",{class:"relative inline-block",ref_key:"menuRef",ref:r,"data-opened":c.value},[e.renderSlot(n.$slots,"button",e.normalizeProps(e.guardReactiveProps({onToggle:l,isExpanded:c.value}))),c.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed top-0 left-0 w-screen h-screen z-10",onClick:l})):e.createCommentVNode("",!0),e.createVNode(e.Transition,{"enter-active-class":"transition ease-out duration-100","enter-from-class":"transform opacity-0 scale-95","enter-to-class":"transform opacity-100 scale-100","leave-active-class":"transition ease-in duration-75","leave-from-class":"transform opacity-100 scale-100","leave-to-class":"transform opacity-0 scale-95"},{default:e.withCtx(()=>[c.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["menu",s.value]),role:"menu","aria-orientation":"vertical",tabindex:"-1"},[n.title?(e.openBlock(),e.createElementBlock("div",v,e.toDisplayString(n.title),1)):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"menu",e.normalizeProps(e.guardReactiveProps({onToggle:l})))],2)):e.createCommentVNode("",!0)]),_:3})],8,y))}}),x=["onClick"],m=e.defineComponent({__name:"OneDropdownItem",props:k,emits:["click"],setup(d,{emit:o}){const a=d,c=e.inject("OneDropdown"),r=()=>{c!==void 0&&c.onToggle(),o("click")},l=e.computed(()=>{const t=[];return a.variant==="secondary"?t.push("text-secondary-content hover:bg-secondary-body-hover"):a.variant==="danger"?t.push("text-danger-content hover:bg-danger-10"):a.variant==="warning"?t.push("text-warning-content hover:bg-warning-10"):a.variant==="info"?t.push("text-info-content hover:bg-info-10"):t.push("hover:bg-secondary-body-hover"),t});return(t,s)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["px-3 py-1.5 flex items-center space-x-3 w-full whitespace-nowrap",l.value]),onClick:e.withModifiers(r,["prevent"])},[t.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.icon),{key:0,class:"w-4 h-4"})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(t.label),1)],10,x))}}),w={},_={class:"border-t border-secondary-stroke my-1"};function b(d,o){return e.openBlock(),e.createElementBlock("div",_)}const C=f._export_sfc(w,[["render",b]]),E={size:{type:[String,Number],default:"50"},rounded:{type:Boolean,default:!1},text:{type:String,required:!1,default:""},src:{type:[String,null],required:!1}},V=["src"],p=e.defineComponent({__name:"OneAvatar",props:E,setup(d){const o=d,a=e.computed(()=>{const t=o.text.trim().split(" ");return t.length<2?o.text.slice(0,2).toUpperCase():t.map(s=>s.slice(0,1)).join("").toUpperCase()}),c=e.computed(()=>({fill:"rgba(255, 255, 255, .75)",fontSize:`${Number(o.size)*.4}px`})),r=e.computed(()=>{const t=o.text.split("").map(i=>i.charCodeAt(0)).reduce((i,u)=>i+u,0),n=`hsl(${360/26*t}, 68%, 48%)`;return{width:`${o.size}px`,height:`${o.size}px`,borderRadius:o.rounded?"100%":"9%",background:n}}),l=e.computed(()=>({width:`${o.size}px`,height:`${o.size}px`,borderRadius:o.rounded?"100%":"9%"}));return(t,s)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(l.value),class:"overflow-hidden"},[t.src?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.src,alt:"",class:"w-full h-full"},null,8,V)):(e.openBlock(),e.createElementBlock("svg",{key:1,style:e.normalizeStyle(r.value),class:"block"},[a.value?(e.openBlock(),e.createElementBlock("text",{key:0,x:"50%",y:"50%","text-anchor":"middle","dominant-baseline":"central",class:"font-light",style:e.normalizeStyle(c.value)},e.toDisplayString(a.value),5)):e.createCommentVNode("",!0)],4))],4))}});function B(d,o){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"})])}function N(d,o){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15m3 0l3-3m0 0l-3-3m3 3H9"})])}const S={user:{type:Object,required:!0},menu:{type:Array,default:()=>[]},iconSize:{type:String,default:"34"},accountLabel:{type:String,default:"Account"},logoutLabel:{type:String,default:"Logout"},onAccount:{type:Function},onLogout:{type:Function}},z={workspace:{type:Object,required:!0},apps:{type:Array,required:!0},iconSize:{type:String,default:"18"},appsTitle:{type:String,default:"Apps"},changeLabel:{type:String,default:"Change"},onChange:{type:Function},onApp:{type:Function}},$=["onClick"],D={class:"space-y-2 text-center py-6",style:{width:"240px"}},A={class:"text-sm text-secondary-content"},L={class:"px-2"},O=e.defineComponent({__name:"OneUserMenu",props:S,setup(d){const o=d,a=e.computed(()=>{var l;return(l=o.menu)==null?void 0:l.map(t=>{let s={label:t.label};t.icon!=null&&(s={...s,icon:t.icon});const n=typeof t.click=="function"?t.click:()=>{};return{key:t.label,args:s,click:n}})}),c=()=>{typeof o.onAccount=="function"&&o.onAccount()},r=()=>{typeof o.onLogout=="function"&&o.onLogout()};return(l,t)=>(e.openBlock(),e.createBlock(h,{stick:"right"},{button:e.withCtx(({onToggle:s,isExpanded:n})=>{var i,u;return[e.createElementVNode("button",{onClick:s,class:e.normalizeClass(["p-1 rounded-full hover:bg-secondary-10",[n?"bg-secondary-25":""]])},[e.createVNode(p,{text:((i=l.user)==null?void 0:i.name)||"",size:l.iconSize,src:(u=l.user)==null?void 0:u.photo_url,rounded:!0},null,8,["text","size","src"])],10,$)]}),menu:e.withCtx(()=>{var s,n,i;return[e.createElementVNode("div",D,[e.createElementVNode("div",null,[e.createVNode(p,{text:((s=l.user)==null?void 0:s.name)||"",size:80,rounded:!0,class:"mx-auto"},null,8,["text"])]),e.createElementVNode("div",null,[e.createElementVNode("div",null,e.toDisplayString((n=l.user)==null?void 0:n.name),1),e.createElementVNode("div",A,e.toDisplayString((i=l.user)==null?void 0:i.email),1)])]),e.createElementVNode("div",L,[e.createVNode(m,{icon:e.unref(B),label:l.accountLabel,class:"rounded",onClick:c},null,8,["icon","label"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,u=>(e.openBlock(),e.createBlock(m,e.mergeProps({key:u.key},u.args,{onClick:u.click}),null,16,["onClick"]))),128)),e.createVNode(m,{icon:e.unref(N),label:l.logoutLabel,class:"rounded",onClick:r},null,8,["icon","label"])])]}),_:1}))}});function P(d,o){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"17.16",y:"3.9",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"10.53",y:"3.9",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"3.9",y:"3.9",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"17.16",y:"10.53",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"10.53",y:"10.53",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"3.9",y:"10.53",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"17.16",y:"17.16",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"10.53",y:"17.16",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"3.9",y:"17.16",fill:"currentColor","stroke-width":"1.8",rx:"1.1"})])}const j=["onClick"],M={class:"space-x-2 flex items-center px-3 py-2",style:{width:"300px"}},q={class:"flex-shrink-0"},F={class:"w-full text-left"},R={class:"flex-shrink-0"},T={class:"px-3 py-2 border-t border-secondary-stroke"},H={class:"text-secondary-content text-left pb-1 text-sm"},I={class:"grid grid-cols-3 gap-1"},U=["onClick"],G={class:"block bg-white mx-auto flex-shrink-0 border border-secondary-stroke p-1 rounded-lg"},J={class:"w-full overflow-hidden text-ellipsis whitespace-nowrap text-center text-sm mt-1"},K=e.defineComponent({__name:"OneBrowserMenu",props:z,setup(d){const o=d,a=()=>{typeof o.onChange=="function"&&o.onChange()},c=r=>{typeof o.onApp=="function"&&o.onApp(r)};return(r,l)=>(e.openBlock(),e.createBlock(h,{stick:"right"},{button:e.withCtx(({onToggle:t,isExpanded:s})=>[e.createElementVNode("button",{onClick:t,class:e.normalizeClass(["p-1 rounded-md hover:bg-secondary-10",[s?"bg-secondary-25":""]])},[e.createVNode(e.unref(P),{class:"text-secondary-base",style:e.normalizeStyle(`width: ${r.iconSize}px; height: ${r.iconSize}px`)},null,8,["style"])],10,j)]),menu:e.withCtx(()=>{var t,s,n;return[e.createElementVNode("div",M,[e.createElementVNode("div",q,[e.createVNode(p,{text:((t=r.workspace)==null?void 0:t.name)||"",src:(s=r.workspace)==null?void 0:s.photo_url,size:44,rounded:!1,class:"mx-auto"},null,8,["text","src"])]),e.createElementVNode("div",F,e.toDisplayString((n=r.workspace)==null?void 0:n.name),1),e.createElementVNode("div",R,[e.createElementVNode("button",{class:"text-sm border border-secondary-stroke rounded px-2 py-0.5 text-secondary-content hover:text-primary-content",onClick:a},e.toDisplayString(r.changeLabel),1)])]),e.createElementVNode("div",T,[e.createElementVNode("div",H,e.toDisplayString(r.appsTitle),1),e.createElementVNode("div",I,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.apps,i=>(e.openBlock(),e.createElementBlock("button",{key:i.id,onClick:u=>c(i),class:"p-1.5 flex flex-col items-center justify-center rounded hover:bg-secondary-10",style:{width:"88px",height:"88px"}},[e.createElementVNode("span",G,[e.createVNode(p,{text:i.name,src:i.photo_url,size:44,rounded:!1},null,8,["text","src"])]),e.createElementVNode("span",J,e.toDisplayString(i.name),1)],8,U))),128))])])]}),_:1}))}});exports.OneDropdownDivider=C;exports._sfc_main=h;exports._sfc_main$1=m;exports._sfc_main$2=O;exports._sfc_main$3=K;exports._sfc_main$4=p;
|