@tenancy.nz/feature-ui 1.1.0 → 1.1.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.
@@ -17,24 +17,27 @@ var StyledBookingChartButton = styled("button", {
17
17
  shouldForwardProp: function shouldForwardProp(prop) {
18
18
  return !["color"].includes(prop);
19
19
  }
20
- })(_templateObject3 || (_templateObject3 = _rollupPluginBabelHelpers._taggedTemplateLiteral(["\n && {\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 }\n"])), function (_ref) {
20
+ })(_templateObject3 || (_templateObject3 = _rollupPluginBabelHelpers._taggedTemplateLiteral(["\n && {\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 color: ", ";\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 }\n"])), function (_ref) {
21
21
  var theme = _ref.theme;
22
22
  return theme.palette.primary.main;
23
23
  }, function (_ref2) {
24
- var active = _ref2.active,
25
- theme = _ref2.theme;
26
- return active ? "#CEF3ED" : theme.palette.background.paper;
24
+ var theme = _ref2.theme;
25
+ return theme.palette.primary.main;
27
26
  }, function (_ref3) {
28
27
  var active = _ref3.active,
29
28
  theme = _ref3.theme;
29
+ return active ? "#CEF3ED" : theme.palette.background.paper;
30
+ }, function (_ref4) {
31
+ var active = _ref4.active,
32
+ theme = _ref4.theme;
30
33
  return !active ? theme.palette.grey[100] : null;
31
34
  });
32
- 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) {
33
- var theme = _ref4.theme;
35
+ 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 (_ref5) {
36
+ var theme = _ref5.theme;
34
37
  return react.css(_templateObject5 || (_templateObject5 = _rollupPluginBabelHelpers._taggedTemplateLiteral(["\n ", " {\n flex-direction: row;\n align-items: center;\n }\n "])), theme.breakpoints.up("sm"));
35
38
  });
36
- 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) {
37
- var theme = _ref5.theme;
39
+ 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 (_ref6) {
40
+ var theme = _ref6.theme;
38
41
  return "\n @media (min-width: ".concat(theme.breakpoints.values.md, "px) {\n align-items: flex-end;\n }\n ");
39
42
  });
40
43
 
@@ -12,11 +12,14 @@ require('./BookingTableRow.styled.cjs');
12
12
  require('./_rollupPluginBabelHelpers-BlfsmA2H.js');
13
13
  require('@emotion/react');
14
14
  require('@emotion/styled');
15
+ require('./bookingTable2.cjs');
15
16
  require('./CheckedIcon.cjs');
16
17
  require('@tenancy.nz/icons');
17
18
 
