import{s as x,f as h,aG as T,ah as g,E as y,G as _,y as v,t as R,bB as w,ag as S,ad as B,ae as N,z as f,P as C,Q as u,aZ as A,a1 as j}from"./index-BPRWoLf4.js";var O=function(d){x(t,d);function t(){var e=d!==null&&d.apply(this,arguments)||this;return e.inputRef=h.createRef(),e}return t.prototype.doAction=function(e,r,n,s){var o,i,a=e==null?void 0:e.actionType,p=this.props,l=p.onChange,c=p.formStore,m=p.store,b=p.name,E=p.resetValue;if(a==="clear")l==null||l(""),this.focus();else if(a==="reset"){var F=(i=T((o=c==null?void 0:c.pristine)!==null&&o!==void 0?o:m==null?void 0:m.pristine,b))!==null&&i!==void 0?i:E;l==null||l(F),this.focus()}else a==="focus"&&this.focus()},t.prototype.focus=function(){var e;(e=this.inputRef.current)===null||e===void 0||e.focus()},t.prototype.handleChange=function(e){var r=this.props,n=r.onChange,s=r.dispatchEvent;s("change",g(this.props,{value:e})),n&&n(e)},t.prototype.handleFocus=function(e){var r=this,n=this.props,s=n.onFocus,o=n.dispatchEvent,i=n.value;this.setState({focused:!0},function(){return y(r,void 0,void 0,function(){var a;return _(this,function(p){switch(p.label){case 0:return[4,o("focus",g(this.props,{value:i}))];case 1:return a=p.sent(),a!=null&&a.prevented?[2]:(s&&s(e),[2])}})})})},t.prototype.handleBlur=function(e){var r=this,n=this.props,s=n.onBlur,o=n.trimContents,i=n.value,a=n.onChange,p=n.dispatchEvent;this.setState({focused:!1},function(){return y(r,void 0,void 0,function(){var l;return _(this,function(c){switch(c.label){case 0:return o&&i&&typeof i=="string"&&a(i.trim()),[4,p("blur",g(this.props,{value:i}))];case 1:return l=c.sent(),l!=null&&l.prevented?[2]:(s&&s(e),[2])}})})})},t.prototype.renderStatic=function(e){e===void 0&&(e="-");var r=this.props,n=r.render,s=r.staticSchema,o=s===void 0?{}:s;return n("static-textarea",v({type:"multiline-text",maxRows:o.limit||5},o),{value:e})},t.prototype.render=function(){var e=R(this.props,[]),r=this.props,n=r.id,s=r.themeCss,o=r.env,i=r.className,a=r.classPrefix;return h.createElement(h.Fragment,null,h.createElement(w,v({},e,{forwardRef:this.inputRef,onFocus:this.handleFocus,onBlur:this.handleBlur,onChange:this.handleChange,className:S(i,B(v(v({},this.props),{name:"inputControlClassName",id:n,themeCss:s})))})),h.createElement(N,v({},this.props,{config:{themeCss:s,classNames:[{key:"inputControlClassName",weights:{default:{inner:".".concat(a,"TextareaControl-input")},hover:{inner:".".concat(a,"TextareaControl-input")},focused:{suf:".is-focused",inner:".".concat(a,"TextareaControl-input")},disabled:{suf:".is-disabled",inner:".".concat(a,"TextareaControl-input")}}}],id:n},env:o})))},t.defaultProps={minRows:3,maxRows:20,trimContents:!0,resetValue:"",clearable:!1},f([C,u("design:type",Function),u("design:paramtypes",[Object]),u("design:returntype",void 0)],t.prototype,"handleChange",null),f([C,u("design:type",Function),u("design:paramtypes",[Object]),u("design:returntype",void 0)],t.prototype,"handleFocus",null),f([C,u("design:type",Function),u("design:paramtypes",[Object]),u("design:returntype",void 0)],t.prototype,"handleBlur",null),f([A(),u("design:type",Function),u("design:paramtypes",[]),u("design:returntype",void 0)],t.prototype,"render",null),t}(h.Component),G=function(d){x(t,d);function t(){return d!==null&&d.apply(this,arguments)||this}return t=f([j({type:"textarea"})],t),t}(O);export{G as TextAreaControlRenderer,O as default};
