componentes-sinco 1.0.36-rc.2 → 1.0.36
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/dist/index.cjs +336 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -3
- package/dist/index.d.ts +32 -3
- package/dist/index.js +332 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -82,6 +82,7 @@ __export(index_exports, {
|
|
|
82
82
|
ADCSincoTheme: () => ADCSincoTheme,
|
|
83
83
|
AdproSincoTheme: () => AdproSincoTheme,
|
|
84
84
|
Attachment: () => Attachment,
|
|
85
|
+
AttachmentMobile: () => AttachmentMobile,
|
|
85
86
|
BasicMenu: () => BasicMenu,
|
|
86
87
|
CALENDAR_CONSTANTS: () => CALENDAR_CONSTANTS,
|
|
87
88
|
Calendar: () => Calendar,
|
|
@@ -4908,12 +4909,338 @@ var SCActivityCalendar = ({
|
|
|
4908
4909
|
))));
|
|
4909
4910
|
};
|
|
4910
4911
|
|
|
4912
|
+
// src/Components/Adjuntar/mobile/AdjuntarMobile.tsx
|
|
4913
|
+
var import_react52 = __toESM(require("react"), 1);
|
|
4914
|
+
|
|
4915
|
+
// src/Components/Adjuntar/mobile/components/button.tsx
|
|
4916
|
+
var import_react51 = __toESM(require("react"), 1);
|
|
4917
|
+
var import_material35 = require("@mui/material");
|
|
4918
|
+
|
|
4919
|
+
// src/Components/Adjuntar/mobile/components/Utils.tsx
|
|
4920
|
+
var MuiIcons4 = __toESM(require("@mui/icons-material"), 1);
|
|
4921
|
+
var import_icons_material12 = require("@mui/icons-material");
|
|
4922
|
+
var getAttachmentIcon = (iconName) => {
|
|
4923
|
+
return iconName && MuiIcons4[iconName] ? MuiIcons4[iconName] : import_icons_material12.AttachFileOutlined;
|
|
4924
|
+
};
|
|
4925
|
+
var getAttachmentColor = (state) => {
|
|
4926
|
+
const colors = {
|
|
4927
|
+
primary: "primary.50",
|
|
4928
|
+
success: "success.50",
|
|
4929
|
+
warning: "warning.50"
|
|
4930
|
+
};
|
|
4931
|
+
return colors[state];
|
|
4932
|
+
};
|
|
4933
|
+
|
|
4934
|
+
// src/Components/Adjuntar/mobile/components/button.tsx
|
|
4935
|
+
var AttachmentButton = ({ buttonAttachment, open, setOpen }) => {
|
|
4936
|
+
var _a, _b, _c, _d;
|
|
4937
|
+
const handleToggle = () => {
|
|
4938
|
+
if (setOpen) {
|
|
4939
|
+
setOpen(!open);
|
|
4940
|
+
}
|
|
4941
|
+
};
|
|
4942
|
+
const Icon = (0, import_react51.useMemo)(
|
|
4943
|
+
() => getAttachmentIcon(buttonAttachment == null ? void 0 : buttonAttachment.icon),
|
|
4944
|
+
[buttonAttachment == null ? void 0 : buttonAttachment.icon]
|
|
4945
|
+
);
|
|
4946
|
+
if (!buttonAttachment) return null;
|
|
4947
|
+
return /* @__PURE__ */ import_react51.default.createElement(import_react51.default.Fragment, null, buttonAttachment && /* @__PURE__ */ import_react51.default.createElement(
|
|
4948
|
+
import_material35.Button,
|
|
4949
|
+
{
|
|
4950
|
+
"data-testid": "test-buttonModal",
|
|
4951
|
+
color: (_a = buttonAttachment == null ? void 0 : buttonAttachment.color) != null ? _a : "primary",
|
|
4952
|
+
onClick: handleToggle,
|
|
4953
|
+
variant: (_b = buttonAttachment == null ? void 0 : buttonAttachment.variant) != null ? _b : "text",
|
|
4954
|
+
size: (_c = buttonAttachment == null ? void 0 : buttonAttachment.size) != null ? _c : "small",
|
|
4955
|
+
startIcon: (buttonAttachment == null ? void 0 : buttonAttachment.iconPosition) === "left" && /* @__PURE__ */ import_react51.default.createElement(Icon, null),
|
|
4956
|
+
endIcon: (buttonAttachment == null ? void 0 : buttonAttachment.iconPosition) === "right" && /* @__PURE__ */ import_react51.default.createElement(Icon, null)
|
|
4957
|
+
},
|
|
4958
|
+
capitalize((_d = buttonAttachment == null ? void 0 : buttonAttachment.text) != null ? _d : "Adjuntar")
|
|
4959
|
+
));
|
|
4960
|
+
};
|
|
4961
|
+
|
|
4962
|
+
// src/Components/Adjuntar/mobile/AdjuntarMobile.tsx
|
|
4963
|
+
var import_material36 = require("@mui/material");
|
|
4964
|
+
var import_CssBaseline = __toESM(require("@mui/material/CssBaseline"), 1);
|
|
4965
|
+
var import_system = require("@mui/system");
|
|
4966
|
+
var import_icons_material13 = require("@mui/icons-material");
|
|
4967
|
+
var AttachmentMobile = ({
|
|
4968
|
+
buttonAttachment,
|
|
4969
|
+
maxSize = 400,
|
|
4970
|
+
fileAccepted = "",
|
|
4971
|
+
initialFiles,
|
|
4972
|
+
deleteAction,
|
|
4973
|
+
children,
|
|
4974
|
+
onChange,
|
|
4975
|
+
sx
|
|
4976
|
+
}) => {
|
|
4977
|
+
const [files, setFiles] = (0, import_react52.useState)([]);
|
|
4978
|
+
const [toast, setToast] = (0, import_react52.useState)(null);
|
|
4979
|
+
const [open, setOpen] = import_react52.default.useState(false);
|
|
4980
|
+
const toggleAttachment = (newOpen) => () => {
|
|
4981
|
+
setOpen(newOpen);
|
|
4982
|
+
};
|
|
4983
|
+
const inputRef = (0, import_react52.useRef)(null);
|
|
4984
|
+
const handleUpload = (event2) => {
|
|
4985
|
+
const newFiles = event2.target.files;
|
|
4986
|
+
if (!newFiles) return;
|
|
4987
|
+
const nuevosArchivos = [];
|
|
4988
|
+
const archivosValidos = [];
|
|
4989
|
+
Array.from(newFiles).forEach((file) => {
|
|
4990
|
+
const isDuplicateFile = files.some(
|
|
4991
|
+
(existingFile) => existingFile.name === file.name && existingFile.size === file.size
|
|
4992
|
+
);
|
|
4993
|
+
const sizeMB = file.size / (1024 * 1024);
|
|
4994
|
+
if (isDuplicateFile) {
|
|
4995
|
+
setToast({
|
|
4996
|
+
type: "error",
|
|
4997
|
+
title: "Archivo duplicado",
|
|
4998
|
+
listITems: [`El archivo "${file.name}" ya existe.`],
|
|
4999
|
+
seeMore: true,
|
|
5000
|
+
time: 5
|
|
5001
|
+
});
|
|
5002
|
+
return;
|
|
5003
|
+
}
|
|
5004
|
+
if (sizeMB > maxSize) {
|
|
5005
|
+
nuevosArchivos.push({
|
|
5006
|
+
name: file.name,
|
|
5007
|
+
size: file.size,
|
|
5008
|
+
type: file.type,
|
|
5009
|
+
progress: 0,
|
|
5010
|
+
uploadError: true
|
|
5011
|
+
});
|
|
5012
|
+
setToast({
|
|
5013
|
+
type: "error",
|
|
5014
|
+
title: "Carga fallida",
|
|
5015
|
+
seeMore: true,
|
|
5016
|
+
listITems: [`El archivo "${file.name}" supera el l\xEDmite de ${maxSize}MB.`],
|
|
5017
|
+
time: 5
|
|
5018
|
+
});
|
|
5019
|
+
return;
|
|
5020
|
+
}
|
|
5021
|
+
if (fileAccepted && !file.name.match(
|
|
5022
|
+
new RegExp(
|
|
5023
|
+
`(${fileAccepted.replace(/\./g, "\\.").replace(/,/g, "|")})$`,
|
|
5024
|
+
"i"
|
|
5025
|
+
)
|
|
5026
|
+
)) {
|
|
5027
|
+
setToast({
|
|
5028
|
+
type: "error",
|
|
5029
|
+
title: "Tipo de archivo no permitido",
|
|
5030
|
+
listITems: [`El archivo "${file.name}" no es un tipo permitido.`],
|
|
5031
|
+
seeMore: true,
|
|
5032
|
+
time: 5
|
|
5033
|
+
});
|
|
5034
|
+
return;
|
|
5035
|
+
}
|
|
5036
|
+
nuevosArchivos.push({
|
|
5037
|
+
name: file.name,
|
|
5038
|
+
size: file.size,
|
|
5039
|
+
type: file.type,
|
|
5040
|
+
progress: 0,
|
|
5041
|
+
uploadError: false
|
|
5042
|
+
});
|
|
5043
|
+
archivosValidos.push(file);
|
|
5044
|
+
});
|
|
5045
|
+
if (nuevosArchivos.length > 0) {
|
|
5046
|
+
setFiles((prevFiles) => {
|
|
5047
|
+
const updatedFiles = [...prevFiles, ...nuevosArchivos];
|
|
5048
|
+
if (archivosValidos.length > 0) {
|
|
5049
|
+
onChange == null ? void 0 : onChange([
|
|
5050
|
+
...archivosValidos,
|
|
5051
|
+
...prevFiles.map((f) => new File([], f.name, { type: f.type }))
|
|
5052
|
+
]);
|
|
5053
|
+
}
|
|
5054
|
+
return updatedFiles;
|
|
5055
|
+
});
|
|
5056
|
+
}
|
|
5057
|
+
setOpen(false);
|
|
5058
|
+
event2.target.value = "";
|
|
5059
|
+
};
|
|
5060
|
+
const handleDeleteFile = (fileToRemove) => __async(null, null, function* () {
|
|
5061
|
+
try {
|
|
5062
|
+
if (deleteAction) {
|
|
5063
|
+
yield deleteAction(fileToRemove.name);
|
|
5064
|
+
}
|
|
5065
|
+
const updatedFiles = files.filter(
|
|
5066
|
+
(file) => !(file.name === fileToRemove.name && file.size === fileToRemove.size)
|
|
5067
|
+
);
|
|
5068
|
+
setFiles(updatedFiles);
|
|
5069
|
+
if (onChange) {
|
|
5070
|
+
const remainingValidFiles = updatedFiles.filter((f) => !f.uploadError).map((f) => new File([], f.name, { type: f.type }));
|
|
5071
|
+
onChange(remainingValidFiles);
|
|
5072
|
+
}
|
|
5073
|
+
setToast({
|
|
5074
|
+
type: "success",
|
|
5075
|
+
title: "Archivo eliminado",
|
|
5076
|
+
listITems: [`El archivo "${fileToRemove.name}" ha sido eliminado exitosamente.`],
|
|
5077
|
+
seeMore: true,
|
|
5078
|
+
time: 3
|
|
5079
|
+
});
|
|
5080
|
+
} catch (error) {
|
|
5081
|
+
setToast({
|
|
5082
|
+
type: "error",
|
|
5083
|
+
title: "Error al eliminar",
|
|
5084
|
+
listITems: [`No se pudo eliminar el archivo "${fileToRemove.name}".`],
|
|
5085
|
+
seeMore: true,
|
|
5086
|
+
time: 5
|
|
5087
|
+
});
|
|
5088
|
+
}
|
|
5089
|
+
});
|
|
5090
|
+
const AttachtmentActions = [
|
|
5091
|
+
{ icon: /* @__PURE__ */ import_react52.default.createElement(import_icons_material13.FolderOpenOutlined, { type: "file", color: "primary" }), color: "primary", label: "Galer\xEDa", onClick: () => alert("diste click en Galeria") },
|
|
5092
|
+
{ icon: /* @__PURE__ */ import_react52.default.createElement(import_icons_material13.PhotoCameraOutlined, { type: "file", color: "success" }), color: "success", label: "C\xE1mara", onClick: () => alert("diste click en Camara") },
|
|
5093
|
+
{ icon: /* @__PURE__ */ import_react52.default.createElement(import_icons_material13.FolderOpenOutlined, { type: "file", color: "warning" }), color: "warning", label: "Archivos", onClick: () => {
|
|
5094
|
+
var _a;
|
|
5095
|
+
return (_a = inputRef.current) == null ? void 0 : _a.click();
|
|
5096
|
+
} }
|
|
5097
|
+
];
|
|
5098
|
+
(0, import_react52.useEffect)(() => {
|
|
5099
|
+
if (initialFiles && initialFiles.length > 0) {
|
|
5100
|
+
setFiles(initialFiles);
|
|
5101
|
+
}
|
|
5102
|
+
}, []);
|
|
5103
|
+
return /* @__PURE__ */ import_react52.default.createElement(import_system.Box, { display: "flex", flexDirection: "column", gap: 1 }, /* @__PURE__ */ import_react52.default.createElement(import_system.Box, { display: "flex", width: "100%", justifyContent: "space-between", alignItems: "center", sx }, children, /* @__PURE__ */ import_react52.default.createElement(
|
|
5104
|
+
AttachmentButton,
|
|
5105
|
+
{
|
|
5106
|
+
buttonAttachment,
|
|
5107
|
+
open,
|
|
5108
|
+
setOpen
|
|
5109
|
+
}
|
|
5110
|
+
)), /* @__PURE__ */ import_react52.default.createElement(import_CssBaseline.default, null), /* @__PURE__ */ import_react52.default.createElement(
|
|
5111
|
+
import_material36.SwipeableDrawer,
|
|
5112
|
+
{
|
|
5113
|
+
ModalProps: {
|
|
5114
|
+
sx: {
|
|
5115
|
+
"& .MuiPaper-root": {
|
|
5116
|
+
borderRadius: "16px 16px 0 0"
|
|
5117
|
+
}
|
|
5118
|
+
}
|
|
5119
|
+
},
|
|
5120
|
+
anchor: "bottom",
|
|
5121
|
+
swipeAreaWidth: 56,
|
|
5122
|
+
open,
|
|
5123
|
+
onClose: toggleAttachment(false),
|
|
5124
|
+
onOpen: toggleAttachment(true)
|
|
5125
|
+
},
|
|
5126
|
+
toast && /* @__PURE__ */ import_react52.default.createElement(SCToastNotification, __spreadValues({}, toast)),
|
|
5127
|
+
/* @__PURE__ */ import_react52.default.createElement(import_system.Box, { display: "flex", flexDirection: "column", alignItems: "center", p: 2, gap: 2 }, /* @__PURE__ */ import_react52.default.createElement(import_system.Box, { display: "flex", width: "100%", justifyContent: "space-between", alignItems: "center", gap: 1, p: 1 }, /* @__PURE__ */ import_react52.default.createElement(import_material36.Typography, { variant: "h6", color: "text.primary" }, "Agregar adjuntos"), /* @__PURE__ */ import_react52.default.createElement(import_material36.IconButton, { size: "medium", onClick: toggleAttachment(false) }, /* @__PURE__ */ import_react52.default.createElement(import_icons_material13.CloseOutlined, { color: "action" }))), /* @__PURE__ */ import_react52.default.createElement(
|
|
5128
|
+
"input",
|
|
5129
|
+
{
|
|
5130
|
+
type: "file",
|
|
5131
|
+
multiple: true,
|
|
5132
|
+
hidden: true,
|
|
5133
|
+
ref: inputRef,
|
|
5134
|
+
onChange: handleUpload
|
|
5135
|
+
}
|
|
5136
|
+
), /* @__PURE__ */ import_react52.default.createElement(import_system.Box, { display: "flex", justifyContent: "space-around", alignItems: "center", width: "100%", gap: 2 }, AttachtmentActions.map((option, index) => /* @__PURE__ */ import_react52.default.createElement(
|
|
5137
|
+
import_system.Box,
|
|
5138
|
+
{
|
|
5139
|
+
display: "flex",
|
|
5140
|
+
flexDirection: "column",
|
|
5141
|
+
alignItems: "center",
|
|
5142
|
+
width: 100,
|
|
5143
|
+
height: 80,
|
|
5144
|
+
borderRadius: 1,
|
|
5145
|
+
bgcolor: "grey.100",
|
|
5146
|
+
border: "1px solid",
|
|
5147
|
+
borderColor: "grey.50",
|
|
5148
|
+
boxShadow: 1,
|
|
5149
|
+
justifyContent: "center",
|
|
5150
|
+
p: 1,
|
|
5151
|
+
gap: 1,
|
|
5152
|
+
onClick: option.onClick,
|
|
5153
|
+
sx: {
|
|
5154
|
+
cursor: "pointer"
|
|
5155
|
+
}
|
|
5156
|
+
},
|
|
5157
|
+
/* @__PURE__ */ import_react52.default.createElement(
|
|
5158
|
+
import_material36.IconButton,
|
|
5159
|
+
{
|
|
5160
|
+
sx: {
|
|
5161
|
+
bgcolor: getAttachmentColor(option.color)
|
|
5162
|
+
},
|
|
5163
|
+
size: "large"
|
|
5164
|
+
},
|
|
5165
|
+
option.icon
|
|
5166
|
+
),
|
|
5167
|
+
/* @__PURE__ */ import_react52.default.createElement(import_material36.Typography, { variant: "body2", color: "text.primary" }, option.label)
|
|
5168
|
+
))))
|
|
5169
|
+
), files.length > 0 && /* @__PURE__ */ import_react52.default.createElement(
|
|
5170
|
+
import_material36.Stack,
|
|
5171
|
+
{
|
|
5172
|
+
"data-testid": "ContenedorArchivosAdjuntos",
|
|
5173
|
+
id: "ContenedorArchivosAdjuntos",
|
|
5174
|
+
width: "100%",
|
|
5175
|
+
sx: __spreadValues({
|
|
5176
|
+
overflowY: "auto"
|
|
5177
|
+
}, files.length > 5 && {
|
|
5178
|
+
maxHeight: 250
|
|
5179
|
+
}),
|
|
5180
|
+
spacing: 1
|
|
5181
|
+
},
|
|
5182
|
+
files.map((file) => /* @__PURE__ */ import_react52.default.createElement(
|
|
5183
|
+
import_material36.Stack,
|
|
5184
|
+
{
|
|
5185
|
+
height: 46,
|
|
5186
|
+
key: file.name + (file.uploadError ? "_error" : ""),
|
|
5187
|
+
direction: "row",
|
|
5188
|
+
alignItems: "center",
|
|
5189
|
+
justifyContent: "space-between",
|
|
5190
|
+
gap: 2,
|
|
5191
|
+
padding: 1,
|
|
5192
|
+
borderRadius: 1,
|
|
5193
|
+
sx: {
|
|
5194
|
+
backgroundColor: file.uploadError ? "error.50" : "transparent",
|
|
5195
|
+
":hover": {
|
|
5196
|
+
backgroundColor: file.uploadError ? "error.100" : "primary.50"
|
|
5197
|
+
}
|
|
5198
|
+
}
|
|
5199
|
+
},
|
|
5200
|
+
/* @__PURE__ */ import_react52.default.createElement(import_material36.Stack, { direction: "row", alignItems: "center", gap: 1, width: "100%" }, /* @__PURE__ */ import_react52.default.createElement(
|
|
5201
|
+
import_icons_material13.UploadFileOutlined,
|
|
5202
|
+
{
|
|
5203
|
+
color: file.uploadError ? "error" : "primary",
|
|
5204
|
+
fontSize: "small"
|
|
5205
|
+
}
|
|
5206
|
+
), /* @__PURE__ */ import_react52.default.createElement(import_material36.Stack, { width: "100%" }, /* @__PURE__ */ import_react52.default.createElement(
|
|
5207
|
+
import_material36.Typography,
|
|
5208
|
+
{
|
|
5209
|
+
variant: "body2",
|
|
5210
|
+
color: "text.primary",
|
|
5211
|
+
whiteSpace: "nowrap",
|
|
5212
|
+
overflow: "hidden",
|
|
5213
|
+
textOverflow: "ellipsis",
|
|
5214
|
+
maxWidth: "310px"
|
|
5215
|
+
},
|
|
5216
|
+
file.name
|
|
5217
|
+
), /* @__PURE__ */ import_react52.default.createElement(
|
|
5218
|
+
import_material36.Typography,
|
|
5219
|
+
{
|
|
5220
|
+
variant: "caption",
|
|
5221
|
+
color: file.uploadError ? "error" : "text.secondary"
|
|
5222
|
+
},
|
|
5223
|
+
file.uploadError && file.size / (1024 * 1024) > maxSize ? "Archivo super\xF3 el l\xEDmite \u2022 Carga fallida" : file.uploadError ? "Archivo duplicado o inv\xE1lido \u2022 Carga fallida" : `${(file.size / (1024 * 1024)).toFixed(2)}MB \u2022 ${file.type}`
|
|
5224
|
+
))),
|
|
5225
|
+
/* @__PURE__ */ import_react52.default.createElement(import_material36.Tooltip, { title: "Eliminar" }, /* @__PURE__ */ import_react52.default.createElement(
|
|
5226
|
+
import_material36.IconButton,
|
|
5227
|
+
{
|
|
5228
|
+
size: "small",
|
|
5229
|
+
onClick: () => handleDeleteFile(file),
|
|
5230
|
+
"aria-label": `Eliminar ${file.name}`
|
|
5231
|
+
},
|
|
5232
|
+
/* @__PURE__ */ import_react52.default.createElement(import_icons_material13.DeleteOutline, { fontSize: "small", color: "action" })
|
|
5233
|
+
))
|
|
5234
|
+
))
|
|
5235
|
+
));
|
|
5236
|
+
};
|
|
5237
|
+
|
|
4911
5238
|
// src/Theme/index.ts
|
|
4912
5239
|
var import_styles3 = require("@mui/material/styles");
|
|
4913
5240
|
|
|
4914
5241
|
// src/Theme/components.ts
|
|
4915
|
-
var
|
|
4916
|
-
var
|
|
5242
|
+
var import_react53 = __toESM(require("react"), 1);
|
|
5243
|
+
var import_icons_material14 = require("@mui/icons-material");
|
|
4917
5244
|
var components = {
|
|
4918
5245
|
MuiSelect: {
|
|
4919
5246
|
styleOverrides: {
|
|
@@ -5610,10 +5937,10 @@ var components = {
|
|
|
5610
5937
|
MuiAlert: {
|
|
5611
5938
|
defaultProps: {
|
|
5612
5939
|
iconMapping: {
|
|
5613
|
-
success:
|
|
5614
|
-
error:
|
|
5615
|
-
warning:
|
|
5616
|
-
info:
|
|
5940
|
+
success: import_react53.default.createElement(import_icons_material14.CheckCircleRounded),
|
|
5941
|
+
error: import_react53.default.createElement(import_icons_material14.ErrorRounded),
|
|
5942
|
+
warning: import_react53.default.createElement(import_icons_material14.WarningRounded),
|
|
5943
|
+
info: import_react53.default.createElement(import_icons_material14.InfoRounded)
|
|
5617
5944
|
}
|
|
5618
5945
|
},
|
|
5619
5946
|
variants: [
|
|
@@ -6451,8 +6778,8 @@ var paletteADC = __spreadValues({
|
|
|
6451
6778
|
}, BasicPalette);
|
|
6452
6779
|
|
|
6453
6780
|
// src/Theme/breakpoints.ts
|
|
6454
|
-
var
|
|
6455
|
-
var breakpoints = (0,
|
|
6781
|
+
var import_system2 = require("@mui/system");
|
|
6782
|
+
var breakpoints = (0, import_system2.createBreakpoints)({
|
|
6456
6783
|
values: {
|
|
6457
6784
|
xs: 0,
|
|
6458
6785
|
sm: 600,
|
|
@@ -6656,6 +6983,7 @@ var ADCSincoTheme = (0, import_styles3.createTheme)(__spreadValues({}, ADCTheme)
|
|
|
6656
6983
|
ADCSincoTheme,
|
|
6657
6984
|
AdproSincoTheme,
|
|
6658
6985
|
Attachment,
|
|
6986
|
+
AttachmentMobile,
|
|
6659
6987
|
BasicMenu,
|
|
6660
6988
|
CALENDAR_CONSTANTS,
|
|
6661
6989
|
Calendar,
|