function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import React from 'react';
import styled from 'styled-components';
import { Badge, Box, Button, Flexbox, Typography } from '../..';
var StyledButton = styled(Button).withConfig({
  displayName: "TextButtonCard__StyledButton",
  componentId: "sc-5yfxox-0"
})(["border:1px solid ", ";border-radius:", "px;box-sizing:border-box;justify-content:flex-start;text-align:left;padding:", "px;> span{width:100%;}:hover{text-decoration:none;border:1px solid ", ";background-color:", ";}:active{outline:2px solid ", ";background-color:", ";}"], function (t) {
  return t.theme.colorTokens.neutral.border_weak;
}, function (t) {
  return t.theme.spacing.unit(1);
}, function (t) {
  return t.theme.spacing.unit(3);
}, function (t) {
  return t.theme.colorTokens.neutral.border_hover;
}, function (t) {
  return t.theme.colorTokens.action.background_weak;
}, function (t) {
  return t.theme.colorTokens.action.border_default;
}, function (t) {
  return t.theme.colorTokens.action.background_weak;
});
var StyledBox = styled(Box).withConfig({
  displayName: "TextButtonCard__StyledBox",
  componentId: "sc-5yfxox-1"
})(["border:1px solid ", ";border-radius:", "px;position:relative;"], function (t) {
  return t.theme.colorTokens.neutral.border_weak;
}, function (t) {
  return t.theme.spacing.unit(1);
});
var StyledButtonPill = styled(Button.Pill).withConfig({
  displayName: "TextButtonCard__StyledButtonPill",
  componentId: "sc-5yfxox-2"
})(["width:130px;"]);
var TextButtonCard = function TextButtonCard(_ref) {
  var title = _ref.title,
    description = _ref.description,
    titleIcon = _ref.titleIcon,
    titleBadgeText = _ref.titleBadgeText,
    buttonText = _ref.buttonText,
    statusIcon = _ref.statusIcon,
    action = _ref.action,
    children = _ref.children;
  var contents = React.createElement(Flexbox, {
    container: true,
    gap: 3,
    wrap: "wrap"
  }, React.createElement(Flexbox, {
    container: true,
    item: true,
    gap: 3,
    alignItems: "center",
    wrap: "nowrap",
    grow: 1,
    basis: "320px"
  }, titleIcon && React.createElement(Badge.Icon, {
    badgeColor: function badgeColor(t) {
      return t.colorTokens.neutral.background_weak;
    }
  }, titleIcon), React.createElement(Flexbox, {
    container: true,
    item: true,
    gap: 1,
    grow: 1,
    direction: "column"
  }, React.createElement(Flexbox, {
    container: true,
    gap: 2,
    alignItems: "baseline"
  }, React.createElement(Typography, {
    type: "primary",
    weight: "bold"
  }, title), titleBadgeText && React.createElement(Badge.Label, {
    type: "secondary",
    weight: "bold",
    badgeColor: function badgeColor(t) {
      return t.colorTokens.action.background_weak;
    },
    color: function color(t) {
      return t.colorTokens.action.text_default;
    }
  }, titleBadgeText)), React.createElement(Typography, {
    type: "secondary",
    color: function color(t) {
      return t.colorTokens.neutral.text_weak;
    }
  }, description)), buttonText && action && React.createElement(Flexbox, {
    item: true,
    shrink: 0
  }, React.createElement(StyledButtonPill, _extends({
    variant: "secondary",
    size: "m"
  }, action), buttonText)), React.createElement(Flexbox, {
    item: true,
    shrink: 0
  }, statusIcon)), children);
  if (action && !buttonText) return React.createElement(StyledButton, _extends({
    variant: "neutral",
    fullWidth: true
  }, action), contents);
  return React.createElement(StyledBox, {
    p: 3
  }, contents);
};
export default TextButtonCard;