@widergy/utilitygo-smart-bill-web 1.7.3 → 1.10.1

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 (135) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/components/Advice/index.js +1 -2
  3. package/dist/components/Advice/styles.module.scss +2 -1
  4. package/dist/components/Amount/index.js +2 -2
  5. package/dist/components/Amount/styles.module.scss +10 -2
  6. package/dist/components/BarChart/constants.js +19 -3
  7. package/dist/components/BarChart/index.js +70 -101
  8. package/dist/components/BarChart/styles.module.scss +71 -0
  9. package/dist/components/BarChart/utils.js +31 -15
  10. package/dist/components/BillCalculation/components/ConceptCard/index.js +28 -9
  11. package/dist/components/BillCalculation/components/ConceptCard/styles.module.scss +16 -6
  12. package/dist/components/BillCalculation/index.js +10 -5
  13. package/dist/components/BillCalculation/utils.js +14 -9
  14. package/dist/components/BillSummary/components/BilledConcepts/components/Concept/index.js +11 -18
  15. package/dist/components/BillSummary/components/BilledConcepts/components/Concept/styles.module.scss +1 -5
  16. package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/constants.js +9 -3
  17. package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/index.js +21 -28
  18. package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/styles.module.scss +2 -2
  19. package/dist/components/BillSummary/components/BilledConcepts/constants.js +1 -1
  20. package/dist/components/BillSummary/components/BilledConcepts/index.js +8 -3
  21. package/dist/components/BillSummary/components/BilledConcepts/styles.module.scss +1 -1
  22. package/dist/components/BillSummary/components/BilledConcepts/utils.js +20 -6
  23. package/dist/components/BillSummary/styles.module.scss +2 -3
  24. package/dist/components/ConsumptionComparison/components/ComparisonTable/components/DataLine/index.js +3 -3
  25. package/dist/components/ConsumptionComparison/components/ComparisonTable/components/DataLine/styles.module.scss +4 -2
  26. package/dist/components/ConsumptionComparison/components/ComparisonTable/components/Season/index.js +3 -3
  27. package/dist/components/ConsumptionComparison/components/ComparisonTable/constants.js +61 -37
  28. package/dist/components/ConsumptionComparison/components/ComparisonTable/styles.module.scss +14 -6
  29. package/dist/components/ConsumptionComparison/components/ComparisonTable/utils.js +4 -2
  30. package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/index.js +2 -5
  31. package/dist/components/ConsumptionComparison/components/ConsumptionAdvice/styles.module.scss +4 -5
  32. package/dist/components/ConsumptionComparison/components/PercentageComparison/index.js +4 -3
  33. package/dist/components/ConsumptionComparison/components/PercentageComparison/styles.module.scss +3 -12
  34. package/dist/components/ConsumptionComparison/index.js +9 -11
  35. package/dist/components/ConsumptionComparison/styles.module.scss +5 -4
  36. package/dist/components/ConsumptionEnergyDetails/components/ConsumptionEnergyComparison/index.js +26 -2
  37. package/dist/components/ConsumptionEnergyDetails/components/ConsumptionEnergyComparison/styles.module.scss +2 -0
  38. package/dist/components/ConsumptionEnergyDetails/components/PercentageComparison/styles.module.scss +1 -1
  39. package/dist/components/ConsumptionEnergyDetails/index.js +21 -11
  40. package/dist/components/ConsumptionEnergyDetails/styles.module.scss +13 -1
  41. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/index.js +61 -42
  42. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/styles.module.scss +33 -20
  43. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/Card/utils.js +24 -0
  44. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderConsumption/index.js +13 -19
  45. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderConsumption/styles.module.scss +3 -6
  46. package/dist/components/ConsumptionIncluded/components/TimelineRow/components/HeaderSettlement/index.js +7 -9
  47. package/dist/components/ConsumptionIncluded/components/TimelineRow/index.js +11 -3
  48. package/dist/components/ConsumptionIncluded/components/TimelineRow/styles.module.scss +10 -13
  49. package/dist/components/ConsumptionIncluded/styles.module.scss +5 -0
  50. package/dist/components/ConsumptionIncluded/utils.js +6 -6
  51. package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/components/ReadingRow/styles.module.scss +2 -0
  52. package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/index.js +8 -6
  53. package/dist/components/ConsumptionPeriod/components/ConsumptionSummary/styles.module.scss +16 -4
  54. package/dist/components/ConsumptionPeriod/components/HistoryGraph/index.js +1 -7
  55. package/dist/components/ConsumptionPeriod/components/Reading/index.js +26 -9
  56. package/dist/components/ConsumptionPeriod/components/Reading/styles.module.scss +13 -8
  57. package/dist/components/ConsumptionPeriod/styles.module.scss +11 -10
  58. package/dist/components/Date/index.js +2 -2
  59. package/dist/components/Date/styles.module.scss +3 -0
  60. package/dist/components/DebtState/styles.module.scss +1 -1
  61. package/dist/components/IconAndDetails/index.js +4 -1
  62. package/dist/components/IconAndDetails/styles.module.scss +2 -2
  63. package/dist/components/Magnitude/index.js +6 -5
  64. package/dist/components/Magnitude/styles.module.scss +5 -5
  65. package/dist/components/MainBillData/components/BillAlert/components/BillParticularConditions/index.js +5 -5
  66. package/dist/components/MainBillData/components/BillAlert/styles.module.scss +5 -3
  67. package/dist/components/MainBillData/components/BillBody/components/ClientData/index.js +13 -13
  68. package/dist/components/MainBillData/components/BillBody/components/ClientData/styles.module.scss +3 -3
  69. package/dist/components/MainBillData/components/BillBody/components/ReadingDetails/styles.module.scss +1 -1
  70. package/dist/components/MainBillData/components/BillBody/styles.module.scss +4 -3
  71. package/dist/components/MainBillData/components/BillHeader/components/TypeAndNumber/index.js +3 -2
  72. package/dist/components/MainBillData/components/BillHeader/components/TypeAndNumber/styles.module.scss +7 -3
  73. package/dist/components/MainBillData/components/BillHeader/index.js +2 -2
  74. package/dist/components/MainBillData/components/BillHeader/styles.module.scss +10 -9
  75. package/dist/components/MainBillData/styles.module.scss +0 -1
  76. package/dist/components/Period/index.js +39 -11
  77. package/dist/components/Period/styles.module.scss +13 -4
  78. package/dist/components/PowerProgresBar/components/PowerConsumption/index.js +2 -3
  79. package/dist/components/PowerProgresBar/index.js +3 -4
  80. package/dist/components/RatesDefinition/components/BillRate/components/RatePrices/index.js +6 -17
  81. package/dist/components/RatesDefinition/components/BillRate/components/RatePrices/styles.module.scss +8 -3
  82. package/dist/components/RatesDefinition/components/BillRate/index.js +10 -11
  83. package/dist/components/RatesDefinition/components/BillRate/styles.module.scss +8 -29
  84. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/Category/index.js +9 -5
  85. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/Category/styles.module.scss +12 -18
  86. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/components/SubStage/index.js +4 -3
  87. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/index.js +13 -62
  88. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/components/Stage/styles.module.scss +2 -6
  89. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Bars/index.js +1 -0
  90. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/components/IndicatorLabel/index.js +18 -12
  91. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/components/IndicatorLabel/styles.module.scss +7 -3
  92. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/index.js +23 -14
  93. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/styles.module.scss +6 -19
  94. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/Indicator/utils.js +35 -1
  95. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/LegendItem/index.js +80 -0
  96. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/components/LegendItem/styles.module.scss +57 -0
  97. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/constants.js +17 -9
  98. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/styles.module.scss +2 -1
  99. package/dist/components/RatesDefinition/components/CategoryByConsumption/components/RateStagesGraph/utils.js +1 -1
  100. package/dist/components/RatesDefinition/components/CategoryByConsumption/index.js +61 -7
  101. package/dist/components/RatesDefinition/components/CategoryByConsumption/styles.module.scss +20 -4
  102. package/dist/components/RatesDefinition/components/PurchasedRate/index.js +12 -22
  103. package/dist/components/RatesDefinition/components/PurchasedRate/styles.module.scss +14 -44
  104. package/dist/components/RatesDefinition/index.js +16 -12
  105. package/dist/components/RatesDefinition/styles.module.scss +38 -10
  106. package/dist/components/StyledAmount/constants.js +0 -45
  107. package/dist/components/StyledAmount/index.js +5 -14
  108. package/dist/components/StyledAmount/styles.module.scss +14 -8
  109. package/dist/components/WithContextApi/index.js +9 -1
  110. package/dist/constants/deviceSizes.js +1 -1
  111. package/dist/index.js +28 -15
  112. package/dist/shared/Context/index.js +1 -1
  113. package/dist/shared/constants/aliases.js +532 -10
  114. package/dist/shared/constants/components.js +3 -1
  115. package/dist/shared/constants/consumptions.js +1 -1
  116. package/dist/shared/constants/readings.js +1 -1
  117. package/dist/shared/constants/stagesGraph.js +1 -1
  118. package/dist/shared/types/assetsTypes.js +1 -30
  119. package/dist/shared/types/billDataTypes.js +1 -1
  120. package/dist/shared/types/componentsTypes.js +4 -2
  121. package/dist/shared/types/rateStagesTypes.js +1 -1
  122. package/dist/shared/utils/consumptions.js +3 -3
  123. package/dist/shared/utils/context.js +3 -1
  124. package/dist/shared/utils/periods.js +1 -1
  125. package/dist/shared/utils/readings.js +1 -1
  126. package/dist/shared/utils/stagesGraph.js +1 -1
  127. package/dist/utils.js +1 -1
  128. package/package.json +2 -3
  129. package/dist/components/BarChart/components/CustomBar/index.js +0 -111
  130. package/dist/components/BarChart/components/CustomLabelText/index.js +0 -48
  131. package/dist/components/BarChart/components/CustomXAxisLabel/index.js +0 -58
  132. package/dist/components/BarChart/styles.js +0 -90
  133. package/dist/components/BillSummary/components/BilledConcepts/components/PieChartContainer/utils.js +0 -27
  134. package/dist/components/BillSummary/components/Rate/index.js +0 -56
  135. package/dist/components/BillSummary/components/Rate/styles.module.scss +0 -43
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.billDataTypes = exports.periodTypes = exports.settlementsTypes = exports.consumptionTypes = void 0;
6
+ exports.settlementsTypes = exports.periodTypes = exports.consumptionTypes = exports.billDataTypes = void 0;
7
7
 
