@expcat/tigercat-react 0.1.6 → 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 (171) 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-W7HUFFPJ.mjs → chunk-CJJ56NVL.mjs} +19 -19
  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-EUHWE7MN.js → chunk-R7TOQU3U.js} +18 -18
  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.d.mts +2 -2
  118. package/dist/components/Message.d.ts +2 -2
  119. package/dist/components/Message.js +7 -7
  120. package/dist/components/Message.mjs +1 -1
  121. package/dist/components/Modal.js +3 -3
  122. package/dist/components/Modal.mjs +2 -2
  123. package/dist/components/Notification.js +4 -4
  124. package/dist/components/Notification.mjs +1 -1
  125. package/dist/components/Pagination.d.mts +5 -1
  126. package/dist/components/Pagination.d.ts +5 -1
  127. package/dist/components/Pagination.js +3 -3
  128. package/dist/components/Pagination.mjs +1 -1
  129. package/dist/components/PieChart.d.mts +14 -0
  130. package/dist/components/PieChart.d.ts +14 -0
  131. package/dist/components/PieChart.js +20 -0
  132. package/dist/components/PieChart.mjs +5 -0
  133. package/dist/components/Popconfirm.d.mts +12 -2
  134. package/dist/components/Popconfirm.d.ts +12 -2
  135. package/dist/components/Popconfirm.js +3 -2
  136. package/dist/components/Popconfirm.mjs +2 -1
  137. package/dist/components/Popover.d.mts +12 -2
  138. package/dist/components/Popover.d.ts +12 -2
  139. package/dist/components/Popover.js +3 -2
  140. package/dist/components/Popover.mjs +2 -1
  141. package/dist/components/RadarChart.d.mts +20 -0
  142. package/dist/components/RadarChart.d.ts +20 -0
  143. package/dist/components/RadarChart.js +20 -0
  144. package/dist/components/RadarChart.mjs +5 -0
  145. package/dist/components/ScatterChart.d.mts +32 -0
  146. package/dist/components/ScatterChart.d.ts +32 -0
  147. package/dist/components/ScatterChart.js +23 -0
  148. package/dist/components/ScatterChart.mjs +8 -0
  149. package/dist/components/Select.js +2 -2
  150. package/dist/components/Select.mjs +1 -1
  151. package/dist/components/Slider.js +2 -2
  152. package/dist/components/Slider.mjs +1 -1
  153. package/dist/components/Space.js +2 -2
  154. package/dist/components/Space.mjs +1 -1
  155. package/dist/components/Steps.js +3 -3
  156. package/dist/components/Steps.mjs +1 -1
  157. package/dist/components/StepsItem.js +2 -2
  158. package/dist/components/StepsItem.mjs +1 -1
  159. package/dist/components/Table.js +2 -2
  160. package/dist/components/Table.mjs +1 -1
  161. package/dist/components/Tooltip.d.mts +12 -2
  162. package/dist/components/Tooltip.d.ts +12 -2
  163. package/dist/components/Tooltip.js +3 -2
  164. package/dist/components/Tooltip.mjs +2 -1
  165. package/dist/index.d.mts +98 -2
  166. package/dist/index.d.ts +98 -2
  167. package/dist/index.js +180 -110
  168. package/dist/index.mjs +41 -27
  169. package/package.json +2 -2
  170. package/dist/chunk-NEULKOYJ.js +0 -48
  171. package/dist/chunk-ZO4XVOHU.mjs +0 -45
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkNEULKOYJ_js = require('./chunk-NEULKOYJ.js');
3
+ var chunkZYPEO2KY_js = require('./chunk-ZYPEO2KY.js');
4
4
  var React = require('react');
5
5
  var reactDom = require('react-dom');
6
6
  var tigercatCore = require('@expcat/tigercat-core');
@@ -69,7 +69,7 @@ var Drawer = ({
69
69
  },
70
70
  [maskClosable, handleClose]
71
71
  );
72
- chunkNEULKOYJ_js.useEscapeKey({ enabled: visible, onEscape: handleClose });
72
+ chunkZYPEO2KY_js.useEscapeKey({ enabled: visible, onEscape: handleClose });
73
73
  const previousVisible = React.useRef(false);
