@nex-ui/react
Version:
🎉 A beautiful, modern, and reliable React component library.
23 lines (20 loc) • 630 B
JavaScript
import { isValidElement, cloneElement } from 'react';
import { chain } from '@nex-ui/utils';
import { useRippleMotion } from './useRippleMotion.mjs';
const Ripple = ({ children, disabled, motionProps, motionStyle, onClick })=>{
const showEffect = useRippleMotion({
motionProps,
motionStyle
});
if (!/*#__PURE__*/ isValidElement(children)) {
return children;
}
return /*#__PURE__*/ cloneElement(children, {
onClick: chain(onClick, children.props.onClick, (e)=>{
if (!disabled) {
showEffect(e);
}
})
});
};
export { Ripple };