gridular 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +43 -6
- package/dist/index.d.ts +43 -6
- package/dist/index.js +378 -244
- package/dist/index.mjs +353 -220
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -93,6 +93,7 @@ __export(index_exports, {
|
|
|
93
93
|
DropdownMenuSubContent: () => DropdownMenuSubContent,
|
|
94
94
|
DropdownMenuSubTrigger: () => DropdownMenuSubTrigger,
|
|
95
95
|
DropdownMenuTrigger: () => DropdownMenuTrigger,
|
|
96
|
+
ExpandableRow: () => ExpandableRow,
|
|
96
97
|
FilterMenu: () => FilterMenu,
|
|
97
98
|
Input: () => Input,
|
|
98
99
|
Pagination: () => Pagination,
|
|
@@ -135,7 +136,7 @@ __export(index_exports, {
|
|
|
135
136
|
module.exports = __toCommonJS(index_exports);
|
|
136
137
|
|
|
137
138
|
// components/data-grid/data-grid.tsx
|
|
138
|
-
var
|
|
139
|
+
var import_react15 = __toESM(require("react"));
|
|
139
140
|
|
|
140
141
|
// lib/utils.ts
|
|
141
142
|
var import_clsx = require("clsx");
|
|
@@ -166,57 +167,64 @@ var import_react = __toESM(require("react"));
|
|
|
166
167
|
var import_tss_react = require("tss-react");
|
|
167
168
|
var lightTheme = {
|
|
168
169
|
colors: {
|
|
169
|
-
primary: "#
|
|
170
|
-
//
|
|
171
|
-
secondary: "#
|
|
172
|
-
//
|
|
173
|
-
background: "#
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
170
|
+
primary: "#536976",
|
|
171
|
+
// Logo slate - sophisticated primary
|
|
172
|
+
secondary: "#BBD2C5",
|
|
173
|
+
// Logo sage - elegant accent
|
|
174
|
+
background: "#fafbfc",
|
|
175
|
+
// Slightly off-white
|
|
176
|
+
foreground: "#292E49",
|
|
177
|
+
// Logo navy - strong text
|
|
178
|
+
muted: "rgba(187, 210, 197, 0.08)",
|
|
179
|
+
// Subtle sage tint
|
|
180
|
+
mutedForeground: "#536976",
|
|
181
|
+
// Logo slate for muted text
|
|
182
|
+
border: "rgba(83, 105, 118, 0.2)",
|
|
183
|
+
// Transparent slate
|
|
184
|
+
popover: "#ffffff",
|
|
185
|
+
accent: "#BBD2C5"
|
|
186
|
+
// Logo sage
|
|
183
187
|
}
|
|
184
188
|
};
|
|
185
189
|
var darkTheme = {
|
|
186
190
|
colors: {
|
|
187
|
-
primary: "#
|
|
188
|
-
//
|
|
189
|
-
secondary: "#
|
|
190
|
-
//
|
|
191
|
-
background: "#
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
191
|
+
primary: "#BBD2C5",
|
|
192
|
+
// Logo sage - glowing primary in dark
|
|
193
|
+
secondary: "#536976",
|
|
194
|
+
// Logo slate
|
|
195
|
+
background: "#0a0b0d",
|
|
196
|
+
// Deep technical black
|
|
197
|
+
foreground: "#e8eaed",
|
|
198
|
+
// Technical pearl
|
|
199
|
+
muted: "rgba(41, 46, 73, 0.3)",
|
|
200
|
+
// Logo navy transparency
|
|
201
|
+
mutedForeground: "#a8abb2",
|
|
202
|
+
// Technical silver
|
|
203
|
+
border: "rgba(83, 105, 118, 0.25)",
|
|
204
|
+
// Transparent slate
|
|
205
|
+
popover: "rgba(26, 28, 32, 0.95)",
|
|
206
|
+
// Semi-transparent charcoal
|
|
207
|
+
accent: "#BBD2C5"
|
|
208
|
+
// Logo sage
|
|
201
209
|
}
|
|
202
210
|
};
|
|
203
211
|
var defaultTailwindTheme = {
|
|
204
|
-
container: "bg-background border border-border rounded-
|
|
205
|
-
header: "bg-muted/50 border-b border-border",
|
|
206
|
-
headerCell: "text-
|
|
207
|
-
row: "border-b border-border hover:bg-
|
|
208
|
-
cell: "px-4 py-
|
|
209
|
-
pagination: "bg-background border-t border-border
|
|
210
|
-
filterMenu: "bg-popover border border-border shadow-
|
|
211
|
-
filterMenuContent: "p-3",
|
|
212
|
-
filterMenuHeader: "font-
|
|
213
|
-
filterMenuInput: "",
|
|
214
|
-
filterMenuClearButton: "",
|
|
215
|
-
filterMenuApplyButton: "",
|
|
216
|
-
columnResizeHandle: "w-
|
|
217
|
-
columnResizeHandleActive: "bg-primary",
|
|
218
|
-
sortIcon: "text-muted-foreground",
|
|
219
|
-
sortIconActive: "text-
|
|
212
|
+
container: "bg-background border border-border/30 rounded-lg overflow-hidden shadow-sm",
|
|
213
|
+
header: "bg-muted/50 border-b border-border/40 backdrop-blur-sm",
|
|
214
|
+
headerCell: "text-foreground font-semibold px-4 py-3.5 text-sm font-sans tracking-tight border-r border-border/20 last:border-r-0 relative",
|
|
215
|
+
row: "border-b border-border/30 hover:bg-primary/5 transition-colors duration-200 group",
|
|
216
|
+
cell: "px-4 py-3 text-sm font-sans text-foreground/90",
|
|
217
|
+
pagination: "bg-background/50 border-t border-border/30 px-4 py-3 flex justify-between items-center font-sans text-sm",
|
|
218
|
+
filterMenu: "bg-popover border border-border/40 shadow-lg rounded-lg backdrop-blur-xl",
|
|
219
|
+
filterMenuContent: "p-4 space-y-3",
|
|
220
|
+
filterMenuHeader: "font-semibold mb-3 text-sm font-sans border-b border-border/30 pb-2",
|
|
221
|
+
filterMenuInput: "font-sans text-sm",
|
|
222
|
+
filterMenuClearButton: "font-sans text-sm font-medium",
|
|
223
|
+
filterMenuApplyButton: "font-sans text-sm font-semibold",
|
|
224
|
+
columnResizeHandle: "w-[3px] bg-border/40 hover:bg-primary cursor-col-resize h-full absolute right-0 top-0 transition-all duration-200 opacity-0 group-hover:opacity-100",
|
|
225
|
+
columnResizeHandleActive: "bg-primary opacity-100 w-[3px]",
|
|
226
|
+
sortIcon: "text-muted-foreground transition-all duration-200",
|
|
227
|
+
sortIconActive: "text-primary"
|
|
220
228
|
};
|
|
221
229
|
var createSpacingFunction = (baseSpacing = 4) => {
|
|
222
230
|
const spacingFn = (...args) => {
|
|
@@ -435,11 +443,11 @@ var FilterMenu = ({
|
|
|
435
443
|
if (!isOpen) {
|
|
436
444
|
return /* @__PURE__ */ import_react2.default.createElement("div", { className: "relative" }, /* @__PURE__ */ import_react2.default.createElement("div", { onClick: () => onOpenChange(true) }, trigger), isActive && /* @__PURE__ */ import_react2.default.createElement("div", { className: "absolute -top-1 -right-1 w-3 h-3 bg-primary rounded-full text-[10px] flex items-center justify-center text-primary-foreground" }, "\u2022"));
|
|
437
445
|
}
|
|
438
|
-
const menuContent = /* @__PURE__ */ import_react2.default.createElement("div", { className: cn("p-
|
|
446
|
+
const menuContent = /* @__PURE__ */ import_react2.default.createElement("div", { className: cn("p-4", theme.classes.filterMenuContent) }, /* @__PURE__ */ import_react2.default.createElement(
|
|
439
447
|
"div",
|
|
440
448
|
{
|
|
441
449
|
className: cn(
|
|
442
|
-
"font-
|
|
450
|
+
"font-semibold mb-3 text-sm text-gray-700 dark:text-gray-200",
|
|
443
451
|
theme.classes.filterMenuHeader,
|
|
444
452
|
classes.header
|
|
445
453
|
)
|
|
@@ -448,22 +456,22 @@ var FilterMenu = ({
|
|
|
448
456
|
"span",
|
|
449
457
|
{
|
|
450
458
|
className: cn(
|
|
451
|
-
"ml-2 text-xs px-
|
|
459
|
+
"ml-2 text-xs px-2 py-0.5 rounded-full bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-200",
|
|
452
460
|
classes.activeIndicator
|
|
453
461
|
)
|
|
454
462
|
},
|
|
455
463
|
"Active"
|
|
456
464
|
))
|
|
457
|
-
), isActive && filterValue && /* @__PURE__ */ import_react2.default.createElement("div", { className: "mb-
|
|
465
|
+
), isActive && filterValue && /* @__PURE__ */ import_react2.default.createElement("div", { className: "mb-3" }, renderCurrentFilter ? renderCurrentFilter(filterValue) : /* @__PURE__ */ import_react2.default.createElement(
|
|
458
466
|
"div",
|
|
459
467
|
{
|
|
460
468
|
className: cn(
|
|
461
|
-
"text-xs bg-
|
|
469
|
+
"text-xs bg-gray-50 dark:bg-gray-800 p-2 rounded border border-gray-200 dark:border-gray-700",
|
|
462
470
|
classes.currentFilter
|
|
463
471
|
)
|
|
464
472
|
},
|
|
465
|
-
"Current
|
|
466
|
-
/* @__PURE__ */ import_react2.default.createElement("strong",
|
|
473
|
+
"Current: ",
|
|
474
|
+
/* @__PURE__ */ import_react2.default.createElement("strong", { className: "font-semibold" }, filterValue)
|
|
467
475
|
)), renderInput ? renderInput({
|
|
468
476
|
value: localFilterValue,
|
|
469
477
|
onChange: setLocalFilterValue,
|
|
@@ -477,7 +485,10 @@ var FilterMenu = ({
|
|
|
477
485
|
onChange: (e) => setLocalFilterValue(e.target.value),
|
|
478
486
|
onKeyDown: handleKeyDown,
|
|
479
487
|
className: cn(
|
|
480
|
-
"w-full
|
|
488
|
+
"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md",
|
|
489
|
+
"focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",
|
|
490
|
+
"bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100",
|
|
491
|
+
"placeholder-gray-400 dark:placeholder-gray-500",
|
|
481
492
|
theme.classes.filterMenuInput,
|
|
482
493
|
classes.input
|
|
483
494
|
),
|
|
@@ -492,7 +503,7 @@ var FilterMenu = ({
|
|
|
492
503
|
"div",
|
|
493
504
|
{
|
|
494
505
|
className: cn(
|
|
495
|
-
"flex justify-
|
|
506
|
+
"flex justify-end mt-3 gap-2",
|
|
496
507
|
classes.buttonContainer
|
|
497
508
|
)
|
|
498
509
|
},
|
|
@@ -501,7 +512,10 @@ var FilterMenu = ({
|
|
|
501
512
|
{
|
|
502
513
|
onClick: handleClearFilter,
|
|
503
514
|
className: cn(
|
|
504
|
-
"px-
|
|
515
|
+
"px-4 py-2 text-sm font-medium rounded-md border border-gray-300 dark:border-gray-600",
|
|
516
|
+
"hover:bg-gray-50 dark:hover:bg-gray-800",
|
|
517
|
+
"text-gray-700 dark:text-gray-200",
|
|
518
|
+
"transition-colors",
|
|
505
519
|
theme.classes.filterMenuClearButton,
|
|
506
520
|
classes.clearButton
|
|
507
521
|
)
|
|
@@ -513,7 +527,9 @@ var FilterMenu = ({
|
|
|
513
527
|
{
|
|
514
528
|
onClick: handleApplyFilter,
|
|
515
529
|
className: cn(
|
|
516
|
-
"px-
|
|
530
|
+
"px-4 py-2 text-sm font-medium rounded-md",
|
|
531
|
+
"bg-blue-600 hover:bg-blue-700 text-white",
|
|
532
|
+
"transition-colors",
|
|
517
533
|
theme.classes.filterMenuApplyButton,
|
|
518
534
|
classes.applyButton
|
|
519
535
|
)
|
|
@@ -527,7 +543,11 @@ var FilterMenu = ({
|
|
|
527
543
|
{
|
|
528
544
|
ref: menuRef,
|
|
529
545
|
className: cn(
|
|
530
|
-
"absolute top-full left-0 z-50 mt-
|
|
546
|
+
"absolute top-full left-0 z-50 mt-2 min-w-[280px]",
|
|
547
|
+
"bg-white dark:bg-gray-900",
|
|
548
|
+
"border border-gray-200 dark:border-gray-700",
|
|
549
|
+
"rounded-lg shadow-xl",
|
|
550
|
+
"backdrop-blur-sm",
|
|
531
551
|
theme.classes.filterMenu,
|
|
532
552
|
classes.container,
|
|
533
553
|
column.index === totalColumns - 1 && "right-0 left-auto"
|
|
@@ -548,7 +568,11 @@ var FilterMenu = ({
|
|
|
548
568
|
{
|
|
549
569
|
ref: menuRef,
|
|
550
570
|
className: cn(
|
|
551
|
-
"absolute top-full left-0 z-50 mt-
|
|
571
|
+
"absolute top-full left-0 z-50 mt-2 min-w-[280px]",
|
|
572
|
+
"bg-white dark:bg-gray-900",
|
|
573
|
+
"border border-gray-200 dark:border-gray-700",
|
|
574
|
+
"rounded-lg shadow-xl",
|
|
575
|
+
"backdrop-blur-sm",
|
|
552
576
|
theme.classes.filterMenu,
|
|
553
577
|
classes.container,
|
|
554
578
|
column.index === totalColumns - 1 && "right-0 left-auto"
|
|
@@ -636,17 +660,17 @@ function TableHeader({
|
|
|
636
660
|
if (!sortDirection) return null;
|
|
637
661
|
if (sortIconVariant === "none") return null;
|
|
638
662
|
if (sortIconVariant === "chevrons") {
|
|
639
|
-
return sortDirection === "asc" ? /* @__PURE__ */ import_react3.default.createElement(import_lucide_react.ChevronUp, { className: "ml-
|
|
663
|
+
return sortDirection === "asc" ? /* @__PURE__ */ import_react3.default.createElement(import_lucide_react.ChevronUp, { className: "ml-1 h-3 w-3 text-primary" }) : /* @__PURE__ */ import_react3.default.createElement(import_lucide_react.ChevronDown, { className: "ml-1 h-3 w-3 text-primary" });
|
|
640
664
|
}
|
|
641
|
-
return sortDirection === "asc" ? /* @__PURE__ */ import_react3.default.createElement(import_lucide_react.ArrowUp, { className: "ml-
|
|
665
|
+
return sortDirection === "asc" ? /* @__PURE__ */ import_react3.default.createElement(import_lucide_react.ArrowUp, { className: "ml-1 h-3 w-3 text-primary" }) : /* @__PURE__ */ import_react3.default.createElement(import_lucide_react.ArrowDown, { className: "ml-1 h-3 w-3 text-primary" });
|
|
642
666
|
};
|
|
643
667
|
const defaultFilterIcon = (column, isActive) => {
|
|
644
668
|
return /* @__PURE__ */ import_react3.default.createElement(
|
|
645
669
|
import_lucide_react.Filter,
|
|
646
670
|
{
|
|
647
671
|
className: cn(
|
|
648
|
-
"h-
|
|
649
|
-
isActive ?
|
|
672
|
+
"h-3.5 w-3.5 transition-colors",
|
|
673
|
+
isActive ? "text-blue-500 fill-blue-100" : "text-gray-400 hover:text-gray-600"
|
|
650
674
|
)
|
|
651
675
|
}
|
|
652
676
|
);
|
|
@@ -727,7 +751,7 @@ function TableHeader({
|
|
|
727
751
|
filterMenuOpen === column.id ? null : column.id
|
|
728
752
|
);
|
|
729
753
|
},
|
|
730
|
-
className: "focus:outline-none"
|
|
754
|
+
className: "p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1"
|
|
731
755
|
},
|
|
732
756
|
renderFilterIcon ? renderFilterIcon(column, hasActiveFilter) : defaultFilterIcon(column, hasActiveFilter)
|
|
733
757
|
)
|
|
@@ -746,7 +770,7 @@ function TableHeader({
|
|
|
746
770
|
}
|
|
747
771
|
|
|
748
772
|
// components/data-grid/table-body.tsx
|
|
749
|
-
var
|
|
773
|
+
var import_react8 = __toESM(require("react"));
|
|
750
774
|
|
|
751
775
|
// components/data-grid/group-row.tsx
|
|
752
776
|
var import_react4 = __toESM(require("react"));
|
|
@@ -1071,10 +1095,27 @@ var TableCell = ({
|
|
|
1071
1095
|
onSelect,
|
|
1072
1096
|
contextMenuContent,
|
|
1073
1097
|
selectedCellClassName = "ring-2 ring-primary ring-inset",
|
|
1074
|
-
preventRowSelection = true
|
|
1098
|
+
preventRowSelection = true,
|
|
1099
|
+
enableExpandableRows = false,
|
|
1100
|
+
isExpanded = false,
|
|
1101
|
+
onToggleExpand,
|
|
1102
|
+
expandIcon,
|
|
1103
|
+
collapseIcon
|
|
1075
1104
|
}) => {
|
|
1076
1105
|
const themeClasses = useTailwindTheme();
|
|
1077
|
-
const
|
|
1106
|
+
const cellContent = column.renderCell ? column.renderCell(row) : column.cell ? column.cell(row) : row[column.id];
|
|
1107
|
+
const content = /* @__PURE__ */ import_react5.default.createElement("div", { className: "relative z-0 flex items-center gap-2" }, enableExpandableRows && /* @__PURE__ */ import_react5.default.createElement(
|
|
1108
|
+
"button",
|
|
1109
|
+
{
|
|
1110
|
+
onClick: (e) => {
|
|
1111
|
+
e.stopPropagation();
|
|
1112
|
+
onToggleExpand == null ? void 0 : onToggleExpand();
|
|
1113
|
+
},
|
|
1114
|
+
className: "p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors",
|
|
1115
|
+
"aria-label": isExpanded ? "Collapse row" : "Expand row"
|
|
1116
|
+
},
|
|
1117
|
+
isExpanded ? expandIcon : collapseIcon
|
|
1118
|
+
), /* @__PURE__ */ import_react5.default.createElement("span", { className: "flex-1" }, cellContent));
|
|
1078
1119
|
const cell = contextMenuContent ? /* @__PURE__ */ import_react5.default.createElement(
|
|
1079
1120
|
ContextMenu,
|
|
1080
1121
|
{
|
|
@@ -1149,14 +1190,19 @@ function TableRow({
|
|
|
1149
1190
|
onCellSelect,
|
|
1150
1191
|
selectedCellClassName,
|
|
1151
1192
|
preventRowSelection,
|
|
1152
|
-
contextMenuContent
|
|
1193
|
+
contextMenuContent,
|
|
1194
|
+
enableExpandableRows = false,
|
|
1195
|
+
isExpanded = false,
|
|
1196
|
+
onToggleExpand,
|
|
1197
|
+
expandIcon,
|
|
1198
|
+
collapseIcon
|
|
1153
1199
|
}) {
|
|
1154
1200
|
return /* @__PURE__ */ import_react6.default.createElement(
|
|
1155
1201
|
"tr",
|
|
1156
1202
|
{
|
|
1157
1203
|
className: cn(
|
|
1158
|
-
"hover:bg-
|
|
1159
|
-
isSelected && selectedRowClassName,
|
|
1204
|
+
"border-b border-border/30 hover:bg-primary/5 transition-colors duration-200 group",
|
|
1205
|
+
isSelected && (selectedRowClassName || "bg-primary/10"),
|
|
1160
1206
|
rowClassName
|
|
1161
1207
|
),
|
|
1162
1208
|
onClick: () => {
|
|
@@ -1171,7 +1217,7 @@ function TableRow({
|
|
|
1171
1217
|
cursor: onRowSelect || onRowClick ? "pointer" : "default"
|
|
1172
1218
|
}
|
|
1173
1219
|
},
|
|
1174
|
-
columns.map((column) => {
|
|
1220
|
+
columns.map((column, index) => {
|
|
1175
1221
|
const isCellSelected = selectedCell && selectedCell.rowId === rowId && selectedCell.columnId === column.id;
|
|
1176
1222
|
return /* @__PURE__ */ import_react6.default.createElement(
|
|
1177
1223
|
TableCell,
|
|
@@ -1194,13 +1240,35 @@ function TableRow({
|
|
|
1194
1240
|
}
|
|
1195
1241
|
},
|
|
1196
1242
|
preventRowSelection,
|
|
1197
|
-
contextMenuContent
|
|
1243
|
+
contextMenuContent,
|
|
1244
|
+
enableExpandableRows: enableExpandableRows && index === 0,
|
|
1245
|
+
isExpanded,
|
|
1246
|
+
onToggleExpand,
|
|
1247
|
+
expandIcon,
|
|
1248
|
+
collapseIcon
|
|
1198
1249
|
}
|
|
1199
1250
|
);
|
|
1200
1251
|
})
|
|
1201
1252
|
);
|
|
1202
1253
|
}
|
|
1203
1254
|
|
|
1255
|
+
// components/data-grid/expandable-row.tsx
|
|
1256
|
+
var import_react7 = __toESM(require("react"));
|
|
1257
|
+
function ExpandableRow({
|
|
1258
|
+
row,
|
|
1259
|
+
rowId,
|
|
1260
|
+
columns,
|
|
1261
|
+
isExpanded,
|
|
1262
|
+
onToggleExpand,
|
|
1263
|
+
renderExpandedContent,
|
|
1264
|
+
expandIcon,
|
|
1265
|
+
collapseIcon,
|
|
1266
|
+
expandButtonClassName
|
|
1267
|
+
}) {
|
|
1268
|
+
if (!isExpanded) return null;
|
|
1269
|
+
return /* @__PURE__ */ import_react7.default.createElement("tr", { key: `${rowId}-expanded`, className: "border-b bg-gray-50 dark:bg-gray-900" }, /* @__PURE__ */ import_react7.default.createElement("td", { colSpan: columns.length, className: "p-0" }, /* @__PURE__ */ import_react7.default.createElement("div", { className: "px-4 py-3 bg-white dark:bg-gray-950 border-t" }, renderExpandedContent(row))));
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1204
1272
|
// components/data-grid/table-body.tsx
|
|
1205
1273
|
var TableBody = ({
|
|
1206
1274
|
paginatedData,
|
|
@@ -1218,18 +1286,25 @@ var TableBody = ({
|
|
|
1218
1286
|
groupingState,
|
|
1219
1287
|
toggleGroupExpanded,
|
|
1220
1288
|
renderGroupRow,
|
|
1221
|
-
groupExpandIcon = /* @__PURE__ */
|
|
1222
|
-
groupCollapseIcon = /* @__PURE__ */
|
|
1289
|
+
groupExpandIcon = /* @__PURE__ */ import_react8.default.createElement(import_lucide_react4.ChevronDown, { className: "h-4 w-4" }),
|
|
1290
|
+
groupCollapseIcon = /* @__PURE__ */ import_react8.default.createElement(import_lucide_react4.ChevronRight, { className: "h-4 w-4" }),
|
|
1223
1291
|
groupRowProps = {},
|
|
1224
1292
|
selectedCell = null,
|
|
1225
1293
|
onCellSelect,
|
|
1226
1294
|
selectedCellClassName = "ring-2 ring-primary ring-inset",
|
|
1227
1295
|
preventRowSelection,
|
|
1228
|
-
contextMenuContent
|
|
1296
|
+
contextMenuContent,
|
|
1297
|
+
enableExpandableRows = false,
|
|
1298
|
+
expandedRows = {},
|
|
1299
|
+
onToggleRowExpand,
|
|
1300
|
+
renderExpandedRow,
|
|
1301
|
+
expandIcon = /* @__PURE__ */ import_react8.default.createElement(import_lucide_react4.ChevronDown, { className: "h-4 w-4" }),
|
|
1302
|
+
collapseIcon = /* @__PURE__ */ import_react8.default.createElement(import_lucide_react4.ChevronRight, { className: "h-4 w-4" }),
|
|
1303
|
+
getRowId = (row, index) => row.id || `row-${index}`
|
|
1229
1304
|
}) => {
|
|
1230
|
-
return /* @__PURE__ */
|
|
1305
|
+
return /* @__PURE__ */ import_react8.default.createElement("tbody", { className: theme.classes.tbody }, paginatedData.map((row, rowIndex) => {
|
|
1231
1306
|
if (enableGrouping && row.isGroupRow) {
|
|
1232
|
-
return /* @__PURE__ */
|
|
1307
|
+
return /* @__PURE__ */ import_react8.default.createElement(
|
|
1233
1308
|
GroupRow,
|
|
1234
1309
|
__spreadValues({
|
|
1235
1310
|
key: row.groupKey,
|
|
@@ -1247,12 +1322,12 @@ var TableBody = ({
|
|
|
1247
1322
|
}, groupRowProps)
|
|
1248
1323
|
);
|
|
1249
1324
|
}
|
|
1250
|
-
const rowId = row
|
|
1325
|
+
const rowId = getRowId(row, rowIndex);
|
|
1251
1326
|
const isSelected = selectedRows[rowId];
|
|
1252
|
-
|
|
1327
|
+
const isExpanded = expandedRows[rowId] || false;
|
|
1328
|
+
return /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, { key: rowId }, /* @__PURE__ */ import_react8.default.createElement(
|
|
1253
1329
|
TableRow,
|
|
1254
1330
|
{
|
|
1255
|
-
key: rowId,
|
|
1256
1331
|
row,
|
|
1257
1332
|
rowId,
|
|
1258
1333
|
columns,
|
|
@@ -1267,14 +1342,31 @@ var TableBody = ({
|
|
|
1267
1342
|
onCellSelect,
|
|
1268
1343
|
selectedCellClassName,
|
|
1269
1344
|
preventRowSelection,
|
|
1270
|
-
contextMenuContent
|
|
1345
|
+
contextMenuContent,
|
|
1346
|
+
enableExpandableRows,
|
|
1347
|
+
isExpanded,
|
|
1348
|
+
onToggleExpand: enableExpandableRows && onToggleRowExpand ? () => onToggleRowExpand(rowId) : void 0,
|
|
1349
|
+
expandIcon,
|
|
1350
|
+
collapseIcon
|
|
1271
1351
|
}
|
|
1272
|
-
)
|
|
1352
|
+
), enableExpandableRows && isExpanded && renderExpandedRow && /* @__PURE__ */ import_react8.default.createElement(
|
|
1353
|
+
ExpandableRow,
|
|
1354
|
+
{
|
|
1355
|
+
row,
|
|
1356
|
+
rowId,
|
|
1357
|
+
columns,
|
|
1358
|
+
isExpanded,
|
|
1359
|
+
onToggleExpand: () => onToggleRowExpand == null ? void 0 : onToggleRowExpand(rowId),
|
|
1360
|
+
renderExpandedContent: renderExpandedRow,
|
|
1361
|
+
expandIcon,
|
|
1362
|
+
collapseIcon
|
|
1363
|
+
}
|
|
1364
|
+
));
|
|
1273
1365
|
}));
|
|
1274
1366
|
};
|
|
1275
1367
|
|
|
1276
1368
|
// components/data-grid/pagination.tsx
|
|
1277
|
-
var
|
|
1369
|
+
var import_react9 = __toESM(require("react"));
|
|
1278
1370
|
var Pagination = ({
|
|
1279
1371
|
pageIndex,
|
|
1280
1372
|
pageCount,
|
|
@@ -1312,92 +1404,113 @@ var Pagination = ({
|
|
|
1312
1404
|
const goToPrevPage = () => setPageIndex(Math.max(0, pageIndex - 1));
|
|
1313
1405
|
const goToNextPage = () => setPageIndex(Math.min(pageCount - 1, pageIndex + 1));
|
|
1314
1406
|
const goToLastPage = () => setPageIndex(pageCount - 1);
|
|
1315
|
-
return /* @__PURE__ */
|
|
1407
|
+
return /* @__PURE__ */ import_react9.default.createElement("div", { className: cn("px-4 py-3 flex items-center justify-between border-t border-gray-200 dark:border-gray-700", className) }, showPageSizeSelector && /* @__PURE__ */ import_react9.default.createElement("div", { className: cn("flex items-center gap-3", pageSizeClassName) }, renderPageSizeSelector ? renderPageSizeSelector({
|
|
1316
1408
|
pageSize,
|
|
1317
1409
|
options: pageSizeOptions,
|
|
1318
1410
|
onChange: handlePageSizeChange
|
|
1319
|
-
}) : /* @__PURE__ */
|
|
1411
|
+
}) : /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, null, /* @__PURE__ */ import_react9.default.createElement("span", { className: "text-sm text-gray-600 dark:text-gray-400 font-medium" }, "Rows per page:"), /* @__PURE__ */ import_react9.default.createElement(
|
|
1320
1412
|
"select",
|
|
1321
1413
|
{
|
|
1322
1414
|
value: pageSize,
|
|
1323
1415
|
onChange: (e) => handlePageSizeChange(Number(e.target.value)),
|
|
1324
|
-
className: "border
|
|
1416
|
+
className: "border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 px-3 py-1.5 text-sm rounded-md hover:border-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-colors cursor-pointer"
|
|
1325
1417
|
},
|
|
1326
|
-
pageSizeOptions.map((option) => /* @__PURE__ */
|
|
1327
|
-
))), /* @__PURE__ */
|
|
1418
|
+
pageSizeOptions.map((option) => /* @__PURE__ */ import_react9.default.createElement("option", { key: option, value: option }, option))
|
|
1419
|
+
))), /* @__PURE__ */ import_react9.default.createElement(
|
|
1328
1420
|
"div",
|
|
1329
1421
|
{
|
|
1330
|
-
className: cn("flex items-center
|
|
1422
|
+
className: cn("flex items-center gap-4", buttonsClassName)
|
|
1331
1423
|
},
|
|
1332
|
-
showPageInfo && /* @__PURE__ */
|
|
1333
|
-
showFirstLastButtons && (renderFirstPageButton ? renderFirstPageButton({
|
|
1424
|
+
showPageInfo && /* @__PURE__ */ import_react9.default.createElement("div", { className: cn("text-sm text-gray-600 dark:text-gray-400", pageInfoClassName) }, renderPageInfo ? renderPageInfo({ start, end, total: totalRows }) : /* @__PURE__ */ import_react9.default.createElement("span", null, start, "\u2013", end, " of ", totalRows)),
|
|
1425
|
+
/* @__PURE__ */ import_react9.default.createElement("div", { className: "flex items-center gap-1" }, showFirstLastButtons && (renderFirstPageButton ? renderFirstPageButton({
|
|
1334
1426
|
onClick: goToFirstPage,
|
|
1335
1427
|
disabled: isFirstPage
|
|
1336
|
-
}) : /* @__PURE__ */
|
|
1428
|
+
}) : /* @__PURE__ */ import_react9.default.createElement(
|
|
1337
1429
|
"button",
|
|
1338
1430
|
{
|
|
1339
1431
|
onClick: goToFirstPage,
|
|
1340
1432
|
disabled: isFirstPage,
|
|
1341
1433
|
className: cn(
|
|
1342
|
-
"
|
|
1434
|
+
"h-8 w-8 rounded-md border border-gray-300 dark:border-gray-600",
|
|
1435
|
+
"bg-white dark:bg-gray-800",
|
|
1436
|
+
"hover:bg-gray-50 dark:hover:bg-gray-700",
|
|
1437
|
+
"text-gray-700 dark:text-gray-300",
|
|
1438
|
+
"disabled:opacity-40 disabled:cursor-not-allowed",
|
|
1439
|
+
"transition-colors",
|
|
1440
|
+
"flex items-center justify-center text-sm",
|
|
1343
1441
|
buttonClassName
|
|
1344
1442
|
)
|
|
1345
1443
|
},
|
|
1346
1444
|
"<<"
|
|
1347
|
-
)),
|
|
1348
|
-
renderPrevPageButton ? renderPrevPageButton({
|
|
1445
|
+
)), renderPrevPageButton ? renderPrevPageButton({
|
|
1349
1446
|
onClick: goToPrevPage,
|
|
1350
1447
|
disabled: isFirstPage
|
|
1351
|
-
}) : /* @__PURE__ */
|
|
1448
|
+
}) : /* @__PURE__ */ import_react9.default.createElement(
|
|
1352
1449
|
"button",
|
|
1353
1450
|
{
|
|
1354
1451
|
onClick: goToPrevPage,
|
|
1355
1452
|
disabled: isFirstPage,
|
|
1356
1453
|
className: cn(
|
|
1357
|
-
"
|
|
1454
|
+
"h-8 w-8 rounded-md border border-gray-300 dark:border-gray-600",
|
|
1455
|
+
"bg-white dark:bg-gray-800",
|
|
1456
|
+
"hover:bg-gray-50 dark:hover:bg-gray-700",
|
|
1457
|
+
"text-gray-700 dark:text-gray-300",
|
|
1458
|
+
"disabled:opacity-40 disabled:cursor-not-allowed",
|
|
1459
|
+
"transition-colors",
|
|
1460
|
+
"flex items-center justify-center text-sm",
|
|
1358
1461
|
buttonClassName
|
|
1359
1462
|
)
|
|
1360
1463
|
},
|
|
1361
1464
|
"<"
|
|
1362
|
-
),
|
|
1363
|
-
renderNextPageButton ? renderNextPageButton({
|
|
1465
|
+
), renderNextPageButton ? renderNextPageButton({
|
|
1364
1466
|
onClick: goToNextPage,
|
|
1365
1467
|
disabled: isLastPage
|
|
1366
|
-
}) : /* @__PURE__ */
|
|
1468
|
+
}) : /* @__PURE__ */ import_react9.default.createElement(
|
|
1367
1469
|
"button",
|
|
1368
1470
|
{
|
|
1369
1471
|
onClick: goToNextPage,
|
|
1370
1472
|
disabled: isLastPage,
|
|
1371
1473
|
className: cn(
|
|
1372
|
-
"
|
|
1474
|
+
"h-8 w-8 rounded-md border border-gray-300 dark:border-gray-600",
|
|
1475
|
+
"bg-white dark:bg-gray-800",
|
|
1476
|
+
"hover:bg-gray-50 dark:hover:bg-gray-700",
|
|
1477
|
+
"text-gray-700 dark:text-gray-300",
|
|
1478
|
+
"disabled:opacity-40 disabled:cursor-not-allowed",
|
|
1479
|
+
"transition-colors",
|
|
1480
|
+
"flex items-center justify-center text-sm",
|
|
1373
1481
|
buttonClassName
|
|
1374
1482
|
)
|
|
1375
1483
|
},
|
|
1376
1484
|
">"
|
|
1377
|
-
),
|
|
1378
|
-
showFirstLastButtons && (renderLastPageButton ? renderLastPageButton({
|
|
1485
|
+
), showFirstLastButtons && (renderLastPageButton ? renderLastPageButton({
|
|
1379
1486
|
onClick: goToLastPage,
|
|
1380
1487
|
disabled: isLastPage
|
|
1381
|
-
}) : /* @__PURE__ */
|
|
1488
|
+
}) : /* @__PURE__ */ import_react9.default.createElement(
|
|
1382
1489
|
"button",
|
|
1383
1490
|
{
|
|
1384
1491
|
onClick: goToLastPage,
|
|
1385
1492
|
disabled: isLastPage,
|
|
1386
1493
|
className: cn(
|
|
1387
|
-
"
|
|
1494
|
+
"h-8 w-8 rounded-md border border-gray-300 dark:border-gray-600",
|
|
1495
|
+
"bg-white dark:bg-gray-800",
|
|
1496
|
+
"hover:bg-gray-50 dark:hover:bg-gray-700",
|
|
1497
|
+
"text-gray-700 dark:text-gray-300",
|
|
1498
|
+
"disabled:opacity-40 disabled:cursor-not-allowed",
|
|
1499
|
+
"transition-colors",
|
|
1500
|
+
"flex items-center justify-center text-sm",
|
|
1388
1501
|
buttonClassName
|
|
1389
1502
|
)
|
|
1390
1503
|
},
|
|
1391
1504
|
">>"
|
|
1392
|
-
))
|
|
1505
|
+
)))
|
|
1393
1506
|
));
|
|
1394
1507
|
};
|
|
1395
1508
|
|
|
1396
1509
|
// components/data-grid/column-manager.tsx
|
|
1397
|
-
var
|
|
1510
|
+
var import_react10 = __toESM(require("react"));
|
|
1398
1511
|
|
|
1399
1512
|
// components/ui/dropdown-menu.tsx
|
|
1400
|
-
var
|
|
1513
|
+
var React11 = __toESM(require("react"));
|
|
1401
1514
|
var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
1402
1515
|
var import_lucide_react5 = require("lucide-react");
|
|
1403
1516
|
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
@@ -1406,9 +1519,9 @@ var DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
|
1406
1519
|
var DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
1407
1520
|
var DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
1408
1521
|
var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
1409
|
-
var DropdownMenuSubTrigger =
|
|
1522
|
+
var DropdownMenuSubTrigger = React11.forwardRef((_a, ref) => {
|
|
1410
1523
|
var _b = _a, { className, inset, children } = _b, props = __objRest(_b, ["className", "inset", "children"]);
|
|
1411
|
-
return /* @__PURE__ */
|
|
1524
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1412
1525
|
DropdownMenuPrimitive.SubTrigger,
|
|
1413
1526
|
__spreadValues({
|
|
1414
1527
|
ref,
|
|
@@ -1419,13 +1532,13 @@ var DropdownMenuSubTrigger = React10.forwardRef((_a, ref) => {
|
|
|
1419
1532
|
)
|
|
1420
1533
|
}, props),
|
|
1421
1534
|
children,
|
|
1422
|
-
/* @__PURE__ */
|
|
1535
|
+
/* @__PURE__ */ React11.createElement(import_lucide_react5.ChevronRight, { className: "ml-auto" })
|
|
1423
1536
|
);
|
|
1424
1537
|
});
|
|
1425
1538
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
1426
|
-
var DropdownMenuSubContent =
|
|
1539
|
+
var DropdownMenuSubContent = React11.forwardRef((_a, ref) => {
|
|
1427
1540
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1428
|
-
return /* @__PURE__ */
|
|
1541
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1429
1542
|
DropdownMenuPrimitive.SubContent,
|
|
1430
1543
|
__spreadValues({
|
|
1431
1544
|
ref,
|
|
@@ -1437,9 +1550,9 @@ var DropdownMenuSubContent = React10.forwardRef((_a, ref) => {
|
|
|
1437
1550
|
);
|
|
1438
1551
|
});
|
|
1439
1552
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
1440
|
-
var DropdownMenuContent =
|
|
1553
|
+
var DropdownMenuContent = React11.forwardRef((_a, ref) => {
|
|
1441
1554
|
var _b = _a, { className, sideOffset = 4 } = _b, props = __objRest(_b, ["className", "sideOffset"]);
|
|
1442
|
-
return /* @__PURE__ */
|
|
1555
|
+
return /* @__PURE__ */ React11.createElement(DropdownMenuPrimitive.Portal, null, /* @__PURE__ */ React11.createElement(
|
|
1443
1556
|
DropdownMenuPrimitive.Content,
|
|
1444
1557
|
__spreadValues({
|
|
1445
1558
|
ref,
|
|
@@ -1453,9 +1566,9 @@ var DropdownMenuContent = React10.forwardRef((_a, ref) => {
|
|
|
1453
1566
|
));
|
|
1454
1567
|
});
|
|
1455
1568
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
1456
|
-
var DropdownMenuItem =
|
|
1569
|
+
var DropdownMenuItem = React11.forwardRef((_a, ref) => {
|
|
1457
1570
|
var _b = _a, { className, inset } = _b, props = __objRest(_b, ["className", "inset"]);
|
|
1458
|
-
return /* @__PURE__ */
|
|
1571
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1459
1572
|
DropdownMenuPrimitive.Item,
|
|
1460
1573
|
__spreadValues({
|
|
1461
1574
|
ref,
|
|
@@ -1468,9 +1581,9 @@ var DropdownMenuItem = React10.forwardRef((_a, ref) => {
|
|
|
1468
1581
|
);
|
|
1469
1582
|
});
|
|
1470
1583
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
1471
|
-
var DropdownMenuCheckboxItem =
|
|
1584
|
+
var DropdownMenuCheckboxItem = React11.forwardRef((_a, ref) => {
|
|
1472
1585
|
var _b = _a, { className, children, checked } = _b, props = __objRest(_b, ["className", "children", "checked"]);
|
|
1473
|
-
return /* @__PURE__ */
|
|
1586
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1474
1587
|
DropdownMenuPrimitive.CheckboxItem,
|
|
1475
1588
|
__spreadValues({
|
|
1476
1589
|
ref,
|
|
@@ -1480,14 +1593,14 @@ var DropdownMenuCheckboxItem = React10.forwardRef((_a, ref) => {
|
|
|
1480
1593
|
),
|
|
1481
1594
|
checked
|
|
1482
1595
|
}, props),
|
|
1483
|
-
/* @__PURE__ */
|
|
1596
|
+
/* @__PURE__ */ React11.createElement("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center" }, /* @__PURE__ */ React11.createElement(DropdownMenuPrimitive.ItemIndicator, null, /* @__PURE__ */ React11.createElement(import_lucide_react5.Check, { className: "h-4 w-4" }))),
|
|
1484
1597
|
children
|
|
1485
1598
|
);
|
|
1486
1599
|
});
|
|
1487
1600
|
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
1488
|
-
var DropdownMenuRadioItem =
|
|
1601
|
+
var DropdownMenuRadioItem = React11.forwardRef((_a, ref) => {
|
|
1489
1602
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
1490
|
-
return /* @__PURE__ */
|
|
1603
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1491
1604
|
DropdownMenuPrimitive.RadioItem,
|
|
1492
1605
|
__spreadValues({
|
|
1493
1606
|
ref,
|
|
@@ -1496,14 +1609,14 @@ var DropdownMenuRadioItem = React10.forwardRef((_a, ref) => {
|
|
|
1496
1609
|
className
|
|
1497
1610
|
)
|
|
1498
1611
|
}, props),
|
|
1499
|
-
/* @__PURE__ */
|
|
1612
|
+
/* @__PURE__ */ React11.createElement("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center" }, /* @__PURE__ */ React11.createElement(DropdownMenuPrimitive.ItemIndicator, null, /* @__PURE__ */ React11.createElement(import_lucide_react5.Circle, { className: "h-2 w-2 fill-current" }))),
|
|
1500
1613
|
children
|
|
1501
1614
|
);
|
|
1502
1615
|
});
|
|
1503
1616
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
1504
|
-
var DropdownMenuLabel =
|
|
1617
|
+
var DropdownMenuLabel = React11.forwardRef((_a, ref) => {
|
|
1505
1618
|
var _b = _a, { className, inset } = _b, props = __objRest(_b, ["className", "inset"]);
|
|
1506
|
-
return /* @__PURE__ */
|
|
1619
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1507
1620
|
DropdownMenuPrimitive.Label,
|
|
1508
1621
|
__spreadValues({
|
|
1509
1622
|
ref,
|
|
@@ -1516,9 +1629,9 @@ var DropdownMenuLabel = React10.forwardRef((_a, ref) => {
|
|
|
1516
1629
|
);
|
|
1517
1630
|
});
|
|
1518
1631
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
1519
|
-
var DropdownMenuSeparator =
|
|
1632
|
+
var DropdownMenuSeparator = React11.forwardRef((_a, ref) => {
|
|
1520
1633
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1521
|
-
return /* @__PURE__ */
|
|
1634
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1522
1635
|
DropdownMenuPrimitive.Separator,
|
|
1523
1636
|
__spreadValues({
|
|
1524
1637
|
ref,
|
|
@@ -1533,7 +1646,7 @@ var DropdownMenuShortcut = (_a) => {
|
|
|
1533
1646
|
} = _b, props = __objRest(_b, [
|
|
1534
1647
|
"className"
|
|
1535
1648
|
]);
|
|
1536
|
-
return /* @__PURE__ */
|
|
1649
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1537
1650
|
"span",
|
|
1538
1651
|
__spreadValues({
|
|
1539
1652
|
className: cn("ml-auto text-xs tracking-widest opacity-60", className)
|
|
@@ -1543,26 +1656,26 @@ var DropdownMenuShortcut = (_a) => {
|
|
|
1543
1656
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
1544
1657
|
|
|
1545
1658
|
// components/ui/button.tsx
|
|
1546
|
-
var
|
|
1659
|
+
var React12 = __toESM(require("react"));
|
|
1547
1660
|
var import_react_slot = require("@radix-ui/react-slot");
|
|
1548
1661
|
var import_class_variance_authority = require("class-variance-authority");
|
|
1549
1662
|
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
1550
|
-
"inline-flex items-center justify-center gap-
|
|
1663
|
+
"inline-flex items-center justify-center gap-1.5 whitespace-nowrap text-sm font-mono font-bold uppercase tracking-[0.08em] transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-0 disabled:pointer-events-none disabled:opacity-30 [&_svg]:pointer-events-none [&_svg]:size-3 [&_svg]:shrink-0 relative overflow-hidden",
|
|
1551
1664
|
{
|
|
1552
1665
|
variants: {
|
|
1553
1666
|
variant: {
|
|
1554
|
-
default: "bg-primary text-primary-foreground
|
|
1555
|
-
destructive: "bg-destructive text-destructive-foreground
|
|
1556
|
-
outline: "border border-
|
|
1557
|
-
secondary: "bg-secondary text-secondary-foreground
|
|
1558
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
1559
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
1667
|
+
default: "bg-primary text-primary-foreground border-2 border-foreground hover:bg-foreground hover:text-background active:translate-y-[1px] shadow-[3px_3px_0_0_rgba(0,0,0,1)] dark:shadow-[3px_3px_0_0_rgba(255,255,255,0.2)] hover:shadow-[1px_1px_0_0_rgba(0,0,0,1)] dark:hover:shadow-[1px_1px_0_0_rgba(255,255,255,0.2)]",
|
|
1668
|
+
destructive: "bg-destructive text-destructive-foreground border-2 border-foreground hover:bg-destructive/90 active:translate-y-[1px] shadow-[3px_3px_0_0_rgba(0,0,0,1)] dark:shadow-[3px_3px_0_0_rgba(255,255,255,0.2)] hover:shadow-[1px_1px_0_0_rgba(0,0,0,1)] dark:hover:shadow-[1px_1px_0_0_rgba(255,255,255,0.2)]",
|
|
1669
|
+
outline: "border-2 border-foreground bg-background hover:bg-foreground hover:text-background active:translate-y-[1px] shadow-[3px_3px_0_0_rgba(0,0,0,1)] dark:shadow-[3px_3px_0_0_rgba(255,255,255,0.2)] hover:shadow-[1px_1px_0_0_rgba(0,0,0,1)] dark:hover:shadow-[1px_1px_0_0_rgba(255,255,255,0.2)]",
|
|
1670
|
+
secondary: "bg-secondary text-secondary-foreground border-2 border-border hover:bg-secondary/80 active:translate-y-[1px] shadow-[2px_2px_0_0_rgba(0,0,0,0.3)] dark:shadow-[2px_2px_0_0_rgba(255,255,255,0.1)] hover:shadow-[1px_1px_0_0_rgba(0,0,0,0.3)] dark:hover:shadow-[1px_1px_0_0_rgba(255,255,255,0.1)]",
|
|
1671
|
+
ghost: "hover:bg-accent hover:text-accent-foreground border-2 border-transparent hover:border-border",
|
|
1672
|
+
link: "text-primary underline-offset-4 hover:underline border-0 shadow-none"
|
|
1560
1673
|
},
|
|
1561
1674
|
size: {
|
|
1562
|
-
default: "h-
|
|
1563
|
-
sm: "h-8
|
|
1564
|
-
lg: "h-
|
|
1565
|
-
icon: "h-
|
|
1675
|
+
default: "h-10 px-5 py-2.5 text-xs",
|
|
1676
|
+
sm: "h-8 px-4 text-[10px]",
|
|
1677
|
+
lg: "h-12 px-7 text-sm",
|
|
1678
|
+
icon: "h-10 w-10"
|
|
1566
1679
|
}
|
|
1567
1680
|
},
|
|
1568
1681
|
defaultVariants: {
|
|
@@ -1571,11 +1684,11 @@ var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
|
1571
1684
|
}
|
|
1572
1685
|
}
|
|
1573
1686
|
);
|
|
1574
|
-
var Button =
|
|
1687
|
+
var Button = React12.forwardRef(
|
|
1575
1688
|
(_a, ref) => {
|
|
1576
1689
|
var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest(_b, ["className", "variant", "size", "asChild"]);
|
|
1577
1690
|
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
1578
|
-
return /* @__PURE__ */
|
|
1691
|
+
return /* @__PURE__ */ React12.createElement(
|
|
1579
1692
|
Comp,
|
|
1580
1693
|
__spreadValues({
|
|
1581
1694
|
className: cn(buttonVariants({ variant, size, className })),
|
|
@@ -1604,20 +1717,20 @@ function ColumnManager({
|
|
|
1604
1717
|
itemClassName,
|
|
1605
1718
|
resetClassName
|
|
1606
1719
|
}) {
|
|
1607
|
-
return /* @__PURE__ */
|
|
1608
|
-
} }) : /* @__PURE__ */
|
|
1720
|
+
return /* @__PURE__ */ import_react10.default.createElement(DropdownMenu, null, /* @__PURE__ */ import_react10.default.createElement(DropdownMenuTrigger, { asChild: true, className }, renderTrigger ? renderTrigger({ onClick: () => {
|
|
1721
|
+
} }) : /* @__PURE__ */ import_react10.default.createElement(
|
|
1609
1722
|
Button,
|
|
1610
1723
|
{
|
|
1611
1724
|
variant: "outline",
|
|
1612
1725
|
size: "sm",
|
|
1613
1726
|
className: cn("ml-auto", triggerClassName)
|
|
1614
1727
|
},
|
|
1615
|
-
/* @__PURE__ */
|
|
1616
|
-
/* @__PURE__ */
|
|
1617
|
-
)), /* @__PURE__ */
|
|
1728
|
+
/* @__PURE__ */ import_react10.default.createElement(import_lucide_react6.Settings, { className: "h-3 w-3 mr-1.5" }),
|
|
1729
|
+
/* @__PURE__ */ import_react10.default.createElement("span", null, "Columns")
|
|
1730
|
+
)), /* @__PURE__ */ import_react10.default.createElement(DropdownMenuContent, { align, className: contentClassName }, columns.map((column) => {
|
|
1618
1731
|
const isVisible = visibleColumns.includes(column.id);
|
|
1619
1732
|
const handleToggle = (checked) => toggleColumnVisibility(column.id, checked);
|
|
1620
|
-
return renderColumnItem ? /* @__PURE__ */
|
|
1733
|
+
return renderColumnItem ? /* @__PURE__ */ import_react10.default.createElement(import_react10.default.Fragment, { key: column.id }, renderColumnItem({ column, isVisible, onToggle: handleToggle })) : /* @__PURE__ */ import_react10.default.createElement(
|
|
1621
1734
|
DropdownMenuCheckboxItem,
|
|
1622
1735
|
{
|
|
1623
1736
|
key: column.id,
|
|
@@ -1627,7 +1740,7 @@ function ColumnManager({
|
|
|
1627
1740
|
},
|
|
1628
1741
|
column.header
|
|
1629
1742
|
);
|
|
1630
|
-
}), showResetButton && /* @__PURE__ */
|
|
1743
|
+
}), showResetButton && /* @__PURE__ */ import_react10.default.createElement(import_react10.default.Fragment, null, /* @__PURE__ */ import_react10.default.createElement(DropdownMenuSeparator, null), renderResetButton ? renderResetButton({ onClick: resetGridPreferences }) : /* @__PURE__ */ import_react10.default.createElement(
|
|
1631
1744
|
DropdownMenuItem,
|
|
1632
1745
|
{
|
|
1633
1746
|
onClick: resetGridPreferences,
|
|
@@ -1636,13 +1749,13 @@ function ColumnManager({
|
|
|
1636
1749
|
resetClassName
|
|
1637
1750
|
)
|
|
1638
1751
|
},
|
|
1639
|
-
/* @__PURE__ */
|
|
1752
|
+
/* @__PURE__ */ import_react10.default.createElement(import_lucide_react6.RotateCcw, { className: "h-3 w-3 mr-1.5" }),
|
|
1640
1753
|
"Reset all columns"
|
|
1641
1754
|
))));
|
|
1642
1755
|
}
|
|
1643
1756
|
|
|
1644
1757
|
// components/data-grid/group-manager.tsx
|
|
1645
|
-
var
|
|
1758
|
+
var import_react11 = __toESM(require("react"));
|
|
1646
1759
|
var import_lucide_react7 = require("lucide-react");
|
|
1647
1760
|
function GroupManager({
|
|
1648
1761
|
columns,
|
|
@@ -1669,29 +1782,29 @@ function GroupManager({
|
|
|
1669
1782
|
updateGroupByColumns([...groupByColumns, columnId]);
|
|
1670
1783
|
}
|
|
1671
1784
|
};
|
|
1672
|
-
return /* @__PURE__ */
|
|
1785
|
+
return /* @__PURE__ */ import_react11.default.createElement("div", { className: "flex flex-col" }, groupByColumns.length > 0 && /* @__PURE__ */ import_react11.default.createElement("div", { className: cn("flex flex-wrap gap-1 mb-2", activeGroupsClassName) }, groupByColumns.map((columnId) => {
|
|
1673
1786
|
const column = columns.find((col) => col.id === columnId);
|
|
1674
1787
|
if (!column) return null;
|
|
1675
|
-
return renderActiveGroup ? /* @__PURE__ */
|
|
1788
|
+
return renderActiveGroup ? /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, { key: columnId }, renderActiveGroup({
|
|
1676
1789
|
column,
|
|
1677
1790
|
onRemove: () => removeGroupByColumn(columnId)
|
|
1678
|
-
})) : /* @__PURE__ */
|
|
1791
|
+
})) : /* @__PURE__ */ import_react11.default.createElement(
|
|
1679
1792
|
"div",
|
|
1680
1793
|
{
|
|
1681
1794
|
key: columnId,
|
|
1682
1795
|
className: "bg-primary/10 rounded-md px-2 py-1 text-xs flex items-center"
|
|
1683
1796
|
},
|
|
1684
|
-
/* @__PURE__ */
|
|
1685
|
-
/* @__PURE__ */
|
|
1797
|
+
/* @__PURE__ */ import_react11.default.createElement("span", { className: "mr-1" }, column.header),
|
|
1798
|
+
/* @__PURE__ */ import_react11.default.createElement(
|
|
1686
1799
|
"button",
|
|
1687
1800
|
{
|
|
1688
1801
|
onClick: () => removeGroupByColumn(columnId),
|
|
1689
1802
|
className: "hover:text-destructive focus:outline-none"
|
|
1690
1803
|
},
|
|
1691
|
-
/* @__PURE__ */
|
|
1804
|
+
/* @__PURE__ */ import_react11.default.createElement(import_lucide_react7.X, { className: "h-3 w-3" })
|
|
1692
1805
|
)
|
|
1693
1806
|
);
|
|
1694
|
-
}), /* @__PURE__ */
|
|
1807
|
+
}), /* @__PURE__ */ import_react11.default.createElement(
|
|
1695
1808
|
Button,
|
|
1696
1809
|
{
|
|
1697
1810
|
variant: "ghost",
|
|
@@ -1700,19 +1813,19 @@ function GroupManager({
|
|
|
1700
1813
|
className: "text-xs h-6"
|
|
1701
1814
|
},
|
|
1702
1815
|
"Clear All"
|
|
1703
|
-
)), /* @__PURE__ */
|
|
1704
|
-
} }) : /* @__PURE__ */
|
|
1816
|
+
)), /* @__PURE__ */ import_react11.default.createElement(DropdownMenu, null, /* @__PURE__ */ import_react11.default.createElement(DropdownMenuTrigger, { asChild: true, className }, renderTrigger ? renderTrigger({ onClick: () => {
|
|
1817
|
+
} }) : /* @__PURE__ */ import_react11.default.createElement(
|
|
1705
1818
|
Button,
|
|
1706
1819
|
{
|
|
1707
1820
|
variant: "outline",
|
|
1708
1821
|
size: "sm",
|
|
1709
1822
|
className: cn(triggerClassName)
|
|
1710
1823
|
},
|
|
1711
|
-
/* @__PURE__ */
|
|
1712
|
-
/* @__PURE__ */
|
|
1713
|
-
)), /* @__PURE__ */
|
|
1824
|
+
/* @__PURE__ */ import_react11.default.createElement(import_lucide_react7.Layers, { className: "h-3 w-3 mr-1.5" }),
|
|
1825
|
+
/* @__PURE__ */ import_react11.default.createElement("span", null, "Group by")
|
|
1826
|
+
)), /* @__PURE__ */ import_react11.default.createElement(DropdownMenuContent, { align, className: contentClassName }, groupableColumns.length > 0 ? groupableColumns.map((column) => {
|
|
1714
1827
|
const isGrouped = groupByColumns.includes(column.id);
|
|
1715
|
-
return /* @__PURE__ */
|
|
1828
|
+
return /* @__PURE__ */ import_react11.default.createElement(
|
|
1716
1829
|
DropdownMenuCheckboxItem,
|
|
1717
1830
|
{
|
|
1718
1831
|
key: column.id,
|
|
@@ -1722,11 +1835,11 @@ function GroupManager({
|
|
|
1722
1835
|
},
|
|
1723
1836
|
column.header
|
|
1724
1837
|
);
|
|
1725
|
-
}) : /* @__PURE__ */
|
|
1838
|
+
}) : /* @__PURE__ */ import_react11.default.createElement(DropdownMenuItem, { disabled: true }, "No groupable columns"), groupByColumns.length > 0 && /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, /* @__PURE__ */ import_react11.default.createElement(DropdownMenuSeparator, null), /* @__PURE__ */ import_react11.default.createElement(DropdownMenuItem, { onClick: clearGrouping }, "Clear all groups")))));
|
|
1726
1839
|
}
|
|
1727
1840
|
|
|
1728
1841
|
// components/data-grid/use-grid-persistence.ts
|
|
1729
|
-
var
|
|
1842
|
+
var import_react12 = require("react");
|
|
1730
1843
|
function useGridPersistence(gridId, columns, defaultColumnWidth = 150) {
|
|
1731
1844
|
const storageKey = `gridular-preferences-${gridId}`;
|
|
1732
1845
|
const getDefaultPreferences = () => ({
|
|
@@ -1766,10 +1879,10 @@ function useGridPersistence(gridId, columns, defaultColumnWidth = 150) {
|
|
|
1766
1879
|
return getDefaultPreferences();
|
|
1767
1880
|
}
|
|
1768
1881
|
};
|
|
1769
|
-
const [preferences, setPreferences] = (0,
|
|
1882
|
+
const [preferences, setPreferences] = (0, import_react12.useState)(
|
|
1770
1883
|
getDefaultPreferences()
|
|
1771
1884
|
);
|
|
1772
|
-
(0,
|
|
1885
|
+
(0, import_react12.useEffect)(() => {
|
|
1773
1886
|
setPreferences(loadPreferences());
|
|
1774
1887
|
}, []);
|
|
1775
1888
|
const savePreferences = (newPreferences) => {
|
|
@@ -1834,10 +1947,10 @@ function useGridPersistence(gridId, columns, defaultColumnWidth = 150) {
|
|
|
1834
1947
|
}
|
|
1835
1948
|
|
|
1836
1949
|
// components/data-grid/use-data-grouping.ts
|
|
1837
|
-
var
|
|
1950
|
+
var import_react13 = require("react");
|
|
1838
1951
|
function useDataGrouping(data, groupingState, idAccessor) {
|
|
1839
1952
|
const { groupByColumns, expandedGroups } = groupingState;
|
|
1840
|
-
const groupedData = (0,
|
|
1953
|
+
const groupedData = (0, import_react13.useMemo)(() => {
|
|
1841
1954
|
if (!groupByColumns.length) return { rows: data, flattenedRows: data };
|
|
1842
1955
|
const createGroupingStructure = (rows, groupBy, depth = 0) => {
|
|
1843
1956
|
if (depth >= groupBy.length || groupBy.length === 0) {
|
|
@@ -1896,16 +2009,16 @@ function useDataGrouping(data, groupingState, idAccessor) {
|
|
|
1896
2009
|
}
|
|
1897
2010
|
|
|
1898
2011
|
// components/data-grid/use-select-cell.tsx
|
|
1899
|
-
var
|
|
2012
|
+
var import_react14 = require("react");
|
|
1900
2013
|
function useSelectCell() {
|
|
1901
|
-
const [selectedCell, setSelectedCell] = (0,
|
|
1902
|
-
const selectCell = (0,
|
|
2014
|
+
const [selectedCell, setSelectedCell] = (0, import_react14.useState)(null);
|
|
2015
|
+
const selectCell = (0, import_react14.useCallback)((rowId, columnId) => {
|
|
1903
2016
|
setSelectedCell({ rowId, columnId });
|
|
1904
2017
|
}, []);
|
|
1905
|
-
const clearSelection = (0,
|
|
2018
|
+
const clearSelection = (0, import_react14.useCallback)(() => {
|
|
1906
2019
|
setSelectedCell(null);
|
|
1907
2020
|
}, []);
|
|
1908
|
-
const isCellSelected = (0,
|
|
2021
|
+
const isCellSelected = (0, import_react14.useCallback)(
|
|
1909
2022
|
(rowId, columnId) => {
|
|
1910
2023
|
return selectedCell !== null && selectedCell.rowId === rowId && selectedCell.columnId === columnId;
|
|
1911
2024
|
},
|
|
@@ -1941,6 +2054,7 @@ function DataGrid({
|
|
|
1941
2054
|
enableRowSelection = false,
|
|
1942
2055
|
enablePagination = true,
|
|
1943
2056
|
enableGrouping = false,
|
|
2057
|
+
enableExpandableRows = false,
|
|
1944
2058
|
hideGroupControls = false,
|
|
1945
2059
|
hideColumnManager = false,
|
|
1946
2060
|
pageSizeOptions = [5, 10, 20, 50, 100],
|
|
@@ -1970,13 +2084,19 @@ function DataGrid({
|
|
|
1970
2084
|
enableCellSelection = false,
|
|
1971
2085
|
onCellSelect,
|
|
1972
2086
|
preventRowSelection,
|
|
1973
|
-
contextMenuContent
|
|
2087
|
+
contextMenuContent,
|
|
2088
|
+
expandedRows = {},
|
|
2089
|
+
onExpandedRowsChange,
|
|
2090
|
+
renderExpandedRow,
|
|
2091
|
+
expandIcon,
|
|
2092
|
+
collapseIcon,
|
|
2093
|
+
getRowId
|
|
1974
2094
|
}) {
|
|
1975
2095
|
const { theme } = useTheme();
|
|
1976
|
-
const filterValueRefs = (0,
|
|
1977
|
-
const [filterMenuOpen, setFilterMenuOpen] = (0,
|
|
1978
|
-
const [activeFilterColumn, setActiveFilterColumn] = (0,
|
|
1979
|
-
const filterMenuRef = (0,
|
|
2096
|
+
const filterValueRefs = (0, import_react15.useRef)(filterState || {});
|
|
2097
|
+
const [filterMenuOpen, setFilterMenuOpen] = (0, import_react15.useState)(null);
|
|
2098
|
+
const [activeFilterColumn, setActiveFilterColumn] = (0, import_react15.useState)(null);
|
|
2099
|
+
const filterMenuRef = (0, import_react15.useRef)(null);
|
|
1980
2100
|
const effectiveEnablePagination = enableGrouping ? false : enablePagination;
|
|
1981
2101
|
const {
|
|
1982
2102
|
preferences,
|
|
@@ -1996,12 +2116,12 @@ function DataGrid({
|
|
|
1996
2116
|
}
|
|
1997
2117
|
}
|
|
1998
2118
|
};
|
|
1999
|
-
const [internalGroupingState, setInternalGroupingState] = (0,
|
|
2119
|
+
const [internalGroupingState, setInternalGroupingState] = (0, import_react15.useState)({
|
|
2000
2120
|
groupByColumns: (groupingState == null ? void 0 : groupingState.groupByColumns) || preferences.groupByColumns || [],
|
|
2001
2121
|
expandedGroups: (groupingState == null ? void 0 : groupingState.expandedGroups) || preferences.expandedGroups || {}
|
|
2002
2122
|
});
|
|
2003
2123
|
const effectiveGroupingState = groupingState || internalGroupingState;
|
|
2004
|
-
const visibleColumns = (0,
|
|
2124
|
+
const visibleColumns = (0, import_react15.useMemo)(() => {
|
|
2005
2125
|
const hiddenIds = new Set(preferences.hiddenColumns);
|
|
2006
2126
|
const visible = columns.filter((col) => !hiddenIds.has(col.id)).map((col) => col.id);
|
|
2007
2127
|
const orderedIds = preferences.columnOrder.filter(
|
|
@@ -2014,16 +2134,16 @@ function DataGrid({
|
|
|
2014
2134
|
});
|
|
2015
2135
|
return orderedIds;
|
|
2016
2136
|
}, [columns, preferences.hiddenColumns, preferences.columnOrder]);
|
|
2017
|
-
const orderedColumns = (0,
|
|
2137
|
+
const orderedColumns = (0, import_react15.useMemo)(() => {
|
|
2018
2138
|
const colMap = new Map(columns.map((col) => [col.id, col]));
|
|
2019
2139
|
return visibleColumns.map((id) => colMap.get(id)).filter(Boolean);
|
|
2020
2140
|
}, [columns, visibleColumns]);
|
|
2021
|
-
(0,
|
|
2141
|
+
(0, import_react15.useEffect)(() => {
|
|
2022
2142
|
if (filterState) {
|
|
2023
2143
|
filterValueRefs.current = __spreadValues({}, filterState);
|
|
2024
2144
|
}
|
|
2025
2145
|
}, [filterState]);
|
|
2026
|
-
(0,
|
|
2146
|
+
(0, import_react15.useEffect)(() => {
|
|
2027
2147
|
function handleClickOutside(event) {
|
|
2028
2148
|
if (filterMenuRef.current && !filterMenuRef.current.contains(event.target)) {
|
|
2029
2149
|
setFilterMenuOpen(null);
|
|
@@ -2039,7 +2159,7 @@ function DataGrid({
|
|
|
2039
2159
|
enableGrouping ? effectiveGroupingState : { groupByColumns: [], expandedGroups: {} },
|
|
2040
2160
|
(row) => row.id || `row-${Math.random()}`
|
|
2041
2161
|
);
|
|
2042
|
-
const paginatedData = (0,
|
|
2162
|
+
const paginatedData = (0, import_react15.useMemo)(() => {
|
|
2043
2163
|
const displayData = enableGrouping ? flattenedRows : data;
|
|
2044
2164
|
if (!effectiveEnablePagination || !pageSize) {
|
|
2045
2165
|
return displayData;
|
|
@@ -2155,7 +2275,7 @@ function DataGrid({
|
|
|
2155
2275
|
});
|
|
2156
2276
|
};
|
|
2157
2277
|
if (!isLoading && (!data || data.length === 0)) {
|
|
2158
|
-
return /* @__PURE__ */
|
|
2278
|
+
return /* @__PURE__ */ import_react15.default.createElement(
|
|
2159
2279
|
"div",
|
|
2160
2280
|
{
|
|
2161
2281
|
className: cn(
|
|
@@ -2168,7 +2288,7 @@ function DataGrid({
|
|
|
2168
2288
|
);
|
|
2169
2289
|
}
|
|
2170
2290
|
if (isLoading) {
|
|
2171
|
-
return /* @__PURE__ */
|
|
2291
|
+
return /* @__PURE__ */ import_react15.default.createElement(
|
|
2172
2292
|
"div",
|
|
2173
2293
|
{
|
|
2174
2294
|
className: cn(
|
|
@@ -2181,7 +2301,7 @@ function DataGrid({
|
|
|
2181
2301
|
);
|
|
2182
2302
|
}
|
|
2183
2303
|
const showToolbar = enableGrouping && !hideGroupControls || !hideColumnManager;
|
|
2184
|
-
return /* @__PURE__ */
|
|
2304
|
+
return /* @__PURE__ */ import_react15.default.createElement(
|
|
2185
2305
|
"div",
|
|
2186
2306
|
{
|
|
2187
2307
|
className: cn(
|
|
@@ -2191,7 +2311,7 @@ function DataGrid({
|
|
|
2191
2311
|
classes.container
|
|
2192
2312
|
)
|
|
2193
2313
|
},
|
|
2194
|
-
showToolbar ? /* @__PURE__ */
|
|
2314
|
+
showToolbar ? /* @__PURE__ */ import_react15.default.createElement(
|
|
2195
2315
|
"div",
|
|
2196
2316
|
{
|
|
2197
2317
|
className: cn(
|
|
@@ -2199,7 +2319,7 @@ function DataGrid({
|
|
|
2199
2319
|
classes.columnManager
|
|
2200
2320
|
)
|
|
2201
2321
|
},
|
|
2202
|
-
enableGrouping && !hideGroupControls ? /* @__PURE__ */
|
|
2322
|
+
enableGrouping && !hideGroupControls ? /* @__PURE__ */ import_react15.default.createElement(
|
|
2203
2323
|
GroupManager,
|
|
2204
2324
|
__spreadValues({
|
|
2205
2325
|
columns,
|
|
@@ -2209,7 +2329,7 @@ function DataGrid({
|
|
|
2209
2329
|
clearGrouping: handleClearGrouping
|
|
2210
2330
|
}, groupManagerProps)
|
|
2211
2331
|
) : null,
|
|
2212
|
-
!hideColumnManager ? /* @__PURE__ */
|
|
2332
|
+
!hideColumnManager ? /* @__PURE__ */ import_react15.default.createElement(
|
|
2213
2333
|
ColumnManager,
|
|
2214
2334
|
__spreadValues({
|
|
2215
2335
|
columns,
|
|
@@ -2219,7 +2339,7 @@ function DataGrid({
|
|
|
2219
2339
|
}, columnManagerProps)
|
|
2220
2340
|
) : null
|
|
2221
2341
|
) : null,
|
|
2222
|
-
/* @__PURE__ */
|
|
2342
|
+
/* @__PURE__ */ import_react15.default.createElement("div", { className: "w-full overflow-auto" }, /* @__PURE__ */ import_react15.default.createElement("table", { className: "w-full border-separate border-spacing-0" }, /* @__PURE__ */ import_react15.default.createElement(
|
|
2223
2343
|
TableHeader,
|
|
2224
2344
|
{
|
|
2225
2345
|
columns: orderedColumns,
|
|
@@ -2257,7 +2377,7 @@ function DataGrid({
|
|
|
2257
2377
|
filterMenu,
|
|
2258
2378
|
filterMenuRef
|
|
2259
2379
|
}
|
|
2260
|
-
), /* @__PURE__ */
|
|
2380
|
+
), /* @__PURE__ */ import_react15.default.createElement(
|
|
2261
2381
|
TableBody,
|
|
2262
2382
|
{
|
|
2263
2383
|
paginatedData,
|
|
@@ -2293,10 +2413,23 @@ function DataGrid({
|
|
|
2293
2413
|
groupCollapseIcon,
|
|
2294
2414
|
groupRowProps,
|
|
2295
2415
|
preventRowSelection,
|
|
2296
|
-
contextMenuContent
|
|
2416
|
+
contextMenuContent,
|
|
2417
|
+
enableExpandableRows,
|
|
2418
|
+
expandedRows,
|
|
2419
|
+
onToggleRowExpand: (rowId) => {
|
|
2420
|
+
if (onExpandedRowsChange) {
|
|
2421
|
+
const newExpandedRows = __spreadValues({}, expandedRows);
|
|
2422
|
+
newExpandedRows[rowId] = !newExpandedRows[rowId];
|
|
2423
|
+
onExpandedRowsChange(newExpandedRows);
|
|
2424
|
+
}
|
|
2425
|
+
},
|
|
2426
|
+
renderExpandedRow,
|
|
2427
|
+
expandIcon,
|
|
2428
|
+
collapseIcon,
|
|
2429
|
+
getRowId
|
|
2297
2430
|
}
|
|
2298
2431
|
))),
|
|
2299
|
-
effectiveEnablePagination ? /* @__PURE__ */
|
|
2432
|
+
effectiveEnablePagination ? /* @__PURE__ */ import_react15.default.createElement(
|
|
2300
2433
|
Pagination,
|
|
2301
2434
|
__spreadValues({
|
|
2302
2435
|
pageIndex: pageIndex != null ? pageIndex : 0,
|
|
@@ -2321,11 +2454,11 @@ function DataGrid({
|
|
|
2321
2454
|
}
|
|
2322
2455
|
|
|
2323
2456
|
// components/data-grid/use-column-resize.ts
|
|
2324
|
-
var
|
|
2457
|
+
var import_react16 = require("react");
|
|
2325
2458
|
var useColumnResize = (enableColumnResize) => {
|
|
2326
|
-
const [columnResizeState, setColumnResizeState] = (0,
|
|
2327
|
-
const [isResizing, setIsResizing] = (0,
|
|
2328
|
-
const handleColumnResizeStart = (0,
|
|
2459
|
+
const [columnResizeState, setColumnResizeState] = (0, import_react16.useState)({});
|
|
2460
|
+
const [isResizing, setIsResizing] = (0, import_react16.useState)(false);
|
|
2461
|
+
const handleColumnResizeStart = (0, import_react16.useCallback)(
|
|
2329
2462
|
(columnId, startWidth, e) => {
|
|
2330
2463
|
if (!enableColumnResize) return;
|
|
2331
2464
|
setIsResizing(true);
|
|
@@ -2355,7 +2488,7 @@ var useColumnResize = (enableColumnResize) => {
|
|
|
2355
2488
|
};
|
|
2356
2489
|
|
|
2357
2490
|
// components/theme-provider/theme-switcher.tsx
|
|
2358
|
-
var
|
|
2491
|
+
var import_react17 = __toESM(require("react"));
|
|
2359
2492
|
var import_lucide_react8 = require("lucide-react");
|
|
2360
2493
|
var ThemeSwitcher = ({ className }) => {
|
|
2361
2494
|
const { theme, setTssTheme, setTailwindTheme } = useTheme();
|
|
@@ -2399,7 +2532,7 @@ var ThemeSwitcher = ({ className }) => {
|
|
|
2399
2532
|
});
|
|
2400
2533
|
}
|
|
2401
2534
|
};
|
|
2402
|
-
return /* @__PURE__ */
|
|
2535
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
2403
2536
|
Button,
|
|
2404
2537
|
{
|
|
2405
2538
|
onClick: toggleTheme,
|
|
@@ -2408,27 +2541,27 @@ var ThemeSwitcher = ({ className }) => {
|
|
|
2408
2541
|
className,
|
|
2409
2542
|
title: isDarkMode ? "Switch to light mode" : "Switch to dark mode"
|
|
2410
2543
|
},
|
|
2411
|
-
isDarkMode ? /* @__PURE__ */
|
|
2544
|
+
isDarkMode ? /* @__PURE__ */ import_react17.default.createElement(import_lucide_react8.Sun, { className: "h-4 w-4" }) : /* @__PURE__ */ import_react17.default.createElement(import_lucide_react8.Moon, { className: "h-4 w-4" })
|
|
2412
2545
|
);
|
|
2413
2546
|
};
|
|
2414
2547
|
|
|
2415
2548
|
// components/theme-provider/theme-wrapper.tsx
|
|
2416
|
-
var
|
|
2549
|
+
var import_react18 = __toESM(require("react"));
|
|
2417
2550
|
var ThemeWrapper = ({
|
|
2418
2551
|
children,
|
|
2419
2552
|
customTheme
|
|
2420
2553
|
}) => {
|
|
2421
|
-
return /* @__PURE__ */
|
|
2554
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
2422
2555
|
ThemeProvider,
|
|
2423
2556
|
{
|
|
2424
2557
|
initialTssTheme: __spreadValues({}, customTheme || {})
|
|
2425
2558
|
},
|
|
2426
|
-
/* @__PURE__ */
|
|
2559
|
+
/* @__PURE__ */ import_react18.default.createElement("div", null, children)
|
|
2427
2560
|
);
|
|
2428
2561
|
};
|
|
2429
2562
|
|
|
2430
2563
|
// components/ui/badge.tsx
|
|
2431
|
-
var
|
|
2564
|
+
var React18 = __toESM(require("react"));
|
|
2432
2565
|
var import_react_slot2 = require("@radix-ui/react-slot");
|
|
2433
2566
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
2434
2567
|
var badgeVariants = (0, import_class_variance_authority2.cva)(
|
|
@@ -2458,7 +2591,7 @@ function Badge(_a) {
|
|
|
2458
2591
|
"asChild"
|
|
2459
2592
|
]);
|
|
2460
2593
|
const Comp = asChild ? import_react_slot2.Slot : "span";
|
|
2461
|
-
return /* @__PURE__ */
|
|
2594
|
+
return /* @__PURE__ */ React18.createElement(
|
|
2462
2595
|
Comp,
|
|
2463
2596
|
__spreadValues({
|
|
2464
2597
|
"data-slot": "badge",
|
|
@@ -2468,42 +2601,42 @@ function Badge(_a) {
|
|
|
2468
2601
|
}
|
|
2469
2602
|
|
|
2470
2603
|
// components/ui/checkbox.tsx
|
|
2471
|
-
var
|
|
2604
|
+
var React19 = __toESM(require("react"));
|
|
2472
2605
|
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"));
|
|
2473
2606
|
var import_lucide_react9 = require("lucide-react");
|
|
2474
|
-
var Checkbox =
|
|
2607
|
+
var Checkbox = React19.forwardRef((_a, ref) => {
|
|
2475
2608
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2476
|
-
return /* @__PURE__ */
|
|
2609
|
+
return /* @__PURE__ */ React19.createElement(
|
|
2477
2610
|
CheckboxPrimitive.Root,
|
|
2478
2611
|
__spreadValues({
|
|
2479
2612
|
ref,
|
|
2480
2613
|
className: cn(
|
|
2481
|
-
"peer h-
|
|
2614
|
+
"peer h-3.5 w-3.5 shrink-0 border-2 border-border shadow-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-foreground",
|
|
2482
2615
|
className
|
|
2483
2616
|
)
|
|
2484
2617
|
}, props),
|
|
2485
|
-
/* @__PURE__ */
|
|
2618
|
+
/* @__PURE__ */ React19.createElement(
|
|
2486
2619
|
CheckboxPrimitive.Indicator,
|
|
2487
2620
|
{
|
|
2488
2621
|
className: cn("flex items-center justify-center text-current")
|
|
2489
2622
|
},
|
|
2490
|
-
/* @__PURE__ */
|
|
2623
|
+
/* @__PURE__ */ React19.createElement(import_lucide_react9.Check, { className: "h-3 w-3", strokeWidth: 3 })
|
|
2491
2624
|
)
|
|
2492
2625
|
);
|
|
2493
2626
|
});
|
|
2494
2627
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
2495
2628
|
|
|
2496
2629
|
// components/ui/input.tsx
|
|
2497
|
-
var
|
|
2498
|
-
var Input =
|
|
2630
|
+
var React20 = __toESM(require("react"));
|
|
2631
|
+
var Input = React20.forwardRef(
|
|
2499
2632
|
(_a, ref) => {
|
|
2500
2633
|
var _b = _a, { className, type } = _b, props = __objRest(_b, ["className", "type"]);
|
|
2501
|
-
return /* @__PURE__ */
|
|
2634
|
+
return /* @__PURE__ */ React20.createElement(
|
|
2502
2635
|
"input",
|
|
2503
2636
|
__spreadValues({
|
|
2504
2637
|
type,
|
|
2505
2638
|
className: cn(
|
|
2506
|
-
"flex h-
|
|
2639
|
+
"flex h-10 w-full border-2 border-border bg-background px-3 py-2 text-sm font-mono font-medium transition-all duration-150 file:border-0 file:bg-transparent file:text-sm file:font-mono file:font-bold file:text-foreground placeholder:text-muted-foreground placeholder:text-xs placeholder:uppercase placeholder:tracking-[0.08em] placeholder:font-bold focus-visible:outline-none focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary/20 hover:border-foreground disabled:cursor-not-allowed disabled:opacity-30 disabled:bg-muted shadow-[inset_2px_2px_0_0_rgba(0,0,0,0.1)] dark:shadow-[inset_2px_2px_0_0_rgba(255,255,255,0.05)] focus-visible:shadow-[inset_0_0_0_0_rgba(0,0,0,0)]",
|
|
2507
2640
|
className
|
|
2508
2641
|
),
|
|
2509
2642
|
ref
|
|
@@ -2514,21 +2647,21 @@ var Input = React19.forwardRef(
|
|
|
2514
2647
|
Input.displayName = "Input";
|
|
2515
2648
|
|
|
2516
2649
|
// components/ui/popover.tsx
|
|
2517
|
-
var
|
|
2650
|
+
var React21 = __toESM(require("react"));
|
|
2518
2651
|
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
|
|
2519
2652
|
var Popover = PopoverPrimitive.Root;
|
|
2520
2653
|
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
2521
2654
|
var PopoverAnchor = PopoverPrimitive.Anchor;
|
|
2522
|
-
var PopoverContent =
|
|
2655
|
+
var PopoverContent = React21.forwardRef((_a, ref) => {
|
|
2523
2656
|
var _b = _a, { className, align = "center", sideOffset = 4 } = _b, props = __objRest(_b, ["className", "align", "sideOffset"]);
|
|
2524
|
-
return /* @__PURE__ */
|
|
2657
|
+
return /* @__PURE__ */ React21.createElement(PopoverPrimitive.Portal, null, /* @__PURE__ */ React21.createElement(
|
|
2525
2658
|
PopoverPrimitive.Content,
|
|
2526
2659
|
__spreadValues({
|
|
2527
2660
|
ref,
|
|
2528
2661
|
align,
|
|
2529
2662
|
sideOffset,
|
|
2530
2663
|
className: cn(
|
|
2531
|
-
"z-50 w-72
|
|
2664
|
+
"z-50 w-72 border-2 border-foreground bg-popover p-4 text-popover-foreground shadow-[4px_4px_0_0_rgba(0,0,0,1)] dark:shadow-[4px_4px_0_0_rgba(255,255,255,0.2)] outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-98 data-[state=open]:zoom-in-98",
|
|
2532
2665
|
className
|
|
2533
2666
|
)
|
|
2534
2667
|
}, props)
|
|
@@ -2537,15 +2670,15 @@ var PopoverContent = React20.forwardRef((_a, ref) => {
|
|
|
2537
2670
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
2538
2671
|
|
|
2539
2672
|
// components/ui/select.tsx
|
|
2540
|
-
var
|
|
2673
|
+
var React22 = __toESM(require("react"));
|
|
2541
2674
|
var SelectPrimitive = __toESM(require("@radix-ui/react-select"));
|
|
2542
2675
|
var import_lucide_react10 = require("lucide-react");
|
|
2543
2676
|
var Select = SelectPrimitive.Root;
|
|
2544
2677
|
var SelectGroup = SelectPrimitive.Group;
|
|
2545
2678
|
var SelectValue = SelectPrimitive.Value;
|
|
2546
|
-
var SelectTrigger =
|
|
2679
|
+
var SelectTrigger = React22.forwardRef((_a, ref) => {
|
|
2547
2680
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
2548
|
-
return /* @__PURE__ */
|
|
2681
|
+
return /* @__PURE__ */ React22.createElement(
|
|
2549
2682
|
SelectPrimitive.Trigger,
|
|
2550
2683
|
__spreadValues({
|
|
2551
2684
|
ref,
|
|
@@ -2555,13 +2688,13 @@ var SelectTrigger = React21.forwardRef((_a, ref) => {
|
|
|
2555
2688
|
)
|
|
2556
2689
|
}, props),
|
|
2557
2690
|
children,
|
|
2558
|
-
/* @__PURE__ */
|
|
2691
|
+
/* @__PURE__ */ React22.createElement(SelectPrimitive.Icon, { asChild: true }, /* @__PURE__ */ React22.createElement(import_lucide_react10.ChevronDown, { className: "h-4 w-4 opacity-50" }))
|
|
2559
2692
|
);
|
|
2560
2693
|
});
|
|
2561
2694
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
2562
|
-
var SelectScrollUpButton =
|
|
2695
|
+
var SelectScrollUpButton = React22.forwardRef((_a, ref) => {
|
|
2563
2696
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2564
|
-
return /* @__PURE__ */
|
|
2697
|
+
return /* @__PURE__ */ React22.createElement(
|
|
2565
2698
|
SelectPrimitive.ScrollUpButton,
|
|
2566
2699
|
__spreadValues({
|
|
2567
2700
|
ref,
|
|
@@ -2570,13 +2703,13 @@ var SelectScrollUpButton = React21.forwardRef((_a, ref) => {
|
|
|
2570
2703
|
className
|
|
2571
2704
|
)
|
|
2572
2705
|
}, props),
|
|
2573
|
-
/* @__PURE__ */
|
|
2706
|
+
/* @__PURE__ */ React22.createElement(import_lucide_react10.ChevronUp, { className: "h-4 w-4" })
|
|
2574
2707
|
);
|
|
2575
2708
|
});
|
|
2576
2709
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
2577
|
-
var SelectScrollDownButton =
|
|
2710
|
+
var SelectScrollDownButton = React22.forwardRef((_a, ref) => {
|
|
2578
2711
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2579
|
-
return /* @__PURE__ */
|
|
2712
|
+
return /* @__PURE__ */ React22.createElement(
|
|
2580
2713
|
SelectPrimitive.ScrollDownButton,
|
|
2581
2714
|
__spreadValues({
|
|
2582
2715
|
ref,
|
|
@@ -2585,13 +2718,13 @@ var SelectScrollDownButton = React21.forwardRef((_a, ref) => {
|
|
|
2585
2718
|
className
|
|
2586
2719
|
)
|
|
2587
2720
|
}, props),
|
|
2588
|
-
/* @__PURE__ */
|
|
2721
|
+
/* @__PURE__ */ React22.createElement(import_lucide_react10.ChevronDown, { className: "h-4 w-4" })
|
|
2589
2722
|
);
|
|
2590
2723
|
});
|
|
2591
2724
|
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
2592
|
-
var SelectContent =
|
|
2725
|
+
var SelectContent = React22.forwardRef((_a, ref) => {
|
|
2593
2726
|
var _b = _a, { className, children, position = "popper" } = _b, props = __objRest(_b, ["className", "children", "position"]);
|
|
2594
|
-
return /* @__PURE__ */
|
|
2727
|
+
return /* @__PURE__ */ React22.createElement(SelectPrimitive.Portal, null, /* @__PURE__ */ React22.createElement(
|
|
2595
2728
|
SelectPrimitive.Content,
|
|
2596
2729
|
__spreadValues({
|
|
2597
2730
|
ref,
|
|
@@ -2602,8 +2735,8 @@ var SelectContent = React21.forwardRef((_a, ref) => {
|
|
|
2602
2735
|
),
|
|
2603
2736
|
position
|
|
2604
2737
|
}, props),
|
|
2605
|
-
/* @__PURE__ */
|
|
2606
|
-
/* @__PURE__ */
|
|
2738
|
+
/* @__PURE__ */ React22.createElement(SelectScrollUpButton, null),
|
|
2739
|
+
/* @__PURE__ */ React22.createElement(
|
|
2607
2740
|
SelectPrimitive.Viewport,
|
|
2608
2741
|
{
|
|
2609
2742
|
className: cn(
|
|
@@ -2613,13 +2746,13 @@ var SelectContent = React21.forwardRef((_a, ref) => {
|
|
|
2613
2746
|
},
|
|
2614
2747
|
children
|
|
2615
2748
|
),
|
|
2616
|
-
/* @__PURE__ */
|
|
2749
|
+
/* @__PURE__ */ React22.createElement(SelectScrollDownButton, null)
|
|
2617
2750
|
));
|
|
2618
2751
|
});
|
|
2619
2752
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
2620
|
-
var SelectLabel =
|
|
2753
|
+
var SelectLabel = React22.forwardRef((_a, ref) => {
|
|
2621
2754
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2622
|
-
return /* @__PURE__ */
|
|
2755
|
+
return /* @__PURE__ */ React22.createElement(
|
|
2623
2756
|
SelectPrimitive.Label,
|
|
2624
2757
|
__spreadValues({
|
|
2625
2758
|
ref,
|
|
@@ -2628,9 +2761,9 @@ var SelectLabel = React21.forwardRef((_a, ref) => {
|
|
|
2628
2761
|
);
|
|
2629
2762
|
});
|
|
2630
2763
|
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
2631
|
-
var SelectItem =
|
|
2764
|
+
var SelectItem = React22.forwardRef((_a, ref) => {
|
|
2632
2765
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
2633
|
-
return /* @__PURE__ */
|
|
2766
|
+
return /* @__PURE__ */ React22.createElement(
|
|
2634
2767
|
SelectPrimitive.Item,
|
|
2635
2768
|
__spreadValues({
|
|
2636
2769
|
ref,
|
|
@@ -2639,14 +2772,14 @@ var SelectItem = React21.forwardRef((_a, ref) => {
|
|
|
2639
2772
|
className
|
|
2640
2773
|
)
|
|
2641
2774
|
}, props),
|
|
2642
|
-
/* @__PURE__ */
|
|
2643
|
-
/* @__PURE__ */
|
|
2775
|
+
/* @__PURE__ */ React22.createElement("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center" }, /* @__PURE__ */ React22.createElement(SelectPrimitive.ItemIndicator, null, /* @__PURE__ */ React22.createElement(import_lucide_react10.Check, { className: "h-4 w-4" }))),
|
|
2776
|
+
/* @__PURE__ */ React22.createElement(SelectPrimitive.ItemText, null, children)
|
|
2644
2777
|
);
|
|
2645
2778
|
});
|
|
2646
2779
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
2647
|
-
var SelectSeparator =
|
|
2780
|
+
var SelectSeparator = React22.forwardRef((_a, ref) => {
|
|
2648
2781
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
2649
|
-
return /* @__PURE__ */
|
|
2782
|
+
return /* @__PURE__ */ React22.createElement(
|
|
2650
2783
|
SelectPrimitive.Separator,
|
|
2651
2784
|
__spreadValues({
|
|
2652
2785
|
ref,
|
|
@@ -2691,6 +2824,7 @@ SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
|
2691
2824
|
DropdownMenuSubContent,
|
|
2692
2825
|
DropdownMenuSubTrigger,
|
|
2693
2826
|
DropdownMenuTrigger,
|
|
2827
|
+
ExpandableRow,
|
|
2694
2828
|
FilterMenu,
|
|
2695
2829
|
Input,
|
|
2696
2830
|
Pagination,
|