shadcn-ui-react 0.5.3 → 0.6.0
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/README.md +74 -26
- package/dist/index.cjs +296 -119
- package/dist/index.d.cts +146 -9
- package/dist/index.d.ts +146 -9
- package/dist/index.js +300 -121
- package/dist/style.css +535 -21
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -121,6 +121,7 @@ __export(index_exports, {
|
|
|
121
121
|
ContextMenuSubContent: () => ContextMenuSubContent,
|
|
122
122
|
ContextMenuSubTrigger: () => ContextMenuSubTrigger,
|
|
123
123
|
ContextMenuTrigger: () => ContextMenuTrigger,
|
|
124
|
+
DATA_TABLE_TEMPLATES: () => DATA_TABLE_TEMPLATES,
|
|
124
125
|
DataTable: () => DataTable,
|
|
125
126
|
DataTableSkeleton: () => DataTableSkeleton,
|
|
126
127
|
Dialog: () => Dialog,
|
|
@@ -8391,12 +8392,215 @@ function Breadcrumbs({ items, className, classNameList }) {
|
|
|
8391
8392
|
}
|
|
8392
8393
|
|
|
8393
8394
|
// src/shared/data-table.tsx
|
|
8394
|
-
var import_react36 = require("react");
|
|
8395
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
8395
8396
|
var import_framer_motion2 = require("framer-motion");
|
|
8396
8397
|
var import_react_icons18 = require("@radix-ui/react-icons");
|
|
8397
8398
|
var import_react_table = require("@tanstack/react-table");
|
|
8398
8399
|
var import_lucide_react6 = require("lucide-react");
|
|
8399
8400
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
8401
|
+
var TablePlain = import_react36.default.forwardRef((_a, ref) => {
|
|
8402
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
8403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8404
|
+
"table",
|
|
8405
|
+
__spreadValues({
|
|
8406
|
+
ref,
|
|
8407
|
+
className: cn("w-full caption-bottom text-sm", className)
|
|
8408
|
+
}, props)
|
|
8409
|
+
);
|
|
8410
|
+
});
|
|
8411
|
+
TablePlain.displayName = "TablePlain";
|
|
8412
|
+
var ACCENT_COLOR = {
|
|
8413
|
+
primary: "var(--primary)",
|
|
8414
|
+
emerald: "#10b981",
|
|
8415
|
+
indigo: "#6366f1",
|
|
8416
|
+
rose: "#f43f5e",
|
|
8417
|
+
amber: "#f59e0b",
|
|
8418
|
+
zinc: "#71717a"
|
|
8419
|
+
};
|
|
8420
|
+
function resolveAccent(accent, accentColor) {
|
|
8421
|
+
var _a;
|
|
8422
|
+
const custom = accentColor == null ? void 0 : accentColor.trim();
|
|
8423
|
+
if (custom) return custom;
|
|
8424
|
+
if (!accent) return void 0;
|
|
8425
|
+
return (_a = ACCENT_COLOR[accent]) != null ? _a : ACCENT_COLOR.primary;
|
|
8426
|
+
}
|
|
8427
|
+
var DATA_TABLE_TEMPLATES = {
|
|
8428
|
+
neo: {
|
|
8429
|
+
root: cn(
|
|
8430
|
+
"relative w-full overflow-hidden rounded-2xl border shadow-sm",
|
|
8431
|
+
"bg-background/70 supports-[backdrop-filter]:bg-background/45 backdrop-blur",
|
|
8432
|
+
"flex flex-col",
|
|
8433
|
+
"before:absolute before:inset-x-0 before:top-0 before:h-[2px] before:bg-transparent",
|
|
8434
|
+
"data-[accent=on]:before:bg-[color:var(--dt-accent)]"
|
|
8435
|
+
),
|
|
8436
|
+
table: cn("w-full text-sm"),
|
|
8437
|
+
thead: "border-b",
|
|
8438
|
+
theadSticky: "sticky top-0 z-10 bg-background/85 supports-[backdrop-filter]:bg-background/60 backdrop-blur",
|
|
8439
|
+
trHead: "hover:bg-transparent",
|
|
8440
|
+
th: cn(
|
|
8441
|
+
"h-11 px-4 text-left align-middle whitespace-nowrap",
|
|
8442
|
+
"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground"
|
|
8443
|
+
),
|
|
8444
|
+
tbody: cn(
|
|
8445
|
+
"[&_tr:last-child]:border-0",
|
|
8446
|
+
"[&>tr:nth-child(even)]:bg-muted/20"
|
|
8447
|
+
),
|
|
8448
|
+
tr: cn(
|
|
8449
|
+
"border-b transition-colors",
|
|
8450
|
+
"data-[state=selected]:bg-muted/35",
|
|
8451
|
+
"data-[accent=on]:data-[state=selected]:bg-[color:var(--dt-accent)]/10"
|
|
8452
|
+
),
|
|
8453
|
+
trClickable: cn(
|
|
8454
|
+
"cursor-pointer",
|
|
8455
|
+
"hover:bg-muted/35 active:bg-muted/45",
|
|
8456
|
+
"data-[accent=on]:hover:bg-[color:var(--dt-accent)]/8",
|
|
8457
|
+
"data-[accent=on]:active:bg-[color:var(--dt-accent)]/12"
|
|
8458
|
+
),
|
|
8459
|
+
td: "px-4 py-3 align-middle",
|
|
8460
|
+
footer: cn(
|
|
8461
|
+
"border-t",
|
|
8462
|
+
"bg-background/80 supports-[backdrop-filter]:bg-background/55 backdrop-blur"
|
|
8463
|
+
),
|
|
8464
|
+
footerInner: "px-4 py-3",
|
|
8465
|
+
metaWrap: "flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-muted-foreground",
|
|
8466
|
+
controlsWrap: "flex flex-wrap items-center justify-between gap-3 sm:justify-end",
|
|
8467
|
+
pageSizeLabel: "text-sm font-medium whitespace-nowrap",
|
|
8468
|
+
pageSizeTrigger: cn(
|
|
8469
|
+
"h-8 w-[5rem]",
|
|
8470
|
+
"border-muted-foreground/20",
|
|
8471
|
+
"focus-visible:ring-2 focus-visible:ring-ring",
|
|
8472
|
+
"data-[accent=on]:focus-visible:ring-[color:var(--dt-accent)]/35"
|
|
8473
|
+
),
|
|
8474
|
+
pageLabel: "hidden sm:flex min-w-[9.25rem] items-center justify-center text-sm font-medium",
|
|
8475
|
+
navButton: cn(
|
|
8476
|
+
"h-8 w-8 p-0 rounded-md",
|
|
8477
|
+
"border-muted-foreground/20",
|
|
8478
|
+
"hover:bg-muted/35 hover:border-muted-foreground/40",
|
|
8479
|
+
"focus-visible:ring-2 focus-visible:ring-ring",
|
|
8480
|
+
"data-[accent=on]:hover:border-[color:var(--dt-accent)]/45",
|
|
8481
|
+
"data-[accent=on]:hover:bg-[color:var(--dt-accent)]/10",
|
|
8482
|
+
"data-[accent=on]:focus-visible:ring-[color:var(--dt-accent)]/35"
|
|
8483
|
+
)
|
|
8484
|
+
},
|
|
8485
|
+
glass: {
|
|
8486
|
+
root: cn(
|
|
8487
|
+
"relative w-full overflow-hidden rounded-2xl border shadow-md",
|
|
8488
|
+
"bg-background/55 supports-[backdrop-filter]:bg-background/25 backdrop-blur-xl",
|
|
8489
|
+
"flex flex-col",
|
|
8490
|
+
"before:absolute before:inset-x-0 before:top-0 before:h-[2px] before:bg-transparent",
|
|
8491
|
+
"data-[accent=on]:before:bg-[color:var(--dt-accent)]"
|
|
8492
|
+
),
|
|
8493
|
+
theadSticky: "sticky top-0 z-10 bg-background/70 supports-[backdrop-filter]:bg-background/35 backdrop-blur-xl",
|
|
8494
|
+
tbody: cn("[&_tr:last-child]:border-0", "[&>tr:nth-child(even)]:bg-background/20")
|
|
8495
|
+
},
|
|
8496
|
+
compact: {
|
|
8497
|
+
th: "h-10 px-3 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground whitespace-nowrap",
|
|
8498
|
+
td: "px-3 py-2 text-xs align-middle",
|
|
8499
|
+
pageSizeTrigger: "h-8 w-[4.5rem]"
|
|
8500
|
+
},
|
|
8501
|
+
minimal: {
|
|
8502
|
+
root: cn("relative w-full overflow-hidden rounded-xl border-0 shadow-none bg-transparent flex flex-col"),
|
|
8503
|
+
theadSticky: "sticky top-0 z-10 bg-background",
|
|
8504
|
+
footer: "border-t bg-transparent",
|
|
8505
|
+
tbody: "[&_tr:last-child]:border-0"
|
|
8506
|
+
},
|
|
8507
|
+
clean: {
|
|
8508
|
+
root: cn(
|
|
8509
|
+
"relative w-full overflow-hidden rounded-2xl border shadow-none",
|
|
8510
|
+
"bg-background flex flex-col",
|
|
8511
|
+
"before:absolute before:inset-x-0 before:top-0 before:h-[2px] before:bg-transparent",
|
|
8512
|
+
"data-[accent=on]:before:bg-[color:var(--dt-accent)]"
|
|
8513
|
+
),
|
|
8514
|
+
theadSticky: "sticky top-0 z-10 bg-background",
|
|
8515
|
+
tbody: cn("[&_tr:last-child]:border-0", "[&>tr:nth-child(even)]:bg-transparent"),
|
|
8516
|
+
tr: cn(
|
|
8517
|
+
"border-b",
|
|
8518
|
+
"data-[state=selected]:bg-muted/35",
|
|
8519
|
+
"data-[accent=on]:data-[state=selected]:bg-[color:var(--dt-accent)]/10"
|
|
8520
|
+
),
|
|
8521
|
+
trClickable: cn(
|
|
8522
|
+
"cursor-pointer",
|
|
8523
|
+
"hover:bg-muted/30 active:bg-muted/40",
|
|
8524
|
+
"data-[accent=on]:hover:bg-[color:var(--dt-accent)]/8",
|
|
8525
|
+
"data-[accent=on]:active:bg-[color:var(--dt-accent)]/12"
|
|
8526
|
+
)
|
|
8527
|
+
},
|
|
8528
|
+
elevated: {
|
|
8529
|
+
root: cn(
|
|
8530
|
+
"relative w-full overflow-hidden rounded-3xl border shadow-lg",
|
|
8531
|
+
"bg-card flex flex-col",
|
|
8532
|
+
"before:absolute before:inset-x-0 before:top-0 before:h-[2px] before:bg-transparent",
|
|
8533
|
+
"data-[accent=on]:before:bg-[color:var(--dt-accent)]"
|
|
8534
|
+
),
|
|
8535
|
+
theadSticky: "sticky top-0 z-10 bg-card/95 supports-[backdrop-filter]:bg-card/75 backdrop-blur",
|
|
8536
|
+
tbody: cn("[&_tr:last-child]:border-0", "[&>tr:nth-child(even)]:bg-muted/10"),
|
|
8537
|
+
th: cn(
|
|
8538
|
+
"h-12 px-5 text-left align-middle whitespace-nowrap",
|
|
8539
|
+
"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground"
|
|
8540
|
+
),
|
|
8541
|
+
td: "px-5 py-3 align-middle"
|
|
8542
|
+
},
|
|
8543
|
+
grid: {
|
|
8544
|
+
root: cn("relative w-full overflow-hidden rounded-2xl border shadow-sm bg-background flex flex-col"),
|
|
8545
|
+
table: cn(
|
|
8546
|
+
"w-full text-sm border-separate border-spacing-0",
|
|
8547
|
+
"[&_th]:border-b [&_td]:border-b",
|
|
8548
|
+
"[&_th:not(:last-child)]:border-r [&_td:not(:last-child)]:border-r",
|
|
8549
|
+
"[&_th]:border-muted-foreground/15 [&_td]:border-muted-foreground/10"
|
|
8550
|
+
),
|
|
8551
|
+
thead: "border-b-0",
|
|
8552
|
+
tbody: "[&_tr:last-child_td]:border-b-0",
|
|
8553
|
+
tr: cn(
|
|
8554
|
+
"transition-colors",
|
|
8555
|
+
"data-[state=selected]:bg-muted/35",
|
|
8556
|
+
"data-[accent=on]:data-[state=selected]:bg-[color:var(--dt-accent)]/10"
|
|
8557
|
+
),
|
|
8558
|
+
trClickable: cn(
|
|
8559
|
+
"cursor-pointer",
|
|
8560
|
+
"hover:bg-muted/25 active:bg-muted/35",
|
|
8561
|
+
"data-[accent=on]:hover:bg-[color:var(--dt-accent)]/7",
|
|
8562
|
+
"data-[accent=on]:active:bg-[color:var(--dt-accent)]/10"
|
|
8563
|
+
)
|
|
8564
|
+
},
|
|
8565
|
+
cards: {
|
|
8566
|
+
root: cn("relative w-full overflow-hidden rounded-2xl border bg-transparent shadow-none flex flex-col"),
|
|
8567
|
+
table: cn(
|
|
8568
|
+
"w-full text-sm border-separate border-spacing-y-2",
|
|
8569
|
+
"[&_tbody_tr_td]:bg-background",
|
|
8570
|
+
"[&_tbody_tr_td:first-child]:rounded-l-xl",
|
|
8571
|
+
"[&_tbody_tr_td:last-child]:rounded-r-xl",
|
|
8572
|
+
"[&_tbody_tr_td]:shadow-sm",
|
|
8573
|
+
"[&_thead_tr]:border-b"
|
|
8574
|
+
),
|
|
8575
|
+
theadSticky: "sticky top-0 z-10 bg-background",
|
|
8576
|
+
tr: cn(
|
|
8577
|
+
"border-0",
|
|
8578
|
+
"data-[state=selected]:opacity-100",
|
|
8579
|
+
"data-[state=selected]:[&_td]:ring-1 data-[state=selected]:[&_td]:ring-muted-foreground/15",
|
|
8580
|
+
"data-[accent=on]:data-[state=selected]:[&_td]:ring-[color:var(--dt-accent)]/25"
|
|
8581
|
+
),
|
|
8582
|
+
trClickable: cn(
|
|
8583
|
+
"cursor-pointer",
|
|
8584
|
+
"[&_td]:transition-colors",
|
|
8585
|
+
"hover:[&_td]:bg-muted/25 active:[&_td]:bg-muted/35",
|
|
8586
|
+
"data-[accent=on]:hover:[&_td]:bg-[color:var(--dt-accent)]/7",
|
|
8587
|
+
"data-[accent=on]:active:[&_td]:bg-[color:var(--dt-accent)]/10"
|
|
8588
|
+
),
|
|
8589
|
+
tbody: "[&_tr:last-child]:border-0"
|
|
8590
|
+
}
|
|
8591
|
+
};
|
|
8592
|
+
function mergeSlots(...parts) {
|
|
8593
|
+
const out = {};
|
|
8594
|
+
for (const p of parts) {
|
|
8595
|
+
if (!p) continue;
|
|
8596
|
+
for (const k of Object.keys(p)) {
|
|
8597
|
+
const v = p[k];
|
|
8598
|
+
if (!v) continue;
|
|
8599
|
+
out[k] = out[k] ? cn(out[k], v) : v;
|
|
8600
|
+
}
|
|
8601
|
+
}
|
|
8602
|
+
return out;
|
|
8603
|
+
}
|
|
8400
8604
|
function DataTable({
|
|
8401
8605
|
columns,
|
|
8402
8606
|
data,
|
|
@@ -8410,18 +8614,17 @@ function DataTable({
|
|
|
8410
8614
|
isRowsSelected = true,
|
|
8411
8615
|
totalRows,
|
|
8412
8616
|
rowsSelectedLabel = "row(s) selected",
|
|
8413
|
-
|
|
8617
|
+
template = "neo",
|
|
8618
|
+
classNames,
|
|
8619
|
+
accent = null,
|
|
8620
|
+
accentColor = null,
|
|
8414
8621
|
emptyData,
|
|
8415
|
-
bodyClassName,
|
|
8416
|
-
cellClassName,
|
|
8417
|
-
headerClassName,
|
|
8418
|
-
rowClassName,
|
|
8419
|
-
tableClassName,
|
|
8420
8622
|
onPageChange,
|
|
8421
8623
|
onClick,
|
|
8422
8624
|
onPageSizeChange,
|
|
8423
8625
|
animate = true,
|
|
8424
8626
|
stickyHeader = true,
|
|
8627
|
+
headerScroll = false,
|
|
8425
8628
|
heightClassName = "h-[clamp(22rem,80vh,44rem)] supports-[height:100dvh]:h-[clamp(22rem,80dvh,44rem)]"
|
|
8426
8629
|
}) {
|
|
8427
8630
|
const safePageCount = Math.max(pageCount != null ? pageCount : 1, 1);
|
|
@@ -8459,114 +8662,90 @@ function DataTable({
|
|
|
8459
8662
|
onPageSizeChange == null ? void 0 : onPageSizeChange(size);
|
|
8460
8663
|
onPageChange == null ? void 0 : onPageChange(1);
|
|
8461
8664
|
};
|
|
8665
|
+
const ui = (0, import_react36.useMemo)(() => {
|
|
8666
|
+
var _a;
|
|
8667
|
+
const builtIn = (_a = DATA_TABLE_TEMPLATES[template]) != null ? _a : DATA_TABLE_TEMPLATES.neo;
|
|
8668
|
+
return mergeSlots(DATA_TABLE_TEMPLATES.neo, builtIn, classNames);
|
|
8669
|
+
}, [template, classNames]);
|
|
8670
|
+
const dtAccent = resolveAccent(accent, accentColor);
|
|
8671
|
+
const accentOn = !!dtAccent;
|
|
8672
|
+
const dataAccent = accentOn ? "on" : "off";
|
|
8673
|
+
const headerIsSticky = stickyHeader && !headerScroll;
|
|
8462
8674
|
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
8463
8675
|
"div",
|
|
8464
8676
|
{
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
heightClassName,
|
|
8469
|
-
className
|
|
8470
|
-
),
|
|
8677
|
+
"data-accent": dataAccent,
|
|
8678
|
+
className: cn(ui.root, heightClassName),
|
|
8679
|
+
style: accentOn ? { "--dt-accent": dtAccent } : void 0,
|
|
8471
8680
|
children: [
|
|
8472
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "
|
|
8473
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
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
|
-
}
|
|
8681
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(ScrollArea, { className: "h-full", children: [
|
|
8682
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "relative min-w-full w-max", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(TablePlain, { className: cn(ui.table), children: [
|
|
8683
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TableHeader, { className: cn(ui.thead), children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TableRow, { className: cn(ui.trHead), children: headerGroup.headers.map((header) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8684
|
+
TableHead,
|
|
8685
|
+
{
|
|
8686
|
+
className: cn(
|
|
8687
|
+
ui.th,
|
|
8688
|
+
headerIsSticky ? cn(ui.theadSticky, "z-20") : void 0
|
|
8505
8689
|
),
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
|
|
8513
|
-
|
|
8514
|
-
|
|
8515
|
-
|
|
8516
|
-
|
|
8517
|
-
|
|
8518
|
-
|
|
8519
|
-
|
|
8520
|
-
|
|
8521
|
-
|
|
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)(
|
|
8690
|
+
children: header.isPlaceholder ? null : (0, import_react_table.flexRender)(
|
|
8691
|
+
header.column.columnDef.header,
|
|
8692
|
+
header.getContext()
|
|
8693
|
+
)
|
|
8694
|
+
},
|
|
8695
|
+
header.id
|
|
8696
|
+
)) }, headerGroup.id)) }),
|
|
8697
|
+
animate ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_framer_motion2.AnimatePresence, { mode: "wait", initial: false, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8698
|
+
import_framer_motion2.motion.tbody,
|
|
8699
|
+
{
|
|
8700
|
+
className: cn(ui.tbody),
|
|
8701
|
+
initial: { opacity: 0, y: 6 },
|
|
8702
|
+
animate: { opacity: 1, y: 0 },
|
|
8703
|
+
exit: { opacity: 0, y: -6 },
|
|
8704
|
+
transition: { duration: 0.18 },
|
|
8705
|
+
children: table.getRowModel().rows.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8540
8706
|
TableRow,
|
|
8541
8707
|
{
|
|
8708
|
+
"data-accent": dataAccent,
|
|
8542
8709
|
"data-state": row.getIsSelected() ? "selected" : void 0,
|
|
8543
8710
|
onClick: () => onClick == null ? void 0 : onClick(row.original),
|
|
8544
|
-
className: cn(
|
|
8545
|
-
|
|
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))
|
|
8711
|
+
className: cn(ui.tr, clickable ? ui.trClickable : void 0),
|
|
8712
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TableCell, { className: cn(ui.td), children: (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext()) }, cell.id))
|
|
8552
8713
|
},
|
|
8553
8714
|
row.id
|
|
8554
|
-
)) : emptyData || /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8715
|
+
)) : emptyData || /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TableRow, { "data-accent": dataAccent, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8555
8716
|
TableCell,
|
|
8556
8717
|
{
|
|
8557
8718
|
colSpan: columns.length,
|
|
8558
|
-
className: "h-28 text-center
|
|
8719
|
+
className: cn(ui.td, "text-muted-foreground h-28 text-center"),
|
|
8559
8720
|
children: "No results."
|
|
8560
8721
|
}
|
|
8561
|
-
) })
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8722
|
+
) })
|
|
8723
|
+
},
|
|
8724
|
+
pageKey
|
|
8725
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TableBody, { className: cn(ui.tbody), children: table.getRowModel().rows.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8726
|
+
TableRow,
|
|
8727
|
+
{
|
|
8728
|
+
"data-accent": dataAccent,
|
|
8729
|
+
"data-state": row.getIsSelected() ? "selected" : void 0,
|
|
8730
|
+
onClick: () => onClick == null ? void 0 : onClick(row.original),
|
|
8731
|
+
className: cn(ui.tr, clickable ? ui.trClickable : void 0),
|
|
8732
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TableCell, { className: cn(ui.td), children: (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext()) }, cell.id))
|
|
8733
|
+
},
|
|
8734
|
+
row.id
|
|
8735
|
+
)) : emptyData || /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TableRow, { "data-accent": dataAccent, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8736
|
+
TableCell,
|
|
8737
|
+
{
|
|
8738
|
+
colSpan: columns.length,
|
|
8739
|
+
className: cn(ui.td, "text-muted-foreground h-28 text-center"),
|
|
8740
|
+
children: "No results."
|
|
8741
|
+
}
|
|
8742
|
+
) }) })
|
|
8743
|
+
] }) }),
|
|
8565
8744
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ScrollBar, { orientation: "horizontal" })
|
|
8566
8745
|
] }) }),
|
|
8567
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className:
|
|
8568
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className:
|
|
8569
|
-
isRowsSelected && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", {
|
|
8746
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: cn(ui.footer), children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: cn(ui.footerInner), children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-[1fr_auto] sm:items-center", children: [
|
|
8747
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: cn(ui.metaWrap), children: [
|
|
8748
|
+
isRowsSelected && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { children: [
|
|
8570
8749
|
table.getFilteredSelectedRowModel().rows.length,
|
|
8571
8750
|
" ",
|
|
8572
8751
|
ofLabel,
|
|
@@ -8575,29 +8754,22 @@ function DataTable({
|
|
|
8575
8754
|
" ",
|
|
8576
8755
|
rowsSelectedLabel
|
|
8577
8756
|
] }),
|
|
8578
|
-
typeof totalRows === "number" && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", {
|
|
8757
|
+
typeof totalRows === "number" && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { children: [
|
|
8579
8758
|
"Total: ",
|
|
8580
8759
|
totalRows,
|
|
8581
8760
|
" registros"
|
|
8582
8761
|
] })
|
|
8583
8762
|
] }),
|
|
8584
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className:
|
|
8763
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: cn(ui.controlsWrap), children: [
|
|
8585
8764
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
8586
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className:
|
|
8587
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
8588
|
-
|
|
8589
|
-
{
|
|
8590
|
-
|
|
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
|
-
)
|
|
8765
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: cn(ui.pageSizeLabel), children: rowPerPageLabel }),
|
|
8766
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(Select2, { value: `${pageSize}`, onValueChange: (v) => changePageSize(Number(v)), children: [
|
|
8767
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectTrigger, { "data-accent": dataAccent, className: cn(ui.pageSizeTrigger), children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectValue, { placeholder: `${pageSize}` }) }),
|
|
8768
|
+
/* @__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)) })
|
|
8769
|
+
] })
|
|
8598
8770
|
] }),
|
|
8599
8771
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
8600
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className:
|
|
8772
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: cn(ui.pageLabel), children: [
|
|
8601
8773
|
pageLabel,
|
|
8602
8774
|
" ",
|
|
8603
8775
|
pageIndex + 1,
|
|
@@ -8609,9 +8781,10 @@ function DataTable({
|
|
|
8609
8781
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8610
8782
|
Button,
|
|
8611
8783
|
{
|
|
8784
|
+
"data-accent": dataAccent,
|
|
8612
8785
|
"aria-label": "Go to first page",
|
|
8613
8786
|
variant: "outline",
|
|
8614
|
-
className: "hidden
|
|
8787
|
+
className: cn("hidden lg:flex", ui.navButton),
|
|
8615
8788
|
onClick: () => goToPage(0),
|
|
8616
8789
|
disabled: pageIndex === 0,
|
|
8617
8790
|
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_icons18.DoubleArrowLeftIcon, { className: "h-4 w-4" })
|
|
@@ -8620,38 +8793,41 @@ function DataTable({
|
|
|
8620
8793
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8621
8794
|
Button,
|
|
8622
8795
|
{
|
|
8796
|
+
"data-accent": dataAccent,
|
|
8623
8797
|
"aria-label": "Go to previous page",
|
|
8624
8798
|
variant: "outline",
|
|
8625
|
-
className:
|
|
8799
|
+
className: cn(ui.navButton),
|
|
8626
8800
|
onClick: () => goToPage(pageIndex - 1),
|
|
8627
8801
|
disabled: pageIndex === 0,
|
|
8628
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react6.
|
|
8802
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react6.ChevronLeft, { className: "h-4 w-4" })
|
|
8629
8803
|
}
|
|
8630
8804
|
),
|
|
8631
8805
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8632
8806
|
Button,
|
|
8633
8807
|
{
|
|
8808
|
+
"data-accent": dataAccent,
|
|
8634
8809
|
"aria-label": "Go to next page",
|
|
8635
8810
|
variant: "outline",
|
|
8636
|
-
className:
|
|
8811
|
+
className: cn(ui.navButton),
|
|
8637
8812
|
onClick: () => goToPage(pageIndex + 1),
|
|
8638
8813
|
disabled: pageIndex + 1 >= safePageCount,
|
|
8639
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react6.
|
|
8814
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_lucide_react6.ChevronRight, { className: "h-4 w-4" })
|
|
8640
8815
|
}
|
|
8641
8816
|
),
|
|
8642
8817
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
8643
8818
|
Button,
|
|
8644
8819
|
{
|
|
8820
|
+
"data-accent": dataAccent,
|
|
8645
8821
|
"aria-label": "Go to last page",
|
|
8646
8822
|
variant: "outline",
|
|
8647
|
-
className: "hidden
|
|
8823
|
+
className: cn("hidden lg:flex", ui.navButton),
|
|
8648
8824
|
onClick: () => goToPage(safePageCount - 1),
|
|
8649
8825
|
disabled: pageIndex + 1 >= safePageCount,
|
|
8650
8826
|
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_icons18.DoubleArrowRightIcon, { className: "h-4 w-4" })
|
|
8651
8827
|
}
|
|
8652
8828
|
)
|
|
8653
8829
|
] }),
|
|
8654
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "
|
|
8830
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "text-muted-foreground w-full text-center text-xs sm:hidden", children: [
|
|
8655
8831
|
pageLabel,
|
|
8656
8832
|
" ",
|
|
8657
8833
|
pageIndex + 1,
|
|
@@ -9145,6 +9321,7 @@ function UiInput(_a) {
|
|
|
9145
9321
|
ContextMenuSubContent,
|
|
9146
9322
|
ContextMenuSubTrigger,
|
|
9147
9323
|
ContextMenuTrigger,
|
|
9324
|
+
DATA_TABLE_TEMPLATES,
|
|
9148
9325
|
DataTable,
|
|
9149
9326
|
DataTableSkeleton,
|
|
9150
9327
|
Dialog,
|