@expcat/tigercat-react 0.1.8 → 0.2.10

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 (170) hide show
  1. package/README.md +59 -0
  2. package/dist/{chunk-TBIEWDY5.js → chunk-36RRHNZD.js} +13 -2
  3. package/dist/chunk-3CDAG4HD.mjs +151 -0
  4. package/dist/chunk-3QFHVAZT.js +68 -0
  5. package/dist/{chunk-ALP3KYYY.mjs → chunk-3XKBDV2Q.mjs} +5 -5
  6. package/dist/chunk-42UKIFFQ.js +278 -0
  7. package/dist/{chunk-K7ZMB2TH.mjs → chunk-5XKYWZZZ.mjs} +16 -22
  8. package/dist/chunk-677VSTPW.mjs +65 -0
  9. package/dist/chunk-6DYS4PJT.mjs +99 -0
  10. package/dist/chunk-6PBNFLM7.js +95 -0
  11. package/dist/{chunk-DCRVIDMY.mjs → chunk-6ZC7H22S.mjs} +1 -1
  12. package/dist/{chunk-WSCSDSV7.mjs → chunk-7IKJBQQV.mjs} +27 -5
  13. package/dist/{chunk-OTRGVENC.js → chunk-7SLNHUGJ.js} +1 -1
  14. package/dist/chunk-A2UW5OKX.mjs +415 -0
  15. package/dist/{chunk-NOOPXNR4.mjs → chunk-AGUPZEUL.mjs} +2 -3
  16. package/dist/chunk-AX5XRD2Q.js +35 -0
  17. package/dist/{chunk-BJU5N7WU.mjs → chunk-BAPR7UUR.mjs} +7 -7
  18. package/dist/chunk-CBALIFPW.mjs +275 -0
  19. package/dist/{chunk-BIWO5KB4.mjs → chunk-CJJ56NVL.mjs} +2 -2
  20. package/dist/{chunk-ENR3RIMM.js → chunk-DGBYGBLR.js} +72 -59
  21. package/dist/chunk-DUWAV47E.js +42 -0
  22. package/dist/chunk-E5GD3H7L.js +94 -0
  23. package/dist/chunk-EJLJYOO7.js +367 -0
  24. package/dist/{chunk-FQ6UHRAO.js → chunk-GQMYCYZ4.js} +6 -27
  25. package/dist/{chunk-G6FSHN2I.mjs → chunk-GW4EWT2K.mjs} +45 -31
  26. package/dist/{chunk-AQQRWISY.js → chunk-GXTBCX3M.js} +1 -1
  27. package/dist/{chunk-HQXZVTP4.mjs → chunk-HGF2EL25.mjs} +74 -61
  28. package/dist/{chunk-R5BQHZWB.js → chunk-HRYBEBZC.js} +15 -21
  29. package/dist/{chunk-PAD2DX5M.mjs → chunk-IIVRVCCP.mjs} +6 -24
  30. package/dist/chunk-IS467WAO.mjs +39 -0
  31. package/dist/{chunk-CTAMMQBC.mjs → chunk-IS7YOBR7.mjs} +16 -13
  32. package/dist/{chunk-ADOPAXPG.mjs → chunk-JI7SFMUT.mjs} +2 -2
  33. package/dist/chunk-KBGURVTD.mjs +282 -0
  34. package/dist/{chunk-O3EUFIOS.mjs → chunk-KELLYJZY.mjs} +36 -30
  35. package/dist/{chunk-XZDJ5FRB.js → chunk-KPZTGRNA.js} +5 -23
  36. package/dist/chunk-KQZ4F7FZ.js +153 -0
  37. package/dist/{chunk-XDKXL2BP.mjs → chunk-KV4LLPAY.mjs} +14 -3
  38. package/dist/{chunk-LNKI6HQ3.js → chunk-LIJLFLYE.js} +27 -5
  39. package/dist/chunk-LVC43YX2.mjs +72 -0
  40. package/dist/chunk-LZNG2HGC.mjs +227 -0
  41. package/dist/chunk-M375I56K.js +75 -0
  42. package/dist/{chunk-7OLWGHUR.mjs → chunk-MF3H7WWW.mjs} +13 -2
  43. package/dist/chunk-N32MAX4A.js +230 -0
  44. package/dist/{chunk-YYKJ63LD.mjs → chunk-NMDNLB3C.mjs} +7 -28
  45. package/dist/{chunk-77D7VQMG.js → chunk-OD2NNQD2.js} +2 -2
  46. package/dist/chunk-OONM7FO7.js +418 -0
  47. package/dist/{chunk-Q5Q7FG4U.js → chunk-OZLGNWET.js} +7 -7
  48. package/dist/{chunk-LAZGEMA2.mjs → chunk-P4EFJIXU.mjs} +1 -1
  49. package/dist/chunk-QI6WAP6Y.js +285 -0
  50. package/dist/{chunk-WK5HN4OH.js → chunk-QY6I7LU5.js} +43 -29
  51. package/dist/{chunk-KSW5JDIV.js → chunk-R7TOQU3U.js} +1 -1
  52. package/dist/chunk-RQSQXQN6.mjs +91 -0
  53. package/dist/chunk-SDLMB34Y.mjs +32 -0
  54. package/dist/chunk-UG3I4PCY.js +102 -0
  55. package/dist/chunk-VBSK4TGO.mjs +364 -0
  56. package/dist/{chunk-DZJUFU55.js → chunk-VXHBQTZS.js} +14 -11
  57. package/dist/chunk-WLIFEALE.mjs +111 -0
  58. package/dist/{chunk-AQ6DHCP6.js → chunk-XRFK2IXM.js} +4 -4
  59. package/dist/{chunk-5FRENLDC.js → chunk-Y2JOJ4D6.js} +14 -3
  60. package/dist/chunk-YER7IQF4.mjs +429 -0
  61. package/dist/{chunk-NI2WNZRT.js → chunk-YESS6YKC.js} +1 -2
  62. package/dist/chunk-Z6F67MJE.mjs +92 -0
  63. package/dist/{chunk-QORSSZX4.js → chunk-ZPFZMXA6.js} +34 -28
  64. package/dist/chunk-ZUUG3WOL.js +432 -0
  65. package/dist/chunk-ZYPEO2KY.js +115 -0
  66. package/dist/components/AreaChart.d.mts +19 -0
  67. package/dist/components/AreaChart.d.ts +19 -0
  68. package/dist/components/AreaChart.js +23 -0
  69. package/dist/components/AreaChart.mjs +8 -0
  70. package/dist/components/BarChart.d.mts +16 -0
  71. package/dist/components/BarChart.d.ts +16 -0
  72. package/dist/components/BarChart.js +23 -0
  73. package/dist/components/BarChart.mjs +8 -0
  74. package/dist/components/ChartAxis.d.mts +10 -0
  75. package/dist/components/ChartAxis.d.ts +10 -0
  76. package/dist/components/ChartAxis.js +16 -0
  77. package/dist/components/ChartAxis.mjs +1 -0
  78. package/dist/components/ChartCanvas.d.mts +9 -0
  79. package/dist/components/ChartCanvas.d.ts +9 -0
  80. package/dist/components/ChartCanvas.js +16 -0
  81. package/dist/components/ChartCanvas.mjs +1 -0
  82. package/dist/components/ChartGrid.d.mts +11 -0
  83. package/dist/components/ChartGrid.d.ts +11 -0
  84. package/dist/components/ChartGrid.js +16 -0
  85. package/dist/components/ChartGrid.mjs +1 -0
  86. package/dist/components/ChartLegend.d.mts +17 -0
  87. package/dist/components/ChartLegend.d.ts +17 -0
  88. package/dist/components/ChartLegend.js +16 -0
  89. package/dist/components/ChartLegend.mjs +1 -0
  90. package/dist/components/ChartSeries.d.mts +18 -0
  91. package/dist/components/ChartSeries.d.ts +18 -0
  92. package/dist/components/ChartSeries.js +16 -0
  93. package/dist/components/ChartSeries.mjs +1 -0
  94. package/dist/components/ChartTooltip.d.mts +12 -0
  95. package/dist/components/ChartTooltip.d.ts +12 -0
  96. package/dist/components/ChartTooltip.js +16 -0
  97. package/dist/components/ChartTooltip.mjs +1 -0
  98. package/dist/components/DonutChart.d.mts +14 -0
  99. package/dist/components/DonutChart.d.ts +14 -0
  100. package/dist/components/DonutChart.js +21 -0
  101. package/dist/components/DonutChart.mjs +6 -0
  102. package/dist/components/Drawer.js +3 -3
  103. package/dist/components/Drawer.mjs +2 -2
  104. package/dist/components/Dropdown.d.mts +12 -2
  105. package/dist/components/Dropdown.d.ts +12 -2
  106. package/dist/components/Dropdown.js +4 -4
  107. package/dist/components/Dropdown.mjs +2 -2
  108. package/dist/components/DropdownItem.js +4 -4
  109. package/dist/components/DropdownItem.mjs +3 -3
  110. package/dist/components/Icon.js +2 -2
  111. package/dist/components/Icon.mjs +1 -1
  112. package/dist/components/LineChart.d.mts +19 -0
  113. package/dist/components/LineChart.d.ts +19 -0
  114. package/dist/components/LineChart.js +23 -0
  115. package/dist/components/LineChart.mjs +8 -0
  116. package/dist/components/List.js +3 -3
  117. package/dist/components/List.mjs +2 -2
  118. package/dist/components/Message.js +4 -4
  119. package/dist/components/Message.mjs +1 -1
  120. package/dist/components/Modal.js +3 -3
  121. package/dist/components/Modal.mjs +2 -2
  122. package/dist/components/Notification.js +4 -4
  123. package/dist/components/Notification.mjs +1 -1
  124. package/dist/components/Pagination.d.mts +5 -1
  125. package/dist/components/Pagination.d.ts +5 -1
  126. package/dist/components/Pagination.js +3 -3
  127. package/dist/components/Pagination.mjs +1 -1
  128. package/dist/components/PieChart.d.mts +14 -0
  129. package/dist/components/PieChart.d.ts +14 -0
  130. package/dist/components/PieChart.js +20 -0
  131. package/dist/components/PieChart.mjs +5 -0
  132. package/dist/components/Popconfirm.d.mts +12 -2
  133. package/dist/components/Popconfirm.d.ts +12 -2
  134. package/dist/components/Popconfirm.js +3 -2
  135. package/dist/components/Popconfirm.mjs +2 -1
  136. package/dist/components/Popover.d.mts +12 -2
  137. package/dist/components/Popover.d.ts +12 -2
  138. package/dist/components/Popover.js +3 -2
  139. package/dist/components/Popover.mjs +2 -1
  140. package/dist/components/RadarChart.d.mts +20 -0
  141. package/dist/components/RadarChart.d.ts +20 -0
  142. package/dist/components/RadarChart.js +20 -0
  143. package/dist/components/RadarChart.mjs +5 -0
  144. package/dist/components/ScatterChart.d.mts +32 -0
  145. package/dist/components/ScatterChart.d.ts +32 -0
  146. package/dist/components/ScatterChart.js +23 -0
  147. package/dist/components/ScatterChart.mjs +8 -0
  148. package/dist/components/Select.js +2 -2
  149. package/dist/components/Select.mjs +1 -1
  150. package/dist/components/Slider.js +2 -2
  151. package/dist/components/Slider.mjs +1 -1
  152. package/dist/components/Space.js +2 -2
  153. package/dist/components/Space.mjs +1 -1
  154. package/dist/components/Steps.js +3 -3
  155. package/dist/components/Steps.mjs +1 -1
  156. package/dist/components/StepsItem.js +2 -2
  157. package/dist/components/StepsItem.mjs +1 -1
  158. package/dist/components/Table.js +2 -2
  159. package/dist/components/Table.mjs +1 -1
  160. package/dist/components/Tooltip.d.mts +12 -2
  161. package/dist/components/Tooltip.d.ts +12 -2
  162. package/dist/components/Tooltip.js +3 -2
  163. package/dist/components/Tooltip.mjs +2 -1
  164. package/dist/index.d.mts +97 -1
  165. package/dist/index.d.ts +97 -1
  166. package/dist/index.js +178 -108
  167. package/dist/index.mjs +41 -27
  168. package/package.json +6 -2
  169. package/dist/chunk-NEULKOYJ.js +0 -48
  170. package/dist/chunk-ZO4XVOHU.mjs +0 -45
