@vidal-community/vidal-web-components
Version:
Vidal Web Components
86 lines (83 loc) • 2.79 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;
};
import { css, html, LitElement } from 'lit';
import { customElement, property } from 'lit/decorators.js';
let TimelineGroupingSelector = class TimelineGroupingSelector extends LitElement {
constructor() {
super(...arguments);
this.grouping = 'ATC';
this.switchHandler = (_groupingValue) => null;
}
render() {
const isSelected = (id) => (this.grouping === id ? 'selected' : '');
return html ` <div class="selector-container">
<span id="ATC" class="${isSelected('ATC')}" @click="${this.switch}"
>ATC</span
>
<span
id="Vidal class"
class="${isSelected('Vidal class')}"
@click="${this.switch}"
>Classe Vidal</span
>
</div>`;
}
switch(event) {
var _a;
this.grouping = ((_a = event.target.getAttribute('id')) !== null && _a !== void 0 ? _a : 'ATC');
this.switchHandler(this.grouping);
}
};
TimelineGroupingSelector.styles = css `
:host {
width: 100%;
height: 27px;
position: relative;
align-items: center;
background: white;
border-radius: 19px;
margin-left: 5px;
margin-right: 10px;
font-size: 0.8em;
}
.selector-container {
height: 100%;
width: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
border-radius: 12px;
box-shadow: rgb(0 0 0) 0px 0px 7px 0px inset;
font-family: Roboto, sans-serif;
}
.selector-container span {
width: 50%;
height: 100%;
font-weight: bold;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
border-radius: 12px;
}
.selected {
background: #434343;
color: white;
}
`;
__decorate([
property()
], TimelineGroupingSelector.prototype, "grouping", void 0);
__decorate([
property()
], TimelineGroupingSelector.prototype, "switchHandler", void 0);
TimelineGroupingSelector = __decorate([
customElement('timeline-grouping-selector')
], TimelineGroupingSelector);
export { TimelineGroupingSelector };
//# sourceMappingURL=timeline-grouping-selector.js.map