@nexusui/components
Version:
These are custom components specially-developed for NexusUI applications. They will make your life easier by giving you out-of-the-box implementations for various high-level UI elements that you can drop directly into your application.
2 lines (1 loc) • 1.22 kB
JavaScript
import{jsx as t,jsxs as r}from"react/jsx-runtime";import{useMemo as o}from"react";import i from"@mui/material/Dialog";import s from"@mui/material/DialogTitle";import a from"@mui/material/DialogContent";import e from"@mui/material/DialogActions";import l from"./Dialog.styles.js";import{ActionsBar as n}from"../common/ActionsBar/ActionsBar.container.js";const m="NexusDialog",c=c=>{const{title:d,footer:p,children:x,DialogActionsProps:g={},DialogContentProps:A={},DialogTitleProps:f={},PaperProps:h={},sx:u,dividers:D=!1,onClose:$,leftActions:y=[],rightActions:P=[],maxWidth:N="sm",...C}=c,j=o((()=>{const r=y.length+P.length;return!p&&r<1?null:t(e,{"data-testid":`${m}-actions`,className:`${m}-actions`,sx:[...Array.isArray(g.sx)?g.sx:[g.sx]],...g,children:p||t(n,{actions:{left:y,right:P}})})}),[g,p,y,P]);return r(i,{"data-testid":`${m}-root`,className:`${m}-root`,onClose:$,sx:[l[".NexusDialog-root"],...Array.isArray(u)?u:[u]],PaperProps:{...h,className:`${m}-paper`,sx:[...Array.isArray(h.sx)?h.sx:[h.sx]]},maxWidth:N,...C,children:[d?t(s,{"data-testid":`${m}-title`,...f,children:d}):null,t(a,{"data-testid":`${m}-content`,className:`${m}-content`,dividers:D,...A,children:x}),j]})};export{c as DialogComponent};