@inf-monkeys-tech/monkeys-design 1.0.56 → 1.0.60

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.
@@ -11352,6 +11352,22 @@ function WorkbenchAssetGallery({
11352
11352
  }
11353
11353
  ) });
11354
11354
  }
11355
+
11356
+ // src/components/workbench/workbenchVisualizationTone.ts
11357
+ var toneVariable = {
11358
+ primary: "--radar-series-one",
11359
+ secondary: "--radar-series-two",
11360
+ accent: "--radar-series-three",
11361
+ muted: "--radar-series-four"
11362
+ };
11363
+ var toneFallback = {
11364
+ primary: "var(--primary)",
11365
+ secondary: "var(--secondary-foreground)",
11366
+ accent: "var(--accent-foreground)",
11367
+ muted: "var(--muted-foreground)"
11368
+ };
11369
+ var workbenchVisualizationToneColor = (tone) => `hsl(var(${toneVariable[tone]}, ${toneFallback[tone]}))`;
11370
+ var workbenchVisualizationToneColorWithAlpha = (tone, alpha) => `hsl(var(${toneVariable[tone]}, ${toneFallback[tone]}) / ${alpha})`;
11355
11371
  var radarWorkspaceStyle = {
11356
11372
  backgroundColor: "hsl(var(--radar-canvas, var(--background)))",
11357
11373
  color: "hsl(var(--foreground))"
@@ -11516,24 +11532,166 @@ function WorkbenchRadarInspectorSection({
11516
11532
  }
11517
11533
  );
11518
11534
  }
