import _extends from "@babel/runtime/helpers/esm/extends";
import React, { forwardRef } from "react";
import classnames from "classnames";
import { StyledButton, StyledButtonElement, StyledButtonElements } from "./Styles";
/**
 * @component Button
 * @description
 * Button component is used to trigger an action or event, such as submitting a form,
 * opening a Dialog, canceling an action, or performing a delete operation.
 *
 * @prop {variant} - adds unique look and feel to button.
 * @prop {size} - controls the size of a button.
 * @prop {active} - adds active/pressed state to a button.
 *
 * @example
 * return (
 *   <Button className="mr-2" variant="primary" size="big">
 *     Save
 *   </Button>
 * )
 * @see
 * https://system.activecollab.com/?path=/story/components-button-indicators-button--button
 * https://design.activecollab.com/docs/components/button
 */
export const Button = /*#__PURE__*/forwardRef((_ref, ref) => {
  let {
    children,
    active = false,
    variant = "contained",
    size = "medium",
    className,
    ...args
  } = _ref;
  return /*#__PURE__*/React.createElement(StyledButton, _extends({
    className: classnames("c-btn", className, {
      "c-btn--contained": variant === "primary" || variant === "contained",
      "c-btn--outlined": variant === "secondary" || variant === "outlined",
      "c-btn--text_colored": variant === "tertiary" || variant === "text colored",
      "c-btn--text_gray": variant === "option" || variant === "text gray",
      "c-btn--dark_transparent": variant === "dark transparent",
      "c-btn--circle-raised": variant === "circle raised",
      "c-btn--big": size === "big",
      "c-btn--small": size === "small",
      "c-btn--icon-only": children instanceof Object && !(children instanceof Array)
    }),
    iconOnly: children instanceof Object && !(children instanceof Array),
    variant: variant,
    active: active,
    size: size,
    ref: ref,
    "aria-pressed": active,
    role: "button"
  }, args), children instanceof Array ? /*#__PURE__*/React.createElement(StyledButtonElements, {
    className: "c-btn__elements"
  }, children.map((value, index) => value ? /*#__PURE__*/React.createElement(StyledButtonElement, {
    className: "c-btn__elements__element",
    key: index
  }, value) : null)) : children);
});
Button.displayName = "Button";
//# sourceMappingURL=Button.js.map