xladmin-react-router 0.3.0 → 0.3.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.
package/README.md CHANGED
@@ -20,12 +20,12 @@ npm install xladmin xladmin-react-router react-router-dom
20
20
  ## Usage
21
21
 
22
22
  ```tsx
23
- import {Shell, createFetchXLAdminClient} from 'xladmin';
24
- import {useReactRouterXLAdminRouter} from 'xladmin-react-router';
23
+ import {Shell, createFetchAdminClient} from 'xladmin';
24
+ import {useReactRouterAdminRouter} from 'xladmin-react-router';
25
25
 
26
26
  export function AdminShell({models, blocks}) {
27
- const client = createFetchXLAdminClient({baseUrl: '/api/admin'});
28
- const router = useReactRouterXLAdminRouter();
27
+ const client = createFetchAdminClient({baseUrl: '/api/admin'});
28
+ const router = useReactRouterAdminRouter();
29
29
 
30
30
  return (
31
31
  <Shell client={client} models={models} blocks={blocks} basePath="/admin" locale="en" router={router}>
@@ -37,8 +37,8 @@ export function AdminShell({models, blocks}) {
37
37
 
38
38
  ## Exports
39
39
 
40
- - `useReactRouterXLAdminRouter()`
41
- - `createReactRouterXLAdminRouter(...)`
40
+ - `useReactRouterAdminRouter()`
41
+ - `createReactRouterAdminRouter(...)`
42
42
 
43
43
  ## Docs
44
44
 
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { XLAdminRouter } from 'xladmin';
1
+ import { AdminRouter } from 'xladmin';
2
2
 
3
- type ReactRouterXLAdminAdapter = {
3
+ type ReactRouterAdminAdapter = {
4
4
  pathname: string;
5
5
  search: string;
6
6
  push: (href: string) => void;
7
7
  replace: (href: string) => void;
8
8
  back: () => void;
9
9
  };
10
- declare function createReactRouterXLAdminRouter(adapter: ReactRouterXLAdminAdapter): XLAdminRouter;
11
- declare function useReactRouterXLAdminRouter(): XLAdminRouter;
10
+ declare function createReactRouterAdminRouter(adapter: ReactRouterAdminAdapter): AdminRouter;
11
+ declare function useReactRouterAdminRouter(): AdminRouter;
12
12
 
13
- export { type ReactRouterXLAdminAdapter, createReactRouterXLAdminRouter, useReactRouterXLAdminRouter };
13
+ export { type ReactRouterAdminAdapter, createReactRouterAdminRouter, useReactRouterAdminRouter };
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // src/index.tsx
4
4
  import { useEffect, useRef } from "react";
5
5
  import { useLocation, useNavigate } from "react-router-dom";
6
- function createReactRouterXLAdminRouter(adapter) {
6
+ function createReactRouterAdminRouter(adapter) {
7
7
  return {
8
8
  getLocation: () => ({
9
9
  pathname: adapter.pathname,
@@ -22,7 +22,7 @@ function createReactRouterXLAdminRouter(adapter) {
22
22
  }
23
23
  };
24
24
  }
25
- function useReactRouterXLAdminRouter() {
25
+ function useReactRouterAdminRouter() {
26
26
  const location = useLocation();
27
27
  const navigate = useNavigate();
28
28
  const listenersRef = useRef(/* @__PURE__ */ new Set());
@@ -39,7 +39,7 @@ function useReactRouterXLAdminRouter() {
39
39
  };
40
40
  navigateRef.current = navigate;
41
41
  if (routerRef.current === null) {
42
- routerRef.current = createReactRouterXLAdminRouter({
42
+ routerRef.current = createReactRouterAdminRouter({
43
43
  pathname: locationRef.current.pathname,
44
44
  search: locationRef.current.search,
45
45
  push: (href) => {
@@ -76,6 +76,6 @@ function useReactRouterXLAdminRouter() {
76
76
  return routerRef.current;
77
77
  }
78
78
  export {
79
- createReactRouterXLAdminRouter,
80
- useReactRouterXLAdminRouter
79
+ createReactRouterAdminRouter,
80
+ useReactRouterAdminRouter
81
81
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xladmin-react-router",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "React Router adapter for xladmin.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -39,6 +39,6 @@
39
39
  "react": ">=19.0.0 <20.0.0",
40
40
  "react-dom": ">=19.0.0 <20.0.0",
41
41
  "react-router-dom": ">=6.4.0 <8.0.0",
42
- "xladmin": "^0.3.0"
42
+ "xladmin": "^0.3.2"
43
43
  }
44
44
  }