@oneb/ui-vue 0.0.73 → 0.0.74
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-27c0a632.cjs +1 -0
- package/dist/{OneBrowserMenu-225e675e.js → OneBrowserMenu-e20f7ed0.js} +146 -147
- 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 +3 -3
- package/dist/form/index.cjs +1 -1
- package/dist/form/index.js +125 -125
- package/dist/{index-0e0f4e2a.js → index-a17260e5.js} +51 -51
- package/dist/index-bdc4dd8e.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/layout/index.cjs +1 -1
- package/dist/layout/index.js +247 -247
- package/package.json +1 -1
- package/dist/OneBrowserMenu-7ee9545f.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/OneBrowserMenuGrid.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-fc8a4372.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
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;
|
package/dist/form/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { inject as
|
|
2
|
-
import { r as
|
|
3
|
-
const
|
|
1
|
+
import { inject as _, computed as t, defineComponent as g, provide as E, openBlock as l, createElementBlock as n, withModifiers as L, renderSlot as C, unref as d, createTextVNode as M, toDisplayString as v, Fragment as $, renderList as V, createCommentVNode as h, createElementVNode as m, ref as q, onMounted as P, normalizeClass as b, createBlock as k, resolveDynamicComponent as z, createVNode as O } from "vue";
|
|
2
|
+
import { r as D } from "../XMarkIcon-51ef0691.js";
|
|
3
|
+
const T = {
|
|
4
4
|
id: {
|
|
5
5
|
type: String,
|
|
6
6
|
required: !1
|
|
@@ -9,7 +9,7 @@ const G = {
|
|
|
9
9
|
type: Object,
|
|
10
10
|
required: !1
|
|
11
11
|
}
|
|
12
|
-
},
|
|
12
|
+
}, G = {
|
|
13
13
|
id: {
|
|
14
14
|
type: String,
|
|
15
15
|
required: !1
|
|
@@ -31,7 +31,7 @@ const G = {
|
|
|
31
31
|
type: Array,
|
|
32
32
|
required: !1
|
|
33
33
|
}
|
|
34
|
-
},
|
|
34
|
+
}, H = {
|
|
35
35
|
name: {
|
|
36
36
|
type: String,
|
|
37
37
|
required: !1
|
|
@@ -40,12 +40,12 @@ const G = {
|
|
|
40
40
|
type: Array,
|
|
41
41
|
required: !1
|
|
42
42
|
}
|
|
43
|
-
},
|
|
43
|
+
}, J = {
|
|
44
44
|
label: {
|
|
45
45
|
type: String,
|
|
46
46
|
required: !1
|
|
47
47
|
}
|
|
48
|
-
},
|
|
48
|
+
}, K = {
|
|
49
49
|
id: {
|
|
50
50
|
type: String,
|
|
51
51
|
required: !1
|
|
@@ -107,7 +107,7 @@ const G = {
|
|
|
107
107
|
required: !1,
|
|
108
108
|
default: []
|
|
109
109
|
}
|
|
110
|
-
},
|
|
110
|
+
}, I = () => _(
|
|
111
111
|
"BaseForm",
|
|
112
112
|
() => ({
|
|
113
113
|
formId: t(() => {
|
|
@@ -116,7 +116,7 @@ const G = {
|
|
|
116
116
|
})
|
|
117
117
|
}),
|
|
118
118
|
!0
|
|
119
|
-
), S = () =>
|
|
119
|
+
), S = () => _(
|
|
120
120
|
"BaseFormField",
|
|
121
121
|
() => ({
|
|
122
122
|
inputId: t(() => {
|
|
@@ -126,55 +126,55 @@ const G = {
|
|
|
126
126
|
hasError: t(() => !1)
|
|
127
127
|
}),
|
|
128
128
|
!0
|
|
129
|
-
),
|
|
129
|
+
), Q = ["onSubmit", "id"], he = /* @__PURE__ */ g({
|
|
130
130
|
__name: "OneForm",
|
|
131
|
-
props:
|
|
131
|
+
props: T,
|
|
132
132
|
emits: ["submit"],
|
|
133
133
|
setup(u, { emit: a }) {
|
|
134
|
-
const r = u
|
|
135
|
-
|
|
134
|
+
const r = u;
|
|
135
|
+
E("BaseForm", {
|
|
136
136
|
formId: t(() => r.id),
|
|
137
137
|
validation: t(() => r.validation)
|
|
138
138
|
});
|
|
139
139
|
const i = () => {
|
|
140
|
-
|
|
140
|
+
a("submit");
|
|
141
141
|
};
|
|
142
|
-
return (
|
|
143
|
-
onSubmit:
|
|
144
|
-
id:
|
|
142
|
+
return (s, o) => (l(), n("form", {
|
|
143
|
+
onSubmit: L(i, ["prevent"]),
|
|
144
|
+
id: s.id,
|
|
145
145
|
class: "space-y-3"
|
|
146
146
|
}, [
|
|
147
|
-
|
|
148
|
-
], 40,
|
|
147
|
+
C(s.$slots, "default")
|
|
148
|
+
], 40, Q));
|
|
149
149
|
}
|
|
150
|
-
}),
|
|
150
|
+
}), R = ["for"], U = /* @__PURE__ */ g({
|
|
151
151
|
__name: "OneFormLabel",
|
|
152
|
-
props:
|
|
152
|
+
props: J,
|
|
153
153
|
setup(u) {
|
|
154
154
|
const { inputId: a } = S();
|
|
155
|
-
return (r,
|
|
156
|
-
for:
|
|
155
|
+
return (r, i) => (l(), n("label", {
|
|
156
|
+
for: d(a),
|
|
157
157
|
class: "block text-sm font-medium text-primary-content select-none"
|
|
158
158
|
}, [
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
C(r.$slots, "default", {}, () => [
|
|
160
|
+
M(v(r.label), 1)
|
|
161
161
|
])
|
|
162
|
-
], 8,
|
|
162
|
+
], 8, R));
|
|
163
163
|
}
|
|
164
|
-
}),
|
|
164
|
+
}), W = {
|
|
165
165
|
key: 0,
|
|
166
166
|
class: "text-danger-content text-xs space-y-1"
|
|
167
|
-
},
|
|
167
|
+
}, X = /* @__PURE__ */ g({
|
|
168
168
|
__name: "OneFormFeedback",
|
|
169
|
-
props:
|
|
169
|
+
props: H,
|
|
170
170
|
setup(u) {
|
|
171
|
-
const a = u, { validation: r } =
|
|
172
|
-
return (o,
|
|
173
|
-
(l(!0), n(
|
|
171
|
+
const a = u, { validation: r } = I(), { inputName: i } = S(), s = t(() => i.value == null && a.name == null ? a.errors ?? [] : r.value == null ? a.errors ?? [] : (r.value ?? {})[a.name || i.value] ?? a.errors ?? []);
|
|
172
|
+
return (o, c) => s.value.length > 0 ? (l(), n("div", W, [
|
|
173
|
+
(l(!0), n($, null, V(s.value, (y) => (l(), n("div", { key: y }, v(y), 1))), 128))
|
|
174
174
|
])) : h("", !0);
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
|
-
function
|
|
177
|
+
function Y(u, a) {
|
|
178
178
|
return l(), n("svg", {
|
|
179
179
|
xmlns: "http://www.w3.org/2000/svg",
|
|
180
180
|
fill: "none",
|
|
@@ -183,19 +183,19 @@ function Z(u, a) {
|
|
|
183
183
|
stroke: "currentColor",
|
|
184
184
|
"aria-hidden": "true"
|
|
185
185
|
}, [
|
|
186
|
-
|
|
186
|
+
m("path", {
|
|
187
187
|
"stroke-linecap": "round",
|
|
188
188
|
"stroke-linejoin": "round",
|
|
189
189
|
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"
|
|
190
190
|
}),
|
|
191
|
-
|
|
191
|
+
m("path", {
|
|
192
192
|
"stroke-linecap": "round",
|
|
193
193
|
"stroke-linejoin": "round",
|
|
194
194
|
d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z"
|
|
195
195
|
})
|
|
196
196
|
]);
|
|
197
197
|
}
|
|
198
|
-
function
|
|
198
|
+
function Z(u, a) {
|
|
199
199
|
return l(), n("svg", {
|
|
200
200
|
xmlns: "http://www.w3.org/2000/svg",
|
|
201
201
|
fill: "none",
|
|
@@ -204,42 +204,42 @@ function x(u, a) {
|
|
|
204
204
|
stroke: "currentColor",
|
|
205
205
|
"aria-hidden": "true"
|
|
206
206
|
}, [
|
|
207
|
-
|
|
207
|
+
m("path", {
|
|
208
208
|
"stroke-linecap": "round",
|
|
209
209
|
"stroke-linejoin": "round",
|
|
210
210
|
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"
|
|
211
211
|
})
|
|
212
212
|
]);
|
|
213
213
|
}
|
|
214
|
-
const
|
|
214
|
+
const x = ["id", "disabled"], ee = ["selected"], re = ["selected", "value"], le = ["name", "id", "value", "placeholder", "disabled", "readonly"], ae = {
|
|
215
215
|
key: 2,
|
|
216
216
|
class: "flex w-full space-x-3 items-center"
|
|
217
|
-
},
|
|
217
|
+
}, ne = ["type", "name", "id", "disabled", "readonly", "checked"], oe = ["for"], te = {
|
|
218
218
|
key: 3,
|
|
219
219
|
class: "w-full space-y-1"
|
|
220
|
-
},
|
|
220
|
+
}, se = ["name", "id", "value", "disabled", "readonly", "checked"], de = ["for"], ie = {
|
|
221
221
|
key: 4,
|
|
222
222
|
class: "relative"
|
|
223
|
-
},
|
|
223
|
+
}, ue = { class: "absolute p-2 px-3 rounded-md h-full flex items-center select-none" }, pe = ["type", "name", "id", "value", "placeholder", "disabled", "readonly"], ce = /* @__PURE__ */ g({
|
|
224
224
|
__name: "OneFormInput",
|
|
225
|
-
props:
|
|
225
|
+
props: K,
|
|
226
226
|
emits: ["update:modelValue"],
|
|
227
227
|
setup(u, { emit: a }) {
|
|
228
|
-
const r = u,
|
|
229
|
-
|
|
230
|
-
r.autofocus &&
|
|
228
|
+
const r = u, { inputId: i, inputName: s, hasError: o } = S(), c = q(null), y = q(!1);
|
|
229
|
+
P(() => {
|
|
230
|
+
r.autofocus && c.value && c.value.focus();
|
|
231
231
|
});
|
|
232
|
-
const
|
|
232
|
+
const j = t(() => r.modelValue != null && r.modelValue !== ""), f = t(() => {
|
|
233
233
|
if (r.id)
|
|
234
234
|
return r.id;
|
|
235
235
|
const e = (i == null ? void 0 : i.value) || "";
|
|
236
236
|
return r.name ? `${e}-${r.name}` : e || "";
|
|
237
|
-
}),
|
|
238
|
-
|
|
239
|
-
},
|
|
237
|
+
}), N = () => {
|
|
238
|
+
a("update:modelValue", "");
|
|
239
|
+
}, A = t(() => {
|
|
240
240
|
const e = {
|
|
241
241
|
"shadow-sm": r.type !== "range",
|
|
242
|
-
"border-danger-base":
|
|
242
|
+
"border-danger-base": o.value || r.invalid,
|
|
243
243
|
"pl-10": r.icon != null,
|
|
244
244
|
"pr-10": r.type === "password",
|
|
245
245
|
"rounded-full": r.rounded,
|
|
@@ -248,19 +248,19 @@ const ee = ["id", "disabled"], re = ["selected"], le = ["selected", "value"], ae
|
|
|
248
248
|
"py-2.5": r.large,
|
|
249
249
|
"py-2": !r.large
|
|
250
250
|
};
|
|
251
|
-
return r.inputClass != null && (typeof r.inputClass == "string" ? e[r.inputClass] = !0 : r.inputClass instanceof Array && r.inputClass.forEach((
|
|
252
|
-
e[
|
|
251
|
+
return r.inputClass != null && (typeof r.inputClass == "string" ? e[r.inputClass] = !0 : r.inputClass instanceof Array && r.inputClass.forEach((F) => {
|
|
252
|
+
e[F] = !0;
|
|
253
253
|
})), e;
|
|
254
|
-
}),
|
|
255
|
-
r.type === "checkbox" ?
|
|
254
|
+
}), w = (e) => {
|
|
255
|
+
r.type === "checkbox" ? a("update:modelValue", e.target.checked) : a("update:modelValue", e.target.value);
|
|
256
256
|
};
|
|
257
|
-
return (e,
|
|
257
|
+
return (e, F) => e.type === "select" ? (l(), n("select", {
|
|
258
258
|
key: 0,
|
|
259
259
|
id: f.value,
|
|
260
260
|
ref_key: "inputElement",
|
|
261
|
-
ref:
|
|
261
|
+
ref: c,
|
|
262
262
|
class: b(["border border-primary-stroke px-3 w-full", {
|
|
263
|
-
"border-danger-base":
|
|
263
|
+
"border-danger-base": d(o) || e.invalid,
|
|
264
264
|
"text-secondary-content": e.modelValue === "" || e.modelValue == null,
|
|
265
265
|
"rounded-full": e.rounded,
|
|
266
266
|
"rounded-md": !e.rounded,
|
|
@@ -275,21 +275,21 @@ const ee = ["id", "disabled"], re = ["selected"], le = ["selected", "value"], ae
|
|
|
275
275
|
selected: e.modelValue === "" || e.modelValue == null,
|
|
276
276
|
disabled: "",
|
|
277
277
|
hidden: ""
|
|
278
|
-
}, v(e.placeholder), 9,
|
|
279
|
-
(l(!0), n(
|
|
280
|
-
selected:
|
|
281
|
-
key:
|
|
282
|
-
value:
|
|
283
|
-
}, v(
|
|
284
|
-
], 10,
|
|
278
|
+
}, v(e.placeholder), 9, ee)) : h("", !0),
|
|
279
|
+
(l(!0), n($, null, V(e.options, (p) => (l(), n("option", {
|
|
280
|
+
selected: p.key === e.modelValue,
|
|
281
|
+
key: p.key,
|
|
282
|
+
value: p.key
|
|
283
|
+
}, v(p.value), 9, re))), 128))
|
|
284
|
+
], 10, x)) : e.type === "textarea" ? (l(), n("textarea", {
|
|
285
285
|
key: 1,
|
|
286
|
-
name: e.name || s
|
|
286
|
+
name: e.name || d(s),
|
|
287
287
|
id: f.value,
|
|
288
288
|
value: e.modelValue,
|
|
289
|
-
onInput:
|
|
289
|
+
onInput: w,
|
|
290
290
|
rows: "3",
|
|
291
291
|
class: b(["border border-primary-stroke px-3 w-full placeholder-gray-400", {
|
|
292
|
-
"border-danger-base":
|
|
292
|
+
"border-danger-base": d(o),
|
|
293
293
|
"rounded-3xl": e.rounded,
|
|
294
294
|
"rounded-md": !e.rounded,
|
|
295
295
|
"text-lg": e.large,
|
|
@@ -300,105 +300,105 @@ const ee = ["id", "disabled"], re = ["selected"], le = ["selected", "value"], ae
|
|
|
300
300
|
disabled: e.disabled,
|
|
301
301
|
readonly: e.readonly,
|
|
302
302
|
ref_key: "inputElement",
|
|
303
|
-
ref:
|
|
304
|
-
}, null, 42,
|
|
305
|
-
|
|
303
|
+
ref: c
|
|
304
|
+
}, null, 42, le)) : e.type === "checkbox" ? (l(), n("div", ae, [
|
|
305
|
+
m("input", {
|
|
306
306
|
type: e.type,
|
|
307
|
-
name: e.name || s
|
|
307
|
+
name: e.name || d(s),
|
|
308
308
|
id: f.value,
|
|
309
309
|
value: !0,
|
|
310
|
-
onInput:
|
|
310
|
+
onInput: w,
|
|
311
311
|
disabled: e.disabled,
|
|
312
312
|
readonly: e.readonly,
|
|
313
313
|
class: b(["rounded-md border border-primary-stroke px-2 py-2 shadow-sm", {
|
|
314
|
-
"border-danger-base":
|
|
314
|
+
"border-danger-base": d(o) || e.invalid
|
|
315
315
|
}]),
|
|
316
316
|
checked: e.modelValue === !0,
|
|
317
317
|
ref_key: "inputElement",
|
|
318
|
-
ref:
|
|
319
|
-
}, null, 42,
|
|
320
|
-
|
|
318
|
+
ref: c
|
|
319
|
+
}, null, 42, ne),
|
|
320
|
+
m("label", {
|
|
321
321
|
for: f.value,
|
|
322
322
|
class: "text-primary-content select-none"
|
|
323
|
-
}, v(e.placeholder), 9,
|
|
324
|
-
])) : e.type === "radio" ? (l(), n("div",
|
|
325
|
-
(l(!0), n(
|
|
326
|
-
key:
|
|
323
|
+
}, v(e.placeholder), 9, oe)
|
|
324
|
+
])) : e.type === "radio" ? (l(), n("div", te, [
|
|
325
|
+
(l(!0), n($, null, V(e.options, (p, B) => (l(), n("div", {
|
|
326
|
+
key: p.key,
|
|
327
327
|
class: "flex w-full space-x-3 items-center"
|
|
328
328
|
}, [
|
|
329
|
-
|
|
329
|
+
m("input", {
|
|
330
330
|
type: "radio",
|
|
331
|
-
name: e.name || s
|
|
332
|
-
id: `${f.value}-${
|
|
333
|
-
value:
|
|
334
|
-
onInput:
|
|
331
|
+
name: e.name || d(s),
|
|
332
|
+
id: `${f.value}-${B}`,
|
|
333
|
+
value: p.key,
|
|
334
|
+
onInput: w,
|
|
335
335
|
disabled: e.disabled,
|
|
336
336
|
readonly: e.readonly,
|
|
337
337
|
class: b(["rounded-md border border-primary-stroke px-3 py-2 shadow-sm", {
|
|
338
|
-
"border-danger-base":
|
|
338
|
+
"border-danger-base": d(o) || e.invalid
|
|
339
339
|
}]),
|
|
340
|
-
checked:
|
|
340
|
+
checked: p.key === e.modelValue,
|
|
341
341
|
ref_for: !0,
|
|
342
342
|
ref_key: "inputElement",
|
|
343
|
-
ref:
|
|
344
|
-
}, null, 42,
|
|
345
|
-
|
|
346
|
-
for: `${f.value}-${
|
|
343
|
+
ref: c
|
|
344
|
+
}, null, 42, se),
|
|
345
|
+
m("label", {
|
|
346
|
+
for: `${f.value}-${B}`,
|
|
347
347
|
class: "text-primary-content select-none"
|
|
348
|
-
}, v(
|
|
348
|
+
}, v(p.value), 9, de)
|
|
349
349
|
]))), 128))
|
|
350
|
-
])) : (l(), n("div",
|
|
351
|
-
|
|
352
|
-
e.icon ? (l(), k(
|
|
350
|
+
])) : (l(), n("div", ie, [
|
|
351
|
+
m("div", ue, [
|
|
352
|
+
e.icon ? (l(), k(z(e.icon), {
|
|
353
353
|
key: 0,
|
|
354
354
|
class: "w-5 h-5 text-primary-content"
|
|
355
355
|
})) : h("", !0)
|
|
356
356
|
]),
|
|
357
|
-
|
|
358
|
-
type:
|
|
359
|
-
name: e.name || s
|
|
357
|
+
m("input", {
|
|
358
|
+
type: y.value ? "text" : e.type,
|
|
359
|
+
name: e.name || d(s),
|
|
360
360
|
id: f.value,
|
|
361
361
|
value: e.modelValue,
|
|
362
|
-
onInput:
|
|
362
|
+
onInput: w,
|
|
363
363
|
placeholder: e.placeholder,
|
|
364
364
|
disabled: e.disabled,
|
|
365
365
|
readonly: e.readonly,
|
|
366
|
-
class: b(["border border-primary-stroke w-full px-3 placeholder-gray-400",
|
|
366
|
+
class: b(["border border-primary-stroke w-full px-3 placeholder-gray-400", A.value]),
|
|
367
367
|
ref_key: "inputElement",
|
|
368
|
-
ref:
|
|
369
|
-
}, null, 42,
|
|
370
|
-
e.clearable &&
|
|
368
|
+
ref: c
|
|
369
|
+
}, null, 42, pe),
|
|
370
|
+
e.clearable && j.value ? (l(), n("div", {
|
|
371
371
|
key: 0,
|
|
372
|
-
onClick:
|
|
372
|
+
onClick: N,
|
|
373
373
|
class: "absolute p-2 px-3 rounded-md h-full flex items-center right-0 top-0 hover:cursor-pointer select-none"
|
|
374
374
|
}, [
|
|
375
|
-
|
|
375
|
+
O(d(D), { class: "w-5 h-5 text-secondary-content hover:text-primary-base" })
|
|
376
376
|
])) : e.type === "password" ? (l(), n("div", {
|
|
377
377
|
key: 1,
|
|
378
|
-
onClick:
|
|
378
|
+
onClick: F[0] || (F[0] = (p) => y.value = !y.value),
|
|
379
379
|
class: "absolute p-2 px-3 rounded-md h-full flex items-center right-0 top-0 hover:cursor-pointer select-none"
|
|
380
380
|
}, [
|
|
381
|
-
|
|
381
|
+
y.value ? (l(), k(d(Z), {
|
|
382
382
|
key: 0,
|
|
383
383
|
class: "w-5 h-5 text-primary-content hover:text-primary-base"
|
|
384
|
-
})) : (l(), k(
|
|
384
|
+
})) : (l(), k(d(Y), {
|
|
385
385
|
key: 1,
|
|
386
386
|
class: "w-5 h-5 text-secondary-content hover:text-primary-base"
|
|
387
387
|
}))
|
|
388
388
|
])) : h("", !0)
|
|
389
389
|
]));
|
|
390
390
|
}
|
|
391
|
-
}),
|
|
391
|
+
}), me = { class: "space-y-1" }, ye = {
|
|
392
392
|
key: 2,
|
|
393
393
|
class: "text-xs text-secondary-content select-none"
|
|
394
|
-
},
|
|
394
|
+
}, be = /* @__PURE__ */ g({
|
|
395
395
|
__name: "OneFormField",
|
|
396
|
-
props:
|
|
396
|
+
props: G,
|
|
397
397
|
setup(u) {
|
|
398
|
-
const a = u, { formId: r, validation:
|
|
399
|
-
() => a.errors != null && a.errors.length > 0 ? !0 : a.name == null ? !1 : (
|
|
398
|
+
const a = u, { formId: r, validation: i } = I(), s = t(
|
|
399
|
+
() => a.errors != null && a.errors.length > 0 ? !0 : a.name == null ? !1 : (i.value ?? {})[a.name] != null
|
|
400
400
|
);
|
|
401
|
-
return
|
|
401
|
+
return E("BaseFormField", {
|
|
402
402
|
inputId: t(() => {
|
|
403
403
|
const o = r.value || "form";
|
|
404
404
|
if (a.id != null)
|
|
@@ -407,26 +407,26 @@ const ee = ["id", "disabled"], re = ["selected"], le = ["selected", "value"], ae
|
|
|
407
407
|
return `${o}-field-${a.name}`;
|
|
408
408
|
}),
|
|
409
409
|
inputName: t(() => a.name),
|
|
410
|
-
hasError:
|
|
411
|
-
}), (o,
|
|
412
|
-
o.label ? (l(), k(
|
|
410
|
+
hasError: s
|
|
411
|
+
}), (o, c) => (l(), n("div", me, [
|
|
412
|
+
o.label ? (l(), k(U, {
|
|
413
413
|
key: 0,
|
|
414
414
|
label: o.label
|
|
415
415
|
}, null, 8, ["label"])) : h("", !0),
|
|
416
|
-
|
|
417
|
-
|
|
416
|
+
C(o.$slots, "default", {}, () => [
|
|
417
|
+
O(ce)
|
|
418
418
|
]),
|
|
419
|
-
|
|
419
|
+
s.value ? (l(), k(X, {
|
|
420
420
|
key: 1,
|
|
421
421
|
errors: o.errors
|
|
422
|
-
}, null, 8, ["errors"])) : o.hint.length > 0 ? (l(), n("p",
|
|
422
|
+
}, null, 8, ["errors"])) : o.hint.length > 0 ? (l(), n("p", ye, v(o.hint), 1)) : h("", !0)
|
|
423
423
|
]));
|
|
424
424
|
}
|
|
425
425
|
});
|
|
426
426
|
export {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
427
|
+
he as OneForm,
|
|
428
|
+
X as OneFormFeedback,
|
|
429
|
+
be as OneFormField,
|
|
430
430
|
ce as OneFormInput,
|
|
431
|
-
|
|
431
|
+
U as OneFormLabel
|
|
432
432
|
};
|