@pie-lib/charting 7.0.4-next.29 → 7.0.4-next.30

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 (272) 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/autosize-input.d.ts +10 -0
  5. package/dist/autosize-input.js +66 -0
  6. package/dist/axes.d.ts +84 -0
  7. package/dist/axes.js +376 -0
  8. package/dist/bars/bar.d.ts +47 -0
  9. package/dist/bars/bar.js +27 -0
  10. package/dist/bars/common/bars.d.ts +98 -0
  11. package/dist/bars/common/bars.js +174 -0
  12. package/dist/bars/common/correct-check-icon.d.ts +18 -0
  13. package/dist/bars/common/correct-check-icon.js +50 -0
  14. package/dist/bars/histogram.d.ts +47 -0
  15. package/dist/bars/histogram.js +28 -0
  16. package/dist/chart-setup.d.ts +29 -0
  17. package/dist/chart-setup.js +231 -0
  18. package/dist/chart-type.d.ts +32 -0
  19. package/dist/chart-type.js +68 -0
  20. package/dist/chart-types.d.ts +41 -0
  21. package/dist/chart-types.js +17 -0
  22. package/dist/chart.d.ts +88 -0
  23. package/dist/chart.js +250 -0
  24. package/dist/common/correctness-indicators.d.ts +70 -0
  25. package/dist/common/correctness-indicators.js +106 -0
  26. package/dist/common/drag-handle.d.ts +129 -0
  27. package/dist/common/drag-handle.js +120 -0
  28. package/dist/common/drag-icon.d.ts +23 -0
  29. package/dist/common/drag-icon.js +45 -0
  30. package/dist/common/styles.d.ts +23 -0
  31. package/dist/common/styles.js +17 -0
  32. package/dist/grid.d.ts +45 -0
  33. package/dist/grid.js +56 -0
  34. package/dist/index.d.ts +14 -0
  35. package/dist/index.js +6 -0
  36. package/dist/key-legend.d.ts +19 -0
  37. package/dist/key-legend.js +46 -0
  38. package/dist/line/common/drag-handle.d.ts +120 -0
  39. package/dist/line/common/drag-handle.js +92 -0
  40. package/dist/line/common/line.d.ts +96 -0
  41. package/dist/line/common/line.js +114 -0
  42. package/dist/line/line-cross.d.ts +47 -0
  43. package/dist/line/line-cross.js +133 -0
  44. package/dist/line/line-dot.d.ts +47 -0
  45. package/dist/line/line-dot.js +101 -0
  46. package/dist/mark-label.d.ts +55 -0
  47. package/dist/mark-label.js +138 -0
  48. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Axis.js +101 -0
  49. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/AxisBottom.js +46 -0
  50. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/AxisLeft.js +47 -0
  51. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/AxisRenderer.js +63 -0
  52. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Ticks.js +44 -0
  53. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/constants/orientation.js +9 -0
  54. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/createPoint.js +14 -0
  55. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getAxisRangePaddingConfig.js +21 -0
  56. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getLabelTransform.js +16 -0
  57. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getTickFormatter.js +8 -0
  58. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getTickPosition.js +15 -0
  59. package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/GridColumns.js +79 -0
  60. package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/GridRows.js +79 -0
  61. package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/utils/getScaleBandwidth.js +6 -0
  62. package/dist/node_modules/.bun/@visx_group@3.12.0_f4eacebf2041cd4f/node_modules/@visx/group/esm/Group.js +50 -0
  63. package/dist/node_modules/.bun/@visx_point@3.12.0/node_modules/@visx/point/esm/Point.js +18 -0
  64. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/align.js +6 -0
  65. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/base.js +6 -0
  66. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/clamp.js +6 -0
  67. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/constant.js +6 -0
  68. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/domain.js +6 -0
  69. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/exponent.js +6 -0
  70. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/interpolate.js +10 -0
  71. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/nice.js +37 -0
  72. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/padding.js +6 -0
  73. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/range.js +6 -0
  74. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/reverse.js +9 -0
  75. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/round.js +7 -0
  76. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/scaleOperator.js +58 -0
  77. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/unknown.js +6 -0
  78. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/zero.js +9 -0
  79. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/scales/band.js +9 -0
  80. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/scales/point.js +9 -0
  81. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/coerceNumber.js +10 -0
  82. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/createColorInterpolator.js +29 -0
  83. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/getTicks.js +9 -0
  84. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/isUtcScale.js +7 -0
  85. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/toString.js +6 -0
  86. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/Bar.js +29 -0
  87. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/Circle.js +29 -0
  88. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/Line.js +47 -0
  89. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/LinePath.js +50 -0
  90. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/util/D3ShapeFactories.js +9 -0
  91. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/util/setNumberOrNumberAccessor.js +6 -0
  92. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/lib/shapes/Line.js +53 -0
  93. package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/Text.js +57 -0
  94. package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/hooks/useText.js +91 -0
  95. package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/util/getStringWidth.js +21 -0
  96. package/dist/node_modules/.bun/@visx_vendor@3.12.0/node_modules/@visx/vendor/esm/d3-interpolate.js +8 -0
  97. package/dist/node_modules/.bun/@visx_vendor@3.12.0/node_modules/@visx/vendor/esm/d3-scale.js +8 -0
  98. package/dist/node_modules/.bun/@visx_vendor@3.12.0/node_modules/@visx/vendor/esm/d3-time.js +8 -0
  99. package/dist/node_modules/.bun/balanced-match@0.4.2/node_modules/balanced-match/index.js +32 -0
  100. package/dist/node_modules/.bun/balanced-match@1.0.2/node_modules/balanced-match/index.js +33 -0
  101. package/dist/node_modules/.bun/classnames@2.5.1/node_modules/classnames/index.js +32 -0
  102. package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +16 -0
  103. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_Hash.js +21 -0
  104. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_ListCache.js +21 -0
  105. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_Map.js +10 -0
  106. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_MapCache.js +21 -0
  107. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_Symbol.js +9 -0
  108. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_assocIndexOf.js +14 -0
  109. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_baseGetTag.js +15 -0
  110. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_baseIsNative.js +16 -0
  111. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_coreJsData.js +9 -0
  112. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_freeGlobal.js +8 -0
  113. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getMapData.js +14 -0
  114. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getNative.js +15 -0
  115. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getRawTag.js +19 -0
  116. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getValue.js +11 -0
  117. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashClear.js +13 -0
  118. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashDelete.js +12 -0
  119. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashGet.js +18 -0
  120. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashHas.js +14 -0
  121. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashSet.js +14 -0
  122. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_isKeyable.js +12 -0
  123. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_isMasked.js +16 -0
  124. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheClear.js +11 -0
  125. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheDelete.js +14 -0
  126. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheGet.js +14 -0
  127. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheHas.js +13 -0
  128. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheSet.js +14 -0
  129. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheClear.js +19 -0
  130. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheDelete.js +14 -0
  131. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheGet.js +13 -0
  132. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheHas.js +13 -0
  133. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheSet.js +14 -0
  134. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_nativeCreate.js +9 -0
  135. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_objectToString.js +12 -0
  136. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_root.js +10 -0
  137. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_toSource.js +20 -0
  138. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/eq.js +11 -0
  139. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/isFunction.js +16 -0
  140. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/isObject.js +12 -0
  141. package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/memoize.js +20 -0
  142. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/formula_evaluator.js +37 -0
  143. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/lexer.js +509 -0
  144. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/math_function.js +108 -0
  145. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix.js +31 -0
  146. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix_evaluator.js +45 -0
  147. package/dist/node_modules/.bun/reduce-css-calc@1.3.0/node_modules/reduce-css-calc/index.js +49 -0
  148. package/dist/node_modules/.bun/reduce-function-call@1.0.3/node_modules/reduce-function-call/index.js +34 -0
  149. package/dist/plot/common/plot.d.ts +103 -0
  150. package/dist/plot/common/plot.js +227 -0
  151. package/dist/plot/dot.d.ts +47 -0
  152. package/dist/plot/dot.js +62 -0
  153. package/dist/plot/line.d.ts +47 -0
  154. package/dist/plot/line.js +84 -0
  155. package/dist/tool-menu.d.ts +31 -0
  156. package/dist/utils.d.ts +39 -0
  157. package/dist/utils.js +101 -0
  158. package/package.json +39 -28
  159. package/CHANGELOG.json +0 -17
  160. package/CHANGELOG.md +0 -1116
  161. package/LICENSE.md +0 -5
  162. package/lib/actions-button.js +0 -145
  163. package/lib/actions-button.js.map +0 -1
  164. package/lib/axes.js +0 -643
  165. package/lib/axes.js.map +0 -1
  166. package/lib/bars/bar.js +0 -58
  167. package/lib/bars/bar.js.map +0 -1
  168. package/lib/bars/common/bars.js +0 -277
  169. package/lib/bars/common/bars.js.map +0 -1
  170. package/lib/bars/common/correct-check-icon.js +0 -54
  171. package/lib/bars/common/correct-check-icon.js.map +0 -1
  172. package/lib/bars/histogram.js +0 -59
  173. package/lib/bars/histogram.js.map +0 -1
  174. package/lib/chart-setup.js +0 -382
  175. package/lib/chart-setup.js.map +0 -1
  176. package/lib/chart-type.js +0 -80
  177. package/lib/chart-type.js.map +0 -1
  178. package/lib/chart-types.js +0 -22
  179. package/lib/chart-types.js.map +0 -1
  180. package/lib/chart.js +0 -384
  181. package/lib/chart.js.map +0 -1
  182. package/lib/common/correctness-indicators.js +0 -156
  183. package/lib/common/correctness-indicators.js.map +0 -1
  184. package/lib/common/drag-handle.js +0 -160
  185. package/lib/common/drag-handle.js.map +0 -1
  186. package/lib/common/drag-icon.js +0 -52
  187. package/lib/common/drag-icon.js.map +0 -1
  188. package/lib/common/styles.js +0 -22
  189. package/lib/common/styles.js.map +0 -1
  190. package/lib/grid.js +0 -112
  191. package/lib/grid.js.map +0 -1
  192. package/lib/index.js +0 -42
  193. package/lib/index.js.map +0 -1
  194. package/lib/key-legend.js +0 -87
  195. package/lib/key-legend.js.map +0 -1
  196. package/lib/line/common/drag-handle.js +0 -146
  197. package/lib/line/common/drag-handle.js.map +0 -1
  198. package/lib/line/common/line.js +0 -214
  199. package/lib/line/common/line.js.map +0 -1
  200. package/lib/line/line-cross.js +0 -214
  201. package/lib/line/line-cross.js.map +0 -1
  202. package/lib/line/line-dot.js +0 -158
  203. package/lib/line/line-dot.js.map +0 -1
  204. package/lib/mark-label.js +0 -237
  205. package/lib/mark-label.js.map +0 -1
  206. package/lib/plot/common/plot.js +0 -349
  207. package/lib/plot/common/plot.js.map +0 -1
  208. package/lib/plot/dot.js +0 -110
  209. package/lib/plot/dot.js.map +0 -1
  210. package/lib/plot/line.js +0 -140
  211. package/lib/plot/line.js.map +0 -1
  212. package/lib/tool-menu.js +0 -106
  213. package/lib/tool-menu.js.map +0 -1
  214. package/lib/utils.js +0 -189
  215. package/lib/utils.js.map +0 -1
  216. package/src/__tests__/actions-button.test.jsx +0 -280
  217. package/src/__tests__/axes.test.jsx +0 -667
  218. package/src/__tests__/chart-setup.test.jsx +0 -532
  219. package/src/__tests__/chart-type.test.jsx +0 -23
  220. package/src/__tests__/chart.test.jsx +0 -86
  221. package/src/__tests__/grid.test.jsx +0 -37
  222. package/src/__tests__/key-legend.test.jsx +0 -223
  223. package/src/__tests__/mark-label.test.jsx +0 -33
  224. package/src/__tests__/tool-menu.test.jsx +0 -522
  225. package/src/__tests__/utils.js +0 -36
  226. package/src/__tests__/utils.test.js +0 -100
  227. package/src/actions-button.jsx +0 -115
  228. package/src/axes.jsx +0 -594
  229. package/src/bars/__tests__/bar.test.jsx +0 -45
  230. package/src/bars/__tests__/histogram.test.jsx +0 -45
  231. package/src/bars/__tests__/utils.js +0 -30
  232. package/src/bars/bar.js +0 -28
  233. package/src/bars/common/__tests__/bars.test.jsx +0 -68
  234. package/src/bars/common/__tests__/utils.js +0 -30
  235. package/src/bars/common/bars.jsx +0 -249
  236. package/src/bars/common/correct-check-icon.jsx +0 -25
  237. package/src/bars/histogram.js +0 -28
  238. package/src/chart-setup.jsx +0 -356
  239. package/src/chart-type.js +0 -59
  240. package/src/chart-types.js +0 -8
  241. package/src/chart.jsx +0 -357
  242. package/src/common/__tests__/correctness-indicators.test.jsx +0 -720
  243. package/src/common/__tests__/drag-handle.test.jsx +0 -58
  244. package/src/common/__tests__/utils.js +0 -30
  245. package/src/common/correctness-indicators.jsx +0 -128
  246. package/src/common/drag-handle.jsx +0 -125
  247. package/src/common/drag-icon.jsx +0 -36
  248. package/src/common/styles.js +0 -19
  249. package/src/grid.jsx +0 -80
  250. package/src/index.js +0 -7
  251. package/src/key-legend.jsx +0 -77
  252. package/src/line/__tests__/line-cross.test.jsx +0 -463
  253. package/src/line/__tests__/line-dot.test.jsx +0 -41
  254. package/src/line/__tests__/utils.js +0 -36
  255. package/src/line/common/__tests__/drag-handle.test.jsx +0 -62
  256. package/src/line/common/__tests__/line.test.jsx +0 -79
  257. package/src/line/common/__tests__/utils.js +0 -30
  258. package/src/line/common/drag-handle.jsx +0 -114
  259. package/src/line/common/line.jsx +0 -171
  260. package/src/line/line-cross.js +0 -144
  261. package/src/line/line-dot.js +0 -111
  262. package/src/mark-label.jsx +0 -238
  263. package/src/plot/__tests__/dot.test.jsx +0 -344
  264. package/src/plot/__tests__/line.test.jsx +0 -375
  265. package/src/plot/__tests__/utils.js +0 -30
  266. package/src/plot/common/__tests__/plot.test.jsx +0 -69
  267. package/src/plot/common/__tests__/utils.js +0 -30
  268. package/src/plot/common/plot.jsx +0 -358
  269. package/src/plot/dot.js +0 -74
  270. package/src/plot/line.js +0 -98
  271. package/src/tool-menu.jsx +0 -85
  272. package/src/utils.js +0 -201
