The shadcn/ui components were using the new "radix-ui" umbrella package
import style (e.g. `import { Tooltip as TooltipPrimitive } from "radix-ui"`).
However, radix-ui@1.5.0 re-exports ALL radix primitives including ones not
installed (@radix-ui/react-accessible-icon, @radix-ui/react-form,
@radix-ui/react-one-time-password-field, @radix-ui/react-password-toggle-field,
@radix-ui/react-toolbar), causing esbuild to fail with 5 unresolved import
errors outside Shakespeare.
Fix: rewrite all 32 imports across the ui/ components to import directly
from their individual @radix-ui/react-* packages (which are all already
installed). Remove the radix-ui umbrella package entirely from package.json
and package-lock.json.
Affected files (32 import changes):
accordion, alert-dialog, aspect-ratio, avatar, badge, breadcrumb, button,
checkbox, collapsible, context-menu, dialog, dropdown-menu, form, hover-card,
label, menubar, navigation-menu, popover, progress, radio-group, scroll-area,
select, separator, sheet, sidebar, slider, switch, tabs, toggle-group, toggle,
tooltip
Co-authored-by: shakespeare.diy <assistant@shakespeare.diy>
24 lines
571 B
TypeScript
24 lines
571 B
TypeScript
import * as React from "react"
|
|
import { type VariantProps } from "class-variance-authority"
|
|
import * as TogglePrimitive from "@radix-ui/react-toggle"
|
|
|
|
import { cn } from "@/lib/utils"
|
|
import { toggleVariants } from "./toggle-variants"
|
|
|
|
function Toggle({
|
|
className,
|
|
variant,
|
|
size,
|
|
...props
|
|
}: React.ComponentProps<typeof TogglePrimitive.Root> &
|
|
VariantProps<typeof toggleVariants>) {
|
|
return (
|
|
<TogglePrimitive.Root
|
|
data-slot="toggle"
|
|
className={cn(toggleVariants({ variant, size, className }))}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export { Toggle }
|