@oneb/ui-vue 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
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"],setup(d,{emit:l}){const a=d,c=e.ref(!1),n=e.ref(null),r=()=>{c.value=!c.value,c.value&&l("open")};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;
@@ -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"],
29
+ setup(p, { emit: s }) {
30
+ const u = p, c = $(!1), o = $(null), r = () => {
31
+ c.value = !c.value, c.value && s("open");
32
+ };
33
+ B("OneDropdown", {
34
+ onToggle: r
35
+ });
36
+ const t = w(() => {
37
+ const n = o.value != null && o.value.offsetLeft < 270;
38
+ return o.value != null && o.value.offsetTop + 270 > window.innerHeight ? "up" + (n ? "-right" : "-left") : "down" + (n ? "-right" : "-left");
39
+ }), i = w(() => {
40
+ const n = [
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" ? 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"), u.stick === "right" ? n.push("right-0") : u.stick === "left" && n.push("left-0"), n;
46
+ });
47
+ return (n, a) => (l(), d("div", {
48
+ class: "relative inline-block",
49
+ ref_key: "menuRef",
50
+ ref: o,
51
+ "data-opened": c.value
52
+ }, [
53
+ z(n.$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
+ n.title ? (l(), d("div", N, f(n.title), 1)) : m("", !0),
76
+ z(n.$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"), o = () => {
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(o, ["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 n = typeof t.click == "function" ? t.click : () => {
205
+ };
206
+ return {
207
+ key: t.label,
208
+ args: i,
209
+ click: n
210
+ };
211
+ });
212
+ }), c = () => {
213
+ typeof s.onAccount == "function" && s.onAccount();
214
+ }, o = () => {
215
+ typeof s.onLogout == "function" && s.onLogout();
216
+ };
217
+ return (r, t) => (l(), v(j, { stick: "right" }, {
218
+ button: y(({ onToggle: i, isExpanded: n }) => {
219
+ var a, g;
220
+ return [
221
+ e("button", {
222
+ onClick: i,
223
+ class: b(["p-1 rounded-full hover:bg-secondary-10", [n ? "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, n, 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: (n = r.user) == null ? void 0 : n.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: o
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
+ }, ne = { class: "flex-shrink-0" }, oe = { 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 = (o) => {
379
+ typeof s.onApp == "function" && s.onApp(o);
380
+ };
381
+ return (o, 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: ${o.iconSize}px; height: ${o.iconSize}px`)
390
+ }, null, 8, ["style"])
391
+ ], 10, ee)
392
+ ]),
393
+ menu: y(() => {
394
+ var t, i, n;
395
+ return [
396
+ e("div", te, [
397
+ e("div", ne, [
398
+ h(k, {
399
+ text: ((t = o.workspace) == null ? void 0 : t.name) || "",
400
+ src: (i = o.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", oe, f((n = o.workspace) == null ? void 0 : n.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(o.changeLabel), 1)
412
+ ])
413
+ ]),
414
+ e("div", se, [
415
+ e("div", ie, f(o.appsTitle), 1),
416
+ e("div", le, [
417
+ (l(!0), d(O, null, M(o.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
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),g=require("../_plugin-vue_export-helper-f246444f.cjs"),h=require("../common/index.cjs"),k={title:{type:String},stick:{type:String,default:"right"}},y={variant:{type:String,default:"primary"},label:{type:String},icon:{type:[Function,Object]}},w=["data-opened"],v={key:0,class:"text-sm text-secondary-content px-3 py-2 text-left"},f=e.defineComponent({__name:"OneDropdown",props:k,emits:["open"],setup(a,{emit:l}){const d=a,s=e.ref(!1),n=e.ref(null),r=()=>{s.value=!s.value,s.value&&l("open")};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")}),c=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"),d.stick==="right"?o.push("right-0"):d.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":s.value},[e.renderSlot(o.$slots,"button",e.normalizeProps(e.guardReactiveProps({onToggle:r,isExpanded:s.value}))),s.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(()=>[s.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["menu",c.value]),role:"menu","aria-orientation":"vertical",tabindex:"-1"},[o.title?(e.openBlock(),e.createElementBlock("div",v,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,w))}}),x=["onClick"],p=e.defineComponent({__name:"OneDropdownItem",props:y,emits:["click"],setup(a,{emit:l}){const d=a,s=e.inject("OneDropdown"),n=()=>{s!==void 0&&s.onToggle(),l("click")},r=e.computed(()=>{const t=[];return d.variant==="secondary"?t.push("text-secondary-content hover:bg-secondary-body-hover"):d.variant==="danger"?t.push("text-danger-content hover:bg-danger-10"):d.variant==="warning"?t.push("text-warning-content hover:bg-warning-10"):d.variant==="info"?t.push("text-info-content hover:bg-info-10"):t.push("hover:bg-secondary-body-hover"),t});return(t,c)=>(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,x))}}),b={},_={class:"border-t border-secondary-stroke my-1"};function C(a,l){return e.openBlock(),e.createElementBlock("div",_)}const V=g._export_sfc(b,[["render",C]]);function E(a,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 N(a,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 B={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}},S={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}},z=["onClick"],O={class:"space-y-2 text-center py-6",style:{width:"240px"}},A={class:"text-sm text-secondary-content"},D={class:"px-2"},$=e.defineComponent({__name:"OneUserMenu",props:B,setup(a){const l=a,d=e.computed(()=>{var r;return(r=l.menu)==null?void 0:r.map(t=>{let c={label:t.label};t.icon!=null&&(c={...c,icon:t.icon});const o=typeof t.click=="function"?t.click:()=>{};return{key:t.label,args:c,click:o}})}),s=()=>{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:c,isExpanded:o})=>{var i,u;return[e.createElementVNode("button",{onClick:c,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,z)]}),menu:e.withCtx(()=>{var c,o,i,u;return[e.createElementVNode("div",O,[e.createElementVNode("div",null,[e.createVNode(h.OneAvatar,{text:((c=r.user)==null?void 0:c.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",A,e.toDisplayString((u=r.user)==null?void 0:u.email),1)])]),e.createElementVNode("div",D,[e.createVNode(p,{icon:e.unref(E),label:r.accountLabel,class:"rounded",onClick:s},null,8,["icon","label"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.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(N),label:r.logoutLabel,class:"rounded",onClick:n},null,8,["icon","label"])])]}),_:1}))}});function L(a,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 M=["onClick"],P={class:"space-x-2 flex items-center px-3 py-2",style:{width:"300px"}},j={class:"flex-shrink-0"},F={class:"w-full text-left"},T={class:"flex-shrink-0"},q={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"},R=["onClick"],U={class:"block bg-white mx-auto flex-shrink-0 border border-secondary-stroke p-1 rounded-lg"},G={class:"w-full overflow-hidden text-ellipsis whitespace-nowrap text-center text-sm mt-1"},J=e.defineComponent({__name:"OneBrowserMenu",props:S,setup(a){const l=a,d=()=>{typeof l.onChange=="function"&&l.onChange()},s=n=>{typeof l.onApp=="function"&&l.onApp(n)};return(n,r)=>(e.openBlock(),e.createBlock(f,{stick:"right"},{button:e.withCtx(({onToggle:t,isExpanded:c})=>[e.createElementVNode("button",{onClick:t,class:e.normalizeClass(["p-1 rounded-md hover:bg-secondary-10",[c?"bg-secondary-25":""]])},[e.createVNode(e.unref(L),{class:"text-secondary-base",style:e.normalizeStyle(`width: ${n.iconSize}px; height: ${n.iconSize}px`)},null,8,["style"])],10,M)]),menu:e.withCtx(()=>{var t,c,o;return[e.createElementVNode("div",P,[e.createElementVNode("div",j,[e.createVNode(h.OneAvatar,{text:((t=n.workspace)==null?void 0:t.name)||"",src:(c=n.workspace)==null?void 0:c.photo_url,size:44,rounded:!1,class:"mx-auto"},null,8,["text","src"])]),e.createElementVNode("div",F,e.toDisplayString((o=n.workspace)==null?void 0:o.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:d},e.toDisplayString(n.changeLabel),1)])]),e.createElementVNode("div",q,[e.createElementVNode("div",H,e.toDisplayString(n.appsTitle),1),e.createElementVNode("div",I,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.apps,i=>(e.openBlock(),e.createElementBlock("button",{key:i.id,onClick:u=>s(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",U,[e.createVNode(h.OneAvatar,{text:i.name,src:i.photo_url,size:44,rounded:!1},null,8,["text","src"])]),e.createElementVNode("span",G,e.toDisplayString(i.name),1)],8,R))),128))])])]}),_:1}))}});exports.OneBrowserMenu=J;exports.OneDropdown=f;exports.OneDropdownDivider=V;exports.OneDropdownItem=p;exports.OneUserMenu=$;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../OneBrowserMenu.vue_vue_type_script_setup_true_lang-4c394828.cjs"),r=require("vue"),n=require("../_plugin-vue_export-helper-f246444f.cjs");require("../common/index.cjs");const o={},t={class:"border-t border-secondary-stroke my-1"};function _(s,i){return r.openBlock(),r.createElementBlock("div",t)}const c=n._export_sfc(o,[["render",_]]);exports.OneBrowserMenu=e._sfc_main$3;exports.OneDropdown=e._sfc_main;exports.OneDropdownItem=e._sfc_main$1;exports.OneUserMenu=e._sfc_main$2;exports.OneDropdownDivider=c;
@@ -1,452 +1,16 @@
1
- import { defineComponent as k, ref as S, provide as B, computed as w, openBlock as l, createElementBlock as u, renderSlot as z, normalizeProps as A, guardReactiveProps as L, createCommentVNode as m, createVNode as h, Transition as j, withCtx as y, normalizeClass as _, toDisplayString as f, inject as P, withModifiers as F, createBlock as v, resolveDynamicComponent as T, createElementVNode as e, unref as $, Fragment as O, renderList as D, mergeProps as V, normalizeStyle as E } from "vue";
2
- import { _ as I } from "../_plugin-vue_export-helper-dad06003.js";
3
- import { OneAvatar as x } from "../common/index.js";
4
- const q = {
5
- title: {
6
- type: String
7
- },
8
- stick: {
9
- type: String,
10
- default: "right"
11
- }
12
- }, H = {
13
- variant: {
14
- type: String,
15
- default: "primary"
16
- },
17
- label: {
18
- type: String
19
- },
20
- icon: {
21
- type: [Function, Object]
22
- }
23
- }, N = ["data-opened"], R = {
24
- key: 0,
25
- class: "text-sm text-secondary-content px-3 py-2 text-left"
26
- }, M = /* @__PURE__ */ k({
27
- __name: "OneDropdown",
28
- props: q,
29
- emits: ["open"],
30
- setup(d, { emit: s }) {
31
- const p = d, c = S(!1), o = S(null), r = () => {
32
- c.value = !c.value, c.value && s("open");
33
- };
34
- B("OneDropdown", {
35
- onToggle: r
36
- });
37
- const t = w(() => {
38
- const n = o.value != null && o.value.offsetLeft < 270;
39
- return o.value != null && o.value.offsetTop + 270 > window.innerHeight ? "up" + (n ? "-right" : "-left") : "down" + (n ? "-right" : "-left");
40
- }), i = w(() => {
41
- const n = [
42
- "absolute z-10 w-fit rounded-md bg-white",
43
- "py-1 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",
44
- "overflow-auto max-h-[540px] min-w-[150px] max-w-[540px]"
45
- ];
46
- 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"), p.stick === "right" ? n.push("right-0") : p.stick === "left" && n.push("left-0"), n;
47
- });
48
- return (n, a) => (l(), u("div", {
49
- class: "relative inline-block",
50
- ref_key: "menuRef",
51
- ref: o,
52
- "data-opened": c.value
53
- }, [
54
- z(n.$slots, "button", A(L({ onToggle: r, isExpanded: c.value }))),
55
- c.value ? (l(), u("div", {
56
- key: 0,
57
- class: "fixed top-0 left-0 w-screen h-screen z-10",
58
- onClick: r
59
- })) : m("", !0),
60
- h(j, {
61
- "enter-active-class": "transition ease-out duration-100",
62
- "enter-from-class": "transform opacity-0 scale-95",
63
- "enter-to-class": "transform opacity-100 scale-100",
64
- "leave-active-class": "transition ease-in duration-75",
65
- "leave-from-class": "transform opacity-100 scale-100",
66
- "leave-to-class": "transform opacity-0 scale-95"
67
- }, {
68
- default: y(() => [
69
- c.value ? (l(), u("div", {
70
- key: 0,
71
- class: _(["menu", i.value]),
72
- role: "menu",
73
- "aria-orientation": "vertical",
74
- tabindex: "-1"
75
- }, [
76
- n.title ? (l(), u("div", R, f(n.title), 1)) : m("", !0),
77
- z(n.$slots, "menu", A(L({ onToggle: r })))
78
- ], 2)) : m("", !0)
79
- ]),
80
- _: 3
81
- })
82
- ], 8, N));
83
- }
84
- }), U = ["onClick"], C = /* @__PURE__ */ k({
85
- __name: "OneDropdownItem",
86
- props: H,
87
- emits: ["click"],
88
- setup(d, { emit: s }) {
89
- const p = d, c = P("OneDropdown"), o = () => {
90
- c !== void 0 && c.onToggle(), s("click");
91
- }, r = w(() => {
92
- const t = [];
93
- return p.variant === "secondary" ? t.push("text-secondary-content hover:bg-secondary-body-hover") : p.variant === "danger" ? t.push("text-danger-content hover:bg-danger-10") : p.variant === "warning" ? t.push("text-warning-content hover:bg-warning-10") : p.variant === "info" ? t.push("text-info-content hover:bg-info-10") : t.push("hover:bg-secondary-body-hover"), t;
94
- });
95
- return (t, i) => (l(), u("button", {
96
- class: _(["px-3 py-1.5 flex items-center space-x-3 w-full whitespace-nowrap", r.value]),
97
- onClick: F(o, ["prevent"])
98
- }, [
99
- t.icon ? (l(), v(T(t.icon), {
100
- key: 0,
101
- class: "w-4 h-4"
102
- })) : m("", !0),
103
- e("span", null, f(t.label), 1)
104
- ], 10, U));
105
- }
106
- }), G = {}, J = { class: "border-t border-secondary-stroke my-1" };
107
- function K(d, s) {
108
- return l(), u("div", J);
1
+ import { c as O, _ as l, a as u, b as w } from "../OneBrowserMenu.vue_vue_type_script_setup_true_lang-8d34213c.js";
2
+ import { openBlock as e, createElementBlock as r } from "vue";
3
+ import { _ as o } from "../_plugin-vue_export-helper-dad06003.js";
4
+ import "../common/index.js";
5
+ const n = {}, s = { class: "border-t border-secondary-stroke my-1" };
6
+ function t(c, _) {
7
+ return e(), r("div", s);
109
8
  }
110
- const we = /* @__PURE__ */ I(G, [["render", K]]);
111
- function Q(d, s) {
112
- return l(), u("svg", {
113
- xmlns: "http://www.w3.org/2000/svg",
114
- fill: "none",
115
- viewBox: "0 0 24 24",
116
- "stroke-width": "1.8",
117
- stroke: "currentColor",
118
- "aria-hidden": "true"
119
- }, [
120
- e("path", {
121
- "stroke-linecap": "round",
122
- "stroke-linejoin": "round",
123
- 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"
124
- })
125
- ]);
126
- }
127
- function W(d, s) {
128
- return l(), u("svg", {
129
- xmlns: "http://www.w3.org/2000/svg",
130
- fill: "none",
131
- viewBox: "0 0 24 24",
132
- "stroke-width": "1.8",
133
- stroke: "currentColor",
134
- "aria-hidden": "true"
135
- }, [
136
- e("path", {
137
- "stroke-linecap": "round",
138
- "stroke-linejoin": "round",
139
- 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"
140
- })
141
- ]);
142
- }
143
- const X = {
144
- user: {
145
- type: Object,
146
- required: !0
147
- },
148
- menu: {
149
- type: Array,
150
- default: () => []
151
- },
152
- iconSize: {
153
- type: String,
154
- default: "34"
155
- },
156
- accountLabel: {
157
- type: String,
158
- default: "Account"
159
- },
160
- logoutLabel: {
161
- type: String,
162
- default: "Logout"
163
- },
164
- onAccount: {
165
- type: Function
166
- },
167
- onLogout: {
168
- type: Function
169
- }
170
- }, Y = {
171
- workspace: {
172
- type: Object,
173
- required: !0
174
- },
175
- apps: {
176
- type: Array,
177
- required: !0
178
- },
179
- iconSize: {
180
- type: String,
181
- default: "24"
182
- },
183
- appsTitle: {
184
- type: String,
185
- default: "Apps"
186
- },
187
- changeLabel: {
188
- type: String,
189
- default: "Change"
190
- },
191
- onChange: {
192
- type: Function
193
- },
194
- onApp: {
195
- type: Function
196
- }
197
- }, Z = ["onClick"], ee = {
198
- class: "space-y-2 text-center py-6",
199
- style: { width: "240px" }
200
- }, te = { class: "text-sm text-secondary-content" }, ne = { class: "px-2" }, ve = /* @__PURE__ */ k({
201
- __name: "OneUserMenu",
202
- props: X,
203
- setup(d) {
204
- const s = d, p = w(() => {
205
- var r;
206
- return (r = s.menu) == null ? void 0 : r.map((t) => {
207
- let i = { label: t.label };
208
- t.icon != null && (i = { ...i, icon: t.icon });
209
- const n = typeof t.click == "function" ? t.click : () => {
210
- };
211
- return {
212
- key: t.label,
213
- args: i,
214
- click: n
215
- };
216
- });
217
- }), c = () => {
218
- typeof s.onAccount == "function" && s.onAccount();
219
- }, o = () => {
220
- typeof s.onLogout == "function" && s.onLogout();
221
- };
222
- return (r, t) => (l(), v(M, { stick: "right" }, {
223
- button: y(({ onToggle: i, isExpanded: n }) => {
224
- var a, g;
225
- return [
226
- e("button", {
227
- onClick: i,
228
- class: _(["p-1 rounded-full hover:bg-secondary-10", [n ? "bg-secondary-25" : ""]])
229
- }, [
230
- h(x, {
231
- text: ((a = r.user) == null ? void 0 : a.name) || "",
232
- size: r.iconSize,
233
- src: (g = r.user) == null ? void 0 : g.photo_url,
234
- rounded: !0
235
- }, null, 8, ["text", "size", "src"])
236
- ], 10, Z)
237
- ];
238
- }),
239
- menu: y(() => {
240
- var i, n, a, g;
241
- return [
242
- e("div", ee, [
243
- e("div", null, [
244
- h(x, {
245
- text: ((i = r.user) == null ? void 0 : i.name) || "",
246
- size: 80,
247
- src: (n = r.user) == null ? void 0 : n.photo_url,
248
- rounded: !0,
249
- class: "mx-auto"
250
- }, null, 8, ["text", "src"])
251
- ]),
252
- e("div", null, [
253
- e("div", null, f((a = r.user) == null ? void 0 : a.name), 1),
254
- e("div", te, f((g = r.user) == null ? void 0 : g.email), 1)
255
- ])
256
- ]),
257
- e("div", ne, [
258
- h(C, {
259
- icon: $(Q),
260
- label: r.accountLabel,
261
- class: "rounded",
262
- onClick: c
263
- }, null, 8, ["icon", "label"]),
264
- (l(!0), u(O, null, D(p.value, (b) => (l(), v(C, V({
265
- key: b.key
266
- }, b.args, {
267
- onClick: b.click
268
- }), null, 16, ["onClick"]))), 128)),
269
- h(C, {
270
- icon: $(W),
271
- label: r.logoutLabel,
272
- class: "rounded",
273
- onClick: o
274
- }, null, 8, ["icon", "label"])
275
- ])
276
- ];
277
- }),
278
- _: 1
279
- }));
280
- }
281
- });
282
- function oe(d, s) {
283
- return l(), u("svg", {
284
- xmlns: "http://www.w3.org/2000/svg",
285
- fill: "none",
286
- viewBox: "0 0 24 24",
287
- "stroke-width": "1.8",
288
- stroke: "currentColor",
289
- "aria-hidden": "true"
290
- }, [
291
- e("rect", {
292
- width: "2.94",
293
- height: "2.94",
294
- x: "17.16",
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: "10.53",
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: "3.9",
313
- y: "3.9",
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: "17.16",
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: "10.53",
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: "3.9",
340
- y: "10.53",
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: "17.16",
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: "10.53",
358
- y: "17.16",
359
- fill: "currentColor",
360
- "stroke-width": "1.8",
361
- rx: "1.1"
362
- }),
363
- e("rect", {
364
- width: "2.94",
365
- height: "2.94",
366
- x: "3.9",
367
- y: "17.16",
368
- fill: "currentColor",
369
- "stroke-width": "1.8",
370
- rx: "1.1"
371
- })
372
- ]);
373
- }
374
- const re = ["onClick"], se = {
375
- class: "space-x-2 flex items-center px-3 py-2",
376
- style: { width: "300px" }
377
- }, ie = { class: "flex-shrink-0" }, le = { class: "w-full text-left" }, ce = { class: "flex-shrink-0" }, ae = { class: "px-3 py-2 border-t border-secondary-stroke" }, ue = { class: "text-secondary-content text-left pb-1 text-sm" }, de = { class: "grid grid-cols-3 gap-1" }, pe = ["onClick"], he = { class: "block bg-white mx-auto flex-shrink-0 border border-secondary-stroke p-1 rounded-lg" }, fe = { class: "w-full overflow-hidden text-ellipsis whitespace-nowrap text-center text-sm mt-1" }, xe = /* @__PURE__ */ k({
378
- __name: "OneBrowserMenu",
379
- props: Y,
380
- setup(d) {
381
- const s = d, p = () => {
382
- typeof s.onChange == "function" && s.onChange();
383
- }, c = (o) => {
384
- typeof s.onApp == "function" && s.onApp(o);
385
- };
386
- return (o, r) => (l(), v(M, { stick: "right" }, {
387
- button: y(({ onToggle: t, isExpanded: i }) => [
388
- e("button", {
389
- onClick: t,
390
- class: _(["p-1 rounded-md hover:bg-secondary-10", [i ? "bg-secondary-25" : ""]])
391
- }, [
392
- h($(oe), {
393
- class: "text-secondary-base",
394
- style: E(`width: ${o.iconSize}px; height: ${o.iconSize}px`)
395
- }, null, 8, ["style"])
396
- ], 10, re)
397
- ]),
398
- menu: y(() => {
399
- var t, i, n;
400
- return [
401
- e("div", se, [
402
- e("div", ie, [
403
- h(x, {
404
- text: ((t = o.workspace) == null ? void 0 : t.name) || "",
405
- src: (i = o.workspace) == null ? void 0 : i.photo_url,
406
- size: 44,
407
- rounded: !1,
408
- class: "mx-auto"
409
- }, null, 8, ["text", "src"])
410
- ]),
411
- e("div", le, f((n = o.workspace) == null ? void 0 : n.name), 1),
412
- e("div", ce, [
413
- e("button", {
414
- class: "text-sm border border-secondary-stroke rounded px-2 py-0.5 text-secondary-content hover:text-primary-content",
415
- onClick: p
416
- }, f(o.changeLabel), 1)
417
- ])
418
- ]),
419
- e("div", ae, [
420
- e("div", ue, f(o.appsTitle), 1),
421
- e("div", de, [
422
- (l(!0), u(O, null, D(o.apps, (a) => (l(), u("button", {
423
- key: a.id,
424
- onClick: (g) => c(a),
425
- class: "p-1.5 flex flex-col items-center justify-center rounded hover:bg-secondary-10",
426
- style: { width: "88px", height: "88px" }
427
- }, [
428
- e("span", he, [
429
- h(x, {
430
- text: a.name,
431
- src: a.photo_url,
432
- size: 44,
433
- rounded: !1
434
- }, null, 8, ["text", "src"])
435
- ]),
436
- e("span", fe, f(a.name), 1)
437
- ], 8, pe))), 128))
438
- ])
439
- ])
440
- ];
441
- }),
442
- _: 1
443
- }));
444
- }
445
- });
9
+ const p = /* @__PURE__ */ o(n, [["render", t]]);
446
10
  export {
447
- xe as OneBrowserMenu,
448
- M as OneDropdown,
449
- we as OneDropdownDivider,
450
- C as OneDropdownItem,
451
- ve as OneUserMenu
11
+ O as OneBrowserMenu,
12
+ l as OneDropdown,
13
+ p as OneDropdownDivider,
14
+ u as OneDropdownItem,
15
+ w as OneUserMenu
452
16
  };
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"),e=require("./form/index.cjs"),r=require("./dropdown/index.cjs"),O=require("./common/index.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=e.OneForm;exports.OneFormFeedback=e.OneFormFeedback;exports.OneFormField=e.OneFormField;exports.OneFormInput=e.OneFormInput;exports.OneFormLabel=e.OneFormLabel;exports.OneBrowserMenu=r.OneBrowserMenu;exports.OneDropdown=r.OneDropdown;exports.OneDropdownDivider=r.OneDropdownDivider;exports.OneDropdownItem=r.OneDropdownItem;exports.OneUserMenu=r.OneUserMenu;exports.OneAvatar=O.OneAvatar;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./button/index.cjs"),r=require("./card/index.cjs"),e=require("./form/index.cjs"),n=require("./OneBrowserMenu.vue_vue_type_script_setup_true_lang-4c394828.cjs"),O=require("./dropdown/index.cjs"),t=require("./common/index.cjs");require("vue");require("./_plugin-vue_export-helper-f246444f.cjs");exports.OneButton=o.OneButton;exports.OneCard=r.OneCard;exports.OneCardBody=r.OneCardBody;exports.OneCardFooter=r.OneCardFooter;exports.OneCardHeader=r.OneCardHeader;exports.OneForm=e.OneForm;exports.OneFormFeedback=e.OneFormFeedback;exports.OneFormField=e.OneFormField;exports.OneFormInput=e.OneFormInput;exports.OneFormLabel=e.OneFormLabel;exports.OneBrowserMenu=n._sfc_main$3;exports.OneDropdown=n._sfc_main;exports.OneDropdownItem=n._sfc_main$1;exports.OneUserMenu=n._sfc_main$2;exports.OneDropdownDivider=O.OneDropdownDivider;exports.OneAvatar=t.OneAvatar;
package/dist/index.js CHANGED
@@ -1,25 +1,26 @@
1
1
  import { OneButton as O } from "./button/index.js";
2
- import { OneCard as t, OneCardBody as d, OneCardFooter as p, OneCardHeader as a } from "./card/index.js";
3
- import { OneForm as f, OneFormFeedback as i, OneFormField as x, OneFormInput as u, OneFormLabel as w } from "./form/index.js";
4
- import { OneBrowserMenu as D, OneDropdown as B, OneDropdownDivider as b, OneDropdownItem as l, OneUserMenu as s } from "./dropdown/index.js";
2
+ import { OneCard as m, OneCardBody as t, OneCardFooter as d, OneCardHeader as p } from "./card/index.js";
3
+ import { OneForm as f, OneFormFeedback as s, OneFormField as x, OneFormInput as i, OneFormLabel as u } from "./form/index.js";
4
+ import { c as C, _ as D, a as b, b as B } from "./OneBrowserMenu.vue_vue_type_script_setup_true_lang-8d34213c.js";
5
+ import { OneDropdownDivider as l } from "./dropdown/index.js";
5
6
  import { OneAvatar as I } from "./common/index.js";
6
7
  import "vue";
7
8
  import "./_plugin-vue_export-helper-dad06003.js";
8
9
  export {
9
10
  I as OneAvatar,
10
- D as OneBrowserMenu,
11
+ C as OneBrowserMenu,
11
12
  O as OneButton,
12
- t as OneCard,
13
- d as OneCardBody,
14
- p as OneCardFooter,
15
- a as OneCardHeader,
16
- B as OneDropdown,
17
- b as OneDropdownDivider,
18
- l as OneDropdownItem,
13
+ m as OneCard,
14
+ t as OneCardBody,
15
+ d as OneCardFooter,
16
+ p as OneCardHeader,
17
+ D as OneDropdown,
18
+ l as OneDropdownDivider,
19
+ b as OneDropdownItem,
19
20
  f as OneForm,
20
- i as OneFormFeedback,
21
+ s as OneFormFeedback,
21
22
  x as OneFormField,
22
- u as OneFormInput,
23
- w as OneFormLabel,
24
- s as OneUserMenu
23
+ i as OneFormInput,
24
+ u as OneFormLabel,
25
+ B as OneUserMenu
25
26
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),y=require("../_plugin-vue_export-helper-f246444f.cjs"),k=require("../OneBrowserMenu.vue_vue_type_script_setup_true_lang-4c394828.cjs");require("../common/index.cjs");const _={};function x(r,o){return e.openBlock(),e.createElementBlock("div",null," header ")}const N=y._export_sfc(_,[["render",x]]),g={items:{required:!0,type:Array},slim:{type:Boolean,default:!0}},B={route:{required:!1,type:[Object,String]},routeName:{required:!1,type:String},handler:{required:!1,type:Function,default(){return()=>{}}},label:{type:String,required:!0},icon:{type:[Function,Object]},exact:{type:Boolean,required:!1,default:!1},slim:{type:Boolean,default:!0}},V={sidebarItems:g.items,logoSrc:{type:String},app:{required:!0,type:Object},user:{type:Object,required:!0},labels:{type:Object},handlers:{type:Object}},E=e.defineComponent({__name:"OneSidebarLink",props:B,setup(r){return(o,l)=>{const n=e.resolveComponent("RouterLink");return e.openBlock(),e.createBlock(n,{to:o.routeName?{name:o.routeName}:o.route,class:e.normalizeClass(["flex items-center w-full p-[8px] rounded-lg text-sm font-medium hover:bg-primary-10-hover hover:text-primary-base transition-all text-primary-content",[o.slim?"w-[44px] h-[44px] justify-center":"h-[44px] justify-start"]]),"active-class":o.exact?"":"bg-primary-10 !text-primary-base","exact-active-class":o.exact?"bg-primary-10 !text-primary-base":"",exact:o.exact},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex flex-nowrap items-center",[o.slim?"w-[24px] h-[24px]":"w-full"]])},[o.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.icon),{key:0,class:"w-[24px] h-[24px] flex-shrink-0"})):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["whitespace-nowrap overflow-hidden text-ellipsis transition-all text-left flex-shrink",[o.slim?"w-0":"pl-1.5 w-full"]])},e.toDisplayString(o.label),3)],2)]),_:1},8,["to","active-class","exact-active-class","exact","class"])}}}),C={class:""},S={class:"space-y-2 p-2"},v=e.defineComponent({__name:"OneSidebar",props:g,setup(r){return(o,l)=>(e.openBlock(),e.createElementBlock("div",C,[e.createElementVNode("div",S,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.items,n=>(e.openBlock(),e.createBlock(E,{key:n.label,icon:n.icon,label:n.label,route:n.route,"route-name":n.routeName,exact:n.exact||!1,slim:o.slim},null,8,["icon","label","route","route-name","exact","slim"]))),128))])]))}});function O(r,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:"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"})])}const j={class:"min-h-screen relative"},q={class:"header h-[56px] flex items-center flex-nowrap absolute top-0 left-0 w-screen"},L={class:"p-2 flex-shrink-0"},$={class:"w-10 h-10 bg-white rounded-lg border border-secondary-stroke flex items-center flex-shrink-0"},M=["src"],z={class:"text-xs"},A={class:"w-full"},D={class:"w-full flex justify-end pr-2"},I={class:"flex items-center space-x-1"},P={class:"body w-full h-full"},R=e.defineComponent({__name:"OneMainLayout",props:V,setup(r){const o=r,l=e.ref(window.localStorage.getItem("sidebar-slim")==="1");e.watch(l,t=>{window.localStorage.setItem("sidebar-slim",String(t?1:0))});const n=e.computed(()=>{var t,a;return{name:((t=o.app)==null?void 0:t.workspace)||"",photo_url:((a=o.app)==null?void 0:a.photo_url)||""}});return(t,a)=>{var s,c,i,p,u,d,m,h,f,b;const w=e.resolveComponent("RouterLink");return e.openBlock(),e.createElementBlock("div",j,[e.createElementVNode("div",q,[e.createElementVNode("div",L,[e.createElementVNode("button",{onClick:a[0]||(a[0]=F=>l.value=!l.value),class:"w-[44px] h-[44px] p-[8px] flex items-center justify-center hover:text-secondary-content"},[e.createVNode(e.unref(O),{class:"w-[24px] h-[24px]"})])]),e.createElementVNode("div",$,[t.logoSrc!=null?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.logoSrc,class:"w-8 h-8 mx-auto",alt:"logo"},null,8,M)):e.createCommentVNode("",!0)]),t.app!=null?(e.openBlock(),e.createBlock(w,{key:0,to:"/",class:"pl-2 max-w-xs"},{default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(t.app.name),1),e.createElementVNode("div",z,e.toDisplayString(t.app.workspace),1)]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",A,[e.createElementVNode("div",D,[e.createElementVNode("div",I,[e.createVNode(k._sfc_main$3,{workspace:n.value,apps:((s=t.app)==null?void 0:s.apps)||[],"change-label":((c=t.labels)==null?void 0:c.change)||"Change","apps-title":((i=t.labels)==null?void 0:i.apps)||"Apps","on-app":(p=t.handlers)==null?void 0:p.onApp,"on-change":(u=t.handlers)==null?void 0:u.onChange,onOpen:(d=t.handlers)==null?void 0:d.onBrowse},null,8,["workspace","apps","change-label","apps-title","on-app","on-change","onOpen"]),e.createVNode(k._sfc_main$2,{user:t.user,"account-label":((m=t.labels)==null?void 0:m.account)||"Account","logout-label":((h=t.labels)==null?void 0:h.logout)||"Logout","on-account":(f=t.handlers)==null?void 0:f.onAccount,"on-logout":(b=t.handlers)==null?void 0:b.onLogout},null,8,["user","account-label","logout-label","on-account","on-logout"])])])])]),e.createElementVNode("div",{class:e.normalizeClass(["sidebar transition-all absolute top-[56px] left-0 h-full",[l.value?"w-[60px]":"w-60"]])},[e.createVNode(v,{slim:l.value,items:t.sidebarItems},null,8,["slim","items"])],2),e.createElementVNode("div",P,[e.createElementVNode("div",{class:e.normalizeClass(["content transition-all pt-[56px]",[l.value?"pl-[60px]":"pl-60"]])},[e.renderSlot(t.$slots,"default")],2)])])}}});exports.OneHeader=N;exports.OneMainLayout=R;exports.OneSidebar=v;
@@ -0,0 +1,3 @@
1
+ export { default as OneHeader } from './OneHeader.vue';
2
+ export { default as OneSidebar } from './OneSidebar.vue';
3
+ export { default as OneMainLayout } from './OneMainLayout.vue';
@@ -0,0 +1,228 @@
1
+ import { openBlock as a, createElementBlock as l, defineComponent as h, resolveComponent as O, createBlock as u, normalizeClass as p, withCtx as L, createElementVNode as s, resolveDynamicComponent as $, createCommentVNode as d, toDisplayString as m, Fragment as q, renderList as B, ref as N, watch as A, computed as I, createVNode as c, unref as M, renderSlot as R } from "vue";
2
+ import { _ as F } from "../_plugin-vue_export-helper-dad06003.js";
3
+ import { c as P, b as V } from "../OneBrowserMenu.vue_vue_type_script_setup_true_lang-8d34213c.js";
4
+ import "../common/index.js";
5
+ const D = {};
6
+ function E(r, t) {
7
+ return a(), l("div", null, " header ");
8
+ }
9
+ const ce = /* @__PURE__ */ F(D, [["render", E]]), j = {
10
+ items: {
11
+ required: !0,
12
+ type: Array
13
+ },
14
+ slim: {
15
+ type: Boolean,
16
+ default: !0
17
+ }
18
+ }, z = {
19
+ route: {
20
+ required: !1,
21
+ type: [Object, String]
22
+ },
23
+ routeName: {
24
+ required: !1,
25
+ type: String
26
+ },
27
+ handler: {
28
+ required: !1,
29
+ type: Function,
30
+ default() {
31
+ return () => {
32
+ };
33
+ }
34
+ },
35
+ label: {
36
+ type: String,
37
+ required: !0
38
+ },
39
+ icon: {
40
+ type: [Function, Object]
41
+ },
42
+ exact: {
43
+ type: Boolean,
44
+ required: !1,
45
+ default: !1
46
+ },
47
+ slim: {
48
+ type: Boolean,
49
+ default: !0
50
+ }
51
+ }, H = {
52
+ sidebarItems: j.items,
53
+ logoSrc: {
54
+ type: String
55
+ },
56
+ app: {
57
+ required: !0,
58
+ type: Object
59
+ },
60
+ user: {
61
+ type: Object,
62
+ required: !0
63
+ },
64
+ labels: {
65
+ type: Object
66
+ },
67
+ handlers: {
68
+ type: Object
69
+ }
70
+ }, G = /* @__PURE__ */ h({
71
+ __name: "OneSidebarLink",
72
+ props: z,
73
+ setup(r) {
74
+ return (t, n) => {
75
+ const o = O("RouterLink");
76
+ return a(), u(o, {
77
+ to: t.routeName ? { name: t.routeName } : t.route,
78
+ class: p(["flex items-center w-full p-[8px] rounded-lg text-sm font-medium hover:bg-primary-10-hover hover:text-primary-base transition-all text-primary-content", [t.slim ? "w-[44px] h-[44px] justify-center" : "h-[44px] justify-start"]]),
79
+ "active-class": t.exact ? "" : "bg-primary-10 !text-primary-base",
80
+ "exact-active-class": t.exact ? "bg-primary-10 !text-primary-base" : "",
81
+ exact: t.exact
82
+ }, {
83
+ default: L(() => [
84
+ s("div", {
85
+ class: p(["flex flex-nowrap items-center", [t.slim ? "w-[24px] h-[24px]" : "w-full"]])
86
+ }, [
87
+ t.icon ? (a(), u($(t.icon), {
88
+ key: 0,
89
+ class: "w-[24px] h-[24px] flex-shrink-0"
90
+ })) : d("", !0),
91
+ s("div", {
92
+ class: p(["whitespace-nowrap overflow-hidden text-ellipsis transition-all text-left flex-shrink", [t.slim ? "w-0" : "pl-1.5 w-full"]])
93
+ }, m(t.label), 3)
94
+ ], 2)
95
+ ]),
96
+ _: 1
97
+ }, 8, ["to", "active-class", "exact-active-class", "exact", "class"]);
98
+ };
99
+ }
100
+ }), J = { class: "" }, K = { class: "space-y-2 p-2" }, Q = /* @__PURE__ */ h({
101
+ __name: "OneSidebar",
102
+ props: j,
103
+ setup(r) {
104
+ return (t, n) => (a(), l("div", J, [
105
+ s("div", K, [
106
+ (a(!0), l(q, null, B(t.items, (o) => (a(), u(G, {
107
+ key: o.label,
108
+ icon: o.icon,
109
+ label: o.label,
110
+ route: o.route,
111
+ "route-name": o.routeName,
112
+ exact: o.exact || !1,
113
+ slim: t.slim
114
+ }, null, 8, ["icon", "label", "route", "route-name", "exact", "slim"]))), 128))
115
+ ])
116
+ ]));
117
+ }
118
+ });
119
+ function T(r, t) {
120
+ return a(), l("svg", {
121
+ xmlns: "http://www.w3.org/2000/svg",
122
+ fill: "none",
123
+ viewBox: "0 0 24 24",
124
+ "stroke-width": "1.8",
125
+ stroke: "currentColor",
126
+ "aria-hidden": "true"
127
+ }, [
128
+ s("path", {
129
+ "stroke-linecap": "round",
130
+ "stroke-linejoin": "round",
131
+ d: "M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"
132
+ })
133
+ ]);
134
+ }
135
+ const U = { class: "min-h-screen relative" }, W = { class: "header h-[56px] flex items-center flex-nowrap absolute top-0 left-0 w-screen" }, X = { class: "p-2 flex-shrink-0" }, Y = { class: "w-10 h-10 bg-white rounded-lg border border-secondary-stroke flex items-center flex-shrink-0" }, Z = ["src"], ee = { class: "text-xs" }, te = { class: "w-full" }, se = { class: "w-full flex justify-end pr-2" }, oe = { class: "flex items-center space-x-1" }, ae = { class: "body w-full h-full" }, ue = /* @__PURE__ */ h({
136
+ __name: "OneMainLayout",
137
+ props: H,
138
+ setup(r) {
139
+ const t = r, n = N(window.localStorage.getItem("sidebar-slim") === "1");
140
+ A(n, (e) => {
141
+ window.localStorage.setItem("sidebar-slim", String(e ? 1 : 0));
142
+ });
143
+ const o = I(() => {
144
+ var e, i;
145
+ return {
146
+ name: ((e = t.app) == null ? void 0 : e.workspace) || "",
147
+ photo_url: ((i = t.app) == null ? void 0 : i.photo_url) || ""
148
+ };
149
+ });
150
+ return (e, i) => {
151
+ var f, b, w, v, y, g, _, x, k, S;
152
+ const C = O("RouterLink");
153
+ return a(), l("div", U, [
154
+ s("div", W, [
155
+ s("div", X, [
156
+ s("button", {
157
+ onClick: i[0] || (i[0] = (ne) => n.value = !n.value),
158
+ class: "w-[44px] h-[44px] p-[8px] flex items-center justify-center hover:text-secondary-content"
159
+ }, [
160
+ c(M(T), { class: "w-[24px] h-[24px]" })
161
+ ])
162
+ ]),
163
+ s("div", Y, [
164
+ e.logoSrc != null ? (a(), l("img", {
165
+ key: 0,
166
+ src: e.logoSrc,
167
+ class: "w-8 h-8 mx-auto",
168
+ alt: "logo"
169
+ }, null, 8, Z)) : d("", !0)
170
+ ]),
171
+ e.app != null ? (a(), u(C, {
172
+ key: 0,
173
+ to: "/",
174
+ class: "pl-2 max-w-xs"
175
+ }, {
176
+ default: L(() => [
177
+ s("div", null, m(e.app.name), 1),
178
+ s("div", ee, m(e.app.workspace), 1)
179
+ ]),
180
+ _: 1
181
+ })) : d("", !0),
182
+ s("div", te, [
183
+ s("div", se, [
184
+ s("div", oe, [
185
+ c(P, {
186
+ workspace: o.value,
187
+ apps: ((f = e.app) == null ? void 0 : f.apps) || [],
188
+ "change-label": ((b = e.labels) == null ? void 0 : b.change) || "Change",
189
+ "apps-title": ((w = e.labels) == null ? void 0 : w.apps) || "Apps",
190
+ "on-app": (v = e.handlers) == null ? void 0 : v.onApp,
191
+ "on-change": (y = e.handlers) == null ? void 0 : y.onChange,
192
+ onOpen: (g = e.handlers) == null ? void 0 : g.onBrowse
193
+ }, null, 8, ["workspace", "apps", "change-label", "apps-title", "on-app", "on-change", "onOpen"]),
194
+ c(V, {
195
+ user: e.user,
196
+ "account-label": ((_ = e.labels) == null ? void 0 : _.account) || "Account",
197
+ "logout-label": ((x = e.labels) == null ? void 0 : x.logout) || "Logout",
198
+ "on-account": (k = e.handlers) == null ? void 0 : k.onAccount,
199
+ "on-logout": (S = e.handlers) == null ? void 0 : S.onLogout
200
+ }, null, 8, ["user", "account-label", "logout-label", "on-account", "on-logout"])
201
+ ])
202
+ ])
203
+ ])
204
+ ]),
205
+ s("div", {
206
+ class: p(["sidebar transition-all absolute top-[56px] left-0 h-full", [n.value ? "w-[60px]" : "w-60"]])
207
+ }, [
208
+ c(Q, {
209
+ slim: n.value,
210
+ items: e.sidebarItems
211
+ }, null, 8, ["slim", "items"])
212
+ ], 2),
213
+ s("div", ae, [
214
+ s("div", {
215
+ class: p(["content transition-all pt-[56px]", [n.value ? "pl-[60px]" : "pl-60"]])
216
+ }, [
217
+ R(e.$slots, "default")
218
+ ], 2)
219
+ ])
220
+ ]);
221
+ };
222
+ }
223
+ });
224
+ export {
225
+ ce as OneHeader,
226
+ ue as OneMainLayout,
227
+ Q as OneSidebar
228
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneb/ui-vue",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -41,6 +41,10 @@
41
41
  "types": "./dist/common/index.d.ts",
42
42
  "import": "./dist/common/index.js"
43
43
  },
44
+ "./layout": {
45
+ "types": "./dist/layout/index.d.ts",
46
+ "import": "./dist/layout/index.js"
47
+ },
44
48
  "./icons": {
45
49
  "types": "./dist/icons/outline/index.d.ts",
46
50
  "import": "./dist/icons/outline/esm/index.js",