bmi-next-brokers 2.4.4 → 2.4.5

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,5 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { ButtonSize, ButtonVariant } from '../Button';
3
+ import { IconConfig } from '../Button/Button';
3
4
  type ModalButtonProps = {
4
5
  show?: boolean;
5
6
  text?: string;
@@ -10,6 +11,7 @@ type ModalButtonProps = {
10
11
  loading?: boolean;
11
12
  id?: string;
12
13
  className?: string;
14
+ icon?: IconConfig;
13
15
  };
14
16
  /**
15
17
  * Props del Modal
@@ -29,6 +31,9 @@ export interface ModalProps extends React.HTMLAttributes<HTMLSpanElement> {
29
31
  withScroll?: boolean;
30
32
  fullWidthFooter?: boolean;
31
33
  helperElement?: React.ReactNode;
34
+ titleClassName?: string;
35
+ contentClassName?: string;
36
+ footerClassName?: string;
32
37
  }
33
38
  /**
34
39
  * Modal con overlay, header, body y footer configurable.
@@ -109,5 +114,5 @@ export interface ModalProps extends React.HTMLAttributes<HTMLSpanElement> {
109
114
  * }
110
115
  * ```
111
116
  */
112
- export declare const Modal: ({ isOpen, title, children, width, confirmButton, cancelButton, zIndex, className, style, onClickOverlay, onClose, closeModal, withScroll, fullWidthFooter, helperElement, ...props }: ModalProps) => React.ReactPortal | null;
117
+ export declare const Modal: ({ isOpen, title, children, width, confirmButton, cancelButton, zIndex, className, titleClassName, contentClassName, footerClassName, style, onClickOverlay, onClose, closeModal, withScroll, fullWidthFooter, helperElement, ...props }: ModalProps) => React.ReactPortal | null;
113
118
  export {};
@@ -1,98 +1,107 @@
1
- import { jsx as a, jsxs as h } from "react/jsx-runtime";
2
- import { useRef as p, useState as v, useEffect as M } from "react";
3
- import { Icon as q } from "../../icons/Icon.js";
4
- import { useScrollLock as G } from "../../hooks/useScrollLock.js";
5
- import { CloseContext as J } from "../../hooks/useClose.js";
6
- import { Button as E } from "../Button/Button.js";
7
- import { createPortal as K } from "react-dom";
8
- import '../../assets/index7.css';const Q = "_modalOverlay_1hyzx_1", U = "_closing_1hyzx_15", c = "_modalLayout_1hyzx_37", u = "_modal_1hyzx_1", n = "_modalHeader_1hyzx_57", B = "_withBorder_1hyzx_65", ss = "_modalTitle_1hyzx_70", es = "_closeIcon_1hyzx_82", ls = "_modalBody_1hyzx_95", as = "_modalFooter_1hyzx_106", ds = "_buttonsDiv_1hyzx_111", rs = "_fullWidthFooter_1hyzx_121", l = {
9
- modalOverlay: Q,
10
- closing: U,
11
- modalLayout: c,
12
- modal: u,
13
- modalHeader: n,
14
- withBorder: B,
15
- modalTitle: ss,
16
- closeIcon: es,
17
- modalBody: ls,
18
- modalFooter: as,
19
- buttonsDiv: ds,
20
- fullWidthFooter: rs
21
- }, bs = ({
1
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
2
+ import { useRef as I, useState as v, useEffect as K } from "react";
3
+ import { Icon as Q } from "../../icons/Icon.js";
4
+ import { useScrollLock as U } from "../../hooks/useScrollLock.js";
5
+ import { CloseContext as c } from "../../hooks/useClose.js";
6
+ import { Button as S } from "../Button/Button.js";
7
+ import { createPortal as t } from "react-dom";
8
+ import '../../assets/index7.css';const u = "_modalOverlay_1hyzx_1", n = "_closing_1hyzx_15", B = "_modalLayout_1hyzx_37", ss = "_modal_1hyzx_1", es = "_modalHeader_1hyzx_57", ls = "_withBorder_1hyzx_65", as = "_modalTitle_1hyzx_70", ds = "_closeIcon_1hyzx_82", rs = "_modalBody_1hyzx_95", is = "_modalFooter_1hyzx_106", hs = "_buttonsDiv_1hyzx_111", os = "_fullWidthFooter_1hyzx_121", l = {
9
+ modalOverlay: u,
10
+ closing: n,
11
+ modalLayout: B,
12
+ modal: ss,
13
+ modalHeader: es,
14
+ withBorder: ls,
15
+ modalTitle: as,
16
+ closeIcon: ds,
17
+ modalBody: rs,
18
+ modalFooter: is,
19
+ buttonsDiv: hs,
20
+ fullWidthFooter: os
21
+ }, zs = ({
22
22
  isOpen: m,
23
23
  title: x,
24
24
  children: b,
25
- width: I = 752,
25
+ width: k = 752,
26
26
  confirmButton: s,
27
27
  cancelButton: e,
28
- zIndex: S,
29
- className: $,
30
- style: f,
28
+ zIndex: L,
29
+ className: O,
30
+ titleClassName: g,
31
+ contentClassName: w,
32
+ footerClassName: z,
33
+ style: F,
31
34
  onClickOverlay: y,
32
- onClose: o,
33
- closeModal: k,
34
- withScroll: L = !0,
35
- fullWidthFooter: O = !1,
36
- helperElement: F,
37
- ...H
35
+ onClose: h,
36
+ closeModal: H,
37
+ withScroll: f = !0,
38
+ fullWidthFooter: T = !1,
39
+ helperElement: W,
40
+ ...D
38
41
  }) => {
39
- const g = p(null), [T, w] = v(!1), _ = p(null), [W, t] = v(!1), [D, R] = v(!1);
40
- G(m);
42
+ const $ = I(null), [R, p] = v(!1), _ = I(null), [j, A] = v(!1), [Y, P] = v(!1);
43
+ U(m);
41
44
  const i = () => {
42
- w(!0), setTimeout(() => {
43
- k(), w(!1);
45
+ p(!0), setTimeout(() => {
46
+ H(), p(!1);
44
47
  }, 250);
45
- }, j = async (d) => {
48
+ }, V = async (d) => {
46
49
  var r;
47
- (r = g.current) != null && r.contains(d.target) || y !== !1 && (typeof y == "function" && await y(), i());
48
- }, A = async () => {
49
- o !== !1 && (typeof o == "function" && await o(), i());
50
- }, Y = async () => {
50
+ (r = $.current) != null && r.contains(d.target) || y !== !1 && (typeof y == "function" && await y(), i());
51
+ }, X = async () => {
52
+ h !== !1 && (typeof h == "function" && await h(), i());
53
+ }, Z = async () => {
51
54
  try {
52
55
  s != null && s.action && await s.action(), i();
53
56
  } catch {
54
57
  return;
55
58
  }
56
- }, P = async () => {
59
+ }, M = async () => {
57
60
  try {
58
61
  e != null && e.action && await e.action(), i();
59
62
  } catch {
60
63
  return;
61
64
  }
62
- }, V = e && Object.keys(e).length > 0, X = s && Object.keys(s).length > 0, z = V && (e.show ?? !0), C = X && (s.show ?? !0), Z = `${l.modal} ${$ || ""}`;
63
- return M(() => {
65
+ }, q = e && Object.keys(e).length > 0, G = s && Object.keys(s).length > 0, C = q && (e.show ?? !0), N = G && (s.show ?? !0), J = `${l.modal} ${O || ""}`;
66
+ return K(() => {
64
67
  if (!_.current) return;
65
68
  const d = _.current, r = () => {
66
- R(d.scrollTop > 0), t(d.scrollHeight > d.clientHeight);
69
+ P(d.scrollTop > 0), A(d.scrollHeight > d.clientHeight);
67
70
  };
68
71
  r(), d.addEventListener("scroll", r);
69
- const N = new ResizeObserver(r);
70
- return N.observe(d), () => {
71
- d.removeEventListener("scroll", r), N.disconnect();
72
+ const E = new ResizeObserver(r);
73
+ return E.observe(d), () => {
74
+ d.removeEventListener("scroll", r), E.disconnect();
72
75
  };
73
- }, [b]), m ? K(
76
+ }, [b]), m ? t(
74
77
  /* @__PURE__ */ a(
75
78
  "div",
76
79
  {
77
- className: `${l.modalOverlay} ${T ? l.closing : ""}`,
78
- style: { zIndex: 3e3 + (S || 0) },
79
- onClick: j,
80
- children: /* @__PURE__ */ h("div", { ref: g, className: l.modalLayout, children: [
81
- /* @__PURE__ */ h(
80
+ className: `${l.modalOverlay} ${R ? l.closing : ""}`,
81
+ style: { zIndex: 3e3 + (L || 0) },
82
+ onClick: V,
83
+ children: /* @__PURE__ */ o("div", { ref: $, className: l.modalLayout, children: [
84
+ /* @__PURE__ */ o(
82
85
  "div",
83
86
  {
84
- className: Z,
85
- style: { maxWidth: I, ...f },
86
- ...H,
87
+ className: J,
88
+ style: { maxWidth: k, ...F },
89
+ ...D,
87
90
  children: [
88
- /* @__PURE__ */ h(
91
+ /* @__PURE__ */ o(
89
92
  "div",
90
93
  {
91
- className: `${l.modalHeader} ${D ? l.withBorder : ""}`,
94
+ className: `${l.modalHeader} ${Y ? l.withBorder : ""} `,
92
95
  children: [
93
- x && /* @__PURE__ */ a("span", { className: l.modalTitle, children: x }),
94
- o !== !1 && /* @__PURE__ */ a("div", { className: l.closeIcon, onClick: A, children: /* @__PURE__ */ a(
95
- q,
96
+ x && /* @__PURE__ */ a(
97
+ "span",
98
+ {
99
+ className: `${l.modalTitle} ${g || ""}`,
100
+ children: x
101
+ }
102
+ ),
103
+ h !== !1 && /* @__PURE__ */ a("div", { className: l.closeIcon, onClick: X, children: /* @__PURE__ */ a(
104
+ Q,
96
105
  {
97
106
  name: "Close",
98
107
  width: 12,
@@ -106,47 +115,49 @@ import '../../assets/index7.css';const Q = "_modalOverlay_1hyzx_1", U = "_closin
106
115
  /* @__PURE__ */ a(
107
116
  "div",
108
117
  {
109
- className: l.modalBody,
118
+ className: `${l.modalBody} ${w || ""}`,
110
119
  style: {
111
- overflowY: L ? "auto" : "hidden"
120
+ overflowY: f ? "auto" : "hidden"
112
121
  },
113
122
  ref: _,
114
- children: /* @__PURE__ */ a(J.Provider, { value: i, children: b })
123
+ children: /* @__PURE__ */ a(c.Provider, { value: i, children: b })
115
124
  }
116
125
  ),
117
- (z || C) && /* @__PURE__ */ a(
126
+ (C || N) && /* @__PURE__ */ a(
118
127
  "div",
119
128
  {
120
- className: `${l.modalFooter} ${W ? l.withBorder : ""}`,
121
- children: /* @__PURE__ */ h(
129
+ className: `${l.modalFooter} ${j ? l.withBorder : ""}`,
130
+ children: /* @__PURE__ */ o(
122
131
  "div",
123
132
  {
124
- className: `${l.buttonsDiv} ${O ? l.fullWidthFooter : ""}`,
133
+ className: `${l.buttonsDiv} ${T ? l.fullWidthFooter : ""} ${z || ""}`,
125
134
  children: [
126
- z && /* @__PURE__ */ a(
127
- E,
135
+ C && /* @__PURE__ */ a(
136
+ S,
128
137
  {
129
138
  variant: (e == null ? void 0 : e.variant) || "outline",
130
- onClick: P,
139
+ onClick: M,
131
140
  disabled: (e == null ? void 0 : e.disabled) || !1,
132
141
  size: (e == null ? void 0 : e.size) || "small",
133
142
  loading: e == null ? void 0 : e.loading,
134
143
  className: e == null ? void 0 : e.className,
144
+ icon: e.icon,
135
145
  fullWidth: !0,
136
146
  children: (e == null ? void 0 : e.text) || "Cancelar"
137
147
  }
138
148
  ),
139
- C && /* @__PURE__ */ a(
140
- E,
149
+ N && /* @__PURE__ */ a(
150
+ S,
141
151
  {
142
152
  type: "submit",
143
153
  form: s == null ? void 0 : s.id,
144
154
  variant: (s == null ? void 0 : s.variant) || "brand",
145
- onClick: Y,
155
+ onClick: Z,
146
156
  disabled: (s == null ? void 0 : s.disabled) || !1,
147
157
  size: (s == null ? void 0 : s.size) || "small",
148
158
  loading: s == null ? void 0 : s.loading,
149
159
  className: s == null ? void 0 : s.className,
160
+ icon: s.icon,
150
161
  fullWidth: !0,
151
162
  children: (s == null ? void 0 : s.text) || "Confirmar"
152
163
  }
@@ -159,7 +170,7 @@ import '../../assets/index7.css';const Q = "_modalOverlay_1hyzx_1", U = "_closin
159
170
  ]
160
171
  }
161
172
  ),
162
- F
173
+ W
163
174
  ] })
164
175
  }
165
176
  ),
@@ -167,5 +178,5 @@ import '../../assets/index7.css';const Q = "_modalOverlay_1hyzx_1", U = "_closin
167
178
  ) : null;
168
179
  };
169
180
  export {
170
- bs as Modal
181
+ zs as Modal
171
182
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bmi-next-brokers",
3
3
  "description": "Componentes de UI para proyecto BMI Next Brokers",
4
- "version": "2.4.4",
4
+ "version": "2.4.5",
5
5
  "author": "BMI Ahorro España",
6
6
  "contributors": [
7
7
  "José Ramón Jiménez <jrjimenez@bmicos.com>",