.
This commit is contained in:
Generated
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
import type { ReadyRuntimeError } from '../utils/get-error-by-type';
|
||||
import type { HydrationErrorState } from '../../shared/hydration-error';
|
||||
export declare function useActiveRuntimeError({ runtimeErrors, getSquashedHydrationErrorDetails, }: {
|
||||
runtimeErrors: ReadyRuntimeError[];
|
||||
getSquashedHydrationErrorDetails: (error: Error) => HydrationErrorState | null;
|
||||
}): {
|
||||
isLoading: boolean;
|
||||
activeIdx: number;
|
||||
setActiveIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
|
||||
activeError: null;
|
||||
errorDetails: null;
|
||||
errorCode: null;
|
||||
errorType: null;
|
||||
} | {
|
||||
isLoading: false;
|
||||
activeIdx: number;
|
||||
setActiveIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
|
||||
activeError: ReadyRuntimeError;
|
||||
errorDetails: {
|
||||
type: "empty";
|
||||
} | {
|
||||
type: "hydration";
|
||||
warning: string | null;
|
||||
notes: string | null;
|
||||
reactOutputComponentDiff: string | null;
|
||||
} | {
|
||||
type: "blocking-route";
|
||||
variant: "navigation" | "runtime";
|
||||
refinement: "" | "generateViewport";
|
||||
} | {
|
||||
type: "dynamic-metadata";
|
||||
variant: "navigation" | "runtime";
|
||||
};
|
||||
errorCode: string | undefined;
|
||||
errorType: import("../components/errors/error-type-label/error-type-label").ErrorType;
|
||||
};
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
interface Options {
|
||||
enterDelay?: number;
|
||||
exitDelay?: number;
|
||||
onUnmount?: () => void;
|
||||
}
|
||||
/**
|
||||
* Useful to perform CSS transitions on React components without
|
||||
* using libraries like Framer Motion. This hook will defer the
|
||||
* unmount of a React component until after a delay.
|
||||
*
|
||||
* @param active - Whether the component should be rendered
|
||||
* @param options - Options for the delayed render
|
||||
* @param options.enterDelay - Delay before rendering the component
|
||||
* @param options.exitDelay - Delay before unmounting the component
|
||||
*
|
||||
* const Modal = ({ active }) => {
|
||||
* const { mounted, rendered } = useDelayedRender(active, {
|
||||
* exitDelay: 2000,
|
||||
* })
|
||||
*
|
||||
* if (!mounted) return null
|
||||
*
|
||||
* return (
|
||||
* <Portal>
|
||||
* <div className={rendered ? 'modal visible' : 'modal'}>...</div>
|
||||
* </Portal>
|
||||
* )
|
||||
*}
|
||||
*
|
||||
* */
|
||||
export declare function useDelayedRender(active?: boolean, options?: Options): {
|
||||
mounted: boolean;
|
||||
rendered: boolean;
|
||||
};
|
||||
export {};
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
import * as React from 'react';
|
||||
export declare function useOnClickOutside(el: Node | React.RefObject<Node | null> | null, cssSelectorsToExclude: string[], handler: ((e: MouseEvent | TouchEvent) => void) | undefined): void;
|
||||
+1
@@ -0,0 +1 @@
|
||||
export declare function useShortcuts(shortcuts: Record<string, () => void>, rootRef: React.RefObject<HTMLElement | null>): void;
|
||||
Reference in New Issue
Block a user