UNPKG

@availity/mui-dialog

Version:

Availity MUI Dialog Component - part of the @availity/element design system

114 lines (108 loc) 4.46 kB
var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; var __getOwnPropDescs = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) { if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); var __objRest = (source, exclude) => { var target = {}; for (var prop in source) if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && __getOwnPropSymbols) for (var prop of __getOwnPropSymbols(source)) { if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) target[prop] = source[prop]; } return target; }; // src/lib/Dialog.tsx import MuiDialog from "@mui/material/Dialog"; import { styled } from "@mui/material/styles"; import { IconButton } from "@availity/mui-button"; import { CloseIcon } from "@availity/mui-icon"; import { jsx, jsxs } from "react/jsx-runtime"; var CloseButton = (args) => /* @__PURE__ */ jsx(IconButton, __spreadProps(__spreadValues({ title: "Close Dialog", color: "secondary" }, args), { children: /* @__PURE__ */ jsx(CloseIcon, { fontSize: "xsmall" }) })); var CloseButtonSlot = styled(CloseButton, { name: "MuiDialog", slot: "AvCloseButton", overridesResolver: (props, styles) => styles.avCloseButton })({ position: "absolute", top: ".5rem", right: ".5rem", "~ .MuiDialogTitle-root": { marginRight: "3.5rem" } }); var Dialog = (_a) => { var _b = _a, { children, closeButton = true, onClose } = _b, rest = __objRest(_b, ["children", "closeButton", "onClose"]); return /* @__PURE__ */ jsxs(MuiDialog, __spreadProps(__spreadValues({ onClose }, rest), { children: [ closeButton ? /* @__PURE__ */ jsx(CloseButtonSlot, { onClick: onClose }) : null, children ] })); }; // src/lib/DialogActions.tsx import MuiDialogActions from "@mui/material/DialogActions"; import { jsx as jsx2 } from "react/jsx-runtime"; var DialogActions = (_a) => { var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]); return /* @__PURE__ */ jsx2(MuiDialogActions, __spreadProps(__spreadValues({}, rest), { children })); }; // src/lib/DialogContent.tsx import MuiDialogContent from "@mui/material/DialogContent"; import { jsx as jsx3 } from "react/jsx-runtime"; var DialogContent = (_a) => { var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]); return /* @__PURE__ */ jsx3(MuiDialogContent, __spreadProps(__spreadValues({}, rest), { children })); }; // src/lib/DialogContentText.tsx import MuiDialogContentText from "@mui/material/DialogContentText"; import { jsx as jsx4 } from "react/jsx-runtime"; var DialogContentText = (_a) => { var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]); return /* @__PURE__ */ jsx4(MuiDialogContentText, __spreadProps(__spreadValues({}, rest), { children })); }; // src/lib/DialogTitle.tsx import MuiDialogTitle from "@mui/material/DialogTitle"; import { AlertIcons } from "@availity/mui-alert"; import { styled as styled2 } from "@mui/material/styles"; import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime"; var AlertIcon = styled2("div", { name: "MuiDialogTitle", slot: "AvIcon", overridesResolver: (props, styles) => styles.avIcon })({ display: "inline-flex", fontSize: "inherit", marginRight: ".5rem", verticalAlign: "text-bottom" }); var DialogTitle = (_a) => { var _b = _a, { children, component = "h2", icon, variant = "h5" } = _b, rest = __objRest(_b, ["children", "component", "icon", "variant"]); return /* @__PURE__ */ jsxs2(MuiDialogTitle, __spreadProps(__spreadValues({ component, variant }, rest), { children: [ icon ? /* @__PURE__ */ jsx5(AlertIcon, { children: AlertIcons[icon] }) : null, children ] })); }; export { CloseButtonSlot, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle };