import a from"./FormGroup.efd02a6a.js";import s from"./Label.9d0d3ee0.js";import l from"./ErrorText.b141a597.js";import i from"./HelperText.14a7ed0b.js";import n from"./IconClipboard.8551be1b.js";import u from"./IconKey.455a255f.js";import{n as p}from"./plugin-vue2_normalizer.000ba15c.js";const d="w-full border-medium-emphasis text-body h-10 px-2 border rounded bg-surface-1 focus:outline-none focus:border-primary",c={props:{id:{type:String,required:!1},label:{type:String,required:!0},type:{type:String,default:()=>"text"},required:{type:Boolean,default:()=>!1},errors:{type:Array},helperText:{type:String},placeholder:{type:String},value:{required:!1,default:""},allowCopy:{required:!1,default:!1,type:Boolean},allowRandomString:{required:!1,default:!1,type:Boolean},loading:{type:Boolean,required:!1,default:!1},disabled:{type:Boolean,required:!1,default:!1},autofocus:{type:Boolean,required:!1,default:!1}},components:{FormGroup:a,Label:s,ErrorText:l,HelperText:i,IconClipboard:n,IconKey:u},data(){return{defaultClasses:d,copied:!1}},watch:{copied(){let r=this;this.copied&&setTimeout(()=>{r.copied=!1},1250)}},methods:{updateValue(r){this.$emit("input",r)},copy(){this.copied=!0,this.$copyText(this.value)},generateString(){this.$emit("input",this.randomString())}},computed:{copyText(){return this.copied?this.__("Copied to clipboard"):this.__("Copy")}}};var f=function(){var e=this,t=e._self._c;return t("FormGroup",{staticClass:"relative"},[t("Label",{attrs:{errors:e.errors,forId:e.id}},[e._v(e._s(e.label))]),e.allowCopy?t("button",{staticClass:"flex items-center right-0 absolute text-xs text-medium-emphasis",attrs:{type:"button"},on:{click:e.copy}},[t("IconClipboard",{staticClass:"mr-2"}),e._v(" "+e._s(e.copyText)+" ")],1):e._e(),e.allowRandomString?t("button",{staticClass:"flex items-center right-0 absolute text-xs text-medium-emphasis",attrs:{type:"button"},on:{click:e.generateString}},[t("IconKey",{staticClass:"mr-2"}),e._v(" "+e._s(e.__("Generate"))+" ")],1):e._e(),t("input",{class:[e.defaultClasses,e.disabled||e.loading?"opacity-50":"",e.loading?"cursor-wait":""],attrs:{id:e.id,type:e.type,required:e.required,disabled:e.loading||e.disabled,autofocus:e.autofocus,placeholder:e.placeholder},domProps:{value:e.value},on:{input:function(o){return e.updateValue(o.target.value)}}}),e.errors?t("ErrorText",[e._v(e._s(e.errors[0]))]):e._e(),e.helperText&&!e.errors?t("HelperText",[e._v(e._s(e.helperText))]):e._e()],1)},m=[],_=p(c,f,m,!1,null,null,null,null);const q=_.exports;export{q as default};
