@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
80 lines (79 loc) • 3.22 kB
TypeScript
import { Dict, Merge } from "../../utils/index.js";
import { ComponentArgs, DOMElement, OmitProps, StyledProps, WithoutAs, WithoutRef } from "../../core/components/index.types.js";
import "../../core/index.js";
import * as React from "react";
import { MotionProps, ResolvedValues, TargetAndTransition, Transition } from "motion/react";
//#region src/components/motion/index.types.d.ts
type ComponentConditionalProps<Y extends DOMElement, M extends DOMElement, D extends object = {}> = Y extends M ? OmitProps<React.ComponentProps<Y>, D> : OmitProps<React.ComponentProps<M>, D>;
type ComponentProps<Y extends DOMElement, M extends DOMElement, D extends object = {}> = ComponentConditionalProps<Y, M, WithoutRef<D>> & {
as?: M;
};
interface MotionComponent<Y extends DOMElement, D extends object = {}> extends ComponentArgs {
<M extends DOMElement = Y>(props: ComponentProps<Y, M, D>): React.ReactElement;
}
interface MotionStyledComponent<Y extends DOMElement, M extends object = {}> extends MotionComponent<Y, Merge<MotionStyledProps, M>> {}
interface StyledPropsWithoutAs extends Omit<StyledProps, "as"> {}
interface MotionStyledProps extends Merge<StyledPropsWithoutAs, MotionProps> {
/**
* The HTML element to render.
*/
as?: DOMElement;
}
type HTMLMotionProps$1<Y extends DOMElement = "div"> = Merge<React.ComponentProps<Y>, MotionStyledProps>;
type HTMLMotionPropsWithoutAs<Y extends DOMElement = "div"> = WithoutAs<HTMLMotionProps$1<Y>>;
type HTMLMotionPropsWithoutChildren<Y extends DOMElement = "div"> = Omit<HTMLMotionProps$1<Y>, "children">;
type TargetResolver<Y = Dict> = (props: MotionTransitionProps & Y) => TargetAndTransition;
type Variant<Y = Dict> = TargetAndTransition | TargetResolver<Y>;
interface MotionTransitionVariants<Y = Dict> {
enter: Variant<Y>;
exit: Variant<Y>;
initial?: Variant<Y>;
}
type MotionLifecycleProps<Y> = { [key in "enter" | "exit"]?: Y };
interface MotionTransitionProps {
/**
* Custom `delay` definition for `enter` and `exit`.
*
* @default 0
*/
delay?: MotionLifecycleProps<number> | number;
/**
* Custom `duration` definition for `enter` and `exit`.
*
* @default 0.2
*/
duration?: MotionLifecycleProps<number> | number;
/**
* Custom `enter`.
*/
enter?: any;
/**
* Custom `exit`.
*/
exit?: any;
/**
* Custom `initial`.
*/
initial?: any;
/**
* Custom `transition` definition for `enter` and `exit`.
*/
transition?: MotionLifecycleProps<Transition>;
/**
* Custom `transitionEnd` definition for `enter` and `exit`.
*/
transitionEnd?: MotionLifecycleProps<ResolvedValues>;
}
type WithTransitionProps<Y extends object = {}> = MotionTransitionProps & Omit<Y, "transition" | "variants"> & {
/**
* Show the component. triggers when enter or exit states.
*/
open?: boolean;
/**
* If `true`, the element will unmount when `open={false}` and animation is done.
*/
unmountOnExit?: boolean;
};
//#endregion
export { HTMLMotionProps$1 as HTMLMotionProps, HTMLMotionPropsWithoutAs, HTMLMotionPropsWithoutChildren, MotionComponent, MotionStyledComponent, MotionTransitionProps, MotionTransitionVariants, WithTransitionProps };
//# sourceMappingURL=index.types.d.ts.map