@pie-lib/charting 7.0.4-next.31 → 7.0.4-next.36

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/CHANGELOG.json +17 -0
  2. package/CHANGELOG.md +1116 -0
  3. package/LICENSE.md +5 -0
  4. package/lib/actions-button.js +145 -0
  5. package/lib/actions-button.js.map +1 -0
  6. package/lib/axes.js +643 -0
  7. package/lib/axes.js.map +1 -0
  8. package/lib/bars/bar.js +58 -0
  9. package/lib/bars/bar.js.map +1 -0
  10. package/lib/bars/common/bars.js +277 -0
  11. package/lib/bars/common/bars.js.map +1 -0
  12. package/lib/bars/common/correct-check-icon.js +54 -0
  13. package/lib/bars/common/correct-check-icon.js.map +1 -0
  14. package/lib/bars/histogram.js +59 -0
  15. package/lib/bars/histogram.js.map +1 -0
  16. package/lib/chart-setup.js +382 -0
  17. package/lib/chart-setup.js.map +1 -0
  18. package/lib/chart-type.js +80 -0
  19. package/lib/chart-type.js.map +1 -0
  20. package/lib/chart-types.js +22 -0
  21. package/lib/chart-types.js.map +1 -0
  22. package/lib/chart.js +384 -0
  23. package/lib/chart.js.map +1 -0
  24. package/lib/common/correctness-indicators.js +156 -0
  25. package/lib/common/correctness-indicators.js.map +1 -0
  26. package/lib/common/drag-handle.js +160 -0
  27. package/lib/common/drag-handle.js.map +1 -0
  28. package/lib/common/drag-icon.js +52 -0
  29. package/lib/common/drag-icon.js.map +1 -0
  30. package/lib/common/styles.js +22 -0
  31. package/lib/common/styles.js.map +1 -0
  32. package/lib/grid.js +112 -0
  33. package/lib/grid.js.map +1 -0
  34. package/lib/index.js +42 -0
  35. package/lib/index.js.map +1 -0
  36. package/lib/key-legend.js +87 -0
  37. package/lib/key-legend.js.map +1 -0
  38. package/lib/line/common/drag-handle.js +146 -0
  39. package/lib/line/common/drag-handle.js.map +1 -0
  40. package/lib/line/common/line.js +214 -0
  41. package/lib/line/common/line.js.map +1 -0
  42. package/lib/line/line-cross.js +214 -0
  43. package/lib/line/line-cross.js.map +1 -0
  44. package/lib/line/line-dot.js +158 -0
  45. package/lib/line/line-dot.js.map +1 -0
  46. package/lib/mark-label.js +237 -0
  47. package/lib/mark-label.js.map +1 -0
  48. package/lib/plot/common/plot.js +349 -0
  49. package/lib/plot/common/plot.js.map +1 -0
  50. package/lib/plot/dot.js +110 -0
  51. package/lib/plot/dot.js.map +1 -0
  52. package/lib/plot/line.js +140 -0
  53. package/lib/plot/line.js.map +1 -0
  54. package/lib/tool-menu.js +106 -0
  55. package/lib/tool-menu.js.map +1 -0
  56. package/lib/utils.js +189 -0
  57. package/lib/utils.js.map +1 -0
  58. package/package.json +28 -39
  59. package/src/__tests__/actions-button.test.jsx +280 -0
  60. package/src/__tests__/axes.test.jsx +667 -0
  61. package/src/__tests__/chart-setup.test.jsx +532 -0
  62. package/src/__tests__/chart-type.test.jsx +23 -0
  63. package/src/__tests__/chart.test.jsx +86 -0
  64. package/src/__tests__/grid.test.jsx +37 -0
  65. package/src/__tests__/key-legend.test.jsx +223 -0
  66. package/src/__tests__/mark-label.test.jsx +33 -0
  67. package/src/__tests__/tool-menu.test.jsx +522 -0
  68. package/src/__tests__/utils.js +36 -0
  69. package/src/__tests__/utils.test.js +100 -0
  70. package/src/actions-button.jsx +115 -0
  71. package/src/axes.jsx +594 -0
  72. package/src/bars/__tests__/bar.test.jsx +45 -0
  73. package/src/bars/__tests__/histogram.test.jsx +45 -0
  74. package/src/bars/__tests__/utils.js +30 -0
  75. package/src/bars/bar.js +28 -0
  76. package/src/bars/common/__tests__/bars.test.jsx +68 -0
  77. package/src/bars/common/__tests__/utils.js +30 -0
  78. package/src/bars/common/bars.jsx +249 -0
  79. package/src/bars/common/correct-check-icon.jsx +25 -0
  80. package/src/bars/histogram.js +28 -0
  81. package/src/chart-setup.jsx +356 -0
  82. package/src/chart-type.js +59 -0
  83. package/src/chart-types.js +8 -0
  84. package/src/chart.jsx +357 -0
  85. package/src/common/__tests__/correctness-indicators.test.jsx +720 -0
  86. package/src/common/__tests__/drag-handle.test.jsx +58 -0
  87. package/src/common/__tests__/utils.js +30 -0
  88. package/src/common/correctness-indicators.jsx +128 -0
  89. package/src/common/drag-handle.jsx +125 -0
  90. package/src/common/drag-icon.jsx +36 -0
  91. package/src/common/styles.js +19 -0
  92. package/src/grid.jsx +80 -0
  93. package/src/index.js +7 -0
  94. package/src/key-legend.jsx +77 -0
  95. package/src/line/__tests__/line-cross.test.jsx +463 -0
  96. package/src/line/__tests__/line-dot.test.jsx +41 -0
  97. package/src/line/__tests__/utils.js +36 -0
  98. package/src/line/common/__tests__/drag-handle.test.jsx +62 -0
  99. package/src/line/common/__tests__/line.test.jsx +79 -0
  100. package/src/line/common/__tests__/utils.js +30 -0
  101. package/src/line/common/drag-handle.jsx +114 -0
  102. package/src/line/common/line.jsx +171 -0
  103. package/src/line/line-cross.js +144 -0
  104. package/src/line/line-dot.js +111 -0
  105. package/src/mark-label.jsx +238 -0
  106. package/src/plot/__tests__/dot.test.jsx +344 -0
  107. package/src/plot/__tests__/line.test.jsx +375 -0
  108. package/src/plot/__tests__/utils.js +30 -0
  109. package/src/plot/common/__tests__/plot.test.jsx +69 -0
  110. package/src/plot/common/__tests__/utils.js +30 -0
  111. package/src/plot/common/plot.jsx +358 -0
  112. package/src/plot/dot.js +74 -0
  113. package/src/plot/line.js +98 -0
  114. package/src/tool-menu.jsx +85 -0
  115. package/src/utils.js +201 -0
  116. package/dist/_virtual/_rolldown/runtime.js +0 -23
  117. package/dist/actions-button.d.ts +0 -26
  118. package/dist/actions-button.js +0 -84
  119. package/dist/autosize-input.d.ts +0 -10
  120. package/dist/autosize-input.js +0 -66
  121. package/dist/axes.d.ts +0 -84
  122. package/dist/axes.js +0 -376
  123. package/dist/bars/bar.d.ts +0 -47
  124. package/dist/bars/bar.js +0 -27
  125. package/dist/bars/common/bars.d.ts +0 -98
  126. package/dist/bars/common/bars.js +0 -174
  127. package/dist/bars/common/correct-check-icon.d.ts +0 -18
  128. package/dist/bars/common/correct-check-icon.js +0 -50
  129. package/dist/bars/histogram.d.ts +0 -47
  130. package/dist/bars/histogram.js +0 -28
  131. package/dist/chart-setup.d.ts +0 -29
  132. package/dist/chart-setup.js +0 -231
  133. package/dist/chart-type.d.ts +0 -32
  134. package/dist/chart-type.js +0 -68
  135. package/dist/chart-types.d.ts +0 -41
  136. package/dist/chart-types.js +0 -17
  137. package/dist/chart.d.ts +0 -88
  138. package/dist/chart.js +0 -250
  139. package/dist/common/correctness-indicators.d.ts +0 -70
  140. package/dist/common/correctness-indicators.js +0 -106
  141. package/dist/common/drag-handle.d.ts +0 -129
  142. package/dist/common/drag-handle.js +0 -120
  143. package/dist/common/drag-icon.d.ts +0 -23
  144. package/dist/common/drag-icon.js +0 -45
  145. package/dist/common/styles.d.ts +0 -23
  146. package/dist/common/styles.js +0 -17
  147. package/dist/grid.d.ts +0 -45
  148. package/dist/grid.js +0 -56
  149. package/dist/index.d.ts +0 -14
  150. package/dist/index.js +0 -6
  151. package/dist/key-legend.d.ts +0 -19
  152. package/dist/key-legend.js +0 -46
  153. package/dist/line/common/drag-handle.d.ts +0 -120
  154. package/dist/line/common/drag-handle.js +0 -92
  155. package/dist/line/common/line.d.ts +0 -96
  156. package/dist/line/common/line.js +0 -114
  157. package/dist/line/line-cross.d.ts +0 -47
  158. package/dist/line/line-cross.js +0 -133
  159. package/dist/line/line-dot.d.ts +0 -47
  160. package/dist/line/line-dot.js +0 -101
  161. package/dist/mark-label.d.ts +0 -55
  162. package/dist/mark-label.js +0 -138
  163. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Axis.js +0 -101
  164. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/AxisBottom.js +0 -46
  165. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/AxisLeft.js +0 -47
  166. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/AxisRenderer.js +0 -63
  167. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Ticks.js +0 -44
  168. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/constants/orientation.js +0 -9
  169. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/createPoint.js +0 -14
  170. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getAxisRangePaddingConfig.js +0 -21
  171. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getLabelTransform.js +0 -16
  172. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getTickFormatter.js +0 -8
  173. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getTickPosition.js +0 -15
  174. package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/GridColumns.js +0 -79
  175. package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/GridRows.js +0 -79
  176. package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/utils/getScaleBandwidth.js +0 -6
  177. package/dist/node_modules/.bun/@visx_group@3.12.0_f4eacebf2041cd4f/node_modules/@visx/group/esm/Group.js +0 -50
  178. package/dist/node_modules/.bun/@visx_point@3.12.0/node_modules/@visx/point/esm/Point.js +0 -18
  179. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/align.js +0 -6
  180. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/base.js +0 -6
  181. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/clamp.js +0 -6
  182. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/constant.js +0 -6
  183. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/domain.js +0 -6
  184. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/exponent.js +0 -6
  185. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/interpolate.js +0 -10
  186. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/nice.js +0 -37
  187. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/padding.js +0 -6
  188. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/range.js +0 -6
  189. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/reverse.js +0 -9
  190. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/round.js +0 -7
  191. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/scaleOperator.js +0 -58
  192. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/unknown.js +0 -6
  193. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/operators/zero.js +0 -9
  194. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/scales/band.js +0 -9
  195. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/scales/point.js +0 -9
  196. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/coerceNumber.js +0 -10
  197. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/createColorInterpolator.js +0 -29
  198. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/getTicks.js +0 -9
  199. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/isUtcScale.js +0 -7
  200. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/toString.js +0 -6
  201. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/Bar.js +0 -29
  202. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/Circle.js +0 -29
  203. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/Line.js +0 -47
  204. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/LinePath.js +0 -50
  205. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/util/D3ShapeFactories.js +0 -9
  206. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/util/setNumberOrNumberAccessor.js +0 -6
  207. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/lib/shapes/Line.js +0 -53
  208. package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/Text.js +0 -57
  209. package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/hooks/useText.js +0 -91
  210. package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/util/getStringWidth.js +0 -21
  211. package/dist/node_modules/.bun/@visx_vendor@3.12.0/node_modules/@visx/vendor/esm/d3-interpolate.js +0 -8
  212. package/dist/node_modules/.bun/@visx_vendor@3.12.0/node_modules/@visx/vendor/esm/d3-scale.js +0 -8
  213. package/dist/node_modules/.bun/@visx_vendor@3.12.0/node_modules/@visx/vendor/esm/d3-time.js +0 -8
  214. package/dist/node_modules/.bun/balanced-match@0.4.2/node_modules/balanced-match/index.js +0 -32
  215. package/dist/node_modules/.bun/balanced-match@1.0.2/node_modules/balanced-match/index.js +0 -33
  216. package/dist/node_modules/.bun/classnames@2.5.1/node_modules/classnames/index.js +0 -32
  217. package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +0 -16
  218. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_Hash.js +0 -21
  219. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_ListCache.js +0 -21
  220. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_Map.js +0 -10
  221. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_MapCache.js +0 -21
  222. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_Symbol.js +0 -9
  223. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_assocIndexOf.js +0 -14
  224. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_baseGetTag.js +0 -15
  225. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_baseIsNative.js +0 -16
  226. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_coreJsData.js +0 -9
  227. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_freeGlobal.js +0 -8
  228. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_getMapData.js +0 -14
  229. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_getNative.js +0 -15
  230. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_getRawTag.js +0 -19
  231. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_getValue.js +0 -11
  232. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashClear.js +0 -13
  233. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashDelete.js +0 -12
  234. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashGet.js +0 -18
  235. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashHas.js +0 -14
  236. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashSet.js +0 -14
  237. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_isKeyable.js +0 -12
  238. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_isMasked.js +0 -16
  239. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheClear.js +0 -11
  240. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js +0 -14
  241. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheGet.js +0 -14
  242. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheHas.js +0 -13
  243. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheSet.js +0 -14
  244. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheClear.js +0 -19
  245. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheDelete.js +0 -14
  246. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheGet.js +0 -13
  247. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheHas.js +0 -13
  248. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheSet.js +0 -14
  249. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_nativeCreate.js +0 -9
  250. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_objectToString.js +0 -12
  251. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_root.js +0 -10
  252. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_toSource.js +0 -20
  253. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/eq.js +0 -11
  254. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/isFunction.js +0 -16
  255. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/isObject.js +0 -12
  256. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/memoize.js +0 -20
  257. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/formula_evaluator.js +0 -37
  258. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/lexer.js +0 -509
  259. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/math_function.js +0 -108
  260. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix.js +0 -31
  261. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix_evaluator.js +0 -45
  262. package/dist/node_modules/.bun/reduce-css-calc@1.3.0/node_modules/reduce-css-calc/index.js +0 -49
  263. package/dist/node_modules/.bun/reduce-function-call@1.0.3/node_modules/reduce-function-call/index.js +0 -34
  264. package/dist/plot/common/plot.d.ts +0 -103
  265. package/dist/plot/common/plot.js +0 -227
  266. package/dist/plot/dot.d.ts +0 -47
  267. package/dist/plot/dot.js +0 -62
  268. package/dist/plot/line.d.ts +0 -47
  269. package/dist/plot/line.js +0 -84
  270. package/dist/tool-menu.d.ts +0 -31
  271. package/dist/utils.d.ts +0 -39
  272. package/dist/utils.js +0 -101
