@pie-lib/graphing-solution-set 0.1.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 (257) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +23 -0
  2. package/dist/axis/arrow.d.ts +14 -0
  3. package/dist/axis/arrow.d.ts.map +1 -0
  4. package/dist/axis/arrow.js +34 -0
  5. package/dist/axis/axes.d.ts +133 -0
  6. package/dist/axis/axes.d.ts.map +1 -0
  7. package/dist/axis/axes.js +214 -0
  8. package/dist/axis/index.d.ts +11 -0
  9. package/dist/axis/index.d.ts.map +1 -0
  10. package/dist/bg.d.ts +52 -0
  11. package/dist/bg.d.ts.map +1 -0
  12. package/dist/bg.js +44 -0
  13. package/dist/container/actions.d.ts +16 -0
  14. package/dist/container/actions.d.ts.map +1 -0
  15. package/dist/container/actions.js +7 -0
  16. package/dist/container/index.d.ts +27 -0
  17. package/dist/container/index.d.ts.map +1 -0
  18. package/dist/container/index.js +48 -0
  19. package/dist/container/marks.d.ts +11 -0
  20. package/dist/container/marks.d.ts.map +1 -0
  21. package/dist/container/marks.js +11 -0
  22. package/dist/container/middleware.d.ts +11 -0
  23. package/dist/container/middleware.d.ts.map +1 -0
  24. package/dist/container/middleware.js +4 -0
  25. package/dist/container/reducer.d.ts +13 -0
  26. package/dist/container/reducer.d.ts.map +1 -0
  27. package/dist/container/reducer.js +7 -0
  28. package/dist/coordinates-label.d.ts +50 -0
  29. package/dist/coordinates-label.d.ts.map +1 -0
  30. package/dist/coordinates-label.js +46 -0
  31. package/dist/graph-with-controls.d.ts +86 -0
  32. package/dist/graph-with-controls.d.ts.map +1 -0
  33. package/dist/graph-with-controls.js +155 -0
  34. package/dist/graph.d.ts +120 -0
  35. package/dist/graph.d.ts.map +1 -0
  36. package/dist/graph.js +221 -0
  37. package/dist/grid-setup.d.ts +27 -0
  38. package/dist/grid-setup.d.ts.map +1 -0
  39. package/dist/grid-setup.js +307 -0
  40. package/dist/grid.d.ts +44 -0
  41. package/dist/grid.d.ts.map +1 -0
  42. package/dist/grid.js +59 -0
  43. package/dist/index.d.ts +15 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +6 -0
  46. package/dist/labels.d.ts +74 -0
  47. package/dist/labels.d.ts.map +1 -0
  48. package/dist/labels.js +134 -0
  49. package/dist/mark-label.d.ts +50 -0
  50. package/dist/mark-label.d.ts.map +1 -0
  51. package/dist/mark-label.js +84 -0
  52. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +7 -0
  53. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/defineProperty.js +12 -0
  54. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/extends.js +12 -0
  55. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +7 -0
  56. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +25 -0
  57. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +12 -0
  58. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +8 -0
  59. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +14 -0
  60. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +9 -0
  61. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/typeof.js +11 -0
  62. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Axis.js +100 -0
  63. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/AxisRenderer.js +61 -0
  64. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Ticks.js +42 -0
  65. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/constants/orientation.js +9 -0
  66. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/createPoint.js +14 -0
  67. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getAxisRangePaddingConfig.js +21 -0
  68. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getLabelTransform.js +16 -0
  69. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getTickFormatter.js +8 -0
  70. package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getTickPosition.js +15 -0
  71. package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/Grid.js +78 -0
  72. package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/GridColumns.js +79 -0
  73. package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/GridRows.js +79 -0
  74. package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/utils/getScaleBandwidth.js +6 -0
  75. package/dist/node_modules/.bun/@visx_group@3.12.0_f4eacebf2041cd4f/node_modules/@visx/group/esm/Group.js +49 -0
  76. package/dist/node_modules/.bun/@visx_point@3.12.0/node_modules/@visx/point/esm/Point.js +18 -0
  77. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/coerceNumber.js +10 -0
  78. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/getTicks.js +9 -0
  79. package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/toString.js +6 -0
  80. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/Line.js +46 -0
  81. package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/lib/shapes/Line.js +52 -0
  82. package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/Text.js +57 -0
  83. package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/hooks/useText.js +91 -0
  84. package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/util/getStringWidth.js +21 -0
  85. package/dist/node_modules/.bun/balanced-match@0.4.2/node_modules/balanced-match/index.js +32 -0
  86. package/dist/node_modules/.bun/balanced-match@1.0.2/node_modules/balanced-match/index.js +33 -0
  87. package/dist/node_modules/.bun/hoist-non-react-statics@3.3.2/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js +68 -0
  88. package/dist/node_modules/.bun/invariant@2.2.4/node_modules/invariant/browser.js +28 -0
  89. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_Hash.js +21 -0
  90. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_ListCache.js +21 -0
  91. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_Map.js +10 -0
  92. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_MapCache.js +21 -0
  93. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_Symbol.js +9 -0
  94. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_assocIndexOf.js +14 -0
  95. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_baseGetTag.js +15 -0
  96. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_baseIsNative.js +16 -0
  97. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_coreJsData.js +9 -0
  98. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_freeGlobal.js +8 -0
  99. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_getMapData.js +14 -0
  100. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_getNative.js +15 -0
  101. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_getRawTag.js +19 -0
  102. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_getValue.js +11 -0
  103. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashClear.js +13 -0
  104. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashDelete.js +12 -0
  105. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashGet.js +18 -0
  106. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashHas.js +14 -0
  107. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_hashSet.js +14 -0
  108. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_isKeyable.js +12 -0
  109. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_isMasked.js +16 -0
  110. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheClear.js +11 -0
  111. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js +14 -0
  112. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheGet.js +14 -0
  113. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheHas.js +13 -0
  114. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_listCacheSet.js +14 -0
  115. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheClear.js +19 -0
  116. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheDelete.js +14 -0
  117. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheGet.js +13 -0
  118. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheHas.js +13 -0
  119. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_mapCacheSet.js +14 -0
  120. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_nativeCreate.js +9 -0
  121. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_objectToString.js +12 -0
  122. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_root.js +10 -0
  123. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/_toSource.js +20 -0
  124. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/eq.js +11 -0
  125. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/isFunction.js +16 -0
  126. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/isObject.js +12 -0
  127. package/dist/node_modules/.bun/lodash@4.17.21/node_modules/lodash/memoize.js +20 -0
  128. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/formula_evaluator.js +37 -0
  129. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/lexer.js +509 -0
  130. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/math_function.js +108 -0
  131. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix.js +31 -0
  132. package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix_evaluator.js +45 -0
  133. package/dist/node_modules/.bun/react-input-autosize@2.2.2_f4eacebf2041cd4f/node_modules/react-input-autosize/lib/AutosizeInput.js +216 -0
  134. package/dist/node_modules/.bun/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js +82 -0
  135. package/dist/node_modules/.bun/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js +62 -0
  136. package/dist/node_modules/.bun/react-is@16.13.1/node_modules/react-is/index.js +10 -0
  137. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/components/Context.js +5 -0
  138. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/components/Provider.js +47 -0
  139. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/components/connectAdvanced.js +95 -0
  140. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/connect.js +52 -0
  141. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/mapDispatchToProps.js +23 -0
  142. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/mapStateToProps.js +13 -0
  143. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/mergeProps.js +26 -0
  144. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/selectorFactory.js +41 -0
  145. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/verifySubselectors.js +11 -0
  146. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/wrapMapToProps.js +28 -0
  147. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/index.js +4 -0
  148. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/utils/isPlainObject.js +10 -0
  149. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/utils/shallowEqual.js +15 -0
  150. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/utils/verifyPlainObject.js +8 -0
  151. package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/utils/warning.js +9 -0
  152. package/dist/node_modules/.bun/reduce-css-calc@1.3.0/node_modules/reduce-css-calc/index.js +49 -0
  153. package/dist/node_modules/.bun/reduce-function-call@1.0.3/node_modules/reduce-function-call/index.js +34 -0
  154. package/dist/node_modules/.bun/redux-undo@1.1.0/node_modules/redux-undo/dist/redux-undo.js +185 -0
  155. package/dist/node_modules/.bun/redux@4.2.1/node_modules/redux/es/redux.js +225 -0
  156. package/dist/toggle-bar.d.ts +41 -0
  157. package/dist/toggle-bar.d.ts.map +1 -0
  158. package/dist/tool-menu.d.ts +22 -0
  159. package/dist/tool-menu.d.ts.map +1 -0
  160. package/dist/tool-menu.js +188 -0
  161. package/dist/tools/index.d.ts +18 -0
  162. package/dist/tools/index.d.ts.map +1 -0
  163. package/dist/tools/index.js +12 -0
  164. package/dist/tools/line/component.d.ts +92 -0
  165. package/dist/tools/line/component.d.ts.map +1 -0
  166. package/dist/tools/line/component.js +58 -0
  167. package/dist/tools/line/index.d.ts +14 -0
  168. package/dist/tools/line/index.d.ts.map +1 -0
  169. package/dist/tools/line/index.js +6 -0
  170. package/dist/tools/polygon/component.d.ts +115 -0
  171. package/dist/tools/polygon/component.d.ts.map +1 -0
  172. package/dist/tools/polygon/component.js +194 -0
  173. package/dist/tools/polygon/index.d.ts +20 -0
  174. package/dist/tools/polygon/index.d.ts.map +1 -0
  175. package/dist/tools/polygon/index.js +55 -0
  176. package/dist/tools/polygon/line.d.ts +105 -0
  177. package/dist/tools/polygon/line.d.ts.map +1 -0
  178. package/dist/tools/polygon/polygon.d.ts +102 -0
  179. package/dist/tools/polygon/polygon.d.ts.map +1 -0
  180. package/dist/tools/polygon/polygon.js +62 -0
  181. package/dist/tools/shared/arrow-head.d.ts +43 -0
  182. package/dist/tools/shared/arrow-head.d.ts.map +1 -0
  183. package/dist/tools/shared/arrow-head.js +37 -0
  184. package/dist/tools/shared/line/index.d.ts +165 -0
  185. package/dist/tools/shared/line/index.d.ts.map +1 -0
  186. package/dist/tools/shared/line/index.js +320 -0
  187. package/dist/tools/shared/line/line-path.d.ts +58 -0
  188. package/dist/tools/shared/line/line-path.d.ts.map +1 -0
  189. package/dist/tools/shared/line/with-root-edge.d.ts +89 -0
  190. package/dist/tools/shared/line/with-root-edge.d.ts.map +1 -0
  191. package/dist/tools/shared/point/arrow-point.d.ts +58 -0
  192. package/dist/tools/shared/point/arrow-point.d.ts.map +1 -0
  193. package/dist/tools/shared/point/arrow-point.js +47 -0
  194. package/dist/tools/shared/point/arrow.d.ts +47 -0
  195. package/dist/tools/shared/point/arrow.d.ts.map +1 -0
  196. package/dist/tools/shared/point/arrow.js +36 -0
  197. package/dist/tools/shared/point/base-point.d.ts +51 -0
  198. package/dist/tools/shared/point/base-point.d.ts.map +1 -0
  199. package/dist/tools/shared/point/base-point.js +88 -0
  200. package/dist/tools/shared/point/index.d.ts +154 -0
  201. package/dist/tools/shared/point/index.d.ts.map +1 -0
  202. package/dist/tools/shared/point/index.js +51 -0
  203. package/dist/tools/shared/styles.d.ts +25 -0
  204. package/dist/tools/shared/styles.d.ts.map +1 -0
  205. package/dist/tools/shared/styles.js +17 -0
  206. package/dist/tools/shared/types.d.ts +16 -0
  207. package/dist/tools/shared/types.d.ts.map +1 -0
  208. package/dist/tools/shared/types.js +10 -0
  209. package/dist/undo-redo.d.ts +21 -0
  210. package/dist/undo-redo.d.ts.map +1 -0
  211. package/dist/undo-redo.js +33 -0
  212. package/dist/use-debounce.d.ts +10 -0
  213. package/dist/use-debounce.d.ts.map +1 -0
  214. package/dist/use-debounce.js +13 -0
  215. package/dist/utils.d.ts +59 -0
  216. package/dist/utils.d.ts.map +1 -0
  217. package/dist/utils.js +72 -0
  218. package/package.json +64 -0
  219. package/src/axis/arrow.tsx +67 -0
  220. package/src/axis/axes.tsx +321 -0
  221. package/src/axis/index.ts +13 -0
  222. package/src/bg.tsx +106 -0
  223. package/src/container/actions.ts +18 -0
  224. package/src/container/index.tsx +95 -0
  225. package/src/container/marks.ts +24 -0
  226. package/src/container/middleware.ts +17 -0
  227. package/src/container/reducer.ts +15 -0
  228. package/src/coordinates-label.tsx +72 -0
  229. package/src/graph-with-controls.tsx +252 -0
  230. package/src/graph.tsx +343 -0
  231. package/src/grid-setup.tsx +470 -0
  232. package/src/grid.tsx +143 -0
  233. package/src/index.ts +17 -0
  234. package/src/labels.tsx +211 -0
  235. package/src/mark-label.tsx +135 -0
  236. package/src/toggle-bar.tsx +231 -0
  237. package/src/tool-menu.tsx +245 -0
  238. package/src/tools/index.ts +18 -0
  239. package/src/tools/line/component.tsx +87 -0
  240. package/src/tools/line/index.ts +14 -0
  241. package/src/tools/polygon/component.tsx +334 -0
  242. package/src/tools/polygon/index.ts +62 -0
  243. package/src/tools/polygon/line.tsx +90 -0
  244. package/src/tools/polygon/polygon.tsx +103 -0
  245. package/src/tools/shared/arrow-head.tsx +56 -0
  246. package/src/tools/shared/line/index.tsx +481 -0
  247. package/src/tools/shared/line/line-path.tsx +95 -0
  248. package/src/tools/shared/line/with-root-edge.tsx +107 -0
  249. package/src/tools/shared/point/arrow-point.tsx +70 -0
  250. package/src/tools/shared/point/arrow.tsx +50 -0
  251. package/src/tools/shared/point/base-point.tsx +123 -0
  252. package/src/tools/shared/point/index.tsx +68 -0
  253. package/src/tools/shared/styles.ts +30 -0
  254. package/src/tools/shared/types.ts +18 -0
  255. package/src/undo-redo.tsx +47 -0
  256. package/src/use-debounce.ts +23 -0
  257. package/src/utils.ts +240 -0
