@mesob/ui 0.0.2
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/components/accordion.d.ts +10 -0
- package/dist/components/accordion.js +74 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/alert-dialog.d.ts +17 -0
- package/dist/components/alert-dialog.js +187 -0
- package/dist/components/alert-dialog.js.map +1 -0
- package/dist/components/alert.d.ts +13 -0
- package/dist/components/alert.js +74 -0
- package/dist/components/alert.js.map +1 -0
- package/dist/components/animated-tabs.d.ts +26 -0
- package/dist/components/animated-tabs.js +290 -0
- package/dist/components/animated-tabs.js.map +1 -0
- package/dist/components/aspect-ratio.d.ts +6 -0
- package/dist/components/aspect-ratio.js +14 -0
- package/dist/components/aspect-ratio.js.map +1 -0
- package/dist/components/avatar.d.ts +9 -0
- package/dist/components/avatar.js +63 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.d.ts +13 -0
- package/dist/components/badge.js +48 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/breadcrumb.d.ts +14 -0
- package/dist/components/breadcrumb.js +110 -0
- package/dist/components/breadcrumb.js.map +1 -0
- package/dist/components/button-group.d.ts +17 -0
- package/dist/components/button-group.js +106 -0
- package/dist/components/button-group.js.map +1 -0
- package/dist/components/button.d.ts +14 -0
- package/dist/components/button.js +60 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/calendar.d.ts +13 -0
- package/dist/components/calendar.js +254 -0
- package/dist/components/calendar.js.map +1 -0
- package/dist/components/card.d.ts +12 -0
- package/dist/components/card.js +98 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/carousel.d.ts +24 -0
- package/dist/components/carousel.js +260 -0
- package/dist/components/carousel.js.map +1 -0
- package/dist/components/chart.d.ts +43 -0
- package/dist/components/chart.js +261 -0
- package/dist/components/chart.js.map +1 -0
- package/dist/components/checkbox.d.ts +7 -0
- package/dist/components/checkbox.js +41 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/collapsible.d.ts +8 -0
- package/dist/components/collapsible.js +38 -0
- package/dist/components/collapsible.js.map +1 -0
- package/dist/components/command.d.ts +22 -0
- package/dist/components/command.js +281 -0
- package/dist/components/command.js.map +1 -0
- package/dist/components/context-menu.d.ts +28 -0
- package/dist/components/context-menu.js +233 -0
- package/dist/components/context-menu.js.map +1 -0
- package/dist/components/data-table/index.d.ts +46 -0
- package/dist/components/data-table/index.js +639 -0
- package/dist/components/data-table/index.js.map +1 -0
- package/dist/components/dialog.d.ts +18 -0
- package/dist/components/dialog.js +146 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/drawer.d.ts +16 -0
- package/dist/components/drawer.js +138 -0
- package/dist/components/drawer.js.map +1 -0
- package/dist/components/dropdown-menu.d.ts +28 -0
- package/dist/components/dropdown-menu.js +241 -0
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/empty.d.ts +15 -0
- package/dist/components/empty.js +110 -0
- package/dist/components/empty.js.map +1 -0
- package/dist/components/entity/index.d.ts +160 -0
- package/dist/components/entity/index.js +1671 -0
- package/dist/components/entity/index.js.map +1 -0
- package/dist/components/field.d.ts +30 -0
- package/dist/components/field.js +279 -0
- package/dist/components/field.js.map +1 -0
- package/dist/components/form.d.ts +28 -0
- package/dist/components/form.js +150 -0
- package/dist/components/form.js.map +1 -0
- package/dist/components/hover-card.d.ts +9 -0
- package/dist/components/hover-card.js +48 -0
- package/dist/components/hover-card.js.map +1 -0
- package/dist/components/input-group.d.ts +20 -0
- package/dist/components/input-group.js +257 -0
- package/dist/components/input-group.js.map +1 -0
- package/dist/components/input-otp.d.ts +14 -0
- package/dist/components/input-otp.js +76 -0
- package/dist/components/input-otp.js.map +1 -0
- package/dist/components/input.d.ts +6 -0
- package/dist/components/input.js +29 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/item.d.ts +28 -0
- package/dist/components/item.js +220 -0
- package/dist/components/item.js.map +1 -0
- package/dist/components/jiret-logo.d.ts +13 -0
- package/dist/components/jiret-logo.js +80 -0
- package/dist/components/jiret-logo.js.map +1 -0
- package/dist/components/kbd.d.ts +6 -0
- package/dist/components/kbd.js +39 -0
- package/dist/components/kbd.js.map +1 -0
- package/dist/components/label.d.ts +7 -0
- package/dist/components/label.js +32 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/menubar.d.ts +29 -0
- package/dist/components/menubar.js +261 -0
- package/dist/components/menubar.js.map +1 -0
- package/dist/components/navigation-menu.d.ts +18 -0
- package/dist/components/navigation-menu.js +178 -0
- package/dist/components/navigation-menu.js.map +1 -0
- package/dist/components/pagination.d.ts +18 -0
- package/dist/components/pagination.js +160 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/popover.d.ts +10 -0
- package/dist/components/popover.js +54 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/powered-by.d.ts +5 -0
- package/dist/components/powered-by.js +98 -0
- package/dist/components/powered-by.js.map +1 -0
- package/dist/components/progress.d.ts +7 -0
- package/dist/components/progress.js +41 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/radio-group.d.ts +8 -0
- package/dist/components/radio-group.js +55 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/resizable.d.ts +11 -0
- package/dist/components/resizable.js +58 -0
- package/dist/components/resizable.js.map +1 -0
- package/dist/components/scroll-area.d.ts +8 -0
- package/dist/components/scroll-area.js +70 -0
- package/dist/components/scroll-area.js.map +1 -0
- package/dist/components/section/index.d.ts +14 -0
- package/dist/components/section/index.js +139 -0
- package/dist/components/section/index.js.map +1 -0
- package/dist/components/select.d.ts +18 -0
- package/dist/components/select.js +181 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/separator.d.ts +7 -0
- package/dist/components/separator.js +36 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/sheet.d.ts +16 -0
- package/dist/components/sheet.js +136 -0
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/sidebar.d.ts +75 -0
- package/dist/components/sidebar.js +909 -0
- package/dist/components/sidebar.js.map +1 -0
- package/dist/components/skeleton.d.ts +5 -0
- package/dist/components/skeleton.js +23 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/slider.d.ts +7 -0
- package/dist/components/slider.js +76 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/sonner.d.ts +6 -0
- package/dist/components/sonner.js +41 -0
- package/dist/components/sonner.js.map +1 -0
- package/dist/components/spinner.d.ts +6 -0
- package/dist/components/spinner.js +28 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/spotlight-search.d.ts +25 -0
- package/dist/components/spotlight-search.js +387 -0
- package/dist/components/spotlight-search.js.map +1 -0
- package/dist/components/switch.d.ts +7 -0
- package/dist/components/switch.js +41 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table.d.ts +13 -0
- package/dist/components/table.js +124 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +10 -0
- package/dist/components/tabs.js +77 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/textarea.d.ts +6 -0
- package/dist/components/textarea.js +26 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/theme-toggle.d.ts +8 -0
- package/dist/components/theme-toggle.js +86 -0
- package/dist/components/theme-toggle.js.map +1 -0
- package/dist/components/toggle-group.d.ts +14 -0
- package/dist/components/toggle-group.js +102 -0
- package/dist/components/toggle-group.js.map +1 -0
- package/dist/components/toggle.d.ts +13 -0
- package/dist/components/toggle.js +53 -0
- package/dist/components/toggle.js.map +1 -0
- package/dist/components/tooltip.d.ts +10 -0
- package/dist/components/tooltip.js +65 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/hooks/use-mobile.d.ts +3 -0
- package/dist/hooks/use-mobile.js +22 -0
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +10 -0
- package/dist/lib/utils.js.map +1 -0
- package/package.json +123 -0
- package/src/styles/globals.css +125 -0
|
@@ -0,0 +1,639 @@
|
|
|
1
|
+
// src/components/data-table/data-table.tsx
|
|
2
|
+
import {
|
|
3
|
+
flexRender,
|
|
4
|
+
getCoreRowModel,
|
|
5
|
+
getFacetedRowModel,
|
|
6
|
+
getFacetedUniqueValues,
|
|
7
|
+
getFilteredRowModel,
|
|
8
|
+
getPaginationRowModel,
|
|
9
|
+
getSortedRowModel,
|
|
10
|
+
useReactTable
|
|
11
|
+
} from "@tanstack/react-table";
|
|
12
|
+
import * as React from "react";
|
|
13
|
+
|
|
14
|
+
// src/lib/utils.ts
|
|
15
|
+
import { clsx } from "clsx";
|
|
16
|
+
import { twMerge } from "tailwind-merge";
|
|
17
|
+
function cn(...inputs) {
|
|
18
|
+
return twMerge(clsx(inputs));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// src/components/table.tsx
|
|
22
|
+
import { jsx } from "react/jsx-runtime";
|
|
23
|
+
function Table({ className, ...props }) {
|
|
24
|
+
return /* @__PURE__ */ jsx(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
"data-slot": "table-container",
|
|
28
|
+
className: "relative w-full overflow-x-auto",
|
|
29
|
+
children: /* @__PURE__ */ jsx(
|
|
30
|
+
"table",
|
|
31
|
+
{
|
|
32
|
+
"data-slot": "table",
|
|
33
|
+
className: cn("w-full caption-bottom text-sm", className),
|
|
34
|
+
...props
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
function TableHeader({ className, ...props }) {
|
|
41
|
+
return /* @__PURE__ */ jsx(
|
|
42
|
+
"thead",
|
|
43
|
+
{
|
|
44
|
+
"data-slot": "table-header",
|
|
45
|
+
className: cn("[&_tr]:border-b", className),
|
|
46
|
+
...props
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
function TableBody({ className, ...props }) {
|
|
51
|
+
return /* @__PURE__ */ jsx(
|
|
52
|
+
"tbody",
|
|
53
|
+
{
|
|
54
|
+
"data-slot": "table-body",
|
|
55
|
+
className: cn("[&_tr:last-child]:border-0", className),
|
|
56
|
+
...props
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
function TableRow({ className, ...props }) {
|
|
61
|
+
return /* @__PURE__ */ jsx(
|
|
62
|
+
"tr",
|
|
63
|
+
{
|
|
64
|
+
"data-slot": "table-row",
|
|
65
|
+
className: cn(
|
|
66
|
+
"hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
|
|
67
|
+
className
|
|
68
|
+
),
|
|
69
|
+
...props
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
function TableHead({ className, ...props }) {
|
|
74
|
+
return /* @__PURE__ */ jsx(
|
|
75
|
+
"th",
|
|
76
|
+
{
|
|
77
|
+
"data-slot": "table-head",
|
|
78
|
+
className: cn(
|
|
79
|
+
"text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
80
|
+
className
|
|
81
|
+
),
|
|
82
|
+
...props
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
function TableCell({ className, ...props }) {
|
|
87
|
+
return /* @__PURE__ */ jsx(
|
|
88
|
+
"td",
|
|
89
|
+
{
|
|
90
|
+
"data-slot": "table-cell",
|
|
91
|
+
className: cn(
|
|
92
|
+
"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
93
|
+
className
|
|
94
|
+
),
|
|
95
|
+
...props
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// src/components/data-table/data-table.tsx
|
|
101
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
102
|
+
function DataTable({
|
|
103
|
+
columns,
|
|
104
|
+
data,
|
|
105
|
+
sorting = [],
|
|
106
|
+
onSortingChange,
|
|
107
|
+
columnFilters = [],
|
|
108
|
+
onColumnFiltersChange,
|
|
109
|
+
columnVisibility = {},
|
|
110
|
+
onColumnVisibilityChange,
|
|
111
|
+
rowSelection = {},
|
|
112
|
+
onRowSelectionChange,
|
|
113
|
+
pageSize = 10,
|
|
114
|
+
pageIndex = 0,
|
|
115
|
+
getRowId
|
|
116
|
+
}) {
|
|
117
|
+
const [internalSorting, setInternalSorting] = React.useState(sorting);
|
|
118
|
+
const [internalColumnFilters, setInternalColumnFilters] = React.useState(columnFilters);
|
|
119
|
+
const [internalColumnVisibility, setInternalColumnVisibility] = React.useState(columnVisibility);
|
|
120
|
+
const [internalRowSelection, setInternalRowSelection] = React.useState(rowSelection);
|
|
121
|
+
const table = useReactTable({
|
|
122
|
+
data,
|
|
123
|
+
columns,
|
|
124
|
+
getRowId: getRowId || ((_, index) => String(index)),
|
|
125
|
+
state: {
|
|
126
|
+
sorting: onSortingChange ? sorting : internalSorting,
|
|
127
|
+
columnFilters: onColumnFiltersChange ? columnFilters : internalColumnFilters,
|
|
128
|
+
columnVisibility: onColumnVisibilityChange ? columnVisibility : internalColumnVisibility,
|
|
129
|
+
rowSelection: onRowSelectionChange ? rowSelection : internalRowSelection,
|
|
130
|
+
pagination: { pageIndex, pageSize }
|
|
131
|
+
},
|
|
132
|
+
enableRowSelection: true,
|
|
133
|
+
onSortingChange: (updater) => {
|
|
134
|
+
const newSorting = typeof updater === "function" ? updater(onSortingChange ? sorting : internalSorting) : updater;
|
|
135
|
+
if (onSortingChange) {
|
|
136
|
+
onSortingChange(newSorting);
|
|
137
|
+
} else {
|
|
138
|
+
setInternalSorting(newSorting);
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
onColumnFiltersChange: (updater) => {
|
|
142
|
+
const newFilters = typeof updater === "function" ? updater(
|
|
143
|
+
onColumnFiltersChange ? columnFilters : internalColumnFilters
|
|
144
|
+
) : updater;
|
|
145
|
+
if (onColumnFiltersChange) {
|
|
146
|
+
onColumnFiltersChange(newFilters);
|
|
147
|
+
} else {
|
|
148
|
+
setInternalColumnFilters(newFilters);
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
onColumnVisibilityChange: (updater) => {
|
|
152
|
+
const newVisibility = typeof updater === "function" ? updater(
|
|
153
|
+
onColumnVisibilityChange ? columnVisibility : internalColumnVisibility
|
|
154
|
+
) : updater;
|
|
155
|
+
if (onColumnVisibilityChange) {
|
|
156
|
+
onColumnVisibilityChange(newVisibility);
|
|
157
|
+
} else {
|
|
158
|
+
setInternalColumnVisibility(newVisibility);
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
onRowSelectionChange: (updater) => {
|
|
162
|
+
const newSelection = typeof updater === "function" ? updater(onRowSelectionChange ? rowSelection : internalRowSelection) : updater;
|
|
163
|
+
if (onRowSelectionChange) {
|
|
164
|
+
onRowSelectionChange(newSelection);
|
|
165
|
+
} else {
|
|
166
|
+
setInternalRowSelection(newSelection);
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
getCoreRowModel: getCoreRowModel(),
|
|
170
|
+
getFilteredRowModel: getFilteredRowModel(),
|
|
171
|
+
getPaginationRowModel: getPaginationRowModel(),
|
|
172
|
+
getSortedRowModel: getSortedRowModel(),
|
|
173
|
+
getFacetedRowModel: getFacetedRowModel(),
|
|
174
|
+
getFacetedUniqueValues: getFacetedUniqueValues()
|
|
175
|
+
});
|
|
176
|
+
return /* @__PURE__ */ jsx2("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxs(Table, { children: [
|
|
177
|
+
/* @__PURE__ */ jsx2(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx2(TableRow, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx2(TableHead, { colSpan: header.colSpan, children: header.isPlaceholder ? null : flexRender(
|
|
178
|
+
header.column.columnDef.header,
|
|
179
|
+
header.getContext()
|
|
180
|
+
) }, header.id)) }, headerGroup.id)) }),
|
|
181
|
+
/* @__PURE__ */ jsx2(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx2(
|
|
182
|
+
TableRow,
|
|
183
|
+
{
|
|
184
|
+
"data-state": row.getIsSelected() && "selected",
|
|
185
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx2(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))
|
|
186
|
+
},
|
|
187
|
+
row.id
|
|
188
|
+
)) : /* @__PURE__ */ jsx2(TableRow, { children: /* @__PURE__ */ jsx2(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: "No results." }) }) })
|
|
189
|
+
] }) });
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// src/components/data-table/data-table-column-header.tsx
|
|
193
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
194
|
+
function DataTableColumnHeader({
|
|
195
|
+
column,
|
|
196
|
+
title,
|
|
197
|
+
className
|
|
198
|
+
}) {
|
|
199
|
+
if (!column.getCanSort()) {
|
|
200
|
+
return /* @__PURE__ */ jsx3("div", { className: cn(className), children: title });
|
|
201
|
+
}
|
|
202
|
+
return /* @__PURE__ */ jsx3("div", { className: cn("flex items-center gap-2", className), children: /* @__PURE__ */ jsx3("span", { children: title }) });
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// src/components/data-table/data-table-pagination.tsx
|
|
206
|
+
import {
|
|
207
|
+
IconChevronLeft,
|
|
208
|
+
IconChevronRight,
|
|
209
|
+
IconChevronsLeft,
|
|
210
|
+
IconChevronsRight
|
|
211
|
+
} from "@tabler/icons-react";
|
|
212
|
+
|
|
213
|
+
// src/components/button.tsx
|
|
214
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
215
|
+
import { cva } from "class-variance-authority";
|
|
216
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
217
|
+
var buttonVariants = cva(
|
|
218
|
+
"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",
|
|
219
|
+
{
|
|
220
|
+
variants: {
|
|
221
|
+
variant: {
|
|
222
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
223
|
+
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
224
|
+
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",
|
|
225
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
226
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
227
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
228
|
+
},
|
|
229
|
+
size: {
|
|
230
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
231
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
232
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
233
|
+
icon: "size-9",
|
|
234
|
+
"icon-sm": "size-8",
|
|
235
|
+
"icon-lg": "size-10"
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
defaultVariants: {
|
|
239
|
+
variant: "default",
|
|
240
|
+
size: "default"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
);
|
|
244
|
+
function Button({
|
|
245
|
+
className,
|
|
246
|
+
variant,
|
|
247
|
+
size,
|
|
248
|
+
asChild = false,
|
|
249
|
+
...props
|
|
250
|
+
}) {
|
|
251
|
+
const Comp = asChild ? Slot : "button";
|
|
252
|
+
return /* @__PURE__ */ jsx4(
|
|
253
|
+
Comp,
|
|
254
|
+
{
|
|
255
|
+
"data-slot": "button",
|
|
256
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
257
|
+
...props
|
|
258
|
+
}
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// src/components/select.tsx
|
|
263
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
264
|
+
import { IconCheck, IconChevronDown, IconChevronUp } from "@tabler/icons-react";
|
|
265
|
+
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
266
|
+
function Select({
|
|
267
|
+
...props
|
|
268
|
+
}) {
|
|
269
|
+
return /* @__PURE__ */ jsx5(SelectPrimitive.Root, { "data-slot": "select", ...props });
|
|
270
|
+
}
|
|
271
|
+
function SelectValue({
|
|
272
|
+
...props
|
|
273
|
+
}) {
|
|
274
|
+
return /* @__PURE__ */ jsx5(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
|
|
275
|
+
}
|
|
276
|
+
function SelectTrigger({
|
|
277
|
+
className,
|
|
278
|
+
size = "default",
|
|
279
|
+
children,
|
|
280
|
+
...props
|
|
281
|
+
}) {
|
|
282
|
+
return /* @__PURE__ */ jsxs2(
|
|
283
|
+
SelectPrimitive.Trigger,
|
|
284
|
+
{
|
|
285
|
+
"data-slot": "select-trigger",
|
|
286
|
+
"data-size": size,
|
|
287
|
+
className: cn(
|
|
288
|
+
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
289
|
+
className
|
|
290
|
+
),
|
|
291
|
+
...props,
|
|
292
|
+
children: [
|
|
293
|
+
children,
|
|
294
|
+
/* @__PURE__ */ jsx5(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx5(IconChevronDown, { className: "size-4 opacity-50" }) })
|
|
295
|
+
]
|
|
296
|
+
}
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
function SelectContent({
|
|
300
|
+
className,
|
|
301
|
+
children,
|
|
302
|
+
position = "popper",
|
|
303
|
+
align = "center",
|
|
304
|
+
...props
|
|
305
|
+
}) {
|
|
306
|
+
return /* @__PURE__ */ jsx5(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs2(
|
|
307
|
+
SelectPrimitive.Content,
|
|
308
|
+
{
|
|
309
|
+
"data-slot": "select-content",
|
|
310
|
+
className: cn(
|
|
311
|
+
"bg-popover text-popover-foreground 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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
|
|
312
|
+
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",
|
|
313
|
+
className
|
|
314
|
+
),
|
|
315
|
+
position,
|
|
316
|
+
align,
|
|
317
|
+
...props,
|
|
318
|
+
children: [
|
|
319
|
+
/* @__PURE__ */ jsx5(SelectScrollUpButton, {}),
|
|
320
|
+
/* @__PURE__ */ jsx5(
|
|
321
|
+
SelectPrimitive.Viewport,
|
|
322
|
+
{
|
|
323
|
+
className: cn(
|
|
324
|
+
"p-1",
|
|
325
|
+
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
326
|
+
),
|
|
327
|
+
children
|
|
328
|
+
}
|
|
329
|
+
),
|
|
330
|
+
/* @__PURE__ */ jsx5(SelectScrollDownButton, {})
|
|
331
|
+
]
|
|
332
|
+
}
|
|
333
|
+
) });
|
|
334
|
+
}
|
|
335
|
+
function SelectItem({
|
|
336
|
+
className,
|
|
337
|
+
children,
|
|
338
|
+
...props
|
|
339
|
+
}) {
|
|
340
|
+
return /* @__PURE__ */ jsxs2(
|
|
341
|
+
SelectPrimitive.Item,
|
|
342
|
+
{
|
|
343
|
+
"data-slot": "select-item",
|
|
344
|
+
className: cn(
|
|
345
|
+
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
346
|
+
className
|
|
347
|
+
),
|
|
348
|
+
...props,
|
|
349
|
+
children: [
|
|
350
|
+
/* @__PURE__ */ jsx5("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx5(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx5(IconCheck, { className: "size-4" }) }) }),
|
|
351
|
+
/* @__PURE__ */ jsx5(SelectPrimitive.ItemText, { children })
|
|
352
|
+
]
|
|
353
|
+
}
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
function SelectScrollUpButton({
|
|
357
|
+
className,
|
|
358
|
+
...props
|
|
359
|
+
}) {
|
|
360
|
+
return /* @__PURE__ */ jsx5(
|
|
361
|
+
SelectPrimitive.ScrollUpButton,
|
|
362
|
+
{
|
|
363
|
+
"data-slot": "select-scroll-up-button",
|
|
364
|
+
className: cn(
|
|
365
|
+
"flex cursor-default items-center justify-center py-1",
|
|
366
|
+
className
|
|
367
|
+
),
|
|
368
|
+
...props,
|
|
369
|
+
children: /* @__PURE__ */ jsx5(IconChevronUp, { className: "size-4" })
|
|
370
|
+
}
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
function SelectScrollDownButton({
|
|
374
|
+
className,
|
|
375
|
+
...props
|
|
376
|
+
}) {
|
|
377
|
+
return /* @__PURE__ */ jsx5(
|
|
378
|
+
SelectPrimitive.ScrollDownButton,
|
|
379
|
+
{
|
|
380
|
+
"data-slot": "select-scroll-down-button",
|
|
381
|
+
className: cn(
|
|
382
|
+
"flex cursor-default items-center justify-center py-1",
|
|
383
|
+
className
|
|
384
|
+
),
|
|
385
|
+
...props,
|
|
386
|
+
children: /* @__PURE__ */ jsx5(IconChevronDown, { className: "size-4" })
|
|
387
|
+
}
|
|
388
|
+
);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
// src/components/data-table/data-table-pagination.tsx
|
|
392
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
393
|
+
function DataTablePagination({
|
|
394
|
+
pageIndex,
|
|
395
|
+
pageSize,
|
|
396
|
+
pageCount,
|
|
397
|
+
totalRows,
|
|
398
|
+
selectedRows = 0,
|
|
399
|
+
onPageChange,
|
|
400
|
+
onPageSizeChange,
|
|
401
|
+
pageSizeOptions = [10, 20, 30, 50]
|
|
402
|
+
}) {
|
|
403
|
+
const canPreviousPage = pageIndex > 0;
|
|
404
|
+
const canNextPage = pageIndex < pageCount - 1;
|
|
405
|
+
return /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between px-2 py-4", children: [
|
|
406
|
+
/* @__PURE__ */ jsxs3("div", { className: "text-muted-foreground flex-1 text-sm", children: [
|
|
407
|
+
selectedRows > 0 && /* @__PURE__ */ jsxs3("span", { children: [
|
|
408
|
+
selectedRows,
|
|
409
|
+
" of ",
|
|
410
|
+
totalRows,
|
|
411
|
+
" row(s) selected."
|
|
412
|
+
] }),
|
|
413
|
+
selectedRows === 0 && /* @__PURE__ */ jsxs3("span", { children: [
|
|
414
|
+
totalRows,
|
|
415
|
+
" row(s) total."
|
|
416
|
+
] })
|
|
417
|
+
] }),
|
|
418
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center space-x-6 lg:space-x-8", children: [
|
|
419
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center space-x-2", children: [
|
|
420
|
+
/* @__PURE__ */ jsx6("p", { className: "text-sm font-medium", children: "Rows per page" }),
|
|
421
|
+
/* @__PURE__ */ jsxs3(
|
|
422
|
+
Select,
|
|
423
|
+
{
|
|
424
|
+
value: `${pageSize}`,
|
|
425
|
+
onValueChange: (value) => onPageSizeChange(Number(value)),
|
|
426
|
+
children: [
|
|
427
|
+
/* @__PURE__ */ jsx6(SelectTrigger, { className: "h-8 w-[70px]", children: /* @__PURE__ */ jsx6(SelectValue, { placeholder: pageSize }) }),
|
|
428
|
+
/* @__PURE__ */ jsx6(SelectContent, { side: "top", children: pageSizeOptions.map((size) => /* @__PURE__ */ jsx6(SelectItem, { value: `${size}`, children: size }, size)) })
|
|
429
|
+
]
|
|
430
|
+
}
|
|
431
|
+
)
|
|
432
|
+
] }),
|
|
433
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex w-[100px] items-center justify-center text-sm font-medium", children: [
|
|
434
|
+
"Page ",
|
|
435
|
+
pageIndex + 1,
|
|
436
|
+
" of ",
|
|
437
|
+
pageCount || 1
|
|
438
|
+
] }),
|
|
439
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center space-x-2", children: [
|
|
440
|
+
/* @__PURE__ */ jsxs3(
|
|
441
|
+
Button,
|
|
442
|
+
{
|
|
443
|
+
variant: "outline",
|
|
444
|
+
size: "icon",
|
|
445
|
+
className: "hidden h-8 w-8 lg:flex",
|
|
446
|
+
onClick: () => onPageChange(0),
|
|
447
|
+
disabled: !canPreviousPage,
|
|
448
|
+
children: [
|
|
449
|
+
/* @__PURE__ */ jsx6("span", { className: "sr-only", children: "Go to first page" }),
|
|
450
|
+
/* @__PURE__ */ jsx6(IconChevronsLeft, { className: "h-4 w-4" })
|
|
451
|
+
]
|
|
452
|
+
}
|
|
453
|
+
),
|
|
454
|
+
/* @__PURE__ */ jsxs3(
|
|
455
|
+
Button,
|
|
456
|
+
{
|
|
457
|
+
variant: "outline",
|
|
458
|
+
size: "icon",
|
|
459
|
+
className: "h-8 w-8",
|
|
460
|
+
onClick: () => onPageChange(pageIndex - 1),
|
|
461
|
+
disabled: !canPreviousPage,
|
|
462
|
+
children: [
|
|
463
|
+
/* @__PURE__ */ jsx6("span", { className: "sr-only", children: "Go to previous page" }),
|
|
464
|
+
/* @__PURE__ */ jsx6(IconChevronLeft, { className: "h-4 w-4" })
|
|
465
|
+
]
|
|
466
|
+
}
|
|
467
|
+
),
|
|
468
|
+
/* @__PURE__ */ jsxs3(
|
|
469
|
+
Button,
|
|
470
|
+
{
|
|
471
|
+
variant: "outline",
|
|
472
|
+
size: "icon",
|
|
473
|
+
className: "h-8 w-8",
|
|
474
|
+
onClick: () => onPageChange(pageIndex + 1),
|
|
475
|
+
disabled: !canNextPage,
|
|
476
|
+
children: [
|
|
477
|
+
/* @__PURE__ */ jsx6("span", { className: "sr-only", children: "Go to next page" }),
|
|
478
|
+
/* @__PURE__ */ jsx6(IconChevronRight, { className: "h-4 w-4" })
|
|
479
|
+
]
|
|
480
|
+
}
|
|
481
|
+
),
|
|
482
|
+
/* @__PURE__ */ jsxs3(
|
|
483
|
+
Button,
|
|
484
|
+
{
|
|
485
|
+
variant: "outline",
|
|
486
|
+
size: "icon",
|
|
487
|
+
className: "hidden h-8 w-8 lg:flex",
|
|
488
|
+
onClick: () => onPageChange(pageCount - 1),
|
|
489
|
+
disabled: !canNextPage,
|
|
490
|
+
children: [
|
|
491
|
+
/* @__PURE__ */ jsx6("span", { className: "sr-only", children: "Go to last page" }),
|
|
492
|
+
/* @__PURE__ */ jsx6(IconChevronsRight, { className: "h-4 w-4" })
|
|
493
|
+
]
|
|
494
|
+
}
|
|
495
|
+
)
|
|
496
|
+
] })
|
|
497
|
+
] })
|
|
498
|
+
] });
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
// src/components/data-table/data-table-view-options.tsx
|
|
502
|
+
import { IconSettings } from "@tabler/icons-react";
|
|
503
|
+
|
|
504
|
+
// src/components/dropdown-menu.tsx
|
|
505
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
506
|
+
import { IconCheck as IconCheck2, IconChevronRight as IconChevronRight2, IconCircle } from "@tabler/icons-react";
|
|
507
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
508
|
+
function DropdownMenu({
|
|
509
|
+
...props
|
|
510
|
+
}) {
|
|
511
|
+
return /* @__PURE__ */ jsx7(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
|
|
512
|
+
}
|
|
513
|
+
function DropdownMenuTrigger({
|
|
514
|
+
...props
|
|
515
|
+
}) {
|
|
516
|
+
return /* @__PURE__ */ jsx7(
|
|
517
|
+
DropdownMenuPrimitive.Trigger,
|
|
518
|
+
{
|
|
519
|
+
"data-slot": "dropdown-menu-trigger",
|
|
520
|
+
...props
|
|
521
|
+
}
|
|
522
|
+
);
|
|
523
|
+
}
|
|
524
|
+
function DropdownMenuContent({
|
|
525
|
+
className,
|
|
526
|
+
sideOffset = 4,
|
|
527
|
+
...props
|
|
528
|
+
}) {
|
|
529
|
+
return /* @__PURE__ */ jsx7(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx7(
|
|
530
|
+
DropdownMenuPrimitive.Content,
|
|
531
|
+
{
|
|
532
|
+
"data-slot": "dropdown-menu-content",
|
|
533
|
+
sideOffset,
|
|
534
|
+
className: cn(
|
|
535
|
+
"bg-popover text-popover-foreground 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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
|
|
536
|
+
className
|
|
537
|
+
),
|
|
538
|
+
...props
|
|
539
|
+
}
|
|
540
|
+
) });
|
|
541
|
+
}
|
|
542
|
+
function DropdownMenuCheckboxItem({
|
|
543
|
+
className,
|
|
544
|
+
children,
|
|
545
|
+
checked,
|
|
546
|
+
...props
|
|
547
|
+
}) {
|
|
548
|
+
return /* @__PURE__ */ jsxs4(
|
|
549
|
+
DropdownMenuPrimitive.CheckboxItem,
|
|
550
|
+
{
|
|
551
|
+
"data-slot": "dropdown-menu-checkbox-item",
|
|
552
|
+
className: cn(
|
|
553
|
+
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
554
|
+
className
|
|
555
|
+
),
|
|
556
|
+
checked,
|
|
557
|
+
...props,
|
|
558
|
+
children: [
|
|
559
|
+
/* @__PURE__ */ jsx7("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx7(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx7(IconCheck2, { className: "size-4" }) }) }),
|
|
560
|
+
children
|
|
561
|
+
]
|
|
562
|
+
}
|
|
563
|
+
);
|
|
564
|
+
}
|
|
565
|
+
function DropdownMenuLabel({
|
|
566
|
+
className,
|
|
567
|
+
inset,
|
|
568
|
+
...props
|
|
569
|
+
}) {
|
|
570
|
+
return /* @__PURE__ */ jsx7(
|
|
571
|
+
DropdownMenuPrimitive.Label,
|
|
572
|
+
{
|
|
573
|
+
"data-slot": "dropdown-menu-label",
|
|
574
|
+
"data-inset": inset,
|
|
575
|
+
className: cn(
|
|
576
|
+
"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
|
|
577
|
+
className
|
|
578
|
+
),
|
|
579
|
+
...props
|
|
580
|
+
}
|
|
581
|
+
);
|
|
582
|
+
}
|
|
583
|
+
function DropdownMenuSeparator({
|
|
584
|
+
className,
|
|
585
|
+
...props
|
|
586
|
+
}) {
|
|
587
|
+
return /* @__PURE__ */ jsx7(
|
|
588
|
+
DropdownMenuPrimitive.Separator,
|
|
589
|
+
{
|
|
590
|
+
"data-slot": "dropdown-menu-separator",
|
|
591
|
+
className: cn("bg-border -mx-1 my-1 h-px", className),
|
|
592
|
+
...props
|
|
593
|
+
}
|
|
594
|
+
);
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
// src/components/data-table/data-table-view-options.tsx
|
|
598
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
599
|
+
function DataTableViewOptions({
|
|
600
|
+
table
|
|
601
|
+
}) {
|
|
602
|
+
return /* @__PURE__ */ jsxs5(DropdownMenu, { children: [
|
|
603
|
+
/* @__PURE__ */ jsx8(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs5(
|
|
604
|
+
Button,
|
|
605
|
+
{
|
|
606
|
+
variant: "outline",
|
|
607
|
+
size: "sm",
|
|
608
|
+
className: "ml-auto hidden h-8 lg:flex",
|
|
609
|
+
children: [
|
|
610
|
+
/* @__PURE__ */ jsx8(IconSettings, { className: "mr-2 h-4 w-4" }),
|
|
611
|
+
"View"
|
|
612
|
+
]
|
|
613
|
+
}
|
|
614
|
+
) }),
|
|
615
|
+
/* @__PURE__ */ jsxs5(DropdownMenuContent, { align: "end", className: "w-[150px]", children: [
|
|
616
|
+
/* @__PURE__ */ jsx8(DropdownMenuLabel, { children: "Toggle columns" }),
|
|
617
|
+
/* @__PURE__ */ jsx8(DropdownMenuSeparator, {}),
|
|
618
|
+
table.getAllColumns().filter(
|
|
619
|
+
(column) => typeof column.accessorFn !== "undefined" && column.getCanHide()
|
|
620
|
+
).map((column) => /* @__PURE__ */ jsx8(
|
|
621
|
+
DropdownMenuCheckboxItem,
|
|
622
|
+
{
|
|
623
|
+
className: "capitalize",
|
|
624
|
+
checked: column.getIsVisible(),
|
|
625
|
+
onCheckedChange: (value) => column.toggleVisibility(!!value),
|
|
626
|
+
children: column.id
|
|
627
|
+
},
|
|
628
|
+
column.id
|
|
629
|
+
))
|
|
630
|
+
] })
|
|
631
|
+
] });
|
|
632
|
+
}
|
|
633
|
+
export {
|
|
634
|
+
DataTable,
|
|
635
|
+
DataTableColumnHeader,
|
|
636
|
+
DataTablePagination,
|
|
637
|
+
DataTableViewOptions
|
|
638
|
+
};
|
|
639
|
+
//# sourceMappingURL=index.js.map
|