UNPKG

@neo4j-ndl/react

Version:

React implementation of Neo4j Design System

58 lines 5.44 kB
"use strict"; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.StatusIndicator = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); /** * * Copyright (c) "Neo4j" * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ const react_1 = __importDefault(require("react")); const defaultImports_1 = require("../_common/defaultImports"); exports.StatusIndicator = react_1.default.forwardRef(function StatusIndicator(_a, ref) { var { as, className, style, type = 'unknown', htmlAttributes } = _a, restProps = __rest(_a, ["as", "className", "style", "type", "htmlAttributes"]); const classes = (0, defaultImports_1.classNames)('ndl-status-indicator', className); const Component = as || 'span'; switch (type) { case 'success': return ((0, jsx_runtime_1.jsx)(Component, Object.assign({}, restProps, { className: classes, style: style, ref: ref }, htmlAttributes, { children: (0, jsx_runtime_1.jsx)("svg", { width: "8", height: "8", viewBox: "0 0 8 8", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("circle", { cx: "4", cy: "4", r: "4", fill: "rgb(var(--theme-palette-success-bg-status))" }) }) }))); case 'info': return ((0, jsx_runtime_1.jsx)(Component, Object.assign({}, restProps, { className: classes, style: style, ref: ref }, htmlAttributes, { children: (0, jsx_runtime_1.jsx)("svg", { width: "8", height: "8", viewBox: "0 0 8 8", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("circle", { cx: "4", cy: "4", r: "4", fill: "rgb(var(--theme-palette-primary-bg-status))" }) }) }))); case 'warning': return ((0, jsx_runtime_1.jsx)(Component, Object.assign({}, restProps, { className: classes, style: style, ref: ref }, htmlAttributes, { children: (0, jsx_runtime_1.jsx)("svg", { width: "8", height: "8", viewBox: "0 0 8 8", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M4.57641 0.35903C4.52349 0.251301 4.44144 0.160559 4.33957 0.0970988C4.23769 0.0336384 4.12007 0 4.00005 0C3.88002 0 3.7624 0.0336384 3.66053 0.0970988C3.55865 0.160559 3.4766 0.251301 3.42368 0.35903L0.0554707 7.22061C0.0149262 7.30309 -0.00393024 7.39454 0.000681349 7.48633C0.00529294 7.57812 0.0332205 7.66722 0.0818275 7.74522C0.130434 7.82322 0.198117 7.88754 0.278487 7.93212C0.358856 7.9767 0.44926 8.00006 0.541165 8H7.45893C7.55083 8.00006 7.64124 7.9767 7.7216 7.93212C7.80197 7.88754 7.86966 7.82322 7.91826 7.74522C7.96687 7.66722 7.9948 7.57812 7.99941 7.48633C8.00402 7.39454 7.98517 7.30309 7.94462 7.22061L4.57641 0.35903Z", fill: "rgb(var(--theme-palette-warning-bg-status))" }) }) }))); case 'danger': return ((0, jsx_runtime_1.jsx)(Component, Object.assign({}, restProps, { className: classes, style: style, ref: ref }, htmlAttributes, { children: (0, jsx_runtime_1.jsx)("svg", { width: "8", height: "8", viewBox: "0 0 8 8", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M0.188426 4.45553C0.067771 4.33472 0 4.17097 0 4.00024C0 3.8295 0.067771 3.66575 0.188426 3.54494L3.54489 0.188838C3.6046 0.128979 3.67554 0.0814871 3.75363 0.0490833C3.83173 0.0166795 3.91545 0 4 0C4.08455 0 4.16827 0.0166795 4.24637 0.0490833C4.32446 0.0814871 4.3954 0.128979 4.45511 0.188838L7.81157 3.54494C7.93223 3.66575 8 3.8295 8 4.00024C8 4.17097 7.93223 4.33472 7.81157 4.45553L4.45511 7.81163C4.33437 7.93226 4.17068 8.00003 4 8.00003C3.82932 8.00003 3.66563 7.93226 3.54489 7.81163L0.188426 4.45553Z", fill: "rgb(var(--theme-palette-danger-bg-status))" }) }) }))); default: return ((0, jsx_runtime_1.jsx)(Component, Object.assign({}, restProps, { className: classes, style: style, ref: ref }, htmlAttributes, { children: (0, jsx_runtime_1.jsx)("svg", { width: "8", height: "8", viewBox: "0 0 8 8", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("rect", { width: "8", height: "8", rx: "1", fill: "rgb(var(--theme-palette-neutral-bg-status))" }) }) }))); } }); //# sourceMappingURL=StatusIndicator.js.map