@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.
@@ -63,8 +63,8 @@ var SimpleBarChartComponent = forwardRef((originalProps, ref) => {
63
63
  const { payload, x, y } = e;
64
64
  if (!payload) return;
65
65
  setTooltipState({
66
- x,
67
- y,
66
+ barX: x,
67
+ barY: y - 20,
68
68
  value: payload.value,
69
69
  label: payload.title
70
70
  });
@@ -107,7 +107,7 @@ var SimpleBarChartComponent = forwardRef((originalProps, ref) => {
107
107
  const tooltipRect = tooltipRef.current.getBoundingClientRect();
108
108
  const chartWidth = chartRect.width;
109
109
  const tooltipWidth = tooltipRect.width;
110
- let left = tooltipState.x - tooltipWidth / 2;
110
+ let left = tooltipState.barX - tooltipWidth / 2;
111
111
  const padding = 8;
112
112
  if (left < padding) {
113
113
  left = padding;
@@ -116,82 +116,96 @@ var SimpleBarChartComponent = forwardRef((originalProps, ref) => {
116
116
  }
117
117
  setTooltipLeft(left);
118
118
  }, [tooltipState]);
119
- return /* @__PURE__ */ jsxs("div", { ref: chartRef, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), onMouseLeave: handleMouseLeave, children: [
120
- label && /* @__PURE__ */ jsx("p", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }),
121
- /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: 140, children: /* @__PURE__ */ jsxs(
122
- BarChart,
123
- {
124
- data,
125
- margin: { left: 0, right: 0, top: 0, bottom: 0 },
126
- barSize: 10,
127
- barGap,
128
- className: "[&_.recharts-surface]:outline-none [&_.recharts-surface]:focus:outline-none",
129
- children: [
130
- /* @__PURE__ */ jsx(
131
- CartesianGrid,
132
- {
133
- vertical: true,
134
- horizontal: false,
135
- strokeDasharray: "4 4",
136
- className: "stroke-neutral-light",
137
- verticalPoints: tickPositions
138
- }
139
- ),
140
- /* @__PURE__ */ jsx(
141
- CartesianGrid,
142
- {
143
- vertical: true,
144
- horizontal: false,
145
- strokeDasharray: "0",
146
- strokeWidth: 2,
147
- className: "stroke-neutral-light",
148
- verticalPoints: [0]
149
- }
150
- ),
151
- /* @__PURE__ */ jsx(
152
- XAxis,
153
- {
154
- dataKey: "title",
155
- axisLine: { stroke: "#DFE2E7", strokeWidth: 1 },
156
- tickLine: false,
157
- tick: CustomTick,
158
- padding: { left: 0, right: 0 }
159
- }
160
- ),
161
- /* @__PURE__ */ jsx(YAxis, { hide: true, ticks: yAxisTicks, domain: yAxisDomain }),
162
- /* @__PURE__ */ jsx(
163
- Bar,
164
- {
165
- dataKey: "value",
166
- fill: "#C7E5FA",
167
- shape: CustomBarShape,
168
- onMouseEnter: handleMouseEnter,
169
- onMouseLeave: handleMouseLeave
170
- }
171
- )
172
- ]
173
- }
174
- ) }),
175
- tooltipFormatter && /* @__PURE__ */ jsx(
176
- "div",
177
- {
178
- ref: tooltipRef,
179
- style: {
180
- position: "absolute",
181
- left: tooltipLeft + 5,
182
- top: (tooltipState == null ? void 0 : tooltipState.y) ? tooltipState.y - 20 : 0,
183
- pointerEvents: "none",
184
- zIndex: 10,
185
- opacity: tooltipState ? 1 : 0,
186
- transition: "opacity 0.1s ease-out",
187
- visibility: tooltipState ? "visible" : "hidden",
188
- width: "fit-content",
189
- whiteSpace: "nowrap"
190
- },
191
- children: tooltipState && tooltipFormatter(tooltipState)
192
- }
193
- )
194
- ] });
119
+ return /* @__PURE__ */ jsxs(
120
+ "div",
121
+ {
122
+ ref: chartRef,
123
+ className: slots.base({ class: classNames == null ? void 0 : classNames.base }),
124
+ onMouseLeave: handleMouseLeave,
125
+ onMouseMove: (e) => {
126
+ const target = e.target;
127
+ if (!target.closest('[data-testid="recharts-bar-rectangle"]') && !target.closest(".recharts-bar-rectangle") && target.tagName !== "path") {
128
+ setTooltipState(null);
129
+ }
130
+ },
131
+ children: [
132
+ label && /* @__PURE__ */ jsx("p", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }),
133
+ /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: 140, children: /* @__PURE__ */ jsxs(
134
+ BarChart,
135
+ {
136
+ data,
137
+ margin: { left: 0, right: 0, top: 0, bottom: 0 },
138
+ barSize: 10,
139
+ barGap,
140
+ className: "[&_.recharts-surface]:outline-none [&_.recharts-surface]:focus:outline-none",
141
+ children: [
142
+ /* @__PURE__ */ jsx(
143
+ CartesianGrid,
144
+ {
145
+ vertical: true,
146
+ horizontal: false,
147
+ strokeDasharray: "4 4",
148
+ className: "stroke-neutral-light",
149
+ verticalPoints: tickPositions
150
+ }
151
+ ),
152
+ /* @__PURE__ */ jsx(
153
+ CartesianGrid,
154
+ {
155
+ vertical: true,
156
+ horizontal: false,
157
+ strokeDasharray: "0",
158
+ strokeWidth: 2,
159
+ className: "stroke-neutral-light",
160
+ verticalPoints: [0]
161
+ }
162
+ ),
163
+ /* @__PURE__ */ jsx(
164
+ XAxis,
165
+ {
166
+ dataKey: "title",
167
+ axisLine: { stroke: "#DFE2E7", strokeWidth: 1 },
168
+ tickLine: false,
169
+ tick: CustomTick,
170
+ padding: { left: 0, right: 0 }
171
+ }
172
+ ),
173
+ /* @__PURE__ */ jsx(YAxis, { hide: true, ticks: yAxisTicks, domain: yAxisDomain }),
174
+ /* @__PURE__ */ jsx(
175
+ Bar,
176
+ {
177
+ dataKey: "value",
178
+ fill: "#C7E5FA",
179
+ shape: CustomBarShape,
180
+ onMouseEnter: handleMouseEnter,
181
+ onMouseLeave: handleMouseLeave
182
+ }
183
+ )
184
+ ]
185
+ }
186
+ ) }),
187
+ tooltipFormatter && /* @__PURE__ */ jsx(
188
+ "div",
189
+ {
190
+ ref: tooltipRef,
191
+ style: {
192
+ position: "absolute",
193
+ left: tooltipLeft + 5,
194
+ top: (tooltipState == null ? void 0 : tooltipState.barY) || 0,
195
+ pointerEvents: "none",
196
+ zIndex: 10,
197
+ opacity: tooltipState ? 1 : 0,
198
+ transition: "opacity 0.1s ease-out",
199
+ visibility: tooltipState ? "visible" : "hidden",
200
+ width: "fit-content",
201
+ whiteSpace: "nowrap"
202
+ },
203
+ children: tooltipState && tooltipFormatter(tooltipState)
204
+ }
205
+ )
206
+ ]
207
+ }
208
+ );
195
209
  });
