@fullkekw/popup 2.0.8 → 2.0.10

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,6 +1,7 @@
1
1
  import { default as React, ReactNode } from 'react';
2
+ export type StateSetter<S = any> = React.Dispatch<React.SetStateAction<S>>;
2
3
  export type PopupWindowAnimationType = 'fade' | 'scale' | null;
3
- export interface PopupSettings {
4
+ export interface IPopupSettings {
4
5
  /** Prevent state change due to user interactions (only synthetic) */
5
6
  preventStateChange?: boolean;
6
7
  /**
@@ -22,35 +23,33 @@ export interface PopupSettings {
22
23
  */
23
24
  disableScroll?: boolean;
24
25
  }
25
- export interface PopupNode {
26
+ export interface IPopupNode {
26
27
  id: string;
27
28
  open: boolean;
28
29
  zIndex: number;
29
- settings: PopupSettings;
30
+ settings: IPopupSettings;
30
31
  }
31
- export interface PopupContextProps {
32
- nodes: PopupNode[];
33
- toggleNode(node: string | PopupNode, state?: boolean): void;
34
- registerNode(node: PopupNode): void;
32
+ export interface IPopupContextProps {
33
+ nodes: IPopupNode[];
34
+ toggleNode(node: string | IPopupNode, state?: boolean): void;
35
+ registerNode(node: IPopupNode): void;
35
36
  toggleDocument(id: string, e: React.MouseEvent): void;
36
37
  }
37
- export interface PopupLayerProps extends React.HTMLAttributes<HTMLElement> {
38
+ export interface IPopupLayerProps extends React.HTMLAttributes<HTMLElement> {
38
39
  children: ReactNode | ReactNode[];
39
- settings?: PopupSettings;
40
+ settings?: IPopupSettings;
40
41
  }
41
- export interface PopupWindowProps extends React.HTMLAttributes<HTMLElement> {
42
+ export interface IPopupWindowProps extends React.HTMLAttributes<HTMLElement> {
42
43
  id: string;
43
44
  children?: ReactNode | ReactNode[];
44
45
  layerClassName?: string;
45
- settings?: PopupSettings;
46
+ settings?: IPopupSettings;
46
47
  onOpen?(): void;
47
48
  onExit?(): void;
48
- /** Render popup in DOM only when user requested it */
49
- renderOnDemand?: boolean;
50
49
  /** Passed useState value */
51
50
  isOpen?: boolean;
52
51
  /** Passed useState setter */
53
- setIsOpen?(isOpen: boolean): void;
52
+ setIsOpen?: StateSetter<boolean>;
54
53
  /**
55
54
  * Popup animation
56
55
  *
@@ -58,7 +57,7 @@ export interface PopupWindowProps extends React.HTMLAttributes<HTMLElement> {
58
57
  */
59
58
  animation?: PopupWindowAnimationType;
60
59
  }
61
- export interface PopupButtonProps extends React.HTMLAttributes<HTMLElement> {
60
+ export interface IPopupButtonProps extends React.HTMLAttributes<HTMLElement> {
62
61
  popupId: string;
63
62
  children?: ReactNode | ReactNode[];
64
63
  onClick?(e: React.MouseEvent): void;
package/dist/Package.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  import { FC } from 'react';
2
- import { PopupButtonProps, PopupLayerProps, PopupWindowProps } from './Interfaces';
2
+ import { IPopupButtonProps, IPopupLayerProps, IPopupWindowProps } from './Interfaces';
3
3
  /**
4
4
  * Popup context provider. Must be inside body tag and in client environment (NextJS)
5
5
  */
6
- export declare const PopupLayer: FC<PopupLayerProps>;
6
+ export declare const PopupLayer: FC<IPopupLayerProps>;
7
7
  /**
8
8
  * Popup window
9
9
  */
10
- export declare const PopupWindow: FC<PopupWindowProps>;
10
+ export declare const PopupWindow: FC<IPopupWindowProps>;
11
11
  /**
12
12
  * Popup trigger button
13
13
  */
14
- export declare const PopupButton: FC<PopupButtonProps>;
14
+ export declare const PopupButton: FC<IPopupButtonProps>;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export * from './Package';
2
2
  export * as default from './Package';
3
- export type { PopupSettings, PopupWindowAnimationType, PopupLayerProps, PopupButtonProps, PopupWindowProps } from './Interfaces';
3
+ export type { IPopupSettings as PopupSettings, PopupWindowAnimationType, IPopupLayerProps as PopupLayerProps, IPopupButtonProps as PopupButtonProps, IPopupWindowProps as PopupWindowProps } from './Interfaces';