{"version":3,"file":"birthday_controller-CGgVcLMZ.js","sources":["../../../app/javascript/controllers/filter/birthday_controller.js"],"sourcesContent":["import ApplicationController from '../application_controller'\n\nexport default class extends ApplicationController {\n static values = {\n valid: Boolean\n }\n\n static targets = [\n 'between',\n 'minInput',\n 'maxInput'\n ]\n\n showBetween() {\n this.show(this.betweenTarget)\n\n if(this.minInputTarget.value) {\n this.focus(this.maxInputTarget, { moveCursorToEnd: true })\n } else {\n this.focus(this.minInputTarget, { moveCursorToEnd: true })\n }\n\n this.sync()\n }\n\n hideBetween() {\n this.hide(this.betweenTarget)\n this.focus(this.minInputTarget, { moveCursorToEnd: true })\n\n this.sync()\n }\n\n sync() {\n if(this.isVisible(this.betweenTarget)) {\n this.validValue = this.minInputTarget.value.trim().length > 0 && this.maxInputTarget.value.trim().length > 0\n } else {\n this.validValue = this.minInputTarget.value.trim().length > 0\n }\n }\n\n validValueChanged() {\n this.element.setAttribute('data-valid', this.validValue)\n\n this.dispatch('validation', {\n detail: this.validValue,\n })\n }\n}\n"],"names":["birthday_controller","ApplicationController","__publicField"],"mappings":"uNAEe,MAAKA,UAASC,CAAsB,CAWjD,aAAc,CACZ,KAAK,KAAK,KAAK,aAAa,EAEzB,KAAK,eAAe,MACrB,KAAK,MAAM,KAAK,eAAgB,CAAE,gBAAiB,EAAM,CAAA,EAEzD,KAAK,MAAM,KAAK,eAAgB,CAAE,gBAAiB,EAAM,CAAA,EAG3D,KAAK,KAAI,CACb,CAEE,aAAc,CACZ,KAAK,KAAK,KAAK,aAAa,EAC5B,KAAK,MAAM,KAAK,eAAgB,CAAE,gBAAiB,EAAM,CAAA,EAEzD,KAAK,KAAI,CACb,CAEE,MAAO,CACF,KAAK,UAAU,KAAK,aAAa,EAClC,KAAK,WAAa,KAAK,eAAe,MAAM,KAAM,EAAC,OAAS,GAAK,KAAK,eAAe,MAAM,KAAI,EAAG,OAAS,EAE3G,KAAK,WAAa,KAAK,eAAe,MAAM,KAAM,EAAC,OAAS,CAElE,CAEE,mBAAoB,CAClB,KAAK,QAAQ,aAAa,aAAc,KAAK,UAAU,EAEvD,KAAK,SAAS,aAAc,CAC1B,OAAQ,KAAK,UACd,CAAA,CACL,CACA,CA5CEC,EADkBF,EACX,SAAS,CACd,MAAO,OACX,GAEEE,EALkBF,EAKX,UAAU,CACf,UACA,WACA,UACJ"}