@@ -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"
@@ -0,0 +1,65 @@
1
+ import { useMemo } from 'react';
2
+ import { getChartGridLineDasharray, getChartAxisTicks, classNames, chartGridLineClasses } from '@expcat/tigercat-core';
3
+ import { jsxs, jsx } from 'react/jsx-runtime';
4
+
5
+ // src/components/ChartGrid.tsx
6
+ var ChartGrid = ({
7
+ xScale,
8
+ yScale,
9
+ show = "both",
10
+ xTicks = 5,
11
+ yTicks = 5,
12
+ xTickValues,
13
+ yTickValues,
14
+ lineStyle = "solid",
15
+ strokeWidth = 1,
16
+ x = 0,
17
+ y = 0,
18
+ className,
19
+ ...props
20
+ }) => {
21
+ const dasharray = useMemo(() => getChartGridLineDasharray(lineStyle), [lineStyle]);
22
+ const resolvedXTicks = useMemo(() => {
23
+ if (!xScale) return [];
24
+ return getChartAxisTicks(xScale, { tickCount: xTicks, tickValues: xTickValues });
25
+ }, [xScale, xTicks, xTickValues]);
26
+ const resolvedYTicks = useMemo(() => {
27
+ if (!yScale) return [];
28
+ return getChartAxisTicks(yScale, { tickCount: yTicks, tickValues: yTickValues });
29
+ }, [yScale, yTicks, yTickValues]);
30
+ const shouldRenderX = show === "both" || show === "x";
31
+ const shouldRenderY = show === "both" || show === "y";
32
+ const xRange = xScale?.range;
33
+ const yRange = yScale?.range;
34
+ return /* @__PURE__ */ jsxs("g", { ...props, className: classNames(className), transform: `translate(${x}, ${y})`, children: [
35
+ shouldRenderX && xScale && yRange ? resolvedXTicks.map((tick) => /* @__PURE__ */ jsx(
36
+ "line",
37
+ {
38
+ x1: tick.position,
39
+ y1: yRange[0],
40
+ x2: tick.position,
41
+ y2: yRange[1],
42
+ className: chartGridLineClasses,
43
+ strokeWidth,
44
+ strokeDasharray: dasharray
45
+ },
46
+ `x-${tick.value}`
47
+ )) : null,
48
+ shouldRenderY && yScale && xRange ? resolvedYTicks.map((tick) => /* @__PURE__ */ jsx(
49
+ "line",
50
+ {
51
+ x1: xRange[0],
52
+ y1: tick.position,
53
+ x2: xRange[1],
54
+ y2: tick.position,
55
+ className: chartGridLineClasses,
56
+ strokeWidth,
57
+ strokeDasharray: dasharray
58
+ },
59
+ `y-${tick.value}`
60
+ )) : null
61
+ ] });
62
+ };
63
+ var ChartGrid_default = ChartGrid;
64
+
65
+ export { ChartGrid, ChartGrid_default };
@@ -0,0 +1,99 @@
1
+ import { PieChart } from './chunk-LZNG2HGC.mjs';
2
+ import { useMemo } from 'react';
3
+ import { getChartInnerRect, classNames } from '@expcat/tigercat-core';
4
+ import { jsx } from 'react/jsx-runtime';
5
+
6
+ var DonutChart = ({
7
+ width = 320,
8
+ height = 200,
9
+ padding = 24,
10
+ data,
11
+ innerRadius,
12
+ innerRadiusRatio = 0.6,
13
+ outerRadius,
14
+ startAngle = 0,
15
+ endAngle = Math.PI * 2,
16
+ padAngle = 0,
17
+ colors,
18
+ showLabels = false,
19
+ labelFormatter,
20
+ // Interaction props
21
+ hoverable = false,
22
+ hoveredIndex,
23
+ activeOpacity = 1,
24
+ inactiveOpacity = 0.25,
25
+ selectable = false,
26
+ selectedIndex,
27
+ // Legend props
28
+ showLegend = false,
29
+ legendPosition = "bottom",
30
+ legendMarkerSize = 10,
31
+ legendGap = 8,
32
+ // Tooltip props
33
+ showTooltip = true,
34
+ tooltipFormatter,
35
+ // Accessibility
36
+ title,
37
+ desc,
38
+ className,
39
+ // Callbacks
40
+ onHoveredIndexChange,
41
+ onSelectedIndexChange,
42
+ onSliceClick,
43
+ onSliceHover
44
+ }) => {
45
+ const innerRect = useMemo(
46
+ () => getChartInnerRect(width, height, padding),
47
+ [width, height, padding]
48
+ );
49
+ const resolvedOuterRadius = useMemo(() => {
50
+ if (typeof outerRadius === "number") return Math.max(0, outerRadius);
51
+ return Math.max(0, Math.min(innerRect.width, innerRect.height) / 2);
52
+ }, [outerRadius, innerRect.width, innerRect.height]);
53
+ const resolvedInnerRadius = useMemo(() => {
54
+ if (typeof innerRadius === "number") {
55
+ return Math.min(Math.max(0, innerRadius), resolvedOuterRadius);
56
+ }
57
+ const ratio = Math.min(Math.max(innerRadiusRatio ?? 0.6, 0), 1);
58
+ return resolvedOuterRadius * ratio;
59
+ }, [innerRadius, innerRadiusRatio, resolvedOuterRadius]);
60
+ return /* @__PURE__ */ jsx(
61
+ PieChart,
62
+ {
63
+ width,
64
+ height,
65
+ padding,
66
+ data,
67
+ innerRadius: resolvedInnerRadius,
68
+ outerRadius,
69
+ startAngle,
70
+ endAngle,
71
+ padAngle,
72
+ colors,
73
+ showLabels,
74
+ labelFormatter,
75
+ hoverable,
76
+ hoveredIndex,
77
+ activeOpacity,
78
+ inactiveOpacity,
79
+ selectable,
80
+ selectedIndex,
81
+ showLegend,
82
+ legendPosition,
83
+ legendMarkerSize,
84
+ legendGap,
85
+ showTooltip,
86
+ tooltipFormatter,
87
+ title,
88
+ desc,
89
+ className: classNames(className),
90
+ onHoveredIndexChange,
91
+ onSelectedIndexChange,
92
+ onSliceClick,
93
+ onSliceHover
94
+ }
95
+ );
96
+ };
97
+ var DonutChart_default = DonutChart;
98
+
99
+ export { DonutChart, DonutChart_default };
@@ -0,0 +1,95 @@
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/ChartLegend.tsx
8
+ var ChartLegend = ({
9
+ items,
10
+ position = "bottom",
11
+ markerSize = 10,
12
+ gap = 8,
13
+ interactive = false,
14
+ className,
15
+ onItemClick,
16
+ onItemHover,
17
+ onItemLeave
18
+ }) => {
19
+ const containerClasses = react.useMemo(
20
+ () => tigercatCore.classNames(
21
+ "flex flex-wrap",
22
+ position === "right" || position === "left" ? "flex-col gap-2" : "flex-row gap-3",
23
+ className
24
+ ),
25
+ [position, className]
26
+ );
27
+ const handleClick = react.useCallback(
28
+ (item) => {
29
+ if (!interactive) return;
30
+ onItemClick?.(item.index, item);
31
+ },
32
+ [interactive, onItemClick]
33
+ );
34
+ const handleHover = react.useCallback(
35
+ (item) => {
36
+ if (!interactive) return;
37
+ onItemHover?.(item.index, item);
38
+ },
39
+ [interactive, onItemHover]
40
+ );
41
+ const handleLeave = react.useCallback(() => {
42
+ if (!interactive) return;
43
+ onItemLeave?.();
44
+ }, [interactive, onItemLeave]);
45
+ return /* @__PURE__ */ jsxRuntime.jsx(
46
+ "div",
47
+ {
48
+ className: containerClasses,
49
+ role: "list",
50
+ "aria-label": "Chart legend",
51
+ "data-chart-legend": "true",
52
+ children: items.map((item) => {
53
+ const ItemComponent = interactive ? "button" : "div";
54
+ return /* @__PURE__ */ jsxRuntime.jsxs(
55
+ ItemComponent,
56
+ {
57
+ type: interactive ? "button" : void 0,
58
+ className: tigercatCore.classNames(
59
+ "flex items-center gap-2 text-sm",
60
+ "text-[color:var(--tiger-text-secondary,#6b7280)]",
61
+ interactive ? "cursor-pointer hover:text-[color:var(--tiger-text,#374151)] transition-colors" : "cursor-default",
62
+ item.active === false ? "opacity-50" : void 0
63
+ ),
64
+ role: "listitem",
65
+ "data-legend-item": "true",
66
+ onClick: interactive ? () => handleClick(item) : void 0,
67
+ onMouseEnter: interactive ? () => handleHover(item) : void 0,
68
+ onMouseLeave: interactive ? handleLeave : void 0,
69
+ children: [
70
+ /* @__PURE__ */ jsxRuntime.jsx(
71
+ "span",
72
+ {
73
+ className: "inline-block rounded-full shrink-0",
74
+ style: {
75
+ width: `${markerSize}px`,
76
+ height: `${markerSize}px`,
77
+ backgroundColor: item.color
78
+ },
79
+ "aria-hidden": "true",
80
+ "data-legend-marker": "true"
81
+ }
82
+ ),
83
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { marginRight: `${gap}px` }, children: item.label })
84
+ ]
85
+ },
86
+ `legend-${item.index}`
87
+ );
88
+ })
89
+ }
90
+ );
91
+ };
92
+ var ChartLegend_default = ChartLegend;
93
+
94
+ exports.ChartLegend = ChartLegend;
95
+ exports.ChartLegend_default = ChartLegend_default;
@@ -1,4 +1,4 @@
1
- import { DropdownContext } from './chunk-WSCSDSV7.mjs';
1
+ import { DropdownContext } from './chunk-7IKJBQQV.mjs';
2
2
  import { useContext } from 'react';
