@catalystsoftware/ui 1.0.4 → 1.0.5

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.
Files changed (157) hide show
  1. package/data/tailwind.config.js +261 -3821
  2. package/dist/components/catalyst-ui/buttons/burger.tsx +207 -0
  3. package/dist/components/catalyst-ui/core/data-display/timeline.tsx +210 -0
  4. package/dist/components/catalyst-ui/core/feedback/alert.tsx +491 -0
  5. package/dist/components/catalyst-ui/core/feedback/spinner-1.tsx +65 -0
  6. package/dist/components/catalyst-ui/core/feedback/toast.tsx +1857 -0
  7. package/dist/components/catalyst-ui/core/navigation/menu.tsx +164 -0
  8. package/dist/components/catalyst-ui/forms/toggle-class.tsx +176 -0
  9. package/dist/components/catalyst-ui/hooks/use-copy-to-clipboard.tsx +419 -0
  10. package/dist/components/catalyst-ui/hooks/use-counter.tsx +13 -0
  11. package/dist/components/catalyst-ui/hooks/use-event-listener.tsx +23 -0
  12. package/dist/components/catalyst-ui/hooks/use-export-markdown.tsx +47 -0
  13. package/dist/components/catalyst-ui/hooks/use-focus.tsx +17 -0
  14. package/dist/components/catalyst-ui/hooks/use-interval.tsx +23 -0
  15. package/dist/components/catalyst-ui/hooks/use-is-client.tsx +16 -0
  16. package/dist/components/catalyst-ui/hooks/use-media-query.tsx +19 -0
  17. package/dist/components/catalyst-ui/hooks/use-mobile.tsx +19 -0
  18. package/dist/components/catalyst-ui/hooks/use-resize-observer.tsx +81 -0
  19. package/dist/components/catalyst-ui/hooks/use-timeout.tsx +21 -0
  20. package/dist/components/catalyst-ui/hooks/use-timer.tsx +209 -0
  21. package/dist/components/catalyst-ui/hooks/use-toggle.tsx +12 -0
  22. package/dist/components/catalyst-ui/media/image.tsx +13 -0
  23. package/dist/components/catalyst-ui/overlays/dual-sidebar.tsx +4142 -0
  24. package/dist/components/catalyst-ui/overlays/sidebar-original.tsx +726 -0
  25. package/dist/components/catalyst-ui/primitives/accordion.tsx +250 -0
  26. package/dist/components/catalyst-ui/primitives/alert-dialog.tsx +126 -0
  27. package/dist/components/catalyst-ui/primitives/aspect-ratio.tsx +9 -0
  28. package/dist/components/catalyst-ui/primitives/avatar.tsx +296 -0
  29. package/dist/components/catalyst-ui/primitives/badge.tsx +57 -0
  30. package/dist/components/catalyst-ui/primitives/breadcrumb.tsx +101 -0
  31. package/dist/components/catalyst-ui/primitives/button.tsx +265 -0
  32. package/dist/components/catalyst-ui/primitives/calendar-v4.tsx +208 -0
  33. package/dist/components/catalyst-ui/primitives/calendar.tsx +295 -0
  34. package/dist/components/catalyst-ui/primitives/card.tsx +618 -0
  35. package/dist/components/catalyst-ui/primitives/carousel.tsx +238 -0
  36. package/dist/components/catalyst-ui/primitives/chart.tsx +347 -0
  37. package/dist/components/catalyst-ui/primitives/checkbox.tsx +225 -0
  38. package/dist/components/catalyst-ui/primitives/collapsible.tsx +212 -0
  39. package/dist/components/catalyst-ui/primitives/command.tsx +393 -0
  40. package/dist/components/catalyst-ui/primitives/context-menu.tsx +236 -0
  41. package/dist/components/catalyst-ui/primitives/dialog.tsx +471 -0
  42. package/dist/components/catalyst-ui/primitives/drawer.tsx +761 -0
  43. package/dist/components/catalyst-ui/primitives/dropdown-menu.tsx +290 -0
  44. package/dist/components/catalyst-ui/primitives/empty.tsx +104 -0
  45. package/dist/components/catalyst-ui/primitives/field.tsx +244 -0
  46. package/dist/components/catalyst-ui/primitives/hover-card.tsx +124 -0
  47. package/dist/components/catalyst-ui/primitives/input-otp.tsx +76 -0
  48. package/dist/components/catalyst-ui/primitives/input.tsx +64 -0
  49. package/dist/components/catalyst-ui/primitives/item.tsx +196 -0
  50. package/dist/components/catalyst-ui/primitives/kbd.tsx +75 -0
  51. package/dist/components/catalyst-ui/primitives/label.tsx +24 -0
  52. package/dist/components/catalyst-ui/primitives/navigation-menu.tsx +150 -0
  53. package/dist/components/catalyst-ui/primitives/pagination.tsx +198 -0
  54. package/dist/components/catalyst-ui/primitives/popover.tsx +232 -0
  55. package/dist/components/catalyst-ui/primitives/progress.tsx +34 -0
  56. package/dist/components/catalyst-ui/primitives/radio-group.tsx +43 -0
  57. package/dist/components/catalyst-ui/primitives/resizable.tsx +56 -0
  58. package/dist/components/catalyst-ui/primitives/select.tsx +155 -0
  59. package/dist/components/catalyst-ui/primitives/separator.tsx +74 -0
  60. package/dist/components/catalyst-ui/primitives/sheet.tsx +126 -0
  61. package/dist/components/catalyst-ui/primitives/skeleton.tsx +15 -0
  62. package/dist/components/catalyst-ui/primitives/slider.tsx +27 -0
  63. package/dist/components/catalyst-ui/primitives/switch.tsx +187 -0
  64. package/dist/components/catalyst-ui/primitives/tabs.tsx +335 -0
  65. package/dist/components/catalyst-ui/primitives/textarea.tsx +24 -0
  66. package/dist/components/catalyst-ui/primitives/toggle-group.tsx +55 -0
  67. package/dist/components/catalyst-ui/primitives/toggle.tsx +42 -0
  68. package/dist/components/catalyst-ui/primitives/tooltip.tsx +116 -0
  69. package/dist/components/catalyst-ui/utils/basic-auth.tsx +40 -0
  70. package/dist/components/catalyst-ui/utils/context-storage.tsx +19 -0
  71. package/dist/components/catalyst-ui/utils/cors-middleware.tsx +71 -0
  72. package/dist/components/catalyst-ui/utils/deferred-content.tsx +595 -0
  73. package/dist/components/catalyst-ui/utils/honeypot-middleware.tsx +38 -0
  74. package/dist/components/catalyst-ui/utils/incId.tsx +75 -0
  75. package/dist/components/catalyst-ui/utils/jwk-auth.tsx +36 -0
  76. package/dist/components/catalyst-ui/utils/request-id.tsx +14 -0
  77. package/dist/components/catalyst-ui/utils/secure-headers.tsx +37 -0
  78. package/dist/components/catalyst-ui/utils/server-timing.tsx +23 -0
  79. package/dist/components/catalyst-ui/utils/utils.ts +43 -0
  80. package/dist/components/catalyst-ui/utils/with-cookie.tsx +43 -0
  81. package/dist/components/catalyst-ui/x/accordian-x.tsx +428 -0
  82. package/dist/components/catalyst-ui/x/alert-x.tsx +413 -0
  83. package/dist/components/catalyst-ui/x/animated-text-x.tsx +2242 -0
  84. package/dist/components/catalyst-ui/x/avatar-x.tsx +515 -0
  85. package/dist/components/catalyst-ui/x/badge-x.tsx +670 -0
  86. package/dist/components/catalyst-ui/x/button-X.tsx +2857 -0
  87. package/dist/components/catalyst-ui/x/button-group-x.tsx +847 -0
  88. package/dist/components/catalyst-ui/x/calendar-x.tsx +1910 -0
  89. package/dist/components/catalyst-ui/x/card-x.tsx +2597 -0
  90. package/dist/components/catalyst-ui/x/checkbox-x.tsx +656 -0
  91. package/dist/components/catalyst-ui/x/collapsible-x.tsx +1360 -0
  92. package/dist/components/catalyst-ui/x/combobox-x.tsx +911 -0
  93. package/dist/components/catalyst-ui/x/data-table-x.tsx +1753 -0
  94. package/dist/components/catalyst-ui/x/date-picker-x.tsx +648 -0
  95. package/dist/components/catalyst-ui/x/dialog-x.tsx +659 -0
  96. package/dist/components/catalyst-ui/x/dropdown-menu-x.tsx +612 -0
  97. package/dist/components/catalyst-ui/x/hover-card-x.tsx +375 -0
  98. package/dist/components/catalyst-ui/x/icon-x.tsx +840 -0
  99. package/dist/components/catalyst-ui/x/input-mask-x.tsx +981 -0
  100. package/dist/components/catalyst-ui/x/input-otp-x.tsx +659 -0
  101. package/dist/components/catalyst-ui/x/loader-x.tsx +1757 -0
  102. package/dist/components/catalyst-ui/x/pagination-x.tsx +622 -0
  103. package/dist/components/catalyst-ui/x/popover-x.tsx +744 -0
  104. package/dist/components/catalyst-ui/x/radio-group-x.tsx +499 -0
  105. package/dist/components/catalyst-ui/x/select-x.tsx +1127 -0
  106. package/dist/components/catalyst-ui/x/sheet-x.tsx +668 -0
  107. package/dist/components/catalyst-ui/x/switch-x.tsx +681 -0
  108. package/dist/components/catalyst-ui/x/table-x.tsx +574 -0
  109. package/dist/components/catalyst-ui/x/tabs-x.tsx +839 -0
  110. package/dist/components/catalyst-ui/x/textarea-x.tsx +1263 -0
  111. package/dist/components/catalyst-ui/x/tooltip-x.tsx +396 -0
  112. package/dist/components/catalyst-ui/x/tracker-x.tsx +560 -0
  113. package/dist/data/bg-data.tsx +901 -0
  114. package/dist/data/buttons-data.tsx +2327 -0
  115. package/dist/data/charts-data.tsx +102 -0
  116. package/dist/data/chat-data.tsx +83 -0
  117. package/dist/data/code-data.tsx +1040 -0
  118. package/dist/data/comboboxes-data.tsx +1843 -0
  119. package/dist/data/command-data.tsx +1381 -0
  120. package/dist/data/core-data.tsx +15953 -0
  121. package/dist/data/crm-data.tsx +47 -0
  122. package/dist/data/data.tsx +159 -0
  123. package/dist/data/date-and-time-data.tsx +554 -0
  124. package/dist/data/dependencies.tsx +7 -0
  125. package/dist/data/ecommerce-data.tsx +1387 -0
  126. package/dist/data/forms-data.tsx +7890 -0
  127. package/dist/data/hooks-data.tsx +5487 -0
  128. package/dist/data/index.ts +34 -0
  129. package/dist/data/inputs-data.tsx +557 -0
  130. package/dist/data/interactive-data.tsx +5394 -0
  131. package/dist/data/lofi-data.tsx +18295 -0
  132. package/dist/data/marketing-data.tsx +2546 -0
  133. package/dist/data/media-data.tsx +1510 -0
  134. package/dist/data/motion-data.tsx +5801 -0
  135. package/dist/data/overlay-data.tsx +4136 -0
  136. package/dist/data/pdf-data.tsx +124 -0
  137. package/dist/data/pos-data.tsx +213 -0
  138. package/dist/data/postcss.config.js +6 -0
  139. package/dist/data/primitive-data.tsx +5170 -0
  140. package/dist/data/prompt-data.tsx +1226 -0
  141. package/dist/data/requiredLibs.ts +4 -0
  142. package/dist/data/sandbox-data.tsx +1 -0
  143. package/dist/data/sidebars-data.tsx +5421 -0
  144. package/dist/data/stacks-data.tsx +32 -0
  145. package/dist/data/table-data.tsx +706 -0
  146. package/dist/data/tailwind.config.js +270 -0
  147. package/dist/data/tailwind.config.ngin.js +3830 -0
  148. package/dist/data/tailwind.css +431 -0
  149. package/dist/data/tools-data.tsx +6910 -0
  150. package/dist/data/typography-data.tsx +2050 -0
  151. package/dist/data/utils-data.tsx +6500 -0
  152. package/dist/data/x-data.tsx +1171 -0
  153. package/dist/data.tsx +159 -0
  154. package/package.json +1 -1
  155. package/dist/index.d.ts +0 -3
  156. package/dist/index.d.ts.map +0 -1
  157. package/dist/index.js.map +0 -362
