@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
@@ -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');
@@ -91,7 +91,17 @@ var Modal = ({
91
91
  if (visible) return;
92
92
  tigercatCore.restoreFocus(previousActiveElementRef.current);
93
93
  }, [visible]);
94
- chunkNEULKOYJ_js.useEscapeKey({ enabled: visible, onEscape: handleClose });
94
+ chunkZYPEO2KY_js.useEscapeKey({ enabled: visible, onEscape: handleClose });
95
+ const handleKeyDown = React.useCallback((event) => {
96
+ if (event.key === "Tab" && dialogRef.current) {
97
+ const focusables = tigercatCore.getFocusableElements(dialogRef.current);
98
+ const result = tigercatCore.getFocusTrapNavigation(event.nativeEvent, focusables, document.activeElement);
99
+ if (result.shouldHandle && result.next) {
100
+ event.preventDefault();
101
+ result.next.focus();
102
+ }
103
+ }
104
+ }, []);
95
105
  const CloseIcon = /* @__PURE__ */ jsxRuntime.jsx(
96
106
  "svg",
97
107
  {
@@ -145,6 +155,7 @@ var Modal = ({
145
155
  "aria-labelledby": ariaLabelledby,
146
156
  tabIndex: -1,
147
157
  ref: dialogRef,
158
+ onKeyDown: handleKeyDown,
148
159
  "data-tiger-modal": "",
149
160
  children: [
150
161
  (title || titleContent || closable) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: tigercatCore.modalHeaderClasses, children: [
@@ -0,0 +1,151 @@
1
+ import { useState, useMemo, useCallback } from 'react';
2
+ import { getChartElementOpacity, classNames } from '@expcat/tigercat-core';
3
+
4
+ // src/hooks/useChartInteraction.ts
5
+ function useChartInteraction(options) {
6
+ const {
7
+ hoverable,
8
+ hoveredIndexProp,
9
+ selectable,
10
+ selectedIndexProp,
11
+ activeOpacity,
12
+ inactiveOpacity,
13
+ legendPosition = "bottom",
14
+ onHoveredIndexChange,
15
+ onSelectedIndexChange,
16
+ getData,
17
+ callbacks
18
+ } = options;
19
+ const [localHoveredIndex, setLocalHoveredIndex] = useState(null);
20
+ const [localSelectedIndex, setLocalSelectedIndex] = useState(null);
21
+ const [tooltipPosition, setTooltipPosition] = useState({ x: 0, y: 0 });
22
+ const resolvedHoveredIndex = hoveredIndexProp !== void 0 ? hoveredIndexProp : localHoveredIndex;
23
+ const resolvedSelectedIndex = selectedIndexProp !== void 0 ? selectedIndexProp : localSelectedIndex;
24
+ const activeIndex = useMemo(() => {
25
+ if (resolvedSelectedIndex !== null) return resolvedSelectedIndex;
26
+ if (hoverable && resolvedHoveredIndex !== null) return resolvedHoveredIndex;
27
+ return null;
28
+ }, [resolvedSelectedIndex, hoverable, resolvedHoveredIndex]);
29
+ const getElementOpacity = useCallback(
30
+ (index) => {
31
+ return getChartElementOpacity(index, activeIndex, {
32
+ activeOpacity,
33
+ inactiveOpacity
34
+ });
35
+ },
36
+ [activeIndex, activeOpacity, inactiveOpacity]
37
+ );
38
+ const handleMouseEnter = useCallback(
39
+ (index, event) => {
40
+ if (!hoverable) return;
41
+ if (hoveredIndexProp === void 0) {
42
+ setLocalHoveredIndex(index);
43
+ }
44
+ setTooltipPosition({ x: event.clientX, y: event.clientY });
45
+ onHoveredIndexChange?.(index);
46
+ if (callbacks?.onHover && getData) {
47
+ callbacks.onHover(index, getData(index) ?? null);
48
+ }
49
+ },
50
+ [hoverable, hoveredIndexProp, onHoveredIndexChange, callbacks, getData]
51
+ );
52
+ const handleMouseMove = useCallback((event) => {
53
+ setTooltipPosition({ x: event.clientX, y: event.clientY });
54
+ }, []);
55
+ const handleMouseLeave = useCallback(() => {
56
+ if (!hoverable) return;
57
+ if (hoveredIndexProp === void 0) {
58
+ setLocalHoveredIndex(null);
59
+ }
60
+ onHoveredIndexChange?.(null);
61
+ callbacks?.onHover?.(null, null);
62
+ }, [hoverable, hoveredIndexProp, onHoveredIndexChange, callbacks]);
63
+ const handleClick = useCallback(
64
+ (index) => {
65
+ if (!selectable) return;
66
+ const nextIndex = resolvedSelectedIndex === index ? null : index;
67
+ if (selectedIndexProp === void 0) {
68
+ setLocalSelectedIndex(nextIndex);
69
+ }
70
+ onSelectedIndexChange?.(nextIndex);
71
+ if (callbacks?.onClick && getData) {
72
+ const datum = getData(index);
73
+ if (datum) callbacks.onClick(index, datum);
74
+ }
75
+ },
76
+ [
77
+ selectable,
78
+ resolvedSelectedIndex,
79
+ selectedIndexProp,
80
+ onSelectedIndexChange,
81
+ callbacks,
82
+ getData
83
+ ]
84
+ );
85
+ const handleKeyDown = useCallback(
86
+ (event, index) => {
87
+ if (!selectable) return;
88
+ if (event.key !== "Enter" && event.key !== " ") return;
89
+ event.preventDefault();
90
+ handleClick(index);
91
+ },
92
+ [selectable, handleClick]
93
+ );
94
+ const handleLegendClick = useCallback(
95
+ (index) => {
96
+ handleClick(index);
97
+ },
98
+ [handleClick]
99
+ );
100
+ const handleLegendHover = useCallback(
101
+ (index) => {
102
+ if (!hoverable) return;
103
+ if (hoveredIndexProp === void 0) {
104
+ setLocalHoveredIndex(index);
105
+ }
106
+ onHoveredIndexChange?.(index);
107
+ },
108
+ [hoverable, hoveredIndexProp, onHoveredIndexChange]
109
+ );
110
+ const handleLegendLeave = useCallback(() => {
111
+ handleMouseLeave();
112
+ }, [handleMouseLeave]);
113
+ const wrapperClasses = useMemo(() => {
114
+ return classNames(
115
+ "inline-flex",
116
+ legendPosition === "right" ? "flex-row items-start gap-4" : legendPosition === "left" ? "flex-row-reverse items-start gap-4" : legendPosition === "top" ? "flex-col-reverse gap-2" : "flex-col gap-2"
117
+ );
118
+ }, [legendPosition]);
119
+ const createLegendItems = useCallback(
120
+ (items, palette, labelFormatter) => {
121
+ return items.map((item, index) => ({
122
+ index,
123
+ label: labelFormatter ? labelFormatter(item, index) : item.label ?? String(item.x ?? index),
124
+ color: item.color ?? palette[index % palette.length],
125
+ active: activeIndex === null || activeIndex === index
126
+ }));
127
+ },
128
+ [activeIndex]
129
+ );
130
+ return {
131
+ localHoveredIndex,
132
+ localSelectedIndex,
133
+ tooltipPosition,
134
+ resolvedHoveredIndex,
135
+ resolvedSelectedIndex,
136
+ activeIndex,
137
+ getElementOpacity,
138
+ handleMouseEnter,
139
+ handleMouseMove,
140
+ handleMouseLeave,
141
+ handleClick,
142
+ handleKeyDown,
143
+ handleLegendClick,
144
+ handleLegendHover,
145
+ handleLegendLeave,
146
+ wrapperClasses,
147
+ createLegendItems
148
+ };
149
+ }
150
+
151
+ export { useChartInteraction };
@@ -0,0 +1,68 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+ var tigercatCore = require('@expcat/tigercat-core');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+
7
+ // src/components/ChartGrid.tsx
8
+ var ChartGrid = ({
9
+ xScale,
10
+ yScale,
11
+ show = "both",
12
+ xTicks = 5,
13
+ yTicks = 5,
14
+ xTickValues,
15
+ yTickValues,
16
+ lineStyle = "solid",
17
+ strokeWidth = 1,
18
+ x = 0,
19
+ y = 0,
20
+ className,
21
+ ...props
22
+ }) => {
23
+ const dasharray = react.useMemo(() => tigercatCore.getChartGridLineDasharray(lineStyle), [lineStyle]);
24
+ const resolvedXTicks = react.useMemo(() => {
25
+ if (!xScale) return [];
26
+ return tigercatCore.getChartAxisTicks(xScale, { tickCount: xTicks, tickValues: xTickValues });
27
+ }, [xScale, xTicks, xTickValues]);
28
+ const resolvedYTicks = react.useMemo(() => {
29
+ if (!yScale) return [];
30
+ return tigercatCore.getChartAxisTicks(yScale, { tickCount: yTicks, tickValues: yTickValues });
31
+ }, [yScale, yTicks, yTickValues]);
32
+ const shouldRenderX = show === "both" || show === "x";
33
+ const shouldRenderY = show === "both" || show === "y";
34
+ const xRange = xScale?.range;
35
+ const yRange = yScale?.range;
36
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { ...props, className: tigercatCore.classNames(className), transform: `translate(${x}, ${y})`, children: [
37
+ shouldRenderX && xScale && yRange ? resolvedXTicks.map((tick) => /* @__PURE__ */ jsxRuntime.jsx(
38
+ "line",
39
+ {
40
+ x1: tick.position,
41
+ y1: yRange[0],
42
+ x2: tick.position,
43
+ y2: yRange[1],
44
+ className: tigercatCore.chartGridLineClasses,
45
+ strokeWidth,
46
+ strokeDasharray: dasharray
47
+ },
48
+ `x-${tick.value}`
49
+ )) : null,
50
+ shouldRenderY && yScale && xRange ? resolvedYTicks.map((tick) => /* @__PURE__ */ jsxRuntime.jsx(
51
+ "line",
52
+ {
53
+ x1: xRange[0],
54
+ y1: tick.position,
55
+ x2: xRange[1],
56
+ y2: tick.position,
57
+ className: tigercatCore.chartGridLineClasses,
58
+ strokeWidth,
59
+ strokeDasharray: dasharray
60
+ },
61
+ `y-${tick.value}`
62
+ )) : null
63
+ ] });
64
+ };
65
+ var ChartGrid_default = ChartGrid;
66
+
67
+ exports.ChartGrid = ChartGrid;
68
+ exports.ChartGrid_default = ChartGrid_default;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { classNames, iconWrapperClasses, iconSvgBaseClasses, iconSizeClasses } from '@expcat/tigercat-core';
2
+ import { classNames, iconWrapperClasses, SVG_DEFAULT_STROKE, SVG_DEFAULT_FILL, SVG_DEFAULT_VIEWBOX_24, SVG_DEFAULT_XMLNS, iconSvgBaseClasses, iconSizeClasses } from '@expcat/tigercat-core';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
5
5
  // src/components/Icon.tsx
@@ -23,10 +23,10 @@ var Icon = ({
23
23
  return React.cloneElement(child, {
24
24
  ...svgProps,
25
25
  className: classNames(iconSvgBaseClasses, iconSizeClasses[size], svgProps.className),
26
- xmlns: svgProps.xmlns ?? "http://www.w3.org/2000/svg",
27
- viewBox: svgProps.viewBox ?? "0 0 24 24",
28
- fill: svgProps.fill ?? "none",
29
- stroke: svgProps.stroke ?? "currentColor",
26
+ xmlns: svgProps.xmlns ?? SVG_DEFAULT_XMLNS,
27
+ viewBox: svgProps.viewBox ?? SVG_DEFAULT_VIEWBOX_24,
28
+ fill: svgProps.fill ?? SVG_DEFAULT_FILL,
29
+ stroke: svgProps.stroke ?? SVG_DEFAULT_STROKE,
30
30
  strokeWidth: svgProps.strokeWidth ?? 2,
31
31
  strokeLinecap: svgProps.strokeLinecap ?? "round",
32
32
  strokeLinejoin: svgProps.strokeLinejoin ?? "round"
@@ -0,0 +1,278 @@
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 ScatterChart = ({
15
+ width = 320,
16
+ height = 200,
17
+ padding = 24,
18
+ data,
19
+ xScale,
20
+ yScale,
21
+ pointSize = 4,
22
+ pointColor = "var(--tiger-primary,#2563eb)",
23
+ pointOpacity,
24
+ showGrid = true,
25
+ showAxis = true,
26
+ showXAxis = true,
27
+ showYAxis = true,
28
+ includeZero = false,
29
+ xAxisLabel,
30
+ yAxisLabel,
31
+ xTicks = 5,
32
+ yTicks = 5,
33
+ xTickValues,
34
+ yTickValues,
35
+ xTickFormat,
36
+ yTickFormat,
37
+ gridLineStyle = "solid",
38
+ gridStrokeWidth = 1,
39
+ // Interaction props
40
+ hoverable = false,
41
+ hoveredIndex: hoveredIndexProp,
42
+ onHoveredIndexChange,
43
+ activeOpacity = 1,
44
+ inactiveOpacity = 0.25,
45
+ selectable = false,
46
+ selectedIndex: selectedIndexProp,
47
+ onSelectedIndexChange,
48
+ onPointClick,
49
+ onPointHover,
50
+ // Legend props
51
+ showLegend = false,
52
+ legendPosition = "bottom",
53
+ legendMarkerSize = 10,
54
+ legendGap = 8,
55
+ legendFormatter,
56
+ // Tooltip props
57
+ showTooltip = true,
58
+ tooltipFormatter,
59
+ // Other
60
+ colors,
61
+ title,
62
+ desc,
63
+ className
64
+ }) => {
65
+ const {
66
+ tooltipPosition,
67
+ resolvedHoveredIndex,
68
+ activeIndex,
69
+ handleMouseEnter,
70
+ handleMouseMove,
71
+ handleMouseLeave,
72
+ handleClick,
73
+ handleKeyDown,
74
+ handleLegendClick,
75
+ handleLegendHover,
76
+ handleLegendLeave,
77
+ wrapperClasses
78
+ } = chunkKQZ4F7FZ_js.useChartInteraction({
79
+ hoverable,
80
+ hoveredIndexProp,
81
+ selectable,
82
+ selectedIndexProp,
83
+ activeOpacity,
84
+ inactiveOpacity,
85
+ legendPosition,
86
+ getData: (index) => data[index],
87
+ onHoveredIndexChange: (index) => {
88
+ onHoveredIndexChange?.(index);
89
+ onPointHover?.(index, index !== null ? data[index] : null);
90
+ },
91
+ onSelectedIndexChange,
92
+ callbacks: {
93
+ onClick: onPointClick
94
+ }
95
+ });
96
+ const innerRect = react.useMemo(
97
+ () => tigercatCore.getChartInnerRect(width, height, padding),
98
+ [width, height, padding]
99
+ );
100
+ const xValues = react.useMemo(() => data.map((item) => item.x), [data]);
101
+ const yValues = react.useMemo(() => data.map((item) => item.y), [data]);
102
+ const resolvedXScale = react.useMemo(() => {
103
+ if (xScale) return xScale;
104
+ const extent = tigercatCore.getNumberExtent(xValues, { includeZero });
105
+ return tigercatCore.createLinearScale(extent, [0, innerRect.width]);
106
+ }, [xScale, xValues, includeZero, innerRect.width]);
107
+ const resolvedYScale = react.useMemo(() => {
108
+ if (yScale) return yScale;
109
+ const extent = tigercatCore.getNumberExtent(yValues, { includeZero });
110
+ return tigercatCore.createLinearScale(extent, [innerRect.height, 0]);
111
+ }, [yScale, yValues, includeZero, innerRect.height]);
112
+ const palette = react.useMemo(
113
+ () => colors && colors.length > 0 ? colors : pointColor ? [pointColor] : [...tigercatCore.DEFAULT_CHART_COLORS],
114
+ [colors, pointColor]
115
+ );
116
+ const points = react.useMemo(
117
+ () => data.map((item, index) => {
118
+ const color = item.color ?? palette[index % palette.length];
119
+ const opacity = tigercatCore.getChartElementOpacity(index, activeIndex, {
120
+ activeOpacity,
121
+ inactiveOpacity
122
+ });
123
+ return {
124
+ cx: resolvedXScale.map(item.x),
125
+ cy: resolvedYScale.map(item.y),
126
+ r: item.size ?? pointSize,
127
+ color,
128
+ opacity: pointOpacity ?? opacity,
129
+ datum: item
130
+ };
131
+ }),
132
+ [
133
+ data,
134
+ palette,
135
+ activeIndex,
136
+ activeOpacity,
137
+ inactiveOpacity,
138
+ resolvedXScale,
139
+ resolvedYScale,
140
+ pointSize,
141
+ pointOpacity
142
+ ]
143
+ );
144
+ const legendItems = react.useMemo(
145
+ () => data.map((item, index) => ({
146
+ index,
147
+ label: legendFormatter ? legendFormatter(item, index) : item.label ?? `(${item.x}, ${item.y})`,
148
+ color: item.color ?? palette[index % palette.length],
149
+ active: activeIndex === null || activeIndex === index
150
+ })),
151
+ [data, legendFormatter, palette, activeIndex]
152
+ );
153
+ const formatTooltip = react.useCallback(
154
+ (datum, index) => {
155
+ if (tooltipFormatter) return tooltipFormatter(datum, index);
156
+ const label = datum.label ?? `Point ${index + 1}`;
157
+ return `${label}: (${datum.x}, ${datum.y})`;
158
+ },
159
+ [tooltipFormatter]
160
+ );
161
+ const tooltipContent = react.useMemo(() => {
162
+ if (resolvedHoveredIndex === null) return "";
163
+ const datum = data[resolvedHoveredIndex];
164
+ return datum ? formatTooltip(datum, resolvedHoveredIndex) : "";
165
+ }, [resolvedHoveredIndex, data, formatTooltip]);
166
+ const shouldShowXAxis = showAxis && showXAxis;
167
+ const shouldShowYAxis = showAxis && showYAxis;
168
+ const chart = /* @__PURE__ */ jsxRuntime.jsxs(
169
+ chunkDUWAV47E_js.ChartCanvas,
170
+ {
171
+ width,
172
+ height,
173
+ padding,
174
+ title,
175
+ desc,
176
+ className: tigercatCore.classNames(className),
177
+ children: [
178
+ showGrid && /* @__PURE__ */ jsxRuntime.jsx(
179
+ chunk3QFHVAZT_js.ChartGrid,
180
+ {
181
+ xScale: resolvedXScale,
182
+ yScale: resolvedYScale,
183
+ show: "both",
184
+ xTicks,
185
+ yTicks,
186
+ xTickValues,
187
+ yTickValues,
188
+ lineStyle: gridLineStyle,
189
+ strokeWidth: gridStrokeWidth
190
+ }
191
+ ),
192
+ shouldShowXAxis && /* @__PURE__ */ jsxRuntime.jsx(
193
+ chunkE5GD3H7L_js.ChartAxis,
194
+ {
195
+ scale: resolvedXScale,
196
+ orientation: "bottom",
197
+ y: innerRect.height,
198
+ ticks: xTicks,
199
+ tickValues: xTickValues,
200
+ tickFormat: xTickFormat,
201
+ label: xAxisLabel
202
+ }
203
+ ),
204
+ shouldShowYAxis && /* @__PURE__ */ jsxRuntime.jsx(
205
+ chunkE5GD3H7L_js.ChartAxis,
206
+ {
207
+ scale: resolvedYScale,
208
+ orientation: "left",
209
+ ticks: yTicks,
210
+ tickValues: yTickValues,
211
+ tickFormat: yTickFormat,
212
+ label: yAxisLabel
213
+ }
214
+ ),
215
+ /* @__PURE__ */ jsxRuntime.jsx(chunkAX5XRD2Q_js.ChartSeries, { data, type: "scatter", children: points.map((point, index) => /* @__PURE__ */ jsxRuntime.jsx(
216
+ "circle",
217
+ {
218
+ cx: point.cx,
219
+ cy: point.cy,
220
+ r: point.r,
221
+ fill: point.color,
222
+ opacity: point.opacity,
223
+ className: tigercatCore.classNames(
224
+ "transition-opacity duration-150",
225
+ (hoverable || selectable) && "cursor-pointer"
226
+ ),
227
+ tabIndex: selectable ? 0 : void 0,
228
+ role: selectable ? "button" : "img",
229
+ "aria-label": point.datum.label ?? `Point ${index + 1}: (${point.datum.x}, ${point.datum.y})`,
230
+ "data-point-index": index,
231
+ onMouseEnter: (e) => handleMouseEnter(index, e),
232
+ onMouseMove: handleMouseMove,
233
+ onMouseLeave: handleMouseLeave,
234
+ onClick: () => handleClick(index),
235
+ onKeyDown: (e) => handleKeyDown(e, index)
236
+ },
237
+ `point-${index}`
238
+ )) })
239
+ ]
240
+ }
241
+ );
242
+ const tooltip = showTooltip && hoverable && /* @__PURE__ */ jsxRuntime.jsx(
243
+ chunkM375I56K_js.ChartTooltip,
244
+ {
245
+ content: tooltipContent,
246
+ visible: resolvedHoveredIndex !== null && tooltipContent !== "",
247
+ x: tooltipPosition.x,
248
+ y: tooltipPosition.y
249
+ }
250
+ );
251
+ if (!showLegend) {
252
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-block relative", children: [
253
+ chart,
254
+ tooltip
255
+ ] });
256
+ }
257
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: wrapperClasses, children: [
258
+ chart,
259
+ /* @__PURE__ */ jsxRuntime.jsx(
260
+ chunk6PBNFLM7_js.ChartLegend,
261
+ {
262
+ items: legendItems,
263
+ position: legendPosition,
264
+ markerSize: legendMarkerSize,
265
+ gap: legendGap,
266
+ interactive: hoverable || selectable,
267
+ onItemClick: handleLegendClick,
268
+ onItemHover: handleLegendHover,
269
+ onItemLeave: handleLegendLeave
270
+ }
271
+ ),
272
+ tooltip
273
+ ] });
274
+ };
275
+ var ScatterChart_default = ScatterChart;
276
+
277
+ exports.ScatterChart = ScatterChart;
278
+ exports.ScatterChart_default = ScatterChart_default;
@@ -1,5 +1,5 @@
1
1
  import { useState, useEffect, useMemo, useCallback } from 'react';
2
- import { getSpinnerSVG, getFixedColumnOffsets, filterData, sortData, paginateData, getRowKey, calculatePagination, getTableHeaderClasses, getCheckboxCellClasses, classNames, getTableHeaderCellClasses, tableEmptyStateClasses, getTableCellClasses, getTableRowClasses, tablePaginationContainerClasses, getTableWrapperClasses, tableBaseClasses, tableLoadingOverlayClasses, getSortIconClasses, getLoadingOverlaySpinnerClasses } from '@expcat/tigercat-core';
2
+ import { getSpinnerSVG, getFixedColumnOffsets, filterData, sortData, paginateData, getRowKey, calculatePagination, getTableHeaderClasses, getCheckboxCellClasses, classNames, getTableHeaderCellClasses, tableEmptyStateClasses, getTableCellClasses, getTableRowClasses, getSimplePaginationContainerClasses, getSimplePaginationTotalClasses, getSimplePaginationControlsClasses, getSimplePaginationSelectClasses, getSimplePaginationButtonsWrapperClasses, getSimplePaginationButtonClasses, getSimplePaginationPageIndicatorClasses, getTableWrapperClasses, tableBaseClasses, tableLoadingOverlayClasses, icon24ViewBox, lockClosedIcon24PathD, lockOpenIcon24PathD, icon16ViewBox, getSortIconClasses, sortAscIcon16PathD, sortDescIcon16PathD, sortBothIcon16PathD, getLoadingOverlaySpinnerClasses } from '@expcat/tigercat-core';
3
3
  import { jsx, jsxs } from 'react/jsx-runtime';
4
4
 
5
5
  // src/components/Table.tsx
@@ -12,9 +12,9 @@ var SortIcon = ({ direction }) => {
12
12
  className: getSortIconClasses(true),
13
13
  width: "16",
14
14
  height: "16",
15
- viewBox: "0 0 16 16",
15
+ viewBox: icon16ViewBox,
16
16
  fill: "currentColor",
17
- children: /* @__PURE__ */ jsx("path", { d: "M8 3l4 4H4l4-4z" })
17
+ children: /* @__PURE__ */ jsx("path", { d: sortAscIcon16PathD })
18
18
  }
19
19
  );
20
20
  }
@@ -25,9 +25,9 @@ var SortIcon = ({ direction }) => {
25
25
  className: getSortIconClasses(true),
26
26
  width: "16",
27
27
  height: "16",
28
- viewBox: "0 0 16 16",
28
+ viewBox: icon16ViewBox,
29
29
  fill: "currentColor",
30
- children: /* @__PURE__ */ jsx("path", { d: "M8 13l-4-4h8l-4 4z" })
30
+ children: /* @__PURE__ */ jsx("path", { d: sortDescIcon16PathD })
31
31
  }
32
32
  );
33
33
  }
