@ledgerhq/lumen-ui-react 0.1.56 → 0.1.57

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 (234) hide show
  1. package/ai-rules/RULES.md +5 -4
  2. package/dist/lib/Components/visualization/Axis/XAxis/XAxis.d.ts +3 -0
  3. package/dist/lib/Components/visualization/Axis/XAxis/XAxis.d.ts.map +1 -0
  4. package/dist/lib/Components/visualization/Axis/XAxis/XAxis.js +85 -0
  5. package/dist/lib/Components/visualization/Axis/XAxis/index.d.ts +3 -0
  6. package/dist/lib/Components/visualization/Axis/XAxis/index.d.ts.map +1 -0
  7. package/dist/lib/Components/visualization/Axis/XAxis/types.d.ts +9 -0
  8. package/dist/lib/Components/visualization/Axis/XAxis/types.d.ts.map +1 -0
  9. package/dist/lib/Components/visualization/Axis/YAxis/YAxis.d.ts +3 -0
  10. package/dist/lib/Components/visualization/Axis/YAxis/YAxis.d.ts.map +1 -0
  11. package/dist/lib/Components/visualization/Axis/YAxis/YAxis.js +85 -0
  12. package/dist/lib/Components/visualization/Axis/YAxis/index.d.ts +3 -0
  13. package/dist/lib/Components/visualization/Axis/YAxis/index.d.ts.map +1 -0
  14. package/dist/lib/Components/visualization/Axis/YAxis/types.d.ts +14 -0
  15. package/dist/lib/Components/visualization/Axis/YAxis/types.d.ts.map +1 -0
  16. package/dist/lib/Components/visualization/Axis/index.d.ts +2 -0
  17. package/dist/lib/Components/visualization/Axis/index.d.ts.map +1 -0
  18. package/dist/lib/Components/visualization/Axis/types.d.ts +80 -0
  19. package/dist/lib/Components/visualization/Axis/types.d.ts.map +1 -0
  20. package/dist/lib/Components/visualization/CartesianChart/CartesianChart.d.ts +3 -0
  21. package/dist/lib/Components/visualization/CartesianChart/CartesianChart.d.ts.map +1 -0
  22. package/dist/lib/Components/visualization/CartesianChart/CartesianChart.js +107 -0
  23. package/dist/lib/Components/visualization/CartesianChart/ChartEmptyLabel/ChartEmptyLabel.d.ts +11 -0
  24. package/dist/lib/Components/visualization/CartesianChart/ChartEmptyLabel/ChartEmptyLabel.d.ts.map +1 -0
  25. package/dist/lib/Components/visualization/CartesianChart/ChartEmptyLabel/ChartEmptyLabel.js +21 -0
  26. package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/RevealAnimationProvider.d.ts +3 -0
  27. package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/RevealAnimationProvider.d.ts.map +1 -0
  28. package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/RevealAnimationProvider.js +41 -0
  29. package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/context.d.ts +15 -0
  30. package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/context.d.ts.map +1 -0
  31. package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/context.js +10 -0
  32. package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/index.d.ts +3 -0
  33. package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/index.d.ts.map +1 -0
  34. package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/types.d.ts +57 -0
  35. package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/types.d.ts.map +1 -0
  36. package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/utils.d.ts +35 -0
  37. package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/utils.d.ts.map +1 -0
  38. package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/utils.js +69 -0
  39. package/dist/lib/Components/visualization/CartesianChart/context/cartesianChartContext.d.ts +8 -0
  40. package/dist/lib/Components/visualization/CartesianChart/context/cartesianChartContext.d.ts.map +1 -0
  41. package/dist/lib/Components/visualization/CartesianChart/context/cartesianChartContext.js +9 -0
  42. package/dist/lib/Components/visualization/CartesianChart/context/index.d.ts +3 -0
  43. package/dist/lib/Components/visualization/CartesianChart/context/index.d.ts.map +1 -0
  44. package/dist/lib/Components/visualization/CartesianChart/context/useBuildChartContext.d.ts +25 -0
  45. package/dist/lib/Components/visualization/CartesianChart/context/useBuildChartContext.d.ts.map +1 -0
  46. package/dist/lib/Components/visualization/CartesianChart/context/useBuildChartContext.js +61 -0
  47. package/dist/lib/Components/visualization/CartesianChart/hooks/useShimmerAnimation.d.ts +18 -0
  48. package/dist/lib/Components/visualization/CartesianChart/hooks/useShimmerAnimation.d.ts.map +1 -0
  49. package/dist/lib/Components/visualization/CartesianChart/hooks/useShimmerAnimation.js +15 -0
  50. package/dist/lib/Components/visualization/CartesianChart/index.d.ts +4 -0
  51. package/dist/lib/Components/visualization/CartesianChart/index.d.ts.map +1 -0
  52. package/dist/lib/Components/visualization/CartesianChart/types.d.ts +127 -0
  53. package/dist/lib/Components/visualization/CartesianChart/types.d.ts.map +1 -0
  54. package/dist/lib/Components/visualization/CartesianChart/utils.d.ts +5 -0
  55. package/dist/lib/Components/visualization/CartesianChart/utils.d.ts.map +1 -0
  56. package/dist/lib/Components/visualization/CartesianChart/utils.js +24 -0
  57. package/dist/lib/Components/visualization/DonutChart/DonutChart.d.ts +3 -0
  58. package/dist/lib/Components/visualization/DonutChart/DonutChart.d.ts.map +1 -0
  59. package/dist/lib/Components/visualization/DonutChart/DonutChart.js +90 -0
  60. package/dist/lib/Components/visualization/DonutChart/DonutChartAnimatedCenter.d.ts +10 -0
  61. package/dist/lib/Components/visualization/DonutChart/DonutChartAnimatedCenter.d.ts.map +1 -0
  62. package/dist/lib/Components/visualization/DonutChart/DonutChartAnimatedCenter.js +61 -0
  63. package/dist/lib/Components/visualization/DonutChart/DonutChartCenter.d.ts +9 -0
  64. package/dist/lib/Components/visualization/DonutChart/DonutChartCenter.d.ts.map +1 -0
  65. package/dist/lib/Components/visualization/DonutChart/DonutChartCenter.js +20 -0
  66. package/dist/lib/Components/visualization/DonutChart/DonutChartDescription.d.ts +3 -0
  67. package/dist/lib/Components/visualization/DonutChart/DonutChartDescription.d.ts.map +1 -0
  68. package/dist/lib/Components/visualization/DonutChart/DonutChartDescription.js +49 -0
  69. package/dist/lib/Components/visualization/DonutChart/DonutChartTitle.d.ts +3 -0
  70. package/dist/lib/Components/visualization/DonutChart/DonutChartTitle.d.ts.map +1 -0
  71. package/dist/lib/Components/visualization/DonutChart/DonutChartTitle.js +55 -0
  72. package/dist/lib/Components/visualization/DonutChart/DonutRing.d.ts +12 -0
  73. package/dist/lib/Components/visualization/DonutChart/DonutRing.d.ts.map +1 -0
  74. package/dist/lib/Components/visualization/DonutChart/DonutRing.js +110 -0
  75. package/dist/lib/Components/visualization/DonutChart/RevealAnimation.d.ts +7 -0
  76. package/dist/lib/Components/visualization/DonutChart/RevealAnimation.d.ts.map +1 -0
  77. package/dist/lib/Components/visualization/DonutChart/RevealAnimation.js +28 -0
  78. package/dist/lib/Components/visualization/DonutChart/donutSizeContext.d.ts +18 -0
  79. package/dist/lib/Components/visualization/DonutChart/donutSizeContext.d.ts.map +1 -0
  80. package/dist/lib/Components/visualization/DonutChart/donutSizeContext.js +6 -0
  81. package/dist/lib/Components/visualization/DonutChart/hooks/useContrastSafeSeries.d.ts +12 -0
  82. package/dist/lib/Components/visualization/DonutChart/hooks/useContrastSafeSeries.d.ts.map +1 -0
  83. package/dist/lib/Components/visualization/DonutChart/hooks/useContrastSafeSeries.js +13 -0
  84. package/dist/lib/Components/visualization/DonutChart/hooks/useDonutLoadingAnimation.d.ts +8 -0
  85. package/dist/lib/Components/visualization/DonutChart/hooks/useDonutLoadingAnimation.d.ts.map +1 -0
  86. package/dist/lib/Components/visualization/DonutChart/hooks/useDonutLoadingAnimation.js +16 -0
  87. package/dist/lib/Components/visualization/DonutChart/index.d.ts +7 -0
  88. package/dist/lib/Components/visualization/DonutChart/index.d.ts.map +1 -0
  89. package/dist/lib/Components/visualization/DonutChart/types.d.ts +172 -0
  90. package/dist/lib/Components/visualization/DonutChart/types.d.ts.map +1 -0
  91. package/dist/lib/Components/visualization/DonutChart/useDonutSeries/index.d.ts +3 -0
  92. package/dist/lib/Components/visualization/DonutChart/useDonutSeries/index.d.ts.map +1 -0
  93. package/dist/lib/Components/visualization/DonutChart/useDonutSeries/useDonutSeries.d.ts +10 -0
  94. package/dist/lib/Components/visualization/DonutChart/useDonutSeries/useDonutSeries.d.ts.map +1 -0
  95. package/dist/lib/Components/visualization/DonutChart/useDonutSeries/useDonutSeries.js +16 -0
  96. package/dist/lib/Components/visualization/DonutChart/useDonutSeries/utils.d.ts +9 -0
  97. package/dist/lib/Components/visualization/DonutChart/useDonutSeries/utils.d.ts.map +1 -0
  98. package/dist/lib/Components/visualization/DonutChart/useDonutSeries/utils.js +46 -0
  99. package/dist/lib/Components/visualization/DonutChart/utils.d.ts +37 -0
  100. package/dist/lib/Components/visualization/DonutChart/utils.d.ts.map +1 -0
  101. package/dist/lib/Components/visualization/DonutChart/utils.js +83 -0
  102. package/dist/lib/Components/visualization/Legend/Legend.d.ts +3 -0
  103. package/dist/lib/Components/visualization/Legend/Legend.d.ts.map +1 -0
  104. package/dist/lib/Components/visualization/Legend/Legend.js +23 -0
  105. package/dist/lib/Components/visualization/Legend/LegendItem.d.ts +7 -0
  106. package/dist/lib/Components/visualization/Legend/LegendItem.d.ts.map +1 -0
  107. package/dist/lib/Components/visualization/Legend/LegendItem.js +19 -0
  108. package/dist/lib/Components/visualization/Legend/index.d.ts +3 -0
  109. package/dist/lib/Components/visualization/Legend/index.d.ts.map +1 -0
  110. package/dist/lib/Components/visualization/Legend/types.d.ts +32 -0
  111. package/dist/lib/Components/visualization/Legend/types.d.ts.map +1 -0
  112. package/dist/lib/Components/visualization/Line/Line.d.ts +3 -0
  113. package/dist/lib/Components/visualization/Line/Line.d.ts.map +1 -0
  114. package/dist/lib/Components/visualization/Line/Line.js +82 -0
  115. package/dist/lib/Components/visualization/Line/index.d.ts +3 -0
  116. package/dist/lib/Components/visualization/Line/index.d.ts.map +1 -0
  117. package/dist/lib/Components/visualization/Line/types.d.ts +45 -0
  118. package/dist/lib/Components/visualization/Line/types.d.ts.map +1 -0
  119. package/dist/lib/Components/visualization/Line/utils.d.ts +28 -0
  120. package/dist/lib/Components/visualization/Line/utils.d.ts.map +1 -0
  121. package/dist/lib/Components/visualization/Line/utils.js +34 -0
  122. package/dist/lib/Components/visualization/LineChart/LineChart.d.ts +3 -0
  123. package/dist/lib/Components/visualization/LineChart/LineChart.d.ts.map +1 -0
  124. package/dist/lib/Components/visualization/LineChart/LineChart.js +181 -0
  125. package/dist/lib/Components/visualization/LineChart/LineChartEmptyState/LineChartEmptyState.d.ts +9 -0
  126. package/dist/lib/Components/visualization/LineChart/LineChartEmptyState/LineChartEmptyState.d.ts.map +1 -0
  127. package/dist/lib/Components/visualization/LineChart/LineChartEmptyState/LineChartEmptyState.js +51 -0
  128. package/dist/lib/Components/visualization/LineChart/LineChartEmptyState/index.d.ts +3 -0
  129. package/dist/lib/Components/visualization/LineChart/LineChartEmptyState/index.d.ts.map +1 -0
  130. package/dist/lib/Components/visualization/LineChart/LineChartEmptyState/types.d.ts +3 -0
  131. package/dist/lib/Components/visualization/LineChart/LineChartEmptyState/types.d.ts.map +1 -0
  132. package/dist/lib/Components/visualization/LineChart/LineChartEmptyState/utils.d.ts +8 -0
  133. package/dist/lib/Components/visualization/LineChart/LineChartEmptyState/utils.d.ts.map +1 -0
  134. package/dist/lib/Components/visualization/LineChart/LineChartEmptyState/utils.js +8 -0
  135. package/dist/lib/Components/visualization/LineChart/index.d.ts +3 -0
  136. package/dist/lib/Components/visualization/LineChart/index.d.ts.map +1 -0
  137. package/dist/lib/Components/visualization/LineChart/types.d.ts +82 -0
  138. package/dist/lib/Components/visualization/LineChart/types.d.ts.map +1 -0
  139. package/dist/lib/Components/visualization/LineChart/utils.d.ts +56 -0
  140. package/dist/lib/Components/visualization/LineChart/utils.d.ts.map +1 -0
  141. package/dist/lib/Components/visualization/LineChart/utils.js +57 -0
  142. package/dist/lib/Components/visualization/Point/Point.d.ts +4 -0
  143. package/dist/lib/Components/visualization/Point/Point.d.ts.map +1 -0
  144. package/dist/lib/Components/visualization/Point/Point.js +122 -0
  145. package/dist/lib/Components/visualization/Point/index.d.ts +3 -0
  146. package/dist/lib/Components/visualization/Point/index.d.ts.map +1 -0
  147. package/dist/lib/Components/visualization/Point/pointContext/MagneticPointsProvider.d.ts +7 -0
  148. package/dist/lib/Components/visualization/Point/pointContext/MagneticPointsProvider.d.ts.map +1 -0
  149. package/dist/lib/Components/visualization/Point/pointContext/MagneticPointsProvider.js +22 -0
  150. package/dist/lib/Components/visualization/Point/pointContext/index.d.ts +3 -0
  151. package/dist/lib/Components/visualization/Point/pointContext/index.d.ts.map +1 -0
  152. package/dist/lib/Components/visualization/Point/pointContext/magneticPointsContext.d.ts +30 -0
  153. package/dist/lib/Components/visualization/Point/pointContext/magneticPointsContext.d.ts.map +1 -0
  154. package/dist/lib/Components/visualization/Point/pointContext/magneticPointsContext.js +14 -0
  155. package/dist/lib/Components/visualization/Point/types.d.ts +110 -0
  156. package/dist/lib/Components/visualization/Point/types.d.ts.map +1 -0
  157. package/dist/lib/Components/visualization/Point/usePointGeometry.d.ts +33 -0
  158. package/dist/lib/Components/visualization/Point/usePointGeometry.d.ts.map +1 -0
  159. package/dist/lib/Components/visualization/Point/usePointGeometry.js +30 -0
  160. package/dist/lib/Components/visualization/Point/utils.d.ts +51 -0
  161. package/dist/lib/Components/visualization/Point/utils.d.ts.map +1 -0
  162. package/dist/lib/Components/visualization/Point/utils.js +54 -0
  163. package/dist/lib/Components/visualization/ReferenceLine/ReferenceLine.d.ts +3 -0
  164. package/dist/lib/Components/visualization/ReferenceLine/ReferenceLine.d.ts.map +1 -0
  165. package/dist/lib/Components/visualization/ReferenceLine/ReferenceLine.js +42 -0
  166. package/dist/lib/Components/visualization/ReferenceLine/index.d.ts +3 -0
  167. package/dist/lib/Components/visualization/ReferenceLine/index.d.ts.map +1 -0
  168. package/dist/lib/Components/visualization/ReferenceLine/types.d.ts +74 -0
  169. package/dist/lib/Components/visualization/ReferenceLine/types.d.ts.map +1 -0
  170. package/dist/lib/Components/visualization/ReferenceLine/useReferenceLineGeometry.d.ts +21 -0
  171. package/dist/lib/Components/visualization/ReferenceLine/useReferenceLineGeometry.d.ts.map +1 -0
  172. package/dist/lib/Components/visualization/ReferenceLine/useReferenceLineGeometry.js +49 -0
  173. package/dist/lib/Components/visualization/ReferenceLine/utils.d.ts +50 -0
  174. package/dist/lib/Components/visualization/ReferenceLine/utils.d.ts.map +1 -0
  175. package/dist/lib/Components/visualization/ReferenceLine/utils.js +66 -0
  176. package/dist/lib/Components/visualization/Scrubber/DefaultScrubberTooltip/ChartTooltipItem.d.ts +9 -0
  177. package/dist/lib/Components/visualization/Scrubber/DefaultScrubberTooltip/ChartTooltipItem.d.ts.map +1 -0
  178. package/dist/lib/Components/visualization/Scrubber/DefaultScrubberTooltip/ChartTooltipItem.js +50 -0
  179. package/dist/lib/Components/visualization/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.d.ts +12 -0
  180. package/dist/lib/Components/visualization/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.d.ts.map +1 -0
  181. package/dist/lib/Components/visualization/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.js +82 -0
  182. package/dist/lib/Components/visualization/Scrubber/DefaultScrubberTooltip/utils.d.ts +58 -0
  183. package/dist/lib/Components/visualization/Scrubber/DefaultScrubberTooltip/utils.d.ts.map +1 -0
  184. package/dist/lib/Components/visualization/Scrubber/DefaultScrubberTooltip/utils.js +80 -0
  185. package/dist/lib/Components/visualization/Scrubber/Scrubber.d.ts +29 -0
  186. package/dist/lib/Components/visualization/Scrubber/Scrubber.d.ts.map +1 -0
  187. package/dist/lib/Components/visualization/Scrubber/Scrubber.js +114 -0
  188. package/dist/lib/Components/visualization/Scrubber/ScrubberProvider.d.ts +3 -0
  189. package/dist/lib/Components/visualization/Scrubber/ScrubberProvider.d.ts.map +1 -0
  190. package/dist/lib/Components/visualization/Scrubber/ScrubberProvider.js +154 -0
  191. package/dist/lib/Components/visualization/Scrubber/context/index.d.ts +2 -0
  192. package/dist/lib/Components/visualization/Scrubber/context/index.d.ts.map +1 -0
  193. package/dist/lib/Components/visualization/Scrubber/context/scrubberContext.d.ts +8 -0
  194. package/dist/lib/Components/visualization/Scrubber/context/scrubberContext.d.ts.map +1 -0
  195. package/dist/lib/Components/visualization/Scrubber/context/scrubberContext.js +9 -0
  196. package/dist/lib/Components/visualization/Scrubber/index.d.ts +4 -0
  197. package/dist/lib/Components/visualization/Scrubber/index.d.ts.map +1 -0
  198. package/dist/lib/Components/visualization/Scrubber/types.d.ts +130 -0
  199. package/dist/lib/Components/visualization/Scrubber/types.d.ts.map +1 -0
  200. package/dist/lib/Components/visualization/Scrubber/useScrubberGeometry.d.ts +29 -0
  201. package/dist/lib/Components/visualization/Scrubber/useScrubberGeometry.d.ts.map +1 -0
  202. package/dist/lib/Components/visualization/Scrubber/useScrubberGeometry.js +37 -0
  203. package/dist/lib/Components/visualization/Scrubber/utils.d.ts +79 -0
  204. package/dist/lib/Components/visualization/Scrubber/utils.d.ts.map +1 -0
  205. package/dist/lib/Components/visualization/Scrubber/utils.js +104 -0
  206. package/dist/lib/Components/visualization/config.d.ts +162 -0
  207. package/dist/lib/Components/visualization/config.d.ts.map +1 -0
  208. package/dist/lib/Components/visualization/config.js +156 -0
  209. package/dist/lib/Components/visualization/index.d.ts +8 -0
  210. package/dist/lib/Components/visualization/index.d.ts.map +1 -0
  211. package/dist/lib/Components/visualization/index.js +27 -0
  212. package/dist/lib/Components/visualization/utils/domain/domain.d.ts +18 -0
  213. package/dist/lib/Components/visualization/utils/domain/domain.d.ts.map +1 -0
  214. package/dist/lib/Components/visualization/utils/domain/domain.js +35 -0
  215. package/dist/lib/Components/visualization/utils/index.d.ts +2 -0
  216. package/dist/lib/Components/visualization/utils/index.d.ts.map +1 -0
  217. package/dist/lib/Components/visualization/utils/numbers.d.ts +13 -0
  218. package/dist/lib/Components/visualization/utils/numbers.d.ts.map +1 -0
  219. package/dist/lib/Components/visualization/utils/numbers.js +5 -0
  220. package/dist/lib/Components/visualization/utils/scales/scales.d.ts +47 -0
  221. package/dist/lib/Components/visualization/utils/scales/scales.d.ts.map +1 -0
  222. package/dist/lib/Components/visualization/utils/scales/scales.js +32 -0
  223. package/dist/lib/Components/visualization/utils/ticks/ticks.d.ts +35 -0
  224. package/dist/lib/Components/visualization/utils/ticks/ticks.d.ts.map +1 -0
  225. package/dist/lib/Components/visualization/utils/ticks/ticks.js +23 -0
  226. package/dist/lib/Components/visualization/utils/types.d.ts +63 -0
  227. package/dist/lib/Components/visualization/utils/types.d.ts.map +1 -0
  228. package/dist/libs/design-core/dist/lib/colorContrast/colorContrast.js +15 -0
  229. package/dist/libs/design-core/dist/lib/colorContrast/hexToHsl.js +14 -0
  230. package/dist/libs/design-core/dist/lib/colorContrast/hslToHex.js +10 -0
  231. package/dist/libs/design-core/dist/lib/themes/js/primitives/primitive.colors.js +15 -0
  232. package/dist/libs/utils-shared/dist/index.js +115 -113
  233. package/dist/package.json +11 -3
  234. package/package.json +12 -4
