@flytedan/flytebot-design-system 0.11.5 → 0.11.6

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
@@ -8309,11 +8309,24 @@ function SaturationDistribution({ campuses = [], floorBand, floorScore, onSelect
8309
8309
  // src/components/planner/MixGap.tsx
8310
8310
  var React37 = __toESM(require("react"), 1);
8311
8311
  var import_jsx_runtime67 = require("react/jsx-runtime");
8312
+ var MIX_GAP_LAYOUT = {
8313
+ trackHeight: 30,
8314
+ barHeight: 20,
8315
+ targetWidth: 6,
8316
+ labelGap: 6,
8317
+ labelGutter: 50
8318
+ };
8319
+ var MIX_GAP_TARGET_STRIPE = "repeating-linear-gradient(135deg, var(--n-600) 0 2px, var(--n-300) 2px 4px)";
8320
+ function mixGapOffset(value, max) {
8321
+ return `calc((100% - ${MIX_GAP_LAYOUT.labelGutter}px) * ${value / max})`;
8322
+ }
8312
8323
  function MixGap({ rows = [], loading = false, className = "" }) {
8313
8324
  const max = Math.max(1, ...rows.flatMap((r) => [r.target, r.realized]));
8314
8325
  const [hover, setHover] = React37.useState(null);
8315
8326
  const toneOf = (gap) => gap >= -1 ? "ok" : gap >= -4 ? "warn" : "danger";
8316
8327
  const TONE = { ok: "var(--ok-solid)", warn: "var(--warn-solid)", danger: "var(--danger-solid)" };
8328
+ const { trackHeight, barHeight, targetWidth, labelGap } = MIX_GAP_LAYOUT;
8329
+ const barTop = (trackHeight - barHeight) / 2;
8317
8330
  return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: ["fd-stack", className].filter(Boolean).join(" "), style: { gap: 4 }, children: [
8318
8331
  /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "fd-row", style: { gap: 16, justifyContent: "flex-end", paddingBottom: 6, flexWrap: "wrap" }, children: [
8319
8332
  [["On target", TONE.ok], ["Close", TONE.warn], ["Short", TONE.danger]].map(([l, c]) => /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("span", { className: "fd-row fd-body-sm fd-muted", style: { gap: 6 }, children: [
@@ -8321,7 +8334,7 @@ function MixGap({ rows = [], loading = false, className = "" }) {
8321
8334
  l
8322
8335
  ] }, l)),
8323
8336
  /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("span", { className: "fd-row fd-body-sm fd-muted", style: { gap: 6 }, children: [
8324
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { style: { width: 3, height: 14, background: "var(--n-500)" } }),
8337
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { "data-mixgap-legend-target": "", style: { width: targetWidth, height: 16, borderRadius: 1, background: MIX_GAP_TARGET_STRIPE } }),
8325
8338
  "Target"
8326
8339
  ] })
8327
8340
  ] }),
@@ -8329,6 +8342,7 @@ function MixGap({ rows = [], loading = false, className = "" }) {
8329
8342
  const gap = r.realized - r.target;
8330
8343
  const tone = toneOf(gap);
8331
8344
  const tip = "Realized " + r.realized + "% vs " + r.target + "% target" + (gap < -1 ? " \xB7 " + Math.abs(gap).toFixed(0) + " pts short" : gap > 1 ? " \xB7 " + gap.toFixed(0) + " pts over" : " \xB7 on target") + (r.note ? " \u2014 " + r.note : "");
8345
+ const labelLeft = r.realized > r.target ? `calc(${mixGapOffset(r.realized, max)} + ${labelGap}px)` : `calc(${mixGapOffset(r.target, max)} + ${targetWidth / 2 + labelGap}px)`;
8332
8346
  return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
8333
8347
  "div",
8334
8348
  {
@@ -8338,14 +8352,14 @@ function MixGap({ rows = [], loading = false, className = "" }) {
8338
8352
  onMouseLeave: () => setHover(null),
8339
8353
  children: [
8340
8354
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { style: { width: 128, flex: "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChannelTag, { channel: r.channel, size: "sm" }) }),
8341
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { style: { position: "relative", flex: 1, height: 22, minWidth: 120 }, children: loading ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "fd-skel", style: { position: "absolute", inset: "5px 0", borderRadius: 3 } }) : /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
8342
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { style: { position: "absolute", left: 0, top: 5, height: 12, width: r.realized / max * 100 + "%", background: TONE[tone], borderRadius: "2px 3px 3px 2px", transition: "width var(--dur-slow) var(--ease), background var(--dur-base) var(--ease)" } }),
8343
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { style: { position: "absolute", left: r.target / max * 100 + "%", top: 0, width: 3, height: 22, background: "var(--n-500)", borderRadius: 1 } }),
8344
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("span", { className: "fd-num", style: { position: "absolute", right: Math.max(r.realized, r.target) / max > 0.82 ? 0 : "auto", left: Math.max(r.realized, r.target) / max > 0.82 ? "auto" : "calc(" + Math.max(r.realized, r.target) / max * 100 + "% + 10px)", top: 2, fontSize: 12, color: "var(--text-muted)", whiteSpace: "nowrap", background: Math.max(r.realized, r.target) / max > 0.82 ? "var(--surface)" : "none", paddingLeft: 3 }, children: [
8355
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { style: { position: "relative", flex: 1, height: trackHeight, minWidth: 120 }, children: loading ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "fd-skel", style: { position: "absolute", left: 0, right: 0, top: barTop, height: barHeight, borderRadius: 3 } }) : /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
8356
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { "data-mixgap-bar": "", style: { position: "absolute", left: 0, top: barTop, height: barHeight, width: mixGapOffset(r.realized, max), background: TONE[tone], borderRadius: "2px 3px 3px 2px", transition: "width var(--dur-slow) var(--ease), background var(--dur-base) var(--ease)" } }),
8357
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { "data-mixgap-target": "", style: { position: "absolute", left: `calc(${mixGapOffset(r.target, max)} - ${targetWidth / 2}px)`, top: 0, width: targetWidth, height: trackHeight, background: MIX_GAP_TARGET_STRIPE, borderRadius: 1 } }),
8358
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("span", { "data-mixgap-label": "", className: "fd-num", style: { position: "absolute", left: labelLeft, top: "50%", transform: "translateY(-50%)", fontSize: 12, color: "var(--text-muted)", whiteSpace: "nowrap" }, children: [
8345
8359
  r.realized,
8346
8360
  "%"
8347
8361
  ] }),
8348
- hover === r.channel ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "fd-tooltip", role: "tooltip", style: { position: "absolute", left: 0, right: "auto", bottom: 26, maxWidth: "min(340px, 100%)", whiteSpace: "normal", textAlign: "left", width: "max-content" }, children: tip }) : null
8362
+ hover === r.channel ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "fd-tooltip", role: "tooltip", style: { position: "absolute", left: 0, right: "auto", bottom: trackHeight + 4, maxWidth: "min(340px, 100%)", whiteSpace: "normal", textAlign: "left", width: "max-content" }, children: tip }) : null
8349
8363
  ] }) })
8350
8364
  ]
8351
8365
  },