@oneb/ui-vue 0.0.20 → 0.0.22
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-2e7f7f88.cjs +1 -0
- package/dist/{OneBrowserMenu.vue_vue_type_script_setup_true_lang-197489be.js → OneBrowserMenu.vue_vue_type_script_setup_true_lang-33d037e7.js} +52 -52
- package/dist/XMarkIcon-51ef0691.js +20 -0
- package/dist/XMarkIcon-f94baa4c.cjs +1 -0
- package/dist/button/index.cjs +1 -1
- package/dist/button/index.js +4 -121
- 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 +117 -132
- package/dist/index-7ea12e26.js +124 -0
- package/dist/index-8152bae6.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +20 -19
- package/dist/layout/index.cjs +1 -1
- package/dist/layout/index.js +285 -112
- package/dist/layout/layout.d.ts +28 -0
- package/package.json +1 -1
- package/dist/OneBrowserMenu.vue_vue_type_script_setup_true_lang-24874222.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),h=require("./common/index.cjs"),g={title:{type:String},stick:{type:String,default:"right"}},k={variant:{type:String,default:"primary"},label:{type:String},icon:{type:[Function,Object]}},y=["data-opened"],w={key:0,class:"text-sm text-secondary-content px-3 py-2 text-left"},f=e.defineComponent({__name:"OneDropdown",props:g,emits:["open","close"],setup(d,{emit:l}){const i=d,c=e.ref(!1),n=e.ref(null),r=()=>{c.value=!c.value,c.value?l("open"):l("close")};e.provide("OneDropdown",{onToggle:r});const t=e.computed(()=>{const o=n.value!=null&&n.value.offsetLeft<270;return n.value!=null&&n.value.offsetTop+270>window.innerHeight?"up"+(o?"-right":"-left"):"down"+(o?"-right":"-left")}),s=e.computed(()=>{const o=["absolute z-10 w-fit rounded-md bg-white","py-1 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none","overflow-auto max-h-[540px] min-w-[150px] max-w-[540px]"];return t.value.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":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 i=d,c=e.inject("OneDropdown"),n=()=>{c!==void 0&&c.onToggle(),l("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,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 _(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 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 l=d,i=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 a,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:((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 s,o,a,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((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,[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(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,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,i=()=>{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: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=>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",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 $, provide as B, computed as
|
|
1
|
+
import { defineComponent as x, ref as $, provide as B, computed as m, openBlock as l, createElementBlock as d, renderSlot as z, normalizeProps as A, guardReactiveProps as L, createCommentVNode as w, 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
2
|
import { OneAvatar as k } from "./common/index.js";
|
|
3
3
|
const q = {
|
|
4
4
|
title: {
|
|
@@ -27,35 +27,35 @@ const q = {
|
|
|
27
27
|
props: q,
|
|
28
28
|
emits: ["open", "close"],
|
|
29
29
|
setup(p, { emit: s }) {
|
|
30
|
-
const u = p, c = $(!1),
|
|
30
|
+
const u = p, c = $(!1), o = $(null), r = () => {
|
|
31
31
|
c.value = !c.value, c.value ? s("open") : s("close");
|
|
32
32
|
};
|
|
33
33
|
B("OneDropdown", {
|
|
34
34
|
onToggle: r
|
|
35
35
|
});
|
|
36
|
-
const t =
|
|
37
|
-
const
|
|
38
|
-
return
|
|
39
|
-
}), i =
|
|
40
|
-
const
|
|
36
|
+
const t = m(() => {
|
|
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 = m(() => {
|
|
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
|
|
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 (
|
|
47
|
+
return (n, a) => (l(), d("div", {
|
|
48
48
|
class: "relative inline-block",
|
|
49
49
|
ref_key: "menuRef",
|
|
50
|
-
ref:
|
|
50
|
+
ref: o,
|
|
51
51
|
"data-opened": c.value
|
|
52
52
|
}, [
|
|
53
|
-
z(
|
|
53
|
+
z(n.$slots, "button", A(L({ onToggle: r, isExpanded: c.value }))),
|
|
54
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
57
|
onClick: r
|
|
58
|
-
})) :
|
|
58
|
+
})) : w("", !0),
|
|
59
59
|
h(P, {
|
|
60
60
|
"enter-active-class": "transition ease-out duration-100",
|
|
61
61
|
"enter-from-class": "transform opacity-0 scale-95",
|
|
@@ -72,9 +72,9 @@ const q = {
|
|
|
72
72
|
"aria-orientation": "vertical",
|
|
73
73
|
tabindex: "-1"
|
|
74
74
|
}, [
|
|
75
|
-
|
|
76
|
-
z(
|
|
77
|
-
], 2)) :
|
|
75
|
+
n.title ? (l(), d("div", N, f(n.title), 1)) : w("", !0),
|
|
76
|
+
z(n.$slots, "menu", A(L({ onToggle: r })))
|
|
77
|
+
], 2)) : w("", !0)
|
|
78
78
|
]),
|
|
79
79
|
_: 3
|
|
80
80
|
})
|
|
@@ -85,25 +85,25 @@ const q = {
|
|
|
85
85
|
props: H,
|
|
86
86
|
emits: ["click"],
|
|
87
87
|
setup(p, { emit: s }) {
|
|
88
|
-
const u = p, c = D("OneDropdown"),
|
|
88
|
+
const u = p, c = D("OneDropdown"), o = () => {
|
|
89
89
|
c !== void 0 && c.onToggle(), s("click");
|
|
90
|
-
}, r =
|
|
90
|
+
}, r = m(() => {
|
|
91
91
|
const t = [];
|
|
92
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
94
|
return (t, i) => (l(), d("button", {
|
|
95
95
|
class: b(["px-3 py-1.5 flex items-center space-x-3 w-full whitespace-nowrap", r.value]),
|
|
96
|
-
onClick: F(
|
|
96
|
+
onClick: F(o, ["prevent"])
|
|
97
97
|
}, [
|
|
98
98
|
t.icon ? (l(), v(T(t.icon), {
|
|
99
99
|
key: 0,
|
|
100
100
|
class: "w-4 h-4"
|
|
101
|
-
})) :
|
|
101
|
+
})) : w("", !0),
|
|
102
102
|
e("span", null, f(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 U(p, s) {
|
|
|
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 G(p, s) {
|
|
|
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 J = {
|
|
|
162
162
|
onLogout: {
|
|
163
163
|
type: Function
|
|
164
164
|
}
|
|
165
|
-
},
|
|
165
|
+
}, J = {
|
|
166
166
|
workspace: {
|
|
167
167
|
type: Object,
|
|
168
168
|
required: !0
|
|
@@ -189,38 +189,38 @@ const J = {
|
|
|
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 s = p, u =
|
|
199
|
+
const s = p, u = m(() => {
|
|
200
200
|
var r;
|
|
201
201
|
return (r = s.menu) == null ? void 0 : r.map((t) => {
|
|
202
202
|
let i = { label: t.label };
|
|
203
203
|
t.icon != null && (i = { ...i, icon: t.icon });
|
|
204
|
-
const
|
|
204
|
+
const n = typeof t.click == "function" ? t.click : () => {
|
|
205
205
|
};
|
|
206
206
|
return {
|
|
207
207
|
key: t.label,
|
|
208
208
|
args: i,
|
|
209
|
-
click:
|
|
209
|
+
click: n
|
|
210
210
|
};
|
|
211
211
|
});
|
|
212
212
|
}), c = () => {
|
|
213
213
|
typeof s.onAccount == "function" && s.onAccount();
|
|
214
|
-
},
|
|
214
|
+
}, o = () => {
|
|
215
215
|
typeof s.onLogout == "function" && s.onLogout();
|
|
216
216
|
};
|
|
217
217
|
return (r, t) => (l(), v(j, { stick: "right" }, {
|
|
218
|
-
button: y(({ onToggle: i, isExpanded:
|
|
218
|
+
button: y(({ onToggle: i, isExpanded: n }) => {
|
|
219
219
|
var a, g;
|
|
220
220
|
return [
|
|
221
221
|
e("button", {
|
|
222
222
|
onClick: i,
|
|
223
|
-
class: b(["p-1 rounded-full hover:bg-secondary-10", [
|
|
223
|
+
class: b(["p-1 rounded-full hover:bg-secondary-10", [n ? "bg-secondary-25" : ""]])
|
|
224
224
|
}, [
|
|
225
225
|
h(k, {
|
|
226
226
|
text: ((a = r.user) == null ? void 0 : a.name) || "",
|
|
@@ -228,18 +228,18 @@ const J = {
|
|
|
228
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
234
|
menu: y(() => {
|
|
235
|
-
var i,
|
|
235
|
+
var i, n, a, g;
|
|
236
236
|
return [
|
|
237
|
-
e("div",
|
|
237
|
+
e("div", Q, [
|
|
238
238
|
e("div", null, [
|
|
239
239
|
h(k, {
|
|
240
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"])
|
|
@@ -251,7 +251,7 @@ const J = {
|
|
|
251
251
|
]),
|
|
252
252
|
e("div", Y, [
|
|
253
253
|
h(C, {
|
|
254
|
-
icon: S(
|
|
254
|
+
icon: S(W),
|
|
255
255
|
label: r.accountLabel,
|
|
256
256
|
class: "rounded",
|
|
257
257
|
onClick: c
|
|
@@ -262,10 +262,10 @@ const J = {
|
|
|
262
262
|
onClick: _.click
|
|
263
263
|
}), null, 16, ["onClick"]))), 128)),
|
|
264
264
|
h(C, {
|
|
265
|
-
icon: S(
|
|
265
|
+
icon: S(U),
|
|
266
266
|
label: r.logoutLabel,
|
|
267
267
|
class: "rounded",
|
|
268
|
-
onClick:
|
|
268
|
+
onClick: o
|
|
269
269
|
}, null, 8, ["icon", "label"])
|
|
270
270
|
])
|
|
271
271
|
];
|
|
@@ -369,16 +369,16 @@ function Z(p, s) {
|
|
|
369
369
|
const ee = ["onClick"], te = {
|
|
370
370
|
class: "space-x-2 flex items-center px-3 py-2",
|
|
371
371
|
style: { width: "300px" }
|
|
372
|
-
},
|
|
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
373
|
__name: "OneBrowserMenu",
|
|
374
|
-
props:
|
|
374
|
+
props: J,
|
|
375
375
|
setup(p) {
|
|
376
376
|
const s = p, u = () => {
|
|
377
377
|
typeof s.onChange == "function" && s.onChange();
|
|
378
|
-
}, c = (
|
|
379
|
-
typeof s.onApp == "function" && s.onApp(
|
|
378
|
+
}, c = (o) => {
|
|
379
|
+
typeof s.onApp == "function" && s.onApp(o);
|
|
380
380
|
};
|
|
381
|
-
return (
|
|
381
|
+
return (o, r) => (l(), v(j, { stick: "right" }, {
|
|
382
382
|
button: y(({ onToggle: t, isExpanded: i }) => [
|
|
383
383
|
e("button", {
|
|
384
384
|
onClick: t,
|
|
@@ -386,35 +386,35 @@ const ee = ["onClick"], te = {
|
|
|
386
386
|
}, [
|
|
387
387
|
h(S(Z), {
|
|
388
388
|
class: "text-secondary-base",
|
|
389
|
-
style: E(`width: ${
|
|
389
|
+
style: E(`width: ${o.iconSize}px; height: ${o.iconSize}px`)
|
|
390
390
|
}, null, 8, ["style"])
|
|
391
391
|
], 10, ee)
|
|
392
392
|
]),
|
|
393
393
|
menu: y(() => {
|
|
394
|
-
var t, i,
|
|
394
|
+
var t, i, n;
|
|
395
395
|
return [
|
|
396
396
|
e("div", te, [
|
|
397
|
-
e("div",
|
|
397
|
+
e("div", ne, [
|
|
398
398
|
h(k, {
|
|
399
|
-
text: ((t =
|
|
400
|
-
src: (i =
|
|
399
|
+
text: ((t = o.workspace) == null ? void 0 : t.name) || "",
|
|
400
|
+
src: (i = o.workspace) == null ? void 0 : i.photo_url,
|
|
401
401
|
size: 44,
|
|
402
402
|
rounded: !1,
|
|
403
403
|
class: "mx-auto"
|
|
404
404
|
}, null, 8, ["text", "src"])
|
|
405
405
|
]),
|
|
406
|
-
e("div",
|
|
406
|
+
e("div", oe, f((n = o.workspace) == null ? void 0 : n.name), 1),
|
|
407
407
|
e("div", re, [
|
|
408
408
|
e("button", {
|
|
409
409
|
class: "text-sm border border-secondary-stroke rounded px-2 py-0.5 text-secondary-content hover:text-primary-content",
|
|
410
410
|
onClick: u
|
|
411
|
-
}, f(
|
|
411
|
+
}, f(o.changeLabel), 1)
|
|
412
412
|
])
|
|
413
413
|
]),
|
|
414
414
|
e("div", se, [
|
|
415
|
-
e("div", ie, f(
|
|
415
|
+
e("div", ie, f(o.appsTitle), 1),
|
|
416
416
|
e("div", le, [
|
|
417
|
-
(l(!0), d(O, null, M(
|
|
417
|
+
(l(!0), d(O, null, M(o.apps, (a) => (l(), d("button", {
|
|
418
418
|
key: a.id,
|
|
419
419
|
onClick: (g) => c(a),
|
|
420
420
|
class: "p-1.5 flex flex-col items-center justify-center rounded hover:bg-secondary-10",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { openBlock as e, createElementBlock as r, createElementVNode as o } from "vue";
|
|
2
|
+
function c(t, n) {
|
|
3
|
+
return e(), r("svg", {
|
|
4
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
fill: "none",
|
|
6
|
+
viewBox: "0 0 24 24",
|
|
7
|
+
"stroke-width": "1.8",
|
|
8
|
+
stroke: "currentColor",
|
|
9
|
+
"aria-hidden": "true"
|
|
10
|
+
}, [
|
|
11
|
+
o("path", {
|
|
12
|
+
"stroke-linecap": "round",
|
|
13
|
+
"stroke-linejoin": "round",
|
|
14
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
15
|
+
})
|
|
16
|
+
]);
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
c as r
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue");function r(t,n){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:"M6 18L18 6M6 6l12 12"})])}exports.render=r;
|
package/dist/button/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index-8152bae6.cjs");require("vue");require("../_plugin-vue_export-helper-f246444f.cjs");exports.OneButton=e._sfc_main;
|
package/dist/button/index.js
CHANGED
|
@@ -1,123 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
class: "spinner",
|
|
5
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
6
|
-
viewBox: "0 0 24 24",
|
|
7
|
-
style: { animation: "one-sp-ico-rot 2.7s linear infinite" }
|
|
8
|
-
}, B = /* @__PURE__ */ f("circle", {
|
|
9
|
-
style: { "stroke-linecap": "round", animation: "one-sp-ico-dash 1.7s ease-in-out infinite" },
|
|
10
|
-
class: "opacity-75",
|
|
11
|
-
cx: "12",
|
|
12
|
-
cy: "12",
|
|
13
|
-
r: "8",
|
|
14
|
-
fill: "none",
|
|
15
|
-
stroke: "currentColor",
|
|
16
|
-
"stroke-width": "2"
|
|
17
|
-
}, null, -1), L = [
|
|
18
|
-
B
|
|
19
|
-
];
|
|
20
|
-
function S(n, r) {
|
|
21
|
-
return o(), a("svg", C, L);
|
|
22
|
-
}
|
|
23
|
-
const z = /* @__PURE__ */ _(k, [["render", S]]), I = {
|
|
24
|
-
variant: {
|
|
25
|
-
type: String,
|
|
26
|
-
default: "primary"
|
|
27
|
-
},
|
|
28
|
-
size: {
|
|
29
|
-
type: String,
|
|
30
|
-
default: "md"
|
|
31
|
-
},
|
|
32
|
-
label: {
|
|
33
|
-
type: String
|
|
34
|
-
},
|
|
35
|
-
icon: {
|
|
36
|
-
type: [Function, Object]
|
|
37
|
-
},
|
|
38
|
-
isLoading: {
|
|
39
|
-
type: Boolean
|
|
40
|
-
},
|
|
41
|
-
isSubmit: {
|
|
42
|
-
type: Boolean,
|
|
43
|
-
default: !1
|
|
44
|
-
},
|
|
45
|
-
disabled: {
|
|
46
|
-
type: Boolean,
|
|
47
|
-
default: !1
|
|
48
|
-
},
|
|
49
|
-
active: {
|
|
50
|
-
type: Boolean,
|
|
51
|
-
default: !1
|
|
52
|
-
},
|
|
53
|
-
iconClass: {
|
|
54
|
-
type: [String, Array]
|
|
55
|
-
}
|
|
56
|
-
}, D = [
|
|
57
|
-
"relative inline-flex",
|
|
58
|
-
"border",
|
|
59
|
-
"items-center justify-center",
|
|
60
|
-
"font-medium whitespace-nowrap",
|
|
61
|
-
"disabled:opacity-50 disabled:cursor-default",
|
|
62
|
-
"focus:outline-none focus:ring-2 focus:ring-offset-2",
|
|
63
|
-
"transition-colors duration-200"
|
|
64
|
-
], O = {
|
|
65
|
-
sm: ["px-2 py-1 text-sm"],
|
|
66
|
-
md: ["px-3 py-2"],
|
|
67
|
-
lg: ["px-4 py-3"]
|
|
68
|
-
}, j = {
|
|
69
|
-
primary: ["rounded-md border-transparent bg-primary-base disabled:bg-primary-hover text-sm text-white hover:bg-primary-hover focus:ring-primary-glow"],
|
|
70
|
-
secondary: ["rounded-md border-primary-stroke bg-primary-body disabled:bg-primary-body-hover text-black text-sm hover:bg-primary-body-hover focus:ring-tertiary-glow"],
|
|
71
|
-
info: ["rounded-md border-transparent bg-info-base disabled:bg-info-hover text-white text-sm hover:bg-info-hover focus:ring-info-glow"],
|
|
72
|
-
success: ["rounded-md border-transparent bg-success-base disabled:bg-success-hover text-white text-sm hover:bg-success-hover focus:ring-success-glow"],
|
|
73
|
-
warning: ["rounded-md border-transparent bg-warning-base disabled:bg-warning-hover text-white text-sm hover:bg-warning-hover focus:ring-warning-glow"],
|
|
74
|
-
danger: ["rounded-md border-transparent bg-danger-base disabled:bg-danger-hover text-white text-sm hover:bg-danger-hover focus:ring-danger-glow"],
|
|
75
|
-
touch: ["rounded-full border-transparent text-black hover:bg-primary-body-hover hover:shadow p-3 text-sm focus:ring-tertiary-glow"],
|
|
76
|
-
link: ["rounded-md border-transparent items-center text-info-base hover:text-info-hover text-sm"],
|
|
77
|
-
none: ["rounded-md border-transparent text-gray-500"]
|
|
78
|
-
}, A = (n = "primary", r = "md") => {
|
|
79
|
-
const e = [];
|
|
80
|
-
return e.push(...D), e.push(...j[n] ?? []), n !== "touch" && e.push(...O[r] ?? []), e;
|
|
81
|
-
}, E = ["disabled", "title", "type", "onClick"], F = /* @__PURE__ */ y({
|
|
82
|
-
__name: "OneButton",
|
|
83
|
-
props: I,
|
|
84
|
-
emits: ["click"],
|
|
85
|
-
setup(n, { emit: r }) {
|
|
86
|
-
const e = n, p = () => {
|
|
87
|
-
r("click");
|
|
88
|
-
}, l = t(() => e.icon), b = t(() => {
|
|
89
|
-
const s = A(e.variant, e.size);
|
|
90
|
-
return e.variant === "touch" && e.active && s.push("bg-primary-body-active"), s;
|
|
91
|
-
}), g = t(() => e.disabled || e.isLoading), m = t(() => e.label && e.label.length > 0 && e.variant !== "touch"), h = t(() => {
|
|
92
|
-
const s = [
|
|
93
|
-
"inline-block text-ellipsis overflow-hidden"
|
|
94
|
-
];
|
|
95
|
-
return (e.icon != null || e.isLoading) && s.push("ml-2"), s;
|
|
96
|
-
}), c = t(() => {
|
|
97
|
-
const s = [];
|
|
98
|
-
return e.size === "sm" ? s.push("w-3 h-3") : e.size === "lg" ? s.push("w-5 h-5") : s.push("w-4 h-4"), typeof e.iconClass == "string" ? s.push(e.iconClass) : e.iconClass instanceof Array && s.push(...e.iconClass), s;
|
|
99
|
-
});
|
|
100
|
-
return (s, N) => (o(), a("button", {
|
|
101
|
-
class: i(b.value),
|
|
102
|
-
disabled: g.value,
|
|
103
|
-
title: s.label,
|
|
104
|
-
type: s.isSubmit ? "submit" : "button",
|
|
105
|
-
onClick: v(p, ["stop"])
|
|
106
|
-
}, [
|
|
107
|
-
s.isLoading ? (o(), d(z, {
|
|
108
|
-
key: 0,
|
|
109
|
-
class: i(c.value)
|
|
110
|
-
}, null, 8, ["class"])) : l.value != null ? (o(), d(w(l.value), {
|
|
111
|
-
key: 1,
|
|
112
|
-
class: i(c.value)
|
|
113
|
-
}, null, 8, ["class"])) : u("", !0),
|
|
114
|
-
m.value ? (o(), a("span", {
|
|
115
|
-
key: 2,
|
|
116
|
-
class: i(h.value)
|
|
117
|
-
}, x(s.label), 3)) : u("", !0)
|
|
118
|
-
], 10, E));
|
|
119
|
-
}
|
|
120
|
-
});
|
|
1
|
+
import { _ as p } from "../index-7ea12e26.js";
|
|
2
|
+
import "vue";
|
|
3
|
+
import "../_plugin-vue_export-helper-dad06003.js";
|
|
121
4
|
export {
|
|
122
|
-
|
|
5
|
+
p as OneButton
|
|
123
6
|
};
|
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-2e7f7f88.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-33d037e7.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"),w={id:{type:String,required:!1},validation:{type:Object,required:!1}},V={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}},C={name:{type:String,required:!1},errors:{type:Array,required:!1}},F={label:{type:String,required:!1}},S={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),$=["onSubmit","id"],N=e.defineComponent({__name:"OneForm",props:w,emits:["submit"],setup(a,{emit:l}){const o=a;e.provide("BaseForm",{formId:e.computed(()=>o.id),validation:e.computed(()=>o.validation)});const d=()=>{l("submit")};return(n,t)=>(e.openBlock(),e.createElementBlock("form",{onSubmit:e.withModifiers(d,["prevent"]),id:n.id,class:"space-y-3"},[e.renderSlot(n.$slots,"default")],40,$))}}),q=["for"],v=e.defineComponent({__name:"OneFormLabel",props:F,setup(a){const{inputId:l}=f();return(o,d)=>(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,q))}}),_={key:0,class:"text-danger-content text-xs space-y-1"},h=e.defineComponent({__name:"OneFormFeedback",props:C,setup(a){const l=a,{validation:o}=k(),{inputName:d}=f(),n=e.computed(()=>d.value==null&&l.name==null?l.errors??[]:o.value==null?l.errors??[]:(o.value??{})[l.name||d.value]??l.errors??[]);return(t,i)=>n.value.length>0?(e.openBlock(),e.createElementBlock("div",_,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,u=>(e.openBlock(),e.createElementBlock("div",{key:u},e.toDisplayString(u),1))),128))])):e.createCommentVNode("",!0)}});function O(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:"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(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:"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"})])}function I(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:"M6 18L18 6M6 6l12 12"})])}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"],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:S,emits:["update:modelValue"],setup(a,{emit:l}){const o=a,{inputId:d,inputName:n,hasError:t}=f(),i=e.ref(null),u=e.ref(!1);e.onMounted(()=>{o.autofocus&&i.value&&i.value.focus()});const B=e.computed(()=>o.modelValue!=null&&o.modelValue!==""),c=e.computed(()=>{if(o.id)return o.id;const r=(d==null?void 0:d.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:i,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",{"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:i},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-3 py-2 shadow-sm",{"border-danger-base":e.unref(t)||r.invalid}]),checked:r.modelValue===!0,ref_key:"inputElement",ref:i},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",G,[(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:i},null,42,H),e.createElementVNode("label",{for:`${c.value}-${y}`,class:"text-primary-content select-none"},e.toDisplayString(s.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:u.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",E.value]),ref_key:"inputElement",ref:i},null,42,R),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(I),{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=>u.value=!u.value),class:"absolute p-2 px-3 rounded-md h-full flex items-center right-0 top-0 hover:cursor-pointer select-none"},[u.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(O),{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"},X=e.defineComponent({__name:"OneFormField",props:V,setup(a){const l=a,{formId:o,validation:d}=k(),n=e.computed(()=>l.errors!=null&&l.errors.length>0?!0:l.name==null?!1:(d.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,i)=>(e.openBlock(),e.createElementBlock("div",U,[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",W,e.toDisplayString(t.hint),1)):e.createCommentVNode("",!0)]))}});exports.OneForm=N;exports.OneFormFeedback=h;exports.OneFormField=X;exports.OneFormInput=b;exports.OneFormLabel=v;
|
|
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-3 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;
|