@storybook/addon-interactions 7.0.0-alpha.0 → 7.0.0-alpha.3

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.
Files changed (38) hide show
  1. package/dist/cjs/Panel.js +118 -201
  2. package/dist/cjs/Panel.stories.js +32 -45
  3. package/dist/cjs/components/AccountForm/AccountForm.js +198 -298
  4. package/dist/cjs/components/AccountForm/addon-interactions.stories.js +163 -649
  5. package/dist/cjs/components/Interaction/Interaction.js +162 -130
  6. package/dist/cjs/components/Interaction/Interaction.stories.js +27 -86
  7. package/dist/cjs/components/List.js +21 -72
  8. package/dist/cjs/components/MatcherResult.js +54 -112
  9. package/dist/cjs/components/MatcherResult.stories.js +49 -29
  10. package/dist/cjs/components/MethodCall.js +187 -261
  11. package/dist/cjs/components/MethodCall.stories.js +232 -257
  12. package/dist/cjs/components/StatusBadge/StatusBadge.js +20 -16
  13. package/dist/cjs/components/StatusBadge/StatusBadge.stories.js +4 -4
  14. package/dist/cjs/components/StatusIcon/StatusIcon.js +29 -17
  15. package/dist/cjs/components/StatusIcon/StatusIcon.stories.js +3 -3
  16. package/dist/cjs/components/Subnav/Subnav.js +77 -85
  17. package/dist/cjs/components/Subnav/Subnav.stories.js +8 -7
  18. package/dist/cjs/constants.js +2 -2
  19. package/dist/cjs/manager.js +4 -5
  20. package/dist/cjs/mocks/index.js +140 -23
  21. package/dist/cjs/preset/checkActionsLoaded.js +2 -6
  22. package/dist/cjs/preset/preview.js +22 -61
  23. package/dist/cjs/theme.js +3 -3
  24. package/dist/esm/Panel.js +28 -7
  25. package/dist/esm/Panel.stories.js +10 -8
  26. package/dist/esm/components/AccountForm/addon-interactions.stories.js +1 -1
  27. package/dist/esm/components/Interaction/Interaction.js +102 -13
  28. package/dist/esm/components/Interaction/Interaction.stories.js +13 -6
  29. package/dist/esm/components/MatcherResult.js +1 -1
  30. package/dist/esm/components/MethodCall.js +55 -58
  31. package/dist/esm/components/MethodCall.stories.js +106 -20
  32. package/dist/esm/components/Subnav/Subnav.stories.js +2 -1
  33. package/dist/esm/mocks/index.js +136 -20
  34. package/dist/types/Panel.d.ts +4 -0
  35. package/dist/types/components/Interaction/Interaction.d.ts +6 -1
  36. package/dist/types/components/MethodCall.d.ts +14 -14
  37. package/dist/types/mocks/index.d.ts +2 -1
  38. package/package.json +11 -11
package/dist/cjs/Panel.js CHANGED
@@ -1,50 +1,10 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
- require("core-js/modules/es.object.keys.js");
6
-
7
- require("core-js/modules/es.symbol.js");
8
-
9
- require("core-js/modules/es.symbol.description.js");
10
-
11
- require("core-js/modules/es.symbol.iterator.js");
12
-
13
- require("core-js/modules/es.function.name.js");
14
-
15
- require("core-js/modules/es.array.from.js");
16
-
17
- require("core-js/modules/es.weak-map.js");
18
-
19
- require("core-js/modules/es.object.get-own-property-descriptor.js");
20
-
21
3
  Object.defineProperty(exports, "__esModule", {
22
4
  value: true
23
5
  });
24
6
  exports.Panel = exports.AddonPanelPure = void 0;
25
7
 
26
- require("core-js/modules/es.array.map.js");
27
-
28
- require("core-js/modules/es.array.iterator.js");
29
-
30
- require("core-js/modules/es.map.js");
31
-
32
- require("core-js/modules/es.object.to-string.js");
33
-
34
- require("core-js/modules/es.string.iterator.js");
35
-
36
- require("core-js/modules/web.dom-collections.iterator.js");
37
-
38
- require("core-js/modules/es.object.assign.js");
39
-
40
- require("core-js/modules/es.array.slice.js");
41
-
42
- require("core-js/modules/es.regexp.exec.js");
43
-
44
- require("core-js/modules/es.string.split.js");
45
-
46
- require("core-js/modules/es.regexp.to-string.js");
47
-
48
8
  var _global = _interopRequireDefault(require("global"));
