@enact/ui 4.1.1 → 4.1.4

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 (92) hide show
  1. package/AnnounceDecorator/tests/Announce-specs.js +13 -5
  2. package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +9 -7
  3. package/AnnounceDecorator/tests/useAnnounce-specs.js +25 -17
  4. package/BodyText/BodyText.d.ts +1 -1
  5. package/BodyText/tests/BodyText-specs.js +49 -35
  6. package/Button/Button.d.ts +6 -6
  7. package/Button/Button.js +5 -3
  8. package/Button/tests/Button-specs.js +104 -3
  9. package/CHANGELOG.md +26 -0
  10. package/Cancelable/Cancelable.js +1 -1
  11. package/Cancelable/tests/Cancelable-specs.js +131 -70
  12. package/Changeable/tests/Changeable-specs.js +162 -110
  13. package/FloatingLayer/FloatingLayer.js +5 -17
  14. package/FloatingLayer/tests/FloatingLayer-specs.js +83 -8
  15. package/FloatingLayer/tests/Scrim-specs.js +20 -11
  16. package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +15 -9
  17. package/GridListImageItem/GridListImageItem.d.ts +1 -1
  18. package/Group/Group.d.ts +2 -2
  19. package/Group/tests/Group-specs.js +71 -41
  20. package/Heading/Heading.d.ts +2 -1
  21. package/Heading/tests/Heading-specs.js +27 -20
  22. package/Icon/Icon.d.ts +4 -4
  23. package/Icon/tests/Icon-specs.js +52 -31
  24. package/IconButton/IconButton.d.ts +4 -4
  25. package/IconButton/tests/IconButton-specs.js +2 -2
  26. package/Image/tests/Image-specs.js +39 -29
  27. package/ImageItem/tests/ImageItem-specs.js +71 -68
  28. package/Item/tests/Item-specs.js +59 -35
  29. package/LabeledIcon/LabeledIcon.d.ts +4 -4
  30. package/LabeledIcon/tests/LabeledIcon-specs.js +30 -19
  31. package/Layout/Layout.d.ts +16 -16
  32. package/Layout/tests/Layout-specs.js +37 -25
  33. package/Marquee/MarqueeBase.js +1 -5
  34. package/Marquee/MarqueeDecorator.js +6 -3
  35. package/Marquee/index.d.ts +4 -1
  36. package/Marquee/tests/Marquee-specs.js +242 -116
  37. package/Media/Media.js +1 -3
  38. package/ProgressBar/tests/ProgressBar-specs.js +60 -42
  39. package/README.md +1 -1
  40. package/RadioDecorator/RadioDecorator.js +3 -5
  41. package/RadioDecorator/tests/RadioDecorator-specs.js +179 -65
  42. package/Repeater/Repeater.d.ts +2 -1
  43. package/Repeater/tests/Repeater-specs.js +86 -45
  44. package/Routable/Routable.d.ts +2 -2
  45. package/Routable/tests/Routable-specs.js +26 -17
  46. package/Routable/tests/Router-specs.js +65 -41
  47. package/Scrollable/Scrollable.js +2 -1
  48. package/Scrollable/ScrollableNative.js +2 -1
  49. package/Scroller/Scroller.d.ts +2 -14
  50. package/Scroller/ScrollerBasic.js +10 -29
  51. package/Scroller/UiScrollerBase.js +1 -1
  52. package/Skinnable/tests/Skinnable-specs.js +102 -54
  53. package/Skinnable/tests/useSkins-specs.js +37 -42
  54. package/Slider/Slider.d.ts +3 -3
  55. package/Slider/tests/Slider-specs.js +4 -4
  56. package/SlotItem/SlotItem.d.ts +2 -2
  57. package/SlotItem/tests/SlotItem-specs.js +4 -4
  58. package/Slottable/tests/Slottable-specs.js +67 -36
  59. package/Slottable/tests/useSlots-specs.js +68 -35
  60. package/Spinner/Spinner.d.ts +1 -1
  61. package/Spinner/tests/Spinner-specs.js +46 -31
  62. package/ToggleIcon/tests/ToggleIcon-specs.js +32 -20
  63. package/ToggleItem/ToggleItem.d.ts +13 -11
  64. package/ToggleItem/tests/ToggleItem-specs.js +51 -34
  65. package/Toggleable/Toggle.js +6 -6
  66. package/Toggleable/Toggleable.js +6 -12
  67. package/Toggleable/tests/Toggleable-specs.js +428 -324
  68. package/Touchable/Drag.js +13 -17
  69. package/Touchable/Flick.js +20 -16
  70. package/Touchable/Hold.js +14 -19
  71. package/Touchable/Touchable.d.ts +3 -3
  72. package/Touchable/tests/Touchable-specs.js +223 -109
  73. package/Touchable/tests/useTouch-specs.js +159 -84
  74. package/Transition/Transition.d.ts +29 -27
  75. package/Transition/Transition.js +11 -9
  76. package/Transition/tests/Transition-specs.js +111 -31
  77. package/ViewManager/TransitionGroup.js +6 -5
  78. package/ViewManager/View.js +1 -1
  79. package/ViewManager/ViewManager.d.ts +4 -4
  80. package/ViewManager/ViewManager.js +10 -10
  81. package/ViewManager/tests/View-specs.js +109 -81
  82. package/ViewManager/tests/ViewManager-specs.js +471 -185
  83. package/VirtualList/UiVirtualListBase.js +11 -21
  84. package/VirtualList/VirtualList.d.ts +11 -29
  85. package/VirtualList/VirtualListBasic.js +33 -49
  86. package/VirtualList/tests/VirtualList-specs.js +29 -61
  87. package/internal/IdProvider/tests/useId-specs.js +35 -18
  88. package/package.json +11 -11
  89. package/resolution/tests/ResolutionDecorator-specs.js +17 -8
  90. package/styles/mixins.less +14 -2
  91. package/useControlledState/tests/useControlledState-specs.js +67 -42
  92. package/useScroll/useScroll.js +12 -26
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
 