18
19
  function BookingTable(_ref) {
19
20
  var data = _ref.data,
21
+ _ref$columns = _ref.columns,
22
+ columns = _ref$columns === void 0 ? "all" : _ref$columns,
20
23
  _ref$loading = _ref.loading,
21
24
  loading = _ref$loading === void 0 ? false : _ref$loading;
22
25
  return /* @__PURE__ */React.createElement(ui.Box, {
@@ -33,7 +36,9 @@ function BookingTable(_ref) {
33
36
  overflow: false
34
37
  }, /* @__PURE__ */React.createElement(ui.Box, {
35
38
  bgcolor: "grey.50"
36
- }, /* @__PURE__ */React.createElement(BookingTableRowHeader.default, null)), /* @__PURE__ */React.createElement(ui.Box, null, !loading && data.map(function (booking, index) {
39
+ }, /* @__PURE__ */React.createElement(BookingTableRowHeader.default, {
40
+ columns: columns
41
+ })), /* @__PURE__ */React.createElement(ui.Box, null, !loading && data.map(function (booking, index) {
37
42
  return /* @__PURE__ */React.createElement(BookingTableRow.default, {
38
43
  key: reactUid.uid(booking, index),
39
44
  firstName: booking.firstName,
@@ -44,7 +49,8 @@ function BookingTable(_ref) {
44
49
  attended: booking.attended,
45
50
  suitable: booking.suitable,
46
51
  applicationSent: booking.applicationSent,
47
- applicationReceived: booking.applicationReceived
52
+ applicationReceived: booking.applicationReceived,
53
+ columns: columns
48
54
  });
49
55
  }), 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, {
50
56
  as: "h4",
@@ -6,6 +6,7 @@ var React = require('react');
6
6
  var ui = require('@tenancy.nz/ui');
7
7
  var CheckedIcon = require('./CheckedIcon.cjs');
8
8
  var BookingTableRow_styled = require('./BookingTableRow.styled.cjs');
9
+ var bookingTable = require('./bookingTable2.cjs');
9
10
  require('@tenancy.nz/icons');
10
11
  require('./_rollupPluginBabelHelpers-BlfsmA2H.js');
11
12
  require('@emotion/react');
@@ -44,7 +45,9 @@ function BookingTableRow(_ref) {
44
45
  _ref$suitable = _ref.suitable,
45
46
  suitable = _ref$suitable === void 0 ? false : _ref$suitable,
46
47
  _ref$tenantNotes = _ref.tenantNotes,
47
- tenantNotes = _ref$tenantNotes === void 0 ? void 0 : _ref$tenantNotes;
48
+ tenantNotes = _ref$tenantNotes === void 0 ? void 0 : _ref$tenantNotes,
49
+ _ref$columns = _ref.columns,
50
+ columns = _ref$columns === void 0 ? "all" : _ref$columns;
48
51
  return /* @__PURE__ */React.createElement(ui.Grid, {
49
52
  container: true,
50
53
  spacing: 0
@@ -56,23 +59,23 @@ function BookingTableRow(_ref) {
56
59
  item: true,
57
60
  xs: 3,
58
61
  md: 3
59
- }, /* @__PURE__ */React.createElement(BookingTableRow_styled.StyledBookingTableRowCell, null, firstName, " ", lastName)), /* @__PURE__ */React.createElement(ui.Grid, {
62
+ }, /* @__PURE__ */React.createElement(BookingTableRow_styled.StyledBookingTableRowCell, null, bookingTable.showBookingTableColumns(columns, ["firstName", "lastName"]) ? "".concat(firstName, " ").concat(lastName) : null)), /* @__PURE__ */React.createElement(ui.Grid, {
60
63
  item: true,
61
64
  xs: 6,
62
65
  md: 7
63
- }, /* @__PURE__ */React.createElement(BookingTableRow_styled.StyledBookingTableRowCell, null, /* @__PURE__ */React.createElement(ui.Text, {
66
+ }, /* @__PURE__ */React.createElement(BookingTableRow_styled.StyledBookingTableRowCell, null, bookingTable.showBookingTableColumns(columns, ["tenantNotes", "notes"]) && /* @__PURE__ */React.createElement(ui.Text, {
64
67
  as: "div",
65
68
  variant: "body2"
66
- }, notes && /* @__PURE__ */React.createElement(ui.Text, {
69
+ }, notes && bookingTable.showBookingTableColumns(columns, "notes") && /* @__PURE__ */React.createElement(ui.Text, {
67
70
  variant: "inherit",
68
71
  paragraph: !!tenantNotes
69
- }, /* @__PURE__ */React.createElement("strong", null, "Property Manager Note"), " ", /* @__PURE__ */React.createElement("br", null), notes), tenantNotes && /* @__PURE__ */React.createElement(ui.Text, {
72
+ }, /* @__PURE__ */React.createElement("strong", null, "Property Manager Note"), " ", /* @__PURE__ */React.createElement("br", null), notes), tenantNotes && bookingTable.showBookingTableColumns(columns, "tenantNotes") && /* @__PURE__ */React.createElement(ui.Text, {
70
73
  variant: "inherit"
71
74
  }, /* @__PURE__ */React.createElement("strong", null, "Tenant Feedback"), /* @__PURE__ */React.createElement("br", null), tenantNotes)))), /* @__PURE__ */React.createElement(ui.Grid, {
72
75
  item: true,
73
76
  xs: 3,
74
77
  md: 2
75
- }, /* @__PURE__ */React.createElement(BookingTableRow_styled.StyledBookingTableRowCell, null, /* @__PURE__ */React.createElement("span", null, tagMap(status))))), /* @__PURE__ */React.createElement(ui.Grid, {
78
+ }, /* @__PURE__ */React.createElement(BookingTableRow_styled.StyledBookingTableRowCell, null, bookingTable.showBookingTableColumns(columns, "status") && /* @__PURE__ */React.createElement("span", null, tagMap(status))))), /* @__PURE__ */React.createElement(ui.Grid, {
76
79
  item: true,
77
80
  container: true,
78
81
  xs: 6
@@ -81,28 +84,28 @@ function BookingTableRow(_ref) {
81
84
  xs: 3
82
85
  }, /* @__PURE__ */React.createElement(BookingTableRow_styled.StyledBookingTableRowCell, {
83
86
  align: "center"
84
- }, /* @__PURE__ */React.createElement(CheckedIcon.default, {
87
+ }, bookingTable.showBookingTableColumns(columns, "attended") && /* @__PURE__ */React.createElement(CheckedIcon.default, {
85
88
  value: attended
86
89
  }))), /* @__PURE__ */React.createElement(ui.Grid, {
87
90
  item: true,
88
91
  xs: 3
89
92
  }, /* @__PURE__ */React.createElement(BookingTableRow_styled.StyledBookingTableRowCell, {
90
93
  align: "center"
91
- }, /* @__PURE__ */React.createElement(CheckedIcon.default, {
94
+ }, bookingTable.showBookingTableColumns(columns, "suitable") && /* @__PURE__ */React.createElement(CheckedIcon.default, {
92
95
  value: suitable
93
96
  }))), /* @__PURE__ */React.createElement(ui.Grid, {
94
97
  item: true,
95
98
  xs: 3
96
99
  }, /* @__PURE__ */React.createElement(BookingTableRow_styled.StyledBookingTableRowCell, {
97
100
  align: "center"
98
- }, /* @__PURE__ */React.createElement(CheckedIcon.default, {
101
+ }, bookingTable.showBookingTableColumns(columns, "applicationSent") && /* @__PURE__ */React.createElement(CheckedIcon.default, {
99
102
  value: applicationSent
100
103
  }))), /* @__PURE__ */React.createElement(ui.Grid, {
101
104
  item: true,
102
105
  xs: 3
103
106
  }, /* @__PURE__ */React.createElement(BookingTableRow_styled.StyledBookingTableRowCell, {
104
107
  align: "center"
105
- }, /* @__PURE__ */React.createElement(CheckedIcon.default, {
108
+ }, bookingTable.showBookingTableColumns(columns, "applicationReceived") && /* @__PURE__ */React.createElement(CheckedIcon.default, {
106
109
  value: applicationReceived
107
110
  })))));
108
111
  }
@@ -14,7 +14,7 @@ var StyledBookingTableRowCell = styled("div", {
14
14
  align = _ref$align === void 0 ? "left" : _ref$align,
15
15
  header = _ref.header,
16
16
  theme = _ref.theme;
17
- return react.css(_templateObject2 || (_templateObject2 = _rollupPluginBabelHelpers._taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: ", ";\n padding: 6px 12px;\n font-size: ", ";\n color: #717680;\n height: 100%;\n\n ", "\n\n ", "\n\n ", "\n\n ", " {\n padding: 12px 24px;\n }\n\n @media print {\n padding: 12px 24px;\n }\n "])), header ? "center" : "flex-start", header ? "12px" : "14px", align === "left" && "\n align-items: flex-start;\n ", align === "center" && "\n align-items: center;\n text-align: center;\n ", align === "right" && "\n align-items: flex-end;\n ", theme.breakpoints.up("md"));
17
+ return react.css(_templateObject2 || (_templateObject2 = _rollupPluginBabelHelpers._taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: ", ";\n padding: 6px 12px;\n font-size: ", ";\n color: #717680;\n height: 100%;\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", " {\n padding: 12px 24px;\n }\n\n @media print {\n padding: 12px 24px;\n }\n "])), header ? "center" : "flex-start", header ? "12px" : "14px", !header && "\n border-top: 1px solid #e9eaeb;\n ", align === "left" && "\n align-items: flex-start;\n ", align === "center" && "\n align-items: center;\n text-align: center;\n ", align === "right" && "\n align-items: flex-end;\n ", theme.breakpoints.up("md"));
18
18
  });
19
19
 
20
20
  exports.StyledBookingTableRowCell = StyledBookingTableRowCell;
@@ -5,11 +5,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var React = require('react');
6
6
  var ui = require('@tenancy.nz/ui');
7
7
  var BookingTableRow_styled = require('./BookingTableRow.styled.cjs');
8
+ var bookingTable = require('./bookingTable2.cjs');
8
9
  require('./_rollupPluginBabelHelpers-BlfsmA2H.js');
9
10
  require('@emotion/react');
10
11
  require('@emotion/styled');
11
12
 
12
- function BookingTableRowHeader() {
13
+ function BookingTableRowHeader(_ref) {
14
+ var _ref$columns = _ref.columns,
15
+ columns = _ref$columns === void 0 ? "all" : _ref$columns;
13
16
  return /* @__PURE__ */React.createElement(ui.Grid, {
14
17
  container: true,
15
18
  spacing: 0
@@ -22,19 +25,19 @@ function BookingTableRowHeader() {
22
25
  xs: 3
23
26
  }, /* @__PURE__ */React.createElement(BookingTableRow_styled.StyledBookingTableRowCell, {
24
27
  header: true
25
- }, "Name")), /* @__PURE__ */React.createElement(ui.Grid, {
28
+ }, bookingTable.showBookingTableColumns(columns, ["firstName", "lastName"]) ? "Name" : null)), /* @__PURE__ */React.createElement(ui.Grid, {
26
29
  item: true,
27
30
  xs: 6,
28
31
  md: 7
29
32
  }, /* @__PURE__ */React.createElement(BookingTableRow_styled.StyledBookingTableRowCell, {
30
33
  header: true
31
- }, "Comments")), /* @__PURE__ */React.createElement(ui.Grid, {
34
+ }, bookingTable.showBookingTableColumns(columns, ["tenantNotes", "notes"]) ? "Comments" : null)), /* @__PURE__ */React.createElement(ui.Grid, {
32
35
  item: true,
33
36
  xs: 3,
34
37
  md: 2
35
38
  }, /* @__PURE__ */React.createElement(BookingTableRow_styled.StyledBookingTableRowCell, {
36
39
  header: true
37
- }, "Status"))), /* @__PURE__ */React.createElement(ui.Grid, {
40
+ }, bookingTable.showBookingTableColumns(columns, "status") ? "Status" : null))), /* @__PURE__ */React.createElement(ui.Grid, {
38
41
  item: true,
39
42
  container: true,
40
43
  xs: 6
@@ -44,25 +47,25 @@ function BookingTableRowHeader() {
44
47
  }, /* @__PURE__ */React.createElement(BookingTableRow_styled.StyledBookingTableRowCell, {
45
48
  align: "center",
46
49
  header: true
47
- }, "Attendend")), /* @__PURE__ */React.createElement(ui.Grid, {
50
+ }, bookingTable.showBookingTableColumns(columns, "attended") ? "Attended" : null)), /* @__PURE__ */React.createElement(ui.Grid, {
48
51
  item: true,
49
52
  xs: 3
50
53
  }, /* @__PURE__ */React.createElement(BookingTableRow_styled.StyledBookingTableRowCell, {
51
54
  align: "center",
52
55
  header: true
53
- }, "Suitable")), /* @__PURE__ */React.createElement(ui.Grid, {
56
+ }, bookingTable.showBookingTableColumns(columns, "suitable") ? "Suitable" : null)), /* @__PURE__ */React.createElement(ui.Grid, {
54
57
  item: true,
55
58
  xs: 3
56
59
  }, /* @__PURE__ */React.createElement(BookingTableRow_styled.StyledBookingTableRowCell, {
57
60
  align: "center",
58
61
  header: true
59
- }, "Application Sent")), /* @__PURE__ */React.createElement(ui.Grid, {
62
+ }, bookingTable.showBookingTableColumns(columns, "applicationSent") ? "Application Sent" : null)), /* @__PURE__ */React.createElement(ui.Grid, {
60
63
  item: true,
61
64
  xs: 3
62
65
  }, /* @__PURE__ */React.createElement(BookingTableRow_styled.StyledBookingTableRowCell, {
63
66
  align: "center",
64
67
  header: true
65
- }, "Application Received"))));
68
+ }, bookingTable.showBookingTableColumns(columns, "applicationReceived") ? "Application Received" : null))));
66
69
  }
67
70
 
68
71
  exports.default = BookingTableRowHeader;
@@ -13,10 +13,13 @@ function CheckedIcon(_ref) {
13
13
  size: "20px"
14
14
  });
15
15
  }
16
- return /* @__PURE__ */React.createElement(icons.CircleTimesIcon, {
17
- color: "error.main",
18
- size: "20px"
19
- });
16
+ if (value === false) {
17
+ return /* @__PURE__ */React.createElement(icons.CircleTimesIcon, {
18
+ color: "error.main",
19
+ size: "20px"
20
+ });
21
+ }
22
+ return null;
20
23
  }
21
24
 
22
25
  exports.default = CheckedIcon;
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ var showBookingTableColumns = function showBookingTableColumns(columns, name) {
4
+ if (columns === "all") {
5
+ return true;
6
+ }
7
+ var names = Array.isArray(name) ? name : [name];
8
+ if (Array.isArray(columns) && names.length > 0) {
9
+ return columns.some(function (column) {
10
+ return names.includes(column);
11
+ });
12
+ }
13
+ return true;
14
+ };
15
+
16
+ exports.showBookingTableColumns = showBookingTableColumns;
@@ -25,6 +25,7 @@ require('@emotion/react');
25
25
  require('@emotion/styled');
26
26
  require('react-uid');
27
27
  require('./BookingTableRow.styled.cjs');
28
+ require('./bookingTable2.cjs');
28
29
  require('./PropertyCard.styled.cjs');
29
30
 
30
31
 
@@ -15,24 +15,27 @@ var StyledBookingChartButton = styled("button", {
15
15
  shouldForwardProp: function shouldForwardProp(prop) {
16
16
  return !["color"].includes(prop);
17
17
  }
18
- })(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n && {\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 }\n"])), function (_ref) {
18
+ })(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n && {\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 color: ", ";\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 }\n"])), function (_ref) {
19
19
  var theme = _ref.theme;
20
20
  return theme.palette.primary.main;
21
21
  }, function (_ref2) {
22
- var active = _ref2.active,
23
- theme = _ref2.theme;
24
- return active ? "#CEF3ED" : theme.palette.background.paper;
22
+ var theme = _ref2.theme;
23
+ return theme.palette.primary.main;
25
24
  }, function (_ref3) {
26
25
  var active = _ref3.active,
27
26
  theme = _ref3.theme;
27
+ return active ? "#CEF3ED" : theme.palette.background.paper;
28
+ }, function (_ref4) {
29
+ var active = _ref4.active,
30
+ theme = _ref4.theme;
28
31
  return !active ? theme.palette.grey[100] : null;
29
32
  });
