@woosmap/ui 3.20.0 → 3.21.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@woosmap/ui",
3
- "version": "3.20.0",
3
+ "version": "3.21.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/WebGeoServices/ui.git"
@@ -10,13 +10,17 @@ function mapChildrenWithProps(children, childrenRefs, closeCb) {
10
10
  if (children) {
11
11
  return React.Children.map(children, (child, index) => {
12
12
  if (React.isValidElement(child)) {
13
+ // only add ref to non functional components
13
14
  return React.cloneElement(child, {
14
15
  ...child.props,
15
16
  closeCb,
16
- ref: (elem) => {
17
- // eslint-disable-next-line no-param-reassign
18
- childrenRefs[index] = elem;
19
- },
17
+ ref:
18
+ !child.type.prototype || (child.type.prototype && child.type.prototype.render)
19
+ ? (elem) => {
20
+ // eslint-disable-next-line no-param-reassign
21
+ childrenRefs[index] = elem;
22
+ }
23
+ : undefined,
20
24
  });
21
25
  }
22
26
  return child;
@@ -351,7 +355,7 @@ class Dropdown extends Component {
351
355
 
352
356
  return (
353
357
  <div
354
- ref={this.clickOutsideRef}
358
+ ref={openOnMouseEnter ? null : this.clickOutsideRef}
355
359
  className={cl('dropdown', { open }, `dropdown--${size}`, className)}
356
360
  {...rest}
357
361
  onMouseEnter={this.onMouseEnter}