@smart-react-components/ui 2.0.0-alpha-46 → 2.0.0-alpha-47

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/Dropdown/index.js CHANGED
@@ -21,9 +21,15 @@ const react_1 = __importDefault(require("react"));
21
21
  const FixedBox_1 = __importDefault(require("../FixedBox"));
22
22
  __exportStar(require("../FixedBox"), exports);
23
23
  const Dropdown = ({ afterHide, afterShow, beforeHide, beforeShow, breakpoint, children, elementProps = {}, hasHideAnimation, hasShowAnimation, isDismissible, maxWidth, minWidth, position, setStatus, space, status, transitionClassName, transitionDuration, triggerInteraction }) => {
24
+ var _a, _b, _c, _d;
25
+ const triggerEl = react_1.default.useRef(null);
24
26
  const [localStatus, setLocalStatus] = react_1.default.useState(() => false);
27
+ const getTriggerEl = () => { var _a; return ((_a = children[0].ref) !== null && _a !== void 0 ? _a : triggerEl).current; };
28
+ react_1.default.useEffect(() => {
29
+ getTriggerEl().dispatchEvent(new Event('src.fixedBox.setPosition'));
30
+ }, [(_c = (_b = (_a = children === null || children === void 0 ? void 0 : children[1]) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.children) === null || _c === void 0 ? void 0 : _c.length]);
25
31
  return (react_1.default.createElement(FixedBox_1.default, { afterHide: afterHide, afterShow: afterShow, beforeHide: beforeHide, beforeShow: beforeShow, breakpoint: breakpoint, elementProps: Object.assign({ overflow: ['initial', true] }, elementProps), hasHideAnimation: hasHideAnimation, hasShowAnimation: hasShowAnimation, isDismissible: isDismissible, maxWidth: maxWidth, minWidth: minWidth, position: position, setStatus: setStatus !== null && setStatus !== void 0 ? setStatus : setLocalStatus, space: space, status: status !== null && status !== void 0 ? status : localStatus, transitionClassName: transitionClassName, transitionDuration: transitionDuration, triggerInteraction: triggerInteraction },
26
- children[0],
32
+ react_1.default.cloneElement(children[0], { ref: (_d = children[0].ref) !== null && _d !== void 0 ? _d : triggerEl }),
27
33
  react_1.default.cloneElement(children[1], { setStatus: setStatus !== null && setStatus !== void 0 ? setStatus : setLocalStatus })));
28
34
  };
29
35
  exports.default = Dropdown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smart-react-components/ui",
3
- "version": "2.0.0-alpha-46",
3
+ "version": "2.0.0-alpha-47",
4
4
  "license": "MIT",
5
5
  "main": "index.js",
6
6
  "description": "SRC UI includes React and Styled components.",