From f9aac036ff83561ba49e0dab85d8749ee96ece71 Mon Sep 17 00:00:00 2001 From: Ivan Vasilov Date: Mon, 14 Jul 2025 16:20:02 +0200 Subject: [PATCH] Reimport all shadcn components (no change to the blocks). --- .../registry/default/components/ui/alert.tsx | 15 +- .../registry/default/components/ui/badge.tsx | 8 +- .../registry/default/components/ui/chart.tsx | 29 ++- .../default/components/ui/command.tsx | 226 ++++++++---------- .../registry/default/components/ui/dialog.tsx | 171 ++++++------- .../registry/default/components/ui/drawer.tsx | 178 ++++++-------- .../registry/default/components/ui/form.tsx | 26 +- .../default/components/ui/hover-card.tsx | 6 +- .../registry/default/components/ui/label.tsx | 2 +- .../default/components/ui/popover.tsx | 55 ++--- .../registry/default/components/ui/select.tsx | 27 +-- .../registry/default/components/ui/switch.tsx | 63 ++--- .../registry/default/components/ui/table.tsx | 11 +- .../default/components/ui/toggle-group.tsx | 2 +- .../registry/default/components/ui/toggle.tsx | 13 +- 15 files changed, 368 insertions(+), 464 deletions(-) diff --git a/apps/ui-library/registry/default/components/ui/alert.tsx b/apps/ui-library/registry/default/components/ui/alert.tsx index e9c7035408d..eaabdfc97a1 100644 --- a/apps/ui-library/registry/default/components/ui/alert.tsx +++ b/apps/ui-library/registry/default/components/ui/alert.tsx @@ -1,15 +1,16 @@ -import * as React from 'react' 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-8 text-center [&>svg]:mx-auto [&>svg]:mb-4 [&>svg]:text-foreground', + 'relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7', { variants: { variant: { default: 'bg-background text-foreground', - destructive: 'bg-background text-foreground [&>svg]:text-destructive', + destructive: + 'border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive', }, }, defaultVariants: { @@ -41,12 +42,8 @@ const AlertDescription = React.forwardRef< HTMLParagraphElement, React.HTMLAttributes >(({ className, ...props }, ref) => ( -
+
)) AlertDescription.displayName = 'AlertDescription' -export { Alert, AlertTitle, AlertDescription } +export { Alert, AlertDescription, AlertTitle } diff --git a/apps/ui-library/registry/default/components/ui/badge.tsx b/apps/ui-library/registry/default/components/ui/badge.tsx index fa899d9a365..180566596c7 100644 --- a/apps/ui-library/registry/default/components/ui/badge.tsx +++ b/apps/ui-library/registry/default/components/ui/badge.tsx @@ -1,18 +1,18 @@ -import * as React from 'react' import { cva, type VariantProps } from 'class-variance-authority' +import * as React from 'react' import { cn } from '@/lib/utils' const badgeVariants = cva( - 'inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2', + 'inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2', { variants: { variant: { - default: 'border-transparent bg-primary text-primary-foreground hover:bg-primary/80', + default: 'border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80', secondary: 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80', destructive: - 'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80', + 'border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80', outline: 'text-foreground', }, }, diff --git a/apps/ui-library/registry/default/components/ui/chart.tsx b/apps/ui-library/registry/default/components/ui/chart.tsx index 37ee71b4552..257c97ed2f2 100644 --- a/apps/ui-library/registry/default/components/ui/chart.tsx +++ b/apps/ui-library/registry/default/components/ui/chart.tsx @@ -50,7 +50,7 @@ const ChartContainer = React.forwardRef< data-chart={chartId} ref={ref} className={cn( - "flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-hidden [&_.recharts-surface]:outline-hidden", + "flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none", className )} {...props} @@ -64,7 +64,7 @@ const ChartContainer = React.forwardRef< ChartContainer.displayName = 'Chart' const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => { - const colorConfig = Object.entries(config).filter(([_, config]) => config.theme || config.color) + const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color) if (!colorConfig.length) { return null @@ -131,7 +131,7 @@ const ChartTooltipContent = React.forwardRef< } const [item] = payload - const key = `${labelKey || item.dataKey || item.name || 'value'}` + const key = `${labelKey || item?.dataKey || item?.name || 'value'}` const itemConfig = getPayloadConfigFromPayload(config, item, key) const value = !labelKey && typeof label === 'string' @@ -161,7 +161,7 @@ const ChartTooltipContent = React.forwardRef<
@@ -189,13 +189,16 @@ const ChartTooltipContent = React.forwardRef< ) : ( !hideIndicator && (
) { - return ( - - ) -} +const Command = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +Command.displayName = CommandPrimitive.displayName -function CommandDialog({ - title = 'Command Palette', - description = 'Search for a command to run...', - children, - className, - showCloseButton = true, - ...props -}: React.ComponentProps & { - title?: string - description?: string - className?: string - showCloseButton?: boolean -}) { +const CommandDialog = ({ children, ...props }: DialogProps) => { return ( - - {title} - {description} - - - + + {children} @@ -57,105 +35,109 @@ function CommandDialog({ ) } -function CommandInput({ - className, - ...props -}: React.ComponentProps) { - return ( -
- - -
- ) -} - -function CommandList({ className, ...props }: React.ComponentProps) { - return ( - - ) -} - -function CommandEmpty({ ...props }: React.ComponentProps) { - return ( - - ) -} - -function CommandGroup({ - className, - ...props -}: React.ComponentProps) { - return ( - , + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( +
+ + - ) -} +
+)) -function CommandSeparator({ - className, - ...props -}: React.ComponentProps) { - return ( - - ) -} +CommandInput.displayName = CommandPrimitive.Input.displayName -function CommandItem({ className, ...props }: React.ComponentProps) { - return ( - - ) -} +const CommandList = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) -function CommandShortcut({ className, ...props }: React.ComponentProps<'span'>) { +CommandList.displayName = CommandPrimitive.List.displayName + +const CommandEmpty = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>((props, ref) => ( + +)) + +CommandEmpty.displayName = CommandPrimitive.Empty.displayName + +const CommandGroup = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) + +CommandGroup.displayName = CommandPrimitive.Group.displayName + +const CommandSeparator = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +CommandSeparator.displayName = CommandPrimitive.Separator.displayName + +const CommandItem = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) + +CommandItem.displayName = CommandPrimitive.Item.displayName + +const CommandShortcut = ({ className, ...props }: React.HTMLAttributes) => { return ( ) } +CommandShortcut.displayName = 'CommandShortcut' export { Command, CommandDialog, - CommandInput, - CommandList, CommandEmpty, CommandGroup, + CommandInput, CommandItem, - CommandShortcut, + CommandList, CommandSeparator, + CommandShortcut, } diff --git a/apps/ui-library/registry/default/components/ui/dialog.tsx b/apps/ui-library/registry/default/components/ui/dialog.tsx index 4a676bc8a29..063d356b306 100644 --- a/apps/ui-library/registry/default/components/ui/dialog.tsx +++ b/apps/ui-library/registry/default/components/ui/dialog.tsx @@ -1,119 +1,94 @@ 'use client' -import * as React from 'react' import * as DialogPrimitive from '@radix-ui/react-dialog' -import { XIcon } from 'lucide-react' +import { X } from 'lucide-react' +import * as React from 'react' import { cn } from '@/lib/utils' -function Dialog({ ...props }: React.ComponentProps) { - return -} +const Dialog = DialogPrimitive.Root -function DialogTrigger({ ...props }: React.ComponentProps) { - return -} +const DialogTrigger = DialogPrimitive.Trigger -function DialogPortal({ ...props }: React.ComponentProps) { - return -} +const DialogPortal = DialogPrimitive.Portal -function DialogClose({ ...props }: React.ComponentProps) { - return -} +const DialogClose = DialogPrimitive.Close -function DialogOverlay({ - className, - ...props -}: React.ComponentProps) { - return ( - , + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DialogOverlay.displayName = DialogPrimitive.Overlay.displayName + +const DialogContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + + - ) -} + > + {children} + + + Close + + + +)) +DialogContent.displayName = DialogPrimitive.Content.displayName -function DialogContent({ - className, - children, - showCloseButton = true, - ...props -}: React.ComponentProps & { - showCloseButton?: boolean -}) { - return ( - - - - {children} - {showCloseButton && ( - - - Close - - )} - - - ) -} +const DialogHeader = ({ className, ...props }: React.HTMLAttributes) => ( +
+) +DialogHeader.displayName = 'DialogHeader' -function DialogHeader({ className, ...props }: React.ComponentProps<'div'>) { - return ( -
- ) -} +const DialogFooter = ({ className, ...props }: React.HTMLAttributes) => ( +
+) +DialogFooter.displayName = 'DialogFooter' -function DialogFooter({ className, ...props }: React.ComponentProps<'div'>) { - return ( -
- ) -} +const DialogTitle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DialogTitle.displayName = DialogPrimitive.Title.displayName -function DialogTitle({ className, ...props }: React.ComponentProps) { - return ( - - ) -} - -function DialogDescription({ - className, - ...props -}: React.ComponentProps) { - return ( - - ) -} +const DialogDescription = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DialogDescription.displayName = DialogPrimitive.Description.displayName export { Dialog, diff --git a/apps/ui-library/registry/default/components/ui/drawer.tsx b/apps/ui-library/registry/default/components/ui/drawer.tsx index fe38ae70f35..1f99cd70894 100644 --- a/apps/ui-library/registry/default/components/ui/drawer.tsx +++ b/apps/ui-library/registry/default/components/ui/drawer.tsx @@ -5,120 +5,96 @@ import { Drawer as DrawerPrimitive } from 'vaul' import { cn } from '@/lib/utils' -function Drawer({ ...props }: React.ComponentProps) { - return -} - -function DrawerTrigger({ ...props }: React.ComponentProps) { - return -} - -function DrawerPortal({ ...props }: React.ComponentProps) { - return -} - -function DrawerClose({ ...props }: React.ComponentProps) { - return -} - -function DrawerOverlay({ - className, +const Drawer = ({ + shouldScaleBackground = true, ...props -}: React.ComponentProps) { - return ( - ) => ( + +) +Drawer.displayName = 'Drawer' + +const DrawerTrigger = DrawerPrimitive.Trigger + +const DrawerPortal = DrawerPrimitive.Portal + +const DrawerClose = DrawerPrimitive.Close + +const DrawerOverlay = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName + +const DrawerContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + + - ) -} + > +
+ {children} + + +)) +DrawerContent.displayName = 'DrawerContent' -function DrawerContent({ - className, - children, - ...props -}: React.ComponentProps) { - return ( - - - -
- {children} - - - ) -} +const DrawerHeader = ({ className, ...props }: React.HTMLAttributes) => ( +
+) +DrawerHeader.displayName = 'DrawerHeader' -function DrawerHeader({ className, ...props }: React.ComponentProps<'div'>) { - return ( -
- ) -} +const DrawerFooter = ({ className, ...props }: React.HTMLAttributes) => ( +
+) +DrawerFooter.displayName = 'DrawerFooter' -function DrawerFooter({ className, ...props }: React.ComponentProps<'div'>) { - return ( -
- ) -} +const DrawerTitle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DrawerTitle.displayName = DrawerPrimitive.Title.displayName -function DrawerTitle({ className, ...props }: React.ComponentProps) { - return ( - - ) -} - -function DrawerDescription({ - className, - ...props -}: React.ComponentProps) { - return ( - - ) -} +const DrawerDescription = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DrawerDescription.displayName = DrawerPrimitive.Description.displayName export { Drawer, - DrawerPortal, - DrawerOverlay, - DrawerTrigger, DrawerClose, DrawerContent, - DrawerHeader, - DrawerFooter, - DrawerTitle, DrawerDescription, + DrawerFooter, + DrawerHeader, + DrawerOverlay, + DrawerPortal, + DrawerTitle, + DrawerTrigger, } diff --git a/apps/ui-library/registry/default/components/ui/form.tsx b/apps/ui-library/registry/default/components/ui/form.tsx index f62ae0ff47c..37b57568228 100644 --- a/apps/ui-library/registry/default/components/ui/form.tsx +++ b/apps/ui-library/registry/default/components/ui/form.tsx @@ -1,15 +1,15 @@ 'use client' -import * as React from 'react' import * as LabelPrimitive from '@radix-ui/react-label' import { Slot } from '@radix-ui/react-slot' +import * as React from 'react' import { Controller, - ControllerProps, - FieldPath, - FieldValues, FormProvider, useFormContext, + type ControllerProps, + type FieldPath, + type FieldValues, } from 'react-hook-form' import { cn } from '@/lib/utils' @@ -74,7 +74,7 @@ const FormItem = React.forwardRef -
+
) } @@ -90,7 +90,7 @@ const FormLabel = React.forwardRef< return (