mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
42 lines
1.5 KiB
JavaScript
42 lines
1.5 KiB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
var _excluded = ["className", "children"];
|
|
|
|
var _fadeStyles;
|
|
|
|
import classNames from 'classnames';
|
|
import React, { useCallback } from 'react';
|
|
import Transition, { ENTERED, ENTERING } from 'react-transition-group/Transition';
|
|
import transitionEndListener from './transitionEndListener';
|
|
import triggerBrowserReflow from './triggerBrowserReflow';
|
|
var defaultProps = {
|
|
in: false,
|
|
timeout: 300,
|
|
mountOnEnter: false,
|
|
unmountOnExit: false,
|
|
appear: false
|
|
};
|
|
var fadeStyles = (_fadeStyles = {}, _fadeStyles[ENTERING] = 'show', _fadeStyles[ENTERED] = 'show', _fadeStyles);
|
|
var Fade = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
var className = _ref.className,
|
|
children = _ref.children,
|
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
|
|
var handleEnter = useCallback(function (node) {
|
|
triggerBrowserReflow(node);
|
|
if (props.onEnter) props.onEnter(node);
|
|
}, [props]);
|
|
return /*#__PURE__*/React.createElement(Transition, _extends({
|
|
ref: ref,
|
|
addEndListener: transitionEndListener
|
|
}, props, {
|
|
onEnter: handleEnter
|
|
}), function (status, innerProps) {
|
|
return /*#__PURE__*/React.cloneElement(children, _extends({}, innerProps, {
|
|
className: classNames('fade', className, children.props.className, fadeStyles[status])
|
|
}));
|
|
});
|
|
});
|
|
Fade.defaultProps = defaultProps;
|
|
Fade.displayName = 'Fade';
|
|
export default Fade; |