@tomaszjarosz/react-visualizers 0.4.0 → 0.4.3

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
@@ -713,23 +713,12 @@ const StatusPanel = ({
713
713
  return /* @__PURE__ */ jsxRuntime.jsxs(
714
714
  "div",
715
715
  {
716
- className: "p-3 bg-gray-50 rounded-lg overflow-hidden",
716
+ className: "p-3 bg-gray-50 rounded-lg",
717
717
  role: "status",
718
718
  "aria-live": "polite",
719
719
  "aria-atomic": "true",
720
720
  children: [
721
- /* @__PURE__ */ jsxRuntime.jsxs(
722
- "div",
723
- {
724
- className: `text-sm font-medium ${VARIANT_STYLES$1[variant]} flex items-center gap-1.5 transition-all duration-150 ${isAnimating ? "opacity-0 translate-y-1" : "opacity-100 translate-y-0"}`,
725
- children: [
726
- Icon2 && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "w-4 h-4 flex-shrink-0 animate-in fade-in duration-300", "aria-hidden": "true" }),
727
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: srPrefix }),
728
- displayedDescription
729
- ]
730
- }
731
- ),
732
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-2 flex items-center gap-2", children: [
721
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
733
722
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 h-1 bg-gray-200 rounded-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
734
723
  "div",
735
724
  {
@@ -749,7 +738,18 @@ const StatusPanel = ({
749
738
  ]
750
739
  }
751
740
  )
752
- ] })
741
+ ] }),
742
+ /* @__PURE__ */ jsxRuntime.jsxs(
743
+ "div",
744
+ {
745
+ className: `text-sm font-medium ${VARIANT_STYLES$1[variant]} flex items-start gap-1.5 transition-all duration-150 ${isAnimating ? "opacity-0 translate-y-1" : "opacity-100 translate-y-0"}`,
746
+ children: [
747
+ Icon2 && /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "w-4 h-4 flex-shrink-0 animate-in fade-in duration-300 mt-0.5", "aria-hidden": "true" }),
748
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: srPrefix }),
749
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: displayedDescription })
750
+ ]
751
+ }
752
+ )
753
753
  ]
754
754
  }
755
755
  );
@@ -1146,13 +1146,15 @@ const ShareButton = ({
1146
1146
  const VisualizationArea = ({
1147
1147
  children,
1148
1148
  minHeight = 300,
1149
+ fixedHeight = false,
1149
1150
  className = ""
1150
1151
  }) => {
1152
+ const style = fixedHeight ? { height: `${minHeight}px`, minHeight: `${minHeight}px`, maxHeight: `${minHeight}px` } : { minHeight: `${minHeight}px` };
1151
1153
  return /* @__PURE__ */ jsxRuntime.jsx(
1152
1154
  "div",
1153
1155
  {
1154
- className: `relative ${className}`,
1155
- style: { minHeight: `${minHeight}px` },
1156
+ className: `relative ${fixedHeight ? "overflow-auto" : ""} ${className}`,
1157
+ style,
1156
1158
  children
1157
1159
  }
1158
1160
  );
@@ -1252,6 +1254,7 @@ const BaseVisualizerLayout = ({
1252
1254
  onShare,
1253
1255
  children,
1254
1256
  minHeight = 400,
1257
+ fixedHeight = false,
1255
1258
  sidePanel,
1256
1259
  status,
1257
1260
  controls,
@@ -1290,12 +1293,10 @@ const BaseVisualizerLayout = ({
1290
1293
  ),
1291
1294
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4", children: [
1292
1295
  infoBox,
1293
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex gap-4 ${hasSidePanel ? "flex-col lg:flex-row" : ""}`, children: [
1294
- /* @__PURE__ */ jsxRuntime.jsxs(VisualizationArea, { minHeight, className: "flex-1", children: [
1295
- children,
1296
- status && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { ...status }) })
1297
- ] }),
1298
- hasSidePanel && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lg:w-80 flex-shrink-0 flex flex-col gap-4", children: [
1296
+ status && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { ...status }) }),
1297
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex gap-4 ${hasSidePanel ? "flex-col lg:flex-row lg:items-start" : ""}`, children: [
1298
+ /* @__PURE__ */ jsxRuntime.jsx(VisualizationArea, { minHeight, fixedHeight, className: "flex-1", children }),
1299
+ hasSidePanel && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lg:w-80 flex-shrink-0 flex flex-col gap-4 lg:sticky lg:top-4", children: [
1299
1300
  hasCodePanel && /* @__PURE__ */ jsxRuntime.jsx(
1300
1301
  CodePanel,
1301
1302
  {
@@ -17027,6 +17028,10 @@ const BlockingQueueVisualizerComponent = ({ showControls = true, showCode = true
17027
17028
  ] })
17028
17029
  ] })
17029
17030
  ] }),
17031
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-center gap-8 text-gray-400 text-lg mb-4", children: [
17032
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "→ put()" }),
17033
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "take() →" })
17034
+ ] }),
17030
17035
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4 mb-4", children: [
17031
17036
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
17032
17037
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-medium text-gray-500 mb-2 text-center", children: "Producers" }),
@@ -17051,6 +17056,13 @@ const BlockingQueueVisualizerComponent = ({ showControls = true, showCode = true
17051
17056
  ")"
17052
17057
  ] }),
17053
17058
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-gray-100 rounded-lg p-2 min-h-[100px]", children: [
17059
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-2 h-1.5 bg-gray-200 rounded-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
17060
+ "div",
17061
+ {
17062
+ className: `h-full transition-colors ${queue.length === capacity ? "bg-red-500" : "bg-cyan-500"}`,
17063
+ style: { width: `${queue.length / capacity * 100}%` }
17064
+ }
17065
+ ) }),
17054
17066
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1", children: queue.length > 0 ? queue.map((item, idx) => /* @__PURE__ */ jsxRuntime.jsx(
17055
17067
  "div",
17056
17068
  {
@@ -17058,14 +17070,7 @@ const BlockingQueueVisualizerComponent = ({ showControls = true, showCode = true
17058
17070
  children: item.value
17059
17071
  },
17060
17072
  item.id
17061
- )) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-gray-400 text-xs py-4", children: "Empty" }) }),
17062
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 h-1.5 bg-gray-200 rounded-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
17063
- "div",
17064
- {
17065
- className: `h-full transition-colors ${queue.length === capacity ? "bg-red-500" : "bg-cyan-500"}`,
17066
- style: { width: `${queue.length / capacity * 100}%` }
17067
- }
17068
- ) })
17073
+ )) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-gray-400 text-xs py-4", children: "Empty" }) })
17069
17074
  ] })
17070
17075
  ] }),
17071
17076
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
@@ -17082,10 +17087,6 @@ const BlockingQueueVisualizerComponent = ({ showControls = true, showCode = true
17082
17087
  c
17083
17088
  )) })
17084
17089
  ] })
17085
- ] }),
17086
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-center gap-8 text-gray-400 text-lg mb-4", children: [
17087
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "→ put()" }),
17088
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "take() →" })
17089
17090
  ] })
17090
17091
  ] });
17091
17092
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -17096,7 +17097,8 @@ const BlockingQueueVisualizerComponent = ({ showControls = true, showCode = true
17096
17097
  badges: BADGES$c,
17097
17098
  gradient: "cyan",
17098
17099
  className,
17099
- minHeight: 350,
17100
+ minHeight: 420,
17101
+ fixedHeight: true,
17100
17102
  status: {
17101
17103
  description,
17102
17104
  currentStep,