luxtable 0.3.3 → 0.3.5

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
@@ -90,17 +90,17 @@ __export(index_exports, {
90
90
  createColumnsFromData: () => createColumnsFromData,
91
91
  createCopyableCell: () => createCopyableCell,
92
92
  defaultStatusColors: () => defaultStatusColors,
93
- flexRender: () => import_react_table3.flexRender,
94
- getCoreRowModel: () => import_react_table3.getCoreRowModel,
95
- getFilteredRowModel: () => import_react_table3.getFilteredRowModel,
96
- getPaginationRowModel: () => import_react_table3.getPaginationRowModel,
97
- getSortedRowModel: () => import_react_table3.getSortedRowModel
93
+ flexRender: () => import_react_table4.flexRender,
94
+ getCoreRowModel: () => import_react_table4.getCoreRowModel,
95
+ getFilteredRowModel: () => import_react_table4.getFilteredRowModel,
96
+ getPaginationRowModel: () => import_react_table4.getPaginationRowModel,
97
+ getSortedRowModel: () => import_react_table4.getSortedRowModel
98
98
  });
99
99
  module.exports = __toCommonJS(index_exports);
100
100
 
101
101
  // src/components/lux-table/lux-table.tsx
102
102
  var React7 = __toESM(require("react"));
103
- var import_react_table = require("@tanstack/react-table");
103
+ var import_react_table2 = require("@tanstack/react-table");
104
104
  var import_lucide_react7 = require("lucide-react");
105
105
 
106
106
  // src/lib/utils.ts
@@ -918,15 +918,51 @@ function TableToolbar({
918
918
  );
919
919
  }
920
920
 
921
+ // src/components/lux-table/sortable-header.tsx
922
+ var import_react_table = require("@tanstack/react-table");
923
+ var import_jsx_runtime10 = require("react/jsx-runtime");
924
+ function SortableHeader({
925
+ header,
926
+ showSortIndex = false
927
+ }) {
928
+ const column = header.column;
929
+ const canSort = column.getCanSort();
930
+ const isSorted = column.getIsSorted();
931
+ const sortIndex = column.getSortIndex();
932
+ const headerContent = header.isPlaceholder ? null : (0, import_react_table.flexRender)(column.columnDef.header, header.getContext());
933
+ if (!canSort) {
934
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: headerContent });
935
+ }
936
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
937
+ "button",
938
+ {
939
+ type: "button",
940
+ className: cn(
941
+ "flex items-center gap-1.5 w-full text-left font-medium group",
942
+ "hover:text-slate-900 dark:hover:text-slate-100",
943
+ "transition-colors duration-150",
944
+ "-ml-2 px-2 py-1 rounded-md",
945
+ "hover:bg-slate-100 dark:hover:bg-slate-800",
946
+ isSorted && "text-blue-600 dark:text-blue-400"
947
+ ),
948
+ onClick: header.column.getToggleSortingHandler(),
949
+ children: [
950
+ headerContent,
951
+ showSortIndex && isSorted && sortIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "ml-0.5 text-[10px] font-bold text-blue-500 dark:text-blue-400 bg-blue-100 dark:bg-blue-900/50 rounded-full w-4 h-4 flex items-center justify-center", children: sortIndex + 1 })
952
+ ]
953
+ }
954
+ );
955
+ }
956
+
921
957
  // src/components/ui/checkbox.tsx
922
958
  var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"));
923
959
  var import_lucide_react6 = require("lucide-react");
924
- var import_jsx_runtime10 = require("react/jsx-runtime");
960
+ var import_jsx_runtime11 = require("react/jsx-runtime");
925
961
  function Checkbox({
926
962
  className,
927
963
  ...props
928
964
  }) {
929
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
965
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
930
966
  CheckboxPrimitive.Root,
931
967
  {
932
968
  "data-slot": "checkbox",
@@ -935,12 +971,12 @@ function Checkbox({
935
971
  className
936
972
  ),
937
973
  ...props,
938
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
974
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
939
975
  CheckboxPrimitive.Indicator,
940
976
  {
941
977
  "data-slot": "checkbox-indicator",
942
978
  className: "grid place-content-center text-current transition-none",
943
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.CheckIcon, { className: "size-3.5" })
979
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react6.CheckIcon, { className: "size-3.5" })
944
980
  }
945
981
  )
