UNPKG

analytica-frontend-lib

Version:

Repositório público dos componentes utilizados nas plataformas da Analytica Ensino

87 lines (85 loc) 2.78 kB
import { Text_default } from "./chunk-IMCIR6TJ.mjs"; import { cn } from "./chunk-53ICLDGS.mjs"; // src/components/Alert/Alert.tsx import { CheckCircleIcon } from "@phosphor-icons/react/dist/csr/CheckCircle"; import { InfoIcon } from "@phosphor-icons/react/dist/csr/Info"; import { WarningCircleIcon } from "@phosphor-icons/react/dist/csr/WarningCircle"; import { XCircleIcon } from "@phosphor-icons/react/dist/csr/XCircle"; import { jsx, jsxs } from "react/jsx-runtime"; var VARIANT_ACTION_CLASSES = { solid: { default: "bg-background-50 border-transparent", info: "bg-info border-transparent", success: "bg-success border-transparent", warning: "bg-warning border-transparent", error: "bg-error border-transparent" }, outline: { default: "bg-background border border-border-100", info: "bg-background border border-border-100", success: "bg-background border border-border-100", warning: "bg-background border border-border-100", error: "bg-background border border-border-100" } }; var COLOR_CLASSES = { default: "text-text-950", info: "text-info-800", success: "text-success-800", warning: "text-warning-800", error: "text-error-800" }; var ICONS = { default: /* @__PURE__ */ jsx(CheckCircleIcon, { size: 18 }), info: /* @__PURE__ */ jsx(InfoIcon, { size: 18 }), success: /* @__PURE__ */ jsx(CheckCircleIcon, { size: 18 }), warning: /* @__PURE__ */ jsx(WarningCircleIcon, { size: 18 }), error: /* @__PURE__ */ jsx(XCircleIcon, { size: 18 }) }; var Alert = ({ variant = "solid", title, description, action = "default", className, ...props }) => { const baseClasses = "alert-wrapper flex items-start gap-2 w-[384px] py-3 px-4 font-inherit rounded-md"; const variantClasses = VARIANT_ACTION_CLASSES[variant][action]; const variantColor = COLOR_CLASSES[action]; const variantIcon = ICONS[action]; const hasHeading = Boolean(title); return /* @__PURE__ */ jsxs("div", { className: cn(baseClasses, variantClasses, className), ...props, children: [ /* @__PURE__ */ jsx("span", { className: cn("mt-0.5", variantColor), children: variantIcon }), /* @__PURE__ */ jsxs("div", { children: [ hasHeading && /* @__PURE__ */ jsx( Text_default, { size: "md", weight: "medium", color: variantColor, className: "mb-0.5", children: title } ), /* @__PURE__ */ jsx( Text_default, { size: hasHeading ? "sm" : "md", weight: "normal", color: !hasHeading ? variantColor : "text-text-700", children: description } ) ] }) ] }); }; var Alert_default = Alert; export { Alert_default }; //# sourceMappingURL=chunk-YQTOSHD5.mjs.map