49
9
 
50
10
  var React = _interopRequireWildcard(require("react"));
@@ -67,36 +27,20 @@ var _Subnav = require("./components/Subnav/Subnav");
67
27
 
68
28
  var _Interaction = require("./components/Interaction/Interaction");
69
29
 
70
- var _excluded = ["calls", "controls", "controlStates", "interactions", "fileName", "hasException", "isPlaying", "onScrollToEnd", "endRef", "isRerunAnimating", "setIsRerunAnimating"],
71
- _excluded2 = ["status"];
30
+ const _excluded = ["calls", "controls", "controlStates", "interactions", "fileName", "hasException", "isPlaying", "pausedAt", "onScrollToEnd", "endRef", "isRerunAnimating", "setIsRerunAnimating"],
31
+ _excluded2 = ["status"];
72
32
 
73
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
33
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
74
34
 
75
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
76
36
 
77
37
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
78
38
 
79
39
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
80
40
 
81
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
82
-
83
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
84
-
85
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
86
-
87
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
88
-
89
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
90
-
91
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
92
-
93
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
94
-
95
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
96
-
97
41
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
98
42
 
99
- var INITIAL_CONTROL_STATES = {
43
+ const INITIAL_CONTROL_STATES = {
100
44
  debugger: false,
101
45
  start: false,
102
46
  back: false,
@@ -104,31 +48,34 @@ var INITIAL_CONTROL_STATES = {
104
48
  next: false,
105
49
  end: false
106
50
  };
107
- var TabIcon = (0, _theming.styled)(_StatusIcon.StatusIcon)({
51
+ const TabIcon = (0, _theming.styled)(_StatusIcon.StatusIcon)({
108
52
  marginLeft: 5
109
53
  });
110
54
 
111
- var TabStatus = function TabStatus(_ref) {
112
- var children = _ref.children;
113
-
114
- var container = _global.default.document.getElementById('tabbutton-interactions');
55
+ const TabStatus = ({
56
+ children
57
+ }) => {
58
+ const container = _global.default.document.getElementById('tabbutton-interactions');
115
59
 
116
60
  return container && /*#__PURE__*/_reactDom.default.createPortal(children, container);
117
61
  };
118
62
 
119
- var AddonPanelPure = /*#__PURE__*/React.memo(function (_ref2) {
120
- var calls = _ref2.calls,
121
- controls = _ref2.controls,
122
- controlStates = _ref2.controlStates,
123
- interactions = _ref2.interactions,
124
- fileName = _ref2.fileName,
125
- hasException = _ref2.hasException,
126
- isPlaying = _ref2.isPlaying,
127
- onScrollToEnd = _ref2.onScrollToEnd,
128
- endRef = _ref2.endRef,
129
- isRerunAnimating = _ref2.isRerunAnimating,
130
- setIsRerunAnimating = _ref2.setIsRerunAnimating,
131
- panelProps = _objectWithoutProperties(_ref2, _excluded);
63
+ const AddonPanelPure = /*#__PURE__*/React.memo(_ref => {
64
+ let {
65
+ calls,
66
+ controls,
67
+ controlStates,
68
+ interactions,
69
+ fileName,
70
+ hasException,
71
+ isPlaying,
72
+ pausedAt,
73
+ onScrollToEnd,
74
+ endRef,
75
+ isRerunAnimating,
76
+ setIsRerunAnimating
77
+ } = _ref,
78
+ panelProps = _objectWithoutPropertiesLoose(_ref, _excluded);
132
79
 
133
80
  return /*#__PURE__*/React.createElement(_components.AddonPanel, panelProps, controlStates.debugger && interactions.length > 0 && /*#__PURE__*/React.createElement(_Subnav.Subnav, {
134
81
  controls: controls,
@@ -139,15 +86,17 @@ var AddonPanelPure = /*#__PURE__*/React.memo(function (_ref2) {
139
86
  onScrollToEnd: onScrollToEnd,
140
87
  isRerunAnimating: isRerunAnimating,
141
88
  setIsRerunAnimating: setIsRerunAnimating
142
- }), interactions.map(function (call) {
143
- return /*#__PURE__*/React.createElement(_Interaction.Interaction, {
144
- key: call.id,
145
- call: call,
146
- callsById: calls,
147
- controls: controls,
148
- controlStates: controlStates
149
- });
150
- }), /*#__PURE__*/React.createElement("div", {
89
+ }), /*#__PURE__*/React.createElement("div", null, interactions.map(call => /*#__PURE__*/React.createElement(_Interaction.Interaction, {
90
+ key: call.id,
91
+ call: call,
92
+ callsById: calls,
93
+ controls: controls,
94
+ controlStates: controlStates,
95
+ childCallIds: call.childCallIds,
96
+ isCollapsed: call.isCollapsed,
97
+ toggleCollapsed: call.toggleCollapsed,
98
+ pausedAt: pausedAt
99
+ }))), /*#__PURE__*/React.createElement("div", {
151
100
  ref: endRef
152
101
  }), !isPlaying && interactions.length === 0 && /*#__PURE__*/React.createElement(_components.Placeholder, null, "No interactions found", /*#__PURE__*/React.createElement(_components.Link, {
153
102
  href: "https://github.com/storybookjs/storybook/blob/next/addons/interactions/README.md",
@@ -157,143 +106,110 @@ var AddonPanelPure = /*#__PURE__*/React.memo(function (_ref2) {
157
106
  });
158
107
  exports.AddonPanelPure = AddonPanelPure;
159
108
 
160
- var Panel = function Panel(props) {
161
- var _useChannel;
162
-
163
- var _React$useState = React.useState(),
164
- _React$useState2 = _slicedToArray(_React$useState, 2),
165
- storyId = _React$useState2[0],
166
- setStoryId = _React$useState2[1];
167
-
168
- var _React$useState3 = React.useState(INITIAL_CONTROL_STATES),
169
- _React$useState4 = _slicedToArray(_React$useState3, 2),
170
- controlStates = _React$useState4[0],
171
- setControlStates = _React$useState4[1];
172
-
173
- var _React$useState5 = React.useState(false),
174
- _React$useState6 = _slicedToArray(_React$useState5, 2),
175
- isPlaying = _React$useState6[0],
176
- setPlaying = _React$useState6[1];
177
-
178
- var _React$useState7 = React.useState(false),
179
- _React$useState8 = _slicedToArray(_React$useState7, 2),
180
- isRerunAnimating = _React$useState8[0],
181
- setIsRerunAnimating = _React$useState8[1];
109
+ const Panel = props => {
110
+ const [storyId, setStoryId] = React.useState();
111
+ const [controlStates, setControlStates] = React.useState(INITIAL_CONTROL_STATES);
112
+ const [pausedAt, setPausedAt] = React.useState();
113
+ const [isPlaying, setPlaying] = React.useState(false);
114
+ const [isRerunAnimating, setIsRerunAnimating] = React.useState(false);
115
+ const [scrollTarget, setScrollTarget] = React.useState();
116
+ const [collapsed, setCollapsed] = React.useState(new Set()); // Calls are tracked in a ref so we don't needlessly rerender.
182
117
 
183
- var _React$useState9 = React.useState(),
184
- _React$useState10 = _slicedToArray(_React$useState9, 2),
185
- scrollTarget = _React$useState10[0],
186
- setScrollTarget = _React$useState10[1]; // Calls are tracked in a ref so we don't needlessly rerender.
118
+ const calls = React.useRef(new Map());
187
119
 
188
-
189
- var calls = React.useRef(new Map());
190
-
191
- var setCall = function setCall(_ref3) {
192
- var status = _ref3.status,
193
- call = _objectWithoutProperties(_ref3, _excluded2);
120
+ const setCall = _ref2 => {
121
+ let call = _objectWithoutPropertiesLoose(_ref2, _excluded2);
194
122
 
195
123
  return calls.current.set(call.id, call);
196
124
  };
197
125
 
198
- var _React$useState11 = React.useState([]),
199
- _React$useState12 = _slicedToArray(_React$useState11, 2),
200
- log = _React$useState12[0],
201
- setLog = _React$useState12[1];
202
-
203
- var interactions = log.map(function (_ref4) {
204
- var callId = _ref4.callId,
205
- status = _ref4.status;
206
- return Object.assign({}, calls.current.get(callId), {
207
- status: status
208
- });
209
- });
210
- var endRef = React.useRef();
211
- React.useEffect(function () {
212
- var observer;
126
+ const [log, setLog] = React.useState([]);
127
+ const childCallMap = new Map();
128
+ const interactions = log.filter(call => {
129
+ if (!call.parentId) return true;
130
+ childCallMap.set(call.parentId, (childCallMap.get(call.parentId) || []).concat(call.callId));
131
+ return !collapsed.has(call.parentId);
132
+ }).map(({
133
+ callId,
134
+ status
135
+ }) => Object.assign({}, calls.current.get(callId), {
136
+ status,
137
+ childCallIds: childCallMap.get(callId),
138
+ isCollapsed: collapsed.has(callId),
139
+ toggleCollapsed: () => setCollapsed(ids => {
140
+ if (ids.has(callId)) ids.delete(callId);else ids.add(callId);
141
+ return new Set(ids);
142
+ })
143
+ }));
144
+ const endRef = React.useRef();
145
+ React.useEffect(() => {
146
+ let observer;
213
147
 
214
148
  if (_global.default.window.IntersectionObserver) {
215
- observer = new _global.default.window.IntersectionObserver(function (_ref5) {
216
- var _ref6 = _slicedToArray(_ref5, 1),
217
- end = _ref6[0];
218
-
219
- return setScrollTarget(end.isIntersecting ? undefined : end.target);
220
- }, {
149
+ observer = new _global.default.window.IntersectionObserver(([end]) => setScrollTarget(end.isIntersecting ? undefined : end.target), {
221
150
  root: _global.default.window.document.querySelector('#panel-tab-content')
222
151
  });
223
152
  if (endRef.current) observer.observe(endRef.current);
224
153
  }
225
154
 
226
- return function () {
155
+ return () => {
227
156
  var _observer;
228
157
 
229
158
  return (_observer = observer) === null || _observer === void 0 ? void 0 : _observer.disconnect();
230
159
  };
231
160
  }, []);
232
- var emit = (0, _api.useChannel)((_useChannel = {}, _defineProperty(_useChannel, _instrumenter.EVENTS.CALL, setCall), _defineProperty(_useChannel, _instrumenter.EVENTS.SYNC, function (payload) {
233
- setControlStates(payload.controlStates);
234
- setLog(payload.logItems);
235
- }), _defineProperty(_useChannel, _coreEvents.STORY_RENDER_PHASE_CHANGED, function (event) {
236
- setStoryId(event.storyId);
237
- setPlaying(event.newPhase === 'playing');
238
- }), _useChannel), []);
239
- var controls = React.useMemo(function () {
240
- return {
241
- start: function start() {
242
- return emit(_instrumenter.EVENTS.START, {
243
- storyId: storyId
244
- });
245
- },
246
- back: function back() {
247
- return emit(_instrumenter.EVENTS.BACK, {
248
- storyId: storyId
249
- });
250
- },
251
- goto: function goto(callId) {
252
- return emit(_instrumenter.EVENTS.GOTO, {
253
- storyId: storyId,
254
- callId: callId
255
- });
256
- },
257
- next: function next() {
258
- return emit(_instrumenter.EVENTS.NEXT, {
259
- storyId: storyId
260
- });
261
- },
262
- end: function end() {
263
- return emit(_instrumenter.EVENTS.END, {
264
- storyId: storyId
265
- });
266
- },
267
- rerun: function rerun() {
268
- setIsRerunAnimating(true);
269
- emit(_coreEvents.FORCE_REMOUNT, {
270
- storyId: storyId
271
- });
272
- }
273
- };
274
- }, [storyId]);
275
- var storyFilePath = (0, _api.useParameter)('fileName', '');
276
-
277
- var _storyFilePath$toStri = storyFilePath.toString().split('/').slice(-1),
278
- _storyFilePath$toStri2 = _slicedToArray(_storyFilePath$toStri, 1),
279
- fileName = _storyFilePath$toStri2[0];
280
-
281
- var scrollToTarget = function scrollToTarget() {
282
- return scrollTarget === null || scrollTarget === void 0 ? void 0 : scrollTarget.scrollIntoView({
283
- behavior: 'smooth',
284
- block: 'end'
285
- });
286
- };
161
+ const emit = (0, _api.useChannel)({
162
+ [_instrumenter.EVENTS.CALL]: setCall,
163
+ [_instrumenter.EVENTS.SYNC]: payload => {
164
+ setControlStates(payload.controlStates);
165
+ setLog(payload.logItems);
166
+ setPausedAt(payload.pausedAt);
167
+ },
168
+ [_coreEvents.STORY_RENDER_PHASE_CHANGED]: event => {
169
+ setStoryId(event.storyId);
170
+ setPlaying(event.newPhase === 'playing');
171
+ setPausedAt(undefined);
172
+ }
173
+ }, []);
174
+ const controls = React.useMemo(() => ({
175
+ start: () => emit(_instrumenter.EVENTS.START, {
176
+ storyId
177
+ }),
178
+ back: () => emit(_instrumenter.EVENTS.BACK, {
179
+ storyId
180
+ }),
181
+ goto: callId => emit(_instrumenter.EVENTS.GOTO, {
182
+ storyId,
183
+ callId
184
+ }),
185
+ next: () => emit(_instrumenter.EVENTS.NEXT, {
186
+ storyId
187
+ }),
188
+ end: () => emit(_instrumenter.EVENTS.END, {
189
+ storyId
190
+ }),
191
+ rerun: () => {
192
+ setIsRerunAnimating(true);
193
+ emit(_coreEvents.FORCE_REMOUNT, {
194
+ storyId
195
+ });
196
+ }
197
+ }), [storyId]);
198
+ const storyFilePath = (0, _api.useParameter)('fileName', '');
199
+ const [fileName] = storyFilePath.toString().split('/').slice(-1);
287
200
 
288
- var showStatus = log.length > 0 && !isPlaying;
289
- var hasException = log.some(function (item) {
290
- return item.status === _instrumenter.CallStates.ERROR;
201
+ const scrollToTarget = () => scrollTarget === null || scrollTarget === void 0 ? void 0 : scrollTarget.scrollIntoView({
202
+ behavior: 'smooth',
203
+ block: 'end'
291
204
  });
205
+
206
+ const showStatus = log.length > 0 && !isPlaying;
207
+ const hasException = log.some(item => item.status === _instrumenter.CallStates.ERROR);
292
208
  return /*#__PURE__*/React.createElement(React.Fragment, {
293
209
  key: "interactions"
294
210
  }, /*#__PURE__*/React.createElement(TabStatus, null, showStatus && (hasException ? /*#__PURE__*/React.createElement(TabIcon, {
295
211
  status: _instrumenter.CallStates.ERROR
296
- }) : " (".concat(interactions.length, ")"))), /*#__PURE__*/React.createElement(AddonPanelPure, _extends({
212
+ }) : ` (${interactions.length})`)), /*#__PURE__*/React.createElement(AddonPanelPure, _extends({
297
213
  calls: calls.current,
298
214
  controls: controls,
299
215
  controlStates: controlStates,
@@ -301,6 +217,7 @@ var Panel = function Panel(props) {
301
217
  fileName: fileName,
302
218
  hasException: hasException,
303
219
  isPlaying: isPlaying,
220
+ pausedAt: pausedAt,
304
221
  endRef: endRef,
305
222
  onScrollToEnd: scrollTarget && scrollToTarget,
306
223
  isRerunAnimating: isRerunAnimating,
@@ -5,18 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = exports.WithDebuggingDisabled = exports.Playing = exports.Paused = exports.Passing = exports.NoInteractions = exports.Failed = void 0;
7
7
 
8
- require("core-js/modules/es.array.iterator.js");
9
-
10
- require("core-js/modules/es.map.js");
11
-
12
- require("core-js/modules/es.object.to-string.js");
13
-
14
- require("core-js/modules/es.string.iterator.js");
15
-
16
- require("core-js/modules/web.dom-collections.iterator.js");
17
-
18
- require("core-js/modules/es.object.assign.js");
19
-
20
8
  var _react = _interopRequireDefault(require("react"));
21
9
 
22
10
  var _addonActions = require("@storybook/addon-actions");
@@ -33,37 +21,35 @@ var _Subnav = _interopRequireDefault(require("./components/Subnav/Subnav.stories
33
21
 
34
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
23
 
36
- var StyledWrapper = _theming.styled.div(function (_ref) {
37
- var theme = _ref.theme;
38
- return {
39
- backgroundColor: theme.background.content,
40
- color: theme.color.defaultText,
41
- display: 'block',
42
- height: '100%',
43
- position: 'absolute',
44
- left: 0,
45
- right: 0,
46
- bottom: 0,
47
- overflow: 'auto'
48
- };
49
- });
50
-
24
+ const StyledWrapper = _theming.styled.div(({
25
+ theme
26
+ }) => ({
27
+ backgroundColor: theme.background.content,
28
+ color: theme.color.defaultText,
29
+ display: 'block',
30
+ height: '100%',
31
+ position: 'absolute',
32
+ left: 0,
33
+ right: 0,
34
+ bottom: 0,
35
+ overflow: 'auto'
36
+ }));
37
+
38
+ const interactions = (0, _mocks.getInteractions)(_instrumenter.CallStates.DONE);
51
39
  var _default = {
52
40
  title: 'Addons/Interactions/Panel',
53
41
  component: _Panel.AddonPanelPure,
54
- decorators: [function (Story) {
55
- return /*#__PURE__*/_react.default.createElement(StyledWrapper, {
56
- id: "panel-tab-content"
57
- }, /*#__PURE__*/_react.default.createElement(Story, null));
58
- }],
42
+ decorators: [Story => /*#__PURE__*/_react.default.createElement(StyledWrapper, {
43
+ id: "panel-tab-content"
44
+ }, /*#__PURE__*/_react.default.createElement(Story, null))],
59
45
  parameters: {
60
46
  layout: 'fullscreen'
61
47
  },
62
48
  args: {
63
- calls: new Map(),
49
+ calls: new Map((0, _mocks.getCalls)(_instrumenter.CallStates.DONE).map(call => [call.id, call])),
64
50
  controls: _Subnav.default.args.controls,
65
51
  controlStates: _Subnav.default.args.controlStates,
66
- interactions: [(0, _mocks.getCall)(_instrumenter.CallStates.DONE)],
52
+ interactions,
67
53
  fileName: 'addon-interactions.stories.tsx',
68
54
  hasException: false,
69
55
  isPlaying: false,
@@ -74,16 +60,16 @@ var _default = {
74
60
  }
75
61
  };
76
62
  exports.default = _default;
77
- var Passing = {
63
+ const Passing = {
78
64
  args: {
79
- interactions: [(0, _mocks.getCall)(_instrumenter.CallStates.DONE)]
65
+ interactions: (0, _mocks.getInteractions)(_instrumenter.CallStates.DONE)
80
66
  }
81
67
  };
82
68
  exports.Passing = Passing;
83
- var Paused = {
69
+ const Paused = {
84
70
  args: {
85
71
  isPlaying: true,
86
- interactions: [(0, _mocks.getCall)(_instrumenter.CallStates.WAITING)],
72
+ interactions: (0, _mocks.getInteractions)(_instrumenter.CallStates.WAITING),
87
73
  controlStates: {
88
74
  debugger: true,
89
75
  start: false,
@@ -91,25 +77,26 @@ var Paused = {
91
77
  goto: true,
92
78
  next: true,
93
79
  end: true
94
- }
80
+ },
81
+ pausedAt: interactions[interactions.length - 1].id
95
82
  }
96
83
  };
97
84
  exports.Paused = Paused;
98
- var Playing = {
85
+ const Playing = {
99
86
  args: {
100
87
  isPlaying: true,
101
- interactions: [(0, _mocks.getCall)(_instrumenter.CallStates.ACTIVE)]
88
+ interactions: (0, _mocks.getInteractions)(_instrumenter.CallStates.ACTIVE)
102
89
  }
103
90
  };
104
91
  exports.Playing = Playing;
105
- var Failed = {
92
+ const Failed = {
106
93
  args: {
107
94
  hasException: true,
108
- interactions: [(0, _mocks.getCall)(_instrumenter.CallStates.ERROR)]
95
+ interactions: (0, _mocks.getInteractions)(_instrumenter.CallStates.ERROR)
109
96
  }
110
97
  };
111
98
  exports.Failed = Failed;
112
- var WithDebuggingDisabled = {
99
+ const WithDebuggingDisabled = {
113
100
  args: {
114
101
  controlStates: Object.assign({}, _Subnav.default.args.controlStates, {
115
102
  debugger: false
@@ -117,7 +104,7 @@ var WithDebuggingDisabled = {
117
104
  }
118
105
  };
119
106
  exports.WithDebuggingDisabled = WithDebuggingDisabled;
120
- var NoInteractions = {
107
+ const NoInteractions = {
121
108
  args: {
122
109
  interactions: []
123
110
  }