74
74
  React.useEffect(() => {
75
75
  if (visible === previousVisible.current) return;
@@ -80,7 +80,7 @@ var Drawer = ({
80
80
  } else {
81
81
  onAfterLeave?.();
82
82
  }
83
- }, 300);
83
+ }, tigercatCore.ANIMATION_DURATION_MS);
84
84
  return () => window.clearTimeout(timer);
85
85
  }, [visible, onAfterEnter, onAfterLeave]);
86
86
  const reactId = React.useId();
@@ -114,6 +114,16 @@ var Drawer = ({
114
114
  if (visible) return;
115
115
  tigercatCore.restoreFocus(previousActiveElementRef.current);
116
116
  }, [visible]);
117
+ const handleKeyDown = React.useCallback((event) => {
118
+ if (event.key === "Tab" && dialogRef.current) {
119
+ const focusables = tigercatCore.getFocusableElements(dialogRef.current);
120
+ const result = tigercatCore.getFocusTrapNavigation(event.nativeEvent, focusables, document.activeElement);
121
+ if (result.shouldHandle && result.next) {
122
+ event.preventDefault();
123
+ result.next.focus();
124
+ }
125
+ }
126
+ }, []);
117
127
  const containerClasses = tigercatCore.classNames(
118
128
  tigercatCore.getDrawerContainerClasses(zIndex),
119
129
  !visible && "pointer-events-none"
@@ -161,6 +171,7 @@ var Drawer = ({
161
171
  "aria-labelledby": ariaLabelledby,
162
172
  tabIndex: -1,
163
173
  ref: dialogRef,
174
+ onKeyDown: handleKeyDown,
164
175
  "data-tiger-drawer": "",
165
176
  children: [
166
177
  (title || header || closable) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: headerClasses, children: [
@@ -0,0 +1,429 @@
1
+ import { useChartInteraction } from './chunk-3CDAG4HD.mjs';
2
+ import { ChartCanvas } from './chunk-IS467WAO.mjs';
3
+ import { ChartSeries } from './chunk-SDLMB34Y.mjs';
4
+ import { ChartTooltip } from './chunk-LVC43YX2.mjs';
5
+ import { useMemo, useState, useCallback } from 'react';
6
+ import { getChartInnerRect, getRadarAngles, getRadarPoints, polarToCartesian, createPolygonPath, getChartGridLineDasharray, DEFAULT_CHART_COLORS, classNames, chartGridLineClasses, chartAxisTickTextClasses } from '@expcat/tigercat-core';
7
+ import { jsxs, jsx } from 'react/jsx-runtime';
8
+
9
+ var RadarChart = ({
10
+ width = 320,
11
+ height = 200,
12
+ padding = 24,
13
+ data,
14
+ series,
15
+ maxValue,
16
+ startAngle = -Math.PI / 2,
17
+ levels = 5,
18
+ showLevelLabels = false,
19
+ showGrid = true,
20
+ showAxis = true,
21
+ showLabels = true,
22
+ labelOffset = 12,
23
+ labelFormatter,
24
+ levelLabelFormatter,
25
+ levelLabelOffset = 8,
26
+ colors,
27
+ gridLineStyle = "solid",
28
+ gridStrokeWidth = 1,
29
+ hoverable = false,
30
+ hoveredIndex: hoveredIndexProp,
31
+ activeOpacity = 1,
32
+ inactiveOpacity = 0.25,
33
+ showTooltip = true,
34
+ tooltipFormatter,
35
+ selectable = false,
36
+ selectedIndex: selectedIndexProp,
37
+ onHoveredIndexChange,
38
+ onSelectedIndexChange,
39
+ onSeriesClick,
40
+ onSeriesHover,
41
+ showLegend = false,
42
+ legendPosition = "bottom",
43
+ legendFormatter,
44
+ legendMarkerSize = 10,
45
+ legendGap = 8,
46
+ strokeColor = DEFAULT_CHART_COLORS[0],
47
+ strokeWidth = 2,
48
+ fillColor = DEFAULT_CHART_COLORS[0],
49
+ fillOpacity = 0.2,
50
+ showPoints = true,
51
+ pointSize = 3,
52
+ pointColor,
53
+ title,
54
+ desc,
55
+ className
56
+ }) => {
57
+ const resolvedSeries = useMemo(() => {
58
+ if (series && series.length > 0) return series;
59
+ return [{ data: data ?? [] }];
60
+ }, [series, data]);
61
+ const {
62
+ resolvedHoveredIndex: _resolvedHoveredIndex,
63
+ resolvedSelectedIndex: _resolvedSelectedIndex,
64
+ activeIndex: resolvedActiveIndex,
65
+ tooltipPosition,
66
+ handleMouseEnter: handleHoverEnter,
67
+ handleMouseMove,
68
+ handleMouseLeave: handleHoverLeave,
69
+ handleClick: handleSelectIndex
70
+ } = useChartInteraction({
71
+ hoverable,
72
+ hoveredIndexProp,
73
+ selectable,
74
+ selectedIndexProp,
75
+ activeOpacity,
76
+ inactiveOpacity,
77
+ legendPosition,
78
+ getData: (index) => resolvedSeries[index],
79
+ onHoveredIndexChange: (index) => {
80
+ onHoveredIndexChange?.(index);
81
+ onSeriesHover?.(index, index !== null ? resolvedSeries[index] : null);
82
+ },
83
+ onSelectedIndexChange: (index) => {
84
+ onSelectedIndexChange?.(index);
85
+ if (index !== null) {
86
+ onSeriesClick?.(index, resolvedSeries[index]);
87
+ }
88
+ }
89
+ });
90
+ const [hoveredPoint, setHoveredPoint] = useState(null);
91
+ const handlePointEnter = useCallback(
92
+ (seriesIndex, pointIndex, event) => {
93
+ if (!hoverable) return;
94
+ setHoveredPoint({ seriesIndex, pointIndex });
95
+ handleHoverEnter(seriesIndex, event);
96
+ },
97
+ [hoverable, handleHoverEnter]
98
+ );
99
+ const handlePointMove = useCallback(
100
+ (event) => {
101
+ handleMouseMove(event);
102
+ },
103
+ [handleMouseMove]
104
+ );
105
+ const handlePointLeave = useCallback(() => {
106
+ setHoveredPoint(null);
107
+ handleHoverLeave();
108
+ }, [handleHoverLeave]);
109
+ const innerRect = useMemo(
110
+ () => getChartInnerRect(width, height, padding),
111
+ [width, height, padding]
112
+ );
113
+ const radius = useMemo(
114
+ () => Math.max(0, Math.min(innerRect.width, innerRect.height) / 2),
115
+ [innerRect.width, innerRect.height]
116
+ );
117
+ const cx = innerRect.width / 2;
118
+ const cy = innerRect.height / 2;
119
+ const axisData = useMemo(() => {
120
+ if (series && series.length > 0) return series[0]?.data ?? [];
121
+ return data ?? [];
122
+ }, [series, data]);
123
+ const resolvedMaxValue = useMemo(() => {
124
+ if (typeof maxValue === "number") return Math.max(0, maxValue);
125
+ const values = resolvedSeries.flatMap((item) => item.data.map((datum) => datum.value));
126
+ const computedMax = values.length > 0 ? Math.max(...values) : 0;
127
+ return computedMax > 0 ? computedMax : 1;
128
+ }, [resolvedSeries, maxValue]);
129
+ const angles = useMemo(
130
+ () => getRadarAngles(axisData.length, startAngle),
131
+ [axisData.length, startAngle]
132
+ );
133
+ const seriesPoints = useMemo(
134
+ () => resolvedSeries.map((item) => ({
135
+ series: item,
136
+ points: getRadarPoints(item.data, {
137
+ cx,
138
+ cy,
139
+ radius,
140
+ startAngle,
141
+ maxValue: resolvedMaxValue
142
+ })
143
+ })),
144
+ [resolvedSeries, cx, cy, radius, startAngle, resolvedMaxValue]
145
+ );
146
+ const gridPaths = useMemo(() => {
147
+ if (!showGrid || angles.length === 0) return [];
148
+ const resolvedLevels = Math.max(1, Math.floor(levels));
149
+ return Array.from({ length: resolvedLevels }, (_, index) => {
150
+ const levelRadius = radius * ((index + 1) / resolvedLevels);
151
+ const ringPoints = angles.map((angle) => polarToCartesian(cx, cy, levelRadius, angle));
152
+ return createPolygonPath(ringPoints);
153
+ });
154
+ }, [showGrid, levels, angles, radius, cx, cy]);
155
+ const axisLines = useMemo(() => {
156
+ if (!showAxis || angles.length === 0) return [];
157
+ return angles.map((angle) => {
158
+ const end = polarToCartesian(cx, cy, radius, angle);
159
+ return {
160
+ x1: cx,
161
+ y1: cy,
162
+ x2: end.x,
163
+ y2: end.y
164
+ };
165
+ });
166
+ }, [showAxis, angles, cx, cy, radius]);
167
+ const labels = useMemo(() => {
168
+ if (!showLabels || angles.length === 0) return [];
169
+ const formatLabel = labelFormatter ?? ((datum) => datum.label ?? `${datum.value}`);
170
+ return axisData.map((datum, index) => {
171
+ const angle = angles[index];
172
+ const position = polarToCartesian(cx, cy, radius + labelOffset, angle);
173
+ return {
174
+ x: position.x,
175
+ y: position.y,
176
+ text: formatLabel(datum, index)
177
+ };
178
+ });
179
+ }, [showLabels, axisData, angles, cx, cy, radius, labelOffset, labelFormatter]);
180
+ const levelLabels = useMemo(() => {
181
+ if (!showLevelLabels || !showGrid || angles.length === 0) return [];
182
+ const resolvedLevels = Math.max(1, Math.floor(levels));
183
+ const formatLevel = levelLabelFormatter ?? ((value) => `${value}`);
184
+ return Array.from({ length: resolvedLevels }, (_, index) => {
185
+ const ratio = (index + 1) / resolvedLevels;
186
+ const value = resolvedMaxValue * ratio;
187
+ const position = polarToCartesian(cx, cy, radius * ratio + levelLabelOffset, startAngle);
188
+ return {
189
+ x: position.x,
190
+ y: position.y,
191
+ text: formatLevel(value, index)
192
+ };
193
+ });
194
+ }, [
195
+ showLevelLabels,
196
+ showGrid,
197
+ angles.length,
198
+ levels,
199
+ resolvedMaxValue,
200
+ cx,
201
+ cy,
202
+ radius,
203
+ levelLabelOffset,
204
+ startAngle,
205
+ levelLabelFormatter
206
+ ]);
207
+ const dasharray = getChartGridLineDasharray(gridLineStyle);
208
+ const palette = useMemo(
209
+ () => colors && colors.length > 0 ? colors : [...DEFAULT_CHART_COLORS],
210
+ [colors]
211
+ );
212
+ const formatTooltip = useMemo(
213
+ () => tooltipFormatter ?? ((datum, seriesIndex, index, series2) => {
214
+ const label = datum.label ?? `#${index + 1}`;
215
+ const value = datum.value;
216
+ const name = series2?.name ?? `Series ${seriesIndex + 1}`;
217
+ return `${name} \xB7 ${label}: ${value}`;
218
+ }),
219
+ [tooltipFormatter]
220
+ );
221
+ const tooltipContent = useMemo(() => {
222
+ if (!hoveredPoint) return "";
223
+ const { seriesIndex, pointIndex } = hoveredPoint;
224
+ const series2 = resolvedSeries[seriesIndex];
225
+ if (!series2) return "";
226
+ const datum = series2.data[pointIndex];
227
+ if (!datum) return "";
228
+ return formatTooltip(datum, seriesIndex, pointIndex, series2);
229
+ }, [hoveredPoint, resolvedSeries, formatTooltip]);
230
+ const resolvedLegendItems = useMemo(
231
+ () => resolvedSeries.map((item, index) => {
232
+ const color = item.color ?? palette[index % palette.length];
233
+ const label = legendFormatter ? legendFormatter(item, index) : item.name ?? `Series ${index + 1}`;
234
+ return {
235
+ index,
236
+ label,
237
+ color
238
+ };
239
+ }),
240
+ [resolvedSeries, palette, legendFormatter]
241
+ );
242
+ const legendContainerClasses = classNames(
243
+ "flex flex-wrap",
244
+ legendPosition === "right" ? "flex-col gap-2" : "flex-row gap-3"
245
+ );
246
+ const wrapperClasses = classNames(
247
+ "inline-flex",
248
+ legendPosition === "right" ? "flex-row items-start gap-4" : "flex-col gap-2"
249
+ );
250
+ const chart = /* @__PURE__ */ jsxs(
251
+ ChartCanvas,
252
+ {
253
+ width,
254
+ height,
255
+ padding,
256
+ title,
257
+ desc,
258
+ className: classNames(className),
259
+ children: [
260
+ gridPaths.map((path, index) => /* @__PURE__ */ jsx(
261
+ "path",
262
+ {
263
+ d: path,
264
+ className: chartGridLineClasses,
265
+ fill: "none",
266
+ strokeWidth: gridStrokeWidth,
267
+ strokeDasharray: dasharray
268
+ },
269
+ `grid-${index}`
270
+ )),
271
+ axisLines.map((line, index) => /* @__PURE__ */ jsx(
272
+ "line",
273
+ {
274
+ x1: line.x1,
275
+ y1: line.y1,
276
+ x2: line.x2,
277
+ y2: line.y2,
278
+ className: chartGridLineClasses,
279
+ strokeWidth: gridStrokeWidth,
280
+ strokeDasharray: dasharray
281
+ },
282
+ `axis-${index}`
283
+ )),
284
+ seriesPoints.map((item, seriesIndex) => {
285
+ const seriesColor = item.series.color ?? palette[seriesIndex % palette.length];
286
+ const resolvedStrokeColor = item.series.strokeColor ?? seriesColor ?? strokeColor;
287
+ const resolvedFillColor = item.series.fillColor ?? seriesColor ?? fillColor;
288
+ const resolvedFillOpacity = item.series.fillOpacity ?? fillOpacity;
289
+ const resolvedStrokeWidth = item.series.strokeWidth ?? strokeWidth;
290
+ const resolvedShowPoints = item.series.showPoints ?? showPoints;
291
+ const resolvedPointSize = item.series.pointSize ?? pointSize;
292
+ const resolvedPointColor = item.series.pointColor ?? seriesColor ?? pointColor;
293
+ const areaPath = createPolygonPath(item.points.map((point) => ({ x: point.x, y: point.y })));
294
+ const resolvedOpacity = resolvedActiveIndex === null ? void 0 : seriesIndex === resolvedActiveIndex ? activeOpacity : inactiveOpacity;
295
+ return /* @__PURE__ */ jsxs(
296
+ ChartSeries,
297
+ {
298
+ data: item.series.data,
299
+ name: item.series.name,
300
+ type: "radar",
301
+ className: item.series.className,
302
+ opacity: resolvedOpacity,
303
+ style: hoverable || selectable ? { cursor: "pointer" } : void 0,
304
+ onMouseEnter: hoverable ? (e) => handleHoverEnter(seriesIndex, e) : void 0,
305
+ onMouseLeave: hoverable ? handleHoverLeave : void 0,
306
+ onClick: selectable ? () => handleSelectIndex(seriesIndex) : void 0,
307
+ tabIndex: selectable ? 0 : void 0,
308
+ onKeyDown: (event) => {
309
+ if (!selectable) return;
310
+ if (event.key !== "Enter" && event.key !== " ") return;
311
+ event.preventDefault();
312
+ handleSelectIndex(seriesIndex);
313
+ },
314
+ children: [
315
+ areaPath ? /* @__PURE__ */ jsx(
316
+ "path",
317
+ {
318
+ d: areaPath,
319
+ fill: resolvedFillColor,
320
+ fillOpacity: resolvedFillOpacity,
321
+ stroke: resolvedStrokeColor,
322
+ strokeWidth: resolvedStrokeWidth,
323
+ "data-radar-area": "true",
324
+ "data-series-index": seriesIndex
325
+ }
326
+ ) : null,
327
+ resolvedShowPoints ? item.points.map((point) => {
328
+ return /* @__PURE__ */ jsx(
329
+ "circle",
330
+ {
331
+ cx: point.x,
332
+ cy: point.y,
333
+ r: point.data.size ?? resolvedPointSize,
334
+ fill: point.data.color ?? resolvedPointColor ?? resolvedStrokeColor,
335
+ className: showTooltip && hoverable ? "cursor-pointer" : void 0,
336
+ "data-radar-point": "true",
337
+ "data-series-index": seriesIndex,
338
+ "data-point-index": point.index,
339
+ onMouseEnter: showTooltip && hoverable ? (e) => handlePointEnter(seriesIndex, point.index, e) : void 0,
340
+ onMouseMove: showTooltip && hoverable ? handlePointMove : void 0,
341
+ onMouseLeave: showTooltip && hoverable ? handlePointLeave : void 0
342
+ },
343
+ `point-${seriesIndex}-${point.index}`
344
+ );
345
+ }) : null
346
+ ]
347
+ },
348
+ `series-${seriesIndex}`
349
+ );
350
+ }),
351
+ labels.map((label, index) => /* @__PURE__ */ jsx(
352
+ "text",
353
+ {
354
+ x: label.x,
355
+ y: label.y,
356
+ className: chartAxisTickTextClasses,
357
+ textAnchor: "middle",
358
+ dominantBaseline: "middle",
359
+ children: label.text
360
+ },
361
+ `label-${index}`
362
+ )),
363
+ levelLabels.map((label, index) => /* @__PURE__ */ jsx(
364
+ "text",
365
+ {
366
+ x: label.x,
367
+ y: label.y,
368
+ className: chartAxisTickTextClasses,
369
+ textAnchor: "middle",
370
+ dominantBaseline: "middle",
371
+ "data-radar-level-label": "true",
372
+ children: label.text
373
+ },
374
+ `level-${index}`
375
+ ))
376
+ ]
377
+ }
378
+ );
379
+ const tooltip = showTooltip && hoverable ? /* @__PURE__ */ jsx(
380
+ ChartTooltip,
381
+ {
382
+ content: tooltipContent,
383
+ visible: hoveredPoint !== null && tooltipContent !== "",
384
+ x: tooltipPosition.x,
385
+ y: tooltipPosition.y
386
+ }
387
+ ) : null;
388
+ if (!showLegend) {
389
+ return /* @__PURE__ */ jsxs("div", { className: "inline-block relative", children: [
390
+ chart,
391
+ tooltip
392
+ ] });
393
+ }
394
+ return /* @__PURE__ */ jsxs("div", { className: wrapperClasses, children: [
395
+ chart,
396
+ /* @__PURE__ */ jsx("div", { className: legendContainerClasses, children: resolvedLegendItems.map((item) => /* @__PURE__ */ jsxs(
397
+ "button",
398
+ {
399
+ type: "button",
400
+ className: classNames(
401
+ "flex items-center gap-2 text-sm text-gray-600",
402
+ selectable ? "cursor-pointer" : "cursor-default"
403
+ ),
404
+ onClick: selectable ? () => handleSelectIndex(item.index) : void 0,
405
+ onMouseEnter: hoverable ? (e) => handleHoverEnter(item.index, e) : void 0,
406
+ onMouseLeave: hoverable ? handlePointLeave : void 0,
407
+ children: [
408
+ /* @__PURE__ */ jsx(
409
+ "span",
410
+ {
411
+ className: "inline-block rounded-full",
412
+ style: {
413
+ width: `${legendMarkerSize}px`,
414
+ height: `${legendMarkerSize}px`,
415
+ backgroundColor: item.color
416
+ }
417
+ }
418
+ ),
419
+ /* @__PURE__ */ jsx("span", { style: { marginRight: `${legendGap}px` }, children: item.label })
420
+ ]
421
+ },
422
+ `legend-${item.index}`
423
+ )) }),
424
+ tooltip
425
+ ] });
426
+ };
427
+ var RadarChart_default = RadarChart;
428
+
429
+ export { RadarChart, RadarChart_default };
@@ -4,7 +4,6 @@ var tigercatCore = require('@expcat/tigercat-core');
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
 
6
6
  // src/components/Space.tsx
7
- var baseClasses = "inline-flex";
8
7
  var Space = ({
9
8
  direction = "horizontal",
10
9
  size = "md",
@@ -22,7 +21,7 @@ var Space = ({
22
21
  {
23
22
  ...props,
24
23
  className: tigercatCore.classNames(
25
- baseClasses,
24
+ tigercatCore.SPACE_BASE_CLASS,
26
25
  tigercatCore.getSpaceDirectionClass(direction),
27
26
  tigercatCore.getSpaceAlignClass(align),
28
27
  gapSize.class,
@@ -0,0 +1,92 @@
1
+ import { useMemo, useCallback } from 'react';
2
+ import { classNames } from '@expcat/tigercat-core';
3
+ import { jsx, jsxs } from 'react/jsx-runtime';
4
+
5
+ // src/components/ChartLegend.tsx
6
+ var ChartLegend = ({
7
+ items,
8
+ position = "bottom",
9
+ markerSize = 10,
10
+ gap = 8,
11
+ interactive = false,
12
+ className,
13
+ onItemClick,
14
+ onItemHover,
15
+ onItemLeave
16
+ }) => {
17
+ const containerClasses = useMemo(
18
+ () => classNames(
19
+ "flex flex-wrap",
20
+ position === "right" || position === "left" ? "flex-col gap-2" : "flex-row gap-3",
21
+ className
22
+ ),
23
+ [position, className]
24
+ );
25
+ const handleClick = useCallback(
26
+ (item) => {
27
+ if (!interactive) return;
28
+ onItemClick?.(item.index, item);
29
+ },
30
+ [interactive, onItemClick]
31
+ );
32
+ const handleHover = useCallback(
33
+ (item) => {
34
+ if (!interactive) return;
35
+ onItemHover?.(item.index, item);
36
+ },
37
+ [interactive, onItemHover]
38
+ );
39
+ const handleLeave = useCallback(() => {
40
+ if (!interactive) return;
41
+ onItemLeave?.();
42
+ }, [interactive, onItemLeave]);
43
+ return /* @__PURE__ */ jsx(
44
+ "div",
45
+ {
46
+ className: containerClasses,
47
+ role: "list",
48
+ "aria-label": "Chart legend",
49
+ "data-chart-legend": "true",
50
+ children: items.map((item) => {
51
+ const ItemComponent = interactive ? "button" : "div";
52
+ return /* @__PURE__ */ jsxs(
53
+ ItemComponent,
54
+ {
55
+ type: interactive ? "button" : void 0,
56
+ className: classNames(
57
+ "flex items-center gap-2 text-sm",
58
+ "text-[color:var(--tiger-text-secondary,#6b7280)]",
59
+ interactive ? "cursor-pointer hover:text-[color:var(--tiger-text,#374151)] transition-colors" : "cursor-default",
60
+ item.active === false ? "opacity-50" : void 0
61
+ ),
62
+ role: "listitem",
63
+ "data-legend-item": "true",
64
+ onClick: interactive ? () => handleClick(item) : void 0,
65
+ onMouseEnter: interactive ? () => handleHover(item) : void 0,
66
+ onMouseLeave: interactive ? handleLeave : void 0,
67
+ children: [
68
+ /* @__PURE__ */ jsx(
69
+ "span",
70
+ {
71
+ className: "inline-block rounded-full shrink-0",
72
+ style: {
73
+ width: `${markerSize}px`,
74
+ height: `${markerSize}px`,
75
+ backgroundColor: item.color
76
+ },
77
+ "aria-hidden": "true",
78
+ "data-legend-marker": "true"
79
+ }
80
+ ),
81
+ /* @__PURE__ */ jsx("span", { style: { marginRight: `${gap}px` }, children: item.label })
82
+ ]
83
+ },
84
+ `legend-${item.index}`
85
+ );
86
+ })
87
+ }
88
+ );
89
+ };
90
+ var ChartLegend_default = ChartLegend;
91
+
92
+ export { ChartLegend, ChartLegend_default };