@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 CHANGED
@@ -2132,15 +2132,21 @@ var Indicator = styled.div(templateObject_3 || (templateObject_3 = __makeTemplat
2132
2132
  var value = _a.value;
2133
2133
  return "".concat(value, "%");
2134
2134
  });
2135
- var Target = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: fit-content;\n position: absolute;\n left: ", ";\n bottom: 40px;\n\n p {\n color: ", ";\n }\n"], ["\n width: fit-content;\n position: absolute;\n left: ", ";\n bottom: 40px;\n\n p {\n color: ", ";\n }\n"])), function (_a) {
2136
- var value = _a.value;
2137
- return "calc(".concat(value, "% - 6px)");
2135
+ var Target = styled.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) {
2136
+ var value = _a.value, width = _a.width;
2137
+ return "calc(".concat(value, "% - ").concat(width / 2, "px)");
2138
2138
  }, theme.colors.blue.darker);
2139
2139
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
2140
2140
 
2141
2141
  var Result = function (props) {
2142
+ var ref = useRef(null);
2143
+ var _a = useState(0), targetWidth = _a[0], setTargetWidth = _a[1];
2142
2144
  var isPassed = props.value >= props.target;
2143
- return (jsxs(Container, __assign({ passed: isPassed }, { children: [jsx(Icon, { type: isPassed ? "check" : "warning", color: isPassed ? "green" : "red", size: "large" }), jsx(Spacer, { horizontal: 15 }), jsxs("div", { children: [jsx(Heading, __assign({ type: "h5" }, { children: props.title })), jsx(Paragraph, { children: props.subtitle })] }), props.progressBar && (jsxs(ProgressBarWrapper, { children: [jsx(Indicator, { value: (props.target / props.progressBar.max) * 100 }), jsx(Target, __assign({ value: (props.target / props.progressBar.max) * 100 }, { children: jsxs(Paragraph, __assign({ size: "small" }, { children: [props.target, props.progressBar.unit] })) })), jsx(ProgressBar, { percent: (props.value / props.progressBar.max) * 100, color: isPassed ? "green" : "red" }), jsxs("div", { children: [jsxs(Paragraph, __assign({ size: "small" }, { children: [props.progressBar.min, props.progressBar.unit] })), jsxs(Paragraph, __assign({ size: "small" }, { children: [props.progressBar.max, props.progressBar.unit] }))] })] }))] })));
2145
+ useEffect(function () {
2146
+ var _a;
2147
+ setTargetWidth((_a = ref.current) === null || _a === void 0 ? void 0 : _a.offsetWidth);
2148
+ }, [ref]);
2149
+ return (jsxs(Container, __assign({ passed: isPassed }, { children: [jsx(Icon, { type: isPassed ? "check" : "warning", color: isPassed ? "green" : "red", size: "large" }), jsx(Spacer, { horizontal: 15 }), jsxs("div", { children: [jsx(Heading, __assign({ type: "h5" }, { children: props.title })), jsx(Paragraph, { children: props.subtitle })] }), props.progressBar && (jsxs(ProgressBarWrapper, { children: [jsx(Indicator, { value: (props.target / props.progressBar.max) * 100 }), jsx(Target, __assign({ value: (props.target / props.progressBar.max) * 100, width: targetWidth, ref: ref }, { children: jsxs(Paragraph, __assign({ size: "small" }, { children: [props.target, props.progressBar.unit] })) })), jsx(ProgressBar, { percent: (props.value / props.progressBar.max) * 100, color: isPassed ? "green" : "red" }), jsxs("div", { children: [jsxs(Paragraph, __assign({ size: "small" }, { children: [props.progressBar.min, props.progressBar.unit] })), jsxs(Paragraph, __assign({ size: "small" }, { children: [props.progressBar.max, props.progressBar.unit] }))] })] }))] })));
2144
2150
  };
2145
2151
 
2146
2152
  export { Alert, Button, Card, Checkbox, Checkboxes, Collapse, DateInputField, Flag, Form, Heading, Icon, IconButton, Illustration, Input, InputField, Key$1 as Key, Keyboard, Link, Loading, LocaleSelect, Logo, Medal, Medals, Modal, Notification, Number, NumberField, Paragraph, PasswordInputField, Popup, ProgressBar, Radio, RadioGroup, Result, Select, SelectField, Spacer, Steps, Subheading, Tag, Toggle, ToggleField, Tooltip, Trophy, theme };