@wonderflow/charts 12.8.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 (259) hide show
  1. package/dist/components/cartesian-base/cartesian-base-axis.d.ts +15 -0
  2. package/dist/components/cartesian-base/cartesian-base-axis.d.ts.map +1 -0
  3. package/dist/components/cartesian-base/cartesian-base-axis.js +53 -0
  4. package/dist/components/cartesian-base/cartesian-base-grid.d.ts +23 -0
  5. package/dist/components/cartesian-base/cartesian-base-grid.d.ts.map +1 -0
  6. package/dist/components/cartesian-base/cartesian-base-grid.js +35 -0
  7. package/dist/components/cartesian-base/cartesian-base-legend.d.ts +7 -0
  8. package/dist/components/cartesian-base/cartesian-base-legend.d.ts.map +1 -0
  9. package/dist/components/cartesian-base/cartesian-base-legend.js +35 -0
  10. package/dist/components/cartesian-base/cartesian-base.d.ts +78 -0
  11. package/dist/components/cartesian-base/cartesian-base.d.ts.map +1 -0
  12. package/dist/components/cartesian-base/cartesian-base.js +98 -0
  13. package/dist/components/cartesian-base/cartesian-base.module.css +1 -0
  14. package/dist/components/cartesian-base/cartesian-base.test.d.ts +2 -0
  15. package/dist/components/cartesian-base/cartesian-base.test.d.ts.map +1 -0
  16. package/dist/components/cartesian-base/cartesian-base.test.js +51 -0
  17. package/dist/components/cartesian-base/index.d.ts +3 -0
  18. package/dist/components/cartesian-base/index.d.ts.map +1 -0
  19. package/dist/components/cartesian-base/index.js +16 -0
  20. package/dist/components/empty-state/empty-state.d.ts +16 -0
  21. package/dist/components/empty-state/empty-state.d.ts.map +1 -0
  22. package/dist/components/empty-state/empty-state.js +31 -0
  23. package/dist/components/empty-state/empty-state.test.d.ts +2 -0
  24. package/dist/components/empty-state/empty-state.test.d.ts.map +1 -0
  25. package/dist/components/empty-state/empty-state.test.js +67 -0
  26. package/dist/components/empty-state/index.d.ts +2 -0
  27. package/dist/components/empty-state/index.d.ts.map +1 -0
  28. package/dist/components/empty-state/index.js +16 -0
  29. package/dist/components/headings/headings.d.ts +27 -0
  30. package/dist/components/headings/headings.d.ts.map +1 -0
  31. package/dist/components/headings/headings.js +31 -0
  32. package/dist/components/headings/headings.test.d.ts +2 -0
  33. package/dist/components/headings/headings.test.d.ts.map +1 -0
  34. package/dist/components/headings/headings.test.js +14 -0
  35. package/dist/components/headings/index.d.ts +3 -0
  36. package/dist/components/headings/index.d.ts.map +1 -0
  37. package/dist/components/headings/index.js +16 -0
  38. package/dist/components/index.d.ts +7 -0
  39. package/dist/components/index.d.ts.map +1 -0
  40. package/dist/components/index.js +21 -0
  41. package/dist/components/line-chart/index.d.ts +3 -0
  42. package/dist/components/line-chart/index.d.ts.map +1 -0
  43. package/dist/components/line-chart/index.js +16 -0
  44. package/dist/components/line-chart/line-chart.d.ts +57 -0
  45. package/dist/components/line-chart/line-chart.d.ts.map +1 -0
  46. package/dist/components/line-chart/line-chart.js +68 -0
  47. package/dist/components/line-chart/line-chart.test.d.ts +2 -0
  48. package/dist/components/line-chart/line-chart.test.d.ts.map +1 -0
  49. package/dist/components/line-chart/line-chart.test.js +20 -0
  50. package/dist/components/loader/bar-chart-loader.d.ts +11 -0
  51. package/dist/components/loader/bar-chart-loader.d.ts.map +1 -0
  52. package/dist/components/loader/bar-chart-loader.js +3 -0
  53. package/dist/components/loader/index.d.ts +2 -0
  54. package/dist/components/loader/index.d.ts.map +1 -0
  55. package/dist/components/loader/index.js +16 -0
  56. package/dist/components/loader/line-chart-loader.d.ts +11 -0
  57. package/dist/components/loader/line-chart-loader.d.ts.map +1 -0
  58. package/dist/components/loader/line-chart-loader.js +3 -0
  59. package/dist/components/loader/loader.d.ts +10 -0
  60. package/dist/components/loader/loader.d.ts.map +1 -0
  61. package/dist/components/loader/loader.js +35 -0
  62. package/dist/components/loader/loader.test.d.ts +2 -0
  63. package/dist/components/loader/loader.test.d.ts.map +1 -0
  64. package/dist/components/loader/loader.test.js +50 -0
  65. package/dist/components/placeholder/index.d.ts +3 -0
  66. package/dist/components/placeholder/index.d.ts.map +1 -0
  67. package/dist/components/placeholder/index.js +16 -0
  68. package/dist/components/placeholder/placeholder.d.ts +9 -0
  69. package/dist/components/placeholder/placeholder.d.ts.map +1 -0
  70. package/dist/components/placeholder/placeholder.js +19 -0
  71. package/dist/components/placeholder/placeholder.test.d.ts +2 -0
  72. package/dist/components/placeholder/placeholder.test.d.ts.map +1 -0
  73. package/dist/components/placeholder/placeholder.test.js +15 -0
  74. package/dist/components/shapes/index.d.ts +2 -0
  75. package/dist/components/shapes/index.d.ts.map +1 -0
  76. package/dist/components/shapes/index.js +16 -0
  77. package/dist/components/shapes/lines/index.d.ts +2 -0
  78. package/dist/components/shapes/lines/index.d.ts.map +1 -0
  79. package/dist/components/shapes/lines/index.js +16 -0
  80. package/dist/components/shapes/lines/lines-marker-labels.d.ts +3 -0
  81. package/dist/components/shapes/lines/lines-marker-labels.d.ts.map +1 -0
  82. package/dist/components/shapes/lines/lines-marker-labels.js +72 -0
  83. package/dist/components/shapes/lines/lines-overlay.d.ts +3 -0
  84. package/dist/components/shapes/lines/lines-overlay.d.ts.map +1 -0
  85. package/dist/components/shapes/lines/lines-overlay.js +52 -0
  86. package/dist/components/shapes/lines/lines-series.d.ts +3 -0
  87. package/dist/components/shapes/lines/lines-series.d.ts.map +1 -0
  88. package/dist/components/shapes/lines/lines-series.js +58 -0
  89. package/dist/components/shapes/lines/lines-tooltip.d.ts +3 -0
  90. package/dist/components/shapes/lines/lines-tooltip.d.ts.map +1 -0
  91. package/dist/components/shapes/lines/lines-tooltip.js +107 -0
  92. package/dist/components/shapes/lines/lines.d.ts +3 -0
  93. package/dist/components/shapes/lines/lines.d.ts.map +1 -0
  94. package/dist/components/shapes/lines/lines.js +28 -0
  95. package/dist/components/shapes/lines/lines.module.css +1 -0
  96. package/dist/components/shapes/lines/lines.test.d.ts +2 -0
  97. package/dist/components/shapes/lines/lines.test.d.ts.map +1 -0
  98. package/dist/components/shapes/lines/lines.test.js +142 -0
  99. package/dist/components/tooltip/index.d.ts +3 -0
  100. package/dist/components/tooltip/index.d.ts.map +1 -0
  101. package/dist/components/tooltip/index.js +16 -0
  102. package/dist/components/tooltip/tooltip.d.ts +35 -0
  103. package/dist/components/tooltip/tooltip.d.ts.map +1 -0
  104. package/dist/components/tooltip/tooltip.js +37 -0
  105. package/dist/components/tooltip/tooltip.module.css +1 -0
  106. package/dist/components/tooltip/tooltip.test.d.ts +2 -0
  107. package/dist/components/tooltip/tooltip.test.d.ts.map +1 -0
  108. package/dist/components/tooltip/tooltip.test.js +20 -0
  109. package/dist/index.d.ts +5 -0
  110. package/dist/index.d.ts.map +1 -0
  111. package/dist/index.js +19 -0
  112. package/dist/providers/cartesian.d.ts +20 -0
  113. package/dist/providers/cartesian.d.ts.map +1 -0
  114. package/dist/providers/cartesian.js +43 -0
  115. package/dist/providers/data.d.ts +11 -0
  116. package/dist/providers/data.d.ts.map +1 -0
  117. package/dist/providers/data.js +32 -0
  118. package/dist/providers/index.d.ts +6 -0
  119. package/dist/providers/index.d.ts.map +1 -0
  120. package/dist/providers/index.js +20 -0
  121. package/dist/providers/layout.d.ts +14 -0
  122. package/dist/providers/layout.d.ts.map +1 -0
  123. package/dist/providers/layout.js +34 -0
  124. package/dist/providers/style-config.d.ts +11 -0
  125. package/dist/providers/style-config.d.ts.map +1 -0
  126. package/dist/providers/style-config.js +29 -0
  127. package/dist/providers/theme.d.ts +10 -0
  128. package/dist/providers/theme.d.ts.map +1 -0
  129. package/dist/providers/theme.js +29 -0
  130. package/dist/style-config/axis.d.ts +3 -0
  131. package/dist/style-config/axis.d.ts.map +1 -0
  132. package/dist/style-config/axis.js +86 -0
  133. package/dist/style-config/cartesian.d.ts +3 -0
  134. package/dist/style-config/cartesian.d.ts.map +1 -0
  135. package/dist/style-config/cartesian.js +31 -0
  136. package/dist/style-config/colors.d.ts +9 -0
  137. package/dist/style-config/colors.d.ts.map +1 -0
  138. package/dist/style-config/colors.js +271 -0
  139. package/dist/style-config/grid.d.ts +7 -0
  140. package/dist/style-config/grid.d.ts.map +1 -0
  141. package/dist/style-config/grid.js +24 -0
  142. package/dist/style-config/headings.d.ts +3 -0
  143. package/dist/style-config/headings.d.ts.map +1 -0
  144. package/dist/style-config/headings.js +39 -0
  145. package/dist/style-config/index.d.ts +10 -0
  146. package/dist/style-config/index.d.ts.map +1 -0
  147. package/dist/style-config/index.js +24 -0
  148. package/dist/style-config/legend.d.ts +3 -0
  149. package/dist/style-config/legend.d.ts.map +1 -0
  150. package/dist/style-config/legend.js +18 -0
  151. package/dist/style-config/linear-gradient.d.ts +3 -0
  152. package/dist/style-config/linear-gradient.d.ts.map +1 -0
  153. package/dist/style-config/linear-gradient.js +20 -0
  154. package/dist/style-config/lines.d.ts +3 -0
  155. package/dist/style-config/lines.d.ts.map +1 -0
  156. package/dist/style-config/lines.js +39 -0
  157. package/dist/style-config/themes.d.ts +5 -0
  158. package/dist/style-config/themes.d.ts.map +1 -0
  159. package/dist/style-config/themes.js +86 -0
  160. package/dist/style-config/tooltip.d.ts +8 -0
  161. package/dist/style-config/tooltip.d.ts.map +1 -0
  162. package/dist/style-config/tooltip.js +56 -0
  163. package/dist/style-config/viewport.d.ts +3 -0
  164. package/dist/style-config/viewport.d.ts.map +1 -0
  165. package/dist/style-config/viewport.js +30 -0
  166. package/dist/types/axis.d.ts +108 -0
  167. package/dist/types/axis.d.ts.map +1 -0
  168. package/dist/types/axis.js +16 -0
  169. package/dist/types/cartesian.d.ts +58 -0
  170. package/dist/types/cartesian.d.ts.map +1 -0
  171. package/dist/types/cartesian.js +20 -0
  172. package/dist/types/colors.d.ts +9 -0
  173. package/dist/types/colors.d.ts.map +1 -0
  174. package/dist/types/colors.js +16 -0
  175. package/dist/types/grid.d.ts +14 -0
  176. package/dist/types/grid.d.ts.map +1 -0
  177. package/dist/types/grid.js +1 -0
  178. package/dist/types/headings.d.ts +26 -0
  179. package/dist/types/headings.d.ts.map +1 -0
  180. package/dist/types/headings.js +16 -0
  181. package/dist/types/index.d.ts +13 -0
  182. package/dist/types/index.d.ts.map +1 -0
  183. package/dist/types/index.js +27 -0
  184. package/dist/types/legend.d.ts +4 -0
  185. package/dist/types/legend.d.ts.map +1 -0
  186. package/dist/types/legend.js +16 -0
  187. package/dist/types/line-chart.d.ts +53 -0
  188. package/dist/types/line-chart.d.ts.map +1 -0
  189. package/dist/types/line-chart.js +16 -0
  190. package/dist/types/linear-gradient.d.ts +5 -0
  191. package/dist/types/linear-gradient.d.ts.map +1 -0
  192. package/dist/types/linear-gradient.js +16 -0
  193. package/dist/types/lines.d.ts +25 -0
  194. package/dist/types/lines.d.ts.map +1 -0
  195. package/dist/types/lines.js +16 -0
  196. package/dist/types/main.d.ts +11 -0
  197. package/dist/types/main.d.ts.map +1 -0
  198. package/dist/types/main.js +20 -0
  199. package/dist/types/themes.d.ts +31 -0
  200. package/dist/types/themes.d.ts.map +1 -0
  201. package/dist/types/themes.js +16 -0
  202. package/dist/types/tooltip.d.ts +23 -0
  203. package/dist/types/tooltip.d.ts.map +1 -0
  204. package/dist/types/tooltip.js +16 -0
  205. package/dist/types/viewport.d.ts +8 -0
  206. package/dist/types/viewport.d.ts.map +1 -0
  207. package/dist/types/viewport.js +16 -0
  208. package/dist/utils/axis.d.ts +60 -0
  209. package/dist/utils/axis.d.ts.map +1 -0
  210. package/dist/utils/axis.js +401 -0
  211. package/dist/utils/axis.test.d.ts +2 -0
  212. package/dist/utils/axis.test.d.ts.map +1 -0
  213. package/dist/utils/axis.test.js +1071 -0
  214. package/dist/utils/colors.d.ts +8 -0
  215. package/dist/utils/colors.d.ts.map +1 -0
  216. package/dist/utils/colors.js +33 -0
  217. package/dist/utils/colors.test.d.ts +2 -0
  218. package/dist/utils/colors.test.d.ts.map +1 -0
  219. package/dist/utils/colors.test.js +31 -0
  220. package/dist/utils/data.d.ts +14 -0
  221. package/dist/utils/data.d.ts.map +1 -0
  222. package/dist/utils/data.js +116 -0
  223. package/dist/utils/data.test.d.ts +2 -0
  224. package/dist/utils/data.test.d.ts.map +1 -0
  225. package/dist/utils/data.test.js +371 -0
  226. package/dist/utils/format.d.ts +15 -0
  227. package/dist/utils/format.d.ts.map +1 -0
  228. package/dist/utils/format.js +41 -0
  229. package/dist/utils/format.test.d.ts +2 -0
  230. package/dist/utils/format.test.d.ts.map +1 -0
  231. package/dist/utils/format.test.js +101 -0
  232. package/dist/utils/index.d.ts +8 -0
  233. package/dist/utils/index.d.ts.map +1 -0
  234. package/dist/utils/index.js +22 -0
  235. package/dist/utils/lines.d.ts +52 -0
  236. package/dist/utils/lines.d.ts.map +1 -0
  237. package/dist/utils/lines.js +190 -0
  238. package/dist/utils/lines.test.d.ts +2 -0
  239. package/dist/utils/lines.test.d.ts.map +1 -0
  240. package/dist/utils/lines.test.js +498 -0
  241. package/dist/utils/math.d.ts +13 -0
  242. package/dist/utils/math.d.ts.map +1 -0
  243. package/dist/utils/math.js +89 -0
  244. package/dist/utils/math.test.d.ts +2 -0
  245. package/dist/utils/math.test.d.ts.map +1 -0
  246. package/dist/utils/math.test.js +142 -0
  247. package/dist/utils/metadata.d.ts +6 -0
  248. package/dist/utils/metadata.d.ts.map +1 -0
  249. package/dist/utils/metadata.js +36 -0
  250. package/dist/utils/metadata.test.d.ts +2 -0
  251. package/dist/utils/metadata.test.d.ts.map +1 -0
  252. package/dist/utils/metadata.test.js +102 -0
  253. package/dist/utils/viewport.d.ts +3 -0
  254. package/dist/utils/viewport.d.ts.map +1 -0
  255. package/dist/utils/viewport.js +29 -0
  256. package/dist/utils/viewport.test.d.ts +2 -0
  257. package/dist/utils/viewport.test.d.ts.map +1 -0
  258. package/dist/utils/viewport.test.js +63 -0
  259. package/package.json +106 -0
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright 2023 Wonderflow Design Team
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { defaultStyles, useTooltipInPortal } from '@visx/tooltip';
18
+ import _ from 'lodash';
19
+ import { useMemo } from 'react';
20
+ import { v4 as uuid } from 'uuid';
21
+ import { useThemeContext } from '../../providers';
22
+ import { tooltipTheme } from '../../style-config/tooltip';
23
+ import { ContentWrapper } from './tooltip.module.css';
24
+ export const Tooltip = ({ isOpen, top = -999, left = -999, offsetTop = 15, offsetLeft = 15, children, config, }) => {
25
+ const theme = useThemeContext();
26
+ const tStyle = useMemo(() => _.merge(defaultStyles, tooltipTheme[theme], config), [theme, config]);
27
+ const { TooltipInPortal } = useTooltipInPortal({
28
+ detectBounds: true,
29
+ scroll: true,
30
+ debounce: 500,
31
+ zIndex: 10,
32
+ });
33
+ if (!isOpen)
34
+ return null;
35
+ return (_jsx(TooltipInPortal, { top: top + offsetTop, left: left + offsetLeft, style: tStyle, children: _jsx("div", { className: ContentWrapper, children: children }) }, uuid()));
36
+ };
37
+ Tooltip.displayName = 'ChartTooltip';
@@ -0,0 +1 @@
1
+ .ContentWrapper{padding:.25rem 0}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=tooltip.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.test.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render, screen } from '@testing-library/react';
3
+ import { Tooltip } from './tooltip';
4
+ global.ResizeObserver = jest.fn().mockImplementation(() => ({
5
+ observe: jest.fn(),
6
+ unobserve: jest.fn(),
7
+ disconnect: jest.fn(),
8
+ }));
9
+ describe('<Tooltip>', () => {
10
+ it('should render the component', () => {
11
+ render(_jsx(Tooltip, { isOpen: true, top: 400, left: 400 }));
12
+ const element = screen.findByTestId('tooltip');
13
+ expect(element).toBeDefined();
14
+ });
15
+ it('should NOT render the component if isOpen is false', () => {
16
+ const { container } = render(_jsx(Tooltip, {}));
17
+ const element = container.firstChild;
18
+ expect(element).toBeNull();
19
+ });
20
+ });
@@ -0,0 +1,5 @@
1
+ export * from './components';
2
+ export * from './style-config';
3
+ export * from './types';
4
+ export * from './utils';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Copyright 2022-2023 Wonderflow Design Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export * from './components';
17
+ export * from './style-config';
18
+ export * from './types';
19
+ export * from './utils';
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ import { CartesianxAxisSystem } from '../types';
3
+ export declare type CartesianContextProps = {
4
+ position: {
5
+ top: number;
6
+ right: number;
7
+ bottom: number;
8
+ left: number;
9
+ };
10
+ dimension: {
11
+ maxWidth: number;
12
+ maxHeight: number;
13
+ };
14
+ axis?: CartesianxAxisSystem;
15
+ };
16
+ export declare type CartesianProviderProps = CartesianContextProps;
17
+ export declare const CartesianContext: import("react").Context<CartesianContextProps>;
18
+ export declare const CartesianProvider: FCChildren<CartesianProviderProps>;
19
+ export declare const useCartesianContext: () => CartesianContextProps;
20
+ //# sourceMappingURL=cartesian.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cartesian.d.ts","sourceRoot":"","sources":["../../src/providers/cartesian.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,oBAAY,qBAAqB,GAAG;IAClC,QAAQ,EAAE;QACR,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,SAAS,EAAE;QACT,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,IAAI,CAAC,EAAE,oBAAoB,CAAC;CAC7B,CAAC;AAEF,oBAAY,sBAAsB,GAAG,qBAAqB,CAAA;AAgB1D,eAAO,MAAM,gBAAgB,gDAAuD,CAAC;AAErF,eAAO,MAAM,iBAAiB,EAAE,UAAU,CAAC,sBAAsB,CAYhE,CAAC;AAEF,eAAO,MAAM,mBAAmB,6BAU/B,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright 2023 Wonderflow Design Team
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { createContext, useContext } from 'react';
18
+ const defaultSetting = {
19
+ position: {
20
+ top: 0,
21
+ right: 0,
22
+ bottom: 600,
23
+ left: 800,
24
+ },
25
+ dimension: {
26
+ maxWidth: 800,
27
+ maxHeight: 600,
28
+ },
29
+ axis: undefined,
30
+ };
31
+ export const CartesianContext = createContext(defaultSetting);
32
+ export const CartesianProvider = ({ children, position, dimension, axis, }) => (_jsx(CartesianContext.Provider, { value: {
33
+ position, dimension, axis,
34
+ }, children: children }));
35
+ export const useCartesianContext = () => {
36
+ const context = useContext(CartesianContext);
37
+ if (!context) {
38
+ throw new Error('useCartesianContext hook must be used inside CartesianProvider to access context data.');
39
+ }
40
+ return context;
41
+ };
42
+ CartesianContext.displayName = 'CartesianContext';
43
+ CartesianProvider.displayName = 'CartesianProvider';
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { Data, LineChartMetadata } from '../types';
3
+ export declare type DataContextProps = {
4
+ data: Data;
5
+ metadata?: LineChartMetadata;
6
+ };
7
+ export declare type DataProviderProps = DataContextProps;
8
+ export declare const DataContext: import("react").Context<DataContextProps>;
9
+ export declare const DataProvider: FCChildren<DataProviderProps>;
10
+ export declare const useDataContext: () => DataContextProps;
11
+ //# sourceMappingURL=data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/providers/data.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAEnD,oBAAY,gBAAgB,GAAG;IAC7B,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC9B,CAAC;AAEF,oBAAY,iBAAiB,GAAG,gBAAgB,CAAA;AAOhD,eAAO,MAAM,WAAW,2CAA+C,CAAC;AAExE,eAAO,MAAM,YAAY,EAAE,UAAU,CAAC,iBAAiB,CAQtD,CAAC;AAEF,eAAO,MAAM,cAAc,wBAU1B,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright 2023 Wonderflow Design Team
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { createContext, useContext } from 'react';
18
+ const defaultData = {
19
+ data: [],
20
+ metadata: undefined,
21
+ };
22
+ export const DataContext = createContext(defaultData);
23
+ export const DataProvider = ({ children, data, metadata, }) => (_jsx(DataContext.Provider, { value: { data, metadata }, children: children }));
24
+ export const useDataContext = () => {
25
+ const context = useContext(DataContext);
26
+ if (!context) {
27
+ throw new Error('useDataContext hook must be used inside DataProvider to access context data.');
28
+ }
29
+ return context;
30
+ };
31
+ DataContext.displayName = 'DataContext';
32
+ DataProvider.displayName = 'DataProvider';
@@ -0,0 +1,6 @@
1
+ export * from './cartesian';
2
+ export * from './data';
3
+ export * from './layout';
4
+ export * from './style-config';
5
+ export * from './theme';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAgBA,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Copyright 2023 Wonderflow Design Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export * from './cartesian';
17
+ export * from './data';
18
+ export * from './layout';
19
+ export * from './style-config';
20
+ export * from './theme';
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { CartesianChartLayout } from '../types';
3
+ export declare type LayoutContextProps = CartesianChartLayout;
4
+ export declare type LayoutProviderProps = {
5
+ layout: LayoutContextProps;
6
+ };
7
+ export declare const LayoutContext: import("react").Context<CartesianChartLayout>;
8
+ export declare const LayoutProvider: FCChildren<LayoutProviderProps>;
9
+ export declare const useLayoutContext: () => {
10
+ context: CartesianChartLayout;
11
+ isHorizontal: boolean;
12
+ isVertical: boolean;
13
+ };
14
+ //# sourceMappingURL=layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/providers/layout.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,oBAAY,kBAAkB,GAAG,oBAAoB,CAAC;AAEtD,oBAAY,mBAAmB,GAAG;IAChC,MAAM,EAAE,kBAAkB,CAAC;CAC5B,CAAA;AAID,eAAO,MAAM,aAAa,+CAAmD,CAAC;AAE9E,eAAO,MAAM,cAAc,EAAE,UAAU,CAAC,mBAAmB,CAO1D,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;CAc5B,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright 2023 Wonderflow Design Team
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { createContext, useContext } from 'react';
18
+ import { CartesianChartLayout } from '../types';
19
+ const defaultLayout = CartesianChartLayout.HORIZONTAL;
20
+ export const LayoutContext = createContext(defaultLayout);
21
+ export const LayoutProvider = ({ children, layout, }) => (_jsx(LayoutContext.Provider, { value: layout, children: children }));
22
+ export const useLayoutContext = () => {
23
+ const context = useContext(LayoutContext);
24
+ if (!context) {
25
+ throw new Error('useLayoutContext hook must be used inside LayoutProvider to access context data.');
26
+ }
27
+ return {
28
+ context,
29
+ isHorizontal: context === CartesianChartLayout.HORIZONTAL,
30
+ isVertical: context === CartesianChartLayout.VERTICAL,
31
+ };
32
+ };
33
+ LayoutContext.displayName = 'LayoutContext';
34
+ LayoutProvider.displayName = 'LayoutProvider';
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { CartesianStyleConfig } from '../types';
3
+ export declare type StyleConfigContextProps = CartesianStyleConfig;
4
+ export declare type StyleConfigProviderProps = {
5
+ styleConfig: CartesianStyleConfig;
6
+ children?: React.ReactNode;
7
+ };
8
+ export declare const StyleConfigContext: import("react").Context<CartesianStyleConfig>;
9
+ export declare const StyleConfigProvider: FCChildren<StyleConfigProviderProps>;
10
+ export declare const useStyleConfigContext: () => CartesianStyleConfig;
11
+ //# sourceMappingURL=style-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style-config.d.ts","sourceRoot":"","sources":["../../src/providers/style-config.tsx"],"names":[],"mappings":";AAqBA,OAAO,EACL,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAElB,oBAAY,uBAAuB,GAAG,oBAAoB,CAAC;AAE3D,oBAAY,wBAAwB,GAAG;IACrC,WAAW,EAAE,oBAAoB,CAAC;IAClC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAA;AAED,eAAO,MAAM,kBAAkB,+CAA+D,CAAC;AAE/F,eAAO,MAAM,mBAAmB,EAAE,UAAU,CAAC,wBAAwB,CAOpE,CAAC;AAEF,eAAO,MAAM,qBAAqB,4BAUjC,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright 2023 Wonderflow Design Team
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { createContext, useContext } from 'react';
18
+ import { cartesianStyleConfig, } from '../style-config';
19
+ export const StyleConfigContext = createContext(cartesianStyleConfig);
20
+ export const StyleConfigProvider = ({ styleConfig, children, }) => (_jsx(StyleConfigContext.Provider, { value: styleConfig, children: children }));
21
+ export const useStyleConfigContext = () => {
22
+ const context = useContext(StyleConfigContext);
23
+ if (!context) {
24
+ throw new Error('useStyleConfigContext hook must be used inside StyleConfigProvider to access context data.');
25
+ }
26
+ return context;
27
+ };
28
+ StyleConfigContext.displayName = 'StyleConfigContext';
29
+ StyleConfigProvider.displayName = 'StyleConfigProvider';
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { ThemeVariants } from '../types';
3
+ export declare type ThemeContextProps = ThemeVariants;
4
+ export declare type ThemeProviderProps = {
5
+ theme: ThemeContextProps;
6
+ };
7
+ export declare const ThemeContext: import("react").Context<ThemeVariants>;
8
+ export declare const ThemeProvider: FCChildren<ThemeProviderProps>;
9
+ export declare const useThemeContext: () => ThemeVariants;
10
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/providers/theme.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,oBAAY,iBAAiB,GAAG,aAAa,CAAC;AAE9C,oBAAY,kBAAkB,GAAG;IAC/B,KAAK,EAAE,iBAAiB,CAAC;CAC1B,CAAA;AAID,eAAO,MAAM,YAAY,wCAAiD,CAAC;AAE3E,eAAO,MAAM,aAAa,EAAE,UAAU,CAAC,kBAAkB,CAOxD,CAAC;AAEF,eAAO,MAAM,eAAe,qBAU3B,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright 2023 Wonderflow Design Team
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { createContext, useContext } from 'react';
18
+ const defaultTheme = 'light';
19
+ export const ThemeContext = createContext(defaultTheme);
20
+ export const ThemeProvider = ({ children, theme, }) => (_jsx(ThemeContext.Provider, { value: theme, children: children }));
21
+ export const useThemeContext = () => {
22
+ const context = useContext(ThemeContext);
23
+ if (!context) {
24
+ throw new Error('useThemeContext hook must be used inside ThemeProvider to access context data.');
25
+ }
26
+ return context;
27
+ };
28
+ ThemeContext.displayName = 'ThemeContext';
29
+ ThemeProvider.displayName = 'ThemeProvider';
@@ -0,0 +1,3 @@
1
+ import { AxisElementsStyleConfig } from '../types/axis';
2
+ export declare const axisStyleConfig: AxisElementsStyleConfig;
3
+ //# sourceMappingURL=axis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axis.d.ts","sourceRoot":"","sources":["../../src/style-config/axis.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,eAAO,MAAM,eAAe,EAAE,uBAsE7B,CAAC"}
@@ -0,0 +1,86 @@
1
+ /*
2
+ * Copyright 2023 Wonderflow Design Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export const axisStyleConfig = {
17
+ formatting: {
18
+ maxCharactersLength: 20,
19
+ omission: '...',
20
+ },
21
+ labelProps: {
22
+ fontFamily: 'system-ui, sans-serif',
23
+ fontSize: 12,
24
+ fontWeight: 600,
25
+ textAnchor: 'middle',
26
+ },
27
+ tickLabelProps: {
28
+ fontFamily: 'system-ui, sans-serif',
29
+ fontSize: 14,
30
+ fontWeight: 400,
31
+ },
32
+ tickLineProps: {
33
+ length: 4,
34
+ strokeWidth: 1,
35
+ strokeLinecap: 'round',
36
+ },
37
+ axisLineProps: {
38
+ strokeWidth: 1,
39
+ strokeDasharray: '',
40
+ },
41
+ spacing: {
42
+ labelCharExtimatedWidth: 8,
43
+ labelHeight: 14,
44
+ labelOffset: 16,
45
+ tickLabelHeight: 16,
46
+ tickLength: 4,
47
+ },
48
+ top: {
49
+ tickLabelProps: {
50
+ dy: -12,
51
+ dominantBaseline: 'auto',
52
+ },
53
+ labelProps: {
54
+ dominantBaseline: 'auto',
55
+ },
56
+ },
57
+ right: {
58
+ tickLabelProps: {
59
+ dx: 4,
60
+ textAnchor: 'start',
61
+ dominantBaseline: 'middle',
62
+ },
63
+ labelProps: {
64
+ dominantBaseline: 'auto',
65
+ },
66
+ },
67
+ bottom: {
68
+ tickLabelProps: {
69
+ dy: 4,
70
+ dominantBaseline: 'auto',
71
+ },
72
+ labelProps: {
73
+ dominantBaseline: 'auto',
74
+ },
75
+ },
76
+ left: {
77
+ tickLabelProps: {
78
+ dx: -4,
79
+ textAnchor: 'end',
80
+ dominantBaseline: 'middle',
81
+ },
82
+ labelProps: {
83
+ dominantBaseline: 'auto',
84
+ },
85
+ },
86
+ };
@@ -0,0 +1,3 @@
1
+ import { CartesianStyleConfig } from '../types/cartesian';
2
+ export declare const cartesianStyleConfig: CartesianStyleConfig;
3
+ //# sourceMappingURL=cartesian.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cartesian.d.ts","sourceRoot":"","sources":["../../src/style-config/cartesian.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAS1D,eAAO,MAAM,oBAAoB,EAAE,oBAQlC,CAAC"}
@@ -0,0 +1,31 @@
1
+ /*
2
+ * Copyright 2023 Wonderflow Design Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { axisStyleConfig } from './axis';
17
+ import { gridStyleConfig } from './grid';
18
+ import { headingsStyleConfig } from './headings';
19
+ import { legendStyleConfig } from './legend';
20
+ import { linesStyleConfig } from './lines';
21
+ import { themes } from './themes';
22
+ import { viewportStyleConfig } from './viewport';
23
+ export const cartesianStyleConfig = {
24
+ headings: headingsStyleConfig,
25
+ grid: gridStyleConfig,
26
+ axis: axisStyleConfig,
27
+ legend: legendStyleConfig,
28
+ lines: linesStyleConfig,
29
+ viewport: viewportStyleConfig,
30
+ themes,
31
+ };
@@ -0,0 +1,9 @@
1
+ import { Colors, KpisColorsNames, NeutralsColorNames, ThemeVariants } from '../types';
2
+ export declare const colors: Colors;
3
+ export declare const colorPaletteKpis: Record<KpisColorsNames, string>;
4
+ export declare const colorPaletteNeutrals: Record<NeutralsColorNames, string>;
5
+ export declare const defaultLineChartPalette: Record<ThemeVariants, {
6
+ overlay: string;
7
+ series: string[];
8
+ }>;
9
+ //# sourceMappingURL=colors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/style-config/colors.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,MAAM,EAAE,eAAe,EAAE,kBAAkB,EAAE,aAAa,EAC3D,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,MAAM,EAAE,MA4LpB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAgB5D,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAanE,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,aAAa,EAAE;IAC1D,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAmCA,CAAC"}