@redsift/charts 9.2.3 → 9.2.4

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 (271) hide show
  1. package/{dist/index.js → index.js} +2 -1
  2. package/index.js.map +1 -0
  3. package/package.json +3 -2
  4. package/coverage/clover.xml +0 -1096
  5. package/coverage/coverage-final.json +0 -60
  6. package/coverage/lcov-report/base.css +0 -224
  7. package/coverage/lcov-report/block-navigation.js +0 -87
  8. package/coverage/lcov-report/components/Arc/Arc.tsx.html +0 -304
  9. package/coverage/lcov-report/components/Arc/index.html +0 -146
  10. package/coverage/lcov-report/components/Arc/index.ts.html +0 -94
  11. package/coverage/lcov-report/components/Arc/styles.ts.html +0 -208
  12. package/coverage/lcov-report/components/Arcs/Arcs.tsx.html +0 -409
  13. package/coverage/lcov-report/components/Arcs/index.html +0 -146
  14. package/coverage/lcov-report/components/Arcs/index.ts.html +0 -94
  15. package/coverage/lcov-report/components/Arcs/styles.ts.html +0 -106
  16. package/coverage/lcov-report/components/Axis/Axis.tsx.html +0 -754
  17. package/coverage/lcov-report/components/Axis/computeTicks.ts.html +0 -481
  18. package/coverage/lcov-report/components/Axis/index.html +0 -176
  19. package/coverage/lcov-report/components/Axis/index.ts.html +0 -94
  20. package/coverage/lcov-report/components/Axis/styles.ts.html +0 -148
  21. package/coverage/lcov-report/components/Axis/types.ts.html +0 -253
  22. package/coverage/lcov-report/components/Bar/Bar.tsx.html +0 -421
  23. package/coverage/lcov-report/components/Bar/index.html +0 -161
  24. package/coverage/lcov-report/components/Bar/index.ts.html +0 -94
  25. package/coverage/lcov-report/components/Bar/styles.ts.html +0 -247
  26. package/coverage/lcov-report/components/Bar/types.ts.html +0 -178
  27. package/coverage/lcov-report/components/BarChart/BarChart.tsx.html +0 -352
  28. package/coverage/lcov-report/components/BarChart/EmptyBarChart.tsx.html +0 -259
  29. package/coverage/lcov-report/components/BarChart/LoadingBarChart.tsx.html +0 -145
  30. package/coverage/lcov-report/components/BarChart/RenderedBarChart.tsx.html +0 -430
  31. package/coverage/lcov-report/components/BarChart/index.html +0 -206
  32. package/coverage/lcov-report/components/BarChart/index.ts.html +0 -94
  33. package/coverage/lcov-report/components/BarChart/styles.ts.html +0 -190
  34. package/coverage/lcov-report/components/BarChart/utils.ts.html +0 -145
  35. package/coverage/lcov-report/components/BottomAxis/BottomAxis.tsx.html +0 -247
  36. package/coverage/lcov-report/components/BottomAxis/index.html +0 -146
  37. package/coverage/lcov-report/components/BottomAxis/index.ts.html +0 -94
  38. package/coverage/lcov-report/components/BottomAxis/styles.ts.html +0 -139
  39. package/coverage/lcov-report/components/ChartContainer/ChartContainer.tsx.html +0 -361
  40. package/coverage/lcov-report/components/ChartContainer/index.html +0 -146
  41. package/coverage/lcov-report/components/ChartContainer/index.ts.html +0 -94
  42. package/coverage/lcov-report/components/ChartContainer/intl/index.html +0 -116
  43. package/coverage/lcov-report/components/ChartContainer/intl/index.ts.html +0 -106
  44. package/coverage/lcov-report/components/ChartContainer/styles.ts.html +0 -208
  45. package/coverage/lcov-report/components/DataPoint/DataPoint.tsx.html +0 -391
  46. package/coverage/lcov-report/components/DataPoint/index.html +0 -146
  47. package/coverage/lcov-report/components/DataPoint/index.ts.html +0 -94
  48. package/coverage/lcov-report/components/DataPoint/styles.ts.html +0 -109
  49. package/coverage/lcov-report/components/Dot/Dot.tsx.html +0 -232
  50. package/coverage/lcov-report/components/Dot/index.html +0 -146
  51. package/coverage/lcov-report/components/Dot/index.ts.html +0 -94
  52. package/coverage/lcov-report/components/Dot/styles.ts.html +0 -184
  53. package/coverage/lcov-report/components/HorizontalBar/HorizontalBar.tsx.html +0 -541
  54. package/coverage/lcov-report/components/HorizontalBar/index.html +0 -161
  55. package/coverage/lcov-report/components/HorizontalBar/index.ts.html +0 -94
  56. package/coverage/lcov-report/components/HorizontalBar/styles.ts.html +0 -187
  57. package/coverage/lcov-report/components/HorizontalBar/types.ts.html +0 -301
  58. package/coverage/lcov-report/components/HorizontalBarChart/HorizontalBarChart.tsx.html +0 -691
  59. package/coverage/lcov-report/components/HorizontalBarChart/index.html +0 -146
  60. package/coverage/lcov-report/components/HorizontalBarChart/index.ts.html +0 -94
  61. package/coverage/lcov-report/components/HorizontalBarChart/styles.ts.html +0 -196
  62. package/coverage/lcov-report/components/HorizontalBarChart/types.ts.html +0 -301
  63. package/coverage/lcov-report/components/Legend/Legend.tsx.html +0 -268
  64. package/coverage/lcov-report/components/Legend/index.html +0 -146
  65. package/coverage/lcov-report/components/Legend/index.ts.html +0 -94
  66. package/coverage/lcov-report/components/Legend/styles.ts.html +0 -130
  67. package/coverage/lcov-report/components/LegendItem/LegendItem.tsx.html +0 -325
  68. package/coverage/lcov-report/components/LegendItem/index.html +0 -146
  69. package/coverage/lcov-report/components/LegendItem/index.ts.html +0 -94
  70. package/coverage/lcov-report/components/LegendItem/styles.ts.html +0 -205
  71. package/coverage/lcov-report/components/PieChart/EmptyPieChart.tsx.html +0 -343
  72. package/coverage/lcov-report/components/PieChart/LoadingPieChart.tsx.html +0 -145
  73. package/coverage/lcov-report/components/PieChart/PieChart.tsx.html +0 -385
  74. package/coverage/lcov-report/components/PieChart/RenderedPieChart.tsx.html +0 -607
  75. package/coverage/lcov-report/components/PieChart/index.html +0 -221
  76. package/coverage/lcov-report/components/PieChart/index.ts.html +0 -94
  77. package/coverage/lcov-report/components/PieChart/styles.ts.html +0 -370
  78. package/coverage/lcov-report/components/PieChart/types.ts.html +0 -367
  79. package/coverage/lcov-report/components/PieChart/utils.ts.html +0 -199
  80. package/coverage/lcov-report/components/ScatterPlot/EmptyScatterPlot.tsx.html +0 -295
  81. package/coverage/lcov-report/components/ScatterPlot/LoadingScatterPlot.tsx.html +0 -145
  82. package/coverage/lcov-report/components/ScatterPlot/RenderedScatterPlot.tsx.html +0 -1048
  83. package/coverage/lcov-report/components/ScatterPlot/ScatterPlot.tsx.html +0 -367
  84. package/coverage/lcov-report/components/ScatterPlot/index.html +0 -221
  85. package/coverage/lcov-report/components/ScatterPlot/index.ts.html +0 -94
  86. package/coverage/lcov-report/components/ScatterPlot/styles.ts.html +0 -190
  87. package/coverage/lcov-report/components/ScatterPlot/types.ts.html +0 -394
  88. package/coverage/lcov-report/components/ScatterPlot/utils.ts.html +0 -388
  89. package/coverage/lcov-report/core/Arc/Arc.tsx.html +0 -304
  90. package/coverage/lcov-report/core/Arc/index.html +0 -146
  91. package/coverage/lcov-report/core/Arc/index.ts.html +0 -94
  92. package/coverage/lcov-report/core/Arc/styles.ts.html +0 -202
  93. package/coverage/lcov-report/core/Arcs/Arcs.tsx.html +0 -421
  94. package/coverage/lcov-report/core/Arcs/index.html +0 -146
  95. package/coverage/lcov-report/core/Arcs/index.ts.html +0 -94
  96. package/coverage/lcov-report/core/Arcs/styles.ts.html +0 -106
  97. package/coverage/lcov-report/core/Axis/Axis.tsx.html +0 -754
  98. package/coverage/lcov-report/core/Axis/computeTicks.ts.html +0 -481
  99. package/coverage/lcov-report/core/Axis/index.html +0 -176
  100. package/coverage/lcov-report/core/Axis/index.ts.html +0 -94
  101. package/coverage/lcov-report/core/Axis/styles.ts.html +0 -145
  102. package/coverage/lcov-report/core/Axis/types.ts.html +0 -253
  103. package/coverage/lcov-report/core/Bar/Bar.tsx.html +0 -421
  104. package/coverage/lcov-report/core/Bar/index.html +0 -161
  105. package/coverage/lcov-report/core/Bar/index.ts.html +0 -94
  106. package/coverage/lcov-report/core/Bar/styles.ts.html +0 -190
  107. package/coverage/lcov-report/core/Bar/types.ts.html +0 -178
  108. package/coverage/lcov-report/core/BottomAxis/BottomAxis.tsx.html +0 -277
  109. package/coverage/lcov-report/core/BottomAxis/index.html +0 -146
  110. package/coverage/lcov-report/core/BottomAxis/index.ts.html +0 -94
  111. package/coverage/lcov-report/core/BottomAxis/styles.ts.html +0 -139
  112. package/coverage/lcov-report/core/ChartConfig/ChartConfig.ts.html +0 -97
  113. package/coverage/lcov-report/core/ChartConfig/index.html +0 -131
  114. package/coverage/lcov-report/core/ChartConfig/index.ts.html +0 -88
  115. package/coverage/lcov-report/core/ChartContainer/ChartContainer.tsx.html +0 -421
  116. package/coverage/lcov-report/core/ChartContainer/index.html +0 -146
  117. package/coverage/lcov-report/core/ChartContainer/index.ts.html +0 -94
  118. package/coverage/lcov-report/core/ChartContainer/intl/index.html +0 -116
  119. package/coverage/lcov-report/core/ChartContainer/intl/index.ts.html +0 -106
  120. package/coverage/lcov-report/core/ChartContainer/styles.ts.html +0 -205
  121. package/coverage/lcov-report/core/DataPoint/DataPoint.tsx.html +0 -442
  122. package/coverage/lcov-report/core/DataPoint/index.html +0 -146
  123. package/coverage/lcov-report/core/DataPoint/index.ts.html +0 -94
  124. package/coverage/lcov-report/core/DataPoint/styles.ts.html +0 -109
  125. package/coverage/lcov-report/core/Dot/Dot.tsx.html +0 -232
  126. package/coverage/lcov-report/core/Dot/index.html +0 -146
  127. package/coverage/lcov-report/core/Dot/index.ts.html +0 -94
  128. package/coverage/lcov-report/core/Dot/styles.ts.html +0 -184
  129. package/coverage/lcov-report/core/Legend/Legend.tsx.html +0 -277
  130. package/coverage/lcov-report/core/Legend/index.html +0 -146
  131. package/coverage/lcov-report/core/Legend/index.ts.html +0 -94
  132. package/coverage/lcov-report/core/Legend/styles.ts.html +0 -172
  133. package/coverage/lcov-report/core/Point/Point.tsx.html +0 -484
  134. package/coverage/lcov-report/core/Point/index.html +0 -146
  135. package/coverage/lcov-report/core/Point/index.ts.html +0 -94
  136. package/coverage/lcov-report/core/Point/styles.ts.html +0 -169
  137. package/coverage/lcov-report/favicon.png +0 -0
  138. package/coverage/lcov-report/gallery/HorizontalBarChart/HorizontalBarChart.tsx.html +0 -706
  139. package/coverage/lcov-report/gallery/HorizontalBarChart/index.html +0 -161
  140. package/coverage/lcov-report/gallery/HorizontalBarChart/index.ts.html +0 -94
  141. package/coverage/lcov-report/gallery/HorizontalBarChart/styles.ts.html +0 -316
  142. package/coverage/lcov-report/gallery/HorizontalBarChart/types.ts.html +0 -310
  143. package/coverage/lcov-report/gallery/PieChart/PieChart.tsx.html +0 -1252
  144. package/coverage/lcov-report/gallery/PieChart/index.html +0 -161
  145. package/coverage/lcov-report/gallery/PieChart/index.ts.html +0 -94
  146. package/coverage/lcov-report/gallery/PieChart/styles.ts.html +0 -517
  147. package/coverage/lcov-report/gallery/PieChart/types.ts.html +0 -388
  148. package/coverage/lcov-report/gallery/ScatterPlot/index.html +0 -146
  149. package/coverage/lcov-report/gallery/ScatterPlot/index.ts.html +0 -94
  150. package/coverage/lcov-report/gallery/ScatterPlot/styles.ts.html +0 -343
  151. package/coverage/lcov-report/gallery/ScatterPlot/types.ts.html +0 -433
  152. package/coverage/lcov-report/hooks/index.html +0 -176
  153. package/coverage/lcov-report/hooks/index.ts.html +0 -97
  154. package/coverage/lcov-report/hooks/useBrush.tsx.html +0 -430
  155. package/coverage/lcov-report/hooks/useColor.tsx.html +0 -163
  156. package/coverage/lcov-report/hooks/useFormatCategoricalData.tsx.html +0 -289
  157. package/coverage/lcov-report/hooks/useIsEmpty.tsx.html +0 -118
  158. package/coverage/lcov-report/hooks/useZoom.tsx.html +0 -235
  159. package/coverage/lcov-report/index.html +0 -311
  160. package/coverage/lcov-report/prettify.css +0 -1
  161. package/coverage/lcov-report/prettify.js +0 -2
  162. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  163. package/coverage/lcov-report/sorter.js +0 -196
  164. package/coverage/lcov.info +0 -2345
  165. package/coverage/storybook/coverage-storybook.json +0 -79382
  166. package/dist/index.js.map +0 -1
  167. package/dist/package.json +0 -98
  168. package/index.ts +0 -1
  169. package/jest.config.js +0 -3
  170. package/rollup.config.js +0 -13
  171. package/src/components/Arc/Arc.test.tsx +0 -80
  172. package/src/components/Arc/Arc.tsx +0 -73
  173. package/src/components/Arc/index.ts +0 -3
  174. package/src/components/Arc/styles.ts +0 -41
  175. package/src/components/Arc/types.ts +0 -18
  176. package/src/components/Arcs/Arcs.stories.tsx +0 -177
  177. package/src/components/Arcs/Arcs.tsx +0 -108
  178. package/src/components/Arcs/index.ts +0 -3
  179. package/src/components/Arcs/styles.ts +0 -7
  180. package/src/components/Arcs/types.ts +0 -26
  181. package/src/components/Axis/Axis.stories.tsx +0 -297
  182. package/src/components/Axis/Axis.tsx +0 -223
  183. package/src/components/Axis/computeTicks.ts +0 -132
  184. package/src/components/Axis/index.ts +0 -3
  185. package/src/components/Axis/styles.ts +0 -21
  186. package/src/components/Axis/types.ts +0 -56
  187. package/src/components/Bar/Bar.stories.tsx +0 -152
  188. package/src/components/Bar/Bar.test.tsx +0 -156
  189. package/src/components/Bar/Bar.tsx +0 -112
  190. package/src/components/Bar/index.ts +0 -3
  191. package/src/components/Bar/styles.ts +0 -54
  192. package/src/components/Bar/types.ts +0 -31
  193. package/src/components/BarChart/BarChart.stories.tsx +0 -74
  194. package/src/components/BarChart/BarChart.test.tsx +0 -178
  195. package/src/components/BarChart/BarChart.tsx +0 -89
  196. package/src/components/BarChart/EmptyBarChart.tsx +0 -58
  197. package/src/components/BarChart/LoadingBarChart.tsx +0 -20
  198. package/src/components/BarChart/RenderedBarChart.tsx +0 -115
  199. package/src/components/BarChart/__snapshots__/BarChart.test.tsx.snap +0 -7028
  200. package/src/components/BarChart/index.ts +0 -3
  201. package/src/components/BarChart/styles.ts +0 -35
  202. package/src/components/BarChart/types.ts +0 -58
  203. package/src/components/BarChart/utils.ts +0 -20
  204. package/src/components/ChartContainer/ChartContainer.stories.tsx +0 -81
  205. package/src/components/ChartContainer/ChartContainer.test.tsx +0 -71
  206. package/src/components/ChartContainer/ChartContainer.tsx +0 -92
  207. package/src/components/ChartContainer/index.ts +0 -3
  208. package/src/components/ChartContainer/intl/en-US.json +0 -3
  209. package/src/components/ChartContainer/intl/fr-FR.json +0 -3
  210. package/src/components/ChartContainer/intl/index.ts +0 -7
  211. package/src/components/ChartContainer/styles.ts +0 -41
  212. package/src/components/ChartContainer/types.ts +0 -26
  213. package/src/components/DataPoint/DataPoint.tsx +0 -102
  214. package/src/components/DataPoint/index.ts +0 -3
  215. package/src/components/DataPoint/styles.ts +0 -8
  216. package/src/components/DataPoint/types.ts +0 -33
  217. package/src/components/Dot/Dot.stories.tsx +0 -157
  218. package/src/components/Dot/Dot.test.tsx +0 -136
  219. package/src/components/Dot/Dot.tsx +0 -49
  220. package/src/components/Dot/index.ts +0 -3
  221. package/src/components/Dot/styles.ts +0 -33
  222. package/src/components/Dot/types.ts +0 -16
  223. package/src/components/Legend/Legend.stories.tsx +0 -108
  224. package/src/components/Legend/Legend.tsx +0 -61
  225. package/src/components/Legend/index.ts +0 -3
  226. package/src/components/Legend/styles.ts +0 -15
  227. package/src/components/Legend/types.ts +0 -27
  228. package/src/components/LegendItem/LegendItem.test.tsx +0 -69
  229. package/src/components/LegendItem/LegendItem.tsx +0 -80
  230. package/src/components/LegendItem/index.ts +0 -3
  231. package/src/components/LegendItem/styles.ts +0 -40
  232. package/src/components/LegendItem/types.ts +0 -30
  233. package/src/components/PieChart/EmptyPieChart.tsx +0 -86
  234. package/src/components/PieChart/LoadingPieChart.tsx +0 -20
  235. package/src/components/PieChart/PieChart.stories.tsx +0 -85
  236. package/src/components/PieChart/PieChart.test.tsx +0 -183
  237. package/src/components/PieChart/PieChart.tsx +0 -100
  238. package/src/components/PieChart/RenderedPieChart.tsx +0 -174
  239. package/src/components/PieChart/__snapshots__/PieChart.test.tsx.snap +0 -21020
  240. package/src/components/PieChart/index.ts +0 -3
  241. package/src/components/PieChart/styles.ts +0 -95
  242. package/src/components/PieChart/types.ts +0 -94
  243. package/src/components/PieChart/utils.ts +0 -38
  244. package/src/components/ScatterPlot/EmptyScatterPlot.tsx +0 -70
  245. package/src/components/ScatterPlot/LoadingScatterPlot.tsx +0 -20
  246. package/src/components/ScatterPlot/RenderedScatterPlot.tsx +0 -321
  247. package/src/components/ScatterPlot/ScatterPlot.stories.tsx +0 -101
  248. package/src/components/ScatterPlot/ScatterPlot.test.tsx +0 -61
  249. package/src/components/ScatterPlot/ScatterPlot.tsx +0 -94
  250. package/src/components/ScatterPlot/__snapshots__/ScatterPlot.test.tsx.snap +0 -91712
  251. package/src/components/ScatterPlot/index.ts +0 -3
  252. package/src/components/ScatterPlot/styles.ts +0 -35
  253. package/src/components/ScatterPlot/types.ts +0 -103
  254. package/src/components/ScatterPlot/utils.ts +0 -101
  255. package/src/config.ts +0 -10
  256. package/src/hooks/index.ts +0 -4
  257. package/src/hooks/useBrush.tsx +0 -115
  258. package/src/hooks/useColor.tsx +0 -26
  259. package/src/hooks/useFormatCategoricalData.tsx +0 -68
  260. package/src/hooks/useZoom.tsx +0 -50
  261. package/src/index.ts +0 -15
  262. package/src/scheme.ts +0 -213
  263. package/src/types/data.ts +0 -52
  264. package/src/types/index.ts +0 -5
  265. package/src/types/legend.ts +0 -19
  266. package/src/types/scale.ts +0 -79
  267. package/src/types/size.ts +0 -17
  268. package/src/types/theme.ts +0 -27
  269. package/tsconfig.json +0 -3
  270. /package/{dist/CONTRIBUTING.md → CONTRIBUTING.md} +0 -0
  271. /package/{dist/index.d.ts → index.d.ts} +0 -0
