(function(o,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(o=typeof globalThis<"u"?globalThis:o||self,t(o.o2oUI={},o.Vue))})(this,function(o,t){"use strict";const u=(i,r)=>{const e=i.__vccOpts||i;for(const[d,s]of r)e[d]=s;return e},m={name:"InputText",props:{id:{type:String,required:!0},type:{type:String,required:!0},placeholder:{type:String,required:!0},error:{type:Boolean,required:!1,default:!1},required:{type:Boolean,required:!1,default:!1},disabled:{type:Boolean,required:!1,default:!1},value:{type:String,required:!1,default:null},label:{type:String,required:!1,default:null}}},f=["id","disabled","type","name","required","placeholder","value"];function c(i,r,e,d,s,a){return t.openBlock(),t.createElementBlock("input",{id:e.id,disabled:e.disabled,type:e.type,class:t.normalizeClass({error:e.error}),name:`input_${e.id}`,required:e.required,placeholder:e.placeholder,value:e.value,onKeyup:r[0]||(r[0]=t.withKeys(l=>i.$emit("setter",l.target.value),["enter"])),onInput:r[1]||(r[1]=l=>{i.$emit("setter",l.target.value),i.$emit("removeError",e.id)})},null,42,f)}const y=u(m,[["render",c]]),E="",q={name:"InputTextArea",props:{id:{type:String,required:!0},placeholder:{type:String,required:!0},error:{type:Boolean,required:!1,default:!1},required:{type:Boolean,required:!1,default:!1},disabled:{type:Boolean,required:!1,default:!1},value:{type:String,required:!1,default:null},label:{type:String,required:!1,default:null},height:{type:String,required:!1,default:"42px"}}},h=["id","disabled","name","value","required","placeholder"];function g(i,r,e,d,s,a){return t.openBlock(),t.createElementBlock("textarea",{id:e.id,disabled:e.disabled,class:t.normalizeClass({error:e.error}),name:`input_${e.id}`,value:e.value,required:e.required,placeholder:e.placeholder,onKeyup:r[0]||(r[0]=t.withKeys(l=>i.$emit("setter",l.target.value),["enter"])),onInput:r[1]||(r[1]=l=>{i.$emit("setter",l.target.value),i.$emit("removeError",e.id)}),style:t.normalizeStyle(`height:${e.height}`)},null,46,h)}const p={name:"Input",components:{InputTextArea:u(q,[["render",g]]),InputText:y},emits:["setter"],props:{item:{type:Object,required:!0}},computed:{error(){return this.item.errors&&Object.values(this.item.errors).find(r=>r.validated===!1)?!0:this.item.error},errorMessage(){if(this.item.hideError)return null;if(this.item.errors){const i=Object.values(this.item.errors).find(r=>r.validated===!1);if(i)return i.message}return this.item.errorMessage}}},k=["for"],b={key:2,class:"error"};function B(i,r,e,d,s,a){const l=t.resolveComponent("input-text"),C=t.resolveComponent("input-text-area");return e.item?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["input-field",e.item.classes])},[e.item.label?(t.openBlock(),t.createElementBlock("label",{key:0,for:e.item.id},[t.createTextVNode(t.toDisplayString(e.item.label)+" ",1),e.item.required?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[t.createTextVNode("*")],64)):t.createCommentVNode("",!0),e.item.help?(t.openBlock(),t.createElementBlock("button",{key:1,class:"reset helper",onMouseover:r[0]||(r[0]=n=>i.showHelpPopover=!0),onMouseleave:r[1]||(r[1]=n=>i.showHelpPopover=!1)},null,32)):t.createCommentVNode("",!0)],8,k)):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["input-container",{"has-icon":e.item.icon}])},[["text","email"].includes(e.item.type)?(t.openBlock(),t.createBlock(l,{key:0,type:e.item.type,required:e.item.required,disabled:e.item.disabled,id:e.item.id,error:a.error,placeholder:e.item.placeholder,value:e.item.value,onSetter:r[2]||(r[2]=n=>i.$emit("setter",n)),onRemoveError:r[3]||(r[3]=n=>i.$emit("remove-error",n))},null,8,["type","required","disabled","id","error","placeholder","value"])):t.createCommentVNode("",!0),e.item.type==="textarea"?(t.openBlock(),t.createBlock(C,{key:1,required:e.item.required,disabled:e.item.disabled,id:e.item.id,error:a.error,placeholder:e.item.placeholder,value:e.item.value,height:e.item.height,onSetter:r[4]||(r[4]=n=>i.$emit("setter",n)),onRemoveError:r[5]||(r[5]=n=>i.$emit("remove-error",n))},null,8,["required","disabled","id","error","placeholder","value","height"])):t.createCommentVNode("",!0),a.errorMessage?(t.openBlock(),t.createElementBlock("span",b,t.toDisplayString(a.errorMessage),1)):t.createCommentVNode("",!0)],2)],2)):t.createCommentVNode("",!0)}const S=u(p,[["render",B]]);o.Input=S,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
//# sourceMappingURL=o2o-ui.umd.js.map
