@umami/react-zen 1.0.5 → 1.0.6
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.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +52 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3588,6 +3588,7 @@ function renderCell(column, row, index) {
|
|
|
3588
3588
|
function DataTable({
|
|
3589
3589
|
data = [],
|
|
3590
3590
|
displayMode = "table",
|
|
3591
|
+
cardMinWidth,
|
|
3591
3592
|
getRowId = defaultGetRowId,
|
|
3592
3593
|
selectionMode = "none",
|
|
3593
3594
|
selectedRows: selectedRowsProp,
|
|
@@ -3661,6 +3662,7 @@ function DataTable({
|
|
|
3661
3662
|
"div",
|
|
3662
3663
|
{
|
|
3663
3664
|
"data-slot": "data-table-pagination",
|
|
3665
|
+
style: { gridColumn: "1 / -1" },
|
|
3664
3666
|
className: "flex w-full items-center justify-between gap-4 py-3 text-sm text-muted-foreground",
|
|
3665
3667
|
children: [
|
|
3666
3668
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
@@ -3694,39 +3696,58 @@ function DataTable({
|
|
|
3694
3696
|
]
|
|
3695
3697
|
}
|
|
3696
3698
|
);
|
|
3697
|
-
const empty = /* @__PURE__ */ jsx(
|
|
3699
|
+
const empty = /* @__PURE__ */ jsx(
|
|
3700
|
+
"div",
|
|
3701
|
+
{
|
|
3702
|
+
"data-slot": "data-table-empty",
|
|
3703
|
+
style: { gridColumn: "1 / -1" },
|
|
3704
|
+
className: "py-10 text-center text-sm text-muted-foreground",
|
|
3705
|
+
children: emptyState
|
|
3706
|
+
}
|
|
3707
|
+
);
|
|
3698
3708
|
if (displayMode === "cards") {
|
|
3699
|
-
return /* @__PURE__ */ jsxs(
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
}))
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3709
|
+
return /* @__PURE__ */ jsxs(
|
|
3710
|
+
Grid,
|
|
3711
|
+
{
|
|
3712
|
+
width: "100%",
|
|
3713
|
+
gap: "6",
|
|
3714
|
+
columns: cardMinWidth ? `repeat(auto-fill, minmax(min(${cardMinWidth}, 100%), 1fr))` : void 0,
|
|
3715
|
+
alignItems: cardMinWidth ? "start" : void 0,
|
|
3716
|
+
"data-slot": "data-table",
|
|
3717
|
+
"data-display-mode": "cards",
|
|
3718
|
+
children: [
|
|
3719
|
+
rows.length === 0 ? empty : rows.map((row) => {
|
|
3720
|
+
const items = visibleColumns.map((column) => ({
|
|
3721
|
+
label: column.label,
|
|
3722
|
+
value: renderCell(column, row.original, row.index)
|
|
3723
|
+
}));
|
|
3724
|
+
if (isSelectable) {
|
|
3725
|
+
items.unshift({
|
|
3726
|
+
label: "",
|
|
3727
|
+
value: /* @__PURE__ */ jsx(
|
|
3728
|
+
Checkbox,
|
|
3729
|
+
{
|
|
3730
|
+
"aria-label": "Select row",
|
|
3731
|
+
checked: row.getIsSelected(),
|
|
3732
|
+
onCheckedChange: (checked) => row.toggleSelected(checked)
|
|
3733
|
+
}
|
|
3734
|
+
)
|
|
3735
|
+
});
|
|
3736
|
+
}
|
|
3737
|
+
return /* @__PURE__ */ jsx(
|
|
3738
|
+
DataCard,
|
|
3710
3739
|
{
|
|
3711
|
-
"
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
}
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
"data-state": row.getIsSelected() ? "selected" : void 0,
|
|
3723
|
-
data: items
|
|
3724
|
-
},
|
|
3725
|
-
row.id
|
|
3726
|
-
);
|
|
3727
|
-
}),
|
|
3728
|
-
pagination
|
|
3729
|
-
] });
|
|
3740
|
+
"data-row-id": row.id,
|
|
3741
|
+
"data-state": row.getIsSelected() ? "selected" : void 0,
|
|
3742
|
+
data: items
|
|
3743
|
+
},
|
|
3744
|
+
row.id
|
|
3745
|
+
);
|
|
3746
|
+
}),
|
|
3747
|
+
pagination
|
|
3748
|
+
]
|
|
3749
|
+
}
|
|
3750
|
+
);
|
|
3730
3751
|
}
|
|
3731
3752
|
const gridTemplateColumns = [
|
|
3732
3753
|
...isSelectable ? [SELECTION_COLUMN_WIDTH] : [],
|