@catalystsoftware/ui 1.0.5 → 1.0.6
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/data/data.tsx +29 -29
- package/dist/data/tailwind.config.js +3821 -261
- package/dist/data.tsx +29 -29
- package/package.json +4 -3
- package/components/catalyst-ui/buttons/burger.tsx +0 -207
- package/components/catalyst-ui/core/data-display/timeline.tsx +0 -210
- package/components/catalyst-ui/core/feedback/alert.tsx +0 -491
- package/components/catalyst-ui/core/feedback/spinner-1.tsx +0 -65
- package/components/catalyst-ui/core/feedback/toast.tsx +0 -1857
- package/components/catalyst-ui/core/navigation/menu.tsx +0 -164
- package/components/catalyst-ui/forms/toggle-class.tsx +0 -176
- package/components/catalyst-ui/hooks/use-copy-to-clipboard.tsx +0 -419
- package/components/catalyst-ui/hooks/use-counter.tsx +0 -13
- package/components/catalyst-ui/hooks/use-event-listener.tsx +0 -23
- package/components/catalyst-ui/hooks/use-export-markdown.tsx +0 -47
- package/components/catalyst-ui/hooks/use-focus.tsx +0 -17
- package/components/catalyst-ui/hooks/use-interval.tsx +0 -23
- package/components/catalyst-ui/hooks/use-is-client.tsx +0 -16
- package/components/catalyst-ui/hooks/use-media-query.tsx +0 -19
- package/components/catalyst-ui/hooks/use-mobile.tsx +0 -19
- package/components/catalyst-ui/hooks/use-resize-observer.tsx +0 -81
- package/components/catalyst-ui/hooks/use-timeout.tsx +0 -21
- package/components/catalyst-ui/hooks/use-timer.tsx +0 -209
- package/components/catalyst-ui/hooks/use-toggle.tsx +0 -12
- package/components/catalyst-ui/media/image.tsx +0 -13
- package/components/catalyst-ui/overlays/dual-sidebar.tsx +0 -4142
- package/components/catalyst-ui/overlays/sidebar-original.tsx +0 -726
- package/components/catalyst-ui/primitives/accordion.tsx +0 -250
- package/components/catalyst-ui/primitives/alert-dialog.tsx +0 -126
- package/components/catalyst-ui/primitives/aspect-ratio.tsx +0 -9
- package/components/catalyst-ui/primitives/avatar.tsx +0 -296
- package/components/catalyst-ui/primitives/badge.tsx +0 -57
- package/components/catalyst-ui/primitives/breadcrumb.tsx +0 -101
- package/components/catalyst-ui/primitives/button.tsx +0 -265
- package/components/catalyst-ui/primitives/calendar-v4.tsx +0 -208
- package/components/catalyst-ui/primitives/calendar.tsx +0 -295
- package/components/catalyst-ui/primitives/card.tsx +0 -618
- package/components/catalyst-ui/primitives/carousel.tsx +0 -238
- package/components/catalyst-ui/primitives/chart.tsx +0 -347
- package/components/catalyst-ui/primitives/checkbox.tsx +0 -225
- package/components/catalyst-ui/primitives/collapsible.tsx +0 -212
- package/components/catalyst-ui/primitives/command.tsx +0 -393
- package/components/catalyst-ui/primitives/context-menu.tsx +0 -236
- package/components/catalyst-ui/primitives/dialog.tsx +0 -471
- package/components/catalyst-ui/primitives/drawer.tsx +0 -761
- package/components/catalyst-ui/primitives/dropdown-menu.tsx +0 -290
- package/components/catalyst-ui/primitives/empty.tsx +0 -104
- package/components/catalyst-ui/primitives/field.tsx +0 -244
- package/components/catalyst-ui/primitives/hover-card.tsx +0 -124
- package/components/catalyst-ui/primitives/input-otp.tsx +0 -76
- package/components/catalyst-ui/primitives/input.tsx +0 -64
- package/components/catalyst-ui/primitives/item.tsx +0 -196
- package/components/catalyst-ui/primitives/kbd.tsx +0 -75
- package/components/catalyst-ui/primitives/label.tsx +0 -24
- package/components/catalyst-ui/primitives/navigation-menu.tsx +0 -150
- package/components/catalyst-ui/primitives/pagination.tsx +0 -198
- package/components/catalyst-ui/primitives/popover.tsx +0 -232
- package/components/catalyst-ui/primitives/progress.tsx +0 -34
- package/components/catalyst-ui/primitives/radio-group.tsx +0 -43
- package/components/catalyst-ui/primitives/resizable.tsx +0 -56
- package/components/catalyst-ui/primitives/select.tsx +0 -155
- package/components/catalyst-ui/primitives/separator.tsx +0 -74
- package/components/catalyst-ui/primitives/sheet.tsx +0 -126
- package/components/catalyst-ui/primitives/skeleton.tsx +0 -15
- package/components/catalyst-ui/primitives/slider.tsx +0 -27
- package/components/catalyst-ui/primitives/switch.tsx +0 -187
- package/components/catalyst-ui/primitives/tabs.tsx +0 -335
- package/components/catalyst-ui/primitives/textarea.tsx +0 -24
- package/components/catalyst-ui/primitives/toggle-group.tsx +0 -55
- package/components/catalyst-ui/primitives/toggle.tsx +0 -42
- package/components/catalyst-ui/primitives/tooltip.tsx +0 -116
- package/components/catalyst-ui/utils/basic-auth.tsx +0 -40
- package/components/catalyst-ui/utils/context-storage.tsx +0 -19
- package/components/catalyst-ui/utils/cors-middleware.tsx +0 -71
- package/components/catalyst-ui/utils/deferred-content.tsx +0 -595
- package/components/catalyst-ui/utils/honeypot-middleware.tsx +0 -38
- package/components/catalyst-ui/utils/incId.tsx +0 -75
- package/components/catalyst-ui/utils/jwk-auth.tsx +0 -36
- package/components/catalyst-ui/utils/request-id.tsx +0 -14
- package/components/catalyst-ui/utils/secure-headers.tsx +0 -37
- package/components/catalyst-ui/utils/server-timing.tsx +0 -23
- package/components/catalyst-ui/utils/utils.ts +0 -43
- package/components/catalyst-ui/utils/with-cookie.tsx +0 -43
- package/components/catalyst-ui/x/accordian-x.tsx +0 -428
- package/components/catalyst-ui/x/alert-x.tsx +0 -413
- package/components/catalyst-ui/x/animated-text-x.tsx +0 -2242
- package/components/catalyst-ui/x/avatar-x.tsx +0 -515
- package/components/catalyst-ui/x/badge-x.tsx +0 -670
- package/components/catalyst-ui/x/button-X.tsx +0 -2857
- package/components/catalyst-ui/x/button-group-x.tsx +0 -847
- package/components/catalyst-ui/x/calendar-x.tsx +0 -1910
- package/components/catalyst-ui/x/card-x.tsx +0 -2597
- package/components/catalyst-ui/x/checkbox-x.tsx +0 -656
- package/components/catalyst-ui/x/collapsible-x.tsx +0 -1360
- package/components/catalyst-ui/x/combobox-x.tsx +0 -911
- package/components/catalyst-ui/x/data-table-x.tsx +0 -1753
- package/components/catalyst-ui/x/date-picker-x.tsx +0 -648
- package/components/catalyst-ui/x/dialog-x.tsx +0 -659
- package/components/catalyst-ui/x/dropdown-menu-x.tsx +0 -612
- package/components/catalyst-ui/x/hover-card-x.tsx +0 -375
- package/components/catalyst-ui/x/icon-x.tsx +0 -840
- package/components/catalyst-ui/x/input-mask-x.tsx +0 -981
- package/components/catalyst-ui/x/input-otp-x.tsx +0 -659
- package/components/catalyst-ui/x/loader-x.tsx +0 -1757
- package/components/catalyst-ui/x/pagination-x.tsx +0 -622
- package/components/catalyst-ui/x/popover-x.tsx +0 -744
- package/components/catalyst-ui/x/radio-group-x.tsx +0 -499
- package/components/catalyst-ui/x/select-x.tsx +0 -1127
- package/components/catalyst-ui/x/sheet-x.tsx +0 -668
- package/components/catalyst-ui/x/switch-x.tsx +0 -681
- package/components/catalyst-ui/x/table-x.tsx +0 -574
- package/components/catalyst-ui/x/tabs-x.tsx +0 -839
- package/components/catalyst-ui/x/textarea-x.tsx +0 -1263
- package/components/catalyst-ui/x/tooltip-x.tsx +0 -396
- package/components/catalyst-ui/x/tracker-x.tsx +0 -560
- package/data/bg-data.tsx +0 -901
- package/data/buttons-data.tsx +0 -2327
- package/data/charts-data.tsx +0 -102
- package/data/chat-data.tsx +0 -83
- package/data/code-data.tsx +0 -1040
- package/data/comboboxes-data.tsx +0 -1843
- package/data/command-data.tsx +0 -1381
- package/data/core-data.tsx +0 -15953
- package/data/crm-data.tsx +0 -47
- package/data/data.tsx +0 -159
- package/data/date-and-time-data.tsx +0 -554
- package/data/dependencies.tsx +0 -7
- package/data/ecommerce-data.tsx +0 -1387
- package/data/forms-data.tsx +0 -7890
- package/data/hooks-data.tsx +0 -5487
- package/data/index.ts +0 -34
- package/data/inputs-data.tsx +0 -557
- package/data/interactive-data.tsx +0 -5394
- package/data/lofi-data.tsx +0 -18295
- package/data/marketing-data.tsx +0 -2546
- package/data/media-data.tsx +0 -1510
- package/data/motion-data.tsx +0 -5801
- package/data/overlay-data.tsx +0 -4136
- package/data/pdf-data.tsx +0 -124
- package/data/pos-data.tsx +0 -213
- package/data/postcss.config.js +0 -6
- package/data/primitive-data.tsx +0 -5170
- package/data/prompt-data.tsx +0 -1226
- package/data/requiredLibs.ts +0 -4
- package/data/sandbox-data.tsx +0 -1
- package/data/sidebars-data.tsx +0 -5421
- package/data/stacks-data.tsx +0 -32
- package/data/table-data.tsx +0 -706
- package/data/tailwind.config.js +0 -270
- package/data/tailwind.config.ngin.js +0 -3830
- package/data/tailwind.css +0 -431
- package/data/tools-data.tsx +0 -6910
- package/data/typography-data.tsx +0 -2050
- package/data/utils-data.tsx +0 -6500
- package/data/x-data.tsx +0 -1171
|
@@ -1,515 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import * as AvatarPrimitive from '@radix-ui/react-avatar'
|
|
3
|
-
import { CheckIcon, HomeIcon, PlusCircleIcon, BadgeCheckIcon, PlusIcon } from 'lucide-react'
|
|
4
|
-
import { cn } from '~/components/catalyst-ui'
|
|
5
|
-
import {
|
|
6
|
-
Avatar,
|
|
7
|
-
AvatarImage,
|
|
8
|
-
AvatarFallback,
|
|
9
|
-
AvatarGroup,
|
|
10
|
-
avatarVariants
|
|
11
|
-
} from '~/components/catalyst-ui'
|
|
12
|
-
import { Badge } from '~/components/catalyst-ui'
|
|
13
|
-
import {
|
|
14
|
-
Tooltip,
|
|
15
|
-
TooltipTrigger,
|
|
16
|
-
TooltipContent
|
|
17
|
-
} from '~/components/catalyst-ui'
|
|
18
|
-
import {
|
|
19
|
-
DropdownMenu,
|
|
20
|
-
DropdownMenuTrigger,
|
|
21
|
-
DropdownMenuContent,
|
|
22
|
-
DropdownMenuItem
|
|
23
|
-
} from '~/components/catalyst-ui'
|
|
24
|
-
import type { LucideIcon } from 'lucide-react'
|
|
25
|
-
|
|
26
|
-
// 1. Type Definition
|
|
27
|
-
type AvatarType =
|
|
28
|
-
| 'default'
|
|
29
|
-
| 'ring'
|
|
30
|
-
| 'rounded'
|
|
31
|
-
| 'statusBusy'
|
|
32
|
-
| 'statusRing'
|
|
33
|
-
| 'statusAway'
|
|
34
|
-
| 'plus'
|
|
35
|
-
| 'notificationBadge'
|
|
36
|
-
| 'verified'
|
|
37
|
-
| 'icon'
|
|
38
|
-
|
|
39
|
-
// 2. Context Creation
|
|
40
|
-
const AvatarXContext = React.createContext<AvatarType>('default')
|
|
41
|
-
|
|
42
|
-
// 3. Parent Wrapper
|
|
43
|
-
export function AvatarX({ avatar = 'default', ...props }: any) {
|
|
44
|
-
return (
|
|
45
|
-
<AvatarXContext.Provider value={avatar}>
|
|
46
|
-
<Avatar {...props} />
|
|
47
|
-
</AvatarXContext.Provider>
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// 4. Image and Fallback Passthroughs
|
|
52
|
-
export function AvatarXImage({ ...props }: any) {
|
|
53
|
-
const avatarType = React.useContext(AvatarXContext)
|
|
54
|
-
switch (avatarType) {
|
|
55
|
-
default:
|
|
56
|
-
return <AvatarImage {...props} />
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function AvatarXFallback({ ...props }: any) {
|
|
62
|
-
const avatarType = React.useContext(AvatarXContext)
|
|
63
|
-
switch (avatarType) {
|
|
64
|
-
default:
|
|
65
|
-
return <AvatarFallback {...props} />
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// 5. Main Structural Variant Component
|
|
71
|
-
export function AvatarXWrapper({ children, ...props }: any) {
|
|
72
|
-
const avatarType = React.useContext(AvatarXContext)
|
|
73
|
-
const Icon = props.icon
|
|
74
|
-
const badgeCount = props.badgeCount || 8
|
|
75
|
-
const statusIcon = props.statusIcon || CheckIcon
|
|
76
|
-
const StatusIconComponent = statusIcon
|
|
77
|
-
|
|
78
|
-
switch (avatarType) {
|
|
79
|
-
case 'ring':
|
|
80
|
-
return (
|
|
81
|
-
<Avatar className={cn('ring-ring ring-2', props.className)} {...props}>
|
|
82
|
-
{children}
|
|
83
|
-
</Avatar>
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
case 'rounded':
|
|
87
|
-
return (
|
|
88
|
-
<Avatar className={cn('rounded-sm', props.className)} {...props}>
|
|
89
|
-
{React.Children.map(children, child => {
|
|
90
|
-
if (React.isValidElement(child) && child.type === AvatarXImage) {
|
|
91
|
-
return React.cloneElement(child as React.ReactElement<any>, {
|
|
92
|
-
className: cn('rounded-sm', child.props.className)
|
|
93
|
-
})
|
|
94
|
-
}
|
|
95
|
-
return child
|
|
96
|
-
})}
|
|
97
|
-
</Avatar>
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
case 'statusBusy':
|
|
101
|
-
return (
|
|
102
|
-
<div className='relative w-fit'>
|
|
103
|
-
<Avatar className={props.className} {...props}>
|
|
104
|
-
{children}
|
|
105
|
-
</Avatar>
|
|
106
|
-
<span className='border-background bg-destructive absolute -right-0.5 -bottom-0.5 size-3 rounded-full border-2'>
|
|
107
|
-
<span className='sr-only'>Busy</span>
|
|
108
|
-
</span>
|
|
109
|
-
</div>
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
case 'statusRing':
|
|
113
|
-
return (
|
|
114
|
-
<div className='relative w-fit'>
|
|
115
|
-
<Avatar className={cn('ring-offset-background ring-2 ring-green-600 ring-offset-2 dark:ring-green-400', props.className)} {...props}>
|
|
116
|
-
{children}
|
|
117
|
-
</Avatar>
|
|
118
|
-
<span className='absolute -right-1.5 -bottom-1.5 inline-flex size-4 items-center justify-center rounded-full bg-green-600 dark:bg-green-400'>
|
|
119
|
-
<StatusIconComponent className='size-3 text-white' />
|
|
120
|
-
</span>
|
|
121
|
-
</div>
|
|
122
|
-
)
|
|
123
|
-
|
|
124
|
-
case 'statusAway':
|
|
125
|
-
return (
|
|
126
|
-
<div className='relative w-fit'>
|
|
127
|
-
<Avatar className={cn('rounded-sm', props.className)} {...props}>
|
|
128
|
-
{React.Children.map(children, child => {
|
|
129
|
-
if (React.isValidElement(child) && child.type === AvatarXImage) {
|
|
130
|
-
return React.cloneElement(child as React.ReactElement<any>, {
|
|
131
|
-
className: cn('rounded-sm', child.props.className)
|
|
132
|
-
})
|
|
133
|
-
}
|
|
134
|
-
return child
|
|
135
|
-
})}
|
|
136
|
-
</Avatar>
|
|
137
|
-
<span className='border-background absolute -top-1.5 -right-1.5 size-3 rounded-full border-2 bg-amber-600 dark:bg-amber-400'>
|
|
138
|
-
<span className='sr-only'>Away</span>
|
|
139
|
-
</span>
|
|
140
|
-
</div>
|
|
141
|
-
)
|
|
142
|
-
|
|
143
|
-
case 'plus':
|
|
144
|
-
return (
|
|
145
|
-
<div className='relative w-fit'>
|
|
146
|
-
<Avatar className={cn('size-10', props.className)} {...props}>
|
|
147
|
-
{children}
|
|
148
|
-
</Avatar>
|
|
149
|
-
<button className='focus-visible:ring-ring/50 absolute -right-1 -bottom-1 inline-flex cursor-pointer items-center justify-center rounded-full focus-visible:ring-[3px] focus-visible:outline-none'>
|
|
150
|
-
<PlusCircleIcon className='text-background size-5 fill-slate-400' />
|
|
151
|
-
<span className='sr-only'>Add</span>
|
|
152
|
-
</button>
|
|
153
|
-
</div>
|
|
154
|
-
)
|
|
155
|
-
|
|
156
|
-
case 'notificationBadge':
|
|
157
|
-
return (
|
|
158
|
-
<div className='relative w-fit'>
|
|
159
|
-
<Avatar className={cn('size-10 rounded-sm', props.className)} {...props}>
|
|
160
|
-
{React.Children.map(children, child => {
|
|
161
|
-
if (React.isValidElement(child) && child.type === AvatarXImage) {
|
|
162
|
-
return React.cloneElement(child as React.ReactElement<any>, {
|
|
163
|
-
className: cn('rounded-sm', child.props.className)
|
|
164
|
-
})
|
|
165
|
-
}
|
|
166
|
-
return child
|
|
167
|
-
})}
|
|
168
|
-
</Avatar>
|
|
169
|
-
<Badge className='absolute -top-2.5 -right-2.5 h-5 min-w-5 bg-indigo-500 px-1 tabular-nums'>
|
|
170
|
-
{badgeCount}
|
|
171
|
-
</Badge>
|
|
172
|
-
</div>
|
|
173
|
-
)
|
|
174
|
-
|
|
175
|
-
case 'verified':
|
|
176
|
-
return (
|
|
177
|
-
<div className='relative w-fit'>
|
|
178
|
-
<Avatar className={cn('size-10', props.className)} {...props}>
|
|
179
|
-
{children}
|
|
180
|
-
</Avatar>
|
|
181
|
-
<span className='absolute -top-1.5 -right-1.5'>
|
|
182
|
-
<span className='sr-only'>Verified</span>
|
|
183
|
-
<BadgeCheckIcon className='text-background size-5 fill-sky-500' />
|
|
184
|
-
</span>
|
|
185
|
-
</div>
|
|
186
|
-
)
|
|
187
|
-
|
|
188
|
-
case 'icon':
|
|
189
|
-
return (
|
|
190
|
-
<Avatar className={props.className} {...props}>
|
|
191
|
-
<AvatarFallback className='bg-indigo-500/10 text-indigo-500'>
|
|
192
|
-
{Icon && <Icon className='size-4' />}
|
|
193
|
-
</AvatarFallback>
|
|
194
|
-
</Avatar>
|
|
195
|
-
)
|
|
196
|
-
|
|
197
|
-
default:
|
|
198
|
-
return (
|
|
199
|
-
<Avatar className={props.className} {...props}>
|
|
200
|
-
{children}
|
|
201
|
-
</Avatar>
|
|
202
|
-
)
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
// 6. Group Component Types
|
|
207
|
-
type AvatarGroupType =
|
|
208
|
-
| 'default'
|
|
209
|
-
| 'max'
|
|
210
|
-
| 'tooltip'
|
|
211
|
-
| 'transition'
|
|
212
|
-
| 'tooltipTransition'
|
|
213
|
-
| 'dropdown'
|
|
214
|
-
| 'outline'
|
|
215
|
-
| 'popularity'
|
|
216
|
-
|
|
217
|
-
const AvatarGroupXContext = React.createContext<AvatarGroupType>('default')
|
|
218
|
-
|
|
219
|
-
export function AvatarGroupX({ avatarGroup = 'default', children, ...props }: any) {
|
|
220
|
-
const avatarGroupType = avatarGroup
|
|
221
|
-
const avatars = props.avatars || []
|
|
222
|
-
const maxVisible = props.maxVisible || 3
|
|
223
|
-
|
|
224
|
-
switch (avatarGroupType) {
|
|
225
|
-
case 'max':
|
|
226
|
-
return (
|
|
227
|
-
<div className='flex -space-x-2'>
|
|
228
|
-
{avatars.map((avatar: any, index: number) => (
|
|
229
|
-
<Avatar key={index} className='ring-background ring-2'>
|
|
230
|
-
<AvatarImage src={avatar.src} alt={avatar.name} />
|
|
231
|
-
<AvatarFallback className='text-xs'>{avatar.fallback}</AvatarFallback>
|
|
232
|
-
</Avatar>
|
|
233
|
-
))}
|
|
234
|
-
<Avatar className='ring-background ring-2'>
|
|
235
|
-
<AvatarFallback className='text-xs'>+{props.remainingCount || 9}</AvatarFallback>
|
|
236
|
-
</Avatar>
|
|
237
|
-
</div>
|
|
238
|
-
)
|
|
239
|
-
|
|
240
|
-
case 'tooltip':
|
|
241
|
-
return (
|
|
242
|
-
<div className='flex -space-x-2'>
|
|
243
|
-
{avatars.map((avatar: any, index: number) => (
|
|
244
|
-
<Tooltip key={index}>
|
|
245
|
-
<TooltipTrigger asChild>
|
|
246
|
-
<Avatar className='ring-background ring-2 transition-all duration-300 ease-in-out hover:z-1 hover:-translate-y-1 hover:shadow-md'>
|
|
247
|
-
<AvatarImage src={avatar.src} alt={avatar.name} />
|
|
248
|
-
<AvatarFallback className='text-xs'>{avatar.fallback}</AvatarFallback>
|
|
249
|
-
</Avatar>
|
|
250
|
-
</TooltipTrigger>
|
|
251
|
-
<TooltipContent>{avatar.name}</TooltipContent>
|
|
252
|
-
</Tooltip>
|
|
253
|
-
))}
|
|
254
|
-
</div>
|
|
255
|
-
)
|
|
256
|
-
|
|
257
|
-
case 'transition':
|
|
258
|
-
return (
|
|
259
|
-
<div className='flex -space-x-2 hover:space-x-1'>
|
|
260
|
-
{avatars.map((avatar: any, index: number) => (
|
|
261
|
-
<Avatar key={index} className='ring-background ring-2 transition-all duration-300 ease-in-out'>
|
|
262
|
-
<AvatarImage src={avatar.src} alt={avatar.name} />
|
|
263
|
-
<AvatarFallback className='text-xs'>{avatar.fallback}</AvatarFallback>
|
|
264
|
-
</Avatar>
|
|
265
|
-
))}
|
|
266
|
-
</div>
|
|
267
|
-
)
|
|
268
|
-
|
|
269
|
-
case 'tooltipTransition':
|
|
270
|
-
return (
|
|
271
|
-
<div className='flex -space-x-2 hover:space-x-1'>
|
|
272
|
-
{avatars.map((avatar: any, index: number) => (
|
|
273
|
-
<Tooltip key={index}>
|
|
274
|
-
<TooltipTrigger asChild>
|
|
275
|
-
<Avatar className='ring-background ring-2 transition-all duration-300 ease-in-out'>
|
|
276
|
-
<AvatarImage src={avatar.src} alt={avatar.name} />
|
|
277
|
-
<AvatarFallback className='text-xs'>{avatar.fallback}</AvatarFallback>
|
|
278
|
-
</Avatar>
|
|
279
|
-
</TooltipTrigger>
|
|
280
|
-
<TooltipContent>{avatar.name}</TooltipContent>
|
|
281
|
-
</Tooltip>
|
|
282
|
-
))}
|
|
283
|
-
</div>
|
|
284
|
-
)
|
|
285
|
-
|
|
286
|
-
case 'dropdown':
|
|
287
|
-
return (
|
|
288
|
-
<div className='flex -space-x-2'>
|
|
289
|
-
{avatars.slice(0, maxVisible).map((avatar: any, index: number) => (
|
|
290
|
-
<Avatar key={index} className='ring-background ring-2'>
|
|
291
|
-
<AvatarImage src={avatar.src} alt={avatar.name} />
|
|
292
|
-
<AvatarFallback className='text-xs'>{avatar.fallback}</AvatarFallback>
|
|
293
|
-
</Avatar>
|
|
294
|
-
))}
|
|
295
|
-
<DropdownMenu>
|
|
296
|
-
<DropdownMenuTrigger asChild>
|
|
297
|
-
<button className='bg-muted has-focus-visible:ring-ring/50 ring-background flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-full ring-2'>
|
|
298
|
-
<PlusIcon className='size-4' />
|
|
299
|
-
<span className='sr-only'>Add</span>
|
|
300
|
-
</button>
|
|
301
|
-
</DropdownMenuTrigger>
|
|
302
|
-
<DropdownMenuContent>
|
|
303
|
-
{avatars.slice(maxVisible).map((avatar: any, index: number) => (
|
|
304
|
-
<DropdownMenuItem key={index}>
|
|
305
|
-
<Avatar>
|
|
306
|
-
<AvatarImage src={avatar.src} alt={avatar.name} />
|
|
307
|
-
<AvatarFallback className='text-xs'>{avatar.fallback}</AvatarFallback>
|
|
308
|
-
</Avatar>
|
|
309
|
-
<span>{avatar.name}</span>
|
|
310
|
-
</DropdownMenuItem>
|
|
311
|
-
))}
|
|
312
|
-
</DropdownMenuContent>
|
|
313
|
-
</DropdownMenu>
|
|
314
|
-
</div>
|
|
315
|
-
)
|
|
316
|
-
|
|
317
|
-
case 'outline':
|
|
318
|
-
return (
|
|
319
|
-
<div className='bg-background flex items-center rounded-full border p-1 shadow-sm'>
|
|
320
|
-
<div className='flex -space-x-2'>
|
|
321
|
-
{avatars.map((avatar: any, index: number) => (
|
|
322
|
-
<Avatar key={index} className='ring-background ring-2'>
|
|
323
|
-
<AvatarImage src={avatar.src} alt={avatar.name} />
|
|
324
|
-
<AvatarFallback className='text-xs'>{avatar.fallback}</AvatarFallback>
|
|
325
|
-
</Avatar>
|
|
326
|
-
))}
|
|
327
|
-
</div>
|
|
328
|
-
<span className='text-muted-foreground hover:text-foreground flex items-center justify-center rounded-full bg-transparent px-2 text-xs shadow-none hover:bg-transparent'>
|
|
329
|
-
+{props.remainingCount || 3}
|
|
330
|
-
</span>
|
|
331
|
-
</div>
|
|
332
|
-
)
|
|
333
|
-
|
|
334
|
-
case 'popularity':
|
|
335
|
-
return (
|
|
336
|
-
<div className='bg-background flex flex-wrap items-center justify-center rounded-full border p-1 shadow-sm'>
|
|
337
|
-
<div className='flex -space-x-1'>
|
|
338
|
-
{avatars.map((avatar: any, index: number) => (
|
|
339
|
-
<Avatar key={index} className='ring-background size-6 ring-2'>
|
|
340
|
-
<AvatarImage src={avatar.src} alt={avatar.name} />
|
|
341
|
-
<AvatarFallback className='text-xs'>{avatar.fallback}</AvatarFallback>
|
|
342
|
-
</Avatar>
|
|
343
|
-
))}
|
|
344
|
-
</div>
|
|
345
|
-
<p className='text-muted-foreground px-2 text-xs'>
|
|
346
|
-
Loved by <strong className='text-foreground font-medium'>{props.lovedByCount || '10K+'}</strong> developers.
|
|
347
|
-
</p>
|
|
348
|
-
</div>
|
|
349
|
-
)
|
|
350
|
-
|
|
351
|
-
default:
|
|
352
|
-
return (
|
|
353
|
-
<div className='flex -space-x-2'>
|
|
354
|
-
{avatars.map((avatar: any, index: number) => (
|
|
355
|
-
<Avatar key={index} className='ring-background ring-2'>
|
|
356
|
-
<AvatarImage src={avatar.src} alt={avatar.name} />
|
|
357
|
-
<AvatarFallback className='text-xs'>{avatar.fallback}</AvatarFallback>
|
|
358
|
-
</Avatar>
|
|
359
|
-
))}
|
|
360
|
-
</div>
|
|
361
|
-
)
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
// 7. Demo Component
|
|
366
|
-
export function AvatarXDemo() {
|
|
367
|
-
const avatars = [
|
|
368
|
-
{ src: 'https://cdn.shadcnstudio.com/ss-assets/avatar/avatar-1.png', name: 'Alice Johnson', fallback: 'AJ' },
|
|
369
|
-
{ src: 'https://cdn.shadcnstudio.com/ss-assets/avatar/avatar-2.png', name: 'Bob Smith', fallback: 'BS' },
|
|
370
|
-
{ src: 'https://cdn.shadcnstudio.com/ss-assets/avatar/avatar-3.png', name: 'Charlie Brown', fallback: 'CB' },
|
|
371
|
-
{ src: 'https://cdn.shadcnstudio.com/ss-assets/avatar/avatar-4.png', name: 'Diana Prince', fallback: 'DP' },
|
|
372
|
-
{ src: 'https://cdn.shadcnstudio.com/ss-assets/avatar/avatar-5.png', name: 'Hallie Richards', fallback: 'HR' },
|
|
373
|
-
]
|
|
374
|
-
|
|
375
|
-
return (
|
|
376
|
-
<div className="space-y-12 p-6 max-w-4xl mx-auto">
|
|
377
|
-
{/* Single Avatar Variants */}
|
|
378
|
-
<div>
|
|
379
|
-
<h3 className="text-lg font-semibold mb-4">Default Avatar</h3>
|
|
380
|
-
<AvatarXWrapper>
|
|
381
|
-
<AvatarXImage src='https://cdn.shadcnstudio.com/ss-assets/avatar/avatar-5.png' alt='Hallie Richards' />
|
|
382
|
-
<AvatarXFallback className='text-xs'>HR</AvatarXFallback>
|
|
383
|
-
</AvatarXWrapper>
|
|
384
|
-
</div>
|
|
385
|
-
|
|
386
|
-
<div>
|
|
387
|
-
<h3 className="text-lg font-semibold mb-4">Ring Avatar</h3>
|
|
388
|
-
<AvatarX avatar="ring">
|
|
389
|
-
<AvatarXWrapper>
|
|
390
|
-
<AvatarXImage src='https://cdn.shadcnstudio.com/ss-assets/avatar/avatar-5.png' alt='Hallie Richards' />
|
|
391
|
-
<AvatarXFallback className='text-xs'>HR</AvatarXFallback>
|
|
392
|
-
</AvatarXWrapper>
|
|
393
|
-
</AvatarX>
|
|
394
|
-
</div>
|
|
395
|
-
|
|
396
|
-
<div>
|
|
397
|
-
<h3 className="text-lg font-semibold mb-4">Rounded Avatar</h3>
|
|
398
|
-
<AvatarX avatar="rounded">
|
|
399
|
-
<AvatarXWrapper>
|
|
400
|
-
<AvatarXImage src='https://cdn.shadcnstudio.com/ss-assets/avatar/avatar-5.png' alt='Hallie Richards' />
|
|
401
|
-
<AvatarXFallback className='text-xs'>HR</AvatarXFallback>
|
|
402
|
-
</AvatarXWrapper>
|
|
403
|
-
</AvatarX>
|
|
404
|
-
</div>
|
|
405
|
-
|
|
406
|
-
<div>
|
|
407
|
-
<h3 className="text-lg font-semibold mb-4">Status Busy Avatar</h3>
|
|
408
|
-
<AvatarX avatar="statusBusy">
|
|
409
|
-
<AvatarXWrapper>
|
|
410
|
-
<AvatarXImage src='https://cdn.shadcnstudio.com/ss-assets/avatar/avatar-5.png' alt='Hallie Richards' />
|
|
411
|
-
<AvatarXFallback className='text-xs'>HR</AvatarXFallback>
|
|
412
|
-
</AvatarXWrapper>
|
|
413
|
-
</AvatarX>
|
|
414
|
-
</div>
|
|
415
|
-
|
|
416
|
-
<div>
|
|
417
|
-
<h3 className="text-lg font-semibold mb-4">Status Ring Avatar</h3>
|
|
418
|
-
<AvatarX avatar="statusRing">
|
|
419
|
-
<AvatarXWrapper statusIcon={CheckIcon}>
|
|
420
|
-
<AvatarXImage src='https://cdn.shadcnstudio.com/ss-assets/avatar/avatar-5.png' alt='Hallie Richards' />
|
|
421
|
-
<AvatarXFallback className='text-xs'>HR</AvatarXFallback>
|
|
422
|
-
</AvatarXWrapper>
|
|
423
|
-
</AvatarX>
|
|
424
|
-
</div>
|
|
425
|
-
|
|
426
|
-
<div>
|
|
427
|
-
<h3 className="text-lg font-semibold mb-4">Status Away Avatar</h3>
|
|
428
|
-
<AvatarX avatar="statusAway">
|
|
429
|
-
<AvatarXWrapper>
|
|
430
|
-
<AvatarXImage src='https://cdn.shadcnstudio.com/ss-assets/avatar/avatar-5.png' alt='Hallie Richards' />
|
|
431
|
-
<AvatarXFallback className='text-xs'>HR</AvatarXFallback>
|
|
432
|
-
</AvatarXWrapper>
|
|
433
|
-
</AvatarX>
|
|
434
|
-
</div>
|
|
435
|
-
|
|
436
|
-
<div>
|
|
437
|
-
<h3 className="text-lg font-semibold mb-4">Plus Avatar</h3>
|
|
438
|
-
<AvatarX avatar="plus">
|
|
439
|
-
<AvatarXWrapper>
|
|
440
|
-
<AvatarXImage src='https://cdn.shadcnstudio.com/ss-assets/avatar/avatar-5.png' alt='Hallie Richards' />
|
|
441
|
-
<AvatarXFallback className='text-xs'>HR</AvatarXFallback>
|
|
442
|
-
</AvatarXWrapper>
|
|
443
|
-
</AvatarX>
|
|
444
|
-
</div>
|
|
445
|
-
|
|
446
|
-
<div>
|
|
447
|
-
<h3 className="text-lg font-semibold mb-4">Notification Badge Avatar</h3>
|
|
448
|
-
<AvatarX avatar="notificationBadge">
|
|
449
|
-
<AvatarXWrapper badgeCount={8}>
|
|
450
|
-
<AvatarXImage src='https://cdn.shadcnstudio.com/ss-assets/avatar/avatar-5.png' alt='Hallie Richards' />
|
|
451
|
-
<AvatarXFallback className='text-xs'>HR</AvatarXFallback>
|
|
452
|
-
</AvatarXWrapper>
|
|
453
|
-
</AvatarX>
|
|
454
|
-
</div>
|
|
455
|
-
|
|
456
|
-
<div>
|
|
457
|
-
<h3 className="text-lg font-semibold mb-4">Verified Avatar</h3>
|
|
458
|
-
<AvatarX avatar="verified">
|
|
459
|
-
<AvatarXWrapper>
|
|
460
|
-
<AvatarXImage src='https://cdn.shadcnstudio.com/ss-assets/avatar/avatar-5.png' alt='Hallie Richards' />
|
|
461
|
-
<AvatarXFallback className='text-xs'>HR</AvatarXFallback>
|
|
462
|
-
</AvatarXWrapper>
|
|
463
|
-
</AvatarX>
|
|
464
|
-
</div>
|
|
465
|
-
|
|
466
|
-
<div>
|
|
467
|
-
<h3 className="text-lg font-semibold mb-4">Icon Avatar</h3>
|
|
468
|
-
<AvatarX avatar="icon">
|
|
469
|
-
<AvatarXWrapper icon={HomeIcon} />
|
|
470
|
-
</AvatarX>
|
|
471
|
-
</div>
|
|
472
|
-
|
|
473
|
-
{/* Avatar Group Variants */}
|
|
474
|
-
<div>
|
|
475
|
-
<h3 className="text-lg font-semibold mb-4">Default Avatar Group</h3>
|
|
476
|
-
<AvatarGroupX avatars={avatars} />
|
|
477
|
-
</div>
|
|
478
|
-
|
|
479
|
-
<div>
|
|
480
|
-
<h3 className="text-lg font-semibold mb-4">Avatar Group with Max Count</h3>
|
|
481
|
-
<AvatarGroupX avatarGroup="max" avatars={avatars} remainingCount={9} />
|
|
482
|
-
</div>
|
|
483
|
-
|
|
484
|
-
<div>
|
|
485
|
-
<h3 className="text-lg font-semibold mb-4">Avatar Group with Tooltips</h3>
|
|
486
|
-
<AvatarGroupX avatarGroup="tooltip" avatars={avatars} />
|
|
487
|
-
</div>
|
|
488
|
-
|
|
489
|
-
<div>
|
|
490
|
-
<h3 className="text-lg font-semibold mb-4">Avatar Group with Transition</h3>
|
|
491
|
-
<AvatarGroupX avatarGroup="transition" avatars={avatars} />
|
|
492
|
-
</div>
|
|
493
|
-
|
|
494
|
-
<div>
|
|
495
|
-
<h3 className="text-lg font-semibold mb-4">Avatar Group with Tooltip & Transition</h3>
|
|
496
|
-
<AvatarGroupX avatarGroup="tooltipTransition" avatars={avatars} />
|
|
497
|
-
</div>
|
|
498
|
-
|
|
499
|
-
<div>
|
|
500
|
-
<h3 className="text-lg font-semibold mb-4">Avatar Group with Dropdown</h3>
|
|
501
|
-
<AvatarGroupX avatarGroup="dropdown" avatars={avatars} maxVisible={3} />
|
|
502
|
-
</div>
|
|
503
|
-
|
|
504
|
-
<div>
|
|
505
|
-
<h3 className="text-lg font-semibold mb-4">Avatar Group with Outline</h3>
|
|
506
|
-
<AvatarGroupX avatarGroup="outline" avatars={avatars} remainingCount={3} />
|
|
507
|
-
</div>
|
|
508
|
-
|
|
509
|
-
<div>
|
|
510
|
-
<h3 className="text-lg font-semibold mb-4">Avatar Group with Popularity Indicator</h3>
|
|
511
|
-
<AvatarGroupX avatarGroup="popularity" avatars={avatars} lovedByCount="10K+" />
|
|
512
|
-
</div>
|
|
513
|
-
</div>
|
|
514
|
-
)
|
|
515
|
-
}
|