@northslopetech/altitude-ui 3.0.0-alpha.13 → 3.0.0-alpha.14

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
@@ -52,6 +52,7 @@ __export(index_exports, {
52
52
  ArrowLeftIcon: () => ArrowLeftIcon,
53
53
  ArrowRightIcon: () => ArrowRightIcon,
54
54
  ArrowUpIcon: () => ArrowUpIcon,
55
+ ArrowsDownUpIcon: () => ArrowsDownUpIcon,
55
56
  Avatar: () => Avatar,
56
57
  AvatarFallback: () => AvatarFallback,
57
58
  AvatarGroup: () => AvatarGroup,
@@ -98,6 +99,10 @@ __export(index_exports, {
98
99
  CloseIcon: () => CloseIcon,
99
100
  CogIcon: () => CogIcon,
100
101
  CredentialsIcon: () => CredentialsIcon,
102
+ DataTableColumnHeader: () => DataTableColumnHeader,
103
+ DataTablePagination: () => DataTablePagination,
104
+ DataTableView: () => DataTableView,
105
+ DataTableViewOptions: () => DataTableViewOptions,
101
106
  DatePicker: () => DatePicker,
102
107
  DatePickerTrigger: () => DatePickerTrigger,
103
108
  Dialog: () => Dialog,
@@ -227,7 +232,14 @@ __export(index_exports, {
227
232
  StatementIcon: () => StatementIcon,
228
233
  Switch: () => Switch,
229
234
  Table: () => Table,
235
+ TableBody: () => TableBody,
236
+ TableCaption: () => TableCaption,
237
+ TableCell: () => TableCell,
238
+ TableFooter: () => TableFooter,
239
+ TableHead: () => TableHead,
240
+ TableHeader: () => TableHeader,
230
241
  TableIcon: () => TableIcon,
242
+ TableRow: () => TableRow,
231
243
  Tabs: () => Tabs,
232
244
  TabsContent: () => TabsContent,
233
245
  TabsList: () => TabsList,
@@ -489,6 +501,7 @@ var import_CaretDown = require("@phosphor-icons/react/CaretDown");
489
501
  var import_CaretLeft = require("@phosphor-icons/react/CaretLeft");
490
502
  var import_CaretRight = require("@phosphor-icons/react/CaretRight");
491
503
  var import_CaretUp = require("@phosphor-icons/react/CaretUp");
504
+ var import_ArrowsDownUp = require("@phosphor-icons/react/ArrowsDownUp");
492
505
  var import_ChatCircle = require("@phosphor-icons/react/ChatCircle");
493
506
  var import_CheckSquare = require("@phosphor-icons/react/CheckSquare");
494
507
  var import_X = require("@phosphor-icons/react/X");
@@ -570,6 +583,7 @@ var CaretDownIcon = createIcon(import_CaretDown.CaretDownIcon);
570
583
  var CaretLeftIcon = createIcon(import_CaretLeft.CaretLeftIcon);
571
584
  var CaretRightIcon = createIcon(import_CaretRight.CaretRightIcon);
572
585
  var CaretUpIcon = createIcon(import_CaretUp.CaretUpIcon);
586
+ var ArrowsDownUpIcon = createIcon(import_ArrowsDownUp.ArrowsDownUpIcon);
573
587
  var ChatIcon = createIcon(import_ChatCircle.ChatCircleIcon);
574
588
  var CheckmarkSquareIcon = createIcon(import_CheckSquare.CheckSquareIcon);
575
589
  var CloseIcon = createIcon(import_X.XIcon);
@@ -690,15 +704,75 @@ var import_button = require("@base-ui/react/button");
690
704
  var import_class_variance_authority3 = require("class-variance-authority");
691
705
  var import_jsx_runtime4 = require("react/jsx-runtime");
692
706
  var buttonVariants = (0, import_class_variance_authority3.cva)(
693
- "inline-flex items-center justify-center gap-2 whitespace-nowrap transition-colors focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
707
+ [
708
+ // Base layout
709
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap",
710
+ // Transitions
711
+ "transition-colors",
712
+ // Focus
713
+ "focus-visible:outline-none",
714
+ // Disabled
715
+ "disabled:pointer-events-none disabled:opacity-50",
716
+ // SVG children
717
+ "[&_svg]:pointer-events-none [&_svg]:shrink-0"
718
+ ],
694
719
  {
695
720
  variants: {
696
721
  variant: {
697
- default: "interactive-default interactive-default-fg border border-default shadow-sm hover:brightness-[90%] dark:hover:brightness-[130%] active:brightness-[80%] dark:active:brightness-[120%] focus-visible:ring-2 focus-visible:ring-focus-default focus-visible:border-strong",
698
- primary: "interactive-accent interactive-accent-fg hover:brightness-[90%] dark:hover:brightness-[130%] active:brightness-[80%] dark:active:brightness-[120%] focus-visible:ring-2 focus-visible:ring-focus-default",
699
- destructive: "interactive-destructive interactive-destructive-fg hover:brightness-[90%] dark:hover:brightness-[130%] active:brightness-[80%] dark:active:brightness-[120%] focus-visible:ring-3 focus-visible:ring-focus-error",
700
- ghost: "interactive-default interactive-default-fg hover:brightness-[90%] dark:hover:brightness-[130%] active:brightness-[80%] dark:active:brightness-[120%] focus-visible:ring-2 focus-visible:ring-focus-default",
701
- link: "h-6 px-0 py-0 rounded-sm text-default underline underline-offset-2 focus-visible:ring-2 focus-visible:ring-focus-default"
722
+ default: [
723
+ // Base
724
+ "interactive-default interactive-default-fg",
725
+ "border border-default shadow-xs",
726
+ // Hover & active
727
+ "hover:brightness-[90%] dark:hover:brightness-[130%]",
728
+ "active:brightness-[80%] dark:active:brightness-[120%]",
729
+ // Focus
730
+ "focus-visible:ring-2 focus-visible:ring-focus-default focus-visible:border-strong"
731
+ ],
732
+ primary: [
733
+ // Base
734
+ "interactive-accent interactive-accent-fg",
735
+ // Hover & active
736
+ "hover:brightness-[90%] dark:hover:brightness-[130%]",
737
+ "active:brightness-[80%] dark:active:brightness-[120%]",
738
+ // Focus
739
+ "focus-visible:ring-2 focus-visible:ring-focus-default"
740
+ ],
741
+ destructive: [
742
+ // Base
743
+ "interactive-destructive interactive-destructive-fg",
744
+ // Hover & active
745
+ "hover:brightness-[90%] dark:hover:brightness-[130%]",
746
+ "active:brightness-[80%] dark:active:brightness-[120%]",
747
+ // Focus
748
+ "focus-visible:ring-3 focus-visible:ring-focus-error"
749
+ ],
750
+ "destructive-subtle": [
751
+ // Base
752
+ "interactive-default text-error shadow-xs",
753
+ "border border-default",
754
+ // Hover & active
755
+ "hover:interactive-hover",
756
+ "active:brightness-[80%] dark:active:brightness-[120%]",
757
+ // Focus
758
+ "focus-visible:ring-3 focus-visible:ring-focus-error"
759
+ ],
760
+ ghost: [
761
+ // Base
762
+ "bg-transparent interactive-default-fg",
763
+ // Hover & active
764
+ "hover:interactive-hover",
765
+ "active:interactive-active",
766
+ // Focus
767
+ "focus-visible:ring-2 focus-visible:ring-focus-default"
768
+ ],
769
+ link: [
770
+ // Base
771
+ "h-6 px-0 py-0 rounded-sm",
772
+ "text-default underline underline-offset-2",
773
+ // Focus
774
+ "focus-visible:ring-2 focus-visible:ring-focus-default"
775
+ ]
702
776
  },
703
777
  size: {
704
778
  default: "h-9 rounded-md px-4 py-2 type-label-sm-medium",
@@ -711,17 +785,26 @@ var buttonVariants = (0, import_class_variance_authority3.cva)(
711
785
  {
712
786
  variant: "link",
713
787
  size: ["default", "sm"],
714
- className: "type-body-sm-regular hover:type-body-sm-semibold active:type-body-sm-semibold"
788
+ className: [
789
+ "type-body-sm-regular",
790
+ "hover:type-body-sm-semibold active:type-body-sm-semibold"
791
+ ]
715
792
  },
716
793
  {
717
794
  variant: "link",
718
795
  size: "lg",
719
- className: "type-body-md-regular hover:type-body-md-semibold active:type-body-md-semibold"
796
+ className: [
797
+ "type-body-md-regular",
798
+ "hover:type-body-md-semibold active:type-body-md-semibold"
799
+ ]
720
800
  },
721
801
  {
722
802
  variant: "link",
723
803
  size: "mini",
724
- className: "type-body-xs-regular hover:type-body-xs-semibold active:type-body-xs-semibold"
804
+ className: [
805
+ "type-body-xs-regular",
806
+ "hover:type-body-xs-semibold active:type-body-xs-semibold"
807
+ ]
725
808
  }
726
809
  ],
727
810
  defaultVariants: {
@@ -6394,160 +6477,418 @@ function PieChart({
6394
6477
  }
6395
6478
 
6396
6479
  // src/components/ui/table.tsx
6397
- var import_react2 = require("react");
6398
- var import_react_table = require("@tanstack/react-table");
6399
6480
  var import_jsx_runtime44 = require("react/jsx-runtime");
6400
- function Table({
6481
+ function Table({ className, ref, ...props }) {
6482
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
6483
+ "div",
6484
+ {
6485
+ "data-slot": "table-container",
6486
+ className: "relative w-full overflow-x-auto",
6487
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
6488
+ "table",
6489
+ {
6490
+ ref,
6491
+ "data-slot": "table",
6492
+ className: cn(
6493
+ // Layout
6494
+ "w-full caption-bottom",
6495
+ className
6496
+ ),
6497
+ ...props
6498
+ }
6499
+ )
6500
+ }
6501
+ );
6502
+ }
6503
+ function TableHeader({
6504
+ className,
6505
+ ref,
6506
+ ...props
6507
+ }) {
6508
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
6509
+ "thead",
6510
+ {
6511
+ ref,
6512
+ "data-slot": "table-header",
6513
+ className: cn(
6514
+ // Surface
6515
+ "surface-secondary",
6516
+ // Border
6517
+ "[&_tr]:border-b [&_tr]:border-default",
6518
+ className
6519
+ ),
6520
+ ...props
6521
+ }
6522
+ );
6523
+ }
6524
+ function TableBody({
6525
+ className,
6526
+ ref,
6527
+ ...props
6528
+ }) {
6529
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("tbody", { ref, "data-slot": "table-body", className, ...props });
6530
+ }
6531
+ function TableFooter({
6532
+ className,
6533
+ ref,
6534
+ ...props
6535
+ }) {
6536
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
6537
+ "tfoot",
6538
+ {
6539
+ ref,
6540
+ "data-slot": "table-footer",
6541
+ className: cn(
6542
+ // Surface
6543
+ "surface-secondary",
6544
+ // Border
6545
+ "border-t border-t-[var(--color-border-default)] [&>tr]:last:border-b-0",
6546
+ // Typography — descendant selector overrides TableCell's type-label-md-regular
6547
+ "[&_td]:font-medium",
6548
+ className
6549
+ ),
6550
+ ...props
6551
+ }
6552
+ );
6553
+ }
6554
+ function TableRow({ className, ref, ...props }) {
6555
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
6556
+ "tr",
6557
+ {
6558
+ ref,
6559
+ "data-slot": "table-row",
6560
+ className: cn(
6561
+ // Border
6562
+ "border-b border-default",
6563
+ // Surface & states
6564
+ "hover:interactive-hover data-[state=selected]:bg-[var(--color-surface-secondary)]",
6565
+ // Transition
6566
+ "transition-colors",
6567
+ className
6568
+ ),
6569
+ ...props
6570
+ }
6571
+ );
6572
+ }
6573
+ function TableHead({
6574
+ className,
6575
+ ref,
6576
+ align = "left",
6577
+ ...props
6578
+ }) {
6579
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
6580
+ "th",
6581
+ {
6582
+ ref,
6583
+ scope: "col",
6584
+ "data-slot": "table-head",
6585
+ className: cn(
6586
+ // Layout
6587
+ "h-8 px-2 align-middle gap-2",
6588
+ // Alignment
6589
+ align === "right" && "text-right",
6590
+ align === "left" && "text-left",
6591
+ // Typography
6592
+ "text-default type-body-sm-medium whitespace-nowrap",
6593
+ // Checkbox alignment
6594
+ "[&:has([role=checkbox])]:pr-0",
6595
+ className
6596
+ ),
6597
+ ...props
6598
+ }
6599
+ );
6600
+ }
6601
+ function TableCell({
6602
+ className,
6603
+ ref,
6604
+ align = "left",
6605
+ ...props
6606
+ }) {
6607
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
6608
+ "td",
6609
+ {
6610
+ ref,
6611
+ "data-slot": "table-cell",
6612
+ className: cn(
6613
+ // Layout
6614
+ "h-8 p-2 align-middle gap-2",
6615
+ // Alignment
6616
+ align === "right" && "text-right",
6617
+ align === "left" && "text-left",
6618
+ // Typography
6619
+ "text-default type-body-sm-regular whitespace-nowrap",
6620
+ // Checkbox alignment
6621
+ "[&:has([role=checkbox])]:pr-0",
6622
+ className
6623
+ ),
6624
+ ...props
6625
+ }
6626
+ );
6627
+ }
6628
+ function TableCaption({
6629
+ className,
6630
+ ref,
6631
+ ...props
6632
+ }) {
6633
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
6634
+ "caption",
6635
+ {
6636
+ ref,
6637
+ "data-slot": "table-caption",
6638
+ className: cn(
6639
+ // Layout
6640
+ "mt-4",
6641
+ // Typography
6642
+ "text-secondary type-body-sm-regular",
6643
+ className
6644
+ ),
6645
+ ...props
6646
+ }
6647
+ );
6648
+ }
6649
+
6650
+ // src/components/ui/data-table/data-table-view.tsx
6651
+ var import_react_table = require("@tanstack/react-table");
6652
+ var import_jsx_runtime45 = require("react/jsx-runtime");
6653
+ function DataTableView({
6401
6654
  table,
6655
+ emptyState = "No results.",
6656
+ loading = false,
6657
+ getRowProps,
6402
6658
  className,
6403
- showPagination = false,
6404
- paginationClassName
6659
+ ...props
6405
6660
  }) {
6406
- const currentPage = table.getState().pagination.pageIndex;
6407
- const pageSize = table.getState().pagination.pageSize;
6408
- const totalPages = table.getPageCount();
6409
- const totalRows = table.getFilteredRowModel().rows.length;
6410
- const showingText = totalRows > 0 ? "Showing " + (currentPage * pageSize + 1) + "-" + Math.min((currentPage + 1) * pageSize, totalRows) + " of " + totalRows + " results" : "No results found";
6411
- const handlePreviousPage = (0, import_react2.useCallback)(() => {
6412
- table.previousPage();
6413
- }, [table]);
6414
- const handleNextPage = (0, import_react2.useCallback)(() => {
6415
- table.nextPage();
6416
- }, [table]);
6417
- const handlePageChange = (0, import_react2.useCallback)(
6418
- (pageIndex) => {
6419
- table.setPageIndex(pageIndex);
6420
- },
6421
- [table]
6661
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
6662
+ "div",
6663
+ {
6664
+ className: cn("relative", loading && "opacity-50 pointer-events-none"),
6665
+ "aria-busy": loading || void 0,
6666
+ children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Table, { className, ...props, children: [
6667
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(TableRow, { children: headerGroup.headers.map((header) => {
6668
+ const sorted = header.column.getIsSorted();
6669
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
6670
+ TableHead,
6671
+ {
6672
+ colSpan: header.colSpan,
6673
+ "aria-sort": sorted === "asc" ? "ascending" : sorted === "desc" ? "descending" : void 0,
6674
+ children: header.isPlaceholder ? null : (0, import_react_table.flexRender)(
6675
+ header.column.columnDef.header,
6676
+ header.getContext()
6677
+ )
6678
+ },
6679
+ header.id
6680
+ );
6681
+ }) }, headerGroup.id)) }),
6682
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(TableBody, { children: table.getRowModel().rows.length > 0 ? table.getRowModel().rows.map((row) => {
6683
+ const rowProps = getRowProps?.(row);
6684
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
6685
+ TableRow,
6686
+ {
6687
+ "data-state": row.getIsSelected() ? "selected" : void 0,
6688
+ ...rowProps,
6689
+ children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(TableCell, { children: (0, import_react_table.flexRender)(
6690
+ cell.column.columnDef.cell,
6691
+ cell.getContext()
6692
+ ) }, cell.id))
6693
+ },
6694
+ row.id
6695
+ );
6696
+ }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
6697
+ TableCell,
6698
+ {
6699
+ colSpan: table.getVisibleLeafColumns().length,
6700
+ className: "h-24 text-center text-secondary",
6701
+ children: emptyState
6702
+ }
6703
+ ) }) })
6704
+ ] })
6705
+ }
6422
6706
  );
