@polastack/design-system 0.1.31 → 0.1.34
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 +3 -1
- package/dist/index.js +14 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -452,9 +452,11 @@ declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<
|
|
|
452
452
|
declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
453
453
|
declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
|
|
454
454
|
|
|
455
|
+
type DataTableVariant = 'rows' | 'grid';
|
|
455
456
|
interface DataTableProps<TData> {
|
|
456
457
|
columns: ColumnDef<TData, unknown>[];
|
|
457
458
|
data: TData[];
|
|
459
|
+
variant?: DataTableVariant;
|
|
458
460
|
enableSorting?: boolean;
|
|
459
461
|
enableRowSelection?: boolean;
|
|
460
462
|
enableColumnVisibility?: boolean;
|
|
@@ -466,7 +468,7 @@ interface DataTableProps<TData> {
|
|
|
466
468
|
className?: string;
|
|
467
469
|
'aria-label'?: string;
|
|
468
470
|
}
|
|
469
|
-
declare function DataTable<TData>({ columns, data, enableSorting, enableRowSelection, enableColumnVisibility, enablePagination, pageSize, pageSizeOptions, onRowSelectionChange, emptyState, className, 'aria-label': ariaLabel, }: DataTableProps<TData>): react_jsx_runtime.JSX.Element;
|
|
471
|
+
declare function DataTable<TData>({ columns, data, variant, enableSorting, enableRowSelection, enableColumnVisibility, enablePagination, pageSize, pageSizeOptions, onRowSelectionChange, emptyState, className, 'aria-label': ariaLabel, }: DataTableProps<TData>): react_jsx_runtime.JSX.Element;
|
|
470
472
|
declare namespace DataTable {
|
|
471
473
|
var displayName: string;
|
|
472
474
|
}
|
package/dist/index.js
CHANGED
|
@@ -2495,7 +2495,7 @@ var TableRow = React31.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
2495
2495
|
{
|
|
2496
2496
|
ref,
|
|
2497
2497
|
className: cn(
|
|
2498
|
-
"border-b border-[var(--color-border)] transition-colors hover:bg-[var(--color-surface-
|
|
2498
|
+
"border-b border-[var(--color-border)] transition-colors hover:bg-[var(--color-surface-muted)] data-[state=selected]:bg-[var(--color-surface-accent)]",
|
|
2499
2499
|
className
|
|
2500
2500
|
),
|
|
2501
2501
|
...props
|
|
@@ -2569,14 +2569,15 @@ function DataTablePagination({
|
|
|
2569
2569
|
children: [
|
|
2570
2570
|
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
2571
2571
|
/* @__PURE__ */ jsx31("span", { className: "hidden sm:inline", children: "Rows per page" }),
|
|
2572
|
-
/* @__PURE__ */
|
|
2573
|
-
|
|
2572
|
+
/* @__PURE__ */ jsxs12(
|
|
2573
|
+
Select,
|
|
2574
2574
|
{
|
|
2575
|
-
value: pageSize,
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2575
|
+
value: String(pageSize),
|
|
2576
|
+
onValueChange: (value) => table.setPageSize(Number(value)),
|
|
2577
|
+
children: [
|
|
2578
|
+
/* @__PURE__ */ jsx31(SelectTrigger, { className: "h-8 w-[4.5rem]", "aria-label": "Rows per page", children: /* @__PURE__ */ jsx31(SelectValue, {}) }),
|
|
2579
|
+
/* @__PURE__ */ jsx31(SelectContent, { children: pageSizeOptions.map((size) => /* @__PURE__ */ jsx31(SelectItem, { value: String(size), children: size }, size)) })
|
|
2580
|
+
]
|
|
2580
2581
|
}
|
|
2581
2582
|
)
|
|
2582
2583
|
] }),
|
|
@@ -2695,6 +2696,7 @@ import { jsx as jsx33, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
|
2695
2696
|
function DataTable({
|
|
2696
2697
|
columns,
|
|
2697
2698
|
data,
|
|
2699
|
+
variant = "rows",
|
|
2698
2700
|
enableSorting = false,
|
|
2699
2701
|
enableRowSelection = false,
|
|
2700
2702
|
enableColumnVisibility = false,
|
|
@@ -2706,6 +2708,8 @@ function DataTable({
|
|
|
2706
2708
|
className,
|
|
2707
2709
|
"aria-label": ariaLabel
|
|
2708
2710
|
}) {
|
|
2711
|
+
const isGrid = variant === "grid";
|
|
2712
|
+
const gridCellClass = isGrid ? "border-r border-[var(--color-border)] last:border-r-0" : "";
|
|
2709
2713
|
const [sorting, setSorting] = React33.useState([]);
|
|
2710
2714
|
const [rowSelection, setRowSelection] = React33.useState({});
|
|
2711
2715
|
const [columnVisibility, setColumnVisibility] = React33.useState({});
|
|
@@ -2765,7 +2769,7 @@ function DataTable({
|
|
|
2765
2769
|
}
|
|
2766
2770
|
),
|
|
2767
2771
|
/* @__PURE__ */ jsxs14(Table, { "aria-label": ariaLabel, children: [
|
|
2768
|
-
/* @__PURE__ */ jsx33(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx33(TableRow, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx33(TableHead, { children: header.isPlaceholder ? null : header.column.getCanSort() ? /* @__PURE__ */ jsxs14(
|
|
2772
|
+
/* @__PURE__ */ jsx33(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx33(TableRow, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx33(TableHead, { className: gridCellClass, children: header.isPlaceholder ? null : header.column.getCanSort() ? /* @__PURE__ */ jsxs14(
|
|
2769
2773
|
"button",
|
|
2770
2774
|
{
|
|
2771
2775
|
className: "flex items-center gap-1 -ml-2 px-2 py-1 rounded-md hover:bg-[var(--color-surface-muted)] transition-colors duration-fast",
|
|
@@ -2799,7 +2803,7 @@ function DataTable({
|
|
|
2799
2803
|
onClick: () => row.toggleSelected(),
|
|
2800
2804
|
className: "cursor-pointer"
|
|
2801
2805
|
},
|
|
2802
|
-
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx33(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))
|
|
2806
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx33(TableCell, { className: gridCellClass, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))
|
|
2803
2807
|
},
|
|
2804
2808
|
row.id
|
|
2805
2809
|
)) : /* @__PURE__ */ jsx33(TableRow, { children: /* @__PURE__ */ jsx33(
|