import _extends from "@babel/runtime/helpers/esm/extends";
import React, { forwardRef } from "react";
import classNames from "classnames";
import { StyledBadge, StyledCounterButton, StyledCounterButtonLabel, StyledCounterButtonReset, StyledCounterButtonWrapper } from "./Styles";
import CloseSmallIcon from "../Icons/collection/CloseSmall";
import { Tooltip } from "../Tooltip/Tooltip";
export const CounterButton = /*#__PURE__*/forwardRef((_ref, ref) => {
  let {
    label,
    icon,
    active,
    counter = 0,
    tooltipText,
    onClearAll,
    className,
    labelClassName,
    disabled = false,
    ...args
  } = _ref;
  return /*#__PURE__*/React.createElement(StyledCounterButtonWrapper, {
    ref: ref,
    className: className
  }, /*#__PURE__*/React.createElement(StyledCounterButton, _extends({
    disabled: disabled,
    "aria-disabled": disabled,
    className: classNames("c-counter-button", {
      "c-counter-button__selected": counter
    })
  }, args, {
    variant: "text gray",
    $active: counter > 0 || active,
    $selected: counter > 0
  }), icon && /*#__PURE__*/React.cloneElement(icon, {
    className: classNames("c-counter-button__icon")
  }), label && /*#__PURE__*/React.createElement(StyledCounterButtonLabel, {
    color: "secondary",
    weight: "medium",
    className: classNames("c-counter-button__label", labelClassName),
    $active: counter > 0 || active
  }, label), counter > 0 ? /*#__PURE__*/React.createElement(StyledBadge, {
    isStandalone: true,
    dimension: 16,
    value: counter
  }) : null), counter > 0 ? /*#__PURE__*/React.createElement(Tooltip, {
    title: "" + tooltipText,
    popperTooltipClassName: "z-index-1300"
  }, /*#__PURE__*/React.createElement(StyledCounterButtonReset, {
    variant: "text colored",
    className: "c-counter-button__reset",
    onClick: onClearAll
  }, /*#__PURE__*/React.createElement(CloseSmallIcon, null))) : null);
});
CounterButton.displayName = "CounterButton";
//# sourceMappingURL=CounterButton.js.map