"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _system = require("@wix/wix-ui-icons-common/system");
var _Button = _interopRequireDefault(require("../../../Button"));
var _TextButton = _interopRequireDefault(require("../../../TextButton"));
var _constants = require("../../constants");
var _WixDesignSystemIconThemeProvider = require("../../../WixDesignSystemIconThemeProvider");
var _AccordionItemCaretSt = require("./AccordionItemCaret.st.css.js");
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/Accordion/components/AccordionItemCaret/AccordionItemCaret.tsx";
var AccordionItemCaret = _ref => {
  var {
    showLabel,
    buttonType,
    skin,
    open,
    disabled,
    hover,
    collapseLabel,
    expandLabel
  } = _ref;
  var icons = (0, _WixDesignSystemIconThemeProvider.useIcons)('AccordionItemCaret', {
    CaretDown: _system.CaretDown,
    CaretRight: _system.CaretRight
  });
  var skinProp = skin === _constants.skins.neutral ? 'dark' : 'standard';
  var isLabelShown = showLabel === 'always' || hover;
  var label = open ? collapseLabel : expandLabel;
  if (buttonType === _constants.buttonTypes.node && isLabelShown && label) {
    return /*#__PURE__*/_react.default.createElement("div", {
      "data-hook": _constants.dataHooks.toggleButton,
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 31,
        columnNumber: 12
      }
    }, label);
  }
  if (buttonType === _constants.buttonTypes.button && label && (
  // For this buttonType, showLabel default is 'always' if undefined.
  showLabel === 'hover' ? hover : true)) {
    return /*#__PURE__*/_react.default.createElement(_Button.default, {
      skin: skinProp,
      size: "small",
      priority: open ? 'secondary' : 'primary',
      disabled: disabled,
      dataHook: _constants.dataHooks.toggleButton,
      children: label,
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 41,
        columnNumber: 7
      }
    });
  }
  if (buttonType === _constants.buttonTypes.textButton) {
    var suffixIcon = open ? /*#__PURE__*/_react.default.createElement(icons.CaretDown, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 53,
        columnNumber: 31
      }
    }) : /*#__PURE__*/_react.default.createElement(icons.CaretRight, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 53,
        columnNumber: 53
      }
    });
    return /*#__PURE__*/_react.default.createElement(_TextButton.default, {
      className: (0, _AccordionItemCaretSt.st)(_AccordionItemCaretSt.classes.textButton, {
        withLabel: !!(isLabelShown && label),
        isHovered: hover,
        disabled
      }),
      skin: skinProp,
      suffixIcon: suffixIcon,
      disabled: disabled,
      dataHook: _constants.dataHooks.toggleButton,
      children: isLabelShown && label,
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 56,
        columnNumber: 7
      }
    });
  }
  return null;
};
var _default = exports.default = AccordionItemCaret;
//# sourceMappingURL=AccordionItemCaret.js.map