@enact/ui 5.5.0 → 5.5.2
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/CHANGELOG.md +26 -0
- package/Scroller/Scroller.d.ts +2 -2
- package/Scroller/ScrollerBasic.js +33 -14
- package/Scroller/tests/ScrollerBasic-specs.js +187 -14
- package/Transition/Transition.js +207 -190
- package/Transition/Transition.module.css +0 -5
- package/Transition/tests/Transition-specs.js +220 -0
- package/VirtualList/VirtualListBasic.js +119 -26
- package/VirtualList/tests/VirtualList-native-specs.js +219 -3
- package/package.json +7 -12
- package/resolution/ResolutionDecorator.js +2 -1
- package/resolution/index.d.ts +6 -4
- package/resolution/resolution.js +63 -35
- package/resolution/tests/resolution-specs.js +35 -7
- package/useScroll/tests/useScroll-specs.js +175 -6
- package/useScroll/useScroll.js +28 -12
package/Transition/Transition.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports.Transition = Transition;
|
|
7
|
+
exports["default"] = exports.TransitionBase = void 0;
|
|
7
8
|
var _handle = require("@enact/core/handle");
|
|
8
9
|
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
9
10
|
var _kind = _interopRequireDefault(require("@enact/core/kind"));
|
|
@@ -14,18 +15,14 @@ var _Resizable = require("../Resizable");
|
|
|
14
15
|
var _TransitionModule = _interopRequireDefault(require("./Transition.module.css"));
|
|
15
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
17
|
var _excluded = ["css", "childRef", "children", "innerStyle"],
|
|
17
|
-
_excluded2 = ["visible"];
|
|
18
|
+
_excluded2 = ["children", "direction", "duration", "noAnimation", "onHide", "onShow", "timingFunction", "type", "visible"];
|
|
18
19
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
19
|
-
function
|
|
20
|
-
function
|
|
21
|
-
function
|
|
22
|
-
function
|
|
23
|
-
function
|
|
24
|
-
function
|
|
25
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
26
|
-
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
27
|
-
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
28
|
-
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
20
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
21
|
+
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."); }
|
|
22
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
23
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
24
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
25
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
29
26
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
30
27
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
31
28
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -52,6 +49,9 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
52
49
|
var formatter = function formatter(duration) {
|
|
53
50
|
return typeof duration === 'number' ? duration + 'ms' : duration;
|
|
54
51
|
};
|
|
52
|
+
|
|
53
|
+
// Shared empty style object reused when no per-type tweaks are needed.
|
|
54
|
+
var EMPTY_STYLE = {};
|
|
55
55
|
/**
|
|
56
56
|
* The stateless structure of the component.
|
|
57
57
|
*
|
|
@@ -242,14 +242,18 @@ var TransitionBase = exports.TransitionBase = (0, _kind["default"])({
|
|
|
242
242
|
direction = _ref2.direction,
|
|
243
243
|
duration = _ref2.duration,
|
|
244
244
|
type = _ref2.type;
|
|
245
|
-
var style = {};
|
|
246
245
|
if (type === 'clip' && (direction === 'left' || direction === 'right')) {
|
|
247
|
-
|
|
248
|
-
|
|
246
|
+
return {
|
|
247
|
+
width: clipWidth
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
if ((type === 'fade' || type === 'slide') && duration && !css[duration]) {
|
|
249
251
|
// If it's a number, assume it's milliseconds, if not, assume it's already a CSS duration string (like "200ms" or "2s")
|
|
250
|
-
|
|
252
|
+
return {
|
|
253
|
+
transitionDuration: formatter(duration)
|
|
254
|
+
};
|
|
251
255
|
}
|
|
252
|
-
return
|
|
256
|
+
return EMPTY_STYLE;
|
|
253
257
|
},
|
|
254
258
|
style: function style(_ref3) {
|
|
255
259
|
var clipHeight = _ref3.clipHeight,
|
|
@@ -259,20 +263,21 @@ var TransitionBase = exports.TransitionBase = (0, _kind["default"])({
|
|
|
259
263
|
type = _ref3.type,
|
|
260
264
|
visible = _ref3.visible,
|
|
261
265
|
_style = _ref3.style;
|
|
262
|
-
if (type
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
if (duration && !css[duration]) {
|
|
271
|
-
// If it's a number, assume it's milliseconds, if not, assume it's already a CSS duration string (like "200ms" or "2s")
|
|
272
|
-
_style.transitionDuration = formatter(duration);
|
|
273
|
-
}
|
|
266
|
+
if (type !== 'clip') return _style;
|
|
267
|
+
var merged = _style ? _objectSpread(_objectSpread({}, _style), {}, {
|
|
268
|
+
overflow: 'hidden'
|
|
269
|
+
}) : {
|
|
270
|
+
overflow: 'hidden'
|
|
271
|
+
};
|
|
272
|
+
if (visible && (direction === 'up' || direction === 'down')) {
|
|
273
|
+
merged.height = clipHeight;
|
|
274
274
|
}
|
|
275
|
-
|
|
275
|
+
// If duration isn't a known named string, assume it is a CSS duration value
|
|
276
|
+
if (duration && !css[duration]) {
|
|
277
|
+
// If it's a number, assume it's milliseconds, if not, assume it's already a CSS duration string (like "200ms" or "2s")
|
|
278
|
+
merged.transitionDuration = formatter(duration);
|
|
279
|
+
}
|
|
280
|
+
return merged;
|
|
276
281
|
}
|
|
277
282
|
},
|
|
278
283
|
render: function render(_ref4) {
|
|
@@ -311,172 +316,192 @@ var TRANSITION_STATE = {
|
|
|
311
316
|
* A stateful component that allows for applying transitions to its child items via configurable
|
|
312
317
|
* properties and events.
|
|
313
318
|
*
|
|
314
|
-
* @
|
|
319
|
+
* @function Transition
|
|
315
320
|
* @ui
|
|
316
321
|
* @memberof ui/Transition
|
|
317
322
|
* @public
|
|
318
323
|
*/
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
var initialWidth = _this.childNode.scrollWidth;
|
|
356
|
-
if (initialHeight !== _this.state.initialHeight || initialWidth !== _this.state.initialWidth) {
|
|
357
|
-
_this.setState({
|
|
358
|
-
initialHeight: initialHeight,
|
|
359
|
-
initialWidth: initialWidth,
|
|
360
|
-
renderState: TRANSITION_STATE.READY
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
_this.childRef = function (node) {
|
|
366
|
-
_this.childNode = node;
|
|
367
|
-
};
|
|
368
|
-
(0, _util.checkPropTypes)(_this, props);
|
|
369
|
-
_this.state = {
|
|
324
|
+
function Transition(_ref5) {
|
|
325
|
+
var children = _ref5.children,
|
|
326
|
+
_ref5$direction = _ref5.direction,
|
|
327
|
+
direction = _ref5$direction === void 0 ? 'up' : _ref5$direction,
|
|
328
|
+
_ref5$duration = _ref5.duration,
|
|
329
|
+
duration = _ref5$duration === void 0 ? 'medium' : _ref5$duration,
|
|
330
|
+
_ref5$noAnimation = _ref5.noAnimation,
|
|
331
|
+
noAnimation = _ref5$noAnimation === void 0 ? false : _ref5$noAnimation,
|
|
332
|
+
onHide = _ref5.onHide,
|
|
333
|
+
onShow = _ref5.onShow,
|
|
334
|
+
_ref5$timingFunction = _ref5.timingFunction,
|
|
335
|
+
timingFunction = _ref5$timingFunction === void 0 ? 'ease-in-out' : _ref5$timingFunction,
|
|
336
|
+
_ref5$type = _ref5.type,
|
|
337
|
+
type = _ref5$type === void 0 ? 'slide' : _ref5$type,
|
|
338
|
+
_ref5$visible = _ref5.visible,
|
|
339
|
+
visible = _ref5$visible === void 0 ? true : _ref5$visible,
|
|
340
|
+
rest = _objectWithoutProperties(_ref5, _excluded2);
|
|
341
|
+
var _useState = (0, _react.useState)(function () {
|
|
342
|
+
return {
|
|
343
|
+
initialHeight: null,
|
|
344
|
+
initialWidth: null,
|
|
345
|
+
renderState: visible ? TRANSITION_STATE.READY : TRANSITION_STATE.INIT
|
|
346
|
+
};
|
|
347
|
+
}),
|
|
348
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
349
|
+
state = _useState2[0],
|
|
350
|
+
setState = _useState2[1];
|
|
351
|
+
var prevVisibleRef = (0, _react.useRef)(visible);
|
|
352
|
+
|
|
353
|
+
// Adjust state during render when `visible` flips on. The functional equivalent of the
|
|
354
|
+
// class's getDerivedStateFromProps. Reading/writing the ref here is intentional.
|
|
355
|
+
// https://react.dev/reference/react/useState#storing-information-from-previous-renders
|
|
356
|
+
if (!prevVisibleRef.current && visible) {
|
|
357
|
+
// eslint-disable-line react-hooks/refs
|
|
358
|
+
prevVisibleRef.current = true;
|
|
359
|
+
setState({
|
|
370
360
|
initialHeight: null,
|
|
371
361
|
initialWidth: null,
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
};
|
|
375
|
-
_this.resizeRegistry = null;
|
|
376
|
-
return _this;
|
|
362
|
+
renderState: TRANSITION_STATE.MEASURE
|
|
363
|
+
});
|
|
377
364
|
}
|
|
378
|
-
_inherits(Transition, _Component);
|
|
379
|
-
return _createClass(Transition, [{
|
|
380
|
-
key: "componentDidMount",
|
|
381
|
-
value: function componentDidMount() {
|
|
382
|
-
if (!this.props.visible) {
|
|
383
|
-
this.measuringJob.idle();
|
|
384
|
-
} else {
|
|
385
|
-
this.measureInner();
|
|
386
|
-
}
|
|
387
|
-
if (this.context && typeof this.context === 'function') {
|
|
388
|
-
this.resizeRegistry = this.context(this.handleResize);
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}, {
|
|
392
|
-
key: "shouldComponentUpdate",
|
|
393
|
-
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
394
|
-
// Don't update if only updating the height and we're not visible
|
|
395
|
-
return this.state.initialHeight === nextState.initialHeight || this.props.visible || nextProps.visible;
|
|
396
|
-
}
|
|
397
|
-
}, {
|
|
398
|
-
key: "componentDidUpdate",
|
|
399
|
-
value: function componentDidUpdate(prevProps, prevState) {
|
|
400
|
-
var _this$props = this.props,
|
|
401
|
-
noAnimation = _this$props.noAnimation,
|
|
402
|
-
visible = _this$props.visible;
|
|
403
|
-
var _this$state = this.state,
|
|
404
|
-
initialHeight = _this$state.initialHeight,
|
|
405
|
-
renderState = _this$state.renderState;
|
|
406
|
-
(0, _util.checkPropTypes)(this, this.props, prevProps);
|
|
407
|
-
if (this.state.renderState === TRANSITION_STATE.MEASURE) {
|
|
408
|
-
this.measuringJob.stop();
|
|
409
|
-
}
|
|
410
365
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
366
|
+
// Latest props for handlers that fire asynchronously (transitionend, observer callbacks)
|
|
367
|
+
var currentProps = _objectSpread({
|
|
368
|
+
children: children,
|
|
369
|
+
direction: direction,
|
|
370
|
+
duration: duration,
|
|
371
|
+
noAnimation: noAnimation,
|
|
372
|
+
onHide: onHide,
|
|
373
|
+
onShow: onShow,
|
|
374
|
+
timingFunction: timingFunction,
|
|
375
|
+
type: type,
|
|
376
|
+
visible: visible
|
|
377
|
+
}, rest);
|
|
378
|
+
(0, _util.checkPropTypes)(Transition, currentProps);
|
|
379
|
+
var propsRef = (0, _react.useRef)();
|
|
380
|
+
propsRef.current = currentProps; // eslint-disable-line react-hooks/refs
|
|
381
|
+
|
|
382
|
+
var childNodeRef = (0, _react.useRef)(null);
|
|
383
|
+
var measuringJobRef = (0, _react.useRef)(null);
|
|
384
|
+
if (measuringJobRef.current == null) {
|
|
385
|
+
measuringJobRef.current = new _util.Job(function () {
|
|
386
|
+
setState(function (prev) {
|
|
387
|
+
return prev.renderState === TRANSITION_STATE.MEASURE ? prev : _objectSpread(_objectSpread({}, prev), {}, {
|
|
388
|
+
renderState: TRANSITION_STATE.MEASURE
|
|
389
|
+
});
|
|
390
|
+
});
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
var measureInner = (0, _react.useCallback)(function () {
|
|
394
|
+
var node = childNodeRef.current;
|
|
395
|
+
if (!node) return;
|
|
396
|
+
var initialHeight = node.scrollHeight;
|
|
397
|
+
var initialWidth = node.scrollWidth;
|
|
398
|
+
setState(function (prev) {
|
|
399
|
+
if (prev.initialHeight === initialHeight && prev.initialWidth === initialWidth && prev.renderState === TRANSITION_STATE.READY) {
|
|
400
|
+
return prev;
|
|
422
401
|
}
|
|
402
|
+
return {
|
|
403
|
+
initialHeight: initialHeight,
|
|
404
|
+
initialWidth: initialWidth,
|
|
405
|
+
renderState: TRANSITION_STATE.READY
|
|
406
|
+
};
|
|
407
|
+
});
|
|
408
|
+
}, []);
|
|
409
|
+
var childRef = (0, _react.useCallback)(function (node) {
|
|
410
|
+
childNodeRef.current = node;
|
|
411
|
+
}, []);
|
|
412
|
+
|
|
413
|
+
// Measurement effect — covers MEASURE → READY commits and the resize-driven
|
|
414
|
+
// re-measure path (handleResize nulls initialHeight, this re-fires).
|
|
415
|
+
(0, _react.useLayoutEffect)(function () {
|
|
416
|
+
if (state.renderState === TRANSITION_STATE.MEASURE) {
|
|
417
|
+
measuringJobRef.current.stop();
|
|
418
|
+
measureInner();
|
|
419
|
+
} else if (visible && state.initialHeight == null) {
|
|
420
|
+
// Component should be visible but doesn't have a height — measure now.
|
|
421
|
+
measureInner();
|
|
423
422
|
}
|
|
424
|
-
},
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
this.resizeRegistry.unregister();
|
|
430
|
-
}
|
|
423
|
+
}, [state.renderState, state.initialHeight, visible, measureInner]);
|
|
424
|
+
(0, _react.useEffect)(function () {
|
|
425
|
+
var job = measuringJobRef.current;
|
|
426
|
+
if (!propsRef.current.visible) {
|
|
427
|
+
job.idle();
|
|
431
428
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
visible = _this$props2.visible,
|
|
437
|
-
props = _objectWithoutProperties(_this$props2, _excluded2);
|
|
438
|
-
delete props.onHide;
|
|
439
|
-
delete props.onShow;
|
|
440
|
-
delete props.textSize;
|
|
441
|
-
switch (this.state.renderState) {
|
|
442
|
-
// If we are deferring children, don't render any
|
|
443
|
-
case TRANSITION_STATE.INIT:
|
|
444
|
-
return null;
|
|
429
|
+
return function () {
|
|
430
|
+
return job.stop();
|
|
431
|
+
};
|
|
432
|
+
}, []);
|
|
445
433
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
434
|
+
// ResizeContext registration — the context value is itself the register fn.
|
|
435
|
+
var resizeRegister = (0, _react.use)(_Resizable.ResizeContext);
|
|
436
|
+
var handleResize = (0, _react.useCallback)(function () {
|
|
437
|
+
// Null initialHeight so the next layout commit re-measures in a separate tick.
|
|
438
|
+
// the useLayoutEffect above re-runs when state.initialHeight transitions to null.
|
|
439
|
+
setState(function (prev) {
|
|
440
|
+
return prev.initialHeight == null ? prev : _objectSpread(_objectSpread({}, prev), {}, {
|
|
441
|
+
initialHeight: null
|
|
442
|
+
});
|
|
443
|
+
});
|
|
444
|
+
}, []);
|
|
445
|
+
(0, _react.useEffect)(function () {
|
|
446
|
+
if (typeof resizeRegister !== 'function') return;
|
|
447
|
+
var registry = resizeRegister(handleResize);
|
|
448
|
+
return function () {
|
|
449
|
+
if (registry) registry.unregister();
|
|
450
|
+
};
|
|
451
|
+
}, [resizeRegister, handleResize]);
|
|
452
|
+
var prevVisibleForEffectRef = (0, _react.useRef)(visible);
|
|
453
|
+
(0, _react.useEffect)(function () {
|
|
454
|
+
var prev = prevVisibleForEffectRef.current;
|
|
455
|
+
prevVisibleForEffectRef.current = visible;
|
|
456
|
+
if (!noAnimation || prev === visible) return;
|
|
457
|
+
if (!prev && visible) {
|
|
458
|
+
(0, _handle.forwardCustom)('onShow')(null, propsRef.current);
|
|
459
|
+
} else if (prev && !visible) {
|
|
460
|
+
(0, _handle.forwardCustom)('onHide')(null, propsRef.current);
|
|
463
461
|
}
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
|
-
return null;
|
|
462
|
+
}, [visible, noAnimation]);
|
|
463
|
+
var handleTransitionEnd = (0, _react.useCallback)(function (ev) {
|
|
464
|
+
(0, _handle.forward)('onTransitionEnd', ev, propsRef.current);
|
|
465
|
+
if (ev.target === childNodeRef.current) {
|
|
466
|
+
var eventName = propsRef.current.visible ? 'onShow' : 'onHide';
|
|
467
|
+
(0, _handle.forward)(eventName, {
|
|
468
|
+
type: eventName,
|
|
469
|
+
currentTarget: ev.currentTarget
|
|
470
|
+
}, propsRef.current);
|
|
476
471
|
}
|
|
477
|
-
}]);
|
|
478
|
-
|
|
479
|
-
|
|
472
|
+
}, []);
|
|
473
|
+
|
|
474
|
+
// If we are deferring children, don't render any.
|
|
475
|
+
if (state.renderState === TRANSITION_STATE.INIT) {
|
|
476
|
+
return null;
|
|
477
|
+
}
|
|
478
|
+
var childProps = _objectSpread(_objectSpread({}, rest), {}, {
|
|
479
|
+
children: children,
|
|
480
|
+
direction: direction,
|
|
481
|
+
duration: duration,
|
|
482
|
+
noAnimation: noAnimation,
|
|
483
|
+
timingFunction: timingFunction,
|
|
484
|
+
type: type
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
// If we're transitioning to visible but don't have a measurement yet, create
|
|
488
|
+
// the transition container with its children so we can measure. Measuring
|
|
489
|
+
// will cause a state change to trigger the animation.
|
|
490
|
+
if (state.renderState === TRANSITION_STATE.MEASURE) {
|
|
491
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TransitionBase, _objectSpread(_objectSpread({}, childProps), {}, {
|
|
492
|
+
childRef: childRef,
|
|
493
|
+
visible: false
|
|
494
|
+
}));
|
|
495
|
+
}
|
|
496
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TransitionBase, _objectSpread(_objectSpread({}, childProps), {}, {
|
|
497
|
+
childRef: childRef,
|
|
498
|
+
visible: visible,
|
|
499
|
+
clipHeight: state.initialHeight,
|
|
500
|
+
clipWidth: state.initialWidth,
|
|
501
|
+
onTransitionEnd: handleTransitionEnd
|
|
502
|
+
}));
|
|
503
|
+
}
|
|
504
|
+
Transition.displayName = 'Transition';
|
|
480
505
|
Transition.propTypes = /** @lends ui/Transition.Transition.prototype */{
|
|
481
506
|
/**
|
|
482
507
|
* The node to be transitioned.
|
|
@@ -578,12 +603,4 @@ Transition.propTypes = /** @lends ui/Transition.Transition.prototype */{
|
|
|
578
603
|
*/
|
|
579
604
|
visible: _propTypes2["default"].bool
|
|
580
605
|
};
|
|
581
|
-
Transition.defaultProps = {
|
|
582
|
-
direction: 'up',
|
|
583
|
-
duration: 'medium',
|
|
584
|
-
noAnimation: false,
|
|
585
|
-
timingFunction: 'ease-in-out',
|
|
586
|
-
type: 'slide',
|
|
587
|
-
visible: true
|
|
588
|
-
};
|
|
589
606
|
var _default = exports["default"] = Transition;
|
|
@@ -6,11 +6,9 @@
|
|
|
6
6
|
}
|
|
7
7
|
.transition.slide .inner {
|
|
8
8
|
transition-property: transform;
|
|
9
|
-
will-change: transform;
|
|
10
9
|
}
|
|
11
10
|
.transition.fade .inner {
|
|
12
11
|
transition-property: opacity;
|
|
13
|
-
will-change: opacity;
|
|
14
12
|
}
|
|
15
13
|
.transition.shown.slide .inner {
|
|
16
14
|
transform: translate3d(0, 0, 0);
|
|
@@ -51,12 +49,10 @@
|
|
|
51
49
|
.transition.clip.up,
|
|
52
50
|
.transition.clip.down {
|
|
53
51
|
transition-property: height;
|
|
54
|
-
will-change: height;
|
|
55
52
|
}
|
|
56
53
|
.transition.clip.right,
|
|
57
54
|
.transition.clip.left {
|
|
58
55
|
transition-property: max-width;
|
|
59
|
-
will-change: max-width;
|
|
60
56
|
}
|
|
61
57
|
.transition.clip.right .inner,
|
|
62
58
|
.transition.clip.left .inner {
|
|
@@ -67,7 +63,6 @@
|
|
|
67
63
|
}
|
|
68
64
|
.transition.clip.down .inner {
|
|
69
65
|
transition-property: transform;
|
|
70
|
-
will-change: transform;
|
|
71
66
|
}
|
|
72
67
|
.transition.clip.down.shown .inner {
|
|
73
68
|
transform: translate(0, 0);
|