@semcore/d3-chart 18.0.0-prerelease.1 → 18.0.0-prerelease.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 (273) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/lib/cjs/Area.js +123 -23
  3. package/lib/cjs/Area.js.map +1 -1
  4. package/lib/cjs/Axis.js +109 -97
  5. package/lib/cjs/Axis.js.map +1 -1
  6. package/lib/cjs/Bar.js +16 -16
  7. package/lib/cjs/Bubble.js +14 -14
  8. package/lib/cjs/ChartMetaData.js +44 -0
  9. package/lib/cjs/ChartMetaData.js.map +1 -0
  10. package/lib/cjs/CompactHorizontalBar.js +16 -16
  11. package/lib/cjs/Donut.js +18 -19
  12. package/lib/cjs/Donut.js.map +1 -1
  13. package/lib/cjs/Dots.js +67 -13
  14. package/lib/cjs/Dots.js.map +1 -1
  15. package/lib/cjs/HorizontalBar.js +16 -16
  16. package/lib/cjs/Hover.js +66 -52
  17. package/lib/cjs/Hover.js.map +1 -1
  18. package/lib/cjs/Line.js +82 -17
  19. package/lib/cjs/Line.js.map +1 -1
  20. package/lib/cjs/Pattern.js +113 -2
  21. package/lib/cjs/Pattern.js.map +1 -1
  22. package/lib/cjs/Plot.js +5 -2
  23. package/lib/cjs/Plot.js.map +1 -1
  24. package/lib/cjs/Radar.js +19 -19
  25. package/lib/cjs/RadialTree.js +12 -12
  26. package/lib/cjs/Reference.js +55 -18
  27. package/lib/cjs/Reference.js.map +1 -1
  28. package/lib/cjs/ScatterPlot.js +9 -9
  29. package/lib/cjs/Tooltip.js +16 -14
  30. package/lib/cjs/Tooltip.js.map +1 -1
  31. package/lib/cjs/a11y/PlotA11yView.js +2 -2
  32. package/lib/cjs/component/Chart/AbstractChart.js +21 -18
  33. package/lib/cjs/component/Chart/AbstractChart.js.map +1 -1
  34. package/lib/cjs/component/Chart/AbstractChart.type.js +19 -0
  35. package/lib/cjs/component/Chart/AbstractChart.type.js.map +1 -1
  36. package/lib/cjs/component/Chart/AreaChart.js +21 -7
  37. package/lib/cjs/component/Chart/AreaChart.js.map +1 -1
  38. package/lib/cjs/component/Chart/AreaChart.type.js.map +1 -1
  39. package/lib/cjs/component/Chart/BarChart.js +6 -3
  40. package/lib/cjs/component/Chart/BarChart.js.map +1 -1
  41. package/lib/cjs/component/Chart/BarChart.type.js.map +1 -1
  42. package/lib/cjs/component/Chart/BubbleChart.js +4 -0
  43. package/lib/cjs/component/Chart/BubbleChart.js.map +1 -1
  44. package/lib/cjs/component/Chart/BubbleChart.type.js.map +1 -1
  45. package/lib/cjs/component/Chart/CigaretteChart.type.js.map +1 -1
  46. package/lib/cjs/component/Chart/CompactHorizontalBarChart.type.js.map +1 -1
  47. package/lib/cjs/component/Chart/DonutChart.js +0 -1
  48. package/lib/cjs/component/Chart/DonutChart.js.map +1 -1
  49. package/lib/cjs/component/Chart/DonutChart.type.js.map +1 -1
  50. package/lib/cjs/component/Chart/HistogramChart.js +6 -3
  51. package/lib/cjs/component/Chart/HistogramChart.js.map +1 -1
  52. package/lib/cjs/component/Chart/HistogramChart.type.js.map +1 -1
  53. package/lib/cjs/component/Chart/LineChart.js +16 -6
  54. package/lib/cjs/component/Chart/LineChart.js.map +1 -1
  55. package/lib/cjs/component/Chart/LineChart.type.js.map +1 -1
  56. package/lib/cjs/component/Chart/RadarChart.type.js.map +1 -1
  57. package/lib/cjs/component/Chart/ScatterPlotChart.type.js.map +1 -1
  58. package/lib/cjs/component/Chart/VennChart.type.js.map +1 -1
  59. package/lib/cjs/component/Chart/index.js +43 -0
  60. package/lib/cjs/component/Chart/index.js.map +1 -1
  61. package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
  62. package/lib/cjs/component/ChartLegend/LegendFlex/legend-flex.shadow.css +2 -2
  63. package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js +16 -16
  64. package/lib/cjs/component/ChartLegend/LegendItem/legend-item.shadow.css +11 -11
  65. package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +7 -7
  66. package/lib/cjs/component/ChartLegend/LegendTable/legend-table.shadow.css +2 -2
  67. package/lib/cjs/index.js +55 -1
  68. package/lib/cjs/index.js.map +1 -1
  69. package/lib/cjs/style/abstract-chart.shadow.css +13 -3
  70. package/lib/cjs/style/area.shadow.css +8 -5
  71. package/lib/cjs/style/axis.shadow.css +51 -60
  72. package/lib/cjs/style/bar.shadow.css +6 -6
  73. package/lib/cjs/style/bubble.shadow.css +3 -3
  74. package/lib/cjs/style/donut.shadow.css +2 -2
  75. package/lib/cjs/style/dot.shadow.css +37 -2
  76. package/lib/cjs/style/hover.shadow.css +30 -13
  77. package/lib/cjs/style/line.shadow.css +3 -3
  78. package/lib/cjs/style/pattern.shadow.css +10 -0
  79. package/lib/cjs/style/plotA11yView.shadow.css +3 -3
  80. package/lib/cjs/style/radar.shadow.css +7 -7
  81. package/lib/cjs/style/radial-tree.shadow.css +2 -2
  82. package/lib/cjs/style/reference.shadow.css +4 -4
  83. package/lib/cjs/style/scatterplot.shadow.css +1 -1
  84. package/lib/cjs/style/tooltip.shadow.css +12 -12
  85. package/lib/cjs/types/Axis.d.js.map +1 -1
  86. package/lib/cjs/types/Donut.d.js.map +1 -1
  87. package/lib/cjs/types/Hover.d.js.map +1 -1
  88. package/lib/cjs/utils.js +21 -1
  89. package/lib/cjs/utils.js.map +1 -1
  90. package/lib/es6/Area.js +125 -25
  91. package/lib/es6/Area.js.map +1 -1
  92. package/lib/es6/Axis.js +109 -97
  93. package/lib/es6/Axis.js.map +1 -1
  94. package/lib/es6/Bar.js +16 -16
  95. package/lib/es6/Bubble.js +14 -14
  96. package/lib/es6/ChartMetaData.js +36 -0
  97. package/lib/es6/ChartMetaData.js.map +1 -0
  98. package/lib/es6/CompactHorizontalBar.js +16 -16
  99. package/lib/es6/Donut.js +18 -19
  100. package/lib/es6/Donut.js.map +1 -1
  101. package/lib/es6/Dots.js +68 -14
  102. package/lib/es6/Dots.js.map +1 -1
  103. package/lib/es6/HorizontalBar.js +16 -16
  104. package/lib/es6/Hover.js +66 -52
  105. package/lib/es6/Hover.js.map +1 -1
  106. package/lib/es6/Line.js +84 -19
  107. package/lib/es6/Line.js.map +1 -1
  108. package/lib/es6/Pattern.js +108 -2
  109. package/lib/es6/Pattern.js.map +1 -1
  110. package/lib/es6/Plot.js +5 -2
  111. package/lib/es6/Plot.js.map +1 -1
  112. package/lib/es6/Radar.js +19 -19
  113. package/lib/es6/RadialTree.js +12 -12
  114. package/lib/es6/Reference.js +55 -18
  115. package/lib/es6/Reference.js.map +1 -1
  116. package/lib/es6/ScatterPlot.js +9 -9
  117. package/lib/es6/Tooltip.js +16 -14
  118. package/lib/es6/Tooltip.js.map +1 -1
  119. package/lib/es6/a11y/PlotA11yView.js +2 -2
  120. package/lib/es6/component/Chart/AbstractChart.js +21 -18
  121. package/lib/es6/component/Chart/AbstractChart.js.map +1 -1
  122. package/lib/es6/component/Chart/AbstractChart.type.js +14 -1
  123. package/lib/es6/component/Chart/AbstractChart.type.js.map +1 -1
  124. package/lib/es6/component/Chart/AreaChart.js +21 -7
  125. package/lib/es6/component/Chart/AreaChart.js.map +1 -1
  126. package/lib/es6/component/Chart/AreaChart.type.js.map +1 -1
  127. package/lib/es6/component/Chart/BarChart.js +6 -3
  128. package/lib/es6/component/Chart/BarChart.js.map +1 -1
  129. package/lib/es6/component/Chart/BarChart.type.js.map +1 -1
  130. package/lib/es6/component/Chart/BubbleChart.js +4 -0
  131. package/lib/es6/component/Chart/BubbleChart.js.map +1 -1
  132. package/lib/es6/component/Chart/BubbleChart.type.js.map +1 -1
  133. package/lib/es6/component/Chart/CigaretteChart.type.js.map +1 -1
  134. package/lib/es6/component/Chart/CompactHorizontalBarChart.type.js.map +1 -1
  135. package/lib/es6/component/Chart/DonutChart.js +0 -1
  136. package/lib/es6/component/Chart/DonutChart.js.map +1 -1
  137. package/lib/es6/component/Chart/DonutChart.type.js.map +1 -1
  138. package/lib/es6/component/Chart/HistogramChart.js +6 -3
  139. package/lib/es6/component/Chart/HistogramChart.js.map +1 -1
  140. package/lib/es6/component/Chart/HistogramChart.type.js.map +1 -1
  141. package/lib/es6/component/Chart/LineChart.js +14 -4
  142. package/lib/es6/component/Chart/LineChart.js.map +1 -1
  143. package/lib/es6/component/Chart/LineChart.type.js.map +1 -1
  144. package/lib/es6/component/Chart/RadarChart.type.js.map +1 -1
  145. package/lib/es6/component/Chart/ScatterPlotChart.type.js.map +1 -1
  146. package/lib/es6/component/Chart/VennChart.type.js.map +1 -1
  147. package/lib/es6/component/Chart/index.js +2 -0
  148. package/lib/es6/component/Chart/index.js.map +1 -1
  149. package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
  150. package/lib/es6/component/ChartLegend/LegendFlex/legend-flex.shadow.css +2 -2
  151. package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js +16 -16
  152. package/lib/es6/component/ChartLegend/LegendItem/legend-item.shadow.css +11 -11
  153. package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +7 -7
  154. package/lib/es6/component/ChartLegend/LegendTable/legend-table.shadow.css +2 -2
  155. package/lib/es6/index.js +1 -0
  156. package/lib/es6/index.js.map +1 -1
  157. package/lib/es6/style/abstract-chart.shadow.css +13 -3
  158. package/lib/es6/style/area.shadow.css +8 -5
  159. package/lib/es6/style/axis.shadow.css +51 -60
  160. package/lib/es6/style/bar.shadow.css +6 -6
  161. package/lib/es6/style/bubble.shadow.css +3 -3
  162. package/lib/es6/style/donut.shadow.css +2 -2
  163. package/lib/es6/style/dot.shadow.css +37 -2
  164. package/lib/es6/style/hover.shadow.css +30 -13
  165. package/lib/es6/style/line.shadow.css +3 -3
  166. package/lib/es6/style/pattern.shadow.css +10 -0
  167. package/lib/es6/style/plotA11yView.shadow.css +3 -3
  168. package/lib/es6/style/radar.shadow.css +7 -7
  169. package/lib/es6/style/radial-tree.shadow.css +2 -2
  170. package/lib/es6/style/reference.shadow.css +4 -4
  171. package/lib/es6/style/scatterplot.shadow.css +1 -1
  172. package/lib/es6/style/tooltip.shadow.css +12 -12
  173. package/lib/es6/types/Axis.d.js.map +1 -1
  174. package/lib/es6/types/Donut.d.js.map +1 -1
  175. package/lib/es6/types/Hover.d.js.map +1 -1
  176. package/lib/es6/utils.js +18 -0
  177. package/lib/es6/utils.js.map +1 -1
  178. package/lib/esm/Area.mjs +127 -26
  179. package/lib/esm/Axis.mjs +110 -98
  180. package/lib/esm/Bar.mjs +17 -17
  181. package/lib/esm/Bubble.mjs +15 -15
  182. package/lib/esm/ChartMetaData.mjs +38 -0
  183. package/lib/esm/CompactHorizontalBar.mjs +17 -17
  184. package/lib/esm/Donut.mjs +19 -20
  185. package/lib/esm/Dots.mjs +66 -15
  186. package/lib/esm/HorizontalBar.mjs +17 -17
  187. package/lib/esm/Hover.mjs +67 -53
  188. package/lib/esm/Line.mjs +86 -20
  189. package/lib/esm/Pattern.mjs +119 -0
  190. package/lib/esm/Plot.mjs +6 -3
  191. package/lib/esm/Radar.mjs +20 -20
  192. package/lib/esm/RadialTree.mjs +13 -13
  193. package/lib/esm/Reference.mjs +56 -19
  194. package/lib/esm/ScatterPlot.mjs +10 -10
  195. package/lib/esm/Tooltip.mjs +17 -15
  196. package/lib/esm/a11y/PlotA11yView.mjs +3 -3
  197. package/lib/esm/component/Chart/AbstractChart.mjs +22 -19
  198. package/lib/esm/component/Chart/AbstractChart.type.mjs +16 -0
  199. package/lib/esm/component/Chart/AreaChart.mjs +21 -7
  200. package/lib/esm/component/Chart/BarChart.mjs +6 -3
  201. package/lib/esm/component/Chart/BubbleChart.mjs +4 -0
  202. package/lib/esm/component/Chart/DonutChart.mjs +0 -1
  203. package/lib/esm/component/Chart/HistogramChart.mjs +6 -3
  204. package/lib/esm/component/Chart/LineChart.mjs +14 -4
  205. package/lib/esm/component/Chart/index.mjs +8 -0
  206. package/lib/esm/component/ChartLegend/LegendFlex/LegendFlex.mjs +5 -5
  207. package/lib/esm/component/ChartLegend/LegendFlex/legend-flex.shadow.css +2 -2
  208. package/lib/esm/component/ChartLegend/LegendItem/LegendItem.mjs +17 -17
  209. package/lib/esm/component/ChartLegend/LegendItem/legend-item.shadow.css +11 -11
  210. package/lib/esm/component/ChartLegend/LegendTable/LegendTable.mjs +8 -8
  211. package/lib/esm/component/ChartLegend/LegendTable/legend-table.shadow.css +2 -2
  212. package/lib/esm/index.mjs +8 -0
  213. package/lib/esm/style/abstract-chart.shadow.css +13 -3
  214. package/lib/esm/style/area.shadow.css +8 -5
  215. package/lib/esm/style/axis.shadow.css +51 -60
  216. package/lib/esm/style/bar.shadow.css +6 -6
  217. package/lib/esm/style/bubble.shadow.css +3 -3
  218. package/lib/esm/style/donut.shadow.css +2 -2
  219. package/lib/esm/style/dot.shadow.css +37 -2
  220. package/lib/esm/style/hover.shadow.css +30 -13
  221. package/lib/esm/style/line.shadow.css +3 -3
  222. package/lib/esm/style/pattern.shadow.css +10 -0
  223. package/lib/esm/style/plotA11yView.shadow.css +3 -3
  224. package/lib/esm/style/radar.shadow.css +7 -7
  225. package/lib/esm/style/radial-tree.shadow.css +2 -2
  226. package/lib/esm/style/reference.shadow.css +4 -4
  227. package/lib/esm/style/scatterplot.shadow.css +1 -1
  228. package/lib/esm/style/tooltip.shadow.css +12 -12
  229. package/lib/esm/utils.mjs +20 -0
  230. package/lib/types/Axis.d.ts +3 -2
  231. package/lib/types/ChartMetaData.d.ts +17 -0
  232. package/lib/types/ChartMetaData.d.ts.map +1 -0
  233. package/lib/types/Donut.d.ts +1 -1
  234. package/lib/types/Hover.d.ts +2 -0
  235. package/lib/types/Pattern.d.ts +18 -0
  236. package/lib/types/Pattern.d.ts.map +1 -1
  237. package/lib/types/component/Chart/AbstractChart.d.ts.map +1 -1
  238. package/lib/types/component/Chart/AbstractChart.type.d.ts +22 -4
  239. package/lib/types/component/Chart/AbstractChart.type.d.ts.map +1 -1
  240. package/lib/types/component/Chart/AreaChart.d.ts.map +1 -1
  241. package/lib/types/component/Chart/AreaChart.type.d.ts +8 -4
  242. package/lib/types/component/Chart/AreaChart.type.d.ts.map +1 -1
  243. package/lib/types/component/Chart/BarChart.d.ts.map +1 -1
  244. package/lib/types/component/Chart/BarChart.type.d.ts +1 -0
  245. package/lib/types/component/Chart/BarChart.type.d.ts.map +1 -1
  246. package/lib/types/component/Chart/BubbleChart.d.ts.map +1 -1
  247. package/lib/types/component/Chart/BubbleChart.type.d.ts +1 -1
  248. package/lib/types/component/Chart/BubbleChart.type.d.ts.map +1 -1
  249. package/lib/types/component/Chart/CigaretteChart.type.d.ts +1 -1
  250. package/lib/types/component/Chart/CigaretteChart.type.d.ts.map +1 -1
  251. package/lib/types/component/Chart/CompactHorizontalBarChart.type.d.ts +1 -1
  252. package/lib/types/component/Chart/CompactHorizontalBarChart.type.d.ts.map +1 -1
  253. package/lib/types/component/Chart/DonutChart.d.ts.map +1 -1
  254. package/lib/types/component/Chart/DonutChart.type.d.ts +1 -2
  255. package/lib/types/component/Chart/DonutChart.type.d.ts.map +1 -1
  256. package/lib/types/component/Chart/HistogramChart.d.ts.map +1 -1
  257. package/lib/types/component/Chart/HistogramChart.type.d.ts +1 -0
  258. package/lib/types/component/Chart/HistogramChart.type.d.ts.map +1 -1
  259. package/lib/types/component/Chart/LineChart.d.ts.map +1 -1
  260. package/lib/types/component/Chart/LineChart.type.d.ts +1 -0
  261. package/lib/types/component/Chart/LineChart.type.d.ts.map +1 -1
  262. package/lib/types/component/Chart/RadarChart.type.d.ts +1 -1
  263. package/lib/types/component/Chart/RadarChart.type.d.ts.map +1 -1
  264. package/lib/types/component/Chart/ScatterPlotChart.type.d.ts +1 -1
  265. package/lib/types/component/Chart/ScatterPlotChart.type.d.ts.map +1 -1
  266. package/lib/types/component/Chart/VennChart.type.d.ts +1 -1
  267. package/lib/types/component/Chart/VennChart.type.d.ts.map +1 -1
  268. package/lib/types/component/Chart/index.d.ts +2 -0
  269. package/lib/types/component/Chart/index.d.ts.map +1 -1
  270. package/lib/types/utils.d.ts +4 -1
  271. package/lib/types/utils.d.ts.map +1 -1
  272. package/package.json +15 -15
  273. package/lib/esm/utils/TextMeasurer.mjs +0 -27
