pxengine 0.1.100 → 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 +63 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -3
- package/dist/index.d.ts +28 -3
- package/dist/index.mjs +63 -20
- 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
|
);
|
|
@@ -38649,12 +38659,36 @@ var confidenceClass = {
|
|
|
38649
38659
|
Medium: "text-amber-600 dark:text-amber-400",
|
|
38650
38660
|
Low: "text-rose-600 dark:text-rose-400"
|
|
38651
38661
|
};
|
|
38652
|
-
|
|
38653
|
-
|
|
38654
|
-
|
|
38655
|
-
|
|
38656
|
-
|
|
38657
|
-
|
|
38662
|
+
function normalizeConfidence(c) {
|
|
38663
|
+
if (!c) return void 0;
|
|
38664
|
+
const v = String(c).trim().toLowerCase();
|
|
38665
|
+
if (v.startsWith("h")) return "High";
|
|
38666
|
+
if (v.startsWith("m")) return "Medium";
|
|
38667
|
+
if (v.startsWith("l")) return "Low";
|
|
38668
|
+
return void 0;
|
|
38669
|
+
}
|
|
38670
|
+
function resolveItems(props) {
|
|
38671
|
+
const cardConfidence = props.confidence;
|
|
38672
|
+
if (Array.isArray(props.insights) && props.insights.length > 0) {
|
|
38673
|
+
return props.insights.map((it) => ({
|
|
38674
|
+
label: it?.label ?? "",
|
|
38675
|
+
value: it?.value ?? "",
|
|
38676
|
+
confidence: normalizeConfidence(it?.confidence ?? cardConfidence)
|
|
38677
|
+
}));
|
|
38678
|
+
}
|
|
38679
|
+
if (Array.isArray(props.key_findings) && props.key_findings.length > 0) {
|
|
38680
|
+
return props.key_findings.map((f) => ({
|
|
38681
|
+
label: f?.finding ?? f?.label ?? "",
|
|
38682
|
+
value: f?.data_point ?? f?.value ?? "",
|
|
38683
|
+
confidence: normalizeConfidence(f?.confidence ?? cardConfidence)
|
|
38684
|
+
}));
|
|
38685
|
+
}
|
|
38686
|
+
return [];
|
|
38687
|
+
}
|
|
38688
|
+
var InsightSummaryCard = (props) => {
|
|
38689
|
+
const { title, className } = props;
|
|
38690
|
+
const summary = props.summary ?? props.executive_summary;
|
|
38691
|
+
const items = resolveItems(props);
|
|
38658
38692
|
return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
|
|
38659
38693
|
"div",
|
|
38660
38694
|
{
|
|
@@ -38665,20 +38699,29 @@ var InsightSummaryCard = ({
|
|
|
38665
38699
|
children: [
|
|
38666
38700
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("h3", { className: "text-base font-semibold text-foreground", children: title }),
|
|
38667
38701
|
summary ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "mt-2 text-sm text-muted-foreground leading-relaxed", children: summary }) : null,
|
|
38668
|
-
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "mt-4 space-y-2", children:
|
|
38702
|
+
items.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "mt-4 space-y-2", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
|
|
38669
38703
|
"div",
|
|
38670
38704
|
{
|
|
38671
38705
|
className: "rounded-xl border border-border/70 bg-background/50 px-3 py-2",
|
|
38672
38706
|
children: [
|
|
38673
38707
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
|
|
38674
38708
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "text-sm font-medium text-foreground", children: item.label }),
|
|
38675
|
-
item.confidence ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
38709
|
+
item.confidence ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
38710
|
+
"span",
|
|
38711
|
+
{
|
|
38712
|
+
className: cn(
|
|
38713
|
+
"text-xs font-semibold shrink-0",
|
|
38714
|
+
confidenceClass[item.confidence]
|
|
38715
|
+
),
|
|
38716
|
+
children: item.confidence
|
|
38717
|
+
}
|
|
38718
|
+
) : null
|
|
38676
38719
|
] }),
|
|
38677
|
-
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "mt-1 text-sm text-muted-foreground", children: item.value })
|
|
38720
|
+
item.value ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "mt-1 text-sm text-muted-foreground", children: item.value }) : null
|
|
38678
38721
|
]
|
|
38679
38722
|
},
|
|
38680
38723
|
`${item.label}-${index}`
|
|
38681
|
-
)) })
|
|
38724
|
+
)) }) : null
|
|
38682
38725
|
]
|
|
38683
38726
|
}
|
|
38684
38727
|
);
|