@beweco/aurora-ui 0.1.31 → 0.1.39
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 +195 -10
- package/dist/index.esm.js +195 -13
- package/dist/types/components/color-picker/ColorPicker.d.ts.map +1 -1
- package/dist/types/components/kanban/Kanban.d.ts +27 -0
- package/dist/types/components/kanban/Kanban.d.ts.map +1 -0
- package/dist/types/components/kanban/Kanban.types.d.ts +163 -0
- package/dist/types/components/kanban/Kanban.types.d.ts.map +1 -0
- package/dist/types/components/kanban/_internal/KanbanCard.d.ts +11 -0
- package/dist/types/components/kanban/_internal/KanbanCard.d.ts.map +1 -0
- package/dist/types/components/kanban/_internal/KanbanColumn.d.ts +12 -0
- package/dist/types/components/kanban/_internal/KanbanColumn.d.ts.map +1 -0
- package/dist/types/components/kanban/_internal/index.d.ts +3 -0
- package/dist/types/components/kanban/_internal/index.d.ts.map +1 -0
- package/dist/types/components/kanban/index.d.ts +4 -0
- package/dist/types/components/kanban/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.cjs.js
CHANGED
|
@@ -762,16 +762,15 @@ var ColorPicker = function (_a) {
|
|
|
762
762
|
/**
|
|
763
763
|
* Render a color circle button
|
|
764
764
|
*/
|
|
765
|
-
var renderColorCircle = function (colorValue, colorName, isSelected) { return (jsxRuntime.jsx("button", { type: "button", disabled: disabled, onClick: function () { return handlePredefinedColorClick(colorValue); }, className: "\n\t\t\t\tw-
|
|
766
|
-
? "border-primary
|
|
767
|
-
: "border-default-
|
|
768
|
-
return (jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 ".concat(className), children: [label && (jsxRuntime.jsxs("label", { htmlFor: inputId, className: "block text-sm font-medium text-foreground", children: [label, required && jsxRuntime.jsx("span", { className: "text-danger ml-1", children: "*" })] })), jsxRuntime.jsxs("div", { className: "flex
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
}, startContent: jsxRuntime.jsx("span", { className: "text-default-400 text-sm", children: "#" }) }) })] }), showPredefinedColors && predefinedColors.length > 0 && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("p", { className: "text-xs font-medium text-default-600 mb-2", children: t.predefinedColorsLabel }), jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: predefinedColors.map(function (color) {
|
|
765
|
+
var renderColorCircle = function (colorValue, colorName, isSelected) { return (jsxRuntime.jsx("button", { type: "button", disabled: disabled, onClick: function () { return handlePredefinedColorClick(colorValue); }, className: "\n\t\t\t\tw-8 h-8 rounded-full border-2 cursor-pointer transition-all\n\t\t\t\tfocus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-1\n\t\t\t\t".concat(disabled ? "opacity-50 cursor-not-allowed" : "hover:scale-110", "\n\t\t\t\t").concat(isSelected
|
|
766
|
+
? "border-primary-500 scale-110 ring-2 ring-primary-500 ring-offset-1"
|
|
767
|
+
: "border-default-700", "\n\t\t\t"), style: { backgroundColor: colorValue }, title: colorName, "aria-label": colorName }, colorValue)); };
|
|
768
|
+
return (jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 ".concat(className), children: [label && (jsxRuntime.jsxs("label", { htmlFor: inputId, className: "block text-sm font-medium text-foreground", children: [label, required && jsxRuntime.jsx("span", { className: "text-danger ml-1", children: "*" })] })), jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("input", { type: "color", id: inputId, name: name, value: textValue, onChange: handleColorPickerChange, disabled: disabled, className: "\n\t\t\t\t\t\t\tw-10 h-10 rounded-lg cursor-pointer border-2 flex-shrink-0\n\t\t\t\t\t\t\ttransition-colors appearance-none bg-transparent p-0.5\n\t\t\t\t\t\t\tfocus:border-primary-500\n\t\t\t\t\t\t\t".concat(disabled ? "opacity-50 cursor-not-allowed" : "hover:border-default-400", "\n\t\t\t\t\t\t\t").concat(error
|
|
769
|
+
? "border-danger dark:border-danger-400"
|
|
770
|
+
: "border-default-300 dark:border-default-700", "\n\t\t\t\t\t\t"), "aria-label": t.customColorLabel, title: t.customColorLabel }), jsxRuntime.jsx(react.Input, { type: "text", value: textValue, onValueChange: handleTextChange, placeholder: t.placeholder, disabled: disabled, isInvalid: error || isInvalidFormat, size: "sm", variant: "bordered", classNames: {
|
|
771
|
+
input: "uppercase font-mono text-small",
|
|
772
|
+
inputWrapper: "min-h-8 h-8 focus-within:!border-primary-500",
|
|
773
|
+
}, startContent: jsxRuntime.jsx("span", { className: "text-default-400 text-sm", children: "#" }) })] }), (error || isInvalidFormat) && (jsxRuntime.jsx("p", { className: "text-tiny text-danger", children: isInvalidFormat ? t.invalidColorFormat : errorText }))] }), showPredefinedColors && predefinedColors.length > 0 && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("p", { className: "text-xs font-medium text-default-600 mb-2", children: t.predefinedColorsLabel }), jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: predefinedColors.map(function (color) {
|
|
775
774
|
return renderColorCircle(color.value, color.name, normalizeHexColor(value) === normalizeHexColor(color.value));
|
|
776
775
|
}) })] })), enableRecentColors && recentColors.length > 0 && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("p", { className: "text-xs font-medium text-default-600 mb-2", children: t.recentColorsLabel }), jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: recentColors.map(function (color) {
|
|
777
776
|
return renderColorCircle(color, color, normalizeHexColor(value) === color);
|
|
@@ -1700,6 +1699,189 @@ var HeaderComponent = function (_a) {
|
|
|
1700
1699
|
};
|
|
1701
1700
|
HeaderComponent.displayName = "Header";
|
|
1702
1701
|
|
|
1702
|
+
/**
|
|
1703
|
+
* KanbanCard - Contenedor de tarjeta genérico del Kanban con soporte drag and drop
|
|
1704
|
+
*
|
|
1705
|
+
* El contenido es 100% definido por el padre mediante renderContent.
|
|
1706
|
+
* Este componente solo provee el contenedor con estilos, eventos y drag.
|
|
1707
|
+
*/
|
|
1708
|
+
var KanbanCardComponent = function (_a) {
|
|
1709
|
+
var item = _a.item, columnId = _a.columnId, index = _a.index, renderContent = _a.renderContent, onCardClick = _a.onCardClick, className = _a.className, _b = _a.isClickable, isClickable = _b === void 0 ? true : _b, _c = _a.isDraggable, isDraggable = _c === void 0 ? false : _c, onDragStart = _a.onDragStart, onDragEnd = _a.onDragEnd;
|
|
1710
|
+
var _d = React.useState(false), isDragging = _d[0], setIsDragging = _d[1];
|
|
1711
|
+
var handleClick = React.useCallback(function () {
|
|
1712
|
+
if (!isDragging) {
|
|
1713
|
+
onCardClick === null || onCardClick === void 0 ? void 0 : onCardClick(item);
|
|
1714
|
+
}
|
|
1715
|
+
}, [item, onCardClick, isDragging]);
|
|
1716
|
+
var handleKeyDown = React.useCallback(function (e) {
|
|
1717
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1718
|
+
e.preventDefault();
|
|
1719
|
+
onCardClick === null || onCardClick === void 0 ? void 0 : onCardClick(item);
|
|
1720
|
+
}
|
|
1721
|
+
}, [item, onCardClick]);
|
|
1722
|
+
var handleDragStart = React.useCallback(function (e) {
|
|
1723
|
+
if (!isDraggable)
|
|
1724
|
+
return;
|
|
1725
|
+
setIsDragging(true);
|
|
1726
|
+
// Datos para el drop
|
|
1727
|
+
e.dataTransfer.setData("application/json", JSON.stringify({ itemId: item.id, fromColumnId: columnId, fromIndex: index }));
|
|
1728
|
+
e.dataTransfer.effectAllowed = "move";
|
|
1729
|
+
// Notificar al padre
|
|
1730
|
+
onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart(item, columnId, index);
|
|
1731
|
+
}, [item, columnId, index, isDraggable, onDragStart]);
|
|
1732
|
+
var handleDragEnd = React.useCallback(function () {
|
|
1733
|
+
setIsDragging(false);
|
|
1734
|
+
onDragEnd === null || onDragEnd === void 0 ? void 0 : onDragEnd();
|
|
1735
|
+
}, [onDragEnd]);
|
|
1736
|
+
var isInteractive = isClickable && onCardClick;
|
|
1737
|
+
return (jsxRuntime.jsx("div", { className: react.cn("bg-content1 border border-default-200 rounded-lg p-4 transition-all", isInteractive && "cursor-pointer hover:border-default-400", isDraggable && "cursor-grab active:cursor-grabbing", isDragging && "opacity-50 scale-95 shadow-lg", className), onClick: isInteractive ? handleClick : undefined, onKeyDown: isInteractive ? handleKeyDown : undefined, role: isInteractive ? "button" : undefined, tabIndex: isInteractive ? 0 : undefined, draggable: isDraggable, onDragStart: handleDragStart, onDragEnd: handleDragEnd, children: renderContent(item) }));
|
|
1738
|
+
};
|
|
1739
|
+
var KanbanCard = React.memo(KanbanCardComponent);
|
|
1740
|
+
KanbanCard.displayName = "KanbanCard";
|
|
1741
|
+
|
|
1742
|
+
/**
|
|
1743
|
+
* KanbanColumn - Columna individual del Kanban con soporte de drop
|
|
1744
|
+
*
|
|
1745
|
+
* Muestra un header con título y badge de conteo,
|
|
1746
|
+
* una lista scrolleable de tarjetas, y estado vacío.
|
|
1747
|
+
* Acepta drops de tarjetas de otras columnas.
|
|
1748
|
+
*/
|
|
1749
|
+
var KanbanColumnComponent = function (_a) {
|
|
1750
|
+
var _b, _c;
|
|
1751
|
+
var column = _a.column, renderItem = _a.renderItem, onCardClick = _a.onCardClick, cardClassName = _a.cardClassName, isCardClickable = _a.isCardClickable, className = _a.className, _d = _a.maxHeight, maxHeight = _d === void 0 ? "calc(100vh - 280px)" : _d, renderColumnHeader = _a.renderColumnHeader, renderEmptyState = _a.renderEmptyState, _e = _a.isDraggable, isDraggable = _e === void 0 ? false : _e, onDragStart = _a.onDragStart, onDragEnd = _a.onDragEnd, onDrop = _a.onDrop, _f = _a.isDragging, isDragging = _f === void 0 ? false : _f, _g = _a.translations, translations = _g === void 0 ? {} : _g;
|
|
1752
|
+
// Traducciones con fallbacks
|
|
1753
|
+
var t = {
|
|
1754
|
+
dropHere: (_b = translations.dropHere) !== null && _b !== void 0 ? _b : "Soltar aquí",
|
|
1755
|
+
emptyMessage: (_c = translations.emptyMessage) !== null && _c !== void 0 ? _c : "No hay elementos",
|
|
1756
|
+
};
|
|
1757
|
+
var _h = React.useState(false), isDragOver = _h[0], setIsDragOver = _h[1];
|
|
1758
|
+
var _j = React.useState(null), dropIndex = _j[0], setDropIndex = _j[1];
|
|
1759
|
+
var itemCount = column.items.length;
|
|
1760
|
+
var isEmpty = itemCount === 0;
|
|
1761
|
+
var handleDragOver = React.useCallback(function (e) {
|
|
1762
|
+
if (!isDraggable)
|
|
1763
|
+
return;
|
|
1764
|
+
e.preventDefault();
|
|
1765
|
+
e.dataTransfer.dropEffect = "move";
|
|
1766
|
+
setIsDragOver(true);
|
|
1767
|
+
}, [isDraggable]);
|
|
1768
|
+
var handleDragLeave = React.useCallback(function (e) {
|
|
1769
|
+
// Solo salir si realmente salimos de la columna (no de un hijo)
|
|
1770
|
+
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
1771
|
+
setIsDragOver(false);
|
|
1772
|
+
setDropIndex(null);
|
|
1773
|
+
}
|
|
1774
|
+
}, []);
|
|
1775
|
+
var handleDrop = React.useCallback(function (e) {
|
|
1776
|
+
e.preventDefault();
|
|
1777
|
+
setIsDragOver(false);
|
|
1778
|
+
setDropIndex(null);
|
|
1779
|
+
if (!isDraggable)
|
|
1780
|
+
return;
|
|
1781
|
+
// Calcular índice de drop basado en posición Y
|
|
1782
|
+
var finalDropIndex = dropIndex !== null && dropIndex !== void 0 ? dropIndex : column.items.length;
|
|
1783
|
+
onDrop === null || onDrop === void 0 ? void 0 : onDrop(column.id, finalDropIndex);
|
|
1784
|
+
}, [isDraggable, column.id, column.items.length, dropIndex, onDrop]);
|
|
1785
|
+
// Calcular índice de drop basado en la posición del mouse
|
|
1786
|
+
var handleDragOverItem = React.useCallback(function (e, itemIndex) {
|
|
1787
|
+
e.preventDefault();
|
|
1788
|
+
var rect = e.currentTarget.getBoundingClientRect();
|
|
1789
|
+
var midpoint = rect.top + rect.height / 2;
|
|
1790
|
+
var newDropIndex = e.clientY < midpoint ? itemIndex : itemIndex + 1;
|
|
1791
|
+
setDropIndex(newDropIndex);
|
|
1792
|
+
}, []);
|
|
1793
|
+
return (jsxRuntime.jsxs("div", { className: react.cn("flex flex-col bg-default-50 rounded-lg border border-default-200 transition-colors", isDragOver && isDragging && "border-primary-400 bg-primary-50/30", className), onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, children: [renderColumnHeader ? (renderColumnHeader(column)) : (jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-4 py-3 border-b border-default-200", children: [jsxRuntime.jsx("h3", { className: "font-semibold text-foreground", children: column.title }), jsxRuntime.jsx(react.Badge, { content: itemCount, color: column.countBadgeColor || "default", variant: "flat", size: "md", classNames: {
|
|
1794
|
+
badge: "text-xs font-medium min-w-6 h-6",
|
|
1795
|
+
}, children: jsxRuntime.jsxs("span", { className: "sr-only", children: [itemCount, " items"] }) })] })), jsxRuntime.jsx("div", { className: react.cn("flex-1 overflow-y-auto p-3 space-y-3", isDragOver && isEmpty && "min-h-24"), style: { maxHeight: maxHeight }, children: isEmpty ? (isDragOver && isDragging ? (jsxRuntime.jsx("div", { className: "h-24 border-2 border-dashed border-primary-300 rounded-lg bg-primary-50/50 flex items-center justify-center", children: jsxRuntime.jsx("span", { className: "text-primary-500 text-sm", children: t.dropHere }) })) : renderEmptyState ? (renderEmptyState(column)) : (jsxRuntime.jsx("div", { className: "flex items-center justify-center h-24 text-default-400 text-sm", children: column.emptyMessage || t.emptyMessage }))) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [column.items.map(function (item, index) { return (jsxRuntime.jsxs("div", { onDragOver: function (e) { return handleDragOverItem(e, index); }, children: [isDragOver && dropIndex === index && (jsxRuntime.jsx("div", { className: "h-1 bg-primary-400 rounded-full mb-3 animate-pulse" })), jsxRuntime.jsx(KanbanCard, { item: item, columnId: column.id, index: index, renderContent: renderItem, onCardClick: onCardClick, className: cardClassName, isClickable: isCardClickable, isDraggable: isDraggable, onDragStart: onDragStart, onDragEnd: onDragEnd })] }, item.id)); }), isDragOver && dropIndex === column.items.length && (jsxRuntime.jsx("div", { className: "h-1 bg-primary-400 rounded-full mt-3 animate-pulse" }))] })) })] }));
|
|
1796
|
+
};
|
|
1797
|
+
var KanbanColumn = React.memo(KanbanColumnComponent);
|
|
1798
|
+
KanbanColumn.displayName = "KanbanColumn";
|
|
1799
|
+
|
|
1800
|
+
/**
|
|
1801
|
+
* Traducciones por defecto en español.
|
|
1802
|
+
* Se mezclan con las traducciones proporcionadas por el usuario.
|
|
1803
|
+
*/
|
|
1804
|
+
var DEFAULT_TRANSLATIONS = {
|
|
1805
|
+
dropHere: "Soltar aquí",
|
|
1806
|
+
emptyMessage: "No hay elementos",
|
|
1807
|
+
};
|
|
1808
|
+
var columnGapClasses = {
|
|
1809
|
+
sm: "gap-3",
|
|
1810
|
+
md: "gap-4",
|
|
1811
|
+
lg: "gap-6",
|
|
1812
|
+
};
|
|
1813
|
+
/**
|
|
1814
|
+
* Kanban - Tablero Kanban genérico con columnas, tarjetas y drag and drop
|
|
1815
|
+
*
|
|
1816
|
+
* El contenido de cada tarjeta es 100% definido por el consumidor
|
|
1817
|
+
* mediante la prop `renderItem`. Esto permite usar el Kanban para
|
|
1818
|
+
* cualquier caso de uso: contactos, tareas, proyectos, etc.
|
|
1819
|
+
*
|
|
1820
|
+
* Soporta drag and drop entre columnas con el callback `onItemMove`.
|
|
1821
|
+
*
|
|
1822
|
+
* @example
|
|
1823
|
+
* ```tsx
|
|
1824
|
+
* // Kanban de tareas con drag and drop
|
|
1825
|
+
* <Kanban<Task>
|
|
1826
|
+
* columns={columns}
|
|
1827
|
+
* renderItem={(item) => <TaskCard task={item.data} />}
|
|
1828
|
+
* onItemMove={(event) => {
|
|
1829
|
+
* console.log(`Moved ${event.item.id} from ${event.fromColumnId} to ${event.toColumnId}`);
|
|
1830
|
+
* // Actualizar estado...
|
|
1831
|
+
* }}
|
|
1832
|
+
* />
|
|
1833
|
+
* ```
|
|
1834
|
+
*/
|
|
1835
|
+
var KanbanComponent = function (_a) {
|
|
1836
|
+
var columns = _a.columns, renderItem = _a.renderItem, onCardClick = _a.onCardClick, onItemMove = _a.onItemMove, isDraggable = _a.isDraggable, cardClassName = _a.cardClassName, isCardClickable = _a.isCardClickable, className = _a.className, _b = _a.columnWidth, columnWidth = _b === void 0 ? "280px" : _b, _c = _a.columnGap, columnGap = _c === void 0 ? "md" : _c, _d = _a.horizontalScroll, horizontalScroll = _d === void 0 ? true : _d, columnMaxHeight = _a.columnMaxHeight, renderColumnHeader = _a.renderColumnHeader, renderEmptyState = _a.renderEmptyState, _e = _a.translations, translations = _e === void 0 ? {} : _e;
|
|
1837
|
+
// Mezclar traducciones del usuario con las por defecto
|
|
1838
|
+
var t = __assign(__assign({}, DEFAULT_TRANSLATIONS), translations);
|
|
1839
|
+
// Determinar si drag está habilitado
|
|
1840
|
+
var dragEnabled = isDraggable !== null && isDraggable !== void 0 ? isDraggable : !!onItemMove;
|
|
1841
|
+
// Estado del drag actual
|
|
1842
|
+
var _f = React.useState(false), isDragging = _f[0], setIsDragging = _f[1];
|
|
1843
|
+
var dragDataRef = React.useRef(null);
|
|
1844
|
+
// Cuando empieza el drag
|
|
1845
|
+
var handleDragStart = React.useCallback(function (item, columnId, index) {
|
|
1846
|
+
setIsDragging(true);
|
|
1847
|
+
dragDataRef.current = { item: item, fromColumnId: columnId, fromIndex: index };
|
|
1848
|
+
}, []);
|
|
1849
|
+
// Cuando termina el drag (sin drop válido)
|
|
1850
|
+
var handleDragEnd = React.useCallback(function () {
|
|
1851
|
+
setIsDragging(false);
|
|
1852
|
+
dragDataRef.current = null;
|
|
1853
|
+
}, []);
|
|
1854
|
+
// Cuando se suelta en una columna
|
|
1855
|
+
var handleDrop = React.useCallback(function (toColumnId, toIndex) {
|
|
1856
|
+
var dragData = dragDataRef.current;
|
|
1857
|
+
if (!dragData || !onItemMove)
|
|
1858
|
+
return;
|
|
1859
|
+
var item = dragData.item, fromColumnId = dragData.fromColumnId, fromIndex = dragData.fromIndex;
|
|
1860
|
+
// No hacer nada si se suelta en la misma posición
|
|
1861
|
+
if (fromColumnId === toColumnId && fromIndex === toIndex) {
|
|
1862
|
+
handleDragEnd();
|
|
1863
|
+
return;
|
|
1864
|
+
}
|
|
1865
|
+
// Ajustar índice si se mueve dentro de la misma columna hacia abajo
|
|
1866
|
+
var adjustedToIndex = toIndex;
|
|
1867
|
+
if (fromColumnId === toColumnId && fromIndex < toIndex) {
|
|
1868
|
+
adjustedToIndex = toIndex - 1;
|
|
1869
|
+
}
|
|
1870
|
+
// Notificar al padre
|
|
1871
|
+
onItemMove({
|
|
1872
|
+
item: item,
|
|
1873
|
+
fromColumnId: fromColumnId,
|
|
1874
|
+
toColumnId: toColumnId,
|
|
1875
|
+
fromIndex: fromIndex,
|
|
1876
|
+
toIndex: adjustedToIndex,
|
|
1877
|
+
});
|
|
1878
|
+
handleDragEnd();
|
|
1879
|
+
}, [onItemMove, handleDragEnd]);
|
|
1880
|
+
return (jsxRuntime.jsx("div", { className: react.cn("flex", columnGapClasses[columnGap], horizontalScroll && "overflow-x-auto pb-4", className), children: columns.map(function (column) { return (jsxRuntime.jsx("div", { className: "flex-shrink-0", style: { width: columnWidth }, children: jsxRuntime.jsx(KanbanColumn, { column: column, renderItem: renderItem, onCardClick: onCardClick, cardClassName: cardClassName, isCardClickable: isCardClickable, maxHeight: columnMaxHeight, renderColumnHeader: renderColumnHeader, renderEmptyState: renderEmptyState, isDraggable: dragEnabled, onDragStart: handleDragStart, onDragEnd: handleDragEnd, onDrop: handleDrop, isDragging: isDragging, translations: t }) }, column.id)); }) }));
|
|
1881
|
+
};
|
|
1882
|
+
var Kanban = React.memo(KanbanComponent);
|
|
1883
|
+
Kanban.displayName = "Kanban";
|
|
1884
|
+
|
|
1703
1885
|
var defaultTranslations$8 = {
|
|
1704
1886
|
previewAlt: "Vista previa de imagen",
|
|
1705
1887
|
removeButtonAriaLabel: "Eliminar imagen",
|
|
@@ -4987,6 +5169,9 @@ exports.HeaderComponent = HeaderComponent;
|
|
|
4987
5169
|
exports.IconComponent = IconComponent;
|
|
4988
5170
|
exports.ImagePreview = ImagePreview;
|
|
4989
5171
|
exports.Input = Input;
|
|
5172
|
+
exports.Kanban = Kanban;
|
|
5173
|
+
exports.KanbanCard = KanbanCard;
|
|
5174
|
+
exports.KanbanColumn = KanbanColumn;
|
|
4990
5175
|
exports.MenuComponent = MenuComponent;
|
|
4991
5176
|
exports.Modal = Modal;
|
|
4992
5177
|
exports.ModalBody = ModalBody;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Skeleton, Button as Button$1, Chip as Chip$1, Accordion, AccordionItem, Pagination as Pagination$1, DatePicker as DatePicker$1, DateRangePicker as DateRangePicker$1, Input as Input$1, RadioGroup, Radio, cn, Card as Card$1, Spacer, Tabs, Tab, Dropdown, DropdownTrigger, DropdownMenu, DropdownItem, Autocomplete, Breadcrumbs, BreadcrumbItem, DropdownSection, ListboxItem, Popover, PopoverTrigger, Tooltip as Tooltip$1, PopoverContent, Listbox, ListboxSection, Avatar, CardBody, CardFooter, Link, Switch as Switch$1, TimeInput as TimeInput$1, Select as Select$1, Image as Image$1, Table, TableHeader, TableColumn, TableBody, TableRow, TableCell, Textarea as Textarea$1, Alert, Modal as Modal$1, ModalContent as ModalContent$1, ModalHeader as ModalHeader$1, ModalBody as ModalBody$1, Slider, ModalFooter as ModalFooter$1, Spinner, SelectItem, Drawer, DrawerContent, DrawerBody } from '@heroui/react';
|
|
1
|
+
import { Skeleton, Button as Button$1, Chip as Chip$1, Accordion, AccordionItem, Pagination as Pagination$1, DatePicker as DatePicker$1, DateRangePicker as DateRangePicker$1, Input as Input$1, RadioGroup, Radio, cn, Card as Card$1, Spacer, Tabs, Tab, Dropdown, DropdownTrigger, DropdownMenu, DropdownItem, Autocomplete, Breadcrumbs, BreadcrumbItem, DropdownSection, Badge, ListboxItem, Popover, PopoverTrigger, Tooltip as Tooltip$1, PopoverContent, Listbox, ListboxSection, Avatar, CardBody, CardFooter, Link, Switch as Switch$1, TimeInput as TimeInput$1, Select as Select$1, Image as Image$1, Table, TableHeader, TableColumn, TableBody, TableRow, TableCell, Textarea as Textarea$1, Alert, Modal as Modal$1, ModalContent as ModalContent$1, ModalHeader as ModalHeader$1, ModalBody as ModalBody$1, Slider, ModalFooter as ModalFooter$1, Spinner, SelectItem, Drawer, DrawerContent, DrawerBody } from '@heroui/react';
|
|
2
2
|
export * from '@heroui/react';
|
|
3
3
|
export { Slider } from '@heroui/react';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import { Icon } from '@iconify/react';
|
|
6
6
|
export { loadIcons } from '@iconify/react';
|
|
7
|
-
import React, { useId, useState, useCallback, useMemo, useEffect, createContext, useContext,
|
|
7
|
+
import React, { useId, useState, useCallback, useMemo, useEffect, createContext, useContext, memo, useRef, createElement, useLayoutEffect } from 'react';
|
|
8
8
|
import { ResponsiveContainer, AreaChart, CartesianGrid, XAxis, Tooltip, Area } from 'recharts';
|
|
9
9
|
import { LazyMotion, domAnimation, m } from 'framer-motion';
|
|
10
10
|
import { createPortal } from 'react-dom';
|
|
@@ -763,16 +763,15 @@ var ColorPicker = function (_a) {
|
|
|
763
763
|
/**
|
|
764
764
|
* Render a color circle button
|
|
765
765
|
*/
|
|
766
|
-
var renderColorCircle = function (colorValue, colorName, isSelected) { return (jsx("button", { type: "button", disabled: disabled, onClick: function () { return handlePredefinedColorClick(colorValue); }, className: "\n\t\t\t\tw-
|
|
767
|
-
? "border-primary
|
|
768
|
-
: "border-default-
|
|
769
|
-
return (jsxs("div", { className: "flex flex-col gap-3 ".concat(className), children: [label && (jsxs("label", { htmlFor: inputId, className: "block text-sm font-medium text-foreground", children: [label, required && jsx("span", { className: "text-danger ml-1", children: "*" })] })), jsxs("div", { className: "flex
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
}, startContent: jsx("span", { className: "text-default-400 text-sm", children: "#" }) }) })] }), showPredefinedColors && predefinedColors.length > 0 && (jsxs("div", { children: [jsx("p", { className: "text-xs font-medium text-default-600 mb-2", children: t.predefinedColorsLabel }), jsx("div", { className: "flex flex-wrap gap-2", children: predefinedColors.map(function (color) {
|
|
766
|
+
var renderColorCircle = function (colorValue, colorName, isSelected) { return (jsx("button", { type: "button", disabled: disabled, onClick: function () { return handlePredefinedColorClick(colorValue); }, className: "\n\t\t\t\tw-8 h-8 rounded-full border-2 cursor-pointer transition-all\n\t\t\t\tfocus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-1\n\t\t\t\t".concat(disabled ? "opacity-50 cursor-not-allowed" : "hover:scale-110", "\n\t\t\t\t").concat(isSelected
|
|
767
|
+
? "border-primary-500 scale-110 ring-2 ring-primary-500 ring-offset-1"
|
|
768
|
+
: "border-default-700", "\n\t\t\t"), style: { backgroundColor: colorValue }, title: colorName, "aria-label": colorName }, colorValue)); };
|
|
769
|
+
return (jsxs("div", { className: "flex flex-col gap-3 ".concat(className), children: [label && (jsxs("label", { htmlFor: inputId, className: "block text-sm font-medium text-foreground", children: [label, required && jsx("span", { className: "text-danger ml-1", children: "*" })] })), jsxs("div", { className: "flex flex-col gap-1", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx("input", { type: "color", id: inputId, name: name, value: textValue, onChange: handleColorPickerChange, disabled: disabled, className: "\n\t\t\t\t\t\t\tw-10 h-10 rounded-lg cursor-pointer border-2 flex-shrink-0\n\t\t\t\t\t\t\ttransition-colors appearance-none bg-transparent p-0.5\n\t\t\t\t\t\t\tfocus:border-primary-500\n\t\t\t\t\t\t\t".concat(disabled ? "opacity-50 cursor-not-allowed" : "hover:border-default-400", "\n\t\t\t\t\t\t\t").concat(error
|
|
770
|
+
? "border-danger dark:border-danger-400"
|
|
771
|
+
: "border-default-300 dark:border-default-700", "\n\t\t\t\t\t\t"), "aria-label": t.customColorLabel, title: t.customColorLabel }), jsx(Input$1, { type: "text", value: textValue, onValueChange: handleTextChange, placeholder: t.placeholder, disabled: disabled, isInvalid: error || isInvalidFormat, size: "sm", variant: "bordered", classNames: {
|
|
772
|
+
input: "uppercase font-mono text-small",
|
|
773
|
+
inputWrapper: "min-h-8 h-8 focus-within:!border-primary-500",
|
|
774
|
+
}, startContent: jsx("span", { className: "text-default-400 text-sm", children: "#" }) })] }), (error || isInvalidFormat) && (jsx("p", { className: "text-tiny text-danger", children: isInvalidFormat ? t.invalidColorFormat : errorText }))] }), showPredefinedColors && predefinedColors.length > 0 && (jsxs("div", { children: [jsx("p", { className: "text-xs font-medium text-default-600 mb-2", children: t.predefinedColorsLabel }), jsx("div", { className: "flex flex-wrap gap-2", children: predefinedColors.map(function (color) {
|
|
776
775
|
return renderColorCircle(color.value, color.name, normalizeHexColor(value) === normalizeHexColor(color.value));
|
|
777
776
|
}) })] })), enableRecentColors && recentColors.length > 0 && (jsxs("div", { children: [jsx("p", { className: "text-xs font-medium text-default-600 mb-2", children: t.recentColorsLabel }), jsx("div", { className: "flex flex-wrap gap-2", children: recentColors.map(function (color) {
|
|
778
777
|
return renderColorCircle(color, color, normalizeHexColor(value) === color);
|
|
@@ -1701,6 +1700,189 @@ var HeaderComponent = function (_a) {
|
|
|
1701
1700
|
};
|
|
1702
1701
|
HeaderComponent.displayName = "Header";
|
|
1703
1702
|
|
|
1703
|
+
/**
|
|
1704
|
+
* KanbanCard - Contenedor de tarjeta genérico del Kanban con soporte drag and drop
|
|
1705
|
+
*
|
|
1706
|
+
* El contenido es 100% definido por el padre mediante renderContent.
|
|
1707
|
+
* Este componente solo provee el contenedor con estilos, eventos y drag.
|
|
1708
|
+
*/
|
|
1709
|
+
var KanbanCardComponent = function (_a) {
|
|
1710
|
+
var item = _a.item, columnId = _a.columnId, index = _a.index, renderContent = _a.renderContent, onCardClick = _a.onCardClick, className = _a.className, _b = _a.isClickable, isClickable = _b === void 0 ? true : _b, _c = _a.isDraggable, isDraggable = _c === void 0 ? false : _c, onDragStart = _a.onDragStart, onDragEnd = _a.onDragEnd;
|
|
1711
|
+
var _d = useState(false), isDragging = _d[0], setIsDragging = _d[1];
|
|
1712
|
+
var handleClick = useCallback(function () {
|
|
1713
|
+
if (!isDragging) {
|
|
1714
|
+
onCardClick === null || onCardClick === void 0 ? void 0 : onCardClick(item);
|
|
1715
|
+
}
|
|
1716
|
+
}, [item, onCardClick, isDragging]);
|
|
1717
|
+
var handleKeyDown = useCallback(function (e) {
|
|
1718
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1719
|
+
e.preventDefault();
|
|
1720
|
+
onCardClick === null || onCardClick === void 0 ? void 0 : onCardClick(item);
|
|
1721
|
+
}
|
|
1722
|
+
}, [item, onCardClick]);
|
|
1723
|
+
var handleDragStart = useCallback(function (e) {
|
|
1724
|
+
if (!isDraggable)
|
|
1725
|
+
return;
|
|
1726
|
+
setIsDragging(true);
|
|
1727
|
+
// Datos para el drop
|
|
1728
|
+
e.dataTransfer.setData("application/json", JSON.stringify({ itemId: item.id, fromColumnId: columnId, fromIndex: index }));
|
|
1729
|
+
e.dataTransfer.effectAllowed = "move";
|
|
1730
|
+
// Notificar al padre
|
|
1731
|
+
onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart(item, columnId, index);
|
|
1732
|
+
}, [item, columnId, index, isDraggable, onDragStart]);
|
|
1733
|
+
var handleDragEnd = useCallback(function () {
|
|
1734
|
+
setIsDragging(false);
|
|
1735
|
+
onDragEnd === null || onDragEnd === void 0 ? void 0 : onDragEnd();
|
|
1736
|
+
}, [onDragEnd]);
|
|
1737
|
+
var isInteractive = isClickable && onCardClick;
|
|
1738
|
+
return (jsx("div", { className: cn("bg-content1 border border-default-200 rounded-lg p-4 transition-all", isInteractive && "cursor-pointer hover:border-default-400", isDraggable && "cursor-grab active:cursor-grabbing", isDragging && "opacity-50 scale-95 shadow-lg", className), onClick: isInteractive ? handleClick : undefined, onKeyDown: isInteractive ? handleKeyDown : undefined, role: isInteractive ? "button" : undefined, tabIndex: isInteractive ? 0 : undefined, draggable: isDraggable, onDragStart: handleDragStart, onDragEnd: handleDragEnd, children: renderContent(item) }));
|
|
1739
|
+
};
|
|
1740
|
+
var KanbanCard = memo(KanbanCardComponent);
|
|
1741
|
+
KanbanCard.displayName = "KanbanCard";
|
|
1742
|
+
|
|
1743
|
+
/**
|
|
1744
|
+
* KanbanColumn - Columna individual del Kanban con soporte de drop
|
|
1745
|
+
*
|
|
1746
|
+
* Muestra un header con título y badge de conteo,
|
|
1747
|
+
* una lista scrolleable de tarjetas, y estado vacío.
|
|
1748
|
+
* Acepta drops de tarjetas de otras columnas.
|
|
1749
|
+
*/
|
|
1750
|
+
var KanbanColumnComponent = function (_a) {
|
|
1751
|
+
var _b, _c;
|
|
1752
|
+
var column = _a.column, renderItem = _a.renderItem, onCardClick = _a.onCardClick, cardClassName = _a.cardClassName, isCardClickable = _a.isCardClickable, className = _a.className, _d = _a.maxHeight, maxHeight = _d === void 0 ? "calc(100vh - 280px)" : _d, renderColumnHeader = _a.renderColumnHeader, renderEmptyState = _a.renderEmptyState, _e = _a.isDraggable, isDraggable = _e === void 0 ? false : _e, onDragStart = _a.onDragStart, onDragEnd = _a.onDragEnd, onDrop = _a.onDrop, _f = _a.isDragging, isDragging = _f === void 0 ? false : _f, _g = _a.translations, translations = _g === void 0 ? {} : _g;
|
|
1753
|
+
// Traducciones con fallbacks
|
|
1754
|
+
var t = {
|
|
1755
|
+
dropHere: (_b = translations.dropHere) !== null && _b !== void 0 ? _b : "Soltar aquí",
|
|
1756
|
+
emptyMessage: (_c = translations.emptyMessage) !== null && _c !== void 0 ? _c : "No hay elementos",
|
|
1757
|
+
};
|
|
1758
|
+
var _h = useState(false), isDragOver = _h[0], setIsDragOver = _h[1];
|
|
1759
|
+
var _j = useState(null), dropIndex = _j[0], setDropIndex = _j[1];
|
|
1760
|
+
var itemCount = column.items.length;
|
|
1761
|
+
var isEmpty = itemCount === 0;
|
|
1762
|
+
var handleDragOver = useCallback(function (e) {
|
|
1763
|
+
if (!isDraggable)
|
|
1764
|
+
return;
|
|
1765
|
+
e.preventDefault();
|
|
1766
|
+
e.dataTransfer.dropEffect = "move";
|
|
1767
|
+
setIsDragOver(true);
|
|
1768
|
+
}, [isDraggable]);
|
|
1769
|
+
var handleDragLeave = useCallback(function (e) {
|
|
1770
|
+
// Solo salir si realmente salimos de la columna (no de un hijo)
|
|
1771
|
+
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
1772
|
+
setIsDragOver(false);
|
|
1773
|
+
setDropIndex(null);
|
|
1774
|
+
}
|
|
1775
|
+
}, []);
|
|
1776
|
+
var handleDrop = useCallback(function (e) {
|
|
1777
|
+
e.preventDefault();
|
|
1778
|
+
setIsDragOver(false);
|
|
1779
|
+
setDropIndex(null);
|
|
1780
|
+
if (!isDraggable)
|
|
1781
|
+
return;
|
|
1782
|
+
// Calcular índice de drop basado en posición Y
|
|
1783
|
+
var finalDropIndex = dropIndex !== null && dropIndex !== void 0 ? dropIndex : column.items.length;
|
|
1784
|
+
onDrop === null || onDrop === void 0 ? void 0 : onDrop(column.id, finalDropIndex);
|
|
1785
|
+
}, [isDraggable, column.id, column.items.length, dropIndex, onDrop]);
|
|
1786
|
+
// Calcular índice de drop basado en la posición del mouse
|
|
1787
|
+
var handleDragOverItem = useCallback(function (e, itemIndex) {
|
|
1788
|
+
e.preventDefault();
|
|
1789
|
+
var rect = e.currentTarget.getBoundingClientRect();
|
|
1790
|
+
var midpoint = rect.top + rect.height / 2;
|
|
1791
|
+
var newDropIndex = e.clientY < midpoint ? itemIndex : itemIndex + 1;
|
|
1792
|
+
setDropIndex(newDropIndex);
|
|
1793
|
+
}, []);
|
|
1794
|
+
return (jsxs("div", { className: cn("flex flex-col bg-default-50 rounded-lg border border-default-200 transition-colors", isDragOver && isDragging && "border-primary-400 bg-primary-50/30", className), onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, children: [renderColumnHeader ? (renderColumnHeader(column)) : (jsxs("div", { className: "flex items-center justify-between px-4 py-3 border-b border-default-200", children: [jsx("h3", { className: "font-semibold text-foreground", children: column.title }), jsx(Badge, { content: itemCount, color: column.countBadgeColor || "default", variant: "flat", size: "md", classNames: {
|
|
1795
|
+
badge: "text-xs font-medium min-w-6 h-6",
|
|
1796
|
+
}, children: jsxs("span", { className: "sr-only", children: [itemCount, " items"] }) })] })), jsx("div", { className: cn("flex-1 overflow-y-auto p-3 space-y-3", isDragOver && isEmpty && "min-h-24"), style: { maxHeight: maxHeight }, children: isEmpty ? (isDragOver && isDragging ? (jsx("div", { className: "h-24 border-2 border-dashed border-primary-300 rounded-lg bg-primary-50/50 flex items-center justify-center", children: jsx("span", { className: "text-primary-500 text-sm", children: t.dropHere }) })) : renderEmptyState ? (renderEmptyState(column)) : (jsx("div", { className: "flex items-center justify-center h-24 text-default-400 text-sm", children: column.emptyMessage || t.emptyMessage }))) : (jsxs(Fragment, { children: [column.items.map(function (item, index) { return (jsxs("div", { onDragOver: function (e) { return handleDragOverItem(e, index); }, children: [isDragOver && dropIndex === index && (jsx("div", { className: "h-1 bg-primary-400 rounded-full mb-3 animate-pulse" })), jsx(KanbanCard, { item: item, columnId: column.id, index: index, renderContent: renderItem, onCardClick: onCardClick, className: cardClassName, isClickable: isCardClickable, isDraggable: isDraggable, onDragStart: onDragStart, onDragEnd: onDragEnd })] }, item.id)); }), isDragOver && dropIndex === column.items.length && (jsx("div", { className: "h-1 bg-primary-400 rounded-full mt-3 animate-pulse" }))] })) })] }));
|
|
1797
|
+
};
|
|
1798
|
+
var KanbanColumn = memo(KanbanColumnComponent);
|
|
1799
|
+
KanbanColumn.displayName = "KanbanColumn";
|
|
1800
|
+
|
|
1801
|
+
/**
|
|
1802
|
+
* Traducciones por defecto en español.
|
|
1803
|
+
* Se mezclan con las traducciones proporcionadas por el usuario.
|
|
1804
|
+
*/
|
|
1805
|
+
var DEFAULT_TRANSLATIONS = {
|
|
1806
|
+
dropHere: "Soltar aquí",
|
|
1807
|
+
emptyMessage: "No hay elementos",
|
|
1808
|
+
};
|
|
1809
|
+
var columnGapClasses = {
|
|
1810
|
+
sm: "gap-3",
|
|
1811
|
+
md: "gap-4",
|
|
1812
|
+
lg: "gap-6",
|
|
1813
|
+
};
|
|
1814
|
+
/**
|
|
1815
|
+
* Kanban - Tablero Kanban genérico con columnas, tarjetas y drag and drop
|
|
1816
|
+
*
|
|
1817
|
+
* El contenido de cada tarjeta es 100% definido por el consumidor
|
|
1818
|
+
* mediante la prop `renderItem`. Esto permite usar el Kanban para
|
|
1819
|
+
* cualquier caso de uso: contactos, tareas, proyectos, etc.
|
|
1820
|
+
*
|
|
1821
|
+
* Soporta drag and drop entre columnas con el callback `onItemMove`.
|
|
1822
|
+
*
|
|
1823
|
+
* @example
|
|
1824
|
+
* ```tsx
|
|
1825
|
+
* // Kanban de tareas con drag and drop
|
|
1826
|
+
* <Kanban<Task>
|
|
1827
|
+
* columns={columns}
|
|
1828
|
+
* renderItem={(item) => <TaskCard task={item.data} />}
|
|
1829
|
+
* onItemMove={(event) => {
|
|
1830
|
+
* console.log(`Moved ${event.item.id} from ${event.fromColumnId} to ${event.toColumnId}`);
|
|
1831
|
+
* // Actualizar estado...
|
|
1832
|
+
* }}
|
|
1833
|
+
* />
|
|
1834
|
+
* ```
|
|
1835
|
+
*/
|
|
1836
|
+
var KanbanComponent = function (_a) {
|
|
1837
|
+
var columns = _a.columns, renderItem = _a.renderItem, onCardClick = _a.onCardClick, onItemMove = _a.onItemMove, isDraggable = _a.isDraggable, cardClassName = _a.cardClassName, isCardClickable = _a.isCardClickable, className = _a.className, _b = _a.columnWidth, columnWidth = _b === void 0 ? "280px" : _b, _c = _a.columnGap, columnGap = _c === void 0 ? "md" : _c, _d = _a.horizontalScroll, horizontalScroll = _d === void 0 ? true : _d, columnMaxHeight = _a.columnMaxHeight, renderColumnHeader = _a.renderColumnHeader, renderEmptyState = _a.renderEmptyState, _e = _a.translations, translations = _e === void 0 ? {} : _e;
|
|
1838
|
+
// Mezclar traducciones del usuario con las por defecto
|
|
1839
|
+
var t = __assign(__assign({}, DEFAULT_TRANSLATIONS), translations);
|
|
1840
|
+
// Determinar si drag está habilitado
|
|
1841
|
+
var dragEnabled = isDraggable !== null && isDraggable !== void 0 ? isDraggable : !!onItemMove;
|
|
1842
|
+
// Estado del drag actual
|
|
1843
|
+
var _f = useState(false), isDragging = _f[0], setIsDragging = _f[1];
|
|
1844
|
+
var dragDataRef = useRef(null);
|
|
1845
|
+
// Cuando empieza el drag
|
|
1846
|
+
var handleDragStart = useCallback(function (item, columnId, index) {
|
|
1847
|
+
setIsDragging(true);
|
|
1848
|
+
dragDataRef.current = { item: item, fromColumnId: columnId, fromIndex: index };
|
|
1849
|
+
}, []);
|
|
1850
|
+
// Cuando termina el drag (sin drop válido)
|
|
1851
|
+
var handleDragEnd = useCallback(function () {
|
|
1852
|
+
setIsDragging(false);
|
|
1853
|
+
dragDataRef.current = null;
|
|
1854
|
+
}, []);
|
|
1855
|
+
// Cuando se suelta en una columna
|
|
1856
|
+
var handleDrop = useCallback(function (toColumnId, toIndex) {
|
|
1857
|
+
var dragData = dragDataRef.current;
|
|
1858
|
+
if (!dragData || !onItemMove)
|
|
1859
|
+
return;
|
|
1860
|
+
var item = dragData.item, fromColumnId = dragData.fromColumnId, fromIndex = dragData.fromIndex;
|
|
1861
|
+
// No hacer nada si se suelta en la misma posición
|
|
1862
|
+
if (fromColumnId === toColumnId && fromIndex === toIndex) {
|
|
1863
|
+
handleDragEnd();
|
|
1864
|
+
return;
|
|
1865
|
+
}
|
|
1866
|
+
// Ajustar índice si se mueve dentro de la misma columna hacia abajo
|
|
1867
|
+
var adjustedToIndex = toIndex;
|
|
1868
|
+
if (fromColumnId === toColumnId && fromIndex < toIndex) {
|
|
1869
|
+
adjustedToIndex = toIndex - 1;
|
|
1870
|
+
}
|
|
1871
|
+
// Notificar al padre
|
|
1872
|
+
onItemMove({
|
|
1873
|
+
item: item,
|
|
1874
|
+
fromColumnId: fromColumnId,
|
|
1875
|
+
toColumnId: toColumnId,
|
|
1876
|
+
fromIndex: fromIndex,
|
|
1877
|
+
toIndex: adjustedToIndex,
|
|
1878
|
+
});
|
|
1879
|
+
handleDragEnd();
|
|
1880
|
+
}, [onItemMove, handleDragEnd]);
|
|
1881
|
+
return (jsx("div", { className: cn("flex", columnGapClasses[columnGap], horizontalScroll && "overflow-x-auto pb-4", className), children: columns.map(function (column) { return (jsx("div", { className: "flex-shrink-0", style: { width: columnWidth }, children: jsx(KanbanColumn, { column: column, renderItem: renderItem, onCardClick: onCardClick, cardClassName: cardClassName, isCardClickable: isCardClickable, maxHeight: columnMaxHeight, renderColumnHeader: renderColumnHeader, renderEmptyState: renderEmptyState, isDraggable: dragEnabled, onDragStart: handleDragStart, onDragEnd: handleDragEnd, onDrop: handleDrop, isDragging: isDragging, translations: t }) }, column.id)); }) }));
|
|
1882
|
+
};
|
|
1883
|
+
var Kanban = memo(KanbanComponent);
|
|
1884
|
+
Kanban.displayName = "Kanban";
|
|
1885
|
+
|
|
1704
1886
|
var defaultTranslations$8 = {
|
|
1705
1887
|
previewAlt: "Vista previa de imagen",
|
|
1706
1888
|
removeButtonAriaLabel: "Eliminar imagen",
|
|
@@ -4953,4 +5135,4 @@ var NavigationLoadingProvider = function (_a) {
|
|
|
4953
5135
|
return (jsxs(NavigationLoadingContext.Provider, { value: value, children: [children, jsx(NavigationLoadingOverlay, { isVisible: isVisible })] }));
|
|
4954
5136
|
};
|
|
4955
5137
|
|
|
4956
|
-
export { AccordionList, AddHolidayForm, AnalyticsCard, AuraAutocomplete, AuraTable, AuraToastProvider, BreadcrumbsComponent, Button, Card, Chip, ColorPicker, ColorSelector, ContentCarousel, DEFAULT_PREDEFINED_COLORS, DatePicker, DateRangePicker, DateSelector, DrawerFilters, GlobalToast, H1, H2, H3, H4, HeaderComponent, HolidayType, IconComponent, ImagePreview, Input, MenuComponent, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, MultiStepWizard, NavigationLoadingContext, NavigationLoadingOverlay, NavigationLoadingProvider, P, Pagination, Phone, PromotionalBanner, RangeFilter, RowSteps, ScheduleRow, SearchInput, Select, SocialMediaBar, SocialMediaCarousel, SocialMediaPreview, StepIndicator, Switch as SwitchComponent, Textarea, ThemeContext, ThemePicker, ThemeProvider, TimeInput as TimeInputComponent, ToastContext, UploadFile, VerticalSteps, Wizard, WizardNavigation, WizardSidebar, defaultTranslations$4 as defaultTranslations, sizeMap, themeColors, useAuraToast, useNavigationLoading, useThemeContext };
|
|
5138
|
+
export { AccordionList, AddHolidayForm, AnalyticsCard, AuraAutocomplete, AuraTable, AuraToastProvider, BreadcrumbsComponent, Button, Card, Chip, ColorPicker, ColorSelector, ContentCarousel, DEFAULT_PREDEFINED_COLORS, DatePicker, DateRangePicker, DateSelector, DrawerFilters, GlobalToast, H1, H2, H3, H4, HeaderComponent, HolidayType, IconComponent, ImagePreview, Input, Kanban, KanbanCard, KanbanColumn, MenuComponent, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, MultiStepWizard, NavigationLoadingContext, NavigationLoadingOverlay, NavigationLoadingProvider, P, Pagination, Phone, PromotionalBanner, RangeFilter, RowSteps, ScheduleRow, SearchInput, Select, SocialMediaBar, SocialMediaCarousel, SocialMediaPreview, StepIndicator, Switch as SwitchComponent, Textarea, ThemeContext, ThemePicker, ThemeProvider, TimeInput as TimeInputComponent, ToastContext, UploadFile, VerticalSteps, Wizard, WizardNavigation, WizardSidebar, defaultTranslations$4 as defaultTranslations, sizeMap, themeColors, useAuraToast, useNavigationLoading, useThemeContext };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPicker.d.ts","sourceRoot":"","sources":["../../../../src/components/color-picker/ColorPicker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACX,gBAAgB,EAGhB,MAAM,qBAAqB,CAAC;AA4C7B;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"ColorPicker.d.ts","sourceRoot":"","sources":["../../../../src/components/color-picker/ColorPicker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EACX,gBAAgB,EAGhB,MAAM,qBAAqB,CAAC;AA4C7B;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAsPlD,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { KanbanProps } from "./Kanban.types";
|
|
2
|
+
/**
|
|
3
|
+
* Kanban - Tablero Kanban genérico con columnas, tarjetas y drag and drop
|
|
4
|
+
*
|
|
5
|
+
* El contenido de cada tarjeta es 100% definido por el consumidor
|
|
6
|
+
* mediante la prop `renderItem`. Esto permite usar el Kanban para
|
|
7
|
+
* cualquier caso de uso: contactos, tareas, proyectos, etc.
|
|
8
|
+
*
|
|
9
|
+
* Soporta drag and drop entre columnas con el callback `onItemMove`.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* // Kanban de tareas con drag and drop
|
|
14
|
+
* <Kanban<Task>
|
|
15
|
+
* columns={columns}
|
|
16
|
+
* renderItem={(item) => <TaskCard task={item.data} />}
|
|
17
|
+
* onItemMove={(event) => {
|
|
18
|
+
* console.log(`Moved ${event.item.id} from ${event.fromColumnId} to ${event.toColumnId}`);
|
|
19
|
+
* // Actualizar estado...
|
|
20
|
+
* }}
|
|
21
|
+
* />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare const KanbanComponent: <T>({ columns, renderItem, onCardClick, onItemMove, isDraggable, cardClassName, isCardClickable, className, columnWidth, columnGap, horizontalScroll, columnMaxHeight, renderColumnHeader, renderEmptyState, translations, }: KanbanProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare const Kanban: typeof KanbanComponent;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=Kanban.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Kanban.d.ts","sourceRoot":"","sources":["../../../../src/components/kanban/Kanban.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAc,WAAW,EAAsB,MAAM,gBAAgB,CAAC;AAkBlF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,QAAA,MAAM,eAAe,GAAI,CAAC,EAAG,0NAgB1B,WAAW,CAAC,CAAC,CAAC,4CAmGhB,CAAC;AAEF,eAAO,MAAM,MAAM,EAA4B,OAAO,eAAe,CAAC"}
|