@@ -0,0 +1,670 @@
1
+ import { Badge, cn, badgeVariants } from "~/components/catalyst-ui";
2
+ import { useState, useId } from "react";
3
+
4
+ /**
5
+ * ★ ━━━━ ☆ ━━━━ BadgeX ━━━━ ☆ ━━━━ ★
6
+ * type BadgeXType =
7
+ * | 'Closable' | 'Selectable' | 'BadgeLink' // Interactive
8
+ * | 'InProgress' | 'BadgeCompleted' | 'BadgePending' | 'BadgeFailed' | 'BadgeSuccessful' | 'BadgeBlocked' // Status
9
+ * | 'Dot' | 'BadgeWithIcon' | 'BadgeGradient' | 'BadgeGradientOutline' | 'BadgeRounded' | 'BadgeAnimated' // Visual Styles
10
+ * | 'BadgeSmall' | 'BadgeLarge' // Sizes
11
+ * | 'BadgeNumber' | 'BadgeAvatar' | 'BadgeCart' // Specialized
12
+ *
13
+ * ★ ━━━━ ☆ ━━━━ USAGE ━━━━ ☆ ━━━━ ★
14
+ *
15
+ * ★ ━━━━━━━━━ Interactive Badges ━━━━━━━━━ ★
16
+ * ```jsx
17
+ * // Closable - Click X to close
18
+ * <BadgeX badge="Closable" text="Click to close" />
19
+ *
20
+ * // Selectable - Click to toggle selection
21
+ * <BadgeX
22
+ * badge="Selectable"
23
+ * text="Select me"
24
+ * selectedText="Selected!"
25
+ * />
26
+ *
27
+ * // Link - Clickable badge
28
+ * <BadgeX badge="BadgeLink" text="View details" />
29
+ * ```
30
+ *
31
+ * ★ ━━━━━━━━━ Status Indicators ━━━━━━━━━ ★
32
+ * ```jsx
33
+ * <BadgeX badge="InProgress" />
34
+ * <BadgeX badge="BadgeCompleted" />
35
+ * <BadgeX badge="BadgePending" />
36
+ * <BadgeX badge="BadgeFailed" />
37
+ * <BadgeX badge="BadgeSuccessful" />
38
+ * <BadgeX badge="BadgeBlocked" />
39
+ * ```
40
+ *
41
+ * ★ ━━━━━━━━━ Visual Styles ━━━━━━━━━ ★
42
+ * ```jsx
43
+ * // Dot Indicator
44
+ * <BadgeX badge="Dot" />
45
+ *
46
+ * // With Icon
47
+ * <BadgeX
48
+ * badge="BadgeWithIcon"
49
+ * text="Premium"
50
+ * icon="★"
51
+ * />
52
+ *
53
+ * // Gradient
54
+ * <BadgeX badge="BadgeGradient" text="Premium" />
55
+ *
56
+ * // Gradient Outline
57
+ * <BadgeX badge="BadgeGradientOutline" text="Special Offer" />
58
+ *
59
+ * // Rounded
60
+ * <BadgeX badge="BadgeRounded" text="Rounded Style" />
61
+ *
62
+ * // Animated
63
+ * <BadgeX
64
+ * badge="BadgeAnimated"
65
+ * text="🎉 Check out our new features! 🚀"
66
+ * subText="New"
67
+ * />
68
+ * ```
69
+ *
70
+ * ★ ━━━━━━━━━ Size Variants ━━━━━━━━━ ★
71
+ * ```jsx
72
+ * <BadgeX badge="BadgeSmall" text="Small" />
73
+ * <BadgeX text="Default Size" />
74
+ * <BadgeX badge="BadgeLarge" text="Large" />
75
+ * ```
76
+ *
77
+ * ★ ━━━━━━━━━ Specialized Badges ━━━━━━━━━ ★
78
+ * ```jsx
79
+ * // Number Badge
80
+ * <BadgeX badge="BadgeNumber" text="99+" />
81
+ *
82
+ * // Avatar Badge
83
+ * <BadgeX
84
+ * badge="BadgeAvatar"
85
+ * text="John Doe"
86
+ * src="https://api.dicebear.com/7.x/avataaars/svg?seed=John"
87
+ * />
88
+ *
89
+ * // Cart Notification (used with button)
90
+ * <div className="relative">
91
+ * <button className="p-2 border rounded-lg hover:bg-muted">
92
+ * 🛒 Cart
93
+ * <BadgeX
94
+ * badge="BadgeCart"
95
+ * text="3"
96
+ * className="absolute -top-1 -right-1"
97
+ * />
98
+ * </button>
99
+ * </div>
100
+ * ```
101
+ *
102
+ * ★ ━━━━━━━━━ Custom Usage Example ━━━━━━━━━ ★
103
+ * ```jsx
104
+ * // Project Status Board
105
+ * <div className="space-y-3">
106
+ * <div className="flex items-center gap-2">
107
+ * <BadgeX badge="BadgeCompleted" />
108
+ * <span>Authentication Module</span>
109
+ * </div>
110
+ * <div className="flex items-center gap-2">
111
+ * <BadgeX badge="InProgress" text="In Development" />
112
+ * <span>Dashboard Analytics</span>
113
+ * </div>
114
+ * <div className="flex items-center gap-2">
115
+ * <BadgeX badge="BadgePending" />
116
+ * <span>API Integration</span>
117
+ * </div>
118
+ * </div>
119
+ *
120
+ * // Team Members Display
121
+ * <div className="flex flex-wrap gap-3">
122
+ * <BadgeX badge="BadgeAvatar" text="Alex Chen" />
123
+ * <BadgeX badge="BadgeAvatar" text="Maria Garcia" />
124
+ * <BadgeX
125
+ * badge="BadgeWithIcon"
126
+ * text="Admin"
127
+ * icon="👑"
128
+ * />
129
+ * <BadgeX badge="BadgeLink" text="Add Member" />
130
+ * </div>
131
+ * ```
132
+ *
133
+ * ★ ━━━━━━━━━ Props ━━━━━━━━━ ★
134
+ *
135
+ * BadgeX Props:
136
+ * - `badge`: BadgeXType - Specifies which variant to use
137
+ * - `text`: string - Custom text content (overrides children)
138
+ * - `selectedText`: string - Text to show when selected (for Selectable badge)
139
+ * - `icon`: string | ReactNode - Icon to display (for BadgeWithIcon)
140
+ * - `src`: string - Image source URL (for BadgeAvatar)
141
+ * - `subText`: string - Secondary text (for BadgeAnimated)
142
+ * - `className`: string - Additional CSS classes
143
+ * - `variant`: 'default' | 'secondary' | 'destructive' | 'outline' - Underlying Catalyst UI variant
144
+ * - `onClose`: () => void - Callback when closable badge is closed
145
+ * - `onClick`: () => void - Click handler for interactive badges
146
+ * - All other props are passed to the underlying Badge component
147
+ *
148
+ * ★ ━━━━━━━━━ Basic Usage ━━━━━━━━━ ★
149
+ * ```javascript
150
+ * import { BadgeX } from "./BadgeX";
151
+ *
152
+ * // Default badge
153
+ * <BadgeX>Default</BadgeX>
154
+ *
155
+ * // Specific variant
156
+ * <BadgeX badge="BadgeCompleted">Completed</BadgeX>
157
+ *
158
+ * // With custom text
159
+ * <BadgeX badge="InProgress" text="Processing" />
160
+ * ```
161
+ *
162
+ */
163
+
164
+ export function BadgeX({ badge = 'default', children, ...props }: any) {
165
+ switch (badge) {
166
+ case 'Closable':
167
+ return <BadgeClosable {...props} >{children}</BadgeClosable>;
168
+ case 'Selectable':
169
+ return <BadgeSelectable {...props} >{children}</BadgeSelectable>;
170
+ case 'InProgress':
171
+ return <BadgeInProgress {...props}>{children}</BadgeInProgress>;
172
+ case 'Dot':
173
+ return <BadgeDot {...props}>{children}</BadgeDot>;
174
+ case 'BadgeBlocked':
175
+ return <BadgeBlocked {...props}>{children}</BadgeBlocked>;
176
+ case 'BadgeCompleted':
177
+ return <BadgeCompleted {...props}>{children}</BadgeCompleted>;
178
+ case 'BadgeStatusOnline':
179
+ return <BadgeStatusOnline {...props}>{children}</BadgeStatusOnline>;
180
+ case 'BadgeGradientOutline':
181
+ return <BadgeGradientOutline {...props}>{children}</BadgeGradientOutline>;
182
+ case 'BadgeLink':
183
+ return <BadgeLink {...props}>{children}</BadgeLink>;
184
+ case 'BadgeRounded':
185
+ return <BadgeRounded {...props}>{children}</BadgeRounded>;
186
+ case 'BadgeNumber':
187
+ return <BadgeNumber {...props}>{children}</BadgeNumber>;
188
+ case 'BadgeLarge':
189
+ return <BadgeLarge {...props}>{children}</BadgeLarge>;
190
+ case 'BadgeSmall':
191
+ return <BadgeSmall {...props}>{children}</BadgeSmall>;
192
+ case 'BadgeWithIcon':
193
+ return <BadgeWithIcon {...props}>{children}</BadgeWithIcon>;
194
+ case 'BadgeGradient':
195
+ return <BadgeGradient {...props}>{children}</BadgeGradient>;
196
+ case 'BadgePending':
197
+ return <BadgePending {...props}>{children}</BadgePending>;
198
+ case 'BadgeFailed':
199
+ return <BadgeFailed {...props}>{children}</BadgeFailed>;
200
+ case 'BadgeSuccessful':
201
+ return <BadgeSuccessful {...props}>{children}</BadgeSuccessful>;
202
+ case 'BadgeAvatar':
203
+ return <BadgeAvatar {...props}>{children}</BadgeAvatar>;
204
+ case 'BadgeCart':
205
+ return <BadgeCart {...props}>{children}</BadgeCart>;
206
+ case 'BadgeAnimated':
207
+ return <BadgeAnimated {...props}>{children}</BadgeAnimated>;
208
+ default:
209
+ return <Badge {...props}>{children}</Badge>;
210
+ }
211
+ }
212
+
213
+
214
+ const BadgeClosable = ({ text = "closeable", className, variant = 'closable', children, ...props }) => {
215
+ const [isActive, setIsActive] = useState(true)
216
+
217
+ if (!isActive) return null
218
+
219
+ return (
220
+ <Badge className={cn(badgeVariants({ variant, className }))} {...props}>
221
+ {children ? children : text}
222
+ <button
223
+ className='focus-visible:border-ring focus-visible:ring-ring/50 text-primary-foreground/60 hover:text-primary-foreground -my-px -ms-px -me-1.5 inline-flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-[inherit] p-0 transition-[color,box-shadow] outline-none focus-visible:ring-[3px]'
224
+ aria-label='Close'
225
+ onClick={() => setIsActive(false)}
226
+ >
227
+ <span className='size-3' aria-hidden='true'>✗</span>
228
+ </button>
229
+ </Badge>
230
+ )
231
+ }
232
+ const BadgeSelectable = ({ text = "Selectable", selectedText = "Selected", className, variant = 'selectable', children, ...props }) => {
233
+ const [selected, setSelected] = useState(false)
234
+ const id = useId()
235
+ const badgeText = selected ? selectedText : text
236
+ return (
237
+ <Badge className={cn(badgeVariants({ variant, className }))} {...props}>
238
+ <input
239
+ type="checkbox"
240
+ id={id}
241
+ className='peer sr-only'
242
+ checked={selected}
243
+ onChange={(e) => setSelected(e.target.checked)}
244
+ />
245
+ <span
246
+ className='hidden size-3 text-green-600 peer-checked:block dark:text-green-400'
247
+ aria-hidden='true'
248
+ >
249
+
250
+ </span>
251
+ <label htmlFor={id} className='cursor-pointer select-none'>
252
+ {children ? children : badgeText}
253
+ </label>
254
+ </Badge>
255
+ )
256
+ }
257
+ const BadgeInProgress = ({ text = "In Progress", className, variant = 'in-progress', children, ...props }) => {
258
+ return (
259
+ <Badge className={cn(badgeVariants({ variant, className }))} {...props}>
260
+ <span className='size-1.5 rounded-full bg-amber-600 dark:bg-amber-400' aria-hidden='true' />
261
+ {children ? children : text}
262
+ </Badge>
263
+ )
264
+ }
265
+ const BadgeDot = ({ text = "Dot Badge", className, variant = 'dot', children, ...props }) => {
266
+ return (
267
+ <Badge className={cn(badgeVariants({ variant, className }))} {...props}>
268
+ <span className='bg-primary size-2 rounded-full' aria-hidden='true' />
269
+ {children ? children : text}
270
+ </Badge>
271
+ )
272
+ }
273
+ const BadgeBlocked = ({ text = "Blocked", className, variant = 'blocked', children, ...props }) => {
274
+ return (
275
+ <Badge className={cn(badgeVariants({ variant, className }))} {...props}>
276
+ <span className='bg-destructive size-1.5 rounded-full' aria-hidden='true' />
277
+ {children ? children : text}
278
+ </Badge>
279
+ )
280
+ }
281
+ const BadgeCompleted = ({ text = "Completed", className, variant = 'completed', children, ...props }) => {
282
+ return (
283
+ <Badge className={cn(badgeVariants({ variant, className }))} {...props}>
284
+ <span className='size-1.5 rounded-full bg-green-600 dark:bg-green-400' aria-hidden='true' />
285
+ {children ? children : text}
286
+ </Badge>
287
+ )
288
+ }
289
+ const BadgeStatusOnline = ({ text = "Online", className, variant = 'status-online', children, ...props }) => {
290
+ return (
291
+ <div className='relative w-fit' className={cn(badgeVariants({ variant, className }))} {...props}>
292
+ {/* Your Avatar component here */}
293
+ <Badge >
294
+ <span className='sr-only'>
295
+ {children ? children : text}
296
+ </span>
297
+ </Badge>
298
+ </div>
299
+ )
300
+ }
301
+ const BadgeGradientOutline = ({ text = "Gradient Outline", className, variant = 'gradient-outline', children, ...props }) => {
302
+ return (
303
+ <div className='flex items-center justify-center rounded-full bg-gradient-to-r from-indigo-500 to-pink-500 p-0.5'>
304
+ <Badge className={cn(badgeVariants({ variant, className }))} {...props}>
305
+ {children ? children : text}
306
+ </Badge>
307
+ </div>
308
+ )
309
+ }
310
+ const BadgeLink = ({ text = "Link", className, variant = 'link', children, ...props }) => {
311
+ return (
312
+ <Badge asChild className={cn(badgeVariants({ variant, className }))} {...props}>
313
+ <a href='#'>
314
+ {children ? children : text} <span className='size-3' aria-hidden='true'>→</span>
315
+ </a>
316
+ </Badge>
317
+ )
318
+ }
319
+ const BadgeRounded = ({ text = "Rounded", className, variant = 'rounded', children, ...props }) => {
320
+ return <Badge className={cn(badgeVariants({ variant, className }))} {...props}>
321
+ {children ? children : text}
322
+ </Badge>
323
+ }
324
+ const BadgeNumber = ({ text = "8", className, variant = 'number', children, ...props }) => {
325
+ return <Badge className={cn(badgeVariants({ variant, className }))} {...props}>
326
+ {children ? children : text}
327
+ </Badge>
328
+ }
329
+ const BadgeLarge = ({ text = "Large", className, variant = 'large', children, ...props }) => {
330
+ return <Badge className={cn(badgeVariants({ variant, className }))} {...props}>
331
+ {children ? children : text}
332
+ </Badge>
333
+ }
334
+ const BadgeSmall = ({ text = "Small", className, variant = 'small', children, ...props }) => {
335
+ return <Badge className={cn(badgeVariants({ variant, className }))} {...props}>
336
+ {children ? children : text}
337
+ </Badge>
338
+ }
339
+ const BadgeWithIcon = ({ text = "With Icon", icon, className, variant = 'with-icon', children, ...props }) => {
340
+ return (
341
+ <Badge className={cn(badgeVariants({ variant, className }))} {...props}>
342
+ <span className='size-3' aria-hidden='true'>{icon ? icon : '★'}</span>
343
+ {children ? children : text}
344
+ </Badge>
345
+ )
346
+ }
347
+ const BadgeGradient = ({ text = "Gradient", className, variant = 'gradient', children, ...props }) => {
348
+ return (
349
+ <Badge className={cn(badgeVariants({ variant, className }))} {...props}>
350
+ {children ? children : text}
351
+ </Badge>
352
+ )
353
+ }
354
+ const BadgePending = ({ text = "Pending", className, variant = 'pending', children, ...props }) => {
355
+ return (
356
+ <Badge className={cn(badgeVariants({ variant, className }))} {...props}>
357
+ <span className='size-3' aria-hidden='true'>⚠</span>
358
+ {children ? children : text}
359
+ </Badge>
360
+ )
361
+ }
362
+ const BadgeFailed = ({ text = "Failed", className, variant = 'failed', children, ...props }) => {
363
+ return (
364
+ <Badge className={cn(badgeVariants({ variant, className }))} {...props}>
365
+ <span className='size-3' aria-hidden='true'>⊘</span>
366
+ {children ? children : text}
367
+ </Badge>
368
+ )
369
+ }
370
+ const BadgeSuccessful = ({ text = "Successful", className, variant = 'successful', children, ...props }) => {
371
+ return (
372
+ <Badge className={cn(badgeVariants({ variant, className }))} {...props}>
373
+ <span className='size-3' aria-hidden='true'>✓</span>
374
+ {children ? children : text}
375
+ </Badge>
376
+ )
377
+ }
378
+ const BadgeAvatar = ({ text = "Blocked", src = "https://cdn.shadcnstudio.com/ss-assets/avatar/avatar-5.png", className, variant = 'avatar', children, ...props }) => {
379
+ return (
380
+ <Badge className={cn(badgeVariants({ variant, className }))} {...props}>
381
+ <img
382
+ src={src}
383
+ alt='Avatar'
384
+ className='size-6 rounded-full'
385
+ />
386
+ {children ? children : text}
387
+ </Badge>
388
+ )
389
+ }
390
+ const BadgeCart = ({ text = "Cart", className, variant = 'cart', children, ...props }) => {
391
+ return (
392
+ <div className='relative w-fit' >
393
+ {/* Your cart icon/avatar here */}
394
+ <Badge className={cn(badgeVariants({ variant, className }))} {...props} >
395
+ {children ? children : text}
396
+ </Badge>
397
+ </div>
398
+ )
399
+ }
400
+ const BadgeAnimated = ({ text = "🎉 Amazing Features! 🪄", subText = 'New', className, variant = 'animated', children, ...props }) => {
401
+ return (
402
+ <Badge showBeam className={cn(badgeVariants({ variant, className }))} {...props}>
403
+ <span className="bg-primary text-primary-foreground rounded-full px-1.5">
404
+ {subText}
405
+ </span>
406
+ <span className="text-sm text-wrap">
407
+ {children ? children : text}
408
+ </span>
409
+ </Badge>
410
+ )
411
+ }
412
+
413
+
414
+ export function BadgeXDemo() {
415
+ const [selectedBadges, setSelectedBadges] = useState({});
416
+
417
+ return (
418
+ <div className="p-8 max-w-7xl mx-auto bg-background">
419
+ <header className="mb-12">
420
+ <h1 className="text-4xl font-bold mb-2">BadgeX Demo</h1>
421
+ <p className="text-muted-foreground">
422
+ A comprehensive collection of badge variants built with Catalyst UI
423
+ </p>
424
+ </header>
425
+
426
+ <div className="space-y-12">
427
+ {/* Section 1: Interactive Badges */}
428
+ <section>
429
+ <h2 className="text-2xl font-semibold mb-6 pb-2 border-b">Interactive Badges</h2>
430
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
431
+ <div className="space-y-4 p-4 border rounded-lg">
432
+ <h3 className="font-medium">Closable</h3>
433
+ <p className="text-sm text-muted-foreground mb-2">Click the X to close</p>
434
+ <BadgeX badge="Closable" text="Click to close" />
435
+ </div>
436
+
437
+ <div className="space-y-4 p-4 border rounded-lg">
438
+ <h3 className="font-medium">Selectable</h3>
439
+ <p className="text-sm text-muted-foreground mb-2">Click to toggle selection</p>
440
+ <BadgeX
441
+ badge="Selectable"
442
+ text="Select me"
443
+ selectedText="Selected!"
444
+ />
445
+ </div>
446
+
447
+ <div className="space-y-4 p-4 border rounded-lg">
448
+ <h3 className="font-medium">Link</h3>
449
+ <p className="text-sm text-muted-foreground mb-2">Clickable badge link</p>
450
+ <BadgeX badge="BadgeLink" text="View details" />
451
+ </div>
452
+ </div>
453
+ </section>
454
+
455
+ {/* Section 2: Status Badges */}
456
+ <section>
457
+ <h2 className="text-2xl font-semibold mb-6 pb-2 border-b">Status Indicators</h2>
458
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
459
+ <div className="space-y-4 p-4 border rounded-lg">
460
+ <h3 className="font-medium">In Progress</h3>
461
+ <BadgeX badge="InProgress" />
462
+ </div>
463
+
464
+ <div className="space-y-4 p-4 border rounded-lg">
465
+ <h3 className="font-medium">Completed</h3>
466
+ <BadgeX badge="BadgeCompleted" />
467
+ </div>
468
+
469
+ <div className="space-y-4 p-4 border rounded-lg">
470
+ <h3 className="font-medium">Pending</h3>
471
+ <BadgeX badge="BadgePending" />
472
+ </div>
473
+
474
+ <div className="space-y-4 p-4 border rounded-lg">
475
+ <h3 className="font-medium">Failed</h3>
476
+ <BadgeX badge="BadgeFailed" />
477
+ </div>
478
+
479
+ <div className="space-y-4 p-4 border rounded-lg">
480
+ <h3 className="font-medium">Successful</h3>
481
+ <BadgeX badge="BadgeSuccessful" />
482
+ </div>
483
+
484
+ <div className="space-y-4 p-4 border rounded-lg">
485
+ <h3 className="font-medium">Blocked</h3>
486
+ <BadgeX badge="BadgeBlocked" />
487
+ </div>
488
+ </div>
489
+ </section>
490
+
491
+ {/* Section 3: Visual Styles */}
492
+ <section>
493
+ <h2 className="text-2xl font-semibold mb-6 pb-2 border-b">Visual Styles</h2>
494
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
495
+ <div className="space-y-4 p-4 border rounded-lg">
496
+ <h3 className="font-medium">Dot Indicator</h3>
497
+ <BadgeX badge="Dot" />
498
+ </div>
499
+
500
+ <div className="space-y-4 p-4 border rounded-lg">
501
+ <h3 className="font-medium">With Icon</h3>
502
+ <BadgeX
503
+ badge="BadgeWithIcon"
504
+ text="Premium"
505
+ icon="★"
506
+ />
507
+ </div>
508
+
509
+ <div className="space-y-4 p-4 border rounded-lg">
510
+ <h3 className="font-medium">Gradient</h3>
511
+ <BadgeX badge="BadgeGradient" text="Premium" />
512
+ </div>
513
+
514
+ <div className="space-y-4 p-4 border rounded-lg">
515
+ <h3 className="font-medium">Gradient Outline</h3>
516
+ <BadgeX badge="BadgeGradientOutline" text="Special Offer" />
517
+ </div>
518
+
519
+ <div className="space-y-4 p-4 border rounded-lg">
520
+ <h3 className="font-medium">Rounded</h3>
521
+ <BadgeX badge="BadgeRounded" text="Rounded Style" />
522
+ </div>
523
+
524
+ <div className="space-y-4 p-4 border rounded-lg">
525
+ <h3 className="font-medium">Animated</h3>
526
+ <BadgeX
527
+ badge="BadgeAnimated"
528
+ text="🎉 Check out our new features! 🚀"
529
+ subText="New"
530
+ />
531
+ </div>
532
+ </div>
533
+ </section>
534
+
535
+ {/* Section 4: Sizes */}
536
+ <section>
537
+ <h2 className="text-2xl font-semibold mb-6 pb-2 border-b">Size Variants</h2>
538
+ <div className="grid grid-cols-1 md:grid-cols-3 gap-6">
539
+ <div className="space-y-4 p-4 border rounded-lg">
540
+ <h3 className="font-medium">Small</h3>
541
+ <BadgeX badge="BadgeSmall" text="Small" />
542
+ </div>
543
+
544
+ <div className="space-y-4 p-4 border rounded-lg">
545
+ <h3 className="font-medium">Default</h3>
546
+ <BadgeX text="Default Size" />
547
+ </div>
548
+
549
+ <div className="space-y-4 p-4 border rounded-lg">
550
+ <h3 className="font-medium">Large</h3>
551
+ <BadgeX badge="BadgeLarge" text="Large" />
552
+ </div>
553
+ </div>
554
+ </section>
555
+
556
+ {/* Section 5: Specialized Badges */}
557
+ <section>
558
+ <h2 className="text-2xl font-semibold mb-6 pb-2 border-b">Specialized</h2>
559
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
560
+ <div className="space-y-4 p-4 border rounded-lg">
561
+ <h3 className="font-medium">Number</h3>
562
+ <BadgeX badge="BadgeNumber" text="99+" />
563
+ </div>
564
+
565
+ <div className="space-y-4 p-4 border rounded-lg">
566
+ <h3 className="font-medium">Avatar</h3>
567
+ <BadgeX
568
+ badge="BadgeAvatar"
569
+ text="John Doe"
570
+ src="https://api.dicebear.com/7.x/avataaars/svg?seed=John"
571
+ />
572
+ </div>
573
+
574
+ <div className="space-y-4 p-4 border rounded-lg">
575
+ <h3 className="font-medium">Cart Notification</h3>
576
+ <div className="relative">
577
+ <button className="p-2 border rounded-lg hover:bg-muted">
578
+ 🛒 Cart
579
+ <BadgeX
580
+ badge="BadgeCart"
581
+ text="3"
582
+ className="absolute -top-1 -right-1"
583
+ />
584
+ </button>
585
+ </div>
586
+ </div>
587
+ </div>
588
+ </section>
589
+
590
+ {/* Section 6: Custom Example */}
591
+ <section>
592
+ <h2 className="text-2xl font-semibold mb-6 pb-2 border-b">Custom Usage Example</h2>
593
+ <div className="p-6 border rounded-lg bg-card">
594
+ <div className="mb-6">
595
+ <h3 className="font-medium mb-4">Project Status Board</h3>
596
+ <div className="space-y-3">
597
+ <div className="flex items-center gap-2">
598
+ <BadgeX badge="BadgeCompleted" />
599
+ <span>Authentication Module</span>
600
+ </div>
601
+ <div className="flex items-center gap-2">
602
+ <BadgeX badge="InProgress" text="In Development" />
603
+ <span>Dashboard Analytics</span>
604
+ </div>
605
+ <div className="flex items-center gap-2">
606
+ <BadgeX badge="BadgePending" />
607
+ <span>API Integration</span>
608
+ </div>
609
+ <div className="flex items-center gap-2">
610
+ <BadgeX badge="BadgeBlocked" />
611
+ <span>Payment Gateway</span>
612
+ </div>
613
+ </div>
614
+ </div>
615
+
616
+ <div>
617
+ <h3 className="font-medium mb-4">Team Members</h3>
618
+ <div className="flex flex-wrap gap-3">
619
+ <BadgeX badge="BadgeAvatar" text="Alex Chen" />
620
+ <BadgeX badge="BadgeAvatar" text="Maria Garcia" />
621
+ <BadgeX
622
+ badge="BadgeWithIcon"
623
+ text="Admin"
624
+ icon="👑"
625
+ />
626
+ <BadgeX
627
+ badge="BadgeLink"
628
+ text="Add Member"
629
+ />
630
+ </div>
631
+ </div>
632
+ </div>
633
+ </section>
634
+
635
+ {/* Usage Instructions */}
636
+ <section className="mt-12 p-6 border rounded-lg bg-muted/30">
637
+ <h2 className="text-2xl font-semibold mb-4">Usage</h2>
638
+ <div className="space-y-4">
639
+ <div>
640
+ <h3 className="font-medium mb-2">Basic Usage</h3>
641
+ <pre className="bg-muted p-3 rounded text-sm overflow-x-auto">
642
+ {`import { BadgeX } from "./BadgeX";
643
+
644
+ // Default badge
645
+ <BadgeX>Default</BadgeX>
646
+
647
+ // Specific variant
648
+ <BadgeX badge="BadgeCompleted">Completed</BadgeX>
649
+
650
+ // With custom text
651
+ <BadgeX badge="InProgress" text="Processing" />`}
652
+ </pre>
653
+ </div>
654
+
655
+ <div>
656
+ <h3 className="font-medium mb-2">Props</h3>
657
+ <ul className="list-disc pl-5 space-y-1 text-sm">
658
+ <li><code>badge</code>: Specifies which variant to use</li>
659
+ <li><code>text</code>: Custom text content (overrides children)</li>
660
+ <li><code>className</code>: Additional CSS classes</li>
661
+ <li><code>variant</code>: Underlying Catalyst UI variant</li>
662
+ <li>All other props are passed to the underlying Badge component</li>
663
+ </ul>
664
+ </div>
665
+ </div>
666
+ </section>
667
+ </div>
668
+ </div>
669
+ );
670
+ }