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EL,UAAA,IAAI,EAAE,EAFD;AAGL,UAAA,KAAK,EAAE;AAHF;AADwD,OAAvC,CAAD,CAFlB,CAAP;AASD;AArBM,GAjHwC;AAyIjD,EAAA,MAzIiD,kBAyIzC,CAzIyC,EAyIxC;AACP,QAAM,QAAQ,GAAG,CACf,KAAK,UAAL,EADe,EAEf,KAAK,OAAL,IAAgB,KAAK,SAAL,EAFD,CAAjB;AAIA,QAAM,QAAQ,GAAG,CAAC,KAAK,MAAN,GAAe,KAAK,kBAApB,GAAyC,KAAK,YAA/D;;AALO,gCAMe,KAAK,iBAAL,EANf;AAAA,QAMC,GAND,yBAMC,GAND;AAAA,QAMM,IANN,yBAMM,IANN;;AAQP,QAAI,GAAG,KAAK,QAAZ,EAAsB;AACpB,MAAA,IAAI,CAAC,KAAL,CAAY,IAAZ,GAAmB,KAAK,IAAxB;AACA,MAAA,IAAI,CAAC,KAAL,CAAY,QAAZ,GAAuB,KAAK,QAA5B;AACD;;AACD,IAAA,IAAI,CAAC,KAAL,CAAY,KAAZ,GAAoB,CAAC,QAAD,EAAW,QAAX,EAAqB,QAArB,SAAqC,KAAK,KAA1C,KAChB,KAAK,KADW,GAEhB,IAAI,CAAC,SAAL,CAAe,KAAK,KAApB,CAFJ;AAIA,WAAO,CAAC,CAAC,GAAD,EAAM,QAAQ,CAAC,KAAK,KAAN,EAAa,IAAb,CAAd,EAAkC,QAAlC,CAAR;AACD;AA1JgD,CAApC,C","sourcesContent":["// Styles\nimport './VBtn.sass'\n\n// Extensions\nimport VSheet from '../VSheet'\n\n// Components\nimport VProgressCircular from '../VProgressCircular'\n\n// Mixins\nimport { factory as GroupableFactory } from '../../mixins/groupable'\nimport { factory as ToggleableFactory } from '../../mixins/toggleable'\nimport Positionable from '../../mixins/positionable'\nimport Routable from '../../mixins/routable'\nimport Sizeable from '../../mixins/sizeable'\n\n// Utilities\nimport mixins, { ExtractVue } from '../../util/mixins'\nimport { breaking } from '../../util/console'\n\n// Types\nimport { VNode } from 'vue'\nimport { PropValidator } from 'vue/types/options'\nimport { RippleOptions } from '../../directives/ripple'\n\nconst baseMixins = mixins(\n VSheet,\n Routable,\n Positionable,\n Sizeable,\n GroupableFactory('btnToggle'),\n ToggleableFactory('inputValue')\n /* @vue/component */\n)\ninterface options extends ExtractVue<typeof baseMixins> {\n $el: HTMLElement\n}\n\nexport default baseMixins.extend<options>().extend({\n name: 'v-btn',\n\n props: {\n activeClass: {\n type: String,\n default (): string | undefined {\n if (!this.btnToggle) return ''\n\n return this.btnToggle.activeClass\n },\n } as any as PropValidator<string>,\n block: Boolean,\n depressed: Boolean,\n fab: Boolean,\n icon: Boolean,\n loading: Boolean,\n outlined: Boolean,\n rounded: Boolean,\n tag: {\n type: String,\n default: 'button',\n },\n text: Boolean,\n type: {\n type: String,\n default: 'button',\n },\n value: null as any as PropValidator<any>,\n },\n\n data: () => ({\n proxyClass: 'v-btn--active',\n }),\n\n computed: {\n classes (): any {\n return {\n 'v-btn': true,\n ...Routable.options.computed.classes.call(this),\n 'v-btn--absolute': this.absolute,\n 'v-btn--block': this.block,\n 'v-btn--bottom': this.bottom,\n 'v-btn--contained': this.contained,\n 'v-btn--depressed': (this.depressed) || this.outlined,\n 'v-btn--disabled': this.disabled,\n 'v-btn--fab': this.isRound,\n 'v-btn--fixed': this.fixed,\n 'v-btn--flat': this.isFlat,\n 'v-btn--icon': this.icon,\n 'v-btn--left': this.left,\n 'v-btn--loading': this.loading,\n 'v-btn--outlined': this.outlined,\n 'v-btn--right': this.right,\n 'v-btn--round': this.isRound,\n 'v-btn--rounded': this.rounded,\n 'v-btn--router': this.to,\n 'v-btn--text': this.text,\n 'v-btn--tile': this.tile,\n 'v-btn--top': this.top,\n ...this.themeClasses,\n ...this.groupClasses,\n ...this.elevationClasses,\n ...this.sizeableClasses,\n }\n },\n contained (): boolean {\n return Boolean(\n !this.isFlat &&\n !this.depressed &&\n // Contained class only adds elevation\n // is not needed if user provides value\n !this.elevation\n )\n },\n computedRipple (): RippleOptions | boolean {\n const defaultRipple = this.icon || this.fab ? { circle: true } : true\n if (this.disabled) return false\n else return this.ripple != null ? this.ripple : defaultRipple\n },\n isFlat (): boolean {\n return Boolean(\n this.icon ||\n this.text ||\n this.outlined\n )\n },\n isRound (): boolean {\n return Boolean(\n this.icon ||\n this.fab\n )\n },\n styles (): object {\n return {\n ...this.measurableStyles,\n }\n },\n },\n\n created () {\n const breakingProps = [\n ['flat', 'text'],\n ['outline', 'outlined'],\n ['round', 'rounded'],\n ]\n\n /* istanbul ignore next */\n breakingProps.forEach(([original, replacement]) => {\n if (this.$attrs.hasOwnProperty(original)) breaking(original, replacement, this)\n })\n },\n\n methods: {\n click (e: MouseEvent): void {\n this.$emit('click', e)\n\n this.btnToggle && this.toggle()\n },\n genContent (): VNode {\n return this.$createElement('span', {\n staticClass: 'v-btn__content',\n }, this.$slots.default)\n },\n genLoader (): VNode {\n return this.$createElement('span', {\n class: 'v-btn__loader',\n }, this.$slots.loader || [this.$createElement(VProgressCircular, {\n props: {\n indeterminate: true,\n size: 23,\n width: 2,\n },\n })])\n },\n },\n\n render (h): VNode {\n const children = [\n this.genContent(),\n this.loading && this.genLoader(),\n ]\n const setColor = !this.isFlat ? this.setBackgroundColor : this.setTextColor\n const { tag, data } = this.generateRouteLink()\n\n if (tag === 'button') {\n data.attrs!.type = this.type\n data.attrs!.disabled = this.disabled\n }\n data.attrs!.value = ['string', 'number'].includes(typeof this.value)\n ? this.value\n : JSON.stringify(this.value)\n\n return h(tag, setColor(this.color, data), children)\n },\n})\n"],"sourceRoot":"","file":"VBtn.js"} |