"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _react = _interopRequireWildcard(require("react"));
var _Ellipsis = _interopRequireDefault(require("../common/Ellipsis"));
var _generateDataAttr = require("../utils/generateDataAttr");
var _TextButtonSt = require("./TextButton.st.css.js");
var _ButtonCore = _interopRequireDefault(require("../Button/ButtonCore"));
var _excluded = ["skin", "underline", "weight", "size", "children", "className", "dataHook", "fluid", "wrap", "ellipsis", "showTooltip", "tooltipProps", "ariaLabel", "ariaLabelledBy", "ariaHaspopup", "ariaExpanded", "ariaControls", "ariaActiveDescendant"];
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/TextButton/TextButton.tsx";
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
class TextButton extends _react.PureComponent {
  constructor() {
    super(...arguments);
    this.button = /*#__PURE__*/_react.default.createRef();
    /**
     * Sets focus on the element
     */
    this.focus = () => {
      this.button.current && this.button.current.focus();
    };
  }
  render() {
    var _this$props = this.props,
      {
        skin,
        underline,
        weight,
        size,
        children,
        className,
        dataHook,
        fluid,
        wrap,
        ellipsis,
        showTooltip,
        tooltipProps,
        ariaLabel,
        ariaLabelledBy,
        ariaHaspopup,
        ariaExpanded,
        ariaControls,
        ariaActiveDescendant
      } = _this$props,
      rest = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
    return /*#__PURE__*/_react.default.createElement(_Ellipsis.default, (0, _extends2.default)({
      ellipsis: ellipsis,
      showTooltip: showTooltip
    }, tooltipProps, {
      render: _ref => {
        var {
          ref,
          ellipsisClasses
        } = _ref;
        return /*#__PURE__*/_react.default.createElement(_ButtonCore.default, (0, _extends2.default)({
          "aria-label": ariaLabel,
          "aria-labelledby": ariaLabelledBy,
          "aria-haspopup": ariaHaspopup,
          "aria-expanded": ariaExpanded,
          "aria-controls": ariaControls,
          "aria-activedescendant": ariaActiveDescendant
        }, rest, (0, _generateDataAttr.generateDataAttr)(this.props, ['skin', 'size', 'weight', 'underline']), {
          ref: this.button,
          className: (0, _TextButtonSt.st)(_TextButtonSt.classes.root, {
            skin,
            underline,
            weight,
            size,
            fluid,
            wrap,
            ellipsis
          }, className),
          "data-hook": dataHook,
          contentClassName: ellipsisClasses(),
          contentRef: ref,
          __self: this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 59,
            columnNumber: 11
          }
        }), children);
      },
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 54,
        columnNumber: 7
      }
    }));
  }
}
TextButton.displayName = 'TextButton';
TextButton.defaultProps = {
  skin: 'standard',
  underline: 'none',
  size: 'medium',
  disabled: false,
  fluid: false,
  wrap: false,
  tooltipProps: {}
};
var _default = exports.default = TextButton;
//# sourceMappingURL=TextButton.js.map