3
3
  import { classNames, getDropdownItemClasses } from '@expcat/tigercat-core';
4
4
  import { jsx } from 'react/jsx-runtime';
@@ -1,13 +1,14 @@
1
- import { useClickOutside, useEscapeKey } from './chunk-ZO4XVOHU.mjs';
1
+ import { useClickOutside, useEscapeKey, useFloating } from './chunk-WLIFEALE.mjs';
2
2
  import { DropdownMenu } from './chunk-SIVJX7VU.mjs';
3
- import React, { createContext, useState, useRef, useCallback, useEffect } from 'react';
4
- import { classNames, getDropdownContainerClasses, getDropdownTriggerClasses, getDropdownMenuWrapperClasses } from '@expcat/tigercat-core';
3
+ import React, { createContext, useState, useRef, useCallback, useEffect, useMemo } from 'react';
4
+ import { classNames, getDropdownContainerClasses, getDropdownTriggerClasses, getTransformOrigin } from '@expcat/tigercat-core';
5
5
  import { jsx, jsxs } from 'react/jsx-runtime';
6
6
 
7
7
  var DropdownContext = createContext(null);
8
8
  var Dropdown = ({
9
9
  trigger = "hover",
10
- placement = "bottom-start",
10
+ placement: initialPlacement = "bottom-start",
11
+ offset = 4,
11
12
  disabled = false,
12
13
  visible: controlledVisible,
13
14
  defaultVisible = false,
@@ -22,6 +23,8 @@ var Dropdown = ({
22
23
  const [internalVisible, setInternalVisible] = useState(defaultVisible);
23
24
  const visible = controlledVisible !== void 0 ? controlledVisible : internalVisible;
24
25
  const containerRef = useRef(null);
26
+ const triggerRef = useRef(null);
27
+ const floatingRef = useRef(null);
25
28
  const hoverTimerRef = useRef(null);
26
29
  const setVisible = useCallback(
27
30
  (newVisible) => {
@@ -69,6 +72,13 @@ var Dropdown = ({
69
72
  enabled: visible,
70
73
  onEscape: () => setVisible(false)
71
74
  });
75
+ const { x, y, placement } = useFloating({
76
+ referenceRef: triggerRef,
77
+ floatingRef,
78
+ enabled: visible,
79
+ placement: initialPlacement,
80
+ offset
81
+ });
72
82
  useEffect(() => {
73
83
  return () => {
74
84
  if (hoverTimerRef.current) {
@@ -82,7 +92,16 @@ var Dropdown = ({
82
92
  className
83
93
  );
84
94
  const triggerClasses = getDropdownTriggerClasses(disabled);
85
- const menuWrapperClasses = getDropdownMenuWrapperClasses(visible, placement);
95
+ const menuWrapperClasses = "absolute z-50";
96
+ const menuWrapperStyles = useMemo(
97
+ () => ({
98
+ position: "absolute",
99
+ left: x,
100
+ top: y,
101
+ transformOrigin: getTransformOrigin(placement)
102
+ }),
103
+ [x, y, placement]
104
+ );
86
105
  const contextValue = {
87
106
  closeOnClick,
88
107
  handleItemClick
@@ -118,6 +137,7 @@ var Dropdown = ({
118
137
  /* @__PURE__ */ jsx(
119
138
  "div",
120
139
  {
140
+ ref: triggerRef,
121
141
  className: triggerClasses,
122
142
  onClick: handleClick,
123
143
  onMouseEnter: handleMouseEnter,
@@ -130,7 +150,9 @@ var Dropdown = ({
130
150
  /* @__PURE__ */ jsx(
131
151
  "div",
132
152
  {
153
+ ref: floatingRef,
133
154
  className: menuWrapperClasses,
155
+ style: menuWrapperStyles,
134
156
  hidden: !visible,
135
157
  onMouseEnter: handleMouseEnter,
136
158
  onMouseLeave: handleMouseLeave,
@@ -69,7 +69,7 @@ var NotificationItem = ({ notification: notification2, onClose }) => {
69
69
  const iconClass = tigercatCore.classNames(tigercatCore.notificationIconClasses, colorScheme.icon);
70
70
  const handleClose = () => {
71
71
  setIsVisible(false);
72
- setTimeout(() => onClose(notification2.id), 300);
72
+ setTimeout(() => onClose(notification2.id), tigercatCore.ANIMATION_DURATION_MS);
73
73
  };
74
74
  const a11yRole = notification2.type === "error" ? "alert" : "status";
75
75
  const ariaLive = notification2.type === "error" ? "assertive" : "polite";