import{r as t,c as i,h as e,H as a,g as s}from"./p-43e8bc5e.js";import{g as n,i as h,e as r,f as l,h as o,a as d,b as p,j as c,c as b,d as m}from"./p-0e15ec4d.js";import{m as u}from"./p-4f82c566.js";import{i as x}from"./p-e4c2dcfc.js";import{B as g}from"./p-ae86d0a0.js";import{d as _}from"./p-f385e205.js";import"./p-e680e7e4.js";import"./p-73aabc9d.js";import"./p-ba041fc5.js";const v=class{constructor(e){t(this,e),this.balChange=i(this,"balChange",7),this.balInput=i(this,"balInput",7),this.balBlur=i(this,"balBlur",7),this.balKeyPress=i(this,"balKeyPress",7),this.balFocus=i(this,"balFocus",7),this.inputId="bal-textarea-"+f++,this.inheritedAttributes={},this.inputValue=this.value,this.initialValue=this.value||"",this.onInput=t=>{const i=n(t);i&&(this.inputValue=i.value),this.balInput.emit(this.inputValue)},this.onFocus=t=>h(this,t),this.onBlur=t=>{r(this,t);const i=t.target;i&&(i.value=this.getValue()),l(this)},this.onClick=t=>o(this,t),this.handleClick=t=>d(this,t),this.focused=!1,this.ariaForm=_,this.name=this.inputId,this.invalid=!1,this.autocapitalize="none",this.autofocus=!1,this.debounce=0,this.placeholder=void 0,this.maxLength=void 0,this.minLength=void 0,this.disabled=!1,this.readonly=!1,this.cols=void 0,this.rows=void 0,this.wrap=void 0,this.required=!1,this.clickable=!1,this.inputmode=void 0,this.value="",this.autoInvalidOff=!1}debounceChanged(){this.balChange=u(this.balChange,this.debounce)}listenOnClick(t){p(this,t)}resetHandler(t){const i=t.target;(null==i?void 0:i.contains(this.el))&&c(this,this.initialValue,this.resetHandlerTimer)}connectedCallback(){this.debounceChanged(),this.initialValue=this.value||""}componentDidLoad(){this.inputValue=this.value}componentWillLoad(){this.inheritedAttributes=x(this.el,["aria-label","tabindex","title"])}async setFocus(){b(this)}async setBlur(){m(this)}getInputElement(){return Promise.resolve(this.nativeInput)}async setAriaForm(t){this.ariaForm=Object.assign({},t)}getValue(){return this.value||""}render(){const t=this.getValue(),i=g.block("textarea"),s=i.element("native");return e(a,{onClick:this.handleClick,"aria-disabled":this.disabled?"true":null,class:Object.assign({},i.class())},e("textarea",Object.assign({class:Object.assign(Object.assign({},s.class()),{textarea:!0,"is-disabled":this.disabled||this.readonly,"is-danger":this.invalid,clickable:this.clickable}),"data-testid":"bal-textarea-input",ref:t=>this.nativeInput=t,name:this.name,id:this.ariaForm.controlId||this.inputId,"aria-labelledby":this.ariaForm.labelId,"aria-describedby":this.ariaForm.messageId,"aria-invalid":!0===this.invalid?"true":"false","aria-disabled":this.disabled?"true":null,disabled:this.disabled,readonly:this.readonly,required:this.required,autoCapitalize:this.autocapitalize,autoFocus:this.autofocus,minLength:this.minLength,maxLength:this.maxLength,placeholder:this.placeholder,inputMode:this.inputmode,value:this.value,cols:this.cols,rows:this.rows,wrap:this.wrap,onFocus:this.onFocus,onInput:t=>this.onInput(t),onBlur:this.onBlur,onClick:this.onClick,onKeyPress:t=>this.balKeyPress.emit(t)},this.inheritedAttributes),t,e("slot",null)))}get el(){return s(this)}static get watchers(){return{debounce:["debounceChanged"]}}};let f=0;v.style=".bal-textarea{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:block;position:relative;-ms-flex:1;flex:1;width:100%;font-family:var(--bal-font-family-text);white-space:pre-wrap;-webkit-box-sizing:border-box;box-sizing:border-box}.bal-textarea__native{margin:0;display:block;width:100%;max-width:100%;max-height:100%;outline:none;background:rgba(0,0,0,0);-webkit-box-sizing:border-box;box-sizing:border-box;resize:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:calc(.75em - 2px)}@media screen and (min-width: 769px),print{.bal-textarea__native{margin:0}}@media screen and (min-width: 1024px){.bal-textarea__native{margin:0}}.bal-textarea__native::-webkit-input-placeholder{padding:0;font-family:inherit}.bal-textarea__native::-moz-placeholder{padding:0;font-family:inherit}.bal-textarea__native:-ms-input-placeholder{padding:0;font-family:inherit}.bal-textarea__native::-ms-input-placeholder{padding:0;font-family:inherit}.bal-textarea__native::placeholder{padding:0;font-family:inherit}@media screen and (min-width: 769px),print{.bal-textarea__native::-webkit-input-placeholder{padding:0}.bal-textarea__native::-moz-placeholder{padding:0}.bal-textarea__native:-ms-input-placeholder{padding:0}.bal-textarea__native::-ms-input-placeholder{padding:0}.bal-textarea__native::placeholder{padding:0}}@media screen and (min-width: 1024px){.bal-textarea__native::-webkit-input-placeholder{padding:0}.bal-textarea__native::-moz-placeholder{padding:0}.bal-textarea__native:-ms-input-placeholder{padding:0}.bal-textarea__native::-ms-input-placeholder{padding:0}.bal-textarea__native::placeholder{padding:0}}";export{v as bal_textarea}