@enact/ui 4.5.2 → 4.5.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 (167) hide show
  1. package/AnnounceDecorator/Announce.js +1 -40
  2. package/AnnounceDecorator/AnnounceDecorator.js +3 -21
  3. package/AnnounceDecorator/tests/Announce-specs.js +2 -7
  4. package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +2 -6
  5. package/AnnounceDecorator/tests/useAnnounce-specs.js +8 -19
  6. package/AnnounceDecorator/useAnnounce.js +0 -6
  7. package/BodyText/BodyText.js +6 -26
  8. package/BodyText/tests/BodyText-specs.js +0 -19
  9. package/Button/Button.js +26 -56
  10. package/Button/tests/Button-specs.js +0 -26
  11. package/CHANGELOG.md +10 -0
  12. package/Cancelable/Cancelable.js +8 -47
  13. package/Cancelable/cancelHandler.js +5 -12
  14. package/Cancelable/modalHandler.js +3 -11
  15. package/Cancelable/tests/Cancelable-specs.js +3 -57
  16. package/Changeable/Changeable.js +2 -34
  17. package/Changeable/tests/Changeable-specs.js +20 -66
  18. package/ComponentOverride/ComponentOverride.js +1 -13
  19. package/FloatingLayer/FloatingLayer.js +17 -73
  20. package/FloatingLayer/FloatingLayerContainer.js +0 -15
  21. package/FloatingLayer/FloatingLayerDecorator.js +4 -17
  22. package/FloatingLayer/Scrim.js +9 -53
  23. package/FloatingLayer/index.js +0 -4
  24. package/FloatingLayer/tests/FloatingLayer-specs.js +8 -22
  25. package/FloatingLayer/tests/Scrim-specs.js +0 -9
  26. package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +0 -13
  27. package/FloatingLayer/useFloatingLayer.js +3 -14
  28. package/FloatingLayer/useFloatingLayerDecorator.js +3 -11
  29. package/ForwardRef/ForwardRef.js +1 -10
  30. package/GridListImageItem/GridListImageItem.js +17 -50
  31. package/Group/Group.js +4 -35
  32. package/Group/GroupItem.js +15 -32
  33. package/Group/tests/Group-specs.js +0 -32
  34. package/Heading/Heading.js +7 -35
  35. package/Heading/tests/Heading-specs.js +81 -14
  36. package/Icon/Icon.js +14 -48
  37. package/Icon/tests/Icon-specs.js +0 -22
  38. package/IconButton/IconButton.js +12 -50
  39. package/IconButton/tests/IconButton-specs.js +0 -7
  40. package/Image/Image.js +16 -45
  41. package/Image/tests/Image-specs.js +0 -14
  42. package/ImageItem/ImageItem.js +17 -46
  43. package/ImageItem/tests/ImageItem-specs.js +0 -25
  44. package/Item/Item.js +8 -32
  45. package/Item/tests/Item-specs.js +0 -24
  46. package/LabeledIcon/LabeledIcon.js +19 -50
  47. package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
  48. package/Layout/Cell.js +11 -37
  49. package/Layout/Layout.js +14 -37
  50. package/Layout/tests/Layout-specs.js +10 -39
  51. package/Marquee/MarqueeBase.js +29 -63
  52. package/Marquee/MarqueeController.js +11 -72
  53. package/Marquee/MarqueeDecorator.js +62 -196
  54. package/Marquee/index.js +1 -5
  55. package/Marquee/tests/Marquee-specs.js +258 -87
  56. package/Measurable/Measurable.js +12 -34
  57. package/Measurable/tests/Measurable-specs.js +115 -0
  58. package/Media/Media.js +15 -65
  59. package/Media/tests/Media-specs.js +168 -0
  60. package/Placeholder/PlaceholderControllerDecorator.js +7 -43
  61. package/Placeholder/PlaceholderDecorator.js +7 -38
  62. package/Placeholder/index.js +0 -4
  63. package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +25 -0
  64. package/Placeholder/tests/PlaceholderDecorator-specs.js +28 -0
  65. package/ProgressBar/ProgressBar.js +13 -44
  66. package/ProgressBar/tests/ProgressBar-specs.js +0 -17
  67. package/RadioDecorator/RadioControllerDecorator.js +1 -29
  68. package/RadioDecorator/RadioDecorator.js +4 -42
  69. package/RadioDecorator/tests/RadioDecorator-specs.js +12 -49
  70. package/Repeater/Repeater.js +9 -33
  71. package/Repeater/tests/Repeater-specs.js +0 -38
  72. package/Resizable/Resizable.js +7 -35
  73. package/Resizable/tests/Resizable-specs.js +34 -0
  74. package/Routable/Link.js +8 -44
  75. package/Routable/Routable.js +10 -33
  76. package/Routable/Route.js +0 -6
  77. package/Routable/Router.js +13 -56
  78. package/Routable/tests/Routable-specs.js +7 -33
  79. package/Routable/tests/Router-specs.js +18 -44
  80. package/Routable/useLink.js +4 -8
  81. package/Routable/util.js +18 -24
  82. package/Scrollable/ScrollAnimator.js +49 -65
  83. package/Scrollable/ScrollThumb.js +2 -13
  84. package/Scrollable/Scrollable.js +179 -386
  85. package/Scrollable/ScrollableNative.js +188 -391
  86. package/Scrollable/Scrollbar.js +28 -100
  87. package/Scroller/Scroller.js +15 -39
  88. package/Scroller/ScrollerBasic.js +34 -89
  89. package/Scroller/UiScrollerBase.js +31 -84
  90. package/Skinnable/Skinnable.js +11 -38
  91. package/Skinnable/tests/Skinnable-specs.js +3 -74
  92. package/Skinnable/tests/useSkins-specs.js +1 -13
  93. package/Skinnable/tests/util-specs.js +0 -14
  94. package/Skinnable/useSkins.js +8 -15
  95. package/Skinnable/util.js +9 -20
  96. package/Slider/Knob.js +5 -24
  97. package/Slider/PositionDecorator.js +16 -54
  98. package/Slider/Slider.js +26 -64
  99. package/Slider/tests/Slider-specs.js +94 -7
  100. package/Slider/utils.js +0 -2
  101. package/SlotItem/SlotItem.js +15 -41
  102. package/SlotItem/tests/SlotItem-specs.js +0 -5
  103. package/Slottable/Slottable.js +4 -12
  104. package/Slottable/tests/Slottable-specs.js +19 -46
  105. package/Slottable/tests/useSlots-specs.js +27 -65
  106. package/Slottable/useSlots.js +8 -33
  107. package/Spinner/Spinner.js +15 -42
  108. package/Spinner/tests/Spinner-specs.js +0 -15
  109. package/ToggleIcon/ToggleIcon.js +10 -36
  110. package/ToggleIcon/tests/ToggleIcon-specs.js +0 -16
  111. package/ToggleItem/ToggleItem.js +15 -52
  112. package/ToggleItem/tests/ToggleItem-specs.js +0 -30
  113. package/Toggleable/Toggle.js +1 -15
  114. package/Toggleable/Toggleable.js +12 -45
  115. package/Toggleable/tests/Toggleable-specs.js +28 -96
  116. package/Toggleable/useToggle.js +3 -19
  117. package/Touchable/ClickAllow.js +5 -14
  118. package/Touchable/Drag.js +16 -54
  119. package/Touchable/Flick.js +11 -42
  120. package/Touchable/Hold.js +21 -68
  121. package/Touchable/Touch.js +37 -65
  122. package/Touchable/Touchable.js +32 -71
  123. package/Touchable/config.js +8 -22
  124. package/Touchable/tests/Touchable-specs.js +270 -119
  125. package/Touchable/tests/useTouch-specs.js +6 -80
  126. package/Touchable/useTouch.js +17 -34
  127. package/Transition/Transition.js +37 -118
  128. package/Transition/tests/Transition-specs.js +20 -60
  129. package/ViewManager/Arranger.js +10 -22
  130. package/ViewManager/TransitionGroup.js +31 -106
  131. package/ViewManager/View.js +35 -91
  132. package/ViewManager/ViewManager.js +19 -83
  133. package/ViewManager/tests/View-specs.js +0 -17
  134. package/ViewManager/tests/ViewManager-specs.js +236 -305
  135. package/ViewManager/tests/test-utils.js +0 -8
  136. package/VirtualList/UiVirtualListBase.js +256 -406
  137. package/VirtualList/VirtualList.js +29 -69
  138. package/VirtualList/VirtualListBase.js +0 -3
  139. package/VirtualList/VirtualListBasic.js +270 -428
  140. package/VirtualList/tests/VirtualList-specs.js +9 -37
  141. package/internal/IdProvider/IdProvider.js +7 -21
  142. package/internal/IdProvider/Provider.js +4 -17
  143. package/internal/IdProvider/tests/IdProvider-specs.js +44 -0
  144. package/internal/IdProvider/tests/useId-specs.js +7 -22
  145. package/internal/IdProvider/useId.js +0 -6
  146. package/internal/Pure/Pure.js +3 -30
  147. package/internal/Pure/tests/Pure-specs.js +88 -0
  148. package/internal/localized-fonts/localized-fonts.js +33 -62
  149. package/internal/localized-fonts/tests/localized-fonts-specs.js +33 -0
  150. package/internal/selection/selection.js +1 -6
  151. package/internal/selection/tests/selection-specs.js +6 -4
  152. package/internal/validators/tests/validators-specs.js +80 -0
  153. package/internal/validators/validators.js +14 -34
  154. package/package.json +8 -2
  155. package/resolution/ResolutionDecorator.js +4 -40
  156. package/resolution/index.js +0 -7
  157. package/resolution/resolution.js +42 -80
  158. package/resolution/tests/ResolutionDecorator-specs.js +4 -11
  159. package/resolution/tests/resolution-specs.js +2 -2
  160. package/useControlledState/tests/useControlledState-specs.js +15 -46
  161. package/useControlledState/useControlledState.js +11 -22
  162. package/useScroll/ScrollAnimator.js +49 -65
  163. package/useScroll/Scrollbar.js +22 -58
  164. package/useScroll/ScrollbarTrack.js +3 -19
  165. package/useScroll/useScroll.js +325 -502
  166. package/useScroll/utilDOM.js +8 -14
  167. package/useScroll/utilEvent.js +0 -4
