text: "use strict";
  var __assign = (this && this.__assign) || function () {
      __assign = Object.assign || function(t) {
          for (var s, i = 1, n = arguments.length; i < n; i++) {
              s = arguments[i];
              for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                  t[p] = s[p];
          }
          return t;
      };
      return __assign.apply(this, arguments);
  };
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
      if (k2 === undefined) k2 = k;
      Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  }) : (function(o, m, k, k2) {
      if (k2 === undefined) k2 = k;
      o[k2] = m[k];
  }));
  var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
  }) : function(o, v) {
      o["default"] = v;
  });
  var __importStar = (this && this.__importStar) || function (mod) {
      if (mod && mod.__esModule) return mod;
      var result = {};
      if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
      __setModuleDefault(result, mod);
      return result;
  };
  var __rest = (this && this.__rest) || function (s, e) {
      var t = {};
      for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
          t[p] = s[p];
      if (s != null && typeof Object.getOwnPropertySymbols === "function")
          for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
              if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                  t[p[i]] = s[p[i]];
          }
      return t;
  };
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  /* eslint-disable react/button-has-type */
  var react_1 = __importStar(require("react"));
  var states_1 = require("@react-md/states");
  var buttonThemeClassNames_1 = __importDefault(require("./buttonThemeClassNames"));
  var FAB_1 = __importDefault(require("./FAB"));
  /**
   * The `Button` component is a simple wrapper for the `<button>` element that
   * defaults the `type` attribute to `"button"` so that it does not automatically
   * submit forms by default. It also supports multiple themes, rendering as an
   * icon button, or even as a floating action button.
   *
   * The default theme will be a clear text button unless the `floating` prop has
   * been provided where it will render as an icon button by default instead.
   */
  var Button = react_1.forwardRef(function Button(_a, ref) {
      var _b = _a.type, type = _b === void 0 ? "button" : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.floating, floating = _d === void 0 ? null : _d, floatingProps = _a.floatingProps, _e = _a.theme, theme = _e === void 0 ? floating ? "secondary" : "clear" : _e, _f = _a.themeType, themeType = _f === void 0 ? floating ? "contained" : "flat" : _f, _g = _a.buttonType, buttonType = _g === void 0 ? floating ? "icon" : "text" : _g, propClassName = _a.className, children = _a.children, disableRipple = _a.disableRipple, disableProgrammaticRipple = _a.disableProgrammaticRipple, rippleTimeout = _a.rippleTimeout, rippleClassNames = _a.rippleClassNames, rippleClassName = _a.rippleClassName, rippleContainerClassName = _a.rippleContainerClassName, propEnablePressedAndRipple = _a.enablePressedAndRipple, disablePressedFallback = _a.disablePressedFallback, onClick = _a.onClick, onKeyUp = _a.onKeyUp, onKeyDown = _a.onKeyDown, onMouseUp = _a.onMouseUp, onMouseDown = _a.onMouseDown, onMouseLeave = _a.onMouseLeave, onTouchStart = _a.onTouchStart, onTouchMove = _a.onTouchMove, onTouchEnd = _a.onTouchEnd, props = __rest(_a, ["type", "disabled", "floating", "floatingProps", "theme", "themeType", "buttonType", "className", "children", "disableRipple", "disableProgrammaticRipple", "rippleTimeout", "rippleClassNames", "rippleClassName", "rippleContainerClassName", "enablePressedAndRipple", "disablePressedFallback", "onClick", "onKeyUp", "onKeyDown", "onMouseUp", "onMouseDown", "onMouseLeave", "onTouchStart", "onTouchMove", "onTouchEnd"]);
      var enablePressedAndRipple = typeof propEnablePressedAndRipple === "boolean"
          ? propEnablePressedAndRipple
          : themeType === "contained";
      var propHandlers = {
          onClick: onClick,
          onKeyUp: onKeyUp,
          onKeyDown: onKeyDown,
          onMouseUp: onMouseUp,
          onMouseDown: onMouseDown,
          onMouseLeave: onMouseLeave,
          onTouchStart: onTouchStart,
          onTouchMove: onTouchMove,
          onTouchEnd: onTouchEnd,
      };
      var isDisabledTheme = theme === "disabled";
      var _h = states_1.useInteractionStates({
          handlers: propHandlers,
          className: buttonThemeClassNames_1.default({
              theme: theme,
              themeType: themeType,
              buttonType: buttonType,
              disabled: disabled,
              className: propClassName,
          }),
          disabled: disabled || isDisabledTheme,
          disableRipple: disableRipple,
          disableProgrammaticRipple: disableProgrammaticRipple,
          disablePressedFallback: disablePressedFallback,
          rippleTimeout: rippleTimeout,
          rippleClassNames: rippleClassNames,
          rippleClassName: rippleClassName,
          rippleContainerClassName: rippleContainerClassName,
          enablePressedAndRipple: enablePressedAndRipple,
      }), ripples = _h.ripples, className = _h.className, handlers = _h.handlers;
      return (react_1.default.createElement(FAB_1.default, __assign({ position: floating }, floatingProps),
          react_1.default.createElement("button", __assign({ "aria-disabled": isDisabledTheme || undefined }, props, (isDisabledTheme ? undefined : handlers), { ref: ref, type: type, className: className, disabled: disabled }),
              children,
              ripples)));
  });
  if (process.env.NODE_ENV !== "production") {
      try {
          var PropTypes = require("prop-types");
          Button.propTypes = {
              type: PropTypes.oneOf(["button", "reset", "submit"]),
              className: PropTypes.string,
              theme: PropTypes.oneOf([
                  "clear",
                  "primary",
                  "secondary",
                  "warning",
                  "error",
                  "disabled",
              ]),
              themeType: PropTypes.oneOf(["flat", "outline", "contained"]),
              buttonType: PropTypes.oneOf(["text", "icon"]),
              disabled: PropTypes.bool,
              children: PropTypes.node,
              disableRipple: PropTypes.bool,
              disableProgrammaticRipple: PropTypes.bool,
              disablePressedFallback: PropTypes.bool,
              rippleTimeout: PropTypes.oneOfType([
                  PropTypes.number,
                  PropTypes.shape({
                      appear: PropTypes.number,
                      enter: PropTypes.number,
                      exit: PropTypes.number,
                  }),
              ]),
              rippleClassNames: PropTypes.oneOfType([
                  PropTypes.string,
                  PropTypes.shape({
                      appear: PropTypes.string,
                      appearActive: PropTypes.string,
                      enter: PropTypes.string,
                      enterActive: PropTypes.string,
                      enterDone: PropTypes.string,
                      exit: PropTypes.string,
                      exitActive: PropTypes.string,
                      exitDone: PropTypes.string,
                  }),
              ]),
              rippleClassName: PropTypes.string,
              rippleContainerClassName: PropTypes.string,
              enablePressedAndRipple: PropTypes.bool,
              floating: PropTypes.oneOf([
                  "top-left",
                  "top-right",
                  "bottom-left",
                  "bottom-right",
              ]),
              floatingProps: PropTypes.object,
              onClick: PropTypes.func,
              onKeyUp: PropTypes.func,
              onKeyDown: PropTypes.func,
              onMouseUp: PropTypes.func,
              onMouseDown: PropTypes.func,
              onMouseLeave: PropTypes.func,
              onTouchStart: PropTypes.func,
              onTouchMove: PropTypes.func,
              onTouchEnd: PropTypes.func,
          };
      }
      catch (e) { }
  }
  exports.default = Button;
  //# sourceMappingURL=Button.js.map