wix-style-react
Version:
wix-style-react
50 lines • 1.75 kB
TypeScript
import type { ReactNode, CSSProperties, TransitionEvent, MutableRefObject } from 'react';
type AriaBoolean = boolean | 'true' | 'false';
/**
* React.Ref uses the readonly type `React.RefObject` instead of
* `React.MutableRefObject`, We pretty much always assume ref objects are
* mutable (at least when we create them), so this type is a workaround so some
* of the weird mechanics of using refs with TS.
*/
export type AssignableRef<ValueType> = {
bivarianceHack(instance: ValueType | null): void;
}['bivarianceHack'] | MutableRefObject<ValueType | null>;
export interface GetCollapsePropsOutput {
id: string;
onTransitionEnd: (e: TransitionEvent) => void;
style: CSSProperties;
'aria-hidden': AriaBoolean;
}
export interface GetCollapsePropsInput {
[key: string]: unknown;
style?: CSSProperties;
onTransitionEnd?: (e: TransitionEvent) => void;
refKey?: string;
ref?: (node: ReactNode) => void | null | undefined;
}
export interface UseCollapseInput {
isExpanded?: boolean;
defaultExpanded?: boolean;
collapsedHeight?: number;
expandStyles?: {};
collapseStyles?: {};
easing?: string;
duration?: number;
onCollapseStart?: () => void;
onCollapseEnd?: () => void;
onExpandStart?: () => void;
onExpandEnd?: () => void;
hasDisabledAnimation?: boolean;
}
export interface UseCollapseOutput {
getCollapseProps: (config?: GetCollapsePropsInput) => GetCollapsePropsOutput;
isExpanded: boolean;
setExpanded: React.Dispatch<React.SetStateAction<boolean>>;
exitAnimationEnded: boolean;
}
export type UseControlledStateOutput = readonly [
boolean,
React.Dispatch<React.SetStateAction<boolean>>
];
export {};
//# sourceMappingURL=types.d.ts.map