"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _react = _interopRequireDefault(require("react"));
var _wixUiIconsCommon = require("@wix/wix-ui-icons-common");
var _Text = _interopRequireDefault(require("../Text"));
var _SidebarBackButtonSt = require("./SidebarBackButton.st.css.js");
var _SidebarAPI = require("../Sidebar/SidebarAPI");
var _constants = require("../Sidebar/constants");
var _Focusable = require("../common/Focusable");
var _context = require("../WixDesignSystemProvider/context");
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/SidebarBackButton/SidebarBackButton.jsx";
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
/**  button with an animated back arrow */
var SidebarBackButton = /*#__PURE__*/function (_React$PureComponent) {
  function SidebarBackButton() {
    (0, _classCallCheck2["default"])(this, SidebarBackButton);
    return _callSuper(this, SidebarBackButton, arguments);
  }
  (0, _inherits2["default"])(SidebarBackButton, _React$PureComponent);
  return (0, _createClass2["default"])(SidebarBackButton, [{
    key: "render",
    value: function render() {
      var _this = this;
      var _this$props = this.props,
        children = _this$props.children,
        animateArrow = _this$props.animateArrow,
        onClick = _this$props.onClick,
        dataHook = _this$props.dataHook,
        className = _this$props.className,
        focusableOnFocus = _this$props.focusableOnFocus,
        focusableOnBlur = _this$props.focusableOnBlur;
      return /*#__PURE__*/_react["default"].createElement(_context.WixDesignSystemContext.Consumer, {
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 27,
          columnNumber: 7
        }
      }, function () {
        return /*#__PURE__*/_react["default"].createElement(_SidebarAPI.SidebarContext.Consumer, {
          __self: _this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 29,
            columnNumber: 11
          }
        }, function (context) {
          var skin = context && context.getSkin() || _constants.sidebarSkins.dark;
          return /*#__PURE__*/_react["default"].createElement("button", {
            className: (0, _SidebarBackButtonSt.st)(_SidebarBackButtonSt.classes.root, {
              skin: skin
            }, className),
            "data-hook": dataHook,
            onClick: onClick,
            onFocus: focusableOnFocus,
            onBlur: focusableOnBlur,
            type: "button",
            tabIndex: "0",
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 33,
              columnNumber: 17
            }
          }, /*#__PURE__*/_react["default"].createElement(_wixUiIconsCommon.ChevronLeft, {
            className: (0, _SidebarBackButtonSt.st)(_SidebarBackButtonSt.classes.arrow, {
              animated: animateArrow
            }),
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 48,
              columnNumber: 19
            }
          }), /*#__PURE__*/_react["default"].createElement(_Text["default"], {
            weight: "normal",
            size: "small",
            secondary: skin === _constants.sidebarSkins.light,
            light: skin === _constants.sidebarSkins.dark,
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 52,
              columnNumber: 19
            }
          }, children));
        });
      });
    }
  }]);
}(_react["default"].PureComponent);
SidebarBackButton.displayName = 'SidebarBackButton';
var _default = exports["default"] = (0, _Focusable.withFocusable)(SidebarBackButton);