@oneb/ui-vue 0.0.53 → 0.0.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,526 +0,0 @@
1
- import { defineComponent as k, ref as _, provide as I, computed as b, openBlock as n, createElementBlock as s, renderSlot as j, normalizeProps as F, guardReactiveProps as B, createCommentVNode as v, createVNode as m, Transition as T, withCtx as A, normalizeClass as C, toDisplayString as p, inject as P, withModifiers as D, createBlock as $, resolveDynamicComponent as V, createElementVNode as e, Fragment as S, renderList as z, mergeProps as E, unref as O, createTextVNode as N, pushScopeId as q, popScopeId as H } from "vue";
2
- import { OneAvatar as w } from "./common/index.js";
3
- import { r as R } from "./XMarkIcon-51ef0691.js";
4
- import { _ as W } from "./index-72d69e4e.js";
5
- import { _ as U } from "./_plugin-vue_export-helper-dad06003.js";
6
- const G = {
7
- title: {
8
- type: String
9
- },
10
- stick: {
11
- type: String,
12
- default: "right"
13
- }
14
- }, J = {
15
- variant: {
16
- type: String,
17
- default: "primary"
18
- },
19
- label: {
20
- type: String
21
- },
22
- icon: {
23
- type: [Function, Object]
24
- }
25
- }, K = ["data-opened"], Q = {
26
- key: 0,
27
- class: "text-sm text-secondary-content px-3 py-2 text-left"
28
- }, X = /* @__PURE__ */ k({
29
- __name: "OneDropdown",
30
- props: G,
31
- emits: ["open", "close"],
32
- setup(d, { emit: l }) {
33
- const c = _(!1), u = _(null), f = l, r = d, a = () => {
34
- c.value = !c.value, c.value ? f("open") : f("close");
35
- };
36
- I("OneDropdown", {
37
- onToggle: a
38
- });
39
- const t = b(() => {
40
- const i = u.value != null && u.value.offsetLeft < 270;
41
- return u.value != null && u.value.offsetTop + 270 > window.innerHeight ? "up" + (i ? "-right" : "-left") : "down" + (i ? "-right" : "-left");
42
- }), o = b(() => {
43
- const i = [
44
- "absolute z-10 w-fit rounded-md bg-white",
45
- "py-1 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",
46
- "overflow-auto max-h-[540px] min-w-[150px] max-w-[540px]"
47
- ];
48
- return t.value.startsWith("up") ? i.push("bottom-1 mb-10") : t.value.startsWith("down") && i.push("top-1 mt-10"), r.stick === "right" ? i.push("right-0") : r.stick === "left" && i.push("left-0"), i;
49
- });
50
- return (i, g) => (n(), s("div", {
51
- class: "relative inline-block",
52
- ref_key: "menuRef",
53
- ref: u,
54
- "data-opened": c.value
55
- }, [
56
- j(i.$slots, "button", F(B({ onToggle: a, isExpanded: c.value }))),
57
- c.value ? (n(), s("div", {
58
- key: 0,
59
- class: "fixed top-0 left-0 w-screen h-screen z-10",
60
- onClick: a
61
- })) : v("", !0),
62
- m(T, {
63
- "enter-active-class": "transition ease-out duration-100",
64
- "enter-from-class": "transform opacity-0 scale-95",
65
- "enter-to-class": "transform opacity-100 scale-100",
66
- "leave-active-class": "transition ease-in duration-75",
67
- "leave-from-class": "transform opacity-100 scale-100",
68
- "leave-to-class": "transform opacity-0 scale-95"
69
- }, {
70
- default: A(() => [
71
- c.value ? (n(), s("div", {
72
- key: 0,
73
- class: C(["menu", o.value]),
74
- role: "menu",
75
- "aria-orientation": "vertical",
76
- tabindex: "-1"
77
- }, [
78
- i.title ? (n(), s("div", Q, p(i.title), 1)) : v("", !0),
79
- j(i.$slots, "menu", F(B({ onToggle: a })))
80
- ], 2)) : v("", !0)
81
- ]),
82
- _: 3
83
- })
84
- ], 8, K));
85
- }
86
- }), M = /* @__PURE__ */ k({
87
- __name: "OneDropdownItem",
88
- props: J,
89
- emits: ["click"],
90
- setup(d, { emit: l }) {
91
- const c = l, u = d, f = P("OneDropdown"), r = () => {
92
- f !== void 0 && f.onToggle(), c("click");
93
- }, a = b(() => {
94
- const t = [];
95
- 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;
96
- });
97
- return (t, o) => (n(), s("button", {
98
- class: C(["px-3 py-1.5 flex items-center space-x-3 w-full whitespace-nowrap", a.value]),
99
- onClick: D(r, ["prevent"])
100
- }, [
101
- t.icon ? (n(), $(V(t.icon), {
102
- key: 0,
103
- class: "w-4 h-4"
104
- })) : v("", !0),
105
- e("span", null, p(t.label), 1)
106
- ], 2));
107
- }
108
- });
109
- function Y(d, l) {
110
- return n(), s("svg", {
111
- xmlns: "http://www.w3.org/2000/svg",
112
- fill: "none",
113
- viewBox: "0 0 24 24",
114
- "stroke-width": "1.8",
115
- stroke: "currentColor",
116
- "aria-hidden": "true"
117
- }, [
118
- e("path", {
119
- "stroke-linecap": "round",
120
- "stroke-linejoin": "round",
121
- 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"
122
- })
123
- ]);
124
- }
125
- const Z = {
126
- user: {
127
- type: Object,
128
- required: !0
129
- },
130
- menu: {
131
- type: Array,
132
- default: () => []
133
- },
134
- iconSize: {
135
- type: String,
136
- default: "34"
137
- },
138
- app: {
139
- type: Object
140
- },
141
- accountLabel: {
142
- type: String,
143
- default: "Account"
144
- },
145
- logoutLabel: {
146
- type: String,
147
- default: "Logout"
148
- },
149
- versionLabel: {
150
- type: String,
151
- default: ""
152
- },
153
- onAccount: {
154
- type: Function
155
- },
156
- onLogout: {
157
- type: Function
158
- }
159
- }, ee = {
160
- workspace: {
161
- type: Object,
162
- required: !0
163
- },
164
- workspaces: {
165
- type: Array
166
- },
167
- apps: {
168
- type: Array,
169
- required: !0
170
- },
171
- iconSize: {
172
- type: String,
173
- default: "24"
174
- },
175
- appsTitle: {
176
- type: String,
177
- default: "Ваші додатки"
178
- },
179
- changeLabel: {
180
- type: String,
181
- default: "Керувати робочими просторами"
182
- },
183
- onChange: {
184
- type: Function
185
- },
186
- onApp: {
187
- type: Function
188
- }
189
- }, te = ["onClick"], oe = { class: "flex flex-col items-center pt-5 pb-2 h-full" }, ne = { class: "flex flex-col px-10 py-1 mt-2 text-center" }, se = { class: "self-center text-base font-medium tracking-wide text-black" }, re = { class: "mt-1 text-xs leading-5 text-blue-500 font-light" }, ie = { class: "text-left w-full mt-5 px-3" }, le = /* @__PURE__ */ e("div", {
190
- class: "space-y-2 text-center",
191
- style: { width: "240px" }
192
- }, null, -1), ce = { class: "-mb-2 flex-shrink-0 mt-auto pt-6 text-[8px] leading-3 text-gray-400" }, qe = /* @__PURE__ */ k({
193
- __name: "OneUserMenu",
194
- props: Z,
195
- setup(d) {
196
- const l = d, c = b(() => {
197
- var r;
198
- return (r = l.menu) == null ? void 0 : r.map((a) => {
199
- let t = { label: a.label };
200
- a.icon != null && (t = { ...t, icon: a.icon });
201
- const o = typeof a.click == "function" ? a.click : () => {
202
- };
203
- return {
204
- key: a.label,
205
- args: t,
206
- click: o
207
- };
208
- });
209
- }), u = () => {
210
- typeof l.onAccount == "function" && l.onAccount();
211
- }, f = () => {
212
- typeof l.onLogout == "function" && l.onLogout();
213
- };
214
- return (r, a) => (n(), $(X, { stick: "right" }, {
215
- button: A(({ onToggle: t, isExpanded: o }) => {
216
- var i, g;
217
- return [
218
- e("button", {
219
- onClick: t,
220
- class: C(["p-1 rounded-full hover:bg-secondary-10", [o ? "bg-secondary-25" : ""]])
221
- }, [
222
- m(w, {
223
- text: ((i = r.user) == null ? void 0 : i.name) || "",
224
- size: r.iconSize,
225
- src: (g = r.user) == null ? void 0 : g.photo_url,
226
- rounded: !0
227
- }, null, 8, ["text", "size", "src"])
228
- ], 10, te)
229
- ];
230
- }),
231
- menu: A(() => {
232
- var t, o, i, g, x;
233
- return [
234
- e("div", oe, [
235
- m(w, {
236
- text: ((t = r.user) == null ? void 0 : t.name) || "",
237
- size: 80,
238
- src: (o = r.user) == null ? void 0 : o.photo_url,
239
- rounded: !0,
240
- class: "mx-auto"
241
- }, null, 8, ["text", "src"]),
242
- e("div", ne, [
243
- e("div", se, p((i = r.user) == null ? void 0 : i.name), 1),
244
- e("div", re, p((g = r.user) == null ? void 0 : g.email), 1)
245
- ]),
246
- typeof l.onAccount == "function" ? (n(), s("a", {
247
- key: 0,
248
- onClick: u,
249
- class: "cursor-pointer justify-center px-8 py-3 mt-3 text-xs font-semibold tracking-wide leading-5 text-gray-600 border border-solid bg-neutral-100 border-slate-200 rounded-[50px] hover:bg-neutral-200"
250
- }, p(r.accountLabel), 1)) : v("", !0),
251
- e("div", ie, [
252
- (n(!0), s(S, null, z(c.value, (y) => (n(), $(M, E({
253
- key: y.key
254
- }, y.args, {
255
- onClick: y.click
256
- }), null, 16, ["onClick"]))), 128)),
257
- m(M, {
258
- icon: O(Y),
259
- label: r.logoutLabel,
260
- class: "rounded py-3",
261
- onClick: f
262
- }, null, 8, ["icon", "label"])
263
- ]),
264
- le,
265
- e("div", ce, p((x = r.app) == null ? void 0 : x.version), 1)
266
- ])
267
- ];
268
- }),
269
- _: 1
270
- }));
271
- }
272
- });
273
- function ae(d, l) {
274
- return n(), s("svg", {
275
- xmlns: "http://www.w3.org/2000/svg",
276
- fill: "none",
277
- viewBox: "0 0 24 24",
278
- "stroke-width": "1.8",
279
- stroke: "currentColor",
280
- "aria-hidden": "true"
281
- }, [
282
- e("rect", {
283
- width: "2.94",
284
- height: "2.94",
285
- x: "17.16",
286
- y: "3.9",
287
- fill: "currentColor",
288
- "stroke-width": "1.8",
289
- rx: "1.1"
290
- }),
291
- e("rect", {
292
- width: "2.94",
293
- height: "2.94",
294
- x: "10.53",
295
- y: "3.9",
296
- fill: "currentColor",
297
- "stroke-width": "1.8",
298
- rx: "1.1"
299
- }),
300
- e("rect", {
301
- width: "2.94",
302
- height: "2.94",
303
- x: "3.9",
304
- y: "3.9",
305
- fill: "currentColor",
306
- "stroke-width": "1.8",
307
- rx: "1.1"
308
- }),
309
- e("rect", {
310
- width: "2.94",
311
- height: "2.94",
312
- x: "17.16",
313
- y: "10.53",
314
- fill: "currentColor",
315
- "stroke-width": "1.8",
316
- rx: "1.1"
317
- }),
318
- e("rect", {
319
- width: "2.94",
320
- height: "2.94",
321
- x: "10.53",
322
- y: "10.53",
323
- fill: "currentColor",
324
- "stroke-width": "1.8",
325
- rx: "1.1"
326
- }),
327
- e("rect", {
328
- width: "2.94",
329
- height: "2.94",
330
- x: "3.9",
331
- y: "10.53",
332
- fill: "currentColor",
333
- "stroke-width": "1.8",
334
- rx: "1.1"
335
- }),
336
- e("rect", {
337
- width: "2.94",
338
- height: "2.94",
339
- x: "17.16",
340
- y: "17.16",
341
- fill: "currentColor",
342
- "stroke-width": "1.8",
343
- rx: "1.1"
344
- }),
345
- e("rect", {
346
- width: "2.94",
347
- height: "2.94",
348
- x: "10.53",
349
- y: "17.16",
350
- fill: "currentColor",
351
- "stroke-width": "1.8",
352
- rx: "1.1"
353
- }),
354
- e("rect", {
355
- width: "2.94",
356
- height: "2.94",
357
- x: "3.9",
358
- y: "17.16",
359
- fill: "currentColor",
360
- "stroke-width": "1.8",
361
- rx: "1.1"
362
- })
363
- ]);
364
- }
365
- function ue(d, l) {
366
- return n(), s("svg", {
367
- xmlns: "http://www.w3.org/2000/svg",
368
- fill: "none",
369
- viewBox: "0 0 24 24",
370
- "stroke-width": "1.8",
371
- stroke: "currentColor",
372
- "aria-hidden": "true"
373
- }, [
374
- e("path", {
375
- "stroke-linecap": "round",
376
- "stroke-linejoin": "round",
377
- d: "M19.5 8.25l-7.5 7.5-7.5-7.5"
378
- })
379
- ]);
380
- }
381
- function de(d, l) {
382
- return n(), s("svg", {
383
- xmlns: "http://www.w3.org/2000/svg",
384
- fill: "none",
385
- viewBox: "0 0 24 24",
386
- "stroke-width": "1.8",
387
- stroke: "currentColor",
388
- "aria-hidden": "true"
389
- }, [
390
- e("path", {
391
- "stroke-linecap": "round",
392
- "stroke-linejoin": "round",
393
- d: "M4.5 15.75l7.5-7.5 7.5 7.5"
394
- })
395
- ]);
396
- }
397
- const pe = (d) => (q("data-v-fe93eab5"), d = d(), H(), d), he = ["data-opened"], fe = {
398
- key: 1,
399
- class: "absolute top-0 right-0 h-screen overflow-y-auto max-w-96 bg-white z-10"
400
- }, me = { class: "flex justify-between items-center pt-3 mb-3" }, ve = { class: "font-semibold text-xl px-3" }, ge = { class: "grid" }, ye = { class: "rounded-lg m-3 border" }, xe = {
401
- class: "space-x-2 flex items-center px-3 py-2",
402
- style: { width: "300px" }
403
- }, _e = { class: "flex justify-between relative" }, we = { class: "flex items-center justify-between w-full text-left text-sm font-semibold" }, be = { clsss: "flex justify-end absolute right-0" }, ke = { key: 0 }, Ce = { class: "text-xs font-semibold" }, Ae = /* @__PURE__ */ pe(() => /* @__PURE__ */ e("hr", null, null, -1)), $e = { class: "px-3 py-2" }, Se = { class: "text-secondary-content text-left pb-1 text-xs uppercase" }, ze = { class: "overflow-auto max-h-full" }, Oe = {
404
- key: 0,
405
- class: "space-y-2"
406
- }, Le = ["onClick"], je = { class: "pl-2" }, Fe = { class: "text-sm mt-1 font-semibold" }, Be = { class: "text-xs mt-1" }, Me = {
407
- key: 1,
408
- class: "mt-2 w-full bg-[#FAFAFA] hover:bg-secondary-10 p-2 rounded-lg mb-5 text-xs hidden"
409
- }, Ie = /* @__PURE__ */ k({
410
- __name: "OneBrowserMenu",
411
- props: ee,
412
- setup(d) {
413
- const l = d, c = _(!1), u = () => {
414
- c.value = !c.value;
415
- }, f = _(!1), r = b(() => f.value ? de : ue);
416
- _(!1);
417
- const a = () => {
418
- typeof l.onChange == "function" && l.onChange();
419
- }, t = (o) => {
420
- typeof l.onApp == "function" && l.onApp(o);
421
- };
422
- return (o, i) => {
423
- var g, x, y, L;
424
- return n(), s("div", { "data-opened": c.value }, [
425
- e("button", {
426
- onClick: u,
427
- class: C(["p-1 rounded-md hover:bg-secondary-10", { "bg-secondary-10": c.value }])
428
- }, [
429
- m(O(ae), { class: "text-secondary-base w-8" })
430
- ], 2),
431
- c.value ? (n(), s("div", {
432
- key: 0,
433
- class: "fixed top-0 left-0 w-screen h-screen z-10",
434
- onClick: u
435
- })) : v("", !0),
436
- c.value ? (n(), s("div", fe, [
437
- e("div", me, [
438
- e("div", ve, p((g = o.workspace) == null ? void 0 : g.label), 1),
439
- m(O(R), {
440
- class: "w-6 cursor-pointer",
441
- onClick: u
442
- })
443
- ]),
444
- e("div", ge, [
445
- e("div", ye, [
446
- e("div", xe, [
447
- e("div", _e, [
448
- m(w, {
449
- text: ((x = o.workspace) == null ? void 0 : x.name) || "",
450
- src: (y = o.workspace) == null ? void 0 : y.photo_url,
451
- size: 44,
452
- rounded: !1,
453
- class: "mx-auto"
454
- }, null, 8, ["text", "src"])
455
- ]),
456
- e("div", we, [
457
- N(p((L = o.workspace) == null ? void 0 : L.name) + " ", 1),
458
- e("div", be, [
459
- m(W, {
460
- variant: "touch",
461
- icon: r.value,
462
- onClick: a
463
- }, null, 8, ["icon"])
464
- ])
465
- ])
466
- ]),
467
- f.value ? (n(), s("div", ke, [
468
- (n(!0), s(S, null, z(o.workspaces, (h) => (n(), s("div", {
469
- key: h.name,
470
- class: "flex items-center space-x-3 border-t px-5 py-2 hover:bg-secondary-10"
471
- }, [
472
- m(w, {
473
- text: h.name,
474
- src: h.photo_url,
475
- size: 30,
476
- rounded: !1
477
- }, null, 8, ["text", "src"]),
478
- e("span", Ce, p(h.name), 1)
479
- ]))), 128))
480
- ])) : v("", !0),
481
- Ae,
482
- e("div", {
483
- onClick: a,
484
- class: "text-center py-2 cursor-pointer",
485
- style: { "font-size": "10px" }
486
- }, p(o.changeLabel), 1)
487
- ])
488
- ]),
489
- e("div", $e, [
490
- e("div", Se, p(o.appsTitle), 1),
491
- e("div", ze, [
492
- o.apps && o.apps.length ? (n(), s("div", Oe, [
493
- (n(!0), s(S, null, z(o.apps, (h) => (n(), s("div", {
494
- key: h.id,
495
- onClick: (Te) => t(h),
496
- class: "flex items-center rounded-lg hover:bg-secondary-10 border p-2 bg-[#FAFAFA] cursor-pointer"
497
- }, [
498
- m(w, {
499
- text: h.name,
500
- src: h.photo_url,
501
- size: 44,
502
- rounded: !1
503
- }, null, 8, ["text", "src"]),
504
- e("div", je, [
505
- e("p", Fe, p(h.name), 1),
506
- e("p", Be, p(h == null ? void 0 : h.inf), 1)
507
- ])
508
- ], 8, Le))), 128))
509
- ])) : v("", !0),
510
- o.apps && o.apps.length ? (n(), s("button", Me, p("Дивитися всі"))) : v("", !0)
511
- ])
512
- ])
513
- ])) : v("", !0)
514
- ], 8, he);
515
- };
516
- }
517
- });
518
- const He = /* @__PURE__ */ U(Ie, [["__scopeId", "data-v-fe93eab5"]]);
519
- export {
520
- He as O,
521
- X as _,
522
- M as a,
523
- qe as b,
524
- ee as c,
525
- ae as r
526
- };