@prediktif/ui 0.1.19 → 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 +19 -36
- package/dist/index.d.ts +19 -36
- package/dist/index.js +173 -191
- package/dist/index.mjs +207 -226
- package/package.json +3 -1
package/dist/index.mjs
CHANGED
|
@@ -716,16 +716,6 @@ function SheetDescription(_a) {
|
|
|
716
716
|
// src/components/ui/skeleton.tsx
|
|
717
717
|
import { cn as cn9 } from "cn";
|
|
718
718
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
719
|
-
function Skeleton(_a) {
|
|
720
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
721
|
-
return /* @__PURE__ */ jsx9(
|
|
722
|
-
"div",
|
|
723
|
-
__spreadValues({
|
|
724
|
-
"data-slot": "skeleton",
|
|
725
|
-
className: cn9("animate-pulse rounded-md bg-muted", className)
|
|
726
|
-
}, props)
|
|
727
|
-
);
|
|
728
|
-
}
|
|
729
719
|
|
|
730
720
|
// src/components/ui/tooltip.tsx
|
|
731
721
|
import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
|
|
@@ -1590,6 +1580,9 @@ function EmptyContent(_a) {
|
|
|
1590
1580
|
);
|
|
1591
1581
|
}
|
|
1592
1582
|
|
|
1583
|
+
// src/lib/utils.ts
|
|
1584
|
+
import { cn as cn13 } from "cn";
|
|
1585
|
+
|
|
1593
1586
|
// src/components/composed/state-empty.tsx
|
|
1594
1587
|
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1595
1588
|
function renderStateIcon(icon) {
|
|
@@ -1605,31 +1598,41 @@ var StateEmpty = memo2(function StateEmpty2({
|
|
|
1605
1598
|
description,
|
|
1606
1599
|
buttonText,
|
|
1607
1600
|
onClick,
|
|
1608
|
-
render
|
|
1601
|
+
render,
|
|
1602
|
+
state = "default"
|
|
1609
1603
|
}) {
|
|
1604
|
+
const isFunctionAction = typeof render === "function";
|
|
1605
|
+
const actionHandler = isFunctionAction ? render : onClick;
|
|
1606
|
+
const buttonRender = isFunctionAction ? void 0 : render;
|
|
1610
1607
|
const hasAction = Boolean(buttonText || render || onClick);
|
|
1611
|
-
return /* @__PURE__ */ jsxs8(
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1608
|
+
return /* @__PURE__ */ jsxs8(
|
|
1609
|
+
Empty,
|
|
1610
|
+
{
|
|
1611
|
+
className: cn13("w-full", state === "outline" && "border border-dashed"),
|
|
1612
|
+
children: [
|
|
1613
|
+
/* @__PURE__ */ jsxs8(EmptyHeader, { children: [
|
|
1614
|
+
/* @__PURE__ */ jsx14(EmptyMedia, { variant: "icon", children: renderStateIcon(icon) }),
|
|
1615
|
+
/* @__PURE__ */ jsx14(EmptyTitle, { children: title }),
|
|
1616
|
+
/* @__PURE__ */ jsx14(EmptyDescription, { children: description })
|
|
1617
|
+
] }),
|
|
1618
|
+
hasAction && /* @__PURE__ */ jsx14(EmptyContent, { children: /* @__PURE__ */ jsx14(
|
|
1619
|
+
Button,
|
|
1620
|
+
{
|
|
1621
|
+
variant: "outline",
|
|
1622
|
+
size: "sm",
|
|
1623
|
+
nativeButton: !buttonRender,
|
|
1624
|
+
onClick: actionHandler,
|
|
1625
|
+
render: buttonRender,
|
|
1626
|
+
children: buttonText
|
|
1627
|
+
}
|
|
1628
|
+
) })
|
|
1629
|
+
]
|
|
1630
|
+
}
|
|
1631
|
+
);
|
|
1629
1632
|
});
|
|
1630
1633
|
|
|
1631
1634
|
// src/components/ui/table.tsx
|
|
1632
|
-
import { cn as
|
|
1635
|
+
import { cn as cn14 } from "cn";
|
|
1633
1636
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1634
1637
|
function Table(_a) {
|
|
1635
1638
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
@@ -1642,7 +1645,7 @@ function Table(_a) {
|
|
|
1642
1645
|
"table",
|
|
1643
1646
|
__spreadValues({
|
|
1644
1647
|
"data-slot": "table",
|
|
1645
|
-
className:
|
|
1648
|
+
className: cn14("w-full caption-bottom text-xs", className)
|
|
1646
1649
|
}, props)
|
|
1647
1650
|
)
|
|
1648
1651
|
}
|
|
@@ -1654,7 +1657,7 @@ function TableHeader(_a) {
|
|
|
1654
1657
|
"thead",
|
|
1655
1658
|
__spreadValues({
|
|
1656
1659
|
"data-slot": "table-header",
|
|
1657
|
-
className:
|
|
1660
|
+
className: cn14("[&_tr]:border-b", className)
|
|
1658
1661
|
}, props)
|
|
1659
1662
|
);
|
|
1660
1663
|
}
|
|
@@ -1664,7 +1667,7 @@ function TableBody(_a) {
|
|
|
1664
1667
|
"tbody",
|
|
1665
1668
|
__spreadValues({
|
|
1666
1669
|
"data-slot": "table-body",
|
|
1667
|
-
className:
|
|
1670
|
+
className: cn14("[&_tr:last-child]:border-0", className)
|
|
1668
1671
|
}, props)
|
|
1669
1672
|
);
|
|
1670
1673
|
}
|
|
@@ -1674,7 +1677,7 @@ function TableRow(_a) {
|
|
|
1674
1677
|
"tr",
|
|
1675
1678
|
__spreadValues({
|
|
1676
1679
|
"data-slot": "table-row",
|
|
1677
|
-
className:
|
|
1680
|
+
className: cn14(
|
|
1678
1681
|
"border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",
|
|
1679
1682
|
className
|
|
1680
1683
|
)
|
|
@@ -1687,7 +1690,7 @@ function TableHead(_a) {
|
|
|
1687
1690
|
"th",
|
|
1688
1691
|
__spreadValues({
|
|
1689
1692
|
"data-slot": "table-head",
|
|
1690
|
-
className:
|
|
1693
|
+
className: cn14(
|
|
1691
1694
|
"h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",
|
|
1692
1695
|
className
|
|
1693
1696
|
)
|
|
@@ -1700,7 +1703,7 @@ function TableCell(_a) {
|
|
|
1700
1703
|
"td",
|
|
1701
1704
|
__spreadValues({
|
|
1702
1705
|
"data-slot": "table-cell",
|
|
1703
|
-
className:
|
|
1706
|
+
className: cn14(
|
|
1704
1707
|
"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",
|
|
1705
1708
|
className
|
|
1706
1709
|
)
|
|
@@ -1753,92 +1756,44 @@ import {
|
|
|
1753
1756
|
flexRender
|
|
1754
1757
|
} from "@tanstack/react-table";
|
|
1755
1758
|
import { SearchXIcon } from "lucide-react";
|
|
1756
|
-
import { jsx as jsx16
|
|
1757
|
-
var SKELETON_ROWS = ["sk-1", "sk-2", "sk-3", "sk-4", "sk-5"];
|
|
1759
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1758
1760
|
function DataTableContentBody({
|
|
1759
1761
|
table,
|
|
1760
|
-
columns
|
|
1761
|
-
isLoading
|
|
1762
|
+
columns
|
|
1762
1763
|
}) {
|
|
1763
|
-
if (isLoading) {
|
|
1764
|
-
return /* @__PURE__ */ jsx16(TableBody, { children: SKELETON_ROWS.map((rowKey) => /* @__PURE__ */ jsx16(TableRow, { children: columns.map((col, idx) => {
|
|
1765
|
-
var _a;
|
|
1766
|
-
const colKey = (_a = col.id) != null ? _a : typeof col.accessorKey === "string" ? col.accessorKey : `col-${idx}`;
|
|
1767
|
-
return /* @__PURE__ */ jsx16(TableCell, { className: "py-3", children: /* @__PURE__ */ jsx16(Skeleton, { className: "h-4 w-full" }) }, `${rowKey}-${colKey}`);
|
|
1768
|
-
}) }, rowKey)) });
|
|
1769
|
-
}
|
|
1770
1764
|
const rows = table.getRowModel().rows;
|
|
1771
1765
|
if (rows == null ? void 0 : rows.length) {
|
|
1772
1766
|
return /* @__PURE__ */ jsx16(TableBody, { children: rows.map((row) => /* @__PURE__ */ jsx16(TableRow, { children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx16(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id)) }, row.id)) });
|
|
1773
1767
|
}
|
|
1774
|
-
return /* @__PURE__ */ jsx16(TableBody, { children: /* @__PURE__ */ jsx16(TableRow, { children: /* @__PURE__ */ jsx16(TableCell, { colSpan: columns.length, className: "h-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
onClick: () => {
|
|
1785
|
-
table.resetGlobalFilter();
|
|
1786
|
-
table.resetColumnFilters();
|
|
1787
|
-
},
|
|
1788
|
-
children: "Clear search & filters"
|
|
1768
|
+
return /* @__PURE__ */ jsx16(TableBody, { children: /* @__PURE__ */ jsx16(TableRow, { children: /* @__PURE__ */ jsx16(TableCell, { colSpan: columns.length, className: "h-48 text-center", children: /* @__PURE__ */ jsx16(
|
|
1769
|
+
StateEmpty,
|
|
1770
|
+
{
|
|
1771
|
+
icon: /* @__PURE__ */ jsx16(SearchXIcon, {}),
|
|
1772
|
+
title: "No matching results",
|
|
1773
|
+
description: "No records matched your search query or filter criteria.",
|
|
1774
|
+
buttonText: "Clear search & filters",
|
|
1775
|
+
render: () => {
|
|
1776
|
+
table.setGlobalFilter("");
|
|
1777
|
+
table.resetColumnFilters();
|
|
1789
1778
|
}
|
|
1790
|
-
|
|
1791
|
-
|
|
1779
|
+
}
|
|
1780
|
+
) }) }) });
|
|
1792
1781
|
}
|
|
1793
1782
|
|
|
1794
1783
|
// src/components/composed/data-table/table-content-header.tsx
|
|
1795
1784
|
import { flexRender as flexRender2 } from "@tanstack/react-table";
|
|
1796
|
-
import {
|
|
1797
|
-
|
|
1798
|
-
// src/lib/utils.ts
|
|
1799
|
-
import { cn as cn14 } from "cn";
|
|
1800
|
-
|
|
1801
|
-
// src/components/composed/data-table/table-content-header.tsx
|
|
1802
|
-
import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1785
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1803
1786
|
function DataTableContentHeader({
|
|
1804
1787
|
table
|
|
1805
1788
|
}) {
|
|
1806
|
-
return /* @__PURE__ */ jsx17(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx17(TableRow, { children: headerGroup.headers.map((header) => {
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
const canSort = header.column.getCanSort();
|
|
1811
|
-
const isSorted = header.column.getIsSorted();
|
|
1812
|
-
if (!canSort) {
|
|
1813
|
-
return /* @__PURE__ */ jsx17(TableHead, { children: flexRender2(
|
|
1814
|
-
header.column.columnDef.header,
|
|
1815
|
-
header.getContext()
|
|
1816
|
-
) }, header.id);
|
|
1817
|
-
}
|
|
1818
|
-
return /* @__PURE__ */ jsx17(TableHead, { className: "select-none", children: /* @__PURE__ */ jsxs10(
|
|
1819
|
-
"button",
|
|
1820
|
-
{
|
|
1821
|
-
type: "button",
|
|
1822
|
-
className: cn14(
|
|
1823
|
-
"flex items-center gap-1.5 -ml-1 px-1 py-1 rounded hover:bg-muted/50 cursor-pointer font-medium text-xs transition-colors",
|
|
1824
|
-
isSorted && "text-foreground font-semibold"
|
|
1825
|
-
),
|
|
1826
|
-
onClick: header.column.getToggleSortingHandler(),
|
|
1827
|
-
"aria-label": `Sort by ${typeof header.column.columnDef.header === "string" ? header.column.columnDef.header : header.id}`,
|
|
1828
|
-
children: [
|
|
1829
|
-
/* @__PURE__ */ jsx17("span", { children: flexRender2(
|
|
1830
|
-
header.column.columnDef.header,
|
|
1831
|
-
header.getContext()
|
|
1832
|
-
) }),
|
|
1833
|
-
isSorted === "asc" ? /* @__PURE__ */ jsx17(ArrowUpIcon, { className: "size-3 text-foreground shrink-0" }) : isSorted === "desc" ? /* @__PURE__ */ jsx17(ArrowDownIcon, { className: "size-3 text-foreground shrink-0" }) : /* @__PURE__ */ jsx17(ArrowUpDownIcon, { className: "size-3 text-muted-foreground/40 hover:text-muted-foreground shrink-0" })
|
|
1834
|
-
]
|
|
1835
|
-
}
|
|
1836
|
-
) }, header.id);
|
|
1837
|
-
}) }, headerGroup.id)) });
|
|
1789
|
+
return /* @__PURE__ */ jsx17(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx17(TableRow, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx17(TableHead, { children: header.isPlaceholder ? null : flexRender2(
|
|
1790
|
+
header.column.columnDef.header,
|
|
1791
|
+
header.getContext()
|
|
1792
|
+
) }, header.id)) }, headerGroup.id)) });
|
|
1838
1793
|
}
|
|
1839
1794
|
|
|
1840
1795
|
// src/components/composed/data-table/table-footer-entries.tsx
|
|
1841
|
-
import { jsx as jsx18, jsxs as
|
|
1796
|
+
import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1842
1797
|
function DataTableFooterEntries({
|
|
1843
1798
|
table
|
|
1844
1799
|
}) {
|
|
@@ -1849,10 +1804,10 @@ function DataTableFooterEntries({
|
|
|
1849
1804
|
const totalRows = table.getFilteredRowModel().rows.length;
|
|
1850
1805
|
const startRow = totalRows === 0 ? 0 : pageIndex * pageSize + 1;
|
|
1851
1806
|
const endRow = Math.min((pageIndex + 1) * pageSize, totalRows);
|
|
1852
|
-
return /* @__PURE__ */
|
|
1807
|
+
return /* @__PURE__ */ jsxs9("div", { className: "flex-1 text-xs text-muted-foreground", children: [
|
|
1853
1808
|
"Showing",
|
|
1854
1809
|
" ",
|
|
1855
|
-
/* @__PURE__ */
|
|
1810
|
+
/* @__PURE__ */ jsxs9("span", { className: "font-medium text-foreground", children: [
|
|
1856
1811
|
startRow,
|
|
1857
1812
|
"-",
|
|
1858
1813
|
endRow
|
|
@@ -1872,12 +1827,12 @@ import {
|
|
|
1872
1827
|
ChevronsLeftIcon,
|
|
1873
1828
|
ChevronsRightIcon
|
|
1874
1829
|
} from "lucide-react";
|
|
1875
|
-
import { jsx as jsx19, jsxs as
|
|
1830
|
+
import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1876
1831
|
function DataTableFooterPagination({
|
|
1877
1832
|
table
|
|
1878
1833
|
}) {
|
|
1879
|
-
return /* @__PURE__ */
|
|
1880
|
-
/* @__PURE__ */
|
|
1834
|
+
return /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
|
|
1835
|
+
/* @__PURE__ */ jsxs10(Tooltip, { children: [
|
|
1881
1836
|
/* @__PURE__ */ jsx19(
|
|
1882
1837
|
TooltipTrigger,
|
|
1883
1838
|
{
|
|
@@ -1895,7 +1850,7 @@ function DataTableFooterPagination({
|
|
|
1895
1850
|
),
|
|
1896
1851
|
/* @__PURE__ */ jsx19(TooltipContent, { children: "Go to first page" })
|
|
1897
1852
|
] }),
|
|
1898
|
-
/* @__PURE__ */
|
|
1853
|
+
/* @__PURE__ */ jsxs10(Tooltip, { children: [
|
|
1899
1854
|
/* @__PURE__ */ jsx19(
|
|
1900
1855
|
TooltipTrigger,
|
|
1901
1856
|
{
|
|
@@ -1913,7 +1868,7 @@ function DataTableFooterPagination({
|
|
|
1913
1868
|
),
|
|
1914
1869
|
/* @__PURE__ */ jsx19(TooltipContent, { children: "Go to previous page" })
|
|
1915
1870
|
] }),
|
|
1916
|
-
/* @__PURE__ */
|
|
1871
|
+
/* @__PURE__ */ jsxs10(Tooltip, { children: [
|
|
1917
1872
|
/* @__PURE__ */ jsx19(
|
|
1918
1873
|
TooltipTrigger,
|
|
1919
1874
|
{
|
|
@@ -1931,7 +1886,7 @@ function DataTableFooterPagination({
|
|
|
1931
1886
|
),
|
|
1932
1887
|
/* @__PURE__ */ jsx19(TooltipContent, { children: "Go to next page" })
|
|
1933
1888
|
] }),
|
|
1934
|
-
/* @__PURE__ */
|
|
1889
|
+
/* @__PURE__ */ jsxs10(Tooltip, { children: [
|
|
1935
1890
|
/* @__PURE__ */ jsx19(
|
|
1936
1891
|
TooltipTrigger,
|
|
1937
1892
|
{
|
|
@@ -1954,13 +1909,13 @@ function DataTableFooterPagination({
|
|
|
1954
1909
|
|
|
1955
1910
|
// src/components/composed/data-table/table-header-add.tsx
|
|
1956
1911
|
import { PlusIcon } from "lucide-react";
|
|
1957
|
-
import { Fragment, jsx as jsx20, jsxs as
|
|
1912
|
+
import { Fragment, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1958
1913
|
function DataTableHeaderAdd({
|
|
1959
1914
|
onAdd,
|
|
1960
1915
|
addLabel
|
|
1961
1916
|
}) {
|
|
1962
|
-
return /* @__PURE__ */
|
|
1963
|
-
/* @__PURE__ */
|
|
1917
|
+
return /* @__PURE__ */ jsxs11(Fragment, { children: [
|
|
1918
|
+
/* @__PURE__ */ jsxs11(Tooltip, { children: [
|
|
1964
1919
|
/* @__PURE__ */ jsx20(
|
|
1965
1920
|
TooltipTrigger,
|
|
1966
1921
|
{
|
|
@@ -1970,7 +1925,7 @@ function DataTableHeaderAdd({
|
|
|
1970
1925
|
),
|
|
1971
1926
|
/* @__PURE__ */ jsx20(TooltipContent, { children: addLabel != null ? addLabel : "Add" })
|
|
1972
1927
|
] }),
|
|
1973
|
-
/* @__PURE__ */
|
|
1928
|
+
/* @__PURE__ */ jsxs11(Button, { variant: "default", onClick: onAdd, className: "hidden sm:flex", children: [
|
|
1974
1929
|
/* @__PURE__ */ jsx20(PlusIcon, {}),
|
|
1975
1930
|
addLabel != null ? addLabel : "Add"
|
|
1976
1931
|
] })
|
|
@@ -2045,6 +2000,41 @@ function exportToCSV(rows, filename = "data-export") {
|
|
|
2045
2000
|
URL.revokeObjectURL(url);
|
|
2046
2001
|
}, 1e3);
|
|
2047
2002
|
}
|
|
2003
|
+
async function exportToPDF(headers, rows, filename = "data-export", title = "Data Export") {
|
|
2004
|
+
const [{ jsPDF }, autoTableMod] = await Promise.all([
|
|
2005
|
+
import("jspdf"),
|
|
2006
|
+
import("jspdf-autotable")
|
|
2007
|
+
]);
|
|
2008
|
+
const autoTable = autoTableMod.autoTable || autoTableMod.default;
|
|
2009
|
+
const orientation = headers.length > 5 ? "landscape" : "portrait";
|
|
2010
|
+
const doc = new jsPDF({ orientation });
|
|
2011
|
+
doc.setFontSize(14);
|
|
2012
|
+
doc.setFont("helvetica", "bold");
|
|
2013
|
+
doc.text(title, 14, 15);
|
|
2014
|
+
doc.setFontSize(8);
|
|
2015
|
+
doc.setFont("helvetica", "normal");
|
|
2016
|
+
doc.setTextColor(120);
|
|
2017
|
+
doc.text(`Generated on ${(/* @__PURE__ */ new Date()).toLocaleString()}`, 14, 20);
|
|
2018
|
+
autoTable(doc, {
|
|
2019
|
+
head: [headers],
|
|
2020
|
+
body: rows,
|
|
2021
|
+
startY: 24,
|
|
2022
|
+
styles: {
|
|
2023
|
+
fontSize: 8,
|
|
2024
|
+
cellPadding: 2.5
|
|
2025
|
+
},
|
|
2026
|
+
headStyles: {
|
|
2027
|
+
fillColor: [40, 40, 40],
|
|
2028
|
+
textColor: [255, 255, 255],
|
|
2029
|
+
fontStyle: "bold"
|
|
2030
|
+
},
|
|
2031
|
+
alternateRowStyles: {
|
|
2032
|
+
fillColor: [248, 248, 248]
|
|
2033
|
+
}
|
|
2034
|
+
});
|
|
2035
|
+
const finalFilename = filename.endsWith(".pdf") ? filename : `${filename}.pdf`;
|
|
2036
|
+
doc.save(finalFilename);
|
|
2037
|
+
}
|
|
2048
2038
|
function printTable(headers, rows, title = "Data Export") {
|
|
2049
2039
|
let tableHtml = `<table style="width:100%; border-collapse:collapse; font-family:sans-serif; font-size:12px;"><thead><tr>`;
|
|
2050
2040
|
for (const header of headers) {
|
|
@@ -2089,7 +2079,7 @@ function printTable(headers, rows, title = "Data Export") {
|
|
|
2089
2079
|
}
|
|
2090
2080
|
|
|
2091
2081
|
// src/components/composed/data-table/table-header-download.tsx
|
|
2092
|
-
import { jsx as jsx21, jsxs as
|
|
2082
|
+
import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2093
2083
|
function getTableExportData(table) {
|
|
2094
2084
|
const columns = table.getAllColumns().filter(
|
|
2095
2085
|
(col) => typeof col.accessorFn !== "undefined" && col.getIsVisible()
|
|
@@ -2132,8 +2122,8 @@ function DataTableHeaderDownload({
|
|
|
2132
2122
|
exportFilename,
|
|
2133
2123
|
onDownload
|
|
2134
2124
|
}) {
|
|
2135
|
-
return /* @__PURE__ */
|
|
2136
|
-
/* @__PURE__ */
|
|
2125
|
+
return /* @__PURE__ */ jsxs12(DropdownMenu, { children: [
|
|
2126
|
+
/* @__PURE__ */ jsxs12(Tooltip, { children: [
|
|
2137
2127
|
/* @__PURE__ */ jsx21(
|
|
2138
2128
|
DropdownMenuTrigger,
|
|
2139
2129
|
{
|
|
@@ -2147,16 +2137,16 @@ function DataTableHeaderDownload({
|
|
|
2147
2137
|
),
|
|
2148
2138
|
/* @__PURE__ */ jsx21(TooltipContent, { children: "Download options" })
|
|
2149
2139
|
] }),
|
|
2150
|
-
/* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", className: "w-48", children: /* @__PURE__ */
|
|
2140
|
+
/* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", className: "w-48", children: /* @__PURE__ */ jsxs12(DropdownMenuGroup, { children: [
|
|
2151
2141
|
/* @__PURE__ */ jsx21(DropdownMenuLabel, { children: "Download data" }),
|
|
2152
2142
|
/* @__PURE__ */ jsx21(DropdownMenuSeparator, {}),
|
|
2153
|
-
/* @__PURE__ */
|
|
2143
|
+
/* @__PURE__ */ jsxs12(
|
|
2154
2144
|
DropdownMenuItem,
|
|
2155
2145
|
{
|
|
2156
2146
|
className: "hover:cursor-pointer",
|
|
2157
|
-
onClick: () => {
|
|
2147
|
+
onClick: async () => {
|
|
2158
2148
|
const { headers, rows } = getTableExportData(table);
|
|
2159
|
-
|
|
2149
|
+
await exportToPDF(headers, rows, exportFilename);
|
|
2160
2150
|
onDownload == null ? void 0 : onDownload();
|
|
2161
2151
|
},
|
|
2162
2152
|
children: [
|
|
@@ -2165,7 +2155,7 @@ function DataTableHeaderDownload({
|
|
|
2165
2155
|
]
|
|
2166
2156
|
}
|
|
2167
2157
|
),
|
|
2168
|
-
/* @__PURE__ */
|
|
2158
|
+
/* @__PURE__ */ jsxs12(
|
|
2169
2159
|
DropdownMenuItem,
|
|
2170
2160
|
{
|
|
2171
2161
|
className: "hover:cursor-pointer",
|
|
@@ -2180,7 +2170,7 @@ function DataTableHeaderDownload({
|
|
|
2180
2170
|
]
|
|
2181
2171
|
}
|
|
2182
2172
|
),
|
|
2183
|
-
/* @__PURE__ */
|
|
2173
|
+
/* @__PURE__ */ jsxs12(
|
|
2184
2174
|
DropdownMenuItem,
|
|
2185
2175
|
{
|
|
2186
2176
|
className: "hover:cursor-pointer",
|
|
@@ -2196,7 +2186,7 @@ function DataTableHeaderDownload({
|
|
|
2196
2186
|
}
|
|
2197
2187
|
),
|
|
2198
2188
|
/* @__PURE__ */ jsx21(DropdownMenuSeparator, {}),
|
|
2199
|
-
/* @__PURE__ */
|
|
2189
|
+
/* @__PURE__ */ jsxs12(
|
|
2200
2190
|
DropdownMenuItem,
|
|
2201
2191
|
{
|
|
2202
2192
|
className: "hover:cursor-pointer",
|
|
@@ -2481,7 +2471,7 @@ function PopoverContent(_a) {
|
|
|
2481
2471
|
import { Select as SelectPrimitive } from "@base-ui/react/select";
|
|
2482
2472
|
import { cn as cn17 } from "cn";
|
|
2483
2473
|
import { CheckIcon as CheckIcon2, ChevronDownIcon as ChevronDownIcon2, ChevronUpIcon } from "lucide-react";
|
|
2484
|
-
import { jsx as jsx24, jsxs as
|
|
2474
|
+
import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2485
2475
|
var Select = SelectPrimitive.Root;
|
|
2486
2476
|
function SelectValue(_a) {
|
|
2487
2477
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
@@ -2503,7 +2493,7 @@ function SelectTrigger(_a) {
|
|
|
2503
2493
|
"size",
|
|
2504
2494
|
"children"
|
|
2505
2495
|
]);
|
|
2506
|
-
return /* @__PURE__ */
|
|
2496
|
+
return /* @__PURE__ */ jsxs13(
|
|
2507
2497
|
SelectPrimitive.Trigger,
|
|
2508
2498
|
__spreadProps(__spreadValues({
|
|
2509
2499
|
"data-slot": "select-trigger",
|
|
@@ -2552,7 +2542,7 @@ function SelectContent(_a) {
|
|
|
2552
2542
|
alignOffset,
|
|
2553
2543
|
alignItemWithTrigger,
|
|
2554
2544
|
className: "isolate z-50",
|
|
2555
|
-
children: /* @__PURE__ */
|
|
2545
|
+
children: /* @__PURE__ */ jsxs13(
|
|
2556
2546
|
SelectPrimitive.Popup,
|
|
2557
2547
|
__spreadProps(__spreadValues({
|
|
2558
2548
|
"data-slot": "select-content",
|
|
@@ -2580,7 +2570,7 @@ function SelectItem(_a) {
|
|
|
2580
2570
|
"className",
|
|
2581
2571
|
"children"
|
|
2582
2572
|
]);
|
|
2583
|
-
return /* @__PURE__ */
|
|
2573
|
+
return /* @__PURE__ */ jsxs13(
|
|
2584
2574
|
SelectPrimitive.Item,
|
|
2585
2575
|
__spreadProps(__spreadValues({
|
|
2586
2576
|
"data-slot": "select-item",
|
|
@@ -2642,7 +2632,7 @@ function SelectScrollDownButton(_a) {
|
|
|
2642
2632
|
}
|
|
2643
2633
|
|
|
2644
2634
|
// src/components/composed/data-table/table-header-filter.tsx
|
|
2645
|
-
import { Fragment as Fragment2, jsx as jsx25, jsxs as
|
|
2635
|
+
import { Fragment as Fragment2, jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2646
2636
|
function smartFilterFn(row, columnId, filterValue) {
|
|
2647
2637
|
var _a, _b, _c;
|
|
2648
2638
|
if (filterValue === void 0 || filterValue === null || filterValue === "" || filterValue === "all") {
|
|
@@ -2803,7 +2793,7 @@ function ColumnFilterInput({
|
|
|
2803
2793
|
}, [column, table, variant]);
|
|
2804
2794
|
if (variant === "boolean" || variant === "select") {
|
|
2805
2795
|
const currentValue = filterValue === void 0 || filterValue === null || filterValue === "" ? "all" : String(filterValue);
|
|
2806
|
-
return /* @__PURE__ */ jsx25("div", { className: "relative flex items-center w-full", children: /* @__PURE__ */
|
|
2796
|
+
return /* @__PURE__ */ jsx25("div", { className: "relative flex items-center w-full", children: /* @__PURE__ */ jsxs14(
|
|
2807
2797
|
Select,
|
|
2808
2798
|
{
|
|
2809
2799
|
value: currentValue,
|
|
@@ -2830,7 +2820,7 @@ function ColumnFilterInput({
|
|
|
2830
2820
|
)
|
|
2831
2821
|
}
|
|
2832
2822
|
),
|
|
2833
|
-
/* @__PURE__ */
|
|
2823
|
+
/* @__PURE__ */ jsxs14(SelectContent, { align: "start", children: [
|
|
2834
2824
|
/* @__PURE__ */ jsx25(SelectItem, { value: "all", children: "All" }),
|
|
2835
2825
|
options.map((opt) => /* @__PURE__ */ jsx25(
|
|
2836
2826
|
SelectItem,
|
|
@@ -2859,15 +2849,15 @@ function ColumnFilterInput({
|
|
|
2859
2849
|
}
|
|
2860
2850
|
}
|
|
2861
2851
|
const formattedDateLabel = dateObj ? format(dateObj, "yyyy-MM-dd") : "";
|
|
2862
|
-
return /* @__PURE__ */ jsx25("div", { className: "relative flex items-center w-full", children: /* @__PURE__ */
|
|
2852
|
+
return /* @__PURE__ */ jsx25("div", { className: "relative flex items-center w-full", children: /* @__PURE__ */ jsxs14(Popover, { open: calendarOpen, onOpenChange: setCalendarOpen, children: [
|
|
2863
2853
|
/* @__PURE__ */ jsx25(
|
|
2864
2854
|
PopoverTrigger,
|
|
2865
2855
|
{
|
|
2866
|
-
render: /* @__PURE__ */
|
|
2856
|
+
render: /* @__PURE__ */ jsxs14(
|
|
2867
2857
|
Button,
|
|
2868
2858
|
{
|
|
2869
2859
|
variant: "outline",
|
|
2870
|
-
className:
|
|
2860
|
+
className: cn13(
|
|
2871
2861
|
"w-full justify-start",
|
|
2872
2862
|
!formattedDateLabel && "text-muted-foreground"
|
|
2873
2863
|
),
|
|
@@ -2931,8 +2921,8 @@ function DataTableHeaderFilter({
|
|
|
2931
2921
|
[table]
|
|
2932
2922
|
);
|
|
2933
2923
|
if (filterableColumns.length === 0) return null;
|
|
2934
|
-
return /* @__PURE__ */
|
|
2935
|
-
/* @__PURE__ */
|
|
2924
|
+
return /* @__PURE__ */ jsxs14(DropdownMenu, { children: [
|
|
2925
|
+
/* @__PURE__ */ jsxs14(Tooltip, { children: [
|
|
2936
2926
|
/* @__PURE__ */ jsx25(
|
|
2937
2927
|
DropdownMenuTrigger,
|
|
2938
2928
|
{
|
|
@@ -2953,12 +2943,12 @@ function DataTableHeaderFilter({
|
|
|
2953
2943
|
),
|
|
2954
2944
|
/* @__PURE__ */ jsx25(TooltipContent, { children: "Filter options" })
|
|
2955
2945
|
] }),
|
|
2956
|
-
/* @__PURE__ */ jsx25(DropdownMenuContent, { align: "end", className: "w-80", children: /* @__PURE__ */
|
|
2946
|
+
/* @__PURE__ */ jsx25(DropdownMenuContent, { align: "end", className: "w-80", children: /* @__PURE__ */ jsxs14(DropdownMenuGroup, { children: [
|
|
2957
2947
|
/* @__PURE__ */ jsx25(DropdownMenuLabel, { children: "Filter by column" }),
|
|
2958
2948
|
/* @__PURE__ */ jsx25(DropdownMenuSeparator, {}),
|
|
2959
2949
|
/* @__PURE__ */ jsx25("div", { className: "max-h-64 overflow-y-auto space-y-2.5 p-1", children: filterableColumns.map((column) => {
|
|
2960
2950
|
const headerText = typeof column.columnDef.header === "string" ? column.columnDef.header : column.id;
|
|
2961
|
-
return /* @__PURE__ */
|
|
2951
|
+
return /* @__PURE__ */ jsxs14(
|
|
2962
2952
|
"div",
|
|
2963
2953
|
{
|
|
2964
2954
|
className: "flex items-center justify-between px-1",
|
|
@@ -2984,7 +2974,7 @@ function DataTableHeaderFilter({
|
|
|
2984
2974
|
column.id
|
|
2985
2975
|
);
|
|
2986
2976
|
}) }),
|
|
2987
|
-
columnFilters.length > 0 && /* @__PURE__ */
|
|
2977
|
+
columnFilters.length > 0 && /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
2988
2978
|
/* @__PURE__ */ jsx25(DropdownMenuSeparator, {}),
|
|
2989
2979
|
/* @__PURE__ */ jsx25(
|
|
2990
2980
|
DropdownMenuItem,
|
|
@@ -3003,7 +2993,7 @@ function DataTableHeaderFilter({
|
|
|
3003
2993
|
import { RotateCwIcon } from "lucide-react";
|
|
3004
2994
|
import { useRouter } from "next/navigation";
|
|
3005
2995
|
import { useState as useState4 } from "react";
|
|
3006
|
-
import { jsx as jsx26, jsxs as
|
|
2996
|
+
import { jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3007
2997
|
function DataTableHeaderRefresh({
|
|
3008
2998
|
onRefresh
|
|
3009
2999
|
}) {
|
|
@@ -3020,7 +3010,7 @@ function DataTableHeaderRefresh({
|
|
|
3020
3010
|
setIsRefreshing(false);
|
|
3021
3011
|
}, 750);
|
|
3022
3012
|
};
|
|
3023
|
-
return /* @__PURE__ */
|
|
3013
|
+
return /* @__PURE__ */ jsxs15(Tooltip, { children: [
|
|
3024
3014
|
/* @__PURE__ */ jsx26(
|
|
3025
3015
|
TooltipTrigger,
|
|
3026
3016
|
{
|
|
@@ -3034,7 +3024,7 @@ function DataTableHeaderRefresh({
|
|
|
3034
3024
|
children: /* @__PURE__ */ jsx26(
|
|
3035
3025
|
RotateCwIcon,
|
|
3036
3026
|
{
|
|
3037
|
-
className:
|
|
3027
|
+
className: cn13(
|
|
3038
3028
|
"transition-transform duration-750",
|
|
3039
3029
|
isRefreshing && "animate-spin"
|
|
3040
3030
|
)
|
|
@@ -3050,23 +3040,22 @@ function DataTableHeaderRefresh({
|
|
|
3050
3040
|
|
|
3051
3041
|
// src/components/composed/data-table/table-header-search.tsx
|
|
3052
3042
|
import { XIcon as XIcon2 } from "lucide-react";
|
|
3053
|
-
import { jsx as jsx27, jsxs as
|
|
3043
|
+
import { jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3054
3044
|
function DataTableHeaderSearch({
|
|
3055
|
-
value,
|
|
3056
|
-
onChange
|
|
3057
|
-
placeholder = "Search..."
|
|
3045
|
+
value = "",
|
|
3046
|
+
onChange
|
|
3058
3047
|
}) {
|
|
3059
|
-
return /* @__PURE__ */
|
|
3048
|
+
return /* @__PURE__ */ jsxs16("div", { className: "relative flex items-center max-w-sm w-full", children: [
|
|
3060
3049
|
/* @__PURE__ */ jsx27(
|
|
3061
3050
|
Input,
|
|
3062
3051
|
{
|
|
3063
|
-
placeholder,
|
|
3064
|
-
value,
|
|
3052
|
+
placeholder: "Search...",
|
|
3053
|
+
value: value != null ? value : "",
|
|
3065
3054
|
onChange: (event) => onChange(event.target.value),
|
|
3066
3055
|
className: "pr-7"
|
|
3067
3056
|
}
|
|
3068
3057
|
),
|
|
3069
|
-
value && /* @__PURE__ */ jsx27(
|
|
3058
|
+
Boolean(value) && /* @__PURE__ */ jsx27(
|
|
3070
3059
|
"button",
|
|
3071
3060
|
{
|
|
3072
3061
|
type: "button",
|
|
@@ -3080,15 +3069,15 @@ function DataTableHeaderSearch({
|
|
|
3080
3069
|
}
|
|
3081
3070
|
|
|
3082
3071
|
// src/components/composed/data-table/table-header-sort.tsx
|
|
3083
|
-
import { ArrowDownIcon
|
|
3084
|
-
import { Fragment as Fragment3, jsx as jsx28, jsxs as
|
|
3072
|
+
import { ArrowDownIcon, ArrowUpDownIcon, ArrowUpIcon } from "lucide-react";
|
|
3073
|
+
import { Fragment as Fragment3, jsx as jsx28, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3085
3074
|
function DataTableHeaderSort({
|
|
3086
3075
|
table,
|
|
3087
3076
|
sorting
|
|
3088
3077
|
}) {
|
|
3089
3078
|
const sortableColumns = table.getAllColumns().filter((column) => column.getCanSort());
|
|
3090
|
-
return /* @__PURE__ */
|
|
3091
|
-
/* @__PURE__ */
|
|
3079
|
+
return /* @__PURE__ */ jsxs17(DropdownMenu, { children: [
|
|
3080
|
+
/* @__PURE__ */ jsxs17(Tooltip, { children: [
|
|
3092
3081
|
/* @__PURE__ */ jsx28(
|
|
3093
3082
|
DropdownMenuTrigger,
|
|
3094
3083
|
{
|
|
@@ -3100,7 +3089,7 @@ function DataTableHeaderSort({
|
|
|
3100
3089
|
{
|
|
3101
3090
|
variant: sorting.length > 0 ? "secondary" : "outline",
|
|
3102
3091
|
size: "icon",
|
|
3103
|
-
children: /* @__PURE__ */ jsx28(
|
|
3092
|
+
children: /* @__PURE__ */ jsx28(ArrowUpDownIcon, {})
|
|
3104
3093
|
}
|
|
3105
3094
|
)
|
|
3106
3095
|
}
|
|
@@ -3109,13 +3098,13 @@ function DataTableHeaderSort({
|
|
|
3109
3098
|
),
|
|
3110
3099
|
/* @__PURE__ */ jsx28(TooltipContent, { children: "Sort options" })
|
|
3111
3100
|
] }),
|
|
3112
|
-
/* @__PURE__ */ jsx28(DropdownMenuContent, { align: "end", className: "w-48", children: /* @__PURE__ */
|
|
3101
|
+
/* @__PURE__ */ jsx28(DropdownMenuContent, { align: "end", className: "w-48", children: /* @__PURE__ */ jsxs17(DropdownMenuGroup, { children: [
|
|
3113
3102
|
/* @__PURE__ */ jsx28(DropdownMenuLabel, { children: "Sort by column" }),
|
|
3114
3103
|
/* @__PURE__ */ jsx28(DropdownMenuSeparator, {}),
|
|
3115
3104
|
sortableColumns.map((column) => {
|
|
3116
3105
|
const isSorted = column.getIsSorted();
|
|
3117
3106
|
const headerText = typeof column.columnDef.header === "string" ? column.columnDef.header : column.id;
|
|
3118
|
-
return /* @__PURE__ */
|
|
3107
|
+
return /* @__PURE__ */ jsxs17(
|
|
3119
3108
|
DropdownMenuItem,
|
|
3120
3109
|
{
|
|
3121
3110
|
className: "flex items-center justify-between hover:cursor-pointer capitalize",
|
|
@@ -3129,22 +3118,22 @@ function DataTableHeaderSort({
|
|
|
3129
3118
|
}
|
|
3130
3119
|
},
|
|
3131
3120
|
children: [
|
|
3132
|
-
|
|
3133
|
-
isSorted === "asc" && /* @__PURE__ */ jsx28(
|
|
3134
|
-
isSorted === "desc" && /* @__PURE__ */ jsx28(
|
|
3121
|
+
headerText,
|
|
3122
|
+
isSorted === "asc" && /* @__PURE__ */ jsx28(ArrowUpIcon, { className: "size-3.5" }),
|
|
3123
|
+
isSorted === "desc" && /* @__PURE__ */ jsx28(ArrowDownIcon, { className: "size-3.5" })
|
|
3135
3124
|
]
|
|
3136
3125
|
},
|
|
3137
3126
|
column.id
|
|
3138
3127
|
);
|
|
3139
3128
|
}),
|
|
3140
|
-
sorting.length > 0 && /* @__PURE__ */
|
|
3129
|
+
sorting.length > 0 && /* @__PURE__ */ jsxs17(Fragment3, { children: [
|
|
3141
3130
|
/* @__PURE__ */ jsx28(DropdownMenuSeparator, {}),
|
|
3142
3131
|
/* @__PURE__ */ jsx28(
|
|
3143
3132
|
DropdownMenuItem,
|
|
3144
3133
|
{
|
|
3145
3134
|
className: "hover:cursor-pointer text-destructive focus:text-destructive",
|
|
3146
3135
|
onClick: () => table.resetSorting(),
|
|
3147
|
-
children: "Clear
|
|
3136
|
+
children: "Clear sorting"
|
|
3148
3137
|
}
|
|
3149
3138
|
)
|
|
3150
3139
|
] })
|
|
@@ -3154,12 +3143,12 @@ function DataTableHeaderSort({
|
|
|
3154
3143
|
|
|
3155
3144
|
// src/components/composed/data-table/table-header-toggle.tsx
|
|
3156
3145
|
import { Columns3CogIcon } from "lucide-react";
|
|
3157
|
-
import { jsx as jsx29, jsxs as
|
|
3146
|
+
import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3158
3147
|
function DataTableHeaderToggle({
|
|
3159
3148
|
table
|
|
3160
3149
|
}) {
|
|
3161
|
-
return /* @__PURE__ */
|
|
3162
|
-
/* @__PURE__ */
|
|
3150
|
+
return /* @__PURE__ */ jsxs18(DropdownMenu, { children: [
|
|
3151
|
+
/* @__PURE__ */ jsxs18(Tooltip, { children: [
|
|
3163
3152
|
/* @__PURE__ */ jsx29(
|
|
3164
3153
|
DropdownMenuTrigger,
|
|
3165
3154
|
{
|
|
@@ -3173,7 +3162,7 @@ function DataTableHeaderToggle({
|
|
|
3173
3162
|
),
|
|
3174
3163
|
/* @__PURE__ */ jsx29(TooltipContent, { children: "Toggle columns" })
|
|
3175
3164
|
] }),
|
|
3176
|
-
/* @__PURE__ */ jsx29(DropdownMenuContent, { align: "end", className: "w-48", children: /* @__PURE__ */
|
|
3165
|
+
/* @__PURE__ */ jsx29(DropdownMenuContent, { align: "end", className: "w-48", children: /* @__PURE__ */ jsxs18(DropdownMenuGroup, { children: [
|
|
3177
3166
|
/* @__PURE__ */ jsx29(DropdownMenuLabel, { children: "Toggle columns" }),
|
|
3178
3167
|
/* @__PURE__ */ jsx29(DropdownMenuSeparator, {}),
|
|
3179
3168
|
table.getAllColumns().filter(
|
|
@@ -3198,7 +3187,7 @@ function DataTableHeaderToggle({
|
|
|
3198
3187
|
// src/components/composed/data-table/data-row-actions.tsx
|
|
3199
3188
|
import { MoreHorizontal } from "lucide-react";
|
|
3200
3189
|
import { Fragment as Fragment4 } from "react";
|
|
3201
|
-
import { Fragment as Fragment5, jsx as jsx30, jsxs as
|
|
3190
|
+
import { Fragment as Fragment5, jsx as jsx30, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3202
3191
|
function RowActions({
|
|
3203
3192
|
label = "Actions",
|
|
3204
3193
|
items = [],
|
|
@@ -3215,8 +3204,8 @@ function RowActions({
|
|
|
3215
3204
|
return /* @__PURE__ */ jsx30(
|
|
3216
3205
|
"div",
|
|
3217
3206
|
{
|
|
3218
|
-
className:
|
|
3219
|
-
children: /* @__PURE__ */
|
|
3207
|
+
className: cn13("flex items-center justify-end w-full", containerClassName),
|
|
3208
|
+
children: /* @__PURE__ */ jsxs19(DropdownMenu, { children: [
|
|
3220
3209
|
/* @__PURE__ */ jsx30(
|
|
3221
3210
|
DropdownMenuTrigger,
|
|
3222
3211
|
{
|
|
@@ -3227,9 +3216,9 @@ function RowActions({
|
|
|
3227
3216
|
DropdownMenuContent,
|
|
3228
3217
|
{
|
|
3229
3218
|
align,
|
|
3230
|
-
className:
|
|
3231
|
-
children: /* @__PURE__ */
|
|
3232
|
-
label && /* @__PURE__ */
|
|
3219
|
+
className: cn13("w-40", contentClassName),
|
|
3220
|
+
children: /* @__PURE__ */ jsxs19(DropdownMenuGroup, { children: [
|
|
3221
|
+
label && /* @__PURE__ */ jsxs19(Fragment5, { children: [
|
|
3233
3222
|
/* @__PURE__ */ jsx30(DropdownMenuLabel, { children: label }),
|
|
3234
3223
|
/* @__PURE__ */ jsx30(DropdownMenuSeparator, {})
|
|
3235
3224
|
] }),
|
|
@@ -3237,14 +3226,14 @@ function RowActions({
|
|
|
3237
3226
|
var _a;
|
|
3238
3227
|
const itemKey = (_a = item.id) != null ? _a : `${item.label}-${index}`;
|
|
3239
3228
|
const isDestructive = item.variant === "destructive";
|
|
3240
|
-
return /* @__PURE__ */
|
|
3229
|
+
return /* @__PURE__ */ jsxs19(Fragment4, { children: [
|
|
3241
3230
|
item.separatorBefore && /* @__PURE__ */ jsx30(DropdownMenuSeparator, {}),
|
|
3242
|
-
/* @__PURE__ */
|
|
3231
|
+
/* @__PURE__ */ jsxs19(
|
|
3243
3232
|
DropdownMenuItem,
|
|
3244
3233
|
{
|
|
3245
3234
|
onClick: item.onClick,
|
|
3246
3235
|
disabled: item.disabled,
|
|
3247
|
-
className:
|
|
3236
|
+
className: cn13(
|
|
3248
3237
|
"hover:cursor-pointer flex items-center gap-2",
|
|
3249
3238
|
isDestructive && "text-destructive focus:text-destructive",
|
|
3250
3239
|
item.className
|
|
@@ -3267,7 +3256,7 @@ function RowActions({
|
|
|
3267
3256
|
}
|
|
3268
3257
|
|
|
3269
3258
|
// src/components/composed/data-table/data-table.tsx
|
|
3270
|
-
import { jsx as jsx31, jsxs as
|
|
3259
|
+
import { jsx as jsx31, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3271
3260
|
function DataTable({
|
|
3272
3261
|
columns,
|
|
3273
3262
|
data,
|
|
@@ -3277,22 +3266,13 @@ function DataTable({
|
|
|
3277
3266
|
onRefresh,
|
|
3278
3267
|
onDownload,
|
|
3279
3268
|
exportFilename = "data-export",
|
|
3280
|
-
isLoading = false,
|
|
3281
|
-
searchPlaceholder = "Search...",
|
|
3282
3269
|
showSearchInput = true,
|
|
3283
3270
|
showRefreshButton = true,
|
|
3284
3271
|
showSortButton = true,
|
|
3285
3272
|
showFilterButton = true,
|
|
3286
3273
|
showDownloadButton = true,
|
|
3287
3274
|
showColumnToggleButton = true,
|
|
3288
|
-
showAddButton = true
|
|
3289
|
-
emptyIcon,
|
|
3290
|
-
emptyTitle,
|
|
3291
|
-
emptyDescription,
|
|
3292
|
-
emptyButtonText,
|
|
3293
|
-
emptyRender,
|
|
3294
|
-
onEmptyAction,
|
|
3295
|
-
renderEmptyState
|
|
3275
|
+
showAddButton = true
|
|
3296
3276
|
}) {
|
|
3297
3277
|
const [createOpen, setCreateOpen] = useState5(false);
|
|
3298
3278
|
const [sorting, setSorting] = useState5([]);
|
|
@@ -3308,46 +3288,53 @@ function DataTable({
|
|
|
3308
3288
|
features,
|
|
3309
3289
|
data,
|
|
3310
3290
|
columns: columnsWithSmartFilters,
|
|
3291
|
+
initialState: {
|
|
3292
|
+
globalFilter: ""
|
|
3293
|
+
},
|
|
3311
3294
|
onSortingChange: setSorting,
|
|
3312
3295
|
onColumnFiltersChange: setColumnFilters,
|
|
3313
3296
|
onColumnVisibilityChange: setColumnVisibility,
|
|
3314
|
-
onGlobalFilterChange:
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3297
|
+
onGlobalFilterChange: (updater) => {
|
|
3298
|
+
setGlobalFilter((prev) => {
|
|
3299
|
+
const next = typeof updater === "function" ? updater(prev) : updater;
|
|
3300
|
+
return next != null ? next : "";
|
|
3301
|
+
});
|
|
3302
|
+
},
|
|
3303
|
+
state: {
|
|
3304
|
+
sorting,
|
|
3305
|
+
columnFilters,
|
|
3306
|
+
columnVisibility,
|
|
3307
|
+
globalFilter: globalFilter != null ? globalFilter : ""
|
|
3323
3308
|
}
|
|
3324
|
-
|
|
3325
|
-
|
|
3309
|
+
});
|
|
3310
|
+
if (data.length === 0) {
|
|
3311
|
+
const hasCreateAction = Boolean(renderCreateDialog);
|
|
3312
|
+
const hasRefreshAction = Boolean(onRefresh);
|
|
3313
|
+
return /* @__PURE__ */ jsxs20("div", { className: "space-y-2", children: [
|
|
3326
3314
|
/* @__PURE__ */ jsx31(
|
|
3327
3315
|
StateEmpty,
|
|
3328
3316
|
{
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
render:
|
|
3317
|
+
state: "outline",
|
|
3318
|
+
icon: /* @__PURE__ */ jsx31(FolderOpenIcon, { className: "size-6 text-muted-foreground" }),
|
|
3319
|
+
title: "No Data Available",
|
|
3320
|
+
description: "There are currently no records to display. Create a new record to get started.",
|
|
3321
|
+
buttonText: hasCreateAction ? addLabel != null ? addLabel : "Add Record" : hasRefreshAction ? "Refresh" : void 0,
|
|
3322
|
+
render: hasCreateAction ? () => setCreateOpen(true) : hasRefreshAction ? onRefresh : void 0
|
|
3335
3323
|
}
|
|
3336
3324
|
),
|
|
3337
3325
|
renderCreateDialog == null ? void 0 : renderCreateDialog(createOpen, setCreateOpen)
|
|
3338
3326
|
] });
|
|
3339
3327
|
}
|
|
3340
|
-
return /* @__PURE__ */
|
|
3341
|
-
/* @__PURE__ */
|
|
3328
|
+
return /* @__PURE__ */ jsxs20("div", { className: "space-y-2", children: [
|
|
3329
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-row items-center justify-between gap-1", children: [
|
|
3342
3330
|
showSearchInput ? /* @__PURE__ */ jsx31(
|
|
3343
3331
|
DataTableHeaderSearch,
|
|
3344
3332
|
{
|
|
3345
3333
|
value: globalFilter,
|
|
3346
|
-
onChange: setGlobalFilter
|
|
3347
|
-
placeholder: searchPlaceholder
|
|
3334
|
+
onChange: setGlobalFilter
|
|
3348
3335
|
}
|
|
3349
3336
|
) : /* @__PURE__ */ jsx31("div", {}),
|
|
3350
|
-
/* @__PURE__ */
|
|
3337
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex flex-row items-center gap-1", children: [
|
|
3351
3338
|
showRefreshButton && /* @__PURE__ */ jsx31(DataTableHeaderRefresh, { onRefresh }),
|
|
3352
3339
|
showSortButton && /* @__PURE__ */ jsx31(DataTableHeaderSort, { table, sorting }),
|
|
3353
3340
|
showFilterButton && /* @__PURE__ */ jsx31(
|
|
@@ -3376,18 +3363,11 @@ function DataTable({
|
|
|
3376
3363
|
] })
|
|
3377
3364
|
] }),
|
|
3378
3365
|
renderCreateDialog == null ? void 0 : renderCreateDialog(createOpen, setCreateOpen),
|
|
3379
|
-
/* @__PURE__ */ jsx31("div", { className: "overflow-hidden rounded-md border [&_[data-slot=table-container]]:no-scrollbar", children: /* @__PURE__ */
|
|
3366
|
+
/* @__PURE__ */ jsx31("div", { className: "overflow-hidden rounded-md border [&_[data-slot=table-container]]:no-scrollbar", children: /* @__PURE__ */ jsxs20(Table, { children: [
|
|
3380
3367
|
/* @__PURE__ */ jsx31(DataTableContentHeader, { table }),
|
|
3381
|
-
/* @__PURE__ */ jsx31(
|
|
3382
|
-
DataTableContentBody,
|
|
3383
|
-
{
|
|
3384
|
-
table,
|
|
3385
|
-
columns,
|
|
3386
|
-
isLoading
|
|
3387
|
-
}
|
|
3388
|
-
)
|
|
3368
|
+
/* @__PURE__ */ jsx31(DataTableContentBody, { table, columns })
|
|
3389
3369
|
] }) }),
|
|
3390
|
-
/* @__PURE__ */
|
|
3370
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between px-2", children: [
|
|
3391
3371
|
/* @__PURE__ */ jsx31(DataTableFooterEntries, { table }),
|
|
3392
3372
|
/* @__PURE__ */ jsx31(DataTableFooterPagination, { table })
|
|
3393
3373
|
] })
|
|
@@ -3473,7 +3453,7 @@ function TabsTrigger(_a) {
|
|
|
3473
3453
|
}
|
|
3474
3454
|
|
|
3475
3455
|
// src/components/composed/header-tabs.tsx
|
|
3476
|
-
import { jsx as jsx33, jsxs as
|
|
3456
|
+
import { jsx as jsx33, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3477
3457
|
function renderTabIcon(icon) {
|
|
3478
3458
|
if (!icon) return null;
|
|
3479
3459
|
if (typeof icon === "function" || typeof icon === "object" && icon !== null && "render" in icon) {
|
|
@@ -3494,8 +3474,8 @@ var HeaderTabs = memo3(function HeaderTabs2({
|
|
|
3494
3474
|
(item) => item.url === pathname || pathname.endsWith(item.url) || pathname.split("/").includes(item.value)
|
|
3495
3475
|
) : void 0;
|
|
3496
3476
|
const activeTab = (_b = value != null ? value : matchedItem == null ? void 0 : matchedItem.value) != null ? _b : (_a = items[0]) == null ? void 0 : _a.value;
|
|
3497
|
-
return /* @__PURE__ */
|
|
3498
|
-
/* @__PURE__ */ jsx33("div", { className: "w-full overflow-x-auto overflow-y-hidden border-b no-scrollbar", children: /* @__PURE__ */ jsx33(TabsList, { variant: "line", className: "inline-flex w-max justify-start", children: items.map(({ title, value: tabValue, url, icon }) => /* @__PURE__ */
|
|
3477
|
+
return /* @__PURE__ */ jsxs21(Tabs, { value: activeTab, onValueChange, className: "space-y-4", children: [
|
|
3478
|
+
/* @__PURE__ */ jsx33("div", { className: "w-full overflow-x-auto overflow-y-hidden border-b no-scrollbar", children: /* @__PURE__ */ jsx33(TabsList, { variant: "line", className: "inline-flex w-max justify-start", children: items.map(({ title, value: tabValue, url, icon }) => /* @__PURE__ */ jsxs21(
|
|
3499
3479
|
TabsTrigger,
|
|
3500
3480
|
{
|
|
3501
3481
|
nativeButton: false,
|
|
@@ -3514,14 +3494,14 @@ var HeaderTabs = memo3(function HeaderTabs2({
|
|
|
3514
3494
|
|
|
3515
3495
|
// src/components/composed/header-title.tsx
|
|
3516
3496
|
import { memo as memo4 } from "react";
|
|
3517
|
-
import { jsx as jsx34, jsxs as
|
|
3497
|
+
import { jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3518
3498
|
var HeaderTitle = memo4(function HeaderTitle2({
|
|
3519
3499
|
title,
|
|
3520
3500
|
subtitle,
|
|
3521
3501
|
children
|
|
3522
3502
|
}) {
|
|
3523
|
-
return /* @__PURE__ */
|
|
3524
|
-
/* @__PURE__ */
|
|
3503
|
+
return /* @__PURE__ */ jsxs22("div", { className: "w-full space-y-4", children: [
|
|
3504
|
+
/* @__PURE__ */ jsxs22("div", { children: [
|
|
3525
3505
|
/* @__PURE__ */ jsx34("h1", { className: "font-semibold", children: title }),
|
|
3526
3506
|
/* @__PURE__ */ jsx34("p", { className: "text-xs text-muted-foreground", children: subtitle })
|
|
3527
3507
|
] }),
|
|
@@ -3547,6 +3527,7 @@ export {
|
|
|
3547
3527
|
RowActions,
|
|
3548
3528
|
StateEmpty,
|
|
3549
3529
|
exportToCSV,
|
|
3530
|
+
exportToPDF,
|
|
3550
3531
|
exportToXLSX,
|
|
3551
3532
|
features,
|
|
3552
3533
|
flexRender3 as flexRender,
|