30
- var StyledPropertyDetailsBox = styled.div(_templateObject4 || (_templateObject4 = _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) {
31
- var theme = _ref4.theme;
33
+ var StyledPropertyDetailsBox = styled.div(_templateObject4 || (_templateObject4 = _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 (_ref5) {
34
+ var theme = _ref5.theme;
32
35
  return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n ", " {\n flex-direction: row;\n align-items: center;\n }\n "])), theme.breakpoints.up("sm"));
33
36
  });
34
- var StyledPropertyAmenitiesBox = styled.div(_templateObject6 || (_templateObject6 = _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) {
35
- var theme = _ref5.theme;
37
+ var StyledPropertyAmenitiesBox = styled.div(_templateObject6 || (_templateObject6 = _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 (_ref6) {
38
+ var theme = _ref6.theme;
36
39
  return "\n @media (min-width: ".concat(theme.breakpoints.values.md, "px) {\n align-items: flex-end;\n }\n ");
37
40
  });
38
41
 
@@ -8,11 +8,14 @@ import './BookingTableRow.styled.js';
8
8
  import './_rollupPluginBabelHelpers-BXw3UT-B.js';
9
9
  import '@emotion/react';
10
10
  import '@emotion/styled';
11
+ import './bookingTable2.js';
11
12
  import './CheckedIcon.js';
12
13
  import '@tenancy.nz/icons';
13
14
 
14
15
  function BookingTable(_ref) {
15
16
  var data = _ref.data,
17
+ _ref$columns = _ref.columns,
18
+ columns = _ref$columns === void 0 ? "all" : _ref$columns,
16
19
  _ref$loading = _ref.loading,
17
20
  loading = _ref$loading === void 0 ? false : _ref$loading;
18
21
  return /* @__PURE__ */React.createElement(Box, {
@@ -29,7 +32,9 @@ function BookingTable(_ref) {
29
32
  overflow: false
30
33
  }, /* @__PURE__ */React.createElement(Box, {
31
34
  bgcolor: "grey.50"
32
- }, /* @__PURE__ */React.createElement(BookingTableRowHeader, null)), /* @__PURE__ */React.createElement(Box, null, !loading && data.map(function (booking, index) {
35
+ }, /* @__PURE__ */React.createElement(BookingTableRowHeader, {
36
+ columns: columns
37
+ })), /* @__PURE__ */React.createElement(Box, null, !loading && data.map(function (booking, index) {
33
38
  return /* @__PURE__ */React.createElement(BookingTableRow, {
34
39
  key: uid(booking, index),
35
40
  firstName: booking.firstName,
@@ -40,7 +45,8 @@ function BookingTable(_ref) {
40
45
  attended: booking.attended,
41
46
  suitable: booking.suitable,
42
47
  applicationSent: booking.applicationSent,
43
- applicationReceived: booking.applicationReceived
48
+ applicationReceived: booking.applicationReceived,
49
+ columns: columns
44
50
  });
45
51
  }), loading && /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(BookingTableRowSkeleton, null), /* @__PURE__ */React.createElement(BookingTableRowSkeleton, null), /* @__PURE__ */React.createElement(BookingTableRowSkeleton, null), /* @__PURE__ */React.createElement(BookingTableRowSkeleton, null)), !loading && data.length === 0 && /* @__PURE__ */React.createElement(Heading, {
46
52
  as: "h4",
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { Grid, Text, Tag } from '@tenancy.nz/ui';
3
3
  import CheckedIcon from './CheckedIcon.js';
4
4
  import { StyledBookingTableRowCell } from './BookingTableRow.styled.js';
5
+ import { showBookingTableColumns } from './bookingTable2.js';
5
6
  import '@tenancy.nz/icons';
6
7
  import './_rollupPluginBabelHelpers-BXw3UT-B.js';
7
8
  import '@emotion/react';
@@ -40,7 +41,9 @@ function BookingTableRow(_ref) {
40
41
  _ref$suitable = _ref.suitable,
41
42
  suitable = _ref$suitable === void 0 ? false : _ref$suitable,
42
43
  _ref$tenantNotes = _ref.tenantNotes,
43
- tenantNotes = _ref$tenantNotes === void 0 ? void 0 : _ref$tenantNotes;
44
+ tenantNotes = _ref$tenantNotes === void 0 ? void 0 : _ref$tenantNotes,
45
+ _ref$columns = _ref.columns,
46
+ columns = _ref$columns === void 0 ? "all" : _ref$columns;
44
47
  return /* @__PURE__ */React.createElement(Grid, {
45
48
  container: true,
46
49
  spacing: 0
@@ -52,23 +55,23 @@ function BookingTableRow(_ref) {
52
55
  item: true,
53
56
  xs: 3,
54
57
  md: 3
55
- }, /* @__PURE__ */React.createElement(StyledBookingTableRowCell, null, firstName, " ", lastName)), /* @__PURE__ */React.createElement(Grid, {
58
+ }, /* @__PURE__ */React.createElement(StyledBookingTableRowCell, null, showBookingTableColumns(columns, ["firstName", "lastName"]) ? "".concat(firstName, " ").concat(lastName) : null)), /* @__PURE__ */React.createElement(Grid, {
56
59
  item: true,
57
60
  xs: 6,
58
61
  md: 7
59
- }, /* @__PURE__ */React.createElement(StyledBookingTableRowCell, null, /* @__PURE__ */React.createElement(Text, {
62
+ }, /* @__PURE__ */React.createElement(StyledBookingTableRowCell, null, showBookingTableColumns(columns, ["tenantNotes", "notes"]) && /* @__PURE__ */React.createElement(Text, {
60
63
  as: "div",
61
64
  variant: "body2"
62
- }, notes && /* @__PURE__ */React.createElement(Text, {
65
+ }, notes && showBookingTableColumns(columns, "notes") && /* @__PURE__ */React.createElement(Text, {
63
66
  variant: "inherit",
64
67
  paragraph: !!tenantNotes
65
- }, /* @__PURE__ */React.createElement("strong", null, "Property Manager Note"), " ", /* @__PURE__ */React.createElement("br", null), notes), tenantNotes && /* @__PURE__ */React.createElement(Text, {
68
+ }, /* @__PURE__ */React.createElement("strong", null, "Property Manager Note"), " ", /* @__PURE__ */React.createElement("br", null), notes), tenantNotes && showBookingTableColumns(columns, "tenantNotes") && /* @__PURE__ */React.createElement(Text, {
66
69
  variant: "inherit"
67
70
  }, /* @__PURE__ */React.createElement("strong", null, "Tenant Feedback"), /* @__PURE__ */React.createElement("br", null), tenantNotes)))), /* @__PURE__ */React.createElement(Grid, {
68
71
  item: true,
69
72
  xs: 3,
70
73
  md: 2
71
- }, /* @__PURE__ */React.createElement(StyledBookingTableRowCell, null, /* @__PURE__ */React.createElement("span", null, tagMap(status))))), /* @__PURE__ */React.createElement(Grid, {
74
+ }, /* @__PURE__ */React.createElement(StyledBookingTableRowCell, null, showBookingTableColumns(columns, "status") && /* @__PURE__ */React.createElement("span", null, tagMap(status))))), /* @__PURE__ */React.createElement(Grid, {
72
75
  item: true,
73
76
  container: true,
74
77
  xs: 6
@@ -77,28 +80,28 @@ function BookingTableRow(_ref) {
77
80
  xs: 3
78
81
  }, /* @__PURE__ */React.createElement(StyledBookingTableRowCell, {
79
82
  align: "center"
80
- }, /* @__PURE__ */React.createElement(CheckedIcon, {
83
+ }, showBookingTableColumns(columns, "attended") && /* @__PURE__ */React.createElement(CheckedIcon, {
81
84
  value: attended
82
85
  }))), /* @__PURE__ */React.createElement(Grid, {
83
86
  item: true,
84
87
  xs: 3
85
88
  }, /* @__PURE__ */React.createElement(StyledBookingTableRowCell, {
86
89
  align: "center"
87
- }, /* @__PURE__ */React.createElement(CheckedIcon, {
90
+ }, showBookingTableColumns(columns, "suitable") && /* @__PURE__ */React.createElement(CheckedIcon, {
88
91
  value: suitable
89
92
  }))), /* @__PURE__ */React.createElement(Grid, {
90
93
  item: true,
91
94
  xs: 3
92
95
  }, /* @__PURE__ */React.createElement(StyledBookingTableRowCell, {
93
96
  align: "center"
94
- }, /* @__PURE__ */React.createElement(CheckedIcon, {
97
+ }, showBookingTableColumns(columns, "applicationSent") && /* @__PURE__ */React.createElement(CheckedIcon, {
95
98
  value: applicationSent
96
99
  }))), /* @__PURE__ */React.createElement(Grid, {
97
100
  item: true,
98
101
  xs: 3
99
102
  }, /* @__PURE__ */React.createElement(StyledBookingTableRowCell, {
100
103
  align: "center"
101
- }, /* @__PURE__ */React.createElement(CheckedIcon, {
104
+ }, showBookingTableColumns(columns, "applicationReceived") && /* @__PURE__ */React.createElement(CheckedIcon, {
102
105
  value: applicationReceived
103
106
  })))));
104
107
  }
@@ -12,7 +12,7 @@ var StyledBookingTableRowCell = styled("div", {
12
12
  align = _ref$align === void 0 ? "left" : _ref$align,
13
13
  header = _ref.header,
14
14
  theme = _ref.theme;
15
- return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: ", ";\n padding: 6px 12px;\n font-size: ", ";\n color: #717680;\n height: 100%;\n\n ", "\n\n ", "\n\n ", "\n\n ", " {\n padding: 12px 24px;\n }\n\n @media print {\n padding: 12px 24px;\n }\n "])), header ? "center" : "flex-start", header ? "12px" : "14px", align === "left" && "\n align-items: flex-start;\n ", align === "center" && "\n align-items: center;\n text-align: center;\n ", align === "right" && "\n align-items: flex-end;\n ", theme.breakpoints.up("md"));
15
+ return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: ", ";\n padding: 6px 12px;\n font-size: ", ";\n color: #717680;\n height: 100%;\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", " {\n padding: 12px 24px;\n }\n\n @media print {\n padding: 12px 24px;\n }\n "])), header ? "center" : "flex-start", header ? "12px" : "14px", !header && "\n border-top: 1px solid #e9eaeb;\n ", align === "left" && "\n align-items: flex-start;\n ", align === "center" && "\n align-items: center;\n text-align: center;\n ", align === "right" && "\n align-items: flex-end;\n ", theme.breakpoints.up("md"));
16
16
  });
17
17
 
18
18
  export { StyledBookingTableRowCell };
@@ -1,11 +1,14 @@
1
1
  import React from 'react';
2
2
  import { Grid } from '@tenancy.nz/ui';
3
3
  import { StyledBookingTableRowCell } from './BookingTableRow.styled.js';
4
+ import { showBookingTableColumns } from './bookingTable2.js';
4
5
  import './_rollupPluginBabelHelpers-BXw3UT-B.js';
5
6
  import '@emotion/react';
6
7
  import '@emotion/styled';
7
8
 
8
- function BookingTableRowHeader() {
9
+ function BookingTableRowHeader(_ref) {
10
+ var _ref$columns = _ref.columns,
11
+ columns = _ref$columns === void 0 ? "all" : _ref$columns;
9
12
  return /* @__PURE__ */React.createElement(Grid, {
10
13
  container: true,
11
14
  spacing: 0
@@ -18,19 +21,19 @@ function BookingTableRowHeader() {
18
21
  xs: 3
19
22
  }, /* @__PURE__ */React.createElement(StyledBookingTableRowCell, {
20
23
  header: true
21
- }, "Name")), /* @__PURE__ */React.createElement(Grid, {
24
+ }, showBookingTableColumns(columns, ["firstName", "lastName"]) ? "Name" : null)), /* @__PURE__ */React.createElement(Grid, {
22
25
  item: true,
23
26
  xs: 6,
24
27
  md: 7
25
28
  }, /* @__PURE__ */React.createElement(StyledBookingTableRowCell, {
26
29
  header: true
27
- }, "Comments")), /* @__PURE__ */React.createElement(Grid, {
30
+ }, showBookingTableColumns(columns, ["tenantNotes", "notes"]) ? "Comments" : null)), /* @__PURE__ */React.createElement(Grid, {
28
31
  item: true,
29
32
  xs: 3,
30
33
  md: 2
31
34
  }, /* @__PURE__ */React.createElement(StyledBookingTableRowCell, {
32
35
  header: true
33
- }, "Status"))), /* @__PURE__ */React.createElement(Grid, {
36
+ }, showBookingTableColumns(columns, "status") ? "Status" : null))), /* @__PURE__ */React.createElement(Grid, {
34
37
  item: true,
35
38
  container: true,
36
39
  xs: 6
@@ -40,25 +43,25 @@ function BookingTableRowHeader() {
40
43
  }, /* @__PURE__ */React.createElement(StyledBookingTableRowCell, {
41
44
  align: "center",
42
45
  header: true
43
- }, "Attendend")), /* @__PURE__ */React.createElement(Grid, {
46
+ }, showBookingTableColumns(columns, "attended") ? "Attended" : null)), /* @__PURE__ */React.createElement(Grid, {
44
47
  item: true,
45
48
  xs: 3
46
49
  }, /* @__PURE__ */React.createElement(StyledBookingTableRowCell, {
47
50
  align: "center",
48
51
  header: true
49
- }, "Suitable")), /* @__PURE__ */React.createElement(Grid, {
52
+ }, showBookingTableColumns(columns, "suitable") ? "Suitable" : null)), /* @__PURE__ */React.createElement(Grid, {
50
53
  item: true,
51
54
  xs: 3
52
55
  }, /* @__PURE__ */React.createElement(StyledBookingTableRowCell, {
53
56
  align: "center",
54
57
  header: true
55
- }, "Application Sent")), /* @__PURE__ */React.createElement(Grid, {
58
+ }, showBookingTableColumns(columns, "applicationSent") ? "Application Sent" : null)), /* @__PURE__ */React.createElement(Grid, {
56
59
  item: true,
57
60
  xs: 3
58
61
  }, /* @__PURE__ */React.createElement(StyledBookingTableRowCell, {
59
62
  align: "center",
60
63
  header: true
61
- }, "Application Received"))));
64
+ }, showBookingTableColumns(columns, "applicationReceived") ? "Application Received" : null))));
62
65
  }
63
66
 
64
67
  export { BookingTableRowHeader as default };
@@ -9,10 +9,13 @@ function CheckedIcon(_ref) {
9
9
  size: "20px"
10
10
  });
11
11
  }
12
- return /* @__PURE__ */React.createElement(CircleTimesIcon, {
13
- color: "error.main",
14
- size: "20px"
15
- });
12
+ if (value === false) {
13
+ return /* @__PURE__ */React.createElement(CircleTimesIcon, {
14
+ color: "error.main",
15
+ size: "20px"
16
+ });
17
+ }
18
+ return null;
16
19
  }
17
20
 
18
21
  export { CheckedIcon as default };
@@ -0,0 +1,14 @@
1
+ var showBookingTableColumns = function showBookingTableColumns(columns, name) {
2
+ if (columns === "all") {
3
+ return true;
4
+ }
5
+ var names = Array.isArray(name) ? name : [name];
6
+ if (Array.isArray(columns) && names.length > 0) {
7
+ return columns.some(function (column) {
8
+ return names.includes(column);
9
+ });
10
+ }
11
+ return true;
12
+ };
13
+
14
+ export { showBookingTableColumns };
package/dist/esm/index.js CHANGED
@@ -23,4 +23,5 @@ import '@emotion/react';
23
23
  import '@emotion/styled';
24
24
  import 'react-uid';
25
25
  import './BookingTableRow.styled.js';
26
+ import './bookingTable2.js';
26
27
  import './PropertyCard.styled.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.1.0",
4
+ "version": "1.1.2",
5
5
  "author": "TPS <https://www.tenancy.co.nz>",
6
6
  "type": "module",
7
7
  "main": "dist/cjs/index.cjs",
@@ -18,12 +18,12 @@
18
18
  "primereact": "3.1.3",
19
19
  "react": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
20
20
  "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
21
- "@tenancy.nz/icons": "1.1.0",
22
- "@tenancy.nz/ui": "1.1.0"
21
+ "@tenancy.nz/icons": "1.1.2",
22
+ "@tenancy.nz/ui": "1.1.2"
23
23
  },
24
24
  "devDependencies": {
25
- "@tenancy.nz/icons": "1.1.0",
26
- "@tenancy.nz/ui": "1.1.0"
25
+ "@tenancy.nz/icons": "1.1.2",
26
+ "@tenancy.nz/ui": "1.1.2"
27
27
  },
28
28
  "dependencies": {
29
29
  "react-uid": "^2.4.0"