3
- var _enzyme = require("enzyme");
4
-
5
- var _useTouch = _interopRequireDefault(require("../useTouch"));
3
+ var _react = require("@testing-library/react");
6
4
 
7
5
  var _config = require("../config");
8
6
 
7
+ var _useTouch = _interopRequireDefault(require("../useTouch"));
8
+
9
9
  var _jsxRuntime = require("react/jsx-runtime");
10
10
 
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -21,14 +21,19 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
21
21
  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; }
22
22
 
23
23
  describe('useTouch', function () {
24
- var DivComponent = function DivComponent() {
25
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {});
24
+ var data;
25
+
26
+ var DivComponent = function DivComponent(props) {
27
+ data = props;
28
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
29
+ "data-testid": "component"
30
+ });
26
31
  };
27
32
 
28
33
  var TouchableComponent = function TouchableComponent(_ref) {
29
- var id = _ref.id,
30
- activeProp = _ref.activeProp,
31
- rest = _objectWithoutProperties(_ref, ["id", "activeProp"]);
34
+ var activeProp = _ref.activeProp,
35
+ id = _ref.id,
36
+ rest = _objectWithoutProperties(_ref, ["activeProp", "id"]);
32
37
 
33
38
  var hook = (0, _useTouch["default"])(_objectSpread({
34
39
  getActive: !!activeProp
@@ -48,13 +53,11 @@ describe('useTouch', function () {
48
53
  beforeEach(_config.resetDefaultConfig);
49
54
  afterEach(_config.resetDefaultConfig);
50
55
  test('should return active state when activeProp is configured', function () {
51
- var subject = (0, _enzyme.shallow)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
56
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
52
57
  activeProp: "active"
53
58
  }));
54
- var wrapped = subject.find(DivComponent);
55
- var expected = true;
56
- var actual = ('active' in wrapped.props());
57
- expect(actual).toBe(expected);
59
+ var expected = data.active;
60
+ expect(expected).toBeDefined();
58
61
  });
59
62
  test('should merge configurations', function () {
60
63
  (0, _config.configure)({
@@ -108,83 +111,116 @@ describe('useTouch', function () {
108
111
  describe('#onDown', function () {
109
112
  test('should invoke onDown handle on mouse down', function () {
110
113
  var handler = jest.fn();
111
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
114
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
112
115
  activeProp: "active",
113
116
  onDown: handler
114
117
  }));
115
- subject.simulate('mousedown', {});
118
+
119
+ var component = _react.screen.getByTestId('component');
120
+
121
+ _react.fireEvent.mouseDown(component, {});
122
+
116
123
  var expected = 1;
117
- var actual = handler.mock.calls.length;
118
- expect(actual).toBe(expected);
124
+ expect(handler).toHaveBeenCalledTimes(expected);
119
125
  });
120
126
  });
121
127
  describe('#onUp', function () {
122
128
  test('should invoke onUp handle on mouse up', function () {
123
129
  var handler = jest.fn();
124
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
130
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
125
131
  activeProp: "active",
126
132
  onUp: handler
127
133
  }));
128
- subject.simulate('mousedown', {});
129
- subject.simulate('mouseup', {});
134
+
135
+ var component = _react.screen.getByTestId('component');
136
+
137
+ _react.fireEvent.mouseDown(component, {});
138
+
139
+ _react.fireEvent.mouseUp(component, {});
140
+
130
141
  var expected = 1;
131
- var actual = handler.mock.calls.length;
132
- expect(actual).toBe(expected);
142
+ expect(handler).toHaveBeenCalledTimes(expected);
133
143
  });
134
144
  });
135
145
  describe('#onTap', function () {
136
146
  test('should be called on mouse up', function () {
137
147
  var handler = jest.fn();
138
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
148
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
139
149
  activeProp: "active",
140
150
  onTap: handler
141
151
  }));
142
- subject.simulate('mousedown', {});
143
- subject.simulate('mouseup', {});
152
+
153
+ var component = _react.screen.getByTestId('component');
154
+
155
+ _react.fireEvent.mouseDown(component, {});
156
+
157
+ _react.fireEvent.mouseUp(component, {});
158
+
144
159
  var expected = 1;
145
- var actual = handler.mock.calls.length;
146
- expect(actual).toBe(expected);
160
+ expect(handler).toHaveBeenCalledTimes(expected);
147
161
  });
148
162
  test('should be called on click', function () {
149
163
  var handler = jest.fn();
150
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
164
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
151
165
  activeProp: "active",
152
166
  onTap: handler
153
167
  }));
154
- subject.simulate('click');
168
+
169
+ var component = _react.screen.getByTestId('component');
170
+
171
+ _react.fireEvent.click(component, {});
172
+
155
173
  var expected = 1;
156
- var actual = handler.mock.calls.length;
157
- expect(actual).toBe(expected);
174
+ expect(handler).toHaveBeenCalledTimes(expected);
158
175
  });
