aura-glass
Version:
A comprehensive glassmorphism design system for React applications with 142+ production-ready components
82 lines • 3.01 kB
TypeScript
import React, { Component, ErrorInfo, ReactNode } from "react";
export interface ErrorBoundaryState {
hasError: boolean;
error: Error | null;
errorInfo: ErrorInfo | null;
errorId: string;
retryCount: number;
}
export interface ErrorBoundaryProps {
/** Children to render */
children: ReactNode;
/** Custom fallback component */
fallback?: React.ComponentType<{
error: Error;
errorInfo: ErrorInfo;
retry: () => void;
errorId: string;
}>;
/** Maximum number of retries */
maxRetries?: number;
/** Whether to reset error state on props change */
resetOnPropsChange?: boolean;
/** Error reporting callback */
onError?: (error: Error, errorInfo: ErrorInfo, errorId: string) => void;
/** Reset callback */
onReset?: () => void;
/** Component name for debugging */
componentName?: string;
}
/**
* Production-ready error boundary with glassmorphism styling
*/
export declare class GlassErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
private resetTimeoutId;
constructor(props: ErrorBoundaryProps);
static getDerivedStateFromError(error: Error): Partial<ErrorBoundaryState>;
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
componentDidUpdate(prevProps: ErrorBoundaryProps): void;
componentWillUnmount(): void;
private reportErrorToService;
private resetErrorBoundary;
private handleRetry;
render(): string | number | boolean | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
}
/**
* HOC for wrapping components with error boundary
*/
export declare function withGlassErrorBoundary<P extends object>(Component: React.ComponentType<P>, errorBoundaryProps?: Omit<ErrorBoundaryProps, "children">): React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<any>>;
/**
* Error boundary specifically for async operations
*/
export declare class GlassAsyncErrorBoundary extends Component<ErrorBoundaryProps & {
timeout?: number;
}, ErrorBoundaryState & {
isTimeout: boolean;
}> {
private timeoutId;
constructor(props: ErrorBoundaryProps & {
timeout?: number;
});
componentDidMount(): void;
componentWillUnmount(): void;
static getDerivedStateFromError(error: Error): Partial<ErrorBoundaryState>;
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
render(): string | number | boolean | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
}
/**
* Lightweight error boundary for non-critical components
*/
export declare const GlassLightErrorBoundary: React.FC<{
children: ReactNode;
fallback?: ReactNode;
onError?: (error: Error) => void;
}>;
/**
* Error boundary specifically for glass components
*/
export declare const GlassComponentErrorBoundary: React.FC<{
children: ReactNode;
componentName?: string;
}>;
//# sourceMappingURL=errorBoundary.d.ts.map