@@ -0,0 +1,22 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { useRef as l, useState as v, useCallback as n, useMemo as g } from "react";
3
+ import { MagneticRegistryProvider as h, MagneticSnapshotProvider as M } from "./magneticPointsContext.js";
4
+ function S({
5
+ children: f
6
+ }) {
7
+ const e = l(/* @__PURE__ */ new Set()), [s, o] = v(0), i = n((r) => {
8
+ e.current.has(r) || (e.current.add(r), o((t) => t + 1));
9
+ }, []), c = n((r) => {
10
+ e.current.has(r) && (e.current.delete(r), o((t) => t + 1));
11
+ }, []), u = n(() => e.current, []), m = g(
12
+ () => ({ register: i, unregister: c }),
13
+ [i, c]
14
+ ), p = g(
15
+ () => ({ version: s, getMagneticPoints: u }),
16
+ [s, u]
17
+ );
18
+ return /* @__PURE__ */ a(h, { value: m, children: /* @__PURE__ */ a(M, { value: p, children: f }) });
19
+ }
20
+ export {
21
+ S as MagneticPointsProvider
22
+ };
@@ -0,0 +1,3 @@
1
+ export { useMagneticRegistry, useMagneticSnapshot, type MagneticRegistryValue, type MagneticSnapshotValue, } from './magneticPointsContext';
2
+ export { MagneticPointsProvider } from './MagneticPointsProvider';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/visualization/Point/pointContext/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Stable registration API for magnetic points. Its identity never changes for
3
+ * the provider's lifetime, so consumers (every `Point`) do not re-render when
4
+ * the magnetic set changes — only when they mount/unmount.
5
+ */
6
+ export type MagneticRegistryValue = {
7
+ register: (dataIndex: number) => void;
8
+ unregister: (dataIndex: number) => void;
9
+ };
10
+ /**
11
+ * Mutable snapshot of the registered magnetic points. Changes on every
12
+ * register/unregister (via `version`) and is consumed only by the scrubber,
13
+ * which needs to recompute its snap targets when the set changes.
14
+ */
15
+ export type MagneticSnapshotValue = {
16
+ version: number;
17
+ getMagneticPoints: () => ReadonlySet<number>;
18
+ };
19
+ declare const MagneticRegistryProvider: import('react').FC<{
20
+ children: import('react').ReactNode;
21
+ value: MagneticRegistryValue;
22
+ }>;
23
+ declare const MagneticSnapshotProvider: import('react').FC<{
24
+ children: import('react').ReactNode;
25
+ value: MagneticSnapshotValue;
26
+ }>;
27
+ export declare const useMagneticRegistry: () => MagneticRegistryValue;
28
+ export declare const useMagneticSnapshot: () => MagneticSnapshotValue;
29
+ export { MagneticRegistryProvider, MagneticSnapshotProvider };
30
+ //# sourceMappingURL=magneticPointsContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"magneticPointsContext.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/visualization/Point/pointContext/magneticPointsContext.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,WAAW,CAAC,MAAM,CAAC,CAAC;CAC9C,CAAC;AAEF,QAAA,MAAO,wBAAwB;;;EAC+B,CAAC;AAE/D,QAAA,MAAO,wBAAwB;;;EAC+B,CAAC;AAE/D,eAAO,MAAM,mBAAmB,QAAO,qBAInC,CAAC;AAEL,eAAO,MAAM,mBAAmB,QAAO,qBAInC,CAAC;AAEL,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { createSafeContext as e } from "../../../../../libs/utils-shared/dist/index.js";
2
+ const [a, t] = e("MagneticRegistry"), [o, n] = e("MagneticSnapshot"), i = () => t({
3
+ consumerName: "useMagneticRegistry",
4
+ contextRequired: !0
5
+ }), c = () => n({
6
+ consumerName: "useMagneticSnapshot",
7
+ contextRequired: !0
8
+ });
9
+ export {
10
+ a as MagneticRegistryProvider,
11
+ o as MagneticSnapshotProvider,
12
+ i as useMagneticRegistry,
13
+ c as useMagneticSnapshot
14
+ };
@@ -0,0 +1,110 @@
1
+ import { ComponentType, MouseEvent, SVGProps } from 'react';
2
+ export type PointLabelProps = {
3
+ x: number;
4
+ y: number;
5
+ children: string;
6
+ } & Omit<SVGProps<SVGTextElement>, 'x' | 'y' | 'children'>;
7
+ export type PointLabelComponent = ComponentType<PointLabelProps>;
8
+ /**
9
+ * Horizontal alignment strategy for a point's label.
10
+ *
11
+ * - `'auto'`: keep the label inside the drawing area, anchoring it to the
12
+ * nearest edge when it would overflow.
13
+ * - `'center'`: always centre the label on the point.
14
+ */
15
+ export type LabelAlignment = 'center' | 'auto';
16
+ /**
17
+ * Pixel position and styling inputs shared by the point's rendered glyphs. Each
18
+ * glyph picks the subset it needs and derives its own pixel geometry (e.g.
19
+ * radius from `size`).
20
+ */
21
+ type PointGlyphProps = {
22
+ x: number;
23
+ y: number;
24
+ size: number;
25
+ color?: string;
26
+ position: 'top' | 'bottom';
27
+ };
28
+ export type PointMarkerProps = Pick<PointGlyphProps, 'x' | 'y' | 'size' | 'color'>;
29
+ export type PointArrowProps = Pick<PointGlyphProps, 'x' | 'y' | 'size' | 'position'>;
30
+ export type PointProps = {
31
+ /**
32
+ * X coordinate in data space (index or explicit value).
33
+ */
34
+ dataX: number;
35
+ /**
36
+ * Y coordinate in data space.
37
+ */
38
+ dataY: number;
39
+ /**
40
+ * Fill color of the point circle.
41
+ * Defaults to `var(--background-muted-strong)`.
42
+ *
43
+ * Use the `cssVar` helper from `@ledgerhq/lumen-design-core` to
44
+ * resolve a design-token CSS variable at runtime:
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * import { cssVar } from '@ledgerhq/lumen-design-core';
49
+ *
50
+ * <Point dataX={0} dataY={42} color={cssVar('var(--background-error-strong)')} />
51
+ * ```
52
+ */
53
+ color?: string;
54
+ /**
55
+ * Text label displayed near the point.
56
+ * A string is rendered directly; a function receives `dataX` and returns
57
+ * the label string, enabling index-based formatting.
58
+ */
59
+ label?: string | ((dataIndex: number) => string);
60
+ /**
61
+ * Custom component rendered instead of the default `PointLabel`.
62
+ * Receives pixel coordinates (`x`, `y`) and the resolved label as
63
+ * `children`. Use `PointLabel` inside your component to retain
64
+ * design-token styling while customising layout or appearance.
65
+ */
66
+ LabelComponent?: PointLabelComponent;
67
+ /**
68
+ * Placement of the label relative to the point.
69
+ * @default 'top'
70
+ */
71
+ labelPosition?: 'top' | 'bottom';
72
+ /**
73
+ * When `true`, the point circle is hidden but the label (if any) is still rendered.
74
+ * @default false
75
+ */
76
+ hidePoint?: boolean;
77
+ /**
78
+ * Diameter of the point circle in pixels.
79
+ * Internally converted to an SVG radius (`size / 2`).
80
+ * @default 10
81
+ */
82
+ size?: number;
83
+ /**
84
+ * When `true`, an arrow is displayed pointing from the point to the label.
85
+ * @default true
86
+ */
87
+ showLabelArrow?: boolean;
88
+ /**
89
+ * Called when the point is clicked.
90
+ */
91
+ onClick?: (event: MouseEvent<SVGGElement>) => void;
92
+ /**
93
+ * When `true`, the scrubber magnetically snaps to this point within the
94
+ * chart's `magnetRadius`. Requires `enableScrubbing` to be set on the
95
+ * parent chart.
96
+ * @default false
97
+ */
98
+ magnetic?: boolean;
99
+ /**
100
+ * Horizontal alignment of the label relative to the chart's drawing area.
101
+ * With `'auto'`, a label that would overflow the left/right edge is anchored
102
+ * to that edge and grows inward instead of being clipped, while the arrow
103
+ * keeps pointing at the exact data point. Use `'center'` to always centre the
104
+ * label on the point.
105
+ * @default 'auto'
106
+ */
107
+ labelAlignment?: LabelAlignment;
108
+ };
109
+ export {};
110
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/visualization/Point/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjE,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,UAAU,CAAC,CAAC;AAE3D,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAC,eAAe,CAAC,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE/C;;;;GAIG;AACH,KAAK,eAAe,GAAG;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,KAAK,GAAG,QAAQ,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,eAAe,EACf,GAAG,GAAG,GAAG,GAAG,MAAM,GAAG,OAAO,CAC7B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,eAAe,EACf,GAAG,GAAG,GAAG,GAAG,MAAM,GAAG,UAAU,CAChC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IACjD;;;;;OAKG;IACH,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC;;;OAGG;IACH,aAAa,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IACjC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACnD;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { CSSProperties } from 'react';
2
+ import { BaseAxisProps } from '../Axis';
3
+ import { DrawingArea } from '../utils/types';
4
+ import { MagneticRegistryValue } from './pointContext/magneticPointsContext';
5
+ type Pixel = {
6
+ x: number;
7
+ y: number;
8
+ };
9
+ type UsePointGeometryParams = {
10
+ dataX: number;
11
+ dataY: number;
12
+ magnetic: boolean;
13
+ };
14
+ type PointGeometry = {
15
+ pixel: Pixel | undefined;
16
+ drawingArea: DrawingArea;
17
+ revealStyle: CSSProperties | undefined;
18
+ isVisible: boolean;
19
+ };
20
+ /**
21
+ * Resolves a point's chart geometry and behaviour: projects its data
22
+ * coordinates to pixels, registers it as a magnetic snap target when enabled,
23
+ * exposes the reveal-animation style, and reports whether it falls inside the
24
+ * drawing area.
25
+ */
26
+ export declare const usePointGeometry: ({ dataX, dataY, magnetic, }: UsePointGeometryParams) => PointGeometry;
27
+ /**
28
+ * Registers/unregisters a data index as a magnetic snap target
29
+ * when the Point has `magnetic` enabled.
30
+ */
31
+ export declare const useMagneticRegistration: (magnetic: boolean, dataX: number, getXAxisConfig: () => BaseAxisProps | undefined, { register, unregister }: MagneticRegistryValue) => void;
32
+ export {};
33
+ //# sourceMappingURL=usePointGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePointGeometry.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/visualization/Point/usePointGeometry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,OAAO,CAAC;AAE/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAI7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAGlF,KAAK,KAAK,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC,KAAK,sBAAsB,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,aAAa,GAAG,SAAS,CAAC;IACvC,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,6BAI9B,sBAAsB,KAAG,aAqB3B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAClC,UAAU,OAAO,EACjB,OAAO,MAAM,EACb,gBAAgB,MAAM,aAAa,GAAG,SAAS,EAC/C,0BAA0B,qBAAqB,KAC9C,IAQF,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { useMemo as a, useEffect as x } from "react";
2
+ import { projectPoint as g } from "../utils/scales/scales.js";
3
+ import { isWithinBounds as v, resolveDataXToIndex as y } from "./utils.js";
4
+ import { useCartesianChartContext as S } from "../CartesianChart/context/cartesianChartContext.js";
5
+ import { useMagneticRegistry as R } from "./pointContext/magneticPointsContext.js";
6
+ import { usePointReveal as d } from "../CartesianChart/RevealAnimation/context.js";
7
+ const A = ({
8
+ dataX: e,
9
+ dataY: t,
10
+ magnetic: r
11
+ }) => {
12
+ const { getXScale: i, getYScale: n, getXAxisConfig: o, drawingArea: u } = S(), f = R();
13
+ C(r, e, o, f);
14
+ const c = i(), m = n(), s = a(() => {
15
+ if (!(!c || !m))
16
+ return g(e, t, c, m);
17
+ }, [e, t, c, m]), l = d(), p = s !== void 0 && v(s.x, s.y, u);
18
+ return { pixel: s, drawingArea: u, revealStyle: l, isVisible: p };
19
+ }, C = (e, t, r, { register: i, unregister: n }) => {
20
+ x(() => {
21
+ if (!e) return;
22
+ const o = y(t, r());
23
+ if (o !== void 0)
24
+ return i(o), () => n(o);
25
+ }, [e, t, r, i, n]);
26
+ };
27
+ export {
28
+ C as useMagneticRegistration,
29
+ A as usePointGeometry
30
+ };
@@ -0,0 +1,51 @@
1
+ import { BaseAxisProps } from '../Axis';
2
+ import { DrawingArea } from '../utils/types';
3
+ import { LabelAlignment } from './types';
4
+ export type LabelTextAnchor = 'start' | 'middle' | 'end';
5
+ export declare const isWithinBounds: (px: number, py: number, area: DrawingArea) => boolean;
6
+ /**
7
+ * Builds the three SVG points of the arrow triangle.
8
+ *
9
+ * `'top'` → arrow sits below the label, tip pointing **down** toward the circle.
10
+ * `'bottom'` → arrow sits above the label, tip pointing **up** toward the circle.
11
+ */
12
+ export declare const buildArrowPoints: (cx: number, cy: number, radius: number, position: "top" | "bottom") => string;
13
+ /**
14
+ * Resolves the label prop to a string or undefined.
15
+ */
16
+ export declare const resolveLabel: (label: string | ((dataIndex: number) => string) | undefined, dataX: number) => string | undefined;
17
+ export declare const resolveDataXToIndex: (dataX: number, axisConfig: BaseAxisProps | undefined) => number | undefined;
18
+ /**
19
+ * Computes the label's horizontal placement, keeping it inside the drawing area
20
+ * near the left/right edges. Centred on the point when it fits; otherwise
21
+ * anchored to the edge and aligned with the arrow's outer vertex (offset by half
22
+ * the arrow width from the point, when an arrow is rendered).
23
+ */
24
+ export declare const computeLabelX: (pixelX: number, label: string, area: DrawingArea, alignment: LabelAlignment, hasArrow: boolean) => {
25
+ x: number;
26
+ textAnchor: LabelTextAnchor;
27
+ };
28
+ /**
29
+ * Computes the vertical position of the label text baseline.
30
+ */
31
+ export declare const computeLabelY: (pixelY: number, radius: number, labelPosition: "top" | "bottom", renderArrow: boolean) => number;
32
+ /**
33
+ * Computes where a point's label is drawn: the (optionally clamped) horizontal
34
+ * placement and the vertical baseline. Label content is resolved separately via
35
+ * {@link resolveLabel}.
36
+ */
37
+ export declare const computeLabelGeometry: ({ text, pixelX, pixelY, size, labelPosition, showLabelArrow, area, alignment, }: {
38
+ text: string;
39
+ pixelX: number;
40
+ pixelY: number;
41
+ size: number;
42
+ labelPosition: "top" | "bottom";
43
+ showLabelArrow: boolean;
44
+ area: DrawingArea;
45
+ alignment: LabelAlignment;
46
+ }) => {
47
+ x: number;
48
+ y: number;
49
+ textAnchor: LabelTextAnchor;
50
+ };
51
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/visualization/Point/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAI9C,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEzD,eAAO,MAAM,cAAc,GACzB,IAAI,MAAM,EACV,IAAI,MAAM,EACV,MAAM,WAAW,KAChB,OAIyB,CAAC;AAE7B;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAC3B,IAAI,MAAM,EACV,IAAI,MAAM,EACV,QAAQ,MAAM,EACd,UAAU,KAAK,GAAG,QAAQ,KACzB,MAYF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,GACvB,OAAO,MAAM,GAAG,CAAC,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,SAAS,EAC3D,OAAO,MAAM,KACZ,MAAM,GAAG,SAGX,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,OAAO,MAAM,EACb,YAAY,aAAa,GAAG,SAAS,KACpC,MAAM,GAAG,SAMX,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,QAAQ,MAAM,EACd,OAAO,MAAM,EACb,MAAM,WAAW,EACjB,WAAW,cAAc,EACzB,UAAU,OAAO,KAChB;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,eAAe,CAAA;CAgB1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GACxB,QAAQ,MAAM,EACd,QAAQ,MAAM,EACd,eAAe,KAAK,GAAG,QAAQ,EAC/B,aAAa,OAAO,KACnB,MAQF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,iFASlC;IACD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,KAAK,GAAG,QAAQ,CAAC;IAChC,cAAc,EAAE,OAAO,CAAC;IACxB,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,cAAc,CAAC;CAC3B,KAAG;IACF,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,UAAU,EAAE,eAAe,CAAC;CAY7B,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { chartConfig as d } from "../config.js";
2
+ const { point: e } = d, p = (t, n, o) => t >= o.x && t <= o.x + o.width && n >= o.y && n <= o.y + o.height, m = (t, n, o, s) => {
3
+ const r = e.arrowWidth / 2;
4
+ if (s === "top") {
5
+ const h = n - o - e.labelGap, a = h - e.arrowHeight;
6
+ return `${t},${h} ${t - r},${a} ${t + r},${a}`;
7
+ }
8
+ const i = n + o + e.labelGap, c = i + e.arrowHeight;
9
+ return `${t},${i} ${t - r},${c} ${t + r},${c}`;
10
+ }, w = (t, n) => {
11
+ const o = typeof t == "function" ? t(n) : t;
12
+ return o === "" ? void 0 : o;
13
+ }, x = (t, n) => {
14
+ const o = n?.data;
15
+ if (!o || typeof o[0] != "number") return t;
16
+ const s = o.indexOf(t);
17
+ if (s !== -1)
18
+ return s;
19
+ }, u = (t, n, o, s, r) => {
20
+ if (s === "center")
21
+ return { x: t, textAnchor: "middle" };
22
+ const i = n.length * e.labelFontSize * e.labelCharWidthRatio / 2, c = r ? e.arrowWidth / 2 : 0;
23
+ return t - i < o.x ? { x: t - c, textAnchor: "start" } : t + i > o.x + o.width ? { x: t + c, textAnchor: "end" } : { x: t, textAnchor: "middle" };
24
+ }, b = (t, n, o, s) => {
25
+ const r = s ? e.arrowHeight + e.labelGap : e.labelGap;
26
+ return o === "top" ? t - n - r - e.labelGap : t + n + r + e.labelGap + e.labelFontSize;
27
+ }, G = ({
28
+ text: t,
29
+ pixelX: n,
30
+ pixelY: o,
31
+ size: s,
32
+ labelPosition: r,
33
+ showLabelArrow: i,
34
+ area: c,
35
+ alignment: h
36
+ }) => {
37
+ const { x: a, textAnchor: l } = u(
38
+ n,
39
+ t,
40
+ c,
41
+ h,
42
+ i
43
+ ), f = b(o, s / 2, r, i);
44
+ return { x: a, y: f, textAnchor: l };
45
+ };
46
+ export {
47
+ m as buildArrowPoints,
48
+ G as computeLabelGeometry,
49
+ u as computeLabelX,
50
+ b as computeLabelY,
51
+ p as isWithinBounds,
52
+ x as resolveDataXToIndex,
53
+ w as resolveLabel
54
+ };
@@ -0,0 +1,3 @@
1
+ import { ReferenceLineProps } from './types';
2
+ export declare function ReferenceLine(props: Readonly<ReferenceLineProps>): import("react/jsx-runtime").JSX.Element | null;
3
+ //# sourceMappingURL=ReferenceLine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReferenceLine.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/visualization/ReferenceLine/ReferenceLine.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAYlD,wBAAgB,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,kBAAkB,CAAC,kDAmChE"}
@@ -0,0 +1,42 @@
1
+ import { jsxs as f, jsx as i } from "react/jsx-runtime";
2
+ import { chartConfig as h } from "../config.js";
3
+ import { useReferenceLineGeometry as m } from "./useReferenceLineGeometry.js";
4
+ const { color: o, font: t, referenceLine: y, strokeWidth: x } = h, u = {
5
+ fill: o.textMuted,
6
+ fontSize: t.labelSize,
7
+ fontWeight: t.labelWeightMedium,
8
+ fontFamily: t.family
9
+ };
10
+ function A(n) {
11
+ const r = m(n), { label: l, stroke: a = o.stroke, lineStyle: s = "dashed" } = n, d = s === "dashed" ? y.dashArray : void 0;
12
+ if (!r) return null;
13
+ const { linePoints: c, labelCoords: e } = r;
14
+ return /* @__PURE__ */ f("g", { "data-testid": "reference-line", children: [
15
+ /* @__PURE__ */ i(
16
+ "line",
17
+ {
18
+ "data-testid": "reference-line-line",
19
+ ...c,
20
+ stroke: a,
21
+ strokeWidth: x.line,
22
+ strokeDasharray: d,
23
+ strokeLinecap: "round"
24
+ }
25
+ ),
26
+ e && /* @__PURE__ */ i(
27
+ "text",
28
+ {
29
+ "data-testid": "reference-line-label",
30
+ x: e.x,
31
+ y: e.y,
32
+ textAnchor: e.textAnchor,
33
+ dominantBaseline: e.dominantBaseline,
34
+ style: u,
35
+ children: l
36
+ }
37
+ )
38
+ ] });
39
+ }
40
+ export {
41
+ A as ReferenceLine
42
+ };
@@ -0,0 +1,3 @@
1
+ export * from './ReferenceLine';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/visualization/ReferenceLine/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC"}
@@ -0,0 +1,74 @@
1
+ export type LabelAlignment = 'start' | 'center' | 'end';
2
+ export type LabelPosition = 'start' | 'center' | 'end';
3
+ export type ReferenceLineBaseProps = {
4
+ /**
5
+ * Label text displayed near the reference line.
6
+ */
7
+ label?: string;
8
+ /**
9
+ * Horizontal pixel offset applied to the label position.
10
+ * @default 0
11
+ */
12
+ labelDx?: number;
13
+ /**
14
+ * Vertical pixel offset applied to the label position.
15
+ * @default 0
16
+ */
17
+ labelDy?: number;
18
+ /**
19
+ * Position of the label along the line.
20
+ * @default 'end'
21
+ */
22
+ labelPosition?: LabelPosition;
23
+ /**
24
+ * Controls the direction the label text extends from its position.
25
+ * - `'start'`: text extends toward the start of the axis (left)
26
+ * - `'center'`: text is centered on the position
27
+ * - `'end'`: text extends toward the end of the axis (right)
28
+ *
29
+ * Defaults: `'center'` for vertical lines, inferred from `labelPosition` for horizontal lines.
30
+ */
31
+ labelHorizontalAlignment?: LabelAlignment;
32
+ /**
33
+ * Controls the direction the label text extends from its position.
34
+ * - `'start'`: text extends toward the start of the axis (up)
35
+ * - `'center'`: text is vertically centered on the position
36
+ * - `'end'`: text extends toward the end of the axis (down)
37
+ *
38
+ * Defaults: `'end'` for horizontal lines, inferred from `labelPosition` for vertical lines.
39
+ */
40
+ labelVerticalAlignment?: LabelAlignment;
41
+ /**
42
+ * Line color.
43
+ * @default cssVar('var(--border-muted)')
44
+ */
45
+ stroke?: string;
46
+ /**
47
+ * Line dash style.
48
+ * - `'dashed'`: rounded dots with `strokeDasharray="0.1 6"`
49
+ * - `'solid'`: continuous line
50
+ * @default 'dashed'
51
+ */
52
+ lineStyle?: 'solid' | 'dashed';
53
+ };
54
+ export type HorizontalReferenceLineProps = ReferenceLineBaseProps & {
55
+ /**
56
+ * Y-axis value in data space where the horizontal line is drawn.
57
+ * The horizontal line is rendered at this Y position spanning the full
58
+ * width of the drawing area.
59
+ */
60
+ dataY: number;
61
+ dataX?: never;
62
+ };
63
+ export type VerticalReferenceLineProps = ReferenceLineBaseProps & {
64
+ /**
65
+ * Data index along the X axis. When `xAxis.data` contains numeric values,
66
+ * the index is mapped to the corresponding axis value automatically.
67
+ * The vertical line is drawn at this position spanning the full height
68
+ * of the drawing area.
69
+ */
70
+ dataX: number;
71
+ dataY?: never;
72
+ };
73
+ export type ReferenceLineProps = HorizontalReferenceLineProps | VerticalReferenceLineProps;
74
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/visualization/ReferenceLine/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AACxD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEvD,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;;;;;OAOG;IACH,wBAAwB,CAAC,EAAE,cAAc,CAAC;IAC1C;;;;;;;OAOG;IACH,sBAAsB,CAAC,EAAE,cAAc,CAAC;IACxC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,sBAAsB,GAAG;IAClE;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,sBAAsB,GAAG;IAChE;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAC1B,4BAA4B,GAC5B,0BAA0B,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { ReferenceLineProps } from './types';
2
+ import { LabelCoordinates } from './utils';
3
+ type ReferenceLineGeometry = {
4
+ linePoints: {
5
+ x1: number;
6
+ y1: number;
7
+ x2: number;
8
+ y2: number;
9
+ };
10
+ labelCoords: LabelCoordinates | null;
11
+ };
12
+ /**
13
+ * Resolves a reference line's chart geometry: reads the chart context, projects
14
+ * the targeted `dataX` (vertical) or `dataY` (horizontal) value to a validated
15
+ * pixel, and derives the line endpoints and optional label coordinates.
16
+ * Returns `null` when the value cannot be projected into the drawing area
17
+ * (see {@link resolvePixel}) or when neither axis is set.
18
+ */
19
+ export declare const useReferenceLineGeometry: (props: Readonly<ReferenceLineProps>) => ReferenceLineGeometry | null;
20
+ export {};
21
+ //# sourceMappingURL=useReferenceLineGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReferenceLineGeometry.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/visualization/ReferenceLine/useReferenceLineGeometry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,SAAS,CAAC;AAEjB,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,WAAW,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACtC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GACnC,OAAO,QAAQ,CAAC,kBAAkB,CAAC,KAClC,qBAAqB,GAAG,IAwD1B,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { resolvePixel as n, computeHorizontalLabelCoordinates as s, computeVerticalLabelCoordinates as c } from "./utils.js";
2
+ import { useCartesianChartContext as g } from "../CartesianChart/context/cartesianChartContext.js";
3
+ const m = (e) => {
4
+ const { getXScale: o, getYScale: x, getXAxisConfig: r, getYAxisConfig: d, drawingArea: l } = g(), t = {
5
+ labelPosition: e.labelPosition ?? "end",
6
+ drawingArea: l,
7
+ dx: e.labelDx ?? 0,
8
+ dy: e.labelDy ?? 0,
9
+ horizontalAlignment: e.labelHorizontalAlignment,
10
+ verticalAlignment: e.labelVerticalAlignment
11
+ };
12
+ if (e.dataY !== void 0) {
13
+ const a = n({
14
+ dataValue: e.dataY,
15
+ scale: x(),
16
+ axis: "y",
17
+ drawingArea: l,
18
+ axisConfig: d()
19
+ });
20
+ return a === void 0 ? null : {
21
+ linePoints: {
22
+ x1: l.x,
23
+ y1: a,
24
+ x2: l.x + l.width,
25
+ y2: a
26
+ },
27
+ labelCoords: e.label ? s({ pixel: a, ...t }) : null
28
+ };
29
+ }
30
+ const i = n({
31
+ dataValue: e.dataX,
32
+ scale: o(),
33
+ axis: "x",
34
+ drawingArea: l,
35
+ axisConfig: r()
36
+ });
37
+ return i === void 0 ? null : {
38
+ linePoints: {
39
+ x1: i,
40
+ y1: l.y,
41
+ x2: i,
42
+ y2: l.y + l.height
43
+ },
44
+ labelCoords: e.label ? c({ pixel: i, ...t }) : null
45
+ };
46
+ };
47
+ export {
48
+ m as useReferenceLineGeometry
49
+ };
@@ -0,0 +1,50 @@
1
+ import { BaseAxisProps } from '../Axis';
2
+ import { ChartScaleFunction, DrawingArea } from '../utils/types';
3
+ import { LabelAlignment, LabelPosition } from './types';
4
+ export type LabelCoordinates = {
5
+ x: number;
6
+ y: number;
7
+ textAnchor: 'start' | 'middle' | 'end';
8
+ dominantBaseline: 'hanging' | 'central' | 'auto';
9
+ };
10
+ type ResolvePixelParams = {
11
+ dataValue: number;
12
+ scale: ChartScaleFunction | undefined;
13
+ axis: 'x' | 'y';
14
+ drawingArea: DrawingArea;
15
+ axisConfig?: BaseAxisProps;
16
+ };
17
+ type LabelParams = {
18
+ pixel: number;
19
+ labelPosition: LabelPosition;
20
+ drawingArea: DrawingArea;
21
+ dx?: number;
22
+ dy?: number;
23
+ horizontalAlignment?: LabelAlignment;
24
+ verticalAlignment?: LabelAlignment;
25
+ };
26
+ /**
27
+ * Checks whether a pixel coordinate falls within the drawing area
28
+ * along a single axis.
29
+ */
30
+ export declare const isPixelWithinDrawingArea: (pixel: number, axis: "x" | "y", drawingArea: DrawingArea) => boolean;
31
+ /**
32
+ * Resolves a data-space value to a validated pixel coordinate.
33
+ * When `axisConfig` is provided, the data value is first translated
34
+ * through the axis data array before being projected onto the scale.
35
+ * Returns `undefined` if the value is out of bounds, the scale is missing,
36
+ * the result is not finite, or the pixel falls outside the drawing area.
37
+ */
38
+ export declare const resolvePixel: ({ dataValue, scale, axis, drawingArea, axisConfig, }: ResolvePixelParams) => number | undefined;
39
+ /**
40
+ * Computes the label pixel coordinates and text alignment attributes
41
+ * for a horizontal reference line.
42
+ */
43
+ export declare const computeHorizontalLabelCoordinates: ({ pixel, labelPosition, drawingArea, dx, dy, horizontalAlignment, verticalAlignment, }: LabelParams) => LabelCoordinates;
44
+ /**
45
+ * Computes the label pixel coordinates and text alignment attributes
46
+ * for a vertical reference line.
47
+ */
48
+ export declare const computeVerticalLabelCoordinates: ({ pixel, labelPosition, drawingArea, dx, dy, horizontalAlignment, verticalAlignment, }: LabelParams) => LabelCoordinates;
49
+ export {};
50
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/visualization/ReferenceLine/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,UAAU,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACvC,gBAAgB,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;CAClD,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACtC,IAAI,EAAE,GAAG,GAAG,GAAG,CAAC;IAChB,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,CAAC,EAAE,aAAa,CAAC;CAC5B,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,WAAW,CAAC;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,mBAAmB,CAAC,EAAE,cAAc,CAAC;IACrC,iBAAiB,CAAC,EAAE,cAAc,CAAC;CACpC,CAAC;AAuBF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GACnC,OAAO,MAAM,EACb,MAAM,GAAG,GAAG,GAAG,EACf,aAAa,WAAW,KACvB,OAKF,CAAC;AAqBF;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GAAI,sDAM1B,kBAAkB,KAAG,MAAM,GAAG,SAehC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iCAAiC,GAAI,wFAQ/C,WAAW,KAAG,gBAKf,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,+BAA+B,GAAI,wFAQ7C,WAAW,KAAG,gBAKf,CAAC"}