UNPKG

@bprogress/next

Version:

NProgress bar like for Next.js compatible with new app directory

21 lines (17 loc) 1.22 kB
import { d as AppRouterInstance, I as InferRouterOptions, c as InferPrefetchOptions, e as RouterProgressOptions, f as AppRouterProgressInstance, b as AppProgressProviderProps } from './types-CtwtM8ra.cjs'; import { AppRouterInstance as AppRouterInstance$1 } from 'next/dist/shared/lib/app-router-context.shared-runtime'; import React from 'react'; import '@bprogress/react'; /** * Custom hook that extends the router (Next.js or custom) with progress bar functionality. * * With this signature, if a custom router is provided, its push method's options are automatically inferred. * * @param options Progress bar options and/or custom router. * @returns An extended router with push, replace, prefetch, back, refresh, and forward methods that manage the progress bar. */ declare function useRouter<Custom extends AppRouterInstance = AppRouterInstance$1, ROpts = InferRouterOptions<Custom>, POpts = InferPrefetchOptions<Custom>>(options?: RouterProgressOptions & { customRouter?: () => Custom; }): AppRouterProgressInstance<ROpts, POpts>; declare const AppProgressProvider: ({ children, ...props }: AppProgressProviderProps) => React.JSX.Element; export { AppProgressProvider as ProgressProvider, useRouter };