Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
♻️ Replace Radix Slot with Base UI useRender (#2625)
Luke Vella5e96ac9ff089
diff --git a/apps/web/package.json b/apps/web/package.jsonindex 684e5319b..18412d836 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -32,7 +32,6 @@"@next/env": "16.2.6","@prisma/adapter-pg": "^7.8.0","@prisma/client": "^7.8.0",- "@radix-ui/react-slot": "^1.1.2","@rallly/billing": "workspace:*","@rallly/database": "workspace:*","@rallly/emails": "workspace:*",diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/components/control-panel-menu-item.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/components/control-panel-menu-item.tsxindex dfbae36a3..bcee13d69 100644--- a/apps/web/src/app/[locale]/(space)/(dashboard)/components/control-panel-menu-item.tsx+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/components/control-panel-menu-item.tsx@@ -15,11 +15,9 @@ export function ControlPanelMenuItem() {return (<SidebarMenuItem>- <SidebarMenuButton asChild>- <Link href="/control-panel">- <GaugeIcon />- <Trans i18nKey="controlPanel" defaults="Control Panel" />- </Link>+ <SidebarMenuButton render={<Link href="/control-panel" />}>+ <GaugeIcon />+ <Trans i18nKey="controlPanel" defaults="Control Panel" /></SidebarMenuButton></SidebarMenuItem>);diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/components/space-sidebar-menu.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/components/space-sidebar-menu.tsxindex e394b91b0..1bfd313eb 100644--- a/apps/web/src/app/[locale]/(space)/(dashboard)/components/space-sidebar-menu.tsx+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/components/space-sidebar-menu.tsx@@ -26,11 +26,12 @@ export function SpaceSidebarMenu() {{section.items.map((item) => {return (<SidebarMenuItem key={item.id}>- <SidebarMenuButton asChild isActive={item.isActive}>- <HoverPrefetchLink href={item.href}>- <item.icon />- {item.label}- </HoverPrefetchLink>+ <SidebarMenuButton+ render={<HoverPrefetchLink href={item.href} />}+ isActive={item.isActive}+ >+ <item.icon />+ {item.label}</SidebarMenuButton></SidebarMenuItem>);diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/dashboard-home.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/dashboard-home.tsxindex 64ae9b041..74db189fb 100644--- a/apps/web/src/app/[locale]/(space)/(dashboard)/dashboard-home.tsx+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/dashboard-home.tsx@@ -44,13 +44,11 @@ export function DashboardHome() {<Trans i18nKey="homeActionsTitle" defaults="Actions" /></h2><TileGrid>- <Tile asChild>- <HoverPrefetchLink href="/new">- <CreatePageIcon />- <TileTitle>- <Trans i18nKey="create" defaults="Create" />- </TileTitle>- </HoverPrefetchLink>+ <Tile render={<HoverPrefetchLink href="/new" />}>+ <CreatePageIcon />+ <TileTitle>+ <Trans i18nKey="create" defaults="Create" />+ </TileTitle></Tile></TileGrid></div>@@ -59,36 +57,32 @@ export function DashboardHome() {<Trans i18nKey="content" defaults="Content" /></h2><TileGrid>- <Tile asChild>- <HoverPrefetchLink href="/polls">- <PollPageIcon />- <TileTitle>- <Trans i18nKey="polls" defaults="Polls" />- </TileTitle>- <TileDescription>- <Trans- i18nKey="openPollCount"- defaults="{count} open"- values={{ count: stats.openPollCount }}- />- </TileDescription>- </HoverPrefetchLink>+ <Tile render={<HoverPrefetchLink href="/polls" />}>+ <PollPageIcon />+ <TileTitle>+ <Trans i18nKey="polls" defaults="Polls" />+ </TileTitle>+ <TileDescription>+ <Trans+ i18nKey="openPollCount"+ defaults="{count} open"+ values={{ count: stats.openPollCount }}+ />+ </TileDescription></Tile>- <Tile asChild>- <HoverPrefetchLink href="/events">- <EventPageIcon />- <TileTitle>- <Trans i18nKey="events" defaults="Events" />- </TileTitle>- <TileDescription>- <Trans- i18nKey="upcomingEventCount"- defaults="{count} upcoming"- values={{ count: stats.upcomingEventCount }}- />- </TileDescription>- </HoverPrefetchLink>+ <Tile render={<HoverPrefetchLink href="/events" />}>+ <EventPageIcon />+ <TileTitle>+ <Trans i18nKey="events" defaults="Events" />+ </TileTitle>+ <TileDescription>+ <Trans+ i18nKey="upcomingEventCount"+ defaults="{count} upcoming"+ values={{ count: stats.upcomingEventCount }}+ />+ </TileDescription></Tile></TileGrid></div>@@ -97,47 +91,41 @@ export function DashboardHome() {<Trans i18nKey="manage" defaults="Manage" /></h2><TileGrid>- <Tile asChild>- <HoverPrefetchLink href="/settings/general">- <SettingsPageIcon />- <TileTitle>- <Trans i18nKey="settings" defaults="Settings" />- </TileTitle>- </HoverPrefetchLink>+ <Tile render={<HoverPrefetchLink href="/settings/general" />}>+ <SettingsPageIcon />+ <TileTitle>+ <Trans i18nKey="settings" defaults="Settings" />+ </TileTitle></Tile>- <Tile asChild>- <HoverPrefetchLink href="/settings/members">- <MembersPageIcon />- <TileTitle>- <Trans i18nKey="members" defaults="Members" />- </TileTitle>- <TileDescription>- <Trans- i18nKey="memberCount"- defaults="{count, plural, =0 {No members} one {1 member} other {# members}}"- values={{ count: stats.memberCount }}- />- </TileDescription>- </HoverPrefetchLink>+ <Tile render={<HoverPrefetchLink href="/settings/members" />}>+ <MembersPageIcon />+ <TileTitle>+ <Trans i18nKey="members" defaults="Members" />+ </TileTitle>+ <TileDescription>+ <Trans+ i18nKey="memberCount"+ defaults="{count, plural, =0 {No members} one {1 member} other {# members}}"+ values={{ count: stats.memberCount }}+ />+ </TileDescription></Tile><IfFeatureEnabled feature="billing">{stats.canManageBilling && (- <Tile asChild>- <HoverPrefetchLink href="/settings/billing">- <BillingPageIcon />- <TileTitle>- <Trans i18nKey="billing" defaults="Billing" />- </TileTitle>- <TileDescription>- <Trans- i18nKey="seatCount"- defaults="{count, plural, =0 {No seats} one {1 seat} other {# seats}}"- values={{ count: stats.seatCount }}- />- </TileDescription>- </HoverPrefetchLink>+ <Tile render={<HoverPrefetchLink href="/settings/billing" />}>+ <BillingPageIcon />+ <TileTitle>+ <Trans i18nKey="billing" defaults="Billing" />+ </TileTitle>+ <TileDescription>+ <Trans+ i18nKey="seatCount"+ defaults="{count, plural, =0 {No seats} one {1 seat} other {# seats}}"+ values={{ count: stats.seatCount }}+ />+ </TileDescription></Tile>)}</IfFeatureEnabled>diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/layout.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/layout.tsxindex e23999bf5..47a24a8a8 100644--- a/apps/web/src/app/[locale]/(space)/(dashboard)/layout.tsx+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/layout.tsx@@ -62,11 +62,11 @@ export default async function Layout({</IfFeatureEnabled><ControlPanelMenuItem /><SidebarMenuItem>- <SidebarMenuButton asChild>- <Link href="/settings/profile">- <SettingsIcon />- <Trans i18nKey="settings" defaults="Settings" />- </Link>+ <SidebarMenuButton+ render={<Link href="/settings/profile" />}+ >+ <SettingsIcon />+ <Trans i18nKey="settings" defaults="Settings" /></SidebarMenuButton></SidebarMenuItem></SidebarMenu>diff --git a/apps/web/src/app/[locale]/(space)/settings/components/sidebar.tsx b/apps/web/src/app/[locale]/(space)/settings/components/sidebar.tsxindex 3accfc6be..69a8171df 100644--- a/apps/web/src/app/[locale]/(space)/settings/components/sidebar.tsx+++ b/apps/web/src/app/[locale]/(space)/settings/components/sidebar.tsx@@ -81,14 +81,17 @@ export function AccountSidebarMenu() {<SidebarMenu>{menuItems.map((item) => (<SidebarMenuItem key={item.id}>- <SidebarMenuButton asChild isActive={pathname.startsWith(item.href)}>- <HoverPrefetchLink- href={item.href}- className="flex items-center gap-x-2"- >- {item.icon}- {item.label}- </HoverPrefetchLink>+ <SidebarMenuButton+ render={+ <HoverPrefetchLink+ href={item.href}+ className="flex items-center gap-x-2"+ />+ }+ isActive={pathname.startsWith(item.href)}+ >+ {item.icon}+ {item.label}</SidebarMenuButton></SidebarMenuItem>))}@@ -140,14 +143,17 @@ export function SpaceSidebarMenu() {<SidebarMenu>{menuItems.map((item) => (<SidebarMenuItem key={item.id}>- <SidebarMenuButton asChild isActive={pathname.startsWith(item.href)}>- <HoverPrefetchLink- href={item.href}- className="flex items-center gap-x-2"- >- <Icon>{item.icon}</Icon>- {item.label}- </HoverPrefetchLink>+ <SidebarMenuButton+ render={+ <HoverPrefetchLink+ href={item.href}+ className="flex items-center gap-x-2"+ />+ }+ isActive={pathname.startsWith(item.href)}+ >+ <Icon>{item.icon}</Icon>+ {item.label}</SidebarMenuButton></SidebarMenuItem>))}@@ -175,18 +181,18 @@ export function DeveloperSidebarMenu() {<SidebarMenu><SidebarMenuItem><SidebarMenuButton- asChild+ render={+ <HoverPrefetchLink+ href="/settings/api-keys"+ className="flex items-center gap-x-2"+ />+ }isActive={pathname.startsWith("/settings/api-keys")}>- <HoverPrefetchLink- href="/settings/api-keys"- className="flex items-center gap-x-2"- >- <Icon>- <KeyIcon />- </Icon>- <Trans i18nKey="apiKeys" defaults="API Keys" />- </HoverPrefetchLink>+ <Icon>+ <KeyIcon />+ </Icon>+ <Trans i18nKey="apiKeys" defaults="API Keys" /></SidebarMenuButton></SidebarMenuItem></SidebarMenu>diff --git a/apps/web/src/app/[locale]/control-panel/nav-item.tsx b/apps/web/src/app/[locale]/control-panel/nav-item.tsxindex 5212f11bd..45508831d 100644--- a/apps/web/src/app/[locale]/control-panel/nav-item.tsx+++ b/apps/web/src/app/[locale]/control-panel/nav-item.tsx@@ -16,8 +16,8 @@ export function NavItem({return (<SidebarMenuItem>- <SidebarMenuButton asChild isActive={isActive}>- <Link href={href}>{children}</Link>+ <SidebarMenuButton render={<Link href={href} />} isActive={isActive}>+ {children}</SidebarMenuButton></SidebarMenuItem>);diff --git a/apps/web/src/app/[locale]/control-panel/page.tsx b/apps/web/src/app/[locale]/control-panel/page.tsxindex 32020ff6c..ecf4224e9 100644--- a/apps/web/src/app/[locale]/control-panel/page.tsx+++ b/apps/web/src/app/[locale]/control-panel/page.tsx@@ -52,89 +52,81 @@ export default async function AdminPage() {<div className="space-y-4"><TileGrid>{/* USERS */}- <Tile asChild>- <Link href="/control-panel/users">- <div className="flex justify-between">- <div>- <PageIcon>- <UsersIcon />- </PageIcon>- <TileTitle>- <Trans i18nKey="users" defaults="Users" />- </TileTitle>- </div>- <div className="text-muted-foreground text-sm">- <span- className={cn({- "text-destructive":- userLimit !== null && userCount > userLimit,- })}- >- <Trans- i18nKey="userCount"- defaults="{count, number, ::compact-short}"- values={{ count: userCount }}- />- /- {userLimit === Number.POSITIVE_INFINITY ? (- <Icon className="inline-flex">- <InfinityIcon />- </Icon>- ) : (- userLimit- )}- </span>- </div>- </div>- </Link>- </Tile>- {/* LICENSE */}- <Tile asChild>- <Link href="/control-panel/license">- <div className="flex justify-between">+ <Tile render={<Link href="/control-panel/users" />}>+ <div className="flex justify-between">+ <div><PageIcon>- <KeySquareIcon />+ <UsersIcon /></PageIcon>- {tier ? (- <span className="text-primary text-sm capitalize">- {tier}- </span>- ) : (- <span className="text-muted-foreground text-sm">- <Trans i18nKey="unlicensed" defaults="Unlicensed" />- </span>- )}+ <TileTitle>+ <Trans i18nKey="users" defaults="Users" />+ </TileTitle></div>- <TileTitle>- <Trans i18nKey="license" defaults="License" />- </TileTitle>- </Link>+ <div className="text-muted-foreground text-sm">+ <span+ className={cn({+ "text-destructive":+ userLimit !== null && userCount > userLimit,+ })}+ >+ <Trans+ i18nKey="userCount"+ defaults="{count, number, ::compact-short}"+ values={{ count: userCount }}+ />+ /+ {userLimit === Number.POSITIVE_INFINITY ? (+ <Icon className="inline-flex">+ <InfinityIcon />+ </Icon>+ ) : (+ userLimit+ )}+ </span>+ </div>+ </div>+ </Tile>+ {/* LICENSE */}+ <Tile render={<Link href="/control-panel/license" />}>+ <div className="flex justify-between">+ <PageIcon>+ <KeySquareIcon />+ </PageIcon>+ {tier ? (+ <span className="text-primary text-sm capitalize">+ {tier}+ </span>+ ) : (+ <span className="text-muted-foreground text-sm">+ <Trans i18nKey="unlicensed" defaults="Unlicensed" />+ </span>+ )}+ </div>+ <TileTitle>+ <Trans i18nKey="license" defaults="License" />+ </TileTitle></Tile>{/* BRANDING */}- <Tile asChild>- <Link href="/control-panel/branding">- <div className="flex justify-between">- <PageIcon>- <PaletteIcon />- </PageIcon>- </div>- <TileTitle>- <Trans i18nKey="branding" defaults="Branding" />- </TileTitle>- </Link>+ <Tile render={<Link href="/control-panel/branding" />}>+ <div className="flex justify-between">+ <PageIcon>+ <PaletteIcon />+ </PageIcon>+ </div>+ <TileTitle>+ <Trans i18nKey="branding" defaults="Branding" />+ </TileTitle></Tile>{/* INSTANCE SETTINGS */}- <Tile asChild>- <Link href="/control-panel/settings">- <div className="flex justify-between">- <PageIcon>- <SettingsIcon />- </PageIcon>- </div>- <TileTitle>- <Trans i18nKey="settings" defaults="Settings" />- </TileTitle>- </Link>+ <Tile render={<Link href="/control-panel/settings" />}>+ <div className="flex justify-between">+ <PageIcon>+ <SettingsIcon />+ </PageIcon>+ </div>+ <TileTitle>+ <Trans i18nKey="settings" defaults="Settings" />+ </TileTitle></Tile>{/* VERSION */}<VersionTile />diff --git a/apps/web/src/app/[locale]/control-panel/version-tile.tsx b/apps/web/src/app/[locale]/control-panel/version-tile.tsxindex b1c2ef484..d9be02b08 100644--- a/apps/web/src/app/[locale]/control-panel/version-tile.tsx+++ b/apps/web/src/app/[locale]/control-panel/version-tile.tsx@@ -17,26 +17,28 @@ export function VersionTile() {});return (- <Tile asChild>- <a- href={data?.url ?? RELEASES_URL}- target="_blank"- rel="noreferrer noopener"- >- <PageIcon>- <DownloadIcon />- </PageIcon>- <TileTitle>{`v${appVersion ?? "unknown"}`}</TileTitle>- <TileDescription>- {isFetching ? (- <Spinner />- ) : data ? (- <span className="text-primary text-sm">- <Trans i18nKey="updateAvailable" defaults="Update available" />- </span>- ) : null}- </TileDescription>- </a>+ <Tile+ render={+ <a+ href={data?.url ?? RELEASES_URL}+ target="_blank"+ rel="noreferrer noopener"+ />+ }+ >+ <PageIcon>+ <DownloadIcon />+ </PageIcon>+ <TileTitle>{`v${appVersion ?? "unknown"}`}</TileTitle>+ <TileDescription>+ {isFetching ? (+ <Spinner />+ ) : data ? (+ <span className="text-primary text-sm">+ <Trans i18nKey="updateAvailable" defaults="Update available" />+ </span>+ ) : null}+ </TileDescription></Tile>);}diff --git a/apps/web/src/components/page-icons.tsx b/apps/web/src/components/page-icons.tsxindex 51fb902b6..ae5d00b8b 100644--- a/apps/web/src/components/page-icons.tsx+++ b/apps/web/src/components/page-icons.tsx@@ -1,6 +1,5 @@"use client";-import { Slot } from "@radix-ui/react-slot";import type { VariantProps } from "class-variance-authority";import { cva } from "class-variance-authority";import {@@ -55,11 +54,7 @@ export function PageIcon({}: {children: React.ReactNode;} & PageIconVariantProps) {- return (- <span className={pageIconVariants({ color, size })}>- <Slot>{children}</Slot>- </span>- );+ return <span className={pageIconVariants({ color, size })}>{children}</span>;}export function SettingsPageIcon() {diff --git a/packages/ui/package.json b/packages/ui/package.jsonindex 9f1fb78d9..8dae4d373 100644--- a/packages/ui/package.json+++ b/packages/ui/package.json@@ -21,7 +21,6 @@"@radix-ui/react-avatar": "^1.1.0","@radix-ui/react-popover": "^1.0.5","@radix-ui/react-portal": "^1.1.6",- "@radix-ui/react-slot": "^1.1.2","@rallly/languages": "workspace:*","@rallly/tailwind-config": "workspace:*","@react-aria/color": "^3.1.5",diff --git a/packages/ui/src/flex.tsx b/packages/ui/src/flex.tsxdeleted file mode 100644index b242263bd..000000000--- a/packages/ui/src/flex.tsx+++ /dev/null@@ -1,82 +0,0 @@-import { Slot } from "@radix-ui/react-slot";-import type { VariantProps } from "class-variance-authority";-import { cva } from "class-variance-authority";-import * as React from "react";--import type {- ComponentPropsWithout,- RemovedProps,-} from "./helpers/component-props";-import { cn } from "./lib/utils";--type FlexElement = React.ElementRef<"div">;-type FlexDivProps = { as?: "div" } & ComponentPropsWithout<"div", RemovedProps>;-type FlexSpanProps = { as: "span" } & ComponentPropsWithout<- "span",- RemovedProps->;-type FlexAttributeProps = FlexSpanProps | FlexDivProps;--const flexVariants = cva("box-border flex justify-start", {- variants: {- direction: {- row: "flex-row",- column: "flex-col",- },- align: {- start: "items-start",- center: "items-center",- end: "items-end",- stretch: "items-stretch",- },- justify: {- start: "justify-start",- center: "justify-center",- end: "justify-end",- between: "justify-between",- around: "justify-around",- },- wrap: {- noWrap: "flex-nowrap",- wrap: "flex-wrap",- wrapReverse: "flex-wrap-reverse",- },- gap: {- none: "gap-0",- xs: "gap-1",- sm: "gap-2",- md: "gap-4",- lg: "gap-6",- xl: "gap-8",- },- },- defaultVariants: {- direction: "row",- align: "center",- justify: "start",- wrap: "noWrap",- gap: "none",- },-});--interface FlexProps extends VariantProps<typeof flexVariants> {- asChild?: boolean;-}--const Flex = React.forwardRef<FlexElement, FlexProps & FlexAttributeProps>(- (props, forwardedRef) => {- const { className, asChild, as: Tag = "div", ...flexProps } = props;- const Comp = asChild ? Slot : Tag;- return (- <Comp- {...flexProps}- ref={forwardedRef}- className={cn(flexVariants(flexProps), className)}- />- );- },-);-Flex.displayName = "Flex";--export { Flex };-export type { FlexProps };diff --git a/packages/ui/src/form.tsx b/packages/ui/src/form.tsxindex 28ed8afc4..aa3e05e1f 100644--- a/packages/ui/src/form.tsx+++ b/packages/ui/src/form.tsx@@ -1,4 +1,5 @@-import { Slot } from "@radix-ui/react-slot";+import { mergeProps } from "@base-ui/react/merge-props";+import { useRender } from "@base-ui/react/use-render";import * as React from "react";import type { ControllerProps, FieldPath, FieldValues } from "react-hook-form";import { Controller, FormProvider, useFormContext } from "react-hook-form";@@ -94,28 +95,34 @@ const FormLabel = React.forwardRef<});FormLabel.displayName = "FormLabel";-const FormControl = React.forwardRef<- React.ElementRef<typeof Slot>,- React.ComponentPropsWithoutRef<typeof Slot>->(({ ...props }, ref) => {+function FormControl({+ children,+ ...props+}: React.HTMLAttributes<HTMLElement>) {const { error, formItemId, formDescriptionId, formMessageId } =useFormField();- return (- <Slot- ref={ref}- id={formItemId}- aria-describedby={- !error+ const element = useRender({+ defaultTagName: "div",+ render: React.isValidElement<Record<string, unknown>>(children)+ ? children+ : undefined,+ props: mergeProps(+ {+ id: formItemId,+ "aria-describedby": !error? `${formDescriptionId}`- : `${formDescriptionId} ${formMessageId}`- }- aria-invalid={!!error}- {...props}- />- );-});-FormControl.displayName = "FormControl";+ : `${formDescriptionId} ${formMessageId}`,+ "aria-invalid": !!error,+ },+ props,+ ),+ });+ if (!React.isValidElement(children)) {+ return null;+ }+ return element;+}const FormDescription = React.forwardRef<HTMLParagraphElement,diff --git a/packages/ui/src/helpers/component-props.ts b/packages/ui/src/helpers/component-props.tsdeleted file mode 100644index c866366ab..000000000--- a/packages/ui/src/helpers/component-props.ts+++ /dev/null@@ -1,23 +0,0 @@-import type React from "react";--type ComponentPropsAs<- // biome-ignore lint/suspicious/noExplicitAny: Fix this later- C extends React.ElementType<any>,- T extends React.ComponentPropsWithoutRef<C>["as"],-> = Omit<- Extract<React.ComponentPropsWithoutRef<C>, { as: T }>,- "as" | "asChild"->;--// Omits the specified props from the component props. Autocomplete will suggest props-// of the component, but won't restrict the omittable props to those that actually exist.-type ComponentPropsWithout<- T extends React.ElementType,- O extends- | Omit<string, keyof React.ComponentPropsWithoutRef<T>>- | keyof React.ComponentPropsWithoutRef<T>,-> = Omit<React.ComponentPropsWithoutRef<T>, O & string>;--type RemovedProps = "asChild" | "defaultChecked" | "defaultValue" | "color";--export type { ComponentPropsAs, ComponentPropsWithout, RemovedProps };diff --git a/packages/ui/src/icon.tsx b/packages/ui/src/icon.tsxindex 3b2c37a63..29cfabd37 100644--- a/packages/ui/src/icon.tsx+++ b/packages/ui/src/icon.tsx@@ -1,7 +1,8 @@"use client";-import { Slot } from "@radix-ui/react-slot";+import { useRender } from "@base-ui/react/use-render";import type { VariantProps } from "class-variance-authority";import { cva } from "class-variance-authority";+import * as React from "react";import { cn } from "./lib/utils";@@ -36,15 +37,21 @@ export function Icon({size,variant,}: { className?: string } & IconProps) {- return (- <Slot- className={cn(+ const element = useRender({+ defaultTagName: "span",+ render: React.isValidElement<{ className?: string }>(children)+ ? children+ : undefined,+ props: {+ className: cn(iconVariants({ size, variant }),"group shrink-0 group-[.bg-destructive]:text-destructive-foreground group-[.bg-primary]:text-primary-foreground",className,- )}- >- {children}- </Slot>- );+ ),+ },+ });+ if (!React.isValidElement(children)) {+ return null;+ }+ return element;}diff --git a/packages/ui/src/sidebar.tsx b/packages/ui/src/sidebar.tsxindex 1b1ee7226..b7e64fb92 100644--- a/packages/ui/src/sidebar.tsx+++ b/packages/ui/src/sidebar.tsx@@ -1,6 +1,7 @@"use client";-import { Slot } from "@radix-ui/react-slot";+import { mergeProps } from "@base-ui/react/merge-props";+import { useRender } from "@base-ui/react/use-render";import type { VariantProps } from "class-variance-authority";import { cva } from "class-variance-authority";import { PanelLeft } from "lucide-react";@@ -423,49 +424,51 @@ const SidebarGroup = React.forwardRef<});SidebarGroup.displayName = "SidebarGroup";-const SidebarGroupLabel = React.forwardRef<- HTMLDivElement,- React.ComponentPropsWithRef<"div"> & { asChild?: boolean }->(({ className, asChild = false, ...props }, ref) => {- const Comp = asChild ? Slot : "div";-- return (- <Comp- ref={ref}- data-sidebar="group-label"- className={cn(- "flex h-8 shrink-0 items-center rounded-md px-2 font-medium text-sidebar-foreground/70 text-xs transition-[margin,opacity] duration-200 ease-linear [&>svg]:size-4 [&>svg]:shrink-0",- "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",- className,- )}- {...props}- />- );-});-SidebarGroupLabel.displayName = "SidebarGroupLabel";--const SidebarGroupAction = React.forwardRef<- HTMLButtonElement,- React.ComponentPropsWithRef<"button"> & { asChild?: boolean }->(({ className, asChild = false, ...props }, ref) => {- const Comp = asChild ? Slot : "button";+function SidebarGroupLabel({+ className,+ render,+ ...props+}: useRender.ComponentProps<"div">) {+ return useRender({+ defaultTagName: "div",+ render,+ props: mergeProps<"div">(+ {+ "data-sidebar": "group-label",+ className: cn(+ "flex h-8 shrink-0 items-center rounded-md px-2 font-medium text-sidebar-foreground/70 text-xs transition-[margin,opacity] duration-200 ease-linear [&>svg]:size-4 [&>svg]:shrink-0",+ "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",+ className,+ ),+ } as React.ComponentProps<"div">,+ props,+ ),+ });+}- return (- <Comp- ref={ref}- data-sidebar="group-action"- className={cn(- "absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0",- // Increases the hit area of the button on mobile.- "after:absolute after:-inset-2 md:after:hidden",- "group-data-[collapsible=icon]:hidden",- className,- )}- {...props}- />- );-});-SidebarGroupAction.displayName = "SidebarGroupAction";+function SidebarGroupAction({+ className,+ render,+ ...props+}: useRender.ComponentProps<"button">) {+ return useRender({+ defaultTagName: "button",+ render,+ props: mergeProps<"button">(+ {+ "data-sidebar": "group-action",+ className: cn(+ "absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0",+ // Increases the hit area of the button on mobile.+ "after:absolute after:-inset-2 md:after:hidden",+ "group-data-[collapsible=icon]:hidden",+ className,+ ),+ } as React.ComponentProps<"button">,+ props,+ ),+ });+}const SidebarGroupContent = React.forwardRef<HTMLDivElement,@@ -531,95 +534,88 @@ const sidebarMenuButtonVariants = cva(},);-const SidebarMenuButton = React.forwardRef<- HTMLButtonElement,- React.ComponentPropsWithRef<"button"> & {- asChild?: boolean;- isActive?: boolean;- tooltip?: string | React.ComponentProps<typeof TooltipContent>;- } & VariantProps<typeof sidebarMenuButtonVariants>->(- (- {- asChild = false,- isActive = false,- variant = "default",- size = "default",- tooltip,- className,- ...props- },- ref,- ) => {- const Comp = asChild ? Slot : "button";- const { isMobile, state } = useSidebar();-- const button = (- <Comp- ref={ref}- data-sidebar="menu-button"- data-size={size}- data-active={isActive}- className={cn(sidebarMenuButtonVariants({ variant, size }), className)}- {...props}- />- );-- if (!tooltip) {- return button;- }-- if (typeof tooltip === "string") {- tooltip = {- children: tooltip,- };- }-- return (- <Tooltip>- <TooltipTrigger render={button} />- <TooltipContent- side="right"- align="center"- hidden={state !== "collapsed" || isMobile}- {...tooltip}- />- </Tooltip>- );- },-);-SidebarMenuButton.displayName = "SidebarMenuButton";+function SidebarMenuButton({+ render,+ isActive = false,+ variant = "default",+ size = "default",+ tooltip,+ className,+ ...props+}: useRender.ComponentProps<"button"> & {+ isActive?: boolean;+ tooltip?: string | React.ComponentProps<typeof TooltipContent>;+} & VariantProps<typeof sidebarMenuButtonVariants>) {+ const { isMobile, state } = useSidebar();++ const button = useRender({+ defaultTagName: "button",+ render,+ props: mergeProps<"button">(+ {+ "data-sidebar": "menu-button",+ "data-size": size ?? undefined,+ "data-active": isActive,+ className: cn(sidebarMenuButtonVariants({ variant, size }), className),+ } as React.ComponentProps<"button">,+ props,+ ),+ });++ if (!tooltip) {+ return button;+ }-const SidebarMenuAction = React.forwardRef<- HTMLButtonElement,- React.ComponentPropsWithRef<"button"> & {- asChild?: boolean;- showOnHover?: boolean;+ if (typeof tooltip === "string") {+ tooltip = {+ children: tooltip,+ };}->(({ className, asChild = false, showOnHover = false, ...props }, ref) => {- const Comp = asChild ? Slot : "button";return (- <Comp- ref={ref}- data-sidebar="menu-action"- className={cn(- "absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0",- // Increases the hit area of the button on mobile.- "after:absolute after:-inset-2 md:after:hidden",- "peer-data-[size=sm]/menu-button:top-1",- "peer-data-[size=default]/menu-button:top-1.5",- "peer-data-[size=lg]/menu-button:top-2.5",- "group-data-[collapsible=icon]:hidden",- showOnHover &&- "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",- className,- )}- {...props}- />+ <Tooltip>+ <TooltipTrigger render={button} />+ <TooltipContent+ side="right"+ align="center"+ hidden={state !== "collapsed" || isMobile}+ {...tooltip}+ />+ </Tooltip>);-});-SidebarMenuAction.displayName = "SidebarMenuAction";+}++function SidebarMenuAction({+ className,+ render,+ showOnHover = false,+ ...props+}: useRender.ComponentProps<"button"> & {+ showOnHover?: boolean;+}) {+ return useRender({+ defaultTagName: "button",+ render,+ props: mergeProps<"button">(+ {+ "data-sidebar": "menu-action",+ className: cn(+ "absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0",+ // Increases the hit area of the button on mobile.+ "after:absolute after:-inset-2 md:after:hidden",+ "peer-data-[size=sm]/menu-button:top-1",+ "peer-data-[size=default]/menu-button:top-1.5",+ "peer-data-[size=lg]/menu-button:top-2.5",+ "group-data-[collapsible=icon]:hidden",+ showOnHover &&+ "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",+ className,+ ),+ } as React.ComponentProps<"button">,+ props,+ ),+ });+}const SidebarMenuBadge = React.forwardRef<HTMLDivElement,@@ -703,35 +699,37 @@ const SidebarMenuSubItem = React.forwardRef<>(({ ...props }, ref) => <li ref={ref} {...props} />);SidebarMenuSubItem.displayName = "SidebarMenuSubItem";-const SidebarMenuSubButton = React.forwardRef<- HTMLAnchorElement,- React.ComponentPropsWithRef<"a"> & {- asChild?: boolean;- size?: "sm" | "md";- isActive?: boolean;- }->(({ asChild = false, size = "md", isActive, className, ...props }, ref) => {- const Comp = asChild ? Slot : "a";-- return (- <Comp- ref={ref}- data-sidebar="menu-sub-button"- data-size={size}- data-active={isActive}- className={cn(- "flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",- "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",- size === "sm" && "text-xs",- size === "md" && "text-sm",- "group-data-[collapsible=icon]:hidden",- className,- )}- {...props}- />- );-});-SidebarMenuSubButton.displayName = "SidebarMenuSubButton";+function SidebarMenuSubButton({+ render,+ size = "md",+ isActive,+ className,+ ...props+}: useRender.ComponentProps<"a"> & {+ size?: "sm" | "md";+ isActive?: boolean;+}) {+ return useRender({+ defaultTagName: "a",+ render,+ props: mergeProps<"a">(+ {+ "data-sidebar": "menu-sub-button",+ "data-size": size,+ "data-active": isActive,+ className: cn(+ "flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",+ "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",+ size === "sm" && "text-xs",+ size === "md" && "text-sm",+ "group-data-[collapsible=icon]:hidden",+ className,+ ),+ } as React.ComponentProps<"a">,+ props,+ ),+ });+}export {Sidebar,diff --git a/packages/ui/src/tile.tsx b/packages/ui/src/tile.tsxindex 26de60c84..598595cd6 100644--- a/packages/ui/src/tile.tsx+++ b/packages/ui/src/tile.tsx@@ -1,45 +1,33 @@"use client";-import { Slot } from "@radix-ui/react-slot";+import { mergeProps } from "@base-ui/react/merge-props";+import { useRender } from "@base-ui/react/use-render";import * as React from "react";import { cn } from "./lib/utils";-const Tile = React.forwardRef<- HTMLDivElement,- {- className?: string;- children?: React.ReactNode;- asChild?: boolean;- }->(({ className, asChild, children, ...props }, ref) => {- const Comp = asChild ? Slot : "div";- return (- <Comp- ref={ref}- className={cn(- "relative flex flex-col justify-end rounded-xl bg-card p-3 text-card-foreground ring-1 ring-button-outline ring-inset transition-transform hover:bg-card-accent active:translate-y-0.5",- className,- )}- {...props}- >- {children}- </Comp>- );-});-Tile.displayName = "Tile";--const TileIcon = React.forwardRef<- HTMLElement,- React.HTMLAttributes<HTMLElement>->(({ className, children, ...props }, ref) => (- <span className={cn("mb-3", className)}>- <Slot ref={ref} className="size-4" {...props}>- {children}- </Slot>- </span>-));-TileIcon.displayName = "TileIcon";+function Tile({+ className,+ render,+ ...props+}: useRender.ComponentProps<"div">) {+ return useRender({+ defaultTagName: "div",+ render,+ props: mergeProps<"div">(+ {+ className: cn(+ "relative flex flex-col justify-end rounded-xl bg-card p-3 text-card-foreground ring-1 ring-button-outline ring-inset transition-transform hover:bg-card-accent active:translate-y-0.5",+ className,+ ),+ },+ props,+ ),+ state: {+ slot: "tile",+ },+ });+}const TileTitle = React.forwardRef<HTMLHeadingElement,@@ -76,4 +64,4 @@ const TileGrid = React.forwardRef<));TileGrid.displayName = "TileGrid";-export { Tile, TileDescription, TileGrid, TileIcon, TileTitle };+export { Tile, TileDescription, TileGrid, TileTitle };diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 8734d642b..2a7e42531 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -228,9 +228,6 @@ importers:'@prisma/client':specifier: ^7.8.0version: 7.8.0([email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])([email protected]))([email protected])- '@radix-ui/react-slot':- specifier: ^1.1.2- version: 1.2.4(@types/[email protected])([email protected])'@rallly/billing':specifier: workspace:*version: link:../../packages/billing@@ -767,9 +764,6 @@ importers:'@radix-ui/react-portal':specifier: ^1.1.6version: 1.1.10(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])- '@radix-ui/react-slot':- specifier: ^1.1.2- version: 1.2.4(@types/[email protected])([email protected])'@rallly/languages':specifier: workspace:*version: link:../languages