dynamic-modal 1.1.10 → 1.1.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dynamic-modal",
3
- "version": "1.1.10",
3
+ "version": "1.1.12",
4
4
  "description": "The dynamic-modal is a solution of creation different modals into project using a json configuration file",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,4 +1,7 @@
1
+ 'use client';
2
+
1
3
  import { useState } from 'react';
4
+
2
5
  import {
3
6
  IModalRenderAction,
4
7
  IModalRenderCondition,
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { IModalLiveDataCondition } from '../interfaces/modal';
2
4
  import { useState } from 'react';
3
5
  import { IOption } from '../interfaces/option';
@@ -1,4 +1,7 @@
1
+ 'use client';
2
+
1
3
  import { useState } from 'react';
4
+
2
5
  import {
3
6
  IModalRenderAction,
4
7
  IModalRenderCondition,
package/src/modal.tsx CHANGED
@@ -28,8 +28,12 @@ import { IMakeButton } from './interfaces/make-button';
28
28
  import { ComponentStateContext } from './context/component/component-state';
29
29
 
30
30
  export const Modal = ({ open, close, config }: IModal) => {
31
- const { ModalButtonAction, ModalButtonCancel } = useContext(ComponentStateContext);
32
- const [modalReady, setModalReady] = useState<IModalConfigProps | undefined>(undefined);
31
+ const { ModalButtonAction, ModalButtonCancel } = useContext(
32
+ ComponentStateContext,
33
+ );
34
+ const [modalReady, setModalReady] = useState<IModalConfigProps | undefined>(
35
+ undefined,
36
+ );
33
37
  const [defaultLoaded, setDefaultLoaded] = useState<boolean>(false);
34
38
 
35
39
  const {
@@ -160,7 +164,7 @@ export const Modal = ({ open, close, config }: IModal) => {
160
164
  setTimeout(() => {
161
165
  setModalReady(undefined);
162
166
  setDefaultLoaded(false);
163
- reset()
167
+ reset();
164
168
  close();
165
169
  }, 200);
166
170
  };
@@ -196,7 +200,7 @@ export const Modal = ({ open, close, config }: IModal) => {
196
200
  if (open && !modalReady) setModalReady(config);
197
201
  }, [config, modalReady, open]);
198
202
 
199
- if(!modalReady) return null
203
+ if (!modalReady) return null;
200
204
 
201
205
  return (
202
206
  <Portal closeTime={200} portalOpen={open} portalTag={'#modal-portal'}>
@@ -286,7 +290,7 @@ export const Modal = ({ open, close, config }: IModal) => {
286
290
  </form>
287
291
  </div>
288
292
  </Portal>
289
- )
293
+ );
290
294
  };
291
295
 
292
296
  export default Modal;
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import { IOption } from '../../interfaces/option';
2
4
 
3
5
  export const liveDataAction = async (