@gusarov-studio/rubik-ui 3.10.0 → 3.11.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.
- package/dist/ModalsManager/ModalDef.d.ts +9 -0
- package/dist/ModalsManager/ModalsManagerProvider.d.ts +7 -0
- package/dist/ModalsManager/ModalsView.d.ts +3 -0
- package/dist/ModalsManager/constants/actionTypes.d.ts +4 -0
- package/dist/ModalsManager/context.d.ts +2 -0
- package/dist/ModalsManager/dispatcher.d.ts +6 -0
- package/dist/ModalsManager/hooks/useModals.d.ts +3 -0
- package/dist/ModalsManager/hooks/useModalsContext.d.ts +2 -0
- package/dist/ModalsManager/hooks/useModalsState.d.ts +5 -0
- package/dist/ModalsManager/index.d.ts +6 -0
- package/dist/ModalsManager/modalsManager.d.ts +8 -0
- package/dist/ModalsManager/modalsRegistry.d.ts +13 -0
- package/dist/ModalsManager/types.d.ts +25 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.declarations.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ModalProps } from "./types";
|
|
3
|
+
interface ModalDefProps {
|
|
4
|
+
modalId: string;
|
|
5
|
+
component: React.ComponentType<any>;
|
|
6
|
+
defaultProps?: ModalProps;
|
|
7
|
+
}
|
|
8
|
+
declare function ModalDef(props: ModalDefProps): null;
|
|
9
|
+
export { ModalDef };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ModalsAction } from "./types";
|
|
3
|
+
type Dispatcher = React.Dispatch<ModalsAction>;
|
|
4
|
+
declare function registerDispatcher(dispatch: Dispatcher): void;
|
|
5
|
+
declare function dispatch(action: ModalsAction): void;
|
|
6
|
+
export { registerDispatcher, dispatch };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ModalsAction, ModalsManagerState } from "../types";
|
|
3
|
+
declare const reducer: (state: ModalsManagerState | undefined, action: ModalsAction) => ModalsManagerState;
|
|
4
|
+
declare function useModalsState(): [ModalsManagerState, React.Dispatch<ModalsAction>];
|
|
5
|
+
export { useModalsState, reducer };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ModalsManagerProvider } from "./ModalsManagerProvider";
|
|
2
|
+
export { ModalsView } from "./ModalsView";
|
|
3
|
+
export { ModalDef } from "./ModalDef";
|
|
4
|
+
export { useModals } from "./hooks/useModals";
|
|
5
|
+
export { modalsManager } from "./modalsManager";
|
|
6
|
+
export { type ModalsManager } from "./types";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ModalProps } from "./types";
|
|
2
|
+
declare const modalsManager: {
|
|
3
|
+
open(modalId: string, props?: ModalProps): void;
|
|
4
|
+
close(): void;
|
|
5
|
+
register: (modalId: string, Component: React.ComponentType<unknown>, defaultProps?: ModalProps) => void;
|
|
6
|
+
unregister: (modalId: string) => boolean;
|
|
7
|
+
};
|
|
8
|
+
export { modalsManager };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ModalProps, RegistryItem } from "./types";
|
|
3
|
+
declare function register(modalId: string, Component: React.ComponentType<unknown>, defaultProps?: ModalProps): void;
|
|
4
|
+
declare function unregister(modalId: string): boolean;
|
|
5
|
+
declare function get(modalId: string): RegistryItem | undefined;
|
|
6
|
+
declare function has(modalId: string): boolean;
|
|
7
|
+
declare const modalsRegistry: {
|
|
8
|
+
register: typeof register;
|
|
9
|
+
unregister: typeof unregister;
|
|
10
|
+
has: typeof has;
|
|
11
|
+
get: typeof get;
|
|
12
|
+
};
|
|
13
|
+
export { modalsRegistry };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { actionTypes } from "./constants/actionTypes";
|
|
3
|
+
export type ModalProps = Record<string, unknown>;
|
|
4
|
+
export interface ModalsManagerState {
|
|
5
|
+
activeDialogId: string | null;
|
|
6
|
+
props: ModalProps;
|
|
7
|
+
}
|
|
8
|
+
export interface ModalsManager {
|
|
9
|
+
open: (dialogId: string, props?: ModalProps) => void;
|
|
10
|
+
close: () => void;
|
|
11
|
+
}
|
|
12
|
+
export type ModalsContextState = ModalsManagerState;
|
|
13
|
+
export interface RegistryItem {
|
|
14
|
+
Component: React.ComponentType<unknown>;
|
|
15
|
+
props?: ModalProps;
|
|
16
|
+
}
|
|
17
|
+
export type ModalsAction = {
|
|
18
|
+
type: typeof actionTypes.OPEN_MODAL;
|
|
19
|
+
payload: {
|
|
20
|
+
modalId: string;
|
|
21
|
+
props?: ModalProps;
|
|
22
|
+
};
|
|
23
|
+
} | {
|
|
24
|
+
type: typeof actionTypes.CLOSE_MODAL;
|
|
25
|
+
};
|