import{r as t,c as s,h as i,H as e,g as h}from"./p-21516f8c.js";import{d as a}from"./p-6fdf5ce4.js";import{c as r}from"./p-86bff9b3.js";const l=":host{--lu-text-area-border-color:#686A6F;position:relative}:host lu-icon{top:50%;margin-top:-13px;font-size:24px;line-height:26px}:host(.lu-color){color:var(--lu-color-base)}.native-textarea{padding:9px 10px;width:100%;border:1px solid var(--lu-global-form-input-outline, var(--lu-text-area-border-color));outline:none;background-color:#FFFFFF;font-size:var(--lu-global-form-text-area-font-size, 14px);line-height:26px;box-sizing:border-box}:host([is-valid]) .native-textarea{border:2px solid #00854E}:host([is-invalid]) .native-textarea{border:2px solid #E4002B}:host(.has-focus) .native-textarea{border:2px solid #1B2C56}";const o=class{constructor(i){t(this,i);this.luChange=s(this,"luChange",7);this.luInput=s(this,"luInput",7);this.luBlur=s(this,"luBlur",7);this.luFocus=s(this,"luFocus",7);this.textAreaId=`lu-text-area-${n++}`;this.didBlurAfterEdit=false;this.hasFocus=false;this.isResetting=false;this.ariaLabeledByAddition="";this.invalid=false;this.valid=false;this.hasFormGroup=false;this.useId=this.textAreaId+"-wrapper";this.autocapitalize="none";this.autofocus=false;this.clearOnEdit=false;this.debounce=0;this.disabled=false;this.name=this.textAreaId;this.readonly=false;this.required=false;this.spellcheck=false;this.autoGrow=false;this.value="";this.onInput=t=>{if(this.nativeInput){this.value=this.nativeInput.value}this.luInput.emit(t)};this.onFocus=()=>{this.hasFocus=true;this.focusChange();this.luFocus.emit()};this.onBlur=()=>{this.hasFocus=false;this.focusChange();this.luBlur.emit()};this.onKeyDown=()=>{this.checkClearOnEdit()}}debounceChanged(){this.luChange=a(this.luChange,this.debounce)}valueChanged(){const t=this.nativeInput;const s=this.getValue();if(t&&t.value!==s){t.value=s}this.luChange.emit({value:s,isResetting:this.isResetting});this.isResetting=false}connectedCallback(){this.debounceChanged()}async setFocus(){if(this.nativeInput){this.nativeInput.focus()}}getInputElement(){return Promise.resolve(this.nativeInput)}async updateValue(t){this.isResetting=true;this.value=t}checkClearOnEdit(){if(!this.clearOnEdit){return}if(this.didBlurAfterEdit&&this.hasValue()){this.value=""}this.didBlurAfterEdit=false}focusChange(){if(this.clearOnEdit&&!this.hasFocus&&this.hasValue()){this.didBlurAfterEdit=true}}hasValue(){return this.getValue()!==""}getValue(){return this.value||""}render(){const t=this.getValue();return i(e,{"aria-disabled":this.disabled?"true":null,class:Object.assign(Object.assign({},r(this.color)),{"is-text-area":true,"has-value":this.hasValue(),"has-focus":this.hasFocus}),"is-invalid":this.invalid,"is-valid":this.valid,id:this.useId},i("textarea",Object.assign({class:"native-textarea",ref:t=>this.nativeInput=t,autoCapitalize:this.autocapitalize},(this.hasFormGroup||this.ariaLabeledByAddition&&this.ariaLabeledByAddition.length>0)&&{"aria-labelledby":`${this.ariaLabeledByAddition} `+(this.hasFormGroup?this.textAreaId+"-label":"")},{autoFocus:this.autofocus,disabled:this.disabled,maxLength:this.maxlength,minLength:this.minlength,name:this.name,placeholder:this.placeholder||"",readOnly:this.readonly,required:this.required,spellCheck:this.spellcheck,cols:this.cols,rows:this.rows,wrap:this.wrap,onInput:this.onInput,onBlur:this.onBlur,onFocus:this.onFocus,onKeyDown:this.onKeyDown}),t))}get el(){return h(this)}static get watchers(){return{debounce:["debounceChanged"],value:["valueChanged"]}}};let n=0;o.style=l;export{o as lu_text_area};
//# sourceMappingURL=p-fb6865d8.entry.js.map