// ~/src/siteplane/components/motion/motion.tsx "use client"; import { mergeProps } from "@base-ui/react/merge-props"; import { useRender } from "@base-ui/react/use-render"; import { AnimatePresence, MotionConfig, PresenceContext, useIsPresent, usePresence, } from "motion/react"; import * as React from "react"; import { useReducedMotionPreference } from "../../system/motion/use-reduced-motion-preference"; import { useSiteplaneNonce } from "../../system/provider/siteplane-ui-provider"; import { cn } from "../../system/utils/cn"; import { slotClass } from "../../system/utils/slot-class"; import { useHeightFollower } from "./motion-follow"; import { GlideOnChange, leavingProps, measureSwapTiming, swapPresence, toMotionElement, useLeavingEntries, usePresenceMotion, type MotionLayout, type SwapTiming, } from "./motion-presence"; export type { MotionLayout }; // Components whose panes stay mounted while they leave (Tabs) take their pin // and height follow from useLeavingPane (motion-follow) and their switch rule // from panelSwitchClassName (motion-presence). Both are kit internals, imported // by file path, not part of the public Motion API. type NativeProps = Omit< React.ComponentPropsWithRef, // Motion owns these handlers; React's versions have a different signature. "onAnimationStart" | "onDrag" | "onDragEnd" | "onDragStart" >; type MotionEntryValue = { /** The entry holds a MotionItem, which plays the exit. */ claim: () => void; /** Whether no other item follows, so no space is needed after it. */ last: boolean; /** The item has left the list and plays its exit. */ leaving: boolean; /** The exit is over: drop the entry. */ remove: () => void; }; const MotionEntryContext = React.createContext(null); /** * Presence that takes a leaving child out of the flow while it plays its exit. * Motion pins that child with a `