"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TypeBadge = void 0;
var _react = _interopRequireDefault(require("react"));
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/*
 * Copyright OpenSearch Contributors
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * Colored pill badge with an optional icon and label.
 * Uses a pastel background derived from the color with the text in the full color.
 */
const TypeBadge = ({
  label,
  color,
  icon,
  textColor
}) => /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
  className: "osd:inline-flex osd:items-center osd:gap-1 osd:px-2 osd:py-0.5 osd:rounded-full osd:text-xs osd:font-semibold osd:leading-none",
  style: {
    backgroundColor: `color-mix(in srgb, ${color} 15%, transparent)`,
    color: textColor !== null && textColor !== void 0 ? textColor : color
  },
  children: [icon && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
    className: "osd:flex osd:items-center osd:w-3 osd:h-3",
    children: icon
  }), label]
});
exports.TypeBadge = TypeBadge;