@prediktif/ui 0.1.18 → 0.1.20
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.d.mts +251 -3
- package/dist/index.d.ts +251 -3
- package/dist/index.js +2010 -171
- package/dist/index.mjs +2024 -170
- package/package.json +6 -2
package/dist/index.js
CHANGED
|
@@ -61,9 +61,31 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
61
61
|
var index_exports = {};
|
|
62
62
|
__export(index_exports, {
|
|
63
63
|
AppSidebar: () => AppSidebar,
|
|
64
|
+
DataTable: () => DataTable,
|
|
65
|
+
DataTableContentBody: () => DataTableContentBody,
|
|
66
|
+
DataTableContentHeader: () => DataTableContentHeader,
|
|
67
|
+
DataTableFooterEntries: () => DataTableFooterEntries,
|
|
68
|
+
DataTableFooterPagination: () => DataTableFooterPagination,
|
|
69
|
+
DataTableHeaderAdd: () => DataTableHeaderAdd,
|
|
70
|
+
DataTableHeaderDownload: () => DataTableHeaderDownload,
|
|
71
|
+
DataTableHeaderFilter: () => DataTableHeaderFilter,
|
|
72
|
+
DataTableHeaderRefresh: () => DataTableHeaderRefresh,
|
|
73
|
+
DataTableHeaderSearch: () => DataTableHeaderSearch,
|
|
74
|
+
DataTableHeaderSort: () => DataTableHeaderSort,
|
|
75
|
+
DataTableHeaderToggle: () => DataTableHeaderToggle,
|
|
64
76
|
HeaderTabs: () => HeaderTabs,
|
|
65
77
|
HeaderTitle: () => HeaderTitle,
|
|
66
|
-
|
|
78
|
+
RowActions: () => RowActions,
|
|
79
|
+
StateEmpty: () => StateEmpty,
|
|
80
|
+
exportToCSV: () => exportToCSV,
|
|
81
|
+
exportToPDF: () => exportToPDF,
|
|
82
|
+
exportToXLSX: () => exportToXLSX,
|
|
83
|
+
features: () => features,
|
|
84
|
+
flexRender: () => import_react_table4.flexRender,
|
|
85
|
+
getTableExportData: () => getTableExportData,
|
|
86
|
+
printTable: () => printTable,
|
|
87
|
+
smartFilterFn: () => smartFilterFn,
|
|
88
|
+
useTable: () => import_react_table4.useTable
|
|
67
89
|
});
|
|
68
90
|
module.exports = __toCommonJS(index_exports);
|
|
69
91
|
|
|
@@ -532,6 +554,57 @@ function DropdownMenuItem(_a) {
|
|
|
532
554
|
}, props)
|
|
533
555
|
);
|
|
534
556
|
}
|
|
557
|
+
function DropdownMenuCheckboxItem(_a) {
|
|
558
|
+
var _b = _a, {
|
|
559
|
+
className,
|
|
560
|
+
children,
|
|
561
|
+
checked,
|
|
562
|
+
inset
|
|
563
|
+
} = _b, props = __objRest(_b, [
|
|
564
|
+
"className",
|
|
565
|
+
"children",
|
|
566
|
+
"checked",
|
|
567
|
+
"inset"
|
|
568
|
+
]);
|
|
569
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
570
|
+
import_menu.Menu.CheckboxItem,
|
|
571
|
+
__spreadProps(__spreadValues({
|
|
572
|
+
"data-slot": "dropdown-menu-checkbox-item",
|
|
573
|
+
"data-inset": inset,
|
|
574
|
+
className: (0, import_cn5.cn)(
|
|
575
|
+
"relative flex min-h-7 cursor-default items-center gap-2 rounded-md py-1.5 pr-8 pl-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7.5 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
|
|
576
|
+
className
|
|
577
|
+
),
|
|
578
|
+
checked
|
|
579
|
+
}, props), {
|
|
580
|
+
children: [
|
|
581
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
582
|
+
"span",
|
|
583
|
+
{
|
|
584
|
+
className: "pointer-events-none absolute right-2 flex items-center justify-center",
|
|
585
|
+
"data-slot": "dropdown-menu-checkbox-item-indicator",
|
|
586
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_menu.Menu.CheckboxItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.CheckIcon, {}) })
|
|
587
|
+
}
|
|
588
|
+
),
|
|
589
|
+
children
|
|
590
|
+
]
|
|
591
|
+
})
|
|
592
|
+
);
|
|
593
|
+
}
|
|
594
|
+
function DropdownMenuSeparator(_a) {
|
|
595
|
+
var _b = _a, {
|
|
596
|
+
className
|
|
597
|
+
} = _b, props = __objRest(_b, [
|
|
598
|
+
"className"
|
|
599
|
+
]);
|
|
600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
601
|
+
import_menu.Menu.Separator,
|
|
602
|
+
__spreadValues({
|
|
603
|
+
"data-slot": "dropdown-menu-separator",
|
|
604
|
+
className: (0, import_cn5.cn)("-mx-1 my-1 h-px bg-border/50", className)
|
|
605
|
+
}, props)
|
|
606
|
+
);
|
|
607
|
+
}
|
|
535
608
|
|
|
536
609
|
// src/components/ui/separator.tsx
|
|
537
610
|
var import_separator = require("@base-ui/react/separator");
|
|
@@ -570,6 +643,20 @@ var React2 = __toESM(require("react"));
|
|
|
570
643
|
var import_input = require("@base-ui/react/input");
|
|
571
644
|
var import_cn7 = require("cn");
|
|
572
645
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
646
|
+
function Input(_a) {
|
|
647
|
+
var _b = _a, { className, type } = _b, props = __objRest(_b, ["className", "type"]);
|
|
648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
649
|
+
import_input.Input,
|
|
650
|
+
__spreadValues({
|
|
651
|
+
type,
|
|
652
|
+
"data-slot": "input",
|
|
653
|
+
className: (0, import_cn7.cn)(
|
|
654
|
+
"h-7 w-full min-w-0 rounded-md border border-input bg-input/20 px-2 py-0.5 text-sm transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs/relaxed file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
655
|
+
className
|
|
656
|
+
)
|
|
657
|
+
}, props)
|
|
658
|
+
);
|
|
659
|
+
}
|
|
573
660
|
|
|
574
661
|
// src/components/ui/sheet.tsx
|
|
575
662
|
var import_dialog = require("@base-ui/react/dialog");
|
|
@@ -1442,155 +1529,25 @@ var AppSidebar = (0, import_react.memo)(function AppSidebar2({
|
|
|
1442
1529
|
] });
|
|
1443
1530
|
});
|
|
1444
1531
|
|
|
1445
|
-
// src/components/composed/
|
|
1446
|
-
var
|
|
1447
|
-
var
|
|
1532
|
+
// src/components/composed/data-table/data-table.tsx
|
|
1533
|
+
var import_react_table4 = require("@tanstack/react-table");
|
|
1534
|
+
var import_lucide_react18 = require("lucide-react");
|
|
1535
|
+
var import_react6 = require("react");
|
|
1536
|
+
|
|
1537
|
+
// src/components/composed/state-empty.tsx
|
|
1448
1538
|
var import_react2 = require("react");
|
|
1449
1539
|
|
|
1450
|
-
// src/components/ui/
|
|
1451
|
-
var import_tabs = require("@base-ui/react/tabs");
|
|
1540
|
+
// src/components/ui/empty.tsx
|
|
1452
1541
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
1453
1542
|
var import_cn12 = require("cn");
|
|
1454
1543
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1455
|
-
function Tabs(_a) {
|
|
1456
|
-
var _b = _a, {
|
|
1457
|
-
className,
|
|
1458
|
-
orientation = "horizontal"
|
|
1459
|
-
} = _b, props = __objRest(_b, [
|
|
1460
|
-
"className",
|
|
1461
|
-
"orientation"
|
|
1462
|
-
]);
|
|
1463
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1464
|
-
import_tabs.Tabs.Root,
|
|
1465
|
-
__spreadValues({
|
|
1466
|
-
"data-slot": "tabs",
|
|
1467
|
-
"data-orientation": orientation,
|
|
1468
|
-
className: (0, import_cn12.cn)(
|
|
1469
|
-
"group/tabs flex gap-2 data-horizontal:flex-col",
|
|
1470
|
-
className
|
|
1471
|
-
)
|
|
1472
|
-
}, props)
|
|
1473
|
-
);
|
|
1474
|
-
}
|
|
1475
|
-
var tabsListVariants = (0, import_class_variance_authority3.cva)(
|
|
1476
|
-
"group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",
|
|
1477
|
-
{
|
|
1478
|
-
variants: {
|
|
1479
|
-
variant: {
|
|
1480
|
-
default: "bg-muted",
|
|
1481
|
-
line: "gap-1 bg-transparent"
|
|
1482
|
-
}
|
|
1483
|
-
},
|
|
1484
|
-
defaultVariants: {
|
|
1485
|
-
variant: "default"
|
|
1486
|
-
}
|
|
1487
|
-
}
|
|
1488
|
-
);
|
|
1489
|
-
function TabsList(_a) {
|
|
1490
|
-
var _b = _a, {
|
|
1491
|
-
className,
|
|
1492
|
-
variant = "default"
|
|
1493
|
-
} = _b, props = __objRest(_b, [
|
|
1494
|
-
"className",
|
|
1495
|
-
"variant"
|
|
1496
|
-
]);
|
|
1497
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1498
|
-
import_tabs.Tabs.List,
|
|
1499
|
-
__spreadValues({
|
|
1500
|
-
"data-slot": "tabs-list",
|
|
1501
|
-
"data-variant": variant,
|
|
1502
|
-
className: (0, import_cn12.cn)(tabsListVariants({ variant }), className)
|
|
1503
|
-
}, props)
|
|
1504
|
-
);
|
|
1505
|
-
}
|
|
1506
|
-
function TabsTrigger(_a) {
|
|
1507
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1508
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1509
|
-
import_tabs.Tabs.Tab,
|
|
1510
|
-
__spreadValues({
|
|
1511
|
-
"data-slot": "tabs-trigger",
|
|
1512
|
-
className: (0, import_cn12.cn)(
|
|
1513
|
-
"relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-xs font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:py-[calc(--spacing(1.25))] hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
|
|
1514
|
-
"group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent",
|
|
1515
|
-
"data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground",
|
|
1516
|
-
"after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",
|
|
1517
|
-
className
|
|
1518
|
-
)
|
|
1519
|
-
}, props)
|
|
1520
|
-
);
|
|
1521
|
-
}
|
|
1522
|
-
|
|
1523
|
-
// src/components/composed/header-tabs.tsx
|
|
1524
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1525
|
-
function renderTabIcon(icon) {
|
|
1526
|
-
if (!icon) return null;
|
|
1527
|
-
if (typeof icon === "function" || typeof icon === "object" && icon !== null && "render" in icon) {
|
|
1528
|
-
const IconComp = icon;
|
|
1529
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(IconComp, {});
|
|
1530
|
-
}
|
|
1531
|
-
return icon;
|
|
1532
|
-
}
|
|
1533
|
-
var HeaderTabs = (0, import_react2.memo)(function HeaderTabs2({
|
|
1534
|
-
items,
|
|
1535
|
-
value,
|
|
1536
|
-
onValueChange,
|
|
1537
|
-
children
|
|
1538
|
-
}) {
|
|
1539
|
-
var _a, _b;
|
|
1540
|
-
const pathname = (0, import_navigation2.usePathname)();
|
|
1541
|
-
const matchedItem = pathname ? items.find(
|
|
1542
|
-
(item) => item.url === pathname || pathname.endsWith(item.url) || pathname.split("/").includes(item.value)
|
|
1543
|
-
) : void 0;
|
|
1544
|
-
const activeTab = (_b = value != null ? value : matchedItem == null ? void 0 : matchedItem.value) != null ? _b : (_a = items[0]) == null ? void 0 : _a.value;
|
|
1545
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Tabs, { value: activeTab, onValueChange, className: "space-y-4", children: [
|
|
1546
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w-full overflow-x-auto overflow-y-hidden border-b no-scrollbar", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TabsList, { variant: "line", className: "inline-flex w-max justify-start", children: items.map(({ title, value: tabValue, url, icon }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1547
|
-
TabsTrigger,
|
|
1548
|
-
{
|
|
1549
|
-
nativeButton: false,
|
|
1550
|
-
render: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_link2.default, { href: url }),
|
|
1551
|
-
value: tabValue,
|
|
1552
|
-
children: [
|
|
1553
|
-
renderTabIcon(icon),
|
|
1554
|
-
title
|
|
1555
|
-
]
|
|
1556
|
-
},
|
|
1557
|
-
tabValue
|
|
1558
|
-
)) }) }),
|
|
1559
|
-
children
|
|
1560
|
-
] });
|
|
1561
|
-
});
|
|
1562
|
-
|
|
1563
|
-
// src/components/composed/header-title.tsx
|
|
1564
|
-
var import_react3 = require("react");
|
|
1565
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1566
|
-
var HeaderTitle = (0, import_react3.memo)(function HeaderTitle2({
|
|
1567
|
-
title,
|
|
1568
|
-
subtitle,
|
|
1569
|
-
children
|
|
1570
|
-
}) {
|
|
1571
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "w-full space-y-4", children: [
|
|
1572
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
|
|
1573
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h1", { className: "font-semibold", children: title }),
|
|
1574
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-xs text-muted-foreground", children: subtitle })
|
|
1575
|
-
] }),
|
|
1576
|
-
children
|
|
1577
|
-
] });
|
|
1578
|
-
});
|
|
1579
|
-
|
|
1580
|
-
// src/components/composed/state-empty.tsx
|
|
1581
|
-
var import_react4 = require("react");
|
|
1582
|
-
|
|
1583
|
-
// src/components/ui/empty.tsx
|
|
1584
|
-
var import_class_variance_authority4 = require("class-variance-authority");
|
|
1585
|
-
var import_cn13 = require("cn");
|
|
1586
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1587
1544
|
function Empty(_a) {
|
|
1588
1545
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1589
|
-
return /* @__PURE__ */ (0,
|
|
1546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1590
1547
|
"div",
|
|
1591
1548
|
__spreadValues({
|
|
1592
1549
|
"data-slot": "empty",
|
|
1593
|
-
className: (0,
|
|
1550
|
+
className: (0, import_cn12.cn)(
|
|
1594
1551
|
"flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance",
|
|
1595
1552
|
className
|
|
1596
1553
|
)
|
|
@@ -1599,15 +1556,15 @@ function Empty(_a) {
|
|
|
1599
1556
|
}
|
|
1600
1557
|
function EmptyHeader(_a) {
|
|
1601
1558
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1602
|
-
return /* @__PURE__ */ (0,
|
|
1559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1603
1560
|
"div",
|
|
1604
1561
|
__spreadValues({
|
|
1605
1562
|
"data-slot": "empty-header",
|
|
1606
|
-
className: (0,
|
|
1563
|
+
className: (0, import_cn12.cn)("flex max-w-sm flex-col items-center gap-1", className)
|
|
1607
1564
|
}, props)
|
|
1608
1565
|
);
|
|
1609
1566
|
}
|
|
1610
|
-
var emptyMediaVariants = (0,
|
|
1567
|
+
var emptyMediaVariants = (0, import_class_variance_authority3.cva)(
|
|
1611
1568
|
"mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
1612
1569
|
{
|
|
1613
1570
|
variants: {
|
|
@@ -1629,22 +1586,22 @@ function EmptyMedia(_a) {
|
|
|
1629
1586
|
"className",
|
|
1630
1587
|
"variant"
|
|
1631
1588
|
]);
|
|
1632
|
-
return /* @__PURE__ */ (0,
|
|
1589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1633
1590
|
"div",
|
|
1634
1591
|
__spreadValues({
|
|
1635
1592
|
"data-slot": "empty-icon",
|
|
1636
1593
|
"data-variant": variant,
|
|
1637
|
-
className: (0,
|
|
1594
|
+
className: (0, import_cn12.cn)(emptyMediaVariants({ variant, className }))
|
|
1638
1595
|
}, props)
|
|
1639
1596
|
);
|
|
1640
1597
|
}
|
|
1641
1598
|
function EmptyTitle(_a) {
|
|
1642
1599
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1643
|
-
return /* @__PURE__ */ (0,
|
|
1600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1644
1601
|
"div",
|
|
1645
1602
|
__spreadValues({
|
|
1646
1603
|
"data-slot": "empty-title",
|
|
1647
|
-
className: (0,
|
|
1604
|
+
className: (0, import_cn12.cn)(
|
|
1648
1605
|
"font-heading text-sm font-medium tracking-tight",
|
|
1649
1606
|
className
|
|
1650
1607
|
)
|
|
@@ -1653,11 +1610,11 @@ function EmptyTitle(_a) {
|
|
|
1653
1610
|
}
|
|
1654
1611
|
function EmptyDescription(_a) {
|
|
1655
1612
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1656
|
-
return /* @__PURE__ */ (0,
|
|
1613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1657
1614
|
"div",
|
|
1658
1615
|
__spreadValues({
|
|
1659
1616
|
"data-slot": "empty-description",
|
|
1660
|
-
className: (0,
|
|
1617
|
+
className: (0, import_cn12.cn)(
|
|
1661
1618
|
"text-xs/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
|
|
1662
1619
|
className
|
|
1663
1620
|
)
|
|
@@ -1666,11 +1623,11 @@ function EmptyDescription(_a) {
|
|
|
1666
1623
|
}
|
|
1667
1624
|
function EmptyContent(_a) {
|
|
1668
1625
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1669
|
-
return /* @__PURE__ */ (0,
|
|
1626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1670
1627
|
"div",
|
|
1671
1628
|
__spreadValues({
|
|
1672
1629
|
"data-slot": "empty-content",
|
|
1673
|
-
className: (0,
|
|
1630
|
+
className: (0, import_cn12.cn)(
|
|
1674
1631
|
"flex w-full max-w-sm min-w-0 flex-col items-center gap-2 text-xs/relaxed text-balance",
|
|
1675
1632
|
className
|
|
1676
1633
|
)
|
|
@@ -1678,44 +1635,1926 @@ function EmptyContent(_a) {
|
|
|
1678
1635
|
);
|
|
1679
1636
|
}
|
|
1680
1637
|
|
|
1638
|
+
// src/lib/utils.ts
|
|
1639
|
+
var import_cn13 = require("cn");
|
|
1640
|
+
|
|
1681
1641
|
// src/components/composed/state-empty.tsx
|
|
1682
|
-
var
|
|
1642
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1683
1643
|
function renderStateIcon(icon) {
|
|
1684
1644
|
if (typeof icon === "function" || typeof icon === "object" && icon !== null && "render" in icon) {
|
|
1685
1645
|
const IconComp = icon;
|
|
1686
|
-
return /* @__PURE__ */ (0,
|
|
1646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(IconComp, {});
|
|
1687
1647
|
}
|
|
1688
1648
|
return icon;
|
|
1689
1649
|
}
|
|
1690
|
-
var StateEmpty = (0,
|
|
1650
|
+
var StateEmpty = (0, import_react2.memo)(function StateEmpty2({
|
|
1691
1651
|
icon,
|
|
1692
1652
|
title,
|
|
1693
1653
|
description,
|
|
1694
1654
|
buttonText,
|
|
1695
|
-
|
|
1655
|
+
onClick,
|
|
1656
|
+
render,
|
|
1657
|
+
state = "default"
|
|
1696
1658
|
}) {
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1659
|
+
const isFunctionAction = typeof render === "function";
|
|
1660
|
+
const actionHandler = isFunctionAction ? render : onClick;
|
|
1661
|
+
const buttonRender = isFunctionAction ? void 0 : render;
|
|
1662
|
+
const hasAction = Boolean(buttonText || render || onClick);
|
|
1663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1664
|
+
Empty,
|
|
1665
|
+
{
|
|
1666
|
+
className: (0, import_cn13.cn)("w-full", state === "outline" && "border border-dashed"),
|
|
1667
|
+
children: [
|
|
1668
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(EmptyHeader, { children: [
|
|
1669
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EmptyMedia, { variant: "icon", children: renderStateIcon(icon) }),
|
|
1670
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EmptyTitle, { children: title }),
|
|
1671
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EmptyDescription, { children: description })
|
|
1672
|
+
] }),
|
|
1673
|
+
hasAction && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EmptyContent, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1674
|
+
Button,
|
|
1675
|
+
{
|
|
1676
|
+
variant: "outline",
|
|
1677
|
+
size: "sm",
|
|
1678
|
+
nativeButton: !buttonRender,
|
|
1679
|
+
onClick: actionHandler,
|
|
1680
|
+
render: buttonRender,
|
|
1681
|
+
children: buttonText
|
|
1682
|
+
}
|
|
1683
|
+
) })
|
|
1684
|
+
]
|
|
1685
|
+
}
|
|
1686
|
+
);
|
|
1687
|
+
});
|
|
1688
|
+
|
|
1689
|
+
// src/components/ui/table.tsx
|
|
1690
|
+
var import_cn14 = require("cn");
|
|
1691
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1692
|
+
function Table(_a) {
|
|
1693
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1695
|
+
"div",
|
|
1696
|
+
{
|
|
1697
|
+
"data-slot": "table-container",
|
|
1698
|
+
className: "relative w-full overflow-x-auto",
|
|
1699
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1700
|
+
"table",
|
|
1701
|
+
__spreadValues({
|
|
1702
|
+
"data-slot": "table",
|
|
1703
|
+
className: (0, import_cn14.cn)("w-full caption-bottom text-xs", className)
|
|
1704
|
+
}, props)
|
|
1705
|
+
)
|
|
1706
|
+
}
|
|
1707
|
+
);
|
|
1708
|
+
}
|
|
1709
|
+
function TableHeader(_a) {
|
|
1710
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1711
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1712
|
+
"thead",
|
|
1713
|
+
__spreadValues({
|
|
1714
|
+
"data-slot": "table-header",
|
|
1715
|
+
className: (0, import_cn14.cn)("[&_tr]:border-b", className)
|
|
1716
|
+
}, props)
|
|
1717
|
+
);
|
|
1718
|
+
}
|
|
1719
|
+
function TableBody(_a) {
|
|
1720
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1722
|
+
"tbody",
|
|
1723
|
+
__spreadValues({
|
|
1724
|
+
"data-slot": "table-body",
|
|
1725
|
+
className: (0, import_cn14.cn)("[&_tr:last-child]:border-0", className)
|
|
1726
|
+
}, props)
|
|
1727
|
+
);
|
|
1728
|
+
}
|
|
1729
|
+
function TableRow(_a) {
|
|
1730
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1732
|
+
"tr",
|
|
1733
|
+
__spreadValues({
|
|
1734
|
+
"data-slot": "table-row",
|
|
1735
|
+
className: (0, import_cn14.cn)(
|
|
1736
|
+
"border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",
|
|
1737
|
+
className
|
|
1738
|
+
)
|
|
1739
|
+
}, props)
|
|
1740
|
+
);
|
|
1741
|
+
}
|
|
1742
|
+
function TableHead(_a) {
|
|
1743
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1744
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1745
|
+
"th",
|
|
1746
|
+
__spreadValues({
|
|
1747
|
+
"data-slot": "table-head",
|
|
1748
|
+
className: (0, import_cn14.cn)(
|
|
1749
|
+
"h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",
|
|
1750
|
+
className
|
|
1751
|
+
)
|
|
1752
|
+
}, props)
|
|
1753
|
+
);
|
|
1754
|
+
}
|
|
1755
|
+
function TableCell(_a) {
|
|
1756
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1758
|
+
"td",
|
|
1759
|
+
__spreadValues({
|
|
1760
|
+
"data-slot": "table-cell",
|
|
1761
|
+
className: (0, import_cn14.cn)(
|
|
1762
|
+
"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",
|
|
1763
|
+
className
|
|
1764
|
+
)
|
|
1765
|
+
}, props)
|
|
1766
|
+
);
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
// src/components/composed/data-table/data-table-features.ts
|
|
1770
|
+
var import_react_table = require("@tanstack/react-table");
|
|
1771
|
+
var features = (0, import_react_table.tableFeatures)({
|
|
1772
|
+
// Filter features
|
|
1773
|
+
columnFilteringFeature: import_react_table.columnFilteringFeature,
|
|
1774
|
+
globalFilteringFeature: import_react_table.globalFilteringFeature,
|
|
1775
|
+
// Visibility & selection features
|
|
1776
|
+
columnVisibilityFeature: import_react_table.columnVisibilityFeature,
|
|
1777
|
+
rowSelectionFeature: import_react_table.rowSelectionFeature,
|
|
1778
|
+
// Pagination & sorting features
|
|
1779
|
+
rowPaginationFeature: import_react_table.rowPaginationFeature,
|
|
1780
|
+
rowSortingFeature: import_react_table.rowSortingFeature,
|
|
1781
|
+
// Row models
|
|
1782
|
+
filteredRowModel: (0, import_react_table.createFilteredRowModel)(),
|
|
1783
|
+
paginatedRowModel: (0, import_react_table.createPaginatedRowModel)(),
|
|
1784
|
+
sortedRowModel: (0, import_react_table.createSortedRowModel)(),
|
|
1785
|
+
// Custom/standard functions
|
|
1786
|
+
filterFns: {
|
|
1787
|
+
includesString: import_react_table.filterFn_includesString
|
|
1788
|
+
},
|
|
1789
|
+
sortFns: {
|
|
1790
|
+
alphanumeric: import_react_table.sortFn_alphanumeric,
|
|
1791
|
+
text: import_react_table.sortFn_text
|
|
1792
|
+
}
|
|
1793
|
+
});
|
|
1794
|
+
|
|
1795
|
+
// src/components/composed/data-table/table-content-body.tsx
|
|
1796
|
+
var import_react_table2 = require("@tanstack/react-table");
|
|
1797
|
+
var import_lucide_react6 = require("lucide-react");
|
|
1798
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1799
|
+
function DataTableContentBody({
|
|
1800
|
+
table,
|
|
1801
|
+
columns
|
|
1802
|
+
}) {
|
|
1803
|
+
const rows = table.getRowModel().rows;
|
|
1804
|
+
if (rows == null ? void 0 : rows.length) {
|
|
1805
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TableBody, { children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TableRow, { children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TableCell, { children: (0, import_react_table2.flexRender)(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) });
|
|
1806
|
+
}
|
|
1807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TableBody, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TableCell, { colSpan: columns.length, className: "h-48 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1808
|
+
StateEmpty,
|
|
1809
|
+
{
|
|
1810
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react6.SearchXIcon, {}),
|
|
1811
|
+
title: "No matching results",
|
|
1812
|
+
description: "No records matched your search query or filter criteria.",
|
|
1813
|
+
buttonText: "Clear search & filters",
|
|
1814
|
+
render: () => {
|
|
1815
|
+
table.setGlobalFilter("");
|
|
1816
|
+
table.resetColumnFilters();
|
|
1711
1817
|
}
|
|
1712
|
-
|
|
1818
|
+
}
|
|
1819
|
+
) }) }) });
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
// src/components/composed/data-table/table-content-header.tsx
|
|
1823
|
+
var import_react_table3 = require("@tanstack/react-table");
|
|
1824
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1825
|
+
function DataTableContentHeader({
|
|
1826
|
+
table
|
|
1827
|
+
}) {
|
|
1828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TableRow, { children: headerGroup.headers.map((header) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TableHead, { children: header.isPlaceholder ? null : (0, import_react_table3.flexRender)(
|
|
1829
|
+
header.column.columnDef.header,
|
|
1830
|
+
header.getContext()
|
|
1831
|
+
) }, header.id)) }, headerGroup.id)) });
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
// src/components/composed/data-table/table-footer-entries.tsx
|
|
1835
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1836
|
+
function DataTableFooterEntries({
|
|
1837
|
+
table
|
|
1838
|
+
}) {
|
|
1839
|
+
var _a, _b, _c;
|
|
1840
|
+
const pagination = (_a = table.options.state) == null ? void 0 : _a.pagination;
|
|
1841
|
+
const pageIndex = (_b = pagination == null ? void 0 : pagination.pageIndex) != null ? _b : 0;
|
|
1842
|
+
const pageSize = (_c = pagination == null ? void 0 : pagination.pageSize) != null ? _c : 10;
|
|
1843
|
+
const totalRows = table.getFilteredRowModel().rows.length;
|
|
1844
|
+
const startRow = totalRows === 0 ? 0 : pageIndex * pageSize + 1;
|
|
1845
|
+
const endRow = Math.min((pageIndex + 1) * pageSize, totalRows);
|
|
1846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex-1 text-xs text-muted-foreground", children: [
|
|
1847
|
+
"Showing",
|
|
1848
|
+
" ",
|
|
1849
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "font-medium text-foreground", children: [
|
|
1850
|
+
startRow,
|
|
1851
|
+
"-",
|
|
1852
|
+
endRow
|
|
1853
|
+
] }),
|
|
1854
|
+
" ",
|
|
1855
|
+
"of ",
|
|
1856
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-medium text-foreground", children: totalRows }),
|
|
1857
|
+
" ",
|
|
1858
|
+
"entries."
|
|
1859
|
+
] });
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
// src/components/composed/data-table/table-footer-pagination.tsx
|
|
1863
|
+
var import_lucide_react7 = require("lucide-react");
|
|
1864
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1865
|
+
function DataTableFooterPagination({
|
|
1866
|
+
table
|
|
1867
|
+
}) {
|
|
1868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1869
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Tooltip, { children: [
|
|
1870
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1871
|
+
TooltipTrigger,
|
|
1872
|
+
{
|
|
1873
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1874
|
+
Button,
|
|
1875
|
+
{
|
|
1876
|
+
variant: "outline",
|
|
1877
|
+
size: "icon-xs",
|
|
1878
|
+
onClick: () => table.firstPage(),
|
|
1879
|
+
disabled: !table.getCanPreviousPage(),
|
|
1880
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react7.ChevronsLeftIcon, {})
|
|
1881
|
+
}
|
|
1882
|
+
)
|
|
1883
|
+
}
|
|
1884
|
+
),
|
|
1885
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TooltipContent, { children: "Go to first page" })
|
|
1886
|
+
] }),
|
|
1887
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Tooltip, { children: [
|
|
1888
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1889
|
+
TooltipTrigger,
|
|
1890
|
+
{
|
|
1891
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1892
|
+
Button,
|
|
1893
|
+
{
|
|
1894
|
+
variant: "outline",
|
|
1895
|
+
size: "icon-xs",
|
|
1896
|
+
onClick: () => table.previousPage(),
|
|
1897
|
+
disabled: !table.getCanPreviousPage(),
|
|
1898
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react7.ChevronLeftIcon, {})
|
|
1899
|
+
}
|
|
1900
|
+
)
|
|
1901
|
+
}
|
|
1902
|
+
),
|
|
1903
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TooltipContent, { children: "Go to previous page" })
|
|
1904
|
+
] }),
|
|
1905
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Tooltip, { children: [
|
|
1906
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1907
|
+
TooltipTrigger,
|
|
1908
|
+
{
|
|
1909
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1910
|
+
Button,
|
|
1911
|
+
{
|
|
1912
|
+
variant: "outline",
|
|
1913
|
+
size: "icon-xs",
|
|
1914
|
+
onClick: () => table.nextPage(),
|
|
1915
|
+
disabled: !table.getCanNextPage(),
|
|
1916
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react7.ChevronRightIcon, {})
|
|
1917
|
+
}
|
|
1918
|
+
)
|
|
1919
|
+
}
|
|
1920
|
+
),
|
|
1921
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TooltipContent, { children: "Go to next page" })
|
|
1922
|
+
] }),
|
|
1923
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Tooltip, { children: [
|
|
1924
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1925
|
+
TooltipTrigger,
|
|
1926
|
+
{
|
|
1927
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1928
|
+
Button,
|
|
1929
|
+
{
|
|
1930
|
+
variant: "outline",
|
|
1931
|
+
size: "icon-xs",
|
|
1932
|
+
onClick: () => table.lastPage(),
|
|
1933
|
+
disabled: !table.getCanNextPage(),
|
|
1934
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react7.ChevronsRightIcon, {})
|
|
1935
|
+
}
|
|
1936
|
+
)
|
|
1937
|
+
}
|
|
1938
|
+
),
|
|
1939
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TooltipContent, { children: "Go to last page" })
|
|
1940
|
+
] })
|
|
1941
|
+
] });
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
// src/components/composed/data-table/table-header-add.tsx
|
|
1945
|
+
var import_lucide_react8 = require("lucide-react");
|
|
1946
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1947
|
+
function DataTableHeaderAdd({
|
|
1948
|
+
onAdd,
|
|
1949
|
+
addLabel
|
|
1950
|
+
}) {
|
|
1951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
1952
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Tooltip, { children: [
|
|
1953
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1954
|
+
TooltipTrigger,
|
|
1955
|
+
{
|
|
1956
|
+
className: "flex sm:hidden",
|
|
1957
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { variant: "default", size: "icon", onClick: onAdd, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.PlusIcon, {}) })
|
|
1958
|
+
}
|
|
1959
|
+
),
|
|
1960
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TooltipContent, { children: addLabel != null ? addLabel : "Add" })
|
|
1961
|
+
] }),
|
|
1962
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Button, { variant: "default", onClick: onAdd, className: "hidden sm:flex", children: [
|
|
1963
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.PlusIcon, {}),
|
|
1964
|
+
addLabel != null ? addLabel : "Add"
|
|
1965
|
+
] })
|
|
1966
|
+
] });
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
// src/components/composed/data-table/table-header-download.tsx
|
|
1970
|
+
var import_lucide_react9 = require("lucide-react");
|
|
1971
|
+
|
|
1972
|
+
// src/components/composed/data-table/export.ts
|
|
1973
|
+
var XLSX = __toESM(require("xlsx"));
|
|
1974
|
+
function normalizeRows(rows) {
|
|
1975
|
+
return rows.map((row) => {
|
|
1976
|
+
var _a, _b, _c;
|
|
1977
|
+
const flat = {};
|
|
1978
|
+
for (const [key, value] of Object.entries(row)) {
|
|
1979
|
+
if (value === null || value === void 0) {
|
|
1980
|
+
flat[key] = "";
|
|
1981
|
+
} else if (Array.isArray(value)) {
|
|
1982
|
+
flat[key] = value.map((item) => {
|
|
1983
|
+
var _a2, _b2, _c2;
|
|
1984
|
+
if (item === null || item === void 0) return "";
|
|
1985
|
+
if (typeof item === "object") {
|
|
1986
|
+
const record = item;
|
|
1987
|
+
return (_c2 = (_b2 = (_a2 = record.name) != null ? _a2 : record.label) != null ? _b2 : record.email) != null ? _c2 : JSON.stringify(item);
|
|
1988
|
+
}
|
|
1989
|
+
return String(item);
|
|
1990
|
+
}).filter(Boolean).join(", ");
|
|
1991
|
+
} else if (typeof value === "object") {
|
|
1992
|
+
const record = value;
|
|
1993
|
+
flat[key] = (_c = (_b = (_a = record.name) != null ? _a : record.label) != null ? _b : record.email) != null ? _c : JSON.stringify(value);
|
|
1994
|
+
} else {
|
|
1995
|
+
flat[key] = String(value);
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
return flat;
|
|
1999
|
+
});
|
|
2000
|
+
}
|
|
2001
|
+
function escapeHtml(str) {
|
|
2002
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
2003
|
+
}
|
|
2004
|
+
function exportToXLSX(rows, filename = "data-export") {
|
|
2005
|
+
const normalized = normalizeRows(rows);
|
|
2006
|
+
const worksheet = XLSX.utils.json_to_sheet(normalized);
|
|
2007
|
+
const workbook = XLSX.utils.book_new();
|
|
2008
|
+
XLSX.utils.book_append_sheet(workbook, worksheet, "Sheet1");
|
|
2009
|
+
const finalFilename = filename.endsWith(".xlsx") ? filename : `${filename}.xlsx`;
|
|
2010
|
+
XLSX.writeFile(workbook, finalFilename);
|
|
2011
|
+
}
|
|
2012
|
+
function exportToCSV(rows, filename = "data-export") {
|
|
2013
|
+
const normalized = normalizeRows(rows);
|
|
2014
|
+
const worksheet = XLSX.utils.json_to_sheet(normalized);
|
|
2015
|
+
const csvString = XLSX.utils.sheet_to_csv(worksheet);
|
|
2016
|
+
const blob = new Blob([`\uFEFF${csvString}`], {
|
|
2017
|
+
type: "text/csv;charset=utf-8;"
|
|
2018
|
+
});
|
|
2019
|
+
const url = URL.createObjectURL(blob);
|
|
2020
|
+
const link = document.createElement("a");
|
|
2021
|
+
link.href = url;
|
|
2022
|
+
const finalFilename = filename.endsWith(".csv") ? filename : `${filename}.csv`;
|
|
2023
|
+
link.setAttribute("download", finalFilename);
|
|
2024
|
+
document.body.appendChild(link);
|
|
2025
|
+
link.click();
|
|
2026
|
+
document.body.removeChild(link);
|
|
2027
|
+
setTimeout(() => {
|
|
2028
|
+
URL.revokeObjectURL(url);
|
|
2029
|
+
}, 1e3);
|
|
2030
|
+
}
|
|
2031
|
+
async function exportToPDF(headers, rows, filename = "data-export", title = "Data Export") {
|
|
2032
|
+
const [{ jsPDF }, autoTableMod] = await Promise.all([
|
|
2033
|
+
import("jspdf"),
|
|
2034
|
+
import("jspdf-autotable")
|
|
2035
|
+
]);
|
|
2036
|
+
const autoTable = autoTableMod.autoTable || autoTableMod.default;
|
|
2037
|
+
const orientation = headers.length > 5 ? "landscape" : "portrait";
|
|
2038
|
+
const doc = new jsPDF({ orientation });
|
|
2039
|
+
doc.setFontSize(14);
|
|
2040
|
+
doc.setFont("helvetica", "bold");
|
|
2041
|
+
doc.text(title, 14, 15);
|
|
2042
|
+
doc.setFontSize(8);
|
|
2043
|
+
doc.setFont("helvetica", "normal");
|
|
2044
|
+
doc.setTextColor(120);
|
|
2045
|
+
doc.text(`Generated on ${(/* @__PURE__ */ new Date()).toLocaleString()}`, 14, 20);
|
|
2046
|
+
autoTable(doc, {
|
|
2047
|
+
head: [headers],
|
|
2048
|
+
body: rows,
|
|
2049
|
+
startY: 24,
|
|
2050
|
+
styles: {
|
|
2051
|
+
fontSize: 8,
|
|
2052
|
+
cellPadding: 2.5
|
|
2053
|
+
},
|
|
2054
|
+
headStyles: {
|
|
2055
|
+
fillColor: [40, 40, 40],
|
|
2056
|
+
textColor: [255, 255, 255],
|
|
2057
|
+
fontStyle: "bold"
|
|
2058
|
+
},
|
|
2059
|
+
alternateRowStyles: {
|
|
2060
|
+
fillColor: [248, 248, 248]
|
|
2061
|
+
}
|
|
2062
|
+
});
|
|
2063
|
+
const finalFilename = filename.endsWith(".pdf") ? filename : `${filename}.pdf`;
|
|
2064
|
+
doc.save(finalFilename);
|
|
2065
|
+
}
|
|
2066
|
+
function printTable(headers, rows, title = "Data Export") {
|
|
2067
|
+
let tableHtml = `<table style="width:100%; border-collapse:collapse; font-family:sans-serif; font-size:12px;"><thead><tr>`;
|
|
2068
|
+
for (const header of headers) {
|
|
2069
|
+
tableHtml += `<th style="border:1px solid #ddd; padding:8px; background-color:#f8f9fa; text-align:left;">${escapeHtml(header)}</th>`;
|
|
2070
|
+
}
|
|
2071
|
+
tableHtml += `</tr></thead><tbody>`;
|
|
2072
|
+
for (const row of rows) {
|
|
2073
|
+
tableHtml += `<tr>`;
|
|
2074
|
+
for (const cell of row) {
|
|
2075
|
+
tableHtml += `<td style="border:1px solid #ddd; padding:8px;">${escapeHtml(cell != null ? cell : "")}</td>`;
|
|
2076
|
+
}
|
|
2077
|
+
tableHtml += `</tr>`;
|
|
2078
|
+
}
|
|
2079
|
+
tableHtml += `</tbody></table>`;
|
|
2080
|
+
const printWindow = window.open("", "_blank");
|
|
2081
|
+
if (!printWindow) return;
|
|
2082
|
+
printWindow.document.write(`
|
|
2083
|
+
<!DOCTYPE html>
|
|
2084
|
+
<html>
|
|
2085
|
+
<head>
|
|
2086
|
+
<title>${escapeHtml(title)}</title>
|
|
2087
|
+
<style>
|
|
2088
|
+
body { font-family: sans-serif; padding: 20px; color: #333; }
|
|
2089
|
+
h2 { margin-bottom: 6px; font-size: 18px; }
|
|
2090
|
+
.meta { font-size: 11px; color: #666; margin-bottom: 16px; }
|
|
2091
|
+
@page { size: auto; margin: 15mm; }
|
|
2092
|
+
</style>
|
|
2093
|
+
</head>
|
|
2094
|
+
<body>
|
|
2095
|
+
<h2>${escapeHtml(title)}</h2>
|
|
2096
|
+
<div class="meta">Generated on ${(/* @__PURE__ */ new Date()).toLocaleString()}</div>
|
|
2097
|
+
${tableHtml}
|
|
2098
|
+
</body>
|
|
2099
|
+
</html>
|
|
2100
|
+
`);
|
|
2101
|
+
printWindow.document.close();
|
|
2102
|
+
printWindow.focus();
|
|
2103
|
+
setTimeout(() => {
|
|
2104
|
+
printWindow.print();
|
|
2105
|
+
printWindow.close();
|
|
2106
|
+
}, 250);
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
// src/components/composed/data-table/table-header-download.tsx
|
|
2110
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2111
|
+
function getTableExportData(table) {
|
|
2112
|
+
const columns = table.getAllColumns().filter(
|
|
2113
|
+
(col) => typeof col.accessorFn !== "undefined" && col.getIsVisible()
|
|
2114
|
+
);
|
|
2115
|
+
const headers = columns.map(
|
|
2116
|
+
(col) => typeof col.columnDef.header === "string" ? col.columnDef.header : col.id
|
|
2117
|
+
);
|
|
2118
|
+
const filteredRows = table.getFilteredRowModel().rows;
|
|
2119
|
+
const rows = filteredRows.map(
|
|
2120
|
+
(row) => headers.map((_, i) => {
|
|
2121
|
+
var _a, _b;
|
|
2122
|
+
const col = columns[i];
|
|
2123
|
+
const value = row.getValue(col.id);
|
|
2124
|
+
if (value === null || value === void 0) return "";
|
|
2125
|
+
if (Array.isArray(value)) {
|
|
2126
|
+
return value.map(
|
|
2127
|
+
(item) => {
|
|
2128
|
+
var _a2, _b2;
|
|
2129
|
+
return typeof item === "object" && item !== null ? (_b2 = (_a2 = item.name) != null ? _a2 : item.email) != null ? _b2 : JSON.stringify(item) : String(item);
|
|
2130
|
+
}
|
|
2131
|
+
).join(", ");
|
|
2132
|
+
}
|
|
2133
|
+
if (typeof value === "object") {
|
|
2134
|
+
return (_b = (_a = value.name) != null ? _a : value.email) != null ? _b : JSON.stringify(value);
|
|
2135
|
+
}
|
|
2136
|
+
return String(value);
|
|
2137
|
+
})
|
|
2138
|
+
);
|
|
2139
|
+
const rowObjects = filteredRows.map((_, rowIndex) => {
|
|
2140
|
+
const obj = {};
|
|
2141
|
+
for (let i = 0; i < columns.length; i++) {
|
|
2142
|
+
obj[headers[i]] = rows[rowIndex][i];
|
|
2143
|
+
}
|
|
2144
|
+
return obj;
|
|
2145
|
+
});
|
|
2146
|
+
return { headers, rows, rowObjects };
|
|
2147
|
+
}
|
|
2148
|
+
function DataTableHeaderDownload({
|
|
2149
|
+
table,
|
|
2150
|
+
exportFilename,
|
|
2151
|
+
onDownload
|
|
2152
|
+
}) {
|
|
2153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { children: [
|
|
2154
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
|
|
2155
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2156
|
+
DropdownMenuTrigger,
|
|
2157
|
+
{
|
|
2158
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2159
|
+
TooltipTrigger,
|
|
2160
|
+
{
|
|
2161
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button, { variant: "outline", size: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.DownloadIcon, {}) })
|
|
2162
|
+
}
|
|
2163
|
+
)
|
|
2164
|
+
}
|
|
2165
|
+
),
|
|
2166
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { children: "Download options" })
|
|
2167
|
+
] }),
|
|
2168
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", className: "w-48", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenuGroup, { children: [
|
|
2169
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuLabel, { children: "Download data" }),
|
|
2170
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuSeparator, {}),
|
|
2171
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2172
|
+
DropdownMenuItem,
|
|
2173
|
+
{
|
|
2174
|
+
className: "hover:cursor-pointer",
|
|
2175
|
+
onClick: async () => {
|
|
2176
|
+
const { headers, rows } = getTableExportData(table);
|
|
2177
|
+
await exportToPDF(headers, rows, exportFilename);
|
|
2178
|
+
onDownload == null ? void 0 : onDownload();
|
|
2179
|
+
},
|
|
2180
|
+
children: [
|
|
2181
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.FileTextIcon, {}),
|
|
2182
|
+
"Download PDF"
|
|
2183
|
+
]
|
|
2184
|
+
}
|
|
2185
|
+
),
|
|
2186
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2187
|
+
DropdownMenuItem,
|
|
2188
|
+
{
|
|
2189
|
+
className: "hover:cursor-pointer",
|
|
2190
|
+
onClick: () => {
|
|
2191
|
+
const { rowObjects } = getTableExportData(table);
|
|
2192
|
+
exportToXLSX(rowObjects, exportFilename);
|
|
2193
|
+
onDownload == null ? void 0 : onDownload();
|
|
2194
|
+
},
|
|
2195
|
+
children: [
|
|
2196
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.FileSpreadsheetIcon, {}),
|
|
2197
|
+
"Download Excel"
|
|
2198
|
+
]
|
|
2199
|
+
}
|
|
2200
|
+
),
|
|
2201
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2202
|
+
DropdownMenuItem,
|
|
2203
|
+
{
|
|
2204
|
+
className: "hover:cursor-pointer",
|
|
2205
|
+
onClick: () => {
|
|
2206
|
+
const { rowObjects } = getTableExportData(table);
|
|
2207
|
+
exportToCSV(rowObjects, exportFilename);
|
|
2208
|
+
onDownload == null ? void 0 : onDownload();
|
|
2209
|
+
},
|
|
2210
|
+
children: [
|
|
2211
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.FileCodeIcon, {}),
|
|
2212
|
+
"Download CSV"
|
|
2213
|
+
]
|
|
2214
|
+
}
|
|
2215
|
+
),
|
|
2216
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuSeparator, {}),
|
|
2217
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2218
|
+
DropdownMenuItem,
|
|
2219
|
+
{
|
|
2220
|
+
className: "hover:cursor-pointer",
|
|
2221
|
+
onClick: () => {
|
|
2222
|
+
const { headers, rows } = getTableExportData(table);
|
|
2223
|
+
printTable(headers, rows, exportFilename);
|
|
2224
|
+
},
|
|
2225
|
+
children: [
|
|
2226
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.PrinterIcon, {}),
|
|
2227
|
+
"Print Table"
|
|
2228
|
+
]
|
|
2229
|
+
}
|
|
2230
|
+
)
|
|
2231
|
+
] }) })
|
|
2232
|
+
] });
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
// src/components/composed/data-table/table-header-filter.tsx
|
|
2236
|
+
var import_date_fns = require("date-fns");
|
|
2237
|
+
var import_lucide_react12 = require("lucide-react");
|
|
2238
|
+
var import_react3 = require("react");
|
|
2239
|
+
|
|
2240
|
+
// src/components/ui/calendar.tsx
|
|
2241
|
+
var import_cn15 = require("cn");
|
|
2242
|
+
var import_lucide_react10 = require("lucide-react");
|
|
2243
|
+
var React3 = __toESM(require("react"));
|
|
2244
|
+
var import_react_day_picker = require("react-day-picker");
|
|
2245
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2246
|
+
function Calendar(_a) {
|
|
2247
|
+
var _b = _a, {
|
|
2248
|
+
className,
|
|
2249
|
+
classNames,
|
|
2250
|
+
showOutsideDays = true,
|
|
2251
|
+
captionLayout = "label",
|
|
2252
|
+
buttonVariant = "ghost",
|
|
2253
|
+
locale,
|
|
2254
|
+
formatters,
|
|
2255
|
+
components
|
|
2256
|
+
} = _b, props = __objRest(_b, [
|
|
2257
|
+
"className",
|
|
2258
|
+
"classNames",
|
|
2259
|
+
"showOutsideDays",
|
|
2260
|
+
"captionLayout",
|
|
2261
|
+
"buttonVariant",
|
|
2262
|
+
"locale",
|
|
2263
|
+
"formatters",
|
|
2264
|
+
"components"
|
|
2265
|
+
]);
|
|
2266
|
+
const defaultClassNames = (0, import_react_day_picker.getDefaultClassNames)();
|
|
2267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2268
|
+
import_react_day_picker.DayPicker,
|
|
2269
|
+
__spreadValues({
|
|
2270
|
+
showOutsideDays,
|
|
2271
|
+
className: (0, import_cn15.cn)(
|
|
2272
|
+
"group/calendar bg-background p-3 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(6)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent",
|
|
2273
|
+
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
2274
|
+
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
2275
|
+
className
|
|
2276
|
+
),
|
|
2277
|
+
captionLayout,
|
|
2278
|
+
locale,
|
|
2279
|
+
formatters: __spreadValues({
|
|
2280
|
+
formatMonthDropdown: (date) => date.toLocaleString(locale == null ? void 0 : locale.code, { month: "short" })
|
|
2281
|
+
}, formatters),
|
|
2282
|
+
classNames: __spreadValues({
|
|
2283
|
+
root: (0, import_cn15.cn)("w-fit", defaultClassNames.root),
|
|
2284
|
+
months: (0, import_cn15.cn)(
|
|
2285
|
+
"relative flex flex-col gap-4 md:flex-row",
|
|
2286
|
+
defaultClassNames.months
|
|
2287
|
+
),
|
|
2288
|
+
month: (0, import_cn15.cn)("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
2289
|
+
nav: (0, import_cn15.cn)(
|
|
2290
|
+
"absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
|
|
2291
|
+
defaultClassNames.nav
|
|
2292
|
+
),
|
|
2293
|
+
button_previous: (0, import_cn15.cn)(
|
|
2294
|
+
buttonVariants({ variant: buttonVariant }),
|
|
2295
|
+
"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
|
|
2296
|
+
defaultClassNames.button_previous
|
|
2297
|
+
),
|
|
2298
|
+
button_next: (0, import_cn15.cn)(
|
|
2299
|
+
buttonVariants({ variant: buttonVariant }),
|
|
2300
|
+
"size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
|
|
2301
|
+
defaultClassNames.button_next
|
|
2302
|
+
),
|
|
2303
|
+
month_caption: (0, import_cn15.cn)(
|
|
2304
|
+
"flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",
|
|
2305
|
+
defaultClassNames.month_caption
|
|
2306
|
+
),
|
|
2307
|
+
dropdowns: (0, import_cn15.cn)(
|
|
2308
|
+
"flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",
|
|
2309
|
+
defaultClassNames.dropdowns
|
|
2310
|
+
),
|
|
2311
|
+
dropdown_root: (0, import_cn15.cn)(
|
|
2312
|
+
"relative rounded-(--cell-radius)",
|
|
2313
|
+
defaultClassNames.dropdown_root
|
|
2314
|
+
),
|
|
2315
|
+
dropdown: (0, import_cn15.cn)(
|
|
2316
|
+
"absolute inset-0 bg-popover opacity-0",
|
|
2317
|
+
defaultClassNames.dropdown
|
|
2318
|
+
),
|
|
2319
|
+
caption_label: (0, import_cn15.cn)(
|
|
2320
|
+
"font-medium select-none",
|
|
2321
|
+
captionLayout === "label" ? "text-sm" : "flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
|
|
2322
|
+
defaultClassNames.caption_label
|
|
2323
|
+
),
|
|
2324
|
+
month_grid: (0, import_cn15.cn)("w-full border-collapse", defaultClassNames.month_grid),
|
|
2325
|
+
weekdays: (0, import_cn15.cn)("flex", defaultClassNames.weekdays),
|
|
2326
|
+
weekday: (0, import_cn15.cn)(
|
|
2327
|
+
"flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none",
|
|
2328
|
+
defaultClassNames.weekday
|
|
2329
|
+
),
|
|
2330
|
+
week: (0, import_cn15.cn)("mt-2 flex w-full", defaultClassNames.week),
|
|
2331
|
+
week_number_header: (0, import_cn15.cn)(
|
|
2332
|
+
"w-(--cell-size) select-none",
|
|
2333
|
+
defaultClassNames.week_number_header
|
|
2334
|
+
),
|
|
2335
|
+
week_number: (0, import_cn15.cn)(
|
|
2336
|
+
"text-[0.8rem] text-muted-foreground select-none",
|
|
2337
|
+
defaultClassNames.week_number
|
|
2338
|
+
),
|
|
2339
|
+
day: (0, import_cn15.cn)(
|
|
2340
|
+
"group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)",
|
|
2341
|
+
props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)" : "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)",
|
|
2342
|
+
defaultClassNames.day
|
|
2343
|
+
),
|
|
2344
|
+
range_start: (0, import_cn15.cn)(
|
|
2345
|
+
"relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted",
|
|
2346
|
+
defaultClassNames.range_start
|
|
2347
|
+
),
|
|
2348
|
+
range_middle: (0, import_cn15.cn)("rounded-none", defaultClassNames.range_middle),
|
|
2349
|
+
range_end: (0, import_cn15.cn)(
|
|
2350
|
+
"relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted",
|
|
2351
|
+
defaultClassNames.range_end
|
|
2352
|
+
),
|
|
2353
|
+
today: (0, import_cn15.cn)(
|
|
2354
|
+
"rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none",
|
|
2355
|
+
defaultClassNames.today
|
|
2356
|
+
),
|
|
2357
|
+
outside: (0, import_cn15.cn)(
|
|
2358
|
+
"text-muted-foreground aria-selected:text-muted-foreground",
|
|
2359
|
+
defaultClassNames.outside
|
|
2360
|
+
),
|
|
2361
|
+
disabled: (0, import_cn15.cn)(
|
|
2362
|
+
"text-muted-foreground opacity-50",
|
|
2363
|
+
defaultClassNames.disabled
|
|
2364
|
+
),
|
|
2365
|
+
hidden: (0, import_cn15.cn)("invisible", defaultClassNames.hidden)
|
|
2366
|
+
}, classNames),
|
|
2367
|
+
components: __spreadValues({
|
|
2368
|
+
Root: (_a2) => {
|
|
2369
|
+
var _b2 = _a2, { className: className2, rootRef } = _b2, props2 = __objRest(_b2, ["className", "rootRef"]);
|
|
2370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2371
|
+
"div",
|
|
2372
|
+
__spreadValues({
|
|
2373
|
+
"data-slot": "calendar",
|
|
2374
|
+
ref: rootRef,
|
|
2375
|
+
className: (0, import_cn15.cn)(className2)
|
|
2376
|
+
}, props2)
|
|
2377
|
+
);
|
|
2378
|
+
},
|
|
2379
|
+
Chevron: (_c) => {
|
|
2380
|
+
var _d = _c, { className: className2, orientation } = _d, props2 = __objRest(_d, ["className", "orientation"]);
|
|
2381
|
+
if (orientation === "left") {
|
|
2382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ChevronLeftIcon, __spreadValues({ className: (0, import_cn15.cn)("size-4", className2) }, props2));
|
|
2383
|
+
}
|
|
2384
|
+
if (orientation === "right") {
|
|
2385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2386
|
+
import_lucide_react10.ChevronRightIcon,
|
|
2387
|
+
__spreadValues({
|
|
2388
|
+
className: (0, import_cn15.cn)("size-4", className2)
|
|
2389
|
+
}, props2)
|
|
2390
|
+
);
|
|
2391
|
+
}
|
|
2392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ChevronDownIcon, __spreadValues({ className: (0, import_cn15.cn)("size-4", className2) }, props2));
|
|
2393
|
+
},
|
|
2394
|
+
DayButton: (_e) => {
|
|
2395
|
+
var props2 = __objRest(_e, []);
|
|
2396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CalendarDayButton, __spreadValues({ locale }, props2));
|
|
2397
|
+
},
|
|
2398
|
+
WeekNumber: (_f) => {
|
|
2399
|
+
var _g = _f, { children } = _g, props2 = __objRest(_g, ["children"]);
|
|
2400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("td", __spreadProps(__spreadValues({}, props2), { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children }) }));
|
|
2401
|
+
}
|
|
2402
|
+
}, components)
|
|
2403
|
+
}, props)
|
|
2404
|
+
);
|
|
2405
|
+
}
|
|
2406
|
+
function CalendarDayButton(_a) {
|
|
2407
|
+
var _b = _a, {
|
|
2408
|
+
className,
|
|
2409
|
+
day,
|
|
2410
|
+
modifiers,
|
|
2411
|
+
locale
|
|
2412
|
+
} = _b, props = __objRest(_b, [
|
|
2413
|
+
"className",
|
|
2414
|
+
"day",
|
|
2415
|
+
"modifiers",
|
|
2416
|
+
"locale"
|
|
2417
|
+
]);
|
|
2418
|
+
const defaultClassNames = (0, import_react_day_picker.getDefaultClassNames)();
|
|
2419
|
+
const ref = React3.useRef(null);
|
|
2420
|
+
React3.useEffect(() => {
|
|
2421
|
+
var _a2;
|
|
2422
|
+
if (modifiers.focused) (_a2 = ref.current) == null ? void 0 : _a2.focus();
|
|
2423
|
+
}, [modifiers.focused]);
|
|
2424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2425
|
+
Button,
|
|
2426
|
+
__spreadValues({
|
|
2427
|
+
variant: "ghost",
|
|
2428
|
+
size: "icon",
|
|
2429
|
+
"data-day": day.date.toLocaleDateString(locale == null ? void 0 : locale.code),
|
|
2430
|
+
"data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
|
|
2431
|
+
"data-range-start": modifiers.range_start,
|
|
2432
|
+
"data-range-end": modifiers.range_end,
|
|
2433
|
+
"data-range-middle": modifiers.range_middle,
|
|
2434
|
+
className: (0, import_cn15.cn)(
|
|
2435
|
+
"relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70",
|
|
2436
|
+
defaultClassNames.day,
|
|
2437
|
+
className
|
|
2438
|
+
)
|
|
2439
|
+
}, props)
|
|
2440
|
+
);
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2443
|
+
// src/components/ui/popover.tsx
|
|
2444
|
+
var import_popover = require("@base-ui/react/popover");
|
|
2445
|
+
var import_cn16 = require("cn");
|
|
2446
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2447
|
+
function Popover(_a) {
|
|
2448
|
+
var props = __objRest(_a, []);
|
|
2449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_popover.Popover.Root, __spreadValues({ "data-slot": "popover" }, props));
|
|
2450
|
+
}
|
|
2451
|
+
function PopoverTrigger(_a) {
|
|
2452
|
+
var props = __objRest(_a, []);
|
|
2453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_popover.Popover.Trigger, __spreadValues({ "data-slot": "popover-trigger" }, props));
|
|
2454
|
+
}
|
|
2455
|
+
function PopoverContent(_a) {
|
|
2456
|
+
var _b = _a, {
|
|
2457
|
+
className,
|
|
2458
|
+
align = "center",
|
|
2459
|
+
alignOffset = 0,
|
|
2460
|
+
side = "bottom",
|
|
2461
|
+
sideOffset = 4
|
|
2462
|
+
} = _b, props = __objRest(_b, [
|
|
2463
|
+
"className",
|
|
2464
|
+
"align",
|
|
2465
|
+
"alignOffset",
|
|
2466
|
+
"side",
|
|
2467
|
+
"sideOffset"
|
|
2468
|
+
]);
|
|
2469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_popover.Popover.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2470
|
+
import_popover.Popover.Positioner,
|
|
2471
|
+
{
|
|
2472
|
+
align,
|
|
2473
|
+
alignOffset,
|
|
2474
|
+
side,
|
|
2475
|
+
sideOffset,
|
|
2476
|
+
className: "isolate z-50",
|
|
2477
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2478
|
+
import_popover.Popover.Popup,
|
|
2479
|
+
__spreadValues({
|
|
2480
|
+
"data-slot": "popover-content",
|
|
2481
|
+
className: (0, import_cn16.cn)(
|
|
2482
|
+
"z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-lg bg-popover p-2.5 text-xs text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
2483
|
+
className
|
|
2484
|
+
)
|
|
2485
|
+
}, props)
|
|
2486
|
+
)
|
|
2487
|
+
}
|
|
2488
|
+
) });
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
// src/components/ui/select.tsx
|
|
2492
|
+
var import_select = require("@base-ui/react/select");
|
|
2493
|
+
var import_cn17 = require("cn");
|
|
2494
|
+
var import_lucide_react11 = require("lucide-react");
|
|
2495
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2496
|
+
var Select = import_select.Select.Root;
|
|
2497
|
+
function SelectValue(_a) {
|
|
2498
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2499
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2500
|
+
import_select.Select.Value,
|
|
2501
|
+
__spreadValues({
|
|
2502
|
+
"data-slot": "select-value",
|
|
2503
|
+
className: (0, import_cn17.cn)("flex flex-1 text-left", className)
|
|
2504
|
+
}, props)
|
|
2505
|
+
);
|
|
2506
|
+
}
|
|
2507
|
+
function SelectTrigger(_a) {
|
|
2508
|
+
var _b = _a, {
|
|
2509
|
+
className,
|
|
2510
|
+
size = "default",
|
|
2511
|
+
children
|
|
2512
|
+
} = _b, props = __objRest(_b, [
|
|
2513
|
+
"className",
|
|
2514
|
+
"size",
|
|
2515
|
+
"children"
|
|
2516
|
+
]);
|
|
2517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2518
|
+
import_select.Select.Trigger,
|
|
2519
|
+
__spreadProps(__spreadValues({
|
|
2520
|
+
"data-slot": "select-trigger",
|
|
2521
|
+
"data-size": size,
|
|
2522
|
+
className: (0, import_cn17.cn)(
|
|
2523
|
+
"flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-input/20 px-2 py-1.5 text-xs/relaxed whitespace-nowrap transition-colors outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-7 data-[size=sm]:h-6 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
|
|
2524
|
+
className
|
|
2525
|
+
)
|
|
2526
|
+
}, props), {
|
|
2527
|
+
children: [
|
|
2528
|
+
children,
|
|
2529
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2530
|
+
import_select.Select.Icon,
|
|
2531
|
+
{
|
|
2532
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.ChevronDownIcon, { className: "pointer-events-none size-3.5 text-muted-foreground" })
|
|
2533
|
+
}
|
|
2534
|
+
)
|
|
2535
|
+
]
|
|
2536
|
+
})
|
|
2537
|
+
);
|
|
2538
|
+
}
|
|
2539
|
+
function SelectContent(_a) {
|
|
2540
|
+
var _b = _a, {
|
|
2541
|
+
className,
|
|
2542
|
+
children,
|
|
2543
|
+
side = "bottom",
|
|
2544
|
+
sideOffset = 4,
|
|
2545
|
+
align = "center",
|
|
2546
|
+
alignOffset = 0,
|
|
2547
|
+
alignItemWithTrigger = true
|
|
2548
|
+
} = _b, props = __objRest(_b, [
|
|
2549
|
+
"className",
|
|
2550
|
+
"children",
|
|
2551
|
+
"side",
|
|
2552
|
+
"sideOffset",
|
|
2553
|
+
"align",
|
|
2554
|
+
"alignOffset",
|
|
2555
|
+
"alignItemWithTrigger"
|
|
2556
|
+
]);
|
|
2557
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_select.Select.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2558
|
+
import_select.Select.Positioner,
|
|
2559
|
+
{
|
|
2560
|
+
side,
|
|
2561
|
+
sideOffset,
|
|
2562
|
+
align,
|
|
2563
|
+
alignOffset,
|
|
2564
|
+
alignItemWithTrigger,
|
|
2565
|
+
className: "isolate z-50",
|
|
2566
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2567
|
+
import_select.Select.Popup,
|
|
2568
|
+
__spreadProps(__spreadValues({
|
|
2569
|
+
"data-slot": "select-content",
|
|
2570
|
+
"data-align-trigger": alignItemWithTrigger,
|
|
2571
|
+
className: (0, import_cn17.cn)(
|
|
2572
|
+
"relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
2573
|
+
className
|
|
2574
|
+
)
|
|
2575
|
+
}, props), {
|
|
2576
|
+
children: [
|
|
2577
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SelectScrollUpButton, {}),
|
|
2578
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_select.Select.List, { children }),
|
|
2579
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SelectScrollDownButton, {})
|
|
2580
|
+
]
|
|
2581
|
+
})
|
|
2582
|
+
)
|
|
2583
|
+
}
|
|
2584
|
+
) });
|
|
2585
|
+
}
|
|
2586
|
+
function SelectItem(_a) {
|
|
2587
|
+
var _b = _a, {
|
|
2588
|
+
className,
|
|
2589
|
+
children
|
|
2590
|
+
} = _b, props = __objRest(_b, [
|
|
2591
|
+
"className",
|
|
2592
|
+
"children"
|
|
2593
|
+
]);
|
|
2594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2595
|
+
import_select.Select.Item,
|
|
2596
|
+
__spreadProps(__spreadValues({
|
|
2597
|
+
"data-slot": "select-item",
|
|
2598
|
+
className: (0, import_cn17.cn)(
|
|
2599
|
+
"relative flex min-h-7 w-full cursor-default items-center gap-2 rounded-md px-2 py-1 text-xs/relaxed outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
2600
|
+
className
|
|
2601
|
+
)
|
|
2602
|
+
}, props), {
|
|
2603
|
+
children: [
|
|
2604
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_select.Select.ItemText, { className: "flex flex-1 shrink-0 gap-2 whitespace-nowrap", children }),
|
|
2605
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2606
|
+
import_select.Select.ItemIndicator,
|
|
2607
|
+
{
|
|
2608
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "pointer-events-none absolute right-2 flex items-center justify-center" }),
|
|
2609
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.CheckIcon, { className: "pointer-events-none" })
|
|
2610
|
+
}
|
|
2611
|
+
)
|
|
2612
|
+
]
|
|
2613
|
+
})
|
|
2614
|
+
);
|
|
2615
|
+
}
|
|
2616
|
+
function SelectScrollUpButton(_a) {
|
|
2617
|
+
var _b = _a, {
|
|
2618
|
+
className
|
|
2619
|
+
} = _b, props = __objRest(_b, [
|
|
2620
|
+
"className"
|
|
2621
|
+
]);
|
|
2622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2623
|
+
import_select.Select.ScrollUpArrow,
|
|
2624
|
+
__spreadProps(__spreadValues({
|
|
2625
|
+
"data-slot": "select-scroll-up-button",
|
|
2626
|
+
className: (0, import_cn17.cn)(
|
|
2627
|
+
"top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5",
|
|
2628
|
+
className
|
|
2629
|
+
)
|
|
2630
|
+
}, props), {
|
|
2631
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.ChevronUpIcon, {})
|
|
2632
|
+
})
|
|
2633
|
+
);
|
|
2634
|
+
}
|
|
2635
|
+
function SelectScrollDownButton(_a) {
|
|
2636
|
+
var _b = _a, {
|
|
2637
|
+
className
|
|
2638
|
+
} = _b, props = __objRest(_b, [
|
|
2639
|
+
"className"
|
|
2640
|
+
]);
|
|
2641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2642
|
+
import_select.Select.ScrollDownArrow,
|
|
2643
|
+
__spreadProps(__spreadValues({
|
|
2644
|
+
"data-slot": "select-scroll-down-button",
|
|
2645
|
+
className: (0, import_cn17.cn)(
|
|
2646
|
+
"bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-3.5",
|
|
2647
|
+
className
|
|
2648
|
+
)
|
|
2649
|
+
}, props), {
|
|
2650
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.ChevronDownIcon, {})
|
|
2651
|
+
})
|
|
2652
|
+
);
|
|
2653
|
+
}
|
|
2654
|
+
|
|
2655
|
+
// src/components/composed/data-table/table-header-filter.tsx
|
|
2656
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2657
|
+
function smartFilterFn(row, columnId, filterValue) {
|
|
2658
|
+
var _a, _b, _c;
|
|
2659
|
+
if (filterValue === void 0 || filterValue === null || filterValue === "" || filterValue === "all") {
|
|
2660
|
+
return true;
|
|
2661
|
+
}
|
|
2662
|
+
const rowValue = row.getValue(columnId);
|
|
2663
|
+
if (rowValue === void 0 || rowValue === null) {
|
|
2664
|
+
return false;
|
|
2665
|
+
}
|
|
2666
|
+
if (typeof rowValue === "boolean" || filterValue === "true" || filterValue === "false") {
|
|
2667
|
+
const rowBool = typeof rowValue === "boolean" ? rowValue : String(rowValue).toLowerCase() === "true" || rowValue === 1 || rowValue === "1";
|
|
2668
|
+
const targetBool = String(filterValue).toLowerCase() === "true";
|
|
2669
|
+
return rowBool === targetBool;
|
|
2670
|
+
}
|
|
2671
|
+
const isFilterDateString = typeof filterValue === "string" && /^\d{4}-\d{2}-\d{2}/.test(filterValue);
|
|
2672
|
+
const isFilterDateObj = filterValue instanceof Date;
|
|
2673
|
+
if (isFilterDateString || isFilterDateObj) {
|
|
2674
|
+
const targetDateStr = isFilterDateObj ? (0, import_date_fns.format)(filterValue, "yyyy-MM-dd") : filterValue.slice(0, 10);
|
|
2675
|
+
let rowDateStr = "";
|
|
2676
|
+
if (rowValue instanceof Date) {
|
|
2677
|
+
rowDateStr = (0, import_date_fns.format)(rowValue, "yyyy-MM-dd");
|
|
2678
|
+
} else if (typeof rowValue === "string" || typeof rowValue === "number") {
|
|
2679
|
+
const parsed = new Date(rowValue);
|
|
2680
|
+
if (!Number.isNaN(parsed.getTime())) {
|
|
2681
|
+
rowDateStr = (0, import_date_fns.format)(parsed, "yyyy-MM-dd");
|
|
2682
|
+
}
|
|
2683
|
+
}
|
|
2684
|
+
if (rowDateStr) {
|
|
2685
|
+
return rowDateStr === targetDateStr;
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2688
|
+
if (Array.isArray(rowValue)) {
|
|
2689
|
+
const targetStr2 = String(filterValue).toLowerCase();
|
|
2690
|
+
return rowValue.some((item) => {
|
|
2691
|
+
var _a2, _b2, _c2;
|
|
2692
|
+
if (item === null || item === void 0) return false;
|
|
2693
|
+
const itemStr = typeof item === "object" ? String(
|
|
2694
|
+
(_c2 = (_b2 = (_a2 = item.name) != null ? _a2 : item.label) != null ? _b2 : item.email) != null ? _c2 : JSON.stringify(item)
|
|
2695
|
+
) : String(item);
|
|
2696
|
+
return itemStr.toLowerCase().includes(targetStr2);
|
|
2697
|
+
});
|
|
2698
|
+
}
|
|
2699
|
+
if (typeof rowValue === "object" && !(rowValue instanceof Date)) {
|
|
2700
|
+
const objStr = String(
|
|
2701
|
+
(_c = (_b = (_a = rowValue.name) != null ? _a : rowValue.label) != null ? _b : rowValue.email) != null ? _c : JSON.stringify(rowValue)
|
|
2702
|
+
);
|
|
2703
|
+
return objStr.toLowerCase().includes(String(filterValue).toLowerCase());
|
|
2704
|
+
}
|
|
2705
|
+
const rowStr = String(rowValue).toLowerCase();
|
|
2706
|
+
const targetStr = String(filterValue).toLowerCase();
|
|
2707
|
+
return rowStr.includes(targetStr);
|
|
2708
|
+
}
|
|
2709
|
+
function getColumnUniqueOptions(column, table) {
|
|
2710
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
2711
|
+
const meta = column.columnDef.meta;
|
|
2712
|
+
if ((meta == null ? void 0 : meta.selectOptions) && meta.selectOptions.length > 0) {
|
|
2713
|
+
return meta.selectOptions;
|
|
2714
|
+
}
|
|
2715
|
+
const rows = (_d = (_c = (_a = table.getCoreRowModel) == null ? void 0 : _a.call(table).rows) != null ? _c : (_b = table.getPreFilteredRowModel) == null ? void 0 : _b.call(table).rows) != null ? _d : [];
|
|
2716
|
+
const uniqueSet = /* @__PURE__ */ new Set();
|
|
2717
|
+
const labelMap = /* @__PURE__ */ new Map();
|
|
2718
|
+
for (const row of rows) {
|
|
2719
|
+
const value = row.getValue(column.id);
|
|
2720
|
+
if (value === null || value === void 0 || value === "") continue;
|
|
2721
|
+
if (typeof value === "boolean") {
|
|
2722
|
+
const str = String(value);
|
|
2723
|
+
if (!uniqueSet.has(str)) {
|
|
2724
|
+
uniqueSet.add(str);
|
|
2725
|
+
labelMap.set(str, value ? "True / Yes" : "False / No");
|
|
2726
|
+
}
|
|
2727
|
+
} else if (Array.isArray(value)) {
|
|
2728
|
+
for (const item of value) {
|
|
2729
|
+
if (item === null || item === void 0 || item === "") continue;
|
|
2730
|
+
const itemStr = typeof item === "object" ? String(
|
|
2731
|
+
(_g = (_f = (_e = item.name) != null ? _e : item.label) != null ? _f : item.email) != null ? _g : JSON.stringify(item)
|
|
2732
|
+
) : String(item);
|
|
2733
|
+
if (!uniqueSet.has(itemStr)) {
|
|
2734
|
+
uniqueSet.add(itemStr);
|
|
2735
|
+
labelMap.set(itemStr, itemStr);
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
} else if (typeof value === "object") {
|
|
2739
|
+
const objStr = String(
|
|
2740
|
+
(_j = (_i = (_h = value.name) != null ? _h : value.label) != null ? _i : value.email) != null ? _j : JSON.stringify(value)
|
|
2741
|
+
);
|
|
2742
|
+
if (!uniqueSet.has(objStr)) {
|
|
2743
|
+
uniqueSet.add(objStr);
|
|
2744
|
+
labelMap.set(objStr, objStr);
|
|
2745
|
+
}
|
|
2746
|
+
} else {
|
|
2747
|
+
const str = String(value);
|
|
2748
|
+
if (!uniqueSet.has(str)) {
|
|
2749
|
+
uniqueSet.add(str);
|
|
2750
|
+
labelMap.set(str, str);
|
|
2751
|
+
}
|
|
2752
|
+
}
|
|
2753
|
+
if (uniqueSet.size >= 100) break;
|
|
2754
|
+
}
|
|
2755
|
+
return Array.from(uniqueSet).map((val) => {
|
|
2756
|
+
var _a2;
|
|
2757
|
+
return {
|
|
2758
|
+
value: String(val),
|
|
2759
|
+
label: String((_a2 = labelMap.get(val)) != null ? _a2 : val)
|
|
2760
|
+
};
|
|
2761
|
+
});
|
|
2762
|
+
}
|
|
2763
|
+
function getFilterVariant(column, table) {
|
|
2764
|
+
var _a, _b, _c, _d;
|
|
2765
|
+
const meta = column.columnDef.meta;
|
|
2766
|
+
if (meta == null ? void 0 : meta.filterVariant) return meta.filterVariant;
|
|
2767
|
+
const rows = (_d = (_c = (_a = table.getCoreRowModel) == null ? void 0 : _a.call(table).rows) != null ? _c : (_b = table.getPreFilteredRowModel) == null ? void 0 : _b.call(table).rows) != null ? _d : [];
|
|
2768
|
+
const sampleValues = [];
|
|
2769
|
+
for (const row of rows) {
|
|
2770
|
+
const val = row.getValue(column.id);
|
|
2771
|
+
if (val !== null && val !== void 0 && val !== "") {
|
|
2772
|
+
sampleValues.push(val);
|
|
2773
|
+
}
|
|
2774
|
+
if (sampleValues.length >= 100) break;
|
|
2775
|
+
}
|
|
2776
|
+
if (sampleValues.length === 0) return "text";
|
|
2777
|
+
const first = sampleValues[0];
|
|
2778
|
+
if (typeof first === "boolean" || sampleValues.every(
|
|
2779
|
+
(v) => typeof v === "boolean" || v === "true" || v === "false"
|
|
2780
|
+
)) {
|
|
2781
|
+
return "boolean";
|
|
2782
|
+
}
|
|
2783
|
+
if (first instanceof Date || typeof first === "string" && (first.match(/^\d{4}-\d{2}-\d{2}/) || !Number.isNaN(Date.parse(first)) && first.length >= 10 && (first.includes("-") || first.includes("/")))) {
|
|
2784
|
+
return "date";
|
|
2785
|
+
}
|
|
2786
|
+
const uniqueCount = new Set(sampleValues.map((v) => String(v))).size;
|
|
2787
|
+
if (uniqueCount > 0 && uniqueCount <= 20 && uniqueCount < sampleValues.length) {
|
|
2788
|
+
return "select";
|
|
2789
|
+
}
|
|
2790
|
+
return "text";
|
|
2791
|
+
}
|
|
2792
|
+
function ColumnFilterInput({
|
|
2793
|
+
column,
|
|
2794
|
+
table,
|
|
2795
|
+
headerText
|
|
2796
|
+
}) {
|
|
2797
|
+
const [calendarOpen, setCalendarOpen] = (0, import_react3.useState)(false);
|
|
2798
|
+
const filterValue = column.getFilterValue();
|
|
2799
|
+
const variant = (0, import_react3.useMemo)(
|
|
2800
|
+
() => getFilterVariant(column, table),
|
|
2801
|
+
[column, table]
|
|
2802
|
+
);
|
|
2803
|
+
const options = (0, import_react3.useMemo)(() => {
|
|
2804
|
+
if (variant === "boolean") {
|
|
2805
|
+
return [
|
|
2806
|
+
{ label: "True / Yes", value: "true" },
|
|
2807
|
+
{ label: "False / No", value: "false" }
|
|
2808
|
+
];
|
|
2809
|
+
}
|
|
2810
|
+
if (variant === "select") {
|
|
2811
|
+
return getColumnUniqueOptions(column, table);
|
|
2812
|
+
}
|
|
2813
|
+
return [];
|
|
2814
|
+
}, [column, table, variant]);
|
|
2815
|
+
if (variant === "boolean" || variant === "select") {
|
|
2816
|
+
const currentValue = filterValue === void 0 || filterValue === null || filterValue === "" ? "all" : String(filterValue);
|
|
2817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "relative flex items-center w-full", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2818
|
+
Select,
|
|
2819
|
+
{
|
|
2820
|
+
value: currentValue,
|
|
2821
|
+
onValueChange: (val) => {
|
|
2822
|
+
if (val === "all") {
|
|
2823
|
+
column.setFilterValue(void 0);
|
|
2824
|
+
} else {
|
|
2825
|
+
column.setFilterValue(val);
|
|
2826
|
+
}
|
|
2827
|
+
},
|
|
2828
|
+
children: [
|
|
2829
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2830
|
+
SelectTrigger,
|
|
2831
|
+
{
|
|
2832
|
+
className: "w-full",
|
|
2833
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
2834
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
2835
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2836
|
+
SelectValue,
|
|
2837
|
+
{
|
|
2838
|
+
placeholder: `Select ${headerText.toLowerCase()}...`,
|
|
2839
|
+
className: "capitalize"
|
|
2840
|
+
}
|
|
2841
|
+
)
|
|
2842
|
+
}
|
|
2843
|
+
),
|
|
2844
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(SelectContent, { align: "start", children: [
|
|
2845
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SelectItem, { value: "all", children: "All" }),
|
|
2846
|
+
options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2847
|
+
SelectItem,
|
|
2848
|
+
{
|
|
2849
|
+
value: opt.value,
|
|
2850
|
+
className: "capitalize",
|
|
2851
|
+
children: opt.label
|
|
2852
|
+
},
|
|
2853
|
+
opt.value
|
|
2854
|
+
))
|
|
2855
|
+
] })
|
|
2856
|
+
]
|
|
2857
|
+
}
|
|
2858
|
+
) });
|
|
2859
|
+
}
|
|
2860
|
+
if (variant === "date") {
|
|
2861
|
+
let dateObj;
|
|
2862
|
+
if (filterValue) {
|
|
2863
|
+
if (filterValue instanceof Date) {
|
|
2864
|
+
dateObj = filterValue;
|
|
2865
|
+
} else if (typeof filterValue === "string") {
|
|
2866
|
+
const parsed = new Date(filterValue);
|
|
2867
|
+
if (!Number.isNaN(parsed.getTime())) {
|
|
2868
|
+
dateObj = parsed;
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
const formattedDateLabel = dateObj ? (0, import_date_fns.format)(dateObj, "yyyy-MM-dd") : "";
|
|
2873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "relative flex items-center w-full", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Popover, { open: calendarOpen, onOpenChange: setCalendarOpen, children: [
|
|
2874
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2875
|
+
PopoverTrigger,
|
|
2876
|
+
{
|
|
2877
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2878
|
+
Button,
|
|
2879
|
+
{
|
|
2880
|
+
variant: "outline",
|
|
2881
|
+
className: (0, import_cn13.cn)(
|
|
2882
|
+
"w-full justify-start",
|
|
2883
|
+
!formattedDateLabel && "text-muted-foreground"
|
|
2884
|
+
),
|
|
2885
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
2886
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
2887
|
+
children: [
|
|
2888
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.CalendarIcon, { className: "mr-1 size-3 shrink-0" }),
|
|
2889
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "truncate", children: formattedDateLabel || `Pick ${headerText.toLowerCase()}...` })
|
|
2890
|
+
]
|
|
2891
|
+
}
|
|
2892
|
+
)
|
|
2893
|
+
}
|
|
2894
|
+
),
|
|
2895
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2896
|
+
PopoverContent,
|
|
2897
|
+
{
|
|
2898
|
+
className: "w-auto p-0",
|
|
2899
|
+
align: "start",
|
|
2900
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
2901
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
2902
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2903
|
+
Calendar,
|
|
2904
|
+
{
|
|
2905
|
+
mode: "single",
|
|
2906
|
+
selected: dateObj,
|
|
2907
|
+
onSelect: (date) => {
|
|
2908
|
+
if (date) {
|
|
2909
|
+
column.setFilterValue((0, import_date_fns.format)(date, "yyyy-MM-dd"));
|
|
2910
|
+
} else {
|
|
2911
|
+
column.setFilterValue(void 0);
|
|
2912
|
+
}
|
|
2913
|
+
setCalendarOpen(false);
|
|
2914
|
+
}
|
|
2915
|
+
}
|
|
2916
|
+
)
|
|
2917
|
+
}
|
|
2918
|
+
)
|
|
2919
|
+
] }) });
|
|
2920
|
+
}
|
|
2921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "relative flex items-center w-full", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2922
|
+
Input,
|
|
2923
|
+
{
|
|
2924
|
+
id: `filter-${column.id}`,
|
|
2925
|
+
placeholder: `Filter ${headerText.toLowerCase()}...`,
|
|
2926
|
+
value: filterValue != null ? filterValue : "",
|
|
2927
|
+
onChange: (e) => column.setFilterValue(e.target.value || void 0),
|
|
2928
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
2929
|
+
onKeyUp: (e) => e.stopPropagation(),
|
|
2930
|
+
onPointerDown: (e) => e.stopPropagation()
|
|
2931
|
+
}
|
|
2932
|
+
) });
|
|
2933
|
+
}
|
|
2934
|
+
function DataTableHeaderFilter({
|
|
2935
|
+
table,
|
|
2936
|
+
columnFilters
|
|
2937
|
+
}) {
|
|
2938
|
+
const filterableColumns = (0, import_react3.useMemo)(
|
|
2939
|
+
() => table.getAllColumns().filter(
|
|
2940
|
+
(column) => typeof column.accessorFn !== "undefined" && column.getCanFilter()
|
|
2941
|
+
),
|
|
2942
|
+
[table]
|
|
2943
|
+
);
|
|
2944
|
+
if (filterableColumns.length === 0) return null;
|
|
2945
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DropdownMenu, { children: [
|
|
2946
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Tooltip, { children: [
|
|
2947
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2948
|
+
DropdownMenuTrigger,
|
|
2949
|
+
{
|
|
2950
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2951
|
+
TooltipTrigger,
|
|
2952
|
+
{
|
|
2953
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2954
|
+
Button,
|
|
2955
|
+
{
|
|
2956
|
+
variant: columnFilters.length > 0 ? "secondary" : "outline",
|
|
2957
|
+
size: "icon",
|
|
2958
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.ListFilterIcon, {})
|
|
2959
|
+
}
|
|
2960
|
+
)
|
|
2961
|
+
}
|
|
2962
|
+
)
|
|
2963
|
+
}
|
|
2964
|
+
),
|
|
2965
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipContent, { children: "Filter options" })
|
|
2966
|
+
] }),
|
|
2967
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownMenuContent, { align: "end", className: "w-80", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DropdownMenuGroup, { children: [
|
|
2968
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownMenuLabel, { children: "Filter by column" }),
|
|
2969
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownMenuSeparator, {}),
|
|
2970
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "max-h-64 overflow-y-auto space-y-2.5 p-1", children: filterableColumns.map((column) => {
|
|
2971
|
+
const headerText = typeof column.columnDef.header === "string" ? column.columnDef.header : column.id;
|
|
2972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2973
|
+
"div",
|
|
2974
|
+
{
|
|
2975
|
+
className: "flex items-center justify-between px-1",
|
|
2976
|
+
children: [
|
|
2977
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2978
|
+
"label",
|
|
2979
|
+
{
|
|
2980
|
+
htmlFor: `filter-${column.id}`,
|
|
2981
|
+
className: "capitalize shrink-0 min-w-20 text-xs font-medium text-muted-foreground",
|
|
2982
|
+
children: headerText
|
|
2983
|
+
}
|
|
2984
|
+
),
|
|
2985
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2986
|
+
ColumnFilterInput,
|
|
2987
|
+
{
|
|
2988
|
+
column,
|
|
2989
|
+
table,
|
|
2990
|
+
headerText
|
|
2991
|
+
}
|
|
2992
|
+
) })
|
|
2993
|
+
]
|
|
2994
|
+
},
|
|
2995
|
+
column.id
|
|
2996
|
+
);
|
|
2997
|
+
}) }),
|
|
2998
|
+
columnFilters.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
2999
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownMenuSeparator, {}),
|
|
3000
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3001
|
+
DropdownMenuItem,
|
|
3002
|
+
{
|
|
3003
|
+
className: "hover:cursor-pointer text-destructive focus:text-destructive",
|
|
3004
|
+
onClick: () => table.resetColumnFilters(),
|
|
3005
|
+
children: "Clear Filters"
|
|
3006
|
+
}
|
|
3007
|
+
)
|
|
3008
|
+
] })
|
|
3009
|
+
] }) })
|
|
3010
|
+
] });
|
|
3011
|
+
}
|
|
3012
|
+
|
|
3013
|
+
// src/components/composed/data-table/table-header-refresh.tsx
|
|
3014
|
+
var import_lucide_react13 = require("lucide-react");
|
|
3015
|
+
var import_navigation2 = require("next/navigation");
|
|
3016
|
+
var import_react4 = require("react");
|
|
3017
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3018
|
+
function DataTableHeaderRefresh({
|
|
3019
|
+
onRefresh
|
|
3020
|
+
}) {
|
|
3021
|
+
const router = (0, import_navigation2.useRouter)();
|
|
3022
|
+
const [isRefreshing, setIsRefreshing] = (0, import_react4.useState)(false);
|
|
3023
|
+
const handleRefresh = () => {
|
|
3024
|
+
setIsRefreshing(true);
|
|
3025
|
+
if (onRefresh) {
|
|
3026
|
+
onRefresh();
|
|
3027
|
+
} else {
|
|
3028
|
+
router.refresh();
|
|
3029
|
+
}
|
|
3030
|
+
setTimeout(() => {
|
|
3031
|
+
setIsRefreshing(false);
|
|
3032
|
+
}, 750);
|
|
3033
|
+
};
|
|
3034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Tooltip, { children: [
|
|
3035
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3036
|
+
TooltipTrigger,
|
|
3037
|
+
{
|
|
3038
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3039
|
+
Button,
|
|
3040
|
+
{
|
|
3041
|
+
variant: "outline",
|
|
3042
|
+
size: "icon",
|
|
3043
|
+
onClick: handleRefresh,
|
|
3044
|
+
disabled: isRefreshing,
|
|
3045
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3046
|
+
import_lucide_react13.RotateCwIcon,
|
|
3047
|
+
{
|
|
3048
|
+
className: (0, import_cn13.cn)(
|
|
3049
|
+
"transition-transform duration-750",
|
|
3050
|
+
isRefreshing && "animate-spin"
|
|
3051
|
+
)
|
|
3052
|
+
}
|
|
3053
|
+
)
|
|
3054
|
+
}
|
|
3055
|
+
)
|
|
3056
|
+
}
|
|
3057
|
+
),
|
|
3058
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipContent, { children: "Refresh data" })
|
|
3059
|
+
] });
|
|
3060
|
+
}
|
|
3061
|
+
|
|
3062
|
+
// src/components/composed/data-table/table-header-search.tsx
|
|
3063
|
+
var import_lucide_react14 = require("lucide-react");
|
|
3064
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3065
|
+
function DataTableHeaderSearch({
|
|
3066
|
+
value = "",
|
|
3067
|
+
onChange
|
|
3068
|
+
}) {
|
|
3069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "relative flex items-center max-w-sm w-full", children: [
|
|
3070
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3071
|
+
Input,
|
|
3072
|
+
{
|
|
3073
|
+
placeholder: "Search...",
|
|
3074
|
+
value: value != null ? value : "",
|
|
3075
|
+
onChange: (event) => onChange(event.target.value),
|
|
3076
|
+
className: "pr-7"
|
|
3077
|
+
}
|
|
3078
|
+
),
|
|
3079
|
+
Boolean(value) && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3080
|
+
"button",
|
|
3081
|
+
{
|
|
3082
|
+
type: "button",
|
|
3083
|
+
onClick: () => onChange(""),
|
|
3084
|
+
className: "absolute right-2 text-muted-foreground hover:text-foreground p-0.5 rounded cursor-pointer",
|
|
3085
|
+
"aria-label": "Clear search text",
|
|
3086
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.XIcon, { className: "size-3.5" })
|
|
3087
|
+
}
|
|
3088
|
+
)
|
|
3089
|
+
] });
|
|
3090
|
+
}
|
|
3091
|
+
|
|
3092
|
+
// src/components/composed/data-table/table-header-sort.tsx
|
|
3093
|
+
var import_lucide_react15 = require("lucide-react");
|
|
3094
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3095
|
+
function DataTableHeaderSort({
|
|
3096
|
+
table,
|
|
3097
|
+
sorting
|
|
3098
|
+
}) {
|
|
3099
|
+
const sortableColumns = table.getAllColumns().filter((column) => column.getCanSort());
|
|
3100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(DropdownMenu, { children: [
|
|
3101
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Tooltip, { children: [
|
|
3102
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3103
|
+
DropdownMenuTrigger,
|
|
3104
|
+
{
|
|
3105
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3106
|
+
TooltipTrigger,
|
|
3107
|
+
{
|
|
3108
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3109
|
+
Button,
|
|
3110
|
+
{
|
|
3111
|
+
variant: sorting.length > 0 ? "secondary" : "outline",
|
|
3112
|
+
size: "icon",
|
|
3113
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react15.ArrowUpDownIcon, {})
|
|
3114
|
+
}
|
|
3115
|
+
)
|
|
3116
|
+
}
|
|
3117
|
+
)
|
|
3118
|
+
}
|
|
3119
|
+
),
|
|
3120
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TooltipContent, { children: "Sort options" })
|
|
3121
|
+
] }),
|
|
3122
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DropdownMenuContent, { align: "end", className: "w-48", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(DropdownMenuGroup, { children: [
|
|
3123
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DropdownMenuLabel, { children: "Sort by column" }),
|
|
3124
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DropdownMenuSeparator, {}),
|
|
3125
|
+
sortableColumns.map((column) => {
|
|
3126
|
+
const isSorted = column.getIsSorted();
|
|
3127
|
+
const headerText = typeof column.columnDef.header === "string" ? column.columnDef.header : column.id;
|
|
3128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3129
|
+
DropdownMenuItem,
|
|
3130
|
+
{
|
|
3131
|
+
className: "flex items-center justify-between hover:cursor-pointer capitalize",
|
|
3132
|
+
onClick: () => {
|
|
3133
|
+
if (isSorted === "asc") {
|
|
3134
|
+
column.toggleSorting(true);
|
|
3135
|
+
} else if (isSorted === "desc") {
|
|
3136
|
+
column.clearSorting();
|
|
3137
|
+
} else {
|
|
3138
|
+
column.toggleSorting(false);
|
|
3139
|
+
}
|
|
3140
|
+
},
|
|
3141
|
+
children: [
|
|
3142
|
+
headerText,
|
|
3143
|
+
isSorted === "asc" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react15.ArrowUpIcon, { className: "size-3.5" }),
|
|
3144
|
+
isSorted === "desc" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react15.ArrowDownIcon, { className: "size-3.5" })
|
|
3145
|
+
]
|
|
3146
|
+
},
|
|
3147
|
+
column.id
|
|
3148
|
+
);
|
|
3149
|
+
}),
|
|
3150
|
+
sorting.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
3151
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DropdownMenuSeparator, {}),
|
|
3152
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3153
|
+
DropdownMenuItem,
|
|
3154
|
+
{
|
|
3155
|
+
className: "hover:cursor-pointer text-destructive focus:text-destructive",
|
|
3156
|
+
onClick: () => table.resetSorting(),
|
|
3157
|
+
children: "Clear sorting"
|
|
3158
|
+
}
|
|
3159
|
+
)
|
|
3160
|
+
] })
|
|
3161
|
+
] }) })
|
|
3162
|
+
] });
|
|
3163
|
+
}
|
|
3164
|
+
|
|
3165
|
+
// src/components/composed/data-table/table-header-toggle.tsx
|
|
3166
|
+
var import_lucide_react16 = require("lucide-react");
|
|
3167
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3168
|
+
function DataTableHeaderToggle({
|
|
3169
|
+
table
|
|
3170
|
+
}) {
|
|
3171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(DropdownMenu, { children: [
|
|
3172
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Tooltip, { children: [
|
|
3173
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3174
|
+
DropdownMenuTrigger,
|
|
3175
|
+
{
|
|
3176
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3177
|
+
TooltipTrigger,
|
|
3178
|
+
{
|
|
3179
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Button, { variant: "outline", size: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react16.Columns3CogIcon, {}) })
|
|
3180
|
+
}
|
|
3181
|
+
)
|
|
3182
|
+
}
|
|
3183
|
+
),
|
|
3184
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TooltipContent, { children: "Toggle columns" })
|
|
3185
|
+
] }),
|
|
3186
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropdownMenuContent, { align: "end", className: "w-48", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(DropdownMenuGroup, { children: [
|
|
3187
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropdownMenuLabel, { children: "Toggle columns" }),
|
|
3188
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DropdownMenuSeparator, {}),
|
|
3189
|
+
table.getAllColumns().filter(
|
|
3190
|
+
(column) => typeof column.accessorFn !== "undefined" && column.getCanHide()
|
|
3191
|
+
).map((column) => {
|
|
3192
|
+
const headerText = typeof column.columnDef.header === "string" ? column.columnDef.header : column.id;
|
|
3193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3194
|
+
DropdownMenuCheckboxItem,
|
|
3195
|
+
{
|
|
3196
|
+
className: "capitalize hover:cursor-pointer",
|
|
3197
|
+
checked: column.getIsVisible(),
|
|
3198
|
+
onCheckedChange: (value) => column.toggleVisibility(!!value),
|
|
3199
|
+
children: headerText
|
|
3200
|
+
},
|
|
3201
|
+
column.id
|
|
3202
|
+
);
|
|
3203
|
+
})
|
|
3204
|
+
] }) })
|
|
3205
|
+
] });
|
|
3206
|
+
}
|
|
3207
|
+
|
|
3208
|
+
// src/components/composed/data-table/data-row-actions.tsx
|
|
3209
|
+
var import_lucide_react17 = require("lucide-react");
|
|
3210
|
+
var import_react5 = require("react");
|
|
3211
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3212
|
+
function RowActions({
|
|
3213
|
+
label = "Actions",
|
|
3214
|
+
items = [],
|
|
3215
|
+
triggerIcon,
|
|
3216
|
+
triggerLabel = "Open action menu",
|
|
3217
|
+
align = "end",
|
|
3218
|
+
containerClassName,
|
|
3219
|
+
contentClassName
|
|
3220
|
+
}) {
|
|
3221
|
+
const visibleItems = items.filter((item) => !item.hidden);
|
|
3222
|
+
if (visibleItems.length === 0) {
|
|
3223
|
+
return null;
|
|
3224
|
+
}
|
|
3225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3226
|
+
"div",
|
|
3227
|
+
{
|
|
3228
|
+
className: (0, import_cn13.cn)("flex items-center justify-end w-full", containerClassName),
|
|
3229
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(DropdownMenu, { children: [
|
|
3230
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3231
|
+
DropdownMenuTrigger,
|
|
3232
|
+
{
|
|
3233
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Button, { variant: "ghost", size: "icon-xs", "aria-label": triggerLabel, children: triggerIcon != null ? triggerIcon : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_lucide_react17.MoreHorizontal, { className: "size-4" }) })
|
|
3234
|
+
}
|
|
3235
|
+
),
|
|
3236
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3237
|
+
DropdownMenuContent,
|
|
3238
|
+
{
|
|
3239
|
+
align,
|
|
3240
|
+
className: (0, import_cn13.cn)("w-40", contentClassName),
|
|
3241
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(DropdownMenuGroup, { children: [
|
|
3242
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
3243
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropdownMenuLabel, { children: label }),
|
|
3244
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropdownMenuSeparator, {})
|
|
3245
|
+
] }),
|
|
3246
|
+
visibleItems.map((item, index) => {
|
|
3247
|
+
var _a;
|
|
3248
|
+
const itemKey = (_a = item.id) != null ? _a : `${item.label}-${index}`;
|
|
3249
|
+
const isDestructive = item.variant === "destructive";
|
|
3250
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react5.Fragment, { children: [
|
|
3251
|
+
item.separatorBefore && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropdownMenuSeparator, {}),
|
|
3252
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
3253
|
+
DropdownMenuItem,
|
|
3254
|
+
{
|
|
3255
|
+
onClick: item.onClick,
|
|
3256
|
+
disabled: item.disabled,
|
|
3257
|
+
className: (0, import_cn13.cn)(
|
|
3258
|
+
"hover:cursor-pointer flex items-center gap-2",
|
|
3259
|
+
isDestructive && "text-destructive focus:text-destructive",
|
|
3260
|
+
item.className
|
|
3261
|
+
),
|
|
3262
|
+
children: [
|
|
3263
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "size-4 shrink-0 flex items-center justify-center", children: item.icon }),
|
|
3264
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: item.label })
|
|
3265
|
+
]
|
|
3266
|
+
}
|
|
3267
|
+
),
|
|
3268
|
+
item.separatorAfter && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DropdownMenuSeparator, {})
|
|
3269
|
+
] }, itemKey);
|
|
3270
|
+
})
|
|
3271
|
+
] })
|
|
3272
|
+
}
|
|
3273
|
+
)
|
|
3274
|
+
] })
|
|
3275
|
+
}
|
|
3276
|
+
);
|
|
3277
|
+
}
|
|
3278
|
+
|
|
3279
|
+
// src/components/composed/data-table/data-table.tsx
|
|
3280
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3281
|
+
function DataTable({
|
|
3282
|
+
columns,
|
|
3283
|
+
data,
|
|
3284
|
+
initialColumnVisibility,
|
|
3285
|
+
renderCreateDialog,
|
|
3286
|
+
addLabel,
|
|
3287
|
+
onRefresh,
|
|
3288
|
+
onDownload,
|
|
3289
|
+
exportFilename = "data-export",
|
|
3290
|
+
showSearchInput = true,
|
|
3291
|
+
showRefreshButton = true,
|
|
3292
|
+
showSortButton = true,
|
|
3293
|
+
showFilterButton = true,
|
|
3294
|
+
showDownloadButton = true,
|
|
3295
|
+
showColumnToggleButton = true,
|
|
3296
|
+
showAddButton = true
|
|
3297
|
+
}) {
|
|
3298
|
+
const [createOpen, setCreateOpen] = (0, import_react6.useState)(false);
|
|
3299
|
+
const [sorting, setSorting] = (0, import_react6.useState)([]);
|
|
3300
|
+
const [columnFilters, setColumnFilters] = (0, import_react6.useState)([]);
|
|
3301
|
+
const [columnVisibility, setColumnVisibility] = (0, import_react6.useState)(initialColumnVisibility != null ? initialColumnVisibility : {});
|
|
3302
|
+
const [globalFilter, setGlobalFilter] = (0, import_react6.useState)("");
|
|
3303
|
+
const columnsWithSmartFilters = (0, import_react6.useMemo)(() => {
|
|
3304
|
+
return columns.map((col) => __spreadValues({
|
|
3305
|
+
filterFn: smartFilterFn
|
|
3306
|
+
}, col));
|
|
3307
|
+
}, [columns]);
|
|
3308
|
+
const table = (0, import_react_table4.useTable)({
|
|
3309
|
+
features,
|
|
3310
|
+
data,
|
|
3311
|
+
columns: columnsWithSmartFilters,
|
|
3312
|
+
initialState: {
|
|
3313
|
+
globalFilter: ""
|
|
3314
|
+
},
|
|
3315
|
+
onSortingChange: setSorting,
|
|
3316
|
+
onColumnFiltersChange: setColumnFilters,
|
|
3317
|
+
onColumnVisibilityChange: setColumnVisibility,
|
|
3318
|
+
onGlobalFilterChange: (updater) => {
|
|
3319
|
+
setGlobalFilter((prev) => {
|
|
3320
|
+
const next = typeof updater === "function" ? updater(prev) : updater;
|
|
3321
|
+
return next != null ? next : "";
|
|
3322
|
+
});
|
|
3323
|
+
},
|
|
3324
|
+
state: {
|
|
3325
|
+
sorting,
|
|
3326
|
+
columnFilters,
|
|
3327
|
+
columnVisibility,
|
|
3328
|
+
globalFilter: globalFilter != null ? globalFilter : ""
|
|
3329
|
+
}
|
|
3330
|
+
});
|
|
3331
|
+
if (data.length === 0) {
|
|
3332
|
+
const hasCreateAction = Boolean(renderCreateDialog);
|
|
3333
|
+
const hasRefreshAction = Boolean(onRefresh);
|
|
3334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "space-y-2", children: [
|
|
3335
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3336
|
+
StateEmpty,
|
|
3337
|
+
{
|
|
3338
|
+
state: "outline",
|
|
3339
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react18.FolderOpenIcon, { className: "size-6 text-muted-foreground" }),
|
|
3340
|
+
title: "No Data Available",
|
|
3341
|
+
description: "There are currently no records to display. Create a new record to get started.",
|
|
3342
|
+
buttonText: hasCreateAction ? addLabel != null ? addLabel : "Add Record" : hasRefreshAction ? "Refresh" : void 0,
|
|
3343
|
+
render: hasCreateAction ? () => setCreateOpen(true) : hasRefreshAction ? onRefresh : void 0
|
|
3344
|
+
}
|
|
3345
|
+
),
|
|
3346
|
+
renderCreateDialog == null ? void 0 : renderCreateDialog(createOpen, setCreateOpen)
|
|
3347
|
+
] });
|
|
3348
|
+
}
|
|
3349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "space-y-2", children: [
|
|
3350
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-row items-center justify-between gap-1", children: [
|
|
3351
|
+
showSearchInput ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3352
|
+
DataTableHeaderSearch,
|
|
3353
|
+
{
|
|
3354
|
+
value: globalFilter,
|
|
3355
|
+
onChange: setGlobalFilter
|
|
3356
|
+
}
|
|
3357
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", {}),
|
|
3358
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-row items-center gap-1", children: [
|
|
3359
|
+
showRefreshButton && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableHeaderRefresh, { onRefresh }),
|
|
3360
|
+
showSortButton && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableHeaderSort, { table, sorting }),
|
|
3361
|
+
showFilterButton && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3362
|
+
DataTableHeaderFilter,
|
|
3363
|
+
{
|
|
3364
|
+
table,
|
|
3365
|
+
columnFilters
|
|
3366
|
+
}
|
|
3367
|
+
),
|
|
3368
|
+
showDownloadButton && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3369
|
+
DataTableHeaderDownload,
|
|
3370
|
+
{
|
|
3371
|
+
table,
|
|
3372
|
+
exportFilename,
|
|
3373
|
+
onDownload
|
|
3374
|
+
}
|
|
3375
|
+
),
|
|
3376
|
+
showColumnToggleButton && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableHeaderToggle, { table }),
|
|
3377
|
+
showAddButton && renderCreateDialog && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3378
|
+
DataTableHeaderAdd,
|
|
3379
|
+
{
|
|
3380
|
+
onAdd: () => setCreateOpen(true),
|
|
3381
|
+
addLabel
|
|
3382
|
+
}
|
|
3383
|
+
)
|
|
3384
|
+
] })
|
|
3385
|
+
] }),
|
|
3386
|
+
renderCreateDialog == null ? void 0 : renderCreateDialog(createOpen, setCreateOpen),
|
|
3387
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "overflow-hidden rounded-md border [&_[data-slot=table-container]]:no-scrollbar", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Table, { children: [
|
|
3388
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableContentHeader, { table }),
|
|
3389
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableContentBody, { table, columns })
|
|
3390
|
+
] }) }),
|
|
3391
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center justify-between px-2", children: [
|
|
3392
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableFooterEntries, { table }),
|
|
3393
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DataTableFooterPagination, { table })
|
|
3394
|
+
] })
|
|
3395
|
+
] });
|
|
3396
|
+
}
|
|
3397
|
+
|
|
3398
|
+
// src/components/composed/header-tabs.tsx
|
|
3399
|
+
var import_link2 = __toESM(require("next/link"));
|
|
3400
|
+
var import_navigation3 = require("next/navigation");
|
|
3401
|
+
var import_react7 = require("react");
|
|
3402
|
+
|
|
3403
|
+
// src/components/ui/tabs.tsx
|
|
3404
|
+
var import_tabs = require("@base-ui/react/tabs");
|
|
3405
|
+
var import_class_variance_authority4 = require("class-variance-authority");
|
|
3406
|
+
var import_cn18 = require("cn");
|
|
3407
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3408
|
+
function Tabs(_a) {
|
|
3409
|
+
var _b = _a, {
|
|
3410
|
+
className,
|
|
3411
|
+
orientation = "horizontal"
|
|
3412
|
+
} = _b, props = __objRest(_b, [
|
|
3413
|
+
"className",
|
|
3414
|
+
"orientation"
|
|
3415
|
+
]);
|
|
3416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3417
|
+
import_tabs.Tabs.Root,
|
|
3418
|
+
__spreadValues({
|
|
3419
|
+
"data-slot": "tabs",
|
|
3420
|
+
"data-orientation": orientation,
|
|
3421
|
+
className: (0, import_cn18.cn)(
|
|
3422
|
+
"group/tabs flex gap-2 data-horizontal:flex-col",
|
|
3423
|
+
className
|
|
3424
|
+
)
|
|
3425
|
+
}, props)
|
|
3426
|
+
);
|
|
3427
|
+
}
|
|
3428
|
+
var tabsListVariants = (0, import_class_variance_authority4.cva)(
|
|
3429
|
+
"group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",
|
|
3430
|
+
{
|
|
3431
|
+
variants: {
|
|
3432
|
+
variant: {
|
|
3433
|
+
default: "bg-muted",
|
|
3434
|
+
line: "gap-1 bg-transparent"
|
|
3435
|
+
}
|
|
3436
|
+
},
|
|
3437
|
+
defaultVariants: {
|
|
3438
|
+
variant: "default"
|
|
3439
|
+
}
|
|
3440
|
+
}
|
|
3441
|
+
);
|
|
3442
|
+
function TabsList(_a) {
|
|
3443
|
+
var _b = _a, {
|
|
3444
|
+
className,
|
|
3445
|
+
variant = "default"
|
|
3446
|
+
} = _b, props = __objRest(_b, [
|
|
3447
|
+
"className",
|
|
3448
|
+
"variant"
|
|
3449
|
+
]);
|
|
3450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3451
|
+
import_tabs.Tabs.List,
|
|
3452
|
+
__spreadValues({
|
|
3453
|
+
"data-slot": "tabs-list",
|
|
3454
|
+
"data-variant": variant,
|
|
3455
|
+
className: (0, import_cn18.cn)(tabsListVariants({ variant }), className)
|
|
3456
|
+
}, props)
|
|
3457
|
+
);
|
|
3458
|
+
}
|
|
3459
|
+
function TabsTrigger(_a) {
|
|
3460
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
3461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3462
|
+
import_tabs.Tabs.Tab,
|
|
3463
|
+
__spreadValues({
|
|
3464
|
+
"data-slot": "tabs-trigger",
|
|
3465
|
+
className: (0, import_cn18.cn)(
|
|
3466
|
+
"relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-xs font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:py-[calc(--spacing(1.25))] hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
|
|
3467
|
+
"group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent",
|
|
3468
|
+
"data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground",
|
|
3469
|
+
"after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",
|
|
3470
|
+
className
|
|
3471
|
+
)
|
|
3472
|
+
}, props)
|
|
3473
|
+
);
|
|
3474
|
+
}
|
|
3475
|
+
|
|
3476
|
+
// src/components/composed/header-tabs.tsx
|
|
3477
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3478
|
+
function renderTabIcon(icon) {
|
|
3479
|
+
if (!icon) return null;
|
|
3480
|
+
if (typeof icon === "function" || typeof icon === "object" && icon !== null && "render" in icon) {
|
|
3481
|
+
const IconComp = icon;
|
|
3482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(IconComp, {});
|
|
3483
|
+
}
|
|
3484
|
+
return icon;
|
|
3485
|
+
}
|
|
3486
|
+
var HeaderTabs = (0, import_react7.memo)(function HeaderTabs2({
|
|
3487
|
+
items,
|
|
3488
|
+
value,
|
|
3489
|
+
onValueChange,
|
|
3490
|
+
children
|
|
3491
|
+
}) {
|
|
3492
|
+
var _a, _b;
|
|
3493
|
+
const pathname = (0, import_navigation3.usePathname)();
|
|
3494
|
+
const matchedItem = pathname ? items.find(
|
|
3495
|
+
(item) => item.url === pathname || pathname.endsWith(item.url) || pathname.split("/").includes(item.value)
|
|
3496
|
+
) : void 0;
|
|
3497
|
+
const activeTab = (_b = value != null ? value : matchedItem == null ? void 0 : matchedItem.value) != null ? _b : (_a = items[0]) == null ? void 0 : _a.value;
|
|
3498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Tabs, { value: activeTab, onValueChange, className: "space-y-4", children: [
|
|
3499
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "w-full overflow-x-auto overflow-y-hidden border-b no-scrollbar", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TabsList, { variant: "line", className: "inline-flex w-max justify-start", children: items.map(({ title, value: tabValue, url, icon }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
3500
|
+
TabsTrigger,
|
|
3501
|
+
{
|
|
3502
|
+
nativeButton: false,
|
|
3503
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_link2.default, { href: url }),
|
|
3504
|
+
value: tabValue,
|
|
3505
|
+
children: [
|
|
3506
|
+
renderTabIcon(icon),
|
|
3507
|
+
title
|
|
3508
|
+
]
|
|
3509
|
+
},
|
|
3510
|
+
tabValue
|
|
3511
|
+
)) }) }),
|
|
3512
|
+
children
|
|
3513
|
+
] });
|
|
3514
|
+
});
|
|
3515
|
+
|
|
3516
|
+
// src/components/composed/header-title.tsx
|
|
3517
|
+
var import_react8 = require("react");
|
|
3518
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3519
|
+
var HeaderTitle = (0, import_react8.memo)(function HeaderTitle2({
|
|
3520
|
+
title,
|
|
3521
|
+
subtitle,
|
|
3522
|
+
children
|
|
3523
|
+
}) {
|
|
3524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "w-full space-y-4", children: [
|
|
3525
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
|
|
3526
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h1", { className: "font-semibold", children: title }),
|
|
3527
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "text-xs text-muted-foreground", children: subtitle })
|
|
3528
|
+
] }),
|
|
3529
|
+
children
|
|
1713
3530
|
] });
|
|
1714
3531
|
});
|
|
1715
3532
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1716
3533
|
0 && (module.exports = {
|
|
1717
3534
|
AppSidebar,
|
|
3535
|
+
DataTable,
|
|
3536
|
+
DataTableContentBody,
|
|
3537
|
+
DataTableContentHeader,
|
|
3538
|
+
DataTableFooterEntries,
|
|
3539
|
+
DataTableFooterPagination,
|
|
3540
|
+
DataTableHeaderAdd,
|
|
3541
|
+
DataTableHeaderDownload,
|
|
3542
|
+
DataTableHeaderFilter,
|
|
3543
|
+
DataTableHeaderRefresh,
|
|
3544
|
+
DataTableHeaderSearch,
|
|
3545
|
+
DataTableHeaderSort,
|
|
3546
|
+
DataTableHeaderToggle,
|
|
1718
3547
|
HeaderTabs,
|
|
1719
3548
|
HeaderTitle,
|
|
1720
|
-
|
|
3549
|
+
RowActions,
|
|
3550
|
+
StateEmpty,
|
|
3551
|
+
exportToCSV,
|
|
3552
|
+
exportToPDF,
|
|
3553
|
+
exportToXLSX,
|
|
3554
|
+
features,
|
|
3555
|
+
flexRender,
|
|
3556
|
+
getTableExportData,
|
|
3557
|
+
printTable,
|
|
3558
|
+
smartFilterFn,
|
|
3559
|
+
useTable
|
|
1721
3560
|
});
|