@omnikit-js/ui 0.5.0 → 0.5.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/README.md +167 -71
- package/dist/styles.css +2486 -0
- package/dist/styles.prefixed.css +248 -0
- package/package.json +7 -4
- package/src/components/BillingClient.tsx +2 -2
- package/src/components/SubscriptionConfirmModal.tsx +1 -1
- package/src/components/ui/alert.tsx +1 -1
- package/src/components/ui/button.tsx +1 -1
- package/src/components/ui/card-brand-icon.tsx +1 -1
- package/src/components/ui/card.tsx +1 -1
- package/src/components/ui/dialog.tsx +2 -2
- package/src/components/ui/dropdown-menu.tsx +6 -6
- package/src/components/ui/navigation-menu.tsx +4 -4
- package/src/components/ui/select.tsx +2 -2
- package/src/components/ui/tabs.tsx +2 -2
- package/src/components/ui/tooltip.tsx +1 -1
- package/src/styles/globals.css +1 -3
- package/src/styles/main.css +95 -0
- package/src/styles/prefixed-main.css +95 -0
- package/src/styles/prefixed.css +1 -3
- package/styles.css +0 -553
package/README.md
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
# @omnikit-js/ui
|
|
2
2
|
|
|
3
|
-
A comprehensive SaaS billing component for Next.js applications with Stripe integration. Built with React Server Components support and
|
|
3
|
+
A comprehensive SaaS billing component for Next.js applications with Stripe integration. Built with React Server Components support and Tailwind CSS v4.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- 🚀 **Server Components Support** - Optimized for Next.js App Router
|
|
8
8
|
- 💳 **Stripe Integration** - Complete payment processing and subscription management
|
|
9
|
-
- 🎨 **Beautiful UI** - Built with Tailwind CSS and Radix UI
|
|
9
|
+
- 🎨 **Beautiful UI** - Built with Tailwind CSS v4 and Radix UI
|
|
10
10
|
- 📊 **Usage Tracking** - Monitor and display resource usage
|
|
11
11
|
- 🔄 **Subscription Management** - Handle upgrades, downgrades, and cancellations
|
|
12
12
|
- 💰 **Payment Methods** - Add, remove, and manage multiple payment methods
|
|
13
13
|
- 📜 **Billing History** - View and download past invoices
|
|
14
14
|
- 🔐 **Secure** - Server-side API key handling
|
|
15
|
+
- 🎯 **No Style Conflicts** - Prefixed CSS option to avoid conflicts with your app
|
|
15
16
|
|
|
16
17
|
## Installation
|
|
17
18
|
|
|
@@ -19,58 +20,100 @@ A comprehensive SaaS billing component for Next.js applications with Stripe inte
|
|
|
19
20
|
npm install @omnikit-js/ui
|
|
20
21
|
```
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
## Usage
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
### Option 1: Standard CSS (For Apps Without Tailwind)
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
If your app doesn't use Tailwind CSS or you want to use the component's default styles:
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
// Import the CSS in your app's entry point (e.g., _app.tsx or layout.tsx)
|
|
31
|
+
import '@omnikit-js/ui/dist/styles.css'
|
|
32
|
+
|
|
33
|
+
// Use the component
|
|
34
|
+
import { Billing } from '@omnikit-js/ui'
|
|
30
35
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
export default function BillingPage() {
|
|
37
|
+
return (
|
|
38
|
+
<Billing
|
|
39
|
+
userId="user_123"
|
|
40
|
+
apiUrl="https://your-api.com"
|
|
41
|
+
apiKey="your-api-key"
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
34
45
|
```
|
|
35
46
|
|
|
36
|
-
|
|
47
|
+
### Option 2: Prefixed CSS (Recommended for Apps With Existing Tailwind)
|
|
37
48
|
|
|
38
|
-
|
|
49
|
+
To avoid conflicts with your app's existing Tailwind styles, use the prefixed version:
|
|
39
50
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
```javascript
|
|
52
|
+
// Import the prefixed CSS instead
|
|
53
|
+
import '@omnikit-js/ui/dist/styles.prefixed.css'
|
|
43
54
|
|
|
44
|
-
|
|
55
|
+
// Use the component
|
|
56
|
+
import { Billing } from '@omnikit-js/ui'
|
|
57
|
+
|
|
58
|
+
export default function BillingPage() {
|
|
59
|
+
return (
|
|
60
|
+
<Billing
|
|
61
|
+
userId="user_123"
|
|
62
|
+
apiUrl="https://your-api.com"
|
|
63
|
+
apiKey="your-api-key"
|
|
64
|
+
/>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
```
|
|
45
68
|
|
|
46
|
-
|
|
69
|
+
**Note:** The prefixed version uses `tw-` prefix for all Tailwind classes internally, preventing conflicts with your app's styles.
|
|
47
70
|
|
|
48
|
-
|
|
49
|
-
|
|
71
|
+
### Next.js App Router Example
|
|
72
|
+
|
|
73
|
+
```javascript
|
|
74
|
+
// app/billing/page.tsx
|
|
75
|
+
import '@omnikit-js/ui/dist/styles.prefixed.css'
|
|
76
|
+
import { Billing } from '@omnikit-js/ui'
|
|
50
77
|
|
|
51
78
|
export default function BillingPage() {
|
|
52
79
|
return (
|
|
53
|
-
<
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
80
|
+
<main className="container mx-auto p-4">
|
|
81
|
+
<h1 className="text-2xl font-bold mb-6">Billing & Subscription</h1>
|
|
82
|
+
<Billing
|
|
83
|
+
userId="user_123"
|
|
84
|
+
apiUrl={process.env.NEXT_PUBLIC_API_URL}
|
|
85
|
+
apiKey={process.env.API_KEY}
|
|
86
|
+
/>
|
|
87
|
+
</main>
|
|
88
|
+
)
|
|
57
89
|
}
|
|
58
90
|
```
|
|
59
91
|
|
|
60
|
-
###
|
|
92
|
+
### Next.js Pages Router Example
|
|
61
93
|
|
|
62
|
-
```
|
|
63
|
-
|
|
94
|
+
```javascript
|
|
95
|
+
// pages/_app.tsx
|
|
96
|
+
import '@omnikit-js/ui/dist/styles.prefixed.css'
|
|
97
|
+
import type { AppProps } from 'next/app'
|
|
98
|
+
|
|
99
|
+
export default function App({ Component, pageProps }: AppProps) {
|
|
100
|
+
return <Component {...pageProps} />
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// pages/billing.tsx
|
|
104
|
+
import { Billing } from '@omnikit-js/ui'
|
|
64
105
|
|
|
65
106
|
export default function BillingPage() {
|
|
66
107
|
return (
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
108
|
+
<div className="container mx-auto p-4">
|
|
109
|
+
<h1 className="text-2xl font-bold mb-6">Billing & Subscription</h1>
|
|
110
|
+
<Billing
|
|
111
|
+
userId="user_123"
|
|
112
|
+
apiUrl={process.env.NEXT_PUBLIC_API_URL}
|
|
113
|
+
apiKey={process.env.API_KEY}
|
|
114
|
+
/>
|
|
115
|
+
</div>
|
|
116
|
+
)
|
|
74
117
|
}
|
|
75
118
|
```
|
|
76
119
|
|
|
@@ -96,6 +139,58 @@ export default function ClientBillingPage({ customerData, pricingData, paymentMe
|
|
|
96
139
|
}
|
|
97
140
|
```
|
|
98
141
|
|
|
142
|
+
## Resolving Style Conflicts
|
|
143
|
+
|
|
144
|
+
If you experience style conflicts, especially with progress bars or grid layouts:
|
|
145
|
+
|
|
146
|
+
### Progress Bar Color Conflicts
|
|
147
|
+
|
|
148
|
+
Override the progress bar styles in your global CSS:
|
|
149
|
+
|
|
150
|
+
```css
|
|
151
|
+
/* Force specific progress bar colors */
|
|
152
|
+
.omnikit-progress-fill {
|
|
153
|
+
background-color: #3b82f6 !important;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/* Or for dark mode */
|
|
157
|
+
@media (prefers-color-scheme: dark) {
|
|
158
|
+
.omnikit-progress-fill {
|
|
159
|
+
background-color: #60a5fa !important;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Grid Layout Conflicts
|
|
165
|
+
|
|
166
|
+
Wrap the component in a scoped container to isolate styles:
|
|
167
|
+
|
|
168
|
+
```css
|
|
169
|
+
/* Create an isolation container */
|
|
170
|
+
.billing-wrapper {
|
|
171
|
+
/* Reset conflicting styles */
|
|
172
|
+
all: initial;
|
|
173
|
+
font-family: inherit;
|
|
174
|
+
color: inherit;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.billing-wrapper * {
|
|
178
|
+
box-sizing: border-box;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* Fix specific grid issues */
|
|
182
|
+
.billing-wrapper .omnikit-pricing-grid {
|
|
183
|
+
display: grid !important;
|
|
184
|
+
gap: 1rem !important;
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
```javascript
|
|
189
|
+
<div className="billing-wrapper">
|
|
190
|
+
<Billing userId="user_123" />
|
|
191
|
+
</div>
|
|
192
|
+
```
|
|
193
|
+
|
|
99
194
|
## Component Props
|
|
100
195
|
|
|
101
196
|
### Billing (Server Component)
|
|
@@ -117,7 +212,7 @@ export default function ClientBillingPage({ customerData, pricingData, paymentMe
|
|
|
117
212
|
| apiUrl | string | The API base URL |
|
|
118
213
|
| apiKey | string | The API key for authentication |
|
|
119
214
|
|
|
120
|
-
|
|
215
|
+
## Environment Variables
|
|
121
216
|
|
|
122
217
|
Create a `.env.local` file in your Next.js project:
|
|
123
218
|
|
|
@@ -146,43 +241,44 @@ The component expects the following API endpoints:
|
|
|
146
241
|
- `POST /billing/payment-methods/:id/default` - Set default payment method
|
|
147
242
|
- `DELETE /billing/payment-methods/:id` - Delete payment method
|
|
148
243
|
|
|
149
|
-
##
|
|
244
|
+
## Troubleshooting
|
|
150
245
|
|
|
151
|
-
###
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
-
|
|
155
|
-
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
-
|
|
159
|
-
-
|
|
160
|
-
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
246
|
+
### Common Issues and Solutions
|
|
247
|
+
|
|
248
|
+
1. **Progress bar showing wrong color**
|
|
249
|
+
- Use the prefixed CSS version
|
|
250
|
+
- Override `.omnikit-progress-fill` with `!important`
|
|
251
|
+
|
|
252
|
+
2. **Grid layout breaking on pricing page**
|
|
253
|
+
- Check for global grid styles in your app
|
|
254
|
+
- Use the isolation container approach shown above
|
|
255
|
+
- Ensure no conflicting CSS Grid properties
|
|
256
|
+
|
|
257
|
+
3. **Modal z-index conflicts**
|
|
258
|
+
- Component modals use `z-50` (z-index: 50)
|
|
259
|
+
- Adjust your app's z-index scale if needed
|
|
260
|
+
|
|
261
|
+
4. **Font inconsistencies**
|
|
262
|
+
- The component inherits font-family
|
|
263
|
+
- Set font on a parent element
|
|
264
|
+
|
|
265
|
+
5. **Styles not loading**
|
|
266
|
+
- Ensure you're importing the CSS file
|
|
267
|
+
- Check the correct path: `@omnikit-js/ui/dist/styles.css` or `@omnikit-js/ui/dist/styles.prefixed.css`
|
|
268
|
+
|
|
269
|
+
## Version History
|
|
270
|
+
|
|
271
|
+
- **0.5.1** - Tailwind CSS v4 support with prefix option
|
|
272
|
+
- **0.3.5** - Previous version with Tailwind CSS v3
|
|
273
|
+
|
|
274
|
+
## Browser Support
|
|
275
|
+
|
|
276
|
+
Requires modern browsers:
|
|
277
|
+
- Safari 16.4+
|
|
278
|
+
- Chrome 111+
|
|
279
|
+
- Firefox 128+
|
|
280
|
+
|
|
281
|
+
For older browser support, use version 0.3.5.
|
|
186
282
|
|
|
187
283
|
## TypeScript
|
|
188
284
|
|