import{r as v,ak as k,v as L,h as t,F as B,K as N,e as g,c as x,H as I,m as K}from"./index-BeCeuELg.js";import{c as S}from"./clsx-09a06a12-B-dksMZM.js";import{t as f}from"./i18n-43b7aa72-DSS4ELtF.js";import{F as M}from"./FormFieldMsg-ba89943d-CF4yysBa.js";import"./tslib.es6-1173d062-BGVaTf34.js";import"./Alert-733b0883-Df5pVzCu.js";const w=class{constructor(e){v(this,e),this.slotName="input",this.catchInputSlot=s=>{k(this.host,s,this.slotName)},this._accessKey=void 0,this._alert=!0,this._currentLength=void 0,this._currentLengthDebounced=void 0,this._disabled=!1,this._hasCounter=!1,this._hideError=!1,this._hideLabel=!1,this._hint="",this._icons=void 0,this._id=void 0,this._label=void 0,this._maxLength=void 0,this._msg=void 0,this._readOnly=!1,this._renderNoLabel=!1,this._required=!1,this._shortKey=void 0,this._slotName=void 0,this._suggestions=void 0,this._smartButton=void 0,this._tooltipAlign="top",this._touched=!1}componentWillRender(){this.slotName=this._slotName?this._slotName:"input"}getIconStyles(e){return e&&typeof e=="object"&&e.style?e.style:{}}render(){var e,s,i,a,n,o,d,l,h,r,_,c;const u=typeof this._msg=="object"&&this._msg!==null&&typeof((e=this._msg)===null||e===void 0?void 0:e._description)=="string"&&((s=this._msg)===null||s===void 0?void 0:s._description.length)>0&&(this._touched===!0||((i=this._msg)===null||i===void 0?void 0:i._type)!=="error"),m=L(this._label),p=typeof this._hint=="string"&&this._hint.length>0,b=!m&&this._hideLabel;return t(I,{key:"4c498207c7887e123d18dcad77803ad6d79cb5b8",class:S("kol-input",this.getModifierClassNameByMsgType(u),{disabled:this._disabled===!0,[((a=this._msg)===null||a===void 0?void 0:a._type)||"error"]:u===!0,"read-only":this._readOnly===!0,required:this._required===!0,touched:this._touched===!0,"hidden-error":this._hideError===!0})},t("label",{key:"46d6fa988699399fe00bc3f7881990bbecbadff1",class:"input-label",id:b?void 0:`${this._id}-label`,hidden:b,htmlFor:this._id},t("span",{key:"261de34a807506dbfbcf14d5a07e83de02998b9d",class:"input-label-span"},t("slot",{key:"d3c4e582654628972631643f098ef13614fbb16a",name:"label"}))),p&&t("span",{key:"2eeb9bd42806a4212fbbdc07c683b492a4678269",class:"hint",id:`${this._id}-hint`},this._hint),t("div",{key:"450f4e9ce61c0203bc5e7bb52128075e876dc50f",class:{input:!0,"icon-left":typeof((n=this._icons)===null||n===void 0?void 0:n.left)=="object","icon-right":typeof((o=this._icons)===null||o===void 0?void 0:o.right)=="object"}},((d=this._icons)===null||d===void 0?void 0:d.left)&&t(g,{key:"db617a34b5625bf385bce736898bf8b60b0362e2",_label:"",_icons:((l=this._icons)===null||l===void 0?void 0:l.left).icon,style:this.getIconStyles((h=this._icons)===null||h===void 0?void 0:h.left)}),t("div",{key:"5aef005fe5cf7b0c7414da238e003b24d9ec8b76",ref:this.catchInputSlot,id:this.slotName,class:"input-slot"}),typeof this._smartButton=="object"&&this._smartButton!==null&&t(x,{key:"2d4f58690c482754336c8433c616115c7b7a1dc1",_customClass:this._smartButton._customClass,_disabled:this._smartButton._disabled,_icons:this._smartButton._icons,_hideLabel:!0,_id:this._smartButton._id,_label:this._smartButton._label,_on:this._smartButton._on,_tooltipAlign:this._smartButton._tooltipAlign,_variant:this._smartButton._variant}),((r=this._icons)===null||r===void 0?void 0:r.right)&&t(g,{key:"0f71452a36701957777a83e5a127e1dd4eb2ac61",_label:"",_icons:((_=this._icons)===null||_===void 0?void 0:_.right).icon,style:this.getIconStyles((c=this._icons)===null||c===void 0?void 0:c.right)})),b&&t(N,{key:"4211c78a773048d9e529a6c8b939d036cc2529b2","aria-hidden":"true",class:"input-tooltip",_badgeText:this._accessKey||this._shortKey,_align:this._tooltipAlign,_id:this._hideLabel?`${this._id}-label`:void 0,_label:this._label}),u&&t(M,{key:"1bcc512281d678916a1b9b9297e3183ab268ac63",_alert:this._alert,_hideError:this._hideError,_msg:this._msg,_id:this._id}),Array.isArray(this._suggestions)&&this._suggestions.length>0&&t("datalist",{key:"1973b589b4fb98d1bdd3623ad8a7b50c9701ba65",id:`${this._id}-list`},this._suggestions.map(y=>t("option",{value:JSON.stringify(y)}))),this._hasCounter&&t(B,null,t("span",{key:"5692122109ff8f8e4c67fb3b52dd0d6add55ea0b",class:"counter","aria-hidden":"true","data-testid":"input-counter"},this._currentLength,this._maxLength&&`/${this._maxLength}`," ",f("kol-characters")),t("span",{key:"5de55b5b1e251a0f538d9cc9688f212d2e1309c3",id:`${this._id}-counter`,"aria-live":"polite","aria-atomic":"true",class:"visually-hidden","data-testid":"input-counter-aria"},this._currentLengthDebounced,this._maxLength&&` ${f("kol-of")} ${this._maxLength}`," ",f("kol-characters"))))}getModifierClassNameByMsgType(e){var s,i;if(e&&(!((s=this._msg)===null||s===void 0)&&s._type))return{default:"msg-type-default",info:"msg-type-info",success:"msg-type-success",warning:"msg-type-warning",error:"msg-type-error"}[(i=this._msg)===null||i===void 0?void 0:i._type]}get host(){return K(this)}};export{w as kol_input};
//# sourceMappingURL=kol-input.entry-D9FNtdRG.js.map
