@polastack/design-system 0.1.33 → 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 +5 -2
- 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
|
@@ -2696,6 +2696,7 @@ import { jsx as jsx33, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
|
2696
2696
|
function DataTable({
|
|
2697
2697
|
columns,
|
|
2698
2698
|
data,
|
|
2699
|
+
variant = "rows",
|
|
2699
2700
|
enableSorting = false,
|
|
2700
2701
|
enableRowSelection = false,
|
|
2701
2702
|
enableColumnVisibility = false,
|
|
@@ -2707,6 +2708,8 @@ function DataTable({
|
|
|
2707
2708
|
className,
|
|
2708
2709
|
"aria-label": ariaLabel
|
|
2709
2710
|
}) {
|
|
2711
|
+
const isGrid = variant === "grid";
|
|
2712
|
+
const gridCellClass = isGrid ? "border-r border-[var(--color-border)] last:border-r-0" : "";
|
|
2710
2713
|
const [sorting, setSorting] = React33.useState([]);
|
|
2711
2714
|
const [rowSelection, setRowSelection] = React33.useState({});
|
|
2712
2715
|
const [columnVisibility, setColumnVisibility] = React33.useState({});
|
|
@@ -2766,7 +2769,7 @@ function DataTable({
|
|
|
2766
2769
|
}
|
|
2767
2770
|
),
|
|
2768
2771
|
/* @__PURE__ */ jsxs14(Table, { "aria-label": ariaLabel, children: [
|
|
2769
|
-
/* @__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(
|
|
2770
2773
|
"button",
|
|
2771
2774
|
{
|
|
2772
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",
|
|
@@ -2800,7 +2803,7 @@ function DataTable({
|
|
|
2800
2803
|
onClick: () => row.toggleSelected(),
|
|
2801
2804
|
className: "cursor-pointer"
|
|
2802
2805
|
},
|
|
2803
|
-
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))
|
|
2804
2807
|
},
|
|
2805
2808
|
row.id
|
|
2806
2809
|
)) : /* @__PURE__ */ jsx33(TableRow, { children: /* @__PURE__ */ jsx33(
|