react-motion-modal 1.1.3 → 1.1.4
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/README.md +1 -1
- package/dist/index.d.ts +10 -9
- package/dist/index.js +1117 -1093
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -118,7 +118,7 @@ Each modal automatically receives the following props:
|
|
|
118
118
|
|
|
119
119
|
- Zustand-based, framework-agnostic state management
|
|
120
120
|
- Built-in animation system powered by [Framer Motion](https://www.framer.com/motion/)
|
|
121
|
-
- You can implement a `ModalRenderer` to dynamically render modals from `
|
|
121
|
+
- You can implement a `ModalRenderer` to dynamically render modals from `modals` state
|
|
122
122
|
- Great for complex apps requiring nested or dynamic modal stacks
|
|
123
123
|
|
|
124
124
|
---
|
package/dist/index.d.ts
CHANGED
|
@@ -4,13 +4,13 @@ import { StoreApi } from 'zustand/vanilla';
|
|
|
4
4
|
import { TargetAndTransition } from 'motion';
|
|
5
5
|
import { UseBoundStore } from 'zustand/react';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
declare type ActiveModal = {
|
|
8
8
|
id: string;
|
|
9
9
|
name: ModalName;
|
|
10
10
|
params?: Params<ModalName>;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
declare type BaseModalParams = {
|
|
14
14
|
/**
|
|
15
15
|
* Function to close the modal
|
|
16
16
|
*/
|
|
@@ -50,32 +50,33 @@ export declare type BaseModalParams = {
|
|
|
50
50
|
};
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
declare type ModalAction = {
|
|
54
54
|
closeModal: (name?: ModalName) => void;
|
|
55
55
|
closeAllModal: () => void;
|
|
56
56
|
openModal: <T extends ModalName>(name: T, params?: Omit<Params<T>, 'closeModal'>) => void;
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
declare type ModalComponent<T = any> = (props: T) => ReactElement;
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
declare type ModalConfig = {
|
|
62
62
|
[K in ModalName]: ModalComponent<Params<K>>;
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
export declare interface ModalDefinition {
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
declare type ModalName = keyof ModalDefinition;
|
|
69
69
|
|
|
70
70
|
export declare type ModalParams<T extends ModalName> = Omit<Params<T>, 'animate' | 'body' | 'container' | 'onClose'>;
|
|
71
71
|
|
|
72
72
|
export declare const ModalProvider: ({ modals, initialParams }: Props) => ReactPortal | null;
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
declare type ModalState = {
|
|
75
|
+
modals: ActiveModal[];
|
|
76
|
+
active?: ActiveModal;
|
|
76
77
|
};
|
|
77
78
|
|
|
78
|
-
|
|
79
|
+
declare type Params<T extends ModalName> = ModalDefinition[T] & BaseModalParams;
|
|
79
80
|
|
|
80
81
|
declare type Props = {
|
|
81
82
|
modals: ModalConfig;
|