package/lib/esm/Dots.mjs CHANGED
@@ -1,34 +1,42 @@
1
1
  import { sstyled } from "@semcore/core";
2
2
  import trottle from "@semcore/core/lib/utils/rafTrottle";
3
+ import { useUID } from "@semcore/core/lib/utils/uniqueID";
3
4
  import { bisector } from "d3-array";
4
5
  import React from "react";
6
+ import { INSIGHTFUL, BAD, GOOD, HIGHLIGHT_DOT } from "./component/Chart/AbstractChart.type.mjs";
5
7
  import createElement from "./createElement.mjs";
6
- import { getPatternSymbolSize, PatternSymbol } from "./Pattern.mjs";
8
+ import { getPatternSymbolSize, PotentialGradient, PatternSymbol } from "./Pattern.mjs";
7
9
  import { getChartDefaultColorName, interpolateValue, eventToPoint, invert } from "./utils.mjs";
8
10
  /*!__reshadow-styles__:"./style/dot.shadow.css"*/
9
11
  const style = (
10
12
  /*__reshadow_css_start__*/
11
13
  (sstyled.insert(
12
14
  /*__inner_css_start__*/
13
- ".___SDots_c7lp2_gg_ .___SDot_c7lp2_gg_{transition-duration:var(--duration_c7lp2)}.___SDot_c7lp2_gg_{stroke-width:1px;stroke:var(--intergalactic-chart-grid-border,#fff);fill:var(--intergalactic-chart-palette-order-1,oklch(.23 .01 140));transition-property:cx,cy,x,y,filter;transition-timing-function:ease-in-out}.___SDot_c7lp2_gg_.__active_c7lp2_gg_{filter:drop-shadow(0 0 1px rgba(0,12,8,.161)) drop-shadow(0 1px 1px rgba(0,12,8,.161))}@media (color-gamut:p3){.___SDot_c7lp2_gg_.__active_c7lp2_gg_{filter:drop-shadow(0 0 1px oklch(.137 .026 175.7/.161)) drop-shadow(0 1px 1px oklch(.137 .026 175.7/.161))}}.___SDot_c7lp2_gg_.__hide_c7lp2_gg_{display:none}.___SDot_c7lp2_gg_.__color_c7lp2_gg_{fill:var(--color_c7lp2)}.___SDot_c7lp2_gg_.__transparent_c7lp2_gg_{opacity:.3}",
15
+ ".___SDots_17cog_gg_ .___SDot_17cog_gg_{transition-duration:var(--duration_17cog)}.___SDot_17cog_gg_{stroke-width:1px;stroke:var(--intergalactic-chart-grid-border,#fff);fill:var(--intergalactic-chart-palette-order-1,oklch(.23 .009 245));transition-property:cx,cy,x,y,filter;transition-timing-function:ease-in-out}.___SDot_17cog_gg_.__active_17cog_gg_{filter:drop-shadow(0 0 1px rgba(0,12,8,.161)) drop-shadow(0 1px 1px rgba(0,12,8,.161))}@media (color-gamut:p3){.___SDot_17cog_gg_.__active_17cog_gg_{filter:drop-shadow(0 0 1px oklch(.137 .026 175.7/.161)) drop-shadow(0 1px 1px oklch(.137 .026 175.7/.161))}}.___SDot_17cog_gg_.__hide_17cog_gg_{display:none}.___SDot_17cog_gg_.__color_17cog_gg_{fill:var(--color_17cog)}.___SDotHighlight_17cog_gg_.__color_17cog_gg_{opacity:.4;fill:var(--color_17cog)}.___SDotHighlight_17cog_gg_.__transparent_17cog_gg_{opacity:.12}.___SDotBorder_17cog_gg_{fill:none;stroke-width:1px;stroke:var(--intergalactic-chart-grid-dot-outer-border,#191d211a);stroke-dasharray:2}.___SDotBorder_17cog_gg_.__transparent_17cog_gg_{opacity:.03}.___SDot_17cog_gg_.__transparent_17cog_gg_{opacity:.3}.___SDotBackdrop_17cog_gg_{stroke-width:1px;stroke:var(--intergalactic-chart-grid-border,#fff);fill:var(--intergalactic-chart-grid-border,#fff);transition-property:cx,cy;transition-duration:var(--duration_17cog);transition-timing-function:ease-in-out}.___SDotBackdrop_17cog_gg_.__hide_17cog_gg_{display:none}",
14
16
  /*__inner_css_end__*/
15
- "c7lp2_gg_"
17
+ "17cog_gg_"
16
18
  ), /*__reshadow_css_end__*/
17
19
  {
18
- "__SDot": "___SDot_c7lp2_gg_",
19
- "_active": "__active_c7lp2_gg_",
20
- "_hide": "__hide_c7lp2_gg_",
21
- "_color": "__color_c7lp2_gg_",
22
- "--color": "--color_c7lp2",
23
- "_transparent": "__transparent_c7lp2_gg_",
24
- "__SDots": "___SDots_c7lp2_gg_",
25
- "--duration": "--duration_c7lp2"
20
+ "__SDot": "___SDot_17cog_gg_",
21
+ "_active": "__active_17cog_gg_",
22
+ "_hide": "__hide_17cog_gg_",
23
+ "_color": "__color_17cog_gg_",
24
+ "--color": "--color_17cog",
25
+ "_transparent": "__transparent_17cog_gg_",
26
+ "__SDots": "___SDots_17cog_gg_",
27
+ "--duration": "--duration_17cog",
28
+ "__SDotHighlight": "___SDotHighlight_17cog_gg_",
29
+ "__SDotBorder": "___SDotBorder_17cog_gg_",
30
+ "__SDotBackdrop": "___SDotBackdrop_17cog_gg_"
26
31
  })
27
32
  );
