mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 17:35:16 +00:00
61 lines
3.0 KiB
JavaScript
61 lines
3.0 KiB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
|
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
|
|
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import classNames from 'classnames';
|
|
import { Transition } from 'react-transition-group';
|
|
import { mapToCssModules, omit, pick, TransitionPropTypeKeys, TransitionTimeouts, tagPropType } from './utils';
|
|
|
|
var propTypes = _objectSpread(_objectSpread({}, Transition.propTypes), {}, {
|
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
|
tag: tagPropType,
|
|
baseClass: PropTypes.string,
|
|
baseClassActive: PropTypes.string,
|
|
className: PropTypes.string,
|
|
cssModule: PropTypes.object,
|
|
innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.string, PropTypes.func])
|
|
});
|
|
|
|
var defaultProps = _objectSpread(_objectSpread({}, Transition.defaultProps), {}, {
|
|
tag: 'div',
|
|
baseClass: 'fade',
|
|
baseClassActive: 'show',
|
|
timeout: TransitionTimeouts.Fade,
|
|
appear: true,
|
|
enter: true,
|
|
exit: true,
|
|
in: true
|
|
});
|
|
|
|
function Fade(props) {
|
|
var Tag = props.tag,
|
|
baseClass = props.baseClass,
|
|
baseClassActive = props.baseClassActive,
|
|
className = props.className,
|
|
cssModule = props.cssModule,
|
|
children = props.children,
|
|
innerRef = props.innerRef,
|
|
otherProps = _objectWithoutPropertiesLoose(props, ["tag", "baseClass", "baseClassActive", "className", "cssModule", "children", "innerRef"]);
|
|
|
|
var transitionProps = pick(otherProps, TransitionPropTypeKeys);
|
|
var childProps = omit(otherProps, TransitionPropTypeKeys);
|
|
return /*#__PURE__*/React.createElement(Transition, transitionProps, function (status) {
|
|
var isActive = status === 'entered';
|
|
var classes = mapToCssModules(classNames(className, baseClass, isActive && baseClassActive), cssModule);
|
|
return /*#__PURE__*/React.createElement(Tag, _extends({
|
|
className: classes
|
|
}, childProps, {
|
|
ref: innerRef
|
|
}), children);
|
|
});
|
|
}
|
|
|
|
Fade.propTypes = propTypes;
|
|
Fade.defaultProps = defaultProps;
|
|
export default Fade; |