@erpsquad/common 1.8.0 → 1.8.1
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/components/action-bar/action-bar/index.esm.js +3 -55
- package/dist/components/action-bar/action-bar/index.esm.js.map +1 -1
- package/dist/components/action-bar/action-bar/index.js +18 -28
- package/dist/components/action-bar/action-bar/index.js.map +1 -1
- package/dist/index.esm.js +68 -67
- package/dist/index.js +1 -1
- package/dist/style.css +2 -2
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.esm.js +4 -3
- package/dist/utils/index.js +1 -1
- package/package.json +2 -4
- package/CSS_SETUP.md +0 -195
- package/QUICK_START.md +0 -118
package/CSS_SETUP.md
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
# CSS Setup Guide - @erpsquad/common
|
|
2
|
-
|
|
3
|
-
## ⚠️ CRITICAL: CSS Must Be Imported
|
|
4
|
-
|
|
5
|
-
Components from `@erpsquad/common` will **NOT have styling** unless you import the CSS file.
|
|
6
|
-
|
|
7
|
-
## ✅ How to Fix
|
|
8
|
-
|
|
9
|
-
Add this **ONE LINE** to your main application file:
|
|
10
|
-
|
|
11
|
-
```tsx
|
|
12
|
-
import '@erpsquad/common/style.css';
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## 📍 Where to Add It
|
|
16
|
-
|
|
17
|
-
### React with Vite
|
|
18
|
-
|
|
19
|
-
```tsx
|
|
20
|
-
// src/main.tsx
|
|
21
|
-
import React from 'react';
|
|
22
|
-
import ReactDOM from 'react-dom/client';
|
|
23
|
-
import '@erpsquad/common/style.css'; // 👈 Add here!
|
|
24
|
-
import App from './App';
|
|
25
|
-
|
|
26
|
-
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
27
|
-
<React.StrictMode>
|
|
28
|
-
<App />
|
|
29
|
-
</React.StrictMode>
|
|
30
|
-
);
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### React with Create React App
|
|
34
|
-
|
|
35
|
-
```tsx
|
|
36
|
-
// src/index.tsx or src/App.tsx
|
|
37
|
-
import React from 'react';
|
|
38
|
-
import ReactDOM from 'react-dom/client';
|
|
39
|
-
import '@erpsquad/common/style.css'; // 👈 Add here!
|
|
40
|
-
import App from './App';
|
|
41
|
-
|
|
42
|
-
const root = ReactDOM.createRoot(document.getElementById('root'));
|
|
43
|
-
root.render(<App />);
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Next.js (Pages Router)
|
|
47
|
-
|
|
48
|
-
```tsx
|
|
49
|
-
// pages/_app.tsx
|
|
50
|
-
import '@erpsquad/common/style.css'; // 👈 Add here!
|
|
51
|
-
import type { AppProps } from 'next/app';
|
|
52
|
-
|
|
53
|
-
export default function App({ Component, pageProps }: AppProps) {
|
|
54
|
-
return <Component {...pageProps} />;
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Next.js (App Router)
|
|
59
|
-
|
|
60
|
-
```tsx
|
|
61
|
-
// app/layout.tsx
|
|
62
|
-
import '@erpsquad/common/style.css'; // 👈 Add here!
|
|
63
|
-
|
|
64
|
-
export default function RootLayout({
|
|
65
|
-
children,
|
|
66
|
-
}: {
|
|
67
|
-
children: React.ReactNode;
|
|
68
|
-
}) {
|
|
69
|
-
return (
|
|
70
|
-
<html lang="en">
|
|
71
|
-
<body>{children}</body>
|
|
72
|
-
</html>
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
## 🎯 What This Does
|
|
78
|
-
|
|
79
|
-
The `style.css` file includes:
|
|
80
|
-
- ✅ All component styles
|
|
81
|
-
- ✅ Chart styles (BarChart, DonutChart, etc.)
|
|
82
|
-
- ✅ Layout and grid styles
|
|
83
|
-
- ✅ Utility classes
|
|
84
|
-
- ✅ Responsive styles
|
|
85
|
-
- ✅ CSS reset and normalize
|
|
86
|
-
- ✅ Theme variables
|
|
87
|
-
- ✅ Animations
|
|
88
|
-
|
|
89
|
-
## 🤔 Why Is This Required?
|
|
90
|
-
|
|
91
|
-
Component libraries bundle CSS separately from JavaScript to:
|
|
92
|
-
|
|
93
|
-
1. **Enable tree-shaking**: Only include CSS for components you use
|
|
94
|
-
2. **Optimize loading**: Load CSS and JS in parallel
|
|
95
|
-
3. **Better caching**: CSS can be cached separately
|
|
96
|
-
4. **Flexibility**: Consumers can override styles more easily
|
|
97
|
-
|
|
98
|
-
This is the standard approach used by popular libraries like:
|
|
99
|
-
- Material-UI
|
|
100
|
-
- Ant Design
|
|
101
|
-
- Bootstrap
|
|
102
|
-
- Tailwind CSS
|
|
103
|
-
|
|
104
|
-
## ❌ Common Mistakes
|
|
105
|
-
|
|
106
|
-
### Mistake #1: Not Importing CSS
|
|
107
|
-
|
|
108
|
-
```tsx
|
|
109
|
-
// ❌ WRONG - No styles imported!
|
|
110
|
-
import { Button } from '@erpsquad/common/components';
|
|
111
|
-
|
|
112
|
-
function App() {
|
|
113
|
-
return <Button>Click me</Button>; // Will render but look unstyled
|
|
114
|
-
}
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### Mistake #2: Importing CSS in the Wrong Place
|
|
118
|
-
|
|
119
|
-
```tsx
|
|
120
|
-
// ❌ WRONG - Don't import in individual components
|
|
121
|
-
// components/MyComponent.tsx
|
|
122
|
-
import '@erpsquad/common/style.css'; // Don't do this!
|
|
123
|
-
import { Button } from '@erpsquad/common/components';
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### Mistake #3: Conditional Import
|
|
127
|
-
|
|
128
|
-
```tsx
|
|
129
|
-
// ❌ WRONG - Don't conditionally import CSS
|
|
130
|
-
if (condition) {
|
|
131
|
-
import '@erpsquad/common/style.css'); // Don't do this!
|
|
132
|
-
}
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
## ✅ Correct Usage
|
|
136
|
-
|
|
137
|
-
```tsx
|
|
138
|
-
// ✅ CORRECT - Import once in main file
|
|
139
|
-
// main.tsx
|
|
140
|
-
import '@erpsquad/common/style.css';
|
|
141
|
-
|
|
142
|
-
import React from 'react';
|
|
143
|
-
import App from './App';
|
|
144
|
-
// ... rest of your setup
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
```tsx
|
|
148
|
-
// ✅ CORRECT - Then use components anywhere
|
|
149
|
-
// components/MyComponent.tsx
|
|
150
|
-
import { Button, TextField } from '@erpsquad/common/components';
|
|
151
|
-
|
|
152
|
-
export function MyComponent() {
|
|
153
|
-
return (
|
|
154
|
-
<>
|
|
155
|
-
<TextField label="Name" />
|
|
156
|
-
<Button variant="contained">Submit</Button>
|
|
157
|
-
</>
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
## 🔍 Verification
|
|
163
|
-
|
|
164
|
-
To verify CSS is loaded:
|
|
165
|
-
|
|
166
|
-
1. Run your app
|
|
167
|
-
2. Open browser DevTools (F12)
|
|
168
|
-
3. Check the `<head>` section - you should see styles
|
|
169
|
-
4. Or check the "Sources" tab for `style.css`
|
|
170
|
-
|
|
171
|
-
## 🆘 Still Not Working?
|
|
172
|
-
|
|
173
|
-
See [TROUBLESHOOTING.md](./TROUBLESHOOTING.md) for more help.
|
|
174
|
-
|
|
175
|
-
### Quick Checks:
|
|
176
|
-
|
|
177
|
-
1. ✅ CSS imported in main file?
|
|
178
|
-
2. ✅ Import statement before component imports?
|
|
179
|
-
3. ✅ Cleared build cache? (`rm -rf node_modules/.vite dist`)
|
|
180
|
-
4. ✅ Restarted dev server?
|
|
181
|
-
|
|
182
|
-
### Build Tool Specific Issues:
|
|
183
|
-
|
|
184
|
-
- **Vite**: Add to `vite.config.ts`:
|
|
185
|
-
```ts
|
|
186
|
-
optimizeDeps: {
|
|
187
|
-
include: ['@erpsquad/common']
|
|
188
|
-
}
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
- **Webpack**: Ensure css-loader and style-loader are installed
|
|
192
|
-
|
|
193
|
-
- **Next.js**: CSS import should be in `_app.tsx` or `layout.tsx`
|
|
194
|
-
|
|
195
|
-
|
package/QUICK_START.md
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
# Quick Start - @erpsquad/common
|
|
2
|
-
|
|
3
|
-
Get up and running with the ERP UI library in 2 minutes.
|
|
4
|
-
|
|
5
|
-
## 1️⃣ Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @erpsquad/common
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## 2️⃣ Install Peer Dependencies
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm install react react-dom @mui/material @emotion/react @emotion/styled @mui/icons-material
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## 3️⃣ ⚠️ Import Styles (REQUIRED!)
|
|
18
|
-
|
|
19
|
-
**In your main application file** (`main.tsx`, `App.tsx`, or `index.tsx`):
|
|
20
|
-
|
|
21
|
-
```tsx
|
|
22
|
-
import '@erpsquad/common/style.css'; // 👈 MUST ADD THIS!
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
**Without this, components will have NO styling!**
|
|
26
|
-
|
|
27
|
-
## 4️⃣ Use Components
|
|
28
|
-
|
|
29
|
-
```tsx
|
|
30
|
-
import React from 'react';
|
|
31
|
-
import '@erpsquad/common/style.css'; // 👈 Don't forget!
|
|
32
|
-
|
|
33
|
-
import { ERPUIProvider } from '@erpsquad/common/contexts';
|
|
34
|
-
import { Button, TextField } from '@erpsquad/common/components';
|
|
35
|
-
|
|
36
|
-
function App() {
|
|
37
|
-
return (
|
|
38
|
-
<ERPUIProvider>
|
|
39
|
-
<TextField label="Name" />
|
|
40
|
-
<Button variant="contained">Submit</Button>
|
|
41
|
-
</ERPUIProvider>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export default App;
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## 🎨 Chart Components
|
|
49
|
-
|
|
50
|
-
```tsx
|
|
51
|
-
import '@erpsquad/common/style.css';
|
|
52
|
-
import {
|
|
53
|
-
BarChart,
|
|
54
|
-
DonutChart,
|
|
55
|
-
LineChart,
|
|
56
|
-
MultiLineChart
|
|
57
|
-
} from '@erpsquad/common/components';
|
|
58
|
-
|
|
59
|
-
function Dashboard() {
|
|
60
|
-
const data = [
|
|
61
|
-
{ label: 'Jan', value: 100 },
|
|
62
|
-
{ label: 'Feb', value: 200 }
|
|
63
|
-
];
|
|
64
|
-
|
|
65
|
-
return <BarChart data={data} />;
|
|
66
|
-
}
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## 🔧 Common Imports
|
|
70
|
-
|
|
71
|
-
### Components
|
|
72
|
-
```tsx
|
|
73
|
-
import { Button, TextField, Select } from '@erpsquad/common/components';
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### Hooks
|
|
77
|
-
```tsx
|
|
78
|
-
import { useAuth, useLanguage } from '@erpsquad/common/hooks';
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Utils
|
|
82
|
-
```tsx
|
|
83
|
-
import { formatDate, enqueueSnackbar } from '@erpsquad/common/utils';
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
### Contexts
|
|
87
|
-
```tsx
|
|
88
|
-
import { ERPUIProvider, AuthProvider } from '@erpsquad/common/contexts';
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Theme
|
|
92
|
-
```tsx
|
|
93
|
-
import { createLightTheme, createDarkTheme } from '@erpsquad/common/theme';
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## ⚠️ Troubleshooting
|
|
97
|
-
|
|
98
|
-
### Components have no styling?
|
|
99
|
-
→ **Add** `import '@erpsquad/common/style.css';` in your main file
|
|
100
|
-
|
|
101
|
-
### Cannot resolve module?
|
|
102
|
-
→ **Install peer dependencies**: `npm install @mui/material @emotion/react @emotion/styled`
|
|
103
|
-
|
|
104
|
-
### Hooks not working?
|
|
105
|
-
→ **Wrap your app** with `<ERPUIProvider>`
|
|
106
|
-
|
|
107
|
-
## 📚 Full Documentation
|
|
108
|
-
|
|
109
|
-
- [Complete README](./README.md)
|
|
110
|
-
- [Troubleshooting Guide](./TROUBLESHOOTING.md)
|
|
111
|
-
- [Styles Guide](./src/styles/README.md)
|
|
112
|
-
|
|
113
|
-
## 🆘 Need Help?
|
|
114
|
-
|
|
115
|
-
- [GitHub Issues](https://github.com/erpforce/common/issues)
|
|
116
|
-
- [NPM Package](https://www.npmjs.com/package/@erpsquad/common)
|
|
117
|
-
|
|
118
|
-
|