"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = __importStar(require("react"));
const acui_1 = require("@Acme Corporation/acui");
const Alert = (0, react_1.forwardRef)(({ status = 'info', variant = 'subtle', title, description, icon, isClosable = false, onClose, className = '', wrapperClassName = '', titleClassName = '', descriptionClassName = '', iconClassName = '', closeButtonClassName = '', children, ...props }, ref) => {
    const theme = (0, acui_1.useTheme)();
    const alertId = react_1.default.useId();
    const titleId = react_1.default.useId();
    const descriptionId = react_1.default.useId();
    const ariaProps = {
        role: 'alert',
        'aria-live': 'polite',
        'aria-atomic': 'true',
        'aria-labelledby': title ? titleId : undefined,
        'aria-describedby': description ? descriptionId : undefined
    };
    const defaultIcons = {
        info: ((0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [(0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "12", r: "10" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 16v-4M12 8h.01" })] })),
        success: ((0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [(0, jsx_runtime_1.jsx)("path", { d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }), (0, jsx_runtime_1.jsx)("polyline", { points: "22 4 12 14.01 9 11.01" })] })),
        warning: ((0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [(0, jsx_runtime_1.jsx)("path", { d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" }), (0, jsx_runtime_1.jsx)("line", { x1: "12", y1: "9", x2: "12", y2: "13" }), (0, jsx_runtime_1.jsx)("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })] })),
        error: ((0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [(0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "12", r: "10" }), (0, jsx_runtime_1.jsx)("line", { x1: "15", y1: "9", x2: "9", y2: "15" }), (0, jsx_runtime_1.jsx)("line", { x1: "9", y1: "9", x2: "15", y2: "15" })] }))
    };
    const renderIcon = () => {
        if (icon) {
            return ((0, jsx_runtime_1.jsx)("span", { className: `bf-alert-icon ${iconClassName}`, "aria-hidden": "true", children: icon }));
        }
        return ((0, jsx_runtime_1.jsx)("span", { className: `bf-alert-icon ${iconClassName}`, "aria-hidden": "true", children: defaultIcons[status] }));
    };
    const wrapperClasses = [
        'bf-alert-wrapper',
        wrapperClassName
    ].filter(Boolean).join(' ');
    const alertClasses = [
        'bf-alert',
        `bf-alert--${status}`,
        `bf-alert--${variant}`,
        className
    ].filter(Boolean).join(' ');
    const titleClasses = [
        'bf-alert-title',
        titleClassName
    ].filter(Boolean).join(' ');
    const descriptionClasses = [
        'bf-alert-description',
        descriptionClassName
    ].filter(Boolean).join(' ');
    const closeButtonClasses = [
        'bf-alert-close-button',
        closeButtonClassName
    ].filter(Boolean).join(' ');
    return ((0, jsx_runtime_1.jsx)("div", { ref: ref, id: alertId, ...ariaProps, className: wrapperClasses, ...props, children: (0, jsx_runtime_1.jsxs)("div", { className: alertClasses, children: [renderIcon(), (0, jsx_runtime_1.jsxs)("div", { className: "bf-alert-content", children: [title && ((0, jsx_runtime_1.jsx)("div", { id: titleId, className: titleClasses, children: title })), description && ((0, jsx_runtime_1.jsx)("div", { id: descriptionId, className: descriptionClasses, children: description })), children] }), isClosable && ((0, jsx_runtime_1.jsx)("button", { type: "button", className: closeButtonClasses, onClick: onClose, "aria-label": "Close alert", children: (0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: [(0, jsx_runtime_1.jsx)("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), (0, jsx_runtime_1.jsx)("line", { x1: "6", y1: "6", x2: "18", y2: "18" })] }) }))] }) }));
});
Alert.displayName = 'Alert';
exports.default = (0, react_1.memo)(Alert);
//# sourceMappingURL=Alert.js.map