"use client" import * as React from "react" import * as RadioGroupPrimitive from "@radix-ui/react-radio-group" import { RadioGroup as SubframeRadioGroup } from "~/ui/components/RadioGroup" import { cn } from "~/lib/utils" // Subframe migration (strangler shim): // Keeps the original shadcn/Radix `RadioGroup` + `RadioGroupItem` API but renders the // Subframe design-system RadioGroup behind it. // // Notes / pitfalls: // - Subframe's RadioGroup is built on the SAME `@radix-ui/react-radio-group` package (it is a // peer dependency re-exported by `@subframe/core`), so the radio context is shared. This is // what lets existing consumers (e.g. `choicebox.tsx`) keep composing raw Radix // `RadioGroupItem` children inside this Root. // - Subframe's Root spreads `value`/`defaultValue`/`onValueChange` straight through to the // Radix Root, which natively supports both controlled and uncontrolled use — no extra state // shim is needed for the group itself. function RadioGroup({ className, children, value, ...props }: React.ComponentProps) { return ( // Radix allows value={null}; Subframe's RadioGroup only accepts string | undefined. {children} ) } // Maps the bare radio item onto Subframe's `RadioGroup.Option` (its `asChild` Radix Item with // the design-system radio markup). Public API is preserved as `React.ComponentProps`. function RadioGroupItem({ className, ...props }: React.ComponentProps) { return } export { RadioGroup, RadioGroupItem }