@prediktif/ui 0.1.18 → 0.1.19

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