6423
- const handlePageSizeChange = (0, import_react2.useCallback)(
6424
- (value) => {
6425
- table.setPageSize(Number(value));
6426
- },
6427
- [table]
6707
+ }
6708
+
6709
+ // src/components/ui/data-table/data-table-pagination.tsx
6710
+ var import_jsx_runtime46 = require("react/jsx-runtime");
6711
+ function DataTablePagination({
6712
+ table,
6713
+ pageSizeOptions = [10, 20, 50, 100],
6714
+ className,
6715
+ ...props
6716
+ }) {
6717
+ const { pageIndex, pageSize } = table.getState().pagination;
6718
+ const totalRows = table.getFilteredRowModel().rows.length;
6719
+ const from = totalRows > 0 ? pageIndex * pageSize + 1 : 0;
6720
+ const to = Math.min((pageIndex + 1) * pageSize, totalRows);
6721
+ const resolvedPageSizeOptions = pageSizeOptions.includes(pageSize) ? pageSizeOptions : [...pageSizeOptions, pageSize].sort((a, b) => a - b);
6722
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
6723
+ "div",
6724
+ {
6725
+ className: cn(
6726
+ "flex flex-wrap items-center justify-between gap-4 px-2 py-3",
6727
+ className
6728
+ ),
6729
+ ...props,
6730
+ children: [
6731
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
6732
+ Text,
6733
+ {
6734
+ variant: "body-sm",
6735
+ className: "text-secondary whitespace-nowrap",
6736
+ "aria-live": "polite",
6737
+ children: totalRows > 0 ? `Showing ${from}\u2013${to} of ${totalRows}` : "No results"
6738
+ }
6739
+ ),
6740
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center gap-1", children: [
6741
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
6742
+ Button,
6743
+ {
6744
+ variant: "ghost",
6745
+ size: "sm",
6746
+ onClick: () => table.firstPage(),
6747
+ disabled: !table.getCanPreviousPage(),
6748
+ "aria-label": "Go to first page",
6749
+ children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ArrowLeftIcon, { "aria-hidden": "true" })
6750
+ }
6751
+ ),
6752
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
6753
+ Button,
6754
+ {
6755
+ variant: "ghost",
6756
+ size: "sm",
6757
+ onClick: () => table.previousPage(),
6758
+ disabled: !table.getCanPreviousPage(),
6759
+ "aria-label": "Go to previous page",
6760
+ children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(CaretLeftIcon, { "aria-hidden": "true" })
6761
+ }
6762
+ ),
6763
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Text, { as: "span", variant: "body-sm", className: "px-2 whitespace-nowrap", children: table.getPageCount() > 0 ? `Page ${pageIndex + 1} of ${table.getPageCount()}` : "No pages" }),
6764
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
6765
+ Button,
6766
+ {
6767
+ variant: "ghost",
6768
+ size: "sm",
6769
+ onClick: () => table.nextPage(),
6770
+ disabled: !table.getCanNextPage(),
6771
+ "aria-label": "Go to next page",
6772
+ children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(CaretRightIcon, { "aria-hidden": "true" })
6773
+ }
6774
+ ),
6775
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
6776
+ Button,
6777
+ {
6778
+ variant: "ghost",
6779
+ size: "sm",
6780
+ onClick: () => table.lastPage(),
6781
+ disabled: !table.getCanNextPage(),
6782
+ "aria-label": "Go to last page",
6783
+ children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ArrowRightIcon, { "aria-hidden": "true" })
6784
+ }
6785
+ )
6786
+ ] }),
6787
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center gap-2", children: [
6788
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
6789
+ Text,
6790
+ {
6791
+ as: "span",
6792
+ variant: "body-sm",
6793
+ className: "text-secondary whitespace-nowrap",
6794
+ children: "Rows per page"
6795
+ }
6796
+ ),
6797
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
6798
+ Select,
6799
+ {
6800
+ value: pageSize.toString(),
6801
+ onValueChange: (value) => table.setPageSize(Number(value)),
6802
+ children: [
6803
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SelectTrigger, { className: "h-8 w-[70px]", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SelectValue, {}) }),
6804
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SelectContent, { children: resolvedPageSizeOptions.map((size) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SelectItem, { value: size.toString(), children: size }, size)) })
6805
+ ]
6806
+ }
6807
+ )
6808
+ ] })
6809
+ ]
6810
+ }
6428
6811
  );
