"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
require("react");
const getSize = require("../../core/utils/get-size/get-size.cjs");
const createVarsResolver = require("../../core/styles-api/create-vars-resolver/create-vars-resolver.cjs");
require("clsx");
const getThemeColor = require("../../core/MantineProvider/color-functions/get-theme-color/get-theme-color.cjs");
const useProps = require("../../core/MantineProvider/use-props/use-props.cjs");
const useStyles = require("../../core/styles-api/use-styles/use-styles.cjs");
const Box = require("../../core/Box/Box.cjs");
const factory = require("../../core/factory/factory.cjs");
const CloseButton = require("../CloseButton/CloseButton.cjs");
const Loader = require("../Loader/Loader.cjs");
const Notification_module_css = require("./Notification.module.css.cjs");
const defaultProps = {
  withCloseButton: true
};
const varsResolver = createVarsResolver.createVarsResolver((theme, { radius, color }) => ({
  root: {
    "--notification-radius": radius === void 0 ? void 0 : getSize.getRadius(radius),
    "--notification-color": color ? getThemeColor.getThemeColor(color, theme) : void 0
  }
}));
const Notification = factory.factory((_props, ref) => {
  const props = useProps.useProps("Notification", defaultProps, _props);
  const {
    className,
    color,
    radius,
    loading,
    withCloseButton,
    withBorder,
    title,
    icon,
    children,
    onClose,
    closeButtonProps,
    classNames,
    style,
    styles,
    unstyled,
    variant,
    vars,
    mod,
    ...others
  } = props;
  const getStyles = useStyles.useStyles({
    name: "Notification",
    classes: Notification_module_css.default,
    props,
    className,
    style,
    classNames,
    styles,
    unstyled,
    vars,
    varsResolver
  });
  return /* @__PURE__ */ jsxRuntime.jsxs(
    Box.Box,
    {
      ...getStyles("root"),
      mod: [{ "data-with-icon": !!icon || loading, "data-with-border": withBorder }, mod],
      ref,
      variant,
      ...others,
      role: "alert",
      children: [
        icon && !loading && /* @__PURE__ */ jsxRuntime.jsx("div", { ...getStyles("icon"), children: icon }),
        loading && /* @__PURE__ */ jsxRuntime.jsx(Loader.Loader, { size: 28, color, ...getStyles("loader") }),
        /* @__PURE__ */ jsxRuntime.jsxs("div", { ...getStyles("body"), children: [
          title && /* @__PURE__ */ jsxRuntime.jsx("div", { ...getStyles("title"), children: title }),
          /* @__PURE__ */ jsxRuntime.jsx(Box.Box, { ...getStyles("description"), mod: { "data-with-title": !!title }, children })
        ] }),
        withCloseButton && /* @__PURE__ */ jsxRuntime.jsx(
          CloseButton.CloseButton,
          {
            iconSize: 16,
            color: "gray",
            ...closeButtonProps,
            unstyled,
            onClick: onClose,
            ...getStyles("closeButton")
          }
        )
      ]
    }
  );
});
Notification.classes = Notification_module_css.default;
Notification.displayName = "@mantine/core/Notification";
exports.Notification = Notification;
