@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,367 @@
1
+ 'use strict';
2
+
3
+ var chunkKQZ4F7FZ_js = require('./chunk-KQZ4F7FZ.js');
4
+ var chunkE5GD3H7L_js = require('./chunk-E5GD3H7L.js');
5
+ var chunkDUWAV47E_js = require('./chunk-DUWAV47E.js');
6
+ var chunk3QFHVAZT_js = require('./chunk-3QFHVAZT.js');
7
+ var chunk6PBNFLM7_js = require('./chunk-6PBNFLM7.js');
8
+ var chunkAX5XRD2Q_js = require('./chunk-AX5XRD2Q.js');
9
+ var chunkM375I56K_js = require('./chunk-M375I56K.js');
10
+ var react = require('react');
11
+ var tigercatCore = require('@expcat/tigercat-core');
12
+ var jsxRuntime = require('react/jsx-runtime');
13
+
14
+ var LineChart = ({
15
+ width = 320,
16
+ height = 200,
17
+ padding = 24,
18
+ data,
19
+ series,
20
+ xScale: xScaleProp,
21
+ yScale: yScaleProp,
22
+ lineColor: _lineColor = "var(--tiger-primary,#2563eb)",
23
+ strokeWidth = 2,
24
+ curve = "linear",
25
+ showPoints = true,
26
+ pointSize = 4,
27
+ pointColor: _pointColor,
28
+ showGrid = true,
29
+ showAxis = true,
30
+ showXAxis = true,
31
+ showYAxis = true,
32
+ includeZero = false,
33
+ xAxisLabel,
34
+ yAxisLabel,
35
+ xTicks = 5,
36
+ yTicks = 5,
37
+ xTickValues,
38
+ yTickValues,
39
+ xTickFormat,
40
+ yTickFormat,
41
+ gridLineStyle = "solid",
42
+ gridStrokeWidth = 1,
43
+ colors,
44
+ hoverable = false,
45
+ hoveredIndex: hoveredIndexProp,
46
+ activeOpacity = 1,
47
+ inactiveOpacity = 0.25,
48
+ selectable = false,
49
+ selectedIndex: selectedIndexProp,
50
+ showLegend = false,
51
+ legendPosition = "bottom",
52
+ legendMarkerSize = 10,
53
+ legendGap = 8,
54
+ showTooltip = true,
55
+ tooltipFormatter,
56
+ legendFormatter,
57
+ title,
58
+ desc,
59
+ className,
60
+ onHoveredIndexChange,
61
+ onSelectedIndexChange,
62
+ onSeriesClick,
63
+ onSeriesHover,
64
+ onPointClick,
65
+ onPointHover
66
+ }) => {
67
+ const [hoveredPointInfo, setHoveredPointInfo] = react.useState(null);
68
+ const [tooltipPosition, setTooltipPosition] = react.useState({ x: 0, y: 0 });
69
+ const innerRect = react.useMemo(
70
+ () => tigercatCore.getChartInnerRect(width, height, padding),
71
+ [width, height, padding]
72
+ );
73
+ const resolvedSeries = react.useMemo(() => {
74
+ if (series && series.length > 0) return series;
75
+ if (data && data.length > 0) return [{ data }];
76
+ return [];
77
+ }, [series, data]);
78
+ const {
79
+ activeIndex,
80
+ handleMouseEnter: handleSeriesHoverEnter,
81
+ handleMouseLeave: handleSeriesHoverLeave,
82
+ handleClick: handleSeriesSelect,
83
+ handleLegendClick,
84
+ handleLegendHover,
85
+ handleLegendLeave,
86
+ wrapperClasses
87
+ } = chunkKQZ4F7FZ_js.useChartInteraction({
88
+ hoverable,
89
+ hoveredIndexProp,
90
+ selectable,
91
+ selectedIndexProp,
92
+ activeOpacity,
93
+ inactiveOpacity,
94
+ legendPosition,
95
+ getData: (index) => resolvedSeries[index],
96
+ onHoveredIndexChange: (index) => {
97
+ onHoveredIndexChange?.(index);
98
+ onSeriesHover?.(index, index !== null ? resolvedSeries[index] : null);
99
+ },
100
+ onSelectedIndexChange: (index) => {
101
+ onSelectedIndexChange?.(index);
102
+ if (index !== null) {
103
+ onSeriesClick?.(index, resolvedSeries[index]);
104
+ }
105
+ }
106
+ });
107
+ const allData = react.useMemo(() => resolvedSeries.flatMap((s) => s.data), [resolvedSeries]);
108
+ const xValues = react.useMemo(() => allData.map((d) => d.x), [allData]);
109
+ const yValues = react.useMemo(() => allData.map((d) => d.y), [allData]);
110
+ const isXNumeric = react.useMemo(() => xValues.every((v) => typeof v === "number"), [xValues]);
111
+ const resolvedXScale = react.useMemo(() => {
112
+ if (xScaleProp) return xScaleProp;
113
+ if (isXNumeric) {
114
+ const extent = tigercatCore.getNumberExtent(xValues, { includeZero: false });
115
+ return tigercatCore.createLinearScale(extent, [0, innerRect.width]);
116
+ } else {
117
+ const categories = [...new Set(xValues.map(String))];
118
+ return tigercatCore.createPointScale(categories, [0, innerRect.width], { padding: 0.1 });
119
+ }
120
+ }, [xScaleProp, isXNumeric, xValues, innerRect.width]);
121
+ const resolvedYScale = react.useMemo(() => {
122
+ if (yScaleProp) return yScaleProp;
123
+ const extent = tigercatCore.getNumberExtent(yValues, { includeZero });
124
+ return tigercatCore.createLinearScale(extent, [innerRect.height, 0]);
125
+ }, [yScaleProp, yValues, includeZero, innerRect.height]);
126
+ const resolvedShowXAxis = showAxis && showXAxis;
127
+ const resolvedShowYAxis = showAxis && showYAxis;
128
+ const palette = react.useMemo(
129
+ () => colors && colors.length > 0 ? colors : [...tigercatCore.DEFAULT_CHART_COLORS],
130
+ [colors]
131
+ );
132
+ const seriesData = react.useMemo(
133
+ () => resolvedSeries.map((s, seriesIndex) => {
134
+ const color = s.color ?? palette[seriesIndex % palette.length];
135
+ const points = s.data.map((datum, pointIndex) => ({
136
+ x: resolvedXScale.map(datum.x),
137
+ y: resolvedYScale.map(datum.y),
138
+ datum,
139
+ pointIndex
140
+ }));
141
+ const linePath = tigercatCore.createLinePath(points, curve);
142
+ const opacity = tigercatCore.getChartElementOpacity(seriesIndex, activeIndex, {
143
+ activeOpacity,
144
+ inactiveOpacity
145
+ });
146
+ return {
147
+ series: s,
148
+ seriesIndex,
149
+ color,
150
+ linePath,
151
+ points,
152
+ opacity,
153
+ strokeWidth: s.strokeWidth ?? strokeWidth,
154
+ strokeDasharray: s.strokeDasharray,
155
+ showPoints: s.showPoints ?? showPoints,
156
+ pointSize: s.pointSize ?? pointSize,
157
+ pointColor: s.pointColor ?? color
158
+ };
159
+ }),
160
+ [
161
+ resolvedSeries,
162
+ palette,
163
+ resolvedXScale,
164
+ resolvedYScale,
165
+ curve,
166
+ activeIndex,
167
+ activeOpacity,
168
+ inactiveOpacity,
169
+ strokeWidth,
170
+ showPoints,
171
+ pointSize
172
+ ]
173
+ );
174
+ const legendItems = react.useMemo(
175
+ () => resolvedSeries.map((s, index) => ({
176
+ index,
177
+ label: legendFormatter ? legendFormatter(s, index) : s.name ?? `Series ${index + 1}`,
178
+ color: s.color ?? palette[index % palette.length],
179
+ active: activeIndex === null || activeIndex === index
180
+ })),
181
+ [resolvedSeries, legendFormatter, palette, activeIndex]
182
+ );
183
+ const formatTooltip = react.useCallback(
184
+ (datum, seriesIndex, _pointIndex, s) => {
185
+ if (tooltipFormatter) return tooltipFormatter(datum, seriesIndex, _pointIndex, s);
186
+ const seriesName = s?.name ?? `Series ${seriesIndex + 1}`;
187
+ const label = datum.label ?? String(datum.x);
188
+ return `${seriesName} \xB7 ${label}: ${datum.y}`;
189
+ },
190
+ [tooltipFormatter]
191
+ );
192
+ const tooltipContent = react.useMemo(() => {
193
+ if (!hoveredPointInfo) return "";
194
+ const { seriesIndex, pointIndex } = hoveredPointInfo;
195
+ const s = resolvedSeries[seriesIndex];
196
+ const datum = s?.data[pointIndex];
197
+ return datum ? formatTooltip(datum, seriesIndex, pointIndex, s) : "";
198
+ }, [hoveredPointInfo, resolvedSeries, formatTooltip]);
199
+ const handlePointMouseEnter = react.useCallback(
200
+ (seriesIndex, pointIndex, event) => {
201
+ setHoveredPointInfo({ seriesIndex, pointIndex });
202
+ setTooltipPosition({ x: event.clientX, y: event.clientY });
203
+ onPointHover?.(seriesIndex, pointIndex, resolvedSeries[seriesIndex]?.data[pointIndex]);
204
+ },
205
+ [onPointHover, resolvedSeries]
206
+ );
207
+ const handlePointMouseMove = react.useCallback((event) => {
208
+ setTooltipPosition({ x: event.clientX, y: event.clientY });
209
+ }, []);
210
+ const handlePointMouseLeave = react.useCallback(() => {
211
+ setHoveredPointInfo(null);
212
+ onPointHover?.(null, null, null);
213
+ }, [onPointHover]);
214
+ const handlePointClick = react.useCallback(
215
+ (seriesIndex, pointIndex) => {
216
+ onPointClick?.(seriesIndex, pointIndex, resolvedSeries[seriesIndex]?.data[pointIndex]);
217
+ handleSeriesSelect(seriesIndex);
218
+ },
219
+ [onPointClick, resolvedSeries, handleSeriesSelect]
220
+ );
221
+ const handleKeyDown = react.useCallback(
222
+ (event, seriesIndex) => {
223
+ if (!selectable) return;
224
+ if (event.key !== "Enter" && event.key !== " ") return;
225
+ event.preventDefault();
226
+ handleSeriesSelect(seriesIndex);
227
+ },
228
+ [selectable, handleSeriesSelect]
229
+ );
230
+ const chart = /* @__PURE__ */ jsxRuntime.jsxs(
231
+ chunkDUWAV47E_js.ChartCanvas,
232
+ {
233
+ width,
234
+ height,
235
+ padding,
236
+ title,
237
+ desc,
238
+ className: tigercatCore.classNames(className),
239
+ children: [
240
+ showGrid && /* @__PURE__ */ jsxRuntime.jsx(
241
+ chunk3QFHVAZT_js.ChartGrid,
242
+ {
243
+ xScale: resolvedXScale,
244
+ yScale: resolvedYScale,
245
+ show: "both",
246
+ xTicks,
247
+ yTicks,
248
+ xTickValues,
249
+ yTickValues,
250
+ lineStyle: gridLineStyle,
251
+ strokeWidth: gridStrokeWidth
252
+ }
253
+ ),
254
+ resolvedShowXAxis && /* @__PURE__ */ jsxRuntime.jsx(
255
+ chunkE5GD3H7L_js.ChartAxis,
256
+ {
257
+ scale: resolvedXScale,
258
+ orientation: "bottom",
259
+ y: innerRect.height,
260
+ ticks: xTicks,
261
+ tickValues: xTickValues,
262
+ tickFormat: xTickFormat,
263
+ label: xAxisLabel
264
+ }
265
+ ),
266
+ resolvedShowYAxis && /* @__PURE__ */ jsxRuntime.jsx(
267
+ chunkE5GD3H7L_js.ChartAxis,
268
+ {
269
+ scale: resolvedYScale,
270
+ orientation: "left",
271
+ ticks: yTicks,
272
+ tickValues: yTickValues,
273
+ tickFormat: yTickFormat,
274
+ label: yAxisLabel
275
+ }
276
+ ),
277
+ seriesData.map((sd) => /* @__PURE__ */ jsxRuntime.jsxs(
278
+ chunkAX5XRD2Q_js.ChartSeries,
279
+ {
280
+ data: sd.series.data,
281
+ name: sd.series.name,
282
+ type: "line",
283
+ opacity: sd.opacity,
284
+ className: tigercatCore.classNames(sd.series.className, (hoverable || selectable) && "cursor-pointer"),
285
+ onMouseEnter: (e) => handleSeriesHoverEnter(sd.seriesIndex, e),
286
+ onMouseLeave: handleSeriesHoverLeave,
287
+ onClick: () => handleSeriesSelect(sd.seriesIndex),
288
+ tabIndex: selectable ? 0 : void 0,
289
+ onKeyDown: (e) => handleKeyDown(e, sd.seriesIndex),
290
+ children: [
291
+ /* @__PURE__ */ jsxRuntime.jsx(
292
+ "path",
293
+ {
294
+ d: sd.linePath,
295
+ fill: "none",
296
+ stroke: sd.color,
297
+ strokeWidth: sd.strokeWidth,
298
+ strokeDasharray: sd.strokeDasharray,
299
+ strokeLinecap: "round",
300
+ strokeLinejoin: "round",
301
+ className: "transition-opacity duration-150",
302
+ "data-line-series": sd.seriesIndex
303
+ }
304
+ ),
305
+ sd.showPoints && sd.points.map((point) => /* @__PURE__ */ jsxRuntime.jsx(
306
+ "circle",
307
+ {
308
+ cx: point.x,
309
+ cy: point.y,
310
+ r: sd.pointSize,
311
+ fill: sd.pointColor,
312
+ className: "transition-all duration-150",
313
+ "data-point-index": point.pointIndex,
314
+ onMouseEnter: (e) => handlePointMouseEnter(sd.seriesIndex, point.pointIndex, e),
315
+ onMouseMove: handlePointMouseMove,
316
+ onMouseLeave: handlePointMouseLeave,
317
+ onClick: (e) => {
318
+ e.stopPropagation();
319
+ handlePointClick(sd.seriesIndex, point.pointIndex);
320
+ }
321
+ },
322
+ `point-${sd.seriesIndex}-${point.pointIndex}`
323
+ ))
324
+ ]
325
+ },
326
+ `series-${sd.seriesIndex}`
327
+ ))
328
+ ]
329
+ }
330
+ );
331
+ const tooltip = showTooltip && /* @__PURE__ */ jsxRuntime.jsx(
332
+ chunkM375I56K_js.ChartTooltip,
333
+ {
334
+ content: tooltipContent,
335
+ visible: hoveredPointInfo !== null && tooltipContent !== "",
336
+ x: tooltipPosition.x,
337
+ y: tooltipPosition.y
338
+ }
339
+ );
340
+ if (!showLegend) {
341
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-block relative", children: [
342
+ chart,
343
+ tooltip
344
+ ] });
345
+ }
346
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: wrapperClasses, children: [
347
+ chart,
348
+ /* @__PURE__ */ jsxRuntime.jsx(
349
+ chunk6PBNFLM7_js.ChartLegend,
350
+ {
351
+ items: legendItems,
352
+ position: legendPosition,
353
+ markerSize: legendMarkerSize,
354
+ gap: legendGap,
355
+ interactive: hoverable || selectable,
356
+ onItemClick: handleLegendClick,
357
+ onItemHover: handleLegendHover,
358
+ onItemLeave: handleLegendLeave
359
+ }
360
+ ),
361
+ tooltip
362
+ ] });
363
+ };
364
+ var LineChart_default = LineChart;
365
+
366
+ exports.LineChart = LineChart;
367
+ exports.LineChart_default = LineChart_default;
@@ -366,16 +366,9 @@ var Select = (props) => {
366
366
  {
367
367
  className: "w-5 h-5 text-[var(--tiger-select-check-icon,var(--tiger-primary,#2563eb))]",
368
368
  xmlns: "http://www.w3.org/2000/svg",
369
- viewBox: "0 0 20 20",
369
+ viewBox: tigercatCore.icon20ViewBox,
370
370
  fill: "currentColor",
371
- children: /* @__PURE__ */ jsxRuntime.jsx(
372
- "path",
373
- {
374
- fillRule: "evenodd",
375
- d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
376
- clipRule: "evenodd"
377
- }
378
- )
371
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: tigercatCore.checkSolidIcon20PathD, clipRule: "evenodd" })
379
372
  }
