Dependencies Updates, Sidebar fixes, default plan, Radix single package (#297)

* Refactor Radix UI imports and update package dependencies, fix Sidebar "group" references, add default value to plan picker to preselect a plan
This commit is contained in:
Giancarlo Buomprisco
2025-07-11 16:57:27 +07:00
committed by GitHub
parent 1d734e6818
commit 50337298fd
72 changed files with 1902 additions and 1263 deletions

View File

@@ -5,9 +5,9 @@ import * as React from 'react';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { Slot } from '@radix-ui/react-slot';
import { VariantProps, cva } from 'class-variance-authority';
import { ChevronDown, PanelLeft } from 'lucide-react';
import { Slot } from 'radix-ui';
import { useTranslation } from 'react-i18next';
import { useIsMobile } from '../hooks/use-mobile';
@@ -149,26 +149,24 @@ const SidebarProvider: React.FC<
return (
<SidebarContext.Provider value={contextValue}>
<TooltipProvider delayDuration={0}>
<div
style={
{
'--sidebar-width': sidebarWidth,
'--sidebar-width-icon': SIDEBAR_WIDTH_ICON,
...style,
} as React.CSSProperties
}
data-minimized={!open}
className={cn(
'group text-sidebar-foreground has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full',
className,
)}
ref={ref}
{...props}
>
{children}
</div>
</TooltipProvider>
<div
style={
{
'--sidebar-width': sidebarWidth,
'--sidebar-width-icon': SIDEBAR_WIDTH_ICON,
...style,
} as React.CSSProperties
}
data-minimized={!open}
className={cn(
'group/sidebar text-sidebar-foreground has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full',
className,
)}
ref={ref}
{...props}
>
{children}
</div>
</SidebarContext.Provider>
);
};
@@ -464,7 +462,7 @@ SidebarGroup.displayName = 'SidebarGroup';
const SidebarGroupLabel: React.FC<
React.ComponentProps<'div'> & { asChild?: boolean }
> = ({ className, asChild = false, ...props }) => {
const Comp = asChild ? Slot : 'div';
const Comp = asChild ? Slot.Root : 'div';
return (
<Comp
@@ -483,7 +481,7 @@ SidebarGroupLabel.displayName = 'SidebarGroupLabel';
const SidebarGroupAction: React.FC<
React.ComponentProps<'button'> & { asChild?: boolean }
> = ({ className, asChild = false, ...props }) => {
const Comp = asChild ? Slot : 'button';
const Comp = asChild ? Slot.Root : 'button';
return (
<Comp
@@ -520,7 +518,7 @@ const SidebarMenu: React.FC<React.ComponentProps<'ul'>> = ({
<ul
data-sidebar="menu"
className={cn(
'flex w-full min-w-0 flex-col gap-1 group-data-[minimized=true]:items-center',
'flex w-full min-w-0 flex-col gap-1 group-data-[minimized=true]/sidebar:items-center',
className,
)}
{...props}
@@ -580,7 +578,7 @@ const SidebarMenuButton: React.FC<
className,
...props
}) => {
const Comp = asChild ? Slot : 'button';
const Comp = asChild ? Slot.Root : 'button';
const { isMobile, open } = useSidebar();
const { t } = useTranslation();
@@ -607,15 +605,17 @@ const SidebarMenuButton: React.FC<
}
return (
<Tooltip>
<TooltipTrigger asChild>{button}</TooltipTrigger>
<TooltipContent
side="right"
align="center"
hidden={isMobile || open}
{...tooltip}
/>
</Tooltip>
<TooltipProvider delayDuration={0}>
<Tooltip>
<TooltipTrigger asChild>{button}</TooltipTrigger>
<TooltipContent
side="right"
align="center"
hidden={isMobile || open}
{...tooltip}
/>
</Tooltip>
</TooltipProvider>
);
};
@@ -627,7 +627,7 @@ const SidebarMenuAction: React.FC<
showOnHover?: boolean;
}
> = ({ className, asChild = false, showOnHover = false, ...props }) => {
const Comp = asChild ? Slot : 'button';
const Comp = asChild ? Slot.Root : 'button';
return (
<Comp
@@ -735,7 +735,7 @@ const SidebarMenuSubButton: React.FC<
isActive?: boolean;
}
> = ({ asChild = false, size = 'md', isActive, className, ...props }) => {
const Comp = asChild ? Slot : 'a';
const Comp = asChild ? Slot.Root : 'a';
return (
<Comp