/*!
 * KoliBri - The accessible HTML-Standard
 */
import{r as i,h as s,F as t,H as e,g as a}from"./index-2ae1c631.js";import{c as d}from"./clsx-09a06a12.js";import{t as o}from"./i18n-5fe08f1c.js";import{g as l,d as n,a as h}from"./component-names-a18a51c8.js";import{h as c,s as f}from"./reuse-32931294.js";import{K as r,a as u}from"./FormFieldMsg-e6f521f5.js";import"./i18n-7ea9f137.js";import"./prop.validators-9feb1d92.js";import"./index-da3e0c00.js";import"./dev.utils-fab45cbc.js";import"./common-54bf85ba.js";import"./tslib.es6-1173d062.js";import"./Alert-15d42d1c.js";import"./Heading-790c1275.js";const b=class{constructor(t){i(this,t),this.slotName="input",this.catchInputSlot=t=>{c(this.host,t,this.slotName)},this._accessKey=void 0,this._alert=!0,this._currentLength=void 0,this._disabled=!1,this._hasCounter=!1,this._hideMsg=!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(t){return t&&"object"==typeof t&&t.style?t.style:{}}render(){var i,a,c,_,b,m,p,g,y,v,k,j;const B="object"==typeof this._msg&&null!==this._msg&&"string"==typeof(null===(i=this._msg)||void 0===i?void 0:i._description)&&(null===(a=this._msg)||void 0===a?void 0:a._description.length)>0&&(!0===this._touched||"error"!==(null===(c=this._msg)||void 0===c?void 0:c._type)),L=f(this._label),N="string"==typeof this._hint&&this._hint.length>0,M=!L&&this._hideLabel;return s(e,{key:"cfd9957fb1257b093d42a0066c080d282f33fe9e",class:d("kol-input",this.getModifierClassNameByMsgType(B),{disabled:!0===this._disabled,[(null===(_=this._msg)||void 0===_?void 0:_._type)||"error"]:!0===B,"read-only":!0===this._readOnly,required:!0===this._required,touched:!0===this._touched,"hidden-msg":!0===this._hideMsg})},s("label",{key:"102823f929a7cad84ee12ddacd7bb6f9782537b8",class:"input-label",id:M?void 0:`${this._id}-label`,hidden:M,htmlFor:this._id},s("span",{key:"b2ac9d0717998fee3300addc9ab39e7dbab48eef",class:"input-label-span"},s("slot",{key:"8b56ca6a6fea3cbb75c73a7bef18593a5e8e9cb9",name:"label"}))),N&&s("span",{key:"5452317626e66003189a15f34b09a8e19bb33f59",class:"hint",id:`${this._id}-hint`},this._hint),s("div",{key:"abd919e1a330a7d8ac02c2ea9e28e7c98988a57f",class:{input:!0,"icon-left":"object"==typeof(null===(b=this._icons)||void 0===b?void 0:b.left),"icon-right":"object"==typeof(null===(m=this._icons)||void 0===m?void 0:m.right)}},(null===(p=this._icons)||void 0===p?void 0:p.left)&&s(n,{key:"0ebc2e86f6234e1f3266b6fcec60996a1b21b578",_label:"",_icons:(null===(g=this._icons)||void 0===g?void 0:g.left).icon,style:this.getIconStyles(null===(y=this._icons)||void 0===y?void 0:y.left)}),s("div",{key:"40fca3a7748e5de1000aef706672f2fc63407cb1",ref:this.catchInputSlot,id:this.slotName,class:"input-slot"}),"object"==typeof this._smartButton&&null!==this._smartButton&&s(h,{key:"321f1feb6f4187365fd536a0b5c0d305f98613c7",_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}),(null===(v=this._icons)||void 0===v?void 0:v.right)&&s(n,{key:"3f335bb610f0c3359c75b467aaf8d9419428f237",_label:"",_icons:(null===(k=this._icons)||void 0===k?void 0:k.right).icon,style:this.getIconStyles(null===(j=this._icons)||void 0===j?void 0:j.right)})),M&&s(l,{key:"8ccbab744fe667c4b689cf4b0649371d7dd6de58","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}),B&&s(r,{key:"4351c438daf4927a556809fc9cb8af6f54425256",alert:this._alert,hideMsg:this._hideMsg,msg:u(this._msg),id:this._id}),Array.isArray(this._suggestions)&&this._suggestions.length>0&&s("datalist",{key:"2669a99b02803c5c26a00e9e8f88cef20784ea5e",id:`${this._id}-list`},this._suggestions.map((t=>s("option",{value:t})))),this._hasCounter&&s("span",{key:"078089228f083c2815c39a3db63c35ee82673bd9",class:"counter","aria-atomic":"true","aria-live":"polite","data-testid":"input-counter"},this._currentLength,this._maxLength&&s(t,null,s("span",{key:"bcd923ae79e3eeb81c4df0aa0fef564b1352b3c6","aria-label":o("kol-of"),role:"img"},"/"),this._maxLength)," ",s("span",{key:"14c8efa8d7c1f8c4266e1c91b955fcadf803835c"},o("kol-characters"))))}getModifierClassNameByMsgType(t){var s,i;if(t&&(null===(s=this._msg)||void 0===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"}[null===(i=this._msg)||void 0===i?void 0:i._type]}get host(){return a(this)}};export{b as kol_input};