946
982
  }
@@ -948,11 +984,11 @@ function Checkbox({
948
984
  }
949
985
 
950
986
  // src/components/lux-table/lux-table.tsx
951
- var import_jsx_runtime11 = require("react/jsx-runtime");
987
+ var import_jsx_runtime12 = require("react/jsx-runtime");
952
988
  function createSelectionColumn() {
953
989
  return {
954
990
  id: "__selection__",
955
- header: ({ table }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
991
+ header: ({ table }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
956
992
  Checkbox,
957
993
  {
958
994
  checked: table.getIsAllPageRowsSelected() || table.getIsSomePageRowsSelected() && "indeterminate",
@@ -960,7 +996,7 @@ function createSelectionColumn() {
960
996
  "aria-label": "Select all rows"
961
997
  }
962
998
  ),
963
- cell: ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
999
+ cell: ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
964
1000
  Checkbox,
965
1001
  {
966
1002
  checked: row.getIsSelected(),
@@ -1016,9 +1052,17 @@ function LuxTable({
1016
1052
  },
1017
1053
  [isControlledRowSelection, onRowSelectionChange, rowSelection]
1018
1054
  );
1019
- const table = (0, import_react_table.useReactTable)({
1055
+ const enableSorting = options?.sorting !== false;
1056
+ const enableMultiSort = options?.multiSort !== false;
1057
+ const table = (0, import_react_table2.useReactTable)({
1020
1058
  data,
1021
1059
  columns: tableColumns,
1060
+ enableSorting,
1061
+ enableMultiSort,
1062
+ // Shift+Click for multi-sort (default behavior)
1063
+ isMultiSortEvent: (e) => e.shiftKey,
1064
+ // Max columns for multi-sort (undefined = unlimited)
1065
+ maxMultiSortColCount: options?.maxMultiSortColCount,
1022
1066
  state: {
1023
1067
  sorting,
1024
1068
  columnFilters,
@@ -1044,11 +1088,11 @@ function LuxTable({
1044
1088
  }
1045
1089
  return String(index);
1046
1090
  }),
1047
- getCoreRowModel: (0, import_react_table.getCoreRowModel)(),
1048
- getPaginationRowModel: options?.pagination ? (0, import_react_table.getPaginationRowModel)() : void 0,
1049
- getSortedRowModel: (0, import_react_table.getSortedRowModel)(),
1050
- getFilteredRowModel: (0, import_react_table.getFilteredRowModel)(),
1051
- getFacetedUniqueValues: (0, import_react_table.getFacetedUniqueValues)(),
1091
+ getCoreRowModel: (0, import_react_table2.getCoreRowModel)(),
1092
+ getPaginationRowModel: options?.pagination ? (0, import_react_table2.getPaginationRowModel)() : void 0,
1093
+ getSortedRowModel: (0, import_react_table2.getSortedRowModel)(),
1094
+ getFilteredRowModel: (0, import_react_table2.getFilteredRowModel)(),
1095
+ getFacetedUniqueValues: (0, import_react_table2.getFacetedUniqueValues)(),
1052
1096
  initialState: {
1053
1097
  pagination: {
1054
1098
  pageSize: options?.pageSize ?? 10
@@ -1065,8 +1109,8 @@ function LuxTable({
1065
1109
  const showToolbar = options?.showToolbar ?? false;
1066
1110
  const showGlobalSearch = options?.showGlobalSearch ?? true;
1067
1111
  const showColumnVisibility = options?.showColumnVisibility ?? true;
1068
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: cn("w-full space-y-4", className), children: [
1069
- showToolbar && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1112
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("w-full space-y-4", className), children: [
1113
+ showToolbar && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1070
1114
  TableToolbar,
1071
1115
  {
1072
1116
  table,
@@ -1077,18 +1121,18 @@ function LuxTable({
1077
1121
  showColumnVisibility
1078
1122
  }
1079
1123
  ),
1080
- enableRowSelection && Object.keys(rowSelection).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2 px-4 py-2 text-sm bg-blue-50 dark:bg-blue-950/50 text-blue-700 dark:text-blue-300 rounded-lg border border-blue-200 dark:border-blue-800", children: [
1081
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react7.CheckCircle2, { className: "w-4 h-4" }),
1082
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
1083
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { children: Object.keys(rowSelection).length }),
1124
+ enableRowSelection && Object.keys(rowSelection).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-2 px-4 py-2 text-sm bg-blue-50 dark:bg-blue-950/50 text-blue-700 dark:text-blue-300 rounded-lg border border-blue-200 dark:border-blue-800", children: [
1125
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react7.CheckCircle2, { className: "w-4 h-4" }),
1126
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { children: [
1127
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: Object.keys(rowSelection).length }),
1084
1128
  " rows selected",
1085
- table.getFilteredRowModel().rows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "text-blue-500 dark:text-blue-400", children: [
1129
+ table.getFilteredRowModel().rows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "text-blue-500 dark:text-blue-400", children: [
1086
1130
  " / ",
1087
1131
  table.getFilteredRowModel().rows.length,
1088
1132
  " total"
1089
1133
  ] })
1090
1134
  ] }),
1091
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1135
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1092
1136
  "button",
1093
1137
  {
1094
1138
  type: "button",
@@ -1098,28 +1142,34 @@ function LuxTable({
1098
1142
  }
1099
1143
  )
1100
1144
  ] }),
1101
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "rounded-md border border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-950 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Table, { children: [
1102
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(TableHeader, { children: [
1103
- table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TableRow, { children: headerGroup.headers.map((header) => {
1145
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "rounded-md border border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-950 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Table, { children: [
1146
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(TableHeader, { children: [
1147
+ table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableRow, { children: headerGroup.headers.map((header) => {
1104
1148
  const isSelectionColumn = header.id === "__selection__";
1105
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1149
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1106
1150
  TableHead,
1107
1151
  {
1108
1152
  style: isSelectionColumn ? { width: 40, padding: "0 12px" } : void 0,
1109
- children: header.isPlaceholder ? null : (0, import_react_table.flexRender)(
1153
+ children: header.isPlaceholder ? null : isSelectionColumn ? (0, import_react_table2.flexRender)(
1110
1154
  header.column.columnDef.header,
1111
1155
  header.getContext()
1156
+ ) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1157
+ SortableHeader,
1158
+ {
1159
+ header,
1160
+ showSortIndex: enableMultiSort && sorting.length > 1
1161
+ }
1112
1162
  )
1113
1163
  },
1114
1164
  header.id
1115
1165
  );
1116
1166
  }) }, headerGroup.id)),
1117
- filteringVisible && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TableRow, { className: "bg-slate-50/50 dark:bg-slate-900/50", children: table.getHeaderGroups()[0]?.headers.map((header) => {
1167
+ filteringVisible && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableRow, { className: "bg-slate-50/50 dark:bg-slate-900/50", children: table.getHeaderGroups()[0]?.headers.map((header) => {
1118
1168
  const isSelectionColumn = header.id === "__selection__";
1119
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TableHead, { className: "py-2", children: !isSelectionColumn && header.column.getCanFilter() ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ColumnFilter, { column: header.column }) : null }, `filter-${header.id}`);
1169
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableHead, { className: "py-2", children: !isSelectionColumn && header.column.getCanFilter() ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ColumnFilter, { column: header.column }) : null }, `filter-${header.id}`);
1120
1170
  }) })
1121
1171
  ] }),
1122
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1172
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1123
1173
  TableRow,
1124
1174
  {
1125
1175
  "data-state": row.getIsSelected() && "selected",
@@ -1136,82 +1186,96 @@ function LuxTable({
1136
1186
  } : void 0,
1137
1187
  children: row.getVisibleCells().map((cell) => {
1138
1188
  const isSelectionColumn = cell.column.id === "__selection__";
1139
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1189
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1140
1190
  TableCell,
1141
1191
  {
1142
1192
  style: isSelectionColumn ? { width: 40, padding: "0 12px" } : void 0,
1143
1193
  onClick: isSelectionColumn ? (e) => e.stopPropagation() : void 0,
1144
- children: (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext())
1194
+ children: (0, import_react_table2.flexRender)(cell.column.columnDef.cell, cell.getContext())
1145
1195
  },
1146
1196
  cell.id
1147
1197
  );
1148
1198
  })
1149
1199
  },
1150
1200
  row.id
1151
- )) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TableCell, { colSpan: visibleColumnCount, className: "h-24 text-center", children: "No results." }) }) })
1201
+ )) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableCell, { colSpan: visibleColumnCount, className: "h-24 text-center", children: "No results." }) }) })
1152
1202
  ] }) }),