@@ -0,0 +1,33 @@
1
+ import e from "react";
2
+ import t from "prop-types";
3
+ import { styled as n } from "@mui/material/styles";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ import { color as i } from "@pie-lib/render-ui";
6
+ import a from "@mui/material/Button";
7
+ import o from "@pie-lib/translator";
8
+ //#region src/undo-redo.tsx
9
+ var { translator: s } = o, c = n(a)(({ theme: e }) => ({
10
+ color: i.text(),
11
+ fontWeight: "bold",
12
+ marginBottom: e.spacing(.5),
13
+ "&:not(:last-of-type)": { marginRight: e.spacing(.5) }
14
+ })), l = class extends e.Component {
15
+ static propTypes = {
16
+ className: t.string,
17
+ onReset: t.func.isRequired,
18
+ language: t.string
19
+ };
20
+ static defaultProps = {};
21
+ render() {
22
+ let { className: e, onReset: t = !1, language: n } = this.props;
23
+ return /* @__PURE__ */ r("div", {
24
+ className: e,
25
+ children: /* @__PURE__ */ r(c, {
26
+ onClick: () => t(),
27
+ children: s.t("graphing.reset", { lng: n })
28
+ })
29
+ });
30
+ }
31
+ };
32
+ //#endregion
33
+ export { l as default };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/graphing-solution-set/src/use-debounce.js
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
+ export declare const useDebounce: (value: any, delay: any) => any;
10
+ //# sourceMappingURL=use-debounce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-debounce.d.ts","sourceRoot":"","sources":["../src/use-debounce.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAIH,eAAO,MAAM,WAAW,GAAI,UAAK,EAAE,UAAK,QAUvC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { useEffect as e, useState as t } from "react";
2
+ //#region src/use-debounce.ts
3
+ var n = (n, r) => {
4
+ let [i, a] = t(n);
5
+ return e(() => {
6
+ let e = setTimeout(() => {
7
+ a(n);
8
+ }, r);
9
+ return () => clearTimeout(e);
10
+ }, [n]), i;
11
+ };
12
+ //#endregion
13
+ export { n as useDebounce };
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/graphing-solution-set/src/utils.js
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
+ export declare const bounds: (area: any, domain: any, range: any) => {
10
+ left: number;
11
+ right: number;
12
+ top: number;
13
+ bottom: number;
14
+ };
15
+ export declare const point: (o: any) => import("@mapbox/point-geometry").default;
16
+ export declare const getAngleDeg: () => number;
17
+ export declare const arrowDimensions: () => number;
18
+ export declare const getTickValues: (prop: any) => number[];
19
+ export declare const countWords: (label: any) => any;
20
+ export declare const findLongestWord: (label: any) => any;
21
+ export declare const amountToIncreaseWidth: (longestWord: any) => number;
22
+ export declare const polygonToArea: (points: any) => any;
23
+ export declare const lineToArea: (from: any, to: any) => {
24
+ left: number;
25
+ top: number;
26
+ bottom: number;
27
+ right: number;
28
+ };
29
+ export declare const pointsToArea: (a: any, b: any) => {
30
+ left: number;
31
+ top: number;
32
+ bottom: number;
33
+ right: number;
34
+ };
35
+ export declare const getRightestPoints: (points: any) => {
36
+ a: any;
37
+ b: any;
38
+ };
39
+ export declare const getMiddleOfTwoPoints: (a: any, b: any) => {
40
+ x: number;
41
+ y: number;
42
+ };
43
+ export declare const roundNumber: (number: any) => number;
44
+ export declare const sameAxes: (p1: any, p2: any) => any;
45
+ export declare const equalPoints: (p1: any, p2: any) => any;
46
+ export declare const thinnerShapesNeeded: (graphProps: any) => boolean;
47
+ export declare const getAdjustedGraphLimits: (graphProps: any) => {
48
+ domain: {
49
+ min: number;
50
+ max: any;
51
+ };
52
+ range: {
53
+ min: number;
54
+ max: any;
55
+ };
56
+ };
57
+ export declare const isDuplicatedMark: (mark: any, marks: any, oldMark: any) => boolean;
58
+ export declare const areArraysOfObjectsEqual: (array1: any, array2: any) => boolean;
59
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAMH,eAAO,MAAM,MAAM;;;;;CAAe,CAAC;AACnC,eAAO,MAAM,KAAK,sDAAc,CAAC;AAGjC,eAAO,MAAM,WAAW,cAAU,CAAC;AAEnC,eAAO,MAAM,eAAe,cAAU,CAAC;AAEvC,eAAO,MAAM,aAAa,GAAI,SAAI,aAsBjC,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,UAAK,QAO/B,CAAC;AAGF,eAAO,MAAM,eAAe,GAAI,UAAK,QAOpC,CAAC;AAGF,eAAO,MAAM,qBAAqB,GAAI,gBAAW,WAMhD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,WAAM,QAenC,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,SAAI,EAAE,OAAE;;;;;CAA2B,CAAC;AAE/D,eAAO,MAAM,YAAY,GAAI,MAAC,EAAE,MAAC;;;;;CAOhC,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,WAAM;;;CAKvC,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,MAAC,EAAE,MAAC;;;CAGvC,CAAC;AAEH,eAAO,MAAM,WAAW,GAAI,WAAM,WAAkC,CAAC;AAErE,eAAO,MAAM,QAAQ,GAAI,OAAE,EAAE,OAAE,QACmE,CAAC;AAEnG,eAAO,MAAM,WAAW,GAAI,OAAE,EAAE,OAAE,QAY/B,CAAC;AASJ,eAAO,MAAM,mBAAmB,GAAI,eAAU,YAS7C,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,eAAU;;;;;;;;;CAuBhD,CAAC;AAWF,eAAO,MAAM,gBAAgB,GAAI,SAAI,EAAE,UAAK,EAAE,YAAO,YA4BpD,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,WAAM,EAAE,WAAM,YAwBrD,CAAC"}
package/dist/utils.js ADDED
@@ -0,0 +1,72 @@
1
+ import "./_virtual/_rolldown/runtime.js";
2
+ import { require_browser as e } from "./node_modules/.bun/invariant@2.2.4/node_modules/invariant/browser.js";
3
+ import { cloneDeep as t, head as n, isEmpty as r, isEqual as i, tail as a } from "lodash-es";
4
+ import { utils as o } from "@pie-lib/plot";
5
+ e();
6
+ var s = o.bounds, c = o.point, l = () => 0, u = () => 0, d = (e) => {
7
+ let t = [], n = 0;
8
+ for (; n >= e.min && t.indexOf(n) < 0;) t.push(n), n = Math.round((n - e.step) * 1e4) / 1e4;
9
+ for (n = Math.round(e.step * 1e4) / 1e4; n <= e.max && t.indexOf(n) < 0;) t.push(n), n = Math.round((n + e.step) * 1e4) / 1e4;
10
+ return t ? t.filter((t) => t >= e.min && t <= e.max) : [];
11
+ }, f = (e) => e == null || r(e) ? 1 : e.split(" ").length, p = (e) => (e || "").replace(/<[^>]+>/g, "").split(" ").sort((e, t) => t.length - e.length)[0].length, m = (e) => e ? e * 10 : 0, h = (e) => {
12
+ let t = n(e), r = {
13
+ left: t.x,
14
+ top: t.y,
15
+ bottom: t.y,
16
+ right: t.x
17
+ };
18
+ return a(e).reduce((e, t) => (e.left = Math.min(e.left, t.x), e.top = Math.max(e.top, t.y), e.bottom = Math.min(e.bottom, t.y), e.right = Math.max(e.right, t.x), e), r);
19
+ }, g = (e) => {
20
+ let n = t(e);
21
+ return n.sort((e, t) => t.x - e.x), {
22
+ a: n[0],
23
+ b: n[1]
24
+ };
25
+ }, _ = (e, t) => ({
26
+ x: (e.x + t.x) / 2,
27
+ y: (e.y + t.y) / 2
28
+ }), v = (e) => parseFloat(e.toFixed(4)), y = (e, t) => e && t && (v(e.x) === v(t.x) || v(e.y) === v(t.y)), b = (e, t) => e && t && i({
29
+ x: v(e.x),
30
+ y: v(e.y)
31
+ }, {
32
+ x: v(t.x),
33
+ y: v(t.y)
34
+ }), x = (e, t) => {
35
+ let { min: n, max: r, step: i } = e;
36
+ return t / ((r - n) / i);
37
+ }, S = (e) => {
38
+ let { domain: t, range: n, size: { width: r, height: i } } = e;
39
+ return x(t, r) < 14 || x(n, i) < 14;
40
+ }, C = (e) => {
41
+ let { domain: t, range: n, size: { width: r, height: i } } = e, a = x(t, r), o = x(n, i), s = t.step / (a / 15), c = n.step / (o / 15);
42
+ return {
43
+ domain: {
44
+ min: t.min - s,
45
+ max: t.max + s
46
+ },
47
+ range: {
48
+ min: n.min - c,
49
+ max: n.max + c
50
+ }
51
+ };
52
+ }, w = (e) => (e || []).sort((e, t) => e.x - t.x || e.y - t.y), T = (e, t, n) => (e.x - t.x) * (n.y - t.y) === (n.x - t.x) * (e.y - t.y), E = (e, t) => T(e.from, t.from, t.to) && T(e.to, t.from, t.to), D = (e, n, r) => {
53
+ let { type: a, building: o } = e;
54
+ if (o) return !1;
55
+ let s = (n || []).filter((e) => e.type === a && !e.building), c = s.findIndex((e) => i(e, r));
56
+ return c !== -1 && s.splice(c, 1), !!s.find((n) => {
57
+ if (a === "line") {
58
+ let { from: t, to: r } = e;
59
+ return b(t, n.from) && b(r, n.to) || b(t, n.to) && b(r, n.from) || a === "line" && E(n, e);
60
+ } else if (a === "polygon") return i(w(t(e.points)), w(t(n.points)));
61
+ });
62
+ }, O = (e, t) => {
63
+ if (e.length !== t.length) return !1;
64
+ for (let n = 0; n < e.length; n++) {
65
+ let r = e[n], i = t[n];
66
+ if (Object.keys(r).length !== Object.keys(i).length) return !1;
67
+ for (let e in r) if (r[e] !== i[e]) return !1;
68
+ }
69
+ return !0;
70
+ };
71
+ //#endregion
72
+ export { m as amountToIncreaseWidth, O as areArraysOfObjectsEqual, u as arrowDimensions, s as bounds, f as countWords, b as equalPoints, p as findLongestWord, C as getAdjustedGraphLimits, l as getAngleDeg, _ as getMiddleOfTwoPoints, g as getRightestPoints, d as getTickValues, D as isDuplicatedMark, c as point, h as polygonToArea, v as roundNumber, y as sameAxes, S as thinnerShapesNeeded };
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@pie-lib/graphing-solution-set",
3
+ "version": "0.1.0",
4
+ "description": "Graphing components",
5
+ "dependencies": {
6
+ "@dnd-kit/sortable": "10.0.0",
7
+ "@emotion/react": "^11.14.0",
8
+ "@emotion/style": "^0.8.0",
9
+ "@mapbox/point-geometry": "^1.1.0",
10
+ "@mui/icons-material": "^7.3.4",
11
+ "@mui/material": "^7.3.4",
12
+ "@pie-lib/drag": "0.1.0",
13
+ "@pie-lib/editable-html-tip-tap": "0.1.0",
14
+ "@pie-lib/graphing-utils": "0.1.0",
15
+ "@pie-lib/plot": "0.1.0",
16
+ "@pie-lib/render-ui": "0.1.0",
17
+ "@pie-lib/tools": "0.1.0",
18
+ "@pie-lib/translator": "0.1.0",
19
+ "@visx/axis": "^3.0.0",
20
+ "@visx/clip-path": "^3.0.0",
21
+ "@visx/curve": "^3.0.0",
22
+ "@visx/event": "^3.0.0",
23
+ "@visx/grid": "^3.0.0",
24
+ "@visx/group": "^3.0.0",
25
+ "@visx/point": "^3.0.0",
26
+ "@visx/shape": "^3.0.0",
27
+ "classnames": "^2.2.6",
28
+ "d3-scale": "^4.0.2",
29
+ "d3-selection": "^3.0.0",
30
+ "debug": "^4.1.1",
31
+ "invariant": "^2.2.4",
32
+ "lodash-es": "^4.17.23",
33
+ "prop-types": "^15.7.2",
34
+ "react": "^18.2.0",
35
+ "react-dom": "^18.2.0",
36
+ "react-draggable": "^3.3.0",
37
+ "react-input-autosize": "^2.2.1",
38
+ "react-redux": "^6.0.0",
39
+ "redux": "^4.0.1",
40
+ "redux-undo": "^1.1.0",
41
+ "@pie-lib/config-ui": "0.1.0",
42
+ "@dnd-kit/core": "6.3.1",
43
+ "@dnd-kit/utilities": "3.2.2"
44
+ },
45
+ "type": "module",
46
+ "main": "./dist/index.js",
47
+ "types": "./dist/index.d.ts",
48
+ "exports": {
49
+ ".": {
50
+ "types": "./dist/index.d.ts",
51
+ "default": "./dist/index.js"
52
+ }
53
+ },
54
+ "files": [
55
+ "dist",
56
+ "src"
57
+ ],
58
+ "sideEffects": false,
59
+ "scripts": {
60
+ "build": "bun x vite build && bun x tsc --emitDeclarationOnly",
61
+ "dev": "bun x vite",
62
+ "test": "bun x vitest run"
63
+ }
64
+ }
@@ -0,0 +1,67 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/graphing-solution-set/src/axis/arrow.jsx
4
+ * @auto-generated
5
+ *
6
+ * This file is automatically synced from pie-elements and converted to TypeScript.
7
+ * Manual edits will be overwritten on next sync.
8
+ * To make changes, edit the upstream JavaScript file and run sync again.
9
+ */
10
+
11
+ import React from 'react';
12
+ import PropTypes from 'prop-types';
13
+
14
+ import { styled } from '@mui/material/styles';
15
+ import { types } from '@pie-lib/plot';
16
+
17
+ const StyledPath: any = styled('path')(({ theme }) => ({
18
+ fill: `var(--arrow-color, ${theme.palette.common.black})`,
19
+ }));
20
+
21
+ export class Arrow extends React.Component {
22
+ render() {
23
+ const { x, y, className, scale } = this.props;
24
+ let direction = this.props.direction || 'left';
25
+
26
+ const xv = scale.x(x);
27
+ const yv = scale.y(y);
28
+
29
+ let transform = '';
30
+
31
+ const getTransform = (x, y, rotate) => `translate(${x}, ${y}) rotate(${rotate})`;
32
+
33
+ if (direction === 'left') {
34
+ transform = getTransform(xv - 15, yv, 0);
35
+ }
36
+
37
+ if (direction === 'right') {
38
+ transform = getTransform(xv + 15, yv, 180);
39
+ }
40
+
41
+ if (direction === 'up') {
42
+ transform = getTransform(xv, yv - 15, 90);
43
+ }
44
+
45
+ if (direction === 'down') {
46
+ transform = getTransform(xv, yv + 15, 270);
47
+ }
48
+
49
+ return <StyledPath d="m 0,0 8,-5 0,10 -8,-5" transform={transform} className={className} />;
50
+ }
51
+ }
52
+
53
+ Arrow.propTypes = {
54
+ y: PropTypes.number,
55
+ x: PropTypes.number,
56
+ direction: PropTypes.oneOf(['left', 'right', 'up', 'down']),
57
+ className: PropTypes.string,
58
+ scale: types.ScaleType.isRequired,
59
+ };
60
+
61
+ Arrow.defaultProps = {
62
+ y: 0,
63
+ x: 0,
64
+ direction: 'left',
65
+ };
66
+
67
+ export default Arrow;
@@ -0,0 +1,321 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/graphing-solution-set/src/axis/axes.jsx
4
+ * @auto-generated
5
+ *
6
+ * This file is automatically synced from pie-elements and converted to TypeScript.
7
+ * Manual edits will be overwritten on next sync.
8
+ * To make changes, edit the upstream JavaScript file and run sync again.
9
+ */
10
+
11
+ import React from 'react';
12
+ import { Axis } from '@visx/axis';
13
+ import { types } from '@pie-lib/plot';
14
+ import PropTypes from 'prop-types';
15
+ import Arrow from './arrow.js';
16
+ import { styled } from '@mui/material/styles';
17
+ import { amountToIncreaseWidth, countWords, findLongestWord, getTickValues } from '../utils.js';
18
+ import { color, Readable as ReadableImport } from '@pie-lib/render-ui';
19
+
20
+ function isRenderableReactInteropType(value: any) {
21
+ return (
22
+ typeof value === 'function' ||
23
+ (typeof value === 'object' && value !== null && typeof value.$$typeof === 'symbol')
24
+ );
25
+ }
26
+
27
+ function unwrapReactInteropSymbol(maybeSymbol: any, namedExport?: string) {
28
+ if (!maybeSymbol) return maybeSymbol;
29
+ if (isRenderableReactInteropType(maybeSymbol)) return maybeSymbol;
30
+ if (isRenderableReactInteropType(maybeSymbol.default)) return maybeSymbol.default;
31
+ if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport])) {
32
+ return maybeSymbol[namedExport];
33
+ }
34
+ if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport]?.default)) {
35
+ return maybeSymbol[namedExport].default;
36
+ }
37
+ return maybeSymbol;
38
+ }
39
+ const Readable = unwrapReactInteropSymbol(ReadableImport, 'Readable') || unwrapReactInteropSymbol(renderUi.Readable, 'Readable');
40
+ import * as RenderUiNamespace from '@pie-lib/render-ui';
41
+ const renderUiNamespaceAny = RenderUiNamespace as any;
42
+ const renderUiDefaultMaybe = renderUiNamespaceAny['default'];
43
+ const renderUi =
44
+ renderUiDefaultMaybe && typeof renderUiDefaultMaybe === 'object'
45
+ ? renderUiDefaultMaybe
46
+ : renderUiNamespaceAny;
47
+ export const AxisPropTypes = {
48
+ includeArrows: PropTypes.object,
49
+ graphProps: PropTypes.object,
50
+ };
51
+
52
+ const AxisDefaultProps = {
53
+ includeArrows: {
54
+ left: true,
55
+ right: true,
56
+ up: true,
57
+ down: true,
58
+ },
59
+ };
60
+
61
+ const StyledAxesGroup: any = styled('g')(() => ({
62
+ '& .visx-axis-line': {
63
+ stroke: '#8a92c0',
64
+ strokeWidth: 4,
65
+ },
66
+ '& .visx-axis-tick': {
67
+ fill: color.defaults.BLACK,
68
+ '& > line': {
69
+ stroke: '#8a92c0',
70
+ },
71
+ },
72
+ }));
73
+
74
+ const AxisLabelHolder: any = styled('div')(({ theme, centered }) => ({
75
+ padding: 0,
76
+ margin: 0,
77
+ '* > *': {
78
+ margin: 0,
79
+ padding: 0,
80
+ },
81
+ '& p': {
82
+ margin: 0,
83
+ },
84
+ fontSize: theme.typography.fontSize,
85
+ ...(centered && { textAlign: 'center' }),
86
+ }));
87
+
88
+ const StyledArrow: any = styled(Arrow)({
89
+ fill: '#8a92c0',
90
+ });
91
+
92
+ const tickLabelStyles = {
93
+ fontFamily: 'Roboto',
94
+ fontSize: '14px',
95
+ cursor: 'inherit',
96
+ };
97
+
98
+ export const sharedValues = (
99
+ firstNegativeX,
100
+ firstNegativeY,
101
+ distanceFromOriginToFirstNegativeX,
102
+ distanceFromOriginToFirstNegativeY,
103
+ deltaAllowance,
104
+ dy,
105
+ ) => {
106
+ let result = [];
107
+
108
+ if (
109
+ firstNegativeX === firstNegativeY &&
110
+ distanceFromOriginToFirstNegativeX - deltaAllowance < distanceFromOriginToFirstNegativeY &&
111
+ distanceFromOriginToFirstNegativeY < distanceFromOriginToFirstNegativeX + deltaAllowance &&
112
+ distanceFromOriginToFirstNegativeX - deltaAllowance < dy &&
113
+ dy < distanceFromOriginToFirstNegativeX + deltaAllowance
114
+ ) {
115
+ result.push(firstNegativeX);
116
+ }
117
+
118
+ return result;
119
+ };
120
+
121
+ export const firstNegativeValue = (interval) => (interval || []).find((element) => element < 0);
122
+
123
+ export class RawXAxis extends React.Component {
124
+ static propTypes = {
125
+ ...AxisPropTypes,
126
+ graphProps: types.GraphPropsType.isRequired,
127
+ };
128
+ static defaultProps = AxisDefaultProps;
129
+
130
+ render() {
131
+ const { includeArrows, graphProps, columnTicksValues, skipValues, distanceFromOriginToFirstNegativeY, dy } =
132
+ this.props;
133
+ const { scale, domain, size, range } = graphProps || {};
134
+
135
+ const labelProps = (label) => {
136
+ const y = skipValues && skipValues[0] === label ? distanceFromOriginToFirstNegativeY + 4 : dy;
137
+
138
+ return {
139
+ ...tickLabelStyles,
140
+ textAnchor: 'middle',
141
+ y: y,
142
+ dx: label === 0 ? -10 : 0,
143
+ dy: label === 0 ? -7 : 0,
144
+ };
145
+ };
146
+
147
+ const necessaryRows = countWords(domain.axisLabel);
148
+ const longestWord = findLongestWord(domain.axisLabel);
149
+ const necessaryWidth = amountToIncreaseWidth(longestWord) + 2;
150
+
151
+ return (
152
+ <StyledAxesGroup>
153
+ <Axis
154
+ scale={scale.x}
155
+ top={scale.y(0)}
156
+ left={0}
157
+ label={domain.label}
158
+ rangePadding={8}
159
+ tickFormat={(value) => value}
160
+ tickLabelProps={labelProps}
161
+ tickValues={columnTicksValues}
162
+ hideZero={!(domain.labelStep || range.labelStep) && domain.min <= 0}
163
+ />
164
+ {includeArrows && includeArrows.left && <StyledArrow direction="left" x={domain.min} y={0} scale={scale} />}
165
+ {includeArrows && includeArrows.right && <StyledArrow direction="right" x={domain.max} y={0} scale={scale} />}
166
+ {domain.axisLabel && (
167
+ <foreignObject x={size.width + 17} y={scale.y(0) - 9} width={necessaryWidth} height={20 * necessaryRows}>
168
+ <Readable false>
169
+ <AxisLabelHolder dangerouslySetInnerHTML={{ __html: domain.axisLabel }} />
170
+ </Readable>
171
+ </foreignObject>
172
+ )}
173
+ </StyledAxesGroup>
174
+ );
175
+ }
176
+ }
177
+
178
+ const XAxis = RawXAxis;
179
+
180
+ export class RawYAxis extends React.Component {
181
+ static propTypes = {
182
+ ...AxisPropTypes,
183
+ graphProps: types.GraphPropsType.isRequired,
184
+ };
185
+ static defaultProps = AxisDefaultProps;
186
+
187
+ render() {
188
+ const { includeArrows, graphProps, skipValues, rowTickValues } = this.props;
189
+ const { scale, range, size } = graphProps || {};
190
+
191
+ const necessaryWidth = range.axisLabel ? amountToIncreaseWidth(range.axisLabel.length) : 0;
192
+
193
+ const customTickFormat = (value) => (skipValues && skipValues.indexOf(value) >= 0 ? '' : value);
194
+
195
+ return (
196
+ <StyledAxesGroup>
197
+ <Axis
198
+ orientation={'left'}
199
+ scale={scale.y}
200
+ top={0}
201
+ height={size.height}
202
+ left={scale.x(0)}
203
+ label={range.label}
204
+ labelProps={{ 'data-pie-readable': false }}
205
+ rangePadding={8}
206
+ tickLength={10}
207
+ tickFormat={customTickFormat}
208
+ tickLabelProps={(value) => {
209
+ let digits = value.toLocaleString().replace(/[.-]/g, '').length || 1;
210
+
211
+ return {
212
+ ...tickLabelStyles,
213
+ dy: 4,
214
+ dx: -10 - digits * 9,
215
+ 'data-pie-readable': false,
216
+ };
217
+ }}
218
+ hideZero={true}
219
+ tickTextAnchor={'bottom'}
220
+ tickValues={rowTickValues}
221
+ />
222
+ {includeArrows && includeArrows.down && <StyledArrow direction="down" x={0} y={range.min} scale={scale} />}
223
+ {includeArrows && includeArrows.up && <StyledArrow direction="up" x={0} y={range.max} scale={scale} />}
224
+ {range.axisLabel && (
225
+ <foreignObject x={scale.x(0) - necessaryWidth / 2} y={-33} width={necessaryWidth} height="20">
226
+ <Readable false>
227
+ <AxisLabelHolder centered dangerouslySetInnerHTML={{ __html: range.axisLabel }} />
228
+ </Readable>
229
+ </foreignObject>
230
+ )}
231
+ </StyledAxesGroup>
232
+ );
233
+ }
234
+ }
235
+
236
+ const YAxis = RawYAxis;
237
+
238
+ export default class Axes extends React.Component {
239
+ static propTypes = {
240
+ ...AxisPropTypes,
241
+ graphProps: types.GraphPropsType.isRequired,
242
+ };
243
+ static defaultProps = AxisDefaultProps;
244
+
245
+ xValues: any = () => {
246
+ const { graphProps } = this.props;
247
+ const { scale, domain } = graphProps || {};
248
+
249
+ if (!domain || !scale) {
250
+ return;
251
+ }
252
+
253
+ const ticks = getTickValues({ ...domain, step: domain.labelStep });
254
+ const negative = firstNegativeValue(ticks);
255
+
256
+ return {
257
+ columnTicksValues: ticks,
258
+ firstNegativeX: negative,
259
+ distanceFromOriginToFirstNegativeX: Math.abs(scale.y(0) - scale.y(negative)),
260
+ };
261
+ };
262
+
263
+ yValues: any = () => {
264
+ const { graphProps } = this.props;
265
+ const { scale, range } = graphProps || {};
266
+
267
+ if (!range || !scale) {
268
+ return;
269
+ }
270
+
271
+ const ticks = getTickValues({ ...range, step: range.labelStep });
272
+ const negative = firstNegativeValue(ticks);
273
+
274
+ return {
275
+ rowTickValues: ticks,
276
+ firstNegativeY: negative,
277
+ distanceFromOriginToFirstNegativeY: Math.abs(scale.x(0) - scale.x(negative)),
278
+ };
279
+ };
280
+
281
+ render() {
282
+ const { graphProps } = this.props;
283
+ const { domain, range } = graphProps || {};
284
+ const { columnTicksValues, firstNegativeX, distanceFromOriginToFirstNegativeX } = this.xValues();
285
+ const { rowTickValues, firstNegativeY, distanceFromOriginToFirstNegativeY } = this.yValues();
286
+ const deltaAllowance = 6;
287
+ const dy = 25;
288
+
289
+ const skipValues = sharedValues(
290
+ firstNegativeX,
291
+ firstNegativeY,
292
+ distanceFromOriginToFirstNegativeX,
293
+ distanceFromOriginToFirstNegativeY,
294
+ deltaAllowance,
295
+ dy,
296
+ );
297
+
298
+ // each axis has to be displayed only if the domain & range include it
299
+ return (
300
+ <StyledAxesGroup>
301
+ {range.min <= 0 ? (
302
+ <XAxis
303
+ {...this.props}
304
+ skipValues={skipValues}
305
+ columnTicksValues={columnTicksValues}
306
+ distanceFromOriginToFirstNegativeY={distanceFromOriginToFirstNegativeY}
307
+ dy={dy}
308
+ />
309
+ ) : null}
310
+ {domain.min <= 0 ? (
311
+ <YAxis
312
+ {...this.props}
313
+ skipValues={skipValues}
314
+ rowTickValues={rowTickValues}
315
+ distanceFromOriginToFirstNegativeX={distanceFromOriginToFirstNegativeX}
316
+ />
317
+ ) : null}
318
+ </StyledAxesGroup>
319
+ );
320
+ }
321
+ }
@@ -0,0 +1,13 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/graphing-solution-set/src/axis/index.js
4
+ * @auto-generated
5
+ *
6
+ * This file is automatically synced from pie-elements and converted to TypeScript.
7
+ * Manual edits will be overwritten on next sync.
8
+ * To make changes, edit the upstream JavaScript file and run sync again.
9
+ */
10
+
11
+ import Axes, { AxisPropTypes } from './axes.js';
12
+
13
+ export { Axes, AxisPropTypes };