react-ecosistema-unp 0.9.5 → 0.9.6

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.
@@ -1,63 +1,71 @@
1
- import { jsxs as c, Fragment as m, jsx as i } from "react/jsx-runtime";
2
- import { useState as u, useRef as p, useEffect as h } from "react";
1
+ import { jsxs as s, Fragment as h, jsx as i } from "react/jsx-runtime";
2
+ import { useState as p, useRef as g, useEffect as y } from "react";
3
3
  import '../../assets/Bootstrap.css';import '../../assets/Paginador.css';/* empty css */
4
4
  /* empty css */
5
- import { C as g } from "../../Card-BXqmurzN.js";
6
- import { B as o } from "../../Button-DMwpnJlD.js";
7
- const j = ({ stepContent: a, onSubmit: s, canJump: d = !0 }) => {
8
- const [r, t] = u(0), l = p(null);
9
- return h(() => {
10
- l.current && r > 0 && l.current.scrollIntoView({
5
+ import { C as v } from "../../Card-BXqmurzN.js";
6
+ import { B as f } from "../../Button-DMwpnJlD.js";
7
+ const w = ({ stepContent: a, onSubmit: d, canJump: c = !0 }) => {
8
+ const [e, t] = p(0), o = g(null);
9
+ return y(() => {
10
+ o.current && e > 0 && o.current.scrollIntoView({
11
11
  behavior: "smooth"
12
12
  });
13
- }, [r]), /* @__PURE__ */ c(m, { children: [
14
- /* @__PURE__ */ i(g, { ref: l, className: "border-0 paginador-card", children: /* @__PURE__ */ i("ul", { id: "progressbar", children: a.map((n, e) => /* @__PURE__ */ c(
13
+ }, [e]), /* @__PURE__ */ s(h, { children: [
14
+ /* @__PURE__ */ i(v, { ref: o, className: "border-0 paginador-card", children: /* @__PURE__ */ i("ul", { id: "progressbar", children: a.map((l, r) => /* @__PURE__ */ s(
15
15
  "li",
16
16
  {
17
- className: e <= r ? "active" : "",
18
- onClick: () => {
19
- d ? d && t(e) : (e === r + 1 || e < r) && t(e);
17
+ className: r <= e ? "active" : "",
18
+ onClick: async () => {
19
+ if (a[e].handleNextClick && !c) {
20
+ const n = a[e].handleNextClick;
21
+ let u = !0;
22
+ if (n) {
23
+ const m = await n();
24
+ typeof m == "boolean" && (u = m);
25
+ }
26
+ u && t(e + 1);
27
+ } else c ? c && t(r) : (r === e + 1 || r < e) && t(r);
20
28
  },
21
29
  children: [
22
- /* @__PURE__ */ i("div", { className: `step ${e <= r ? "active" : ""}`, children: /* @__PURE__ */ i(n.icon, { size: 18 }) }),
23
- /* @__PURE__ */ i("strong", { children: n.label })
30
+ /* @__PURE__ */ i("div", { className: `step ${r <= e ? "active" : ""}`, children: /* @__PURE__ */ i(l.icon, { size: 18 }) }),
31
+ /* @__PURE__ */ i("strong", { children: l.label })
24
32
  ]
25
33
  },
26
- e
34
+ r
27
35
  )) }) }),
28
- /* @__PURE__ */ i("div", { className: "paginador-content", children: a[r].content }),
29
- /* @__PURE__ */ c("div", { className: "paginador-buttons", style: { display: "flex", justifyContent: "end" }, children: [
30
- r > 0 && /* @__PURE__ */ i(
31
- o,
36
+ /* @__PURE__ */ i("div", { className: "paginador-content", children: a[e].content }),
37
+ /* @__PURE__ */ s("div", { className: "paginador-buttons", style: { display: "flex", justifyContent: "end" }, children: [
38
+ e > 0 && /* @__PURE__ */ i(
39
+ f,
32
40
  {
33
41
  variant: "unp_secondary",
34
- onClick: () => t(r - 1),
42
+ onClick: () => t(e - 1),
35
43
  children: "Anterior"
36
44
  }
37
45
  ),
38
- r < a.length - 1 && /* @__PURE__ */ i(
39
- o,
46
+ e < a.length - 1 && /* @__PURE__ */ i(
47
+ f,
40
48
  {
41
49
  variant: "unp_primary",
42
50
  style: { justifySelf: "end", marginLeft: "1rem" },
43
51
  onClick: async () => {
44
- const n = a[r].handleNextClick;
45
- let e = !0;
46
- if (n) {
47
- const f = await n();
48
- typeof f == "boolean" && (e = f);
52
+ const l = a[e].handleNextClick;
53
+ let r = !0;
54
+ if (l) {
55
+ const n = await l();
56
+ typeof n == "boolean" && (r = n);
49
57
  }
50
- e && t(r + 1);
58
+ r && t(e + 1);
51
59
  },
52
60
  children: "Siguiente"
53
61
  }
54
62
  ),
55
- r === a.length - 1 && s && /* @__PURE__ */ i(
56
- o,
63
+ e === a.length - 1 && d && /* @__PURE__ */ i(
64
+ f,
57
65
  {
58
66
  type: "submit",
59
67
  variant: "unp_send",
60
- onClick: s,
68
+ onClick: d,
61
69
  style: { marginLeft: "1rem" },
62
70
  children: "Enviar"
63
71
  }
@@ -66,5 +74,5 @@ const j = ({ stepContent: a, onSubmit: s, canJump: d = !0 }) => {
66
74
  ] });
67
75
  };
68
76
  export {
69
- j as Paginador
77
+ w as Paginador
70
78
  };
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": "0.9.5",
5
+ "version": "0.9.6",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": {