@aclymatepackages/modules 2.3.1 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/PdlCompanySelect.js +13 -46
- package/dist/components/PlacesAutocomplete.js +1 -3
- package/dist/components/ReportSummaryBlock.js +1 -2
- package/package.json +5 -6
- package/src/components/PdlCompanySelect.js +15 -35
- package/src/components/PlacesAutocomplete.js +0 -2
- package/src/components/ReportSummaryBlock.js +1 -1
|
@@ -9,47 +9,21 @@ require("core-js/modules/es.promise.js");
|
|
|
9
9
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _material = require("@mui/material");
|
|
12
|
-
var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
|
|
13
12
|
var _Search = _interopRequireDefault(require("@mui/icons-material/Search"));
|
|
14
13
|
var _atoms = require("@aclymatepackages/atoms");
|
|
15
|
-
var _themes = require("@aclymatepackages/themes");
|
|
16
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
18
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
|
-
const
|
|
20
|
-
let {
|
|
21
|
-
id,
|
|
22
|
-
name,
|
|
23
|
-
isSelected,
|
|
24
|
-
setSelectedCompanyId
|
|
25
|
-
} = _ref;
|
|
26
|
-
return /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
27
|
-
item: true
|
|
28
|
-
}, /*#__PURE__*/_react.default.createElement(_material.ThemeProvider, {
|
|
29
|
-
theme: _themes.mainTheme
|
|
30
|
-
}, /*#__PURE__*/_react.default.createElement(_material.Chip, {
|
|
31
|
-
label: name,
|
|
32
|
-
style: {
|
|
33
|
-
color: isSelected ? "white" : "inherit"
|
|
34
|
-
},
|
|
35
|
-
onClick: () => setSelectedCompanyId(currentId => currentId === id ? null : id),
|
|
36
|
-
icon: isSelected && /*#__PURE__*/_react.default.createElement(_Check.default, {
|
|
37
|
-
style: {
|
|
38
|
-
color: "white"
|
|
39
|
-
}
|
|
40
|
-
}),
|
|
41
|
-
color: isSelected ? "primary" : "default"
|
|
42
|
-
})));
|
|
43
|
-
};
|
|
44
|
-
const PdlCompanySelect = _ref2 => {
|
|
17
|
+
const PdlCompanySelect = _ref => {
|
|
45
18
|
let {
|
|
46
19
|
onCompanyNotFound,
|
|
47
20
|
onCompanySelected,
|
|
48
21
|
onSelectClick = () => {},
|
|
49
22
|
matchingFunction,
|
|
50
23
|
label = "Enter your company's name",
|
|
51
|
-
actionLabel = "Please select your company from these options"
|
|
52
|
-
|
|
24
|
+
actionLabel = "Please select your company from these options",
|
|
25
|
+
helperText
|
|
26
|
+
} = _ref;
|
|
53
27
|
const [inputValue, setInputValue] = (0, _react.useState)("");
|
|
54
28
|
const [matchingCompanies, setMatchingCompanies] = (0, _react.useState)([]);
|
|
55
29
|
const [inputComplete, setInputComplete] = (0, _react.useState)(false);
|
|
@@ -72,10 +46,10 @@ const PdlCompanySelect = _ref2 => {
|
|
|
72
46
|
await onCompanySelected(companyId, name);
|
|
73
47
|
return onSelectClick();
|
|
74
48
|
};
|
|
75
|
-
const selectedCompany = matchingCompanies.find(
|
|
49
|
+
const selectedCompany = matchingCompanies.find(_ref2 => {
|
|
76
50
|
let {
|
|
77
51
|
id
|
|
78
|
-
} =
|
|
52
|
+
} = _ref2;
|
|
79
53
|
return selectedCompanyId === id;
|
|
80
54
|
});
|
|
81
55
|
return /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
@@ -89,14 +63,15 @@ const PdlCompanySelect = _ref2 => {
|
|
|
89
63
|
label: label,
|
|
90
64
|
value: inputValue,
|
|
91
65
|
setValue: setInputValue,
|
|
92
|
-
onKeyPress:
|
|
66
|
+
onKeyPress: _ref3 => {
|
|
93
67
|
let {
|
|
94
68
|
key
|
|
95
|
-
} =
|
|
69
|
+
} = _ref3;
|
|
96
70
|
if (key === "Enter") {
|
|
97
71
|
return fetchMatchingCompanies();
|
|
98
72
|
}
|
|
99
73
|
},
|
|
74
|
+
helperText: helperText || "Press enter or click the search icon to search for matching companies",
|
|
100
75
|
InputProps: {
|
|
101
76
|
endAdornment: /*#__PURE__*/_react.default.createElement(_material.InputAdornment, null, /*#__PURE__*/_react.default.createElement(_material.IconButton, {
|
|
102
77
|
disabled: pdlFetchLoading,
|
|
@@ -119,18 +94,10 @@ const PdlCompanySelect = _ref2 => {
|
|
|
119
94
|
container: true,
|
|
120
95
|
spacing: 2,
|
|
121
96
|
justifyContent: "center"
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
} = _ref5;
|
|
127
|
-
return /*#__PURE__*/_react.default.createElement(CompanySelectionChip, {
|
|
128
|
-
key: "company-list-item-".concat(idx),
|
|
129
|
-
name: name,
|
|
130
|
-
isSelected: selectedCompanyId === id,
|
|
131
|
-
setSelectedCompanyId: setSelectedCompanyId,
|
|
132
|
-
id: id
|
|
133
|
-
});
|
|
97
|
+
}, /*#__PURE__*/_react.default.createElement(_atoms.MatchingCompanyChips, {
|
|
98
|
+
matchingCompanies: matchingCompanies,
|
|
99
|
+
selectedCompanyId: selectedCompanyId,
|
|
100
|
+
setSelectedCompanyId: setSelectedCompanyId
|
|
134
101
|
})), /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
135
102
|
item: true,
|
|
136
103
|
container: true,
|
|
@@ -43,8 +43,7 @@ const PlacesAutocomplete = _ref => {
|
|
|
43
43
|
id,
|
|
44
44
|
style,
|
|
45
45
|
textFieldProps,
|
|
46
|
-
coordinates
|
|
47
|
-
appCheckToken
|
|
46
|
+
coordinates
|
|
48
47
|
} = _ref;
|
|
49
48
|
const [inputValue, setInputValue] = (0, _react.useState)("");
|
|
50
49
|
const [options, setOptions] = (0, _react.useState)([]);
|
|
@@ -67,7 +66,6 @@ const PlacesAutocomplete = _ref => {
|
|
|
67
66
|
return data.predictions;
|
|
68
67
|
};
|
|
69
68
|
return await (0, _fetchAclymateApi.default)({
|
|
70
|
-
appCheckToken,
|
|
71
69
|
path: "/google-maps/autocomplete/".concat(dataString),
|
|
72
70
|
method: "GET",
|
|
73
71
|
signal,
|
|
@@ -8,7 +8,6 @@ require("core-js/modules/web.dom-collections.iterator.js");
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _material = require("@mui/material");
|
|
10
10
|
var _otherHelpers = require("@aclymatepackages/other-helpers");
|
|
11
|
-
var _emissionsCalcs = require("@aclymatepackages/emissions-calcs");
|
|
12
11
|
var _ReportGraphContentLayout = _interopRequireDefault(require("./ReportGraphContentLayout"));
|
|
13
12
|
var _EmissionsPieChart = _interopRequireDefault(require("./EmissionsPieChart"));
|
|
14
13
|
var _EmissionsSummarySentence = _interopRequireDefault(require("./EmissionsSummarySentence"));
|
|
@@ -30,7 +29,7 @@ const ReportSummaryBlock = _ref => {
|
|
|
30
29
|
const {
|
|
31
30
|
scope
|
|
32
31
|
} = scopeObj;
|
|
33
|
-
const scopeEmissions = (0,
|
|
32
|
+
const scopeEmissions = (0, _otherHelpers.filterEmissionsByScope)(emissions, scope);
|
|
34
33
|
return _objectSpread(_objectSpread({}, scopeObj), {}, {
|
|
35
34
|
emissions: scopeEmissions
|
|
36
35
|
});
|
package/package.json
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aclymatepackages/modules",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Aclymate modules",
|
|
5
5
|
"author": "William Loopesko",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@aclymatepackages/array-immutability-helpers": "^1.0.0",
|
|
9
|
-
"@aclymatepackages/atoms": "^3.
|
|
9
|
+
"@aclymatepackages/atoms": "^3.3.2",
|
|
10
10
|
"@aclymatepackages/chart-helpers": "^2.0.8",
|
|
11
11
|
"@aclymatepackages/converters": "^1.0.0",
|
|
12
|
-
"@aclymatepackages/
|
|
13
|
-
"@aclymatepackages/fetch-aclymate-api": "^2.1.8",
|
|
12
|
+
"@aclymatepackages/fetch-aclymate-api": "^1.0.0",
|
|
14
13
|
"@aclymatepackages/formatters": "^1.0.0",
|
|
15
14
|
"@aclymatepackages/lists": "^1.0.0",
|
|
16
15
|
"@aclymatepackages/multi-part-form": "^2.0.1",
|
|
17
|
-
"@aclymatepackages/other-helpers": "^1.0.
|
|
16
|
+
"@aclymatepackages/other-helpers": "^1.0.9",
|
|
18
17
|
"@aclymatepackages/reg-exp": "^1.0.0",
|
|
19
|
-
"@aclymatepackages/subcategories": "^3.1
|
|
18
|
+
"@aclymatepackages/subcategories": "^3.2.1",
|
|
20
19
|
"@aclymatepackages/themes": "^3.0.9",
|
|
21
20
|
"@babel/preset-react": "^7.16.7",
|
|
22
21
|
"@emotion/react": "^11.11.1",
|
|
@@ -2,39 +2,18 @@ import React, { useState } from "react";
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
Grid,
|
|
5
|
-
Chip,
|
|
6
5
|
InputAdornment,
|
|
7
6
|
CircularProgress,
|
|
8
7
|
IconButton,
|
|
9
8
|
Typography,
|
|
10
|
-
ThemeProvider,
|
|
11
9
|
} from "@mui/material";
|
|
12
|
-
import CheckIcon from "@mui/icons-material/Check";
|
|
13
10
|
import SearchIcon from "@mui/icons-material/Search";
|
|
14
11
|
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
name,
|
|
21
|
-
isSelected,
|
|
22
|
-
setSelectedCompanyId,
|
|
23
|
-
}) => (
|
|
24
|
-
<Grid item>
|
|
25
|
-
<ThemeProvider theme={mainTheme}>
|
|
26
|
-
<Chip
|
|
27
|
-
label={name}
|
|
28
|
-
style={{ color: isSelected ? "white" : "inherit" }}
|
|
29
|
-
onClick={() =>
|
|
30
|
-
setSelectedCompanyId((currentId) => (currentId === id ? null : id))
|
|
31
|
-
}
|
|
32
|
-
icon={isSelected && <CheckIcon style={{ color: "white" }} />}
|
|
33
|
-
color={isSelected ? "primary" : "default"}
|
|
34
|
-
/>
|
|
35
|
-
</ThemeProvider>
|
|
36
|
-
</Grid>
|
|
37
|
-
);
|
|
12
|
+
import {
|
|
13
|
+
TextField,
|
|
14
|
+
LoadingButton,
|
|
15
|
+
MatchingCompanyChips,
|
|
16
|
+
} from "@aclymatepackages/atoms";
|
|
38
17
|
|
|
39
18
|
const PdlCompanySelect = ({
|
|
40
19
|
onCompanyNotFound,
|
|
@@ -43,6 +22,7 @@ const PdlCompanySelect = ({
|
|
|
43
22
|
matchingFunction,
|
|
44
23
|
label = "Enter your company's name",
|
|
45
24
|
actionLabel = "Please select your company from these options",
|
|
25
|
+
helperText,
|
|
46
26
|
}) => {
|
|
47
27
|
const [inputValue, setInputValue] = useState("");
|
|
48
28
|
const [matchingCompanies, setMatchingCompanies] = useState([]);
|
|
@@ -89,6 +69,10 @@ const PdlCompanySelect = ({
|
|
|
89
69
|
return fetchMatchingCompanies();
|
|
90
70
|
}
|
|
91
71
|
}}
|
|
72
|
+
helperText={
|
|
73
|
+
helperText ||
|
|
74
|
+
"Press enter or click the search icon to search for matching companies"
|
|
75
|
+
}
|
|
92
76
|
InputProps={{
|
|
93
77
|
endAdornment: (
|
|
94
78
|
<InputAdornment>
|
|
@@ -116,15 +100,11 @@ const PdlCompanySelect = ({
|
|
|
116
100
|
</Typography>
|
|
117
101
|
</Grid>
|
|
118
102
|
<Grid item container spacing={2} justifyContent="center">
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
setSelectedCompanyId={setSelectedCompanyId}
|
|
125
|
-
id={id}
|
|
126
|
-
/>
|
|
127
|
-
))}
|
|
103
|
+
<MatchingCompanyChips
|
|
104
|
+
matchingCompanies={matchingCompanies}
|
|
105
|
+
selectedCompanyId={selectedCompanyId}
|
|
106
|
+
setSelectedCompanyId={setSelectedCompanyId}
|
|
107
|
+
/>
|
|
128
108
|
</Grid>
|
|
129
109
|
<Grid item container spacing={2} justifyContent="center">
|
|
130
110
|
<Grid item>
|
|
@@ -23,7 +23,6 @@ const PlacesAutocomplete = ({
|
|
|
23
23
|
style,
|
|
24
24
|
textFieldProps,
|
|
25
25
|
coordinates,
|
|
26
|
-
appCheckToken,
|
|
27
26
|
}) => {
|
|
28
27
|
const [inputValue, setInputValue] = useState("");
|
|
29
28
|
const [options, setOptions] = useState([]);
|
|
@@ -45,7 +44,6 @@ const PlacesAutocomplete = ({
|
|
|
45
44
|
};
|
|
46
45
|
|
|
47
46
|
return await fetchAclymateApi({
|
|
48
|
-
appCheckToken,
|
|
49
47
|
path: `/google-maps/autocomplete/${dataString}`,
|
|
50
48
|
method: "GET",
|
|
51
49
|
signal,
|
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
import { Typography } from "@mui/material";
|
|
4
4
|
|
|
5
5
|
import { buildEmissionsSummarySentence } from "@aclymatepackages/other-helpers";
|
|
6
|
-
import { filterEmissionsByScope } from "@aclymatepackages/
|
|
6
|
+
import { filterEmissionsByScope } from "@aclymatepackages/other-helpers";
|
|
7
7
|
|
|
8
8
|
import ReportGraphContentLayout from "./ReportGraphContentLayout";
|
|
9
9
|
import EmissionsPieChart from "./EmissionsPieChart";
|