pxengine 0.1.28 → 0.1.29

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 CHANGED
@@ -352,6 +352,10 @@ __export(atoms_exports, {
352
352
  VideoAtom: () => VideoAtom
353
353
  });
354
354
 
355
+ // src/atoms/TextAtom.tsx
356
+ var import_react_markdown = __toESM(require("react-markdown"), 1);
357
+ var import_remark_gfm = __toESM(require("remark-gfm"), 1);
358
+
355
359
  // src/lib/utils.ts
356
360
  var import_clsx = require("clsx");
357
361
  var import_tailwind_merge = require("tailwind-merge");
@@ -366,7 +370,8 @@ var TextAtom = ({
366
370
  variant = "p",
367
371
  className,
368
372
  style,
369
- backgroundColor
373
+ backgroundColor,
374
+ markdown = false
370
375
  }) => {
371
376
  const baseStyles = {
372
377
  h1: "scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl text-gray900",
@@ -379,14 +384,25 @@ var TextAtom = ({
379
384
  label: "text-[10px] font-bold text-gray400 uppercase tracking-widest pl-1"
380
385
  };
381
386
  const Component2 = variant === "small" || variant === "muted" || variant === "label" ? "p" : variant;
387
+ const wrapperStyles = {
388
+ ...style,
389
+ ...backgroundColor && { backgroundColor }
390
+ };
391
+ if (markdown) {
392
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
393
+ "div",
394
+ {
395
+ className: cn(baseStyles[variant], "prose prose-sm max-w-none", className),
396
+ style: wrapperStyles,
397
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_markdown.default, { remarkPlugins: [import_remark_gfm.default], children: content })
398
+ }
399
+ );
400
+ }
382
401
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
383
402
  Component2,
384
403
  {
385
404
  className: cn(baseStyles[variant], className),
386
- style: {
387
- ...style,
388
- ...backgroundColor && { backgroundColor }
389
- },
405
+ style: wrapperStyles,
390
406
  children: content
391
407
  }
392
408
  );
@@ -34202,7 +34218,7 @@ var import_react56 = __toESM(require("react"), 1);
34202
34218
  var import_jsx_runtime96 = require("react/jsx-runtime");
34203
34219
  var FormCard = import_react56.default.memo(
34204
34220
  ({
34205
- // title,
34221
+ title,
34206
34222
  fields,
34207
34223
  data,
34208
34224
  editingFields = {},
@@ -34215,15 +34231,40 @@ var FormCard = import_react56.default.memo(
34215
34231
  proceedLabel,
34216
34232
  onProceed,
34217
34233
  isLatestMessage = true,
34234
+ hideTitle = false,
34235
+ hideCopyButton = false,
34218
34236
  className,
34219
34237
  footer
34220
34238
  }) => {
34239
+ const [copied, setCopied] = (0, import_react56.useState)(false);
34221
34240
  const handleCopyAll = () => {
34222
- const text = fields.map((field) => {
34223
- const value = data[field.key];
34224
- return `${field.label}: ${typeof value === "object" ? JSON.stringify(value) : value}`;
34225
- }).join("\n");
34226
- navigator.clipboard.writeText(text);
34241
+ const flattenValue = (val) => {
34242
+ if (val === null || val === void 0) return "-";
34243
+ if (Array.isArray(val)) {
34244
+ return val.map((item) => {
34245
+ if (typeof item === "object" && item !== null) {
34246
+ return item.label || item.value || item.name || JSON.stringify(item);
34247
+ }
34248
+ return String(item);
34249
+ }).join(", ");
34250
+ }
34251
+ if (typeof val === "object") {
34252
+ return Object.entries(val).map(([k, v]) => `${k.replace(/_/g, " ")}: ${v}`).join(", ");
34253
+ }
34254
+ return String(val);
34255
+ };
34256
+ const text = [
34257
+ title,
34258
+ "",
34259
+ ...fields.map((field) => {
34260
+ const value = data[field.key];
34261
+ return `${field.label}: ${flattenValue(value)}`;
34262
+ })
34263
+ ].join("\n");
34264
+ navigator.clipboard.writeText(text).then(() => {
34265
+ setCopied(true);
34266
+ setTimeout(() => setCopied(false), 2e3);
34267
+ });
34227
34268
  };
34228
34269
  return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(
34229
34270
  "div",
@@ -34233,16 +34274,23 @@ var FormCard = import_react56.default.memo(
34233
34274
  className
34234
34275
  ),
34235
34276
  children: [
34236
- /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
34277
+ !hideCopyButton && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
34237
34278
  "button",
34238
34279
  {
34239
34280
  onClick: handleCopyAll,
34240
34281
  title: "Copy all details",
34241
- className: "absolute top-4 right-4 p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray200 text-gray-400 hover:text-gray-600 dark:hover:text-gray300 transition-all active:scale-95 z-10",
34242
- children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(Copy, { className: "h-4 w-4" })
34282
+ className: "absolute top-4 right-4 p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-200 text-gray-400 hover:text-gray-600 dark:hover:text-gray300 transition-all active:scale-95 z-10",
34283
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(Check, { className: "h-4 w-4 text-green-500" }) : /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(Copy, { className: "h-4 w-4" })
34243
34284
  }
34244
34285
  ),
34245
34286
  /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("div", { className: "p-6 relative", children: [
34287
+ !hideTitle && title && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
34288
+ "h3",
34289
+ {
34290
+ className: "text-gray900 dark:text-white mb-12 font-bold",
34291
+ children: title
34292
+ }
34293
+ ),
34246
34294
  showTimeline && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
34247
34295
  "div",
34248
34296
  {
@@ -35396,7 +35444,7 @@ var CampaignSeedCard = import_react60.default.memo(
35396
35444
  showTimeline: true,
35397
35445
  isLatestMessage: effectiveIsLatest,
35398
35446
  className: cn("font-noto", className),
35399
- footer: !effectiveIsLatest && (selectionStatus || hasUserResponded) ? /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: "flex justify-end items-center gap-1.5 text-green-600 text-[10px] font-semibold py-4 pr-6", children: [
35447
+ footer: !effectiveIsLatest && selectionStatus ? /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)("div", { className: "flex justify-end items-center gap-1.5 text-green-600 text-[10px] font-semibold py-4 pr-6", children: [
35400
35448
  /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(CircleCheck, { className: "h-3.5 w-3.5" }),
35401
35449
  /* @__PURE__ */ (0, import_jsx_runtime107.jsx)("span", { children: selectionStatus === "agent" ? "Suggested by Agent" : "Selected by you" })
35402
35450
  ] }) : formCardProps.footer
@@ -35491,7 +35539,7 @@ var SearchSpecCard = import_react61.default.memo(
35491
35539
  });
35492
35540
  };
35493
35541
  const effectiveIsLatest = isLatestMessage && !hasUserResponded;
35494
- return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
35542
+ return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
35495
35543
  FormCard,
35496
35544
  {
35497
35545
  ...formCardProps,
@@ -35502,12 +35550,12 @@ var SearchSpecCard = import_react61.default.memo(
35502
35550
  onProceed: handleProceed,
35503
35551
  isLatestMessage: effectiveIsLatest,
35504
35552
  className,
35505
- footer: !effectiveIsLatest && (selectionStatus || hasUserResponded) ? /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: "flex justify-end items-center gap-1.5 text-green-600 text-xs font-semibold py-1", children: [
35553
+ footer: !effectiveIsLatest && selectionStatus ? /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: "flex justify-end items-center gap-1.5 text-green-600 text-xs font-semibold py-1", children: [
35506
35554
  /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(CircleCheck, { className: "h-4 w-4" }),
35507
35555
  /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("span", { children: selectionStatus === "agent" ? "Selected by Agent" : "Selected by User" })
35508
35556
  ] }) : formCardProps.footer
35509
35557
  }
35510
- );
35558
+ ) });
35511
35559
  }
35512
35560
  );
