@flytedan/flytebot-design-system 0.63.0 → 0.64.0

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
@@ -1095,6 +1095,7 @@ __export(index_exports, {
1095
1095
  formatDuration: () => formatDuration,
1096
1096
  formatEta: () => formatEta,
1097
1097
  formatRelative: () => formatRelative,
1098
+ formatShare: () => formatShare,
1098
1099
  groupMessages: () => groupMessages,
1099
1100
  hasModifier: () => hasModifier,
1100
1101
  historyUrlAdapter: () => historyUrlAdapter,
@@ -3923,11 +3924,13 @@ function DonutChart({
3923
3924
  // src/components/data/BarList.tsx
3924
3925
  var React25 = __toESM(require("react"), 1);
3925
3926
  var import_jsx_runtime40 = require("react/jsx-runtime");
3927
+ var wholePercent = (share) => formatPercent(Math.round(share * 100));
3926
3928
  function BarList({
3927
3929
  rows,
3928
3930
  label,
3929
3931
  valueFormat = formatCompact,
3930
3932
  total,
3933
+ shareFormat = wholePercent,
3931
3934
  sort = true,
3932
3935
  maxRows,
3933
3936
  barHeight = 10,
@@ -3956,9 +3959,9 @@ function BarList({
3956
3959
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("ol", { className: "fd-barlist-list", "aria-label": label, children: ordered.map((r, i) => {
3957
3960
  const value = Number(r.value) || 0;
3958
3961
  const barPct = Math.max(0, Math.min(100, value / maxValue * 100));
3959
- const pct = effectiveTotal ? Math.round(value / effectiveTotal * 100) : 0;
3962
+ const share = effectiveTotal ? value / effectiveTotal : 0;
3960
3963
  const color = chartColor(i, r.color);
3961
- const detail = `${r.label} \u2014 ${valueFormat(value)} (${formatPercent(pct)})`;
3964
+ const detail = `${r.label} \u2014 ${valueFormat(value)} (${shareFormat(share)})`;
3962
3965
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("li", { className: "fd-barlist-row", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Tooltip, { label: detail, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("button", { type: "button", className: "fd-barlist-btn", children: [
3963
3966
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "fd-barlist-label", title: truncationTitle(r.label), children: r.label }),
3964
3967
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "fd-barlist-track", style: { height: barHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("svg", { viewBox: "0 0 100 10", preserveAspectRatio: "none", role: "img", "aria-label": detail, children: [
@@ -3966,7 +3969,7 @@ function BarList({
3966
3969
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("rect", { x: 0, y: 0, width: barPct, height: 10, rx: 3, fill: color })
3967
3970
  ] }) }),
3968
3971
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "fd-barlist-value fd-tabular", children: valueFormat(value) }),
3969
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "fd-barlist-pct fd-tabular", children: formatPercent(pct) })
3972
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "fd-barlist-pct fd-tabular", children: shareFormat(share) })
3970
3973
  ] }) }) }, r.id);
3971
3974
  }) }),
3972
3975
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
@@ -3976,8 +3979,8 @@ function BarList({
3976
3979
  columns: ["", "Value", "Percent"],
3977
3980
  rows: ordered.map((r) => {
3978
3981
  const value = Number(r.value) || 0;
3979
- const pct = effectiveTotal ? Math.round(value / effectiveTotal * 100) : 0;
3980
- return [r.label, valueFormat(value), formatPercent(pct)];
3982
+ const share = effectiveTotal ? value / effectiveTotal : 0;
3983
+ return [r.label, valueFormat(value), shareFormat(share)];
3981
3984
  })
3982
3985
  }
3983
3986
  )
@@ -7721,6 +7724,7 @@ function USChoropleth({ values, label, valueLabel, formatValue, formatReadout, t
7721
7724
  rows: model.top.map((row) => ({ id: row.code, label: row.name, value: row.value, color: "var(--seq-4)" })),
7722
7725
  valueFormat: formatValue,
7723
7726
  total: model.total,
7727
+ shareFormat: formatShare,
7724
7728
  sort: false
7725
7729
  }
7726
7730
  ) }) : null
@@ -16339,6 +16343,7 @@ function useDocumentTitle(routeTitle, appName) {
16339
16343
  formatDuration,
16340
16344
  formatEta,
16341
16345
  formatRelative,
16346
+ formatShare,
16342
16347
  groupMessages,
16343
16348
  hasModifier,
16344
16349
  historyUrlAdapter,