{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "checkbox-spring",
  "type": "registry:component",
  "title": "Spring Checkbox",
  "description": "A checkbox whose box springs past its size when checked while the tick draws itself and bounces in. Supports a label and an indeterminate state.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "micro",
    "checkbox",
    "form",
    "spring",
    "check",
    "indeterminate",
    "input"
  ],
  "docs": "https://hyperblur.dev/effects/checkbox-spring",
  "files": [
    {
      "path": "registry/hyperblur/checkbox-spring.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/checkbox-spring.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface CheckboxSpringProps\n  extends Omit<React.LabelHTMLAttributes<HTMLLabelElement>, \"onChange\" | \"defaultChecked\"> {\n  checked?: boolean;\n  defaultChecked?: boolean;\n  onCheckedChange?: (checked: boolean) => void;\n  indeterminate?: boolean;\n  label?: React.ReactNode;\n  description?: React.ReactNode;\n  accent?: string;\n  size?: number;\n  disabled?: boolean;\n  name?: string;\n  value?: string;\n}\n\nconst css = `\n.hb-qr6 {\n  display: inline-flex;\n  align-items: flex-start;\n  gap: 10px;\n  position: relative;\n  box-sizing: border-box;\n  font-family: inherit;\n  color: #ededed;\n  cursor: pointer;\n  user-select: none;\n  -webkit-tap-highlight-color: transparent;\n}\n.hb-qr6[data-disabled=\"true\"] { opacity: 0.45; cursor: not-allowed; }\n.hb-qr6-i {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  margin: 0;\n  opacity: 0;\n  pointer-events: none;\n}\n.hb-qr6-b {\n  flex: none;\n  display: grid;\n  place-items: center;\n  box-sizing: border-box;\n  border: 1.5px solid #3d3d3d;\n  border-radius: 28%;\n  background: #0f0f0f;\n  color: #ffffff;\n  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);\n}\n.hb-qr6:not([data-disabled=\"true\"]):hover .hb-qr6-b { border-color: #6a6a6a; }\n.hb-qr6:not([data-disabled=\"true\"]):active .hb-qr6-b { transform: scale(0.86); }\n.hb-qr6-i:focus-visible ~ .hb-qr6-b {\n  outline: 2px solid var(--hb-qr6-a);\n  outline-offset: 3px;\n}\n.hb-qr6[data-state=\"on\"] .hb-qr6-b {\n  background: var(--hb-qr6-a);\n  border-color: var(--hb-qr6-a);\n  animation: hb-qr6-pop 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;\n}\n.hb-qr6[data-state=\"mixed\"] .hb-qr6-b {\n  background: var(--hb-qr6-a);\n  border-color: var(--hb-qr6-a);\n  animation: hb-qr6-pop2 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;\n}\n.hb-qr6-s {\n  width: 76%;\n  height: 76%;\n  overflow: visible;\n  fill: none;\n  stroke: currentColor;\n  stroke-width: 3;\n  stroke-linecap: round;\n  stroke-linejoin: round;\n  opacity: 0;\n  transform: scale(0.4);\n  transition: opacity 0.14s ease, transform 0.14s ease;\n}\n.hb-qr6-c,\n.hb-qr6-m {\n  stroke-dasharray: 1;\n  stroke-dashoffset: 1;\n  transition: stroke-dashoffset 0.28s ease 0.1s;\n}\n.hb-qr6[data-state=\"on\"] .hb-qr6-s {\n  opacity: 1;\n  transform: scale(1);\n  animation: hb-qr6-bounce 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) 0.08s backwards;\n}\n.hb-qr6[data-state=\"on\"] .hb-qr6-c { stroke-dashoffset: 0; }\n.hb-qr6[data-state=\"mixed\"] .hb-qr6-s {\n  opacity: 1;\n  transform: scale(1);\n  animation: hb-qr6-bounce2 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) 0.08s backwards;\n}\n.hb-qr6[data-state=\"mixed\"] .hb-qr6-m { stroke-dashoffset: 0; }\n.hb-qr6-t {\n  display: flex;\n  min-width: 0;\n  flex-direction: column;\n  gap: 1px;\n}\n.hb-qr6-l {\n  font-size: 14px;\n  font-weight: 500;\n  line-height: 1.3;\n}\n.hb-qr6-x {\n  font-size: 12px;\n  line-height: 1.35;\n  color: #8f8f8f;\n}\n@keyframes hb-qr6-pop {\n  0% { transform: scale(0.78); }\n  30% { transform: scale(1.26); }\n  50% { transform: scale(0.9); }\n  70% { transform: scale(1.07); }\n  100% { transform: scale(1); }\n}\n@keyframes hb-qr6-pop2 {\n  0% { transform: scale(0.78); }\n  30% { transform: scale(1.26); }\n  50% { transform: scale(0.9); }\n  70% { transform: scale(1.07); }\n  100% { transform: scale(1); }\n}\n@keyframes hb-qr6-bounce {\n  0% { transform: scale(0) rotate(-14deg); }\n  45% { transform: scale(1.4) rotate(6deg); }\n  65% { transform: scale(0.82) rotate(-3deg); }\n  82% { transform: scale(1.1) rotate(0); }\n  100% { transform: scale(1) rotate(0); }\n}\n@keyframes hb-qr6-bounce2 {\n  0% { transform: scale(0) rotate(-14deg); }\n  45% { transform: scale(1.4) rotate(6deg); }\n  65% { transform: scale(0.82) rotate(-3deg); }\n  82% { transform: scale(1.1) rotate(0); }\n  100% { transform: scale(1) rotate(0); }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-qr6-b, .hb-qr6-s, .hb-qr6-c, .hb-qr6-m { transition: none; }\n  .hb-qr6[data-state=\"on\"] .hb-qr6-b,\n  .hb-qr6[data-state=\"mixed\"] .hb-qr6-b,\n  .hb-qr6[data-state=\"on\"] .hb-qr6-s,\n  .hb-qr6[data-state=\"mixed\"] .hb-qr6-s { animation: none; }\n  .hb-qr6:not([data-disabled=\"true\"]):active .hb-qr6-b { transform: none; }\n}\n`;\n\nexport function CheckboxSpring({\n  checked,\n  defaultChecked = false,\n  onCheckedChange,\n  indeterminate = false,\n  label,\n  description,\n  accent = \"#2f7bff\",\n  size = 22,\n  disabled = false,\n  name,\n  value,\n  className = \"\",\n  style,\n  ...rest\n}: CheckboxSpringProps) {\n  const inputRef = React.useRef<HTMLInputElement>(null);\n  const [inner, setInner] = React.useState(defaultChecked);\n  const controlled = checked !== undefined;\n  const on = controlled ? checked : inner;\n  const state = indeterminate ? \"mixed\" : on ? \"on\" : \"off\";\n\n  React.useEffect(() => {\n    if (inputRef.current) inputRef.current.indeterminate = indeterminate;\n  }, [indeterminate]);\n\n  return (\n    <label\n      data-state={state}\n      data-disabled={disabled ? \"true\" : \"false\"}\n      className={`hb-qr6 ${className}`.trim()}\n      style={{ [\"--hb-qr6-a\" as string]: accent, ...style } as React.CSSProperties}\n      {...rest}\n    >\n      <style href=\"hb-checkbox-spring\" precedence=\"default\">\n        {css}\n      </style>\n      <input\n        ref={inputRef}\n        type=\"checkbox\"\n        className=\"hb-qr6-i\"\n        name={name}\n        value={value}\n        checked={on}\n        disabled={disabled}\n        onChange={(e) => {\n          const next = e.target.checked;\n          if (!controlled) setInner(next);\n          onCheckedChange?.(next);\n        }}\n      />\n      <span className=\"hb-qr6-b\" aria-hidden=\"true\" style={{ width: size, height: size }}>\n        <svg className=\"hb-qr6-s\" viewBox=\"0 0 24 24\">\n          <path className=\"hb-qr6-c\" d=\"M5.5 12.8 10 17.2 18.5 7\" pathLength={1} />\n          <path className=\"hb-qr6-m\" d=\"M6 12h12\" pathLength={1} />\n        </svg>\n      </span>\n      {label || description ? (\n        <span className=\"hb-qr6-t\">\n          {label ? <span className=\"hb-qr6-l\">{label}</span> : null}\n          {description ? <span className=\"hb-qr6-x\">{description}</span> : null}\n        </span>\n      ) : null}\n    </label>\n  );\n}\n"
    }
  ]
}