luxtable 0.3.4 → 0.3.6
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/EXAMPLE.md +348 -348
- package/README.md +178 -40
- package/USAGE.md +823 -631
- package/dist/index.d.mts +156 -23
- package/dist/index.d.ts +156 -23
- package/dist/index.js +1608 -729
- package/dist/index.mjs +1528 -652
- package/package.json +5 -2
- package/src/styles/README.md +141 -0
- package/src/styles/variables.css +283 -0
package/dist/index.js
CHANGED
|
@@ -89,19 +89,22 @@ __export(index_exports, {
|
|
|
89
89
|
createColumnHelper: () => createColumnHelper,
|
|
90
90
|
createColumnsFromData: () => createColumnsFromData,
|
|
91
91
|
createCopyableCell: () => createCopyableCell,
|
|
92
|
+
defaultGlobalCellConfig: () => defaultGlobalCellConfig,
|
|
92
93
|
defaultStatusColors: () => defaultStatusColors,
|
|
93
|
-
flexRender: () =>
|
|
94
|
-
getCoreRowModel: () =>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
flexRender: () => import_react_table4.flexRender,
|
|
95
|
+
getCoreRowModel: () => import_react_table4.getCoreRowModel,
|
|
96
|
+
getFieldConfig: () => getFieldConfig,
|
|
97
|
+
getFilteredRowModel: () => import_react_table4.getFilteredRowModel,
|
|
98
|
+
getPaginationRowModel: () => import_react_table4.getPaginationRowModel,
|
|
99
|
+
getSortedRowModel: () => import_react_table4.getSortedRowModel,
|
|
100
|
+
renderCell: () => renderCell
|
|
98
101
|
});
|
|
99
102
|
module.exports = __toCommonJS(index_exports);
|
|
100
103
|
|
|
101
104
|
// src/components/lux-table/lux-table.tsx
|
|
102
|
-
var
|
|
103
|
-
var
|
|
104
|
-
var
|
|
105
|
+
var React10 = __toESM(require("react"));
|
|
106
|
+
var import_react_table3 = require("@tanstack/react-table");
|
|
107
|
+
var import_lucide_react11 = require("lucide-react");
|
|
105
108
|
|
|
106
109
|
// src/lib/utils.ts
|
|
107
110
|
var import_clsx = require("clsx");
|
|
@@ -126,7 +129,7 @@ var TableHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
126
129
|
"thead",
|
|
127
130
|
{
|
|
128
131
|
ref,
|
|
129
|
-
className: cn("[&_tr]:border-b [&_tr]:border-
|
|
132
|
+
className: cn("[&_tr]:border-b [&_tr]:border-[hsl(var(--lux-table-header-border))]", className),
|
|
130
133
|
...props
|
|
131
134
|
}
|
|
132
135
|
));
|
|
@@ -145,7 +148,7 @@ var TableFooter = React.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
145
148
|
{
|
|
146
149
|
ref,
|
|
147
150
|
className: cn(
|
|
148
|
-
"border-t border-
|
|
151
|
+
"border-t border-[hsl(var(--lux-table-footer-border))] bg-[hsl(var(--lux-table-footer-background))] text-[hsl(var(--lux-table-footer-foreground))] font-medium [&>tr]:last:border-b-0",
|
|
149
152
|
className
|
|
150
153
|
),
|
|
151
154
|
...props
|
|
@@ -157,9 +160,9 @@ var TableRow = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
157
160
|
{
|
|
158
161
|
ref,
|
|
159
162
|
className: cn(
|
|
160
|
-
"border-b border-
|
|
161
|
-
"hover:bg-
|
|
162
|
-
"data-[state=selected]:bg-
|
|
163
|
+
"border-b border-[hsl(var(--lux-table-row-border))] transition-colors",
|
|
164
|
+
"hover:bg-[hsl(var(--lux-table-row-hover))]",
|
|
165
|
+
"data-[state=selected]:bg-[hsl(var(--lux-table-row-selected))]",
|
|
163
166
|
className
|
|
164
167
|
),
|
|
165
168
|
...props
|
|
@@ -172,7 +175,7 @@ var TableHead = React.forwardRef(({ className, children, ...props }, ref) => {
|
|
|
172
175
|
{
|
|
173
176
|
ref,
|
|
174
177
|
className: cn(
|
|
175
|
-
"h-10 px-4 text-left align-middle font-medium text-
|
|
178
|
+
"h-10 px-4 text-left align-middle font-medium text-[hsl(var(--lux-table-header-foreground))]",
|
|
176
179
|
"[&:has([role=checkbox])]:pr-0",
|
|
177
180
|
"group",
|
|
178
181
|
// Enable group-hover for action buttons
|
|
@@ -189,9 +192,15 @@ var TableCell = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
189
192
|
{
|
|
190
193
|
ref,
|
|
191
194
|
className: cn(
|
|
192
|
-
"p-4 align-middle [&:has([role=checkbox])]:pr-0",
|
|
195
|
+
"p-4 align-middle text-[hsl(var(--lux-table-cell-foreground))] [&:has([role=checkbox])]:pr-0",
|
|
196
|
+
"[&>*]:text-[hsl(var(--lux-table-cell-foreground))]",
|
|
197
|
+
"[&_*]:text-[hsl(var(--lux-table-cell-foreground))]",
|
|
193
198
|
className
|
|
194
199
|
),
|
|
200
|
+
style: {
|
|
201
|
+
color: "hsl(var(--lux-table-cell-foreground))",
|
|
202
|
+
...props.style
|
|
203
|
+
},
|
|
195
204
|
...props
|
|
196
205
|
}
|
|
197
206
|
));
|
|
@@ -200,7 +209,7 @@ var TableCaption = React.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
200
209
|
"caption",
|
|
201
210
|
{
|
|
202
211
|
ref,
|
|
203
|
-
className: cn("mt-4 text-sm text-
|
|
212
|
+
className: cn("mt-4 text-sm text-[hsl(var(--lux-table-cell-muted))]", className),
|
|
204
213
|
...props
|
|
205
214
|
}
|
|
206
215
|
));
|
|
@@ -211,16 +220,16 @@ var import_lucide_react = require("lucide-react");
|
|
|
211
220
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
212
221
|
function SortIcon({ direction }) {
|
|
213
222
|
if (!direction) {
|
|
214
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.ChevronsUpDown, { className: "h-4 w-4 text-slate-400 dark:text-slate-
|
|
223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.ChevronsUpDown, { className: "h-4 w-4 text-slate-400/60 dark:text-slate-600" });
|
|
215
224
|
}
|
|
216
225
|
if (direction === "asc") {
|
|
217
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex items-center justify-center rounded bg-
|
|
226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex items-center justify-center rounded-md bg-gradient-to-br from-emerald-500/15 to-teal-500/15 dark:from-emerald-400/20 dark:to-teal-400/20 p-0.5 ring-1 ring-emerald-500/20 dark:ring-emerald-400/25", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.ChevronUp, { className: "h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400", strokeWidth: 2.5 }) });
|
|
218
227
|
}
|
|
219
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex items-center justify-center rounded bg-
|
|
228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex items-center justify-center rounded-md bg-gradient-to-br from-emerald-500/15 to-teal-500/15 dark:from-emerald-400/20 dark:to-teal-400/20 p-0.5 ring-1 ring-emerald-500/20 dark:ring-emerald-400/25", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.ChevronDown, { className: "h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400", strokeWidth: 2.5 }) });
|
|
220
229
|
}
|
|
221
230
|
|
|
222
231
|
// src/components/lux-table/column-filter.tsx
|
|
223
|
-
var
|
|
232
|
+
var React6 = __toESM(require("react"));
|
|
224
233
|
|
|
225
234
|
// src/components/ui/input.tsx
|
|
226
235
|
var React2 = __toESM(require("react"));
|
|
@@ -231,7 +240,7 @@ var Input = React2.forwardRef(({ className, type, ...props }, ref) => {
|
|
|
231
240
|
{
|
|
232
241
|
type,
|
|
233
242
|
className: cn(
|
|
234
|
-
"flex h-9 w-full rounded-md border border-
|
|
243
|
+
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
235
244
|
className
|
|
236
245
|
),
|
|
237
246
|
ref,
|
|
@@ -254,7 +263,7 @@ var SelectTrigger = React3.forwardRef(({ className, children, ...props }, ref) =
|
|
|
254
263
|
{
|
|
255
264
|
ref,
|
|
256
265
|
className: cn(
|
|
257
|
-
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-
|
|
266
|
+
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
258
267
|
className
|
|
259
268
|
),
|
|
260
269
|
...props,
|
|
@@ -296,7 +305,7 @@ var SelectContent = React3.forwardRef(({ className, children, position = "popper
|
|
|
296
305
|
{
|
|
297
306
|
ref,
|
|
298
307
|
className: cn(
|
|
299
|
-
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-
|
|
308
|
+
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md 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-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
300
309
|
position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
301
310
|
className
|
|
302
311
|
),
|
|
@@ -333,7 +342,7 @@ var SelectItem = React3.forwardRef(({ className, children, ...props }, ref) => /
|
|
|
333
342
|
{
|
|
334
343
|
ref,
|
|
335
344
|
className: cn(
|
|
336
|
-
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-
|
|
345
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
337
346
|
className
|
|
338
347
|
),
|
|
339
348
|
...props,
|
|
@@ -348,19 +357,352 @@ var SelectSeparator = React3.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
348
357
|
SelectPrimitive.Separator,
|
|
349
358
|
{
|
|
350
359
|
ref,
|
|
351
|
-
className: cn("-mx-1 my-1 h-px bg-
|
|
360
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
352
361
|
...props
|
|
353
362
|
}
|
|
354
363
|
));
|
|
355
364
|
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
356
365
|
|
|
366
|
+
// src/components/ui/slider.tsx
|
|
367
|
+
var React4 = __toESM(require("react"));
|
|
368
|
+
var import_jsx_runtime5 = (
|
|
369
|
+
// Range slider
|
|
370
|
+
require("react/jsx-runtime")
|
|
371
|
+
);
|
|
372
|
+
var Slider = React4.forwardRef(
|
|
373
|
+
({ className, value = [0, 100], onValueChange, min = 0, max = 100, step = 1, ...props }, ref) => {
|
|
374
|
+
const [localValue, setLocalValue] = React4.useState(value);
|
|
375
|
+
React4.useEffect(() => {
|
|
376
|
+
setLocalValue(value);
|
|
377
|
+
}, [value]);
|
|
378
|
+
const handleChange = (index, newValue) => {
|
|
379
|
+
const newValues = [...localValue];
|
|
380
|
+
newValues[index] = Math.max(min, Math.min(max, newValue));
|
|
381
|
+
if (newValues.length === 2) {
|
|
382
|
+
if (index === 0 && newValues[0] > newValues[1]) {
|
|
383
|
+
newValues[0] = newValues[1];
|
|
384
|
+
} else if (index === 1 && newValues[1] < newValues[0]) {
|
|
385
|
+
newValues[1] = newValues[0];
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
setLocalValue(newValues);
|
|
389
|
+
onValueChange?.(newValues);
|
|
390
|
+
};
|
|
391
|
+
const percentage = (val) => (val - min) / (max - min) * 100;
|
|
392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: cn("relative flex w-full items-center", className), children: localValue.length === 2 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative w-full", children: [
|
|
393
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
394
|
+
"input",
|
|
395
|
+
{
|
|
396
|
+
ref,
|
|
397
|
+
type: "range",
|
|
398
|
+
min,
|
|
399
|
+
max,
|
|
400
|
+
step,
|
|
401
|
+
value: localValue[0],
|
|
402
|
+
onChange: (e) => handleChange(0, Number(e.target.value)),
|
|
403
|
+
className: "absolute h-2 w-full appearance-none bg-transparent pointer-events-none z-10 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:h-5 [&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[hsl(var(--lux-focus-ring))] [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-[hsl(var(--lux-filter-background))] [&::-webkit-slider-thumb]:cursor-pointer [&::-webkit-slider-thumb]:pointer-events-auto [&::-moz-range-thumb]:h-5 [&::-moz-range-thumb]:w-5 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:bg-[hsl(var(--lux-focus-ring))] [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-[hsl(var(--lux-filter-background))] [&::-moz-range-thumb]:cursor-pointer [&::-moz-range-thumb]:pointer-events-auto",
|
|
404
|
+
style: { zIndex: localValue[0] > localValue[1] ? 20 : 10 },
|
|
405
|
+
...props
|
|
406
|
+
}
|
|
407
|
+
),
|
|
408
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
409
|
+
"input",
|
|
410
|
+
{
|
|
411
|
+
type: "range",
|
|
412
|
+
min,
|
|
413
|
+
max,
|
|
414
|
+
step,
|
|
415
|
+
value: localValue[1],
|
|
416
|
+
onChange: (e) => handleChange(1, Number(e.target.value)),
|
|
417
|
+
className: "absolute h-2 w-full appearance-none bg-transparent pointer-events-none z-10 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:h-5 [&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[hsl(var(--lux-focus-ring))] [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-[hsl(var(--lux-filter-background))] [&::-webkit-slider-thumb]:cursor-pointer [&::-webkit-slider-thumb]:pointer-events-auto [&::-moz-range-thumb]:h-5 [&::-moz-range-thumb]:w-5 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:bg-[hsl(var(--lux-focus-ring))] [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-[hsl(var(--lux-filter-background))] [&::-moz-range-thumb]:cursor-pointer [&::-moz-range-thumb]:pointer-events-auto",
|
|
418
|
+
style: { zIndex: localValue[1] > localValue[0] ? 20 : 10 }
|
|
419
|
+
}
|
|
420
|
+
),
|
|
421
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "absolute h-2 w-full rounded-full bg-[hsl(var(--lux-filter-border))]" }),
|
|
422
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
423
|
+
"div",
|
|
424
|
+
{
|
|
425
|
+
className: "absolute h-2 rounded-full bg-[hsl(var(--lux-focus-ring))]",
|
|
426
|
+
style: {
|
|
427
|
+
left: `${percentage(Math.min(localValue[0], localValue[1]))}%`,
|
|
428
|
+
width: `${percentage(Math.max(localValue[0], localValue[1])) - percentage(Math.min(localValue[0], localValue[1]))}%`
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
)
|
|
432
|
+
] }) : (
|
|
433
|
+
// Single value slider
|
|
434
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative w-full", children: [
|
|
435
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
436
|
+
"input",
|
|
437
|
+
{
|
|
438
|
+
ref,
|
|
439
|
+
type: "range",
|
|
440
|
+
min,
|
|
441
|
+
max,
|
|
442
|
+
step,
|
|
443
|
+
value: localValue[0],
|
|
444
|
+
onChange: (e) => handleChange(0, Number(e.target.value)),
|
|
445
|
+
className: "h-2 w-full appearance-none rounded-full bg-[hsl(var(--lux-filter-border))] [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:h-5 [&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[hsl(var(--lux-focus-ring))] [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-[hsl(var(--lux-filter-background))] [&::-webkit-slider-thumb]:cursor-pointer [&::-moz-range-thumb]:h-5 [&::-moz-range-thumb]:w-5 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:bg-[hsl(var(--lux-focus-ring))] [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-[hsl(var(--lux-filter-background))] [&::-moz-range-thumb]:cursor-pointer",
|
|
446
|
+
...props
|
|
447
|
+
}
|
|
448
|
+
),
|
|
449
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
450
|
+
"div",
|
|
451
|
+
{
|
|
452
|
+
className: "absolute top-0 h-2 rounded-full bg-[hsl(var(--lux-focus-ring))] pointer-events-none",
|
|
453
|
+
style: { width: `${percentage(localValue[0])}%` }
|
|
454
|
+
}
|
|
455
|
+
)
|
|
456
|
+
] })
|
|
457
|
+
) });
|
|
458
|
+
}
|
|
459
|
+
);
|
|
460
|
+
Slider.displayName = "Slider";
|
|
461
|
+
|
|
462
|
+
// src/components/ui/popover.tsx
|
|
463
|
+
var React5 = __toESM(require("react"));
|
|
464
|
+
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
|
|
465
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
466
|
+
var Popover = PopoverPrimitive.Root;
|
|
467
|
+
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
468
|
+
var PopoverAnchor = PopoverPrimitive.Anchor;
|
|
469
|
+
var PopoverContent = React5.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopoverPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
470
|
+
PopoverPrimitive.Content,
|
|
471
|
+
{
|
|
472
|
+
ref,
|
|
473
|
+
align,
|
|
474
|
+
sideOffset,
|
|
475
|
+
className: cn(
|
|
476
|
+
"z-50 w-72 rounded-md border border-border bg-popover p-4 text-popover-foreground shadow-md 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-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
477
|
+
className
|
|
478
|
+
),
|
|
479
|
+
...props
|
|
480
|
+
}
|
|
481
|
+
) }));
|
|
482
|
+
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
483
|
+
|
|
484
|
+
// src/components/ui/button.tsx
|
|
485
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
486
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
487
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
488
|
+
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
489
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
490
|
+
{
|
|
491
|
+
variants: {
|
|
492
|
+
variant: {
|
|
493
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
494
|
+
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
495
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
496
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
497
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
498
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
499
|
+
},
|
|
500
|
+
size: {
|
|
501
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
502
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
503
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
504
|
+
icon: "size-9",
|
|
505
|
+
"icon-sm": "size-8",
|
|
506
|
+
"icon-lg": "size-10"
|
|
507
|
+
}
|
|
508
|
+
},
|
|
509
|
+
defaultVariants: {
|
|
510
|
+
variant: "default",
|
|
511
|
+
size: "default"
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
);
|
|
515
|
+
function Button({
|
|
516
|
+
className,
|
|
517
|
+
variant = "default",
|
|
518
|
+
size = "default",
|
|
519
|
+
asChild = false,
|
|
520
|
+
...props
|
|
521
|
+
}) {
|
|
522
|
+
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
524
|
+
Comp,
|
|
525
|
+
{
|
|
526
|
+
"data-slot": "button",
|
|
527
|
+
"data-variant": variant,
|
|
528
|
+
"data-size": size,
|
|
529
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
530
|
+
...props
|
|
531
|
+
}
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
// src/components/ui/calendar.tsx
|
|
536
|
+
var import_lucide_react3 = require("lucide-react");
|
|
537
|
+
var import_react_day_picker = require("react-day-picker");
|
|
538
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
539
|
+
function Calendar({
|
|
540
|
+
className,
|
|
541
|
+
classNames,
|
|
542
|
+
showOutsideDays = true,
|
|
543
|
+
...props
|
|
544
|
+
}) {
|
|
545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
546
|
+
import_react_day_picker.DayPicker,
|
|
547
|
+
{
|
|
548
|
+
showOutsideDays,
|
|
549
|
+
className: cn("p-3", className),
|
|
550
|
+
classNames: {
|
|
551
|
+
months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
|
|
552
|
+
month: "space-y-4",
|
|
553
|
+
caption: "flex justify-center pt-1 relative items-center",
|
|
554
|
+
caption_label: "text-sm font-medium",
|
|
555
|
+
nav: "space-x-1 flex items-center",
|
|
556
|
+
nav_button: cn(
|
|
557
|
+
"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100",
|
|
558
|
+
"border border-[hsl(var(--lux-filter-border))] rounded-md",
|
|
559
|
+
"hover:bg-[hsl(var(--lux-table-row-hover))]",
|
|
560
|
+
"inline-flex items-center justify-center"
|
|
561
|
+
),
|
|
562
|
+
nav_button_previous: "absolute left-1",
|
|
563
|
+
nav_button_next: "absolute right-1",
|
|
564
|
+
table: "w-full border-collapse space-y-1",
|
|
565
|
+
head_row: "flex",
|
|
566
|
+
head_cell: "text-[hsl(var(--lux-toolbar-icon))] rounded-md w-9 font-normal text-[0.8rem]",
|
|
567
|
+
row: "flex w-full mt-2",
|
|
568
|
+
cell: "h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-[hsl(var(--lux-table-row-hover))]/50 [&:has([aria-selected])]:bg-[hsl(var(--lux-focus-ring))]/10 first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",
|
|
569
|
+
day: cn(
|
|
570
|
+
"h-9 w-9 p-0 font-normal aria-selected:opacity-100",
|
|
571
|
+
"rounded-md hover:bg-[hsl(var(--lux-table-row-hover))]",
|
|
572
|
+
"inline-flex items-center justify-center"
|
|
573
|
+
),
|
|
574
|
+
day_range_end: "day-range-end",
|
|
575
|
+
day_selected: "bg-[hsl(var(--lux-focus-ring))] text-[hsl(var(--lux-filter-background))] hover:bg-[hsl(var(--lux-focus-ring))] hover:text-[hsl(var(--lux-filter-background))] focus:bg-[hsl(var(--lux-focus-ring))] focus:text-[hsl(var(--lux-filter-background))]",
|
|
576
|
+
day_today: "bg-[hsl(var(--lux-filter-border))] text-[hsl(var(--lux-filter-foreground))]",
|
|
577
|
+
day_outside: "day-outside text-[hsl(var(--lux-toolbar-icon))] opacity-50 aria-selected:bg-[hsl(var(--lux-table-row-hover))]/50 aria-selected:text-[hsl(var(--lux-toolbar-icon))] aria-selected:opacity-30",
|
|
578
|
+
day_disabled: "text-[hsl(var(--lux-toolbar-icon))] opacity-50",
|
|
579
|
+
day_range_middle: "aria-selected:bg-[hsl(var(--lux-focus-ring))]/20 aria-selected:text-[hsl(var(--lux-filter-foreground))]",
|
|
580
|
+
day_hidden: "invisible",
|
|
581
|
+
...classNames
|
|
582
|
+
},
|
|
583
|
+
components: {
|
|
584
|
+
IconLeft: ({ ...props2 }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.ChevronLeft, { className: "h-4 w-4" }),
|
|
585
|
+
IconRight: ({ ...props2 }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.ChevronRight, { className: "h-4 w-4" })
|
|
586
|
+
},
|
|
587
|
+
...props
|
|
588
|
+
}
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
Calendar.displayName = "Calendar";
|
|
592
|
+
|
|
593
|
+
// src/components/lux-table/column-filter.tsx
|
|
594
|
+
var import_lucide_react4 = require("lucide-react");
|
|
595
|
+
|
|
596
|
+
// src/components/cell-renderers/status-cell.tsx
|
|
597
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
598
|
+
var createStatusColor = (bg, text, darkBg, darkText) => ({
|
|
599
|
+
bg,
|
|
600
|
+
text,
|
|
601
|
+
darkBg,
|
|
602
|
+
darkText
|
|
603
|
+
});
|
|
604
|
+
var statusColorMap = {
|
|
605
|
+
active: createStatusColor(
|
|
606
|
+
"bg-[hsl(var(--lux-status-active-bg))]",
|
|
607
|
+
"text-[hsl(var(--lux-status-active-text))]",
|
|
608
|
+
"",
|
|
609
|
+
""
|
|
610
|
+
),
|
|
611
|
+
inactive: createStatusColor(
|
|
612
|
+
"bg-[hsl(var(--lux-status-inactive-bg))]",
|
|
613
|
+
"text-[hsl(var(--lux-status-inactive-text))]",
|
|
614
|
+
"",
|
|
615
|
+
""
|
|
616
|
+
),
|
|
617
|
+
pending: createStatusColor(
|
|
618
|
+
"bg-[hsl(var(--lux-status-pending-bg))]",
|
|
619
|
+
"text-[hsl(var(--lux-status-pending-text))]",
|
|
620
|
+
"",
|
|
621
|
+
""
|
|
622
|
+
),
|
|
623
|
+
completed: createStatusColor(
|
|
624
|
+
"bg-[hsl(var(--lux-status-completed-bg))]",
|
|
625
|
+
"text-[hsl(var(--lux-status-completed-text))]",
|
|
626
|
+
"",
|
|
627
|
+
""
|
|
628
|
+
),
|
|
629
|
+
cancelled: createStatusColor(
|
|
630
|
+
"bg-[hsl(var(--lux-status-cancelled-bg))]",
|
|
631
|
+
"text-[hsl(var(--lux-status-cancelled-text))]",
|
|
632
|
+
"",
|
|
633
|
+
""
|
|
634
|
+
)
|
|
635
|
+
};
|
|
636
|
+
var defaultStatusColors = {
|
|
637
|
+
// Lowercase versions
|
|
638
|
+
...statusColorMap,
|
|
639
|
+
// Capitalized versions
|
|
640
|
+
Active: statusColorMap.active,
|
|
641
|
+
Inactive: statusColorMap.inactive,
|
|
642
|
+
Pending: statusColorMap.pending,
|
|
643
|
+
Completed: statusColorMap.completed,
|
|
644
|
+
Cancelled: statusColorMap.cancelled
|
|
645
|
+
};
|
|
646
|
+
function StatusCell({ value, colors, className }) {
|
|
647
|
+
const mergedColors = { ...defaultStatusColors, ...colors };
|
|
648
|
+
const normalizedValue = value.toLowerCase();
|
|
649
|
+
const capitalizedValue = value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();
|
|
650
|
+
const colorConfig = mergedColors[normalizedValue] || mergedColors[value] || mergedColors[capitalizedValue];
|
|
651
|
+
const displayValue = capitalizedValue;
|
|
652
|
+
if (!colorConfig) {
|
|
653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: `px-2 py-1 rounded-full text-xs font-medium bg-[hsl(var(--lux-status-default-bg))] text-[hsl(var(--lux-status-default-text))] ${className || ""}`, children: displayValue });
|
|
654
|
+
}
|
|
655
|
+
const { bg, text } = colorConfig;
|
|
656
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: `px-2 py-1 rounded-full text-xs font-medium ${bg} ${text} ${className || ""}`, children: displayValue });
|
|
657
|
+
}
|
|
658
|
+
|
|
357
659
|
// src/components/lux-table/column-filter.tsx
|
|
358
|
-
var
|
|
359
|
-
|
|
660
|
+
var import_date_fns = require("date-fns");
|
|
661
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
662
|
+
function detectFilterType(column, data) {
|
|
663
|
+
const meta = column.columnDef.meta;
|
|
664
|
+
if (meta?.filterVariant) {
|
|
665
|
+
return meta.filterVariant;
|
|
666
|
+
}
|
|
667
|
+
const columnId = column.id.toLowerCase();
|
|
668
|
+
const accessorKey = "accessorKey" in column.columnDef ? String(column.columnDef.accessorKey || "").toLowerCase() : "";
|
|
669
|
+
const datePatterns = ["date", "createdat", "updatedat", "joindate", "startdate", "enddate", "birthdate", "publishedat"];
|
|
670
|
+
if (datePatterns.some((pattern) => columnId.includes(pattern) || accessorKey.includes(pattern))) {
|
|
671
|
+
return "date";
|
|
672
|
+
}
|
|
673
|
+
const statusPatterns = ["status", "state", "stage", "phase"];
|
|
674
|
+
if (statusPatterns.some((pattern) => columnId.includes(pattern) || accessorKey.includes(pattern))) {
|
|
675
|
+
return "status";
|
|
676
|
+
}
|
|
677
|
+
const numericPatterns = ["salary", "price", "amount", "cost", "revenue", "total", "balance", "fee"];
|
|
678
|
+
if (numericPatterns.some((pattern) => columnId.includes(pattern) || accessorKey.includes(pattern))) {
|
|
679
|
+
return "slider";
|
|
680
|
+
}
|
|
681
|
+
if (data && data.length > 0) {
|
|
682
|
+
const firstValue = column.getFacetedUniqueValues().keys().next().value;
|
|
683
|
+
if (firstValue !== void 0) {
|
|
684
|
+
if (typeof firstValue === "string" && /^\d{4}-\d{2}-\d{2}/.test(firstValue)) {
|
|
685
|
+
const date = new Date(firstValue);
|
|
686
|
+
if (!isNaN(date.getTime())) {
|
|
687
|
+
return "date";
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
if (typeof firstValue === "number") {
|
|
691
|
+
return "slider";
|
|
692
|
+
}
|
|
693
|
+
const statusValues = ["active", "inactive", "pending", "completed", "cancelled", "approved", "rejected"];
|
|
694
|
+
if (typeof firstValue === "string" && statusValues.includes(firstValue.toLowerCase())) {
|
|
695
|
+
return "status";
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
return "text";
|
|
700
|
+
}
|
|
701
|
+
function ColumnFilter({ column, data }) {
|
|
360
702
|
const columnFilterValue = column.getFilterValue();
|
|
361
|
-
const filterVariant = column
|
|
362
|
-
const sortedUniqueValues =
|
|
363
|
-
if (filterVariant !== "select") return [];
|
|
703
|
+
const filterVariant = detectFilterType(column, data);
|
|
704
|
+
const sortedUniqueValues = React6.useMemo(() => {
|
|
705
|
+
if (filterVariant !== "select" && filterVariant !== "status") return [];
|
|
364
706
|
const values = /* @__PURE__ */ new Set();
|
|
365
707
|
column.getFacetedUniqueValues().forEach((_, key) => {
|
|
366
708
|
if (key !== null && key !== void 0) {
|
|
@@ -369,35 +711,322 @@ function ColumnFilter({ column }) {
|
|
|
369
711
|
});
|
|
370
712
|
return Array.from(values).sort();
|
|
371
713
|
}, [column, filterVariant]);
|
|
714
|
+
if (filterVariant === "date") {
|
|
715
|
+
const dateRange = columnFilterValue || {};
|
|
716
|
+
const [fromDate, setFromDate] = React6.useState(
|
|
717
|
+
dateRange.from ? new Date(dateRange.from) : void 0
|
|
718
|
+
);
|
|
719
|
+
const [toDate, setToDate] = React6.useState(
|
|
720
|
+
dateRange.to ? new Date(dateRange.to) : void 0
|
|
721
|
+
);
|
|
722
|
+
const [fromOpen, setFromOpen] = React6.useState(false);
|
|
723
|
+
const [toOpen, setToOpen] = React6.useState(false);
|
|
724
|
+
React6.useEffect(() => {
|
|
725
|
+
if (columnFilterValue) {
|
|
726
|
+
const range = columnFilterValue;
|
|
727
|
+
setFromDate(range.from ? new Date(range.from) : void 0);
|
|
728
|
+
setToDate(range.to ? new Date(range.to) : void 0);
|
|
729
|
+
} else {
|
|
730
|
+
setFromDate(void 0);
|
|
731
|
+
setToDate(void 0);
|
|
732
|
+
}
|
|
733
|
+
}, [columnFilterValue]);
|
|
734
|
+
const handleFromDateChange = (date) => {
|
|
735
|
+
setFromDate(date);
|
|
736
|
+
const newRange = {
|
|
737
|
+
from: date ? (0, import_date_fns.format)(date, "yyyy-MM-dd") : void 0,
|
|
738
|
+
to: toDate ? (0, import_date_fns.format)(toDate, "yyyy-MM-dd") : void 0
|
|
739
|
+
};
|
|
740
|
+
column.setFilterValue(
|
|
741
|
+
newRange.from || newRange.to ? newRange : void 0
|
|
742
|
+
);
|
|
743
|
+
};
|
|
744
|
+
const handleToDateChange = (date) => {
|
|
745
|
+
setToDate(date);
|
|
746
|
+
const newRange = {
|
|
747
|
+
from: fromDate ? (0, import_date_fns.format)(fromDate, "yyyy-MM-dd") : void 0,
|
|
748
|
+
to: date ? (0, import_date_fns.format)(date, "yyyy-MM-dd") : void 0
|
|
749
|
+
};
|
|
750
|
+
column.setFilterValue(
|
|
751
|
+
newRange.from || newRange.to ? newRange : void 0
|
|
752
|
+
);
|
|
753
|
+
};
|
|
754
|
+
const clearDates = () => {
|
|
755
|
+
setFromDate(void 0);
|
|
756
|
+
setToDate(void 0);
|
|
757
|
+
column.setFilterValue(void 0);
|
|
758
|
+
};
|
|
759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex gap-1 items-center", onClick: (e) => e.stopPropagation(), children: [
|
|
760
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Popover, { open: fromOpen, onOpenChange: setFromOpen, children: [
|
|
761
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
762
|
+
Button,
|
|
763
|
+
{
|
|
764
|
+
variant: "outline",
|
|
765
|
+
size: "sm",
|
|
766
|
+
className: cn(
|
|
767
|
+
"h-8 text-xs w-32 justify-start text-left font-normal",
|
|
768
|
+
!fromDate && "text-[hsl(var(--lux-toolbar-input-placeholder))]",
|
|
769
|
+
"border-[hsl(var(--lux-filter-border))]",
|
|
770
|
+
"bg-[hsl(var(--lux-filter-background))]",
|
|
771
|
+
"text-[hsl(var(--lux-filter-foreground))]"
|
|
772
|
+
),
|
|
773
|
+
children: [
|
|
774
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CalendarIcon, { className: "mr-2 h-3 w-3" }),
|
|
775
|
+
fromDate ? (0, import_date_fns.format)(fromDate, "MMM dd, yyyy") : "From"
|
|
776
|
+
]
|
|
777
|
+
}
|
|
778
|
+
) }),
|
|
779
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
780
|
+
Calendar,
|
|
781
|
+
{
|
|
782
|
+
mode: "single",
|
|
783
|
+
selected: fromDate,
|
|
784
|
+
onSelect: handleFromDateChange,
|
|
785
|
+
initialFocus: true
|
|
786
|
+
}
|
|
787
|
+
) })
|
|
788
|
+
] }),
|
|
789
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-xs text-[hsl(var(--lux-toolbar-icon))]", children: "-" }),
|
|
790
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Popover, { open: toOpen, onOpenChange: setToOpen, children: [
|
|
791
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
792
|
+
Button,
|
|
793
|
+
{
|
|
794
|
+
variant: "outline",
|
|
795
|
+
size: "sm",
|
|
796
|
+
className: cn(
|
|
797
|
+
"h-8 text-xs w-32 justify-start text-left font-normal",
|
|
798
|
+
!toDate && "text-[hsl(var(--lux-toolbar-input-placeholder))]",
|
|
799
|
+
"border-[hsl(var(--lux-filter-border))]",
|
|
800
|
+
"bg-[hsl(var(--lux-filter-background))]",
|
|
801
|
+
"text-[hsl(var(--lux-filter-foreground))]"
|
|
802
|
+
),
|
|
803
|
+
children: [
|
|
804
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.CalendarIcon, { className: "mr-2 h-3 w-3" }),
|
|
805
|
+
toDate ? (0, import_date_fns.format)(toDate, "MMM dd, yyyy") : "To"
|
|
806
|
+
]
|
|
807
|
+
}
|
|
808
|
+
) }),
|
|
809
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PopoverContent, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
810
|
+
Calendar,
|
|
811
|
+
{
|
|
812
|
+
mode: "single",
|
|
813
|
+
selected: toDate,
|
|
814
|
+
onSelect: handleToDateChange,
|
|
815
|
+
initialFocus: true
|
|
816
|
+
}
|
|
817
|
+
) })
|
|
818
|
+
] }),
|
|
819
|
+
(fromDate || toDate) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
820
|
+
Button,
|
|
821
|
+
{
|
|
822
|
+
variant: "ghost",
|
|
823
|
+
size: "sm",
|
|
824
|
+
onClick: clearDates,
|
|
825
|
+
className: "h-8 w-8 p-0",
|
|
826
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.X, { className: "h-3 w-3" })
|
|
827
|
+
}
|
|
828
|
+
)
|
|
829
|
+
] });
|
|
830
|
+
}
|
|
831
|
+
if (filterVariant === "slider") {
|
|
832
|
+
const numericValues = React6.useMemo(() => {
|
|
833
|
+
const values = [];
|
|
834
|
+
column.getFacetedUniqueValues().forEach((_, key) => {
|
|
835
|
+
if (typeof key === "number") {
|
|
836
|
+
values.push(key);
|
|
837
|
+
} else if (typeof key === "string") {
|
|
838
|
+
const num = parseFloat(key);
|
|
839
|
+
if (!isNaN(num)) {
|
|
840
|
+
values.push(num);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
});
|
|
844
|
+
return values;
|
|
845
|
+
}, [column]);
|
|
846
|
+
const min = numericValues.length > 0 ? Math.min(...numericValues) : 0;
|
|
847
|
+
const max = numericValues.length > 0 ? Math.max(...numericValues) : 100;
|
|
848
|
+
const avg = numericValues.length > 0 ? (min + max) / 2 : 50;
|
|
849
|
+
const sliderValue = columnFilterValue || { min, max };
|
|
850
|
+
const [range, setRange] = React6.useState([
|
|
851
|
+
sliderValue.min ?? min,
|
|
852
|
+
sliderValue.max ?? max
|
|
853
|
+
]);
|
|
854
|
+
React6.useEffect(() => {
|
|
855
|
+
if (columnFilterValue) {
|
|
856
|
+
const val = columnFilterValue;
|
|
857
|
+
setRange([val.min ?? min, val.max ?? max]);
|
|
858
|
+
} else {
|
|
859
|
+
setRange([min, max]);
|
|
860
|
+
}
|
|
861
|
+
}, [columnFilterValue, min, max]);
|
|
862
|
+
const handleSliderChange = (newRange) => {
|
|
863
|
+
setRange(newRange);
|
|
864
|
+
column.setFilterValue({ min: newRange[0], max: newRange[1] });
|
|
865
|
+
};
|
|
866
|
+
const clearSlider = () => {
|
|
867
|
+
setRange([min, max]);
|
|
868
|
+
column.setFilterValue(void 0);
|
|
869
|
+
};
|
|
870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Popover, { children: [
|
|
871
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
872
|
+
Button,
|
|
873
|
+
{
|
|
874
|
+
variant: "outline",
|
|
875
|
+
size: "sm",
|
|
876
|
+
className: cn(
|
|
877
|
+
"h-8 text-xs w-full justify-start",
|
|
878
|
+
"border-[hsl(var(--lux-filter-border))]",
|
|
879
|
+
"bg-[hsl(var(--lux-filter-background))]",
|
|
880
|
+
"text-[hsl(var(--lux-filter-foreground))]"
|
|
881
|
+
),
|
|
882
|
+
onClick: (e) => e.stopPropagation(),
|
|
883
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: range[0] === min && range[1] === max ? "All" : `${Math.round(range[0])} - ${Math.round(range[1])}` })
|
|
884
|
+
}
|
|
885
|
+
) }),
|
|
886
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PopoverContent, { className: "w-64", align: "start", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-3", children: [
|
|
887
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between text-sm", children: [
|
|
888
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[hsl(var(--lux-filter-foreground))]", children: "Range" }),
|
|
889
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "text-[hsl(var(--lux-toolbar-icon))]", children: [
|
|
890
|
+
Math.round(range[0]),
|
|
891
|
+
" - ",
|
|
892
|
+
Math.round(range[1])
|
|
893
|
+
] })
|
|
894
|
+
] }),
|
|
895
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
896
|
+
Slider,
|
|
897
|
+
{
|
|
898
|
+
value: range,
|
|
899
|
+
onValueChange: handleSliderChange,
|
|
900
|
+
min,
|
|
901
|
+
max,
|
|
902
|
+
step: (max - min) / 100
|
|
903
|
+
}
|
|
904
|
+
),
|
|
905
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between text-xs text-[hsl(var(--lux-toolbar-icon))]", children: [
|
|
906
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
|
|
907
|
+
"Min: ",
|
|
908
|
+
Math.round(min)
|
|
909
|
+
] }),
|
|
910
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
|
|
911
|
+
"Avg: ",
|
|
912
|
+
Math.round(avg)
|
|
913
|
+
] }),
|
|
914
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
|
|
915
|
+
"Max: ",
|
|
916
|
+
Math.round(max)
|
|
917
|
+
] })
|
|
918
|
+
] }),
|
|
919
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
920
|
+
Button,
|
|
921
|
+
{
|
|
922
|
+
variant: "ghost",
|
|
923
|
+
size: "sm",
|
|
924
|
+
onClick: clearSlider,
|
|
925
|
+
className: "w-full h-7 text-xs",
|
|
926
|
+
children: "Clear"
|
|
927
|
+
}
|
|
928
|
+
)
|
|
929
|
+
] }) })
|
|
930
|
+
] });
|
|
931
|
+
}
|
|
932
|
+
if (filterVariant === "status") {
|
|
933
|
+
const selectedStatuses = columnFilterValue || [];
|
|
934
|
+
const [open, setOpen] = React6.useState(false);
|
|
935
|
+
const toggleStatus = (status) => {
|
|
936
|
+
const newSelection = selectedStatuses.includes(status) ? selectedStatuses.filter((s) => s !== status) : [...selectedStatuses, status];
|
|
937
|
+
column.setFilterValue(newSelection.length > 0 ? newSelection : void 0);
|
|
938
|
+
};
|
|
939
|
+
const clearStatuses = () => {
|
|
940
|
+
column.setFilterValue(void 0);
|
|
941
|
+
};
|
|
942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Popover, { open, onOpenChange: setOpen, children: [
|
|
943
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
944
|
+
Button,
|
|
945
|
+
{
|
|
946
|
+
variant: "outline",
|
|
947
|
+
size: "sm",
|
|
948
|
+
className: cn(
|
|
949
|
+
"h-8 text-xs w-full justify-start",
|
|
950
|
+
"border-[hsl(var(--lux-filter-border))]",
|
|
951
|
+
"bg-[hsl(var(--lux-filter-background))]",
|
|
952
|
+
"text-[hsl(var(--lux-filter-foreground))]"
|
|
953
|
+
),
|
|
954
|
+
onClick: (e) => {
|
|
955
|
+
e.stopPropagation();
|
|
956
|
+
setOpen(!open);
|
|
957
|
+
},
|
|
958
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: selectedStatuses.length === 0 ? "All Status" : `${selectedStatuses.length} selected` })
|
|
959
|
+
}
|
|
960
|
+
) }),
|
|
961
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PopoverContent, { className: "w-48", align: "start", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-2", children: [
|
|
962
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
963
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-sm font-medium text-[hsl(var(--lux-filter-foreground))]", children: "Status" }),
|
|
964
|
+
selectedStatuses.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
965
|
+
Button,
|
|
966
|
+
{
|
|
967
|
+
variant: "ghost",
|
|
968
|
+
size: "sm",
|
|
969
|
+
onClick: clearStatuses,
|
|
970
|
+
className: "h-6 text-xs",
|
|
971
|
+
children: "Clear"
|
|
972
|
+
}
|
|
973
|
+
)
|
|
974
|
+
] }),
|
|
975
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-1.5", children: sortedUniqueValues.map((status) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
976
|
+
"button",
|
|
977
|
+
{
|
|
978
|
+
onClick: () => toggleStatus(status),
|
|
979
|
+
className: cn(
|
|
980
|
+
"w-full flex items-center gap-2 p-2 rounded-md text-left text-xs transition-colors",
|
|
981
|
+
selectedStatuses.includes(status) ? "bg-[hsl(var(--lux-focus-ring))]/20" : "hover:bg-[hsl(var(--lux-table-row-hover))]"
|
|
982
|
+
),
|
|
983
|
+
children: [
|
|
984
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
985
|
+
"input",
|
|
986
|
+
{
|
|
987
|
+
type: "checkbox",
|
|
988
|
+
checked: selectedStatuses.includes(status),
|
|
989
|
+
onChange: () => toggleStatus(status),
|
|
990
|
+
className: "h-3 w-3"
|
|
991
|
+
}
|
|
992
|
+
),
|
|
993
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(StatusCell, { value: status })
|
|
994
|
+
]
|
|
995
|
+
},
|
|
996
|
+
status
|
|
997
|
+
)) })
|
|
998
|
+
] }) })
|
|
999
|
+
] });
|
|
1000
|
+
}
|
|
372
1001
|
if (filterVariant === "select") {
|
|
373
|
-
return /* @__PURE__ */ (0,
|
|
1002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
374
1003
|
Select,
|
|
375
1004
|
{
|
|
376
1005
|
value: columnFilterValue ?? "",
|
|
377
1006
|
onValueChange: (value) => column.setFilterValue(value === "__all__" ? void 0 : value),
|
|
378
1007
|
children: [
|
|
379
|
-
/* @__PURE__ */ (0,
|
|
1008
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
380
1009
|
SelectTrigger,
|
|
381
1010
|
{
|
|
382
1011
|
className: cn(
|
|
383
1012
|
"h-8 text-xs",
|
|
384
|
-
"border-
|
|
385
|
-
"bg-
|
|
386
|
-
"text-
|
|
1013
|
+
"border-[hsl(var(--lux-filter-border))]",
|
|
1014
|
+
"bg-[hsl(var(--lux-filter-background))]",
|
|
1015
|
+
"text-[hsl(var(--lux-filter-foreground))]"
|
|
387
1016
|
),
|
|
388
1017
|
onClick: (e) => e.stopPropagation(),
|
|
389
|
-
children: /* @__PURE__ */ (0,
|
|
1018
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SelectValue, { placeholder: "All" })
|
|
390
1019
|
}
|
|
391
1020
|
),
|
|
392
|
-
/* @__PURE__ */ (0,
|
|
393
|
-
/* @__PURE__ */ (0,
|
|
394
|
-
sortedUniqueValues.map((value) => /* @__PURE__ */ (0,
|
|
1021
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(SelectContent, { children: [
|
|
1022
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SelectItem, { value: "__all__", children: "All" }),
|
|
1023
|
+
sortedUniqueValues.map((value) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SelectItem, { value, children: value }, value))
|
|
395
1024
|
] })
|
|
396
1025
|
]
|
|
397
1026
|
}
|
|
398
1027
|
);
|
|
399
1028
|
}
|
|
400
|
-
return /* @__PURE__ */ (0,
|
|
1029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
401
1030
|
Input,
|
|
402
1031
|
{
|
|
403
1032
|
type: "text",
|
|
@@ -406,10 +1035,10 @@ function ColumnFilter({ column }) {
|
|
|
406
1035
|
placeholder: "Filter...",
|
|
407
1036
|
className: cn(
|
|
408
1037
|
"h-8 text-xs",
|
|
409
|
-
"border-
|
|
410
|
-
"bg-
|
|
411
|
-
"text-
|
|
412
|
-
"placeholder:text-
|
|
1038
|
+
"border-[hsl(var(--lux-filter-border))]",
|
|
1039
|
+
"bg-[hsl(var(--lux-filter-background))]",
|
|
1040
|
+
"text-[hsl(var(--lux-filter-foreground))]",
|
|
1041
|
+
"placeholder:text-[hsl(var(--lux-toolbar-input-placeholder))]"
|
|
413
1042
|
),
|
|
414
1043
|
onClick: (e) => e.stopPropagation()
|
|
415
1044
|
}
|
|
@@ -417,10 +1046,10 @@ function ColumnFilter({ column }) {
|
|
|
417
1046
|
}
|
|
418
1047
|
|
|
419
1048
|
// src/components/lux-table/pagination.tsx
|
|
420
|
-
var
|
|
421
|
-
var
|
|
1049
|
+
var import_lucide_react5 = require("lucide-react");
|
|
1050
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
422
1051
|
function PaginationButton({ onClick, disabled, title, children }) {
|
|
423
|
-
return /* @__PURE__ */ (0,
|
|
1052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
424
1053
|
"button",
|
|
425
1054
|
{
|
|
426
1055
|
className: cn(
|
|
@@ -428,6 +1057,7 @@ function PaginationButton({ onClick, disabled, title, children }) {
|
|
|
428
1057
|
"h-9 w-9",
|
|
429
1058
|
"border border-slate-200 dark:border-slate-800",
|
|
430
1059
|
"bg-white dark:bg-slate-950",
|
|
1060
|
+
"text-slate-900 dark:text-slate-100",
|
|
431
1061
|
"hover:bg-slate-100 dark:hover:bg-slate-800",
|
|
432
1062
|
"disabled:pointer-events-none disabled:opacity-50",
|
|
433
1063
|
"transition-colors"
|
|
@@ -440,7 +1070,7 @@ function PaginationButton({ onClick, disabled, title, children }) {
|
|
|
440
1070
|
);
|
|
441
1071
|
}
|
|
442
1072
|
function PageNumberButton({ pageNum, isActive, onClick }) {
|
|
443
|
-
return /* @__PURE__ */ (0,
|
|
1073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
444
1074
|
"button",
|
|
445
1075
|
{
|
|
446
1076
|
onClick,
|
|
@@ -448,7 +1078,7 @@ function PageNumberButton({ pageNum, isActive, onClick }) {
|
|
|
448
1078
|
"inline-flex items-center justify-center rounded-md text-sm font-medium",
|
|
449
1079
|
"h-9 w-9",
|
|
450
1080
|
"transition-colors",
|
|
451
|
-
isActive ? "bg-
|
|
1081
|
+
isActive ? "bg-slate-900 dark:bg-slate-100 text-white dark:text-slate-900 border border-slate-900 dark:border-slate-100" : "border border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-950 text-slate-900 dark:text-slate-100 hover:bg-slate-100 dark:hover:bg-slate-800"
|
|
452
1082
|
),
|
|
453
1083
|
children: pageNum + 1
|
|
454
1084
|
}
|
|
@@ -482,22 +1112,22 @@ function TablePagination({ table }) {
|
|
|
482
1112
|
}
|
|
483
1113
|
return pages;
|
|
484
1114
|
};
|
|
485
|
-
return /* @__PURE__ */ (0,
|
|
486
|
-
/* @__PURE__ */ (0,
|
|
487
|
-
/* @__PURE__ */ (0,
|
|
488
|
-
/* @__PURE__ */ (0,
|
|
1115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-col sm:flex-row items-center justify-between gap-4 px-2 py-3", children: [
|
|
1116
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
1117
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "text-sm text-[hsl(var(--lux-table-cell-muted))]", children: [
|
|
1118
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "font-medium text-[hsl(var(--lux-table-foreground))]", children: startRow }),
|
|
489
1119
|
"-",
|
|
490
|
-
/* @__PURE__ */ (0,
|
|
1120
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "font-medium text-[hsl(var(--lux-table-foreground))]", children: endRow }),
|
|
491
1121
|
" ",
|
|
492
1122
|
"of",
|
|
493
1123
|
" ",
|
|
494
|
-
/* @__PURE__ */ (0,
|
|
1124
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "font-medium text-[hsl(var(--lux-table-foreground))]", children: totalRows }),
|
|
495
1125
|
" ",
|
|
496
1126
|
"records shown"
|
|
497
1127
|
] }),
|
|
498
|
-
/* @__PURE__ */ (0,
|
|
499
|
-
/* @__PURE__ */ (0,
|
|
500
|
-
/* @__PURE__ */ (0,
|
|
1128
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1129
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-sm text-[hsl(var(--lux-table-cell-muted))]", children: "Rows per page:" }),
|
|
1130
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
501
1131
|
"select",
|
|
502
1132
|
{
|
|
503
1133
|
value: pageSize,
|
|
@@ -507,40 +1137,40 @@ function TablePagination({ table }) {
|
|
|
507
1137
|
className: cn(
|
|
508
1138
|
"h-9 rounded-md border border-slate-200 dark:border-slate-800",
|
|
509
1139
|
"bg-white dark:bg-slate-950",
|
|
510
|
-
"px-3 py-1 text-sm",
|
|
1140
|
+
"px-3 py-1 text-sm text-slate-900 dark:text-slate-100",
|
|
511
1141
|
"focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1",
|
|
512
1142
|
"cursor-pointer"
|
|
513
1143
|
),
|
|
514
|
-
children: [10, 20, 30, 50, 100].map((size) => /* @__PURE__ */ (0,
|
|
1144
|
+
children: [10, 20, 30, 50, 100].map((size) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: size, children: size }, size))
|
|
515
1145
|
}
|
|
516
1146
|
)
|
|
517
1147
|
] })
|
|
518
1148
|
] }),
|
|
519
|
-
/* @__PURE__ */ (0,
|
|
520
|
-
/* @__PURE__ */ (0,
|
|
1149
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1150
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
521
1151
|
PaginationButton,
|
|
522
1152
|
{
|
|
523
1153
|
onClick: () => table.setPageIndex(0),
|
|
524
1154
|
disabled: !table.getCanPreviousPage(),
|
|
525
1155
|
title: "First page",
|
|
526
|
-
children: /* @__PURE__ */ (0,
|
|
1156
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.ChevronsLeft, { className: "h-4 w-4" })
|
|
527
1157
|
}
|
|
528
1158
|
),
|
|
529
|
-
/* @__PURE__ */ (0,
|
|
1159
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
530
1160
|
PaginationButton,
|
|
531
1161
|
{
|
|
532
1162
|
onClick: () => table.previousPage(),
|
|
533
1163
|
disabled: !table.getCanPreviousPage(),
|
|
534
1164
|
title: "Previous page",
|
|
535
|
-
children: /* @__PURE__ */ (0,
|
|
1165
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.ChevronLeft, { className: "h-4 w-4" })
|
|
536
1166
|
}
|
|
537
1167
|
),
|
|
538
|
-
/* @__PURE__ */ (0,
|
|
1168
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex items-center gap-1", children: getPageNumbers().map((page, idx) => {
|
|
539
1169
|
if (page === "...") {
|
|
540
|
-
return /* @__PURE__ */ (0,
|
|
1170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "px-2 text-[hsl(var(--lux-table-cell-muted))]", children: "..." }, `ellipsis-${idx}`);
|
|
541
1171
|
}
|
|
542
1172
|
const pageNum = page;
|
|
543
|
-
return /* @__PURE__ */ (0,
|
|
1173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
544
1174
|
PageNumberButton,
|
|
545
1175
|
{
|
|
546
1176
|
pageNum,
|
|
@@ -550,22 +1180,22 @@ function TablePagination({ table }) {
|
|
|
550
1180
|
pageNum
|
|
551
1181
|
);
|
|
552
1182
|
}) }),
|
|
553
|
-
/* @__PURE__ */ (0,
|
|
1183
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
554
1184
|
PaginationButton,
|
|
555
1185
|
{
|
|
556
1186
|
onClick: () => table.nextPage(),
|
|
557
1187
|
disabled: !table.getCanNextPage(),
|
|
558
1188
|
title: "Next page",
|
|
559
|
-
children: /* @__PURE__ */ (0,
|
|
1189
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.ChevronRight, { className: "h-4 w-4" })
|
|
560
1190
|
}
|
|
561
1191
|
),
|
|
562
|
-
/* @__PURE__ */ (0,
|
|
1192
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
563
1193
|
PaginationButton,
|
|
564
1194
|
{
|
|
565
1195
|
onClick: () => table.setPageIndex(table.getPageCount() - 1),
|
|
566
1196
|
disabled: !table.getCanNextPage(),
|
|
567
1197
|
title: "Last page",
|
|
568
|
-
children: /* @__PURE__ */ (0,
|
|
1198
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react5.ChevronsRight, { className: "h-4 w-4" })
|
|
569
1199
|
}
|
|
570
1200
|
)
|
|
571
1201
|
] })
|
|
@@ -573,119 +1203,68 @@ function TablePagination({ table }) {
|
|
|
573
1203
|
}
|
|
574
1204
|
|
|
575
1205
|
// src/components/lux-table/table-toolbar.tsx
|
|
576
|
-
var
|
|
577
|
-
var
|
|
1206
|
+
var React8 = __toESM(require("react"));
|
|
1207
|
+
var import_lucide_react7 = require("lucide-react");
|
|
578
1208
|
|
|
579
|
-
// src/components/ui/
|
|
580
|
-
var
|
|
581
|
-
var
|
|
582
|
-
var
|
|
583
|
-
var
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
593
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
594
|
-
},
|
|
595
|
-
size: {
|
|
596
|
-
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
597
|
-
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
598
|
-
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
599
|
-
icon: "size-9",
|
|
600
|
-
"icon-sm": "size-8",
|
|
601
|
-
"icon-lg": "size-10"
|
|
602
|
-
}
|
|
603
|
-
},
|
|
604
|
-
defaultVariants: {
|
|
605
|
-
variant: "default",
|
|
606
|
-
size: "default"
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
);
|
|
610
|
-
function Button({
|
|
611
|
-
className,
|
|
612
|
-
variant = "default",
|
|
613
|
-
size = "default",
|
|
614
|
-
asChild = false,
|
|
615
|
-
...props
|
|
616
|
-
}) {
|
|
617
|
-
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
618
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
619
|
-
Comp,
|
|
620
|
-
{
|
|
621
|
-
"data-slot": "button",
|
|
622
|
-
"data-variant": variant,
|
|
623
|
-
"data-size": size,
|
|
624
|
-
className: cn(buttonVariants({ variant, size, className })),
|
|
625
|
-
...props
|
|
626
|
-
}
|
|
627
|
-
);
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
// src/components/ui/dropdown-menu.tsx
|
|
631
|
-
var React5 = __toESM(require("react"));
|
|
632
|
-
var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
633
|
-
var import_lucide_react4 = require("lucide-react");
|
|
634
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
635
|
-
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
636
|
-
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
637
|
-
var DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
638
|
-
var DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
639
|
-
var DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
640
|
-
var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
641
|
-
var DropdownMenuSubTrigger = React5.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
642
|
-
DropdownMenuPrimitive.SubTrigger,
|
|
1209
|
+
// src/components/ui/dropdown-menu.tsx
|
|
1210
|
+
var React7 = __toESM(require("react"));
|
|
1211
|
+
var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
1212
|
+
var import_lucide_react6 = require("lucide-react");
|
|
1213
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1214
|
+
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
1215
|
+
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
1216
|
+
var DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
1217
|
+
var DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
1218
|
+
var DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
1219
|
+
var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
1220
|
+
var DropdownMenuSubTrigger = React7.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1221
|
+
DropdownMenuPrimitive.SubTrigger,
|
|
643
1222
|
{
|
|
644
1223
|
ref,
|
|
645
1224
|
className: cn(
|
|
646
|
-
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-
|
|
1225
|
+
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
|
|
647
1226
|
inset && "pl-8",
|
|
648
1227
|
className
|
|
649
1228
|
),
|
|
650
1229
|
...props,
|
|
651
1230
|
children: [
|
|
652
1231
|
children,
|
|
653
|
-
/* @__PURE__ */ (0,
|
|
1232
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.ChevronRight, { className: "ml-auto h-4 w-4" })
|
|
654
1233
|
]
|
|
655
1234
|
}
|
|
656
1235
|
));
|
|
657
1236
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
658
|
-
var DropdownMenuSubContent =
|
|
1237
|
+
var DropdownMenuSubContent = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
659
1238
|
DropdownMenuPrimitive.SubContent,
|
|
660
1239
|
{
|
|
661
1240
|
ref,
|
|
662
1241
|
className: cn(
|
|
663
|
-
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-
|
|
1242
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-lg 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-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
664
1243
|
className
|
|
665
1244
|
),
|
|
666
1245
|
...props
|
|
667
1246
|
}
|
|
668
1247
|
));
|
|
669
1248
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
670
|
-
var DropdownMenuContent =
|
|
1249
|
+
var DropdownMenuContent = React7.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
671
1250
|
DropdownMenuPrimitive.Content,
|
|
672
1251
|
{
|
|
673
1252
|
ref,
|
|
674
1253
|
sideOffset,
|
|
675
1254
|
className: cn(
|
|
676
|
-
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-
|
|
1255
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md 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-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
677
1256
|
className
|
|
678
1257
|
),
|
|
679
1258
|
...props
|
|
680
1259
|
}
|
|
681
1260
|
) }));
|
|
682
1261
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
683
|
-
var DropdownMenuItem =
|
|
1262
|
+
var DropdownMenuItem = React7.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
684
1263
|
DropdownMenuPrimitive.Item,
|
|
685
1264
|
{
|
|
686
1265
|
ref,
|
|
687
1266
|
className: cn(
|
|
688
|
-
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-
|
|
1267
|
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
689
1268
|
inset && "pl-8",
|
|
690
1269
|
className
|
|
691
1270
|
),
|
|
@@ -693,40 +1272,40 @@ var DropdownMenuItem = React5.forwardRef(({ className, inset, ...props }, ref) =
|
|
|
693
1272
|
}
|
|
694
1273
|
));
|
|
695
1274
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
696
|
-
var DropdownMenuCheckboxItem =
|
|
1275
|
+
var DropdownMenuCheckboxItem = React7.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
697
1276
|
DropdownMenuPrimitive.CheckboxItem,
|
|
698
1277
|
{
|
|
699
1278
|
ref,
|
|
700
1279
|
className: cn(
|
|
701
|
-
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-
|
|
1280
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
702
1281
|
className
|
|
703
1282
|
),
|
|
704
1283
|
checked,
|
|
705
1284
|
...props,
|
|
706
1285
|
children: [
|
|
707
|
-
/* @__PURE__ */ (0,
|
|
1286
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Check, { className: "h-4 w-4" }) }) }),
|
|
708
1287
|
children
|
|
709
1288
|
]
|
|
710
1289
|
}
|
|
711
1290
|
));
|
|
712
1291
|
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
713
|
-
var DropdownMenuRadioItem =
|
|
1292
|
+
var DropdownMenuRadioItem = React7.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
714
1293
|
DropdownMenuPrimitive.RadioItem,
|
|
715
1294
|
{
|
|
716
1295
|
ref,
|
|
717
1296
|
className: cn(
|
|
718
|
-
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-
|
|
1297
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
719
1298
|
className
|
|
720
1299
|
),
|
|
721
1300
|
...props,
|
|
722
1301
|
children: [
|
|
723
|
-
/* @__PURE__ */ (0,
|
|
1302
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react6.Circle, { className: "h-2 w-2 fill-current" }) }) }),
|
|
724
1303
|
children
|
|
725
1304
|
]
|
|
726
1305
|
}
|
|
727
1306
|
));
|
|
728
1307
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
729
|
-
var DropdownMenuLabel =
|
|
1308
|
+
var DropdownMenuLabel = React7.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
730
1309
|
DropdownMenuPrimitive.Label,
|
|
731
1310
|
{
|
|
732
1311
|
ref,
|
|
@@ -739,11 +1318,11 @@ var DropdownMenuLabel = React5.forwardRef(({ className, inset, ...props }, ref)
|
|
|
739
1318
|
}
|
|
740
1319
|
));
|
|
741
1320
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
742
|
-
var DropdownMenuSeparator =
|
|
1321
|
+
var DropdownMenuSeparator = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
743
1322
|
DropdownMenuPrimitive.Separator,
|
|
744
1323
|
{
|
|
745
1324
|
ref,
|
|
746
|
-
className: cn("-mx-1 my-1 h-px bg-
|
|
1325
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
747
1326
|
...props
|
|
748
1327
|
}
|
|
749
1328
|
));
|
|
@@ -752,7 +1331,7 @@ var DropdownMenuShortcut = ({
|
|
|
752
1331
|
className,
|
|
753
1332
|
...props
|
|
754
1333
|
}) => {
|
|
755
|
-
return /* @__PURE__ */ (0,
|
|
1334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
756
1335
|
"span",
|
|
757
1336
|
{
|
|
758
1337
|
className: cn("ml-auto text-xs tracking-widest opacity-60", className),
|
|
@@ -763,7 +1342,7 @@ var DropdownMenuShortcut = ({
|
|
|
763
1342
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
764
1343
|
|
|
765
1344
|
// src/components/lux-table/table-toolbar.tsx
|
|
766
|
-
var
|
|
1345
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
767
1346
|
function TableToolbar({
|
|
768
1347
|
table,
|
|
769
1348
|
showFiltering = true,
|
|
@@ -773,35 +1352,35 @@ function TableToolbar({
|
|
|
773
1352
|
showColumnVisibility = true,
|
|
774
1353
|
className
|
|
775
1354
|
}) {
|
|
776
|
-
const [globalFilter, setGlobalFilter] =
|
|
1355
|
+
const [globalFilter, setGlobalFilter] = React8.useState("");
|
|
777
1356
|
const hidableColumns = table.getAllColumns().filter((column) => column.getCanHide() && column.id !== "__selection__");
|
|
778
1357
|
const hiddenColumns = hidableColumns.filter((column) => !column.getIsVisible());
|
|
779
|
-
const handleGlobalSearch =
|
|
1358
|
+
const handleGlobalSearch = React8.useCallback(
|
|
780
1359
|
(value) => {
|
|
781
1360
|
setGlobalFilter(value);
|
|
782
1361
|
table.setGlobalFilter(value);
|
|
783
1362
|
},
|
|
784
1363
|
[table]
|
|
785
1364
|
);
|
|
786
|
-
const handleResetVisibility =
|
|
1365
|
+
const handleResetVisibility = React8.useCallback(() => {
|
|
787
1366
|
table.resetColumnVisibility();
|
|
788
1367
|
}, [table]);
|
|
789
|
-
const handleShowAllColumns =
|
|
1368
|
+
const handleShowAllColumns = React8.useCallback(() => {
|
|
790
1369
|
hidableColumns.forEach((column) => {
|
|
791
1370
|
column.toggleVisibility(true);
|
|
792
1371
|
});
|
|
793
1372
|
}, [hidableColumns]);
|
|
794
|
-
return /* @__PURE__ */ (0,
|
|
1373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
795
1374
|
"div",
|
|
796
1375
|
{
|
|
797
1376
|
className: cn(
|
|
798
|
-
"flex flex-wrap items-center gap-2 p-3 rounded-lg border border-
|
|
1377
|
+
"flex flex-wrap items-center gap-2 p-3 rounded-lg border border-[hsl(var(--lux-toolbar-border))] bg-[hsl(var(--lux-toolbar-background))]",
|
|
799
1378
|
className
|
|
800
1379
|
),
|
|
801
1380
|
children: [
|
|
802
|
-
showGlobalSearch && /* @__PURE__ */ (0,
|
|
803
|
-
/* @__PURE__ */ (0,
|
|
804
|
-
/* @__PURE__ */ (0,
|
|
1381
|
+
showGlobalSearch && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "relative flex-1 min-w-[200px] max-w-sm", children: [
|
|
1382
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-[hsl(var(--lux-toolbar-icon))]" }),
|
|
1383
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
805
1384
|
"input",
|
|
806
1385
|
{
|
|
807
1386
|
type: "text",
|
|
@@ -809,55 +1388,55 @@ function TableToolbar({
|
|
|
809
1388
|
value: globalFilter,
|
|
810
1389
|
onChange: (e) => handleGlobalSearch(e.target.value),
|
|
811
1390
|
className: cn(
|
|
812
|
-
"w-full h-9 pl-9 pr-3 rounded-md border border-
|
|
813
|
-
"bg-
|
|
814
|
-
"placeholder:text-
|
|
815
|
-
"focus:outline-none focus:ring-2 focus:ring-
|
|
1391
|
+
"w-full h-9 pl-9 pr-3 rounded-md border border-[hsl(var(--lux-toolbar-input-border))]",
|
|
1392
|
+
"bg-[hsl(var(--lux-toolbar-input-background))] text-sm text-[hsl(var(--lux-toolbar-input-foreground))]",
|
|
1393
|
+
"placeholder:text-[hsl(var(--lux-toolbar-input-placeholder))]",
|
|
1394
|
+
"focus:outline-none focus:ring-2 focus:ring-[hsl(var(--lux-focus-ring))]/50 focus:border-[hsl(var(--lux-focus-ring))]",
|
|
816
1395
|
"transition-colors"
|
|
817
1396
|
)
|
|
818
1397
|
}
|
|
819
1398
|
),
|
|
820
|
-
globalFilter && /* @__PURE__ */ (0,
|
|
1399
|
+
globalFilter && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
821
1400
|
"button",
|
|
822
1401
|
{
|
|
823
1402
|
onClick: () => handleGlobalSearch(""),
|
|
824
|
-
className: "absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded-full hover:bg-
|
|
825
|
-
children: /* @__PURE__ */ (0,
|
|
1403
|
+
className: "absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded-full hover:bg-[hsl(var(--lux-table-row-hover))] transition-colors",
|
|
1404
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.FilterX, { className: "h-3 w-3 text-[hsl(var(--lux-toolbar-icon))]" })
|
|
826
1405
|
}
|
|
827
1406
|
)
|
|
828
1407
|
] }),
|
|
829
|
-
/* @__PURE__ */ (0,
|
|
830
|
-
showFiltering && onFilteringToggle && /* @__PURE__ */ (0,
|
|
1408
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-2 ml-auto", children: [
|
|
1409
|
+
showFiltering && onFilteringToggle && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
831
1410
|
Button,
|
|
832
1411
|
{
|
|
833
1412
|
variant: filteringEnabled ? "default" : "outline",
|
|
834
1413
|
size: "sm",
|
|
835
1414
|
onClick: () => onFilteringToggle(!filteringEnabled),
|
|
836
|
-
className: "gap-2",
|
|
837
|
-
children: filteringEnabled ? /* @__PURE__ */ (0,
|
|
838
|
-
/* @__PURE__ */ (0,
|
|
839
|
-
/* @__PURE__ */ (0,
|
|
840
|
-
] }) : /* @__PURE__ */ (0,
|
|
841
|
-
/* @__PURE__ */ (0,
|
|
842
|
-
/* @__PURE__ */ (0,
|
|
1415
|
+
className: "gap-2 bg-white dark:bg-slate-950 border-slate-200 dark:border-slate-800 text-slate-900 dark:text-slate-100 hover:bg-slate-100 dark:hover:bg-slate-800",
|
|
1416
|
+
children: filteringEnabled ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
1417
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.FilterX, { className: "h-4 w-4" }),
|
|
1418
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "hidden sm:inline", children: "Hide Filters" })
|
|
1419
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
1420
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.Filter, { className: "h-4 w-4" }),
|
|
1421
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "hidden sm:inline", children: "Show Filters" })
|
|
843
1422
|
] })
|
|
844
1423
|
}
|
|
845
1424
|
),
|
|
846
|
-
showColumnVisibility && /* @__PURE__ */ (0,
|
|
847
|
-
/* @__PURE__ */ (0,
|
|
848
|
-
/* @__PURE__ */ (0,
|
|
849
|
-
/* @__PURE__ */ (0,
|
|
850
|
-
hiddenColumns.length > 0 && /* @__PURE__ */ (0,
|
|
851
|
-
/* @__PURE__ */ (0,
|
|
1425
|
+
showColumnVisibility && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DropdownMenu, { children: [
|
|
1426
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Button, { variant: "outline", size: "sm", className: "gap-2 bg-white dark:bg-slate-950 border-slate-200 dark:border-slate-800 text-slate-900 dark:text-slate-100 hover:bg-slate-100 dark:hover:bg-slate-800", children: [
|
|
1427
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.Columns3, { className: "h-4 w-4" }),
|
|
1428
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "hidden sm:inline", children: "Columns" }),
|
|
1429
|
+
hiddenColumns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "ml-1 flex h-5 w-5 items-center justify-center rounded-full bg-[hsl(var(--lux-focus-ring))] text-[10px] font-medium text-white", children: hiddenColumns.length }),
|
|
1430
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.ChevronDown, { className: "h-3 w-3 opacity-50" })
|
|
852
1431
|
] }) }),
|
|
853
|
-
/* @__PURE__ */ (0,
|
|
854
|
-
/* @__PURE__ */ (0,
|
|
855
|
-
/* @__PURE__ */ (0,
|
|
1432
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DropdownMenuContent, { align: "end", className: "w-56 bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-800", children: [
|
|
1433
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DropdownMenuLabel, { className: "flex items-center gap-2", children: [
|
|
1434
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.Columns3, { className: "h-4 w-4" }),
|
|
856
1435
|
"Toggle Columns"
|
|
857
1436
|
] }),
|
|
858
|
-
/* @__PURE__ */ (0,
|
|
859
|
-
/* @__PURE__ */ (0,
|
|
860
|
-
/* @__PURE__ */ (0,
|
|
1437
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DropdownMenuSeparator, {}),
|
|
1438
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1 px-2 py-1.5", children: [
|
|
1439
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
861
1440
|
Button,
|
|
862
1441
|
{
|
|
863
1442
|
variant: "ghost",
|
|
@@ -866,12 +1445,12 @@ function TableToolbar({
|
|
|
866
1445
|
disabled: hiddenColumns.length === 0,
|
|
867
1446
|
className: "h-7 flex-1 text-xs",
|
|
868
1447
|
children: [
|
|
869
|
-
/* @__PURE__ */ (0,
|
|
1448
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.Eye, { className: "mr-1 h-3 w-3" }),
|
|
870
1449
|
"Show All"
|
|
871
1450
|
]
|
|
872
1451
|
}
|
|
873
1452
|
),
|
|
874
|
-
/* @__PURE__ */ (0,
|
|
1453
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
875
1454
|
Button,
|
|
876
1455
|
{
|
|
877
1456
|
variant: "ghost",
|
|
@@ -879,33 +1458,33 @@ function TableToolbar({
|
|
|
879
1458
|
onClick: handleResetVisibility,
|
|
880
1459
|
className: "h-7 flex-1 text-xs",
|
|
881
1460
|
children: [
|
|
882
|
-
/* @__PURE__ */ (0,
|
|
1461
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.RotateCcw, { className: "mr-1 h-3 w-3" }),
|
|
883
1462
|
"Reset"
|
|
884
1463
|
]
|
|
885
1464
|
}
|
|
886
1465
|
)
|
|
887
1466
|
] }),
|
|
888
|
-
/* @__PURE__ */ (0,
|
|
889
|
-
/* @__PURE__ */ (0,
|
|
1467
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DropdownMenuSeparator, {}),
|
|
1468
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "max-h-[300px] overflow-y-auto", children: hidableColumns.map((column) => {
|
|
890
1469
|
const columnDef = column.columnDef;
|
|
891
1470
|
const headerText = typeof columnDef.header === "string" ? columnDef.header : column.id;
|
|
892
|
-
return /* @__PURE__ */ (0,
|
|
1471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
893
1472
|
DropdownMenuCheckboxItem,
|
|
894
1473
|
{
|
|
895
1474
|
checked: column.getIsVisible(),
|
|
896
1475
|
onCheckedChange: (value) => column.toggleVisibility(!!value),
|
|
897
1476
|
className: "capitalize",
|
|
898
|
-
children: /* @__PURE__ */ (0,
|
|
899
|
-
column.getIsVisible() ? /* @__PURE__ */ (0,
|
|
1477
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "flex items-center gap-2", children: [
|
|
1478
|
+
column.getIsVisible() ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.Eye, { className: "h-3.5 w-3.5 text-[hsl(var(--lux-status-active-bg))]" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react7.EyeOff, { className: "h-3.5 w-3.5 text-[hsl(var(--lux-toolbar-icon))]" }),
|
|
900
1479
|
headerText
|
|
901
1480
|
] })
|
|
902
1481
|
},
|
|
903
1482
|
column.id
|
|
904
1483
|
);
|
|
905
1484
|
}) }),
|
|
906
|
-
hiddenColumns.length > 0 && /* @__PURE__ */ (0,
|
|
907
|
-
/* @__PURE__ */ (0,
|
|
908
|
-
/* @__PURE__ */ (0,
|
|
1485
|
+
hiddenColumns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
1486
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DropdownMenuSeparator, {}),
|
|
1487
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "px-2 py-1.5 text-xs text-[hsl(var(--lux-table-cell-muted))]", children: [
|
|
909
1488
|
hiddenColumns.length,
|
|
910
1489
|
" column(s) hidden"
|
|
911
1490
|
] })
|
|
@@ -918,15 +1497,51 @@ function TableToolbar({
|
|
|
918
1497
|
);
|
|
919
1498
|
}
|
|
920
1499
|
|
|
1500
|
+
// src/components/lux-table/sortable-header.tsx
|
|
1501
|
+
var import_react_table = require("@tanstack/react-table");
|
|
1502
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1503
|
+
function SortableHeader({
|
|
1504
|
+
header,
|
|
1505
|
+
showSortIndex = false
|
|
1506
|
+
}) {
|
|
1507
|
+
const column = header.column;
|
|
1508
|
+
const canSort = column.getCanSort();
|
|
1509
|
+
const isSorted = column.getIsSorted();
|
|
1510
|
+
const sortIndex = column.getSortIndex();
|
|
1511
|
+
const headerContent = header.isPlaceholder ? null : (0, import_react_table.flexRender)(column.columnDef.header, header.getContext());
|
|
1512
|
+
if (!canSort) {
|
|
1513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: headerContent });
|
|
1514
|
+
}
|
|
1515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1516
|
+
"button",
|
|
1517
|
+
{
|
|
1518
|
+
type: "button",
|
|
1519
|
+
className: cn(
|
|
1520
|
+
"flex items-center gap-1.5 w-full text-left font-medium group",
|
|
1521
|
+
"hover:text-[hsl(var(--lux-table-foreground))]",
|
|
1522
|
+
"transition-all duration-200",
|
|
1523
|
+
"-ml-2 px-2 py-1 rounded-md",
|
|
1524
|
+
"hover:bg-[hsl(var(--lux-table-row-hover))]",
|
|
1525
|
+
isSorted && "text-[hsl(var(--lux-sort-sorted-text))]"
|
|
1526
|
+
),
|
|
1527
|
+
onClick: header.column.getToggleSortingHandler(),
|
|
1528
|
+
children: [
|
|
1529
|
+
headerContent,
|
|
1530
|
+
showSortIndex && isSorted && sortIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "ml-0.5 text-[10px] font-bold text-[hsl(var(--lux-sort-sorted-text))] bg-[hsl(var(--lux-sort-sorted-text))]/10 rounded-full w-4 h-4 flex items-center justify-center ring-1 ring-[hsl(var(--lux-sort-sorted-text))]/20", children: sortIndex + 1 })
|
|
1531
|
+
]
|
|
1532
|
+
}
|
|
1533
|
+
);
|
|
1534
|
+
}
|
|
1535
|
+
|
|
921
1536
|
// src/components/ui/checkbox.tsx
|
|
922
1537
|
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"));
|
|
923
|
-
var
|
|
924
|
-
var
|
|
1538
|
+
var import_lucide_react8 = require("lucide-react");
|
|
1539
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
925
1540
|
function Checkbox({
|
|
926
1541
|
className,
|
|
927
1542
|
...props
|
|
928
1543
|
}) {
|
|
929
|
-
return /* @__PURE__ */ (0,
|
|
1544
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
930
1545
|
CheckboxPrimitive.Root,
|
|
931
1546
|
{
|
|
932
1547
|
"data-slot": "checkbox",
|
|
@@ -935,545 +1550,429 @@ function Checkbox({
|
|
|
935
1550
|
className
|
|
936
1551
|
),
|
|
937
1552
|
...props,
|
|
938
|
-
children: /* @__PURE__ */ (0,
|
|
1553
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
939
1554
|
CheckboxPrimitive.Indicator,
|
|
940
1555
|
{
|
|
941
1556
|
"data-slot": "checkbox-indicator",
|
|
942
1557
|
className: "grid place-content-center text-current transition-none",
|
|
943
|
-
children: /* @__PURE__ */ (0,
|
|
1558
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react8.CheckIcon, { className: "size-3.5" })
|
|
944
1559
|
}
|
|
945
1560
|
)
|
|
946
1561
|
}
|
|
947
1562
|
);
|
|
948
1563
|
}
|
|
949
1564
|
|
|
950
|
-
// src/components/
|
|
951
|
-
var
|
|
952
|
-
function
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
cell: ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
964
|
-
Checkbox,
|
|
1565
|
+
// src/components/cell-renderers/progress-cell.tsx
|
|
1566
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1567
|
+
function ProgressCell({
|
|
1568
|
+
value,
|
|
1569
|
+
barColor = "bg-[hsl(var(--lux-progress-bar))]",
|
|
1570
|
+
bgColor = "bg-[hsl(var(--lux-progress-bg))]",
|
|
1571
|
+
showLabel = false,
|
|
1572
|
+
className
|
|
1573
|
+
}) {
|
|
1574
|
+
const clampedValue = Math.min(100, Math.max(0, value));
|
|
1575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `flex items-center gap-2 ${className || ""}`, children: [
|
|
1576
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: `w-full rounded-full h-2.5 ${bgColor}`, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1577
|
+
"div",
|
|
965
1578
|
{
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
onCheckedChange: (value) => row.toggleSelected(!!value),
|
|
969
|
-
"aria-label": "Select row"
|
|
1579
|
+
className: `${barColor} h-2.5 rounded-full transition-all`,
|
|
1580
|
+
style: { width: `${clampedValue}%` }
|
|
970
1581
|
}
|
|
971
|
-
),
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
1582
|
+
) }),
|
|
1583
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "text-xs text-[hsl(var(--lux-progress-text))] w-8", children: [
|
|
1584
|
+
value,
|
|
1585
|
+
"%"
|
|
1586
|
+
] })
|
|
1587
|
+
] });
|
|
976
1588
|
}
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
1589
|
+
|
|
1590
|
+
// src/components/cell-renderers/boolean-cell.tsx
|
|
1591
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1592
|
+
function BooleanCell({
|
|
1593
|
+
value,
|
|
1594
|
+
trueLabel = "Yes",
|
|
1595
|
+
falseLabel = "No",
|
|
1596
|
+
trueColor = "text-[hsl(var(--lux-boolean-true))]",
|
|
1597
|
+
falseColor = "text-[hsl(var(--lux-boolean-false))]"
|
|
1598
|
+
}) {
|
|
1599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: `font-medium ${value ? trueColor : falseColor}`, children: value ? trueLabel : falseLabel });
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
// src/components/cell-renderers/date-cell.tsx
|
|
1603
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1604
|
+
function DateCell({ value, format: format2 = "short", locale = "en-US" }) {
|
|
1605
|
+
const date = typeof value === "string" ? new Date(value) : value;
|
|
1606
|
+
if (isNaN(date.getTime())) {
|
|
1607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-[hsl(var(--lux-table-cell-muted))]", children: "-" });
|
|
1608
|
+
}
|
|
1609
|
+
let formatted;
|
|
1610
|
+
switch (format2) {
|
|
1611
|
+
case "long":
|
|
1612
|
+
formatted = date.toLocaleDateString(locale, {
|
|
1613
|
+
year: "numeric",
|
|
1614
|
+
month: "long",
|
|
1615
|
+
day: "numeric"
|
|
1616
|
+
});
|
|
1617
|
+
break;
|
|
1618
|
+
case "relative": {
|
|
1619
|
+
const now = /* @__PURE__ */ new Date();
|
|
1620
|
+
const diffMs = now.getTime() - date.getTime();
|
|
1621
|
+
const diffDays = Math.floor(diffMs / (1e3 * 60 * 60 * 24));
|
|
1622
|
+
if (diffDays === 0) formatted = "Today";
|
|
1623
|
+
else if (diffDays === 1) formatted = "Yesterday";
|
|
1624
|
+
else if (diffDays < 7) formatted = `${diffDays} days ago`;
|
|
1625
|
+
else formatted = date.toLocaleDateString(locale);
|
|
1626
|
+
break;
|
|
1627
|
+
}
|
|
1628
|
+
default:
|
|
1629
|
+
formatted = date.toLocaleDateString(locale);
|
|
1630
|
+
}
|
|
1631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-[hsl(var(--lux-table-cell-foreground))]", children: formatted });
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
// src/components/cell-renderers/currency-cell.tsx
|
|
1635
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1636
|
+
function CurrencyCell({ value, currency = "TRY", locale = "tr-TR" }) {
|
|
1637
|
+
const formatted = new Intl.NumberFormat(locale, {
|
|
1638
|
+
style: "currency",
|
|
1639
|
+
currency
|
|
1640
|
+
}).format(value);
|
|
1641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-medium text-[hsl(var(--lux-table-cell-foreground))]", children: formatted });
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
// src/components/cell-renderers/copyable-cell.tsx
|
|
1645
|
+
var React9 = __toESM(require("react"));
|
|
1646
|
+
var import_lucide_react9 = require("lucide-react");
|
|
1647
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1648
|
+
function CopyableCell({
|
|
1649
|
+
value,
|
|
1650
|
+
feedbackDuration = 2e3,
|
|
1651
|
+
onCopy,
|
|
980
1652
|
className,
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
onSortingChange,
|
|
984
|
-
rowSelection: controlledRowSelection,
|
|
985
|
-
onRowSelectionChange,
|
|
986
|
-
onSelectedRowsChange,
|
|
987
|
-
getRowId
|
|
1653
|
+
tooltip = "Click to copy",
|
|
1654
|
+
alwaysShowIcon = false
|
|
988
1655
|
}) {
|
|
989
|
-
const [
|
|
990
|
-
const [
|
|
991
|
-
const
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1656
|
+
const [copied, setCopied] = React9.useState(false);
|
|
1657
|
+
const [isHovered, setIsHovered] = React9.useState(false);
|
|
1658
|
+
const handleCopy = async (e) => {
|
|
1659
|
+
e.stopPropagation();
|
|
1660
|
+
const textToCopy = String(value);
|
|
1661
|
+
try {
|
|
1662
|
+
await navigator.clipboard.writeText(textToCopy);
|
|
1663
|
+
setCopied(true);
|
|
1664
|
+
onCopy?.(textToCopy);
|
|
1665
|
+
setTimeout(() => {
|
|
1666
|
+
setCopied(false);
|
|
1667
|
+
}, feedbackDuration);
|
|
1668
|
+
} catch (err) {
|
|
1669
|
+
console.error("Copy error:", err);
|
|
1670
|
+
}
|
|
1671
|
+
};
|
|
1672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1673
|
+
"button",
|
|
1674
|
+
{
|
|
1675
|
+
type: "button",
|
|
1676
|
+
onClick: handleCopy,
|
|
1677
|
+
onMouseEnter: () => setIsHovered(true),
|
|
1678
|
+
onMouseLeave: () => setIsHovered(false),
|
|
1679
|
+
title: tooltip,
|
|
1680
|
+
className: `
|
|
1681
|
+
group inline-flex items-center gap-2
|
|
1682
|
+
px-2 py-1 -mx-2 -my-1
|
|
1683
|
+
rounded-md
|
|
1684
|
+
transition-all duration-200
|
|
1685
|
+
hover:bg-slate-100 dark:hover:bg-slate-800
|
|
1686
|
+
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1
|
|
1687
|
+
cursor-pointer
|
|
1688
|
+
${className || ""}
|
|
1689
|
+
`,
|
|
1690
|
+
children: [
|
|
1691
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "select-none text-[hsl(var(--lux-table-cell-foreground))]", children: value }),
|
|
1692
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1693
|
+
"span",
|
|
1694
|
+
{
|
|
1695
|
+
className: `
|
|
1696
|
+
inline-flex items-center justify-center
|
|
1697
|
+
transition-all duration-200
|
|
1698
|
+
${alwaysShowIcon || isHovered || copied ? "opacity-100" : "opacity-0"}
|
|
1699
|
+
`,
|
|
1700
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react9.Check, { className: "h-3.5 w-3.5 text-green-600 dark:text-green-400" }) : /* @__PURE__ */ (0, import_jsx_runtime20.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" })
|
|
1701
|
+
}
|
|
1702
|
+
)
|
|
1703
|
+
]
|
|
1005
1704
|
}
|
|
1006
|
-
return columns;
|
|
1007
|
-
}, [columns, showCheckbox, enableRowSelection]);
|
|
1008
|
-
const handleRowSelectionChange = React7.useCallback(
|
|
1009
|
-
(updater) => {
|
|
1010
|
-
const newSelection = typeof updater === "function" ? updater(rowSelection) : updater;
|
|
1011
|
-
if (isControlledRowSelection && onRowSelectionChange) {
|
|
1012
|
-
onRowSelectionChange(newSelection);
|
|
1013
|
-
} else {
|
|
1014
|
-
setInternalRowSelection(newSelection);
|
|
1015
|
-
}
|
|
1016
|
-
},
|
|
1017
|
-
[isControlledRowSelection, onRowSelectionChange, rowSelection]
|
|
1018
1705
|
);
|
|
1019
|
-
const table = (0, import_react_table.useReactTable)({
|
|
1020
|
-
data,
|
|
1021
|
-
columns: tableColumns,
|
|
1022
|
-
state: {
|
|
1023
|
-
sorting,
|
|
1024
|
-
columnFilters,
|
|
1025
|
-
rowSelection,
|
|
1026
|
-
globalFilter
|
|
1027
|
-
},
|
|
1028
|
-
onGlobalFilterChange: setGlobalFilter,
|
|
1029
|
-
onSortingChange: (updater) => {
|
|
1030
|
-
const newSorting = typeof updater === "function" ? updater(sorting) : updater;
|
|
1031
|
-
if (isControlledSorting && onSortingChange) {
|
|
1032
|
-
onSortingChange(newSorting);
|
|
1033
|
-
} else {
|
|
1034
|
-
setInternalSorting(newSorting);
|
|
1035
|
-
}
|
|
1036
|
-
},
|
|
1037
|
-
onColumnFiltersChange: setColumnFilters,
|
|
1038
|
-
onRowSelectionChange: handleRowSelectionChange,
|
|
1039
|
-
enableRowSelection,
|
|
1040
|
-
enableMultiRowSelection,
|
|
1041
|
-
getRowId: getRowId ?? ((row, index) => {
|
|
1042
|
-
if (typeof row === "object" && row !== null && "id" in row) {
|
|
1043
|
-
return String(row.id);
|
|
1044
|
-
}
|
|
1045
|
-
return String(index);
|
|
1046
|
-
}),
|
|
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)(),
|
|
1052
|
-
initialState: {
|
|
1053
|
-
pagination: {
|
|
1054
|
-
pageSize: options?.pageSize ?? 10
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
});
|
|
1058
|
-
React7.useEffect(() => {
|
|
1059
|
-
if (onSelectedRowsChange) {
|
|
1060
|
-
const selectedRows = table.getSelectedRowModel().rows.map((row) => row.original);
|
|
1061
|
-
onSelectedRowsChange(selectedRows);
|
|
1062
|
-
}
|
|
1063
|
-
}, [rowSelection, onSelectedRowsChange, table]);
|
|
1064
|
-
const visibleColumnCount = tableColumns.length;
|
|
1065
|
-
const showToolbar = options?.showToolbar ?? false;
|
|
1066
|
-
const showGlobalSearch = options?.showGlobalSearch ?? true;
|
|
1067
|
-
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)(
|
|
1070
|
-
TableToolbar,
|
|
1071
|
-
{
|
|
1072
|
-
table,
|
|
1073
|
-
showFiltering: options?.filtering !== void 0,
|
|
1074
|
-
filteringEnabled: filteringVisible,
|
|
1075
|
-
onFilteringToggle: setFilteringVisible,
|
|
1076
|
-
showGlobalSearch,
|
|
1077
|
-
showColumnVisibility
|
|
1078
|
-
}
|
|
1079
|
-
),
|
|
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 }),
|
|
1084
|
-
" rows selected",
|
|
1085
|
-
table.getFilteredRowModel().rows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "text-blue-500 dark:text-blue-400", children: [
|
|
1086
|
-
" / ",
|
|
1087
|
-
table.getFilteredRowModel().rows.length,
|
|
1088
|
-
" total"
|
|
1089
|
-
] })
|
|
1090
|
-
] }),
|
|
1091
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1092
|
-
"button",
|
|
1093
|
-
{
|
|
1094
|
-
type: "button",
|
|
1095
|
-
onClick: () => handleRowSelectionChange({}),
|
|
1096
|
-
className: "ml-auto text-xs hover:text-blue-900 dark:hover:text-blue-100 underline underline-offset-2",
|
|
1097
|
-
children: "Clear selection"
|
|
1098
|
-
}
|
|
1099
|
-
)
|
|
1100
|
-
] }),
|
|
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) => {
|
|
1104
|
-
const isSelectionColumn = header.id === "__selection__";
|
|
1105
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1106
|
-
TableHead,
|
|
1107
|
-
{
|
|
1108
|
-
style: isSelectionColumn ? { width: 40, padding: "0 12px" } : void 0,
|
|
1109
|
-
children: header.isPlaceholder ? null : (0, import_react_table.flexRender)(
|
|
1110
|
-
header.column.columnDef.header,
|
|
1111
|
-
header.getContext()
|
|
1112
|
-
)
|
|
1113
|
-
},
|
|
1114
|
-
header.id
|
|
1115
|
-
);
|
|
1116
|
-
}) }, 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) => {
|
|
1118
|
-
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}`);
|
|
1120
|
-
}) })
|
|
1121
|
-
] }),
|
|
1122
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1123
|
-
TableRow,
|
|
1124
|
-
{
|
|
1125
|
-
"data-state": row.getIsSelected() && "selected",
|
|
1126
|
-
className: cn(
|
|
1127
|
-
enableRowSelection && "cursor-pointer",
|
|
1128
|
-
row.getIsSelected() && "bg-blue-50/50 dark:bg-blue-950/30"
|
|
1129
|
-
),
|
|
1130
|
-
onClick: enableRowSelection && !showCheckbox ? () => {
|
|
1131
|
-
if (selectionMode === "single") {
|
|
1132
|
-
handleRowSelectionChange({ [row.id]: true });
|
|
1133
|
-
} else {
|
|
1134
|
-
row.toggleSelected();
|
|
1135
|
-
}
|
|
1136
|
-
} : void 0,
|
|
1137
|
-
children: row.getVisibleCells().map((cell) => {
|
|
1138
|
-
const isSelectionColumn = cell.column.id === "__selection__";
|
|
1139
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1140
|
-
TableCell,
|
|
1141
|
-
{
|
|
1142
|
-
style: isSelectionColumn ? { width: 40, padding: "0 12px" } : void 0,
|
|
1143
|
-
onClick: isSelectionColumn ? (e) => e.stopPropagation() : void 0,
|
|
1144
|
-
children: (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext())
|
|
1145
|
-
},
|
|
1146
|
-
cell.id
|
|
1147
|
-
);
|
|
1148
|
-
})
|
|
1149
|
-
},
|
|
1150
|
-
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." }) }) })
|
|
1152
|
-
] }) }),
|
|
1153
|
-
options?.pagination && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TablePagination, { table })
|
|
1154
|
-
] });
|
|
1155
1706
|
}
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
var import_lucide_react8 = require("lucide-react");
|
|
1159
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1160
|
-
function LuxDataTableColumnHeader({
|
|
1161
|
-
column,
|
|
1162
|
-
title,
|
|
1163
|
-
className
|
|
1164
|
-
}) {
|
|
1165
|
-
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 }) });
|
|
1168
|
-
}
|
|
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)(
|
|
1185
|
-
Button,
|
|
1186
|
-
{
|
|
1187
|
-
variant: "ghost",
|
|
1188
|
-
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",
|
|
1190
|
-
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" })
|
|
1193
|
-
]
|
|
1194
|
-
}
|
|
1195
|
-
) }),
|
|
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" }),
|
|
1199
|
-
"Sort Ascending"
|
|
1200
|
-
] }),
|
|
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" }),
|
|
1203
|
-
"Sort Descending"
|
|
1204
|
-
] }),
|
|
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" }),
|
|
1209
|
-
"Clear sorting"
|
|
1210
|
-
] })
|
|
1211
|
-
] }),
|
|
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" }),
|
|
1215
|
-
"Hide column"
|
|
1216
|
-
] })
|
|
1217
|
-
] })
|
|
1218
|
-
] })
|
|
1219
|
-
] });
|
|
1707
|
+
function createCopyableCell(value, options) {
|
|
1708
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CopyableCell, { value, ...options });
|
|
1220
1709
|
}
|
|
1221
1710
|
|
|
1222
|
-
// src/
|
|
1223
|
-
var
|
|
1224
|
-
var
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
},
|
|
1231
|
-
Inactive: {
|
|
1232
|
-
bg: "bg-red-100",
|
|
1233
|
-
text: "text-red-800",
|
|
1234
|
-
darkBg: "dark:bg-red-900",
|
|
1235
|
-
darkText: "dark:text-red-300"
|
|
1236
|
-
},
|
|
1237
|
-
Pending: {
|
|
1238
|
-
bg: "bg-yellow-100",
|
|
1239
|
-
text: "text-yellow-800",
|
|
1240
|
-
darkBg: "dark:bg-yellow-900",
|
|
1241
|
-
darkText: "dark:text-yellow-300"
|
|
1242
|
-
},
|
|
1243
|
-
Completed: {
|
|
1244
|
-
bg: "bg-blue-100",
|
|
1245
|
-
text: "text-blue-800",
|
|
1246
|
-
darkBg: "dark:bg-blue-900",
|
|
1247
|
-
darkText: "dark:text-blue-300"
|
|
1248
|
-
},
|
|
1249
|
-
Cancelled: {
|
|
1250
|
-
bg: "bg-gray-100",
|
|
1251
|
-
text: "text-gray-800",
|
|
1252
|
-
darkBg: "dark:bg-gray-900",
|
|
1253
|
-
darkText: "dark:text-gray-300"
|
|
1254
|
-
}
|
|
1711
|
+
// src/lib/cell-config.tsx
|
|
1712
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1713
|
+
var defaultPatterns = {
|
|
1714
|
+
status: ["status", "state", "stage", "phase"],
|
|
1715
|
+
date: ["date", "createdAt", "updatedAt", "joinDate", "startDate", "endDate", "birthDate", "publishedAt"],
|
|
1716
|
+
currency: ["price", "amount", "salary", "cost", "revenue", "total", "balance", "fee"],
|
|
1717
|
+
boolean: ["isActive", "isVerified", "isEnabled", "isDeleted", "isPublished", "isPublic"],
|
|
1718
|
+
copyable: ["id", "email", "phone", "code", "token", "reference", "orderId"]
|
|
1255
1719
|
};
|
|
1256
|
-
function
|
|
1257
|
-
const
|
|
1258
|
-
const
|
|
1259
|
-
|
|
1260
|
-
|
|
1720
|
+
function detectFieldTypeFromName(fieldName, patterns) {
|
|
1721
|
+
const name = fieldName.toLowerCase();
|
|
1722
|
+
const mergedPatterns = {
|
|
1723
|
+
status: [...defaultPatterns.status, ...patterns?.status || []],
|
|
1724
|
+
date: [...defaultPatterns.date, ...patterns?.date || []],
|
|
1725
|
+
currency: [...defaultPatterns.currency, ...patterns?.currency || []],
|
|
1726
|
+
boolean: [...defaultPatterns.boolean, ...patterns?.boolean || []],
|
|
1727
|
+
copyable: [...defaultPatterns.copyable, ...patterns?.copyable || []]
|
|
1728
|
+
};
|
|
1729
|
+
if (mergedPatterns.status.some((pattern) => name.includes(pattern.toLowerCase()))) {
|
|
1730
|
+
return "status";
|
|
1261
1731
|
}
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
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)(
|
|
1278
|
-
"div",
|
|
1279
|
-
{
|
|
1280
|
-
className: `${barColor} h-2.5 rounded-full transition-all`,
|
|
1281
|
-
style: { width: `${clampedValue}%` }
|
|
1282
|
-
}
|
|
1283
|
-
) }),
|
|
1284
|
-
showLabel && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "text-xs text-gray-500 dark:text-gray-400 w-8", children: [
|
|
1285
|
-
value,
|
|
1286
|
-
"%"
|
|
1287
|
-
] })
|
|
1288
|
-
] });
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
// src/components/cell-renderers/boolean-cell.tsx
|
|
1292
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1293
|
-
function BooleanCell({
|
|
1294
|
-
value,
|
|
1295
|
-
trueLabel = "Yes",
|
|
1296
|
-
falseLabel = "No",
|
|
1297
|
-
trueColor = "text-green-600 dark:text-green-400",
|
|
1298
|
-
falseColor = "text-red-600 dark:text-red-400"
|
|
1299
|
-
}) {
|
|
1300
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: `font-medium ${value ? trueColor : falseColor}`, children: value ? trueLabel : falseLabel });
|
|
1732
|
+
if (mergedPatterns.date.some((pattern) => name.includes(pattern.toLowerCase()))) {
|
|
1733
|
+
return "date";
|
|
1734
|
+
}
|
|
1735
|
+
if (mergedPatterns.currency.some((pattern) => name.includes(pattern.toLowerCase()))) {
|
|
1736
|
+
return "currency";
|
|
1737
|
+
}
|
|
1738
|
+
if (mergedPatterns.boolean.some((pattern) => name.includes(pattern.toLowerCase()))) {
|
|
1739
|
+
return "boolean";
|
|
1740
|
+
}
|
|
1741
|
+
if (mergedPatterns.copyable.some((pattern) => name.includes(pattern.toLowerCase()))) {
|
|
1742
|
+
return "copyable";
|
|
1743
|
+
}
|
|
1744
|
+
return null;
|
|
1301
1745
|
}
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
const date = typeof value === "string" ? new Date(value) : value;
|
|
1307
|
-
if (isNaN(date.getTime())) {
|
|
1308
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-gray-400", children: "-" });
|
|
1746
|
+
function detectFieldTypeFromValue(value) {
|
|
1747
|
+
if (value === null || value === void 0) return null;
|
|
1748
|
+
if (typeof value === "boolean") {
|
|
1749
|
+
return "boolean";
|
|
1309
1750
|
}
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
year: "numeric",
|
|
1315
|
-
month: "long",
|
|
1316
|
-
day: "numeric"
|
|
1317
|
-
});
|
|
1318
|
-
break;
|
|
1319
|
-
case "relative": {
|
|
1320
|
-
const now = /* @__PURE__ */ new Date();
|
|
1321
|
-
const diffMs = now.getTime() - date.getTime();
|
|
1322
|
-
const diffDays = Math.floor(diffMs / (1e3 * 60 * 60 * 24));
|
|
1323
|
-
if (diffDays === 0) formatted = "Today";
|
|
1324
|
-
else if (diffDays === 1) formatted = "Yesterday";
|
|
1325
|
-
else if (diffDays < 7) formatted = `${diffDays} days ago`;
|
|
1326
|
-
else formatted = date.toLocaleDateString(locale);
|
|
1327
|
-
break;
|
|
1751
|
+
if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}/.test(value)) {
|
|
1752
|
+
const date = new Date(value);
|
|
1753
|
+
if (!isNaN(date.getTime())) {
|
|
1754
|
+
return "date";
|
|
1328
1755
|
}
|
|
1329
|
-
default:
|
|
1330
|
-
formatted = date.toLocaleDateString(locale);
|
|
1331
1756
|
}
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1757
|
+
if (value instanceof Date) {
|
|
1758
|
+
return "date";
|
|
1759
|
+
}
|
|
1760
|
+
if (typeof value === "number") {
|
|
1761
|
+
return null;
|
|
1762
|
+
}
|
|
1763
|
+
if (typeof value === "string") {
|
|
1764
|
+
const lowerValue = value.toLowerCase();
|
|
1765
|
+
const statusValues = ["active", "inactive", "pending", "completed", "cancelled", "approved", "rejected"];
|
|
1766
|
+
if (statusValues.includes(lowerValue)) {
|
|
1767
|
+
return "status";
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
return null;
|
|
1343
1771
|
}
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
setCopied(true);
|
|
1365
|
-
onCopy?.(textToCopy);
|
|
1366
|
-
setTimeout(() => {
|
|
1367
|
-
setCopied(false);
|
|
1368
|
-
}, feedbackDuration);
|
|
1369
|
-
} catch (err) {
|
|
1370
|
-
console.error("Copy error:", err);
|
|
1772
|
+
function getFieldConfig(fieldName, value, config) {
|
|
1773
|
+
if (config?.fields?.[fieldName]) {
|
|
1774
|
+
return config.fields[fieldName];
|
|
1775
|
+
}
|
|
1776
|
+
if (config?.autoDetect === false) {
|
|
1777
|
+
return null;
|
|
1778
|
+
}
|
|
1779
|
+
const nameType = detectFieldTypeFromName(fieldName, config?.patterns);
|
|
1780
|
+
if (nameType) {
|
|
1781
|
+
switch (nameType) {
|
|
1782
|
+
case "status":
|
|
1783
|
+
return { type: "status" };
|
|
1784
|
+
case "date":
|
|
1785
|
+
return { type: "date", format: "short" };
|
|
1786
|
+
case "currency":
|
|
1787
|
+
return { type: "currency", currency: "USD" };
|
|
1788
|
+
case "boolean":
|
|
1789
|
+
return { type: "boolean" };
|
|
1790
|
+
case "copyable":
|
|
1791
|
+
return { type: "copyable" };
|
|
1371
1792
|
}
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
{
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
group inline-flex items-center gap-2
|
|
1383
|
-
px-2 py-1 -mx-2 -my-1
|
|
1384
|
-
rounded-md
|
|
1385
|
-
transition-all duration-200
|
|
1386
|
-
hover:bg-slate-100 dark:hover:bg-slate-800
|
|
1387
|
-
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1
|
|
1388
|
-
cursor-pointer
|
|
1389
|
-
${className || ""}
|
|
1390
|
-
`,
|
|
1391
|
-
children: [
|
|
1392
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "select-none", children: value }),
|
|
1393
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1394
|
-
"span",
|
|
1395
|
-
{
|
|
1396
|
-
className: `
|
|
1397
|
-
inline-flex items-center justify-center
|
|
1398
|
-
transition-all duration-200
|
|
1399
|
-
${alwaysShowIcon || isHovered || copied ? "opacity-100" : "opacity-0"}
|
|
1400
|
-
`,
|
|
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" })
|
|
1402
|
-
}
|
|
1403
|
-
)
|
|
1404
|
-
]
|
|
1793
|
+
}
|
|
1794
|
+
const valueType = detectFieldTypeFromValue(value);
|
|
1795
|
+
if (valueType) {
|
|
1796
|
+
switch (valueType) {
|
|
1797
|
+
case "status":
|
|
1798
|
+
return { type: "status" };
|
|
1799
|
+
case "date":
|
|
1800
|
+
return { type: "date", format: "short" };
|
|
1801
|
+
case "boolean":
|
|
1802
|
+
return { type: "boolean" };
|
|
1405
1803
|
}
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
function createCopyableCell(value, options) {
|
|
1409
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CopyableCell, { value, ...options });
|
|
1804
|
+
}
|
|
1805
|
+
return null;
|
|
1410
1806
|
}
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
)
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
className: cn(labelVariants(), className),
|
|
1425
|
-
...props
|
|
1807
|
+
var defaultGlobalCellConfig = {
|
|
1808
|
+
defaultStatusColors,
|
|
1809
|
+
autoDetect: true,
|
|
1810
|
+
patterns: defaultPatterns
|
|
1811
|
+
};
|
|
1812
|
+
function renderCell(context, fieldName, config) {
|
|
1813
|
+
const value = context.getValue();
|
|
1814
|
+
const fieldConfig = getFieldConfig(fieldName, value, config);
|
|
1815
|
+
if (!fieldConfig) {
|
|
1816
|
+
if (value === null || value === void 0) {
|
|
1817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[hsl(var(--lux-table-cell-foreground))]", children: "-" });
|
|
1818
|
+
}
|
|
1819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[hsl(var(--lux-table-cell-foreground))]", children: String(value) });
|
|
1426
1820
|
}
|
|
1427
|
-
)
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
// src/components/ui/popover.tsx
|
|
1431
|
-
var React10 = __toESM(require("react"));
|
|
1432
|
-
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
|
|
1433
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1434
|
-
var Popover = PopoverPrimitive.Root;
|
|
1435
|
-
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
1436
|
-
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)(
|
|
1438
|
-
PopoverPrimitive.Content,
|
|
1439
|
-
{
|
|
1440
|
-
ref,
|
|
1441
|
-
align,
|
|
1442
|
-
sideOffset,
|
|
1443
|
-
className: cn(
|
|
1444
|
-
"z-50 w-72 rounded-md border border-slate-200 bg-white p-4 text-slate-950 shadow-md 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-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-50",
|
|
1445
|
-
className
|
|
1446
|
-
),
|
|
1447
|
-
...props
|
|
1821
|
+
if (fieldConfig.type === "custom") {
|
|
1822
|
+
return fieldConfig.render(context);
|
|
1448
1823
|
}
|
|
1449
|
-
)
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1824
|
+
if (fieldConfig.type === "status") {
|
|
1825
|
+
const statusValue = String(value);
|
|
1826
|
+
const colors = {
|
|
1827
|
+
...config?.defaultStatusColors,
|
|
1828
|
+
...defaultStatusColors,
|
|
1829
|
+
...fieldConfig.colors
|
|
1830
|
+
};
|
|
1831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StatusCell, { value: statusValue, colors });
|
|
1832
|
+
}
|
|
1833
|
+
if (fieldConfig.type === "progress") {
|
|
1834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1835
|
+
ProgressCell,
|
|
1836
|
+
{
|
|
1837
|
+
value: Number(value),
|
|
1838
|
+
barColor: fieldConfig.barColor,
|
|
1839
|
+
showLabel: fieldConfig.showLabel ?? false
|
|
1840
|
+
}
|
|
1841
|
+
);
|
|
1842
|
+
}
|
|
1843
|
+
if (fieldConfig.type === "boolean") {
|
|
1844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1845
|
+
BooleanCell,
|
|
1846
|
+
{
|
|
1847
|
+
value: Boolean(value),
|
|
1848
|
+
trueLabel: fieldConfig.trueLabel,
|
|
1849
|
+
falseLabel: fieldConfig.falseLabel,
|
|
1850
|
+
trueColor: fieldConfig.trueColor,
|
|
1851
|
+
falseColor: fieldConfig.falseColor
|
|
1852
|
+
}
|
|
1853
|
+
);
|
|
1854
|
+
}
|
|
1855
|
+
if (fieldConfig.type === "date") {
|
|
1856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1857
|
+
DateCell,
|
|
1858
|
+
{
|
|
1859
|
+
value,
|
|
1860
|
+
format: fieldConfig.format,
|
|
1861
|
+
locale: fieldConfig.locale
|
|
1862
|
+
}
|
|
1863
|
+
);
|
|
1864
|
+
}
|
|
1865
|
+
if (fieldConfig.type === "currency") {
|
|
1866
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1867
|
+
CurrencyCell,
|
|
1868
|
+
{
|
|
1869
|
+
value: Number(value),
|
|
1870
|
+
currency: fieldConfig.currency || "USD",
|
|
1871
|
+
locale: fieldConfig.locale || "en-US"
|
|
1872
|
+
}
|
|
1873
|
+
);
|
|
1874
|
+
}
|
|
1875
|
+
if (fieldConfig.type === "copyable") {
|
|
1876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1877
|
+
CopyableCell,
|
|
1878
|
+
{
|
|
1879
|
+
value: String(value),
|
|
1880
|
+
alwaysShowIcon: fieldConfig.alwaysShowIcon,
|
|
1881
|
+
tooltip: fieldConfig.tooltip,
|
|
1882
|
+
onCopy: fieldConfig.onCopy
|
|
1883
|
+
}
|
|
1884
|
+
);
|
|
1885
|
+
}
|
|
1886
|
+
if (value === null || value === void 0) {
|
|
1887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[hsl(var(--lux-table-cell-foreground))]", children: "-" });
|
|
1888
|
+
}
|
|
1889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-[hsl(var(--lux-table-cell-foreground))]", children: String(value) });
|
|
1890
|
+
}
|
|
1473
1891
|
|
|
1474
1892
|
// src/lib/column-helper.tsx
|
|
1475
1893
|
var import_react_table2 = require("@tanstack/react-table");
|
|
1894
|
+
|
|
1895
|
+
// src/components/lux-table/column-header.tsx
|
|
1896
|
+
var import_lucide_react10 = require("lucide-react");
|
|
1476
1897
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1898
|
+
function LuxDataTableColumnHeader({
|
|
1899
|
+
column,
|
|
1900
|
+
title,
|
|
1901
|
+
className
|
|
1902
|
+
}) {
|
|
1903
|
+
const isSorted = column.getIsSorted();
|
|
1904
|
+
const canSort = column.getCanSort();
|
|
1905
|
+
const SortIndicator = () => {
|
|
1906
|
+
if (isSorted === "desc") {
|
|
1907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ArrowDown, { className: "h-4 w-4 text-[hsl(var(--lux-sort-active))]" });
|
|
1908
|
+
}
|
|
1909
|
+
if (isSorted === "asc") {
|
|
1910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ArrowUp, { className: "h-4 w-4 text-[hsl(var(--lux-sort-active))]" });
|
|
1911
|
+
}
|
|
1912
|
+
if (canSort) {
|
|
1913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ArrowUpDown, { className: "h-4 w-4 text-[hsl(var(--lux-sort-idle))]" });
|
|
1914
|
+
}
|
|
1915
|
+
return null;
|
|
1916
|
+
};
|
|
1917
|
+
if (!canSort) {
|
|
1918
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: cn("text-sm font-medium", className), children: title });
|
|
1919
|
+
}
|
|
1920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cn("flex items-center gap-2", className), children: [
|
|
1921
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SortIndicator, {}),
|
|
1922
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-sm font-medium", children: title }),
|
|
1923
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { children: [
|
|
1924
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1925
|
+
Button,
|
|
1926
|
+
{
|
|
1927
|
+
variant: "ghost",
|
|
1928
|
+
size: "icon",
|
|
1929
|
+
className: "h-6 w-6 ml-auto opacity-100 focus:opacity-100 data-[state=open]:opacity-100 transition-opacity",
|
|
1930
|
+
children: [
|
|
1931
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.MoreVertical, { className: "h-3.5 w-3.5" }),
|
|
1932
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "sr-only", children: "Column actions" })
|
|
1933
|
+
]
|
|
1934
|
+
}
|
|
1935
|
+
) }),
|
|
1936
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenuContent, { align: "end", className: "bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-800", children: [
|
|
1937
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenuItem, { onClick: (e) => {
|
|
1938
|
+
e.stopPropagation();
|
|
1939
|
+
column.toggleSorting(false);
|
|
1940
|
+
}, children: [
|
|
1941
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ArrowUp, { className: "mr-2 h-3.5 w-3.5 text-muted-foreground/70" }),
|
|
1942
|
+
"Sort Ascending"
|
|
1943
|
+
] }),
|
|
1944
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenuItem, { onClick: (e) => {
|
|
1945
|
+
e.stopPropagation();
|
|
1946
|
+
column.toggleSorting(true);
|
|
1947
|
+
}, children: [
|
|
1948
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ArrowDown, { className: "mr-2 h-3.5 w-3.5 text-muted-foreground/70" }),
|
|
1949
|
+
"Sort Descending"
|
|
1950
|
+
] }),
|
|
1951
|
+
isSorted && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
1952
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuSeparator, {}),
|
|
1953
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenuItem, { onClick: (e) => {
|
|
1954
|
+
e.stopPropagation();
|
|
1955
|
+
column.clearSorting();
|
|
1956
|
+
}, children: [
|
|
1957
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.X, { className: "mr-2 h-3.5 w-3.5 text-muted-foreground/70" }),
|
|
1958
|
+
"Clear sorting"
|
|
1959
|
+
] })
|
|
1960
|
+
] }),
|
|
1961
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuSeparator, {}),
|
|
1962
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenuItem, { onClick: (e) => {
|
|
1963
|
+
e.stopPropagation();
|
|
1964
|
+
column.toggleVisibility(false);
|
|
1965
|
+
}, children: [
|
|
1966
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.EyeOff, { className: "mr-2 h-3.5 w-3.5 text-muted-foreground/70" }),
|
|
1967
|
+
"Hide column"
|
|
1968
|
+
] })
|
|
1969
|
+
] })
|
|
1970
|
+
] })
|
|
1971
|
+
] });
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
// src/lib/column-helper.tsx
|
|
1975
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1477
1976
|
var toTitleCase = (str) => {
|
|
1478
1977
|
return str.replace(/([A-Z])/g, " $1").replace(/^./, (s) => s.toUpperCase()).trim();
|
|
1479
1978
|
};
|
|
@@ -1489,24 +1988,21 @@ function createColumnHelper() {
|
|
|
1489
1988
|
...column,
|
|
1490
1989
|
// enableSorting is true by default
|
|
1491
1990
|
enableSorting: column?.enableSorting !== false,
|
|
1991
|
+
// Pass size if provided
|
|
1992
|
+
size: column?.size,
|
|
1492
1993
|
// Pass meta information (filterVariant etc.)
|
|
1493
1994
|
meta: column?.meta,
|
|
1494
1995
|
// Use LuxDataTableColumnHeader if header is string or undefined
|
|
1495
|
-
header: typeof headerContent === "function" ? headerContent : ({ column: colParam }) => /* @__PURE__ */ (0,
|
|
1996
|
+
header: typeof headerContent === "function" ? headerContent : ({ column: colParam }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1496
1997
|
LuxDataTableColumnHeader,
|
|
1497
1998
|
{
|
|
1498
1999
|
column: colParam,
|
|
1499
2000
|
title: typeof headerContent === "string" ? headerContent : toTitleCase(accessor)
|
|
1500
2001
|
}
|
|
1501
2002
|
),
|
|
1502
|
-
//
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
if (value === null || value === void 0) {
|
|
1506
|
-
return "-";
|
|
1507
|
-
}
|
|
1508
|
-
return String(value);
|
|
1509
|
-
})
|
|
2003
|
+
// Only add default cell if cell is not explicitly provided
|
|
2004
|
+
// This allows LuxTable's cellConfig to work
|
|
2005
|
+
...column?.cell ? { cell: column.cell } : {}
|
|
1510
2006
|
};
|
|
1511
2007
|
return helper.accessor(accessor, finalColumn);
|
|
1512
2008
|
},
|
|
@@ -1536,7 +2032,7 @@ function createColumnHelper() {
|
|
|
1536
2032
|
auto: (columns) => {
|
|
1537
2033
|
return columns.map((col) => {
|
|
1538
2034
|
return helper.accessor(col.accessor, {
|
|
1539
|
-
header: ({ column }) => /* @__PURE__ */ (0,
|
|
2035
|
+
header: ({ column }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LuxDataTableColumnHeader, { column, title: col.header }),
|
|
1540
2036
|
cell: col.cell || ((info) => {
|
|
1541
2037
|
const value = info.getValue();
|
|
1542
2038
|
if (value === null || value === void 0) return "-";
|
|
@@ -1562,18 +2058,398 @@ function createColumnsFromData(data, options) {
|
|
|
1562
2058
|
const headerText = options?.headers?.[key] || toTitleCase(key);
|
|
1563
2059
|
const cellRenderer = options?.cells?.[key];
|
|
1564
2060
|
return helper.accessor(key, {
|
|
1565
|
-
header: ({ column }) => /* @__PURE__ */ (0,
|
|
1566
|
-
cell
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
2061
|
+
header: ({ column }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LuxDataTableColumnHeader, { column, title: headerText }),
|
|
2062
|
+
// Only add cell if explicitly provided - this allows LuxTable's cellConfig to work
|
|
2063
|
+
...cellRenderer ? { cell: cellRenderer } : {}
|
|
2064
|
+
});
|
|
2065
|
+
});
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2068
|
+
// src/components/lux-table/lux-table.tsx
|
|
2069
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2070
|
+
function createSelectionColumn() {
|
|
2071
|
+
return {
|
|
2072
|
+
id: "__selection__",
|
|
2073
|
+
header: ({ table }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2074
|
+
Checkbox,
|
|
2075
|
+
{
|
|
2076
|
+
checked: table.getIsAllPageRowsSelected() || table.getIsSomePageRowsSelected() && "indeterminate",
|
|
2077
|
+
onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value),
|
|
2078
|
+
"aria-label": "Select all rows"
|
|
2079
|
+
}
|
|
2080
|
+
),
|
|
2081
|
+
cell: ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2082
|
+
Checkbox,
|
|
2083
|
+
{
|
|
2084
|
+
checked: row.getIsSelected(),
|
|
2085
|
+
disabled: !row.getCanSelect(),
|
|
2086
|
+
onCheckedChange: (value) => row.toggleSelected(!!value),
|
|
2087
|
+
"aria-label": "Select row"
|
|
2088
|
+
}
|
|
2089
|
+
),
|
|
2090
|
+
size: 40,
|
|
2091
|
+
enableSorting: false,
|
|
2092
|
+
enableHiding: false
|
|
2093
|
+
};
|
|
2094
|
+
}
|
|
2095
|
+
function LuxTable({
|
|
2096
|
+
columns,
|
|
2097
|
+
data,
|
|
2098
|
+
className,
|
|
2099
|
+
options,
|
|
2100
|
+
cellConfig,
|
|
2101
|
+
sorting: controlledSorting,
|
|
2102
|
+
onSortingChange,
|
|
2103
|
+
rowSelection: controlledRowSelection,
|
|
2104
|
+
onRowSelectionChange,
|
|
2105
|
+
onSelectedRowsChange,
|
|
2106
|
+
getRowId
|
|
2107
|
+
}) {
|
|
2108
|
+
const [internalSorting, setInternalSorting] = React10.useState([]);
|
|
2109
|
+
const [columnFilters, setColumnFilters] = React10.useState([]);
|
|
2110
|
+
const [globalFilter, setGlobalFilter] = React10.useState("");
|
|
2111
|
+
const [filteringVisible, setFilteringVisible] = React10.useState(options?.filtering ?? false);
|
|
2112
|
+
const [internalRowSelection, setInternalRowSelection] = React10.useState({});
|
|
2113
|
+
const isControlledSorting = controlledSorting !== void 0;
|
|
2114
|
+
const sorting = isControlledSorting ? controlledSorting : internalSorting;
|
|
2115
|
+
const isControlledRowSelection = controlledRowSelection !== void 0;
|
|
2116
|
+
const rowSelection = isControlledRowSelection ? controlledRowSelection : internalRowSelection;
|
|
2117
|
+
const selectionMode = options?.selection ?? "none";
|
|
2118
|
+
const showCheckbox = options?.showSelectionCheckbox ?? selectionMode !== "none";
|
|
2119
|
+
const enableRowSelection = selectionMode !== "none";
|
|
2120
|
+
const enableMultiRowSelection = selectionMode === "multiple";
|
|
2121
|
+
const mergedCellConfig = React10.useMemo(() => {
|
|
2122
|
+
const baseConfig = defaultGlobalCellConfig;
|
|
2123
|
+
if (cellConfig) {
|
|
2124
|
+
return {
|
|
2125
|
+
...baseConfig,
|
|
2126
|
+
...cellConfig,
|
|
2127
|
+
fields: {
|
|
2128
|
+
...cellConfig.fields
|
|
2129
|
+
// User's fields override defaults
|
|
2130
|
+
},
|
|
2131
|
+
patterns: {
|
|
2132
|
+
...baseConfig.patterns,
|
|
2133
|
+
...cellConfig.patterns
|
|
2134
|
+
// Merge patterns
|
|
2135
|
+
},
|
|
2136
|
+
defaultStatusColors: {
|
|
2137
|
+
...baseConfig.defaultStatusColors,
|
|
2138
|
+
...cellConfig.defaultStatusColors
|
|
2139
|
+
// Merge status colors
|
|
2140
|
+
}
|
|
2141
|
+
};
|
|
2142
|
+
}
|
|
2143
|
+
return baseConfig;
|
|
2144
|
+
}, [cellConfig]);
|
|
2145
|
+
const autoColumns = React10.useMemo(() => {
|
|
2146
|
+
if (columns) return columns;
|
|
2147
|
+
if (!data || data.length === 0) return [];
|
|
2148
|
+
if (typeof data[0] === "object" && data[0] !== null) {
|
|
2149
|
+
const generatedColumns = createColumnsFromData(data);
|
|
2150
|
+
return generatedColumns;
|
|
2151
|
+
}
|
|
2152
|
+
return [];
|
|
2153
|
+
}, [columns, data]);
|
|
2154
|
+
const dateFilterFn = React10.useCallback((row, columnId, filterValue) => {
|
|
2155
|
+
if (!filterValue || !filterValue.from && !filterValue.to) return true;
|
|
2156
|
+
const cellValue = row.getValue(columnId);
|
|
2157
|
+
if (!cellValue) return false;
|
|
2158
|
+
const cellDate = new Date(String(cellValue));
|
|
2159
|
+
if (isNaN(cellDate.getTime())) return false;
|
|
2160
|
+
if (filterValue.from) {
|
|
2161
|
+
const fromDate = new Date(filterValue.from);
|
|
2162
|
+
fromDate.setHours(0, 0, 0, 0);
|
|
2163
|
+
if (cellDate < fromDate) return false;
|
|
2164
|
+
}
|
|
2165
|
+
if (filterValue.to) {
|
|
2166
|
+
const toDate = new Date(filterValue.to);
|
|
2167
|
+
toDate.setHours(23, 59, 59, 999);
|
|
2168
|
+
if (cellDate > toDate) return false;
|
|
2169
|
+
}
|
|
2170
|
+
return true;
|
|
2171
|
+
}, []);
|
|
2172
|
+
const sliderFilterFn = React10.useCallback((row, columnId, filterValue) => {
|
|
2173
|
+
if (!filterValue || filterValue.min === void 0 && filterValue.max === void 0) return true;
|
|
2174
|
+
const cellValue = row.getValue(columnId);
|
|
2175
|
+
const numValue = typeof cellValue === "number" ? cellValue : parseFloat(String(cellValue));
|
|
2176
|
+
if (isNaN(numValue)) return false;
|
|
2177
|
+
if (filterValue.min !== void 0 && numValue < filterValue.min) return false;
|
|
2178
|
+
if (filterValue.max !== void 0 && numValue > filterValue.max) return false;
|
|
2179
|
+
return true;
|
|
2180
|
+
}, []);
|
|
2181
|
+
const statusFilterFn = React10.useCallback((row, columnId, filterValue) => {
|
|
2182
|
+
if (!filterValue || filterValue.length === 0) return true;
|
|
2183
|
+
const cellValue = String(row.getValue(columnId)).toLowerCase();
|
|
2184
|
+
return filterValue.some((status) => status.toLowerCase() === cellValue);
|
|
2185
|
+
}, []);
|
|
2186
|
+
const tableColumns = React10.useMemo(() => {
|
|
2187
|
+
let processedColumns = autoColumns.map((col) => {
|
|
2188
|
+
const accessorKey = "accessorKey" in col ? col.accessorKey : void 0;
|
|
2189
|
+
const fieldName = accessorKey ? String(accessorKey) : "id" in col ? String(col.id) : void 0;
|
|
2190
|
+
let filterFn = col.filterFn;
|
|
2191
|
+
const meta = col.meta || {};
|
|
2192
|
+
if (fieldName && !meta.filterVariant) {
|
|
2193
|
+
const fieldNameLower = fieldName.toLowerCase();
|
|
2194
|
+
const datePatterns = ["date", "createdat", "updatedat", "joindate", "startdate", "enddate", "birthdate", "publishedat"];
|
|
2195
|
+
if (datePatterns.some((pattern) => fieldNameLower.includes(pattern))) {
|
|
2196
|
+
meta.filterVariant = "date";
|
|
2197
|
+
filterFn = dateFilterFn;
|
|
2198
|
+
}
|
|
2199
|
+
const statusPatterns = ["status", "state", "stage", "phase"];
|
|
2200
|
+
if (statusPatterns.some((pattern) => fieldNameLower.includes(pattern))) {
|
|
2201
|
+
meta.filterVariant = "status";
|
|
2202
|
+
filterFn = statusFilterFn;
|
|
2203
|
+
}
|
|
2204
|
+
const numericPatterns = ["salary", "price", "amount", "cost", "revenue", "total", "balance", "fee"];
|
|
2205
|
+
if (numericPatterns.some((pattern) => fieldNameLower.includes(pattern))) {
|
|
2206
|
+
meta.filterVariant = "slider";
|
|
2207
|
+
filterFn = sliderFilterFn;
|
|
2208
|
+
}
|
|
2209
|
+
} else if (meta.filterVariant) {
|
|
2210
|
+
if (meta.filterVariant === "date" && !filterFn) {
|
|
2211
|
+
filterFn = dateFilterFn;
|
|
2212
|
+
} else if (meta.filterVariant === "slider" && !filterFn) {
|
|
2213
|
+
filterFn = sliderFilterFn;
|
|
2214
|
+
} else if (meta.filterVariant === "status" && !filterFn) {
|
|
2215
|
+
filterFn = statusFilterFn;
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2218
|
+
if (mergedCellConfig && fieldName) {
|
|
2219
|
+
const sampleValue = data && data.length > 0 ? data[0]?.[fieldName] : void 0;
|
|
2220
|
+
const fieldConfig = getFieldConfig(fieldName, sampleValue, mergedCellConfig);
|
|
2221
|
+
if (fieldConfig) {
|
|
2222
|
+
return {
|
|
2223
|
+
...col,
|
|
2224
|
+
cell: (context) => renderCell(context, fieldName, mergedCellConfig),
|
|
2225
|
+
filterFn,
|
|
2226
|
+
meta
|
|
2227
|
+
};
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
if (col.cell || filterFn || meta.filterVariant) {
|
|
2231
|
+
return {
|
|
2232
|
+
...col,
|
|
2233
|
+
filterFn,
|
|
2234
|
+
meta
|
|
2235
|
+
};
|
|
2236
|
+
}
|
|
2237
|
+
return {
|
|
2238
|
+
...col,
|
|
2239
|
+
filterFn,
|
|
2240
|
+
meta
|
|
2241
|
+
};
|
|
1571
2242
|
});
|
|
2243
|
+
if (showCheckbox && enableRowSelection) {
|
|
2244
|
+
return [createSelectionColumn(), ...processedColumns];
|
|
2245
|
+
}
|
|
2246
|
+
return processedColumns;
|
|
2247
|
+
}, [autoColumns, showCheckbox, enableRowSelection, mergedCellConfig, data, dateFilterFn, sliderFilterFn, statusFilterFn]);
|
|
2248
|
+
const handleRowSelectionChange = React10.useCallback(
|
|
2249
|
+
(updater) => {
|
|
2250
|
+
const newSelection = typeof updater === "function" ? updater(rowSelection) : updater;
|
|
2251
|
+
if (isControlledRowSelection && onRowSelectionChange) {
|
|
2252
|
+
onRowSelectionChange(newSelection);
|
|
2253
|
+
} else {
|
|
2254
|
+
setInternalRowSelection(newSelection);
|
|
2255
|
+
}
|
|
2256
|
+
},
|
|
2257
|
+
[isControlledRowSelection, onRowSelectionChange, rowSelection]
|
|
2258
|
+
);
|
|
2259
|
+
const enableSorting = options?.sorting !== false;
|
|
2260
|
+
const enableMultiSort = options?.multiSort !== false;
|
|
2261
|
+
const table = (0, import_react_table3.useReactTable)({
|
|
2262
|
+
data,
|
|
2263
|
+
columns: tableColumns,
|
|
2264
|
+
enableSorting,
|
|
2265
|
+
enableMultiSort,
|
|
2266
|
+
// Shift+Click for multi-sort (default behavior)
|
|
2267
|
+
isMultiSortEvent: (e) => e.shiftKey,
|
|
2268
|
+
// Max columns for multi-sort (undefined = unlimited)
|
|
2269
|
+
maxMultiSortColCount: options?.maxMultiSortColCount,
|
|
2270
|
+
state: {
|
|
2271
|
+
sorting,
|
|
2272
|
+
columnFilters,
|
|
2273
|
+
rowSelection,
|
|
2274
|
+
globalFilter
|
|
2275
|
+
},
|
|
2276
|
+
onGlobalFilterChange: setGlobalFilter,
|
|
2277
|
+
onSortingChange: (updater) => {
|
|
2278
|
+
const newSorting = typeof updater === "function" ? updater(sorting) : updater;
|
|
2279
|
+
if (isControlledSorting && onSortingChange) {
|
|
2280
|
+
onSortingChange(newSorting);
|
|
2281
|
+
} else {
|
|
2282
|
+
setInternalSorting(newSorting);
|
|
2283
|
+
}
|
|
2284
|
+
},
|
|
2285
|
+
onColumnFiltersChange: setColumnFilters,
|
|
2286
|
+
onRowSelectionChange: handleRowSelectionChange,
|
|
2287
|
+
enableRowSelection,
|
|
2288
|
+
enableMultiRowSelection,
|
|
2289
|
+
getRowId: getRowId ?? ((row, index) => {
|
|
2290
|
+
if (typeof row === "object" && row !== null && "id" in row) {
|
|
2291
|
+
return String(row.id);
|
|
2292
|
+
}
|
|
2293
|
+
return String(index);
|
|
2294
|
+
}),
|
|
2295
|
+
getCoreRowModel: (0, import_react_table3.getCoreRowModel)(),
|
|
2296
|
+
getPaginationRowModel: options?.pagination ? (0, import_react_table3.getPaginationRowModel)() : void 0,
|
|
2297
|
+
getSortedRowModel: (0, import_react_table3.getSortedRowModel)(),
|
|
2298
|
+
getFilteredRowModel: (0, import_react_table3.getFilteredRowModel)(),
|
|
2299
|
+
getFacetedUniqueValues: (0, import_react_table3.getFacetedUniqueValues)(),
|
|
2300
|
+
initialState: {
|
|
2301
|
+
pagination: {
|
|
2302
|
+
pageSize: options?.pageSize ?? 10
|
|
2303
|
+
}
|
|
2304
|
+
}
|
|
1572
2305
|
});
|
|
2306
|
+
React10.useEffect(() => {
|
|
2307
|
+
if (onSelectedRowsChange) {
|
|
2308
|
+
const selectedRows = table.getSelectedRowModel().rows.map((row) => row.original);
|
|
2309
|
+
onSelectedRowsChange(selectedRows);
|
|
2310
|
+
}
|
|
2311
|
+
}, [rowSelection, onSelectedRowsChange, table]);
|
|
2312
|
+
const visibleColumnCount = tableColumns.length;
|
|
2313
|
+
const showToolbar = options?.showToolbar ?? false;
|
|
2314
|
+
const showGlobalSearch = options?.showGlobalSearch ?? true;
|
|
2315
|
+
const showColumnVisibility = options?.showColumnVisibility ?? true;
|
|
2316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cn("w-full space-y-4", className), children: [
|
|
2317
|
+
showToolbar && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2318
|
+
TableToolbar,
|
|
2319
|
+
{
|
|
2320
|
+
table,
|
|
2321
|
+
showFiltering: options?.filtering !== void 0,
|
|
2322
|
+
filteringEnabled: filteringVisible,
|
|
2323
|
+
onFilteringToggle: setFilteringVisible,
|
|
2324
|
+
showGlobalSearch,
|
|
2325
|
+
showColumnVisibility
|
|
2326
|
+
}
|
|
2327
|
+
),
|
|
2328
|
+
enableRowSelection && Object.keys(rowSelection).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2 px-4 py-2 text-sm bg-[hsl(var(--lux-selection-info-background))] text-[hsl(var(--lux-selection-info-foreground))] rounded-lg border border-[hsl(var(--lux-selection-info-border))]", children: [
|
|
2329
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.CheckCircle2, { className: "w-4 h-4" }),
|
|
2330
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { children: [
|
|
2331
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("strong", { children: Object.keys(rowSelection).length }),
|
|
2332
|
+
" rows selected",
|
|
2333
|
+
table.getFilteredRowModel().rows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "opacity-80", children: [
|
|
2334
|
+
" / ",
|
|
2335
|
+
table.getFilteredRowModel().rows.length,
|
|
2336
|
+
" total"
|
|
2337
|
+
] })
|
|
2338
|
+
] }),
|
|
2339
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2340
|
+
"button",
|
|
2341
|
+
{
|
|
2342
|
+
type: "button",
|
|
2343
|
+
onClick: () => handleRowSelectionChange({}),
|
|
2344
|
+
className: "ml-auto text-xs hover:opacity-80 underline underline-offset-2",
|
|
2345
|
+
children: "Clear selection"
|
|
2346
|
+
}
|
|
2347
|
+
)
|
|
2348
|
+
] }),
|
|
2349
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rounded-md border border-[hsl(var(--lux-table-border))] bg-[hsl(var(--lux-table-background))] overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Table, { children: [
|
|
2350
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(TableHeader, { children: [
|
|
2351
|
+
table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableRow, { children: headerGroup.headers.map((header) => {
|
|
2352
|
+
const isSelectionColumn = header.id === "__selection__";
|
|
2353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2354
|
+
TableHead,
|
|
2355
|
+
{
|
|
2356
|
+
style: isSelectionColumn ? { width: 40, padding: "0 12px" } : void 0,
|
|
2357
|
+
children: header.isPlaceholder ? null : isSelectionColumn ? (0, import_react_table3.flexRender)(
|
|
2358
|
+
header.column.columnDef.header,
|
|
2359
|
+
header.getContext()
|
|
2360
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2361
|
+
SortableHeader,
|
|
2362
|
+
{
|
|
2363
|
+
header,
|
|
2364
|
+
showSortIndex: enableMultiSort && sorting.length > 1
|
|
2365
|
+
}
|
|
2366
|
+
)
|
|
2367
|
+
},
|
|
2368
|
+
header.id
|
|
2369
|
+
);
|
|
2370
|
+
}) }, headerGroup.id)),
|
|
2371
|
+
filteringVisible && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableRow, { className: "bg-[hsl(var(--lux-filter-background))]", children: table.getHeaderGroups()[0]?.headers.map((header) => {
|
|
2372
|
+
const isSelectionColumn = header.id === "__selection__";
|
|
2373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableHead, { className: "py-2", children: !isSelectionColumn && header.column.getCanFilter() ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ColumnFilter, { column: header.column, data }) : null }, `filter-${header.id}`);
|
|
2374
|
+
}) })
|
|
2375
|
+
] }),
|
|
2376
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2377
|
+
TableRow,
|
|
2378
|
+
{
|
|
2379
|
+
"data-state": row.getIsSelected() && "selected",
|
|
2380
|
+
className: cn(
|
|
2381
|
+
enableRowSelection && "cursor-pointer",
|
|
2382
|
+
row.getIsSelected() && "bg-[hsl(var(--lux-selection-background))]"
|
|
2383
|
+
),
|
|
2384
|
+
onClick: enableRowSelection && !showCheckbox ? () => {
|
|
2385
|
+
if (selectionMode === "single") {
|
|
2386
|
+
handleRowSelectionChange({ [row.id]: true });
|
|
2387
|
+
} else {
|
|
2388
|
+
row.toggleSelected();
|
|
2389
|
+
}
|
|
2390
|
+
} : void 0,
|
|
2391
|
+
children: row.getVisibleCells().map((cell) => {
|
|
2392
|
+
const isSelectionColumn = cell.column.id === "__selection__";
|
|
2393
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2394
|
+
TableCell,
|
|
2395
|
+
{
|
|
2396
|
+
style: isSelectionColumn ? { width: 40, padding: "0 12px" } : void 0,
|
|
2397
|
+
onClick: isSelectionColumn ? (e) => e.stopPropagation() : void 0,
|
|
2398
|
+
children: (0, import_react_table3.flexRender)(cell.column.columnDef.cell, cell.getContext())
|
|
2399
|
+
},
|
|
2400
|
+
cell.id
|
|
2401
|
+
);
|
|
2402
|
+
})
|
|
2403
|
+
},
|
|
2404
|
+
row.id
|
|
2405
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableCell, { colSpan: visibleColumnCount, className: "h-24 text-center", children: "No results." }) }) })
|
|
2406
|
+
] }) }),
|
|
2407
|
+
options?.pagination && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TablePagination, { table })
|
|
2408
|
+
] });
|
|
1573
2409
|
}
|
|
1574
2410
|
|
|
2411
|
+
// src/components/ui/label.tsx
|
|
2412
|
+
var React11 = __toESM(require("react"));
|
|
2413
|
+
var LabelPrimitive = __toESM(require("@radix-ui/react-label"));
|
|
2414
|
+
var import_class_variance_authority2 = require("class-variance-authority");
|
|
2415
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2416
|
+
var labelVariants = (0, import_class_variance_authority2.cva)(
|
|
2417
|
+
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
2418
|
+
);
|
|
2419
|
+
var Label3 = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2420
|
+
LabelPrimitive.Root,
|
|
2421
|
+
{
|
|
2422
|
+
ref,
|
|
2423
|
+
className: cn(labelVariants(), className),
|
|
2424
|
+
...props
|
|
2425
|
+
}
|
|
2426
|
+
));
|
|
2427
|
+
Label3.displayName = LabelPrimitive.Root.displayName;
|
|
2428
|
+
|
|
2429
|
+
// src/components/ui/separator.tsx
|
|
2430
|
+
var React12 = __toESM(require("react"));
|
|
2431
|
+
var SeparatorPrimitive = __toESM(require("@radix-ui/react-separator"));
|
|
2432
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2433
|
+
var Separator3 = React12.forwardRef(
|
|
2434
|
+
({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2435
|
+
SeparatorPrimitive.Root,
|
|
2436
|
+
{
|
|
2437
|
+
ref,
|
|
2438
|
+
decorative,
|
|
2439
|
+
orientation,
|
|
2440
|
+
className: cn(
|
|
2441
|
+
"shrink-0 bg-border",
|
|
2442
|
+
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
2443
|
+
className
|
|
2444
|
+
),
|
|
2445
|
+
...props
|
|
2446
|
+
}
|
|
2447
|
+
)
|
|
2448
|
+
);
|
|
2449
|
+
Separator3.displayName = SeparatorPrimitive.Root.displayName;
|
|
2450
|
+
|
|
1575
2451
|
// src/index.ts
|
|
1576
|
-
var
|
|
2452
|
+
var import_react_table4 = require("@tanstack/react-table");
|
|
1577
2453
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1578
2454
|
0 && (module.exports = {
|
|
1579
2455
|
BooleanCell,
|
|
@@ -1635,10 +2511,13 @@ var import_react_table3 = require("@tanstack/react-table");
|
|
|
1635
2511
|
createColumnHelper,
|
|
1636
2512
|
createColumnsFromData,
|
|
1637
2513
|
createCopyableCell,
|
|
2514
|
+
defaultGlobalCellConfig,
|
|
1638
2515
|
defaultStatusColors,
|
|
1639
2516
|
flexRender,
|
|
1640
2517
|
getCoreRowModel,
|
|
2518
|
+
getFieldConfig,
|
|
1641
2519
|
getFilteredRowModel,
|
|
1642
2520
|
getPaginationRowModel,
|
|
1643
|
-
getSortedRowModel
|
|
2521
|
+
getSortedRowModel,
|
|
2522
|
+
renderCell
|
|
1644
2523
|
});
|