159
176
  test('should be called before onClick on click', function () {
160
177
  var handler = jest.fn();
161
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
178
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
162
179
  activeProp: "active",
163
180
  onClick: handler,
164
181
  onTap: handler
165
182
  }));
166
- subject.simulate('click');
183
+
184
+ var component = _react.screen.getByTestId('component');
185
+
186
+ _react.fireEvent.click(component, {});
187
+
167
188
  var expected = ['onTap', 'click'];
168
189
  var actual = handler.mock.calls.map(function (call) {
169
190
  return call[0].type;
170
191
  });
171
192
  expect(actual).toEqual(expected);
172
193
  });
173
- test('should be called before onCLick on mouse up', function () {
194
+ test('should be called before onClick on mouse up', function () {
174
195
  var handler = jest.fn();
175
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
196
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
176
197
  activeProp: "active",
177
198
  onClick: handler,
178
199
  onTap: handler
179
200
  }));
180
- var ev = {
181
- // a matching timeStamp is used by Touchable to prevent multiple onTaps on "true"
182
- // click (mouseup + click)
183
- timeStamp: 1
184
- };
185
- subject.simulate('mousedown', ev);
186
- subject.simulate('mouseup', ev);
187
- subject.simulate('click', ev);
201
+
202
+ var component = _react.screen.getByTestId('component');
203
+
204
+ var mouseDownEvent = _react.createEvent.mouseDown(component, {});
205
+
206
+ var mouseUpEvent = _react.createEvent.mouseUp(component, {});
207
+
208
+ var clickEvent = _react.createEvent.click(component, {}); // a matching timeStamp is used by Touchable to prevent multiple onTaps on "true"
209
+ // click (mouseup + click)
210
+
211
+
212
+ Object.defineProperty(mouseDownEvent, 'timeStamp', {
213
+ value: 1
214
+ });
215
+ Object.defineProperty(mouseUpEvent, 'timeStamp', {
216
+ value: 1
217
+ });
218
+ Object.defineProperty(clickEvent, 'timeStamp', {
219
+ value: 1
220
+ });
221
+ (0, _react.fireEvent)(component, mouseDownEvent);
222
+ (0, _react.fireEvent)(component, mouseUpEvent);
223
+ (0, _react.fireEvent)(component, clickEvent);
188
224
  var expected = ['onTap', 'click'];
189
225
  var actual = handler.mock.calls.map(function (call) {
190
226
  return call[0].type;
@@ -193,95 +229,129 @@ describe('useTouch', function () {
193
229
  });
194
230
  test('should be preventable via onUp handler', function () {
195
231
  var handler = jest.fn();
196
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
232
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
197
233
  activeProp: "active",
198
234
  onTap: handler,
199
235
  onUp: preventDefault
200
236
  }));
201
- subject.simulate('mousedown', {});
202
- subject.simulate('mouseup', {});
203
- var expected = 0;
204
- var actual = handler.mock.calls.length;
205
- expect(actual).toBe(expected);
237
+
238
+ var component = _react.screen.getByTestId('component');
239
+
240
+ _react.fireEvent.mouseDown(component, {});
241
+
242
+ _react.fireEvent.mouseUp(component, {});
243
+
244
+ expect(handler).not.toHaveBeenCalled();
206
245
  });
