@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.
@@ -3,6 +3,7 @@ import type { ModalComponentProps } from './ModalContext';
3
3
  interface DemoModalProps extends ModalComponentProps {
4
4
  title?: string;
5
5
  message?: string;
6
+ isLoading?: boolean;
6
7
  }
7
8
  declare const DemoModal: React.FC<DemoModalProps>;
8
9
  export default DemoModal;
@@ -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: ReactNode;
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
  };