From 85556056fdc5e588b876a72620357dd4c38573e4 Mon Sep 17 00:00:00 2001 From: david Date: Sun, 12 Apr 2026 12:07:54 +0200 Subject: [PATCH] =?UTF-8?q?Actualizaci=C3=B3n=20ShadCN/UI=20a=20Base=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/shadcn-ui/components.json | 4 +- packages/shadcn-ui/package.json | 68 ++-- .../shadcn-ui/src/components/accordion.tsx | 25 +- .../shadcn-ui/src/components/alert-dialog.tsx | 68 ++-- packages/shadcn-ui/src/components/alert.tsx | 4 +- .../shadcn-ui/src/components/aspect-ratio.tsx | 19 +- packages/shadcn-ui/src/components/avatar.tsx | 11 +- packages/shadcn-ui/src/components/badge.tsx | 33 +- .../shadcn-ui/src/components/breadcrumb.tsx | 35 ++- .../shadcn-ui/src/components/button-group.tsx | 42 +-- packages/shadcn-ui/src/components/button.tsx | 37 +-- .../shadcn-ui/src/components/calendar.tsx | 3 +- packages/shadcn-ui/src/components/card.tsx | 10 +- .../shadcn-ui/src/components/carousel.tsx | 2 + packages/shadcn-ui/src/components/chart.tsx | 71 +++-- .../shadcn-ui/src/components/checkbox.tsx | 12 +- .../shadcn-ui/src/components/collapsible.tsx | 24 +- .../shadcn-ui/src/components/combobox.tsx | 295 ++++++++++++++++++ packages/shadcn-ui/src/components/command.tsx | 9 +- .../shadcn-ui/src/components/context-menu.tsx | 172 +++++----- packages/shadcn-ui/src/components/dialog.tsx | 66 ++-- .../shadcn-ui/src/components/direction.tsx | 4 + packages/shadcn-ui/src/components/drawer.tsx | 10 +- .../src/components/dropdown-menu.tsx | 235 +++++++------- packages/shadcn-ui/src/components/empty.tsx | 11 +- packages/shadcn-ui/src/components/field.tsx | 12 +- packages/shadcn-ui/src/components/form.tsx | 95 +++--- .../shadcn-ui/src/components/hover-card.tsx | 58 ++-- .../shadcn-ui/src/components/input-group.tsx | 22 +- .../shadcn-ui/src/components/input-otp.tsx | 4 +- packages/shadcn-ui/src/components/input.tsx | 18 +- packages/shadcn-ui/src/components/item.tsx | 37 ++- packages/shadcn-ui/src/components/label.tsx | 10 +- packages/shadcn-ui/src/components/menubar.tsx | 158 +++++----- .../src/components/native-select.tsx | 61 ++++ .../src/components/navigation-menu.tsx | 76 ++--- .../shadcn-ui/src/components/pagination.tsx | 27 +- packages/shadcn-ui/src/components/popover.tsx | 57 ++-- .../shadcn-ui/src/components/progress.tsx | 80 ++++- .../shadcn-ui/src/components/radio-group.tsx | 26 +- .../shadcn-ui/src/components/resizable.tsx | 2 + .../shadcn-ui/src/components/scroll-area.tsx | 12 +- packages/shadcn-ui/src/components/select.tsx | 127 ++++---- .../shadcn-ui/src/components/separator.tsx | 22 +- packages/shadcn-ui/src/components/sheet.tsx | 67 ++-- packages/shadcn-ui/src/components/sidebar.tsx | 209 +++++++------ packages/shadcn-ui/src/components/slider.tsx | 59 ++-- packages/shadcn-ui/src/components/sonner.tsx | 2 + packages/shadcn-ui/src/components/switch.tsx | 7 +- packages/shadcn-ui/src/components/table.tsx | 4 +- packages/shadcn-ui/src/components/tabs.tsx | 26 +- .../shadcn-ui/src/components/textarea.tsx | 2 +- .../shadcn-ui/src/components/toggle-group.tsx | 22 +- packages/shadcn-ui/src/components/toggle.tsx | 21 +- packages/shadcn-ui/src/components/tooltip.tsx | 57 ++-- packages/shadcn-ui/src/hooks/use-mobile.tsx | 19 ++ packages/shadcn-ui/src/styles/globals.css | 278 +++++++---------- packages/shadcn-ui/tailwind.config.mts | 4 + packages/shadcn-ui/tsconfig.json | 1 - packages/shadcn-ui/update-components.sh | 3 +- 60 files changed, 1715 insertions(+), 1240 deletions(-) create mode 100644 packages/shadcn-ui/src/components/combobox.tsx create mode 100644 packages/shadcn-ui/src/components/direction.tsx create mode 100644 packages/shadcn-ui/src/components/native-select.tsx create mode 100644 packages/shadcn-ui/src/hooks/use-mobile.tsx diff --git a/packages/shadcn-ui/components.json b/packages/shadcn-ui/components.json index 5cced8c9..a950c0c4 100644 --- a/packages/shadcn-ui/components.json +++ b/packages/shadcn-ui/components.json @@ -1,11 +1,11 @@ { "$schema": "https://ui.shadcn.com/schema.json", - "style": "radix-nova", + "style": "base-vega", "rsc": false, "tsx": true, "tailwind": { "config": "", - "css": "@repo/shadcn-ui/globals.css", + "css": "src/styles/globals.css", "baseColor": "neutral", "cssVariables": true, "prefix": "" diff --git a/packages/shadcn-ui/package.json b/packages/shadcn-ui/package.json index 8e129806..4b9ea817 100644 --- a/packages/shadcn-ui/package.json +++ b/packages/shadcn-ui/package.json @@ -20,49 +20,75 @@ "ui:add": "pnpm dlx shadcn@latest add" }, "peerDependencies": { - "react": "^19.1.0", - "react-dom": "^19.1.0" + "react": "^19.2.5", + "react-dom": "^19.2.5" }, "devDependencies": { - "@biomejs/biome": "^2.3.1", + "@biomejs/biome": "^2.4.11", "@repo/typescript-config": "workspace:*", - "@tailwindcss/cli": "^4.1.5", - "@tailwindcss/postcss": "^4.1.5", - "@turbo/gen": "^2.5.2", - "@types/node": "^22.15.12", - "@types/react": "^19.1.2", - "@types/react-dom": "^19.1.3", - "postcss": "^8.5.3", - "react": "^19.1.0", - "react-dom": "^19.1.0", - "shadcn": "^4.0.8", + "@tailwindcss/cli": "^4.2.2", + "@tailwindcss/postcss": "^4.2.2", + "@turbo/gen": "^2.9.6", + "@types/node": "^25.6.0", + "@types/react": "^19.2.14", + "@types/react-dom": "^19.2.3", + "postcss": "^8.5.9", + "react": "^19.2.5", + "react-dom": "^19.2.5", + "shadcn": "^4.2.0", "tw-animate-css": "^1.4.0", - "typescript": "^5.6.0" + "typescript": "^6.0.2" }, "dependencies": { + "@base-ui/react": "^1.3.0", "@fontsource-variable/geist": "^5.2.8", "@fontsource-variable/geist-mono": "^5.2.7", "@hookform/resolvers": "^5.2.2", + "@radix-ui/react-accordion": "^1.2.12", + "@radix-ui/react-alert-dialog": "^1.1.15", + "@radix-ui/react-aspect-ratio": "^1.1.8", + "@radix-ui/react-avatar": "^1.1.11", + "@radix-ui/react-checkbox": "^1.3.3", + "@radix-ui/react-collapsible": "^1.1.12", + "@radix-ui/react-context-menu": "^2.2.16", + "@radix-ui/react-dialog": "^1.1.15", + "@radix-ui/react-dropdown-menu": "^2.1.16", + "@radix-ui/react-hover-card": "^1.1.15", + "@radix-ui/react-label": "^2.1.8", + "@radix-ui/react-menubar": "^1.1.16", + "@radix-ui/react-navigation-menu": "^1.2.14", + "@radix-ui/react-popover": "^1.1.15", + "@radix-ui/react-progress": "^1.1.8", + "@radix-ui/react-radio-group": "^1.3.8", + "@radix-ui/react-scroll-area": "^1.2.10", + "@radix-ui/react-select": "^2.2.6", + "@radix-ui/react-separator": "^1.1.8", + "@radix-ui/react-slider": "^1.3.6", + "@radix-ui/react-slot": "^1.2.4", + "@radix-ui/react-switch": "^1.2.6", + "@radix-ui/react-tabs": "^1.1.13", + "@radix-ui/react-tooltip": "^1.2.8", "add": "^2.0.6", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "cmdk": "^1.1.1", "date-fns": "^4.1.0", "embla-carousel-react": "^8.6.0", - "framer-motion": "^12.4.7", + "framer-motion": "^12.38.0", "input-otp": "^1.4.2", - "lucide-react": "^0.577.0", + "lucide-react": "^1.8.0", "next-themes": "^0.4.6", - "pnpm": "^10.10.0", + "pnpm": "^10.33.0", "radix-ui": "latest", "react-day-picker": "9.14.0", "react-hook-form": "^7.72.1", - "react-resizable-panels": "^4.8.0", - "recharts": "2.15.4", + "react-resizable-panels": "^4.9.0", + "recharts": "3.8.0", "sonner": "^2.0.7", "tailwind-merge": "^3.5.0", - "tailwindcss": "^4.1.10", + "tailwindcss": "^4.2.2", + "tailwindcss-animate": "^1.0.7", "vaul": "^1.1.2", - "zod": "^3.25.76" + "zod": "^4.3.6" } } \ No newline at end of file diff --git a/packages/shadcn-ui/src/components/accordion.tsx b/packages/shadcn-ui/src/components/accordion.tsx index b390c16b..306a7e85 100644 --- a/packages/shadcn-ui/src/components/accordion.tsx +++ b/packages/shadcn-ui/src/components/accordion.tsx @@ -1,13 +1,9 @@ -import * as React from "react" -import { Accordion as AccordionPrimitive } from "radix-ui" +import { Accordion as AccordionPrimitive } from "@base-ui/react/accordion" import { cn } from "@repo/shadcn-ui/lib/utils" import { ChevronDownIcon, ChevronUpIcon } from "lucide-react" -function Accordion({ - className, - ...props -}: React.ComponentProps) { +function Accordion({ className, ...props }: AccordionPrimitive.Root.Props) { return ( ) { +function AccordionItem({ className, ...props }: AccordionPrimitive.Item.Props) { return ( ) { +}: AccordionPrimitive.Trigger.Props) { return ( ) { +}: AccordionPrimitive.Panel.Props) { return ( -
{children}
-
+ ) } diff --git a/packages/shadcn-ui/src/components/alert-dialog.tsx b/packages/shadcn-ui/src/components/alert-dialog.tsx index 1290c9b1..11c4d9d9 100644 --- a/packages/shadcn-ui/src/components/alert-dialog.tsx +++ b/packages/shadcn-ui/src/components/alert-dialog.tsx @@ -1,26 +1,22 @@ +"use client" + import * as React from "react" -import { AlertDialog as AlertDialogPrimitive } from "radix-ui" +import { AlertDialog as AlertDialogPrimitive } from "@base-ui/react/alert-dialog" import { cn } from "@repo/shadcn-ui/lib/utils" import { Button } from "@repo/shadcn-ui/components/button" -function AlertDialog({ - ...props -}: React.ComponentProps) { +function AlertDialog({ ...props }: AlertDialogPrimitive.Root.Props) { return } -function AlertDialogTrigger({ - ...props -}: React.ComponentProps) { +function AlertDialogTrigger({ ...props }: AlertDialogPrimitive.Trigger.Props) { return ( ) } -function AlertDialogPortal({ - ...props -}: React.ComponentProps) { +function AlertDialogPortal({ ...props }: AlertDialogPrimitive.Portal.Props) { return ( ) @@ -29,12 +25,12 @@ function AlertDialogPortal({ function AlertDialogOverlay({ className, ...props -}: React.ComponentProps) { +}: AlertDialogPrimitive.Backdrop.Props) { return ( - & { +}: AlertDialogPrimitive.Popup.Props & { size?: "default" | "sm" }) { return ( - & - Pick, "variant" | "size">) { +}: React.ComponentProps) { return ( - + + } + {...props} + /> ) } diff --git a/packages/shadcn-ui/src/components/alert.tsx b/packages/shadcn-ui/src/components/alert.tsx index 5197a955..3a1ed534 100644 --- a/packages/shadcn-ui/src/components/alert.tsx +++ b/packages/shadcn-ui/src/components/alert.tsx @@ -4,7 +4,7 @@ import { cva, type VariantProps } from "class-variance-authority" import { cn } from "@repo/shadcn-ui/lib/utils" const alertVariants = cva( - "group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4", + "group/alert relative grid w-full gap-0.5 rounded-lg border px-4 py-3 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4", { variants: { variant: { @@ -67,7 +67,7 @@ function AlertAction({ className, ...props }: React.ComponentProps<"div">) { return (
) diff --git a/packages/shadcn-ui/src/components/aspect-ratio.tsx b/packages/shadcn-ui/src/components/aspect-ratio.tsx index ae5f48c7..b79c7b99 100644 --- a/packages/shadcn-ui/src/components/aspect-ratio.tsx +++ b/packages/shadcn-ui/src/components/aspect-ratio.tsx @@ -1,9 +1,22 @@ -import { AspectRatio as AspectRatioPrimitive } from "radix-ui" +import { cn } from "@repo/shadcn-ui/lib/utils" function AspectRatio({ + ratio, + className, ...props -}: React.ComponentProps) { - return +}: React.ComponentProps<"div"> & { ratio: number }) { + return ( +
+ ) } export { AspectRatio } diff --git a/packages/shadcn-ui/src/components/avatar.tsx b/packages/shadcn-ui/src/components/avatar.tsx index 0043e851..7ae5c2ef 100644 --- a/packages/shadcn-ui/src/components/avatar.tsx +++ b/packages/shadcn-ui/src/components/avatar.tsx @@ -1,5 +1,5 @@ import * as React from "react" -import { Avatar as AvatarPrimitive } from "radix-ui" +import { Avatar as AvatarPrimitive } from "@base-ui/react/avatar" import { cn } from "@repo/shadcn-ui/lib/utils" @@ -7,7 +7,7 @@ function Avatar({ className, size = "default", ...props -}: React.ComponentProps & { +}: AvatarPrimitive.Root.Props & { size?: "default" | "sm" | "lg" }) { return ( @@ -23,10 +23,7 @@ function Avatar({ ) } -function AvatarImage({ - className, - ...props -}: React.ComponentProps) { +function AvatarImage({ className, ...props }: AvatarPrimitive.Image.Props) { return ( ) { +}: AvatarPrimitive.Fallback.Props) { return ( & - VariantProps & { asChild?: boolean }) { - const Comp = asChild ? Slot.Root : "span" - - return ( - - ) +}: useRender.ComponentProps<"span"> & VariantProps) { + return useRender({ + defaultTagName: "span", + props: mergeProps<"span">( + { + className: cn(badgeVariants({ variant }), className), + }, + props + ), + render, + state: { + slot: "badge", + variant, + }, + }) } export { Badge, badgeVariants } diff --git a/packages/shadcn-ui/src/components/breadcrumb.tsx b/packages/shadcn-ui/src/components/breadcrumb.tsx index 62863575..5b53e8f4 100644 --- a/packages/shadcn-ui/src/components/breadcrumb.tsx +++ b/packages/shadcn-ui/src/components/breadcrumb.tsx @@ -1,5 +1,6 @@ import * as React from "react" -import { Slot } from "radix-ui" +import { mergeProps } from "@base-ui/react/merge-props" +import { useRender } from "@base-ui/react/use-render" import { cn } from "@repo/shadcn-ui/lib/utils" import { ChevronRightIcon, MoreHorizontalIcon } from "lucide-react" @@ -20,7 +21,7 @@ function BreadcrumbList({ className, ...props }: React.ComponentProps<"ol">) {
    ) { return (
  1. ) } function BreadcrumbLink({ - asChild, className, + render, ...props -}: React.ComponentProps<"a"> & { - asChild?: boolean -}) { - const Comp = asChild ? Slot.Root : "a" - - return ( - - ) +}: useRender.ComponentProps<"a">) { + return useRender({ + defaultTagName: "a", + props: mergeProps<"a">( + { + className: cn("transition-colors hover:text-foreground", className), + }, + props + ), + render, + state: { + slot: "breadcrumb-link", + }, + }) } function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">) { diff --git a/packages/shadcn-ui/src/components/button-group.tsx b/packages/shadcn-ui/src/components/button-group.tsx index adb6abf1..7b56a260 100644 --- a/packages/shadcn-ui/src/components/button-group.tsx +++ b/packages/shadcn-ui/src/components/button-group.tsx @@ -1,18 +1,19 @@ +import { mergeProps } from "@base-ui/react/merge-props" +import { useRender } from "@base-ui/react/use-render" import { cva, type VariantProps } from "class-variance-authority" -import { Slot } from "radix-ui" import { cn } from "@repo/shadcn-ui/lib/utils" import { Separator } from "@repo/shadcn-ui/components/separator" const buttonGroupVariants = cva( - "flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", + "flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", { variants: { orientation: { horizontal: - "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg!", + "*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-md! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0", vertical: - "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!", + "flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-md! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0", }, }, defaultVariants: { @@ -39,22 +40,25 @@ function ButtonGroup({ function ButtonGroupText({ className, - asChild = false, + render, ...props -}: React.ComponentProps<"div"> & { - asChild?: boolean -}) { - const Comp = asChild ? Slot.Root : "div" - - return ( - - ) +}: useRender.ComponentProps<"div">) { + return useRender({ + defaultTagName: "div", + props: mergeProps<"div">( + { + className: cn( + "flex items-center gap-2 rounded-md border bg-muted px-2.5 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", + className + ), + }, + props + ), + render, + state: { + slot: "button-group-text", + }, + }) } function ButtonGroupSeparator({ diff --git a/packages/shadcn-ui/src/components/button.tsx b/packages/shadcn-ui/src/components/button.tsx index 380275e0..0b49433d 100644 --- a/packages/shadcn-ui/src/components/button.tsx +++ b/packages/shadcn-ui/src/components/button.tsx @@ -1,17 +1,16 @@ -import * as React from "react" +import { Button as ButtonPrimitive } from "@base-ui/react/button" import { cva, type VariantProps } from "class-variance-authority" -import { Slot } from "radix-ui" import { cn } from "@repo/shadcn-ui/lib/utils" const buttonVariants = cva( - "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", + "group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", { variants: { variant: { - default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80", + default: "bg-primary text-primary-foreground hover:bg-primary/80", outline: - "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50", + "border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50", secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground", ghost: @@ -22,16 +21,16 @@ const buttonVariants = cva( }, size: { default: - "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2", - xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3", - sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5", - lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3", - icon: "size-8", + "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2", + xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3", + sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5", + lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2", + icon: "size-9", "icon-xs": - "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3", + "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3", "icon-sm": - "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg", - "icon-lg": "size-9", + "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md", + "icon-lg": "size-10", }, }, defaultVariants: { @@ -45,19 +44,11 @@ function Button({ className, variant = "default", size = "default", - asChild = false, ...props -}: React.ComponentProps<"button"> & - VariantProps & { - asChild?: boolean - }) { - const Comp = asChild ? Slot.Root : "button" - +}: ButtonPrimitive.Props & VariantProps) { return ( - diff --git a/packages/shadcn-ui/src/components/calendar.tsx b/packages/shadcn-ui/src/components/calendar.tsx index 92821686..c705947b 100644 --- a/packages/shadcn-ui/src/components/calendar.tsx +++ b/packages/shadcn-ui/src/components/calendar.tsx @@ -29,7 +29,7 @@ function Calendar({ svg]:rotate-180`, String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`, className @@ -194,7 +194,6 @@ function CalendarDayButton({ return ( + } + > + + Close )} - + ) } @@ -105,29 +100,26 @@ function DialogFooter({
    {children} {showCloseButton && ( - - + }> + Close )}
    ) } -function DialogTitle({ - className, - ...props -}: React.ComponentProps) { +function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) { return ( ) @@ -136,7 +128,7 @@ function DialogTitle({ function DialogDescription({ className, ...props -}: React.ComponentProps) { +}: DialogPrimitive.Description.Props) { return ( -
    +
    {children} @@ -71,7 +73,7 @@ function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
    ) diff --git a/packages/shadcn-ui/src/components/dropdown-menu.tsx b/packages/shadcn-ui/src/components/dropdown-menu.tsx index d5363e1b..d05294b9 100644 --- a/packages/shadcn-ui/src/components/dropdown-menu.tsx +++ b/packages/shadcn-ui/src/components/dropdown-menu.tsx @@ -1,58 +1,73 @@ import * as React from "react" -import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui" +import { Menu as MenuPrimitive } from "@base-ui/react/menu" import { cn } from "@repo/shadcn-ui/lib/utils" -import { CheckIcon, ChevronRightIcon } from "lucide-react" +import { ChevronRightIcon, CheckIcon } from "lucide-react" -function DropdownMenu({ - ...props -}: React.ComponentProps) { - return +function DropdownMenu({ ...props }: MenuPrimitive.Root.Props) { + return } -function DropdownMenuPortal({ - ...props -}: React.ComponentProps) { - return ( - - ) +function DropdownMenuPortal({ ...props }: MenuPrimitive.Portal.Props) { + return } -function DropdownMenuTrigger({ - ...props -}: React.ComponentProps) { - return ( - - ) +function DropdownMenuTrigger({ ...props }: MenuPrimitive.Trigger.Props) { + return } function DropdownMenuContent({ - className, align = "start", + alignOffset = 0, + side = "bottom", sideOffset = 4, + className, ...props -}: React.ComponentProps) { +}: MenuPrimitive.Popup.Props & + Pick< + MenuPrimitive.Positioner.Props, + "align" | "alignOffset" | "side" | "sideOffset" + >) { return ( - - + - + alignOffset={alignOffset} + side={side} + sideOffset={sideOffset} + > + + + ) } -function DropdownMenuGroup({ +function DropdownMenuGroup({ ...props }: MenuPrimitive.Group.Props) { + return +} + +function DropdownMenuLabel({ + className, + inset, ...props -}: React.ComponentProps) { +}: MenuPrimitive.GroupLabel.Props & { + inset?: boolean +}) { return ( - + ) } @@ -61,17 +76,17 @@ function DropdownMenuItem({ inset, variant = "default", ...props -}: React.ComponentProps & { +}: MenuPrimitive.Item.Props & { inset?: boolean variant?: "default" | "destructive" }) { return ( - +} + +function DropdownMenuSubTrigger({ + className, + inset, + children, + ...props +}: MenuPrimitive.SubmenuTrigger.Props & { + inset?: boolean +}) { + return ( + + {children} + + + ) +} + +function DropdownMenuSubContent({ + align = "start", + alignOffset = -3, + side = "right", + sideOffset = 0, + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + function DropdownMenuCheckboxItem({ className, children, checked, inset, ...props -}: React.ComponentProps & { +}: MenuPrimitive.CheckboxItem.Props & { inset?: boolean }) { return ( - - + - + {children} - + ) } -function DropdownMenuRadioGroup({ - ...props -}: React.ComponentProps) { +function DropdownMenuRadioGroup({ ...props }: MenuPrimitive.RadioGroup.Props) { return ( - @@ -129,15 +191,15 @@ function DropdownMenuRadioItem({ children, inset, ...props -}: React.ComponentProps & { +}: MenuPrimitive.RadioItem.Props & { inset?: boolean }) { return ( - - + - + {children} - - ) -} - -function DropdownMenuLabel({ - className, - inset, - ...props -}: React.ComponentProps & { - inset?: boolean -}) { - return ( - + ) } function DropdownMenuSeparator({ className, ...props -}: React.ComponentProps) { +}: MenuPrimitive.Separator.Props) { return ( - ) { - return -} - -function DropdownMenuSubTrigger({ - className, - inset, - children, - ...props -}: React.ComponentProps & { - inset?: boolean -}) { - return ( - - {children} - - - ) -} - -function DropdownMenuSubContent({ - className, - ...props -}: React.ComponentProps) { - return ( - - ) -} - export { DropdownMenu, DropdownMenuPortal, diff --git a/packages/shadcn-ui/src/components/empty.tsx b/packages/shadcn-ui/src/components/empty.tsx index 6c153edc..678fa6d0 100644 --- a/packages/shadcn-ui/src/components/empty.tsx +++ b/packages/shadcn-ui/src/components/empty.tsx @@ -7,7 +7,7 @@ function Empty({ className, ...props }: React.ComponentProps<"div">) {
    ) { return (
    ) @@ -83,7 +86,7 @@ function EmptyContent({ className, ...props }: React.ComponentProps<"div">) {
    ) {
    [data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3", + "flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3", className )} {...props} @@ -28,7 +28,7 @@ function FieldLegend({ data-slot="field-legend" data-variant={variant} className={cn( - "mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base", + "mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base", className )} {...props} @@ -41,7 +41,7 @@ function FieldGroup({ className, ...props }: React.ComponentProps<"div">) {
    ) { } const fieldVariants = cva( - "group/field flex w-full gap-2 data-[invalid=true]:text-destructive", + "group/field flex w-full gap-3 data-[invalid=true]:text-destructive", { variants: { orientation: { @@ -88,7 +88,7 @@ function FieldContent({ className, ...props }: React.ComponentProps<"div">) {
    [data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10", + "group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-3 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col", className )} diff --git a/packages/shadcn-ui/src/components/form.tsx b/packages/shadcn-ui/src/components/form.tsx index d42cdc6d..4440513d 100644 --- a/packages/shadcn-ui/src/components/form.tsx +++ b/packages/shadcn-ui/src/components/form.tsx @@ -1,13 +1,12 @@ "use client" import * as React from "react" -import { Label as LabelPrimitive, Slot as SlotPrimitive } from "radix-ui" - +import * as LabelPrimitive from "@radix-ui/react-label" +import { Slot } from "@radix-ui/react-slot" import { Controller, FormProvider, useFormContext, - useFormState, type ControllerProps, type FieldPath, type FieldValues, @@ -20,18 +19,16 @@ const Form = FormProvider type FormFieldContextValue< TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath = FieldPath, + TName extends FieldPath = FieldPath > = { name: TName } -const FormFieldContext = React.createContext( - {} as FormFieldContextValue -) +const FormFieldContext = React.createContext(null) const FormField = < TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath = FieldPath, + TName extends FieldPath = FieldPath >({ ...props }: ControllerProps) => { @@ -45,14 +42,18 @@ const FormField = < const useFormField = () => { const fieldContext = React.useContext(FormFieldContext) const itemContext = React.useContext(FormItemContext) - const { getFieldState } = useFormContext() - const formState = useFormState({ name: fieldContext.name }) - const fieldState = getFieldState(fieldContext.name, formState) + const { getFieldState, formState } = useFormContext() if (!fieldContext) { throw new Error("useFormField should be used within ") } + if (!itemContext) { + throw new Error("useFormField should be used within ") + } + + const fieldState = getFieldState(fieldContext.name, formState) + const { id } = itemContext return { @@ -69,47 +70,48 @@ type FormItemContextValue = { id: string } -const FormItemContext = React.createContext( - {} as FormItemContextValue -) +const FormItemContext = React.createContext(null) -function FormItem({ className, ...props }: React.ComponentProps<"div">) { +const FormItem = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => { const id = React.useId() return ( -
    +
    ) -} +}) +FormItem.displayName = "FormItem" -function FormLabel({ - className, - ...props -}: React.ComponentProps) { +const FormLabel = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => { const { error, formItemId } = useFormField() return (