207
246
  });
208
247
  describe('state management', function () {
209
248
  describe('activate', function () {
210
249
  test('should update active state on mouse down when activeProp is configured', function () {
211
250
  var handler = jest.fn();
212
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
251
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
213
252
  activeProp: "active",
214
253
  onDown: handler
215
254
  }));
216
- var beforeDown = subject.find(DivComponent).prop('active');
217
- subject.simulate('mousedown', {});
218
- var afterDown = subject.find(DivComponent).prop('active');
255
+
256
+ var component = _react.screen.getByTestId('component');
257
+
258
+ var beforeDown = data.active;
259
+
260
+ _react.fireEvent.mouseDown(component, {});
261
+
262
+ var afterDown = data.active;
219
263
  var expected = false;
220
264
  var actual = beforeDown === afterDown;
221
265
  expect(actual).toBe(expected);
222
266
  });
223
267
  test('should not update active state on mouse down when disabled', function () {
224
268
  var handler = jest.fn();
225
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
269
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
226
270
  activeProp: "active",
227
271
  disabled: true,
228
272
  onDown: handler
229
273
  }));
230
- subject.simulate('mousedown', {});
274
+
275
+ var component = _react.screen.getByTestId('component');
276
+
277
+ _react.fireEvent.mouseDown(component, {});
278
+
231
279
  var expected = false;
232
- var actual = subject.find(DivComponent).prop('active');
280
+ var actual = data.active;
233
281
  expect(actual).toBe(expected);
234
282
  });
235
283
  test('should not update active state on mouse down when preventDefault is called', function () {
236
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
284
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
237
285
  activeProp: "active",
238
286
  onDown: preventDefault
239
287
  }));
