/*!
 * KoliBri - The accessible HTML-Standard
 */
import{r as i,h as t,F as s,H as e,g as h}from"./index-a5e15b1e.js";import{aE as l,M as o}from"./index-c3ae175d.js";import{a as n}from"./i18n-73edd5e1.js";import{F as d}from"./form-field-msg-fc7cec72.js";import"./index-eb50dd62.js";import"./dev.utils-c7d151c6.js";const a=class{constructor(t){i(this,t),this.slotName="input",this.catchInputSlot=t=>{l(this.host,t,this.slotName)},this._accessKey=void 0,this._alert=!0,this._currentLength=void 0,this._disabled=!1,this._error="",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._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 i,l,h,a,r,_,c,u;const m="string"==typeof this._error&&this._error.length>0&&!0===this._touched,p=o(this._label),g="string"==typeof this._hint&&this._hint.length>0,v=!p&&this._hideLabel;return t(e,{class:{disabled:!0===this._disabled,error:!0===m,"read-only":!0===this._readOnly,required:!0===this._required,touched:!0===this._touched,"hidden-error":!0===this._hideError}},t("label",{class:"input-label",id:v?void 0:`${this._id}-label`,hidden:v,htmlFor:this._id},t("span",{class:"input-label-span"},t("slot",{name:"label"}))),g&&t("span",{class:"hint",id:`${this._id}-hint`},this._hint),t("div",{class:{input:!0,"icon-left":"object"==typeof(null===(i=this._icons)||void 0===i?void 0:i.left),"icon-right":"object"==typeof(null===(l=this._icons)||void 0===l?void 0:l.right)}},(null===(h=this._icons)||void 0===h?void 0:h.left)&&t("kol-icon",{_label:"",_icons:(null===(a=this._icons)||void 0===a?void 0:a.left).icon,style:this.getIconStyles(null===(r=this._icons)||void 0===r?void 0:r.left)}),t("div",{ref:this.catchInputSlot,id:this.slotName,class:"input-slot"}),"object"==typeof this._smartButton&&null!==this._smartButton&&t("kol-button-wc",{_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===(_=this._icons)||void 0===_?void 0:_.right)&&t("kol-icon",{_label:"",_icons:(null===(c=this._icons)||void 0===c?void 0:c.right).icon,style:this.getIconStyles(null===(u=this._icons)||void 0===u?void 0:u.right)})),v&&t("kol-tooltip-wc",{"aria-hidden":"true",class:"input-tooltip",_accessKey:this._accessKey,_align:this._tooltipAlign,_id:this._hideLabel?`${this._id}-label`:void 0,_label:this._label}),m&&t(d,{_alert:this._alert,_hideError:this._hideError,_error:this._error,_id:this._id}),Array.isArray(this._suggestions)&&this._suggestions.length>0&&t("datalist",{id:`${this._id}-list`},this._suggestions.map((i=>t("option",{value:i})))),this._hasCounter&&t("span",{class:"counter","aria-atomic":"true","aria-live":"polite"},this._currentLength,this._maxLength&&t(s,null,t("span",{"aria-label":n("kol-of"),role:"img"},"/"),this._maxLength)," ",t("span",null,n("kol-characters"))))}get host(){return h(this)}};export{a as kol_input};