@dilipod/ui 0.2.0 → 0.2.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/index.d.mts +3 -42
- package/dist/index.d.ts +3 -42
- package/dist/index.js +98 -2030
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +82 -2019
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -1
- package/src/components/badge.tsx +15 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dilipod/ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Dilipod Design System - Shared UI components and styles",
|
|
5
5
|
"author": "Dilipod <hello@dilipod.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -61,7 +61,11 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@phosphor-icons/react": "^2.1.7",
|
|
64
|
+
"@radix-ui/react-accordion": "^1.2.12",
|
|
64
65
|
"@radix-ui/react-dialog": "^1.1.14",
|
|
66
|
+
"@radix-ui/react-label": "^2.1.8",
|
|
67
|
+
"@radix-ui/react-navigation-menu": "^1.2.14",
|
|
68
|
+
"@radix-ui/react-separator": "^1.1.8",
|
|
65
69
|
"@radix-ui/react-slot": "^1.2.3",
|
|
66
70
|
"class-variance-authority": "^0.7.1",
|
|
67
71
|
"clsx": "^2.1.1",
|
package/src/components/badge.tsx
CHANGED
|
@@ -40,19 +40,21 @@ export interface BadgeProps
|
|
|
40
40
|
|
|
41
41
|
const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(
|
|
42
42
|
({ className, variant, size, pulse, pulseColor: pulseColorProp, children, ...props }, ref) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
// Get pulse color based on variant or explicit pulseColor prop
|
|
44
|
+
// Using explicit conditionals so Tailwind can detect the classes
|
|
45
|
+
const getPulseColorClass = () => {
|
|
46
|
+
const color = pulseColorProp || variant || 'default'
|
|
47
|
+
switch (color) {
|
|
48
|
+
case 'success': return 'bg-green-500'
|
|
49
|
+
case 'warning': return 'bg-amber-500'
|
|
50
|
+
case 'error': return 'bg-red-500'
|
|
51
|
+
case 'primary': return 'bg-[var(--cyan)]'
|
|
52
|
+
case 'outline': return 'bg-gray-400'
|
|
53
|
+
default: return 'bg-gray-500'
|
|
54
|
+
}
|
|
50
55
|
}
|
|
51
56
|
|
|
52
|
-
|
|
53
|
-
const pulseColor = pulseColorProp
|
|
54
|
-
? pulseColorMap[pulseColorProp]
|
|
55
|
-
: pulseColorMap[variant || 'default']
|
|
57
|
+
const pulseColorClass = getPulseColorClass()
|
|
56
58
|
|
|
57
59
|
return (
|
|
58
60
|
<span
|
|
@@ -65,13 +67,13 @@ const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(
|
|
|
65
67
|
<span
|
|
66
68
|
className={cn(
|
|
67
69
|
'absolute inline-flex h-full w-full animate-ping rounded-full opacity-75',
|
|
68
|
-
|
|
70
|
+
pulseColorClass
|
|
69
71
|
)}
|
|
70
72
|
/>
|
|
71
73
|
<span
|
|
72
74
|
className={cn(
|
|
73
75
|
'relative inline-flex h-1.5 w-1.5 rounded-full',
|
|
74
|
-
|
|
76
|
+
pulseColorClass
|
|
75
77
|
)}
|
|
76
78
|
/>
|
|
77
79
|
</span>
|