UNPKG

avent-ui

Version:

The best UI library for Typescript and React

30 lines (27 loc) 1.24 kB
import { jsx } from 'react/jsx-runtime'; import React, { forwardRef, useMemo } from 'react'; const HamMenuContents = React.memo(forwardRef((props, ref) => { const { children, as, style, className, animateDelay, motionProp, ...otherProps } = props; const Component = as || 'div'; const slide = useMemo(() => { return (motionProp || { initial: { x: "80px", }, enter: (i) => ({ x: '0', transition: { duration: 0.8, ease: [0.76, 0, 0.24, 1], delay: i * (animateDelay || 0.05) } }), exit: (i) => ({ x: '80px', transition: { duration: 0.8, ease: [0.76, 0, 0.24, 1], delay: i * (-1 * (animateDelay || 0.05)) } }) }); }, [animateDelay, motionProp]); return (jsx(Component, { ref: ref, className: `flex flex-col mt-3 gap-3 ${className || ''}`, style: style, ...otherProps, children: React.Children.map(children, (child, index) => { return (child && React.cloneElement(child, { index, slide })); }) })); })); HamMenuContents.displayName = 'HamMenuContents'; export { HamMenuContents as default }; //# sourceMappingURL=hammenu-content.js.map