"use strict";
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MessageBox = void 0;
/* eslint-disable max-len */
const react_1 = __importDefault(require("react"));
const styled_components_1 = __importDefault(require("styled-components"));
const styled_system_1 = require("styled-system");
const box_1 = require("../../atoms/box");
const icon_1 = require("../../atoms/icon");
const button_1 = require("../../atoms/button");
const css_class_1 = require("../../utils/css-class");
const sizeVariants = styled_system_1.variant({
    prop: 'size',
    variants: {
        sm: {
            boxShadow: 'none',
            '& > section, & + section': {
                px: 'lg',
                py: 'default',
            },
            [`& > ${button_1.Button}`]: {
                margin: '0px',
            },
        },
    },
});
const variants = (theme) => styled_system_1.variant({
    variants: {
        success: {},
        danger: {
            bg: 'errorLight',
            'box-shadow': `0 2px 0 0 ${theme.colors.error};`,
            '& + section': {
                borderColor: 'errorLight',
            },
        },
        info: {
            bg: 'primary20',
            'box-shadow': `0 2px 0 0 ${theme.colors.primary100};`,
            '& + section': {
                borderColor: 'primary20',
            },
        },
    },
});
const StyledMessageBox = styled_components_1.default.div `
  line-height: ${({ theme }) => theme.lineHeights.default};
  box-shadow: 0 2px 0 0 ${({ theme }) => theme.colors.success};
  background: ${({ theme }) => theme.colors.successLight};
  color: ${({ theme }) => theme.colors.grey80};
  & > ${button_1.Button} {
    float: right;
    margin: 8px;
    & svg {
      fill: ${({ theme }) => theme.colors.grey80};
    }
  }
  ${({ theme }) => variants(theme)};
  ${sizeVariants};
`;
const StyledCaption = styled_components_1.default(box_1.Box) ``;
StyledCaption.defaultProps = {
    px: 'xl',
    py: 'lg',
};
const StyledChildren = styled_components_1.default(box_1.Box) `
  padding: ${({ theme }) => theme.space.lg} ${({ theme }) => theme.space.xl};
  background: ${({ theme }) => theme.colors.white};
  border-style: solid;
  border-width: 0 1px 1px 1px;
  border-color: ${({ theme }) => theme.colors.successLight};
`;
/**
 * @classdesc
 *
 *  *
 * Component responsible for rendering standard danger/info/success
 * messages.
 *
 * It has 2 size versions: default and small. Also it can either contain or
 * don't contain children, which causes different look.
 *
 * ### Usage
 *
 * ```javascript
 * import { MessageBox, MessageBoxProps } from '@adminjs/design-system'
 * ```
 *
 * @component
 * @subcategory Molecules
 * @hideconstructor
 * @see MessageBoxProps
 * @see {@link https://storybook.adminjs.co/?path=/story/designsystem-molecules-messagebox--default Storybook}
 * @example
 *
 * Component responsible for rendering standard danger/info/success
 * messages.
 *
 * It has 2 size versions: default and small. Also it can either contain or
 * don't contain children, which causes different look.
 *
 * ### Usage
 *
 * ```javascript
 * import { MessageBox, MessageBoxProps } from '@adminjs/design-system'
 * ```
 *
 * @component
 * @subcategory Molecules
 * @hideconstructor
 * @see MessageBoxProps
 * @see {@link https://storybook.adminjs.co/?path=/story/designsystem-molecules-messagebox--default Storybook}
 * @example