react-confirm 0.4.0 → 0.5.0-1

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.
@@ -1,86 +0,0 @@
1
- import * as React from 'react';
2
-
3
- type ConfirmableProps<P, R> = {
4
- dispose: () => void;
5
- resolve: (value: R | PromiseLike<R>) => void;
6
- reject: (reason?: any) => void;
7
- } & P;
8
-
9
- type ConfirmableDialog<P, R> = React.ComponentType<ConfirmableProps<P, R>>;
10
-
11
- export type ConfirmDialogProps<P, R> = {
12
- /** Dismiss dialog without resolving the promise. */
13
- dismiss: () => void;
14
- /** Resolve the promise with the given value. */
15
- proceed: (value: R) => void;
16
- /** Reject the promise with the given value. */
17
- cancel: (value?: any) => void;
18
- /** Indicates if the dialog should be shown aka. someone is waiting for a promise. */
19
- show: boolean;
20
- } & P;
21
-
22
- export type ConfirmDialog<P, R> = React.ComponentType<ConfirmDialogProps<P, R>> ;
23
-
24
- export declare function confirmable<P, R>(
25
- component: ConfirmDialog<P, R>
26
- ): ConfirmableDialog<P, R>;
27
-
28
- export declare function createConfirmation<P, R>(
29
- component: ConfirmableDialog<P, R>,
30
- unmountDelay?: number,
31
- mountingNode?: HTMLElement,
32
- ): (props: P) => Promise<R>;
33
-
34
- type Mounter = {
35
- mount: (component: React.ComponentType, props: any, mountNode?: HTMLElement) => string
36
- unmount: (key: string) => void
37
- }
38
-
39
- type TreeMounter = {
40
- options: {
41
- setMountedCallback: (callback: (components: any) => void) => void
42
- mountNode?: Element | DocumentFragment | HTMLElement
43
- }
44
- } & Mounter
45
-
46
- export declare function createReactTreeMounter(mountNode?: Element | DocumentFragment | HTMLElement): TreeMounter;
47
- export declare function createMountPoint(mounter: TreeMounter): React.ComponentType;
48
- export declare function createDomTreeMounter(defaultMountNode?: Element | DocumentFragment | HTMLElement): Mounter;
49
- export declare function createConfirmationCreater(mounter: Mounter): typeof createConfirmation;
50
-
51
- // Context-aware confirmation system
52
- export interface ConfirmationContext {
53
- /**
54
- * Creates a confirmation function for a given component
55
- * @param component - The confirmable component
56
- * @param unmountDelay - Delay before unmounting the component (default: 1000ms)
57
- * @returns Confirmation function that returns a Promise
58
- */
59
- createConfirmation: <P, R>(
60
- component: ConfirmableDialog<P, R>,
61
- unmountDelay?: number
62
- ) => (props: P) => Promise<R>;
63
-
64
- /**
65
- * React component that must be rendered in your app to display confirmations
66
- * Place this component at the root level of your app or where you want confirmations to appear
67
- */
68
- ConfirmationRoot: React.ComponentType;
69
- }
70
-
71
- /**
72
- * Creates a React context-aware confirmation system.
73
- * This provides a simple interface for using confirmations within React component tree.
74
- *
75
- * @param mountNode - Optional DOM node to mount dialogs in
76
- * @returns Object containing createConfirmation function and ConfirmationRoot component
77
- */
78
- export declare function createConfirmationContext(
79
- mountNode?: Element | DocumentFragment | HTMLElement
80
- ): ConfirmationContext;
81
-
82
- /**
83
- * Context-aware confirmation system for convenient usage
84
- * Use this if you don't need custom mount nodes
85
- */
86
- export declare const ContextAwareConfirmation: ConfirmationContext;