@@ -37,14 +37,14 @@ var SortIcon = ({ direction }) => {
37
37
  className: getSortIconClasses(false),
38
38
  width: "16",
39
39
  height: "16",
40
- viewBox: "0 0 16 16",
40
+ viewBox: icon16ViewBox,
41
41
  fill: "currentColor",
42
- children: /* @__PURE__ */ jsx("path", { d: "M8 3l4 4H4l4-4zM8 13l-4-4h8l-4 4z" })
42
+ children: /* @__PURE__ */ jsx("path", { d: sortBothIcon16PathD })
43
43
  }
44
44
  );
45
45
  };
46
46
  var LockIcon = ({ locked }) => {
47
- return /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: locked ? /* @__PURE__ */ jsx("path", { d: "M17 8h-1V6a4 4 0 10-8 0v2H7a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2V10a2 2 0 00-2-2zm-7-2a2 2 0 114 0v2h-4V6z" }) : /* @__PURE__ */ jsx("path", { d: "M17 8h-1V6a4 4 0 00-7.75-1.41 1 1 0 101.9.62A2 2 0 0114 6v2H7a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2V10a2 2 0 00-2-2zm0 12H7V10h10v10z" }) });
47
+ return /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: icon24ViewBox, fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: locked ? lockClosedIcon24PathD : lockOpenIcon24PathD }) });
48
48
  };
