rud-dashboard 0.1.4
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 +148 -0
- package/dist/preact/index.preact.cjs +1707 -0
- package/dist/preact/index.preact.cjs.map +1 -0
- package/dist/preact/index.preact.d.cts +261 -0
- package/dist/preact/index.preact.d.ts +261 -0
- package/dist/preact/index.preact.js +1656 -0
- package/dist/preact/index.preact.js.map +1 -0
- package/dist/react/index.cjs +1707 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.cts +261 -0
- package/dist/react/index.d.ts +261 -0
- package/dist/react/index.js +1656 -0
- package/dist/react/index.js.map +1 -0
- package/dist/styles.css +94 -0
- package/package.json +89 -0
- package/tailwind.preset.js +48 -0
package/README.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Rud Dashboard
|
|
2
|
+
|
|
3
|
+
Dashboard component library with TailwindCSS. Supports React and Preact.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install rud-dashboard
|
|
9
|
+
# or
|
|
10
|
+
bun add rud-dashboard
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
### 1. Import the Tailwind Preset
|
|
16
|
+
|
|
17
|
+
Update your `tailwind.config.js`:
|
|
18
|
+
|
|
19
|
+
```javascript
|
|
20
|
+
import rudPreset from 'rud-dashboard/tailwind.preset'
|
|
21
|
+
|
|
22
|
+
export default {
|
|
23
|
+
presets: [rdbPreset],
|
|
24
|
+
content: [
|
|
25
|
+
"./src/**/*.{js,ts,jsx,tsx}",
|
|
26
|
+
"./node_modules/rud-dashboard/**/*.{js,ts,jsx,tsx}",
|
|
27
|
+
],
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 2. Add CSS Variables
|
|
32
|
+
|
|
33
|
+
Add to your main CSS file (e.g., `globals.css` or `index.css`):
|
|
34
|
+
|
|
35
|
+
```css
|
|
36
|
+
@import 'rud-dashboard/styles.css';
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or copy the CSS variables from `node_modules/rud-dashboard/dist/styles.css` to customize them.
|
|
40
|
+
|
|
41
|
+
### 3. Use the Components
|
|
42
|
+
|
|
43
|
+
**React:**
|
|
44
|
+
```tsx
|
|
45
|
+
import { Dashboard } from 'rud-dashboard'
|
|
46
|
+
|
|
47
|
+
function App() {
|
|
48
|
+
return (
|
|
49
|
+
<Dashboard
|
|
50
|
+
enableEditMode={true}
|
|
51
|
+
defaultEditMode={false}
|
|
52
|
+
gridMode="elegant"
|
|
53
|
+
showDefaultToolbar={true}
|
|
54
|
+
initialItems={[
|
|
55
|
+
{ id: '1', type: 'basic', title: 'Widget', x: 0, y: 0, w: 2, h: 1 }
|
|
56
|
+
]}
|
|
57
|
+
/>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Preact:**
|
|
63
|
+
```tsx
|
|
64
|
+
import { Dashboard } from 'rud-dashboard/preact'
|
|
65
|
+
|
|
66
|
+
export function App() {
|
|
67
|
+
return (
|
|
68
|
+
<Dashboard
|
|
69
|
+
enableEditMode={true}
|
|
70
|
+
defaultEditMode={false}
|
|
71
|
+
gridMode="elegant"
|
|
72
|
+
showDefaultToolbar={true}
|
|
73
|
+
initialItems={[
|
|
74
|
+
{ id: '1', type: 'basic', title: 'Widget', x: 0, y: 0, w: 2, h: 1 }
|
|
75
|
+
]}
|
|
76
|
+
/>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Development
|
|
82
|
+
|
|
83
|
+
### Install Dependencies
|
|
84
|
+
```bash
|
|
85
|
+
bun install
|
|
86
|
+
```
|
|
87
|
+
### Build Library
|
|
88
|
+
```bash
|
|
89
|
+
bun run build
|
|
90
|
+
```
|
|
91
|
+
### Create Package
|
|
92
|
+
```bash
|
|
93
|
+
bun run pack:local
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Playground
|
|
97
|
+
|
|
98
|
+
### React Playground
|
|
99
|
+
```bash
|
|
100
|
+
# Start dev server
|
|
101
|
+
bun run dev
|
|
102
|
+
# With Node
|
|
103
|
+
npm run dev
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Preact Playground
|
|
107
|
+
```bash
|
|
108
|
+
# Start dev server
|
|
109
|
+
bun run test:preact
|
|
110
|
+
# With Node
|
|
111
|
+
npm run test:preact
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Testing Built Package
|
|
115
|
+
|
|
116
|
+
### Preact Example
|
|
117
|
+
```bash
|
|
118
|
+
cd example
|
|
119
|
+
bun install
|
|
120
|
+
bun add ../rud-dashboard-0.1.0.tgz
|
|
121
|
+
bun run dev
|
|
122
|
+
bun run build
|
|
123
|
+
bun run preview
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### React Example
|
|
127
|
+
```bash
|
|
128
|
+
cd example-react
|
|
129
|
+
bun install
|
|
130
|
+
bun add ../rud-dashboard-0.1.0.tgz
|
|
131
|
+
bun run dev
|
|
132
|
+
bun run build
|
|
133
|
+
bun run preview
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## TypeScript
|
|
137
|
+
|
|
138
|
+
Full TypeScript support:
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
import type { DashboardProps, StatCardProps } from 'rud-dashboard'
|
|
142
|
+
// or
|
|
143
|
+
import type { DashboardProps, StatCardProps } from 'rud-dashboard/preact'
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## License
|
|
147
|
+
|
|
148
|
+
MIT
|