@semcore/d3-chart 3.60.0 → 3.60.1

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 (214) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/lib/cjs/Area.js +14 -12
  3. package/lib/cjs/Area.js.map +1 -1
  4. package/lib/cjs/Axis.js +17 -15
  5. package/lib/cjs/Axis.js.map +1 -1
  6. package/lib/cjs/Bar.js +19 -17
  7. package/lib/cjs/Bar.js.map +1 -1
  8. package/lib/cjs/Bubble.js +15 -13
  9. package/lib/cjs/Bubble.js.map +1 -1
  10. package/lib/cjs/CompactHorizontalBar.js +19 -17
  11. package/lib/cjs/CompactHorizontalBar.js.map +1 -1
  12. package/lib/cjs/Donut.js +12 -10
  13. package/lib/cjs/Donut.js.map +1 -1
  14. package/lib/cjs/Dots.js +11 -9
  15. package/lib/cjs/Dots.js.map +1 -1
  16. package/lib/cjs/HorizontalBar.js +19 -17
  17. package/lib/cjs/HorizontalBar.js.map +1 -1
  18. package/lib/cjs/Hover.js +6 -4
  19. package/lib/cjs/Hover.js.map +1 -1
  20. package/lib/cjs/Line.js +12 -10
  21. package/lib/cjs/Line.js.map +1 -1
  22. package/lib/cjs/Plot.js +6 -4
  23. package/lib/cjs/Plot.js.map +1 -1
  24. package/lib/cjs/Radar.js +22 -20
  25. package/lib/cjs/Radar.js.map +1 -1
  26. package/lib/cjs/RadialTree.js +15 -13
  27. package/lib/cjs/RadialTree.js.map +1 -1
  28. package/lib/cjs/Reference.js +15 -13
  29. package/lib/cjs/Reference.js.map +1 -1
  30. package/lib/cjs/ScatterPlot.js +12 -10
  31. package/lib/cjs/ScatterPlot.js.map +1 -1
  32. package/lib/cjs/Tooltip.js +12 -10
  33. package/lib/cjs/Tooltip.js.map +1 -1
  34. package/lib/cjs/Venn.js +12 -10
  35. package/lib/cjs/Venn.js.map +1 -1
  36. package/lib/cjs/a11y/PlotA11yModule.js +5 -3
  37. package/lib/cjs/a11y/PlotA11yModule.js.map +1 -1
  38. package/lib/cjs/a11y/PlotA11yView.js +5 -3
  39. package/lib/cjs/a11y/PlotA11yView.js.map +1 -1
  40. package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js +7 -5
  41. package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js.map +1 -1
  42. package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js +20 -18
  43. package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
  44. package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +9 -7
  45. package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js.map +1 -1
  46. package/lib/es6/Area.js +14 -12
  47. package/lib/es6/Area.js.map +1 -1
  48. package/lib/es6/Axis.js +17 -15
  49. package/lib/es6/Axis.js.map +1 -1
  50. package/lib/es6/Bar.js +19 -17
  51. package/lib/es6/Bar.js.map +1 -1
  52. package/lib/es6/Bubble.js +15 -13
  53. package/lib/es6/Bubble.js.map +1 -1
  54. package/lib/es6/CompactHorizontalBar.js +19 -17
  55. package/lib/es6/CompactHorizontalBar.js.map +1 -1
  56. package/lib/es6/Donut.js +12 -10
  57. package/lib/es6/Donut.js.map +1 -1
  58. package/lib/es6/Dots.js +11 -9
  59. package/lib/es6/Dots.js.map +1 -1
  60. package/lib/es6/HorizontalBar.js +19 -17
  61. package/lib/es6/HorizontalBar.js.map +1 -1
  62. package/lib/es6/Hover.js +6 -4
  63. package/lib/es6/Hover.js.map +1 -1
  64. package/lib/es6/Line.js +12 -10
  65. package/lib/es6/Line.js.map +1 -1
  66. package/lib/es6/Plot.js +6 -4
  67. package/lib/es6/Plot.js.map +1 -1
  68. package/lib/es6/Radar.js +22 -20
  69. package/lib/es6/Radar.js.map +1 -1
  70. package/lib/es6/RadialTree.js +15 -13
  71. package/lib/es6/RadialTree.js.map +1 -1
  72. package/lib/es6/Reference.js +15 -13
  73. package/lib/es6/Reference.js.map +1 -1
  74. package/lib/es6/ScatterPlot.js +12 -10
  75. package/lib/es6/ScatterPlot.js.map +1 -1
  76. package/lib/es6/Tooltip.js +12 -10
  77. package/lib/es6/Tooltip.js.map +1 -1
  78. package/lib/es6/Venn.js +12 -10
  79. package/lib/es6/Venn.js.map +1 -1
  80. package/lib/es6/a11y/PlotA11yModule.js +5 -3
  81. package/lib/es6/a11y/PlotA11yModule.js.map +1 -1
  82. package/lib/es6/a11y/PlotA11yView.js +5 -3
  83. package/lib/es6/a11y/PlotA11yView.js.map +1 -1
  84. package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js +7 -5
  85. package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js.map +1 -1
  86. package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js +20 -18
  87. package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
  88. package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +9 -7
  89. package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js.map +1 -1
  90. package/lib/esm/AnimatedClipPath.mjs +54 -0
  91. package/lib/esm/Area.mjs +189 -0
  92. package/lib/esm/Axis.mjs +406 -0
  93. package/lib/esm/Bar.mjs +201 -0
  94. package/lib/esm/Bubble.mjs +216 -0
  95. package/lib/esm/CompactHorizontalBar.mjs +518 -0
  96. package/lib/esm/Donut.mjs +415 -0
  97. package/lib/esm/Dots.mjs +120 -0
  98. package/lib/esm/GroupBar.mjs +94 -0
  99. package/lib/esm/HorizontalBar.mjs +181 -0
  100. package/lib/esm/Hover.mjs +217 -0
  101. package/lib/esm/Line.mjs +199 -0
  102. package/lib/esm/Pattern.mjs +520 -0
  103. package/lib/esm/Plot.mjs +137 -0
  104. package/lib/esm/Radar.mjs +706 -0
  105. package/lib/esm/RadialTree.mjs +565 -0
  106. package/lib/esm/Reference.mjs +243 -0
  107. package/lib/esm/ResponsiveContainer.mjs +99 -0
  108. package/lib/esm/ScatterPlot.mjs +194 -0
  109. package/lib/esm/StackBar.mjs +177 -0
  110. package/lib/esm/StackedArea.mjs +84 -0
  111. package/lib/esm/Tooltip.mjs +255 -0
  112. package/lib/esm/Venn.mjs +234 -0
  113. package/lib/esm/a11y/DataAccessibilityTable.mjs +100 -0
  114. package/lib/esm/a11y/PlotA11yModule.mjs +117 -0
  115. package/lib/esm/a11y/PlotA11yView.mjs +146 -0
  116. package/lib/esm/a11y/bezier.mjs +32 -0
  117. package/lib/esm/a11y/focus.mjs +44 -0
  118. package/lib/esm/a11y/hints.mjs +122 -0
  119. package/lib/esm/a11y/insights.mjs +700 -0
  120. package/lib/esm/a11y/intl.mjs +17 -0
  121. package/lib/esm/a11y/locale.mjs +39 -0
  122. package/lib/esm/a11y/serialize.mjs +363 -0
  123. package/lib/esm/a11y/summarize.mjs +14 -0
  124. package/lib/esm/a11y/translations/module/__intergalactic-dynamic-locales.mjs +33 -0
  125. package/lib/esm/a11y/translations/module/de.json.mjs +14 -0
  126. package/lib/esm/a11y/translations/module/en.json.mjs +14 -0
  127. package/lib/esm/a11y/translations/module/es.json.mjs +14 -0
  128. package/lib/esm/a11y/translations/module/fr.json.mjs +14 -0
  129. package/lib/esm/a11y/translations/module/it.json.mjs +14 -0
  130. package/lib/esm/a11y/translations/module/ja.json.mjs +14 -0
  131. package/lib/esm/a11y/translations/module/ko.json.mjs +14 -0
  132. package/lib/esm/a11y/translations/module/nl.json.mjs +14 -0
  133. package/lib/esm/a11y/translations/module/pl.json.mjs +14 -0
  134. package/lib/esm/a11y/translations/module/pt.json.mjs +14 -0
  135. package/lib/esm/a11y/translations/module/sv.json.mjs +14 -0
  136. package/lib/esm/a11y/translations/module/tr.json.mjs +14 -0
  137. package/lib/esm/a11y/translations/module/vi.json.mjs +14 -0
  138. package/lib/esm/a11y/translations/module/zh.json.mjs +14 -0
  139. package/lib/esm/a11y/translations/view/__intergalactic-dynamic-locales.mjs +33 -0
  140. package/lib/esm/a11y/translations/view/de.json.mjs +48 -0
  141. package/lib/esm/a11y/translations/view/en.json.mjs +48 -0
  142. package/lib/esm/a11y/translations/view/es.json.mjs +48 -0
  143. package/lib/esm/a11y/translations/view/fr.json.mjs +48 -0
  144. package/lib/esm/a11y/translations/view/it.json.mjs +48 -0
  145. package/lib/esm/a11y/translations/view/ja.json.mjs +48 -0
  146. package/lib/esm/a11y/translations/view/ko.json.mjs +48 -0
  147. package/lib/esm/a11y/translations/view/nl.json.mjs +48 -0
  148. package/lib/esm/a11y/translations/view/pl.json.mjs +48 -0
  149. package/lib/esm/a11y/translations/view/pt.json.mjs +48 -0
  150. package/lib/esm/a11y/translations/view/sv.json.mjs +48 -0
  151. package/lib/esm/a11y/translations/view/tr.json.mjs +48 -0
  152. package/lib/esm/a11y/translations/view/vi.json.mjs +48 -0
  153. package/lib/esm/a11y/translations/view/zh.json.mjs +48 -0
  154. package/lib/esm/color.mjs +127 -0
  155. package/lib/esm/component/Chart/AbstractChart.mjs +408 -0
  156. package/lib/esm/component/Chart/AreaChart.mjs +145 -0
  157. package/lib/esm/component/Chart/BarChart.mjs +240 -0
  158. package/lib/esm/component/Chart/BubbleChart.mjs +135 -0
  159. package/lib/esm/component/Chart/CigaretteChart.mjs +294 -0
  160. package/lib/esm/component/Chart/CompactHorizontalBarChart.mjs +113 -0
  161. package/lib/esm/component/Chart/DonutChart.mjs +113 -0
  162. package/lib/esm/component/Chart/HistogramChart.mjs +166 -0
  163. package/lib/esm/component/Chart/LineChart.mjs +131 -0
  164. package/lib/esm/component/Chart/RadarChart.mjs +115 -0
  165. package/lib/esm/component/Chart/ScatterPlotChart.mjs +144 -0
  166. package/lib/esm/component/Chart/VennChart.mjs +141 -0
  167. package/lib/esm/component/Chart/index.mjs +27 -0
  168. package/lib/esm/component/ChartLegend/BaseLegend.mjs +91 -0
  169. package/lib/esm/component/ChartLegend/LegendFlex/LegendFlex.mjs +86 -0
  170. package/lib/esm/component/ChartLegend/LegendFlex/legend-flex.shadow.css +12 -0
  171. package/lib/esm/component/ChartLegend/LegendItem/LegendItem.mjs +240 -0
  172. package/lib/esm/component/ChartLegend/LegendItem/LegendItem.type.mjs +4 -0
  173. package/lib/esm/component/ChartLegend/LegendItem/legend-item.shadow.css +129 -0
  174. package/lib/esm/component/ChartLegend/LegendTable/LegendTable.mjs +90 -0
  175. package/lib/esm/component/ChartLegend/LegendTable/legend-table.shadow.css +19 -0
  176. package/lib/esm/component/ChartLegend/index.mjs +5 -0
  177. package/lib/esm/component/Cigarette/Cigarette.mjs +139 -0
  178. package/lib/esm/component/StackGroupBar/StackGroupBar.mjs +141 -0
  179. package/lib/esm/createElement.mjs +104 -0
  180. package/lib/esm/index.mjs +70 -0
  181. package/lib/esm/style/area.shadow.css +50 -0
  182. package/lib/esm/style/axis.shadow.css +88 -0
  183. package/lib/esm/style/bar.shadow.css +66 -0
  184. package/lib/esm/style/bubble.shadow.css +64 -0
  185. package/lib/esm/style/donut.shadow.css +36 -0
  186. package/lib/esm/style/dot.shadow.css +27 -0
  187. package/lib/esm/style/hover.shadow.css +9 -0
  188. package/lib/esm/style/line.shadow.css +43 -0
  189. package/lib/esm/style/plot.shadow.css +19 -0
  190. package/lib/esm/style/plotA11yModule.shadow.css +12 -0
  191. package/lib/esm/style/plotA11yView.shadow.css +39 -0
  192. package/lib/esm/style/radar.shadow.css +80 -0
  193. package/lib/esm/style/radial-tree.shadow.css +54 -0
  194. package/lib/esm/style/reference.shadow.css +43 -0
  195. package/lib/esm/style/scatterplot.shadow.css +41 -0
  196. package/lib/esm/style/tooltip.shadow.css +42 -0
  197. package/lib/esm/style/venn.shadow.css +48 -0
  198. package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +31 -0
  199. package/lib/esm/translations/en.json.mjs +12 -0
  200. package/lib/esm/translations/es.json.mjs +11 -0
  201. package/lib/esm/translations/fr.json.mjs +11 -0
  202. package/lib/esm/translations/it.json.mjs +11 -0
  203. package/lib/esm/translations/ja.json.mjs +11 -0
  204. package/lib/esm/translations/ko.json.mjs +11 -0
  205. package/lib/esm/translations/nl.json.mjs +11 -0
  206. package/lib/esm/translations/pl.json.mjs +11 -0
  207. package/lib/esm/translations/pt.json.mjs +11 -0
  208. package/lib/esm/translations/sv.json.mjs +11 -0
  209. package/lib/esm/translations/tr.json.mjs +11 -0
  210. package/lib/esm/translations/vi.json.mjs +11 -0
  211. package/lib/esm/translations/zh.json.mjs +11 -0
  212. package/lib/esm/utils.mjs +266 -0
  213. package/package.json +11 -11
  214. package/vite.config.ts +2 -0
