@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,134 @@
1
+ 'use strict';
2
+
3
+ function _arrayLikeToArray(r, a) {
4
+ (null == a || a > r.length) && (a = r.length);
5
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
6
+ return n;
7
+ }
8
+ function _arrayWithHoles(r) {
9
+ if (Array.isArray(r)) return r;
10
+ }
11
+ function _defineProperty(e, r, t) {
12
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
13
+ value: t,
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true
17
+ }) : e[r] = t, e;
18
+ }
19
+ function _iterableToArrayLimit(r, l) {
20
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
21
+ if (null != t) {
22
+ var e,
23
+ n,
24
+ i,
25
+ u,
26
+ a = [],
27
+ f = true,
28
+ o = false;
29
+ try {
30
+ if (i = (t = t.call(r)).next, 0 === l) {
31
+ if (Object(t) !== t) return;
32
+ f = !1;
33
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
34
+ } catch (r) {
35
+ o = true, n = r;
36
+ } finally {
37
+ try {
38
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
39
+ } finally {
40
+ if (o) throw n;
41
+ }
42
+ }
43
+ return a;
44
+ }
45
+ }
46
+ function _nonIterableRest() {
47
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
48
+ }
49
+ function ownKeys(e, r) {
50
+ var t = Object.keys(e);
51
+ if (Object.getOwnPropertySymbols) {
52
+ var o = Object.getOwnPropertySymbols(e);
53
+ r && (o = o.filter(function (r) {
54
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
55
+ })), t.push.apply(t, o);
56
+ }
57
+ return t;
58
+ }
59
+ function _objectSpread2(e) {
60
+ for (var r = 1; r < arguments.length; r++) {
61
+ var t = null != arguments[r] ? arguments[r] : {};
62
+ r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
63
+ _defineProperty(e, r, t[r]);
64
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
65
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
66
+ });
67
+ }
68
+ return e;
69
+ }
70
+ function _objectWithoutProperties(e, t) {
71
+ if (null == e) return {};
72
+ var o,
73
+ r,
74
+ i = _objectWithoutPropertiesLoose(e, t);
75
+ if (Object.getOwnPropertySymbols) {
76
+ var n = Object.getOwnPropertySymbols(e);
77
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
78
+ }
79
+ return i;
80
+ }
81
+ function _objectWithoutPropertiesLoose(r, e) {
82
+ if (null == r) return {};
83
+ var t = {};
84
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
85
+ if (-1 !== e.indexOf(n)) continue;
86
+ t[n] = r[n];
87
+ }
88
+ return t;
89
+ }
90
+ function _slicedToArray(r, e) {
91
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
92
+ }
93
+ function _taggedTemplateLiteral(e, t) {
94
+ return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, {
95
+ raw: {
96
+ value: Object.freeze(t)
97
+ }
98
+ }));
99
+ }
100
+ function _toPrimitive(t, r) {
101
+ if ("object" != typeof t || !t) return t;
102
+ var e = t[Symbol.toPrimitive];
103
+ if (void 0 !== e) {
104
+ var i = e.call(t, r);
105
+ if ("object" != typeof i) return i;
106
+ throw new TypeError("@@toPrimitive must return a primitive value.");
107
+ }
108
+ return ("string" === r ? String : Number)(t);
109
+ }
110
+ function _toPropertyKey(t) {
111
+ var i = _toPrimitive(t, "string");
112
+ return "symbol" == typeof i ? i : i + "";
113
+ }
114
+ function _unsupportedIterableToArray(r, a) {
115
+ if (r) {
116
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
117
+ var t = {}.toString.call(r).slice(8, -1);
118
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
119
+ }
120
+ }
121
+
122
+ exports.arrayLikeToArray = _arrayLikeToArray;
123
+ exports.arrayWithHoles = _arrayWithHoles;
124
+ exports.defineProperty = _defineProperty;
125
+ exports.iterableToArrayLimit = _iterableToArrayLimit;
126
+ exports.nonIterableRest = _nonIterableRest;
127
+ exports.objectSpread2 = _objectSpread2;
128
+ exports.objectWithoutProperties = _objectWithoutProperties;
129
+ exports.objectWithoutPropertiesLoose = _objectWithoutPropertiesLoose;
130
+ exports.slicedToArray = _slicedToArray;
131
+ exports.taggedTemplateLiteral = _taggedTemplateLiteral;
132
+ exports.toPrimitive = _toPrimitive;
133
+ exports.toPropertyKey = _toPropertyKey;
134
+ exports.unsupportedIterableToArray = _unsupportedIterableToArray;
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var React = require('react');
7
+ var ui = require('@tenancy.nz/ui');
8
+ var icons = require('@tenancy.nz/icons');
9
+ var IconLabel = require('./IconLabel.cjs');
10
+
11
+ function AgentDetailsCard(_ref) {
12
+ var _ref$email = _ref.email,
13
+ email = _ref$email === void 0 ? void 0 : _ref$email,
14
+ _ref$loading = _ref.loading,
15
+ loading = _ref$loading === void 0 ? false : _ref$loading,
16
+ _ref$logo = _ref.logo,
17
+ logo = _ref$logo === void 0 ? void 0 : _ref$logo,
18
+ _ref$name = _ref.name,
19
+ name = _ref$name === void 0 ? void 0 : _ref$name,
20
+ _ref$phone = _ref.phone,
21
+ phone = _ref$phone === void 0 ? void 0 : _ref$phone;
22
+ return /* @__PURE__ */React.createElement(ui.Box, {
23
+ display: "flex",
24
+ gap: "8px",
25
+ align: "flex-start"
26
+ }, /* @__PURE__ */React.createElement(ui.Box, {
27
+ display: "flex",
28
+ gap: "8px",
29
+ direction: "column",
30
+ width: "100%"
31
+ }, loading ? /* @__PURE__ */React.createElement(ui.Skeleton, {
32
+ width: "75%",
33
+ height: "22px",
34
+ variant: "text"
35
+ }) : /* @__PURE__ */React.createElement(IconLabel.default, {
36
+ color: "tertiary.main",
37
+ startIcon: /* @__PURE__ */React.createElement(icons.UserIcon, {
38
+ size: "24px"
39
+ })
40
+ }, /* @__PURE__ */React.createElement(ui.Heading, {
41
+ as: "h5",
42
+ weight: "700"
43
+ }, name)), loading ? /* @__PURE__ */React.createElement(ui.Skeleton, {
44
+ width: "55%",
45
+ height: "18px",
46
+ variant: "text"
47
+ }) : /* @__PURE__ */React.createElement(IconLabel.default, {
48
+ color: "tertiary.main",
49
+ startIcon: /* @__PURE__ */React.createElement(icons.PhoneIcon, {
50
+ size: "24px"
51
+ })
52
+ }, /* @__PURE__ */React.createElement(ui.Text, {
53
+ as: "span",
54
+ color: "text.primary",
55
+ variant: "body1",
56
+ weight: "400"
57
+ }, phone)), loading ? /* @__PURE__ */React.createElement(ui.Skeleton, {
58
+ width: "55%",
59
+ height: "18px",
60
+ variant: "text"
61
+ }) : /* @__PURE__ */React.createElement(IconLabel.default, {
62
+ color: "tertiary.main",
63
+ startIcon: /* @__PURE__ */React.createElement(icons.EnvelopeIcon, {
64
+ size: "24px"
65
+ })
66
+ }, /* @__PURE__ */React.createElement(ui.Text, {
67
+ as: "span",
68
+ color: "text.primary",
69
+ variant: "body1",
70
+ weight: "400"
71
+ }, email))), loading && /* @__PURE__ */React.createElement(ui.Box, {
72
+ flex: "0 0 40px"
73
+ }, /* @__PURE__ */React.createElement(ui.Skeleton, {
74
+ width: "40px",
75
+ height: "40px",
76
+ variant: "rectangular"
77
+ })), logo && !loading && /* @__PURE__ */React.createElement(ui.Box, {
78
+ width: "40px",
79
+ height: "40px",
80
+ sx: {
81
+ flex: "0 0 40px",
82
+ "> img": {
83
+ maxWidth: "100%",
84
+ maxHeight: "100%"
85
+ }
86
+ }
87
+ }, /* @__PURE__ */React.createElement("img", {
88
+ src: logo,
89
+ alt: "Agency Logo"
90
+ })));
91
+ }
92
+
93
+ exports.default = AgentDetailsCard;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _rollupPluginBabelHelpers = require('../_virtual/_rollupPluginBabelHelpers.cjs');
7
+ var React = require('react');
8
+ var ui = require('@tenancy.nz/ui');
9
+
10
+ var _excluded = ["width", "minWidth", "maxWidth", "height", "border", "label", "amount", "text"];
11
+ function AnalyticsBox(_ref) {
12
+ var width = _ref.width,
13
+ minWidth = _ref.minWidth,
14
+ maxWidth = _ref.maxWidth,
15
+ height = _ref.height,
16
+ border = _ref.border,
17
+ label = _ref.label,
18
+ amount = _ref.amount,
19
+ text = _ref.text,
20
+ rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
21
+ return /* @__PURE__ */React.createElement(ui.Paper, _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, rest), {}, {
22
+ sx: {
23
+ maxWidth: maxWidth,
24
+ width: width,
25
+ minWidth: minWidth,
26
+ border: border,
27
+ height: height || "100%",
28
+ display: "flex",
29
+ alignItems: "center",
30
+ justifyContent: "center",
31
+ padding: "16px"
32
+ }
33
+ }), /* @__PURE__ */React.createElement(ui.Box, null, /* @__PURE__ */React.createElement(ui.Heading, {
34
+ align: "center",
35
+ weight: "700",
36
+ as: "h3",
37
+ gutterBottom: true
38
+ }, amount), /* @__PURE__ */React.createElement(ui.Text, {
39
+ align: "center",
40
+ weight: "400",
41
+ variant: "body2"
42
+ }, label), text && /* @__PURE__ */React.createElement(ui.Text, {
43
+ align: "center",
44
+ weight: "400",
45
+ sx: {
46
+ fontSize: {
47
+ xs: 8,
48
+ sm: 10,
49
+ xl: 14
50
+ },
51
+ lineHeight: "15.6px",
52
+ maxWidth: "366px",
53
+ mt: "8px"
54
+ }
55
+ }, text)));
56
+ }
57
+
58
+ exports.default = AnalyticsBox;
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var React = require('react');
7
+ var ui = require('@tenancy.nz/ui');
8
+ var AnalyticsBox = require('./AnalyticsBox.cjs');
9
+ var EnquiriesDoughnutChart = require('./EnquiriesDoughnutChart.cjs');
10
+
11
+ function AnalyticsSection(_ref) {
12
+ var viewingsCount = _ref.viewingsCount,
13
+ bookingsCount = _ref.bookingsCount,
14
+ attendeesCount = _ref.attendeesCount,
15
+ cancellationsCount = _ref.cancellationsCount,
16
+ applicationsCount = _ref.applicationsCount,
17
+ averageRent = _ref.averageRent,
18
+ textUsage = _ref.textUsage,
19
+ tradeMeEnquiriesCount = _ref.tradeMeEnquiriesCount,
20
+ bookMeEnquiriesCount = _ref.bookMeEnquiriesCount,
21
+ manualEnquiryCount = _ref.manualEnquiryCount,
22
+ agreementsCount = _ref.agreementsCount,
23
+ agreementsFinalisedCount = _ref.agreementsFinalisedCount,
24
+ filterDaysCount = _ref.filterDaysCount;
25
+ var isXlUp = ui.useMediaQuery(function (theme) {
26
+ return theme.breakpoints.up("xl");
27
+ });
28
+ return /* @__PURE__ */React.createElement(ui.Box, {
29
+ display: "flex",
30
+ align: "stretch",
31
+ direction: {
32
+ xs: "column-reverse",
33
+ mlg: "row"
34
+ },
35
+ gap: "27px"
36
+ }, /* @__PURE__ */React.createElement(ui.Box, {
37
+ width: "100%",
38
+ maxWidth: {
39
+ xs: "100%",
40
+ mob: "340px",
41
+ xl: "463px"
42
+ }
43
+ }, /* @__PURE__ */React.createElement(ui.Paper, {
44
+ style: {
45
+ width: "100%",
46
+ position: "relative",
47
+ height: "100%"
48
+ }
49
+ }, /* @__PURE__ */React.createElement(ui.Box, {
50
+ mt: "20px",
51
+ height: "100%"
52
+ }, /* @__PURE__ */React.createElement(EnquiriesDoughnutChart.default, {
53
+ tradeMeEnquiriesCount: tradeMeEnquiriesCount,
54
+ bookMeEnquiriesCount: bookMeEnquiriesCount,
55
+ manualEnquiryCount: manualEnquiryCount
56
+ })))), /* @__PURE__ */React.createElement(ui.Box, {
57
+ width: "100%"
58
+ }, /* @__PURE__ */React.createElement(ui.Box, {
59
+ display: "flex",
60
+ direction: "row",
61
+ width: "100%",
62
+ gap: 6
63
+ }, /* @__PURE__ */React.createElement(ui.Box, {
64
+ flex: 3
65
+ }, /* @__PURE__ */React.createElement(ui.Box, {
66
+ display: "flex",
67
+ gap: 6
68
+ }, /* @__PURE__ */React.createElement(AnalyticsBox.default, {
69
+ label: "Viewings",
70
+ amount: viewingsCount,
71
+ width: "100%",
72
+ height: isXlUp ? "157px" : "125px"
73
+ }), /* @__PURE__ */React.createElement(AnalyticsBox.default, {
74
+ label: "Bookings",
75
+ amount: bookingsCount,
76
+ width: "100%",
77
+ height: isXlUp ? "157px" : "125px"
78
+ }), /* @__PURE__ */React.createElement(AnalyticsBox.default, {
79
+ label: "Attendees",
80
+ amount: attendeesCount,
81
+ width: "100%",
82
+ border: "3px solid #6FD3C0",
83
+ height: isXlUp ? "157px" : "125px"
84
+ })), /* @__PURE__ */React.createElement(ui.Box, {
85
+ display: "flex",
86
+ width: "100%",
87
+ gap: 6,
88
+ mt: 6
89
+ }, /* @__PURE__ */React.createElement(AnalyticsBox.default, {
90
+ label: "Converted Properties",
91
+ amount: agreementsCount,
92
+ width: "100%",
93
+ height: isXlUp ? "157px" : "125px",
94
+ text: /* @__PURE__ */React.createElement(ui.Box, {
95
+ as: "span",
96
+ maxWidth: "276px"
97
+ }, "Properties that have had a viewing in the last", " ", /* @__PURE__ */React.createElement(ui.Text, {
98
+ as: "span",
99
+ display: "inline",
100
+ weight: "700",
101
+ fontSize: "inherit"
102
+ }, filterDaysCount), " ", "days where an agreement has been", " ", /* @__PURE__ */React.createElement(ui.Text, {
103
+ as: "span",
104
+ display: "inline",
105
+ weight: "700",
106
+ fontSize: "inherit"
107
+ }, "created"))
108
+ }), /* @__PURE__ */React.createElement(AnalyticsBox.default, {
109
+ label: "Converted Properties",
110
+ amount: agreementsFinalisedCount,
111
+ width: "100%",
112
+ height: isXlUp ? "157px" : "125px",
113
+ text: /* @__PURE__ */React.createElement(ui.Box, {
114
+ as: "span",
115
+ maxWidth: "276px"
116
+ }, "Properties that have had a viewing in the last", " ", /* @__PURE__ */React.createElement(ui.Text, {
117
+ as: "span",
118
+ display: "inline",
119
+ weight: "700",
120
+ fontSize: "inherit"
121
+ }, filterDaysCount), " ", "days where an agreement has been", " ", /* @__PURE__ */React.createElement(ui.Text, {
122
+ as: "span",
123
+ display: "inline",
124
+ weight: "700",
125
+ fontSize: "inherit"
126
+ }, "finalised"))
127
+ }))), /* @__PURE__ */React.createElement(ui.Box, {
128
+ flex: 2
129
+ }, /* @__PURE__ */React.createElement(ui.Box, {
130
+ display: "flex",
131
+ gap: 6
132
+ }, /* @__PURE__ */React.createElement(AnalyticsBox.default, {
133
+ label: "Cancellations",
134
+ amount: cancellationsCount,
135
+ width: "100%",
136
+ border: "3px solid #ED0D8D",
137
+ height: isXlUp ? "157px" : "125px"
138
+ }), /* @__PURE__ */React.createElement(AnalyticsBox.default, {
139
+ label: "Applications",
140
+ amount: applicationsCount,
141
+ width: "100%",
142
+ border: "3px solid #F5C440",
143
+ height: isXlUp ? "157px" : "125px"
144
+ })), /* @__PURE__ */React.createElement(ui.Box, {
145
+ display: "flex",
146
+ gap: 6,
147
+ mt: 6
148
+ }, /* @__PURE__ */React.createElement(AnalyticsBox.default, {
149
+ label: /* @__PURE__ */React.createElement("span", null, "Average", /* @__PURE__ */React.createElement("br", null), " Rent"),
150
+ amount: averageRent,
151
+ width: "100%",
152
+ height: isXlUp ? "157px" : "125px"
153
+ }), /* @__PURE__ */React.createElement(AnalyticsBox.default, {
154
+ label: /* @__PURE__ */React.createElement("span", null, "Text Usage", /* @__PURE__ */React.createElement("br", null), " Total"),
155
+ amount: textUsage,
156
+ width: "100%",
157
+ height: isXlUp ? "157px" : "125px"
158
+ }))))));
159
+ }
160
+
161
+ exports.default = AnalyticsSection;
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _rollupPluginBabelHelpers = require('../_virtual/_rollupPluginBabelHelpers.cjs');
7
+ var React = require('react');
8
+ var ui = require('@tenancy.nz/ui');
9
+ var chart = require('primereact/chart');
10
+ var BookingChart_styled = require('./BookingChart.styled.cjs');
11
+
12
+ var defaultOptions = {
13
+ scaleFontColor: "black",
14
+ legend: {
15
+ display: false
16
+ },
17
+ plugins: {
18
+ datalabels: {
19
+ align: "centre",
20
+ font: {
21
+ weight: "700",
22
+ size: 12,
23
+ family: "Montserrat, sans-serif"
24
+ },
25
+ display: function display(ctx) {
26
+ return ctx.dataset.data[ctx.dataIndex] > 0;
27
+ }
28
+ }
29
+ },
30
+ scales: {
31
+ xAxes: [{
32
+ gridLines: {
33
+ labelString: "Date",
34
+ display: false
35
+ },
36
+ ticks: {
37
+ fontSize: 13,
38
+ family: "Montserrat, sans-serif",
39
+ fontWeight: "bold"
40
+ },
41
+ stacked: true
42
+ }],
43
+ yAxes: [{
44
+ scaleLabel: {
45
+ display: true,
46
+ labelString: "Total bookings",
47
+ fontFamily: "Montserrat, sans-serif",
48
+ fontSize: 13,
49
+ fontStyle: "600"
50
+ },
51
+ ticks: {
52
+ min: 0,
53
+ stepSize: 5,
54
+ fontSize: 13,
55
+ fontWeight: 500
56
+ },
57
+ gridLines: {
58
+ display: false
59
+ },
60
+ stacked: true
61
+ }]
62
+ }
63
+ };
64
+ function BookingChart(_ref) {
65
+ var data = _ref.data,
66
+ labels = _ref.labels,
67
+ _ref$mode = _ref.mode,
68
+ mode = _ref$mode === void 0 ? "day" : _ref$mode,
69
+ _ref$options = _ref.options,
70
+ options = _ref$options === void 0 ? {} : _ref$options,
71
+ _ref$onModeChange = _ref.onModeChange,
72
+ onModeChange = _ref$onModeChange === void 0 ? void 0 : _ref$onModeChange;
73
+ var legends = React.useMemo(function () {
74
+ return data.map(function (_ref2) {
75
+ var label = _ref2.label,
76
+ backgroundColor = _ref2.backgroundColor;
77
+ return [label, backgroundColor];
78
+ }).filter(function (_ref3, i, items) {
79
+ var _ref4 = _rollupPluginBabelHelpers.slicedToArray(_ref3, 1),
80
+ label = _ref4[0];
81
+ return items.findIndex(function (_ref5) {
82
+ var _ref6 = _rollupPluginBabelHelpers.slicedToArray(_ref5, 1),
83
+ l = _ref6[0];
84
+ return l === label;
85
+ }) === i;
86
+ });
87
+ }, [data]);
88
+ return /* @__PURE__ */React.createElement(ui.Box, {
89
+ display: "flex",
90
+ direction: "column",
91
+ gap: "16px",
92
+ width: "100%"
93
+ }, legends.length > 0 && /* @__PURE__ */React.createElement(BookingChart_styled.StyledBookingChartStack, null, legends.map(function (_ref7) {
94
+ var _ref8 = _rollupPluginBabelHelpers.slicedToArray(_ref7, 2),
95
+ label = _ref8[0],
96
+ backgroundColor = _ref8[1];
97
+ return /* @__PURE__ */React.createElement(BookingChart_styled.StyledBookingChartLegend, {
98
+ key: label,
99
+ color: backgroundColor
100
+ }, label);
101
+ })), /* @__PURE__ */React.createElement(ui.Box, {
102
+ width: "100%",
103
+ overflow: "hidden"
104
+ }, /* @__PURE__ */React.createElement(chart.Chart, {
105
+ type: "bar",
106
+ data: {
107
+ labels: labels,
108
+ datasets: data
109
+ },
110
+ options: _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, defaultOptions), options)
111
+ })), onModeChange && /* @__PURE__ */React.createElement(BookingChart_styled.StyledBookingChartStack, null, /* @__PURE__ */React.createElement(BookingChart_styled.StyledBookingChartButton, {
112
+ onClick: onModeChange,
113
+ active: mode === "day",
114
+ value: "day"
115
+ }, "Day"), /* @__PURE__ */React.createElement(BookingChart_styled.StyledBookingChartButton, {
116
+ onClick: onModeChange,
117
+ active: mode === "week",
118
+ value: "week"
119
+ }, "Week"), /* @__PURE__ */React.createElement(BookingChart_styled.StyledBookingChartButton, {
120
+ onClick: onModeChange,
121
+ active: mode === "month",
122
+ value: "month"
123
+ }, "Month")));
124
+ }
125
+
126
+ exports.default = BookingChart;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ var _rollupPluginBabelHelpers = require('../_virtual/_rollupPluginBabelHelpers.cjs');
5
+ var react = require('@emotion/react');
6
+ var styled = require('@emotion/styled');
7
+
8
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
9
+ var StyledBookingChartStack = styled.div(_templateObject || (_templateObject = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n padding: 0;\n margin: 0;\n list-style: none;\n font-size: 12px;\n justify-content: center;\n color: #000;\n width: 100%;\n"])));
10
+ var StyledBookingChartLegend = styled("span", {
11
+ shouldForwardProp: function shouldForwardProp(prop) {
12
+ return !["color"].includes(prop);
13
+ }
14
+ })(_templateObject2 || (_templateObject2 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n font-weight: 500;\n display: flex;\n align-items: center;\n gap: 6px;\n\n &::before {\n content: '';\n display: inline-flex;\n width: 32px;\n height: 18px;\n background-color: ", ";\n border-radius: 4px;\n }\n"])), function (props) {
15
+ return props.color;
16
+ });
17
+ var StyledBookingChartButton = styled("button", {
18
+ shouldForwardProp: function shouldForwardProp(prop) {
19
+ return !["color"].includes(prop);
20
+ }
21
+ })(_templateObject3 || (_templateObject3 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n font-weight: 500;\n display: flex;\n align-items: center;\n padding: 6px 10px;\n font-size: 14px;\n border-radius: 4px;\n font-family: inherit;\n border: 1px solid ", ";\n box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.1);\n background-color: ", ";\n cursor: pointer;\n\n &:hover {\n background-color: ", ";\n }\n"])), function (_ref) {
22
+ var theme = _ref.theme;
23
+ return theme.palette.primary.main;
24
+ }, function (_ref2) {
25
+ var active = _ref2.active,
26
+ theme = _ref2.theme;
27
+ return active ? "#CEF3ED" : theme.palette.background.paper;
28
+ }, function (_ref3) {
29
+ var active = _ref3.active,
30
+ theme = _ref3.theme;
31
+ return !active ? theme.palette.grey[100] : null;
32
+ });
33
+ var StyledPropertyDetailsBox = styled.div(_templateObject4 || (_templateObject4 = _rollupPluginBabelHelpers.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 (_ref4) {
34
+ var theme = _ref4.theme;
35
+ return react.css(_templateObject5 || (_templateObject5 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n ", " {\n flex-direction: row;\n align-items: center;\n }\n "])), theme.breakpoints.up("sm"));
36
+ });
37
+ var StyledPropertyAmenitiesBox = styled.div(_templateObject6 || (_templateObject6 = _rollupPluginBabelHelpers.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\n @media print {\n align-items: flex-end;\n }\n"])), function (_ref5) {
38
+ var theme = _ref5.theme;
39
+ return "\n @media (min-width: ".concat(theme.breakpoints.values.md, "px) {\n align-items: flex-end;\n }\n ");
40
+ });
41
+
42
+ exports.StyledBookingChartButton = StyledBookingChartButton;
43
+ exports.StyledBookingChartLegend = StyledBookingChartLegend;
44
+ exports.StyledBookingChartStack = StyledBookingChartStack;
45
+ exports.StyledPropertyAmenitiesBox = StyledPropertyAmenitiesBox;
46
+ exports.StyledPropertyDetailsBox = StyledPropertyDetailsBox;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var React = require('react');
7
+ var reactUid = require('react-uid');
8
+ var ui = require('@tenancy.nz/ui');
9
+ var BookingTableRowHeader = require('./BookingTableRowHeader.cjs');
10
+ var BookingTableRow = require('./BookingTableRow.cjs');
11
+ var BookingTableRowSkeleton = require('./BookingTableRowSkeleton.cjs');
12
+
13
+ function BookingTable(_ref) {
14
+ var data = _ref.data,
15
+ _ref$loading = _ref.loading,
16
+ loading = _ref$loading === void 0 ? false : _ref$loading;
17
+ return /* @__PURE__ */React.createElement(ui.Box, {
18
+ sx: {
19
+ overflowX: "auto",
20
+ scrollBehavior: "smooth"
21
+ }
22
+ }, /* @__PURE__ */React.createElement(ui.Box, {
23
+ sx: {
24
+ minWidth: "1024px"
25
+ }
26
+ }, /* @__PURE__ */React.createElement(ui.Paper, {
27
+ outlined: true,
28
+ overflow: false
29
+ }, /* @__PURE__ */React.createElement(ui.Box, {
30
+ bgcolor: "grey.50"
31
+ }, /* @__PURE__ */React.createElement(BookingTableRowHeader.default, null)), /* @__PURE__ */React.createElement(ui.Box, null, !loading && data.map(function (booking, index) {
32
+ return /* @__PURE__ */React.createElement(BookingTableRow.default, {
33
+ key: reactUid.uid(booking, index),
34
+ firstName: booking.firstName,
35
+ lastName: booking.lastName,
36
+ notes: booking.notes,
37
+ tenantNotes: booking.tenantNotes,
38
+ status: booking.status,
39
+ attended: booking.attended,
40
+ suitable: booking.suitable,
41
+ applicationSent: booking.applicationSent,
42
+ applicationReceived: booking.applicationReceived
43
+ });
44
+ }), loading && /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(BookingTableRowSkeleton.default, null), /* @__PURE__ */React.createElement(BookingTableRowSkeleton.default, null), /* @__PURE__ */React.createElement(BookingTableRowSkeleton.default, null), /* @__PURE__ */React.createElement(BookingTableRowSkeleton.default, null)), !loading && data.length === 0 && /* @__PURE__ */React.createElement(ui.Heading, {
45
+ as: "h4",
46
+ align: "center",
47
+ sx: {
48
+ margin: "16px 0"
49
+ }
50
+ }, "No bookings")))));
51
+ }
52
+
53
+ exports.default = BookingTable;