"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _button = _interopRequireDefault(require("@alifd/next/lib/button"));
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _icon = _interopRequireDefault(require("@alifd/next/lib/icon"));
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var React = _interopRequireWildcard(require("react"));
var _excluded = ["type", "color", "style", "title", "disabled", "text", "loading", "warning", "href", "icons", "iconSize", "iconColor", "ifIcon", "inputEl", "component"];
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var ColorfulButton = function ColorfulButton(_ref) {
  var _ref$type = _ref.type,
    type = _ref$type === void 0 ? 'primary' : _ref$type,
    color = _ref.color,
    _ref$style = _ref.style,
    style = _ref$style === void 0 ? {} : _ref$style,
    _ref$title = _ref.title,
    title = _ref$title === void 0 ? '主要按钮' : _ref$title,
    disabled = _ref.disabled,
    text = _ref.text,
    loading = _ref.loading,
    warning = _ref.warning,
    href = _ref.href,
    _ref$icons = _ref.icons,
    icons = _ref$icons === void 0 ? 'cry' : _ref$icons,
    _ref$iconSize = _ref.iconSize,
    iconSize = _ref$iconSize === void 0 ? '24px' : _ref$iconSize,
    _ref$iconColor = _ref.iconColor,
    iconColor = _ref$iconColor === void 0 ? '#000000' : _ref$iconColor,
    _ref$ifIcon = _ref.ifIcon,
    ifIcon = _ref$ifIcon === void 0 ? true : _ref$ifIcon,
    inputEl = _ref.inputEl,
    component = _ref.component,
    otherProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
  var _style = style || {};
  if (color) {
    _style.backgroundColor = color;
  }
  var _otherProps = otherProps || {};
  _otherProps.style = _style;
  inputEl = (0, React.useRef)(null);
  // // inputEl.current.style.fontSize = iconSize + 'px'

  //加监听值用法
  (0, React.useEffect)(function () {
    //只有当count的值发生变化，此函数才会执行
    // inputEl.current.style.hight = iconSize

    console.log("count change: count is " + iconSize, inputEl);
  }, [iconSize]);
  return /*#__PURE__*/React.createElement(_button["default"], (0, _extends2["default"])({
    onClick: function onClick() {
      return MouseEventHandler;
    }
  }, _otherProps, {
    href: href,
    text: text,
    warning: warning,
    loading: loading,
    component: component,
    type: type,
    disabled: disabled
  }), ifIcon ? /*#__PURE__*/React.createElement(_icon["default"], {
    className: "spanImg",
    type: icons,
    style: {
      color: iconColor
    }
  }) : '', title);
};
ColorfulButton.displayName = 'ColorfulButton';
var _default = ColorfulButton;
exports["default"] = _default;