240
- subject.simulate('mousedown', {});
288
+
289
+ var component = _react.screen.getByTestId('component');
290
+
291
+ _react.fireEvent.mouseDown(component, {});
292
+
241
293
  var expected = false;
242
- var actual = subject.find(DivComponent).prop('active');
294
+ var actual = data.active;
243
295
  expect(actual).toBe(expected);
244
296
  });
245
297
  });
246
298
  describe('deactivate', function () {
247
299
  test('should update active state on mouse up when activeProp is configured', function () {
248
300
  var handler = jest.fn();
249
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
301
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
250
302
  activeProp: "active",
251
303
  onDown: handler
252
304
  }));
253
- subject.simulate('mousedown', {});
254
- var beforeUp = subject.find(DivComponent).prop('active');
255
- subject.simulate('mouseup', {});
256
- var afterUp = subject.find(DivComponent).prop('active');
305
+
306
+ var component = _react.screen.getByTestId('component');
307
+
308
+ _react.fireEvent.mouseDown(component, {});
309
+
310
+ var beforeUp = data.active;
311
+
312
+ _react.fireEvent.mouseUp(component, {});
313
+
314
+ var afterUp = data.active;
257
315
  var expected = false;
258
316
  var actual = beforeUp === afterUp;
259
317
  expect(actual).toBe(expected);
260
318
  });
261
319
  test('should not update active state on mouse down when disabled', function () {
262
320
  var handler = jest.fn();
263
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
321
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
264
322
  activeProp: "active",
265
323
  disabled: true,
266
324
  onDown: handler
267
325
  }));
268
- subject.simulate('mousedown', {});
269
- var beforeUp = subject.find(DivComponent).prop('active');
270
- subject.simulate('mouseup', {});
271
- var afterUp = subject.find(DivComponent).prop('active');
326
+
327
+ var component = _react.screen.getByTestId('component');
328
+
329
+ _react.fireEvent.mouseDown(component, {});
330
+
331
+ var beforeUp = data.active;
332
+
333
+ _react.fireEvent.mouseUp(component, {});
334
+
335
+ var afterUp = data.active;
272
336
  var expected = true;
273
337
  var actual = beforeUp === afterUp;
274
338
  expect(actual).toBe(expected);
275
339
  });
276
340
  test('should not update active state on mouse down when preventDefault is called', function () {
277
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
341
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TouchableComponent, {
278
342
  activeProp: "active",
279
343
  onDown: preventDefault
280
344
  }));
281
- subject.simulate('mousedown', {});
282
- var beforeUp = subject.find(DivComponent).prop('active');
283
- subject.simulate('mouseup', {});
284
- var afterUp = subject.find(DivComponent).prop('active');
345
+
346
+ var component = _react.screen.getByTestId('component');
347
+
348
+ _react.fireEvent.mouseDown(component, {});
349
+
350
+ var beforeUp = data.active;
351
+
352
+ _react.fireEvent.mouseUp(component, {});
353
+
354
+ var afterUp = data.active;
285
355
  var expected = true;
286
356
  var actual = beforeUp === afterUp;
287
357
  expect(actual).toBe(expected);
@@ -301,14 +371,17 @@ describe('useTouch', function () {
301
371
  id: "outer"
302
372
  }, outerHook.handlers), {}, {
303
373
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({
304
- id: "inner"
374
+ "data-testid": "inner"
305
375
  }, innerHook.handlers), {}, {
306
376
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(DivComponent, {})
307
377
  }))
308
378
  }));
309
379
  };
310
380
 
311
- var subject = (0, _enzyme.mount)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {}));
381
+ (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {}));
382
+
383
+ var inner = _react.screen.getByTestId('inner');
384
+
312
385
  var mouseEvent = {
313
386
  timeStamp: 1
314
387
  };
@@ -323,14 +396,16 @@ describe('useTouch', function () {
323
396
  clientY: 0
324
397
  }]
