import { __rest, __assign } from '../../node_modules/tslib/tslib.es6.js';
import React from 'react';
import { useDisclosure, Alert as Alert$1, AlertIcon, Flex, AlertTitle, AlertDescription, CloseButton } from '@chakra-ui/react';
import AlertLink from './Link.js';

var Alert = function (_a) {
    var title = _a.title, description = _a.description, link = _a.link, type = _a.type, icon = _a.icon, rest = __rest(_a, ["title", "description", "link", "type", "icon"]);
    var _b = useDisclosure({ defaultIsOpen: true }), isOpen = _b.isOpen, onClose = _b.onClose;
    return isOpen || !rest.dismissible ? (React.createElement(Alert$1, { status: type },
        React.createElement(AlertIcon, null, icon),
        React.createElement(Flex, { direction: "column", w: "100%" },
            title ? React.createElement(AlertTitle, null, title) : null,
            React.createElement(AlertDescription, null, description),
            link ? React.createElement(AlertLink, __assign({}, link)) : null),
        rest.dismissible ? (React.createElement(CloseButton, { alignSelf: "flex-start", position: "relative", onClick: function () {
                var _a;
                onClose();
                (_a = rest.onDismiss) === null || _a === void 0 ? void 0 : _a.call(rest);
            } })) : null)) : null;
};

export { Alert as default };
//# sourceMappingURL=index.js.map
