@starasia/admin 1.0.5 → 1.0.6
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 +124 -0
- package/dist/index.cjs.js +17 -9
- package/dist/index.es.js +2084 -1733
- package/dist/index.umd.js +17 -9
- package/package.json +4 -1
package/README.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# @starasia/admin
|
|
2
|
+
|
|
3
|
+
Core Admin FE for starasia UI
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @starasia/admin react react-dom react-router-dom
|
|
9
|
+
# or
|
|
10
|
+
yarn add @starasia/admin react react-dom react-router-dom
|
|
11
|
+
# or
|
|
12
|
+
pnpm add @starasia/admin react react-dom react-router-dom
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Peer Dependencies
|
|
16
|
+
|
|
17
|
+
This package requires the following peer dependencies:
|
|
18
|
+
|
|
19
|
+
- `react` >= 18.2.0
|
|
20
|
+
- `react-dom` >= 18.2.0
|
|
21
|
+
- `react-router-dom` ^6.23.0
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
**IMPORTANT:** You must wrap your application with `BrowserRouter` (or another router provider) from `react-router-dom` before using any components from `@starasia/admin`.
|
|
26
|
+
|
|
27
|
+
### Basic Setup
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { BrowserRouter } from 'react-router-dom';
|
|
31
|
+
import { App } from '@starasia/admin';
|
|
32
|
+
|
|
33
|
+
function Root() {
|
|
34
|
+
return (
|
|
35
|
+
<BrowserRouter>
|
|
36
|
+
<App
|
|
37
|
+
router={/* your routes */}
|
|
38
|
+
menus={/* your menus */}
|
|
39
|
+
logo={/* your logo */}
|
|
40
|
+
/>
|
|
41
|
+
</BrowserRouter>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default Root;
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Using Individual Components
|
|
49
|
+
|
|
50
|
+
If you're using individual components from `@starasia/admin`, make sure they're also wrapped with a router provider:
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import { BrowserRouter } from 'react-router-dom';
|
|
54
|
+
import { Sidebar, Header } from '@starasia/admin';
|
|
55
|
+
|
|
56
|
+
function MyApp() {
|
|
57
|
+
return (
|
|
58
|
+
<BrowserRouter>
|
|
59
|
+
<div>
|
|
60
|
+
<Header />
|
|
61
|
+
<Sidebar menus={menus} />
|
|
62
|
+
{/* Your other components */}
|
|
63
|
+
</div>
|
|
64
|
+
</BrowserRouter>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Common Errors
|
|
70
|
+
|
|
71
|
+
### Error: "Cannot read properties of undefined (reading 'recentlyCreatedOwnerStacks')"
|
|
72
|
+
|
|
73
|
+
This error occurs when components try to use React Router hooks without a router context. Make sure your application is wrapped with `BrowserRouter` or another router provider.
|
|
74
|
+
|
|
75
|
+
**Solution:**
|
|
76
|
+
```tsx
|
|
77
|
+
// ✅ Correct
|
|
78
|
+
import { BrowserRouter } from 'react-router-dom';
|
|
79
|
+
|
|
80
|
+
function App() {
|
|
81
|
+
return (
|
|
82
|
+
<BrowserRouter>
|
|
83
|
+
{/* Your @starasia/admin components */}
|
|
84
|
+
</BrowserRouter>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ❌ Incorrect
|
|
89
|
+
function App() {
|
|
90
|
+
return (
|
|
91
|
+
<>
|
|
92
|
+
{/* Missing BrowserRouter - will cause errors */}
|
|
93
|
+
</>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Version Compatibility
|
|
99
|
+
|
|
100
|
+
**IMPORTANT:** This package is compatible with React 18 only. React 19 is NOT supported yet.
|
|
101
|
+
|
|
102
|
+
- React: ^18.2.0 (React 19 not supported)
|
|
103
|
+
- React DOM: ^18.2.0 (React 19 not supported)
|
|
104
|
+
- React Router DOM: ^6.23.0
|
|
105
|
+
|
|
106
|
+
If you're using React 19, you'll encounter errors like:
|
|
107
|
+
- `Cannot read properties of undefined (reading 'ReactCurrentDispatcher')`
|
|
108
|
+
- `Cannot read properties of undefined (reading 'recentlyCreatedOwnerStacks')`
|
|
109
|
+
|
|
110
|
+
To fix these errors, downgrade to React 18:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npm install react@^18.2.0 react-dom@^18.2.0
|
|
114
|
+
# or
|
|
115
|
+
pnpm add react@^18.2.0 react-dom@^18.2.0
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## License
|
|
119
|
+
|
|
120
|
+
ISC
|
|
121
|
+
|
|
122
|
+
## Author
|
|
123
|
+
|
|
124
|
+
Prawito Hudoro
|