{"version":3,"file":"name_controller-BmM3X5Z6.js","sources":["../../../app/javascript/controllers/step/name_controller.js"],"sourcesContent":["import ApplicationController from '@/controllers/application_controller'\n\nexport default class extends ApplicationController {\n static values = {\n kind: String,\n name: String,\n }\n\n static targets = ['input', 'label', 'editButton']\n\n initialize() {\n this.onToggle = this.onToggle.bind(this)\n\n super.initialize()\n }\n\n connect() {\n this.element.addEventListener('toggle', this.onToggle)\n\n super.connect()\n }\n\n disconnect() {\n this.element.removeEventListener('toggle', this.onToggle)\n\n super.disconnect()\n }\n\n onToggle(event) {\n if(this.element.open) {\n this.focus(this.inputTarget, { moveCursorToEnd: true })\n }\n }\n\n edit() {\n this.hide(this.labelTarget, this.editButtonTarget)\n this.show(this.inputTarget)\n\n this.focus(this.inputTarget, { moveCursorToEnd: true })\n }\n\n escape() {\n this.inputTarget.value = this.nameValue\n\n this.hide(this.inputTarget)\n this.show(this.labelTarget, this.editButtonTarget)\n }\n\n saveByEnter() {\n this.nameValue = this.inputTarget.value\n this.labelTarget.innerText = this.nameValue || t.journeys.new[this.kindValue]\n\n this.hide(this.inputTarget)\n this.show(this.labelTarget, this.editButtonTarget)\n }\n\n onInputChange() {\n }\n}\n"],"names":["name_controller","ApplicationController","event","__publicField"],"mappings":"uNAEe,MAAKA,UAASC,CAAsB,CAQjD,YAAa,CACX,KAAK,SAAW,KAAK,SAAS,KAAK,IAAI,EAEvC,MAAM,WAAU,CACpB,CAEE,SAAU,CACR,KAAK,QAAQ,iBAAiB,SAAU,KAAK,QAAQ,EAErD,MAAM,QAAO,CACjB,CAEE,YAAa,CACX,KAAK,QAAQ,oBAAoB,SAAU,KAAK,QAAQ,EAExD,MAAM,WAAU,CACpB,CAEE,SAASC,EAAO,CACX,KAAK,QAAQ,MACd,KAAK,MAAM,KAAK,YAAa,CAAE,gBAAiB,EAAM,CAAA,CAE5D,CAEE,MAAO,CACL,KAAK,KAAK,KAAK,YAAa,KAAK,gBAAgB,EACjD,KAAK,KAAK,KAAK,WAAW,EAE1B,KAAK,MAAM,KAAK,YAAa,CAAE,gBAAiB,EAAM,CAAA,CAC1D,CAEE,QAAS,CACP,KAAK,YAAY,MAAQ,KAAK,UAE9B,KAAK,KAAK,KAAK,WAAW,EAC1B,KAAK,KAAK,KAAK,YAAa,KAAK,gBAAgB,CACrD,CAEE,aAAc,CACZ,KAAK,UAAY,KAAK,YAAY,MAClC,KAAK,YAAY,UAAY,KAAK,WAAa,EAAE,SAAS,IAAI,KAAK,SAAS,EAE5E,KAAK,KAAK,KAAK,WAAW,EAC1B,KAAK,KAAK,KAAK,YAAa,KAAK,gBAAgB,CACrD,CAEE,eAAgB,CAClB,CACA,CAvDEC,EADkBH,EACX,SAAS,CACd,KAAM,OACN,KAAM,MACV,GAEEG,EANkBH,EAMX,UAAU,CAAC,QAAS,QAAS,YAAY"}