@db-ux/react-core-components 2.2.1 → 2.2.2-intersectionobserver-0b9938c

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.
@@ -429,14 +429,16 @@ function DBCustomSelectFn(props, component) {
429
429
  set_selectedLabelsId(mId + "-selected-labels");
430
430
  set_infoTextId(mId + "-info");
431
431
  set_invalidMessage(props.invalidMessage || DEFAULT_INVALID_MESSAGE);
432
- set_observer(new IntersectionObserver((payload) => {
433
- if (detailsRef.current) {
434
- const entry = payload.find(({ target }) => target === detailsRef.current);
435
- if (entry && !entry.isIntersecting && detailsRef.current.open) {
436
- detailsRef.current.open = false;
432
+ if (typeof window !== "undefined" && "IntersectionObserver" in window) {
433
+ set_observer(new IntersectionObserver((payload) => {
434
+ if (detailsRef.current) {
435
+ const entry = payload.find(({ target }) => target === detailsRef.current);
436
+ if (entry && !entry.isIntersecting && detailsRef.current.open) {
437
+ detailsRef.current.open = false;
438
+ }
437
439
  }
438
- }
439
- }));
440
+ }));
441
+ }
440
442
  }, []);
441
443
  useEffect(() => {
442
444
  if (detailsRef.current) {
@@ -101,12 +101,14 @@ function DBPopoverFn(props, component) {
101
101
  ["mouseleave", "focusout"].forEach((event) => {
102
102
  _ref.current.addEventListener(event, () => handleLeave());
103
103
  });
104
- set_observer(new IntersectionObserver((payload) => {
105
- const entry = payload.find(({ target }) => target === getTrigger());
106
- if (entry && !entry.isIntersecting) {
107
- handleEscape(false);
108
- }
109
- }));
104
+ if (typeof window !== "undefined" && "IntersectionObserver" in window) {
105
+ set_observer(new IntersectionObserver((payload) => {
106
+ const entry = payload.find(({ target }) => target === getTrigger());
107
+ if (entry && !entry.isIntersecting) {
108
+ handleEscape(false);
109
+ }
110
+ }));
111
+ }
110
112
  }
111
113
  }, [_ref.current, initialized]);
112
114
  useEffect(() => {
@@ -82,12 +82,14 @@ function DBTooltipFn(props, component) {
82
82
  parent.setAttribute("aria-describedby", _id);
83
83
  }
84
84
  }
85
- set_observer(new IntersectionObserver((payload) => {
86
- const entry = payload.find(({ target }) => target === getParent());
87
- if (entry && !entry.isIntersecting) {
88
- handleEscape(false);
89
- }
90
- }));
85
+ if (typeof window !== "undefined" && "IntersectionObserver" in window) {
86
+ set_observer(new IntersectionObserver((payload) => {
87
+ const entry = payload.find(({ target }) => target === getParent());
88
+ if (entry && !entry.isIntersecting) {
89
+ handleEscape(false);
90
+ }
91
+ }));
92
+ }
91
93
  setInitialized(false);
92
94
  }
93
95
  }, [_ref.current, initialized]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@db-ux/react-core-components",
3
- "version": "2.2.1",
3
+ "version": "2.2.2-intersectionobserver-0b9938c",
4
4
  "description": "React components for @db-ux/core-components",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "sideEffects": false,
40
40
  "dependencies": {
41
- "@db-ux/core-components": "2.2.1",
42
- "@db-ux/core-foundations": "2.2.1"
41
+ "@db-ux/core-components": "2.2.2-intersectionobserver-0b9938c",
42
+ "@db-ux/core-foundations": "2.2.2-intersectionobserver-0b9938c"
43
43
  }
44
44
  }