{"version":3,"file":"name_controller-CTQMl8kd.js","sources":["../../../app/javascript/controllers/property/name_controller.js"],"sourcesContent":["import ApplicationController from '../application_controller'\n\nexport default class extends ApplicationController {\n static values = {\n name: String,\n }\n\n static targets=[\"firstName\", \"lastName\", \"form\", \"label\"]\n\n connect() {\n this.dispatch('sync', {\n detail: this.nameValue\n })\n\n super.connect()\n }\n\n focus() {\n this.hide(this.labelTarget)\n this.show(this.formTarget)\n\n super.focus(this.firstNameTarget, { moveCursorToEnd: true })\n }\n\n submit({ target }) {\n if(this.isInvisible(this.formTarget)|| this.formTarget.contains(target) || this.labelTarget.contains(target)) return\n this.formTarget.requestSubmit()\n }\n\n restore() {\n this.formTarget.reset()\n this.blur()\n }\n\n blur() {\n this.hide(this.formTarget)\n this.show(this.labelTarget)\n }\n}\n"],"names":["name_controller","ApplicationController","target","__publicField"],"mappings":"uNAEe,MAAKA,UAASC,CAAsB,CAOjD,SAAU,CACR,KAAK,SAAS,OAAQ,CACpB,OAAQ,KAAK,SACd,CAAA,EAED,MAAM,QAAO,CACjB,CAEE,OAAQ,CACN,KAAK,KAAK,KAAK,WAAW,EAC1B,KAAK,KAAK,KAAK,UAAU,EAEzB,MAAM,MAAM,KAAK,gBAAiB,CAAE,gBAAiB,EAAM,CAAA,CAC/D,CAEE,OAAO,CAAE,OAAAC,GAAU,CACd,KAAK,YAAY,KAAK,UAAU,GAAI,KAAK,WAAW,SAASA,CAAM,GAAK,KAAK,YAAY,SAASA,CAAM,GAC3G,KAAK,WAAW,cAAa,CACjC,CAEE,SAAU,CACR,KAAK,WAAW,MAAK,EACrB,KAAK,KAAI,CACb,CAEE,MAAO,CACL,KAAK,KAAK,KAAK,UAAU,EACzB,KAAK,KAAK,KAAK,WAAW,CAC9B,CACA,CAnCEC,EADkBH,EACX,SAAS,CACd,KAAM,MACV,GAEEG,EALkBH,EAKX,UAAQ,CAAC,YAAa,WAAY,OAAQ,OAAO"}