@app-studio/web 0.8.40 → 0.8.41

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/web.esm.js CHANGED
@@ -6622,46 +6622,51 @@ var MessageLayout = _ref => {
6622
6622
  };
6623
6623
 
6624
6624
  var useModalStore = /*#__PURE__*/create(set => ({
6625
- modal: false,
6626
- modalProps: {
6627
- isVisible: false
6628
- },
6629
- overlayProps: {},
6630
- show: function show(modal, modalProps, overlayProps) {
6625
+ modals: [],
6626
+ show: function show(name, modalProps, overlayProps) {
6631
6627
  if (modalProps === void 0) {
6632
6628
  modalProps = {};
6633
6629
  }
6634
6630
  if (overlayProps === void 0) {
6635
6631
  overlayProps = {};
6636
6632
  }
6637
- if (modal) {
6638
- modalProps.isVisible = true;
6639
- }
6640
- set(state => Object.assign({}, state, {
6641
- modal,
6642
- modalProps,
6643
- overlayProps
6633
+ set(state => ({
6634
+ modals: [...state.modals, {
6635
+ name,
6636
+ props: Object.assign({}, modalProps, {
6637
+ isVisible: true
6638
+ }),
6639
+ overlayProps
6640
+ }]
6644
6641
  }));
6645
6642
  },
6646
- hide: () => {
6647
- set(state => Object.assign({}, state, {
6648
- modalProps: Object.assign({}, state.modalProps, {
6649
- isVisible: false
6650
- })
6651
- }));
6643
+ hide: name => {
6644
+ set(state => {
6645
+ if (!name) {
6646
+ // Hide all modals
6647
+ return {
6648
+ modals: []
6649
+ };
6650
+ }
6651
+ // Hide specific modal by name
6652
+ return {
6653
+ modals: state.modals.filter(modal => modal.name !== name)
6654
+ };
6655
+ });
6652
6656
  }
6653
6657
  }));
6654
- var showModal = function showModal(modal, modalProps, overlayProps) {
6658
+ var showModal = function showModal(name, modalProps, overlayProps) {
6655
6659
  if (modalProps === void 0) {
6656
6660
  modalProps = {};
6657
6661
  }
6658
6662
  if (overlayProps === void 0) {
6659
6663
  overlayProps = {};
6660
6664
  }
6661
- useModalStore.getState().show(modal, modalProps, overlayProps);
6665
+ useModalStore.getState().show(name, modalProps, overlayProps);
6662
6666
  };
6663
- var hideModal = () => {
6664
- useModalStore.getState().hide();
6667
+ var hideModal = name => {
6668
+ console.log('hideModal', name);
6669
+ useModalStore.getState().hide(typeof name === 'string' ? name : undefined);
6665
6670
  };
6666
6671
 
6667
6672
  var ContainerShapes = {
@@ -6831,33 +6836,29 @@ var ModalFooter = _ref5 => {
6831
6836
 
6832
6837
  var ModalLayout = _ref => {
6833
6838
  var {
6834
- modals
6839
+ modals: availableModals
6835
6840
  } = _ref;
6836
- var modalStore = useModalStore(_ref2 => {
6837
- var {
6838
- modal,
6839
- modalProps,
6840
- overlayProps
6841
- } = _ref2;
6842
- return {
6843
- modal,
6844
- modalProps,
6845
- overlayProps
6846
- };
6847
- });
6848
- if (typeof modalStore.modal === 'boolean') {
6849
- return null;
6850
- }
6851
- var Modal = modals[modalStore.modal];
6852
- if (!Modal) {
6853
- console.error(modalStore.modal + " modal doesn't exist");
6841
+ var activeModals = useModalStore(state => state.modals);
6842
+ if (activeModals.length === 0) {
6854
6843
  return null;
6855
6844
  }
6856
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(ModalOverlay, Object.assign({
6857
- isOpen: modalStore.modalProps.isVisible,
6858
- onClose: hideModal,
6859
- blur: 10
6860
- }, modalStore.overlayProps), Modal !== undefined && /*#__PURE__*/React.createElement(Modal, Object.assign({}, modalStore.modalProps))));
6845
+ return /*#__PURE__*/React.createElement(Fragment, null, activeModals.map((modal, index) => {
6846
+ var ModalComponent = availableModals[modal.name];
6847
+ if (!ModalComponent) {
6848
+ console.error(modal.name + " modal doesn't exist");
6849
+ return null;
6850
+ }
6851
+ return /*#__PURE__*/React.createElement(ModalOverlay, Object.assign({
6852
+ key: index,
6853
+ isOpen: modal.props.isVisible,
6854
+ onClose: () => hideModal(modal.name),
6855
+ blur: 5
6856
+ }, modal.overlayProps, {
6857
+ style: {
6858
+ zIndex: 1000 + index
6859
+ }
6860
+ }), /*#__PURE__*/React.createElement(ModalComponent, Object.assign({}, modal.props)));
6861
+ }));
6861
6862
  };
6862
6863
 
6863
6864
  /**