6429
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { children: [
6430
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: cn("overflow-x-auto", className), children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("table", { className: "min-w-full divide-y divide-border", children: [
6431
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("thead", { className: "bg-inverse text-inverse", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("tr", { children: headerGroup.headers.map((header) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("th", { className: "px-6 py-3 text-left", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
6432
- "div",
6433
- {
6434
- className: `flex items-center space-x-1 ${header.column.getCanSort() ? "cursor-pointer select-none" : ""}`,
6435
- onClick: header.column.getToggleSortingHandler(),
6436
- children: [
6437
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
6438
- Text,
6439
- {
6440
- as: "span",
6441
- variant: "label-xs",
6442
- className: "text-inverse uppercase tracking-wider",
6443
- children: (0, import_react_table.flexRender)(
6444
- header.column.columnDef.header,
6445
- header.getContext()
6446
- )
6447
- }
6448
- ),
6449
- header.column.getCanSort() && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "ml-1", children: [
6450
- header.column.getIsSorted() === "asc" && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CaretUpIcon, { className: "text-inverse" }),
6451
- header.column.getIsSorted() === "desc" && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CaretDownIcon, { className: "text-inverse" })
6452
- ] })
6453
- ]
6454
- }
6455
- ) }, header.id)) }, headerGroup.id)) }),
6456
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("tbody", { className: "surface-default divide-y divide-border", children: table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("tr", { children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text, { variant: "body-sm", children: (0, import_react_table.flexRender)(
6457
- cell.column.columnDef.cell,
6458
- cell.getContext()
6459
- ) }) }, cell.id)) }, row.id)) })
6460
- ] }) }),
6461
- showPagination && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
6462
- "div",
6812
+ }
6813
+
6814
+ // src/components/ui/data-table/data-table-column-header.tsx
6815
+ var import_jsx_runtime47 = require("react/jsx-runtime");
6816
+ function DataTableColumnHeader({
6817
+ column,
6818
+ title,
6819
+ className,
6820
+ ...props
6821
+ }) {
6822
+ if (!column.getCanSort()) {
6823
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
6824
+ Text,
6463
6825
  {
6464
- className: cn(
6465
- "flex items-center justify-between px-6 py-3 surface-default border-t border-subtle",
6466
- paginationClassName
6467
- ),
6468
- children: [
6469
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text, { variant: "body-sm", className: "text-secondary", children: showingText }) }),
6470
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex items-center space-x-1", children: [
6471
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
6472
- Button,
6473
- {
6474
- variant: "ghost",
6475
- size: "sm",
6476
- onClick: handlePreviousPage,
6477
- disabled: !table.getCanPreviousPage(),
6478
- className: "p-2",
6479
- children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ArrowLeftIcon, {})
6480
- }
6481
- ),
6482
- Array.from(
6483
- { length: Math.min(5, table.getPageCount()) },
6484
- (_, i) => {
6485
- let pageNumber;
6486
- if (totalPages <= 5) {
6487
- pageNumber = i;
6488
- } else if (currentPage <= 2) {
6489
- pageNumber = i;
6490
- } else if (currentPage >= totalPages - 3) {
6491
- pageNumber = totalPages - 5 + i;
6492
- } else {
6493
- pageNumber = currentPage - 2 + i;
6494
- }
6495
- const isActive = pageNumber === currentPage;
6496
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
6497
- Button,
6498
- {
6499
- variant: isActive ? "default" : "ghost",
6500
- size: "sm",
6501
- onClick: () => handlePageChange(pageNumber),
6502
- className: "min-w-8 h-8 p-0",
6503
- children: pageNumber + 1
6504
- },
6505
- pageNumber
6506
- );
6507
- }
6508
- ),
6509
- table.getPageCount() > 5 && currentPage < totalPages - 3 && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
6510
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "px-1 text-secondary", children: "..." }),
6511
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text, { variant: "body-sm", className: "text-secondary", children: totalPages })
6512
- ] }),
6513
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
6514
- Button,
6515
- {
6516
- variant: "ghost",
6517
- size: "sm",
6518
- onClick: handleNextPage,
6519
- disabled: !table.getCanNextPage(),
6520
- className: "p-2",
6521
- children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ArrowRightIcon, {})
6522
- }
6523
- )
6524
- ] }),
6525
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex items-center gap-3 w-48", children: [
6526
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
6527
- Text,
6528
- {
6529
- variant: "body-sm",
6530
- className: "text-secondary whitespace-nowrap",
6531
- children: "Rows per page:"
6532
- }
6533
- ),
6534
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
6535
- Select,
6536
- {
6537
- value: table.getState().pagination.pageSize.toString(),
6538
- onValueChange: handlePageSizeChange,
6539
- children: [
6540
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SelectTrigger, { className: "min-w-0 h-8", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SelectValue, {}) }),
6541
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SelectContent, { children: [10, 20, 50, 100].map((size) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SelectItem, { value: size.toString(), children: size }, size)) })
6542
- ]
6543
- }
6544
- )
6545
- ] })
6546
- ]
6826
+ as: "div",
6827
+ variant: "body-sm-medium",
6828
+ className: cn(className),
6829
+ ...props,
6830
+ children: title
6831
+ }
6832
+ );
6833
+ }
6834
+ const sorted = column.getIsSorted();
6835
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: cn("flex items-center gap-2", className), ...props, children: [
6836
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Text, { as: "span", variant: "body-sm-medium", children: title }),
6837
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
6838
+ Button,
6839
+ {
6840
+ variant: "ghost",
6841
+ size: "mini",
6842
+ onClick: () => {
6843
+ setTimeout(() => {
6844
+ column.toggleSorting(sorted === "asc");
6845
+ }, 0);
6846
+ },
6847
+ "aria-label": `Sort by ${title}`,
6848
+ className: "text-secondary",
6849
+ children: sorted === "desc" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CaretDownIcon, { "aria-hidden": "true" }) : sorted === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CaretUpIcon, { "aria-hidden": "true" }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(ArrowsDownUpIcon, { "aria-hidden": "true", size: 16 })
6547
6850
  }
