"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Legend = void 0;
var _react = _interopRequireDefault(require("react"));
var _styledComponents = _interopRequireDefault(require("styled-components"));
var _ = require("../..");
var _NormalizedElements = _interopRequireDefault(require("../../common/NormalizedElements"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var StyledLegendAsCaption = (0, _styledComponents.default)(_NormalizedElements.default.Legend).withConfig({
  displayName: "Legend__StyledLegendAsCaption",
  componentId: "sc-x6z4g1-0"
})(["margin:0 0 ", "px 0;"], function (p) {
  return p.theme.spacing.unit(4);
});
var StyledLegendAsLabel = (0, _styledComponents.default)(_NormalizedElements.default.Legend).withConfig({
  displayName: "Legend__StyledLegendAsLabel",
  componentId: "sc-x6z4g1-1"
})(["cursor:auto;"]);
var Legend = exports.Legend = function Legend(props) {
  var className = props.className,
    children = props.children,
    _props$styleType = props.styleType,
    styleType = _props$styleType === void 0 ? 'caption' : _props$styleType;
  if (styleType === 'caption') {
    return _react.default.createElement(StyledLegendAsCaption, {
      className: className
    }, _react.default.createElement(_.Typography, {
      type: "title3",
      weight: "bold"
    }, children));
  }
  return _react.default.createElement(_.FormLabel, {
    className: className,
    as: StyledLegendAsLabel
  }, children);
};