next-data-kit 9.0.0 → 9.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -7,7 +7,6 @@ var lucideReact = require('lucide-react');
7
7
  var CheckboxPrimitive = require('@radix-ui/react-checkbox');
8
8
  var PopoverPrimitive = require('@radix-ui/react-popover');
9
9
  var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
10
- var SwitchPrimitive = require('@radix-ui/react-switch');
11
10
  var reactSlot = require('@radix-ui/react-slot');
12
11
  var classVarianceAuthority = require('class-variance-authority');
13
12
  var SelectPrimitive = require('@radix-ui/react-select');
@@ -35,7 +34,6 @@ var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
35
34
  var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
36
35
  var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
37
36
  var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
38
- var SwitchPrimitive__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitive);
39
37
  var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
40
38
 
41
39
  // src/server/utils.ts
@@ -810,7 +808,7 @@ function TableRow({ className, ...props }) {
810
808
  {
811
809
  "data-slot": "table-row",
812
810
  className: cn(
813
- "hover:bg-gray-50 dark:hover:bg-gray-900/50 hover:border-gray-200 dark:hover:border-gray-800 data-[state=selected]:bg-gray-50 dark:data-[state=selected]:bg-gray-900/50 border-b border-gray-100 dark:border-gray-900 transition-colors",
811
+ "hover:bg-gray-50 dark:hover:bg-gray-900 data-[state=selected]:bg-gray-50 dark:data-[state=selected]:bg-gray-900 border-b border-gray-100 dark:border-gray-800 transition-colors",
814
812
  className
815
813
  ),
816
814
  ...props
@@ -962,31 +960,6 @@ function DropdownMenuSeparator({
962
960
  }
963
961
  );
964
962
  }
965
- function Switch({
966
- className,
967
- ...props
968
- }) {
969
- return /* @__PURE__ */ jsxRuntime.jsx(
970
- SwitchPrimitive__namespace.Root,
971
- {
972
- "data-slot": "switch",
973
- className: cn(
974
- "peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
975
- className
976
- ),
977
- ...props,
978
- children: /* @__PURE__ */ jsxRuntime.jsx(
979
- SwitchPrimitive__namespace.Thumb,
980
- {
981
- "data-slot": "switch-thumb",
982
- className: cn(
983
- "bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"
984
- )
985
- }
986
- )
987
- }
988
- );
989
- }
990
963
  var buttonVariants = classVarianceAuthority.cva(
991
964
  "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:ring-black/20 dark:focus-visible:ring-white/20 focus-visible:ring-[3px] aria-invalid:ring-red-500/20 dark:aria-invalid:ring-red-500/30 aria-invalid:border-red-500",
992
965
  {
@@ -1433,68 +1406,52 @@ var DataKitRoot = (props) => {
1433
1406
  selection.deselectAll();
1434
1407
  }, [dataKit.items.length]);
1435
1408
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: tableRef, className: `space-y-3 ${className ?? ""}`, children: [
1436
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
1437
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: filters.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: isFilterOpen, onOpenChange: setIsFilterOpen, children: [
1438
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", children: [
1439
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Filter, { className: "mr-1.5 size-4" }),
1440
- "Filters"
1441
- ] }) }),
1442
- /* @__PURE__ */ jsxRuntime.jsxs(PopoverContent, { align: "start", className: "w-80", container: overlayContainer, children: [
1443
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-3", children: filters.map((f) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-1.5", children: [
1444
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: f.label }),
1445
- f.type === "TEXT" && /* @__PURE__ */ jsxRuntime.jsx(
1446
- "input",
1447
- {
1448
- type: "text",
1449
- className: "h-9 w-full rounded-md border bg-transparent px-3 text-sm outline-none focus:ring-2 focus:ring-ring",
1450
- placeholder: f.placeholder,
1451
- value: dataKit.filter[f.id] ?? "",
1452
- onChange: (e) => dataKit.actions.setFilter(f.id, e.target.value)
1453
- }
1454
- ),
1455
- f.type === "SELECT" && /* @__PURE__ */ jsxRuntime.jsxs(
1456
- Select,
1457
- {
1458
- value: String(dataKit.filter[f.id] || "__all__"),
1459
- onValueChange: (v) => dataKit.actions.setFilter(f.id, v === "__all__" ? "" : v),
1460
- children: [
1461
- /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
1462
- /* @__PURE__ */ jsxRuntime.jsxs(SelectContent, { container: overlayContainer, children: [
1463
- /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: "__all__", children: "All" }),
1464
- f.dataset?.map((d) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: d.id, children: d.label }, d.id))
1465
- ] })
1466
- ]
1467
- }
1468
- ),
1469
- f.type === "BOOLEAN" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
1470
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: f.placeholder ?? "Enable" }),
1471
- /* @__PURE__ */ jsxRuntime.jsx(
1472
- Switch,
1473
- {
1474
- checked: Boolean(dataKit.filter[f.id]),
1475
- onCheckedChange: (c) => dataKit.actions.setFilter(f.id, c)
1476
- }
1477
- )
1478
- ] })
1479
- ] }, f.id)) }),
1480
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-4 flex justify-between border-t pt-3", children: [
1481
- /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", size: "sm", onClick: handleResetFilters, children: "Reset" }),
1482
- /* @__PURE__ */ jsxRuntime.jsx(Button, { size: "sm", onClick: () => setIsFilterOpen(false), children: "Done" })
1483
- ] })
1484
- ] })
1409
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between gap-2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: filters.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: isFilterOpen, onOpenChange: setIsFilterOpen, children: [
1410
+ /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", children: [
1411
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Filter, { className: "mr-1.5 size-4" }),
1412
+ "Filters"
1485
1413
  ] }) }),
