import {designComponent, getComponentCls, PropType, useRefs} from "@peryl/react-compose"; import React, {ReactElement} from "react"; import FlipMove from "react-flip-move"; import './list.scss'; export const List = designComponent({ props: { tag: { type: String, default: 'div' }, easing: { type: String, default: 'cubic-bezier(0.23, 1, 0.32, 1)' }, duration: { type: [String, Number], default: '300ms' }, animation: { type: String as PropType }, enterAnimation: { type: String as PropType }, leaveAnimation: { type: String as PropType }, onStart: { type: Function as PropType<(childElement: ReactElement, domNode: HTMLElement) => void> }, onFinish: { type: Function as PropType<(childElement: ReactElement, domNode: HTMLElement) => void> }, onStartAll: { type: Function as PropType<(childElements: Array>, domNodes: Array) => void> }, onFinishAll: { type: Function as PropType<(childElements: Array>, domNodes: Array) => void> }, disableAllAnimations: { type: Boolean, default: false }, }, inheritPropsType: HTMLDivElement, slots: ['default'], setup({ props, slots }) { const { refs, onRef } = useRefs({ el: HTMLDivElement }); const defaultFlipAnimation = { enter: { from: { transform: 'translateY(30px)', opacity: 0.15, }, to: { transform: '', }, }, leave: { from: { transform: '', }, to: { transform: 'translateY(-30px)', opacity: 0, }, }, }; return { refer: { refs, }, render: () => { const Tag = props.tag as any; return ( ); } }; }, }); export default List;