react-ecosistema-unp 0.9.5 → 0.9.7

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 @@ interface TarjetaProps {
3
3
  title: string;
4
4
  children: React.ReactNode;
5
5
  method?: string;
6
+ validated?: boolean;
6
7
  onSubmit?: (...args: any[]) => any;
7
8
  }
8
9
  declare const Tarjeta: React.FC<TarjetaProps>;
@@ -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
  };
@@ -1,33 +1,42 @@
1
- import { jsxs as l, Fragment as u, jsx as a } from "react/jsx-runtime";
2
- import e from "react";
1
+ import { jsxs as l, Fragment as f, jsx as a } from "react/jsx-runtime";
2
+ import t from "react";
3
3
  import '../../assets/Bootstrap.css';import '../../assets/Tarjeta.css';/* empty css */
4
4
  /* empty css */
5
- import { C as f, a as C } from "../../Card-BXqmurzN.js";
6
- import { C as j } from "../../CardBody-RoDe1y90.js";
7
- import { B as S } from "../../Button-DMwpnJlD.js";
8
- const b = {
5
+ import { C, a as j } from "../../Card-BXqmurzN.js";
6
+ import { C as S } from "../../CardBody-RoDe1y90.js";
7
+ import { B as b } from "../../Button-DMwpnJlD.js";
8
+ const g = {
9
9
  marginBottom: "20px",
10
10
  width: "100px"
11
- }, v = ({
11
+ }, V = ({
12
12
  title: p,
13
13
  children: s,
14
14
  method: n,
15
- onSubmit: m
15
+ validated: m = !1,
16
+ onSubmit: d
16
17
  }) => {
17
- const r = e.Children.toArray(s), c = r[0] && e.isValidElement(r[0]) && r[0].type.displayName === "Subtitulo", i = r.filter(
18
- (t) => e.isValidElement(t) && t.type.displayName === "SeccionTarjeta"
19
- ), d = i.length > 0, y = e.Children.map(s, (t, o) => e.isValidElement(t) && t.type.displayName === "SeccionTarjeta" ? e.cloneElement(t, {
20
- isGray: t.props.isGray ?? o % 2 === 1,
21
- isLast: t.props.isLast ?? o === i.length - 1
22
- }) : t);
23
- return /* @__PURE__ */ l(u, { children: [
24
- /* @__PURE__ */ l(f, { className: "border-0 mb-4 tarjeta-unp", children: [
25
- /* @__PURE__ */ a(C, { className: "d-flex justify-content-between align-items-center bg-unp text-light py-3 tarjeta-header-unp", children: p }),
26
- d ? y : /* @__PURE__ */ a(j, { className: `${c ? "pt-0" : ""}`, children: s })
18
+ const r = t.Children.toArray(s), c = r[0] && t.isValidElement(r[0]) && r[0].type.displayName === "Subtitulo", i = r.filter(
19
+ (e) => t.isValidElement(e) && e.type.displayName === "SeccionTarjeta"
20
+ ), y = i.length > 0, u = t.Children.map(s, (e, o) => t.isValidElement(e) && e.type.displayName === "SeccionTarjeta" ? t.cloneElement(e, {
21
+ isGray: e.props.isGray ?? o % 2 === 1,
22
+ isLast: e.props.isLast ?? o === i.length - 1
23
+ }) : e);
24
+ return /* @__PURE__ */ l(f, { children: [
25
+ /* @__PURE__ */ l(C, { className: "border-0 mb-4 tarjeta-unp", children: [
26
+ /* @__PURE__ */ a(j, { className: "d-flex justify-content-between align-items-center bg-unp text-light py-3 tarjeta-header-unp", children: p }),
27
+ /* @__PURE__ */ a(
28
+ "form",
29
+ {
30
+ method: n,
31
+ noValidate: !0,
32
+ className: m ? "was-validated" : "",
33
+ children: y ? u : /* @__PURE__ */ a(S, { className: `${c ? "pt-0" : ""}`, children: s })
34
+ }
35
+ )
27
36
  ] }),
28
- n === "POST" || n === "post" && /* @__PURE__ */ a("div", { style: { display: "flex", justifyContent: "end" }, children: /* @__PURE__ */ a(S, { variant: "unp_send", style: b, onClick: m, children: "Enviar" }) })
37
+ n === "POST" || n === "post" && /* @__PURE__ */ a("div", { style: { display: "flex", justifyContent: "end" }, children: /* @__PURE__ */ a(b, { variant: "unp_send", style: g, onClick: d, children: "Enviar" }) })
29
38
  ] });
30
39
  };
31
40
  export {
32
- v as Tarjeta
41
+ V as Tarjeta
33
42
  };
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.7",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": {