@typeolymp/ui-components 1.9.8 → 1.9.9
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/build/index.es.js +10 -4
- package/build/index.es.js.map +1 -1
- package/build/index.js +10 -4
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -2143,15 +2143,21 @@ var Indicator = styled__default["default"].div(templateObject_3 || (templateObje
|
|
|
2143
2143
|
var value = _a.value;
|
|
2144
2144
|
return "".concat(value, "%");
|
|
2145
2145
|
});
|
|
2146
|
-
var Target = styled__default["default"].div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width:
|
|
2147
|
-
var value = _a.value;
|
|
2148
|
-
return "calc(".concat(value, "% -
|
|
2146
|
+
var Target = styled__default["default"].div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: max-content;\n position: absolute;\n left: ", ";\n bottom: 40px;\n\n p {\n color: ", ";\n }\n"], ["\n width: max-content;\n position: absolute;\n left: ", ";\n bottom: 40px;\n\n p {\n color: ", ";\n }\n"])), function (_a) {
|
|
2147
|
+
var value = _a.value, width = _a.width;
|
|
2148
|
+
return "calc(".concat(value, "% - ").concat(width / 2, "px)");
|
|
2149
2149
|
}, theme.colors.blue.darker);
|
|
2150
2150
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
2151
2151
|
|
|
2152
2152
|
var Result = function (props) {
|
|
2153
|
+
var ref = React.useRef(null);
|
|
2154
|
+
var _a = React.useState(0), targetWidth = _a[0], setTargetWidth = _a[1];
|
|
2153
2155
|
var isPassed = props.value >= props.target;
|
|
2154
|
-
|
|
2156
|
+
React.useEffect(function () {
|
|
2157
|
+
var _a;
|
|
2158
|
+
setTargetWidth((_a = ref.current) === null || _a === void 0 ? void 0 : _a.offsetWidth);
|
|
2159
|
+
}, [ref]);
|
|
2160
|
+
return (jsxRuntime.jsxs(Container, __assign({ passed: isPassed }, { children: [jsxRuntime.jsx(Icon, { type: isPassed ? "check" : "warning", color: isPassed ? "green" : "red", size: "large" }), jsxRuntime.jsx(Spacer, { horizontal: 15 }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(Heading, __assign({ type: "h5" }, { children: props.title })), jsxRuntime.jsx(Paragraph, { children: props.subtitle })] }), props.progressBar && (jsxRuntime.jsxs(ProgressBarWrapper, { children: [jsxRuntime.jsx(Indicator, { value: (props.target / props.progressBar.max) * 100 }), jsxRuntime.jsx(Target, __assign({ value: (props.target / props.progressBar.max) * 100, width: targetWidth, ref: ref }, { children: jsxRuntime.jsxs(Paragraph, __assign({ size: "small" }, { children: [props.target, props.progressBar.unit] })) })), jsxRuntime.jsx(ProgressBar, { percent: (props.value / props.progressBar.max) * 100, color: isPassed ? "green" : "red" }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs(Paragraph, __assign({ size: "small" }, { children: [props.progressBar.min, props.progressBar.unit] })), jsxRuntime.jsxs(Paragraph, __assign({ size: "small" }, { children: [props.progressBar.max, props.progressBar.unit] }))] })] }))] })));
|
|
2155
2161
|
};
|
|
2156
2162
|
|
|
2157
2163
|
exports.Alert = Alert;
|