380
373
  )
381
374
  ] })
@@ -434,16 +427,9 @@ var Select = (props) => {
434
427
  {
435
428
  className: "w-4 h-4 text-[var(--tiger-select-icon,var(--tiger-text-muted,#9ca3af))] hover:text-[var(--tiger-select-icon-hover,var(--tiger-text-muted,#6b7280))]",
436
429
  xmlns: "http://www.w3.org/2000/svg",
437
- viewBox: "0 0 20 20",
430
+ viewBox: tigercatCore.icon20ViewBox,
438
431
  fill: "currentColor",
439
- children: /* @__PURE__ */ jsxRuntime.jsx(
440
- "path",
441
- {
442
- fillRule: "evenodd",
443
- d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
444
- clipRule: "evenodd"
445
- }
446
- )
432
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: tigercatCore.closeSolidIcon20PathD, clipRule: "evenodd" })
447
433
  }
448
434
  ) }),
449
435
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: tigercatCore.classNames("inline-flex", isOpen && "rotate-180"), children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -451,16 +437,9 @@ var Select = (props) => {
451
437
  {
452
438
  className: "w-5 h-5 text-[var(--tiger-select-icon,var(--tiger-text-muted,#9ca3af))] transition-transform",
453
439
  xmlns: "http://www.w3.org/2000/svg",
454
- viewBox: "0 0 20 20",
440
+ viewBox: tigercatCore.icon20ViewBox,
455
441
  fill: "currentColor",
456
- children: /* @__PURE__ */ jsxRuntime.jsx(
457
- "path",
458
- {
459
- fillRule: "evenodd",
460
- d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",
461
- clipRule: "evenodd"
462
- }
463
- )
442
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", d: tigercatCore.chevronDownSolidIcon20PathD, clipRule: "evenodd" })
464
443
  }
465
444
  ) })
