@railzai/railz-visualizations
Version:
Railz.ai Visualizations
69 lines (64 loc) • 2.48 kB
JavaScript
/*!
* Accounting Data as a Service™ is the solution that makes sense of your business customers' financial data.
* Built with Stencil
* Copyright (c) FIS.
*/
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
/**
* Checks if `value` is `null`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `null`, else `false`.
* @example
*
* _.isNull(null);
* // => true
*
* _.isNull(void 0);
* // => false
*/
function isNull(value) {
return value === null;
}
const percentageCss = "@font-face{font-family:Inter;src:url(\"../assets/fonts/Inter-italic-var.woff2\");font-family:Inter;src:url(\"../assets/fonts/Inter-upright-var.woff2\")}body,div[class^=railz-],div[class*=\" railz-\"]{font-family:Inter, Roboto, -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}.rv-percentage{line-height:1.5;display:flex;font-size:14px;font-weight:500}.rv-percentage .rv-positive{color:#006037}.rv-percentage .rv-negative{color:#b30000}";
const Percentage = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
constructor() {
super();
this.__registerHost();
this.__attachShadow();
/**
* Percentage to show
*/
this.percentage = 0;
}
render() {
var _a, _b;
if (isNull(this.percentage) || this.percentage === 0) {
return null;
}
return (h("div", { class: "rv-percentage" }, this.percentage > 0 ? (h("div", { class: "rv-positive", style: (_a = this.percentageStyle) === null || _a === void 0 ? void 0 : _a.positive }, "\u25B2 ", this.percentage, "%")) : (h("div", { class: "rv-negative", style: (_b = this.percentageStyle) === null || _b === void 0 ? void 0 : _b.negative }, "\u25BC ", this.percentage, "%"))));
}
static get style() { return percentageCss; }
}, [1, "railz-percentage", {
"percentage": [2],
"percentageStyle": [16]
}]);
function defineCustomElement() {
if (typeof customElements === "undefined") {
return;
}
const components = ["railz-percentage"];
components.forEach(tagName => { switch (tagName) {
case "railz-percentage":
if (!customElements.get(tagName)) {
customElements.define(tagName, Percentage);
}
break;
} });
}
export { Percentage as P, defineCustomElement as d };
//# sourceMappingURL=percentage.js.map