@rxdi/ui-kit
Version:
UI Components for building graphql-server website
76 lines • 3.34 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BadgeComponent = void 0;
const lit_html_1 = require("@rxdi/lit-html");
const settings_1 = require("../settings");
/**
* @customElement rx-badge
*/
let BadgeComponent = class BadgeComponent extends lit_html_1.LitElement {
OnUpdateFirst() {
this.options = Object.assign({ boarderRadius: 500, height: 22, fontSize: 14, minWidth: 22, color: '#FFF', background: '#1e87f0' }, this.options);
}
};
exports.BadgeComponent = BadgeComponent;
__decorate([
(0, lit_html_1.property)({ type: String }),
__metadata("design:type", String)
], BadgeComponent.prototype, "background", void 0);
__decorate([
(0, lit_html_1.property)({ type: String }),
__metadata("design:type", String)
], BadgeComponent.prototype, "color", void 0);
__decorate([
(0, lit_html_1.property)({ type: Object }),
__metadata("design:type", Object)
], BadgeComponent.prototype, "options", void 0);
__decorate([
(0, lit_html_1.property)({ type: String }),
__metadata("design:type", String)
], BadgeComponent.prototype, "palette", void 0);
exports.BadgeComponent = BadgeComponent = __decorate([
(0, lit_html_1.Component)({
selector: 'rx-badge',
template() {
var _a, _b, _c, _d, _e, _f;
return (0, lit_html_1.html) `
<style>
.badge {
box-sizing: border-box;
min-width: ${(_a = this.options) === null || _a === void 0 ? void 0 : _a.minWidth}px;
height: ${(_b = this.options) === null || _b === void 0 ? void 0 : _b.height}px;
padding: 0 5px;
border-radius: ${(_c = this.options) === null || _c === void 0 ? void 0 : _c.boarderRadius}px;
vertical-align: middle;
font-size: ${(_d = this.options) === null || _d === void 0 ? void 0 : _d.fontSize}px;
display: inline-flex;
justify-content: center;
align-items: center;
color: var(--${this.palette}-color);
background: var(--${this.palette}-bg-color);
}
</style>
<span
style=${(0, lit_html_1.styleMap)(this.palette
? {}
: {
color: this.color || ((_e = this.options) === null || _e === void 0 ? void 0 : _e.color),
background: this.background || ((_f = this.options) === null || _f === void 0 ? void 0 : _f.background),
})}
class="badge"
><slot></slot
></span>
`;
},
})
], BadgeComponent);
//# sourceMappingURL=badge.component.js.map