@@ -4,60 +4,33 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = exports.TransitionBase = exports.Transition = void 0;
7
-
8
7
  var _handle = require("@enact/core/handle");
9
-
10
8
  var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
11
-
12
9
  var _kind = _interopRequireDefault(require("@enact/core/kind"));
13
-
14
10
  var _util = require("@enact/core/util");
15
-
16
11
  var _react = require("react");
17
-
18
12
  var _propTypes2 = _interopRequireDefault(require("prop-types"));
19
-
20
13
  var _Resizable = require("../Resizable");
21
-
22
14
  var _TransitionModule = _interopRequireDefault(require("./Transition.module.css"));
23
-
24
15
  var _jsxRuntime = require("react/jsx-runtime");
25
-
26
16
  var _excluded = ["css", "childRef", "children", "innerStyle"],
27
- _excluded2 = ["visible"];
28
-
17
+ _excluded2 = ["visible"];
29
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
30
-
31
19
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
32
-
33
20
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
34
-
35
21
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
36
-
37
22
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
38
-
39
23
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
40
-
41
24
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
42
-
43
25
  function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
44
-
45
26
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
46
-
47
27
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
48
-
49
28
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
50
-
51
29
  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; }
52
-
53
30
  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; }
54
-
55
31
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
56
-
57
32
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
58
-
59
33
  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; }
