react-transition-state 1.2.0-alpha.2 → 1.2.0-alpha.3
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/package.json +1 -1
- package/types/index.d.ts +19 -13
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -7,6 +7,12 @@ export type TransitionState =
|
|
|
7
7
|
| 'exited'
|
|
8
8
|
| 'unmounted';
|
|
9
9
|
|
|
10
|
+
export interface State {
|
|
11
|
+
state: TransitionState;
|
|
12
|
+
isMounted: boolean;
|
|
13
|
+
isEnter: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
10
16
|
export interface TransitionOptions {
|
|
11
17
|
initialEntered?: boolean;
|
|
12
18
|
mountOnEnter?: boolean;
|
|
@@ -19,26 +25,26 @@ export interface TransitionOptions {
|
|
|
19
25
|
onChange?: (event: { state: TransitionState }) => void;
|
|
20
26
|
}
|
|
21
27
|
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
) => [TransitionState, (toEnter?: boolean) => void, () => void];
|
|
25
|
-
|
|
26
|
-
interface State {
|
|
27
|
-
state: TransitionState;
|
|
28
|
-
isMounted: boolean;
|
|
29
|
-
isEnter: boolean;
|
|
28
|
+
export interface TransitionItemOptions<K> extends Omit<TransitionOptions, 'onChange'> {
|
|
29
|
+
onChange?: (event: { key: K } & State) => void;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export interface TransitionMapOptions
|
|
33
|
-
|
|
32
|
+
export interface TransitionMapOptions {
|
|
33
|
+
singleEnter?: boolean;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export
|
|
36
|
+
export type TransitionResult = [TransitionState, (toEnter?: boolean) => void, () => void];
|
|
37
|
+
|
|
38
|
+
export interface TransitionMapResult<K> {
|
|
37
39
|
stateMap: Omit<Map<K, State>, 'clear' | 'delete' | 'set'>;
|
|
38
40
|
toggle: (key: K, toEnter?: boolean) => void;
|
|
39
41
|
endTransition: (key: K) => void;
|
|
40
|
-
setItem: (key: K, options?:
|
|
42
|
+
setItem: (key: K, options?: TransitionItemOptions<K>) => void;
|
|
41
43
|
deleteItem: (key: K) => boolean;
|
|
42
|
-
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const useTransition: (options?: TransitionOptions) => TransitionResult;
|
|
47
|
+
|
|
48
|
+
export const useTransitionMap: <K>(options?: TransitionMapOptions) => TransitionMapResult<K>;
|
|
43
49
|
|
|
44
50
|
export default useTransition;
|