325
398
  };
326
- var inner = subject.find('div#inner');
327
- inner.simulate('touchstart', touchEvent);
328
- inner.simulate('touchend', touchEvent);
329
- inner.simulate('mousedown', mouseEvent);
330
- inner.simulate('mouseup', mouseEvent);
331
- var expected = 1;
332
- var actual = handler.mock.calls.length;
333
- expect(actual).toBe(expected);
399
+
400
+ _react.fireEvent.touchStart(inner, touchEvent);
401
+
402
+ _react.fireEvent.touchEnd(inner, touchEvent);
403
+
404
+ _react.fireEvent.mouseDown(inner, mouseEvent);
405
+
406
+ _react.fireEvent.mouseUp(inner, mouseEvent);
407
+
408
+ expect(handler).toHaveBeenCalled();
334
409
  });
335
410
  });
336
411
  });
@@ -75,10 +75,11 @@ are also supported and treated as milliseconds.
75
75
  */
76
76
  noAnimation?: boolean;
77
77
  /**
78
- * The transition timing function.
79
- * * Supported function names are: `ease` , `ease-in` , `ease-out` , `ease-in-out` , `ease-in-quart` ,
80
- `ease-out-quart` , and `linear` .
81
- */
78
+ * The transition timing function.
79
+ * * Supported function names are: `ease` , `ease-in` , `ease-out` , `ease-in-out` , `ease-in-quart` ,
80
+ *
81
+ * `ease-out-quart` , and `linear` .
82
+ */
82
83
  timingFunction?: string;
83
84
  /**
84
85
  * The type of transition to affect the content.
@@ -86,19 +87,19 @@ are also supported and treated as milliseconds.
86
87
  *
87
88
  * Details on types:
88
89
  * * `'slide'` - Typically used for bringing something which is off the edge of the screen,
89
- and not visible, onto the screen. Think of a popup, toast, notification, dialog, or
90
- an overlaying menu. This requires no re-rendering or repainting of the screen during
91
- the transition, making it very performant. However, this does not affect layout at
92
- all, which makes it less useful for transitioning from a place already on the
93
- screen.
90
+ and not visible, onto the screen. Think of a popup, toast, notification, dialog, or
91
+ an overlaying menu. This requires no re-rendering or repainting of the screen during
92
+ the transition, making it very performant. However, this does not affect layout at
93
+ all, which makes it less useful for transitioning from a place already on the
94
+ screen.
94
95
  * * `'clip'` - This is useful for showing a component that transitions-in from a location
95
- that is already on the screen. Examples would be an expanding header or an
96
- accordion. This type does affects layout, its current size will push other sibling
97
- elements to make room for itself. Because of this, repainting the layout does happen
98
- during transition.
96
+ that is already on the screen. Examples would be an expanding header or an
97
+ accordion. This type does affects layout, its current size will push other sibling
98
+ elements to make room for itself. Because of this, repainting the layout does happen
99
+ during transition.
99
100
  * * `'fade'` - Fade the components onto the screen, from 0 opacity (completely invisible)
100
- to 1 (full visibility). Pretty basic, but useful for fading on/off a tooltip, a
101
- menu, a panel, or even view contents. This does not affect layout at all.
101
+ to 1 (full visibility). Pretty basic, but useful for fading on/off a tooltip, a
102
+ menu, a panel, or even view contents. This does not affect layout at all.
102
103
  */
103
104
  type?: string;
