pxengine 0.1.149 → 0.1.151
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 +64 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +64 -21
- package/dist/index.mjs.map +1 -1
- package/dist/registry.json +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -11217,6 +11217,37 @@ ChatSkeleton.displayName = "ChatSkeleton";
|
|
|
11217
11217
|
// src/molecules/generic/EditableField/EditableField.tsx
|
|
11218
11218
|
import React88, { useState as useState6, useEffect as useEffect5, useRef as useRef6 } from "react";
|
|
11219
11219
|
|
|
11220
|
+
// src/lib/format-utils.ts
|
|
11221
|
+
function isPlainRecord(value) {
|
|
11222
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
11223
|
+
}
|
|
11224
|
+
function devWarnUnexpectedObject(context, value) {
|
|
11225
|
+
if (typeof process !== "undefined" && process.env?.NODE_ENV === "production") return;
|
|
11226
|
+
console.warn(
|
|
11227
|
+
`[PXEngine-UI] formatCellValue received an object/array where a primitive value was expected (context: "${context}"). This usually means the rendered schema and the data feeding it don't match \u2014 worth flagging to whatever generated this data.`,
|
|
11228
|
+
value
|
|
11229
|
+
);
|
|
11230
|
+
}
|
|
11231
|
+
function formatCellValue(value, context = "cell") {
|
|
11232
|
+
if (value === null || value === void 0 || value === "") return "";
|
|
11233
|
+
if (typeof value !== "object") return String(value);
|
|
11234
|
+
devWarnUnexpectedObject(context, value);
|
|
11235
|
+
if (Array.isArray(value)) {
|
|
11236
|
+
if (value.length === 0) return "";
|
|
11237
|
+
if (value.every((item) => item === null || item === void 0 || typeof item !== "object")) {
|
|
11238
|
+
return value.map((item) => String(item ?? "")).join(", ");
|
|
11239
|
+
}
|
|
11240
|
+
return `${value.length} item${value.length === 1 ? "" : "s"}`;
|
|
11241
|
+
}
|
|
11242
|
+
if (isPlainRecord(value)) {
|
|
11243
|
+
const meaningful = value.label ?? value.name ?? value.title ?? value.id ?? value.value;
|
|
11244
|
+
if (typeof meaningful === "string" || typeof meaningful === "number") {
|
|
11245
|
+
return String(meaningful);
|
|
11246
|
+
}
|
|
11247
|
+
}
|
|
11248
|
+
return "Complex value";
|
|
11249
|
+
}
|
|
11250
|
+
|
|
11220
11251
|
// src/components/ui/hover-card.tsx
|
|
11221
11252
|
import * as React85 from "react";
|
|
11222
11253
|
import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
|
|
@@ -11668,7 +11699,7 @@ var EditableField = React88.memo(
|
|
|
11668
11699
|
if (!value) {
|
|
11669
11700
|
return /* @__PURE__ */ jsx97("span", { className: "opacity-0", children: "-" });
|
|
11670
11701
|
}
|
|
11671
|
-
return
|
|
11702
|
+
return formatCellValue(value, "label");
|
|
11672
11703
|
};
|
|
11673
11704
|
return /* @__PURE__ */ jsxs58(
|
|
11674
11705
|
"div",
|
|
@@ -11922,7 +11953,7 @@ var FormCard = React90.memo(
|
|
|
11922
11953
|
if (Array.isArray(val)) {
|
|
11923
11954
|
return val.map((item) => {
|
|
11924
11955
|
if (typeof item === "object" && item !== null) {
|
|
11925
|
-
return item.label || item.value || item.name ||
|
|
11956
|
+
return item.label || item.value || item.name || formatCellValue(item, "label");
|
|
11926
11957
|
}
|
|
11927
11958
|
return String(item);
|
|
11928
11959
|
}).join(", ");
|
|
@@ -12191,7 +12222,7 @@ var StatsGrid = ({
|
|
|
12191
12222
|
{
|
|
12192
12223
|
id: `stat-label-${index}`,
|
|
12193
12224
|
type: "text",
|
|
12194
|
-
content:
|
|
12225
|
+
content: formatCellValue(item.label, "label"),
|
|
12195
12226
|
variant: "small",
|
|
12196
12227
|
className: cn(!hasPxVars && "text-muted-foreground", "font-medium tracking-wide uppercase text-[10px]"),
|
|
12197
12228
|
style: textColor ? { color: textColor } : void 0
|
|
@@ -12231,7 +12262,7 @@ var StatsGrid = ({
|
|
|
12231
12262
|
),
|
|
12232
12263
|
children: [
|
|
12233
12264
|
TrendIcon && /* @__PURE__ */ jsx101(TrendIcon, { className: "w-3 h-3 mr-0.5" }),
|
|
12234
|
-
|
|
12265
|
+
formatCellValue(item.trend, "label")
|
|
12235
12266
|
]
|
|
12236
12267
|
}
|
|
12237
12268
|
)
|
|
@@ -12517,7 +12548,7 @@ var DataGrid = ({
|
|
|
12517
12548
|
variant: "secondary",
|
|
12518
12549
|
className: "border-gold/20 bg-gold/10 text-gold",
|
|
12519
12550
|
style: s.accent,
|
|
12520
|
-
children:
|
|
12551
|
+
children: formatCellValue(value, "badge")
|
|
12521
12552
|
}
|
|
12522
12553
|
);
|
|
12523
12554
|
case "avatar":
|
|
@@ -12533,7 +12564,7 @@ var DataGrid = ({
|
|
|
12533
12564
|
case "number":
|
|
12534
12565
|
return /* @__PURE__ */ jsx107("span", { className: "font-mono font-medium text-cardText", style: s.text, children: Number(value ?? 0).toLocaleString() });
|
|
12535
12566
|
default:
|
|
12536
|
-
return /* @__PURE__ */ jsx107("span", { className: "text-cardText", style: s.text, children:
|
|
12567
|
+
return /* @__PURE__ */ jsx107("span", { className: "text-cardText", style: s.text, children: formatCellValue(value, "cell") });
|
|
12537
12568
|
}
|
|
12538
12569
|
};
|
|
12539
12570
|
return /* @__PURE__ */ jsxs67(
|
|
@@ -14675,11 +14706,7 @@ function stringifyValue(value, atomName, props) {
|
|
|
14675
14706
|
}
|
|
14676
14707
|
if (Array.isArray(value)) return value.join(", ");
|
|
14677
14708
|
if (typeof value === "object") {
|
|
14678
|
-
|
|
14679
|
-
return JSON.stringify(value);
|
|
14680
|
-
} catch {
|
|
14681
|
-
return String(value);
|
|
14682
|
-
}
|
|
14709
|
+
return formatCellValue(value, "label");
|
|
14683
14710
|
}
|
|
14684
14711
|
return String(value);
|
|
14685
14712
|
}
|
|
@@ -14835,7 +14862,7 @@ var ApprovalCard = React100.memo(
|
|
|
14835
14862
|
style: i < details.length - 1 ? { borderBottomColor: theme?.border } : {},
|
|
14836
14863
|
children: [
|
|
14837
14864
|
/* @__PURE__ */ jsx128("span", { className: "text-cardText/50", style: s.muted, children: d.label }),
|
|
14838
|
-
/* @__PURE__ */ jsx128("span", { className: "font-medium text-cardText", style: s.text, children:
|
|
14865
|
+
/* @__PURE__ */ jsx128("span", { className: "font-medium text-cardText", style: s.text, children: formatCellValue(d.value, "label") })
|
|
14839
14866
|
]
|
|
14840
14867
|
},
|
|
14841
14868
|
i
|
|
@@ -15122,7 +15149,7 @@ var DataTableCard = React103.memo(
|
|
|
15122
15149
|
isHighlight ? "font-semibold text-gold" : colIdx === 0 ? "font-medium text-cardText" : "text-cardText/60"
|
|
15123
15150
|
),
|
|
15124
15151
|
style: isHighlight ? s.accent : colIdx === 0 ? s.text : s.muted,
|
|
15125
|
-
children: typeof cell === "object" ?
|
|
15152
|
+
children: typeof cell === "object" ? formatCellValue(cell, "cell") : String(cell)
|
|
15126
15153
|
},
|
|
15127
15154
|
colIdx
|
|
15128
15155
|
);
|
|
@@ -16117,7 +16144,7 @@ var ResearchBriefCard = ({
|
|
|
16117
16144
|
item.label,
|
|
16118
16145
|
": "
|
|
16119
16146
|
] }),
|
|
16120
|
-
/* @__PURE__ */ jsx138("span", { className: "text-muted-foreground", children:
|
|
16147
|
+
/* @__PURE__ */ jsx138("span", { className: "text-muted-foreground", children: formatCellValue(item.value, "label") })
|
|
16121
16148
|
] }, `${item.label}-${idx}`)) })
|
|
16122
16149
|
] })
|
|
16123
16150
|
]
|
|
@@ -16212,8 +16239,8 @@ var CampaignBriefCard = ({
|
|
|
16212
16239
|
] }),
|
|
16213
16240
|
constraints.length > 0 ? /* @__PURE__ */ jsx140("ul", { className: "mt-4 space-y-1.5 text-sm text-foreground/90", children: constraints.map((item, i) => /* @__PURE__ */ jsxs100("li", { children: [
|
|
16214
16241
|
"- ",
|
|
16215
|
-
|
|
16216
|
-
] }, `${item}-${i}`)) }) : null
|
|
16242
|
+
formatCellValue(item, "label")
|
|
16243
|
+
] }, `${typeof item === "object" ? i : item}-${i}`)) }) : null
|
|
16217
16244
|
] });
|
|
16218
16245
|
};
|
|
16219
16246
|
|
|
@@ -21023,7 +21050,7 @@ var MCQCard = React114.memo(
|
|
|
21023
21050
|
};
|
|
21024
21051
|
const optionsEntries = resolvedOptions && Object.keys(resolvedOptions).length > 0 ? Object.entries(resolvedOptions).map(([key, val]) => [
|
|
21025
21052
|
key,
|
|
21026
|
-
typeof val === "string" ? val : typeof val === "object" && val !== null ? val.label || val.description || val.id ||
|
|
21053
|
+
typeof val === "string" ? val : typeof val === "object" && val !== null ? val.label || val.description || val.id || formatCellValue(val, "label") : String(val ?? "")
|
|
21027
21054
|
]) : [];
|
|
21028
21055
|
const labelFor = (key) => {
|
|
21029
21056
|
const found = optionsEntries.find(([k]) => k === key);
|
|
@@ -21963,7 +21990,7 @@ var CampaignConceptCard = React116.memo(
|
|
|
21963
21990
|
if (val.length === 0)
|
|
21964
21991
|
return /* @__PURE__ */ jsx172("span", { className: "text-muted-foreground text-sm", children: "-" });
|
|
21965
21992
|
return /* @__PURE__ */ jsx172("div", { className: "flex flex-wrap gap-2 pt-1", children: val.map((item, idx) => {
|
|
21966
|
-
const label = typeof item === "object" && item !== null ? item.label || item.value || item.name ||
|
|
21993
|
+
const label = typeof item === "object" && item !== null ? item.label || item.value || item.name || formatCellValue(item, "badge") : String(item);
|
|
21967
21994
|
return /* @__PURE__ */ jsx172(
|
|
21968
21995
|
"span",
|
|
21969
21996
|
{
|
|
@@ -22003,7 +22030,7 @@ var CampaignConceptCard = React116.memo(
|
|
|
22003
22030
|
index !== void 0 ? index : "",
|
|
22004
22031
|
" :",
|
|
22005
22032
|
" ",
|
|
22006
|
-
typeof cardTitle === "object" ?
|
|
22033
|
+
typeof cardTitle === "object" ? formatCellValue(cardTitle, "title") : String(cardTitle)
|
|
22007
22034
|
] }),
|
|
22008
22035
|
/* @__PURE__ */ jsxs129("div", { className: "flex flex-wrap gap-2", children: [
|
|
22009
22036
|
isRecommended && /* @__PURE__ */ jsx172("span", { className: "text-[10px] font-semibold uppercase tracking-widest text-gold", children: "Recommended" }),
|
|
@@ -22061,7 +22088,7 @@ var CampaignConceptCard = React116.memo(
|
|
|
22061
22088
|
FormCard,
|
|
22062
22089
|
{
|
|
22063
22090
|
...formCardProps,
|
|
22064
|
-
title: typeof cardTitle === "object" ?
|
|
22091
|
+
title: typeof cardTitle === "object" ? formatCellValue(cardTitle, "title") : String(cardTitle),
|
|
22065
22092
|
data,
|
|
22066
22093
|
fields,
|
|
22067
22094
|
showTimeline: true,
|
|
@@ -26702,6 +26729,22 @@ var CONTEXT_DEPENDENT_COMPONENTS = /* @__PURE__ */ new Set([
|
|
|
26702
26729
|
"NavigationMenuContent",
|
|
26703
26730
|
"NavigationMenuItem"
|
|
26704
26731
|
]);
|
|
26732
|
+
var renderComponentNotFoundError = (componentName, key) => {
|
|
26733
|
+
return /* @__PURE__ */ jsxs144(
|
|
26734
|
+
"div",
|
|
26735
|
+
{
|
|
26736
|
+
className: "p-4 border-2 border-dashed border-gray-300 rounded-lg bg-gray-50/80 my-2",
|
|
26737
|
+
children: [
|
|
26738
|
+
/* @__PURE__ */ jsx195("p", { className: "text-sm font-semibold text-gray-600", children: "This content couldn't be displayed." }),
|
|
26739
|
+
/* @__PURE__ */ jsxs144("p", { className: "text-xs text-gray-400 mt-1", children: [
|
|
26740
|
+
"Unknown component: ",
|
|
26741
|
+
componentName
|
|
26742
|
+
] })
|
|
26743
|
+
]
|
|
26744
|
+
},
|
|
26745
|
+
key
|
|
26746
|
+
);
|
|
26747
|
+
};
|
|
26705
26748
|
var COMPONENT_SUGGESTIONS = {
|
|
26706
26749
|
FormLabel: "FormInputAtom (with label prop)",
|
|
26707
26750
|
FormControl: "FormInputAtom",
|
|
@@ -26956,7 +26999,7 @@ var PXEngineRenderer = React120.memo(function PXEngineRenderer2({
|
|
|
26956
26999
|
console.warn(
|
|
26957
27000
|
`[PXEngineRenderer] Component not found: ${componentName}`
|
|
26958
27001
|
);
|
|
26959
|
-
return
|
|
27002
|
+
return renderComponentNotFoundError(componentName, uniqueKey);
|
|
26960
27003
|
}
|
|
26961
27004
|
}
|
|
26962
27005
|
const resolvedNormalized = resolvedIdentifier.charAt(0).toUpperCase() + resolvedIdentifier.slice(1);
|