@coinbase/cds-web-visualization 3.3.0 → 3.4.0-beta.2

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 (204) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dts/chart/CartesianChart.d.ts +36 -0
  3. package/dts/chart/CartesianChart.d.ts.map +1 -0
  4. package/dts/chart/ChartProvider.d.ts +6 -0
  5. package/dts/chart/ChartProvider.d.ts.map +1 -0
  6. package/dts/chart/Path.d.ts +34 -0
  7. package/dts/chart/Path.d.ts.map +1 -0
  8. package/dts/chart/PeriodSelector.d.ts +61 -0
  9. package/dts/chart/PeriodSelector.d.ts.map +1 -0
  10. package/dts/chart/Point.d.ts +153 -0
  11. package/dts/chart/Point.d.ts.map +1 -0
  12. package/dts/chart/area/Area.d.ts +48 -0
  13. package/dts/chart/area/Area.d.ts.map +1 -0
  14. package/dts/chart/area/AreaChart.d.ts +52 -0
  15. package/dts/chart/area/AreaChart.d.ts.map +1 -0
  16. package/dts/chart/area/DottedArea.d.ts +68 -0
  17. package/dts/chart/area/DottedArea.d.ts.map +1 -0
  18. package/dts/chart/area/GradientArea.d.ts +30 -0
  19. package/dts/chart/area/GradientArea.d.ts.map +1 -0
  20. package/dts/chart/area/SolidArea.d.ts +8 -0
  21. package/dts/chart/area/SolidArea.d.ts.map +1 -0
  22. package/dts/chart/area/index.d.ts +6 -0
  23. package/dts/chart/area/index.d.ts.map +1 -0
  24. package/dts/chart/axis/Axis.d.ts +208 -0
  25. package/dts/chart/axis/Axis.d.ts.map +1 -0
  26. package/dts/chart/axis/XAxis.d.ts +16 -0
  27. package/dts/chart/axis/XAxis.d.ts.map +1 -0
  28. package/dts/chart/axis/YAxis.d.ts +21 -0
  29. package/dts/chart/axis/YAxis.d.ts.map +1 -0
  30. package/dts/chart/axis/index.d.ts +4 -0
  31. package/dts/chart/axis/index.d.ts.map +1 -0
  32. package/dts/chart/bar/Bar.d.ts +91 -0
  33. package/dts/chart/bar/Bar.d.ts.map +1 -0
  34. package/dts/chart/bar/BarChart.d.ts +53 -0
  35. package/dts/chart/bar/BarChart.d.ts.map +1 -0
  36. package/dts/chart/bar/BarPlot.d.ts +29 -0
  37. package/dts/chart/bar/BarPlot.d.ts.map +1 -0
  38. package/dts/chart/bar/BarStack.d.ts +111 -0
  39. package/dts/chart/bar/BarStack.d.ts.map +1 -0
  40. package/dts/chart/bar/BarStackGroup.d.ts +35 -0
  41. package/dts/chart/bar/BarStackGroup.d.ts.map +1 -0
  42. package/dts/chart/bar/DefaultBar.d.ts +17 -0
  43. package/dts/chart/bar/DefaultBar.d.ts.map +1 -0
  44. package/dts/chart/bar/DefaultBarStack.d.ts +16 -0
  45. package/dts/chart/bar/DefaultBarStack.d.ts.map +1 -0
  46. package/dts/chart/bar/index.d.ts +8 -0
  47. package/dts/chart/bar/index.d.ts.map +1 -0
  48. package/dts/chart/index.d.ts +13 -0
  49. package/dts/chart/index.d.ts.map +1 -0
  50. package/dts/chart/line/DottedLine.d.ts +14 -0
  51. package/dts/chart/line/DottedLine.d.ts.map +1 -0
  52. package/dts/chart/line/GradientLine.d.ts +42 -0
  53. package/dts/chart/line/GradientLine.d.ts.map +1 -0
  54. package/dts/chart/line/Line.d.ts +80 -0
  55. package/dts/chart/line/Line.d.ts.map +1 -0
  56. package/dts/chart/line/LineChart.d.ts +59 -0
  57. package/dts/chart/line/LineChart.d.ts.map +1 -0
  58. package/dts/chart/line/ReferenceLine.d.ts +131 -0
  59. package/dts/chart/line/ReferenceLine.d.ts.map +1 -0
  60. package/dts/chart/line/SolidLine.d.ts +14 -0
  61. package/dts/chart/line/SolidLine.d.ts.map +1 -0
  62. package/dts/chart/line/index.d.ts +7 -0
  63. package/dts/chart/line/index.d.ts.map +1 -0
  64. package/dts/chart/scrubber/Scrubber.d.ts +149 -0
  65. package/dts/chart/scrubber/Scrubber.d.ts.map +1 -0
  66. package/dts/chart/scrubber/ScrubberBeacon.d.ts +93 -0
  67. package/dts/chart/scrubber/ScrubberBeacon.d.ts.map +1 -0
  68. package/dts/chart/scrubber/ScrubberBeaconLabel.d.ts +7 -0
  69. package/dts/chart/scrubber/ScrubberBeaconLabel.d.ts.map +1 -0
  70. package/dts/chart/scrubber/ScrubberProvider.d.ts +17 -0
  71. package/dts/chart/scrubber/ScrubberProvider.d.ts.map +1 -0
  72. package/dts/chart/scrubber/index.d.ts +2 -0
  73. package/dts/chart/scrubber/index.d.ts.map +1 -0
  74. package/dts/chart/text/ChartText.d.ts +114 -0
  75. package/dts/chart/text/ChartText.d.ts.map +1 -0
  76. package/dts/chart/text/SmartChartTextGroup.d.ts +55 -0
  77. package/dts/chart/text/SmartChartTextGroup.d.ts.map +1 -0
  78. package/dts/chart/text/index.d.ts +3 -0
  79. package/dts/chart/text/index.d.ts.map +1 -0
  80. package/dts/chart/utils/axis.d.ts +342 -0
  81. package/dts/chart/utils/axis.d.ts.map +1 -0
  82. package/dts/chart/utils/bar.d.ts +20 -0
  83. package/dts/chart/utils/bar.d.ts.map +1 -0
  84. package/dts/chart/utils/chart.d.ts +97 -0
  85. package/dts/chart/utils/chart.d.ts.map +1 -0
  86. package/dts/chart/utils/context.d.ts +95 -0
  87. package/dts/chart/utils/context.d.ts.map +1 -0
  88. package/dts/chart/utils/index.d.ts +8 -0
  89. package/dts/chart/utils/index.d.ts.map +1 -0
  90. package/dts/chart/utils/path.d.ts +107 -0
  91. package/dts/chart/utils/path.d.ts.map +1 -0
  92. package/dts/chart/utils/point.d.ts +75 -0
  93. package/dts/chart/utils/point.d.ts.map +1 -0
  94. package/dts/chart/utils/scale.d.ts +43 -0
  95. package/dts/chart/utils/scale.d.ts.map +1 -0
  96. package/dts/index.d.ts +2 -1
  97. package/dts/index.d.ts.map +1 -1
  98. package/dts/sparkline/Counter.d.ts +7 -2
  99. package/dts/sparkline/Sparkline.d.ts +61 -16
  100. package/dts/sparkline/Sparkline.d.ts.map +1 -1
  101. package/dts/sparkline/SparklineArea.d.ts +12 -4
  102. package/dts/sparkline/SparklineArea.d.ts.map +1 -1
  103. package/dts/sparkline/SparklineAreaPattern.d.ts +12 -4
  104. package/dts/sparkline/SparklineAreaPattern.d.ts.map +1 -1
  105. package/dts/sparkline/SparklineGradient.d.ts +21 -10
  106. package/dts/sparkline/SparklineGradient.d.ts.map +1 -1
  107. package/dts/sparkline/SparklinePath.d.ts +8 -6
  108. package/dts/sparkline/__figma__/Sparkline.figma.d.ts +1 -1
  109. package/dts/sparkline/generateSparklineWithId.d.ts +8 -2
  110. package/dts/sparkline/generateSparklineWithId.d.ts.map +1 -1
  111. package/dts/sparkline/index.d.ts +1 -1
  112. package/dts/sparkline/sparkline-interactive/InnerSparklineInteractiveProvider.d.ts +9 -5
  113. package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts +168 -118
  114. package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts.map +1 -1
  115. package/dts/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.d.ts +22 -9
  116. package/dts/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.d.ts.map +1 -1
  117. package/dts/sparkline/sparkline-interactive/SparklineInteractiveHoverDate.d.ts +4 -2
  118. package/dts/sparkline/sparkline-interactive/SparklineInteractiveHoverPrice.d.ts +4 -2
  119. package/dts/sparkline/sparkline-interactive/SparklineInteractiveLineVertical.d.ts +5 -3
  120. package/dts/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.d.ts +11 -6
  121. package/dts/sparkline/sparkline-interactive/SparklineInteractivePaths.d.ts +21 -7
  122. package/dts/sparkline/sparkline-interactive/SparklineInteractivePaths.d.ts.map +1 -1
  123. package/dts/sparkline/sparkline-interactive/SparklineInteractivePeriodSelector.d.ts +21 -16
  124. package/dts/sparkline/sparkline-interactive/SparklineInteractiveProvider.d.ts +17 -12
  125. package/dts/sparkline/sparkline-interactive/SparklineInteractiveScrubHandler.d.ts +23 -10
  126. package/dts/sparkline/sparkline-interactive/SparklineInteractiveScrubProvider.d.ts +12 -12
  127. package/dts/sparkline/sparkline-interactive/SparklineInteractiveTimeseriesPaths.d.ts +22 -14
  128. package/dts/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.d.ts +1 -1
  129. package/dts/sparkline/sparkline-interactive/fade.d.ts +1 -1
  130. package/dts/sparkline/sparkline-interactive/useSparklineInteractiveConstants.d.ts +11 -11
  131. package/dts/sparkline/sparkline-interactive-header/SparklineInteractiveHeader.d.ts +101 -93
  132. package/dts/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.d.ts +1 -1
  133. package/esm/chart/CartesianChart.css +1 -0
  134. package/esm/chart/CartesianChart.js +258 -0
  135. package/esm/chart/ChartProvider.js +10 -0
  136. package/esm/chart/Path.js +89 -0
  137. package/esm/chart/PeriodSelector.css +1 -0
  138. package/esm/chart/PeriodSelector.js +126 -0
  139. package/esm/chart/Point.css +2 -0
  140. package/esm/chart/Point.js +171 -0
  141. package/esm/chart/area/Area.js +85 -0
  142. package/esm/chart/area/AreaChart.js +164 -0
  143. package/esm/chart/area/DottedArea.js +141 -0
  144. package/esm/chart/area/GradientArea.js +111 -0
  145. package/esm/chart/area/SolidArea.js +29 -0
  146. package/esm/chart/area/index.js +7 -0
  147. package/esm/chart/axis/Axis.js +46 -0
  148. package/esm/chart/axis/XAxis.css +2 -0
  149. package/esm/chart/axis/XAxis.js +195 -0
  150. package/esm/chart/axis/YAxis.css +2 -0
  151. package/esm/chart/axis/YAxis.js +183 -0
  152. package/esm/chart/axis/index.js +5 -0
  153. package/esm/chart/bar/Bar.js +59 -0
  154. package/esm/chart/bar/BarChart.js +147 -0
  155. package/esm/chart/bar/BarPlot.js +96 -0
  156. package/esm/chart/bar/BarStack.js +519 -0
  157. package/esm/chart/bar/BarStackGroup.js +96 -0
  158. package/esm/chart/bar/DefaultBar.js +64 -0
  159. package/esm/chart/bar/DefaultBarStack.js +60 -0
  160. package/esm/chart/bar/index.js +9 -0
  161. package/esm/chart/index.js +14 -0
  162. package/esm/chart/line/DottedLine.js +38 -0
  163. package/esm/chart/line/GradientLine.js +58 -0
  164. package/esm/chart/line/Line.js +159 -0
  165. package/esm/chart/line/LineChart.js +120 -0
  166. package/esm/chart/line/ReferenceLine.js +142 -0
  167. package/esm/chart/line/SolidLine.js +34 -0
  168. package/esm/chart/line/index.js +8 -0
  169. package/esm/chart/scrubber/Scrubber.js +483 -0
  170. package/esm/chart/scrubber/ScrubberBeacon.js +195 -0
  171. package/esm/chart/scrubber/ScrubberBeaconLabel.js +33 -0
  172. package/esm/chart/scrubber/ScrubberProvider.js +228 -0
  173. package/esm/chart/scrubber/index.js +2 -0
  174. package/esm/chart/text/ChartText.js +236 -0
  175. package/esm/chart/text/SmartChartTextGroup.js +226 -0
  176. package/esm/chart/text/index.js +4 -0
  177. package/esm/chart/utils/axis.js +593 -0
  178. package/esm/chart/utils/bar.js +24 -0
  179. package/esm/chart/utils/chart.js +229 -0
  180. package/esm/chart/utils/context.js +15 -0
  181. package/esm/chart/utils/index.js +9 -0
  182. package/esm/chart/utils/path.js +204 -0
  183. package/esm/chart/utils/point.js +118 -0
  184. package/esm/chart/utils/scale.js +48 -0
  185. package/esm/index.js +4 -1
  186. package/esm/sparkline/Sparkline.js +129 -15
  187. package/esm/sparkline/SparklineArea.js +7 -2
  188. package/esm/sparkline/SparklineAreaPattern.js +4 -2
  189. package/esm/sparkline/SparklineGradient.js +16 -58
  190. package/esm/sparkline/generateSparklineWithId.js +3 -2
  191. package/esm/sparkline/sparkline-interactive/SparklineInteractive.js +5 -1
  192. package/esm/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.js +5 -2
  193. package/esm/sparkline/sparkline-interactive/SparklineInteractivePaths.js +4 -0
  194. package/package.json +15 -11
  195. package/dts/sparkline/sparkline-interactive/__stories__/SparklineInteractive.stories.d.ts +0 -374
  196. package/dts/sparkline/sparkline-interactive/__stories__/SparklineInteractive.stories.d.ts.map +0 -1
  197. package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractive.test.d.ts +0 -2
  198. package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractive.test.d.ts.map +0 -1
  199. package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractivePeriodSelector.test.d.ts +0 -2
  200. package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractivePeriodSelector.test.d.ts.map +0 -1
  201. package/dts/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.d.ts +0 -87
  202. package/dts/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.d.ts.map +0 -1
  203. package/dts/sparkline/sparkline-interactive-header/__tests__/SparklineInteractiveHeader.test.d.ts +0 -2
  204. package/dts/sparkline/sparkline-interactive-header/__tests__/SparklineInteractiveHeader.test.d.ts.map +0 -1
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { type ScrubberContextValue } from '../utils';
3
+ export type ScrubberProviderProps = Partial<
4
+ Pick<ScrubberContextValue, 'enableScrubbing' | 'onScrubberPositionChange'>
5
+ > & {
6
+ children: React.ReactNode;
7
+ /**
8
+ * A reference to the root SVG element, where interaction event handlers will be attached.
9
+ */
10
+ svgRef: React.RefObject<SVGSVGElement> | null;
11
+ };
12
+ /**
13
+ * A component which encapsulates the ScrubberContext.
14
+ * It depends on a ChartContext in order to provide accurate mouse tracking.
15
+ */
16
+ export declare const ScrubberProvider: React.FC<ScrubberProviderProps>;
17
+ //# sourceMappingURL=ScrubberProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScrubberProvider.d.ts","sourceRoot":"","sources":["../../../src/chart/scrubber/ScrubberProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAGzE,OAAO,EAAuC,KAAK,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAE1F,MAAM,MAAM,qBAAqB,GAAG,OAAO,CACzC,IAAI,CAAC,oBAAoB,EAAE,iBAAiB,GAAG,0BAA0B,CAAC,CAC3E,GAAG;IACF,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;CAC/C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAsQ5D,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './Scrubber';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/chart/scrubber/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC"}
@@ -0,0 +1,114 @@
1
+ import React from 'react';
2
+ import type { ElevationLevels, Rect, SharedProps } from '@coinbase/cds-common/types';
3
+ import { type BoxProps } from '@coinbase/cds-web/layout';
4
+ import { type ChartInset } from '../utils';
5
+ type ValidChartTextChildElements =
6
+ | React.ReactElement<React.SVGProps<SVGTSpanElement>, 'tspan'>
7
+ | React.ReactElement<React.SVGProps<SVGTextPathElement>, 'textPath'>;
8
+ /**
9
+ * The supported content types for ChartText.
10
+ */
11
+ export type ChartTextChildren =
12
+ | string
13
+ | number
14
+ | null
15
+ | undefined
16
+ | ValidChartTextChildElements
17
+ | ValidChartTextChildElements[];
18
+ /**
19
+ * Horizontal alignment options for chart text.
20
+ */
21
+ export type TextHorizontalAlignment = 'left' | 'center' | 'right';
22
+ /**
23
+ * Vertical alignment options for chart text.
24
+ */
25
+ export type TextVerticalAlignment = 'top' | 'middle' | 'bottom';
26
+ export type ChartTextProps = SharedProps &
27
+ Pick<BoxProps<'g'>, 'font' | 'fontFamily' | 'fontSize' | 'fontWeight' | 'opacity'> & {
28
+ /**
29
+ * The text color.
30
+ * @default 'var(--color-fgMuted)'
31
+ */
32
+ color?: string;
33
+ /**
34
+ * The background color of the text's background rectangle.
35
+ * @default 'transparent' if not elevated, 'var(--color-bg)' if elevated
36
+ */
37
+ background?: string;
38
+ /**
39
+ * The desired x offset in SVG pixels.
40
+ */
41
+ dx?: number;
42
+ /**
43
+ * The desired y offset in SVG pixels.
44
+ */
45
+ dy?: number;
46
+ /**
47
+ * The elevation for the background.
48
+ */
49
+ elevation?: ElevationLevels;
50
+ /**
51
+ * The text content to display.
52
+ */
53
+ children: ChartTextChildren;
54
+ /**
55
+ * The desired x position in SVG pixels.
56
+ * @note Text will be automatically positioned to fit within bounds unless `disableRepositioning` is true.
57
+ */
58
+ x: number;
59
+ /**
60
+ * The desired y position in SVG pixels.
61
+ * @note Text will be automatically positioned to fit within bounds unless `disableRepositioning` is true.
62
+ */
63
+ y: number;
64
+ /**
65
+ * Horizontal alignment of the text.
66
+ * @default 'center'
67
+ */
68
+ horizontalAlignment?: TextHorizontalAlignment;
69
+ /**
70
+ * Vertical alignment of the text.
71
+ * @default 'middle'
72
+ */
73
+ verticalAlignment?: TextVerticalAlignment;
74
+ /**
75
+ * When true, disables automatic repositioning to fit within bounds.
76
+ */
77
+ disableRepositioning?: boolean;
78
+ /**
79
+ * Optional bounds rectangle to constrain the text within. If provided, text will be positioned
80
+ * to stay within these bounds. Defaults to the full chart bounds when not provided.
81
+ */
82
+ bounds?: Rect;
83
+ /**
84
+ * Callback fired when text dimensions change.
85
+ * Used for collision detection and smart positioning.
86
+ * Returns the adjusted position and dimensions.
87
+ */
88
+ onDimensionsChange?: (rect: Rect) => void;
89
+ /**
90
+ * Inset around the text content for the background rect.
91
+ * Only affects the background, text position remains unchanged.
92
+ */
93
+ inset?: number | ChartInset;
94
+ style?: React.CSSProperties;
95
+ styles?: {
96
+ root?: React.CSSProperties;
97
+ text?: React.CSSProperties;
98
+ backgroundRect?: React.CSSProperties;
99
+ };
100
+ className?: string;
101
+ classNames?: {
102
+ root?: string;
103
+ text?: string;
104
+ backgroundRect?: string;
105
+ };
106
+ /**
107
+ * Border radius for the background rectangle.
108
+ * @default 4
109
+ */
110
+ borderRadius?: number;
111
+ };
112
+ export declare const ChartText: React.NamedExoticComponent<ChartTextProps>;
113
+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AAS,CAAC,EAAE,eAAe,CAAC;IAC5B;;OAEG;IACH,QAAQ,EAAE,iBAAiB,CAAC;IAC5B;;;OAGG;IACH,CAAC,EAAE,MAAM,CAAC;IACV;;;OAGG;IACH,CAAC,EAAE,MAAM,CAAC;IACV;;;OAGG;IACH,mBAAmB,CAAC,EAAE,uBAAuB,CAAC;IAC9C;;;OAGG;IACH,iBAAiB,CAAC,EAAE,qBAAqB,CAAC;IAC1C;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;OAGG;IACH,MAAM,CAAC,EAAE,IAAI,CAAC;IACd;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC1C;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAC5B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,MAAM,CAAC,EAAE;QACP,IAAI,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAC3B,IAAI,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAC3B,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;KACtC,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;IACF;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAkCJ,eAAO,MAAM,SAAS,4CAgMrB,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { type ChartTextChildren, type ChartTextProps } from './ChartText';
2
+ /**
3
+ * Configuration for a single text label in the display list
4
+ */
5
+ export type TextLabelData = {
6
+ /**
7
+ * The text content to display
8
+ */
9
+ label: ChartTextChildren;
10
+ /**
11
+ * X coordinate where the text should be positioned
12
+ */
13
+ x: number;
14
+ /**
15
+ * Y coordinate where the text should be positioned
16
+ */
17
+ y: number;
18
+ /**
19
+ * Additional props to pass to the ChartText component for this specific label
20
+ */
21
+ chartTextProps?: Partial<ChartTextProps>;
22
+ };
23
+ export type TextLabelDataWithKey = TextLabelData & {
24
+ key: string;
25
+ };
26
+ export type SmartChartTextGroupProps = {
27
+ /**
28
+ * Array of text labels to display
29
+ */
30
+ labels: TextLabelData[];
31
+ /**
32
+ * Minimum gap between labels in pixels
33
+ * @default 8
34
+ */
35
+ minGap?: number;
36
+ /**
37
+ * Whether to always show first and last labels
38
+ * @default true
39
+ */
40
+ prioritizeEndLabels?: boolean;
41
+ /**
42
+ * Common props to apply to all ChartText components
43
+ */
44
+ chartTextProps?: Partial<ChartTextProps>;
45
+ };
46
+ /**
47
+ * A smart text display component that prevents label overlap through collision detection.
48
+ *
49
+ * This component renders a list of ChartText components and automatically hides overlapping elements
50
+ * to ensure readability.
51
+ *
52
+ * The component focuses solely on overlap prevention logic for better separation of concerns.
53
+ */
54
+ export declare const SmartChartTextGroup: import('react').NamedExoticComponent<SmartChartTextGroupProps>;
55
+ //# sourceMappingURL=SmartChartTextGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SmartChartTextGroup.d.ts","sourceRoot":"","sources":["../../../src/chart/text/SmartChartTextGroup.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAa,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAErF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,KAAK,EAAE,iBAAiB,CAAC;IACzB;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IACV;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IACV;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;CAC1C,CAAC;AAiBF;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,gEAoM/B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './ChartText';
2
+ export * from './SmartChartTextGroup';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/chart/text/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,342 @@
1
+ import type React from 'react';
2
+ import type { Rect } from '@coinbase/cds-common/types';
3
+ import { type AxisBounds, type Series } from './chart';
4
+ import { type ChartAxisScaleType, type ChartScaleFunction } from './scale';
5
+ export declare const defaultAxisId = 'DEFAULT_AXIS_ID';
6
+ export declare const defaultAxisScaleType = 'linear';
7
+ /**
8
+ * Axis configuration with computed bounds
9
+ */
10
+ export type AxisConfig = {
11
+ /** The type of scale to use */
12
+ scaleType: ChartAxisScaleType;
13
+ /**
14
+ * Domain bounds for the axis (data space)
15
+ */
16
+ domain: AxisBounds;
17
+ /**
18
+ * Range bounds for the axis (visual space in pixels)
19
+ */
20
+ range: AxisBounds;
21
+ /**
22
+ * Data for the axis
23
+ */
24
+ data?: string[] | number[];
25
+ /**
26
+ * Padding between categories for band scales (0-1, where 0.1 = 10% spacing)
27
+ * Only used when scaleType is 'band'
28
+ * @default 0.1
29
+ */
30
+ categoryPadding?: number;
31
+ /**
32
+ * Domain limit type for numeric scales
33
+ * - 'nice': Rounds the domain to human-friendly values
34
+ * - 'strict': Uses the exact min/max values from the data
35
+ */
36
+ domainLimit: 'nice' | 'strict';
37
+ };
38
+ /**
39
+ * Axis configuration without computed bounds (used for input)
40
+ */
41
+ export type AxisConfigProps = Omit<AxisConfig, 'domain' | 'range'> & {
42
+ /**
43
+ * Unique identifier for this axis.
44
+ */
45
+ id: string;
46
+ /**
47
+ * Domain configuration for the axis (data space).
48
+ *
49
+ * The domainLimit parameter (inherited from AxisConfig) controls how initial domain bounds are calculated:
50
+ * - 'nice' (default for y axes): Rounds the domain to human-friendly values (e.g., 0-100 instead of 1.2-97.8)
51
+ * - 'strict' (default for x axes): Uses the exact min/max values from the data
52
+ *
53
+ * The domain can be:
54
+ * - A partial bounds object to override specific min/max values
55
+ * - A function that receives the limit-processed bounds and allows further customization
56
+ *
57
+ * This allows you to first apply nice/strict processing, then optionally transform the result.
58
+ */
59
+ domain?: Partial<AxisBounds> | ((bounds: AxisBounds) => AxisBounds);
60
+ /**
61
+ * Range configuration for the axis (visual space in pixels).
62
+ * Can be a partial bounds object to override specific values, or a function that transforms the calculated range.
63
+ *
64
+ * When using a function, it receives the initial calculated range bounds and allows you to adjust them.
65
+ * This replaces the previous rangeOffset approach and provides more flexibility for range customization.
66
+ */
67
+ range?: Partial<AxisBounds> | ((bounds: AxisBounds) => AxisBounds);
68
+ };
69
+ /**
70
+ * Gets a D3 scale based on the axis configuration.
71
+ * Handles both numeric (linear/log) and categorical (band) scales.
72
+ *
73
+ * For numeric scales, the domain limit controls whether bounds are "nice" (human-friendly)
74
+ * or "strict" (exact min/max). Range can be customized using function-based configuration.
75
+ *
76
+ * @param params - Scale parameters
77
+ * @returns The D3 scale function
78
+ * @throws An Error if bounds are invalid
79
+ */
80
+ export declare const getAxisScale: ({
81
+ config,
82
+ type,
83
+ range,
84
+ dataDomain,
85
+ }: {
86
+ config?: AxisConfig;
87
+ type: 'x' | 'y';
88
+ range: AxisBounds;
89
+ dataDomain: AxisBounds;
90
+ }) => ChartScaleFunction;
91
+ /**
92
+ * Formats the array of user-provided axis configs with default values and validates axis ids.
93
+ * Ensures at least one axis config exists if no input is provided.
94
+ * Requires specific axis ids when there are more than 1 axes.
95
+ * Defaults the axis id for a single axis config if there is no id.
96
+ * @param type - the type of axis, 'x' or 'y'
97
+ * @param axes - array of axis configs or single axis config
98
+ * @param defaultId - the default id to use for the axis
99
+ * @param defaultScaleType - the default scale type to use for the axis
100
+ * @returns array of axis configs with IDs
101
+ */
102
+ export declare const getAxisConfig: (
103
+ type: 'x' | 'y',
104
+ axes: Partial<AxisConfigProps> | Partial<AxisConfigProps>[] | undefined,
105
+ defaultId?: string,
106
+ defaultScaleType?: ChartAxisScaleType,
107
+ ) => AxisConfigProps[];
108
+ /**
109
+ * Calculates the data domain for an axis based on its configuration and series data.
110
+ * Handles both x and y axes, categorical data, custom domain configurations, and stacking.
111
+ *
112
+ * @param axisParam - The axis configuration
113
+ * @param series - Array of series objects (for stacking support)
114
+ * @param axisType - Whether this is an 'x' or 'y' axis
115
+ * @returns The calculated axis bounds
116
+ */
117
+ export declare const getAxisDomain: (
118
+ axisParam: AxisConfigProps,
119
+ series: Series[],
120
+ axisType: 'x' | 'y',
121
+ ) => AxisBounds;
122
+ /**
123
+ * Calculates the visual range for an axis based on the chart rectangle and configuration.
124
+ * Handles custom range configurations including functions and partial bounds.
125
+ *
126
+ * @param axisParam - The axis configuration
127
+ * @param chartRect - The chart drawing area rectangle
128
+ * @param axisType - Whether this is an 'x' or 'y' axis
129
+ * @returns The calculated axis range bounds
130
+ */
131
+ export declare const getAxisRange: (
132
+ axisParam: AxisConfigProps,
133
+ chartRect: Rect,
134
+ axisType: 'x' | 'y',
135
+ ) => AxisBounds;
136
+ /**
137
+ * Options for tick generation behavior
138
+ */
139
+ type TickGenerationOptions = {
140
+ /**
141
+ * Minimum step size allowed for ticks.
142
+ * Prevents the step from being smaller than this value.
143
+ * @example 1 // Prevents fractional steps like 0.5
144
+ */
145
+ minStep?: number;
146
+ /**
147
+ * Maximum step size allowed for ticks.
148
+ * Prevents the step from being larger than this value.
149
+ * @example 100 // Prevents steps larger than 100
150
+ */
151
+ maxStep?: number;
152
+ /**
153
+ * Minimum number of ticks to generate when using tickInterval.
154
+ * @default 4
155
+ */
156
+ minTickCount?: number;
157
+ };
158
+ export type GetAxisTicksDataProps = {
159
+ /**
160
+ * Custom tick configuration for the axis.
161
+ * - **Array**: Uses these exact values for tick positioning and labels.
162
+ * - For numeric scales: exact values to display
163
+ * - For band scales: category indices to display
164
+ * - **Function**: Filters based on the predicate function.
165
+ * - For numeric scales: filters generated tick values
166
+ * - For band scales: filters category indices
167
+ */
168
+ ticks?: number[] | ((value: number) => boolean);
169
+ /**
170
+ * The scale function to use for positioning and tick generation.
171
+ * Can be either a numeric scale or a band scale.
172
+ */
173
+ scaleFunction: ChartScaleFunction;
174
+ /**
175
+ * Requested number of ticks to display (only used for numeric scales).
176
+ * For band/categorical scales, use the `ticks` parameter to control which categories are shown.
177
+ */
178
+ requestedTickCount?: number;
179
+ /**
180
+ * Categories for band scales
181
+ */
182
+ categories?: string[];
183
+ /**
184
+ * Possible tick values to filter from when using function-based ticks.
185
+ * Used for discrete data (such as 'band' scale indices).
186
+ */
187
+ possibleTickValues?: number[];
188
+ /**
189
+ * Interval at which to show ticks in pixels.
190
+ * When provided, calculates tick count based on available space and generates
191
+ * evenly distributed ticks that always include first and last domain values.
192
+ * Only applies to numeric scales and overrides requestedTickCount.
193
+ *
194
+ * @example
195
+ * // For a chart with 400px width, tickInterval: 64 would generate ~6 ticks
196
+ * // evenly distributed across the data range, always including first and last values
197
+ * getAxisTicksData({
198
+ * scaleFunction: numericScale,
199
+ * tickInterval: 32,
200
+ * possibleTickValues: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
201
+ * });
202
+ * // Result: ticks at indices [0, 2, 4, 6, 8, 10] with their corresponding positions
203
+ */
204
+ tickInterval?: number;
205
+ /**
206
+ * Options for tick generation behavior
207
+ */
208
+ options?: TickGenerationOptions;
209
+ };
210
+ /**
211
+ * Formats a tick value for display on an axis.
212
+ * Consolidates the identical formatting logic shared between XAxis and YAxis.
213
+ *
214
+ * @param value - The raw tick value to format
215
+ * @param tickFormatter - Optional custom formatter function
216
+ * @returns The formatted tick value as a React node
217
+ */
218
+ export declare const formatAxisTick: (
219
+ value: any,
220
+ tickFormatter?: (value: any) => React.ReactNode,
221
+ ) => React.ReactNode;
222
+ /**
223
+ * Processes tick configuration and returns tick data with positions.
224
+ *
225
+ * **Parameter Precedence by Scale Type:**
226
+ *
227
+ * **For Numeric Scales (linear/log):**
228
+ * 1. `ticks` (array) - Explicit tick values override all other options
229
+ * 2. `ticks` (function) - Filter function for tick selection
230
+ * 3. `ticks` (boolean) - Show/hide all possible ticks
231
+ * 4. `requestedTickCount` - D3 automatic tick generation (overrides tickInterval)
232
+ * 5. `tickInterval` - Pixel-based spacing (fallback)
233
+ *
234
+ * **For Categorical Scales (band):**
235
+ * 1. `ticks` (array) - Explicit category indices to display
236
+ * 2. `ticks` (function) - Filter function for category selection
237
+ * 3. `ticks` (boolean) - Show/hide all categories
238
+ * 4. Default - Show all categories (requestedTickCount and tickInterval are ignored)
239
+ *
240
+ * @param params - Tick processing parameters
241
+ * @param params.ticks - Custom tick configuration with multiple formats:
242
+ * - **Array**: For numeric scales: exact tick values; For band scales: category indices
243
+ * - **Function**: Predicate to filter tick values or category indices
244
+ * - **Boolean**: Show all (true) or no ticks (false) for both scale types
245
+ * @param params.scaleFunction - D3 scale function (numeric or band scale)
246
+ * @param params.requestedTickCount - Number of ticks for D3 generation (**numeric scales only**, overrides tickInterval)
247
+ * @param params.categories - Category labels (**band scales only**)
248
+ * @param params.possibleTickValues - Available tick values for filtering/selection (**numeric scales only**)
249
+ * @param params.tickInterval - Pixel spacing between ticks (**numeric scales only**, fallback option)
250
+ * @returns Array of tick data with values and positions
251
+ *
252
+ * @example
253
+ * // Basic usage with tickInterval for pixel-based spacing
254
+ * import { scaleLinear } from 'd3-scale';
255
+ *
256
+ * const numericScale = scaleLinear().domain([0, 10]).range([0, 400]);
257
+ * const result = getAxisTicksData({
258
+ * scaleFunction: numericScale,
259
+ * tickInterval: 80, // 80 pixels between ticks
260
+ * possibleTickValues: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
261
+ * });
262
+ * // Returns: [
263
+ * // { tick: 0, position: 0 }, // Always includes first
264
+ * // { tick: 2, position: 80 },
265
+ * // { tick: 5, position: 200 },
266
+ * // { tick: 7, position: 280 },
267
+ * // { tick: 10, position: 400 } // Always includes last
268
+ * // ]
269
+ *
270
+ * @example
271
+ * // Using requestedTickCount for D3-generated ticks
272
+ * const result = getAxisTicksData({
273
+ * scaleFunction: numericScale,
274
+ * requestedTickCount: 5
275
+ * });
276
+ * // Uses D3's tick generation algorithm
277
+ *
278
+ * @example
279
+ * // Using explicit tick values
280
+ * const result = getAxisTicksData({
281
+ * scaleFunction: numericScale,
282
+ * ticks: [0, 2.5, 5, 7.5, 10]
283
+ * });
284
+ * // Returns exact positions for specified values
285
+ *
286
+ * @example
287
+ * // Using tick filter function
288
+ * const result = getAxisTicksData({
289
+ * scaleFunction: numericScale,
290
+ * ticks: (value) => value % 2 === 0, // Only even numbers
291
+ * possibleTickValues: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
292
+ * });
293
+ * // Returns: [0, 2, 4, 6, 8, 10] with their positions
294
+ *
295
+ * @example
296
+ * // Band scale with categories (requestedTickCount and tickInterval are ignored)
297
+ * import { scaleBand } from 'd3-scale';
298
+ *
299
+ * const bandScale = scaleBand().domain([0, 1, 2, 3, 4]).range([0, 400]).padding(0.1);
300
+ * const result = getAxisTicksData({
301
+ * scaleFunction: bandScale,
302
+ * categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
303
+ * ticks: [0, 2, 4], // Show only Jan (index 0), Mar (index 2), May (index 4)
304
+ * requestedTickCount: 10, // IGNORED for band scales
305
+ * tickInterval: 50 // IGNORED for band scales
306
+ * });
307
+ * // Returns tick positions centered in each selected band
308
+ */
309
+ export declare const getAxisTicksData: ({
310
+ ticks,
311
+ scaleFunction,
312
+ requestedTickCount,
313
+ categories,
314
+ possibleTickValues,
315
+ tickInterval,
316
+ options,
317
+ }: GetAxisTicksDataProps) => Array<{
318
+ tick: number;
319
+ position: number;
320
+ }>;
321
+ export type RegisteredAxis = {
322
+ id: string;
323
+ position: 'top' | 'bottom' | 'left' | 'right';
324
+ size: number;
325
+ };
326
+ /**
327
+ * Calculates the total amount of padding needed to render a set of axes on the main drawing area of the chart.
328
+ * Returns the registed axes, an API for adding/removing axes as well as the total calculated padding that must be reserved in the drawing area.
329
+ */
330
+ export declare const useTotalAxisPadding: () => {
331
+ renderedAxes: Map<string, RegisteredAxis>;
332
+ axisPadding: {
333
+ top: number;
334
+ right: number;
335
+ bottom: number;
336
+ left: number;
337
+ };
338
+ registerAxis: (id: string, position: 'top' | 'bottom' | 'left' | 'right', size: number) => void;
339
+ unregisterAxis: (id: string) => void;
340
+ };
341
+ export {};
342
+ //# sourceMappingURL=axis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axis.d.ts","sourceRoot":"","sources":["../../../src/chart/utils/axis.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EACL,KAAK,UAAU,EAIf,KAAK,MAAM,EACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EAMxB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAC/C,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAE7C;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,+BAA+B;IAC/B,SAAS,EAAE,kBAAkB,CAAC;IAC9B;;OAEG;IACH,MAAM,EAAE,UAAU,CAAC;IACnB;;OAEG;IACH,KAAK,EAAE,UAAU,CAAC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,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IAC9C,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;uBAIvB,MAAM,YAAY,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,QAAQ,MAAM;yBAclC,MAAM;CAwB/C,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Calculates the size adjustment needed for bars when accounting for gaps between them.
3
+ * This function helps determine how much to reduce each bar's width to accommodate
4
+ * the specified gap size between multiple bars in a group.
5
+ *
6
+ * @param barCount - The number of bars in the group
7
+ * @param gapSize - The desired gap size between bars
8
+ * @returns The amount to reduce each bar's size by, or 0 if there's only one bar
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * // For 3 bars with 12px gaps, each bar should be reduced by 8px
13
+ * const adjustment = getBarSizeAdjustment(3, 12);
14
+ *
15
+ * // Single bar needs no adjustment
16
+ * const singleBarAdjustment = getBarSizeAdjustment(1, 10);
17
+ * ```
18
+ */
19
+ export declare function getBarSizeAdjustment(barCount: number, gapSize: number): number;
20
+ //# sourceMappingURL=bar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bar.d.ts","sourceRoot":"","sources":["../../../src/chart/utils/bar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAM9E"}