35513
35561
  SearchSpecCard.displayName = "SearchSpecCard";
@@ -36458,7 +36506,7 @@ var CampaignConceptCard = import_react64.default.memo(
36458
36506
  /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("h2", { className: "mb-1 py-1 text-txtColor font-bold", children: typeof cardTitle === "object" ? JSON.stringify(cardTitle) : String(cardTitle) }),
36459
36507
  /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex flex-wrap gap-2", children: [
36460
36508
  isRecommended && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "inline-flex text-[10px] font-bold uppercase tracking-widest text-[#22C55E]", children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "bg-[#22C55E]/10 px-2 py-0.5 rounded border border-[#22C55E]/20", children: "Recommended" }) }),
36461
- !effectiveIsLatest && (selectionStatus || hasUserResponded) && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "inline-flex text-[10px] font-bold uppercase tracking-widest text-[#3B82F6]", children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "bg-[#3B82F6]/10 px-2 py-0.5 rounded border border-[#3B82F6]/20", children: selectionStatus === "agent" ? "Selected by Agent" : "Selected by You" }) })
36509
+ !effectiveIsLatest && selectionStatus && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "inline-flex text-[10px] font-bold uppercase tracking-widest text-[#3B82F6]", children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { className: "bg-[#3B82F6]/10 px-2 py-0.5 rounded border border-[#3B82F6]/20", children: selectionStatus === "agent" ? "Selected by Agent" : "Selected by You" }) })
36462
36510
  ] })
36463
36511
  ] }),
36464
36512
  /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex items-center gap-2 ml-3", onClick: (e) => e.stopPropagation(), children: [
@@ -36524,8 +36572,10 @@ var CampaignConceptCard = import_react64.default.memo(
36524
36572
  proceedLabel: "Continue with this concept",
36525
36573
  onProceed: handleProceed,
36526
36574
  isLatestMessage: effectiveIsLatest,
36575
+ hideTitle: true,
36576
+ hideCopyButton: true,
36527
36577
  className: "bg-transparent border-none shadow-none mb-0 p-0",
36528
- footer: !effectiveIsLatest && (selectionStatus || hasUserResponded) ? /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex justify-end items-center gap-1.5 text-green-600 text-[10px] font-semibold py-4 pr-6", children: [
36578
+ footer: !effectiveIsLatest && selectionStatus ? /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "flex justify-end items-center gap-1.5 text-green-600 text-[10px] font-semibold py-4 pr-6", children: [
36529
36579
  /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(CircleCheck, { className: "h-3.5 w-3.5" }),
36530
36580
  /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { children: selectionStatus === "agent" ? "Selected by Agent" : "Selected by You" })
36531
36581
  ] }) : formCardProps.footer