@tirth_jasoliya/ui 1.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/README.md +240 -0
- package/dist/index.cjs +3133 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +398 -0
- package/dist/index.d.ts +398 -0
- package/dist/index.js +3091 -0
- package/dist/index.js.map +1 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
```markdown
|
|
2
|
+
# @tirth_jasoliya/ui
|
|
3
|
+
|
|
4
|
+
> ✨ A complete, type-safe UI component library featuring elegant layouts, data displays, and utility components. Built with TypeScript, Tailwind CSS, and React.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 🌟 Features
|
|
9
|
+
|
|
10
|
+
- **Layout System**: Pre-built, composable layout components (`AppContainer`, `AppHeader`, `AppContent`, `AppFooter`)
|
|
11
|
+
- **Type Safety**: Fully typed components with intelligent prop completion
|
|
12
|
+
- **Context-Aware**: Built-in app meta management for titles, breadcrumbs, and actions
|
|
13
|
+
- **Utility-First**: Includes helpful utilities like `GeneralHelper` for formatting and UI helpers
|
|
14
|
+
- **Customizable**: Themeable and extensible with Tailwind CSS
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 📦 Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Using npm
|
|
22
|
+
npm install @tirth_jasoliya/ui
|
|
23
|
+
|
|
24
|
+
# Using yarn
|
|
25
|
+
yarn add @tirth_jasoliya/ui
|
|
26
|
+
|
|
27
|
+
# Using pnpm
|
|
28
|
+
pnpm add @tirth_jasoliya/ui
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Peer Dependencies**:
|
|
32
|
+
```bash
|
|
33
|
+
npm install react react-dom clsx tailwind-merge lucide-react
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 🚀 Quick Start
|
|
39
|
+
|
|
40
|
+
### 1. Setup App Meta Provider
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
// App.tsx
|
|
44
|
+
import { AppMetaProvider } from '@tmj/ui';
|
|
45
|
+
|
|
46
|
+
function App() {
|
|
47
|
+
return (
|
|
48
|
+
<AppMetaProvider>
|
|
49
|
+
<MyPage />
|
|
50
|
+
</AppMetaProvider>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 2. Use Layout Components
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import {
|
|
59
|
+
AppContainer,
|
|
60
|
+
AppHeader,
|
|
61
|
+
AppContent,
|
|
62
|
+
AppFooter
|
|
63
|
+
} from '@tmj/ui';
|
|
64
|
+
|
|
65
|
+
function DashboardPage() {
|
|
66
|
+
return (
|
|
67
|
+
<AppContainer>
|
|
68
|
+
<AppHeader />
|
|
69
|
+
<AppContent>
|
|
70
|
+
<h1>Dashboard Content</h1>
|
|
71
|
+
</AppContent>
|
|
72
|
+
<AppFooter />
|
|
73
|
+
</AppContainer>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 3. Manage Page Metadata
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
import { usePageTemplate } from '@tmj/ui/hooks';
|
|
82
|
+
|
|
83
|
+
function ProductPage() {
|
|
84
|
+
usePageTemplate({
|
|
85
|
+
title: 'Product Details',
|
|
86
|
+
breadcrumbs: [
|
|
87
|
+
{ label: 'Home', href: '/' },
|
|
88
|
+
{ label: 'Products', href: '/products' },
|
|
89
|
+
{ label: 'Current Product' }
|
|
90
|
+
],
|
|
91
|
+
primaryActions: <Button>Edit Product</Button>
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return <div>...</div>;
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 🧩 Core Components
|
|
101
|
+
|
|
102
|
+
### Layout System
|
|
103
|
+
|
|
104
|
+
| Component | Description |
|
|
105
|
+
|-----------------|-------------|
|
|
106
|
+
| `AppContainer` | Root layout container with spacing and padding controls |
|
|
107
|
+
| `AppHeader` | Top navigation bar with title, breadcrumbs, and actions |
|
|
108
|
+
| `AppContent` | Flexible content area with multiple layout modes |
|
|
109
|
+
| `AppFooter` | Bottom bar with secondary actions and pagination |
|
|
110
|
+
|
|
111
|
+
### Utility Components
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
import { GeneralHelper } from '@tmj/ui';
|
|
115
|
+
|
|
116
|
+
// Format currency
|
|
117
|
+
const price = GeneralHelper.formatINR(1500, { compact: true }); // ₹1.5K
|
|
118
|
+
|
|
119
|
+
// Status badge
|
|
120
|
+
<GeneralHelper.StatusBadge status="active" variant="outline" />
|
|
121
|
+
|
|
122
|
+
// Copy to clipboard
|
|
123
|
+
<GeneralHelper.CopyToClipboard text="Copy me!" />
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## 🛠️ Advanced Usage
|
|
129
|
+
|
|
130
|
+
### Custom Route Types
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
// lib/app-meta.ts
|
|
134
|
+
import { createAppMetaContext } from '@tmj/ui/context/app-meta';
|
|
135
|
+
|
|
136
|
+
type AppRoutes = '/' | '/dashboard' | '/products/:id';
|
|
137
|
+
|
|
138
|
+
const { AppMetaProvider, useAppMeta } = createAppMetaContext<AppRoutes>();
|
|
139
|
+
|
|
140
|
+
export { AppMetaProvider, useAppMeta };
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Theming
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
// tailwind.config.js
|
|
147
|
+
module.exports = {
|
|
148
|
+
theme: {
|
|
149
|
+
extend: {
|
|
150
|
+
colors: {
|
|
151
|
+
primary: {
|
|
152
|
+
DEFAULT: 'var(--color-primary)',
|
|
153
|
+
light: 'var(--color-primary-light)',
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## 📚 API Reference
|
|
164
|
+
|
|
165
|
+
### AppMeta Context
|
|
166
|
+
|
|
167
|
+
| Hook/Component | Description |
|
|
168
|
+
|---------------|-------------|
|
|
169
|
+
| `AppMetaProvider` | Provides context for page metadata |
|
|
170
|
+
| `useAppMeta()` | Access and update app metadata |
|
|
171
|
+
| `usePageTemplate()` | Hook to set page metadata |
|
|
172
|
+
|
|
173
|
+
### GeneralHelper Utilities
|
|
174
|
+
|
|
175
|
+
| Method | Description |
|
|
176
|
+
|--------|-------------|
|
|
177
|
+
| `formatINR()` | Format numbers as Indian Rupees |
|
|
178
|
+
| `formatDate()` | Date formatting utilities |
|
|
179
|
+
| `toProperCase()` | String case conversion |
|
|
180
|
+
| `StatusBadge` | Configurable status indicator |
|
|
181
|
+
| `CopyToClipboard` | Clipboard copy component |
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## 🎨 Design Philosophy
|
|
186
|
+
|
|
187
|
+
1. **Consistent**: Unified design language across components
|
|
188
|
+
2. **Composable**: Mix and match layout components as needed
|
|
189
|
+
3. **Type-Safe**: Full TypeScript support with intelligent hints
|
|
190
|
+
4. **Performant**: Optimized for fast rendering and updates
|
|
191
|
+
5. **Accessible**: Built with WAI-ARIA standards
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## 🛣️ Roadmap
|
|
196
|
+
|
|
197
|
+
- [x] Core layout components
|
|
198
|
+
- [x] App meta management system
|
|
199
|
+
- [x] Data table component
|
|
200
|
+
- [x] Data template component
|
|
201
|
+
- [] Form components
|
|
202
|
+
- [x] Dark mode support
|
|
203
|
+
- [] Component playground
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## 🤝 Contributing
|
|
208
|
+
|
|
209
|
+
We welcome contributions! Please open an issue to discuss your ideas or submit a PR.
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## 📄 License
|
|
214
|
+
|
|
215
|
+
MIT © [Tirth Jasoliya](https://github.com/tirth-jasoliya)
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
This README features:
|
|
219
|
+
|
|
220
|
+
1. Clear, visually appealing structure with emoji headers
|
|
221
|
+
2. Complete installation instructions
|
|
222
|
+
3. Quick start guide with code examples
|
|
223
|
+
4. Component API reference
|
|
224
|
+
5. Advanced usage patterns
|
|
225
|
+
6. Design philosophy and roadmap
|
|
226
|
+
7. Consistent with your router package's style
|
|
227
|
+
|
|
228
|
+
The documentation highlights:
|
|
229
|
+
- The layout system first (your core feature)
|
|
230
|
+
- Type safety as a key benefit
|
|
231
|
+
- Practical examples for common use cases
|
|
232
|
+
- Easy integration instructions
|
|
233
|
+
- Future plans to set expectations
|
|
234
|
+
|
|
235
|
+
You can further customize it with:
|
|
236
|
+
- Screenshots of components
|
|
237
|
+
- Live demo links
|
|
238
|
+
- More detailed code examples
|
|
239
|
+
- Theming documentation
|
|
240
|
+
- Contribution guidelines
|