import { WebComponent, html } from 'web-component-base'
type StatusType = 'default' | 'active' | 'positive' | 'intermediary' | 'negative'
class StatusIndicator extends WebComponent {
static shadowRootInit: ShadowRootInit = {
mode: 'closed'
}
static props = {
status: 'default',
pulse: false
}
#indicatorColor: Record = {
default: '216, 226, 233',
active: '0, 149, 255',
positive: '75, 210, 143',
intermediary: '255, 170, 0',
negative: '255, 77, 77'
}
#pulseAnimationCSSRules: Partial = {
animationName: 'pulse',
animationDuration: '2s',
animationTimingFunction: 'ease-in-out',
animationIterationCount: 'infinite',
animationDelay: '0',
animationFillMode: 'none'
}
get template(): any {
// @ts-ignore: Needs fixing on the base class
const statusColor = this.#indicatorColor[this.props.status]
return html`
${
/** if pulse is set, add animation keyframes */
this.props.pulse ? html`
`
:
''
}`
}
}
customElements.define('status-indicator', StatusIndicator)
export default StatusIndicator