import _taggedTemplateLiteralLoose from "@babel/runtime/helpers/taggedTemplateLiteralLoose";

var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;

import React from 'react';
import styled from 'styled-components';
import Collapse from '@kunukn/react-collapse';
import { IconArrowDown } from '../../../../../Common/Icons';
import { Typography } from '../../../../../Common/Typography';

var TabContent = props => {
  var {
    open
  } = props;
  var {
    tab: {
      content,
      isComponent
    }
  } = props;
  return /*#__PURE__*/React.createElement(Wrapper, {
    open: open,
    className: "mb-3"
  }, /*#__PURE__*/React.createElement(Collapse, {
    isOpen: open,
    transition: "height 290ms cubic-bezier(.4, 0, .2, 1)"
  }, isComponent ? /*#__PURE__*/React.createElement(Content, {
    open: open
  }, content) : /*#__PURE__*/React.createElement(Content, {
    open: open,
    dangerouslySetInnerHTML: {
      __html: content
    }
  })));
};

export var TabListItem = props => {
  var {
    tab,
    open,
    onClick,
    isLast
  } = props;
  return /*#__PURE__*/React.createElement(Border, {
    isLast: isLast
  }, /*#__PURE__*/React.createElement(ListItem, {
    role: "button",
    onClick: onClick(tab.name)
  }, tab.isComponent && tab.headerComponent, !tab.isComponent && /*#__PURE__*/React.createElement(ItemLabel, null, tab.name), /*#__PURE__*/React.createElement(IconWrapper, {
    open: open
  }, /*#__PURE__*/React.createElement(IconArrowDown, {
    width: "24",
    height: "24"
  }))), /*#__PURE__*/React.createElement(TabContent, {
    open: open,
    tab: tab
  }));
};
var Wrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n  position: relative;\n  overflow: ", ";\n"])), props => props.open ? 'initial' : 'hidden');
var Border = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n  border-top: 1px solid;\n  ", "\n  border-color: ", ";\n"])), props => props.isLast ? 'border-bottom: 1px solid;' : '', (_ref) => {
  var {
    theme
  } = _ref;
  return theme.palette.light;
});
var Content = styled.div.attrs({
  className: 'py-2'
})(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n  position: absolute;\n  opacity: 0;\n  width: 100%;\n  max-height: 0;\n  ", ";\n"])), props => props.open && "\n      position: relative;\n      opacity: 1;\n      visibility: visible;\n      overflow: auto;\n      max-height: 5000px;\n    ");
var ListItem = styled(Typography).attrs({
  as: 'div',
  variant: 4,
  className: 'py-3 d-flex justify-content-between align-items-center'
})(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n  position: relative;\n  width: 100%;\n  flex: 1;\n  outline: none;\n  text-transform: none;\n  cursor: pointer;\n  transition: color 0.25s ease;\n  background: transparent;\n"])));
var ItemLabel = styled(Typography).attrs({
  as: 'h5',
  variant: 4
})(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n  overflow-wrap: break-word;\n  position: relative;\n  max-width: 90%;\n  letter-spacing: 0;\n  text-transform: capitalize;\n"])));
var IconWrapper = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n  & svg {\n    transform: rotate(0);\n    transition: transform 0.3s ease;\n    ", "\n  }\n"])), props => props.open && "\n        transform: rotate(180deg);\n      ");
//# sourceMappingURL=index.js.map