@typeolymp/ui-components 1.9.7 → 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
@@ -1262,7 +1262,7 @@ var Key$1 = function (props) { return (jsxs(Container$c, __assign({}, props, { c
1262
1262
  transform: "scale(2)",
1263
1263
  } }, { children: jsx("path", { d: "M0 4.5V1C0 0.447715 0.447715 0 1 0H2C2.55228 0 3 0.447715 3 1V4H25V1C25 0.447715 25.4477 0 26 0H27C27.5523 0 28 0.447715 28 1V4.5C28 5.88071 26.8807 7 25.5 7H2.5C1.11929 7 0 5.88071 0 4.5Z" }) }))) : (jsx(Heading, __assign({ type: "h1" }, { children: props.char })))] }))); };
1264
1264
 
1265
- var Wrapper$2 = styled.a(templateObject_1$m || (templateObject_1$m = __makeTemplateObject(["\n width: fit-content;\n display: flex;\n align-items: center;\n cursor: pointer;\n text-decoration: none;\n\n > div {\n width: 19px;\n height: 19px;\n margin-right: ", ";\n margin-left: ", ";\n }\n"], ["\n width: fit-content;\n display: flex;\n align-items: center;\n cursor: pointer;\n text-decoration: none;\n\n > div {\n width: 19px;\n height: 19px;\n margin-right: ", ";\n margin-left: ", ";\n }\n"])), function (_a) {
1265
+ var Wrapper$2 = styled.a(templateObject_1$m || (templateObject_1$m = __makeTemplateObject(["\n width: fit-content;\n display: flex;\n align-items: center;\n cursor: pointer;\n text-decoration: none;\n\n > div {\n width: 19px;\n height: 19px;\n margin-top: 3px;\n margin-right: ", ";\n margin-left: ", ";\n }\n"], ["\n width: fit-content;\n display: flex;\n align-items: center;\n cursor: pointer;\n text-decoration: none;\n\n > div {\n width: 19px;\n height: 19px;\n margin-top: 3px;\n margin-right: ", ";\n margin-left: ", ";\n }\n"])), function (_a) {
1266
1266
  var chevron = _a.chevron;
1267
1267
  return (chevron === "left" ? "4px" : "");
1268
1268
  }, function (_a) {
@@ -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 };