react-router 7.13.1 → 7.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/{production/browser-DzsJABDQ.d.mts → development/browser-Bfn3xw9E.d.ts} +2 -1
  3. package/dist/development/{browser-DzsJABDQ.d.mts → browser-Di6-vSl-.d.mts} +2 -1
  4. package/dist/development/{chunk-XOLAXE2Z.js → chunk-GO74ODU3.js} +190 -111
  5. package/dist/{production/chunk-B5UMK6O7.js → development/chunk-HPFFRPKK.js} +100 -99
  6. package/dist/development/{chunk-KSEWV2VO.js → chunk-LLP6DRWX.js} +7 -7
  7. package/dist/{production/chunk-TXB4YXR2.mjs → development/chunk-UALY5CBT.mjs} +83 -49
  8. package/dist/development/{chunk-LFPYN7LY.mjs → chunk-UVKPFVEO.mjs} +124 -44
  9. package/dist/development/context-phCt_zmH.d.mts +1713 -0
  10. package/dist/development/dom-export.d.mts +3 -2
  11. package/dist/development/dom-export.d.ts +3 -2
  12. package/dist/development/dom-export.js +45 -29
  13. package/dist/development/dom-export.mjs +21 -5
  14. package/dist/development/{index-react-server-client-C4tCIird.d.ts → index-react-server-client-BcrVT7Dd.d.mts} +4 -2
  15. package/dist/{production/index-react-server-client-EzWJGpN_.d.mts → development/index-react-server-client-CCwMoQIT.d.ts} +1067 -10
  16. package/dist/development/index-react-server-client.d.mts +3 -2
  17. package/dist/development/index-react-server-client.d.ts +3 -2
  18. package/dist/development/index-react-server-client.js +4 -4
  19. package/dist/development/index-react-server-client.mjs +2 -2
  20. package/dist/development/index-react-server.d.mts +293 -246
  21. package/dist/development/index-react-server.d.ts +293 -246
  22. package/dist/development/index-react-server.js +121 -43
  23. package/dist/development/index-react-server.mjs +121 -43
  24. package/dist/development/index.d.mts +15 -13
  25. package/dist/development/index.d.ts +15 -13
  26. package/dist/development/index.js +176 -142
  27. package/dist/development/index.mjs +3 -3
  28. package/dist/development/instrumentation-BYr6ff5D.d.ts +657 -0
  29. package/dist/development/lib/types/internal.d.mts +2 -2
  30. package/dist/development/lib/types/internal.d.ts +2 -2
  31. package/dist/development/lib/types/internal.js +1 -1
  32. package/dist/development/lib/types/internal.mjs +1 -1
  33. package/dist/development/{register-CBoanF80.d.ts → register-CTxsJBKQ.d.mts} +1 -1
  34. package/dist/development/{register-cRYJ3CjG.d.mts → register-CkcGwv27.d.ts} +1 -1
  35. package/dist/development/routeModules-BRrCYrSL.d.mts +1693 -0
  36. package/dist/development/routeModules-CA7kSxJJ.d.ts +1693 -0
  37. package/dist/production/{browser-sPQ7eaK4.d.ts → browser-Bfn3xw9E.d.ts} +2 -1
  38. package/dist/{development/browser-sPQ7eaK4.d.ts → production/browser-Di6-vSl-.d.mts} +2 -1
  39. package/dist/production/{chunk-RJCJ3EYF.mjs → chunk-2BDJPJTA.mjs} +124 -44
  40. package/dist/production/{chunk-ZJMCM6KT.js → chunk-CAFVLUDY.js} +7 -7
  41. package/dist/production/{chunk-772H4TVR.js → chunk-LKUVSIBA.js} +190 -111
  42. package/dist/{development/chunk-JPUPSTYD.mjs → production/chunk-PY35PE22.mjs} +83 -49
  43. package/dist/{development/chunk-2YMDXNOJ.js → production/chunk-XAAX7KIK.js} +100 -99
  44. package/dist/production/context-phCt_zmH.d.mts +1713 -0
  45. package/dist/production/dom-export.d.mts +3 -2
  46. package/dist/production/dom-export.d.ts +3 -2
  47. package/dist/production/dom-export.js +45 -29
  48. package/dist/production/dom-export.mjs +21 -5
  49. package/dist/{development/index-react-server-client-EzWJGpN_.d.mts → production/index-react-server-client-BcrVT7Dd.d.mts} +4 -2
  50. package/dist/production/{index-react-server-client-C4tCIird.d.ts → index-react-server-client-CCwMoQIT.d.ts} +1067 -10
  51. package/dist/production/index-react-server-client.d.mts +3 -2
  52. package/dist/production/index-react-server-client.d.ts +3 -2
  53. package/dist/production/index-react-server-client.js +4 -4
  54. package/dist/production/index-react-server-client.mjs +2 -2
  55. package/dist/production/index-react-server.d.mts +293 -246
  56. package/dist/production/index-react-server.d.ts +293 -246
  57. package/dist/production/index-react-server.js +121 -43
  58. package/dist/production/index-react-server.mjs +121 -43
  59. package/dist/production/index.d.mts +15 -13
  60. package/dist/production/index.d.ts +15 -13
  61. package/dist/production/index.js +176 -142
  62. package/dist/production/index.mjs +3 -3
  63. package/dist/production/instrumentation-BYr6ff5D.d.ts +657 -0
  64. package/dist/production/lib/types/internal.d.mts +2 -2
  65. package/dist/production/lib/types/internal.d.ts +2 -2
  66. package/dist/production/lib/types/internal.js +1 -1
  67. package/dist/production/lib/types/internal.mjs +1 -1
  68. package/dist/production/{register-CBoanF80.d.ts → register-CTxsJBKQ.d.mts} +1 -1
  69. package/dist/production/{register-cRYJ3CjG.d.mts → register-CkcGwv27.d.ts} +1 -1
  70. package/dist/production/routeModules-BRrCYrSL.d.mts +1693 -0
  71. package/dist/production/routeModules-CA7kSxJJ.d.ts +1693 -0
  72. package/package.json +1 -1
  73. package/dist/development/instrumentation--6Pioq_G.d.ts +0 -3344
  74. package/dist/development/router-cLsU7kHk.d.mts +0 -3344
  75. package/dist/production/instrumentation--6Pioq_G.d.ts +0 -3344
  76. package/dist/production/router-cLsU7kHk.d.mts +0 -3344
@@ -1,14 +1,15 @@
1
- import { bG as RouteManifest, o as RouteModules, Q as HydrationState, a1 as DataRouteObject, a as ClientLoaderFunction, a5 as StaticHandlerContext, bH as ServerRouteModule, q as MiddlewareEnabled, c as RouterContextProvider, r as AppLoadContext, al as LoaderFunctionArgs, ac as ActionFunctionArgs, au as unstable_ServerInstrumentation, aj as HTMLFormMethod, ah as FormEncType, w as RelativeRoutingType, bh as PageLinkDescriptor, T as To, bI as History, a4 as GetScrollRestorationKeyFunction, e as RouterInit, bJ as FutureConfig$1, u as unstable_ClientInstrumentation, p as DataStrategyFunction, a0 as PatchRoutesOnNavigationFunction, s as NavigateOptions, a6 as Fetcher, K as RouteObject, n as Router, v as SerializeFrom, B as BlockerFunction, L as Location, bK as CreateStaticHandlerOptions$1, a2 as StaticHandler } from './instrumentation--6Pioq_G.js';
1
+ import { H as HydrationState, f as StaticHandlerContext, l as unstable_ServerInstrumentation, c as RelativeRoutingType, a as Router$1, d as RouterState, R as RouterInit, t as FutureConfig$1, u as unstable_ClientInstrumentation, e as GetScrollRestorationKeyFunction, F as Fetcher, B as BlockerFunction, C as CreateStaticHandlerOptions$1, S as StaticHandler } from './instrumentation-BYr6ff5D.js';
2
2
  import * as React from 'react';