1153
- options?.pagination && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TablePagination, { table })
1203
+ options?.pagination && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TablePagination, { table })
1154
1204
  ] });
1155
1205
  }
1156
1206
 
1157
1207
  // src/components/lux-table/column-header.tsx
1158
1208
  var import_lucide_react8 = require("lucide-react");
1159
- var import_jsx_runtime12 = require("react/jsx-runtime");
1209
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1160
1210
  function LuxDataTableColumnHeader({
1161
1211
  column,
1162
1212
  title,
1163
1213
  className
1164
1214
  }) {
1165
1215
  const isSorted = column.getIsSorted();
1166
- if (!column.getCanSort()) {
1167
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn("flex items-center justify-between", className), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-sm font-medium text-muted-foreground", children: title }) });
1216
+ const canSort = column.getCanSort();
1217
+ const SortIndicator = () => {
1218
+ if (isSorted === "desc") {
1219
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react8.ArrowDown, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
1220
+ }
1221
+ if (isSorted === "asc") {
1222
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react8.ArrowUp, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
1223
+ }
1224
+ if (canSort) {
1225
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react8.ArrowUpDown, { className: "h-4 w-4 text-slate-400 dark:text-slate-500" });
1226
+ }
1227
+ return null;
1228
+ };
1229
+ if (!canSort) {
1230
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: cn("text-sm font-medium", className), children: title });
1168
1231
  }