8
8
  var _propTypes = require("prop-types");
9
9
 
@@ -21,7 +21,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
21
21
 
22
22
  var componentTypes = (0, _propTypes.oneOfType)([_propTypes.element, _propTypes.node, _propTypes.func, _propTypes.any]);
23
23
  exports.componentTypes = componentTypes;
24
- var componentsTypes = (0, _propTypes.shape)((_shape = {}, _defineProperty(_shape, COMPONENTS.BUTTON, componentTypes), _defineProperty(_shape, COMPONENTS.DIALOG, componentTypes), _defineProperty(_shape, COMPONENTS.EXTERNAL_LINK, componentTypes), _defineProperty(_shape, COMPONENTS.LABEL, componentTypes), _defineProperty(_shape, COMPONENTS.PROGRESS_BAR, componentTypes), _defineProperty(_shape, COMPONENTS.TOOLTIP, componentTypes), _defineProperty(_shape, COMPONENTS.TOUCHABLE, componentTypes), _defineProperty(_shape, COMPONENTS.CARD, componentTypes), _defineProperty(_shape, COMPONENTS.MARKDOWN, componentTypes), _defineProperty(_shape, COMPONENTS.TOGGLE, componentTypes), _shape));
24
+ var componentsTypes = (0, _propTypes.shape)((_shape = {}, _defineProperty(_shape, COMPONENTS.BUTTON, componentTypes), _defineProperty(_shape, COMPONENTS.DIALOG, componentTypes), _defineProperty(_shape, COMPONENTS.EXTERNAL_LINK, componentTypes), _defineProperty(_shape, COMPONENTS.LABEL, componentTypes), _defineProperty(_shape, COMPONENTS.PROGRESS_BAR, componentTypes), _defineProperty(_shape, COMPONENTS.TOOLTIP, componentTypes), _defineProperty(_shape, COMPONENTS.TOUCHABLE, componentTypes), _defineProperty(_shape, COMPONENTS.CARD, componentTypes), _defineProperty(_shape, COMPONENTS.MARKDOWN, componentTypes), _defineProperty(_shape, COMPONENTS.TOGGLE, componentTypes), _defineProperty(_shape, COMPONENTS.BAR_CHART, componentTypes), _shape));
25
25
  exports.componentsTypes = componentsTypes;
