@beweco/aurora-ui 0.0.9 → 0.0.10
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/assets/css/styles.css +1 -1
- package/dist/index.cjs.js +500 -2
- package/dist/index.esm.js +502 -5
- package/dist/types/components/UploadFile/UploadFile.d.ts +20 -0
- package/dist/types/components/UploadFile/UploadFile.d.ts.map +1 -0
- package/dist/types/components/UploadFile/UploadFile.types.d.ts +104 -0
- package/dist/types/components/UploadFile/UploadFile.types.d.ts.map +1 -0
- package/dist/types/components/UploadFile/index.d.ts +3 -0
- package/dist/types/components/UploadFile/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { Button, cn, ListboxItem, Popover, PopoverTrigger, Tooltip, PopoverContent, Listbox, Accordion, AccordionItem, ListboxSection, Spacer, Avatar, Card, CardBody, CardFooter, Input } from '@heroui/react';
|
|
3
|
-
import React, { useEffect, useState, createElement, useCallback, useRef, createContext, useContext } from 'react';
|
|
2
|
+
import { Button, cn, ListboxItem, Popover, PopoverTrigger, Tooltip, PopoverContent, Listbox, Accordion, AccordionItem, ListboxSection, Spacer, Avatar, Card, CardBody, CardFooter, Input, Modal, ModalContent, ModalHeader, ModalBody, Slider, ModalFooter } from '@heroui/react';
|
|
3
|
+
import React, { useEffect, useState, createElement, useCallback, useRef, useMemo, createContext, useContext } from 'react';
|
|
4
4
|
import { Icon } from '@iconify/react';
|
|
5
5
|
import { useTheme } from '@heroui/use-theme';
|
|
6
6
|
|
|
@@ -292,7 +292,7 @@ var countries = [
|
|
|
292
292
|
{ code: "+971", name: "UAE", flag: "🇦🇪" },
|
|
293
293
|
];
|
|
294
294
|
var uniqueCountries = Array.from(new Map(countries.map(function (item) { return [item.code + item.name, item]; })).values());
|
|
295
|
-
var defaultTranslations = {
|
|
295
|
+
var defaultTranslations$1 = {
|
|
296
296
|
label: "Teléfono",
|
|
297
297
|
placeholder: "Número de teléfono",
|
|
298
298
|
searchPlaceholder: "Buscar país...",
|
|
@@ -308,7 +308,7 @@ var Phone = function (_a) {
|
|
|
308
308
|
var dropdownRef = useRef(null);
|
|
309
309
|
var _m = useState(uniqueCountries), filteredCountries = _m[0], setFilteredCountries = _m[1];
|
|
310
310
|
// Combinar traducciones por defecto con las proporcionadas
|
|
311
|
-
var t = __assign(__assign({}, defaultTranslations), translations);
|
|
311
|
+
var t = __assign(__assign({}, defaultTranslations$1), translations);
|
|
312
312
|
// Usar la etiqueta de las traducciones si no se proporciona label explícitamente
|
|
313
313
|
var finalLabel = label || t.label;
|
|
314
314
|
// Sincroniza valor externo
|
|
@@ -377,6 +377,503 @@ var Phone = function (_a) {
|
|
|
377
377
|
: ""), onClick: function () { return handleCountrySelect(country); }, children: [jsx("span", { className: "mr-3 text-lg", children: country.flag }), jsx("span", { className: "flex-1 text-left dark:text-gray-100", children: country.name }), jsx("span", { className: "text-xs text-gray-500 dark:text-gray-400", children: country.code })] }, country.code)); })) : (jsx("div", { className: "px-4 py-2 text-sm text-gray-500 dark:text-gray-400", children: t.noCountriesFound })) })] }))] }), jsx(Input, { type: "tel", className: "flex-1 border-none bg-transparent text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 h-10 px-2", placeholder: t.placeholder, value: inputValue, onChange: handleInputChange, onBlur: onBlur, disabled: disabled, name: name, autoComplete: "tel", id: "phone-input-".concat(name) })] }), error && errorText && (jsx("span", { className: "text-xs text-pink-600 dark:text-pink-400 mt-1", children: errorText }))] }));
|
|
378
378
|
};
|
|
379
379
|
|
|
380
|
+
// Traducciones por defecto en español
|
|
381
|
+
var defaultTranslations = {
|
|
382
|
+
uploadText: "Da clic y selecciona tus archivos",
|
|
383
|
+
subText: "",
|
|
384
|
+
dragText: "Suelta el archivo aquí",
|
|
385
|
+
multipleFilesError: "Solo puedes subir un archivo",
|
|
386
|
+
maxFilesError: "Puedes subir máximo {maxFiles} archivos",
|
|
387
|
+
invalidFileTypeError: "Solo se aceptan archivos de tipo: {acceptedTypes}",
|
|
388
|
+
maxFileSizeError: "El archivo excede el tamaño máximo permitido de {maxSize}",
|
|
389
|
+
removeFileAriaLabel: "Remover archivo",
|
|
390
|
+
uploadAreaAriaLabel: "Área de carga de archivos",
|
|
391
|
+
cropModalTitle: "Recortar imagen",
|
|
392
|
+
cropSaveButton: "Guardar",
|
|
393
|
+
cropCancelButton: "Cancelar",
|
|
394
|
+
cropZoomLabel: "Zoom",
|
|
395
|
+
cropInstructions: "Arrastra para mover la imagen y usa el zoom para ajustar el tamaño",
|
|
396
|
+
cropBackgroundLabel: "Color de fondo",
|
|
397
|
+
cropBackgroundWhite: "Blanco",
|
|
398
|
+
cropBackgroundBlack: "Negro",
|
|
399
|
+
cropBackgroundTransparent: "Transparente",
|
|
400
|
+
};
|
|
401
|
+
/**
|
|
402
|
+
* Formatea el tipo de archivo para mostrar
|
|
403
|
+
*/
|
|
404
|
+
var formatFileType = function (type) {
|
|
405
|
+
var _a;
|
|
406
|
+
if (type.startsWith(".")) {
|
|
407
|
+
return type.toUpperCase();
|
|
408
|
+
}
|
|
409
|
+
if (type.includes("/")) {
|
|
410
|
+
var parts = type.split("/");
|
|
411
|
+
return ((_a = parts[1]) === null || _a === void 0 ? void 0 : _a.toUpperCase()) || type;
|
|
412
|
+
}
|
|
413
|
+
return type.toUpperCase();
|
|
414
|
+
};
|
|
415
|
+
/**
|
|
416
|
+
* Formatea el tamaño del archivo de forma legible
|
|
417
|
+
*/
|
|
418
|
+
var formatFileSize = function (bytes) {
|
|
419
|
+
if (bytes === 0) {
|
|
420
|
+
return "0 Bytes";
|
|
421
|
+
}
|
|
422
|
+
var k = 1024;
|
|
423
|
+
var sizes = ["Bytes", "KB", "MB", "GB"];
|
|
424
|
+
var i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
425
|
+
return "".concat(Math.round(bytes / Math.pow(k, i)), " ").concat(sizes[i]);
|
|
426
|
+
};
|
|
427
|
+
/**
|
|
428
|
+
* Componente de recorte de imagen usando Canvas API
|
|
429
|
+
*/
|
|
430
|
+
var ImageCropModal = function (_a) {
|
|
431
|
+
var isOpen = _a.isOpen, imageUrl = _a.imageUrl, targetWidth = _a.targetWidth, targetHeight = _a.targetHeight, onSave = _a.onSave, onCancel = _a.onCancel, translations = _a.translations;
|
|
432
|
+
var canvasRef = useRef(null);
|
|
433
|
+
var _b = useState(null), imageElement = _b[0], setImageElement = _b[1];
|
|
434
|
+
var _c = useState(0), zoomValue = _c[0], setZoomValue = _c[1]; // Valor del slider de -1 a 1
|
|
435
|
+
var _d = useState({ x: 0, y: 0 }), position = _d[0], setPosition = _d[1];
|
|
436
|
+
var _e = useState(false), isDragging = _e[0], setIsDragging = _e[1];
|
|
437
|
+
var _f = useState({ x: 0, y: 0 }), dragStart = _f[0], setDragStart = _f[1];
|
|
438
|
+
var _g = useState(1), baseScale = _g[0], setBaseScale = _g[1]; // Escala base inicial
|
|
439
|
+
var _h = useState({ width: 400, height: 300 }), canvasSize = _h[0], setCanvasSize = _h[1];
|
|
440
|
+
var _j = useState("white"), backgroundColor = _j[0], setBackgroundColor = _j[1];
|
|
441
|
+
// Función para convertir el valor del zoom slider a escala real
|
|
442
|
+
var getScaleFromZoom = function (zoomValue) {
|
|
443
|
+
if (zoomValue === 0) {
|
|
444
|
+
return baseScale;
|
|
445
|
+
}
|
|
446
|
+
if (zoomValue > 0) {
|
|
447
|
+
// Zoom in: de baseScale a baseScale * 3
|
|
448
|
+
return baseScale + baseScale * 2 * zoomValue;
|
|
449
|
+
}
|
|
450
|
+
// Zoom out: de baseScale * 0.3 a baseScale
|
|
451
|
+
return baseScale + baseScale * 0.7 * zoomValue;
|
|
452
|
+
};
|
|
453
|
+
var currentScale = getScaleFromZoom(zoomValue);
|
|
454
|
+
// Cargar imagen cuando se abre el modal
|
|
455
|
+
useEffect(function () {
|
|
456
|
+
if (isOpen && imageUrl) {
|
|
457
|
+
var img_1 = new Image();
|
|
458
|
+
img_1.onload = function () {
|
|
459
|
+
setImageElement(img_1);
|
|
460
|
+
// Calcular escala inicial para que la imagen quepa en el área de crop
|
|
461
|
+
var scaleX = targetWidth / img_1.width;
|
|
462
|
+
var scaleY = targetHeight / img_1.height;
|
|
463
|
+
var initialScale = Math.max(scaleX, scaleY);
|
|
464
|
+
setBaseScale(initialScale);
|
|
465
|
+
setZoomValue(0); // Empezar en el centro
|
|
466
|
+
setPosition({ x: 0, y: 0 });
|
|
467
|
+
setBackgroundColor("white"); // Reset color de fondo
|
|
468
|
+
};
|
|
469
|
+
img_1.src = imageUrl;
|
|
470
|
+
}
|
|
471
|
+
}, [isOpen, imageUrl, targetWidth, targetHeight]);
|
|
472
|
+
// Dibujar en el canvas
|
|
473
|
+
useEffect(function () {
|
|
474
|
+
if (!(imageElement && canvasRef.current)) {
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
var canvas = canvasRef.current;
|
|
478
|
+
var ctx = canvas.getContext("2d");
|
|
479
|
+
if (!ctx) {
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
// Limpiar canvas
|
|
483
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
484
|
+
// Dibujar fondo gris del canvas
|
|
485
|
+
ctx.fillStyle = "#f3f4f6";
|
|
486
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
487
|
+
// Calcular posición y tamaño de la imagen
|
|
488
|
+
var imgWidth = imageElement.width * currentScale;
|
|
489
|
+
var imgHeight = imageElement.height * currentScale;
|
|
490
|
+
var imgX = (canvas.width - imgWidth) / 2 + position.x;
|
|
491
|
+
var imgY = (canvas.height - imgHeight) / 2 + position.y;
|
|
492
|
+
// Dibujar imagen
|
|
493
|
+
ctx.drawImage(imageElement, imgX, imgY, imgWidth, imgHeight);
|
|
494
|
+
// Dibujar overlay para mostrar área de recorte
|
|
495
|
+
ctx.fillStyle = "rgba(0, 0, 0, 0.5)";
|
|
496
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
497
|
+
// Limpiar área de recorte (centro)
|
|
498
|
+
var cropX = (canvas.width - targetWidth) / 2;
|
|
499
|
+
var cropY = (canvas.height - targetHeight) / 2;
|
|
500
|
+
ctx.clearRect(cropX, cropY, targetWidth, targetHeight);
|
|
501
|
+
// Dibujar color de fondo del área de recorte
|
|
502
|
+
if (backgroundColor !== "transparent") {
|
|
503
|
+
ctx.fillStyle = backgroundColor === "white" ? "#ffffff" : "#000000";
|
|
504
|
+
ctx.fillRect(cropX, cropY, targetWidth, targetHeight);
|
|
505
|
+
}
|
|
506
|
+
// Redibujar imagen solo en el área de recorte
|
|
507
|
+
ctx.save();
|
|
508
|
+
ctx.beginPath();
|
|
509
|
+
ctx.rect(cropX, cropY, targetWidth, targetHeight);
|
|
510
|
+
ctx.clip();
|
|
511
|
+
ctx.drawImage(imageElement, imgX, imgY, imgWidth, imgHeight);
|
|
512
|
+
ctx.restore();
|
|
513
|
+
// Dibujar borde del área de recorte
|
|
514
|
+
ctx.strokeStyle = "#3b82f6";
|
|
515
|
+
ctx.lineWidth = 2;
|
|
516
|
+
ctx.strokeRect(cropX, cropY, targetWidth, targetHeight);
|
|
517
|
+
}, [
|
|
518
|
+
imageElement,
|
|
519
|
+
currentScale,
|
|
520
|
+
position,
|
|
521
|
+
targetWidth,
|
|
522
|
+
targetHeight,
|
|
523
|
+
backgroundColor,
|
|
524
|
+
]);
|
|
525
|
+
var handleMouseDown = function (e) {
|
|
526
|
+
var _a;
|
|
527
|
+
e.preventDefault();
|
|
528
|
+
setIsDragging(true);
|
|
529
|
+
var rect = (_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
530
|
+
if (rect) {
|
|
531
|
+
setDragStart({
|
|
532
|
+
x: e.clientX - rect.left - position.x,
|
|
533
|
+
y: e.clientY - rect.top - position.y,
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
var handleMouseMove = function (e) {
|
|
538
|
+
var _a;
|
|
539
|
+
if (!isDragging) {
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
e.preventDefault();
|
|
543
|
+
var rect = (_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
544
|
+
if (rect) {
|
|
545
|
+
setPosition({
|
|
546
|
+
x: e.clientX - rect.left - dragStart.x,
|
|
547
|
+
y: e.clientY - rect.top - dragStart.y,
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
var handleMouseUp = function () {
|
|
552
|
+
setIsDragging(false);
|
|
553
|
+
};
|
|
554
|
+
// Eventos táctiles para dispositivos móviles
|
|
555
|
+
var handleTouchStart = function (e) {
|
|
556
|
+
var _a;
|
|
557
|
+
e.preventDefault();
|
|
558
|
+
if (e.touches.length === 1) {
|
|
559
|
+
setIsDragging(true);
|
|
560
|
+
var rect = (_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
561
|
+
if (rect) {
|
|
562
|
+
var touch = e.touches[0];
|
|
563
|
+
setDragStart({
|
|
564
|
+
x: touch.clientX - rect.left - position.x,
|
|
565
|
+
y: touch.clientY - rect.top - position.y,
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
var handleTouchMove = function (e) {
|
|
571
|
+
var _a;
|
|
572
|
+
if (!isDragging || e.touches.length !== 1) {
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
e.preventDefault();
|
|
576
|
+
var rect = (_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
577
|
+
if (rect) {
|
|
578
|
+
var touch = e.touches[0];
|
|
579
|
+
setPosition({
|
|
580
|
+
x: touch.clientX - rect.left - dragStart.x,
|
|
581
|
+
y: touch.clientY - rect.top - dragStart.y,
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
};
|
|
585
|
+
var handleTouchEnd = function () {
|
|
586
|
+
setIsDragging(false);
|
|
587
|
+
};
|
|
588
|
+
var handleSave = function () {
|
|
589
|
+
if (!(imageElement && canvasRef.current)) {
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
// Crear canvas temporal para el recorte
|
|
593
|
+
var tempCanvas = document.createElement("canvas");
|
|
594
|
+
tempCanvas.width = targetWidth;
|
|
595
|
+
tempCanvas.height = targetHeight;
|
|
596
|
+
var tempCtx = tempCanvas.getContext("2d");
|
|
597
|
+
if (!tempCtx) {
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
// Dibujar color de fondo si no es transparente
|
|
601
|
+
if (backgroundColor !== "transparent") {
|
|
602
|
+
tempCtx.fillStyle = backgroundColor === "white" ? "#ffffff" : "#000000";
|
|
603
|
+
tempCtx.fillRect(0, 0, targetWidth, targetHeight);
|
|
604
|
+
}
|
|
605
|
+
// Calcular parámetros de recorte
|
|
606
|
+
var canvas = canvasRef.current;
|
|
607
|
+
var imgWidth = imageElement.width * currentScale;
|
|
608
|
+
var imgHeight = imageElement.height * currentScale;
|
|
609
|
+
var imgX = (canvas.width - imgWidth) / 2 + position.x;
|
|
610
|
+
var imgY = (canvas.height - imgHeight) / 2 + position.y;
|
|
611
|
+
var cropX = (canvas.width - targetWidth) / 2;
|
|
612
|
+
var cropY = (canvas.height - targetHeight) / 2;
|
|
613
|
+
// Calcular área fuente en la imagen original
|
|
614
|
+
var sourceX = (cropX - imgX) / currentScale;
|
|
615
|
+
var sourceY = (cropY - imgY) / currentScale;
|
|
616
|
+
var sourceWidth = targetWidth / currentScale;
|
|
617
|
+
var sourceHeight = targetHeight / currentScale;
|
|
618
|
+
// Dibujar recorte sobre el fondo
|
|
619
|
+
tempCtx.drawImage(imageElement, sourceX, sourceY, sourceWidth, sourceHeight, 0, 0, targetWidth, targetHeight);
|
|
620
|
+
// Convertir a blob y crear archivo
|
|
621
|
+
var fileType = backgroundColor === "transparent" ? "image/png" : "image/png";
|
|
622
|
+
tempCanvas.toBlob(function (blob) {
|
|
623
|
+
if (blob) {
|
|
624
|
+
var timestamp = new Date().getTime();
|
|
625
|
+
var file = new File([blob], "cropped-image-".concat(timestamp, ".png"), {
|
|
626
|
+
type: fileType,
|
|
627
|
+
});
|
|
628
|
+
onSave(file, imageElement.src);
|
|
629
|
+
}
|
|
630
|
+
}, fileType);
|
|
631
|
+
};
|
|
632
|
+
// Calcular dimensiones responsive del canvas
|
|
633
|
+
var updateCanvasSize = useCallback(function () {
|
|
634
|
+
var minCanvasWidth = Math.min(350, window.innerWidth - 40);
|
|
635
|
+
var minCanvasHeight = Math.min(250, window.innerHeight - 300);
|
|
636
|
+
var newCanvasWidth = Math.max(minCanvasWidth, targetWidth + 60);
|
|
637
|
+
var newCanvasHeight = Math.max(minCanvasHeight, targetHeight + 60);
|
|
638
|
+
setCanvasSize({ width: newCanvasWidth, height: newCanvasHeight });
|
|
639
|
+
}, [targetWidth, targetHeight]);
|
|
640
|
+
// Actualizar tamaño del canvas al cambiar el tamaño de la ventana
|
|
641
|
+
useEffect(function () {
|
|
642
|
+
if (!isOpen) {
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
updateCanvasSize();
|
|
646
|
+
var handleResize = function () {
|
|
647
|
+
updateCanvasSize();
|
|
648
|
+
};
|
|
649
|
+
window.addEventListener("resize", handleResize);
|
|
650
|
+
return function () {
|
|
651
|
+
window.removeEventListener("resize", handleResize);
|
|
652
|
+
};
|
|
653
|
+
}, [isOpen, updateCanvasSize]);
|
|
654
|
+
return (jsx(Modal, { isOpen: isOpen, onClose: onCancel, size: "5xl", className: "sm:max-w-4xl", scrollBehavior: "inside", backdrop: "blur", classNames: {
|
|
655
|
+
backdrop: "bg-black/80",
|
|
656
|
+
wrapper: "p-0 sm:p-4",
|
|
657
|
+
base: "m-0 sm:m-4 max-h-screen sm:max-h-[90vh] w-full sm:w-auto",
|
|
658
|
+
}, children: jsxs(ModalContent, { className: "m-0 sm:m-0 h-screen sm:h-auto sm:max-h-[90vh] sm:rounded-lg", children: [jsxs(ModalHeader, { className: "flex flex-col gap-1 px-4 sm:px-6", children: [translations.cropModalTitle, jsx("p", { className: "text-xs sm:text-sm text-gray-500 font-normal", children: translations.cropInstructions })] }), jsx(ModalBody, { className: "px-4 sm:px-6 py-4", children: jsxs("div", { className: "flex flex-col gap-4", children: [jsx("div", { className: "flex justify-center overflow-hidden", children: jsx("canvas", { ref: canvasRef, width: canvasSize.width, height: canvasSize.height, className: "border border-gray-300 cursor-move select-none max-w-full max-h-[50vh] sm:max-h-[60vh]", onMouseDown: handleMouseDown, onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, onMouseLeave: handleMouseUp, onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd, style: { touchAction: "none" } }) }), jsxs("div", { className: "flex flex-col gap-2", children: [jsx("label", { htmlFor: "zoom-slider", className: "text-sm font-medium", children: translations.cropZoomLabel }), jsxs("div", { className: "flex items-center gap-2 sm:gap-3 w-full", children: [jsx("span", { className: "text-xs text-gray-500 min-w-[15px] sm:min-w-[20px]", children: "-" }), jsx(Slider, { id: "zoom-slider", size: "sm", step: 0.1, minValue: -1, maxValue: 1, value: zoomValue, onChange: function (value) { return setZoomValue(value); }, className: "flex-1", marks: [
|
|
659
|
+
{ value: -1, label: "Out" },
|
|
660
|
+
{ value: 0, label: "0" },
|
|
661
|
+
{ value: 1, label: "In" },
|
|
662
|
+
] }), jsx("span", { className: "text-xs text-gray-500 min-w-[15px] sm:min-w-[20px]", children: "+" })] })] }), jsxs("div", { className: "flex flex-col gap-2", children: [jsx("div", { className: "text-sm font-medium", children: translations.cropBackgroundLabel }), jsxs("div", { className: "flex flex-wrap gap-3 sm:gap-4", children: [jsxs("label", { className: "flex items-center gap-2 cursor-pointer", children: [jsx("input", { type: "radio", name: "background-color", value: "white", checked: backgroundColor === "white", onChange: function (e) {
|
|
663
|
+
return setBackgroundColor(e.target.value);
|
|
664
|
+
}, className: "text-blue-600 focus:ring-blue-500" }), jsx("div", { className: "w-4 h-4 bg-white border border-gray-300 rounded" }), jsx("span", { className: "text-sm", children: translations.cropBackgroundWhite })] }), jsxs("label", { className: "flex items-center gap-2 cursor-pointer", children: [jsx("input", { type: "radio", name: "background-color", value: "black", checked: backgroundColor === "black", onChange: function (e) {
|
|
665
|
+
return setBackgroundColor(e.target.value);
|
|
666
|
+
}, className: "text-blue-600 focus:ring-blue-500" }), jsx("div", { className: "w-4 h-4 bg-black border border-gray-300 rounded" }), jsx("span", { className: "text-sm", children: translations.cropBackgroundBlack })] }), jsxs("label", { className: "flex items-center gap-2 cursor-pointer", children: [jsx("input", { type: "radio", name: "background-color", value: "transparent", checked: backgroundColor === "transparent", onChange: function (e) {
|
|
667
|
+
return setBackgroundColor(e.target.value);
|
|
668
|
+
}, className: "text-blue-600 focus:ring-blue-500" }), jsx("div", { className: "w-4 h-4 bg-gray-200 border border-gray-300 rounded", style: {
|
|
669
|
+
backgroundImage: "linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%)",
|
|
670
|
+
backgroundSize: "8px 8px",
|
|
671
|
+
backgroundPosition: "0 0, 0 4px, 4px -4px, -4px 0px",
|
|
672
|
+
} }), jsx("span", { className: "text-sm", children: translations.cropBackgroundTransparent })] })] })] })] }) }), jsxs(ModalFooter, { className: "flex flex-col-reverse sm:flex-row gap-2 px-4 sm:px-6", children: [jsx(Button, { color: "danger", variant: "light", onPress: onCancel, className: "w-full sm:w-auto", children: translations.cropCancelButton }), jsx(Button, { color: "primary", onPress: handleSave, className: "w-full sm:w-auto", children: translations.cropSaveButton })] })] }) }));
|
|
673
|
+
};
|
|
674
|
+
/**
|
|
675
|
+
* Componente de previsualización de archivo
|
|
676
|
+
*/
|
|
677
|
+
var FilePreview = function (_a) {
|
|
678
|
+
var file = _a.file, onRemove = _a.onRemove, removeAriaLabel = _a.removeAriaLabel;
|
|
679
|
+
var _b = useState(""), previewUrl = _b[0], setPreviewUrl = _b[1];
|
|
680
|
+
useEffect(function () {
|
|
681
|
+
if (file === null || file === void 0 ? void 0 : file.type.startsWith("image/")) {
|
|
682
|
+
var url_1 = URL.createObjectURL(file);
|
|
683
|
+
setPreviewUrl(url_1);
|
|
684
|
+
return function () { return URL.revokeObjectURL(url_1); };
|
|
685
|
+
}
|
|
686
|
+
}, [file]);
|
|
687
|
+
if (!(file === null || file === void 0 ? void 0 : file.type.startsWith("image/"))) {
|
|
688
|
+
return null;
|
|
689
|
+
}
|
|
690
|
+
return (jsxs("div", { className: "absolute inset-0 overflow-hidden z-10", children: [jsx("img", { src: previewUrl, alt: file.name, className: "w-full h-full object-cover" }), jsx(Button, { isIconOnly: true, size: "sm", color: "danger", variant: "solid", className: "absolute top-2 right-2 sm:top-3 sm:right-3 z-20 bg-red-100 hover:bg-red-200 text-red-600 min-w-8 h-8 sm:min-w-10 sm:h-10", onPress: onRemove, "aria-label": removeAriaLabel, children: jsx(IconComponent, { icon: "heroicons:trash", size: "sm" }) })] }));
|
|
691
|
+
};
|
|
692
|
+
/**
|
|
693
|
+
* Componente UploadDocument basado en Hero UI con funcionalidad mejorada
|
|
694
|
+
*
|
|
695
|
+
* @example
|
|
696
|
+
* ```tsx
|
|
697
|
+
* <UploadDocument
|
|
698
|
+
* onUpload={(files) => console.log(files)}
|
|
699
|
+
* acceptedFiles="image/*,.pdf"
|
|
700
|
+
* multiple={false}
|
|
701
|
+
* translations={{
|
|
702
|
+
* uploadText: "Upload your files",
|
|
703
|
+
* dragText: "Drop files here"
|
|
704
|
+
* }}
|
|
705
|
+
* />
|
|
706
|
+
* ```
|
|
707
|
+
*/
|
|
708
|
+
var UploadFile = function (_a) {
|
|
709
|
+
var text = _a.text, textColor = _a.textColor, subText = _a.subText,
|
|
710
|
+
// borderColor, // TODO: Implementar colores personalizados
|
|
711
|
+
iconColor = _a.iconColor,
|
|
712
|
+
// backgroundColor, // TODO: Implementar colores personalizados
|
|
713
|
+
_b = _a.width,
|
|
714
|
+
// backgroundColor, // TODO: Implementar colores personalizados
|
|
715
|
+
width = _b === void 0 ? "100%" : _b, _c = _a.height, height = _c === void 0 ? "auto" : _c, _d = _a.multiple, multiple = _d === void 0 ? false : _d, _e = _a.maxFiles, maxFiles = _e === void 0 ? 1 : _e, maxFileSize = _a.maxFileSize, _f = _a.acceptedFiles, acceptedFiles = _f === void 0 ? ".pdf" : _f, _g = _a.icon, icon = _g === void 0 ? "heroicons:arrow-up-on-square" : _g, onUpload = _a.onUpload, onError = _a.onError, _h = _a.error, error = _h === void 0 ? false : _h, _j = _a.success, success = _j === void 0 ? false : _j, _k = _a.disabled, disabled = _k === void 0 ? false : _k, errorText = _a.errorText, cropConfig = _a.cropConfig, image = _a.image, _l = _a.className, className = _l === void 0 ? "" : _l, _m = _a.translations, translations = _m === void 0 ? {} : _m;
|
|
716
|
+
var inputRef = useRef(null);
|
|
717
|
+
var uploadImageRef = useRef(image || null);
|
|
718
|
+
var _o = useState(false), isDragging = _o[0], setIsDragging = _o[1];
|
|
719
|
+
// Estados para el modal de crop
|
|
720
|
+
var _p = useState(false), showCropModal = _p[0], setShowCropModal = _p[1];
|
|
721
|
+
var _q = useState(""), selectedImageUrl = _q[0], setSelectedImageUrl = _q[1];
|
|
722
|
+
var _r = useState(null); _r[0]; var setOriginalFile = _r[1];
|
|
723
|
+
// Combinar traducciones por defecto con las proporcionadas
|
|
724
|
+
var t = useMemo(function () { return (__assign(__assign({}, defaultTranslations), translations)); }, [translations]);
|
|
725
|
+
// Actualizar texto si se pasa como prop (retrocompatibilidad)
|
|
726
|
+
var finalText = text || t.uploadText;
|
|
727
|
+
var finalSubText = subText || t.subText;
|
|
728
|
+
var handleClick = function () {
|
|
729
|
+
var _a;
|
|
730
|
+
if (!(disabled || uploadImageRef.current)) {
|
|
731
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
var validateFiles = useCallback(function (files) {
|
|
735
|
+
var filesArray = Array.from(files);
|
|
736
|
+
if (!multiple && filesArray.length > 1) {
|
|
737
|
+
onError === null || onError === void 0 ? void 0 : onError(t.multipleFilesError);
|
|
738
|
+
return [];
|
|
739
|
+
}
|
|
740
|
+
if (filesArray.length > maxFiles) {
|
|
741
|
+
onError === null || onError === void 0 ? void 0 : onError(t.maxFilesError.replace("{maxFiles}", maxFiles.toString()));
|
|
742
|
+
return [];
|
|
743
|
+
}
|
|
744
|
+
// Validar tamaño de archivo
|
|
745
|
+
if (maxFileSize) {
|
|
746
|
+
var oversizedFiles = filesArray.filter(function (file) { return file.size > maxFileSize; });
|
|
747
|
+
if (oversizedFiles.length > 0) {
|
|
748
|
+
var maxSizeFormatted = formatFileSize(maxFileSize);
|
|
749
|
+
onError === null || onError === void 0 ? void 0 : onError(t.maxFileSizeError.replace("{maxSize}", maxSizeFormatted));
|
|
750
|
+
return [];
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
// Validar tipos de archivo
|
|
754
|
+
var acceptedExtensions = Array.isArray(acceptedFiles)
|
|
755
|
+
? acceptedFiles.map(function (ext) { return ext.trim().toLowerCase(); })
|
|
756
|
+
: acceptedFiles.split(",").map(function (ext) { return ext.trim().toLowerCase(); });
|
|
757
|
+
var validFiles = filesArray.filter(function (file) {
|
|
758
|
+
var _a;
|
|
759
|
+
if (acceptedFiles.includes("image/*") &&
|
|
760
|
+
file.type.startsWith("image/")) {
|
|
761
|
+
return true;
|
|
762
|
+
}
|
|
763
|
+
if (acceptedExtensions.some(function (ext) { return ext.includes("/"); })) {
|
|
764
|
+
return acceptedExtensions.some(function (type) { return file.type === type; });
|
|
765
|
+
}
|
|
766
|
+
var fileExtension = ".".concat((_a = file.name.split(".").pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase());
|
|
767
|
+
return acceptedExtensions.some(function (ext) { return ext === fileExtension || ext === "*"; });
|
|
768
|
+
});
|
|
769
|
+
if (validFiles.length === 0) {
|
|
770
|
+
var formattedTypes = acceptedExtensions
|
|
771
|
+
.map(formatFileType)
|
|
772
|
+
.join(", ");
|
|
773
|
+
onError === null || onError === void 0 ? void 0 : onError(t.invalidFileTypeError.replace("{acceptedTypes}", formattedTypes));
|
|
774
|
+
return [];
|
|
775
|
+
}
|
|
776
|
+
return validFiles;
|
|
777
|
+
}, [multiple, maxFiles, maxFileSize, acceptedFiles, t, onError]);
|
|
778
|
+
var handleFileUpload = useCallback(function (files) {
|
|
779
|
+
var validFiles = validateFiles(files);
|
|
780
|
+
if (validFiles.length > 0) {
|
|
781
|
+
var file_1 = validFiles[0];
|
|
782
|
+
// Si es imagen y hay configuración de crop, abrir modal
|
|
783
|
+
if (file_1.type.startsWith("image/") && cropConfig) {
|
|
784
|
+
var reader_1 = new FileReader();
|
|
785
|
+
reader_1.onload = function () {
|
|
786
|
+
setSelectedImageUrl(reader_1.result);
|
|
787
|
+
setOriginalFile(file_1);
|
|
788
|
+
setShowCropModal(true);
|
|
789
|
+
};
|
|
790
|
+
reader_1.readAsDataURL(file_1);
|
|
791
|
+
}
|
|
792
|
+
else {
|
|
793
|
+
// Procesar directamente si no necesita crop
|
|
794
|
+
uploadImageRef.current = file_1;
|
|
795
|
+
onUpload(validFiles);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
}, [onUpload, validateFiles, cropConfig]);
|
|
799
|
+
// Manejar guardado de imagen recortada
|
|
800
|
+
var handleCropSave = useCallback(function (croppedFile) {
|
|
801
|
+
uploadImageRef.current = croppedFile;
|
|
802
|
+
setShowCropModal(false);
|
|
803
|
+
setSelectedImageUrl("");
|
|
804
|
+
setOriginalFile(null);
|
|
805
|
+
onUpload([croppedFile]);
|
|
806
|
+
}, [onUpload]);
|
|
807
|
+
// Manejar cancelación de crop
|
|
808
|
+
var handleCropCancel = useCallback(function () {
|
|
809
|
+
setShowCropModal(false);
|
|
810
|
+
setSelectedImageUrl("");
|
|
811
|
+
setOriginalFile(null);
|
|
812
|
+
}, []);
|
|
813
|
+
var handleChange = function (event) {
|
|
814
|
+
var files = event.target.files;
|
|
815
|
+
if (files && files.length > 0) {
|
|
816
|
+
handleFileUpload(files);
|
|
817
|
+
}
|
|
818
|
+
// Limpiar el input
|
|
819
|
+
if (inputRef.current) {
|
|
820
|
+
inputRef.current.value = "";
|
|
821
|
+
}
|
|
822
|
+
};
|
|
823
|
+
var handleDragEnter = useCallback(function (e) {
|
|
824
|
+
e.preventDefault();
|
|
825
|
+
e.stopPropagation();
|
|
826
|
+
if (!disabled) {
|
|
827
|
+
setIsDragging(true);
|
|
828
|
+
}
|
|
829
|
+
}, [disabled]);
|
|
830
|
+
var handleDragLeave = useCallback(function (e) {
|
|
831
|
+
e.preventDefault();
|
|
832
|
+
e.stopPropagation();
|
|
833
|
+
setIsDragging(false);
|
|
834
|
+
}, []);
|
|
835
|
+
var handleDragOver = useCallback(function (e) {
|
|
836
|
+
e.preventDefault();
|
|
837
|
+
e.stopPropagation();
|
|
838
|
+
}, []);
|
|
839
|
+
var handleDrop = useCallback(function (e) {
|
|
840
|
+
e.preventDefault();
|
|
841
|
+
e.stopPropagation();
|
|
842
|
+
setIsDragging(false);
|
|
843
|
+
if (disabled) {
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
846
|
+
var droppedFiles = e.dataTransfer.files;
|
|
847
|
+
if (droppedFiles.length > 0) {
|
|
848
|
+
handleFileUpload(droppedFiles);
|
|
849
|
+
}
|
|
850
|
+
}, [disabled, handleFileUpload]);
|
|
851
|
+
var handleRemoveImage = function () {
|
|
852
|
+
uploadImageRef.current = null;
|
|
853
|
+
onUpload([]);
|
|
854
|
+
};
|
|
855
|
+
// Clases CSS dinámicas usando Tailwind
|
|
856
|
+
var containerClasses = "\n\t\trelative w-full border-2 border-dashed rounded-2xl p-2 sm:p-4 lg:p-4 transition-all duration-300\n\t\t".concat(width !== "100%" ? "w-[".concat(width, "]") : "w-full", "\n\t\t").concat(height !== "auto" ? "h-[".concat(height, "]") : "min-h-[150px] sm:min-h-[180px] lg:min-h-[200px]", "\n\t\t").concat(isDragging
|
|
857
|
+
? "border-blue-500 bg-blue-50 dark:bg-blue-950"
|
|
858
|
+
: error
|
|
859
|
+
? "border-red-500 bg-red-50 dark:bg-red-950"
|
|
860
|
+
: success
|
|
861
|
+
? "border-green-500 bg-green-50 dark:bg-green-950"
|
|
862
|
+
: disabled
|
|
863
|
+
? "border-gray-300 bg-gray-100 dark:bg-gray-800"
|
|
864
|
+
: "border-gray-300 hover:border-gray-400 bg-gray-50 dark:bg-gray-900", "\n\t\t").concat(!(disabled || uploadImageRef.current) ? "cursor-pointer" : "cursor-default", "\n\t\t").concat(className, "\n\t")
|
|
865
|
+
.trim()
|
|
866
|
+
.replace(/\s+/g, " ");
|
|
867
|
+
var textClasses = "\n\t\ttext-center mb-1 sm:mb-2 text-sm sm:text-base lg:text-lg font-medium\n\t\t".concat(disabled ? "text-gray-400" : textColor || "text-gray-700 dark:text-gray-200", "\n\t");
|
|
868
|
+
var subTextClasses = "\n\t\ttext-xs sm:text-sm text-center\n\t\t".concat(disabled ? "text-gray-400" : "text-gray-500 dark:text-gray-400", "\n\t");
|
|
869
|
+
return (jsxs("div", { className: "relative", children: [jsx(Card, { className: containerClasses, isPressable: !(disabled || uploadImageRef.current), onPress: handleClick, children: jsxs(CardBody, { className: "flex flex-col items-center justify-center gap-3 sm:gap-4 relative", onDragEnter: handleDragEnter, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, children: [uploadImageRef.current && (jsx(FilePreview, { file: uploadImageRef.current, onRemove: handleRemoveImage, removeAriaLabel: t.removeFileAriaLabel })), jsx("div", { className: uploadImageRef.current
|
|
870
|
+
? "opacity-0"
|
|
871
|
+
: "opacity-100 transition-opacity", children: jsxs("div", { className: "flex flex-col items-center gap-3 sm:gap-4", children: [jsx(IconComponent, { icon: icon, size: "xl", className: "sm:text-4xl lg:text-5xl ".concat(disabled ? "text-gray-400" : iconColor || "text-primary") }), jsxs("div", { className: "space-y-1 sm:space-y-2 text-center px-2", children: [jsx("p", { className: textClasses, children: isDragging ? t.dragText : finalText }), finalSubText && !isDragging && (jsx("p", { className: subTextClasses, children: finalSubText }))] })] }) }), jsx("input", { ref: inputRef, type: "file", className: "hidden", multiple: multiple, accept: Array.isArray(acceptedFiles)
|
|
872
|
+
? acceptedFiles.join(",")
|
|
873
|
+
: acceptedFiles, onChange: handleChange, disabled: disabled, "aria-label": t.uploadAreaAriaLabel })] }) }), error && errorText && (jsx("p", { className: "text-red-500 text-sm mt-2", role: "alert", children: errorText })), showCropModal && selectedImageUrl && cropConfig && (jsx(ImageCropModal, { isOpen: showCropModal, imageUrl: selectedImageUrl, targetWidth: cropConfig.targetWidth, targetHeight: cropConfig.targetHeight, onSave: handleCropSave, onCancel: handleCropCancel, translations: t }))] }));
|
|
874
|
+
};
|
|
875
|
+
UploadFile.displayName = "UploadFile";
|
|
876
|
+
|
|
380
877
|
var themeColors = {
|
|
381
878
|
"purple-light": {
|
|
382
879
|
extend: "light",
|
|
@@ -575,4 +1072,4 @@ var ThemeProvider = function (_a) {
|
|
|
575
1072
|
return (jsx(ThemeContext.Provider, { value: { theme: theme, setTheme: setTheme }, children: jsx("main", { className: "".concat(theme, " bg-background text-foreground "), children: children }) }));
|
|
576
1073
|
};
|
|
577
1074
|
|
|
578
|
-
export { ButtonPrueba, IconComponent, MenuComponent, Phone, ThemeContext, ThemeProvider, sizeMap, themeColors, useThemeContext };
|
|
1075
|
+
export { ButtonPrueba, IconComponent, MenuComponent, Phone, ThemeContext, ThemeProvider, UploadFile, sizeMap, themeColors, useThemeContext };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { UploadFileProps } from "./UploadFile.types";
|
|
3
|
+
/**
|
|
4
|
+
* Componente UploadDocument basado en Hero UI con funcionalidad mejorada
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <UploadDocument
|
|
9
|
+
* onUpload={(files) => console.log(files)}
|
|
10
|
+
* acceptedFiles="image/*,.pdf"
|
|
11
|
+
* multiple={false}
|
|
12
|
+
* translations={{
|
|
13
|
+
* uploadText: "Upload your files",
|
|
14
|
+
* dragText: "Drop files here"
|
|
15
|
+
* }}
|
|
16
|
+
* />
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const UploadFile: React.FC<UploadFileProps>;
|
|
20
|
+
//# sourceMappingURL=UploadFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UploadFile.d.ts","sourceRoot":"","sources":["../../../../src/components/UploadFile/UploadFile.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EACX,eAAe,EAEf,MAAM,oBAAoB,CAAC;AAkiB5B;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA0UhD,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Traducciones para el componente UploadFile
|
|
3
|
+
*/
|
|
4
|
+
export interface UploadFileTranslations {
|
|
5
|
+
/** Texto principal del área de carga */
|
|
6
|
+
uploadText?: string;
|
|
7
|
+
/** Texto secundario o de ayuda */
|
|
8
|
+
subText?: string;
|
|
9
|
+
/** Texto cuando se arrastra un archivo */
|
|
10
|
+
dragText?: string;
|
|
11
|
+
/** Mensaje de error por múltiples archivos */
|
|
12
|
+
multipleFilesError?: string;
|
|
13
|
+
/** Mensaje de error por límite de archivos excedido */
|
|
14
|
+
maxFilesError?: string;
|
|
15
|
+
/** Mensaje de error por tipo de archivo no válido */
|
|
16
|
+
invalidFileTypeError?: string;
|
|
17
|
+
/** Mensaje de error por tamaño de archivo excedido */
|
|
18
|
+
maxFileSizeError?: string;
|
|
19
|
+
/** Etiqueta ARIA para el botón de remover archivo */
|
|
20
|
+
removeFileAriaLabel?: string;
|
|
21
|
+
/** Etiqueta ARIA para el área de carga */
|
|
22
|
+
uploadAreaAriaLabel?: string;
|
|
23
|
+
/** Título del modal de recorte */
|
|
24
|
+
cropModalTitle?: string;
|
|
25
|
+
/** Texto del botón de guardar recorte */
|
|
26
|
+
cropSaveButton?: string;
|
|
27
|
+
/** Texto del botón de cancelar recorte */
|
|
28
|
+
cropCancelButton?: string;
|
|
29
|
+
/** Etiqueta para el control de zoom */
|
|
30
|
+
cropZoomLabel?: string;
|
|
31
|
+
/** Instrucciones de recorte */
|
|
32
|
+
cropInstructions?: string;
|
|
33
|
+
/** Etiqueta para el color de fondo */
|
|
34
|
+
cropBackgroundLabel?: string;
|
|
35
|
+
/** Opciones de color de fondo */
|
|
36
|
+
cropBackgroundWhite?: string;
|
|
37
|
+
cropBackgroundBlack?: string;
|
|
38
|
+
cropBackgroundTransparent?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Configuración para recorte de imagen
|
|
42
|
+
*/
|
|
43
|
+
export interface CropConfig {
|
|
44
|
+
/** Ancho objetivo de la imagen recortada */
|
|
45
|
+
targetWidth: number;
|
|
46
|
+
/** Alto objetivo de la imagen recortada */
|
|
47
|
+
targetHeight: number;
|
|
48
|
+
/** Texto del botón de guardar recorte */
|
|
49
|
+
textButton?: string;
|
|
50
|
+
/** Color del botón de guardar recorte */
|
|
51
|
+
colorButton?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Props del componente UploadFile
|
|
55
|
+
*/
|
|
56
|
+
export interface UploadFileProps {
|
|
57
|
+
/** Texto principal del área de carga */
|
|
58
|
+
text?: string;
|
|
59
|
+
/** Color del texto principal */
|
|
60
|
+
textColor?: string;
|
|
61
|
+
/** Texto secundario o de ayuda */
|
|
62
|
+
subText?: string;
|
|
63
|
+
/** Color del borde */
|
|
64
|
+
borderColor?: string;
|
|
65
|
+
/** Color del icono */
|
|
66
|
+
iconColor?: string;
|
|
67
|
+
/** Color de fondo */
|
|
68
|
+
backgroundColor?: string;
|
|
69
|
+
/** Ancho del componente */
|
|
70
|
+
width?: string;
|
|
71
|
+
/** Alto del componente */
|
|
72
|
+
height?: string;
|
|
73
|
+
/** Permitir múltiples archivos */
|
|
74
|
+
multiple?: boolean;
|
|
75
|
+
/** Número máximo de archivos */
|
|
76
|
+
maxFiles?: number;
|
|
77
|
+
/** Tamaño máximo de archivo en bytes */
|
|
78
|
+
maxFileSize?: number;
|
|
79
|
+
/** Tipos de archivo aceptados */
|
|
80
|
+
acceptedFiles?: string | string[];
|
|
81
|
+
/** Icono a mostrar */
|
|
82
|
+
icon?: string;
|
|
83
|
+
/** Función callback al subir archivos */
|
|
84
|
+
onUpload: (files: File[]) => void;
|
|
85
|
+
/** Función callback para manejar errores de validación */
|
|
86
|
+
onError?: (message: string) => void;
|
|
87
|
+
/** Estado de error */
|
|
88
|
+
error?: boolean;
|
|
89
|
+
/** Estado de éxito */
|
|
90
|
+
success?: boolean;
|
|
91
|
+
/** Estado deshabilitado */
|
|
92
|
+
disabled?: boolean;
|
|
93
|
+
/** Texto del mensaje de error */
|
|
94
|
+
errorText?: string;
|
|
95
|
+
/** Configuración para recorte de imagen */
|
|
96
|
+
cropConfig?: CropConfig;
|
|
97
|
+
/** Archivo de imagen preseleccionado */
|
|
98
|
+
image?: File;
|
|
99
|
+
/** Clases CSS adicionales */
|
|
100
|
+
className?: string;
|
|
101
|
+
/** Traducciones para i18n */
|
|
102
|
+
translations?: UploadFileTranslations;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=UploadFile.types.d.ts.map
|