"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
function _export(target, all) {
    for(var name in all)Object.defineProperty(target, name, {
        enumerable: true,
        get: all[name]
    });
}
_export(exports, {
    Dialog: function() {
        return Dialog;
    },
    DialogBody: function() {
        return DialogBody;
    },
    DialogContent: function() {
        return DialogContent;
    },
    DialogDescription: function() {
        return DialogDescription;
    },
    DialogFooter: function() {
        return DialogFooter;
    },
    // DialogContainer,
    DialogHeader: function() {
        return DialogHeader;
    },
    DialogTitle: function() {
        return DialogTitle;
    },
    DialogTrigger: function() {
        return DialogTrigger;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
const _reactdialog = /*#__PURE__*/ _interop_require_wildcard(require("@radix-ui/react-dialog"));
const _css = require("../utils/css");
const _icon = require("../icon");
const _classvarianceauthority = require("class-variance-authority");
function _interop_require_default(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    };
}
function _getRequireWildcardCache(nodeInterop) {
    if (typeof WeakMap !== "function") return null;
    var cacheBabelInterop = new WeakMap();
    var cacheNodeInterop = new WeakMap();
    return (_getRequireWildcardCache = function(nodeInterop) {
        return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
    })(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
    if (!nodeInterop && obj && obj.__esModule) {
        return obj;
    }
    if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
        return {
            default: obj
        };
    }
    var cache = _getRequireWildcardCache(nodeInterop);
    if (cache && cache.has(obj)) {
        return cache.get(obj);
    }
    var newObj = {
        __proto__: null
    };
    var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
    for(var key in obj){
        if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
            var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
            if (desc && (desc.get || desc.set)) {
                Object.defineProperty(newObj, key, desc);
            } else {
                newObj[key] = obj[key];
            }
        }
    }
    newObj.default = obj;
    if (cache) {
        cache.set(obj, newObj);
    }
    return newObj;
}
const dialogVariants = (0, _classvarianceauthority.cva)("orderly-fixed orderly-py-5 orderly-left-[50%] orderly-top-[50%] orderly-z-50 orderly-grid orderly-w-full orderly-max-w-[90%] orderly-translate-x-[-50%] orderly-translate-y-[-50%] orderly-bg-base-700 orderly-text-base-contrast orderly-shadow-lg orderly-duration-200 data-[state=open]:orderly-animate-in data-[state=closed]:orderly-animate-out data-[state=closed]:orderly-fade-out-0 data-[state=open]:orderly-fade-in-0 data-[state=closed]:orderly-zoom-out-95 data-[state=open]:orderly-zoom-in-95 data-[state=closed]:orderly-slide-out-to-left-1/2 data-[state=closed]:orderly-slide-out-to-top-[48%] data-[state=open]:orderly-slide-in-from-left-1/2 data-[state=open]:orderly-slide-in-from-top-[48%] orderly-rounded", {
    variants: {
        maxWidth: {
            xs: "orderly-max-w-[85%] desktop:orderly-max-w-[340px]",
            sm: "orderly-max-w-[85%] desktop:orderly-max-w-[440px]",
            lg: "orderly-max-w-[85%] desktop:orderly-max-w-[480px]",
            xl: "orderly-max-w-[85%] desktop:orderly-max-w-[540px]"
        }
    },
    defaultVariants: {
        maxWidth: "sm"
    }
});
const Dialog = _reactdialog.Root;
const DialogTrigger = _reactdialog.Trigger;
const DialogPortal = ({ // @ts-ignore
className, ...props })=>// @ts-ignore
    /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactdialog.Portal, {
        className: (0, _css.cn)(className),
        ...props
    });
DialogPortal.displayName = _reactdialog.Portal.displayName;
const DialogOverlay = /*#__PURE__*/ _react.default.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactdialog.Overlay, {
        ref: ref,
        className: (0, _css.cn)("orderly-dialog-overlay", "orderly-fixed orderly-inset-0 orderly-z-50 orderly-bg-black/70 orderly-backdrop-blur-sm data-[state=open]:orderly-animate-in data-[state=closed]:orderly-animate-out data-[state=closed]:orderly-fade-out-0 data-[state=open]:orderly-fade-in-0", className),
        ...props
    }));
DialogOverlay.displayName = _reactdialog.Overlay.displayName;
const DialogContent = /*#__PURE__*/ _react.default.forwardRef(({ children, closable, closeableSize = 20, className, maxWidth, ...props }, ref)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(DialogPortal, {
        children: [
            /*#__PURE__*/ (0, _jsxruntime.jsx)(DialogOverlay, {}),
            /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactdialog.Content, {
                ref: ref,
                className: (0, _css.cn)("orderly-dialog-content", dialogVariants({
                    maxWidth
                }), className),
                ...props,
                children: [
                    children,
                    closable && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactdialog.Close, {
                        className: (0, _css.cn)("orderly-dialog-close", "orderly-absolute orderly-right-5 orderly-top-5 orderly-rounded-sm orderly-opacity-70 orderly-ring-offset-base-700 orderly-transition-opacity hover:orderly-opacity-100 focus:orderly-outline-none focus:orderly-ring-2 focus:orderly-ring-ring focus:orderly-ring-offset-2 disabled:orderly-pointer-events-none data-[state=open]:orderly-bg-accent data-[state=open]:orderly-text-muted-foreground"),
                        children: [
                            /*#__PURE__*/ (0, _jsxruntime.jsx)(_icon.CloseIcon, {
                                size: closeableSize
                            }),
                            /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                                className: "orderly-sr-only",
                                children: "Close"
                            })
                        ]
                    })
                ]
            })
        ]
    }));
DialogContent.displayName = _reactdialog.Content.displayName;
const DialogHeader = ({ className, ...props })=>/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
        className: (0, _css.cn)("orderly-dialog-header", "orderly-px-5 orderly-pb-5 orderly-flex orderly-flex-col orderly-text-base orderly-relative after:orderly-content after:orderly-block after:orderly-absolute after:orderly-bottom-0 after:orderly-left-5 after:orderly-right-5 after:orderly-h-[1px] after:orderly-bg-base-contrast/10 after:orderly-mt-5", className),
        ...props
    });
DialogHeader.displayName = "DialogHeader";
const DialogFooter = ({ className, ...props })=>/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
        className: (0, _css.cn)("orderly-dialog-footer", "orderly-px-5 orderly-grid orderly-grid-cols-2 sm:orderly-flex sm:orderly-flex-row sm:orderly-justify-end orderly-gap-3", className),
        ...props
    });
DialogFooter.displayName = "DialogFooter";
const DialogTitle = /*#__PURE__*/ _react.default.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactdialog.Title, {
        ref: ref,
        className: (0, _css.cn)("orderly-dialog-title", "orderly-text-xs orderly-leading-none desktop:orderly-text-xl", className),
        ...props
    }));
DialogTitle.displayName = _reactdialog.Title.displayName;
const DialogDescription = /*#__PURE__*/ _react.default.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactdialog.Description, {
        ref: ref,
        className: (0, _css.cn)("orderly-dialog-description", "orderly-text-3xs orderly-text-muted-foreground orderly-text-left", className),
        ...props
    }));
DialogDescription.displayName = _reactdialog.Description.displayName;
const DialogBody = (props)=>{
    const { children, className } = props;
    return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
        className: (0, _css.cn)("orderly-dialog-body", "orderly-px-5", className),
        children: children
    });
};
DialogBody.displayName = "DialogBody";

//# sourceMappingURL=dialog.js.map