@soyfri/shared-library 1.5.0-beta.4 → 1.6.0-beta.0

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.
Files changed (247) hide show
  1. package/Button-C17mExpd.cjs.map +1 -1
  2. package/Button-UkkP-bNw.js.map +1 -1
  3. package/components/ActionMenu/ActionMenu.cjs +107 -0
  4. package/components/ActionMenu/ActionMenu.cjs.map +1 -0
  5. package/components/ActionMenu/ActionMenu.d.ts +44 -0
  6. package/components/ActionMenu/ActionMenu.js +107 -0
  7. package/components/ActionMenu/ActionMenu.js.map +1 -0
  8. package/components/ActionMenu/index.d.ts +2 -0
  9. package/components/ActionMenu.d.ts +6 -0
  10. package/components/AppBar/AppBar.cjs +129 -0
  11. package/components/AppBar/AppBar.cjs.map +1 -0
  12. package/components/AppBar/AppBar.d.ts +55 -0
  13. package/components/AppBar/AppBar.js +129 -0
  14. package/components/AppBar/AppBar.js.map +1 -0
  15. package/components/AppBar/AppBar.sx.d.ts +12 -0
  16. package/components/AppBar/AppBarContext.d.ts +18 -0
  17. package/components/AppBar/AppBarMenuToggle.d.ts +39 -0
  18. package/components/AppBar/index.d.ts +6 -0
  19. package/components/AppBar.d.ts +6 -0
  20. package/components/Autocomplete/Autocomplete.cjs +263 -82
  21. package/components/Autocomplete/Autocomplete.cjs.map +1 -1
  22. package/components/Autocomplete/Autocomplete.d.ts +71 -13
  23. package/components/Autocomplete/Autocomplete.definitions.d.ts +7 -0
  24. package/components/Autocomplete/Autocomplete.helpers.d.ts +22 -0
  25. package/components/Autocomplete/Autocomplete.js +264 -83
  26. package/components/Autocomplete/Autocomplete.js.map +1 -1
  27. package/components/Autocomplete/Autocomplete.sx.d.ts +7 -0
  28. package/components/Autocomplete/_parts/AutocompleteChips.d.ts +20 -0
  29. package/components/Autocomplete/_parts/AutocompleteLoader.d.ts +9 -0
  30. package/components/Autocomplete/_parts/AutocompleteOption.d.ts +16 -0
  31. package/components/Autocomplete/index.d.ts +2 -1
  32. package/components/Autocomplete.d.ts +4 -0
  33. package/components/Avatar/Avatar.cjs +117 -81
  34. package/components/Avatar/Avatar.cjs.map +1 -1
  35. package/components/Avatar/Avatar.d.ts +16 -2
  36. package/components/Avatar/Avatar.definitions.d.ts +11 -0
  37. package/components/Avatar/Avatar.js +118 -82
  38. package/components/Avatar/Avatar.js.map +1 -1
  39. package/components/Avatar/index.d.ts +1 -0
  40. package/components/Button/Button.d.ts +5 -5
  41. package/components/Button/index.d.ts +1 -0
  42. package/components/Card/Card.cjs +78 -7
  43. package/components/Card/Card.cjs.map +1 -1
  44. package/components/Card/Card.d.ts +31 -8
  45. package/components/Card/Card.js +79 -8
  46. package/components/Card/Card.js.map +1 -1
  47. package/components/Card/Card.sx.d.ts +14 -0
  48. package/components/Card/index.d.ts +4 -1
  49. package/components/Card.d.ts +4 -0
  50. package/components/Checkbox/Checkbox.cjs +189 -0
  51. package/components/Checkbox/Checkbox.cjs.map +1 -0
  52. package/components/Checkbox/Checkbox.d.ts +55 -0
  53. package/components/Checkbox/Checkbox.js +189 -0
  54. package/components/Checkbox/Checkbox.js.map +1 -0
  55. package/components/Checkbox/Checkbox.sx.d.ts +13 -0
  56. package/components/Checkbox/index.d.ts +2 -0
  57. package/components/Checkbox.d.ts +6 -0
  58. package/components/Chip/Chip.cjs +2 -1
  59. package/components/Chip/Chip.cjs.map +1 -1
  60. package/components/Chip/Chip.js +2 -1
  61. package/components/Chip/Chip.js.map +1 -1
  62. package/components/Chip/index.d.ts +2 -1
  63. package/components/Chip.d.ts +4 -0
  64. package/components/DatePicker/DatePicker.cjs +178 -3
  65. package/components/DatePicker/DatePicker.cjs.map +1 -1
  66. package/components/DatePicker/DatePicker.d.ts +35 -9
  67. package/components/DatePicker/DatePicker.definitions.d.ts +1 -0
  68. package/components/DatePicker/DatePicker.helpers.d.ts +7 -0
  69. package/components/DatePicker/DatePicker.js +177 -2
  70. package/components/DatePicker/DatePicker.js.map +1 -1
  71. package/components/DatePicker/DatePicker.sx.d.ts +9 -0
  72. package/components/DatePicker/index.d.ts +2 -1
  73. package/components/DatePicker.d.ts +4 -0
  74. package/components/DateTimePicker/DateTimePicker.cjs +121 -131
  75. package/components/DateTimePicker/DateTimePicker.cjs.map +1 -1
  76. package/components/DateTimePicker/DateTimePicker.d.ts +41 -12
  77. package/components/DateTimePicker/DateTimePicker.definitions.d.ts +3 -0
  78. package/components/DateTimePicker/DateTimePicker.helpers.d.ts +13 -0
  79. package/components/DateTimePicker/DateTimePicker.js +121 -131
  80. package/components/DateTimePicker/DateTimePicker.js.map +1 -1
  81. package/components/DateTimePicker/DateTimePicker.sx.d.ts +7 -0
  82. package/components/DateTimePicker/index.d.ts +2 -1
  83. package/components/DateTimePicker.d.ts +4 -0
  84. package/components/Drawer/Drawer.cjs +272 -0
  85. package/components/Drawer/Drawer.cjs.map +1 -0
  86. package/components/Drawer/Drawer.d.ts +58 -0
  87. package/components/Drawer/Drawer.js +272 -0
  88. package/components/Drawer/Drawer.js.map +1 -0
  89. package/components/Drawer/Drawer.sx.d.ts +23 -0
  90. package/components/Drawer/DrawerContext.d.ts +18 -0
  91. package/components/Drawer/DrawerItem.d.ts +40 -0
  92. package/components/Drawer/index.d.ts +6 -0
  93. package/components/Drawer.d.ts +6 -0
  94. package/components/Gallery/Gallery.cjs +154 -79
  95. package/components/Gallery/Gallery.cjs.map +1 -1
  96. package/components/Gallery/Gallery.d.ts +25 -9
  97. package/components/Gallery/Gallery.js +154 -79
  98. package/components/Gallery/Gallery.js.map +1 -1
  99. package/components/Gallery/GalleryLightbox.d.ts +6 -10
  100. package/components/Gallery/GalleryMain.d.ts +3 -7
  101. package/components/Gallery/GalleryThumbnails.d.ts +7 -11
  102. package/components/Gallery/index.d.ts +2 -1
  103. package/components/Gallery.d.ts +4 -0
  104. package/components/Icon/Icon.cjs +49 -10
  105. package/components/Icon/Icon.cjs.map +1 -1
  106. package/components/Icon/Icon.d.ts +29 -2
  107. package/components/Icon/Icon.js +49 -10
  108. package/components/Icon/Icon.js.map +1 -1
  109. package/components/Icon/index.d.ts +2 -1
  110. package/components/Icon.d.ts +4 -0
  111. package/components/Input/Input.cjs +186 -3
  112. package/components/Input/Input.cjs.map +1 -1
  113. package/components/Input/Input.d.ts +29 -17
  114. package/components/Input/Input.definitions.d.ts +6 -2
  115. package/components/Input/Input.helpers.d.ts +14 -0
  116. package/components/Input/Input.js +185 -2
  117. package/components/Input/Input.js.map +1 -1
  118. package/components/Input/Input.sx.d.ts +8 -0
  119. package/components/Input/index.d.ts +2 -1
  120. package/components/Input.d.ts +4 -0
  121. package/components/InputGroup/InputGroup.cjs +107 -93
  122. package/components/InputGroup/InputGroup.cjs.map +1 -1
  123. package/components/InputGroup/InputGroup.d.ts +38 -2
  124. package/components/InputGroup/InputGroup.definitions.d.ts +6 -0
  125. package/components/InputGroup/InputGroup.js +109 -95
  126. package/components/InputGroup/InputGroup.js.map +1 -1
  127. package/components/InputGroup/index.d.ts +2 -1
  128. package/components/InputGroup.d.ts +4 -0
  129. package/components/Modal/Modal.cjs +287 -148
  130. package/components/Modal/Modal.cjs.map +1 -1
  131. package/components/Modal/Modal.d.ts +57 -6
  132. package/components/Modal/Modal.js +289 -150
  133. package/components/Modal/Modal.js.map +1 -1
  134. package/components/Modal/ModalBody.d.ts +6 -1
  135. package/components/Modal/ModalFooter.d.ts +12 -4
  136. package/components/Modal/ModalHeader.d.ts +6 -1
  137. package/components/Modal/index.d.ts +8 -1
  138. package/components/Modal.d.ts +4 -0
  139. package/components/RadioGroup/RadioGroup.cjs +204 -0
  140. package/components/RadioGroup/RadioGroup.cjs.map +1 -0
  141. package/components/RadioGroup/RadioGroup.d.ts +59 -0
  142. package/components/RadioGroup/RadioGroup.definitions.d.ts +6 -0
  143. package/components/RadioGroup/RadioGroup.js +204 -0
  144. package/components/RadioGroup/RadioGroup.js.map +1 -0
  145. package/components/RadioGroup/RadioGroup.sx.d.ts +20 -0
  146. package/components/RadioGroup/index.d.ts +2 -0
  147. package/components/RadioGroup.d.ts +6 -0
  148. package/components/Select/Select.cjs +311 -4
  149. package/components/Select/Select.cjs.map +1 -1
  150. package/components/Select/Select.d.ts +62 -27
  151. package/components/Select/Select.helpers.d.ts +15 -0
  152. package/components/Select/Select.js +310 -3
  153. package/components/Select/Select.js.map +1 -1
  154. package/components/Select/Select.sx.d.ts +7 -0
  155. package/components/Select/_parts/SelectMenuItem.d.ts +20 -0
  156. package/components/Select/index.d.ts +2 -1
  157. package/components/Select.d.ts +4 -0
  158. package/components/Stat/Stat.cjs +2 -2
  159. package/components/Stat/Stat.cjs.map +1 -1
  160. package/components/Stat/Stat.js +2 -2
  161. package/components/Stat/Stat.js.map +1 -1
  162. package/components/Stat/index.d.ts +2 -1
  163. package/components/Stat.d.ts +4 -0
  164. package/components/StatusMessage/StatusMessage.cjs +66 -55
  165. package/components/StatusMessage/StatusMessage.cjs.map +1 -1
  166. package/components/StatusMessage/StatusMessage.d.ts +20 -36
  167. package/components/StatusMessage/StatusMessage.js +68 -57
  168. package/components/StatusMessage/StatusMessage.js.map +1 -1
  169. package/components/StatusMessage/index.d.ts +2 -1
  170. package/components/StatusMessage.d.ts +4 -0
  171. package/components/Stepper/Stepper.cjs +285 -29
  172. package/components/Stepper/Stepper.cjs.map +1 -1
  173. package/components/Stepper/Stepper.d.ts +13 -7
  174. package/components/Stepper/Stepper.js +287 -31
  175. package/components/Stepper/Stepper.js.map +1 -1
  176. package/components/Stepper/StepperContext.d.ts +73 -0
  177. package/components/Stepper/_hooks/useHorizontalScroll.d.ts +19 -0
  178. package/components/Stepper/_parts/StepperScrollArrow.d.ts +19 -0
  179. package/components/Stepper/index.d.ts +6 -2
  180. package/components/Stepper.d.ts +4 -0
  181. package/components/Switch/Switch.cjs +184 -0
  182. package/components/Switch/Switch.cjs.map +1 -0
  183. package/components/Switch/Switch.d.ts +48 -0
  184. package/components/Switch/Switch.definitions.d.ts +7 -0
  185. package/components/Switch/Switch.js +184 -0
  186. package/components/Switch/Switch.js.map +1 -0
  187. package/components/Switch/Switch.sx.d.ts +22 -0
  188. package/components/Switch/Switch.types.d.ts +1 -0
  189. package/components/Switch/index.d.ts +2 -0
  190. package/components/Switch.d.ts +6 -0
  191. package/components/Tabs/Tabs.cjs +45 -29
  192. package/components/Tabs/Tabs.cjs.map +1 -1
  193. package/components/Tabs/Tabs.d.ts +21 -16
  194. package/components/Tabs/Tabs.js +46 -30
  195. package/components/Tabs/Tabs.js.map +1 -1
  196. package/components/Tabs/index.d.ts +4 -2
  197. package/components/Tabs.d.ts +4 -0
  198. package/components/Timeline/Timeline.cjs +3 -2
  199. package/components/Timeline/Timeline.cjs.map +1 -1
  200. package/components/Timeline/Timeline.d.ts +4 -8
  201. package/components/Timeline/Timeline.js +3 -2
  202. package/components/Timeline/Timeline.js.map +1 -1
  203. package/components/Timeline/index.d.ts +4 -2
  204. package/components/Timeline.d.ts +4 -0
  205. package/components/_shared/formField.sx.d.ts +33 -0
  206. package/components/_shared/mergeSx.d.ts +7 -0
  207. package/components/_shared/resolvePreset.d.ts +18 -0
  208. package/formField.sx-8_QRnKxv.js +68 -0
  209. package/formField.sx-8_QRnKxv.js.map +1 -0
  210. package/formField.sx-BAX7KwMR.cjs +67 -0
  211. package/formField.sx-BAX7KwMR.cjs.map +1 -0
  212. package/index.cjs +144 -1
  213. package/index.cjs.map +1 -1
  214. package/index.d.ts +4 -0
  215. package/index.js +49 -2
  216. package/index.js.map +1 -1
  217. package/mergeSx-BXoNZjB_.js +10 -0
  218. package/mergeSx-BXoNZjB_.js.map +1 -0
  219. package/mergeSx-Dbccoo_H.cjs +9 -0
  220. package/mergeSx-Dbccoo_H.cjs.map +1 -0
  221. package/mui.d.ts +7 -0
  222. package/package.json +31 -1
  223. package/resolvePreset-B-IB0ehH.js +15 -0
  224. package/resolvePreset-B-IB0ehH.js.map +1 -0
  225. package/resolvePreset-CT3kU-K2.cjs +14 -0
  226. package/resolvePreset-CT3kU-K2.cjs.map +1 -0
  227. package/theme/componentStyles.d.ts +32 -0
  228. package/theme/tokens.d.ts +28 -0
  229. package/tokens-BRrcP_p_.js +21 -0
  230. package/tokens-BRrcP_p_.js.map +1 -0
  231. package/tokens-jaWWNk39.cjs +20 -0
  232. package/tokens-jaWWNk39.cjs.map +1 -0
  233. package/utils/index.d.ts +2 -0
  234. package/utils/scrollToTop.d.ts +28 -0
  235. package/DatePicker-BSNboVhN.js +0 -201
  236. package/DatePicker-BSNboVhN.js.map +0 -1
  237. package/DatePicker-BoqxWAhj.cjs +0 -200
  238. package/DatePicker-BoqxWAhj.cjs.map +0 -1
  239. package/Input-DFHs7cJ_.js +0 -171
  240. package/Input-DFHs7cJ_.js.map +0 -1
  241. package/Input-c8MwNNPg.cjs +0 -170
  242. package/Input-c8MwNNPg.cjs.map +0 -1
  243. package/Select-BO2N56sm.cjs +0 -411
  244. package/Select-BO2N56sm.cjs.map +0 -1
  245. package/Select-BcLkyHSE.js +0 -412
  246. package/Select-BcLkyHSE.js.map +0 -1
  247. package/components/Select/Select.definitions.d.ts +0 -14
