import _extends from "@babel/runtime/helpers/esm/extends";
import React, { useMemo } from "react";
import { ChipCloseIcon, ChipContainer, ChipTrigger } from "./Styles";
import { Typography } from "../Typography/Typography";
export const Chip = /*#__PURE__*/React.forwardRef((_ref, ref) => {
  let {
    startAdornment,
    label,
    onClose,
    size = "regular",
    color,
    backgroundColor,
    closeClassName,
    typographyProps,
    ...rest
  } = _ref;
  const showClose = typeof onClose === "function";
  const variant = useMemo(() => {
    switch (size) {
      case "big":
        return "Body 1";
      case "biggest":
        return "Body 1";
      default:
        return "Caption 1";
    }
  }, [size]);
  return /*#__PURE__*/React.createElement(ChipContainer, _extends({}, rest, {
    ref: ref,
    size: size,
    showClose: showClose,
    color: color,
    backgroundColor: backgroundColor,
    "data-testid": "chip-container"
  }), startAdornment, /*#__PURE__*/React.createElement(Typography, _extends({
    variant: variant,
    "data-testid": "chip-typography",
    weight: size === "biggest" ? "medium" : "regular"
  }, typographyProps), label), showClose ? /*#__PURE__*/React.createElement(ChipTrigger, {
    size: size,
    onClick: onClose,
    className: closeClassName
  }, /*#__PURE__*/React.createElement(ChipCloseIcon, {
    fill: color ? color : "currentColor"
  })) : null);
});
Chip.displayName = "Chip";
//# sourceMappingURL=Chip.js.map