@omnikit-js/ui 0.3.9 → 0.4.3
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
CHANGED
|
@@ -21,8 +21,7 @@ npm install @omnikit-js/ui
|
|
|
21
21
|
|
|
22
22
|
### Setup
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
1. Add our component to your `tailwind.config.js`:
|
|
26
25
|
```js
|
|
27
26
|
module.exports = {
|
|
28
27
|
content: [
|
|
@@ -36,7 +35,12 @@ module.exports = {
|
|
|
36
35
|
}
|
|
37
36
|
```
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
2. Import the component-specific styles:
|
|
39
|
+
```tsx
|
|
40
|
+
import '@omnikit-js/ui/styles.css';
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**That's it!** The component will use your existing Tailwind configuration plus essential component-specific styles.
|
|
40
44
|
|
|
41
45
|
## Prerequisites
|
|
42
46
|
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/* Essential component-specific styles only */
|
|
2
|
+
|
|
3
|
+
/* Pricing text styles */
|
|
4
|
+
.omnikit-price-text {
|
|
5
|
+
font-size: 2rem;
|
|
6
|
+
line-height: 1;
|
|
7
|
+
font-weight: 700;
|
|
8
|
+
letter-spacing: -0.025em;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.omnikit-price-units {
|
|
12
|
+
font-size: 0.875rem;
|
|
13
|
+
line-height: 1.25rem;
|
|
14
|
+
color: #6b7280;
|
|
15
|
+
font-weight: 400;
|
|
16
|
+
margin-left: 0.25rem;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* Feature value styles */
|
|
20
|
+
.omnikit-feature-value {
|
|
21
|
+
font-size: 1.125rem;
|
|
22
|
+
line-height: 1.75rem;
|
|
23
|
+
font-weight: 600;
|
|
24
|
+
color: #111827;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.omnikit-feature-units {
|
|
28
|
+
font-size: 0.875rem;
|
|
29
|
+
color: #6b7280;
|
|
30
|
+
font-weight: 400;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.omnikit-feature-name {
|
|
34
|
+
font-size: 0.75rem;
|
|
35
|
+
line-height: 1rem;
|
|
36
|
+
color: #6b7280;
|
|
37
|
+
margin-top: 0.25rem;
|
|
38
|
+
cursor: help;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* Boolean feature icons */
|
|
42
|
+
.omnikit-feature-value .omnikit-boolean-true {
|
|
43
|
+
color: #22c55e;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.omnikit-feature-value .omnikit-boolean-false {
|
|
47
|
+
color: #ef4444;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Progress bar specific styles */
|
|
51
|
+
.omnikit-progress-fill-red { background-color: #ef4444; }
|
|
52
|
+
.omnikit-progress-fill-orange { background-color: #f97316; }
|
|
53
|
+
.omnikit-progress-fill-yellow { background-color: #eab308; }
|
|
54
|
+
.omnikit-progress-fill-green { background-color: #22c55e; }
|
|
55
|
+
|
|
56
|
+
/* Usage status colors that might not be in standard Tailwind */
|
|
57
|
+
.omnikit-usage-red { color: #dc2626; }
|
|
58
|
+
.omnikit-usage-orange { color: #ea580c; }
|
|
59
|
+
.omnikit-usage-yellow { color: #d97706; }
|
|
60
|
+
.omnikit-usage-green { color: #16a34a; }
|
|
61
|
+
|
|
62
|
+
/* Background colors for usage indicators */
|
|
63
|
+
.omnikit-bg-red-100 { background-color: #fee2e2; }
|
|
64
|
+
.omnikit-bg-orange-100 { background-color: #ffedd5; }
|
|
65
|
+
.omnikit-bg-yellow-100 { background-color: #fef3c7; }
|
|
66
|
+
.omnikit-bg-green-100 { background-color: #dcfce7; }
|
|
67
|
+
|
|
68
|
+
/* Dark mode variants */
|
|
69
|
+
@media (prefers-color-scheme: dark) {
|
|
70
|
+
.omnikit-usage-red { color: #f87171; }
|
|
71
|
+
.omnikit-usage-orange { color: #fb923c; }
|
|
72
|
+
.omnikit-usage-yellow { color: #facc15; }
|
|
73
|
+
.omnikit-usage-green { color: #4ade80; }
|
|
74
|
+
|
|
75
|
+
.omnikit-bg-red-100 { background-color: #450a0a; }
|
|
76
|
+
.omnikit-bg-orange-100 { background-color: #431407; }
|
|
77
|
+
.omnikit-bg-yellow-100 { background-color: #451a03; }
|
|
78
|
+
.omnikit-bg-green-100 { background-color: #14532d; }
|
|
79
|
+
|
|
80
|
+
.omnikit-feature-value { color: #ffffff; }
|
|
81
|
+
.omnikit-feature-units { color: #9ca3af; }
|
|
82
|
+
.omnikit-feature-name { color: #9ca3af; }
|
|
83
|
+
.omnikit-price-units { color: #9ca3af; }
|
|
84
|
+
|
|
85
|
+
.omnikit-feature-value .omnikit-boolean-true { color: #4ade80; }
|
|
86
|
+
.omnikit-feature-value .omnikit-boolean-false { color: #f87171; }
|
|
87
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnikit-js/ui",
|
|
3
|
-
"version": "0.3
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "A SaaS billing component for Next.js with Stripe integration",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"module": "src/index.ts",
|
|
@@ -10,13 +10,16 @@
|
|
|
10
10
|
"types": "./src/index.ts",
|
|
11
11
|
"import": "./src/index.ts",
|
|
12
12
|
"require": "./src/index.ts"
|
|
13
|
-
}
|
|
13
|
+
},
|
|
14
|
+
"./styles.css": "./dist/styles.css"
|
|
14
15
|
},
|
|
15
16
|
"files": [
|
|
16
|
-
"src"
|
|
17
|
+
"src",
|
|
18
|
+
"dist/styles.css"
|
|
17
19
|
],
|
|
18
20
|
"scripts": {
|
|
19
|
-
"build": "rollup -c",
|
|
21
|
+
"build": "rollup -c && npm run build:css",
|
|
22
|
+
"build:css": "postcss src/styles/globals.css -o dist/styles.css",
|
|
20
23
|
"dev": "rollup -c -w",
|
|
21
24
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
22
25
|
"prepublishOnly": "npm run build"
|
|
@@ -76,6 +79,7 @@
|
|
|
76
79
|
"@types/react-dom": "^18.3.0",
|
|
77
80
|
"autoprefixer": "^10.4.19",
|
|
78
81
|
"postcss": "^8.4.38",
|
|
82
|
+
"postcss-cli": "^11.0.1",
|
|
79
83
|
"react": "^18.3.1",
|
|
80
84
|
"react-dom": "^18.3.1",
|
|
81
85
|
"rollup": "^4.17.2",
|
|
@@ -156,10 +156,10 @@ export default function BillingClient({ customerData, pricingData, paymentMethod
|
|
|
156
156
|
const formatFeatureValue = (value: any) => {
|
|
157
157
|
// Handle string boolean values
|
|
158
158
|
if (value === 'true' || value === true) {
|
|
159
|
-
return
|
|
159
|
+
return <span className="omnikit-boolean-true">✓</span>
|
|
160
160
|
}
|
|
161
161
|
if (value === 'false' || value === false) {
|
|
162
|
-
return
|
|
162
|
+
return <span className="omnikit-boolean-false">✗</span>
|
|
163
163
|
}
|
|
164
164
|
// Handle numeric values (both string and number)
|
|
165
165
|
const numValue = typeof value === 'string' ? parseFloat(value) : value
|
|
@@ -440,15 +440,15 @@ export default function BillingClient({ customerData, pricingData, paymentMethod
|
|
|
440
440
|
|
|
441
441
|
const getStatusIcon = (percent: number, withinLimit: boolean) => {
|
|
442
442
|
if (!withinLimit || percent >= 90) {
|
|
443
|
-
return <AlertCircle className="h-4 w-4
|
|
443
|
+
return <AlertCircle className="h-4 w-4 omnikit-usage-red" />;
|
|
444
444
|
}
|
|
445
445
|
if (percent >= 75) {
|
|
446
|
-
return <AlertTriangle className="h-4 w-4
|
|
446
|
+
return <AlertTriangle className="h-4 w-4 omnikit-usage-orange" />;
|
|
447
447
|
}
|
|
448
448
|
if (percent >= 50) {
|
|
449
|
-
return <Info className="h-4 w-4
|
|
449
|
+
return <Info className="h-4 w-4 omnikit-usage-yellow" />;
|
|
450
450
|
}
|
|
451
|
-
return <CheckCircle className="h-4 w-4
|
|
451
|
+
return <CheckCircle className="h-4 w-4 omnikit-usage-green" />;
|
|
452
452
|
};
|
|
453
453
|
|
|
454
454
|
return (
|
|
@@ -532,11 +532,11 @@ export default function BillingClient({ customerData, pricingData, paymentMethod
|
|
|
532
532
|
<CardContent className="text-center pb-4 flex-1">
|
|
533
533
|
<div className="mb-4">
|
|
534
534
|
<div className="flex items-baseline justify-center">
|
|
535
|
-
<span className="
|
|
535
|
+
<span className="omnikit-price-text">
|
|
536
536
|
{parseFloat(price?.unit_amount) === 0 ? 'Free' : `$${parseFloat(price?.unit_amount).toFixed(2).replace(/\.00$/, '')}`}
|
|
537
537
|
</span>
|
|
538
538
|
{parseFloat(price?.unit_amount) > 0 && (
|
|
539
|
-
<span className="
|
|
539
|
+
<span className="omnikit-price-units">/month</span>
|
|
540
540
|
)}
|
|
541
541
|
</div>
|
|
542
542
|
{isCurrentPlan ? (
|
|
@@ -548,13 +548,13 @@ export default function BillingClient({ customerData, pricingData, paymentMethod
|
|
|
548
548
|
<div className="space-y-3 flex-1 flex flex-col justify-between min-h-[300px]">
|
|
549
549
|
{features.map((feature: any) => (
|
|
550
550
|
<div key={feature.id} className="border-t pt-3 first:border-t-0 first:pt-0 flex-1 flex flex-col justify-center">
|
|
551
|
-
<div className="
|
|
552
|
-
{formatFeatureValue(feature.value)} <span className="
|
|
551
|
+
<div className="omnikit-feature-value">
|
|
552
|
+
{formatFeatureValue(feature.value)} <span className="omnikit-feature-units">{feature.units}</span>
|
|
553
553
|
</div>
|
|
554
554
|
<TooltipProvider>
|
|
555
555
|
<Tooltip>
|
|
556
556
|
<TooltipTrigger asChild>
|
|
557
|
-
<div className="
|
|
557
|
+
<div className="omnikit-feature-name">
|
|
558
558
|
{feature.name || feature.description}
|
|
559
559
|
</div>
|
|
560
560
|
</TooltipTrigger>
|
|
@@ -49,10 +49,10 @@ export default function SubscriptionConfirmModal({
|
|
|
49
49
|
const formatFeatureValue = (value: any) => {
|
|
50
50
|
// Handle string boolean values
|
|
51
51
|
if (value === 'true' || value === true) {
|
|
52
|
-
return
|
|
52
|
+
return <span className="omnikit-boolean-true">✓</span>
|
|
53
53
|
}
|
|
54
54
|
if (value === 'false' || value === false) {
|
|
55
|
-
return
|
|
55
|
+
return <span className="omnikit-boolean-false">✗</span>
|
|
56
56
|
}
|
|
57
57
|
// Handle numeric values (both string and number)
|
|
58
58
|
const numValue = typeof value === 'string' ? parseFloat(value) : value
|
package/src/styles/globals.css
CHANGED
|
@@ -1,3 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/* Essential component-specific styles only */
|
|
2
|
+
|
|
3
|
+
/* Pricing text styles */
|
|
4
|
+
.omnikit-price-text {
|
|
5
|
+
font-size: 2rem;
|
|
6
|
+
line-height: 1;
|
|
7
|
+
font-weight: 700;
|
|
8
|
+
letter-spacing: -0.025em;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.omnikit-price-units {
|
|
12
|
+
font-size: 0.875rem;
|
|
13
|
+
line-height: 1.25rem;
|
|
14
|
+
color: #6b7280;
|
|
15
|
+
font-weight: 400;
|
|
16
|
+
margin-left: 0.25rem;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* Feature value styles */
|
|
20
|
+
.omnikit-feature-value {
|
|
21
|
+
font-size: 1.125rem;
|
|
22
|
+
line-height: 1.75rem;
|
|
23
|
+
font-weight: 600;
|
|
24
|
+
color: #111827;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.omnikit-feature-units {
|
|
28
|
+
font-size: 0.875rem;
|
|
29
|
+
color: #6b7280;
|
|
30
|
+
font-weight: 400;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.omnikit-feature-name {
|
|
34
|
+
font-size: 0.75rem;
|
|
35
|
+
line-height: 1rem;
|
|
36
|
+
color: #6b7280;
|
|
37
|
+
margin-top: 0.25rem;
|
|
38
|
+
cursor: help;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* Boolean feature icons */
|
|
42
|
+
.omnikit-feature-value .omnikit-boolean-true {
|
|
43
|
+
color: #22c55e;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.omnikit-feature-value .omnikit-boolean-false {
|
|
47
|
+
color: #ef4444;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Progress bar specific styles */
|
|
51
|
+
.omnikit-progress-fill-red { background-color: #ef4444; }
|
|
52
|
+
.omnikit-progress-fill-orange { background-color: #f97316; }
|
|
53
|
+
.omnikit-progress-fill-yellow { background-color: #eab308; }
|
|
54
|
+
.omnikit-progress-fill-green { background-color: #22c55e; }
|
|
55
|
+
|
|
56
|
+
/* Usage status colors that might not be in standard Tailwind */
|
|
57
|
+
.omnikit-usage-red { color: #dc2626; }
|
|
58
|
+
.omnikit-usage-orange { color: #ea580c; }
|
|
59
|
+
.omnikit-usage-yellow { color: #d97706; }
|
|
60
|
+
.omnikit-usage-green { color: #16a34a; }
|
|
61
|
+
|
|
62
|
+
/* Background colors for usage indicators */
|
|
63
|
+
.omnikit-bg-red-100 { background-color: #fee2e2; }
|
|
64
|
+
.omnikit-bg-orange-100 { background-color: #ffedd5; }
|
|
65
|
+
.omnikit-bg-yellow-100 { background-color: #fef3c7; }
|
|
66
|
+
.omnikit-bg-green-100 { background-color: #dcfce7; }
|
|
67
|
+
|
|
68
|
+
/* Dark mode variants */
|
|
69
|
+
@media (prefers-color-scheme: dark) {
|
|
70
|
+
.omnikit-usage-red { color: #f87171; }
|
|
71
|
+
.omnikit-usage-orange { color: #fb923c; }
|
|
72
|
+
.omnikit-usage-yellow { color: #facc15; }
|
|
73
|
+
.omnikit-usage-green { color: #4ade80; }
|
|
74
|
+
|
|
75
|
+
.omnikit-bg-red-100 { background-color: #450a0a; }
|
|
76
|
+
.omnikit-bg-orange-100 { background-color: #431407; }
|
|
77
|
+
.omnikit-bg-yellow-100 { background-color: #451a03; }
|
|
78
|
+
.omnikit-bg-green-100 { background-color: #14532d; }
|
|
79
|
+
|
|
80
|
+
.omnikit-feature-value { color: #ffffff; }
|
|
81
|
+
.omnikit-feature-units { color: #9ca3af; }
|
|
82
|
+
.omnikit-feature-name { color: #9ca3af; }
|
|
83
|
+
.omnikit-price-units { color: #9ca3af; }
|
|
84
|
+
|
|
85
|
+
.omnikit-feature-value .omnikit-boolean-true { color: #4ade80; }
|
|
86
|
+
.omnikit-feature-value .omnikit-boolean-false { color: #f87171; }
|
|
87
|
+
}
|