@oneb/ui-vue 0.0.46 → 0.0.47
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-9e476cc1.cjs +1 -0
- package/dist/{OneBrowserMenu.vue_vue_type_script_setup_true_lang-5cfc15cc.js → OneBrowserMenu.vue_vue_type_script_setup_true_lang-d28539b7.js} +111 -111
- 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 +203 -200
- package/package.json +1 -1
- package/dist/OneBrowserMenu.vue_vue_type_script_setup_true_lang-a90b1310.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"),p=require("./common/index.cjs"),g={title:{type:String},stick:{type:String,default:"right"}},y={variant:{type:String,default:"primary"},label:{type:String},icon:{type:[Function,Object]}},k=["data-opened"],x={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:s}){const a=d,c=e.ref(!1),n=e.ref(null),r=()=>{c.value=!c.value,c.value?s("open"):s("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"),a.stick==="right"?o.push("right-0"):a.stick==="left"&&o.push("left-0"),o});return(o,i)=>(e.openBlock(),e.createElementBlock("div",{class:"relative inline-block",ref_key:"menuRef",ref:n,"data-opened":c.value},[e.renderSlot(o.$slots,"button",e.normalizeProps(e.guardReactiveProps({onToggle:r,isExpanded:c.value}))),c.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed top-0 left-0 w-screen h-screen z-10",onClick:r})):e.createCommentVNode("",!0),e.createVNode(e.Transition,{"enter-active-class":"transition ease-out duration-100","enter-from-class":"transform opacity-0 scale-95","enter-to-class":"transform opacity-100 scale-100","leave-active-class":"transition ease-in duration-75","leave-from-class":"transform opacity-100 scale-100","leave-to-class":"transform opacity-0 scale-95"},{default:e.withCtx(()=>[c.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["menu",l.value]),role:"menu","aria-orientation":"vertical",tabindex:"-1"},[o.title?(e.openBlock(),e.createElementBlock("div",x,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,k))}}),v=["onClick"],m=e.defineComponent({__name:"OneDropdownItem",props:y,emits:["click"],setup(d,{emit:s}){const a=d,c=e.inject("OneDropdown"),n=()=>{c!==void 0&&c.onToggle(),s("click")},r=e.computed(()=>{const t=[];return a.variant==="secondary"?t.push("text-secondary-content hover:bg-secondary-body-hover"):a.variant==="danger"?t.push("text-danger-content hover:bg-danger-10"):a.variant==="warning"?t.push("text-warning-content hover:bg-warning-10"):a.variant==="info"?t.push("text-info-content hover:bg-info-10"):t.push("hover:bg-secondary-body-hover"),t});return(t,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 w(d,s){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}},_={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}},C=["onClick"],V={class:"flex flex-col items-center pt-6 pb-3 h-full"},E={class:"flex flex-col px-10 py-1 mt-2 text-center"},N={class:"self-center text-base font-medium tracking-wide text-black"},B={class:"mt-1 text-xs leading-5 text-blue-500"},S={class:"text-left w-full mt-5"},$=e.createElementVNode("div",{class:"space-y-2 text-center py-6",style:{width:"240px"}},null,-1),z=e.createElementVNode("div",{class:"pb-2 flex-shrink-0 mt-auto pt-6 text-xs leading-3 text-gray-400"},"v.1.0.0 (beta)",-1),A=e.defineComponent({__name:"OneUserMenu",props:b,setup(d){const s=d,a=e.computed(()=>{var r;return(r=s.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}})}),c=()=>{typeof s.onAccount=="function"&&s.onAccount()},n=()=>{typeof s.onLogout=="function"&&s.onLogout()};return(r,t)=>(e.openBlock(),e.createBlock(f,{stick:"right"},{button:e.withCtx(({onToggle:l,isExpanded:o})=>{var i,u;return[e.createElementVNode("button",{onClick:l,class:e.normalizeClass(["p-1 rounded-full hover:bg-secondary-10",[o?"bg-secondary-25":""]])},[e.createVNode(p.OneAvatar,{text:((i=r.user)==null?void 0:i.name)||"",size:r.iconSize,src:(u=r.user)==null?void 0:u.photo_url,rounded:!0},null,8,["text","size","src"])],10,C)]}),menu:e.withCtx(()=>{var l,o,i,u;return[e.createElementVNode("div",V,[e.createVNode(p.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",E,[e.createElementVNode("div",N,e.toDisplayString((i=r.user)==null?void 0:i.name),1),e.createElementVNode("div",B,e.toDisplayString((u=r.user)==null?void 0:u.email),1)]),typeof s.onAccount=="function"?(e.openBlock(),e.createElementBlock("a",{key:0,onClick:c,class:"cursor-pointer justify-center px-8 py-3 mt-3 text-xs font-semibold tracking-wide leading-5 text-gray-600 border border-solid bg-neutral-100 border-slate-200 rounded-[50px] hover:bg-neutral-200"}," Обліковий запис 1B ")):e.createCommentVNode("",!0),e.createElementVNode("div",S,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,h=>(e.openBlock(),e.createBlock(m,e.mergeProps({key:h.key},h.args,{onClick:h.click}),null,16,["onClick"]))),128)),e.createVNode(m,{icon:e.unref(w),label:r.logoutLabel,class:"rounded",onClick:n},null,8,["icon","label"])]),$,z])]}),_:1}))}});function L(d,s){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 D=["onClick"],O={class:"space-x-2 flex items-center px-3 py-2",style:{width:"300px"}},P={class:"flex-shrink-0"},j={class:"w-full text-left"},F={class:"flex-shrink-0"},M={class:"px-3 py-2 border-t border-secondary-stroke"},T={class:"text-secondary-content text-left pb-1 text-sm"},q={class:"grid grid-cols-3 gap-1"},R=["onClick"],H={class:"block bg-white mx-auto flex-shrink-0 border border-secondary-stroke p-1 rounded-lg"},I={class:"w-full overflow-hidden text-ellipsis whitespace-nowrap text-center text-sm mt-1"},W=e.defineComponent({__name:"OneBrowserMenu",props:_,setup(d){const s=d,a=()=>{typeof s.onChange=="function"&&s.onChange()},c=n=>{typeof s.onApp=="function"&&s.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(L),{class:"text-secondary-base",style:e.normalizeStyle(`width: ${n.iconSize}px; height: ${n.iconSize}px`)},null,8,["style"])],10,D)]),menu:e.withCtx(()=>{var t,l,o;return[e.createElementVNode("div",O,[e.createElementVNode("div",P,[e.createVNode(p.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",j,e.toDisplayString((o=n.workspace)==null?void 0:o.name),1),e.createElementVNode("div",F,[e.createElementVNode("button",{class:"text-sm border border-secondary-stroke rounded px-2 py-0.5 text-secondary-content hover:text-primary-content",onClick:a},e.toDisplayString(n.changeLabel),1)])]),e.createElementVNode("div",M,[e.createElementVNode("div",T,e.toDisplayString(n.appsTitle),1),e.createElementVNode("div",q,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.apps,i=>(e.openBlock(),e.createElementBlock("button",{key:i.id,onClick:u=>c(i),class:"p-1.5 flex flex-col items-center justify-center rounded hover:bg-secondary-10",style:{width:"88px",height:"88px"}},[e.createElementVNode("span",H,[e.createVNode(p.OneAvatar,{text:i.name,src:i.photo_url,size:44,rounded:!1},null,8,["text","src"])]),e.createElementVNode("span",I,e.toDisplayString(i.name),1)],8,R))),128))])])]}),_:1}))}});exports._sfc_main=f;exports._sfc_main$1=m;exports._sfc_main$2=A;exports._sfc_main$3=W;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as k, ref as C, provide as P, computed as
|
|
1
|
+
import { defineComponent as k, ref as C, provide as P, computed as m, openBlock as l, createElementBlock as d, renderSlot as $, normalizeProps as S, guardReactiveProps as A, createCommentVNode as y, createVNode as f, Transition as D, withCtx as x, normalizeClass as b, toDisplayString as h, inject as F, withModifiers as M, createBlock as w, resolveDynamicComponent as T, createElementVNode as e, Fragment as L, renderList as O, mergeProps as V, unref as j, normalizeStyle as E } from "vue";
|
|
2
2
|
import { OneAvatar as v } from "./common/index.js";
|
|
3
3
|
const q = {
|
|
4
4
|
title: {
|
|
@@ -27,36 +27,36 @@ const q = {
|
|
|
27
27
|
props: q,
|
|
28
28
|
emits: ["open", "close"],
|
|
29
29
|
setup(p, { emit: s }) {
|
|
30
|
-
const
|
|
31
|
-
|
|
30
|
+
const u = p, c = C(!1), n = C(null), r = () => {
|
|
31
|
+
c.value = !c.value, c.value ? s("open") : s("close");
|
|
32
32
|
};
|
|
33
33
|
P("OneDropdown", {
|
|
34
|
-
onToggle:
|
|
34
|
+
onToggle: r
|
|
35
35
|
});
|
|
36
|
-
const t =
|
|
37
|
-
const o =
|
|
38
|
-
return
|
|
39
|
-
}),
|
|
36
|
+
const t = m(() => {
|
|
37
|
+
const o = n.value != null && n.value.offsetLeft < 270;
|
|
38
|
+
return n.value != null && n.value.offsetTop + 270 > window.innerHeight ? "up" + (o ? "-right" : "-left") : "down" + (o ? "-right" : "-left");
|
|
39
|
+
}), i = m(() => {
|
|
40
40
|
const o = [
|
|
41
41
|
"absolute z-10 w-fit rounded-md bg-white",
|
|
42
42
|
"py-1 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",
|
|
43
43
|
"overflow-auto max-h-[540px] min-w-[150px] max-w-[540px]"
|
|
44
44
|
];
|
|
45
|
-
return t.value.startsWith("up") ? o.push("bottom-1 mb-10") : t.value.startsWith("down") && o.push("top-1 mt-10"),
|
|
45
|
+
return t.value.startsWith("up") ? o.push("bottom-1 mb-10") : t.value.startsWith("down") && o.push("top-1 mt-10"), u.stick === "right" ? o.push("right-0") : u.stick === "left" && o.push("left-0"), o;
|
|
46
46
|
});
|
|
47
|
-
return (o,
|
|
47
|
+
return (o, a) => (l(), d("div", {
|
|
48
48
|
class: "relative inline-block",
|
|
49
49
|
ref_key: "menuRef",
|
|
50
|
-
ref:
|
|
51
|
-
"data-opened":
|
|
50
|
+
ref: n,
|
|
51
|
+
"data-opened": c.value
|
|
52
52
|
}, [
|
|
53
|
-
$(o.$slots, "button", S(A({ onToggle:
|
|
54
|
-
|
|
53
|
+
$(o.$slots, "button", S(A({ 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(D, {
|
|
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: x(() => [
|
|
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
|
o.title ? (l(), d("div", N, h(o.title), 1)) : y("", !0),
|
|
76
|
-
$(o.$slots, "menu", S(A({ onToggle:
|
|
76
|
+
$(o.$slots, "menu", S(A({ onToggle: r })))
|
|
77
77
|
], 2)) : y("", !0)
|
|
78
78
|
]),
|
|
79
79
|
_: 3
|
|
80
80
|
})
|
|
81
81
|
], 8, I));
|
|
82
82
|
}
|
|
83
|
-
}), z = /* @__PURE__ */ k({
|
|
83
|
+
}), R = ["onClick"], z = /* @__PURE__ */ k({
|
|
84
84
|
__name: "OneDropdownItem",
|
|
85
85
|
props: H,
|
|
86
86
|
emits: ["click"],
|
|
87
87
|
setup(p, { emit: s }) {
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
},
|
|
88
|
+
const u = p, c = F("OneDropdown"), n = () => {
|
|
89
|
+
c !== void 0 && c.onToggle(), s("click");
|
|
90
|
+
}, r = m(() => {
|
|
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: M(
|
|
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: M(n, ["prevent"])
|
|
97
97
|
}, [
|
|
98
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, s) {
|
|
|
119
119
|
})
|
|
120
120
|
]);
|
|
121
121
|
}
|
|
122
|
-
const
|
|
122
|
+
const U = {
|
|
123
123
|
user: {
|
|
124
124
|
type: Object,
|
|
125
125
|
required: !0
|
|
@@ -146,7 +146,7 @@ const W = {
|
|
|
146
146
|
onLogout: {
|
|
147
147
|
type: Function
|
|
148
148
|
}
|
|
149
|
-
},
|
|
149
|
+
}, G = {
|
|
150
150
|
workspace: {
|
|
151
151
|
type: Object,
|
|
152
152
|
required: !0
|
|
@@ -173,83 +173,83 @@ const W = {
|
|
|
173
173
|
onApp: {
|
|
174
174
|
type: Function
|
|
175
175
|
}
|
|
176
|
-
},
|
|
176
|
+
}, J = ["onClick"], K = { class: "flex flex-col items-center pt-6 pb-3 h-full" }, Q = { class: "flex flex-col px-10 py-1 mt-2 text-center" }, X = { class: "self-center text-base font-medium tracking-wide text-black" }, Y = { class: "mt-1 text-xs leading-5 text-blue-500" }, Z = { class: "text-left w-full mt-5" }, ee = /* @__PURE__ */ e("div", {
|
|
177
177
|
class: "space-y-2 text-center py-6",
|
|
178
178
|
style: { width: "240px" }
|
|
179
|
-
}, null, -1),
|
|
179
|
+
}, null, -1), te = /* @__PURE__ */ e("div", { class: "pb-2 flex-shrink-0 mt-auto pt-6 text-xs leading-3 text-gray-400" }, "v.1.0.0 (beta)", -1), ye = /* @__PURE__ */ k({
|
|
180
180
|
__name: "OneUserMenu",
|
|
181
|
-
props:
|
|
181
|
+
props: U,
|
|
182
182
|
setup(p) {
|
|
183
|
-
const s = p,
|
|
184
|
-
var
|
|
185
|
-
return (
|
|
186
|
-
let
|
|
187
|
-
|
|
188
|
-
const
|
|
183
|
+
const s = p, u = m(() => {
|
|
184
|
+
var r;
|
|
185
|
+
return (r = s.menu) == null ? void 0 : r.map((t) => {
|
|
186
|
+
let i = { label: t.label };
|
|
187
|
+
t.icon != null && (i = { ...i, icon: t.icon });
|
|
188
|
+
const o = typeof t.click == "function" ? t.click : () => {
|
|
189
189
|
};
|
|
190
190
|
return {
|
|
191
|
-
key:
|
|
192
|
-
args:
|
|
193
|
-
click:
|
|
191
|
+
key: t.label,
|
|
192
|
+
args: i,
|
|
193
|
+
click: o
|
|
194
194
|
};
|
|
195
195
|
});
|
|
196
196
|
}), c = () => {
|
|
197
197
|
typeof s.onAccount == "function" && s.onAccount();
|
|
198
|
-
},
|
|
198
|
+
}, n = () => {
|
|
199
199
|
typeof s.onLogout == "function" && s.onLogout();
|
|
200
200
|
};
|
|
201
|
-
return (
|
|
202
|
-
button:
|
|
203
|
-
var
|
|
201
|
+
return (r, t) => (l(), w(B, { stick: "right" }, {
|
|
202
|
+
button: x(({ onToggle: i, isExpanded: o }) => {
|
|
203
|
+
var a, g;
|
|
204
204
|
return [
|
|
205
205
|
e("button", {
|
|
206
|
-
onClick:
|
|
207
|
-
class: b(["p-1 rounded-full hover:bg-secondary-10", [
|
|
206
|
+
onClick: i,
|
|
207
|
+
class: b(["p-1 rounded-full hover:bg-secondary-10", [o ? "bg-secondary-25" : ""]])
|
|
208
208
|
}, [
|
|
209
|
-
|
|
210
|
-
text: ((
|
|
211
|
-
size:
|
|
212
|
-
src: (
|
|
209
|
+
f(v, {
|
|
210
|
+
text: ((a = r.user) == null ? void 0 : a.name) || "",
|
|
211
|
+
size: r.iconSize,
|
|
212
|
+
src: (g = r.user) == null ? void 0 : g.photo_url,
|
|
213
213
|
rounded: !0
|
|
214
214
|
}, null, 8, ["text", "size", "src"])
|
|
215
|
-
], 10,
|
|
215
|
+
], 10, J)
|
|
216
216
|
];
|
|
217
217
|
}),
|
|
218
|
-
menu:
|
|
219
|
-
var
|
|
218
|
+
menu: x(() => {
|
|
219
|
+
var i, o, a, g;
|
|
220
220
|
return [
|
|
221
|
-
e("div",
|
|
222
|
-
|
|
223
|
-
text: ((
|
|
221
|
+
e("div", K, [
|
|
222
|
+
f(v, {
|
|
223
|
+
text: ((i = r.user) == null ? void 0 : i.name) || "",
|
|
224
224
|
size: 80,
|
|
225
|
-
src: (
|
|
225
|
+
src: (o = r.user) == null ? void 0 : o.photo_url,
|
|
226
226
|
rounded: !0,
|
|
227
227
|
class: "mx-auto"
|
|
228
228
|
}, null, 8, ["text", "src"]),
|
|
229
|
-
e("div",
|
|
230
|
-
e("div",
|
|
231
|
-
e("div",
|
|
229
|
+
e("div", Q, [
|
|
230
|
+
e("div", X, h((a = r.user) == null ? void 0 : a.name), 1),
|
|
231
|
+
e("div", Y, h((g = r.user) == null ? void 0 : g.email), 1)
|
|
232
232
|
]),
|
|
233
233
|
typeof s.onAccount == "function" ? (l(), d("a", {
|
|
234
234
|
key: 0,
|
|
235
235
|
onClick: c,
|
|
236
236
|
class: "cursor-pointer justify-center px-8 py-3 mt-3 text-xs font-semibold tracking-wide leading-5 text-gray-600 border border-solid bg-neutral-100 border-slate-200 rounded-[50px] hover:bg-neutral-200"
|
|
237
237
|
}, " Обліковий запис 1B ")) : y("", !0),
|
|
238
|
-
e("div",
|
|
239
|
-
(l(!0), d(L, null, O(
|
|
238
|
+
e("div", Z, [
|
|
239
|
+
(l(!0), d(L, null, O(u.value, (_) => (l(), w(z, V({
|
|
240
240
|
key: _.key
|
|
241
241
|
}, _.args, {
|
|
242
242
|
onClick: _.click
|
|
243
243
|
}), null, 16, ["onClick"]))), 128)),
|
|
244
|
-
|
|
245
|
-
icon: j(
|
|
246
|
-
label:
|
|
244
|
+
f(z, {
|
|
245
|
+
icon: j(W),
|
|
246
|
+
label: r.logoutLabel,
|
|
247
247
|
class: "rounded",
|
|
248
|
-
onClick:
|
|
248
|
+
onClick: n
|
|
249
249
|
}, null, 8, ["icon", "label"])
|
|
250
250
|
]),
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+
ee,
|
|
252
|
+
te
|
|
253
253
|
])
|
|
254
254
|
];
|
|
255
255
|
}),
|
|
@@ -257,7 +257,7 @@ const W = {
|
|
|
257
257
|
}));
|
|
258
258
|
}
|
|
259
259
|
});
|
|
260
|
-
function
|
|
260
|
+
function oe(p, s) {
|
|
261
261
|
return l(), d("svg", {
|
|
262
262
|
xmlns: "http://www.w3.org/2000/svg",
|
|
263
263
|
fill: "none",
|
|
@@ -349,70 +349,70 @@ function te(p, s) {
|
|
|
349
349
|
})
|
|
350
350
|
]);
|
|
351
351
|
}
|
|
352
|
-
const
|
|
352
|
+
const ne = ["onClick"], re = {
|
|
353
353
|
class: "space-x-2 flex items-center px-3 py-2",
|
|
354
354
|
style: { width: "300px" }
|
|
355
|
-
},
|
|
355
|
+
}, se = { class: "flex-shrink-0" }, ie = { class: "w-full text-left" }, le = { class: "flex-shrink-0" }, ce = { class: "px-3 py-2 border-t border-secondary-stroke" }, ae = { class: "text-secondary-content text-left pb-1 text-sm" }, ue = { class: "grid grid-cols-3 gap-1" }, de = ["onClick"], pe = { class: "block bg-white mx-auto flex-shrink-0 border border-secondary-stroke p-1 rounded-lg" }, he = { class: "w-full overflow-hidden text-ellipsis whitespace-nowrap text-center text-sm mt-1" }, xe = /* @__PURE__ */ k({
|
|
356
356
|
__name: "OneBrowserMenu",
|
|
357
|
-
props:
|
|
357
|
+
props: G,
|
|
358
358
|
setup(p) {
|
|
359
|
-
const s = p,
|
|
359
|
+
const s = p, u = () => {
|
|
360
360
|
typeof s.onChange == "function" && s.onChange();
|
|
361
|
-
}, c = (
|
|
362
|
-
typeof s.onApp == "function" && s.onApp(
|
|
361
|
+
}, c = (n) => {
|
|
362
|
+
typeof s.onApp == "function" && s.onApp(n);
|
|
363
363
|
};
|
|
364
|
-
return (
|
|
365
|
-
button:
|
|
364
|
+
return (n, r) => (l(), w(B, { stick: "right" }, {
|
|
365
|
+
button: x(({ onToggle: t, isExpanded: i }) => [
|
|
366
366
|
e("button", {
|
|
367
|
-
onClick:
|
|
368
|
-
class: b(["p-1 rounded-md hover:bg-secondary-10", [
|
|
367
|
+
onClick: t,
|
|
368
|
+
class: b(["p-1 rounded-md hover:bg-secondary-10", [i ? "bg-secondary-25" : ""]])
|
|
369
369
|
}, [
|
|
370
|
-
|
|
370
|
+
f(j(oe), {
|
|
371
371
|
class: "text-secondary-base",
|
|
372
|
-
style: E(`width: ${
|
|
372
|
+
style: E(`width: ${n.iconSize}px; height: ${n.iconSize}px`)
|
|
373
373
|
}, null, 8, ["style"])
|
|
374
|
-
], 10,
|
|
374
|
+
], 10, ne)
|
|
375
375
|
]),
|
|
376
|
-
menu:
|
|
377
|
-
var
|
|
376
|
+
menu: x(() => {
|
|
377
|
+
var t, i, o;
|
|
378
378
|
return [
|
|
379
|
-
e("div",
|
|
380
|
-
e("div",
|
|
381
|
-
|
|
382
|
-
text: ((
|
|
383
|
-
src: (
|
|
379
|
+
e("div", re, [
|
|
380
|
+
e("div", se, [
|
|
381
|
+
f(v, {
|
|
382
|
+
text: ((t = n.workspace) == null ? void 0 : t.name) || "",
|
|
383
|
+
src: (i = n.workspace) == null ? void 0 : i.photo_url,
|
|
384
384
|
size: 44,
|
|
385
385
|
rounded: !1,
|
|
386
386
|
class: "mx-auto"
|
|
387
387
|
}, null, 8, ["text", "src"])
|
|
388
388
|
]),
|
|
389
|
-
e("div",
|
|
390
|
-
e("div",
|
|
389
|
+
e("div", ie, h((o = n.workspace) == null ? void 0 : o.name), 1),
|
|
390
|
+
e("div", le, [
|
|
391
391
|
e("button", {
|
|
392
392
|
class: "text-sm border border-secondary-stroke rounded px-2 py-0.5 text-secondary-content hover:text-primary-content",
|
|
393
|
-
onClick:
|
|
394
|
-
}, h(
|
|
393
|
+
onClick: u
|
|
394
|
+
}, h(n.changeLabel), 1)
|
|
395
395
|
])
|
|
396
396
|
]),
|
|
397
|
-
e("div",
|
|
398
|
-
e("div",
|
|
399
|
-
e("div",
|
|
400
|
-
(l(!0), d(L, null, O(
|
|
401
|
-
key:
|
|
402
|
-
onClick: (
|
|
397
|
+
e("div", ce, [
|
|
398
|
+
e("div", ae, h(n.appsTitle), 1),
|
|
399
|
+
e("div", ue, [
|
|
400
|
+
(l(!0), d(L, null, O(n.apps, (a) => (l(), d("button", {
|
|
401
|
+
key: a.id,
|
|
402
|
+
onClick: (g) => c(a),
|
|
403
403
|
class: "p-1.5 flex flex-col items-center justify-center rounded hover:bg-secondary-10",
|
|
404
404
|
style: { width: "88px", height: "88px" }
|
|
405
405
|
}, [
|
|
406
|
-
e("span",
|
|
407
|
-
|
|
408
|
-
text:
|
|
409
|
-
src:
|
|
406
|
+
e("span", pe, [
|
|
407
|
+
f(v, {
|
|
408
|
+
text: a.name,
|
|
409
|
+
src: a.photo_url,
|
|
410
410
|
size: 44,
|
|
411
411
|
rounded: !1
|
|
412
412
|
}, null, 8, ["text", "src"])
|
|
413
413
|
]),
|
|
414
|
-
e("span",
|
|
415
|
-
], 8,
|
|
414
|
+
e("span", he, h(a.name), 1)
|
|
415
|
+
], 8, de))), 128))
|
|
416
416
|
])
|
|
417
417
|
])
|
|
418
418
|
];
|
|
@@ -424,6 +424,6 @@ const oe = ["onClick"], ne = {
|
|
|
424
424
|
export {
|
|
425
425
|
B as _,
|
|
426
426
|
z as a,
|
|
427
|
-
|
|
428
|
-
|
|
427
|
+
ye as b,
|
|
428
|
+
xe as c
|
|
429
429
|
};
|
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-9e476cc1.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-d28539b7.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;
|