@deepnoid/ui 0.1.181 → 0.1.183

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.
@@ -402,8 +402,8 @@ var BarChartComponent = (0, import_react.forwardRef)((originalProps, ref) => {
402
402
  const { payload, x, y } = e;
403
403
  if (!payload || !payload[dataKey]) return;
404
404
  setTooltipState({
405
- x,
406
- y,
405
+ barX: x,
406
+ barY: y - 10,
407
407
  value: payload[dataKey],
408
408
  dataKey,
409
409
  label: payload.title
@@ -474,7 +474,7 @@ var BarChartComponent = (0, import_react.forwardRef)((originalProps, ref) => {
474
474
  const tooltipRect = tooltipRef.current.getBoundingClientRect();
475
475
  const chartWidth = chartRect.width;
476
476
  const tooltipWidth = tooltipRect.width;
477
- let left = tooltipState.x - tooltipWidth / 2;
477
+ let left = tooltipState.barX - tooltipWidth / 2;
478
478
  const padding2 = 8;
479
479
  if (left < padding2) {
480
480
  left = padding2;
@@ -483,114 +483,128 @@ var BarChartComponent = (0, import_react.forwardRef)((originalProps, ref) => {
483
483
  }
484
484
  setTooltipLeft(left);
485
485
  }, [tooltipState]);
486
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ref: chartRef, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), onMouseLeave: handleMouseLeave, children: [
487
- label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }),
488
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
489
- import_recharts.BarChart,
490
- {
491
- data,
492
- margin: { left: -20 },
493
- barSize: 20,
494
- barGap,
495
- className: "[&_.recharts-surface]:outline-none [&_.recharts-surface]:focus:outline-none",
496
- children: [
497
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("defs", { children: [
498
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { id: "blueGradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
499
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "0%", stopColor: "#DEC1FA" }),
500
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "100%", stopColor: "#3F9CF2" })
501
- ] }),
502
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { id: "greenGradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
503
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "0%", stopColor: "#C2E59C" }),
504
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "100%", stopColor: "#64B3F4" })
505
- ] }),
506
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { id: "pinkGradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
507
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "0%", stopColor: "#DDD6F3" }),
508
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "100%", stopColor: "#FAACA8" })
509
- ] })
510
- ] }),
511
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
512
- import_recharts.CartesianGrid,
513
- {
514
- vertical: true,
515
- horizontal: false,
516
- strokeDasharray: "4 4",
517
- className: "stroke-neutral-light",
518
- verticalPoints: tickPositions
519
- }
520
- ),
521
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
522
- import_recharts.XAxis,
523
- {
524
- dataKey: "title",
525
- axisLine: { stroke: "#DFE2E7", strokeWidth: 1 },
526
- tickLine: false,
527
- tick: CustomTick,
528
- padding: { left: 0, right: 0 }
529
- }
530
- ),
531
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
532
- import_recharts.YAxis,
533
- {
534
- axisLine: { stroke: "#DFE2E7", strokeWidth: 1 },
535
- tickLine: false,
536
- tick: CustomYAxisTick,
537
- ticks: yAxisTicks,
538
- domain: yAxisDomain
539
- }
540
- ),
541
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
542
- import_recharts.Bar,
543
- {
544
- dataKey: "blue",
545
- fill: "url(#blueGradient)",
546
- shape: CustomBarShape,
547
- onMouseEnter: (e) => handleMouseEnter(e, "blue"),
548
- onMouseLeave: handleMouseLeave
549
- }
550
- ),
551
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
552
- import_recharts.Bar,
553
- {
554
- dataKey: "green",
555
- fill: "url(#greenGradient)",
556
- shape: CustomBarShape,
557
- onMouseEnter: (e) => handleMouseEnter(e, "green"),
558
- onMouseLeave: handleMouseLeave
559
- }
560
- ),
561
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
562
- import_recharts.Bar,
563
- {
564
- dataKey: "pink",
565
- fill: "url(#pinkGradient)",
566
- shape: CustomBarShape,
567
- onMouseEnter: (e) => handleMouseEnter(e, "pink"),
568
- onMouseLeave: handleMouseLeave
569
- }
570
- )
571
- ]
572
- }
573
- ) }),
574
- tooltipFormatter && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
575
- "div",
576
- {
577
- ref: tooltipRef,
578
- style: {
579
- position: "absolute",
580
- left: tooltipLeft + 10,
581
- top: (tooltipState == null ? void 0 : tooltipState.y) ? tooltipState.y - 40 : 0,
582
- pointerEvents: "none",
583
- zIndex: 10,
584
- opacity: tooltipState ? 1 : 0,
585
- transition: "opacity 0.1s ease-out",
586
- visibility: tooltipState ? "visible" : "hidden",
587
- width: "fit-content",
588
- whiteSpace: "nowrap"
589
- },
590
- children: tooltipState && tooltipFormatter(tooltipState)
591
- }
592
- )
593
- ] });
486
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
487
+ "div",
488
+ {
489
+ ref: chartRef,
490
+ className: slots.base({ class: classNames == null ? void 0 : classNames.base }),
491
+ onMouseLeave: handleMouseLeave,
492
+ onMouseMove: (e) => {
493
+ const target = e.target;
494
+ if (!target.closest('[data-testid="recharts-bar-rectangle"]') && !target.closest(".recharts-bar-rectangle") && target.tagName !== "path") {
495
+ setTooltipState(null);
496
+ }
497
+ },
498
+ children: [
499
+ label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }),
500
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
501
+ import_recharts.BarChart,
502
+ {
503
+ data,
504
+ margin: { left: -20 },
505
+ barSize: 20,
506
+ barGap,
507
+ className: "[&_.recharts-surface]:outline-none [&_.recharts-surface]:focus:outline-none",
508
+ children: [
509
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("defs", { children: [
510
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { id: "blueGradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
511
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "0%", stopColor: "#DEC1FA" }),
512
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "100%", stopColor: "#3F9CF2" })
513
+ ] }),
514
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { id: "greenGradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
515
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "0%", stopColor: "#C2E59C" }),
516
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "100%", stopColor: "#64B3F4" })
517
+ ] }),
518
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { id: "pinkGradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
519
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "0%", stopColor: "#DDD6F3" }),
520
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { offset: "100%", stopColor: "#FAACA8" })
521
+ ] })
522
+ ] }),
523
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
524
+ import_recharts.CartesianGrid,
525
+ {
526
+ vertical: true,
527
+ horizontal: false,
528
+ strokeDasharray: "4 4",
529
+ className: "stroke-neutral-light",
530
+ verticalPoints: tickPositions
531
+ }
532
+ ),
533
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
534
+ import_recharts.XAxis,
535
+ {
536
+ dataKey: "title",
537
+ axisLine: { stroke: "#DFE2E7", strokeWidth: 1 },
538
+ tickLine: false,
539
+ tick: CustomTick,
540
+ padding: { left: 0, right: 0 }
541
+ }
542
+ ),
543
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
544
+ import_recharts.YAxis,
545
+ {
546
+ axisLine: { stroke: "#DFE2E7", strokeWidth: 1 },
547
+ tickLine: false,
548
+ tick: CustomYAxisTick,
549
+ ticks: yAxisTicks,
550
+ domain: yAxisDomain
551
+ }
552
+ ),
553
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
554
+ import_recharts.Bar,
555
+ {
556
+ dataKey: "blue",
557
+ fill: "url(#blueGradient)",
558
+ shape: CustomBarShape,
559
+ onMouseEnter: (e) => handleMouseEnter(e, "blue"),
560
+ onMouseLeave: handleMouseLeave
561
+ }
562
+ ),
563
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
564
+ import_recharts.Bar,
565
+ {
566
+ dataKey: "green",
567
+ fill: "url(#greenGradient)",
568
+ shape: CustomBarShape,
569
+ onMouseEnter: (e) => handleMouseEnter(e, "green"),
570
+ onMouseLeave: handleMouseLeave
571
+ }
572
+ ),
573
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
574
+ import_recharts.Bar,
575
+ {
576
+ dataKey: "pink",
577
+ fill: "url(#pinkGradient)",
578
+ shape: CustomBarShape,
579
+ onMouseEnter: (e) => handleMouseEnter(e, "pink"),
580
+ onMouseLeave: handleMouseLeave
581
+ }
582
+ )
583
+ ]
584
+ }
585
+ ) }),
586
+ tooltipFormatter && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
587
+ "div",
588
+ {
589
+ ref: tooltipRef,
590
+ style: {
591
+ position: "absolute",
592
+ left: tooltipLeft + 10,
593
+ top: (tooltipState == null ? void 0 : tooltipState.barY) || 0,
594
+ pointerEvents: "none",
595
+ zIndex: 10,
596
+ opacity: tooltipState ? 1 : 0,
597
+ transition: "opacity 0.1s ease-out",
598
+ visibility: tooltipState ? "visible" : "hidden",
599
+ width: "fit-content",
600
+ whiteSpace: "nowrap"
601
+ },
602
+ children: tooltipState && tooltipFormatter(tooltipState)
603
+ }
604
+ )
605
+ ]
606
+ }
607
+ );
594
608
  });
595
609
  BarChartComponent.displayName = "barChart";
596
610
  var barChart_default = BarChartComponent;
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  BarChartTooltip,
4
4
  barChart_default
5
- } from "../../chunk-JOK735WN.mjs";
5
+ } from "../../chunk-WKTRWHDA.mjs";
6
6
  import "../../chunk-E3G5QXSH.mjs";
7
7
  import "../../chunk-U4DJHAM5.mjs";
8
8
  import "../../chunk-AC6TWLRT.mjs";