@delightui/components 0.1.160 → 0.1.161
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/cjs/components/molecules/Modal/DemoModal.d.ts +1 -0
- package/dist/cjs/components/molecules/Modal/ModalContext/ModalContext.types.d.ts +24 -1
- package/dist/cjs/library.js +3 -3
- package/dist/cjs/library.js.map +1 -1
- package/dist/esm/components/molecules/Modal/DemoModal.d.ts +1 -0
- package/dist/esm/components/molecules/Modal/ModalContext/ModalContext.types.d.ts +24 -1
- package/dist/esm/library.js +3 -3
- package/dist/esm/library.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/package.json +1 -1
|
@@ -15,7 +15,8 @@ export type ModalInstance = {
|
|
|
15
15
|
/** Unique identifier for the modal instance */
|
|
16
16
|
id: string;
|
|
17
17
|
/** The rendered React component for the modal */
|
|
18
|
-
component:
|
|
18
|
+
component: React.ComponentType<any>;
|
|
19
|
+
props: ModalComponentProps;
|
|
19
20
|
};
|
|
20
21
|
/**
|
|
21
22
|
* The context type that provides modal management functionality.
|
|
@@ -43,6 +44,21 @@ export type ModalContextType = {
|
|
|
43
44
|
* ```
|
|
44
45
|
*/
|
|
45
46
|
openModal: <T extends ModalComponentProps>(id: string, Component: ComponentType<T>, props: T) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Updates the props of an existing modal by its unique identifier.
|
|
49
|
+
*
|
|
50
|
+
* @template T - The props type for the modal component (must extend ModalComponentProps)
|
|
51
|
+
* @param id - The unique identifier of the modal to update
|
|
52
|
+
* @param newProps - The new props to merge with the existing props
|
|
53
|
+
* @returns void
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* const { updateModal } = useModalContext();
|
|
58
|
+
* updateModal('confirmation', { title: 'Updated Title' });
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
updateModal: <T extends ModalComponentProps>(id: string, newProps: Partial<T>) => void;
|
|
46
62
|
/**
|
|
47
63
|
* Closes and removes a modal by its unique identifier.
|
|
48
64
|
*
|
|
@@ -84,4 +100,11 @@ export type UseModalReturn<T extends ModalComponentProps> = {
|
|
|
84
100
|
closeModal: () => void;
|
|
85
101
|
/** The unique identifier for this modal instance */
|
|
86
102
|
modalId: string;
|
|
103
|
+
/**
|
|
104
|
+
* Updates the props of the modal instance managed by this hook.
|
|
105
|
+
*
|
|
106
|
+
* @param newProps - The new props to merge with the existing props
|
|
107
|
+
* @returns void
|
|
108
|
+
*/
|
|
109
|
+
updateModal: (newProps: Partial<T>) => void;
|
|
87
110
|
};
|