49
49
  var LoadingSpinner = () => /* @__PURE__ */ jsx(
50
50
  "svg",
@@ -586,13 +586,13 @@ function Table({
586
586
  const { totalPages, startIndex, endIndex, hasNext, hasPrev } = paginationInfo;
587
587
  const total = processedData.length;
588
588
  const paginationConfig2 = pagination;
589
- return /* @__PURE__ */ jsxs("div", { className: tablePaginationContainerClasses, children: [
590
- paginationConfig2.showTotal !== false && /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-700", children: paginationConfig2.totalText ? paginationConfig2.totalText(total, [startIndex, endIndex]) : `Showing ${startIndex} to ${endIndex} of ${total} results` }),
591
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
589
+ return /* @__PURE__ */ jsxs("div", { className: getSimplePaginationContainerClasses(), children: [
590
+ paginationConfig2.showTotal !== false && /* @__PURE__ */ jsx("div", { className: getSimplePaginationTotalClasses(), children: paginationConfig2.totalText ? paginationConfig2.totalText(total, [startIndex, endIndex]) : `Showing ${startIndex} to ${endIndex} of ${total} results` }),
591
+ /* @__PURE__ */ jsxs("div", { className: getSimplePaginationControlsClasses(), children: [
592
592
  paginationConfig2.showSizeChanger !== false && /* @__PURE__ */ jsx(
593
593
  "select",
594
594
  {
595
- className: "px-3 py-1 border border-gray-300 rounded text-sm",
595
+ className: getSimplePaginationSelectClasses(),
596
596
  value: currentPageSize,
597
597
  onChange: (e) => handlePageSizeChange(Number(e.target.value)),
598
598
  children: (paginationConfig2.pageSizeOptions || [10, 20, 50, 100]).map((size2) => /* @__PURE__ */ jsxs("option", { value: size2, children: [
@@ -601,20 +601,17 @@ function Table({
601
601
  ] }, size2))
602
602
  }
603
603
  ),
604
- /* @__PURE__ */ jsxs("div", { className: "flex gap-1", children: [
604
+ /* @__PURE__ */ jsxs("div", { className: getSimplePaginationButtonsWrapperClasses(), children: [
605
605
  /* @__PURE__ */ jsx(
606
606
  "button",
607
607
  {
608
- className: classNames(
609
- "px-3 py-1 border border-gray-300 rounded text-sm",
610
- hasPrev ? "hover:bg-gray-50 text-gray-700" : "text-gray-400 cursor-not-allowed"
611
- ),
608
+ className: getSimplePaginationButtonClasses(!hasPrev),
612
609
  disabled: !hasPrev,
613
610
  onClick: () => handlePageChange(currentPage - 1),
614
611
  children: "Previous"
615
612
  }
616
613
  ),
617
- /* @__PURE__ */ jsxs("span", { className: "px-3 py-1 text-sm text-gray-700", children: [
614
+ /* @__PURE__ */ jsxs("span", { className: getSimplePaginationPageIndicatorClasses(), children: [
618
615
  "Page ",
619
616
  currentPage,
620
617
  " of ",
@@ -623,10 +620,7 @@ function Table({
623
620
  /* @__PURE__ */ jsx(
624
621
  "button",
625
622
  {
626
- className: classNames(
627
- "px-3 py-1 border border-gray-300 rounded text-sm",
628
- hasNext ? "hover:bg-gray-50 text-gray-700" : "text-gray-400 cursor-not-allowed"
629
- ),
623
+ className: getSimplePaginationButtonClasses(!hasNext),
630
624
  disabled: !hasNext,
631
625
  onClick: () => handlePageChange(currentPage + 1),
632
626
  children: "Next"