import{p as e,H as r,c as t,h as a,d as s,t as i}from"./p-Bpcl2TqF.js";import{i as o,d as l,t as p}from"./p-94ZtGp9D.js";const d=()=>`:host{display:flex;flex-direction:column;width:100%}.wrapper__label{color:#1D1D1D;font:400 1rem/1.5rem "Source Sans 3"}.wrapper__label .required{margin-left:4px}.wrapper__label .required.error{color:#CD002F}:host(.wrapper--disabled) .wrapper__label{color:#BFBBBB}.wrapper__textarea{width:100%}.wrapper__textarea.fullWidth{width:100%}.wrapper__textarea.fullWidth textarea{width:100%;box-sizing:border-box}.wrapper__textarea textarea{border:1px solid #8D8786;border-radius:1px;padding:8px 16px;background-color:#FFFFFF;color:#1D1D1D;font:400 1rem/1.5rem "Source Sans 3";transition:all 100ms ease;transition-property:border-color}.wrapper__textarea textarea:hover{border:1px solid #575352}.wrapper__textarea textarea:focus-within{outline:2px solid #0A8276;outline-offset:0}:host(.wrapper--error) .wrapper__textarea textarea{border:1px solid #CD002F}:host(.wrapper--disabled) .wrapper__textarea textarea{border:1px solid #BFBBBB;background-color:#BFBBBB;color:#FFFFFF}:host(.wrapper--disabled) .wrapper__textarea textarea::placeholder{color:#FFFFFF}.wrapper__caption{color:#1D1D1D;font:400 0.75rem/1rem "Source Sans 3"}:host(.wrapper--error) .wrapper__caption{color:#CD002F}:host(.wrapper--disabled) .wrapper__caption{color:#BFBBBB}`;const n=e(class e extends r{constructor(e){super();if(e!==false){this.__registerHost()}this.__attachShadow();this.ifxInput=t(this,"ifxInput",7);this.internals=this.attachInternals()}inputId=`ifx-textarea-${++h}`;internals;ifxInput;get el(){return this}caption;cols;disabled=false;error=false;label;maxlength;name;placeholder;required=false;readOnly=false;resize="both";rows;value;wrap="soft";fullWidth="false";async reset(){this.resetTextarea()}handleComponentWidth(){const e=this.el.shadowRoot.querySelector(".wrapper__textarea");const r=this.fullWidth.toLowerCase()==="true";if(r){e.classList.add("fullWidth")}else if(e.classList.contains("fullWidth")){e.classList.remove("fullWidth")}}componentDidRender(){this.handleComponentWidth()}formResetCallback(){this.resetTextarea()}handleOnInput(e){this.value=e.target.value;this.ifxInput.emit(this.value)}resetTextarea(){this.value=""}async componentDidLoad(){if(!o(this.el)){const e=l();p("ifx-textarea",await e)}}render(){return a(s,{key:"350f76781fb653356a69c43f840b9686632b380b",class:`wrapper--${this.error?"error":""} wrapper--${this.disabled&&!this.error?"disabled":""}`},a("label",{key:"989170dc3276291308efc0a6884c68ebac75286b",class:"wrapper__label",htmlFor:this.inputId},this.label?.trim(),this.required&&a("span",{key:"818cb3ac7fc4d0361c1fa2ef0119d14d8c553b2b",class:`required ${this.error?"error":""}`},"*")),a("div",{key:"28fea71f1fb14a4142255983f834598f632e7f71",class:"wrapper__textarea"},a("textarea",{key:"c771ad2ba76ffe99613699bdd44ea87e3f4a4575","aria-label":"a textarea","aria-value":this.value,"aria-disabled":this.disabled&&!this.error,id:this.inputId,style:{resize:this.resize},name:this.name?this.name:this.inputId,cols:this.cols,rows:this.rows,maxlength:this.maxlength,wrap:this.wrap,disabled:this.disabled&&!this.error,readonly:this.readOnly,placeholder:this.placeholder,value:this.value,onInput:e=>this.handleOnInput(e)})),this.caption?.trim()&&a("div",{key:"e49249f001f6c8ebe7d09647862676dadc521ceb",class:"wrapper__caption"},this.caption.trim()))}static get style(){return d()}},[513,"ifx-textarea",{caption:[1],cols:[2],disabled:[4],error:[4],label:[1],maxlength:[2],name:[1],placeholder:[1],required:[4],readOnly:[4,"read-only"],resize:[1],rows:[2],value:[1025],wrap:[1],fullWidth:[513,"full-width"],reset:[64]}]);let h=0;function c(){if(typeof customElements==="undefined"){return}const e=["ifx-textarea"];e.forEach((e=>{switch(e){case"ifx-textarea":if(!customElements.get(i(e))){customElements.define(i(e),n)}break}}))}const f=n;const x=c;export{f as IfxTextarea,x as defineCustomElement};
//# sourceMappingURL=ifx-textarea.js.map