@expcat/tigercat-react 0.1.8 → 0.2.0

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.
Files changed (169) hide show
  1. package/dist/{chunk-TBIEWDY5.js → chunk-36RRHNZD.js} +13 -2
  2. package/dist/chunk-3CDAG4HD.mjs +151 -0
  3. package/dist/chunk-3QFHVAZT.js +68 -0
  4. package/dist/{chunk-ALP3KYYY.mjs → chunk-3XKBDV2Q.mjs} +5 -5
  5. package/dist/chunk-42UKIFFQ.js +278 -0
  6. package/dist/{chunk-K7ZMB2TH.mjs → chunk-5XKYWZZZ.mjs} +16 -22
  7. package/dist/chunk-677VSTPW.mjs +65 -0
  8. package/dist/chunk-6DYS4PJT.mjs +99 -0
  9. package/dist/chunk-6PBNFLM7.js +95 -0
  10. package/dist/{chunk-DCRVIDMY.mjs → chunk-6ZC7H22S.mjs} +1 -1
  11. package/dist/{chunk-WSCSDSV7.mjs → chunk-7IKJBQQV.mjs} +27 -5
  12. package/dist/{chunk-OTRGVENC.js → chunk-7SLNHUGJ.js} +1 -1
  13. package/dist/chunk-A2UW5OKX.mjs +415 -0
  14. package/dist/{chunk-NOOPXNR4.mjs → chunk-AGUPZEUL.mjs} +2 -3
  15. package/dist/chunk-AX5XRD2Q.js +35 -0
  16. package/dist/{chunk-BJU5N7WU.mjs → chunk-BAPR7UUR.mjs} +7 -7
  17. package/dist/chunk-CBALIFPW.mjs +275 -0
  18. package/dist/{chunk-BIWO5KB4.mjs → chunk-CJJ56NVL.mjs} +2 -2
  19. package/dist/{chunk-ENR3RIMM.js → chunk-DGBYGBLR.js} +72 -59
  20. package/dist/chunk-DUWAV47E.js +42 -0
  21. package/dist/chunk-E5GD3H7L.js +94 -0
  22. package/dist/chunk-EJLJYOO7.js +367 -0
  23. package/dist/{chunk-FQ6UHRAO.js → chunk-GQMYCYZ4.js} +6 -27
  24. package/dist/{chunk-G6FSHN2I.mjs → chunk-GW4EWT2K.mjs} +45 -31
  25. package/dist/{chunk-AQQRWISY.js → chunk-GXTBCX3M.js} +1 -1
  26. package/dist/{chunk-HQXZVTP4.mjs → chunk-HGF2EL25.mjs} +74 -61
  27. package/dist/{chunk-R5BQHZWB.js → chunk-HRYBEBZC.js} +15 -21
  28. package/dist/{chunk-PAD2DX5M.mjs → chunk-IIVRVCCP.mjs} +6 -24
  29. package/dist/chunk-IS467WAO.mjs +39 -0
  30. package/dist/{chunk-CTAMMQBC.mjs → chunk-IS7YOBR7.mjs} +16 -13
  31. package/dist/{chunk-ADOPAXPG.mjs → chunk-JI7SFMUT.mjs} +2 -2
  32. package/dist/chunk-KBGURVTD.mjs +282 -0
  33. package/dist/{chunk-O3EUFIOS.mjs → chunk-KELLYJZY.mjs} +36 -30
  34. package/dist/{chunk-XZDJ5FRB.js → chunk-KPZTGRNA.js} +5 -23
  35. package/dist/chunk-KQZ4F7FZ.js +153 -0
  36. package/dist/{chunk-XDKXL2BP.mjs → chunk-KV4LLPAY.mjs} +14 -3
  37. package/dist/{chunk-LNKI6HQ3.js → chunk-LIJLFLYE.js} +27 -5
  38. package/dist/chunk-LVC43YX2.mjs +72 -0
  39. package/dist/chunk-LZNG2HGC.mjs +227 -0
  40. package/dist/chunk-M375I56K.js +75 -0
  41. package/dist/{chunk-7OLWGHUR.mjs → chunk-MF3H7WWW.mjs} +13 -2
  42. package/dist/chunk-N32MAX4A.js +230 -0
  43. package/dist/{chunk-YYKJ63LD.mjs → chunk-NMDNLB3C.mjs} +7 -28
  44. package/dist/{chunk-77D7VQMG.js → chunk-OD2NNQD2.js} +2 -2
  45. package/dist/chunk-OONM7FO7.js +418 -0
  46. package/dist/{chunk-Q5Q7FG4U.js → chunk-OZLGNWET.js} +7 -7
  47. package/dist/{chunk-LAZGEMA2.mjs → chunk-P4EFJIXU.mjs} +1 -1
  48. package/dist/chunk-QI6WAP6Y.js +285 -0
  49. package/dist/{chunk-WK5HN4OH.js → chunk-QY6I7LU5.js} +43 -29
  50. package/dist/{chunk-KSW5JDIV.js → chunk-R7TOQU3U.js} +1 -1
  51. package/dist/chunk-RQSQXQN6.mjs +91 -0
  52. package/dist/chunk-SDLMB34Y.mjs +32 -0
  53. package/dist/chunk-UG3I4PCY.js +102 -0
  54. package/dist/chunk-VBSK4TGO.mjs +364 -0
  55. package/dist/{chunk-DZJUFU55.js → chunk-VXHBQTZS.js} +14 -11
  56. package/dist/chunk-WLIFEALE.mjs +111 -0
  57. package/dist/{chunk-AQ6DHCP6.js → chunk-XRFK2IXM.js} +4 -4
  58. package/dist/{chunk-5FRENLDC.js → chunk-Y2JOJ4D6.js} +14 -3
  59. package/dist/chunk-YER7IQF4.mjs +429 -0
  60. package/dist/{chunk-NI2WNZRT.js → chunk-YESS6YKC.js} +1 -2
  61. package/dist/chunk-Z6F67MJE.mjs +92 -0
  62. package/dist/{chunk-QORSSZX4.js → chunk-ZPFZMXA6.js} +34 -28
  63. package/dist/chunk-ZUUG3WOL.js +432 -0
  64. package/dist/chunk-ZYPEO2KY.js +115 -0
  65. package/dist/components/AreaChart.d.mts +19 -0
  66. package/dist/components/AreaChart.d.ts +19 -0
  67. package/dist/components/AreaChart.js +23 -0
  68. package/dist/components/AreaChart.mjs +8 -0
  69. package/dist/components/BarChart.d.mts +16 -0
  70. package/dist/components/BarChart.d.ts +16 -0
  71. package/dist/components/BarChart.js +23 -0
  72. package/dist/components/BarChart.mjs +8 -0
  73. package/dist/components/ChartAxis.d.mts +10 -0
  74. package/dist/components/ChartAxis.d.ts +10 -0
  75. package/dist/components/ChartAxis.js +16 -0
  76. package/dist/components/ChartAxis.mjs +1 -0
  77. package/dist/components/ChartCanvas.d.mts +9 -0
  78. package/dist/components/ChartCanvas.d.ts +9 -0
  79. package/dist/components/ChartCanvas.js +16 -0
  80. package/dist/components/ChartCanvas.mjs +1 -0
  81. package/dist/components/ChartGrid.d.mts +11 -0
  82. package/dist/components/ChartGrid.d.ts +11 -0
  83. package/dist/components/ChartGrid.js +16 -0
  84. package/dist/components/ChartGrid.mjs +1 -0
  85. package/dist/components/ChartLegend.d.mts +17 -0
  86. package/dist/components/ChartLegend.d.ts +17 -0
  87. package/dist/components/ChartLegend.js +16 -0
  88. package/dist/components/ChartLegend.mjs +1 -0
  89. package/dist/components/ChartSeries.d.mts +18 -0
  90. package/dist/components/ChartSeries.d.ts +18 -0
  91. package/dist/components/ChartSeries.js +16 -0
  92. package/dist/components/ChartSeries.mjs +1 -0
  93. package/dist/components/ChartTooltip.d.mts +12 -0
  94. package/dist/components/ChartTooltip.d.ts +12 -0
  95. package/dist/components/ChartTooltip.js +16 -0
  96. package/dist/components/ChartTooltip.mjs +1 -0
  97. package/dist/components/DonutChart.d.mts +14 -0
  98. package/dist/components/DonutChart.d.ts +14 -0
  99. package/dist/components/DonutChart.js +21 -0
  100. package/dist/components/DonutChart.mjs +6 -0
  101. package/dist/components/Drawer.js +3 -3
  102. package/dist/components/Drawer.mjs +2 -2
  103. package/dist/components/Dropdown.d.mts +12 -2
  104. package/dist/components/Dropdown.d.ts +12 -2
  105. package/dist/components/Dropdown.js +4 -4
  106. package/dist/components/Dropdown.mjs +2 -2
  107. package/dist/components/DropdownItem.js +4 -4
  108. package/dist/components/DropdownItem.mjs +3 -3
  109. package/dist/components/Icon.js +2 -2
  110. package/dist/components/Icon.mjs +1 -1
  111. package/dist/components/LineChart.d.mts +19 -0
  112. package/dist/components/LineChart.d.ts +19 -0
  113. package/dist/components/LineChart.js +23 -0
  114. package/dist/components/LineChart.mjs +8 -0
  115. package/dist/components/List.js +3 -3
  116. package/dist/components/List.mjs +2 -2
  117. package/dist/components/Message.js +4 -4
  118. package/dist/components/Message.mjs +1 -1
  119. package/dist/components/Modal.js +3 -3
  120. package/dist/components/Modal.mjs +2 -2
  121. package/dist/components/Notification.js +4 -4
  122. package/dist/components/Notification.mjs +1 -1
  123. package/dist/components/Pagination.d.mts +5 -1
  124. package/dist/components/Pagination.d.ts +5 -1
  125. package/dist/components/Pagination.js +3 -3
  126. package/dist/components/Pagination.mjs +1 -1
  127. package/dist/components/PieChart.d.mts +14 -0
  128. package/dist/components/PieChart.d.ts +14 -0
  129. package/dist/components/PieChart.js +20 -0
  130. package/dist/components/PieChart.mjs +5 -0
  131. package/dist/components/Popconfirm.d.mts +12 -2
  132. package/dist/components/Popconfirm.d.ts +12 -2
  133. package/dist/components/Popconfirm.js +3 -2
  134. package/dist/components/Popconfirm.mjs +2 -1
  135. package/dist/components/Popover.d.mts +12 -2
  136. package/dist/components/Popover.d.ts +12 -2
  137. package/dist/components/Popover.js +3 -2
  138. package/dist/components/Popover.mjs +2 -1
  139. package/dist/components/RadarChart.d.mts +20 -0
  140. package/dist/components/RadarChart.d.ts +20 -0
  141. package/dist/components/RadarChart.js +20 -0
  142. package/dist/components/RadarChart.mjs +5 -0
  143. package/dist/components/ScatterChart.d.mts +32 -0
  144. package/dist/components/ScatterChart.d.ts +32 -0
  145. package/dist/components/ScatterChart.js +23 -0
  146. package/dist/components/ScatterChart.mjs +8 -0
  147. package/dist/components/Select.js +2 -2
  148. package/dist/components/Select.mjs +1 -1
  149. package/dist/components/Slider.js +2 -2
  150. package/dist/components/Slider.mjs +1 -1
  151. package/dist/components/Space.js +2 -2
  152. package/dist/components/Space.mjs +1 -1
  153. package/dist/components/Steps.js +3 -3
  154. package/dist/components/Steps.mjs +1 -1
  155. package/dist/components/StepsItem.js +2 -2
  156. package/dist/components/StepsItem.mjs +1 -1
  157. package/dist/components/Table.js +2 -2
  158. package/dist/components/Table.mjs +1 -1
  159. package/dist/components/Tooltip.d.mts +12 -2
  160. package/dist/components/Tooltip.d.ts +12 -2
  161. package/dist/components/Tooltip.js +3 -2
  162. package/dist/components/Tooltip.mjs +2 -1
  163. package/dist/index.d.mts +97 -1
  164. package/dist/index.d.ts +97 -1
  165. package/dist/index.js +178 -108
  166. package/dist/index.mjs +41 -27
  167. package/package.json +2 -2
  168. package/dist/chunk-NEULKOYJ.js +0 -48
  169. package/dist/chunk-ZO4XVOHU.mjs +0 -45