3
+ import { aC as RouteManifest, J as RouteModules, n as DataRouteObject, a as ClientLoaderFunction, aD as ServerRouteModule, r as MiddlewareEnabled, c as RouterContextProvider, s as AppLoadContext, q as LoaderFunctionArgs, _ as ActionFunctionArgs, aE as TrackedPromise, f as History, T as To, L as Location, i as Action, aa as RouteMatch, W as InitialEntry, Y as NonIndexRouteObject, a5 as LazyRouteFunction, X as IndexRouteObject, P as Params, l as DataStrategyFunction, m as PatchRoutesOnNavigationFunction, e as RouteObject, U as UIMatch, o as HTMLFormMethod, F as FormEncType, at as PageLinkDescriptor, K as SerializeFrom } from './routeModules-CA7kSxJJ.js';
3
4
 
4
- interface Route {
5
+ interface Route$1 {
5
6
  index?: boolean;
6
7
  caseSensitive?: boolean;
7
8
  id: string;
8
9
  parentId?: string;
9
10
  path?: string;
10
11
  }
11
- interface EntryRoute extends Route {
12
+ interface EntryRoute extends Route$1 {
12
13
  hasAction: boolean;
13
14
  hasLoader: boolean;
14
15
  hasClientAction: boolean;
@@ -58,6 +59,7 @@ interface EntryContext extends FrameworkContextObject {
58
59
  serverHandoffStream?: ReadableStream<Uint8Array>;
59
60
  }
60
61
  interface FutureConfig {
62
+ unstable_passThroughRequests: boolean;
61
63
  unstable_subResourceIntegrity: boolean;
62
64
  unstable_trailingSlashAwareDataRequests: boolean;
63
65
  v8_middleware: boolean;
@@ -82,7 +84,7 @@ interface AssetsManifest {
82
84
  }
83
85
 
84
86
  type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
85
- interface ServerRoute extends Route {
87
+ interface ServerRoute extends Route$1 {
86
88
  children: ServerRoute[];
87
89
  module: ServerRouteModule;
88
90
  }
@@ -145,6 +147,1061 @@ interface ServerEntryModule {
145
147
  streamTimeout?: number;
146
148
  }
147
149
 
150
+ interface DataRouterContextObject extends Omit<NavigationContextObject, "future" | "unstable_useTransitions"> {
151
+ router: Router$1;
152
+ staticContext?: StaticHandlerContext;
153
+ onError?: ClientOnErrorFunction;
154
+ }
155
+ declare const DataRouterContext: React.Context<DataRouterContextObject | null>;
156
+ declare const DataRouterStateContext: React.Context<RouterState | null>;
157
+ type ViewTransitionContextObject = {
158
+ isTransitioning: false;
159
+ } | {
160
+ isTransitioning: true;
161
+ flushSync: boolean;
162
+ currentLocation: Location;
163
+ nextLocation: Location;
164
+ };
165
+ declare const ViewTransitionContext: React.Context<ViewTransitionContextObject>;
166
+ type FetchersContextObject = Map<string, any>;
167
+ declare const FetchersContext: React.Context<FetchersContextObject>;
168
+ declare const AwaitContext: React.Context<TrackedPromise | null>;
169
+ declare const AwaitContextProvider: (props: React.ComponentProps<typeof AwaitContext.Provider>) => React.FunctionComponentElement<React.ProviderProps<TrackedPromise | null>>;
170
+ interface NavigateOptions {
171
+ /** Replace the current entry in the history stack instead of pushing a new one */
172
+ replace?: boolean;
173
+ /** Masked URL */
174
+ unstable_mask?: To;
175
+ /** Adds persistent client side routing state to the next location */
176
+ state?: any;
177
+ /** If you are using {@link ScrollRestoration `<ScrollRestoration>`}, prevent the scroll position from being reset to the top of the window when navigating */
178
+ preventScrollReset?: boolean;
179
+ /** Defines the relative path behavior for the link. "route" will use the route hierarchy so ".." will remove all URL segments of the current route pattern while "path" will use the URL path so ".." will remove one URL segment. */
180
+ relative?: RelativeRoutingType;
181
+ /** Wraps the initial state update for this navigation in a {@link https://react.dev/reference/react-dom/flushSync ReactDOM.flushSync} call instead of the default {@link https://react.dev/reference/react/startTransition React.startTransition} */
182
+ flushSync?: boolean;
183
+ /** Enables a {@link https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API View Transition} for this navigation by wrapping the final state update in `document.startViewTransition()`. If you need to apply specific styles for this view transition, you will also need to leverage the {@link useViewTransitionState `useViewTransitionState()`} hook. */
184
+ viewTransition?: boolean;
185
+ /** Specifies the default revalidation behavior after this submission */
186
+ unstable_defaultShouldRevalidate?: boolean;
187
+ }
188
+ /**
189
+ * A Navigator is a "location changer"; it's how you get to different locations.
190
+ *
191
+ * Every history instance conforms to the Navigator interface, but the
192
+ * distinction is useful primarily when it comes to the low-level `<Router>` API
193
+ * where both the location and a navigator must be provided separately in order
194
+ * to avoid "tearing" that may occur in a suspense-enabled app if the action
195
+ * and/or location were to be read directly from the history instance.
196
+ */
197
+ interface Navigator {
198
+ createHref: History["createHref"];
199
+ encodeLocation?: History["encodeLocation"];
200
+ go: History["go"];
201
+ push(to: To, state?: any, opts?: NavigateOptions): void;
202
+ replace(to: To, state?: any, opts?: NavigateOptions): void;
203
+ }
204
+ interface NavigationContextObject {
205
+ basename: string;
206
+ navigator: Navigator;
207
+ static: boolean;
208
+ unstable_useTransitions: boolean | undefined;
209
+ future: {};
210
+ }
211
+ declare const NavigationContext: React.Context<NavigationContextObject>;
212
+ interface LocationContextObject {
213
+ location: Location;
214
+ navigationType: Action;
215
+ }
216
+ declare const LocationContext: React.Context<LocationContextObject>;
217
+ interface RouteContextObject {
218
+ outlet: React.ReactElement | null;
219
+ matches: RouteMatch[];
220
+ isDataRoute: boolean;
221
+ }
222
+ declare const RouteContext: React.Context<RouteContextObject>;
223
+
224
+ declare function mapRouteProperties(route: RouteObject): Partial<RouteObject> & {
225
+ hasErrorBoundary: boolean;
226
+ };
227
+ declare const hydrationRouteProperties: (keyof RouteObject)[];
228
+ /**
229
+ * @category Data Routers
230
+ */
231
+ interface MemoryRouterOpts {
232
+ /**
233
+ * Basename path for the application.
234
+ */
235
+ basename?: string;
236
+ /**
237
+ * A function that returns an {@link RouterContextProvider} instance
238
+ * which is provided as the `context` argument to client [`action`](../../start/data/route-object#action)s,
239
+ * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
240
+ * This function is called to generate a fresh `context` instance on each
241
+ * navigation or fetcher call.
242
+ */
243
+ getContext?: RouterInit["getContext"];
244
+ /**
245
+ * Future flags to enable for the router.
246
+ */
247
+ future?: Partial<FutureConfig$1>;
248
+ /**
249
+ * Hydration data to initialize the router with if you have already performed
250
+ * data loading on the server.
251
+ */
252
+ hydrationData?: HydrationState;
253
+ /**
254
+ * Initial entries in the in-memory history stack
255
+ */
256
+ initialEntries?: InitialEntry[];
257
+ /**
258
+ * Index of `initialEntries` the application should initialize to
259
+ */
260
+ initialIndex?: number;
261
+ /**
262
+ * Array of instrumentation objects allowing you to instrument the router and
263
+ * individual routes prior to router initialization (and on any subsequently
264
+ * added routes via `route.lazy` or `patchRoutesOnNavigation`). This is
265
+ * mostly useful for observability such as wrapping navigations, fetches,
266
+ * as well as route loaders/actions/middlewares with logging and/or performance
267
+ * tracing. See the [docs](../../how-to/instrumentation) for more information.
268
+ *
269
+ * ```tsx
270
+ * let router = createBrowserRouter(routes, {
271
+ * unstable_instrumentations: [logging]
272
+ * });
273
+ *
274
+ *
275
+ * let logging = {
276
+ * router({ instrument }) {
277
+ * instrument({
278
+ * navigate: (impl, info) => logExecution(`navigate ${info.to}`, impl),
279
+ * fetch: (impl, info) => logExecution(`fetch ${info.to}`, impl)
280
+ * });
281
+ * },
282
+ * route({ instrument, id }) {
283
+ * instrument({
284
+ * middleware: (impl, info) => logExecution(
285
+ * `middleware ${info.request.url} (route ${id})`,
286
+ * impl
287
+ * ),
288
+ * loader: (impl, info) => logExecution(
289
+ * `loader ${info.request.url} (route ${id})`,
290
+ * impl
291
+ * ),
292
+ * action: (impl, info) => logExecution(
293
+ * `action ${info.request.url} (route ${id})`,
294
+ * impl
295
+ * ),
296
+ * })
297
+ * }
298
+ * };
299
+ *
300
+ * async function logExecution(label: string, impl: () => Promise<void>) {
301
+ * let start = performance.now();
302
+ * console.log(`start ${label}`);
303
+ * await impl();
304
+ * let duration = Math.round(performance.now() - start);
305
+ * console.log(`end ${label} (${duration}ms)`);
306
+ * }
307
+ * ```
308
+ */
309
+ unstable_instrumentations?: unstable_ClientInstrumentation[];
310
+ /**
311
+ * Override the default data strategy of running loaders in parallel -
312
+ * see the [docs](../../how-to/data-strategy) for more information.
313
+ *
314
+ * ```tsx
315
+ * let router = createBrowserRouter(routes, {
316
+ * async dataStrategy({
317
+ * matches,
318
+ * request,
319
+ * runClientMiddleware,
320
+ * }) {
321
+ * const matchesToLoad = matches.filter((m) =>
322
+ * m.shouldCallHandler(),
323
+ * );
324
+ *
325
+ * const results: Record<string, DataStrategyResult> = {};
326
+ * await runClientMiddleware(() =>
327
+ * Promise.all(
328
+ * matchesToLoad.map(async (match) => {
329
+ * results[match.route.id] = await match.resolve();
330
+ * }),
331
+ * ),
332
+ * );
333
+ * return results;
334
+ * },
335
+ * });
336
+ * ```
337
+ */
338
+ dataStrategy?: DataStrategyFunction;
339
+ /**
340
+ * Lazily define portions of the route tree on navigations.
341
+ */
342
+ patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction;
343
+ }
344
+ /**
345
+ * Create a new {@link DataRouter} that manages the application path using an
346
+ * in-memory [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
347
+ * stack. Useful for non-browser environments without a DOM API.
348
+ *
349
+ * @public
350
+ * @category Data Routers
351
+ * @mode data
352
+ * @param routes Application routes
353
+ * @param opts Options
354
+ * @param {MemoryRouterOpts.basename} opts.basename n/a
355
+ * @param {MemoryRouterOpts.dataStrategy} opts.dataStrategy n/a
356
+ * @param {MemoryRouterOpts.future} opts.future n/a
357
+ * @param {MemoryRouterOpts.getContext} opts.getContext n/a
358
+ * @param {MemoryRouterOpts.hydrationData} opts.hydrationData n/a
359
+ * @param {MemoryRouterOpts.initialEntries} opts.initialEntries n/a
360
+ * @param {MemoryRouterOpts.initialIndex} opts.initialIndex n/a
361
+ * @param {MemoryRouterOpts.unstable_instrumentations} opts.unstable_instrumentations n/a
362
+ * @param {MemoryRouterOpts.patchRoutesOnNavigation} opts.patchRoutesOnNavigation n/a
363
+ * @returns An initialized {@link DataRouter} to pass to {@link RouterProvider | `<RouterProvider>`}
364
+ */
365
+ declare function createMemoryRouter(routes: RouteObject[], opts?: MemoryRouterOpts): Router$1;
366
+ /**
367
+ * Function signature for client side error handling for loader/actions errors
368
+ * and rendering errors via `componentDidCatch`
369
+ */
370
+ interface ClientOnErrorFunction {
371
+ (error: unknown, info: {
372
+ location: Location;
373
+ params: Params;
374
+ unstable_pattern: string;
375
+ errorInfo?: React.ErrorInfo;
376
+ }): void;
377
+ }
378
+ /**
379
+ * @category Types
380
+ */
381
+ interface RouterProviderProps {
382
+ /**
383
+ * The {@link DataRouter} instance to use for navigation and data fetching.
384
+ */
385
+ router: Router$1;
386
+ /**
387
+ * The [`ReactDOM.flushSync`](https://react.dev/reference/react-dom/flushSync)
388
+ * implementation to use for flushing updates.
389
+ *
390
+ * You usually don't have to worry about this:
391
+ * - The `RouterProvider` exported from `react-router/dom` handles this internally for you
392
+ * - If you are rendering in a non-DOM environment, you can import
393
+ * `RouterProvider` from `react-router` and ignore this prop
394
+ */
395
+ flushSync?: (fn: () => unknown) => undefined;
396
+ /**
397
+ * An error handler function that will be called for any middleware, loader, action,
398
+ * or render errors that are encountered in your application. This is useful for
399
+ * logging or reporting errors instead of in the {@link ErrorBoundary} because it's not
400
+ * subject to re-rendering and will only run one time per error.
401
+ *
402
+ * The `errorInfo` parameter is passed along from
403
+ * [`componentDidCatch`](https://react.dev/reference/react/Component#componentdidcatch)
404
+ * and is only present for render errors.
405
+ *
406
+ * ```tsx
407
+ * <RouterProvider onError=(error, info) => {
408
+ * let { location, params, unstable_pattern, errorInfo } = info;
409
+ * console.error(error, location, errorInfo);
410
+ * reportToErrorService(error, location, errorInfo);
411
+ * }} />
412
+ * ```
413
+ */
414
+ onError?: ClientOnErrorFunction;
415
+ /**
416
+ * Control whether router state updates are internally wrapped in
417
+ * [`React.startTransition`](https://react.dev/reference/react/startTransition).
418
+ *
419
+ * - When left `undefined`, all state updates are wrapped in
420
+ * `React.startTransition`
421
+ * - This can lead to buggy behaviors if you are wrapping your own
422
+ * navigations/fetchers in `startTransition`.
423
+ * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped
424
+ * in `React.startTransition` and router state changes will be wrapped in
425
+ * `React.startTransition` and also sent through
426
+ * [`useOptimistic`](https://react.dev/reference/react/useOptimistic) to
427
+ * surface mid-navigation router state changes to the UI.
428
+ * - When set to `false`, the router will not leverage `React.startTransition` or
429
+ * `React.useOptimistic` on any navigations or state changes.
430
+ *
431
+ * For more information, please see the [docs](https://reactrouter.com/explanation/react-transitions).
432
+ */
433
+ unstable_useTransitions?: boolean;
434
+ }
435
+ /**
436
+ * Render the UI for the given {@link DataRouter}. This component should
437
+ * typically be at the top of an app's element tree.
438
+ *
439
+ * ```tsx
440
+ * import { createBrowserRouter } from "react-router";
441
+ * import { RouterProvider } from "react-router/dom";
442
+ * import { createRoot } from "react-dom/client";
443
+ *
444
+ * const router = createBrowserRouter(routes);
445
+ * createRoot(document.getElementById("root")).render(
446
+ * <RouterProvider router={router} />
447
+ * );
448
+ * ```
449
+ *
450
+ * <docs-info>Please note that this component is exported both from
451
+ * `react-router` and `react-router/dom` with the only difference being that the
452
+ * latter automatically wires up `react-dom`'s [`flushSync`](https://react.dev/reference/react-dom/flushSync)
453
+ * implementation. You _almost always_ want to use the version from
454
+ * `react-router/dom` unless you're running in a non-DOM environment.</docs-info>
455
+ *
456
+ *
457
+ * @public
458
+ * @category Data Routers
459
+ * @mode data
460
+ * @param props Props
461
+ * @param {RouterProviderProps.flushSync} props.flushSync n/a
462
+ * @param {RouterProviderProps.onError} props.onError n/a
463
+ * @param {RouterProviderProps.router} props.router n/a
464
+ * @param {RouterProviderProps.unstable_useTransitions} props.unstable_useTransitions n/a
465
+ * @returns React element for the rendered router
466
+ */
467
+ declare function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, onError, unstable_useTransitions, }: RouterProviderProps): React.ReactElement;
468
+ /**
469
+ * @category Types
470
+ */
471
+ interface MemoryRouterProps {
472
+ /**
473
+ * Application basename
474
+ */
475
+ basename?: string;
476
+ /**
477
+ * Nested {@link Route} elements describing the route tree
478
+ */
479
+ children?: React.ReactNode;
480
+ /**
481
+ * Initial entries in the in-memory history stack
482
+ */
483
+ initialEntries?: InitialEntry[];
484
+ /**
485
+ * Index of `initialEntries` the application should initialize to
486
+ */
487
+ initialIndex?: number;
488
+ /**
489
+ * Control whether router state updates are internally wrapped in
490
+ * [`React.startTransition`](https://react.dev/reference/react/startTransition).
491
+ *
492
+ * - When left `undefined`, all router state updates are wrapped in
493
+ * `React.startTransition`
494
+ * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped
495
+ * in `React.startTransition` and all router state updates are wrapped in
496
+ * `React.startTransition`
497
+ * - When set to `false`, the router will not leverage `React.startTransition`
498
+ * on any navigations or state changes.
499
+ *
500
+ * For more information, please see the [docs](https://reactrouter.com/explanation/react-transitions).
501
+ */
502
+ unstable_useTransitions?: boolean;
503
+ }
504
+ /**
505
+ * A declarative {@link Router | `<Router>`} that stores all entries in memory.
506
+ *
507
+ * @public
508
+ * @category Declarative Routers
509
+ * @mode declarative
510
+ * @param props Props
511
+ * @param {MemoryRouterProps.basename} props.basename n/a
512
+ * @param {MemoryRouterProps.children} props.children n/a
513
+ * @param {MemoryRouterProps.initialEntries} props.initialEntries n/a
514
+ * @param {MemoryRouterProps.initialIndex} props.initialIndex n/a
515
+ * @param {MemoryRouterProps.unstable_useTransitions} props.unstable_useTransitions n/a
516
+ * @returns A declarative in-memory {@link Router | `<Router>`} for client-side
517
+ * routing.
518
+ */
519
+ declare function MemoryRouter({ basename, children, initialEntries, initialIndex, unstable_useTransitions, }: MemoryRouterProps): React.ReactElement;
520
+ /**
521
+ * @category Types
522
+ */
523
+ interface NavigateProps {
524
+ /**
525
+ * The path to navigate to. This can be a string or a {@link Path} object
526
+ */
527
+ to: To;
528
+ /**
529
+ * Whether to replace the current entry in the [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
530
+ * stack
531
+ */
532
+ replace?: boolean;
533
+ /**
534
+ * State to pass to the new {@link Location} to store in [`history.state`](https://developer.mozilla.org/en-US/docs/Web/API/History/state).
535
+ */
536
+ state?: any;
537
+ /**
538
+ * How to interpret relative routing in the `to` prop.
539
+ * See {@link RelativeRoutingType}.
540
+ */
541
+ relative?: RelativeRoutingType;
542
+ }
543
+ /**
544
+ * A component-based version of {@link useNavigate} to use in a
545
+ * [`React.Component` class](https://react.dev/reference/react/Component) where
546
+ * hooks cannot be used.
547
+ *
548
+ * It's recommended to avoid using this component in favor of {@link useNavigate}.
549
+ *
550
+ * @example
551
+ * <Navigate to="/tasks" />
552
+ *
553
+ * @public
554
+ * @category Components
555
+ * @param props Props
556
+ * @param {NavigateProps.relative} props.relative n/a
557
+ * @param {NavigateProps.replace} props.replace n/a
558
+ * @param {NavigateProps.state} props.state n/a
559
+ * @param {NavigateProps.to} props.to n/a
560
+ * @returns {void}
561
+ *
562
+ */
563
+ declare function Navigate({ to, replace, state, relative, }: NavigateProps): null;
564
+ /**
565
+ * @category Types
566
+ */
567
+ interface OutletProps {
568
+ /**
569
+ * Provides a context value to the element tree below the outlet. Use when
570
+ * the parent route needs to provide values to child routes.
571
+ *
572
+ * ```tsx
573
+ * <Outlet context={myContextValue} />
574
+ * ```
575
+ *
576
+ * Access the context with {@link useOutletContext}.
577
+ */
578
+ context?: unknown;
579
+ }
580
+ /**
581
+ * Renders the matching child route of a parent route or nothing if no child
582
+ * route matches.
583
+ *
584
+ * @example
585
+ * import { Outlet } from "react-router";
586
+ *
587
+ * export default function SomeParent() {
588
+ * return (
589
+ * <div>
590
+ * <h1>Parent Content</h1>
591
+ * <Outlet />
592
+ * </div>
593
+ * );
594
+ * }
595
+ *
596
+ * @public
597
+ * @category Components
598
+ * @param props Props
599
+ * @param {OutletProps.context} props.context n/a
600
+ * @returns React element for the rendered outlet or `null` if no child route matches.
601
+ */
602
+ declare function Outlet(props: OutletProps): React.ReactElement | null;
603
+ /**
604
+ * @category Types
605
+ */
606
+ interface PathRouteProps {
607
+ /**
608
+ * Whether the path should be case-sensitive. Defaults to `false`.
609
+ */
610
+ caseSensitive?: NonIndexRouteObject["caseSensitive"];
611
+ /**
612
+ * The path pattern to match. If unspecified or empty, then this becomes a
613
+ * layout route.
614
+ */
615
+ path?: NonIndexRouteObject["path"];
616
+ /**
617
+ * The unique identifier for this route (for use with {@link DataRouter}s)
618
+ */
619
+ id?: NonIndexRouteObject["id"];
620
+ /**
621
+ * A function that returns a promise that resolves to the route object.
622
+ * Used for code-splitting routes.
623
+ * See [`lazy`](../../start/data/route-object#lazy).
624
+ */
625
+ lazy?: LazyRouteFunction<NonIndexRouteObject>;
626
+ /**
627
+ * The route middleware.
628
+ * See [`middleware`](../../start/data/route-object#middleware).
629
+ */
630
+ middleware?: NonIndexRouteObject["middleware"];
631
+ /**
632
+ * The route loader.
633
+ * See [`loader`](../../start/data/route-object#loader).
634
+ */
635
+ loader?: NonIndexRouteObject["loader"];
636
+ /**
637
+ * The route action.
638
+ * See [`action`](../../start/data/route-object#action).
639
+ */
640
+ action?: NonIndexRouteObject["action"];
641
+ hasErrorBoundary?: NonIndexRouteObject["hasErrorBoundary"];
642
+ /**
643
+ * The route shouldRevalidate function.
644
+ * See [`shouldRevalidate`](../../start/data/route-object#shouldRevalidate).
645
+ */
646
+ shouldRevalidate?: NonIndexRouteObject["shouldRevalidate"];
647
+ /**
648
+ * The route handle.
649
+ */
650
+ handle?: NonIndexRouteObject["handle"];
651
+ /**
652
+ * Whether this is an index route.
653
+ */
654
+ index?: false;
655
+ /**
656
+ * Child Route components
657
+ */
658
+ children?: React.ReactNode;
659
+ /**
660
+ * The React element to render when this Route matches.
661
+ * Mutually exclusive with `Component`.
662
+ */
663
+ element?: React.ReactNode | null;
664
+ /**
665
+ * The React element to render while this router is loading data.
666
+ * Mutually exclusive with `HydrateFallback`.
667
+ */
668
+ hydrateFallbackElement?: React.ReactNode | null;
669
+ /**
670
+ * The React element to render at this route if an error occurs.
671
+ * Mutually exclusive with `ErrorBoundary`.
672
+ */
673
+ errorElement?: React.ReactNode | null;
674
+ /**
675
+ * The React Component to render when this route matches.
676
+ * Mutually exclusive with `element`.
677
+ */
678
+ Component?: React.ComponentType | null;
679
+ /**
680
+ * The React Component to render while this router is loading data.
681
+ * Mutually exclusive with `hydrateFallbackElement`.
682
+ */
683
+ HydrateFallback?: React.ComponentType | null;
684
+ /**
685
+ * The React Component to render at this route if an error occurs.
686
+ * Mutually exclusive with `errorElement`.
687
+ */
688
+ ErrorBoundary?: React.ComponentType | null;
689
+ }
690
+ /**
691
+ * @category Types
692
+ */
693
+ interface LayoutRouteProps extends PathRouteProps {
694
+ }
695
+ /**
696
+ * @category Types
697
+ */
698
+ interface IndexRouteProps {
699
+ /**
700
+ * Whether the path should be case-sensitive. Defaults to `false`.
701
+ */
702
+ caseSensitive?: IndexRouteObject["caseSensitive"];
703
+ /**
704
+ * The path pattern to match. If unspecified or empty, then this becomes a
705
+ * layout route.
706
+ */
707
+ path?: IndexRouteObject["path"];
708
+ /**
709
+ * The unique identifier for this route (for use with {@link DataRouter}s)
710
+ */
711
+ id?: IndexRouteObject["id"];
712
+ /**
713
+ * A function that returns a promise that resolves to the route object.
714
+ * Used for code-splitting routes.
715
+ * See [`lazy`](../../start/data/route-object#lazy).
716
+ */
717
+ lazy?: LazyRouteFunction<IndexRouteObject>;
718
+ /**
719
+ * The route middleware.
720
+ * See [`middleware`](../../start/data/route-object#middleware).
721
+ */
722
+ middleware?: IndexRouteObject["middleware"];
723
+ /**
724
+ * The route loader.
725
+ * See [`loader`](../../start/data/route-object#loader).
726
+ */
727
+ loader?: IndexRouteObject["loader"];
728
+ /**
729
+ * The route action.
730
+ * See [`action`](../../start/data/route-object#action).
731
+ */
732
+ action?: IndexRouteObject["action"];
733
+ hasErrorBoundary?: IndexRouteObject["hasErrorBoundary"];
734
+ /**
735
+ * The route shouldRevalidate function.
736
+ * See [`shouldRevalidate`](../../start/data/route-object#shouldRevalidate).
737
+ */
738
+ shouldRevalidate?: IndexRouteObject["shouldRevalidate"];
739
+ /**
740
+ * The route handle.
741
+ */
742
+ handle?: IndexRouteObject["handle"];
743
+ /**
744
+ * Whether this is an index route.
745
+ */
746
+ index: true;
747
+ /**
748
+ * Child Route components
749
+ */
750
+ children?: undefined;
751
+ /**
752
+ * The React element to render when this Route matches.
753
+ * Mutually exclusive with `Component`.
754
+ */
755
+ element?: React.ReactNode | null;
756
+ /**
757
+ * The React element to render while this router is loading data.
758
+ * Mutually exclusive with `HydrateFallback`.
759
+ */
760
+ hydrateFallbackElement?: React.ReactNode | null;
761
+ /**
762
+ * The React element to render at this route if an error occurs.
763
+ * Mutually exclusive with `ErrorBoundary`.
764
+ */
765
+ errorElement?: React.ReactNode | null;
766
+ /**
767
+ * The React Component to render when this route matches.
768
+ * Mutually exclusive with `element`.
769
+ */
770
+ Component?: React.ComponentType | null;
771
+ /**
772
+ * The React Component to render while this router is loading data.
773
+ * Mutually exclusive with `hydrateFallbackElement`.
774
+ */
775
+ HydrateFallback?: React.ComponentType | null;
776
+ /**
777
+ * The React Component to render at this route if an error occurs.
778
+ * Mutually exclusive with `errorElement`.
779
+ */
780
+ ErrorBoundary?: React.ComponentType | null;
781
+ }
782
+ /**
783
+ * @category Types
784
+ */
785
+ type RouteProps = PathRouteProps | LayoutRouteProps | IndexRouteProps;
786
+ /**
787
+ * Configures an element to render when a pattern matches the current location.
788
+ * It must be rendered within a {@link Routes} element. Note that these routes
789
+ * do not participate in data loading, actions, code splitting, or any other
790
+ * route module features.
791
+ *
792
+ * @example
793
+ * // Usually used in a declarative router
794
+ * function App() {
795
+ * return (
796
+ * <BrowserRouter>
797
+ * <Routes>
798
+ * <Route index element={<StepOne />} />
799
+ * <Route path="step-2" element={<StepTwo />} />
800
+ * <Route path="step-3" element={<StepThree />} />
801
+ * </Routes>
802
+ * </BrowserRouter>
803
+ * );
804
+ * }
805
+ *
806
+ * // But can be used with a data router as well if you prefer the JSX notation
807
+ * const routes = createRoutesFromElements(
808
+ * <>
809
+ * <Route index loader={step1Loader} Component={StepOne} />
810
+ * <Route path="step-2" loader={step2Loader} Component={StepTwo} />
811
+ * <Route path="step-3" loader={step3Loader} Component={StepThree} />
812
+ * </>
813
+ * );
814
+ *
815
+ * const router = createBrowserRouter(routes);
816
+ *
817
+ * function App() {
818
+ * return <RouterProvider router={router} />;
819
+ * }
820
+ *
821
+ * @public
822
+ * @category Components
823
+ * @param props Props
824
+ * @param {PathRouteProps.action} props.action n/a
825
+ * @param {PathRouteProps.caseSensitive} props.caseSensitive n/a
826
+ * @param {PathRouteProps.Component} props.Component n/a
827
+ * @param {PathRouteProps.children} props.children n/a
828
+ * @param {PathRouteProps.element} props.element n/a
829
+ * @param {PathRouteProps.ErrorBoundary} props.ErrorBoundary n/a
830
+ * @param {PathRouteProps.errorElement} props.errorElement n/a
831
+ * @param {PathRouteProps.handle} props.handle n/a
832
+ * @param {PathRouteProps.HydrateFallback} props.HydrateFallback n/a
833
+ * @param {PathRouteProps.hydrateFallbackElement} props.hydrateFallbackElement n/a
834
+ * @param {PathRouteProps.id} props.id n/a
835
+ * @param {PathRouteProps.index} props.index n/a
836
+ * @param {PathRouteProps.lazy} props.lazy n/a
837
+ * @param {PathRouteProps.loader} props.loader n/a
838
+ * @param {PathRouteProps.path} props.path n/a
839
+ * @param {PathRouteProps.shouldRevalidate} props.shouldRevalidate n/a
840
+ * @returns {void}
841
+ */
842
+ declare function Route(props: RouteProps): React.ReactElement | null;
843
+ /**
844
+ * @category Types
845
+ */
846
+ interface RouterProps {
847
+ /**
848
+ * The base path for the application. This is prepended to all locations
849
+ */
850
+ basename?: string;
851
+ /**
852
+ * Nested {@link Route} elements describing the route tree
853
+ */
854
+ children?: React.ReactNode;
855
+ /**
856
+ * The location to match against. Defaults to the current location.
857
+ * This can be a string or a {@link Location} object.
858
+ */
859
+ location: Partial<Location> | string;
860
+ /**
861
+ * The type of navigation that triggered this `location` change.
862
+ * Defaults to {@link NavigationType.Pop}.
863
+ */
864
+ navigationType?: Action;
865
+ /**
866
+ * The navigator to use for navigation. This is usually a history object
867
+ * or a custom navigator that implements the {@link Navigator} interface.
868
+ */
869
+ navigator: Navigator;
870
+ /**
871
+ * Whether this router is static or not (used for SSR). If `true`, the router
872
+ * will not be reactive to location changes.
873
+ */
874
+ static?: boolean;
875
+ /**
876
+ * Control whether router state updates are internally wrapped in
877
+ * [`React.startTransition`](https://react.dev/reference/react/startTransition).
878
+ *
879
+ * - When left `undefined`, all router state updates are wrapped in
880
+ * `React.startTransition`
881
+ * - When set to `true`, {@link Link} and {@link Form} navigations will be wrapped
882
+ * in `React.startTransition` and all router state updates are wrapped in
883
+ * `React.startTransition`
884
+ * - When set to `false`, the router will not leverage `React.startTransition`
885
+ * on any navigations or state changes.
886
+ *
887
+ * For more information, please see the [docs](https://reactrouter.com/explanation/react-transitions).
888
+ */
889
+ unstable_useTransitions?: boolean;
890
+ }
891
+ /**
892
+ * Provides location context for the rest of the app.
893
+ *
894
+ * Note: You usually won't render a `<Router>` directly. Instead, you'll render a
895
+ * router that is more specific to your environment such as a {@link BrowserRouter}
896
+ * in web browsers or a {@link ServerRouter} for server rendering.
897
+ *
898
+ * @public
899
+ * @category Declarative Routers
900
+ * @mode declarative
901
+ * @param props Props
902
+ * @param {RouterProps.basename} props.basename n/a
903
+ * @param {RouterProps.children} props.children n/a
904
+ * @param {RouterProps.location} props.location n/a
905
+ * @param {RouterProps.navigationType} props.navigationType n/a
906
+ * @param {RouterProps.navigator} props.navigator n/a
907
+ * @param {RouterProps.static} props.static n/a
908
+ * @param {RouterProps.unstable_useTransitions} props.unstable_useTransitions n/a
909
+ * @returns React element for the rendered router or `null` if the location does
910
+ * not match the {@link props.basename}
911
+ */
912
+ declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, unstable_useTransitions, }: RouterProps): React.ReactElement | null;
913
+ /**
914
+ * @category Types
915
+ */
916
+ interface RoutesProps {
917
+ /**
918
+ * Nested {@link Route} elements
919
+ */
920
+ children?: React.ReactNode;
921
+ /**
922
+ * The {@link Location} to match against. Defaults to the current location.
923
+ */
924
+ location?: Partial<Location> | string;
925
+ }
926
+ /**
927
+ * Renders a branch of {@link Route | `<Route>`s} that best matches the current
928
+ * location. Note that these routes do not participate in [data loading](../../start/framework/route-module#loader),
929
+ * [`action`](../../start/framework/route-module#action), code splitting, or
930
+ * any other [route module](../../start/framework/route-module) features.
931
+ *
932
+ * @example
933
+ * import { Route, Routes } from "react-router";
934
+ *
935
+ * <Routes>
936
+ * <Route index element={<StepOne />} />
937
+ * <Route path="step-2" element={<StepTwo />} />
938
+ * <Route path="step-3" element={<StepThree />} />
939
+ * </Routes>
940
+ *
941
+ * @public
942
+ * @category Components
943
+ * @param props Props
944
+ * @param {RoutesProps.children} props.children n/a
945
+ * @param {RoutesProps.location} props.location n/a
946
+ * @returns React element for the rendered routes or `null` if no route matches
947
+ */
948
+ declare function Routes({ children, location, }: RoutesProps): React.ReactElement | null;
949
+ interface AwaitResolveRenderFunction<Resolve = any> {
950
+ (data: Awaited<Resolve>): React.ReactNode;
951
+ }
952
+ /**
953
+ * @category Types
954
+ */
955
+ interface AwaitProps<Resolve> {
956
+ /**
957
+ * When using a function, the resolved value is provided as the parameter.
958
+ *
959
+ * ```tsx [2]
960
+ * <Await resolve={reviewsPromise}>
961
+ * {(resolvedReviews) => <Reviews items={resolvedReviews} />}
962
+ * </Await>
963
+ * ```
964
+ *
965
+ * When using React elements, {@link useAsyncValue} will provide the
966
+ * resolved value:
967
+ *
968
+ * ```tsx [2]
969
+ * <Await resolve={reviewsPromise}>
970
+ * <Reviews />
971
+ * </Await>
972
+ *
973
+ * function Reviews() {
974
+ * const resolvedReviews = useAsyncValue();
975
+ * return <div>...</div>;
976
+ * }
977
+ * ```
978
+ */
979
+ children: React.ReactNode | AwaitResolveRenderFunction<Resolve>;
980
+ /**
981
+ * The error element renders instead of the `children` when the [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
982
+ * rejects.
983
+ *
984
+ * ```tsx
985
+ * <Await
986
+ * errorElement={<div>Oops</div>}
987
+ * resolve={reviewsPromise}
988
+ * >
989
+ * <Reviews />
990
+ * </Await>
991
+ * ```
992
+ *
993
+ * To provide a more contextual error, you can use the {@link useAsyncError} in a
994
+ * child component
995
+ *
996
+ * ```tsx
997
+ * <Await
998
+ * errorElement={<ReviewsError />}
999
+ * resolve={reviewsPromise}
1000
+ * >
1001
+ * <Reviews />
1002
+ * </Await>
1003
+ *
1004
+ * function ReviewsError() {
1005
+ * const error = useAsyncError();
1006
+ * return <div>Error loading reviews: {error.message}</div>;
1007
+ * }
1008
+ * ```
1009
+ *
1010
+ * If you do not provide an `errorElement`, the rejected value will bubble up
1011
+ * to the nearest route-level [`ErrorBoundary`](../../start/framework/route-module#errorboundary)
1012
+ * and be accessible via the {@link useRouteError} hook.
1013
+ */
1014
+ errorElement?: React.ReactNode;
1015
+ /**
1016
+ * Takes a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
1017
+ * returned from a [`loader`](../../start/framework/route-module#loader) to be
1018
+ * resolved and rendered.
1019
+ *
1020
+ * ```tsx
1021
+ * import { Await, useLoaderData } from "react-router";
1022
+ *
1023
+ * export async function loader() {
1024
+ * let reviews = getReviews(); // not awaited
1025
+ * let book = await getBook();
1026
+ * return {
1027
+ * book,
1028
+ * reviews, // this is a promise
1029
+ * };
1030
+ * }
1031
+ *
1032
+ * export default function Book() {
1033
+ * const {
1034
+ * book,
1035
+ * reviews, // this is the same promise
1036
+ * } = useLoaderData();
1037
+ *
1038
+ * return (
1039
+ * <div>
1040
+ * <h1>{book.title}</h1>
1041
+ * <p>{book.description}</p>
1042
+ * <React.Suspense fallback={<ReviewsSkeleton />}>
1043
+ * <Await
1044
+ * // and is the promise we pass to Await
1045
+ * resolve={reviews}
1046
+ * >
1047
+ * <Reviews />
1048
+ * </Await>
1049
+ * </React.Suspense>
1050
+ * </div>
1051
+ * );
1052
+ * }
1053
+ * ```
1054
+ */
1055
+ resolve: Resolve;
1056
+ }
1057
+ /**
1058
+ * Used to render promise values with automatic error handling.
1059
+ *
1060
+ * **Note:** `<Await>` expects to be rendered inside a [`<React.Suspense>`](https://react.dev/reference/react/Suspense)
1061
+ *
1062
+ * @example
1063
+ * import { Await, useLoaderData } from "react-router";
1064
+ *
1065
+ * export async function loader() {
1066
+ * // not awaited
1067
+ * const reviews = getReviews();
1068
+ * // awaited (blocks the transition)
1069
+ * const book = await fetch("/api/book").then((res) => res.json());
1070
+ * return { book, reviews };
1071
+ * }
1072
+ *
1073
+ * function Book() {
1074
+ * const { book, reviews } = useLoaderData();
1075
+ * return (
1076
+ * <div>
1077
+ * <h1>{book.title}</h1>
1078
+ * <p>{book.description}</p>
1079
+ * <React.Suspense fallback={<ReviewsSkeleton />}>
1080
+ * <Await
1081
+ * resolve={reviews}
1082
+ * errorElement={
1083
+ * <div>Could not load reviews 😬</div>
1084
+ * }
1085
+ * children={(resolvedReviews) => (
1086
+ * <Reviews items={resolvedReviews} />
1087
+ * )}
1088
+ * />
1089
+ * </React.Suspense>
1090
+ * </div>
1091
+ * );
1092
+ * }
1093
+ *
1094
+ * @public
1095
+ * @category Components
1096
+ * @mode framework
1097
+ * @mode data
1098
+ * @param props Props
1099
+ * @param {AwaitProps.children} props.children n/a
1100
+ * @param {AwaitProps.errorElement} props.errorElement n/a
1101
+ * @param {AwaitProps.resolve} props.resolve n/a
1102
+ * @returns React element for the rendered awaited value
1103
+ */
1104
+ declare function Await<Resolve>({ children, errorElement, resolve, }: AwaitProps<Resolve>): React.JSX.Element;
1105
+ /**
1106
+ * Creates a route config from a React "children" object, which is usually
1107
+ * either a `<Route>` element or an array of them. Used internally by
1108
+ * `<Routes>` to create a route config from its children.
1109
+ *
1110
+ * @category Utils
1111
+ * @mode data
1112
+ * @param children The React children to convert into a route config
1113
+ * @param parentPath The path of the parent route, used to generate unique IDs.
1114
+ * @returns An array of {@link RouteObject}s that can be used with a {@link DataRouter}
1115
+ */
1116
+ declare function createRoutesFromChildren(children: React.ReactNode, parentPath?: number[]): RouteObject[];
1117
+ /**
1118
+ * Create route objects from JSX elements instead of arrays of objects.
1119
+ *
1120
+ * @example
1121
+ * const routes = createRoutesFromElements(
1122
+ * <>
1123
+ * <Route index loader={step1Loader} Component={StepOne} />
1124
+ * <Route path="step-2" loader={step2Loader} Component={StepTwo} />
1125
+ * <Route path="step-3" loader={step3Loader} Component={StepThree} />
1126
+ * </>
1127
+ * );
1128
+ *
1129
+ * const router = createBrowserRouter(routes);
1130
+ *
1131
+ * function App() {
1132
+ * return <RouterProvider router={router} />;
1133
+ * }
1134
+ *
1135
+ * @name createRoutesFromElements
1136
+ * @public
1137
+ * @category Utils
1138
+ * @mode data
1139
+ * @param children The React children to convert into a route config
1140
+ * @param parentPath The path of the parent route, used to generate unique IDs.
1141
+ * This is used for internal recursion and is not intended to be used by the
1142
+ * application developer.
1143
+ * @returns An array of {@link RouteObject}s that can be used with a {@link DataRouter}
1144
+ */
1145
+ declare const createRoutesFromElements: typeof createRoutesFromChildren;
1146
+ /**
1147
+ * Renders the result of {@link matchRoutes} into a React element.
1148
+ *
1149
+ * @public
1150
+ * @category Utils
1151
+ * @param matches The array of {@link RouteMatch | route matches} to render
1152
+ * @returns A React element that renders the matched routes or `null` if no matches
1153
+ */
1154
+ declare function renderMatches(matches: RouteMatch[] | null): React.ReactElement | null;
1155
+ declare function useRouteComponentProps(): {
1156
+ params: Readonly<Params<string>>;
1157
+ loaderData: any;
1158
+ actionData: any;
1159
+ matches: UIMatch<unknown, unknown>[];
1160
+ };
1161
+ type RouteComponentProps = ReturnType<typeof useRouteComponentProps>;
1162
+ type RouteComponentType = React.ComponentType<RouteComponentProps>;
1163
+ declare function WithComponentProps({ children, }: {
1164
+ children: React.ReactElement;
1165
+ }): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
1166
+ declare function withComponentProps(Component: RouteComponentType): () => React.ReactElement<{
1167
+ params: Readonly<Params<string>>;
1168
+ loaderData: any;
1169
+ actionData: any;
1170
+ matches: UIMatch<unknown, unknown>[];
1171
+ }, string | React.JSXElementConstructor<any>>;
1172
+ declare function useHydrateFallbackProps(): {
1173
+ params: Readonly<Params<string>>;
1174
+ loaderData: any;
1175
+ actionData: any;
1176
+ };
1177
+ type HydrateFallbackProps = ReturnType<typeof useHydrateFallbackProps>;
1178
+ type HydrateFallbackType = React.ComponentType<HydrateFallbackProps>;
1179
+ declare function WithHydrateFallbackProps({ children, }: {
1180
+ children: React.ReactElement;
1181
+ }): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
1182
+ declare function withHydrateFallbackProps(HydrateFallback: HydrateFallbackType): () => React.ReactElement<{
1183
+ params: Readonly<Params<string>>;
1184
+ loaderData: any;
1185
+ actionData: any;
1186
+ }, string | React.JSXElementConstructor<any>>;
1187
+ declare function useErrorBoundaryProps(): {
1188
+ params: Readonly<Params<string>>;
1189
+ loaderData: any;
1190
+ actionData: any;
1191
+ error: unknown;
1192
+ };
1193
+ type ErrorBoundaryProps = ReturnType<typeof useErrorBoundaryProps>;
1194
+ type ErrorBoundaryType = React.ComponentType<ErrorBoundaryProps>;
1195
+ declare function WithErrorBoundaryProps({ children, }: {
1196
+ children: React.ReactElement;
1197
+ }): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
1198
+ declare function withErrorBoundaryProps(ErrorBoundary: ErrorBoundaryType): () => React.ReactElement<{
1199
+ params: Readonly<Params<string>>;
1200
+ loaderData: any;
1201
+ actionData: any;
1202
+ error: unknown;
1203
+ }, string | React.JSXElementConstructor<any>>;
1204
+
148
1205
  type ParamKeyValuePair = [string, string];
149
1206
  type URLSearchParamsInit = string | ParamKeyValuePair[] | Record<string, string | string[]> | URLSearchParams;
150
1207
  /**
@@ -954,7 +2011,7 @@ interface DOMRouterOpts {
954
2011
  * @param {DOMRouterOpts.window} opts.window n/a
955
2012
  * @returns An initialized {@link DataRouter| data router} to pass to {@link RouterProvider | `<RouterProvider>`}
956
2013
  */
957
- declare function createBrowserRouter(routes: RouteObject[], opts?: DOMRouterOpts): Router;
2014
+ declare function createBrowserRouter(routes: RouteObject[], opts?: DOMRouterOpts): Router$1;
958
2015
  /**
959
2016
  * Create a new {@link DataRouter| data router} that manages the application
960
2017
  * path via the URL [`hash`](https://developer.mozilla.org/en-US/docs/Web/API/URL/hash).
@@ -974,7 +2031,7 @@ declare function createBrowserRouter(routes: RouteObject[], opts?: DOMRouterOpts
974
2031
  * @param {DOMRouterOpts.window} opts.window n/a
975
2032
  * @returns An initialized {@link DataRouter| data router} to pass to {@link RouterProvider | `<RouterProvider>`}
976
2033
  */
977
- declare function createHashRouter(routes: RouteObject[], opts?: DOMRouterOpts): Router;
2034
+ declare function createHashRouter(routes: RouteObject[], opts?: DOMRouterOpts): Router$1;
978
2035
  /**
979
2036
  * @category Types
980
2037
  */
@@ -1305,7 +2362,7 @@ interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>,
1305
2362
  */
1306
2363
  unstable_defaultShouldRevalidate?: boolean;
1307
2364
  /**
1308
- * Masked path for for this navigation, when you want to navigate the router to
2365
+ * Masked path for this navigation, when you want to navigate the router to
1309
2366
  * one location but display a separate location in the URL bar.
1310
2367
  *
1311
2368
  * This is useful for contextual navigations such as opening an image in a modal
@@ -2475,7 +3532,7 @@ interface StaticRouterProviderProps {
2475
3532
  /**
2476
3533
  * The static {@link DataRouter} from {@link createStaticRouter}
2477
3534
  */
2478
- router: Router;
3535
+ router: Router$1;
2479
3536
  /**
2480
3537
  * Whether to hydrate the router on the client (default `true`)
2481
3538
  */
@@ -2581,6 +3638,6 @@ declare function createStaticHandler(routes: RouteObject[], opts?: CreateStaticH
2581
3638
  */
2582
3639
  declare function createStaticRouter(routes: RouteObject[], context: StaticHandlerContext, opts?: {
2583
3640
  future?: Partial<FutureConfig$1>;
2584
- }): Router;
3641
+ }): Router$1;
2585
3642
 