104
105
  /**
@@ -130,7 +131,8 @@ export interface TransitionProps {
130
131
  /**
131
132
  * Controls how long the transition should take.
132
133
  * * Supported preset durations are: `'short'` (250ms), `'medium'` (500ms), and `'long'` (1s).
133
- `'medium'` (500ms) is default when no others are specified.
134
+ *
135
+ * `'medium'` (500ms) is default when no others are specified.
134
136
  *
135
137
  * Any valid CSS duration value is also accepted, e.g. "200ms" or "3s". Pure numeric values
136
138
  are also supported and treated as miliseconds.
@@ -162,19 +164,19 @@ Supported function names are: `ease` , `ease-in` , `ease-out` , `ease-in-out
162
164
  *
163
165
  * Details on types:
164
166
  * * `'slide'` - Typically used for bringing something which is off the edge of the screen,
165
- and not visible, onto the screen. Think of a popup, toast, notification, dialog, or
166
- an overlaying menu. This requires no re-rendering or repainting of the screen during
167
- the transition, making it very performant. However, this does not affect layout at
168
- all, which makes it less useful for transitioning from a place already on the
169
- screen.
167
+ and not visible, onto the screen. Think of a popup, toast, notification, dialog, or
168
+ an overlaying menu. This requires no re-rendering or repainting of the screen during
169
+ the transition, making it very performant. However, this does not affect layout at
170
+ all, which makes it less useful for transitioning from a place already on the
171
+ screen.
170
172
  * * `'clip'` - This is useful for showing a component that transitions-in from a location
171
- that is already on the screen. Examples would be an expanding header or an
172
- accordion. This type does affects layout, its current size will push other sibling
173
- elements to make room for itself. Because of this, repainting the layout does happen
174
- during transition.
173
+ that is already on the screen. Examples would be an expanding header or an
174
+ accordion. This type does affects layout, its current size will push other sibling
175
+ elements to make room for itself. Because of this, repainting the layout does happen
176
+ during transition.
175
177
  * * `'fade'` - Fade the components onto the screen, from 0 opacity (completely invisible)
176
- to 1 (full visibility). Pretty basic, but useful for fading on/off a tooltip, a
177
- menu, a panel, or even view contents. This does not affect layout at all.
178
+ to 1 (full visibility). Pretty basic, but useful for fading on/off a tooltip, a
179
+ menu, a panel, or even view contents. This does not affect layout at all.
178
180
  */
179
181
  type?: string;
180
182
  /**
@@ -55,10 +55,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
55
55
 
56
56
  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; }
57
57
 
58
- var forwardTransitionEnd = (0, _handle.forward)('onTransitionEnd');
59
- var forwardOnShow = (0, _handle.forward)('onShow');
60
- var forwardOnHide = (0, _handle.forward)('onHide');
61
-
62
58
  var formatter = function formatter(duration) {
63
59
  return typeof duration === 'number' ? duration + 'ms' : duration;
64
60
  };
@@ -375,13 +371,19 @@ var Transition = /*#__PURE__*/function (_Component) {
375
371
  };
376
372
 
377
373
  _this.handleTransitionEnd = function (ev) {
378
- forwardTransitionEnd(ev, _this.props);
374
+ (0, _handle.forward)('onTransitionEnd', ev, _this.props);
379
375
 
380
376
  if (ev.target === _this.childNode) {
381
377
  if (!_this.props.visible) {
382
- forwardOnHide(ev, _this.props);
378
+ (0, _handle.forward)('onHide', {
379
+ type: 'onHide',
380
+ currentTarget: ev.currentTarget
381
+ }, _this.props);
383
382
  } else if (_this.props.visible) {
384
- forwardOnShow(ev, _this.props);
383
+ (0, _handle.forward)('onShow', {
384
+ type: 'onShow',
385
+ currentTarget: ev.currentTarget
386
+ }, _this.props);
385
387
  }
386
388
  }
387
389
  };
@@ -456,9 +458,9 @@ var Transition = /*#__PURE__*/function (_Component) {
456
458
 
457
459
  if (noAnimation) {
458
460
  if (!prevProps.visible && visible) {
459
- forwardOnShow({}, this.props);
461
+ (0, _handle.forwardCustom)('onShow')({}, this.props);
460
462
  } else if (prevProps.visible && !visible) {
461
- forwardOnHide({}, this.props);
463
+ (0, _handle.forwardCustom)('onHide')({}, this.props);
462
464
  }
463
465
  }
464
466
  }