/*!
 * KoliBri - The accessible HTML-Standard
 */
import{r as registerInstance,h,F as Fragment,H as Host,g as getElement}from"./index-cf24d1fe.js";import{c as clsx}from"./clsx-09a06a12.js";import{t as translate}from"./i18n-8640d789.js";import{F as FormFieldMsg}from"./form-field-msg-22e08734.js";import{a as KolTooltipWcTag,g as KolIconTag,c as KolButtonWcTag}from"./component-names-0a8a1a6c.js";import{h as handleSlotContent,s as showExpertSlot}from"./reuse-523ba2ac.js";import"./i18n-7ea9f137.js";const KolInputWc=class{constructor(t){registerInstance(this,t),this.slotName="input",this.catchInputSlot=t=>{handleSlotContent(this.host,t,this.slotName)},this._accessKey=void 0,this._alert=!0,this._currentLength=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._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 t,i,s,e,o,a,l,n,d,r,c,_;const u=Boolean("error"===(null===(t=this._msg)||void 0===t?void 0:t._type)&&this._msg._description&&(null===(i=this._msg._description)||void 0===i?void 0:i.length)>0),g=!this._readOnly&&u&&!0===this._touched,f=Boolean(g||"error"!==(null===(s=this._msg)||void 0===s?void 0:s._type)&&(null===(e=this._msg)||void 0===e?void 0:e._description)),m=showExpertSlot(this._label),b="string"==typeof this._hint&&this._hint.length>0,p=!m&&this._hideLabel;return h(Host,{key:"cb5a010dca6149a054367c7244be69a4e9facb6b",class:clsx("kol-input",this.getModifierClassNameByMsgType(),{disabled:!0===this._disabled,error:!0===g,"read-only":!0===this._readOnly,required:!0===this._required,touched:!0===this._touched,"hidden-error":!0===this._hideError})},h("label",{key:"e9d576ee7f951415fc80678196a94a243908d9a1",class:"input-label",id:p?void 0:`${this._id}-label`,hidden:p,htmlFor:this._id},h("span",{key:"8af0c623f1c552deb3cbb306c5370c8cc05539be",class:"input-label-span"},h("slot",{key:"123d4cd6e4f6e6a0e805e13a3e79a39bf049ff85",name:"label"}))),b&&h("span",{key:"4475d87afadc2d721a34511aa96cd5775d150c39",class:"hint",id:`${this._id}-hint`},this._hint),h("div",{key:"eee25913b496676e874a5123ef132048c2535b8a",class:{input:!0,"icon-left":"object"==typeof(null===(o=this._icons)||void 0===o?void 0:o.left),"icon-right":"object"==typeof(null===(a=this._icons)||void 0===a?void 0:a.right)}},(null===(l=this._icons)||void 0===l?void 0:l.left)&&h(KolIconTag,{key:"84326de1ed7d3542ab0c868ba5bcc88d66d09ed2",_label:"",_icons:(null===(n=this._icons)||void 0===n?void 0:n.left).icon,style:this.getIconStyles(null===(d=this._icons)||void 0===d?void 0:d.left)}),h("div",{key:"4499d53591ef3ca4c86603481f65b09a0f65a5a9",ref:this.catchInputSlot,id:this.slotName,class:"input-slot"}),"object"==typeof this._smartButton&&null!==this._smartButton&&h(KolButtonWcTag,{key:"cc02b46988087722bb62674e02d0a2a0922d8033",_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===(r=this._icons)||void 0===r?void 0:r.right)&&h(KolIconTag,{key:"7425d45bd0da5363927ff85980f47e5728c9245c",_label:"",_icons:(null===(c=this._icons)||void 0===c?void 0:c.right).icon,style:this.getIconStyles(null===(_=this._icons)||void 0===_?void 0:_.right)})),p&&h(KolTooltipWcTag,{key:"66bfb816c06ec291dae8683d1f4dabf81fb4376c","aria-hidden":"true",class:"input-tooltip",_accessKey:this._accessKey,_align:this._tooltipAlign,_id:this._hideLabel?`${this._id}-label`:void 0,_label:this._label}),f&&h(FormFieldMsg,{key:"afbfc9cb6af4e93cf18cbff41a7114ae17043af8",_alert:this._alert,_hideError:this._hideError,_msg:this._msg,_id:this._id}),Array.isArray(this._suggestions)&&this._suggestions.length>0&&h("datalist",{key:"7de41a5df7e95fe2ecd4756a93584fa59155efe1",id:`${this._id}-list`},this._suggestions.map((t=>h("option",{value:t})))),this._hasCounter&&h("span",{key:"e97be096b0bd1bf7622bd4daa0c0d482cf3b8c61",class:"counter","aria-atomic":"true","aria-live":"polite","data-testid":"input-counter"},this._currentLength,this._maxLength&&h(Fragment,null,h("span",{key:"6449d0737b9123456f82ea25a0d0b289aad3df7a","aria-label":translate("kol-of"),role:"img"},"/"),this._maxLength)," ",h("span",{key:"c6ad705d411bcde0769a7e7cfd1f4859fd8ce279"},translate("kol-characters"))))}getModifierClassNameByMsgType(){var t,i;if(null===(t=this._msg)||void 0===t?void 0:t._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 getElement(this)}};export{KolInputWc as kol_input};