"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _react = _interopRequireDefault(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _classnames = _interopRequireDefault(require("classnames"));

var _constants = require("../../constants");

// Copyright 1999-2020. Plesk International GmbH. All rights reserved.

/**
 * Figure component.
 * @since 0.0.42
 */
const Figure = ({
  baseClassName,
  className,
  href,
  caption,
  children,
  ...props
}) => /*#__PURE__*/_react.default.createElement("figure", (0, _extends2.default)({
  className: (0, _classnames.default)(baseClassName, className)
}, props), children, href && /*#__PURE__*/_react.default.createElement("a", {
  href: href,
  className: (0, _classnames.default)(`${baseClassName}__overlay`, `${baseClassName}__overlay--cover`, `${baseClassName}__action`)
}), caption && /*#__PURE__*/_react.default.createElement("figcaption", {
  className: (0, _classnames.default)(`${baseClassName}__overlay`, `${baseClassName}__overlay--bottom`)
}, caption));

Figure.propTypes = {
  /**
   * @since 0.0.47
   */
  href: _propTypes.default.string,

  /**
   * @since 0.0.47
   */
  caption: _propTypes.default.any,

  /**
   * Content of the figure
   * @since 0.0.42
   */
  children: _propTypes.default.node,

  /**
   * @ignore
   */
  className: _propTypes.default.string,

  /**
   * @ignore
   */
  baseClassName: _propTypes.default.string
};
Figure.defaultProps = {
  href: null,
  caption: null,
  children: null,
  className: null,
  baseClassName: `${_constants.CLS_PREFIX}figure`
};
var _default = Figure;
exports.default = _default;