xtendui
Version:
Xtend UI is a powerful frontend library of Tailwind CSS components enhanced by vanilla js. It helps you build interfaces with advanced interactions and animations.
3 lines • 2.5 kB
JavaScript
/*! For license information please see 18.min.js.LICENSE.txt */
;(globalThis.webpackChunkxtendui=globalThis.webpackChunkxtendui||[]).push([[18],{8018:(t,e,n)=>{n.r(e),n.d(e,{TextareaautosizeInit:()=>o});var i=n(5498);class o{_init(){this._initVars(),this._initLogic()}_initVars(){const t=this;t._optionsDefault=i.Xt.merge([t.constructor.optionsDefault,i.Xt.options[t.componentName]]),t._optionsInitial=t.options=i.Xt.merge([t._optionsDefault,t._optionsCustom])}_initLogic(){const t=this,e=t.options;t.ns=t.ns??i.Xt.uniqueId(),t.enable(),i.Xt._initMatches({self:t,optionsInitial:t._optionsInitial}),t.initial=!0;const n=i.Xt.dataStorage.put(t.container,`keydown keyup reset/${t.ns}`,t._keychange.bind(t));t.container.addEventListener("keydown",n),t.container.addEventListener("keyup",n),t.form=t.container.closest("form"),t.form&&t.form.addEventListener("reset",n),t._initStart(),t.container.dispatchEvent(new CustomEvent(`setup.${t._componentNs}`)),i.Xt.frameDouble({el:t.container,ns:`${t.ns}Init`,func:()=>{t.container.setAttribute(`data-${t.componentName}-init`,""),t.container.dispatchEvent(new CustomEvent(`init.${t._componentNs}`)),t.initial=!1,e.debug&&console.debug(`${t.componentName} init`,t)}}),t.options.disabled&&t.disable()}_initStart(){const t=this;t.disabled||t._keychange.bind(t)()}_keychange(){const t=this;t.disabled||(t.container.style.height="5px",t.container.style.height=`${t.container.scrollHeight}px`,i.Xt.frame({el:t.container,ns:`${t.ns}Keychange`,func:()=>{t.container.style.height="5px",t.container.style.height=`${t.container.scrollHeight}px`}}))}enable(){const t=this;t.disabled&&(t.disabled=!1,t.container.dispatchEvent(new CustomEvent(`status.${t._componentNs}`)))}disable(){let{skipEvent:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=this;e.disabled||(e.disabled=!0,e.container.style.height="",i.Xt.frame({el:e.container,ns:`${e.ns}Keychange`}),t||e.container.dispatchEvent(new CustomEvent(`status.${e._componentNs}`)))}reinit(){this._initLogic()}destroy(){const t=this;t.container.style.height="";const e=i.Xt.dataStorage.get(t.container,`keydown keyup reset/${t.ns}`);t.container.removeEventListener("keydown",e),t.container.removeEventListener("keyup",e),t.form&&t.form.removeEventListener("reset",e),t.container.removeAttribute(`data-${t.componentName}-init`),i.Xt._remove({name:t.componentName,el:t.container}),t.container.dispatchEvent(new CustomEvent(`destroy.${t._componentNs}`))}}}}]);
//# sourceMappingURL=18.min.js.map