@stereopt/data-table 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +119 -33
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +119 -33
- package/dist/styles.css +86 -293
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -121,6 +121,73 @@ function TableCell({ className, ...props }) {
|
|
|
121
121
|
);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
// src/components/ui/input.tsx
|
|
125
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
126
|
+
function Input({ className, type, ...props }) {
|
|
127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
128
|
+
"input",
|
|
129
|
+
{
|
|
130
|
+
className: cn(
|
|
131
|
+
"h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
132
|
+
className
|
|
133
|
+
),
|
|
134
|
+
"data-slot": "input",
|
|
135
|
+
type,
|
|
136
|
+
...props
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// src/dataTable/filters/DataTableFilter.tsx
|
|
142
|
+
var DataTableFilter = ({
|
|
143
|
+
table,
|
|
144
|
+
filter
|
|
145
|
+
}) => {
|
|
146
|
+
switch (filter.type) {
|
|
147
|
+
case "select": {
|
|
148
|
+
throw Error("Select Filter not implemented yet");
|
|
149
|
+
}
|
|
150
|
+
case "date": {
|
|
151
|
+
throw Error("Date Filter not implemented yet");
|
|
152
|
+
}
|
|
153
|
+
default:
|
|
154
|
+
throw new Error("Type not Implemented", filter.type);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
// src/dataTable/DataTableControls.tsx
|
|
159
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
160
|
+
var DataTableControls = ({
|
|
161
|
+
table,
|
|
162
|
+
search,
|
|
163
|
+
filters
|
|
164
|
+
}) => {
|
|
165
|
+
const value = table.getState().globalFilter ?? "";
|
|
166
|
+
const setValue = table.setGlobalFilter;
|
|
167
|
+
if (!filters && !search) return null;
|
|
168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-center gap-4 pb-4", children: [
|
|
169
|
+
search && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
170
|
+
Input,
|
|
171
|
+
{
|
|
172
|
+
className: "max-w-sm",
|
|
173
|
+
onChange: (event) => setValue(() => event.target.value),
|
|
174
|
+
placeholder: search?.placeholder,
|
|
175
|
+
value
|
|
176
|
+
}
|
|
177
|
+
),
|
|
178
|
+
filters?.map((filter) => {
|
|
179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
180
|
+
DataTableFilter,
|
|
181
|
+
{
|
|
182
|
+
filter,
|
|
183
|
+
table
|
|
184
|
+
},
|
|
185
|
+
filter.column.toString()
|
|
186
|
+
);
|
|
187
|
+
})
|
|
188
|
+
] });
|
|
189
|
+
};
|
|
190
|
+
|
|
124
191
|
// src/components/ui/button.tsx
|
|
125
192
|
var import_class_variance_authority = require("class-variance-authority");
|
|
126
193
|
|
|
@@ -170,7 +237,7 @@ function composeRefs(...refs) {
|
|
|
170
237
|
}
|
|
171
238
|
|
|
172
239
|
// node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
173
|
-
var
|
|
240
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
174
241
|
// @__NO_SIDE_EFFECTS__
|
|
175
242
|
function createSlot(ownerName) {
|
|
176
243
|
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
@@ -188,9 +255,9 @@ function createSlot(ownerName) {
|
|
|
188
255
|
return child;
|
|
189
256
|
}
|
|
190
257
|
});
|
|
191
|
-
return /* @__PURE__ */ (0,
|
|
258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children: React2.isValidElement(newElement) ? React2.cloneElement(newElement, void 0, newChildren) : null });
|
|
192
259
|
}
|
|
193
|
-
return /* @__PURE__ */ (0,
|
|
260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
194
261
|
});
|
|
195
262
|
Slot2.displayName = `${ownerName}.Slot`;
|
|
196
263
|
return Slot2;
|
|
@@ -217,7 +284,7 @@ var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
|
|
|
217
284
|
// @__NO_SIDE_EFFECTS__
|
|
218
285
|
function createSlottable(ownerName) {
|
|
219
286
|
const Slottable2 = ({ children }) => {
|
|
220
|
-
return /* @__PURE__ */ (0,
|
|
287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children });
|
|
221
288
|
};
|
|
222
289
|
Slottable2.displayName = `${ownerName}.Slottable`;
|
|
223
290
|
Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
|
|
@@ -266,7 +333,7 @@ function getElementRef(element) {
|
|
|
266
333
|
}
|
|
267
334
|
|
|
268
335
|
// src/components/ui/button.tsx
|
|
269
|
-
var
|
|
336
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
270
337
|
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
271
338
|
"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
272
339
|
{
|
|
@@ -304,7 +371,7 @@ function Button({
|
|
|
304
371
|
...props
|
|
305
372
|
}) {
|
|
306
373
|
const Comp = asChild ? dist_exports.Root : "button";
|
|
307
|
-
return /* @__PURE__ */ (0,
|
|
374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
308
375
|
Comp,
|
|
309
376
|
{
|
|
310
377
|
className: cn(buttonVariants({ variant, size, className })),
|
|
@@ -437,25 +504,25 @@ var __iconNode4 = [
|
|
|
437
504
|
var ChevronsRight = createLucideIcon("chevrons-right", __iconNode4);
|
|
438
505
|
|
|
439
506
|
// src/dataTable/pagination/DataTablePagination.tsx
|
|
440
|
-
var
|
|
507
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
441
508
|
function DataTablePagination({
|
|
442
509
|
table
|
|
443
510
|
}) {
|
|
444
|
-
return /* @__PURE__ */ (0,
|
|
445
|
-
/* @__PURE__ */ (0,
|
|
511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center justify-between px-2 pt-4", children: [
|
|
512
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "text-muted-foreground flex-1 text-sm", children: [
|
|
446
513
|
table.getFilteredRowModel().rows.length,
|
|
447
514
|
" rows"
|
|
448
515
|
] }),
|
|
449
|
-
/* @__PURE__ */ (0,
|
|
450
|
-
/* @__PURE__ */ (0,
|
|
516
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center space-x-6 lg:space-x-8", children: [
|
|
517
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-[100px] items-center justify-center text-sm font-medium", children: [
|
|
451
518
|
"Page ",
|
|
452
519
|
table.getState().pagination.pageIndex + 1,
|
|
453
520
|
" of",
|
|
454
521
|
" ",
|
|
455
522
|
table.getPageCount() || 1
|
|
456
523
|
] }),
|
|
457
|
-
/* @__PURE__ */ (0,
|
|
458
|
-
/* @__PURE__ */ (0,
|
|
524
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center space-x-2", children: [
|
|
525
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
459
526
|
Button,
|
|
460
527
|
{
|
|
461
528
|
className: "hidden size-8 lg:flex",
|
|
@@ -464,12 +531,12 @@ function DataTablePagination({
|
|
|
464
531
|
size: "icon",
|
|
465
532
|
variant: "outline",
|
|
466
533
|
children: [
|
|
467
|
-
/* @__PURE__ */ (0,
|
|
468
|
-
/* @__PURE__ */ (0,
|
|
534
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "sr-only", children: "Go to first page" }),
|
|
535
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChevronsLeft, {})
|
|
469
536
|
]
|
|
470
537
|
}
|
|
471
538
|
),
|
|
472
|
-
/* @__PURE__ */ (0,
|
|
539
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
473
540
|
Button,
|
|
474
541
|
{
|
|
475
542
|
className: "size-8",
|
|
@@ -478,12 +545,12 @@ function DataTablePagination({
|
|
|
478
545
|
size: "icon",
|
|
479
546
|
variant: "outline",
|
|
480
547
|
children: [
|
|
481
|
-
/* @__PURE__ */ (0,
|
|
482
|
-
/* @__PURE__ */ (0,
|
|
548
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "sr-only", children: "Go to previous page" }),
|
|
549
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChevronLeft, {})
|
|
483
550
|
]
|
|
484
551
|
}
|
|
485
552
|
),
|
|
486
|
-
/* @__PURE__ */ (0,
|
|
553
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
487
554
|
Button,
|
|
488
555
|
{
|
|
489
556
|
className: "size-8",
|
|
@@ -492,12 +559,12 @@ function DataTablePagination({
|
|
|
492
559
|
size: "icon",
|
|
493
560
|
variant: "outline",
|
|
494
561
|
children: [
|
|
495
|
-
/* @__PURE__ */ (0,
|
|
496
|
-
/* @__PURE__ */ (0,
|
|
562
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "sr-only", children: "Go to next page" }),
|
|
563
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChevronRight, {})
|
|
497
564
|
]
|
|
498
565
|
}
|
|
499
566
|
),
|
|
500
|
-
/* @__PURE__ */ (0,
|
|
567
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
501
568
|
Button,
|
|
502
569
|
{
|
|
503
570
|
className: "hidden size-8 lg:flex",
|
|
@@ -506,8 +573,8 @@ function DataTablePagination({
|
|
|
506
573
|
size: "icon",
|
|
507
574
|
variant: "outline",
|
|
508
575
|
children: [
|
|
509
|
-
/* @__PURE__ */ (0,
|
|
510
|
-
/* @__PURE__ */ (0,
|
|
576
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "sr-only", children: "Go to last page" }),
|
|
577
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChevronsRight, {})
|
|
511
578
|
]
|
|
512
579
|
}
|
|
513
580
|
)
|
|
@@ -516,9 +583,19 @@ function DataTablePagination({
|
|
|
516
583
|
] });
|
|
517
584
|
}
|
|
518
585
|
|
|
586
|
+
// src/lib/search.ts
|
|
587
|
+
var import_match_sorter_utils = require("@tanstack/match-sorter-utils");
|
|
588
|
+
var fuzzyFilterFn = (searchableColumns) => (row, columnId, filterValue, addMeta) => {
|
|
589
|
+
if (!searchableColumns) return false;
|
|
590
|
+
if (!searchableColumns.includes(columnId)) return false;
|
|
591
|
+
const itemRank = (0, import_match_sorter_utils.rankItem)(row.getValue(columnId), filterValue);
|
|
592
|
+
addMeta({ itemRank });
|
|
593
|
+
return itemRank.passed;
|
|
594
|
+
};
|
|
595
|
+
|
|
519
596
|
// src/dataTable/DataTable.tsx
|
|
520
597
|
var import_react_table = require("@tanstack/react-table");
|
|
521
|
-
var
|
|
598
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
522
599
|
function DataTable({
|
|
523
600
|
columns,
|
|
524
601
|
data,
|
|
@@ -532,15 +609,24 @@ function DataTable({
|
|
|
532
609
|
getFilteredRowModel: (0, import_react_table.getFilteredRowModel)(),
|
|
533
610
|
getFacetedRowModel: (0, import_react_table.getFacetedRowModel)(),
|
|
534
611
|
getFacetedUniqueValues: (0, import_react_table.getFacetedUniqueValues)(),
|
|
612
|
+
globalFilterFn: fuzzyFilterFn(config?.search?.filterFields),
|
|
535
613
|
autoResetPageIndex: false,
|
|
536
614
|
initialState: {
|
|
537
615
|
columnVisibility: config?.columnVisibility
|
|
538
616
|
}
|
|
539
617
|
});
|
|
540
|
-
return /* @__PURE__ */ (0,
|
|
541
|
-
/* @__PURE__ */ (0,
|
|
542
|
-
|
|
543
|
-
|
|
618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w-full", children: [
|
|
619
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
620
|
+
DataTableControls,
|
|
621
|
+
{
|
|
622
|
+
filters: config?.filters,
|
|
623
|
+
search: config?.search,
|
|
624
|
+
table
|
|
625
|
+
}
|
|
626
|
+
),
|
|
627
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "rounded-md border overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Table, { children: [
|
|
628
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TableHeader, { className: "bg-muted", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TableRow, { children: headerGroup.headers.map((header) => {
|
|
629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
544
630
|
TableHead,
|
|
545
631
|
{
|
|
546
632
|
colSpan: header.colSpan,
|
|
@@ -553,17 +639,17 @@ function DataTable({
|
|
|
553
639
|
header.id
|
|
554
640
|
);
|
|
555
641
|
}) }, headerGroup.id)) }),
|
|
556
|
-
/* @__PURE__ */ (0,
|
|
642
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
557
643
|
TableRow,
|
|
558
644
|
{
|
|
559
645
|
"data-state": row.getIsSelected() && "selected",
|
|
560
|
-
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0,
|
|
646
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TableCell, { className: "truncate max-w-0", children: (0, import_react_table.flexRender)(
|
|
561
647
|
cell.column.columnDef.cell,
|
|
562
648
|
cell.getContext()
|
|
563
649
|
) }, cell.id))
|
|
564
650
|
},
|
|
565
651
|
row.id
|
|
566
|
-
)) : /* @__PURE__ */ (0,
|
|
652
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
567
653
|
TableCell,
|
|
568
654
|
{
|
|
569
655
|
className: "h-24 text-center",
|
|
@@ -572,7 +658,7 @@ function DataTable({
|
|
|
572
658
|
}
|
|
573
659
|
) }) })
|
|
574
660
|
] }) }),
|
|
575
|
-
/* @__PURE__ */ (0,
|
|
661
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DataTablePagination, { table })
|
|
576
662
|
] });
|
|
577
663
|
}
|
|
578
664
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ColumnDef } from '@tanstack/react-table';
|
|
3
3
|
|
|
4
|
+
type Filter<TData> = {
|
|
5
|
+
column: keyof TData;
|
|
6
|
+
type: "select" | "date";
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type Search<TData> = {
|
|
10
|
+
filterFields: (keyof TData)[];
|
|
11
|
+
placeholder: string;
|
|
12
|
+
};
|
|
13
|
+
type Filters<TData> = Filter<TData>[];
|
|
4
14
|
type ColumnVisibility<TData> = {
|
|
5
15
|
[K in keyof TData]?: boolean;
|
|
6
16
|
} & Record<string, boolean>;
|
|
@@ -8,6 +18,8 @@ interface DataTableProps<TData, TValue> {
|
|
|
8
18
|
columns: ColumnDef<TData, TValue>[];
|
|
9
19
|
data: TData[];
|
|
10
20
|
config?: {
|
|
21
|
+
search?: Search<TData>;
|
|
22
|
+
filters?: Filters<TData>;
|
|
11
23
|
columnVisibility?: ColumnVisibility<TData>;
|
|
12
24
|
};
|
|
13
25
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ColumnDef } from '@tanstack/react-table';
|
|
3
3
|
|
|
4
|
+
type Filter<TData> = {
|
|
5
|
+
column: keyof TData;
|
|
6
|
+
type: "select" | "date";
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type Search<TData> = {
|
|
10
|
+
filterFields: (keyof TData)[];
|
|
11
|
+
placeholder: string;
|
|
12
|
+
};
|
|
13
|
+
type Filters<TData> = Filter<TData>[];
|
|
4
14
|
type ColumnVisibility<TData> = {
|
|
5
15
|
[K in keyof TData]?: boolean;
|
|
6
16
|
} & Record<string, boolean>;
|
|
@@ -8,6 +18,8 @@ interface DataTableProps<TData, TValue> {
|
|
|
8
18
|
columns: ColumnDef<TData, TValue>[];
|
|
9
19
|
data: TData[];
|
|
10
20
|
config?: {
|
|
21
|
+
search?: Search<TData>;
|
|
22
|
+
filters?: Filters<TData>;
|
|
11
23
|
columnVisibility?: ColumnVisibility<TData>;
|
|
12
24
|
};
|
|
13
25
|
}
|
package/dist/index.js
CHANGED
|
@@ -90,6 +90,73 @@ function TableCell({ className, ...props }) {
|
|
|
90
90
|
);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
// src/components/ui/input.tsx
|
|
94
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
95
|
+
function Input({ className, type, ...props }) {
|
|
96
|
+
return /* @__PURE__ */ jsx2(
|
|
97
|
+
"input",
|
|
98
|
+
{
|
|
99
|
+
className: cn(
|
|
100
|
+
"h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
|
|
101
|
+
className
|
|
102
|
+
),
|
|
103
|
+
"data-slot": "input",
|
|
104
|
+
type,
|
|
105
|
+
...props
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// src/dataTable/filters/DataTableFilter.tsx
|
|
111
|
+
var DataTableFilter = ({
|
|
112
|
+
table,
|
|
113
|
+
filter
|
|
114
|
+
}) => {
|
|
115
|
+
switch (filter.type) {
|
|
116
|
+
case "select": {
|
|
117
|
+
throw Error("Select Filter not implemented yet");
|
|
118
|
+
}
|
|
119
|
+
case "date": {
|
|
120
|
+
throw Error("Date Filter not implemented yet");
|
|
121
|
+
}
|
|
122
|
+
default:
|
|
123
|
+
throw new Error("Type not Implemented", filter.type);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// src/dataTable/DataTableControls.tsx
|
|
128
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
129
|
+
var DataTableControls = ({
|
|
130
|
+
table,
|
|
131
|
+
search,
|
|
132
|
+
filters
|
|
133
|
+
}) => {
|
|
134
|
+
const value = table.getState().globalFilter ?? "";
|
|
135
|
+
const setValue = table.setGlobalFilter;
|
|
136
|
+
if (!filters && !search) return null;
|
|
137
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 pb-4", children: [
|
|
138
|
+
search && /* @__PURE__ */ jsx3(
|
|
139
|
+
Input,
|
|
140
|
+
{
|
|
141
|
+
className: "max-w-sm",
|
|
142
|
+
onChange: (event) => setValue(() => event.target.value),
|
|
143
|
+
placeholder: search?.placeholder,
|
|
144
|
+
value
|
|
145
|
+
}
|
|
146
|
+
),
|
|
147
|
+
filters?.map((filter) => {
|
|
148
|
+
return /* @__PURE__ */ jsx3(
|
|
149
|
+
DataTableFilter,
|
|
150
|
+
{
|
|
151
|
+
filter,
|
|
152
|
+
table
|
|
153
|
+
},
|
|
154
|
+
filter.column.toString()
|
|
155
|
+
);
|
|
156
|
+
})
|
|
157
|
+
] });
|
|
158
|
+
};
|
|
159
|
+
|
|
93
160
|
// src/components/ui/button.tsx
|
|
94
161
|
import { cva } from "class-variance-authority";
|
|
95
162
|
|
|
@@ -139,7 +206,7 @@ function composeRefs(...refs) {
|
|
|
139
206
|
}
|
|
140
207
|
|
|
141
208
|
// node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
142
|
-
import { Fragment as Fragment2, jsx as
|
|
209
|
+
import { Fragment as Fragment2, jsx as jsx4 } from "react/jsx-runtime";
|
|
143
210
|
// @__NO_SIDE_EFFECTS__
|
|
144
211
|
function createSlot(ownerName) {
|
|
145
212
|
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
@@ -157,9 +224,9 @@ function createSlot(ownerName) {
|
|
|
157
224
|
return child;
|
|
158
225
|
}
|
|
159
226
|
});
|
|
160
|
-
return /* @__PURE__ */
|
|
227
|
+
return /* @__PURE__ */ jsx4(SlotClone, { ...slotProps, ref: forwardedRef, children: React2.isValidElement(newElement) ? React2.cloneElement(newElement, void 0, newChildren) : null });
|
|
161
228
|
}
|
|
162
|
-
return /* @__PURE__ */
|
|
229
|
+
return /* @__PURE__ */ jsx4(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
163
230
|
});
|
|
164
231
|
Slot2.displayName = `${ownerName}.Slot`;
|
|
165
232
|
return Slot2;
|
|
@@ -186,7 +253,7 @@ var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
|
|
|
186
253
|
// @__NO_SIDE_EFFECTS__
|
|
187
254
|
function createSlottable(ownerName) {
|
|
188
255
|
const Slottable2 = ({ children }) => {
|
|
189
|
-
return /* @__PURE__ */
|
|
256
|
+
return /* @__PURE__ */ jsx4(Fragment2, { children });
|
|
190
257
|
};
|
|
191
258
|
Slottable2.displayName = `${ownerName}.Slottable`;
|
|
192
259
|
Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
|
|
@@ -235,7 +302,7 @@ function getElementRef(element) {
|
|
|
235
302
|
}
|
|
236
303
|
|
|
237
304
|
// src/components/ui/button.tsx
|
|
238
|
-
import { jsx as
|
|
305
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
239
306
|
var buttonVariants = cva(
|
|
240
307
|
"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
241
308
|
{
|
|
@@ -273,7 +340,7 @@ function Button({
|
|
|
273
340
|
...props
|
|
274
341
|
}) {
|
|
275
342
|
const Comp = asChild ? dist_exports.Root : "button";
|
|
276
|
-
return /* @__PURE__ */
|
|
343
|
+
return /* @__PURE__ */ jsx5(
|
|
277
344
|
Comp,
|
|
278
345
|
{
|
|
279
346
|
className: cn(buttonVariants({ variant, size, className })),
|
|
@@ -406,25 +473,25 @@ var __iconNode4 = [
|
|
|
406
473
|
var ChevronsRight = createLucideIcon("chevrons-right", __iconNode4);
|
|
407
474
|
|
|
408
475
|
// src/dataTable/pagination/DataTablePagination.tsx
|
|
409
|
-
import { jsx as
|
|
476
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
410
477
|
function DataTablePagination({
|
|
411
478
|
table
|
|
412
479
|
}) {
|
|
413
|
-
return /* @__PURE__ */
|
|
414
|
-
/* @__PURE__ */
|
|
480
|
+
return /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between px-2 pt-4", children: [
|
|
481
|
+
/* @__PURE__ */ jsxs2("div", { className: "text-muted-foreground flex-1 text-sm", children: [
|
|
415
482
|
table.getFilteredRowModel().rows.length,
|
|
416
483
|
" rows"
|
|
417
484
|
] }),
|
|
418
|
-
/* @__PURE__ */
|
|
419
|
-
/* @__PURE__ */
|
|
485
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center space-x-6 lg:space-x-8", children: [
|
|
486
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex w-[100px] items-center justify-center text-sm font-medium", children: [
|
|
420
487
|
"Page ",
|
|
421
488
|
table.getState().pagination.pageIndex + 1,
|
|
422
489
|
" of",
|
|
423
490
|
" ",
|
|
424
491
|
table.getPageCount() || 1
|
|
425
492
|
] }),
|
|
426
|
-
/* @__PURE__ */
|
|
427
|
-
/* @__PURE__ */
|
|
493
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center space-x-2", children: [
|
|
494
|
+
/* @__PURE__ */ jsxs2(
|
|
428
495
|
Button,
|
|
429
496
|
{
|
|
430
497
|
className: "hidden size-8 lg:flex",
|
|
@@ -433,12 +500,12 @@ function DataTablePagination({
|
|
|
433
500
|
size: "icon",
|
|
434
501
|
variant: "outline",
|
|
435
502
|
children: [
|
|
436
|
-
/* @__PURE__ */
|
|
437
|
-
/* @__PURE__ */
|
|
503
|
+
/* @__PURE__ */ jsx6("span", { className: "sr-only", children: "Go to first page" }),
|
|
504
|
+
/* @__PURE__ */ jsx6(ChevronsLeft, {})
|
|
438
505
|
]
|
|
439
506
|
}
|
|
440
507
|
),
|
|
441
|
-
/* @__PURE__ */
|
|
508
|
+
/* @__PURE__ */ jsxs2(
|
|
442
509
|
Button,
|
|
443
510
|
{
|
|
444
511
|
className: "size-8",
|
|
@@ -447,12 +514,12 @@ function DataTablePagination({
|
|
|
447
514
|
size: "icon",
|
|
448
515
|
variant: "outline",
|
|
449
516
|
children: [
|
|
450
|
-
/* @__PURE__ */
|
|
451
|
-
/* @__PURE__ */
|
|
517
|
+
/* @__PURE__ */ jsx6("span", { className: "sr-only", children: "Go to previous page" }),
|
|
518
|
+
/* @__PURE__ */ jsx6(ChevronLeft, {})
|
|
452
519
|
]
|
|
453
520
|
}
|
|
454
521
|
),
|
|
455
|
-
/* @__PURE__ */
|
|
522
|
+
/* @__PURE__ */ jsxs2(
|
|
456
523
|
Button,
|
|
457
524
|
{
|
|
458
525
|
className: "size-8",
|
|
@@ -461,12 +528,12 @@ function DataTablePagination({
|
|
|
461
528
|
size: "icon",
|
|
462
529
|
variant: "outline",
|
|
463
530
|
children: [
|
|
464
|
-
/* @__PURE__ */
|
|
465
|
-
/* @__PURE__ */
|
|
531
|
+
/* @__PURE__ */ jsx6("span", { className: "sr-only", children: "Go to next page" }),
|
|
532
|
+
/* @__PURE__ */ jsx6(ChevronRight, {})
|
|
466
533
|
]
|
|
467
534
|
}
|
|
468
535
|
),
|
|
469
|
-
/* @__PURE__ */
|
|
536
|
+
/* @__PURE__ */ jsxs2(
|
|
470
537
|
Button,
|
|
471
538
|
{
|
|
472
539
|
className: "hidden size-8 lg:flex",
|
|
@@ -475,8 +542,8 @@ function DataTablePagination({
|
|
|
475
542
|
size: "icon",
|
|
476
543
|
variant: "outline",
|
|
477
544
|
children: [
|
|
478
|
-
/* @__PURE__ */
|
|
479
|
-
/* @__PURE__ */
|
|
545
|
+
/* @__PURE__ */ jsx6("span", { className: "sr-only", children: "Go to last page" }),
|
|
546
|
+
/* @__PURE__ */ jsx6(ChevronsRight, {})
|
|
480
547
|
]
|
|
481
548
|
}
|
|
482
549
|
)
|
|
@@ -485,6 +552,16 @@ function DataTablePagination({
|
|
|
485
552
|
] });
|
|
486
553
|
}
|
|
487
554
|
|
|
555
|
+
// src/lib/search.ts
|
|
556
|
+
import { rankItem } from "@tanstack/match-sorter-utils";
|
|
557
|
+
var fuzzyFilterFn = (searchableColumns) => (row, columnId, filterValue, addMeta) => {
|
|
558
|
+
if (!searchableColumns) return false;
|
|
559
|
+
if (!searchableColumns.includes(columnId)) return false;
|
|
560
|
+
const itemRank = rankItem(row.getValue(columnId), filterValue);
|
|
561
|
+
addMeta({ itemRank });
|
|
562
|
+
return itemRank.passed;
|
|
563
|
+
};
|
|
564
|
+
|
|
488
565
|
// src/dataTable/DataTable.tsx
|
|
489
566
|
import {
|
|
490
567
|
flexRender,
|
|
@@ -495,7 +572,7 @@ import {
|
|
|
495
572
|
getPaginationRowModel,
|
|
496
573
|
useReactTable
|
|
497
574
|
} from "@tanstack/react-table";
|
|
498
|
-
import { jsx as
|
|
575
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
499
576
|
function DataTable({
|
|
500
577
|
columns,
|
|
501
578
|
data,
|
|
@@ -509,15 +586,24 @@ function DataTable({
|
|
|
509
586
|
getFilteredRowModel: getFilteredRowModel(),
|
|
510
587
|
getFacetedRowModel: getFacetedRowModel(),
|
|
511
588
|
getFacetedUniqueValues: getFacetedUniqueValues(),
|
|
589
|
+
globalFilterFn: fuzzyFilterFn(config?.search?.filterFields),
|
|
512
590
|
autoResetPageIndex: false,
|
|
513
591
|
initialState: {
|
|
514
592
|
columnVisibility: config?.columnVisibility
|
|
515
593
|
}
|
|
516
594
|
});
|
|
517
|
-
return /* @__PURE__ */
|
|
518
|
-
/* @__PURE__ */
|
|
519
|
-
|
|
520
|
-
|
|
595
|
+
return /* @__PURE__ */ jsxs3("div", { className: "w-full", children: [
|
|
596
|
+
/* @__PURE__ */ jsx7(
|
|
597
|
+
DataTableControls,
|
|
598
|
+
{
|
|
599
|
+
filters: config?.filters,
|
|
600
|
+
search: config?.search,
|
|
601
|
+
table
|
|
602
|
+
}
|
|
603
|
+
),
|
|
604
|
+
/* @__PURE__ */ jsx7("div", { className: "rounded-md border overflow-hidden", children: /* @__PURE__ */ jsxs3(Table, { children: [
|
|
605
|
+
/* @__PURE__ */ jsx7(TableHeader, { className: "bg-muted", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx7(TableRow, { children: headerGroup.headers.map((header) => {
|
|
606
|
+
return /* @__PURE__ */ jsx7(
|
|
521
607
|
TableHead,
|
|
522
608
|
{
|
|
523
609
|
colSpan: header.colSpan,
|
|
@@ -530,17 +616,17 @@ function DataTable({
|
|
|
530
616
|
header.id
|
|
531
617
|
);
|
|
532
618
|
}) }, headerGroup.id)) }),
|
|
533
|
-
/* @__PURE__ */
|
|
619
|
+
/* @__PURE__ */ jsx7(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx7(
|
|
534
620
|
TableRow,
|
|
535
621
|
{
|
|
536
622
|
"data-state": row.getIsSelected() && "selected",
|
|
537
|
-
children: row.getVisibleCells().map((cell) => /* @__PURE__ */
|
|
623
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx7(TableCell, { className: "truncate max-w-0", children: flexRender(
|
|
538
624
|
cell.column.columnDef.cell,
|
|
539
625
|
cell.getContext()
|
|
540
626
|
) }, cell.id))
|
|
541
627
|
},
|
|
542
628
|
row.id
|
|
543
|
-
)) : /* @__PURE__ */
|
|
629
|
+
)) : /* @__PURE__ */ jsx7(TableRow, { children: /* @__PURE__ */ jsx7(
|
|
544
630
|
TableCell,
|
|
545
631
|
{
|
|
546
632
|
className: "h-24 text-center",
|
|
@@ -549,7 +635,7 @@ function DataTable({
|
|
|
549
635
|
}
|
|
550
636
|
) }) })
|
|
551
637
|
] }) }),
|
|
552
|
-
/* @__PURE__ */
|
|
638
|
+
/* @__PURE__ */ jsx7(DataTablePagination, { table })
|
|
553
639
|
] });
|
|
554
640
|
}
|
|
555
641
|
export {
|
package/dist/styles.css
CHANGED
|
@@ -88,35 +88,11 @@
|
|
|
88
88
|
border-bottom-style: var(--tw-border-style);
|
|
89
89
|
border-bottom-width: 1px;
|
|
90
90
|
}
|
|
91
|
-
.border-border {
|
|
92
|
-
border-color: var(--color-border);
|
|
93
|
-
}
|
|
94
91
|
.border-transparent {
|
|
95
92
|
border-color: transparent;
|
|
96
93
|
}
|
|
97
|
-
.bg-
|
|
98
|
-
background-color:
|
|
99
|
-
}
|
|
100
|
-
.bg-destructive\/10 {
|
|
101
|
-
background-color: color-mix(in srgb, 0 84.2% 60.2% 10%, transparent);
|
|
102
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
103
|
-
background-color: color-mix(in oklab, var(--color-destructive) 10%, transparent);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
.bg-muted {
|
|
107
|
-
background-color: var(--color-muted);
|
|
108
|
-
}
|
|
109
|
-
.bg-muted\/50 {
|
|
110
|
-
background-color: color-mix(in srgb, 0 0% 96.1% 50%, transparent);
|
|
111
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
112
|
-
background-color: color-mix(in oklab, var(--color-muted) 50%, transparent);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
.bg-primary {
|
|
116
|
-
background-color: var(--color-primary);
|
|
117
|
-
}
|
|
118
|
-
.bg-secondary {
|
|
119
|
-
background-color: var(--color-secondary);
|
|
94
|
+
.bg-transparent {
|
|
95
|
+
background-color: transparent;
|
|
120
96
|
}
|
|
121
97
|
.bg-clip-padding {
|
|
122
98
|
background-clip: padding-box;
|
|
@@ -136,24 +112,6 @@
|
|
|
136
112
|
.whitespace-nowrap {
|
|
137
113
|
white-space: nowrap;
|
|
138
114
|
}
|
|
139
|
-
.text-destructive {
|
|
140
|
-
color: var(--color-destructive);
|
|
141
|
-
}
|
|
142
|
-
.text-foreground {
|
|
143
|
-
color: var(--color-foreground);
|
|
144
|
-
}
|
|
145
|
-
.text-muted-foreground {
|
|
146
|
-
color: var(--color-muted-foreground);
|
|
147
|
-
}
|
|
148
|
-
.text-primary {
|
|
149
|
-
color: var(--color-primary);
|
|
150
|
-
}
|
|
151
|
-
.text-primary-foreground {
|
|
152
|
-
color: var(--color-primary-foreground);
|
|
153
|
-
}
|
|
154
|
-
.text-secondary-foreground {
|
|
155
|
-
color: var(--color-secondary-foreground);
|
|
156
|
-
}
|
|
157
115
|
.underline-offset-4 {
|
|
158
116
|
text-underline-offset: 4px;
|
|
159
117
|
}
|
|
@@ -161,6 +119,9 @@
|
|
|
161
119
|
outline-style: var(--tw-outline-style);
|
|
162
120
|
outline-width: 1px;
|
|
163
121
|
}
|
|
122
|
+
.filter {
|
|
123
|
+
filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);
|
|
124
|
+
}
|
|
164
125
|
.transition-all {
|
|
165
126
|
transition-property: all;
|
|
166
127
|
transition-timing-function: var(--tw-ease, ease);
|
|
@@ -179,48 +140,20 @@
|
|
|
179
140
|
-webkit-user-select: none;
|
|
180
141
|
user-select: none;
|
|
181
142
|
}
|
|
182
|
-
.
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
background-color: color-mix(in srgb, 0 84.2% 60.2% 20%, transparent);
|
|
186
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
187
|
-
background-color: color-mix(in oklab, var(--color-destructive) 20%, transparent);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
143
|
+
.file\:inline-flex {
|
|
144
|
+
&::file-selector-button {
|
|
145
|
+
display: inline-flex;
|
|
190
146
|
}
|
|
191
147
|
}
|
|
192
|
-
.
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
.hover\:bg-muted\/50 {
|
|
200
|
-
&:hover {
|
|
201
|
-
@media (hover: hover) {
|
|
202
|
-
background-color: color-mix(in srgb, 0 0% 96.1% 50%, transparent);
|
|
203
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
204
|
-
background-color: color-mix(in oklab, var(--color-muted) 50%, transparent);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
.hover\:bg-secondary\/80 {
|
|
210
|
-
&:hover {
|
|
211
|
-
@media (hover: hover) {
|
|
212
|
-
background-color: color-mix(in srgb, 0 0% 96.1% 80%, transparent);
|
|
213
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
214
|
-
background-color: color-mix(in oklab, var(--color-secondary) 80%, transparent);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
148
|
+
.file\:border-0 {
|
|
149
|
+
&::file-selector-button {
|
|
150
|
+
border-style: var(--tw-border-style);
|
|
151
|
+
border-width: 0px;
|
|
217
152
|
}
|
|
218
153
|
}
|
|
219
|
-
.
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
color: var(--color-foreground);
|
|
223
|
-
}
|
|
154
|
+
.file\:bg-transparent {
|
|
155
|
+
&::file-selector-button {
|
|
156
|
+
background-color: transparent;
|
|
224
157
|
}
|
|
225
158
|
}
|
|
226
159
|
.hover\:underline {
|
|
@@ -230,41 +163,12 @@
|
|
|
230
163
|
}
|
|
231
164
|
}
|
|
232
165
|
}
|
|
233
|
-
.focus-visible\:border-destructive\/40 {
|
|
234
|
-
&:focus-visible {
|
|
235
|
-
border-color: color-mix(in srgb, 0 84.2% 60.2% 40%, transparent);
|
|
236
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
237
|
-
border-color: color-mix(in oklab, var(--color-destructive) 40%, transparent);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
.focus-visible\:border-ring {
|
|
242
|
-
&:focus-visible {
|
|
243
|
-
border-color: var(--color-ring);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
166
|
.focus-visible\:ring-3 {
|
|
247
167
|
&:focus-visible {
|
|
248
168
|
--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
|
|
249
169
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
250
170
|
}
|
|
251
171
|
}
|
|
252
|
-
.focus-visible\:ring-destructive\/20 {
|
|
253
|
-
&:focus-visible {
|
|
254
|
-
--tw-ring-color: color-mix(in srgb, 0 84.2% 60.2% 20%, transparent);
|
|
255
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
256
|
-
--tw-ring-color: color-mix(in oklab, var(--color-destructive) 20%, transparent);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
.focus-visible\:ring-ring\/50 {
|
|
261
|
-
&:focus-visible {
|
|
262
|
-
--tw-ring-color: color-mix(in srgb, 0 0% 3.6% 50%, transparent);
|
|
263
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
264
|
-
--tw-ring-color: color-mix(in oklab, var(--color-ring) 50%, transparent);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
172
|
.active\:not-aria-\[haspopup\]\:translate-y-px {
|
|
269
173
|
&:active {
|
|
270
174
|
&:not(*[aria-haspopup]) {
|
|
@@ -278,42 +182,14 @@
|
|
|
278
182
|
pointer-events: none;
|
|
279
183
|
}
|
|
280
184
|
}
|
|
281
|
-
.disabled\:
|
|
185
|
+
.disabled\:cursor-not-allowed {
|
|
282
186
|
&:disabled {
|
|
283
|
-
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
.has-aria-expanded\:bg-muted\/50 {
|
|
287
|
-
&:has(*[aria-expanded="true"]) {
|
|
288
|
-
background-color: color-mix(in srgb, 0 0% 96.1% 50%, transparent);
|
|
289
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
290
|
-
background-color: color-mix(in oklab, var(--color-muted) 50%, transparent);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
.aria-expanded\:bg-muted {
|
|
295
|
-
&[aria-expanded="true"] {
|
|
296
|
-
background-color: var(--color-muted);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
.aria-expanded\:bg-secondary {
|
|
300
|
-
&[aria-expanded="true"] {
|
|
301
|
-
background-color: var(--color-secondary);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
.aria-expanded\:text-foreground {
|
|
305
|
-
&[aria-expanded="true"] {
|
|
306
|
-
color: var(--color-foreground);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
.aria-expanded\:text-secondary-foreground {
|
|
310
|
-
&[aria-expanded="true"] {
|
|
311
|
-
color: var(--color-secondary-foreground);
|
|
187
|
+
cursor: not-allowed;
|
|
312
188
|
}
|
|
313
189
|
}
|
|
314
|
-
.
|
|
315
|
-
|
|
316
|
-
|
|
190
|
+
.disabled\:opacity-50 {
|
|
191
|
+
&:disabled {
|
|
192
|
+
opacity: 50%;
|
|
317
193
|
}
|
|
318
194
|
}
|
|
319
195
|
.aria-invalid\:ring-3 {
|
|
@@ -322,106 +198,6 @@
|
|
|
322
198
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
323
199
|
}
|
|
324
200
|
}
|
|
325
|
-
.aria-invalid\:ring-destructive\/20 {
|
|
326
|
-
&[aria-invalid="true"] {
|
|
327
|
-
--tw-ring-color: color-mix(in srgb, 0 84.2% 60.2% 20%, transparent);
|
|
328
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
329
|
-
--tw-ring-color: color-mix(in oklab, var(--color-destructive) 20%, transparent);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
.data-\[state\=selected\]\:bg-muted {
|
|
334
|
-
&[data-state="selected"] {
|
|
335
|
-
background-color: var(--color-muted);
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
.dark\:border-input {
|
|
339
|
-
@media (prefers-color-scheme: dark) {
|
|
340
|
-
border-color: var(--color-input);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
.dark\:bg-destructive\/20 {
|
|
344
|
-
@media (prefers-color-scheme: dark) {
|
|
345
|
-
background-color: color-mix(in srgb, 0 84.2% 60.2% 20%, transparent);
|
|
346
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
347
|
-
background-color: color-mix(in oklab, var(--color-destructive) 20%, transparent);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
.dark\:bg-input\/30 {
|
|
352
|
-
@media (prefers-color-scheme: dark) {
|
|
353
|
-
background-color: color-mix(in srgb, 0 0% 89.8% 30%, transparent);
|
|
354
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
355
|
-
background-color: color-mix(in oklab, var(--color-input) 30%, transparent);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
.dark\:hover\:bg-destructive\/30 {
|
|
360
|
-
@media (prefers-color-scheme: dark) {
|
|
361
|
-
&:hover {
|
|
362
|
-
@media (hover: hover) {
|
|
363
|
-
background-color: color-mix(in srgb, 0 84.2% 60.2% 30%, transparent);
|
|
364
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
365
|
-
background-color: color-mix(in oklab, var(--color-destructive) 30%, transparent);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
.dark\:hover\:bg-input\/50 {
|
|
372
|
-
@media (prefers-color-scheme: dark) {
|
|
373
|
-
&:hover {
|
|
374
|
-
@media (hover: hover) {
|
|
375
|
-
background-color: color-mix(in srgb, 0 0% 89.8% 50%, transparent);
|
|
376
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
377
|
-
background-color: color-mix(in oklab, var(--color-input) 50%, transparent);
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
.dark\:hover\:bg-muted\/50 {
|
|
384
|
-
@media (prefers-color-scheme: dark) {
|
|
385
|
-
&:hover {
|
|
386
|
-
@media (hover: hover) {
|
|
387
|
-
background-color: color-mix(in srgb, 0 0% 96.1% 50%, transparent);
|
|
388
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
389
|
-
background-color: color-mix(in oklab, var(--color-muted) 50%, transparent);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
.dark\:focus-visible\:ring-destructive\/40 {
|
|
396
|
-
@media (prefers-color-scheme: dark) {
|
|
397
|
-
&:focus-visible {
|
|
398
|
-
--tw-ring-color: color-mix(in srgb, 0 84.2% 60.2% 40%, transparent);
|
|
399
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
400
|
-
--tw-ring-color: color-mix(in oklab, var(--color-destructive) 40%, transparent);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
.dark\:aria-invalid\:border-destructive\/50 {
|
|
406
|
-
@media (prefers-color-scheme: dark) {
|
|
407
|
-
&[aria-invalid="true"] {
|
|
408
|
-
border-color: color-mix(in srgb, 0 84.2% 60.2% 50%, transparent);
|
|
409
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
410
|
-
border-color: color-mix(in oklab, var(--color-destructive) 50%, transparent);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
.dark\:aria-invalid\:ring-destructive\/40 {
|
|
416
|
-
@media (prefers-color-scheme: dark) {
|
|
417
|
-
&[aria-invalid="true"] {
|
|
418
|
-
--tw-ring-color: color-mix(in srgb, 0 84.2% 60.2% 40%, transparent);
|
|
419
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
420
|
-
--tw-ring-color: color-mix(in oklab, var(--color-destructive) 40%, transparent);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
201
|
.\[\&_svg\]\:pointer-events-none {
|
|
426
202
|
& svg {
|
|
427
203
|
pointer-events: none;
|
|
@@ -444,18 +220,6 @@
|
|
|
444
220
|
border-width: 0px;
|
|
445
221
|
}
|
|
446
222
|
}
|
|
447
|
-
.\[a\]\:hover\:bg-primary\/80 {
|
|
448
|
-
&:is(a) {
|
|
449
|
-
&:hover {
|
|
450
|
-
@media (hover: hover) {
|
|
451
|
-
background-color: color-mix(in srgb, 0 0% 9% 80%, transparent);
|
|
452
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
453
|
-
background-color: color-mix(in oklab, var(--color-primary) 80%, transparent);
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
223
|
.\[\&\>tr\]\:last\:border-b-0 {
|
|
460
224
|
&>tr {
|
|
461
225
|
&:last-child {
|
|
@@ -464,43 +228,6 @@
|
|
|
464
228
|
}
|
|
465
229
|
}
|
|
466
230
|
}
|
|
467
|
-
:root, :host {
|
|
468
|
-
--color-background: 0 0% 100%;
|
|
469
|
-
--color-foreground: 0 0% 3.6%;
|
|
470
|
-
--color-muted: 0 0% 96.1%;
|
|
471
|
-
--color-muted-foreground: 0 0% 45.1%;
|
|
472
|
-
--color-destructive: 0 84.2% 60.2%;
|
|
473
|
-
--color-border: 0 0% 89.8%;
|
|
474
|
-
--color-input: 0 0% 89.8%;
|
|
475
|
-
--color-primary: 0 0% 9%;
|
|
476
|
-
--color-primary-foreground: 0 0% 98%;
|
|
477
|
-
--color-secondary: 0 0% 96.1%;
|
|
478
|
-
--color-secondary-foreground: 0 0% 9%;
|
|
479
|
-
--color-ring: 0 0% 3.6%;
|
|
480
|
-
}
|
|
481
|
-
@media (prefers-color-scheme: dark) {
|
|
482
|
-
:root {
|
|
483
|
-
--color-background: 0 0% 3.6%;
|
|
484
|
-
--color-foreground: 0 0% 98%;
|
|
485
|
-
--color-card: 0 0% 3.6%;
|
|
486
|
-
--color-card-foreground: 0 0% 98%;
|
|
487
|
-
--color-popover: 0 0% 3.6%;
|
|
488
|
-
--color-popover-foreground: 0 0% 98%;
|
|
489
|
-
--color-muted: 0 0% 14.9%;
|
|
490
|
-
--color-muted-foreground: 0 0% 63.9%;
|
|
491
|
-
--color-accent: 0 0% 98%;
|
|
492
|
-
--color-accent-foreground: 0 0% 9%;
|
|
493
|
-
--color-destructive: 0 62.8% 30.6%;
|
|
494
|
-
--color-destructive-foreground: 0 0% 98%;
|
|
495
|
-
--color-border: 0 0% 14.9%;
|
|
496
|
-
--color-input: 0 0% 14.9%;
|
|
497
|
-
--color-primary: 0 0% 98%;
|
|
498
|
-
--color-primary-foreground: 0 0% 9%;
|
|
499
|
-
--color-secondary: 0 0% 14.9%;
|
|
500
|
-
--color-secondary-foreground: 0 0% 98%;
|
|
501
|
-
--color-ring: 0 0% 83.1%;
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
231
|
@property --tw-border-style {
|
|
505
232
|
syntax: "*";
|
|
506
233
|
inherits: false;
|
|
@@ -511,6 +238,59 @@
|
|
|
511
238
|
inherits: false;
|
|
512
239
|
initial-value: solid;
|
|
513
240
|
}
|
|
241
|
+
@property --tw-blur {
|
|
242
|
+
syntax: "*";
|
|
243
|
+
inherits: false;
|
|
244
|
+
}
|
|
245
|
+
@property --tw-brightness {
|
|
246
|
+
syntax: "*";
|
|
247
|
+
inherits: false;
|
|
248
|
+
}
|
|
249
|
+
@property --tw-contrast {
|
|
250
|
+
syntax: "*";
|
|
251
|
+
inherits: false;
|
|
252
|
+
}
|
|
253
|
+
@property --tw-grayscale {
|
|
254
|
+
syntax: "*";
|
|
255
|
+
inherits: false;
|
|
256
|
+
}
|
|
257
|
+
@property --tw-hue-rotate {
|
|
258
|
+
syntax: "*";
|
|
259
|
+
inherits: false;
|
|
260
|
+
}
|
|
261
|
+
@property --tw-invert {
|
|
262
|
+
syntax: "*";
|
|
263
|
+
inherits: false;
|
|
264
|
+
}
|
|
265
|
+
@property --tw-opacity {
|
|
266
|
+
syntax: "*";
|
|
267
|
+
inherits: false;
|
|
268
|
+
}
|
|
269
|
+
@property --tw-saturate {
|
|
270
|
+
syntax: "*";
|
|
271
|
+
inherits: false;
|
|
272
|
+
}
|
|
273
|
+
@property --tw-sepia {
|
|
274
|
+
syntax: "*";
|
|
275
|
+
inherits: false;
|
|
276
|
+
}
|
|
277
|
+
@property --tw-drop-shadow {
|
|
278
|
+
syntax: "*";
|
|
279
|
+
inherits: false;
|
|
280
|
+
}
|
|
281
|
+
@property --tw-drop-shadow-color {
|
|
282
|
+
syntax: "*";
|
|
283
|
+
inherits: false;
|
|
284
|
+
}
|
|
285
|
+
@property --tw-drop-shadow-alpha {
|
|
286
|
+
syntax: "<percentage>";
|
|
287
|
+
inherits: false;
|
|
288
|
+
initial-value: 100%;
|
|
289
|
+
}
|
|
290
|
+
@property --tw-drop-shadow-size {
|
|
291
|
+
syntax: "*";
|
|
292
|
+
inherits: false;
|
|
293
|
+
}
|
|
514
294
|
@property --tw-shadow {
|
|
515
295
|
syntax: "*";
|
|
516
296
|
inherits: false;
|
|
@@ -596,6 +376,19 @@
|
|
|
596
376
|
*, ::before, ::after, ::backdrop {
|
|
597
377
|
--tw-border-style: solid;
|
|
598
378
|
--tw-outline-style: solid;
|
|
379
|
+
--tw-blur: initial;
|
|
380
|
+
--tw-brightness: initial;
|
|
381
|
+
--tw-contrast: initial;
|
|
382
|
+
--tw-grayscale: initial;
|
|
383
|
+
--tw-hue-rotate: initial;
|
|
384
|
+
--tw-invert: initial;
|
|
385
|
+
--tw-opacity: initial;
|
|
386
|
+
--tw-saturate: initial;
|
|
387
|
+
--tw-sepia: initial;
|
|
388
|
+
--tw-drop-shadow: initial;
|
|
389
|
+
--tw-drop-shadow-color: initial;
|
|
390
|
+
--tw-drop-shadow-alpha: 100%;
|
|
391
|
+
--tw-drop-shadow-size: initial;
|
|
599
392
|
--tw-shadow: 0 0 #0000;
|
|
600
393
|
--tw-shadow-color: initial;
|
|
601
394
|
--tw-shadow-alpha: 100%;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stereopt/data-table",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "Simple reusable React data table component",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@tailwindcss/postcss": "^4.2.2",
|
|
68
|
+
"@tanstack/match-sorter-utils": "^8.19.4",
|
|
68
69
|
"@tanstack/react-table": "^8.21.3",
|
|
69
70
|
"class-variance-authority": "^0.7.1",
|
|
70
71
|
"clsx": "^2.1.1",
|