Skip to content

Commit

Permalink
fix: motionProps type issue
Browse files Browse the repository at this point in the history
  • Loading branch information
wingkwong committed Jan 31, 2025
1 parent a5b8f86 commit 98c2169
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type {AccordionItemVariantProps, AccordionItemSlots, SlotsToClasses} from "@heroui/theme";
import type {HTMLMotionProps} from "@heroui/motion";

import {As} from "@heroui/system";
import {ItemProps, BaseItem} from "@heroui/aria-utils";
Expand Down Expand Up @@ -50,7 +51,7 @@ export interface Props<T extends object = {}>
/**
* The props to modify the framer motion animation. Use the `variants` API to create your own animation.
*/
motionProps?: any; // FIXME(motion): HTMLMotionProps<"section">;
motionProps?: Omit<HTMLMotionProps<"section">, "ref">;
/**
* Whether to keep the accordion content mounted when collapsed.
* @default false
Expand Down
6 changes: 2 additions & 4 deletions packages/components/modal/src/modal-content.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type {AriaDialogProps} from "@react-aria/dialog";
import type {HTMLMotionProps} from "@heroui/motion";

import {cloneElement, isValidElement, ReactNode, useMemo, useCallback} from "react";
import {DismissButton} from "@react-aria/overlays";
Expand Down Expand Up @@ -92,10 +93,7 @@ const ModalContent = (props: ModalContentProps) => {
exit="exit"
initial="exit"
variants={TRANSITION_VARIANTS.fade}
{
// FIXME(motion): HTMLMotionProps<"div">
...(getBackdropProps() as any)
}
{...(getBackdropProps() as Omit<HTMLMotionProps<"div">, "ref">)}
/>
</LazyMotion>
);
Expand Down
3 changes: 2 additions & 1 deletion packages/components/modal/src/use-modal.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type {ModalVariantProps, SlotsToClasses, ModalSlots} from "@heroui/theme";
import type {HTMLMotionProps} from "@heroui/motion";

import {AriaModalOverlayProps} from "@react-aria/overlays";
import {useAriaModalOverlay} from "@heroui/use-aria-modal-overlay";
Expand All @@ -21,7 +22,7 @@ interface Props extends HTMLHeroUIProps<"section"> {
/**
* The props to modify the framer motion animation. Use the `variants` API to create your own animation.
*/
motionProps?: any; // FIXME(motion): HTMLMotionProps<"section">
motionProps?: Omit<HTMLMotionProps<"section">, "ref">;
/**
* Determines whether to hide the modal close button.
* @default false
Expand Down
4 changes: 3 additions & 1 deletion packages/components/navbar/src/navbar-menu.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type {HTMLMotionProps} from "@heroui/motion";

import {forwardRef, HTMLHeroUIProps} from "@heroui/system";
import {useDOMRef} from "@heroui/react-utils";
import {clsx, dataAttr} from "@heroui/shared-utils";
Expand All @@ -19,7 +21,7 @@ export interface NavbarMenuProps extends HTMLHeroUIProps<"ul"> {
/**
* The props to modify the framer motion animation. Use the `variants` API to create your own animation.
*/
motionProps?: any; // FIXME(motion): HTMLMotionProps<"ul">
motionProps?: Omit<HTMLMotionProps<"ul">, "ref">;
}

const domAnimation = () => import("@heroui/dom-animation").then((res) => res.default);
Expand Down
3 changes: 2 additions & 1 deletion packages/components/navbar/src/use-navbar.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type {NavbarVariantProps, SlotsToClasses, NavbarSlots} from "@heroui/theme";
import type {HTMLMotionProps} from "@heroui/motion";