1486
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
1487
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "mr-2 text-sm text-muted-foreground", children: [
1488
- dataKit.items.length,
1489
- " of ",
1490
- dataKit.total
1491
- ] }),
1492
- /* @__PURE__ */ jsxRuntime.jsxs(Select, { value: String(dataKit.limit), onValueChange: (v) => dataKit.actions.setLimit(Number(v)), disabled: dataKit.state.isLoading, children: [
1493
- /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "w-16", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
1494
- /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { container: overlayContainer, children: limitOptions.map((v) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: String(v), children: v }, v)) })
1414
+ /* @__PURE__ */ jsxRuntime.jsxs(PopoverContent, { align: "start", className: "w-80", container: overlayContainer, children: [
1415
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-3", children: filters.map((f) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-1.5", children: [
1416
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: f.label }),
1417
+ f.type === "TEXT" && /* @__PURE__ */ jsxRuntime.jsx(
1418
+ "input",
1419
+ {
1420
+ type: "text",
1421
+ className: "h-9 w-full rounded-md border bg-transparent px-3 text-sm outline-none focus:ring-2 focus:ring-ring",
1422
+ placeholder: f.placeholder,
1423
+ value: dataKit.filter[f.id] ?? "",
1424
+ onChange: (e) => dataKit.actions.setFilter(f.id, e.target.value)
1425
+ }
1426
+ ),
1427
+ f.type === "SELECT" && /* @__PURE__ */ jsxRuntime.jsxs(
1428
+ Select,
1429
+ {
1430
+ value: String(dataKit.filter[f.id] || "__all__"),
1431
+ onValueChange: (v) => dataKit.actions.setFilter(f.id, v === "__all__" ? "" : v),
1432
+ children: [
1433
+ /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
1434
+ /* @__PURE__ */ jsxRuntime.jsxs(SelectContent, { container: overlayContainer, children: [
1435
+ /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: "__all__", children: "All" }),
1436
+ f.dataset?.map((d) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: d.id, children: d.label }, d.id))
1437
+ ] })
1438
+ ]
1439
+ }
1440
+ ),
1441
+ f.type === "BOOLEAN" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxRuntime.jsx(
1442
+ Checkbox,
1443
+ {
1444
+ checked: Boolean(dataKit.filter[f.id]),
1445
+ onCheckedChange: (c) => dataKit.actions.setFilter(f.id, c)
1446
+ }
1447
+ ) })
1448
+ ] }, f.id)) }),
1449
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-4 flex justify-between border-t pt-3", children: [
1450
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", size: "sm", onClick: handleResetFilters, children: "Reset" }),
1451
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { size: "sm", onClick: () => setIsFilterOpen(false), children: "Done" })
1495
1452
  ] })
1496
1453
  ] })
1497
- ] }),
1454
+ ] }) }) }),
1498
1455
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: `overflow-hidden border border-gray-200 dark:border-gray-800 ${bordered === "rounded" ? "rounded-lg" : bordered ? "" : "rounded-lg"}`, children: /* @__PURE__ */ jsxRuntime.jsxs(Table, { children: [
1499
1456
  /* @__PURE__ */ jsxRuntime.jsx(TableHeader, { children: /* @__PURE__ */ jsxRuntime.jsxs(TableRow, { children: [
1500
1457
  selectable?.enabled && /* @__PURE__ */ jsxRuntime.jsx(TableHead, { className: "w-12", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
@@ -1566,8 +1523,12 @@ var DataKitRoot = (props) => {
1566
1523
  }) })
1567
1524
  ] }) }),
1568
1525
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4 justify-between", children: [
1569
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-[140px]", children: [
1570
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-muted-foreground", children: [
1526
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
1527
+ /* @__PURE__ */ jsxRuntime.jsxs(Select, { value: String(dataKit.limit), onValueChange: (v) => dataKit.actions.setLimit(Number(v)), disabled: dataKit.state.isLoading, children: [
1528
+ /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "w-16", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
1529
+ /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { container: overlayContainer, children: limitOptions.map((v) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: String(v), children: v }, v)) })
1530
+ ] }),
1531
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-muted-foreground whitespace-nowrap", children: [
1571
1532
  "Page ",
1572
1533
  dataKit.page,
1573
1534
  " of ",
@@ -1578,8 +1539,7 @@ var DataKitRoot = (props) => {
1578
1539
  " selected"
1579
1540
  ] })
1580
1541
  ] }),
1581
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1" }),
1582
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end w-full", children: paginationType === "SIMPLE" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
1542
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end", children: paginationType === "SIMPLE" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
1583
1543
  /* @__PURE__ */ jsxRuntime.jsx(
1584
1544
  Button,
1585
1545
  {
@@ -1759,16 +1719,13 @@ var DataKitInner = (props, ref) => {
1759
1719
  ]
1760
1720
  }
1761
1721
  ),
1762
- f.type === "BOOLEAN" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
1763
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: f.placeholder ?? "Enable" }),
1764
- /* @__PURE__ */ jsxRuntime.jsx(
1765
- Switch,
1766
- {
1767
- checked: Boolean(dataKit.filter[f.id]),
1768
- onCheckedChange: (c) => dataKit.actions.setFilter(f.id, c)
1769
- }
1770
- )
1771
- ] })
1722
+ f.type === "BOOLEAN" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxRuntime.jsx(
1723
+ Checkbox,
1724
+ {
1725
+ checked: Boolean(dataKit.filter[f.id]),
1726
+ onCheckedChange: (c) => dataKit.actions.setFilter(f.id, c)
1727
+ }
1728
+ ) })
1772
1729
  ] }, f.id)) }),
1773
1730
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-4 flex justify-between border-t pt-3", children: [
1774
1731
  /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", size: "sm", onClick: handleResetFilters, children: "Reset" }),