= ForwardRefExoticComponent<
PropsWithoutRef & RefAttributes
>;
/**
* Support for React component props
*/
declare type UnwrapFactoryAttributes = F extends
DetailedHTMLFactory ? P : never;
declare type UnwrapFactoryElement = F extends
DetailedHTMLFactory ? P : never;
declare type HTMLAttributesWithoutMotionProps<
Attributes extends HTMLAttributes,
Element extends HTMLElement,
> = {
[K in Exclude]?: Attributes[K];
};
/**
* @public
*/
declare type HTMLMotionProps =
& HTMLAttributesWithoutMotionProps<
UnwrapFactoryAttributes,
UnwrapFactoryElement
>
& MotionProps;
/**
* Motion-optimised versions of React's HTML components.
*
* @public
*/
declare type HTMLMotionComponents = {
[K in HTMLElements]: ForwardRefComponent<
UnwrapFactoryElement,
HTMLMotionProps
>;
};
interface SVGAttributesWithoutMotionProps
extends
Pick, Exclude, keyof MotionProps>> {
}
/**
* Blanket-accept any SVG attribute as a `MotionValue`
* @public
*/
declare type SVGAttributesAsMotionValues = MakeMotion<
SVGAttributesWithoutMotionProps
>;
declare type UnwrapSVGFactoryElement = F extends React.SVGProps ? P
: never;
/**
* @public
*/
interface SVGMotionProps
extends SVGAttributesAsMotionValues, MotionProps {
}
/**
* Motion-optimised versions of React's SVG components.
*
* @public
*/
declare type SVGMotionComponents = {
[K in SVGElements]: ForwardRefComponent<
UnwrapSVGFactoryElement,
SVGMotionProps>
>;
};
/**
* @public
*/
interface FeatureProps extends MotionProps {
visualElement: VisualElement;
}
declare type FeatureNames = {
animation: true;
exit: true;
drag: true;
tap: true;
focus: true;
hover: true;
pan: true;
inView: true;
measureLayout: true;
};
declare type FeatureComponent = React$1.ComponentType;
/**
* @public
*/
interface FeatureDefinition {
isEnabled: (props: MotionProps) => boolean;
Component?: FeatureComponent;
}
interface FeatureComponents {
animation?: FeatureComponent;
exit?: FeatureComponent;
drag?: FeatureComponent;
tap?: FeatureComponent;
focus?: FeatureComponent;
hover?: FeatureComponent;
pan?: FeatureComponent;
inView?: FeatureComponent;
measureLayout?: FeatureComponent;
}
interface FeatureBundle extends FeatureComponents {
renderer: CreateVisualElement;
projectionNodeConstructor?: any;
}
declare type LazyFeatureBundle$1 = () => Promise;
declare type FeatureDefinitions = {
[K in keyof FeatureNames]: FeatureDefinition;
};
declare type LoadedFeatures = FeatureDefinitions & {
projectionNodeConstructor?: any;
};
declare type RenderComponent = (
Component: string | React$1.ComponentType,
props: MotionProps,
projectionId: number | undefined,
ref: React$1.Ref,
visualState: VisualState,
isStatic: boolean,
visualElement?: VisualElement,
) => any;
interface MotionComponentConfig {
preloadedFeatures?: FeatureBundle;
createVisualElement?: CreateVisualElement;
projectionNodeConstructor?: any;
useRender: RenderComponent;
useVisualState: UseVisualState;
Component: string | React$1.ComponentType;
}
/**
* Create a `motion` component.
*
* This function accepts a Component argument, which can be either a string (ie "div"
* for `motion.div`), or an actual React component.
*
* Alongside this is a config option which provides a way of rendering the provided
* component "offline", or outside the React render cycle.
*
* @internal
*/
declare function createMotionComponent(
{
preloadedFeatures,
createVisualElement,
projectionNodeConstructor,
useRender,
useVisualState,
Component,
}: MotionComponentConfig,
): React$1.ForwardRefExoticComponent<
React$1.PropsWithoutRef & React$1.RefAttributes
>;
/**
* I'd rather the return type of `custom` to be implicit but this throws
* incorrect relative paths in the exported types and API Extractor throws
* a wobbly.
*
* @internal
*/
declare type CustomDomComponent = React$1.ForwardRefExoticComponent<
& React$1.PropsWithoutRef
& React$1.RefAttributes
>;
interface CustomMotionComponentConfig {
forwardMotionProps?: boolean;
}
declare type DOMMotionComponents = HTMLMotionComponents & SVGMotionComponents;
/**
* HTML & SVG components, optimised for use with gestures and animation. These can be used as
* drop-in replacements for any HTML & SVG component, all CSS & SVG properties are supported.
*
* @public
*/
declare const motion:
& ((
Component: string | React$1.ComponentType,
customMotionComponentConfig?: CustomMotionComponentConfig,
) => CustomDomComponent)
& HTMLMotionComponents
& SVGMotionComponents;
/**
* Create a DOM `motion` component with the provided string. This is primarily intended
* as a full alternative to `motion` for consumers who have to support environments that don't
* support `Proxy`.
*
* ```javascript
* import { createDomMotionComponent } from "framer-motion"
*
* const motion = {
* div: createDomMotionComponent('div')
* }
* ```
*
* @public
*/
declare function createDomMotionComponent(
key: T,
): DOMMotionComponents[T];
/**
* @public
*/
declare const m:
& ((
Component: string | React$1.ComponentType,
customMotionComponentConfig?: CustomMotionComponentConfig,
) => CustomDomComponent)
& HTMLMotionComponents
& SVGMotionComponents;
/**
* @public
*/
interface AnimatePresenceProps {
/**
* By passing `initial={false}`, `AnimatePresence` will disable any initial animations on children
* that are present when the component is first rendered.
*
* ```jsx
*
* {isVisible && (
*
* )}
*
* ```
*
* @public
*/
initial?: boolean;
/**
* When a component is removed, there's no longer a chance to update its props. So if a component's `exit`
* prop is defined as a dynamic variant and you want to pass a new `custom` prop, you can do so via `AnimatePresence`.
* This will ensure all leaving components animate using the latest data.
*
* @public
*/
custom?: any;
/**
* Fires when all exiting nodes have completed animating out.
*
* @public
*/
onExitComplete?: () => void;
/**
* If set to `true`, `AnimatePresence` will only render one component at a time. The exiting component
* will finish its exit animation before the entering component is rendered.
*
* ```jsx
* const MyComponent = ({ currentItem }) => (
*
*
*
* )
* ```
*
* @beta
*/
exitBeforeEnter?: boolean;
/**
* Used in Framer to flag that sibling children *shouldn't* re-render as a result of a
* child being removed.
*
* @internal
*/
presenceAffectsLayout?: boolean;
}
/**
* `AnimatePresence` enables the animation of components that have been removed from the tree.
*
* When adding/removing more than a single child, every child **must** be given a unique `key` prop.
*
* Any `motion` components that have an `exit` property defined will animate out when removed from
* the tree.
*
* ```jsx
* import { motion, AnimatePresence } from 'framer-motion'
*
* export const Items = ({ items }) => (
*
* {items.map(item => (
*
* ))}
*
* )
* ```
*
* You can sequence exit animations throughout a tree using variants.
*
* If a child contains multiple `motion` components with `exit` props, it will only unmount the child
* once all `motion` components have finished animating out. Likewise, any components using
* `usePresence` all need to call `safeToRemove`.
*
* @public
*/
declare const AnimatePresence: React$1.FunctionComponent;
declare const AnimateSharedLayout: React$1.FunctionComponent;
declare type LazyFeatureBundle = () => Promise;
/**
* @public
*/
interface LazyProps {
children?: ReactNode;
/**
* Can be used to provide a feature bundle synchronously or asynchronously.
*
* ```jsx
* // features.js
* import { domAnimations } from "framer-motion"
* export default domAnimations
*
* // index.js
* import { LazyMotion, m } from "framer-motion"
*
* const loadFeatures = import("./features.js")
* .then(res => res.default)
*
* function Component() {
* return (
*
*
*
* )
* }
* ```
*
* @public
*/
features: FeatureBundle | LazyFeatureBundle;
/**
* If `true`, will throw an error if a `motion` component renders within
* a `LazyMotion` component.
*
* ```jsx
* // This component will throw an error that explains using a motion component
* // instead of the m component will break the benefits of code-splitting.
* function Component() {
* return (
*
*
*
* )
* }
* ```
*
* @public
*/
strict?: boolean;
}
/**
* Used in conjunction with the `m` component to reduce bundle size.
*
* `m` is a version of the `motion` component that only loads functionality
* critical for the initial render.
*
* `LazyMotion` can then be used to either synchronously or asynchronously
* load animation and gesture support.
*
* ```jsx
* // Synchronous loading
* import { LazyMotion, m, domAnimations } from "framer-motion"
*
* function App() {
* return (
*
*
*
* )
* }
*
* // Asynchronous loading
* import { LazyMotion, m } from "framer-motion"
*
* function App() {
* return (
* import('./path/to/domAnimations')}>
*
*
* )
* }
* ```
*
* @public
*/
declare function LazyMotion(
{ children, features, strict }: LazyProps,
): JSX.Element;
interface Props$2 {
id?: string;
inheritId?: boolean;
}
declare const LayoutGroup: React$1.FunctionComponent;
interface Props$1 {
/**
* A HTML element to render this component as. Defaults to `"li"`.
*
* @public
*/
as?: keyof ReactHTML;
/**
* The value in the list that this component represents.
*
* @public
*/
value: V;
}
interface Props {
/**
* A HTML element to render this component as. Defaults to `"ul"`.
*
* @public
*/
as?: keyof ReactHTML;
/**
* The axis to reorder along. By default, items will be draggable on this axis.
* To make draggable on both axes, set ``
*
* @public
*/
axis?: "x" | "y";
/**
* A callback to fire with the new value order. For instance, if the values
* are provided as a state from `useState`, this could be the set state function.
*
* @public
*/
onReorder: (newOrder: any[]) => void;
/**
* The latest values state.
*
* ```jsx
* function Component() {
* const [items, setItems] = useState([0, 1, 2])
*
* return (
*
* {items.map((item) => )}
*
* )
* }
* ```
*
* @public
*/
values: V[];
}
declare const Reorder: {
Group: React$1.ForwardRefExoticComponent<
& Props
& {
color?: string | undefined;
translate?: "no" | "yes" | undefined;
hidden?: boolean | undefined;
onPlay?: React$1.ReactEventHandler | undefined;
className?: string | undefined;
id?: string | undefined;
lang?: string | undefined;
role?: React$1.AriaRole | undefined;
tabIndex?: number | undefined;
"aria-activedescendant"?: string | undefined;
"aria-atomic"?: boolean | "false" | "true" | undefined;
"aria-autocomplete"?: "none" | "inline" | "both" | "list" | undefined;
"aria-busy"?: boolean | "false" | "true" | undefined;
"aria-checked"?: boolean | "mixed" | "false" | "true" | undefined;
"aria-colcount"?: number | undefined;
"aria-colindex"?: number | undefined;
"aria-colspan"?: number | undefined;
"aria-controls"?: string | undefined;
"aria-current"?:
| boolean
| "page"
| "false"
| "true"
| "step"
| "location"
| "date"
| "time"
| undefined;
"aria-describedby"?: string | undefined;
"aria-details"?: string | undefined;
"aria-disabled"?: boolean | "false" | "true" | undefined;
"aria-dropeffect"?:
| "none"
| "copy"
| "move"
| "link"
| "execute"
| "popup"
| undefined;
"aria-errormessage"?: string | undefined;
"aria-expanded"?: boolean | "false" | "true" | undefined;
"aria-flowto"?: string | undefined;
"aria-grabbed"?: boolean | "false" | "true" | undefined;
"aria-haspopup"?:
| boolean
| "grid"
| "listbox"
| "menu"
| "false"
| "true"
| "dialog"
| "tree"
| undefined;
"aria-hidden"?: boolean | "false" | "true" | undefined;
"aria-invalid"?:
| boolean
| "false"
| "true"
| "grammar"
| "spelling"
| undefined;
"aria-keyshortcuts"?: string | undefined;
"aria-label"?: string | undefined;
"aria-labelledby"?: string | undefined;
"aria-level"?: number | undefined;
"aria-live"?: "off" | "assertive" | "polite" | undefined;
"aria-modal"?: boolean | "false" | "true" | undefined;
"aria-multiline"?: boolean | "false" | "true" | undefined;
"aria-multiselectable"?: boolean | "false" | "true" | undefined;
"aria-orientation"?: "horizontal" | "vertical" | undefined;
"aria-owns"?: string | undefined;
"aria-placeholder"?: string | undefined;
"aria-posinset"?: number | undefined;
"aria-pressed"?: boolean | "mixed" | "false" | "true" | undefined;
"aria-readonly"?: boolean | "false" | "true" | undefined;
"aria-relevant"?:
| "all"
| "text"
| "additions"
| "additions removals"
| "additions text"
| "removals"
| "removals additions"
| "removals text"
| "text additions"
| "text removals"
| undefined;
"aria-required"?: boolean | "false" | "true" | undefined;
"aria-roledescription"?: string | undefined;
"aria-rowcount"?: number | undefined;
"aria-rowindex"?: number | undefined;
"aria-rowspan"?: number | undefined;
"aria-selected"?: boolean | "false" | "true" | undefined;
"aria-setsize"?: number | undefined;
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
"aria-valuemax"?: number | undefined;
"aria-valuemin"?: number | undefined;
"aria-valuenow"?: number | undefined;
"aria-valuetext"?: string | undefined;
children?: React$1.ReactNode;
dangerouslySetInnerHTML?: {
__html: string;
} | undefined;
onCopy?: React$1.ClipboardEventHandler | undefined;
onCopyCapture?: React$1.ClipboardEventHandler | undefined;
onCut?: React$1.ClipboardEventHandler | undefined;
onCutCapture?: React$1.ClipboardEventHandler | undefined;
onPaste?: React$1.ClipboardEventHandler | undefined;
onPasteCapture?: React$1.ClipboardEventHandler | undefined;
onCompositionEnd?: React$1.CompositionEventHandler | undefined;
onCompositionEndCapture?:
| React$1.CompositionEventHandler
| undefined;
onCompositionStart?: React$1.CompositionEventHandler | undefined;
onCompositionStartCapture?:
| React$1.CompositionEventHandler
| undefined;
onCompositionUpdate?: React$1.CompositionEventHandler | undefined;
onCompositionUpdateCapture?:
| React$1.CompositionEventHandler
| undefined;
onFocus?: React$1.FocusEventHandler | undefined;
onFocusCapture?: React$1.FocusEventHandler | undefined;
onBlur?: React$1.FocusEventHandler | undefined;
onBlurCapture?: React$1.FocusEventHandler | undefined;
onChange?: React$1.FormEventHandler | undefined;
onChangeCapture?: React$1.FormEventHandler | undefined;
onBeforeInput?: React$1.FormEventHandler | undefined;
onBeforeInputCapture?: React$1.FormEventHandler | undefined;
onInput?: React$1.FormEventHandler | undefined;
onInputCapture?: React$1.FormEventHandler | undefined;
onReset?: React$1.FormEventHandler | undefined;
onResetCapture?: React$1.FormEventHandler | undefined;
onSubmit?: React$1.FormEventHandler | undefined;
onSubmitCapture?: React$1.FormEventHandler | undefined;
onInvalid?: React$1.FormEventHandler | undefined;
onInvalidCapture?: React$1.FormEventHandler | undefined;
onLoad?: React$1.ReactEventHandler | undefined;
onLoadCapture?: React$1.ReactEventHandler | undefined;
onError?: React$1.ReactEventHandler | undefined;
onErrorCapture?: React$1.ReactEventHandler | undefined;
onKeyDown?: React$1.KeyboardEventHandler | undefined;
onKeyDownCapture?: React$1.KeyboardEventHandler | undefined;
onKeyPress?: React$1.KeyboardEventHandler | undefined;
onKeyPressCapture?: React$1.KeyboardEventHandler | undefined;
onKeyUp?: React$1.KeyboardEventHandler | undefined;
onKeyUpCapture?: React$1.KeyboardEventHandler | undefined;
onAbort?: React$1.ReactEventHandler | undefined;
onAbortCapture?: React$1.ReactEventHandler | undefined;
onCanPlay?: React$1.ReactEventHandler | undefined;
onCanPlayCapture?: React$1.ReactEventHandler | undefined;
onCanPlayThrough?: React$1.ReactEventHandler | undefined;
onCanPlayThroughCapture?: React$1.ReactEventHandler | undefined;
onDurationChange?: React$1.ReactEventHandler | undefined;
onDurationChangeCapture?: React$1.ReactEventHandler | undefined;
onEmptied?: React$1.ReactEventHandler | undefined;
onEmptiedCapture?: React$1.ReactEventHandler | undefined;
onEncrypted?: React$1.ReactEventHandler | undefined;
onEncryptedCapture?: React$1.ReactEventHandler | undefined;
onEnded?: React$1.ReactEventHandler | undefined;
onEndedCapture?: React$1.ReactEventHandler | undefined;
onLoadedData?: React$1.ReactEventHandler | undefined;
onLoadedDataCapture?: React$1.ReactEventHandler | undefined;
onLoadedMetadata?: React$1.ReactEventHandler | undefined;
onLoadedMetadataCapture?: React$1.ReactEventHandler | undefined;
onLoadStart?: React$1.ReactEventHandler | undefined;
onLoadStartCapture?: React$1.ReactEventHandler | undefined;
onPause?: React$1.ReactEventHandler | undefined;
onPauseCapture?: React$1.ReactEventHandler | undefined;
onPlayCapture?: React$1.ReactEventHandler | undefined;
onPlaying?: React$1.ReactEventHandler | undefined;
onPlayingCapture?: React$1.ReactEventHandler | undefined;
onProgress?: React$1.ReactEventHandler | undefined;
onProgressCapture?: React$1.ReactEventHandler | undefined;
onRateChange?: React$1.ReactEventHandler | undefined;
onRateChangeCapture?: React$1.ReactEventHandler | undefined;
onSeeked?: React$1.ReactEventHandler | undefined;
onSeekedCapture?: React$1.ReactEventHandler | undefined;
onSeeking?: React$1.ReactEventHandler | undefined;
onSeekingCapture?: React$1.ReactEventHandler | undefined;
onStalled?: React$1.ReactEventHandler | undefined;
onStalledCapture?: React$1.ReactEventHandler | undefined;
onSuspend?: React$1.ReactEventHandler | undefined;
onSuspendCapture?: React$1.ReactEventHandler | undefined;
onTimeUpdate?: React$1.ReactEventHandler | undefined;
onTimeUpdateCapture?: React$1.ReactEventHandler | undefined;
onVolumeChange?: React$1.ReactEventHandler | undefined;
onVolumeChangeCapture?: React$1.ReactEventHandler | undefined;
onWaiting?: React$1.ReactEventHandler | undefined;
onWaitingCapture?: React$1.ReactEventHandler | undefined;
onAuxClick?: React$1.MouseEventHandler | undefined;
onAuxClickCapture?: React$1.MouseEventHandler | undefined;
onClick?: React$1.MouseEventHandler | undefined;
onClickCapture?: React$1.MouseEventHandler | undefined;
onContextMenu?: React$1.MouseEventHandler | undefined;
onContextMenuCapture?: React$1.MouseEventHandler | undefined;
onDoubleClick?: React$1.MouseEventHandler | undefined;
onDoubleClickCapture?: React$1.MouseEventHandler | undefined;
onDragCapture?: React$1.DragEventHandler | undefined;
onDragEndCapture?: React$1.DragEventHandler | undefined;
onDragEnter?: React$1.DragEventHandler | undefined;
onDragEnterCapture?: React$1.DragEventHandler | undefined;
onDragExit?: React$1.DragEventHandler | undefined;
onDragExitCapture?: React$1.DragEventHandler | undefined;
onDragLeave?: React$1.DragEventHandler | undefined;
onDragLeaveCapture?: React$1.DragEventHandler | undefined;
onDragOver?: React$1.DragEventHandler | undefined;
onDragOverCapture?: React$1.DragEventHandler | undefined;
onDragStartCapture?: React$1.DragEventHandler | undefined;
onDrop?: React$1.DragEventHandler | undefined;
onDropCapture?: React$1.DragEventHandler | undefined;
onMouseDown?: React$1.MouseEventHandler | undefined;
onMouseDownCapture?: React$1.MouseEventHandler | undefined;
onMouseEnter?: React$1.MouseEventHandler | undefined;
onMouseLeave?: React$1.MouseEventHandler