package/dist/package.json DELETED
@@ -1,98 +0,0 @@
1
- {
2
- "author": {
3
- "name": "Red Sift"
4
- },
5
- "bugs": {
6
- "url": "https://github.com/redsift/design-system/issues"
7
- },
8
- "description": "Chart component library as part of Red Sift's Design System. This package is based on d3.js for computation, react for rendering and events and react-spring for animations and transitions.",
9
- "homepage": "https://github.com/redsift/design-system",
10
- "license": "MIT",
11
- "main": "index.js",
12
- "module": "index.js",
13
- "name": "@redsift/charts",
14
- "publishConfig": {
15
- "directory": "dist"
16
- },
17
- "repository": {
18
- "type": "git",
19
- "url": "git+https://github.com/redsift/design-system"
20
- },
21
- "sideEffects": false,
22
- "scripts": {
23
- "build": "rollup -c",
24
- "check-types": "tsc && tsc-strict",
25
- "lint": "eslint --ext .js,.jsx,.ts,.tsx src/",
26
- "prepare": "install-peers || exit 0",
27
- "prepublishOnly": "yarn build",
28
- "test:unit": "NODE_ENV=test jest --verbose",
29
- "test:storybook": "test-storybook -c ../../.storybook --url http://localhost:9000/ --coverage",
30
- "test": "yarn test:unit && yarn test:storybook"
31
- },
32
- "types": "types.d.ts",
33
- "version": "9.2.3",
34
- "dependencies": {
35
- "@emotion/react": "^11.10.4",
36
- "@emotion/styled": "^11.10.4",
37
- "@react-aria/i18n": "3.7.2",
38
- "classnames": "^2.3.1",
39
- "d3": "^7.8.0",
40
- "d3-shape": "^3.1.0"
41
- },
42
- "devDependencies": {
43
- "@babel/core": "^7.8.3",
44
- "@babel/plugin-proposal-class-properties": "^7.16.7",
45
- "@babel/plugin-proposal-export-default-from": "^7.16.7",
46
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
47
- "@babel/plugin-proposal-object-rest-spread": "^7.17.3",
48
- "@babel/plugin-proposal-optional-chaining": "^7.16.7",
49
- "@babel/plugin-proposal-private-methods": "^7.16.11",
50
- "@babel/plugin-proposal-private-property-in-object": "^7.16.7",
51
- "@babel/preset-env": "^7.17.10",
52
- "@babel/preset-react": "^7.17.12",
53
- "@babel/preset-typescript": "^7.16.7",
54
- "@react-spring/web": "^9.7.1",
55
- "@rollup/plugin-babel": "^6.0.2",
56
- "@rollup/plugin-commonjs": "^24.0.0",
57
- "@rollup/plugin-json": "^6.0.0",
58
- "@rollup/plugin-node-resolve": "^13.3.0",
59
- "@testing-library/dom": "^8.5.0",
60
- "@testing-library/jest-dom": "^5.16.4",
61
- "@testing-library/react": "^13.4.0",
62
- "@testing-library/react-hooks": "^8.0.1",
63
- "@testing-library/user-event": "14.2.1",
64
- "@types/d3": "^7.4.0",
65
- "@types/d3-shape": "^3.1.0",
66
- "@types/jest": "^27.5.1",
67
- "@types/react": "18.0.12",
68
- "@types/react-dom": "18.0.5",
69
- "@types/styled-components": "^5.1.25",
70
- "@typescript-eslint/eslint-plugin": "^5.48.0",
71
- "@typescript-eslint/parser": "^5.26.0",
72
- "identity-obj-proxy": "^3.0.0",
73
- "install-peers-cli": "^2.2.0",
74
- "jest": "^28.1.0",
75
- "jest-environment-jsdom": "^29.3.0",
76
- "msw": "^0.47.4",
77
- "react": "18.2.0",
78
- "react-dom": "18.2.0",
79
- "rollup": "^2.72.1",
80
- "rollup-plugin-analyzer": "^4.0.0",
81
- "rollup-plugin-auto-external": "^2.0.0",
82
- "rollup-plugin-cleaner": "^1.0.0",
83
- "rollup-plugin-copy": "^3.4.0",
84
- "rollup-plugin-dts": "^5.0.0",
85
- "rollup-plugin-execute": "^1.1.0",
86
- "rollup-plugin-svg": "^2.0.0",
87
- "rollup-plugin-ts-paths-resolve": "^1.7.1",
88
- "rollup-plugin-typescript-paths": "^1.3.1",
89
- "ts-jest": "^28.0.3"
90
- },
91
- "peerDependencies": {
92
- "@redsift/design-system": ">=9.0.0-alpha.0",
93
- "@redsift/popovers": ">=9.0.0-alpha.0",
94
- "react": ">=17",
95
- "react-dom": ">=17",
96
- "styled-components": "^5.3.5"
97
- }
98
- }
package/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './src';
package/jest.config.js DELETED
@@ -1,3 +0,0 @@
1
- var JEST_CONFIG = require('../../configs/jest.config');
2
-
3
- module.exports = { ...JEST_CONFIG };
package/rollup.config.js DELETED
@@ -1,13 +0,0 @@
1
- import { rollupConfig } from '../../configs/rollup.base.config';
2
-
3
- import pkg from './package.json';
4
-
5
- const baseRollupConfig = rollupConfig(__dirname, pkg);
6
-
7
- // Bundle JS code
8
- const bundleJS = { ...baseRollupConfig.bundleJS };
9
-
10
- // Bundle TS types in D.TS files
11
- const bundleType = { ...baseRollupConfig.bundleType };
12
-
13
- export default [bundleJS, bundleType];
@@ -1,80 +0,0 @@
1
- import React from 'react';
2
- import { fireEvent, render, screen, waitFor } from '@testing-library/react';
3
- import userEvent from '@testing-library/user-event';
4
- import { arc as d3arc, pie as d3pie } from 'd3';
5
-
6
- import { Arc } from './Arc';
7
- import { ArcDatum, TooltipVariant, CategoryDatum } from '../../types';
8
-
9
- jest.mock('@redsift/design-system', () => ({
10
- ...jest.requireActual('@redsift/design-system'),
11
- useId: () => ['123'],
12
- }));
13
-
14
- const createArc = d3arc<ArcDatum>().innerRadius(0).outerRadius(150);
15
- const createPie = d3pie<CategoryDatum>()
16
- .value((d) => d.value)
17
- .sort(null);
18
- const data = [
19
- {
20
- key: 'Croissant',
21
- value: 333,
22
- },
23
- ];
24
- const pieData = createPie(data);
25
-
26
- describe('Arc', () => {
27
- const onClickSpy = jest.fn();
28
-
29
- afterEach(() => {
30
- onClickSpy.mockClear();
31
- });
32
-
33
- it('supports click', async () => {
34
- const { getByRole } = render(
35
- <svg width={500} height={500}>
36
- <Arc id="123" index={0} data={pieData[0]} createArc={createArc} onClick={onClickSpy} />
37
- </svg>
38
- );
39
-
40
- const bar = getByRole('button');
41
- fireEvent.click(bar);
42
- expect(onClickSpy).toHaveBeenCalledWith(pieData[0]);
43
- });
44
-
45
- it('supports keydown', async () => {
46
- const { getByRole } = render(
47
- <svg width={500} height={500}>
48
- <Arc id="123" index={0} data={pieData[0]} createArc={createArc} onClick={onClickSpy} />
49
- </svg>
50
- );
51
-
52
- const bar = getByRole('button');
53
- fireEvent.keyDown(bar, { key: 'Enter', code: 'Enter', charCode: 13 });
54
- expect(onClickSpy).toHaveBeenCalledWith(pieData[0]);
55
- });
56
-
57
- it('shows a tooltip on hover', async () => {
58
- const user = userEvent.setup();
59
- const { getByRole } = render(
60
- <svg width={500} height={500}>
61
- <Arc
62
- index={0}
63
- // The onClick gives the bar the role "button" which is then used to access the bars.
64
- onClick={onClickSpy}
65
- data={pieData[0]}
66
- createArc={createArc}
67
- tooltipVariant={TooltipVariant.label}
68
- />
69
- </svg>
70
- );
71
-
72
- const bar = getByRole('button');
73
- await user.hover(bar);
74
- await waitFor(() => {
75
- expect(screen.getByRole('tooltip', { exact: true })).toBeInTheDocument();
76
- });
77
- const tooltip = screen.getByRole('tooltip');
78
- expect(tooltip.textContent).toContain('Croissant');
79
- });
80
- });
@@ -1,73 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import classNames from 'classnames';
3
- import { animated, useSpring } from '@react-spring/web';
4
- import { interpolate as d3interpolate } from 'd3';
5
-
6
- import { Comp } from '@redsift/design-system';
7
-
8
- import { ArcProps } from './types';
9
- import { StyledArc } from './styles';
10
- import { monochrome } from '../../scheme';
11
- import { config } from '../../config';
12
-
13
- const COMPONENT_NAME = 'Arc';
14
- const CLASSNAME = 'redsift-arc';
15
- const DEFAULT_PROPS: Partial<ArcProps> = {
16
- color: monochrome,
17
- index: 0,
18
- previousData: {
19
- data: {
20
- key: '',
21
- value: 0,
22
- },
23
- startAngle: 0,
24
- endAngle: 0,
25
- padAngle: 0,
26
- value: 0,
27
- index: 0,
28
- },
29
- };
30
-
31
- export const Arc: Comp<ArcProps, SVGGElement> = forwardRef((props, ref) => {
32
- const { color, data, isSelected: propsIsSelected, onClick, role } = props;
33
-
34
- const { className, createArc, hasStroke, previousData, ...forwardedProps } =
35
- props;
36
-
37
- const interpolator = d3interpolate(previousData, data);
38
-
39
- const isSelectable = role === 'option';
40
- const isDeselected = isSelectable && propsIsSelected === false;
41
-
42
- const animatedProps = useSpring({
43
- ...config,
44
- to: async (next: (props?: object) => Promise<void>) => {
45
- await next({ t: 1 });
46
- },
47
- from: { t: 0 },
48
- });
49
-
50
- return (
51
- <StyledArc
52
- {...forwardedProps}
53
- ref={ref}
54
- className={classNames(Arc.className, className)}
55
- $clickable={Boolean(onClick)}
56
- $hasStroke={Boolean(hasStroke)}
57
- >
58
- <animated.path
59
- d={
60
- config.immediate
61
- ? (createArc(data) as unknown as string)
62
- : (animatedProps.t.to((t) =>
63
- createArc(interpolator(t))
64
- ) as unknown as string)
65
- }
66
- fill={isDeselected ? 'var(--redsift-color-neutral-lightgrey)' : color}
67
- />
68
- </StyledArc>
69
- );
70
- });
71
- Arc.className = CLASSNAME;
72
- Arc.defaultProps = DEFAULT_PROPS;
73
- Arc.displayName = COMPONENT_NAME;
@@ -1,3 +0,0 @@
1
- export * from './Arc';
2
- export * from './types';
3
- export * from './styles';
@@ -1,41 +0,0 @@
1
- import styled, { css } from 'styled-components';
2
- import { StyledArcProps } from './types';
3
- import { DataPoint } from '../DataPoint';
4
-
5
- /**
6
- * Component style.
7
- */
8
- export const StyledArc = styled(DataPoint)<StyledArcProps>`
9
- ${({ $hasStroke }) =>
10
- $hasStroke
11
- ? css`
12
- path {
13
- stroke-width: 2px;
14
- stroke: #fff;
15
- }
16
- `
17
- : ''}
18
-
19
- ${({ $clickable }) =>
20
- $clickable
21
- ? css`
22
- cursor: pointer;
23
-
24
- &:hover,
25
- &:focus,
26
- &.focused {
27
- opacity: 0.8;
28
- outline: none;
29
- }
30
-
31
- &:focus-visible,
32
- &.focused {
33
- path {
34
- stroke: var(--redsift-color-default-primary);
35
- stroke-width: 4px;
36
- paint-order: stroke;
37
- }
38
- }
39
- `
40
- : ''}}
41
- `;
@@ -1,18 +0,0 @@
1
- import { Arc as d3Arc } from 'd3';
2
- import { ArcDatum } from '../../types';
3
- import { DataPointProps, StyledDataPointProps } from '../DataPoint';
4
-
5
- /**
6
- * Component props.
7
- */
8
- export interface ArcProps extends DataPointProps<ArcDatum> {
9
- /** Arc generator used to determine the width of the arc. */
10
- createArc: d3Arc<any, ArcDatum>;
11
- /** Whether the arc has a stroke or not. Used to create a gap between two siblings. */
12
- hasStroke?: boolean;
13
- }
14
-
15
- export type StyledArcProps = StyledDataPointProps &
16
- Omit<ArcProps, 'createArc'> & {
17
- $hasStroke: ArcProps['hasStroke'];
18
- };
@@ -1,177 +0,0 @@
1
- import React from 'react';
2
- // @ts-ignore
3
- import type { StoryObj } from '@storybook/react';
4
- import { arc as d3arc, pie as d3pie } from 'd3';
5
-
6
- import { Arcs, ArcsProps } from '.';
7
- import { ArcDatum, TooltipVariant, CategoryDatum } from '../../types';
8
-
9
- const meta = {
10
- title: 'Charts/Core/Arcs',
11
- component: Arcs,
12
- };
13
-
14
- export default meta;
15
- type Story = StoryObj<ArcsProps>;
16
-
17
- const createArc = d3arc<ArcDatum>().innerRadius(0).outerRadius(150);
18
-
19
- export const Simple: Story = {
20
- render: () => {
21
- const createPie = d3pie<CategoryDatum>()
22
- .value((d) => d.value)
23
- .sort(null);
24
- const data = [
25
- {
26
- key: 'Croissant',
27
- value: 333,
28
- },
29
- ];
30
- const pieData = createPie(data);
31
-
32
- return (
33
- <svg width={500} height={500}>
34
- <Arcs
35
- hasLabels
36
- transform="translate(250,250)"
37
- arcs={[
38
- {
39
- id: '123',
40
- createArc,
41
- data: pieData[0],
42
- },
43
- ]}
44
- />
45
- </svg>
46
- );
47
- },
48
- };
49
-
50
- export const Clickable: Story = {
51
- render: () => {
52
- const createPie = d3pie<CategoryDatum>()
53
- .value((d) => d.value)
54
- .sort(null);
55
- const data = [
56
- {
57
- key: 'Button',
58
- value: 150,
59
- },
60
- {
61
- key: 'Link',
62
- value: 333,
63
- },
64
- ];
65
- const pieData = createPie(data);
66
-
67
- return (
68
- <svg width={500} height={500}>
69
- <Arcs
70
- hasLabels
71
- transform="translate(250,250)"
72
- id="123"
73
- hasStroke
74
- arcs={[
75
- {
76
- createArc,
77
- onClick: (datum) => console.log(datum),
78
- data: pieData[0],
79
- },
80
- {
81
- createArc,
82
- onClick: (datum) => {
83
- window.open(
84
- `https://en.wikipedia.org/wiki/${datum.data.key}`,
85
- '_blank'
86
- );
87
- },
88
- data: pieData[1],
89
- },
90
- ]}
91
- />
92
- </svg>
93
- );
94
- },
95
- };
96
-
97
- export const Selectable: Story = {
98
- render: () => {
99
- const createPie = d3pie<CategoryDatum>()
100
- .value((d) => d.value)
101
- .sort(null);
102
- const data = [
103
- {
104
- key: 'Deselected',
105
- value: 150,
106
- },
107
- {
108
- key: 'Selected',
109
- value: 333,
110
- },
111
- ];
112
- const pieData = createPie(data);
113
-
114
- return (
115
- <svg width={500} height={500}>
116
- <Arcs
117
- hasLabels
118
- transform="translate(250,250)"
119
- role="option"
120
- arcs={[
121
- {
122
- createArc,
123
- isSelected: false,
124
- onClick: (datum) =>
125
- console.log('Clicked on the non-selected arc', datum),
126
- data: pieData[0],
127
- },
128
- {
129
- createArc,
130
- isSelected: true,
131
- onClick: (datum) =>
132
- console.log('Clicked on the selected arc', datum),
133
- data: pieData[1],
134
- },
135
- ]}
136
- />
137
- </svg>
138
- );
139
- },
140
- };
141
-
142
- export const WithTooltip: Story = {
143
- render: () => {
144
- const createPie = d3pie<CategoryDatum>()
145
- .value((d) => d.value)
146
- .sort(null);
147
- const data = Object.keys(TooltipVariant).map((tooltipVariant) => ({
148
- key: tooltipVariant,
149
- value: 333,
150
- }));
151
- const pieData = createPie(data);
152
-
153
- return (
154
- <svg width={500} height={500}>
155
- <Arcs
156
- hasLabels
157
- transform="translate(250,250)"
158
- arcs={Object.keys(TooltipVariant).map((tooltipVariant, index) => ({
159
- createArc,
160
- hasStroke: true,
161
- index,
162
- isSelected: true,
163
- key: tooltipVariant,
164
- labelDecorator: (datum: ArcDatum) =>
165
- `${datum.data.key.charAt(0).toUpperCase()}${datum.data.key.slice(
166
- 1
167
- )}`,
168
- percent: 0.25,
169
- data: pieData[index],
170
- tooltipVariant,
171
- role: 'option',
172
- }))}
173
- />
174
- </svg>
175
- );
176
- },
177
- };
@@ -1,108 +0,0 @@
1
- import React, { RefObject, forwardRef } from 'react';
2
- import classNames from 'classnames';
3
- import { animated, useSpring } from '@react-spring/web';
4
- import { interpolate as d3interpolate } from 'd3';
5
-
6
- import { Comp, useId } from '@redsift/design-system';
7
-
8
- import { ArcsProps } from './types';
9
- import { StyledArcs } from './styles';
10
- import { Arc } from '../Arc';
11
- import { config } from '../../config';
12
-
13
- const COMPONENT_NAME = 'Arcs';
14
- const CLASSNAME = 'redsift-arcs';
15
- const DEFAULT_PROPS: Partial<ArcsProps> = {};
16
-
17
- export const Arcs: Comp<ArcsProps, SVGGElement> = forwardRef((props, ref) => {
18
- const {
19
- arcs,
20
- className,
21
- color,
22
- hasLabels,
23
- hasStroke,
24
- id: propsId,
25
- labelDecorator,
26
- onClick,
27
- role,
28
- sliceProps,
29
- tooltipVariant,
30
- ...forwardedProps
31
- } = props;
32
- const [_id] = useId();
33
- const id = propsId ?? _id;
34
-
35
- const animatedProps = useSpring({
36
- ...config,
37
- to: async (next: (props?: object) => Promise<void>) => {
38
- await next({ t: 1 });
39
- },
40
- from: { t: 0 },
41
- });
42
-
43
- return (
44
- <StyledArcs
45
- {...forwardedProps}
46
- className={classNames(Arcs.className, className)}
47
- ref={ref as RefObject<SVGGElement>}
48
- >
49
- <g className="arc-group">
50
- {arcs.map((arc, index) => {
51
- const arcIndex = arc.index ?? index;
52
- const arcId = arc.id ?? `id${id}__arc-${arcIndex}`;
53
-
54
- return (
55
- <Arc
56
- {...sliceProps}
57
- color={color}
58
- hasStroke={hasStroke}
59
- labelDecorator={labelDecorator}
60
- onClick={onClick}
61
- role={role}
62
- tooltipVariant={tooltipVariant}
63
- {...arc}
64
- key={arcId}
65
- id={arcId}
66
- index={arcIndex}
67
- />
68
- );
69
- })}
70
- </g>
71
- {hasLabels ? (
72
- <g className="arc-label-group">
73
- {arcs
74
- .filter((arc) => {
75
- const value = arc.data.data.value;
76
- const percent = arc.data.data.percent;
77
- return percent ? value > 0 && percent >= 0.1 : value > 0;
78
- })
79
- .map((arc, index) => {
80
- const arcIndex = arc.index ?? index;
81
- const arcId = arc.id ?? `id${id}__arc-${arcIndex}`;
82
- const arcLabelDecorator = arc.labelDecorator ?? labelDecorator;
83
- const interpolator = d3interpolate(arc.from, arc.data);
84
-
85
- return (
86
- <animated.text
87
- alignmentBaseline="middle"
88
- className={`arc-label _${index}`}
89
- key={`${arcId}-label`}
90
- textAnchor="middle"
91
- transform={
92
- config.immediate
93
- ? `translate(${arc.createArc.centroid(arc.data)})`
94
- : animatedProps.t.to((t) => `translate(${arc.createArc.centroid(interpolator(t))})`)
95
- }
96
- >
97
- {arcLabelDecorator ? arcLabelDecorator(arc.data) : arc.data.data.key}
98
- </animated.text>
99
- );
100
- })}
101
- </g>
102
- ) : null}
103
- </StyledArcs>
104
- );
105
- });
106
- Arcs.className = CLASSNAME;
107
- Arcs.defaultProps = DEFAULT_PROPS;
108
- Arcs.displayName = COMPONENT_NAME;
@@ -1,3 +0,0 @@
1
- export * from './Arcs';
2
- export * from './types';
3
- export * from './styles';
@@ -1,7 +0,0 @@
1
- import styled from 'styled-components';
2
- import { StyledArcsProps } from './types';
3
-
4
- /**
5
- * Component style.
6
- */
7
- export const StyledArcs = styled.g<StyledArcsProps>``;
@@ -1,26 +0,0 @@
1
- import { ComponentProps } from 'react';
2
- import { ArcProps } from '../Arc/types';
3
-
4
- /**
5
- * Component props.
6
- */
7
- export interface ArcsProps
8
- extends Omit<ComponentProps<'g'>, 'onClick' | 'role'>,
9
- Pick<
10
- ArcProps,
11
- | 'id'
12
- | 'labelDecorator'
13
- | 'onClick'
14
- | 'role'
15
- | 'hasStroke'
16
- | 'tooltipVariant'
17
- > {
18
- /** Arc props. */
19
- arcs: Omit<ArcProps, 'ref'>[];
20
- /** Whether arcs have internal labels or not. */
21
- hasLabels?: boolean;
22
- /** Native HTML props to forward to each slice. */
23
- sliceProps?: Omit<ComponentProps<'g'>, 'onClick' | 'ref' | 'width'>;
24
- }
25
-
26
- export type StyledArcsProps = Omit<ArcsProps, 'arcs'> & {};