6548
6851
  )
6549
6852
  ] });
6550
6853
  }
6854
+
6855
+ // src/components/ui/data-table/data-table-view-options.tsx
6856
+ var import_jsx_runtime48 = require("react/jsx-runtime");
6857
+ function DataTableViewOptions({
6858
+ table,
6859
+ ...props
6860
+ }) {
6861
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(DropdownMenu, { children: [
6862
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
6863
+ DropdownMenuTrigger,
6864
+ {
6865
+ render: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
6866
+ Button,
6867
+ {
6868
+ variant: "ghost",
6869
+ size: "sm",
6870
+ ...props,
6871
+ "aria-label": "Table options",
6872
+ children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(CogIcon, { "aria-hidden": "true" })
6873
+ }
6874
+ )
6875
+ }
6876
+ ),
6877
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(DropdownMenuContent, { align: "end", children: [
6878
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DropdownMenuLabel, { children: "Toggle columns" }),
6879
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DropdownMenuSeparator, {}),
6880
+ table.getAllColumns().filter((column) => column.getCanHide()).map((column) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
6881
+ DropdownMenuCheckboxItem,
6882
+ {
6883
+ checked: column.getIsVisible(),
6884
+ onCheckedChange: (value) => column.toggleVisibility(!!value),
6885
+ children: typeof column.columnDef.header === "string" ? column.columnDef.header : column.id
6886
+ },
6887
+ column.id
6888
+ ))
6889
+ ] })
6890
+ ] });
6891
+ }
6551
6892
  // Annotate the CommonJS export names for ESM import in node:
6552
6893
  0 && (module.exports = {
6553
6894
  Accordion,
@@ -6572,6 +6913,7 @@ function Table({
6572
6913
  ArrowLeftIcon,
6573
6914
  ArrowRightIcon,
6574
6915
  ArrowUpIcon,
6916
+ ArrowsDownUpIcon,
6575
6917
  Avatar,
6576
6918
  AvatarFallback,
6577
6919
  AvatarGroup,
@@ -6618,6 +6960,10 @@ function Table({
6618
6960
  CloseIcon,
6619
6961
  CogIcon,
6620
6962
  CredentialsIcon,
6963
+ DataTableColumnHeader,
6964
+ DataTablePagination,
6965
+ DataTableView,
6966
+ DataTableViewOptions,
6621
6967
  DatePicker,
6622
6968
  DatePickerTrigger,
6623
6969
  Dialog,
@@ -6747,7 +7093,14 @@ function Table({
6747
7093
  StatementIcon,
6748
7094
  Switch,
6749
7095
  Table,
7096
+ TableBody,
7097
+ TableCaption,
7098
+ TableCell,
7099
+ TableFooter,
7100
+ TableHead,
7101
+ TableHeader,
6750
7102
  TableIcon,
7103
+ TableRow,
6751
7104
  Tabs,
6752
7105
  TabsContent,
6753
7106
  TabsList,