@@ -1,463 +0,0 @@
1
- import React from 'react';
2
- import { render } from '@pie-lib/test-utils';
3
- import { createTheme, ThemeProvider } from '@mui/material/styles';
4
- import Line, { LineCross as LineChart } from '../line-cross';
5
- import { graphProps } from './utils';
6
-
7
- // Mock dependencies
8
- jest.mock('@visx/shape', () => ({
9
- LinePath: ({ data, x, y, strokeWidth, style, ...props }) => (
10
- <path
11
- data-testid="line-path"
12
- d={data.map((d, i) => `${i === 0 ? 'M' : 'L'}${x(d)},${y(d)}`).join(' ')}
13
- strokeWidth={strokeWidth}
14
- {...props}
15
- />
16
- ),
17
- }));
18
-
19
- jest.mock('@visx/group', () => ({
20
- Group: ({ children, ...props }) => (
21
- <g data-testid="visx-group" {...props}>
22
- {children}
23
- </g>
24
- ),
25
- }));
26
-
27
- jest.mock('@pie-lib/render-ui', () => ({
28
- color: {
29
- text: () => '#000000',
30
- defaults: {
31
- TEXT: '#000000',
32
- BLACK: '#000000',
33
- BORDER_GRAY: '#cccccc',
34
- },
35
- disabled: () => '#cccccc',
36
- },
37
- }));
38
-
39
- jest.mock('../../utils', () => ({
40
- dataToXBand: jest.fn((scale, data, width, type) => {
41
- return {
42
- bandwidth: () => 20,
43
- };
44
- }),
45
- }));
46
-
47
- jest.mock('../common/line', () => {
48
- return function RawLine({ CustomDraggableComponent, data, graphProps, ...props }) {
49
- return (
50
- <svg data-testid="raw-line">
51
- {data && data.length > 0 ? (
52
- data.map((d, i) => (
53
- <CustomDraggableComponent
54
- key={i}
55
- scale={graphProps.scale}
56
- x={d.x || i}
57
- y={d.y || i}
58
- r={8}
59
- correctness={d.correctness}
60
- interactive={d.interactive}
61
- correctData={props.correctData}
62
- label={d.label}
63
- {...props}
64
- />
65
- ))
66
- ) : (
67
- <text>No data</text>
68
- )}
69
- </svg>
70
- );
71
- };
72
- });
73
-
74
- jest.mock('../../common/correctness-indicators', () => ({
75
- CorrectnessIndicator: ({ scale, x, y, correctness, interactive }) =>
76
- correctness && interactive ? (
77
- <g data-testid="correctness-indicator">
78
- <circle cx={scale.x(x)} cy={scale.y(y)} r={5} />
79
- </g>
80
- ) : null,
81
- SmallCorrectPointIndicator: ({ scale, x, correctness, correctData, label }) =>
82
- correctness && correctness.value === 'incorrect' && correctData ? (
83
- <g data-testid="small-correct-indicator">
84
- <circle cx={scale.x(x)} cy={scale.y(0)} r={3} />
85
- </g>
86
- ) : null,
87
- }));
88
-
89
- let theme;
90
-
91
- beforeAll(() => {
92
- theme = createTheme();
93
- });
94
-
95
- describe('LineChart', () => {
96
- const renderComponent = (extras) => {
97
- const defaults = {
98
- classes: {},
99
- className: 'className',
100
- graphProps: graphProps(),
101
- data: [],
102
- xBand: () => {
103
- return {
104
- bandwidth: () => {},
105
- };
106
- },
107
- };
108
- const props = { ...defaults, ...extras };
109
- return render(
110
- <ThemeProvider theme={theme}>
111
- <LineChart {...props} />
112
- </ThemeProvider>,
113
- );
114
- };
115
-
116
- describe('rendering', () => {
117
- it('renders line cross chart', () => {
118
- const { container } = renderComponent();
119
- expect(container.firstChild).toBeInTheDocument();
120
- });
121
-
122
- it('renders with data points', () => {
123
- const data = [
124
- { x: 1, y: 2, label: 'A' },
125
- { x: 2, y: 3, label: 'B' },
126
- ];
127
- const { getByTestId } = renderComponent({ data });
128
- expect(getByTestId('raw-line')).toBeInTheDocument();
129
- });
130
-
131
- it('renders without data', () => {
132
- const { getByTestId } = renderComponent({ data: [] });
133
- expect(getByTestId('raw-line')).toBeInTheDocument();
134
- });
135
-
136
- it('passes graphProps to RawLine', () => {
137
- const customGraphProps = graphProps(0, 10, 0, 10);
138
- const { getByTestId } = renderComponent({ graphProps: customGraphProps });
139
- expect(getByTestId('raw-line')).toBeInTheDocument();
140
- });
141
-
142
- it('passes onChange to RawLine', () => {
143
- const onChange = jest.fn();
144
- const { getByTestId } = renderComponent({ onChange });
145
- expect(getByTestId('raw-line')).toBeInTheDocument();
146
- });
147
- });
148
-
149
- describe('xBand calculation', () => {
150
- it('calculates xBand from data', () => {
151
- const data = [{ x: 1, y: 2 }];
152
- const { getByTestId } = renderComponent({ data });
153
- expect(getByTestId('raw-line')).toBeInTheDocument();
154
- });
155
-
156
- it('handles empty data for xBand', () => {
157
- const { getByTestId } = renderComponent({ data: [] });
158
- expect(getByTestId('raw-line')).toBeInTheDocument();
159
- });
160
- });
161
-
162
- describe('component', () => {
163
- it('returns correct chart object', () => {
164
- const chart = Line();
165
-
166
- expect(chart).toEqual({
167
- type: 'lineCross',
168
- Component: LineChart,
169
- name: 'Line Cross',
170
- });
171
- });
172
-
173
- it('returns object with correct type', () => {
174
- const chart = Line();
175
- expect(chart.type).toBe('lineCross');
176
- });
177
-
178
- it('returns object with correct name', () => {
179
- const chart = Line();
180
- expect(chart.name).toBe('Line Cross');
181
- });
182
-
183
- it('returns object with LineCross component', () => {
184
- const chart = Line();
185
- expect(chart.Component).toBe(LineChart);
186
- });
187
- });
188
-
189
- describe('edge cases', () => {
190
- it('handles null data', () => {
191
- const { getByTestId } = renderComponent({ data: null });
192
- expect(getByTestId('raw-line')).toBeInTheDocument();
193
- });
194
-
195
- it('handles undefined graphProps', () => {
196
- const { container } = renderComponent({ graphProps: undefined });
197
- expect(container).toBeInTheDocument();
198
- });
199
-
200
- it('handles missing scale in graphProps', () => {
201
- const { container } = renderComponent({
202
- graphProps: { size: { width: 400, height: 400 } },
203
- });
204
- expect(container).toBeInTheDocument();
205
- });
206
-
207
- it('handles missing size in graphProps', () => {
208
- const { container } = renderComponent({
209
- graphProps: { scale: graphProps().scale },
210
- });
211
- expect(container).toBeInTheDocument();
212
- });
213
-
214
- it('renders with className', () => {
215
- const { container } = renderComponent({ className: 'custom-class' });
216
- expect(container).toBeInTheDocument();
217
- });
218
- });
219
-
220
- describe('data with correctness', () => {
221
- it('renders data with correct answers', () => {
222
- const data = [
223
- { x: 1, y: 2, label: 'A', correctness: { value: 'correct', label: 'Correct!' }, interactive: true },
224
- ];
225
- const { getByTestId } = renderComponent({ data });
226
- expect(getByTestId('raw-line')).toBeInTheDocument();
227
- });
228
-
229
- it('renders data with incorrect answers', () => {
230
- const data = [{ x: 1, y: 2, label: 'A', correctness: { value: 'incorrect', label: 'Wrong' }, interactive: true }];
231
- const correctData = [{ label: 'A', value: 3 }];
232
- const { getByTestId } = renderComponent({ data, correctData });
233
- expect(getByTestId('raw-line')).toBeInTheDocument();
234
- });
235
-
236
- it('renders non-interactive data', () => {
237
- const data = [{ x: 1, y: 2, label: 'A', interactive: false }];
238
- const { getByTestId } = renderComponent({ data });
239
- expect(getByTestId('raw-line')).toBeInTheDocument();
240
- });
241
- });
242
- });
243
-
244
- describe('DraggableComponent', () => {
245
- // We need to test the DraggableComponent through LineCross since it's not exported
246
- const renderLineCrossWithData = (dataExtras = {}) => {
247
- const data = [{ x: 5, y: 10, label: 'A', r: 8, interactive: true, ...dataExtras }];
248
- const props = {
249
- graphProps: graphProps(),
250
- data,
251
- };
252
- return render(
253
- <ThemeProvider theme={theme}>
254
- <LineChart {...props} />
255
- </ThemeProvider>,
256
- );
257
- };
258
-
259
- describe('rendering', () => {
260
- it('renders cross lines', () => {
261
- const { getAllByTestId } = renderLineCrossWithData();
262
- const linePaths = getAllByTestId('line-path');
263
- expect(linePaths.length).toBeGreaterThan(0);
264
- });
265
-
266
- it('renders visx group', () => {
267
- const { getByTestId } = renderLineCrossWithData();
268
- expect(getByTestId('visx-group')).toBeInTheDocument();
269
- });
270
-
271
- it('renders transparent handle circle', () => {
272
- const { container } = renderLineCrossWithData();
273
- const circles = container.querySelectorAll('circle');
274
- expect(circles.length).toBeGreaterThan(0);
275
- });
276
- });
277
-
278
- describe('hover interactions', () => {
279
- it('renders interactive elements for hover', () => {
280
- const { container } = renderLineCrossWithData();
281
- // The component should render, even if we can't test hover through the mock
282
- expect(container).toBeInTheDocument();
283
- });
284
-
285
- it('component supports hover state changes', () => {
286
- const { container } = renderLineCrossWithData();
287
- // Verify the component renders with interactive data
288
- const svg = container.querySelector('svg');
289
- expect(svg).toBeInTheDocument();
290
- });
291
- });
292
-
293
- describe('correctness indicators', () => {
294
- it('renders correctness indicator for correct answer', () => {
295
- const { getByTestId } = renderLineCrossWithData({
296
- correctness: { value: 'correct', label: 'Correct!' },
297
- });
298
- expect(getByTestId('correctness-indicator')).toBeInTheDocument();
299
- });
300
-
301
- it('does not render correctness indicator when not interactive', () => {
302
- const { queryByTestId } = renderLineCrossWithData({
303
- correctness: { value: 'correct', label: 'Correct!' },
304
- interactive: false,
305
- });
306
- expect(queryByTestId('correctness-indicator')).not.toBeInTheDocument();
307
- });
308
-
309
- it('renders small correct indicator for incorrect answer', () => {
310
- const data = [
311
- {
312
- x: 5,
313
- y: 10,
314
- label: 'A',
315
- correctness: { value: 'incorrect', label: 'Wrong' },
316
- interactive: true,
317
- },
318
- ];
319
- const correctData = [{ label: 'A', value: 15 }];
320
- const props = {
321
- graphProps: graphProps(),
322
- data,
323
- correctData,
324
- };
325
- const { getByTestId } = render(
326
- <ThemeProvider theme={theme}>
327
- <LineChart {...props} />
328
- </ThemeProvider>,
329
- );
330
- expect(getByTestId('small-correct-indicator')).toBeInTheDocument();
331
- });
332
-
333
- it('does not render small correct indicator for correct answer', () => {
334
- const data = [
335
- {
336
- x: 5,
337
- y: 10,
338
- label: 'A',
339
- correctness: { value: 'correct', label: 'Correct!' },
340
- interactive: true,
341
- },
342
- ];
343
- const correctData = [{ label: 'A', value: 15 }];
344
- const props = {
345
- graphProps: graphProps(),
346
- data,
347
- correctData,
348
- };
349
- const { queryByTestId } = render(
350
- <ThemeProvider theme={theme}>
351
- <LineChart {...props} />
352
- </ThemeProvider>,
353
- );
354
- expect(queryByTestId('small-correct-indicator')).not.toBeInTheDocument();
355
- });
356
- });
357
-
358
- describe('cross lines positioning', () => {
359
- it('renders two cross lines for each point', () => {
360
- const { getAllByTestId } = renderLineCrossWithData();
361
- const linePaths = getAllByTestId('line-path');
362
- expect(linePaths.length).toBe(2); // Two lines per cross
363
- });
364
-
365
- it('positions cross lines correctly with scale', () => {
366
- const { getAllByTestId } = renderLineCrossWithData({ x: 3, y: 7 });
367
- const linePaths = getAllByTestId('line-path');
368
- expect(linePaths.length).toBe(2);
369
- });
370
- });
371
-
372
- describe('edge cases', () => {
373
- it('renders with zero coordinates', () => {
374
- const { container } = renderLineCrossWithData({ x: 0, y: 0 });
375
- expect(container).toBeInTheDocument();
376
- });
377
-
378
- it('renders with negative coordinates', () => {
379
- const { container } = renderLineCrossWithData({ x: -5, y: -10 });
380
- expect(container).toBeInTheDocument();
381
- });
382
-
383
- it('renders with large coordinates', () => {
384
- const { container } = renderLineCrossWithData({ x: 1000, y: 2000 });
385
- expect(container).toBeInTheDocument();
386
- });
387
-
388
- it('renders without correctness', () => {
389
- const { container } = renderLineCrossWithData({ correctness: null });
390
- expect(container).toBeInTheDocument();
391
- });
392
-
393
- it('renders without label', () => {
394
- const { container } = renderLineCrossWithData({ label: undefined });
395
- expect(container).toBeInTheDocument();
396
- });
397
-
398
- it('handles custom radius', () => {
399
- const { container } = renderLineCrossWithData({ r: 12 });
400
- expect(container).toBeInTheDocument();
401
- });
402
-
403
- it('applies className', () => {
404
- const { getByTestId } = renderLineCrossWithData({ className: 'custom-cross' });
405
- const group = getByTestId('visx-group');
406
- expect(group).toBeInTheDocument();
407
- });
408
- });
409
-
410
- describe('hover rect sizing', () => {
411
- it('component supports hover rect with proper sizing', () => {
412
- const { container } = renderLineCrossWithData({ r: 10 });
413
- // Verify the component renders with custom radius
414
- expect(container).toBeInTheDocument();
415
- });
416
-
417
- it('component supports hover rect centering', () => {
418
- const { container } = renderLineCrossWithData({ x: 5, y: 10, r: 8 });
419
- // Verify the component renders at specified coordinates
420
- expect(container).toBeInTheDocument();
421
- });
422
- });
423
-
424
- describe('multiple data points', () => {
425
- it('renders multiple crosses for multiple data points', () => {
426
- const data = [
427
- { x: 1, y: 2, label: 'A', interactive: true },
428
- { x: 3, y: 4, label: 'B', interactive: true },
429
- { x: 5, y: 6, label: 'C', interactive: true },
430
- ];
431
- const props = {
432
- graphProps: graphProps(),
433
- data,
434
- };
435
- const { getAllByTestId } = render(
436
- <ThemeProvider theme={theme}>
437
- <LineChart {...props} />
438
- </ThemeProvider>,
439
- );
440
- const groups = getAllByTestId('visx-group');
441
- expect(groups.length).toBe(3);
442
- });
443
-
444
- it('renders multiple data points with proper structure', () => {
445
- const data = [
446
- { x: 1, y: 2, label: 'A', interactive: true },
447
- { x: 3, y: 4, label: 'B', interactive: true },
448
- ];
449
- const props = {
450
- graphProps: graphProps(),
451
- data,
452
- };
453
- const { container } = render(
454
- <ThemeProvider theme={theme}>
455
- <LineChart {...props} />
456
- </ThemeProvider>,
457
- );
458
-
459
- // Should render the component with multiple data points
460
- expect(container).toBeInTheDocument();
461
- });
462
- });
463
- });
@@ -1,41 +0,0 @@
1
- import React from 'react';
2
- import { render } from '@pie-lib/test-utils';
3
- import Line, { LineDot as LineChart } from '../line-dot';
4
- import { graphProps } from './utils';
5
-
6
- describe('LineChart', () => {
7
- const renderComponent = (extras) => {
8
- const defaults = {
9
- classes: {},
10
- className: 'className',
11
- graphProps: graphProps(),
12
- data: [],
13
- xBand: () => {
14
- return {
15
- bandwidth: () => {},
16
- };
17
- },
18
- };
19
- const props = { ...defaults, ...extras };
20
- return render(<LineChart {...props} />);
21
- };
22
-
23
- describe('rendering', () => {
24
- it('renders line dot chart', () => {
25
- const { container } = renderComponent();
26
- expect(container.firstChild).toBeInTheDocument();
27
- });
28
- });
29
-
30
- describe('component', () => {
31
- it('returns correct chart object', () => {
32
- const chart = Line();
33
-
34
- expect(chart).toEqual({
35
- type: 'lineDot',
36
- Component: LineChart,
37
- name: 'Line Dot',
38
- });
39
- });
40
- });
41
- });
@@ -1,36 +0,0 @@
1
- import { scaleBand, scaleLinear } from 'd3-scale';
2
-
3
- export const scaleMock = () => {
4
- const fn = jest.fn((n) => n);
5
- fn.invert = jest.fn((n) => n);
6
- return fn;
7
- };
8
-
9
- export const createBandScale = (domain = [], range = [0, 400]) => {
10
- return scaleBand().domain(domain).range(range).padding(0.1);
11
- };
12
-
13
- export const graphProps = (dmin = 0, dmax = 1, rmin = 0, rmax = 1) => ({
14
- scale: {
15
- x: scaleLinear().domain([dmin, dmax]).range([0, 400]),
16
- y: scaleLinear().domain([rmin, rmax]).range([400, 0]),
17
- },
18
- snap: {
19
- x: jest.fn((n) => n),
20
- y: jest.fn((n) => n),
21
- },
22
- domain: {
23
- min: dmin,
24
- max: dmax,
25
- step: 1,
26
- },
27
- range: {
28
- min: rmin,
29
- max: rmax,
30
- step: 1,
31
- },
32
- size: {
33
- width: 400,
34
- height: 400,
35
- },
36
- });
@@ -1,62 +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(
39
- <svg>
40
- <DragHandle {...props} />
41
- </svg>,
42
- );
43
- };
44
-
45
- describe('rendering', () => {
46
- it('renders without crashing', () => {
47
- const { container } = renderComponent();
48
- expect(container.firstChild).toBeInTheDocument();
49
- });
50
- });
51
-
52
- describe('gridDraggable options', () => {
53
- it('configures gridDraggable with correct options', () => {
54
- // The gridDraggable HOC is tested by verifying that it's called with the component
55
- // Detailed unit tests for the HOC options would require accessing internal
56
- // implementation details which is not recommended with RTL
57
- const { container } = renderComponent();
58
- expect(container.firstChild).toBeInTheDocument();
59
- expect(gridDraggable).toHaveBeenCalled();
60
- });
61
- });
62
- });
@@ -1,79 +0,0 @@
1
- import { render } from '@testing-library/react';
2
- import React from 'react';
3
- import Line, { RawLine } from '../line';
4
- import { graphProps } from './utils';
5
-
6
- describe('Line', () => {
7
- const xBand = () => {};
8
- xBand.bandwidth = () => {};
9
- const onChange = jest.fn();
10
-
11
- const renderComponent = (extras) => {
12
- const defaults = {
13
- classes: {},
14
- className: 'className',
15
- graphProps: graphProps(),
16
- xBand,
17
- onChange,
18
- data: [{ value: 0, label: '0' }],
19
- };
20
- const props = { ...defaults, ...extras };
21
- return render(<Line {...props} />);
22
- };
23
-
24
- describe('rendering', () => {
25
- it('renders without crashing', () => {
26
- const { container } = renderComponent();
27
- expect(container.firstChild).toBeInTheDocument();
28
- });
29
- });
30
-
31
- describe('functionality', () => {
32
- it('calls onChange when line changes', () => {
33
- const { container } = renderComponent();
34
- // Testing changeLine functionality would require user interaction
35
- // with drag handles on the line chart
36
- expect(container.firstChild).toBeInTheDocument();
37
- });
38
- });
39
- });
40
-
41
- describe('RawLine', () => {
42
- const xBand = () => {};
43
- xBand.bandwidth = () => {};
44
- const onChange = jest.fn();
45
-
46
- const renderComponent = (extras) => {
47
- const defaults = {
48
- classes: {},
49
- className: 'className',
50
- graphProps: graphProps(),
51
- xBand,
52
- onChange,
53
- data: [
54
- { label: 'A', value: 0 },
55
- { label: 'B', value: 1 },
56
- ],
57
- label: 'label',
58
- CustomBarElement: () => <div />,
59
- };
60
- const props = { ...defaults, ...extras };
61
- return render(<RawLine {...props} />);
62
- };
63
-
64
- describe('rendering', () => {
65
- it('renders without crashing', () => {
66
- const { container } = renderComponent();
67
- expect(container.firstChild).toBeInTheDocument();
68
- });
69
- });
70
-
71
- describe('functionality', () => {
72
- it('handles drag operations', () => {
73
- const { container } = renderComponent();
74
- // Testing dragStop functionality would require user interaction
75
- // with drag handles on the line
76
- expect(container.firstChild).toBeInTheDocument();
77
- });
78
- });
79
- });