@oneb/ui-vue 0.0.5 → 0.0.6
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/README.md +7 -4
- package/dist/dropdown/index.cjs +1 -1
- package/dist/dropdown/index.js +1 -1
- package/dist/dropdown/menu.d.ts +8 -0
- package/dist/index-3196cf32.cjs +1 -0
- package/dist/{index-6f93552a.js → index-6423ecce.js} +70 -62
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +5 -1
- package/dist/index-26c86446.cjs +0 -1
package/README.md
CHANGED
|
@@ -19,27 +19,30 @@
|
|
|
19
19
|
</template>
|
|
20
20
|
|
|
21
21
|
<script setup>
|
|
22
|
-
import { OneButton, OneLink, OneCard, OneCardHeader, OneCardBody } from '
|
|
22
|
+
import { OneButton, OneLink, OneCard, OneCardHeader, OneCardBody } from '@oneb/ui-vue'
|
|
23
23
|
</script>
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
## Setup
|
|
27
27
|
|
|
28
28
|
### 1. src/assets/mains.css
|
|
29
|
-
add line: `@import '
|
|
29
|
+
add line: `@import '@oneb/ui-vue/style.css';`
|
|
30
30
|
add line: `@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800;900&display=swap');`
|
|
31
31
|
|
|
32
32
|
### 2. tailwind.config.cjs
|
|
33
33
|
|
|
34
34
|
1. Import config `const onebui = require('onebui-vue/tailwind.config')`
|
|
35
|
-
2. Add `'
|
|
35
|
+
2. Add `'./node_modules/@oneb/ui-vue/dist/**/*.{vue,js,ts,jsx,tsx}'` to `content`
|
|
36
36
|
3. Extend config
|
|
37
37
|
|
|
38
38
|
```
|
|
39
39
|
const onebui = require('onebui-vue/tailwind.config')
|
|
40
40
|
|
|
41
41
|
module.exports = {
|
|
42
|
-
content: [
|
|
42
|
+
content: [
|
|
43
|
+
...,
|
|
44
|
+
"./node_modules/@oneb/ui-vue/dist/**/*.{vue,js,ts,jsx,tsx}"
|
|
45
|
+
],
|
|
43
46
|
theme: onebui.theme,
|
|
44
47
|
plugins: [require('@tailwindcss/forms')]
|
|
45
48
|
}
|
package/dist/dropdown/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index-3196cf32.cjs");require("vue");require("../_plugin-vue_export-helper-f246444f.cjs");exports.OneBrowserMenu=e._sfc_main$3;exports.OneDropdown=e._sfc_main;exports.OneDropdownDivider=e.OneDropdownDivider;exports.OneDropdownItem=e._sfc_main$1;exports.OneUserMenu=e._sfc_main$2;
|
package/dist/dropdown/index.js
CHANGED
package/dist/dropdown/menu.d.ts
CHANGED
|
@@ -16,6 +16,10 @@ export declare const userMenuProps: {
|
|
|
16
16
|
}[]>;
|
|
17
17
|
default: () => any[];
|
|
18
18
|
};
|
|
19
|
+
iconSize: {
|
|
20
|
+
type: StringConstructor;
|
|
21
|
+
default: string;
|
|
22
|
+
};
|
|
19
23
|
accountLabel: {
|
|
20
24
|
type: StringConstructor;
|
|
21
25
|
default: string;
|
|
@@ -48,6 +52,10 @@ export declare const browserMenuProps: {
|
|
|
48
52
|
}[]>;
|
|
49
53
|
required: boolean;
|
|
50
54
|
};
|
|
55
|
+
iconSize: {
|
|
56
|
+
type: StringConstructor;
|
|
57
|
+
default: string;
|
|
58
|
+
};
|
|
51
59
|
appsTitle: {
|
|
52
60
|
type: StringConstructor;
|
|
53
61
|
default: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),f=require("./_plugin-vue_export-helper-f246444f.cjs"),g={title:{type:String},stick:{type:String,default:"right"}},k={variant:{type:String,default:"primary"},label:{type:String},icon:{type:[Function,Object]}},y=["data-opened"],v={key:0,class:"text-sm text-secondary-content px-3 py-2 text-left"},h=e.defineComponent({__name:"OneDropdown",props:g,emits:["open"],setup(d,{emit:o}){const a=d,c=e.ref(!1),r=e.ref(null),l=()=>{c.value=!c.value,c.value&&o("open")};e.provide("OneDropdown",{onToggle:l});const t=e.computed(()=>{const n=r.value!=null&&r.value.offsetLeft<270;return r.value!=null&&r.value.offsetTop+270>window.innerHeight?"up"+(n?"-right":"-left"):"down"+(n?"-right":"-left")}),s=e.computed(()=>{const n=["absolute z-10 w-fit rounded-md bg-white","py-1 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none","overflow-auto max-h-[540px] min-w-[150px] max-w-[540px]"];return t.value==="up"?n.push("bottom-1 mb-10"):t.value==="down"?n.push("top-1 mt-10"):t.value==="up-right"?n.push("left-0 bottom-1 mb-10"):t.value==="down-right"&&n.push("left-0 top-1 mt-10"),a.stick==="right"?n.push("right-0"):a.stick==="left"&&n.push("left-0"),n});return(n,i)=>(e.openBlock(),e.createElementBlock("div",{class:"relative inline-block",ref_key:"menuRef",ref:r,"data-opened":c.value},[e.renderSlot(n.$slots,"button",e.normalizeProps(e.guardReactiveProps({onToggle:l,isExpanded:c.value}))),c.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed top-0 left-0 w-screen h-screen z-10",onClick:l})):e.createCommentVNode("",!0),e.createVNode(e.Transition,{"enter-active-class":"transition ease-out duration-100","enter-from-class":"transform opacity-0 scale-95","enter-to-class":"transform opacity-100 scale-100","leave-active-class":"transition ease-in duration-75","leave-from-class":"transform opacity-100 scale-100","leave-to-class":"transform opacity-0 scale-95"},{default:e.withCtx(()=>[c.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["menu",s.value]),role:"menu","aria-orientation":"vertical",tabindex:"-1"},[n.title?(e.openBlock(),e.createElementBlock("div",v,e.toDisplayString(n.title),1)):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"menu",e.normalizeProps(e.guardReactiveProps({onToggle:l})))],2)):e.createCommentVNode("",!0)]),_:3})],8,y))}}),x=["onClick"],m=e.defineComponent({__name:"OneDropdownItem",props:k,emits:["click"],setup(d,{emit:o}){const a=d,c=e.inject("OneDropdown"),r=()=>{c!==void 0&&c.onToggle(),o("click")},l=e.computed(()=>{const t=[];return a.variant==="secondary"?t.push("text-secondary-content hover:bg-secondary-body-hover"):a.variant==="danger"?t.push("text-danger-content hover:bg-danger-10"):a.variant==="warning"?t.push("text-warning-content hover:bg-warning-10"):a.variant==="info"?t.push("text-info-content hover:bg-info-10"):t.push("hover:bg-secondary-body-hover"),t});return(t,s)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["px-3 py-1.5 flex items-center space-x-3 w-full whitespace-nowrap",l.value]),onClick:e.withModifiers(r,["prevent"])},[t.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.icon),{key:0,class:"w-4 h-4"})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(t.label),1)],10,x))}}),w={},_={class:"border-t border-secondary-stroke my-1"};function b(d,o){return e.openBlock(),e.createElementBlock("div",_)}const C=f._export_sfc(w,[["render",b]]),E={size:{type:[String,Number],default:"50"},rounded:{type:Boolean,default:!1},text:{type:String,required:!1,default:""},src:{type:[String,null],required:!1}},V=["src"],p=e.defineComponent({__name:"OneAvatar",props:E,setup(d){const o=d,a=e.computed(()=>{const t=o.text.trim().split(" ");return t.length<2?o.text.slice(0,2).toUpperCase():t.map(s=>s.slice(0,1)).join("").toUpperCase()}),c=e.computed(()=>({fill:"rgba(255, 255, 255, .75)",fontSize:`${Number(o.size)*.4}px`})),r=e.computed(()=>{const t=o.text.split("").map(i=>i.charCodeAt(0)).reduce((i,u)=>i+u,0),n=`hsl(${360/26*t}, 68%, 48%)`;return{width:`${o.size}px`,height:`${o.size}px`,borderRadius:o.rounded?"100%":"9%",background:n}}),l=e.computed(()=>({width:`${o.size}px`,height:`${o.size}px`,borderRadius:o.rounded?"100%":"9%"}));return(t,s)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(l.value),class:"overflow-hidden"},[t.src?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.src,alt:"",class:"w-full h-full"},null,8,V)):(e.openBlock(),e.createElementBlock("svg",{key:1,style:e.normalizeStyle(r.value),class:"block"},[a.value?(e.openBlock(),e.createElementBlock("text",{key:0,x:"50%",y:"50%","text-anchor":"middle","dominant-baseline":"central",class:"font-light",style:e.normalizeStyle(c.value)},e.toDisplayString(a.value),5)):e.createCommentVNode("",!0)],4))],4))}});function B(d,o){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"})])}function N(d,o){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15m3 0l3-3m0 0l-3-3m3 3H9"})])}const S={user:{type:Object,required:!0},menu:{type:Array,default:()=>[]},iconSize:{type:String,default:"34"},accountLabel:{type:String,default:"Account"},logoutLabel:{type:String,default:"Logout"},onAccount:{type:Function},onLogout:{type:Function}},z={workspace:{type:Object,required:!0},apps:{type:Array,required:!0},iconSize:{type:String,default:"18"},appsTitle:{type:String,default:"Apps"},changeLabel:{type:String,default:"Change"},onChange:{type:Function},onApp:{type:Function}},$=["onClick"],D={class:"space-y-2 text-center py-6",style:{width:"240px"}},A={class:"text-sm text-secondary-content"},L={class:"px-2"},O=e.defineComponent({__name:"OneUserMenu",props:S,setup(d){const o=d,a=e.computed(()=>{var l;return(l=o.menu)==null?void 0:l.map(t=>{let s={label:t.label};t.icon!=null&&(s={...s,icon:t.icon});const n=typeof t.click=="function"?t.click:()=>{};return{key:t.label,args:s,click:n}})}),c=()=>{typeof o.onAccount=="function"&&o.onAccount()},r=()=>{typeof o.onLogout=="function"&&o.onLogout()};return(l,t)=>(e.openBlock(),e.createBlock(h,{stick:"right"},{button:e.withCtx(({onToggle:s,isExpanded:n})=>{var i,u;return[e.createElementVNode("button",{onClick:s,class:e.normalizeClass(["p-1 rounded-full hover:bg-secondary-10",[n?"bg-secondary-25":""]])},[e.createVNode(p,{text:((i=l.user)==null?void 0:i.name)||"",size:l.iconSize,src:(u=l.user)==null?void 0:u.photo_url,rounded:!0},null,8,["text","size","src"])],10,$)]}),menu:e.withCtx(()=>{var s,n,i;return[e.createElementVNode("div",D,[e.createElementVNode("div",null,[e.createVNode(p,{text:((s=l.user)==null?void 0:s.name)||"",size:80,rounded:!0,class:"mx-auto"},null,8,["text"])]),e.createElementVNode("div",null,[e.createElementVNode("div",null,e.toDisplayString((n=l.user)==null?void 0:n.name),1),e.createElementVNode("div",A,e.toDisplayString((i=l.user)==null?void 0:i.email),1)])]),e.createElementVNode("div",L,[e.createVNode(m,{icon:e.unref(B),label:l.accountLabel,class:"rounded",onClick:c},null,8,["icon","label"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,u=>(e.openBlock(),e.createBlock(m,e.mergeProps({key:u.key},u.args,{onClick:u.click}),null,16,["onClick"]))),128)),e.createVNode(m,{icon:e.unref(N),label:l.logoutLabel,class:"rounded",onClick:r},null,8,["icon","label"])])]}),_:1}))}});function P(d,o){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"17.16",y:"3.9",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"10.53",y:"3.9",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"3.9",y:"3.9",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"17.16",y:"10.53",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"10.53",y:"10.53",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"3.9",y:"10.53",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"17.16",y:"17.16",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"10.53",y:"17.16",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"3.9",y:"17.16",fill:"currentColor","stroke-width":"1.8",rx:"1.1"})])}const j=["onClick"],M={class:"space-x-2 flex items-center px-3 py-2",style:{width:"300px"}},q={class:"flex-shrink-0"},F={class:"w-full text-left"},R={class:"flex-shrink-0"},T={class:"px-3 py-2 border-t border-secondary-stroke"},H={class:"text-secondary-content text-left pb-1 text-sm"},I={class:"grid grid-cols-3 gap-1"},U=["onClick"],G={class:"block bg-white mx-auto flex-shrink-0 border border-secondary-stroke p-1 rounded-lg"},J={class:"w-full overflow-hidden text-ellipsis whitespace-nowrap text-center text-sm mt-1"},K=e.defineComponent({__name:"OneBrowserMenu",props:z,setup(d){const o=d,a=()=>{typeof o.onChange=="function"&&o.onChange()},c=r=>{typeof o.onApp=="function"&&o.onApp(r)};return(r,l)=>(e.openBlock(),e.createBlock(h,{stick:"right"},{button:e.withCtx(({onToggle:t,isExpanded:s})=>[e.createElementVNode("button",{onClick:t,class:e.normalizeClass(["p-1 rounded-md hover:bg-secondary-10",[s?"bg-secondary-25":""]])},[e.createVNode(e.unref(P),{class:"text-secondary-base",style:e.normalizeStyle(`width: ${r.iconSize}px; height: ${r.iconSize}px`)},null,8,["style"])],10,j)]),menu:e.withCtx(()=>{var t,s,n;return[e.createElementVNode("div",M,[e.createElementVNode("div",q,[e.createVNode(p,{text:((t=r.workspace)==null?void 0:t.name)||"",src:(s=r.workspace)==null?void 0:s.photo_url,size:44,rounded:!1,class:"mx-auto"},null,8,["text","src"])]),e.createElementVNode("div",F,e.toDisplayString((n=r.workspace)==null?void 0:n.name),1),e.createElementVNode("div",R,[e.createElementVNode("button",{class:"text-sm border border-secondary-stroke rounded px-2 py-0.5 text-secondary-content hover:text-primary-content",onClick:a},e.toDisplayString(r.changeLabel),1)])]),e.createElementVNode("div",T,[e.createElementVNode("div",H,e.toDisplayString(r.appsTitle),1),e.createElementVNode("div",I,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.apps,i=>(e.openBlock(),e.createElementBlock("button",{key:i.id,onClick:u=>c(i),class:"p-1.5 flex flex-col items-center justify-center rounded hover:bg-secondary-10",style:{width:"88px",height:"88px"}},[e.createElementVNode("span",G,[e.createVNode(p,{text:i.name,src:i.photo_url,size:44,rounded:!1},null,8,["text","src"])]),e.createElementVNode("span",J,e.toDisplayString(i.name),1)],8,U))),128))])])]}),_:1}))}});exports.OneDropdownDivider=C;exports._sfc_main=h;exports._sfc_main$1=m;exports._sfc_main$2=O;exports._sfc_main$3=K;exports._sfc_main$4=p;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as x, ref as S, provide as D, computed as g, openBlock as l, createElementBlock as u, renderSlot as z, normalizeProps as A, guardReactiveProps as L, createCommentVNode as m, createVNode as y, Transition as M, withCtx as v, normalizeClass as _, toDisplayString as f, inject as P, withModifiers as F, createBlock as k, resolveDynamicComponent as T, createElementVNode as t, normalizeStyle as w, unref as $, Fragment as O, renderList as j, mergeProps as q } from "vue";
|
|
2
2
|
import { _ as N } from "./_plugin-vue_export-helper-dad06003.js";
|
|
3
3
|
const R = {
|
|
4
4
|
title: {
|
|
@@ -22,12 +22,12 @@ const R = {
|
|
|
22
22
|
}, E = ["data-opened"], H = {
|
|
23
23
|
key: 0,
|
|
24
24
|
class: "text-sm text-secondary-content px-3 py-2 text-left"
|
|
25
|
-
}, B = /* @__PURE__ */
|
|
25
|
+
}, B = /* @__PURE__ */ x({
|
|
26
26
|
__name: "OneDropdown",
|
|
27
27
|
props: R,
|
|
28
28
|
emits: ["open"],
|
|
29
29
|
setup(p, { emit: n }) {
|
|
30
|
-
const d = p, c =
|
|
30
|
+
const d = p, c = S(!1), r = S(null), s = () => {
|
|
31
31
|
c.value = !c.value, c.value && n("open");
|
|
32
32
|
};
|
|
33
33
|
D("OneDropdown", {
|
|
@@ -36,7 +36,7 @@ const R = {
|
|
|
36
36
|
const e = g(() => {
|
|
37
37
|
const o = r.value != null && r.value.offsetLeft < 270;
|
|
38
38
|
return r.value != null && r.value.offsetTop + 270 > window.innerHeight ? "up" + (o ? "-right" : "-left") : "down" + (o ? "-right" : "-left");
|
|
39
|
-
}),
|
|
39
|
+
}), i = g(() => {
|
|
40
40
|
const o = [
|
|
41
41
|
"absolute z-10 w-fit rounded-md bg-white",
|
|
42
42
|
"py-1 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",
|
|
@@ -44,14 +44,14 @@ const R = {
|
|
|
44
44
|
];
|
|
45
45
|
return e.value === "up" ? o.push("bottom-1 mb-10") : e.value === "down" ? o.push("top-1 mt-10") : e.value === "up-right" ? o.push("left-0 bottom-1 mb-10") : e.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;
|
|
46
46
|
});
|
|
47
|
-
return (o, a) => (
|
|
47
|
+
return (o, a) => (l(), u("div", {
|
|
48
48
|
class: "relative inline-block",
|
|
49
49
|
ref_key: "menuRef",
|
|
50
50
|
ref: r,
|
|
51
51
|
"data-opened": c.value
|
|
52
52
|
}, [
|
|
53
|
-
|
|
54
|
-
c.value ? (
|
|
53
|
+
z(o.$slots, "button", A(L({ onToggle: s, isExpanded: c.value }))),
|
|
54
|
+
c.value ? (l(), u("div", {
|
|
55
55
|
key: 0,
|
|
56
56
|
class: "fixed top-0 left-0 w-screen h-screen z-10",
|
|
57
57
|
onClick: s
|
|
@@ -64,23 +64,23 @@ const R = {
|
|
|
64
64
|
"leave-from-class": "transform opacity-100 scale-100",
|
|
65
65
|
"leave-to-class": "transform opacity-0 scale-95"
|
|
66
66
|
}, {
|
|
67
|
-
default:
|
|
68
|
-
c.value ? (
|
|
67
|
+
default: v(() => [
|
|
68
|
+
c.value ? (l(), u("div", {
|
|
69
69
|
key: 0,
|
|
70
|
-
class: _(["menu",
|
|
70
|
+
class: _(["menu", i.value]),
|
|
71
71
|
role: "menu",
|
|
72
72
|
"aria-orientation": "vertical",
|
|
73
73
|
tabindex: "-1"
|
|
74
74
|
}, [
|
|
75
|
-
o.title ? (
|
|
76
|
-
|
|
75
|
+
o.title ? (l(), u("div", H, f(o.title), 1)) : m("", !0),
|
|
76
|
+
z(o.$slots, "menu", A(L({ onToggle: s })))
|
|
77
77
|
], 2)) : m("", !0)
|
|
78
78
|
]),
|
|
79
79
|
_: 3
|
|
80
80
|
})
|
|
81
81
|
], 8, E));
|
|
82
82
|
}
|
|
83
|
-
}), I = ["onClick"], C = /* @__PURE__ */
|
|
83
|
+
}), I = ["onClick"], C = /* @__PURE__ */ x({
|
|
84
84
|
__name: "OneDropdownItem",
|
|
85
85
|
props: V,
|
|
86
86
|
emits: ["click"],
|
|
@@ -91,11 +91,11 @@ const R = {
|
|
|
91
91
|
const e = [];
|
|
92
92
|
return d.variant === "secondary" ? e.push("text-secondary-content hover:bg-secondary-body-hover") : d.variant === "danger" ? e.push("text-danger-content hover:bg-danger-10") : d.variant === "warning" ? e.push("text-warning-content hover:bg-warning-10") : d.variant === "info" ? e.push("text-info-content hover:bg-info-10") : e.push("hover:bg-secondary-body-hover"), e;
|
|
93
93
|
});
|
|
94
|
-
return (e,
|
|
94
|
+
return (e, i) => (l(), u("button", {
|
|
95
95
|
class: _(["px-3 py-1.5 flex items-center space-x-3 w-full whitespace-nowrap", s.value]),
|
|
96
96
|
onClick: F(r, ["prevent"])
|
|
97
97
|
}, [
|
|
98
|
-
e.icon ? (
|
|
98
|
+
e.icon ? (l(), k(T(e.icon), {
|
|
99
99
|
key: 0,
|
|
100
100
|
class: "w-4 h-4"
|
|
101
101
|
})) : m("", !0),
|
|
@@ -104,9 +104,9 @@ const R = {
|
|
|
104
104
|
}
|
|
105
105
|
}), U = {}, G = { class: "border-t border-secondary-stroke my-1" };
|
|
106
106
|
function J(p, n) {
|
|
107
|
-
return
|
|
107
|
+
return l(), u("div", G);
|
|
108
108
|
}
|
|
109
|
-
const
|
|
109
|
+
const ve = /* @__PURE__ */ N(U, [["render", J]]), K = {
|
|
110
110
|
size: {
|
|
111
111
|
type: [String, Number],
|
|
112
112
|
default: "50"
|
|
@@ -124,13 +124,13 @@ const xe = /* @__PURE__ */ N(U, [["render", J]]), K = {
|
|
|
124
124
|
type: [String, null],
|
|
125
125
|
required: !1
|
|
126
126
|
}
|
|
127
|
-
}, Q = ["src"],
|
|
127
|
+
}, Q = ["src"], b = /* @__PURE__ */ x({
|
|
128
128
|
__name: "OneAvatar",
|
|
129
129
|
props: K,
|
|
130
130
|
setup(p) {
|
|
131
131
|
const n = p, d = g(() => {
|
|
132
132
|
const e = n.text.trim().split(" ");
|
|
133
|
-
return e.length < 2 ? n.text.slice(0, 2).toUpperCase() : e.map((
|
|
133
|
+
return e.length < 2 ? n.text.slice(0, 2).toUpperCase() : e.map((i) => i.slice(0, 1)).join("").toUpperCase();
|
|
134
134
|
}), c = g(() => ({
|
|
135
135
|
fill: "rgba(255, 255, 255, .75)",
|
|
136
136
|
fontSize: `${Number(n.size) * 0.4}px`
|
|
@@ -147,35 +147,35 @@ const xe = /* @__PURE__ */ N(U, [["render", J]]), K = {
|
|
|
147
147
|
height: `${n.size}px`,
|
|
148
148
|
borderRadius: n.rounded ? "100%" : "9%"
|
|
149
149
|
}));
|
|
150
|
-
return (e,
|
|
151
|
-
style:
|
|
150
|
+
return (e, i) => (l(), u("div", {
|
|
151
|
+
style: w(s.value),
|
|
152
152
|
class: "overflow-hidden"
|
|
153
153
|
}, [
|
|
154
|
-
e.src ? (
|
|
154
|
+
e.src ? (l(), u("img", {
|
|
155
155
|
key: 0,
|
|
156
156
|
src: e.src,
|
|
157
157
|
alt: "",
|
|
158
158
|
class: "w-full h-full"
|
|
159
|
-
}, null, 8, Q)) : (
|
|
159
|
+
}, null, 8, Q)) : (l(), u("svg", {
|
|
160
160
|
key: 1,
|
|
161
|
-
style:
|
|
161
|
+
style: w(r.value),
|
|
162
162
|
class: "block"
|
|
163
163
|
}, [
|
|
164
|
-
d.value ? (
|
|
164
|
+
d.value ? (l(), u("text", {
|
|
165
165
|
key: 0,
|
|
166
166
|
x: "50%",
|
|
167
167
|
y: "50%",
|
|
168
168
|
"text-anchor": "middle",
|
|
169
169
|
"dominant-baseline": "central",
|
|
170
170
|
class: "font-light",
|
|
171
|
-
style:
|
|
171
|
+
style: w(c.value)
|
|
172
172
|
}, f(d.value), 5)) : m("", !0)
|
|
173
173
|
], 4))
|
|
174
174
|
], 4));
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
177
|
function W(p, n) {
|
|
178
|
-
return
|
|
178
|
+
return l(), u("svg", {
|
|
179
179
|
xmlns: "http://www.w3.org/2000/svg",
|
|
180
180
|
fill: "none",
|
|
181
181
|
viewBox: "0 0 24 24",
|
|
@@ -191,7 +191,7 @@ function W(p, n) {
|
|
|
191
191
|
]);
|
|
192
192
|
}
|
|
193
193
|
function X(p, n) {
|
|
194
|
-
return
|
|
194
|
+
return l(), u("svg", {
|
|
195
195
|
xmlns: "http://www.w3.org/2000/svg",
|
|
196
196
|
fill: "none",
|
|
197
197
|
viewBox: "0 0 24 24",
|
|
@@ -215,6 +215,10 @@ const Y = {
|
|
|
215
215
|
type: Array,
|
|
216
216
|
default: () => []
|
|
217
217
|
},
|
|
218
|
+
iconSize: {
|
|
219
|
+
type: String,
|
|
220
|
+
default: "34"
|
|
221
|
+
},
|
|
218
222
|
accountLabel: {
|
|
219
223
|
type: String,
|
|
220
224
|
default: "Account"
|
|
@@ -238,6 +242,10 @@ const Y = {
|
|
|
238
242
|
type: Array,
|
|
239
243
|
required: !0
|
|
240
244
|
},
|
|
245
|
+
iconSize: {
|
|
246
|
+
type: String,
|
|
247
|
+
default: "18"
|
|
248
|
+
},
|
|
241
249
|
appsTitle: {
|
|
242
250
|
type: String,
|
|
243
251
|
default: "Apps"
|
|
@@ -255,20 +263,20 @@ const Y = {
|
|
|
255
263
|
}, ee = ["onClick"], te = {
|
|
256
264
|
class: "space-y-2 text-center py-6",
|
|
257
265
|
style: { width: "240px" }
|
|
258
|
-
}, ne = { class: "text-sm text-secondary-content" }, oe = { class: "px-2" },
|
|
266
|
+
}, ne = { class: "text-sm text-secondary-content" }, oe = { class: "px-2" }, xe = /* @__PURE__ */ x({
|
|
259
267
|
__name: "OneUserMenu",
|
|
260
268
|
props: Y,
|
|
261
269
|
setup(p) {
|
|
262
270
|
const n = p, d = g(() => {
|
|
263
271
|
var s;
|
|
264
272
|
return (s = n.menu) == null ? void 0 : s.map((e) => {
|
|
265
|
-
let
|
|
266
|
-
e.icon != null && (
|
|
273
|
+
let i = { label: e.label };
|
|
274
|
+
e.icon != null && (i = { ...i, icon: e.icon });
|
|
267
275
|
const o = typeof e.click == "function" ? e.click : () => {
|
|
268
276
|
};
|
|
269
277
|
return {
|
|
270
278
|
key: e.label,
|
|
271
|
-
args:
|
|
279
|
+
args: i,
|
|
272
280
|
click: o
|
|
273
281
|
};
|
|
274
282
|
});
|
|
@@ -277,30 +285,30 @@ const Y = {
|
|
|
277
285
|
}, r = () => {
|
|
278
286
|
typeof n.onLogout == "function" && n.onLogout();
|
|
279
287
|
};
|
|
280
|
-
return (s, e) => (
|
|
281
|
-
button:
|
|
288
|
+
return (s, e) => (l(), k(B, { stick: "right" }, {
|
|
289
|
+
button: v(({ onToggle: i, isExpanded: o }) => {
|
|
282
290
|
var a, h;
|
|
283
291
|
return [
|
|
284
292
|
t("button", {
|
|
285
|
-
onClick:
|
|
293
|
+
onClick: i,
|
|
286
294
|
class: _(["p-1 rounded-full hover:bg-secondary-10", [o ? "bg-secondary-25" : ""]])
|
|
287
295
|
}, [
|
|
288
|
-
y(
|
|
296
|
+
y(b, {
|
|
289
297
|
text: ((a = s.user) == null ? void 0 : a.name) || "",
|
|
290
|
-
size:
|
|
298
|
+
size: s.iconSize,
|
|
291
299
|
src: (h = s.user) == null ? void 0 : h.photo_url,
|
|
292
300
|
rounded: !0
|
|
293
|
-
}, null, 8, ["text", "src"])
|
|
301
|
+
}, null, 8, ["text", "size", "src"])
|
|
294
302
|
], 10, ee)
|
|
295
303
|
];
|
|
296
304
|
}),
|
|
297
|
-
menu:
|
|
298
|
-
var
|
|
305
|
+
menu: v(() => {
|
|
306
|
+
var i, o, a;
|
|
299
307
|
return [
|
|
300
308
|
t("div", te, [
|
|
301
309
|
t("div", null, [
|
|
302
|
-
y(
|
|
303
|
-
text: ((
|
|
310
|
+
y(b, {
|
|
311
|
+
text: ((i = s.user) == null ? void 0 : i.name) || "",
|
|
304
312
|
size: 80,
|
|
305
313
|
rounded: !0,
|
|
306
314
|
class: "mx-auto"
|
|
@@ -318,7 +326,7 @@ const Y = {
|
|
|
318
326
|
class: "rounded",
|
|
319
327
|
onClick: c
|
|
320
328
|
}, null, 8, ["icon", "label"]),
|
|
321
|
-
(
|
|
329
|
+
(l(!0), u(O, null, j(d.value, (h) => (l(), k(C, q({
|
|
322
330
|
key: h.key
|
|
323
331
|
}, h.args, {
|
|
324
332
|
onClick: h.click
|
|
@@ -337,7 +345,7 @@ const Y = {
|
|
|
337
345
|
}
|
|
338
346
|
});
|
|
339
347
|
function re(p, n) {
|
|
340
|
-
return
|
|
348
|
+
return l(), u("svg", {
|
|
341
349
|
xmlns: "http://www.w3.org/2000/svg",
|
|
342
350
|
fill: "none",
|
|
343
351
|
viewBox: "0 0 24 24",
|
|
@@ -428,10 +436,10 @@ function re(p, n) {
|
|
|
428
436
|
})
|
|
429
437
|
]);
|
|
430
438
|
}
|
|
431
|
-
const se = ["onClick"],
|
|
439
|
+
const se = ["onClick"], ie = {
|
|
432
440
|
class: "space-x-2 flex items-center px-3 py-2",
|
|
433
441
|
style: { width: "300px" }
|
|
434
|
-
},
|
|
442
|
+
}, le = { class: "flex-shrink-0" }, ce = { class: "w-full text-left" }, ae = { class: "flex-shrink-0" }, ue = { class: "px-3 py-2 border-t border-secondary-stroke" }, de = { class: "text-secondary-content text-left pb-1 text-sm" }, pe = { class: "grid grid-cols-3 gap-1" }, he = ["onClick"], fe = { class: "block bg-white mx-auto flex-shrink-0 border border-secondary-stroke p-1 rounded-lg" }, ge = { class: "w-full overflow-hidden text-ellipsis whitespace-nowrap text-center text-sm mt-1" }, we = /* @__PURE__ */ x({
|
|
435
443
|
__name: "OneBrowserMenu",
|
|
436
444
|
props: Z,
|
|
437
445
|
setup(p) {
|
|
@@ -440,26 +448,26 @@ const se = ["onClick"], le = {
|
|
|
440
448
|
}, c = (r) => {
|
|
441
449
|
typeof n.onApp == "function" && n.onApp(r);
|
|
442
450
|
};
|
|
443
|
-
return (r, s) => (
|
|
444
|
-
button:
|
|
451
|
+
return (r, s) => (l(), k(B, { stick: "right" }, {
|
|
452
|
+
button: v(({ onToggle: e, isExpanded: i }) => [
|
|
445
453
|
t("button", {
|
|
446
454
|
onClick: e,
|
|
447
|
-
class: _(["p-1 rounded-md hover:bg-secondary-10", [
|
|
455
|
+
class: _(["p-1 rounded-md hover:bg-secondary-10", [i ? "bg-secondary-25" : ""]])
|
|
448
456
|
}, [
|
|
449
457
|
y($(re), {
|
|
450
458
|
class: "text-secondary-base",
|
|
451
|
-
style:
|
|
452
|
-
})
|
|
459
|
+
style: w(`width: ${r.iconSize}px; height: ${r.iconSize}px`)
|
|
460
|
+
}, null, 8, ["style"])
|
|
453
461
|
], 10, se)
|
|
454
462
|
]),
|
|
455
|
-
menu:
|
|
456
|
-
var e,
|
|
463
|
+
menu: v(() => {
|
|
464
|
+
var e, i, o;
|
|
457
465
|
return [
|
|
458
|
-
t("div",
|
|
459
|
-
t("div",
|
|
460
|
-
y(
|
|
466
|
+
t("div", ie, [
|
|
467
|
+
t("div", le, [
|
|
468
|
+
y(b, {
|
|
461
469
|
text: ((e = r.workspace) == null ? void 0 : e.name) || "",
|
|
462
|
-
src: (
|
|
470
|
+
src: (i = r.workspace) == null ? void 0 : i.photo_url,
|
|
463
471
|
size: 44,
|
|
464
472
|
rounded: !1,
|
|
465
473
|
class: "mx-auto"
|
|
@@ -476,14 +484,14 @@ const se = ["onClick"], le = {
|
|
|
476
484
|
t("div", ue, [
|
|
477
485
|
t("div", de, f(r.appsTitle), 1),
|
|
478
486
|
t("div", pe, [
|
|
479
|
-
(
|
|
487
|
+
(l(!0), u(O, null, j(r.apps, (a) => (l(), u("button", {
|
|
480
488
|
key: a.id,
|
|
481
489
|
onClick: (h) => c(a),
|
|
482
490
|
class: "p-1.5 flex flex-col items-center justify-center rounded hover:bg-secondary-10",
|
|
483
491
|
style: { width: "88px", height: "88px" }
|
|
484
492
|
}, [
|
|
485
493
|
t("span", fe, [
|
|
486
|
-
y(
|
|
494
|
+
y(b, {
|
|
487
495
|
text: a.name,
|
|
488
496
|
src: a.photo_url,
|
|
489
497
|
size: 44,
|
|
@@ -501,10 +509,10 @@ const se = ["onClick"], le = {
|
|
|
501
509
|
}
|
|
502
510
|
});
|
|
503
511
|
export {
|
|
504
|
-
|
|
512
|
+
ve as O,
|
|
505
513
|
B as _,
|
|
506
514
|
C as a,
|
|
507
|
-
|
|
515
|
+
xe as b,
|
|
508
516
|
we as c,
|
|
509
|
-
|
|
517
|
+
b as d
|
|
510
518
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./button/index.cjs"),n=require("./card/index.cjs"),r=require("./form/index.cjs"),e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./button/index.cjs"),n=require("./card/index.cjs"),r=require("./form/index.cjs"),e=require("./index-3196cf32.cjs");require("vue");require("./_plugin-vue_export-helper-f246444f.cjs");exports.OneButton=o.OneButton;exports.OneCard=n.OneCard;exports.OneCardBody=n.OneCardBody;exports.OneCardFooter=n.OneCardFooter;exports.OneCardHeader=n.OneCardHeader;exports.OneForm=r.OneForm;exports.OneFormFeedback=r.OneFormFeedback;exports.OneFormField=r.OneFormField;exports.OneFormInput=r.OneFormInput;exports.OneFormLabel=r.OneFormLabel;exports.OneAvatar=e._sfc_main$4;exports.OneBrowserMenu=e._sfc_main$3;exports.OneDropdown=e._sfc_main;exports.OneDropdownDivider=e.OneDropdownDivider;exports.OneDropdownItem=e._sfc_main$1;exports.OneUserMenu=e._sfc_main$2;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OneButton as O } from "./button/index.js";
|
|
2
2
|
import { OneCard as d, OneCardBody as m, OneCardFooter as t, OneCardHeader as p } from "./card/index.js";
|
|
3
3
|
import { OneForm as F, OneFormFeedback as i, OneFormField as f, OneFormInput as u, OneFormLabel as w } from "./form/index.js";
|
|
4
|
-
import { d as C, c as D, _ as b, O as B, a as c, b as l } from "./index-
|
|
4
|
+
import { d as C, c as D, _ as b, O as B, a as c, b as l } from "./index-6423ecce.js";
|
|
5
5
|
import "vue";
|
|
6
6
|
import "./_plugin-vue_export-helper-dad06003.js";
|
|
7
7
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneb/ui-vue",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -34,6 +34,10 @@
|
|
|
34
34
|
"types": "./dist/form/index.d.ts",
|
|
35
35
|
"import": "./dist/form/index.js"
|
|
36
36
|
},
|
|
37
|
+
"./dropdown": {
|
|
38
|
+
"types": "./dist/dropdown/index.d.ts",
|
|
39
|
+
"import": "./dist/dropdown/index.js"
|
|
40
|
+
},
|
|
37
41
|
"./icons": {
|
|
38
42
|
"types": "./dist/icons/outline/index.d.ts",
|
|
39
43
|
"import": "./dist/icons/outline/esm/index.js",
|
package/dist/index-26c86446.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),f=require("./_plugin-vue_export-helper-f246444f.cjs"),k={title:{type:String},stick:{type:String,default:"right"}},g={variant:{type:String,default:"primary"},label:{type:String},icon:{type:[Function,Object]}},y=["data-opened"],x={key:0,class:"text-sm text-secondary-content px-3 py-2 text-left"},h=e.defineComponent({__name:"OneDropdown",props:k,emits:["open"],setup(d,{emit:o}){const i=d,c=e.ref(!1),r=e.ref(null),l=()=>{c.value=!c.value,c.value&&o("open")};e.provide("OneDropdown",{onToggle:l});const t=e.computed(()=>{const n=r.value!=null&&r.value.offsetLeft<270;return r.value!=null&&r.value.offsetTop+270>window.innerHeight?"up"+(n?"-right":"-left"):"down"+(n?"-right":"-left")}),s=e.computed(()=>{const n=["absolute z-10 w-fit rounded-md bg-white","py-1 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none","overflow-auto max-h-[540px] min-w-[150px] max-w-[540px]"];return t.value==="up"?n.push("bottom-1 mb-10"):t.value==="down"?n.push("top-1 mt-10"):t.value==="up-right"?n.push("left-0 bottom-1 mb-10"):t.value==="down-right"&&n.push("left-0 top-1 mt-10"),i.stick==="right"?n.push("right-0"):i.stick==="left"&&n.push("left-0"),n});return(n,a)=>(e.openBlock(),e.createElementBlock("div",{class:"relative inline-block",ref_key:"menuRef",ref:r,"data-opened":c.value},[e.renderSlot(n.$slots,"button",e.normalizeProps(e.guardReactiveProps({onToggle:l,isExpanded:c.value}))),c.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed top-0 left-0 w-screen h-screen z-10",onClick:l})):e.createCommentVNode("",!0),e.createVNode(e.Transition,{"enter-active-class":"transition ease-out duration-100","enter-from-class":"transform opacity-0 scale-95","enter-to-class":"transform opacity-100 scale-100","leave-active-class":"transition ease-in duration-75","leave-from-class":"transform opacity-100 scale-100","leave-to-class":"transform opacity-0 scale-95"},{default:e.withCtx(()=>[c.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["menu",s.value]),role:"menu","aria-orientation":"vertical",tabindex:"-1"},[n.title?(e.openBlock(),e.createElementBlock("div",x,e.toDisplayString(n.title),1)):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"menu",e.normalizeProps(e.guardReactiveProps({onToggle:l})))],2)):e.createCommentVNode("",!0)]),_:3})],8,y))}}),v=["onClick"],m=e.defineComponent({__name:"OneDropdownItem",props:g,emits:["click"],setup(d,{emit:o}){const i=d,c=e.inject("OneDropdown"),r=()=>{c!==void 0&&c.onToggle(),o("click")},l=e.computed(()=>{const t=[];return i.variant==="secondary"?t.push("text-secondary-content hover:bg-secondary-body-hover"):i.variant==="danger"?t.push("text-danger-content hover:bg-danger-10"):i.variant==="warning"?t.push("text-warning-content hover:bg-warning-10"):i.variant==="info"?t.push("text-info-content hover:bg-info-10"):t.push("hover:bg-secondary-body-hover"),t});return(t,s)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["px-3 py-1.5 flex items-center space-x-3 w-full whitespace-nowrap",l.value]),onClick:e.withModifiers(r,["prevent"])},[t.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.icon),{key:0,class:"w-4 h-4"})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(t.label),1)],10,v))}}),w={},_={class:"border-t border-secondary-stroke my-1"};function b(d,o){return e.openBlock(),e.createElementBlock("div",_)}const C=f._export_sfc(w,[["render",b]]),E={size:{type:[String,Number],default:"50"},rounded:{type:Boolean,default:!1},text:{type:String,required:!1,default:""},src:{type:[String,null],required:!1}},V=["src"],p=e.defineComponent({__name:"OneAvatar",props:E,setup(d){const o=d,i=e.computed(()=>{const t=o.text.trim().split(" ");return t.length<2?o.text.slice(0,2).toUpperCase():t.map(s=>s.slice(0,1)).join("").toUpperCase()}),c=e.computed(()=>({fill:"rgba(255, 255, 255, .75)",fontSize:`${Number(o.size)*.4}px`})),r=e.computed(()=>{const t=o.text.split("").map(a=>a.charCodeAt(0)).reduce((a,u)=>a+u,0),n=`hsl(${360/26*t}, 68%, 48%)`;return{width:`${o.size}px`,height:`${o.size}px`,borderRadius:o.rounded?"100%":"9%",background:n}}),l=e.computed(()=>({width:`${o.size}px`,height:`${o.size}px`,borderRadius:o.rounded?"100%":"9%"}));return(t,s)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(l.value),class:"overflow-hidden"},[t.src?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.src,alt:"",class:"w-full h-full"},null,8,V)):(e.openBlock(),e.createElementBlock("svg",{key:1,style:e.normalizeStyle(r.value),class:"block"},[i.value?(e.openBlock(),e.createElementBlock("text",{key:0,x:"50%",y:"50%","text-anchor":"middle","dominant-baseline":"central",class:"font-light",style:e.normalizeStyle(c.value)},e.toDisplayString(i.value),5)):e.createCommentVNode("",!0)],4))],4))}});function B(d,o){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"})])}function N(d,o){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15m3 0l3-3m0 0l-3-3m3 3H9"})])}const S={user:{type:Object,required:!0},menu:{type:Array,default:()=>[]},accountLabel:{type:String,default:"Account"},logoutLabel:{type:String,default:"Logout"},onAccount:{type:Function},onLogout:{type:Function}},$={workspace:{type:Object,required:!0},apps:{type:Array,required:!0},appsTitle:{type:String,default:"Apps"},changeLabel:{type:String,default:"Change"},onChange:{type:Function},onApp:{type:Function}},z=["onClick"],D={class:"space-y-2 text-center py-6",style:{width:"240px"}},A={class:"text-sm text-secondary-content"},L={class:"px-2"},O=e.defineComponent({__name:"OneUserMenu",props:S,setup(d){const o=d,i=e.computed(()=>{var l;return(l=o.menu)==null?void 0:l.map(t=>{let s={label:t.label};t.icon!=null&&(s={...s,icon:t.icon});const n=typeof t.click=="function"?t.click:()=>{};return{key:t.label,args:s,click:n}})}),c=()=>{typeof o.onAccount=="function"&&o.onAccount()},r=()=>{typeof o.onLogout=="function"&&o.onLogout()};return(l,t)=>(e.openBlock(),e.createBlock(h,{stick:"right"},{button:e.withCtx(({onToggle:s,isExpanded:n})=>{var a,u;return[e.createElementVNode("button",{onClick:s,class:e.normalizeClass(["p-1 rounded-full hover:bg-secondary-10",[n?"bg-secondary-25":""]])},[e.createVNode(p,{text:((a=l.user)==null?void 0:a.name)||"",size:34,src:(u=l.user)==null?void 0:u.photo_url,rounded:!0},null,8,["text","src"])],10,z)]}),menu:e.withCtx(()=>{var s,n,a;return[e.createElementVNode("div",D,[e.createElementVNode("div",null,[e.createVNode(p,{text:((s=l.user)==null?void 0:s.name)||"",size:80,rounded:!0,class:"mx-auto"},null,8,["text"])]),e.createElementVNode("div",null,[e.createElementVNode("div",null,e.toDisplayString((n=l.user)==null?void 0:n.name),1),e.createElementVNode("div",A,e.toDisplayString((a=l.user)==null?void 0:a.email),1)])]),e.createElementVNode("div",L,[e.createVNode(m,{icon:e.unref(B),label:l.accountLabel,class:"rounded",onClick:c},null,8,["icon","label"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,u=>(e.openBlock(),e.createBlock(m,e.mergeProps({key:u.key},u.args,{onClick:u.click}),null,16,["onClick"]))),128)),e.createVNode(m,{icon:e.unref(N),label:l.logoutLabel,class:"rounded",onClick:r},null,8,["icon","label"])])]}),_:1}))}});function P(d,o){return e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.8",stroke:"currentColor","aria-hidden":"true"},[e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"17.16",y:"3.9",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"10.53",y:"3.9",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"3.9",y:"3.9",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"17.16",y:"10.53",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"10.53",y:"10.53",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"3.9",y:"10.53",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"17.16",y:"17.16",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"10.53",y:"17.16",fill:"currentColor","stroke-width":"1.8",rx:"1.1"}),e.createElementVNode("rect",{width:"2.94",height:"2.94",x:"3.9",y:"17.16",fill:"currentColor","stroke-width":"1.8",rx:"1.1"})])}const j=["onClick"],M={class:"space-x-2 flex items-center px-3 py-2",style:{width:"300px"}},q={class:"flex-shrink-0"},F={class:"w-full text-left"},R={class:"flex-shrink-0"},T={class:"px-3 py-2 border-t border-secondary-stroke"},H={class:"text-secondary-content text-left pb-1 text-sm"},I={class:"grid grid-cols-3 gap-1"},U=["onClick"],G={class:"block bg-white mx-auto flex-shrink-0 border border-secondary-stroke p-1 rounded-lg"},J={class:"w-full overflow-hidden text-ellipsis whitespace-nowrap text-center text-sm mt-1"},K=e.defineComponent({__name:"OneBrowserMenu",props:$,setup(d){const o=d,i=()=>{typeof o.onChange=="function"&&o.onChange()},c=r=>{typeof o.onApp=="function"&&o.onApp(r)};return(r,l)=>(e.openBlock(),e.createBlock(h,{stick:"right"},{button:e.withCtx(({onToggle:t,isExpanded:s})=>[e.createElementVNode("button",{onClick:t,class:e.normalizeClass(["p-1 rounded-md hover:bg-secondary-10",[s?"bg-secondary-25":""]])},[e.createVNode(e.unref(P),{class:"text-secondary-base",style:{width:"34px",height:"34px"}})],10,j)]),menu:e.withCtx(()=>{var t,s,n;return[e.createElementVNode("div",M,[e.createElementVNode("div",q,[e.createVNode(p,{text:((t=r.workspace)==null?void 0:t.name)||"",src:(s=r.workspace)==null?void 0:s.photo_url,size:44,rounded:!1,class:"mx-auto"},null,8,["text","src"])]),e.createElementVNode("div",F,e.toDisplayString((n=r.workspace)==null?void 0:n.name),1),e.createElementVNode("div",R,[e.createElementVNode("button",{class:"text-sm border border-secondary-stroke rounded px-2 py-0.5 text-secondary-content hover:text-primary-content",onClick:i},e.toDisplayString(r.changeLabel),1)])]),e.createElementVNode("div",T,[e.createElementVNode("div",H,e.toDisplayString(r.appsTitle),1),e.createElementVNode("div",I,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.apps,a=>(e.openBlock(),e.createElementBlock("button",{key:a.id,onClick:u=>c(a),class:"p-1.5 flex flex-col items-center justify-center rounded hover:bg-secondary-10",style:{width:"88px",height:"88px"}},[e.createElementVNode("span",G,[e.createVNode(p,{text:a.name,src:a.photo_url,size:44,rounded:!1},null,8,["text","src"])]),e.createElementVNode("span",J,e.toDisplayString(a.name),1)],8,U))),128))])])]}),_:1}))}});exports.OneDropdownDivider=C;exports._sfc_main=h;exports._sfc_main$1=m;exports._sfc_main$2=O;exports._sfc_main$3=K;exports._sfc_main$4=p;
|