"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Button = void 0;
var _react = _interopRequireWildcard(require("react"));
var _classnames = _interopRequireDefault(require("classnames"));
var _Styles = require("./Styles");
var _excluded = ["children", "active", "variant", "size", "className"];
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
/**
 * @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
 */
var Button = exports.Button = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
  var children = _ref.children,
    _ref$active = _ref.active,
    active = _ref$active === void 0 ? false : _ref$active,
    _ref$variant = _ref.variant,
    variant = _ref$variant === void 0 ? "contained" : _ref$variant,
    _ref$size = _ref.size,
    size = _ref$size === void 0 ? "medium" : _ref$size,
    className = _ref.className,
    args = _objectWithoutProperties(_ref, _excluded);
  return /*#__PURE__*/_react.default.createElement(_Styles.StyledButton, _extends({
    className: (0, _classnames.default)("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.default.createElement(_Styles.StyledButtonElements, {
    className: "c-btn__elements"
  }, children.map(function (value, index) {
    return value ? /*#__PURE__*/_react.default.createElement(_Styles.StyledButtonElement, {
      className: "c-btn__elements__element",
      key: index
    }, value) : null;
  })) : children);
});
Button.displayName = "Button";
//# sourceMappingURL=Button.js.map