@@ -0,0 +1,432 @@
1
+ 'use strict';
2
+
3
+ var chunkKQZ4F7FZ_js = require('./chunk-KQZ4F7FZ.js');
4
+ var chunkDUWAV47E_js = require('./chunk-DUWAV47E.js');
5
+ var chunkAX5XRD2Q_js = require('./chunk-AX5XRD2Q.js');
6
+ var chunkM375I56K_js = require('./chunk-M375I56K.js');
7
+ var react = require('react');
8
+ var tigercatCore = require('@expcat/tigercat-core');
9
+ var jsxRuntime = require('react/jsx-runtime');
10
+
11
+ var RadarChart = ({
12
+ width = 320,
13
+ height = 200,
14
+ padding = 24,
15
+ data,
16
+ series,
17
+ maxValue,
18
+ startAngle = -Math.PI / 2,
19
+ levels = 5,
20
+ showLevelLabels = false,
21
+ showGrid = true,
22
+ showAxis = true,
23
+ showLabels = true,
24
+ labelOffset = 12,
25
+ labelFormatter,
26
+ levelLabelFormatter,
27
+ levelLabelOffset = 8,
28
+ colors,
29
+ gridLineStyle = "solid",
30
+ gridStrokeWidth = 1,
31
+ hoverable = false,
32
+ hoveredIndex: hoveredIndexProp,
33
+ activeOpacity = 1,
34
+ inactiveOpacity = 0.25,
35
+ showTooltip = true,
36
+ tooltipFormatter,
37
+ selectable = false,
38
+ selectedIndex: selectedIndexProp,
39
+ onHoveredIndexChange,
40
+ onSelectedIndexChange,
41
+ onSeriesClick,
42
+ onSeriesHover,
43
+ showLegend = false,
44
+ legendPosition = "bottom",
45
+ legendFormatter,
46
+ legendMarkerSize = 10,
47
+ legendGap = 8,
48
+ strokeColor = tigercatCore.DEFAULT_CHART_COLORS[0],
49
+ strokeWidth = 2,
50
+ fillColor = tigercatCore.DEFAULT_CHART_COLORS[0],
51
+ fillOpacity = 0.2,
52
+ showPoints = true,
53
+ pointSize = 3,
54
+ pointColor,
55
+ title,
56
+ desc,
57
+ className
58
+ }) => {
59
+ const resolvedSeries = react.useMemo(() => {
60
+ if (series && series.length > 0) return series;
61
+ return [{ data: data ?? [] }];
62
+ }, [series, data]);
63
+ const {
64
+ resolvedHoveredIndex: _resolvedHoveredIndex,
65
+ resolvedSelectedIndex: _resolvedSelectedIndex,
66
+ activeIndex: resolvedActiveIndex,
67
+ tooltipPosition,
68
+ handleMouseEnter: handleHoverEnter,
69
+ handleMouseMove,
70
+ handleMouseLeave: handleHoverLeave,
71
+ handleClick: handleSelectIndex
72
+ } = chunkKQZ4F7FZ_js.useChartInteraction({
73
+ hoverable,
74
+ hoveredIndexProp,
75
+ selectable,
76
+ selectedIndexProp,
77
+ activeOpacity,
78
+ inactiveOpacity,
79
+ legendPosition,
80
+ getData: (index) => resolvedSeries[index],
81
+ onHoveredIndexChange: (index) => {
82
+ onHoveredIndexChange?.(index);
83
+ onSeriesHover?.(index, index !== null ? resolvedSeries[index] : null);
84
+ },
85
+ onSelectedIndexChange: (index) => {
86
+ onSelectedIndexChange?.(index);
87
+ if (index !== null) {
88
+ onSeriesClick?.(index, resolvedSeries[index]);
89
+ }
90
+ }
91
+ });
92
+ const [hoveredPoint, setHoveredPoint] = react.useState(null);
93
+ const handlePointEnter = react.useCallback(
94
+ (seriesIndex, pointIndex, event) => {
95
+ if (!hoverable) return;
96
+ setHoveredPoint({ seriesIndex, pointIndex });
97
+ handleHoverEnter(seriesIndex, event);
98
+ },
99
+ [hoverable, handleHoverEnter]
100
+ );
101
+ const handlePointMove = react.useCallback(
102
+ (event) => {
103
+ handleMouseMove(event);
104
+ },
105
+ [handleMouseMove]
106
+ );
107
+ const handlePointLeave = react.useCallback(() => {
108
+ setHoveredPoint(null);
109
+ handleHoverLeave();
110
+ }, [handleHoverLeave]);
111
+ const innerRect = react.useMemo(
112
+ () => tigercatCore.getChartInnerRect(width, height, padding),
113
+ [width, height, padding]
114
+ );
115
+ const radius = react.useMemo(
116
+ () => Math.max(0, Math.min(innerRect.width, innerRect.height) / 2),
117
+ [innerRect.width, innerRect.height]
118
+ );
119
+ const cx = innerRect.width / 2;
120
+ const cy = innerRect.height / 2;
121
+ const axisData = react.useMemo(() => {
122
+ if (series && series.length > 0) return series[0]?.data ?? [];
123
+ return data ?? [];
124
+ }, [series, data]);
125
+ const resolvedMaxValue = react.useMemo(() => {
126
+ if (typeof maxValue === "number") return Math.max(0, maxValue);
127
+ const values = resolvedSeries.flatMap((item) => item.data.map((datum) => datum.value));
128
+ const computedMax = values.length > 0 ? Math.max(...values) : 0;
129
+ return computedMax > 0 ? computedMax : 1;
130
+ }, [resolvedSeries, maxValue]);
131
+ const angles = react.useMemo(
132
+ () => tigercatCore.getRadarAngles(axisData.length, startAngle),
133
+ [axisData.length, startAngle]
134
+ );
135
+ const seriesPoints = react.useMemo(
136
+ () => resolvedSeries.map((item) => ({
137
+ series: item,
138
+ points: tigercatCore.getRadarPoints(item.data, {
139
+ cx,
140
+ cy,
141
+ radius,
142
+ startAngle,
143
+ maxValue: resolvedMaxValue
144
+ })
145
+ })),
146
+ [resolvedSeries, cx, cy, radius, startAngle, resolvedMaxValue]
147
+ );
148
+ const gridPaths = react.useMemo(() => {
149
+ if (!showGrid || angles.length === 0) return [];
150
+ const resolvedLevels = Math.max(1, Math.floor(levels));
151
+ return Array.from({ length: resolvedLevels }, (_, index) => {
152
+ const levelRadius = radius * ((index + 1) / resolvedLevels);
153
+ const ringPoints = angles.map((angle) => tigercatCore.polarToCartesian(cx, cy, levelRadius, angle));
154
+ return tigercatCore.createPolygonPath(ringPoints);
155
+ });
156
+ }, [showGrid, levels, angles, radius, cx, cy]);
157
+ const axisLines = react.useMemo(() => {
158
+ if (!showAxis || angles.length === 0) return [];
159
+ return angles.map((angle) => {
160
+ const end = tigercatCore.polarToCartesian(cx, cy, radius, angle);
161
+ return {
162
+ x1: cx,
163
+ y1: cy,
164
+ x2: end.x,
165
+ y2: end.y
166
+ };
167
+ });
168
+ }, [showAxis, angles, cx, cy, radius]);
169
+ const labels = react.useMemo(() => {
170
+ if (!showLabels || angles.length === 0) return [];
171
+ const formatLabel = labelFormatter ?? ((datum) => datum.label ?? `${datum.value}`);
172
+ return axisData.map((datum, index) => {
173
+ const angle = angles[index];
174
+ const position = tigercatCore.polarToCartesian(cx, cy, radius + labelOffset, angle);
175
+ return {
176
+ x: position.x,
177
+ y: position.y,
178
+ text: formatLabel(datum, index)
179
+ };
180
+ });
181
+ }, [showLabels, axisData, angles, cx, cy, radius, labelOffset, labelFormatter]);
182
+ const levelLabels = react.useMemo(() => {
183
+ if (!showLevelLabels || !showGrid || angles.length === 0) return [];
184
+ const resolvedLevels = Math.max(1, Math.floor(levels));
185
+ const formatLevel = levelLabelFormatter ?? ((value) => `${value}`);
186
+ return Array.from({ length: resolvedLevels }, (_, index) => {
187
+ const ratio = (index + 1) / resolvedLevels;
188
+ const value = resolvedMaxValue * ratio;
189
+ const position = tigercatCore.polarToCartesian(cx, cy, radius * ratio + levelLabelOffset, startAngle);
190
+ return {
191
+ x: position.x,
192
+ y: position.y,
193
+ text: formatLevel(value, index)
194
+ };
195
+ });
196
+ }, [
197
+ showLevelLabels,
198
+ showGrid,
199
+ angles.length,
200
+ levels,
201
+ resolvedMaxValue,
202
+ cx,
203
+ cy,
204
+ radius,
205
+ levelLabelOffset,
206
+ startAngle,
207
+ levelLabelFormatter
208
+ ]);
209
+ const dasharray = tigercatCore.getChartGridLineDasharray(gridLineStyle);
210
+ const palette = react.useMemo(
211
+ () => colors && colors.length > 0 ? colors : [...tigercatCore.DEFAULT_CHART_COLORS],
212
+ [colors]
213
+ );
214
+ const formatTooltip = react.useMemo(
215
+ () => tooltipFormatter ?? ((datum, seriesIndex, index, series2) => {
216
+ const label = datum.label ?? `#${index + 1}`;
217
+ const value = datum.value;
218
+ const name = series2?.name ?? `Series ${seriesIndex + 1}`;
219
+ return `${name} \xB7 ${label}: ${value}`;
220
+ }),
221
+ [tooltipFormatter]
222
+ );
223
+ const tooltipContent = react.useMemo(() => {
224
+ if (!hoveredPoint) return "";
225
+ const { seriesIndex, pointIndex } = hoveredPoint;
226
+ const series2 = resolvedSeries[seriesIndex];
227
+ if (!series2) return "";
228
+ const datum = series2.data[pointIndex];
229
+ if (!datum) return "";
230
+ return formatTooltip(datum, seriesIndex, pointIndex, series2);
231
+ }, [hoveredPoint, resolvedSeries, formatTooltip]);
232
+ const resolvedLegendItems = react.useMemo(
233
+ () => resolvedSeries.map((item, index) => {
234
+ const color = item.color ?? palette[index % palette.length];
235
+ const label = legendFormatter ? legendFormatter(item, index) : item.name ?? `Series ${index + 1}`;
236
+ return {
237
+ index,
238
+ label,
239
+ color
240
+ };
241
+ }),
242
+ [resolvedSeries, palette, legendFormatter]
243
+ );
244
+ const legendContainerClasses = tigercatCore.classNames(
245
+ "flex flex-wrap",
246
+ legendPosition === "right" ? "flex-col gap-2" : "flex-row gap-3"
247
+ );
248
+ const wrapperClasses = tigercatCore.classNames(
249
+ "inline-flex",
250
+ legendPosition === "right" ? "flex-row items-start gap-4" : "flex-col gap-2"
251
+ );
252
+ const chart = /* @__PURE__ */ jsxRuntime.jsxs(
253
+ chunkDUWAV47E_js.ChartCanvas,
254
+ {
255
+ width,
256
+ height,
257
+ padding,
258
+ title,
259
+ desc,
260
+ className: tigercatCore.classNames(className),
261
+ children: [
262
+ gridPaths.map((path, index) => /* @__PURE__ */ jsxRuntime.jsx(
263
+ "path",
264
+ {
265
+ d: path,
266
+ className: tigercatCore.chartGridLineClasses,
267
+ fill: "none",
268
+ strokeWidth: gridStrokeWidth,
269
+ strokeDasharray: dasharray
270
+ },
271
+ `grid-${index}`
272
+ )),
273
+ axisLines.map((line, index) => /* @__PURE__ */ jsxRuntime.jsx(
274
+ "line",
275
+ {
276
+ x1: line.x1,
277
+ y1: line.y1,
278
+ x2: line.x2,
279
+ y2: line.y2,
280
+ className: tigercatCore.chartGridLineClasses,
281
+ strokeWidth: gridStrokeWidth,
282
+ strokeDasharray: dasharray
283
+ },
284
+ `axis-${index}`
285
+ )),
286
+ seriesPoints.map((item, seriesIndex) => {
287
+ const seriesColor = item.series.color ?? palette[seriesIndex % palette.length];
288
+ const resolvedStrokeColor = item.series.strokeColor ?? seriesColor ?? strokeColor;
289
+ const resolvedFillColor = item.series.fillColor ?? seriesColor ?? fillColor;
290
+ const resolvedFillOpacity = item.series.fillOpacity ?? fillOpacity;
291
+ const resolvedStrokeWidth = item.series.strokeWidth ?? strokeWidth;
292
+ const resolvedShowPoints = item.series.showPoints ?? showPoints;
293
+ const resolvedPointSize = item.series.pointSize ?? pointSize;
294
+ const resolvedPointColor = item.series.pointColor ?? seriesColor ?? pointColor;
295
+ const areaPath = tigercatCore.createPolygonPath(item.points.map((point) => ({ x: point.x, y: point.y })));
296
+ const resolvedOpacity = resolvedActiveIndex === null ? void 0 : seriesIndex === resolvedActiveIndex ? activeOpacity : inactiveOpacity;
297
+ return /* @__PURE__ */ jsxRuntime.jsxs(
298
+ chunkAX5XRD2Q_js.ChartSeries,
299
+ {
300
+ data: item.series.data,
301
+ name: item.series.name,
302
+ type: "radar",
303
+ className: item.series.className,
304
+ opacity: resolvedOpacity,
305
+ style: hoverable || selectable ? { cursor: "pointer" } : void 0,
306
+ onMouseEnter: hoverable ? (e) => handleHoverEnter(seriesIndex, e) : void 0,
307
+ onMouseLeave: hoverable ? handleHoverLeave : void 0,
308
+ onClick: selectable ? () => handleSelectIndex(seriesIndex) : void 0,
309
+ tabIndex: selectable ? 0 : void 0,
310
+ onKeyDown: (event) => {
311
+ if (!selectable) return;
312
+ if (event.key !== "Enter" && event.key !== " ") return;
313
+ event.preventDefault();
314
+ handleSelectIndex(seriesIndex);
315
+ },
316
+ children: [
317
+ areaPath ? /* @__PURE__ */ jsxRuntime.jsx(
318
+ "path",
319
+ {
320
+ d: areaPath,
321
+ fill: resolvedFillColor,
322
+ fillOpacity: resolvedFillOpacity,
323
+ stroke: resolvedStrokeColor,
324
+ strokeWidth: resolvedStrokeWidth,
325
+ "data-radar-area": "true",
326
+ "data-series-index": seriesIndex
327
+ }
328
+ ) : null,
329
+ resolvedShowPoints ? item.points.map((point) => {
330
+ return /* @__PURE__ */ jsxRuntime.jsx(
331
+ "circle",
332
+ {
333
+ cx: point.x,
334
+ cy: point.y,
335
+ r: point.data.size ?? resolvedPointSize,
336
+ fill: point.data.color ?? resolvedPointColor ?? resolvedStrokeColor,
337
+ className: showTooltip && hoverable ? "cursor-pointer" : void 0,
338
+ "data-radar-point": "true",
339
+ "data-series-index": seriesIndex,
340
+ "data-point-index": point.index,
341
+ onMouseEnter: showTooltip && hoverable ? (e) => handlePointEnter(seriesIndex, point.index, e) : void 0,
342
+ onMouseMove: showTooltip && hoverable ? handlePointMove : void 0,
343
+ onMouseLeave: showTooltip && hoverable ? handlePointLeave : void 0
344
+ },
345
+ `point-${seriesIndex}-${point.index}`
346
+ );
347
+ }) : null
348
+ ]
349
+ },
350
+ `series-${seriesIndex}`
351
+ );
352
+ }),
353
+ labels.map((label, index) => /* @__PURE__ */ jsxRuntime.jsx(
354
+ "text",
355
+ {
356
+ x: label.x,
357
+ y: label.y,
358
+ className: tigercatCore.chartAxisTickTextClasses,
359
+ textAnchor: "middle",
360
+ dominantBaseline: "middle",
361
+ children: label.text
362
+ },
363
+ `label-${index}`
364
+ )),
365
+ levelLabels.map((label, index) => /* @__PURE__ */ jsxRuntime.jsx(
366
+ "text",
367
+ {
368
+ x: label.x,
369
+ y: label.y,
370
+ className: tigercatCore.chartAxisTickTextClasses,
371
+ textAnchor: "middle",
372
+ dominantBaseline: "middle",
373
+ "data-radar-level-label": "true",
374
+ children: label.text
375
+ },
376
+ `level-${index}`
377
+ ))
378
+ ]
379
+ }
380
+ );
381
+ const tooltip = showTooltip && hoverable ? /* @__PURE__ */ jsxRuntime.jsx(
382
+ chunkM375I56K_js.ChartTooltip,
383
+ {
384
+ content: tooltipContent,
385
+ visible: hoveredPoint !== null && tooltipContent !== "",
386
+ x: tooltipPosition.x,
387
+ y: tooltipPosition.y
388
+ }
389
+ ) : null;
390
+ if (!showLegend) {
391
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-block relative", children: [
392
+ chart,
393
+ tooltip
394
+ ] });
395
+ }
396
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: wrapperClasses, children: [
397
+ chart,
398
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: legendContainerClasses, children: resolvedLegendItems.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
399
+ "button",
400
+ {
401
+ type: "button",
402
+ className: tigercatCore.classNames(
403
+ "flex items-center gap-2 text-sm text-gray-600",
404
+ selectable ? "cursor-pointer" : "cursor-default"
405
+ ),
406
+ onClick: selectable ? () => handleSelectIndex(item.index) : void 0,
407
+ onMouseEnter: hoverable ? (e) => handleHoverEnter(item.index, e) : void 0,
408
+ onMouseLeave: hoverable ? handlePointLeave : void 0,
409
+ children: [
410
+ /* @__PURE__ */ jsxRuntime.jsx(
411
+ "span",
412
+ {
413
+ className: "inline-block rounded-full",
414
+ style: {
415
+ width: `${legendMarkerSize}px`,
416
+ height: `${legendMarkerSize}px`,
417
+ backgroundColor: item.color
418
+ }
419
+ }
420
+ ),
421
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { marginRight: `${legendGap}px` }, children: item.label })
422
+ ]
423
+ },
424
+ `legend-${item.index}`
425
+ )) }),
426
+ tooltip
427
+ ] });
428
+ };
429
+ var RadarChart_default = RadarChart;
430
+
431
+ exports.RadarChart = RadarChart;
432
+ exports.RadarChart_default = RadarChart_default;
@@ -0,0 +1,115 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+ var tigercatCore = require('@expcat/tigercat-core');
5
+
6
+ // src/utils/overlay.ts
7
+ function useClickOutside({
8
+ enabled,
9
+ refs,
10
+ onOutsideClick,
11
+ defer = false
12
+ }) {
13
+ react.useEffect(() => {
14
+ if (!enabled) return;
15
+ const handler = (event) => {
16
+ const elements = refs.map((ref) => ref?.current);
17
+ if (tigercatCore.isEventOutside(event, elements)) {
18
+ onOutsideClick();
19
+ }
20
+ };
21
+ const attach = () => document.addEventListener("click", handler);
22
+ const detach = () => document.removeEventListener("click", handler);
23
+ if (!defer) {
24
+ attach();
25
+ return () => detach();
26
+ }
27
+ const timer = window.setTimeout(() => attach(), 0);
28
+ return () => {
29
+ window.clearTimeout(timer);
30
+ detach();
31
+ };
32
+ }, [enabled, refs, onOutsideClick, defer]);
33
+ }
34
+ function useEscapeKey({ enabled, onEscape }) {
35
+ react.useEffect(() => {
36
+ if (!enabled) return;
37
+ const handler = (event) => {
38
+ if (event.defaultPrevented) return;
39
+ if (!tigercatCore.isEscapeKey(event)) return;
40
+ onEscape();
41
+ };
42
+ document.addEventListener("keydown", handler);
43
+ return () => document.removeEventListener("keydown", handler);
44
+ }, [enabled, onEscape]);
45
+ }
46
+ function useFloating(options) {
47
+ const {
48
+ referenceRef,
49
+ floatingRef,
50
+ enabled,
51
+ placement: initialPlacement = "bottom",
52
+ offset: offsetDistance = 8,
53
+ arrowRef,
54
+ onPlacementChange
55
+ } = options;
56
+ const [x, setX] = react.useState(0);
57
+ const [y, setY] = react.useState(0);
58
+ const [placement, setPlacement] = react.useState(initialPlacement);
59
+ const [arrowX, setArrowX] = react.useState(void 0);
60
+ const [arrowY, setArrowY] = react.useState(void 0);
61
+ const onPlacementChangeRef = react.useRef(onPlacementChange);
62
+ onPlacementChangeRef.current = onPlacementChange;
63
+ const update = react.useCallback(async () => {
64
+ const reference = referenceRef.current;
65
+ const floating = floatingRef.current;
66
+ if (!reference || !floating) return;
67
+ const floatingOptions = {
68
+ placement: initialPlacement,
69
+ offset: offsetDistance,
70
+ flip: true,
71
+ shift: true,
72
+ arrowElement: arrowRef?.current
73
+ };
74
+ const result = await tigercatCore.computeFloatingPosition(
75
+ reference,
76
+ floating,
77
+ floatingOptions
78
+ );
79
+ setX(result.x);
80
+ setY(result.y);
81
+ setPlacement((prev) => {
82
+ if (prev !== result.placement) {
83
+ onPlacementChangeRef.current?.(result.placement);
84
+ return result.placement;
85
+ }
86
+ return prev;
87
+ });
88
+ if (result.arrow) {
89
+ setArrowX(result.arrow.x);
90
+ setArrowY(result.arrow.y);
91
+ }
92
+ }, [referenceRef, floatingRef, initialPlacement, offsetDistance, arrowRef]);
93
+ react.useEffect(() => {
94
+ const reference = referenceRef.current;
95
+ const floating = floatingRef.current;
96
+ if (!enabled || !reference || !floating) return;
97
+ update();
98
+ const cleanup = tigercatCore.autoUpdateFloating(reference, floating, update);
99
+ return () => {
100
+ cleanup();
101
+ };
102
+ }, [enabled, referenceRef, floatingRef, update]);
103
+ return {
104
+ x,
105
+ y,
106
+ placement,
107
+ arrowX,
108
+ arrowY,
109
+ update
110
+ };
111
+ }
112
+
113
+ exports.useClickOutside = useClickOutside;
114
+ exports.useEscapeKey = useEscapeKey;
115
+ exports.useFloating = useFloating;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { AreaChartProps as AreaChartProps$1, AreaChartDatum, AreaChartSeries, ChartPadding, ChartScale } from '@expcat/tigercat-core';
3
+
4
+ interface AreaChartProps extends AreaChartProps$1 {
5
+ data?: AreaChartDatum[];
6
+ series?: AreaChartSeries[];
7
+ padding?: ChartPadding;
8
+ xScale?: ChartScale;
9
+ yScale?: ChartScale;
10
+ onHoveredIndexChange?: (index: number | null) => void;
11
+ onSelectedIndexChange?: (index: number | null) => void;
12
+ onSeriesClick?: (seriesIndex: number, series: AreaChartSeries) => void;
13
+ onSeriesHover?: (seriesIndex: number | null, series: AreaChartSeries | null) => void;
14
+ onPointClick?: (seriesIndex: number, pointIndex: number, datum: AreaChartDatum) => void;
15
+ onPointHover?: (seriesIndex: number | null, pointIndex: number | null, datum: AreaChartDatum | null) => void;
16
+ }
17
+ declare const AreaChart: React.FC<AreaChartProps>;
18
+
19
+ export { AreaChart, type AreaChartProps, AreaChart as default };
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { AreaChartProps as AreaChartProps$1, AreaChartDatum, AreaChartSeries, ChartPadding, ChartScale } from '@expcat/tigercat-core';
3
+
4
+ interface AreaChartProps extends AreaChartProps$1 {
5
+ data?: AreaChartDatum[];
6
+ series?: AreaChartSeries[];
7
+ padding?: ChartPadding;
8
+ xScale?: ChartScale;
9
+ yScale?: ChartScale;
10
+ onHoveredIndexChange?: (index: number | null) => void;
11
+ onSelectedIndexChange?: (index: number | null) => void;
12
+ onSeriesClick?: (seriesIndex: number, series: AreaChartSeries) => void;
13
+ onSeriesHover?: (seriesIndex: number | null, series: AreaChartSeries | null) => void;
14
+ onPointClick?: (seriesIndex: number, pointIndex: number, datum: AreaChartDatum) => void;
15
+ onPointHover?: (seriesIndex: number | null, pointIndex: number | null, datum: AreaChartDatum | null) => void;
16
+ }
17
+ declare const AreaChart: React.FC<AreaChartProps>;
18
+
19
+ export { AreaChart, type AreaChartProps, AreaChart as default };
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var chunkOONM7FO7_js = require('../chunk-OONM7FO7.js');
6
+ require('../chunk-KQZ4F7FZ.js');
7
+ require('../chunk-E5GD3H7L.js');
8
+ require('../chunk-DUWAV47E.js');
9
+ require('../chunk-3QFHVAZT.js');
10
+ require('../chunk-6PBNFLM7.js');
11
+ require('../chunk-AX5XRD2Q.js');
12
+ require('../chunk-M375I56K.js');
13
+
14
+
15
+
16
+ Object.defineProperty(exports, "AreaChart", {
17
+ enumerable: true,
18
+ get: function () { return chunkOONM7FO7_js.AreaChart; }
19
+ });
20
+ Object.defineProperty(exports, "default", {
21
+ enumerable: true,
22
+ get: function () { return chunkOONM7FO7_js.AreaChart_default; }
23
+ });
@@ -0,0 +1,8 @@
1
+ export { AreaChart, AreaChart_default as default } from '../chunk-A2UW5OKX.mjs';
2
+ import '../chunk-3CDAG4HD.mjs';
3
+ import '../chunk-RQSQXQN6.mjs';
4
+ import '../chunk-IS467WAO.mjs';
5
+ import '../chunk-677VSTPW.mjs';
6
+ import '../chunk-Z6F67MJE.mjs';
7
+ import '../chunk-SDLMB34Y.mjs';
8
+ import '../chunk-LVC43YX2.mjs';
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { BarChartProps as BarChartProps$1, BarChartDatum, ChartPadding, ChartScale } from '@expcat/tigercat-core';
3
+
4
+ interface BarChartProps extends BarChartProps$1 {
5
+ data: BarChartDatum[];
6
+ padding?: ChartPadding;
7
+ xScale?: ChartScale;
8
+ yScale?: ChartScale;
9
+ onHoveredIndexChange?: (index: number | null) => void;
10
+ onSelectedIndexChange?: (index: number | null) => void;
11
+ onBarClick?: (index: number, datum: BarChartDatum) => void;
12
+ onBarHover?: (index: number | null, datum: BarChartDatum | null) => void;
13
+ }
14
+ declare const BarChart: React.FC<BarChartProps>;
15
+
16
+ export { BarChart, type BarChartProps, BarChart as default };
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { BarChartProps as BarChartProps$1, BarChartDatum, ChartPadding, ChartScale } from '@expcat/tigercat-core';
3
+
4
+ interface BarChartProps extends BarChartProps$1 {
5
+ data: BarChartDatum[];
6
+ padding?: ChartPadding;
7
+ xScale?: ChartScale;
8
+ yScale?: ChartScale;
9
+ onHoveredIndexChange?: (index: number | null) => void;
10
+ onSelectedIndexChange?: (index: number | null) => void;
11
+ onBarClick?: (index: number, datum: BarChartDatum) => void;
12
+ onBarHover?: (index: number | null, datum: BarChartDatum | null) => void;
13
+ }
14
+ declare const BarChart: React.FC<BarChartProps>;
15
+
16
+ export { BarChart, type BarChartProps, BarChart as default };
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var chunkQI6WAP6Y_js = require('../chunk-QI6WAP6Y.js');
6
+ require('../chunk-KQZ4F7FZ.js');
7
+ require('../chunk-E5GD3H7L.js');
8
+ require('../chunk-DUWAV47E.js');
9
+ require('../chunk-3QFHVAZT.js');
10
+ require('../chunk-6PBNFLM7.js');
11
+ require('../chunk-AX5XRD2Q.js');
12
+ require('../chunk-M375I56K.js');
13
+
14
+
15
+
16
+ Object.defineProperty(exports, "BarChart", {
17
+ enumerable: true,
18
+ get: function () { return chunkQI6WAP6Y_js.BarChart; }
19
+ });
20
+ Object.defineProperty(exports, "default", {
21
+ enumerable: true,
22
+ get: function () { return chunkQI6WAP6Y_js.BarChart_default; }
23
+ });
@@ -0,0 +1,8 @@
1
+ export { BarChart, BarChart_default as default } from '../chunk-KBGURVTD.mjs';
2
+ import '../chunk-3CDAG4HD.mjs';
3
+ import '../chunk-RQSQXQN6.mjs';
4
+ import '../chunk-IS467WAO.mjs';
5
+ import '../chunk-677VSTPW.mjs';
6
+ import '../chunk-Z6F67MJE.mjs';
7
+ import '../chunk-SDLMB34Y.mjs';
8
+ import '../chunk-LVC43YX2.mjs';