@tenancy.nz/feature-ui 1.0.0 → 1.0.2

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 (41) hide show
  1. package/dist/cjs/_virtual/_rollupPluginBabelHelpers.cjs +134 -0
  2. package/dist/cjs/components/AgentDetailsCard.cjs +93 -0
  3. package/dist/cjs/components/AnalyticsBox.cjs +58 -0
  4. package/dist/cjs/components/AnalyticsSection.cjs +161 -0
  5. package/dist/cjs/components/BookingChart.cjs +126 -0
  6. package/dist/cjs/components/BookingChart.styled.cjs +46 -0
  7. package/dist/cjs/components/BookingTable.cjs +53 -0
  8. package/dist/cjs/components/BookingTableRow.cjs +107 -0
  9. package/dist/cjs/components/BookingTableRow.styled.cjs +21 -0
  10. package/dist/cjs/components/BookingTableRowHeader.cjs +66 -0
  11. package/dist/cjs/components/BookingTableRowSkeleton.cjs +97 -0
  12. package/dist/cjs/components/CheckedIcon.cjs +23 -0
  13. package/dist/cjs/components/EnquiriesDoughnutChart.cjs +144 -0
  14. package/dist/cjs/components/GridList.cjs +80 -0
  15. package/dist/cjs/components/Hidden.cjs +18 -0
  16. package/dist/cjs/components/IconLabel.cjs +44 -0
  17. package/dist/cjs/components/NotesCard.cjs +67 -0
  18. package/dist/cjs/components/PropertyCard.cjs +145 -0
  19. package/dist/cjs/components/PropertyCard.styled.cjs +24 -0
  20. package/dist/cjs/index.cjs +36 -0
  21. package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +120 -0
  22. package/dist/esm/components/AgentDetailsCard.js +89 -0
  23. package/dist/esm/components/AnalyticsBox.js +54 -0
  24. package/dist/esm/components/AnalyticsSection.js +157 -0
  25. package/dist/esm/components/BookingChart.js +122 -0
  26. package/dist/esm/components/BookingChart.styled.js +40 -0
  27. package/dist/esm/components/BookingTable.js +49 -0
  28. package/dist/esm/components/BookingTableRow.js +103 -0
  29. package/dist/esm/components/BookingTableRow.styled.js +19 -0
  30. package/dist/esm/components/BookingTableRowHeader.js +62 -0
  31. package/dist/esm/components/BookingTableRowSkeleton.js +93 -0
  32. package/dist/esm/components/CheckedIcon.js +19 -0
  33. package/dist/esm/components/EnquiriesDoughnutChart.js +140 -0
  34. package/dist/esm/components/GridList.js +76 -0
  35. package/dist/esm/components/Hidden.js +14 -0
  36. package/dist/esm/components/IconLabel.js +40 -0
  37. package/dist/esm/components/NotesCard.js +63 -0
  38. package/dist/esm/components/PropertyCard.js +141 -0
  39. package/dist/esm/components/PropertyCard.styled.js +20 -0
  40. package/dist/esm/index.js +16 -0
  41. package/package.json +5 -5
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
3
+ import React from 'react';
4
+ import { Grid, Box, Pagination, Select } from '@tenancy.nz/ui';
5
+ import Hidden from './Hidden.js';
6
+
7
+ var _excluded = ["items", "children", "renderItem", "headerComponent", "footerComponent", "spacing", "loading", "loadingComponent", "emptyComponent", "currentPage", "totalPages", "onChangePage", "showHeaderComponent", "resultsPerPage", "onChangeResultsPerPage", "perPage", "scrollTopOnChangePage"];
8
+ function GridList(_ref) {
9
+ var items = _ref.items,
10
+ children = _ref.children,
11
+ renderItem = _ref.renderItem,
12
+ headerComponent = _ref.headerComponent,
13
+ footerComponent = _ref.footerComponent,
14
+ spacing = _ref.spacing,
15
+ loading = _ref.loading,
16
+ loadingComponent = _ref.loadingComponent,
17
+ emptyComponent = _ref.emptyComponent,
18
+ currentPage = _ref.currentPage,
19
+ totalPages = _ref.totalPages,
20
+ onChangePage = _ref.onChangePage,
21
+ showHeaderComponent = _ref.showHeaderComponent,
22
+ resultsPerPage = _ref.resultsPerPage,
23
+ onChangeResultsPerPage = _ref.onChangeResultsPerPage,
24
+ perPage = _ref.perPage,
25
+ scrollTopOnChangePage = _ref.scrollTopOnChangePage,
26
+ rest = _objectWithoutProperties(_ref, _excluded);
27
+ var gridContainerRef = React.useRef(null);
28
+ var childLen = React.Children.count(children);
29
+ var isChildren = childLen > 0;
30
+ var listLength = 0;
31
+ if (!isChildren) {
32
+ listLength = Array.isArray(items) ? items.length : 0;
33
+ } else {
34
+ listLength = childLen;
35
+ }
36
+ var isEmpty = listLength === 0;
37
+ React.useEffect(function () {
38
+ if (scrollTopOnChangePage && currentPage > 1 && !loading && gridContainerRef && gridContainerRef.current) {
39
+ gridContainerRef.current.scrollIntoView();
40
+ }
41
+ }, [currentPage, loading, gridContainerRef, scrollTopOnChangePage]);
42
+ return /* @__PURE__ */React.createElement(React.Fragment, null, showHeaderComponent && headerComponent, loading && /* @__PURE__ */React.createElement(React.Fragment, null, loadingComponent), !loading && isEmpty && /* @__PURE__ */React.createElement(React.Fragment, null, emptyComponent), !loading && !isEmpty && /* @__PURE__ */React.createElement("div", {
43
+ ref: gridContainerRef,
44
+ style: {
45
+ width: "100%"
46
+ }
47
+ }, /* @__PURE__ */React.createElement(Grid, _objectSpread2(_objectSpread2({
48
+ container: true
49
+ }, rest), {}, {
50
+ spacing: spacing
51
+ }), isChildren ? children : items.map(renderItem))), typeof onChangePage === "function" && /* @__PURE__ */React.createElement(Hidden, {
52
+ hide: isEmpty
53
+ }, /* @__PURE__ */React.createElement(Box, {
54
+ display: "flex",
55
+ justify: "center",
56
+ align: "center",
57
+ direction: "column",
58
+ marginTop: 12
59
+ }, /* @__PURE__ */React.createElement(Pagination, {
60
+ page: currentPage,
61
+ count: totalPages,
62
+ color: "textPrimary",
63
+ shape: "round",
64
+ size: "large",
65
+ onChange: onChangePage
66
+ }), typeof onChangeResultsPerPage === "function" && /* @__PURE__ */React.createElement(Box, {
67
+ mt: 4
68
+ }, /* @__PURE__ */React.createElement(Select, {
69
+ name: "gridListSelect",
70
+ value: perPage,
71
+ options: resultsPerPage,
72
+ onChange: onChangeResultsPerPage
73
+ })))), footerComponent);
74
+ }
75
+
76
+ export { GridList as default };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ import 'react';
3
+
4
+ function Hidden(_ref) {
5
+ var _ref$hide = _ref.hide,
6
+ hide = _ref$hide === void 0 ? false : _ref$hide,
7
+ children = _ref.children;
8
+ if (hide) {
9
+ return null;
10
+ }
11
+ return children;
12
+ }
13
+
14
+ export { Hidden as default };
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
3
+ import React from 'react';
4
+ import { Box } from '@tenancy.nz/ui';
5
+
6
+ var _excluded = ["children", "endIcon", "startIcon", "onClick"];
7
+ function IconLabel(_ref) {
8
+ var children = _ref.children,
9
+ _ref$endIcon = _ref.endIcon,
10
+ endIcon = _ref$endIcon === void 0 ? void 0 : _ref$endIcon,
11
+ _ref$startIcon = _ref.startIcon,
12
+ startIcon = _ref$startIcon === void 0 ? void 0 : _ref$startIcon,
13
+ _ref$onClick = _ref.onClick,
14
+ onClick = _ref$onClick === void 0 ? void 0 : _ref$onClick,
15
+ rest = _objectWithoutProperties(_ref, _excluded);
16
+ var iconLabel = /* @__PURE__ */React.createElement(Box, _objectSpread2({
17
+ align: "center",
18
+ display: "inline-flex"
19
+ }, rest), startIcon && /* @__PURE__ */React.createElement(Box, {
20
+ display: "inline-flex",
21
+ color: "inherit",
22
+ fontSize: "inherit"
23
+ }, startIcon), children && /* @__PURE__ */React.createElement(Box, {
24
+ display: "inline-flex",
25
+ color: "inherit",
26
+ fontSize: "inherit",
27
+ marginLeft: startIcon ? 1 : 0,
28
+ marginRight: endIcon ? 1 : 0,
29
+ fontWeight: "inherit"
30
+ }, children), endIcon && /* @__PURE__ */React.createElement(Box, {
31
+ display: "inline-flex",
32
+ color: "text.muted",
33
+ marginLeft: 1
34
+ }, endIcon));
35
+ return /* @__PURE__ */React.createElement(React.Fragment, null, typeof onClick === "function" ? /* @__PURE__ */React.createElement(Box, {
36
+ onClick: onClick
37
+ }, iconLabel) : iconLabel);
38
+ }
39
+
40
+ export { IconLabel as default };
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
3
+ import React from 'react';
4
+ import { Paper, Box, Skeleton, Text, Tag } from '@tenancy.nz/ui';
5
+
6
+ var _excluded = ["loading", "tag", "text"];
7
+ var tagMap = function tagMap(name) {
8
+ if (typeof name !== "string") {
9
+ return name;
10
+ }
11
+ if (name === "feedback") {
12
+ return /* @__PURE__ */React.createElement(Tag, {
13
+ color: "info",
14
+ label: "Feedback"
15
+ });
16
+ }
17
+ if (name === "maintenance") {
18
+ return /* @__PURE__ */React.createElement(Tag, {
19
+ color: "orange",
20
+ label: "Maintenance"
21
+ });
22
+ }
23
+ return name;
24
+ };
25
+ function NotesCard(_ref) {
26
+ var _ref$loading = _ref.loading,
27
+ loading = _ref$loading === void 0 ? false : _ref$loading,
28
+ _ref$tag = _ref.tag,
29
+ tag = _ref$tag === void 0 ? void 0 : _ref$tag,
30
+ _ref$text = _ref.text,
31
+ text = _ref$text === void 0 ? void 0 : _ref$text,
32
+ rest = _objectWithoutProperties(_ref, _excluded);
33
+ return /* @__PURE__ */React.createElement(Paper, _objectSpread2({
34
+ inset: "medium",
35
+ sx: {
36
+ minHeight: "100%"
37
+ }
38
+ }, rest), /* @__PURE__ */React.createElement(Box, {
39
+ mb: "8px",
40
+ mt: loading ? "-5px" : "0px"
41
+ }, loading ? /* @__PURE__ */React.createElement(Skeleton, {
42
+ width: "114px",
43
+ height: "30px",
44
+ variant: "text"
45
+ }) : tagMap(tag)), loading && /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(Skeleton, {
46
+ width: "90%",
47
+ height: "20px",
48
+ variant: "text"
49
+ }), /* @__PURE__ */React.createElement(Skeleton, {
50
+ width: "80%",
51
+ height: "20px",
52
+ variant: "text"
53
+ }), /* @__PURE__ */React.createElement(Skeleton, {
54
+ width: "70%",
55
+ height: "20px",
56
+ variant: "text"
57
+ })), !loading && /* @__PURE__ */React.createElement(Text, {
58
+ variant: "body2",
59
+ weight: "400"
60
+ }, text));
61
+ }
62
+
63
+ export { NotesCard as default };
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
3
+ import React from 'react';
4
+ import { Paper, Media, Box, Heading, Text } from '@tenancy.nz/ui';
5
+ import { Icon } from '@tenancy.nz/icons';
6
+ import IconLabel from './IconLabel.js';
7
+ import { StyledPropertyImage, StyledPropertyDetailsBox, StyledPropertyAmenitiesBox } from './PropertyCard.styled.js';
8
+
9
+ var _excluded = ["address", "compact", "enquiriesCount", "imgSrc", "noOfBedrooms", "noOfBathrooms", "noOfCarparks", "rent", "viewingsCount"];
10
+ function PropertyCard(_ref) {
11
+ var _ref$address = _ref.address,
12
+ address = _ref$address === void 0 ? void 0 : _ref$address,
13
+ _ref$compact = _ref.compact,
14
+ compact = _ref$compact === void 0 ? false : _ref$compact,
15
+ _ref$enquiriesCount = _ref.enquiriesCount,
16
+ enquiriesCount = _ref$enquiriesCount === void 0 ? void 0 : _ref$enquiriesCount,
17
+ imgSrc = _ref.imgSrc,
18
+ _ref$noOfBedrooms = _ref.noOfBedrooms,
19
+ noOfBedrooms = _ref$noOfBedrooms === void 0 ? void 0 : _ref$noOfBedrooms,
20
+ _ref$noOfBathrooms = _ref.noOfBathrooms,
21
+ noOfBathrooms = _ref$noOfBathrooms === void 0 ? void 0 : _ref$noOfBathrooms,
22
+ _ref$noOfCarparks = _ref.noOfCarparks,
23
+ noOfCarparks = _ref$noOfCarparks === void 0 ? void 0 : _ref$noOfCarparks,
24
+ _ref$rent = _ref.rent,
25
+ rent = _ref$rent === void 0 ? void 0 : _ref$rent,
26
+ _ref$viewingsCount = _ref.viewingsCount,
27
+ viewingsCount = _ref$viewingsCount === void 0 ? void 0 : _ref$viewingsCount,
28
+ rest = _objectWithoutProperties(_ref, _excluded);
29
+ return /* @__PURE__ */React.createElement(Paper, _objectSpread2({
30
+ overflow: false,
31
+ sx: {
32
+ display: "flex",
33
+ alignItems: "center"
34
+ }
35
+ }, rest), /* @__PURE__ */React.createElement(StyledPropertyImage, null, /* @__PURE__ */React.createElement(Media, {
36
+ as: "img",
37
+ title: address,
38
+ src: imgSrc
39
+ })), /* @__PURE__ */React.createElement(StyledPropertyDetailsBox, null, /* @__PURE__ */React.createElement(Box, null, /* @__PURE__ */React.createElement(Heading, {
40
+ as: "h4",
41
+ weight: "700"
42
+ }, address)), /* @__PURE__ */React.createElement(Box, {
43
+ sx: {
44
+ display: "flex",
45
+ alignItems: "center",
46
+ ml: {
47
+ sm: "auto"
48
+ },
49
+ mt: {
50
+ xs: "10px",
51
+ sm: 0
52
+ },
53
+ "@media print": {
54
+ ml: "auto"
55
+ }
56
+ }
57
+ }, /* @__PURE__ */React.createElement(StyledPropertyAmenitiesBox, null, rent && /* @__PURE__ */React.createElement(Heading, {
58
+ as: "h4",
59
+ weight: "700"
60
+ }, rent), /* @__PURE__ */React.createElement(Box, {
61
+ fontSize: "16px"
62
+ }, noOfBedrooms && /* @__PURE__ */React.createElement(IconLabel, {
63
+ color: "text.primary",
64
+ startIcon: /* @__PURE__ */React.createElement(Icon, {
65
+ size: 21,
66
+ color: "inherit",
67
+ name: "bed"
68
+ })
69
+ }, /* @__PURE__ */React.createElement(Text, {
70
+ as: "span",
71
+ variant: "inherit"
72
+ }, noOfBedrooms)), noOfBathrooms && /* @__PURE__ */React.createElement(IconLabel, {
73
+ color: "text.primary",
74
+ startIcon: /* @__PURE__ */React.createElement(Icon, {
75
+ size: 21,
76
+ color: "inherit",
77
+ name: "bath"
78
+ }),
79
+ marginLeft: 3
80
+ }, /* @__PURE__ */React.createElement(Text, {
81
+ as: "span",
82
+ variant: "inherit"
83
+ }, noOfBathrooms)), noOfCarparks && /* @__PURE__ */React.createElement(IconLabel, {
84
+ color: "text.primary",
85
+ startIcon: /* @__PURE__ */React.createElement(Icon, {
86
+ size: 21,
87
+ color: "inherit",
88
+ name: "car"
89
+ }),
90
+ marginLeft: 3
91
+ }, /* @__PURE__ */React.createElement(Text, {
92
+ as: "span",
93
+ variant: "inherit"
94
+ }, noOfCarparks)))), !compact && /* @__PURE__ */React.createElement(Box, {
95
+ paddingLeft: "25px",
96
+ borderLeft: "1px solid #00000040",
97
+ display: "flex",
98
+ direction: "column",
99
+ sx: {
100
+ gap: {
101
+ xs: "18px",
102
+ lg: "10px",
103
+ xl: 0
104
+ },
105
+ justifyContent: "space-between"
106
+ }
107
+ }, viewingsCount && /* @__PURE__ */React.createElement(Box, {
108
+ display: "flex",
109
+ align: "center",
110
+ gap: "12px"
111
+ }, /* @__PURE__ */React.createElement(Box, {
112
+ minWidth: "87px"
113
+ }, /* @__PURE__ */React.createElement(Text, {
114
+ transform: "uppercase",
115
+ color: "textPrimary",
116
+ as: "span",
117
+ weight: "600",
118
+ align: "right",
119
+ lineHeight: "15px"
120
+ }, "Viewings")), /* @__PURE__ */React.createElement(Heading, {
121
+ as: "h2"
122
+ }, viewingsCount)), enquiriesCount && /* @__PURE__ */React.createElement(Box, {
123
+ display: "flex",
124
+ align: "center",
125
+ gap: "12px"
126
+ }, /* @__PURE__ */React.createElement(Box, {
127
+ minWidth: "87px"
128
+ }, /* @__PURE__ */React.createElement(Text, {
129
+ transform: "uppercase",
130
+ color: "textPrimary",
131
+ as: "span",
132
+ weight: "600",
133
+ minWidth: "87px",
134
+ align: "right",
135
+ lineHeight: "15px"
136
+ }, "Enquiries")), /* @__PURE__ */React.createElement(Heading, {
137
+ as: "h2"
138
+ }, enquiriesCount))))));
139
+ }
140
+
141
+ export { PropertyCard as default };
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ import { taggedTemplateLiteral as _taggedTemplateLiteral } from '../_virtual/_rollupPluginBabelHelpers.js';
3
+ import { css } from '@emotion/react';
4
+ import styled from '@emotion/styled';
5
+
6
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
7
+ var StyledPropertyImage = styled.figure(_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) {
8
+ var theme = _ref.theme;
9
+ 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"));
10
+ });
11
+ var StyledPropertyDetailsBox = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n width: 100%;\n align-items: flex-start;\n padding: 16px 24px 16px 20px;\n flex-direction: column;\n\n ", "\n\n @media print {\n flex-direction: row;\n align-items: center;\n }\n"])), function (_ref2) {
12
+ var theme = _ref2.theme;
13
+ return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", " {\n flex-direction: row;\n align-items: center;\n }\n "])), theme.breakpoints.up("sm"));
14
+ });
15
+ var StyledPropertyAmenitiesBox = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding-right: 25px;\n display: flex;\n flex-direction: column;\n margin-top: 5px;\n\n gap: 18px;\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) {
16
+ var theme = _ref3.theme;
17
+ return "\n @media (min-width: ".concat(theme.breakpoints.values.md, "px) {\n align-items: flex-end;\n }\n ");
18
+ });
19
+
20
+ export { StyledPropertyAmenitiesBox, StyledPropertyDetailsBox, StyledPropertyImage };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ export { default as AgentDetailsCard } from './components/AgentDetailsCard.js';
3
+ export { default as AnalyticsBox } from './components/AnalyticsBox.js';
4
+ export { default as AnalyticsSection } from './components/AnalyticsSection.js';
5
+ export { default as BookingChart } from './components/BookingChart.js';
6
+ export { default as BookingTable } from './components/BookingTable.js';
7
+ export { default as BookingTableRow } from './components/BookingTableRow.js';
8
+ export { default as BookingTableRowHeader } from './components/BookingTableRowHeader.js';
9
+ export { default as BookingTableRowSkeleton } from './components/BookingTableRowSkeleton.js';
10
+ export { default as CheckedIcon } from './components/CheckedIcon.js';
11
+ export { default as EnquiriesDoughnutChart } from './components/EnquiriesDoughnutChart.js';
12
+ export { default as GridList } from './components/GridList.js';
13
+ export { default as Hidden } from './components/Hidden.js';
14
+ export { default as IconLabel } from './components/IconLabel.js';
15
+ export { default as NotesCard } from './components/NotesCard.js';
16
+ export { default as PropertyCard } from './components/PropertyCard.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.0.0",
4
+ "version": "1.0.2",
5
5
  "author": "TPS <https://www.tenancy.co.nz>",
6
6
  "type": "module",
7
7
  "main": "dist/cjs/index.cjs",
@@ -18,14 +18,14 @@
18
18
  "primereact": "^3.1.3",
19
19
  "react": ">= 16.0.0 <= 18.3.1",
20
20
  "react-dom": ">= 16.0.0 <= 18.3.1",
21
- "@tenancy.nz/icons": "1.0.0",
22
- "@tenancy.nz/ui": "1.0.0"
21
+ "@tenancy.nz/icons": "1.0.2",
22
+ "@tenancy.nz/ui": "1.0.5"
23
23
  },
24
24
  "devDependencies": {
25
25
  "react": "^19.1.0",
26
26
  "react-dom": "^19.1.0",
27
- "@tenancy.nz/icons": "1.0.0",
28
- "@tenancy.nz/ui": "1.0.0"
27
+ "@tenancy.nz/icons": "1.0.2",
28
+ "@tenancy.nz/ui": "1.0.5"
29
29
  },
30
30
  "dependencies": {
31
31
  "react-uid": "^2.4.0"