@onesaz/ui 0.3.0 → 0.3.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/index.d.ts +130 -3
- package/dist/index.js +1283 -210
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -1671,7 +1671,7 @@ var DialogOverlay = React19.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
1671
1671
|
}
|
|
1672
1672
|
));
|
|
1673
1673
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
1674
|
-
var DialogContent = React19.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs7(DialogPortal, { children: [
|
|
1674
|
+
var DialogContent = React19.forwardRef(({ className, children, hideCloseButton = false, ...props }, ref) => /* @__PURE__ */ jsxs7(DialogPortal, { children: [
|
|
1675
1675
|
/* @__PURE__ */ jsx19(DialogOverlay, {}),
|
|
1676
1676
|
/* @__PURE__ */ jsxs7(
|
|
1677
1677
|
DialogPrimitive.Content,
|
|
@@ -1688,7 +1688,7 @@ var DialogContent = React19.forwardRef(({ className, children, ...props }, ref)
|
|
|
1688
1688
|
...props,
|
|
1689
1689
|
children: [
|
|
1690
1690
|
children,
|
|
1691
|
-
/* @__PURE__ */ jsxs7(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
|
|
1691
|
+
!hideCloseButton && /* @__PURE__ */ jsxs7(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
|
|
1692
1692
|
/* @__PURE__ */ jsxs7(
|
|
1693
1693
|
"svg",
|
|
1694
1694
|
{
|
|
@@ -2188,35 +2188,1106 @@ var Combobox = React23.forwardRef(
|
|
|
2188
2188
|
);
|
|
2189
2189
|
Combobox.displayName = "Combobox";
|
|
2190
2190
|
|
|
2191
|
-
// src/
|
|
2191
|
+
// src/components/data-grid/index.tsx
|
|
2192
2192
|
import * as React24 from "react";
|
|
2193
|
+
import {
|
|
2194
|
+
useReactTable,
|
|
2195
|
+
getCoreRowModel,
|
|
2196
|
+
getPaginationRowModel,
|
|
2197
|
+
getSortedRowModel,
|
|
2198
|
+
getFilteredRowModel,
|
|
2199
|
+
flexRender
|
|
2200
|
+
} from "@tanstack/react-table";
|
|
2201
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
2193
2202
|
import { jsx as jsx24, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2203
|
+
function convertColumns(columns, checkboxSelection) {
|
|
2204
|
+
const tanstackColumns = [];
|
|
2205
|
+
if (checkboxSelection) {
|
|
2206
|
+
tanstackColumns.push({
|
|
2207
|
+
id: "__select__",
|
|
2208
|
+
header: ({ table }) => /* @__PURE__ */ jsx24("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx24(
|
|
2209
|
+
Checkbox,
|
|
2210
|
+
{
|
|
2211
|
+
checked: table.getIsAllPageRowsSelected(),
|
|
2212
|
+
onChange: (e) => table.toggleAllPageRowsSelected(e.target.checked),
|
|
2213
|
+
"aria-label": "Select all"
|
|
2214
|
+
}
|
|
2215
|
+
) }),
|
|
2216
|
+
cell: ({ row }) => /* @__PURE__ */ jsx24("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx24(
|
|
2217
|
+
Checkbox,
|
|
2218
|
+
{
|
|
2219
|
+
checked: row.getIsSelected(),
|
|
2220
|
+
onChange: (e) => row.toggleSelected(e.target.checked),
|
|
2221
|
+
"aria-label": "Select row"
|
|
2222
|
+
}
|
|
2223
|
+
) }),
|
|
2224
|
+
size: 50,
|
|
2225
|
+
enableSorting: false,
|
|
2226
|
+
enableColumnFilter: false,
|
|
2227
|
+
enableHiding: false
|
|
2228
|
+
});
|
|
2229
|
+
}
|
|
2230
|
+
columns.forEach((col) => {
|
|
2231
|
+
if (col.hide) return;
|
|
2232
|
+
const tanstackCol = {
|
|
2233
|
+
id: col.field,
|
|
2234
|
+
accessorFn: (row) => {
|
|
2235
|
+
if (col.valueGetter) {
|
|
2236
|
+
return col.valueGetter({ row, field: col.field });
|
|
2237
|
+
}
|
|
2238
|
+
return row[col.field];
|
|
2239
|
+
},
|
|
2240
|
+
header: col.renderHeader ? () => col.renderHeader({ field: col.field, colDef: col }) : col.headerName || col.field,
|
|
2241
|
+
cell: ({ row, getValue }) => {
|
|
2242
|
+
const value = getValue();
|
|
2243
|
+
if (col.renderCell) {
|
|
2244
|
+
return col.renderCell({
|
|
2245
|
+
row: row.original,
|
|
2246
|
+
value,
|
|
2247
|
+
field: col.field,
|
|
2248
|
+
rowIndex: row.index
|
|
2249
|
+
});
|
|
2250
|
+
}
|
|
2251
|
+
if (col.valueFormatter) {
|
|
2252
|
+
return col.valueFormatter({ value });
|
|
2253
|
+
}
|
|
2254
|
+
return value;
|
|
2255
|
+
},
|
|
2256
|
+
enableSorting: col.sortable !== false,
|
|
2257
|
+
enableHiding: col.hideable !== false,
|
|
2258
|
+
size: col.width,
|
|
2259
|
+
minSize: col.minWidth,
|
|
2260
|
+
maxSize: col.maxWidth,
|
|
2261
|
+
meta: {
|
|
2262
|
+
align: col.align,
|
|
2263
|
+
headerAlign: col.headerAlign,
|
|
2264
|
+
flex: col.flex,
|
|
2265
|
+
headerName: col.headerName || col.field,
|
|
2266
|
+
wrapText: col.wrapText,
|
|
2267
|
+
cellClassName: col.cellClassName
|
|
2268
|
+
}
|
|
2269
|
+
};
|
|
2270
|
+
tanstackColumns.push(tanstackCol);
|
|
2271
|
+
});
|
|
2272
|
+
return tanstackColumns;
|
|
2273
|
+
}
|
|
2274
|
+
var densityRowHeights = {
|
|
2275
|
+
compact: 36,
|
|
2276
|
+
standard: 52,
|
|
2277
|
+
comfortable: 68
|
|
2278
|
+
};
|
|
2279
|
+
function calculateInitialColumnWidths(columns, containerWidth, checkboxSelection, columnSizing) {
|
|
2280
|
+
const widthMap = /* @__PURE__ */ new Map();
|
|
2281
|
+
if (containerWidth <= 0) return widthMap;
|
|
2282
|
+
let remainingWidth = containerWidth;
|
|
2283
|
+
if (checkboxSelection) {
|
|
2284
|
+
widthMap.set("__select__", { id: "__select__", width: 50, minWidth: 50, maxWidth: 50 });
|
|
2285
|
+
remainingWidth -= 50;
|
|
2286
|
+
}
|
|
2287
|
+
const flexColumns = [];
|
|
2288
|
+
let totalFlex = 0;
|
|
2289
|
+
columns.forEach((col) => {
|
|
2290
|
+
if (col.hide) return;
|
|
2291
|
+
const minWidth = col.minWidth || 50;
|
|
2292
|
+
const maxWidth = col.maxWidth || 9999;
|
|
2293
|
+
if (columnSizing[col.field]) {
|
|
2294
|
+
const resizedWidth = columnSizing[col.field];
|
|
2295
|
+
widthMap.set(col.field, {
|
|
2296
|
+
id: col.field,
|
|
2297
|
+
width: resizedWidth,
|
|
2298
|
+
minWidth,
|
|
2299
|
+
maxWidth
|
|
2300
|
+
});
|
|
2301
|
+
remainingWidth -= resizedWidth;
|
|
2302
|
+
return;
|
|
2303
|
+
}
|
|
2304
|
+
if (col.flex && col.flex > 0) {
|
|
2305
|
+
flexColumns.push({ col, flex: col.flex, minWidth, maxWidth });
|
|
2306
|
+
totalFlex += col.flex;
|
|
2307
|
+
remainingWidth -= minWidth;
|
|
2308
|
+
} else {
|
|
2309
|
+
const width = col.width || 100;
|
|
2310
|
+
const finalWidth = Math.max(minWidth, Math.min(width, maxWidth));
|
|
2311
|
+
widthMap.set(col.field, {
|
|
2312
|
+
id: col.field,
|
|
2313
|
+
width: finalWidth,
|
|
2314
|
+
minWidth,
|
|
2315
|
+
maxWidth
|
|
2316
|
+
});
|
|
2317
|
+
remainingWidth -= finalWidth;
|
|
2318
|
+
}
|
|
2319
|
+
});
|
|
2320
|
+
if (flexColumns.length > 0 && totalFlex > 0) {
|
|
2321
|
+
const extraWidth = Math.max(0, remainingWidth);
|
|
2322
|
+
flexColumns.forEach(({ col, flex, minWidth, maxWidth }) => {
|
|
2323
|
+
const proportionalExtra = flex / totalFlex * extraWidth;
|
|
2324
|
+
const calculatedWidth = minWidth + proportionalExtra;
|
|
2325
|
+
const finalWidth = Math.max(minWidth, Math.min(calculatedWidth, maxWidth));
|
|
2326
|
+
widthMap.set(col.field, {
|
|
2327
|
+
id: col.field,
|
|
2328
|
+
width: finalWidth,
|
|
2329
|
+
minWidth,
|
|
2330
|
+
maxWidth,
|
|
2331
|
+
flex
|
|
2332
|
+
});
|
|
2333
|
+
});
|
|
2334
|
+
}
|
|
2335
|
+
return widthMap;
|
|
2336
|
+
}
|
|
2337
|
+
function useColumnWidths(columns, containerWidth, checkboxSelection, columnSizing) {
|
|
2338
|
+
return React24.useMemo(
|
|
2339
|
+
() => calculateInitialColumnWidths(columns, containerWidth, checkboxSelection, columnSizing),
|
|
2340
|
+
[columns, containerWidth, checkboxSelection, columnSizing]
|
|
2341
|
+
);
|
|
2342
|
+
}
|
|
2343
|
+
var ColumnResizeHandle = ({
|
|
2344
|
+
header,
|
|
2345
|
+
isResizing
|
|
2346
|
+
}) => {
|
|
2347
|
+
return /* @__PURE__ */ jsx24(
|
|
2348
|
+
"div",
|
|
2349
|
+
{
|
|
2350
|
+
className: cn(
|
|
2351
|
+
// Wider hit area (8px) for easier clicking, but visually narrow
|
|
2352
|
+
"absolute right-0 top-0 h-full w-2 cursor-col-resize select-none touch-none z-10",
|
|
2353
|
+
// Visual indicator using pseudo-element
|
|
2354
|
+
"after:absolute after:right-0 after:top-0 after:h-full after:w-[2px]",
|
|
2355
|
+
"hover:after:bg-primary-500",
|
|
2356
|
+
isResizing && "after:bg-primary-500"
|
|
2357
|
+
),
|
|
2358
|
+
onMouseDown: header.getResizeHandler(),
|
|
2359
|
+
onTouchStart: header.getResizeHandler(),
|
|
2360
|
+
onClick: (e) => e.stopPropagation()
|
|
2361
|
+
}
|
|
2362
|
+
);
|
|
2363
|
+
};
|
|
2364
|
+
var SortIcon = ({ direction }) => {
|
|
2365
|
+
if (!direction) {
|
|
2366
|
+
return /* @__PURE__ */ jsx24("svg", { className: "ml-1 h-4 w-4 text-muted-foreground/50", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx24("path", { d: "M7 15l5 5 5-5M7 9l5-5 5 5" }) });
|
|
2367
|
+
}
|
|
2368
|
+
return /* @__PURE__ */ jsx24("svg", { className: "ml-1 h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: direction === "asc" ? /* @__PURE__ */ jsx24("path", { d: "M7 14l5-5 5 5" }) : /* @__PURE__ */ jsx24("path", { d: "M7 10l5 5 5-5" }) });
|
|
2369
|
+
};
|
|
2370
|
+
var ColumnVisibilityDropdown = ({
|
|
2371
|
+
table
|
|
2372
|
+
}) => {
|
|
2373
|
+
const [open, setOpen] = React24.useState(false);
|
|
2374
|
+
const dropdownRef = React24.useRef(null);
|
|
2375
|
+
React24.useEffect(() => {
|
|
2376
|
+
const handleClickOutside = (event) => {
|
|
2377
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
2378
|
+
setOpen(false);
|
|
2379
|
+
}
|
|
2380
|
+
};
|
|
2381
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
2382
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2383
|
+
}, []);
|
|
2384
|
+
const allColumns = table.getAllLeafColumns().filter((col) => col.id !== "__select__");
|
|
2385
|
+
return /* @__PURE__ */ jsxs10("div", { className: "relative", ref: dropdownRef, children: [
|
|
2386
|
+
/* @__PURE__ */ jsxs10(
|
|
2387
|
+
Button,
|
|
2388
|
+
{
|
|
2389
|
+
variant: "outline",
|
|
2390
|
+
size: "sm",
|
|
2391
|
+
onClick: () => setOpen(!open),
|
|
2392
|
+
className: "h-9 gap-2",
|
|
2393
|
+
children: [
|
|
2394
|
+
/* @__PURE__ */ jsxs10("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
2395
|
+
/* @__PURE__ */ jsx24("path", { d: "M12 3v18M3 12h18" }),
|
|
2396
|
+
/* @__PURE__ */ jsx24("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
2397
|
+
/* @__PURE__ */ jsx24("path", { d: "M3 9h18M3 15h18M9 3v18M15 3v18" })
|
|
2398
|
+
] }),
|
|
2399
|
+
"Columns"
|
|
2400
|
+
]
|
|
2401
|
+
}
|
|
2402
|
+
),
|
|
2403
|
+
open && /* @__PURE__ */ jsxs10("div", { className: "absolute right-0 top-full mt-1 z-50 min-w-[180px] rounded-md border border-border bg-popover p-2 shadow-md", children: [
|
|
2404
|
+
/* @__PURE__ */ jsx24("div", { className: "text-sm font-medium text-foreground mb-2 px-2", children: "Show/Hide Columns" }),
|
|
2405
|
+
/* @__PURE__ */ jsx24("div", { className: "max-h-[300px] overflow-auto", children: allColumns.map((column) => {
|
|
2406
|
+
const meta = column.columnDef.meta;
|
|
2407
|
+
const headerName = meta?.headerName || column.id;
|
|
2408
|
+
return /* @__PURE__ */ jsxs10(
|
|
2409
|
+
"label",
|
|
2410
|
+
{
|
|
2411
|
+
className: "flex items-center gap-2 px-2 py-1.5 hover:bg-muted rounded cursor-pointer",
|
|
2412
|
+
children: [
|
|
2413
|
+
/* @__PURE__ */ jsx24(
|
|
2414
|
+
Checkbox,
|
|
2415
|
+
{
|
|
2416
|
+
checked: column.getIsVisible(),
|
|
2417
|
+
onChange: (e) => column.toggleVisibility(e.target.checked)
|
|
2418
|
+
}
|
|
2419
|
+
),
|
|
2420
|
+
/* @__PURE__ */ jsx24("span", { className: "text-sm", children: headerName })
|
|
2421
|
+
]
|
|
2422
|
+
},
|
|
2423
|
+
column.id
|
|
2424
|
+
);
|
|
2425
|
+
}) }),
|
|
2426
|
+
/* @__PURE__ */ jsxs10("div", { className: "border-t border-border mt-2 pt-2 flex gap-2 px-2", children: [
|
|
2427
|
+
/* @__PURE__ */ jsx24(
|
|
2428
|
+
Button,
|
|
2429
|
+
{
|
|
2430
|
+
variant: "ghost",
|
|
2431
|
+
size: "sm",
|
|
2432
|
+
className: "flex-1 h-7 text-xs",
|
|
2433
|
+
onClick: () => table.toggleAllColumnsVisible(true),
|
|
2434
|
+
children: "Show All"
|
|
2435
|
+
}
|
|
2436
|
+
),
|
|
2437
|
+
/* @__PURE__ */ jsx24(
|
|
2438
|
+
Button,
|
|
2439
|
+
{
|
|
2440
|
+
variant: "ghost",
|
|
2441
|
+
size: "sm",
|
|
2442
|
+
className: "flex-1 h-7 text-xs",
|
|
2443
|
+
onClick: () => table.toggleAllColumnsVisible(false),
|
|
2444
|
+
children: "Hide All"
|
|
2445
|
+
}
|
|
2446
|
+
)
|
|
2447
|
+
] })
|
|
2448
|
+
] })
|
|
2449
|
+
] });
|
|
2450
|
+
};
|
|
2451
|
+
var DataGridPagination = ({
|
|
2452
|
+
table,
|
|
2453
|
+
pageSizeOptions = [10, 25, 50, 100],
|
|
2454
|
+
rowCount,
|
|
2455
|
+
paginationMode
|
|
2456
|
+
}) => {
|
|
2457
|
+
const pageCount = paginationMode === "server" && rowCount ? Math.ceil(rowCount / table.getState().pagination.pageSize) : table.getPageCount();
|
|
2458
|
+
const currentPage = table.getState().pagination.pageIndex;
|
|
2459
|
+
const totalRows = paginationMode === "server" && rowCount ? rowCount : table.getFilteredRowModel().rows.length;
|
|
2460
|
+
const pageSize = table.getState().pagination.pageSize;
|
|
2461
|
+
const getPageNumbers = () => {
|
|
2462
|
+
const pages = [];
|
|
2463
|
+
const maxVisible = 5;
|
|
2464
|
+
if (pageCount <= maxVisible) {
|
|
2465
|
+
for (let i = 0; i < pageCount; i++) pages.push(i);
|
|
2466
|
+
} else {
|
|
2467
|
+
pages.push(0);
|
|
2468
|
+
if (currentPage > 2) {
|
|
2469
|
+
pages.push("ellipsis");
|
|
2470
|
+
}
|
|
2471
|
+
const start = Math.max(1, currentPage - 1);
|
|
2472
|
+
const end = Math.min(pageCount - 2, currentPage + 1);
|
|
2473
|
+
for (let i = start; i <= end; i++) {
|
|
2474
|
+
if (!pages.includes(i)) pages.push(i);
|
|
2475
|
+
}
|
|
2476
|
+
if (currentPage < pageCount - 3) {
|
|
2477
|
+
pages.push("ellipsis");
|
|
2478
|
+
}
|
|
2479
|
+
if (!pages.includes(pageCount - 1)) {
|
|
2480
|
+
pages.push(pageCount - 1);
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
return pages;
|
|
2484
|
+
};
|
|
2485
|
+
const startRow = currentPage * pageSize + 1;
|
|
2486
|
+
const endRow = Math.min((currentPage + 1) * pageSize, totalRows);
|
|
2487
|
+
return /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-end gap-4 px-4 py-3 border-t border-border bg-background", children: [
|
|
2488
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2 text-sm text-muted-foreground whitespace-nowrap", children: [
|
|
2489
|
+
/* @__PURE__ */ jsx24("span", { children: "Rows per page:" }),
|
|
2490
|
+
/* @__PURE__ */ jsx24(
|
|
2491
|
+
"select",
|
|
2492
|
+
{
|
|
2493
|
+
value: pageSize,
|
|
2494
|
+
onChange: (e) => table.setPageSize(Number(e.target.value)),
|
|
2495
|
+
className: "h-8 rounded-md border border-border bg-background px-2 text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-ring",
|
|
2496
|
+
children: pageSizeOptions.map((size) => /* @__PURE__ */ jsx24("option", { value: size, children: size }, size))
|
|
2497
|
+
}
|
|
2498
|
+
)
|
|
2499
|
+
] }),
|
|
2500
|
+
/* @__PURE__ */ jsxs10("span", { className: "text-sm text-muted-foreground whitespace-nowrap", children: [
|
|
2501
|
+
startRow,
|
|
2502
|
+
"-",
|
|
2503
|
+
endRow,
|
|
2504
|
+
" of ",
|
|
2505
|
+
totalRows
|
|
2506
|
+
] }),
|
|
2507
|
+
/* @__PURE__ */ jsx24(PaginationNamespace, { className: "mx-0 w-auto", children: /* @__PURE__ */ jsxs10(PaginationContent, { children: [
|
|
2508
|
+
/* @__PURE__ */ jsx24(PaginationItem, { children: /* @__PURE__ */ jsx24(
|
|
2509
|
+
Button,
|
|
2510
|
+
{
|
|
2511
|
+
variant: "outline",
|
|
2512
|
+
size: "icon",
|
|
2513
|
+
className: "h-8 w-8",
|
|
2514
|
+
onClick: () => table.setPageIndex(0),
|
|
2515
|
+
disabled: !table.getCanPreviousPage(),
|
|
2516
|
+
children: /* @__PURE__ */ jsx24("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx24("path", { d: "M11 17l-5-5 5-5M18 17l-5-5 5-5" }) })
|
|
2517
|
+
}
|
|
2518
|
+
) }),
|
|
2519
|
+
/* @__PURE__ */ jsx24(PaginationItem, { children: /* @__PURE__ */ jsx24(
|
|
2520
|
+
Button,
|
|
2521
|
+
{
|
|
2522
|
+
variant: "outline",
|
|
2523
|
+
size: "icon",
|
|
2524
|
+
className: "h-8 w-8",
|
|
2525
|
+
onClick: () => table.previousPage(),
|
|
2526
|
+
disabled: !table.getCanPreviousPage(),
|
|
2527
|
+
children: /* @__PURE__ */ jsx24("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx24("path", { d: "M15 18l-6-6 6-6" }) })
|
|
2528
|
+
}
|
|
2529
|
+
) }),
|
|
2530
|
+
getPageNumbers().map(
|
|
2531
|
+
(page, idx) => page === "ellipsis" ? /* @__PURE__ */ jsx24(PaginationItem, { children: /* @__PURE__ */ jsx24(PaginationEllipsis, {}) }, `ellipsis-${idx}`) : /* @__PURE__ */ jsx24(PaginationItem, { children: /* @__PURE__ */ jsx24(
|
|
2532
|
+
PaginationLink,
|
|
2533
|
+
{
|
|
2534
|
+
isActive: page === currentPage,
|
|
2535
|
+
onClick: () => table.setPageIndex(page),
|
|
2536
|
+
children: page + 1
|
|
2537
|
+
}
|
|
2538
|
+
) }, page)
|
|
2539
|
+
),
|
|
2540
|
+
/* @__PURE__ */ jsx24(PaginationItem, { children: /* @__PURE__ */ jsx24(
|
|
2541
|
+
Button,
|
|
2542
|
+
{
|
|
2543
|
+
variant: "outline",
|
|
2544
|
+
size: "icon",
|
|
2545
|
+
className: "h-8 w-8",
|
|
2546
|
+
onClick: () => table.nextPage(),
|
|
2547
|
+
disabled: !table.getCanNextPage(),
|
|
2548
|
+
children: /* @__PURE__ */ jsx24("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx24("path", { d: "M9 18l6-6-6-6" }) })
|
|
2549
|
+
}
|
|
2550
|
+
) }),
|
|
2551
|
+
/* @__PURE__ */ jsx24(PaginationItem, { children: /* @__PURE__ */ jsx24(
|
|
2552
|
+
Button,
|
|
2553
|
+
{
|
|
2554
|
+
variant: "outline",
|
|
2555
|
+
size: "icon",
|
|
2556
|
+
className: "h-8 w-8",
|
|
2557
|
+
onClick: () => table.setPageIndex(pageCount - 1),
|
|
2558
|
+
disabled: !table.getCanNextPage(),
|
|
2559
|
+
children: /* @__PURE__ */ jsx24("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx24("path", { d: "M13 17l5-5-5-5M6 17l5-5-5-5" }) })
|
|
2560
|
+
}
|
|
2561
|
+
) })
|
|
2562
|
+
] }) })
|
|
2563
|
+
] });
|
|
2564
|
+
};
|
|
2565
|
+
var ExportDropdown = ({
|
|
2566
|
+
onExport,
|
|
2567
|
+
rows,
|
|
2568
|
+
columns,
|
|
2569
|
+
fileName = "data-export"
|
|
2570
|
+
}) => {
|
|
2571
|
+
const [open, setOpen] = React24.useState(false);
|
|
2572
|
+
const dropdownRef = React24.useRef(null);
|
|
2573
|
+
React24.useEffect(() => {
|
|
2574
|
+
const handleClickOutside = (event) => {
|
|
2575
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
2576
|
+
setOpen(false);
|
|
2577
|
+
}
|
|
2578
|
+
};
|
|
2579
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
2580
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2581
|
+
}, []);
|
|
2582
|
+
const exportToCSV = () => {
|
|
2583
|
+
const visibleColumns = columns.filter((col) => !col.hide);
|
|
2584
|
+
const headers = visibleColumns.map((col) => col.headerName || col.field);
|
|
2585
|
+
const csvRows = [headers.join(",")];
|
|
2586
|
+
rows.forEach((row) => {
|
|
2587
|
+
const values = visibleColumns.map((col) => {
|
|
2588
|
+
const value = row[col.field];
|
|
2589
|
+
const stringValue = String(value ?? "");
|
|
2590
|
+
if (stringValue.includes(",") || stringValue.includes('"')) {
|
|
2591
|
+
return `"${stringValue.replace(/"/g, '""')}"`;
|
|
2592
|
+
}
|
|
2593
|
+
return stringValue;
|
|
2594
|
+
});
|
|
2595
|
+
csvRows.push(values.join(","));
|
|
2596
|
+
});
|
|
2597
|
+
const csvContent = csvRows.join("\n");
|
|
2598
|
+
const blob = new Blob([csvContent], { type: "text/csv;charset=utf-8;" });
|
|
2599
|
+
const link = document.createElement("a");
|
|
2600
|
+
link.href = URL.createObjectURL(blob);
|
|
2601
|
+
link.download = `${fileName}.csv`;
|
|
2602
|
+
link.click();
|
|
2603
|
+
URL.revokeObjectURL(link.href);
|
|
2604
|
+
setOpen(false);
|
|
2605
|
+
};
|
|
2606
|
+
const exportToJSON = () => {
|
|
2607
|
+
const visibleColumns = columns.filter((col) => !col.hide);
|
|
2608
|
+
const data = rows.map((row) => {
|
|
2609
|
+
const obj = {};
|
|
2610
|
+
visibleColumns.forEach((col) => {
|
|
2611
|
+
obj[col.field] = row[col.field];
|
|
2612
|
+
});
|
|
2613
|
+
return obj;
|
|
2614
|
+
});
|
|
2615
|
+
const jsonContent = JSON.stringify(data, null, 2);
|
|
2616
|
+
const blob = new Blob([jsonContent], { type: "application/json" });
|
|
2617
|
+
const link = document.createElement("a");
|
|
2618
|
+
link.href = URL.createObjectURL(blob);
|
|
2619
|
+
link.download = `${fileName}.json`;
|
|
2620
|
+
link.click();
|
|
2621
|
+
URL.revokeObjectURL(link.href);
|
|
2622
|
+
setOpen(false);
|
|
2623
|
+
};
|
|
2624
|
+
const handleCustomExport = () => {
|
|
2625
|
+
if (onExport) {
|
|
2626
|
+
onExport(rows, columns);
|
|
2627
|
+
}
|
|
2628
|
+
setOpen(false);
|
|
2629
|
+
};
|
|
2630
|
+
return /* @__PURE__ */ jsxs10("div", { className: "relative", ref: dropdownRef, children: [
|
|
2631
|
+
/* @__PURE__ */ jsxs10(
|
|
2632
|
+
Button,
|
|
2633
|
+
{
|
|
2634
|
+
variant: "outline",
|
|
2635
|
+
size: "sm",
|
|
2636
|
+
onClick: () => setOpen(!open),
|
|
2637
|
+
className: "h-9 gap-2",
|
|
2638
|
+
children: [
|
|
2639
|
+
/* @__PURE__ */ jsxs10("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
2640
|
+
/* @__PURE__ */ jsx24("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
2641
|
+
/* @__PURE__ */ jsx24("polyline", { points: "7 10 12 15 17 10" }),
|
|
2642
|
+
/* @__PURE__ */ jsx24("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
|
|
2643
|
+
] }),
|
|
2644
|
+
"Export"
|
|
2645
|
+
]
|
|
2646
|
+
}
|
|
2647
|
+
),
|
|
2648
|
+
open && /* @__PURE__ */ jsxs10("div", { className: "absolute right-0 top-full mt-1 z-50 min-w-[140px] rounded-md border border-border bg-popover p-1 shadow-md", children: [
|
|
2649
|
+
/* @__PURE__ */ jsxs10(
|
|
2650
|
+
"button",
|
|
2651
|
+
{
|
|
2652
|
+
className: "flex w-full items-center gap-2 rounded px-3 py-2 text-sm hover:bg-muted",
|
|
2653
|
+
onClick: exportToCSV,
|
|
2654
|
+
children: [
|
|
2655
|
+
/* @__PURE__ */ jsxs10("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
2656
|
+
/* @__PURE__ */ jsx24("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
2657
|
+
/* @__PURE__ */ jsx24("polyline", { points: "14 2 14 8 20 8" })
|
|
2658
|
+
] }),
|
|
2659
|
+
"Export CSV"
|
|
2660
|
+
]
|
|
2661
|
+
}
|
|
2662
|
+
),
|
|
2663
|
+
/* @__PURE__ */ jsxs10(
|
|
2664
|
+
"button",
|
|
2665
|
+
{
|
|
2666
|
+
className: "flex w-full items-center gap-2 rounded px-3 py-2 text-sm hover:bg-muted",
|
|
2667
|
+
onClick: exportToJSON,
|
|
2668
|
+
children: [
|
|
2669
|
+
/* @__PURE__ */ jsxs10("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
2670
|
+
/* @__PURE__ */ jsx24("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
2671
|
+
/* @__PURE__ */ jsx24("polyline", { points: "14 2 14 8 20 8" })
|
|
2672
|
+
] }),
|
|
2673
|
+
"Export JSON"
|
|
2674
|
+
]
|
|
2675
|
+
}
|
|
2676
|
+
),
|
|
2677
|
+
onExport && /* @__PURE__ */ jsxs10(
|
|
2678
|
+
"button",
|
|
2679
|
+
{
|
|
2680
|
+
className: "flex w-full items-center gap-2 rounded px-3 py-2 text-sm hover:bg-muted",
|
|
2681
|
+
onClick: handleCustomExport,
|
|
2682
|
+
children: [
|
|
2683
|
+
/* @__PURE__ */ jsxs10("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
2684
|
+
/* @__PURE__ */ jsx24("circle", { cx: "12", cy: "12", r: "3" }),
|
|
2685
|
+
/* @__PURE__ */ jsx24("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z" })
|
|
2686
|
+
] }),
|
|
2687
|
+
"Custom Export"
|
|
2688
|
+
]
|
|
2689
|
+
}
|
|
2690
|
+
)
|
|
2691
|
+
] })
|
|
2692
|
+
] });
|
|
2693
|
+
};
|
|
2694
|
+
var MoreOptionsDropdown = ({
|
|
2695
|
+
options
|
|
2696
|
+
}) => {
|
|
2697
|
+
const [open, setOpen] = React24.useState(false);
|
|
2698
|
+
const dropdownRef = React24.useRef(null);
|
|
2699
|
+
React24.useEffect(() => {
|
|
2700
|
+
const handleClickOutside = (event) => {
|
|
2701
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
2702
|
+
setOpen(false);
|
|
2703
|
+
}
|
|
2704
|
+
};
|
|
2705
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
2706
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2707
|
+
}, []);
|
|
2708
|
+
if (options.length === 0) return null;
|
|
2709
|
+
return /* @__PURE__ */ jsxs10("div", { className: "relative", ref: dropdownRef, children: [
|
|
2710
|
+
/* @__PURE__ */ jsx24(
|
|
2711
|
+
Button,
|
|
2712
|
+
{
|
|
2713
|
+
variant: "outline",
|
|
2714
|
+
size: "icon",
|
|
2715
|
+
onClick: () => setOpen(!open),
|
|
2716
|
+
className: "h-9 w-9",
|
|
2717
|
+
children: /* @__PURE__ */ jsxs10("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
2718
|
+
/* @__PURE__ */ jsx24("circle", { cx: "12", cy: "12", r: "1" }),
|
|
2719
|
+
/* @__PURE__ */ jsx24("circle", { cx: "12", cy: "5", r: "1" }),
|
|
2720
|
+
/* @__PURE__ */ jsx24("circle", { cx: "12", cy: "19", r: "1" })
|
|
2721
|
+
] })
|
|
2722
|
+
}
|
|
2723
|
+
),
|
|
2724
|
+
open && /* @__PURE__ */ jsx24("div", { className: "absolute right-0 top-full mt-1 z-50 min-w-[160px] rounded-md border border-border bg-popover p-1 shadow-md", children: options.map((option, index) => /* @__PURE__ */ jsxs10(
|
|
2725
|
+
"button",
|
|
2726
|
+
{
|
|
2727
|
+
className: "flex w-full items-center gap-2 rounded px-3 py-2 text-sm hover:bg-muted",
|
|
2728
|
+
onClick: () => {
|
|
2729
|
+
option.onClick();
|
|
2730
|
+
setOpen(false);
|
|
2731
|
+
},
|
|
2732
|
+
children: [
|
|
2733
|
+
option.icon,
|
|
2734
|
+
option.label
|
|
2735
|
+
]
|
|
2736
|
+
},
|
|
2737
|
+
index
|
|
2738
|
+
)) })
|
|
2739
|
+
] });
|
|
2740
|
+
};
|
|
2741
|
+
var DataGridToolbar = ({
|
|
2742
|
+
title,
|
|
2743
|
+
globalFilter,
|
|
2744
|
+
setGlobalFilter,
|
|
2745
|
+
showQuickFilter = true,
|
|
2746
|
+
showColumnSelector = true,
|
|
2747
|
+
showExport = true,
|
|
2748
|
+
table,
|
|
2749
|
+
rows,
|
|
2750
|
+
columns,
|
|
2751
|
+
onExport,
|
|
2752
|
+
exportFileName,
|
|
2753
|
+
customButtons,
|
|
2754
|
+
moreOptions = []
|
|
2755
|
+
}) => {
|
|
2756
|
+
return /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between px-4 py-3 border-b border-border bg-background", children: [
|
|
2757
|
+
title && /* @__PURE__ */ jsx24("h3", { className: "text-lg font-semibold text-foreground", children: title }),
|
|
2758
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2 ml-auto", children: [
|
|
2759
|
+
showQuickFilter && /* @__PURE__ */ jsx24(
|
|
2760
|
+
Input,
|
|
2761
|
+
{
|
|
2762
|
+
placeholder: "Search...",
|
|
2763
|
+
value: globalFilter ?? "",
|
|
2764
|
+
onChange: (e) => setGlobalFilter(e.target.value),
|
|
2765
|
+
className: "h-9 w-64"
|
|
2766
|
+
}
|
|
2767
|
+
),
|
|
2768
|
+
showColumnSelector && /* @__PURE__ */ jsx24(ColumnVisibilityDropdown, { table }),
|
|
2769
|
+
showExport && /* @__PURE__ */ jsx24(
|
|
2770
|
+
ExportDropdown,
|
|
2771
|
+
{
|
|
2772
|
+
onExport,
|
|
2773
|
+
rows,
|
|
2774
|
+
columns,
|
|
2775
|
+
fileName: exportFileName
|
|
2776
|
+
}
|
|
2777
|
+
),
|
|
2778
|
+
customButtons,
|
|
2779
|
+
moreOptions.length > 0 && /* @__PURE__ */ jsx24(MoreOptionsDropdown, { options: moreOptions })
|
|
2780
|
+
] })
|
|
2781
|
+
] });
|
|
2782
|
+
};
|
|
2783
|
+
var RowRenderer = ({
|
|
2784
|
+
row,
|
|
2785
|
+
rowIndex,
|
|
2786
|
+
rowHeight,
|
|
2787
|
+
showCellVerticalBorder,
|
|
2788
|
+
checkboxSelection,
|
|
2789
|
+
disableRowSelectionOnClick,
|
|
2790
|
+
getRowClassName,
|
|
2791
|
+
style,
|
|
2792
|
+
globalWrapText = false,
|
|
2793
|
+
columnWidths
|
|
2794
|
+
}) => {
|
|
2795
|
+
const customClassName = getRowClassName?.({ row: row.original, rowIndex });
|
|
2796
|
+
return /* @__PURE__ */ jsx24(
|
|
2797
|
+
"tr",
|
|
2798
|
+
{
|
|
2799
|
+
className: cn(
|
|
2800
|
+
"border-b border-border transition-colors hover:bg-muted/50",
|
|
2801
|
+
row.getIsSelected() && "bg-accent/10",
|
|
2802
|
+
customClassName
|
|
2803
|
+
),
|
|
2804
|
+
"data-state": row.getIsSelected() ? "selected" : void 0,
|
|
2805
|
+
style,
|
|
2806
|
+
onClick: () => {
|
|
2807
|
+
if (!disableRowSelectionOnClick && checkboxSelection) {
|
|
2808
|
+
row.toggleSelected();
|
|
2809
|
+
}
|
|
2810
|
+
},
|
|
2811
|
+
children: row.getVisibleCells().map((cell) => {
|
|
2812
|
+
const meta = cell.column.columnDef.meta;
|
|
2813
|
+
const align = meta?.align || "left";
|
|
2814
|
+
const wrapText = meta?.wrapText !== void 0 ? meta.wrapText : globalWrapText;
|
|
2815
|
+
const cellClassName = meta?.cellClassName;
|
|
2816
|
+
const colWidth = columnWidths.get(cell.column.id);
|
|
2817
|
+
const width = colWidth?.width || cell.column.getSize();
|
|
2818
|
+
return /* @__PURE__ */ jsx24(
|
|
2819
|
+
"td",
|
|
2820
|
+
{
|
|
2821
|
+
className: cn(
|
|
2822
|
+
"px-4 overflow-hidden",
|
|
2823
|
+
showCellVerticalBorder && "border-r last:border-r-0 border-border"
|
|
2824
|
+
),
|
|
2825
|
+
style: {
|
|
2826
|
+
height: wrapText ? "auto" : rowHeight,
|
|
2827
|
+
minHeight: rowHeight,
|
|
2828
|
+
textAlign: align,
|
|
2829
|
+
width,
|
|
2830
|
+
maxWidth: colWidth?.maxWidth || width,
|
|
2831
|
+
minWidth: colWidth?.minWidth || cell.column.columnDef.minSize
|
|
2832
|
+
},
|
|
2833
|
+
children: /* @__PURE__ */ jsx24(
|
|
2834
|
+
"div",
|
|
2835
|
+
{
|
|
2836
|
+
className: cn(
|
|
2837
|
+
wrapText ? "whitespace-normal break-words" : "truncate",
|
|
2838
|
+
cellClassName
|
|
2839
|
+
),
|
|
2840
|
+
title: (
|
|
2841
|
+
// Show tooltip for truncated simple text values
|
|
2842
|
+
!wrapText && (typeof cell.getValue() === "string" || typeof cell.getValue() === "number") ? String(cell.getValue()) : void 0
|
|
2843
|
+
),
|
|
2844
|
+
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
2845
|
+
}
|
|
2846
|
+
)
|
|
2847
|
+
},
|
|
2848
|
+
cell.id
|
|
2849
|
+
);
|
|
2850
|
+
})
|
|
2851
|
+
},
|
|
2852
|
+
row.id
|
|
2853
|
+
);
|
|
2854
|
+
};
|
|
2855
|
+
var VirtualizedTableBody = ({
|
|
2856
|
+
table,
|
|
2857
|
+
rowHeight,
|
|
2858
|
+
showCellVerticalBorder,
|
|
2859
|
+
checkboxSelection,
|
|
2860
|
+
disableRowSelectionOnClick,
|
|
2861
|
+
getRowClassName,
|
|
2862
|
+
overscan,
|
|
2863
|
+
parentRef,
|
|
2864
|
+
globalWrapText = false,
|
|
2865
|
+
columnWidths
|
|
2866
|
+
}) => {
|
|
2867
|
+
const rows = table.getRowModel().rows;
|
|
2868
|
+
const virtualizer = useVirtualizer({
|
|
2869
|
+
count: rows.length,
|
|
2870
|
+
getScrollElement: () => parentRef.current,
|
|
2871
|
+
estimateSize: () => rowHeight,
|
|
2872
|
+
overscan
|
|
2873
|
+
});
|
|
2874
|
+
const virtualRows = virtualizer.getVirtualItems();
|
|
2875
|
+
if (rows.length === 0) {
|
|
2876
|
+
return /* @__PURE__ */ jsx24("tbody", { children: /* @__PURE__ */ jsx24("tr", { children: /* @__PURE__ */ jsx24(
|
|
2877
|
+
"td",
|
|
2878
|
+
{
|
|
2879
|
+
colSpan: table.getVisibleLeafColumns().length,
|
|
2880
|
+
className: "h-32 text-center text-muted-foreground",
|
|
2881
|
+
children: "No data available"
|
|
2882
|
+
}
|
|
2883
|
+
) }) });
|
|
2884
|
+
}
|
|
2885
|
+
const paddingTop = virtualRows.length > 0 ? virtualRows[0].start : 0;
|
|
2886
|
+
const paddingBottom = virtualRows.length > 0 ? virtualizer.getTotalSize() - virtualRows[virtualRows.length - 1].end : 0;
|
|
2887
|
+
return /* @__PURE__ */ jsxs10("tbody", { children: [
|
|
2888
|
+
paddingTop > 0 && /* @__PURE__ */ jsx24("tr", { children: /* @__PURE__ */ jsx24(
|
|
2889
|
+
"td",
|
|
2890
|
+
{
|
|
2891
|
+
colSpan: table.getVisibleLeafColumns().length,
|
|
2892
|
+
style: { height: paddingTop, padding: 0, border: "none" }
|
|
2893
|
+
}
|
|
2894
|
+
) }),
|
|
2895
|
+
virtualRows.map((virtualRow) => {
|
|
2896
|
+
const row = rows[virtualRow.index];
|
|
2897
|
+
return /* @__PURE__ */ jsx24(
|
|
2898
|
+
RowRenderer,
|
|
2899
|
+
{
|
|
2900
|
+
row,
|
|
2901
|
+
rowIndex: virtualRow.index,
|
|
2902
|
+
rowHeight,
|
|
2903
|
+
showCellVerticalBorder,
|
|
2904
|
+
checkboxSelection,
|
|
2905
|
+
disableRowSelectionOnClick,
|
|
2906
|
+
getRowClassName,
|
|
2907
|
+
globalWrapText,
|
|
2908
|
+
columnWidths
|
|
2909
|
+
},
|
|
2910
|
+
row.id
|
|
2911
|
+
);
|
|
2912
|
+
}),
|
|
2913
|
+
paddingBottom > 0 && /* @__PURE__ */ jsx24("tr", { children: /* @__PURE__ */ jsx24(
|
|
2914
|
+
"td",
|
|
2915
|
+
{
|
|
2916
|
+
colSpan: table.getVisibleLeafColumns().length,
|
|
2917
|
+
style: { height: paddingBottom, padding: 0, border: "none" }
|
|
2918
|
+
}
|
|
2919
|
+
) })
|
|
2920
|
+
] });
|
|
2921
|
+
};
|
|
2922
|
+
var StandardTableBody = ({
|
|
2923
|
+
table,
|
|
2924
|
+
rowHeight,
|
|
2925
|
+
showCellVerticalBorder,
|
|
2926
|
+
checkboxSelection,
|
|
2927
|
+
disableRowSelectionOnClick,
|
|
2928
|
+
getRowClassName,
|
|
2929
|
+
globalWrapText = false,
|
|
2930
|
+
columnWidths
|
|
2931
|
+
}) => {
|
|
2932
|
+
const rows = table.getRowModel().rows;
|
|
2933
|
+
if (rows.length === 0) {
|
|
2934
|
+
return /* @__PURE__ */ jsx24("tbody", { children: /* @__PURE__ */ jsx24("tr", { children: /* @__PURE__ */ jsx24(
|
|
2935
|
+
"td",
|
|
2936
|
+
{
|
|
2937
|
+
colSpan: table.getVisibleLeafColumns().length,
|
|
2938
|
+
className: "h-32 text-center text-muted-foreground",
|
|
2939
|
+
children: "No data available"
|
|
2940
|
+
}
|
|
2941
|
+
) }) });
|
|
2942
|
+
}
|
|
2943
|
+
return /* @__PURE__ */ jsx24("tbody", { children: rows.map((row, rowIndex) => /* @__PURE__ */ jsx24(
|
|
2944
|
+
RowRenderer,
|
|
2945
|
+
{
|
|
2946
|
+
row,
|
|
2947
|
+
rowIndex,
|
|
2948
|
+
rowHeight,
|
|
2949
|
+
showCellVerticalBorder,
|
|
2950
|
+
checkboxSelection,
|
|
2951
|
+
disableRowSelectionOnClick,
|
|
2952
|
+
getRowClassName,
|
|
2953
|
+
globalWrapText,
|
|
2954
|
+
columnWidths
|
|
2955
|
+
},
|
|
2956
|
+
row.id
|
|
2957
|
+
)) });
|
|
2958
|
+
};
|
|
2959
|
+
function DataGrid({
|
|
2960
|
+
rows,
|
|
2961
|
+
columns,
|
|
2962
|
+
getRowId,
|
|
2963
|
+
loading = false,
|
|
2964
|
+
title,
|
|
2965
|
+
toolBar = false,
|
|
2966
|
+
checkboxSelection = false,
|
|
2967
|
+
rowSelectionModel,
|
|
2968
|
+
onRowSelectionModelChange,
|
|
2969
|
+
disableRowSelectionOnClick = false,
|
|
2970
|
+
columnVisibilityModel,
|
|
2971
|
+
onColumnVisibilityModelChange,
|
|
2972
|
+
paginationMode = "client",
|
|
2973
|
+
paginationModel,
|
|
2974
|
+
onPaginationModelChange,
|
|
2975
|
+
rowCount,
|
|
2976
|
+
pageSizeOptions = [10, 25, 50, 100],
|
|
2977
|
+
sortingMode = "client",
|
|
2978
|
+
filterMode = "client",
|
|
2979
|
+
height = 400,
|
|
2980
|
+
minHeight,
|
|
2981
|
+
maxHeight,
|
|
2982
|
+
density = "standard",
|
|
2983
|
+
showCellVerticalBorder = false,
|
|
2984
|
+
showColumnVerticalBorder = false,
|
|
2985
|
+
hideFooter = false,
|
|
2986
|
+
hideFooterPagination = false,
|
|
2987
|
+
virtualized = false,
|
|
2988
|
+
overscan = 5,
|
|
2989
|
+
wrapText = false,
|
|
2990
|
+
getRowClassName,
|
|
2991
|
+
slotProps,
|
|
2992
|
+
className,
|
|
2993
|
+
sx,
|
|
2994
|
+
autoHeight = false,
|
|
2995
|
+
disableColumnSelector = false,
|
|
2996
|
+
onExport,
|
|
2997
|
+
exportFileName = "data-export",
|
|
2998
|
+
resizableColumns = false,
|
|
2999
|
+
onColumnResize
|
|
3000
|
+
}) {
|
|
3001
|
+
const tableContainerRef = React24.useRef(null);
|
|
3002
|
+
const [sorting, setSorting] = React24.useState([]);
|
|
3003
|
+
const [globalFilter, setGlobalFilter] = React24.useState("");
|
|
3004
|
+
const [rowSelection, setRowSelection] = React24.useState(
|
|
3005
|
+
rowSelectionModel || {}
|
|
3006
|
+
);
|
|
3007
|
+
const [pagination, setPagination] = React24.useState({
|
|
3008
|
+
pageIndex: paginationModel?.page || 0,
|
|
3009
|
+
pageSize: paginationModel?.pageSize || 10
|
|
3010
|
+
});
|
|
3011
|
+
const [columnVisibility, setColumnVisibility] = React24.useState(
|
|
3012
|
+
columnVisibilityModel || {}
|
|
3013
|
+
);
|
|
3014
|
+
const [containerWidth, setContainerWidth] = React24.useState(0);
|
|
3015
|
+
const [columnSizing, setColumnSizing] = React24.useState({});
|
|
3016
|
+
React24.useEffect(() => {
|
|
3017
|
+
const container = tableContainerRef.current;
|
|
3018
|
+
if (!container) return;
|
|
3019
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
3020
|
+
for (const entry of entries) {
|
|
3021
|
+
setContainerWidth(entry.contentRect.width);
|
|
3022
|
+
}
|
|
3023
|
+
});
|
|
3024
|
+
resizeObserver.observe(container);
|
|
3025
|
+
setContainerWidth(container.clientWidth);
|
|
3026
|
+
return () => resizeObserver.disconnect();
|
|
3027
|
+
}, []);
|
|
3028
|
+
const columnWidths = useColumnWidths(columns, containerWidth, checkboxSelection, columnSizing);
|
|
3029
|
+
const tanstackColumns = React24.useMemo(
|
|
3030
|
+
() => convertColumns(columns, checkboxSelection),
|
|
3031
|
+
[columns, checkboxSelection]
|
|
3032
|
+
);
|
|
3033
|
+
React24.useEffect(() => {
|
|
3034
|
+
if (paginationModel) {
|
|
3035
|
+
setPagination({
|
|
3036
|
+
pageIndex: paginationModel.page,
|
|
3037
|
+
pageSize: paginationModel.pageSize
|
|
3038
|
+
});
|
|
3039
|
+
}
|
|
3040
|
+
}, [paginationModel?.page, paginationModel?.pageSize]);
|
|
3041
|
+
React24.useEffect(() => {
|
|
3042
|
+
if (rowSelectionModel) {
|
|
3043
|
+
setRowSelection(rowSelectionModel);
|
|
3044
|
+
}
|
|
3045
|
+
}, [rowSelectionModel]);
|
|
3046
|
+
React24.useEffect(() => {
|
|
3047
|
+
if (columnVisibilityModel) {
|
|
3048
|
+
setColumnVisibility(columnVisibilityModel);
|
|
3049
|
+
}
|
|
3050
|
+
}, [columnVisibilityModel]);
|
|
3051
|
+
const table = useReactTable({
|
|
3052
|
+
data: rows,
|
|
3053
|
+
columns: tanstackColumns,
|
|
3054
|
+
getCoreRowModel: getCoreRowModel(),
|
|
3055
|
+
getPaginationRowModel: virtualized ? void 0 : paginationMode === "client" ? getPaginationRowModel() : void 0,
|
|
3056
|
+
getSortedRowModel: sortingMode === "client" ? getSortedRowModel() : void 0,
|
|
3057
|
+
getFilteredRowModel: filterMode === "client" ? getFilteredRowModel() : void 0,
|
|
3058
|
+
getRowId: getRowId ? (row) => String(getRowId(row)) : void 0,
|
|
3059
|
+
state: {
|
|
3060
|
+
sorting,
|
|
3061
|
+
globalFilter,
|
|
3062
|
+
rowSelection,
|
|
3063
|
+
pagination: virtualized ? void 0 : pagination,
|
|
3064
|
+
columnVisibility,
|
|
3065
|
+
columnSizing
|
|
3066
|
+
},
|
|
3067
|
+
onSortingChange: setSorting,
|
|
3068
|
+
onGlobalFilterChange: setGlobalFilter,
|
|
3069
|
+
onRowSelectionChange: (updater) => {
|
|
3070
|
+
const newValue = typeof updater === "function" ? updater(rowSelection) : updater;
|
|
3071
|
+
setRowSelection(newValue);
|
|
3072
|
+
onRowSelectionModelChange?.(newValue);
|
|
3073
|
+
},
|
|
3074
|
+
onPaginationChange: virtualized ? void 0 : (updater) => {
|
|
3075
|
+
const newValue = typeof updater === "function" ? updater(pagination) : updater;
|
|
3076
|
+
setPagination(newValue);
|
|
3077
|
+
onPaginationModelChange?.({ page: newValue.pageIndex, pageSize: newValue.pageSize });
|
|
3078
|
+
},
|
|
3079
|
+
onColumnVisibilityChange: (updater) => {
|
|
3080
|
+
const newValue = typeof updater === "function" ? updater(columnVisibility) : updater;
|
|
3081
|
+
setColumnVisibility(newValue);
|
|
3082
|
+
onColumnVisibilityModelChange?.(newValue);
|
|
3083
|
+
},
|
|
3084
|
+
// Column resizing - use TanStack Table's built-in handling
|
|
3085
|
+
enableColumnResizing: resizableColumns,
|
|
3086
|
+
columnResizeMode: "onChange",
|
|
3087
|
+
// Real-time resize (vs 'onEnd' which only updates on mouse up)
|
|
3088
|
+
onColumnSizingChange: (updater) => {
|
|
3089
|
+
const newValue = typeof updater === "function" ? updater(columnSizing) : updater;
|
|
3090
|
+
setColumnSizing(newValue);
|
|
3091
|
+
if (onColumnResize) {
|
|
3092
|
+
Object.entries(newValue).forEach(([columnId, width]) => {
|
|
3093
|
+
if (columnSizing[columnId] !== width) {
|
|
3094
|
+
onColumnResize(columnId, width);
|
|
3095
|
+
}
|
|
3096
|
+
});
|
|
3097
|
+
}
|
|
3098
|
+
},
|
|
3099
|
+
enableRowSelection: checkboxSelection,
|
|
3100
|
+
manualPagination: virtualized ? true : paginationMode === "server",
|
|
3101
|
+
manualSorting: sortingMode === "server",
|
|
3102
|
+
manualFiltering: filterMode === "server",
|
|
3103
|
+
pageCount: virtualized ? void 0 : paginationMode === "server" && rowCount ? Math.ceil(rowCount / pagination.pageSize) : void 0
|
|
3104
|
+
});
|
|
3105
|
+
const rowHeight = densityRowHeights[density];
|
|
3106
|
+
const showQuickFilter = slotProps?.toolbar?.showQuickFilter !== false;
|
|
3107
|
+
const showColumnSelector = !disableColumnSelector && slotProps?.toolbar?.showColumnSelector !== false;
|
|
3108
|
+
const showExport = slotProps?.toolbar?.showExport !== false;
|
|
3109
|
+
const customButtons = slotProps?.toolbar?.customButtons;
|
|
3110
|
+
const moreOptions = slotProps?.toolbar?.moreOptions || [];
|
|
3111
|
+
const containerStyle = {
|
|
3112
|
+
...sx
|
|
3113
|
+
};
|
|
3114
|
+
if (!autoHeight) {
|
|
3115
|
+
containerStyle.height = height;
|
|
3116
|
+
if (minHeight) containerStyle.minHeight = minHeight;
|
|
3117
|
+
if (maxHeight) containerStyle.maxHeight = maxHeight;
|
|
3118
|
+
}
|
|
3119
|
+
return /* @__PURE__ */ jsxs10(
|
|
3120
|
+
"div",
|
|
3121
|
+
{
|
|
3122
|
+
className: cn(
|
|
3123
|
+
"rounded-lg border border-border bg-background overflow-hidden flex flex-col",
|
|
3124
|
+
className
|
|
3125
|
+
),
|
|
3126
|
+
style: containerStyle,
|
|
3127
|
+
children: [
|
|
3128
|
+
toolBar && /* @__PURE__ */ jsx24(
|
|
3129
|
+
DataGridToolbar,
|
|
3130
|
+
{
|
|
3131
|
+
title,
|
|
3132
|
+
globalFilter,
|
|
3133
|
+
setGlobalFilter,
|
|
3134
|
+
showQuickFilter,
|
|
3135
|
+
showColumnSelector,
|
|
3136
|
+
showExport,
|
|
3137
|
+
table,
|
|
3138
|
+
rows,
|
|
3139
|
+
columns,
|
|
3140
|
+
onExport,
|
|
3141
|
+
exportFileName,
|
|
3142
|
+
customButtons,
|
|
3143
|
+
moreOptions
|
|
3144
|
+
}
|
|
3145
|
+
),
|
|
3146
|
+
/* @__PURE__ */ jsxs10(
|
|
3147
|
+
"div",
|
|
3148
|
+
{
|
|
3149
|
+
ref: tableContainerRef,
|
|
3150
|
+
className: "relative flex-1 overflow-auto",
|
|
3151
|
+
children: [
|
|
3152
|
+
loading && /* @__PURE__ */ jsx24("div", { className: "absolute inset-0 bg-background/80 flex items-center justify-center z-10", children: /* @__PURE__ */ jsx24(Spinner, { size: "lg" }) }),
|
|
3153
|
+
/* @__PURE__ */ jsxs10("table", { className: "w-full border-collapse table-fixed", children: [
|
|
3154
|
+
/* @__PURE__ */ jsx24("colgroup", { children: table.getVisibleLeafColumns().map((column) => {
|
|
3155
|
+
const colWidth = columnWidths.get(column.id);
|
|
3156
|
+
return /* @__PURE__ */ jsx24(
|
|
3157
|
+
"col",
|
|
3158
|
+
{
|
|
3159
|
+
style: {
|
|
3160
|
+
width: colWidth?.width || column.getSize(),
|
|
3161
|
+
minWidth: colWidth?.minWidth || column.columnDef.minSize,
|
|
3162
|
+
maxWidth: colWidth?.maxWidth || column.columnDef.maxSize
|
|
3163
|
+
}
|
|
3164
|
+
},
|
|
3165
|
+
column.id
|
|
3166
|
+
);
|
|
3167
|
+
}) }),
|
|
3168
|
+
/* @__PURE__ */ jsx24("thead", { className: "sticky top-0 z-[1]", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx24("tr", { className: "bg-muted", children: headerGroup.headers.map((header) => {
|
|
3169
|
+
const meta = header.column.columnDef.meta;
|
|
3170
|
+
const align = meta?.headerAlign || meta?.align || "left";
|
|
3171
|
+
const colWidth = columnWidths.get(header.column.id);
|
|
3172
|
+
const effectiveWidth = colWidth?.width || header.getSize();
|
|
3173
|
+
return /* @__PURE__ */ jsxs10(
|
|
3174
|
+
"th",
|
|
3175
|
+
{
|
|
3176
|
+
className: cn(
|
|
3177
|
+
"px-4 text-left font-medium text-muted-foreground border-b border-border bg-muted overflow-hidden relative",
|
|
3178
|
+
showColumnVerticalBorder && "border-r last:border-r-0",
|
|
3179
|
+
header.column.getCanSort() && "cursor-pointer select-none hover:bg-muted/80",
|
|
3180
|
+
// Add cursor class when resizing
|
|
3181
|
+
header.column.getIsResizing() && "cursor-col-resize"
|
|
3182
|
+
),
|
|
3183
|
+
style: {
|
|
3184
|
+
height: rowHeight,
|
|
3185
|
+
width: effectiveWidth,
|
|
3186
|
+
minWidth: colWidth?.minWidth || header.column.columnDef.minSize,
|
|
3187
|
+
maxWidth: colWidth?.maxWidth || header.column.columnDef.maxSize,
|
|
3188
|
+
textAlign: align
|
|
3189
|
+
},
|
|
3190
|
+
onClick: header.column.getToggleSortingHandler(),
|
|
3191
|
+
children: [
|
|
3192
|
+
/* @__PURE__ */ jsxs10("div", { className: cn(
|
|
3193
|
+
"flex items-center gap-1 truncate",
|
|
3194
|
+
align === "center" && "justify-center",
|
|
3195
|
+
align === "right" && "justify-end"
|
|
3196
|
+
), children: [
|
|
3197
|
+
header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()),
|
|
3198
|
+
header.column.getCanSort() && /* @__PURE__ */ jsx24(SortIcon, { direction: header.column.getIsSorted() })
|
|
3199
|
+
] }),
|
|
3200
|
+
resizableColumns && header.column.id !== "__select__" && /* @__PURE__ */ jsx24(
|
|
3201
|
+
ColumnResizeHandle,
|
|
3202
|
+
{
|
|
3203
|
+
header,
|
|
3204
|
+
isResizing: header.column.getIsResizing()
|
|
3205
|
+
}
|
|
3206
|
+
)
|
|
3207
|
+
]
|
|
3208
|
+
},
|
|
3209
|
+
header.id
|
|
3210
|
+
);
|
|
3211
|
+
}) }, headerGroup.id)) }),
|
|
3212
|
+
virtualized ? /* @__PURE__ */ jsx24(
|
|
3213
|
+
VirtualizedTableBody,
|
|
3214
|
+
{
|
|
3215
|
+
table,
|
|
3216
|
+
rowHeight,
|
|
3217
|
+
showCellVerticalBorder,
|
|
3218
|
+
checkboxSelection,
|
|
3219
|
+
disableRowSelectionOnClick,
|
|
3220
|
+
getRowClassName,
|
|
3221
|
+
overscan,
|
|
3222
|
+
parentRef: tableContainerRef,
|
|
3223
|
+
globalWrapText: wrapText,
|
|
3224
|
+
columnWidths
|
|
3225
|
+
}
|
|
3226
|
+
) : /* @__PURE__ */ jsx24(
|
|
3227
|
+
StandardTableBody,
|
|
3228
|
+
{
|
|
3229
|
+
table,
|
|
3230
|
+
rowHeight,
|
|
3231
|
+
showCellVerticalBorder,
|
|
3232
|
+
checkboxSelection,
|
|
3233
|
+
disableRowSelectionOnClick,
|
|
3234
|
+
getRowClassName,
|
|
3235
|
+
globalWrapText: wrapText,
|
|
3236
|
+
columnWidths
|
|
3237
|
+
}
|
|
3238
|
+
)
|
|
3239
|
+
] })
|
|
3240
|
+
]
|
|
3241
|
+
}
|
|
3242
|
+
),
|
|
3243
|
+
!virtualized && !hideFooter && !hideFooterPagination && /* @__PURE__ */ jsx24(
|
|
3244
|
+
DataGridPagination,
|
|
3245
|
+
{
|
|
3246
|
+
table,
|
|
3247
|
+
pageSizeOptions,
|
|
3248
|
+
rowCount,
|
|
3249
|
+
paginationMode
|
|
3250
|
+
}
|
|
3251
|
+
),
|
|
3252
|
+
virtualized && !hideFooter && /* @__PURE__ */ jsx24("div", { className: "flex items-center justify-end gap-4 px-4 py-3 border-t border-border bg-background", children: /* @__PURE__ */ jsxs10("span", { className: "text-sm text-muted-foreground whitespace-nowrap", children: [
|
|
3253
|
+
table.getFilteredRowModel().rows.length,
|
|
3254
|
+
" total rows (virtualized)"
|
|
3255
|
+
] }) })
|
|
3256
|
+
]
|
|
3257
|
+
}
|
|
3258
|
+
);
|
|
3259
|
+
}
|
|
3260
|
+
DataGrid.displayName = "DataGrid";
|
|
3261
|
+
|
|
3262
|
+
// src/playground.tsx
|
|
3263
|
+
import * as React25 from "react";
|
|
3264
|
+
import { jsx as jsx25, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3265
|
+
var Section = ({ title, children }) => /* @__PURE__ */ jsxs11("div", { className: "mb-8", children: [
|
|
3266
|
+
/* @__PURE__ */ jsx25("h2", { className: "text-xl font-semibold mb-4 text-foreground", children: title }),
|
|
3267
|
+
/* @__PURE__ */ jsx25("div", { className: "p-4 border border-border rounded-lg bg-background", children })
|
|
2197
3268
|
] });
|
|
2198
3269
|
var ThemeToggle = () => {
|
|
2199
3270
|
const { theme, setTheme } = useTheme();
|
|
2200
|
-
return /* @__PURE__ */
|
|
2201
|
-
/* @__PURE__ */
|
|
2202
|
-
/* @__PURE__ */
|
|
2203
|
-
/* @__PURE__ */
|
|
2204
|
-
/* @__PURE__ */
|
|
2205
|
-
/* @__PURE__ */
|
|
2206
|
-
/* @__PURE__ */
|
|
2207
|
-
/* @__PURE__ */
|
|
3271
|
+
return /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
3272
|
+
/* @__PURE__ */ jsx25(Label, { children: "Theme:" }),
|
|
3273
|
+
/* @__PURE__ */ jsxs11(SelectNamespace, { value: theme, onValueChange: (value) => setTheme(value), children: [
|
|
3274
|
+
/* @__PURE__ */ jsx25(SelectTrigger, { className: "w-32", children: /* @__PURE__ */ jsx25(SelectValue, { placeholder: "Select theme" }) }),
|
|
3275
|
+
/* @__PURE__ */ jsxs11(SelectContent, { children: [
|
|
3276
|
+
/* @__PURE__ */ jsx25(SelectItem, { value: "light", children: "Light" }),
|
|
3277
|
+
/* @__PURE__ */ jsx25(SelectItem, { value: "dark", children: "Dark" }),
|
|
3278
|
+
/* @__PURE__ */ jsx25(SelectItem, { value: "system", children: "System" })
|
|
2208
3279
|
] })
|
|
2209
3280
|
] })
|
|
2210
3281
|
] });
|
|
2211
3282
|
};
|
|
2212
3283
|
var PlaygroundContent = () => {
|
|
2213
|
-
const [dialogOpen, setDialogOpen] =
|
|
2214
|
-
const [checkboxChecked, setCheckboxChecked] =
|
|
2215
|
-
const [switchChecked, setSwitchChecked] =
|
|
2216
|
-
const [inputValue, setInputValue] =
|
|
2217
|
-
const [textareaValue, setTextareaValue] =
|
|
2218
|
-
const [selectValue, setSelectValue] =
|
|
2219
|
-
const [comboboxValue, setComboboxValue] =
|
|
3284
|
+
const [dialogOpen, setDialogOpen] = React25.useState(false);
|
|
3285
|
+
const [checkboxChecked, setCheckboxChecked] = React25.useState(false);
|
|
3286
|
+
const [switchChecked, setSwitchChecked] = React25.useState(false);
|
|
3287
|
+
const [inputValue, setInputValue] = React25.useState("");
|
|
3288
|
+
const [textareaValue, setTextareaValue] = React25.useState("");
|
|
3289
|
+
const [selectValue, setSelectValue] = React25.useState("");
|
|
3290
|
+
const [comboboxValue, setComboboxValue] = React25.useState("");
|
|
2220
3291
|
const comboboxOptions = [
|
|
2221
3292
|
{ value: "react", label: "React" },
|
|
2222
3293
|
{ value: "vue", label: "Vue" },
|
|
@@ -2224,35 +3295,35 @@ var PlaygroundContent = () => {
|
|
|
2224
3295
|
{ value: "svelte", label: "Svelte" },
|
|
2225
3296
|
{ value: "solid", label: "SolidJS" }
|
|
2226
3297
|
];
|
|
2227
|
-
return /* @__PURE__ */
|
|
2228
|
-
/* @__PURE__ */
|
|
2229
|
-
/* @__PURE__ */
|
|
2230
|
-
/* @__PURE__ */
|
|
3298
|
+
return /* @__PURE__ */ jsx25("div", { className: "min-h-screen bg-background p-8", children: /* @__PURE__ */ jsxs11("div", { className: "max-w-4xl mx-auto", children: [
|
|
3299
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between mb-8", children: [
|
|
3300
|
+
/* @__PURE__ */ jsx25("h1", { className: "text-3xl font-bold text-foreground", children: "@onesaz/ui Playground" }),
|
|
3301
|
+
/* @__PURE__ */ jsx25(ThemeToggle, {})
|
|
2231
3302
|
] }),
|
|
2232
|
-
/* @__PURE__ */
|
|
2233
|
-
/* @__PURE__ */
|
|
2234
|
-
/* @__PURE__ */
|
|
2235
|
-
/* @__PURE__ */
|
|
2236
|
-
/* @__PURE__ */
|
|
2237
|
-
/* @__PURE__ */
|
|
2238
|
-
/* @__PURE__ */
|
|
2239
|
-
/* @__PURE__ */
|
|
3303
|
+
/* @__PURE__ */ jsxs11(Section, { title: "Button", children: [
|
|
3304
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap gap-4", children: [
|
|
3305
|
+
/* @__PURE__ */ jsx25(Button, { variant: "default", children: "Default" }),
|
|
3306
|
+
/* @__PURE__ */ jsx25(Button, { variant: "destructive", children: "Destructive" }),
|
|
3307
|
+
/* @__PURE__ */ jsx25(Button, { variant: "outline", children: "Outline" }),
|
|
3308
|
+
/* @__PURE__ */ jsx25(Button, { variant: "secondary", children: "Secondary" }),
|
|
3309
|
+
/* @__PURE__ */ jsx25(Button, { variant: "ghost", children: "Ghost" }),
|
|
3310
|
+
/* @__PURE__ */ jsx25(Button, { variant: "link", children: "Link" })
|
|
2240
3311
|
] }),
|
|
2241
|
-
/* @__PURE__ */
|
|
2242
|
-
/* @__PURE__ */
|
|
2243
|
-
/* @__PURE__ */
|
|
2244
|
-
/* @__PURE__ */
|
|
2245
|
-
/* @__PURE__ */
|
|
3312
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap gap-4 mt-4", children: [
|
|
3313
|
+
/* @__PURE__ */ jsx25(Button, { size: "sm", children: "Small" }),
|
|
3314
|
+
/* @__PURE__ */ jsx25(Button, { size: "default", children: "Default" }),
|
|
3315
|
+
/* @__PURE__ */ jsx25(Button, { size: "lg", children: "Large" }),
|
|
3316
|
+
/* @__PURE__ */ jsx25(Button, { size: "icon", children: "\u{1F514}" })
|
|
2246
3317
|
] }),
|
|
2247
|
-
/* @__PURE__ */
|
|
2248
|
-
/* @__PURE__ */
|
|
2249
|
-
/* @__PURE__ */
|
|
3318
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap gap-4 mt-4", children: [
|
|
3319
|
+
/* @__PURE__ */ jsx25(Button, { disabled: true, children: "Disabled" }),
|
|
3320
|
+
/* @__PURE__ */ jsx25(Button, { variant: "outline", disabled: true, children: "Disabled Outline" })
|
|
2250
3321
|
] })
|
|
2251
3322
|
] }),
|
|
2252
|
-
/* @__PURE__ */
|
|
2253
|
-
/* @__PURE__ */
|
|
2254
|
-
/* @__PURE__ */
|
|
2255
|
-
/* @__PURE__ */
|
|
3323
|
+
/* @__PURE__ */ jsx25(Section, { title: "Input", children: /* @__PURE__ */ jsxs11("div", { className: "space-y-4 max-w-md", children: [
|
|
3324
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
3325
|
+
/* @__PURE__ */ jsx25(Label, { htmlFor: "input-default", children: "Default Input" }),
|
|
3326
|
+
/* @__PURE__ */ jsx25(
|
|
2256
3327
|
Input,
|
|
2257
3328
|
{
|
|
2258
3329
|
id: "input-default",
|
|
@@ -2262,19 +3333,19 @@ var PlaygroundContent = () => {
|
|
|
2262
3333
|
}
|
|
2263
3334
|
)
|
|
2264
3335
|
] }),
|
|
2265
|
-
/* @__PURE__ */
|
|
2266
|
-
/* @__PURE__ */
|
|
2267
|
-
/* @__PURE__ */
|
|
3336
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
3337
|
+
/* @__PURE__ */ jsx25(Label, { htmlFor: "input-disabled", children: "Disabled Input" }),
|
|
3338
|
+
/* @__PURE__ */ jsx25(Input, { id: "input-disabled", placeholder: "Disabled...", disabled: true })
|
|
2268
3339
|
] }),
|
|
2269
|
-
/* @__PURE__ */
|
|
2270
|
-
/* @__PURE__ */
|
|
2271
|
-
/* @__PURE__ */
|
|
3340
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
3341
|
+
/* @__PURE__ */ jsx25(Label, { htmlFor: "input-type", children: "Email Input" }),
|
|
3342
|
+
/* @__PURE__ */ jsx25(Input, { id: "input-type", type: "email", placeholder: "email@example.com" })
|
|
2272
3343
|
] })
|
|
2273
3344
|
] }) }),
|
|
2274
|
-
/* @__PURE__ */
|
|
2275
|
-
/* @__PURE__ */
|
|
2276
|
-
/* @__PURE__ */
|
|
2277
|
-
/* @__PURE__ */
|
|
3345
|
+
/* @__PURE__ */ jsx25(Section, { title: "Textarea", children: /* @__PURE__ */ jsxs11("div", { className: "space-y-4 max-w-md", children: [
|
|
3346
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
3347
|
+
/* @__PURE__ */ jsx25(Label, { htmlFor: "textarea-default", children: "Default Textarea" }),
|
|
3348
|
+
/* @__PURE__ */ jsx25(
|
|
2278
3349
|
Textarea,
|
|
2279
3350
|
{
|
|
2280
3351
|
id: "textarea-default",
|
|
@@ -2284,52 +3355,52 @@ var PlaygroundContent = () => {
|
|
|
2284
3355
|
}
|
|
2285
3356
|
)
|
|
2286
3357
|
] }),
|
|
2287
|
-
/* @__PURE__ */
|
|
2288
|
-
/* @__PURE__ */
|
|
2289
|
-
/* @__PURE__ */
|
|
3358
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
3359
|
+
/* @__PURE__ */ jsx25(Label, { htmlFor: "textarea-disabled", children: "Disabled Textarea" }),
|
|
3360
|
+
/* @__PURE__ */ jsx25(Textarea, { id: "textarea-disabled", placeholder: "Disabled...", disabled: true })
|
|
2290
3361
|
] })
|
|
2291
3362
|
] }) }),
|
|
2292
|
-
/* @__PURE__ */
|
|
2293
|
-
/* @__PURE__ */
|
|
2294
|
-
/* @__PURE__ */
|
|
2295
|
-
/* @__PURE__ */
|
|
2296
|
-
/* @__PURE__ */
|
|
2297
|
-
/* @__PURE__ */
|
|
2298
|
-
/* @__PURE__ */
|
|
2299
|
-
/* @__PURE__ */
|
|
2300
|
-
/* @__PURE__ */
|
|
3363
|
+
/* @__PURE__ */ jsx25(Section, { title: "Select", children: /* @__PURE__ */ jsxs11("div", { className: "space-y-4 max-w-md", children: [
|
|
3364
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
3365
|
+
/* @__PURE__ */ jsx25(Label, { children: "Default Select" }),
|
|
3366
|
+
/* @__PURE__ */ jsxs11(SelectNamespace, { value: selectValue, onValueChange: setSelectValue, children: [
|
|
3367
|
+
/* @__PURE__ */ jsx25(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsx25(SelectValue, { placeholder: "Select an option..." }) }),
|
|
3368
|
+
/* @__PURE__ */ jsxs11(SelectContent, { children: [
|
|
3369
|
+
/* @__PURE__ */ jsx25(SelectItem, { value: "option1", children: "Option 1" }),
|
|
3370
|
+
/* @__PURE__ */ jsx25(SelectItem, { value: "option2", children: "Option 2" }),
|
|
3371
|
+
/* @__PURE__ */ jsx25(SelectItem, { value: "option3", children: "Option 3" })
|
|
2301
3372
|
] })
|
|
2302
3373
|
] })
|
|
2303
3374
|
] }),
|
|
2304
|
-
/* @__PURE__ */
|
|
2305
|
-
/* @__PURE__ */
|
|
2306
|
-
/* @__PURE__ */
|
|
2307
|
-
/* @__PURE__ */
|
|
2308
|
-
/* @__PURE__ */
|
|
2309
|
-
/* @__PURE__ */
|
|
2310
|
-
/* @__PURE__ */
|
|
2311
|
-
/* @__PURE__ */
|
|
2312
|
-
/* @__PURE__ */
|
|
3375
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
3376
|
+
/* @__PURE__ */ jsx25(Label, { children: "Grouped Select" }),
|
|
3377
|
+
/* @__PURE__ */ jsxs11(SelectNamespace, { children: [
|
|
3378
|
+
/* @__PURE__ */ jsx25(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsx25(SelectValue, { placeholder: "Select a food..." }) }),
|
|
3379
|
+
/* @__PURE__ */ jsxs11(SelectContent, { children: [
|
|
3380
|
+
/* @__PURE__ */ jsxs11(SelectGroup, { children: [
|
|
3381
|
+
/* @__PURE__ */ jsx25(SelectLabel, { children: "Fruits" }),
|
|
3382
|
+
/* @__PURE__ */ jsx25(SelectItem, { value: "apple", children: "Apple" }),
|
|
3383
|
+
/* @__PURE__ */ jsx25(SelectItem, { value: "banana", children: "Banana" })
|
|
2313
3384
|
] }),
|
|
2314
|
-
/* @__PURE__ */
|
|
2315
|
-
/* @__PURE__ */
|
|
2316
|
-
/* @__PURE__ */
|
|
2317
|
-
/* @__PURE__ */
|
|
3385
|
+
/* @__PURE__ */ jsxs11(SelectGroup, { children: [
|
|
3386
|
+
/* @__PURE__ */ jsx25(SelectLabel, { children: "Vegetables" }),
|
|
3387
|
+
/* @__PURE__ */ jsx25(SelectItem, { value: "carrot", children: "Carrot" }),
|
|
3388
|
+
/* @__PURE__ */ jsx25(SelectItem, { value: "potato", children: "Potato" })
|
|
2318
3389
|
] })
|
|
2319
3390
|
] })
|
|
2320
3391
|
] })
|
|
2321
3392
|
] }),
|
|
2322
|
-
/* @__PURE__ */
|
|
2323
|
-
/* @__PURE__ */
|
|
2324
|
-
/* @__PURE__ */
|
|
2325
|
-
/* @__PURE__ */
|
|
2326
|
-
/* @__PURE__ */
|
|
3393
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
3394
|
+
/* @__PURE__ */ jsx25(Label, { children: "Disabled Select" }),
|
|
3395
|
+
/* @__PURE__ */ jsxs11(SelectNamespace, { disabled: true, children: [
|
|
3396
|
+
/* @__PURE__ */ jsx25(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsx25(SelectValue, { placeholder: "Disabled..." }) }),
|
|
3397
|
+
/* @__PURE__ */ jsx25(SelectContent, { children: /* @__PURE__ */ jsx25(SelectItem, { value: "none", children: "None" }) })
|
|
2327
3398
|
] })
|
|
2328
3399
|
] })
|
|
2329
3400
|
] }) }),
|
|
2330
|
-
/* @__PURE__ */
|
|
2331
|
-
/* @__PURE__ */
|
|
2332
|
-
/* @__PURE__ */
|
|
3401
|
+
/* @__PURE__ */ jsx25(Section, { title: "Combobox (Searchable Select)", children: /* @__PURE__ */ jsx25("div", { className: "space-y-4 max-w-md", children: /* @__PURE__ */ jsxs11("div", { children: [
|
|
3402
|
+
/* @__PURE__ */ jsx25(Label, { children: "Framework" }),
|
|
3403
|
+
/* @__PURE__ */ jsx25(
|
|
2333
3404
|
Combobox,
|
|
2334
3405
|
{
|
|
2335
3406
|
options: comboboxOptions,
|
|
@@ -2339,9 +3410,9 @@ var PlaygroundContent = () => {
|
|
|
2339
3410
|
}
|
|
2340
3411
|
)
|
|
2341
3412
|
] }) }) }),
|
|
2342
|
-
/* @__PURE__ */
|
|
2343
|
-
/* @__PURE__ */
|
|
2344
|
-
/* @__PURE__ */
|
|
3413
|
+
/* @__PURE__ */ jsx25(Section, { title: "Checkbox & Switch", children: /* @__PURE__ */ jsxs11("div", { className: "space-y-4", children: [
|
|
3414
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
3415
|
+
/* @__PURE__ */ jsx25(
|
|
2345
3416
|
Checkbox,
|
|
2346
3417
|
{
|
|
2347
3418
|
id: "checkbox",
|
|
@@ -2349,15 +3420,15 @@ var PlaygroundContent = () => {
|
|
|
2349
3420
|
onChange: (e) => setCheckboxChecked(e.target.checked)
|
|
2350
3421
|
}
|
|
2351
3422
|
),
|
|
2352
|
-
/* @__PURE__ */
|
|
3423
|
+
/* @__PURE__ */ jsx25(Label, { htmlFor: "checkbox", children: "Accept terms and conditions" })
|
|
2353
3424
|
] }),
|
|
2354
|
-
/* @__PURE__ */
|
|
2355
|
-
/* @__PURE__ */
|
|
2356
|
-
/* @__PURE__ */
|
|
3425
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
3426
|
+
/* @__PURE__ */ jsx25(Checkbox, { id: "checkbox-disabled", disabled: true }),
|
|
3427
|
+
/* @__PURE__ */ jsx25(Label, { htmlFor: "checkbox-disabled", children: "Disabled checkbox" })
|
|
2357
3428
|
] }),
|
|
2358
|
-
/* @__PURE__ */
|
|
2359
|
-
/* @__PURE__ */
|
|
2360
|
-
/* @__PURE__ */
|
|
3429
|
+
/* @__PURE__ */ jsx25(Separator, {}),
|
|
3430
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
3431
|
+
/* @__PURE__ */ jsx25(
|
|
2361
3432
|
Switch,
|
|
2362
3433
|
{
|
|
2363
3434
|
id: "switch",
|
|
@@ -2365,160 +3436,160 @@ var PlaygroundContent = () => {
|
|
|
2365
3436
|
onChange: (e) => setSwitchChecked(e.target.checked)
|
|
2366
3437
|
}
|
|
2367
3438
|
),
|
|
2368
|
-
/* @__PURE__ */
|
|
3439
|
+
/* @__PURE__ */ jsx25(Label, { htmlFor: "switch", children: "Enable notifications" })
|
|
2369
3440
|
] }),
|
|
2370
|
-
/* @__PURE__ */
|
|
2371
|
-
/* @__PURE__ */
|
|
2372
|
-
/* @__PURE__ */
|
|
3441
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
3442
|
+
/* @__PURE__ */ jsx25(Switch, { id: "switch-disabled", disabled: true }),
|
|
3443
|
+
/* @__PURE__ */ jsx25(Label, { htmlFor: "switch-disabled", children: "Disabled switch" })
|
|
2373
3444
|
] })
|
|
2374
3445
|
] }) }),
|
|
2375
|
-
/* @__PURE__ */
|
|
2376
|
-
/* @__PURE__ */
|
|
2377
|
-
/* @__PURE__ */
|
|
2378
|
-
/* @__PURE__ */
|
|
2379
|
-
/* @__PURE__ */
|
|
3446
|
+
/* @__PURE__ */ jsx25(Section, { title: "Badge", children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap gap-4", children: [
|
|
3447
|
+
/* @__PURE__ */ jsx25(Badge, { children: "Default" }),
|
|
3448
|
+
/* @__PURE__ */ jsx25(Badge, { variant: "secondary", children: "Secondary" }),
|
|
3449
|
+
/* @__PURE__ */ jsx25(Badge, { variant: "destructive", children: "Destructive" }),
|
|
3450
|
+
/* @__PURE__ */ jsx25(Badge, { variant: "outline", children: "Outline" })
|
|
2380
3451
|
] }) }),
|
|
2381
|
-
/* @__PURE__ */
|
|
2382
|
-
/* @__PURE__ */
|
|
2383
|
-
/* @__PURE__ */
|
|
2384
|
-
/* @__PURE__ */
|
|
2385
|
-
/* @__PURE__ */
|
|
3452
|
+
/* @__PURE__ */ jsx25(Section, { title: "Card", children: /* @__PURE__ */ jsxs11("div", { className: "grid gap-4 md:grid-cols-2", children: [
|
|
3453
|
+
/* @__PURE__ */ jsxs11(Card, { children: [
|
|
3454
|
+
/* @__PURE__ */ jsxs11(CardHeader, { children: [
|
|
3455
|
+
/* @__PURE__ */ jsx25(CardTitle, { children: "Card Title" }),
|
|
3456
|
+
/* @__PURE__ */ jsx25(CardDescription, { children: "Card description goes here" })
|
|
2386
3457
|
] }),
|
|
2387
|
-
/* @__PURE__ */
|
|
2388
|
-
/* @__PURE__ */
|
|
2389
|
-
/* @__PURE__ */
|
|
2390
|
-
/* @__PURE__ */
|
|
3458
|
+
/* @__PURE__ */ jsx25(CardContent, { children: /* @__PURE__ */ jsx25("p", { className: "text-foreground", children: "This is the card content area." }) }),
|
|
3459
|
+
/* @__PURE__ */ jsxs11(CardFooter, { children: [
|
|
3460
|
+
/* @__PURE__ */ jsx25(Button, { variant: "outline", className: "mr-2", children: "Cancel" }),
|
|
3461
|
+
/* @__PURE__ */ jsx25(Button, { children: "Submit" })
|
|
2391
3462
|
] })
|
|
2392
3463
|
] }),
|
|
2393
|
-
/* @__PURE__ */
|
|
2394
|
-
/* @__PURE__ */
|
|
2395
|
-
/* @__PURE__ */
|
|
2396
|
-
/* @__PURE__ */
|
|
3464
|
+
/* @__PURE__ */ jsxs11(Card, { children: [
|
|
3465
|
+
/* @__PURE__ */ jsxs11(CardHeader, { children: [
|
|
3466
|
+
/* @__PURE__ */ jsx25(CardTitle, { children: "Another Card" }),
|
|
3467
|
+
/* @__PURE__ */ jsx25(CardDescription, { children: "With different content" })
|
|
2397
3468
|
] }),
|
|
2398
|
-
/* @__PURE__ */
|
|
2399
|
-
/* @__PURE__ */
|
|
2400
|
-
/* @__PURE__ */
|
|
3469
|
+
/* @__PURE__ */ jsx25(CardContent, { children: /* @__PURE__ */ jsxs11("div", { className: "space-y-2", children: [
|
|
3470
|
+
/* @__PURE__ */ jsx25(Label, { htmlFor: "card-input", children: "Name" }),
|
|
3471
|
+
/* @__PURE__ */ jsx25(Input, { id: "card-input", placeholder: "Enter name..." })
|
|
2401
3472
|
] }) }),
|
|
2402
|
-
/* @__PURE__ */
|
|
3473
|
+
/* @__PURE__ */ jsx25(CardFooter, { children: /* @__PURE__ */ jsx25(Button, { className: "w-full", children: "Save" }) })
|
|
2403
3474
|
] })
|
|
2404
3475
|
] }) }),
|
|
2405
|
-
/* @__PURE__ */
|
|
2406
|
-
/* @__PURE__ */
|
|
2407
|
-
/* @__PURE__ */
|
|
2408
|
-
/* @__PURE__ */
|
|
2409
|
-
/* @__PURE__ */
|
|
2410
|
-
/* @__PURE__ */
|
|
3476
|
+
/* @__PURE__ */ jsxs11(Section, { title: "Dialog", children: [
|
|
3477
|
+
/* @__PURE__ */ jsx25(Button, { onClick: () => setDialogOpen(true), children: "Open Dialog" }),
|
|
3478
|
+
/* @__PURE__ */ jsx25(DialogNamespace, { open: dialogOpen, onOpenChange: setDialogOpen, children: /* @__PURE__ */ jsxs11(DialogContent, { children: [
|
|
3479
|
+
/* @__PURE__ */ jsxs11(DialogHeader, { children: [
|
|
3480
|
+
/* @__PURE__ */ jsx25(DialogTitle, { children: "Create New Zone" }),
|
|
3481
|
+
/* @__PURE__ */ jsx25(DialogDescription, { children: "Fill in the details below to create a new zone." })
|
|
2411
3482
|
] }),
|
|
2412
|
-
/* @__PURE__ */
|
|
2413
|
-
/* @__PURE__ */
|
|
2414
|
-
/* @__PURE__ */
|
|
2415
|
-
/* @__PURE__ */
|
|
2416
|
-
/* @__PURE__ */
|
|
3483
|
+
/* @__PURE__ */ jsxs11("div", { className: "space-y-4 py-4", children: [
|
|
3484
|
+
/* @__PURE__ */ jsxs11("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
3485
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
3486
|
+
/* @__PURE__ */ jsx25(Label, { htmlFor: "zone-name", children: "Zone Name *" }),
|
|
3487
|
+
/* @__PURE__ */ jsx25(Input, { id: "zone-name", placeholder: "eg:hyderabad" })
|
|
2417
3488
|
] }),
|
|
2418
|
-
/* @__PURE__ */
|
|
2419
|
-
/* @__PURE__ */
|
|
2420
|
-
/* @__PURE__ */
|
|
3489
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
3490
|
+
/* @__PURE__ */ jsx25(Label, { htmlFor: "zone-code", children: "Zone Code *" }),
|
|
3491
|
+
/* @__PURE__ */ jsx25(Input, { id: "zone-code", placeholder: "eg :hyd022" })
|
|
2421
3492
|
] })
|
|
2422
3493
|
] }),
|
|
2423
|
-
/* @__PURE__ */
|
|
2424
|
-
/* @__PURE__ */
|
|
2425
|
-
/* @__PURE__ */
|
|
2426
|
-
/* @__PURE__ */
|
|
2427
|
-
/* @__PURE__ */
|
|
2428
|
-
/* @__PURE__ */
|
|
2429
|
-
/* @__PURE__ */
|
|
2430
|
-
/* @__PURE__ */
|
|
3494
|
+
/* @__PURE__ */ jsxs11("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
3495
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
3496
|
+
/* @__PURE__ */ jsx25(Label, { children: "State *" }),
|
|
3497
|
+
/* @__PURE__ */ jsxs11(SelectNamespace, { children: [
|
|
3498
|
+
/* @__PURE__ */ jsx25(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsx25(SelectValue, { placeholder: "Select state" }) }),
|
|
3499
|
+
/* @__PURE__ */ jsxs11(SelectContent, { children: [
|
|
3500
|
+
/* @__PURE__ */ jsx25(SelectItem, { value: "telangana", children: "TELANGANA" }),
|
|
3501
|
+
/* @__PURE__ */ jsx25(SelectItem, { value: "andhra", children: "ANDHRA PRADESH" })
|
|
2431
3502
|
] })
|
|
2432
3503
|
] })
|
|
2433
3504
|
] }),
|
|
2434
|
-
/* @__PURE__ */
|
|
2435
|
-
/* @__PURE__ */
|
|
2436
|
-
/* @__PURE__ */
|
|
2437
|
-
/* @__PURE__ */
|
|
2438
|
-
/* @__PURE__ */
|
|
2439
|
-
/* @__PURE__ */
|
|
2440
|
-
/* @__PURE__ */
|
|
3505
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
3506
|
+
/* @__PURE__ */ jsx25(Label, { children: "District *" }),
|
|
3507
|
+
/* @__PURE__ */ jsxs11(SelectNamespace, { children: [
|
|
3508
|
+
/* @__PURE__ */ jsx25(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsx25(SelectValue, { placeholder: "Select District" }) }),
|
|
3509
|
+
/* @__PURE__ */ jsxs11(SelectContent, { children: [
|
|
3510
|
+
/* @__PURE__ */ jsx25(SelectItem, { value: "hyderabad", children: "HYDERABAD" }),
|
|
3511
|
+
/* @__PURE__ */ jsx25(SelectItem, { value: "rangareddy", children: "RANGAREDDY" })
|
|
2441
3512
|
] })
|
|
2442
3513
|
] })
|
|
2443
3514
|
] })
|
|
2444
3515
|
] })
|
|
2445
3516
|
] }),
|
|
2446
|
-
/* @__PURE__ */
|
|
2447
|
-
/* @__PURE__ */
|
|
2448
|
-
/* @__PURE__ */
|
|
3517
|
+
/* @__PURE__ */ jsxs11(DialogFooter, { children: [
|
|
3518
|
+
/* @__PURE__ */ jsx25(Button, { variant: "outline", onClick: () => setDialogOpen(false), children: "CANCEL" }),
|
|
3519
|
+
/* @__PURE__ */ jsx25(Button, { onClick: () => setDialogOpen(false), children: "Create" })
|
|
2449
3520
|
] })
|
|
2450
3521
|
] }) })
|
|
2451
3522
|
] }),
|
|
2452
|
-
/* @__PURE__ */
|
|
2453
|
-
/* @__PURE__ */
|
|
2454
|
-
/* @__PURE__ */
|
|
2455
|
-
/* @__PURE__ */
|
|
2456
|
-
/* @__PURE__ */
|
|
2457
|
-
/* @__PURE__ */
|
|
2458
|
-
/* @__PURE__ */
|
|
3523
|
+
/* @__PURE__ */ jsx25(Section, { title: "Table", children: /* @__PURE__ */ jsxs11(TableNamespace, { children: [
|
|
3524
|
+
/* @__PURE__ */ jsx25(TableCaption, { children: "A list of recent invoices" }),
|
|
3525
|
+
/* @__PURE__ */ jsx25(TableHeader, { children: /* @__PURE__ */ jsxs11(TableRow, { children: [
|
|
3526
|
+
/* @__PURE__ */ jsx25(TableHead, { children: "Invoice" }),
|
|
3527
|
+
/* @__PURE__ */ jsx25(TableHead, { children: "Status" }),
|
|
3528
|
+
/* @__PURE__ */ jsx25(TableHead, { children: "Method" }),
|
|
3529
|
+
/* @__PURE__ */ jsx25(TableHead, { className: "text-right", children: "Amount" })
|
|
2459
3530
|
] }) }),
|
|
2460
|
-
/* @__PURE__ */
|
|
2461
|
-
/* @__PURE__ */
|
|
2462
|
-
/* @__PURE__ */
|
|
2463
|
-
/* @__PURE__ */
|
|
2464
|
-
/* @__PURE__ */
|
|
2465
|
-
/* @__PURE__ */
|
|
3531
|
+
/* @__PURE__ */ jsxs11(TableBody, { children: [
|
|
3532
|
+
/* @__PURE__ */ jsxs11(TableRow, { children: [
|
|
3533
|
+
/* @__PURE__ */ jsx25(TableCell, { children: "INV001" }),
|
|
3534
|
+
/* @__PURE__ */ jsx25(TableCell, { children: /* @__PURE__ */ jsx25(Badge, { children: "Paid" }) }),
|
|
3535
|
+
/* @__PURE__ */ jsx25(TableCell, { children: "Credit Card" }),
|
|
3536
|
+
/* @__PURE__ */ jsx25(TableCell, { className: "text-right", children: "$250.00" })
|
|
2466
3537
|
] }),
|
|
2467
|
-
/* @__PURE__ */
|
|
2468
|
-
/* @__PURE__ */
|
|
2469
|
-
/* @__PURE__ */
|
|
2470
|
-
/* @__PURE__ */
|
|
2471
|
-
/* @__PURE__ */
|
|
3538
|
+
/* @__PURE__ */ jsxs11(TableRow, { children: [
|
|
3539
|
+
/* @__PURE__ */ jsx25(TableCell, { children: "INV002" }),
|
|
3540
|
+
/* @__PURE__ */ jsx25(TableCell, { children: /* @__PURE__ */ jsx25(Badge, { variant: "secondary", children: "Pending" }) }),
|
|
3541
|
+
/* @__PURE__ */ jsx25(TableCell, { children: "PayPal" }),
|
|
3542
|
+
/* @__PURE__ */ jsx25(TableCell, { className: "text-right", children: "$150.00" })
|
|
2472
3543
|
] }),
|
|
2473
|
-
/* @__PURE__ */
|
|
2474
|
-
/* @__PURE__ */
|
|
2475
|
-
/* @__PURE__ */
|
|
2476
|
-
/* @__PURE__ */
|
|
2477
|
-
/* @__PURE__ */
|
|
3544
|
+
/* @__PURE__ */ jsxs11(TableRow, { children: [
|
|
3545
|
+
/* @__PURE__ */ jsx25(TableCell, { children: "INV003" }),
|
|
3546
|
+
/* @__PURE__ */ jsx25(TableCell, { children: /* @__PURE__ */ jsx25(Badge, { variant: "destructive", children: "Failed" }) }),
|
|
3547
|
+
/* @__PURE__ */ jsx25(TableCell, { children: "Bank Transfer" }),
|
|
3548
|
+
/* @__PURE__ */ jsx25(TableCell, { className: "text-right", children: "$350.00" })
|
|
2478
3549
|
] })
|
|
2479
3550
|
] })
|
|
2480
3551
|
] }) }),
|
|
2481
|
-
/* @__PURE__ */
|
|
2482
|
-
/* @__PURE__ */
|
|
2483
|
-
/* @__PURE__ */
|
|
2484
|
-
/* @__PURE__ */
|
|
2485
|
-
/* @__PURE__ */
|
|
2486
|
-
/* @__PURE__ */
|
|
2487
|
-
/* @__PURE__ */
|
|
3552
|
+
/* @__PURE__ */ jsx25(Section, { title: "Pagination", children: /* @__PURE__ */ jsx25(PaginationNamespace, { children: /* @__PURE__ */ jsxs11(PaginationContent, { children: [
|
|
3553
|
+
/* @__PURE__ */ jsx25(PaginationItem, { children: /* @__PURE__ */ jsx25(PaginationPrevious, { onClick: () => console.log("Previous") }) }),
|
|
3554
|
+
/* @__PURE__ */ jsx25(PaginationItem, { children: /* @__PURE__ */ jsx25(PaginationLink, { isActive: true, children: "1" }) }),
|
|
3555
|
+
/* @__PURE__ */ jsx25(PaginationItem, { children: /* @__PURE__ */ jsx25(PaginationLink, { children: "2" }) }),
|
|
3556
|
+
/* @__PURE__ */ jsx25(PaginationItem, { children: /* @__PURE__ */ jsx25(PaginationLink, { children: "3" }) }),
|
|
3557
|
+
/* @__PURE__ */ jsx25(PaginationItem, { children: /* @__PURE__ */ jsx25(PaginationEllipsis, {}) }),
|
|
3558
|
+
/* @__PURE__ */ jsx25(PaginationItem, { children: /* @__PURE__ */ jsx25(PaginationNext, { onClick: () => console.log("Next") }) })
|
|
2488
3559
|
] }) }) }),
|
|
2489
|
-
/* @__PURE__ */
|
|
2490
|
-
/* @__PURE__ */
|
|
2491
|
-
/* @__PURE__ */
|
|
2492
|
-
/* @__PURE__ */
|
|
3560
|
+
/* @__PURE__ */ jsx25(Section, { title: "Spinner", children: /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-8", children: [
|
|
3561
|
+
/* @__PURE__ */ jsxs11("div", { className: "text-center", children: [
|
|
3562
|
+
/* @__PURE__ */ jsx25(Spinner, { size: "sm" }),
|
|
3563
|
+
/* @__PURE__ */ jsx25("p", { className: "text-sm text-muted-foreground mt-2", children: "Small" })
|
|
2493
3564
|
] }),
|
|
2494
|
-
/* @__PURE__ */
|
|
2495
|
-
/* @__PURE__ */
|
|
2496
|
-
/* @__PURE__ */
|
|
3565
|
+
/* @__PURE__ */ jsxs11("div", { className: "text-center", children: [
|
|
3566
|
+
/* @__PURE__ */ jsx25(Spinner, { size: "default" }),
|
|
3567
|
+
/* @__PURE__ */ jsx25("p", { className: "text-sm text-muted-foreground mt-2", children: "Default" })
|
|
2497
3568
|
] }),
|
|
2498
|
-
/* @__PURE__ */
|
|
2499
|
-
/* @__PURE__ */
|
|
2500
|
-
/* @__PURE__ */
|
|
3569
|
+
/* @__PURE__ */ jsxs11("div", { className: "text-center", children: [
|
|
3570
|
+
/* @__PURE__ */ jsx25(Spinner, { size: "lg" }),
|
|
3571
|
+
/* @__PURE__ */ jsx25("p", { className: "text-sm text-muted-foreground mt-2", children: "Large" })
|
|
2501
3572
|
] })
|
|
2502
3573
|
] }) }),
|
|
2503
|
-
/* @__PURE__ */
|
|
2504
|
-
/* @__PURE__ */
|
|
2505
|
-
/* @__PURE__ */
|
|
2506
|
-
/* @__PURE__ */
|
|
2507
|
-
/* @__PURE__ */
|
|
2508
|
-
/* @__PURE__ */
|
|
2509
|
-
/* @__PURE__ */
|
|
2510
|
-
/* @__PURE__ */
|
|
3574
|
+
/* @__PURE__ */ jsx25(Section, { title: "Separator", children: /* @__PURE__ */ jsxs11("div", { className: "space-y-4", children: [
|
|
3575
|
+
/* @__PURE__ */ jsx25("p", { className: "text-foreground", children: "Content above separator" }),
|
|
3576
|
+
/* @__PURE__ */ jsx25(Separator, {}),
|
|
3577
|
+
/* @__PURE__ */ jsx25("p", { className: "text-foreground", children: "Content below separator" }),
|
|
3578
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center h-10", children: [
|
|
3579
|
+
/* @__PURE__ */ jsx25("span", { className: "text-foreground", children: "Left" }),
|
|
3580
|
+
/* @__PURE__ */ jsx25(Separator, { orientation: "vertical", className: "mx-4" }),
|
|
3581
|
+
/* @__PURE__ */ jsx25("span", { className: "text-foreground", children: "Right" })
|
|
2511
3582
|
] })
|
|
2512
3583
|
] }) }),
|
|
2513
|
-
/* @__PURE__ */
|
|
2514
|
-
/* @__PURE__ */
|
|
2515
|
-
/* @__PURE__ */
|
|
2516
|
-
/* @__PURE__ */
|
|
2517
|
-
/* @__PURE__ */
|
|
3584
|
+
/* @__PURE__ */ jsx25(Section, { title: "Typography & Colors", children: /* @__PURE__ */ jsxs11("div", { className: "space-y-2", children: [
|
|
3585
|
+
/* @__PURE__ */ jsx25("p", { className: "text-foreground", children: "text-foreground - Primary text color" }),
|
|
3586
|
+
/* @__PURE__ */ jsx25("p", { className: "text-muted-foreground", children: "text-muted-foreground - Muted text color" }),
|
|
3587
|
+
/* @__PURE__ */ jsx25("p", { className: "text-accent", children: "text-accent - Accent color" }),
|
|
3588
|
+
/* @__PURE__ */ jsx25("p", { className: "text-destructive", children: "text-destructive - Destructive color" })
|
|
2518
3589
|
] }) })
|
|
2519
3590
|
] }) });
|
|
2520
3591
|
};
|
|
2521
|
-
var Playground = () => /* @__PURE__ */
|
|
3592
|
+
var Playground = () => /* @__PURE__ */ jsx25(ThemeProvider, { defaultTheme: "light", children: /* @__PURE__ */ jsx25(PlaygroundContent, {}) });
|
|
2522
3593
|
export {
|
|
2523
3594
|
Badge,
|
|
2524
3595
|
Box,
|
|
@@ -2532,6 +3603,8 @@ export {
|
|
|
2532
3603
|
CardTitle,
|
|
2533
3604
|
Checkbox,
|
|
2534
3605
|
Combobox,
|
|
3606
|
+
DataGrid,
|
|
3607
|
+
DataGrid as DataGridV0,
|
|
2535
3608
|
DialogNamespace as Dialog,
|
|
2536
3609
|
DialogClose,
|
|
2537
3610
|
DialogContent,
|