28
33
  const BASE_RADIUS = 3.5;
29
34
  const ACTIVE_RADIUS = 4.5;
30
35
  function Dots(props) {
31
36
  var _ref3;
37
+ const SDotHighlight = "circle";
38
+ const SDotBorder = "circle";
39
+ const SDotBackdrop = "circle";
32
40
  const {
33
41
  Element: SDot,
34
42
  styles,
@@ -48,6 +56,7 @@ function Dots(props) {
48
56
  patterns,
49
57
  onClick
50
58
  } = props;
59
+ const uid = useUID();
51
60
  const bisect = bisector((d) => d[x]).center;
52
61
  const [activeIndex, setActiveIndex] = React.useState(null);
53
62
  const patternKey = color || getChartDefaultColorName(0);
@@ -71,6 +80,21 @@ function Dots(props) {
71
80
  const index = bisect(data, vX);
72
81
  onClick(index, e);
73
82
  }, [scale, data, onClick]);
83
+ const resolveHighlightColor = React.useCallback((highlight) => {
84
+ switch (highlight) {
85
+ case GOOD: {
86
+ return resolveColor("--intergalactic-chart-data-success");
87
+ }
88
+ case BAD: {
89
+ return resolveColor("--intergalactic-chart-data-critical");
90
+ }
91
+ case INSIGHTFUL: {
92
+ return `url(#dotGradient_${uid})`;
93
+ }
94
+ default:
95
+ return "";
96
+ }
97
+ }, [uid, resolveColor]);
74
98
  React.useEffect(() => {
75
99
  const unsubscribeMouseMoveRoot = eventEmitter.subscribe("onMouseMoveChart", (e) => {
76
100
  e.persist();
@@ -90,13 +114,38 @@ function Dots(props) {
90
114
  const isPrev = d3.defined()(data[i - 1] || {});
91
115
  const isNext = d3.defined()(data[i + 1] || {});
92
116
  const active = i === activeIndex;
93
- const visible = typeof display === "function" ? display(i, i === activeIndex, !isPrev && !isNext) : display || i === activeIndex || !isPrev && !isNext;
117
+ const visible = typeof display === "function" ? display(i, active, !isPrev && !isNext, d) : display || active || !isPrev && !isNext;
94
118
  const radius = active ? ACTIVE_RADIUS : radiusBase;
95
119
  if (!d3.defined()(d)) return acc;
96
120
  if (!visible) return acc;
97
121
  if (!patterns) {
98
122
  var _ref;
99
- acc.push((_ref = sstyled(styles), /* @__PURE__ */ React.createElement(SDot, _ref.cn("SDot", {
123
+ acc.push((_ref = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, {
124
+ key: i
125
+ }, d[HIGHLIGHT_DOT] && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SDotBorder, _ref.cn("SDotBorder", {
126
+ "visible": visible,
127
+ "active": active,
128
+ "hide": hide,
129
+ "transparent": transparent,
130
+ "cx": d3.x()(d),
131
+ "cy": d3.y()(d),
132
+ "r": 11.5
133
+ })), /* @__PURE__ */ React.createElement(SDotHighlight, _ref.cn("SDotHighlight", {
134
+ "color": resolveHighlightColor(d[HIGHLIGHT_DOT]),
135
+ "value": d,
136
+ "visible": visible,
137
+ "active": active,
138
+ "hide": hide,
139
+ "transparent": transparent,
140
+ "cx": d3.x()(d),
141
+ "cy": d3.y()(d),
142
+ "r": 8.5
143
+ }))), transparent && /* @__PURE__ */ React.createElement(SDotBackdrop, _ref.cn("SDotBackdrop", {
144
+ "hide": hide,
145
+ "cx": d3.x()(d),
146
+ "cy": d3.y()(d),
147
+ "r": radius
148
+ })), /* @__PURE__ */ React.createElement(SDot, _ref.cn("SDot", {
100
149
  "render": "circle",
101
150
  "color": resolveColor(color),
102
151
  "patternKey": patternKey,
@@ -111,7 +160,7 @@ function Dots(props) {
111
160
  "cy": d3.y()(d),
112
161
  "r": radius,
113
162
  "__excludeProps": ["display", "data", "scale"]
114
- }))));
163
+ })))));
115
164
  } else {
116
165
  var _ref2;
117
166
  acc.push((_ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(SDot, _ref2.cn("SDot", {
@@ -135,7 +184,9 @@ function Dots(props) {
135
184
  return _ref3 = sstyled(styles), /* @__PURE__ */ React.createElement(SDots, _ref3.cn("SDots", {
136
185
  "duration": `${duration}ms`,
137
186
  "onClickCapture": handlerOnClick
138
- }), patterns && /* @__PURE__ */ React.createElement(PatternSymbol, _ref3.cn("PatternSymbol", {
187
+ }), /* @__PURE__ */ React.createElement(PotentialGradient, _ref3.cn("PotentialGradient", {
188
+ "id": `dotGradient_${uid}`
189
+ })), patterns && /* @__PURE__ */ React.createElement(PatternSymbol, _ref3.cn("PatternSymbol", {
139
190
  "color": resolveColor(color),
140
191
  "patternKey": color,
141
192
  "id": svgPatternId,
@@ -11,26 +11,26 @@ const style = (
11
11
  /*__reshadow_css_start__*/
12
12
  (sstyled.insert(
13
13
  /*__inner_css_start__*/
14
- ".___SBar_1yabt_gg_{fill:var(--intergalactic-chart-palette-order-1,oklch(.23 .01 140));transition-property:height,width,y;transition-duration:var(--duration_1yabt);transition-timing-function:ease-in-out}.___SBar_1yabt_gg_.__color_1yabt_gg_{fill:var(--color_1yabt)}.___SBar_1yabt_gg_.__pattern_1yabt_gg_.__color_1yabt_gg_{fill:var(--pattern_1yabt);stroke:var(--color_1yabt);stroke-width:1px}.___SBar_1yabt_gg_.__hide_1yabt_gg_{display:none}.___SBar_1yabt_gg_.__transparent_1yabt_gg_{opacity:.3}.___SBar_1yabt_gg_.__onClick_1yabt_gg_{cursor:pointer}.___SBackground_1yabt_gg_{fill:var(--intergalactic-chart-grid-bar-chart-base-bg,oklch(.96 .001 180));opacity:.4}.___SBackground_1yabt_gg_.__onClick_1yabt_gg_{cursor:pointer}.___SBarAnnotation_1yabt_gg_{display:flex;justify-content:space-between}.___SBarLabel_1yabt_gg_{color:var(--intergalactic-text-primary,oklch(.1 .03 137/.899));margin-right:auto}.___SBarLabel_1yabt_gg_,.___SBarPercent_1yabt_gg_{font-size:var(--intergalactic-fs-200,14px);line-height:var(--intergalactic-lh-200,1.4286)}.___SBarPercent_1yabt_gg_{color:var(--intergalactic-text-secondary,oklch(.097 .023 156.5/.468));margin-right:var(--intergalactic-spacing-2x,8px)}.___SBarValue_1yabt_gg_{min-width:52px;display:flex;justify-content:flex-end;color:var(--intergalactic-text-primary,oklch(.1 .03 137/.899));font-size:var(--intergalactic-fs-200,14px);line-height:var(--intergalactic-lh-200,1.4286);text-align:right}.___SCompactHorizontalBarHoverRect_1yabt_gg_{fill:var(--intergalactic-chart-grid-bar-chart-hover,oklch(.177 .033 175.6/.042))}",
14
+ ".___SBar_avucd_gg_{fill:var(--intergalactic-chart-palette-order-1,oklch(.23 .009 245));transition-property:height,width,y;transition-duration:var(--duration_avucd);transition-timing-function:ease-in-out}.___SBar_avucd_gg_.__color_avucd_gg_{fill:var(--color_avucd)}.___SBar_avucd_gg_.__pattern_avucd_gg_.__color_avucd_gg_{fill:var(--pattern_avucd);stroke:var(--color_avucd);stroke-width:1px}.___SBar_avucd_gg_.__hide_avucd_gg_{display:none}.___SBar_avucd_gg_.__transparent_avucd_gg_{opacity:.3}.___SBar_avucd_gg_.__onClick_avucd_gg_{cursor:pointer}.___SBackground_avucd_gg_{fill:var(--intergalactic-chart-grid-bar-base-bg,oklch(.92 .008 233.5));opacity:.4}.___SBackground_avucd_gg_.__onClick_avucd_gg_{cursor:pointer}.___SBarAnnotation_avucd_gg_{display:flex;justify-content:space-between}.___SBarLabel_avucd_gg_{color:var(--intergalactic-text-primary,oklch(.23 .009 245));margin-right:auto}.___SBarLabel_avucd_gg_,.___SBarPercent_avucd_gg_{font-size:var(--intergalactic-fs-200,14px);line-height:var(--intergalactic-lh-200,1.4286)}.___SBarPercent_avucd_gg_{color:var(--intergalactic-text-secondary,oklch(.182 .045 244.8/.593));margin-right:var(--intergalactic-spacing-2x,8px)}.___SBarValue_avucd_gg_{min-width:52px;display:flex;justify-content:flex-end;color:var(--intergalactic-text-primary,oklch(.23 .009 245));font-size:var(--intergalactic-fs-200,14px);line-height:var(--intergalactic-lh-200,1.4286);text-align:right}.___SCompactHorizontalBarHoverRect_avucd_gg_{fill:var(--intergalactic-chart-grid-bar-hover,oklch(.375 .09 242.7/.05))}",
15
15
  /*__inner_css_end__*/
16
- "1yabt_gg_"
16
+ "avucd_gg_"
17
17
  ), /*__reshadow_css_end__*/
18
18
  {
19
- "__SBar": "___SBar_1yabt_gg_",
20
- "--duration": "--duration_1yabt",
21
- "_color": "__color_1yabt_gg_",
22
- "--color": "--color_1yabt",
23
- "_pattern": "__pattern_1yabt_gg_",
24
- "--pattern": "--pattern_1yabt",
25
- "_hide": "__hide_1yabt_gg_",
26
- "_transparent": "__transparent_1yabt_gg_",
27
- "_onClick": "__onClick_1yabt_gg_",
28
- "__SBackground": "___SBackground_1yabt_gg_",
29
- "__SBarAnnotation": "___SBarAnnotation_1yabt_gg_",
30
- "__SBarLabel": "___SBarLabel_1yabt_gg_",
31
- "__SBarPercent": "___SBarPercent_1yabt_gg_",
32
- "__SBarValue": "___SBarValue_1yabt_gg_",
33
- "__SCompactHorizontalBarHoverRect": "___SCompactHorizontalBarHoverRect_1yabt_gg_"
19
+ "__SBar": "___SBar_avucd_gg_",
20
+ "--duration": "--duration_avucd",
21
+ "_color": "__color_avucd_gg_",
22
+ "--color": "--color_avucd",
23
+ "_pattern": "__pattern_avucd_gg_",
24
+ "--pattern": "--pattern_avucd",
25
+ "_hide": "__hide_avucd_gg_",
26
+ "_transparent": "__transparent_avucd_gg_",
27
+ "_onClick": "__onClick_avucd_gg_",
28
+ "__SBackground": "___SBackground_avucd_gg_",
29
+ "__SBarAnnotation": "___SBarAnnotation_avucd_gg_",
30
+ "__SBarLabel": "___SBarLabel_avucd_gg_",
31
+ "__SBarPercent": "___SBarPercent_avucd_gg_",
32
+ "__SBarValue": "___SBarValue_avucd_gg_",
33
+ "__SCompactHorizontalBarHoverRect": "___SCompactHorizontalBarHoverRect_avucd_gg_"
34
34
  })
35
35
  );
36
36
  const MIN_WIDTH = 2;
package/lib/esm/Hover.mjs CHANGED
@@ -1,35 +1,41 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { sstyled, Component, assignProps } from "@semcore/core";
3
3
  import canUseDOM from "@semcore/core/lib/utils/canUseDOM";
4
+ import { getFocusableIn } from "@semcore/core/lib/utils/focus-lock/getFocusableIn";
4
5
  import { hasParent } from "@semcore/core/lib/utils/hasParent";
5
6
  import trottle from "@semcore/core/lib/utils/rafTrottle";
7
+ import useEnhancedEffect from "@semcore/core/lib/utils/use/useEnhancedEffect";
6
8
  import React from "react";
7
9
  import createElement from "./createElement.mjs";
8
10
  import Tooltip from "./Tooltip.mjs";
9
11
  import { eventToPoint, invert, getIndexFromData, scaleOfBandwidth, scaleToBand } from "./utils.mjs";
10
- import { TextMeasurer } from "./utils/TextMeasurer.mjs";
11
12
  /*!__reshadow-styles__:"./style/hover.shadow.css"*/
12
13
  const style = (
13
14
  /*__reshadow_css_start__*/
14
15
  (sstyled.insert(
15
16
  /*__inner_css_start__*/
16
- ".___SHoverLine_j53e0_gg_,.___SHoverLine_j53e0_gg_:focus-visible{outline:none;stroke:var(--intergalactic-chart-grid-x-axis,oklch(.88 .002 175.6))}.___SHoverRect_j53e0_gg_,.___SHoverRect_j53e0_gg_:focus-visible{outline:none;fill:var(--intergalactic-chart-grid-bar-chart-hover,oklch(.177 .033 175.6/.042))}.___STick_j53e0_gg_{font-size:var(--intergalactic-fs-100,12px);fill:var(--intergalactic-chart-grid-text-label,oklch(.097 .023 156.5/.468));transform:translateY(12px);text-anchor:middle;cursor:default}.___STick_j53e0_gg_,.___STick_j53e0_gg_ tspan{dominant-baseline:hanging}.___STickHover_j53e0_gg_{fill:var(--intergalactic-chart-x-axis-accent-tick,oklch(.96 .001 180))}",
17
+ '.___SHoverLine_zj7nr_gg_,.___SHoverLine_zj7nr_gg_:focus-visible{outline:none;stroke:var(--intergalactic-chart-grid-x-axis,oklch(.88 .011 234.9))}.___SHoverRect_zj7nr_gg_,.___SHoverRect_zj7nr_gg_:focus-visible{outline:none;fill:var(--intergalactic-chart-grid-bar-hover,oklch(.375 .09 242.7/.05))}.___SHoveredTickWrapper_zj7nr_gg_{font-size:var(--intergalactic-fs-100,12px);font-feature-settings:"tnum";font-variant-numeric:tabular-nums;line-height:var(--intergalactic-lh-100,1.3334);color:var(--intergalactic-chart-grid-text-label,#00132466);text-align:center}.___SHoveredTickWrapper_zj7nr_gg_[data-is-first=true]{text-align:left}.___SHoveredTickWrapper_zj7nr_gg_[data-is-last=true]{text-align:right}.___SHoveredTickWrapper_zj7nr_gg_._position_top_zj7nr_gg_ .___SHoveredTickContent_zj7nr_gg_{align-content:end}.___SHoveredTickWrapper_zj7nr_gg_ .___SHoveredTickContent_zj7nr_gg_{height:100%}.___SHoveredTickWrapper_zj7nr_gg_ .___SHoveredTick_zj7nr_gg_{display:inline-block;padding:3px 12px;border-radius:6px;background-color:var(--intergalactic-chart-x-axis-accent-tick,oklch(.96 .005 232.5))}',
17
18
  /*__inner_css_end__*/
18
- "j53e0_gg_"
19
+ "zj7nr_gg_"
19
20
  ), /*__reshadow_css_end__*/
20
21
  {
21
- "__SHoverLine": "___SHoverLine_j53e0_gg_",
22
- "__SHoverRect": "___SHoverRect_j53e0_gg_",
23
- "__STickHover": "___STickHover_j53e0_gg_",
24
- "__STick": "___STick_j53e0_gg_"
22
+ "__SHoverLine": "___SHoverLine_zj7nr_gg_",
23
+ "__SHoverRect": "___SHoverRect_zj7nr_gg_",
24
+ "__SHoveredTickWrapper": "___SHoveredTickWrapper_zj7nr_gg_",
25
+ "_position_top": "_position_top_zj7nr_gg_",
26
+ "__SHoveredTickContent": "___SHoveredTickContent_zj7nr_gg_",
27
+ "__SHoveredTick": "___SHoveredTick_zj7nr_gg_"
25
28
  })
26
29
  );
27
30
  const STROKE_WIDTH = 1;
28
31
  const NOTCH_WIDTH = 9;
29
32
  const NOTCH_DELTA = NOTCH_WIDTH / 2 - STROKE_WIDTH / 4;
30
- function formatValue(value) {
33
+ function formatValue(locale, value) {
31
34
  if (value instanceof Date) {
32
- return value.toLocaleDateString();
35
+ return new Intl.DateTimeFormat(locale ?? "en", {
36
+ day: "numeric",
37
+ month: "short"
38
+ }).format(value);
33
39
  }
34
40
  return value;
35
41
  }
@@ -40,7 +46,6 @@ class Hover extends Component {
40
46
  xIndex: null,
41
47
  yIndex: null
42
48
  });
43
- _defineProperty(this, "measurer", new TextMeasurer());
44
49
  _defineProperty(this, "virtualElement", canUseDOM() ? document.createElement("div") : {});
45
50
  _defineProperty(this, "handlerMouseMoveRoot", trottle((e, currentTarget, isTickUnder) => {
46
51
  const {
@@ -130,7 +135,9 @@ class HoverLineRoot extends Hover {
130
135
  render() {
131
136
  var _ref3;
132
137
  const {
133
- hideHoverLine
138
+ hideHoverLine,
139
+ meta,
140
+ locale
134
141
  } = this.asProps;
135
142
  const {
136
143
  xIndex,
@@ -176,14 +183,15 @@ class HoverLineRoot extends Hover {
176
183
  "y1": yRange[1],
177
184
  "y2": yRange[1]
178
185
  }))), !hideTickHover && /* @__PURE__ */ React.createElement(HoveredTick, _ref3.cn("HoveredTick", {
179
- "tickFormatter": dataHints.titles.getHorizontalAxesTitle ?? formatValue,
186
+ "size": meta.getTicksSize("horizontal"),
187
+ "position": meta.getTicksPosition("horizontal"),
188
+ "tickFormatter": dataHints.titles.getHorizontalAxesTitle ?? formatValue.bind(null, locale),
180
189
  "value": data[xIndex]?.[x],
181
190
  "isFirstTick": xIndex === 0,
182
191
  "isLastTick": xIndex === data.length - 1,
183
- "textMeasurer": this.measurer,
184
192
  "styles": styles,
185
193
  "x": x1,
186
- "y": yRange[0]
194
+ "yRange": yRange
187
195
  }))) : null, yIndex !== null ? /* @__PURE__ */ React.createElement(SHoverLine, _ref3.cn("SHoverLine", {
188
196
  "render": "g",
189
197
  "index": yIndex,
@@ -212,7 +220,8 @@ class HoverRectRoot extends Hover {
212
220
  render() {
213
221
  var _ref4;
214
222
  const {
215
- hideHoverLine
223
+ hideHoverLine,
224
+ meta
216
225
  } = this.asProps;
217
226
  if (hideHoverLine) {
218
227
  return null;
@@ -225,7 +234,8 @@ class HoverRectRoot extends Hover {
225
234
  data,
226
235
  scale,
227
236
  dataHints,
228
- hideTickHover
237
+ hideTickHover,
238
+ locale
229
239
  } = this.asProps;
230
240
  const {
231
241
  xIndex,
@@ -249,12 +259,13 @@ class HoverRectRoot extends Hover {
249
259
  "x": xScale(data[xIndex][x]) - xStep * xPaddingInner / 2,
250
260
  "y": yRange[1]
251
261
  })), !hideTickHover && /* @__PURE__ */ React.createElement(HoveredTick, _ref4.cn("HoveredTick", {
252
- "tickFormatter": dataHints.titles.getHorizontalAxesTitle ?? formatValue,
262
+ "size": meta.getTicksSize("horizontal"),
263
+ "position": meta.getTicksPosition("horizontal"),
264
+ "tickFormatter": dataHints.titles.getHorizontalAxesTitle ?? formatValue.bind(null, locale),
253
265
  "value": data[xIndex]?.[x],
254
- "textMeasurer": this.measurer,
255
266
  "styles": styles,
256
267
  "x": xScale(data[xIndex][x]) + xStep * (1 - xPaddingInner) / 2,
257
- "y": yRange[0]
268
+ "yRange": yRange
258
269
  }))), yIndex !== null && /* @__PURE__ */ React.createElement(SHoverRect, _ref4.cn("SHoverRect", {
259
270
  "aria-hidden": true,
260
271
  "render": "rect",
@@ -267,53 +278,56 @@ class HoverRectRoot extends Hover {
267
278
  }
268
279
  }
269
280
  _defineProperty(HoverRectRoot, "displayName", "HoverRect");
281
+ const HOVERED_TICK_MARGIN_Y = 8;
282
+ const HOVERED_TICK_PADDING_Y = 3;
270
283
  const HOVERED_TICK_PADDING_X = 12;
271
- const HOVERED_TICK_PADDING_Y = 4;
272
- const HOVERED_TOCK_BORDER_RADIUS = 6;
273
284
  function HoveredTick(props) {
274
285
  var _ref5;
275
286
  const {
276
- paddingX = HOVERED_TICK_PADDING_X,
277
- paddingY = HOVERED_TICK_PADDING_Y,
278
- borderRadius = HOVERED_TOCK_BORDER_RADIUS,
279
287
  tickFormatter,
280
288
  value,
281
289
  isFirstTick = false,
282
290
  isLastTick = false,
283
- textMeasurer,
284
291
  styles,
285
292
  x,
286
- y
293
+ yRange,
294
+ size,
295
+ position
287
296
  } = props;
288
- const STickWrapper = "g";
289
- const STickHover = "rect";
290
- const STick = "text";
297
+ const contentRef = React.useRef(null);
298
+ const [interactive, setInteractive] = React.useState(false);
291
299
  const formattedValue = tickFormatter(value);
300
+ const isMightBeInteractive = formattedValue !== null && typeof formattedValue === "object";
301
+ useEnhancedEffect(() => {
302
+ if (!isMightBeInteractive || !contentRef.current) {
303
+ setInteractive(false);
304
+ return;
305
+ }
306
+ setInteractive(getFocusableIn(contentRef.current).length > 0);
307
+ });
308
+ if (size?.width === void 0 || size?.height === void 0 || position === null) return null;
292
309
  const {
293
- width: textWidth,
294
- height: textHeight
295
- } = formattedValue !== void 0 ? textMeasurer.measure(formattedValue) : {
296
- width: 0,
297
- height: 0
298
- };
299
- const hoverX = isFirstTick ? x - NOTCH_DELTA : isLastTick ? x - textWidth - paddingX * 2 + NOTCH_DELTA : x - paddingX - textWidth / 2;
300
- const tickX = isFirstTick ? x + paddingX + textWidth / 2 - NOTCH_DELTA : isLastTick ? x - textWidth / 2 - paddingX + NOTCH_DELTA : x;
301
- const hoverPos = {
302
- x: hoverX,
303
- y: y + textHeight / 2 - paddingY / 2,
304
- width: textWidth + paddingX * 2,
305
- height: textHeight + paddingY * 2
306
- };
307
- const tickPos = {
308
- x: tickX,
309
- y
310
- };
311
- return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(STickWrapper, _ref5.cn("STickWrapper", {}), /* @__PURE__ */ React.createElement(STickHover, _ref5.cn("STickHover", {
312
- ...hoverPos,
313
- "rx": borderRadius
314
- })), /* @__PURE__ */ React.createElement(STick, _ref5.cn("STick", {
315
- ...tickPos
316
- }), formattedValue));
310
+ width,
311
+ height
312
+ } = size;
313
+ const SHoveredTickWrapper = "foreignObject";
314
+ const SHoveredTickContent = "div";
315
+ const SHoveredTick = "span";
316
+ const w = width + HOVERED_TICK_PADDING_X * 2;
317
+ const tickX = isFirstTick ? x : isLastTick ? x - w : x - w / 2;
318
+ const tickY = position === "top" ? yRange[1] - height - HOVERED_TICK_MARGIN_Y + HOVERED_TICK_PADDING_Y : yRange[0] + HOVERED_TICK_MARGIN_Y - HOVERED_TICK_PADDING_Y;
319
+ return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SHoveredTickWrapper, _ref5.cn("SHoveredTickWrapper", {
320
+ "x": tickX,
321
+ "y": tickY,
322
+ "width": w,
323
+ "height": height,
324
+ "data-is-first": isFirstTick,
325
+ "data-is-last": isLastTick,
326
+ "position": position,
327
+ "aria-hidden": interactive ? void 0 : true
328
+ }), /* @__PURE__ */ React.createElement(SHoveredTickContent, _ref5.cn("SHoveredTickContent", {
329
+ "ref": contentRef
330
+ }), /* @__PURE__ */ React.createElement(SHoveredTick, _ref5.cn("SHoveredTick", {}), formattedValue)));
317
331
  }
318
332
  function HoverLineTooltip(props) {
319
333
  var _ref = arguments[0], _ref6;
package/lib/esm/Line.mjs CHANGED
@@ -5,28 +5,31 @@ import { bisector } from "d3-array";
5
5
  import { line, curveLinear, curveCardinal, area } from "d3-shape";
6
6
  import React from "react";
7
7
  import AnimatedClipPath from "./AnimatedClipPath.mjs";
8
+ import "./component/Chart/index.mjs";
9
+ import { SvgElement } from "./component/SvgElement.mjs";
8
10
  import createElement from "./createElement.mjs";
9
11
  import Dots from "./Dots.mjs";
10
- import { resolvePatternDasharray } from "./Pattern.mjs";
11
- import { interpolateValue, getNullData, definedNullData, eventToPoint, invert, getChartDefaultColorName, definedData, scaleOfBandwidth } from "./utils.mjs";
12
+ import { ForecastGradient, StrokeMask, PotentialGradient, resolvePatternDasharray } from "./Pattern.mjs";
13
+ import { interpolateValue, getNullData, definedNullData, eventToPoint, invert, getDataOfType, getChartDefaultColorName, definedData, scaleOfBandwidth } from "./utils.mjs";
14
+ import { FORECAST, POTENTIAL, DATA_TYPE } from "./component/Chart/AbstractChart.type.mjs";
12
15
  /*!__reshadow-styles__:"./style/line.shadow.css"*/
13
16
  const style = (
14
17
  /*__reshadow_css_start__*/
15
18
  (sstyled.insert(
16
19
  /*__inner_css_start__*/
17
- ".___SLine_ty5xk_gg_{fill:#0000;stroke-width:2;stroke:var(--intergalactic-chart-palette-order-1,oklch(.23 .01 140));transition-property:d;transition-duration:var(--duration_ty5xk);transition-timing-function:ease-in-out}.___SLine_ty5xk_gg_.__color_ty5xk_gg_{stroke:var(--color_ty5xk)}.___SLine_ty5xk_gg_.__hide_ty5xk_gg_{display:none}.___SLine_ty5xk_gg_.__transparent_ty5xk_gg_{opacity:.3}.___SNull_ty5xk_gg_{fill:#0000;stroke:var(--intergalactic-chart-palette-order-null,oklch(.9 .002 177));stroke-dasharray:4}.___SNull_ty5xk_gg_.__hide_ty5xk_gg_{display:none}.___SLineArea_ty5xk_gg_{transition-property:d;transition-duration:var(--duration_ty5xk);transition-timing-function:ease-in-out;opacity:.3;fill:var(--intergalactic-chart-palette-order-1,oklch(.23 .01 140))}.___SLineArea_ty5xk_gg_.__color_ty5xk_gg_{fill:var(--color_ty5xk)}",
20
+ ".___SLine_1g38p_gg_{fill:#0000;stroke-width:2;stroke:var(--intergalactic-chart-palette-order-1,oklch(.23 .009 245));transition-property:d;transition-duration:var(--duration_1g38p);transition-timing-function:ease-in-out}.___SLine_1g38p_gg_.__color_1g38p_gg_{stroke:var(--color_1g38p)}.___SLine_1g38p_gg_.__hide_1g38p_gg_{display:none}.___SLine_1g38p_gg_.__transparent_1g38p_gg_{opacity:.3}.___SNull_1g38p_gg_{fill:#0000;stroke:var(--intergalactic-chart-palette-order-null,oklch(.9 .009 234));stroke-dasharray:4}.___SNull_1g38p_gg_.__hide_1g38p_gg_{display:none}.___SLineArea_1g38p_gg_{transition-property:d;transition-duration:var(--duration_1g38p);transition-timing-function:ease-in-out;opacity:.3;fill:var(--intergalactic-chart-palette-order-1,oklch(.23 .009 245))}.___SLineArea_1g38p_gg_.__color_1g38p_gg_{fill:var(--color_1g38p)}",
18
21
  /*__inner_css_end__*/
19
- "ty5xk_gg_"
22
+ "1g38p_gg_"
20
23
  ), /*__reshadow_css_end__*/
21
24
  {
22
- "__SLine": "___SLine_ty5xk_gg_",
23
- "--duration": "--duration_ty5xk",
24
- "_color": "__color_ty5xk_gg_",
25
- "--color": "--color_ty5xk",
26
- "_hide": "__hide_ty5xk_gg_",
27
- "_transparent": "__transparent_ty5xk_gg_",
28
- "__SNull": "___SNull_ty5xk_gg_",
29
- "__SLineArea": "___SLineArea_ty5xk_gg_"
25
+ "__SLine": "___SLine_1g38p_gg_",
26
+ "--duration": "--duration_1g38p",
27
+ "_color": "__color_1g38p_gg_",
28
+ "--color": "--color_1g38p",
29
+ "_hide": "__hide_1g38p_gg_",
30
+ "_transparent": "__transparent_1g38p_gg_",
31
+ "__SNull": "___SNull_1g38p_gg_",
32
+ "__SLineArea": "___SLineArea_1g38p_gg_"
30
33
  })
31
34
  );
32
35
  class LineRoot extends Component {
@@ -106,8 +109,71 @@ class LineRoot extends Component {
106
109
  const index = bisector((d) => d[x]).center(data, vX);
107
110
  onClick(index, e);
108
111
  }
109
- render() {
112
+ renderForecast() {
110
113
  var _ref;
114
+ const SLine = SvgElement;
115
+ const {
116
+ styles,
117
+ hide,
118
+ color,
119
+ resolveColor,
120
+ uid,
121
+ d3,
122
+ duration,
123
+ y,
124
+ transparent
125
+ } = this.asProps;
126
+ const data = getDataOfType(this.asProps.data, FORECAST, y);
127
+ return _ref = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SLine, _ref.cn("SLine", {
128
+ "aria-hidden": true,
129
+ "clipPath": `url(#${uid})`,
130
+ "tag": "path",
131
+ "hide": hide,
132
+ "color": resolveColor(color),
133
+ "transparent": transparent,
134
+ "d": d3(data),
135
+ "use:duration": `${duration}ms`,
136
+ "strokeDasharray": "4 4",
137
+ "onClickCapture": this.handlerOnClick.bind(this),
138
+ "pointerEvents": "stroke"
139
+ })), /* @__PURE__ */ React.createElement(ForecastGradient, _ref.cn("ForecastGradient", {
140
+ "id": `${uid}-forecast-gradient`
141
+ })), /* @__PURE__ */ React.createElement(StrokeMask, _ref.cn("StrokeMask", {
142
+ "id": `${uid}-forecast-mask`
143
+ })));
144
+ }
145
+ renderPotential() {
146
+ var _ref2;
147
+ const SLine = SvgElement;
148
+ const {
149
+ styles,
150
+ hide,
151
+ uid,
152
+ d3,
153
+ duration,
154
+ y,
155
+ transparent
156
+ } = this.asProps;
157
+ const data = getDataOfType(this.asProps.data, POTENTIAL, y);
158
+ return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SLine, _ref2.cn("SLine", {
159
+ "aria-hidden": true,
160
+ "clipPath": `url(#${uid})`,
161
+ "tag": "path",
162
+ "hide": hide,
163
+ "color": `url(#${uid}-potential-gradient-line)`,
164
+ "transparent": transparent,
165
+ "d": d3(data),
166
+ "use:duration": `${duration}ms`,
167
+ "onClickCapture": this.handlerOnClick.bind(this),
168
+ "pointerEvents": "stroke",
169
+ "strokeDasharray": "4 4"
170
+ })), /* @__PURE__ */ React.createElement(PotentialGradient, _ref2.cn("PotentialGradient", {
171
+ "id": `${uid}-potential-gradient-line`,
172
+ "type": "line"
173
+ })));
174
+ }
175
+ render() {
176
+ var _ref3;
111
177
  const SLine = this.Element;
112
178
  const {
113
179
  styles,
@@ -123,11 +189,11 @@ class LineRoot extends Component {
123
189
  transparent,
124
190
  patterns
125
191
  } = this.asProps;
126
- const data = this.asProps.data.filter((item) => item[y] !== interpolateValue);
192
+ const data = this.asProps.data.filter((item) => item[y] !== interpolateValue && item[DATA_TYPE] !== FORECAST && item[DATA_TYPE] !== POTENTIAL);
127
193
  this.asProps.dataHintsHandler.specifyDataRowFields(x, y);
128
194
  this.asProps.dataHintsHandler.establishDataType("time-series");
129
195
  const patternKey = color || getChartDefaultColorName(0);
130
- return _ref = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SLine, _ref.cn("SLine", {
196
+ return _ref3 = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, this.renderForecast(), this.renderPotential(), /* @__PURE__ */ React.createElement(SLine, _ref3.cn("SLine", {
131
197
  "aria-hidden": true,
132
198
  "clipPath": `url(#${uid})`,
133
199
  "render": "path",
@@ -139,7 +205,7 @@ class LineRoot extends Component {
139
205
  "strokeDasharray": patterns ? resolvePatternDasharray(patternKey, patterns) : void 0,
140
206
  "onClickCapture": this.handlerOnClick.bind(this),
141
207
  "pointerEvents": "stroke"
142
- })), duration && /* @__PURE__ */ React.createElement(AnimatedClipPath, _ref.cn("AnimatedClipPath", {
208
+ })), duration && /* @__PURE__ */ React.createElement(AnimatedClipPath, _ref3.cn("AnimatedClipPath", {
143
209
  "aria-hidden": true,
144
210
  "duration": duration,
145
211
  "id": uid,
@@ -167,7 +233,7 @@ _defineProperty(LineRoot, "defaultProps", ({
167
233
  };
168
234
  });
169
235
  function Null(props) {
170
- var _ref2;
236
+ var _ref4;
171
237
  const {
172
238
  Element: SNull,
173
239
  styles,
@@ -175,7 +241,7 @@ function Null(props) {
175
241
  data,
176
242
  hide
177
243
  } = props;
178
- return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(SNull, _ref2.cn("SNull", {
244
+ return _ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(SNull, _ref4.cn("SNull", {
179
245
  "render": "path",
180
246
  "d": d3(data),
181
247
  "hide": hide
@@ -217,9 +283,9 @@ function Area(props) {
217
283
  return chunked;
218
284
  }, [data, y0, y1, area$1, autoInterpolate]);
219
285
  return /* @__PURE__ */ React.createElement(React.Fragment, null, dataToArea.map((chunk, index) => {
220
- var _ref3;
286
+ var _ref5;
221
287
  const d3 = area().curve(curve).x((data2) => xScale(data2[x])).y0((data2) => yScale(data2[y0])).y1((data2) => yScale(data2[y1]));
222
- return _ref3 = sstyled(styles), /* @__PURE__ */ React.createElement(SLineArea, _ref3.cn("SLineArea", {
288
+ return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(SLineArea, _ref5.cn("SLineArea", {
223
289
  "key": `${chunk.length}-${index}`,
224
290
  "aria-hidden": true,
225
291
  "clipPath": `url(#${uid})`,