UNPKG

@gsretail.com/gui-core

Version:

A skeleton to create your own React component library using Rollup, TypeScript, Sass and Storybook

2 lines (1 loc) 2.03 kB
import{__rest as e,__assign as l}from"tslib";import*as t from"react";import{DialogTitle as a,DialogContent as n,DialogActions as r,Paper as o}from"@mui/material";import c from"react-draggable";import{GuiIcon as i}from"@gsretail.com/gui-icons";import{GuiIconButton as s}from"../Button/GuiIconButton.js";import{StyledDraggableDialog as m,StyledDialog as u}from"./GuiDialog.styled.js";function g(e){return t.createElement(c,{handle:"#draggable-dialog-title",cancel:'[class*="MuiDialogContent-root"]'},t.createElement(o,l({},e)))}var d=function(o){var c=o.subject,d=o.size,p=o.scroll,C=o.draggable,h=o.isCustom,E=o.height,b=o.children,f=o.tabsChildren,k=o.actionsChildren,y=o.onCloseBtn;o.setOpen,o.className;var D=e(o,["subject","size","scroll","draggable","isCustom","height","children","tabsChildren","actionsChildren","onCloseBtn","setOpen","className"]),N=D.onClose,v=D.open;return t.createElement(t.Fragment,null,C?t.createElement(m,l({className:"gui-dialog-draggable","aria-labelledby":"draggable-dialog-title",PaperComponent:g,fullWidth:!0,size:d,height:E||"300px",scroll:p,open:v,onClose:function(e,l){"backdropClick"!==l&&"escapeKeyDown"!==l&&N(e,l)}},D),h?t.createElement(t.Fragment,null,b&&b):t.createElement(t.Fragment,null,y&&t.createElement(s,{className:"btnDialogClose",variant:"clear",color:"secondary",onClick:y},t.createElement(i,{name:"Close",width:"28px"})),t.createElement(a,null,c&&c,f&&f),b&&t.createElement(n,null,b),k&&t.createElement(r,null,k))):t.createElement(u,l({className:"gui-dialog",fullWidth:!0,size:d,height:E,scroll:p,open:v,onClose:function(e,l){"backdropClick"!==l&&"escapeKeyDown"!==l&&N(e,l)}},D),h?t.createElement(t.Fragment,null,b&&b):t.createElement(t.Fragment,null,y&&t.createElement(s,{className:"btnDialogClose",variant:"clear",color:"secondary",onClick:y},t.createElement(i,{name:"Close",width:"28px"})),t.createElement(a,null,c&&c,f&&f),b&&t.createElement(n,null,b),k&&t.createElement(r,null,k))))};d.defaultProps={size:"small",scroll:"paper"};export{d as GuiDialog,d as default};