@@ -0,0 +1,243 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
4
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
8
+ import { sstyled } from "@semcore/utils/lib/core/index";
9
+ import React from "react";
10
+ import { sstyled as sstyled$1, Component } from "@semcore/core";
11
+ import uniqueIDEnhancement from "@semcore/utils/lib/uniqueID";
12
+ import createElement from "./createElement.mjs";
13
+ import { scaleOfBandwidth } from "./utils.mjs";
14
+ /*!__reshadow-styles__:"./style/reference.shadow.css"*/
15
+ var style = (
16
+ /*__reshadow_css_start__*/
17
+ (sstyled.insert(
18
+ /*__inner_css_start__*/
19
+ ".___SReferenceLine_157js_gg_{fill:none;stroke:var(--intergalactic-chart-grid-y-accent-hover-line, #a9abb6)}.___STitle_157js_gg_{font-size:var(--intergalactic-fs-100, 12px);fill:var(--intergalactic-chart-grid-text-label, #6c6e79);transform-origin:var(--transform-origin_157js)}.___STitle_157js_gg_._position_top_157js_gg_{text-anchor:middle}.___STitle_157js_gg_._position_bottom_157js_gg_{text-anchor:middle;dominant-baseline:hanging}.___STitle_157js_gg_._position_left_157js_gg_,.___STitle_157js_gg_._position_right_157js_gg_{transform:rotate(-90deg);text-anchor:middle;dominant-baseline:middle}.___SBackground_157js_gg_{fill:var(--intergalactic-chart-grid-period-bg, rgba(196, 199, 207, 0.2))}.___SStripes_157js_gg_{fill:var(--fill_157js)}.___SStripesPatternPath_157js_gg_{stroke:var(--intergalactic-chart-grid-period-pattern, rgba(25, 27, 35, 0.15));stroke-width:1px}",
20
+ /*__inner_css_end__*/
21
+ "157js_gg_"
22
+ ), /*__reshadow_css_end__*/
23
+ {
24
+ "__SReferenceLine": "___SReferenceLine_157js_gg_",
25
+ "__STitle": "___STitle_157js_gg_",
26
+ "--transform-origin": "--transform-origin_157js",
27
+ "_position_top": "_position_top_157js_gg_",
28
+ "_position_bottom": "_position_bottom_157js_gg_",
29
+ "_position_right": "_position_right_157js_gg_",
30
+ "_position_left": "_position_left_157js_gg_",
31
+ "__SBackground": "___SBackground_157js_gg_",
32
+ "__SStripes": "___SStripes_157js_gg_",
33
+ "--fill": "--fill_157js",
34
+ "__SStripesPatternPath": "___SStripesPatternPath_157js_gg_"
35
+ })
36
+ );
37
+ var side2direction = {
38
+ left: "vertical",
39
+ right: "vertical",
40
+ top: "horizontal",
41
+ bottom: "horizontal"
42
+ };
43
+ var lineDirection2props = {
44
+ vertical: function vertical(_ref5, value) {
45
+ var _ref6 = _slicedToArray(_ref5, 2), xScale = _ref6[0], yScale = _ref6[1];
46
+ var yRange = yScale.range();
47
+ var x = scaleOfBandwidth(xScale, value);
48
+ return {
49
+ x1: x,
50
+ x2: x,
51
+ y1: yRange[0],
52
+ y2: yRange[1]
53
+ };
54
+ },
55
+ horizontal: function horizontal(_ref7, value) {
56
+ var _ref8 = _slicedToArray(_ref7, 2), xScale = _ref8[0], yScale = _ref8[1];
57
+ var xRange = xScale.range();
58
+ var y = scaleOfBandwidth(yScale, value);
59
+ return {
60
+ x1: xRange[0],
61
+ x2: xRange[1],
62
+ y1: y,
63
+ y2: y
64
+ };
65
+ }
66
+ };
67
+ var rectDirection2props = {
68
+ vertical: function vertical2(_ref9, value, endValue) {
69
+ var _ref10 = _slicedToArray(_ref9, 2), xScale = _ref10[0], yScale = _ref10[1];
70
+ var yRange = yScale.range();
71
+ var x = scaleOfBandwidth(xScale, value);
72
+ var width = endValue !== void 0 ? scaleOfBandwidth(xScale, endValue) - x : 100;
73
+ return {
74
+ x,
75
+ y: yRange[1],
76
+ width,
77
+ height: yRange[0] - yRange[1]
78
+ };
79
+ },
80
+ horizontal: function horizontal2(_ref11, value, endValue) {
81
+ var _ref12 = _slicedToArray(_ref11, 2), xScale = _ref12[0], yScale = _ref12[1];
82
+ var xRange = xScale.range();
83
+ var y = scaleOfBandwidth(yScale, value);
84
+ var height = endValue !== void 0 ? scaleOfBandwidth(yScale, endValue) - y : 100;
85
+ return {
86
+ x: xRange[0],
87
+ y,
88
+ width: xRange[1] - xRange[0],
89
+ height
90
+ };
91
+ }
92
+ };
93
+ var titleOffset = 10;
94
+ var titleSideToProps = {
95
+ left: function left(_ref13, value) {
96
+ var _ref14 = _slicedToArray(_ref13, 2), xScale = _ref14[0], yScale = _ref14[1];
97
+ var yRange = yScale.range();
98
+ var x = scaleOfBandwidth(xScale, value);
99
+ return {
100
+ x: x - titleOffset,
101
+ y: (yRange[0] + yRange[1]) / 2
102
+ };
103
+ },
104
+ right: function right(_ref15, value) {
105
+ var _ref16 = _slicedToArray(_ref15, 2), xScale = _ref16[0], yScale = _ref16[1];
106
+ var yRange = yScale.range();
107
+ var x = scaleOfBandwidth(xScale, value);
108
+ return {
109
+ x: x + titleOffset,
110
+ y: (yRange[0] + yRange[1]) / 2
111
+ };
112
+ },
113
+ top: function top(_ref17, value) {
114
+ var _ref18 = _slicedToArray(_ref17, 2), xScale = _ref18[0], yScale = _ref18[1];
115
+ var xRange = xScale.range();
116
+ var y = scaleOfBandwidth(yScale, value);
117
+ return {
118
+ x: (xRange[1] + xRange[0]) / 2,
119
+ y: y - titleOffset
120
+ };
121
+ },
122
+ bottom: function bottom(_ref19, value) {
123
+ var _ref20 = _slicedToArray(_ref19, 2), xScale = _ref20[0], yScale = _ref20[1];
124
+ var xRange = xScale.range();
125
+ var y = scaleOfBandwidth(yScale, value);
126
+ return {
127
+ x: (xRange[1] + xRange[0]) / 2,
128
+ y: y + titleOffset
129
+ };
130
+ }
131
+ };
132
+ var ReferenceLineRoot = /* @__PURE__ */ function(_Component) {
133
+ _inherits(ReferenceLineRoot2, _Component);
134
+ var _super = _createSuper(ReferenceLineRoot2);
135
+ function ReferenceLineRoot2() {
136
+ _classCallCheck(this, ReferenceLineRoot2);
137
+ return _super.apply(this, arguments);
138
+ }
139
+ _createClass(ReferenceLineRoot2, [{
140
+ key: "getTitleProps",
141
+ value: function getTitleProps() {
142
+ var _this$asProps = this.asProps, position = _this$asProps.position, value = _this$asProps.value;
143
+ return {
144
+ position,
145
+ value
146
+ };
147
+ }
148
+ }, {
149
+ key: "getBackgroundProps",
150
+ value: function getBackgroundProps() {
151
+ var _this$asProps2 = this.asProps, position = _this$asProps2.position, value = _this$asProps2.value;
152
+ return {
153
+ position,
154
+ value
155
+ };
156
+ }
157
+ }, {
158
+ key: "render",
159
+ value: function render() {
160
+ var _ref;
161
+ var SReferenceLine = this.Element;
162
+ var _this$asProps3 = this.asProps, title = _this$asProps3.title, scale = _this$asProps3.scale, position = _this$asProps3.position, value = _this$asProps3.value, color = _this$asProps3.color, resolveColor = _this$asProps3.resolveColor, styles = _this$asProps3.styles;
163
+ var positionProps = lineDirection2props[side2direction[position]];
164
+ return _ref = sstyled$1(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SReferenceLine, _ref.cn("SReferenceLine", _objectSpread({
165
+ "render": "line",
166
+ "__excludeProps": ["data", "scale", "format", "value", "color"],
167
+ "stroke": resolveColor(color)
168
+ }, positionProps(scale, value)))), title && /* @__PURE__ */ React.createElement(ReferenceLine.Title, null, title));
169
+ }
170
+ }]);
171
+ return ReferenceLineRoot2;
172
+ }(Component);
173
+ _defineProperty(ReferenceLineRoot, "displayName", "ReferenceLine");
174
+ _defineProperty(ReferenceLineRoot, "style", style);
175
+ _defineProperty(ReferenceLineRoot, "defaultProps", {
176
+ position: "left"
177
+ });
178
+ function Title(props) {
179
+ var _ref2;
180
+ var STitle = props.Element, styles = props.styles, scale = props.scale, position = props.position, value = props.value;
181
+ var _titleSideToProps$pos = titleSideToProps[position](scale, value), x = _titleSideToProps$pos.x, y = _titleSideToProps$pos.y;
182
+ var sstyles = sstyled$1(styles);
183
+ var sTitleStyles = sstyles.cn("STitle", {
184
+ "transform-origin": "".concat(x.toFixed(2), "px ").concat(y.toFixed(2), "px")
185
+ });
186
+ return _ref2 = sstyled$1(styles), /* @__PURE__ */ React.createElement(STitle, _ref2.cn("STitle", {
187
+ "render": "text",
188
+ "childrenPosition": "inside",
189
+ "className": sTitleStyles.className,
190
+ "style": sTitleStyles.style,
191
+ "position": position,
192
+ "x": x,
193
+ "y": y
194
+ }));
195
+ }
196
+ function Background(props) {
197
+ var _ref3;
198
+ var SBackground = props.Element, styles = props.styles, scale = props.scale, _props$position = props.position, position = _props$position === void 0 ? "left" : _props$position, value = props.value, endValue = props.endValue;
199
+ var positionProps = rectDirection2props[side2direction[position]];
200
+ return _ref3 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SBackground, _ref3.cn("SBackground", _objectSpread({
201
+ "render": "rect",
202
+ "childrenPosition": "inside"
203
+ }, positionProps(scale, value, endValue))));
204
+ }
205
+ Background.style = style;
206
+ var diagonalGap = 8;
207
+ var gap = Math.sqrt(Math.pow(diagonalGap, 2) + Math.pow(diagonalGap, 2));
208
+ var gap12 = gap * (1 / 2);
209
+ var gap32 = gap * (3 / 2);
210
+ var path = "M-".concat(gap, ",-").concat(gap12, " L").concat(gap, ",").concat(gap32, " M-").concat(gap12, ",-").concat(gap, " L").concat(gap32, ",").concat(gap);
211
+ function Stripes(props) {
212
+ var _ref4;
213
+ var SStripes = props.Element, styles = props.styles, scale = props.scale, _props$position2 = props.position, position = _props$position2 === void 0 ? "left" : _props$position2, value = props.value, endValue = props.endValue, uid = props.uid;
214
+ var SStripesPatternPath = "path";
215
+ var positionProps = rectDirection2props[side2direction[position]];
216
+ var patternId = "".concat(uid, "-pattern");
217
+ return _ref4 = sstyled$1(styles), /* @__PURE__ */ React.createElement("g", _ref4.cn("g", {}), /* @__PURE__ */ React.createElement(SStripes, _ref4.cn("SStripes", _objectSpread({
218
+ "render": "rect",
219
+ "childrenPosition": "inside",
220
+ "fill": "url(#".concat(patternId, ")")
221
+ }, positionProps(scale, value, endValue)))), /* @__PURE__ */ React.createElement("pattern", _ref4.cn("pattern", {
222
+ "id": patternId,
223
+ "patternUnits": "userSpaceOnUse",
224
+ "width": gap,
225
+ "height": gap
226
+ }), /* @__PURE__ */ React.createElement(SStripesPatternPath, _ref4.cn("SStripesPatternPath", {
227
+ "d": path
228
+ }))));
229
+ }
230
+ Stripes.style = style;
231
+ Stripes.enhance = [uniqueIDEnhancement()];
232
+ var ReferenceLine = createElement(ReferenceLineRoot, {
233
+ Title,
234
+ Background,
235
+ Stripes
236
+ });
237
+ var ReferenceBackground = createElement(Background);
238
+ var ReferenceStripes = createElement(Stripes);
239
+ export {
240
+ ReferenceBackground,
241
+ ReferenceLine,
242
+ ReferenceStripes
243
+ };
@@ -0,0 +1,99 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
5
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
6
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
7
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
8
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
+ import createComponent, { sstyled, assignProps, Component } from "@semcore/core";
10
+ import React from "react";
11
+ import { Box } from "@semcore/flex-box";
12
+ import trottle from "@semcore/utils/lib/rafTrottle";
13
+ import fire from "@semcore/utils/lib/fire";
14
+ import getOriginChildren from "@semcore/utils/lib/getOriginChildren";
15
+ import canUseDOM from "@semcore/utils/lib/canUseDOM";
16
+ var ResponsiveContainerRoot = /* @__PURE__ */ function(_Component) {
17
+ _inherits(ResponsiveContainerRoot2, _Component);
18
+ var _super = _createSuper(ResponsiveContainerRoot2);
19
+ function ResponsiveContainerRoot2(props) {
20
+ var _this;
21
+ _classCallCheck(this, ResponsiveContainerRoot2);
22
+ _this = _super.call(this, props);
23
+ _defineProperty(_assertThisInitialized(_this), "containerRef", /* @__PURE__ */ React.createRef());
24
+ _defineProperty(_assertThisInitialized(_this), "size", [0, 0]);
25
+ _defineProperty(_assertThisInitialized(_this), "handleResize", trottle(function(entries) {
26
+ var _this$asProps = _this.asProps, Children = _this$asProps.Children, aspect = _this$asProps.aspect;
27
+ if (!_this.$container) return;
28
+ var _this$$container = _this.$container, width = _this$$container.clientWidth, height = _this$$container.clientHeight;
29
+ if (aspect) {
30
+ var style = window.getComputedStyle(_this.$container);
31
+ var minHeight = Number.parseInt(style.getPropertyValue("min-height"));
32
+ var maxHeight = Number.parseInt(style.getPropertyValue("max-height"));
33
+ height = width * aspect;
34
+ if (height < minHeight) {
35
+ height = minHeight;
36
+ }
37
+ if (height > maxHeight) {
38
+ height = maxHeight;
39
+ }
40
+ }
41
+ if (_this.size[0] === width && _this.size[1] === height) return;
42
+ _this.size = [width, height];
43
+ fire(_assertThisInitialized(_this), "onResize", _this.size, entries);
44
+ if (typeof getOriginChildren(Children) === "function") {
45
+ _this.forceUpdate();
46
+ }
47
+ }));
48
+ if (canUseDOM()) {
49
+ _this.observer = new ResizeObserver(_this.handleResize);
50
+ }
51
+ return _this;
52
+ }
53
+ _createClass(ResponsiveContainerRoot2, [{
54
+ key: "$container",
55
+ get: function get() {
56
+ return this.containerRef.current;
57
+ }
58
+ }, {
59
+ key: "setContext",
60
+ value: function setContext() {
61
+ var _this$size = _slicedToArray(this.size, 2), width = _this$size[0], height = _this$size[1];
62
+ return {
63
+ width,
64
+ height
65
+ };
66
+ }
67
+ }, {
68
+ key: "componentDidMount",
69
+ value: function componentDidMount() {
70
+ if (this.$container) {
71
+ var _this$observer;
72
+ (_this$observer = this.observer) === null || _this$observer === void 0 ? void 0 : _this$observer.observe(this.$container);
73
+ }
74
+ }
75
+ // TODO component did update ref?
76
+ }, {
77
+ key: "componentWillUnmount",
78
+ value: function componentWillUnmount() {
79
+ var _this$observer2;
80
+ (_this$observer2 = this.observer) === null || _this$observer2 === void 0 ? void 0 : _this$observer2.disconnect();
81
+ }
82
+ }, {
83
+ key: "render",
84
+ value: function render() {
85
+ var _ref = this.asProps, _ref2;
86
+ var SResponsiveContainer = Box;
87
+ var styles = this.asProps.styles;
88
+ return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(SResponsiveContainer, _ref2.cn("SResponsiveContainer", _objectSpread({}, assignProps({
89
+ "ref": this.containerRef
90
+ }, _ref))));
91
+ }
92
+ }]);
93
+ return ResponsiveContainerRoot2;
94
+ }(Component);
95
+ _defineProperty(ResponsiveContainerRoot, "displayName", "ResponsiveContainer");
96
+ var ResponsiveContainer = createComponent(ResponsiveContainerRoot);
97
+ export {
98
+ ResponsiveContainer as default
99
+ };
@@ -0,0 +1,194 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
5
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
6
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
7
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
8
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
+ import { sstyled } from "@semcore/utils/lib/core/index";
10
+ import { sstyled as sstyled$1, Component, assignProps } from "@semcore/core";
11
+ import React from "react";
12
+ import { transition } from "d3-transition";
13
+ import canUseDOM from "@semcore/utils/lib/canUseDOM";
14
+ import uniqueIDEnhancement from "@semcore/utils/lib/uniqueID";
15
+ import createElement from "./createElement.mjs";
16
+ import { getScatterPlotRadius } from "./utils.mjs";
17
+ import Tooltip from "./Tooltip.mjs";
18
+ import { PatternFill } from "./Pattern.mjs";
19
+ /*!__reshadow-styles__:"./style/scatterplot.shadow.css"*/
20
+ var style = (
21
+ /*__reshadow_css_start__*/
22
+ (sstyled.insert(
23
+ /*__inner_css_start__*/
24
+ ".___SScatterPlot_bcv24_gg_{fill:var(--intergalactic-chart-palette-order-1, #2bb3ff);transition-property:cx,cy;transition-duration:var(--duration_bcv24);transition-timing-function:ease-in-out;opacity:.5}@media (hover:hover){.___SScatterPlot_bcv24_gg_:hover{opacity:.8}}.___SScatterPlot_bcv24_gg_.__color_bcv24_gg_{fill:var(--color_bcv24)}.___SScatterPlot_bcv24_gg_.__pattern_bcv24_gg_.__color_bcv24_gg_{fill:var(--pattern_bcv24);stroke:var(--color_bcv24);stroke-width:1px}.___SScatterPlot_bcv24_gg_.__transparent_bcv24_gg_{opacity:.3}.___SValue_bcv24_gg_{text-anchor:middle;font-size:var(--intergalactic-fs-50, 10px);stroke:var(--intergalactic-chart-palette-order-9, #008ff8)}.___SValue_bcv24_gg_.__color_bcv24_gg_{stroke:var(--color_bcv24)}.___SValue_bcv24_gg_.__transparent_bcv24_gg_{opacity:.3}",
25
+ /*__inner_css_end__*/
26
+ "bcv24_gg_"
27
+ ), /*__reshadow_css_end__*/
28
+ {
29
+ "__SScatterPlot": "___SScatterPlot_bcv24_gg_",
30
+ "_color": "__color_bcv24_gg_",
31
+ "--color": "--color_bcv24",
32
+ "_pattern": "__pattern_bcv24_gg_",
33
+ "--pattern": "--pattern_bcv24",
34
+ "_transparent": "__transparent_bcv24_gg_",
35
+ "__SValue": "___SValue_bcv24_gg_",
36
+ "--duration": "--duration_bcv24"
37
+ })
38
+ );
39
+ var ScatterPlotRoot = /* @__PURE__ */ function(_Component) {
40
+ _inherits(ScatterPlotRoot2, _Component);
41
+ var _super = _createSuper(ScatterPlotRoot2);
42
+ function ScatterPlotRoot2() {
43
+ var _this;
44
+ _classCallCheck(this, ScatterPlotRoot2);
45
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
46
+ args[_key] = arguments[_key];
47
+ }
48
+ _this = _super.call.apply(_super, [this].concat(args));
49
+ _defineProperty(_assertThisInitialized(_this), "virtualElement", canUseDOM() ? document.createElement("div") : {});
50
+ _defineProperty(_assertThisInitialized(_this), "bindHandlerTooltip", function(visible, props, tooltipProps) {
51
+ return function(_ref4) {
52
+ var clientX = _ref4.clientX, clientY = _ref4.clientY;
53
+ var eventEmitter = _this.asProps.eventEmitter;
54
+ eventEmitter.emit("setTooltipPosition", clientX, clientY);
55
+ eventEmitter.emit("setTooltipRenderingProps", props, tooltipProps);
56
+ eventEmitter.emit("setTooltipVisible", visible);
57
+ };
58
+ });
59
+ return _this;
60
+ }
61
+ _createClass(ScatterPlotRoot2, [{
62
+ key: "generateGetBoundingClientRect",
63
+ value: function generateGetBoundingClientRect() {
64
+ var x = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
65
+ var y = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
66
+ return function() {
67
+ return {
68
+ width: 0,
69
+ height: 0,
70
+ top: y,
71
+ right: x,
72
+ bottom: y,
73
+ left: x
74
+ };
75
+ };
76
+ }
77
+ }, {
78
+ key: "animationCircle",
79
+ value: function animationCircle() {
80
+ var _this$asProps = this.asProps, duration = _this$asProps.duration, uid = _this$asProps.uid, r = _this$asProps.r, value = _this$asProps.value;
81
+ var radius = r ? r : getScatterPlotRadius(value);
82
+ var selectRect = transition().selection().selectAll("[id^=".concat(uid, "]")).attr("r", 0);
83
+ var selectRectNode = selectRect.node();
84
+ if (duration > 0 && selectRectNode) {
85
+ selectRect.transition().duration(duration).attr("r", radius);
86
+ }
87
+ }
88
+ }, {
89
+ key: "componentDidUpdate",
90
+ value: function componentDidUpdate(prevProps) {
91
+ if (prevProps.data !== this.props.data) {
92
+ this.animationCircle();
93
+ }
94
+ }
95
+ }, {
96
+ key: "componentDidMount",
97
+ value: function componentDidMount() {
98
+ this.animationCircle();
99
+ }
100
+ }, {
101
+ key: "renderCircle",
102
+ value: function renderCircle(d, i) {
103
+ var _ref2;
104
+ var _this$asProps2 = this.asProps, color = _this$asProps2.color, scale = _this$asProps2.scale, x = _this$asProps2.x, y = _this$asProps2.y, r = _this$asProps2.r, offset = _this$asProps2.offset, styles = _this$asProps2.styles, uid = _this$asProps2.uid, duration = _this$asProps2.duration, value = _this$asProps2.value, valueColor = _this$asProps2.valueColor, transparent = _this$asProps2.transparent, resolveColor = _this$asProps2.resolveColor, patterns = _this$asProps2.patterns;
105
+ var _scale = _slicedToArray(scale, 2), xScale = _scale[0], yScale = _scale[1];
106
+ var SScatterPlot = this.Element;
107
+ var SValue = "text";
108
+ if (Number.isNaN(d[x]) || Number.isNaN(d[y])) {
109
+ return null;
110
+ }
111
+ return _ref2 = sstyled$1(styles), /* @__PURE__ */ React.createElement("g", _ref2.cn("g", {
112
+ "aria-hidden": true,
113
+ "key": "circle(#".concat(i, ")"),
114
+ "onMouseMove": this.bindHandlerTooltip(true, this.props, {
115
+ xIndex: i,
116
+ index: i,
117
+ patterns
118
+ }),
119
+ "onMouseLeave": this.bindHandlerTooltip(false, this.props, {
120
+ xIndex: i,
121
+ index: i,
122
+ patterns
123
+ })
124
+ }), /* @__PURE__ */ React.createElement(SScatterPlot, _ref2.cn("SScatterPlot", {
125
+ "aria-hidden": true,
126
+ "id": "".concat(uid).concat(i),
127
+ "index": i,
128
+ "render": "circle",
129
+ "clipPath": "url(#".concat(uid, ")"),
130
+ "cx": xScale(d[x]) + offset[0],
131
+ "cy": yScale(d[y]) + offset[1],
132
+ "color": resolveColor(color),
133
+ "pattern": patterns ? "url(#".concat(uid, "-").concat(i, "-pattern)") : void 0,
134
+ "r": r,
135
+ "use:duration": "".concat(duration, "ms"),
136
+ "transparent": transparent
137
+ })), patterns && /* @__PURE__ */ React.createElement(PatternFill, _ref2.cn("PatternFill", {
138
+ "id": "".concat(uid, "-").concat(i, "-pattern"),
139
+ "patternKey": color,
140
+ "color": resolveColor(color),
141
+ "patterns": patterns
142
+ })), d[value] !== void 0 && /* @__PURE__ */ React.createElement(SValue, _ref2.cn("SValue", {
143
+ "aria-hidden": true,
144
+ "x": xScale(d[x]) + offset[0],
145
+ "y": yScale(d[y]) + offset[1],
146
+ "dy": ".3em",
147
+ "clipPath": "url(#".concat(uid, ")"),
148
+ "color": resolveColor(valueColor),
149
+ "transparent": transparent
150
+ }), d[value]));
151
+ }
152
+ }, {
153
+ key: "render",
154
+ value: function render() {
155
+ var _this$asProps3 = this.asProps, data = _this$asProps3.data, uid = _this$asProps3.uid, scale = _this$asProps3.scale, x = _this$asProps3.x, y = _this$asProps3.y, value = _this$asProps3.value;
156
+ var _scale2 = _slicedToArray(scale, 2), xScale = _scale2[0], yScale = _scale2[1];
157
+ var xSize = Math.abs(xScale.range()[0] - xScale.range()[1]);
158
+ var ySize = Math.abs(yScale.range()[0] - yScale.range()[1]);
159
+ var xMargin = Math.min(xScale.range()[0], xScale.range()[1]);
160
+ var yMargin = Math.min(yScale.range()[0], yScale.range()[1]);
161
+ this.asProps.dataHintsHandler.specifyDataRowFields(x, y, value);
162
+ this.asProps.dataHintsHandler.establishDataType("points-cloud");
163
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, data.map(this.renderCircle.bind(this)), /* @__PURE__ */ React.createElement("clipPath", {
164
+ id: uid
165
+ }, /* @__PURE__ */ React.createElement("rect", {
166
+ x: xMargin,
167
+ y: yMargin,
168
+ width: "".concat(xSize, "px"),
169
+ height: "".concat(ySize, "px")
170
+ })));
171
+ }
172
+ }]);
173
+ return ScatterPlotRoot2;
174
+ }(Component);
175
+ _defineProperty(ScatterPlotRoot, "displayName", "ScatterPlot");
176
+ _defineProperty(ScatterPlotRoot, "style", style);
177
+ _defineProperty(ScatterPlotRoot, "enhance", [uniqueIDEnhancement()]);
178
+ _defineProperty(ScatterPlotRoot, "defaultProps", {
179
+ offset: [0, 0],
180
+ duration: 500
181
+ });
182
+ var ScatterPlotTooltip = function ScatterPlotTooltip2(props) {
183
+ var _ref = arguments[0], _ref3;
184
+ var SScatterPlotTooltip = Tooltip;
185
+ return _ref3 = sstyled$1(props.styles), /* @__PURE__ */ React.createElement(SScatterPlotTooltip, _ref3.cn("SScatterPlotTooltip", _objectSpread({}, assignProps({
186
+ "excludeAnchorProps": true
187
+ }, _ref))));
188
+ };
189
+ var ScatterPlot = createElement(ScatterPlotRoot, {
190
+ Tooltip: [ScatterPlotTooltip, Tooltip._______childrenComponents]
191
+ });
192
+ export {
193
+ ScatterPlot as default
194
+ };