@tenancy.nz/feature-ui 1.4.11 → 1.5.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/cjs/components/AgentDetailsCard.cjs +9 -7
- package/dist/cjs/components/AnalyticsBox.cjs +23 -14
- package/dist/cjs/components/AnalyticsSection.cjs +141 -133
- package/dist/cjs/components/ChartLegend.cjs +43 -0
- package/dist/cjs/components/CheckedIcon.cjs +12 -7
- package/dist/cjs/components/PropertyCard.cjs +45 -38
- package/dist/cjs/components/PropertyCard.styled.cjs +2 -2
- package/dist/cjs/components/analytics-doughnut-chart.cjs +61 -0
- package/dist/cjs/components/doughnut-chart.cjs +124 -0
- package/dist/cjs/index.cjs +4 -2
- package/dist/cjs/utils/helpers/general.cjs +13 -0
- package/dist/esm/components/AgentDetailsCard.js +9 -7
- package/dist/esm/components/AnalyticsBox.js +24 -15
- package/dist/esm/components/AnalyticsSection.js +141 -133
- package/dist/esm/components/ChartLegend.js +39 -0
- package/dist/esm/components/CheckedIcon.js +12 -7
- package/dist/esm/components/PropertyCard.js +45 -38
- package/dist/esm/components/PropertyCard.styled.js +2 -2
- package/dist/esm/components/analytics-doughnut-chart.js +57 -0
- package/dist/esm/components/doughnut-chart.js +120 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/utils/helpers/general.js +11 -0
- package/package.json +9 -5
- package/dist/cjs/components/EnquiriesDoughnutChart.cjs +0 -143
- package/dist/esm/components/EnquiriesDoughnutChart.js +0 -139
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Stack from '@mui/material/Stack';
|
|
4
|
+
import { Box, Text } from '@tenancy.nz/ui';
|
|
5
|
+
|
|
6
|
+
function ChartLegend(_ref) {
|
|
7
|
+
var _ref$color = _ref.color,
|
|
8
|
+
color = _ref$color === void 0 ? void 0 : _ref$color,
|
|
9
|
+
_ref$count = _ref.count,
|
|
10
|
+
count = _ref$count === void 0 ? void 0 : _ref$count,
|
|
11
|
+
label = _ref.label,
|
|
12
|
+
_ref$sx = _ref.sx,
|
|
13
|
+
sx = _ref$sx === void 0 ? {} : _ref$sx;
|
|
14
|
+
return /* @__PURE__ */React.createElement(Stack, {
|
|
15
|
+
flexDirection: "row",
|
|
16
|
+
alignItems: "center",
|
|
17
|
+
gap: 1.5,
|
|
18
|
+
sx: _objectSpread2(_objectSpread2({}, sx), {}, {
|
|
19
|
+
userSelect: "none",
|
|
20
|
+
fontSize: "12px"
|
|
21
|
+
})
|
|
22
|
+
}, /* @__PURE__ */React.createElement(Box, {
|
|
23
|
+
borderRadius: "4px",
|
|
24
|
+
width: "32px",
|
|
25
|
+
height: "18px",
|
|
26
|
+
bgcolor: color || "#D9D9D9"
|
|
27
|
+
}), /* @__PURE__ */React.createElement(Box, {
|
|
28
|
+
minWidth: "24px"
|
|
29
|
+
}, count !== void 0 && count >= 0 && /* @__PURE__ */React.createElement(Text, {
|
|
30
|
+
align: "center",
|
|
31
|
+
weight: "700",
|
|
32
|
+
variant: "inherit"
|
|
33
|
+
}, count)), typeof label !== "string" ? label : /* @__PURE__ */React.createElement(Text, {
|
|
34
|
+
weight: "500",
|
|
35
|
+
variant: "inherit"
|
|
36
|
+
}, label));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { ChartLegend as default };
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import CheckCircleOutlineRoundedIcon from '@mui/icons-material/CheckCircleOutlineRounded';
|
|
3
|
+
import HighlightOffRoundedIcon from '@mui/icons-material/HighlightOffRounded';
|
|
3
4
|
import { Text } from '@tenancy.nz/ui';
|
|
4
5
|
|
|
5
6
|
function CheckedIcon(_ref) {
|
|
6
7
|
var value = _ref.value;
|
|
7
8
|
if (value === true) {
|
|
8
|
-
return /* @__PURE__ */React.createElement(
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
return /* @__PURE__ */React.createElement(CheckCircleOutlineRoundedIcon, {
|
|
10
|
+
sx: {
|
|
11
|
+
color: "success.main"
|
|
12
|
+
},
|
|
13
|
+
fontSize: "small"
|
|
11
14
|
});
|
|
12
15
|
}
|
|
13
16
|
if (value === false) {
|
|
14
|
-
return /* @__PURE__ */React.createElement(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
return /* @__PURE__ */React.createElement(HighlightOffRoundedIcon, {
|
|
18
|
+
sx: {
|
|
19
|
+
color: "error.main"
|
|
20
|
+
},
|
|
21
|
+
fontSize: "small"
|
|
17
22
|
});
|
|
18
23
|
}
|
|
19
24
|
return /* @__PURE__ */React.createElement(Text, {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Paper, Media, Box, Heading, Text } from '@tenancy.nz/ui';
|
|
4
|
-
import
|
|
4
|
+
import Stack from '@mui/material/Stack';
|
|
5
|
+
import BedRoundedIcon from '@mui/icons-material/BedRounded';
|
|
6
|
+
import BathtubRoundedIcon from '@mui/icons-material/BathtubRounded';
|
|
7
|
+
import DirectionsCarRoundedIcon from '@mui/icons-material/DirectionsCarRounded';
|
|
5
8
|
import IconLabel from './IconLabel.js';
|
|
6
9
|
import { StyledPropertyImage, StyledPropertyDetailsBox, StyledPropertyAmenitiesBox } from './PropertyCard.styled.js';
|
|
7
10
|
|
|
@@ -32,7 +35,6 @@ function PropertyCard(_ref) {
|
|
|
32
35
|
alignItems: "center"
|
|
33
36
|
}
|
|
34
37
|
}, rest), /* @__PURE__ */React.createElement(StyledPropertyImage, null, /* @__PURE__ */React.createElement(Media, {
|
|
35
|
-
as: "img",
|
|
36
38
|
title: address,
|
|
37
39
|
src: imgSrc
|
|
38
40
|
})), /* @__PURE__ */React.createElement(StyledPropertyDetailsBox, null, /* @__PURE__ */React.createElement(Box, null, /* @__PURE__ */React.createElement(Heading, {
|
|
@@ -56,49 +58,57 @@ function PropertyCard(_ref) {
|
|
|
56
58
|
}, /* @__PURE__ */React.createElement(StyledPropertyAmenitiesBox, null, rent && /* @__PURE__ */React.createElement(Heading, {
|
|
57
59
|
as: "h4",
|
|
58
60
|
weight: "700"
|
|
59
|
-
}, rent), /* @__PURE__ */React.createElement(
|
|
60
|
-
|
|
61
|
+
}, rent), /* @__PURE__ */React.createElement(Stack, {
|
|
62
|
+
sx: {
|
|
63
|
+
fontSize: "16px",
|
|
64
|
+
fontWeight: "600"
|
|
65
|
+
},
|
|
66
|
+
flexDirection: "row",
|
|
67
|
+
gap: 3,
|
|
68
|
+
alignItems: "center"
|
|
61
69
|
}, (noOfBedrooms || String(noOfBedrooms) === "0") && /* @__PURE__ */React.createElement(IconLabel, {
|
|
62
70
|
color: "text.primary",
|
|
63
|
-
startIcon: /* @__PURE__ */React.createElement(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
71
|
+
startIcon: /* @__PURE__ */React.createElement(BedRoundedIcon, {
|
|
72
|
+
sx: {
|
|
73
|
+
color: "tertiary.main"
|
|
74
|
+
},
|
|
75
|
+
fontSize: "small"
|
|
67
76
|
})
|
|
68
77
|
}, /* @__PURE__ */React.createElement(Text, {
|
|
69
78
|
as: "span",
|
|
70
79
|
variant: "inherit"
|
|
71
80
|
}, noOfBedrooms)), (noOfBathrooms || String(noOfBathrooms) === "0") && /* @__PURE__ */React.createElement(IconLabel, {
|
|
72
81
|
color: "text.primary",
|
|
73
|
-
startIcon: /* @__PURE__ */React.createElement(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
startIcon: /* @__PURE__ */React.createElement(BathtubRoundedIcon, {
|
|
83
|
+
sx: {
|
|
84
|
+
color: "tertiary.main"
|
|
85
|
+
},
|
|
86
|
+
fontSize: "small"
|
|
87
|
+
})
|
|
79
88
|
}, /* @__PURE__ */React.createElement(Text, {
|
|
80
89
|
as: "span",
|
|
81
90
|
variant: "inherit"
|
|
82
91
|
}, noOfBathrooms)), (noOfCarparks || String(noOfCarparks) === "0") && /* @__PURE__ */React.createElement(IconLabel, {
|
|
83
92
|
color: "text.primary",
|
|
84
|
-
startIcon: /* @__PURE__ */React.createElement(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
93
|
+
startIcon: /* @__PURE__ */React.createElement(DirectionsCarRoundedIcon, {
|
|
94
|
+
sx: {
|
|
95
|
+
color: "tertiary.main"
|
|
96
|
+
},
|
|
97
|
+
fontSize: "small"
|
|
98
|
+
})
|
|
90
99
|
}, /* @__PURE__ */React.createElement(Text, {
|
|
91
100
|
as: "span",
|
|
92
101
|
variant: "inherit"
|
|
93
102
|
}, noOfCarparks)))), !compact && /* @__PURE__ */React.createElement(Box, {
|
|
94
|
-
paddingLeft: "
|
|
95
|
-
borderLeft: "1px solid
|
|
103
|
+
paddingLeft: "24px",
|
|
104
|
+
borderLeft: "1px solid",
|
|
105
|
+
borderLeftColor: "grey.300",
|
|
96
106
|
display: "flex",
|
|
97
107
|
direction: "column",
|
|
98
108
|
sx: {
|
|
99
109
|
gap: {
|
|
100
|
-
xs:
|
|
101
|
-
lg:
|
|
110
|
+
xs: 4,
|
|
111
|
+
lg: 2,
|
|
102
112
|
xl: 0
|
|
103
113
|
},
|
|
104
114
|
justifyContent: "space-between"
|
|
@@ -106,34 +116,31 @@ function PropertyCard(_ref) {
|
|
|
106
116
|
}, viewingsCount && /* @__PURE__ */React.createElement(Box, {
|
|
107
117
|
display: "flex",
|
|
108
118
|
align: "center",
|
|
109
|
-
gap:
|
|
119
|
+
gap: 2
|
|
110
120
|
}, /* @__PURE__ */React.createElement(Box, {
|
|
111
|
-
minWidth: "
|
|
121
|
+
minWidth: "67px"
|
|
112
122
|
}, /* @__PURE__ */React.createElement(Text, {
|
|
113
|
-
transform: "uppercase",
|
|
114
123
|
color: "textPrimary",
|
|
115
124
|
as: "span",
|
|
116
|
-
weight: "
|
|
125
|
+
weight: "500",
|
|
117
126
|
align: "right",
|
|
118
|
-
|
|
127
|
+
variant: "body2"
|
|
119
128
|
}, "Viewings")), /* @__PURE__ */React.createElement(Heading, {
|
|
120
|
-
as: "
|
|
129
|
+
as: "h4"
|
|
121
130
|
}, viewingsCount)), enquiriesCount && /* @__PURE__ */React.createElement(Box, {
|
|
122
131
|
display: "flex",
|
|
123
132
|
align: "center",
|
|
124
|
-
gap:
|
|
133
|
+
gap: 2
|
|
125
134
|
}, /* @__PURE__ */React.createElement(Box, {
|
|
126
|
-
minWidth: "
|
|
135
|
+
minWidth: "67px"
|
|
127
136
|
}, /* @__PURE__ */React.createElement(Text, {
|
|
128
|
-
|
|
137
|
+
variant: "body2",
|
|
129
138
|
color: "textPrimary",
|
|
130
139
|
as: "span",
|
|
131
|
-
weight: "
|
|
132
|
-
|
|
133
|
-
align: "right",
|
|
134
|
-
lineHeight: "15px"
|
|
140
|
+
weight: "500",
|
|
141
|
+
align: "right"
|
|
135
142
|
}, "Enquiries")), /* @__PURE__ */React.createElement(Heading, {
|
|
136
|
-
as: "
|
|
143
|
+
as: "h4"
|
|
137
144
|
}, enquiriesCount))))));
|
|
138
145
|
}
|
|
139
146
|
|
|
@@ -3,7 +3,7 @@ import { css } from '@emotion/react';
|
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
4
|
|
|
5
5
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
6
|
-
var StyledPropertyImage = styled.
|
|
6
|
+
var StyledPropertyImage = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 0;\n margin: 0;\n width: 120px;\n height: 95px;\n flex: 0 0 95px;\n overflow: hidden;\n\n ", "\n"])), function (_ref) {
|
|
7
7
|
var theme = _ref.theme;
|
|
8
8
|
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", " {\n display: none;\n }\n\n ", " {\n width: 150px;\n height: 135px;\n flex: 0 0 150px;\n }\n\n @media print {\n width: 150px;\n height: 135px;\n flex: 0 0 150px;\n display: block;\n }\n "])), theme.breakpoints.down("sm"), theme.breakpoints.up("sm"));
|
|
9
9
|
});
|
|
@@ -11,7 +11,7 @@ var StyledPropertyDetailsBox = styled.div(_templateObject3 || (_templateObject3
|
|
|
11
11
|
var theme = _ref2.theme;
|
|
12
12
|
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", " {\n flex-direction: row;\n align-items: center;\n }\n "])), theme.breakpoints.up("sm"));
|
|
13
13
|
});
|
|
14
|
-
var StyledPropertyAmenitiesBox = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding-right: 25px;\n display: flex;\n flex-direction: column;\n margin-top: 5px;\n
|
|
14
|
+
var StyledPropertyAmenitiesBox = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding-right: 25px;\n display: flex;\n flex-direction: column;\n margin-top: 5px;\n gap: 8px;\n min-width: 170px;\n height: 100%;\n justify-content: space-between;\n\n ", "\n @media print {\n align-items: flex-end;\n }\n"])), function (_ref3) {
|
|
15
15
|
var theme = _ref3.theme;
|
|
16
16
|
return "\n @media (min-width: ".concat(theme.breakpoints.values.md, "px) {\n align-items: flex-end;\n }\n ");
|
|
17
17
|
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import DoughnutChart from './doughnut-chart.js';
|
|
3
|
+
import { parseChartCount } from '../utils/helpers/general.js';
|
|
4
|
+
|
|
5
|
+
function AnalyticsDoughnutChart(_ref) {
|
|
6
|
+
var _ref$allhouseCount = _ref.allhouseCount,
|
|
7
|
+
allhouseCount = _ref$allhouseCount === void 0 ? 0 : _ref$allhouseCount,
|
|
8
|
+
_ref$bookMeCount = _ref.bookMeCount,
|
|
9
|
+
bookMeCount = _ref$bookMeCount === void 0 ? 0 : _ref$bookMeCount,
|
|
10
|
+
_ref$oneRoofCount = _ref.oneRoofCount,
|
|
11
|
+
oneRoofCount = _ref$oneRoofCount === void 0 ? 0 : _ref$oneRoofCount,
|
|
12
|
+
_ref$realEstateCount = _ref.realEstateCount,
|
|
13
|
+
realEstateCount = _ref$realEstateCount === void 0 ? 0 : _ref$realEstateCount,
|
|
14
|
+
_ref$tradeMeCount = _ref.tradeMeCount,
|
|
15
|
+
tradeMeCount = _ref$tradeMeCount === void 0 ? 0 : _ref$tradeMeCount,
|
|
16
|
+
_ref$manualCount = _ref.manualCount,
|
|
17
|
+
manualCount = _ref$manualCount === void 0 ? 0 : _ref$manualCount,
|
|
18
|
+
_ref$heading = _ref.heading,
|
|
19
|
+
heading = _ref$heading === void 0 ? void 0 : _ref$heading;
|
|
20
|
+
var data = [{
|
|
21
|
+
color: "#0CC1A3",
|
|
22
|
+
count: parseChartCount(bookMeCount),
|
|
23
|
+
slug: "bookme",
|
|
24
|
+
title: "Tenant Portal"
|
|
25
|
+
}, {
|
|
26
|
+
color: "#000000",
|
|
27
|
+
count: parseChartCount(allhouseCount),
|
|
28
|
+
slug: "allhouse",
|
|
29
|
+
title: "Allhouse"
|
|
30
|
+
}, {
|
|
31
|
+
color: "#FF8500",
|
|
32
|
+
count: parseChartCount(oneRoofCount),
|
|
33
|
+
slug: "oneroof",
|
|
34
|
+
title: "OneRoof"
|
|
35
|
+
}, {
|
|
36
|
+
color: "#0098FF",
|
|
37
|
+
count: parseChartCount(realEstateCount),
|
|
38
|
+
slug: "realestate",
|
|
39
|
+
title: "realestate.co.nz"
|
|
40
|
+
}, {
|
|
41
|
+
color: "#4854D3",
|
|
42
|
+
count: parseChartCount(tradeMeCount),
|
|
43
|
+
slug: "trademe",
|
|
44
|
+
title: "Trade Me"
|
|
45
|
+
}, {
|
|
46
|
+
color: "#D9D9D9",
|
|
47
|
+
count: parseChartCount(manualCount),
|
|
48
|
+
slug: "manual",
|
|
49
|
+
title: "Manually Generated"
|
|
50
|
+
}];
|
|
51
|
+
return /* @__PURE__ */React.createElement(DoughnutChart, {
|
|
52
|
+
data: data,
|
|
53
|
+
heading: heading
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { AnalyticsDoughnutChart as default };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { uid } from 'react-uid';
|
|
4
|
+
import Stack from '@mui/material/Stack';
|
|
5
|
+
import { Heading, Box } from '@tenancy.nz/ui';
|
|
6
|
+
import { Chart } from 'primereact/chart.js';
|
|
7
|
+
import ChartLegend from './ChartLegend.js';
|
|
8
|
+
|
|
9
|
+
function DoughnutChart(_ref) {
|
|
10
|
+
var data = _ref.data,
|
|
11
|
+
_ref$heading = _ref.heading,
|
|
12
|
+
heading = _ref$heading === void 0 ? void 0 : _ref$heading,
|
|
13
|
+
_ref$chartProps = _ref.chartProps,
|
|
14
|
+
chartProps = _ref$chartProps === void 0 ? {} : _ref$chartProps,
|
|
15
|
+
_ref$size = _ref.size,
|
|
16
|
+
size = _ref$size === void 0 ? "164px" : _ref$size;
|
|
17
|
+
if (!Array.isArray(data) || data.length === 0) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
var chartLabels = data.map(function (d) {
|
|
21
|
+
return d.title;
|
|
22
|
+
});
|
|
23
|
+
var chartValues = data.map(function (d) {
|
|
24
|
+
return d.count;
|
|
25
|
+
});
|
|
26
|
+
var chartColors = data.map(function (d) {
|
|
27
|
+
return d.color;
|
|
28
|
+
});
|
|
29
|
+
return /* @__PURE__ */React.createElement(Stack, {
|
|
30
|
+
sx: {
|
|
31
|
+
position: "relative"
|
|
32
|
+
},
|
|
33
|
+
alignItems: "center",
|
|
34
|
+
gap: 4
|
|
35
|
+
}, heading && /* @__PURE__ */React.createElement(Heading, {
|
|
36
|
+
as: "h4",
|
|
37
|
+
color: "primary"
|
|
38
|
+
}, heading), /* @__PURE__ */React.createElement(Stack, {
|
|
39
|
+
flexDirection: {
|
|
40
|
+
sm: "row"
|
|
41
|
+
},
|
|
42
|
+
gap: 12,
|
|
43
|
+
alignItems: "center"
|
|
44
|
+
}, /* @__PURE__ */React.createElement(Box, {
|
|
45
|
+
width: size,
|
|
46
|
+
height: size,
|
|
47
|
+
overflow: "hidden",
|
|
48
|
+
position: "relative",
|
|
49
|
+
maxWidth: "100%",
|
|
50
|
+
sx: {
|
|
51
|
+
"&& > canvas": {
|
|
52
|
+
width: "100%",
|
|
53
|
+
height: "100%"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, /* @__PURE__ */React.createElement(Chart, _objectSpread2({
|
|
57
|
+
type: "doughnut",
|
|
58
|
+
data: {
|
|
59
|
+
labels: chartLabels,
|
|
60
|
+
datasets: [{
|
|
61
|
+
data: chartValues,
|
|
62
|
+
backgroundColor: chartColors,
|
|
63
|
+
hoverBackgroundColor: chartColors,
|
|
64
|
+
borderWidth: 0
|
|
65
|
+
}]
|
|
66
|
+
},
|
|
67
|
+
options: {
|
|
68
|
+
responsive: true,
|
|
69
|
+
maintainAspectRatio: false,
|
|
70
|
+
cutoutPercentage: 64,
|
|
71
|
+
legend: {
|
|
72
|
+
display: false
|
|
73
|
+
},
|
|
74
|
+
animation: {
|
|
75
|
+
duration: 0
|
|
76
|
+
},
|
|
77
|
+
tooltips: {
|
|
78
|
+
backgroundColor: "#0E0044",
|
|
79
|
+
titleFontColor: "#fff",
|
|
80
|
+
bodyFontColor: "#fff",
|
|
81
|
+
xPadding: 8,
|
|
82
|
+
yPadding: 8,
|
|
83
|
+
bodyFontFamily: "Montserrat, sans-serif",
|
|
84
|
+
bodyFontStyle: "semibold",
|
|
85
|
+
bodyFontSize: 14,
|
|
86
|
+
borderColor: "transparent",
|
|
87
|
+
callbacks: {
|
|
88
|
+
labelColor: function labelColor(tooltipItem, chart) {
|
|
89
|
+
var dataset = chart.config.data.datasets[tooltipItem.datasetIndex];
|
|
90
|
+
var color = dataset.backgroundColor[tooltipItem.index];
|
|
91
|
+
return {
|
|
92
|
+
borderColor: color,
|
|
93
|
+
backgroundColor: color,
|
|
94
|
+
borderWidth: 0,
|
|
95
|
+
borderRadius: 5
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
style: {
|
|
102
|
+
width: "100%",
|
|
103
|
+
height: "100%"
|
|
104
|
+
}
|
|
105
|
+
}, chartProps))), /* @__PURE__ */React.createElement(Stack, {
|
|
106
|
+
gap: 2
|
|
107
|
+
}, data.map(function (item) {
|
|
108
|
+
var color = item.color,
|
|
109
|
+
count = item.count,
|
|
110
|
+
title = item.title;
|
|
111
|
+
return /* @__PURE__ */React.createElement(ChartLegend, {
|
|
112
|
+
key: uid(item),
|
|
113
|
+
color: color,
|
|
114
|
+
count: count,
|
|
115
|
+
label: title
|
|
116
|
+
});
|
|
117
|
+
}))));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export { DoughnutChart as default };
|
package/dist/esm/index.js
CHANGED
|
@@ -7,7 +7,8 @@ export { default as BookingTableRow } from './components/BookingTableRow.js';
|
|
|
7
7
|
export { default as BookingTableRowHeader } from './components/BookingTableRowHeader.js';
|
|
8
8
|
export { default as BookingTableRowSkeleton } from './components/BookingTableRowSkeleton.js';
|
|
9
9
|
export { default as CheckedIcon } from './components/CheckedIcon.js';
|
|
10
|
-
export { default as
|
|
10
|
+
export { default as DoughnutChart } from './components/doughnut-chart.js';
|
|
11
|
+
export { default as AnalyticsDoughnutChart } from './components/analytics-doughnut-chart.js';
|
|
11
12
|
export { default as GridList } from './components/GridList.js';
|
|
12
13
|
export { default as Hidden } from './components/Hidden.js';
|
|
13
14
|
export { default as IconLabel } from './components/IconLabel.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tenancy.nz/feature-ui",
|
|
3
3
|
"description": "React UI feature components.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.5.0",
|
|
5
5
|
"author": "TPS <https://www.tenancy.co.nz>",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/cjs/index.cjs",
|
|
@@ -13,17 +13,21 @@
|
|
|
13
13
|
"peerDependencies": {
|
|
14
14
|
"@emotion/react": "^11.14.0",
|
|
15
15
|
"@emotion/styled": "^11.14.1",
|
|
16
|
+
"@mui/icons-material": "^7.2.0",
|
|
17
|
+
"@mui/material": "^7.3.1",
|
|
16
18
|
"chart.js": "2.7.3",
|
|
17
19
|
"classnames": "^2.2.6",
|
|
18
20
|
"primereact": "3.1.3",
|
|
19
21
|
"react": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
20
22
|
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
21
|
-
"@tenancy.nz/
|
|
22
|
-
"@tenancy.nz/ui": "1.4.11"
|
|
23
|
+
"@tenancy.nz/ui": "1.5.0"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
|
-
"@
|
|
26
|
-
"@
|
|
26
|
+
"@emotion/react": "^11.14.0",
|
|
27
|
+
"@emotion/styled": "^11.14.1",
|
|
28
|
+
"@mui/icons-material": "^7.2.0",
|
|
29
|
+
"@mui/material": "^7.3.1",
|
|
30
|
+
"@tenancy.nz/ui": "1.5.0"
|
|
27
31
|
},
|
|
28
32
|
"dependencies": {
|
|
29
33
|
"react-uid": "^2.4.0"
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var React = require('react');
|
|
6
|
-
var ui = require('@tenancy.nz/ui');
|
|
7
|
-
var chart_js = require('primereact/chart.js');
|
|
8
|
-
|
|
9
|
-
function EnquiriesDoughnutChart(_ref) {
|
|
10
|
-
var _ref$tradeMeEnquiries = _ref.tradeMeEnquiriesCount,
|
|
11
|
-
tradeMeEnquiriesCount = _ref$tradeMeEnquiries === void 0 ? 0 : _ref$tradeMeEnquiries,
|
|
12
|
-
_ref$bookMeEnquiriesC = _ref.bookMeEnquiriesCount,
|
|
13
|
-
bookMeEnquiriesCount = _ref$bookMeEnquiriesC === void 0 ? 0 : _ref$bookMeEnquiriesC,
|
|
14
|
-
_ref$manualEnquiryCou = _ref.manualEnquiryCount,
|
|
15
|
-
manualEnquiryCount = _ref$manualEnquiryCou === void 0 ? 0 : _ref$manualEnquiryCou;
|
|
16
|
-
var colors = {
|
|
17
|
-
tradeMe: "#6FD3C0",
|
|
18
|
-
bookMe: "#00C0F3",
|
|
19
|
-
manual: "#394869"
|
|
20
|
-
};
|
|
21
|
-
var chartColors = [colors.tradeMe, colors.bookMe, colors.manual];
|
|
22
|
-
return /* @__PURE__ */React.createElement(ui.Box, {
|
|
23
|
-
position: "relative",
|
|
24
|
-
display: "flex",
|
|
25
|
-
height: "100%",
|
|
26
|
-
align: "center"
|
|
27
|
-
}, /* @__PURE__ */React.createElement(ui.Text, {
|
|
28
|
-
transform: "uppercase",
|
|
29
|
-
sx: {
|
|
30
|
-
position: "absolute",
|
|
31
|
-
left: 20,
|
|
32
|
-
top: -10
|
|
33
|
-
},
|
|
34
|
-
fontSize: 13,
|
|
35
|
-
color: "textPrimary",
|
|
36
|
-
weight: "700"
|
|
37
|
-
}, "Number of enquiries"), /* @__PURE__ */React.createElement(ui.Box, {
|
|
38
|
-
width: "100%",
|
|
39
|
-
overflow: "hidden"
|
|
40
|
-
}, /* @__PURE__ */React.createElement(chart_js.Chart, {
|
|
41
|
-
type: "doughnut",
|
|
42
|
-
data: {
|
|
43
|
-
labels: ["TradeMe", "BookMe", "Manual"],
|
|
44
|
-
datasets: [{
|
|
45
|
-
data: [Math.max(tradeMeEnquiriesCount, 1e-3), Math.max(bookMeEnquiriesCount, 1e-3), Math.max(manualEnquiryCount, 1e-3)],
|
|
46
|
-
backgroundColor: chartColors,
|
|
47
|
-
hoverBackgroundColor: chartColors
|
|
48
|
-
}]
|
|
49
|
-
},
|
|
50
|
-
options: {
|
|
51
|
-
legend: {
|
|
52
|
-
display: false
|
|
53
|
-
},
|
|
54
|
-
animation: {
|
|
55
|
-
duration: 0
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
style: {
|
|
59
|
-
width: "100%",
|
|
60
|
-
position: "absolute",
|
|
61
|
-
top: "18%",
|
|
62
|
-
left: "-75px"
|
|
63
|
-
}
|
|
64
|
-
})), /* @__PURE__ */React.createElement(ui.Box, {
|
|
65
|
-
maxWidth: {
|
|
66
|
-
xs: "160px",
|
|
67
|
-
xl: "180px"
|
|
68
|
-
},
|
|
69
|
-
width: "100%",
|
|
70
|
-
padding: "10px 20px",
|
|
71
|
-
mt: -4
|
|
72
|
-
}, /* @__PURE__ */React.createElement(ui.Box, {
|
|
73
|
-
width: "100%"
|
|
74
|
-
}, /* @__PURE__ */React.createElement(ui.Box, {
|
|
75
|
-
height: "10px",
|
|
76
|
-
backgroundColor: colors.tradeMe,
|
|
77
|
-
width: "100%"
|
|
78
|
-
}), /* @__PURE__ */React.createElement(ui.Box, {
|
|
79
|
-
display: "flex",
|
|
80
|
-
justify: "space-between",
|
|
81
|
-
width: "100%",
|
|
82
|
-
align: "flex-start",
|
|
83
|
-
mt: 2
|
|
84
|
-
}, /* @__PURE__ */React.createElement(ui.Text, {
|
|
85
|
-
transform: "uppercase",
|
|
86
|
-
fontSize: 12,
|
|
87
|
-
weight: "600"
|
|
88
|
-
}, "TradeMe"), /* @__PURE__ */React.createElement(ui.Text, {
|
|
89
|
-
transform: "uppercase",
|
|
90
|
-
fontSize: 32,
|
|
91
|
-
weight: "700",
|
|
92
|
-
mt: -3,
|
|
93
|
-
color: "textPrimary"
|
|
94
|
-
}, tradeMeEnquiriesCount))), /* @__PURE__ */React.createElement(ui.Box, {
|
|
95
|
-
width: "100%",
|
|
96
|
-
mt: "30px"
|
|
97
|
-
}, /* @__PURE__ */React.createElement(ui.Box, {
|
|
98
|
-
height: "10px",
|
|
99
|
-
backgroundColor: colors.bookMe,
|
|
100
|
-
width: "100%"
|
|
101
|
-
}), /* @__PURE__ */React.createElement(ui.Box, {
|
|
102
|
-
display: "flex",
|
|
103
|
-
justify: "space-between",
|
|
104
|
-
width: "100%",
|
|
105
|
-
align: "flex-start",
|
|
106
|
-
mt: 2
|
|
107
|
-
}, /* @__PURE__ */React.createElement(ui.Text, {
|
|
108
|
-
transform: "uppercase",
|
|
109
|
-
fontSize: 12,
|
|
110
|
-
weight: "600"
|
|
111
|
-
}, "Bookme"), /* @__PURE__ */React.createElement(ui.Text, {
|
|
112
|
-
transform: "uppercase",
|
|
113
|
-
fontSize: 32,
|
|
114
|
-
weight: "700",
|
|
115
|
-
mt: -3,
|
|
116
|
-
color: "textPrimary"
|
|
117
|
-
}, bookMeEnquiriesCount))), /* @__PURE__ */React.createElement(ui.Box, {
|
|
118
|
-
width: "100%",
|
|
119
|
-
mt: "30px"
|
|
120
|
-
}, /* @__PURE__ */React.createElement(ui.Box, {
|
|
121
|
-
height: "10px",
|
|
122
|
-
backgroundColor: colors.manual,
|
|
123
|
-
width: "100%"
|
|
124
|
-
}), /* @__PURE__ */React.createElement(ui.Box, {
|
|
125
|
-
display: "flex",
|
|
126
|
-
justify: "space-between",
|
|
127
|
-
width: "100%",
|
|
128
|
-
align: "flex-start",
|
|
129
|
-
mt: 2
|
|
130
|
-
}, /* @__PURE__ */React.createElement(ui.Text, {
|
|
131
|
-
transform: "uppercase",
|
|
132
|
-
fontSize: 12,
|
|
133
|
-
weight: "600"
|
|
134
|
-
}, "Manually", /* @__PURE__ */React.createElement("br", null), "Generated"), /* @__PURE__ */React.createElement(ui.Text, {
|
|
135
|
-
transform: "uppercase",
|
|
136
|
-
fontSize: 32,
|
|
137
|
-
weight: "700",
|
|
138
|
-
color: "textPrimary",
|
|
139
|
-
mt: -3
|
|
140
|
-
}, manualEnquiryCount)))));
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
exports.default = EnquiriesDoughnutChart;
|