@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,520 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ import _typeof from "@babel/runtime/helpers/esm/typeof";
4
+ import React from "react";
5
+ import propsForElement from "@semcore/utils/lib/propsForElement";
6
+ var _excluded = ["color", "patternKey", "patterns"];
7
+ var defaultDasharrays = ["4 4", "8 8", "2 4", "4 8", "8 2", "8 4", "12 4", "2 2"];
8
+ var defaultPatterns = {
9
+ starSmall: {
10
+ fill: {
11
+ viewBox: "0 0 20 20",
12
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
13
+ d: "M9.062 2.535c.322-.871 1.554-.871 1.876 0l1.603 4.333a1 1 0 0 0 .591.59l4.333 1.604c.871.322.871 1.554 0 1.876l-4.333 1.603a1 1 0 0 0-.59.591l-1.604 4.333c-.322.871-1.554.871-1.876 0L7.46 13.132a1 1 0 0 0-.591-.59l-4.334-1.604c-.87-.322-.87-1.554 0-1.876L6.868 7.46a1 1 0 0 0 .59-.591l1.604-4.333Z"
14
+ }))
15
+ },
16
+ symbol: {
17
+ viewBox: "0 0 33 32",
18
+ size: [16, 16],
19
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
20
+ d: "M15.062 2.534c.322-.87 1.554-.87 1.876 0l3.224 8.713a1 1 0 0 0 .59.591l8.713 3.224c.871.322.871 1.554 0 1.876l-8.712 3.224a1 1 0 0 0-.591.59l-3.224 8.713c-.322.871-1.554.871-1.876 0l-3.224-8.712a1 1 0 0 0-.59-.591l-8.713-3.224c-.871-.322-.871-1.554 0-1.876l8.712-3.224a1 1 0 0 0 .591-.59l3.224-8.713Z"
21
+ }))
22
+ },
23
+ dasharray: defaultDasharrays[0]
24
+ },
25
+ romb: {
26
+ fill: {
27
+ viewBox: "0 0 20 20",
28
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
29
+ d: "M19.828 10 10 .172.172 10 10 19.828 19.828 10Z"
30
+ }))
31
+ },
32
+ symbol: {
33
+ viewBox: "0 0 20 20",
34
+ size: [14, 14],
35
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
36
+ d: "M20 10 10 0 0 10l10 10 10-10Z"
37
+ }))
38
+ },
39
+ dasharray: defaultDasharrays[1]
40
+ },
41
+ circleOutline: {
42
+ fill: {
43
+ viewBox: "0 0 20 20",
44
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
45
+ fillRule: "evenodd",
46
+ d: "M6 3a3 3 0 1 0 0 6 3 3 0 0 0 0-6ZM0 6a6 6 0 1 1 12 0A6 6 0 0 1 0 6Z",
47
+ clipRule: "evenodd"
48
+ }))
49
+ },
50
+ symbol: {
51
+ viewBox: "0 0 10 10",
52
+ size: [14, 14],
53
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
54
+ fillRule: "evenodd",
55
+ d: "M5 3a2 2 0 1 0 0 4 2 2 0 0 0 0-4ZM0 5a5 5 0 1 1 10 0A5 5 0 0 1 0 5Z",
56
+ clipRule: "evenodd"
57
+ }))
58
+ },
59
+ dasharray: defaultDasharrays[2]
60
+ },
61
+ triangleDown: {
62
+ fill: {
63
+ viewBox: "0 0 16 16",
64
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
65
+ d: "M7.99998 14L14.0622 3.5H1.93781L7.99998 14Z"
66
+ }))
67
+ },
68
+ symbol: {
69
+ viewBox: "0 0 33 32",
70
+ size: [16, 12],
71
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
72
+ d: "M16.56 26.755 29.12 5H4l12.56 21.755Z"
73
+ }))
74
+ },
75
+ dasharray: defaultDasharrays[3]
76
+ },
77
+ rombOutline: {
78
+ fill: {
79
+ viewBox: "0 0 20 20",
80
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
81
+ fillRule: "evenodd",
82
+ clipRule: "evenodd",
83
+ d: "M10 0.17157L19.8284 10L10 19.8284L0.17157 10L10 0.17157ZM5.82842 10L10 14.1716L14.1716 10L10 5.82842L5.82842 10Z"
84
+ }))
85
+ },
86
+ symbol: {
87
+ viewBox: "0 0 25 24",
88
+ size: [16.61, 16.61],
89
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
90
+ fillRule: "evenodd",
91
+ d: "M12.536 0 24.07 11.536 12.535 23.07 1 11.535 12.536 0ZM8.07 11.536 12.536 16 17 11.536 12.536 7.07 8.07 11.536Z",
92
+ clipRule: "evenodd"
93
+ }))
94
+ },
95
+ dasharray: defaultDasharrays[4]
96
+ },
97
+ square: {
98
+ fill: {
99
+ viewBox: "0 0 28 28",
100
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
101
+ d: "M18 2H2v16h16V2Z"
102
+ }))
103
+ },
104
+ symbol: {
105
+ viewBox: "0 0 21 20",
106
+ size: [18, 18],
107
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
108
+ d: "M17 3H3v14h14V3Z"
109
+ }))
110
+ },
111
+ dasharray: defaultDasharrays[5]
112
+ },
113
+ trees: {
114
+ fill: {
115
+ viewBox: "0 0 21 20",
116
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
117
+ d: "m19.536 12.456-9.415-9.415-9.415 9.415L5.21 16.96l4.912-4.913 4.913 4.913 4.502-4.503Z"
118
+ }))
119
+ },
120
+ symbol: {
121
+ viewBox: "0 0 21 20",
122
+ size: [16.14, 14],
123
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
124
+ d: "m19.536 12.456-9.415-9.415-9.415 9.415L5.21 16.96l4.912-4.913 4.913 4.913 4.502-4.503Z"
125
+ }))
126
+ },
127
+ dasharray: defaultDasharrays[6]
128
+ },
129
+ wave: {
130
+ fill: {
131
+ viewBox: "0 0 12 12",
132
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
133
+ fillRule: "evenodd",
134
+ clipRule: "evenodd",
135
+ d: "M3 5.5C2.4683 5.5 1.80116 5.78854 1.28624 6.64674L0.514495 7.93298L-2.05798 6.3895L-1.28624 5.10326C-0.30116 3.46146 1.2817 2.5 3 2.5C4.7183 2.5 6.30116 3.46146 7.28624 5.10326C7.80116 5.96146 8.4683 6.25 9 6.25C9.5317 6.25 10.1988 5.96146 10.7138 5.10326L11.4855 3.81702L14.058 5.3605L13.2862 6.64674C12.3012 8.28854 10.7183 9.25 9 9.25C7.2817 9.25 5.69884 8.28854 4.71376 6.64674C4.19884 5.78854 3.5317 5.5 3 5.5Z"
136
+ }))
137
+ },
138
+ symbol: {
139
+ viewBox: "0 0 21 20",
140
+ size: [17.14, 14],
141
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
142
+ d: "m20.121 6.457-.027-.017-1.43 2.383c-.954 1.59-2.19 2.125-3.176 2.125-.985 0-2.22-.534-3.175-2.125C10.488 5.781 7.555 4 4.372 4c-1.503 0-2.95.397-4.25 1.136v8.339l1.074-1.792c.954-1.59 2.19-2.125 3.176-2.125.985 0 2.22.535 3.175 2.125 1.825 3.042 4.758 4.823 7.942 4.823 1.651 0 3.235-.479 4.632-1.365V6.457Z"
143
+ }))
144
+ },
145
+ dasharray: defaultDasharrays[7]
146
+ },
147
+ star: {
148
+ fill: {
149
+ viewBox: "0 0 21 20",
150
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
151
+ d: "M9.17 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 0 0 .951.69h3.461c.969 0 1.372 1.24.588 1.81l-2.8 2.034a1 1 0 0 0-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.539 1.118l-2.8-2.034a1 1 0 0 0-1.175 0l-2.8 2.034c-.784.57-1.839-.197-1.54-1.118l1.07-3.292a1 1 0 0 0-.363-1.118L3.1 8.72c-.784-.57-.381-1.81.587-1.81H7.15a1 1 0 0 0 .95-.69l1.07-3.292Z"
152
+ }))
153
+ },
154
+ symbol: {
155
+ viewBox: "0 0 33 32",
156
+ size: [16.41, 15.66],
157
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
158
+ d: "M15.049.927c.3-.921 1.603-.921 1.902 0l2.866 8.82a1 1 0 0 0 .95.69h9.274c.97 0 1.372 1.24.588 1.81l-7.502 5.45a1 1 0 0 0-.364 1.119l2.866 8.82c.3.92-.755 1.687-1.539 1.117l-7.502-5.45a1 1 0 0 0-1.176 0l-7.502 5.45c-.784.57-1.838-.196-1.54-1.118l2.867-8.82a1 1 0 0 0-.364-1.117l-7.502-5.451c-.784-.57-.381-1.81.588-1.81h9.273a1 1 0 0 0 .951-.69L15.05.927Z"
159
+ }))
160
+ },
161
+ dasharray: defaultDasharrays[0]
162
+ },
163
+ cogwheel: {
164
+ fill: {
165
+ viewBox: "0 0 20 20",
166
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
167
+ fillRule: "evenodd",
168
+ clipRule: "evenodd",
169
+ d: "M10.0622 1L18.1244 5.6547V14.9641L10.0622 19.6188L2 14.9641V5.6547L10.0622 1ZM6 7.9641V12.6547L10.0622 15L14.1244 12.6547V7.9641L10.0622 5.6188L6 7.9641Z"
170
+ }))
171
+ },
172
+ symbol: {
173
+ viewBox: "0 0 21 20",
174
+ size: [16.95, 16.95],
175
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
176
+ fillRule: "evenodd",
177
+ d: "m10.121.113 8.562 4.944v9.886l-8.562 4.944-8.562-4.944V5.057L10.121.113ZM6.56 7.943v4.114l3.562 2.056 3.563-2.056V7.943L10.12 5.887 6.56 7.943Z",
178
+ clipRule: "evenodd"
179
+ }))
180
+ },
181
+ dasharray: defaultDasharrays[1]
182
+ },
183
+ crossesDiagonal: {
184
+ fill: {
185
+ viewBox: "0 0 20 20",
186
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
187
+ fillRule: "evenodd",
188
+ d: "M3.683 3.683a2.333 2.333 0 0 1 3.3 0L10 6.7l3.017-3.017a2.333 2.333 0 1 1 3.3 3.3L13.3 10l3.017 3.017a2.333 2.333 0 0 1-3.3 3.3L10 13.3l-3.017 3.017a2.333 2.333 0 0 1-3.3-3.3L6.7 10 3.683 6.983a2.333 2.333 0 0 1 0-3.3Z",
189
+ clipRule: "evenodd"
190
+ }))
191
+ },
192
+ symbol: {
193
+ viewBox: "0 0 20 20",
194
+ size: [18, 18],
195
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
196
+ fillRule: "evenodd",
197
+ d: "M3.683 3.683a2.333 2.333 0 0 1 3.3 0L10 6.7l3.017-3.017a2.333 2.333 0 1 1 3.3 3.3L13.3 10l3.017 3.017a2.333 2.333 0 0 1-3.3 3.3L10 13.3l-3.017 3.017a2.333 2.333 0 0 1-3.3-3.3L6.7 10 3.683 6.983a2.333 2.333 0 0 1 0-3.3Z",
198
+ clipRule: "evenodd"
199
+ }))
200
+ },
201
+ dasharray: defaultDasharrays[2]
202
+ },
203
+ triangleOutline: {
204
+ fill: {
205
+ viewBox: "0 0 18 18",
206
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
207
+ fillRule: "evenodd",
208
+ clipRule: "evenodd",
209
+ d: "M8.99998 2L16.7942 15.5H1.20575L8.99998 2ZM6.4019 12.5H11.5981L8.99998 8L6.4019 12.5Z"
210
+ }))
211
+ },
212
+ symbol: {
213
+ viewBox: "0 0 33 32",
214
+ size: [18, 18],
215
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
216
+ fillRule: "evenodd",
217
+ d: "m15.99 4 13.99 24.231H2L15.99 4Zm0 12.923-2.798 4.847h5.596l-2.798-4.847Z",
218
+ clipRule: "evenodd"
219
+ }))
220
+ },
221
+ dasharray: defaultDasharrays[3]
222
+ },
223
+ chain: {
224
+ fill: {
225
+ viewBox: "0 0 24 14",
226
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
227
+ fillRule: "evenodd",
228
+ clipRule: "evenodd",
229
+ d: "M6.8453 -2H17.1547L21.1547 4.9282H26V8.9282H21.1547L17.1547 15.8564H6.8453L2.8453 8.9282H-2V4.9282H2.8453L6.8453 -2ZM6.3094 6.9282L9.1547 11.8564H14.8453L17.6906 6.9282L14.8453 2H9.1547L6.3094 6.9282Z"
230
+ }))
231
+ },
232
+ symbol: {
233
+ viewBox: "0 0 25 24",
234
+ size: [17.28, 17.28],
235
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
236
+ fillRule: "evenodd",
237
+ d: "M6.557 2.572h10.886l4 6.928h2.678v5h-2.678l-4 6.928H6.557l-4-6.928H.12v-5h2.436l4-6.928ZM6.887 12l2.556 4.428h5.114L17.113 12l-2.556-4.428H9.443L6.887 12Z",
238
+ clipRule: "evenodd"
239
+ }))
240
+ },
241
+ dasharray: defaultDasharrays[4]
242
+ },
243
+ squama: {
244
+ fill: {
245
+ viewBox: "0 0 18 18",
246
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
247
+ d: "M12.314 12a8 8 0 0 0 0-11.314L1 12a8 8 0 0 0 11.314 0Z"
248
+ }))
249
+ },
250
+ symbol: {
251
+ viewBox: "0 0 18 18",
252
+ size: [13.66, 13.66],
253
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
254
+ d: "M12.314 12a8 8 0 0 0 0-11.314L1 12a8 8 0 0 0 11.314 0Z"
255
+ }))
256
+ },
257
+ dasharray: defaultDasharrays[5]
258
+ },
259
+ linesDouble: {
260
+ fill: {
261
+ viewBox: "0 0 16 16",
262
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
263
+ d: "M11 0H14V16H11V0Z"
264
+ }), /* @__PURE__ */ React.createElement("path", {
265
+ d: "M5 0H8V16H5V0Z"
266
+ }))
267
+ },
268
+ symbol: {
269
+ viewBox: "0 0 17 16",
270
+ size: [16, 16],
271
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
272
+ d: "M9.121 2h4v12h-4V2ZM4.121 2h4v12h-4V2Z"
273
+ }))
274
+ },
275
+ dasharray: defaultDasharrays[6]
276
+ },
277
+ zigzagVertical: {
278
+ fill: {
279
+ viewBox: "0 0 12 12",
280
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
281
+ d: "M12 1.94 7.84 6.151l4.16 4.06V1.94ZM0 10.18V1.972L1.948 0h4.217L.128 6.112 6.16 12H1.865L0 10.18Z"
282
+ }))
283
+ },
284
+ symbol: {
285
+ viewBox: "0 0 21 20",
286
+ size: [15.85, 17.14],
287
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
288
+ d: "m1.757 10 10-10h8.486l-10 10 10 10h-8.486l-10-10Z"
289
+ }))
290
+ },
291
+ dasharray: defaultDasharrays[7]
292
+ },
293
+ triangleDownOutline: {
294
+ fill: {
295
+ viewBox: "0 0 18 18",
296
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
297
+ fillRule: "evenodd",
298
+ clipRule: "evenodd",
299
+ d: "M8.99998 17L16.7942 3.5H1.20575L8.99998 17ZM6.4019 6.5H11.5981L8.99998 11L6.4019 6.5Z"
300
+ }))
301
+ },
302
+ symbol: {
303
+ viewBox: "0 0 33 32",
304
+ size: [16, 13.22],
305
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
306
+ fillRule: "evenodd",
307
+ d: "M15.99 28 29.98 3.769H2L15.99 28Zm0-12.923-2.798-4.847h5.596l-2.798 4.847Z",
308
+ clipRule: "evenodd"
309
+ }))
310
+ },
311
+ dasharray: defaultDasharrays[0]
312
+ },
313
+ crosses: {
314
+ fill: {
315
+ viewBox: "0 0 22 22",
316
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
317
+ d: "M8 0a2.286 2.286 0 0 0-2.286 2.286v3.428H2.286a2.286 2.286 0 0 0 0 4.572h3.428v3.428a2.286 2.286 0 1 0 4.572 0v-3.428h3.428a2.286 2.286 0 1 0 0-4.572h-3.428V2.286A2.286 2.286 0 0 0 8 0Z"
318
+ }))
319
+ },
320
+ symbol: {
321
+ viewBox: "0 0 16 16",
322
+ size: [18, 18],
323
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
324
+ d: "M8 0a2.286 2.286 0 0 0-2.286 2.286v3.428H2.286a2.286 2.286 0 0 0 0 4.572h3.428v3.428a2.286 2.286 0 1 0 4.572 0v-3.428h3.428a2.286 2.286 0 1 0 0-4.572h-3.428V2.286A2.286 2.286 0 0 0 8 0Z"
325
+ }))
326
+ },
327
+ dasharray: defaultDasharrays[1]
328
+ },
329
+ linesDoubleHorizontal: {
330
+ fill: {
331
+ viewBox: "0 0 16 16",
332
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
333
+ d: "M16 11v3H0v-3h16ZM16 5v3H0V5h16Z"
334
+ }))
335
+ },
336
+ symbol: {
337
+ viewBox: "0 0 17 16",
338
+ size: [16, 16],
339
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
340
+ d: "M2 8V4h12v4H2ZM2 13V9h12v4H2Z"
341
+ }))
342
+ },
343
+ dasharray: defaultDasharrays[2]
344
+ },
345
+ waveVertical: {
346
+ fill: {
347
+ viewBox: "0 0 12 12",
348
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
349
+ fillRule: "evenodd",
350
+ clipRule: "evenodd",
351
+ d: "M5.625 8.875C5.625 9.4067 5.91354 10.0738 6.77174 10.5888L8.05798 11.3605L6.5145 13.933L5.22826 13.1612C3.58646 12.1762 2.625 10.5933 2.625 8.875C2.625 7.1567 3.58646 5.57384 5.22826 4.58876C6.08646 4.07384 6.375 3.4067 6.375 2.875C6.375 2.3433 6.08646 1.67616 5.22826 1.16124L3.94202 0.389496L5.4855 -2.18298L6.77174 -1.41124C8.41354 -0.42616 9.375 1.1567 9.375 2.875C9.375 4.5933 8.41354 6.17616 6.77174 7.16124C5.91354 7.67616 5.625 8.3433 5.625 8.875Z"
352
+ }))
353
+ },
354
+ symbol: {
355
+ viewBox: "0 0 21 20",
356
+ size: [16, 17.14],
357
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
358
+ d: "M8.823 1.336 6.596 0h8.62a8.593 8.593 0 0 1 1.29 4.512c0 3.183-1.78 6.116-4.823 7.941-1.59.954-2.125 2.19-2.125 3.176 0 .985.535 2.22 2.125 3.175L13.677 20H5.206A8.578 8.578 0 0 1 4 15.629c0-3.184 1.781-6.117 4.823-7.942 1.59-.954 2.125-2.19 2.125-3.175 0-.986-.534-2.222-2.125-3.176Z"
359
+ }))
360
+ },
361
+ dasharray: defaultDasharrays[3]
362
+ },
363
+ squareOutline: {
364
+ fill: {
365
+ viewBox: "0 0 22 22",
366
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
367
+ fillRule: "evenodd",
368
+ d: "M2 2h16v16H2V2Zm4.364 4.364v7.272h7.272V6.364H6.364Z",
369
+ clipRule: "evenodd"
370
+ }))
371
+ },
372
+ symbol: {
373
+ viewBox: "0 0 21 20",
374
+ size: [18, 18],
375
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
376
+ fillRule: "evenodd",
377
+ d: "M1.5 1.5h17v17h-17v-17Zm5 5v7h7v-7h-7Z",
378
+ clipRule: "evenodd"
379
+ }))
380
+ },
381
+ dasharray: defaultDasharrays[4]
382
+ },
383
+ triangle: {
384
+ fill: {
385
+ viewBox: "0 0 21 20",
386
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
387
+ d: "m10 2 8.66 15H1.34L10 2Z"
388
+ }))
389
+ },
390
+ symbol: {
391
+ viewBox: "0 0 33 32",
392
+ size: [16, 16],
393
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
394
+ d: "m15.66 5 12.66 21.928H3L15.66 5Z"
395
+ }))
396
+ },
397
+ dasharray: defaultDasharrays[5]
398
+ },
399
+ crescent: {
400
+ fill: {
401
+ viewBox: "0 0 21 20",
402
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
403
+ d: "M18.501 16.748c.269-.293.018-.748-.38-.748A9 9 0 0 1 11.466.94c.32-.35.13-.941-.345-.941-5.523 0-10 4.477-10 10s4.477 10 10 10a9.974 9.974 0 0 0 7.38-3.252Z"
404
+ }))
405
+ },
406
+ symbol: {
407
+ viewBox: "0 0 21 20",
408
+ size: [14.99, 17.14],
409
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
410
+ d: "M18.501 16.748c.269-.293.018-.748-.38-.748A9 9 0 0 1 11.466.94c.32-.35.13-.941-.345-.941-5.523 0-10 4.477-10 10s4.477 10 10 10a9.974 9.974 0 0 0 7.38-3.252Z"
411
+ }))
412
+ },
413
+ dasharray: defaultDasharrays[6]
414
+ },
415
+ zigzag: {
416
+ fill: {
417
+ viewBox: "0 0 12 12",
418
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
419
+ d: "M6 4.621 1.379 0H5.62L6 .379 6.379 0h4.242L6 4.621ZM0 10.621 1.379 12H5.62L0 6.379v4.242ZM6.379 12h4.242L12 10.621V6.38L6.379 12Z"
420
+ }))
421
+ },
422
+ symbol: {
423
+ viewBox: "0 0 21 21",
424
+ size: [17.14, 16.02],
425
+ children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("path", {
426
+ d: "m20.121 1.284-9.797 9.797L.121.88v8.485l10.203 10.203 9.797-9.797V1.284Z"
427
+ }))
428
+ },
429
+ dasharray: defaultDasharrays[7]
430
+ }
431
+ };
432
+ var defaultPatternsList = Object.values(defaultPatterns);
433
+ var patternsKeysOrderCache = /* @__PURE__ */ new WeakMap();
434
+ patternsKeysOrderCache.set(defaultPatternsList, []);
435
+ var resolvePatternIndex = function resolvePatternIndex2(patternKey, patterns) {
436
+ if (_typeof(patterns) !== "object") return 0;
437
+ if (!patternsKeysOrderCache.has(patterns)) {
438
+ patternsKeysOrderCache.set(patterns, []);
439
+ }
440
+ var patternsKeysCachedList = patternsKeysOrderCache.get(patterns);
441
+ var index = patternsKeysCachedList.indexOf(patternKey);
442
+ if (index === -1) {
443
+ index = patternsKeysCachedList.length;
444
+ patternsKeysCachedList.push(patternKey);
445
+ }
446
+ return index;
447
+ };
448
+ var resolvePattern = function resolvePattern2(patternKey) {
449
+ var patternsConfig = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
450
+ if (_typeof(patternsConfig) === "object" && patternsConfig && !Array.isArray(patternsConfig)) return patternsConfig;
451
+ if (typeof patternsConfig === "string") {
452
+ if (!defaultPatterns[patternsConfig]) {
453
+ var available = Object.keys(defaultPatterns).join(", ");
454
+ throw new Error("No default pattern ".concat(patternsConfig, " found. Options ").concat(available, " are available. If you want to use cusom pattern, pass it as object."));
455
+ }
456
+ return defaultPatterns[patternsConfig];
457
+ }
458
+ var patterns = patternsConfig === true ? defaultPatternsList : patternsConfig;
459
+ var patternIndex = resolvePatternIndex(patternKey, patterns);
460
+ patternIndex = patternIndex % patterns.length;
461
+ return patterns[patternIndex];
462
+ };
463
+ var PatternFill = function PatternFill2(_ref) {
464
+ var id = _ref.id, color = _ref.color, patternKey = _ref.patternKey, _ref$patterns = _ref.patterns, patterns = _ref$patterns === void 0 ? defaultPatternsList : _ref$patterns;
465
+ var DefaultPattern = React.useMemo(function() {
466
+ var _resolvePattern = resolvePattern(patternKey, patterns), fill = _resolvePattern.fill;
467
+ return function() {
468
+ return /* @__PURE__ */ React.createElement("pattern", {
469
+ id,
470
+ fill: color,
471
+ x: "0",
472
+ y: "0",
473
+ width: "12",
474
+ height: "12",
475
+ viewBox: fill.viewBox,
476
+ patternUnits: "userSpaceOnUse"
477
+ }, fill.children);
478
+ };
479
+ }, [patternKey, id, color, patterns]);
480
+ return /* @__PURE__ */ React.createElement(DefaultPattern, null);
481
+ };
482
+ var getPatternSymbolSize = function getPatternSymbolSize2(_ref2) {
483
+ var _patternData$symbol;
484
+ var patternKey = _ref2.patternKey, patterns = _ref2.patterns;
485
+ var patternData = resolvePattern(patternKey, patterns);
486
+ if (!(patternData !== null && patternData !== void 0 && (_patternData$symbol = patternData.symbol) !== null && _patternData$symbol !== void 0 && _patternData$symbol.size)) return [10, 10];
487
+ return patternData.symbol.size;
488
+ };
489
+ var PatternSymbol = function PatternSymbol2(_ref3) {
490
+ var color = _ref3.color, patternKey = _ref3.patternKey, patterns = _ref3.patterns, props = _objectWithoutProperties(_ref3, _excluded);
491
+ var DefaultSymbol = React.useMemo(function() {
492
+ var patternData = resolvePattern(patternKey, patterns);
493
+ var children = patternData === null || patternData === void 0 ? void 0 : patternData.symbol.children;
494
+ var viewBox = patternData === null || patternData === void 0 ? void 0 : patternData.symbol.viewBox;
495
+ var width = patternData === null || patternData === void 0 ? void 0 : patternData.symbol.size[0];
496
+ var height = patternData === null || patternData === void 0 ? void 0 : patternData.symbol.size[1];
497
+ return function(props2) {
498
+ return /* @__PURE__ */ React.createElement("svg", _extends({
499
+ fill: color,
500
+ x: "0",
501
+ y: "0",
502
+ width,
503
+ height,
504
+ viewBox,
505
+ strokeWidth: "1"
506
+ }, propsForElement(props2, "svg")), children);
507
+ };
508
+ }, [patternKey, color, patterns]);
509
+ return /* @__PURE__ */ React.createElement(DefaultSymbol, props);
510
+ };
511
+ var resolvePatternDasharray = function resolvePatternDasharray2(patternKey, patterns) {
512
+ var pattern = resolvePattern(patternKey, patterns);
513
+ return pattern === null || pattern === void 0 ? void 0 : pattern.dasharray;
514
+ };
515
+ export {
516
+ PatternFill,
517
+ PatternSymbol,
518
+ getPatternSymbolSize,
519
+ resolvePatternDasharray
520
+ };
@@ -0,0 +1,137 @@
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 createComponent, { sstyled as sstyled$1, assignProps, Component } from "@semcore/core";
11
+ import React from "react";
12
+ import { Box } from "@semcore/flex-box";
13
+ import EventEmitter from "@semcore/utils/lib/eventEmitter";
14
+ import keyboardFocusEnhance from "@semcore/utils/lib/enhances/keyboardFocusEnhance";
15
+ import { uniqueId, eventToPoint } from "./utils.mjs";
16
+ import { PlotA11yModule } from "./a11y/PlotA11yModule.mjs";
17
+ import { makeDataHintsContainer, makeDataHintsHandlers } from "./a11y/hints.mjs";
18
+ import resolveColorEnhance from "@semcore/utils/lib/enhances/resolveColorEnhance";
19
+ import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
20
+ import i18nEnhance from "@semcore/utils/lib/enhances/i18nEnhance";
21
+ /*!__reshadow-styles__:"./style/plot.shadow.css"*/
22
+ var style = (
23
+ /*__reshadow_css_start__*/
24
+ (sstyled.insert(
25
+ /*__inner_css_start__*/
26
+ ".___SPlot_381vk_gg_{overflow:hidden}.___SPlot_381vk_gg_:active,.___SPlot_381vk_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}foreignObject[data-aria-only]{pointer-events:none}.___SPlot_381vk_gg_.__keyboardFocused_381vk_gg_{border:1px solid var(--intergalactic-chart-palette-order-9, #008ff8);box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5))}",
27
+ /*__inner_css_end__*/
28
+ "381vk_gg_"
29
+ ), /*__reshadow_css_end__*/
30
+ {
31
+ "__SPlot": "___SPlot_381vk_gg_",
32
+ "_keyboardFocused": "__keyboardFocused_381vk_gg_"
33
+ })
34
+ );
35
+ var PlotRoot = /* @__PURE__ */ function(_Component) {
36
+ _inherits(PlotRoot2, _Component);
37
+ var _super = _createSuper(PlotRoot2);
38
+ function PlotRoot2(props) {
39
+ var _this;
40
+ _classCallCheck(this, PlotRoot2);
41
+ _this = _super.call(this, props);
42
+ _defineProperty(_assertThisInitialized(_this), "plotId", uniqueId());
43
+ _defineProperty(_assertThisInitialized(_this), "rootRef", /* @__PURE__ */ React.createRef());
44
+ _defineProperty(_assertThisInitialized(_this), "dataStructureHints", _this.props.dataHints || makeDataHintsContainer());
45
+ _defineProperty(_assertThisInitialized(_this), "dataHintsHandler", makeDataHintsHandlers(_this.dataStructureHints));
46
+ _defineProperty(_assertThisInitialized(_this), "handlerMouseMove", function(e) {
47
+ var scale = _this.asProps.scale;
48
+ _this.eventEmitter.emit("onMouseMoveRoot", e);
49
+ if (scale && scale.length >= 2) {
50
+ var _scale = _slicedToArray(scale, 2), xScale = _scale[0], yScale = _scale[1];
51
+ var _eventToPoint = eventToPoint(e, _this.rootRef.current), _eventToPoint2 = _slicedToArray(_eventToPoint, 2), pX = _eventToPoint2[0], pY = _eventToPoint2[1];
52
+ var _xScale$range = xScale.range(), _xScale$range2 = _slicedToArray(_xScale$range, 2), minX = _xScale$range2[0], maxX = _xScale$range2[1];
53
+ var _yScale$range = yScale.range(), _yScale$range2 = _slicedToArray(_yScale$range, 2), maxY = _yScale$range2[0], minY = _yScale$range2[1];
54
+ if (pX >= minX && pX <= maxX && pY >= minY && pY <= maxY) {
55
+ _this.eventEmitter.emit("onMouseMoveChart", e);
56
+ } else {
57
+ _this.eventEmitter.emit("onMouseLeaveChart", e);
58
+ }
59
+ }
60
+ });
61
+ _defineProperty(_assertThisInitialized(_this), "handlerMouseLeave", function(e) {
62
+ _this.eventEmitter.emit("onMouseLeaveRoot", e);
63
+ _this.eventEmitter.emit("onMouseLeaveChart", e);
64
+ });
65
+ _this.eventEmitter = props.eventEmitter || new EventEmitter();
66
+ return _this;
67
+ }
68
+ _createClass(PlotRoot2, [{
69
+ key: "setContext",
70
+ value: function setContext() {
71
+ var _scale$, _scale$$domain;
72
+ var _this$asProps = this.asProps, scale = _this$asProps.scale, data = _this$asProps.data, width = _this$asProps.width, height = _this$asProps.height, locale = _this$asProps.locale, resolveColor = _this$asProps.resolveColor, patterns = _this$asProps.patterns, duration = _this$asProps.duration;
73
+ var yScaleDomain = scale === null || scale === void 0 ? void 0 : (_scale$ = scale[1]) === null || _scale$ === void 0 ? void 0 : (_scale$$domain = _scale$.domain) === null || _scale$$domain === void 0 ? void 0 : _scale$$domain.call(_scale$);
74
+ if (yScaleDomain !== null && yScaleDomain !== void 0 && yScaleDomain.length && data !== null && data !== void 0 && data.length) {
75
+ this.dataHintsHandler.setPointsDensity(data.length / width, Math.abs(yScaleDomain[1] - yScaleDomain[0]) / height);
76
+ }
77
+ return {
78
+ $rootProps: {
79
+ size: [width, height],
80
+ data,
81
+ locale,
82
+ scale,
83
+ eventEmitter: this.eventEmitter,
84
+ rootRef: this.rootRef,
85
+ dataHintsHandler: this.dataHintsHandler,
86
+ resolveColor,
87
+ patterns,
88
+ duration
89
+ }
90
+ };
91
+ }
92
+ }, {
93
+ key: "render",
94
+ value: function render() {
95
+ var _ref = this.asProps, _ref2;
96
+ var SPlot = Box;
97
+ var _this$asProps2 = this.asProps, styles = _this$asProps2.styles, width = _this$asProps2.width, height = _this$asProps2.height, Children = _this$asProps2.Children, data = _this$asProps2.data, a11yAltTextConfig = _this$asProps2.a11yAltTextConfig, label = _this$asProps2.label, locale = _this$asProps2.locale, getI18nText = _this$asProps2.getI18nText;
98
+ if (!width || !height) return null;
99
+ var ariaLabel = label !== null && label !== void 0 ? label : getI18nText("d3Chart.Plot:aria-label");
100
+ return _ref2 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SPlot, _ref2.cn("SPlot", _objectSpread({}, assignProps({
101
+ "tag": "svg",
102
+ "__excludeProps": ["data", "scale"],
103
+ "ref": this.rootRef,
104
+ "onMouseMove": this.handlerMouseMove,
105
+ "onMouseLeave": this.handlerMouseLeave,
106
+ "aria-label": ariaLabel,
107
+ "tabIndex": 0
108
+ }, _ref))), /* @__PURE__ */ React.createElement(Children, _ref2.cn("Children", {})), /* @__PURE__ */ React.createElement("foreignObject", _ref2.cn("foreignObject", {
109
+ "width": "100%",
110
+ "height": "100%",
111
+ "data-aria-only": true
112
+ }), /* @__PURE__ */ React.createElement(PlotA11yModule, _ref2.cn("PlotA11yModule", {
113
+ "id": this.plotId,
114
+ "data": data,
115
+ "plotLabel": label,
116
+ "locale": locale,
117
+ "plotRef": this.rootRef,
118
+ "hints": this.dataStructureHints,
119
+ "config": a11yAltTextConfig
120
+ }))));
121
+ }
122
+ }]);
123
+ return PlotRoot2;
124
+ }(Component);
125
+ _defineProperty(PlotRoot, "displayName", "Plot");
126
+ _defineProperty(PlotRoot, "style", style);
127
+ _defineProperty(PlotRoot, "defaultProps", function() {
128
+ return {
129
+ width: 0,
130
+ height: 0
131
+ };
132
+ });
133
+ _defineProperty(PlotRoot, "enhance", [keyboardFocusEnhance(), resolveColorEnhance(), i18nEnhance(localizedMessages)]);
134
+ const Plot = createComponent(PlotRoot);
135
+ export {
136
+ Plot as default
137
+ };