@typeolymp/ui-components 1.19.39 → 1.19.40

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
@@ -14930,22 +14930,31 @@ var Dropdown = function (_a) {
14930
14930
  ? setIsVisible(false)
14931
14931
  : null;
14932
14932
  }, [isVisible, dropwdownRef]);
14933
+ var handleScroll = useCallback(function () { return setIsVisible(false); }, []);
14933
14934
  useEffect(function () {
14934
14935
  document.addEventListener("mousedown", handleClickOutside);
14936
+ document.addEventListener("scroll", handleScroll);
14935
14937
  return function () {
14936
14938
  document.removeEventListener("mousedown", handleClickOutside);
14939
+ document.removeEventListener("scroll", handleScroll);
14937
14940
  };
14938
- }, [handleClickOutside]);
14941
+ }, [handleClickOutside, handleScroll]);
14939
14942
  var triggerDropdown = useCallback(function () {
14940
14943
  if (props.disabled)
14941
14944
  return;
14942
14945
  var el = document.getElementById(triggerId);
14943
14946
  if (el) {
14944
- var _a = el.getBoundingClientRect(), bottom = _a.bottom, left = _a.left;
14947
+ var _a = el.getBoundingClientRect(), bottom = _a.bottom, top_1 = _a.top, left = _a.left;
14945
14948
  var width = el.offsetWidth;
14946
- var position_1 = left + width > window.innerWidth / 2 ? "right" : "left";
14947
- var y = bottom + yOffset;
14948
- var x = position_1 === "left"
14949
+ var xPosition = left + width > window.innerWidth / 2 ? "right" : "left";
14950
+ var yPosition = window.innerHeight - (bottom + yOffset) <
14951
+ dropwdownRef.current.offsetHeight
14952
+ ? "top"
14953
+ : "bottom";
14954
+ var y = yPosition === "bottom"
14955
+ ? bottom + yOffset
14956
+ : top_1 - dropwdownRef.current.offsetHeight - yOffset - 4;
14957
+ var x = xPosition === "left"
14949
14958
  ? left
14950
14959
  : left + width - dropwdownRef.current.offsetWidth;
14951
14960
  setPosition({ x: x, y: y });
@@ -17593,7 +17602,10 @@ var InputField = function (props) {
17593
17602
  return (jsxs(Container$h, { children: [jsx$1(Label$9, __assign$2({ as: "label", htmlFor: props.name }, { children: props.label })), jsx$1(Spacer, { vertical: 5 }), jsx$1(Input, { defaultValue: props.defaultValue, autoComplete: props.autoComplete, autoFocus: props.autoFocus, disabled: props.disabled, placeholder: props.placeholder, id: props.name, onChange: onChange, onBlur: onBlur }), props.tips && (jsxs("div", __assign$2({ style: { marginLeft: "5px" } }, { children: [jsx$1(Spacer, { vertical: 5 }), props.tips.map(function (tip, index) { return (jsxs(Paragraph, __assign$2({ size: "small", weight: "regular" }, { children: ["\u2022 ", tip] }), "".concat(tip, "-").concat(index))); })] })))] }));
17594
17603
  };
17595
17604
 
17596
- var Container$g = styled.div(templateObject_1$s || (templateObject_1$s = __makeTemplateObject$1(["\n min-width: 74px;\n width: fit-content;\n height: 74px;\n background-color: ", ";\n box-sizing: border-box;\n\n border: 4px solid;\n border-radius: 6px;\n border-color: ", ";\n\n padding: 8px 24px;\n margin-right: 6px;\n margin-left: 6px;\n margin-bottom: ", ";\n\n display: flex;\n justify-content: center;\n align-items: center;\n\n position: relative;\n text-transform: uppercase;\n\n h1 {\n color: ", ";\n }\n\n > svg {\n fill: ", ";\n }\n"], ["\n min-width: 74px;\n width: fit-content;\n height: 74px;\n background-color: ", ";\n box-sizing: border-box;\n\n border: 4px solid;\n border-radius: 6px;\n border-color: ", ";\n\n padding: 8px 24px;\n margin-right: 6px;\n margin-left: 6px;\n margin-bottom: ", ";\n\n display: flex;\n justify-content: center;\n align-items: center;\n\n position: relative;\n text-transform: uppercase;\n\n h1 {\n color: ", ";\n }\n\n > svg {\n fill: ", ";\n }\n"])), function (_a) {
17605
+ var Container$g = styled.div(templateObject_1$s || (templateObject_1$s = __makeTemplateObject$1(["\n min-width: 74px;\n max-width: ", ";\n min-height: 74px;\n max-height: 74px;\n background-color: ", ";\n box-sizing: border-box;\n\n border: 4px solid;\n border-radius: 6px;\n border-color: ", ";\n\n padding: 8px 24px;\n margin-right: 6px;\n margin-left: 6px;\n margin-bottom: ", ";\n\n display: flex;\n justify-content: center;\n align-items: center;\n\n position: relative;\n text-transform: uppercase;\n\n h1 {\n color: ", ";\n }\n\n > svg {\n fill: ", ";\n }\n"], ["\n min-width: 74px;\n max-width: ", ";\n min-height: 74px;\n max-height: 74px;\n background-color: ", ";\n box-sizing: border-box;\n\n border: 4px solid;\n border-radius: 6px;\n border-color: ", ";\n\n padding: 8px 24px;\n margin-right: 6px;\n margin-left: 6px;\n margin-bottom: ", ";\n\n display: flex;\n justify-content: center;\n align-items: center;\n\n position: relative;\n text-transform: uppercase;\n\n h1 {\n color: ", ";\n }\n\n > svg {\n fill: ", ";\n }\n"])), function (_a) {
17606
+ var char = _a.char;
17607
+ return (char.length === 1 ? "74px" : "");
17608
+ }, function (_a) {
17597
17609
  var status = _a.status, color = _a.color;
17598
17610
  switch (status) {
17599
17611
  case "passed":