@starasia/admin 8.32.0 → 10.0.0
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/dist/adapters/react-router.cjs.js +1 -0
- package/dist/adapters/react-router.d.ts +12 -0
- package/dist/adapters/react-router.es.js +24 -0
- package/dist/adapters/tanstack.cjs.js +1 -0
- package/dist/adapters/tanstack.d.ts +20 -0
- package/dist/adapters/tanstack.es.js +42 -0
- package/dist/components/AdvanceFilterBar/types.d.ts +2 -2
- package/dist/entries/App/index.d.ts +10 -2
- package/dist/hooks/useRouteInfo.d.ts +3 -3
- package/dist/hooks/useRouteParams.d.ts +3 -3
- package/dist/index.cjs.js +5 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +3283 -3271
- package/dist/index.umd.js +16 -16
- package/dist/router/index.d.ts +2 -0
- package/dist/router/provider.d.ts +17 -0
- package/dist/router/types.d.ts +54 -0
- package/package.json +34 -4
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React, PropsWithChildren } from 'react';
|
|
2
|
+
import { StarasiaRouterAdapter } from './types';
|
|
3
|
+
|
|
4
|
+
export type StarasiaRouterProviderProps = PropsWithChildren<{
|
|
5
|
+
adapter: StarasiaRouterAdapter;
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* Menyediakan router adapter ke seluruh komponen @starasia/admin.
|
|
9
|
+
* Biasanya tidak dipakai langsung — `<App routerAdapter={...} />` sudah
|
|
10
|
+
* membungkus app dengan provider ini secara otomatis.
|
|
11
|
+
*/
|
|
12
|
+
export declare const StarasiaRouterProvider: ({ adapter, children, }: StarasiaRouterProviderProps) => React.JSX.Element;
|
|
13
|
+
/**
|
|
14
|
+
* Mengambil router adapter aktif. Throw kalau belum dipasang supaya
|
|
15
|
+
* kesalahan setup ketahuan lebih awal dan jelas.
|
|
16
|
+
*/
|
|
17
|
+
export declare const useRouterAdapter: () => StarasiaRouterAdapter;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ComponentType, CSSProperties, ReactNode, MouseEvent } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Bentuk lokasi minimal yang dibutuhkan komponen @starasia/admin.
|
|
5
|
+
* Sengaja string-based (lowest common denominator) supaya bisa dipetakan
|
|
6
|
+
* dari router apa pun (react-router, TanStack Router, dll).
|
|
7
|
+
*/
|
|
8
|
+
export interface RouterLocation {
|
|
9
|
+
pathname: string;
|
|
10
|
+
search: string;
|
|
11
|
+
hash: string;
|
|
12
|
+
state?: unknown;
|
|
13
|
+
key?: string;
|
|
14
|
+
}
|
|
15
|
+
/** Target navigasi: path string, atau angka untuk history back/forward. */
|
|
16
|
+
export type NavigateTo = string | number;
|
|
17
|
+
export interface NavigateOptions {
|
|
18
|
+
replace?: boolean;
|
|
19
|
+
state?: unknown;
|
|
20
|
+
}
|
|
21
|
+
export type SearchParamsInit = string | URLSearchParams | Record<string, string | string[]> | Array<[string, string]>;
|
|
22
|
+
/**
|
|
23
|
+
* Pengganti router-agnostic untuk `SetURLSearchParams` milik react-router.
|
|
24
|
+
* Signature dibuat kompatibel dengan pemakaian existing
|
|
25
|
+
* (`setSearchParams({ ...obj })` dan `setSearchParams(prev => ...)`).
|
|
26
|
+
*/
|
|
27
|
+
export type SetSearchParams = (next?: SearchParamsInit | ((prev: URLSearchParams) => SearchParamsInit), opts?: NavigateOptions) => void;
|
|
28
|
+
export interface RouterLinkProps {
|
|
29
|
+
to: string;
|
|
30
|
+
replace?: boolean;
|
|
31
|
+
state?: unknown;
|
|
32
|
+
style?: CSSProperties;
|
|
33
|
+
className?: string;
|
|
34
|
+
children?: ReactNode;
|
|
35
|
+
onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Kontrak router yang dikonsumsi @starasia/admin. Consumer menyediakan
|
|
40
|
+
* implementasinya lewat `<App routerAdapter={...} />` atau
|
|
41
|
+
* `<StarasiaRouterProvider adapter={...}>`.
|
|
42
|
+
*
|
|
43
|
+
* Adapter siap pakai:
|
|
44
|
+
* import { reactRouterAdapter } from "@starasia/admin/adapters/react-router";
|
|
45
|
+
* import { tanstackAdapter } from "@starasia/admin/adapters/tanstack";
|
|
46
|
+
*/
|
|
47
|
+
export interface StarasiaRouterAdapter {
|
|
48
|
+
useLocation: () => RouterLocation;
|
|
49
|
+
useParams: () => Record<string, string | undefined>;
|
|
50
|
+
useSearchParams: () => [URLSearchParams, SetSearchParams];
|
|
51
|
+
useNavigate: () => (to: NavigateTo, opts?: NavigateOptions) => void;
|
|
52
|
+
Link: ComponentType<RouterLinkProps>;
|
|
53
|
+
Outlet: ComponentType;
|
|
54
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@starasia/admin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "Core Admin Dashboard for starasia UI",
|
|
5
5
|
"author": "Rizki Izzul Haq",
|
|
6
6
|
"main": "dist/index.umd.js",
|
|
7
7
|
"module": "dist/index.es.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.es.js",
|
|
13
|
+
"require": "./dist/index.umd.js"
|
|
14
|
+
},
|
|
15
|
+
"./adapters/react-router": {
|
|
16
|
+
"types": "./dist/adapters/react-router.d.ts",
|
|
17
|
+
"import": "./dist/adapters/react-router.es.js",
|
|
18
|
+
"require": "./dist/adapters/react-router.cjs.js"
|
|
19
|
+
},
|
|
20
|
+
"./adapters/tanstack": {
|
|
21
|
+
"types": "./dist/adapters/tanstack.d.ts",
|
|
22
|
+
"import": "./dist/adapters/tanstack.es.js",
|
|
23
|
+
"require": "./dist/adapters/tanstack.cjs.js"
|
|
24
|
+
},
|
|
25
|
+
"./dist/*": "./dist/*",
|
|
26
|
+
"./package.json": "./package.json"
|
|
27
|
+
},
|
|
9
28
|
"files": [
|
|
10
29
|
"dist"
|
|
11
30
|
],
|
|
@@ -18,13 +37,22 @@
|
|
|
18
37
|
"peerDependencies": {
|
|
19
38
|
"react": ">=18.2.0 <20.0.0",
|
|
20
39
|
"react-dom": ">=18.2.0 <20.0.0",
|
|
21
|
-
"react-router": ">=7"
|
|
40
|
+
"react-router": ">=7",
|
|
41
|
+
"@tanstack/react-router": ">=1"
|
|
42
|
+
},
|
|
43
|
+
"peerDependenciesMeta": {
|
|
44
|
+
"react-router": {
|
|
45
|
+
"optional": true
|
|
46
|
+
},
|
|
47
|
+
"@tanstack/react-router": {
|
|
48
|
+
"optional": true
|
|
49
|
+
}
|
|
22
50
|
},
|
|
23
51
|
"dependencies": {
|
|
24
52
|
"@starasia/accordion": "3.1.1",
|
|
25
53
|
"@starasia/alert": "4.0.1",
|
|
26
54
|
"@starasia/badges": "3.5.1",
|
|
27
|
-
"@starasia/box": "
|
|
55
|
+
"@starasia/box": "5.0.0",
|
|
28
56
|
"@starasia/breadcrumb": "4.0.1",
|
|
29
57
|
"@starasia/button": "4.0.6",
|
|
30
58
|
"@starasia/card": "5.1.1",
|
|
@@ -60,12 +88,14 @@
|
|
|
60
88
|
"react-easy-crop": "^5.5.6"
|
|
61
89
|
},
|
|
62
90
|
"devDependencies": {
|
|
91
|
+
"@tanstack/react-router": "^1.58.0",
|
|
63
92
|
"@types/node": "^20.19.26",
|
|
64
93
|
"@types/react": "^18.3.27",
|
|
65
94
|
"@types/react-dom": "^18.3.7",
|
|
66
95
|
"@vitejs/plugin-react": "^4.7.0",
|
|
67
96
|
"react": "18.3.1",
|
|
68
97
|
"react-dom": "18.3.1",
|
|
98
|
+
"react-router": "^7.0.0",
|
|
69
99
|
"tsconfig-paths": "^4.2.0",
|
|
70
100
|
"typescript": "^5.9.3",
|
|
71
101
|
"vite": "^5.4.21",
|
|
@@ -73,6 +103,6 @@
|
|
|
73
103
|
},
|
|
74
104
|
"scripts": {
|
|
75
105
|
"dev": "vite --config vite.config.ts --port 3002",
|
|
76
|
-
"build": "vite build --config vite.config.ts"
|
|
106
|
+
"build": "vite build --config vite.config.ts && vite build --config vite.adapters.config.ts"
|
|
77
107
|
}
|
|
78
108
|
}
|