@pie-lib/charting 7.0.3-next.3 → 7.0.4-next.0

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 (269) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +23 -0
  2. package/dist/actions-button.d.ts +26 -0
  3. package/dist/actions-button.js +84 -0
  4. package/dist/axes.d.ts +84 -0
  5. package/dist/axes.js +376 -0
  6. package/dist/bars/bar.d.ts +47 -0
  7. package/dist/bars/bar.js +27 -0
  8. package/dist/bars/common/bars.d.ts +98 -0
  9. package/dist/bars/common/bars.js +174 -0
  10. package/dist/bars/common/correct-check-icon.d.ts +18 -0
  11. package/dist/bars/common/correct-check-icon.js +50 -0
  12. package/dist/bars/histogram.d.ts +47 -0
  13. package/dist/bars/histogram.js +28 -0
  14. package/dist/chart-setup.d.ts +29 -0
  15. package/dist/chart-setup.js +231 -0
  16. package/dist/chart-type.d.ts +32 -0
  17. package/dist/chart-type.js +68 -0
  18. package/dist/chart-types.d.ts +41 -0
  19. package/dist/chart-types.js +17 -0
  20. package/dist/chart.d.ts +88 -0
  21. package/dist/chart.js +250 -0
  22. package/dist/common/correctness-indicators.d.ts +70 -0
  23. package/dist/common/correctness-indicators.js +106 -0
  24. package/dist/common/drag-handle.d.ts +129 -0
  25. package/dist/common/drag-handle.js +120 -0
  26. package/dist/common/drag-icon.d.ts +23 -0
  27. package/dist/common/drag-icon.js +45 -0
  28. package/dist/common/styles.d.ts +23 -0
  29. package/dist/common/styles.js +17 -0
  30. package/dist/grid.d.ts +45 -0
  31. package/dist/grid.js +56 -0
  32. package/dist/index.d.ts +14 -0
  33. package/dist/index.js +6 -0
  34. package/dist/key-legend.d.ts +19 -0
  35. package/dist/key-legend.js +46 -0
  36. package/dist/line/common/drag-handle.d.ts +120 -0
  37. package/dist/line/common/drag-handle.js +92 -0
  38. package/dist/line/common/line.d.ts +96 -0
  39. package/dist/line/common/line.js +114 -0
  40. package/dist/line/line-cross.d.ts +47 -0
  41. package/dist/line/line-cross.js +133 -0
  42. package/dist/line/line-dot.d.ts +47 -0
  43. package/dist/line/line-dot.js +101 -0
  44. package/dist/mark-label.d.ts +55 -0
  45. package/dist/mark-label.js +139 -0
  46. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Axis.js +100 -0
  47. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/AxisBottom.js +45 -0
  48. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/AxisLeft.js +46 -0
  49. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/AxisRenderer.js +61 -0
  50. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Ticks.js +42 -0
  51. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/constants/orientation.js +9 -0
  52. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/createPoint.js +14 -0
  53. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getAxisRangePaddingConfig.js +21 -0
  54. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getLabelTransform.js +16 -0
  55. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getTickFormatter.js +8 -0
  56. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getTickPosition.js +15 -0
  57. package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/GridColumns.js +79 -0
  58. package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/GridRows.js +79 -0
  59. package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/utils/getScaleBandwidth.js +6 -0
  60. package/dist/node_modules/.bun/@visx_group@3.12.0_f4eacebf2041cd4f/node_modules/@visx/group/esm/Group.js +49 -0
  61. package/dist/node_modules/.bun/@visx_point@3.12.0/node_modules/@visx/point/esm/Point.js +18 -0
  62. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/align.js +6 -0
  63. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/base.js +6 -0
  64. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/clamp.js +6 -0
  65. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/constant.js +6 -0
  66. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/domain.js +6 -0
  67. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/exponent.js +6 -0
  68. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/interpolate.js +10 -0
  69. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/nice.js +37 -0
  70. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/padding.js +6 -0
  71. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/range.js +6 -0
  72. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/reverse.js +9 -0
  73. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/round.js +7 -0
  74. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/scaleOperator.js +58 -0
  75. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/unknown.js +6 -0
  76. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/zero.js +9 -0
  77. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/scales/band.js +9 -0
  78. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/scales/point.js +9 -0
  79. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/coerceNumber.js +10 -0
  80. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/createColorInterpolator.js +29 -0
  81. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/getTicks.js +9 -0
  82. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/isUtcScale.js +7 -0
  83. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/toString.js +6 -0
  84. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/Bar.js +28 -0
  85. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/Circle.js +28 -0
  86. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/Line.js +46 -0
  87. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/LinePath.js +49 -0
  88. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/util/D3ShapeFactories.js +9 -0
  89. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/util/setNumberOrNumberAccessor.js +6 -0
  90. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/lib/shapes/Line.js +52 -0
  91. package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/Text.js +57 -0
  92. package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/hooks/useText.js +91 -0
  93. package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/util/getStringWidth.js +21 -0
  94. package/dist/node_modules/.bun/@visx_vendor@3.12.0/node_modules/@visx/vendor/esm/d3-interpolate.js +8 -0
  95. package/dist/node_modules/.bun/@visx_vendor@3.12.0/node_modules/@visx/vendor/esm/d3-scale.js +8 -0
  96. package/dist/node_modules/.bun/@visx_vendor@3.12.0/node_modules/@visx/vendor/esm/d3-time.js +8 -0
  97. package/dist/node_modules/.bun/balanced-match@0.4.2/node_modules/balanced-match/index.js +32 -0
  98. package/dist/node_modules/.bun/balanced-match@1.0.2/node_modules/balanced-match/index.js +33 -0
  99. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_Hash.js +21 -0
  100. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_ListCache.js +21 -0
  101. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_Map.js +10 -0
  102. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_MapCache.js +21 -0
  103. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_Symbol.js +9 -0
  104. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_assocIndexOf.js +14 -0
  105. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_baseGetTag.js +15 -0
  106. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_baseIsNative.js +16 -0
  107. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_coreJsData.js +9 -0
  108. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_freeGlobal.js +8 -0
  109. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getMapData.js +14 -0
  110. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getNative.js +15 -0
  111. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getRawTag.js +19 -0
  112. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getValue.js +11 -0
  113. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashClear.js +13 -0
  114. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashDelete.js +12 -0
  115. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashGet.js +18 -0
  116. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashHas.js +14 -0
  117. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashSet.js +14 -0
  118. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_isKeyable.js +12 -0
  119. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_isMasked.js +16 -0
  120. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheClear.js +11 -0
  121. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheDelete.js +14 -0
  122. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheGet.js +14 -0
  123. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheHas.js +13 -0
  124. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheSet.js +14 -0
  125. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheClear.js +19 -0
  126. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheDelete.js +14 -0
  127. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheGet.js +13 -0
  128. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheHas.js +13 -0
  129. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheSet.js +14 -0
  130. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_nativeCreate.js +9 -0
  131. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_objectToString.js +12 -0
  132. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_root.js +10 -0
  133. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_toSource.js +20 -0
  134. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/eq.js +11 -0
  135. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/isFunction.js +16 -0
  136. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/isObject.js +12 -0
  137. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/memoize.js +20 -0
  138. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/formula_evaluator.js +37 -0
  139. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/lexer.js +509 -0
  140. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/math_function.js +108 -0
  141. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix.js +31 -0
  142. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix_evaluator.js +45 -0
  143. package/dist/node_modules/.bun/react-input-autosize@2.2.2_f4eacebf2041cd4f/node_modules/react-input-autosize/lib/AutosizeInput.js +216 -0
  144. package/dist/node_modules/.bun/reduce-css-calc@1.3.0/node_modules/reduce-css-calc/index.js +49 -0
  145. package/dist/node_modules/.bun/reduce-function-call@1.0.3/node_modules/reduce-function-call/index.js +34 -0
  146. package/dist/plot/common/plot.d.ts +103 -0
  147. package/dist/plot/common/plot.js +227 -0
  148. package/dist/plot/dot.d.ts +47 -0
  149. package/dist/plot/dot.js +62 -0
  150. package/dist/plot/line.d.ts +47 -0
  151. package/dist/plot/line.js +84 -0
  152. package/dist/tool-menu.d.ts +31 -0
  153. package/dist/utils.d.ts +39 -0
  154. package/dist/utils.js +101 -0
  155. package/package.json +35 -25
  156. package/CHANGELOG.json +0 -17
  157. package/CHANGELOG.md +0 -1110
  158. package/LICENSE.md +0 -5
  159. package/lib/actions-button.js +0 -145
  160. package/lib/actions-button.js.map +0 -1
  161. package/lib/axes.js +0 -643
  162. package/lib/axes.js.map +0 -1
  163. package/lib/bars/bar.js +0 -58
  164. package/lib/bars/bar.js.map +0 -1
  165. package/lib/bars/common/bars.js +0 -277
  166. package/lib/bars/common/bars.js.map +0 -1
  167. package/lib/bars/common/correct-check-icon.js +0 -54
  168. package/lib/bars/common/correct-check-icon.js.map +0 -1
  169. package/lib/bars/histogram.js +0 -59
  170. package/lib/bars/histogram.js.map +0 -1
  171. package/lib/chart-setup.js +0 -382
  172. package/lib/chart-setup.js.map +0 -1
  173. package/lib/chart-type.js +0 -80
  174. package/lib/chart-type.js.map +0 -1
  175. package/lib/chart-types.js +0 -22
  176. package/lib/chart-types.js.map +0 -1
  177. package/lib/chart.js +0 -384
  178. package/lib/chart.js.map +0 -1
  179. package/lib/common/correctness-indicators.js +0 -156
  180. package/lib/common/correctness-indicators.js.map +0 -1
  181. package/lib/common/drag-handle.js +0 -160
  182. package/lib/common/drag-handle.js.map +0 -1
  183. package/lib/common/drag-icon.js +0 -52
  184. package/lib/common/drag-icon.js.map +0 -1
  185. package/lib/common/styles.js +0 -22
  186. package/lib/common/styles.js.map +0 -1
  187. package/lib/grid.js +0 -101
  188. package/lib/grid.js.map +0 -1
  189. package/lib/index.js +0 -42
  190. package/lib/index.js.map +0 -1
  191. package/lib/key-legend.js +0 -87
  192. package/lib/key-legend.js.map +0 -1
  193. package/lib/line/common/drag-handle.js +0 -146
  194. package/lib/line/common/drag-handle.js.map +0 -1
  195. package/lib/line/common/line.js +0 -214
  196. package/lib/line/common/line.js.map +0 -1
  197. package/lib/line/line-cross.js +0 -214
  198. package/lib/line/line-cross.js.map +0 -1
  199. package/lib/line/line-dot.js +0 -158
  200. package/lib/line/line-dot.js.map +0 -1
  201. package/lib/mark-label.js +0 -237
  202. package/lib/mark-label.js.map +0 -1
  203. package/lib/plot/common/plot.js +0 -349
  204. package/lib/plot/common/plot.js.map +0 -1
  205. package/lib/plot/dot.js +0 -110
  206. package/lib/plot/dot.js.map +0 -1
  207. package/lib/plot/line.js +0 -140
  208. package/lib/plot/line.js.map +0 -1
  209. package/lib/tool-menu.js +0 -106
  210. package/lib/tool-menu.js.map +0 -1
  211. package/lib/utils.js +0 -189
  212. package/lib/utils.js.map +0 -1
  213. package/src/__tests__/actions-button.test.jsx +0 -280
  214. package/src/__tests__/axes.test.jsx +0 -667
  215. package/src/__tests__/chart-setup.test.jsx +0 -532
  216. package/src/__tests__/chart-type.test.jsx +0 -23
  217. package/src/__tests__/chart.test.jsx +0 -86
  218. package/src/__tests__/grid.test.jsx +0 -37
  219. package/src/__tests__/key-legend.test.jsx +0 -223
  220. package/src/__tests__/mark-label.test.jsx +0 -33
  221. package/src/__tests__/tool-menu.test.jsx +0 -522
  222. package/src/__tests__/utils.js +0 -36
  223. package/src/__tests__/utils.test.js +0 -100
  224. package/src/actions-button.jsx +0 -115
  225. package/src/axes.jsx +0 -594
  226. package/src/bars/__tests__/bar.test.jsx +0 -45
  227. package/src/bars/__tests__/histogram.test.jsx +0 -45
  228. package/src/bars/__tests__/utils.js +0 -30
  229. package/src/bars/bar.js +0 -28
  230. package/src/bars/common/__tests__/bars.test.jsx +0 -68
  231. package/src/bars/common/__tests__/utils.js +0 -30
  232. package/src/bars/common/bars.jsx +0 -249
  233. package/src/bars/common/correct-check-icon.jsx +0 -25
  234. package/src/bars/histogram.js +0 -28
  235. package/src/chart-setup.jsx +0 -356
  236. package/src/chart-type.js +0 -59
  237. package/src/chart-types.js +0 -8
  238. package/src/chart.jsx +0 -357
  239. package/src/common/__tests__/correctness-indicators.test.jsx +0 -720
  240. package/src/common/__tests__/drag-handle.test.jsx +0 -58
  241. package/src/common/__tests__/utils.js +0 -30
  242. package/src/common/correctness-indicators.jsx +0 -128
  243. package/src/common/drag-handle.jsx +0 -125
  244. package/src/common/drag-icon.jsx +0 -36
  245. package/src/common/styles.js +0 -19
  246. package/src/grid.jsx +0 -68
  247. package/src/index.js +0 -7
  248. package/src/key-legend.jsx +0 -77
  249. package/src/line/__tests__/line-cross.test.jsx +0 -463
  250. package/src/line/__tests__/line-dot.test.jsx +0 -41
  251. package/src/line/__tests__/utils.js +0 -36
  252. package/src/line/common/__tests__/drag-handle.test.jsx +0 -62
  253. package/src/line/common/__tests__/line.test.jsx +0 -79
  254. package/src/line/common/__tests__/utils.js +0 -30
  255. package/src/line/common/drag-handle.jsx +0 -114
  256. package/src/line/common/line.jsx +0 -171
  257. package/src/line/line-cross.js +0 -144
  258. package/src/line/line-dot.js +0 -111
  259. package/src/mark-label.jsx +0 -238
  260. package/src/plot/__tests__/dot.test.jsx +0 -344
  261. package/src/plot/__tests__/line.test.jsx +0 -375
  262. package/src/plot/__tests__/utils.js +0 -30
  263. package/src/plot/common/__tests__/plot.test.jsx +0 -69
  264. package/src/plot/common/__tests__/utils.js +0 -30
  265. package/src/plot/common/plot.jsx +0 -358
  266. package/src/plot/dot.js +0 -74
  267. package/src/plot/line.js +0 -98
  268. package/src/tool-menu.jsx +0 -85
  269. package/src/utils.js +0 -201
