UNPKG

@nex-ui/react

Version:

🎉 A beautiful, modern, and reliable React component library.

23 lines (20 loc) • 583 B
import { isValidElement, cloneElement } from 'react'; import { useRippleMotion } from './useRippleMotion.mjs'; const Ripple = ({ children, disabled, motionProps, motionStyle })=>{ const showEffect = useRippleMotion({ motionProps, motionStyle }); if (!/*#__PURE__*/ isValidElement(children)) { return children; } return /*#__PURE__*/ cloneElement(children, { onClick: (e)=>{ children.props.onClick?.(e); if (!disabled) { showEffect(e); } } }); }; export { Ripple };