@soyfri/shared-library 2.0.0-beta8 → 2.0.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.
- package/Button-C17mExpd.cjs.map +1 -1
- package/Button-UkkP-bNw.js.map +1 -1
- package/README.md +182 -150
- package/components/ActionMenu/ActionMenu.cjs +52 -52
- package/components/ActionMenu/ActionMenu.cjs.map +1 -1
- package/components/ActionMenu/ActionMenu.d.ts +20 -36
- package/components/ActionMenu/ActionMenu.js +55 -55
- package/components/ActionMenu/ActionMenu.js.map +1 -1
- package/components/ActionMenu/index.d.ts +2 -2
- package/components/AppBar/AppBar.cjs +3 -220
- package/components/AppBar/AppBar.cjs.map +1 -1
- package/components/AppBar/AppBar.d.ts +6 -6
- package/components/AppBar/AppBar.js +6 -223
- package/components/AppBar/AppBar.js.map +1 -1
- package/components/AppBar/index.d.ts +0 -6
- package/components/Autocomplete/Autocomplete.cjs +310 -4
- package/components/Autocomplete/Autocomplete.cjs.map +1 -1
- package/components/Autocomplete/Autocomplete.d.ts +29 -26
- package/components/Autocomplete/Autocomplete.definitions.d.ts +2 -1
- package/components/Autocomplete/Autocomplete.helpers.d.ts +12 -8
- package/components/Autocomplete/Autocomplete.js +310 -4
- package/components/Autocomplete/Autocomplete.js.map +1 -1
- package/components/Autocomplete/_parts/AutocompleteChips.d.ts +7 -6
- package/components/Autocomplete/_parts/AutocompleteOption.d.ts +10 -13
- package/components/Autocomplete/index.d.ts +1 -1
- package/components/Avatar/Avatar.cjs +159 -2
- package/components/Avatar/Avatar.cjs.map +1 -1
- package/components/Avatar/Avatar.js +159 -2
- package/components/Avatar/Avatar.js.map +1 -1
- package/components/Avatar/index.d.ts +1 -0
- package/components/Button/Button.d.ts +5 -5
- package/components/Button/index.d.ts +1 -0
- package/components/Card/Card.cjs +95 -7
- package/components/Card/Card.cjs.map +1 -1
- package/components/Card/Card.d.ts +3 -50
- package/components/Card/Card.js +95 -7
- package/components/Card/Card.js.map +1 -1
- package/components/Card/Card.sx.d.ts +3 -6
- package/components/Card/index.d.ts +1 -1
- package/{Switch-BIeobv6i.cjs → components/Checkbox/Checkbox.cjs} +30 -20
- package/components/Checkbox/Checkbox.cjs.map +1 -0
- package/components/Checkbox/Checkbox.d.ts +55 -0
- package/{Switch-DQEOxM2R.js → components/Checkbox/Checkbox.js} +29 -20
- package/components/Checkbox/Checkbox.js.map +1 -0
- package/components/Checkbox/Checkbox.sx.d.ts +13 -0
- package/components/Checkbox/index.d.ts +2 -0
- package/components/Checkbox.d.ts +6 -0
- package/components/Chip/Chip.cjs +73 -3
- package/components/Chip/Chip.cjs.map +1 -1
- package/components/Chip/Chip.js +72 -2
- package/components/Chip/Chip.js.map +1 -1
- package/components/Chip/index.d.ts +2 -1
- package/components/Chip.d.ts +4 -0
- package/components/Column/Column.cjs +1 -1
- package/components/Column/Column.cjs.map +1 -1
- package/components/Column/Column.d.ts +1 -1
- package/components/Column/Column.js +1 -1
- package/components/Column/Column.js.map +1 -1
- package/components/Column/index.d.ts +0 -1
- package/components/DatePicker/DatePicker.cjs +177 -3
- package/components/DatePicker/DatePicker.cjs.map +1 -1
- package/components/DatePicker/DatePicker.d.ts +1 -13
- package/components/DatePicker/DatePicker.js +177 -3
- package/components/DatePicker/DatePicker.js.map +1 -1
- package/components/DatePicker/index.d.ts +1 -1
- package/components/DateRangePicker/DateRangePicker.cjs +73 -2
- package/components/DateRangePicker/DateRangePicker.cjs.map +1 -1
- package/components/DateRangePicker/DateRangePicker.js +73 -2
- package/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/components/DateTimePicker/DateTimePicker.cjs +195 -3
- package/components/DateTimePicker/DateTimePicker.cjs.map +1 -1
- package/components/DateTimePicker/DateTimePicker.d.ts +9 -17
- package/components/DateTimePicker/DateTimePicker.definitions.d.ts +2 -0
- package/components/DateTimePicker/DateTimePicker.helpers.d.ts +4 -2
- package/components/DateTimePicker/DateTimePicker.js +195 -3
- package/components/DateTimePicker/DateTimePicker.js.map +1 -1
- package/components/DateTimePicker/index.d.ts +1 -1
- package/components/Drawer/Drawer.cjs +13 -7
- package/components/Drawer/Drawer.cjs.map +1 -1
- package/components/Drawer/Drawer.d.ts +3 -1
- package/components/Drawer/Drawer.js +14 -8
- package/components/Drawer/Drawer.js.map +1 -1
- package/components/Drawer/DrawerItem.d.ts +6 -1
- package/components/Gallery/Gallery.cjs +154 -79
- package/components/Gallery/Gallery.cjs.map +1 -1
- package/components/Gallery/Gallery.d.ts +25 -9
- package/components/Gallery/Gallery.js +154 -79
- package/components/Gallery/Gallery.js.map +1 -1
- package/components/Gallery/GalleryLightbox.d.ts +6 -10
- package/components/Gallery/GalleryMain.d.ts +3 -7
- package/components/Gallery/GalleryThumbnails.d.ts +7 -11
- package/components/Gallery/index.d.ts +2 -1
- package/components/Gallery.d.ts +4 -0
- package/components/Icon/Icon.cjs +6 -8
- package/components/Icon/Icon.cjs.map +1 -1
- package/components/Icon/Icon.d.ts +11 -17
- package/components/Icon/Icon.js +6 -8
- package/components/Icon/Icon.js.map +1 -1
- package/components/Icon/index.d.ts +2 -1
- package/components/Icon.d.ts +4 -0
- package/components/Input/Input.cjs +185 -3
- package/components/Input/Input.cjs.map +1 -1
- package/components/Input/Input.d.ts +9 -2
- package/components/Input/Input.helpers.d.ts +3 -3
- package/components/Input/Input.js +185 -3
- package/components/Input/Input.js.map +1 -1
- package/components/Input/index.d.ts +1 -1
- package/components/InputGroup/InputGroup.cjs +23 -22
- package/components/InputGroup/InputGroup.cjs.map +1 -1
- package/components/InputGroup/InputGroup.d.ts +4 -4
- package/components/InputGroup/InputGroup.js +22 -21
- package/components/InputGroup/InputGroup.js.map +1 -1
- package/components/InputGroup/index.d.ts +2 -1
- package/components/InputGroup.d.ts +4 -0
- package/components/Modal/Modal.cjs +345 -6
- package/components/Modal/Modal.cjs.map +1 -1
- package/components/Modal/Modal.d.ts +20 -5
- package/components/Modal/Modal.js +345 -6
- package/components/Modal/Modal.js.map +1 -1
- package/components/Modal/ModalBody.d.ts +6 -1
- package/components/Modal/ModalFooter.d.ts +4 -4
- package/components/Modal/ModalHeader.d.ts +6 -1
- package/components/Modal/index.d.ts +4 -3
- package/components/RadioGroup/RadioGroup.cjs +201 -3
- package/components/RadioGroup/RadioGroup.cjs.map +1 -1
- package/components/RadioGroup/RadioGroup.d.ts +9 -3
- package/components/RadioGroup/RadioGroup.js +201 -3
- package/components/RadioGroup/RadioGroup.js.map +1 -1
- package/components/RadioGroup/index.d.ts +1 -1
- package/components/Select/Select.cjs +310 -4
- package/components/Select/Select.cjs.map +1 -1
- package/components/Select/Select.d.ts +35 -20
- package/components/Select/Select.helpers.d.ts +6 -19
- package/components/Select/Select.js +310 -4
- package/components/Select/Select.js.map +1 -1
- package/components/Select/index.d.ts +1 -1
- package/components/Stat/Stat.cjs +83 -4
- package/components/Stat/Stat.cjs.map +1 -1
- package/components/Stat/Stat.js +82 -3
- package/components/Stat/Stat.js.map +1 -1
- package/components/Stat/index.d.ts +2 -1
- package/components/Stat.d.ts +4 -0
- package/components/StatusMessage/StatusMessage.cjs +105 -3
- package/components/StatusMessage/StatusMessage.cjs.map +1 -1
- package/components/StatusMessage/StatusMessage.d.ts +20 -36
- package/components/StatusMessage/StatusMessage.js +105 -3
- package/components/StatusMessage/StatusMessage.js.map +1 -1
- package/components/StatusMessage/StatusMessageContext.d.ts +16 -0
- package/components/StatusMessage/index.d.ts +2 -0
- package/components/Stepper/Stepper.cjs +324 -4
- package/components/Stepper/Stepper.cjs.map +1 -1
- package/components/Stepper/Stepper.d.ts +9 -8
- package/components/Stepper/Stepper.js +323 -3
- package/components/Stepper/Stepper.js.map +1 -1
- package/{hooks/Wizard/WizardContext.d.ts → components/Stepper/StepperContext.d.ts} +28 -22
- package/components/Stepper/_hooks/useHorizontalScroll.d.ts +19 -0
- package/components/Stepper/_parts/StepperScrollArrow.d.ts +19 -0
- package/components/Stepper/index.d.ts +6 -2
- package/components/Stepper.d.ts +4 -0
- package/components/Switch/Switch.cjs +181 -3
- package/components/Switch/Switch.cjs.map +1 -1
- package/components/Switch/Switch.d.ts +7 -2
- package/components/Switch/Switch.js +181 -3
- package/components/Switch/Switch.js.map +1 -1
- package/components/Table/Table.cjs +528 -2
- package/components/Table/Table.cjs.map +1 -1
- package/components/Table/Table.d.ts +1 -1
- package/components/Table/Table.js +528 -2
- package/components/Table/Table.js.map +1 -1
- package/components/Tabs/Tabs.cjs +110 -4
- package/components/Tabs/Tabs.cjs.map +1 -1
- package/components/Tabs/Tabs.d.ts +21 -16
- package/components/Tabs/Tabs.js +109 -3
- package/components/Tabs/Tabs.js.map +1 -1
- package/components/Tabs/index.d.ts +4 -2
- package/components/Tabs.d.ts +4 -0
- package/components/Timeline/Timeline.cjs +3 -2
- package/components/Timeline/Timeline.cjs.map +1 -1
- package/components/Timeline/Timeline.d.ts +4 -8
- package/components/Timeline/Timeline.js +3 -2
- package/components/Timeline/Timeline.js.map +1 -1
- package/components/Timeline/index.d.ts +4 -2
- package/components/Timeline.d.ts +4 -0
- package/components/_shared/mergeSx.d.ts +7 -0
- package/{formField.sx-DfVbMe0V.js → formField.sx-8_QRnKxv.js} +2 -11
- package/formField.sx-8_QRnKxv.js.map +1 -0
- package/{formField.sx-CQ1mbk9M.cjs → formField.sx-BAX7KwMR.cjs} +10 -19
- package/formField.sx-BAX7KwMR.cjs.map +1 -0
- package/index.cjs +31 -47
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -30
- package/index.js +17 -48
- package/index.js.map +1 -1
- package/mergeSx-BXoNZjB_.js +10 -0
- package/mergeSx-BXoNZjB_.js.map +1 -0
- package/mergeSx-Dbccoo_H.cjs +9 -0
- package/mergeSx-Dbccoo_H.cjs.map +1 -0
- package/mui.d.ts +3 -2
- package/package.json +8 -20
- package/{resolvePreset-K6_BfWHD.js → resolvePreset-B-IB0ehH.js} +3 -3
- package/{resolvePreset-K6_BfWHD.js.map → resolvePreset-B-IB0ehH.js.map} +1 -1
- package/{resolvePreset-CxTI6_Ln.cjs → resolvePreset-CT3kU-K2.cjs} +3 -3
- package/{resolvePreset-CxTI6_Ln.cjs.map → resolvePreset-CT3kU-K2.cjs.map} +1 -1
- package/theme/componentStyles.d.ts +1 -1
- package/tokens-BRrcP_p_.js +21 -0
- package/tokens-BRrcP_p_.js.map +1 -0
- package/tokens-jaWWNk39.cjs +20 -0
- package/tokens-jaWWNk39.cjs.map +1 -0
- package/utils/index.d.ts +2 -0
- package/{components/ScrollTopButton → utils}/scrollToTop.d.ts +6 -7
- package/Autocomplete-BA-cGASd.js +0 -316
- package/Autocomplete-BA-cGASd.js.map +0 -1
- package/Autocomplete-C2x-lBvZ.cjs +0 -315
- package/Autocomplete-C2x-lBvZ.cjs.map +0 -1
- package/Avatar-9L7YMxya.cjs +0 -162
- package/Avatar-9L7YMxya.cjs.map +0 -1
- package/Avatar-BJTr-PBd.js +0 -163
- package/Avatar-BJTr-PBd.js.map +0 -1
- package/Card-DG_crfkK.cjs +0 -185
- package/Card-DG_crfkK.cjs.map +0 -1
- package/Card-Ug-ttVSh.js +0 -186
- package/Card-Ug-ttVSh.js.map +0 -1
- package/Chip-OPYQ1uQ_.js +0 -74
- package/Chip-OPYQ1uQ_.js.map +0 -1
- package/Chip-qoJLDiva.cjs +0 -73
- package/Chip-qoJLDiva.cjs.map +0 -1
- package/DatePicker-8f_9bwhS.js +0 -202
- package/DatePicker-8f_9bwhS.js.map +0 -1
- package/DatePicker-DLSfkgGA.cjs +0 -201
- package/DatePicker-DLSfkgGA.cjs.map +0 -1
- package/DateRangePicker-BVpeJCHI.js +0 -76
- package/DateRangePicker-BVpeJCHI.js.map +0 -1
- package/DateRangePicker-B_hKQhbj.cjs +0 -75
- package/DateRangePicker-B_hKQhbj.cjs.map +0 -1
- package/DateTimePicker-CWNW09-O.cjs +0 -220
- package/DateTimePicker-CWNW09-O.cjs.map +0 -1
- package/DateTimePicker-D4L9GAod.js +0 -221
- package/DateTimePicker-D4L9GAod.js.map +0 -1
- package/Input-Cp911l23.js +0 -174
- package/Input-Cp911l23.js.map +0 -1
- package/Input-DI0jfq5X.cjs +0 -173
- package/Input-DI0jfq5X.cjs.map +0 -1
- package/Modal-Bm_HH9cv.cjs +0 -319
- package/Modal-Bm_HH9cv.cjs.map +0 -1
- package/Modal-Bnz6d9m9.js +0 -320
- package/Modal-Bnz6d9m9.js.map +0 -1
- package/RadioGroup-CxqDHap1.cjs +0 -200
- package/RadioGroup-CxqDHap1.cjs.map +0 -1
- package/RadioGroup-DMi9FvMP.js +0 -201
- package/RadioGroup-DMi9FvMP.js.map +0 -1
- package/Select-3CBOfM2H.js +0 -447
- package/Select-3CBOfM2H.js.map +0 -1
- package/Select-Bku4f4f8.cjs +0 -446
- package/Select-Bku4f4f8.cjs.map +0 -1
- package/Stat-BUcFCGrz.cjs +0 -83
- package/Stat-BUcFCGrz.cjs.map +0 -1
- package/Stat-C06A_izS.js +0 -84
- package/Stat-C06A_izS.js.map +0 -1
- package/StatusMessage-C5B6oGZ_.cjs +0 -78
- package/StatusMessage-C5B6oGZ_.cjs.map +0 -1
- package/StatusMessage-D1GlfQdz.js +0 -79
- package/StatusMessage-D1GlfQdz.js.map +0 -1
- package/Step-Dq0N72YB.js +0 -49
- package/Step-Dq0N72YB.js.map +0 -1
- package/Step-a8U8O-91.cjs +0 -48
- package/Step-a8U8O-91.cjs.map +0 -1
- package/Switch-BIeobv6i.cjs.map +0 -1
- package/Switch-DQEOxM2R.js.map +0 -1
- package/Tab-Co31KY2k.cjs +0 -95
- package/Tab-Co31KY2k.cjs.map +0 -1
- package/Tab-DiK62gRz.js +0 -96
- package/Tab-DiK62gRz.js.map +0 -1
- package/Table-C2LbW0B1.js +0 -531
- package/Table-C2LbW0B1.js.map +0 -1
- package/Table-C4OM6rrC.cjs +0 -530
- package/Table-C4OM6rrC.cjs.map +0 -1
- package/components/AppBar/AppBarBrand.d.ts +0 -31
- package/components/AppBar/AppBarUserMenu.d.ts +0 -65
- package/components/Autocomplete/Autocomplete.types.d.ts +0 -1
- package/components/DatePicker/DatePicker.types.d.ts +0 -1
- package/components/DateTimePicker/DateTimePicker.types.d.ts +0 -1
- package/components/Input/Input.types.d.ts +0 -1
- package/components/PageLoader/PageLoader.cjs +0 -61
- package/components/PageLoader/PageLoader.cjs.map +0 -1
- package/components/PageLoader/PageLoader.d.ts +0 -38
- package/components/PageLoader/PageLoader.js +0 -61
- package/components/PageLoader/PageLoader.js.map +0 -1
- package/components/PageLoader/index.d.ts +0 -2
- package/components/PageLoader.d.ts +0 -6
- package/components/RadioGroup/RadioGroup.types.d.ts +0 -1
- package/components/ScrollTopButton/ScrollTopButton.cjs +0 -79
- package/components/ScrollTopButton/ScrollTopButton.cjs.map +0 -1
- package/components/ScrollTopButton/ScrollTopButton.d.ts +0 -48
- package/components/ScrollTopButton/ScrollTopButton.js +0 -79
- package/components/ScrollTopButton/ScrollTopButton.js.map +0 -1
- package/components/ScrollTopButton/index.d.ts +0 -4
- package/components/ScrollTopButton.d.ts +0 -6
- package/components/Select/Select.definitions.d.ts +0 -17
- package/components/Select/Select.types.d.ts +0 -1
- package/components/Select/_parts/SelectSearchHeader.d.ts +0 -15
- package/components/Select/_parts/SelectValue.d.ts +0 -22
- package/formField.sx-CQ1mbk9M.cjs.map +0 -1
- package/formField.sx-DfVbMe0V.js.map +0 -1
- package/hooks/Wizard/Wizard.cjs +0 -7
- package/hooks/Wizard/Wizard.cjs.map +0 -1
- package/hooks/Wizard/Wizard.js +0 -7
- package/hooks/Wizard/Wizard.js.map +0 -1
- package/hooks/Wizard/index.d.ts +0 -3
- package/hooks/Wizard/useWizard.d.ts +0 -9
- package/hooks/Wizard.d.ts +0 -2
- package/useWizard-CWdIxZzX.cjs +0 -94
- package/useWizard-CWdIxZzX.cjs.map +0 -1
- package/useWizard-CWq--C3o.js +0 -95
- package/useWizard-CWq--C3o.js.map +0 -1
- /package/{styles.css → index.css} +0 -0
|
@@ -1,9 +1,348 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
2
21
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
22
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
23
|
+
const React = require("react");
|
|
24
|
+
const material = require("@mui/material");
|
|
25
|
+
const InfoOutlinedIcon = require("@mui/icons-material/InfoOutlined");
|
|
26
|
+
const WarningAmberIcon = require("@mui/icons-material/WarningAmber");
|
|
27
|
+
const ErrorOutlineIcon = require("@mui/icons-material/ErrorOutline");
|
|
28
|
+
const CheckCircleOutlineIcon = require("@mui/icons-material/CheckCircleOutline");
|
|
29
|
+
const Button = require("../../Button-C17mExpd.cjs");
|
|
30
|
+
const mergeSx = require("../../mergeSx-Dbccoo_H.cjs");
|
|
31
|
+
const ModalFooter = ({
|
|
32
|
+
children,
|
|
33
|
+
showCloseButton = true,
|
|
34
|
+
closeButtonText = "Cerrar",
|
|
35
|
+
closeButtonDisabled = false,
|
|
36
|
+
onClose,
|
|
37
|
+
actions = []
|
|
38
|
+
}) => {
|
|
39
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
40
|
+
material.Box,
|
|
41
|
+
{
|
|
42
|
+
sx: {
|
|
43
|
+
padding: 2,
|
|
44
|
+
borderTop: (theme) => `1px solid ${theme.palette.divider}`,
|
|
45
|
+
display: "flex",
|
|
46
|
+
justifyContent: "flex-end",
|
|
47
|
+
gap: 1
|
|
48
|
+
},
|
|
49
|
+
children: [
|
|
50
|
+
children,
|
|
51
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { direction: "row", spacing: 1, children: [
|
|
52
|
+
showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(
|
|
53
|
+
Button.Button,
|
|
54
|
+
{
|
|
55
|
+
onClick: onClose,
|
|
56
|
+
disabled: closeButtonDisabled,
|
|
57
|
+
variant: "outlined",
|
|
58
|
+
color: "secondary",
|
|
59
|
+
children: closeButtonText
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
actions.map((action) => {
|
|
63
|
+
const { buttonProps, text, onClick, disabled, variant, color } = action;
|
|
64
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
65
|
+
Button.Button,
|
|
66
|
+
__spreadProps(__spreadValues({
|
|
67
|
+
onClick,
|
|
68
|
+
disabled,
|
|
69
|
+
variant: variant || "contained",
|
|
70
|
+
color: color || "primary"
|
|
71
|
+
}, buttonProps), {
|
|
72
|
+
children: text
|
|
73
|
+
}),
|
|
74
|
+
text
|
|
75
|
+
);
|
|
76
|
+
})
|
|
77
|
+
] })
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
ModalFooter.displayName = "ModalFooter";
|
|
83
|
+
const ModalHeader = ({ children, id }) => {
|
|
84
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
85
|
+
material.Box,
|
|
86
|
+
{
|
|
87
|
+
sx: {
|
|
88
|
+
padding: 2,
|
|
89
|
+
borderBottom: (theme) => `1px solid ${theme.palette.divider}`,
|
|
90
|
+
display: "flex",
|
|
91
|
+
alignItems: "center",
|
|
92
|
+
justifyContent: "space-between"
|
|
93
|
+
},
|
|
94
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { id, variant: "h6", component: "h2", children })
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
ModalHeader.displayName = "ModalHeader";
|
|
99
|
+
const ModalBody = ({ children, id }) => {
|
|
100
|
+
return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { id, sx: { padding: 2, overflowY: "auto", flexGrow: 1 }, children });
|
|
101
|
+
};
|
|
102
|
+
ModalBody.displayName = "ModalBody";
|
|
103
|
+
const isModalSlot = (child, Component, displayName) => {
|
|
104
|
+
if (child.type === Component) return true;
|
|
105
|
+
const type = child.type;
|
|
106
|
+
return (type == null ? void 0 : type.displayName) === displayName;
|
|
107
|
+
};
|
|
108
|
+
const modalStyle = {
|
|
109
|
+
position: "absolute",
|
|
110
|
+
top: "50%",
|
|
111
|
+
left: "50%",
|
|
112
|
+
transform: "translate(-50%, -50%)",
|
|
113
|
+
width: "90%",
|
|
114
|
+
maxHeight: "90vh",
|
|
115
|
+
display: "flex",
|
|
116
|
+
flexDirection: "column",
|
|
117
|
+
outline: "none"
|
|
118
|
+
};
|
|
119
|
+
const severityConfig = {
|
|
120
|
+
info: {
|
|
121
|
+
color: "primary",
|
|
122
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(InfoOutlinedIcon, { sx: { fontSize: 48 } }),
|
|
123
|
+
paletteKey: "primary"
|
|
124
|
+
},
|
|
125
|
+
warning: {
|
|
126
|
+
color: "warning",
|
|
127
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(WarningAmberIcon, { sx: { fontSize: 48 } }),
|
|
128
|
+
paletteKey: "warning"
|
|
129
|
+
},
|
|
130
|
+
error: {
|
|
131
|
+
color: "error",
|
|
132
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(ErrorOutlineIcon, { sx: { fontSize: 48 } }),
|
|
133
|
+
paletteKey: "error"
|
|
134
|
+
},
|
|
135
|
+
success: {
|
|
136
|
+
color: "success",
|
|
137
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(CheckCircleOutlineIcon, { sx: { fontSize: 48 } }),
|
|
138
|
+
paletteKey: "success"
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
const Modal = React.forwardRef(
|
|
142
|
+
({
|
|
143
|
+
mode = "default",
|
|
144
|
+
open: controlledOpen,
|
|
145
|
+
onClose: controlledOnClose,
|
|
146
|
+
title,
|
|
147
|
+
children,
|
|
148
|
+
showCloseButton = true,
|
|
149
|
+
closeButtonText = "Cerrar",
|
|
150
|
+
closeButtonDisabled = false,
|
|
151
|
+
actions = [],
|
|
152
|
+
maxWidth = "sm",
|
|
153
|
+
hiddenHeader = false,
|
|
154
|
+
hiddenBody = false,
|
|
155
|
+
hiddenFooter = false,
|
|
156
|
+
sx,
|
|
157
|
+
paperSx,
|
|
158
|
+
className,
|
|
159
|
+
// Props del modo confirm
|
|
160
|
+
onConfirm,
|
|
161
|
+
confirmText = "Confirmar",
|
|
162
|
+
confirmDisabled = false,
|
|
163
|
+
severity = "info",
|
|
164
|
+
confirmMessage
|
|
165
|
+
}, ref) => {
|
|
166
|
+
const [internalOpen, setInternalOpen] = React.useState(false);
|
|
167
|
+
const [confirmLoading, setConfirmLoading] = React.useState(false);
|
|
168
|
+
const titleId = React.useId();
|
|
169
|
+
const descId = React.useId();
|
|
170
|
+
const isOpen = controlledOpen !== void 0 ? controlledOpen : internalOpen;
|
|
171
|
+
React.useImperativeHandle(ref, () => ({
|
|
172
|
+
open: () => setInternalOpen(true),
|
|
173
|
+
close: () => {
|
|
174
|
+
setInternalOpen(false);
|
|
175
|
+
controlledOnClose == null ? void 0 : controlledOnClose();
|
|
176
|
+
}
|
|
177
|
+
}));
|
|
178
|
+
const handleCloseInternal = () => {
|
|
179
|
+
setInternalOpen(false);
|
|
180
|
+
controlledOnClose == null ? void 0 : controlledOnClose();
|
|
181
|
+
};
|
|
182
|
+
const handleConfirm = async () => {
|
|
183
|
+
if (!onConfirm) {
|
|
184
|
+
handleCloseInternal();
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const result = onConfirm();
|
|
188
|
+
if (!(result instanceof Promise)) {
|
|
189
|
+
handleCloseInternal();
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
setConfirmLoading(true);
|
|
193
|
+
try {
|
|
194
|
+
await result;
|
|
195
|
+
handleCloseInternal();
|
|
196
|
+
} catch (err) {
|
|
197
|
+
console.error("Modal onConfirm failed:", err);
|
|
198
|
+
} finally {
|
|
199
|
+
setConfirmLoading(false);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
const theme = material.useTheme();
|
|
203
|
+
const isMobile = material.useMediaQuery(theme.breakpoints.down("sm"));
|
|
204
|
+
const getWidth = () => {
|
|
205
|
+
if (isMobile) return "95%";
|
|
206
|
+
switch (maxWidth) {
|
|
207
|
+
case "xs":
|
|
208
|
+
return 300;
|
|
209
|
+
case "sm":
|
|
210
|
+
return 500;
|
|
211
|
+
case "md":
|
|
212
|
+
return 700;
|
|
213
|
+
case "lg":
|
|
214
|
+
return 900;
|
|
215
|
+
case "xl":
|
|
216
|
+
return 1100;
|
|
217
|
+
case false:
|
|
218
|
+
return "auto";
|
|
219
|
+
default:
|
|
220
|
+
return typeof maxWidth === "string" ? maxWidth : 500;
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
const paperBaseSx = __spreadProps(__spreadValues({}, modalStyle), { width: getWidth() });
|
|
224
|
+
const mergedPaperSx = mergeSx.mergeSx(paperBaseSx, paperSx);
|
|
225
|
+
if (mode === "confirm") {
|
|
226
|
+
const config = severityConfig[severity];
|
|
227
|
+
const message = confirmMessage != null ? confirmMessage : children;
|
|
228
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
229
|
+
material.Modal,
|
|
230
|
+
{
|
|
231
|
+
open: isOpen,
|
|
232
|
+
onClose: handleCloseInternal,
|
|
233
|
+
"aria-labelledby": title ? titleId : void 0,
|
|
234
|
+
"aria-describedby": message ? descId : void 0,
|
|
235
|
+
closeAfterTransition: true,
|
|
236
|
+
sx,
|
|
237
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(material.Paper, { className, sx: mergedPaperSx, children: [
|
|
238
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { spacing: 2.5, sx: { p: 3, alignItems: "center", textAlign: "center" }, children: [
|
|
239
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
240
|
+
material.Box,
|
|
241
|
+
{
|
|
242
|
+
sx: {
|
|
243
|
+
width: 72,
|
|
244
|
+
height: 72,
|
|
245
|
+
borderRadius: "50%",
|
|
246
|
+
backgroundColor: (t) => t.palette[config.paletteKey].light,
|
|
247
|
+
color: (t) => t.palette[config.paletteKey].dark,
|
|
248
|
+
display: "flex",
|
|
249
|
+
alignItems: "center",
|
|
250
|
+
justifyContent: "center",
|
|
251
|
+
opacity: 0.9
|
|
252
|
+
},
|
|
253
|
+
children: config.icon
|
|
254
|
+
}
|
|
255
|
+
),
|
|
256
|
+
title && /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { id: titleId, variant: "h6", component: "h2", sx: { fontWeight: 700 }, children: title }),
|
|
257
|
+
message && /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { id: descId, variant: "body2", color: "text.secondary", children: message })
|
|
258
|
+
] }),
|
|
259
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
260
|
+
ModalFooter,
|
|
261
|
+
{
|
|
262
|
+
showCloseButton,
|
|
263
|
+
closeButtonText,
|
|
264
|
+
closeButtonDisabled: closeButtonDisabled || confirmLoading,
|
|
265
|
+
onClose: handleCloseInternal,
|
|
266
|
+
actions: [
|
|
267
|
+
{
|
|
268
|
+
text: confirmText,
|
|
269
|
+
onClick: handleConfirm,
|
|
270
|
+
disabled: confirmDisabled || confirmLoading,
|
|
271
|
+
variant: "contained",
|
|
272
|
+
color: config.color
|
|
273
|
+
}
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
)
|
|
277
|
+
] })
|
|
278
|
+
}
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
const renderChildren = () => {
|
|
282
|
+
let header = null;
|
|
283
|
+
let body = null;
|
|
284
|
+
let footer = null;
|
|
285
|
+
React.Children.forEach(children, (child) => {
|
|
286
|
+
var _a, _b, _c, _d, _e;
|
|
287
|
+
if (!React.isValidElement(child)) return;
|
|
288
|
+
if (isModalSlot(child, ModalHeader, "ModalHeader")) {
|
|
289
|
+
const headerChild = child;
|
|
290
|
+
header = React.cloneElement(headerChild, __spreadValues({ id: titleId }, headerChild.props));
|
|
291
|
+
} else if (isModalSlot(child, ModalBody, "ModalBody")) {
|
|
292
|
+
const bodyChild = child;
|
|
293
|
+
body = React.cloneElement(bodyChild, __spreadValues({ id: descId }, bodyChild.props));
|
|
294
|
+
} else if (isModalSlot(child, ModalFooter, "ModalFooter")) {
|
|
295
|
+
const footerChild = child;
|
|
296
|
+
const childProps = footerChild.props;
|
|
297
|
+
footer = React.cloneElement(footerChild, {
|
|
298
|
+
showCloseButton: (_a = childProps.showCloseButton) != null ? _a : showCloseButton,
|
|
299
|
+
closeButtonText: (_b = childProps.closeButtonText) != null ? _b : closeButtonText,
|
|
300
|
+
closeButtonDisabled: (_c = childProps.closeButtonDisabled) != null ? _c : closeButtonDisabled,
|
|
301
|
+
onClose: (_d = childProps.onClose) != null ? _d : handleCloseInternal,
|
|
302
|
+
actions: (_e = childProps.actions) != null ? _e : actions
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
if (!footer && !hiddenFooter) {
|
|
307
|
+
footer = /* @__PURE__ */ jsxRuntime.jsx(
|
|
308
|
+
ModalFooter,
|
|
309
|
+
{
|
|
310
|
+
showCloseButton,
|
|
311
|
+
closeButtonText,
|
|
312
|
+
closeButtonDisabled,
|
|
313
|
+
onClose: handleCloseInternal,
|
|
314
|
+
actions
|
|
315
|
+
}
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
319
|
+
!hiddenHeader && (header || title && /* @__PURE__ */ jsxRuntime.jsx(ModalHeader, { id: titleId, children: title })),
|
|
320
|
+
!hiddenBody && body,
|
|
321
|
+
footer
|
|
322
|
+
] });
|
|
323
|
+
};
|
|
324
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
325
|
+
material.Modal,
|
|
326
|
+
{
|
|
327
|
+
open: isOpen,
|
|
328
|
+
onClose: handleCloseInternal,
|
|
329
|
+
"aria-labelledby": titleId,
|
|
330
|
+
"aria-describedby": descId,
|
|
331
|
+
closeAfterTransition: true,
|
|
332
|
+
sx,
|
|
333
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(material.Paper, { className, sx: mergedPaperSx, children: renderChildren() })
|
|
334
|
+
}
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
);
|
|
338
|
+
Modal.displayName = "Modal";
|
|
339
|
+
const ModalWithStatics = Modal;
|
|
340
|
+
ModalWithStatics.Header = ModalHeader;
|
|
341
|
+
ModalWithStatics.Body = ModalBody;
|
|
342
|
+
ModalWithStatics.Footer = ModalFooter;
|
|
343
|
+
exports.Modal = ModalWithStatics;
|
|
344
|
+
exports.ModalBody = ModalBody;
|
|
345
|
+
exports.ModalFooter = ModalFooter;
|
|
346
|
+
exports.ModalHeader = ModalHeader;
|
|
347
|
+
exports.default = ModalWithStatics;
|
|
9
348
|
//# sourceMappingURL=Modal.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"Modal.cjs","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":["jsxs","Box","Stack","jsx","Button","Typography","forwardRef","useState","useId","useImperativeHandle","useTheme","useMediaQuery","mergeSx","MuiModal","Paper","Children","isValidElement","cloneElement","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BO,MAAM,cAA0C,CAAC;AAAA,EACtD;AAAA,EACA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a;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,iBACEd,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA,SAAS;AAAA,YACT;AAAA,UAAA;AAAA,QAAA;AAAA,MAGN;AAEA,aACEH,2BAAAA,KAAAkB,qBAAA,EACG,UAAA;AAAA,QAAA,CAAC,iBAAiB,UAAW,wCAAU,aAAA,EAAY,IAAI,SAAU,UAAA,MAAA,CAAM;AAAA,QACvE,CAAC,cAAc;AAAA,QACf;AAAA,MAAA,GACH;AAAA,IAEJ;AAEA,WACEf,2BAAAA;AAAAA,MAACU,SAAAA;AAAAA,MAAA;AAAA,QACC,MAAM;AAAA,QACN,SAAS;AAAA,QACT,mBAAiB;AAAA,QACjB,oBAAkB;AAAA,QAClB,sBAAoB;AAAA,QACpB;AAAA,QAEA,yCAACC,SAAAA,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,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { forwardRef, ReactNode } from 'react';
|
|
2
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
2
3
|
import { DialogProps } from '@mui/material/Dialog';
|
|
3
|
-
import {
|
|
4
|
+
import { ModalFooter, ModalAction } from './ModalFooter';
|
|
4
5
|
import { ModalHeader } from './ModalHeader';
|
|
5
6
|
import { ModalBody } from './ModalBody';
|
|
6
7
|
export interface ModalRef {
|
|
@@ -9,7 +10,7 @@ export interface ModalRef {
|
|
|
9
10
|
}
|
|
10
11
|
export type ModalMode = 'default' | 'confirm';
|
|
11
12
|
export type ModalSeverity = 'info' | 'warning' | 'error' | 'success';
|
|
12
|
-
interface ModalProps {
|
|
13
|
+
export interface ModalProps {
|
|
13
14
|
/**
|
|
14
15
|
* Modo del modal.
|
|
15
16
|
* - `default` (default): modal genérico con slots `Header`/`Body`/`Footer` y
|
|
@@ -30,10 +31,24 @@ interface ModalProps {
|
|
|
30
31
|
closeButtonDisabled?: boolean;
|
|
31
32
|
actions?: ModalAction[];
|
|
32
33
|
maxWidth?: DialogProps['maxWidth'];
|
|
34
|
+
/** Oculta el header (incluso si hay `title` o se pasa un `<Modal.Header>`). */
|
|
35
|
+
hiddenHeader?: boolean;
|
|
36
|
+
/** Oculta el body (incluso si se pasa un `<Modal.Body>`). */
|
|
37
|
+
hiddenBody?: boolean;
|
|
38
|
+
/** Oculta el footer (incluso si se pasa un `<Modal.Footer>` o `actions`). */
|
|
33
39
|
hiddenFooter?: boolean;
|
|
40
|
+
/** sx del Modal root (MuiModal). */
|
|
41
|
+
sx?: SxProps<Theme>;
|
|
42
|
+
/** sx del Paper interno (contenedor visual). Se mergea sobre el default. */
|
|
43
|
+
paperSx?: SxProps<Theme>;
|
|
44
|
+
/** className del Paper interno. */
|
|
45
|
+
className?: string;
|
|
34
46
|
/**
|
|
35
47
|
* Callback de confirmación. Soporta promesa — si devuelve `Promise`, el
|
|
36
48
|
* botón muestra estado `disabled` mientras resuelve.
|
|
49
|
+
*
|
|
50
|
+
* Si la promesa **rechaza**, el modal queda abierto para que el consumer
|
|
51
|
+
* pueda mostrar el error en su UI. El modal se cierra solo en éxito.
|
|
37
52
|
*/
|
|
38
53
|
onConfirm?: () => void | Promise<void>;
|
|
39
54
|
/** Texto del botón primario en modo `confirm`. Default: "Confirmar". */
|
|
@@ -55,8 +70,8 @@ interface ModalProps {
|
|
|
55
70
|
*/
|
|
56
71
|
confirmMessage?: ReactNode;
|
|
57
72
|
}
|
|
58
|
-
export declare const Modal:
|
|
59
|
-
type ModalComponent =
|
|
73
|
+
export declare const Modal: import('react').ForwardRefExoticComponent<ModalProps & import('react').RefAttributes<ModalRef>>;
|
|
74
|
+
type ModalComponent = ReturnType<typeof forwardRef<ModalRef, ModalProps>> & {
|
|
60
75
|
Header: typeof ModalHeader;
|
|
61
76
|
Body: typeof ModalBody;
|
|
62
77
|
Footer: typeof ModalFooter;
|