@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/components/Modal/Modal/Modal.layout.d.ts +1 -1
- package/dist/components/Modal/Modal/Modal.store.d.ts +10 -7
- package/dist/web.cjs.development.js +48 -47
- package/dist/web.cjs.development.js.map +1 -1
- package/dist/web.cjs.production.min.js +1 -1
- package/dist/web.cjs.production.min.js.map +1 -1
- package/dist/web.esm.js +48 -47
- package/dist/web.esm.js.map +1 -1
- package/dist/web.umd.development.js +48 -47
- package/dist/web.umd.development.js.map +1 -1
- package/dist/web.umd.production.min.js +1 -1
- package/dist/web.umd.production.min.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ModalLayoutProps } from './Modal.props';
|
|
3
|
-
export declare const ModalLayout: ({ modals }: ModalLayoutProps) => React.JSX.Element | null;
|
|
3
|
+
export declare const ModalLayout: ({ modals: availableModals }: ModalLayoutProps) => React.JSX.Element | null;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
export interface
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export interface ModalItem {
|
|
2
|
+
name: string;
|
|
3
|
+
props: any & {
|
|
4
4
|
isVisible: boolean;
|
|
5
5
|
};
|
|
6
6
|
overlayProps: any;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
}
|
|
8
|
+
export interface ModalState {
|
|
9
|
+
modals: ModalItem[];
|
|
10
|
+
show: (name: string, modalProps?: any, overlayProps?: any) => void;
|
|
11
|
+
hide: (name?: string) => void;
|
|
9
12
|
}
|
|
10
13
|
export declare const useModalStore: any;
|
|
11
|
-
export declare const showModal: (
|
|
12
|
-
export declare const hideModal: () => void;
|
|
14
|
+
export declare const showModal: (name: string, modalProps?: any, overlayProps?: any) => void;
|
|
15
|
+
export declare const hideModal: (name?: string | undefined) => void;
|
|
@@ -6629,46 +6629,51 @@ var MessageLayout = _ref => {
|
|
|
6629
6629
|
};
|
|
6630
6630
|
|
|
6631
6631
|
var useModalStore = /*#__PURE__*/zustand.create(set => ({
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
isVisible: false
|
|
6635
|
-
},
|
|
6636
|
-
overlayProps: {},
|
|
6637
|
-
show: function show(modal, modalProps, overlayProps) {
|
|
6632
|
+
modals: [],
|
|
6633
|
+
show: function show(name, modalProps, overlayProps) {
|
|
6638
6634
|
if (modalProps === void 0) {
|
|
6639
6635
|
modalProps = {};
|
|
6640
6636
|
}
|
|
6641
6637
|
if (overlayProps === void 0) {
|
|
6642
6638
|
overlayProps = {};
|
|
6643
6639
|
}
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6640
|
+
set(state => ({
|
|
6641
|
+
modals: [...state.modals, {
|
|
6642
|
+
name,
|
|
6643
|
+
props: Object.assign({}, modalProps, {
|
|
6644
|
+
isVisible: true
|
|
6645
|
+
}),
|
|
6646
|
+
overlayProps
|
|
6647
|
+
}]
|
|
6651
6648
|
}));
|
|
6652
6649
|
},
|
|
6653
|
-
hide:
|
|
6654
|
-
set(state =>
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6650
|
+
hide: name => {
|
|
6651
|
+
set(state => {
|
|
6652
|
+
if (!name) {
|
|
6653
|
+
// Hide all modals
|
|
6654
|
+
return {
|
|
6655
|
+
modals: []
|
|
6656
|
+
};
|
|
6657
|
+
}
|
|
6658
|
+
// Hide specific modal by name
|
|
6659
|
+
return {
|
|
6660
|
+
modals: state.modals.filter(modal => modal.name !== name)
|
|
6661
|
+
};
|
|
6662
|
+
});
|
|
6659
6663
|
}
|
|
6660
6664
|
}));
|
|
6661
|
-
var showModal = function showModal(
|
|
6665
|
+
var showModal = function showModal(name, modalProps, overlayProps) {
|
|
6662
6666
|
if (modalProps === void 0) {
|
|
6663
6667
|
modalProps = {};
|
|
6664
6668
|
}
|
|
6665
6669
|
if (overlayProps === void 0) {
|
|
6666
6670
|
overlayProps = {};
|
|
6667
6671
|
}
|
|
6668
|
-
useModalStore.getState().show(
|
|
6672
|
+
useModalStore.getState().show(name, modalProps, overlayProps);
|
|
6669
6673
|
};
|
|
6670
|
-
var hideModal =
|
|
6671
|
-
|
|
6674
|
+
var hideModal = name => {
|
|
6675
|
+
console.log('hideModal', name);
|
|
6676
|
+
useModalStore.getState().hide(typeof name === 'string' ? name : undefined);
|
|
6672
6677
|
};
|
|
6673
6678
|
|
|
6674
6679
|
var ContainerShapes = {
|
|
@@ -6838,33 +6843,29 @@ var ModalFooter = _ref5 => {
|
|
|
6838
6843
|
|
|
6839
6844
|
var ModalLayout = _ref => {
|
|
6840
6845
|
var {
|
|
6841
|
-
modals
|
|
6846
|
+
modals: availableModals
|
|
6842
6847
|
} = _ref;
|
|
6843
|
-
var
|
|
6844
|
-
|
|
6845
|
-
modal,
|
|
6846
|
-
modalProps,
|
|
6847
|
-
overlayProps
|
|
6848
|
-
} = _ref2;
|
|
6849
|
-
return {
|
|
6850
|
-
modal,
|
|
6851
|
-
modalProps,
|
|
6852
|
-
overlayProps
|
|
6853
|
-
};
|
|
6854
|
-
});
|
|
6855
|
-
if (typeof modalStore.modal === 'boolean') {
|
|
6856
|
-
return null;
|
|
6857
|
-
}
|
|
6858
|
-
var Modal = modals[modalStore.modal];
|
|
6859
|
-
if (!Modal) {
|
|
6860
|
-
console.error(modalStore.modal + " modal doesn't exist");
|
|
6848
|
+
var activeModals = useModalStore(state => state.modals);
|
|
6849
|
+
if (activeModals.length === 0) {
|
|
6861
6850
|
return null;
|
|
6862
6851
|
}
|
|
6863
|
-
return /*#__PURE__*/React__default.createElement(React.Fragment, null,
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6852
|
+
return /*#__PURE__*/React__default.createElement(React.Fragment, null, activeModals.map((modal, index) => {
|
|
6853
|
+
var ModalComponent = availableModals[modal.name];
|
|
6854
|
+
if (!ModalComponent) {
|
|
6855
|
+
console.error(modal.name + " modal doesn't exist");
|
|
6856
|
+
return null;
|
|
6857
|
+
}
|
|
6858
|
+
return /*#__PURE__*/React__default.createElement(ModalOverlay, Object.assign({
|
|
6859
|
+
key: index,
|
|
6860
|
+
isOpen: modal.props.isVisible,
|
|
6861
|
+
onClose: () => hideModal(modal.name),
|
|
6862
|
+
blur: 5
|
|
6863
|
+
}, modal.overlayProps, {
|
|
6864
|
+
style: {
|
|
6865
|
+
zIndex: 1000 + index
|
|
6866
|
+
}
|
|
6867
|
+
}), /*#__PURE__*/React__default.createElement(ModalComponent, Object.assign({}, modal.props)));
|
|
6868
|
+
}));
|
|
6868
6869
|
};
|
|
6869
6870
|
|
|
6870
6871
|
/**
|