Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
♻️ Migrate Switch to Base UI (#2585)
Luke Vellaa7713533e718
diff --git a/apps/web/package.json b/apps/web/package.jsonindex fd54c671e..16a174e6a 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -35,7 +35,6 @@"@radix-ui/react-radio-group": "^1.2.3","@radix-ui/react-select": "^2.2.2","@radix-ui/react-slot": "^1.1.2",- "@radix-ui/react-switch": "^1.0.2","@rallly/billing": "workspace:*","@rallly/database": "workspace:*","@rallly/emails": "workspace:*",diff --git a/packages/ui/package.json b/packages/ui/package.jsonindex 2699ead95..20a79ab31 100644--- a/packages/ui/package.json+++ b/packages/ui/package.json@@ -26,7 +26,6 @@"@radix-ui/react-radio-group": "^1.2.3","@radix-ui/react-select": "^2.2.2","@radix-ui/react-slot": "^1.1.2",- "@radix-ui/react-switch": "^1.0.2","@radix-ui/react-tabs": "^1.0.4","@radix-ui/react-tooltip": "^1.1.8","@rallly/languages": "workspace:*",diff --git a/packages/ui/src/switch.tsx b/packages/ui/src/switch.tsxindex 250cd5db5..8f76d1add 100644--- a/packages/ui/src/switch.tsx+++ b/packages/ui/src/switch.tsx@@ -1,33 +1,34 @@"use client";-import * as SwitchPrimitives from "@radix-ui/react-switch";-import * as React from "react";+import { Switch as SwitchPrimitive } from "@base-ui/react/switch";+import type * as React from "react";import { cn } from "./lib/utils";-const Switch = React.forwardRef<- React.ElementRef<typeof SwitchPrimitives.Root>,- React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> & {- icon?: React.ReactNode;- }->(({ className, ...props }, ref) => (- <SwitchPrimitives.Root- className={cn(- "peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full p-0.5 ring-1 ring-button-outline ring-inset transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-muted",- className,- )}- {...props}- ref={ref}- >- <SwitchPrimitives.Thumb+function Switch({+ className,+ icon,+ ...props+}: SwitchPrimitive.Root.Props & {+ icon?: React.ReactNode;+}) {+ return (+ <SwitchPrimitive.Root+ data-slot="switch"className={cn(- "pointer-events-none flex h-full w-4 items-center justify-center rounded-full bg-background shadow-lg ring-0 transition-transform duration-100 data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0 dark:bg-gray-700",+ "peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full p-0.5 ring-1 ring-button-outline ring-inset transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-offset-2 data-disabled:cursor-not-allowed data-checked:bg-primary data-unchecked:bg-muted data-disabled:opacity-50",+ className,)}+ {...props}>- {props.icon}- </SwitchPrimitives.Thumb>- </SwitchPrimitives.Root>-));-Switch.displayName = SwitchPrimitives.Root.displayName;+ <SwitchPrimitive.Thumb+ data-slot="switch-thumb"+ className="pointer-events-none flex h-full w-4 items-center justify-center rounded-full bg-background shadow-lg ring-0 transition-transform duration-100 data-checked:translate-x-4 data-unchecked:translate-x-0 dark:bg-gray-700"+ >+ {icon}+ </SwitchPrimitive.Thumb>+ </SwitchPrimitive.Root>+ );+}export { Switch };diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 2416228ae..6e851596d 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -237,9 +237,6 @@ importers:'@radix-ui/react-slot':specifier: ^1.1.2version: 1.2.4(@types/[email protected])([email protected])- '@radix-ui/react-switch':- specifier: ^1.0.2- version: 1.2.6(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])'@rallly/billing':specifier: workspace:*version: link:../../packages/billing@@ -791,9 +788,6 @@ importers:'@radix-ui/react-slot':specifier: ^1.1.2version: 1.2.4(@types/[email protected])([email protected])- '@radix-ui/react-switch':- specifier: ^1.0.2- version: 1.2.6(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])'@radix-ui/react-tabs':specifier: ^1.0.4version: 1.1.13(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])@@ -3815,19 +3809,6 @@ packages:'@types/react':optional: true- '@radix-ui/[email protected]':- resolution: {integrity: sha512-bByzr1+ep1zk4VubeEVViV592vu2lHE2BZY5OnzehZqOOgogN80+mNtCqPkhn2gklJqOpxWgPoYTSnhBCqpOXQ==}- 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-7xdcatg7/U+7+Udyoj2zodtI9H/IIopqo+YOIcZOq1nJwXWBZ9p8xiu5llXlekDbZkca79a/fozEYQXIA4sW6A==}peerDependencies:@@ -15164,21 +15145,6 @@ snapshots:optionalDependencies:'@types/react': 19.2.13- '@radix-ui/[email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([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-primitive': 2.1.3(@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])- '@radix-ui/react-use-previous': 1.1.1(@types/[email protected])([email protected])- '@radix-ui/react-use-size': 1.1.1(@types/[email protected])([email protected])- react: 19.2.6- react-dom: 19.2.6([email protected])- optionalDependencies:- '@types/react': 19.2.13- '@types/react-dom': 19.2.3(@types/[email protected])-'@radix-ui/[email protected](@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])':dependencies:'@radix-ui/primitive': 1.1.3