196
210
  SimpleBarChartComponent.displayName = "simpleBarChart";
197
211
  var simpleBarChart_default = SimpleBarChartComponent;
@@ -15,6 +15,9 @@ import {
15
15
  clsx
16
16
  } from "./chunk-27Y6K5NK.mjs";
17
17
 
18
+ // src/components/table/table-head.tsx
19
+ import { isValidElement, useEffect as useEffect3, useRef as useRef2, useState as useState3 } from "react";
20
+
18
21
  // src/components/table/table.tsx
19
22
  import {
20
23
  forwardRef,
@@ -36,25 +39,46 @@ function TableCell({
36
39
  slots,
37
40
  classNames
38
41
  }) {
39
- var _a;
42
+ var _a, _b;
40
43
  const value = row[column.field];
41
44
  const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
42
45
  const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
43
46
  const tdRef = useRef(null);
44
47
  const [showTitle, setShowTitle] = useState(false);
45
- const checkOverflow = (el) => el.scrollWidth > el.clientWidth;
48
+ const checkOverflow = (el) => {
49
+ if (el.scrollWidth > el.clientWidth) {
50
+ return true;
51
+ }
52
+ const children = Array.from(el.children);
53
+ for (const child of children) {
54
+ if (child.scrollWidth > child.clientWidth) {
55
+ return true;
56
+ }
57
+ }
58
+ return false;
59
+ };
46
60
  useEffect(() => {
47
61
  if (tdRef.current) {
48
- setShowTitle(checkOverflow(tdRef.current));
62
+ setTimeout(() => {
63
+ if (tdRef.current) {
64
+ setShowTitle(checkOverflow(tdRef.current));
65
+ }
66
+ }, 0);
49
67
  }
50
68
  }, [content]);
51
69
  return /* @__PURE__ */ jsx(
52
70
  "td",
53
71
  {
54
72
  ref: tdRef,
55
- className: clsx(slots.td(), classNames == null ? void 0 : classNames.td, column.className, "truncate"),
73
+ className: clsx(
74
+ slots.td(),
75
+ classNames == null ? void 0 : classNames.td,
76
+ column.className,
77
+ "truncate",
78
+ "[&>*]:block [&>*]:w-full [&>*]:truncate"
79
+ ),
56
80
  style: { ...getCellStyle(column), maxWidth: column.width || "150px" },
57
- title: showTitle ? String(content) : void 0,
81
+ title: showTitle ? String(((_b = value == null ? void 0 : value.props) == null ? void 0 : _b.children) || content || "") : void 0,
58
82
  children: content
59
83
  },
60
84
  `${row.id}-${column.field}-${colIdx}-${rowIndex}`
@@ -518,20 +542,51 @@ var getCellStyle = (column) => {
518
542
 
519
543
  // src/components/table/table-head.tsx
520
544
  import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
521
- var TableHead = ({
545
+ function TableHeaderCell({
546
+ content,
547
+ column,
548
+ isCheckbox = false,
522
549
  slots,
523
- columns,
524
- color,
525
- size,
526
- rowCheckbox = false,
527
- hasCheckedRows,
528
- classNames,
529
- onCheckAll
530
- }) => {
531
- const renderTh = (content, key, column, isCheckbox) => /* @__PURE__ */ jsx3(
550
+ classNames
551
+ }) {
552
+ const thRef = useRef2(null);
553
+ const [showTitle, setShowTitle] = useState3(false);
554
+ const checkOverflow = (el) => {
555
+ if (el.scrollWidth > el.clientWidth) {
556
+ return true;
557
+ }
558
+ const children = Array.from(el.children);
559
+ for (const child of children) {
560
+ if (child.scrollWidth > child.clientWidth) {
561
+ return true;
562
+ }
563
+ }
564
+ return false;
565
+ };
566
+ const extractTextFromContent = (node) => {
567
+ if (typeof node === "string" || typeof node === "number") {
568
+ return String(node);
569
+ }
570
+ if (isValidElement(node)) {
571
+ return String(node.props.children || "");
572
+ }
573
+ return "";
574
+ };
575
+ useEffect3(() => {
576
+ if (thRef.current && !isCheckbox) {
577
+ setTimeout(() => {
578
+ if (thRef.current) {
579
+ setShowTitle(checkOverflow(thRef.current));
580
+ }
581
+ }, 0);
582
+ }
583
+ }, [content, isCheckbox]);
584
+ const titleText = !isCheckbox && showTitle ? extractTextFromContent(content) : void 0;
585
+ return /* @__PURE__ */ jsx3(
532
586
  "th",
533
587
  {
534
- className: clsx(slots.th({ class: classNames == null ? void 0 : classNames.th }), column == null ? void 0 : column.className),
588
+ ref: thRef,
589
+ className: clsx(slots.th({ class: classNames == null ? void 0 : classNames.th }), column == null ? void 0 : column.className, !isCheckbox && "truncate"),
535
590
  style: isCheckbox ? {
536
591
  width: "40px",
537
592
  minWidth: "40px",
@@ -540,24 +595,48 @@ var TableHead = ({
540
595
  flexGrow: 0,
541
596
  boxSizing: "border-box"
542
597
  } : column ? { ...getCellStyle(column), textAlign: "center" } : void 0,
598
+ title: titleText,
543
599
  children: content
544
- },
545
- key
600
+ }
546
601
  );
602
+ }
603
+ var TableHead = ({
604
+ slots,
605
+ columns,
606
+ color,
607
+ size,
608
+ rowCheckbox = false,
609
+ hasCheckedRows,
610
+ classNames,
611
+ onCheckAll
612
+ }) => {
547
613
  return /* @__PURE__ */ jsx3("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ jsxs3("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
548
- columns.map((column, idx) => renderTh(column.headerName, `${column.field}-${idx}`, column)),
549
- rowCheckbox && renderTh(
550
- /* @__PURE__ */ jsx3("div", { "data-checkbox": true, children: /* @__PURE__ */ jsx3(
551
- checkbox_default,
552
- {
553
- size,
554
- checked: hasCheckedRows,
555
- onChange: (e) => onCheckAll(e.target.checked)
556
- }
557
- ) }),
558
- "checkbox",
559
- void 0,
560
- true
614
+ columns.map((column, idx) => /* @__PURE__ */ jsx3(
615
+ TableHeaderCell,
616
+ {
617
+ content: column.headerName,
618
+ column,
619
+ slots,
620
+ classNames
621
+ },
622
+ `${column.field}-${idx}`
623
+ )),
624
+ rowCheckbox && /* @__PURE__ */ jsx3(
625
+ TableHeaderCell,
626
+ {
627
+ content: /* @__PURE__ */ jsx3("div", { "data-checkbox": true, children: /* @__PURE__ */ jsx3(
628
+ checkbox_default,
629
+ {
630
+ size,
631
+ checked: hasCheckedRows,
632
+ onChange: (e) => onCheckAll(e.target.checked)
633
+ }
634
+ ) }),
635
+ isCheckbox: true,
636
+ slots,
637
+ classNames
638
+ },
639
+ "checkbox"
561
640
  )
562
641
  ] }) });
563
642
  };
@@ -0,0 +1,264 @@
1
+ "use client";
2
+ import {
3
+ mapPropsVariants
4
+ } from "./chunk-E3G5QXSH.mjs";
5
+ import {
6
+ tv
7
+ } from "./chunk-U4DJHAM5.mjs";
8
+
9
+ // src/components/charts/barChart.tsx
10
+ import { forwardRef, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
11
+ import { XAxis, YAxis, ResponsiveContainer, CartesianGrid, BarChart, Bar } from "recharts";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ var BarChartComponent = forwardRef((originalProps, ref) => {
14
+ const [props, variantProps] = mapPropsVariants(originalProps, barChartStyle.variantKeys);
15
+ const {
16
+ data = [],
17
+ label,
18
+ classNames,
19
+ yAxisTicks = [0, 20, 40, 60, 80, 100],
20
+ yAxisTickFormatter = (value) => `${value}`,
21
+ yAxisDomain = [-6, 110],
22
+ barGap = 20,
23
+ tooltipFormatter
24
+ } = { ...props, ...variantProps };
25
+ const slots = useMemo(() => barChartStyle({ ...variantProps }), [variantProps]);
26
+ const chartRef = useRef(null);
27
+ const tooltipRef = useRef(null);
28
+ const [tooltipLeft, setTooltipLeft] = useState(0);
29
+ const [tickPositions, setTickPositions] = useState([]);
30
+ const tickRef = useRef([]);
31
+ const [tooltipState, setTooltipState] = useState(null);
32
+ const handleMouseEnter = (e, dataKey) => {
33
+ if (!tooltipFormatter || !chartRef.current) return;
34
+ const { payload, x, y } = e;
35
+ if (!payload || !payload[dataKey]) return;
36
+ setTooltipState({
37
+ barX: x,
38
+ barY: y - 10,
39
+ value: payload[dataKey],
40
+ dataKey,
41
+ label: payload.title
42
+ });
43
+ };
44
+ const handleMouseLeave = () => {
45
+ setTooltipState(null);
46
+ };
47
+ const CustomBarShape = ({ x, y, width, height, fill }) => {
48
+ const radius = 5;
49
+ const extraHeight = 10;
50
+ const adjustedHeight = height + extraHeight;
51
+ const adjustedY = y;
52
+ const bottomY = adjustedY + adjustedHeight;
53
+ return height ? /* @__PURE__ */ jsx(
54
+ "path",
55
+ {
56
+ d: `M${x},${bottomY} L${x},${adjustedY + radius} Q${x},${adjustedY} ${x + radius},${adjustedY} L${x + width - radius},${adjustedY} Q${x + width},${adjustedY} ${x + width},${adjustedY + radius} L${x + width},${bottomY} Z`,
57
+ fill
58
+ }
59
+ ) : /* @__PURE__ */ jsx("rect", { x, y, width, height: 0, fill });
60
+ };
61
+ const CustomTick = ({ x, y, payload }) => {
62
+ if (x !== void 0) tickRef.current.push(x);
63
+ return /* @__PURE__ */ jsx(
64
+ "text",
65
+ {
66
+ x,
67
+ y: y + 14,
68
+ textAnchor: "middle",
69
+ fontSize: 12,
70
+ fontWeight: 700,
71
+ fill: "currentColor",
72
+ className: "text-body-foreground",
73
+ children: payload.value
74
+ }
75
+ );
76
+ };
77
+ const CustomYAxisTick = ({ x, y, payload }) => /* @__PURE__ */ jsx(
78
+ "text",
79
+ {
80
+ x: x - 10,
81
+ y,
82
+ textAnchor: "middle",
83
+ fontSize: 12,
84
+ fontWeight: 700,
85
+ fill: "currentColor",
86
+ className: "text-body-foreground",
87
+ dy: 4,
88
+ children: yAxisTickFormatter(payload.value)
89
+ }
90
+ );
91
+ useEffect(() => {
92
+ const raf = requestAnimationFrame(() => {
93
+ const unique = [...new Set(tickRef.current)].sort((a, b) => a - b);
94
+ const mids = [];
95
+ for (let i = 0; i < unique.length - 1; i++) {
96
+ mids.push((unique[i] + unique[i + 1]) / 2);
97
+ }
98
+ setTickPositions(mids);
99
+ tickRef.current = [];
100
+ });
101
+ return () => cancelAnimationFrame(raf);
102
+ }, [data]);
103
+ useLayoutEffect(() => {
104
+ if (!tooltipState || !chartRef.current || !tooltipRef.current) return;
105
+ const chartRect = chartRef.current.getBoundingClientRect();
106
+ const tooltipRect = tooltipRef.current.getBoundingClientRect();
107
+ const chartWidth = chartRect.width;
108
+ const tooltipWidth = tooltipRect.width;
109
+ let left = tooltipState.barX - tooltipWidth / 2;
110
+ const padding = 8;
111
+ if (left < padding) {
112
+ left = padding;
113
+ } else if (left + tooltipWidth > chartWidth - padding) {
114
+ left = chartWidth - tooltipWidth - padding;
115
+ }
116
+ setTooltipLeft(left);
117
+ }, [tooltipState]);
118
+ return /* @__PURE__ */ jsxs(
119
+ "div",
120
+ {
121
+ ref: chartRef,
122
+ className: slots.base({ class: classNames == null ? void 0 : classNames.base }),
123
+ onMouseLeave: handleMouseLeave,
124
+ onMouseMove: (e) => {
125
+ const target = e.target;
126
+ if (!target.closest('[data-testid="recharts-bar-rectangle"]') && !target.closest(".recharts-bar-rectangle") && target.tagName !== "path") {
127
+ setTooltipState(null);
128
+ }
129
+ },
130
+ children: [
131
+ label && /* @__PURE__ */ jsx("p", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }),
132
+ /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(
133
+ BarChart,
134
+ {
135
+ data,
136
+ margin: { left: -20 },
137
+ barSize: 20,
138
+ barGap,
139
+ className: "[&_.recharts-surface]:outline-none [&_.recharts-surface]:focus:outline-none",
140
+ children: [
141
+ /* @__PURE__ */ jsxs("defs", { children: [
142
+ /* @__PURE__ */ jsxs("linearGradient", { id: "blueGradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
143
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "#DEC1FA" }),
144
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "#3F9CF2" })
145
+ ] }),
146
+ /* @__PURE__ */ jsxs("linearGradient", { id: "greenGradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
147
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "#C2E59C" }),
148
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "#64B3F4" })
149
+ ] }),
150
+ /* @__PURE__ */ jsxs("linearGradient", { id: "pinkGradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
151
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "#DDD6F3" }),
152
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "#FAACA8" })
153
+ ] })
154
+ ] }),
155
+ /* @__PURE__ */ jsx(
156
+ CartesianGrid,
157
+ {
158
+ vertical: true,
159
+ horizontal: false,
160
+ strokeDasharray: "4 4",
161
+ className: "stroke-neutral-light",
162
+ verticalPoints: tickPositions
163
+ }
164
+ ),
165
+ /* @__PURE__ */ jsx(
166
+ XAxis,
167
+ {
168
+ dataKey: "title",
169
+ axisLine: { stroke: "#DFE2E7", strokeWidth: 1 },
170
+ tickLine: false,
171
+ tick: CustomTick,
172
+ padding: { left: 0, right: 0 }
173
+ }
174
+ ),
175
+ /* @__PURE__ */ jsx(
176
+ YAxis,
177
+ {
178
+ axisLine: { stroke: "#DFE2E7", strokeWidth: 1 },
179
+ tickLine: false,
180
+ tick: CustomYAxisTick,
181
+ ticks: yAxisTicks,
182
+ domain: yAxisDomain
183
+ }
184
+ ),
185
+ /* @__PURE__ */ jsx(
186
+ Bar,
187
+ {
188
+ dataKey: "blue",
189
+ fill: "url(#blueGradient)",
190
+ shape: CustomBarShape,
191
+ onMouseEnter: (e) => handleMouseEnter(e, "blue"),
192
+ onMouseLeave: handleMouseLeave
193
+ }
194
+ ),
195
+ /* @__PURE__ */ jsx(
196
+ Bar,
197
+ {
198
+ dataKey: "green",
199
+ fill: "url(#greenGradient)",
200
+ shape: CustomBarShape,
201
+ onMouseEnter: (e) => handleMouseEnter(e, "green"),
202
+ onMouseLeave: handleMouseLeave
203
+ }
204
+ ),
205
+ /* @__PURE__ */ jsx(
206
+ Bar,
207
+ {
208
+ dataKey: "pink",
209
+ fill: "url(#pinkGradient)",
210
+ shape: CustomBarShape,
211
+ onMouseEnter: (e) => handleMouseEnter(e, "pink"),
212
+ onMouseLeave: handleMouseLeave
213
+ }
214
+ )
215
+ ]
216
+ }
217
+ ) }),
218
+ tooltipFormatter && /* @__PURE__ */ jsx(
219
+ "div",
220
+ {
221
+ ref: tooltipRef,
222
+ style: {
223
+ position: "absolute",
224
+ left: tooltipLeft + 10,
225
+ top: (tooltipState == null ? void 0 : tooltipState.barY) || 0,
226
+ pointerEvents: "none",
227
+ zIndex: 10,
228
+ opacity: tooltipState ? 1 : 0,
229
+ transition: "opacity 0.1s ease-out",
230
+ visibility: tooltipState ? "visible" : "hidden",
231
+ width: "fit-content",
232
+ whiteSpace: "nowrap"
233
+ },
234
+ children: tooltipState && tooltipFormatter(tooltipState)
235
+ }
236
+ )
237
+ ]
238
+ }
239
+ );
240
+ });
241
+ BarChartComponent.displayName = "barChart";
242
+ var barChart_default = BarChartComponent;
243
+ var barChartStyle = tv({
244
+ slots: {
245
+ base: ["flex", "flex-col", "gap-[10px]", "select-none", "relative"],
246
+ label: ["text-md", "font-bold", "text-body-foreground"]
247
+ },
248
+ variants: {},
249
+ defaultVariants: {}
250
+ });
251
+ function BarChartTooltip({ className = "", children }) {
252
+ return /* @__PURE__ */ jsx(
253
+ "div",
254
+ {
255
+ className: `text-md text-common-white bg-common-black flex max-w-[160px] whitespace-nowrap rounded-[5px] px-[10px] py-[6px] text-center font-bold ${className}`,
256
+ children
257
+ }
258
+ );
259
+ }
260
+
261
+ export {
262
+ barChart_default,
263
+ BarChartTooltip
264
+ };