@animxyz/react
Advanced tools
Comparing version 0.1.2 to 0.2.0-alpha.0
@@ -6,4 +6,12 @@ # Change Log | ||
# [0.2.0-alpha.0](https://github.com/ingram-projects/animxyz/compare/v0.1.2...v0.2.0-alpha.0) (2020-12-29) | ||
**Note:** Version bump only for package @animxyz/react | ||
## [0.1.2](https://github.com/ingram-projects/animxyz/compare/v0.1.1...v0.1.2) (2020-12-29) | ||
**Note:** Version bump only for package @animxyz/react |
/** | ||
* ReactAnimXyz v0.1.1 | ||
* ReactAnimXyz v0.1.2 | ||
* Copyright (c) 2020-present Ingram Projects | ||
@@ -14,4 +14,4 @@ * Released under the MIT License. | ||
var PropTypes = require('prop-types'); | ||
var clsx = require('clsx'); | ||
var reactTransitionGroup = require('react-transition-group'); | ||
var clsx = require('clsx'); | ||
@@ -57,15 +57,19 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var xyzTransitionClasses = { | ||
appearFrom: 'xyz-appear-from', | ||
appearActive: 'xyz-appear', | ||
appearTo: 'xyz-appear-to', | ||
inFrom: 'xyz-in-from', | ||
inActive: 'xyz-in', | ||
inTo: 'xyz-in-to', | ||
outFrom: 'xyz-out-from', | ||
outActive: 'xyz-out', | ||
outTo: 'xyz-out-to' | ||
}; | ||
function getXyzDurationForMode (mode, duration) { | ||
switch (typeof duration) { | ||
case 'number': | ||
return duration; | ||
function getXyzElementMode(el) { | ||
case 'string': | ||
return duration; | ||
case 'object': | ||
if (duration === null) return null; | ||
return duration[mode]; | ||
} | ||
return null; | ||
} | ||
function getXyzElementMode (el) { | ||
if (el.classList.contains('xyz-appear')) { | ||
@@ -86,21 +90,2 @@ return 'appear'; | ||
function getXyzTimeoutForMode(mode, timeout) { | ||
if (typeof timeout !== 'object' || timeout === null) { | ||
return timeout; | ||
} | ||
switch (mode) { | ||
case 'appear': | ||
return timeout.appear; | ||
case 'in': | ||
return timeout.enter; | ||
case 'out': | ||
return timeout.exit; | ||
} | ||
return null; | ||
} | ||
function clearXyzElementProperties(el) { | ||
@@ -114,44 +99,57 @@ clearTimeout(el.xyzAnimTimeout); | ||
function getXyzAnimationHook(timeout) { | ||
return function (el, done) { | ||
function getXyzAnimationHook (duration) { | ||
return (el, done) => { | ||
clearXyzElementProperties(el); | ||
function xyzAnimDone() { | ||
clearXyzElementProperties(el); | ||
done(); | ||
clearXyzElementProperties(el); | ||
} | ||
var mode = getXyzElementMode(el); | ||
var modeTimeout = getXyzTimeoutForMode(mode, timeout); | ||
const mode = getXyzElementMode(el); | ||
const modeDuration = getXyzDurationForMode(mode, duration); | ||
if (typeof modeTimeout === 'number') { | ||
el.xyzAnimTimeout = setTimeout(xyzAnimDone, modeTimeout); | ||
if (typeof modeDuration === 'number') { | ||
el.xyzAnimTimeout = setTimeout(xyzAnimDone, modeDuration); | ||
return; | ||
} | ||
var xyzModeKeyframes = "xyz-" + mode + "-keyframes"; | ||
var xyzEls = [el]; | ||
const xyzModeKeyframes = "xyz-".concat(mode, "-keyframes"); | ||
const xyzEls = new Set([el]); | ||
if (modeTimeout === 'auto') { | ||
var xyzNestedEls = el.querySelectorAll((".xyz-nested, .xyz-" + mode + "-nested")); | ||
xyzEls.push.apply(xyzEls, Array.from(xyzNestedEls)); | ||
if (modeDuration === 'auto') { | ||
const xyzNestedEls = el.querySelectorAll(".xyz-nested, .xyz-".concat(mode, "-nested")); | ||
xyzNestedEls.forEach(xyzEls.add, xyzEls); | ||
} | ||
var xyzActiveEls = xyzEls.filter(function (xyzEl) { | ||
// If element is invisible | ||
if (xyzEl.offsetParent === null) { return false; } // If element isn't animating | ||
function removeXyzEl(xyzEl) { | ||
xyzEls.delete(xyzEl); | ||
var animationName = window.getComputedStyle(xyzEl).getPropertyValue('animation-name'); | ||
if (animationName.indexOf(xyzModeKeyframes) === -1) { return false; } | ||
return true; | ||
if (xyzEls.size === 0) { | ||
xyzAnimDone(); | ||
} | ||
} // After one tick remove any elements that are dont have active animations | ||
el.xyzAnimTimeout = setTimeout(() => { | ||
xyzEls.forEach(xyzEl => { | ||
// Remove if element isnt visible | ||
const visible = xyzEl.offsetParent || xyzEl.getClientRects().length; | ||
if (!visible) { | ||
removeXyzEl(xyzEl); | ||
} // Remove if element has xyz animation overridden | ||
const animationName = window.getComputedStyle(xyzEl).getPropertyValue('animation-name'); | ||
if (animationName.indexOf(xyzModeKeyframes) === -1) { | ||
removeXyzEl(xyzEl); | ||
} | ||
}); | ||
}); | ||
var xyzActiveElsSet = new Set(xyzActiveEls); | ||
el.xyzAnimEnd = function (event) { | ||
el.xyzAnimEnd = event => { | ||
if (event.animationName === xyzModeKeyframes) { | ||
xyzActiveElsSet.delete(event.target); | ||
if (xyzActiveElsSet.size === 0) { | ||
xyzAnimDone(); | ||
} | ||
removeXyzEl(event.target); | ||
} | ||
@@ -165,22 +163,36 @@ }; | ||
var xyzTransitionClasses = { | ||
appearFrom: 'xyz-appear-from', | ||
appearActive: 'xyz-appear', | ||
appearTo: 'xyz-appear-to', | ||
inFrom: 'xyz-in-from', | ||
inActive: 'xyz-in', | ||
inTo: 'xyz-in-to', | ||
outFrom: 'xyz-out-from', | ||
outActive: 'xyz-out', | ||
outTo: 'xyz-out-to' | ||
}; | ||
function getXyzTransitionProps(props) { | ||
var ref = props || {}; | ||
var timeout = ref.timeout; | ||
var classNames = { | ||
appear: xyzTransitionClasses.appearFrom, | ||
appearActive: xyzTransitionClasses.appearActive, | ||
appearDone: xyzTransitionClasses.appearTo, | ||
enter: xyzTransitionClasses.inFrom, | ||
enterActive: xyzTransitionClasses.inActive, | ||
enterDone: xyzTransitionClasses.inTo, | ||
exit: xyzTransitionClasses.outFrom, | ||
exitActive: xyzTransitionClasses.outActive, | ||
exitDone: xyzTransitionClasses.outTo | ||
const { | ||
duration | ||
} = props || {}; | ||
const transitionProps = { | ||
classNames: { | ||
appear: xyzTransitionClasses.appearFrom, | ||
appearActive: xyzTransitionClasses.appearActive, | ||
appearDone: xyzTransitionClasses.appearTo, | ||
enter: xyzTransitionClasses.inFrom, | ||
enterActive: xyzTransitionClasses.inActive, | ||
enterDone: xyzTransitionClasses.inTo, | ||
exit: xyzTransitionClasses.outFrom, | ||
exitActive: xyzTransitionClasses.outActive, | ||
exitDone: xyzTransitionClasses.outTo | ||
}, | ||
addEndListener: getXyzAnimationHook(duration) | ||
}; | ||
var addEndListener = getXyzAnimationHook(timeout); | ||
var mergedProps = Object.assign({}, props, { | ||
classNames: Object.assign({}, classNames, props.classNames), | ||
addEndListener: addEndListener | ||
const mergedProps = Object.assign({}, props, transitionProps, { | ||
classNames: Object.assign({}, props.classNames, transitionProps.classNames) | ||
}); | ||
delete mergedProps.timeout; | ||
delete mergedProps.duration; | ||
return mergedProps; | ||
@@ -190,8 +202,12 @@ } | ||
function XyzTransition(props) { | ||
var xyz = props.xyz; | ||
var children = props.children; | ||
var rest = _objectWithoutPropertiesLoose(props, ["xyz", "children"]); | ||
const { | ||
xyz, | ||
className, | ||
style, | ||
children | ||
} = props, | ||
rest = _objectWithoutPropertiesLoose(props, ["xyz", "className", "style", "children"]); | ||
var xyzTransitionProps = getXyzTransitionProps(rest); | ||
var childArray = React.Children.toArray(children).filter(Boolean); | ||
const xyzTransitionProps = getXyzTransitionProps(rest); | ||
const childArray = React.Children.toArray(children).filter(React.isValidElement); | ||
@@ -202,6 +218,9 @@ if (childArray.length !== 1) { | ||
var child = childArray[0]; | ||
const child = childArray[0]; | ||
return /*#__PURE__*/React__default['default'].createElement(reactTransitionGroup.CSSTransition, xyzTransitionProps, React.cloneElement(child, Object.assign({ | ||
xyz: xyz | ||
}, child.props))); | ||
xyz | ||
}, child.props, { | ||
className: clsx__default['default'](className, child.props.className), | ||
style: Object.assign({}, style, child.props.style) | ||
}))); | ||
} | ||
@@ -211,23 +230,30 @@ | ||
xyz: PropTypes__default['default'].string, | ||
timeout: PropTypes__default['default'].oneOfType([PropTypes__default['default'].number, PropTypes__default['default'].oneOf(['auto']), PropTypes__default['default'].shape({ | ||
duration: PropTypes__default['default'].oneOfType([PropTypes__default['default'].number, PropTypes__default['default'].oneOf(['auto']), PropTypes__default['default'].shape({ | ||
appear: PropTypes__default['default'].oneOfType([PropTypes__default['default'].number, PropTypes__default['default'].oneOf(['auto'])]), | ||
enter: PropTypes__default['default'].oneOfType([PropTypes__default['default'].number, PropTypes__default['default'].oneOf(['auto'])]), | ||
exit: PropTypes__default['default'].oneOfType([PropTypes__default['default'].number, PropTypes__default['default'].oneOf(['auto'])]) | ||
in: PropTypes__default['default'].oneOfType([PropTypes__default['default'].number, PropTypes__default['default'].oneOf(['auto'])]), | ||
out: PropTypes__default['default'].oneOfType([PropTypes__default['default'].number, PropTypes__default['default'].oneOf(['auto'])]) | ||
})]), | ||
children: PropTypes__default['default'].node | ||
}); | ||
delete XyzTransition.propTypes.timeout; | ||
function XyzTransitionGroup(props) { | ||
var xyz = props.xyz; | ||
var component = props.component; | ||
var childFactory = props.childFactory; | ||
var children = props.children; | ||
var rest = _objectWithoutPropertiesLoose(props, ["xyz", "component", "childFactory", "children"]); | ||
const { | ||
xyz, | ||
component = 'div', | ||
childFactory, | ||
className, | ||
style, | ||
children | ||
} = props, | ||
rest = _objectWithoutPropertiesLoose(props, ["xyz", "component", "childFactory", "className", "style", "children"]); | ||
var childArray = React.Children.toArray(children).filter(Boolean); | ||
const childArray = React.Children.toArray(children).filter(React.isValidElement); | ||
return /*#__PURE__*/React__default['default'].createElement(reactTransitionGroup.TransitionGroup, { | ||
component: component, | ||
xyz: xyz, | ||
component: component, | ||
className: className, | ||
style: style, | ||
childFactory: childFactory | ||
}, childArray.map(function (child, index) { return React__default['default'].createElement(XyzTransition, _extends({}, rest, { | ||
}, childArray.map((child, index) => /*#__PURE__*/React__default['default'].createElement(XyzTransition, _extends({}, rest, { | ||
key: child.key | ||
@@ -238,4 +264,4 @@ }), React.cloneElement(child, { | ||
'--xyz-index-rev': childArray.length - index - 1 | ||
}, child.style) | ||
})); })); | ||
}, child.props.style) | ||
})))); | ||
} | ||
@@ -246,7 +272,9 @@ | ||
function XyzTransitionSwitch(props) { | ||
var mode = props.mode; | ||
var children = props.children; | ||
var rest = _objectWithoutPropertiesLoose(props, ["mode", "children"]); | ||
const { | ||
mode, | ||
children | ||
} = props, | ||
rest = _objectWithoutPropertiesLoose(props, ["mode", "children"]); | ||
var childArray = React.Children.toArray(children).filter(Boolean); | ||
const childArray = React.Children.toArray(children).filter(React.isValidElement); | ||
@@ -257,3 +285,3 @@ if (childArray.length !== 1) { | ||
var child = childArray[0]; | ||
const child = childArray[0]; | ||
return /*#__PURE__*/React__default['default'].createElement(reactTransitionGroup.SwitchTransition, { | ||
@@ -260,0 +288,0 @@ mode: mode |
/** | ||
* ReactAnimXyz v0.1.1 | ||
* ReactAnimXyz v0.1.2 | ||
* Copyright (c) 2020-present Ingram Projects | ||
@@ -8,6 +8,7 @@ * Released under the MIT License. | ||
import React, { Children, cloneElement } from 'react'; | ||
import React, { Children, isValidElement, cloneElement } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import clsx from 'clsx'; | ||
export { default as xyz } from 'clsx'; | ||
import { CSSTransition, TransitionGroup, SwitchTransition } from 'react-transition-group'; | ||
export { default as xyz } from 'clsx'; | ||
@@ -47,15 +48,19 @@ function _extends() { | ||
var xyzTransitionClasses = { | ||
appearFrom: 'xyz-appear-from', | ||
appearActive: 'xyz-appear', | ||
appearTo: 'xyz-appear-to', | ||
inFrom: 'xyz-in-from', | ||
inActive: 'xyz-in', | ||
inTo: 'xyz-in-to', | ||
outFrom: 'xyz-out-from', | ||
outActive: 'xyz-out', | ||
outTo: 'xyz-out-to' | ||
}; | ||
function getXyzDurationForMode (mode, duration) { | ||
switch (typeof duration) { | ||
case 'number': | ||
return duration; | ||
function getXyzElementMode(el) { | ||
case 'string': | ||
return duration; | ||
case 'object': | ||
if (duration === null) return null; | ||
return duration[mode]; | ||
} | ||
return null; | ||
} | ||
function getXyzElementMode (el) { | ||
if (el.classList.contains('xyz-appear')) { | ||
@@ -76,21 +81,2 @@ return 'appear'; | ||
function getXyzTimeoutForMode(mode, timeout) { | ||
if (typeof timeout !== 'object' || timeout === null) { | ||
return timeout; | ||
} | ||
switch (mode) { | ||
case 'appear': | ||
return timeout.appear; | ||
case 'in': | ||
return timeout.enter; | ||
case 'out': | ||
return timeout.exit; | ||
} | ||
return null; | ||
} | ||
function clearXyzElementProperties(el) { | ||
@@ -104,44 +90,57 @@ clearTimeout(el.xyzAnimTimeout); | ||
function getXyzAnimationHook(timeout) { | ||
return function (el, done) { | ||
function getXyzAnimationHook (duration) { | ||
return (el, done) => { | ||
clearXyzElementProperties(el); | ||
function xyzAnimDone() { | ||
clearXyzElementProperties(el); | ||
done(); | ||
clearXyzElementProperties(el); | ||
} | ||
var mode = getXyzElementMode(el); | ||
var modeTimeout = getXyzTimeoutForMode(mode, timeout); | ||
const mode = getXyzElementMode(el); | ||
const modeDuration = getXyzDurationForMode(mode, duration); | ||
if (typeof modeTimeout === 'number') { | ||
el.xyzAnimTimeout = setTimeout(xyzAnimDone, modeTimeout); | ||
if (typeof modeDuration === 'number') { | ||
el.xyzAnimTimeout = setTimeout(xyzAnimDone, modeDuration); | ||
return; | ||
} | ||
var xyzModeKeyframes = "xyz-" + mode + "-keyframes"; | ||
var xyzEls = [el]; | ||
const xyzModeKeyframes = "xyz-".concat(mode, "-keyframes"); | ||
const xyzEls = new Set([el]); | ||
if (modeTimeout === 'auto') { | ||
var xyzNestedEls = el.querySelectorAll((".xyz-nested, .xyz-" + mode + "-nested")); | ||
xyzEls.push.apply(xyzEls, Array.from(xyzNestedEls)); | ||
if (modeDuration === 'auto') { | ||
const xyzNestedEls = el.querySelectorAll(".xyz-nested, .xyz-".concat(mode, "-nested")); | ||
xyzNestedEls.forEach(xyzEls.add, xyzEls); | ||
} | ||
var xyzActiveEls = xyzEls.filter(function (xyzEl) { | ||
// If element is invisible | ||
if (xyzEl.offsetParent === null) { return false; } // If element isn't animating | ||
function removeXyzEl(xyzEl) { | ||
xyzEls.delete(xyzEl); | ||
var animationName = window.getComputedStyle(xyzEl).getPropertyValue('animation-name'); | ||
if (animationName.indexOf(xyzModeKeyframes) === -1) { return false; } | ||
return true; | ||
if (xyzEls.size === 0) { | ||
xyzAnimDone(); | ||
} | ||
} // After one tick remove any elements that are dont have active animations | ||
el.xyzAnimTimeout = setTimeout(() => { | ||
xyzEls.forEach(xyzEl => { | ||
// Remove if element isnt visible | ||
const visible = xyzEl.offsetParent || xyzEl.getClientRects().length; | ||
if (!visible) { | ||
removeXyzEl(xyzEl); | ||
} // Remove if element has xyz animation overridden | ||
const animationName = window.getComputedStyle(xyzEl).getPropertyValue('animation-name'); | ||
if (animationName.indexOf(xyzModeKeyframes) === -1) { | ||
removeXyzEl(xyzEl); | ||
} | ||
}); | ||
}); | ||
var xyzActiveElsSet = new Set(xyzActiveEls); | ||
el.xyzAnimEnd = function (event) { | ||
el.xyzAnimEnd = event => { | ||
if (event.animationName === xyzModeKeyframes) { | ||
xyzActiveElsSet.delete(event.target); | ||
if (xyzActiveElsSet.size === 0) { | ||
xyzAnimDone(); | ||
} | ||
removeXyzEl(event.target); | ||
} | ||
@@ -155,22 +154,36 @@ }; | ||
var xyzTransitionClasses = { | ||
appearFrom: 'xyz-appear-from', | ||
appearActive: 'xyz-appear', | ||
appearTo: 'xyz-appear-to', | ||
inFrom: 'xyz-in-from', | ||
inActive: 'xyz-in', | ||
inTo: 'xyz-in-to', | ||
outFrom: 'xyz-out-from', | ||
outActive: 'xyz-out', | ||
outTo: 'xyz-out-to' | ||
}; | ||
function getXyzTransitionProps(props) { | ||
var ref = props || {}; | ||
var timeout = ref.timeout; | ||
var classNames = { | ||
appear: xyzTransitionClasses.appearFrom, | ||
appearActive: xyzTransitionClasses.appearActive, | ||
appearDone: xyzTransitionClasses.appearTo, | ||
enter: xyzTransitionClasses.inFrom, | ||
enterActive: xyzTransitionClasses.inActive, | ||
enterDone: xyzTransitionClasses.inTo, | ||
exit: xyzTransitionClasses.outFrom, | ||
exitActive: xyzTransitionClasses.outActive, | ||
exitDone: xyzTransitionClasses.outTo | ||
const { | ||
duration | ||
} = props || {}; | ||
const transitionProps = { | ||
classNames: { | ||
appear: xyzTransitionClasses.appearFrom, | ||
appearActive: xyzTransitionClasses.appearActive, | ||
appearDone: xyzTransitionClasses.appearTo, | ||
enter: xyzTransitionClasses.inFrom, | ||
enterActive: xyzTransitionClasses.inActive, | ||
enterDone: xyzTransitionClasses.inTo, | ||
exit: xyzTransitionClasses.outFrom, | ||
exitActive: xyzTransitionClasses.outActive, | ||
exitDone: xyzTransitionClasses.outTo | ||
}, | ||
addEndListener: getXyzAnimationHook(duration) | ||
}; | ||
var addEndListener = getXyzAnimationHook(timeout); | ||
var mergedProps = Object.assign({}, props, { | ||
classNames: Object.assign({}, classNames, props.classNames), | ||
addEndListener: addEndListener | ||
const mergedProps = Object.assign({}, props, transitionProps, { | ||
classNames: Object.assign({}, props.classNames, transitionProps.classNames) | ||
}); | ||
delete mergedProps.timeout; | ||
delete mergedProps.duration; | ||
return mergedProps; | ||
@@ -180,8 +193,12 @@ } | ||
function XyzTransition(props) { | ||
var xyz = props.xyz; | ||
var children = props.children; | ||
var rest = _objectWithoutPropertiesLoose(props, ["xyz", "children"]); | ||
const { | ||
xyz, | ||
className, | ||
style, | ||
children | ||
} = props, | ||
rest = _objectWithoutPropertiesLoose(props, ["xyz", "className", "style", "children"]); | ||
var xyzTransitionProps = getXyzTransitionProps(rest); | ||
var childArray = Children.toArray(children).filter(Boolean); | ||
const xyzTransitionProps = getXyzTransitionProps(rest); | ||
const childArray = Children.toArray(children).filter(isValidElement); | ||
@@ -192,6 +209,9 @@ if (childArray.length !== 1) { | ||
var child = childArray[0]; | ||
const child = childArray[0]; | ||
return /*#__PURE__*/React.createElement(CSSTransition, xyzTransitionProps, cloneElement(child, Object.assign({ | ||
xyz: xyz | ||
}, child.props))); | ||
xyz | ||
}, child.props, { | ||
className: clsx(className, child.props.className), | ||
style: Object.assign({}, style, child.props.style) | ||
}))); | ||
} | ||
@@ -201,23 +221,30 @@ | ||
xyz: PropTypes.string, | ||
timeout: PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf(['auto']), PropTypes.shape({ | ||
duration: PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf(['auto']), PropTypes.shape({ | ||
appear: PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf(['auto'])]), | ||
enter: PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf(['auto'])]), | ||
exit: PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf(['auto'])]) | ||
in: PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf(['auto'])]), | ||
out: PropTypes.oneOfType([PropTypes.number, PropTypes.oneOf(['auto'])]) | ||
})]), | ||
children: PropTypes.node | ||
}); | ||
delete XyzTransition.propTypes.timeout; | ||
function XyzTransitionGroup(props) { | ||
var xyz = props.xyz; | ||
var component = props.component; | ||
var childFactory = props.childFactory; | ||
var children = props.children; | ||
var rest = _objectWithoutPropertiesLoose(props, ["xyz", "component", "childFactory", "children"]); | ||
const { | ||
xyz, | ||
component = 'div', | ||
childFactory, | ||
className, | ||
style, | ||
children | ||
} = props, | ||
rest = _objectWithoutPropertiesLoose(props, ["xyz", "component", "childFactory", "className", "style", "children"]); | ||
var childArray = Children.toArray(children).filter(Boolean); | ||
const childArray = Children.toArray(children).filter(isValidElement); | ||
return /*#__PURE__*/React.createElement(TransitionGroup, { | ||
component: component, | ||
xyz: xyz, | ||
component: component, | ||
className: className, | ||
style: style, | ||
childFactory: childFactory | ||
}, childArray.map(function (child, index) { return React.createElement(XyzTransition, _extends({}, rest, { | ||
}, childArray.map((child, index) => /*#__PURE__*/React.createElement(XyzTransition, _extends({}, rest, { | ||
key: child.key | ||
@@ -228,4 +255,4 @@ }), cloneElement(child, { | ||
'--xyz-index-rev': childArray.length - index - 1 | ||
}, child.style) | ||
})); })); | ||
}, child.props.style) | ||
})))); | ||
} | ||
@@ -236,7 +263,9 @@ | ||
function XyzTransitionSwitch(props) { | ||
var mode = props.mode; | ||
var children = props.children; | ||
var rest = _objectWithoutPropertiesLoose(props, ["mode", "children"]); | ||
const { | ||
mode, | ||
children | ||
} = props, | ||
rest = _objectWithoutPropertiesLoose(props, ["mode", "children"]); | ||
var childArray = Children.toArray(children).filter(Boolean); | ||
const childArray = Children.toArray(children).filter(isValidElement); | ||
@@ -247,3 +276,3 @@ if (childArray.length !== 1) { | ||
var child = childArray[0]; | ||
const child = childArray[0]; | ||
return /*#__PURE__*/React.createElement(SwitchTransition, { | ||
@@ -250,0 +279,0 @@ mode: mode |
/** | ||
* ReactAnimXyz v0.1.1 | ||
* ReactAnimXyz v0.1.2 | ||
* Copyright (c) 2020-present Ingram Projects | ||
@@ -9,3 +9,3 @@ * Released under the MIT License. | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("prop-types"),require("react-transition-group"),require("clsx")):"function"==typeof define&&define.amd?define(["exports","prop-types","react-transition-group","clsx"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactAnimXyz={},e.PropTypes,e.reactTransitionGroup,e.clsx)}(this,(function(e,t,r,n){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=o(t),u=o(n);function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function c(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}function f(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}var l=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable;function y(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var d=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(e){n[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,n,o=y(e),i=1;i<arguments.length;i++){for(var u in r=Object(arguments[i]))s.call(r,u)&&(o[u]=r[u]);if(l){n=l(r);for(var a=0;a<n.length;a++)p.call(r,n[a])&&(o[n[a]]=r[n[a]])}}return o},m=f((function(e,t){var r=60103,n=60106;t.Fragment=60107,t.StrictMode=60108,t.Profiler=60114;var o=60109,i=60110,u=60112;t.Suspense=60113;var a=60115,c=60116;if("function"==typeof Symbol&&Symbol.for){var f=Symbol.for;r=f("react.element"),n=f("react.portal"),t.Fragment=f("react.fragment"),t.StrictMode=f("react.strict_mode"),t.Profiler=f("react.profiler"),o=f("react.provider"),i=f("react.context"),u=f("react.forward_ref"),t.Suspense=f("react.suspense"),a=f("react.memo"),c=f("react.lazy")}var l="function"==typeof Symbol&&Symbol.iterator;function s(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y={};function m(e,t,r){this.props=e,this.context=t,this.refs=y,this.updater=r||p}function h(){}function v(e,t,r){this.props=e,this.context=t,this.refs=y,this.updater=r||p}m.prototype.isReactComponent={},m.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error(s(85));this.updater.enqueueSetState(this,e,t,"setState")},m.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},h.prototype=m.prototype;var b=v.prototype=new h;b.constructor=v,d(b,m.prototype),b.isPureReactComponent=!0;var x={current:null},g=Object.prototype.hasOwnProperty,O={key:!0,ref:!0,__self:!0,__source:!0};function _(e,t,n){var o,i={},u=null,a=null;if(null!=t)for(o in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(u=""+t.key),t)g.call(t,o)&&!O.hasOwnProperty(o)&&(i[o]=t[o]);var c=arguments.length-2;if(1===c)i.children=n;else if(1<c){for(var f=Array(c),l=0;l<c;l++)f[l]=arguments[l+2];i.children=f}if(e&&e.defaultProps)for(o in c=e.defaultProps)void 0===i[o]&&(i[o]=c[o]);return{$$typeof:r,type:e,key:u,ref:a,props:i,_owner:x.current}}function j(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}var w=/\/+/g;function z(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function E(e,t,o,i,u){var a=typeof e;"undefined"!==a&&"boolean"!==a||(e=null);var c=!1;if(null===e)c=!0;else switch(a){case"string":case"number":c=!0;break;case"object":switch(e.$$typeof){case r:case n:c=!0}}if(c)return u=u(c=e),e=""===i?"."+z(c,0):i,Array.isArray(u)?(o="",null!=e&&(o=e.replace(w,"$&/")+"/"),E(u,t,o,"",(function(e){return e}))):null!=u&&(j(u)&&(u=function(e,t){return{$$typeof:r,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(u,o+(!u.key||c&&c.key===u.key?"":(""+u.key).replace(w,"$&/")+"/")+e)),t.push(u)),1;if(c=0,i=""===i?".":i+":",Array.isArray(e))for(var f=0;f<e.length;f++){var p=i+z(a=e[f],f);c+=E(a,t,o,p,u)}else if("function"==typeof(p=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=l&&e[l]||e["@@iterator"])?e:null}(e)))for(e=p.call(e),f=0;!(a=e.next()).done;)c+=E(a=a.value,t,o,p=i+z(a,f++),u);else if("object"===a)throw t=""+e,Error(s(31,"[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t));return c}function S(e,t,r){if(null==e)return e;var n=[],o=0;return E(e,n,"","",(function(e){return t.call(r,e,o++)})),n}function T(e){if(-1===e._status){var t=e._result;t=t(),e._status=0,e._result=t,t.then((function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)}),(function(t){0===e._status&&(e._status=2,e._result=t)}))}if(1===e._status)return e._result;throw e._result}var k={current:null};function C(){var e=k.current;if(null===e)throw Error(s(321));return e}var A={ReactCurrentDispatcher:k,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:x,IsSomeRendererActing:{current:!1},assign:d};t.Children={map:S,forEach:function(e,t,r){S(e,(function(){t.apply(this,arguments)}),r)},count:function(e){var t=0;return S(e,(function(){t++})),t},toArray:function(e){return S(e,(function(e){return e}))||[]},only:function(e){if(!j(e))throw Error(s(143));return e}},t.Component=m,t.PureComponent=v,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=A,t.cloneElement=function(e,t,n){if(null==e)throw Error(s(267,e));var o=d({},e.props),i=e.key,u=e.ref,a=e._owner;if(null!=t){if(void 0!==t.ref&&(u=t.ref,a=x.current),void 0!==t.key&&(i=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(f in t)g.call(t,f)&&!O.hasOwnProperty(f)&&(o[f]=void 0===t[f]&&void 0!==c?c[f]:t[f])}var f=arguments.length-2;if(1===f)o.children=n;else if(1<f){c=Array(f);for(var l=0;l<f;l++)c[l]=arguments[l+2];o.children=c}return{$$typeof:r,type:e.type,key:i,ref:u,props:o,_owner:a}},t.createContext=function(e,t){return void 0===t&&(t=null),(e={$$typeof:i,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:o,_context:e},e.Consumer=e},t.createElement=_,t.createFactory=function(e){var t=_.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:u,render:e}},t.isValidElement=j,t.lazy=function(e){return{$$typeof:c,_payload:{_status:-1,_result:e},_init:T}},t.memo=function(e,t){return{$$typeof:a,type:e,compare:void 0===t?null:t}},t.useCallback=function(e,t){return C().useCallback(e,t)},t.useContext=function(e,t){return C().useContext(e,t)},t.useDebugValue=function(){},t.useEffect=function(e,t){return C().useEffect(e,t)},t.useImperativeHandle=function(e,t,r){return C().useImperativeHandle(e,t,r)},t.useLayoutEffect=function(e,t){return C().useLayoutEffect(e,t)},t.useMemo=function(e,t){return C().useMemo(e,t)},t.useReducer=function(e,t,r){return C().useReducer(e,t,r)},t.useRef=function(e){return C().useRef(e)},t.useState=function(e){return C().useState(e)},t.version="17.0.1"})),h=(f((function(e,t){})),f((function(e){e.exports=m}))),v="xyz-appear-from",b="xyz-appear",x="xyz-appear-to",g="xyz-in-from",O="xyz-in",_="xyz-in-to",j="xyz-out-from",w="xyz-out",z="xyz-out-to";function E(e){clearTimeout(e.xyzAnimTimeout),e.removeEventListener("animationend",e.xyzAnimEnd),e.removeEventListener("animationcancelled",e.xyzAnimEnd),delete e.xyzAnimTimeout,delete e.xyzAnimEnd}function S(e){var t=(e||{}).timeout,r={appear:v,appearActive:b,appearDone:x,enter:g,enterActive:O,enterDone:_,exit:j,exitActive:w,exitDone:z},n=function(e){return function(t,r){function n(){r(),E(t)}E(t);var o=function(e){return e.classList.contains("xyz-appear")?"appear":e.classList.contains("xyz-in")?"in":e.classList.contains("xyz-out")?"out":null}(t),i=function(e,t){if("object"!=typeof t||null===t)return t;switch(e){case"appear":return t.appear;case"in":return t.enter;case"out":return t.exit}return null}(o,e);if("number"!=typeof i){var u="xyz-"+o+"-keyframes",a=[t];if("auto"===i){var c=t.querySelectorAll(".xyz-nested, .xyz-"+o+"-nested");a.push.apply(a,Array.from(c))}var f=a.filter((function(e){return null!==e.offsetParent&&-1!==window.getComputedStyle(e).getPropertyValue("animation-name").indexOf(u)})),l=new Set(f);t.xyzAnimEnd=function(e){e.animationName===u&&(l.delete(e.target),0===l.size&&n())},t.addEventListener("animationend",t.xyzAnimEnd,!1),t.addEventListener("animationcancelled",t.xyzAnimEnd,!1)}else t.xyzAnimTimeout=setTimeout(n,i)}}(t),o=Object.assign({},e,{classNames:Object.assign({},r,e.classNames),addEndListener:n});return delete o.timeout,o}function T(e){var t=e.xyz,n=e.children,o=S(c(e,["xyz","children"])),i=h.Children.toArray(n).filter(Boolean);if(1!==i.length)throw new Error("XyzTransition must have a single truthy child at all times");var u=i[0];return h.createElement(r.CSSTransition,o,h.cloneElement(u,Object.assign({xyz:t},u.props)))}function k(e){var t=e.xyz,n=e.component,o=e.childFactory,i=e.children,u=c(e,["xyz","component","childFactory","children"]),f=h.Children.toArray(i).filter(Boolean);return h.createElement(r.TransitionGroup,{xyz:t,component:n,childFactory:o},f.map((function(e,t){return h.createElement(T,a({},u,{key:e.key}),h.cloneElement(e,{style:Object.assign({"--xyz-index":t,"--xyz-index-rev":f.length-t-1},e.style)}))})))}function C(e){var t=e.mode,n=e.children,o=c(e,["mode","children"]),i=h.Children.toArray(n).filter(Boolean);if(1!==i.length)throw new Error("XyzTransitionSwitch must have a single truthy child at all times");var u=i[0];return h.createElement(r.SwitchTransition,{mode:t},h.createElement(T,a({},o,{key:u.key}),u))}T.propTypes=Object.assign({},r.CSSTransition.propTypes,{xyz:i.default.string,timeout:i.default.oneOfType([i.default.number,i.default.oneOf(["auto"]),i.default.shape({appear:i.default.oneOfType([i.default.number,i.default.oneOf(["auto"])]),enter:i.default.oneOfType([i.default.number,i.default.oneOf(["auto"])]),exit:i.default.oneOfType([i.default.number,i.default.oneOf(["auto"])])})]),children:i.default.node}),k.propTypes=Object.assign({},r.TransitionGroup.propTypes,T.propTypes),C.propTypes=Object.assign({},r.SwitchTransition.propTypes,T.propTypes),Object.defineProperty(e,"xyz",{enumerable:!0,get:function(){return u.default}}),e.XyzTransition=T,e.XyzTransitionGroup=k,e.XyzTransitionSwitch=C,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("prop-types"),require("clsx"),require("react-transition-group")):"function"==typeof define&&define.amd?define(["exports","prop-types","clsx","react-transition-group"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactAnimXyz={},e.PropTypes,e.clsx,e.reactTransitionGroup)}(this,(function(e,t,n,r){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=o(t),a=o(n);function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function c(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}function s(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var l=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable;function y(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var d=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,r,o=y(e),i=1;i<arguments.length;i++){for(var a in n=Object(arguments[i]))f.call(n,a)&&(o[a]=n[a]);if(l){r=l(n);for(var u=0;u<r.length;u++)p.call(n,r[u])&&(o[r[u]]=n[r[u]])}}return o},m=s((function(e,t){var n=60103,r=60106;t.Fragment=60107,t.StrictMode=60108,t.Profiler=60114;var o=60109,i=60110,a=60112;t.Suspense=60113;var u=60115,c=60116;if("function"==typeof Symbol&&Symbol.for){var s=Symbol.for;n=s("react.element"),r=s("react.portal"),t.Fragment=s("react.fragment"),t.StrictMode=s("react.strict_mode"),t.Profiler=s("react.profiler"),o=s("react.provider"),i=s("react.context"),a=s("react.forward_ref"),t.Suspense=s("react.suspense"),u=s("react.memo"),c=s("react.lazy")}var l="function"==typeof Symbol&&Symbol.iterator;function f(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y={};function m(e,t,n){this.props=e,this.context=t,this.refs=y,this.updater=n||p}function h(){}function v(e,t,n){this.props=e,this.context=t,this.refs=y,this.updater=n||p}m.prototype.isReactComponent={},m.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error(f(85));this.updater.enqueueSetState(this,e,t,"setState")},m.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},h.prototype=m.prototype;var b=v.prototype=new h;b.constructor=v,d(b,m.prototype),b.isPureReactComponent=!0;var g={current:null},x=Object.prototype.hasOwnProperty,O={key:!0,ref:!0,__self:!0,__source:!0};function E(e,t,r){var o,i={},a=null,u=null;if(null!=t)for(o in void 0!==t.ref&&(u=t.ref),void 0!==t.key&&(a=""+t.key),t)x.call(t,o)&&!O.hasOwnProperty(o)&&(i[o]=t[o]);var c=arguments.length-2;if(1===c)i.children=r;else if(1<c){for(var s=Array(c),l=0;l<c;l++)s[l]=arguments[l+2];i.children=s}if(e&&e.defaultProps)for(o in c=e.defaultProps)void 0===i[o]&&(i[o]=c[o]);return{$$typeof:n,type:e,key:a,ref:u,props:i,_owner:g.current}}function _(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}var j=/\/+/g;function w(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function z(e,t,o,i,a){var u=typeof e;"undefined"!==u&&"boolean"!==u||(e=null);var c=!1;if(null===e)c=!0;else switch(u){case"string":case"number":c=!0;break;case"object":switch(e.$$typeof){case n:case r:c=!0}}if(c)return a=a(c=e),e=""===i?"."+w(c,0):i,Array.isArray(a)?(o="",null!=e&&(o=e.replace(j,"$&/")+"/"),z(a,t,o,"",(function(e){return e}))):null!=a&&(_(a)&&(a=function(e,t){return{$$typeof:n,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(a,o+(!a.key||c&&c.key===a.key?"":(""+a.key).replace(j,"$&/")+"/")+e)),t.push(a)),1;if(c=0,i=""===i?".":i+":",Array.isArray(e))for(var s=0;s<e.length;s++){var p=i+w(u=e[s],s);c+=z(u,t,o,p,a)}else if("function"==typeof(p=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=l&&e[l]||e["@@iterator"])?e:null}(e)))for(e=p.call(e),s=0;!(u=e.next()).done;)c+=z(u=u.value,t,o,p=i+w(u,s++),a);else if("object"===u)throw t=""+e,Error(f(31,"[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t));return c}function T(e,t,n){if(null==e)return e;var r=[],o=0;return z(e,r,"","",(function(e){return t.call(n,e,o++)})),r}function S(e){if(-1===e._status){var t=e._result;t=t(),e._status=0,e._result=t,t.then((function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)}),(function(t){0===e._status&&(e._status=2,e._result=t)}))}if(1===e._status)return e._result;throw e._result}var k={current:null};function C(){var e=k.current;if(null===e)throw Error(f(321));return e}var A={ReactCurrentDispatcher:k,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:g,IsSomeRendererActing:{current:!1},assign:d};t.Children={map:T,forEach:function(e,t,n){T(e,(function(){t.apply(this,arguments)}),n)},count:function(e){var t=0;return T(e,(function(){t++})),t},toArray:function(e){return T(e,(function(e){return e}))||[]},only:function(e){if(!_(e))throw Error(f(143));return e}},t.Component=m,t.PureComponent=v,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=A,t.cloneElement=function(e,t,r){if(null==e)throw Error(f(267,e));var o=d({},e.props),i=e.key,a=e.ref,u=e._owner;if(null!=t){if(void 0!==t.ref&&(a=t.ref,u=g.current),void 0!==t.key&&(i=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(s in t)x.call(t,s)&&!O.hasOwnProperty(s)&&(o[s]=void 0===t[s]&&void 0!==c?c[s]:t[s])}var s=arguments.length-2;if(1===s)o.children=r;else if(1<s){c=Array(s);for(var l=0;l<s;l++)c[l]=arguments[l+2];o.children=c}return{$$typeof:n,type:e.type,key:i,ref:a,props:o,_owner:u}},t.createContext=function(e,t){return void 0===t&&(t=null),(e={$$typeof:i,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:o,_context:e},e.Consumer=e},t.createElement=E,t.createFactory=function(e){var t=E.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:a,render:e}},t.isValidElement=_,t.lazy=function(e){return{$$typeof:c,_payload:{_status:-1,_result:e},_init:S}},t.memo=function(e,t){return{$$typeof:u,type:e,compare:void 0===t?null:t}},t.useCallback=function(e,t){return C().useCallback(e,t)},t.useContext=function(e,t){return C().useContext(e,t)},t.useDebugValue=function(){},t.useEffect=function(e,t){return C().useEffect(e,t)},t.useImperativeHandle=function(e,t,n){return C().useImperativeHandle(e,t,n)},t.useLayoutEffect=function(e,t){return C().useLayoutEffect(e,t)},t.useMemo=function(e,t){return C().useMemo(e,t)},t.useReducer=function(e,t,n){return C().useReducer(e,t,n)},t.useRef=function(e){return C().useRef(e)},t.useState=function(e){return C().useState(e)},t.version="17.0.1"})),h=(s((function(e,t){})),s((function(e){e.exports=m})));function v(e){clearTimeout(e.xyzAnimTimeout),e.removeEventListener("animationend",e.xyzAnimEnd),e.removeEventListener("animationcancelled",e.xyzAnimEnd),delete e.xyzAnimTimeout,delete e.xyzAnimEnd}function b(e){return(t,n)=>{function r(){v(t),n()}v(t);const o=function(e){return e.classList.contains("xyz-appear")?"appear":e.classList.contains("xyz-in")?"in":e.classList.contains("xyz-out")?"out":null}(t),i=function(e,t){switch(typeof t){case"number":case"string":return t;case"object":return null===t?null:t[e]}return null}(o,e);if("number"==typeof i)return void(t.xyzAnimTimeout=setTimeout(r,i));const a="xyz-".concat(o,"-keyframes"),u=new Set([t]);if("auto"===i){t.querySelectorAll(".xyz-nested, .xyz-".concat(o,"-nested")).forEach(u.add,u)}function c(e){u.delete(e),0===u.size&&r()}t.xyzAnimTimeout=setTimeout(()=>{u.forEach(e=>{e.offsetParent||e.getClientRects().length||c(e);-1===window.getComputedStyle(e).getPropertyValue("animation-name").indexOf(a)&&c(e)})}),t.xyzAnimEnd=e=>{e.animationName===a&&c(e.target)},t.addEventListener("animationend",t.xyzAnimEnd,!1),t.addEventListener("animationcancelled",t.xyzAnimEnd,!1)}}var g="xyz-appear-from",x="xyz-appear",O="xyz-appear-to",E="xyz-in-from",_="xyz-in",j="xyz-in-to",w="xyz-out-from",z="xyz-out",T="xyz-out-to";function S(e){const{xyz:t,className:n,style:o,children:i}=e,u=function(e){const{duration:t}=e||{},n={classNames:{appear:g,appearActive:x,appearDone:O,enter:E,enterActive:_,enterDone:j,exit:w,exitActive:z,exitDone:T},addEndListener:b(t)},r=Object.assign({},e,n,{classNames:Object.assign({},e.classNames,n.classNames)});return delete r.duration,r}(c(e,["xyz","className","style","children"])),s=h.Children.toArray(i).filter(h.isValidElement);if(1!==s.length)throw new Error("XyzTransition must have a single truthy child at all times");const l=s[0];return h.createElement(r.CSSTransition,u,h.cloneElement(l,Object.assign({xyz:t},l.props,{className:a.default(n,l.props.className),style:Object.assign({},o,l.props.style)})))}function k(e){const{xyz:t,component:n="div",childFactory:o,className:i,style:a,children:s}=e,l=c(e,["xyz","component","childFactory","className","style","children"]),f=h.Children.toArray(s).filter(h.isValidElement);return h.createElement(r.TransitionGroup,{component:n,xyz:t,className:i,style:a,childFactory:o},f.map((e,t)=>h.createElement(S,u({},l,{key:e.key}),h.cloneElement(e,{style:Object.assign({"--xyz-index":t,"--xyz-index-rev":f.length-t-1},e.props.style)}))))}function C(e){const{mode:t,children:n}=e,o=c(e,["mode","children"]),i=h.Children.toArray(n).filter(h.isValidElement);if(1!==i.length)throw new Error("XyzTransitionSwitch must have a single truthy child at all times");const a=i[0];return h.createElement(r.SwitchTransition,{mode:t},h.createElement(S,u({},o,{key:a.key}),a))}S.propTypes=Object.assign({},r.CSSTransition.propTypes,{xyz:i.default.string,duration:i.default.oneOfType([i.default.number,i.default.oneOf(["auto"]),i.default.shape({appear:i.default.oneOfType([i.default.number,i.default.oneOf(["auto"])]),in:i.default.oneOfType([i.default.number,i.default.oneOf(["auto"])]),out:i.default.oneOfType([i.default.number,i.default.oneOf(["auto"])])})]),children:i.default.node}),delete S.propTypes.timeout,k.propTypes=Object.assign({},r.TransitionGroup.propTypes,S.propTypes),C.propTypes=Object.assign({},r.SwitchTransition.propTypes,S.propTypes),Object.defineProperty(e,"xyz",{enumerable:!0,get:function(){return a.default}}),e.XyzTransition=S,e.XyzTransitionGroup=k,e.XyzTransitionSwitch=C,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=ReactAnimXyz.js.map |
{ | ||
"name": "@animxyz/react", | ||
"version": "0.1.2", | ||
"version": "0.2.0-alpha.0", | ||
"publishConfig": { | ||
@@ -32,4 +32,3 @@ "access": "public" | ||
"files": [ | ||
"dist", | ||
"src" | ||
"dist" | ||
], | ||
@@ -54,3 +53,3 @@ "moduleName": "ReactAnimXyz", | ||
"peerDependencies": { | ||
"react": "^17.0.1" | ||
"react": "^17.0.0" | ||
}, | ||
@@ -64,3 +63,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "a8f57703a066fe8b9b8c51dd9e6166548d51073d" | ||
"gitHead": "6eec5496b315b7088db337b08ce1e6f971e0525f" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
60764
8
519
1