react-equal-height
Version:
A React library with TypeScript support that automatically compares and sets the highest element height, including the ability to sort elements per row. Protected by the 'use client' directive, making it compatible with React Server Components and Next.js
24 lines (23 loc) • 1.31 kB
TypeScript
import { PropsWithChildren, ElementType, ComponentPropsWithoutRef } from 'react';
import { EqualHeightContextProps } from './equal-height-context';
import { ElementsProps } from "./equal-height-holder";
export interface ElementsMaxSizesProps extends Pick<ElementsProps, 'name' | 'height'> {
position?: number;
}
export interface HoldersInfoProps extends ElementsMaxSizesProps {
id: string;
}
interface BaseProps {
id?: string;
equalRows?: EqualHeightContextProps['equalRows'];
timeout?: number;
animationSpeed?: EqualHeightContextProps['animationSpeed'];
updateOnChange?: EqualHeightContextProps['updateOnChange'];
developerMode?: EqualHeightContextProps['developerMode'];
}
export type Props<T extends ElementType | undefined = undefined> = {
as?: T;
} & (T extends undefined ? BaseProps : BaseProps & ComponentPropsWithoutRef<Exclude<T, undefined>>);
export declare const defaults: Omit<EqualHeightContextProps, 'setHoldersInfo'> & Pick<Props, 'timeout'> & Required<Pick<Props, 'updateOnChange'>>;
declare const EqualHeight: <T extends ElementType | undefined = undefined>({ as, children, id, timeout, animationSpeed, equalRows, updateOnChange, developerMode, ...props }: PropsWithChildren<Props<T>>) => import("react/jsx-runtime").JSX.Element;
export default EqualHeight;