@scania/tegel
Version:
Tegel Design System
27 lines (23 loc) • 2.17 kB
JavaScript
import { r as registerInstance, h, H as Host, a as getElement } from './index-9xxNGlso.js';
import { h as hasSlot } from './hasSlot-DDX6uFcm.js';
const tagCss = () => `.sc-tds-tag-h{box-sizing:border-box;display:inline-flex;align-items:center;border-radius:4px;background-color:var(--tds-tag-neutral-background);color:var(--tds-tag-neutral-color);gap:4px}.sc-tds-tag-h *.sc-tds-tag{box-sizing:border-box}.lg.sc-tds-tag-h{padding:4px}.sm.sc-tds-tag-h{border-radius:2px;padding:2px 4px;font:var(--tds-detail-05)}.success.sc-tds-tag-h{background-color:var(--tds-tag-success-background);color:var(--tds-tag-success-color)}.warning.sc-tds-tag-h{background-color:var(--tds-tag-warning-background);color:var(--tds-tag-warning-color)}.new.sc-tds-tag-h{background-color:var(--tds-tag-new-background);color:var(--tds-tag-new-color)}.neutral.sc-tds-tag-h{background-color:var(--tds-tag-neutral-background);color:var(--tds-tag-neutral-color)}.information.sc-tds-tag-h{background-color:var(--tds-tag-information-background);color:var(--tds-tag-information-color)}.error.sc-tds-tag-h{background-color:var(--tds-tag-error-background);color:var(--tds-tag-error-color)}.tds-tag__content.sc-tds-tag{display:flex;align-items:center;gap:inherit}`;
const TdsTag = class {
constructor(hostRef) {
registerInstance(this, hostRef);
/** Sets the size of the tag */
this.size = 'lg';
/** Sets the variant mode of the tag */
this.variant = 'Neutral';
}
render() {
const hasPrefixSlot = hasSlot('prefix', this.host);
const getTagClasses = () => ({
[`${this.size.toLowerCase()}`]: true,
[this.variant.toLowerCase()]: true,
});
return (h(Host, { key: '6e014440b1933df324129ccb7ee25a4e6e28f7f5', class: getTagClasses() }, h("div", { key: '14605f18833dc92370646302cf0fd10106ae8600', class: "tds-tag__content" }, hasPrefixSlot && h("slot", { key: 'f6f426e202bee36eb53fc35b132b216ab74d7b6f', name: "prefix" }), h("span", { key: '15c5d2b25241ef26fe71ba37d2f16e3b0d88a9ce' }, this.text))));
}
get host() { return getElement(this); }
};
TdsTag.style = tagCss();
export { TdsTag as tds_tag };