76 lines
2.6 KiB
JavaScript

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
import '../../../src/stylus/components/_chips.styl';
import mixins from '../../util/mixins';
// Components
import VIcon from '../VIcon';
// Mixins
import Colorable from '../../mixins/colorable';
import Themeable from '../../mixins/themeable';
import Toggleable from '../../mixins/toggleable';
/* @vue/component */
export default mixins(Colorable, Themeable, Toggleable).extend({
name: 'v-chip',
props: {
close: Boolean,
disabled: Boolean,
label: Boolean,
outline: Boolean,
// Used for selects/tagging
selected: Boolean,
small: Boolean,
textColor: String,
value: {
type: Boolean,
default: true
}
},
computed: {
classes: function classes() {
return _extends({
'v-chip--disabled': this.disabled,
'v-chip--selected': this.selected && !this.disabled,
'v-chip--label': this.label,
'v-chip--outline': this.outline,
'v-chip--small': this.small,
'v-chip--removable': this.close
}, this.themeClasses);
}
},
methods: {
genClose: function genClose(h) {
var _this = this;
var data = {
staticClass: 'v-chip__close',
on: {
click: function click(e) {
e.stopPropagation();
_this.$emit('input', false);
}
}
};
return h('div', data, [h(VIcon, '$vuetify.icons.delete')]);
},
genContent: function genContent(h) {
return h('span', {
staticClass: 'v-chip__content'
}, [this.$slots.default, this.close && this.genClose(h)]);
}
},
render: function render(h) {
var data = this.setBackgroundColor(this.color, {
staticClass: 'v-chip',
'class': this.classes,
attrs: { tabindex: this.disabled ? -1 : 0 },
directives: [{
name: 'show',
value: this.isActive
}],
on: this.$listeners
});
var color = this.textColor || this.outline && this.color;
return h('span', this.setTextColor(color, data), [this.genContent(h)]);
}
});
//# sourceMappingURL=VChip.js.map