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:
DrSmoothl committed 2026-05-17 00:23:37 +08:00
1 parent 2d21316a74
commit a8661ea216
26 files changed
+1988 -7

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
import * as React from 'react';
import * as SwitchPrimitive from '@radix-ui/react-switch';
import { cn } from '../lib/cn';
const Switch = React.forwardRef<
React.ElementRef<typeof SwitchPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>
>(({ className, ...props }, ref) => (
<SwitchPrimitive.Root
ref={ref}
className={cn(
'peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors',
'focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/40',
'disabled:cursor-not-allowed disabled:opacity-50',
'data-[state=checked]:bg-primary data-[state=unchecked]:bg-muted',
className
)}
{...props}
>
<SwitchPrimitive.Thumb
className={cn(
'pointer-events-none block size-4 rounded-full bg-background shadow-sm ring-0 transition-transform',
'data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0'
)}
/>
</SwitchPrimitive.Root>
));
Switch.displayName = 'Switch';
export { Switch };