react-side-sheet-pro 0.1.0

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.
@@ -0,0 +1,60 @@
1
+ /// <reference types="react" />
2
+ import { ReactNode } from "react";
3
+ type Sides = "left" | "right";
4
+ interface SideSheetOptions {
5
+ side: Sides;
6
+ mountStrategy: "all" | "top-only";
7
+ }
8
+ interface SideOptions {
9
+ width?: number;
10
+ className?: string;
11
+ confirmBeforeClose?: boolean;
12
+ confirmMessage?: string;
13
+ confirmCallback?: (message: string) => Promise<boolean>;
14
+ closeOnOverlayClick?: boolean;
15
+ closeOnEsc?: boolean;
16
+ animationDuration?: number;
17
+ onOpen?: (id: number) => void;
18
+ onClose?: (id: number) => void;
19
+ }
20
+ interface SideElementProps {
21
+ sideId: number;
22
+ close: (id: number | null) => Promise<void>;
23
+ open: (element: SideElement, options?: SideOptions) => number;
24
+ update: (id: number, options: SideOptions) => void;
25
+ options: SideOptions;
26
+ }
27
+ type SideElement = (props: SideElementProps) => ReactNode;
28
+ interface SideStackItem {
29
+ id: number;
30
+ element: SideElement;
31
+ options: Required<SideOptions>;
32
+ state: "opening" | "open" | "closing";
33
+ }
34
+ interface SideSheetContextValue {
35
+ open: (el: SideElement, opts?: SideOptions) => number;
36
+ close: (id: number | null) => Promise<void>;
37
+ update: (id: number, opts: SideOptions) => void;
38
+ config: SideSheetOptions;
39
+ }
40
+ declare const useSideSheet: () => SideSheetContextValue;
41
+ declare const SideSheet: {
42
+ Provider: import("react").FC<{
43
+ children: import("react").ReactNode;
44
+ configuration: Partial<SideSheetOptions>;
45
+ }>;
46
+ Header: import("react").FC<{
47
+ title: string;
48
+ onClose?: (() => void) | undefined;
49
+ actions?: import("react").ReactNode;
50
+ }>;
51
+ Content: import("react").FC<{
52
+ children: import("react").ReactNode;
53
+ className?: string | undefined;
54
+ }>;
55
+ Footer: import("react").FC<{
56
+ children: import("react").ReactNode;
57
+ className?: string | undefined;
58
+ }>;
59
+ };
60
+ export { useSideSheet, Sides, SideSheetOptions, SideOptions, SideElementProps, SideElement, SideStackItem, SideSheetContextValue, SideSheet };