@widergy/energy-ui 3.10.0 → 3.10.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.
- package/CHANGELOG.md +17 -0
- package/dist/components/UTBarChart/components/YAxis/index.js +1 -3
- package/dist/components/UTBarChart/components/YAxis/utils.js +2 -5
- package/dist/components/UTBarChart/constants.js +5 -2
- package/dist/components/UTBarChart/index.js +10 -9
- package/dist/components/UTBarChart/utils.js +5 -2
- package/dist/components/UTOnboarding/index.js +4 -3
- package/dist/components/UTOnboarding/styles.module.scss +4 -6
- package/dist/components/UTOnboarding/theme.js +12 -4
- package/dist/components/UTWizard/styles.module.scss +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## [3.10.2](https://github.com/widergy/energy-ui/compare/v3.10.1...v3.10.2) (2024-06-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* some fixes ([aa772bc](https://github.com/widergy/energy-ui/commit/aa772bc6406e8cdc5bd8550905dd103aa4592248))
|
|
7
|
+
* wizard ([7be8e21](https://github.com/widergy/energy-ui/commit/7be8e212e3a2804b87dd59ec5229e939c41d6771))
|
|
8
|
+
|
|
9
|
+
## [3.10.1](https://github.com/widergy/energy-ui/compare/v3.10.0...v3.10.1) (2024-06-18)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* adjust scale range ([4d7de48](https://github.com/widergy/energy-ui/commit/4d7de4815f634e0878a250a7a1597751ba9f7ca7))
|
|
15
|
+
* constant ([6fb884e](https://github.com/widergy/energy-ui/commit/6fb884eca4f36a16de899d4136fc7b8fec55db92))
|
|
16
|
+
* refactor ([5d526f5](https://github.com/widergy/energy-ui/commit/5d526f5c1d0e1c7ff52ccb952153c2120d6e6ee5))
|
|
17
|
+
|
|
1
18
|
# [3.10.0](https://github.com/widergy/energy-ui/compare/v3.9.1...v3.10.0) (2024-06-07)
|
|
2
19
|
|
|
3
20
|
|
|
@@ -50,9 +50,7 @@ const YAxis = _ref => {
|
|
|
50
50
|
x: x,
|
|
51
51
|
y: unitSubtitleYPosition
|
|
52
52
|
}, unitSubtitle), axis.map(index => {
|
|
53
|
-
const newMaxValue = (0, _utils.yAxisMaxValueRounder)(maxValue, yAxisTicks);
|
|
54
53
|
const value = Math.round((maxValue - index * maxValue / (yAxisTicks - 1)) * 100) / 100;
|
|
55
|
-
const labelValue = Math.round((newMaxValue - index * newMaxValue / (yAxisTicks - 1)) * 100) / 100;
|
|
56
54
|
return /*#__PURE__*/_react.default.createElement(_AxisElement.default, {
|
|
57
55
|
className: classes.yAxisLabel,
|
|
58
56
|
setRef: (0, _utils.applyToIndex)(0, index, labelRef),
|
|
@@ -60,7 +58,7 @@ const YAxis = _ref => {
|
|
|
60
58
|
graphYStart: graphYStart,
|
|
61
59
|
x: x,
|
|
62
60
|
value: value,
|
|
63
|
-
label: valueDecorator((0, _numeral.default)(
|
|
61
|
+
label: valueDecorator((0, _numeral.default)(value).format(value < 1 && value > 0 ? '0,0.00' : '0,0')),
|
|
64
62
|
height: height
|
|
65
63
|
});
|
|
66
64
|
}));
|
|
@@ -3,12 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.applyToIndex = void 0;
|
|
7
7
|
const applyToIndex = function (targetIndex, currentIndex, prop) {
|
|
8
8
|
let defaultValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
9
9
|
return currentIndex === targetIndex ? prop : defaultValue;
|
|
10
10
|
};
|
|
11
|
-
exports.applyToIndex = applyToIndex;
|
|
12
|
-
const TICKS_MULTIPLIER_DISTANCE = 5;
|
|
13
|
-
const yAxisMaxValueRounder = (maxValue, yAxisTicks) => maxValue < 25 ? maxValue : Math.ceil(maxValue / (yAxisTicks - 1) / TICKS_MULTIPLIER_DISTANCE) * TICKS_MULTIPLIER_DISTANCE * (yAxisTicks - 1);
|
|
14
|
-
exports.yAxisMaxValueRounder = yAxisMaxValueRounder;
|
|
11
|
+
exports.applyToIndex = applyToIndex;
|
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.DEFAULT_SCROLL_PADDING = exports.DEFAULT_MAX_VALUE = exports.DEFAULT_MARGIN_TOP = exports.DEFAULT_AXIS_PADDING = void 0;
|
|
6
|
+
exports.TICKS_MULTIPLIER_DISTANCE = exports.LOWER_BOUND_DEFAULT = exports.LIMIT_MAX_VALUE_ROUNDER = exports.DEFAULT_SCROLL_PADDING = exports.DEFAULT_MAX_VALUE = exports.DEFAULT_MARGIN_TOP = exports.DEFAULT_AXIS_PADDING = void 0;
|
|
7
7
|
const DEFAULT_AXIS_PADDING = exports.DEFAULT_AXIS_PADDING = 10;
|
|
8
8
|
const DEFAULT_SCROLL_PADDING = exports.DEFAULT_SCROLL_PADDING = 20;
|
|
9
9
|
const DEFAULT_MARGIN_TOP = exports.DEFAULT_MARGIN_TOP = 40;
|
|
10
|
-
const DEFAULT_MAX_VALUE = exports.DEFAULT_MAX_VALUE = 100;
|
|
10
|
+
const DEFAULT_MAX_VALUE = exports.DEFAULT_MAX_VALUE = 100;
|
|
11
|
+
const TICKS_MULTIPLIER_DISTANCE = exports.TICKS_MULTIPLIER_DISTANCE = 5;
|
|
12
|
+
const LOWER_BOUND_DEFAULT = exports.LOWER_BOUND_DEFAULT = 0;
|
|
13
|
+
const LIMIT_MAX_VALUE_ROUNDER = exports.LIMIT_MAX_VALUE_ROUNDER = 25;
|
|
@@ -123,15 +123,16 @@ const UTBarChart = _ref => {
|
|
|
123
123
|
GRAPH_Y_END,
|
|
124
124
|
GRAPH_Y_START
|
|
125
125
|
} = (0, _utils.getGraphAttributes)(containerWidth, containerHeight, marginLeft, marginRight, marginBottom, pagination ? 0 : minBarWidth, formattedData[0].length, barPadding, groups, spacingOptions);
|
|
126
|
-
const
|
|
127
|
-
const
|
|
128
|
-
const maxAbsoluteValue = Math.max(
|
|
129
|
-
const
|
|
126
|
+
const [linearLowerBound, linearUpperBound] = (0, _utils.getBounds)(maxLinearValue, yAxisTicks);
|
|
127
|
+
const [barLowerBound, barUpperBound] = (0, _utils.getBounds)(maxBarValue, yAxisTicks);
|
|
128
|
+
const maxAbsoluteValue = Math.max(linearUpperBound, barUpperBound);
|
|
129
|
+
const barMaxValue = singleYAxis ? maxAbsoluteValue : barUpperBound;
|
|
130
|
+
const yAxis = d3.scaleLinear().domain([barLowerBound, barMaxValue]).range([GRAPH_Y_START, GRAPH_Y_END]);
|
|
130
131
|
const xAxis = d3.scaleBand().domain(d3.range(formattedData[0].length)).range([GRAPH_X_START, GRAPH_X_END]).padding(barPadding);
|
|
131
132
|
const groupWidth = xAxis.bandwidth();
|
|
132
133
|
const xSubAxis = d3.scaleBand().domain(d3.range(groups)).range([0, groupWidth]).padding(barPadding);
|
|
133
134
|
const barWidth = xSubAxis.bandwidth();
|
|
134
|
-
const linearYAxis = singleYAxis ? yAxis : d3.scaleLinear().domain([
|
|
135
|
+
const linearYAxis = singleYAxis ? yAxis : d3.scaleLinear().domain([linearLowerBound, linearUpperBound]).range([GRAPH_Y_START, GRAPH_Y_END]);
|
|
135
136
|
(0, _react.useEffect)(() => {
|
|
136
137
|
setCurrentPage(0);
|
|
137
138
|
}, [barData]);
|
|
@@ -168,7 +169,7 @@ const UTBarChart = _ref => {
|
|
|
168
169
|
graphXEnd: GRAPH_X_END,
|
|
169
170
|
graphXStart: GRAPH_X_START,
|
|
170
171
|
graphYStart: GRAPH_Y_START,
|
|
171
|
-
levels: (0, _utils.getGrid)(yAxisTicks,
|
|
172
|
+
levels: (0, _utils.getGrid)(yAxisTicks, barMaxValue),
|
|
172
173
|
yAxis: yAxis
|
|
173
174
|
}), formattedData.map((data, group) => /*#__PURE__*/_react.default.createElement(_Bars.default, {
|
|
174
175
|
barBorderRadius: barBorderRadius,
|
|
@@ -181,7 +182,7 @@ const UTBarChart = _ref => {
|
|
|
181
182
|
groups: groups,
|
|
182
183
|
groupWidth: groupWidth,
|
|
183
184
|
highlightWidth: highlightWidth,
|
|
184
|
-
maxBarValue:
|
|
185
|
+
maxBarValue: barUpperBound,
|
|
185
186
|
onBarClick: onBarClick,
|
|
186
187
|
padding: barPadding,
|
|
187
188
|
selectable: selectable,
|
|
@@ -222,7 +223,7 @@ const UTBarChart = _ref => {
|
|
|
222
223
|
classes: classes,
|
|
223
224
|
graphYEnd: GRAPH_Y_END,
|
|
224
225
|
graphYStart: GRAPH_Y_START,
|
|
225
|
-
maxValue:
|
|
226
|
+
maxValue: barMaxValue,
|
|
226
227
|
setRef: marginLeftRef,
|
|
227
228
|
textAnchor: "end",
|
|
228
229
|
unit: barUnit,
|
|
@@ -236,7 +237,7 @@ const UTBarChart = _ref => {
|
|
|
236
237
|
classes: classes,
|
|
237
238
|
graphYEnd: GRAPH_Y_END,
|
|
238
239
|
graphYStart: GRAPH_Y_START,
|
|
239
|
-
maxValue:
|
|
240
|
+
maxValue: linearUpperBound,
|
|
240
241
|
setRef: marginRightRef,
|
|
241
242
|
textAnchor: "start",
|
|
242
243
|
unit: linearUnit,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getPages = exports.getMinValue = exports.getMaxValues = exports.getMaxValue = exports.getGrid = exports.getGraphAttributes = exports.getFormattedLinearData = exports.getFormattedDecorators = exports.getFormattedData = exports.flattenData = exports.flattenAndReduceBarData = void 0;
|
|
6
|
+
exports.getPages = exports.getMinValue = exports.getMaxValues = exports.getMaxValue = exports.getGrid = exports.getGraphAttributes = exports.getFormattedLinearData = exports.getFormattedDecorators = exports.getFormattedData = exports.getBounds = exports.flattenData = exports.flattenAndReduceBarData = void 0;
|
|
7
7
|
var _array = require("@widergy/web-utils/lib/array");
|
|
8
8
|
var d3 = _interopRequireWildcard(require("d3"));
|
|
9
9
|
var _constants = require("./constants");
|
|
@@ -161,4 +161,7 @@ const getGrid = (ticks, maxValue) => new Array(ticks).fill(0).map((_, index) =>
|
|
|
161
161
|
} = _ref11;
|
|
162
162
|
return !!value;
|
|
163
163
|
});
|
|
164
|
-
exports.getGrid = getGrid;
|
|
164
|
+
exports.getGrid = getGrid;
|
|
165
|
+
const yAxisMaxValueRounder = (maxValue, yAxisTicks) => maxValue < _constants.LIMIT_MAX_VALUE_ROUNDER ? maxValue : Math.ceil(maxValue / (yAxisTicks - 1) / _constants.TICKS_MULTIPLIER_DISTANCE) * _constants.TICKS_MULTIPLIER_DISTANCE * (yAxisTicks - 1);
|
|
166
|
+
const getBounds = (maxValue, yAxisTicks) => [_constants.LOWER_BOUND_DEFAULT, yAxisMaxValueRounder(maxValue, yAxisTicks)];
|
|
167
|
+
exports.getBounds = getBounds;
|
|
@@ -22,6 +22,7 @@ const UTOnboarding = _ref => {
|
|
|
22
22
|
let {
|
|
23
23
|
classes: themeClasses,
|
|
24
24
|
classNames,
|
|
25
|
+
enabled,
|
|
25
26
|
handleComplete,
|
|
26
27
|
handleOnClose,
|
|
27
28
|
options,
|
|
@@ -31,7 +32,6 @@ const UTOnboarding = _ref => {
|
|
|
31
32
|
const classes = (0, _react.useMemo)(() => (0, _classesUtils.mergeClasses)(themeClasses, classNames), [themeClasses, classNames]) || {};
|
|
32
33
|
const [currentStep, setCurrentStep] = (0, _react.useState)(0);
|
|
33
34
|
const [loading, setLoading] = (0, _react.useState)(true);
|
|
34
|
-
const [enabled, setEnabled] = (0, _react.useState)(true);
|
|
35
35
|
const currentStepIsSuggestion = (_steps$currentStep$is = (_steps$currentStep = steps[currentStep]) === null || _steps$currentStep === void 0 ? void 0 : _steps$currentStep.isSuggestion) !== null && _steps$currentStep$is !== void 0 ? _steps$currentStep$is : false;
|
|
36
36
|
const hideFooter = (_steps$currentStep$hi = (_steps$currentStep2 = steps[currentStep]) === null || _steps$currentStep2 === void 0 ? void 0 : _steps$currentStep2.hideFooter) !== null && _steps$currentStep$hi !== void 0 ? _steps$currentStep$hi : false;
|
|
37
37
|
const totalSteps = steps.length;
|
|
@@ -73,7 +73,7 @@ const UTOnboarding = _ref => {
|
|
|
73
73
|
}) : step.intro
|
|
74
74
|
})),
|
|
75
75
|
initialStep: 0,
|
|
76
|
-
onExit: handleOnClose
|
|
76
|
+
onExit: handleOnClose,
|
|
77
77
|
onBeforeChange: nextStep => {
|
|
78
78
|
var _steps$nextStep;
|
|
79
79
|
const overlay = document.querySelector('.introjs-overlay');
|
|
@@ -92,7 +92,7 @@ const UTOnboarding = _ref => {
|
|
|
92
92
|
doneLabel: _constants.DONE_LABEL,
|
|
93
93
|
exitOnEsc: false,
|
|
94
94
|
exitOnOverlayClick: false,
|
|
95
|
-
helperElementPadding:
|
|
95
|
+
helperElementPadding: 0,
|
|
96
96
|
hidePrev: true,
|
|
97
97
|
nextLabel: currentStep === 0 ? _constants.START_LABEL : _constants.NEXT_LABEL,
|
|
98
98
|
prevLabel: _constants.PREV_LABEL,
|
|
@@ -113,6 +113,7 @@ const UTOnboarding = _ref => {
|
|
|
113
113
|
UTOnboarding.propTypes = {
|
|
114
114
|
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
115
115
|
classNames: (0, _propTypes.objectOf)(_propTypes.string),
|
|
116
|
+
enabled: _propTypes.bool,
|
|
116
117
|
handleComplete: _propTypes.func,
|
|
117
118
|
handleOnClose: _propTypes.func,
|
|
118
119
|
options: _propTypes.object,
|
|
@@ -28,9 +28,6 @@ $introjs-tooltipbuttons: 'introjs-tooltipbuttons';
|
|
|
28
28
|
font-weight: 400;
|
|
29
29
|
position: relative;
|
|
30
30
|
top: -10px;
|
|
31
|
-
&:hover {
|
|
32
|
-
background-color: var(--actionAccent03) !important;
|
|
33
|
-
}
|
|
34
31
|
}
|
|
35
32
|
}
|
|
36
33
|
|
|
@@ -43,7 +40,7 @@ $introjs-tooltipbuttons: 'introjs-tooltipbuttons';
|
|
|
43
40
|
}
|
|
44
41
|
|
|
45
42
|
.button {
|
|
46
|
-
background-color: var(--
|
|
43
|
+
background-color: var(--dark05) !important;
|
|
47
44
|
border-radius: 4px;
|
|
48
45
|
box-shadow: none;
|
|
49
46
|
color: var(--actionNegative04) !important;
|
|
@@ -155,8 +152,9 @@ $introjs-tooltipbuttons: 'introjs-tooltipbuttons';
|
|
|
155
152
|
|
|
156
153
|
.highlight {
|
|
157
154
|
border-radius: 0;
|
|
158
|
-
|
|
155
|
+
box-sizing: border-box;
|
|
159
156
|
box-shadow:
|
|
160
|
-
|
|
157
|
+
inset 0px 0px 0px 4px #17f455,
|
|
161
158
|
rgba(33, 33, 33, 0.5) 0px 0px 0px 5000px !important;
|
|
159
|
+
z-index: 1290;
|
|
162
160
|
}
|
|
@@ -40,8 +40,8 @@ const getButtonNextTextTheme = _ref4 => {
|
|
|
40
40
|
variant
|
|
41
41
|
} = _ref4;
|
|
42
42
|
return {
|
|
43
|
-
[_constants.VARIANTS.dark]: theme.Palette.
|
|
44
|
-
[_constants.VARIANTS.information]: theme.Palette.
|
|
43
|
+
[_constants.VARIANTS.dark]: theme.Palette.dark['05'],
|
|
44
|
+
[_constants.VARIANTS.information]: theme.Palette.dark['05'],
|
|
45
45
|
[_constants.VARIANTS.light]: theme.Palette.actions.negative['05']
|
|
46
46
|
}[variant];
|
|
47
47
|
};
|
|
@@ -61,12 +61,12 @@ const retrieveStyle = _ref6 => {
|
|
|
61
61
|
} = _ref6;
|
|
62
62
|
return {
|
|
63
63
|
onboardingContainer: {
|
|
64
|
-
backgroundColor: getBackgroundColor({
|
|
64
|
+
backgroundColor: " ".concat(getBackgroundColor({
|
|
65
65
|
theme,
|
|
66
66
|
...validateProps({
|
|
67
67
|
variant
|
|
68
68
|
})
|
|
69
|
-
}),
|
|
69
|
+
}), " !important"),
|
|
70
70
|
color: getLabelTheme({
|
|
71
71
|
theme,
|
|
72
72
|
...validateProps({
|
|
@@ -94,6 +94,14 @@ const retrieveStyle = _ref6 => {
|
|
|
94
94
|
variant
|
|
95
95
|
})
|
|
96
96
|
}), " !important")
|
|
97
|
+
},
|
|
98
|
+
'& .introjs-tooltip': {
|
|
99
|
+
backgroundColor: " ".concat(getBackgroundColor({
|
|
100
|
+
theme,
|
|
101
|
+
...validateProps({
|
|
102
|
+
variant
|
|
103
|
+
})
|
|
104
|
+
}), " !important")
|
|
97
105
|
}
|
|
98
106
|
}
|
|
99
107
|
};
|