Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

feat: update shadcn components

Dillion Vermae855a32de2fa
diff --git a/apps/www/components/ui/accordion.tsx b/apps/www/components/ui/accordion.tsx
index 4a8cca46..df9c6bb3 100644
--- a/apps/www/components/ui/accordion.tsx
+++ b/apps/www/components/ui/accordion.tsx
@@ -2,65 +2,56 @@
import * as React from "react"
import * as AccordionPrimitive from "@radix-ui/react-accordion"
-import { ChevronDownIcon } from "lucide-react"
+import { ChevronDown } from "lucide-react"
import { cn } from "@/lib/utils"
-function Accordion({
- ...props
-}: React.ComponentProps<typeof AccordionPrimitive.Root>) {
- return <AccordionPrimitive.Root data-slot="accordion" {...props} />
-}
+const Accordion = AccordionPrimitive.Root
-function AccordionItem({
- className,
- ...props
-}: React.ComponentProps<typeof AccordionPrimitive.Item>) {
- return (
- <AccordionPrimitive.Item
- data-slot="accordion-item"
- className={cn("border-b last:border-b-0", className)}
- {...props}
- />
- )
-}
-
-function AccordionTrigger({
- className,
- children,
- ...props
-}: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
- return (
- <AccordionPrimitive.Header className="flex">
- <AccordionPrimitive.Trigger
- data-slot="accordion-trigger"
- className={cn(
- "focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
- className
- )}
- {...props}
- >
- {children}
- <ChevronDownIcon className="text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" />
- </AccordionPrimitive.Trigger>
- </AccordionPrimitive.Header>
- )
-}
+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"
-function AccordionContent({
- className,
- children,
- ...props
-}: React.ComponentProps<typeof AccordionPrimitive.Content>) {
- return (
- <AccordionPrimitive.Content
- data-slot="accordion-content"
- className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
+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 text-left text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
+ className
+ )}
{...props}
>
- <div className={cn("pt-0 pb-4", className)}>{children}</div>
- </AccordionPrimitive.Content>
- )
-}
+ {children}
+ <ChevronDown className="text-muted-foreground 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="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
+ {...props}
+ >
+ <div className={cn("pt-0 pb-4", className)}>{children}</div>
+ </AccordionPrimitive.Content>
+))
+AccordionContent.displayName = AccordionPrimitive.Content.displayName
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
diff --git a/apps/www/components/ui/alert.tsx b/apps/www/components/ui/alert.tsx
index 14213546..9783ab80 100644
--- a/apps/www/components/ui/alert.tsx
+++ b/apps/www/components/ui/alert.tsx
@@ -4,13 +4,13 @@ import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const alertVariants = cva(
- "relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
+ "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-card text-card-foreground",
+ default: "bg-background text-foreground",
destructive:
- "text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",
+ "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
},
},
defaultVariants: {
@@ -19,48 +19,41 @@ const alertVariants = cva(
}
)
-function Alert({
- className,
- variant,
- ...props
-}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
- return (
- <div
- data-slot="alert"
- role="alert"
- className={cn(alertVariants({ variant }), className)}
- {...props}
- />
- )
-}
+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"
-function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="alert-title"
- className={cn(
- "col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",
- className
- )}
- {...props}
- />
- )
-}
+const AlertTitle = React.forwardRef<
+ HTMLParagraphElement,
+ React.HTMLAttributes<HTMLHeadingElement>
+>(({ className, ...props }, ref) => (
+ <h5
+ ref={ref}
+ className={cn("mb-1 leading-none font-medium tracking-tight", className)}
+ {...props}
+ />
+))
+AlertTitle.displayName = "AlertTitle"
-function AlertDescription({
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="alert-description"
- className={cn(
- "text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",
- className
- )}
- {...props}
- />
- )
-}
+const AlertDescription = React.forwardRef<
+ HTMLParagraphElement,
+ React.HTMLAttributes<HTMLParagraphElement>
+>(({ className, ...props }, ref) => (
+ <div
+ ref={ref}
+ className={cn("text-sm [&_p]:leading-relaxed", className)}
+ {...props}
+ />
+))
+AlertDescription.displayName = "AlertDescription"
export { Alert, AlertTitle, AlertDescription }
diff --git a/apps/www/components/ui/avatar.tsx b/apps/www/components/ui/avatar.tsx
index 71e428b4..e6a93ce0 100644
--- a/apps/www/components/ui/avatar.tsx
+++ b/apps/www/components/ui/avatar.tsx
@@ -5,49 +5,46 @@ import * as AvatarPrimitive from "@radix-ui/react-avatar"
import { cn } from "@/lib/utils"
-function Avatar({
- className,
- ...props
-}: React.ComponentProps<typeof AvatarPrimitive.Root>) {
- return (
- <AvatarPrimitive.Root
- data-slot="avatar"
- className={cn(
- "relative flex size-8 shrink-0 overflow-hidden rounded-full",
- className
- )}
- {...props}
- />
- )
-}
+const Avatar = React.forwardRef<
+ React.ElementRef<typeof AvatarPrimitive.Root>,
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
+>(({ className, ...props }, ref) => (
+ <AvatarPrimitive.Root
+ ref={ref}
+ className={cn(
+ "relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
+ className
+ )}
+ {...props}
+ />
+))
+Avatar.displayName = AvatarPrimitive.Root.displayName
-function AvatarImage({
- className,
- ...props
-}: React.ComponentProps<typeof AvatarPrimitive.Image>) {
- return (
- <AvatarPrimitive.Image
- data-slot="avatar-image"
- className={cn("aspect-square size-full", className)}
- {...props}
- />
- )
-}
+const AvatarImage = React.forwardRef<
+ React.ElementRef<typeof AvatarPrimitive.Image>,
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
+>(({ className, ...props }, ref) => (
+ <AvatarPrimitive.Image
+ ref={ref}
+ className={cn("aspect-square h-full w-full", className)}
+ {...props}
+ />
+))
+AvatarImage.displayName = AvatarPrimitive.Image.displayName
-function AvatarFallback({
- className,
- ...props
-}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
- return (
- <AvatarPrimitive.Fallback
- data-slot="avatar-fallback"
- className={cn(
- "bg-muted flex size-full items-center justify-center rounded-full",
- className
- )}
- {...props}
- />
- )
-}
+const AvatarFallback = React.forwardRef<
+ React.ElementRef<typeof AvatarPrimitive.Fallback>,
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
+>(({ className, ...props }, ref) => (
+ <AvatarPrimitive.Fallback
+ ref={ref}
+ className={cn(
+ "bg-muted flex h-full w-full items-center justify-center rounded-full",
+ className
+ )}
+ {...props}
+ />
+))
+AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
export { Avatar, AvatarImage, AvatarFallback }
diff --git a/apps/www/components/ui/badge.tsx b/apps/www/components/ui/badge.tsx
index b67c8b7c..e87d62bf 100644
--- a/apps/www/components/ui/badge.tsx
+++ b/apps/www/components/ui/badge.tsx
@@ -1,22 +1,20 @@
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 badgeVariants = cva(
- "inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
+ "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 [a&]:hover:bg-primary/90",
+ "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
secondary:
- "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
+ "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
destructive:
- "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
- outline:
- "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
+ "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
+ outline: "text-foreground",
},
},
defaultVariants: {
@@ -25,26 +23,14 @@ const badgeVariants = cva(
}
)
-interface BadgeProps
- extends React.HTMLAttributes<HTMLSpanElement>,
- VariantProps<typeof badgeVariants> {
- asChild?: boolean
-}
+export interface BadgeProps
+ extends React.HTMLAttributes<HTMLDivElement>,
+ VariantProps<typeof badgeVariants> {}
-const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(
- ({ className, variant, asChild = false, ...props }, ref) => {
- const Comp = asChild ? Slot : "span"
- return (
- <Comp
- data-slot="badge"
- className={cn(badgeVariants({ variant }), className)}
- ref={ref}
- {...props}
- />
- )
- }
-)
-
-Badge.displayName = "Badge"
+function Badge({ className, variant, ...props }: BadgeProps) {
+ return (
+ <div className={cn(badgeVariants({ variant }), className)} {...props} />
+ )
+}
-export { Badge, badgeVariants, type BadgeProps }
+export { Badge, badgeVariants }
diff --git a/apps/www/components/ui/button.tsx b/apps/www/components/ui/button.tsx
index beea7677..14941258 100644
--- a/apps/www/components/ui/button.tsx
+++ b/apps/www/components/ui/button.tsx
@@ -23,7 +23,7 @@ const buttonVariants = cva(
rainbow:
"group relative animate-rainbow cursor-pointer border-0 bg-[linear-gradient(#121213,#121213),linear-gradient(#121213_50%,rgba(18,18,19,0.6)_80%,rgba(18,18,19,0)),linear-gradient(90deg,var(--color-1),var(--color-5),var(--color-3),var(--color-4),var(--color-2))] bg-[length:200%] text-primary-foreground [background-clip:padding-box,border-box,border-box] [background-origin:border-box] [border:calc(0.08*1rem)_solid_transparent] before:absolute before:bottom-[-20%] before:left-1/2 before:z-0 before:h-1/5 before:w-3/5 before:-translate-x-1/2 before:animate-rainbow before:bg-[linear-gradient(90deg,var(--color-1),var(--color-5),var(--color-3),var(--color-4),var(--color-2))] before:[filter:blur(calc(0.8*1rem))] dark:bg-[linear-gradient(#fff,#fff),linear-gradient(#fff_50%,rgba(255,255,255,0.6)_80%,rgba(0,0,0,0)),linear-gradient(90deg,var(--color-1),var(--color-5),var(--color-3),var(--color-4),var(--color-2))]",
"rainbow-outline":
- "group relative animate-rainbow cursor-pointer border-0 border-input bg-[linear-gradient(#fff,#fff),linear-gradient(#fff_50%,rgba(255,255,255,0.6)_80%,rgba(0,0,0,0)),linear-gradient(90deg,var(--color-1),var(--color-5),var(--color-3),var(--color-4),var(--color-2))] bg-[length:200%] px-4 text-foreground shadow-sm [background-clip:padding-box,border-box,border-box] [background-origin:border-box] [border:calc(0.08*1rem)_solid_transparent] before:absolute before:bottom-[-20%] before:left-1/2 before:z-0 before:h-1/5 before:w-3/5 before:-translate-x-1/2 before:animate-rainbow before:bg-[linear-gradient(90deg,var(--color-1),var(--color-5),var(--color-3),var(--color-4),var(--color-2))] before:[filter:blur(calc(0.8*1rem))] dark:bg-[linear-gradient(#121213,#121213),linear-gradient(#121213_50%,rgba(18,18,19,0.6)_80%,rgba(18,18,19,0)),linear-gradient(90deg,var(--color-1),var(--color-5),var(--color-3),var(--color-4),var(--color-2))]",
+ "group relative animate-rainbow cursor-pointer border-0 border-input bg-[linear-gradient(#fff,#fff),linear-gradient(#fff_50%,rgba(255,255,255,0.6)_80%,rgba(0,0,0,0)),linear-gradient(90deg,var(--color-1),var(--color-5),var(--color-3),var(--color-4),var(--color-2))] bg-[length:200%] px-4 text-foreground [background-clip:padding-box,border-box,border-box] [background-origin:border-box] [border:calc(0.08*1rem)_solid_transparent] before:absolute before:bottom-[-20%] before:left-1/2 before:z-0 before:h-1/5 before:w-3/5 before:-translate-x-1/2 before:animate-rainbow before:bg-[linear-gradient(90deg,var(--color-1),var(--color-5),var(--color-3),var(--color-4),var(--color-2))] before:[filter:blur(calc(0.8*1rem))] dark:bg-[linear-gradient(#121213,#121213),linear-gradient(#121213_50%,rgba(18,18,19,0.6)_80%,rgba(18,18,19,0)),linear-gradient(90deg,var(--color-1),var(--color-5),var(--color-3),var(--color-4),var(--color-2))]",
},
size: {
default: "h-9 px-4 py-2 has-[>svg]:px-3",
diff --git a/apps/www/components/ui/calendar.tsx b/apps/www/components/ui/calendar.tsx
index b8df044d..79f7f38e 100644
--- a/apps/www/components/ui/calendar.tsx
+++ b/apps/www/components/ui/calendar.tsx
@@ -1,75 +1,213 @@
"use client"
import * as React from "react"
-import { ChevronLeft, ChevronRight } from "lucide-react"
-import { DayPicker } from "react-day-picker"
+import {
+ ChevronDownIcon,
+ ChevronLeftIcon,
+ ChevronRightIcon,
+} from "lucide-react"
+import { DayButton, DayPicker, getDefaultClassNames } from "react-day-picker"
import { cn } from "@/lib/utils"
-import { buttonVariants } from "@/components/ui/button"
+import { Button, buttonVariants } from "@/components/ui/button"
function Calendar({
className,
classNames,
showOutsideDays = true,
+ captionLayout = "label",
+ buttonVariant = "ghost",
+ formatters,
+ components,
...props
-}: React.ComponentProps<typeof DayPicker>) {
+}: React.ComponentProps<typeof DayPicker> & {
+ buttonVariant?: React.ComponentProps<typeof Button>["variant"]
+}) {
+ const defaultClassNames = getDefaultClassNames()
+
return (
<DayPicker
showOutsideDays={showOutsideDays}
- className={cn("p-3", className)}
+ className={cn(
+ "bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
+ String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
+ String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
+ className
+ )}
+ captionLayout={captionLayout}
+ formatters={{
+ formatMonthDropdown: (date) =>
+ date.toLocaleString("default", { month: "short" }),
+ ...formatters,
+ }}
classNames={{
- months: "flex flex-col sm:flex-row gap-2",
- month: "flex flex-col gap-4",
- caption: "flex justify-center pt-1 relative items-center w-full",
- caption_label: "text-sm font-medium",
- nav: "flex items-center gap-1",
- nav_button: cn(
- buttonVariants({ variant: "outline" }),
- "size-7 bg-transparent p-0 opacity-50 hover:opacity-100"
- ),
- nav_button_previous: "absolute left-1",
- nav_button_next: "absolute right-1",
- table: "w-full border-collapse space-x-1",
- head_row: "flex",
- head_cell:
- "text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",
- row: "flex w-full mt-2",
- cell: cn(
- "relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",
- props.mode === "range"
- ? "[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md"
- : "[&:has([aria-selected])]:rounded-md"
+ root: cn("w-fit", defaultClassNames.root),
+ months: cn(
+ "relative flex flex-col gap-4 md:flex-row",
+ defaultClassNames.months
+ ),
+ month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
+ nav: cn(
+ "absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
+ defaultClassNames.nav
+ ),
+ button_previous: cn(
+ buttonVariants({ variant: buttonVariant }),
+ "h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",
+ defaultClassNames.button_previous
+ ),
+ button_next: cn(
+ buttonVariants({ variant: buttonVariant }),
+ "h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",
+ defaultClassNames.button_next
+ ),
+ month_caption: cn(
+ "flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",
+ defaultClassNames.month_caption
+ ),
+ dropdowns: cn(
+ "flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",
+ defaultClassNames.dropdowns
+ ),
+ dropdown_root: cn(
+ "has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",
+ defaultClassNames.dropdown_root
+ ),
+ dropdown: cn(
+ "bg-popover absolute inset-0 opacity-0",
+ defaultClassNames.dropdown
+ ),
+ caption_label: cn(
+ "select-none font-medium",
+ captionLayout === "label"
+ ? "text-sm"
+ : "[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",
+ defaultClassNames.caption_label
+ ),
+ table: "w-full border-collapse",
+ weekdays: cn("flex", defaultClassNames.weekdays),
+ weekday: cn(
+ "text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",
+ defaultClassNames.weekday
+ ),
+ week: cn("mt-2 flex w-full", defaultClassNames.week),
+ week_number_header: cn(
+ "w-[--cell-size] select-none",
+ defaultClassNames.week_number_header
+ ),
+ week_number: cn(
+ "text-muted-foreground select-none text-[0.8rem]",
+ defaultClassNames.week_number
),
day: cn(
- buttonVariants({ variant: "ghost" }),
- "size-8 p-0 font-normal aria-selected:opacity-100"
- ),
- day_range_start:
- "day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",
- day_range_end:
- "day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",
- day_selected:
- "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
- day_today: "bg-accent text-accent-foreground",
- day_outside:
- "day-outside text-muted-foreground aria-selected:text-muted-foreground",
- day_disabled: "text-muted-foreground opacity-50",
- day_range_middle:
- "aria-selected:bg-accent aria-selected:text-accent-foreground",
- day_hidden: "invisible",
+ "group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",
+ defaultClassNames.day
+ ),
+ range_start: cn(
+ "bg-accent rounded-l-md",
+ defaultClassNames.range_start
+ ),
+ range_middle: cn("rounded-none", defaultClassNames.range_middle),
+ range_end: cn("bg-accent rounded-r-md", defaultClassNames.range_end),
+ today: cn(
+ "bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
+ defaultClassNames.today
+ ),
+ outside: cn(
+ "text-muted-foreground aria-selected:text-muted-foreground",
+ defaultClassNames.outside
+ ),
+ disabled: cn(
+ "text-muted-foreground opacity-50",
+ defaultClassNames.disabled
+ ),
+ hidden: cn("invisible", defaultClassNames.hidden),
...classNames,
}}
components={{
- IconLeft: ({ className, ...props }) => (
- <ChevronLeft className={cn("size-4", className)} {...props} />
- ),
- IconRight: ({ className, ...props }) => (
- <ChevronRight className={cn("size-4", className)} {...props} />
- ),
+ Root: ({ className, rootRef, ...props }) => {
+ return (
+ <div
+ data-slot="calendar"
+ ref={rootRef}
+ className={cn(className)}
+ {...props}
+ />
+ )
+ },
+ Chevron: ({ className, orientation, ...props }) => {
+ if (orientation === "left") {
+ return (
+ <ChevronLeftIcon className={cn("size-4", className)} {...props} />
+ )
+ }
+
+ if (orientation === "right") {
+ return (
+ <ChevronRightIcon
+ className={cn("size-4", className)}
+ {...props}
+ />
+ )
+ }
+
+ return (
+ <ChevronDownIcon className={cn("size-4", className)} {...props} />
+ )
+ },
+ DayButton: CalendarDayButton,
+ WeekNumber: ({ children, ...props }) => {
+ return (
+ <td {...props}>
+ <div className="flex size-[--cell-size] items-center justify-center text-center">
+ {children}
+ </div>
+ </td>
+ )
+ },
+ ...components,
}}
{...props}
/>
)
}
-export { Calendar }
+function CalendarDayButton({
+ className,
+ day,
+ modifiers,
+ ...props
+}: React.ComponentProps<typeof DayButton>) {
+ const defaultClassNames = getDefaultClassNames()
+
+ const ref = React.useRef<HTMLButtonElement>(null)
+ React.useEffect(() => {
+ if (modifiers.focused) ref.current?.focus()
+ }, [modifiers.focused])
+
+ return (
+ <Button
+ ref={ref}
+ variant="ghost"
+ size="icon"
+ data-day={day.date.toLocaleDateString()}
+ data-selected-single={
+ modifiers.selected &&
+ !modifiers.range_start &&
+ !modifiers.range_end &&
+ !modifiers.range_middle
+ }
+ data-range-start={modifiers.range_start}
+ data-range-end={modifiers.range_end}
+ data-range-middle={modifiers.range_middle}
+ className={cn(
+ "data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md [&>span]:text-xs [&>span]:opacity-70",
+ defaultClassNames.day,
+ className
+ )}
+ {...props}
+ />
+ )
+}
+
+export { Calendar, CalendarDayButton }
diff --git a/apps/www/components/ui/card.tsx b/apps/www/components/ui/card.tsx
index d05bbc6c..04b3de2e 100644
--- a/apps/www/components/ui/card.tsx
+++ b/apps/www/components/ui/card.tsx
@@ -2,91 +2,75 @@ import * as React from "react"
import { cn } from "@/lib/utils"
-function Card({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="card"
- className={cn(
- "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
- className
- )}
- {...props}
- />
- )
-}
+const Card = React.forwardRef<
+ HTMLDivElement,
+ React.HTMLAttributes<HTMLDivElement>
+>(({ className, ...props }, ref) => (
+ <div
+ ref={ref}
+ className={cn(
+ "bg-card text-card-foreground rounded-xl border shadow",
+ className
+ )}
+ {...props}
+ />
+))
+Card.displayName = "Card"
-function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="card-header"
- className={cn(
- "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
- className
- )}
- {...props}
- />
- )
-}
+const CardHeader = React.forwardRef<
+ HTMLDivElement,
+ React.HTMLAttributes<HTMLDivElement>
+>(({ className, ...props }, ref) => (
+ <div
+ ref={ref}
+ className={cn("flex flex-col space-y-1.5 p-6", className)}
+ {...props}
+ />
+))
+CardHeader.displayName = "CardHeader"
-function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="card-title"
- className={cn("leading-none font-semibold", className)}
- {...props}
- />
- )
-}
+const CardTitle = React.forwardRef<
+ HTMLDivElement,
+ React.HTMLAttributes<HTMLDivElement>
+>(({ className, ...props }, ref) => (
+ <div
+ ref={ref}
+ className={cn("leading-none font-semibold tracking-tight", className)}
+ {...props}
+ />
+))
+CardTitle.displayName = "CardTitle"
-function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="card-description"
- className={cn("text-muted-foreground text-sm", className)}
- {...props}
- />
- )
-}
+const CardDescription = React.forwardRef<
+ HTMLDivElement,
+ React.HTMLAttributes<HTMLDivElement>
+>(({ className, ...props }, ref) => (
+ <div
+ ref={ref}
+ className={cn("text-muted-foreground text-sm", className)}
+ {...props}
+ />
+))
+CardDescription.displayName = "CardDescription"
-function CardAction({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="card-action"
- className={cn(
- "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
- className
- )}
- {...props}
- />
- )
-}
+const CardContent = React.forwardRef<
+ HTMLDivElement,
+ React.HTMLAttributes<HTMLDivElement>
+>(({ className, ...props }, ref) => (
+ <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
+))
+CardContent.displayName = "CardContent"
-function CardContent({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="card-content"
- className={cn("px-6", className)}
- {...props}
- />
- )
-}
+const CardFooter = React.forwardRef<
+ HTMLDivElement,
+ React.HTMLAttributes<HTMLDivElement>
+>(({ className, ...props }, ref) => (
+ <div
+ ref={ref}
+ className={cn("flex items-center p-6 pt-0", className)}
+ {...props}
+ />
+))
+CardFooter.displayName = "CardFooter"
-function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="card-footer"
- className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
- {...props}
- />
- )
-}
-
-export {
- Card,
- CardHeader,
- CardFooter,
- CardTitle,
- CardAction,
- CardDescription,
- CardContent,
-}
+export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
diff --git a/apps/www/components/ui/collapsible.tsx b/apps/www/components/ui/collapsible.tsx
index ae9fad04..9fa48946 100644
--- a/apps/www/components/ui/collapsible.tsx
+++ b/apps/www/components/ui/collapsible.tsx
@@ -2,32 +2,10 @@
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
-function Collapsible({
- ...props
-}: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
- return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
-}
+const Collapsible = CollapsiblePrimitive.Root
-function CollapsibleTrigger({
- ...props
-}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
- return (
- <CollapsiblePrimitive.CollapsibleTrigger
- data-slot="collapsible-trigger"
- {...props}
- />
- )
-}
+const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger
-function CollapsibleContent({
- ...props
-}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
- return (
- <CollapsiblePrimitive.CollapsibleContent
- data-slot="collapsible-content"
- {...props}
- />
- )
-}
+const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
diff --git a/apps/www/components/ui/command.tsx b/apps/www/components/ui/command.tsx
index 4ca53497..2543c7ad 100644
--- a/apps/www/components/ui/command.tsx
+++ b/apps/www/components/ui/command.tsx
@@ -1,51 +1,33 @@
"use client"
import * as React from "react"
+import { type DialogProps } from "@radix-ui/react-dialog"
import { Command as CommandPrimitive } from "cmdk"
-import { SearchIcon } from "lucide-react"
+import { Search } from "lucide-react"
import { cn } from "@/lib/utils"
-import {
- Dialog,
- DialogContent,
- DialogDescription,
- DialogHeader,
- DialogTitle,
-} from "@/components/ui/dialog"
-
-function Command({
- className,
- ...props
-}: React.ComponentProps<typeof CommandPrimitive>) {
- return (
- <CommandPrimitive
- data-slot="command"
- className={cn(
- "bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
- className
- )}
- {...props}
- />
- )
-}
+import { Dialog, DialogContent } from "@/components/ui/dialog"
-function CommandDialog({
- title = "Command Palette",
- description = "Search for a command to run...",
- children,
- ...props
-}: React.ComponentProps<typeof Dialog> & {
- title?: string
- description?: string
-}) {
+const Command = React.forwardRef<
+ React.ElementRef<typeof CommandPrimitive>,
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive>
+>(({ className, ...props }, ref) => (
+ <CommandPrimitive
+ ref={ref}
+ className={cn(
+ "bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
+ className
+ )}
+ {...props}
+ />
+))
+Command.displayName = CommandPrimitive.displayName
+
+const CommandDialog = ({ children, ...props }: DialogProps) => {
return (
<Dialog {...props}>
- <DialogHeader className="sr-only">
- <DialogTitle>{title}</DialogTitle>
- <DialogDescription>{description}</DialogDescription>
- </DialogHeader>
<DialogContent className="overflow-hidden p-0">
- <Command className="[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
+ <Command className="[&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
{children}
</Command>
</DialogContent>
@@ -53,108 +35,101 @@ function CommandDialog({
)
}
-function CommandInput({
- className,
- ...props
-}: React.ComponentProps<typeof CommandPrimitive.Input>) {
- return (
- <div
- data-slot="command-input-wrapper"
- className="flex h-9 items-center gap-2 border-b px-3"
- >
- <SearchIcon className="size-4 shrink-0 opacity-50" />
- <CommandPrimitive.Input
- data-slot="command-input"
- className={cn(
- "placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
- className
- )}
- {...props}
- />
- </div>
- )
-}
-
-function CommandList({
- className,
- ...props
-}: React.ComponentProps<typeof CommandPrimitive.List>) {
- return (
- <CommandPrimitive.List
- data-slot="command-list"
+const CommandInput = React.forwardRef<
+ React.ElementRef<typeof CommandPrimitive.Input>,
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
+>(({ className, ...props }, ref) => (
+ <div className="flex items-center border-b px-3" cmdk-input-wrapper="">
+ <Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
+ <CommandPrimitive.Input
+ ref={ref}
className={cn(
- "max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
+ "placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50",
className
)}
{...props}
/>
- )
-}
+ </div>
+))
-function CommandEmpty({
- ...props
-}: React.ComponentProps<typeof CommandPrimitive.Empty>) {
- return (
- <CommandPrimitive.Empty
- data-slot="command-empty"
- className="py-6 text-center text-sm"
- {...props}
- />
- )
-}
+CommandInput.displayName = CommandPrimitive.Input.displayName
-function CommandGroup({
- className,
- ...props
-}: React.ComponentProps<typeof CommandPrimitive.Group>) {
- return (
- <CommandPrimitive.Group
- data-slot="command-group"
- className={cn(
- "text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
- className
- )}
- {...props}
- />
- )
-}
+const CommandList = React.forwardRef<
+ React.ElementRef<typeof CommandPrimitive.List>,
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
+>(({ className, ...props }, ref) => (
+ <CommandPrimitive.List
+ ref={ref}
+ className={cn("max-h-[300px] overflow-x-hidden overflow-y-auto", className)}
+ {...props}
+ />
+))
-function CommandSeparator({
- className,
- ...props
-}: React.ComponentProps<typeof CommandPrimitive.Separator>) {
- return (
- <CommandPrimitive.Separator
- data-slot="command-separator"
- className={cn("bg-border -mx-1 h-px", className)}
- {...props}
- />
- )
-}
+CommandList.displayName = CommandPrimitive.List.displayName
-function CommandItem({
- className,
- ...props
-}: React.ComponentProps<typeof CommandPrimitive.Item>) {
- return (
- <CommandPrimitive.Item
- data-slot="command-item"
- className={cn(
- "data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- className
- )}
- {...props}
- />
- )
-}
+const CommandEmpty = React.forwardRef<
+ React.ElementRef<typeof CommandPrimitive.Empty>,
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
+>((props, ref) => (
+ <CommandPrimitive.Empty
+ ref={ref}
+ className="py-6 text-center text-sm"
+ {...props}
+ />
+))
+
+CommandEmpty.displayName = CommandPrimitive.Empty.displayName
+
+const CommandGroup = React.forwardRef<
+ React.ElementRef<typeof CommandPrimitive.Group>,
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
+>(({ className, ...props }, ref) => (
+ <CommandPrimitive.Group
+ ref={ref}
+ className={cn(
+ "text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
+ className
+ )}
+ {...props}
+ />
+))
+
+CommandGroup.displayName = CommandPrimitive.Group.displayName
+
+const CommandSeparator = React.forwardRef<
+ React.ElementRef<typeof CommandPrimitive.Separator>,
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
+>(({ className, ...props }, ref) => (
+ <CommandPrimitive.Separator
+ ref={ref}
+ className={cn("bg-border -mx-1 h-px", className)}
+ {...props}
+ />
+))
+CommandSeparator.displayName = CommandPrimitive.Separator.displayName
+
+const CommandItem = React.forwardRef<
+ React.ElementRef<typeof CommandPrimitive.Item>,
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
+>(({ className, ...props }, ref) => (
+ <CommandPrimitive.Item
+ ref={ref}
+ className={cn(
+ "data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
+ className
+ )}
+ {...props}
+ />
+))
+
+CommandItem.displayName = CommandPrimitive.Item.displayName
-function CommandShortcut({
+const CommandShortcut = ({
className,
...props
-}: React.ComponentProps<"span">) {
+}: React.HTMLAttributes<HTMLSpanElement>) => {
return (
<span
- data-slot="command-shortcut"
className={cn(
"text-muted-foreground ml-auto text-xs tracking-widest",
className
@@ -163,6 +138,7 @@ function CommandShortcut({
/>
)
}
+CommandShortcut.displayName = "CommandShortcut"
export {
Command,
diff --git a/apps/www/components/ui/context-menu.tsx b/apps/www/components/ui/context-menu.tsx
index e29ad05f..eee1e74e 100644
--- a/apps/www/components/ui/context-menu.tsx
+++ b/apps/www/components/ui/context-menu.tsx
@@ -2,228 +2,175 @@
import * as React from "react"
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
-import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"
+import { Check, ChevronRight, Circle } from "lucide-react"
import { cn } from "@/lib/utils"
-function ContextMenu({
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.Root>) {
- return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />
-}
-
-function ContextMenuTrigger({
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>) {
- return (
- <ContextMenuPrimitive.Trigger data-slot="context-menu-trigger" {...props} />
- )
-}
-
-function ContextMenuGroup({
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.Group>) {
- return (
- <ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />
- )
-}
-
-function ContextMenuPortal({
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) {
- return (
- <ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} />
- )
-}
-
-function ContextMenuSub({
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.Sub>) {
- return <ContextMenuPrimitive.Sub data-slot="context-menu-sub" {...props} />
-}
-
-function ContextMenuRadioGroup({
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>) {
- return (
- <ContextMenuPrimitive.RadioGroup
- data-slot="context-menu-radio-group"
- {...props}
- />
- )
-}
-
-function ContextMenuSubTrigger({
- className,
- inset,
- children,
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & {
- inset?: boolean
-}) {
- return (
- <ContextMenuPrimitive.SubTrigger
- data-slot="context-menu-sub-trigger"
- data-inset={inset}
- className={cn(
- "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- className
- )}
- {...props}
- >
- {children}
- <ChevronRightIcon className="ml-auto" />
- </ContextMenuPrimitive.SubTrigger>
- )
-}
-
-function ContextMenuSubContent({
- className,
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>) {
- return (
- <ContextMenuPrimitive.SubContent
- data-slot="context-menu-sub-content"
- className={cn(
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
- className
- )}
- {...props}
- />
- )
-}
-
-function ContextMenuContent({
- className,
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.Content>) {
- return (
- <ContextMenuPrimitive.Portal>
- <ContextMenuPrimitive.Content
- data-slot="context-menu-content"
- className={cn(
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
- className
- )}
- {...props}
- />
- </ContextMenuPrimitive.Portal>
- )
-}
-
-function ContextMenuItem({
- className,
- inset,
- variant = "default",
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {
- inset?: boolean
- variant?: "default" | "destructive"
-}) {
- return (
- <ContextMenuPrimitive.Item
- data-slot="context-menu-item"
- data-inset={inset}
- data-variant={variant}
- className={cn(
- "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- className
- )}
- {...props}
- />
- )
-}
-
-function ContextMenuCheckboxItem({
- className,
- children,
- checked,
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>) {
- return (
- <ContextMenuPrimitive.CheckboxItem
- data-slot="context-menu-checkbox-item"
- className={cn(
- "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- className
- )}
- checked={checked}
- {...props}
- >
- <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
- <ContextMenuPrimitive.ItemIndicator>
- <CheckIcon className="size-4" />
- </ContextMenuPrimitive.ItemIndicator>
- </span>
- {children}
- </ContextMenuPrimitive.CheckboxItem>
- )
-}
-
-function ContextMenuRadioItem({
- className,
- children,
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem>) {
- return (
- <ContextMenuPrimitive.RadioItem
- data-slot="context-menu-radio-item"
+const ContextMenu = ContextMenuPrimitive.Root
+
+const ContextMenuTrigger = ContextMenuPrimitive.Trigger
+
+const ContextMenuGroup = ContextMenuPrimitive.Group
+
+const ContextMenuPortal = ContextMenuPrimitive.Portal
+
+const ContextMenuSub = ContextMenuPrimitive.Sub
+
+const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup
+
+const ContextMenuSubTrigger = React.forwardRef<
+ React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
+ inset?: boolean
+ }
+>(({ className, inset, children, ...props }, ref) => (
+ <ContextMenuPrimitive.SubTrigger
+ ref={ref}
+ className={cn(
+ "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-none select-none",
+ inset && "pl-8",
+ className
+ )}
+ {...props}
+ >
+ {children}
+ <ChevronRight className="ml-auto h-4 w-4" />
+ </ContextMenuPrimitive.SubTrigger>
+))
+ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName
+
+const ContextMenuSubContent = React.forwardRef<
+ React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
+>(({ className, ...props }, ref) => (
+ <ContextMenuPrimitive.SubContent
+ ref={ref}
+ className={cn(
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-[--radix-context-menu-content-transform-origin] overflow-hidden rounded-md border p-1 shadow-lg",
+ className
+ )}
+ {...props}
+ />
+))
+ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName
+
+const ContextMenuContent = React.forwardRef<
+ React.ElementRef<typeof ContextMenuPrimitive.Content>,
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
+>(({ className, ...props }, ref) => (
+ <ContextMenuPrimitive.Portal>
+ <ContextMenuPrimitive.Content
+ ref={ref}
className={cn(
- "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] origin-[--radix-context-menu-content-transform-origin] overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
className
)}
{...props}
- >
- <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
- <ContextMenuPrimitive.ItemIndicator>
- <CircleIcon className="size-2 fill-current" />
- </ContextMenuPrimitive.ItemIndicator>
- </span>
- {children}
- </ContextMenuPrimitive.RadioItem>
- )
-}
-
-function ContextMenuLabel({
- className,
- inset,
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.Label> & {
- inset?: boolean
-}) {
- return (
- <ContextMenuPrimitive.Label
- data-slot="context-menu-label"
- data-inset={inset}
- className={cn(
- "text-foreground px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
- className
- )}
- {...props}
- />
- )
-}
-
-function ContextMenuSeparator({
- className,
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.Separator>) {
- return (
- <ContextMenuPrimitive.Separator
- data-slot="context-menu-separator"
- className={cn("bg-border -mx-1 my-1 h-px", className)}
- {...props}
/>
- )
-}
-
-function ContextMenuShortcut({
+ </ContextMenuPrimitive.Portal>
+))
+ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName
+
+const ContextMenuItem = React.forwardRef<
+ React.ElementRef<typeof ContextMenuPrimitive.Item>,
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
+ inset?: boolean
+ }
+>(({ className, inset, ...props }, ref) => (
+ <ContextMenuPrimitive.Item
+ ref={ref}
+ className={cn(
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
+ inset && "pl-8",
+ className
+ )}
+ {...props}
+ />
+))
+ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName
+
+const ContextMenuCheckboxItem = React.forwardRef<
+ React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
+>(({ className, children, checked, ...props }, ref) => (
+ <ContextMenuPrimitive.CheckboxItem
+ ref={ref}
+ className={cn(
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
+ className
+ )}
+ checked={checked}
+ {...props}
+ >
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
+ <ContextMenuPrimitive.ItemIndicator>
+ <Check className="h-4 w-4" />
+ </ContextMenuPrimitive.ItemIndicator>
+ </span>
+ {children}
+ </ContextMenuPrimitive.CheckboxItem>
+))
+ContextMenuCheckboxItem.displayName =
+ ContextMenuPrimitive.CheckboxItem.displayName
+
+const ContextMenuRadioItem = React.forwardRef<
+ React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
+>(({ className, children, ...props }, ref) => (
+ <ContextMenuPrimitive.RadioItem
+ ref={ref}
+ className={cn(
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
+ className
+ )}
+ {...props}
+ >
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
+ <ContextMenuPrimitive.ItemIndicator>
+ <Circle className="h-4 w-4 fill-current" />
+ </ContextMenuPrimitive.ItemIndicator>
+ </span>
+ {children}
+ </ContextMenuPrimitive.RadioItem>
+))
+ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName
+
+const ContextMenuLabel = React.forwardRef<
+ React.ElementRef<typeof ContextMenuPrimitive.Label>,
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
+ inset?: boolean
+ }
+>(({ className, inset, ...props }, ref) => (
+ <ContextMenuPrimitive.Label
+ ref={ref}
+ className={cn(
+ "text-foreground px-2 py-1.5 text-sm font-semibold",
+ inset && "pl-8",
+ className
+ )}
+ {...props}
+ />
+))
+ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName
+
+const ContextMenuSeparator = React.forwardRef<
+ React.ElementRef<typeof ContextMenuPrimitive.Separator>,
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
+>(({ className, ...props }, ref) => (
+ <ContextMenuPrimitive.Separator
+ ref={ref}
+ className={cn("bg-border -mx-1 my-1 h-px", className)}
+ {...props}
+ />
+))
+ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName
+
+const ContextMenuShortcut = ({
className,
...props
-}: React.ComponentProps<"span">) {
+}: React.HTMLAttributes<HTMLSpanElement>) => {
return (
<span
- data-slot="context-menu-shortcut"
className={cn(
"text-muted-foreground ml-auto text-xs tracking-widest",
className
@@ -232,6 +179,7 @@ function ContextMenuShortcut({
/>
)
}
+ContextMenuShortcut.displayName = "ContextMenuShortcut"
export {
ContextMenu,
diff --git a/apps/www/components/ui/form.tsx b/apps/www/components/ui/form.tsx
index 524b986b..c25f2c7e 100644
--- a/apps/www/components/ui/form.tsx
+++ b/apps/www/components/ui/form.tsx
@@ -7,7 +7,6 @@ import {
Controller,
FormProvider,
useFormContext,
- useFormState,
type ControllerProps,
type FieldPath,
type FieldValues,
@@ -45,8 +44,8 @@ const FormField = <
const useFormField = () => {
const fieldContext = React.useContext(FormFieldContext)
const itemContext = React.useContext(FormItemContext)
- const { getFieldState } = useFormContext()
- const formState = useFormState({ name: fieldContext.name })
+ const { getFieldState, formState } = useFormContext()
+
const fieldState = getFieldState(fieldContext.name, formState)
if (!fieldContext) {
@@ -73,43 +72,46 @@ const FormItemContext = React.createContext<FormItemContextValue>(
{} as FormItemContextValue
)
-function FormItem({ className, ...props }: React.ComponentProps<"div">) {
+const FormItem = React.forwardRef<
+ HTMLDivElement,
+ React.HTMLAttributes<HTMLDivElement>
+>(({ className, ...props }, ref) => {
const id = React.useId()
return (
<FormItemContext.Provider value={{ id }}>
- <div
- data-slot="form-item"
- className={cn("grid gap-2", className)}
- {...props}
- />
+ <div ref={ref} className={cn("space-y-2", className)} {...props} />
</FormItemContext.Provider>
)
-}
+})
+FormItem.displayName = "FormItem"
-function FormLabel({
- className,
- ...props
-}: React.ComponentProps<typeof LabelPrimitive.Root>) {
+const FormLabel = React.forwardRef<
+ React.ElementRef<typeof LabelPrimitive.Root>,
+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
+>(({ className, ...props }, ref) => {
const { error, formItemId } = useFormField()
return (
<Label
- data-slot="form-label"
- data-error={!!error}
- className={cn("data-[error=true]:text-destructive", className)}
+ ref={ref}
+ className={cn(error && "text-destructive", className)}
htmlFor={formItemId}
{...props}
/>
)
-}
+})
+FormLabel.displayName = "FormLabel"
-function FormControl({ ...props }: React.ComponentProps<typeof Slot>) {
+const FormControl = React.forwardRef<
+ React.ElementRef<typeof Slot>,
+ React.ComponentPropsWithoutRef<typeof Slot>
+>(({ ...props }, ref) => {
const { error, formItemId, formDescriptionId, formMessageId } = useFormField()
return (
<Slot
- data-slot="form-control"
+ ref={ref}
id={formItemId}
aria-describedby={
!error
@@ -120,24 +122,32 @@ function FormControl({ ...props }: React.ComponentProps<typeof Slot>) {
{...props}
/>
)
-}
+})
+FormControl.displayName = "FormControl"
-function FormDescription({ className, ...props }: React.ComponentProps<"p">) {
+const FormDescription = React.forwardRef<
+ HTMLParagraphElement,
+ React.HTMLAttributes<HTMLParagraphElement>
+>(({ className, ...props }, ref) => {
const { formDescriptionId } = useFormField()
return (
<p
- data-slot="form-description"
+ ref={ref}
id={formDescriptionId}
- className={cn("text-muted-foreground text-sm", className)}
+ className={cn("text-muted-foreground text-[0.8rem]", className)}
{...props}
/>
)
-}
+})
+FormDescription.displayName = "FormDescription"
-function FormMessage({ className, ...props }: React.ComponentProps<"p">) {
+const FormMessage = React.forwardRef<
+ HTMLParagraphElement,
+ React.HTMLAttributes<HTMLParagraphElement>
+>(({ className, children, ...props }, ref) => {
const { error, formMessageId } = useFormField()
- const body = error ? String(error?.message ?? "") : props.children
+ const body = error ? String(error?.message ?? "") : children
if (!body) {
return null
@@ -145,15 +155,16 @@ function FormMessage({ className, ...props }: React.ComponentProps<"p">) {
return (
<p
- data-slot="form-message"
+ ref={ref}
id={formMessageId}
- className={cn("text-destructive text-sm", className)}
+ className={cn("text-destructive text-[0.8rem] font-medium", className)}
{...props}
>
{body}
</p>
)
-}
+})
+FormMessage.displayName = "FormMessage"
export {
useFormField,
diff --git a/apps/www/components/ui/hover-card.tsx b/apps/www/components/ui/hover-card.tsx
deleted file mode 100644
index e7541864..00000000
--- a/apps/www/components/ui/hover-card.tsx
+++ /dev/null
@@ -1,44 +0,0 @@
-"use client"
-
-import * as React from "react"
-import * as HoverCardPrimitive from "@radix-ui/react-hover-card"
-
-import { cn } from "@/lib/utils"
-
-function HoverCard({
- ...props
-}: React.ComponentProps<typeof HoverCardPrimitive.Root>) {
- return <HoverCardPrimitive.Root data-slot="hover-card" {...props} />
-}
-
-function HoverCardTrigger({
- ...props
-}: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {
- return (
- <HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />
- )
-}
-
-function HoverCardContent({
- className,
- align = "center",
- sideOffset = 4,
- ...props
-}: React.ComponentProps<typeof HoverCardPrimitive.Content>) {
- return (
- <HoverCardPrimitive.Portal data-slot="hover-card-portal">
- <HoverCardPrimitive.Content
- data-slot="hover-card-content"
- align={align}
- sideOffset={sideOffset}
- className={cn(
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
- className
- )}
- {...props}
- />
- </HoverCardPrimitive.Portal>
- )
-}
-
-export { HoverCard, HoverCardTrigger, HoverCardContent }
diff --git a/apps/www/components/ui/input.tsx b/apps/www/components/ui/input.tsx
index 03295ca6..aee4bf8a 100644
--- a/apps/www/components/ui/input.tsx
+++ b/apps/www/components/ui/input.tsx
@@ -2,20 +2,21 @@ import * as React from "react"
import { cn } from "@/lib/utils"
-function Input({ className, type, ...props }: React.ComponentProps<"input">) {
- return (
- <input
- type={type}
- data-slot="input"
- className={cn(
- "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
- "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
- "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
- className
- )}
- {...props}
- />
- )
-}
+const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<"input">>(
+ ({ className, type, ...props }, ref) => {
+ return (
+ <input
+ type={type}
+ className={cn(
+ "border-input file:text-foreground placeholder:text-muted-foreground focus-visible:ring-ring flex h-9 w-full rounded-md border bg-transparent px-3 py-1 text-base transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-1 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
+ className
+ )}
+ ref={ref}
+ {...props}
+ />
+ )
+ }
+)
+Input.displayName = "Input"
export { Input }
diff --git a/apps/www/components/ui/label.tsx b/apps/www/components/ui/label.tsx
index fb5fbc3e..53418217 100644
--- a/apps/www/components/ui/label.tsx
+++ b/apps/www/components/ui/label.tsx
@@ -2,23 +2,25 @@
import * as React from "react"
import * as LabelPrimitive from "@radix-ui/react-label"
+import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
-function Label({
- className,
- ...props
-}: React.ComponentProps<typeof LabelPrimitive.Root>) {
- return (
- <LabelPrimitive.Root
- data-slot="label"
- className={cn(
- "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
- className
- )}
- {...props}
- />
- )
-}
+const labelVariants = cva(
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
+)
+
+const Label = React.forwardRef<
+ React.ElementRef<typeof LabelPrimitive.Root>,
+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
+ VariantProps<typeof labelVariants>
+>(({ className, ...props }, ref) => (
+ <LabelPrimitive.Root
+ ref={ref}
+ className={cn(labelVariants(), className)}
+ {...props}
+ />
+))
+Label.displayName = LabelPrimitive.Root.displayName
export { Label }
diff --git a/apps/www/components/ui/popover.tsx b/apps/www/components/ui/popover.tsx
index 01e468b6..89731cbb 100644
--- a/apps/www/components/ui/popover.tsx
+++ b/apps/www/components/ui/popover.tsx
@@ -5,44 +5,29 @@ import * as PopoverPrimitive from "@radix-ui/react-popover"
import { cn } from "@/lib/utils"
-function Popover({
- ...props
-}: React.ComponentProps<typeof PopoverPrimitive.Root>) {
- return <PopoverPrimitive.Root data-slot="popover" {...props} />
-}
+const Popover = PopoverPrimitive.Root
-function PopoverTrigger({
- ...props
-}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
- return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />
-}
+const PopoverTrigger = PopoverPrimitive.Trigger
-function PopoverContent({
- className,
- align = "center",
- sideOffset = 4,
- ...props
-}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
- return (
- <PopoverPrimitive.Portal>
- <PopoverPrimitive.Content
- data-slot="popover-content"
- align={align}
- sideOffset={sideOffset}
- className={cn(
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
- className
- )}
- {...props}
- />
- </PopoverPrimitive.Portal>
- )
-}
+const PopoverAnchor = PopoverPrimitive.Anchor
-function PopoverAnchor({
- ...props
-}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
- return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />
-}
+const PopoverContent = React.forwardRef<
+ React.ElementRef<typeof PopoverPrimitive.Content>,
+ React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
+>(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
+ <PopoverPrimitive.Portal>
+ <PopoverPrimitive.Content
+ ref={ref}
+ align={align}
+ sideOffset={sideOffset}
+ className={cn(
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-[--radix-popover-content-transform-origin] rounded-md border p-4 shadow-md outline-none",
+ className
+ )}
+ {...props}
+ />
+ </PopoverPrimitive.Portal>
+))
+PopoverContent.displayName = PopoverPrimitive.Content.displayName
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }
diff --git a/apps/www/components/ui/scroll-area.tsx b/apps/www/components/ui/scroll-area.tsx
index 8e4fa13f..46ec8098 100644
--- a/apps/www/components/ui/scroll-area.tsx
+++ b/apps/www/components/ui/scroll-area.tsx
@@ -5,54 +5,44 @@ import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"
import { cn } from "@/lib/utils"
-function ScrollArea({
- className,
- children,
- ...props
-}: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
- return (
- <ScrollAreaPrimitive.Root
- data-slot="scroll-area"
- className={cn("relative", className)}
- {...props}
- >
- <ScrollAreaPrimitive.Viewport
- data-slot="scroll-area-viewport"
- className="focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1"
- >
- {children}
- </ScrollAreaPrimitive.Viewport>
- <ScrollBar />
- <ScrollAreaPrimitive.Corner />
- </ScrollAreaPrimitive.Root>
- )
-}
+const ScrollArea = React.forwardRef<
+ React.ElementRef<typeof ScrollAreaPrimitive.Root>,
+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
+>(({ className, children, ...props }, ref) => (
+ <ScrollAreaPrimitive.Root
+ ref={ref}
+ className={cn("relative overflow-hidden", className)}
+ {...props}
+ >
+ <ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">
+ {children}
+ </ScrollAreaPrimitive.Viewport>
+ <ScrollBar />
+ <ScrollAreaPrimitive.Corner />
+ </ScrollAreaPrimitive.Root>
+))
+ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName
-function ScrollBar({
- className,
- orientation = "vertical",
- ...props
-}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
- return (
- <ScrollAreaPrimitive.ScrollAreaScrollbar
- data-slot="scroll-area-scrollbar"
- orientation={orientation}
- className={cn(
- "flex touch-none p-px transition-colors select-none",
- orientation === "vertical" &&
- "h-full w-2.5 border-l border-l-transparent",
- orientation === "horizontal" &&
- "h-2.5 flex-col border-t border-t-transparent",
- className
- )}
- {...props}
- >
- <ScrollAreaPrimitive.ScrollAreaThumb
- data-slot="scroll-area-thumb"
- className="bg-border relative flex-1 rounded-full"
- />
- </ScrollAreaPrimitive.ScrollAreaScrollbar>
- )
-}
+const ScrollBar = React.forwardRef<
+ React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
+>(({ className, orientation = "vertical", ...props }, ref) => (
+ <ScrollAreaPrimitive.ScrollAreaScrollbar
+ ref={ref}
+ orientation={orientation}
+ className={cn(
+ "flex touch-none transition-colors select-none",
+ orientation === "vertical" &&
+ "h-full w-2.5 border-l border-l-transparent p-[1px]",
+ orientation === "horizontal" &&
+ "h-2.5 flex-col border-t border-t-transparent p-[1px]",
+ className
+ )}
+ {...props}
+ >
+ <ScrollAreaPrimitive.ScrollAreaThumb className="bg-border relative flex-1 rounded-full" />
+ </ScrollAreaPrimitive.ScrollAreaScrollbar>
+))
+ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName
export { ScrollArea, ScrollBar }
diff --git a/apps/www/components/ui/select.tsx b/apps/www/components/ui/select.tsx
index 0204cb40..8faff85f 100644
--- a/apps/www/components/ui/select.tsx
+++ b/apps/www/components/ui/select.tsx
@@ -2,176 +2,148 @@
import * as React from "react"
import * as SelectPrimitive from "@radix-ui/react-select"
-import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react"
+import { Check, ChevronDown, ChevronUp } from "lucide-react"
import { cn } from "@/lib/utils"
-function Select({
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.Root>) {
- return <SelectPrimitive.Root data-slot="select" {...props} />
-}
+const Select = SelectPrimitive.Root
-function SelectGroup({
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.Group>) {
- return <SelectPrimitive.Group data-slot="select-group" {...props} />
-}
+const SelectGroup = SelectPrimitive.Group
-function SelectValue({
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.Value>) {
- return <SelectPrimitive.Value data-slot="select-value" {...props} />
-}
+const SelectValue = SelectPrimitive.Value
+
+const SelectTrigger = React.forwardRef<
+ React.ElementRef<typeof SelectPrimitive.Trigger>,
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
+>(({ className, children, ...props }, ref) => (
+ <SelectPrimitive.Trigger
+ ref={ref}
+ className={cn(
+ "border-input ring-offset-background data-[placeholder]:text-muted-foreground focus:ring-ring flex h-9 w-full items-center justify-between rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap focus:ring-1 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
+ className
+ )}
+ {...props}
+ >
+ {children}
+ <SelectPrimitive.Icon asChild>
+ <ChevronDown className="h-4 w-4 opacity-50" />
+ </SelectPrimitive.Icon>
+ </SelectPrimitive.Trigger>
+))
+SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
+
+const SelectScrollUpButton = React.forwardRef<
+ React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
+>(({ className, ...props }, ref) => (
+ <SelectPrimitive.ScrollUpButton
+ ref={ref}
+ className={cn(
+ "flex cursor-default items-center justify-center py-1",
+ className
+ )}
+ {...props}
+ >
+ <ChevronUp className="h-4 w-4" />
+ </SelectPrimitive.ScrollUpButton>
+))
+SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
-function SelectTrigger({
- className,
- size = "default",
- children,
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
- size?: "sm" | "default"
-}) {
- return (
- <SelectPrimitive.Trigger
- data-slot="select-trigger"
- data-size={size}
+const SelectScrollDownButton = React.forwardRef<
+ React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
+>(({ className, ...props }, ref) => (
+ <SelectPrimitive.ScrollDownButton
+ ref={ref}
+ className={cn(
+ "flex cursor-default items-center justify-center py-1",
+ className
+ )}
+ {...props}
+ >
+ <ChevronDown className="h-4 w-4" />
+ </SelectPrimitive.ScrollDownButton>
+))
+SelectScrollDownButton.displayName =
+ SelectPrimitive.ScrollDownButton.displayName
+
+const SelectContent = React.forwardRef<
+ React.ElementRef<typeof SelectPrimitive.Content>,
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
+>(({ className, children, position = "popper", ...props }, ref) => (
+ <SelectPrimitive.Portal>
+ <SelectPrimitive.Content
+ ref={ref}
className={cn(
- "border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] origin-[--radix-select-content-transform-origin] overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
+ position === "popper" &&
+ "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
className
)}
+ position={position}
{...props}
>
- {children}
- <SelectPrimitive.Icon asChild>
- <div className="select-icon flex items-center justify-center">
- <ChevronDownIcon className="size-4 opacity-50" />
- </div>
- </SelectPrimitive.Icon>
- </SelectPrimitive.Trigger>
- )
-}
-
-function SelectContent({
- className,
- children,
- position = "popper",
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.Content>) {
- return (
- <SelectPrimitive.Portal>
- <SelectPrimitive.Content
- data-slot="select-content"
+ <SelectScrollUpButton />
+ <SelectPrimitive.Viewport
className={cn(
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
+ "p-1",
position === "popper" &&
- "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
- className
+ "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
)}
- position={position}
- {...props}
>
- <SelectScrollUpButton />
- <SelectPrimitive.Viewport
- className={cn(
- "p-1",
- position === "popper" &&
- "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
- )}
- >
- {children}
- </SelectPrimitive.Viewport>
- <SelectScrollDownButton />
- </SelectPrimitive.Content>
- </SelectPrimitive.Portal>
- )
-}
+ {children}
+ </SelectPrimitive.Viewport>
+ <SelectScrollDownButton />
+ </SelectPrimitive.Content>
+ </SelectPrimitive.Portal>
+))
+SelectContent.displayName = SelectPrimitive.Content.displayName
-function SelectLabel({
- className,
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.Label>) {
- return (
- <SelectPrimitive.Label
- data-slot="select-label"
- className={cn("text-muted-foreground px-2 py-1.5 text-xs", className)}
- {...props}
- />
- )
-}
+const SelectLabel = React.forwardRef<
+ React.ElementRef<typeof SelectPrimitive.Label>,
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
+>(({ className, ...props }, ref) => (
+ <SelectPrimitive.Label
+ ref={ref}
+ className={cn("px-2 py-1.5 text-sm font-semibold", className)}
+ {...props}
+ />
+))
+SelectLabel.displayName = SelectPrimitive.Label.displayName
-function SelectItem({
- className,
- children,
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.Item>) {
- return (
- <SelectPrimitive.Item
- data-slot="select-item"
- className={cn(
- "focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
- className
- )}
- {...props}
- >
- <span className="absolute right-2 flex size-3.5 items-center justify-center">
- <SelectPrimitive.ItemIndicator>
- <CheckIcon className="size-4" />
- </SelectPrimitive.ItemIndicator>
- </span>
- <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
- </SelectPrimitive.Item>
- )
-}
+const SelectItem = React.forwardRef<
+ React.ElementRef<typeof SelectPrimitive.Item>,
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
+>(({ className, children, ...props }, ref) => (
+ <SelectPrimitive.Item
+ ref={ref}
+ className={cn(
+ "focus:bg-accent focus:text-accent-foreground relative flex w-full cursor-default items-center rounded-sm py-1.5 pr-8 pl-2 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
+ className
+ )}
+ {...props}
+ >
+ <span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
+ <SelectPrimitive.ItemIndicator>
+ <Check className="h-4 w-4" />
+ </SelectPrimitive.ItemIndicator>
+ </span>
+ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
+ </SelectPrimitive.Item>
+))
+SelectItem.displayName = SelectPrimitive.Item.displayName
-function SelectSeparator({
- className,
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
- return (
- <SelectPrimitive.Separator
- data-slot="select-separator"
- className={cn("bg-border pointer-events-none -mx-1 my-1 h-px", className)}
- {...props}
- />
- )
-}
-
-function SelectScrollUpButton({
- className,
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
- return (
- <SelectPrimitive.ScrollUpButton
- data-slot="select-scroll-up-button"
- className={cn(
- "flex cursor-default items-center justify-center py-1",
- className
- )}
- {...props}
- >
- <ChevronUpIcon className="size-4" />
- </SelectPrimitive.ScrollUpButton>
- )
-}
-
-function SelectScrollDownButton({
- className,
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
- return (
- <SelectPrimitive.ScrollDownButton
- data-slot="select-scroll-down-button"
- className={cn(
- "flex cursor-default items-center justify-center py-1",
- className
- )}
- {...props}
- >
- <ChevronDownIcon className="size-4" />
- </SelectPrimitive.ScrollDownButton>
- )
-}
+const SelectSeparator = React.forwardRef<
+ React.ElementRef<typeof SelectPrimitive.Separator>,
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
+>(({ className, ...props }, ref) => (
+ <SelectPrimitive.Separator
+ ref={ref}
+ className={cn("bg-muted -mx-1 my-1 h-px", className)}
+ {...props}
+ />
+))
+SelectSeparator.displayName = SelectPrimitive.Separator.displayName
export {
Select,
diff --git a/apps/www/components/ui/separator.tsx b/apps/www/components/ui/separator.tsx
index 275381ca..13d1b380 100644
--- a/apps/www/components/ui/separator.tsx
+++ b/apps/www/components/ui/separator.tsx
@@ -5,24 +5,27 @@ import * as SeparatorPrimitive from "@radix-ui/react-separator"
import { cn } from "@/lib/utils"
-function Separator({
- className,
- orientation = "horizontal",
- decorative = true,
- ...props
-}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
- return (
+const Separator = React.forwardRef<
+ React.ElementRef<typeof SeparatorPrimitive.Root>,
+ React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
+>(
+ (
+ { className, orientation = "horizontal", decorative = true, ...props },
+ ref
+ ) => (
<SeparatorPrimitive.Root
- data-slot="separator"
+ ref={ref}
decorative={decorative}
orientation={orientation}
className={cn(
- "bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
+ "bg-border shrink-0",
+ orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
className
)}
{...props}
/>
)
-}
+)
+Separator.displayName = SeparatorPrimitive.Root.displayName
export { Separator }
diff --git a/apps/www/components/ui/sheet.tsx b/apps/www/components/ui/sheet.tsx
index 84649ad0..5b0043bb 100644
--- a/apps/www/components/ui/sheet.tsx
+++ b/apps/www/components/ui/sheet.tsx
@@ -2,133 +2,134 @@
import * as React from "react"
import * as SheetPrimitive from "@radix-ui/react-dialog"
-import { XIcon } from "lucide-react"
+import { cva, type VariantProps } from "class-variance-authority"
+import { X } from "lucide-react"
import { cn } from "@/lib/utils"
-function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
- return <SheetPrimitive.Root data-slot="sheet" {...props} />
-}
+const Sheet = SheetPrimitive.Root
-function SheetTrigger({
- ...props
-}: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
- return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />
-}
+const SheetTrigger = SheetPrimitive.Trigger
-function SheetClose({
- ...props
-}: React.ComponentProps<typeof SheetPrimitive.Close>) {
- return <SheetPrimitive.Close data-slot="sheet-close" {...props} />
-}
+const SheetClose = SheetPrimitive.Close
-function SheetPortal({
- ...props
-}: React.ComponentProps<typeof SheetPrimitive.Portal>) {
- return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />
-}
+const SheetPortal = SheetPrimitive.Portal
-function SheetOverlay({
- className,
- ...props
-}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
- return (
- <SheetPrimitive.Overlay
- data-slot="sheet-overlay"
- className={cn(
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
- className
- )}
- {...props}
- />
- )
-}
+const SheetOverlay = React.forwardRef<
+ React.ElementRef<typeof SheetPrimitive.Overlay>,
+ React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>
+>(({ className, ...props }, ref) => (
+ <SheetPrimitive.Overlay
+ className={cn(
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80",
+ className
+ )}
+ {...props}
+ ref={ref}
+ />
+))
+SheetOverlay.displayName = SheetPrimitive.Overlay.displayName
-function SheetContent({
- className,
- children,
- side = "right",
- ...props
-}: React.ComponentProps<typeof SheetPrimitive.Content> & {
- side?: "top" | "right" | "bottom" | "left"
-}) {
- return (
- <SheetPortal>
- <SheetOverlay />
- <SheetPrimitive.Content
- data-slot="sheet-content"
- className={cn(
- "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
- side === "right" &&
- "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
- side === "left" &&
- "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
- side === "top" &&
- "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
- side === "bottom" &&
- "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
- className
- )}
- {...props}
- >
- {children}
- <SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
- <XIcon className="size-4" />
- <span className="sr-only">Close</span>
- </SheetPrimitive.Close>
- </SheetPrimitive.Content>
- </SheetPortal>
- )
-}
+const sheetVariants = cva(
+ "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",
+ {
+ variants: {
+ side: {
+ top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
+ bottom:
+ "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
+ left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
+ right:
+ "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
+ },
+ },
+ defaultVariants: {
+ side: "right",
+ },
+ }
+)
-function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="sheet-header"
- className={cn("flex flex-col gap-1.5 p-4", className)}
- {...props}
- />
- )
-}
+interface SheetContentProps
+ extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
+ VariantProps<typeof sheetVariants> {}
-function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="sheet-footer"
- className={cn("mt-auto flex flex-col gap-2 p-4", className)}
+const SheetContent = React.forwardRef<
+ React.ElementRef<typeof SheetPrimitive.Content>,
+ SheetContentProps
+>(({ side = "right", className, children, ...props }, ref) => (
+ <SheetPortal>
+ <SheetOverlay />
+ <SheetPrimitive.Content
+ ref={ref}
+ className={cn(sheetVariants({ side }), className)}
{...props}
- />
- )
-}
+ >
+ <SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none">
+ <X className="h-4 w-4" />
+ <span className="sr-only">Close</span>
+ </SheetPrimitive.Close>
+ {children}
+ </SheetPrimitive.Content>
+ </SheetPortal>
+))
+SheetContent.displayName = SheetPrimitive.Content.displayName
-function SheetTitle({
+const SheetHeader = ({
className,
...props
-}: React.ComponentProps<typeof SheetPrimitive.Title>) {
- return (
- <SheetPrimitive.Title
- data-slot="sheet-title"
- className={cn("text-foreground font-semibold", className)}
- {...props}
- />
- )
-}
+}: React.HTMLAttributes<HTMLDivElement>) => (
+ <div
+ className={cn(
+ "flex flex-col space-y-2 text-center sm:text-left",
+ className
+ )}
+ {...props}
+ />
+)
+SheetHeader.displayName = "SheetHeader"
-function SheetDescription({
+const SheetFooter = ({
className,
...props
-}: React.ComponentProps<typeof SheetPrimitive.Description>) {
- return (
- <SheetPrimitive.Description
- data-slot="sheet-description"
- className={cn("text-muted-foreground text-sm", className)}
- {...props}
- />
- )
-}
+}: React.HTMLAttributes<HTMLDivElement>) => (
+ <div
+ className={cn(
+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
+ className
+ )}
+ {...props}
+ />
+)
+SheetFooter.displayName = "SheetFooter"
+
+const SheetTitle = React.forwardRef<
+ React.ElementRef<typeof SheetPrimitive.Title>,
+ React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>
+>(({ className, ...props }, ref) => (
+ <SheetPrimitive.Title
+ ref={ref}
+ className={cn("text-foreground text-lg font-semibold", className)}
+ {...props}
+ />
+))
+SheetTitle.displayName = SheetPrimitive.Title.displayName
+
+const SheetDescription = React.forwardRef<
+ React.ElementRef<typeof SheetPrimitive.Description>,
+ React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>
+>(({ className, ...props }, ref) => (
+ <SheetPrimitive.Description
+ ref={ref}
+ className={cn("text-muted-foreground text-sm", className)}
+ {...props}
+ />
+))
+SheetDescription.displayName = SheetPrimitive.Description.displayName
export {
Sheet,
+ SheetPortal,
+ SheetOverlay,
SheetTrigger,
SheetClose,
SheetContent,
diff --git a/apps/www/components/ui/skeleton.tsx b/apps/www/components/ui/skeleton.tsx
index 32ea0ef7..9ace823a 100644
--- a/apps/www/components/ui/skeleton.tsx
+++ b/apps/www/components/ui/skeleton.tsx
@@ -1,10 +1,12 @@
import { cn } from "@/lib/utils"
-function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
+function Skeleton({
+ className,
+ ...props
+}: React.HTMLAttributes<HTMLDivElement>) {
return (
<div
- data-slot="skeleton"
- className={cn("bg-accent animate-pulse rounded-md", className)}
+ className={cn("bg-primary/10 animate-pulse rounded-md", className)}
{...props}
/>
)
diff --git a/apps/www/components/ui/sonner.tsx b/apps/www/components/ui/sonner.tsx
index 957524ed..452f4d9f 100644
--- a/apps/www/components/ui/sonner.tsx
+++ b/apps/www/components/ui/sonner.tsx
@@ -1,7 +1,9 @@
"use client"
import { useTheme } from "next-themes"
-import { Toaster as Sonner, ToasterProps } from "sonner"
+import { Toaster as Sonner } from "sonner"
+
+type ToasterProps = React.ComponentProps<typeof Sonner>
const Toaster = ({ ...props }: ToasterProps) => {
const { theme = "system" } = useTheme()
@@ -10,13 +12,17 @@ const Toaster = ({ ...props }: ToasterProps) => {
<Sonner
theme={theme as ToasterProps["theme"]}
className="toaster group"
- style={
- {
- "--normal-bg": "var(--popover)",
- "--normal-text": "var(--popover-foreground)",
- "--normal-border": "var(--border)",
- } as React.CSSProperties
- }
+ toastOptions={{
+ classNames: {
+ toast:
+ "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
+ description: "group-[.toast]:text-muted-foreground",
+ actionButton:
+ "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
+ cancelButton:
+ "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
+ },
+ }}
{...props}
/>
)
diff --git a/apps/www/components/ui/switch.tsx b/apps/www/components/ui/switch.tsx
index 6a2b5241..36e6d24b 100644
--- a/apps/www/components/ui/switch.tsx
+++ b/apps/www/components/ui/switch.tsx
@@ -1,31 +1,29 @@
"use client"
import * as React from "react"
-import * as SwitchPrimitive from "@radix-ui/react-switch"
+import * as SwitchPrimitives from "@radix-ui/react-switch"
import { cn } from "@/lib/utils"
-function Switch({
- className,
- ...props
-}: React.ComponentProps<typeof SwitchPrimitive.Root>) {
- return (
- <SwitchPrimitive.Root
- data-slot="switch"
+const Switch = React.forwardRef<
+ React.ElementRef<typeof SwitchPrimitives.Root>,
+ React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
+>(({ className, ...props }, ref) => (
+ <SwitchPrimitives.Root
+ className={cn(
+ "peer focus-visible:ring-ring focus-visible:ring-offset-background data-[state=checked]:bg-primary data-[state=unchecked]:bg-input inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
+ className
+ )}
+ {...props}
+ ref={ref}
+ >
+ <SwitchPrimitives.Thumb
className={cn(
- "peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
- className
+ "bg-background pointer-events-none block h-4 w-4 rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
)}
- {...props}
- >
- <SwitchPrimitive.Thumb
- data-slot="switch-thumb"
- className={cn(
- "bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"
- )}
- />
- </SwitchPrimitive.Root>
- )
-}
+ />
+ </SwitchPrimitives.Root>
+))
+Switch.displayName = SwitchPrimitives.Root.displayName
export { Switch }
diff --git a/apps/www/components/ui/table.tsx b/apps/www/components/ui/table.tsx
index 51b74dd5..f0835704 100644
--- a/apps/www/components/ui/table.tsx
+++ b/apps/www/components/ui/table.tsx
@@ -1,108 +1,112 @@
-"use client"
-
import * as React from "react"
import { cn } from "@/lib/utils"
-function Table({ className, ...props }: React.ComponentProps<"table">) {
- return (
- <div
- data-slot="table-container"
- className="relative w-full overflow-x-auto"
- >
- <table
- data-slot="table"
- className={cn("w-full caption-bottom text-sm", className)}
- {...props}
- />
- </div>
- )
-}
-
-function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
- return (
- <thead
- data-slot="table-header"
- className={cn("[&_tr]:border-b", className)}
+const Table = React.forwardRef<
+ HTMLTableElement,
+ React.HTMLAttributes<HTMLTableElement>
+>(({ className, ...props }, ref) => (
+ <div className="relative w-full overflow-auto">
+ <table
+ ref={ref}
+ className={cn("w-full caption-bottom text-sm", className)}
{...props}
/>
- )
-}
+ </div>
+))
+Table.displayName = "Table"
-function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
- return (
- <tbody
- data-slot="table-body"
- className={cn("[&_tr:last-child]:border-0", className)}
- {...props}
- />
- )
-}
+const TableHeader = React.forwardRef<
+ HTMLTableSectionElement,
+ React.HTMLAttributes<HTMLTableSectionElement>
+>(({ className, ...props }, ref) => (
+ <thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />
+))
+TableHeader.displayName = "TableHeader"
-function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
- return (
- <tfoot
- data-slot="table-footer"
- className={cn(
- "bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",
- className
- )}
- {...props}
- />
- )
-}
+const TableBody = React.forwardRef<
+ HTMLTableSectionElement,
+ React.HTMLAttributes<HTMLTableSectionElement>
+>(({ className, ...props }, ref) => (
+ <tbody
+ ref={ref}
+ className={cn("[&_tr:last-child]:border-0", className)}
+ {...props}
+ />
+))
+TableBody.displayName = "TableBody"
-function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
- return (
- <tr
- data-slot="table-row"
- className={cn(
- "hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
- className
- )}
- {...props}
- />
- )
-}
+const TableFooter = React.forwardRef<
+ HTMLTableSectionElement,
+ React.HTMLAttributes<HTMLTableSectionElement>
+>(({ className, ...props }, ref) => (
+ <tfoot
+ ref={ref}
+ className={cn(
+ "bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",
+ className
+ )}
+ {...props}
+ />
+))
+TableFooter.displayName = "TableFooter"
-function TableHead({ className, ...props }: React.ComponentProps<"th">) {
- return (
- <th
- data-slot="table-head"
- className={cn(
- "text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
- className
- )}
- {...props}
- />
- )
-}
+const TableRow = React.forwardRef<
+ HTMLTableRowElement,
+ React.HTMLAttributes<HTMLTableRowElement>
+>(({ className, ...props }, ref) => (
+ <tr
+ ref={ref}
+ className={cn(
+ "hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
+ className
+ )}
+ {...props}
+ />
+))
+TableRow.displayName = "TableRow"
-function TableCell({ className, ...props }: React.ComponentProps<"td">) {
- return (
- <td
- data-slot="table-cell"
- className={cn(
- "p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
- className
- )}
- {...props}
- />
- )
-}
+const TableHead = React.forwardRef<
+ HTMLTableCellElement,
+ React.ThHTMLAttributes<HTMLTableCellElement>
+>(({ className, ...props }, ref) => (
+ <th
+ ref={ref}
+ className={cn(
+ "text-muted-foreground h-10 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
+ className
+ )}
+ {...props}
+ />
+))
+TableHead.displayName = "TableHead"
-function TableCaption({
- className,
- ...props
-}: React.ComponentProps<"caption">) {
- return (
- <caption
- data-slot="table-caption"
- className={cn("text-muted-foreground mt-4 text-sm", className)}
- {...props}
- />
- )
-}
+const TableCell = React.forwardRef<
+ HTMLTableCellElement,
+ React.TdHTMLAttributes<HTMLTableCellElement>
+>(({ className, ...props }, ref) => (
+ <td
+ ref={ref}
+ className={cn(
+ "p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
+ className
+ )}
+ {...props}
+ />
+))
+TableCell.displayName = "TableCell"
+
+const TableCaption = React.forwardRef<
+ HTMLTableCaptionElement,
+ React.HTMLAttributes<HTMLTableCaptionElement>
+>(({ className, ...props }, ref) => (
+ <caption
+ ref={ref}
+ className={cn("text-muted-foreground mt-4 text-sm", className)}
+ {...props}
+ />
+))
+TableCaption.displayName = "TableCaption"
export {
Table,
diff --git a/apps/www/components/ui/tabs.tsx b/apps/www/components/ui/tabs.tsx
index 571eb94c..2928dea0 100644
--- a/apps/www/components/ui/tabs.tsx
+++ b/apps/www/components/ui/tabs.tsx
@@ -5,63 +5,51 @@ import * as TabsPrimitive from "@radix-ui/react-tabs"
import { cn } from "@/lib/utils"
-function Tabs({
- className,
- ...props
-}: React.ComponentProps<typeof TabsPrimitive.Root>) {
- return (
- <TabsPrimitive.Root
- data-slot="tabs"
- className={cn("flex flex-col gap-2", className)}
- {...props}
- />
- )
-}
+const Tabs = TabsPrimitive.Root
-function TabsList({
- className,
- ...props
-}: React.ComponentProps<typeof TabsPrimitive.List>) {
- return (
- <TabsPrimitive.List
- data-slot="tabs-list"
- className={cn(
- "bg-muted text-muted-foreground inline-flex h-9 items-center justify-center rounded-lg p-[3px]",
- className
- )}
- {...props}
- />
- )
-}
+const TabsList = React.forwardRef<
+ React.ElementRef<typeof TabsPrimitive.List>,
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
+>(({ className, ...props }, ref) => (
+ <TabsPrimitive.List
+ ref={ref}
+ className={cn(
+ "bg-muted text-muted-foreground inline-flex h-9 items-center justify-center rounded-lg p-1",
+ className
+ )}
+ {...props}
+ />
+))
+TabsList.displayName = TabsPrimitive.List.displayName
-/* dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 */
-function TabsTrigger({
- className,
- ...props
-}: React.ComponentProps<typeof TabsPrimitive.Trigger>) {
- return (
- <TabsPrimitive.Trigger
- data-slot="tabs-trigger"
- className={cn(
- "data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground dark:text-muted-foreground ring-offset-background data-[state=active]:text-foreground inline-flex h-[calc(100%-1px)] cursor-pointer items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:ring-offset-2 focus-visible:outline-1 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- className
- )}
- {...props}
- />
- )
-}
+const TabsTrigger = React.forwardRef<
+ React.ElementRef<typeof TabsPrimitive.Trigger>,
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
+>(({ className, ...props }, ref) => (
+ <TabsPrimitive.Trigger
+ ref={ref}
+ className={cn(
+ "ring-offset-background focus-visible:ring-ring data-[state=active]:bg-background data-[state=active]:text-foreground inline-flex items-center justify-center rounded-md px-3 py-1 text-sm font-medium whitespace-nowrap transition-all focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow",
+ className
+ )}
+ {...props}
+ />
+))
+TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
-function TabsContent({
- className,
- ...props
-}: React.ComponentProps<typeof TabsPrimitive.Content>) {
- return (
- <TabsPrimitive.Content
- data-slot="tabs-content"
- className={cn("flex-1 outline-none", className)}
- {...props}
- />
- )
-}
+const TabsContent = React.forwardRef<
+ React.ElementRef<typeof TabsPrimitive.Content>,
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
+>(({ className, ...props }, ref) => (
+ <TabsPrimitive.Content
+ ref={ref}
+ className={cn(
+ "ring-offset-background focus-visible:ring-ring mt-2 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",
+ className
+ )}
+ {...props}
+ />
+))
+TabsContent.displayName = TabsPrimitive.Content.displayName
export { Tabs, TabsList, TabsTrigger, TabsContent }
diff --git a/apps/www/components/ui/toast.tsx b/apps/www/components/ui/toast.tsx
deleted file mode 100644
index a6d9aea1..00000000
--- a/apps/www/components/ui/toast.tsx
+++ /dev/null
@@ -1,127 +0,0 @@
-import * as React from "react"
-import { Cross2Icon } from "@radix-ui/react-icons"
-import * as ToastPrimitives from "@radix-ui/react-toast"
-import { cva, type VariantProps } from "class-variance-authority"
-
-import { cn } from "@/lib/utils"
-
-const ToastProvider = ToastPrimitives.Provider
-
-const ToastViewport = React.forwardRef<
- React.ElementRef<typeof ToastPrimitives.Viewport>,
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>
->(({ className, ...props }, ref) => (
- <ToastPrimitives.Viewport
- ref={ref}
- className={cn(
- "fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:top-auto sm:right-0 sm:bottom-0 sm:flex-col md:max-w-[420px]",
- className
- )}
- {...props}
- />
-))
-ToastViewport.displayName = ToastPrimitives.Viewport.displayName
-
-const toastVariants = cva(
- "group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
- {
- variants: {
- variant: {
- default: "border bg-background",
- destructive:
- "destructive group border-destructive bg-destructive text-destructive-foreground",
- },
- },
- defaultVariants: {
- variant: "default",
- },
- }
-)
-
-const Toast = React.forwardRef<
- React.ElementRef<typeof ToastPrimitives.Root>,
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &
- VariantProps<typeof toastVariants>
->(({ className, variant, ...props }, ref) => {
- return (
- <ToastPrimitives.Root
- ref={ref}
- className={cn(toastVariants({ variant }), className)}
- {...props}
- />
- )
-})
-Toast.displayName = ToastPrimitives.Root.displayName
-
-const ToastAction = React.forwardRef<
- React.ElementRef<typeof ToastPrimitives.Action>,
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>
->(({ className, ...props }, ref) => (
- <ToastPrimitives.Action
- ref={ref}
- className={cn(
- "hover:bg-secondary focus:ring-ring group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors focus:ring-1 focus:outline-none disabled:pointer-events-none disabled:opacity-50",
- className
- )}
- {...props}
- />
-))
-ToastAction.displayName = ToastPrimitives.Action.displayName
-
-const ToastClose = React.forwardRef<
- React.ElementRef<typeof ToastPrimitives.Close>,
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>
->(({ className, ...props }, ref) => (
- <ToastPrimitives.Close
- ref={ref}
- className={cn(
- "text-foreground/50 hover:text-foreground absolute top-1 right-1 rounded-md p-1 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:ring-1 focus:outline-none group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",
- className
- )}
- toast-close=""
- {...props}
- >
- <Cross2Icon className="size-4" />
- </ToastPrimitives.Close>
-))
-ToastClose.displayName = ToastPrimitives.Close.displayName
-
-const ToastTitle = React.forwardRef<
- React.ElementRef<typeof ToastPrimitives.Title>,
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>
->(({ className, ...props }, ref) => (
- <ToastPrimitives.Title
- ref={ref}
- className={cn("text-sm font-semibold [&+div]:text-xs", className)}
- {...props}
- />
-))
-ToastTitle.displayName = ToastPrimitives.Title.displayName
-
-const ToastDescription = React.forwardRef<
- React.ElementRef<typeof ToastPrimitives.Description>,
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>
->(({ className, ...props }, ref) => (
- <ToastPrimitives.Description
- ref={ref}
- className={cn("text-sm opacity-90", className)}
- {...props}
- />
-))
-ToastDescription.displayName = ToastPrimitives.Description.displayName
-
-type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>
-
-type ToastActionElement = React.ReactElement<typeof ToastAction>
-
-export {
- type ToastProps,
- type ToastActionElement,
- ToastProvider,
- ToastViewport,
- Toast,
- ToastTitle,
- ToastDescription,
- ToastClose,
- ToastAction,
-}
diff --git a/apps/www/components/ui/toaster.tsx b/apps/www/components/ui/toaster.tsx
deleted file mode 100644
index e2233852..00000000
--- a/apps/www/components/ui/toaster.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-"use client"
-
-import {
- Toast,
- ToastClose,
- ToastDescription,
- ToastProvider,
- ToastTitle,
- ToastViewport,
-} from "@/components/ui/toast"
-import { useToast } from "@/components/ui/use-toast"
-
-export function Toaster() {
- const { toasts } = useToast()
-
- return (
- <ToastProvider>
- {toasts.map(function ({ id, title, description, action, ...props }) {
- return (
- <Toast key={id} {...props}>
- <div className="grid gap-1">
- {title && <ToastTitle>{title}</ToastTitle>}
- {description && (
- <ToastDescription>{description}</ToastDescription>
- )}
- </div>
- {action}
- <ToastClose />
- </Toast>
- )
- })}
- <ToastViewport />
- </ToastProvider>
- )
-}
diff --git a/apps/www/components/ui/tooltip.tsx b/apps/www/components/ui/tooltip.tsx
index 4ee26b38..e844667a 100644
--- a/apps/www/components/ui/tooltip.tsx
+++ b/apps/www/components/ui/tooltip.tsx
@@ -5,57 +5,28 @@ import * as TooltipPrimitive from "@radix-ui/react-tooltip"
import { cn } from "@/lib/utils"
-function TooltipProvider({
- delayDuration = 0,
- ...props
-}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
- return (
- <TooltipPrimitive.Provider
- data-slot="tooltip-provider"
- delayDuration={delayDuration}
- {...props}
- />
- )
-}
+const TooltipProvider = TooltipPrimitive.Provider
-function Tooltip({
- ...props
-}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
- return (
- <TooltipProvider>
- <TooltipPrimitive.Root data-slot="tooltip" {...props} />
- </TooltipProvider>
- )
-}
+const Tooltip = TooltipPrimitive.Root
-function TooltipTrigger({
- ...props
-}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
- return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
-}
+const TooltipTrigger = TooltipPrimitive.Trigger
-function TooltipContent({
- className,
- sideOffset = 0,
- children,
- ...props
-}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
- return (
- <TooltipPrimitive.Portal>
- <TooltipPrimitive.Content
- data-slot="tooltip-content"
- sideOffset={sideOffset}
- className={cn(
- "bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
- className
- )}
- {...props}
- >
- {children}
- <TooltipPrimitive.Arrow className="bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
- </TooltipPrimitive.Content>
- </TooltipPrimitive.Portal>
- )
-}
+const TooltipContent = React.forwardRef<
+ React.ElementRef<typeof TooltipPrimitive.Content>,
+ React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
+>(({ className, sideOffset = 4, ...props }, ref) => (
+ <TooltipPrimitive.Portal>
+ <TooltipPrimitive.Content
+ ref={ref}
+ sideOffset={sideOffset}
+ className={cn(
+ "bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 origin-[--radix-tooltip-content-transform-origin] overflow-hidden rounded-md px-3 py-1.5 text-xs",
+ className
+ )}
+ {...props}
+ />
+ </TooltipPrimitive.Portal>
+))
+TooltipContent.displayName = TooltipPrimitive.Content.displayName
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
diff --git a/apps/www/components/ui/use-toast.ts b/apps/www/components/ui/use-toast.ts
deleted file mode 100644
index 2c94c2d4..00000000
--- a/apps/www/components/ui/use-toast.ts
+++ /dev/null
@@ -1,189 +0,0 @@
-// Inspired by react-hot-toast library
-import * as React from "react"
-
-import type { ToastActionElement, ToastProps } from "@/components/ui/toast"
-
-const TOAST_LIMIT = 1
-const TOAST_REMOVE_DELAY = 1000000
-
-type ToasterToast = ToastProps & {
- id: string
- title?: React.ReactNode
- description?: React.ReactNode
- action?: ToastActionElement
-}
-
-const actionTypes = {
- ADD_TOAST: "ADD_TOAST",
- UPDATE_TOAST: "UPDATE_TOAST",
- DISMISS_TOAST: "DISMISS_TOAST",
- REMOVE_TOAST: "REMOVE_TOAST",
-} as const
-
-let count = 0
-
-function genId() {
- count = (count + 1) % Number.MAX_VALUE
- return count.toString()
-}
-
-type ActionType = typeof actionTypes
-
-type Action =
- | {
- type: ActionType["ADD_TOAST"]
- toast: ToasterToast
- }
- | {
- type: ActionType["UPDATE_TOAST"]
- toast: Partial<ToasterToast>
- }
- | {
- type: ActionType["DISMISS_TOAST"]
- toastId?: ToasterToast["id"]
- }
- | {
- type: ActionType["REMOVE_TOAST"]
- toastId?: ToasterToast["id"]
- }
-
-interface State {
- toasts: ToasterToast[]
-}
-
-const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()
-
-const addToRemoveQueue = (toastId: string) => {
- if (toastTimeouts.has(toastId)) {
- return
- }
-
- const timeout = setTimeout(() => {
- toastTimeouts.delete(toastId)
- dispatch({
- type: "REMOVE_TOAST",
- toastId: toastId,
- })
- }, TOAST_REMOVE_DELAY)
-
- toastTimeouts.set(toastId, timeout)
-}
-
-export const reducer = (state: State, action: Action): State => {
- switch (action.type) {
- case "ADD_TOAST":
- return {
- ...state,
- toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
- }
-
- case "UPDATE_TOAST":
- return {
- ...state,
- toasts: state.toasts.map((t) =>
- t.id === action.toast.id ? { ...t, ...action.toast } : t
- ),
- }
-
- case "DISMISS_TOAST": {
- const { toastId } = action
-
- // ! Side effects ! - This could be extracted into a dismissToast() action,
- // but I'll keep it here for simplicity
- if (toastId) {
- addToRemoveQueue(toastId)
- } else {
- state.toasts.forEach((toast) => {
- addToRemoveQueue(toast.id)
- })
- }
-
- return {
- ...state,
- toasts: state.toasts.map((t) =>
- t.id === toastId || toastId === undefined
- ? {
- ...t,
- open: false,
- }
- : t
- ),
- }
- }
- case "REMOVE_TOAST":
- if (action.toastId === undefined) {
- return {
- ...state,
- toasts: [],
- }
- }
- return {
- ...state,
- toasts: state.toasts.filter((t) => t.id !== action.toastId),
- }
- }
-}
-
-const listeners: Array<(state: State) => void> = []
-
-let memoryState: State = { toasts: [] }
-
-function dispatch(action: Action) {
- memoryState = reducer(memoryState, action)
- listeners.forEach((listener) => {
- listener(memoryState)
- })
-}
-
-type Toast = Omit<ToasterToast, "id">
-
-function toast({ ...props }: Toast) {
- const id = genId()
-
- const update = (props: ToasterToast) =>
- dispatch({
- type: "UPDATE_TOAST",
- toast: { ...props, id },
- })
- const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id })
-
- dispatch({
- type: "ADD_TOAST",
- toast: {
- ...props,
- id,
- open: true,
- onOpenChange: (open) => {
- if (!open) dismiss()
- },
- },
- })
-
- return {
- id: id,
- dismiss,
- update,
- }
-}
-
-function useToast() {
- const [state, setState] = React.useState<State>(memoryState)
-
- React.useEffect(() => {
- listeners.push(setState)
- return () => {
- const index = listeners.indexOf(setState)
- if (index > -1) {
- listeners.splice(index, 1)
- }
- }
- }, [state])
-
- return {
- ...state,
- toast,
- dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }),
- }
-}
-
-export { useToast, toast }
diff --git a/apps/www/package.json b/apps/www/package.json
index c518a02d..acd47bea 100644
--- a/apps/www/package.json
+++ b/apps/www/package.json
@@ -23,6 +23,7 @@
},
"dependencies": {
"@heroicons/react": "^2.2.0",
+ "@hookform/resolvers": "^5.2.2",
"@radix-ui/react-accordion": "^1.2.12",
"@radix-ui/react-alert-dialog": "^1.1.15",
"@radix-ui/react-avatar": "^1.1.10",
@@ -30,7 +31,6 @@
"@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-icons": "^1.3.2",
"@radix-ui/react-label": "^2.1.7",
"@radix-ui/react-popover": "^1.1.15",
@@ -67,7 +67,7 @@
"postcss": "8.5.6",
"posthog-js": "^1.266.0",
"react": "19.1.1",
- "react-day-picker": "^8.10.1",
+ "react-day-picker": "^9.11.0",
"react-dom": "19.1.1",
"react-hook-form": "^7.62.0",
"react-tweet": "^3.2.2",
diff --git a/apps/www/styles/globals.css b/apps/www/styles/globals.css
index ba64b50b..a8662461 100644
--- a/apps/www/styles/globals.css
+++ b/apps/www/styles/globals.css
@@ -400,7 +400,7 @@
@layer base {
:root {
- @apply overscroll-none overflow-x-hidden;
+ @apply overflow-x-hidden overscroll-none;
}
* {
@@ -495,8 +495,8 @@
}
.steps > h3:before {
- @apply absolute inline-flex h-9 w-9 items-center justify-center rounded-full border-4 border-background bg-muted text-center -indent-px font-mono text-base font-medium;
- @apply ml-[-50px] mt-[-4px];
+ @apply border-background bg-muted absolute inline-flex h-9 w-9 items-center justify-center rounded-full border-4 text-center -indent-px font-mono text-base font-medium;
+ @apply mt-[-4px] ml-[-50px];
content: counter(steps);
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 57e52e0e..b1c2b2af 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -23,6 +23,9 @@ importers:
'@heroicons/react':
specifier: ^2.2.0
version: 2.2.0([email protected])
+ '@hookform/resolvers':
+ specifier: ^5.2.2
'@radix-ui/react-accordion':
specifier: ^1.2.12
@@ -44,9 +47,6 @@ importers:
'@radix-ui/react-dropdown-menu':
specifier: ^2.1.16
- '@radix-ui/react-hover-card':
- specifier: ^1.1.15
'@radix-ui/react-icons':
specifier: ^1.3.2
version: 1.3.2([email protected])
@@ -156,8 +156,8 @@ importers:
specifier: 19.1.1
version: 19.1.1
react-day-picker:
- specifier: ^8.10.1
+ specifier: ^9.11.0
+ version: 9.11.0([email protected])
react-dom:
specifier: 19.1.1
version: 19.1.1([email protected])
@@ -498,6 +498,9 @@ packages:
resolution: {integrity: sha512-/yCrWGCoA1SVKOks25EGadP9Pnj0oAIHGpl2wH2M2Y46dPM2ueb8wyCVOD7O3WCTkaJ0IkKvzhl1JY7+uCT2Dw==}
engines: {node: '>=v18'}
+ '@date-fns/[email protected]':
+ resolution: {integrity: sha512-P5LUNhtbj6YfI3iJjw5EL9eUAG6OitD0W3fWQcpQjDRc/QIsL0tRNuO1PcDvPccWL1fSTXXdE1ds+l95DV/OFA==}
+
'@dotenvx/[email protected]':
resolution: {integrity: sha512-M1cyP6YstFQCjih54SAxCqHLMMi8QqV8tenpgGE48RTXWD7vfMYJiw/6xcCDpS2h28AcLpTsFCZA863Ge9yxzA==}
hasBin: true
@@ -746,6 +749,11 @@ packages:
peerDependencies:
react: '>= 16 || ^19.0.0-rc'
+ '@hookform/[email protected]':
+ resolution: {integrity: sha512-A/IxlMLShx3KjV/HeTcTfaMxdwy690+L/ZADoeaTltLx+CVuzkeVIPuybK3jrRfw7YZnmdKsVVHAlEPIAEUNlA==}
+ peerDependencies:
+ react-hook-form: ^7.55.0
+
'@humanfs/[email protected]':
resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==}
engines: {node: '>=18.18.0'}
@@ -1373,19 +1381,6 @@ packages:
'@types/react-dom':
optional: true
- '@radix-ui/[email protected]':
- resolution: {integrity: sha512-qgTkjNT1CfKMoP0rcasmlH2r1DAiYicWsDsufxl940sT2wHNEWWv6FMWIQXWhVdmC1d/HYfbhQx60KYyAtKxjg==}
- peerDependencies:
- '@types/react': '*'
- '@types/react-dom': '*'
- react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
- react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
- peerDependenciesMeta:
- '@types/react':
- optional: true
- '@types/react-dom':
- optional: true
-
'@radix-ui/[email protected]':
resolution: {integrity: sha512-fyQIhGDhzfc9pK2kH6Pl9c4BDJGfMkPqkyIgYDthyNYoNg3wVhoJMMh19WS4Up/1KMPFVpNsT2q3WmXn2N1m6g==}
peerDependencies:
@@ -1813,6 +1808,9 @@ packages:
'@standard-schema/[email protected]':
resolution: {integrity: sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==}
+ '@standard-schema/[email protected]':
+ resolution: {integrity: sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==}
+
resolution: {integrity: sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==}
@@ -2651,10 +2649,16 @@ packages:
resolution: {integrity: sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==}
engines: {node: '>= 0.4'}
+ resolution: {integrity: sha512-hTIP/z+t+qKwBDcmmsnmjWTduxCg+5KfdqWQvb2X/8C9+knYY6epN/pfxdDuyVlSVeFz0sM5eEfwIUQ70U4ckg==}
+
resolution: {integrity: sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==}
engines: {node: '>=0.11'}
+ resolution: {integrity: sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==}
+
resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==}
peerDependencies:
@@ -4853,11 +4857,11 @@ packages:
resolution: {integrity: sha512-9G8cA+tuMS75+6G/TzW8OtLzmBDMo8p1JRxN5AZ+LAp8uxGA8V8GZm4GQ4/N5QNQEnLmg6SS7wyuSmbKepiKqA==}
engines: {node: '>= 0.10'}
- resolution: {integrity: sha512-TMx7fNbhLk15eqcMt+7Z7S2KF7mfTId/XJDjKE8f+IUcFn0l08/kI4FiYTL/0yuOLmEcbR4Fwe3GJf/NiiMnPA==}
+ resolution: {integrity: sha512-L4FYOaPrr3+AEROeP6IG2mCORZZfxJDkJI2df8mv1jyPrNYeccgmFPZDaHyAuPCBCddQFozkxbikj2NhMEYfDQ==}
+ engines: {node: '>=18'}
peerDependencies:
- date-fns: ^2.28.0 || ^3.0.0
- react: ^16.8.0 || ^17.0.0 || ^18.0.0
+ react: '>=16.8.0'
resolution: {integrity: sha512-Dlq/5LAZgF0Gaz6yiqZCf6VCcZs1ghAJyrsu84Q/GT0gV+mCxbfmKNoGRKBYMJ8IEdGPqu49YWXD02GCknEDkw==}
@@ -6129,6 +6133,8 @@ snapshots:
'@types/conventional-commits-parser': 5.0.1
chalk: 5.6.2
+ '@date-fns/[email protected]': {}
+
'@dotenvx/[email protected]':
dependencies:
commander: 11.1.0
@@ -6318,6 +6324,11 @@ snapshots:
dependencies:
react: 19.1.1
+ dependencies:
+ '@standard-schema/utils': 0.3.0
+ react-hook-form: 7.62.0([email protected])
+
'@humanfs/[email protected]': {}
'@humanfs/[email protected]':
@@ -6951,23 +6962,6 @@ snapshots:
'@types/react': 19.1.13
'@types/react-dom': 19.1.9(@types/[email protected])
- dependencies:
- '@radix-ui/primitive': 1.1.3
- '@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])
- '@radix-ui/react-context': 1.1.2(@types/[email protected])([email protected])
- '@radix-ui/react-dismissable-layer': 1.1.11(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
- '@radix-ui/react-use-controllable-state': 1.2.2(@types/[email protected])([email protected])
- react: 19.1.1
- react-dom: 19.1.1([email protected])
- optionalDependencies:
- '@types/react': 19.1.13
- '@types/react-dom': 19.1.9(@types/[email protected])
-
dependencies:
react: 19.1.1
@@ -7458,6 +7452,8 @@ snapshots:
'@standard-schema/[email protected]': {}
+ '@standard-schema/[email protected]': {}
+
dependencies:
tslib: 2.8.1
@@ -8341,10 +8337,14 @@ snapshots:
es-errors: 1.3.0
is-data-view: 1.0.2
+
dependencies:
'@babel/runtime': 7.28.4
+
dependencies:
ms: 2.1.3
@@ -10957,9 +10957,11 @@ snapshots:
iconv-lite: 0.7.0
unpipe: 1.0.0
dependencies:
- date-fns: 2.30.0
+ '@date-fns/tz': 1.4.1
+ date-fns: 4.1.0
+ date-fns-jalali: 4.1.0-0
react: 19.1.1