{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "sign-in-card",
  "title": "Sign-in Card",
  "type": "registry:block",
  "description": "Magic-link sign-in with validation, shake and sent state",
  "dependencies": [
    "motion@^12.43.0"
  ],
  "files": [
    {
      "path": "src/kavyn/sign-in-card.jsx",
      "type": "registry:file",
      "target": "@components/kavyn/sign-in-card.jsx",
      "content": "'use client'\n\nimport { useState } from 'react'\nimport { motion, AnimatePresence } from 'motion/react'\n\nconst valid = (v) => /^[^\\s@]+@[^\\s@]+\\.[^\\s@]{2,}$/.test(v)\n\n// Block: magic-link sign-in. Validates as you type, shakes on a bad address, confirms with a sent state.\n/** @param {{ product?: any, onSubmit?: any }} props */\nexport default function SignInCard({ product = 'Acme', onSubmit = undefined }) {\n  const [email, setEmail] = useState('')\n  const [state, setState] = useState('idle')\n  const [shake, setShake] = useState(0)\n  const submit = async (e) => {\n    e.preventDefault()\n    if (!valid(email)) { setShake((n) => n + 1); return }\n    setState('sending')\n    try { await (onSubmit ? onSubmit(email) : new Promise((r) => setTimeout(r, 900))); setState('sent') } catch { setState('error') }\n  }\n  return (\n    <section className=\"@container grid w-full place-items-center rounded-2xl border border-line bg-bg p-6 @2xl:p-12\">\n      <div className=\"w-full max-w-sm rounded-2xl border border-line bg-panel p-6\">\n        <AnimatePresence mode=\"wait\" initial={false}>\n          {state === 'sent' ? (\n            <motion.div key=\"sent\" initial={{ opacity: 0, scale: 0.96 }} animate={{ opacity: 1, scale: 1 }} exit={{ opacity: 0 }} className=\"py-4 text-center\">\n              <motion.svg viewBox=\"0 0 24 24\" className=\"mx-auto size-10 text-emerald-400\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\"><motion.path d=\"M4 12.5 9.5 18 20 6\" initial={{ pathLength: 0 }} animate={{ pathLength: 1 }} transition={{ duration: 0.5 }} /></motion.svg>\n              <h3 className=\"mt-4 text-base font-medium text-tx\">Check your inbox</h3>\n              <p className=\"mt-1 text-sm text-mute\">We sent a sign-in link to <span className=\"text-tx\">{email}</span></p>\n              <button type=\"button\" onClick={() => setState('idle')} className=\"mt-5 text-xs text-mute underline underline-offset-4 hover:text-tx\">Use a different email</button>\n            </motion.div>\n          ) : (\n            <motion.form key=\"form\" onSubmit={submit} noValidate initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }}>\n              <h3 className=\"text-lg font-medium tracking-tight text-tx\">Sign in to {product}</h3>\n              <p className=\"mt-1 text-sm text-mute\">No password. We will email you a link.</p>\n              <button type=\"button\" className=\"mt-5 flex h-10 w-full items-center justify-center gap-2 rounded-lg border border-line2 bg-bg text-sm text-tx hover:bg-panel2\">\n                <svg viewBox=\"0 0 24 24\" className=\"size-4\" fill=\"currentColor\"><path d=\"M12 .5a11.5 11.5 0 0 0-3.6 22.4c.6.1.8-.3.8-.6v-2c-3.2.7-3.9-1.5-3.9-1.5-.5-1.3-1.3-1.7-1.3-1.7-1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1 1.8 2.8 1.3 3.5 1 .1-.8.4-1.3.7-1.6-2.6-.3-5.3-1.3-5.3-5.7 0-1.3.5-2.3 1.2-3.1-.1-.3-.5-1.5.1-3.1 0 0 1-.3 3.2 1.2a11 11 0 0 1 5.8 0C17.3 4.8 18.3 5.1 18.3 5.1c.6 1.6.2 2.8.1 3.1.8.8 1.2 1.9 1.2 3.1 0 4.4-2.7 5.4-5.3 5.7.4.4.8 1.1.8 2.2v3.2c0 .3.2.7.8.6A11.5 11.5 0 0 0 12 .5Z\" /></svg>\n                Continue with GitHub\n              </button>\n              <div className=\"my-4 flex items-center gap-3 text-[11px] text-faint\"><span className=\"h-px flex-1 bg-line\" />or<span className=\"h-px flex-1 bg-line\" /></div>\n              <motion.label key={shake} animate={shake ? { x: [0, -8, 8, -5, 5, 0] } : {}} transition={{ duration: 0.4 }}\n                className={`flex h-10 items-center rounded-lg border bg-bg px-3 transition-colors focus-within:border-acc/70 ${shake && !valid(email) ? 'border-rose-500/60' : 'border-line2'}`}>\n                <input type=\"email\" inputMode=\"email\" autoComplete=\"email\" maxLength={254} value={email} onChange={(e) => setEmail(e.target.value.trim())} placeholder=\"you@company.com\" aria-label=\"Email\" className=\"min-w-0 flex-1 bg-transparent text-sm text-tx outline-none placeholder:text-faint\" />\n                {valid(email) && <motion.span initial={{ scale: 0 }} animate={{ scale: 1 }} className=\"text-xs text-emerald-400\">✓</motion.span>}\n              </motion.label>\n              {state === 'error' && <p className=\"mt-2 text-xs text-rose-400\">Could not send the link. Check your connection and try again.</p>}\n              <button type=\"submit\" disabled={state === 'sending'} className=\"mt-3 flex h-10 w-full items-center justify-center rounded-lg bg-tx text-sm font-medium text-bg disabled:opacity-60\">\n                {state === 'sending' ? <motion.span className=\"size-4 rounded-full border-2 border-bg/30 border-t-bg\" animate={{ rotate: 360 }} transition={{ repeat: Infinity, duration: 0.7, ease: 'linear' }} /> : 'Email me a link'}\n              </button>\n            </motion.form>\n          )}\n        </AnimatePresence>\n      </div>\n    </section>\n  )\n}\n"
    }
  ],
  "cssVars": {
    "theme": {
      "color-bg": "var(--bg)",
      "color-panel": "var(--panel)",
      "color-panel2": "var(--panel2)",
      "color-line": "var(--line)",
      "color-line2": "var(--line2)",
      "color-tx": "var(--tx)",
      "color-mute": "var(--mute)",
      "color-faint": "var(--faint)",
      "color-acc": "var(--acc)",
      "color-acc-fg": "var(--acc-fg)"
    },
    "light": {
      "bg": "#ffffff",
      "panel": "#f5f5f7",
      "panel2": "#e8e8ed",
      "line": "#e5e5ea",
      "line2": "#d2d2d7",
      "tx": "#1d1d1f",
      "mute": "#6e6e73",
      "faint": "#a1a1a6",
      "acc": "#1d1d1f",
      "acc-fg": "#ffffff"
    },
    "dark": {
      "bg": "#000000",
      "panel": "#141416",
      "panel2": "#1f1f22",
      "line": "#262628",
      "line2": "#3a3a3d",
      "tx": "#f5f5f7",
      "mute": "#a1a1a6",
      "faint": "#6e6e73",
      "acc": "#f5f5f7",
      "acc-fg": "#000000"
    }
  },
  "css": {
    ".light": {
      "--bg": "#ffffff",
      "--panel": "#f5f5f7",
      "--panel2": "#e8e8ed",
      "--line": "#e5e5ea",
      "--line2": "#d2d2d7",
      "--tx": "#1d1d1f",
      "--mute": "#6e6e73",
      "--faint": "#a1a1a6",
      "--acc": "#1d1d1f",
      "--acc-fg": "#ffffff"
    }
  }
}
