{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "radio-jelly",
  "type": "registry:component",
  "title": "Jelly Radio",
  "description": "A radio group whose selected dot squashes and stretches like jelly when it is chosen, while the label slides over. Arrow keys work out of the box.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "micro",
    "radio",
    "form",
    "jelly",
    "spring",
    "group",
    "input"
  ],
  "docs": "https://hyperblur.dev/effects/radio-jelly",
  "files": [
    {
      "path": "registry/hyperblur/radio-jelly.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/radio-jelly.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface RadioJellyOption {\n  value: string;\n  label: React.ReactNode;\n  description?: React.ReactNode;\n  disabled?: boolean;\n}\n\nexport interface RadioJellyProps\n  extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\" | \"defaultValue\"> {\n  options: RadioJellyOption[];\n  value?: string;\n  defaultValue?: string;\n  onValueChange?: (value: string) => void;\n  name?: string;\n  accent?: string;\n  size?: number;\n  direction?: \"vertical\" | \"horizontal\";\n  disabled?: boolean;\n}\n\nconst css = `\n.hb-qr5 {\n  display: flex;\n  flex-direction: column;\n  gap: 2px;\n  box-sizing: border-box;\n  font-family: inherit;\n  color: #ededed;\n}\n.hb-qr5[data-direction=\"horizontal\"] {\n  flex-direction: row;\n  flex-wrap: wrap;\n  gap: 4px 12px;\n}\n.hb-qr5-o {\n  position: relative;\n  display: flex;\n  align-items: center;\n  gap: 12px;\n  box-sizing: border-box;\n  padding: 8px 10px;\n  border-radius: 12px;\n  cursor: pointer;\n  user-select: none;\n  -webkit-tap-highlight-color: transparent;\n  transition: background 0.2s ease;\n}\n.hb-qr5-o:hover { background: rgba(255, 255, 255, 0.04); }\n.hb-qr5-o[data-disabled=\"true\"] { opacity: 0.45; cursor: not-allowed; }\n.hb-qr5-o[data-disabled=\"true\"]:hover { background: transparent; }\n.hb-qr5-i {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  margin: 0;\n  opacity: 0;\n  pointer-events: none;\n}\n.hb-qr5-r {\n  position: relative;\n  flex: none;\n  width: var(--hb-qr5-z);\n  height: var(--hb-qr5-z);\n  box-sizing: border-box;\n  border: 2px solid #3a3a3a;\n  border-radius: 50%;\n  background: #0f0f0f;\n  display: grid;\n  place-items: center;\n  transition: border-color 0.25s ease, box-shadow 0.25s ease;\n}\n.hb-qr5-o:hover .hb-qr5-r { border-color: #5a5a5a; }\n.hb-qr5-i:focus-visible ~ .hb-qr5-r {\n  outline: 2px solid var(--hb-qr5-a);\n  outline-offset: 3px;\n}\n.hb-qr5-d {\n  width: 56%;\n  height: 56%;\n  border-radius: 50%;\n  background: radial-gradient(circle at 34% 28%, color-mix(in srgb, var(--hb-qr5-a) 35%, #ffffff) 0%, var(--hb-qr5-a) 55%);\n  transform: scale(0);\n  opacity: 0;\n  transition: transform 0.16s ease, opacity 0.16s ease;\n}\n.hb-qr5-o[data-checked=\"true\"] .hb-qr5-r {\n  border-color: var(--hb-qr5-a);\n  box-shadow: 0 0 0 4px color-mix(in srgb, var(--hb-qr5-a) 16%, transparent);\n  animation: hb-qr5-ring 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);\n}\n.hb-qr5-o[data-checked=\"true\"] .hb-qr5-d {\n  opacity: 1;\n  animation: hb-qr5-jelly 0.85s linear both;\n}\n.hb-qr5-t {\n  display: flex;\n  min-width: 0;\n  flex-direction: column;\n  gap: 1px;\n  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);\n}\n.hb-qr5-o[data-checked=\"true\"] .hb-qr5-t { transform: translateX(3px); }\n.hb-qr5-l {\n  font-size: 14px;\n  font-weight: 500;\n  line-height: 1.3;\n  color: #bdbdbd;\n  transition: color 0.2s ease;\n}\n.hb-qr5-o[data-checked=\"true\"] .hb-qr5-l { color: #ffffff; }\n.hb-qr5-x {\n  font-size: 12px;\n  line-height: 1.35;\n  color: #8f8f8f;\n}\n@keyframes hb-qr5-jelly {\n  0% { transform: scale(0, 0); }\n  18% { transform: scale(1.5, 0.62); }\n  34% { transform: scale(0.76, 1.34); }\n  50% { transform: scale(1.18, 0.88); }\n  66% { transform: scale(0.94, 1.07); }\n  82% { transform: scale(1.03, 0.98); }\n  100% { transform: scale(1, 1); }\n}\n@keyframes hb-qr5-ring {\n  0% { transform: scale(1); }\n  25% { transform: scale(0.88, 1.1); }\n  50% { transform: scale(1.1, 0.92); }\n  75% { transform: scale(0.97, 1.03); }\n  100% { transform: scale(1); }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-qr5-o, .hb-qr5-r, .hb-qr5-d, .hb-qr5-t, .hb-qr5-l { transition: none; }\n  .hb-qr5-o[data-checked=\"true\"] .hb-qr5-r,\n  .hb-qr5-o[data-checked=\"true\"] .hb-qr5-d { animation: none; transform: none; }\n  .hb-qr5-o[data-checked=\"true\"] .hb-qr5-t { transform: none; }\n}\n`;\n\nexport function RadioJelly({\n  options,\n  value,\n  defaultValue,\n  onValueChange,\n  name,\n  accent = \"#2f7bff\",\n  size = 22,\n  direction = \"vertical\",\n  disabled = false,\n  className = \"\",\n  style,\n  ...rest\n}: RadioJellyProps) {\n  const autoName = React.useId();\n  const groupName = name ?? autoName;\n  const [inner, setInner] = React.useState<string | undefined>(defaultValue);\n  const controlled = value !== undefined;\n  const current = controlled ? value : inner;\n\n  function pick(next: string) {\n    if (!controlled) setInner(next);\n    if (next !== current) onValueChange?.(next);\n  }\n\n  return (\n    <div\n      role=\"radiogroup\"\n      data-direction={direction}\n      className={`hb-qr5 ${className}`.trim()}\n      style={\n        {\n          [\"--hb-qr5-a\" as string]: accent,\n          [\"--hb-qr5-z\" as string]: `${size}px`,\n          ...style,\n        } as React.CSSProperties\n      }\n      {...rest}\n    >\n      <style href=\"hb-radio-jelly\" precedence=\"default\">\n        {css}\n      </style>\n      {options.map((option) => {\n        const off = disabled || option.disabled === true;\n        const checked = current === option.value;\n        return (\n          <label\n            key={option.value}\n            className=\"hb-qr5-o\"\n            data-checked={checked ? \"true\" : \"false\"}\n            data-disabled={off ? \"true\" : \"false\"}\n          >\n            <input\n              type=\"radio\"\n              className=\"hb-qr5-i\"\n              name={groupName}\n              value={option.value}\n              checked={checked}\n              disabled={off}\n              onChange={() => pick(option.value)}\n            />\n            <span className=\"hb-qr5-r\" aria-hidden=\"true\">\n              <span className=\"hb-qr5-d\" />\n            </span>\n            <span className=\"hb-qr5-t\">\n              <span className=\"hb-qr5-l\">{option.label}</span>\n              {option.description ? <span className=\"hb-qr5-x\">{option.description}</span> : null}\n            </span>\n          </label>\n        );\n      })}\n    </div>\n  );\n}\n"
    }
  ]
}