@lerx/promise-modal 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -676,15 +676,12 @@ const BackgroundFrame = ({ modalId, onChangeOrder, }) => {
676
676
  event.stopPropagation();
677
677
  }, [modal, onClose]);
678
678
  const Background = react.useMemo(() => modal?.BackgroundComponent || BackgroundComponent, [BackgroundComponent, modal]);
679
- const className = react.useMemo(() => modal
680
- ? classNames.cx(background, {
681
- [active$1]: modal.closeOnBackdropClick && modal.visible,
682
- [visible$1]: modal.manualDestroy ? modal.alive : modal.visible,
683
- })
684
- : undefined, [modal]);
685
679
  if (!modal)
686
680
  return null;
687
- return (jsxRuntime.jsx("div", { className: className, onClick: handleClose, children: Background && (jsxRuntime.jsx(Background, { id: modal.id, type: modal.type, alive: modal.alive, visible: modal.visible, initiator: modal.initiator, manualDestroy: modal.manualDestroy, closeOnBackdropClick: modal.closeOnBackdropClick, background: modal.background, onChange: onChange, onConfirm: onConfirm, onClose: onClose, onDestroy: onDestroy, onChangeOrder: onChangeOrder, context: userDefinedContext })) }));
681
+ return (jsxRuntime.jsx("div", { className: classNames.cx(background, {
682
+ [active$1]: modal.closeOnBackdropClick && modal.visible,
683
+ [visible$1]: modal.manualDestroy ? modal.alive : modal.visible,
684
+ }), onClick: handleClose, children: Background && (jsxRuntime.jsx(Background, { id: modal.id, type: modal.type, alive: modal.alive, visible: modal.visible, initiator: modal.initiator, manualDestroy: modal.manualDestroy, closeOnBackdropClick: modal.closeOnBackdropClick, background: modal.background, onChange: onChange, onConfirm: onConfirm, onClose: onClose, onDestroy: onDestroy, onChangeOrder: onChangeOrder, context: userDefinedContext })) }));
688
685
  };
689
686
 