package/src/utils.js ADDED
@@ -0,0 +1,201 @@
1
+ import { scaleBand, scalePoint } from '@visx/scale';
2
+ import { utils } from '@pie-lib/plot';
3
+
4
+ export const tickCount = utils.tickCount;
5
+ export const bounds = utils.bounds;
6
+ export const point = utils.point;
7
+
8
+ export const bandKey = (d, index) => `${index}-${d.label || '-'}`;
9
+
10
+ export const dataToXBand = (scaleX, data, width, type) => {
11
+ const chartWidth = width || 400; // fallback
12
+ const domain = data && data.length ? data.map(bandKey) : ['default'];
13
+
14
+ switch (type) {
15
+ case 'bar':
16
+ case 'dotPlot':
17
+ case 'linePlot':
18
+ return scaleBand({
19
+ range: [0, chartWidth],
20
+ domain,
21
+ padding: 0.2,
22
+ });
23
+
24
+ case 'histogram':
25
+ return scaleBand({
26
+ range: [0, chartWidth],
27
+ domain,
28
+ padding: 0,
29
+ });
30
+
31
+ case 'lineCross':
32
+ case 'lineDot':
33
+ return scalePoint({
34
+ domain,
35
+ range: [0, chartWidth],
36
+ });
37
+
38
+ default:
39
+ return scaleBand({
40
+ range: [0, chartWidth],
41
+ domain,
42
+ padding: 0,
43
+ });
44
+ }
45
+ };
46
+
47
+ export const getTickValues = (prop = {}) => {
48
+ const tickValues = [];
49
+ let tickVal = prop.min;
50
+
51
+ while (tickVal <= prop.max) {
52
+ tickValues.push(tickVal);
53
+ tickVal = Math.round((tickVal + prop.step) * 10000) / 10000;
54
+ }
55
+
56
+ return tickValues;
57
+ };
58
+
59
+ export const getDomainAndRangeByChartType = (domain, range, chartType) => {
60
+ let { step, labelStep, min, max } = range || {};
61
+
62
+ if (!min) {
63
+ min = 0;
64
+ }
65
+
66
+ if (!max || max < 0) {
67
+ max = range.min + 1;
68
+ }
69
+
70
+ if (!step) {
71
+ step = labelStep || 1;
72
+ }
73
+ if (!labelStep || (isNaN(labelStep) && step)) {
74
+ labelStep = step || 1;
75
+ }
76
+
77
+ range.max = max;
78
+
79
+ switch (chartType) {
80
+ // if chart is dot plot or line plot, we should ignore step and make sure that min & max are integer values
81
+ case 'dotPlot':
82
+ case 'linePlot': {
83
+ const intMin = Math.round(min);
84
+ const intMax = Math.round(max);
85
+
86
+ return {
87
+ domain: {
88
+ ...domain,
89
+ step: 1,
90
+ labelStep: 1,
91
+ min: 0,
92
+ max: 1,
93
+ },
94
+ range: {
95
+ ...range,
96
+ min: intMin,
97
+ max: intMin === intMax ? intMin + 1 : intMax,
98
+ labelStep,
99
+ step: 1,
100
+ },
101
+ };
102
+ }
103
+
104
+ default:
105
+ return {
106
+ domain: {
107
+ ...domain,
108
+ step: 1,
109
+ labelStep: 1,
110
+ min: 0,
111
+ max: 1,
112
+ },
113
+ range: {
114
+ ...range,
115
+ labelStep,
116
+ step,
117
+ },
118
+ };
119
+ }
120
+ };
121
+
122
+ export const getGridLinesAndAxisByChartType = (range, chartType) => {
123
+ switch (chartType) {
124
+ case 'lineDot':
125
+ case 'lineCross':
126
+ return {
127
+ verticalLines: undefined,
128
+ horizontalLines: getTickValues(range),
129
+ leftAxis: true,
130
+ };
131
+
132
+ case 'dotPlot':
133
+ case 'linePlot':
134
+ return {
135
+ verticalLines: [],
136
+ horizontalLines: [],
137
+ leftAxis: false,
138
+ };
139
+
140
+ default:
141
+ return {
142
+ verticalLines: [],
143
+ horizontalLines: getTickValues(range),
144
+ leftAxis: true,
145
+ };
146
+ }
147
+ };
148
+
149
+ export const getRotateAngle = (fontSize, height) => {
150
+ if (height >= fontSize * 2) {
151
+ return 25;
152
+ }
153
+
154
+ return 0;
155
+ };
156
+
157
+ export const getTopPadding = (barWidth) => {
158
+ if (barWidth < 30) {
159
+ return 50;
160
+ }
161
+
162
+ if (barWidth < 40) {
163
+ return 30;
164
+ }
165
+
166
+ if (barWidth < 60) {
167
+ return 15;
168
+ }
169
+
170
+ return 0;
171
+ };
172
+
173
+ // This function calculates the transformation scale for SVG and the icon's vertical distance from its category
174
+ export const getScale = (width) => {
175
+ let scale, deltay;
176
+
177
+ if (width > 91) {
178
+ scale = 1.3;
179
+ deltay = -55;
180
+ } else if (width > 45) {
181
+ scale = 1.1;
182
+ deltay = -45;
183
+ } else if (width > 40) {
184
+ scale = 0.5 + (width - 34) * 0.02;
185
+ deltay = -25;
186
+ } else if (width > 30) {
187
+ scale = 0.5 + (width - 34) * 0.02;
188
+ deltay = -20;
189
+ } else {
190
+ scale = 0.5 * Math.pow(0.98, 34 - width); // 0.98 is the reduction factor. Adjust to control scaling.
191
+ deltay = -15;
192
+ }
193
+
194
+ return { scale, deltay };
195
+ };
196
+
197
+ export const getAdjustedX = (width, scaleValue) => {
198
+ const innerWidthOriginal = 57;
199
+ const effectiveInnerWidth = innerWidthOriginal * scaleValue;
200
+ return (width - effectiveInnerWidth) / 2;
201
+ };
@@ -1,23 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, n) => {
3
- let r = {};
4
- for (var i in e) t(r, i, {
5
- get: e[i],
6
- enumerable: !0
7
- });
8
- return n || t(r, Symbol.toStringTag, { value: "Module" }), r;
9
- }, c = (e, i, o, s) => {
10
- if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
11
- get: ((e) => i[e]).bind(null, d),
12
- enumerable: !(s = n(i, d)) || s.enumerable
13
- });
14
- return e;
15
- }, l = (e, t, n) => (c(e, t, "default"), n && c(n, t, "default")), u = (n, r, a) => (a = n == null ? {} : e(i(n)), c(r || !n || !n.__esModule ? t(a, "default", {
16
- value: n,
17
- enumerable: !0
18
- }) : a, n)), d = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
19
- if (typeof require < "u") return require.apply(this, arguments);
20
- throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
21
- });
22
- //#endregion
23
- export { o as __commonJSMin, s as __exportAll, l as __reExport, d as __require, u as __toESM };
@@ -1,26 +0,0 @@
1
- /**
2
- * @synced-from pie-lib/packages/charting/src/actions-button.jsx
3
- * @auto-generated
4
- *
5
- * This file is automatically synced from pie-elements and converted to TypeScript.
6
- * Manual edits will be overwritten on next sync.
7
- * To make changes, edit the upstream JavaScript file and run sync again.
8
- */
9
- import React from 'react';
10
- import PropTypes from 'prop-types';
11
- export declare class ActionsButton extends React.Component {
12
- constructor(props: any);
13
- componentWillUnmount(): void;
14
- static propTypes: {
15
- addCategory: PropTypes.Validator<(...args: any[]) => any>;
16
- deleteCategory: PropTypes.Validator<(...args: any[]) => any>;
17
- language: PropTypes.Requireable<string>;
18
- categories: PropTypes.Requireable<any[]>;
19
- };
20
- handleActionsClick: any;
21
- handleActionsClose: any;
22
- handleAddCategory: any;
23
- handleDeleteCategory: any;
24
- render(): React.JSX.Element;
25
- }
26
- export default ActionsButton;
@@ -1,84 +0,0 @@
1
- import e from "react";
2
- import t from "prop-types";
3
- import { styled as n } from "@mui/material/styles";
4
- import { color as r } from "@pie-lib/render-ui";
5
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
- import o from "@mui/material/Button";
7
- import s from "@mui/material/Popover";
8
- import c from "@mui/material/Paper";
9
- import l from "@pie-lib/translator";
10
- //#region src/actions-button.tsx
11
- var { translator: u } = l, d = n("div")(() => ({ alignSelf: "flex-end" })), f = n("div")(({ theme: e }) => ({
12
- cursor: "pointer",
13
- fontSize: e.typography.fontSize,
14
- color: r.tertiary(),
15
- padding: e.spacing(1)
16
- })), p = n(c)(({ theme: e }) => ({
17
- padding: e.spacing(1),
18
- display: "flex",
19
- flexDirection: "column",
20
- gap: e.spacing(1),
21
- "& button": {
22
- textTransform: "none",
23
- fontSize: e.typography.fontSize,
24
- color: r.text(),
25
- justifyContent: "flex-start"
26
- }
27
- })), m = class extends e.Component {
28
- constructor(e) {
29
- super(e), this.state = { actionsAnchorEl: null };
30
- }
31
- componentWillUnmount() {
32
- this.setState({ actionsAnchorEl: null });
33
- }
34
- static propTypes = {
35
- addCategory: t.func.isRequired,
36
- deleteCategory: t.func.isRequired,
37
- language: t.string,
38
- categories: t.array
39
- };
40
- handleActionsClick = (e) => {
41
- this.setState({ actionsAnchorEl: e.currentTarget });
42
- };
43
- handleActionsClose = () => {
44
- this.setState({ actionsAnchorEl: null });
45
- };
46
- handleAddCategory = () => {
47
- let { addCategory: e } = this.props;
48
- e(), this.handleActionsClose();
49
- };
50
- handleDeleteCategory = (e) => {
51
- let { deleteCategory: t } = this.props;
52
- t(e), this.handleActionsClose();
53
- };
54
- render() {
55
- let { categories: e, language: t } = this.props, { actionsAnchorEl: n } = this.state;
56
- return /* @__PURE__ */ a(d, { children: [/* @__PURE__ */ i(f, {
57
- role: "button",
58
- tabIndex: 0,
59
- onClick: this.handleActionsClick,
60
- children: "Actions"
61
- }), /* @__PURE__ */ i(s, {
62
- open: !!n,
63
- anchorEl: n,
64
- onClose: this.handleActionsClose,
65
- anchorOrigin: {
66
- vertical: "bottom",
67
- horizontal: "left"
68
- },
69
- transformOrigin: {
70
- vertical: "top",
71
- horizontal: "left"
72
- },
73
- children: /* @__PURE__ */ a(p, { children: [/* @__PURE__ */ a(o, {
74
- onClick: () => this.handleAddCategory(),
75
- children: ["+ ", u.t("charting.add", { lng: t })]
76
- }), e.length > 0 && e.map((e, n) => e.deletable && !e.correctness && /* @__PURE__ */ i(o, {
77
- onClick: () => this.handleDeleteCategory(n),
78
- children: `${u.t("charting.delete", { lng: t })} <${e.label || u.t("charting.newLabel", { lng: t })}>`
79
- }, n))] })
80
- }, `actions-popover-${Math.random()}`)] });
81
- }
82
- };
83
- //#endregion
84
- export { m as default };
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- export interface AutosizeInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'className' | 'style'> {
3
- className?: string;
4
- inputClassName?: string;
5
- inputRef?: (node: HTMLInputElement | null) => void;
6
- inputStyle?: React.CSSProperties;
7
- minWidth?: number | string;
8
- style?: React.CSSProperties;
9
- }
10
- export declare const AutosizeInput: React.ForwardRefExoticComponent<AutosizeInputProps & React.RefAttributes<HTMLInputElement>>;
@@ -1,66 +0,0 @@
1
- import e, { useCallback as t, useLayoutEffect as n, useRef as r, useState as i } from "react";
2
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
3
- //#region src/autosize-input.tsx
4
- var s = (e) => {
5
- let t = Number.parseFloat(e);
6
- return Number.isFinite(t) ? t : 0;
7
- }, c = (e, t) => {
8
- let n = e ?? t;
9
- return typeof n == "number" ? n : typeof n == "string" && n.endsWith("px") ? s(n) : 1;
10
- }, l = e.forwardRef(({ className: e, inputClassName: l, inputRef: u, inputStyle: d, minWidth: f, placeholder: p, style: m, value: h, defaultValue: g, ..._ }, v) => {
11
- let y = r(null), b = r(u), x = r(v), S = r(null), [C, w] = i(() => c(f, d?.minWidth));
12
- b.current = u, x.current = v;
13
- let T = t((e) => {
14
- y.current = e, b.current?.(e);
15
- let t = x.current;
16
- typeof t == "function" ? t(e) : t && (t.current = e);
17
- }, []);
18
- return n(() => {
19
- let e = y.current, t = S.current;
20
- if (!e || !t) return;
21
- let n = window.getComputedStyle(e);
22
- t.style.font = n.font, t.style.letterSpacing = n.letterSpacing, t.style.textTransform = n.textTransform, t.textContent = String(h ?? g ?? p ?? "") || " ";
23
- let r = s(n.paddingLeft) + s(n.paddingRight) + s(n.borderLeftWidth) + s(n.borderRightWidth), i = Math.ceil(t.getBoundingClientRect().width + 2), a = n.boxSizing === "border-box" ? i + r : i;
24
- w(Math.max(c(f, d?.minWidth), a));
25
- }, [
26
- g,
27
- l,
28
- d,
29
- f,
30
- p,
31
- h
32
- ]), /* @__PURE__ */ o("span", {
33
- className: e,
34
- style: {
35
- display: "inline-block",
36
- ...m
37
- },
38
- children: [/* @__PURE__ */ a("input", {
39
- ..._,
40
- ref: T,
41
- className: l,
42
- placeholder: p,
43
- style: {
44
- width: C,
45
- ...d
46
- },
47
- value: h,
48
- defaultValue: g
49
- }), /* @__PURE__ */ a("span", {
50
- ref: S,
51
- "aria-hidden": "true",
52
- style: {
53
- height: 0,
54
- left: 0,
55
- overflow: "hidden",
56
- position: "absolute",
57
- top: 0,
58
- visibility: "hidden",
59
- whiteSpace: "pre"
60
- }
61
- })]
62
- });
63
- });
64
- l.displayName = "AutosizeInput";
65
- //#endregion
66
- export { l as AutosizeInput };
package/dist/axes.d.ts DELETED
@@ -1,84 +0,0 @@
1
- /**
2
- * @synced-from pie-lib/packages/charting/src/axes.jsx
3
- * @auto-generated
4
- *
5
- * This file is automatically synced from pie-elements and converted to TypeScript.
6
- * Manual edits will be overwritten on next sync.
7
- * To make changes, edit the upstream JavaScript file and run sync again.
8
- */
9
- import React from 'react';
10
- import PropTypes from 'prop-types';
11
- export declare class TickComponent extends React.Component {
12
- static propTypes: {
13
- defineChart: PropTypes.Requireable<boolean>;
14
- error: PropTypes.Requireable<any>;
15
- };
16
- constructor(props: any);
17
- componentDidUpdate(prevProps: any): void;
18
- handleAlertDialog: (open: any, callback: any) => void;
19
- changeCategory: any;
20
- changeInteractive: any;
21
- changeEditable: any;
22
- splitText: any;
23
- render(): React.JSX.Element | null;
24
- }
25
- export declare class RawChartAxes extends React.Component {
26
- static propTypes: {
27
- bottomScale: PropTypes.Requireable<(...args: any[]) => any>;
28
- categories: PropTypes.Requireable<any[]>;
29
- defineChart: PropTypes.Requireable<boolean>;
30
- error: PropTypes.Requireable<any>;
31
- graphProps: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
32
- scale: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
33
- x: PropTypes.Validator<(...args: any[]) => any>;
34
- y: PropTypes.Validator<(...args: any[]) => any>;
35
- }>>>;
36
- snap: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
37
- x: PropTypes.Validator<(...args: any[]) => any>;
38
- y: PropTypes.Validator<(...args: any[]) => any>;
39
- }>>>;
40
- domain: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
41
- min: PropTypes.Validator<number>;
42
- max: PropTypes.Validator<number>;
43
- step: PropTypes.Requireable<number>;
44
- }>>>;
45
- range: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
46
- min: PropTypes.Validator<number>;
47
- max: PropTypes.Validator<number>;
48
- step: PropTypes.Requireable<number>;
49
- }>>>;
50
- size: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
51
- width: PropTypes.Validator<number>;
52
- height: PropTypes.Validator<number>;
53
- }>>>;
54
- }>>>;
55
- xBand: PropTypes.Requireable<(...args: any[]) => any>;
56
- leftAxis: PropTypes.Requireable<boolean>;
57
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
58
- onChangeCategory: PropTypes.Requireable<(...args: any[]) => any>;
59
- top: PropTypes.Requireable<number>;
60
- theme: PropTypes.Requireable<object>;
61
- chartingOptions: PropTypes.Requireable<object>;
62
- changeInteractiveEnabled: PropTypes.Requireable<boolean>;
63
- changeEditableEnabled: PropTypes.Requireable<boolean>;
64
- autoFocus: PropTypes.Requireable<boolean>;
65
- onAutoFocusUsed: PropTypes.Requireable<(...args: any[]) => any>;
66
- showCorrectness: PropTypes.Requireable<boolean>;
67
- hiddenLabelRef: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | PropTypes.InferProps<{
68
- current: PropTypes.Requireable<Element>;
69
- }> | null | undefined>>;
70
- };
71
- state: {
72
- height: number;
73
- width: number;
74
- };
75
- measureHiddenLabel: any;
76
- _onDocMutation: any;
77
- observeHiddenLabel: any;
78
- setHiddenLabelRef: any;
79
- componentDidMount(): void;
80
- componentWillUnmount(): void;
81
- componentDidUpdate(prevProps: any): void;
82
- render(): React.JSX.Element;
83
- }
84
- export default RawChartAxes;