2586
- export { type ScriptsProps as $, type AssetsManifest as A, type BrowserRouterProps as B, useViewTransitionState as C, type DOMRouterOpts as D, type EntryContext as E, type FutureConfig as F, type FetcherSubmitOptions as G, type HashRouterProps as H, type SubmitOptions as I, type SubmitTarget as J, createSearchParams as K, type LinkProps as L, type StaticRouterProps as M, type NavLinkProps as N, type StaticRouterProviderProps as O, type ParamKeyValuePair as P, createStaticHandler as Q, createStaticRouter as R, type ServerBuild as S, StaticRouter as T, type URLSearchParamsInit as U, StaticRouterProvider as V, Meta as W, Links as X, Scripts as Y, PrefetchPageLinks as Z, type LinksProps as _, type HistoryRouterProps as a, type PrefetchBehavior as a0, type DiscoverBehavior as a1, type HandleDataRequestFunction as a2, type HandleDocumentRequestFunction as a3, type HandleErrorFunction as a4, type ServerEntryModule as a5, FrameworkContext as a6, createClientRoutes as a7, createClientRoutesWithHMRRevalidationOptOut as a8, shouldHydrateRouteLoader as a9, useScrollRestoration as aa, type NavLinkRenderProps as b, type FetcherFormProps as c, type FormProps as d, type ScrollRestorationProps as e, type SetURLSearchParams as f, type SubmitFunction as g, type FetcherSubmitFunction as h, type FetcherWithComponents as i, createBrowserRouter as j, createHashRouter as k, BrowserRouter as l, HashRouter as m, Link as n, HistoryRouter as o, NavLink as p, Form as q, ScrollRestoration as r, useSearchParams as s, useSubmit as t, useLinkClickHandler as u, useFormAction as v, useFetcher as w, useFetchers as x, useBeforeUnload as y, usePrompt as z };
3643
+ export { Form as $, type AssetsManifest as A, type BrowserRouterProps as B, type ClientOnErrorFunction as C, type DOMRouterOpts as D, type EntryContext as E, type FutureConfig as F, type ScrollRestorationProps as G, type HashRouterProps as H, type IndexRouteProps as I, type SetURLSearchParams as J, type SubmitFunction as K, type LayoutRouteProps as L, type MemoryRouterOpts as M, type NavigateOptions as N, type OutletProps as O, type PathRouteProps as P, type FetcherSubmitFunction as Q, type RouteProps as R, type ServerBuild as S, type FetcherWithComponents as T, createBrowserRouter as U, createHashRouter as V, BrowserRouter as W, HashRouter as X, Link as Y, HistoryRouter as Z, NavLink as _, type Navigator as a, ScrollRestoration as a0, useLinkClickHandler as a1, useSearchParams as a2, useSubmit as a3, useFormAction as a4, useFetcher as a5, useFetchers as a6, useBeforeUnload as a7, usePrompt as a8, useViewTransitionState as a9, FetchersContext as aA, LocationContext as aB, NavigationContext as aC, RouteContext as aD, ViewTransitionContext as aE, hydrationRouteProperties as aF, mapRouteProperties as aG, WithComponentProps as aH, withComponentProps as aI, WithHydrateFallbackProps as aJ, withHydrateFallbackProps as aK, WithErrorBoundaryProps as aL, withErrorBoundaryProps as aM, FrameworkContext as aN, createClientRoutes as aO, createClientRoutesWithHMRRevalidationOptOut as aP, shouldHydrateRouteLoader as aQ, useScrollRestoration as aR, type FetcherSubmitOptions as aa, type ParamKeyValuePair as ab, type SubmitOptions as ac, type URLSearchParamsInit as ad, type SubmitTarget as ae, createSearchParams as af, type StaticRouterProps as ag, type StaticRouterProviderProps as ah, createStaticHandler as ai, createStaticRouter as aj, StaticRouter as ak, StaticRouterProvider as al, Meta as am, Links as an, Scripts as ao, PrefetchPageLinks as ap, type LinksProps as aq, type ScriptsProps as ar, type PrefetchBehavior as as, type DiscoverBehavior as at, type HandleDataRequestFunction as au, type HandleDocumentRequestFunction as av, type HandleErrorFunction as aw, type ServerEntryModule as ax, DataRouterContext as ay, DataRouterStateContext as az, AwaitContextProvider as b, type AwaitProps as c, type MemoryRouterProps as d, type NavigateProps as e, type RouterProps as f, type RouterProviderProps as g, type RoutesProps as h, Await as i, MemoryRouter as j, Navigate as k, Outlet as l, Route as m, Router as n, RouterProvider as o, Routes as p, createMemoryRouter as q, createRoutesFromChildren as r, createRoutesFromElements as s, renderMatches as t, type HistoryRouterProps as u, type LinkProps as v, type NavLinkProps as w, type NavLinkRenderProps as x, type FetcherFormProps as y, type FormProps as z };