@potenlab/ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2W3RBVMM.js +698 -0
- package/dist/chunk-2W3RBVMM.js.map +1 -0
- package/dist/chunk-3PDPL453.cjs +42 -0
- package/dist/chunk-3PDPL453.cjs.map +1 -0
- package/dist/chunk-6GVBJTP3.js +3 -0
- package/dist/chunk-6GVBJTP3.js.map +1 -0
- package/dist/chunk-7XPQQR3Z.cjs +586 -0
- package/dist/chunk-7XPQQR3Z.cjs.map +1 -0
- package/dist/chunk-CN4BR5A5.cjs +1442 -0
- package/dist/chunk-CN4BR5A5.cjs.map +1 -0
- package/dist/chunk-DUACVZEX.js +13 -0
- package/dist/chunk-DUACVZEX.js.map +1 -0
- package/dist/chunk-EKVWVJD4.cjs +4 -0
- package/dist/chunk-EKVWVJD4.cjs.map +1 -0
- package/dist/chunk-IIMC6ODV.js +554 -0
- package/dist/chunk-IIMC6ODV.js.map +1 -0
- package/dist/chunk-M67D4PYJ.cjs +4 -0
- package/dist/chunk-M67D4PYJ.cjs.map +1 -0
- package/dist/chunk-O4BML5KD.cjs +744 -0
- package/dist/chunk-O4BML5KD.cjs.map +1 -0
- package/dist/chunk-OF2IE7ZP.cjs +26 -0
- package/dist/chunk-OF2IE7ZP.cjs.map +1 -0
- package/dist/chunk-T2ZO7QTO.js +3 -0
- package/dist/chunk-T2ZO7QTO.js.map +1 -0
- package/dist/chunk-T3VMPVU4.js +20 -0
- package/dist/chunk-T3VMPVU4.js.map +1 -0
- package/dist/chunk-VMWIQIIN.js +1343 -0
- package/dist/chunk-VMWIQIIN.js.map +1 -0
- package/dist/chunk-YDSVKR35.js +23 -0
- package/dist/chunk-YDSVKR35.js.map +1 -0
- package/dist/chunk-YSNZIYC2.cjs +16 -0
- package/dist/chunk-YSNZIYC2.cjs.map +1 -0
- package/dist/components/common/index.cjs +54 -0
- package/dist/components/common/index.cjs.map +1 -0
- package/dist/components/common/index.d.cts +138 -0
- package/dist/components/common/index.d.ts +138 -0
- package/dist/components/common/index.js +5 -0
- package/dist/components/common/index.js.map +1 -0
- package/dist/components/layouts/index.cjs +16 -0
- package/dist/components/layouts/index.cjs.map +1 -0
- package/dist/components/layouts/index.d.cts +15 -0
- package/dist/components/layouts/index.d.ts +15 -0
- package/dist/components/layouts/index.js +3 -0
- package/dist/components/layouts/index.js.map +1 -0
- package/dist/components/ui/index.cjs +503 -0
- package/dist/components/ui/index.cjs.map +1 -0
- package/dist/components/ui/index.d.cts +217 -0
- package/dist/components/ui/index.d.ts +217 -0
- package/dist/components/ui/index.js +6 -0
- package/dist/components/ui/index.js.map +1 -0
- package/dist/hooks/index.cjs +13 -0
- package/dist/hooks/index.cjs.map +1 -0
- package/dist/hooks/index.d.cts +3 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.cjs +571 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/index.cjs +17 -0
- package/dist/lib/index.cjs.map +1 -0
- package/dist/lib/index.d.cts +6 -0
- package/dist/lib/index.d.ts +6 -0
- package/dist/lib/index.js +4 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/styles/globals.css +167 -0
- package/package.json +137 -0
- package/src/styles/globals.css +167 -0
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkO4BML5KD_cjs = require('./chunk-O4BML5KD.cjs');
|
|
4
|
+
var chunkYSNZIYC2_cjs = require('./chunk-YSNZIYC2.cjs');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var React3 = require('react');
|
|
7
|
+
var lucideReact = require('lucide-react');
|
|
8
|
+
var reactTable = require('@tanstack/react-table');
|
|
9
|
+
|
|
10
|
+
function _interopNamespace(e) {
|
|
11
|
+
if (e && e.__esModule) return e;
|
|
12
|
+
var n = Object.create(null);
|
|
13
|
+
if (e) {
|
|
14
|
+
Object.keys(e).forEach(function (k) {
|
|
15
|
+
if (k !== 'default') {
|
|
16
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return e[k]; }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
n.default = e;
|
|
25
|
+
return Object.freeze(n);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
|
|
29
|
+
|
|
30
|
+
function FormField({ id, label, type, value, options, onChange }) {
|
|
31
|
+
if (type === "select") {
|
|
32
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
33
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.Label, { htmlFor: id, children: label }),
|
|
34
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkO4BML5KD_cjs.Select, { value, onValueChange: onChange, children: [
|
|
35
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.SelectTrigger, { id, className: "h-[52px] pr-4", children: /* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.SelectValue, { placeholder: label }) }),
|
|
36
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.SelectContent, { children: options?.map((option) => /* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.SelectItem, { value: option, children: option }, option)) })
|
|
37
|
+
] })
|
|
38
|
+
] });
|
|
39
|
+
}
|
|
40
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
41
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.Label, { htmlFor: id, children: label }),
|
|
42
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
43
|
+
chunkO4BML5KD_cjs.Input,
|
|
44
|
+
{
|
|
45
|
+
id,
|
|
46
|
+
className: "h-[52px]",
|
|
47
|
+
value,
|
|
48
|
+
onChange: (e) => onChange(e.target.value)
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
] });
|
|
52
|
+
}
|
|
53
|
+
function LabeledSwitch({ id, label, checked, onCheckedChange }) {
|
|
54
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
55
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
56
|
+
"label",
|
|
57
|
+
{
|
|
58
|
+
htmlFor: id,
|
|
59
|
+
className: "font-pretendard text-[16px] font-medium text-black select-none cursor-pointer",
|
|
60
|
+
children: label
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.Switch, { id, checked, onCheckedChange })
|
|
64
|
+
] });
|
|
65
|
+
}
|
|
66
|
+
function PageHeader({
|
|
67
|
+
title,
|
|
68
|
+
subtitle,
|
|
69
|
+
badgeCount,
|
|
70
|
+
badgeSuffix = "",
|
|
71
|
+
actionLabel,
|
|
72
|
+
actionIcon: ActionIcon,
|
|
73
|
+
onAction
|
|
74
|
+
}) {
|
|
75
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
76
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-row justify-between items-start", children: [
|
|
77
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
78
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
79
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "font-pretendard text-[32px] font-semibold text-black", children: title }),
|
|
80
|
+
badgeCount !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
81
|
+
chunkO4BML5KD_cjs.Badge,
|
|
82
|
+
{
|
|
83
|
+
variant: "green",
|
|
84
|
+
"aria-label": `Total: ${chunkYSNZIYC2_cjs.formatNumber(badgeCount)}${badgeSuffix}`,
|
|
85
|
+
children: [
|
|
86
|
+
chunkYSNZIYC2_cjs.formatNumber(badgeCount),
|
|
87
|
+
badgeSuffix
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
] }),
|
|
92
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-pretendard text-[18px] font-medium text-subtitle mt-1", children: subtitle })
|
|
93
|
+
] }),
|
|
94
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkO4BML5KD_cjs.Button, { variant: "primary", onClick: onAction, children: [
|
|
95
|
+
ActionIcon && /* @__PURE__ */ jsxRuntime.jsx(ActionIcon, { className: "size-5" }),
|
|
96
|
+
actionLabel
|
|
97
|
+
] })
|
|
98
|
+
] }),
|
|
99
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.Separator, { className: "my-6" })
|
|
100
|
+
] });
|
|
101
|
+
}
|
|
102
|
+
function SearchBar({
|
|
103
|
+
value,
|
|
104
|
+
onChange,
|
|
105
|
+
placeholder = "Search...",
|
|
106
|
+
ariaLabel = "Search",
|
|
107
|
+
className
|
|
108
|
+
}) {
|
|
109
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
110
|
+
chunkO4BML5KD_cjs.Input,
|
|
111
|
+
{
|
|
112
|
+
className: chunkYSNZIYC2_cjs.cn("h-12 rounded-md", className),
|
|
113
|
+
placeholder,
|
|
114
|
+
value,
|
|
115
|
+
onChange: (e) => onChange(e.target.value),
|
|
116
|
+
"aria-label": ariaLabel
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
function PaginationControls({
|
|
121
|
+
currentPage,
|
|
122
|
+
totalPages,
|
|
123
|
+
itemsPerPage,
|
|
124
|
+
onPageChange,
|
|
125
|
+
onItemsPerPageChange,
|
|
126
|
+
labels,
|
|
127
|
+
className
|
|
128
|
+
}) {
|
|
129
|
+
const [pageJumpInput, setPageJumpInput] = React3__namespace.useState("");
|
|
130
|
+
const pageJumpPlaceholder = labels?.pageJumpPlaceholder ?? "Page";
|
|
131
|
+
const pageJumpButton = labels?.pageJumpButton ?? "Go";
|
|
132
|
+
const itemsPerPageLabel = labels?.itemsPerPageLabel ?? "Items per page";
|
|
133
|
+
const itemSuffix = labels?.itemSuffix ?? "";
|
|
134
|
+
const isFirstPage = currentPage <= 1;
|
|
135
|
+
const isLastPage = currentPage >= totalPages;
|
|
136
|
+
function handleGoToFirst() {
|
|
137
|
+
if (!isFirstPage) {
|
|
138
|
+
onPageChange(1);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function handleGoToPrevious() {
|
|
142
|
+
if (!isFirstPage) {
|
|
143
|
+
onPageChange(currentPage - 1);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function handleGoToNext() {
|
|
147
|
+
if (!isLastPage) {
|
|
148
|
+
onPageChange(currentPage + 1);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function handleGoToLast() {
|
|
152
|
+
if (!isLastPage) {
|
|
153
|
+
onPageChange(totalPages);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function handlePageJump() {
|
|
157
|
+
const page = parseInt(pageJumpInput, 10);
|
|
158
|
+
if (!isNaN(page) && page >= 1 && page <= totalPages) {
|
|
159
|
+
onPageChange(page);
|
|
160
|
+
setPageJumpInput("");
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function handlePageJumpKeyDown(e) {
|
|
164
|
+
if (e.key === "Enter") {
|
|
165
|
+
handlePageJump();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function handleItemsPerPageChange(value) {
|
|
169
|
+
const count = parseInt(value, 10);
|
|
170
|
+
if (!isNaN(count)) {
|
|
171
|
+
onItemsPerPageChange(count);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkYSNZIYC2_cjs.cn("flex items-center justify-between", className), children: [
|
|
175
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
176
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
177
|
+
chunkO4BML5KD_cjs.Button,
|
|
178
|
+
{
|
|
179
|
+
variant: "pagination",
|
|
180
|
+
size: "pagination",
|
|
181
|
+
"aria-label": "Go to first page",
|
|
182
|
+
disabled: isFirstPage,
|
|
183
|
+
onClick: handleGoToFirst,
|
|
184
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsLeft, { className: "size-5" })
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
188
|
+
chunkO4BML5KD_cjs.Button,
|
|
189
|
+
{
|
|
190
|
+
variant: "pagination",
|
|
191
|
+
size: "pagination",
|
|
192
|
+
"aria-label": "Previous page",
|
|
193
|
+
disabled: isFirstPage,
|
|
194
|
+
onClick: handleGoToPrevious,
|
|
195
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "size-5" })
|
|
196
|
+
}
|
|
197
|
+
),
|
|
198
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
199
|
+
chunkO4BML5KD_cjs.Button,
|
|
200
|
+
{
|
|
201
|
+
variant: "pagination",
|
|
202
|
+
size: "pagination",
|
|
203
|
+
"aria-label": "Next page",
|
|
204
|
+
disabled: isLastPage,
|
|
205
|
+
onClick: handleGoToNext,
|
|
206
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "size-5" })
|
|
207
|
+
}
|
|
208
|
+
),
|
|
209
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
210
|
+
chunkO4BML5KD_cjs.Button,
|
|
211
|
+
{
|
|
212
|
+
variant: "pagination",
|
|
213
|
+
size: "pagination",
|
|
214
|
+
"aria-label": "Go to last page",
|
|
215
|
+
disabled: isLastPage,
|
|
216
|
+
onClick: handleGoToLast,
|
|
217
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsRight, { className: "size-5" })
|
|
218
|
+
}
|
|
219
|
+
),
|
|
220
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
221
|
+
"span",
|
|
222
|
+
{
|
|
223
|
+
className: "flex items-center gap-1 px-2",
|
|
224
|
+
"aria-live": "polite",
|
|
225
|
+
children: [
|
|
226
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[20px] font-bold", children: currentPage }),
|
|
227
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[16px] font-normal text-muted-fg", children: [
|
|
228
|
+
"/ ",
|
|
229
|
+
totalPages
|
|
230
|
+
] })
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
)
|
|
234
|
+
] }),
|
|
235
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
236
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
237
|
+
chunkO4BML5KD_cjs.Input,
|
|
238
|
+
{
|
|
239
|
+
className: "w-[100px] h-12",
|
|
240
|
+
placeholder: pageJumpPlaceholder,
|
|
241
|
+
value: pageJumpInput,
|
|
242
|
+
onChange: (e) => setPageJumpInput(e.target.value),
|
|
243
|
+
onKeyDown: handlePageJumpKeyDown,
|
|
244
|
+
"aria-label": pageJumpPlaceholder
|
|
245
|
+
}
|
|
246
|
+
),
|
|
247
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
248
|
+
chunkO4BML5KD_cjs.Button,
|
|
249
|
+
{
|
|
250
|
+
variant: "secondary",
|
|
251
|
+
size: "secondary",
|
|
252
|
+
onClick: handlePageJump,
|
|
253
|
+
children: pageJumpButton
|
|
254
|
+
}
|
|
255
|
+
),
|
|
256
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
257
|
+
chunkO4BML5KD_cjs.Select,
|
|
258
|
+
{
|
|
259
|
+
value: String(itemsPerPage),
|
|
260
|
+
onValueChange: handleItemsPerPageChange,
|
|
261
|
+
children: [
|
|
262
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.SelectTrigger, { className: "w-[96px] h-12", "aria-label": itemsPerPageLabel, children: /* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.SelectValue, {}) }),
|
|
263
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkO4BML5KD_cjs.SelectContent, { children: [
|
|
264
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkO4BML5KD_cjs.SelectItem, { value: "10", children: [
|
|
265
|
+
"10",
|
|
266
|
+
itemSuffix
|
|
267
|
+
] }),
|
|
268
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkO4BML5KD_cjs.SelectItem, { value: "20", children: [
|
|
269
|
+
"20",
|
|
270
|
+
itemSuffix
|
|
271
|
+
] }),
|
|
272
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkO4BML5KD_cjs.SelectItem, { value: "50", children: [
|
|
273
|
+
"50",
|
|
274
|
+
itemSuffix
|
|
275
|
+
] })
|
|
276
|
+
] })
|
|
277
|
+
]
|
|
278
|
+
}
|
|
279
|
+
)
|
|
280
|
+
] })
|
|
281
|
+
] });
|
|
282
|
+
}
|
|
283
|
+
function TabNavigation({
|
|
284
|
+
tabs,
|
|
285
|
+
defaultValue,
|
|
286
|
+
value,
|
|
287
|
+
onTabChange,
|
|
288
|
+
className
|
|
289
|
+
}) {
|
|
290
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
291
|
+
chunkO4BML5KD_cjs.Tabs,
|
|
292
|
+
{
|
|
293
|
+
defaultValue,
|
|
294
|
+
value,
|
|
295
|
+
onValueChange: onTabChange,
|
|
296
|
+
className: chunkYSNZIYC2_cjs.cn(className),
|
|
297
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.TabsList, { children: tabs.map((tab) => /* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.TabsTrigger, { value: tab.value, disabled: tab.disabled, children: tab.label }, tab.value)) })
|
|
298
|
+
}
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
function DataTablePagination({
|
|
302
|
+
table,
|
|
303
|
+
pageSizeOptions = [10, 20, 50],
|
|
304
|
+
labels
|
|
305
|
+
}) {
|
|
306
|
+
const [pageJumpInput, setPageJumpInput] = React3__namespace.useState("");
|
|
307
|
+
const pageJumpPlaceholder = labels?.pageJumpPlaceholder ?? "Page";
|
|
308
|
+
const pageJumpButton = labels?.pageJumpButton ?? "Go";
|
|
309
|
+
const itemsPerPageLabel = labels?.itemsPerPageLabel ?? "Items per page";
|
|
310
|
+
const itemSuffix = labels?.itemSuffix ?? "";
|
|
311
|
+
const currentPage = table.getState().pagination.pageIndex + 1;
|
|
312
|
+
const totalPages = table.getPageCount();
|
|
313
|
+
function handlePageJump() {
|
|
314
|
+
const page = parseInt(pageJumpInput, 10);
|
|
315
|
+
if (!isNaN(page) && page >= 1 && page <= totalPages) {
|
|
316
|
+
table.setPageIndex(page - 1);
|
|
317
|
+
setPageJumpInput("");
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
function handlePageJumpKeyDown(e) {
|
|
321
|
+
if (e.key === "Enter") {
|
|
322
|
+
handlePageJump();
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
326
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
327
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
328
|
+
chunkO4BML5KD_cjs.Button,
|
|
329
|
+
{
|
|
330
|
+
variant: "pagination",
|
|
331
|
+
size: "pagination",
|
|
332
|
+
"aria-label": "Go to first page",
|
|
333
|
+
disabled: !table.getCanPreviousPage(),
|
|
334
|
+
onClick: () => table.setPageIndex(0),
|
|
335
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsLeft, { className: "size-5" })
|
|
336
|
+
}
|
|
337
|
+
),
|
|
338
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
339
|
+
chunkO4BML5KD_cjs.Button,
|
|
340
|
+
{
|
|
341
|
+
variant: "pagination",
|
|
342
|
+
size: "pagination",
|
|
343
|
+
"aria-label": "Previous page",
|
|
344
|
+
disabled: !table.getCanPreviousPage(),
|
|
345
|
+
onClick: () => table.previousPage(),
|
|
346
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "size-5" })
|
|
347
|
+
}
|
|
348
|
+
),
|
|
349
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
350
|
+
chunkO4BML5KD_cjs.Button,
|
|
351
|
+
{
|
|
352
|
+
variant: "pagination",
|
|
353
|
+
size: "pagination",
|
|
354
|
+
"aria-label": "Next page",
|
|
355
|
+
disabled: !table.getCanNextPage(),
|
|
356
|
+
onClick: () => table.nextPage(),
|
|
357
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "size-5" })
|
|
358
|
+
}
|
|
359
|
+
),
|
|
360
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
361
|
+
chunkO4BML5KD_cjs.Button,
|
|
362
|
+
{
|
|
363
|
+
variant: "pagination",
|
|
364
|
+
size: "pagination",
|
|
365
|
+
"aria-label": "Go to last page",
|
|
366
|
+
disabled: !table.getCanNextPage(),
|
|
367
|
+
onClick: () => table.setPageIndex(table.getPageCount() - 1),
|
|
368
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsRight, { className: "size-5" })
|
|
369
|
+
}
|
|
370
|
+
),
|
|
371
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1 px-2", "aria-live": "polite", children: [
|
|
372
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[20px] font-bold", children: currentPage }),
|
|
373
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[16px] font-normal text-muted-fg", children: [
|
|
374
|
+
"/ ",
|
|
375
|
+
totalPages
|
|
376
|
+
] })
|
|
377
|
+
] })
|
|
378
|
+
] }),
|
|
379
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
380
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
381
|
+
chunkO4BML5KD_cjs.Input,
|
|
382
|
+
{
|
|
383
|
+
className: "w-[100px] h-12",
|
|
384
|
+
placeholder: pageJumpPlaceholder,
|
|
385
|
+
value: pageJumpInput,
|
|
386
|
+
onChange: (e) => setPageJumpInput(e.target.value),
|
|
387
|
+
onKeyDown: handlePageJumpKeyDown,
|
|
388
|
+
"aria-label": pageJumpPlaceholder
|
|
389
|
+
}
|
|
390
|
+
),
|
|
391
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.Button, { variant: "secondary", size: "secondary", onClick: handlePageJump, children: pageJumpButton }),
|
|
392
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
393
|
+
chunkO4BML5KD_cjs.Select,
|
|
394
|
+
{
|
|
395
|
+
value: String(table.getState().pagination.pageSize),
|
|
396
|
+
onValueChange: (value) => table.setPageSize(Number(value)),
|
|
397
|
+
children: [
|
|
398
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.SelectTrigger, { className: "w-[96px] h-12", "aria-label": itemsPerPageLabel, children: /* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.SelectValue, {}) }),
|
|
399
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.SelectContent, { children: pageSizeOptions.map((size) => /* @__PURE__ */ jsxRuntime.jsxs(chunkO4BML5KD_cjs.SelectItem, { value: String(size), children: [
|
|
400
|
+
size,
|
|
401
|
+
itemSuffix
|
|
402
|
+
] }, size)) })
|
|
403
|
+
]
|
|
404
|
+
}
|
|
405
|
+
)
|
|
406
|
+
] })
|
|
407
|
+
] });
|
|
408
|
+
}
|
|
409
|
+
function DataTable({
|
|
410
|
+
columns,
|
|
411
|
+
data,
|
|
412
|
+
enableSorting = false,
|
|
413
|
+
enableFiltering = false,
|
|
414
|
+
enableRowSelection = false,
|
|
415
|
+
enablePagination = false,
|
|
416
|
+
manualPagination = false,
|
|
417
|
+
rowCount,
|
|
418
|
+
pageSizeOptions,
|
|
419
|
+
onRowClick,
|
|
420
|
+
emptyMessage = "No data available.",
|
|
421
|
+
sorting: sortingProp,
|
|
422
|
+
onSortingChange,
|
|
423
|
+
columnFilters: columnFiltersProp,
|
|
424
|
+
onColumnFiltersChange,
|
|
425
|
+
pagination: paginationProp,
|
|
426
|
+
onPaginationChange,
|
|
427
|
+
rowSelection: rowSelectionProp,
|
|
428
|
+
onRowSelectionChange,
|
|
429
|
+
columnVisibility: columnVisibilityProp,
|
|
430
|
+
onColumnVisibilityChange
|
|
431
|
+
}) {
|
|
432
|
+
const [internalSorting, setInternalSorting] = React3__namespace.useState(
|
|
433
|
+
[]
|
|
434
|
+
);
|
|
435
|
+
const [internalColumnFilters, setInternalColumnFilters] = React3__namespace.useState([]);
|
|
436
|
+
const [internalRowSelection, setInternalRowSelection] = React3__namespace.useState({});
|
|
437
|
+
const [internalColumnVisibility, setInternalColumnVisibility] = React3__namespace.useState({});
|
|
438
|
+
const [internalPagination, setInternalPagination] = React3__namespace.useState({ pageIndex: 0, pageSize: 10 });
|
|
439
|
+
const table = reactTable.useReactTable({
|
|
440
|
+
data,
|
|
441
|
+
columns,
|
|
442
|
+
rowCount: manualPagination ? rowCount : void 0,
|
|
443
|
+
state: {
|
|
444
|
+
sorting: sortingProp ?? internalSorting,
|
|
445
|
+
columnFilters: columnFiltersProp ?? internalColumnFilters,
|
|
446
|
+
rowSelection: rowSelectionProp ?? internalRowSelection,
|
|
447
|
+
columnVisibility: columnVisibilityProp ?? internalColumnVisibility,
|
|
448
|
+
pagination: paginationProp ?? internalPagination
|
|
449
|
+
},
|
|
450
|
+
onSortingChange: onSortingChange ?? setInternalSorting,
|
|
451
|
+
onColumnFiltersChange: onColumnFiltersChange ?? setInternalColumnFilters,
|
|
452
|
+
onRowSelectionChange: onRowSelectionChange ?? setInternalRowSelection,
|
|
453
|
+
onColumnVisibilityChange: onColumnVisibilityChange ?? setInternalColumnVisibility,
|
|
454
|
+
onPaginationChange: onPaginationChange ?? setInternalPagination,
|
|
455
|
+
getCoreRowModel: reactTable.getCoreRowModel(),
|
|
456
|
+
...enableSorting && { getSortedRowModel: reactTable.getSortedRowModel() },
|
|
457
|
+
...enableFiltering && { getFilteredRowModel: reactTable.getFilteredRowModel() },
|
|
458
|
+
...enablePagination && !manualPagination && {
|
|
459
|
+
getPaginationRowModel: reactTable.getPaginationRowModel()
|
|
460
|
+
},
|
|
461
|
+
enableRowSelection,
|
|
462
|
+
manualPagination
|
|
463
|
+
});
|
|
464
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
|
|
465
|
+
/* @__PURE__ */ jsxRuntime.jsxs(chunkO4BML5KD_cjs.Table, { children: [
|
|
466
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
467
|
+
chunkO4BML5KD_cjs.TableRow,
|
|
468
|
+
{
|
|
469
|
+
className: "hover:bg-table-header cursor-default",
|
|
470
|
+
children: headerGroup.headers.map((header) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
471
|
+
chunkO4BML5KD_cjs.TableHead,
|
|
472
|
+
{
|
|
473
|
+
className: chunkYSNZIYC2_cjs.cn(
|
|
474
|
+
header.column.columnDef.meta?.headerClassName ?? header.column.columnDef.meta?.className
|
|
475
|
+
),
|
|
476
|
+
children: header.isPlaceholder ? null : reactTable.flexRender(
|
|
477
|
+
header.column.columnDef.header,
|
|
478
|
+
header.getContext()
|
|
479
|
+
)
|
|
480
|
+
},
|
|
481
|
+
header.id
|
|
482
|
+
))
|
|
483
|
+
},
|
|
484
|
+
headerGroup.id
|
|
485
|
+
)) }),
|
|
486
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
487
|
+
chunkO4BML5KD_cjs.TableRow,
|
|
488
|
+
{
|
|
489
|
+
"data-state": row.getIsSelected() && "selected",
|
|
490
|
+
onClick: onRowClick ? () => onRowClick(row.original) : void 0,
|
|
491
|
+
onKeyDown: onRowClick ? (e) => {
|
|
492
|
+
if (e.key === "Enter") onRowClick(row.original);
|
|
493
|
+
} : void 0,
|
|
494
|
+
tabIndex: onRowClick ? 0 : void 0,
|
|
495
|
+
role: onRowClick ? "link" : void 0,
|
|
496
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
497
|
+
chunkO4BML5KD_cjs.TableCell,
|
|
498
|
+
{
|
|
499
|
+
className: chunkYSNZIYC2_cjs.cn(cell.column.columnDef.meta?.className),
|
|
500
|
+
children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
501
|
+
},
|
|
502
|
+
cell.id
|
|
503
|
+
))
|
|
504
|
+
},
|
|
505
|
+
row.id
|
|
506
|
+
)) : /* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.TableCell, { colSpan: columns.length, className: "h-24 text-center", children: emptyMessage }) }) })
|
|
507
|
+
] }),
|
|
508
|
+
enablePagination && /* @__PURE__ */ jsxRuntime.jsx(DataTablePagination, { table, pageSizeOptions })
|
|
509
|
+
] });
|
|
510
|
+
}
|
|
511
|
+
function DataTableColumnHeader({
|
|
512
|
+
column,
|
|
513
|
+
title,
|
|
514
|
+
className
|
|
515
|
+
}) {
|
|
516
|
+
if (!column.getCanSort()) {
|
|
517
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkYSNZIYC2_cjs.cn(className), children: title });
|
|
518
|
+
}
|
|
519
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
520
|
+
"button",
|
|
521
|
+
{
|
|
522
|
+
type: "button",
|
|
523
|
+
className: chunkYSNZIYC2_cjs.cn("flex items-center gap-1", className),
|
|
524
|
+
onClick: () => column.toggleSorting(column.getIsSorted() === "asc"),
|
|
525
|
+
children: [
|
|
526
|
+
title,
|
|
527
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUpDown, { className: "size-4 text-table-cell" })
|
|
528
|
+
]
|
|
529
|
+
}
|
|
530
|
+
);
|
|
531
|
+
}
|
|
532
|
+
function DataTableToolbar({
|
|
533
|
+
table,
|
|
534
|
+
searchPlaceholder = "Search...",
|
|
535
|
+
searchColumnId,
|
|
536
|
+
className,
|
|
537
|
+
children
|
|
538
|
+
}) {
|
|
539
|
+
const filterValue = searchColumnId ? table.getColumn(searchColumnId)?.getFilterValue() ?? "" : "";
|
|
540
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkYSNZIYC2_cjs.cn("flex items-center gap-2", className), children: [
|
|
541
|
+
searchColumnId && /* @__PURE__ */ jsxRuntime.jsx(
|
|
542
|
+
chunkO4BML5KD_cjs.Input,
|
|
543
|
+
{
|
|
544
|
+
className: "h-12 rounded-md flex-1",
|
|
545
|
+
placeholder: searchPlaceholder,
|
|
546
|
+
value: filterValue,
|
|
547
|
+
onChange: (e) => table.getColumn(searchColumnId)?.setFilterValue(e.target.value),
|
|
548
|
+
"aria-label": searchPlaceholder
|
|
549
|
+
}
|
|
550
|
+
),
|
|
551
|
+
children
|
|
552
|
+
] });
|
|
553
|
+
}
|
|
554
|
+
function DataTableRowActions({ actions }) {
|
|
555
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(chunkO4BML5KD_cjs.DropdownMenu, { children: [
|
|
556
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(chunkO4BML5KD_cjs.Button, { variant: "ghost", size: "icon", className: "size-8 p-0", children: [
|
|
557
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoreHorizontal, { className: "size-4" }),
|
|
558
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Open menu" })
|
|
559
|
+
] }) }),
|
|
560
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkO4BML5KD_cjs.DropdownMenuContent, { align: "end", children: actions.map((action) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
561
|
+
chunkO4BML5KD_cjs.DropdownMenuItem,
|
|
562
|
+
{
|
|
563
|
+
onClick: action.onClick,
|
|
564
|
+
className: chunkYSNZIYC2_cjs.cn(
|
|
565
|
+
action.variant === "destructive" && "text-destructive"
|
|
566
|
+
),
|
|
567
|
+
children: action.label
|
|
568
|
+
},
|
|
569
|
+
action.label
|
|
570
|
+
)) })
|
|
571
|
+
] });
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
exports.DataTable = DataTable;
|
|
575
|
+
exports.DataTableColumnHeader = DataTableColumnHeader;
|
|
576
|
+
exports.DataTablePagination = DataTablePagination;
|
|
577
|
+
exports.DataTableRowActions = DataTableRowActions;
|
|
578
|
+
exports.DataTableToolbar = DataTableToolbar;
|
|
579
|
+
exports.FormField = FormField;
|
|
580
|
+
exports.LabeledSwitch = LabeledSwitch;
|
|
581
|
+
exports.PageHeader = PageHeader;
|
|
582
|
+
exports.PaginationControls = PaginationControls;
|
|
583
|
+
exports.SearchBar = SearchBar;
|
|
584
|
+
exports.TabNavigation = TabNavigation;
|
|
585
|
+
//# sourceMappingURL=chunk-7XPQQR3Z.cjs.map
|
|
586
|
+
//# sourceMappingURL=chunk-7XPQQR3Z.cjs.map
|