@@ -17,23 +17,16 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
20
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
33
- import React__default, { forwardRef, useState, useImperativeHandle } from "react";
34
- import { Box, Stack, Button, Typography, useTheme, useMediaQuery, Modal as Modal$1, Paper } from "@mui/material";
21
+ import { forwardRef, useState, useId, useImperativeHandle, Children, isValidElement, cloneElement } from "react";
22
+ import { Box, Stack, Typography, useTheme, useMediaQuery, Modal as Modal$1, Paper } from "@mui/material";
23
+ import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined";
24
+ import WarningAmberIcon from "@mui/icons-material/WarningAmber";
25
+ import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline";
26
+ import CheckCircleOutlineIcon from "@mui/icons-material/CheckCircleOutline";
27
+ import { B as Button } from "../../Button-UkkP-bNw.js";
28
+ import { m as mergeSx } from "../../mergeSx-BXoNZjB_.js";
35
29
  const ModalFooter = ({
36
- // Renombrado
37
30
  children,
38
31
  showCloseButton = true,
39
32
  closeButtonText = "Cerrar",
@@ -41,38 +34,74 @@ const ModalFooter = ({
41
34
  onClose,
42
35
  actions = []
43
36
  }) => {
44
- return /* @__PURE__ */ jsxs(Box, { sx: { padding: 2, borderTop: "1px solid #e0e0e0", display: "flex", justifyContent: "flex-end", gap: 1 }, children: [
45
- children,
46
- /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, children: [
47
- showCloseButton && /* @__PURE__ */ jsx(
48
- Button,
49
- {
50
- onClick: onClose,
51
- disabled: closeButtonDisabled,
52
- variant: "outlined",
53
- color: "secondary",
54
- children: closeButtonText
55
- }
56
- ),
57
- actions.map((action, index) => /* @__PURE__ */ jsx(
58
- Button,
59
- {
60
- onClick: action.onClick,
61
- disabled: action.disabled,
62
- variant: action.variant || "contained",
63
- color: action.color || "primary",
64
- children: action.text
65
- },
66
- index
67
- ))
68
- ] })
69
- ] });
37
+ return /* @__PURE__ */ jsxs(
38
+ Box,
39
+ {
40
+ sx: {
41
+ padding: 2,
42
+ borderTop: (theme) => `1px solid ${theme.palette.divider}`,
43
+ display: "flex",
44
+ justifyContent: "flex-end",
45
+ gap: 1
46
+ },
47
+ children: [
48
+ children,
49
+ /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, children: [
50
+ showCloseButton && /* @__PURE__ */ jsx(
51
+ Button,
52
+ {
53
+ onClick: onClose,
54
+ disabled: closeButtonDisabled,
55
+ variant: "outlined",
56
+ color: "secondary",
57
+ children: closeButtonText
58
+ }
59
+ ),
60
+ actions.map((action) => {
61
+ const { buttonProps, text, onClick, disabled, variant, color } = action;
62
+ return /* @__PURE__ */ jsx(
63
+ Button,
64
+ __spreadProps(__spreadValues({
65
+ onClick,
66
+ disabled,
67
+ variant: variant || "contained",
68
+ color: color || "primary"
69
+ }, buttonProps), {
70
+ children: text
71
+ }),
72
+ text
73
+ );
74
+ })
75
+ ] })
76
+ ]
77
+ }
78
+ );
70
79
  };
