/*!
 * KoliBri - The accessible HTML-Standard
 */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const index=require("./index-daeff106.js"),index$1=require("./index-7215e5f8.js"),i18n=require("./i18n-411431b1.js"),formFieldMsg=require("./form-field-msg-e7415486.js");require("./index-d6d9ba30.js"),require("./dev.utils-0c521af5.js");const KolInput=class{constructor(t){index.registerInstance(this,t),this.slotName="input",this.catchInputSlot=t=>{index$1.handleSlotContent(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 t,i,s,e,o,n,h,l;const r="string"==typeof this._error&&this._error.length>0&&!0===this._touched,d=index$1.showExpertSlot(this._label),a="string"==typeof this._hint&&this._hint.length>0,_=!d&&this._hideLabel;return index.h(index.Host,{class:{disabled:!0===this._disabled,error:!0===r,"read-only":!0===this._readOnly,required:!0===this._required,touched:!0===this._touched,"hidden-error":!0===this._hideError}},index.h("label",{class:"input-label",id:_?void 0:`${this._id}-label`,hidden:_,htmlFor:this._id},index.h("span",{class:"input-label-span"},index.h("slot",{name:"label"}))),a&&index.h("span",{class:"hint",id:`${this._id}-hint`},this._hint),index.h("div",{class:{input:!0,"icon-left":"object"==typeof(null===(t=this._icons)||void 0===t?void 0:t.left),"icon-right":"object"==typeof(null===(i=this._icons)||void 0===i?void 0:i.right)}},(null===(s=this._icons)||void 0===s?void 0:s.left)&&index.h("kol-icon",{_label:"",_icons:(null===(e=this._icons)||void 0===e?void 0:e.left).icon,style:this.getIconStyles(null===(o=this._icons)||void 0===o?void 0:o.left)}),index.h("div",{ref:this.catchInputSlot,id:this.slotName,class:"input-slot"}),"object"==typeof this._smartButton&&null!==this._smartButton&&index.h("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===(n=this._icons)||void 0===n?void 0:n.right)&&index.h("kol-icon",{_label:"",_icons:(null===(h=this._icons)||void 0===h?void 0:h.right).icon,style:this.getIconStyles(null===(l=this._icons)||void 0===l?void 0:l.right)})),_&&index.h("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}),r&&index.h(formFieldMsg.FormFieldMsg,{_alert:this._alert,_hideError:this._hideError,_error:this._error,_id:this._id}),Array.isArray(this._suggestions)&&this._suggestions.length>0&&index.h("datalist",{id:`${this._id}-list`},this._suggestions.map((t=>index.h("option",{value:t})))),this._hasCounter&&index.h("span",{class:"counter","aria-atomic":"true","aria-live":"polite"},this._currentLength,this._maxLength&&index.h(index.Fragment,null,index.h("span",{"aria-label":i18n.translate("kol-of"),role:"img"},"/"),this._maxLength)," ",index.h("span",null,i18n.translate("kol-characters"))))}get host(){return index.getElement(this)}};exports.kol_input=KolInput;