60
-
61
34
  var formatter = function formatter(duration) {
62
35
  return typeof duration === 'number' ? duration + 'ms' : duration;
63
36
  };
@@ -72,13 +45,9 @@ var formatter = function formatter(duration) {
72
45
  * @memberof ui/Transition
73
46
  * @public
74
47
  */
75
-
76
-
77
48
  var TransitionBase = (0, _kind["default"])({
78
49
  name: 'TransitionBase',
79
- propTypes:
80
- /** @lends ui/Transition.TransitionBase.prototype */
81
- {
50
+ propTypes: /** @lends ui/Transition.TransitionBase.prototype */{
82
51
  /**
83
52
  * Provide a function to get the reference to the child node (the one with the content) at
84
53
  * render time.
@@ -90,7 +59,6 @@ var TransitionBase = (0, _kind["default"])({
90
59
  * @public
91
60
  */
92
61
  childRef: _propTypes["default"].ref,
93
-
94
62
  /**
95
63
  * The node to be transitioned.
96
64
  *
@@ -98,7 +66,6 @@ var TransitionBase = (0, _kind["default"])({
98
66
  * @public
99
67
  */
100
68
  children: _propTypes2["default"].node,
101
-
102
69
  /**
103
70
  * The height of the transition when `type` is set to `'clip'`, used when direction is
104
71
  * 'left' or 'right'.
@@ -108,7 +75,6 @@ var TransitionBase = (0, _kind["default"])({
108
75
  * @public
109
76
  */
110
77
  clipHeight: _propTypes2["default"].number,
111
-
112
78
  /**
113
79
  * The width of the transition when `type` is set to `'clip'`, used when direction is 'left'
114
80
  * or 'right'.
@@ -118,7 +84,6 @@ var TransitionBase = (0, _kind["default"])({
118
84
  * @public
119
85
  */
120
86
  clipWidth: _propTypes2["default"].number,
121
-
122
87
  /**
123
88
  * Customizes the component by mapping the supplied collection of CSS class names to the
124
89
  * corresponding internal elements and states of this component.
@@ -151,7 +116,6 @@ var TransitionBase = (0, _kind["default"])({
151
116
  * @public
152
117
  */
153
118
  css: _propTypes2["default"].object,
154
-
155
119
  /**
156
120
  * Sets the direction of transition. Where the component will move *to*; the destination.
157
121
  * Supported directions are: `'up'`, `'right'`, `'down'`, `'left'`.
@@ -161,7 +125,6 @@ var TransitionBase = (0, _kind["default"])({
161
125
  * @public
162
126
  */
163
127
  direction: _propTypes2["default"].oneOf(['up', 'right', 'down', 'left']),
164
-
165
128
  /**
166
129
  * Controls how long the transition should take.
167
130
  * Supported preset durations are: `'short'` (250ms), `'medium'` (500ms), and `'long'` (1s).
@@ -174,7 +137,6 @@ var TransitionBase = (0, _kind["default"])({
174
137
  * @public
175
138
  */
176
139
  duration: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
177
-
178
140
  /**
179
141
  * Disables transition animation.
180
142
  *
@@ -185,7 +147,6 @@ var TransitionBase = (0, _kind["default"])({
185
147
  * @public
186
148
  */
187
149
  noAnimation: _propTypes2["default"].bool,
188
-
189
150
  /**
190
151
  * The transition timing function.
191
152
  *
@@ -197,7 +158,6 @@ var TransitionBase = (0, _kind["default"])({
197
158
  * @public
198
159
  */
199
160
  timingFunction: _propTypes2["default"].oneOf(['ease', 'ease-in', 'ease-out', 'ease-in-out', 'ease-in-quart', 'ease-out-quart', 'linear']),
200
-
201
161
  /**
202
162
  * The type of transition to affect the content.
203
163
  *
@@ -224,7 +184,6 @@ var TransitionBase = (0, _kind["default"])({
224
184
  * @public
225
185
  */
226
186
  type: _propTypes2["default"].oneOf(['slide', 'clip', 'fade']),
227
-
228
187
  /**
229
188
  * Sets the visibility of the component, which determines whether it's on screen or off.
230
189
  *
@@ -250,67 +209,60 @@ var TransitionBase = (0, _kind["default"])({
250
209
  computed: {
251
210
  className: function className(_ref) {
252
211
  var css = _ref.css,
253
- direction = _ref.direction,
254
- duration = _ref.duration,
255
- noAnimation = _ref.noAnimation,
256
- timingFunction = _ref.timingFunction,
257
- type = _ref.type,
258
- visible = _ref.visible,
259
- styler = _ref.styler;
212
+ direction = _ref.direction,
213
+ duration = _ref.duration,
214
+ noAnimation = _ref.noAnimation,
215
+ timingFunction = _ref.timingFunction,
216
+ type = _ref.type,
217
+ visible = _ref.visible,
218
+ styler = _ref.styler;
260
219
  return styler.append(visible ? 'shown' : 'hidden', direction && css[direction], !noAnimation && duration && css[duration], !noAnimation && timingFunction && css[timingFunction], css[type]);
261
220
  },
262
221
  innerStyle: function innerStyle(_ref2) {
263
222
  var clipWidth = _ref2.clipWidth,
264
- css = _ref2.css,
265
- direction = _ref2.direction,
266
- duration = _ref2.duration,
267
- type = _ref2.type;
223
+ css = _ref2.css,
224
+ direction = _ref2.direction,
225
+ duration = _ref2.duration,
226
+ type = _ref2.type;
268
227
  var style = {};
269
-
270
228
  if (type === 'clip' && (direction === 'left' || direction === 'right')) {
271
229
  style.width = clipWidth;
272
230
  } else if ((type === 'fade' || type === 'slide') && duration && !css[duration]) {
273
231
  // If it's a number, assume it's miliseconds, if not, assume it's already a CSS duration string (like "200ms" or "2s")
274
232
  style.transitionDuration = formatter(duration);
275
233
  }
276
-
277
234
  return style;
278
235
  },
279
236
  style: function style(_ref3) {
280
237
  var clipHeight = _ref3.clipHeight,
281
- css = _ref3.css,
282
- direction = _ref3.direction,
283
- duration = _ref3.duration,
284
- type = _ref3.type,
285
- visible = _ref3.visible,
286
- _style = _ref3.style;
287
-
238
+ css = _ref3.css,
239
+ direction = _ref3.direction,
240
+ duration = _ref3.duration,
241
+ type = _ref3.type,
242
+ visible = _ref3.visible,
243
+ _style = _ref3.style;
288
244
  if (type === 'clip') {
289
245
  _style = _objectSpread(_objectSpread({}, _style), {}, {
290
246
  overflow: 'hidden'
291
247
  });
292
-
293
248
  if (visible && (direction === 'up' || direction === 'down')) {
294
249
  _style.height = clipHeight;
295
- } // If duration isn't a known named string, assume it is a CSS duration value
296
-
297
-
250
+ }
251
+ // If duration isn't a known named string, assume it is a CSS duration value
298
252
  if (duration && !css[duration]) {
299
253
  // If it's a number, assume it's miliseconds, if not, assume it's already a CSS duration string (like "200ms" or "2s")
300
254
  _style.transitionDuration = formatter(duration);
301
255
  }
302
256
  }
303
-
304
257
  return _style;
305
258
  }
306
259
  },
307
260
  render: function render(_ref4) {
308
261
  var css = _ref4.css,
309
- childRef = _ref4.childRef,
310
- children = _ref4.children,
311
- innerStyle = _ref4.innerStyle,
312
- rest = _objectWithoutProperties(_ref4, _excluded);
313
-
262
+ childRef = _ref4.childRef,
263
+ children = _ref4.children,
264
+ innerStyle = _ref4.innerStyle,
265
+ rest = _objectWithoutProperties(_ref4, _excluded);
314
266
  delete rest.clipHeight;
315
267
  delete rest.clipWidth;
316
268
  delete rest.direction;
@@ -336,8 +288,8 @@ var TRANSITION_STATE = {
336
288
  MEASURE: 1,
337
289
  // open but need to measure
338
290
  READY: 2 // measured and ready
339
-
340
291
  };
292
+
341
293
  /**
342
294
  * A stateful component that allows for applying transitions to its child items via configurable
343
295
  * properties and events.
@@ -347,24 +299,18 @@ var TRANSITION_STATE = {
347
299
  * @memberof ui/Transition
348
300
  * @public
349
301
  */
350
-
351
302
  var Transition = /*#__PURE__*/function (_Component) {
352
303
  _inherits(Transition, _Component);
353
-
354
304
  var _super = _createSuper(Transition);
355
-
356
305
  function Transition(props) {
357
306
  var _this;
358
-
359
307
  _classCallCheck(this, Transition);
360
-
361
308
  _this = _super.call(this, props);
362
309
  _this.measuringJob = new _util.Job(function () {
363
310
  _this.setState({
364
311
  renderState: TRANSITION_STATE.MEASURE
365
312
  });
366
313
  });
367
-
368
314
  _this.handleResize = function () {
369
315
  // @TODO oddly, using the setState callback is required here to ensure that the bounds
370
316
  // are remeasured in a separate tick
@@ -372,10 +318,8 @@ var Transition = /*#__PURE__*/function (_Component) {
372
318
  initialHeight: null
373
319
  }, _this.measureInner);
374
320
  };
375
-
376
321
  _this.handleTransitionEnd = function (ev) {
377
322
  (0, _handle.forward)('onTransitionEnd', ev, _this.props);
378
-
379
323
  if (ev.target === _this.childNode) {
380
324
  if (!_this.props.visible) {
381
325
  (0, _handle.forward)('onHide', {
@@ -390,12 +334,10 @@ var Transition = /*#__PURE__*/function (_Component) {
390
334
  }
391
335
  }
392
336
  };
393
-
394
337
  _this.measureInner = function () {
395
338
  if (_this.childNode) {
396
339
  var initialHeight = _this.childNode.scrollHeight;
397
340
  var initialWidth = _this.childNode.scrollWidth;
398
-
399
341
  if (initialHeight !== _this.state.initialHeight || initialWidth !== _this.state.initialWidth) {
400
342
  _this.setState({
401
343
  initialHeight: initialHeight,
@@ -405,11 +347,9 @@ var Transition = /*#__PURE__*/function (_Component) {
405
347
  }
406
348
  }
407
349
  };
408
-
409
350
  _this.childRef = function (node) {
410
351
  _this.childNode = node;
411
352
  };
412
-
413
353
  _this.state = {
414
354
  initialHeight: null,
415
355
  initialWidth: null,
@@ -419,7 +359,6 @@ var Transition = /*#__PURE__*/function (_Component) {
419
359
  _this.resizeRegistry = null;
420
360
  return _this;
421
361
  }
422
-
423
362
  _createClass(Transition, [{
424
363
  key: "componentDidMount",
425
364
  value: function componentDidMount() {
@@ -428,7 +367,6 @@ var Transition = /*#__PURE__*/function (_Component) {
428
367
  } else {
429
368
  this.measureInner();
430
369
  }
431
-
432
370
  if (this.context && typeof this.context === 'function') {
433
371
  this.resizeRegistry = this.context(this.handleResize);
434
372
  }
@@ -443,22 +381,20 @@ var Transition = /*#__PURE__*/function (_Component) {
443
381
  key: "componentDidUpdate",
444
382
  value: function componentDidUpdate(prevProps, prevState) {
445
383
  var _this$props = this.props,
446
- noAnimation = _this$props.noAnimation,
447
- visible = _this$props.visible;
384
+ noAnimation = _this$props.noAnimation,
385
+ visible = _this$props.visible;
448
386
  var _this$state = this.state,
449
- initialHeight = _this$state.initialHeight,
450
- renderState = _this$state.renderState;
451
-
387
+ initialHeight = _this$state.initialHeight,
388
+ renderState = _this$state.renderState;
452
389
  if (this.state.renderState === TRANSITION_STATE.MEASURE) {
453
390
  this.measuringJob.stop();
454
- } // Checking that something changed that wasn't the visibility
455
- // or the initialHeight state or checking if component should be visible but doesn't have a height
456
-
391
+ }
457
392
 
393
+ // Checking that something changed that wasn't the visibility
394
+ // or the initialHeight state or checking if component should be visible but doesn't have a height
458
395
  if (visible === prevProps.visible && initialHeight === prevState.initialHeight && renderState !== TRANSITION_STATE.INIT || initialHeight == null && visible) {
459
396
  this.measureInner();
460
397
  }
461
-
462
398
  if (noAnimation) {
463
399
  if (!prevProps.visible && visible) {
464
400
  (0, _handle.forwardCustom)('onShow')({}, this.props);
@@ -471,7 +407,6 @@ var Transition = /*#__PURE__*/function (_Component) {
471
407
  key: "componentWillUnmount",
472
408
  value: function componentWillUnmount() {
473
409
  this.measuringJob.stop();
474
-
475
410
  if (this.resizeRegistry) {
476
411
  this.resizeRegistry.unregister();
477
412
  }
@@ -480,27 +415,24 @@ var Transition = /*#__PURE__*/function (_Component) {
480
415
  key: "render",
481
416
  value: function render() {
482
417
  var _this$props2 = this.props,
483
- visible = _this$props2.visible,
484
- props = _objectWithoutProperties(_this$props2, _excluded2);
485
-
418
+ visible = _this$props2.visible,
419
+ props = _objectWithoutProperties(_this$props2, _excluded2);
486
420
  delete props.onHide;
487
421
  delete props.onShow;
488
422
  delete props.textSize;
489
-
490
423
  switch (this.state.renderState) {
491
424
  // If we are deferring children, don't render any
492
425
  case TRANSITION_STATE.INIT:
493
426
  return null;
427
+
494
428
  // If we're transitioning to visible but don't have a measurement yet, create the
495
429
  // transition container with its children so we can measure. Measuring will cause a
496
430
  // state change to trigger the animation.
497
-
498
431
  case TRANSITION_STATE.MEASURE:
499
432
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(TransitionBase, _objectSpread(_objectSpread({}, props), {}, {
500
433
  childRef: this.childRef,
501
434
  visible: false
502
435
  }));
503
-
504
436
  case TRANSITION_STATE.READY:
505
437
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(TransitionBase, _objectSpread(_objectSpread({}, props), {}, {
506
438
  childRef: this.childRef,
@@ -522,19 +454,14 @@ var Transition = /*#__PURE__*/function (_Component) {
522
454
  renderState: TRANSITION_STATE.MEASURE
523
455
  };
524
456
  }
525
-
526
457
  return null;
527
458
  }
528
459
  }]);
529
-
530
460
  return Transition;
531
461
  }(_react.Component);
532
-
533
462
  exports.Transition = Transition;
534
463
  Transition.contextType = _Resizable.ResizeContext;
535
- Transition.propTypes =
536
- /** @lends ui/Transition.Transition.prototype */
537
- {
464
+ Transition.propTypes = /** @lends ui/Transition.Transition.prototype */{
538
465
  /**
539
466
  * The node to be transitioned.
540
467
  *
@@ -542,7 +469,6 @@ Transition.propTypes =
542
469
  * @public
543
470
  */
544
471
  children: _propTypes2["default"].node,
545
-
546
472
  /**
547
473
  * The direction of transition (i.e. where the component will move *to*; the destination).
548
474
  *
@@ -553,7 +479,6 @@ Transition.propTypes =
553
479
  * @public
554
480
  */
555
481
  direction: _propTypes2["default"].oneOf(['up', 'right', 'down', 'left']),
556
-
557
482
  /**
558
483
  * Controls how long the transition should take.
559
484
  *
@@ -568,7 +493,6 @@ Transition.propTypes =
568
493
  * @public
569
494
  */
570
495
  duration: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
571
-
572
496
  /**
573
497
  * Disables transition animation.
574
498
  *
@@ -579,7 +503,6 @@ Transition.propTypes =
579
503
  * @public
580
504
  */
581
505
  noAnimation: _propTypes2["default"].bool,
582
-
583
506
  /**
584
507
  * Called after transition for hiding is finished.
585
508
  *
@@ -587,7 +510,6 @@ Transition.propTypes =
587
510
  * @public
588
511
  */
589
512
  onHide: _propTypes2["default"].func,
590
-
591
513
  /**
592
514
  * Called after transition for showing is finished.
593
515
  *
@@ -595,7 +517,6 @@ Transition.propTypes =
595
517
  * @public
596
518
  */
597
519
  onShow: _propTypes2["default"].func,
598
-
599
520
  /**
600
521
  * The transition timing function.
601
522
  * Supported function names are: `ease`, `ease-in`, `ease-out`, `ease-in-out`, `ease-in-quart`,
@@ -606,7 +527,6 @@ Transition.propTypes =
606
527
  * @public
607
528
  */
608
529
  timingFunction: _propTypes2["default"].oneOf(['ease', 'ease-in', 'ease-out', 'ease-in-out', 'ease-in-quart', 'ease-out-quart', 'linear']),
609
-
610
530
  /**
611
531
  * The type of transition to affect the content.
612
532
  *
@@ -633,7 +553,6 @@ Transition.propTypes =
633
553
  * @public
634
554
  */
635
555
  type: _propTypes2["default"].oneOf(['slide', 'clip', 'fade']),
636
-
637
556
  /**
638
557
  * The visibility of the component, which determines whether it's on the screen or off.
639
558
  *