@jengaui/alert-dialog
Version:
Jenga UI Alert Dialog component in React
9 lines (6 loc) • 930 B
JavaScript
import { a } from './chunk-QUSS2ZBB.js';
import { Portal } from '@jengaui/portal';
import { DialogContainer } from '@jengaui/dialog';
import { jsx } from 'react/jsx-runtime';
var g="AlertDialogZone";function S(m){let{openedDialog:r}=m;if(r===null)return jsx(Portal,{},g);let{type:D,isDismissable:u=!0,actions:e,onDismiss:d,content:s,...A}=r.props,{resolve:t,reject:P,isVisible:l,dialogType:y}=r.meta,T=(()=>{let i=(o,c)=>{if(typeof o>"u")return;if(typeof o=="boolean")return o?{onPress:()=>t(c)}:!1;let a=o.onPress;return {...o,onPress:J=>{a==null||a(J),t(c);}}};return typeof e>"u"?{}:{confirm:i(e.confirm,"confirm"),secondary:i(e.secondary,"secondary"),cancel:i(e.cancel,"cancel")}})();return jsx(Portal,{children:jsx(DialogContainer,{isOpen:l,isDismissable:u,type:D,onDismiss:d,children:jsx(a,{noActions:y==="form",actions:T,isHidden:!l,content:typeof s=="function"?s({resolve:t,reject:P}):s,...A})})},g)}
export { S as a };