1169
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("flex items-center justify-between gap-1", className), children: [
1170
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1171
- Button,
1172
- {
1173
- variant: "ghost",
1174
- size: "sm",
1175
- className: "-ml-3 h-8 hover:bg-accent",
1176
- onClick: () => column.toggleSorting(isSorted === "asc"),
1177
- children: [
1178
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: title }),
1179
- isSorted === "desc" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react8.ArrowDown, { className: "ml-1.5 h-4 w-4 text-primary" }) : isSorted === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react8.ArrowUp, { className: "ml-1.5 h-4 w-4 text-primary" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react8.ChevronsUpDown, { className: "ml-1.5 h-4 w-4 text-muted-foreground/50" })
1180
- ]
1181
- }
1182
- ),
1183
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(DropdownMenu, { children: [
1184
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1232
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: cn("flex items-center gap-2", className), children: [
1233
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SortIndicator, {}),
1234
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-sm font-medium", children: title }),
1235
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DropdownMenu, { children: [
1236
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1185
1237
  Button,
1186
1238
  {
1187
1239
  variant: "ghost",
1188
1240
  size: "icon",
1189
- className: "h-6 w-6 opacity-0 group-hover:opacity-100 hover:opacity-100 focus:opacity-100 data-[state=open]:opacity-100 transition-opacity",
1241
+ className: "h-6 w-6 ml-auto opacity-0 group-hover:opacity-100 hover:opacity-100 focus:opacity-100 data-[state=open]:opacity-100 transition-opacity",
1190
1242
  children: [
1191
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react8.MoreVertical, { className: "h-3.5 w-3.5" }),
1192
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "sr-only", children: "Column actions" })
1243
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react8.MoreVertical, { className: "h-3.5 w-3.5" }),
1244
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "sr-only", children: "Column actions" })
1193
1245
  ]
