aark-react-modalify 1.0.2 → 1.0.4
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/components/ModalProvider.d.ts +7 -0
- package/dist/components/ModalRenderer.d.ts +9 -0
- package/dist/hooks/useModal.d.ts +10 -0
- package/dist/index.d.ts +6 -0
- package/dist/logic/ModalManager.d.ts +20 -0
- package/dist/logic/aark.d.ts +13 -0
- package/dist/types/index.d.ts +26 -0
- package/dist/utils/theme.d.ts +40 -0
- package/package.json +9 -4
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import type { ModalConfig } from '../types';
|
|
3
|
+
import '../assets/styles/aark-modal.css';
|
|
4
|
+
interface ModalRendererProps {
|
|
5
|
+
config: ModalConfig;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
}
|
|
8
|
+
declare const ModalRenderer: FC<ModalRendererProps>;
|
|
9
|
+
export default ModalRenderer;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ModalConfig } from "../types";
|
|
2
|
+
export interface UseModalReturn {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
config: ModalConfig | null;
|
|
5
|
+
close: () => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Hook to manage modal state and listen to modal events
|
|
9
|
+
*/
|
|
10
|
+
export declare function useModal(): UseModalReturn;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as aark } from "./logic/aark";
|
|
2
|
+
export type { ModalOptions, ModalPosition, ModalMode, ModalConfig, ModalState, ModalEvent, ModalEventType, } from "./types";
|
|
3
|
+
export type { AarkModalTheme } from "./utils/theme";
|
|
4
|
+
export { setAarkModalTheme, resetAarkModalTheme, getAarkModalTheme, } from "./utils/theme";
|
|
5
|
+
export { useModal } from "./hooks/useModal";
|
|
6
|
+
export { default as ModalRenderer } from "./components/ModalRenderer";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ModalConfig, ModalOptions, ModalEvent } from "../types";
|
|
3
|
+
type ModalListener = (event: ModalEvent) => void;
|
|
4
|
+
declare function subscribe(listener: ModalListener): () => void;
|
|
5
|
+
declare function fire(content: ReactNode, options?: ModalOptions): void;
|
|
6
|
+
declare function close(): void;
|
|
7
|
+
declare function isOpen(): boolean;
|
|
8
|
+
declare function getCurrentConfig(): ModalConfig | null;
|
|
9
|
+
declare function closeAll(): void;
|
|
10
|
+
declare function cleanup(): void;
|
|
11
|
+
export declare const modalManager: {
|
|
12
|
+
subscribe: typeof subscribe;
|
|
13
|
+
fire: typeof fire;
|
|
14
|
+
close: typeof close;
|
|
15
|
+
isOpen: typeof isOpen;
|
|
16
|
+
getCurrentConfig: typeof getCurrentConfig;
|
|
17
|
+
closeAll: typeof closeAll;
|
|
18
|
+
cleanup: typeof cleanup;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ModalOptions } from "../types";
|
|
3
|
+
import type { AarkModalTheme } from "../utils/theme";
|
|
4
|
+
declare const aark: {
|
|
5
|
+
fire: (content: ReactNode, options?: ModalOptions) => void;
|
|
6
|
+
close: () => void;
|
|
7
|
+
isOpen: () => boolean;
|
|
8
|
+
closeAll: () => void;
|
|
9
|
+
setTheme: (theme: AarkModalTheme) => void;
|
|
10
|
+
resetTheme: () => void;
|
|
11
|
+
getTheme: () => AarkModalTheme;
|
|
12
|
+
};
|
|
13
|
+
export default aark;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export type ModalPosition = "center" | "top-center" | "top-right" | "bottom-right" | "bottom-center";
|
|
3
|
+
export type ModalMode = "modal" | "notification";
|
|
4
|
+
export interface ModalOptions {
|
|
5
|
+
position?: ModalPosition;
|
|
6
|
+
mode?: ModalMode;
|
|
7
|
+
showCloseIcon?: boolean;
|
|
8
|
+
autoCloseTime?: number;
|
|
9
|
+
className?: string;
|
|
10
|
+
overlayClassName?: string;
|
|
11
|
+
preventEscClose?: boolean;
|
|
12
|
+
preventOverlayClose?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ModalConfig {
|
|
15
|
+
content: ReactNode;
|
|
16
|
+
options?: ModalOptions;
|
|
17
|
+
}
|
|
18
|
+
export interface ModalState {
|
|
19
|
+
isOpen: boolean;
|
|
20
|
+
config: ModalConfig | null;
|
|
21
|
+
}
|
|
22
|
+
export type ModalEventType = "open" | "close" | "beforeClose";
|
|
23
|
+
export interface ModalEvent {
|
|
24
|
+
type: ModalEventType;
|
|
25
|
+
config?: ModalConfig;
|
|
26
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS Theme customization utilities for AARK React Modalify
|
|
3
|
+
*/
|
|
4
|
+
export interface AarkModalTheme {
|
|
5
|
+
overlayBackground?: string;
|
|
6
|
+
overlayBlur?: string;
|
|
7
|
+
modalBackground?: string;
|
|
8
|
+
modalBorderRadius?: string;
|
|
9
|
+
modalShadow?: string;
|
|
10
|
+
modalPadding?: string;
|
|
11
|
+
modalZIndex?: number;
|
|
12
|
+
modalContentZIndex?: number;
|
|
13
|
+
closeButtonColor?: string;
|
|
14
|
+
closeButtonHoverBackground?: string;
|
|
15
|
+
closeButtonHoverColor?: string;
|
|
16
|
+
closeButtonFocusOutline?: string;
|
|
17
|
+
animationDuration?: string;
|
|
18
|
+
fadeDuration?: string;
|
|
19
|
+
customOverlayBackground?: string;
|
|
20
|
+
customOverlayBlur?: string;
|
|
21
|
+
customModalGradientStart?: string;
|
|
22
|
+
customModalGradientEnd?: string;
|
|
23
|
+
customModalTextColor?: string;
|
|
24
|
+
customModalShadow?: string;
|
|
25
|
+
customModalCloseColor?: string;
|
|
26
|
+
customModalCloseHoverBackground?: string;
|
|
27
|
+
customModalCloseHoverColor?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Apply custom theme to AARK Modal CSS variables
|
|
31
|
+
*/
|
|
32
|
+
export declare function setAarkModalTheme(theme: AarkModalTheme): void;
|
|
33
|
+
/**
|
|
34
|
+
* Reset AARK Modal theme to default values
|
|
35
|
+
*/
|
|
36
|
+
export declare function resetAarkModalTheme(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Get current AARK Modal theme values
|
|
39
|
+
*/
|
|
40
|
+
export declare function getAarkModalTheme(): AarkModalTheme;
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aark-react-modalify",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "A lightweight, flexible React modal and notification library with TypeScript support. Features automatic DOM mounting, customizable styling, and a simple imperative API for displaying modals, alerts, confirmations, and toast notifications.",
|
|
5
|
+
"private": false,
|
|
5
6
|
"main": "dist/index.cjs.js",
|
|
6
7
|
"module": "dist/index.esm.js",
|
|
7
8
|
"types": "dist/index.d.ts",
|
|
@@ -20,7 +21,7 @@
|
|
|
20
21
|
"LICENSE"
|
|
21
22
|
],
|
|
22
23
|
"scripts": {
|
|
23
|
-
"build": "npm run clean && npm run build:
|
|
24
|
+
"build": "npm run clean && npm run build:lib && npm run build:types",
|
|
24
25
|
"build:lib": "vite build --config vite.lib.config.ts",
|
|
25
26
|
"build:types": "tsc --project tsconfig.build.json --emitDeclarationOnly",
|
|
26
27
|
"clean": "rimraf dist",
|
|
@@ -44,7 +45,11 @@
|
|
|
44
45
|
"imperative",
|
|
45
46
|
"lightweight",
|
|
46
47
|
"flexible",
|
|
47
|
-
"customizable"
|
|
48
|
+
"customizable",
|
|
49
|
+
"aark-react-modalify",
|
|
50
|
+
"aark-modal",
|
|
51
|
+
"aark-toast",
|
|
52
|
+
"aark-notification"
|
|
48
53
|
],
|
|
49
54
|
"peerDependencies": {
|
|
50
55
|
"react": ">=16.8.0",
|
|
@@ -73,7 +78,7 @@
|
|
|
73
78
|
"author": "Mohammad Sumon",
|
|
74
79
|
"repository": {
|
|
75
80
|
"type": "git",
|
|
76
|
-
"url": "https://github.com/sumonsbgc/aark-react-modalify.git"
|
|
81
|
+
"url": "git+https://github.com/sumonsbgc/aark-react-modalify.git"
|
|
77
82
|
},
|
|
78
83
|
"homepage": "https://github.com/sumonsbgc/aark-react-modalify#readme",
|
|
79
84
|
"bugs": {
|