@homefile/components-v2 2.36.29 → 2.37.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/dist/components/propertyTiles/charts/areaCharts/TrendindAreaChart.d.ts +2 -0
- package/dist/components/propertyTiles/charts/areaCharts/TrendindAreaChart.js +21 -0
- package/dist/components/propertyTiles/charts/areaCharts/TrendingAreaChartHeader.d.ts +1 -0
- package/dist/components/propertyTiles/charts/areaCharts/TrendingAreaChartHeader.js +10 -0
- package/dist/components/propertyTiles/charts/areaCharts/index.d.ts +2 -0
- package/dist/components/propertyTiles/charts/areaCharts/index.js +2 -0
- package/dist/components/propertyTiles/charts/index.d.ts +1 -0
- package/dist/components/propertyTiles/charts/index.js +1 -0
- package/dist/mocks/propertyTiles/charts.d.ts +1 -0
- package/dist/mocks/propertyTiles/charts.js +47 -0
- package/dist/stories/propertyTiles/TrendingAreaChart.stories.d.ts +5 -0
- package/dist/stories/propertyTiles/TrendingAreaChart.stories.js +14 -0
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Stack, Text } from '@chakra-ui/react';
|
|
3
|
+
import { AreaChart, XAxis, YAxis, CartesianGrid, Tooltip, Area, } from 'recharts';
|
|
4
|
+
import { cursorStyle, yAxisStyle, TrendingAreaChartHeader, } from '../../../../components';
|
|
5
|
+
import { colors } from '../../../../theme/colors';
|
|
6
|
+
export const TrendingAreaChart = ({ data = [] }) => {
|
|
7
|
+
return (_jsxs(Stack, { spacing: "base", bg: "neutral.white", p: "base", children: [_jsx(TrendingAreaChartHeader, {}), _jsxs(AreaChart, { width: 300, height: 200, data: data, margin: {
|
|
8
|
+
left: -25,
|
|
9
|
+
bottom: -10,
|
|
10
|
+
}, children: [_jsx("defs", { children: _jsxs("linearGradient", { id: "area-gradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [_jsx("stop", { offset: "0%", stopColor: colors.blue[3] }), _jsx("stop", { offset: "100%", stopColor: colors.lightBlue[3] })] }) }), _jsx(CartesianGrid, { horizontalCoordinatesGenerator: () => [100], verticalCoordinatesGenerator: (props) => {
|
|
11
|
+
const w = props.width + 35;
|
|
12
|
+
const step = w / 5;
|
|
13
|
+
return [step, step * 2, step * 3, step * 4];
|
|
14
|
+
}, stroke: colors.lightBlue[2] }), _jsx(XAxis, { dataKey: "month", style: yAxisStyle }), _jsx(YAxis, { style: yAxisStyle }), _jsx(Tooltip, { content: CustomTooltip, cursor: cursorStyle }), _jsx(Area, { type: "monotone", dataKey: "value", fill: "url(#area-gradient)", strokeWidth: 1, strokeOpacity: 0.1 })] })] }));
|
|
15
|
+
};
|
|
16
|
+
const CustomTooltip = ({ active, payload }) => {
|
|
17
|
+
if (active && payload && payload.length) {
|
|
18
|
+
return (_jsx(Box, { bg: "violet.1", p: "2", borderRadius: "md", boxShadow: "md", children: _jsx(Text, { color: "neutral.white", fontWeight: "bold", fontSize: "xs", children: `$ ${payload[0].value}k` }) }));
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TrendingAreaChartHeader: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { t } from 'i18next';
|
|
3
|
+
import { ChartLegend } from '../../../../components';
|
|
4
|
+
import { Flex, Text } from '@chakra-ui/react';
|
|
5
|
+
export const TrendingAreaChartHeader = () => {
|
|
6
|
+
const now = new Date();
|
|
7
|
+
const month = now.toLocaleString('en-US', { month: 'short' }).toUpperCase();
|
|
8
|
+
const year = now.getFullYear();
|
|
9
|
+
return (_jsxs(Flex, { gap: "base", justify: "space-between", children: [_jsx(Text, { fontSize: "xs", children: `${month} ${year}` }), _jsx(ChartLegend, { color: "blue.3", label: t('propertyTiles.charts.value'), textTransform: "uppercase", fontSize: "xxs" })] }));
|
|
10
|
+
};
|
|
@@ -24,3 +24,50 @@ export const lineChartData = [
|
|
|
24
24
|
balance: 4000,
|
|
25
25
|
},
|
|
26
26
|
];
|
|
27
|
+
export const areaChartData = [
|
|
28
|
+
{
|
|
29
|
+
month: 'J',
|
|
30
|
+
value: 2000,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
month: 'F',
|
|
34
|
+
value: 2100,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
month: 'M',
|
|
38
|
+
value: 2000,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
month: 'A',
|
|
42
|
+
value: 2300,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
month: 'M',
|
|
46
|
+
value: 2400,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
month: 'J',
|
|
50
|
+
value: 2200,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
month: 'J',
|
|
54
|
+
value: 2200,
|
|
55
|
+
},
|
|
56
|
+
{ month: 'A', value: 2500 },
|
|
57
|
+
{
|
|
58
|
+
month: 'S',
|
|
59
|
+
value: 2100,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
month: 'O',
|
|
63
|
+
value: 2400,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
month: 'N',
|
|
67
|
+
value: 2500,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
month: 'D',
|
|
71
|
+
value: 2600,
|
|
72
|
+
},
|
|
73
|
+
];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { TrendingLineChartI } from '../../interfaces';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const TrendingAreaChartComponent: (args: TrendingLineChartI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '@chakra-ui/react';
|
|
3
|
+
import { TrendingAreaChart } from '../../components';
|
|
4
|
+
import { areaChartData as data } from '../../mocks';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/PropertyTiles/Charts',
|
|
7
|
+
component: TrendingAreaChart,
|
|
8
|
+
args: {
|
|
9
|
+
data,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
export const TrendingAreaChartComponent = (args) => {
|
|
13
|
+
return (_jsx(Box, { w: ['full', 'fit-content'], p: "base", bg: "lightGreen.1", children: _jsx(TrendingAreaChart, Object.assign({}, args)) }));
|
|
14
|
+
};
|