UNPKG

@scania/tegel

Version:
29 lines (24 loc) 2.18 kB
'use strict'; var index = require('./index-DGsdvbvx.js'); var hasSlot = require('./hasSlot-D-DVNhGg.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) { index.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.hasSlot('prefix', this.host); const getTagClasses = () => ({ [`${this.size.toLowerCase()}`]: true, [this.variant.toLowerCase()]: true, }); return (index.h(index.Host, { key: '6e014440b1933df324129ccb7ee25a4e6e28f7f5', class: getTagClasses() }, index.h("div", { key: '14605f18833dc92370646302cf0fd10106ae8600', class: "tds-tag__content" }, hasPrefixSlot && index.h("slot", { key: 'f6f426e202bee36eb53fc35b132b216ab74d7b6f', name: "prefix" }), index.h("span", { key: '15c5d2b25241ef26fe71ba37d2f16e3b0d88a9ce' }, this.text)))); } get host() { return index.getElement(this); } }; TdsTag.style = tagCss(); exports.tds_tag = TdsTag;