26
26
  var unpackedComponentsTypes = {
27
27
  Button: componentTypes,
@@ -32,6 +32,8 @@ var unpackedComponentsTypes = {
32
32
  Touchable: componentTypes,
33
33
  Card: componentTypes,
34
34
  Markdown: componentTypes,
35
- Toggle: componentTypes
35
+ Toggle: componentTypes,
36
+ BarChart: componentTypes,
37
+ PieChart: componentTypes
36
38
  };
37
39
  exports.unpackedComponentsTypes = unpackedComponentsTypes;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.rateStagesTypes = exports.stageType = exports.subStageType = void 0;
6
+ exports.subStageType = exports.stageType = exports.rateStagesTypes = void 0;
7
7
 
8
8
  var _propTypes = require("prop-types");
9
9
 
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.consumptionDataMapper = exports.getConsumptionHistoryData = exports.getDailyConsumption = exports.getTotalConsumption = exports.getRemainingConsumption = exports.getCurrentConsumption = void 0;
6
+ exports.getTotalConsumption = exports.getRemainingConsumption = exports.getDailyConsumption = exports.getCurrentConsumption = exports.getConsumptionHistoryData = exports.consumptionDataMapper = void 0;
7
7
 
8
- var _moment = _interopRequireDefault(require("moment"));
8
+ var _dayjs = _interopRequireDefault(require("dayjs"));
9
9
 
10
10
  var _lodash = _interopRequireDefault(require("lodash"));
11
11
 
@@ -71,7 +71,7 @@ var getDailyConsumption = function getDailyConsumption(period, energyType) {
71
71
  exports.getDailyConsumption = getDailyConsumption;
72
72
 
73
73
  var formatPeriod = function formatPeriod(period) {
74
- return period.number && period.year && "".concat(period.number, "/").concat((0, _moment.default)(period.year, 'YYYY').format('YY'));
74
+ return period.number && period.year && "".concat(period.number, "/").concat((0, _dayjs.default)(period.year, 'YYYY').format('YY'));
75
75
  };
76
76
 
77
77
  var getConsumptionHistoryData = function getConsumptionHistoryData(billDataParameter, energyType, showPeriodsInChronologicalOrder) {
@@ -25,7 +25,9 @@ var unpackComponents = function unpackComponents(contextApiInfo) {
25
25
  Touchable: components[COMPONENTS.TOUCHABLE],
26
26
  Card: components[COMPONENTS.CARD],
27
27
  Markdown: components[COMPONENTS.MARKDOWN],
28
- Toggle: components[COMPONENTS.TOGGLE]
28
+ Toggle: components[COMPONENTS.TOGGLE],
29
+ BarChart: components[COMPONENTS.BAR_CHART],
30
+ PieChart: components[COMPONENTS.PIE_CHART]
29
31
  };
30
32
  };
31
33
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getSavingsPercentage = exports.comparePeriods = exports.areSamePeriods = exports.getLastYearPeriod = exports.getCurrentPeriod = void 0;
6
+ exports.getSavingsPercentage = exports.getLastYearPeriod = exports.getCurrentPeriod = exports.comparePeriods = exports.areSamePeriods = void 0;
7
7
 
8
8
  var _seamlessImmutable = require("seamless-immutable");
9
9
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getActiveEnergyRecord = exports.getReadingPeriod = void 0;
6
+ exports.getReadingPeriod = exports.getActiveEnergyRecord = void 0;
7
7
 
8
8
  var _seamlessImmutable = require("seamless-immutable");
9
9
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getSubStageWidth = exports.getStageRangeWidth = exports.getSubStageRangeWidth = exports.getCurrentStage = void 0;
6
+ exports.getSubStageWidth = exports.getSubStageRangeWidth = exports.getStageRangeWidth = exports.getCurrentStage = void 0;
7
7
 
8
8
  var _stagesGraph = require("../constants/stagesGraph");
9
9
 
package/dist/utils.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.formatNumber = exports.numberOrDash = exports.stringOrDash = void 0;
6
+ exports.stringOrDash = exports.numberOrDash = exports.formatNumber = void 0;
7
7
 
8
8
  var _numeral = _interopRequireDefault(require("config/numeral"));
9
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/utilitygo-smart-bill-web",
3
- "version": "1.7.3",
3
+ "version": "1.10.1",
4
4
  "description": "UtilityGO SmartBill Web",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -52,14 +52,13 @@
52
52
  ],
53
53
  "dependencies": {
54
54
  "@widergy/web-utils": ">=0.4.1",
55
+ "dayjs": "^1.10.7",
55
56
  "lodash": ">=4.17.4",
56
- "moment": ">=2.19.1",
57
57
  "node-sass": "^4.11.0",
58
58
  "numeral": ">=2.0.6",
59
59
  "react-jss": "^8.6.1",
60
60
  "react-perfect-scrollbar": "^1.5.3",
61
61
  "react-responsive": "^4.1.0",
62
- "recharts": "github:widergy/recharts#master",
63
62
  "sass-loader": "^7.1.0",
64
63
  "seamless-immutable": "^7.1.4",
65
64
  "yarn": "^1.22.10"
@@ -1,111 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _react = _interopRequireWildcard(require("react"));
11
-
12
- var _propTypes = require("prop-types");
13
-
14
- var _numeral = _interopRequireDefault(require("config/numeral"));
15
-
16
- var _utils = require("../../utils");
17
-
18
- var _styles = require("../../styles");
19
-
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
-
24
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
-
26
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
27
-
28
- var CustomBar = function CustomBar(_ref) {
29
- var x = _ref.x,
30
- y = _ref.y,
31
- width = _ref.width,
32
- height = _ref.height,
33
- payload = _ref.payload,
34
- currentPeriod = _ref.currentPeriod,
35
- lastYearPeriod = _ref.lastYearPeriod,
36
- isDesktop = _ref.isDesktop,
37
- font = _ref.font,
38
- fontSize = _ref.fontSize,
39
- rotateNumbers = _ref.rotateNumbers;
40
- var period = payload.period;
41
- var bar = _styles.styles.bar,
42
- label = _styles.styles.label;
43
-
44
- var getBarStyles = function getBarStyles() {
45
- switch (period) {
46
- case currentPeriod:
47
- return {
48
- color: bar.currentPeriodBarColor,
49
- border: bar.currentPeriodBarBorderColor
50
- };
51
-
52
- case lastYearPeriod:
53
- return {
54
- color: bar.lastYearBarColor,
55
- border: bar.lastYearBarBorderColor
56
- };
57
-
58
- default:
59
- return {
60
- color: bar.baseBarColor,
61
- border: bar.baseBarBorderColor
62
- };
63
- }
64
- };
65
-
66
- var barStyles = (0, _react.useMemo)(getBarStyles, [period, currentPeriod, lastYearPeriod]);
67
- var labelColor = (0, _react.useMemo)((0, _utils.getLabelColor)(period, currentPeriod, lastYearPeriod), [period, currentPeriod, lastYearPeriod]);
68
- var transformProps = !rotateNumbers ? {
69
- x: x + (isDesktop ? bar.desktopSize : bar.mobileSize) / 2,
70
- y: y - label.barLabel.marginBottom,
71
- textAnchor: 'middle'
72
- } : {
73
- x: x + label.barLabel.marginBottom,
74
- y: y + (isDesktop ? bar.desktopSize : bar.mobileSize) / 2,
75
- transform: 'rotate(-90)',
76
- dominantBaseline: 'middle',
77
- 'transform-origin': "".concat(x, " ").concat(y)
78
- };
79
- return /*#__PURE__*/_react.default.createElement("g", null, /*#__PURE__*/_react.default.createElement("text", _extends({
80
- fontWeight: period === currentPeriod && 'bold',
81
- fill: labelColor,
82
- fontFamily: font,
83
- fontSize: fontSize,
84
- opacity: period === currentPeriod ? 1 : label.opacity
85
- }, transformProps), (0, _numeral.default)(payload.consumption).format('0,0')), /*#__PURE__*/_react.default.createElement("rect", {
86
- x: x,
87
- y: y,
88
- width: width,
89
- height: height,
90
- fill: barStyles.color,
91
- stroke: barStyles.border
92
- }));
93
- };
94
-
95
- CustomBar.propTypes = {
96
- x: _propTypes.number,
97
- y: _propTypes.number,
98
- width: _propTypes.number,
99
- height: _propTypes.number,
100
- payload: (0, _propTypes.shape)({
101
- period: _propTypes.string
102
- }),
103
- currentPeriod: _propTypes.string,
104
- lastYearPeriod: _propTypes.string,
105
- isDesktop: _propTypes.bool,
106
- font: _propTypes.string,
107
- fontSize: _propTypes.number,
108
- rotateNumbers: _propTypes.bool
109
- };
110
- var _default = CustomBar;
111
- exports.default = _default;
@@ -1,48 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _propTypes = require("prop-types");
11
-
12
- var _styles = require("../../styles");
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- function CustomLabelText(_ref) {
17
- var x = _ref.x,
18
- y = _ref.y,
19
- text = _ref.text,
20
- color = _ref.color,
21
- bold = _ref.bold,
22
- opacity = _ref.opacity,
23
- fontFamily = _ref.fontFamily;
24
- var label = _styles.styles.label;
25
- return /*#__PURE__*/_react.default.createElement("text", {
26
- x: x,
27
- y: y,
28
- alignmentBaseline: "central",
29
- fill: color,
30
- fontFamily: fontFamily,
31
- fontSize: label.fontSize,
32
- fontWeight: bold && 'bold',
33
- textAnchor: "middle",
34
- opacity: opacity
35
- }, text);
36
- }
37
-
38
- CustomLabelText.propTypes = {
39
- x: _propTypes.number.isRequired,
40
- y: _propTypes.number.isRequired,
41
- text: (0, _propTypes.oneOfType)([_propTypes.string, _propTypes.number]).isRequired,
42
- color: _propTypes.string.isRequired,
43
- bold: _propTypes.bool,
44
- fontFamily: _propTypes.string,
45
- opacity: _propTypes.number
46
- };
47
- var _default = CustomLabelText;
48
- exports.default = _default;
@@ -1,58 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _react = _interopRequireWildcard(require("react"));
11
-
12
- var _propTypes = require("prop-types");
13
-
14
- var _CustomLabelText = _interopRequireDefault(require("../CustomLabelText"));
15
-
16
- var _utils = require("../../utils");
17
-
18
- var _styles = require("../../styles");
19
-
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
-
24
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
-
26
- var CustomXAxisLabel = function CustomXAxisLabel(_ref) {
27
- var x = _ref.x,
28
- y = _ref.y,
29
- currentPeriod = _ref.currentPeriod,
30
- lastYearPeriod = _ref.lastYearPeriod,
31
- payload = _ref.payload,
32
- fontFamily = _ref.fontFamily;
33
- var label = _styles.styles.label;
34
- var period = payload.value;
35
- var labelColor = (0, _react.useMemo)((0, _utils.getLabelColor)(period, currentPeriod, lastYearPeriod), [period, currentPeriod, lastYearPeriod]);
36
- return /*#__PURE__*/_react.default.createElement("svg", null, /*#__PURE__*/_react.default.createElement(_CustomLabelText.default, {
37
- x: x,
38
- y: y + label.x.tickMarginTop,
39
- bold: true,
40
- color: labelColor,
41
- opacity: period === currentPeriod ? 1 : label.opacity,
42
- text: period,
43
- fontFamily: fontFamily
44
- }));
45
- };
46
-
47
- CustomXAxisLabel.propTypes = {
48
- x: _propTypes.number,
49
- y: _propTypes.number,
50
- currentPeriod: _propTypes.string,
51
- lastYearPeriod: _propTypes.string,
52
- fontFamily: _propTypes.string,
53
- payload: (0, _propTypes.shape)({
54
- value: _propTypes.string
55
- })
56
- };
57
- var _default = CustomXAxisLabel;
58
- exports.default = _default;
@@ -1,90 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.styles = void 0;
7
-
8
- var _colorsExport = _interopRequireDefault(require("../../scss/variables/_colorsExport.scss"));
9
-
10
- var _fontFamilies = _interopRequireDefault(require("../../scss/variables/_fontFamilies.scss"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
- var styles = {
15
- chart: {
16
- desktop: {
17
- size: {
18
- width: 600,
19
- height: 200
20
- },
21
- margin: {
22
- right: 20,
23
- left: -20,
24
- bottom: 40,
25
- top: 40
26
- }
27
- },
28
- mobile: {
29
- size: {
30
- width: 350,
31
- height: 200
32
- },
33
- margin: {
34
- right: 15,
35
- left: -35,
36
- bottom: 30,
37
- top: 30
38
- }
39
- },
40
- mobileMonthly: {
41
- size: {
42
- width: 350,
43
- height: 250
44
- },
45
- margin: {
46
- right: 15,
47
- left: -35,
48
- bottom: 30,
49
- top: 60
50
- }
51
- }
52
- },
53
- xAxis: {
54
- color: _colorsExport.default.axisColor
55
- },
56
- yAxis: {
57
- labelAngle: -90
58
- },
59
- label: {
60
- baseColor: _colorsExport.default.gray,
61
- currentPeriodColor: _colorsExport.default.primary,
62
- lastYearColor: _colorsExport.default.lightPrimary,
63
- fontFamily: _fontFamilies.default.nunito,
64
- fontSize: 11,
65
- opacity: 0.8,
66
- x: {
67
- tickMarginTop: 5,
68
- axisLabelOffset: 10
69
- },
70
- y: {
71
- axisLabelOffset: 15
72
- },
73
- barLabel: {
74
- marginBottom: 7,
75
- fontSize: 14,
76
- smallFontSize: 10
77
- }
78
- },
79
- bar: {
80
- desktopSize: 30,
81
- mobileSize: 25,
82
- baseBarColor: _colorsExport.default.grayBar,
83
- currentPeriodBarColor: _colorsExport.default.primaryBar,
84
- lastYearBarColor: _colorsExport.default.lightPrimaryBar,
85
- baseBarBorderColor: _colorsExport.default.transparent,
86
- currentPeriodBarBorderColor: _colorsExport.default.primary,
87
- lastYearBarBorderColor: _colorsExport.default.transparent
88
- }
89
- };
90
- exports.styles = styles;
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.renderCustomizedLabel = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _constants = require("./constants");
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
- var renderCustomizedLabel = function renderCustomizedLabel(cx, cy, midAngle, innerRadius, outerRadius, percent) {
15
- var radius = innerRadius + (outerRadius - innerRadius) * 0.5;
16
- var x = cx + radius * Math.cos(-midAngle * _constants.RADIAN);
17
- var y = cy + radius * Math.sin(-midAngle * _constants.RADIAN);
18
- return /*#__PURE__*/_react.default.createElement("text", {
19
- x: x,
20
- y: y,
21
- fill: "white",
22
- textAnchor: x > cx ? 'start' : 'end',
23
- dominantBaseline: "central"
24
- }, "".concat((percent * 100).toFixed(0), "%"));
25
- };
26
-
27
- exports.renderCustomizedLabel = renderCustomizedLabel;
@@ -1,56 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _smartBillTypes = require("../../../../shared/types/smartBillTypes");
11
-
12
- var _billDataTypes = require("../../../../shared/types/billDataTypes");
13
-
14
- var _WithContextApi = _interopRequireDefault(require("../../../WithContextApi"));
15
-
16
- var _RateAndCategory = _interopRequireDefault(require("../../../RateAndCategory"));
17
-
18
- var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
19
-
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
- var Rate = function Rate(_ref) {
23
- var _billData$rate, _billData$rate2;
24
-
25
- var contextApiInfo = _ref.contextApiInfo,
26
- billData = _ref.billData;
27
- var config = contextApiInfo.config,
28
- Label = contextApiInfo.Label;
29
- var rateTitle = config.texts.billSummary.rateTitle;
30
- var rate = billData === null || billData === void 0 ? void 0 : (_billData$rate = billData.rate) === null || _billData$rate === void 0 ? void 0 : _billData$rate.purchased;
31
- var category = billData === null || billData === void 0 ? void 0 : (_billData$rate2 = billData.rate) === null || _billData$rate2 === void 0 ? void 0 : _billData$rate2.category;
32
- return /*#__PURE__*/_react.default.createElement("div", {
33
- className: _stylesModule.default.container
34
- }, /*#__PURE__*/_react.default.createElement(Label, {
35
- bold: true,
36
- large: true,
37
- className: _stylesModule.default.title
38
- }, rateTitle), /*#__PURE__*/_react.default.createElement(_RateAndCategory.default, {
39
- rate: rate,
40
- category: category,
41
- classes: {
42
- container: _stylesModule.default.rateAndCategoryContainer,
43
- purchasedRate: _stylesModule.default.purchasedRate,
44
- category: _stylesModule.default.category
45
- }
46
- }));
47
- };
48
-
49
- Rate.propTypes = {
50
- contextApiInfo: _smartBillTypes.contextApiInfoTypes,
51
- billData: _billDataTypes.billDataTypes
52
- };
53
-
54
- var _default = (0, _WithContextApi.default)()(Rate);
55
-
56
- exports.default = _default;
@@ -1,43 +0,0 @@
1
- @import '../../../../scss/variables/_colorsExport.scss';
2
- @import '../../../../scss/variables/_fontSizes';
3
- @import '../../../../scss/variables/_mediaQueries';
4
- @import '../../../..scss/variables/_sizes';
5
-
6
- .container {
7
- background-color: $white;
8
- border: 1px solid $borders-gray;
9
- border-radius: $default-container-border-radius;
10
- display: flex;
11
- flex-flow: column;
12
- justify-content: space-between;
13
- padding: $default-container-padding;
14
- width: 50%;
15
-
16
- @media #{$tablet-mobile} {
17
- padding: $default-container-padding;
18
- }
19
- }
20
-
21
- .title {
22
- margin-bottom: 15px;
23
-
24
- @media #{$tablet-mobile} {
25
- margin-bottom: 0;
26
- }
27
- }
28
-
29
- .rateAndCategoryContainer {
30
- @media #{$tablet-mobile} {
31
- align-items: flex-start;
32
- }
33
- }
34
-
35
- .purchasedRate {
36
- font-size: $xxlarge;
37
- margin-bottom: 9px;
38
- }
39
-
40
- .category {
41
- font-size: $small;
42
- padding: 7px 10px;
43
- }