@@ -1,58 +0,0 @@
1
- import { render } from '@testing-library/react';
2
- import React from 'react';
3
- import DragHandle from '../drag-handle';
4
- import { gridDraggable } from '@pie-lib/plot';
5
- import { graphProps } from './utils';
6
-
7
- jest.mock('../../utils', () => {
8
- const { point } = jest.requireActual('../../utils');
9
- return {
10
- bounds: jest.fn(),
11
- point,
12
- getScale: jest.fn(() => ({ scale: 1 })),
13
- };
14
- });
15
-
16
- jest.mock('@pie-lib/plot', () => {
17
- const { types, utils } = jest.requireActual('@pie-lib/plot');
18
- return {
19
- gridDraggable: jest.fn((opts) => (Comp) => Comp),
20
- types,
21
- utils,
22
- };
23
- });
24
-
25
- describe('BasePoint', () => {
26
- let onChange = jest.fn();
27
- const renderComponent = (extras) => {
28
- const defaults = {
29
- classes: {},
30
- className: 'className',
31
- onChange,
32
- graphProps: graphProps(),
33
- x: 0,
34
- y: 0,
35
- width: 100,
36
- };
37
- const props = { ...defaults, ...extras };
38
- return render(<DragHandle {...props} />);
39
- };
40
-
41
- describe('rendering', () => {
42
- it('renders without crashing', () => {
43
- const { container } = renderComponent();
44
- expect(container.firstChild).toBeInTheDocument();
45
- });
46
- });
47
-
48
- describe('gridDraggable options', () => {
49
- it('configures gridDraggable with correct options', () => {
50
- // The gridDraggable HOC is tested by verifying that it's called with the component
51
- // Detailed unit tests for the HOC options would require accessing internal
52
- // implementation details which is not recommended with RTL
53
- const { container } = renderComponent();
54
- expect(container.firstChild).toBeInTheDocument();
55
- expect(gridDraggable).toHaveBeenCalled();
56
- });
57
- });
58
- });
@@ -1,30 +0,0 @@
1
- export const scaleMock = () => {
2
- const fn = jest.fn((n) => n);
3
- fn.invert = jest.fn((n) => n);
4
- return fn;
5
- };
6
-
7
- export const graphProps = (dmin = 0, dmax = 1, rmin = 0, rmax = 1) => ({
8
- scale: {
9
- x: scaleMock(),
10
- y: scaleMock(),
11
- },
12
- snap: {
13
- x: jest.fn((n) => n),
14
- y: jest.fn((n) => n),
15
- },
16
- domain: {
17
- min: dmin,
18
- max: dmax,
19
- step: 1,
20
- },
21
- range: {
22
- min: rmin,
23
- max: rmax,
24
- step: 1,
25
- },
26
- size: {
27
- width: 400,
28
- height: 400,
29
- },
30
- });
@@ -1,128 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { styled } from '@mui/material/styles';
4
- import Check from '@mui/icons-material/Check';
5
- import Close from '@mui/icons-material/Close';
6
- import { color as enumColor } from '@pie-lib/render-ui';
7
-
8
- const StyledCorrectIcon = styled(Check)(({ theme }) => ({
9
- borderRadius: theme.spacing(2),
10
- color: enumColor.defaults.WHITE,
11
- fontSize: '16px',
12
- width: '16px',
13
- height: '16px',
14
- padding: '2px',
15
- border: `1px solid ${enumColor.defaults.WHITE}`,
16
- stroke: 'initial',
17
- boxSizing: 'unset', // to override the default border-box in IBX
18
- backgroundColor: enumColor.correct(),
19
- display: 'block',
20
- '&.small': {
21
- fontSize: '10px',
22
- width: '10px',
23
- height: '10px',
24
- },
25
- }));
26
-
27
- const StyledIncorrectIcon = styled(Close)(({ theme }) => ({
28
- borderRadius: theme.spacing(2),
29
- color: enumColor.defaults.WHITE,
30
- fontSize: '16px',
31
- width: '16px',
32
- height: '16px',
33
- padding: '2px',
34
- border: `1px solid ${enumColor.defaults.WHITE}`,
35
- stroke: 'initial',
36
- boxSizing: 'unset', // to override the default border-box in IBX
37
- backgroundColor: enumColor.incorrectWithIcon(),
38
- display: 'block',
39
- '&.small': {
40
- fontSize: '10px',
41
- width: '10px',
42
- height: '10px',
43
- },
44
- }));
45
-
46
- export const CorrectnessIndicator = ({ scale, x, y, correctness, interactive }) => {
47
- if (!correctness || !interactive) return null;
48
- const cx = scale ? scale.x(x) : x;
49
- const cy = scale ? scale.y(y) : y;
50
- const isCorrect = correctness.value === 'correct';
51
-
52
- // the icon is 16px + 2px padding + 1px border, so total size is 22px
53
- return (
54
- <foreignObject x={cx - 11} y={cy - 11} width={22} height={22}>
55
- {isCorrect ? <StyledCorrectIcon title={correctness.label} /> : <StyledIncorrectIcon title={correctness.label} />}
56
- </foreignObject>
57
- );
58
- };
59
-
60
- export const SmallCorrectPointIndicator = ({ scale, x, correctness, correctData, label }) => {
61
- if (correctness && correctness.value === 'incorrect') {
62
- const correctVal = parseFloat(correctData.find((d) => d.label === label)?.value);
63
- if (isNaN(correctVal)) return null;
64
- const correctPxY = scale.y(correctVal);
65
- const yToRender = correctPxY - 7.5;
66
- const xToRender = scale.x(x) - 7.5;
67
-
68
- // small circle has 10px font + 2px padding + 1px border, so total size is 15px
69
- return (
70
- <foreignObject x={xToRender} y={yToRender} width={15} height={15}>
71
- <StyledCorrectIcon className="small" title={correctness.label} />
72
- </foreignObject>
73
- );
74
- }
75
-
76
- return null;
77
- };
78
-
79
- export const TickCorrectnessIndicator = ({ correctness, interactive }) => {
80
- if (!correctness || !interactive) return null;
81
-
82
- return correctness.value === 'correct' ? (
83
- <StyledCorrectIcon title={correctness.label} />
84
- ) : (
85
- <StyledIncorrectIcon title={correctness.label} />
86
- );
87
- };
88
-
89
- CorrectnessIndicator.propTypes = {
90
- scale: PropTypes.shape({
91
- x: PropTypes.func,
92
- y: PropTypes.func,
93
- }),
94
- x: PropTypes.number.isRequired,
95
- y: PropTypes.number.isRequired,
96
- correctness: PropTypes.shape({
97
- value: PropTypes.string,
98
- label: PropTypes.string,
99
- }),
100
- interactive: PropTypes.bool,
101
- };
102
-
103
- SmallCorrectPointIndicator.propTypes = {
104
- scale: PropTypes.shape({
105
- x: PropTypes.func,
106
- y: PropTypes.func,
107
- }).isRequired,
108
- x: PropTypes.number.isRequired,
109
- correctness: PropTypes.shape({
110
- value: PropTypes.string,
111
- label: PropTypes.string,
112
- }),
113
- correctData: PropTypes.arrayOf(
114
- PropTypes.shape({
115
- label: PropTypes.string,
116
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
117
- }),
118
- ),
119
- label: PropTypes.string,
120
- };
121
-
122
- TickCorrectnessIndicator.propTypes = {
123
- correctness: PropTypes.shape({
124
- value: PropTypes.string,
125
- label: PropTypes.string,
126
- }),
127
- interactive: PropTypes.bool,
128
- };
@@ -1,125 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { styled } from '@mui/material/styles';
4
- import Check from '@mui/icons-material/Check';
5
- import Close from '@mui/icons-material/Close';
6
-
7
- import { gridDraggable, types, utils } from '@pie-lib/plot';
8
- import { color as enumColor } from '@pie-lib/render-ui';
9
- import { getScale } from '../utils';
10
- import DragIcon from './drag-icon';
11
-
12
- const StyledSvg = styled('svg')(() => ({
13
- overflow: 'visible !important',
14
- }));
15
-
16
- const StyledEllipse = styled('ellipse')(() => ({
17
- fill: 'transparent',
18
- clipPath: 'polygon(50% 0%, 100% 0%, 100% 50%, 0% 50%, 0% 0%)',
19
- }));
20
-
21
- const StyledCorrectIcon = styled(Check)(() => ({
22
- backgroundColor: enumColor.correct(),
23
- borderRadius: '16px', // equivalent to theme.spacing(2) for most themes
24
- color: enumColor.defaults.WHITE,
25
- fontSize: '16px',
26
- padding: '2px',
27
- border: `4px solid ${enumColor.defaults.WHITE}`,
28
- width: '16px',
29
- height: '16px',
30
- boxSizing: 'unset', // to override the default border-box in IBX
31
- }));
32
-
33
- const StyledIncorrectIcon = styled(Close)(() => ({
34
- backgroundColor: enumColor.incorrectWithIcon(),
35
- borderRadius: '16px', // equivalent to theme.spacing(2) for most themes
36
- color: enumColor.defaults.WHITE,
37
- fontSize: '16px',
38
- padding: '2px',
39
- border: `4px solid ${enumColor.defaults.WHITE}`,
40
- width: '16px',
41
- height: '16px',
42
- boxSizing: 'unset', // to override the default border-box in IBX
43
- }));
44
-
45
- const RawDragHandle = ({ x, y, width, graphProps, interactive, isHovered, correctness, isPlot, ...rest }) => {
46
- const { scale } = graphProps;
47
- const scaleValue = getScale(width)?.scale;
48
-
49
- return (
50
- <StyledSvg x={x} y={scale.y(y) - 10} width={width} overflow="visible">
51
- {isHovered && !correctness && interactive && (
52
- <DragIcon width={width} scaleValue={scaleValue} color={enumColor.defaults.BORDER_GRAY} />
53
- )}
54
- {interactive && !correctness && (
55
- <StyledEllipse
56
- cx={width / 2}
57
- cy={10}
58
- rx={width / 2}
59
- // the drag icon has a 22px fixed r value, so the ry value is 3 times that in order to cover all the area
60
- ry={66}
61
- {...rest}
62
- />
63
- )}
64
-
65
- <defs>
66
- <filter id="bottomShadow" x="0" y="0" width="140%" height="140%">
67
- <feGaussianBlur in="SourceAlpha" stdDeviation="3" />
68
- <feOffset dx="0" dy="5" result="offsetblur" />
69
- <feFlood floodColor="#00000033" />
70
- <feComposite in2="offsetblur" operator="in" />
71
- <feMerge>
72
- <feMergeNode />
73
- <feMergeNode in="SourceGraphic" />
74
- </feMerge>
75
- </filter>
76
- </defs>
77
-
78
- {correctness && interactive && !isPlot && (
79
- <foreignObject x={width / 2 - 14} y={0} width={40} height={40}>
80
- {correctness.value === 'correct' ? (
81
- <StyledCorrectIcon title={correctness.label} />
82
- ) : (
83
- <StyledIncorrectIcon title={correctness.label} />
84
- )}
85
- </foreignObject>
86
- )}
87
- </StyledSvg>
88
- );
89
- };
90
-
91
- RawDragHandle.propTypes = {
92
- x: PropTypes.number.isRequired,
93
- y: PropTypes.number.isRequired,
94
- width: PropTypes.number,
95
- graphProps: types.GraphPropsType.isRequired,
96
- interactive: PropTypes.bool,
97
- isHovered: PropTypes.bool,
98
- correctness: PropTypes.shape({
99
- value: PropTypes.string,
100
- label: PropTypes.string,
101
- }),
102
- isPlot: PropTypes.bool,
103
- };
104
-
105
- export const DragHandle = RawDragHandle;
106
-
107
- export const D = gridDraggable({
108
- axis: 'y',
109
- fromDelta: (props, delta) => {
110
- //TODO: should be in grid-draggable, if axis is y delta.x should always be 0.
111
- delta.x = 0;
112
- const newPoint = utils.point(props).add(utils.point(delta));
113
-
114
- return newPoint.y;
115
- },
116
- bounds: (props, { domain, range }) => {
117
- const area = { left: 0, top: props.y, bottom: props.y, right: 0 };
118
- return utils.bounds(area, domain, range);
119
- },
120
- anchorPoint: (props) => {
121
- return { x: props.x, y: props.y };
122
- },
123
- })(DragHandle);
124
-
125
- export default D;
@@ -1,36 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { getAdjustedX, getScale } from '../utils';
4
-
5
- const DragIcon = ({ width, scaleValue, color }) => (
6
- <svg
7
- x={getAdjustedX(width, scaleValue)}
8
- y={getScale(width)?.deltay}
9
- color={color}
10
- width={width}
11
- height={width}
12
- overflow="visible"
13
- viewBox={`0 0 ${width} ${width}`}
14
- style={{ overflow: 'visible !important' }}
15
- >
16
- <g xmlns="http://www.w3.org/2000/svg" fill="currentColor" stroke="currentColor" transform={`scale(${scaleValue})`}>
17
- <circle cx="28.5" cy="23.5" r="22" fill="white" stroke="currentColor" />
18
- <path
19
- d="M33.5 21.25H23.4609C22.7578 21.25 22.4062 20.4297 22.9141 19.9219L27.9141 14.9219C28.2266 14.6094 28.7344 14.6094 29.0469 14.9219L34.0469 19.9219C34.5547 20.4297 34.2031 21.25 33.5 21.25Z"
20
- fill="currentColor"
21
- />
22
- <path
23
- d="M23.5 25.75L33.5391 25.75C34.2422 25.75 34.5938 26.5703 34.0859 27.0781L29.0859 32.0781C28.7734 32.3906 28.2656 32.3906 27.9531 32.0781L22.9531 27.0781C22.4453 26.5703 22.7969 25.75 23.5 25.75Z"
24
- fill="currentColor"
25
- />
26
- </g>
27
- </svg>
28
- );
29
-
30
- DragIcon.propTypes = {
31
- width: PropTypes.number.isRequired,
32
- scaleValue: PropTypes.number.isRequired,
33
- color: PropTypes.string,
34
- };
35
-
36
- export default DragIcon;
@@ -1,19 +0,0 @@
1
- import { color } from '@pie-lib/render-ui';
2
-
3
- export const disabled = (key = 'fill') => ({
4
- [key]: `var(--graph-disabled, ${color.disabled()})`,
5
- pointerEvents: 'none',
6
- border: 'none',
7
- });
8
-
9
- export const correct = (key = 'fill') => ({
10
- [key]: color.correct(),
11
- pointerEvents: 'none',
12
- border: `solid 1px ${color.correct()}`,
13
- });
14
-
15
- export const incorrect = (key = 'fill') => ({
16
- [key]: color.incorrect(),
17
- pointerEvents: 'none',
18
- border: `solid 1px ${color.incorrect()}`,
19
- });
package/src/grid.jsx DELETED
@@ -1,68 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { styled } from '@mui/material/styles';
4
- import { GridColumns, GridRows } from '@visx/grid';
5
-
6
- import { types } from '@pie-lib/plot';
7
- import { color } from '@pie-lib/render-ui';
8
-
9
- const StyledGridGroup = styled('g')(() => ({
10
- stroke: color.primaryLight(),
11
- }));
12
-
13
- export class Grid extends React.Component {
14
- static propTypes = {
15
- className: PropTypes.string,
16
- graphProps: types.GraphPropsType.isRequired,
17
- xBand: PropTypes.func,
18
- columnTickValues: PropTypes.array,
19
- rowTickValues: PropTypes.array,
20
- };
21
-
22
- static defaultProps = {};
23
-
24
- render() {
25
- const { graphProps, xBand, rowTickValues, columnTickValues } = this.props;
26
- const { scale = {}, size = {}, range = {} } = graphProps || {};
27
- const { step = 0, labelStep = 0 } = range;
28
- const highlightNonLabel = step && labelStep && step < labelStep;
29
- // if highlightNonLabel is true, we need to separate the unlabled lines in order to render them in a different color
30
- const { unlabeledLines, labeledLines } = (rowTickValues || []).reduce(
31
- (acc, value) => {
32
- if (highlightNonLabel && value % labelStep !== 0) {
33
- acc.unlabeledLines.push(value);
34
- } else {
35
- acc.labeledLines.push(value);
36
- }
37
- return acc;
38
- },
39
- { unlabeledLines: [], labeledLines: [] },
40
- );
41
-
42
- return (
43
- <StyledGridGroup>
44
- <GridRows
45
- scale={scale.y}
46
- width={size.width}
47
- tickValues={unlabeledLines}
48
- lineStyle={{
49
- stroke: color.fadedPrimary(),
50
- strokeWidth: 1,
51
- }}
52
- />
53
- <GridRows
54
- scale={scale.y}
55
- width={size.width}
56
- tickValues={labeledLines}
57
- lineStyle={{
58
- stroke: color.visualElementsColors.GRIDLINES_COLOR,
59
- strokeWidth: 1,
60
- }}
61
- />
62
- <GridColumns scale={xBand} height={size.height} offset={xBand.bandwidth() / 2} tickValues={columnTickValues} />
63
- </StyledGridGroup>
64
- );
65
- }
66
- }
67
-
68
- export default Grid;
package/src/index.js DELETED
@@ -1,7 +0,0 @@
1
- import Chart from './chart';
2
- import chartTypes from './chart-types';
3
- import ConfigureChartPanel from './chart-setup';
4
- import ChartType from './chart-type';
5
- import KeyLegend from './key-legend';
6
-
7
- export { Chart, chartTypes, ChartType, ConfigureChartPanel, KeyLegend };
@@ -1,77 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { styled } from '@mui/material/styles';
4
- import Check from '@mui/icons-material/Check';
5
- import Close from '@mui/icons-material/Close';
6
- import { color } from '@pie-lib/render-ui';
7
- import Translator from '@pie-lib/translator';
8
-
9
- const StyledContainer = styled('div')(({ theme }) => ({
10
- backgroundColor: color.defaults.WHITE,
11
- padding: theme.spacing(2),
12
- width: '355px',
13
- boxShadow: 'inset 0px 1px 5px 0px #9297A6',
14
- display: 'flex',
15
- flexDirection: 'column',
16
- gap: '16px',
17
- }));
18
-
19
- const StyledRow = styled('div')(() => ({
20
- display: 'flex',
21
- alignItems: 'center',
22
- gap: '12px',
23
- }));
24
-
25
- const StyledTitle = styled('div')(({ theme }) => ({
26
- fontSize: theme.typography.h6.fontSize,
27
- fontWeight: '700',
28
- }));
29
-
30
- const StyledSmallText = styled('div')(() => ({
31
- marginLeft: '2px',
32
- }));
33
-
34
- const StyledCorrectIcon = styled(Check)(({ theme }) => ({
35
- backgroundColor: color.correct(),
36
- borderRadius: theme.spacing(2),
37
- color: color.defaults.WHITE,
38
- }));
39
-
40
- const StyledIncorrectIcon = styled(Close)(({ theme }) => ({
41
- backgroundColor: color.incorrectWithIcon(),
42
- borderRadius: theme.spacing(2),
43
- color: color.defaults.WHITE,
44
- }));
45
-
46
- const StyledLastRow = styled('div')(() => ({
47
- marginLeft: '3px',
48
- display: 'flex',
49
- alignItems: 'center',
50
- gap: '12px',
51
- }));
52
-
53
- const { translator } = Translator;
54
-
55
- const KeyLegend = ({ language }) => (
56
- <StyledContainer>
57
- <StyledTitle>Key</StyledTitle>
58
- <StyledRow>
59
- <StyledIncorrectIcon />
60
- <div>{translator.t('charting.keyLegend.incorrectAnswer', { lng: language })}</div>
61
- </StyledRow>
62
- <StyledRow>
63
- <StyledCorrectIcon />
64
- <div>{translator.t('charting.keyLegend.correctAnswer', { lng: language })}</div>
65
- </StyledRow>
66
- <StyledLastRow>
67
- <StyledCorrectIcon fontSize={'small'} />
68
- <StyledSmallText>{translator.t('charting.keyLegend.correctKeyAnswer', { lng: language })}</StyledSmallText>
69
- </StyledLastRow>
70
- </StyledContainer>
71
- );
72
-
73
- KeyLegend.propTypes = {
74
- language: PropTypes.string,
75
- };
76
-
77
- export default KeyLegend;