import {HTMLHeroUIProps, mapPropsVariants, PropGetter, useProviderContext} from "@heroui/system";
import {navbar} from "@heroui/theme";
Expand Down Expand Up @@ -56,7 +57,7 @@ interface Props extends HTMLHeroUIProps<"nav"> {
* The props to modify the framer motion animation. Use the `variants` API to create your own animation.
* This motion is only available if the `shouldHideOnScroll` prop is set to `true`.
*/
motionProps?: any; // FIXME(motion): HTMLMotionProps<"nav">
motionProps?: Omit<HTMLMotionProps<"nav">, "ref">;
/**
* The event handler for the menu open state.
* @param isOpen boolean
Expand Down
7 changes: 4 additions & 3 deletions packages/components/popover/src/free-solo-popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
* @internal
*/

import type {HTMLMotionProps} from "@heroui/motion";

import * as React from "react";
import {DismissButton, Overlay} from "@react-aria/overlays";
import {forwardRef} from "@heroui/system";
import {LazyMotion, m} from "@heroui/motion";
import {LazyMotion, m, TRANSITION_VARIANTS} from "@heroui/motion";
import {mergeProps} from "@react-aria/utils";
import {getTransformOrigins} from "@heroui/aria-utils";
import {TRANSITION_VARIANTS} from "@heroui/motion";
import {useDialog} from "@react-aria/dialog";

import {usePopover, UsePopoverProps, UsePopoverReturn} from "./use-popover";
Expand Down Expand Up @@ -135,7 +136,7 @@ const FreeSoloPopover = forwardRef<"div", FreeSoloPopoverProps>(
exit="exit"
initial="exit"
variants={TRANSITION_VARIANTS.fade}
{...(getBackdropProps() as any)} // FIXME(motion): HTMLMotionProps<"div">
{...(getBackdropProps() as Omit<HTMLMotionProps<"div">, "ref">)}
/>
</LazyMotion>
);
Expand Down
6 changes: 3 additions & 3 deletions packages/components/popover/src/popover-content.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type {AriaDialogProps} from "@react-aria/dialog";
import type {HTMLMotionProps} from "@heroui/motion";

import {DOMAttributes, ReactNode, useMemo, useRef} from "react";
import {DismissButton} from "@react-aria/overlays";
import {TRANSITION_VARIANTS} from "@heroui/motion";
import {m, LazyMotion} from "@heroui/motion";
import {TRANSITION_VARIANTS, m, LazyMotion} from "@heroui/motion";
import {HTMLHeroUIProps} from "@heroui/system";
import {getTransformOrigins} from "@heroui/aria-utils";
import {useDialog} from "@react-aria/dialog";
Expand Down Expand Up @@ -73,7 +73,7 @@ const PopoverContent = (props: PopoverContentProps) => {
exit="exit"
initial="exit"
variants={TRANSITION_VARIANTS.fade}
{...(getBackdropProps() as any)} // FIXME(motion): HTMLMotionProps<"div">
{...(getBackdropProps() as Omit<HTMLMotionProps<"div">, "ref">)}
/>
</LazyMotion>
);
Expand Down
3 changes: 2 additions & 1 deletion packages/components/popover/src/use-popover.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type {PopoverVariantProps, SlotsToClasses, PopoverSlots} from "@heroui/theme";
import type {PressEvent} from "@react-types/shared";
import type {HTMLMotionProps} from "@heroui/motion";

import {RefObject, Ref, useEffect} from "react";
import {ReactRef, useDOMRef} from "@heroui/react-utils";
Expand Down Expand Up @@ -49,7 +50,7 @@ export interface Props extends HTMLHeroUIProps<"div"> {
/**
* The props to modify the framer motion animation. Use the `variants` API to create your own animation.
*/
motionProps?: any; // FIXME(motion): HTMLMotionProps<"div">
motionProps?: Omit<HTMLMotionProps<"div">, "ref">;
/**
* The container element in which the overlay portal will be placed.
* @default document.body
Expand Down
3 changes: 2 additions & 1 deletion packages/components/ripple/src/ripple.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import type {RippleType} from "./use-ripple";
import type {FC} from "react";
import type {HTMLHeroUIProps} from "@heroui/system";
import type {HTMLMotionProps} from "@heroui/motion";

import {AnimatePresence, m, LazyMotion} from "@heroui/motion";
import {clamp} from "@heroui/shared-utils";

export interface RippleProps extends HTMLHeroUIProps<"span"> {
ripples: RippleType[];
color?: string;
motionProps?: any; // FIXME(motion): HTMLMotionProps<"span">
motionProps?: Omit<HTMLMotionProps<"span">, "ref">;
style?: React.CSSProperties;
onClear: (key: React.Key) => void;
}
Expand Down
5 changes: 3 additions & 2 deletions packages/components/tabs/src/use-tabs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type {TabsVariantProps, SlotsToClasses, TabsSlots, TabsReturnType} from "@heroui/theme";
import type {HTMLMotionProps} from "@heroui/motion";

import {HTMLHeroUIProps, mapPropsVariants, PropGetter, useProviderContext} from "@heroui/system";
import {tabs} from "@heroui/theme";
Expand All @@ -20,7 +21,7 @@ export interface Props extends Omit<HTMLHeroUIProps, "children"> {
/**
* The props to modify the cursor motion animation. Use the `variants` API to create your own animation.
*/
motionProps?: any; // FIXME(motion): HTMLMotionProps<"span">
motionProps?: Omit<HTMLMotionProps<"span">, "ref">;
/**
* Whether the tabs selection should occur on press up instead of press down.
* @default true
Expand Down Expand Up @@ -76,7 +77,7 @@ export type ValuesType<T = object> = {
listRef?: RefObject<HTMLElement>;
shouldSelectOnPressUp?: boolean;
classNames?: SlotsToClasses<TabsSlots>;
motionProps?: any; // FIXME(motion): HTMLMotionProps<"span">
motionProps?: Omit<HTMLMotionProps<"span">, "ref">;
disableAnimation?: boolean;
isDisabled?: boolean;
};
Expand Down
3 changes: 2 additions & 1 deletion packages/components/tooltip/src/use-tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type {PopoverVariantProps, SlotsToClasses} from "@heroui/theme";
import type {AriaTooltipProps} from "@react-types/tooltip";
import type {OverlayTriggerProps} from "@react-types/overlays";
import type {OverlayOptions} from "@heroui/aria-utils";
import type {HTMLMotionProps} from "@heroui/motion";

import {ReactNode, Ref, useId, useImperativeHandle} from "react";
import {useTooltipTriggerState} from "@react-stately/tooltip";
Expand Down Expand Up @@ -51,7 +52,7 @@ interface Props extends Omit<HTMLHeroUIProps, "content"> {
/**
* The props to modify the framer motion animation. Use the `variants` API to create your own animation.
*/
motionProps?: any; // FIXME(motion): HTMLMotionProps<"div">
motionProps?: Omit<HTMLMotionProps<"div">, "ref">;
/**
* The container element in which the overlay portal will be placed.
* @default document.body
Expand Down

0 comments on commit 98c2169

Please sign in to comment.