71
- const ModalHeader = ({ children }) => {
72
- return /* @__PURE__ */ jsx(Box, { sx: { padding: 2, borderBottom: "1px solid #e0e0e0", display: "flex", alignItems: "center", justifyContent: "space-between" }, children: /* @__PURE__ */ jsx(Typography, { variant: "h6", component: "h2", children }) });
80
+ ModalFooter.displayName = "ModalFooter";
81
+ const ModalHeader = ({ children, id }) => {
82
+ return /* @__PURE__ */ jsx(
83
+ Box,
84
+ {
85
+ sx: {
86
+ padding: 2,
87
+ borderBottom: (theme) => `1px solid ${theme.palette.divider}`,
88
+ display: "flex",
89
+ alignItems: "center",
90
+ justifyContent: "space-between"
91
+ },
92
+ children: /* @__PURE__ */ jsx(Typography, { id, variant: "h6", component: "h2", children })
93
+ }
94
+ );
95
+ };
96
+ ModalHeader.displayName = "ModalHeader";
97
+ const ModalBody = ({ children, id }) => {
98
+ return /* @__PURE__ */ jsx(Box, { id, sx: { padding: 2, overflowY: "auto", flexGrow: 1 }, children });
73
99
  };
74
- const ModalBody = ({ children }) => {
75
- return /* @__PURE__ */ jsx(Box, { sx: { padding: 2, overflowY: "auto", flexGrow: 1 }, children });
100
+ ModalBody.displayName = "ModalBody";
101
+ const isModalSlot = (child, Component, displayName) => {
102
+ if (child.type === Component) return true;
103
+ const type = child.type;
104
+ return (type == null ? void 0 : type.displayName) === displayName;
76
105
  };
77
106
  const modalStyle = {
78
107
  position: "absolute",
@@ -85,125 +114,235 @@ const modalStyle = {
85
114
  flexDirection: "column",
86
115
  outline: "none"
87
116
  };
88
- const Modal = forwardRef(({
89
- open: controlledOpen,
90
- // Renombra la prop 'open' si se pasa externamente
91
- onClose: controlledOnClose,
92
- // Renombra la prop 'onClose' si se pasa externamente
93
- title,
94
- children,
95
- showCloseButton = true,
96
- closeButtonText = "Cerrar",
97
- closeButtonDisabled = false,
98
- actions = [],
99
- maxWidth = "sm",
100
- hiddenFooter = false
101
- }, ref) => {
102
- const [internalOpen, setInternalOpen] = useState(false);
103
- const isOpen = controlledOpen !== void 0 ? controlledOpen : internalOpen;
104
- useImperativeHandle(ref, () => ({
105
- open: () => setInternalOpen(true),
106
- close: () => {
117
+ const severityConfig = {
118
+ info: {
119
+ color: "primary",
120
+ icon: /* @__PURE__ */ jsx(InfoOutlinedIcon, { sx: { fontSize: 48 } }),
121
+ paletteKey: "primary"
122
+ },
123
+ warning: {
124
+ color: "warning",
125
+ icon: /* @__PURE__ */ jsx(WarningAmberIcon, { sx: { fontSize: 48 } }),
126
+ paletteKey: "warning"
127
+ },
128
+ error: {
129
+ color: "error",
130
+ icon: /* @__PURE__ */ jsx(ErrorOutlineIcon, { sx: { fontSize: 48 } }),
131
+ paletteKey: "error"
132
+ },
133
+ success: {
134
+ color: "success",
135
+ icon: /* @__PURE__ */ jsx(CheckCircleOutlineIcon, { sx: { fontSize: 48 } }),
136
+ paletteKey: "success"
137
+ }
138
+ };
139
+ const Modal = forwardRef(
140
+ ({
141
+ mode = "default",
142
+ open: controlledOpen,
143
+ onClose: controlledOnClose,
144
+ title,
145
+ children,
146
+ showCloseButton = true,
147
+ closeButtonText = "Cerrar",
148
+ closeButtonDisabled = false,
149
+ actions = [],
150
+ maxWidth = "sm",
151
+ hiddenHeader = false,
152
+ hiddenBody = false,
153
+ hiddenFooter = false,
154
+ sx,
155
+ paperSx,
156
+ className,
157
+ // Props del modo confirm
158
+ onConfirm,
159
+ confirmText = "Confirmar",
160
+ confirmDisabled = false,
161
+ severity = "info",
162
+ confirmMessage
163
+ }, ref) => {
164
+ const [internalOpen, setInternalOpen] = useState(false);
165
+ const [confirmLoading, setConfirmLoading] = useState(false);
166
+ const titleId = useId();
167
+ const descId = useId();
168
+ const isOpen = controlledOpen !== void 0 ? controlledOpen : internalOpen;
169
+ useImperativeHandle(ref, () => ({
170
+ open: () => setInternalOpen(true),
171
+ close: () => {
172
+ setInternalOpen(false);
173
+ controlledOnClose == null ? void 0 : controlledOnClose();
174
+ }
175
+ }));
176
+ const handleCloseInternal = () => {
107
177
  setInternalOpen(false);
108
178
  controlledOnClose == null ? void 0 : controlledOnClose();
179
+ };
180
+ const handleConfirm = async () => {
181
+ if (!onConfirm) {
182
+ handleCloseInternal();
183
+ return;
184
+ }
185
+ const result = onConfirm();
186
+ if (!(result instanceof Promise)) {
187
+ handleCloseInternal();
188
+ return;
189
+ }
190
+ setConfirmLoading(true);
191
+ try {
192
+ await result;
193
+ handleCloseInternal();
194
+ } catch (err) {
195
+ console.error("Modal onConfirm failed:", err);
196
+ } finally {
197
+ setConfirmLoading(false);
198
+ }
199
+ };
200
+ const theme = useTheme();
201
+ const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
202
+ const getWidth = () => {
203
+ if (isMobile) return "95%";
204
+ switch (maxWidth) {
205
+ case "xs":
206
+ return 300;
207
+ case "sm":
208
+ return 500;
209
+ case "md":
210
+ return 700;
211
+ case "lg":
212
+ return 900;
213
+ case "xl":
214
+ return 1100;
215
+ case false:
216
+ return "auto";
217
+ default:
218
+ return typeof maxWidth === "string" ? maxWidth : 500;
219
+ }
220
+ };
221
+ const paperBaseSx = __spreadProps(__spreadValues({}, modalStyle), { width: getWidth() });
222
+ const mergedPaperSx = mergeSx(paperBaseSx, paperSx);
223
+ if (mode === "confirm") {
224
+ const config = severityConfig[severity];
225
+ const message = confirmMessage != null ? confirmMessage : children;
226
+ return /* @__PURE__ */ jsx(
227
+ Modal$1,
228
+ {
229
+ open: isOpen,
230
+ onClose: handleCloseInternal,
231
+ "aria-labelledby": title ? titleId : void 0,
232
+ "aria-describedby": message ? descId : void 0,
233
+ closeAfterTransition: true,
234
+ sx,
235
+ children: /* @__PURE__ */ jsxs(Paper, { className, sx: mergedPaperSx, children: [
236
+ /* @__PURE__ */ jsxs(Stack, { spacing: 2.5, sx: { p: 3, alignItems: "center", textAlign: "center" }, children: [
237
+ /* @__PURE__ */ jsx(
238
+ Box,
239
+ {
240
+ sx: {
241
+ width: 72,
242
+ height: 72,
243
+ borderRadius: "50%",
244
+ backgroundColor: (t) => t.palette[config.paletteKey].light,
245
+ color: (t) => t.palette[config.paletteKey].dark,
246
+ display: "flex",
247
+ alignItems: "center",
248
+ justifyContent: "center",
249
+ opacity: 0.9
250
+ },
251
+ children: config.icon
252
+ }
253
+ ),
254
+ title && /* @__PURE__ */ jsx(Typography, { id: titleId, variant: "h6", component: "h2", sx: { fontWeight: 700 }, children: title }),
255
+ message && /* @__PURE__ */ jsx(Typography, { id: descId, variant: "body2", color: "text.secondary", children: message })
256
+ ] }),
257
+ /* @__PURE__ */ jsx(
258
+ ModalFooter,
259
+ {
260
+ showCloseButton,
261
+ closeButtonText,
262
+ closeButtonDisabled: closeButtonDisabled || confirmLoading,
263
+ onClose: handleCloseInternal,
264
+ actions: [
265
+ {
266
+ text: confirmText,
267
+ onClick: handleConfirm,
268
+ disabled: confirmDisabled || confirmLoading,
269
+ variant: "contained",
270
+ color: config.color
271
+ }
272
+ ]
273
+ }
274
+ )
275
+ ] })
276
+ }
277
+ );
109
278
  }
110
- }));
111
- const handleCloseInternal = () => {
112
- setInternalOpen(false);
113
- controlledOnClose == null ? void 0 : controlledOnClose();
114
- };
115
- const theme = useTheme();
116
- const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
117
- const getWidth = () => {
118
- if (isMobile) return "95%";
119
- switch (maxWidth) {
120
- case "xs":
121
- return 300;
122
- case "sm":
123
- return 500;
124
- case "md":
125
- return 700;
126
- case "lg":
127
- return 900;
128
- case "xl":
129
- return 1100;
130
- case false:
131
- return "auto";
132
- default:
133
- return 500;
134
- }
135
- };
136
- const renderChildren = () => {
137
- let header = null;
138
- let body = null;
139
- let footer = null;
140
- React__default.Children.forEach(children, (child) => {
141
- if (React__default.isValidElement(child)) {
142
- if (child.type === ModalHeader) {
143
- header = child;
144
- } else if (child.type === ModalBody) {
145
- body = child;
146
- } else if (child.type === ModalFooter) {
279
+ const renderChildren = () => {
280
+ let header = null;
281
+ let body = null;
282
+ let footer = null;
283
+ Children.forEach(children, (child) => {
284
+ var _a, _b, _c, _d, _e;
285
+ if (!isValidElement(child)) return;
286
+ if (isModalSlot(child, ModalHeader, "ModalHeader")) {
287
+ const headerChild = child;
288
+ header = cloneElement(headerChild, __spreadValues({ id: titleId }, headerChild.props));
289
+ } else if (isModalSlot(child, ModalBody, "ModalBody")) {
290
+ const bodyChild = child;
291
+ body = cloneElement(bodyChild, __spreadValues({ id: descId }, bodyChild.props));
292
+ } else if (isModalSlot(child, ModalFooter, "ModalFooter")) {
147
293
  const footerChild = child;
148
- const _a = footerChild.props, {
149
- showCloseButton: childShowCloseButton,
150
- closeButtonText: childCloseButtonText,
151
- closeButtonDisabled: childCloseButtonDisabled,
152
- onClose: childOnClose,
153
- actions: childActions
154
- } = _a, restOfFooterProps = __objRest(_a, [
155
- "showCloseButton",
156
- "closeButtonText",
157
- "closeButtonDisabled",
158
- "onClose",
159
- "actions"
160
- ]);
161
- footer = React__default.cloneElement(footerChild, __spreadValues({
294
+ const childProps = footerChild.props;
295
+ footer = cloneElement(footerChild, {
296
+ showCloseButton: (_a = childProps.showCloseButton) != null ? _a : showCloseButton,
297
+ closeButtonText: (_b = childProps.closeButtonText) != null ? _b : closeButtonText,
298
+ closeButtonDisabled: (_c = childProps.closeButtonDisabled) != null ? _c : closeButtonDisabled,
299
+ onClose: (_d = childProps.onClose) != null ? _d : handleCloseInternal,
300
+ actions: (_e = childProps.actions) != null ? _e : actions
301
+ });
302
+ }
303
+ });
304
+ if (!footer && !hiddenFooter) {
305
+ footer = /* @__PURE__ */ jsx(
306
+ ModalFooter,
307
+ {
162
308
  showCloseButton,
163
309
  closeButtonText,
164
310
  closeButtonDisabled,
165
311
  onClose: handleCloseInternal,
166
- // Usa la función de cierre interna
167
312
  actions
168
- }, restOfFooterProps));
169
- }
313
+ }
314
+ );
170
315
  }
171
- });
172
- if (!footer && !hiddenFooter) {
173
- footer = /* @__PURE__ */ jsx(
174
- ModalFooter,
175
- {
176
- showCloseButton,
177
- closeButtonText,
178
- closeButtonDisabled,
179
- onClose: handleCloseInternal,
180
- actions
181
- }
182
- );
183
- }
184
- return /* @__PURE__ */ jsxs(Fragment, { children: [
185
- header || title && /* @__PURE__ */ jsx(ModalHeader, { children: title }),
186
- body,
187
- footer
188
- ] });
189
- };
190
- return /* @__PURE__ */ jsx(
191
- Modal$1,
192
- {
193
- open: isOpen,
194
- onClose: handleCloseInternal,
195
- "aria-labelledby": "modal-title",
196
- "aria-describedby": "modal-description",
197
- closeAfterTransition: true,
198
- children: /* @__PURE__ */ jsx(Paper, { sx: __spreadProps(__spreadValues({}, modalStyle), { width: getWidth() }), children: renderChildren() })
199
- }
200
- );
201
- });
316
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
317
+ !hiddenHeader && (header || title && /* @__PURE__ */ jsx(ModalHeader, { id: titleId, children: title })),
318
+ !hiddenBody && body,
319
+ footer
320
+ ] });
321
+ };
322
+ return /* @__PURE__ */ jsx(
323
+ Modal$1,
324
+ {
325
+ open: isOpen,
326
+ onClose: handleCloseInternal,
327
+ "aria-labelledby": titleId,
328
+ "aria-describedby": descId,
329
+ closeAfterTransition: true,
330
+ sx,
331
+ children: /* @__PURE__ */ jsx(Paper, { className, sx: mergedPaperSx, children: renderChildren() })
332
+ }
333
+ );
334
+ }
335
+ );
336
+ Modal.displayName = "Modal";
202
337
  const ModalWithStatics = Modal;
203
338
  ModalWithStatics.Header = ModalHeader;
204
339
  ModalWithStatics.Body = ModalBody;
205
340
  ModalWithStatics.Footer = ModalFooter;
206
341
  export {
207
- ModalWithStatics as Modal
342
+ ModalWithStatics as Modal,
343
+ ModalBody,
344
+ ModalFooter,
345
+ ModalHeader,
346
+ ModalWithStatics as default
208
347
  };
209
348
  //# sourceMappingURL=Modal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","sources":["../../../src/components/Modal/ModalFooter.tsx","../../../src/components/Modal/ModalHeader.tsx","../../../src/components/Modal/ModalBody.tsx","../../../src/components/Modal/Modal.tsx"],"sourcesContent":["import React from 'react';\nimport { Box, Button, Stack } from '@mui/material';\nimport { ButtonProps } from '@mui/material/Button';\n\n// Interfaz para acciones personalizadas (se mantiene aquí)\nexport interface ModalAction {\n text: string;\n onClick: () => void;\n disabled?: boolean;\n variant?: ButtonProps['variant'];\n color?: ButtonProps['color'];\n}\n\nexport interface ModalFooterProps { // Renombrado\n children?: React.ReactNode;\n showCloseButton?: boolean;\n closeButtonText?: string;\n closeButtonDisabled?: boolean;\n onClose: () => void;\n actions?: ModalAction[];\n}\n\nexport const ModalFooter: React.FC<ModalFooterProps> = ({ // Renombrado\n children,\n showCloseButton = true,\n closeButtonText = \"Cerrar\",\n closeButtonDisabled = false,\n onClose,\n actions = [],\n}) => {\n return (\n <Box sx={{ padding: 2, borderTop: '1px solid #e0e0e0', display: 'flex', justifyContent: 'flex-end', gap: 1 }}>\n {children}\n <Stack direction=\"row\" spacing={1}>\n {showCloseButton && (\n <Button\n onClick={onClose}\n disabled={closeButtonDisabled}\n variant=\"outlined\"\n color=\"secondary\"\n >\n {closeButtonText}\n </Button>\n )}\n {actions.map((action, index) => (\n <Button\n key={index}\n onClick={action.onClick}\n disabled={action.disabled}\n variant={action.variant || 'contained'}\n color={action.color || 'primary'}\n >\n {action.text}\n </Button>\n ))}\n </Stack>\n </Box>\n );\n};\n\nexport default ModalFooter;","import React from 'react';\nimport { Box, Typography } from '@mui/material';\n\ninterface ModalHeaderProps { // Renombrado\n children: React.ReactNode;\n}\n\nexport const ModalHeader: React.FC<ModalHeaderProps> = ({ children }) => { // Renombrado\n return (\n <Box sx={{ padding: 2, borderBottom: '1px solid #e0e0e0', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>\n <Typography variant=\"h6\" component=\"h2\">\n {children}\n </Typography>\n </Box>\n );\n};\n\nexport default ModalHeader;","import React from 'react';\nimport { Box } from '@mui/material';\n\ninterface ModalBodyProps { // Renombrado\n children: React.ReactNode;\n}\n\nexport const ModalBody: React.FC<ModalBodyProps> = ({ children }) => { // Renombrado\n return (\n <Box sx={{ padding: 2, overflowY: 'auto', flexGrow: 1 }}>\n {children}\n </Box>\n );\n};\n\nexport default ModalBody;","import React, { useState, useImperativeHandle, forwardRef } from 'react'; // 👈 Importa useImperativeHandle y forwardRef\nimport { Modal as MuiModal, Box, Paper, useTheme, useMediaQuery } from '@mui/material';\n\nimport { DialogProps } from '@mui/material/Dialog';\nimport { ModalAction, ModalFooter, ModalFooterProps } from './ModalFooter';\nimport { ModalHeader } from './ModalHeader';\nimport { ModalBody } from './ModalBody';\n\n// Define la interfaz para los métodos que el padre puede llamar a través de la ref\nexport interface ModalRef {\n open: () => void;\n close: () => void;\n}\n\ninterface ModalProps {\n // La prop 'open' ahora es opcional si se usa con ref, pero aún puede ser controlada externamente\n open?: boolean;\n onClose?: () => void; // 'onClose' ahora es opcional ya que el modal puede cerrarse internamente\n title?: string;\n children: React.ReactNode;\n showCloseButton?: boolean;\n closeButtonText?: string;\n closeButtonDisabled?: boolean;\n actions?: ModalAction[];\n maxWidth?: DialogProps['maxWidth'];\n hiddenFooter?: boolean\n}\n\nconst modalStyle = {\n position: 'absolute' as 'absolute',\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n width: '90%',\n maxHeight: '90vh',\n display: 'flex',\n flexDirection: 'column',\n outline: 'none',\n};\n\n// Envuelve el componente en forwardRef\nexport const Modal = forwardRef<ModalRef, ModalProps>(({\n open: controlledOpen, // Renombra la prop 'open' si se pasa externamente\n onClose: controlledOnClose, // Renombra la prop 'onClose' si se pasa externamente\n title,\n children,\n showCloseButton = true,\n closeButtonText = \"Cerrar\",\n closeButtonDisabled = false,\n actions = [],\n maxWidth = 'sm',\n hiddenFooter = false,\n}, ref) => { // Recibe la ref\n // Estado interno para gestionar la visibilidad si no es controlado externamente\n const [internalOpen, setInternalOpen] = useState(false);\n\n // Determina si el modal está abierto, priorizando la prop externa\n const isOpen = controlledOpen !== undefined ? controlledOpen : internalOpen;\n\n // Expone métodos 'open' y 'close' a través de la ref\n useImperativeHandle(ref, () => ({\n open: () => setInternalOpen(true),\n close: () => {\n setInternalOpen(false);\n controlledOnClose?.(); // Llama al onClose externo si existe\n },\n }));\n\n const handleCloseInternal = () => {\n setInternalOpen(false);\n controlledOnClose?.(); // Llama al onClose externo si existe\n };\n\n const theme = useTheme();\n const isMobile = useMediaQuery(theme.breakpoints.down('sm'));\n\n const getWidth = () => {\n if (isMobile) return '95%';\n switch (maxWidth) {\n case 'xs': return 300;\n case 'sm': return 500;\n case 'md': return 700;\n case 'lg': return 900;\n case 'xl': return 1100;\n case false: return 'auto';\n default: return 500;\n }\n };\n\n const renderChildren = () => {\n let header: React.ReactNode | null = null;\n let body: React.ReactNode | null = null;\n let footer: React.ReactNode | null = null;\n\n React.Children.forEach(children, (child) => {\n if (React.isValidElement(child)) {\n if (child.type === ModalHeader) {\n header = child;\n } else if (child.type === ModalBody) {\n body = child;\n } else if (child.type === ModalFooter) {\n const footerChild = child as React.ReactElement<ModalFooterProps>;\n const {\n showCloseButton: childShowCloseButton,\n closeButtonText: childCloseButtonText,\n closeButtonDisabled: childCloseButtonDisabled,\n onClose: childOnClose,\n actions: childActions,\n ...restOfFooterProps\n } = footerChild.props;\n\n footer = React.cloneElement(footerChild, {\n showCloseButton,\n closeButtonText,\n closeButtonDisabled,\n onClose: handleCloseInternal, // Usa la función de cierre interna\n actions,\n ...restOfFooterProps,\n });\n }\n }\n });\n\n if (!footer && !hiddenFooter) {\n footer = (\n <ModalFooter\n showCloseButton={showCloseButton}\n closeButtonText={closeButtonText}\n closeButtonDisabled={closeButtonDisabled}\n onClose={handleCloseInternal} // Usa la función de cierre interna\n actions={actions}\n />\n );\n }\n\n return (\n <>\n {header || (title && <ModalHeader>{title}</ModalHeader>)}\n {body}\n {footer}\n </>\n );\n };\n\n return (\n <MuiModal\n open={isOpen} // Usa el estado de visibilidad determinado\n onClose={handleCloseInternal} // Usa la función de cierre interna\n aria-labelledby=\"modal-title\"\n aria-describedby=\"modal-description\"\n closeAfterTransition\n >\n <Paper sx={{ ...modalStyle, width: getWidth() }}>\n {renderChildren()}\n </Paper>\n </MuiModal>\n );\n});\n\n// Define los sub-componentes como propiedades estáticas con tipos explícitos\ntype ModalComponent = React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<ModalRef>> & {\n Header: typeof ModalHeader;\n Body: typeof ModalBody;\n Footer: typeof ModalFooter;\n};\n\nconst ModalWithStatics = Modal as ModalComponent;\n\nModalWithStatics.Header = ModalHeader;\nModalWithStatics.Body = ModalBody;\nModalWithStatics.Footer = ModalFooter;\n\nexport default ModalWithStatics;"],"names":["React","MuiModal"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBO,MAAM,cAA0C,CAAC;AAAA;AAAA,EACtD;AAAA,EACA,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,sBAAsB;AAAA,EACtB;AAAA,EACA,UAAU,CAAA;AACZ,MAAM;AACJ,SACE,qBAAC,KAAA,EAAI,IAAI,EAAE,SAAS,GAAG,WAAW,qBAAqB,SAAS,QAAQ,gBAAgB,YAAY,KAAK,KACtG,UAAA;AAAA,IAAA;AAAA,IACD,qBAAC,OAAA,EAAM,WAAU,OAAM,SAAS,GAC7B,UAAA;AAAA,MAAA,mBACC;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,SAAS;AAAA,UACT,UAAU;AAAA,UACV,SAAQ;AAAA,UACR,OAAM;AAAA,UAEL,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,MAGJ,QAAQ,IAAI,CAAC,QAAQ,UACpB;AAAA,QAAC;AAAA,QAAA;AAAA,UAEC,SAAS,OAAO;AAA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QAAA;AAAA,MAAA;AAAA,IAGN;AAEA,WACE,qBAAA,UAAA,EACG,UAAA;AAAA,MAAA,UAAW,SAAS,oBAAC,aAAA,EAAa,UAAA,OAAM;AAAA,MACxC;AAAA,MACA;AAAA,IAAA,GACH;AAAA,EAEJ;AAEA,SACE;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,MAAM;AAAA,MACN,SAAS;AAAA,MACT,mBAAgB;AAAA,MAChB,oBAAiB;AAAA,MACjB,sBAAoB;AAAA,MAEpB,UAAA,oBAAC,OAAA,EAAM,IAAI,iCAAK,aAAL,EAAiB,OAAO,SAAA,EAAS,IACzC,UAAA,eAAA,EAAe,CAClB;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;AASD,MAAM,mBAAmB;AAEzB,iBAAiB,SAAS;AAC1B,iBAAiB,OAAO;AACxB,iBAAiB,SAAS;"}
1
+ {"version":3,"file":"Modal.js","sources":["../../../src/components/Modal/ModalFooter.tsx","../../../src/components/Modal/ModalHeader.tsx","../../../src/components/Modal/ModalBody.tsx","../../../src/components/Modal/Modal.tsx"],"sourcesContent":["import React from 'react';\nimport { Box, Stack } from '@mui/material';\nimport type { ButtonProps as MuiButtonProps } from '@mui/material/Button';\n\nimport { Button } from '../Button';\n\n// Interfaz para acciones personalizadas (se mantiene aquí)\nexport interface ModalAction {\n text: string;\n onClick?: () => void;\n disabled?: boolean;\n variant?: MuiButtonProps['variant'];\n color?: MuiButtonProps['color'];\n /**\n * Props adicionales que se forwardean al `<Button>` interno. Útil para casos\n * avanzados como conectar el botón con un `<form id=\"...\">` externo usando\n * `buttonProps={{ type: 'submit', form: 'my-form-id' }}`.\n */\n buttonProps?: Partial<MuiButtonProps> & { form?: string };\n}\n\nexport interface ModalFooterProps {\n children?: React.ReactNode;\n showCloseButton?: boolean;\n closeButtonText?: string;\n closeButtonDisabled?: boolean;\n onClose: () => void;\n actions?: ModalAction[];\n}\n\nexport const ModalFooter: React.FC<ModalFooterProps> = ({\n children,\n showCloseButton = true,\n closeButtonText = 'Cerrar',\n closeButtonDisabled = false,\n onClose,\n actions = [],\n}) => {\n return (\n <Box\n sx={{\n padding: 2,\n borderTop: (theme) => `1px solid ${theme.palette.divider}`,\n display: 'flex',\n justifyContent: 'flex-end',\n gap: 1,\n }}\n >\n {children}\n <Stack direction=\"row\" spacing={1}>\n {showCloseButton && (\n <Button\n onClick={onClose}\n disabled={closeButtonDisabled}\n variant=\"outlined\"\n color=\"secondary\"\n >\n {closeButtonText}\n </Button>\n )}\n {actions.map((action) => {\n const { buttonProps, text, onClick, disabled, variant, color } = action;\n return (\n <Button\n key={text}\n onClick={onClick}\n disabled={disabled}\n variant={variant || 'contained'}\n color={color || 'primary'}\n {...(buttonProps as any)}\n >\n {text}\n </Button>\n );\n })}\n </Stack>\n </Box>\n );\n};\n\nModalFooter.displayName = 'ModalFooter';\n\nexport default ModalFooter;\n","import React from 'react';\nimport { Box, Typography } from '@mui/material';\n\nexport interface ModalHeaderProps {\n children: React.ReactNode;\n /**\n * ID del elemento — usado para `aria-labelledby` del Modal. Se setea\n * automáticamente cuando el header se renderiza dentro de `<Modal>`.\n */\n id?: string;\n}\n\nexport const ModalHeader: React.FC<ModalHeaderProps> = ({ children, id }) => {\n return (\n <Box\n sx={{\n padding: 2,\n borderBottom: (theme) => `1px solid ${theme.palette.divider}`,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <Typography id={id} variant=\"h6\" component=\"h2\">\n {children}\n </Typography>\n </Box>\n );\n};\n\nModalHeader.displayName = 'ModalHeader';\n\nexport default ModalHeader;\n","import React from 'react';\nimport { Box } from '@mui/material';\n\nexport interface ModalBodyProps {\n children: React.ReactNode;\n /**\n * ID del elemento — usado para `aria-describedby` del Modal. Se setea\n * automáticamente cuando el body se renderiza dentro de `<Modal>`.\n */\n id?: string;\n}\n\nexport const ModalBody: React.FC<ModalBodyProps> = ({ children, id }) => {\n return (\n <Box id={id} sx={{ padding: 2, overflowY: 'auto', flexGrow: 1 }}>\n {children}\n </Box>\n );\n};\n\nModalBody.displayName = 'ModalBody';\n\nexport default ModalBody;\n","import {\n Children,\n cloneElement,\n forwardRef,\n isValidElement,\n useId,\n useImperativeHandle,\n useState,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport {\n Modal as MuiModal,\n Paper,\n useMediaQuery,\n useTheme,\n Box,\n Stack,\n Typography,\n} from '@mui/material';\nimport type { SxProps, Theme } from '@mui/material/styles';\nimport InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';\nimport WarningAmberIcon from '@mui/icons-material/WarningAmber';\nimport ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';\nimport CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline';\n\nimport type { DialogProps } from '@mui/material/Dialog';\nimport { ModalFooter, type ModalAction, type ModalFooterProps } from './ModalFooter';\nimport { ModalHeader } from './ModalHeader';\nimport { ModalBody } from './ModalBody';\nimport { mergeSx } from '../_shared/mergeSx';\n\n// Detección robusta de sub-componentes — funciona con wrappers / HMR que\n// rompen la igualdad de referencia (`child.type === ModalHeader`).\nconst isModalSlot = (\n child: ReactElement,\n Component: unknown,\n displayName: string,\n): boolean => {\n if (child.type === Component) return true;\n const type = child.type as { displayName?: string };\n return type?.displayName === displayName;\n};\n\n// Define la interfaz para los métodos que el padre puede llamar a través de la ref\nexport interface ModalRef {\n open: () => void;\n close: () => void;\n}\n\nexport type ModalMode = 'default' | 'confirm';\nexport type ModalSeverity = 'info' | 'warning' | 'error' | 'success';\n\nexport interface ModalProps {\n /**\n * Modo del modal.\n * - `default` (default): modal genérico con slots `Header`/`Body`/`Footer` y\n * `actions` custom.\n * - `confirm`: reemplaza al `ConfirmModal` legacy. Renderiza un layout\n * focalizado con icono por severidad, mensaje y botones \"Cancelar\" /\n * \"Confirmar\".\n */\n mode?: ModalMode;\n\n // ── Props comunes ────────────────────────────────────────────────────\n /** Controlado externamente. Omitir si se usa vía ref. */\n open?: boolean;\n /** Callback al cerrar. También se dispara al confirmar/cancelar. */\n onClose?: () => void;\n title?: string;\n children?: ReactNode;\n showCloseButton?: boolean;\n closeButtonText?: string;\n closeButtonDisabled?: boolean;\n actions?: ModalAction[];\n maxWidth?: DialogProps['maxWidth'];\n /** Oculta el header (incluso si hay `title` o se pasa un `<Modal.Header>`). */\n hiddenHeader?: boolean;\n /** Oculta el body (incluso si se pasa un `<Modal.Body>`). */\n hiddenBody?: boolean;\n /** Oculta el footer (incluso si se pasa un `<Modal.Footer>` o `actions`). */\n hiddenFooter?: boolean;\n /** sx del Modal root (MuiModal). */\n sx?: SxProps<Theme>;\n /** sx del Paper interno (contenedor visual). Se mergea sobre el default. */\n paperSx?: SxProps<Theme>;\n /** className del Paper interno. */\n className?: string;\n\n // ── Props del modo confirm ───────────────────────────────────────────\n /**\n * Callback de confirmación. Soporta promesa — si devuelve `Promise`, el\n * botón muestra estado `disabled` mientras resuelve.\n *\n * Si la promesa **rechaza**, el modal queda abierto para que el consumer\n * pueda mostrar el error en su UI. El modal se cierra solo en éxito.\n */\n onConfirm?: () => void | Promise<void>;\n /** Texto del botón primario en modo `confirm`. Default: \"Confirmar\". */\n confirmText?: string;\n /** Deshabilita el botón de confirmar. */\n confirmDisabled?: boolean;\n /**\n * Severidad visual en modo `confirm`. Controla el icono y el color del\n * botón de confirmación.\n * - `info` (default): primary\n * - `warning`: warning (amarillo)\n * - `error`: error (rojo) — típico para \"Eliminar\"\n * - `success`: success (verde) — típico para \"Aprobar\"\n */\n severity?: ModalSeverity;\n /**\n * Mensaje del confirm. Puede ser string o cualquier ReactNode. Si se omite,\n * se usa `children`.\n */\n confirmMessage?: ReactNode;\n}\n\nconst modalStyle = {\n position: 'absolute' as const,\n top: '50%',\n left: '50%',\n transform: 'translate(-50%, -50%)',\n width: '90%',\n maxHeight: '90vh',\n display: 'flex',\n flexDirection: 'column' as const,\n outline: 'none',\n};\n\nconst severityConfig: Record<\n ModalSeverity,\n { color: ModalAction['color']; icon: ReactNode; paletteKey: 'primary' | 'warning' | 'error' | 'success' }\n> = {\n info: {\n color: 'primary',\n icon: <InfoOutlinedIcon sx={{ fontSize: 48 }} />,\n paletteKey: 'primary',\n },\n warning: {\n color: 'warning',\n icon: <WarningAmberIcon sx={{ fontSize: 48 }} />,\n paletteKey: 'warning',\n },\n error: {\n color: 'error',\n icon: <ErrorOutlineIcon sx={{ fontSize: 48 }} />,\n paletteKey: 'error',\n },\n success: {\n color: 'success',\n icon: <CheckCircleOutlineIcon sx={{ fontSize: 48 }} />,\n paletteKey: 'success',\n },\n};\n\nexport const Modal = forwardRef<ModalRef, ModalProps>(\n (\n {\n mode = 'default',\n open: controlledOpen,\n onClose: controlledOnClose,\n title,\n children,\n showCloseButton = true,\n closeButtonText = 'Cerrar',\n closeButtonDisabled = false,\n actions = [],\n maxWidth = 'sm',\n hiddenHeader = false,\n hiddenBody = false,\n hiddenFooter = false,\n sx,\n paperSx,\n className,\n\n // Props del modo confirm\n onConfirm,\n confirmText = 'Confirmar',\n confirmDisabled = false,\n severity = 'info',\n confirmMessage,\n },\n ref,\n ) => {\n const [internalOpen, setInternalOpen] = useState(false);\n const [confirmLoading, setConfirmLoading] = useState(false);\n\n // IDs estables para a11y: `aria-labelledby` y `aria-describedby`.\n const titleId = useId();\n const descId = useId();\n\n const isOpen = controlledOpen !== undefined ? controlledOpen : internalOpen;\n\n useImperativeHandle(ref, () => ({\n open: () => setInternalOpen(true),\n close: () => {\n setInternalOpen(false);\n controlledOnClose?.();\n },\n }));\n\n const handleCloseInternal = () => {\n setInternalOpen(false);\n controlledOnClose?.();\n };\n\n const handleConfirm = async () => {\n if (!onConfirm) {\n handleCloseInternal();\n return;\n }\n const result = onConfirm();\n if (!(result instanceof Promise)) {\n handleCloseInternal();\n return;\n }\n setConfirmLoading(true);\n try {\n await result;\n handleCloseInternal();\n } catch (err) {\n // No cerrar el modal en caso de error — el consumer es responsable\n // de mostrar un estado de error en su UI. Logueamos para trazabilidad\n // en dev.\n // eslint-disable-next-line no-console\n console.error('Modal onConfirm failed:', err);\n } finally {\n setConfirmLoading(false);\n }\n };\n\n const theme = useTheme();\n const isMobile = useMediaQuery(theme.breakpoints.down('sm'));\n\n const getWidth = () => {\n if (isMobile) return '95%';\n switch (maxWidth) {\n case 'xs':\n return 300;\n case 'sm':\n return 500;\n case 'md':\n return 700;\n case 'lg':\n return 900;\n case 'xl':\n return 1100;\n case false:\n return 'auto';\n default:\n // Soporta string custom: `maxWidth=\"600px\"` se pasa tal cual.\n return typeof maxWidth === 'string' ? maxWidth : 500;\n }\n };\n\n // Base sx del Paper + width responsive; el consumer puede pisarlos via `paperSx`.\n const paperBaseSx: SxProps<Theme> = { ...modalStyle, width: getWidth() };\n const mergedPaperSx = mergeSx(paperBaseSx, paperSx);\n\n // ── Render modo CONFIRM ─────────────────────────────────────────────\n if (mode === 'confirm') {\n const config = severityConfig[severity];\n const message = confirmMessage ?? children;\n\n return (\n <MuiModal\n open={isOpen}\n onClose={handleCloseInternal}\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={message ? descId : undefined}\n closeAfterTransition\n sx={sx}\n >\n <Paper className={className} sx={mergedPaperSx}>\n <Stack spacing={2.5} sx={{ p: 3, alignItems: 'center', textAlign: 'center' }}>\n <Box\n sx={{\n width: 72,\n height: 72,\n borderRadius: '50%',\n backgroundColor: (t) => t.palette[config.paletteKey].light,\n color: (t) => t.palette[config.paletteKey].dark,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n opacity: 0.9,\n }}\n >\n {config.icon}\n </Box>\n {title && (\n <Typography id={titleId} variant=\"h6\" component=\"h2\" sx={{ fontWeight: 700 }}>\n {title}\n </Typography>\n )}\n {message && (\n <Typography id={descId} variant=\"body2\" color=\"text.secondary\">\n {message}\n </Typography>\n )}\n </Stack>\n <ModalFooter\n showCloseButton={showCloseButton}\n closeButtonText={closeButtonText}\n closeButtonDisabled={closeButtonDisabled || confirmLoading}\n onClose={handleCloseInternal}\n actions={[\n {\n text: confirmText,\n onClick: handleConfirm,\n disabled: confirmDisabled || confirmLoading,\n variant: 'contained',\n color: config.color,\n },\n ]}\n />\n </Paper>\n </MuiModal>\n );\n }\n\n // ── Render modo DEFAULT (compuesto) ─────────────────────────────────\n const renderChildren = () => {\n let header: ReactNode | null = null;\n let body: ReactNode | null = null;\n let footer: ReactNode | null = null;\n\n Children.forEach(children, (child) => {\n if (!isValidElement(child)) return;\n\n if (isModalSlot(child, ModalHeader, 'ModalHeader')) {\n const headerChild = child as ReactElement<{ id?: string }>;\n header = cloneElement(headerChild, { id: titleId, ...headerChild.props });\n } else if (isModalSlot(child, ModalBody, 'ModalBody')) {\n const bodyChild = child as ReactElement<{ id?: string }>;\n body = cloneElement(bodyChild, { id: descId, ...bodyChild.props });\n } else if (isModalSlot(child, ModalFooter, 'ModalFooter')) {\n const footerChild = child as ReactElement<ModalFooterProps>;\n // Props del child ganan sobre los del Modal padre: si el consumer\n // declara `<Modal.Footer showCloseButton={false}>`, ese valor se\n // respeta. Solo los que vengan `undefined` caen al default del padre.\n const childProps = footerChild.props;\n footer = cloneElement(footerChild, {\n showCloseButton: childProps.showCloseButton ?? showCloseButton,\n closeButtonText: childProps.closeButtonText ?? closeButtonText,\n closeButtonDisabled: childProps.closeButtonDisabled ?? closeButtonDisabled,\n onClose: childProps.onClose ?? handleCloseInternal,\n actions: childProps.actions ?? actions,\n });\n }\n });\n\n if (!footer && !hiddenFooter) {\n footer = (\n <ModalFooter\n showCloseButton={showCloseButton}\n closeButtonText={closeButtonText}\n closeButtonDisabled={closeButtonDisabled}\n onClose={handleCloseInternal}\n actions={actions}\n />\n );\n }\n\n return (\n <>\n {!hiddenHeader && (header || (title && <ModalHeader id={titleId}>{title}</ModalHeader>))}\n {!hiddenBody && body}\n {footer}\n </>\n );\n };\n\n return (\n <MuiModal\n open={isOpen}\n onClose={handleCloseInternal}\n aria-labelledby={titleId}\n aria-describedby={descId}\n closeAfterTransition\n sx={sx}\n >\n <Paper className={className} sx={mergedPaperSx}>\n {renderChildren()}\n </Paper>\n </MuiModal>\n );\n },\n);\n\nModal.displayName = 'Modal';\n\n// Define los sub-componentes como propiedades estáticas con tipos explícitos\ntype ModalComponent = ReturnType<typeof forwardRef<ModalRef, ModalProps>> & {\n Header: typeof ModalHeader;\n Body: typeof ModalBody;\n Footer: typeof ModalFooter;\n};\n\nconst ModalWithStatics = Modal as ModalComponent;\n\nModalWithStatics.Header = ModalHeader;\nModalWithStatics.Body = ModalBody;\nModalWithStatics.Footer = ModalFooter;\n\nexport default ModalWithStatics;\n"],"names":["MuiModal"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BO,MAAM,cAA0C,CAAC;AAAA,EACtD;AAAA,EACA,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,sBAAsB;AAAA,EACtB;AAAA,EACA,UAAU,CAAA;AACZ,MAAM;AACJ,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAI;AAAA,QACF,SAAS;AAAA,QACT,WAAW,CAAC,UAAU,aAAa,MAAM,QAAQ,OAAO;AAAA,QACxD,SAAS;AAAA,QACT,gBAAgB;AAAA,QAChB,KAAK;AAAA,MAAA;AAAA,MAGN,UAAA;AAAA,QAAA;AAAA,QACD,qBAAC,OAAA,EAAM,WAAU,OAAM,SAAS,GAC7B,UAAA;AAAA,UAAA,mBACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,SAAS;AAAA,cACT,UAAU;AAAA,cACV,SAAQ;AAAA,cACR,OAAM;AAAA,cAEL,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAGJ,QAAQ,IAAI,CAAC,WAAW;AACvB,kBAAM,EAAE,aAAa,MAAM,SAAS,UAAU,SAAS,UAAU;AACjE,mBACE;AAAA,cAAC;AAAA,cAAA;AAAA,gBAEC;AAAA,gBACA;AAAA,gBACA,SAAS,WAAW;AAAA,gBACpB,OAAO,SAAS;AAAA,iBACX,cANN;AAAA,gBAQE,UAAA;AAAA,cAAA;AAAA,cAPI;AAAA,YAAA;AAAA,UAUX,CAAC;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,cAAc;AAIpB,gBAAM,aAAa,YAAY;AAC/B,mBAAS,aAAa,aAAa;AAAA,YACjC,kBAAiB,gBAAW,oBAAX,YAA8B;AAAA,YAC/C,kBAAiB,gBAAW,oBAAX,YAA8B;AAAA,YAC/C,sBAAqB,gBAAW,wBAAX,YAAkC;AAAA,YACvD,UAAS,gBAAW,YAAX,YAAsB;AAAA,YAC/B,UAAS,gBAAW,YAAX,YAAsB;AAAA,UAAA,CAChC;AAAA,QACH;AAAA,MACF,CAAC;AAED,UAAI,CAAC,UAAU,CAAC,cAAc;AAC5B,iBACE;AAAA,UAAC;AAAA,UAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA,SAAS;AAAA,YACT;AAAA,UAAA;AAAA,QAAA;AAAA,MAGN;AAEA,aACE,qBAAA,UAAA,EACG,UAAA;AAAA,QAAA,CAAC,iBAAiB,UAAW,6BAAU,aAAA,EAAY,IAAI,SAAU,UAAA,MAAA,CAAM;AAAA,QACvE,CAAC,cAAc;AAAA,QACf;AAAA,MAAA,GACH;AAAA,IAEJ;AAEA,WACE;AAAA,MAACA;AAAAA,MAAA;AAAA,QACC,MAAM;AAAA,QACN,SAAS;AAAA,QACT,mBAAiB;AAAA,QACjB,oBAAkB;AAAA,QAClB,sBAAoB;AAAA,QACpB;AAAA,QAEA,8BAAC,OAAA,EAAM,WAAsB,IAAI,eAC9B,2BAAe,CAClB;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,MAAM,cAAc;AASpB,MAAM,mBAAmB;AAEzB,iBAAiB,SAAS;AAC1B,iBAAiB,OAAO;AACxB,iBAAiB,SAAS;"}
@@ -1,6 +1,11 @@
1
1
  import { default as React } from 'react';
2
- interface ModalBodyProps {
2
+ export interface ModalBodyProps {
3
3
  children: React.ReactNode;
4
+ /**
5
+ * ID del elemento — usado para `aria-describedby` del Modal. Se setea
6
+ * automáticamente cuando el body se renderiza dentro de `<Modal>`.
7
+ */
8
+ id?: string;
4
9
  }
5
10
  export declare const ModalBody: React.FC<ModalBodyProps>;
6
11
  export default ModalBody;
@@ -1,11 +1,19 @@
1
1
  import { default as React } from 'react';
2
- import { ButtonProps } from '@mui/material/Button';
2
+ import { ButtonProps as MuiButtonProps } from '@mui/material/Button';
3
3
  export interface ModalAction {
4
4
  text: string;
5
- onClick: () => void;
5
+ onClick?: () => void;
6
6
  disabled?: boolean;
7
- variant?: ButtonProps['variant'];
8
- color?: ButtonProps['color'];
7
+ variant?: MuiButtonProps['variant'];
8
+ color?: MuiButtonProps['color'];
9
+ /**
10
+ * Props adicionales que se forwardean al `<Button>` interno. Útil para casos
11
+ * avanzados como conectar el botón con un `<form id="...">` externo usando
12
+ * `buttonProps={{ type: 'submit', form: 'my-form-id' }}`.
13
+ */
14
+ buttonProps?: Partial<MuiButtonProps> & {
15
+ form?: string;
16
+ };
9
17
  }
10
18
  export interface ModalFooterProps {
11
19
  children?: React.ReactNode;
@@ -1,6 +1,11 @@
1
1
  import { default as React } from 'react';
2
- interface ModalHeaderProps {
2
+ export interface ModalHeaderProps {
3
3
  children: React.ReactNode;
4
+ /**
5
+ * ID del elemento — usado para `aria-labelledby` del Modal. Se setea
6
+ * automáticamente cuando el header se renderiza dentro de `<Modal>`.
7
+ */
8
+ id?: string;
4
9
  }
5
10
  export declare const ModalHeader: React.FC<ModalHeaderProps>;
6
11
  export default ModalHeader;
@@ -1 +1,8 @@
1
- export { default as Modal } from './Modal';
1
+ export { default, default as Modal } from './Modal';
2
+ export type { ModalProps, ModalRef, ModalMode, ModalSeverity } from './Modal';
3
+ export { ModalHeader } from './ModalHeader';
4
+ export type { ModalHeaderProps } from './ModalHeader';
5
+ export { ModalBody } from './ModalBody';
6
+ export type { ModalBodyProps } from './ModalBody';
7
+ export { ModalFooter } from './ModalFooter';
8
+ export type { ModalAction, ModalFooterProps } from './ModalFooter';
@@ -1,2 +1,6 @@
1
1
  export * from './Modal/index'
2
2
  export {}
3
+ import _default from './Modal/index'
4
+ export default _default
5
+ export * from './Modal/index'
6
+ export {}