feat(ui): add @snowluma/ui shared UI library
Lifts the shadcn primitives + Tailwind 4 theme tokens from webui into a dedicated workspace package consumable by both webui and SnowLumaDesktop. - 14 primitives (Button, Dialog, AlertDialog, Input, Label, Checkbox, Select, Switch, Tabs, Card, Avatar, Badge, Progress, ScrollArea, Separator, Sheet, Skeleton, Tooltip) + sonner Toaster wrapper - Tailwind 4 theme tokens exported via styles/theme.css - tsup ESM build with declaration files - publishConfig.access=public mirroring @snowluma/sdk Consumers @import '@snowluma/ui/styles/theme.css' for tokens and add an @source directive to scan the package for utility classes.
This commit is contained in:
26 files changed
+1988
-7
No files matched your search
@@ -0,0 +1,44 @@
|
||||
import * as React from 'react';
|
||||
import { cn } from '../lib/cn';
|
||||
|
||||
interface AvatarProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
size?: number;
|
||||
}
|
||||
|
||||
const Avatar = React.forwardRef<HTMLDivElement, AvatarProps>(
|
||||
({ className, size = 36, style, ...props }, ref) => (
|
||||
<div
|
||||
ref={ref}
|
||||
className={cn('relative inline-flex shrink-0 overflow-hidden rounded-full bg-muted', className)}
|
||||
style={{ width: size, height: size, ...style }}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
Avatar.displayName = 'Avatar';
|
||||
|
||||
const AvatarImage = React.forwardRef<HTMLImageElement, React.ImgHTMLAttributes<HTMLImageElement>>(
|
||||
({ className, alt = '', ...props }, ref) => (
|
||||
<img
|
||||
ref={ref}
|
||||
alt={alt}
|
||||
className={cn('aspect-square size-full object-cover', className)}
|
||||
referrerPolicy="no-referrer"
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
AvatarImage.displayName = 'AvatarImage';
|
||||
|
||||
const AvatarFallback = React.forwardRef<HTMLSpanElement, React.HTMLAttributes<HTMLSpanElement>>(
|
||||
({ className, ...props }, ref) => (
|
||||
<span
|
||||
ref={ref}
|
||||
className={cn('flex size-full items-center justify-center bg-muted text-xs font-medium text-muted-foreground', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
AvatarFallback.displayName = 'AvatarFallback';
|
||||
|
||||
export { Avatar, AvatarImage, AvatarFallback };
|
||||
Reference in new issue
Block a user