shadcn-ui-react 0.5.1 → 0.5.3
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 +252 -162
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +255 -169
- package/dist/style.css +115 -29
- package/package.json +11 -11
package/dist/index.cjs
CHANGED
|
@@ -7860,16 +7860,18 @@ Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
|
7860
7860
|
// src/components/table.tsx
|
|
7861
7861
|
var React59 = __toESM(require("react"), 1);
|
|
7862
7862
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
7863
|
-
var Table = React59.forwardRef(
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
"
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
});
|
|
7863
|
+
var Table = React59.forwardRef(
|
|
7864
|
+
(_a, ref) => {
|
|
7865
|
+
var _b = _a, { className, containerClassName } = _b, props = __objRest(_b, ["className", "containerClassName"]);
|
|
7866
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: cn("relative w-full overflow-auto", containerClassName), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7867
|
+
"table",
|
|
7868
|
+
__spreadValues({
|
|
7869
|
+
ref,
|
|
7870
|
+
className: cn("w-full caption-bottom text-sm", className)
|
|
7871
|
+
}, props)
|
|
7872
|
+
) });
|
|
7873
|
+
}
|
|
7874
|
+
);
|
|
7873
7875
|
Table.displayName = "Table";
|
|
7874
7876
|
var TableHeader = React59.forwardRef((_a, ref) => {
|
|
7875
7877
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
@@ -7922,7 +7924,7 @@ var TableHead = React59.forwardRef((_a, ref) => {
|
|
|
7922
7924
|
__spreadValues({
|
|
7923
7925
|
ref,
|
|
7924
7926
|
className: cn(
|
|
7925
|
-
"h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [
|
|
7927
|
+
"h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 *:[[role=checkbox]]:translate-y-0.5",
|
|
7926
7928
|
className
|
|
7927
7929
|
)
|
|
7928
7930
|
}, props)
|
|
@@ -7936,7 +7938,7 @@ var TableCell = React59.forwardRef((_a, ref) => {
|
|
|
7936
7938
|
__spreadValues({
|
|
7937
7939
|
ref,
|
|
7938
7940
|
className: cn(
|
|
7939
|
-
"p-2 align-middle [&:has([role=checkbox])]:pr-0 [
|
|
7941
|
+
"p-2 align-middle [&:has([role=checkbox])]:pr-0 *:[[role=checkbox]]:translate-y-0.5",
|
|
7940
7942
|
className
|
|
7941
7943
|
)
|
|
7942
7944
|
}, props)
|
|
@@ -8389,7 +8391,8 @@ function Breadcrumbs({ items, className, classNameList }) {
|
|
|
8389
8391
|
}
|
|
8390
8392
|
|
|
8391
8393
|
// src/shared/data-table.tsx
|
|
8392
|
-
var import_react36 =
|
|
8394
|
+
var import_react36 = require("react");
|
|
8395
|
+
var import_framer_motion2 = require("framer-motion");
|
|
8393
8396
|
var import_react_icons18 = require("@radix-ui/react-icons");
|
|
8394
8397
|
var import_react_table = require("@tanstack/react-table");
|
|
8395
8398
|
var import_lucide_react6 = require("lucide-react");
|
|
@@ -8416,165 +8419,252 @@ function DataTable({
|
|
|
8416
8419
|
tableClassName,
|
|
8417
8420
|
onPageChange,
|
|
8418
8421
|
onClick,
|
|
8419
|
-
onPageSizeChange
|
|
8422
|
+
onPageSizeChange,
|
|
8423
|
+
animate = true,
|
|
8424
|
+
stickyHeader = true,
|
|
8425
|
+
heightClassName = "h-[clamp(22rem,80vh,44rem)] supports-[height:100dvh]:h-[clamp(22rem,80dvh,44rem)]"
|
|
8420
8426
|
}) {
|
|
8421
|
-
const
|
|
8422
|
-
|
|
8423
|
-
|
|
8424
|
-
|
|
8427
|
+
const safePageCount = Math.max(pageCount != null ? pageCount : 1, 1);
|
|
8428
|
+
const pageIndex = Math.min(Math.max(page - 1, 0), safePageCount - 1);
|
|
8429
|
+
const pageSize = Math.max(perPage, 1);
|
|
8430
|
+
const paginationState = (0, import_react36.useMemo)(
|
|
8431
|
+
() => ({ pageIndex, pageSize }),
|
|
8432
|
+
[pageIndex, pageSize]
|
|
8433
|
+
);
|
|
8425
8434
|
const table = (0, import_react_table.useReactTable)({
|
|
8426
8435
|
data,
|
|
8427
8436
|
columns,
|
|
8428
|
-
pageCount,
|
|
8437
|
+
pageCount: safePageCount,
|
|
8438
|
+
state: { pagination: paginationState },
|
|
8429
8439
|
getCoreRowModel: (0, import_react_table.getCoreRowModel)(),
|
|
8430
8440
|
getFilteredRowModel: (0, import_react_table.getFilteredRowModel)(),
|
|
8431
|
-
state: { pagination },
|
|
8432
|
-
onPaginationChange: setPagination,
|
|
8433
|
-
getPaginationRowModel: (0, import_react_table.getPaginationRowModel)(),
|
|
8434
8441
|
manualPagination: true,
|
|
8435
|
-
manualFiltering: true
|
|
8442
|
+
manualFiltering: true,
|
|
8443
|
+
autoResetAll: false,
|
|
8444
|
+
autoResetPageIndex: false
|
|
8436
8445
|
});
|
|
8437
|
-
const
|
|
8438
|
-
|
|
8439
|
-
|
|
8440
|
-
|
|
8446
|
+
const clickable = !!onClick;
|
|
8447
|
+
const pageKey = (0, import_react36.useMemo)(
|
|
8448
|
+
() => `${pageIndex}-${pageSize}-${data.length}`,
|
|
8449
|
+
[pageIndex, pageSize, data.length]
|
|
8450
|
+
);
|
|
8451
|
+
const goToPage = (nextPageIndex) => {
|
|
8452
|
+
const clamped = Math.min(Math.max(nextPageIndex, 0), safePageCount - 1);
|
|
8453
|
+
if (clamped === pageIndex) return;
|
|
8454
|
+
onPageChange == null ? void 0 : onPageChange(clamped + 1);
|
|
8441
8455
|
};
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
|
|
8459
|
-
className: rowClassName,
|
|
8460
|
-
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TableCell, { className: cellClassName, children: (0, import_react_table.flexRender)(
|
|
8461
|
-
cell.column.columnDef.cell,
|
|
8462
|
-
cell.getContext()
|
|
8463
|
-
) }, cell.id))
|
|
8464
|
-
},
|
|
8465
|
-
row.id
|
|
8466
|
-
)) : emptyData || /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8467
|
-
TableCell,
|
|
8468
|
-
{
|
|
8469
|
-
colSpan: columns.length,
|
|
8470
|
-
className: "h-24 text-center",
|
|
8471
|
-
children: "No results."
|
|
8472
|
-
}
|
|
8473
|
-
) }) })
|
|
8474
|
-
] }),
|
|
8475
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ScrollBar, { orientation: "horizontal" })
|
|
8476
|
-
] }),
|
|
8477
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "border-t px-4 py-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between", children: [
|
|
8478
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-1 flex-wrap items-center gap-2", children: [
|
|
8479
|
-
isRowsSelected && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "text-muted-foreground text-sm", children: [
|
|
8480
|
-
table.getFilteredSelectedRowModel().rows.length,
|
|
8481
|
-
" ",
|
|
8482
|
-
ofLabel,
|
|
8483
|
-
" ",
|
|
8484
|
-
table.getFilteredRowModel().rows.length,
|
|
8485
|
-
" ",
|
|
8486
|
-
rowsSelectedLabel
|
|
8487
|
-
] }),
|
|
8488
|
-
totalRows ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "text-sm text-muted-foreground", children: [
|
|
8489
|
-
"Total: ",
|
|
8490
|
-
totalRows,
|
|
8491
|
-
" registros"
|
|
8492
|
-
] }) : null
|
|
8493
|
-
] }),
|
|
8494
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-end", children: [
|
|
8495
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
8496
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-sm font-medium whitespace-nowrap", children: rowPerPageLabel }),
|
|
8456
|
+
const changePageSize = (newSize) => {
|
|
8457
|
+
const size = Math.max(Number(newSize) || 1, 1);
|
|
8458
|
+
if (size === pageSize) return;
|
|
8459
|
+
onPageSizeChange == null ? void 0 : onPageSizeChange(size);
|
|
8460
|
+
onPageChange == null ? void 0 : onPageChange(1);
|
|
8461
|
+
};
|
|
8462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
8463
|
+
"div",
|
|
8464
|
+
{
|
|
8465
|
+
className: cn(
|
|
8466
|
+
"relative w-full overflow-hidden rounded-xl border bg-background/60 backdrop-blur supports-backdrop-filter:bg-background/40 shadow-sm",
|
|
8467
|
+
"flex flex-col",
|
|
8468
|
+
heightClassName,
|
|
8469
|
+
className
|
|
8470
|
+
),
|
|
8471
|
+
children: [
|
|
8472
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(ScrollArea, { className: "h-full", children: [
|
|
8497
8473
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
8498
|
-
|
|
8474
|
+
Table,
|
|
8499
8475
|
{
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
const newSize = Number(value);
|
|
8503
|
-
setPagination(__spreadProps(__spreadValues({}, pagination), {
|
|
8504
|
-
pageSize: newSize,
|
|
8505
|
-
pageIndex: 0
|
|
8506
|
-
}));
|
|
8507
|
-
if (onPageSizeChange) onPageSizeChange(newSize);
|
|
8508
|
-
},
|
|
8476
|
+
containerClassName: "overflow-visible",
|
|
8477
|
+
className: cn("w-full", tableClassName),
|
|
8509
8478
|
children: [
|
|
8510
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8511
|
-
|
|
8479
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8480
|
+
TableHeader,
|
|
8481
|
+
{
|
|
8482
|
+
className: cn(
|
|
8483
|
+
stickyHeader ? "sticky top-0 z-10 bg-background/80 backdrop-blur border-b" : "",
|
|
8484
|
+
headerClassName
|
|
8485
|
+
),
|
|
8486
|
+
children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8487
|
+
TableRow,
|
|
8488
|
+
{
|
|
8489
|
+
className: cn("hover:bg-transparent", rowClassName),
|
|
8490
|
+
children: headerGroup.headers.map((header) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8491
|
+
TableHead,
|
|
8492
|
+
{
|
|
8493
|
+
className: cn("whitespace-nowrap", headerClassName),
|
|
8494
|
+
children: header.isPlaceholder ? null : (0, import_react_table.flexRender)(
|
|
8495
|
+
header.column.columnDef.header,
|
|
8496
|
+
header.getContext()
|
|
8497
|
+
)
|
|
8498
|
+
},
|
|
8499
|
+
header.id
|
|
8500
|
+
))
|
|
8501
|
+
},
|
|
8502
|
+
headerGroup.id
|
|
8503
|
+
))
|
|
8504
|
+
}
|
|
8505
|
+
),
|
|
8506
|
+
animate ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_framer_motion2.AnimatePresence, { mode: "wait", initial: false, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8507
|
+
import_framer_motion2.motion.tbody,
|
|
8508
|
+
{
|
|
8509
|
+
className: cn("[&_tr:last-child]:border-0", bodyClassName),
|
|
8510
|
+
initial: { opacity: 0, y: 6 },
|
|
8511
|
+
animate: { opacity: 1, y: 0 },
|
|
8512
|
+
exit: { opacity: 0, y: -6 },
|
|
8513
|
+
transition: { duration: 0.18 },
|
|
8514
|
+
children: table.getRowModel().rows.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8515
|
+
TableRow,
|
|
8516
|
+
{
|
|
8517
|
+
"data-state": row.getIsSelected() ? "selected" : void 0,
|
|
8518
|
+
onClick: () => onClick == null ? void 0 : onClick(row.original),
|
|
8519
|
+
className: cn(
|
|
8520
|
+
rowClassName,
|
|
8521
|
+
clickable ? "cursor-pointer hover:bg-muted/60 active:bg-muted/80" : ""
|
|
8522
|
+
),
|
|
8523
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TableCell, { className: cellClassName, children: (0, import_react_table.flexRender)(
|
|
8524
|
+
cell.column.columnDef.cell,
|
|
8525
|
+
cell.getContext()
|
|
8526
|
+
) }, cell.id))
|
|
8527
|
+
},
|
|
8528
|
+
row.id
|
|
8529
|
+
)) : emptyData || /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8530
|
+
TableCell,
|
|
8531
|
+
{
|
|
8532
|
+
colSpan: columns.length,
|
|
8533
|
+
className: "h-28 text-center text-muted-foreground",
|
|
8534
|
+
children: "No results."
|
|
8535
|
+
}
|
|
8536
|
+
) })
|
|
8537
|
+
},
|
|
8538
|
+
pageKey
|
|
8539
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TableBody, { className: bodyClassName, children: table.getRowModel().rows.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8540
|
+
TableRow,
|
|
8541
|
+
{
|
|
8542
|
+
"data-state": row.getIsSelected() ? "selected" : void 0,
|
|
8543
|
+
onClick: () => onClick == null ? void 0 : onClick(row.original),
|
|
8544
|
+
className: cn(
|
|
8545
|
+
rowClassName,
|
|
8546
|
+
clickable ? "cursor-pointer hover:bg-muted/60 active:bg-muted/80" : ""
|
|
8547
|
+
),
|
|
8548
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TableCell, { className: cn(cellClassName), children: (0, import_react_table.flexRender)(
|
|
8549
|
+
cell.column.columnDef.cell,
|
|
8550
|
+
cell.getContext()
|
|
8551
|
+
) }, cell.id))
|
|
8552
|
+
},
|
|
8553
|
+
row.id
|
|
8554
|
+
)) : emptyData || /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8555
|
+
TableCell,
|
|
8556
|
+
{
|
|
8557
|
+
colSpan: columns.length,
|
|
8558
|
+
className: "h-28 text-center text-muted-foreground",
|
|
8559
|
+
children: "No results."
|
|
8560
|
+
}
|
|
8561
|
+
) }) })
|
|
8512
8562
|
]
|
|
8513
8563
|
}
|
|
8514
|
-
)
|
|
8515
|
-
] }),
|
|
8516
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
8517
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex w-[110px] items-center justify-center text-sm font-medium", children: [
|
|
8518
|
-
pageLabel,
|
|
8519
|
-
" ",
|
|
8520
|
-
pagination.pageIndex + 1,
|
|
8521
|
-
" ",
|
|
8522
|
-
ofLabel,
|
|
8523
|
-
" ",
|
|
8524
|
-
pageCount
|
|
8525
|
-
] }),
|
|
8526
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8527
|
-
Button,
|
|
8528
|
-
{
|
|
8529
|
-
"aria-label": "Go to first page",
|
|
8530
|
-
variant: "outline",
|
|
8531
|
-
className: "hidden h-8 w-8 p-0 lg:flex",
|
|
8532
|
-
onClick: () => setPagination(__spreadProps(__spreadValues({}, pagination), { pageIndex: 0 })),
|
|
8533
|
-
disabled: pagination.pageIndex === 0,
|
|
8534
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_icons18.DoubleArrowLeftIcon, { className: "h-4 w-4" })
|
|
8535
|
-
}
|
|
8536
|
-
),
|
|
8537
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8538
|
-
Button,
|
|
8539
|
-
{
|
|
8540
|
-
"aria-label": "Go to previous page",
|
|
8541
|
-
variant: "outline",
|
|
8542
|
-
className: "h-8 w-8 p-0",
|
|
8543
|
-
onClick: () => setPagination(__spreadProps(__spreadValues({}, pagination), {
|
|
8544
|
-
pageIndex: pagination.pageIndex - 1
|
|
8545
|
-
})),
|
|
8546
|
-
disabled: pagination.pageIndex === 0,
|
|
8547
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react6.ChevronLeftIcon, { className: "h-4 w-4" })
|
|
8548
|
-
}
|
|
8549
8564
|
),
|
|
8550
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
"
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8565
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ScrollBar, { orientation: "horizontal" })
|
|
8566
|
+
] }) }),
|
|
8567
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "border-t bg-background/70 backdrop-blur supports-backdrop-filter:bg-background/50", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "px-4 py-3", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-[1fr_auto] sm:items-center", children: [
|
|
8568
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1", children: [
|
|
8569
|
+
isRowsSelected && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "text-muted-foreground text-sm", children: [
|
|
8570
|
+
table.getFilteredSelectedRowModel().rows.length,
|
|
8571
|
+
" ",
|
|
8572
|
+
ofLabel,
|
|
8573
|
+
" ",
|
|
8574
|
+
table.getFilteredRowModel().rows.length,
|
|
8575
|
+
" ",
|
|
8576
|
+
rowsSelectedLabel
|
|
8577
|
+
] }),
|
|
8578
|
+
typeof totalRows === "number" && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "text-sm text-muted-foreground", children: [
|
|
8579
|
+
"Total: ",
|
|
8580
|
+
totalRows,
|
|
8581
|
+
" registros"
|
|
8582
|
+
] })
|
|
8583
|
+
] }),
|
|
8584
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-3 sm:justify-end", children: [
|
|
8585
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
8586
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-sm font-medium whitespace-nowrap", children: rowPerPageLabel }),
|
|
8587
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
8588
|
+
Select2,
|
|
8589
|
+
{
|
|
8590
|
+
value: `${pageSize}`,
|
|
8591
|
+
onValueChange: (value) => changePageSize(Number(value)),
|
|
8592
|
+
children: [
|
|
8593
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectTrigger, { className: "h-8 w-21", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectValue, { placeholder: pageSize }) }),
|
|
8594
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectContent, { side: "top", children: pageSizeOptions.map((size) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectItem, { value: `${size}`, children: size }, size)) })
|
|
8595
|
+
]
|
|
8596
|
+
}
|
|
8597
|
+
)
|
|
8598
|
+
] }),
|
|
8599
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
8600
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "hidden sm:flex min-w-35 items-center justify-center text-sm font-medium", children: [
|
|
8601
|
+
pageLabel,
|
|
8602
|
+
" ",
|
|
8603
|
+
pageIndex + 1,
|
|
8604
|
+
" ",
|
|
8605
|
+
ofLabel,
|
|
8606
|
+
" ",
|
|
8607
|
+
safePageCount
|
|
8608
|
+
] }),
|
|
8609
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8610
|
+
Button,
|
|
8611
|
+
{
|
|
8612
|
+
"aria-label": "Go to first page",
|
|
8613
|
+
variant: "outline",
|
|
8614
|
+
className: "hidden h-8 w-8 p-0 lg:flex",
|
|
8615
|
+
onClick: () => goToPage(0),
|
|
8616
|
+
disabled: pageIndex === 0,
|
|
8617
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_icons18.DoubleArrowLeftIcon, { className: "h-4 w-4" })
|
|
8618
|
+
}
|
|
8619
|
+
),
|
|
8620
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8621
|
+
Button,
|
|
8622
|
+
{
|
|
8623
|
+
"aria-label": "Go to previous page",
|
|
8624
|
+
variant: "outline",
|
|
8625
|
+
className: "h-8 w-8 p-0",
|
|
8626
|
+
onClick: () => goToPage(pageIndex - 1),
|
|
8627
|
+
disabled: pageIndex === 0,
|
|
8628
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react6.ChevronLeftIcon, { className: "h-4 w-4" })
|
|
8629
|
+
}
|
|
8630
|
+
),
|
|
8631
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8632
|
+
Button,
|
|
8633
|
+
{
|
|
8634
|
+
"aria-label": "Go to next page",
|
|
8635
|
+
variant: "outline",
|
|
8636
|
+
className: "h-8 w-8 p-0",
|
|
8637
|
+
onClick: () => goToPage(pageIndex + 1),
|
|
8638
|
+
disabled: pageIndex + 1 >= safePageCount,
|
|
8639
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react6.ChevronRightIcon, { className: "h-4 w-4" })
|
|
8640
|
+
}
|
|
8641
|
+
),
|
|
8642
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8643
|
+
Button,
|
|
8644
|
+
{
|
|
8645
|
+
"aria-label": "Go to last page",
|
|
8646
|
+
variant: "outline",
|
|
8647
|
+
className: "hidden h-8 w-8 p-0 lg:flex",
|
|
8648
|
+
onClick: () => goToPage(safePageCount - 1),
|
|
8649
|
+
disabled: pageIndex + 1 >= safePageCount,
|
|
8650
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_icons18.DoubleArrowRightIcon, { className: "h-4 w-4" })
|
|
8651
|
+
}
|
|
8652
|
+
)
|
|
8653
|
+
] }),
|
|
8654
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "sm:hidden w-full text-center text-xs text-muted-foreground", children: [
|
|
8655
|
+
pageLabel,
|
|
8656
|
+
" ",
|
|
8657
|
+
pageIndex + 1,
|
|
8658
|
+
" ",
|
|
8659
|
+
ofLabel,
|
|
8660
|
+
" ",
|
|
8661
|
+
safePageCount
|
|
8662
|
+
] })
|
|
8663
|
+
] })
|
|
8664
|
+
] }) }) })
|
|
8665
|
+
]
|
|
8666
|
+
}
|
|
8667
|
+
);
|
|
8578
8668
|
}
|
|
8579
8669
|
|
|
8580
8670
|
// src/shared/data-table-skeleton.tsx
|
|
@@ -8589,10 +8679,10 @@ function DataTableSkeleton({
|
|
|
8589
8679
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "w-full space-y-3 overflow-auto", children: [
|
|
8590
8680
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex w-full items-center justify-between space-x-2 overflow-auto p-1", children: [
|
|
8591
8681
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-1 items-center space-x-2 space-y-4", children: [
|
|
8592
|
-
searchableColumnCount > 0 ? Array.from({ length: searchableColumnCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Skeleton, { className: "h-10 w-
|
|
8593
|
-
filterableColumnCount > 0 ? Array.from({ length: filterableColumnCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Skeleton, { className: "h-10 w-
|
|
8682
|
+
searchableColumnCount > 0 ? Array.from({ length: searchableColumnCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Skeleton, { className: "h-10 w-37.5 lg:w-62.5" }, i)) : null,
|
|
8683
|
+
filterableColumnCount > 0 ? Array.from({ length: filterableColumnCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Skeleton, { className: "h-10 w-17.5 border-dashed" }, i)) : null
|
|
8594
8684
|
] }),
|
|
8595
|
-
showViewOptions ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Skeleton, { className: "ml-auto hidden h-7 w-
|
|
8685
|
+
showViewOptions ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Skeleton, { className: "ml-auto hidden h-7 w-17.5 lg:flex" }) : null
|
|
8596
8686
|
] }),
|
|
8597
8687
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "rounded-md border", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(Table, { children: [
|
|
8598
8688
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TableHeader, { children: Array.from({ length: 1 }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TableRow, { className: "hover:bg-transparent", children: Array.from({ length: columnCount }).map((_2, i2) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Skeleton, { className: "h-6 w-full" }) }, i2)) }, i)) }),
|
|
@@ -8603,9 +8693,9 @@ function DataTableSkeleton({
|
|
|
8603
8693
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-col items-center gap-4 sm:flex-row sm:gap-6 lg:gap-8", children: [
|
|
8604
8694
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center space-x-2", children: [
|
|
8605
8695
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Skeleton, { className: "h-8 w-24" }),
|
|
8606
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Skeleton, { className: "h-8 w-
|
|
8696
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Skeleton, { className: "h-8 w-17.5" })
|
|
8607
8697
|
] }),
|
|
8608
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex w-
|
|
8698
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex w-25 items-center justify-center text-sm font-medium", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Skeleton, { className: "h-8 w-20" }) }),
|
|
8609
8699
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center space-x-2", children: [
|
|
8610
8700
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Skeleton, { className: "hidden size-8 lg:block" }),
|
|
8611
8701
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Skeleton, { className: "size-8" }),
|
package/dist/index.d.cts
CHANGED
|
@@ -645,7 +645,9 @@ declare const Toaster: ({ ...props }: ToasterProps) => react_jsx_runtime.JSX.Ele
|
|
|
645
645
|
|
|
646
646
|
declare const Switch: React$1.ForwardRefExoticComponent<Omit<SwitchPrimitives.SwitchProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
647
647
|
|
|
648
|
-
declare const Table: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLTableElement> &
|
|
648
|
+
declare const Table: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLTableElement> & {
|
|
649
|
+
containerClassName?: string;
|
|
650
|
+
} & React$1.RefAttributes<HTMLTableElement>>;
|
|
649
651
|
declare const TableHeader: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLTableSectionElement> & React$1.RefAttributes<HTMLTableSectionElement>>;
|
|
650
652
|
declare const TableBody: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLTableSectionElement> & React$1.RefAttributes<HTMLTableSectionElement>>;
|
|
651
653
|
declare const TableFooter: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLTableSectionElement> & React$1.RefAttributes<HTMLTableSectionElement>>;
|
|
@@ -790,8 +792,11 @@ interface DataTableProps<TData, TValue> {
|
|
|
790
792
|
pageLabel?: string;
|
|
791
793
|
ofLabel?: string;
|
|
792
794
|
emptyData?: React__default.ReactNode;
|
|
795
|
+
animate?: boolean;
|
|
796
|
+
stickyHeader?: boolean;
|
|
797
|
+
heightClassName?: string;
|
|
793
798
|
}
|
|
794
|
-
declare function DataTable<TData, TValue>({ columns, data, pageCount, page, perPage, pageSizeOptions, rowPerPageLabel, ofLabel, pageLabel, isRowsSelected, totalRows, rowsSelectedLabel, className, emptyData, bodyClassName, cellClassName, headerClassName, rowClassName, tableClassName, onPageChange, onClick, onPageSizeChange, }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
799
|
+
declare function DataTable<TData, TValue>({ columns, data, pageCount, page, perPage, pageSizeOptions, rowPerPageLabel, ofLabel, pageLabel, isRowsSelected, totalRows, rowsSelectedLabel, className, emptyData, bodyClassName, cellClassName, headerClassName, rowClassName, tableClassName, onPageChange, onClick, onPageSizeChange, animate, stickyHeader, heightClassName, }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
795
800
|
|
|
796
801
|
type DataTableSkeletonProps = {
|
|
797
802
|
columnCount: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -645,7 +645,9 @@ declare const Toaster: ({ ...props }: ToasterProps) => react_jsx_runtime.JSX.Ele
|
|
|
645
645
|
|
|
646
646
|
declare const Switch: React$1.ForwardRefExoticComponent<Omit<SwitchPrimitives.SwitchProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
647
647
|
|
|
648
|
-
declare const Table: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLTableElement> &
|
|
648
|
+
declare const Table: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLTableElement> & {
|
|
649
|
+
containerClassName?: string;
|
|
650
|
+
} & React$1.RefAttributes<HTMLTableElement>>;
|
|
649
651
|
declare const TableHeader: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLTableSectionElement> & React$1.RefAttributes<HTMLTableSectionElement>>;
|
|
650
652
|
declare const TableBody: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLTableSectionElement> & React$1.RefAttributes<HTMLTableSectionElement>>;
|
|
651
653
|
declare const TableFooter: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLTableSectionElement> & React$1.RefAttributes<HTMLTableSectionElement>>;
|
|
@@ -790,8 +792,11 @@ interface DataTableProps<TData, TValue> {
|
|
|
790
792
|
pageLabel?: string;
|
|
791
793
|
ofLabel?: string;
|
|
792
794
|
emptyData?: React__default.ReactNode;
|
|
795
|
+
animate?: boolean;
|
|
796
|
+
stickyHeader?: boolean;
|
|
797
|
+
heightClassName?: string;
|
|
793
798
|
}
|
|
794
|
-
declare function DataTable<TData, TValue>({ columns, data, pageCount, page, perPage, pageSizeOptions, rowPerPageLabel, ofLabel, pageLabel, isRowsSelected, totalRows, rowsSelectedLabel, className, emptyData, bodyClassName, cellClassName, headerClassName, rowClassName, tableClassName, onPageChange, onClick, onPageSizeChange, }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
799
|
+
declare function DataTable<TData, TValue>({ columns, data, pageCount, page, perPage, pageSizeOptions, rowPerPageLabel, ofLabel, pageLabel, isRowsSelected, totalRows, rowsSelectedLabel, className, emptyData, bodyClassName, cellClassName, headerClassName, rowClassName, tableClassName, onPageChange, onClick, onPageSizeChange, animate, stickyHeader, heightClassName, }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
795
800
|
|
|
796
801
|
type DataTableSkeletonProps = {
|
|
797
802
|
columnCount: number;
|