{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "radio-button",
  "type": "registry:ui",
  "title": "RadioButton",
  "description": "RadioButton lets users pick exactly one option from a set.",
  "dependencies": [
    "@radix-ui/react-label@^2.1.8",
    "@radix-ui/react-radio-group@^1.3.8",
    "class-variance-authority@^0.7.1"
  ],
  "registryDependencies": [
    "https://wideset.co/r/motion.json",
    "https://wideset.co/r/styles.json",
    "https://wideset.co/r/utils.json"
  ],
  "files": [
    {
      "path": "src/components/radio-button/RadioButton.context.ts",
      "type": "registry:ui",
      "target": "components/ui/wideset/radio-button/RadioButton.context.ts",
      "content": "'use client';\n\nimport { createContext, useContext } from 'react';\n\nimport type { RadioButtonContextType } from './RadioButton.types';\n\nexport const RadioButtonContext = createContext<RadioButtonContextType | undefined>(undefined);\n\nexport const useRadioButtonContext = () => {\n  const context = useContext(RadioButtonContext);\n\n  if (context === undefined) {\n    throw new Error('useRadioButtonContext must be used within a RadioButton');\n  }\n\n  return context;\n};\n"
    },
    {
      "path": "src/components/radio-button/RadioButton.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/radio-button/RadioButton.tsx",
      "content": "'use client';\n\nimport * as Label from '@radix-ui/react-label';\nimport * as RadioGroupPrimitive from '@radix-ui/react-radio-group';\nimport * as React from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { useDefaultMotion } from '@/lib/wideset/motion/MotionProvider';\nimport { RadioButtonContext } from './RadioButton.context';\nimport type { RadioButtonProps, RadioButtonWithSubComponents } from './RadioButton.types';\nimport {\n  radioIndicatorMotionVariants,\n  radioIndicatorVariants,\n  radioMotionVariants,\n  radioVariants,\n} from './RadioButton.variants';\nimport { RadioButtonDescription } from './RadioButtonDescription';\nimport { RadioButtonGroup } from './RadioButtonGroup';\nimport { RadioButtonLabel } from './RadioButtonLabel';\n\nconst RadioButton = React.forwardRef<\n  React.ComponentRef<typeof RadioGroupPrimitive.Item>,\n  RadioButtonProps\n>(\n  (\n    {\n      className,\n      size = 'lg',\n      variant = 'primary',\n      id,\n      label,\n      description,\n      disabled,\n      defaultMotion,\n      children,\n      ...props\n    },\n    ref,\n  ) => {\n    const fallbackId = React.useId();\n    const motion = useDefaultMotion(defaultMotion);\n    const radioId = id || fallbackId;\n\n    const radioElement = (\n      <RadioGroupPrimitive.Item\n        ref={ref}\n        id={radioId}\n        className={cn(\n          radioVariants({ size, variant }),\n          radioMotionVariants({ enabled: motion }),\n          className,\n        )}\n        disabled={disabled}\n        data-slot=\"radio-button\"\n        {...props}\n      >\n        <RadioGroupPrimitive.Indicator\n          className={cn(\n            'absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2',\n            radioIndicatorMotionVariants({ enabled: motion }),\n          )}\n        >\n          <div className={radioIndicatorVariants({ size, variant })} />\n        </RadioGroupPrimitive.Indicator>\n      </RadioGroupPrimitive.Item>\n    );\n\n    return (\n      <RadioButtonContext.Provider value={{ disabled, id: radioId }}>\n        <div className={cn('gap-ws-5 flex w-fit')}>\n          {radioElement}\n          {label ? (\n            <Label.Root\n              data-slot=\"radio-button-label\"\n              htmlFor={radioId}\n              className={cn(\n                'typography-label-sm text-ws-dynamic-secondary-default gap-ws-3 flex cursor-pointer flex-col',\n                disabled && 'text-ws-static-subtle pointer-events-none',\n              )}\n            >\n              {label}\n              {description && (\n                <div\n                  data-slot=\"radio-button-description\"\n                  className=\"text-ws-static-subtle typography-body-sm\"\n                >\n                  {description}\n                </div>\n              )}\n            </Label.Root>\n          ) : (\n            Boolean(children) && <div className=\"gap-ws-3 flex flex-col\">{children}</div>\n          )}\n        </div>\n      </RadioButtonContext.Provider>\n    );\n  },\n) as RadioButtonWithSubComponents;\n\nRadioButton.displayName = 'RadioButton';\nRadioButton.Group = RadioButtonGroup;\nRadioButton.Label = RadioButtonLabel;\nRadioButton.Description = RadioButtonDescription;\n\nexport { RadioButton, RadioButtonDescription, RadioButtonGroup, RadioButtonLabel };\n"
    },
    {
      "path": "src/components/radio-button/RadioButton.types.ts",
      "type": "registry:ui",
      "target": "components/ui/wideset/radio-button/RadioButton.types.ts",
      "content": "import type * as RadioGroupPrimitive from '@radix-ui/react-radio-group';\nimport type { VariantProps } from 'class-variance-authority';\nimport type { LabelHTMLAttributes } from 'react';\n\nimport type { MotionProps } from '@/lib/wideset/motion/Motion.types';\nimport type { radioVariants } from './RadioButton.variants';\nimport type { RadioButtonDescription } from './RadioButtonDescription';\nimport type { RadioButtonGroup } from './RadioButtonGroup';\nimport type { RadioButtonLabel } from './RadioButtonLabel';\n\nexport type RadioButtonContextType = {\n  disabled?: boolean;\n  id?: string;\n};\n\ntype RadioButtonItemPrimitiveProps = React.ComponentPropsWithoutRef<\n  typeof RadioGroupPrimitive.Item\n>;\n\ntype RadioGroupPrimitiveProps = React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>;\n\ntype RadioButtonPropsBase = Omit<\n  RadioButtonItemPrimitiveProps,\n  'children' | 'className' | 'disabled' | 'id' | 'required' | 'value'\n> &\n  MotionProps &\n  VariantProps<typeof radioVariants> & {\n    /** Additional CSS classes merged with the radio root element. */\n    className?: RadioButtonItemPrimitiveProps['className'];\n    /** Disables the radio visually and functionally. */\n    disabled?: RadioButtonItemPrimitiveProps['disabled'];\n    /** Stable id of the radio input. When omitted, one is generated automatically. */\n    id?: RadioButtonItemPrimitiveProps['id'];\n    /** Marks the radio as required in a form context. */\n    required?: RadioButtonItemPrimitiveProps['required'];\n    /** Unique value of the radio within the owning `RadioButton.Group`. */\n    value: RadioButtonItemPrimitiveProps['value'];\n  };\n\ntype RadioButtonPropsWithLabel = RadioButtonPropsBase & {\n  /** Shorthand label rendered next to the radio. Mutually exclusive with `children`. */\n  label: string;\n  /** Supplementary text shown below the shorthand label. Requires `label`. */\n  description?: string;\n  children?: never;\n};\n\ntype RadioButtonPropsWithChildren = RadioButtonPropsBase & {\n  label?: never;\n  description?: never;\n  /** Composed label content such as `RadioButton.Label` and `RadioButton.Description`. */\n  children?: React.ReactNode;\n};\n\ntype RadioButtonPropsWithoutLabel = RadioButtonPropsBase & {\n  label?: never;\n  description?: never;\n  children?: never;\n};\n\n/** One option in a mutually exclusive radio group. */\nexport type RadioButtonProps =\n  RadioButtonPropsWithLabel | RadioButtonPropsWithChildren | RadioButtonPropsWithoutLabel;\n\nexport type RadioButtonWithSubComponents = React.ForwardRefExoticComponent<\n  React.PropsWithoutRef<RadioButtonProps> &\n    React.RefAttributes<React.ComponentRef<typeof RadioGroupPrimitive.Item>>\n> & {\n  Group: typeof RadioButtonGroup;\n  Label: typeof RadioButtonLabel;\n  Description: typeof RadioButtonDescription;\n};\n\n/** A group managing one selected radio value. */\nexport type RadioButtonGroupProps = Omit<\n  RadioGroupPrimitiveProps,\n  | 'children'\n  | 'className'\n  | 'defaultValue'\n  | 'disabled'\n  | 'name'\n  | 'onValueChange'\n  | 'orientation'\n  | 'required'\n  | 'value'\n> & {\n  /** RadioButton items rendered inside the group. */\n  children?: RadioGroupPrimitiveProps['children'];\n  /** Additional CSS classes merged with the group root element. */\n  className?: RadioGroupPrimitiveProps['className'];\n  /** Initial selected value for uncontrolled usage. Ignored when `value` is provided. */\n  defaultValue?: RadioGroupPrimitiveProps['defaultValue'];\n  /** Disables every radio in the group. */\n  disabled?: RadioGroupPrimitiveProps['disabled'];\n  /** Form field name shared by all radios in the group. */\n  name?: RadioGroupPrimitiveProps['name'];\n  /** Fired when the selected value changes. */\n  onValueChange?: RadioGroupPrimitiveProps['onValueChange'];\n  /** Layout direction of the radios within the group. */\n  orientation?: RadioGroupPrimitiveProps['orientation'];\n  /** Marks the group as required in a form context. */\n  required?: RadioGroupPrimitiveProps['required'];\n  /** Controlled selected radio value. */\n  value?: RadioGroupPrimitiveProps['value'];\n};\n\n/** The text label associated with `RadioButton`. */\nexport type RadioButtonLabelProps = Omit<LabelHTMLAttributes<HTMLLabelElement>, 'htmlFor'> & {\n  /** Explicit id of the radio controlled by this label. Falls back to the nearest `RadioButton` id. */\n  htmlFor?: string;\n};\n"
    },
    {
      "path": "src/components/radio-button/RadioButton.variants.ts",
      "type": "registry:ui",
      "target": "components/ui/wideset/radio-button/RadioButton.variants.ts",
      "content": "import { cva } from 'class-variance-authority';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { boxFillMotion } from '@/lib/wideset/motion/recipes';\n\nexport const radioVariants = cva(\n  cn(\n    'group relative box-border flex cursor-pointer border',\n    'disabled:wds-disabled focus-visible:wds-focus-visible focus-visible:bg-ws-static-highlight-base',\n    'radix-state-checked:border-2',\n    'radix-state-checked:disabled:bg-ws-dynamic-secondary-alpha-default',\n    'radix-state-checked:disabled:border-ws-dynamic-secondary-disabled',\n  ),\n  {\n    variants: {\n      size: {\n        // my-ws-2 reproduces Figma's 16×20 Control Container (paddingTop/Bottom = 2)\n        // so the sm control centers against the 20px label line.\n        sm: 'size-ws-control-sm my-ws-2 rounded-full',\n        lg: 'size-ws-control-md rounded-full',\n      },\n      variant: {\n        primary: cn(\n          'outline-ws-dynamic-primary-strong-default bg-ws-static-highlight-base border-ws-static-strong',\n\n          'radix-state-unchecked:border-ws-static-strong',\n          'radix-state-unchecked:hover:border-ws-dynamic-secondary-hover',\n          'radix-state-unchecked:active:border-ws-dynamic-secondary-pressed',\n          'radix-state-unchecked:disabled:bg-ws-dynamic-secondary-alpha-default',\n          'radix-state-unchecked:disabled:border-ws-dynamic-secondary-disabled',\n\n          'radix-state-checked:border-ws-dynamic-primary-strong-default',\n          'radix-state-checked:bg-ws-dynamic-secondary-alpha-default',\n          'radix-state-checked:hover:bg-ws-dynamic-primary-alpha-hover',\n          'radix-state-checked:hover:border-ws-dynamic-primary-strong-hover',\n          'radix-state-checked:active:bg-ws-dynamic-primary-alpha-pressed',\n          'radix-state-checked:active:border-ws-dynamic-primary-strong-pressed',\n        ),\n        danger: cn(\n          'outline-ws-dynamic-danger-strong-default bg-ws-static-highlight-base border-ws-dynamic-danger-strong-default',\n\n          'radix-state-unchecked:border-ws-dynamic-danger-strong-default',\n          'radix-state-unchecked:hover:border-ws-dynamic-danger-strong-hover',\n          'radix-state-unchecked:active:border-ws-dynamic-danger-strong-pressed',\n          'radix-state-unchecked:disabled:bg-ws-dynamic-secondary-alpha-default',\n          'radix-state-unchecked:disabled:border-ws-dynamic-secondary-disabled',\n\n          'radix-state-checked:bg-ws-dynamic-danger-alpha-default',\n          'radix-state-checked:hover:bg-ws-dynamic-danger-alpha-hover',\n          'radix-state-checked:hover:border-ws-dynamic-danger-strong-hover',\n          'radix-state-checked:active:bg-ws-dynamic-danger-alpha-pressed',\n          'radix-state-checked:active:border-ws-dynamic-danger-strong-pressed',\n        ),\n      },\n    },\n    defaultVariants: {\n      size: 'lg',\n      variant: 'primary',\n    },\n  },\n);\n\nexport const radioMotionVariants = cva('', {\n  variants: {\n    enabled: { true: boxFillMotion, false: '' },\n  },\n  defaultVariants: { enabled: true },\n});\n\nexport const radioIndicatorMotionVariants = cva('', {\n  variants: {\n    enabled: {\n      true: cn(\n        'animate-in fade-in-0 zoom-in-[0.4]',\n        'fill-mode-both duration-(--ws-motion-duration-fast) ease-(--ws-motion-ease-bounce)',\n      ),\n      false: '',\n    },\n  },\n  defaultVariants: { enabled: true },\n});\n\nexport const radioIndicatorVariants = cva(\n  cn(\n    'rounded-full',\n    'group-radix-state-unchecked:hidden group-disabled:bg-ws-dynamic-primary-disabled',\n  ),\n  {\n    variants: {\n      variant: {\n        primary: cn(\n          'bg-ws-dynamic-primary-default',\n          'group-hover:bg-ws-dynamic-primary-hover',\n          'group-active:bg-ws-dynamic-primary-pressed',\n        ),\n        danger: cn(\n          'bg-ws-dynamic-danger-default',\n          'group-hover:bg-ws-dynamic-danger-hover',\n          'group-active:bg-ws-dynamic-danger-pressed',\n        ),\n      },\n      size: {\n        // Figma binds the sm dot to Size/5 (=8px); the lg dot is an unbound raw 10px in Figma.\n        sm: 'size-ws-5',\n        lg: 'h-[10px] w-[10px]',\n      },\n    },\n  },\n);\n"
    },
    {
      "path": "src/components/radio-button/RadioButtonDescription.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/radio-button/RadioButtonDescription.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { useRadioButtonContext } from './RadioButton.context';\n\nexport const RadioButtonDescription = React.forwardRef<\n  HTMLSpanElement,\n  React.HTMLAttributes<HTMLSpanElement>\n>(({ children, className, onClick, ...props }, ref) => {\n  const { disabled, id } = useRadioButtonContext();\n\n  const handleClick = (event: React.MouseEvent<HTMLSpanElement>) => {\n    onClick?.(event);\n\n    if (event.defaultPrevented || disabled || !id) return;\n\n    document.getElementById(id)?.click();\n  };\n\n  return (\n    // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions\n    <span\n      ref={ref}\n      className={cn(\n        'text-ws-static-subtle typography-body-sm cursor-pointer',\n        disabled && 'pointer-events-none',\n        className,\n      )}\n      onClick={handleClick}\n      data-slot=\"radio-button-description\"\n      {...props}\n    >\n      {children}\n    </span>\n  );\n});\n\nRadioButtonDescription.displayName = 'RadioButton.Description';\n"
    },
    {
      "path": "src/components/radio-button/RadioButtonGroup.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/radio-button/RadioButtonGroup.tsx",
      "content": "'use client';\n\nimport * as RadioGroupPrimitive from '@radix-ui/react-radio-group';\nimport * as React from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport type { RadioButtonGroupProps } from './RadioButton.types';\n\nconst RadioButtonGroup = React.forwardRef<\n  React.ComponentRef<typeof RadioGroupPrimitive.Root>,\n  RadioButtonGroupProps\n>(({ orientation = 'vertical', className, ...props }, ref) => (\n  <RadioGroupPrimitive.Root\n    ref={ref}\n    orientation={orientation}\n    className={cn(\n      'flex',\n      orientation === 'vertical' ? 'gap-ws-7 flex-col' : 'gap-ws-11',\n      className,\n    )}\n    data-slot=\"radio-button-group\"\n    {...props}\n  />\n));\n\nRadioButtonGroup.displayName = 'RadioButton.Group';\n\nexport { RadioButtonGroup };\n"
    },
    {
      "path": "src/components/radio-button/RadioButtonLabel.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/radio-button/RadioButtonLabel.tsx",
      "content": "'use client';\n\nimport * as Label from '@radix-ui/react-label';\nimport * as React from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { useRadioButtonContext } from './RadioButton.context';\nimport type { RadioButtonLabelProps } from './RadioButton.types';\n\nexport const RadioButtonLabel = React.forwardRef<HTMLLabelElement, RadioButtonLabelProps>(\n  ({ children, htmlFor, className, ...props }, ref) => {\n    const { disabled, id } = useRadioButtonContext();\n\n    return (\n      <Label.Root\n        ref={ref}\n        htmlFor={htmlFor || id}\n        className={cn(\n          'typography-label-sm text-ws-static-base cursor-pointer',\n          disabled && 'text-ws-static-subtle pointer-events-none',\n          className,\n        )}\n        data-slot=\"radio-button-label\"\n        {...props}\n      >\n        {children}\n      </Label.Root>\n    );\n  },\n);\n\nRadioButtonLabel.displayName = 'RadioButton.Label';\n"
    }
  ],
  "meta": {
    "version": "1.0.0",
    "commit": "8bb3627"
  }
}
