@impulse-ui-native/charts 2.1.1 → 2.3.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.
- package/README.md +97 -6
- package/dist/components/bar-chart/bar-chart-body.d.mts +15 -0
- package/dist/components/bar-chart/bar-chart-body.js +50 -0
- package/dist/components/bar-chart/bar-chart-body.js.map +1 -0
- package/dist/components/bar-chart/bar-chart.d.mts +11 -0
- package/dist/components/bar-chart/bar-chart.js +21 -0
- package/dist/components/bar-chart/bar-chart.js.map +1 -0
- package/dist/components/bar-chart/index.d.mts +8 -0
- package/dist/components/bar-chart/index.js +5 -0
- package/dist/components/bar-chart/index.js.map +1 -0
- package/dist/components/chart-axes/chart-axes.d.mts +22 -0
- package/dist/components/chart-axes/chart-axes.js +64 -0
- package/dist/components/chart-axes/chart-axes.js.map +1 -0
- package/dist/components/chart-axes/index.d.mts +7 -0
- package/dist/components/chart-axes/index.js +5 -0
- package/dist/components/chart-axes/index.js.map +1 -0
- package/dist/components/index.d.mts +14 -2
- package/dist/components/index.js +9 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/line-chart/index.d.mts +7 -0
- package/dist/components/line-chart/index.js +5 -0
- package/dist/components/line-chart/index.js.map +1 -0
- package/dist/components/{line-chart-body.d.mts → line-chart/line-chart-body.d.mts} +3 -3
- package/dist/components/{line-chart-body.js → line-chart/line-chart-body.js} +5 -9
- package/dist/components/line-chart/line-chart-body.js.map +1 -0
- package/dist/components/{line-chart.d.mts → line-chart/line-chart.d.mts} +3 -3
- package/dist/components/{line-chart.js → line-chart/line-chart.js} +1 -1
- package/dist/components/line-chart/line-chart.js.map +1 -0
- package/dist/components/multi-bar-chart/index.d.mts +9 -0
- package/dist/components/multi-bar-chart/index.js +5 -0
- package/dist/components/multi-bar-chart/index.js.map +1 -0
- package/dist/components/multi-bar-chart/multi-bar-chart-body.d.mts +16 -0
- package/dist/components/multi-bar-chart/multi-bar-chart-body.js +72 -0
- package/dist/components/multi-bar-chart/multi-bar-chart-body.js.map +1 -0
- package/dist/components/multi-bar-chart/multi-bar-chart.d.mts +12 -0
- package/dist/components/multi-bar-chart/multi-bar-chart.js +21 -0
- package/dist/components/multi-bar-chart/multi-bar-chart.js.map +1 -0
- package/dist/components/multi-line-chart/index.d.mts +8 -0
- package/dist/components/multi-line-chart/index.js +5 -0
- package/dist/components/multi-line-chart/index.js.map +1 -0
- package/dist/components/{multi-line-chart-body.d.mts → multi-line-chart/multi-line-chart-body.d.mts} +4 -4
- package/dist/components/{multi-line-chart-body.js → multi-line-chart/multi-line-chart-body.js} +4 -7
- package/dist/components/multi-line-chart/multi-line-chart-body.js.map +1 -0
- package/dist/components/{multi-line-chart.d.mts → multi-line-chart/multi-line-chart.d.mts} +4 -4
- package/dist/components/{multi-line-chart.js → multi-line-chart/multi-line-chart.js} +1 -1
- package/dist/components/multi-line-chart/multi-line-chart.js.map +1 -0
- package/dist/components/multi-pie-chart/index.d.mts +7 -0
- package/dist/components/multi-pie-chart/index.js +5 -0
- package/dist/components/multi-pie-chart/index.js.map +1 -0
- package/dist/components/multi-pie-chart/multi-pie-chart-body.d.mts +13 -0
- package/dist/components/multi-pie-chart/multi-pie-chart-body.js +40 -0
- package/dist/components/multi-pie-chart/multi-pie-chart-body.js.map +1 -0
- package/dist/components/multi-pie-chart/multi-pie-chart.d.mts +10 -0
- package/dist/components/multi-pie-chart/multi-pie-chart.js +19 -0
- package/dist/components/multi-pie-chart/multi-pie-chart.js.map +1 -0
- package/dist/components/pie-chart/index.d.mts +6 -0
- package/dist/components/pie-chart/index.js +5 -0
- package/dist/components/pie-chart/index.js.map +1 -0
- package/dist/components/pie-chart/pie-chart-body.d.mts +12 -0
- package/dist/components/pie-chart/pie-chart-body.js +32 -0
- package/dist/components/pie-chart/pie-chart-body.js.map +1 -0
- package/dist/components/pie-chart/pie-chart.d.mts +9 -0
- package/dist/components/pie-chart/pie-chart.js +19 -0
- package/dist/components/pie-chart/pie-chart.js.map +1 -0
- package/dist/components/primitives/bar.d.mts +12 -0
- package/dist/components/primitives/bar.js +44 -0
- package/dist/components/primitives/bar.js.map +1 -0
- package/dist/components/primitives/index.d.mts +6 -0
- package/dist/components/primitives/index.js +4 -0
- package/dist/components/primitives/index.js.map +1 -1
- package/dist/components/primitives/pie.d.mts +10 -0
- package/dist/components/primitives/pie.js +63 -0
- package/dist/components/primitives/pie.js.map +1 -0
- package/dist/constants/bar-chart.constants.d.mts +4 -0
- package/dist/constants/bar-chart.constants.js +7 -0
- package/dist/constants/bar-chart.constants.js.map +1 -0
- package/dist/constants/bar.constants.d.mts +8 -0
- package/dist/constants/bar.constants.js +12 -0
- package/dist/constants/bar.constants.js.map +1 -0
- package/dist/constants/index.d.mts +4 -1
- package/dist/constants/index.js +3 -0
- package/dist/constants/index.js.map +1 -1
- package/dist/constants/pie.constants.d.mts +15 -0
- package/dist/constants/pie.constants.js +26 -0
- package/dist/constants/pie.constants.js.map +1 -0
- package/dist/hooks/index.d.mts +14 -1
- package/dist/hooks/index.js +11 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/use-bar-chart.hook.d.mts +11 -0
- package/dist/hooks/use-bar-chart.hook.js +13 -0
- package/dist/hooks/use-bar-chart.hook.js.map +1 -0
- package/dist/hooks/use-chart-layout.hook.d.mts +7 -0
- package/dist/hooks/use-chart-layout.hook.js +9 -0
- package/dist/hooks/use-chart-layout.hook.js.map +1 -0
- package/dist/hooks/use-multi-bar-chart.hook.d.mts +13 -0
- package/dist/hooks/use-multi-bar-chart.hook.js +20 -0
- package/dist/hooks/use-multi-bar-chart.hook.js.map +1 -0
- package/dist/hooks/use-multi-pie-chart.hook.d.mts +10 -0
- package/dist/hooks/use-multi-pie-chart.hook.js +40 -0
- package/dist/hooks/use-multi-pie-chart.hook.js.map +1 -0
- package/dist/hooks/use-pie-chart.hook.d.mts +9 -0
- package/dist/hooks/use-pie-chart.hook.js +29 -0
- package/dist/hooks/use-pie-chart.hook.js.map +1 -0
- package/dist/index.d.mts +32 -3
- package/dist/types/bar-chart.types.d.mts +38 -0
- package/dist/types/bar-chart.types.js +1 -0
- package/dist/types/bar-chart.types.js.map +1 -0
- package/dist/types/bar.types.d.mts +12 -0
- package/dist/types/bar.types.js +1 -0
- package/dist/types/bar.types.js.map +1 -0
- package/dist/types/index.d.mts +10 -0
- package/dist/types/index.js +10 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/multi-bar-chart.types.d.mts +21 -0
- package/dist/types/multi-bar-chart.types.js +1 -0
- package/dist/types/multi-bar-chart.types.js.map +1 -0
- package/dist/types/multi-pie-chart.types.d.mts +20 -0
- package/dist/types/multi-pie-chart.types.js +1 -0
- package/dist/types/multi-pie-chart.types.js.map +1 -0
- package/dist/types/pie-chart.types.d.mts +46 -0
- package/dist/types/pie-chart.types.js +1 -0
- package/dist/types/pie-chart.types.js.map +1 -0
- package/dist/types/pie.types.d.mts +10 -0
- package/dist/types/pie.types.js +1 -0
- package/dist/types/pie.types.js.map +1 -0
- package/dist/types/use-bar-chart.types.d.mts +26 -0
- package/dist/types/use-bar-chart.types.js +1 -0
- package/dist/types/use-bar-chart.types.js.map +1 -0
- package/dist/types/use-multi-bar-chart.types.d.mts +17 -0
- package/dist/types/use-multi-bar-chart.types.js +1 -0
- package/dist/types/use-multi-bar-chart.types.js.map +1 -0
- package/dist/types/use-multi-pie-chart.types.d.mts +14 -0
- package/dist/types/use-multi-pie-chart.types.js +1 -0
- package/dist/types/use-multi-pie-chart.types.js.map +1 -0
- package/dist/types/use-pie-chart.types.d.mts +12 -0
- package/dist/types/use-pie-chart.types.js +1 -0
- package/dist/types/use-pie-chart.types.js.map +1 -0
- package/dist/utils/bar-chart.util.d.mts +25 -0
- package/dist/utils/bar-chart.util.js +145 -0
- package/dist/utils/bar-chart.util.js.map +1 -0
- package/dist/utils/grid.util.js +4 -4
- package/dist/utils/grid.util.js.map +1 -1
- package/dist/utils/index.d.mts +13 -0
- package/dist/utils/index.js +24 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/multi-bar-chart.util.d.mts +14 -0
- package/dist/utils/multi-bar-chart.util.js +62 -0
- package/dist/utils/multi-bar-chart.util.js.map +1 -0
- package/dist/utils/multi-pie-chart.util.d.mts +10 -0
- package/dist/utils/multi-pie-chart.util.js +59 -0
- package/dist/utils/multi-pie-chart.util.js.map +1 -0
- package/dist/utils/pie-chart.util.d.mts +18 -0
- package/dist/utils/pie-chart.util.js +82 -0
- package/dist/utils/pie-chart.util.js.map +1 -0
- package/dist/utils/pie.util.d.mts +8 -0
- package/dist/utils/pie.util.js +19 -0
- package/dist/utils/pie.util.js.map +1 -0
- package/package.json +5 -5
- package/dist/components/line-chart-body.js.map +0 -1
- package/dist/components/line-chart.js.map +0 -1
- package/dist/components/multi-line-chart-body.js.map +0 -1
- package/dist/components/multi-line-chart.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/multi-bar-chart/multi-bar-chart-body.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { Group } from \"@shopify/react-native-skia\";\n\nimport { memo } from \"@impulse-ui-native/core\";\nimport { AppTheme } from \"@impulse-ui-native/theme\";\n\nimport { useChartLayout, useMultiBarChart } from \"../../hooks\";\nimport { ChartSize, ChartXValue, MultiBarChartProps } from \"../../types\";\nimport { createDrawableMultiBarChartSeries } from \"../../utils\";\nimport { ChartAxes } from \"../chart-axes\";\nimport { Bar } from \"../primitives\";\n\ninterface MultiBarChartBodyProps<\n X extends ChartXValue,\n> extends MultiBarChartProps<X> {\n size: ChartSize;\n theme: AppTheme;\n}\n\nexport const MultiBarChartBody = memo(function MultiBarChartBodyComponent<\n X extends ChartXValue = string,\n>(props: MultiBarChartBodyProps<X>) {\n const {\n categoryPadding,\n fontManager,\n grid,\n insets,\n series,\n seriesPadding,\n size,\n theme,\n xAxis,\n yAxis,\n } = props;\n const layout = useChartLayout(size, insets);\n const {\n series: seriesModels,\n xScale,\n xTicks,\n yScale,\n yTicks,\n } = useMultiBarChart({\n categoryPadding,\n plot: layout.plot,\n series,\n seriesPadding,\n xAxis,\n yAxis,\n });\n const drawableSeries = useMemo(\n () =>\n seriesModels.map((currentSeries, index) =>\n createDrawableMultiBarChartSeries(currentSeries, index),\n ),\n [seriesModels],\n );\n\n return (\n <>\n <ChartAxes\n fontManager={fontManager}\n grid={grid}\n layout={layout}\n theme={theme}\n xAxis={xAxis}\n xScale={xScale}\n xTicks={xTicks}\n yAxis={yAxis}\n yScale={yScale}\n yTicks={yTicks}\n />\n\n <Group clip={layout.plot}>\n {drawableSeries.map((currentSeries) => (\n <Bar\n key={currentSeries.id}\n coordinates={currentSeries.coordinates}\n {...currentSeries.bar}\n />\n ))}\n </Group>\n </>\n );\n});\n"],"mappings":"AA0DI,mBACE,KADF;AA1DJ,SAAS,eAAe;AACxB,SAAS,aAAa;AAEtB,SAAS,YAAY;AAGrB,SAAS,gBAAgB,wBAAwB;AAEjD,SAAS,yCAAyC;AAClD,SAAS,iBAAiB;AAC1B,SAAS,WAAW;AASb,MAAM,oBAAoB,KAAK,SAAS,2BAE7C,OAAkC;AAClC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,SAAS,eAAe,MAAM,MAAM;AAC1C,QAAM;AAAA,IACJ,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,iBAAiB;AAAA,IACnB;AAAA,IACA,MAAM,OAAO;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,iBAAiB;AAAA,IACrB,MACE,aAAa;AAAA,MAAI,CAAC,eAAe,UAC/B,kCAAkC,eAAe,KAAK;AAAA,IACxD;AAAA,IACF,CAAC,YAAY;AAAA,EACf;AAEA,SACE,iCACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,IAEA,oBAAC,SAAM,MAAM,OAAO,MACjB,yBAAe,IAAI,CAAC,kBACnB;AAAA,MAAC;AAAA;AAAA,QAEC,aAAa,cAAc;AAAA,QAC1B,GAAG,cAAc;AAAA;AAAA,MAFb,cAAc;AAAA,IAGrB,CACD,GACH;AAAA,KACF;AAEJ,CAAC;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { b as ChartXValue } from '../../line-chart.types-yxru5uWc.mjs';
|
|
3
|
+
import { MultiBarChartProps } from '../../types/multi-bar-chart.types.mjs';
|
|
4
|
+
import '@shopify/react-native-skia';
|
|
5
|
+
import '../../types/common.types.mjs';
|
|
6
|
+
import '../../types/style.types.mjs';
|
|
7
|
+
import '@impulse-ui-native/theme';
|
|
8
|
+
import '../../types/bar-chart.types.mjs';
|
|
9
|
+
|
|
10
|
+
declare const MultiBarChart: <X extends ChartXValue = string>(props: MultiBarChartProps<X>) => react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { MultiBarChart };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
import { Canvas } from "@shopify/react-native-skia";
|
|
4
|
+
import { memo } from "@impulse-ui-native/core";
|
|
5
|
+
import { useTheme } from "@impulse-ui-native/theme";
|
|
6
|
+
import { useChartCanvas } from "../../hooks";
|
|
7
|
+
import { MultiBarChartBody } from "./multi-bar-chart-body";
|
|
8
|
+
const MultiBarChart = memo(function MultiBarChart2(props) {
|
|
9
|
+
const theme = useTheme();
|
|
10
|
+
const { ref, size } = useChartCanvas();
|
|
11
|
+
return /* @__PURE__ */ jsx(Canvas, { ref, style: styles.container, children: /* @__PURE__ */ jsx(MultiBarChartBody, { ...props, size, theme }) });
|
|
12
|
+
});
|
|
13
|
+
const styles = StyleSheet.create({
|
|
14
|
+
container: {
|
|
15
|
+
flex: 1
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
export {
|
|
19
|
+
MultiBarChart
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=multi-bar-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/multi-bar-chart/multi-bar-chart.tsx"],"sourcesContent":["import { StyleSheet } from \"react-native\";\nimport { Canvas } from \"@shopify/react-native-skia\";\n\nimport { memo } from \"@impulse-ui-native/core\";\nimport { useTheme } from \"@impulse-ui-native/theme\";\n\nimport { useChartCanvas } from \"../../hooks\";\nimport { ChartXValue, MultiBarChartProps } from \"../../types\";\nimport { MultiBarChartBody } from \"./multi-bar-chart-body\";\n\nexport const MultiBarChart = memo(function MultiBarChart<\n X extends ChartXValue = string,\n>(props: MultiBarChartProps<X>) {\n const theme = useTheme();\n const { ref, size } = useChartCanvas();\n\n return (\n <Canvas ref={ref} style={styles.container}>\n <MultiBarChartBody {...props} size={size} theme={theme} />\n </Canvas>\n );\n});\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n"],"mappings":"AAkBM;AAlBN,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AAEvB,SAAS,YAAY;AACrB,SAAS,gBAAgB;AAEzB,SAAS,sBAAsB;AAE/B,SAAS,yBAAyB;AAE3B,MAAM,gBAAgB,KAAK,SAASA,eAEzC,OAA8B;AAC9B,QAAM,QAAQ,SAAS;AACvB,QAAM,EAAE,KAAK,KAAK,IAAI,eAAe;AAErC,SACE,oBAAC,UAAO,KAAU,OAAO,OAAO,WAC9B,8BAAC,qBAAmB,GAAG,OAAO,MAAY,OAAc,GAC1D;AAEJ,CAAC;AAED,MAAM,SAAS,WAAW,OAAO;AAAA,EAC/B,WAAW;AAAA,IACT,MAAM;AAAA,EACR;AACF,CAAC;","names":["MultiBarChart"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { MultiLineChart } from './multi-line-chart.mjs';
|
|
2
|
+
import 'react/jsx-runtime';
|
|
3
|
+
import '../../line-chart.types-yxru5uWc.mjs';
|
|
4
|
+
import '@shopify/react-native-skia';
|
|
5
|
+
import '../../types/common.types.mjs';
|
|
6
|
+
import '../../types/style.types.mjs';
|
|
7
|
+
import '@impulse-ui-native/theme';
|
|
8
|
+
import '../../types/multi-line-chart.types.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/multi-line-chart/index.ts"],"sourcesContent":["export { MultiLineChart } from \"./multi-line-chart\";\n"],"mappings":"AAAA,SAAS,sBAAsB;","names":[]}
|
package/dist/components/{multi-line-chart-body.d.mts → multi-line-chart/multi-line-chart-body.d.mts}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { b as ChartXValue } from '
|
|
3
|
-
import { MultiLineChartBodyProps } from '
|
|
2
|
+
import { b as ChartXValue } from '../../line-chart.types-yxru5uWc.mjs';
|
|
3
|
+
import { MultiLineChartBodyProps } from '../../types/multi-line-chart.types.mjs';
|
|
4
4
|
import '@shopify/react-native-skia';
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
5
|
+
import '../../types/common.types.mjs';
|
|
6
|
+
import '../../types/style.types.mjs';
|
|
7
7
|
import '@impulse-ui-native/theme';
|
|
8
8
|
|
|
9
9
|
declare const MultiLineChartBody: <X extends ChartXValue = number>(props: MultiLineChartBodyProps<X>) => react_jsx_runtime.JSX.Element;
|
package/dist/components/{multi-line-chart-body.js → multi-line-chart/multi-line-chart-body.js}
RENAMED
|
@@ -2,12 +2,9 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { Group } from "@shopify/react-native-skia";
|
|
4
4
|
import { memo } from "@impulse-ui-native/core";
|
|
5
|
-
import { useMultiLineChart } from "
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
createDrawableMultiLineChartSeries
|
|
9
|
-
} from "../utils";
|
|
10
|
-
import { Grid, Line, XAxis, YAxis } from "./primitives";
|
|
5
|
+
import { useChartLayout, useMultiLineChart } from "../../hooks";
|
|
6
|
+
import { createDrawableMultiLineChartSeries } from "../../utils";
|
|
7
|
+
import { Grid, Line, XAxis, YAxis } from "../primitives";
|
|
11
8
|
const MultiLineChartBody = memo(function MultiLineChartBodyComponent(props) {
|
|
12
9
|
const {
|
|
13
10
|
fontManager,
|
|
@@ -20,7 +17,7 @@ const MultiLineChartBody = memo(function MultiLineChartBodyComponent(props) {
|
|
|
20
17
|
xScaleType,
|
|
21
18
|
yAxis
|
|
22
19
|
} = props;
|
|
23
|
-
const layout =
|
|
20
|
+
const layout = useChartLayout(size, insets);
|
|
24
21
|
const {
|
|
25
22
|
series: seriesModels,
|
|
26
23
|
xScale,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/multi-line-chart/multi-line-chart-body.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { Group } from \"@shopify/react-native-skia\";\n\nimport { memo } from \"@impulse-ui-native/core\";\n\nimport { useChartLayout, useMultiLineChart } from \"../../hooks\";\nimport { ChartXValue, MultiLineChartBodyProps } from \"../../types\";\nimport { createDrawableMultiLineChartSeries } from \"../../utils\";\nimport { Grid, Line, XAxis, YAxis } from \"../primitives\";\n\nexport const MultiLineChartBody = memo(function MultiLineChartBodyComponent<\n X extends ChartXValue = number,\n>(props: MultiLineChartBodyProps<X>) {\n const {\n fontManager,\n grid,\n insets,\n series,\n size,\n theme,\n xAxis,\n xScaleType,\n yAxis,\n } = props;\n\n const layout = useChartLayout(size, insets);\n\n const {\n series: seriesModels,\n xScale,\n xTicks,\n yScale,\n yTicks,\n } = useMultiLineChart({\n plot: layout.plot,\n series,\n xAxis,\n xScaleType,\n yAxis,\n });\n\n const drawableSeries = useMemo(\n () =>\n seriesModels.map((currentSeries, index) =>\n createDrawableMultiLineChartSeries(currentSeries, index, layout.plot),\n ),\n [layout.plot, seriesModels],\n );\n\n const isGridStyle = grid !== undefined;\n\n return (\n <>\n {isGridStyle ? (\n <Grid\n options={grid}\n plot={layout.plot}\n theme={theme}\n xTicks={xTicks}\n xScale={xScale}\n yTicks={yTicks}\n yScale={yScale}\n />\n ) : null}\n\n {xAxis?.visible !== false ? (\n <XAxis\n ticks={xTicks}\n scale={xScale}\n plot={layout.plot}\n region={layout.xAxis}\n theme={theme}\n options={xAxis}\n fontManager={fontManager}\n lineVisible={!isGridStyle}\n tickVisible={!isGridStyle}\n />\n ) : null}\n\n {yAxis?.visible !== false ? (\n <YAxis\n ticks={yTicks}\n scale={yScale}\n plot={layout.plot}\n region={layout.yAxis}\n theme={theme}\n options={yAxis}\n fontManager={fontManager}\n lineVisible={!isGridStyle}\n tickVisible={!isGridStyle}\n />\n ) : null}\n\n <Group clip={layout.plot}>\n {drawableSeries.map((currentSeries) => (\n <Line\n key={currentSeries.id}\n coordinates={currentSeries.coordinates}\n {...currentSeries.line}\n />\n ))}\n </Group>\n </>\n );\n});\n"],"mappings":"AAoDI,mBAEI,KAFJ;AApDJ,SAAS,eAAe;AACxB,SAAS,aAAa;AAEtB,SAAS,YAAY;AAErB,SAAS,gBAAgB,yBAAyB;AAElD,SAAS,0CAA0C;AACnD,SAAS,MAAM,MAAM,OAAO,aAAa;AAElC,MAAM,qBAAqB,KAAK,SAAS,4BAE9C,OAAmC;AACnC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,SAAS,eAAe,MAAM,MAAM;AAE1C,QAAM;AAAA,IACJ,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,kBAAkB;AAAA,IACpB,MAAM,OAAO;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,iBAAiB;AAAA,IACrB,MACE,aAAa;AAAA,MAAI,CAAC,eAAe,UAC/B,mCAAmC,eAAe,OAAO,OAAO,IAAI;AAAA,IACtE;AAAA,IACF,CAAC,OAAO,MAAM,YAAY;AAAA,EAC5B;AAEA,QAAM,cAAc,SAAS;AAE7B,SACE,iCACG;AAAA,kBACC;AAAA,MAAC;AAAA;AAAA,QACC,SAAS;AAAA,QACT,MAAM,OAAO;AAAA,QACb;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF,IACE;AAAA,IAEH,OAAO,YAAY,QAClB;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA,QACP,OAAO;AAAA,QACP,MAAM,OAAO;AAAA,QACb,QAAQ,OAAO;AAAA,QACf;AAAA,QACA,SAAS;AAAA,QACT;AAAA,QACA,aAAa,CAAC;AAAA,QACd,aAAa,CAAC;AAAA;AAAA,IAChB,IACE;AAAA,IAEH,OAAO,YAAY,QAClB;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA,QACP,OAAO;AAAA,QACP,MAAM,OAAO;AAAA,QACb,QAAQ,OAAO;AAAA,QACf;AAAA,QACA,SAAS;AAAA,QACT;AAAA,QACA,aAAa,CAAC;AAAA,QACd,aAAa,CAAC;AAAA;AAAA,IAChB,IACE;AAAA,IAEJ,oBAAC,SAAM,MAAM,OAAO,MACjB,yBAAe,IAAI,CAAC,kBACnB;AAAA,MAAC;AAAA;AAAA,QAEC,aAAa,cAAc;AAAA,QAC1B,GAAG,cAAc;AAAA;AAAA,MAFb,cAAc;AAAA,IAGrB,CACD,GACH;AAAA,KACF;AAEJ,CAAC;","names":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { b as ChartXValue } from '
|
|
3
|
-
import { MultiLineChartProps } from '
|
|
2
|
+
import { b as ChartXValue } from '../../line-chart.types-yxru5uWc.mjs';
|
|
3
|
+
import { MultiLineChartProps } from '../../types/multi-line-chart.types.mjs';
|
|
4
4
|
import '@shopify/react-native-skia';
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
5
|
+
import '../../types/common.types.mjs';
|
|
6
|
+
import '../../types/style.types.mjs';
|
|
7
7
|
import '@impulse-ui-native/theme';
|
|
8
8
|
|
|
9
9
|
declare const MultiLineChart: <X extends ChartXValue = number>(props: MultiLineChartProps<X>) => react_jsx_runtime.JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { StyleSheet } from "react-native";
|
|
|
3
3
|
import { Canvas } from "@shopify/react-native-skia";
|
|
4
4
|
import { memo } from "@impulse-ui-native/core";
|
|
5
5
|
import { useTheme } from "@impulse-ui-native/theme";
|
|
6
|
-
import { useChartCanvas } from "
|
|
6
|
+
import { useChartCanvas } from "../../hooks";
|
|
7
7
|
import { MultiLineChartBody } from "./multi-line-chart-body";
|
|
8
8
|
const MultiLineChart = memo(function MultiLineChart2(props) {
|
|
9
9
|
const theme = useTheme();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/multi-line-chart/multi-line-chart.tsx"],"sourcesContent":["import { StyleSheet } from \"react-native\";\nimport { Canvas } from \"@shopify/react-native-skia\";\n\nimport { memo } from \"@impulse-ui-native/core\";\nimport { useTheme } from \"@impulse-ui-native/theme\";\n\nimport { useChartCanvas } from \"../../hooks\";\nimport { ChartXValue, MultiLineChartProps } from \"../../types\";\nimport { MultiLineChartBody } from \"./multi-line-chart-body\";\n\nexport const MultiLineChart = memo(function MultiLineChart<\n X extends ChartXValue = number,\n>(props: MultiLineChartProps<X>) {\n const theme = useTheme();\n\n const { ref, size } = useChartCanvas();\n\n return (\n <Canvas ref={ref} style={styles.container}>\n <MultiLineChartBody {...props} size={size} theme={theme} />\n </Canvas>\n );\n});\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n"],"mappings":"AAmBM;AAnBN,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AAEvB,SAAS,YAAY;AACrB,SAAS,gBAAgB;AAEzB,SAAS,sBAAsB;AAE/B,SAAS,0BAA0B;AAE5B,MAAM,iBAAiB,KAAK,SAASA,gBAE1C,OAA+B;AAC/B,QAAM,QAAQ,SAAS;AAEvB,QAAM,EAAE,KAAK,KAAK,IAAI,eAAe;AAErC,SACE,oBAAC,UAAO,KAAU,OAAO,OAAO,WAC9B,8BAAC,sBAAoB,GAAG,OAAO,MAAY,OAAc,GAC3D;AAEJ,CAAC;AAED,MAAM,SAAS,WAAW,OAAO;AAAA,EAC/B,WAAW;AAAA,IACT,MAAM;AAAA,EACR;AACF,CAAC;","names":["MultiLineChart"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { MultiPieChart } from './multi-pie-chart.mjs';
|
|
2
|
+
import 'react/jsx-runtime';
|
|
3
|
+
import '../../types/multi-pie-chart.types.mjs';
|
|
4
|
+
import '../../types/pie-chart.types.mjs';
|
|
5
|
+
import '../../types/common.types.mjs';
|
|
6
|
+
import '../../types/style.types.mjs';
|
|
7
|
+
import '@shopify/react-native-skia';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/multi-pie-chart/index.ts"],"sourcesContent":["export { MultiPieChart } from \"./multi-pie-chart\";\n"],"mappings":"AAAA,SAAS,qBAAqB;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ChartSize } from '../../types/common.types.mjs';
|
|
3
|
+
import { MultiPieChartProps } from '../../types/multi-pie-chart.types.mjs';
|
|
4
|
+
import '../../types/style.types.mjs';
|
|
5
|
+
import '@shopify/react-native-skia';
|
|
6
|
+
import '../../types/pie-chart.types.mjs';
|
|
7
|
+
|
|
8
|
+
interface MultiPieChartBodyProps extends MultiPieChartProps {
|
|
9
|
+
size: ChartSize;
|
|
10
|
+
}
|
|
11
|
+
declare const MultiPieChartBody: (props: MultiPieChartBodyProps) => react_jsx_runtime.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { MultiPieChartBody };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "@impulse-ui-native/core";
|
|
3
|
+
import { useChartLayout, useMultiPieChart } from "../../hooks";
|
|
4
|
+
import { Pie } from "../primitives";
|
|
5
|
+
const MultiPieChartBody = memo(function MultiPieChartBody2(props) {
|
|
6
|
+
const {
|
|
7
|
+
endAngle,
|
|
8
|
+
innerRadius,
|
|
9
|
+
insets,
|
|
10
|
+
outerRadius,
|
|
11
|
+
padAngle,
|
|
12
|
+
ringPadding,
|
|
13
|
+
series,
|
|
14
|
+
size,
|
|
15
|
+
startAngle
|
|
16
|
+
} = props;
|
|
17
|
+
const layout = useChartLayout(size, insets);
|
|
18
|
+
const { series: seriesModels } = useMultiPieChart({
|
|
19
|
+
endAngle,
|
|
20
|
+
innerRadius,
|
|
21
|
+
outerRadius,
|
|
22
|
+
padAngle,
|
|
23
|
+
plot: layout.plot,
|
|
24
|
+
ringPadding,
|
|
25
|
+
series,
|
|
26
|
+
startAngle
|
|
27
|
+
});
|
|
28
|
+
return /* @__PURE__ */ jsx(Fragment, { children: seriesModels.map((currentSeries) => /* @__PURE__ */ jsx(
|
|
29
|
+
Pie,
|
|
30
|
+
{
|
|
31
|
+
coordinates: currentSeries.coordinates,
|
|
32
|
+
...currentSeries.slice
|
|
33
|
+
},
|
|
34
|
+
currentSeries.id
|
|
35
|
+
)) });
|
|
36
|
+
});
|
|
37
|
+
export {
|
|
38
|
+
MultiPieChartBody
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=multi-pie-chart-body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/multi-pie-chart/multi-pie-chart-body.tsx"],"sourcesContent":["import { memo } from \"@impulse-ui-native/core\";\n\nimport { useChartLayout, useMultiPieChart } from \"../../hooks\";\nimport { ChartSize, MultiPieChartProps } from \"../../types\";\nimport { Pie } from \"../primitives\";\n\ninterface MultiPieChartBodyProps extends MultiPieChartProps {\n size: ChartSize;\n}\n\nexport const MultiPieChartBody = memo(function MultiPieChartBody(\n props: MultiPieChartBodyProps,\n) {\n const {\n endAngle,\n innerRadius,\n insets,\n outerRadius,\n padAngle,\n ringPadding,\n series,\n size,\n startAngle,\n } = props;\n const layout = useChartLayout(size, insets);\n const { series: seriesModels } = useMultiPieChart({\n endAngle,\n innerRadius,\n outerRadius,\n padAngle,\n plot: layout.plot,\n ringPadding,\n series,\n startAngle,\n });\n\n return (\n <>\n {seriesModels.map((currentSeries) => (\n <Pie\n key={currentSeries.id}\n coordinates={currentSeries.coordinates}\n {...currentSeries.slice}\n />\n ))}\n </>\n );\n});\n"],"mappings":"AAqCI,mBAEI,WAFJ;AArCJ,SAAS,YAAY;AAErB,SAAS,gBAAgB,wBAAwB;AAEjD,SAAS,WAAW;AAMb,MAAM,oBAAoB,KAAK,SAASA,mBAC7C,OACA;AACA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,SAAS,eAAe,MAAM,MAAM;AAC1C,QAAM,EAAE,QAAQ,aAAa,IAAI,iBAAiB;AAAA,IAChD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM,OAAO;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,SACE,gCACG,uBAAa,IAAI,CAAC,kBACjB;AAAA,IAAC;AAAA;AAAA,MAEC,aAAa,cAAc;AAAA,MAC1B,GAAG,cAAc;AAAA;AAAA,IAFb,cAAc;AAAA,EAGrB,CACD,GACH;AAEJ,CAAC;","names":["MultiPieChartBody"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { MultiPieChartProps } from '../../types/multi-pie-chart.types.mjs';
|
|
3
|
+
import '../../types/pie-chart.types.mjs';
|
|
4
|
+
import '../../types/common.types.mjs';
|
|
5
|
+
import '../../types/style.types.mjs';
|
|
6
|
+
import '@shopify/react-native-skia';
|
|
7
|
+
|
|
8
|
+
declare const MultiPieChart: (props: MultiPieChartProps) => react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { MultiPieChart };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
import { Canvas } from "@shopify/react-native-skia";
|
|
4
|
+
import { memo } from "@impulse-ui-native/core";
|
|
5
|
+
import { useChartCanvas } from "../../hooks";
|
|
6
|
+
import { MultiPieChartBody } from "./multi-pie-chart-body";
|
|
7
|
+
const MultiPieChart = memo(function MultiPieChart2(props) {
|
|
8
|
+
const { ref, size } = useChartCanvas();
|
|
9
|
+
return /* @__PURE__ */ jsx(Canvas, { ref, style: styles.container, children: /* @__PURE__ */ jsx(MultiPieChartBody, { ...props, size }) });
|
|
10
|
+
});
|
|
11
|
+
const styles = StyleSheet.create({
|
|
12
|
+
container: {
|
|
13
|
+
flex: 1
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
export {
|
|
17
|
+
MultiPieChart
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=multi-pie-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/multi-pie-chart/multi-pie-chart.tsx"],"sourcesContent":["import { StyleSheet } from \"react-native\";\nimport { Canvas } from \"@shopify/react-native-skia\";\n\nimport { memo } from \"@impulse-ui-native/core\";\n\nimport { useChartCanvas } from \"../../hooks\";\nimport { MultiPieChartProps } from \"../../types\";\nimport { MultiPieChartBody } from \"./multi-pie-chart-body\";\n\nexport const MultiPieChart = memo(function MultiPieChart(\n props: MultiPieChartProps,\n) {\n const { ref, size } = useChartCanvas();\n\n return (\n <Canvas ref={ref} style={styles.container}>\n <MultiPieChartBody {...props} size={size} />\n </Canvas>\n );\n});\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n"],"mappings":"AAgBM;AAhBN,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AAEvB,SAAS,YAAY;AAErB,SAAS,sBAAsB;AAE/B,SAAS,yBAAyB;AAE3B,MAAM,gBAAgB,KAAK,SAASA,eACzC,OACA;AACA,QAAM,EAAE,KAAK,KAAK,IAAI,eAAe;AAErC,SACE,oBAAC,UAAO,KAAU,OAAO,OAAO,WAC9B,8BAAC,qBAAmB,GAAG,OAAO,MAAY,GAC5C;AAEJ,CAAC;AAED,MAAM,SAAS,WAAW,OAAO;AAAA,EAC/B,WAAW;AAAA,IACT,MAAM;AAAA,EACR;AACF,CAAC;","names":["MultiPieChart"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/pie-chart/index.ts"],"sourcesContent":["export { PieChart } from \"./pie-chart\";\n"],"mappings":"AAAA,SAAS,gBAAgB;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ChartSize } from '../../types/common.types.mjs';
|
|
3
|
+
import { PieChartProps } from '../../types/pie-chart.types.mjs';
|
|
4
|
+
import '../../types/style.types.mjs';
|
|
5
|
+
import '@shopify/react-native-skia';
|
|
6
|
+
|
|
7
|
+
interface PieChartBodyProps extends PieChartProps {
|
|
8
|
+
size: ChartSize;
|
|
9
|
+
}
|
|
10
|
+
declare const PieChartBody: (props: PieChartBodyProps) => react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { PieChartBody };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "@impulse-ui-native/core";
|
|
3
|
+
import { useChartLayout, usePieChart } from "../../hooks";
|
|
4
|
+
import { Pie } from "../primitives";
|
|
5
|
+
const PieChartBody = memo(function PieChartBody2(props) {
|
|
6
|
+
const {
|
|
7
|
+
data,
|
|
8
|
+
endAngle,
|
|
9
|
+
innerRadius,
|
|
10
|
+
insets,
|
|
11
|
+
outerRadius,
|
|
12
|
+
padAngle,
|
|
13
|
+
size,
|
|
14
|
+
slice,
|
|
15
|
+
startAngle
|
|
16
|
+
} = props;
|
|
17
|
+
const layout = useChartLayout(size, insets);
|
|
18
|
+
const { coordinates } = usePieChart({
|
|
19
|
+
data,
|
|
20
|
+
endAngle,
|
|
21
|
+
innerRadius,
|
|
22
|
+
outerRadius,
|
|
23
|
+
padAngle,
|
|
24
|
+
plot: layout.plot,
|
|
25
|
+
startAngle
|
|
26
|
+
});
|
|
27
|
+
return /* @__PURE__ */ jsx(Pie, { coordinates, ...slice });
|
|
28
|
+
});
|
|
29
|
+
export {
|
|
30
|
+
PieChartBody
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=pie-chart-body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/pie-chart/pie-chart-body.tsx"],"sourcesContent":["import { memo } from \"@impulse-ui-native/core\";\n\nimport { useChartLayout, usePieChart } from \"../../hooks\";\nimport { ChartSize, PieChartProps } from \"../../types\";\nimport { Pie } from \"../primitives\";\n\ninterface PieChartBodyProps extends PieChartProps {\n size: ChartSize;\n}\n\nexport const PieChartBody = memo(function PieChartBody(\n props: PieChartBodyProps,\n) {\n const {\n data,\n endAngle,\n innerRadius,\n insets,\n outerRadius,\n padAngle,\n size,\n slice,\n startAngle,\n } = props;\n const layout = useChartLayout(size, insets);\n const { coordinates } = usePieChart({\n data,\n endAngle,\n innerRadius,\n outerRadius,\n padAngle,\n plot: layout.plot,\n startAngle,\n });\n\n return <Pie coordinates={coordinates} {...slice} />;\n});\n"],"mappings":"AAmCS;AAnCT,SAAS,YAAY;AAErB,SAAS,gBAAgB,mBAAmB;AAE5C,SAAS,WAAW;AAMb,MAAM,eAAe,KAAK,SAASA,cACxC,OACA;AACA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,SAAS,eAAe,MAAM,MAAM;AAC1C,QAAM,EAAE,YAAY,IAAI,YAAY;AAAA,IAClC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM,OAAO;AAAA,IACb;AAAA,EACF,CAAC;AAED,SAAO,oBAAC,OAAI,aAA2B,GAAG,OAAO;AACnD,CAAC;","names":["PieChartBody"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { PieChartProps } from '../../types/pie-chart.types.mjs';
|
|
3
|
+
import '../../types/common.types.mjs';
|
|
4
|
+
import '../../types/style.types.mjs';
|
|
5
|
+
import '@shopify/react-native-skia';
|
|
6
|
+
|
|
7
|
+
declare const PieChart: (props: PieChartProps) => react_jsx_runtime.JSX.Element;
|
|
8
|
+
|
|
9
|
+
export { PieChart };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
import { Canvas } from "@shopify/react-native-skia";
|
|
4
|
+
import { memo } from "@impulse-ui-native/core";
|
|
5
|
+
import { useChartCanvas } from "../../hooks";
|
|
6
|
+
import { PieChartBody } from "./pie-chart-body";
|
|
7
|
+
const PieChart = memo(function PieChart2(props) {
|
|
8
|
+
const { ref, size } = useChartCanvas();
|
|
9
|
+
return /* @__PURE__ */ jsx(Canvas, { ref, style: styles.container, children: /* @__PURE__ */ jsx(PieChartBody, { ...props, size }) });
|
|
10
|
+
});
|
|
11
|
+
const styles = StyleSheet.create({
|
|
12
|
+
container: {
|
|
13
|
+
flex: 1
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
export {
|
|
17
|
+
PieChart
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=pie-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/pie-chart/pie-chart.tsx"],"sourcesContent":["import { StyleSheet } from \"react-native\";\nimport { Canvas } from \"@shopify/react-native-skia\";\n\nimport { memo } from \"@impulse-ui-native/core\";\n\nimport { useChartCanvas } from \"../../hooks\";\nimport { PieChartProps } from \"../../types\";\nimport { PieChartBody } from \"./pie-chart-body\";\n\nexport const PieChart = memo(function PieChart(props: PieChartProps) {\n const { ref, size } = useChartCanvas();\n\n return (\n <Canvas ref={ref} style={styles.container}>\n <PieChartBody {...props} size={size} />\n </Canvas>\n );\n});\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n});\n"],"mappings":"AAcM;AAdN,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AAEvB,SAAS,YAAY;AAErB,SAAS,sBAAsB;AAE/B,SAAS,oBAAoB;AAEtB,MAAM,WAAW,KAAK,SAASA,UAAS,OAAsB;AACnE,QAAM,EAAE,KAAK,KAAK,IAAI,eAAe;AAErC,SACE,oBAAC,UAAO,KAAU,OAAO,OAAO,WAC9B,8BAAC,gBAAc,GAAG,OAAO,MAAY,GACvC;AAEJ,CAAC;AAED,MAAM,SAAS,WAAW,OAAO;AAAA,EAC/B,WAAW;AAAA,IACT,MAAM;AAAA,EACR;AACF,CAAC;","names":["PieChart"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { b as ChartXValue } from '../../line-chart.types-yxru5uWc.mjs';
|
|
3
|
+
import { BarProps } from '../../types/bar.types.mjs';
|
|
4
|
+
import '@shopify/react-native-skia';
|
|
5
|
+
import '../../types/common.types.mjs';
|
|
6
|
+
import '../../types/style.types.mjs';
|
|
7
|
+
import '@impulse-ui-native/theme';
|
|
8
|
+
import '../../types/bar-chart.types.mjs';
|
|
9
|
+
|
|
10
|
+
declare const Bar: <X extends ChartXValue = string>(props: BarProps<X>) => react_jsx_runtime.JSX.Element | null;
|
|
11
|
+
|
|
12
|
+
export { Bar };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Group, RoundedRect } from "@shopify/react-native-skia";
|
|
3
|
+
import { memo } from "@impulse-ui-native/core";
|
|
4
|
+
import {
|
|
5
|
+
BarDefaultColor,
|
|
6
|
+
BarDefaultOpacity,
|
|
7
|
+
BarDefaultRadius
|
|
8
|
+
} from "../../constants";
|
|
9
|
+
const Bar = memo(function Bar2(props) {
|
|
10
|
+
const {
|
|
11
|
+
color = BarDefaultColor,
|
|
12
|
+
coordinates,
|
|
13
|
+
opacity = BarDefaultOpacity,
|
|
14
|
+
radius = BarDefaultRadius,
|
|
15
|
+
visible = true
|
|
16
|
+
} = props;
|
|
17
|
+
if (!visible) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return /* @__PURE__ */ jsx(Group, { children: coordinates.map((coordinate) => {
|
|
21
|
+
const resolvedRadius = Math.min(
|
|
22
|
+
Math.max(0, radius),
|
|
23
|
+
coordinate.width / 2,
|
|
24
|
+
coordinate.height / 2
|
|
25
|
+
);
|
|
26
|
+
return coordinate.height > 0 ? /* @__PURE__ */ jsx(
|
|
27
|
+
RoundedRect,
|
|
28
|
+
{
|
|
29
|
+
x: coordinate.x,
|
|
30
|
+
y: coordinate.y,
|
|
31
|
+
width: coordinate.width,
|
|
32
|
+
height: coordinate.height,
|
|
33
|
+
r: resolvedRadius,
|
|
34
|
+
color,
|
|
35
|
+
opacity
|
|
36
|
+
},
|
|
37
|
+
coordinate.index
|
|
38
|
+
) : null;
|
|
39
|
+
}) });
|
|
40
|
+
});
|
|
41
|
+
export {
|
|
42
|
+
Bar
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/primitives/bar.tsx"],"sourcesContent":["import { Group, RoundedRect } from \"@shopify/react-native-skia\";\n\nimport { memo } from \"@impulse-ui-native/core\";\n\nimport {\n BarDefaultColor,\n BarDefaultOpacity,\n BarDefaultRadius,\n} from \"../../constants\";\nimport { BarProps, ChartXValue } from \"../../types\";\n\nexport const Bar = memo(function Bar<X extends ChartXValue = string>(\n props: BarProps<X>,\n) {\n const {\n color = BarDefaultColor,\n coordinates,\n opacity = BarDefaultOpacity,\n radius = BarDefaultRadius,\n visible = true,\n } = props;\n\n if (!visible) {\n return null;\n }\n\n return (\n <Group>\n {coordinates.map((coordinate) => {\n const resolvedRadius = Math.min(\n Math.max(0, radius),\n coordinate.width / 2,\n coordinate.height / 2,\n );\n\n return coordinate.height > 0 ? (\n <RoundedRect\n key={coordinate.index}\n x={coordinate.x}\n y={coordinate.y}\n width={coordinate.width}\n height={coordinate.height}\n r={resolvedRadius}\n color={color}\n opacity={opacity}\n />\n ) : null;\n })}\n </Group>\n );\n});\n"],"mappings":"AAoCU;AApCV,SAAS,OAAO,mBAAmB;AAEnC,SAAS,YAAY;AAErB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGA,MAAM,MAAM,KAAK,SAASA,KAC/B,OACA;AACA,QAAM;AAAA,IACJ,QAAQ;AAAA,IACR;AAAA,IACA,UAAU;AAAA,IACV,SAAS;AAAA,IACT,UAAU;AAAA,EACZ,IAAI;AAEJ,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AAEA,SACE,oBAAC,SACE,sBAAY,IAAI,CAAC,eAAe;AAC/B,UAAM,iBAAiB,KAAK;AAAA,MAC1B,KAAK,IAAI,GAAG,MAAM;AAAA,MAClB,WAAW,QAAQ;AAAA,MACnB,WAAW,SAAS;AAAA,IACtB;AAEA,WAAO,WAAW,SAAS,IACzB;AAAA,MAAC;AAAA;AAAA,QAEC,GAAG,WAAW;AAAA,QACd,GAAG,WAAW;AAAA,QACd,OAAO,WAAW;AAAA,QAClB,QAAQ,WAAW;AAAA,QACnB,GAAG;AAAA,QACH;AAAA,QACA;AAAA;AAAA,MAPK,WAAW;AAAA,IAQlB,IACE;AAAA,EACN,CAAC,GACH;AAEJ,CAAC;","names":["Bar"]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
export { Bar } from './bar.mjs';
|
|
1
2
|
export { Grid } from './grid.mjs';
|
|
2
3
|
export { Label } from './label.mjs';
|
|
3
4
|
export { Line } from './line.mjs';
|
|
5
|
+
export { Pie } from './pie.mjs';
|
|
4
6
|
export { XAxis } from './x-axis.mjs';
|
|
5
7
|
export { YAxis } from './y-axis.mjs';
|
|
6
8
|
import 'react/jsx-runtime';
|
|
@@ -9,6 +11,10 @@ import '@shopify/react-native-skia';
|
|
|
9
11
|
import '../../types/common.types.mjs';
|
|
10
12
|
import '../../types/style.types.mjs';
|
|
11
13
|
import '@impulse-ui-native/theme';
|
|
14
|
+
import '../../types/bar.types.mjs';
|
|
15
|
+
import '../../types/bar-chart.types.mjs';
|
|
12
16
|
import '../../types/label.types.mjs';
|
|
13
17
|
import '../../types/line.types.mjs';
|
|
18
|
+
import '../../types/pie.types.mjs';
|
|
19
|
+
import '../../types/pie-chart.types.mjs';
|
|
14
20
|
import '../../types/axis.types.mjs';
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import { Bar } from "./bar";
|
|
1
2
|
import { Grid } from "./grid";
|
|
2
3
|
import { Label } from "./label";
|
|
3
4
|
import { Line } from "./line";
|
|
5
|
+
import { Pie } from "./pie";
|
|
4
6
|
import { XAxis } from "./x-axis";
|
|
5
7
|
import { YAxis } from "./y-axis";
|
|
6
8
|
export {
|
|
9
|
+
Bar,
|
|
7
10
|
Grid,
|
|
8
11
|
Label,
|
|
9
12
|
Line,
|
|
13
|
+
Pie,
|
|
10
14
|
XAxis,
|
|
11
15
|
YAxis
|
|
12
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/primitives/index.ts"],"sourcesContent":["export { Grid } from \"./grid\";\nexport { Label } from \"./label\";\nexport { Line } from \"./line\";\nexport { XAxis } from \"./x-axis\";\nexport { YAxis } from \"./y-axis\";\n"],"mappings":"AAAA,SAAS,YAAY;AACrB,SAAS,aAAa;AACtB,SAAS,YAAY;AACrB,SAAS,aAAa;AACtB,SAAS,aAAa;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/primitives/index.ts"],"sourcesContent":["export { Bar } from \"./bar\";\nexport { Grid } from \"./grid\";\nexport { Label } from \"./label\";\nexport { Line } from \"./line\";\nexport { Pie } from \"./pie\";\nexport { XAxis } from \"./x-axis\";\nexport { YAxis } from \"./y-axis\";\n"],"mappings":"AAAA,SAAS,WAAW;AACpB,SAAS,YAAY;AACrB,SAAS,aAAa;AACtB,SAAS,YAAY;AACrB,SAAS,WAAW;AACpB,SAAS,aAAa;AACtB,SAAS,aAAa;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { PieProps } from '../../types/pie.types.mjs';
|
|
3
|
+
import '../../types/pie-chart.types.mjs';
|
|
4
|
+
import '../../types/common.types.mjs';
|
|
5
|
+
import '../../types/style.types.mjs';
|
|
6
|
+
import '@shopify/react-native-skia';
|
|
7
|
+
|
|
8
|
+
declare const Pie: (props: PieProps) => react_jsx_runtime.JSX.Element | null;
|
|
9
|
+
|
|
10
|
+
export { Pie };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { Group, Path } from "@shopify/react-native-skia";
|
|
4
|
+
import { memo } from "@impulse-ui-native/core";
|
|
5
|
+
import {
|
|
6
|
+
PieDefaultColor,
|
|
7
|
+
PieDefaultColors,
|
|
8
|
+
PieDefaultCornerRadius,
|
|
9
|
+
PieDefaultOpacity,
|
|
10
|
+
PieDefaultStrokeWidth
|
|
11
|
+
} from "../../constants";
|
|
12
|
+
import { createPieSlicePath } from "../../utils";
|
|
13
|
+
const Pie = memo(function Pie2(props) {
|
|
14
|
+
const {
|
|
15
|
+
colors = PieDefaultColors,
|
|
16
|
+
coordinates,
|
|
17
|
+
cornerRadius = PieDefaultCornerRadius,
|
|
18
|
+
opacity = PieDefaultOpacity,
|
|
19
|
+
strokeColor,
|
|
20
|
+
strokeWidth = PieDefaultStrokeWidth,
|
|
21
|
+
visible = true
|
|
22
|
+
} = props;
|
|
23
|
+
const slices = useMemo(
|
|
24
|
+
() => coordinates.map((coordinate) => ({
|
|
25
|
+
color: coordinate.datum.color ?? colors[coordinate.index % colors.length] ?? PieDefaultColor,
|
|
26
|
+
coordinate,
|
|
27
|
+
path: createPieSlicePath(coordinate, cornerRadius)
|
|
28
|
+
})),
|
|
29
|
+
[colors, coordinates, cornerRadius]
|
|
30
|
+
);
|
|
31
|
+
if (!visible) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return /* @__PURE__ */ jsx(Group, { children: slices.map(
|
|
35
|
+
({ color, coordinate, path }) => path ? /* @__PURE__ */ jsxs(
|
|
36
|
+
Group,
|
|
37
|
+
{
|
|
38
|
+
transform: [
|
|
39
|
+
{ translateX: coordinate.center.x },
|
|
40
|
+
{ translateY: coordinate.center.y }
|
|
41
|
+
],
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ jsx(Path, { path, color, opacity }),
|
|
44
|
+
strokeColor && strokeWidth > 0 ? /* @__PURE__ */ jsx(
|
|
45
|
+
Path,
|
|
46
|
+
{
|
|
47
|
+
path,
|
|
48
|
+
color: strokeColor,
|
|
49
|
+
opacity,
|
|
50
|
+
style: "stroke",
|
|
51
|
+
strokeWidth
|
|
52
|
+
}
|
|
53
|
+
) : null
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
coordinate.datum.id
|
|
57
|
+
) : null
|
|
58
|
+
) });
|
|
59
|
+
});
|
|
60
|
+
export {
|
|
61
|
+
Pie
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=pie.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/primitives/pie.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { Group, Path } from \"@shopify/react-native-skia\";\n\nimport { memo } from \"@impulse-ui-native/core\";\n\nimport {\n PieDefaultColor,\n PieDefaultColors,\n PieDefaultCornerRadius,\n PieDefaultOpacity,\n PieDefaultStrokeWidth,\n} from \"../../constants\";\nimport { PieProps } from \"../../types\";\nimport { createPieSlicePath } from \"../../utils\";\n\nexport const Pie = memo(function Pie(props: PieProps) {\n const {\n colors = PieDefaultColors,\n coordinates,\n cornerRadius = PieDefaultCornerRadius,\n opacity = PieDefaultOpacity,\n strokeColor,\n strokeWidth = PieDefaultStrokeWidth,\n visible = true,\n } = props;\n const slices = useMemo(\n () =>\n coordinates.map((coordinate) => ({\n color:\n coordinate.datum.color ??\n colors[coordinate.index % colors.length] ??\n PieDefaultColor,\n coordinate,\n path: createPieSlicePath(coordinate, cornerRadius),\n })),\n [colors, coordinates, cornerRadius],\n );\n\n if (!visible) {\n return null;\n }\n\n return (\n <Group>\n {slices.map(({ color, coordinate, path }) =>\n path ? (\n <Group\n key={coordinate.datum.id}\n transform={[\n { translateX: coordinate.center.x },\n { translateY: coordinate.center.y },\n ]}\n >\n <Path path={path} color={color} opacity={opacity} />\n {strokeColor && strokeWidth > 0 ? (\n <Path\n path={path}\n color={strokeColor}\n opacity={opacity}\n style=\"stroke\"\n strokeWidth={strokeWidth}\n />\n ) : null}\n </Group>\n ) : null,\n )}\n </Group>\n );\n});\n"],"mappings":"AA8CU,SAOE,KAPF;AA9CV,SAAS,eAAe;AACxB,SAAS,OAAO,YAAY;AAE5B,SAAS,YAAY;AAErB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,0BAA0B;AAE5B,MAAM,MAAM,KAAK,SAASA,KAAI,OAAiB;AACpD,QAAM;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA,eAAe;AAAA,IACf,UAAU;AAAA,IACV;AAAA,IACA,cAAc;AAAA,IACd,UAAU;AAAA,EACZ,IAAI;AACJ,QAAM,SAAS;AAAA,IACb,MACE,YAAY,IAAI,CAAC,gBAAgB;AAAA,MAC/B,OACE,WAAW,MAAM,SACjB,OAAO,WAAW,QAAQ,OAAO,MAAM,KACvC;AAAA,MACF;AAAA,MACA,MAAM,mBAAmB,YAAY,YAAY;AAAA,IACnD,EAAE;AAAA,IACJ,CAAC,QAAQ,aAAa,YAAY;AAAA,EACpC;AAEA,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AAEA,SACE,oBAAC,SACE,iBAAO;AAAA,IAAI,CAAC,EAAE,OAAO,YAAY,KAAK,MACrC,OACE;AAAA,MAAC;AAAA;AAAA,QAEC,WAAW;AAAA,UACT,EAAE,YAAY,WAAW,OAAO,EAAE;AAAA,UAClC,EAAE,YAAY,WAAW,OAAO,EAAE;AAAA,QACpC;AAAA,QAEA;AAAA,8BAAC,QAAK,MAAY,OAAc,SAAkB;AAAA,UACjD,eAAe,cAAc,IAC5B;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA,OAAO;AAAA,cACP;AAAA,cACA,OAAM;AAAA,cACN;AAAA;AAAA,UACF,IACE;AAAA;AAAA;AAAA,MAfC,WAAW,MAAM;AAAA,IAgBxB,IACE;AAAA,EACN,GACF;AAEJ,CAAC;","names":["Pie"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/constants/bar-chart.constants.ts"],"sourcesContent":["export const BarChartDefaultCategoryPadding = 0.2;\nexport const MultiBarChartDefaultSeriesPadding = 0.1;\n"],"mappings":"AAAO,MAAM,iCAAiC;AACvC,MAAM,oCAAoC;","names":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as _impulse_ui_native_theme from '@impulse-ui-native/theme';
|
|
2
|
+
|
|
3
|
+
declare const BarDefaultColor: string;
|
|
4
|
+
declare const BarDefaultColors: _impulse_ui_native_theme.ChartColorPalette;
|
|
5
|
+
declare const BarDefaultOpacity = 1;
|
|
6
|
+
declare const BarDefaultRadius = 0;
|
|
7
|
+
|
|
8
|
+
export { BarDefaultColor, BarDefaultColors, BarDefaultOpacity, BarDefaultRadius };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ChartColorTokens } from "@impulse-ui-native/theme";
|
|
2
|
+
const BarDefaultColor = ChartColorTokens[0];
|
|
3
|
+
const BarDefaultColors = ChartColorTokens;
|
|
4
|
+
const BarDefaultOpacity = 1;
|
|
5
|
+
const BarDefaultRadius = 0;
|
|
6
|
+
export {
|
|
7
|
+
BarDefaultColor,
|
|
8
|
+
BarDefaultColors,
|
|
9
|
+
BarDefaultOpacity,
|
|
10
|
+
BarDefaultRadius
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=bar.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/constants/bar.constants.ts"],"sourcesContent":["import { ChartColorTokens } from \"@impulse-ui-native/theme\";\n\nexport const BarDefaultColor = ChartColorTokens[0];\nexport const BarDefaultColors = ChartColorTokens;\nexport const BarDefaultOpacity = 1;\nexport const BarDefaultRadius = 0;\n"],"mappings":"AAAA,SAAS,wBAAwB;AAE1B,MAAM,kBAAkB,iBAAiB,CAAC;AAC1C,MAAM,mBAAmB;AACzB,MAAM,oBAAoB;AAC1B,MAAM,mBAAmB;","names":[]}
|