@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.
- package/dist/OneBrowserMenu.vue_vue_type_script_setup_true_lang-197489be.js +446 -0
- package/dist/OneBrowserMenu.vue_vue_type_script_setup_true_lang-24874222.cjs +1 -0
- package/dist/button/button.d.ts +1 -1
- package/dist/button/index.cjs +1 -1
- package/dist/button/index.js +2 -2
- package/dist/common/avatar.d.ts +0 -1
- package/dist/common/index.cjs +1 -1
- package/dist/common/index.js +24 -17
- package/dist/dropdown/dropdown.d.ts +1 -1
- package/dist/dropdown/index.cjs +1 -1
- package/dist/dropdown/index.js +13 -449
- package/dist/form/form.d.ts +4 -0
- package/dist/form/index.cjs +1 -1
- package/dist/form/index.js +148 -138
- package/dist/index.cjs +1 -1
- package/dist/index.js +16 -15
- package/dist/layout/index.cjs +1 -0
- package/dist/layout/index.d.ts +2 -0
- package/dist/layout/index.js +223 -0
- package/package.json +5 -1
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import { defineComponent as x, ref as $, provide as B, computed as w, openBlock as l, createElementBlock as d, renderSlot as z, normalizeProps as A, guardReactiveProps as L, createCommentVNode as m, createVNode as h, Transition as P, withCtx as y, normalizeClass as b, toDisplayString as f, inject as D, withModifiers as F, createBlock as v, resolveDynamicComponent as T, createElementVNode as e, unref as S, Fragment as O, renderList as M, mergeProps as V, normalizeStyle as E } from "vue";
|
|
2
|
+
import { OneAvatar as k } from "./common/index.js";
|
|
3
|
+
const q = {
|
|
4
|
+
title: {
|
|
5
|
+
type: String
|
|
6
|
+
},
|
|
7
|
+
stick: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: "right"
|
|
10
|
+
}
|
|
11
|
+
}, H = {
|
|
12
|
+
variant: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: "primary"
|
|
15
|
+
},
|
|
16
|
+
label: {
|
|
17
|
+
type: String
|
|
18
|
+
},
|
|
19
|
+
icon: {
|
|
20
|
+
type: [Function, Object]
|
|
21
|
+
}
|
|
22
|
+
}, I = ["data-opened"], N = {
|
|
23
|
+
key: 0,
|
|
24
|
+
class: "text-sm text-secondary-content px-3 py-2 text-left"
|
|
25
|
+
}, j = /* @__PURE__ */ x({
|
|
26
|
+
__name: "OneDropdown",
|
|
27
|
+
props: q,
|
|
28
|
+
emits: ["open", "close"],
|
|
29
|
+
setup(p, { emit: s }) {
|
|
30
|
+
const u = p, c = $(!1), n = $(null), r = () => {
|
|
31
|
+
c.value = !c.value, c.value ? s("open") : s("close");
|
|
32
|
+
};
|
|
33
|
+
B("OneDropdown", {
|
|
34
|
+
onToggle: r
|
|
35
|
+
});
|
|
36
|
+
const t = w(() => {
|
|
37
|
+
const o = n.value != null && n.value.offsetLeft < 270;
|
|
38
|
+
return n.value != null && n.value.offsetTop + 270 > window.innerHeight ? "up" + (o ? "-right" : "-left") : "down" + (o ? "-right" : "-left");
|
|
39
|
+
}), i = w(() => {
|
|
40
|
+
const o = [
|
|
41
|
+
"absolute z-10 w-fit rounded-md bg-white",
|
|
42
|
+
"py-1 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",
|
|
43
|
+
"overflow-auto max-h-[540px] min-w-[150px] max-w-[540px]"
|
|
44
|
+
];
|
|
45
|
+
return t.value === "up" ? o.push("bottom-1 mb-10") : t.value === "down" ? o.push("top-1 mt-10") : t.value === "up-right" ? o.push("left-0 bottom-1 mb-10") : t.value === "down-right" && o.push("left-0 top-1 mt-10"), u.stick === "right" ? o.push("right-0") : u.stick === "left" && o.push("left-0"), o;
|
|
46
|
+
});
|
|
47
|
+
return (o, a) => (l(), d("div", {
|
|
48
|
+
class: "relative inline-block",
|
|
49
|
+
ref_key: "menuRef",
|
|
50
|
+
ref: n,
|
|
51
|
+
"data-opened": c.value
|
|
52
|
+
}, [
|
|
53
|
+
z(o.$slots, "button", A(L({ onToggle: r, isExpanded: c.value }))),
|
|
54
|
+
c.value ? (l(), d("div", {
|
|
55
|
+
key: 0,
|
|
56
|
+
class: "fixed top-0 left-0 w-screen h-screen z-10",
|
|
57
|
+
onClick: r
|
|
58
|
+
})) : m("", !0),
|
|
59
|
+
h(P, {
|
|
60
|
+
"enter-active-class": "transition ease-out duration-100",
|
|
61
|
+
"enter-from-class": "transform opacity-0 scale-95",
|
|
62
|
+
"enter-to-class": "transform opacity-100 scale-100",
|
|
63
|
+
"leave-active-class": "transition ease-in duration-75",
|
|
64
|
+
"leave-from-class": "transform opacity-100 scale-100",
|
|
65
|
+
"leave-to-class": "transform opacity-0 scale-95"
|
|
66
|
+
}, {
|
|
67
|
+
default: y(() => [
|
|
68
|
+
c.value ? (l(), d("div", {
|
|
69
|
+
key: 0,
|
|
70
|
+
class: b(["menu", i.value]),
|
|
71
|
+
role: "menu",
|
|
72
|
+
"aria-orientation": "vertical",
|
|
73
|
+
tabindex: "-1"
|
|
74
|
+
}, [
|
|
75
|
+
o.title ? (l(), d("div", N, f(o.title), 1)) : m("", !0),
|
|
76
|
+
z(o.$slots, "menu", A(L({ onToggle: r })))
|
|
77
|
+
], 2)) : m("", !0)
|
|
78
|
+
]),
|
|
79
|
+
_: 3
|
|
80
|
+
})
|
|
81
|
+
], 8, I));
|
|
82
|
+
}
|
|
83
|
+
}), R = ["onClick"], C = /* @__PURE__ */ x({
|
|
84
|
+
__name: "OneDropdownItem",
|
|
85
|
+
props: H,
|
|
86
|
+
emits: ["click"],
|
|
87
|
+
setup(p, { emit: s }) {
|
|
88
|
+
const u = p, c = D("OneDropdown"), n = () => {
|
|
89
|
+
c !== void 0 && c.onToggle(), s("click");
|
|
90
|
+
}, r = w(() => {
|
|
91
|
+
const t = [];
|
|
92
|
+
return u.variant === "secondary" ? t.push("text-secondary-content hover:bg-secondary-body-hover") : u.variant === "danger" ? t.push("text-danger-content hover:bg-danger-10") : u.variant === "warning" ? t.push("text-warning-content hover:bg-warning-10") : u.variant === "info" ? t.push("text-info-content hover:bg-info-10") : t.push("hover:bg-secondary-body-hover"), t;
|
|
93
|
+
});
|
|
94
|
+
return (t, i) => (l(), d("button", {
|
|
95
|
+
class: b(["px-3 py-1.5 flex items-center space-x-3 w-full whitespace-nowrap", r.value]),
|
|
96
|
+
onClick: F(n, ["prevent"])
|
|
97
|
+
}, [
|
|
98
|
+
t.icon ? (l(), v(T(t.icon), {
|
|
99
|
+
key: 0,
|
|
100
|
+
class: "w-4 h-4"
|
|
101
|
+
})) : m("", !0),
|
|
102
|
+
e("span", null, f(t.label), 1)
|
|
103
|
+
], 10, R));
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
function U(p, s) {
|
|
107
|
+
return l(), d("svg", {
|
|
108
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
109
|
+
fill: "none",
|
|
110
|
+
viewBox: "0 0 24 24",
|
|
111
|
+
"stroke-width": "1.8",
|
|
112
|
+
stroke: "currentColor",
|
|
113
|
+
"aria-hidden": "true"
|
|
114
|
+
}, [
|
|
115
|
+
e("path", {
|
|
116
|
+
"stroke-linecap": "round",
|
|
117
|
+
"stroke-linejoin": "round",
|
|
118
|
+
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"
|
|
119
|
+
})
|
|
120
|
+
]);
|
|
121
|
+
}
|
|
122
|
+
function G(p, s) {
|
|
123
|
+
return l(), d("svg", {
|
|
124
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
125
|
+
fill: "none",
|
|
126
|
+
viewBox: "0 0 24 24",
|
|
127
|
+
"stroke-width": "1.8",
|
|
128
|
+
stroke: "currentColor",
|
|
129
|
+
"aria-hidden": "true"
|
|
130
|
+
}, [
|
|
131
|
+
e("path", {
|
|
132
|
+
"stroke-linecap": "round",
|
|
133
|
+
"stroke-linejoin": "round",
|
|
134
|
+
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"
|
|
135
|
+
})
|
|
136
|
+
]);
|
|
137
|
+
}
|
|
138
|
+
const J = {
|
|
139
|
+
user: {
|
|
140
|
+
type: Object,
|
|
141
|
+
required: !0
|
|
142
|
+
},
|
|
143
|
+
menu: {
|
|
144
|
+
type: Array,
|
|
145
|
+
default: () => []
|
|
146
|
+
},
|
|
147
|
+
iconSize: {
|
|
148
|
+
type: String,
|
|
149
|
+
default: "34"
|
|
150
|
+
},
|
|
151
|
+
accountLabel: {
|
|
152
|
+
type: String,
|
|
153
|
+
default: "Account"
|
|
154
|
+
},
|
|
155
|
+
logoutLabel: {
|
|
156
|
+
type: String,
|
|
157
|
+
default: "Logout"
|
|
158
|
+
},
|
|
159
|
+
onAccount: {
|
|
160
|
+
type: Function
|
|
161
|
+
},
|
|
162
|
+
onLogout: {
|
|
163
|
+
type: Function
|
|
164
|
+
}
|
|
165
|
+
}, K = {
|
|
166
|
+
workspace: {
|
|
167
|
+
type: Object,
|
|
168
|
+
required: !0
|
|
169
|
+
},
|
|
170
|
+
apps: {
|
|
171
|
+
type: Array,
|
|
172
|
+
required: !0
|
|
173
|
+
},
|
|
174
|
+
iconSize: {
|
|
175
|
+
type: String,
|
|
176
|
+
default: "24"
|
|
177
|
+
},
|
|
178
|
+
appsTitle: {
|
|
179
|
+
type: String,
|
|
180
|
+
default: "Apps"
|
|
181
|
+
},
|
|
182
|
+
changeLabel: {
|
|
183
|
+
type: String,
|
|
184
|
+
default: "Change"
|
|
185
|
+
},
|
|
186
|
+
onChange: {
|
|
187
|
+
type: Function
|
|
188
|
+
},
|
|
189
|
+
onApp: {
|
|
190
|
+
type: Function
|
|
191
|
+
}
|
|
192
|
+
}, Q = ["onClick"], W = {
|
|
193
|
+
class: "space-y-2 text-center py-6",
|
|
194
|
+
style: { width: "240px" }
|
|
195
|
+
}, X = { class: "text-sm text-secondary-content" }, Y = { class: "px-2" }, he = /* @__PURE__ */ x({
|
|
196
|
+
__name: "OneUserMenu",
|
|
197
|
+
props: J,
|
|
198
|
+
setup(p) {
|
|
199
|
+
const s = p, u = w(() => {
|
|
200
|
+
var r;
|
|
201
|
+
return (r = s.menu) == null ? void 0 : r.map((t) => {
|
|
202
|
+
let i = { label: t.label };
|
|
203
|
+
t.icon != null && (i = { ...i, icon: t.icon });
|
|
204
|
+
const o = typeof t.click == "function" ? t.click : () => {
|
|
205
|
+
};
|
|
206
|
+
return {
|
|
207
|
+
key: t.label,
|
|
208
|
+
args: i,
|
|
209
|
+
click: o
|
|
210
|
+
};
|
|
211
|
+
});
|
|
212
|
+
}), c = () => {
|
|
213
|
+
typeof s.onAccount == "function" && s.onAccount();
|
|
214
|
+
}, n = () => {
|
|
215
|
+
typeof s.onLogout == "function" && s.onLogout();
|
|
216
|
+
};
|
|
217
|
+
return (r, t) => (l(), v(j, { stick: "right" }, {
|
|
218
|
+
button: y(({ onToggle: i, isExpanded: o }) => {
|
|
219
|
+
var a, g;
|
|
220
|
+
return [
|
|
221
|
+
e("button", {
|
|
222
|
+
onClick: i,
|
|
223
|
+
class: b(["p-1 rounded-full hover:bg-secondary-10", [o ? "bg-secondary-25" : ""]])
|
|
224
|
+
}, [
|
|
225
|
+
h(k, {
|
|
226
|
+
text: ((a = r.user) == null ? void 0 : a.name) || "",
|
|
227
|
+
size: r.iconSize,
|
|
228
|
+
src: (g = r.user) == null ? void 0 : g.photo_url,
|
|
229
|
+
rounded: !0
|
|
230
|
+
}, null, 8, ["text", "size", "src"])
|
|
231
|
+
], 10, Q)
|
|
232
|
+
];
|
|
233
|
+
}),
|
|
234
|
+
menu: y(() => {
|
|
235
|
+
var i, o, a, g;
|
|
236
|
+
return [
|
|
237
|
+
e("div", W, [
|
|
238
|
+
e("div", null, [
|
|
239
|
+
h(k, {
|
|
240
|
+
text: ((i = r.user) == null ? void 0 : i.name) || "",
|
|
241
|
+
size: 80,
|
|
242
|
+
src: (o = r.user) == null ? void 0 : o.photo_url,
|
|
243
|
+
rounded: !0,
|
|
244
|
+
class: "mx-auto"
|
|
245
|
+
}, null, 8, ["text", "src"])
|
|
246
|
+
]),
|
|
247
|
+
e("div", null, [
|
|
248
|
+
e("div", null, f((a = r.user) == null ? void 0 : a.name), 1),
|
|
249
|
+
e("div", X, f((g = r.user) == null ? void 0 : g.email), 1)
|
|
250
|
+
])
|
|
251
|
+
]),
|
|
252
|
+
e("div", Y, [
|
|
253
|
+
h(C, {
|
|
254
|
+
icon: S(U),
|
|
255
|
+
label: r.accountLabel,
|
|
256
|
+
class: "rounded",
|
|
257
|
+
onClick: c
|
|
258
|
+
}, null, 8, ["icon", "label"]),
|
|
259
|
+
(l(!0), d(O, null, M(u.value, (_) => (l(), v(C, V({
|
|
260
|
+
key: _.key
|
|
261
|
+
}, _.args, {
|
|
262
|
+
onClick: _.click
|
|
263
|
+
}), null, 16, ["onClick"]))), 128)),
|
|
264
|
+
h(C, {
|
|
265
|
+
icon: S(G),
|
|
266
|
+
label: r.logoutLabel,
|
|
267
|
+
class: "rounded",
|
|
268
|
+
onClick: n
|
|
269
|
+
}, null, 8, ["icon", "label"])
|
|
270
|
+
])
|
|
271
|
+
];
|
|
272
|
+
}),
|
|
273
|
+
_: 1
|
|
274
|
+
}));
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
function Z(p, s) {
|
|
278
|
+
return l(), d("svg", {
|
|
279
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
280
|
+
fill: "none",
|
|
281
|
+
viewBox: "0 0 24 24",
|
|
282
|
+
"stroke-width": "1.8",
|
|
283
|
+
stroke: "currentColor",
|
|
284
|
+
"aria-hidden": "true"
|
|
285
|
+
}, [
|
|
286
|
+
e("rect", {
|
|
287
|
+
width: "2.94",
|
|
288
|
+
height: "2.94",
|
|
289
|
+
x: "17.16",
|
|
290
|
+
y: "3.9",
|
|
291
|
+
fill: "currentColor",
|
|
292
|
+
"stroke-width": "1.8",
|
|
293
|
+
rx: "1.1"
|
|
294
|
+
}),
|
|
295
|
+
e("rect", {
|
|
296
|
+
width: "2.94",
|
|
297
|
+
height: "2.94",
|
|
298
|
+
x: "10.53",
|
|
299
|
+
y: "3.9",
|
|
300
|
+
fill: "currentColor",
|
|
301
|
+
"stroke-width": "1.8",
|
|
302
|
+
rx: "1.1"
|
|
303
|
+
}),
|
|
304
|
+
e("rect", {
|
|
305
|
+
width: "2.94",
|
|
306
|
+
height: "2.94",
|
|
307
|
+
x: "3.9",
|
|
308
|
+
y: "3.9",
|
|
309
|
+
fill: "currentColor",
|
|
310
|
+
"stroke-width": "1.8",
|
|
311
|
+
rx: "1.1"
|
|
312
|
+
}),
|
|
313
|
+
e("rect", {
|
|
314
|
+
width: "2.94",
|
|
315
|
+
height: "2.94",
|
|
316
|
+
x: "17.16",
|
|
317
|
+
y: "10.53",
|
|
318
|
+
fill: "currentColor",
|
|
319
|
+
"stroke-width": "1.8",
|
|
320
|
+
rx: "1.1"
|
|
321
|
+
}),
|
|
322
|
+
e("rect", {
|
|
323
|
+
width: "2.94",
|
|
324
|
+
height: "2.94",
|
|
325
|
+
x: "10.53",
|
|
326
|
+
y: "10.53",
|
|
327
|
+
fill: "currentColor",
|
|
328
|
+
"stroke-width": "1.8",
|
|
329
|
+
rx: "1.1"
|
|
330
|
+
}),
|
|
331
|
+
e("rect", {
|
|
332
|
+
width: "2.94",
|
|
333
|
+
height: "2.94",
|
|
334
|
+
x: "3.9",
|
|
335
|
+
y: "10.53",
|
|
336
|
+
fill: "currentColor",
|
|
337
|
+
"stroke-width": "1.8",
|
|
338
|
+
rx: "1.1"
|
|
339
|
+
}),
|
|
340
|
+
e("rect", {
|
|
341
|
+
width: "2.94",
|
|
342
|
+
height: "2.94",
|
|
343
|
+
x: "17.16",
|
|
344
|
+
y: "17.16",
|
|
345
|
+
fill: "currentColor",
|
|
346
|
+
"stroke-width": "1.8",
|
|
347
|
+
rx: "1.1"
|
|
348
|
+
}),
|
|
349
|
+
e("rect", {
|
|
350
|
+
width: "2.94",
|
|
351
|
+
height: "2.94",
|
|
352
|
+
x: "10.53",
|
|
353
|
+
y: "17.16",
|
|
354
|
+
fill: "currentColor",
|
|
355
|
+
"stroke-width": "1.8",
|
|
356
|
+
rx: "1.1"
|
|
357
|
+
}),
|
|
358
|
+
e("rect", {
|
|
359
|
+
width: "2.94",
|
|
360
|
+
height: "2.94",
|
|
361
|
+
x: "3.9",
|
|
362
|
+
y: "17.16",
|
|
363
|
+
fill: "currentColor",
|
|
364
|
+
"stroke-width": "1.8",
|
|
365
|
+
rx: "1.1"
|
|
366
|
+
})
|
|
367
|
+
]);
|
|
368
|
+
}
|
|
369
|
+
const ee = ["onClick"], te = {
|
|
370
|
+
class: "space-x-2 flex items-center px-3 py-2",
|
|
371
|
+
style: { width: "300px" }
|
|
372
|
+
}, oe = { class: "flex-shrink-0" }, ne = { class: "w-full text-left" }, re = { class: "flex-shrink-0" }, se = { class: "px-3 py-2 border-t border-secondary-stroke" }, ie = { class: "text-secondary-content text-left pb-1 text-sm" }, le = { class: "grid grid-cols-3 gap-1" }, ce = ["onClick"], ae = { class: "block bg-white mx-auto flex-shrink-0 border border-secondary-stroke p-1 rounded-lg" }, ue = { class: "w-full overflow-hidden text-ellipsis whitespace-nowrap text-center text-sm mt-1" }, fe = /* @__PURE__ */ x({
|
|
373
|
+
__name: "OneBrowserMenu",
|
|
374
|
+
props: K,
|
|
375
|
+
setup(p) {
|
|
376
|
+
const s = p, u = () => {
|
|
377
|
+
typeof s.onChange == "function" && s.onChange();
|
|
378
|
+
}, c = (n) => {
|
|
379
|
+
typeof s.onApp == "function" && s.onApp(n);
|
|
380
|
+
};
|
|
381
|
+
return (n, r) => (l(), v(j, { stick: "right" }, {
|
|
382
|
+
button: y(({ onToggle: t, isExpanded: i }) => [
|
|
383
|
+
e("button", {
|
|
384
|
+
onClick: t,
|
|
385
|
+
class: b(["p-1 rounded-md hover:bg-secondary-10", [i ? "bg-secondary-25" : ""]])
|
|
386
|
+
}, [
|
|
387
|
+
h(S(Z), {
|
|
388
|
+
class: "text-secondary-base",
|
|
389
|
+
style: E(`width: ${n.iconSize}px; height: ${n.iconSize}px`)
|
|
390
|
+
}, null, 8, ["style"])
|
|
391
|
+
], 10, ee)
|
|
392
|
+
]),
|
|
393
|
+
menu: y(() => {
|
|
394
|
+
var t, i, o;
|
|
395
|
+
return [
|
|
396
|
+
e("div", te, [
|
|
397
|
+
e("div", oe, [
|
|
398
|
+
h(k, {
|
|
399
|
+
text: ((t = n.workspace) == null ? void 0 : t.name) || "",
|
|
400
|
+
src: (i = n.workspace) == null ? void 0 : i.photo_url,
|
|
401
|
+
size: 44,
|
|
402
|
+
rounded: !1,
|
|
403
|
+
class: "mx-auto"
|
|
404
|
+
}, null, 8, ["text", "src"])
|
|
405
|
+
]),
|
|
406
|
+
e("div", ne, f((o = n.workspace) == null ? void 0 : o.name), 1),
|
|
407
|
+
e("div", re, [
|
|
408
|
+
e("button", {
|
|
409
|
+
class: "text-sm border border-secondary-stroke rounded px-2 py-0.5 text-secondary-content hover:text-primary-content",
|
|
410
|
+
onClick: u
|
|
411
|
+
}, f(n.changeLabel), 1)
|
|
412
|
+
])
|
|
413
|
+
]),
|
|
414
|
+
e("div", se, [
|
|
415
|
+
e("div", ie, f(n.appsTitle), 1),
|
|
416
|
+
e("div", le, [
|
|
417
|
+
(l(!0), d(O, null, M(n.apps, (a) => (l(), d("button", {
|
|
418
|
+
key: a.id,
|
|
419
|
+
onClick: (g) => c(a),
|
|
420
|
+
class: "p-1.5 flex flex-col items-center justify-center rounded hover:bg-secondary-10",
|
|
421
|
+
style: { width: "88px", height: "88px" }
|
|
422
|
+
}, [
|
|
423
|
+
e("span", ae, [
|
|
424
|
+
h(k, {
|
|
425
|
+
text: a.name,
|
|
426
|
+
src: a.photo_url,
|
|
427
|
+
size: 44,
|
|
428
|
+
rounded: !1
|
|
429
|
+
}, null, 8, ["text", "src"])
|
|
430
|
+
]),
|
|
431
|
+
e("span", ue, f(a.name), 1)
|
|
432
|
+
], 8, ce))), 128))
|
|
433
|
+
])
|
|
434
|
+
])
|
|
435
|
+
];
|
|
436
|
+
}),
|
|
437
|
+
_: 1
|
|
438
|
+
}));
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
export {
|
|
442
|
+
j as _,
|
|
443
|
+
C as a,
|
|
444
|
+
he as b,
|
|
445
|
+
fe as c
|
|
446
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),h=require("./common/index.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"],w={key:0,class:"text-sm text-secondary-content px-3 py-2 text-left"},f=e.defineComponent({__name:"OneDropdown",props:g,emits:["open","close"],setup(d,{emit:l}){const a=d,c=e.ref(!1),n=e.ref(null),r=()=>{c.value=!c.value,c.value?l("open"):l("close")};e.provide("OneDropdown",{onToggle:r});const t=e.computed(()=>{const o=n.value!=null&&n.value.offsetLeft<270;return n.value!=null&&n.value.offsetTop+270>window.innerHeight?"up"+(o?"-right":"-left"):"down"+(o?"-right":"-left")}),s=e.computed(()=>{const o=["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"?o.push("bottom-1 mb-10"):t.value==="down"?o.push("top-1 mt-10"):t.value==="up-right"?o.push("left-0 bottom-1 mb-10"):t.value==="down-right"&&o.push("left-0 top-1 mt-10"),a.stick==="right"?o.push("right-0"):a.stick==="left"&&o.push("left-0"),o});return(o,i)=>(e.openBlock(),e.createElementBlock("div",{class:"relative inline-block",ref_key:"menuRef",ref:n,"data-opened":c.value},[e.renderSlot(o.$slots,"button",e.normalizeProps(e.guardReactiveProps({onToggle:r,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:r})):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"},[o.title?(e.openBlock(),e.createElementBlock("div",w,e.toDisplayString(o.title),1)):e.createCommentVNode("",!0),e.renderSlot(o.$slots,"menu",e.normalizeProps(e.guardReactiveProps({onToggle:r})))],2)):e.createCommentVNode("",!0)]),_:3})],8,y))}}),v=["onClick"],p=e.defineComponent({__name:"OneDropdownItem",props:k,emits:["click"],setup(d,{emit:l}){const a=d,c=e.inject("OneDropdown"),n=()=>{c!==void 0&&c.onToggle(),l("click")},r=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",r.value]),onClick:e.withModifiers(n,["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,v))}});function x(d,l){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 b(d,l){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 _={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}},C={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}},V=["onClick"],E={class:"space-y-2 text-center py-6",style:{width:"240px"}},N={class:"text-sm text-secondary-content"},B={class:"px-2"},S=e.defineComponent({__name:"OneUserMenu",props:_,setup(d){const l=d,a=e.computed(()=>{var r;return(r=l.menu)==null?void 0:r.map(t=>{let s={label:t.label};t.icon!=null&&(s={...s,icon:t.icon});const o=typeof t.click=="function"?t.click:()=>{};return{key:t.label,args:s,click:o}})}),c=()=>{typeof l.onAccount=="function"&&l.onAccount()},n=()=>{typeof l.onLogout=="function"&&l.onLogout()};return(r,t)=>(e.openBlock(),e.createBlock(f,{stick:"right"},{button:e.withCtx(({onToggle:s,isExpanded:o})=>{var i,u;return[e.createElementVNode("button",{onClick:s,class:e.normalizeClass(["p-1 rounded-full hover:bg-secondary-10",[o?"bg-secondary-25":""]])},[e.createVNode(h.OneAvatar,{text:((i=r.user)==null?void 0:i.name)||"",size:r.iconSize,src:(u=r.user)==null?void 0:u.photo_url,rounded:!0},null,8,["text","size","src"])],10,V)]}),menu:e.withCtx(()=>{var s,o,i,u;return[e.createElementVNode("div",E,[e.createElementVNode("div",null,[e.createVNode(h.OneAvatar,{text:((s=r.user)==null?void 0:s.name)||"",size:80,src:(o=r.user)==null?void 0:o.photo_url,rounded:!0,class:"mx-auto"},null,8,["text","src"])]),e.createElementVNode("div",null,[e.createElementVNode("div",null,e.toDisplayString((i=r.user)==null?void 0:i.name),1),e.createElementVNode("div",N,e.toDisplayString((u=r.user)==null?void 0:u.email),1)])]),e.createElementVNode("div",B,[e.createVNode(p,{icon:e.unref(x),label:r.accountLabel,class:"rounded",onClick:c},null,8,["icon","label"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,m=>(e.openBlock(),e.createBlock(p,e.mergeProps({key:m.key},m.args,{onClick:m.click}),null,16,["onClick"]))),128)),e.createVNode(p,{icon:e.unref(b),label:r.logoutLabel,class:"rounded",onClick:n},null,8,["icon","label"])])]}),_:1}))}});function z(d,l){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 $=["onClick"],A={class:"space-x-2 flex items-center px-3 py-2",style:{width:"300px"}},L={class:"flex-shrink-0"},D={class:"w-full text-left"},O={class:"flex-shrink-0"},P={class:"px-3 py-2 border-t border-secondary-stroke"},M={class:"text-secondary-content text-left pb-1 text-sm"},j={class:"grid grid-cols-3 gap-1"},F=["onClick"],T={class:"block bg-white mx-auto flex-shrink-0 border border-secondary-stroke p-1 rounded-lg"},q={class:"w-full overflow-hidden text-ellipsis whitespace-nowrap text-center text-sm mt-1"},R=e.defineComponent({__name:"OneBrowserMenu",props:C,setup(d){const l=d,a=()=>{typeof l.onChange=="function"&&l.onChange()},c=n=>{typeof l.onApp=="function"&&l.onApp(n)};return(n,r)=>(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(z),{class:"text-secondary-base",style:e.normalizeStyle(`width: ${n.iconSize}px; height: ${n.iconSize}px`)},null,8,["style"])],10,$)]),menu:e.withCtx(()=>{var t,s,o;return[e.createElementVNode("div",A,[e.createElementVNode("div",L,[e.createVNode(h.OneAvatar,{text:((t=n.workspace)==null?void 0:t.name)||"",src:(s=n.workspace)==null?void 0:s.photo_url,size:44,rounded:!1,class:"mx-auto"},null,8,["text","src"])]),e.createElementVNode("div",D,e.toDisplayString((o=n.workspace)==null?void 0:o.name),1),e.createElementVNode("div",O,[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(n.changeLabel),1)])]),e.createElementVNode("div",P,[e.createElementVNode("div",M,e.toDisplayString(n.appsTitle),1),e.createElementVNode("div",j,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.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",T,[e.createVNode(h.OneAvatar,{text:i.name,src:i.photo_url,size:44,rounded:!1},null,8,["text","src"])]),e.createElementVNode("span",q,e.toDisplayString(i.name),1)],8,F))),128))])])]}),_:1}))}});exports._sfc_main=f;exports._sfc_main$1=p;exports._sfc_main$2=S;exports._sfc_main$3=R;
|
package/dist/button/button.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExtractPropTypes, FunctionalComponent, Component } from "vue";
|
|
2
|
-
export type ButtonVariantType = 'primary' | '
|
|
2
|
+
export type ButtonVariantType = 'primary' | 'secondary' | 'warning' | 'danger' | 'info' | 'touch' | 'link' | 'none';
|
|
3
3
|
export type ButtonSizeType = 'sm' | 'md' | 'lg';
|
|
4
4
|
export type ButtonIconType = FunctionalComponent | Component;
|
|
5
5
|
export declare const buttonProps: {
|
package/dist/button/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),p=require("../_plugin-vue_export-helper-f246444f.cjs");const b={},g={class:"spinner",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:{animation:"one-sp-ico-rot 2.7s linear infinite"}},m=e.createElementVNode("circle",{style:{"stroke-linecap":"round",animation:"one-sp-ico-dash 1.7s ease-in-out infinite"},class:"opacity-75",cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor","stroke-width":"2"},null,-1),h=[m];function f(t,n){return e.openBlock(),e.createElementBlock("svg",g,h)}const y=p._export_sfc(b,[["render",f]]),v={variant:{type:String,default:"primary"},size:{type:String,default:"md"},label:{type:String},icon:{type:[Function,Object]},isLoading:{type:Boolean},isSubmit:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},active:{type:Boolean,default:!1},iconClass:{type:[String,Array]}},w=["relative inline-flex","border","items-center justify-center","text-sm font-medium whitespace-nowrap","disabled:opacity-50 disabled:cursor-default","focus:outline-none focus:ring-2 focus:ring-offset-2","transition-colors duration-200"],k={sm:["px-2 py-1"],md:["px-3 py-2"
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),p=require("../_plugin-vue_export-helper-f246444f.cjs");const b={},g={class:"spinner",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:{animation:"one-sp-ico-rot 2.7s linear infinite"}},m=e.createElementVNode("circle",{style:{"stroke-linecap":"round",animation:"one-sp-ico-dash 1.7s ease-in-out infinite"},class:"opacity-75",cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor","stroke-width":"2"},null,-1),h=[m];function f(t,n){return e.openBlock(),e.createElementBlock("svg",g,h)}const y=p._export_sfc(b,[["render",f]]),v={variant:{type:String,default:"primary"},size:{type:String,default:"md"},label:{type:String},icon:{type:[Function,Object]},isLoading:{type:Boolean},isSubmit:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},active:{type:Boolean,default:!1},iconClass:{type:[String,Array]}},w=["relative inline-flex","border","items-center justify-center","text-sm font-medium whitespace-nowrap","disabled:opacity-50 disabled:cursor-default","focus:outline-none focus:ring-2 focus:ring-offset-2","transition-colors duration-200"],k={sm:["px-2 py-1"],md:["px-3 py-2"],lg:["px-4 py-3"]},_={primary:["rounded-md border-transparent bg-primary-base disabled:bg-primary-hover text-white hover:bg-primary-hover focus:ring-primary-glow"],secondary:["rounded-md border-primary-stroke bg-primary-body disabled:bg-primary-body-hover text-black hover:bg-primary-body-hover focus:ring-tertiary-glow"],info:["rounded-md border-transparent bg-info-base disabled:bg-info-hover text-white hover:bg-info-hover focus:ring-info-glow"],success:["rounded-md border-transparent bg-success-base disabled:bg-success-hover text-white hover:bg-success-hover focus:ring-success-glow"],warning:["rounded-md border-transparent bg-warning-base disabled:bg-warning-hover text-white hover:bg-warning-hover focus:ring-warning-glow"],danger:["rounded-md border-transparent bg-danger-base disabled:bg-danger-hover text-white hover:bg-danger-hover focus:ring-danger-glow"],touch:["rounded-full border-transparent text-black hover:bg-primary-body-hover hover:shadow p-3 focus:ring-tertiary-glow"],link:["rounded-md border-transparent items-center text-info-base hover:text-info-hover"],none:["rounded-md border-transparent text-gray-500"]},C=(t="primary",n="md")=>{const o=[];return o.push(...w),o.push(..._[t]??[]),t!=="touch"&&o.push(...k[n]??[]),o},B=["disabled","title","type","onClick"],x=e.defineComponent({__name:"OneButton",props:v,emits:["click"],setup(t,{emit:n}){const o=t,a=()=>{n("click")},r=e.computed(()=>o.icon),l=e.computed(()=>{const s=C(o.variant,o.size);return o.variant==="touch"&&o.active&&s.push("bg-primary-body-active"),s}),c=e.computed(()=>o.disabled||o.isLoading),d=e.computed(()=>o.label&&o.label.length>0&&o.variant!=="touch"),u=e.computed(()=>{const s=["inline-block text-ellipsis overflow-hidden"];return(o.icon!=null||o.isLoading)&&s.push("ml-2"),s}),i=e.computed(()=>{const s=[];return o.size==="sm"?s.push("w-3 h-3"):o.size==="lg"?s.push("w-5 h-5"):s.push("w-4 h-4"),typeof o.iconClass=="string"?s.push(o.iconClass):o.iconClass instanceof Array&&s.push(...o.iconClass),s});return(s,L)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(l.value),disabled:c.value,title:s.label,type:s.isSubmit?"submit":"button",onClick:e.withModifiers(a,["stop"])},[s.isLoading?(e.openBlock(),e.createBlock(y,{key:0,class:e.normalizeClass(i.value)},null,8,["class"])):r.value!=null?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{key:1,class:e.normalizeClass(i.value)},null,8,["class"])):e.createCommentVNode("",!0),d.value?(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass(u.value)},e.toDisplayString(s.label),3)):e.createCommentVNode("",!0)],10,B))}});exports.OneButton=x;
|
package/dist/button/index.js
CHANGED
|
@@ -63,8 +63,8 @@ const z = /* @__PURE__ */ k(x, [["render", S]]), I = {
|
|
|
63
63
|
"transition-colors duration-200"
|
|
64
64
|
], O = {
|
|
65
65
|
sm: ["px-2 py-1"],
|
|
66
|
-
md: ["px-3 py-2"
|
|
67
|
-
lg: ["px-4 py-3"
|
|
66
|
+
md: ["px-3 py-2"],
|
|
67
|
+
lg: ["px-4 py-3"]
|
|
68
68
|
}, j = {
|
|
69
69
|
primary: ["rounded-md border-transparent bg-primary-base disabled:bg-primary-hover text-white hover:bg-primary-hover focus:ring-primary-glow"],
|
|
70
70
|
secondary: ["rounded-md border-primary-stroke bg-primary-body disabled:bg-primary-body-hover text-black hover:bg-primary-body-hover focus:ring-tertiary-glow"],
|
package/dist/common/avatar.d.ts
CHANGED
package/dist/common/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),p={size:{type:[String,Number],default:"50"},rounded:{type:Boolean,default:!1},text:{type:String,required:!1
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),p={size:{type:[String,Number],default:"50"},rounded:{type:Boolean,default:!1},text:{type:String,required:!1},src:{type:[String,null],required:!1}},m=["src"],h=e.defineComponent({__name:"OneAvatar",props:p,setup(s){const t=s,o=e.computed(()=>{if(t.text==null||t.text==="")return"";const r=t.text.trim().split(" ");return r.length<2?t.text.slice(0,2).toUpperCase():r.map(l=>l.slice(0,1)).join("").toUpperCase()}),i=e.computed(()=>({fill:"rgba(255, 255, 255, .75)",fontSize:`${Number(t.size)*.4}px`})),a=e.computed(()=>{if(t.text==null)return{width:`${t.size}px`,height:`${t.size}px`,borderRadius:t.rounded?"100%":"9%"};const r=t.text.split("").map(n=>n.charCodeAt(0)).reduce((n,d)=>n+d,0),u=`hsl(${360/26*r}, 68%, 48%)`;return{width:`${t.size}px`,height:`${t.size}px`,borderRadius:t.rounded?"100%":"9%",background:u}}),c=e.computed(()=>({width:`${t.size}px`,height:`${t.size}px`,borderRadius:t.rounded?"100%":"9%"}));return(r,l)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(c.value),class:"overflow-hidden"},[r.src?(e.openBlock(),e.createElementBlock("img",{key:0,src:r.src,alt:"",class:"w-full h-full"},null,8,m)):(e.openBlock(),e.createElementBlock("svg",{key:1,style:e.normalizeStyle(a.value),class:"block"},[o.value?(e.openBlock(),e.createElementBlock("text",{key:0,x:"50%",y:"50%","text-anchor":"middle","dominant-baseline":"central",class:"font-light",style:e.normalizeStyle(i.value)},e.toDisplayString(o.value),5)):e.createCommentVNode("",!0)],4))],4))}});exports.OneAvatar=h;
|
package/dist/common/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as m, computed as r, openBlock as s, createElementBlock as n, normalizeStyle as i, toDisplayString as f, createCommentVNode as g } from "vue";
|
|
2
|
+
const y = {
|
|
3
3
|
size: {
|
|
4
4
|
type: [String, Number],
|
|
5
5
|
default: "50"
|
|
@@ -10,30 +10,37 @@ const x = {
|
|
|
10
10
|
},
|
|
11
11
|
text: {
|
|
12
12
|
type: String,
|
|
13
|
-
required: !1
|
|
14
|
-
default: ""
|
|
13
|
+
required: !1
|
|
15
14
|
},
|
|
16
15
|
src: {
|
|
17
16
|
type: [String, null],
|
|
18
17
|
required: !1
|
|
19
18
|
}
|
|
20
|
-
}, v = ["src"],
|
|
19
|
+
}, v = ["src"], z = /* @__PURE__ */ m({
|
|
21
20
|
__name: "OneAvatar",
|
|
22
|
-
props:
|
|
23
|
-
setup(
|
|
24
|
-
const e =
|
|
21
|
+
props: y,
|
|
22
|
+
setup(u) {
|
|
23
|
+
const e = u, a = r(() => {
|
|
24
|
+
if (e.text == null || e.text === "")
|
|
25
|
+
return "";
|
|
25
26
|
const t = e.text.trim().split(" ");
|
|
26
27
|
return t.length < 2 ? e.text.slice(0, 2).toUpperCase() : t.map((l) => l.slice(0, 1)).join("").toUpperCase();
|
|
27
|
-
}),
|
|
28
|
+
}), c = r(() => ({
|
|
28
29
|
fill: "rgba(255, 255, 255, .75)",
|
|
29
30
|
fontSize: `${Number(e.size) * 0.4}px`
|
|
30
31
|
})), d = r(() => {
|
|
31
|
-
|
|
32
|
+
if (e.text == null)
|
|
33
|
+
return {
|
|
34
|
+
width: `${e.size}px`,
|
|
35
|
+
height: `${e.size}px`,
|
|
36
|
+
borderRadius: e.rounded ? "100%" : "9%"
|
|
37
|
+
};
|
|
38
|
+
const t = e.text.split("").map((o) => o.charCodeAt(0)).reduce((o, x) => o + x, 0), h = `hsl(${360 / 26 * t}, 68%, 48%)`;
|
|
32
39
|
return {
|
|
33
40
|
width: `${e.size}px`,
|
|
34
41
|
height: `${e.size}px`,
|
|
35
42
|
borderRadius: e.rounded ? "100%" : "9%",
|
|
36
|
-
background:
|
|
43
|
+
background: h
|
|
37
44
|
};
|
|
38
45
|
}), p = r(() => ({
|
|
39
46
|
width: `${e.size}px`,
|
|
@@ -41,7 +48,7 @@ const x = {
|
|
|
41
48
|
borderRadius: e.rounded ? "100%" : "9%"
|
|
42
49
|
}));
|
|
43
50
|
return (t, l) => (s(), n("div", {
|
|
44
|
-
style:
|
|
51
|
+
style: i(p.value),
|
|
45
52
|
class: "overflow-hidden"
|
|
46
53
|
}, [
|
|
47
54
|
t.src ? (s(), n("img", {
|
|
@@ -51,22 +58,22 @@ const x = {
|
|
|
51
58
|
class: "w-full h-full"
|
|
52
59
|
}, null, 8, v)) : (s(), n("svg", {
|
|
53
60
|
key: 1,
|
|
54
|
-
style:
|
|
61
|
+
style: i(d.value),
|
|
55
62
|
class: "block"
|
|
56
63
|
}, [
|
|
57
|
-
|
|
64
|
+
a.value ? (s(), n("text", {
|
|
58
65
|
key: 0,
|
|
59
66
|
x: "50%",
|
|
60
67
|
y: "50%",
|
|
61
68
|
"text-anchor": "middle",
|
|
62
69
|
"dominant-baseline": "central",
|
|
63
70
|
class: "font-light",
|
|
64
|
-
style:
|
|
65
|
-
},
|
|
71
|
+
style: i(c.value)
|
|
72
|
+
}, f(a.value), 5)) : g("", !0)
|
|
66
73
|
], 4))
|
|
67
74
|
], 4));
|
|
68
75
|
}
|
|
69
76
|
});
|
|
70
77
|
export {
|
|
71
|
-
|
|
78
|
+
z as OneAvatar
|
|
72
79
|
};
|
|
@@ -11,7 +11,7 @@ export declare const dropdownProps: {
|
|
|
11
11
|
export type DropdownProps = ExtractPropTypes<typeof dropdownProps>;
|
|
12
12
|
export declare const dropdownItemProps: {
|
|
13
13
|
variant: {
|
|
14
|
-
type: PropType<"primary" | "
|
|
14
|
+
type: PropType<"primary" | "secondary" | "warning" | "danger" | "info">;
|
|
15
15
|
default: string;
|
|
16
16
|
};
|
|
17
17
|
label: {
|