@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 @@
1
+ {"version":3,"file":"headings.d.ts","sourceRoot":"","sources":["../../../src/components/headings/headings.tsx"],"names":[],"mappings":";AAsBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,oBAAY,aAAa,GAAG;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC,mBAAmB,CAAC,CAAC;CAC3C,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAmD5C,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } 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 { Group } from '@visx/group';
18
+ import { Text } from '@visx/text';
19
+ import _ from 'lodash';
20
+ import { useMemo } from 'react';
21
+ import { useStyleConfigContext, useThemeContext } from '../../providers';
22
+ export const Headings = ({ title, subtitle, top = 0, left = 0, config, }) => {
23
+ const theme = useThemeContext();
24
+ const { headings, themes } = useStyleConfigContext();
25
+ const mergeStyle = useMemo(() => (_.merge(headings, config)), [headings, config]);
26
+ const { title: t, subtitle: s } = mergeStyle;
27
+ if (!title)
28
+ return null;
29
+ return (_jsxs(Group, { top: top, left: left, children: [_jsx(Text, { "data-testid": "headings", fontFamily: mergeStyle.fontFamily, fill: themes[theme].headings.title, fontSize: t.fontSize, fontWeight: t.fontWeight, lineHeight: t.lineHeight, textAnchor: t.textAnchor, verticalAnchor: t.verticalAnchor, x: t.x, y: t.y, dy: 4, children: title }), _jsx(Text, { fontFamily: mergeStyle.fontFamily, fill: themes[theme].headings.subtitle, fontSize: s.fontSize, fontWeight: s.fontWeight, lineHeight: s.lineHeight, textAnchor: s.textAnchor, verticalAnchor: s.verticalAnchor, x: s.x, y: s.y, dy: 4, children: subtitle })] }));
30
+ };
31
+ Headings.displayName = 'ChartHeadings';
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=headings.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headings.test.d.ts","sourceRoot":"","sources":["../../../src/components/headings/headings.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render, screen } from '@testing-library/react';
3
+ import { Headings } from './headings';
4
+ describe('<Headings>', () => {
5
+ it('should render the component', () => {
6
+ render(_jsx(Headings, { title: "Title" }));
7
+ const element = screen.getByTestId('headings');
8
+ expect(element).toBeDefined();
9
+ });
10
+ it('should NOT render the component w/o title', () => {
11
+ const { container } = render(_jsx(Headings, {}));
12
+ expect(container.firstChild).toBeNull();
13
+ });
14
+ });
@@ -0,0 +1,3 @@
1
+ export type { HeadingsProps } from './headings';
2
+ export { Headings } from './headings';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/headings/index.ts"],"names":[],"mappings":"AAgBA,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,16 @@
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 { Headings } from './headings';
@@ -0,0 +1,7 @@
1
+ export * from './cartesian-base';
2
+ export * from './headings';
3
+ export * from './line-chart';
4
+ export * from './loader';
5
+ export * from './shapes';
6
+ export * from './tooltip';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAgBA,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}
@@ -0,0 +1,21 @@
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 './cartesian-base';
17
+ export * from './headings';
18
+ export * from './line-chart';
19
+ export * from './loader';
20
+ export * from './shapes';
21
+ export * from './tooltip';
@@ -0,0 +1,3 @@
1
+ export type { LineChartProps } from './line-chart';
2
+ export { LineChart } from './line-chart';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/line-chart/index.ts"],"names":[],"mappings":"AAgBA,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,16 @@
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 { LineChart } from './line-chart';
@@ -0,0 +1,57 @@
1
+ /// <reference types="react" />
2
+ import { Except } from 'type-fest';
3
+ import { CartesianChartLayout, Data, ThemeVariants } from '../../types';
4
+ import { LineChartIndex, LineChartOverlay, LineChartRenderType, LineChartSeries, LineChartTooltip } from '../../types/line-chart';
5
+ import { CartesianBaseProps } from '../cartesian-base/cartesian-base';
6
+ export declare type LineChartProps = {
7
+ /**
8
+ * Set the theme of the chart. This is set to `light` by default.
9
+ */
10
+ theme?: ThemeVariants;
11
+ /**
12
+ * Set the layout of the chart. `Index`, `Series` and eventually `Overlay` will be automatically rearranged.
13
+ */
14
+ layout?: CartesianChartLayout;
15
+ /**
16
+ * Set the data structure that will be used to render the chart.
17
+ */
18
+ data: Data;
19
+ /**
20
+ * Set the type of render function used to draw any chart line.
21
+ */
22
+ renderAs?: LineChartRenderType;
23
+ /**
24
+ * Set the properties associated with the Index Axis.
25
+ */
26
+ index: LineChartIndex;
27
+ /**
28
+ * Set the properties associated with any Series of lines.
29
+ */
30
+ series: LineChartSeries;
31
+ /**
32
+ * Set the properties associated with the Overlay Axis.
33
+ */
34
+ overlay?: LineChartOverlay;
35
+ /**
36
+ * Set extra data or custom content to be displayed in the tooltip.
37
+ */
38
+ tooltip?: LineChartTooltip;
39
+ /**
40
+ * Prevent showing a connecting line between points when data is missing.
41
+ */
42
+ hideMissingDataConnection?: boolean;
43
+ /**
44
+ * Show a marker for every single data point.
45
+ */
46
+ showMarker?: boolean;
47
+ /**
48
+ * Show a label and a marker for every single data point.
49
+ */
50
+ showMarkerLabel?: boolean;
51
+ /**
52
+ * Remove the padding from the chart container.
53
+ */
54
+ hidePadding?: boolean;
55
+ } & Except<CartesianBaseProps, 'axis'>;
56
+ export declare const LineChart: React.FC<LineChartProps>;
57
+ //# sourceMappingURL=line-chart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"line-chart.d.ts","sourceRoot":"","sources":["../../../src/components/line-chart/line-chart.tsx"],"names":[],"mappings":";AAiBA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAOnC,OAAO,EACL,oBAAoB,EAAU,IAAI,EAAe,aAAa,EAC/D,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EAAqB,gBAAgB,EAAE,mBAAmB,EAAE,eAAe,EAAE,gBAAgB,EAC5G,MAAM,wBAAwB,CAAC;AAShC,OAAO,EAAiB,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAErF,oBAAY,cAAc,GAAG;IAC3B;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;IACX;;OAEG;IACH,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B;;OAEG;IACH,KAAK,EAAE,cAAc,CAAC;IACtB;;OAEG;IACH,MAAM,EAAE,eAAe,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B;;OAEG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B;;OAEG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAA;AAEtC,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CA+E9C,CAAC"}
@@ -0,0 +1,68 @@
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 { useMemo } from 'react';
18
+ import { DataProvider, LayoutProvider, ThemeProvider, } from '../../providers';
19
+ import { defaultLineChartPalette } from '../../style-config';
20
+ import { CartesianChartLayout, Charts, } from '../../types';
21
+ import { handleChartAxisLayout, handleChartDomainAndScaleType, handleOverlayColor, handleOverlayName, handleSeriesColors, handleSeriesNames, } from '../../utils';
22
+ import { CartesianBase } from '../cartesian-base/cartesian-base';
23
+ export const LineChart = ({ theme = 'light', layout = CartesianChartLayout.HORIZONTAL, renderAs = 'curves', data = [], index, series, overlay, tooltip, hideMissingDataConnection = false, showMarker = false, showMarkerLabel = false, hidePadding = false, ...otherProps }) => {
24
+ const isHorizontal = layout === CartesianChartLayout.HORIZONTAL;
25
+ const { index: i, series: s, overlay: o } = useMemo(() => handleChartDomainAndScaleType(data, index, series, overlay), [data, index, overlay, series]);
26
+ const axis = useMemo(() => handleChartAxisLayout(i, s, o), [i, s, o]);
27
+ const palette = useMemo(() => defaultLineChartPalette[theme], [theme]);
28
+ const zeroPadding = hidePadding ? {
29
+ top: 0, right: 12, bottom: 0, left: 0,
30
+ } : undefined;
31
+ const metadata = useMemo(() => ({
32
+ type: Charts.LINE_CHART,
33
+ renderAs,
34
+ index: index.dataKey,
35
+ series: {
36
+ dataKey: series.dataKey,
37
+ names: handleSeriesNames(series),
38
+ colors: handleSeriesColors(series, palette.series),
39
+ style: series.style,
40
+ },
41
+ overlay: {
42
+ dataKey: overlay?.dataKey,
43
+ name: handleOverlayName(overlay),
44
+ color: handleOverlayColor(overlay, palette.overlay),
45
+ style: overlay?.style,
46
+ },
47
+ tooltip,
48
+ hideMissingDataConnection,
49
+ showMarker,
50
+ showMarkerLabel,
51
+ hidePadding,
52
+ }), [renderAs,
53
+ index.dataKey,
54
+ series,
55
+ palette.series,
56
+ palette.overlay,
57
+ overlay,
58
+ tooltip,
59
+ hideMissingDataConnection,
60
+ showMarker,
61
+ showMarkerLabel,
62
+ hidePadding]);
63
+ return (_jsx(ThemeProvider, { theme: theme, children: _jsx(LayoutProvider, { layout: layout, children: _jsx(DataProvider, { data: data, metadata: metadata, children: _jsx(CartesianBase, { axis: axis[layout], grid: {
64
+ hideRows: !isHorizontal,
65
+ hideColumns: isHorizontal,
66
+ }, margin: zeroPadding, ...otherProps }) }) }) }));
67
+ };
68
+ LineChart.displayName = 'LineChart';
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=line-chart.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"line-chart.test.d.ts","sourceRoot":"","sources":["../../../src/components/line-chart/line-chart.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 { LineChart } from './line-chart';
4
+ global.ResizeObserver = jest.fn().mockImplementation(() => ({
5
+ observe: jest.fn(),
6
+ unobserve: jest.fn(),
7
+ disconnect: jest.fn(),
8
+ }));
9
+ describe('<LineChart>', () => {
10
+ it('should render the component', () => {
11
+ render(_jsx(LineChart, { data: [{ date: 'a', value: 1 }, { date: 'b', value: 2 }], index: { dataKey: 'date' }, series: { dataKey: ['value'] }, overlay: { dataKey: 'value' }, title: "Title" }));
12
+ const element = screen.getByTestId('cartesian');
13
+ expect(element).toBeDefined();
14
+ });
15
+ it('should render the component w/o padding', () => {
16
+ render(_jsx(LineChart, { data: [{ date: 'a', value: 1 }, { date: 'b', value: 2 }], index: { dataKey: 'date' }, series: { dataKey: ['value'] }, overlay: { dataKey: 'value' }, hidePadding: true, hideLegend: true }));
17
+ const element = screen.getByTestId('cartesian');
18
+ expect(element).toBeDefined();
19
+ });
20
+ });
@@ -0,0 +1,11 @@
1
+ import { SVGAttributes } from 'react';
2
+ export declare type BarChartLoaderProps = {
3
+ width?: number;
4
+ height?: number;
5
+ otherProps?: SVGAttributes<SVGElement | SVGSVGElement>;
6
+ };
7
+ export declare const BarChartLoader: {
8
+ ({ width, height, otherProps, }: BarChartLoaderProps): JSX.Element;
9
+ displayName: string;
10
+ };
11
+ //# sourceMappingURL=bar-chart-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bar-chart-loader.d.ts","sourceRoot":"","sources":["../../../src/components/loader/bar-chart-loader.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,oBAAY,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,aAAa,CAAC,UAAU,GAAG,aAAa,CAAC,CAAC;CACxD,CAAA;AAED,eAAO,MAAM,cAAc;qCAIxB,mBAAmB;;CA2BrB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export const BarChartLoader = ({ width = 800, height = 600, otherProps, }) => (_jsx("svg", { version: "1.1", id: "Line-Chart-Loader", xmlns: "http:www.w3.org/2000/svg", viewBox: `0 0 ${width} ${height}`, "data-testid": "bar-chart-loader", ...otherProps, children: _jsx("g", { transform: `matrix(${width / 848},0,0,${height / (160 * 3)},0,0)`, children: _jsx("g", { transform: `translate(0 ${height / 3})`, children: _jsxs("g", { children: [_jsx("rect", { fill: "#454545", width: "10", height: "100", rx: "4", transform: "translate(0) rotate(180 5 50)", children: _jsx("animate", { attributeName: "height", dur: "1.1s", values: "30; 100; 30", repeatCount: "indefinite" }) }), _jsx("rect", { x: "17", fill: "#454545", width: "10", height: "100", rx: "4", transform: "translate(3) rotate(180 20 50)", children: _jsx("animate", { attributeName: "height", dur: "1.25s", values: "30; 100; 30", repeatCount: "indefinite", begin: "0.1s" }) }), _jsx("rect", { x: "40", fill: "#454545", width: "10", height: "100", rx: "4", transform: "translate(6) rotate(180 38 50)", children: _jsx("animate", { attributeName: "height", dur: "1.15s", values: "30; 100; 30", repeatCount: "indefinite", begin: "0.3s" }) }), _jsx("rect", { x: "60", fill: "#454545", width: "10", height: "100", rx: "4", transform: "translate(9) rotate(180 55 50)", children: _jsx("animate", { attributeName: "height", dur: "1.25s", values: "30; 100; 30", repeatCount: "indefinite", begin: "0.5s" }) }), _jsx("rect", { x: "80", fill: "#454545", width: "10", height: "100", rx: "4", transform: "translate(12) rotate(180 72 50)", children: _jsx("animate", { attributeName: "height", dur: "1.0s", values: "30; 100; 30", repeatCount: "indefinite", begin: "0.1s" }) })] }) }) }) }));
3
+ BarChartLoader.displayName = 'BarChartLoader';
@@ -0,0 +1,2 @@
1
+ export * from './loader';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/loader/index.ts"],"names":[],"mappings":"AAgBA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,16 @@
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 './loader';
@@ -0,0 +1,11 @@
1
+ import { SVGAttributes } from 'react';
2
+ export declare type LineChartLoaderProps = {
3
+ width?: number;
4
+ height?: number;
5
+ otherProps?: SVGAttributes<SVGElement | SVGSVGElement>;
6
+ };
7
+ export declare const LineChartLoader: {
8
+ ({ width, height, otherProps, }: LineChartLoaderProps): JSX.Element;
9
+ displayName: string;
10
+ };
11
+ //# sourceMappingURL=line-chart-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"line-chart-loader.d.ts","sourceRoot":"","sources":["../../../src/components/loader/line-chart-loader.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,oBAAY,oBAAoB,GAAG;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,aAAa,CAAC,UAAU,GAAG,aAAa,CAAC,CAAC;CACxD,CAAA;AAED,eAAO,MAAM,eAAe;qCAIzB,oBAAoB;;CAmEtB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export const LineChartLoader = ({ width = 800, height = 600, otherProps, }) => (_jsx("svg", { version: "1.1", id: "Line-Chart-Loader", xmlns: "http:www.w3.org/2000/svg", viewBox: `0 0 ${width} ${height}`, "data-testid": "line-chart-loader", ...otherProps, children: _jsx("g", { transform: `matrix(${width / 850},0,0,${height / 480},0,0)`, children: _jsxs("g", { transform: `translate(0 ${height / 3})`, children: [_jsx("path", { stroke: "slateGray", strokeWidth: "2", strokeLinecap: "round", fill: "none", opacity: "0.25", style: { filter: 'blur(4px)' }, children: _jsx("animate", { id: "animation-to-check", repeatCount: "indefinite", fill: "freeze", attributeName: "d", values: "M 0.00 23.11 S 141.33 145.08 282.67 78.36 424.00 79.81 565.33 131.93 706.67 136.78 848.00 22.27;\n M 0.00 70.45 S 141.33 162.69 282.67 96.34 424.00 208.94 565.33 143.47 706.67 190.44 848.00 37.12;\n M 0.00 8.81 S 141.33 52.29 282.67 16.75 424.00 186.90 565.33 38.83 706.67 198.72 848.00 86.75;\n M 0.00 50.76 S 141.33 140.50 282.67 195.50 424.00 131.19 565.33 81.52 706.67 165.20 848.00 144.93;\n M 0.00 143.93 S 141.33 117.47 282.67 74.91 424.00 91.48 565.33 97.48 706.67 0.38 848.00 84.98;\n M 0.00 145.06 S 141.33 89.44 282.67 211.80 424.00 169.36 565.33 161.16 706.67 87.35 848.00 153.68;\n M 0.00 23.11 S 141.33 145.08 282.67 78.36 424.00 79.81 565.33 131.93 706.67 136.78 848.00 22.27;", dur: "20s", keySplines: " 0.1 0.8 0.2 1; 0.1 0.7 0.3 1; 0.1 0.8 0.2 1; 0.1 0.6 0.2 1; 0.1 0.9 0.3 1; 0.1 0.8 0.2 1", keyTimes: " 0; 0.11; 0.31; 0.51; 0.61; 0.81; 1", calcMode: "spline" }) }), _jsx("path", { stroke: "slateGray", strokeWidth: "2", strokeLinecap: "round", fill: "none", opacity: "0.5", style: { filter: 'blur(1px)' }, children: _jsx("animate", { id: "animation-to-check", repeatCount: "indefinite", fill: "freeze", attributeName: "d", values: "M 0.00 140.35 S 106.00 21.23 212.00 36.97 318.00 166.91 424.00 35.35 530.00 0.94 636.00 30.27 742.00 44.27 848.00 161.16;\n M 0.00 47.10 S 106.00 22.99 212.00 43.71 318.00 141.87 424.00 136.20 530.00 79.36 636.00 51.42 742.00 158.07 848.00 214.18;\n M 0.00 196.44 S 106.00 90.57 212.00 27.36 318.00 200.04 424.00 117.20 530.00 143.58 636.00 184.60 742.00 149.63 848.00 170.34;\n M 0.00 4.32 S 106.00 78.52 212.00 117.52 318.00 128.90 424.00 108.19 530.00 137.21 636.00 129.57 742.00 75.91 848.00 2.85;\n M 0.00 125.58 S 106.00 9.06 212.00 9.50 318.00 152.78 424.00 103.22 530.00 40.77 636.00 48.34 742.00 142.04 848.00 27.54;\n M 0.00 174.05 S 106.00 84.41 212.00 21.07 318.00 40.66 424.00 169.71 530.00 204.73 636.00 142.72 742.00 115.59 848.00 139.64;\n M 0.00 140.35 S 106.00 21.23 212.00 36.97 318.00 166.91 424.00 35.35 530.00 0.94 636.00 30.27 742.00 44.27 848.00 161.16;", dur: "20s", keySplines: " 0.1 0.8 0.2 1; 0.1 0.7 0.3 1; 0.1 0.8 0.2 1; 0.1 0.6 0.2 1; 0.1 0.9 0.3 1; 0.1 0.8 0.2 1", keyTimes: " 0; 0.11; 0.31; 0.51; 0.61; 0.81; 1", calcMode: "spline" }) }), _jsx("path", { stroke: "slateGray", strokeWidth: "3", strokeLinecap: "round", fill: "none", opacity: "0.85", children: _jsx("animate", { id: "animation-to-check", repeatCount: "indefinite", fill: "freeze", attributeName: "d", values: "M 0.00 158.43 S 70.67 80.68 141.33 140.46 212.00 26.02 282.67 172.46 353.33 94.96 424.00 80.73 494.67 184.51 565.33 22.53 636.00 180.46 706.67 163.18 777.33 131.47 848.00 121.13;\n M 0.00 67.96 S 70.67 206.71 141.33 102.49 212.00 24.74 282.67 168.58 353.33 98.95 424.00 32.61 494.67 212.75 565.33 208.46 636.00 150.15 706.67 157.76 777.33 60.82 848.00 73.79;\n M 0.00 114.15 S 70.67 46.37 141.33 164.14 212.00 104.24 282.67 96.06 353.33 189.11 424.00 156.49 494.67 153.64 565.33 176.73 636.00 149.73 706.67 86.67 777.33 16.49 848.00 101.95;\n M 0.00 120.25 S 70.67 112.62 141.33 9.70 212.00 180.98 282.67 194.29 353.33 176.21 424.00 150.37 494.67 211.59 565.33 19.30 636.00 188.88 706.67 88.40 777.33 58.85 848.00 96.13;\n M 0.00 28.96 S 70.67 200.92 141.33 27.90 212.00 63.87 282.67 99.99 353.33 20.86 424.00 110.84 494.67 11.48 565.33 202.32 636.00 90.08 706.67 88.33 777.33 175.65 848.00 81.52;\n M 0.00 76.74 S 70.67 60.90 141.33 198.49 212.00 171.39 282.67 32.42 353.33 161.88 424.00 116.87 494.67 69.69 565.33 137.11 636.00 39.73 706.67 211.02 777.33 201.82 848.00 114.20;\n M 0.00 158.43 S 70.67 80.68 141.33 140.46 212.00 26.02 282.67 172.46 353.33 94.96 424.00 80.73 494.67 184.51 565.33 22.53 636.00 180.46 706.67 163.18 777.33 131.47 848.00 121.13;", dur: "20s", keySplines: "0.1 0.8 0.2 1; 0.1 0.7 0.3 1; 0.1 0.8 0.2 1; 0.1 0.6 0.2 1; 0.1 0.9 0.3 1; 0.1 0.8 0.2 1", keyTimes: " 0; 0.11; 0.31; 0.51; 0.61; 0.81; 1", calcMode: "spline" }) })] }) }) }));
3
+ LineChartLoader.displayName = 'LineChartLoader';
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ export declare type LoaderProp = {
3
+ isLoading?: boolean;
4
+ left?: number;
5
+ top?: number;
6
+ width?: number;
7
+ height?: number;
8
+ };
9
+ export declare const Loader: ({ isLoading, left, top, width, height, }: LoaderProp) => JSX.Element | null;
10
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/components/loader/loader.tsx"],"names":[],"mappings":";AA0BA,oBAAY,UAAU,GAAG;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAA;AAED,eAAO,MAAM,MAAM,6CAMhB,UAAU,uBAgCZ,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright 2022-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 { RectClipPath } from '@visx/clip-path';
18
+ import { LinearGradient } from '@visx/gradient';
19
+ import { Group } from '@visx/group';
20
+ import { useDataContext, useThemeContext } from '../../providers';
21
+ import { themes } from '../../style-config';
22
+ import { Charts } from '../../types';
23
+ import { BarChartLoader } from './bar-chart-loader';
24
+ import { LineChartLoader } from './line-chart-loader';
25
+ export const Loader = ({ isLoading = false, left = 0, top = 0, width = 800, height = 600, }) => {
26
+ const theme = useThemeContext();
27
+ const { metadata } = useDataContext();
28
+ const { from, to } = themes[theme].grid.background;
29
+ const isLineChart = metadata?.type === Charts.LINE_CHART;
30
+ const isBarChart = metadata?.type === Charts.BAR_CHART;
31
+ const rightExtraPadding = metadata?.hidePadding ? 12 : 0;
32
+ if (!isLoading)
33
+ return null;
34
+ return (_jsxs(Group, { children: [_jsx(RectClipPath, { id: "clip-path-loader", x: left, y: top, width: width + rightExtraPadding, height: height }), _jsx(LinearGradient, { id: "loader-gradient", from: to, to: from }), _jsxs(Group, { clipPath: "url(#clip-path-loader)", children: [_jsx("rect", { "data-testid": "loader", x: left, y: top, width: width + rightExtraPadding, height: height, fill: "url(#loader-gradient)" }), isLineChart && (_jsx(LineChartLoader, { width: width, height: height })), isBarChart && (_jsx(BarChartLoader, {}))] })] }));
35
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=loader.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.test.d.ts","sourceRoot":"","sources":["../../../src/components/loader/loader.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,50 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render, screen } from '@testing-library/react';
3
+ import { DataProvider } from '../../providers';
4
+ import { Charts } from '../../types';
5
+ import { BarChartLoader } from './bar-chart-loader';
6
+ import { LineChartLoader } from './line-chart-loader';
7
+ import { Loader } from './loader';
8
+ const mockMetadata = {
9
+ type: Charts.LINE_CHART,
10
+ index: 'test',
11
+ series: {
12
+ dataKey: ['a', 'b'],
13
+ names: ['A', 'B'],
14
+ colors: ['ca', 'cb'],
15
+ },
16
+ overlay: {
17
+ name: '',
18
+ color: '',
19
+ },
20
+ hidePadding: true,
21
+ };
22
+ describe('<Loader>', () => {
23
+ it('should render the component', () => {
24
+ render(_jsx(Loader, { isLoading: true }));
25
+ const element = screen.getByTestId('loader');
26
+ expect(element).toBeDefined();
27
+ });
28
+ it('should NOT render the component w/o title', () => {
29
+ const { container } = render(_jsx(Loader, {}));
30
+ expect(container.firstChild).toBeNull();
31
+ });
32
+ it('should render w context', () => {
33
+ const { container } = render(_jsx(DataProvider, { data: [{}, {}], metadata: mockMetadata, children: _jsx(Loader, {}) }));
34
+ expect(container.firstChild).toBeNull();
35
+ });
36
+ });
37
+ describe('<LineChartLoader>', () => {
38
+ it('should render the component', () => {
39
+ render(_jsx(LineChartLoader, {}));
40
+ const element = screen.getByTestId('line-chart-loader');
41
+ expect(element).toBeDefined();
42
+ });
43
+ });
44
+ describe('<BarChartLoader>', () => {
45
+ it('should render the component', () => {
46
+ render(_jsx(BarChartLoader, {}));
47
+ const element = screen.getByTestId('bar-chart-loader');
48
+ expect(element).toBeDefined();
49
+ });
50
+ });
@@ -0,0 +1,3 @@
1
+ export type { PlaceholderProps } from './placeholder';
2
+ export { Placeholder } from './placeholder';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/placeholder/index.tsx"],"names":[],"mappings":"AAgBA,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,16 @@
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 { Placeholder } from './placeholder';
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ export declare type PlaceholderProps = {
3
+ /**
4
+ * Set the color fill for the component.
5
+ */
6
+ color?: string;
7
+ };
8
+ export declare const Placeholder: React.FC<PlaceholderProps>;
9
+ //# sourceMappingURL=placeholder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placeholder.d.ts","sourceRoot":"","sources":["../../../src/components/placeholder/placeholder.tsx"],"names":[],"mappings":";AAkBA,oBAAY,gBAAgB,GAAG;IAC7B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAclD,CAAC"}
@@ -0,0 +1,19 @@
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 { colorPaletteNeutrals } from '../../style-config';
18
+ export const Placeholder = ({ color = colorPaletteNeutrals.dimmed5, }) => (_jsx("svg", { width: 12, height: 12, "data-testid": "placeholder", children: _jsx("rect", { x: 0, y: 0, width: 12, height: 12, rx: 2, ry: 2, fill: color }) }));
19
+ Placeholder.displayName = 'Placeholder';
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=placeholder.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placeholder.test.d.ts","sourceRoot":"","sources":["../../../src/components/placeholder/placeholder.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render, screen } from '@testing-library/react';
3
+ import { Placeholder } from './placeholder';
4
+ describe('<Placeholder>', () => {
5
+ it('should render the component', () => {
6
+ render(_jsx(Placeholder, {}));
7
+ const element = screen.getByTestId('placeholder');
8
+ expect(element).toBeDefined();
9
+ });
10
+ it('should render the component w color', () => {
11
+ render(_jsx(Placeholder, { color: "red" }));
12
+ const element = screen.getByTestId('placeholder');
13
+ expect(element).toBeDefined();
14
+ });
15
+ });
@@ -0,0 +1,2 @@
1
+ export * from './lines';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/shapes/index.ts"],"names":[],"mappings":"AAgBA,cAAc,SAAS,CAAC"}
@@ -0,0 +1,16 @@
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 './lines';
@@ -0,0 +1,2 @@
1
+ export { Lines } from './lines';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/shapes/lines/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}