(null);\n const { registerItem, activeIndex, disabled, readOnly, selectedIndex, selectedValue, onValueChange, hasSelection, } = useRadioGroupContext();\n useEffect(() => {\n registerItem(index, internalRef.current);\n return () => registerItem(index, null);\n }, [index, registerItem]);\n const isActive = activeIndex === index;\n const isSelected = value !== undefined && selectedValue !== undefined\n ? selectedValue === value\n : selected ?? selectedIndex === index;\n const handleSelect = () => {\n if (disabled || readOnly)\n return;\n if (value !== undefined) {\n onValueChange?.(value);\n }\n onSelect?.();\n };\n const radioValue = value ?? `__zeron-radio-index-${index}`;\n return ( {\n (internalRef as React.MutableRefObject).current = node;\n if (typeof ref === \"function\")\n ref(node);\n else if (ref)\n (ref as React.MutableRefObject).current = node;\n }} data-proximity-index={index} \n // Roving tabindex: selected item is the tab stop; with no selection the\n // first item takes it so the group stays keyboard-reachable.\n tabIndex={disabled ? -1 : isSelected ? 0 : !hasSelection && index === 0 ? 0 : -1} role=\"radio\" aria-checked={isSelected} aria-disabled={disabled || undefined} aria-label={label} aria-readonly={readOnly || undefined} onClick={handleSelect} onMouseDown={(e) => {\n // Clicking the 15px radio circle would natively focus the hidden\n // primitive (nearest focusable ancestor of the click target), after\n // which arrow-key nav dead-zones: the group keydown handler can't\n // find the target among the row wrappers. Prevent the native focus\n // move (click still fires) and land focus on the row instead. Skip\n // genuinely interactive children so we don't hijack their focus.\n const interactive = (e.target as HTMLElement).closest('button:not([tabindex=\"-1\"]), a[href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])');\n if (interactive && interactive !== e.currentTarget)\n return;\n e.preventDefault();\n e.currentTarget.focus();\n }} onKeyDown={(e) => {\n if (e.key === \" \" || e.key === \"Enter\") {\n e.preventDefault();\n handleSelect();\n }\n }} className={cn(\n // Fixed height keeps every option row aligned and easy to target.\n `relative z-content flex h-control-sm items-center gap-2.5 rounded-lg px-3 cursor-pointer outline-none`, disabled && \"pointer-events-none opacity-50\", readOnly && \"cursor-default\", className)} {...props}>\n \n\n {/* The invisible bold copy reserves width so weight changes do not reflow. */}\n \n \n {label}\n \n \n {label}\n \n \n\n
);\n});\nRadioItem.displayName = \"RadioItem\";\nexport { RadioGroup, RadioGroupItem, RadioItem };\nexport default RadioGroup;\n",
"type": "registry:ui",
"target": "components/ui/radio-group.tsx"
}
]
}