All files / src/react-parallax-tilt types.public.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88                                                                                                                                                                               
import type { GlareProps } from '@/features/glare/types.public';
import type { TiltProps } from '@/features/tilt/types.public';
 
import type { SupportedEvent } from './types';
 
export type OnMoveParams = {
  tiltAngleX: number;
  tiltAngleY: number;
  tiltAngleXPercentage: number;
  tiltAngleYPercentage: number;
  glareAngle: number;
  glareOpacity: number;
  event: SupportedEvent;
};
 
export type OnMove = (onMoveParams: OnMoveParams) => void;
 
export type OnEnterParams = {
  event: MouseEvent | React.MouseEvent | TouchEvent | React.TouchEvent;
};
 
export type OnEnter = (onEnterParams: OnEnterParams) => void;
 
export type OnLeaveParams = {
  event: MouseEvent | React.MouseEvent | TouchEvent | React.TouchEvent;
};
 
export type OnLeave = (onLeaveParams: OnLeaveParams) => void;
 
type HtmlDivTilt = Pick<React.HTMLAttributes<HTMLDivElement>, 'className' | 'style'>;
 
export type ReactParallaxTiltProps = TiltProps &
  GlareProps &
  HtmlDivTilt & {
    /**
     * Tilt children component
     */
    children?: React.ReactNode;
    /**
     * Scale of the component (`1.5 = 150%, 2 = 200%`).
     */
    scale?: number;
    /**
     * Defines how far the tilt component appears from the user. Lower values create more extreme tilt effects.
     */
    perspective?: number;
    /**
     * Enables/disables vertical flipping of the component.
     */
    flipVertically?: boolean;
    /**
     * Enables/disables horizontal flipping of the component.
     */
    flipHorizontally?: boolean;
    /**
     * Determines if effects should reset on `onLeave` event.
     */
    reset?: boolean;
    /**
     * Easing function for the transition.
     */
    transitionEasing?: string;
    /**
     * Speed of the transition.
     */
    transitionSpeed?: number;
    /**
     * Tracks mouse and touch events across the entire window.
     */
    trackOnWindow?: boolean;
    /**
     * Enables/disables device orientation detection.
     */
    gyroscope?: boolean;
    /**
     * Callback triggered when user moves on the component.
     */
    onMove?: OnMove;
    /**
     * Callback triggered when user enters the component.
     */
    onEnter?: OnEnter;
    /**
     * Callback triggered when user leaves the component.
     */
    onLeave?: OnLeave;
  };