@vue-interface/sizeable
Version:
The sizeable mixin for interface components.
45 lines (44 loc) • 1.08 kB
JavaScript
import { defineComponent as e } from "vue";
const s = e({
props: {
/**
* The generic component prefix.
*/
componentPrefix: String,
/**
* The size name.
*/
size: String,
/**
* The sizable prefix. Should use to component prefix, unless the
* sizeable prefix is different than the component prefix.
*/
sizePrefix: String
},
computed: {
/**
* The computed sizeable class prefix.
*/
sizeableClassPrefix() {
return this.sizePrefix || this.componentPrefix;
},
/**
* Determines if the size already has the prefix.
*/
hasSizeablePrefix() {
return this.size === void 0 ? !1 : !!this.size.match(
new RegExp(`^${this.sizeableClassPrefix}`)
);
},
/**
* The size classes that get injected into the DOM.
*/
sizeableClass() {
return this.size ? !this.sizeableClassPrefix || this.hasSizeablePrefix ? this.size : `${this.sizeableClassPrefix}-${this.size}` : "";
}
}
});
export {
s as Sizeable
};
//# sourceMappingURL=sizeable.js.map