From e2554c9be8804e8d423194493411142f3c8d810f Mon Sep 17 00:00:00 2001 From: Amruth Pillai Date: Mon, 17 Aug 2026 22:32:33 +0200 Subject: [PATCH] chore(ui): drop the sonner dependency Every call site now uses the Base UI toast, so the sonner wrapper and its test go with it. --- packages/ui/package.json | 1 - packages/ui/src/components/sonner.test.tsx | 30 ----------------- packages/ui/src/components/sonner.tsx | 38 ---------------------- 3 files changed, 69 deletions(-) delete mode 100644 packages/ui/src/components/sonner.test.tsx delete mode 100644 packages/ui/src/components/sonner.tsx diff --git a/packages/ui/package.json b/packages/ui/package.json index f715bafdb..ffb1d411d 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -31,7 +31,6 @@ "react-dom": "^19.2.8", "react-resizable-panels": "^4.12.2", "shadcn": "^4.16.2", - "sonner": "^2.0.8", "tw-animate-css": "^1.4.0" }, "devDependencies": { diff --git a/packages/ui/src/components/sonner.test.tsx b/packages/ui/src/components/sonner.test.tsx deleted file mode 100644 index 4727d5a60..000000000 --- a/packages/ui/src/components/sonner.test.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { render } from "@testing-library/react"; -import { describe, expect, it } from "vitest"; -import { ThemeProvider } from "next-themes"; -import { Toaster } from "./sonner"; - -describe("Toaster", () => { - it("renders without errors when wrapped in ThemeProvider", () => { - const { container } = render( - - - , - ); - // Sonner renders into document.body, but we just verify no crash - expect(container).toBeInTheDocument(); - }); - - it("forwards arbitrary props to underlying Sonner", () => { - const { container } = render( - - - , - ); - expect(container).toBeInTheDocument(); - }); - - it("does not throw when rendered without theme context", () => { - // Toaster falls back to "system" theme when next-themes context is absent. - expect(() => render()).not.toThrow(); - }); -}); diff --git a/packages/ui/src/components/sonner.tsx b/packages/ui/src/components/sonner.tsx deleted file mode 100644 index 5a00d3cf2..000000000 --- a/packages/ui/src/components/sonner.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import type { ToasterProps } from "sonner"; -import { CheckCircleIcon, CircleNotchIcon, InfoIcon, WarningIcon, XCircleIcon } from "@phosphor-icons/react"; -import { useTheme } from "next-themes"; -import { Toaster as Sonner } from "sonner"; - -const Toaster = ({ ...props }: ToasterProps) => { - const { theme = "system" } = useTheme(); - - return ( - } - className="toaster group" - icons={{ - success: , - info: , - warning: , - error: , - loading: , - }} - style={ - { - "--normal-bg": "var(--popover)", - "--normal-text": "var(--popover-foreground)", - "--normal-border": "var(--border)", - "--border-radius": "var(--radius)", - } as React.CSSProperties - } - toastOptions={{ - classNames: { - toast: "cn-toast", - }, - }} - {...props} - /> - ); -}; - -export { Toaster };