UNPKG

@vidal-community/vidal-web-components

Version:

Vidal Web Components

96 lines (93 loc) 3.1 kB
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 { html, LitElement, css } from 'lit'; import { customElement, property } from 'lit/decorators.js'; let TimelineDrugDisplayModeSelector = class TimelineDrugDisplayModeSelector extends LitElement { constructor() { super(...arguments); this.grouping = 'molecule'; this.onClickHandler = () => null; } render() { this.style.width = this.width; const className = (id) => (this.grouping === id ? 'selected' : ''); return html ` <div class="selector-container"> <span id="molecule" class="${className('molecule')}" @click="${this.switch}" >Substance</span > <span id="prescribable" class="${className('prescribable')}" @click="${this.switch}" >Prescriptible</span > <span id="VMP" class="${className('VMP')}" @click="${this.switch}" >Médicament Virtuel</span > </div>`; } switch(event) { const element = event.target; const id = element.getAttribute('id'); this.grouping = id; this.onClickHandler(event); } }; TimelineDrugDisplayModeSelector.styles = css ` :host { display: flex; width: 66%; height: 27px; position: relative; align-items: center; background: white; border-radius: 19px; 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: 30%; 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() ], TimelineDrugDisplayModeSelector.prototype, "width", void 0); __decorate([ property() ], TimelineDrugDisplayModeSelector.prototype, "grouping", void 0); __decorate([ property() ], TimelineDrugDisplayModeSelector.prototype, "onClickHandler", void 0); TimelineDrugDisplayModeSelector = __decorate([ customElement('timeline-drug-display-mode-selector') ], TimelineDrugDisplayModeSelector); export { TimelineDrugDisplayModeSelector }; //# sourceMappingURL=timeline-drug-display-mode-selector.js.map