react-ecosistema-unp 1.7.0-pre.1 → 1.7.0-pre.3

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.
@@ -2,7 +2,7 @@ interface UseFetchGenericoParams<T> {
2
2
  endpoint: string;
3
3
  localJsonPath?: string;
4
4
  label?: string;
5
- dependencia?: number | null;
5
+ dependencia?: number | string | null;
6
6
  queryParamKey?: string;
7
7
  all?: boolean;
8
8
  filtrarResultados?: (item: T) => boolean;
@@ -1 +1 @@
1
- export declare const useWebSocket: (url: string, onMessage: (data: any) => void) => void;
1
+ export declare const useWebSocket: (url: string, onMessage?: (data: any) => void) => void;
@@ -1,36 +1,36 @@
1
1
  import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
- import { useState as i, useEffect as h } from "react";
2
+ import { useState as d, useEffect as u } from "react";
3
3
  import '../../../assets/Modal.css';/* empty css */
4
4
  const f = ({
5
5
  show: o,
6
- onHide: a,
6
+ onHide: t,
7
7
  title: c,
8
8
  children: r,
9
9
  closeModalOut: m
10
10
  }) => {
11
- const [l, t] = i(!1), [d, s] = i(!1);
12
- return h(() => {
13
- o ? t(!0) : (s(!0), setTimeout(() => {
14
- t(!1), s(!1);
11
+ const [l, a] = d(!1), [i, s] = d(!1);
12
+ return u(() => {
13
+ o ? a(!0) : (s(!0), setTimeout(() => {
14
+ a(!1), s(!1);
15
15
  }, 200));
16
16
  }, [o]), /* @__PURE__ */ e(
17
17
  "div",
18
18
  {
19
- className: `modal-overlay ${l ? "show" : ""} ${d ? "hide" : ""}`,
19
+ className: `modal-overlay ${l ? "show" : ""} ${i ? "hide" : ""}`,
20
20
  onClick: () => {
21
21
  m && (s(!0), setTimeout(() => {
22
- a(), s(!1);
22
+ t(), s(!1);
23
23
  }, 200));
24
24
  },
25
25
  children: /* @__PURE__ */ n(
26
26
  "div",
27
27
  {
28
- className: `modal-container ${l ? "show" : ""} ${d ? "hide" : ""}`,
29
- onClick: (u) => u.stopPropagation(),
28
+ className: `modal-container ${l ? "show" : ""} ${i ? "hide" : ""}`,
29
+ onClick: (h) => h.stopPropagation(),
30
30
  children: [
31
31
  /* @__PURE__ */ n("div", { className: "modal_header", children: [
32
32
  /* @__PURE__ */ e("span", { children: c }),
33
- /* @__PURE__ */ e("button", { className: "close_button", onClick: a, type: "button", children: "×" })
33
+ /* @__PURE__ */ e("button", { className: "close_button", onClick: t, type: "button", children: "×" })
34
34
  ] }),
35
35
  /* @__PURE__ */ e("div", { className: "modal_body", children: r })
36
36
  ]
@@ -38,8 +38,8 @@ const f = ({
38
38
  )
39
39
  }
40
40
  );
41
- }, M = (o) => (process.env.NODE_ENV === "development" && console.warn("[CustomModal] is deprecated. Please use [EcoModal] instead."), /* @__PURE__ */ e(f, { ...o }));
41
+ }, b = (o) => /* @__PURE__ */ e(f, { ...o });
42
42
  export {
43
- M as CustomModal,
43
+ b as CustomModal,
44
44
  f as EcoModal
45
45
  };
@@ -1,16 +1,17 @@
1
1
  import { useEffect as b } from "react";
2
- import { webSocketService as e } from "./websocket.js";
3
- const i = (c, s) => {
2
+ import { webSocketService as c } from "./websocket.js";
3
+ const u = (t, e) => {
4
4
  b(() => {
5
- e.connect(c);
6
- const t = (r) => {
7
- s(r);
8
- }, o = e.subscribe(t);
9
- return () => {
10
- o(), e.unsubscribe(t);
11
- };
12
- }, [c, s]);
5
+ if (c.connect(t), e) {
6
+ const r = (s) => {
7
+ e(s);
8
+ }, o = c.subscribe(r);
9
+ return () => {
10
+ o(), c.unsubscribe(r);
11
+ };
12
+ }
13
+ }, [t, e]);
13
14
  };
14
15
  export {
15
- i as useWebSocket
16
+ u as useWebSocket
16
17
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "react-ecosistema-unp",
3
3
  "author": "Ecosistema de Información - Unidad Nacional de Protección",
4
4
  "private": false,
5
- "version": "1.7.0-pre.1",
5
+ "version": "1.7.0-pre.3",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": {