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 Avatar from '../avatar/Avatar';
import Button from '@zohodesk/base/es/Button/Button';
import Text from '../text/Text';
import Box from '../layout/Box';
import style from './Card.module.css';
import constantProps from './Card.constantProps';
import BoxConstantProps from '../layout/Box.constantProps';
import cardPropTypes, { defaultProps, propsDescription } from './Card.propTypes';
export default function CardSkeleton(props) {
  let {
    children,
    type
  } = props;
  let Components = {};
  React.Children.forEach(children, child => {
    if (child && child.type && child.type.displayName) {
      Components[child.type.displayName] = () => {
        return child;
      };
    }
  });

  if (Object.keys(Components).length) {
    return /*#__PURE__*/React.createElement(Box, _extends({
      isContainer: true
    }, props, {
      customClassName: style[type] + ' ' + style.base
    }), /*#__PURE__*/React.createElement(Box, null, Components.Avatar ? /*#__PURE__*/React.createElement(Components.Avatar, null) : null), /*#__PURE__*/React.createElement(Box, {
      flexible: true,
      customClassName: style.spacing
    }, /*#__PURE__*/React.createElement(Box, null, Components.HeaderActions ? /*#__PURE__*/React.createElement(Box, {
      customClassName: style.absposition
    }, Components.HeaderActions ? /*#__PURE__*/React.createElement(Components.HeaderActions, null) : null) : null), Components.TextFields ? /*#__PURE__*/React.createElement(Components.TextFields, null) : null, /*#__PURE__*/React.createElement(Box, null, Components.FooterActions ? /*#__PURE__*/React.createElement(Components.FooterActions, null) : null)));
  }

  return /*#__PURE__*/React.createElement(React.Fragment, null, children);
}
CardSkeleton.propTypes = cardPropTypes;
CardSkeleton.defaultProps = defaultProps;
CardSkeleton.propsDescription = propsDescription;
CardSkeleton.constantProps = constantProps; // sub comp

export let CardAvatarSkeleton = props => {
  if (props.children) {
    return props.children;
  }

  return /*#__PURE__*/React.createElement(Avatar, props);
};
export let CardPrimaryTextSkeleton = props => {
  return /*#__PURE__*/React.createElement(Text, props);
};
export let CardSecondaryTextSkeleton = props => {
  return /*#__PURE__*/React.createElement(Text, props);
};
export let CardButtonSkeleton = props => {
  return /*#__PURE__*/React.createElement(Button, props);
};
export let CardTextFieldsSkeleton = props => {
  return /*#__PURE__*/React.createElement(Box, _extends({
    direction: BoxConstantProps.direction.column
  }, props), props.children);
};
export let CardFooterActionsSkeleton = props => {
  let customeclass = props.customClassName ? `${props.customClassName} ${props.isHover ? style.footeractions : ''} ` : `${props.isHover ? style.footeractions : ''}`;
  return /*#__PURE__*/React.createElement(Box, _extends({
    isContainer: true,
    direction: BoxConstantProps.direction.row
  }, props, {
    customClassName: customeclass
  }), props.children);
};
export let CardHeaderActionsSkeleton = props => {
  return /*#__PURE__*/React.createElement(Box, _extends({
    isContainer: true,
    direction: BoxConstantProps.direction.row
  }, props, {
    customClassName: props.isHover ? style.headeractions : ''
  }), props.children);
};