@parto-system-design/ui 1.0.1 → 1.0.2

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
@@ -9330,6 +9330,7 @@ function PartoHeatMap({
9330
9330
 
9331
9331
  // src/components/charts/PartoWordCloud.tsx
9332
9332
  var React32 = __toESM(require("react"), 1);
9333
+ var import_react_dom3 = require("react-dom");
9333
9334
  var import_wordcloud = require("@visx/wordcloud");
9334
9335
  var import_scale = require("@visx/scale");
9335
9336
  var import_text = require("@visx/text");
@@ -9386,28 +9387,25 @@ function PartoWordCloud({
9386
9387
  return fontScale(datum.value);
9387
9388
  };
9388
9389
  const handleMouseMove = (event, text, value) => {
9389
- if (containerRef.current) {
9390
- const containerRect = containerRef.current.getBoundingClientRect();
9391
- const x = event.clientX - containerRect.left;
9392
- const y = event.clientY - containerRect.top;
9393
- setHovered({
9394
- text,
9395
- value,
9396
- x,
9397
- y,
9398
- color: primaryColor
9399
- });
9400
- }
9390
+ const x = event.clientX;
9391
+ const y = event.clientY;
9392
+ setHovered({
9393
+ text,
9394
+ value,
9395
+ x,
9396
+ y,
9397
+ color: primaryColor
9398
+ });
9401
9399
  };
9402
- return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
9400
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
9403
9401
  "div",
9404
9402
  {
9405
9403
  ref: containerRef,
9406
9404
  className,
9407
9405
  style: { position: "relative", width: "100%", height: "100%", display: "flex", alignItems: "center", justifyContent: "center" },
9408
9406
  dir: "rtl",
9409
- children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { style: { position: "relative", width, height, display: "flex", alignItems: "center", justifyContent: "center" }, children: [
9410
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
9407
+ children: [
9408
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { style: { position: "relative", width, height, display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
9411
9409
  import_wordcloud.Wordcloud,
9412
9410
  {
9413
9411
  words: formattedWords,
@@ -9445,29 +9443,33 @@ function PartoWordCloud({
9445
9443
  ) }, w.text);
9446
9444
  })
9447
9445
  }
9448
- ),
9449
- hovered && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
9450
- "div",
9451
- {
9452
- className: "pointer-events-none absolute z-50",
9453
- style: {
9454
- left: `${hovered.x}px`,
9455
- top: `${hovered.y - 50}px`,
9456
- transform: "translateX(-50%)"
9457
- },
9458
- children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl", children: [
9459
- /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center gap-2", children: [
9460
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "h-2.5 w-2.5 rounded-[2px]", style: { backgroundColor: hovered.color } }),
9461
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "font-medium", children: hovered.text })
9462
- ] }),
9463
- /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center justify-between", children: [
9464
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "text-muted-foreground", children: "\u062A\u0639\u062F\u0627\u062F" }),
9465
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "font-mono font-medium tabular-nums", children: hovered.value.toLocaleString("fa-IR") })
9446
+ ) }),
9447
+ hovered && typeof document !== "undefined" && (0, import_react_dom3.createPortal)(
9448
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
9449
+ "div",
9450
+ {
9451
+ className: "pointer-events-none fixed z-[9999]",
9452
+ dir: "ltr",
9453
+ style: {
9454
+ left: `${hovered.x}px`,
9455
+ top: `${hovered.y - 10}px`,
9456
+ transform: "translate(-50%, -100%)"
9457
+ },
9458
+ children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl", dir: "rtl", children: [
9459
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center gap-2", children: [
9460
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "h-2.5 w-2.5 rounded-[2px]", style: { backgroundColor: hovered.color } }),
9461
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "font-medium", children: hovered.text })
9462
+ ] }),
9463
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center justify-between", children: [
9464
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "text-muted-foreground", children: "\u062A\u0639\u062F\u0627\u062F" }),
9465
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "font-mono font-medium tabular-nums", children: hovered.value.toLocaleString("fa-IR") })
9466
+ ] })
9466
9467
  ] })
9467
- ] })
9468
- }
9468
+ }
9469
+ ),
9470
+ document.body
9469
9471
  )
9470
- ] })
9472
+ ]
9471
9473
  }
9472
9474
  );
9473
9475
  }