@oneb/ui-vue 0.0.38 → 0.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/OneBrowserMenu.vue_vue_type_script_setup_true_lang-562e2fdb.cjs +1 -0
- package/dist/{OneBrowserMenu.vue_vue_type_script_setup_true_lang-b65a0a0a.js → OneBrowserMenu.vue_vue_type_script_setup_true_lang-59fac367.js} +117 -117
- package/dist/button/index.cjs +1 -1
- package/dist/button/index.js +1 -1
- package/dist/dropdown/index.cjs +1 -1
- package/dist/dropdown/index.js +1 -1
- package/dist/form/index.cjs +1 -1
- package/dist/form/index.js +125 -125
- package/dist/index-3615f53c.cjs +1 -0
- package/dist/{index-72d69e4e.js → index-f136b5ea.js} +51 -51
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/layout/index.cjs +1 -1
- package/dist/layout/index.js +168 -168
- package/package.json +1 -1
- package/dist/OneBrowserMenu.vue_vue_type_script_setup_true_lang-4b350df0.cjs +0 -1
- package/dist/button/OneButton.vue.d.ts +0 -2
- package/dist/button/SpinnerIcon.vue.d.ts +0 -2
- package/dist/button/util.d.ts +0 -2
- package/dist/card/OneCard.vue.d.ts +0 -2
- package/dist/card/OneCardBody.vue.d.ts +0 -2
- package/dist/card/OneCardFooter.vue.d.ts +0 -2
- package/dist/card/OneCardHeader.vue.d.ts +0 -2
- package/dist/common/OneAvatar.vue.d.ts +0 -2
- package/dist/dropdown/OneBrowserMenu.vue.d.ts +0 -2
- package/dist/dropdown/OneDropdown.vue.d.ts +0 -2
- package/dist/dropdown/OneDropdownDivider.vue.d.ts +0 -2
- package/dist/dropdown/OneDropdownItem.vue.d.ts +0 -2
- package/dist/dropdown/OneUserMenu.vue.d.ts +0 -2
- package/dist/form/OneForm.vue.d.ts +0 -2
- package/dist/form/OneFormFeedback.vue.d.ts +0 -2
- package/dist/form/OneFormField.vue.d.ts +0 -2
- package/dist/form/OneFormInput.vue.d.ts +0 -2
- package/dist/form/OneFormLabel.vue.d.ts +0 -2
- package/dist/index-e804f148.cjs +0 -1
- package/dist/layout/IconOneb.vue.d.ts +0 -2
- package/dist/layout/OneMainLayout.vue.d.ts +0 -2
- package/dist/layout/OneSidebar.vue.d.ts +0 -2
- package/dist/layout/OneSidebarLink.vue.d.ts +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),h=require("./common/index.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"],w={key:0,class:"text-sm text-secondary-content px-3 py-2 text-left"},f=e.defineComponent({__name:"OneDropdown",props:k,emits:["open","close"],setup(d,{emit:c}){const i=d,s=e.ref(!1),n=e.ref(null),r=()=>{s.value=!s.value,s.value?c("open"):c("close")};e.provide("OneDropdown",{onToggle:r});const t=e.computed(()=>{const o=n.value!=null&&n.value.offsetLeft<270;return n.value!=null&&n.value.offsetTop+270>window.innerHeight?"up"+(o?"-right":"-left"):"down"+(o?"-right":"-left")}),l=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.startsWith("up")?o.push("bottom-1 mb-10"):t.value.startsWith("down")&&o.push("top-1 mt-10"),i.stick==="right"?o.push("right-0"):i.stick==="left"&&o.push("left-0"),o});return(o,a)=>(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",l.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:g,emits:["click"],setup(d,{emit:c}){const i=d,s=e.inject("OneDropdown"),n=()=>{s!==void 0&&s.onToggle(),c("click")},r=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,l)=>(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,c){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 _(d,c){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}},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:b,setup(d){const c=d,i=e.computed(()=>{var r;return(r=c.menu)==null?void 0:r.map(t=>{let l={label:t.label};t.icon!=null&&(l={...l,icon:t.icon});const o=typeof t.click=="function"?t.click:()=>{};return{key:t.label,args:l,click:o}})}),s=()=>{typeof c.onAccount=="function"&&c.onAccount()},n=()=>{typeof c.onLogout=="function"&&c.onLogout()};return(r,t)=>(e.openBlock(),e.createBlock(f,{stick:"right"},{button:e.withCtx(({onToggle:l,isExpanded:o})=>{var a,u;return[e.createElementVNode("button",{onClick:l,class:e.normalizeClass(["p-1 rounded-full hover:bg-secondary-10",[o?"bg-secondary-25":""]])},[e.createVNode(h.OneAvatar,{text:((a=r.user)==null?void 0:a.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 l,o,a,u;return[e.createElementVNode("div",E,[e.createElementVNode("div",null,[e.createVNode(h.OneAvatar,{text:((l=r.user)==null?void 0:l.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((a=r.user)==null?void 0:a.name),1),e.createElementVNode("div",N,e.toDisplayString((u=r.user)==null?void 0:u.email),1)])]),e.createElementVNode("div",B,[typeof c.onAccount=="function"?(e.openBlock(),e.createBlock(p,{key:0,icon:e.unref(x),label:r.accountLabel,class:"rounded",onClick:s},null,8,["icon","label"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.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(_),label:r.logoutLabel,class:"rounded",onClick:n},null,8,["icon","label"])])]}),_:1}))}});function z(d,c){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 A=["onClick"],$={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 c=d,i=()=>{typeof c.onChange=="function"&&c.onChange()},s=n=>{typeof c.onApp=="function"&&c.onApp(n)};return(n,r)=>(e.openBlock(),e.createBlock(f,{stick:"right"},{button:e.withCtx(({onToggle:t,isExpanded:l})=>[e.createElementVNode("button",{onClick:t,class:e.normalizeClass(["p-1 rounded-md hover:bg-secondary-10",[l?"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,A)]),menu:e.withCtx(()=>{var t,l,o;return[e.createElementVNode("div",$,[e.createElementVNode("div",L,[e.createVNode(h.OneAvatar,{text:((t=n.workspace)==null?void 0:t.name)||"",src:(l=n.workspace)==null?void 0:l.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:i},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,a=>(e.openBlock(),e.createElementBlock("button",{key:a.id,onClick:u=>s(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",T,[e.createVNode(h.OneAvatar,{text:a.name,src:a.photo_url,size:44,rounded:!1},null,8,["text","src"])]),e.createElementVNode("span",q,e.toDisplayString(a.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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as x, ref as
|
|
1
|
+
import { defineComponent as x, ref as $, provide as B, computed as v, openBlock as l, createElementBlock as d, renderSlot as z, normalizeProps as A, guardReactiveProps as L, createCommentVNode as y, createVNode as f, Transition as P, withCtx as m, normalizeClass as b, toDisplayString as h, inject as D, withModifiers as F, createBlock as w, resolveDynamicComponent as T, createElementVNode as e, unref as S, Fragment as O, renderList as M, mergeProps as V, normalizeStyle as E } from "vue";
|
|
2
2
|
import { OneAvatar as k } from "./common/index.js";
|
|
3
3
|
const q = {
|
|
4
4
|
title: {
|
|
@@ -26,37 +26,37 @@ const q = {
|
|
|
26
26
|
__name: "OneDropdown",
|
|
27
27
|
props: q,
|
|
28
28
|
emits: ["open", "close"],
|
|
29
|
-
setup(p, { emit:
|
|
30
|
-
const
|
|
31
|
-
|
|
29
|
+
setup(p, { emit: s }) {
|
|
30
|
+
const u = p, c = $(!1), o = $(null), r = () => {
|
|
31
|
+
c.value = !c.value, c.value ? s("open") : s("close");
|
|
32
32
|
};
|
|
33
33
|
B("OneDropdown", {
|
|
34
|
-
onToggle:
|
|
34
|
+
onToggle: r
|
|
35
35
|
});
|
|
36
36
|
const t = v(() => {
|
|
37
|
-
const n =
|
|
38
|
-
return
|
|
39
|
-
}),
|
|
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 = v(() => {
|
|
40
40
|
const n = [
|
|
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",
|
|
43
43
|
"overflow-auto max-h-[540px] min-w-[150px] max-w-[540px]"
|
|
44
44
|
];
|
|
45
|
-
return t.value.startsWith("up") ? n.push("bottom-1 mb-10") : t.value.startsWith("down") && n.push("top-1 mt-10"),
|
|
45
|
+
return t.value.startsWith("up") ? n.push("bottom-1 mb-10") : t.value.startsWith("down") && n.push("top-1 mt-10"), u.stick === "right" ? n.push("right-0") : u.stick === "left" && n.push("left-0"), n;
|
|
46
46
|
});
|
|
47
|
-
return (n,
|
|
47
|
+
return (n, a) => (l(), d("div", {
|
|
48
48
|
class: "relative inline-block",
|
|
49
49
|
ref_key: "menuRef",
|
|
50
|
-
ref:
|
|
51
|
-
"data-opened":
|
|
50
|
+
ref: o,
|
|
51
|
+
"data-opened": c.value
|
|
52
52
|
}, [
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
z(n.$slots, "button", A(L({ onToggle: r, isExpanded: c.value }))),
|
|
54
|
+
c.value ? (l(), d("div", {
|
|
55
55
|
key: 0,
|
|
56
56
|
class: "fixed top-0 left-0 w-screen h-screen z-10",
|
|
57
|
-
onClick:
|
|
57
|
+
onClick: r
|
|
58
58
|
})) : y("", !0),
|
|
59
|
-
|
|
59
|
+
f(P, {
|
|
60
60
|
"enter-active-class": "transition ease-out duration-100",
|
|
61
61
|
"enter-from-class": "transform opacity-0 scale-95",
|
|
62
62
|
"enter-to-class": "transform opacity-100 scale-100",
|
|
@@ -64,46 +64,46 @@ const q = {
|
|
|
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
|
-
|
|
67
|
+
default: m(() => [
|
|
68
|
+
c.value ? (l(), d("div", {
|
|
69
69
|
key: 0,
|
|
70
|
-
class: b(["menu",
|
|
70
|
+
class: b(["menu", i.value]),
|
|
71
71
|
role: "menu",
|
|
72
72
|
"aria-orientation": "vertical",
|
|
73
73
|
tabindex: "-1"
|
|
74
74
|
}, [
|
|
75
75
|
n.title ? (l(), d("div", N, h(n.title), 1)) : y("", !0),
|
|
76
|
-
|
|
76
|
+
z(n.$slots, "menu", A(L({ onToggle: r })))
|
|
77
77
|
], 2)) : y("", !0)
|
|
78
78
|
]),
|
|
79
79
|
_: 3
|
|
80
80
|
})
|
|
81
81
|
], 8, I));
|
|
82
82
|
}
|
|
83
|
-
}), C = /* @__PURE__ */ x({
|
|
83
|
+
}), R = ["onClick"], C = /* @__PURE__ */ x({
|
|
84
84
|
__name: "OneDropdownItem",
|
|
85
85
|
props: H,
|
|
86
86
|
emits: ["click"],
|
|
87
|
-
setup(p, { emit:
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
},
|
|
87
|
+
setup(p, { emit: s }) {
|
|
88
|
+
const u = p, c = D("OneDropdown"), o = () => {
|
|
89
|
+
c !== void 0 && c.onToggle(), s("click");
|
|
90
|
+
}, r = v(() => {
|
|
91
91
|
const t = [];
|
|
92
|
-
return
|
|
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
93
|
});
|
|
94
|
-
return (t,
|
|
95
|
-
class: b(["px-3 py-1.5 flex items-center space-x-3 w-full whitespace-nowrap",
|
|
96
|
-
onClick: F(
|
|
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
97
|
}, [
|
|
98
|
-
t.icon ? (l(),
|
|
98
|
+
t.icon ? (l(), w(T(t.icon), {
|
|
99
99
|
key: 0,
|
|
100
100
|
class: "w-4 h-4"
|
|
101
101
|
})) : y("", !0),
|
|
102
102
|
e("span", null, h(t.label), 1)
|
|
103
|
-
],
|
|
103
|
+
], 10, R));
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
|
-
function
|
|
106
|
+
function W(p, s) {
|
|
107
107
|
return l(), d("svg", {
|
|
108
108
|
xmlns: "http://www.w3.org/2000/svg",
|
|
109
109
|
fill: "none",
|
|
@@ -119,7 +119,7 @@ function R(p, r) {
|
|
|
119
119
|
})
|
|
120
120
|
]);
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function U(p, s) {
|
|
123
123
|
return l(), d("svg", {
|
|
124
124
|
xmlns: "http://www.w3.org/2000/svg",
|
|
125
125
|
fill: "none",
|
|
@@ -135,7 +135,7 @@ function W(p, r) {
|
|
|
135
135
|
})
|
|
136
136
|
]);
|
|
137
137
|
}
|
|
138
|
-
const
|
|
138
|
+
const G = {
|
|
139
139
|
user: {
|
|
140
140
|
type: Object,
|
|
141
141
|
required: !0
|
|
@@ -162,7 +162,7 @@ const U = {
|
|
|
162
162
|
onLogout: {
|
|
163
163
|
type: Function
|
|
164
164
|
}
|
|
165
|
-
},
|
|
165
|
+
}, J = {
|
|
166
166
|
workspace: {
|
|
167
167
|
type: Object,
|
|
168
168
|
required: !0
|
|
@@ -189,84 +189,84 @@ const U = {
|
|
|
189
189
|
onApp: {
|
|
190
190
|
type: Function
|
|
191
191
|
}
|
|
192
|
-
},
|
|
192
|
+
}, K = ["onClick"], Q = {
|
|
193
193
|
class: "space-y-2 text-center py-6",
|
|
194
194
|
style: { width: "240px" }
|
|
195
|
-
},
|
|
195
|
+
}, X = { class: "text-sm text-secondary-content" }, Y = { class: "px-2" }, he = /* @__PURE__ */ x({
|
|
196
196
|
__name: "OneUserMenu",
|
|
197
|
-
props:
|
|
197
|
+
props: G,
|
|
198
198
|
setup(p) {
|
|
199
|
-
const
|
|
200
|
-
var
|
|
201
|
-
return (
|
|
202
|
-
let
|
|
203
|
-
|
|
204
|
-
const
|
|
199
|
+
const s = p, u = v(() => {
|
|
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
205
|
};
|
|
206
206
|
return {
|
|
207
|
-
key:
|
|
208
|
-
args:
|
|
209
|
-
click:
|
|
207
|
+
key: t.label,
|
|
208
|
+
args: i,
|
|
209
|
+
click: n
|
|
210
210
|
};
|
|
211
211
|
});
|
|
212
212
|
}), c = () => {
|
|
213
|
-
typeof
|
|
214
|
-
},
|
|
215
|
-
typeof
|
|
213
|
+
typeof s.onAccount == "function" && s.onAccount();
|
|
214
|
+
}, o = () => {
|
|
215
|
+
typeof s.onLogout == "function" && s.onLogout();
|
|
216
216
|
};
|
|
217
|
-
return (
|
|
218
|
-
button:
|
|
219
|
-
var
|
|
217
|
+
return (r, t) => (l(), w(j, { stick: "right" }, {
|
|
218
|
+
button: m(({ onToggle: i, isExpanded: n }) => {
|
|
219
|
+
var a, g;
|
|
220
220
|
return [
|
|
221
221
|
e("button", {
|
|
222
|
-
onClick:
|
|
223
|
-
class: b(["p-1 rounded-full hover:bg-secondary-10", [
|
|
222
|
+
onClick: i,
|
|
223
|
+
class: b(["p-1 rounded-full hover:bg-secondary-10", [n ? "bg-secondary-25" : ""]])
|
|
224
224
|
}, [
|
|
225
|
-
|
|
226
|
-
text: ((
|
|
227
|
-
size:
|
|
228
|
-
src: (
|
|
225
|
+
f(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
229
|
rounded: !0
|
|
230
230
|
}, null, 8, ["text", "size", "src"])
|
|
231
|
-
], 10,
|
|
231
|
+
], 10, K)
|
|
232
232
|
];
|
|
233
233
|
}),
|
|
234
|
-
menu:
|
|
235
|
-
var
|
|
234
|
+
menu: m(() => {
|
|
235
|
+
var i, n, a, g;
|
|
236
236
|
return [
|
|
237
|
-
e("div",
|
|
237
|
+
e("div", Q, [
|
|
238
238
|
e("div", null, [
|
|
239
|
-
|
|
240
|
-
text: ((
|
|
239
|
+
f(k, {
|
|
240
|
+
text: ((i = r.user) == null ? void 0 : i.name) || "",
|
|
241
241
|
size: 80,
|
|
242
|
-
src: (
|
|
242
|
+
src: (n = r.user) == null ? void 0 : n.photo_url,
|
|
243
243
|
rounded: !0,
|
|
244
244
|
class: "mx-auto"
|
|
245
245
|
}, null, 8, ["text", "src"])
|
|
246
246
|
]),
|
|
247
247
|
e("div", null, [
|
|
248
|
-
e("div", null, h((
|
|
249
|
-
e("div",
|
|
248
|
+
e("div", null, h((a = r.user) == null ? void 0 : a.name), 1),
|
|
249
|
+
e("div", X, h((g = r.user) == null ? void 0 : g.email), 1)
|
|
250
250
|
])
|
|
251
251
|
]),
|
|
252
|
-
e("div",
|
|
253
|
-
typeof
|
|
252
|
+
e("div", Y, [
|
|
253
|
+
typeof s.onAccount == "function" ? (l(), w(C, {
|
|
254
254
|
key: 0,
|
|
255
|
-
icon: S(
|
|
256
|
-
label:
|
|
255
|
+
icon: S(W),
|
|
256
|
+
label: r.accountLabel,
|
|
257
257
|
class: "rounded",
|
|
258
258
|
onClick: c
|
|
259
259
|
}, null, 8, ["icon", "label"])) : y("", !0),
|
|
260
|
-
(l(!0), d(O, null, M(
|
|
260
|
+
(l(!0), d(O, null, M(u.value, (_) => (l(), w(C, V({
|
|
261
261
|
key: _.key
|
|
262
262
|
}, _.args, {
|
|
263
263
|
onClick: _.click
|
|
264
264
|
}), null, 16, ["onClick"]))), 128)),
|
|
265
|
-
|
|
266
|
-
icon: S(
|
|
267
|
-
label:
|
|
265
|
+
f(C, {
|
|
266
|
+
icon: S(U),
|
|
267
|
+
label: r.logoutLabel,
|
|
268
268
|
class: "rounded",
|
|
269
|
-
onClick:
|
|
269
|
+
onClick: o
|
|
270
270
|
}, null, 8, ["icon", "label"])
|
|
271
271
|
])
|
|
272
272
|
];
|
|
@@ -275,7 +275,7 @@ const U = {
|
|
|
275
275
|
}));
|
|
276
276
|
}
|
|
277
277
|
});
|
|
278
|
-
function
|
|
278
|
+
function Z(p, s) {
|
|
279
279
|
return l(), d("svg", {
|
|
280
280
|
xmlns: "http://www.w3.org/2000/svg",
|
|
281
281
|
fill: "none",
|
|
@@ -367,70 +367,70 @@ function Y(p, r) {
|
|
|
367
367
|
})
|
|
368
368
|
]);
|
|
369
369
|
}
|
|
370
|
-
const
|
|
370
|
+
const ee = ["onClick"], te = {
|
|
371
371
|
class: "space-x-2 flex items-center px-3 py-2",
|
|
372
372
|
style: { width: "300px" }
|
|
373
|
-
},
|
|
373
|
+
}, 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({
|
|
374
374
|
__name: "OneBrowserMenu",
|
|
375
|
-
props:
|
|
375
|
+
props: J,
|
|
376
376
|
setup(p) {
|
|
377
|
-
const
|
|
378
|
-
typeof
|
|
379
|
-
}, c = (
|
|
380
|
-
typeof
|
|
377
|
+
const s = p, u = () => {
|
|
378
|
+
typeof s.onChange == "function" && s.onChange();
|
|
379
|
+
}, c = (o) => {
|
|
380
|
+
typeof s.onApp == "function" && s.onApp(o);
|
|
381
381
|
};
|
|
382
|
-
return (
|
|
383
|
-
button:
|
|
382
|
+
return (o, r) => (l(), w(j, { stick: "right" }, {
|
|
383
|
+
button: m(({ onToggle: t, isExpanded: i }) => [
|
|
384
384
|
e("button", {
|
|
385
|
-
onClick:
|
|
386
|
-
class: b(["p-1 rounded-md hover:bg-secondary-10", [
|
|
385
|
+
onClick: t,
|
|
386
|
+
class: b(["p-1 rounded-md hover:bg-secondary-10", [i ? "bg-secondary-25" : ""]])
|
|
387
387
|
}, [
|
|
388
|
-
|
|
388
|
+
f(S(Z), {
|
|
389
389
|
class: "text-secondary-base",
|
|
390
|
-
style: E(`width: ${
|
|
390
|
+
style: E(`width: ${o.iconSize}px; height: ${o.iconSize}px`)
|
|
391
391
|
}, null, 8, ["style"])
|
|
392
|
-
], 10,
|
|
392
|
+
], 10, ee)
|
|
393
393
|
]),
|
|
394
|
-
menu:
|
|
395
|
-
var
|
|
394
|
+
menu: m(() => {
|
|
395
|
+
var t, i, n;
|
|
396
396
|
return [
|
|
397
|
-
e("div",
|
|
398
|
-
e("div",
|
|
399
|
-
|
|
400
|
-
text: ((
|
|
401
|
-
src: (
|
|
397
|
+
e("div", te, [
|
|
398
|
+
e("div", ne, [
|
|
399
|
+
f(k, {
|
|
400
|
+
text: ((t = o.workspace) == null ? void 0 : t.name) || "",
|
|
401
|
+
src: (i = o.workspace) == null ? void 0 : i.photo_url,
|
|
402
402
|
size: 44,
|
|
403
403
|
rounded: !1,
|
|
404
404
|
class: "mx-auto"
|
|
405
405
|
}, null, 8, ["text", "src"])
|
|
406
406
|
]),
|
|
407
|
-
e("div",
|
|
408
|
-
e("div",
|
|
407
|
+
e("div", oe, h((n = o.workspace) == null ? void 0 : n.name), 1),
|
|
408
|
+
e("div", re, [
|
|
409
409
|
e("button", {
|
|
410
410
|
class: "text-sm border border-secondary-stroke rounded px-2 py-0.5 text-secondary-content hover:text-primary-content",
|
|
411
|
-
onClick:
|
|
412
|
-
}, h(
|
|
411
|
+
onClick: u
|
|
412
|
+
}, h(o.changeLabel), 1)
|
|
413
413
|
])
|
|
414
414
|
]),
|
|
415
|
-
e("div",
|
|
416
|
-
e("div",
|
|
417
|
-
e("div",
|
|
418
|
-
(l(!0), d(O, null, M(
|
|
419
|
-
key:
|
|
420
|
-
onClick: (
|
|
415
|
+
e("div", se, [
|
|
416
|
+
e("div", ie, h(o.appsTitle), 1),
|
|
417
|
+
e("div", le, [
|
|
418
|
+
(l(!0), d(O, null, M(o.apps, (a) => (l(), d("button", {
|
|
419
|
+
key: a.id,
|
|
420
|
+
onClick: (g) => c(a),
|
|
421
421
|
class: "p-1.5 flex flex-col items-center justify-center rounded hover:bg-secondary-10",
|
|
422
422
|
style: { width: "88px", height: "88px" }
|
|
423
423
|
}, [
|
|
424
|
-
e("span",
|
|
425
|
-
|
|
426
|
-
text:
|
|
427
|
-
src:
|
|
424
|
+
e("span", ae, [
|
|
425
|
+
f(k, {
|
|
426
|
+
text: a.name,
|
|
427
|
+
src: a.photo_url,
|
|
428
428
|
size: 44,
|
|
429
429
|
rounded: !1
|
|
430
430
|
}, null, 8, ["text", "src"])
|
|
431
431
|
]),
|
|
432
|
-
e("span",
|
|
433
|
-
], 8,
|
|
432
|
+
e("span", ue, h(a.name), 1)
|
|
433
|
+
], 8, ce))), 128))
|
|
434
434
|
])
|
|
435
435
|
])
|
|
436
436
|
];
|
|
@@ -442,6 +442,6 @@ const Z = ["onClick"], ee = {
|
|
|
442
442
|
export {
|
|
443
443
|
j as _,
|
|
444
444
|
C as a,
|
|
445
|
-
|
|
446
|
-
|
|
445
|
+
he as b,
|
|
446
|
+
fe as c
|
|
447
447
|
};
|
package/dist/button/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-3615f53c.cjs");require("vue");require("../_plugin-vue_export-helper-f246444f.cjs");exports.OneButton=e._sfc_main;
|
package/dist/button/index.js
CHANGED
package/dist/dropdown/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../OneBrowserMenu.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../OneBrowserMenu.vue_vue_type_script_setup_true_lang-562e2fdb.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;
|
package/dist/dropdown/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as O, _ as l, a as u, b as w } from "../OneBrowserMenu.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import { c as O, _ as l, a as u, b as w } from "../OneBrowserMenu.vue_vue_type_script_setup_true_lang-59fac367.js";
|
|
2
2
|
import { openBlock as e, createElementBlock as r } from "vue";
|
|
3
3
|
import { _ as o } from "../_plugin-vue_export-helper-dad06003.js";
|
|
4
4
|
import "../common/index.js";
|
package/dist/form/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),C=require("../XMarkIcon-f94baa4c.cjs"),w={id:{type:String,required:!1},validation:{type:Object,required:!1}},F={id:{type:String,required:!1},label:{type:String,required:!1},name:{type:String,required:!1},hint:{type:String,required:!1,default:""},errors:{type:Array,required:!1}},S={name:{type:String,required:!1},errors:{type:Array,required:!1}},$={label:{type:String,required:!1}},N={id:{type:String,required:!1},name:{type:String,required:!1},placeholder:{type:String,default:""},icon:{type:[Function,Object]},type:{type:String,default:"text"},inputClass:{required:!1,type:[Array,String]},modelValue:{required:!1,type:[String,Number,Array,Boolean,Object,null]},autofocus:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},rounded:{type:Boolean,default:!1},large:{type:Boolean,default:!1},invalid:{type:Boolean,required:!1,default:!1},options:{type:Array,required:!1,default:[]}},v=()=>e.inject("BaseForm",()=>({formId:e.computed(()=>{}),validation:e.computed(()=>{})}),!0),y=()=>e.inject("BaseFormField",()=>({inputId:e.computed(()=>{}),inputName:e.computed(()=>{}),hasError:e.computed(()=>!1)}),!0),q=["id"],O=e.defineComponent({__name:"OneForm",props:w,emits:["submit"],setup(d,{emit:l}){const o=d,n=l;e.provide("BaseForm",{formId:e.computed(()=>o.id),validation:e.computed(()=>o.validation)});const a=()=>{n("submit")};return(t,u)=>(e.openBlock(),e.createElementBlock("form",{onSubmit:e.withModifiers(a,["prevent"]),id:t.id,class:"space-y-3"},[e.renderSlot(t.$slots,"default")],40,q))}}),_=["for"],h=e.defineComponent({__name:"OneFormLabel",props:$,setup(d){const{inputId:l}=y();return(o,n)=>(e.openBlock(),e.createElementBlock("label",{for:e.unref(l),class:"block text-sm font-medium text-primary-content select-none"},[e.renderSlot(o.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(o.label),1)])],8,_))}}),I={key:0,class:"text-danger-content text-xs space-y-1"},b=e.defineComponent({__name:"OneFormFeedback",props:S,setup(d){const l=d,{validation:o}=v(),{inputName:n}=y(),a=e.computed(()=>n.value==null&&l.name==null?l.errors??[]:o.value==null?l.errors??[]:(o.value??{})[l.name||n.value]??l.errors??[]);return(t,u)=>a.value.length>0?(e.openBlock(),e.createElementBlock("div",I,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,s=>(e.openBlock(),e.createElementBlock("div",{key:s},e.toDisplayString(s),1))),128))])):e.createCommentVNode("",!0)}});function j(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:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})])}function L(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:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})])}const M=["id","disabled"],A=["selected"],D=["selected","value"],z=["name","id","value","placeholder","disabled","readonly"],P={key:2,class:"flex w-full space-x-3 items-center"},T=["type","name","id","disabled","readonly","checked"],X=["for"],G={key:3,class:"w-full space-y-1"},H=["name","id","value","disabled","readonly","checked"],J=["for"],K={key:4,class:"relative"},Q={class:"absolute p-2 px-3 rounded-md h-full flex items-center select-none"},R=["type","name","id","value","placeholder","disabled","readonly"],B=e.defineComponent({__name:"OneFormInput",props:N,emits:["update:modelValue"],setup(d,{emit:l}){const o=d,n=l,{inputId:a,inputName:t,hasError:u}=y(),s=e.ref(null),p=e.ref(!1);e.onMounted(()=>{o.autofocus&&s.value&&s.value.focus()});const g=e.computed(()=>o.modelValue!=null&&o.modelValue!==""),c=e.computed(()=>{if(o.id)return o.id;const r=(a==null?void 0:a.value)||"";return o.name?`${r}-${o.name}`:r||""}),E=()=>{n("update:modelValue","")},V=e.computed(()=>{const r={"shadow-sm":o.type!=="range","border-danger-base":u.value||o.invalid,"pl-10":o.icon!=null,"pr-10":o.type==="password","rounded-full":o.rounded,"rounded-md":!o.rounded,"text-lg":o.large,"py-2.5":o.large,"py-2":!o.large};return o.inputClass!=null&&(typeof o.inputClass=="string"?r[o.inputClass]=!0:o.inputClass instanceof Array&&o.inputClass.forEach(f=>{r[f]=!0})),r}),m=r=>{o.type==="checkbox"?n("update:modelValue",r.target.checked):n("update:modelValue",r.target.value)};return(r,f)=>r.type==="select"?(e.openBlock(),e.createElementBlock("select",{key:0,id:c.value,ref_key:"inputElement",ref:s,class:e.normalizeClass(["border border-primary-stroke px-3 w-full",{"border-danger-base":e.unref(u)||r.invalid,"text-secondary-content":r.modelValue===""||r.modelValue==null,"rounded-full":r.rounded,"rounded-md":!r.rounded,"text-lg":r.large,"py-2.5":r.large,"py-2":!r.large}]),disabled:r.disabled},[r.placeholder?(e.openBlock(),e.createElementBlock("option",{key:0,selected:r.modelValue===""||r.modelValue==null,disabled:"",hidden:""},e.toDisplayString(r.placeholder),9,A)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options,i=>(e.openBlock(),e.createElementBlock("option",{selected:i.key===r.modelValue,key:i.key,value:i.key},e.toDisplayString(i.value),9,D))),128))],10,M)):r.type==="textarea"?(e.openBlock(),e.createElementBlock("textarea",{key:1,name:r.name||e.unref(t),id:c.value,value:r.modelValue,onInput:m,rows:"3",class:e.normalizeClass(["border border-primary-stroke px-3 w-full placeholder-gray-400",{"border-danger-base":e.unref(u),"rounded-3xl":r.rounded,"rounded-md":!r.rounded,"text-lg":r.large,"py-2.5":r.large,"py-2":!r.large}]),placeholder:r.placeholder,disabled:r.disabled,readonly:r.readonly,ref_key:"inputElement",ref:s},null,42,z)):r.type==="checkbox"?(e.openBlock(),e.createElementBlock("div",P,[e.createElementVNode("input",{type:r.type,name:r.name||e.unref(t),id:c.value,value:!0,onInput:m,disabled:r.disabled,readonly:r.readonly,class:e.normalizeClass(["rounded-md border border-primary-stroke px-2 py-2 shadow-sm",{"border-danger-base":e.unref(u)||r.invalid}]),checked:r.modelValue===!0,ref_key:"inputElement",ref:s},null,42,T),e.createElementVNode("label",{for:c.value,class:"text-primary-content select-none"},e.toDisplayString(r.placeholder),9,X)])):r.type==="radio"?(e.openBlock(),e.createElementBlock("div",G,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options,(i,k)=>(e.openBlock(),e.createElementBlock("div",{key:i.key,class:"flex w-full space-x-3 items-center"},[e.createElementVNode("input",{type:"radio",name:r.name||e.unref(t),id:`${c.value}-${k}`,value:i.key,onInput:m,disabled:r.disabled,readonly:r.readonly,class:e.normalizeClass(["rounded-md border border-primary-stroke px-3 py-2 shadow-sm",{"border-danger-base":e.unref(u)||r.invalid}]),checked:i.key===r.modelValue,ref_for:!0,ref_key:"inputElement",ref:s},null,42,H),e.createElementVNode("label",{for:`${c.value}-${k}`,class:"text-primary-content select-none"},e.toDisplayString(i.value),9,J)]))),128))])):(e.openBlock(),e.createElementBlock("div",K,[e.createElementVNode("div",Q,[r.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.icon),{key:0,class:"w-5 h-5 text-primary-content"})):e.createCommentVNode("",!0)]),e.createElementVNode("input",{type:p.value?"text":r.type,name:r.name||e.unref(t),id:c.value,value:r.modelValue,onInput:m,placeholder:r.placeholder,disabled:r.disabled,readonly:r.readonly,class:e.normalizeClass(["border border-primary-stroke w-full px-3 placeholder-gray-400",V.value]),ref_key:"inputElement",ref:s},null,42,R),r.clearable&&g.value?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:E,class:"absolute p-2 px-3 rounded-md h-full flex items-center right-0 top-0 hover:cursor-pointer select-none"},[e.createVNode(e.unref(C.render),{class:"w-5 h-5 text-secondary-content hover:text-primary-base"})])):r.type==="password"?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:f[0]||(f[0]=i=>p.value=!p.value),class:"absolute p-2 px-3 rounded-md h-full flex items-center right-0 top-0 hover:cursor-pointer select-none"},[p.value?(e.openBlock(),e.createBlock(e.unref(L),{key:0,class:"w-5 h-5 text-primary-content hover:text-primary-base"})):(e.openBlock(),e.createBlock(e.unref(j),{key:1,class:"w-5 h-5 text-secondary-content hover:text-primary-base"}))])):e.createCommentVNode("",!0)]))}}),U={class:"space-y-1"},W={key:2,class:"text-xs text-secondary-content select-none"},Y=e.defineComponent({__name:"OneFormField",props:F,setup(d){const l=d,{formId:o,validation:n}=v(),a=e.computed(()=>l.errors!=null&&l.errors.length>0?!0:l.name==null?!1:(n.value??{})[l.name]!=null);return e.provide("BaseFormField",{inputId:e.computed(()=>{const t=o.value||"form";if(l.id!=null)return`${t}-${l.id}`;if(l.name!=null)return`${t}-field-${l.name}`}),inputName:e.computed(()=>l.name),hasError:a}),(t,u)=>(e.openBlock(),e.createElementBlock("div",U,[t.label?(e.openBlock(),e.createBlock(h,{key:0,label:t.label},null,8,["label"])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"default",{},()=>[e.createVNode(B)]),a.value?(e.openBlock(),e.createBlock(b,{key:1,errors:t.errors},null,8,["errors"])):t.hint.length>0?(e.openBlock(),e.createElementBlock("p",W,e.toDisplayString(t.hint),1)):e.createCommentVNode("",!0)]))}});exports.OneForm=O;exports.OneFormFeedback=b;exports.OneFormField=Y;exports.OneFormInput=B;exports.OneFormLabel=h;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),V=require("../XMarkIcon-f94baa4c.cjs"),C={id:{type:String,required:!1},validation:{type:Object,required:!1}},w={id:{type:String,required:!1},label:{type:String,required:!1},name:{type:String,required:!1},hint:{type:String,required:!1,default:""},errors:{type:Array,required:!1}},F={name:{type:String,required:!1},errors:{type:Array,required:!1}},S={label:{type:String,required:!1}},$={id:{type:String,required:!1},name:{type:String,required:!1},placeholder:{type:String,default:""},icon:{type:[Function,Object]},type:{type:String,default:"text"},inputClass:{required:!1,type:[Array,String]},modelValue:{required:!1,type:[String,Number,Array,Boolean,Object,null]},autofocus:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},rounded:{type:Boolean,default:!1},large:{type:Boolean,default:!1},invalid:{type:Boolean,required:!1,default:!1},options:{type:Array,required:!1,default:[]}},k=()=>e.inject("BaseForm",()=>({formId:e.computed(()=>{}),validation:e.computed(()=>{})}),!0),f=()=>e.inject("BaseFormField",()=>({inputId:e.computed(()=>{}),inputName:e.computed(()=>{}),hasError:e.computed(()=>!1)}),!0),N=["onSubmit","id"],q=e.defineComponent({__name:"OneForm",props:C,emits:["submit"],setup(d,{emit:l}){const o=d;e.provide("BaseForm",{formId:e.computed(()=>o.id),validation:e.computed(()=>o.validation)});const a=()=>{l("submit")};return(n,t)=>(e.openBlock(),e.createElementBlock("form",{onSubmit:e.withModifiers(a,["prevent"]),id:n.id,class:"space-y-3"},[e.renderSlot(n.$slots,"default")],40,N))}}),O=["for"],v=e.defineComponent({__name:"OneFormLabel",props:S,setup(d){const{inputId:l}=f();return(o,a)=>(e.openBlock(),e.createElementBlock("label",{for:e.unref(l),class:"block text-sm font-medium text-primary-content select-none"},[e.renderSlot(o.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(o.label),1)])],8,O))}}),_={key:0,class:"text-danger-content text-xs space-y-1"},h=e.defineComponent({__name:"OneFormFeedback",props:F,setup(d){const l=d,{validation:o}=k(),{inputName:a}=f(),n=e.computed(()=>a.value==null&&l.name==null?l.errors??[]:o.value==null?l.errors??[]:(o.value??{})[l.name||a.value]??l.errors??[]);return(t,u)=>n.value.length>0?(e.openBlock(),e.createElementBlock("div",_,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,i=>(e.openBlock(),e.createElementBlock("div",{key:i},e.toDisplayString(i),1))),128))])):e.createCommentVNode("",!0)}});function I(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:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})])}function j(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:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})])}const L=["id","disabled"],M=["selected"],A=["selected","value"],D=["name","id","value","placeholder","disabled","readonly"],z={key:2,class:"flex w-full space-x-3 items-center"},P=["type","name","id","disabled","readonly","checked"],T=["for"],X={key:3,class:"w-full space-y-1"},G=["name","id","value","disabled","readonly","checked"],H=["for"],J={key:4,class:"relative"},K={class:"absolute p-2 px-3 rounded-md h-full flex items-center select-none"},Q=["type","name","id","value","placeholder","disabled","readonly"],b=e.defineComponent({__name:"OneFormInput",props:$,emits:["update:modelValue"],setup(d,{emit:l}){const o=d,{inputId:a,inputName:n,hasError:t}=f(),u=e.ref(null),i=e.ref(!1);e.onMounted(()=>{o.autofocus&&u.value&&u.value.focus()});const B=e.computed(()=>o.modelValue!=null&&o.modelValue!==""),c=e.computed(()=>{if(o.id)return o.id;const r=(a==null?void 0:a.value)||"";return o.name?`${r}-${o.name}`:r||""}),g=()=>{l("update:modelValue","")},E=e.computed(()=>{const r={"shadow-sm":o.type!=="range","border-danger-base":t.value||o.invalid,"pl-10":o.icon!=null,"pr-10":o.type==="password","rounded-full":o.rounded,"rounded-md":!o.rounded,"text-lg":o.large,"py-2.5":o.large,"py-2":!o.large};return o.inputClass!=null&&(typeof o.inputClass=="string"?r[o.inputClass]=!0:o.inputClass instanceof Array&&o.inputClass.forEach(m=>{r[m]=!0})),r}),p=r=>{o.type==="checkbox"?l("update:modelValue",r.target.checked):l("update:modelValue",r.target.value)};return(r,m)=>r.type==="select"?(e.openBlock(),e.createElementBlock("select",{key:0,id:c.value,ref_key:"inputElement",ref:u,class:e.normalizeClass(["border border-primary-stroke px-3 w-full",{"border-danger-base":e.unref(t)||r.invalid,"text-secondary-content":r.modelValue===""||r.modelValue==null,"rounded-full":r.rounded,"rounded-md":!r.rounded,"text-lg":r.large,"py-2.5":r.large,"py-2":!r.large}]),disabled:r.disabled},[r.placeholder?(e.openBlock(),e.createElementBlock("option",{key:0,selected:r.modelValue===""||r.modelValue==null,disabled:"",hidden:""},e.toDisplayString(r.placeholder),9,M)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options,s=>(e.openBlock(),e.createElementBlock("option",{selected:s.key===r.modelValue,key:s.key,value:s.key},e.toDisplayString(s.value),9,A))),128))],10,L)):r.type==="textarea"?(e.openBlock(),e.createElementBlock("textarea",{key:1,name:r.name||e.unref(n),id:c.value,value:r.modelValue,onInput:p,rows:"3",class:e.normalizeClass(["border border-primary-stroke px-3 w-full placeholder-gray-400",{"border-danger-base":e.unref(t),"rounded-3xl":r.rounded,"rounded-md":!r.rounded,"text-lg":r.large,"py-2.5":r.large,"py-2":!r.large}]),placeholder:r.placeholder,disabled:r.disabled,readonly:r.readonly,ref_key:"inputElement",ref:u},null,42,D)):r.type==="checkbox"?(e.openBlock(),e.createElementBlock("div",z,[e.createElementVNode("input",{type:r.type,name:r.name||e.unref(n),id:c.value,value:!0,onInput:p,disabled:r.disabled,readonly:r.readonly,class:e.normalizeClass(["rounded-md border border-primary-stroke px-2 py-2 shadow-sm",{"border-danger-base":e.unref(t)||r.invalid}]),checked:r.modelValue===!0,ref_key:"inputElement",ref:u},null,42,P),e.createElementVNode("label",{for:c.value,class:"text-primary-content select-none"},e.toDisplayString(r.placeholder),9,T)])):r.type==="radio"?(e.openBlock(),e.createElementBlock("div",X,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options,(s,y)=>(e.openBlock(),e.createElementBlock("div",{key:s.key,class:"flex w-full space-x-3 items-center"},[e.createElementVNode("input",{type:"radio",name:r.name||e.unref(n),id:`${c.value}-${y}`,value:s.key,onInput:p,disabled:r.disabled,readonly:r.readonly,class:e.normalizeClass(["rounded-md border border-primary-stroke px-3 py-2 shadow-sm",{"border-danger-base":e.unref(t)||r.invalid}]),checked:s.key===r.modelValue,ref_for:!0,ref_key:"inputElement",ref:u},null,42,G),e.createElementVNode("label",{for:`${c.value}-${y}`,class:"text-primary-content select-none"},e.toDisplayString(s.value),9,H)]))),128))])):(e.openBlock(),e.createElementBlock("div",J,[e.createElementVNode("div",K,[r.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.icon),{key:0,class:"w-5 h-5 text-primary-content"})):e.createCommentVNode("",!0)]),e.createElementVNode("input",{type:i.value?"text":r.type,name:r.name||e.unref(n),id:c.value,value:r.modelValue,onInput:p,placeholder:r.placeholder,disabled:r.disabled,readonly:r.readonly,class:e.normalizeClass(["border border-primary-stroke w-full px-3 placeholder-gray-400",E.value]),ref_key:"inputElement",ref:u},null,42,Q),r.clearable&&B.value?(e.openBlock(),e.createElementBlock("div",{key:0,onClick:g,class:"absolute p-2 px-3 rounded-md h-full flex items-center right-0 top-0 hover:cursor-pointer select-none"},[e.createVNode(e.unref(V.render),{class:"w-5 h-5 text-secondary-content hover:text-primary-base"})])):r.type==="password"?(e.openBlock(),e.createElementBlock("div",{key:1,onClick:m[0]||(m[0]=s=>i.value=!i.value),class:"absolute p-2 px-3 rounded-md h-full flex items-center right-0 top-0 hover:cursor-pointer select-none"},[i.value?(e.openBlock(),e.createBlock(e.unref(j),{key:0,class:"w-5 h-5 text-primary-content hover:text-primary-base"})):(e.openBlock(),e.createBlock(e.unref(I),{key:1,class:"w-5 h-5 text-secondary-content hover:text-primary-base"}))])):e.createCommentVNode("",!0)]))}}),R={class:"space-y-1"},U={key:2,class:"text-xs text-secondary-content select-none"},W=e.defineComponent({__name:"OneFormField",props:w,setup(d){const l=d,{formId:o,validation:a}=k(),n=e.computed(()=>l.errors!=null&&l.errors.length>0?!0:l.name==null?!1:(a.value??{})[l.name]!=null);return e.provide("BaseFormField",{inputId:e.computed(()=>{const t=o.value||"form";if(l.id!=null)return`${t}-${l.id}`;if(l.name!=null)return`${t}-field-${l.name}`}),inputName:e.computed(()=>l.name),hasError:n}),(t,u)=>(e.openBlock(),e.createElementBlock("div",R,[t.label?(e.openBlock(),e.createBlock(v,{key:0,label:t.label},null,8,["label"])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"default",{},()=>[e.createVNode(b)]),n.value?(e.openBlock(),e.createBlock(h,{key:1,errors:t.errors},null,8,["errors"])):t.hint.length>0?(e.openBlock(),e.createElementBlock("p",U,e.toDisplayString(t.hint),1)):e.createCommentVNode("",!0)]))}});exports.OneForm=q;exports.OneFormFeedback=h;exports.OneFormField=W;exports.OneFormInput=b;exports.OneFormLabel=v;
|