@axzydev/axzy_ui_system 1.4.6 → 1.4.8
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 +439 -298
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.cts +118 -6
- package/dist/index.d.ts +118 -6
- package/dist/index.js +439 -298
- package/dist/index.js.map +1 -1
- package/dist/layered.css +1 -1
- package/package.json +1 -1
- package/src/components/molecules/line-bar-chart/line-bar-chart.tsx +24 -15
- package/src/components/molecules/table/table.doc.mdx +18 -1
- package/src/components/molecules/table/table.props.ts +10 -2
- package/src/components/molecules/table/table.tsx +135 -88
- package/src/components/organisms/data-table/ITDataTable.doc.mdx +18 -1
- package/src/components/organisms/data-table/dataTable.props.ts +3 -2
- package/src/components/organisms/data-table/dataTable.tsx +120 -58
- package/src/index.ts +2 -2
- package/src/showcases/DataShowcases.tsx +107 -2
- package/src/types/table.types.ts +110 -0
package/dist/index.cjs
CHANGED
|
@@ -4580,13 +4580,44 @@ function ITDataTable({
|
|
|
4580
4580
|
virtualizedMaxHeight = 400,
|
|
4581
4581
|
rowHeight,
|
|
4582
4582
|
overscan = 5,
|
|
4583
|
-
stickyHeader = false
|
|
4583
|
+
stickyHeader = false,
|
|
4584
|
+
showViewToggle = true,
|
|
4585
|
+
design,
|
|
4586
|
+
colors,
|
|
4587
|
+
containerStyle,
|
|
4588
|
+
cardClassName,
|
|
4589
|
+
cardStyle,
|
|
4590
|
+
toolbarClassName,
|
|
4591
|
+
toolbarStyle,
|
|
4592
|
+
headerClassName,
|
|
4593
|
+
headerStyle,
|
|
4594
|
+
headerCellClassName,
|
|
4595
|
+
headerCellStyle,
|
|
4596
|
+
rowClassName,
|
|
4597
|
+
rowStyle,
|
|
4598
|
+
cellClassName,
|
|
4599
|
+
cellStyle,
|
|
4600
|
+
cardsClassName,
|
|
4601
|
+
cardsStyle,
|
|
4602
|
+
footerClassName,
|
|
4603
|
+
footerStyle
|
|
4584
4604
|
}) {
|
|
4585
4605
|
const [viewMode, setViewMode] = (0, import_react22.useState)(defaultView || "table");
|
|
4586
4606
|
const { ref: rootRef, width: containerWidth } = useElementSize();
|
|
4587
4607
|
const [data, setData] = (0, import_react22.useState)([]);
|
|
4588
4608
|
const [totalItems, setTotalItems] = (0, import_react22.useState)(0);
|
|
4589
4609
|
const [isLoading, setIsLoading] = (0, import_react22.useState)(fetchOnMount);
|
|
4610
|
+
const colorVars = {
|
|
4611
|
+
...colors?.headerBg ? { "--color-table-headerBg": colors.headerBg } : {},
|
|
4612
|
+
...colors?.headerText ? { "--color-table-headerText": colors.headerText } : {},
|
|
4613
|
+
...colors?.rowBg ? { "--color-table-rowBg": colors.rowBg } : {},
|
|
4614
|
+
...colors?.rowText ? { "--color-table-rowText": colors.rowText } : {},
|
|
4615
|
+
...colors?.rowHover ? { "--color-table-rowHover": colors.rowHover } : {}
|
|
4616
|
+
};
|
|
4617
|
+
const mergeSlot = (slot, flatClassName, flatStyle) => ({
|
|
4618
|
+
className: (0, import_clsx23.default)(slot?.className, flatClassName),
|
|
4619
|
+
style: { ...slot?.style, ...flatStyle }
|
|
4620
|
+
});
|
|
4590
4621
|
const isFixed = layout === "fixed";
|
|
4591
4622
|
const forcedCards = autoCardBreakpoint > 0 && containerWidth > 0 && containerWidth < autoCardBreakpoint;
|
|
4592
4623
|
const effectiveView = forcedCards ? "cards" : viewMode;
|
|
@@ -4849,6 +4880,25 @@ function ITDataTable({
|
|
|
4849
4880
|
event.preventDefault();
|
|
4850
4881
|
onRowClick(row, event);
|
|
4851
4882
|
};
|
|
4883
|
+
const containerSlot = mergeSlot(design?.container, containerClassName, containerStyle);
|
|
4884
|
+
const cardSlot = mergeSlot(design?.card, cardClassName, cardStyle);
|
|
4885
|
+
const toolbarSlot = mergeSlot(design?.toolbar, toolbarClassName, toolbarStyle);
|
|
4886
|
+
const headerSlot = mergeSlot(design?.header, headerClassName, headerStyle);
|
|
4887
|
+
const headerCellSlot = mergeSlot(design?.headerCell, headerCellClassName, headerCellStyle);
|
|
4888
|
+
const rowSlot = mergeSlot(design?.row, rowClassName, rowStyle);
|
|
4889
|
+
const cellSlot = mergeSlot(design?.cell, cellClassName, cellStyle);
|
|
4890
|
+
const cardsSlot = mergeSlot(design?.cards, cardsClassName, cardsStyle);
|
|
4891
|
+
const footerSlot = mergeSlot(design?.footer, footerClassName, footerStyle);
|
|
4892
|
+
const viewToggle = /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center bg-slate-100 dark:bg-slate-800/80 rounded-lg p-0.5 border border-slate-200 dark:border-slate-700/50", children: [
|
|
4893
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("button", { onClick: () => setViewMode("table"), disabled: forcedCards, className: segCtrlClass("table"), children: [
|
|
4894
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_fa13.FaTable, { size: 11 }),
|
|
4895
|
+
"Table"
|
|
4896
|
+
] }),
|
|
4897
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("button", { onClick: () => setViewMode("cards"), className: segCtrlClass("cards"), children: [
|
|
4898
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_fa13.FaThLarge, { size: 11 }),
|
|
4899
|
+
"Cards"
|
|
4900
|
+
] })
|
|
4901
|
+
] });
|
|
4852
4902
|
const tableEl = /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
4853
4903
|
"table",
|
|
4854
4904
|
{
|
|
@@ -4874,7 +4924,8 @@ function ITDataTable({
|
|
|
4874
4924
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4875
4925
|
"tr",
|
|
4876
4926
|
{
|
|
4877
|
-
className: (0, import_clsx23.default)(tableHeaderRow, "dark:text-slate-200"),
|
|
4927
|
+
className: (0, import_clsx23.default)(tableHeaderRow, "dark:text-slate-200", headerSlot.className),
|
|
4928
|
+
style: headerSlot.style,
|
|
4878
4929
|
"aria-rowindex": isTableVirtual ? 1 : void 0,
|
|
4879
4930
|
children: columns.map((col) => {
|
|
4880
4931
|
const pin = pinnedMeta[col.key];
|
|
@@ -4889,13 +4940,17 @@ function ITDataTable({
|
|
|
4889
4940
|
isPinned && "sticky",
|
|
4890
4941
|
isStickyHeader && "sticky top-0 bg-secondary-50",
|
|
4891
4942
|
isPinned ? "z-[15]" : isStickyHeader && "z-10",
|
|
4892
|
-
isPinned && (col.pinned === "left" ? "it-table-pinned-left" : "it-table-pinned-right")
|
|
4943
|
+
isPinned && (col.pinned === "left" ? "it-table-pinned-left" : "it-table-pinned-right"),
|
|
4944
|
+
headerCellSlot.className,
|
|
4945
|
+
col.headerClassName
|
|
4893
4946
|
),
|
|
4894
|
-
style:
|
|
4947
|
+
style: {
|
|
4895
4948
|
...col.minWidth != null ? { minWidth: `${col.minWidth}px` } : {},
|
|
4896
4949
|
...isStickyHeader || isPinned ? { backgroundColor: "var(--color-table-headerBg, #f8fafc)" } : {},
|
|
4897
|
-
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {}
|
|
4898
|
-
|
|
4950
|
+
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {},
|
|
4951
|
+
...headerCellSlot.style,
|
|
4952
|
+
...col.headerStyle
|
|
4953
|
+
},
|
|
4899
4954
|
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: isFixed ? "flex flex-col gap-3" : "flex flex-col gap-3 min-w-[150px]", children: [
|
|
4900
4955
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
4901
4956
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ITText, { as: "span", className: "text-slate-900 dark:text-white font-bold", children: col.label }),
|
|
@@ -4929,8 +4984,10 @@ function ITDataTable({
|
|
|
4929
4984
|
className: (0, import_clsx23.default)(
|
|
4930
4985
|
tableRow,
|
|
4931
4986
|
variant === "striped" && absoluteIndex % 2 === 0 && "bg-secondary-50/40 dark:bg-slate-800/20",
|
|
4932
|
-
onRowClick && !isLoading && tableRowClickable
|
|
4987
|
+
onRowClick && !isLoading && tableRowClickable,
|
|
4988
|
+
rowSlot.className
|
|
4933
4989
|
),
|
|
4990
|
+
style: rowSlot.style,
|
|
4934
4991
|
tabIndex: onRowClick && !isLoading ? 0 : void 0,
|
|
4935
4992
|
onClick: onRowClick && !isLoading ? handleRowClick(row) : void 0,
|
|
4936
4993
|
onKeyDown: onRowClick && !isLoading ? handleRowKeyDown(row) : void 0,
|
|
@@ -4947,12 +5004,16 @@ function ITDataTable({
|
|
|
4947
5004
|
col.align && tableAlignClasses[col.align],
|
|
4948
5005
|
isPinned && "sticky bg-[var(--color-table-rowBg,white)] group-hover:bg-[var(--color-table-rowHover,var(--color-secondary-50))]",
|
|
4949
5006
|
isPinned && (col.pinned === "left" ? "it-table-pinned-left" : "it-table-pinned-right"),
|
|
4950
|
-
isPinned && "z-[1]"
|
|
5007
|
+
isPinned && "z-[1]",
|
|
5008
|
+
cellSlot.className,
|
|
5009
|
+
col.cellClassName
|
|
4951
5010
|
),
|
|
4952
|
-
style:
|
|
5011
|
+
style: {
|
|
4953
5012
|
...col.minWidth != null ? { minWidth: `${col.minWidth}px` } : {},
|
|
4954
|
-
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {}
|
|
4955
|
-
|
|
5013
|
+
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {},
|
|
5014
|
+
...cellSlot.style,
|
|
5015
|
+
...col.cellStyle
|
|
5016
|
+
},
|
|
4956
5017
|
title: truncateTitle,
|
|
4957
5018
|
children: col.type === "actions" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: tableActionsCell, children: renderCellContent(col, row) }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: (0, import_clsx23.default)(tableCellText, col.truncate && "truncate"), children: renderCellContent(col, row) })
|
|
4958
5019
|
},
|
|
@@ -4971,78 +5032,89 @@ function ITDataTable({
|
|
|
4971
5032
|
]
|
|
4972
5033
|
}
|
|
4973
5034
|
);
|
|
4974
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_fa13.FaTable, { size: 11 }),
|
|
4983
|
-
"Table"
|
|
4984
|
-
] }),
|
|
4985
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("button", { onClick: () => setViewMode("cards"), className: segCtrlClass("cards"), children: [
|
|
4986
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_fa13.FaThLarge, { size: 11 }),
|
|
4987
|
-
"Cards"
|
|
4988
|
-
] })
|
|
4989
|
-
] })
|
|
4990
|
-
] })
|
|
4991
|
-
] }),
|
|
4992
|
-
!title && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex justify-end px-4 pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center bg-slate-100 dark:bg-slate-800/80 rounded-lg p-0.5 border border-slate-200 dark:border-slate-700/50", children: [
|
|
4993
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("button", { onClick: () => setViewMode("table"), disabled: forcedCards, className: segCtrlClass("table"), children: [
|
|
4994
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_fa13.FaTable, { size: 11 }),
|
|
4995
|
-
"Table"
|
|
4996
|
-
] }),
|
|
4997
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("button", { onClick: () => setViewMode("cards"), className: segCtrlClass("cards"), children: [
|
|
4998
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_fa13.FaThLarge, { size: 11 }),
|
|
4999
|
-
"Cards"
|
|
5000
|
-
] })
|
|
5001
|
-
] }) }),
|
|
5002
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: scrollOuterClass, children: [
|
|
5003
|
-
isLoading && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "absolute inset-0 z-20 flex items-center justify-center bg-white/40 backdrop-blur-[2px] transition-all duration-300", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-col items-center gap-3 p-6 rounded-2xl shadow-xl border border-secondary-100 animate-in fade-in zoom-in duration-300", style: { backgroundColor: "var(--color-table-rowBg, #ffffff)" }, children: loadingIndicator || /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
5004
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_fa13.FaSpinner, { className: "animate-spin text-primary-500 text-4xl" }),
|
|
5005
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ITText, { as: "span", className: "text-sm font-semibold text-secondary-600 animate-pulse", children: "Cargando datos..." })
|
|
5006
|
-
] }) }) }),
|
|
5007
|
-
effectiveView === "cards" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "p-4 space-y-3 max-h-[400px] overflow-y-auto", children: data.length > 0 ? data.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
5036
|
+
"div",
|
|
5037
|
+
{
|
|
5038
|
+
ref: rootRef,
|
|
5039
|
+
className: (0, import_clsx23.default)("space-y-4 w-full relative", containerSlot.className),
|
|
5040
|
+
style: { ...colorVars, ...containerSlot.style },
|
|
5041
|
+
children: [
|
|
5042
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
5008
5043
|
"div",
|
|
5009
5044
|
{
|
|
5010
|
-
className: (0, import_clsx23.default)(
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5045
|
+
className: (0, import_clsx23.default)(tableContainer, cardSlot.className),
|
|
5046
|
+
style: { backgroundColor: "var(--color-table-rowBg, #ffffff)", ...cardSlot.style },
|
|
5047
|
+
children: [
|
|
5048
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
5049
|
+
"div",
|
|
5050
|
+
{
|
|
5051
|
+
className: (0, import_clsx23.default)("px-6 py-5 flex items-center justify-between", toolbarSlot.className),
|
|
5052
|
+
style: { backgroundColor: "var(--color-table-rowBg, #ffffff)", ...toolbarSlot.style },
|
|
5053
|
+
children: [
|
|
5054
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ITText, { as: "h2", className: "text-xl font-bold text-secondary-900 leading-tight", children: title }),
|
|
5055
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
5056
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "text-secondary-400", children: loadingIndicator || /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_fa13.FaSpinner, { className: "animate-spin text-primary-500 text-xl" }) }),
|
|
5057
|
+
showViewToggle && viewToggle
|
|
5058
|
+
] })
|
|
5059
|
+
]
|
|
5060
|
+
}
|
|
5061
|
+
),
|
|
5062
|
+
!title && showViewToggle && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: (0, import_clsx23.default)("flex justify-end px-4 pt-3", toolbarSlot.className), style: toolbarSlot.style, children: viewToggle }),
|
|
5063
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: scrollOuterClass, children: [
|
|
5064
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "absolute inset-0 z-20 flex items-center justify-center bg-white/40 backdrop-blur-[2px] transition-all duration-300", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-col items-center gap-3 p-6 rounded-2xl shadow-xl border border-secondary-100 animate-in fade-in zoom-in duration-300", style: { backgroundColor: "var(--color-table-rowBg, #ffffff)" }, children: loadingIndicator || /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
5065
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_fa13.FaSpinner, { className: "animate-spin text-primary-500 text-4xl" }),
|
|
5066
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ITText, { as: "span", className: "text-sm font-semibold text-secondary-600 animate-pulse", children: "Cargando datos..." })
|
|
5067
|
+
] }) }) }),
|
|
5068
|
+
effectiveView === "cards" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: (0, import_clsx23.default)("p-4 space-y-3 max-h-[400px] overflow-y-auto", cardsSlot.className), style: cardsSlot.style, children: data.length > 0 ? data.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5069
|
+
"div",
|
|
5070
|
+
{
|
|
5071
|
+
className: (0, import_clsx23.default)(tableCardHover, onRowClick && !isLoading && tableCardClickable),
|
|
5072
|
+
role: onRowClick && !isLoading ? "button" : void 0,
|
|
5073
|
+
tabIndex: onRowClick && !isLoading ? 0 : void 0,
|
|
5074
|
+
onClick: onRowClick && !isLoading ? handleRowClick(row) : void 0,
|
|
5075
|
+
onKeyDown: onRowClick && !isLoading ? handleRowKeyDown(row) : void 0,
|
|
5076
|
+
children: renderCard ? renderCard(row) : renderDefaultCard(row)
|
|
5077
|
+
},
|
|
5078
|
+
i
|
|
5079
|
+
)) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: (0, import_clsx23.default)(tableEmptyContent, "py-12"), children: [
|
|
5080
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ITText, { as: "span", className: "text-lg", children: "No se encontraron resultados" }),
|
|
5081
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ITText, { as: "span", className: "text-sm mt-1", children: "Intenta ajustar los filtros" })
|
|
5082
|
+
] }) }) : isTableVirtual ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5083
|
+
"div",
|
|
5084
|
+
{
|
|
5085
|
+
ref: scrollRef,
|
|
5086
|
+
className: "overflow-x-auto overflow-y-auto",
|
|
5087
|
+
style: { maxHeight: virtualizedMaxHeight },
|
|
5088
|
+
children: tableEl
|
|
5089
|
+
}
|
|
5090
|
+
) : tableEl
|
|
5091
|
+
] })
|
|
5092
|
+
]
|
|
5093
|
+
}
|
|
5094
|
+
),
|
|
5095
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5022
5096
|
"div",
|
|
5023
5097
|
{
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5098
|
+
className: (0, import_clsx23.default)("rounded-b-xl px-6 py-4", footerSlot.className),
|
|
5099
|
+
style: { backgroundColor: "var(--color-table-rowBg, #ffffff)", ...footerSlot.style },
|
|
5100
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5101
|
+
ITPagination,
|
|
5102
|
+
{
|
|
5103
|
+
currentPage,
|
|
5104
|
+
totalPages: computedTotalPages,
|
|
5105
|
+
onPageChange: goToPage,
|
|
5106
|
+
color: "primary",
|
|
5107
|
+
itemsPerPageOptions,
|
|
5108
|
+
itemsPerPage,
|
|
5109
|
+
onItemsPerPageChange: handleItemsPerPageChange,
|
|
5110
|
+
totalItems
|
|
5111
|
+
}
|
|
5112
|
+
)
|
|
5028
5113
|
}
|
|
5029
|
-
)
|
|
5030
|
-
]
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
ITPagination,
|
|
5034
|
-
{
|
|
5035
|
-
currentPage,
|
|
5036
|
-
totalPages: computedTotalPages,
|
|
5037
|
-
onPageChange: goToPage,
|
|
5038
|
-
color: "primary",
|
|
5039
|
-
itemsPerPageOptions,
|
|
5040
|
-
itemsPerPage,
|
|
5041
|
-
onItemsPerPageChange: handleItemsPerPageChange,
|
|
5042
|
-
totalItems
|
|
5043
|
-
}
|
|
5044
|
-
) })
|
|
5045
|
-
] });
|
|
5114
|
+
)
|
|
5115
|
+
]
|
|
5116
|
+
}
|
|
5117
|
+
);
|
|
5046
5118
|
}
|
|
5047
5119
|
|
|
5048
5120
|
// src/components/organisms/dialog/dialog.tsx
|
|
@@ -8354,7 +8426,12 @@ function ITLineBarChart({
|
|
|
8354
8426
|
const linePoints = data.map((d, i) => `${x(i)},${y(d.line)}`).join(" ");
|
|
8355
8427
|
const areaPath = data.length > 0 ? `M ${x(0)} ${y(data[0].line)} ` + data.slice(1).map((d, i) => `L ${x(i + 1)} ${y(d.line)}`).join(" ") + ` L ${x(data.length - 1)} ${padding.top + plotHeight} L ${x(0)} ${padding.top + plotHeight} Z` : "";
|
|
8356
8428
|
const active = hover !== null ? data[hover] : null;
|
|
8357
|
-
|
|
8429
|
+
const tooltipLeft = (() => {
|
|
8430
|
+
if (hover === null) return 0;
|
|
8431
|
+
const center = x(hover) / width * 100;
|
|
8432
|
+
return Math.min(Math.max(center, 12), 88);
|
|
8433
|
+
})();
|
|
8434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: `relative flex flex-col gap-3 ${className}`.trim(), children: [
|
|
8358
8435
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
8359
8436
|
"svg",
|
|
8360
8437
|
{
|
|
@@ -8423,20 +8500,27 @@ function ITLineBarChart({
|
|
|
8423
8500
|
data.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("g", { onMouseEnter: () => setHover(i), children: [
|
|
8424
8501
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("rect", { x: padding.left + step * i, y: padding.top, width: step, height: plotHeight, fill: "transparent" }),
|
|
8425
8502
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("text", { x: x(i), y: height - 8, textAnchor: "middle", fontSize: 10, fill: "#64748b", children: d.label })
|
|
8426
|
-
] }, `hit-${d.label}`))
|
|
8427
|
-
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
|
|
8435
|
-
|
|
8436
|
-
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
|
|
8503
|
+
] }, `hit-${d.label}`))
|
|
8504
|
+
]
|
|
8505
|
+
}
|
|
8506
|
+
),
|
|
8507
|
+
active && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
8508
|
+
"div",
|
|
8509
|
+
{
|
|
8510
|
+
className: "pointer-events-none absolute z-10 -translate-x-1/2 rounded-lg px-2.5 py-1.5 shadow-lg",
|
|
8511
|
+
style: { left: `${tooltipLeft}%`, top: 4, background: "#0f172a", opacity: 0.94, minWidth: 132 },
|
|
8512
|
+
role: "status",
|
|
8513
|
+
children: [
|
|
8514
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: "text-[10px] font-semibold", style: { color: "#e2e8f0" }, children: active.label }),
|
|
8515
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("p", { className: "text-[11px] tabular-nums", style: { color: lineColor }, children: [
|
|
8516
|
+
lineLabel,
|
|
8517
|
+
": ",
|
|
8518
|
+
formatValue(active.line)
|
|
8519
|
+
] }),
|
|
8520
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("p", { className: "text-[11px] tabular-nums", style: { color: "#93c5fd" }, children: [
|
|
8521
|
+
barLabel,
|
|
8522
|
+
": ",
|
|
8523
|
+
formatValue(active.bar)
|
|
8440
8524
|
] })
|
|
8441
8525
|
]
|
|
8442
8526
|
}
|
|
@@ -8483,10 +8567,41 @@ function ITTable({
|
|
|
8483
8567
|
virtualizedMaxHeight = 400,
|
|
8484
8568
|
rowHeight,
|
|
8485
8569
|
overscan = 5,
|
|
8486
|
-
stickyHeader = false
|
|
8570
|
+
stickyHeader = false,
|
|
8571
|
+
showViewToggle = true,
|
|
8572
|
+
design,
|
|
8573
|
+
colors,
|
|
8574
|
+
containerStyle,
|
|
8575
|
+
cardClassName,
|
|
8576
|
+
cardStyle,
|
|
8577
|
+
toolbarClassName,
|
|
8578
|
+
toolbarStyle,
|
|
8579
|
+
headerClassName,
|
|
8580
|
+
headerStyle,
|
|
8581
|
+
headerCellClassName,
|
|
8582
|
+
headerCellStyle,
|
|
8583
|
+
rowClassName,
|
|
8584
|
+
rowStyle,
|
|
8585
|
+
cellClassName,
|
|
8586
|
+
cellStyle,
|
|
8587
|
+
cardsClassName,
|
|
8588
|
+
cardsStyle,
|
|
8589
|
+
footerClassName,
|
|
8590
|
+
footerStyle
|
|
8487
8591
|
}) {
|
|
8488
8592
|
const [viewMode, setViewMode] = (0, import_react38.useState)(defaultView);
|
|
8489
8593
|
const { ref: rootRef, width: containerWidth } = useElementSize();
|
|
8594
|
+
const colorVars = {
|
|
8595
|
+
...colors?.headerBg ? { "--color-table-headerBg": colors.headerBg } : {},
|
|
8596
|
+
...colors?.headerText ? { "--color-table-headerText": colors.headerText } : {},
|
|
8597
|
+
...colors?.rowBg ? { "--color-table-rowBg": colors.rowBg } : {},
|
|
8598
|
+
...colors?.rowText ? { "--color-table-rowText": colors.rowText } : {},
|
|
8599
|
+
...colors?.rowHover ? { "--color-table-rowHover": colors.rowHover } : {}
|
|
8600
|
+
};
|
|
8601
|
+
const mergeSlot = (slot, flatClassName, flatStyle) => ({
|
|
8602
|
+
className: (0, import_clsx44.default)(slot?.className, flatClassName),
|
|
8603
|
+
style: { ...slot?.style, ...flatStyle }
|
|
8604
|
+
});
|
|
8490
8605
|
const isFixed = layout === "fixed";
|
|
8491
8606
|
const forcedCards = autoCardBreakpoint > 0 && containerWidth > 0 && containerWidth < autoCardBreakpoint;
|
|
8492
8607
|
const effectiveView = forcedCards ? "cards" : viewMode;
|
|
@@ -8818,215 +8933,241 @@ function ITTable({
|
|
|
8818
8933
|
event.preventDefault();
|
|
8819
8934
|
onRowClick(row, event);
|
|
8820
8935
|
};
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
"Table"
|
|
8834
|
-
]
|
|
8835
|
-
}
|
|
8836
|
-
),
|
|
8837
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
8838
|
-
"button",
|
|
8839
|
-
{
|
|
8840
|
-
onClick: () => setViewMode("cards"),
|
|
8841
|
-
className: `flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-semibold transition-all ${effectiveView === "cards" ? "bg-white dark:bg-slate-900 text-slate-900 dark:text-white shadow-sm border border-slate-200/50 dark:border-slate-700" : "text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-200"}`,
|
|
8842
|
-
children: [
|
|
8843
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_fa27.FaThLarge, { size: 11 }),
|
|
8844
|
-
"Cards"
|
|
8845
|
-
]
|
|
8846
|
-
}
|
|
8847
|
-
)
|
|
8848
|
-
] })
|
|
8849
|
-
] }),
|
|
8850
|
-
!title && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "flex justify-end px-4 pt-3", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex items-center bg-slate-100 dark:bg-slate-800/80 rounded-lg p-0.5 border border-slate-200 dark:border-slate-700/50", children: [
|
|
8851
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
8852
|
-
"button",
|
|
8853
|
-
{
|
|
8854
|
-
onClick: () => setViewMode("table"),
|
|
8855
|
-
disabled: forcedCards,
|
|
8856
|
-
className: `flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-semibold transition-all ${effectiveView === "table" ? "bg-white dark:bg-slate-900 text-slate-900 dark:text-white shadow-sm border border-slate-200/50 dark:border-slate-700" : "text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-200"}`,
|
|
8857
|
-
children: [
|
|
8858
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_fa27.FaTable, { size: 11 }),
|
|
8859
|
-
"Table"
|
|
8860
|
-
]
|
|
8861
|
-
}
|
|
8862
|
-
),
|
|
8863
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
8864
|
-
"button",
|
|
8865
|
-
{
|
|
8866
|
-
onClick: () => setViewMode("cards"),
|
|
8867
|
-
className: `flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-semibold transition-all ${effectiveView === "cards" ? "bg-white dark:bg-slate-900 text-slate-900 dark:text-white shadow-sm border border-slate-200/50 dark:border-slate-700" : "text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-200"}`,
|
|
8868
|
-
children: [
|
|
8869
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_fa27.FaThLarge, { size: 11 }),
|
|
8870
|
-
"Cards"
|
|
8871
|
-
]
|
|
8872
|
-
}
|
|
8873
|
-
)
|
|
8874
|
-
] }) }),
|
|
8875
|
-
effectiveView === "cards" ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "p-4 space-y-3 max-h-[400px] overflow-y-auto", children: currentData.length > 0 ? currentData.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
8876
|
-
"div",
|
|
8877
|
-
{
|
|
8878
|
-
className: (0, import_clsx44.default)(tableCardHover, onRowClick && tableCardClickable),
|
|
8879
|
-
role: onRowClick ? "button" : void 0,
|
|
8880
|
-
tabIndex: onRowClick ? 0 : void 0,
|
|
8881
|
-
onClick: onRowClick ? handleRowClick(row) : void 0,
|
|
8882
|
-
onKeyDown: onRowClick ? handleRowKeyDown(row) : void 0,
|
|
8883
|
-
children: renderCard ? renderCard(row) : renderDefaultCard(row)
|
|
8884
|
-
},
|
|
8885
|
-
i
|
|
8886
|
-
)) : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: (0, import_clsx44.default)(tableEmptyContent, "py-12"), children: [
|
|
8887
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ITText, { as: "span", className: "text-lg", children: "No se encontraron resultados" }),
|
|
8888
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ITText, { as: "span", className: "text-sm mt-1", children: "Intenta ajustar los filtros" })
|
|
8889
|
-
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
8890
|
-
"div",
|
|
8936
|
+
const containerSlot = mergeSlot(design?.container, containerClassName, containerStyle);
|
|
8937
|
+
const cardSlot = mergeSlot(design?.card, cardClassName, cardStyle);
|
|
8938
|
+
const toolbarSlot = mergeSlot(design?.toolbar, toolbarClassName, toolbarStyle);
|
|
8939
|
+
const headerSlot = mergeSlot(design?.header, headerClassName, headerStyle);
|
|
8940
|
+
const headerCellSlot = mergeSlot(design?.headerCell, headerCellClassName, headerCellStyle);
|
|
8941
|
+
const rowSlot = mergeSlot(design?.row, rowClassName, rowStyle);
|
|
8942
|
+
const cellSlot = mergeSlot(design?.cell, cellClassName, cellStyle);
|
|
8943
|
+
const cardsSlot = mergeSlot(design?.cards, cardsClassName, cardsStyle);
|
|
8944
|
+
const footerSlot = mergeSlot(design?.footer, footerClassName, footerStyle);
|
|
8945
|
+
const viewToggle = /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex items-center bg-slate-100 dark:bg-slate-800/80 rounded-lg p-0.5 border border-slate-200 dark:border-slate-700/50", children: [
|
|
8946
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
8947
|
+
"button",
|
|
8891
8948
|
{
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8895
|
-
children:
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
tableLayoutClass,
|
|
8900
|
-
showVerticalBorder && "[&_th]:border-r [&_th:last-child]:border-r-0 [&_td]:border-r [&_td:last-child]:border-r-0",
|
|
8901
|
-
showVerticalBorder && (verticalBorderClassname || "[&_th]:border-slate-100 dark:[&_th]:border-slate-700/30 [&_td]:border-slate-100 dark:[&_td]:border-slate-700/30"),
|
|
8902
|
-
variantStyles[variant],
|
|
8903
|
-
sizeStyles[size]
|
|
8904
|
-
),
|
|
8905
|
-
style: isFixed ? { tableLayout: "fixed" } : void 0,
|
|
8906
|
-
"aria-rowcount": isTableVirtual ? currentData.length + 1 : void 0,
|
|
8907
|
-
children: [
|
|
8908
|
-
hasColumnWidths && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("colgroup", { children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
8909
|
-
"col",
|
|
8910
|
-
{
|
|
8911
|
-
style: col.width != null ? { width: typeof col.width === "number" ? `${col.width}px` : col.width } : void 0
|
|
8912
|
-
},
|
|
8913
|
-
col.key
|
|
8914
|
-
)) }),
|
|
8915
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
8916
|
-
"tr",
|
|
8917
|
-
{
|
|
8918
|
-
className: (0, import_clsx44.default)(tableHeaderRow, "dark:text-slate-200"),
|
|
8919
|
-
"aria-rowindex": isTableVirtual ? 1 : void 0,
|
|
8920
|
-
children: columns.map((col) => {
|
|
8921
|
-
const pin = pinnedMeta[col.key];
|
|
8922
|
-
const isPinned = pin != null;
|
|
8923
|
-
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
8924
|
-
"th",
|
|
8925
|
-
{
|
|
8926
|
-
scope: "col",
|
|
8927
|
-
className: (0, import_clsx44.default)(
|
|
8928
|
-
tableHeaderCell(col.className, density),
|
|
8929
|
-
col.align && tableAlignClasses[col.align],
|
|
8930
|
-
isPinned && "sticky",
|
|
8931
|
-
isStickyHeader && "sticky top-0 bg-secondary-50",
|
|
8932
|
-
isPinned ? "z-[15]" : isStickyHeader && "z-10",
|
|
8933
|
-
isPinned && (col.pinned === "left" ? "it-table-pinned-left" : "it-table-pinned-right")
|
|
8934
|
-
),
|
|
8935
|
-
style: col.minWidth != null || isStickyHeader || isPinned ? {
|
|
8936
|
-
...col.minWidth != null ? { minWidth: `${col.minWidth}px` } : {},
|
|
8937
|
-
...isStickyHeader || isPinned ? { backgroundColor: "var(--color-table-headerBg, #f8fafc)" } : {},
|
|
8938
|
-
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {}
|
|
8939
|
-
} : void 0,
|
|
8940
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: isFixed ? "flex flex-col gap-3" : "flex flex-col gap-3 min-w-[150px]", children: [
|
|
8941
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
8942
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ITText, { as: "span", className: "text-slate-900 dark:text-white font-bold", children: col.label }),
|
|
8943
|
-
col.sortable && col.type !== "actions" && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
8944
|
-
"button",
|
|
8945
|
-
{
|
|
8946
|
-
onClick: () => handleSort(col.key),
|
|
8947
|
-
className: `p-1 rounded-md transition-colors ${sortConfig?.key === col.key ? "bg-secondary-200 text-secondary-900" : "hover:bg-secondary-200 text-secondary-400 hover:text-secondary-700"}`,
|
|
8948
|
-
title: `Ordenar por ${col.label}`,
|
|
8949
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_md2.MdOutlineSwapVert, { className: "w-4 h-4", "aria-hidden": "true" })
|
|
8950
|
-
}
|
|
8951
|
-
)
|
|
8952
|
-
] }),
|
|
8953
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "w-full", children: col.filter ? renderFilterInput(col) : null })
|
|
8954
|
-
] })
|
|
8955
|
-
},
|
|
8956
|
-
col.key
|
|
8957
|
-
);
|
|
8958
|
-
})
|
|
8959
|
-
}
|
|
8960
|
-
) }),
|
|
8961
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("tbody", { className: (0, import_clsx44.default)(tableBody, "dark:divide-slate-700/30"), children: currentData.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
8962
|
-
isTableVirtual && topSpacerHeight > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("tr", { "aria-hidden": "true", style: { height: topSpacerHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("td", { colSpan: columnCount, style: { padding: 0, border: 0 } }) }),
|
|
8963
|
-
windowData.map((row, windowIndex) => {
|
|
8964
|
-
const absoluteIndex = isTableVirtual ? startIndex + windowIndex : windowIndex;
|
|
8965
|
-
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
8966
|
-
"tr",
|
|
8967
|
-
{
|
|
8968
|
-
"aria-rowindex": isTableVirtual ? absoluteIndex + 2 : void 0,
|
|
8969
|
-
className: (0, import_clsx44.default)(
|
|
8970
|
-
tableRow,
|
|
8971
|
-
variant === "striped" && absoluteIndex % 2 === 0 && "bg-secondary-50/40 dark:bg-slate-800/20",
|
|
8972
|
-
onRowClick && tableRowClickable
|
|
8973
|
-
),
|
|
8974
|
-
tabIndex: onRowClick ? 0 : void 0,
|
|
8975
|
-
onClick: onRowClick ? handleRowClick(row) : void 0,
|
|
8976
|
-
onKeyDown: onRowClick ? handleRowKeyDown(row) : void 0,
|
|
8977
|
-
children: columns.map((col) => {
|
|
8978
|
-
const rawValue = getNestedValue(row, col.key);
|
|
8979
|
-
const truncateTitle = col.truncate && (typeof rawValue === "string" || typeof rawValue === "number") ? String(rawValue) : void 0;
|
|
8980
|
-
const pin = pinnedMeta[col.key];
|
|
8981
|
-
const isPinned = pin != null;
|
|
8982
|
-
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
8983
|
-
"td",
|
|
8984
|
-
{
|
|
8985
|
-
className: (0, import_clsx44.default)(
|
|
8986
|
-
tableCell(col.className, density),
|
|
8987
|
-
col.align && tableAlignClasses[col.align],
|
|
8988
|
-
isPinned && "sticky bg-[var(--color-table-rowBg,white)] group-hover:bg-[var(--color-table-rowHover,var(--color-secondary-50))]",
|
|
8989
|
-
isPinned && (col.pinned === "left" ? "it-table-pinned-left" : "it-table-pinned-right"),
|
|
8990
|
-
isPinned && "z-[1]"
|
|
8991
|
-
),
|
|
8992
|
-
style: col.minWidth != null || isPinned ? {
|
|
8993
|
-
...col.minWidth != null ? { minWidth: `${col.minWidth}px` } : {},
|
|
8994
|
-
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {}
|
|
8995
|
-
} : void 0,
|
|
8996
|
-
title: truncateTitle,
|
|
8997
|
-
children: col.type === "actions" ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: tableActionsCell, children: renderCellContent(col, row) }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: (0, import_clsx44.default)(tableCellText, col.truncate && "truncate"), children: renderCellContent(col, row) })
|
|
8998
|
-
},
|
|
8999
|
-
`${absoluteIndex}-${col.key}`
|
|
9000
|
-
);
|
|
9001
|
-
})
|
|
9002
|
-
},
|
|
9003
|
-
absoluteIndex
|
|
9004
|
-
);
|
|
9005
|
-
}),
|
|
9006
|
-
isTableVirtual && bottomSpacerHeight > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("tr", { "aria-hidden": "true", style: { height: bottomSpacerHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("td", { colSpan: columnCount, style: { padding: 0, border: 0 } }) })
|
|
9007
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("td", { colSpan: columns.length, className: "px-6 py-12 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: tableEmptyContent, children: [
|
|
9008
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ITText, { as: "span", className: "text-lg", children: "No se encontraron resultados" }),
|
|
9009
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ITText, { as: "span", className: "text-sm mt-1", children: "Intenta ajustar los filtros" })
|
|
9010
|
-
] }) }) }) })
|
|
9011
|
-
]
|
|
9012
|
-
}
|
|
9013
|
-
)
|
|
8949
|
+
onClick: () => setViewMode("table"),
|
|
8950
|
+
disabled: forcedCards,
|
|
8951
|
+
className: `flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-semibold transition-all ${effectiveView === "table" ? "bg-white dark:bg-slate-900 text-slate-900 dark:text-white shadow-sm border border-slate-200/50 dark:border-slate-700" : "text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-200"}`,
|
|
8952
|
+
children: [
|
|
8953
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_fa27.FaTable, { size: 11 }),
|
|
8954
|
+
"Table"
|
|
8955
|
+
]
|
|
9014
8956
|
}
|
|
9015
8957
|
),
|
|
9016
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.
|
|
9017
|
-
|
|
8958
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
8959
|
+
"button",
|
|
9018
8960
|
{
|
|
9019
|
-
|
|
9020
|
-
|
|
9021
|
-
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
onItemsPerPageChange: handleItemsPerPageChange,
|
|
9026
|
-
totalItems: filteredData.length
|
|
8961
|
+
onClick: () => setViewMode("cards"),
|
|
8962
|
+
className: `flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-semibold transition-all ${effectiveView === "cards" ? "bg-white dark:bg-slate-900 text-slate-900 dark:text-white shadow-sm border border-slate-200/50 dark:border-slate-700" : "text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-200"}`,
|
|
8963
|
+
children: [
|
|
8964
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_fa27.FaThLarge, { size: 11 }),
|
|
8965
|
+
"Cards"
|
|
8966
|
+
]
|
|
9027
8967
|
}
|
|
9028
|
-
)
|
|
9029
|
-
] })
|
|
8968
|
+
)
|
|
8969
|
+
] });
|
|
8970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
8971
|
+
"div",
|
|
8972
|
+
{
|
|
8973
|
+
ref: rootRef,
|
|
8974
|
+
className: (0, import_clsx44.default)("space-y-4 w-full", containerSlot.className),
|
|
8975
|
+
style: { ...colorVars, ...containerSlot.style },
|
|
8976
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
8977
|
+
"div",
|
|
8978
|
+
{
|
|
8979
|
+
className: (0, import_clsx44.default)(tableContainer, cardSlot.className),
|
|
8980
|
+
style: { backgroundColor: "var(--color-table-rowBg, #ffffff)", ...cardSlot.style },
|
|
8981
|
+
children: [
|
|
8982
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
8983
|
+
"div",
|
|
8984
|
+
{
|
|
8985
|
+
className: (0, import_clsx44.default)("px-6 py-5 flex items-center justify-between", toolbarSlot.className),
|
|
8986
|
+
style: { backgroundColor: "var(--color-table-rowBg, #ffffff)", ...toolbarSlot.style },
|
|
8987
|
+
children: [
|
|
8988
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ITText, { as: "h2", className: "text-xl font-bold text-secondary-900 leading-tight", children: title }),
|
|
8989
|
+
showViewToggle && viewToggle
|
|
8990
|
+
]
|
|
8991
|
+
}
|
|
8992
|
+
),
|
|
8993
|
+
!title && showViewToggle && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: (0, import_clsx44.default)("flex justify-end px-4 pt-3", toolbarSlot.className), style: toolbarSlot.style, children: viewToggle }),
|
|
8994
|
+
effectiveView === "cards" ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: (0, import_clsx44.default)("p-4 space-y-3 max-h-[400px] overflow-y-auto", cardsSlot.className), style: cardsSlot.style, children: currentData.length > 0 ? currentData.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
8995
|
+
"div",
|
|
8996
|
+
{
|
|
8997
|
+
className: (0, import_clsx44.default)(tableCardHover, onRowClick && tableCardClickable),
|
|
8998
|
+
role: onRowClick ? "button" : void 0,
|
|
8999
|
+
tabIndex: onRowClick ? 0 : void 0,
|
|
9000
|
+
onClick: onRowClick ? handleRowClick(row) : void 0,
|
|
9001
|
+
onKeyDown: onRowClick ? handleRowKeyDown(row) : void 0,
|
|
9002
|
+
children: renderCard ? renderCard(row) : renderDefaultCard(row)
|
|
9003
|
+
},
|
|
9004
|
+
i
|
|
9005
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: (0, import_clsx44.default)(tableEmptyContent, "py-12"), children: [
|
|
9006
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ITText, { as: "span", className: "text-lg", children: "No se encontraron resultados" }),
|
|
9007
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ITText, { as: "span", className: "text-sm mt-1", children: "Intenta ajustar los filtros" })
|
|
9008
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
9009
|
+
"div",
|
|
9010
|
+
{
|
|
9011
|
+
ref: isTableVirtual ? scrollRef : void 0,
|
|
9012
|
+
className: isTableVirtual ? "overflow-x-auto overflow-y-auto" : "overflow-x-auto",
|
|
9013
|
+
style: isTableVirtual ? { maxHeight: virtualizedMaxHeight } : void 0,
|
|
9014
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
9015
|
+
"table",
|
|
9016
|
+
{
|
|
9017
|
+
className: (0, import_clsx44.default)(
|
|
9018
|
+
tableLayoutClass,
|
|
9019
|
+
showVerticalBorder && "[&_th]:border-r [&_th:last-child]:border-r-0 [&_td]:border-r [&_td:last-child]:border-r-0",
|
|
9020
|
+
showVerticalBorder && (verticalBorderClassname || "[&_th]:border-slate-100 dark:[&_th]:border-slate-700/30 [&_td]:border-slate-100 dark:[&_td]:border-slate-700/30"),
|
|
9021
|
+
variantStyles[variant],
|
|
9022
|
+
sizeStyles[size]
|
|
9023
|
+
),
|
|
9024
|
+
style: isFixed ? { tableLayout: "fixed" } : void 0,
|
|
9025
|
+
"aria-rowcount": isTableVirtual ? currentData.length + 1 : void 0,
|
|
9026
|
+
children: [
|
|
9027
|
+
hasColumnWidths && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("colgroup", { children: columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
9028
|
+
"col",
|
|
9029
|
+
{
|
|
9030
|
+
style: col.width != null ? { width: typeof col.width === "number" ? `${col.width}px` : col.width } : void 0
|
|
9031
|
+
},
|
|
9032
|
+
col.key
|
|
9033
|
+
)) }),
|
|
9034
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
9035
|
+
"tr",
|
|
9036
|
+
{
|
|
9037
|
+
className: (0, import_clsx44.default)(tableHeaderRow, "dark:text-slate-200", headerSlot.className),
|
|
9038
|
+
style: headerSlot.style,
|
|
9039
|
+
"aria-rowindex": isTableVirtual ? 1 : void 0,
|
|
9040
|
+
children: columns.map((col) => {
|
|
9041
|
+
const pin = pinnedMeta[col.key];
|
|
9042
|
+
const isPinned = pin != null;
|
|
9043
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
9044
|
+
"th",
|
|
9045
|
+
{
|
|
9046
|
+
scope: "col",
|
|
9047
|
+
className: (0, import_clsx44.default)(
|
|
9048
|
+
tableHeaderCell(col.className, density),
|
|
9049
|
+
col.align && tableAlignClasses[col.align],
|
|
9050
|
+
isPinned && "sticky",
|
|
9051
|
+
isStickyHeader && "sticky top-0 bg-secondary-50",
|
|
9052
|
+
isPinned ? "z-[15]" : isStickyHeader && "z-10",
|
|
9053
|
+
isPinned && (col.pinned === "left" ? "it-table-pinned-left" : "it-table-pinned-right"),
|
|
9054
|
+
headerCellSlot.className,
|
|
9055
|
+
col.headerClassName
|
|
9056
|
+
),
|
|
9057
|
+
style: {
|
|
9058
|
+
...col.minWidth != null ? { minWidth: `${col.minWidth}px` } : {},
|
|
9059
|
+
...isStickyHeader || isPinned ? { backgroundColor: "var(--color-table-headerBg, #f8fafc)" } : {},
|
|
9060
|
+
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {},
|
|
9061
|
+
...headerCellSlot.style,
|
|
9062
|
+
...col.headerStyle
|
|
9063
|
+
},
|
|
9064
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: isFixed ? "flex flex-col gap-3" : "flex flex-col gap-3 min-w-[150px]", children: [
|
|
9065
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
9066
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ITText, { as: "span", className: "text-slate-900 dark:text-white font-bold", children: col.label }),
|
|
9067
|
+
col.sortable && col.type !== "actions" && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
9068
|
+
"button",
|
|
9069
|
+
{
|
|
9070
|
+
onClick: () => handleSort(col.key),
|
|
9071
|
+
className: `p-1 rounded-md transition-colors ${sortConfig?.key === col.key ? "bg-secondary-200 text-secondary-900" : "hover:bg-secondary-200 text-secondary-400 hover:text-secondary-700"}`,
|
|
9072
|
+
title: `Ordenar por ${col.label}`,
|
|
9073
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_md2.MdOutlineSwapVert, { className: "w-4 h-4", "aria-hidden": "true" })
|
|
9074
|
+
}
|
|
9075
|
+
)
|
|
9076
|
+
] }),
|
|
9077
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "w-full", children: col.filter ? renderFilterInput(col) : null })
|
|
9078
|
+
] })
|
|
9079
|
+
},
|
|
9080
|
+
col.key
|
|
9081
|
+
);
|
|
9082
|
+
})
|
|
9083
|
+
}
|
|
9084
|
+
) }),
|
|
9085
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("tbody", { className: (0, import_clsx44.default)(tableBody, "dark:divide-slate-700/30"), children: currentData.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
9086
|
+
isTableVirtual && topSpacerHeight > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("tr", { "aria-hidden": "true", style: { height: topSpacerHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("td", { colSpan: columnCount, style: { padding: 0, border: 0 } }) }),
|
|
9087
|
+
windowData.map((row, windowIndex) => {
|
|
9088
|
+
const absoluteIndex = isTableVirtual ? startIndex + windowIndex : windowIndex;
|
|
9089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
9090
|
+
"tr",
|
|
9091
|
+
{
|
|
9092
|
+
"aria-rowindex": isTableVirtual ? absoluteIndex + 2 : void 0,
|
|
9093
|
+
className: (0, import_clsx44.default)(
|
|
9094
|
+
tableRow,
|
|
9095
|
+
variant === "striped" && absoluteIndex % 2 === 0 && "bg-secondary-50/40 dark:bg-slate-800/20",
|
|
9096
|
+
onRowClick && tableRowClickable,
|
|
9097
|
+
rowSlot.className
|
|
9098
|
+
),
|
|
9099
|
+
style: rowSlot.style,
|
|
9100
|
+
tabIndex: onRowClick ? 0 : void 0,
|
|
9101
|
+
onClick: onRowClick ? handleRowClick(row) : void 0,
|
|
9102
|
+
onKeyDown: onRowClick ? handleRowKeyDown(row) : void 0,
|
|
9103
|
+
children: columns.map((col) => {
|
|
9104
|
+
const rawValue = getNestedValue(row, col.key);
|
|
9105
|
+
const truncateTitle = col.truncate && (typeof rawValue === "string" || typeof rawValue === "number") ? String(rawValue) : void 0;
|
|
9106
|
+
const pin = pinnedMeta[col.key];
|
|
9107
|
+
const isPinned = pin != null;
|
|
9108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
9109
|
+
"td",
|
|
9110
|
+
{
|
|
9111
|
+
className: (0, import_clsx44.default)(
|
|
9112
|
+
tableCell(col.className, density),
|
|
9113
|
+
col.align && tableAlignClasses[col.align],
|
|
9114
|
+
isPinned && "sticky bg-[var(--color-table-rowBg,white)] group-hover:bg-[var(--color-table-rowHover,var(--color-secondary-50))]",
|
|
9115
|
+
isPinned && (col.pinned === "left" ? "it-table-pinned-left" : "it-table-pinned-right"),
|
|
9116
|
+
isPinned && "z-[1]",
|
|
9117
|
+
cellSlot.className,
|
|
9118
|
+
col.cellClassName
|
|
9119
|
+
),
|
|
9120
|
+
style: {
|
|
9121
|
+
...col.minWidth != null ? { minWidth: `${col.minWidth}px` } : {},
|
|
9122
|
+
...isPinned ? pin.side === "left" ? { left: pin.offset } : { right: pin.offset } : {},
|
|
9123
|
+
...cellSlot.style,
|
|
9124
|
+
...col.cellStyle
|
|
9125
|
+
},
|
|
9126
|
+
title: truncateTitle,
|
|
9127
|
+
children: col.type === "actions" ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: tableActionsCell, children: renderCellContent(col, row) }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: (0, import_clsx44.default)(tableCellText, col.truncate && "truncate"), children: renderCellContent(col, row) })
|
|
9128
|
+
},
|
|
9129
|
+
`${absoluteIndex}-${col.key}`
|
|
9130
|
+
);
|
|
9131
|
+
})
|
|
9132
|
+
},
|
|
9133
|
+
absoluteIndex
|
|
9134
|
+
);
|
|
9135
|
+
}),
|
|
9136
|
+
isTableVirtual && bottomSpacerHeight > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("tr", { "aria-hidden": "true", style: { height: bottomSpacerHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("td", { colSpan: columnCount, style: { padding: 0, border: 0 } }) })
|
|
9137
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("td", { colSpan: columns.length, className: "px-6 py-12 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: tableEmptyContent, children: [
|
|
9138
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ITText, { as: "span", className: "text-lg", children: "No se encontraron resultados" }),
|
|
9139
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ITText, { as: "span", className: "text-sm mt-1", children: "Intenta ajustar los filtros" })
|
|
9140
|
+
] }) }) }) })
|
|
9141
|
+
]
|
|
9142
|
+
}
|
|
9143
|
+
)
|
|
9144
|
+
}
|
|
9145
|
+
),
|
|
9146
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
9147
|
+
"div",
|
|
9148
|
+
{
|
|
9149
|
+
className: (0, import_clsx44.default)("rounded-b-xl px-6 py-4", footerSlot.className),
|
|
9150
|
+
style: { backgroundColor: "var(--color-table-rowBg, #ffffff)", ...footerSlot.style },
|
|
9151
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
9152
|
+
ITPagination,
|
|
9153
|
+
{
|
|
9154
|
+
currentPage,
|
|
9155
|
+
totalPages: computedTotalPages,
|
|
9156
|
+
onPageChange: goToPage,
|
|
9157
|
+
color: "primary",
|
|
9158
|
+
itemsPerPageOptions,
|
|
9159
|
+
itemsPerPage,
|
|
9160
|
+
onItemsPerPageChange: handleItemsPerPageChange,
|
|
9161
|
+
totalItems: filteredData.length
|
|
9162
|
+
}
|
|
9163
|
+
)
|
|
9164
|
+
}
|
|
9165
|
+
)
|
|
9166
|
+
]
|
|
9167
|
+
}
|
|
9168
|
+
)
|
|
9169
|
+
}
|
|
9170
|
+
);
|
|
9030
9171
|
}
|
|
9031
9172
|
|
|
9032
9173
|
// src/components/atoms/textarea/textarea.tsx
|