/*!
 * KoliBri - The accessible HTML-Standard
 */
import{r as i,h as s,F as t,H as e,g as d}from"./index-a0b4dca2.js";import{c as a}from"./clsx-09a06a12.js";import{t as o}from"./i18n-5fe08f1c.js";import{u as l,d as n,a as h}from"./component-names-aa3cbc3c.js";import{h as f,s as r}from"./reuse-32931294.js";import{K as c}from"./FormFieldMsg-de303cbe.js";import"./i18n-7ea9f137.js";import"./Alert-a0cdc528.js";import"./tslib.es6-2e5096f8.js";import"./Heading-781aa65b.js";import"./dev.utils-fab45cbc.js";const u=class{constructor(t){i(this,t),this.slotName="input",this.catchInputSlot=t=>{f(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._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,d,_,f,b,u,m,p,g,y,v,k;const j=Boolean("error"===(null===(i=this._msg)||void 0===i?void 0:i._type)&&this._msg._description&&(null===(d=this._msg._description)||void 0===d?void 0:d.length)>0),B=!this._readOnly&&j&&!0===this._touched,L=Boolean(B||"error"!==(null===(_=this._msg)||void 0===_?void 0:_._type)&&(null===(f=this._msg)||void 0===f?void 0:f._description)),N=r(this._label),x="string"==typeof this._hint&&this._hint.length>0,A=!N&&this._hideLabel;return s(e,{key:"b8df7f60763afdbfdf35b0026a092c49a3b1866b",class:a("kol-input",this.getModifierClassNameByMsgType(),{disabled:!0===this._disabled,error:!0===B,"read-only":!0===this._readOnly,required:!0===this._required,touched:!0===this._touched,"hidden-error":!0===this._hideError})},s("label",{key:"29a105409c1aa053d015150788729b94745518bd",class:"input-label",id:A?void 0:`${this._id}-label`,hidden:A,htmlFor:this._id},s("span",{key:"6808011d7fdc8605a78c0c02381f11fdb18f34f5",class:"input-label-span"},s("slot",{key:"9cb9136bbe0e9adf68d3b75f68496f71bfb81020",name:"label"}))),x&&s("span",{key:"d701237628ecde9eeef3ddda238858bcd5ecbe5c",class:"hint",id:`${this._id}-hint`},this._hint),s("div",{key:"2ddffe093cfe68ba213fc84416751401557a4745",class:{input:!0,"icon-left":"object"==typeof(null===(b=this._icons)||void 0===b?void 0:b.left),"icon-right":"object"==typeof(null===(u=this._icons)||void 0===u?void 0:u.right)}},(null===(m=this._icons)||void 0===m?void 0:m.left)&&s(n,{key:"d5ee1e5d7ffde6adc6518301bd7515902d8c4015",_label:"",_icons:(null===(p=this._icons)||void 0===p?void 0:p.left).icon,style:this.getIconStyles(null===(g=this._icons)||void 0===g?void 0:g.left)}),s("div",{key:"55b2164813cefbafbf9951fd44f7f9d720116414",ref:this.catchInputSlot,id:this.slotName,class:"input-slot"}),"object"==typeof this._smartButton&&null!==this._smartButton&&s(h,{key:"3f03623c2f5ddc28a3a17d21738182253f8bd471",_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===(y=this._icons)||void 0===y?void 0:y.right)&&s(n,{key:"d38fb504da0f5a37e5808ede0d16b0f368db6f25",_label:"",_icons:(null===(v=this._icons)||void 0===v?void 0:v.right).icon,style:this.getIconStyles(null===(k=this._icons)||void 0===k?void 0:k.right)})),A&&s(l,{key:"fd6697c91cf0c33934be094ee8e10913f5244955","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}),L&&s(c,{key:"babedf64505945c9d8c9a3e3f41f464346c795e1",_alert:this._alert,_hideError:this._hideError,_msg:this._msg,_id:this._id}),Array.isArray(this._suggestions)&&this._suggestions.length>0&&s("datalist",{key:"18aa171c5139a11b793e4cdd3379a9b98c91670f",id:`${this._id}-list`},this._suggestions.map((t=>s("option",{value:t})))),this._hasCounter&&s("span",{key:"193f9b434011825c0695ac11dbc135bd5614e692",class:"counter","aria-atomic":"true","aria-live":"polite","data-testid":"input-counter"},this._currentLength,this._maxLength&&s(t,null,s("span",{key:"43426e33b6e7a204b2f7614cf51f890adbb6d51b","aria-label":o("kol-of"),role:"img"},"/"),this._maxLength)," ",s("span",{key:"e7856e63c99d0ece89fd8f8005f4dd2843a59f31"},o("kol-characters"))))}getModifierClassNameByMsgType(){var t,s;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===(s=this._msg)||void 0===s?void 0:s._type]}get host(){return d(this)}};export{u as kol_input};