UNPKG

gov-gui

Version:

Gov UI Component Library Typscript Build

224 lines (223 loc) 7.3 kB
import { h } from "@stencil/core"; import { getGlobalPropsClasses } from "../../global/global-styles-helper"; import { getAnimationClasses } from "../../global/animation-helpers"; export class GovBadge { constructor() { this.variant = 'success'; this.animationDelay = '2s'; this.allClasses = ''; } // inject the global styles on component load componentWillLoad() { const animationClasses = getAnimationClasses({ animation: this.animation, animationDelay: this.animationDelay, animationSpeed: this.animationSpeed }); this.allClasses = getGlobalPropsClasses({ classes: this.classes + ' ' + animationClasses, variant: this.variant, size: this.size }); } //watching for any change in animations to trigger them watchAnimations() { this.provideClass(); } watchAnimationsDelay() { this.provideClass(); } watchAnimationsSpeed() { this.provideClass(); } handleSize() { this.provideClass(); } watchVisibility() { this.provideClass(); } provideClass() { const animationClasses = getAnimationClasses({ animation: this.animation, animationDelay: this.animationDelay, animationSpeed: this.animationSpeed }); this.allClasses = getGlobalPropsClasses({ classes: this.classes + ' ' + animationClasses, variant: this.variant, size: this.size }); } render() { return (h("div", { key: '694a9f0c3cb3940e82ab276f048395c4d454e019', class: `badge round border-white border bw-2 d-inline-flex align-center justify-center ${this.allClasses || ''}`, style: Object.assign({}, this.styles) }, h("slot", { key: '3af79f1f5cab78c67176826e8c9291ba64ec3499' }))); } static get is() { return "gov-badge"; } static get encapsulation() { return "shadow"; } static get originalStyleUrls() { return { "$": ["gov-badge.css"] }; } static get styleUrls() { return { "$": ["gov-badge.css"] }; } static get properties() { return { "classes": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [], "text": "" }, "getter": false, "setter": false, "attribute": "classes", "reflect": false }, "styles": { "type": "unknown", "mutable": false, "complexType": { "original": "{ [key: string]: string }", "resolved": "{ [key: string]: string; }", "references": {} }, "required": false, "optional": true, "docs": { "tags": [], "text": "" }, "getter": false, "setter": false }, "variant": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [], "text": "" }, "getter": false, "setter": false, "attribute": "variant", "reflect": false, "defaultValue": "'success'" }, "size": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [], "text": "" }, "getter": false, "setter": false, "attribute": "size", "reflect": false }, "animation": { "type": "string", "mutable": false, "complexType": { "original": "string", "resolved": "string", "references": {} }, "required": false, "optional": true, "docs": { "tags": [], "text": "" }, "getter": false, "setter": false, "attribute": "animation", "reflect": false }, "animationDelay": { "type": "string", "mutable": false, "complexType": { "original": "'2s' | '3s' | '4s' | '5s'", "resolved": "\"2s\" | \"3s\" | \"4s\" | \"5s\"", "references": {} }, "required": false, "optional": true, "docs": { "tags": [], "text": "" }, "getter": false, "setter": false, "attribute": "animation-delay", "reflect": false, "defaultValue": "'2s'" }, "animationSpeed": { "type": "string", "mutable": false, "complexType": { "original": "'slow' | 'slower' | 'fast' | 'faster'", "resolved": "\"fast\" | \"faster\" | \"slow\" | \"slower\"", "references": {} }, "required": false, "optional": true, "docs": { "tags": [], "text": "" }, "getter": false, "setter": false, "attribute": "animation-speed", "reflect": false } }; } static get elementRef() { return "el"; } static get watchers() { return [{ "propName": "animation", "methodName": "watchAnimations" }, { "propName": "animationDelay", "methodName": "watchAnimationsDelay" }, { "propName": "animationSpeed", "methodName": "watchAnimationsSpeed" }, { "propName": "size", "methodName": "handleSize" }, { "propName": "variant", "methodName": "watchVisibility" }]; } } //# sourceMappingURL=gov-badge.js.map