{"version":3,"sources":["webpack:///../../../src/components/VSwitch/VSwitch.ts"],"names":["name","directives","Touch","props","inset","loading","type","Boolean","default","flat","computed","classes","this","attrs","String","role","validationState","hasError","hasColor","switchData","setTextColor","undefined","class","themeClasses","methods","genDefaultSlot","genSwitch","$createElement","staticClass","genInput","attrs$","genRipple","value","left","right","onSwipeRight","genProgress","$slots","progress","color","size","width","indeterminate","onSwipeLeft","onChange","onKeydown","e"],"mappings":"0RAsBe,qBAAkB,CAC/BA,KAD+B,WAG/BC,WAAY,CAAEC,MAAA,QAEdC,MAAO,CACLC,MADK,QAELC,QAAS,CACPC,KAAM,CAACC,QADA,QAEPC,SAAS,GAEXC,KAAM,CACJH,KADI,QAEJE,SAAS,IAIbE,SAAU,CACRC,QADQ,WAEN,wCACK,qCADE,OAAP,IAEE,+CAFK,EAGL,wBAAyBC,KAHpB,KAIL,yBAA0BA,KAAKR,SAGnCS,MATQ,WAUN,MAAO,CACL,eAAgBC,OAAOF,KADlB,UAEL,gBAAiBE,OAAOF,KAFnB,YAGLG,KAAM,WAMVC,gBAnBQ,WAoBN,OAAIJ,KAAKK,UAAYL,KAArB,eAAiD,QAC7CA,KAAJ,WAA4B,UAC5B,OAAIA,KAAKM,SAA0BN,KAAP,mBAA5B,GAGFO,WAzBQ,WA0BN,OAAOP,KAAKQ,aAAaR,KAAKP,aAAUgB,EAAYT,KAA7C,gBAAmE,CACxEU,MAAOV,KAAKW,iBAKlBC,QAAS,CACPC,eADO,WAEL,MAAO,CACLb,KADK,YAELA,KAFF,aAKFc,UAPO,WAQL,OAAOd,KAAKe,eAAe,MAAO,CAChCC,YAAa,sCACZ,CACDhB,KAAKiB,SAAS,WAAY,OAA1B,OAA0B,CAA1B,kBACKjB,KADqB,OAErBA,KAAKkB,SAEVlB,KAAKmB,UAAUnB,KAAKQ,aAAaR,KAAlB,gBAAwC,CACrDX,WAAY,CAAC,CACXD,KADW,QAEXgC,MAAO,CACLC,KAAMrB,KADD,YAELsB,MAAOtB,KAAKuB,mBAIlBvB,KAAKe,eAAe,MAAO,OAA3B,OAA2B,CAA3B,CACEC,YADyB,0BAEtBhB,KAAKO,aAEVP,KAAKe,eAAe,MAAO,OAA3B,OAA2B,CAA3B,CACEC,YADyB,0BAEtBhB,KAAKO,YACP,CAACP,KAvBN,mBA0BFwB,YAlCO,WAmCL,OAAOxB,KAAKe,eAAe,EAApB,QAAwC,EAC5B,IAAjBf,KAAKP,QAAL,KAEIO,KAAKyB,OAAOC,UAAY1B,KAAKe,eAAe,EAApB,KAAuC,CAC/DxB,MAAO,CACLoC,OAAyB,IAAjB3B,KAAKP,SAAN,KAA0BO,KAAKP,QACjCO,KAAK2B,OADH,UAEH3B,KAHC,QAIL4B,KAJK,GAKLC,MALK,EAMLC,eAAe,QAKzBC,YAlDO,WAmDD/B,KAAJ,UAAmBA,KAAKgC,YAE1BT,aArDO,WAsDAvB,KAAL,UAAoBA,KAAKgC,YAE3BC,UAxDO,SAwDE,IAEJC,EAAA,UAAc,OAAd,MAA+BlC,KAAhC,UACCkC,EAAA,UAAc,OAAd,QAAiClC,KAFpC,WAGEA,KAAKgC","file":"js/views-admin-ModifyTransaction.25df66be.js","sourcesContent":["// Styles\nimport '../../styles/components/_selection-controls.sass'\nimport './VSwitch.sass'\n\n// Mixins\nimport Selectable from '../../mixins/selectable'\nimport VInput from '../VInput'\n\n// Directives\nimport Touch from '../../directives/touch'\n\n// Components\nimport { VFabTransition } from '../transitions'\nimport VProgressCircular from '../VProgressCircular/VProgressCircular'\n\n// Helpers\nimport { keyCodes } from '../../util/helpers'\n\n// Types\nimport { VNode, VNodeData } from 'vue'\n\n/* @vue/component */\nexport default Selectable.extend({\n name: 'v-switch',\n\n directives: { Touch },\n\n props: {\n inset: Boolean,\n loading: {\n type: [Boolean, String],\n default: false,\n },\n flat: {\n type: Boolean,\n default: false,\n },\n },\n\n computed: {\n classes (): object {\n return {\n ...VInput.options.computed.classes.call(this),\n 'v-input--selection-controls v-input--switch': true,\n 'v-input--switch--flat': this.flat,\n 'v-input--switch--inset': this.inset,\n }\n },\n attrs (): object {\n return {\n 'aria-checked': String(this.isActive),\n 'aria-disabled': String(this.isDisabled),\n role: 'switch',\n }\n },\n // Do not return undefined if disabled,\n // according to spec, should still show\n // a color when disabled and active\n validationState (): string | undefined {\n if (this.hasError && this.shouldValidate) return 'error'\n if (this.hasSuccess) return 'success'\n if (this.hasColor !== null) return this.computedColor\n return undefined\n },\n switchData (): VNodeData {\n return this.setTextColor(this.loading ? undefined : this.validationState, {\n class: this.themeClasses,\n })\n },\n },\n\n methods: {\n genDefaultSlot (): (VNode | null)[] {\n return [\n this.genSwitch(),\n this.genLabel(),\n ]\n },\n genSwitch (): VNode {\n return this.$createElement('div', {\n staticClass: 'v-input--selection-controls__input',\n }, [\n this.genInput('checkbox', {\n ...this.attrs,\n ...this.attrs$,\n }),\n this.genRipple(this.setTextColor(this.validationState, {\n directives: [{\n name: 'touch',\n value: {\n left: this.onSwipeLeft,\n right: this.onSwipeRight,\n },\n }],\n })),\n this.$createElement('div', {\n staticClass: 'v-input--switch__track',\n ...this.switchData,\n }),\n this.$createElement('div', {\n staticClass: 'v-input--switch__thumb',\n ...this.switchData,\n }, [this.genProgress()]),\n ])\n },\n genProgress (): VNode {\n return this.$createElement(VFabTransition, {}, [\n this.loading === false\n ? null\n : this.$slots.progress || this.$createElement(VProgressCircular, {\n props: {\n color: (this.loading === true || this.loading === '')\n ? (this.color || 'primary')\n : this.loading,\n size: 16,\n width: 2,\n indeterminate: true,\n },\n }),\n ])\n },\n onSwipeLeft () {\n if (this.isActive) this.onChange()\n },\n onSwipeRight () {\n if (!this.isActive) this.onChange()\n },\n onKeydown (e: KeyboardEvent) {\n if (\n (e.keyCode === keyCodes.left && this.isActive) ||\n (e.keyCode === keyCodes.right && !this.isActive)\n ) this.onChange()\n },\n },\n})\n"],"sourceRoot":""}