pxengine 0.1.101 → 0.1.102
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 +20 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.mjs +20 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -37842,31 +37842,41 @@ FeedbackRatingCard.displayName = "FeedbackRatingCard";
|
|
|
37842
37842
|
var import_react71 = __toESM(require("react"), 1);
|
|
37843
37843
|
var import_jsx_runtime128 = require("react/jsx-runtime");
|
|
37844
37844
|
var DataTableCard = import_react71.default.memo(
|
|
37845
|
-
({ title, caption, columns, rows, highlight_column, theme, className, onAction: _onAction }) => {
|
|
37845
|
+
({ title, caption, columns, rows, highlight_column, highlightColumn, theme, className, onAction: _onAction }) => {
|
|
37846
37846
|
const s = th(theme);
|
|
37847
|
+
const cols = (Array.isArray(columns) ? columns : []).map((c, i) => {
|
|
37848
|
+
if (typeof c === "string") return { key: c, label: c };
|
|
37849
|
+
return {
|
|
37850
|
+
key: c?.key ?? c?.label ?? String(i),
|
|
37851
|
+
label: c?.label ?? c?.key ?? String(i)
|
|
37852
|
+
};
|
|
37853
|
+
});
|
|
37854
|
+
const safeRows = Array.isArray(rows) ? rows : [];
|
|
37855
|
+
const highlight = highlight_column ?? highlightColumn;
|
|
37847
37856
|
return /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: cn("w-full rounded-[16px] border border-gray400 bg-cardSurface overflow-hidden", className), style: s.root, children: [
|
|
37848
37857
|
(title || caption) && /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "border-b border-gray400 px-4 py-3", style: { borderBottomColor: theme?.border }, children: [
|
|
37849
37858
|
title && /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("h3", { className: "text-sm font-semibold text-cardText", style: s.text, children: title }),
|
|
37850
37859
|
caption && /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("p", { className: "mt-0.5 text-[10px] text-cardText/40", style: s.muted, children: caption })
|
|
37851
37860
|
] }),
|
|
37852
37861
|
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("table", { className: "w-full min-w-full border-collapse text-xs", children: [
|
|
37853
|
-
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("tr", { className: "border-b border-gray400 bg-black/20", style: { borderBottomColor: theme?.border, ...s.surface }, children:
|
|
37862
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("tr", { className: "border-b border-gray400 bg-black/20", style: { borderBottomColor: theme?.border, ...s.surface }, children: cols.map((col, idx) => /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
37854
37863
|
"th",
|
|
37855
37864
|
{
|
|
37856
37865
|
className: "px-4 py-2.5 text-left font-semibold uppercase tracking-widest text-[10px] text-cardText/40",
|
|
37857
37866
|
style: s.muted,
|
|
37858
|
-
children: col
|
|
37867
|
+
children: col.label
|
|
37859
37868
|
},
|
|
37860
37869
|
idx
|
|
37861
37870
|
)) }) }),
|
|
37862
|
-
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("tbody", { children:
|
|
37871
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("tbody", { children: safeRows.map((row, rowIdx) => /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
37863
37872
|
"tr",
|
|
37864
37873
|
{
|
|
37865
|
-
className: cn("border-b border-gray400/40 transition-colors hover:bg-white/[0.02]", rowIdx ===
|
|
37874
|
+
className: cn("border-b border-gray400/40 transition-colors hover:bg-white/[0.02]", rowIdx === safeRows.length - 1 && "border-b-0"),
|
|
37866
37875
|
style: { borderBottomColor: theme?.border },
|
|
37867
|
-
children:
|
|
37868
|
-
const
|
|
37869
|
-
const
|
|
37876
|
+
children: cols.map((col, colIdx) => {
|
|
37877
|
+
const raw = row?.[col.key] ?? row?.[col.label];
|
|
37878
|
+
const cell = raw ?? "\u2014";
|
|
37879
|
+
const isHighlight = highlight != null && (col.key === highlight || col.label === highlight);
|
|
37870
37880
|
return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
37871
37881
|
"td",
|
|
37872
37882
|
{
|
|
@@ -37875,7 +37885,7 @@ var DataTableCard = import_react71.default.memo(
|
|
|
37875
37885
|
isHighlight ? "font-semibold text-gold" : colIdx === 0 ? "font-medium text-cardText" : "text-cardText/60"
|
|
37876
37886
|
),
|
|
37877
37887
|
style: isHighlight ? s.accent : colIdx === 0 ? s.text : s.muted,
|
|
37878
|
-
children: String(cell)
|
|
37888
|
+
children: typeof cell === "object" ? JSON.stringify(cell) : String(cell)
|
|
37879
37889
|
},
|
|
37880
37890
|
colIdx
|
|
37881
37891
|
);
|
|
@@ -37884,7 +37894,7 @@ var DataTableCard = import_react71.default.memo(
|
|
|
37884
37894
|
rowIdx
|
|
37885
37895
|
)) })
|
|
37886
37896
|
] }) }),
|
|
37887
|
-
|
|
37897
|
+
safeRows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("div", { className: "flex items-center justify-center py-10 text-xs text-cardText/30", style: s.muted, children: "No data available" })
|
|
37888
37898
|
] });
|
|
37889
37899
|
}
|
|
37890
37900
|
);
|