import{r as v,ak as k,v as L,h as t,F as B,K as x,e as g,c as N,H as I,m as K}from"./index-CJwtOLCA.js";import{c as M}from"./clsx-09a06a12-BT_IL7Fz.js";import{t as b}from"./i18n-820d85c7-BH6ws-IX.js";import{F as S}from"./FormFieldMsg-ac98caad-CbRac5GP.js";import"./tslib.es6-1173d062-BAJoBDh7.js";import"./Alert-ea5205e8-CXVwjimO.js";/*!
 * KoliBri - The accessible HTML-Standard
 */const w=class{constructor(e){v(this,e),this.slotName="input",this.catchInputSlot=s=>{k(this.host,s,this.slotName)},this._accessKey=void 0,this._alert=!0,this._currentLength=void 0,this._currentLengthDebounced=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(e){return e&&typeof e=="object"&&e.style?e.style:{}}render(){var e,s,i,a,n,o,d,l,h,r,_,c;const u=typeof this._msg=="object"&&this._msg!==null&&typeof((e=this._msg)===null||e===void 0?void 0:e._description)=="string"&&((s=this._msg)===null||s===void 0?void 0:s._description.length)>0&&(this._touched===!0||((i=this._msg)===null||i===void 0?void 0:i._type)!=="error"),m=L(this._label),p=typeof this._hint=="string"&&this._hint.length>0,f=!m&&this._hideLabel;return t(I,{key:"97a275ca1a9441bbc2b08647a9f7bb15422abe39",class:M("kol-input",this.getModifierClassNameByMsgType(u),{disabled:this._disabled===!0,[((a=this._msg)===null||a===void 0?void 0:a._type)||"error"]:u===!0,"read-only":this._readOnly===!0,required:this._required===!0,touched:this._touched===!0,"hidden-error":this._hideError===!0})},t("label",{key:"f9840afaadb54e828df2360b35206bd474d6e6ae",class:"input-label",id:f?void 0:`${this._id}-label`,hidden:f,htmlFor:this._id},t("span",{key:"b9a24b60ba19d4af9018c4c0b0974c1976634683",class:"input-label-span"},t("slot",{key:"6dd64696bf929479eb707d3380301251e1d83457",name:"label"}))),p&&t("span",{key:"8957e1a38b7ab3e4e1b79308ac21cce40c1b87c9",class:"hint",id:`${this._id}-hint`},this._hint),t("div",{key:"4830f1ea34aba0d7affe33bb4416b1ef1d0365dd",class:{input:!0,"icon-left":typeof((n=this._icons)===null||n===void 0?void 0:n.left)=="object","icon-right":typeof((o=this._icons)===null||o===void 0?void 0:o.right)=="object"}},((d=this._icons)===null||d===void 0?void 0:d.left)&&t(g,{key:"3afaeb25f8bf25451dc92e32021742df0280ac5f",_label:"",_icons:((l=this._icons)===null||l===void 0?void 0:l.left).icon,style:this.getIconStyles((h=this._icons)===null||h===void 0?void 0:h.left)}),t("div",{key:"132a91efcb02a2e9f554df8d202078787de2fdc7",ref:this.catchInputSlot,id:this.slotName,class:"input-slot"}),typeof this._smartButton=="object"&&this._smartButton!==null&&t(N,{key:"eae26e05ed4265ccd3d22d0ab59da0b374d352a6",_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}),((r=this._icons)===null||r===void 0?void 0:r.right)&&t(g,{key:"4975557b0114b0e7901148a6159d3d28ee56fada",_label:"",_icons:((_=this._icons)===null||_===void 0?void 0:_.right).icon,style:this.getIconStyles((c=this._icons)===null||c===void 0?void 0:c.right)})),f&&t(x,{key:"6d5f028bd4ca6930fe0127ee292ca225e5dad8d4","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}),u&&t(S,{key:"1ad8ac23b1bff22f8a29edfd0a58d0f192eec80c",_alert:this._alert,_hideError:this._hideError,_msg:this._msg,_id:this._id}),Array.isArray(this._suggestions)&&this._suggestions.length>0&&t("datalist",{key:"79af0e327c2e1bb571e43587478188a38899a647",id:`${this._id}-list`},this._suggestions.map(y=>t("option",{value:y}))),this._hasCounter&&t(B,null,t("span",{key:"416b8380d001dea36f8e087633ecd1d6fe523ba8",class:"counter","aria-hidden":"true","data-testid":"input-counter"},this._currentLength,this._maxLength&&`/${this._maxLength}`," ",b("kol-characters")),t("span",{key:"6fed61b8e5a0e8b01ce392f500e8f47b9b9cab45","aria-live":"polite","aria-atomic":"true",class:"visually-hidden","data-testid":"input-counter-aria"},this._currentLengthDebounced,this._maxLength&&` ${b("kol-of")} ${this._maxLength}`," ",b("kol-characters"))))}getModifierClassNameByMsgType(e){var s,i;if(e&&(!((s=this._msg)===null||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"}[(i=this._msg)===null||i===void 0?void 0:i._type]}get host(){return K(this)}};export{w as kol_input};
//# sourceMappingURL=kol-input.entry-C_pWO9IM.js.map