690
687
  const AlertInner = react.memo(({ modal, handlers }) => {
@@ -793,15 +790,12 @@ const ForegroundFrame = ({ modalId, onChangeOrder, }) => {
793
790
  const { context: userDefinedContext } = useUserDefinedContext();
794
791
  const { modal, onChange, onConfirm, onClose, onDestroy } = useModal(modalId);
795
792
  const Foreground = react.useMemo(() => modal?.ForegroundComponent || ForegroundComponent, [ForegroundComponent, modal]);
796
- const className = react.useMemo(() => modal
797
- ? classNames.cx(foreground, {
798
- [active]: modal.visible,
799
- [visible]: modal.manualDestroy ? modal.alive : modal.visible,
800
- })
801
- : undefined, [modal]);
802
793
  if (!modal)
803
794
  return null;
804
- return (jsxRuntime.jsx("div", { className: className, children: jsxRuntime.jsxs(Foreground, { id: modal.id, type: modal.type, alive: modal.alive, visible: modal.visible, initiator: modal.initiator, manualDestroy: modal.manualDestroy, closeOnBackdropClick: modal.closeOnBackdropClick, background: modal.background, onChange: onChange, onConfirm: onConfirm, onClose: onClose, onDestroy: onDestroy, onChangeOrder: onChangeOrder, context: userDefinedContext, children: [modal.type === 'alert' && (jsxRuntime.jsx(AlertInner, { modal: modal, handlers: { onConfirm } })), modal.type === 'confirm' && (jsxRuntime.jsx(ConfirmInner, { modal: modal, handlers: { onConfirm, onClose } })), modal.type === 'prompt' && (jsxRuntime.jsx(PromptInner, { modal: modal, handlers: { onChange, onConfirm, onClose } }))] }) }));
795
+ return (jsxRuntime.jsx("div", { className: classNames.cx(foreground, {
796
+ [active]: modal.visible,
797
+ [visible]: modal.manualDestroy ? modal.alive : modal.visible,
798
+ }), children: jsxRuntime.jsxs(Foreground, { id: modal.id, type: modal.type, alive: modal.alive, visible: modal.visible, initiator: modal.initiator, manualDestroy: modal.manualDestroy, closeOnBackdropClick: modal.closeOnBackdropClick, background: modal.background, onChange: onChange, onConfirm: onConfirm, onClose: onClose, onDestroy: onDestroy, onChangeOrder: onChangeOrder, context: userDefinedContext, children: [modal.type === 'alert' && (jsxRuntime.jsx(AlertInner, { modal: modal, handlers: { onConfirm } })), modal.type === 'confirm' && (jsxRuntime.jsx(ConfirmInner, { modal: modal, handlers: { onConfirm, onClose } })), modal.type === 'prompt' && (jsxRuntime.jsx(PromptInner, { modal: modal, handlers: { onChange, onConfirm, onClose } }))] }) }));
805
799
  };
806
800
 
807
801
  const useSubscribeModal = (modal) => {
package/dist/index.mjs CHANGED
@@ -674,15 +674,12 @@ const BackgroundFrame = ({ modalId, onChangeOrder, }) => {
674
674
  event.stopPropagation();
675
675
  }, [modal, onClose]);
676
676
  const Background = useMemo(() => modal?.BackgroundComponent || BackgroundComponent, [BackgroundComponent, modal]);
677
- const className = useMemo(() => modal
678
- ? cx(background, {
679
- [active$1]: modal.closeOnBackdropClick && modal.visible,
680
- [visible$1]: modal.manualDestroy ? modal.alive : modal.visible,
681
- })
682
- : undefined, [modal]);
683
677
  if (!modal)
684
678
  return null;
685
- return (jsx("div", { className: className, onClick: handleClose, children: Background && (jsx(Background, { id: modal.id, type: modal.type, alive: modal.alive, visible: modal.visible, initiator: modal.initiator, manualDestroy: modal.manualDestroy, closeOnBackdropClick: modal.closeOnBackdropClick, background: modal.background, onChange: onChange, onConfirm: onConfirm, onClose: onClose, onDestroy: onDestroy, onChangeOrder: onChangeOrder, context: userDefinedContext })) }));
679
+ return (jsx("div", { className: cx(background, {
680
+ [active$1]: modal.closeOnBackdropClick && modal.visible,
681
+ [visible$1]: modal.manualDestroy ? modal.alive : modal.visible,
682
+ }), onClick: handleClose, children: Background && (jsx(Background, { id: modal.id, type: modal.type, alive: modal.alive, visible: modal.visible, initiator: modal.initiator, manualDestroy: modal.manualDestroy, closeOnBackdropClick: modal.closeOnBackdropClick, background: modal.background, onChange: onChange, onConfirm: onConfirm, onClose: onClose, onDestroy: onDestroy, onChangeOrder: onChangeOrder, context: userDefinedContext })) }));
686
683
  };
687
684
 
688
685
  const AlertInner = memo(({ modal, handlers }) => {
@@ -791,15 +788,12 @@ const ForegroundFrame = ({ modalId, onChangeOrder, }) => {
791
788
  const { context: userDefinedContext } = useUserDefinedContext();
792
789
  const { modal, onChange, onConfirm, onClose, onDestroy } = useModal(modalId);
793
790
  const Foreground = useMemo(() => modal?.ForegroundComponent || ForegroundComponent, [ForegroundComponent, modal]);
794
- const className = useMemo(() => modal
795
- ? cx(foreground, {
796
- [active]: modal.visible,
797
- [visible]: modal.manualDestroy ? modal.alive : modal.visible,
798
- })
799
- : undefined, [modal]);
800
791
  if (!modal)
801
792
  return null;
802
- return (jsx("div", { className: className, children: jsxs(Foreground, { id: modal.id, type: modal.type, alive: modal.alive, visible: modal.visible, initiator: modal.initiator, manualDestroy: modal.manualDestroy, closeOnBackdropClick: modal.closeOnBackdropClick, background: modal.background, onChange: onChange, onConfirm: onConfirm, onClose: onClose, onDestroy: onDestroy, onChangeOrder: onChangeOrder, context: userDefinedContext, children: [modal.type === 'alert' && (jsx(AlertInner, { modal: modal, handlers: { onConfirm } })), modal.type === 'confirm' && (jsx(ConfirmInner, { modal: modal, handlers: { onConfirm, onClose } })), modal.type === 'prompt' && (jsx(PromptInner, { modal: modal, handlers: { onChange, onConfirm, onClose } }))] }) }));
793
+ return (jsx("div", { className: cx(foreground, {
794
+ [active]: modal.visible,
795
+ [visible]: modal.manualDestroy ? modal.alive : modal.visible,
796
+ }), children: jsxs(Foreground, { id: modal.id, type: modal.type, alive: modal.alive, visible: modal.visible, initiator: modal.initiator, manualDestroy: modal.manualDestroy, closeOnBackdropClick: modal.closeOnBackdropClick, background: modal.background, onChange: onChange, onConfirm: onConfirm, onClose: onClose, onDestroy: onDestroy, onChangeOrder: onChangeOrder, context: userDefinedContext, children: [modal.type === 'alert' && (jsx(AlertInner, { modal: modal, handlers: { onConfirm } })), modal.type === 'confirm' && (jsx(ConfirmInner, { modal: modal, handlers: { onConfirm, onClose } })), modal.type === 'prompt' && (jsx(PromptInner, { modal: modal, handlers: { onChange, onConfirm, onClose } }))] }) }));
803
797
  };
804
798
 
805
799
  const useSubscribeModal = (modal) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lerx/promise-modal",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Universal React modal utility that can be used outside React components with promise-based results for alert, confirm, and prompt modals",
5
5
  "keywords": [
6
6
  "react",