@storybook/addon-interactions 6.5.0-alpha.1 → 6.5.0-alpha.10

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/dist/cjs/Panel.js CHANGED
@@ -197,17 +197,24 @@ var Panel = function Panel(props) {
197
197
  });
198
198
  var endRef = React.useRef();
199
199
  React.useEffect(function () {
200
- var observer = new _global.default.window.IntersectionObserver(function (_ref5) {
201
- var _ref6 = _slicedToArray(_ref5, 1),
202
- end = _ref6[0];
200
+ var observer;
201
+
202
+ if (_global.default.window.IntersectionObserver) {
203
+ observer = new _global.default.window.IntersectionObserver(function (_ref5) {
204
+ var _ref6 = _slicedToArray(_ref5, 1),
205
+ end = _ref6[0];
206
+
207
+ return setScrollTarget(end.isIntersecting ? undefined : end.target);
208
+ }, {
209
+ root: _global.default.window.document.querySelector('#panel-tab-content')
210
+ });
211
+ if (endRef.current) observer.observe(endRef.current);
212
+ }
203
213
 
204
- return setScrollTarget(end.isIntersecting ? undefined : end.target);
205
- }, {
206
- root: _global.default.window.document.querySelector('#panel-tab-content')
207
- });
208
- if (endRef.current) observer.observe(endRef.current);
209
214
  return function () {
210
- return observer.disconnect();
215
+ var _observer;
216
+
217
+ return (_observer = observer) === null || _observer === void 0 ? void 0 : _observer.disconnect();
211
218
  };
212
219
  }, []);
213
220
  var emit = (0, _api.useChannel)((_useChannel = {}, _defineProperty(_useChannel, _instrumenter.EVENTS.CALL, setCall), _defineProperty(_useChannel, _instrumenter.EVENTS.SYNC, function (payload) {
package/dist/esm/Panel.js CHANGED
@@ -147,17 +147,24 @@ export var Panel = function Panel(props) {
147
147
  });
148
148
  var endRef = React.useRef();
149
149
  React.useEffect(function () {
150
- var observer = new global.window.IntersectionObserver(function (_ref5) {
151
- var _ref6 = _slicedToArray(_ref5, 1),
152
- end = _ref6[0];
150
+ var observer;
151
+
152
+ if (global.window.IntersectionObserver) {
153
+ observer = new global.window.IntersectionObserver(function (_ref5) {
154
+ var _ref6 = _slicedToArray(_ref5, 1),
155
+ end = _ref6[0];
156
+
157
+ return setScrollTarget(end.isIntersecting ? undefined : end.target);
158
+ }, {
159
+ root: global.window.document.querySelector('#panel-tab-content')
160
+ });
161
+ if (endRef.current) observer.observe(endRef.current);
162
+ }
153
163
 
154
- return setScrollTarget(end.isIntersecting ? undefined : end.target);
155
- }, {
156
- root: global.window.document.querySelector('#panel-tab-content')
157
- });
158
- if (endRef.current) observer.observe(endRef.current);
159
164
  return function () {
160
- return observer.disconnect();
165
+ var _observer;
166
+
167
+ return (_observer = observer) === null || _observer === void 0 ? void 0 : _observer.disconnect();
161
168
  };
162
169
  }, []);
163
170
  var emit = useChannel((_useChannel = {}, _defineProperty(_useChannel, EVENTS.CALL, setCall), _defineProperty(_useChannel, EVENTS.SYNC, function (payload) {
@@ -90,11 +90,20 @@ export const Panel = props => {
90
90
  }));
91
91
  const endRef = React.useRef();
92
92
  React.useEffect(() => {
93
- const observer = new global.window.IntersectionObserver(([end]) => setScrollTarget(end.isIntersecting ? undefined : end.target), {
94
- root: global.window.document.querySelector('#panel-tab-content')
95
- });
96
- if (endRef.current) observer.observe(endRef.current);
97
- return () => observer.disconnect();
93
+ let observer;
94
+
95
+ if (global.window.IntersectionObserver) {
96
+ observer = new global.window.IntersectionObserver(([end]) => setScrollTarget(end.isIntersecting ? undefined : end.target), {
97
+ root: global.window.document.querySelector('#panel-tab-content')
98
+ });
99
+ if (endRef.current) observer.observe(endRef.current);
100
+ }
101
+
102
+ return () => {
103
+ var _observer;
104
+
105
+ return (_observer = observer) === null || _observer === void 0 ? void 0 : _observer.disconnect();
106
+ };
98
107
  }, []);
99
108
  const emit = useChannel({
100
109
  [EVENTS.CALL]: setCall,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-interactions",
3
- "version": "6.5.0-alpha.1",
3
+ "version": "6.5.0-alpha.10",
4
4
  "description": "Automate, test and debug user interactions",
5
5
  "keywords": [
6
6
  "storybook-addons",
@@ -41,14 +41,14 @@
41
41
  "prepare": "node ../../scripts/prepare.js"
42
42
  },
43
43
  "dependencies": {
44
- "@storybook/addons": "6.5.0-alpha.1",
45
- "@storybook/api": "6.5.0-alpha.1",
46
- "@storybook/components": "6.5.0-alpha.1",
47
- "@storybook/core-common": "6.5.0-alpha.1",
48
- "@storybook/core-events": "6.5.0-alpha.1",
44
+ "@storybook/addons": "6.5.0-alpha.10",
45
+ "@storybook/api": "6.5.0-alpha.10",
46
+ "@storybook/components": "6.5.0-alpha.10",
47
+ "@storybook/core-common": "6.5.0-alpha.10",
48
+ "@storybook/core-events": "6.5.0-alpha.10",
49
49
  "@storybook/csf": "0.0.2--canary.87bc651.0",
50
- "@storybook/instrumenter": "6.5.0-alpha.1",
51
- "@storybook/theming": "6.5.0-alpha.1",
50
+ "@storybook/instrumenter": "6.5.0-alpha.10",
51
+ "@storybook/theming": "6.5.0-alpha.10",
52
52
  "global": "^4.4.0",
53
53
  "jest-mock": "^27.0.6",
54
54
  "polished": "^4.0.5",
@@ -74,7 +74,7 @@
74
74
  "publishConfig": {
75
75
  "access": "public"
76
76
  },
77
- "gitHead": "fbf6e247a099ec45c30f8594f255a088847b7957",
77
+ "gitHead": "9f7d260e82218d8bbf4fedda39e34d2e9d9813a3",
78
78
  "sbmodern": "dist/modern/index.js",
79
79
  "storybook": {
80
80
  "displayName": "Interactions",