@soyfri/shared-library 2.0.0-beta.8 → 2.0.0-beta8
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/Autocomplete-BA-cGASd.js +316 -0
- package/Autocomplete-BA-cGASd.js.map +1 -0
- package/Autocomplete-C2x-lBvZ.cjs +315 -0
- package/Autocomplete-C2x-lBvZ.cjs.map +1 -0
- package/Avatar-9L7YMxya.cjs +162 -0
- package/Avatar-9L7YMxya.cjs.map +1 -0
- package/Avatar-BJTr-PBd.js +163 -0
- package/Avatar-BJTr-PBd.js.map +1 -0
- package/Card-DG_crfkK.cjs +185 -0
- package/Card-DG_crfkK.cjs.map +1 -0
- package/Card-Ug-ttVSh.js +186 -0
- package/Card-Ug-ttVSh.js.map +1 -0
- package/Chip-OPYQ1uQ_.js +74 -0
- package/Chip-OPYQ1uQ_.js.map +1 -0
- package/Chip-qoJLDiva.cjs +73 -0
- package/Chip-qoJLDiva.cjs.map +1 -0
- package/DatePicker-8f_9bwhS.js +202 -0
- package/DatePicker-8f_9bwhS.js.map +1 -0
- package/DatePicker-DLSfkgGA.cjs +201 -0
- package/DatePicker-DLSfkgGA.cjs.map +1 -0
- package/DateRangePicker-BVpeJCHI.js +76 -0
- package/DateRangePicker-BVpeJCHI.js.map +1 -0
- package/DateRangePicker-B_hKQhbj.cjs +75 -0
- package/DateRangePicker-B_hKQhbj.cjs.map +1 -0
- package/DateTimePicker-CWNW09-O.cjs +220 -0
- package/DateTimePicker-CWNW09-O.cjs.map +1 -0
- package/DateTimePicker-D4L9GAod.js +221 -0
- package/DateTimePicker-D4L9GAod.js.map +1 -0
- package/Input-Cp911l23.js +174 -0
- package/Input-Cp911l23.js.map +1 -0
- package/Input-DI0jfq5X.cjs +173 -0
- package/Input-DI0jfq5X.cjs.map +1 -0
- package/Modal-Bm_HH9cv.cjs +319 -0
- package/Modal-Bm_HH9cv.cjs.map +1 -0
- package/Modal-Bnz6d9m9.js +320 -0
- package/Modal-Bnz6d9m9.js.map +1 -0
- package/RadioGroup-CxqDHap1.cjs +200 -0
- package/RadioGroup-CxqDHap1.cjs.map +1 -0
- package/RadioGroup-DMi9FvMP.js +201 -0
- package/RadioGroup-DMi9FvMP.js.map +1 -0
- package/Select-3CBOfM2H.js +447 -0
- package/Select-3CBOfM2H.js.map +1 -0
- package/Select-Bku4f4f8.cjs +446 -0
- package/Select-Bku4f4f8.cjs.map +1 -0
- package/Stat-BUcFCGrz.cjs +83 -0
- package/Stat-BUcFCGrz.cjs.map +1 -0
- package/Stat-C06A_izS.js +84 -0
- package/Stat-C06A_izS.js.map +1 -0
- package/StatusMessage-C5B6oGZ_.cjs +78 -0
- package/StatusMessage-C5B6oGZ_.cjs.map +1 -0
- package/StatusMessage-D1GlfQdz.js +79 -0
- package/StatusMessage-D1GlfQdz.js.map +1 -0
- package/Step-Dq0N72YB.js +49 -0
- package/Step-Dq0N72YB.js.map +1 -0
- package/Step-a8U8O-91.cjs +48 -0
- package/Step-a8U8O-91.cjs.map +1 -0
- package/Switch-BIeobv6i.cjs +179 -0
- package/Switch-BIeobv6i.cjs.map +1 -0
- package/Switch-DQEOxM2R.js +180 -0
- package/Switch-DQEOxM2R.js.map +1 -0
- package/Tab-Co31KY2k.cjs +95 -0
- package/Tab-Co31KY2k.cjs.map +1 -0
- package/Tab-DiK62gRz.js +96 -0
- package/Tab-DiK62gRz.js.map +1 -0
- package/Table-C2LbW0B1.js +531 -0
- package/Table-C2LbW0B1.js.map +1 -0
- package/Table-C4OM6rrC.cjs +530 -0
- package/Table-C4OM6rrC.cjs.map +1 -0
- package/components/AppBar/AppBar.cjs +1 -1
- package/components/AppBar/AppBar.js +1 -1
- package/components/Autocomplete/Autocomplete.cjs +4 -311
- package/components/Autocomplete/Autocomplete.cjs.map +1 -1
- package/components/Autocomplete/Autocomplete.js +4 -311
- package/components/Autocomplete/Autocomplete.js.map +1 -1
- package/components/Avatar/Avatar.cjs +2 -160
- package/components/Avatar/Avatar.cjs.map +1 -1
- package/components/Avatar/Avatar.js +2 -160
- package/components/Avatar/Avatar.js.map +1 -1
- package/components/Card/Card.cjs +7 -184
- package/components/Card/Card.cjs.map +1 -1
- package/components/Card/Card.js +7 -184
- package/components/Card/Card.js.map +1 -1
- package/components/Chip/Chip.cjs +2 -71
- package/components/Chip/Chip.cjs.map +1 -1
- package/components/Chip/Chip.js +2 -71
- package/components/Chip/Chip.js.map +1 -1
- 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 +1 -0
- package/components/DatePicker/DatePicker.cjs +3 -200
- package/components/DatePicker/DatePicker.cjs.map +1 -1
- package/components/DatePicker/DatePicker.js +3 -200
- package/components/DatePicker/DatePicker.js.map +1 -1
- package/components/DateRangePicker/DateRangePicker.cjs +2 -73
- package/components/DateRangePicker/DateRangePicker.cjs.map +1 -1
- package/components/DateRangePicker/DateRangePicker.js +2 -73
- package/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/components/DateTimePicker/DateTimePicker.cjs +3 -219
- package/components/DateTimePicker/DateTimePicker.cjs.map +1 -1
- package/components/DateTimePicker/DateTimePicker.js +3 -219
- package/components/DateTimePicker/DateTimePicker.js.map +1 -1
- package/components/Drawer/Drawer.cjs +1 -1
- package/components/Drawer/Drawer.js +1 -1
- package/components/Input/Input.cjs +3 -172
- package/components/Input/Input.cjs.map +1 -1
- package/components/Input/Input.js +3 -172
- package/components/Input/Input.js.map +1 -1
- package/components/Modal/Modal.cjs +7 -317
- package/components/Modal/Modal.cjs.map +1 -1
- package/components/Modal/Modal.js +6 -316
- package/components/Modal/Modal.js.map +1 -1
- package/components/Modal/index.d.ts +2 -1
- package/components/Modal.d.ts +4 -0
- package/components/RadioGroup/RadioGroup.cjs +3 -199
- package/components/RadioGroup/RadioGroup.cjs.map +1 -1
- package/components/RadioGroup/RadioGroup.js +3 -199
- package/components/RadioGroup/RadioGroup.js.map +1 -1
- package/components/ScrollTopButton/ScrollTopButton.cjs +1 -1
- package/components/ScrollTopButton/ScrollTopButton.js +1 -1
- package/components/Select/Select.cjs +4 -445
- package/components/Select/Select.cjs.map +1 -1
- package/components/Select/Select.js +4 -445
- package/components/Select/Select.js.map +1 -1
- package/components/Stat/Stat.cjs +2 -81
- package/components/Stat/Stat.cjs.map +1 -1
- package/components/Stat/Stat.js +2 -81
- package/components/Stat/Stat.js.map +1 -1
- package/components/StatusMessage/StatusMessage.cjs +4 -77
- package/components/StatusMessage/StatusMessage.cjs.map +1 -1
- package/components/StatusMessage/StatusMessage.d.ts +1 -1
- package/components/StatusMessage/StatusMessage.js +3 -76
- package/components/StatusMessage/StatusMessage.js.map +1 -1
- package/components/StatusMessage/index.d.ts +2 -1
- package/components/StatusMessage.d.ts +4 -0
- package/components/Stepper/Stepper.cjs +3 -46
- package/components/Stepper/Stepper.cjs.map +1 -1
- package/components/Stepper/Stepper.js +3 -46
- package/components/Stepper/Stepper.js.map +1 -1
- package/components/Switch/Switch.cjs +3 -178
- package/components/Switch/Switch.cjs.map +1 -1
- package/components/Switch/Switch.js +3 -178
- package/components/Switch/Switch.js.map +1 -1
- package/components/Table/Table.cjs +2 -528
- package/components/Table/Table.cjs.map +1 -1
- package/components/Table/Table.d.ts +1 -1
- package/components/Table/Table.js +2 -528
- package/components/Table/Table.js.map +1 -1
- package/components/Tabs/Tabs.cjs +3 -93
- package/components/Tabs/Tabs.cjs.map +1 -1
- package/components/Tabs/Tabs.js +3 -93
- package/components/Tabs/Tabs.js.map +1 -1
- package/hooks/Wizard/WizardContext.d.ts +2 -2
- package/index.cjs +46 -1
- package/index.cjs.map +1 -1
- package/index.d.ts +30 -0
- package/index.js +46 -1
- package/index.js.map +1 -1
- package/package.json +5 -3
- package/{resolvePreset-CT3kU-K2.cjs → resolvePreset-CxTI6_Ln.cjs} +3 -3
- package/{resolvePreset-CT3kU-K2.cjs.map → resolvePreset-CxTI6_Ln.cjs.map} +1 -1
- package/{resolvePreset-B-IB0ehH.js → resolvePreset-K6_BfWHD.js} +3 -3
- package/{resolvePreset-B-IB0ehH.js.map → resolvePreset-K6_BfWHD.js.map} +1 -1
- package/useWizard-CWdIxZzX.cjs.map +1 -1
- package/useWizard-CWq--C3o.js.map +1 -1
|
@@ -1,175 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
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
|
-
import { jsx } from "react/jsx-runtime";
|
|
33
|
-
import { TextField } from "@mui/material";
|
|
34
|
-
import { useTheme } from "@mui/material/styles";
|
|
35
|
-
import { Controller } from "react-hook-form";
|
|
36
|
-
import { b as buildFormFieldSx, F as FIELD_INPUT_PADDING_Y } from "../../formField.sx-DfVbMe0V.js";
|
|
37
|
-
import { r as resolvePreset } from "../../resolvePreset-B-IB0ehH.js";
|
|
38
|
-
const parseValue = (raw, type) => {
|
|
39
|
-
if (type !== "number") return raw;
|
|
40
|
-
if (raw === "" || raw === "-") return raw;
|
|
41
|
-
const n = parseFloat(raw);
|
|
42
|
-
return isNaN(n) ? raw : n;
|
|
43
|
-
};
|
|
44
|
-
const buildSlotProps = (type, min, max, customSlotProps, customInputProps, _labelPosition, readOnly) => {
|
|
45
|
-
const numberAttrs = type === "number" ? __spreadValues({ min: min != null ? min : Number.NEGATIVE_INFINITY }, max !== void 0 && { max }) : {};
|
|
46
|
-
return __spreadProps(__spreadValues({}, customSlotProps), {
|
|
47
|
-
htmlInput: __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, customInputProps), customSlotProps == null ? void 0 : customSlotProps.htmlInput), numberAttrs), readOnly && { readOnly: true }),
|
|
48
|
-
// Dejamos que MUI maneje el shrink nativamente (animación inside → up).
|
|
49
|
-
// El consumidor puede forzar shrink con slotProps.inputLabel.shrink=true si lo necesita.
|
|
50
|
-
inputLabel: __spreadValues({}, customSlotProps == null ? void 0 : customSlotProps.inputLabel)
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
const buildInputSx = (borderRadius, labelPosition) => {
|
|
54
|
-
const radius = typeof borderRadius === "number" ? `${borderRadius}px` : borderRadius;
|
|
55
|
-
return buildFormFieldSx({
|
|
56
|
-
borderRadius,
|
|
57
|
-
labelPosition,
|
|
58
|
-
extraOutsideSx: {
|
|
59
|
-
"& .MuiInputBase-input": {
|
|
60
|
-
paddingTop: FIELD_INPUT_PADDING_Y,
|
|
61
|
-
paddingBottom: FIELD_INPUT_PADDING_Y
|
|
62
|
-
},
|
|
63
|
-
// Filled: quitar el padding-top reservado para el label flotante dentro.
|
|
64
|
-
"& .MuiFilledInput-root": {
|
|
65
|
-
paddingTop: 0,
|
|
66
|
-
borderRadius: `${radius} ${radius} 0 0`
|
|
67
|
-
},
|
|
68
|
-
"& .MuiFilledInput-input": {
|
|
69
|
-
paddingTop: FIELD_INPUT_PADDING_Y
|
|
70
|
-
},
|
|
71
|
-
// Standard: quitar el margin-top reservado para el label flotante.
|
|
72
|
-
"& .MuiInput-root": {
|
|
73
|
-
marginTop: 0
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
const Input = (props) => {
|
|
79
|
-
const _a = props, {
|
|
80
|
-
type = "text",
|
|
81
|
-
variant = "outlined",
|
|
82
|
-
size = "small",
|
|
83
|
-
borderRadius = 10,
|
|
84
|
-
labelPosition = "outside",
|
|
85
|
-
preset,
|
|
86
|
-
min,
|
|
87
|
-
max,
|
|
88
|
-
readOnly,
|
|
89
|
-
inputProps,
|
|
90
|
-
slotProps,
|
|
91
|
-
sx
|
|
92
|
-
} = _a, rest = __objRest(_a, [
|
|
93
|
-
"type",
|
|
94
|
-
"variant",
|
|
95
|
-
"size",
|
|
96
|
-
"borderRadius",
|
|
97
|
-
"labelPosition",
|
|
98
|
-
"preset",
|
|
99
|
-
"min",
|
|
100
|
-
"max",
|
|
101
|
-
"readOnly",
|
|
102
|
-
"inputProps",
|
|
103
|
-
"slotProps",
|
|
104
|
-
"sx"
|
|
105
|
-
]);
|
|
106
|
-
const theme = useTheme();
|
|
107
|
-
const presetSx = resolvePreset("Input", preset, theme);
|
|
108
|
-
const finalSlotProps = buildSlotProps(
|
|
109
|
-
type,
|
|
110
|
-
min,
|
|
111
|
-
max,
|
|
112
|
-
slotProps,
|
|
113
|
-
inputProps,
|
|
114
|
-
labelPosition,
|
|
115
|
-
readOnly
|
|
116
|
-
);
|
|
117
|
-
const mergedSx = [
|
|
118
|
-
buildInputSx(borderRadius, labelPosition),
|
|
119
|
-
...presetSx ? [presetSx] : [],
|
|
120
|
-
...Array.isArray(sx) ? sx : [sx]
|
|
121
|
-
];
|
|
122
|
-
if ("control" in props && props.control) {
|
|
123
|
-
const { name, control, validation } = props;
|
|
124
|
-
return /* @__PURE__ */ jsx(
|
|
125
|
-
Controller,
|
|
126
|
-
{
|
|
127
|
-
name,
|
|
128
|
-
control,
|
|
129
|
-
rules: validation,
|
|
130
|
-
render: ({ field, fieldState: { error } }) => {
|
|
131
|
-
var _a2, _b;
|
|
132
|
-
return /* @__PURE__ */ jsx(
|
|
133
|
-
TextField,
|
|
134
|
-
__spreadProps(__spreadValues({
|
|
135
|
-
fullWidth: true
|
|
136
|
-
}, rest), {
|
|
137
|
-
name: field.name,
|
|
138
|
-
value: (_a2 = field.value) != null ? _a2 : "",
|
|
139
|
-
onChange: (e) => field.onChange(parseValue(e.target.value, type)),
|
|
140
|
-
onBlur: field.onBlur,
|
|
141
|
-
inputRef: field.ref,
|
|
142
|
-
type,
|
|
143
|
-
variant,
|
|
144
|
-
size,
|
|
145
|
-
slotProps: finalSlotProps,
|
|
146
|
-
sx: mergedSx,
|
|
147
|
-
error: !!error || rest.error,
|
|
148
|
-
helperText: (_b = error == null ? void 0 : error.message) != null ? _b : rest.helperText
|
|
149
|
-
})
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
const { value, onChange } = props;
|
|
156
|
-
return /* @__PURE__ */ jsx(
|
|
157
|
-
TextField,
|
|
158
|
-
__spreadProps(__spreadValues({
|
|
159
|
-
fullWidth: true
|
|
160
|
-
}, rest), {
|
|
161
|
-
value: value != null ? value : "",
|
|
162
|
-
onChange: (e) => onChange(parseValue(e.target.value, type)),
|
|
163
|
-
type,
|
|
164
|
-
variant,
|
|
165
|
-
size,
|
|
166
|
-
slotProps: finalSlotProps,
|
|
167
|
-
sx: mergedSx
|
|
168
|
-
})
|
|
169
|
-
);
|
|
170
|
-
};
|
|
1
|
+
import { I, I as I2 } from "../../Input-Cp911l23.js";
|
|
171
2
|
export {
|
|
172
|
-
Input,
|
|
173
|
-
|
|
3
|
+
I as Input,
|
|
4
|
+
I2 as default
|
|
174
5
|
};
|
|
175
6
|
//# sourceMappingURL=Input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","sources":[
|
|
1
|
+
{"version":3,"file":"Input.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,319 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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));
|
|
21
|
-
var __objRest = (source, exclude) => {
|
|
22
|
-
var target = {};
|
|
23
|
-
for (var prop in source)
|
|
24
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
if (source != null && __getOwnPropSymbols)
|
|
27
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
}
|
|
31
|
-
return target;
|
|
32
|
-
};
|
|
33
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
34
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
35
|
-
const React = require("react");
|
|
36
|
-
const material = require("@mui/material");
|
|
37
|
-
const InfoOutlinedIcon = require("@mui/icons-material/InfoOutlined");
|
|
38
|
-
const WarningAmberIcon = require("@mui/icons-material/WarningAmber");
|
|
39
|
-
const ErrorOutlineIcon = require("@mui/icons-material/ErrorOutline");
|
|
40
|
-
const CheckCircleOutlineIcon = require("@mui/icons-material/CheckCircleOutline");
|
|
41
|
-
const ModalFooter = ({
|
|
42
|
-
// Renombrado
|
|
43
|
-
children,
|
|
44
|
-
showCloseButton = true,
|
|
45
|
-
closeButtonText = "Cerrar",
|
|
46
|
-
closeButtonDisabled = false,
|
|
47
|
-
onClose,
|
|
48
|
-
actions = []
|
|
49
|
-
}) => {
|
|
50
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { padding: 2, borderTop: "1px solid #e0e0e0", display: "flex", justifyContent: "flex-end", gap: 1 }, children: [
|
|
51
|
-
children,
|
|
52
|
-
/* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { direction: "row", spacing: 1, children: [
|
|
53
|
-
showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(
|
|
54
|
-
material.Button,
|
|
55
|
-
{
|
|
56
|
-
onClick: onClose,
|
|
57
|
-
disabled: closeButtonDisabled,
|
|
58
|
-
variant: "outlined",
|
|
59
|
-
color: "secondary",
|
|
60
|
-
children: closeButtonText
|
|
61
|
-
}
|
|
62
|
-
),
|
|
63
|
-
actions.map((action, index) => {
|
|
64
|
-
const { buttonProps } = action;
|
|
65
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
66
|
-
material.Button,
|
|
67
|
-
__spreadProps(__spreadValues({
|
|
68
|
-
onClick: action.onClick,
|
|
69
|
-
disabled: action.disabled,
|
|
70
|
-
variant: action.variant || "contained",
|
|
71
|
-
color: action.color || "primary"
|
|
72
|
-
}, buttonProps), {
|
|
73
|
-
children: action.text
|
|
74
|
-
}),
|
|
75
|
-
index
|
|
76
|
-
);
|
|
77
|
-
})
|
|
78
|
-
] })
|
|
79
|
-
] });
|
|
80
|
-
};
|
|
81
|
-
const ModalHeader = ({ children }) => {
|
|
82
|
-
return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { padding: 2, borderBottom: "1px solid #e0e0e0", display: "flex", alignItems: "center", justifyContent: "space-between" }, children: /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "h6", component: "h2", children }) });
|
|
83
|
-
};
|
|
84
|
-
const ModalBody = ({ children }) => {
|
|
85
|
-
return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { padding: 2, overflowY: "auto", flexGrow: 1 }, children });
|
|
86
|
-
};
|
|
87
|
-
const modalStyle = {
|
|
88
|
-
position: "absolute",
|
|
89
|
-
top: "50%",
|
|
90
|
-
left: "50%",
|
|
91
|
-
transform: "translate(-50%, -50%)",
|
|
92
|
-
width: "90%",
|
|
93
|
-
maxHeight: "90vh",
|
|
94
|
-
display: "flex",
|
|
95
|
-
flexDirection: "column",
|
|
96
|
-
outline: "none"
|
|
97
|
-
};
|
|
98
|
-
const severityConfig = {
|
|
99
|
-
info: {
|
|
100
|
-
color: "primary",
|
|
101
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(InfoOutlinedIcon, { sx: { fontSize: 48 } }),
|
|
102
|
-
bg: "primary.light"
|
|
103
|
-
},
|
|
104
|
-
warning: {
|
|
105
|
-
color: "warning",
|
|
106
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(WarningAmberIcon, { sx: { fontSize: 48 } }),
|
|
107
|
-
bg: "warning.light"
|
|
108
|
-
},
|
|
109
|
-
error: {
|
|
110
|
-
color: "error",
|
|
111
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(ErrorOutlineIcon, { sx: { fontSize: 48 } }),
|
|
112
|
-
bg: "error.light"
|
|
113
|
-
},
|
|
114
|
-
success: {
|
|
115
|
-
color: "success",
|
|
116
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(CheckCircleOutlineIcon, { sx: { fontSize: 48 } }),
|
|
117
|
-
bg: "success.light"
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
const Modal = React.forwardRef(
|
|
121
|
-
({
|
|
122
|
-
mode = "default",
|
|
123
|
-
open: controlledOpen,
|
|
124
|
-
onClose: controlledOnClose,
|
|
125
|
-
title,
|
|
126
|
-
children,
|
|
127
|
-
showCloseButton = true,
|
|
128
|
-
closeButtonText = "Cerrar",
|
|
129
|
-
closeButtonDisabled = false,
|
|
130
|
-
actions = [],
|
|
131
|
-
maxWidth = "sm",
|
|
132
|
-
hiddenFooter = false,
|
|
133
|
-
// Props del modo confirm
|
|
134
|
-
onConfirm,
|
|
135
|
-
confirmText = "Confirmar",
|
|
136
|
-
confirmDisabled = false,
|
|
137
|
-
severity = "info",
|
|
138
|
-
confirmMessage
|
|
139
|
-
}, ref) => {
|
|
140
|
-
const [internalOpen, setInternalOpen] = React.useState(false);
|
|
141
|
-
const [confirmLoading, setConfirmLoading] = React.useState(false);
|
|
142
|
-
const isOpen = controlledOpen !== void 0 ? controlledOpen : internalOpen;
|
|
143
|
-
React.useImperativeHandle(ref, () => ({
|
|
144
|
-
open: () => setInternalOpen(true),
|
|
145
|
-
close: () => {
|
|
146
|
-
setInternalOpen(false);
|
|
147
|
-
controlledOnClose == null ? void 0 : controlledOnClose();
|
|
148
|
-
}
|
|
149
|
-
}));
|
|
150
|
-
const handleCloseInternal = () => {
|
|
151
|
-
setInternalOpen(false);
|
|
152
|
-
controlledOnClose == null ? void 0 : controlledOnClose();
|
|
153
|
-
};
|
|
154
|
-
const handleConfirm = async () => {
|
|
155
|
-
if (!onConfirm) {
|
|
156
|
-
handleCloseInternal();
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
try {
|
|
160
|
-
const result = onConfirm();
|
|
161
|
-
if (result instanceof Promise) {
|
|
162
|
-
setConfirmLoading(true);
|
|
163
|
-
await result;
|
|
164
|
-
}
|
|
165
|
-
} finally {
|
|
166
|
-
setConfirmLoading(false);
|
|
167
|
-
handleCloseInternal();
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
const theme = material.useTheme();
|
|
171
|
-
const isMobile = material.useMediaQuery(theme.breakpoints.down("sm"));
|
|
172
|
-
const getWidth = () => {
|
|
173
|
-
if (isMobile) return "95%";
|
|
174
|
-
switch (maxWidth) {
|
|
175
|
-
case "xs":
|
|
176
|
-
return 300;
|
|
177
|
-
case "sm":
|
|
178
|
-
return 500;
|
|
179
|
-
case "md":
|
|
180
|
-
return 700;
|
|
181
|
-
case "lg":
|
|
182
|
-
return 900;
|
|
183
|
-
case "xl":
|
|
184
|
-
return 1100;
|
|
185
|
-
case false:
|
|
186
|
-
return "auto";
|
|
187
|
-
default:
|
|
188
|
-
return 500;
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
if (mode === "confirm") {
|
|
192
|
-
const config = severityConfig[severity];
|
|
193
|
-
const message = confirmMessage != null ? confirmMessage : children;
|
|
194
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
195
|
-
material.Modal,
|
|
196
|
-
{
|
|
197
|
-
open: isOpen,
|
|
198
|
-
onClose: handleCloseInternal,
|
|
199
|
-
"aria-labelledby": "modal-title",
|
|
200
|
-
closeAfterTransition: true,
|
|
201
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(material.Paper, { sx: __spreadProps(__spreadValues({}, modalStyle), { width: getWidth() }), children: [
|
|
202
|
-
/* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { spacing: 2.5, sx: { p: 3, alignItems: "center", textAlign: "center" }, children: [
|
|
203
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
204
|
-
material.Box,
|
|
205
|
-
{
|
|
206
|
-
sx: {
|
|
207
|
-
width: 72,
|
|
208
|
-
height: 72,
|
|
209
|
-
borderRadius: "50%",
|
|
210
|
-
backgroundColor: (t) => t.palette[severity === "info" ? "primary" : severity].light,
|
|
211
|
-
color: (t) => t.palette[severity === "info" ? "primary" : severity].dark,
|
|
212
|
-
display: "flex",
|
|
213
|
-
alignItems: "center",
|
|
214
|
-
justifyContent: "center",
|
|
215
|
-
opacity: 0.9
|
|
216
|
-
},
|
|
217
|
-
children: config.icon
|
|
218
|
-
}
|
|
219
|
-
),
|
|
220
|
-
title && /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "h6", component: "h2", sx: { fontWeight: 700 }, children: title }),
|
|
221
|
-
message && /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "body2", color: "text.secondary", children: message })
|
|
222
|
-
] }),
|
|
223
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
224
|
-
ModalFooter,
|
|
225
|
-
{
|
|
226
|
-
showCloseButton,
|
|
227
|
-
closeButtonText,
|
|
228
|
-
closeButtonDisabled: closeButtonDisabled || confirmLoading,
|
|
229
|
-
onClose: handleCloseInternal,
|
|
230
|
-
actions: [
|
|
231
|
-
{
|
|
232
|
-
text: confirmText,
|
|
233
|
-
onClick: handleConfirm,
|
|
234
|
-
disabled: confirmDisabled || confirmLoading,
|
|
235
|
-
variant: "contained",
|
|
236
|
-
color: config.color
|
|
237
|
-
}
|
|
238
|
-
]
|
|
239
|
-
}
|
|
240
|
-
)
|
|
241
|
-
] })
|
|
242
|
-
}
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
const renderChildren = () => {
|
|
246
|
-
let header = null;
|
|
247
|
-
let body = null;
|
|
248
|
-
let footer = null;
|
|
249
|
-
React.Children.forEach(children, (child) => {
|
|
250
|
-
if (React.isValidElement(child)) {
|
|
251
|
-
if (child.type === ModalHeader) {
|
|
252
|
-
header = child;
|
|
253
|
-
} else if (child.type === ModalBody) {
|
|
254
|
-
body = child;
|
|
255
|
-
} else if (child.type === ModalFooter) {
|
|
256
|
-
const footerChild = child;
|
|
257
|
-
const _a = footerChild.props, {
|
|
258
|
-
showCloseButton: childShowCloseButton,
|
|
259
|
-
closeButtonText: childCloseButtonText,
|
|
260
|
-
closeButtonDisabled: childCloseButtonDisabled,
|
|
261
|
-
onClose: childOnClose,
|
|
262
|
-
actions: childActions
|
|
263
|
-
} = _a, restOfFooterProps = __objRest(_a, [
|
|
264
|
-
"showCloseButton",
|
|
265
|
-
"closeButtonText",
|
|
266
|
-
"closeButtonDisabled",
|
|
267
|
-
"onClose",
|
|
268
|
-
"actions"
|
|
269
|
-
]);
|
|
270
|
-
footer = React.cloneElement(footerChild, __spreadValues({
|
|
271
|
-
showCloseButton,
|
|
272
|
-
closeButtonText,
|
|
273
|
-
closeButtonDisabled,
|
|
274
|
-
onClose: handleCloseInternal,
|
|
275
|
-
actions
|
|
276
|
-
}, restOfFooterProps));
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
if (!footer && !hiddenFooter) {
|
|
281
|
-
footer = /* @__PURE__ */ jsxRuntime.jsx(
|
|
282
|
-
ModalFooter,
|
|
283
|
-
{
|
|
284
|
-
showCloseButton,
|
|
285
|
-
closeButtonText,
|
|
286
|
-
closeButtonDisabled,
|
|
287
|
-
onClose: handleCloseInternal,
|
|
288
|
-
actions
|
|
289
|
-
}
|
|
290
|
-
);
|
|
291
|
-
}
|
|
292
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
293
|
-
header || title && /* @__PURE__ */ jsxRuntime.jsx(ModalHeader, { children: title }),
|
|
294
|
-
body,
|
|
295
|
-
footer
|
|
296
|
-
] });
|
|
297
|
-
};
|
|
298
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
299
|
-
material.Modal,
|
|
300
|
-
{
|
|
301
|
-
open: isOpen,
|
|
302
|
-
onClose: handleCloseInternal,
|
|
303
|
-
"aria-labelledby": "modal-title",
|
|
304
|
-
"aria-describedby": "modal-description",
|
|
305
|
-
closeAfterTransition: true,
|
|
306
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(material.Paper, { sx: __spreadProps(__spreadValues({}, modalStyle), { width: getWidth() }), children: renderChildren() })
|
|
307
|
-
}
|
|
308
|
-
);
|
|
309
|
-
}
|
|
310
|
-
);
|
|
311
|
-
const ModalWithStatics = Modal;
|
|
312
|
-
ModalWithStatics.Header = ModalHeader;
|
|
313
|
-
ModalWithStatics.Body = ModalBody;
|
|
314
|
-
ModalWithStatics.Footer = ModalFooter;
|
|
315
|
-
exports.Modal = ModalWithStatics;
|
|
316
|
-
exports.ModalBody = ModalBody;
|
|
317
|
-
exports.ModalFooter = ModalFooter;
|
|
318
|
-
exports.ModalHeader = ModalHeader;
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const Modal = require("../../Modal-Bm_HH9cv.cjs");
|
|
4
|
+
exports.Modal = Modal.Modal;
|
|
5
|
+
exports.ModalBody = Modal.ModalBody;
|
|
6
|
+
exports.ModalFooter = Modal.ModalFooter;
|
|
7
|
+
exports.ModalHeader = Modal.ModalHeader;
|
|
8
|
+
exports.default = Modal.ModalWithStatics;
|
|
319
9
|
//# sourceMappingURL=Modal.cjs.map
|
|
@@ -1 +1 @@
|
|
|
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, 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 * 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<ButtonProps> & { form?: string };\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 const { buttonProps } = action;\n return (\n <Button\n key={index}\n onClick={action.onClick}\n disabled={action.disabled}\n variant={action.variant || 'contained'}\n color={action.color || 'primary'}\n {...(buttonProps as any)}\n >\n {action.text}\n </Button>\n );\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, {\n useState,\n useImperativeHandle,\n forwardRef,\n type ReactNode,\n} from 'react';\nimport {\n Modal as MuiModal,\n Paper,\n useTheme,\n useMediaQuery,\n Box,\n Stack,\n Typography,\n} from '@mui/material';\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 { 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\nexport type ModalMode = 'default' | 'confirm';\nexport type ModalSeverity = 'info' | 'warning' | 'error' | 'success';\n\ninterface 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 hiddenFooter?: boolean;\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 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; bg: string }\n> = {\n info: {\n color: 'primary',\n icon: <InfoOutlinedIcon sx={{ fontSize: 48 }} />,\n bg: 'primary.light',\n },\n warning: {\n color: 'warning',\n icon: <WarningAmberIcon sx={{ fontSize: 48 }} />,\n bg: 'warning.light',\n },\n error: {\n color: 'error',\n icon: <ErrorOutlineIcon sx={{ fontSize: 48 }} />,\n bg: 'error.light',\n },\n success: {\n color: 'success',\n icon: <CheckCircleOutlineIcon sx={{ fontSize: 48 }} />,\n bg: 'success.light',\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 hiddenFooter = false,\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 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 try {\n const result = onConfirm();\n if (result instanceof Promise) {\n setConfirmLoading(true);\n await result;\n }\n } finally {\n setConfirmLoading(false);\n handleCloseInternal();\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 return 500;\n }\n };\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=\"modal-title\"\n closeAfterTransition\n >\n <Paper sx={{ ...modalStyle, width: getWidth() }}>\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) =>\n t.palette[severity === 'info' ? 'primary' : severity].light,\n color: (t) =>\n t.palette[severity === 'info' ? 'primary' : severity].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 variant=\"h6\" component=\"h2\" sx={{ fontWeight: 700 }}>\n {title}\n </Typography>\n )}\n {message && (\n <Typography 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 (legacy) ────────────────────────────────────\n const renderChildren = () => {\n let header: ReactNode | null = null;\n let body: ReactNode | null = null;\n let footer: 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,\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}\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}\n onClose={handleCloseInternal}\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\n// Define los sub-componentes como propiedades estáticas con tipos explícitos\ntype ModalComponent = React.ForwardRefExoticComponent<\n ModalProps & React.RefAttributes<ModalRef>\n> & {\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","useImperativeHandle","useTheme","useMediaQuery","MuiModal","Paper","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BO,MAAM,cAA0C,CAAC;AAAA;AAAA,EACtD;AAAA,EACA,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,sBAAsB;AAAA,EACtB;AAAA,EACA,UAAU,CAAA;AACZ,MAAM;AACJ,SACEA,2BAAAA,KAACC,SAAAA,KAAA,EAAI,IAAI,EAAE,SAAS,GAAG,WAAW,qBAAqB,SAAS,QAAQ,gBAAgB,YAAY,KAAK,KACtG,UAAA;AAAA,IAAA;AAAA,IACDD,2BAAAA,KAACE,SAAAA,OAAA,EAAM,WAAU,OAAM,SAAS,GAC7B,UAAA;AAAA,MAAA,mBACCC,2BAAAA;AAAAA,QAACC,SAAAA;AAAAA,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,UAAU;AAC9B,cAAM,EAAE,gBAAgB;AACxB,eACED,2BAAAA;AAAAA,UAACC,SAAAA;AAAAA,UAAA;AAAA,YAEC,SAAS,OAAO;AAAA,YAChB,UAAU,OAAO;AAAA,YACjB,SAAS,OAAO,WAAW;AAAA,YAC3B,OAAO,OAAO,SAAS;AAAA,aAClB,cANN;AAAA,YAQE,UAAA,OAAO;AAAA,UAAA;AAAA,UAPH;AAAA,QAAA;AAAA,MAUX,CAAC;AAAA,IAAA,EAAA,CACH;AAAA,EAAA,GACF;AAEJ;AC7DO,MAAM,cAA0C,CAAC,EAAE,eAAe;AACvE,SACED,+BAACF,SAAAA,OAAI,IAAI,EAAE,SAAS,GAAG,cAAc,qBAAqB,SAAS,QAAQ,YAAY,UAAU,gBAAgB,gBAAA,GAC/G,UAAA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