UNPKG

@navinc/base-react-components

Version:
81 lines 3.54 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; 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; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Pill = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); const styled_components_1 = __importStar(require("styled-components")); const neutralStyles = (0, styled_components_1.css) ` color: ${({ theme }) => theme.neutral400}; background: ${({ theme }) => theme.neutral200}; `; const positiveStyles = (0, styled_components_1.css) ` color: ${({ theme }) => theme.seaturtleGreen200}; background: ${({ theme }) => theme.seaturtleGreen100}; `; const informationStyles = (0, styled_components_1.css) ` color: ${({ theme }) => theme.navBlue}; background: ${({ theme }) => theme.lightBlue200}; `; const negativeStyles = (0, styled_components_1.css) ` color: ${({ theme }) => theme.sebastianRed200}; background: ${({ theme }) => theme.sebastianRed100}; `; const variantStylesMap = { neutral: neutralStyles, positive: positiveStyles, information: informationStyles, negative: negativeStyles, }; const variantStyles = ({ variant }) => variantStylesMap[variant]; const Span = styled_components_1.default.span.withConfig({ displayName: "brc-sc-Span", componentId: "brc-sc-ric8us" }) ` font-family: ${({ theme }) => theme.fontPrimary}; font-size: 12px; font-weight: bold; padding: 8px 12px; text-align: center; line-height: 1.5; border-radius: 16px; ${variantStyles} `; const Pill = (_a) => { var { label, variant, name, id } = _a, rest = __rest(_a, ["label", "variant", "name", "id"]); const testID = `pill:${label}`; return ((0, jsx_runtime_1.jsx)(Span, Object.assign({ "data-testid": testID, variant: variant, name: name !== null && name !== void 0 ? name : testID, id: id !== null && id !== void 0 ? id : testID }, rest, { children: label }))); }; exports.Pill = Pill; const StyledPill = (0, styled_components_1.default)(exports.Pill).withConfig({ displayName: "brc-sc-StyledPill", componentId: "brc-sc-1etjyq1" }) ``; exports.default = StyledPill; //# sourceMappingURL=pill.js.map