1194
1246
  }
1195
1247
  ) }),
1196
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(DropdownMenuContent, { align: "end", children: [
1197
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(DropdownMenuItem, { onClick: () => column.toggleSorting(false), children: [
1198
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react8.ArrowUp, { className: "mr-2 h-3.5 w-3.5 text-muted-foreground/70" }),
1248
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DropdownMenuContent, { align: "end", children: [
1249
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DropdownMenuItem, { onClick: (e) => {
1250
+ e.stopPropagation();
1251
+ column.toggleSorting(false);
1252
+ }, children: [
1253
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react8.ArrowUp, { className: "mr-2 h-3.5 w-3.5 text-muted-foreground/70" }),
1199
1254
  "Sort Ascending"
1200
1255
  ] }),
1201
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(DropdownMenuItem, { onClick: () => column.toggleSorting(true), children: [
1202
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react8.ArrowDown, { className: "mr-2 h-3.5 w-3.5 text-muted-foreground/70" }),
1256
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DropdownMenuItem, { onClick: (e) => {
1257
+ e.stopPropagation();
1258
+ column.toggleSorting(true);
1259
+ }, children: [
1260
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react8.ArrowDown, { className: "mr-2 h-3.5 w-3.5 text-muted-foreground/70" }),
1203
1261
  "Sort Descending"
1204
1262
  ] }),
1205
- isSorted && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
1206
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownMenuSeparator, {}),
1207
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(DropdownMenuItem, { onClick: () => column.clearSorting(), children: [
1208
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react8.X, { className: "mr-2 h-3.5 w-3.5 text-muted-foreground/70" }),
1263
+ isSorted && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
1264
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DropdownMenuSeparator, {}),
1265
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DropdownMenuItem, { onClick: (e) => {
1266
+ e.stopPropagation();
1267
+ column.clearSorting();
1268
+ }, children: [
1269
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react8.X, { className: "mr-2 h-3.5 w-3.5 text-muted-foreground/70" }),
1209
1270
  "Clear sorting"
1210
1271
  ] })
1211
1272
  ] }),
1212
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownMenuSeparator, {}),
1213
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(DropdownMenuItem, { onClick: () => column.toggleVisibility(false), children: [
1214
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react8.EyeOff, { className: "mr-2 h-3.5 w-3.5 text-muted-foreground/70" }),
1273
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DropdownMenuSeparator, {}),
1274
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DropdownMenuItem, { onClick: (e) => {
1275
+ e.stopPropagation();
1276
+ column.toggleVisibility(false);
1277
+ }, children: [
1278
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react8.EyeOff, { className: "mr-2 h-3.5 w-3.5 text-muted-foreground/70" }),
1215
1279
  "Hide column"
1216
1280
  ] })
1217
1281
  ] })
@@ -1220,7 +1284,7 @@ function LuxDataTableColumnHeader({
1220
1284
  }
1221
1285
 
1222
1286
  // src/components/cell-renderers/status-cell.tsx
1223
- var import_jsx_runtime13 = require("react/jsx-runtime");
1287
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1224
1288
  var defaultStatusColors = {
1225
1289
  Active: {
1226
1290
  bg: "bg-green-100",
@@ -1257,14 +1321,14 @@ function StatusCell({ value, colors, className }) {
1257
1321
  const mergedColors = { ...defaultStatusColors, ...colors };
1258
1322
  const colorConfig = mergedColors[value];
1259
1323
  if (!colorConfig) {
1260
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: `px-2 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300 ${className || ""}`, children: value });
1324
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: `px-2 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300 ${className || ""}`, children: value });
1261
1325
  }
1262
1326
  const { bg, text, darkBg, darkText } = colorConfig;
