-
Notifications
You must be signed in to change notification settings - Fork 201
Extract UI components into shared @repo/shadcn package and add Base UI wrappers
#111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,59 +1,2 @@ | ||
| import * as React from 'react'; | ||
| import { Slot } from '@radix-ui/react-slot'; | ||
| import { cva, type VariantProps } from 'class-variance-authority'; | ||
|
|
||
| import { cn } from '@/lib/utils'; | ||
|
|
||
| const buttonVariants = cva( | ||
| 'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', | ||
| { | ||
| variants: { | ||
| variant: { | ||
| default: 'bg-primary text-primary-foreground hover:bg-primary/90', | ||
| destructive: | ||
| 'bg-destructive text-destructive-foreground hover:bg-destructive/90', | ||
| outline: | ||
| 'border border-input dark:bg-neutral-800 bg-neutral-50 hover:bg-accent hover:text-accent-foreground', | ||
| secondary: | ||
| 'bg-secondary text-secondary-foreground hover:bg-secondary/80', | ||
| ghost: 'hover:bg-accent hover:text-accent-foreground', | ||
| link: 'text-primary underline-offset-4 hover:underline', | ||
| uilayouts: | ||
| 'dark:bg-zinc-900 bg-neutral-200 dark:text-white text-black border dark:border-neutral-800', | ||
| }, | ||
| size: { | ||
| default: 'h-10 px-4 py-2', | ||
| sm: 'h-9 rounded-md px-3', | ||
| lg: 'h-11 rounded-md px-8', | ||
| icon: 'h-10 w-10', | ||
| }, | ||
| }, | ||
| defaultVariants: { | ||
| variant: 'default', | ||
| size: 'default', | ||
| }, | ||
| } | ||
| ); | ||
|
|
||
| export interface ButtonProps | ||
| extends | ||
| React.ButtonHTMLAttributes<HTMLButtonElement>, | ||
| VariantProps<typeof buttonVariants> { | ||
| asChild?: boolean; | ||
| } | ||
|
|
||
| const Button = React.forwardRef<HTMLButtonElement, ButtonProps>( | ||
| ({ className, variant, size, asChild = false, ...props }, ref) => { | ||
| const Comp = asChild ? Slot : 'button'; | ||
| return ( | ||
| <Comp | ||
| className={cn(buttonVariants({ variant, size, className }))} | ||
| ref={ref} | ||
| {...props} | ||
| /> | ||
| ); | ||
| } | ||
| ); | ||
| Button.displayName = 'Button'; | ||
|
|
||
| export { Button, buttonVariants }; | ||
| export { Button, buttonVariants } from '@repo/shadcn' | ||
| export type { ButtonProps } from '@repo/shadcn' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,7 +77,11 @@ | |
| "unist-util-visit": "^5.1.0", | ||
| "vaul": "^1.0.0", | ||
| "zod": "^3.23.8", | ||
| "zustand": "5.0.0-rc.2" | ||
| "zustand": "5.0.0-rc.2", | ||
| "@base-ui-components/react": "^1.0.0-beta.3", | ||
| "@radix-ui/react-accordion": "^1.2.4", | ||
| "@radix-ui/react-collapsible": "^1.1.4", | ||
| "@radix-ui/react-separator": "^1.1.4" | ||
|
Comment on lines
+81
to
+84
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
These newly added packages are not represented anywhere in the committed Useful? React with 👍 / 👎. |
||
| }, | ||
| "devDependencies": { | ||
| "@tailwindcss/postcss": "^4.1.14", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| 'use client' | ||
|
|
||
| import * as React from 'react' | ||
| import { Accordion as BaseAccordion } from '@base-ui-components/react/accordion' | ||
| import { ChevronDown } from 'lucide-react' | ||
|
|
||
| const cx = (...classes: Array<string | undefined>) => classes.filter(Boolean).join(' ') | ||
|
|
||
| function Root({ className, ...props }: React.ComponentProps<typeof BaseAccordion.Root> & { className?: string }) { | ||
| return <BaseAccordion.Root className={cx('w-full', className)} {...props} /> | ||
| } | ||
|
|
||
| function Item({ className, ...props }: React.ComponentProps<typeof BaseAccordion.Item> & { className?: string }) { | ||
| return <BaseAccordion.Item className={cx('border-b', className)} {...props} /> | ||
| } | ||
|
|
||
| function Trigger({ className, children, ...props }: React.ComponentProps<typeof BaseAccordion.Trigger> & { className?: string }) { | ||
| return ( | ||
| <BaseAccordion.Header> | ||
| <BaseAccordion.Trigger | ||
| className={cx('flex w-full items-center justify-between py-4 text-left text-sm font-medium transition-all hover:underline', className)} | ||
| {...props} | ||
| > | ||
| {children} | ||
| <ChevronDown className="h-4 w-4 shrink-0 transition-transform data-[panel-open]:rotate-180" /> | ||
| </BaseAccordion.Trigger> | ||
| </BaseAccordion.Header> | ||
| ) | ||
| } | ||
|
|
||
| function Content({ className, children, ...props }: React.ComponentProps<typeof BaseAccordion.Panel> & { className?: string }) { | ||
| return ( | ||
| <BaseAccordion.Panel className={cx('overflow-hidden text-sm', className)} {...props}> | ||
| <div className="pb-4 pt-0">{children}</div> | ||
| </BaseAccordion.Panel> | ||
| ) | ||
| } | ||
|
|
||
| export const BaseUiAccordion = { Root, Item, Trigger, Content } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from '../ui/alert-dialog' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from '../ui/alert' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `aspect-ratio`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/aspect-ratio' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `badge`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/badge' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `button`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/button' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `calendar`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/calendar' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `card`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/card' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `charts`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/charts' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from '../ui/checkbox' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from '../ui/collapsible' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from '../ui/combobox' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `command`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/command' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from '../ui/context-menu' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from '../ui/date-picker' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `dialog`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/dialog' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `drawer`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/drawer' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `dropdown`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/dropdown' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `form`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/form' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `hover-card`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/hover-card' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| export * from './accordion' | ||
| export * from './aspect-ratio' | ||
| export * from './badge' | ||
| export * from './button' | ||
| export * from './calendar' | ||
| export * from './card' | ||
| export * from './charts' | ||
| export * from './command' | ||
| export * from './dialog' | ||
| export * from './drawer' | ||
| export * from './dropdown' | ||
| export * from './form' | ||
| export * from './hover-card' | ||
| export * from './input' | ||
| export * from './label' | ||
| export * from './navigation-menu' | ||
| export * from './plastic-button' | ||
| export * from './popover' | ||
| export * from './scroll-area' | ||
| export * from './slider' | ||
| export * from './switch' | ||
| export * from './tabs' | ||
| export * from './toast' | ||
| export * from './tooltip' | ||
| export * from './alert' | ||
| export * from './alert-dialog' | ||
| export * from './checkbox' | ||
| export * from './collapsible' | ||
| export * from './context-menu' | ||
| export * from './date-picker' | ||
| export * from './menubar' | ||
| export * from './progress' | ||
| export * from './radio-group' | ||
| export * from './select' | ||
| export * from './separator' | ||
| export * from './sheet' | ||
| export * from './skeleton' | ||
| export * from './sonner' | ||
| export * from './textarea' | ||
| export * from './toggle' | ||
| export * from './toggle-group' | ||
| export * from './combobox' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `input`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/input' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `label`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/label' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from '../ui/menubar' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `navigation-menu`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/navigation-menu' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `plastic-button`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/plastic-button' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `popover`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/popover' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from '../ui/progress' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from '../ui/radio-group' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `scroll-area`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/scroll-area' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from '../ui/select' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from '../ui/separator' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from '../ui/sheet' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from '../ui/skeleton' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `slider`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/slider' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from '../ui/sonner' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `switch`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/switch' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `tabs`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/tabs' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from '../ui/textarea' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `toast`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/toast' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from '../ui/toggle-group' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from '../ui/toggle' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Base UI variant placeholder for `tooltip`. | ||
| // This currently re-exports the Radix/shadcn implementation to keep API parity. | ||
| export * from '../ui/tooltip' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,4 @@ | ||
| export * from './ui' | ||
|
|
||
| export * from './base-ui/accordion' | ||
| export * from './base-ui' | ||
|
Comment on lines
+3
to
+4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check if base-ui/index.tsx re-exports accordion (would cause duplicate)
echo "=== Checking base-ui/index.tsx for accordion re-export ==="
cat packages/shadcn/src/base-ui/index.tsx 2>/dev/null || echo "File not found"
echo ""
echo "=== Checking base-ui modules for pass-through re-exports from ui ==="
# Look at a sample base-ui module to see if it re-exports with same names
rg -n "export.*from.*['\"]\.\.\/ui" packages/shadcn/src/base-ui/ --type tsx --type ts 2>/dev/null || \
rg -n "export.*from.*['\"]\.\.\/ui" packages/shadcn/src/base-ui/
echo ""
echo "=== Checking ui barrel for exported symbols ==="
cat packages/shadcn/src/ui/index.tsx 2>/dev/null | head -30Repository: ui-layouts/uilayouts Length of output: 1298 🏁 Script executed: #!/bin/bash
echo "=== Checking what ui/button exports ==="
cat packages/shadcn/src/ui/button/index.tsx 2>/dev/null || echo "Not found"
echo ""
echo "=== Checking what base-ui/button exports ==="
cat packages/shadcn/src/base-ui/button/index.tsx 2>/dev/null || echo "Not found"
echo ""
echo "=== Checking what ui/badge exports ==="
cat packages/shadcn/src/ui/badge/index.tsx 2>/dev/null || echo "Not found"
echo ""
echo "=== Checking what base-ui/badge exports ==="
cat packages/shadcn/src/base-ui/badge/index.tsx 2>/dev/null || echo "Not found"Repository: ui-layouts/uilayouts Length of output: 275 🏁 Script executed: #!/bin/bash
echo "=== Directory structure of packages/shadcn/src/ ==="
ls -la packages/shadcn/src/
echo ""
echo "=== Content of ui directory ==="
ls packages/shadcn/src/ui/ 2>/dev/null || echo "ui not found"
echo ""
echo "=== Content of base-ui directory ==="
ls packages/shadcn/src/base-ui/ 2>/dev/null | head -20 || echo "base-ui not found"
echo ""
echo "=== Files in ui directory (recursive, limiting to depth 2) ==="
find packages/shadcn/src/ui -maxdepth 2 -type f -name "*.tsx" -o -name "*.ts" 2>/dev/null | head -20Repository: ui-layouts/uilayouts Length of output: 1797 🏁 Script executed: #!/bin/bash
echo "=== ui/button.tsx ==="
cat packages/shadcn/src/ui/button.tsx
echo ""
echo "=== base-ui/button.tsx ==="
cat packages/shadcn/src/base-ui/button.tsxRepository: ui-layouts/uilayouts Length of output: 2175 🏁 Script executed: #!/bin/bash
echo "=== ui/accordion.tsx ==="
cat packages/shadcn/src/ui/accordion.tsx
echo ""
echo "=== base-ui/accordion.tsx ==="
cat packages/shadcn/src/base-ui/accordion.tsxRepository: ui-layouts/uilayouts Length of output: 3671 Remove the redundant accordion export and the conflicting base-ui barrel. Lines 3–4 cause export collisions:
Remove line 3 and either remove line 4 or line 1, depending on the intended export strategy. 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| 'use client' | ||
|
|
||
| import * as React from 'react' | ||
| import * as AccordionPrimitive from '@radix-ui/react-accordion' | ||
| import { ChevronDown } from 'lucide-react' | ||
|
|
||
| import { cn } from '@/lib/utils' | ||
|
|
||
| const Accordion = AccordionPrimitive.Root | ||
|
|
||
| const AccordionItem = React.forwardRef< | ||
| React.ElementRef<typeof AccordionPrimitive.Item>, | ||
| React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item> | ||
| >(({ className, ...props }, ref) => ( | ||
| <AccordionPrimitive.Item ref={ref} className={cn('border-b', className)} {...props} /> | ||
| )) | ||
| AccordionItem.displayName = 'AccordionItem' | ||
|
|
||
| const AccordionTrigger = React.forwardRef< | ||
| React.ElementRef<typeof AccordionPrimitive.Trigger>, | ||
| React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger> | ||
| >(({ className, children, ...props }, ref) => ( | ||
| <AccordionPrimitive.Header className='flex'> | ||
| <AccordionPrimitive.Trigger | ||
| ref={ref} | ||
| className={cn( | ||
| 'flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180', | ||
| className | ||
| )} | ||
| {...props} | ||
| > | ||
| {children} | ||
| <ChevronDown className='h-4 w-4 shrink-0 transition-transform duration-200' /> | ||
| </AccordionPrimitive.Trigger> | ||
| </AccordionPrimitive.Header> | ||
| )) | ||
| AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName | ||
|
|
||
| const AccordionContent = React.forwardRef< | ||
| React.ElementRef<typeof AccordionPrimitive.Content>, | ||
| React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content> | ||
| >(({ className, children, ...props }, ref) => ( | ||
| <AccordionPrimitive.Content | ||
| ref={ref} | ||
| className='overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down' | ||
| {...props} | ||
| > | ||
| <div className={cn('pb-4 pt-0', className)}>{children}</div> | ||
| </AccordionPrimitive.Content> | ||
|
Comment on lines
+43
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win Apply Current placement changes consumer-facing styling semantics and blocks overrides on the content root. Proposed fix <AccordionPrimitive.Content
ref={ref}
- className='overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down'
+ className={cn(
+ 'overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down',
+ className
+ )}
{...props}
>
- <div className={cn('pb-4 pt-0', className)}>{children}</div>
+ <div className='pb-4 pt-0'>{children}</div>
</AccordionPrimitive.Content>🤖 Prompt for AI Agents |
||
| )) | ||
| AccordionContent.displayName = AccordionPrimitive.Content.displayName | ||
|
|
||
| export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { Dialog, DialogTrigger, DialogContent, DialogTitle, DialogDescription, DialogClose } from './dialog' | ||
|
|
||
| const AlertDialog = Dialog | ||
| const AlertDialogTrigger = DialogTrigger | ||
| const AlertDialogContent = DialogContent | ||
| const AlertDialogTitle = DialogTitle | ||
| const AlertDialogDescription = DialogDescription | ||
| const AlertDialogCancel = DialogClose | ||
| const AlertDialogAction = DialogClose | ||
|
|
||
| export { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogTitle, AlertDialogDescription, AlertDialogCancel, AlertDialogAction } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { cva, type VariantProps } from 'class-variance-authority' | ||
| import * as React from 'react' | ||
| import { cn } from '@/lib/utils' | ||
|
|
||
| const alertVariants = cva('relative w-full rounded-lg border p-4', { variants: { variant: { default: 'bg-background text-foreground', destructive: 'border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive' } }, defaultVariants: { variant: 'default' } }) | ||
| export const Alert = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>>(({ className, variant, ...props }, ref) => <div ref={ref} role='alert' className={cn(alertVariants({ variant }), className)} {...props} />) | ||
| Alert.displayName = 'Alert' | ||
| export const AlertTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(({ className, ...props }, ref) => <h5 ref={ref} className={cn('mb-1 font-medium leading-none tracking-tight', className)} {...props} />) | ||
| AlertTitle.displayName='AlertTitle' | ||
| export const AlertDescription = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => <div ref={ref} className={cn('text-sm [&_p]:leading-relaxed', className)} {...props} />) | ||
| AlertDescription.displayName='AlertDescription' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| 'use client' | ||
| import * as React from 'react' | ||
| import * as CheckboxPrimitive from '@radix-ui/react-checkbox' | ||
| import { Check } from 'lucide-react' | ||
| import { cn } from '@/lib/utils' | ||
| export const Checkbox = React.forwardRef<React.ElementRef<typeof CheckboxPrimitive.Root>, React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>>(({ className, ...props }, ref)=><CheckboxPrimitive.Root ref={ref} className={cn('peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground', className)} {...props}><CheckboxPrimitive.Indicator className={cn('flex items-center justify-center text-current')}><Check className='h-4 w-4'/></CheckboxPrimitive.Indicator></CheckboxPrimitive.Root>) | ||
| Checkbox.displayName=CheckboxPrimitive.Root.displayName |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| 'use client' | ||
| export * from '@radix-ui/react-collapsible' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uilayoutsbutton variantRe-exporting the shared package button drops the app-specific
uilayoutsvariant that this file used to define. The website still renders<Button variant='uilayouts'>inapps/ui-layout/components/website/copy-page.tsxlines 82 and 136, and the sharedpackages/shadcn/src/ui/button.tsxvariant map has nouilayoutsentry, so those copy-page controls lose their intended dark/light border styling at runtime rather than behaving like the previous local button.Useful? React with 👍 / 👎.