11535
+ function assertValidRadarFilterRowProps(props) {
11536
+ const { disclosure, onSelect } = props;
11537
+ const invalid = !disclosure && !onSelect || disclosure?.mode === "integrated" && (Boolean(onSelect) || props.selected !== void 0) || disclosure?.mode === "separate" && !onSelect;
11538
+ if (invalid) {
11539
+ throw new Error("Invalid WorkbenchRadarFilterRow props.");
11540
+ }
11541
+ }
11542
+ function WorkbenchRadarFilterRow(props) {
11543
+ assertValidRadarFilterRowProps(props);
11544
+ const {
11545
+ label,
11546
+ value,
11547
+ icon,
11548
+ selected,
11549
+ disabled = false,
11550
+ tone,
11551
+ onSelect,
11552
+ disclosure,
11553
+ className
11554
+ } = props;
11555
+ const isSelected = selected ?? false;
11556
+ const selectedClasses = isSelected ? void 0 : "monkeys-workbench-radar-filter-row--idle";
11557
+ const disabledClasses = disabled ? "monkeys-workbench-radar-filter-disabled" : void 0;
11558
+ const resolvedTone = tone ?? "primary";
11559
+ const toneColor = workbenchVisualizationToneColor(resolvedTone);
11560
+ const style = {
11561
+ "--workbench-radar-filter-tone": toneColor,
11562
+ "--tw-ring-color": tone ? toneColor : "hsl(var(--ring))",
11563
+ ...isSelected || tone ? {
11564
+ backgroundColor: workbenchVisualizationToneColorWithAlpha(
11565
+ resolvedTone,
11566
+ isSelected ? 0.14 : 0.08
11567
+ ),
11568
+ borderColor: toneColor
11569
+ } : {}
11570
+ };
11571
+ const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11572
+ hasRenderableNode(icon) ? /* @__PURE__ */ jsxRuntime.jsx(
11573
+ "span",
11574
+ {
11575
+ className: cn(
11576
+ "flex size-4 shrink-0 items-center justify-center",
11577
+ tone ? "text-[var(--workbench-radar-filter-tone)]" : "text-muted-foreground"
11578
+ ),
11579
+ "aria-hidden": "true",
11580
+ children: icon
11581
+ }
11582
+ ) : null,
11583
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 truncate", children: label }),
11584
+ hasRenderableNode(value) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto shrink-0 tabular-nums text-muted-foreground", children: value }) : null
11585
+ ] });
11586
+ const disclosureIcon = disclosure ? /* @__PURE__ */ jsxRuntime.jsx(
11587
+ "span",
11588
+ {
11589
+ "aria-hidden": "true",
11590
+ className: cn(
11591
+ "text-lg leading-none transition-transform motion-reduce:transition-none",
11592
+ disclosure.expanded && "rotate-90"
11593
+ ),
11594
+ children: "\u203A"
11595
+ }
11596
+ ) : null;
11597
+ if (disclosure?.mode === "separate") {
11598
+ const disclosureLabel2 = disclosure.expanded ? disclosure.collapseLabel : disclosure.expandLabel;
11599
+ return /* @__PURE__ */ jsxRuntime.jsxs(
11600
+ "div",
11601
+ {
11602
+ "data-monkeys-component": "workbench-radar-filter-row",
11603
+ className: cn(
11604
+ "monkeys-workbench-radar-filter-row monkeys-workbench-radar-filter-row--separate",
11605
+ selectedClasses,
11606
+ disabledClasses,
11607
+ className
11608
+ ),
11609
+ style,
11610
+ children: [
11611
+ /* @__PURE__ */ jsxRuntime.jsx(
11612
+ "button",
11613
+ {
11614
+ type: "button",
11615
+ "aria-pressed": selected,
11616
+ disabled,
11617
+ onClick: onSelect,
11618
+ className: cn(
11619
+ "monkeys-workbench-radar-filter-control monkeys-workbench-radar-filter-row__action",
11620
+ disabledClasses
11621
+ ),
11622
+ children: content
11623
+ }
11624
+ ),
11625
+ /* @__PURE__ */ jsxRuntime.jsx(
11626
+ "button",
11627
+ {
11628
+ type: "button",
11629
+ "aria-expanded": disclosure.expanded,
11630
+ "aria-controls": disclosure.controls,
11631
+ "aria-label": disclosureLabel2,
11632
+ disabled,
11633
+ onClick: disclosure.onToggle,
11634
+ className: cn(
11635
+ "monkeys-workbench-radar-filter-row__disclosure",
11636
+ disabledClasses
11637
+ ),
11638
+ children: disclosureIcon
11639
+ }
11640
+ )
11641
+ ]
11642
+ }
11643
+ );
11644
+ }
11645
+ const integratedDisclosure = disclosure?.mode === "integrated" ? disclosure : void 0;
11646
+ const disclosureLabel = integratedDisclosure ? integratedDisclosure.expanded ? integratedDisclosure.collapseLabel : integratedDisclosure.expandLabel : void 0;
11647
+ return /* @__PURE__ */ jsxRuntime.jsxs(
11648
+ "button",
11649
+ {
11650
+ type: "button",
11651
+ "data-monkeys-component": "workbench-radar-filter-row",
11652
+ "aria-label": disclosureLabel,
11653
+ "aria-pressed": integratedDisclosure ? void 0 : selected,
11654
+ "aria-expanded": integratedDisclosure?.expanded,
11655
+ "aria-controls": integratedDisclosure?.controls,
11656
+ disabled,
11657
+ onClick: integratedDisclosure?.onToggle ?? onSelect,
11658
+ className: cn(
11659
+ "monkeys-workbench-radar-filter-control monkeys-workbench-radar-filter-row",
11660
+ selectedClasses,
11661
+ disabledClasses,
11662
+ className
11663
+ ),
11664
+ style,
11665
+ children: [
11666
+ content,
11667
+ integratedDisclosure ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto shrink-0 text-muted-foreground", children: disclosureIcon }) : null
11668
+ ]
11669
+ }
11670
+ );
11671
+ }
11519
11672
  function WorkbenchRadarFilterChip({
11520
11673
  label,
11521
11674
  value,
11522
11675
  icon,
11523
11676
  selected = false,
11677
+ disabled = false,
11524
11678
  onSelect,
11525
11679
  className
11526
11680
  }) {
11527
- const Comp = onSelect ? "button" : "div";
11681
+ const interactive = Boolean(onSelect) || disabled;
11682
+ const Comp = interactive ? "button" : "div";
11528
11683
  return /* @__PURE__ */ jsxRuntime.jsxs(
11529
11684
  Comp,
11530
11685
  {
11531
- type: onSelect ? "button" : void 0,
11532
- "aria-pressed": onSelect ? selected : void 0,
11686
+ type: interactive ? "button" : void 0,
11687
+ "aria-pressed": onSelect && !disabled ? selected : void 0,
11688
+ disabled: interactive ? disabled : void 0,
11533
11689
  onClick: onSelect,
11534
11690
  className: cn(
11535
- "flex min-h-9 min-w-0 items-center gap-2 rounded-full border px-3 text-xs font-semibold outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring motion-reduce:transition-none",
11691
+ "flex min-w-0 items-center border text-xs font-semibold outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring motion-reduce:transition-none",
11692
+ "monkeys-workbench-radar-filter-control rounded-full",
11536
11693
  selected ? "border-primary bg-primary/20 text-primary" : "border-border bg-background/40 text-foreground hover:border-primary/60 hover:bg-primary/10",
11694
+ disabled && "cursor-not-allowed opacity-50",
11537
11695
  className
11538
11696
  ),
11539
11697
  children: [
@@ -11554,20 +11712,6 @@ var getDomain2 = (values, min, max) => {
11554
11712
  };
11555
11713
  var scale2 = (value, domain, start, end) => start + (value - domain[0]) / (domain[1] - domain[0]) * (end - start);
11556
11714
  var clamp5 = (value, min, max) => Math.min(max, Math.max(min, value));
11557
- var toneVariable = {
11558
- primary: "--radar-series-one",
11559
- secondary: "--radar-series-two",
11560
- accent: "--radar-series-three",
11561
- muted: "--radar-series-four"
11562
- };
11563
- var toneFallback = {
11564
- primary: "var(--primary)",
11565
- secondary: "var(--secondary-foreground)",
11566
- accent: "var(--accent-foreground)",
11567
- muted: "var(--muted-foreground)"
11568
- };
11569
- var toneColor = (tone) => `hsl(var(${toneVariable[tone]}, ${toneFallback[tone]}))`;
11570
- var toneColorWithAlpha = (tone, alpha) => `hsl(var(${toneVariable[tone]}, ${toneFallback[tone]}) / ${alpha})`;
11571
11715
  var activatePoint2 = (event, point, onPointSelect) => {
11572
11716
  if (!onPointSelect || event.key !== "Enter" && event.key !== " ") return;
11573
11717
  event.preventDefault();
@@ -11742,12 +11886,12 @@ function WorkbenchRadarMatrix({
11742
11886
  const radius = labelled ? clamp5(scale2(point.size ?? 1, sizeDomain, 5, 9), 5, 9) : 3.5;
11743
11887
  const fontSize = labelled ? clamp5(scale2(point.size ?? 1, sizeDomain, 14, 31), 14, 31) : 0;
11744
11888
  const pointStyle = {
11745
- fill: toneColor(tone),
11889
+ fill: workbenchVisualizationToneColor(tone),
11746
11890
  stroke: "hsl(var(--foreground) / 0.74)"
11747
11891
  };
11748
11892
  const labelStyle = {
11749
- fill: toneColor(tone),
11750
- filter: `drop-shadow(0 0 0.65rem ${toneColorWithAlpha(tone, 0.72)})`
11893
+ fill: workbenchVisualizationToneColor(tone),
11894
+ filter: `drop-shadow(0 0 0.65rem ${workbenchVisualizationToneColorWithAlpha(tone, 0.72)})`
11751
11895
  };
11752
11896
  return /* @__PURE__ */ jsxRuntime.jsxs(
11753
11897
  "g",
@@ -11767,7 +11911,7 @@ function WorkbenchRadarMatrix({
11767
11911
  r: radius + 10,
11768
11912
  fill: "none",
11769
11913
  strokeWidth: "2",
11770
- style: { stroke: toneColorWithAlpha(tone, 0.48) }
11914
+ style: { stroke: workbenchVisualizationToneColorWithAlpha(tone, 0.48) }
11771
11915
  }
11772
11916
  ) : null,
11773
11917
  /* @__PURE__ */ jsxRuntime.jsx("circle", { r: radius, strokeWidth: "1.25", style: pointStyle }),
@@ -11845,7 +11989,7 @@ function WorkbenchRadarMatrix({
11845
11989
  cx: clamp5(scale2(point.x, xDomain, 40, width - 40), 40, width - 40),
11846
11990
  cy: clamp5(scale2(point.y, yDomain, height - 48, 54), 54, height - 48),
11847
11991
  r: "8",
11848
- style: { fill: toneColor(point.tone || (index % 2 === 0 ? "primary" : "accent")) }
11992
+ style: { fill: workbenchVisualizationToneColor(point.tone || (index % 2 === 0 ? "primary" : "accent")) }
11849
11993
  },
11850
11994
  point.id
11851
11995
  )),
@@ -11868,7 +12012,7 @@ function WorkbenchRadarMatrix({
11868
12012
  legend.length ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute bottom-4 left-1/2 hidden -translate-x-1/2 items-center gap-4 rounded-full border border-border bg-card/95 px-4 py-2 text-xs font-semibold shadow-xl md:flex", children: legend.map((item) => {
11869
12013
  const tone = item.tone || "muted";
11870
12014
  return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2 text-muted-foreground", children: [
11871
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-2 rounded-full", style: { backgroundColor: toneColor(tone) } }),
12015
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-2 rounded-full", style: { backgroundColor: workbenchVisualizationToneColor(tone) } }),
11872
12016
  item.label
11873
12017
  ] }, item.id);
11874
12018
  }) }) : null
@@ -11898,6 +12042,7 @@ exports.WorkbenchMasonryLayout = WorkbenchMasonryLayout;
11898
12042
  exports.WorkbenchMetricGrid = WorkbenchMetricGrid;
11899
12043
  exports.WorkbenchPageSkeleton = WorkbenchPageSkeleton;
11900
12044
  exports.WorkbenchRadarFilterChip = WorkbenchRadarFilterChip;
12045
+ exports.WorkbenchRadarFilterRow = WorkbenchRadarFilterRow;
11901
12046
  exports.WorkbenchRadarInspectorSection = WorkbenchRadarInspectorSection;
11902
12047
  exports.WorkbenchRadarMatrix = WorkbenchRadarMatrix;
11903
12048
  exports.WorkbenchRadarNavigation = WorkbenchRadarNavigation;