@ai-matrx/records-ui 0.116.11 → 0.116.12

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/CHANGELOG.md CHANGED
@@ -12,7 +12,7 @@
12
12
  - Tests: `vitest.setup.ts` gives jsdom a no-op `performance.mark` / `measure`.
13
13
  - **New subpath `@ai-matrx/records-ui/data-source`:** `recordsDataSource`, `personActor` and the who-changed words (`whenWords`, `actorWords`, `actorBadge`, `lastChangeSentence`, `SOMEBODY`, `THE_SYSTEM`) alone. `/helpers` also carries the field-type words, the colour resolver and the table builders, which read `@ai-matrx/records/core`; this entry reaches `@ai-matrx/kit` only, and shares the one data-source cache with `/helpers` and the root. Additive. Consumer action: a shell-reachable service that only binds its supabase client or says when imports from `/data-source`.
14
14
 
15
- ## 0.116.11
15
+ ## 0.116.12
16
16
 
17
17
  UNVERIFIED: this release has no Unreleased entry and the source comparison could not be made (the caller supplied no source comparison). Whether source changed is unknown; consumer action is unknown.
18
18
  Check the package's gitHead on npm against this version's gitHead: `git diff <previous gitHead> <this gitHead> -- apps/shared/records-ui/src`.
package/dist/index.cjs CHANGED
@@ -43020,8 +43020,15 @@ function asRefusal2(block) {
43020
43020
  "dashboard_run"
43021
43021
  );
43022
43022
  }
43023
+ function colorOfGroup(groups, colors) {
43024
+ if (!colors) return null;
43025
+ const values = Object.values(groups);
43026
+ if (values.length > 1) return null;
43027
+ const raw = values[0];
43028
+ return colors[raw === null || raw === void 0 ? "" : String(raw)] ?? null;
43029
+ }
43023
43030
  var NO_GROUPS = { title: "", kind: "bar", group_by: [], rows: [] };
43024
- function ChartBlock({ block, subject, tableName: tableName2, className, centerValue, variant = "card", source }) {
43031
+ function ChartBlock({ block, subject, tableName: tableName2, className, centerValue, centerTotal, legend = true, groupColors, variant = "card", source }) {
43025
43032
  const bare = variant === "bare";
43026
43033
  const host = useRecordsUi();
43027
43034
  const kind2 = block.kind;
@@ -43072,10 +43079,10 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
43072
43079
  };
43073
43080
  }
43074
43081
  points.forEach((point, index) => {
43075
- out[point.label] ??= { label: point.label, color: SERIES_COLORS[index % SERIES_COLORS.length] };
43082
+ out[point.label] ??= { label: point.label, color: (!windows ? colorOfGroup(point.groups, groupColors) : null) ?? SERIES_COLORS[index % SERIES_COLORS.length] };
43076
43083
  });
43077
43084
  return out;
43078
- }, [primary, measureName, windows, points]);
43085
+ }, [primary, measureName, windows, points, groupColors]);
43079
43086
  const goal = target && typeof target.value === "number" ? {
43080
43087
  value: typeof target.pace === "number" ? target.pace : block.bucket ? null : target.value,
43081
43088
  label: typeof target.pace === "number" && target.per !== "bucket" ? `${target.label} pace` : target.label
@@ -43134,10 +43141,11 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
43134
43141
  config,
43135
43142
  onDrill: drill,
43136
43143
  goal,
43137
- ...centerValue ? { center: points.reduce((sum, p) => sum + (p.values[primary] ?? 0), 0) } : {}
43144
+ ...centerValue ? { center: centerTotal !== void 0 ? centerTotal : points.reduce((sum, p) => sum + (p.values[primary] ?? 0), 0) } : {},
43145
+ showLegend: legend
43138
43146
  }
43139
43147
  ),
43140
- kind2 === "donut" ? null : /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(Values, { points, measure: primary, config, onDrill: drill, compared, aimingUp: !!target })
43148
+ kind2 === "donut" || !legend ? null : /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(Values, { points, measure: primary, config, onDrill: drill, compared, aimingUp: !!target })
43141
43149
  ] }) })
43142
43150
  ]
43143
43151
  }
@@ -43344,7 +43352,8 @@ function Drawing({
43344
43352
  config,
43345
43353
  onDrill,
43346
43354
  goal,
43347
- center
43355
+ center,
43356
+ showLegend = true
43348
43357
  }) {
43349
43358
  const compared = series.length > 1;
43350
43359
  const drawOrder = compared ? [series[1], series[0]] : series;
@@ -43401,15 +43410,15 @@ function Drawing({
43401
43410
  {
43402
43411
  className: "pointer-events-none absolute inset-0 flex items-center justify-center px-6 font-semibold tabular-nums",
43403
43412
  "data-records-chart-center": "",
43404
- title: pretty(center),
43405
- style: { fontSize: pretty(center).length > 6 ? 13 : 16 },
43406
- children: pretty(center).length > 7 ? compactTick(center) : pretty(center)
43413
+ title: center === null ? void 0 : pretty(center),
43414
+ style: { fontSize: center !== null && pretty(center).length > 6 ? 13 : 16 },
43415
+ children: center === null ? "\u2013" : pretty(center).length > 7 ? compactTick(center) : pretty(center)
43407
43416
  }
43408
43417
  )
43409
43418
  ] });
43410
43419
  return /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2", "data-records-donut": "", children: [
43411
43420
  ringWithCenter,
43412
- /* @__PURE__ */ (0, import_jsx_runtime143.jsx)("ul", { className: "flex min-w-[8rem] max-w-md flex-1 basis-40 flex-col gap-0.5 overflow-y-auto overscroll-contain", style: { maxHeight: DONUT_LEGEND_MAX_PX }, "data-records-donut-legend": "", children: points.map((point, at) => {
43421
+ showLegend ? /* @__PURE__ */ (0, import_jsx_runtime143.jsx)("ul", { className: "flex min-w-[8rem] max-w-md flex-1 basis-40 flex-col gap-0.5 overflow-y-auto overscroll-contain", style: { maxHeight: DONUT_LEGEND_MAX_PX }, "data-records-donut-legend": "", children: points.map((point, at) => {
43413
43422
  const value = point.values[series[0]] ?? 0;
43414
43423
  const share = total > 0 ? Math.round(value / total * 1e3) / 10 : 0;
43415
43424
  const row = /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)(import_jsx_runtime143.Fragment, { children: [
@@ -43419,7 +43428,7 @@ function Drawing({
43419
43428
  /* @__PURE__ */ (0, import_jsx_runtime143.jsx)("span", { className: "w-10 shrink-0 text-right tabular-nums text-muted-foreground", "data-records-donut-share": "", children: `${share}%` })
43420
43429
  ] });
43421
43430
  return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)("li", { className: "min-w-0 text-xs", children: onDrill ? /* @__PURE__ */ (0, import_jsx_runtime143.jsx)("button", { type: "button", className: "flex w-full min-w-0 items-center gap-2 rounded px-1 py-0.5 text-left hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", onClick: () => onDrill(point), children: row }) : /* @__PURE__ */ (0, import_jsx_runtime143.jsx)("span", { className: "flex w-full min-w-0 items-center gap-2 px-1 py-0.5", children: row }) }, `${at}:${point.label}`);
43422
- }) })
43431
+ }) }) : null
43423
43432
  ] });
43424
43433
  }
43425
43434
  if (kind2 === "line") {