466
445
  ] })
@@ -1,8 +1,8 @@
1
- import { useState, useRef, useCallback, useEffect } from 'react';
2
- import { classNames, getTooltipContainerClasses, getTooltipTriggerClasses, getDropdownMenuWrapperClasses, getTooltipContentClasses } from '@expcat/tigercat-core';
1
+ import { useFloating, useClickOutside, useEscapeKey } from './chunk-WLIFEALE.mjs';
2
+ import { useState, useRef, useCallback } from 'react';
3
+ import { classNames, getTooltipContainerClasses, getTooltipTriggerClasses, getTooltipContentClasses, getTransformOrigin } from '@expcat/tigercat-core';
3
4
  import { jsxs, jsx } from 'react/jsx-runtime';
4
5
 
5
- // src/components/Tooltip.tsx
6
6
  var tooltipIdCounter = 0;
7
7
  var createTooltipId = () => `tiger-tooltip-${++tooltipIdCounter}`;
8
8
  var Tooltip = ({
@@ -12,6 +12,7 @@ var Tooltip = ({
12
12
  trigger = "hover",
13
13
  placement = "top",
14
14
  disabled = false,
15
+ offset = 8,
15
16
  className,
16
17
  style,
17
18
  children,
@@ -23,6 +24,8 @@ var Tooltip = ({
23
24
  const [internalVisible, setInternalVisible] = useState(defaultVisible);
24
25
  const currentVisible = isControlled ? visible : internalVisible;
25
26
  const containerRef = useRef(null);
27
+ const triggerRef = useRef(null);
28
+ const floatingRef = useRef(null);
26
29
  const tooltipIdRef = useRef(null);
27
30
  if (!tooltipIdRef.current) {
28
31
  tooltipIdRef.current = createTooltipId();
@@ -30,6 +33,17 @@ var Tooltip = ({
30
33
  const tooltipId = tooltipIdRef.current;
31
34
  const tooltipContent = contentContent ?? content;
32
35
  const describedBy = tooltipContent != null ? tooltipId : void 0;
36
+ const {
37
+ x,
38
+ y,
39
+ placement: actualPlacement
40
+ } = useFloating({
41
+ referenceRef: triggerRef,
42
+ floatingRef,
43
+ enabled: currentVisible,
44
+ placement,
45
+ offset
46
+ });
33
47
  const setVisible = useCallback(
34
48
  (newVisible) => {
35
49
  if (disabled && newVisible) return;
@@ -60,35 +74,26 @@ var Tooltip = ({
60
74
  if (disabled || trigger !== "focus") return;
61
75
  setVisible(false);
62
76
  };
63
- useEffect(() => {
64
- if (!currentVisible || trigger !== "click") return;
65
- const handleClickOutside = (event) => {
66
- const target = event.target;
67
- if (!target) return;
68
- if (containerRef.current?.contains(target)) return;
69
- setVisible(false);
70
- };
71
- const timeoutId = setTimeout(() => {
72
- document.addEventListener("click", handleClickOutside);
73
- }, 0);
74
- return () => {
75
- clearTimeout(timeoutId);
76
- document.removeEventListener("click", handleClickOutside);
77
- };
78
- }, [currentVisible, trigger, setVisible]);
79
- useEffect(() => {
80
- if (!currentVisible) return;
81
- const handleKeyDown = (event) => {
82
- if (event.key !== "Escape") return;
83
- setVisible(false);
84
- };
85
- document.addEventListener("keydown", handleKeyDown);
86
- return () => document.removeEventListener("keydown", handleKeyDown);
87
- }, [currentVisible, setVisible]);
77
+ useClickOutside({
78
+ enabled: currentVisible && trigger === "click",
79
+ refs: [containerRef],
80
+ onOutsideClick: () => setVisible(false),
81
+ defer: true
82
+ });
83
+ useEscapeKey({
84
+ enabled: currentVisible,
85
+ onEscape: () => setVisible(false)
86
+ });
88
87
  const containerClasses = classNames(getTooltipContainerClasses(), className);
89
88
  const triggerClasses = getTooltipTriggerClasses(disabled);
90
- const contentWrapperClasses = getDropdownMenuWrapperClasses(currentVisible, placement);
91
89
  const contentClasses = getTooltipContentClasses();
90
+ const floatingStyles = {
91
+ position: "absolute",
92
+ left: x,
93
+ top: y,
94
+ transformOrigin: getTransformOrigin(actualPlacement),
95
+ zIndex: 1e3
96
+ };
92
97
  const triggerHandlers = {};
93
98
  if (trigger === "click") {
94
99
  triggerHandlers.onClick = handleTriggerClick;
@@ -103,8 +108,17 @@ var Tooltip = ({
103
108
  return null;
104
109
  }
105
110
  return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: containerClasses, style, ...divProps, children: [
106
- /* @__PURE__ */ jsx("div", { className: triggerClasses, "aria-describedby": describedBy, ...triggerHandlers, children }),
107
- /* @__PURE__ */ jsx("div", { className: contentWrapperClasses, hidden: !currentVisible, "aria-hidden": !currentVisible, children: /* @__PURE__ */ jsx("div", { id: tooltipId, role: "tooltip", className: contentClasses, children: tooltipContent }) })
111
+ /* @__PURE__ */ jsx(
112
+ "div",
113
+ {
114
+ ref: triggerRef,
115
+ className: triggerClasses,
116
+ "aria-describedby": describedBy,
117
+ ...triggerHandlers,
118
+ children
119
+ }
120
+ ),
121
+ currentVisible && /* @__PURE__ */ jsx("div", { ref: floatingRef, style: floatingStyles, "aria-hidden": false, children: /* @__PURE__ */ jsx("div", { id: tooltipId, role: "tooltip", className: contentClasses, children: tooltipContent }) })
108
122
  ] });
109
123
  };
110
124
 
@@ -93,7 +93,7 @@ var StepsItem = ({
93
93
  const contentClasses = tigercatCore.getStepContentClasses(stepsContext.direction, stepsContext.simple);
94
94
  const titleClasses = tigercatCore.getStepTitleClasses(stepStatus, stepsContext.size, isClickable);
95
95
  const descriptionClasses = tigercatCore.getStepDescriptionClasses(stepStatus, stepsContext.size);
96
- const handleClick = (event) => {
96
+ const handleClick = (_event) => {
97
97
  if (!isClickable) {
98
98
  return;
99
99
  }