@aclymatepackages/modules 2.1.4 → 2.1.6

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.
@@ -124,6 +124,7 @@ const AccountingChart = _ref2 => {
124
124
  if (baseline) {
125
125
  return {
126
126
  baseline: 100,
127
+ isPledgeYear: pledgeYear === (0, _dayjs.default)(baselineDate).year(),
127
128
  year,
128
129
  tonsCo2e
129
130
  };
@@ -61,7 +61,8 @@ const EmissionsPieChart = _ref2 => {
61
61
  viewMode = "subcategories",
62
62
  pieChartRef,
63
63
  branding,
64
- showTooltip = true
64
+ showTooltip = true,
65
+ CustomTooltip
65
66
  } = _ref2;
66
67
  const subcategoriesArray = (0, _subcategories.buildSubcategoriesArray)(emissions);
67
68
  const scopesArray = (0, _subcategories.buildScopesWithColors)(branding);
@@ -88,6 +89,7 @@ const EmissionsPieChart = _ref2 => {
88
89
  });
89
90
  };
90
91
  const pieSlicesWithPercentages = formatChartPieSlices();
92
+ const TooltipComponent = CustomTooltip || PieChartCustomTooltip;
91
93
  return /*#__PURE__*/_react.default.createElement(_recharts.ResponsiveContainer, {
92
94
  height: "100%",
93
95
  aspect: 1.5
@@ -115,7 +117,7 @@ const EmissionsPieChart = _ref2 => {
115
117
  wrapperStyle: {
116
118
  zIndex: 99
117
119
  },
118
- content: /*#__PURE__*/_react.default.createElement(PieChartCustomTooltip, null)
120
+ content: /*#__PURE__*/_react.default.createElement(TooltipComponent, null)
119
121
  })));
120
122
  };
121
123
  var _default = exports.default = EmissionsPieChart;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aclymatepackages/modules",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "description": "Aclymate modules",
5
5
  "author": "William Loopesko",
6
6
  "main": "dist/index.js",
@@ -56,6 +56,7 @@ const AccountingChartTooltip = ({
56
56
  if (isPledgeYear) {
57
57
  return { title, subtitle: "Pledge Year" };
58
58
  }
59
+
59
60
  if (future) {
60
61
  return {
61
62
  title,
@@ -123,7 +124,12 @@ const AccountingChart = ({
123
124
  tonsCo2e,
124
125
  }) => {
125
126
  if (baseline) {
126
- return { baseline: 100, year, tonsCo2e };
127
+ return {
128
+ baseline: 100,
129
+ isPledgeYear: pledgeYear === dayjs(baselineDate).year(),
130
+ year,
131
+ tonsCo2e,
132
+ };
127
133
  }
128
134
 
129
135
  if (!pledgeYear || pledgeYear > year) {
@@ -54,6 +54,7 @@ const EmissionsPieChart = ({
54
54
  pieChartRef,
55
55
  branding,
56
56
  showTooltip = true,
57
+ CustomTooltip,
57
58
  }) => {
58
59
  const subcategoriesArray = buildSubcategoriesArray(emissions);
59
60
  const scopesArray = buildScopesWithColors(branding);
@@ -91,6 +92,8 @@ const EmissionsPieChart = ({
91
92
 
92
93
  const pieSlicesWithPercentages = formatChartPieSlices();
93
94
 
95
+ const TooltipComponent = CustomTooltip || PieChartCustomTooltip;
96
+
94
97
  return (
95
98
  <ResponsiveContainer height="100%" aspect={1.5}>
96
99
  <PieChart ref={pieChartRef}>
@@ -113,7 +116,7 @@ const EmissionsPieChart = ({
113
116
  {showTooltip && (
114
117
  <ChartTooltip
115
118
  wrapperStyle={{ zIndex: 99 }}
116
- content={<PieChartCustomTooltip />}
119
+ content={<TooltipComponent />}
117
120
  />
118
121
  )}
119
122
  </PieChart>