1263
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: `px-2 py-1 rounded-full text-xs font-medium ${bg} ${text} ${darkBg || ""} ${darkText || ""} ${className || ""}`, children: value });
1327
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: `px-2 py-1 rounded-full text-xs font-medium ${bg} ${text} ${darkBg || ""} ${darkText || ""} ${className || ""}`, children: value });
1264
1328
  }
1265
1329
 
1266
1330
  // src/components/cell-renderers/progress-cell.tsx
1267
- var import_jsx_runtime14 = require("react/jsx-runtime");
1331
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1268
1332
  function ProgressCell({
1269
1333
  value,
1270
1334
  barColor = "bg-blue-600",
@@ -1273,15 +1337,15 @@ function ProgressCell({
1273
1337
  className
1274
1338
  }) {
1275
1339
  const clampedValue = Math.min(100, Math.max(0, value));
1276
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: `flex items-center gap-2 ${className || ""}`, children: [
1277
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: `w-full rounded-full h-2.5 ${bgColor}`, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1340
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `flex items-center gap-2 ${className || ""}`, children: [
1341
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: `w-full rounded-full h-2.5 ${bgColor}`, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1278
1342
  "div",
1279
1343
  {
1280
1344
  className: `${barColor} h-2.5 rounded-full transition-all`,
1281
1345
  style: { width: `${clampedValue}%` }
1282
1346
  }
1283
1347
  ) }),
1284
- showLabel && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "text-xs text-gray-500 dark:text-gray-400 w-8", children: [
1348
+ showLabel && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "text-xs text-gray-500 dark:text-gray-400 w-8", children: [
1285
1349
  value,
1286
1350
  "%"
1287
1351
  ] })
@@ -1289,7 +1353,7 @@ function ProgressCell({
1289
1353
  }
1290
1354
 
1291
1355
  // src/components/cell-renderers/boolean-cell.tsx
1292
- var import_jsx_runtime15 = require("react/jsx-runtime");
1356
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1293
1357
  function BooleanCell({
1294
1358
  value,
1295
1359
  trueLabel = "Yes",
@@ -1297,15 +1361,15 @@ function BooleanCell({
1297
1361
  trueColor = "text-green-600 dark:text-green-400",
1298
1362
  falseColor = "text-red-600 dark:text-red-400"
1299
1363
  }) {
1300
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: `font-medium ${value ? trueColor : falseColor}`, children: value ? trueLabel : falseLabel });
1364
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: `font-medium ${value ? trueColor : falseColor}`, children: value ? trueLabel : falseLabel });
1301
1365
  }
1302
1366
 
1303
1367
  // src/components/cell-renderers/date-cell.tsx
1304
- var import_jsx_runtime16 = require("react/jsx-runtime");
1368
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1305
1369
  function DateCell({ value, format = "short", locale = "en-US" }) {
1306
1370
  const date = typeof value === "string" ? new Date(value) : value;
1307
1371
  if (isNaN(date.getTime())) {
1308
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-gray-400", children: "-" });
1372
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-gray-400", children: "-" });
1309
1373
  }
1310
1374
  let formatted;
1311
1375
  switch (format) {
@@ -1329,23 +1393,23 @@ function DateCell({ value, format = "short", locale = "en-US" }) {
1329
1393
  default:
1330
1394
  formatted = date.toLocaleDateString(locale);
1331
1395
  }
1332
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: formatted });
1396
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: formatted });
1333
1397
  }
1334
1398
 
1335
1399
  // src/components/cell-renderers/currency-cell.tsx
1336
- var import_jsx_runtime17 = require("react/jsx-runtime");
1400
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1337
1401
  function CurrencyCell({ value, currency = "TRY", locale = "tr-TR" }) {
1338
1402
  const formatted = new Intl.NumberFormat(locale, {
1339
1403
  style: "currency",
1340
1404
  currency
1341
1405
  }).format(value);
1342
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "font-medium", children: formatted });
1406
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-medium", children: formatted });
1343
1407
  }
1344
1408
 
1345
1409
  // src/components/cell-renderers/copyable-cell.tsx
1346
1410
  var React8 = __toESM(require("react"));
1347
1411
  var import_lucide_react9 = require("lucide-react");
1348
- var import_jsx_runtime18 = require("react/jsx-runtime");
1412
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1349
1413
  function CopyableCell({
1350
1414
  value,
1351
1415
  feedbackDuration = 2e3,
@@ -1370,7 +1434,7 @@ function CopyableCell({
1370
1434
  console.error("Copy error:", err);
1371
1435
  }
1372
1436
  };
1373
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1437
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
1374
1438
  "button",
1375
1439
  {
1376
1440
  type: "button",
@@ -1389,8 +1453,8 @@ function CopyableCell({
1389
1453
  ${className || ""}
1390
1454
  `,
1391
1455
  children: [
1392
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "select-none", children: value }),
1393
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1456
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "select-none", children: value }),
1457
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1394
1458
  "span",
1395
1459
  {
1396
1460
  className: `
@@ -1398,7 +1462,7 @@ function CopyableCell({
1398
1462
  transition-all duration-200
1399
1463
  ${alwaysShowIcon || isHovered || copied ? "opacity-100" : "opacity-0"}
1400
1464
  `,
1401
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react9.Check, { className: "h-3.5 w-3.5 text-green-600 dark:text-green-400" }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react9.Copy, { className: "h-3.5 w-3.5 text-slate-400 dark:text-slate-500 group-hover:text-slate-600 dark:group-hover:text-slate-300" })
1465
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.Check, { className: "h-3.5 w-3.5 text-green-600 dark:text-green-400" }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.Copy, { className: "h-3.5 w-3.5 text-slate-400 dark:text-slate-500 group-hover:text-slate-600 dark:group-hover:text-slate-300" })
1402
1466
  }
1403
1467
  )
1404
1468
  ]
@@ -1406,18 +1470,18 @@ function CopyableCell({
1406
1470
  );
1407
1471
  }
1408
1472
  function createCopyableCell(value, options) {
1409
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CopyableCell, { value, ...options });
1473
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CopyableCell, { value, ...options });
1410
1474
  }
1411
1475
 
1412
1476
  // src/components/ui/label.tsx
1413
1477
  var React9 = __toESM(require("react"));
1414
1478
  var LabelPrimitive = __toESM(require("@radix-ui/react-label"));
1415
1479
  var import_class_variance_authority2 = require("class-variance-authority");
1416
- var import_jsx_runtime19 = require("react/jsx-runtime");
1480
+ var import_jsx_runtime20 = require("react/jsx-runtime");
1417
1481
  var labelVariants = (0, import_class_variance_authority2.cva)(
1418
1482
  "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
1419
1483
  );
1420
- var Label3 = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1484
+ var Label3 = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1421
1485
  LabelPrimitive.Root,
1422
1486
  {
1423
1487
  ref,
@@ -1430,11 +1494,11 @@ Label3.displayName = LabelPrimitive.Root.displayName;
1430
1494
  // src/components/ui/popover.tsx
1431
1495
  var React10 = __toESM(require("react"));
1432
1496
  var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
1433
- var import_jsx_runtime20 = require("react/jsx-runtime");
1497
+ var import_jsx_runtime21 = require("react/jsx-runtime");
1434
1498
  var Popover = PopoverPrimitive.Root;
1435
1499
  var PopoverTrigger = PopoverPrimitive.Trigger;
1436
1500
  var PopoverAnchor = PopoverPrimitive.Anchor;
1437
- var PopoverContent = React10.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PopoverPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1501
+ var PopoverContent = React10.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PopoverPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1438
1502
  PopoverPrimitive.Content,
1439
1503
  {
1440
1504
  ref,
@@ -1452,9 +1516,9 @@ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
1452
1516
  // src/components/ui/separator.tsx
1453
1517
  var React11 = __toESM(require("react"));
1454
1518
  var SeparatorPrimitive = __toESM(require("@radix-ui/react-separator"));
1455
- var import_jsx_runtime21 = require("react/jsx-runtime");
1519
+ var import_jsx_runtime22 = require("react/jsx-runtime");
1456
1520
  var Separator3 = React11.forwardRef(
1457
- ({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1521
+ ({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1458
1522
  SeparatorPrimitive.Root,
1459
1523
  {
1460
1524
  ref,
@@ -1472,13 +1536,13 @@ var Separator3 = React11.forwardRef(
1472
1536
  Separator3.displayName = SeparatorPrimitive.Root.displayName;
1473
1537
 
1474
1538
  // src/lib/column-helper.tsx
1475
- var import_react_table2 = require("@tanstack/react-table");
1476
- var import_jsx_runtime22 = require("react/jsx-runtime");
1539
+ var import_react_table3 = require("@tanstack/react-table");
1540
+ var import_jsx_runtime23 = require("react/jsx-runtime");
1477
1541
  var toTitleCase = (str) => {
1478
1542
  return str.replace(/([A-Z])/g, " $1").replace(/^./, (s) => s.toUpperCase()).trim();
1479
1543
  };
1480
1544
  function createColumnHelper() {
1481
- const helper = (0, import_react_table2.createColumnHelper)();
1545
+ const helper = (0, import_react_table3.createColumnHelper)();
1482
1546
  return {
1483
1547
  /**
1484
1548
  * Simple accessor - if cell is not provided, value is rendered automatically
@@ -1492,7 +1556,7 @@ function createColumnHelper() {
1492
1556
  // Pass meta information (filterVariant etc.)
1493
1557
  meta: column?.meta,
1494
1558
  // Use LuxDataTableColumnHeader if header is string or undefined
1495
- header: typeof headerContent === "function" ? headerContent : ({ column: colParam }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1559
+ header: typeof headerContent === "function" ? headerContent : ({ column: colParam }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1496
1560
  LuxDataTableColumnHeader,
1497
1561
  {
1498
1562
  column: colParam,
@@ -1536,7 +1600,7 @@ function createColumnHelper() {
1536
1600
  auto: (columns) => {
1537
1601
  return columns.map((col) => {
1538
1602
  return helper.accessor(col.accessor, {
1539
- header: ({ column }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(LuxDataTableColumnHeader, { column, title: col.header }),
1603
+ header: ({ column }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LuxDataTableColumnHeader, { column, title: col.header }),
1540
1604
  cell: col.cell || ((info) => {
1541
1605
  const value = info.getValue();
1542
1606
  if (value === null || value === void 0) return "-";
@@ -1549,7 +1613,7 @@ function createColumnHelper() {
1549
1613
  }
1550
1614
  function createColumnsFromData(data, options) {
1551
1615
  if (!data || data.length === 0) return [];
1552
- const helper = (0, import_react_table2.createColumnHelper)();
1616
+ const helper = (0, import_react_table3.createColumnHelper)();
1553
1617
  const firstRow = data[0];
1554
1618
  let keys = Object.keys(firstRow);
1555
1619
  if (options?.include) {
@@ -1562,7 +1626,7 @@ function createColumnsFromData(data, options) {
1562
1626
  const headerText = options?.headers?.[key] || toTitleCase(key);
1563
1627
  const cellRenderer = options?.cells?.[key];
1564
1628
  return helper.accessor(key, {
1565
- header: ({ column }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(LuxDataTableColumnHeader, { column, title: headerText }),
1629
+ header: ({ column }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LuxDataTableColumnHeader, { column, title: headerText }),
1566
1630
  cell: cellRenderer || ((info) => {
1567
1631
  const value = info.getValue();
1568
1632
  if (value === null || value === void 0) return "-";
@@ -1573,7 +1637,7 @@ function createColumnsFromData(data, options) {
1573
1637
  }
1574
1638
 
1575
1639
  // src/index.ts
1576
- var import_react_table3 = require("@tanstack/react-table");
1640
+ var import_react_table4 = require("@tanstack/react-table");
1577
1641
  // Annotate the CommonJS export names for ESM import in node:
1578
1642
  0 && (module.exports = {
1579
1643
  BooleanCell,