{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"sign-in","type":"registry:block","title":"Sign in","description":"A sign in card that morphs from email to a six digit code to your account.","categories":["blocks"],"dependencies":["lucide-react","motion"],"registryDependencies":["https://ui.teamofsilicons.com/r/silicon-motion-tokens.json","https://ui.teamofsilicons.com/r/avatar.json","https://ui.teamofsilicons.com/r/button.json","https://ui.teamofsilicons.com/r/input.json","https://ui.teamofsilicons.com/r/otp-input.json"],"files":[{"path":"registry/blocks/sign-in/sign-in.tsx","type":"registry:component","target":"@components/silicon-ui/blocks/sign-in/sign-in.tsx","content":"\"use client\";\n\nimport { useCallback, useEffect, useLayoutEffect, useId, useRef, useState, type FormEvent } from \"react\";\nimport { AnimatePresence, LayoutGroup, animate, motion, useMotionValue, useReducedMotion, type Transition, type Variants } from \"motion/react\";\nimport { Check, KeyRound } from \"lucide-react\";\nimport { Avatar } from \"../../avatar/avatar\";\nimport { Button } from \"../../button/button\";\nimport { Input } from \"../../input/input\";\nimport { OtpInput } from \"../../otp-input/otp-input\";\nimport { avatar } from \"../../lib/media\";\nimport { motionTokens } from \"../../lib/motion-tokens\";\nimport styles from \"./sign-in.module.css\";\n\ntype Step = \"email\" | \"code\" | \"done\";\ntype Provider = \"Google\" | \"Apple\" | \"GitHub\";\nexport type SignInMethod = \"Email code\" | \"Passkey\" | Provider;\nexport interface SignInAccount { name: string; email: string; photo?: string }\nexport interface SignInProps {\n  /** The code the simulated email contains. */\n  demoCode?: string;\n  /** Called once the simulated sign in succeeds. */\n  onSignIn?: (account: SignInAccount, method: SignInMethod) => void;\n}\ntype StepCustom = { direction: number; reduce: boolean; still?: boolean };\n\nconst RESEND_SECONDS = 30;\nconst providers: Provider[] = [\"Google\", \"Apple\", \"GitHub\"];\n/** The official four-colour Google \"G\"; Apple and GitHub ship monochrome marks, drawn in currentColor below. */\nfunction GoogleLogo() {\n  return <svg className={styles.providerMark} width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n    <path fill=\"#4285F4\" d=\"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z\" />\n    <path fill=\"#34A853\" d=\"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z\" />\n    <path fill=\"#FBBC05\" d=\"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z\" />\n    <path fill=\"#EA4335\" d=\"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z\" />\n  </svg>;\n}\nconst providerMarks: Record<Provider, string> = {\n  Google: \"M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z\",\n  Apple: \"M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701\",\n  GitHub: \"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12\",\n};\nconst people: SignInAccount[] = [\n  { name: \"Emma Collins\", email: \"emma@northwind.studio\", photo: avatar(\"emma-collins\") },\n  { name: \"Marcus Johnson\", email: \"marcus@northwind.studio\", photo: avatar(\"marcus-johnson\") },\n  { name: \"Ava Mitchell\", email: \"ava@northwind.studio\", photo: avatar(\"ava-mitchell\") },\n  { name: \"Jasmine Brooks\", email: \"jasmine@northwind.studio\", photo: avatar(\"jasmine-brooks\") },\n  { name: \"Sofia Ramirez\", email: \"sofia@northwind.studio\", photo: avatar(\"sofia-ramirez\") },\n];\nconst domainFixes: Record<string, string> = { \"gmial.com\": \"gmail.com\", \"gamil.com\": \"gmail.com\", \"gmai.com\": \"gmail.com\", \"gnail.com\": \"gmail.com\", \"gmail.co\": \"gmail.com\", \"hotmial.com\": \"hotmail.com\", \"outlok.com\": \"outlook.com\", \"outlook.co\": \"outlook.com\", \"iclod.com\": \"icloud.com\", \"icoud.com\": \"icloud.com\", \"yaho.com\": \"yahoo.com\" };\n\nconst isEmail = (value: string) => /^[^\\s@]+@[^\\s@]+\\.[^\\s@]{2,}$/.test(value.trim());\nfunction suggestionFor(value: string) {\n  const [local, domain, extra] = value.trim().toLowerCase().split(\"@\");\n  return local && domain && extra === undefined && domainFixes[domain] ? `${local}@${domainFixes[domain]}` : \"\";\n}\n/** Known teammates keep their photo; anyone else gets a name from their address and an initials avatar. */\nfunction accountFor(value: string): SignInAccount {\n  const email = value.trim().toLowerCase();\n  const parts = email.split(\"@\")[0]!.split(/[._+-]+/).filter(Boolean);\n  const known = people.find(person => person.name.toLowerCase().split(\" \")[0] === parts[0]);\n  if (known) return { ...known, email };\n  return { name: parts.slice(0, 2).map(part => part[0]!.toUpperCase() + part.slice(1)).join(\" \") || \"Silicon member\", email };\n}\n\nconst stepMotion: Variants = {\n  enter: ({ direction, reduce, still }: StepCustom) => still ? { opacity: 1, x: 0, filter: \"blur(0px)\" } : reduce ? { opacity: 0 } : { opacity: 0, x: direction * 28, filter: `blur(${motionTokens.blur.soft}px)` },\n  center: ({ reduce }: StepCustom) => ({ opacity: 1, x: 0, filter: \"blur(0px)\", transition: reduce ? { duration: motionTokens.duration.instant } : { x: motionTokens.spring.smooth, opacity: { duration: motionTokens.duration.standard, ease: motionTokens.ease.enter, delay: .05 }, filter: { duration: motionTokens.duration.standard, ease: motionTokens.ease.enter } } }),\n  exit: ({ direction, reduce }: StepCustom) => reduce ? { opacity: 0, transition: { duration: 0 } } : { opacity: 0, x: direction * -20, filter: `blur(${motionTokens.blur.soft}px)`, transition: { x: motionTokens.spring.smooth, opacity: { duration: motionTokens.duration.exit, ease: motionTokens.ease.standard }, filter: { duration: motionTokens.duration.exit } } },\n};\n/** Seconds roll down while the timer runs and back up when a new code restarts it. */\nconst roll: Variants = {\n  enter: (direction: number) => ({ opacity: 0, y: `${-0.7 * direction}em`, filter: `blur(${motionTokens.blur.subtle}px)` }),\n  center: { opacity: 1, y: 0, filter: \"blur(0px)\" },\n  exit: (direction: number) => ({ opacity: 0, y: `${0.7 * direction}em`, filter: `blur(${motionTokens.blur.subtle}px)` }),\n};\n\nfunction RollingTime({ seconds, reduce }: { seconds: number; reduce: boolean }) {\n  const [shown, setShown] = useState({ seconds, direction: 1 });\n  if (shown.seconds !== seconds) setShown({ seconds, direction: seconds < shown.seconds ? 1 : -1 });\n  const text = `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, \"0\")}`;\n  const transition: Transition = reduce ? { duration: 0 } : { y: motionTokens.spring.snappy, opacity: { duration: motionTokens.duration.fast }, filter: { duration: motionTokens.duration.fast } };\n  return <span className={styles.time}>{text.split(\"\").map((character, index) => <span key={index} className={styles.timeColumn}>\n    <AnimatePresence initial={false} mode=\"popLayout\" custom={shown.direction}><motion.span key={character} custom={shown.direction} variants={roll} initial=\"enter\" animate=\"center\" exit=\"exit\" transition={transition}>{character}</motion.span></AnimatePresence>\n  </span>)}</span>;\n}\n\n/** The card follows its content on a spring only while the step changes; otherwise it stays auto, so field messages open without lag. */\nfunction useStepHeight(step: Step, reduce: boolean) {\n  const track = useRef<HTMLDivElement>(null);\n  const height = useMotionValue<number | \"auto\">(\"auto\");\n  const measured = useRef(0);\n  const gliding = useRef(false);\n  const lastStep = useRef(step);\n  const glide = useCallback((to: number) => {\n    gliding.current = true;\n    animate(height, to, { ...motionTokens.spring.smooth, onComplete: () => { gliding.current = false; height.jump(\"auto\"); } });\n  }, [height]);\n  useEffect(() => {\n    const node = track.current;\n    if (!node || typeof ResizeObserver === \"undefined\") return;\n    const observer = new ResizeObserver(([entry]) => {\n      if (!entry) return;\n      measured.current = entry.borderBoxSize?.[0]?.blockSize ?? node.offsetHeight;\n      if (gliding.current) glide(measured.current);\n    });\n    observer.observe(node);\n    return () => observer.disconnect();\n  }, [glide]);\n  useLayoutEffect(() => {\n    if (lastStep.current === step) return;\n    lastStep.current = step;\n    const current = height.get();\n    const from = typeof current === \"number\" ? current : measured.current;\n    const to = track.current?.offsetHeight ?? 0;\n    if (reduce || !from || !to) { gliding.current = false; height.jump(\"auto\"); return; }\n    if (current === \"auto\") height.jump(from);\n    glide(to);\n  }, [step, reduce, height, glide]);\n  return { track, height };\n}\n\nexport function SignIn({ demoCode = \"123456\", onSignIn }: SignInProps) {\n  const id = useId();\n  const reduce = !!useReducedMotion();\n  const [step, setStep] = useState<Step>(\"email\");\n  const [direction, setDirection] = useState(1);\n  const [email, setEmail] = useState(\"\");\n  const [touched, setTouched] = useState(false);\n  const [attempted, setAttempted] = useState(false);\n  const [code, setCode] = useState(\"\");\n  const [codeError, setCodeError] = useState(\"\");\n  const [resendIn, setResendIn] = useState(RESEND_SECONDS);\n  const [busy, setBusy] = useState<null | \"email\" | \"code\" | \"passkey\" | Provider>(null);\n  const [account, setAccount] = useState<SignInAccount>(people[0]!);\n  const [method, setMethod] = useState<SignInMethod>(\"Email code\");\n  const [status, setStatus] = useState(\"\");\n  const emailRef = useRef<HTMLInputElement>(null);\n  const codeRef = useRef<HTMLDivElement>(null);\n  const doneRef = useRef<HTMLHeadingElement>(null);\n  const focusNext = useRef<\"email\" | \"done\" | null>(null);\n  const timers = useRef<number[]>([]);\n  const { track, height } = useStepHeight(step, reduce);\n\n  const emailError = (touched || attempted) && !isEmail(email) ? (email.trim() ? \"Enter a full address, like name@example.com.\" : \"Enter your email address.\") : \"\";\n  const suggestion = touched || attempted ? suggestionFor(email) : \"\";\n  const custom: StepCustom = { direction, reduce };\n  const avatarTransition: Transition = reduce ? { duration: 0 } : motionTokens.spring.morph;\n  const rise = (index: number) => ({\n    initial: reduce ? { opacity: 0 } : { opacity: 0, y: 10, filter: `blur(${motionTokens.blur.soft}px)` },\n    animate: { opacity: 1, y: 0, filter: \"blur(0px)\" },\n    transition: (reduce ? { duration: motionTokens.duration.instant } : { y: { ...motionTokens.spring.smooth, delay: .14 + index * motionTokens.stagger.line }, opacity: { duration: motionTokens.duration.standard, ease: motionTokens.ease.enter, delay: .14 + index * motionTokens.stagger.line }, filter: { duration: motionTokens.duration.standard, delay: .14 + index * motionTokens.stagger.line } }) as Transition,\n  });\n\n  useEffect(() => { const pending = timers.current; return () => pending.forEach(window.clearTimeout); }, []);\n  useEffect(() => {\n    if (step !== \"code\" || resendIn <= 0) return;\n    const timer = window.setTimeout(() => setResendIn(seconds => Math.max(0, seconds - 1)), 1000);\n    return () => window.clearTimeout(timer);\n  }, [step, resendIn]);\n  useEffect(() => {\n    const target = focusNext.current;\n    focusNext.current = null;\n    if (target === \"email\") { emailRef.current?.focus(); emailRef.current?.select(); }\n    if (target === \"done\") doneRef.current?.focus();\n  }, [step]);\n\n  function later(run: () => void, ms: number) { timers.current.push(window.setTimeout(run, ms)); }\n  function go(next: Step, towards: number, focus: \"email\" | \"done\" | null = null) { focusNext.current = focus; setDirection(towards); setStep(next); }\n  const focusCode = () => codeRef.current?.querySelector(\"input\")?.focus();\n\n  function complete(next: SignInAccount, how: SignInMethod) {\n    setBusy(null);\n    setAccount(next);\n    setMethod(how);\n    go(\"done\", 1, \"done\");\n    setStatus(`Signed in with ${how === \"Email code\" ? \"an email code\" : how}`);\n    onSignIn?.(next, how);\n  }\n\n  function submitEmail(event: FormEvent<HTMLFormElement>) {\n    event.preventDefault();\n    if (busy) return;\n    setAttempted(true);\n    if (!isEmail(email)) { emailRef.current?.focus(); return; }\n    setBusy(\"email\");\n    setStatus(\"Sending a code\");\n    later(() => {\n      setBusy(null);\n      setAccount(accountFor(email));\n      setCode(\"\");\n      setCodeError(\"\");\n      setResendIn(RESEND_SECONDS);\n      go(\"code\", 1);\n      setStatus(\"Code sent\");\n    }, 800);\n  }\n\n  function applySuggestion() {\n    setEmail(suggestion);\n    setStatus(`Email changed to ${suggestion}`);\n    emailRef.current?.focus();\n  }\n\n  function verify(value: string) {\n    if (busy) return;\n    if (value.length < 6) { setCodeError(\"Enter all 6 digits.\"); focusCode(); return; }\n    setBusy(\"code\");\n    setStatus(\"Checking code\");\n    later(() => {\n      if (value === demoCode) { complete(account, \"Email code\"); return; }\n      setBusy(null);\n      setCode(\"\");\n      setCodeError(\"That code didn't match. Check the latest email and try again.\");\n      setStatus(\"Code didn't match\");\n      focusCode();\n    }, 700);\n  }\n\n  function changeCode(value: string) {\n    if (busy) return;\n    setCode(value);\n    if (codeError && value) setCodeError(\"\");\n    if (value.length === 6) verify(value);\n  }\n\n  function resend() {\n    if (busy || resendIn > 0) return;\n    setResendIn(RESEND_SECONDS);\n    setCode(\"\");\n    setCodeError(\"\");\n    setStatus(\"New code sent\");\n    focusCode();\n  }\n\n  function changeEmail() {\n    if (busy) return;\n    setAttempted(false);\n    go(\"email\", -1, \"email\");\n    setStatus(\"Edit your email\");\n  }\n\n  function signInWith(how: \"passkey\" | Provider) {\n    if (busy) return;\n    setBusy(how);\n    setStatus(how === \"passkey\" ? \"Waiting for your passkey\" : `Opening ${how}`);\n    later(() => complete(people[0]!, how === \"passkey\" ? \"Passkey\" : how), how === \"passkey\" ? 1100 : 900);\n  }\n\n  function signOut() {\n    setEmail(account.email);\n    setTouched(false);\n    setAttempted(false);\n    setCode(\"\");\n    go(\"email\", -1, \"email\");\n    setStatus(\"Signed out\");\n  }\n\n  return (\n    <section className={styles.signIn} aria-label=\"Sign in\">\n      <LayoutGroup id={id}>\n        <motion.div className={styles.viewport} style={{ height }}>\n          <div ref={track} className={styles.track}>\n            <AnimatePresence mode=\"popLayout\" initial={false} custom={custom}>\n              {step === \"email\" && <motion.div key=\"email\" className={styles.step} custom={custom} variants={stepMotion} initial=\"enter\" animate=\"center\" exit=\"exit\">\n                <div className={styles.heading}><h2>Sign in to Silicon</h2><p>Enter your email and we will send you a 6 digit code.</p></div>\n                <form className={styles.form} onSubmit={submitEmail} noValidate>\n                  <div className={styles.fieldGroup}>\n                    <Input ref={emailRef} label=\"Email\" type=\"email\" inputMode=\"email\" autoComplete=\"email\" autoCapitalize=\"none\" spellCheck={false} placeholder=\"name@example.com\" value={email} readOnly={busy === \"email\"} error={emailError} onChange={event => setEmail(event.target.value)} onBlur={() => { if (email.trim()) setTouched(true); }} />\n                    <AnimatePresence initial={false}>\n                      {suggestion && <motion.div key=\"suggestion\" className={styles.suggestion} initial={{ height: 0, opacity: 0 }} animate={{ height: \"auto\", opacity: 1 }} exit={{ height: 0, opacity: 0 }} transition={reduce ? { duration: 0 } : { height: motionTokens.spring.smooth, opacity: { duration: motionTokens.duration.fast } }}>\n                        <p>Did you mean <button type=\"button\" className={styles.textButton} aria-label={`Use ${suggestion}`} onClick={applySuggestion}>{suggestion}</button>?</p>\n                      </motion.div>}\n                    </AnimatePresence>\n                  </div>\n                  <Button type=\"submit\" className={styles.wide} loading={busy === \"email\"}>Continue</Button>\n                </form>\n                <div className={styles.divider}>or</div>\n                <div className={styles.alternatives}>\n                  <Button type=\"button\" variant=\"secondary\" className={styles.wide} loading={busy === \"passkey\"} onClick={() => signInWith(\"passkey\")}><KeyRound size={16} strokeWidth={1.75} aria-hidden=\"true\" />Sign in with a passkey</Button>\n                  <div className={styles.sso} role=\"group\" aria-label=\"Single sign-on\">\n                    {providers.map(provider => <Button key={provider} type=\"button\" variant=\"secondary\" className={styles.ssoButton} aria-label={`Continue with ${provider}`} loading={busy === provider} onClick={() => signInWith(provider)}>{provider === \"Google\" ? <GoogleLogo /> : <svg className={styles.providerMark} width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\"><path d={providerMarks[provider]} /></svg>}{provider}</Button>)}\n                  </div>\n                </div>\n              </motion.div>}\n\n              {step === \"code\" && <motion.div key=\"code\" className={styles.step} custom={custom} variants={stepMotion} initial=\"enter\" animate=\"center\" exit=\"exit\">\n                <div className={styles.heading}><h2>Check your email</h2><p>Enter the 6 digit code we sent. It expires in 10 minutes.</p></div>\n                <div className={styles.identity}>\n                  <motion.span layoutId=\"account-avatar\" className={`${styles.avatarMover} ${styles.avatarSmall}`} transition={avatarTransition}><Avatar name={account.name} src={account.photo} size=\"xl\" className={styles.avatarFill} /></motion.span>\n                  <span className={styles.identityEmail}>{account.email}</span>\n                  <Button type=\"button\" variant=\"ghost\" size=\"sm\" aria-label=\"Change email\" onClick={changeEmail}>Change</Button>\n                </div>\n                <form className={styles.form} onSubmit={event => { event.preventDefault(); verify(code); }} noValidate>\n                  <div ref={codeRef}><OtpInput label=\"Verification code\" description={`For this demo, the code is ${demoCode}.`} value={code} onChange={changeCode} error={codeError} autoFocus /></div>\n                  <Button type=\"submit\" className={styles.wide} loading={busy === \"code\"}>Verify</Button>\n                </form>\n                <button type=\"button\" className={styles.resend} aria-disabled={resendIn > 0 || undefined} aria-label={resendIn > 0 ? `Resend code, available in ${resendIn} seconds` : \"Resend code\"} onClick={resend}>\n                  <AnimatePresence mode=\"popLayout\" initial={false}>\n                    <motion.span key={resendIn > 0 ? \"wait\" : \"ready\"} className={styles.resendLabel} initial={reduce ? { opacity: 0 } : { opacity: 0, y: 6, filter: `blur(${motionTokens.blur.soft}px)` }} animate={{ opacity: 1, y: 0, filter: \"blur(0px)\" }} exit={reduce ? { opacity: 0, transition: { duration: 0 } } : { opacity: 0, y: -4, filter: `blur(${motionTokens.blur.subtle}px)`, transition: { duration: motionTokens.duration.fast } }} transition={reduce ? { duration: motionTokens.duration.instant } : { duration: motionTokens.duration.standard, ease: motionTokens.ease.enter }}>\n                      {resendIn > 0 ? <>Resend code in <RollingTime seconds={resendIn} reduce={reduce} /></> : \"Resend code\"}\n                    </motion.span>\n                  </AnimatePresence>\n                </button>\n              </motion.div>}\n\n              {step === \"done\" && <motion.div key=\"done\" className={styles.step} custom={{ ...custom, still: true }} variants={stepMotion} initial=\"enter\" animate=\"center\" exit=\"exit\">\n                <div className={styles.avatarStage}>\n                  <svg className={styles.ring} viewBox=\"0 0 96 96\" aria-hidden=\"true\"><motion.circle cx=\"48\" cy=\"48\" r=\"47\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" initial={reduce ? false : { pathLength: 0, opacity: 0 }} animate={{ pathLength: 1, opacity: 1 }} transition={{ pathLength: { duration: motionTokens.duration.expressive * 1.25, ease: motionTokens.ease.inOut, delay: motionTokens.duration.considered }, opacity: { duration: motionTokens.duration.instant, delay: motionTokens.duration.considered } }} /></svg>\n                  <motion.span layoutId=\"account-avatar\" className={`${styles.avatarMover} ${styles.avatarLarge}`} initial={method === \"Email code\" || reduce ? false : { opacity: 0, scale: .7 }} animate={{ opacity: 1, scale: 1 }} transition={avatarTransition}><Avatar name={account.name} src={account.photo} size=\"xl\" className={styles.avatarFill} /></motion.span>\n                  <motion.span className={styles.badge} aria-hidden=\"true\" initial={reduce ? false : { opacity: 0, scale: .4 }} animate={{ opacity: 1, scale: 1 }} transition={{ ...motionTokens.spring.snappy, delay: .78 }}><Check size={14} strokeWidth={2.25} /></motion.span>\n                </div>\n                <motion.div className={styles.heading} {...rise(0)}><h2 ref={doneRef} tabIndex={-1}>Welcome back, {account.name.split(\" \")[0]}</h2><p className={styles.email}>{account.email}</p></motion.div>\n                <motion.dl className={styles.details} {...rise(1)}>\n                  <div><dt>Signed in with</dt><dd>{method}</dd></div>\n                  <div><dt>This browser</dt><dd>Remembered for 30 days</dd></div>\n                </motion.dl>\n                <motion.div {...rise(2)}><Button type=\"button\" variant=\"secondary\" className={styles.wide} onClick={signOut}>Sign out</Button></motion.div>\n              </motion.div>}\n            </AnimatePresence>\n          </div>\n        </motion.div>\n      </LayoutGroup>\n\n      <footer className={styles.footer}>\n        <p className={styles.srOnly} role=\"status\" aria-live=\"polite\">{status}</p>\n        <span className={styles.status} aria-hidden=\"true\">\n          <AnimatePresence mode=\"popLayout\" initial={false}>\n            <motion.span key={status} initial={reduce ? { opacity: 0 } : { opacity: 0, y: 6, filter: `blur(${motionTokens.blur.soft}px)` }} animate={{ opacity: 1, y: 0, filter: \"blur(0px)\" }} exit={reduce ? { opacity: 0, transition: { duration: 0 } } : { opacity: 0, y: -4, filter: `blur(${motionTokens.blur.subtle}px)`, transition: { duration: motionTokens.duration.fast } }} transition={reduce ? { duration: motionTokens.duration.instant } : { duration: motionTokens.duration.standard, ease: motionTokens.ease.enter }}>{status}</motion.span>\n          </AnimatePresence>\n        </span>\n        <span className={styles.switch}>No account? <button type=\"button\" className={styles.textButton} onClick={() => setStatus(\"Sign up opens in your app\")}>Sign up</button></span>\n      </footer>\n    </section>\n  );\n}\n\nexport default SignIn;\n"},{"path":"registry/blocks/sign-in/sign-in.module.css","type":"registry:component","target":"@components/silicon-ui/blocks/sign-in/sign-in.module.css","content":".signIn { container: sign-in / inline-size; width: min(100%, 432px); min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-overlay); corner-shape: var(--corner-shape); background: var(--surface); color: var(--foreground); font-family: var(--font-body); letter-spacing: var(--tracking-body); }\n/* Clips the leaving step while the height glides. Steps carry their own padding, so focus rings never reach the clip. */\n.viewport { overflow: hidden; }\n/* The leaving step pops out against this box. */\n.track { position: relative; }\n.step { display: grid; min-width: 0; padding: var(--space-block); }\n\n.heading { display: grid; gap: var(--space-related); margin-bottom: var(--space-section); }\n.heading h2 { margin: 0; font-family: var(--font-display); font-size: var(--text-3xl); font-weight: var(--weight-regular); letter-spacing: var(--tracking-display); line-height: var(--leading-display); text-wrap: balance; outline: none; }\n.heading p { margin: 0; color: var(--text-secondary); font-size: var(--text-sm); line-height: var(--leading-body); text-wrap: pretty; }\n.heading .email { overflow-wrap: anywhere; }\n\n.form { display: grid; gap: var(--space-inset); }\n/* No gap inside: a closing suggestion row would otherwise leave a gap behind until it unmounts. */\n.fieldGroup { display: grid; min-width: 0; }\n.wide { width: 100%; }\n.suggestion { overflow: hidden; }\n.suggestion p { margin: 0; padding: var(--space-related) 0 var(--space-tight); color: var(--text-secondary); font-size: var(--text-xs); line-height: var(--leading-body); overflow-wrap: anywhere; }\n.textButton { border: 0; border-radius: var(--radius-detail); corner-shape: var(--corner-shape); padding: 0; background: none; color: var(--foreground); font: inherit; font-weight: var(--weight-medium); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; cursor: pointer; transition: text-decoration-color var(--duration-fast) var(--ease-standard); }\n\n.divider { display: flex; align-items: center; gap: var(--space-group); margin: var(--space-comfort) 0; color: var(--text-muted); font-size: var(--text-xs); line-height: 1; }\n.divider::before, .divider::after { flex: 1; height: 1px; background: var(--border); content: \"\"; }\n.alternatives { display: grid; gap: var(--space-related); }\n.sso { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-related); }\n.sso .ssoButton { min-width: 0; padding-inline: var(--space-related); }\n.providerMark { flex: none; }\n\n/* The account being signed in to. Its avatar is the one that grows into the signed in state. */\n.identity { display: flex; min-width: 0; align-items: center; gap: var(--space-group); margin-bottom: var(--space-section); border: 1px solid var(--border); border-radius: var(--radius-control); corner-shape: var(--corner-shape); padding: var(--space-related) var(--space-related) var(--space-related) var(--space-group); }\n.identityEmail { flex: 1; min-width: 0; font-size: var(--text-sm); line-height: var(--leading-body); overflow-wrap: anywhere; }\n.identity > button { flex: none; }\n.avatarMover { position: relative; z-index: 1; display: inline-flex; flex: none; }\n.avatarSmall { width: 32px; height: 32px; font-size: var(--text-xs); }\n.avatarLarge { position: absolute; inset: var(--space-tight); font-size: var(--text-2xl); }\n/* Both steps render the large photo and size it here, so the morph never waits on a second image. */\n.avatarMover .avatarFill { width: 100%; height: 100%; font-size: inherit; }\n\n.resend { position: relative; display: inline-flex; min-height: var(--control-height-sm); align-items: center; justify-self: start; margin: var(--space-group) 0 calc(var(--space-related) * -1) calc(var(--space-related) * -1); border: 0; border-radius: var(--radius-full); corner-shape: round; padding: 0 var(--space-related); background: none; color: var(--foreground); font: inherit; font-size: var(--text-sm); font-weight: var(--weight-medium); line-height: var(--leading-body); cursor: pointer; transition: color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard); }\n.resend[aria-disabled=\"true\"] { color: var(--text-muted); font-weight: var(--weight-regular); cursor: default; }\n.resendLabel { display: inline-flex; align-items: baseline; gap: .3em; white-space: nowrap; }\n.time { display: inline-flex; font-variant-numeric: tabular-nums; }\n.timeColumn { position: relative; display: inline-flex; justify-content: center; }\n.timeColumn > span { display: inline-block; }\n\n.avatarStage { position: relative; width: 96px; height: 96px; margin: 0 0 var(--space-section) calc(var(--space-tight) * -1); }\n.ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; color: var(--success); transform: rotate(-90deg); }\n.badge { position: absolute; right: var(--space-hair); bottom: var(--space-tight); z-index: 2; display: grid; width: 26px; height: 26px; place-items: center; border: 2px solid var(--surface); border-radius: var(--radius-full); corner-shape: round; background: var(--success); color: var(--surface); }\n.details { display: grid; margin: 0 0 var(--space-section); border-top: 1px solid var(--border); padding: 0; }\n.details div { display: flex; justify-content: space-between; gap: var(--space-inset); border-bottom: 1px solid var(--border); padding: var(--space-group) 0; font-size: var(--text-sm); line-height: var(--leading-body); }\n.details dt { color: var(--text-secondary); }\n.details dd { margin: 0; text-align: right; }\n\n.footer { display: flex; min-height: 48px; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-tight) var(--space-inset); border-top: 1px solid var(--border); padding: var(--space-group) var(--space-block); color: var(--text-muted); font-size: var(--text-xs); line-height: var(--leading-body); }\n.status { position: relative; display: block; min-width: 0; flex: 1 1 12rem; }\n.switch { color: var(--text-secondary); white-space: nowrap; }\n.switch .textButton { text-decoration-color: transparent; }\n.status > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.srOnly { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n\n@media (hover: hover) and (pointer: fine) {\n  .textButton:hover { text-decoration-color: currentColor; }\n  .resend:not([aria-disabled=\"true\"]):hover { background: var(--surface-muted); }\n}\n\n@container sign-in (max-width: 380px) {\n  .step { padding: var(--space-section) var(--space-comfort); }\n  .heading h2 { font-size: var(--text-2xl); }\n  .identity { gap: var(--space-related); padding-left: var(--space-related); }\n  .sso .ssoButton { gap: var(--space-related); font-size: var(--text-xs); }\n  .footer { padding-inline: var(--space-comfort); }\n}\n@media (max-width: 480px) { .signIn { border-radius: var(--radius-container); corner-shape: var(--corner-shape); } }\n@media (prefers-reduced-motion: reduce) { .textButton, .resend { transition: none; } }\n"},{"path":"lib/media.ts","type":"registry:lib","target":"@components/silicon-ui/lib/media.ts","content":"/**\n * Shared demo media. Files live in `public/media/`, credits in `public/media/CREDITS.md`.\n * Portraits are 400 px squares; photos are 1600 px on the long side.\n */\n\nexport interface MediaPerson {\n  id: string;\n  name: string;\n  role?: string;\n  src: string;\n}\n\nexport interface MediaPhoto {\n  id: string;\n  alt: string;\n  src: string;\n  width: number;\n  height: number;\n}\n\nexport const people = [\n  { id: \"emma-collins\", name: \"Emma Collins\", role: \"Product designer\", src: \"/media/people/emma-collins.jpg\" },\n  { id: \"marcus-johnson\", name: \"Marcus Johnson\", role: \"Frontend engineer\", src: \"/media/people/marcus-johnson.jpg\" },\n  { id: \"jasmine-brooks\", name: \"Jasmine Brooks\", role: \"Design lead\", src: \"/media/people/jasmine-brooks.jpg\" },\n  { id: \"olivia-bennett\", name: \"Olivia Bennett\", role: \"Platform engineer\", src: \"/media/people/olivia-bennett.jpg\" },\n  { id: \"sofia-ramirez\", name: \"Sofia Ramirez\", role: \"Operations lead\", src: \"/media/people/sofia-ramirez.jpg\" },\n  { id: \"ryan-sullivan\", name: \"Ryan Sullivan\", role: \"Account executive\", src: \"/media/people/ryan-sullivan.jpg\" },\n  { id: \"hannah-walsh\", name: \"Hannah Walsh\", role: \"Customer success\", src: \"/media/people/hannah-walsh.jpg\" },\n  { id: \"chloe-nguyen\", name: \"Chloe Nguyen\", role: \"Data analyst\", src: \"/media/people/chloe-nguyen.jpg\" },\n  { id: \"ava-mitchell\", name: \"Ava Mitchell\", role: \"Marketing manager\", src: \"/media/people/ava-mitchell.jpg\" },\n  { id: \"daniel-kim\", name: \"Daniel Kim\", role: \"Backend engineer\", src: \"/media/people/daniel-kim.jpg\" },\n  { id: \"jordan-reyes\", name: \"Jordan Reyes\", role: \"Support specialist\", src: \"/media/people/jordan-reyes.jpg\" },\n  { id: \"mateo-alvarez\", name: \"Mateo Alvarez\", role: \"Mobile engineer\", src: \"/media/people/mateo-alvarez.jpg\" },\n  { id: \"tyler-hayes\", name: \"Tyler Hayes\", role: \"Sales lead\", src: \"/media/people/tyler-hayes.jpg\" },\n  { id: \"andre-williams\", name: \"Andre Williams\", role: \"Finance partner\", src: \"/media/people/andre-williams.jpg\" },\n  { id: \"nathan-cole\", name: \"Nathan Cole\", role: \"Engineering manager\", src: \"/media/people/nathan-cole.jpg\" },\n  { id: \"diane-foster\", name: \"Diane Foster\", role: \"Chief operating officer\", src: \"/media/people/diane-foster.jpg\" },\n] as const satisfies readonly MediaPerson[];\n\nexport const photos = [\n  { id: \"lounge-chair\", alt: \"A woven oak lounge chair with a sheepskin and linen cushion on a concrete floor\", src: \"/media/photos/lounge-chair.jpg\", width: 1280, height: 1600 },\n  { id: \"table-lamp\", alt: \"A white mushroom table lamp glowing beside books and a small vase\", src: \"/media/photos/table-lamp.jpg\", width: 1600, height: 900 },\n  { id: \"linen-throw\", alt: \"Folded natural linen throws with fringed edges in soft window light\", src: \"/media/photos/linen-throw.jpg\", width: 1067, height: 1600 },\n  { id: \"glass-carafe\", alt: \"A hand pouring water from a ribbed glass carafe into tumblers\", src: \"/media/photos/glass-carafe.jpg\", width: 1280, height: 1600 },\n  { id: \"stoneware-cups\", alt: \"Two speckled stoneware cups with a lid on a pale table\", src: \"/media/photos/stoneware-cups.jpg\", width: 1067, height: 1600 },\n  { id: \"stacked-bowls\", alt: \"Two stacked speckled ceramic bowls against a dark wall\", src: \"/media/photos/stacked-bowls.jpg\", width: 1600, height: 1067 },\n  { id: \"ceramic-lamp\", alt: \"A sculptural ceramic lamp with a linen shade on a walnut sideboard\", src: \"/media/photos/ceramic-lamp.jpg\", width: 1067, height: 1600 },\n  { id: \"living-room\", alt: \"A bright living room with timber beams, arched windows, and cream sofas\", src: \"/media/photos/living-room.jpg\", width: 1200, height: 1600 },\n  { id: \"sunroom\", alt: \"A sunroom with a round dining table, plants, and windows on three sides\", src: \"/media/photos/sunroom.jpg\", width: 1600, height: 1067 },\n  { id: \"home-office\", alt: \"A home office with a wooden desk and deep green walls\", src: \"/media/photos/home-office.jpg\", width: 1600, height: 1200 },\n  { id: \"reading-chair\", alt: \"A grey armchair and ottoman with a knit throw in a dark green room\", src: \"/media/photos/reading-chair.jpg\", width: 1600, height: 900 },\n  { id: \"bedroom\", alt: \"A made bed with striped linen pillows against an oak headboard\", src: \"/media/photos/bedroom.jpg\", width: 1067, height: 1600 },\n  { id: \"restaurant\", alt: \"A warm restaurant dining room with woven pendant lights and a tree\", src: \"/media/photos/restaurant.jpg\", width: 1067, height: 1600 },\n  { id: \"wine-bar\", alt: \"A glass carafe of red wine on a bar table in low evening light\", src: \"/media/photos/wine-bar.jpg\", width: 1600, height: 1067 },\n  { id: \"concert-hall\", alt: \"Curved stainless steel panels of the Walt Disney Concert Hall against a blue sky\", src: \"/media/photos/concert-hall.jpg\", width: 1600, height: 1143 },\n  { id: \"curved-facade\", alt: \"A white tiled building facade with curved balconies\", src: \"/media/photos/curved-facade.jpg\", width: 1600, height: 1067 },\n  { id: \"pool-house\", alt: \"A modern glass house beside a long pool under a clear sky\", src: \"/media/photos/pool-house.jpg\", width: 1600, height: 900 },\n  { id: \"terracotta-waves\", alt: \"Wavy terracotta walls rising toward a blue sky\", src: \"/media/photos/terracotta-waves.jpg\", width: 1067, height: 1600 },\n  { id: \"mountain-ridges\", alt: \"Layered mountain ridges under a warm evening sky\", src: \"/media/photos/mountain-ridges.jpg\", width: 1600, height: 1068 },\n  { id: \"alpine-lake\", alt: \"A calm alpine lake reflecting a rocky peak at golden hour\", src: \"/media/photos/alpine-lake.jpg\", width: 1067, height: 1600 },\n  { id: \"coastline\", alt: \"A long coastline with waves rolling onto a beach below green cliffs\", src: \"/media/photos/coastline.jpg\", width: 1200, height: 1600 },\n  { id: \"sea-at-dusk\", alt: \"A calm sea at dusk with a low island on the horizon\", src: \"/media/photos/sea-at-dusk.jpg\", width: 1067, height: 1600 },\n  { id: \"lisbon-tram\", alt: \"A yellow tram on a street lined with historic buildings in Lisbon\", src: \"/media/photos/lisbon-tram.jpg\", width: 1600, height: 1064 },\n  { id: \"lisbon-bridge\", alt: \"The 25 de Abril Bridge crossing the Tagus in Lisbon\", src: \"/media/photos/lisbon-bridge.jpg\", width: 1600, height: 1166 },\n  { id: \"lisbon-rooftops\", alt: \"Terracotta rooftops of Lisbon running down to the river\", src: \"/media/photos/lisbon-rooftops.jpg\", width: 1280, height: 1600 },\n  { id: \"salmon-dinner\", alt: \"Seared salmon with a bright herb salsa and a glass of red wine\", src: \"/media/photos/salmon-dinner.jpg\", width: 1067, height: 1600 },\n  { id: \"chef-plating\", alt: \"A chef spooning sauce onto a plated dish in a dark kitchen\", src: \"/media/photos/chef-plating.jpg\", width: 1600, height: 1600 },\n] as const satisfies readonly MediaPhoto[];\n\nexport type PersonId = (typeof people)[number][\"id\"];\nexport type PhotoId = (typeof photos)[number][\"id\"];\n\n/** Looks up a person by id. */\nexport function person(id: PersonId): MediaPerson {\n  return people.find(entry => entry.id === id)!;\n}\n\n/** Looks up a photo by id. */\nexport function photo(id: PhotoId): MediaPhoto {\n  return photos.find(entry => entry.id === id)!;\n}\n\n/** Square 400 px avatar path for a person id, for `src` props. */\nexport const avatar = (id: PersonId) => person(id).src;\n\n/** 800 × 1000 portrait crop of the same photo, for image-led layouts. */\nexport const portrait = (id: PersonId) => `/media/people/portrait/${id}.jpg`;\n\n/** The first `count` people, for avatar stacks and lists. */\nexport const peopleSample = (count: number) => people.slice(0, count);\n"},{"path":"registry/components/otp-input/otp-input.tsx","type":"registry:component","target":"@components/silicon-ui/otp-input/otp-input.tsx","content":"\"use client\";\n\nimport { useEffect, useId, useRef, useState } from \"react\";\nimport type { ClipboardEvent, KeyboardEvent, ChangeEvent, FocusEvent } from \"react\";\nimport { AnimatePresence, motion, useAnimate, useReducedMotion } from \"motion/react\";\nimport type { Transition } from \"motion/react\";\nimport { motionTokens } from \"../lib/motion-tokens\";\nimport styles from \"./otp-input.module.css\";\n\nexport interface OtpInputProps {\n  length?: number;\n  value?: string;\n  onChange?: (value: string) => void;\n  label: string;\n  description?: string;\n  error?: string;\n  autoFocus?: boolean;\n  disabled?: boolean;\n  inputMode?: \"numeric\" | \"text\";\n  className?: string;\n}\n\n/** Changed words rise in and unblur while unchanged words hold still. Assistive tech reads the plain copy. */\nfunction MotionText({ text }: { text: string }) {\n  const reduced = useReducedMotion();\n  const words = text.split(\" \");\n  return <><span className={styles.srOnly}>{text}</span><span className={styles.words} aria-hidden=\"true\"><AnimatePresence initial={false} mode=\"popLayout\">{words.map((word, index) => <motion.span key={`${index}:${word}`} className={styles.word}\n    initial={reduced ? { opacity: 0 } : { opacity: 0, y: \"0.35em\", filter: `blur(${motionTokens.blur.soft}px)` }} animate={{ opacity: 1, y: 0, filter: \"blur(0px)\" }}\n    exit={reduced ? { opacity: 0, transition: { duration: 0 } } : { opacity: 0, y: \"-0.35em\", filter: `blur(${motionTokens.blur.subtle}px)`, transition: { duration: motionTokens.duration.instant, ease: [...motionTokens.ease.standard] } }}\n    transition={reduced ? { duration: motionTokens.duration.instant } : { duration: motionTokens.duration.standard, ease: [...motionTokens.ease.enter] }}>{index < words.length - 1 ? `${word} ` : word}</motion.span>)}</AnimatePresence></span></>;\n}\n\n/** Helper and error copy: the row opens its height on a spring, then the words settle in. */\nfunction FieldMessage({ id, text, className, alert }: { id?: string; text?: string; className?: string; alert?: boolean }) {\n  return <AnimatePresence initial={false}>{text ? <MessageRow key=\"message\" id={id} text={text} className={className} alert={alert} /> : null}</AnimatePresence>;\n}\n\n/** The row tracks the measured copy, so a longer message that wraps opens its next line instead of snapping. */\nfunction MessageRow({ id, text, className, alert }: { id?: string; text: string; className?: string; alert?: boolean }) {\n  const reduced = useReducedMotion();\n  const copyRef = useRef<HTMLSpanElement>(null);\n  const [height, setHeight] = useState<number | \"auto\">(\"auto\");\n  useEffect(() => {\n    const node = copyRef.current;\n    if (!node || typeof ResizeObserver === \"undefined\") return;\n    const observer = new ResizeObserver(([entry]) => setHeight(entry?.borderBoxSize?.[0]?.blockSize ?? node.offsetHeight));\n    observer.observe(node);\n    return () => observer.disconnect();\n  }, []);\n  return <motion.span className={styles.messageSlot} initial={{ height: 0, opacity: 0 }} animate={{ height, opacity: 1 }} exit={{ height: 0, opacity: 0, transition: reduced ? { duration: 0 } : { height: motionTokens.spring.smooth, opacity: { duration: motionTokens.duration.instant } } }} transition={reduced ? { duration: 0 } : { height: motionTokens.spring.smooth, opacity: { duration: motionTokens.duration.fast } }}>\n    <motion.span ref={copyRef} id={id} className={className} role={alert ? \"alert\" : undefined} initial={reduced ? false : { y: \"0.35em\", filter: `blur(${motionTokens.blur.soft}px)` }} animate={{ y: 0, filter: \"blur(0px)\" }} transition={{ duration: reduced ? 0 : motionTokens.duration.standard, ease: [...motionTokens.ease.enter] }}><MotionText text={text} /></motion.span>\n  </motion.span>;\n}\n\nexport function OtpInput({ length = 6, value = \"\", onChange, label, description, error, autoFocus = false, disabled = false, inputMode = \"numeric\", className }: OtpInputProps) {\n  const generatedId = useId();\n  const reduced = useReducedMotion();\n  const [scope, animate] = useAnimate<HTMLDivElement>();\n  const inputRefs = useRef<Array<HTMLInputElement | null>>([]);\n  const values = Array.from({ length }, (_, index) => value[index] ?? \"\");\n  const hintId = description ? `${generatedId}-description` : undefined;\n  const errorId = error ? `${generatedId}-error` : undefined;\n  const describedBy = [hintId, errorId].filter(Boolean).join(\" \") || undefined;\n  const focusAt = (index: number) => inputRefs.current[Math.max(0, Math.min(index, length - 1))]?.focus();\n  const sanitize = (next: string) => inputMode === \"numeric\" ? next.replace(/\\D/g, \"\") : next;\n  // One ring for the whole row. It glides between slots while focus stays inside, and fades in where focus lands when it arrives from outside.\n  const [ring, setRing] = useState({ x: 0, width: 0, shown: false, glide: false });\n  // A paste fills several slots in one update; those digits land as a short left to right wave.\n  const [fill, setFill] = useState({ value, wave: false });\n  if (fill.value !== value) setFill({ value, wave: Array.from({ length }, (_, index) => (fill.value[index] ?? \"\") !== (value[index] ?? \"\")).filter(Boolean).length > 1 });\n  const lastError = useRef(error);\n\n  useEffect(() => {\n    if (autoFocus) inputRefs.current[0]?.focus();\n  }, [autoFocus]);\n\n  // Slots shrink at narrow widths; keep the ring on the focused slot when the row resizes.\n  useEffect(() => {\n    const row = scope.current;\n    if (!row || typeof ResizeObserver === \"undefined\") return;\n    const observer = new ResizeObserver(() => {\n      const slot = (row.contains(document.activeElement) ? document.activeElement?.parentElement : null) as HTMLElement | null;\n      if (slot) setRing(current => (current.x === slot.offsetLeft && current.width === slot.offsetWidth ? current : { ...current, x: slot.offsetLeft, width: slot.offsetWidth, glide: false }));\n    });\n    observer.observe(row);\n    return () => observer.disconnect();\n  }, [scope]);\n\n  // A new error nudges the row side to side once, so a rejected code reads as a response to the attempt.\n  useEffect(() => {\n    if (error && error !== lastError.current && !reduced && scope.current) animate(scope.current, { x: [0, -6, 5, -3, 2, 0] }, { duration: .36, ease: [...motionTokens.ease.standard] });\n    lastError.current = error;\n  }, [error, reduced, animate, scope]);\n\n  const updateAt = (index: number, raw: string) => {\n    const next = values.slice();\n    const clean = sanitize(raw).slice(-1);\n    next[index] = clean;\n    onChange?.(next.join(\"\"));\n    if (clean && index < length - 1) focusAt(index + 1);\n  };\n\n  const handleChange = (index: number, event: ChangeEvent<HTMLInputElement>) => {\n    const raw = sanitize(event.target.value);\n    if (raw.length <= 1) {\n      updateAt(index, raw);\n      return;\n    }\n\n    const next = values.slice();\n    raw.slice(0, length - index).split(\"\").forEach((character, offset) => { next[index + offset] = character; });\n    onChange?.(next.join(\"\"));\n    focusAt(Math.min(index + raw.length, length - 1));\n  };\n  const handlePaste = (index: number, event: ClipboardEvent<HTMLInputElement>) => {\n    event.preventDefault();\n    const pasted = sanitize(event.clipboardData.getData(\"text\")).slice(0, length - index);\n    if (!pasted) return;\n    const next = values.slice();\n    pasted.split(\"\").forEach((character, offset) => { next[index + offset] = character; });\n    onChange?.(next.join(\"\"));\n    focusAt(Math.min(index + pasted.length, length - 1));\n  };\n\n  const handleKeyDown = (index: number, event: KeyboardEvent<HTMLInputElement>) => {\n    if (event.key === \"ArrowLeft\") { event.preventDefault(); focusAt(index - 1); }\n    if (event.key === \"ArrowRight\") { event.preventDefault(); focusAt(index + 1); }\n    if (event.key === \"Backspace\" && !values[index] && index > 0) {\n      event.preventDefault();\n      const next = values.slice();\n      next[index - 1] = \"\";\n      onChange?.(next.join(\"\"));\n      focusAt(index - 1);\n    }\n    if (event.key === \"Delete\" && values[index]) {\n      const next = values.slice();\n      next[index] = \"\";\n      onChange?.(next.join(\"\"));\n    }\n  };\n  const handleFocus = (event: FocusEvent<HTMLInputElement>) => { const slot = event.currentTarget.parentElement as HTMLElement; setRing(current => ({ x: slot.offsetLeft, width: slot.offsetWidth, shown: true, glide: current.shown })); };\n  const handleBlur = (event: FocusEvent<HTMLInputElement>) => { if (!scope.current?.contains(event.relatedTarget as Node | null)) setRing(current => ({ ...current, shown: false, glide: false })); };\n  const glyphTransition = (index: number): Transition => reduced ? { duration: motionTokens.duration.instant } : { duration: motionTokens.duration.standard, ease: [...motionTokens.ease.enter], delay: fill.wave ? index * motionTokens.stagger.item : 0 };\n\n  return <div className={[styles.field, className].filter(Boolean).join(\" \")}>\n    <span className={styles.label}>{label}</span>\n    <div ref={scope} className={styles.inputs} role=\"group\" aria-label={label} data-invalid={error ? \"true\" : undefined}>\n      {values.map((character, index) => <div key={`${generatedId}-${index}`} className={styles.slot}>\n        <input\n          ref={(node) => { inputRefs.current[index] = node; }}\n          className={styles.input}\n          aria-label={`${label}, digit ${index + 1} of ${length}`}\n          aria-describedby={describedBy}\n          aria-invalid={error ? true : undefined}\n          value={character}\n          data-filled={character ? \"true\" : undefined}\n          maxLength={1}\n          inputMode={inputMode}\n          autoComplete={index === 0 ? \"one-time-code\" : \"off\"}\n          disabled={disabled}\n          onChange={(event) => handleChange(index, event)}\n          onPaste={(event) => handlePaste(index, event)}\n          onKeyDown={(event) => handleKeyDown(index, event)}\n          onFocus={handleFocus}\n          onBlur={handleBlur}\n        />\n        {/* The input text is transparent; this copy of the digit rises into the slot and unblurs. */}\n        <AnimatePresence initial={false}>{character ? <motion.span key={character} className={styles.glyph} aria-hidden=\"true\" initial={reduced ? { opacity: 0 } : { opacity: 0, y: \"0.35em\", filter: `blur(${motionTokens.blur.soft}px)` }} animate={{ opacity: 1, y: 0, filter: \"blur(0px)\" }} exit={reduced ? { opacity: 0, transition: { duration: 0 } } : { opacity: 0, scale: .9, filter: `blur(${motionTokens.blur.subtle}px)`, transition: { duration: motionTokens.duration.instant, ease: [...motionTokens.ease.standard] } }} transition={glyphTransition(index)}>{character}</motion.span> : null}</AnimatePresence>\n      </div>)}\n      <motion.span className={styles.ring} aria-hidden=\"true\" initial={false} animate={{ x: ring.x, width: ring.width, opacity: ring.shown ? 1 : 0, scale: ring.shown ? 1 : .94 }} transition={reduced ? { duration: 0 } : { x: ring.glide ? motionTokens.spring.snappy : { duration: 0 }, width: { duration: 0 }, scale: motionTokens.spring.snappy, opacity: { duration: motionTokens.duration.fast } }} />\n    </div>\n    <FieldMessage id={hintId} text={description} className={styles.description} />\n    <FieldMessage id={errorId} text={error} className={styles.error} alert />\n  </div>;\n}\n"},{"path":"registry/components/otp-input/otp-input.module.css","type":"registry:component","target":"@components/silicon-ui/otp-input/otp-input.module.css","content":"/* No row gap: grid tracks clamp a negative margin at zero, so a closed message row would still pay the gap. Each row carries its own space instead. */\n.field { display: grid; min-width: 0; }\n.label { margin-bottom: var(--space-related); color: var(--foreground); font-size: var(--text-sm); font-weight: var(--weight-medium); line-height: var(--leading-body); letter-spacing: var(--tracking-body); }\n.inputs { position: relative; display: flex; width: fit-content; max-width: 100%; gap: var(--space-related); }\n.slot { position: relative; display: grid; width: 42px; height: 48px; min-width: 0; flex: 0 1 42px; }\n/* The native text is transparent (caret stays visible); .glyph draws the digit so it can rise in. */\n.input { width: 100%; height: 100%; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); color: transparent; caret-color: var(--accent); font: inherit; font-size: var(--text-lg); font-variant-numeric: tabular-nums; text-align: center; outline: none; transition: border-color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard); }\n@media (hover: hover) and (pointer: fine) { .input:hover:not(:disabled, [data-filled=\"true\"], [aria-invalid=\"true\"]) { border-color: var(--border-strong); background: var(--surface-muted); } }\n.input[data-filled=\"true\"] { border-color: var(--accent); background: var(--accent-subtle); }\n.input:focus-visible { outline: none; }\n.input[aria-invalid=\"true\"] { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 7%, var(--surface)); }\n.input:disabled { cursor: not-allowed; opacity: .48; background: var(--surface-muted); }\n.glyph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--foreground); font-size: var(--text-lg); font-variant-numeric: tabular-nums; pointer-events: none; }\n.input:disabled ~ .glyph { opacity: .48; }\n/* One ring per field. It glides to the focused slot and morphs to the danger color with the error state. */\n.ring { position: absolute; top: 0; left: 0; height: 100%; z-index: 2; border: 1px solid var(--accent-strong); border-radius: var(--radius-control); pointer-events: none; transition: border-color var(--duration-fast) var(--ease-standard); }\n.inputs[data-invalid=\"true\"] .ring { border-color: var(--danger); }\n/* The row's space is padding inside the clipped slot, so the height animates from a true zero. */\n.messageSlot { display: block; overflow: hidden; }\n.description, .error { display: block; padding-top: var(--space-related); font-size: var(--field-hint-size, var(--text-xs)); line-height: var(--leading-body); letter-spacing: var(--tracking-body); }\n.description { color: var(--field-hint-colour, var(--text-muted)); }.error { color: var(--danger); }\n/* Words are measured against this box when they pop out to leave, so it must be the positioned parent. */\n.words { position: relative; display: block; }\n.word { display: inline-block; white-space: pre; }\n.srOnly { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n@media (max-width: 360px) { .inputs { gap: var(--space-related); }.slot { height: 44px; } }\n@media (forced-colors: active) { .ring { display: none; } .input:focus-visible { outline: 2px solid CanvasText; outline-offset: 2px; } .input { color: CanvasText; } .glyph { display: none; } }\n@media (prefers-reduced-motion: reduce) { .input, .ring { transition: none; } }\n"},{"path":"registry/components/input/input.tsx","type":"registry:component","target":"@components/silicon-ui/input/input.tsx","content":"\"use client\";\n\nimport { forwardRef, useEffect, useId, useRef, useState } from \"react\";\nimport type { InputHTMLAttributes, ReactNode } from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { motionTokens } from \"../lib/motion-tokens\";\nimport styles from \"./input.module.css\";\n\nexport interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"prefix\"> {\n  label: string;\n  /** Fixed text or an icon inside the field before what is typed (a currency, \"c:\"). It takes the typed text's size and\n   * a quieter colour, with no gap: the value reads as one word with it. */\n  prefix?: ReactNode;\n  /** An icon or short text inside the field after what is typed (a status icon, a unit). */\n  suffix?: ReactNode;\n  /** Plain text animates word by word when it changes; markup (a bold id) is shown as given. */\n  description?: ReactNode;\n  error?: string;\n}\n\n/* Digits roll up when a number grows and down when it shrinks; `custom` hands the latest direction to digits already leaving. */\nconst digit = {\n  enter: (direction: number) => ({ opacity: 0, y: `${direction * 0.6}em`, filter: `blur(${motionTokens.blur.subtle}px)` }),\n  center: { opacity: 1, y: 0, filter: \"blur(0px)\" },\n  exit: (direction: number) => ({ opacity: 0, y: `${direction * -0.6}em`, filter: `blur(${motionTokens.blur.subtle}px)` }),\n};\nconst isNumber = (word: string) => /^\\d[\\d.,/:]*%?$/.test(word);\n\n/** A count in the copy, such as \"12 characters\", rolls only the digits that changed; a gained or lost digit opens or closes its width. */\nfunction RollingNumber({ word }: { word: string }) {\n  const reduced = useReducedMotion();\n  const [shown, setShown] = useState({ word, direction: 1 });\n  if (shown.word !== word) setShown({ word, direction: parseFloat(word.replace(/,/g, \"\")) < parseFloat(shown.word.replace(/,/g, \"\")) ? -1 : 1 });\n  const characters = word.split(\"\");\n  const transition = reduced ? { duration: 0 } : { y: motionTokens.spring.snappy, width: motionTokens.spring.morph, opacity: { duration: motionTokens.duration.fast }, filter: { duration: motionTokens.duration.fast } };\n  return <AnimatePresence initial={false}>{characters.map((character, index) => <motion.span key={characters.length - index} className={styles.column} initial={{ width: 0, opacity: 0 }} animate={{ width: \"auto\", opacity: 1 }} exit={{ width: 0, opacity: 0 }} transition={transition}>\n    <AnimatePresence initial={false} mode=\"popLayout\" custom={shown.direction}><motion.span key={character} custom={shown.direction} variants={digit} initial=\"enter\" animate=\"center\" exit=\"exit\" transition={transition}>{character}</motion.span></AnimatePresence>\n  </motion.span>)}</AnimatePresence>;\n}\n\n/** Changed words rise in and unblur while unchanged words hold still, and numbers roll. Assistive tech reads the plain copy. */\nfunction MotionText({ text }: { text: ReactNode }) {\n  const reduced = useReducedMotion();\n  if (typeof text !== \"string\") return text;\n  const words = text.split(\" \");\n  return <><span className={styles.srOnly}>{text}</span><span className={styles.words} aria-hidden=\"true\"><AnimatePresence initial={false} mode=\"popLayout\">{words.map((word, index) => <motion.span key={`${index}:${isNumber(word) ? \"#\" : word}`} className={styles.word}\n    initial={reduced ? { opacity: 0 } : { opacity: 0, y: \"0.35em\", filter: `blur(${motionTokens.blur.soft}px)` }} animate={{ opacity: 1, y: 0, filter: \"blur(0px)\" }}\n    exit={reduced ? { opacity: 0, transition: { duration: 0 } } : { opacity: 0, y: \"-0.35em\", filter: `blur(${motionTokens.blur.subtle}px)`, transition: { duration: motionTokens.duration.exit, ease: [...motionTokens.ease.standard] } }}\n    transition={reduced ? { duration: motionTokens.duration.instant } : { duration: motionTokens.duration.standard, ease: [...motionTokens.ease.enter] }}>{isNumber(word) ? <RollingNumber word={word} /> : word}{index < words.length - 1 ? \" \" : null}</motion.span>)}</AnimatePresence></span></>;\n}\n\n/** Helper and error copy: the row opens its height on a spring, then the words settle in. */\nfunction FieldMessage({ id, text, className, alert }: { id?: string; text?: ReactNode; className?: string; alert?: boolean }) {\n  return <AnimatePresence initial={false}>{text ? <MessageRow key=\"message\" id={id} text={text} className={className} alert={alert} /> : null}</AnimatePresence>;\n}\n\n/** The row tracks the measured copy, so a longer message that wraps opens its next line instead of snapping. */\nfunction MessageRow({ id, text, className, alert }: { id?: string; text: ReactNode; className?: string; alert?: boolean }) {\n  const reduced = useReducedMotion();\n  const copyRef = useRef<HTMLSpanElement>(null);\n  const [height, setHeight] = useState<number | \"auto\">(\"auto\");\n  useEffect(() => {\n    const node = copyRef.current;\n    if (!node || typeof ResizeObserver === \"undefined\") return;\n    const observer = new ResizeObserver(([entry]) => { if (entry) setHeight(entry.borderBoxSize?.[0]?.blockSize ?? node.offsetHeight); });\n    observer.observe(node);\n    return () => observer.disconnect();\n  }, []);\n  // Reduced motion mounts the row at full height: a zero-duration open would still paint one collapsed frame. The presence starts\n  // with initial={false}, so rows present at hydration render the same on server and client either way.\n  return <motion.span className={styles.messageSlot} initial={reduced ? false : { height: 0, opacity: 0 }} animate={{ height, opacity: 1 }} exit={{ height: 0, opacity: 0, transition: reduced ? { duration: 0 } : { height: motionTokens.spring.smooth, opacity: { duration: motionTokens.duration.instant } } }} transition={reduced ? { duration: 0 } : { height: motionTokens.spring.smooth, opacity: { duration: motionTokens.duration.fast } }}>\n    <motion.span ref={copyRef} id={id} className={className} role={alert ? \"alert\" : undefined} initial={reduced ? false : { y: \"0.35em\", filter: `blur(${motionTokens.blur.soft}px)` }} animate={{ y: 0, filter: \"blur(0px)\" }} transition={{ duration: reduced ? 0 : motionTokens.duration.standard, ease: [...motionTokens.ease.enter] }}><MotionText text={text} /></motion.span>\n  </motion.span>;\n}\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n  { label, description, error, id, className, prefix, suffix, ...props }, ref,\n) {\n  const generatedId = useId();\n  const controlId = id ?? generatedId;\n  const hintId = description ? `${controlId}-description` : undefined;\n  const errorId = error ? `${controlId}-error` : undefined;\n  const describedBy = [props[\"aria-describedby\"], hintId, errorId].filter(Boolean).join(\" \") || undefined;\n  return <div className={styles.field}>\n    <label className={styles.label} htmlFor={controlId}>{label}</label>\n    {prefix != null || suffix != null ? <div className={styles.control}>\n      {prefix != null ? <span className={styles.prefix} aria-hidden=\"true\">{prefix}</span> : null}\n      <input {...props} id={controlId} ref={ref} className={[styles.input, styles.bare, className].filter(Boolean).join(\" \")} aria-invalid={error ? true : props[\"aria-invalid\"]} aria-describedby={describedBy}/>\n      {suffix != null ? <span className={styles.suffix} aria-hidden=\"true\">{suffix}</span> : null}\n    </div> : <input {...props} id={controlId} ref={ref} className={[styles.input, className].filter(Boolean).join(\" \")} aria-invalid={error ? true : props[\"aria-invalid\"]} aria-describedby={describedBy}/>}\n    <FieldMessage id={hintId} text={description} className={styles.description} />\n    <FieldMessage id={errorId} text={error} className={styles.error} alert />\n  </div>;\n});\n\nInput.displayName = \"Input\";\n"},{"path":"registry/components/input/input.module.css","type":"registry:component","target":"@components/silicon-ui/input/input.module.css","content":"/* No row gap: grid tracks clamp a negative margin at zero, so a closed message row would still pay the gap. Each row carries its own space instead. */\n.field { display: grid; min-width: 0; }\n.label { margin-bottom: var(--space-related); color: var(--foreground); font-size: var(--text-sm); font-weight: var(--weight-medium); line-height: var(--leading-body); letter-spacing: var(--tracking-body); }\n/* Focus answers with the border colour alone (no rings or halos); the field itself never changes size. */\n.input { width: 100%; min-height: var(--control-height-md); padding: 0 var(--space-group); border: 1px solid var(--border-strong); border-radius: var(--radius-control); background: var(--surface); color: var(--foreground); font: inherit; font-size: var(--field-text-size, var(--text-sm)); line-height: var(--leading-body); letter-spacing: var(--tracking-body); outline: none; transition: border-color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard); }\n.input::placeholder { color: var(--text-muted); }\n@media (hover: hover) and (pointer: fine) { .input:hover:not(:disabled, [aria-invalid=\"true\"]) { border-color: var(--foreground); } }\n.input:focus-visible { border-color: var(--foreground); }\n.input[aria-invalid=\"true\"] { border-color: var(--danger); }\n.input:disabled { cursor: not-allowed; opacity: .5; background: var(--surface-muted); }\n/* With a prefix or suffix the box is the control around the input: the prefix sits in line with the typed text, at its\n   size, so \"c:\" and \"anil\" read as one id; the input inside is bare. Hover, focus, invalid and disabled move to the box. */\n.control { display: flex; width: 100%; min-height: var(--control-height-md); box-sizing: border-box; align-items: center; padding: 0 var(--space-group); border: 1px solid var(--border-strong); border-radius: var(--radius-control); background: var(--surface); color: var(--foreground); font-size: var(--field-text-size, var(--text-sm)); line-height: var(--leading-body); letter-spacing: var(--tracking-body); cursor: text; transition: border-color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard); }\n.input.bare { min-width: 0; min-height: calc(var(--control-height-md) - 2px); flex: 1; padding: 0; border: 0; border-radius: 0; background: transparent; }\n.prefix, .suffix { display: inline-flex; flex: none; align-items: center; color: var(--text-secondary); font: inherit; letter-spacing: inherit; white-space: nowrap; pointer-events: none; }\n.suffix { margin-inline-start: var(--space-related); }\n@media (hover: hover) and (pointer: fine) { .control:hover:not(:has(:disabled, [aria-invalid=\"true\"])) { border-color: var(--foreground); } }\n.control:has(.input:focus-visible) { border-color: var(--foreground); }\n.control:has(.input[aria-invalid=\"true\"]) { border-color: var(--danger); }\n.control:has(.input:disabled) { cursor: not-allowed; opacity: .5; background: var(--surface-muted); }\n.control:has(.input:disabled) .input { opacity: 1; background: transparent; }\n/* The row's space is padding inside the clipped slot, so the height animates from a true zero. */\n.messageSlot { display: block; overflow: hidden; }\n.description, .error { display: block; padding-top: var(--space-related); font-size: var(--field-hint-size, var(--text-xs)); line-height: var(--leading-body); letter-spacing: var(--tracking-body); }\n.description { color: var(--field-hint-colour, var(--text-muted)); } .error { color: var(--danger); }\n/* Words are measured against this box when they pop out to leave, so it must be the positioned parent. */\n.words { position: relative; display: block; }\n.word { display: inline-block; white-space: pre; }\n/* One column per character of a count. Tabular digits keep columns equal, so only a gained or lost digit changes the width. */\n.column { position: relative; display: inline-flex; justify-content: center; font-variant-numeric: tabular-nums; }\n.column > span { display: inline-block; }\n.srOnly { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n@media (prefers-reduced-motion: reduce) { .input { transition-duration: .01ms; } }\n"},{"path":"registry/components/button/button.tsx","type":"registry:component","target":"@components/silicon-ui/button/button.tsx","content":"\"use client\";\n\nimport { forwardRef, isValidElement, useCallback, useEffect, useLayoutEffect, useRef } from \"react\";\nimport type { ButtonHTMLAttributes, ReactNode, Ref, RefObject } from \"react\";\nimport { AnimatePresence, animate, motion, useIsPresent, useMotionValue, useReducedMotion } from \"motion/react\";\nimport type { TargetAndTransition, Variants } from \"motion/react\";\nimport { motionTokens } from \"../lib/motion-tokens\";\nimport styles from \"./button.module.css\";\n\n/** `soft` is filled and borderless, for controls in a bar (experimental). `link` is text with an underline, for an action\n * among words (a switch under a field); `--button-link-underline` sets the resting underline (transparent: on hover only). */\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"ghost\" | \"danger\" | \"soft\" | \"link\";\n/** `xs` (24px) is for dense UI such as tree rows and toolbars, usually icon-only with an aria-label. */\nexport type ButtonSize = \"xs\" | \"sm\" | \"md\" | \"lg\";\n\nexport interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"onDrag\" | \"onDragEnd\" | \"onDragStart\" | \"onAnimationStart\"> {\n  /** The look: `primary` (default) for the main action, `secondary` bordered, `ghost` quiet, `danger` destructive, `soft` filled for bars, `link` underlined text. */\n  variant?: ButtonVariant;\n  /** Height: `xs` 24px, `sm` 36px, `md` 44px (default), `lg` 50px. */\n  size?: ButtonSize;\n  /** Shows a spinner in place of the label and sets aria-busy, keeping the button's width. */\n  loading?: boolean;\n}\n\n/** Icon buttons press a little deeper, wide buttons a little less, so every size reads as the same push. */\nconst pressVariants: Variants = {\n  pressed: (button: RefObject<HTMLButtonElement | null>) => {\n    const width = button.current?.offsetWidth ?? 0;\n    return { scale: width > 220 ? .985 : width && width <= 48 ? .96 : .97, transition: { duration: motionTokens.duration.instant, ease: [...motionTokens.ease.standard] } };\n  },\n};\n\nconst rest: TargetAndTransition = { opacity: 1, y: 0, scale: 1, filter: \"blur(0px)\" };\n/** Text rises about .3em out of a soft blur; the outgoing label lifts away a little faster. */\nconst textIn: TargetAndTransition = { opacity: 0, y: 4, filter: `blur(${motionTokens.blur.soft}px)` };\nconst textOut: TargetAndTransition = { opacity: 0, y: -3, filter: `blur(${motionTokens.blur.soft}px)`, transition: { duration: motionTokens.duration.fast, ease: [...motionTokens.ease.standard] } };\nconst iconIn: TargetAndTransition = { opacity: 0, scale: .6, filter: `blur(${motionTokens.blur.subtle}px)` };\nconst iconOut: TargetAndTransition = { opacity: 0, scale: .6, filter: `blur(${motionTokens.blur.subtle}px)`, transition: { duration: motionTokens.duration.fast, ease: [...motionTokens.ease.standard] } };\nconst fadeIn: TargetAndTransition = { ...rest, opacity: 0 };\nconst fadeOut: TargetAndTransition = { opacity: 0, transition: { duration: motionTokens.duration.instant } };\n/** Scale rides the spring; opacity and blur tween so blur never overshoots below zero. */\nconst iconEnter = { ...motionTokens.spring.snappy, opacity: { duration: motionTokens.duration.fast, ease: [...motionTokens.ease.enter] }, filter: { duration: motionTokens.duration.fast, ease: [...motionTokens.ease.enter] } } as const;\n\n/** A key for the label content: text plus element names, so a new label or icon crossfades while prop-only updates stay in place. */\nfunction labelKey(node: ReactNode): string {\n  if (node == null || typeof node === \"boolean\") return \"\";\n  if (typeof node === \"string\" || typeof node === \"number\" || typeof node === \"bigint\") return String(node);\n  if (Array.isArray(node)) return node.map(labelKey).join(\"\");\n  if (!isValidElement(node)) return \"\";\n  const type = node.type as string | { displayName?: string; name?: string };\n  return `<${typeof type === \"string\" ? type : type?.displayName ?? type?.name ?? \"\"}>${labelKey((node.props as { children?: ReactNode }).children)}`;\n}\n\n/** Springs the slot to the natural width of the incoming label when it changes, so a new label never snaps the button's size.\n *  The outgoing label is popped out of flow at once, so it never holds the old width. Other resizes (a late web font, a parent reflow) jump straight to the new width, so nothing wobbles on first paint. */\nfunction useMorphWidth(content: RefObject<HTMLElement | null>, key: string, reduced: boolean) {\n  const width = useMotionValue<number | \"auto\">(\"auto\");\n  const lastKey = useRef(key), armedUntil = useRef(0);\n  useLayoutEffect(() => {\n    if (lastKey.current === key) return;\n    lastKey.current = key;\n    armedUntil.current = performance.now() + 700;\n  }, [key]);\n  useEffect(() => {\n    const node = content.current, slot = node?.parentElement;\n    if (!node || !slot || typeof ResizeObserver === \"undefined\") return;\n    let measured = false;\n    const observer = new ResizeObserver(([entry]) => {\n      if (!entry) return;\n      const next = entry.contentRect.width;\n      if (!next || !measured || reduced || performance.now() > armedUntil.current) { measured = next > 0; width.jump(next || \"auto\"); delete slot.dataset.morphing; return; }\n      slot.dataset.morphing = \"\";\n      animate(width, next, { ...motionTokens.spring.morph, onComplete: () => { delete slot.dataset.morphing; } });\n    });\n    observer.observe(node);\n    return () => observer.disconnect();\n  }, [content, reduced, width]);\n  return width;\n}\n\nfunction LabelPhase({ children, icon, reduced, ref }: { children: ReactNode; icon: boolean; reduced: boolean; ref?: Ref<HTMLSpanElement> }) {\n  const present = useIsPresent();\n  return <motion.span ref={ref} className={styles.labelPhase} aria-hidden={present ? undefined : true} initial={reduced ? fadeIn : icon ? iconIn : textIn} animate={rest} exit={reduced ? fadeOut : icon ? iconOut : textOut} transition={reduced ? { duration: motionTokens.duration.instant } : icon ? iconEnter : { duration: motionTokens.duration.standard, ease: [...motionTokens.ease.enter] }}>{children}</motion.span>;\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n  { className, variant = \"primary\", size = \"md\", loading = false, disabled, children, onClick, ...props },\n  ref,\n) {\n  const reduceMotion = useReducedMotion() ?? false;\n  const buttonRef = useRef<HTMLButtonElement | null>(null);\n  const contentRef = useRef<HTMLSpanElement>(null);\n  const key = labelKey(children);\n  const width = useMorphWidth(contentRef, key, reduceMotion);\n  const setRefs = useCallback((node: HTMLButtonElement | null) => {\n    buttonRef.current = node;\n    if (typeof ref === \"function\") ref(node); else if (ref) ref.current = node;\n  }, [ref]);\n  // A trigger that anchors a menu, popover, or dialog keeps its rect still while pressed, so the layer never measures a scaled anchor.\n  // Radix triggers (asChild) pass aria-haspopup or data-state through; the stylesheet repeats the guard.\n  const popup = props[\"aria-haspopup\"];\n  const anchorsLayer = (popup !== undefined && popup !== false && popup !== \"false\") || props.role === \"combobox\" || (props as Record<string, unknown>)[\"data-state\"] !== undefined;\n  const inert = disabled || loading || props[\"aria-disabled\"] === true || props[\"aria-disabled\"] === \"true\";\n  const classes = [styles.button, styles[variant], styles[size], className].filter(Boolean).join(\" \");\n  // An icon with no text: square at the compact size.\n  const iconOnly = !/\\S/.test(key.replace(/<[^>]*>/g, \"\"));\n\n  return (\n    <motion.button\n      ref={setRefs}\n      tabIndex={props.tabIndex ?? 0}\n      className={classes}\n      data-variant={variant}\n      data-icon-only={iconOnly || undefined}\n      disabled={disabled}\n      aria-busy={loading || undefined}\n      custom={buttonRef}\n      variants={pressVariants}\n      whileTap={reduceMotion || anchorsLayer || inert ? undefined : \"pressed\"}\n      transition={motionTokens.spring.snappy}\n      {...props}\n      // Loading keeps the button focusable (a disabled button would drop keyboard focus mid-action) and swallows presses instead.\n      aria-disabled={loading || props[\"aria-disabled\"] || undefined}\n      onClick={loading ? event => event.preventDefault() : onClick}\n    >\n      <AnimatePresence initial={false}>\n        {loading ? <motion.span key=\"loader\" className={styles.loader} aria-hidden=\"true\" initial={reduceMotion ? { opacity: 0 } : { opacity: 0, scale: .6 }} animate={{ opacity: 1, scale: 1 }} exit={reduceMotion ? fadeOut : { ...iconOut, scale: .8 }} transition={reduceMotion ? { duration: motionTokens.duration.instant } : iconEnter}><span className={styles.spinner} /></motion.span> : null}\n      </AnimatePresence>\n      <motion.span className={[styles.labelSlot, loading ? styles.loadingLabel : \"\"].filter(Boolean).join(\" \")} style={{ width }}>\n        <span ref={contentRef} className={styles.labelContent}>\n          <AnimatePresence mode=\"popLayout\" initial={false}>\n            <LabelPhase key={key} icon={!/\\S/.test(key.replace(/<[^>]*>/g, \"\"))} reduced={reduceMotion}>{children}</LabelPhase>\n          </AnimatePresence>\n        </span>\n      </motion.span>\n    </motion.button>\n  );\n});\n\nButton.displayName = \"Button\";\n\nexport default Button;\n"},{"path":"registry/components/button/button.module.css","type":"registry:component","target":"@components/silicon-ui/button/button.module.css","content":"/* Press scale is driven by Motion (whileTap) alone, so transform never gets a CSS transition here. */\n.button { position: relative; display: inline-flex; min-height: var(--control-height-md); align-items: center; justify-content: center; gap: var(--space-related); border: 1px solid transparent; border-radius: var(--radius-control); corner-shape: var(--corner-shape); padding: 0 var(--space-inset); font: inherit; font-size: var(--text-sm); font-weight: var(--weight-medium); letter-spacing: var(--tracking-body); line-height: var(--leading-body); white-space: nowrap; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard), opacity var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard); }\n.button:disabled { cursor: not-allowed; opacity: .52; }\n.button[aria-busy=\"true\"] { cursor: progress; }\n/* Anchors of floating layers never scale: Radix opens on pointerdown and would measure a shrunken trigger. */\n.button:is([aria-haspopup]:not([aria-haspopup=\"false\"]), [data-state], [role=\"combobox\"]) { transform: none !important; }\n/* The slot's width follows the incoming label on a spring. The label stays centered and may overflow evenly while the slot catches up;\n   the outgoing label pops out of flow against the slot itself, so it keeps its place instead of following the new content box. */\n.labelSlot { position: relative; display: inline-flex; min-width: 0; align-items: center; justify-content: center; transition: opacity var(--duration-fast) var(--ease-standard); }\n.labelSlot[data-morphing] { clip-path: inset(-50% calc(var(--space-group) * -1)); }\n.labelContent { display: inline-flex; flex: none; align-items: center; }\n.labelPhase { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-related); white-space: nowrap; }\n.labelPhase svg { flex: none; }\n.primary { color: var(--primary-foreground); background: var(--primary); border-color: var(--primary); }\n.secondary { color: var(--foreground); background: var(--surface); border-color: var(--border); }\n.ghost { color: var(--text-secondary); background: transparent; border-color: transparent; }\n.danger { color: var(--danger); background: var(--surface); border-color: var(--border); }\n/* Filled and borderless, for controls that live in a bar (a search trigger, a toolbar, a switcher). Place it on --background or\n   --surface; on a --surface-muted panel it has no fill to show. */\n.soft { color: var(--foreground); background: var(--surface-muted); border-color: transparent; }\n/* A disabled outlined button keeps its shape and fades only its label, so it still reads as a button that is off, not as plain text. */\n.secondary:disabled, .danger:disabled { opacity: 1; color: var(--text-muted); background: var(--surface-muted); border-color: var(--border); }\n.danger:disabled { color: color-mix(in oklab, var(--danger) 55%, var(--surface-muted)); }\n.ghost:disabled, .soft:disabled { opacity: 1; color: var(--text-muted); }\n@media (hover: hover) and (pointer: fine) {\n  .primary:hover:not(:disabled) { opacity: .91; box-shadow: var(--shadow-resting); }\n  .secondary:hover:not(:disabled) { background: var(--surface-muted); box-shadow: var(--shadow-resting); }\n  .ghost:hover:not(:disabled) { color: var(--foreground); background: var(--surface-muted); }\n  .danger:hover:not(:disabled) { border-color: var(--danger); background: var(--surface-muted); }\n  .soft:hover:not(:disabled) { background: var(--surface-pressed); }\n}\n/* Color feedback on press, so touch and menu triggers (which never scale) still answer the finger. */\n.primary:active:not(:disabled) { opacity: .84; }\n.secondary:active:not(:disabled), .ghost:active:not(:disabled) { color: var(--foreground); background: var(--surface-muted); }\n.danger:active:not(:disabled) { border-color: var(--danger); background: var(--surface-muted); }\n.soft:active:not(:disabled) { background: var(--surface-pressed); }\n.xs { min-height: var(--control-height-xs); gap: var(--space-tight); padding-inline: var(--space-related); font-size: var(--text-xs); letter-spacing: var(--tracking-body); }\n/* A compact icon-only button is a square, with the icon at its usual 16px. */\n.xs[data-icon-only] { min-width: var(--control-height-xs); padding-inline: 0; }\n.xs svg { width: 16px; height: 16px; }\n.sm { min-height: var(--control-height-sm); padding-inline: var(--space-group); font-size: var(--text-sm); }\n.md { min-height: var(--control-height-md); }\n.lg { min-height: var(--control-height-lg); padding-inline: var(--space-comfort); font-size: var(--text-sm); }\n/* link: text with an underline, no box. The underline is light at rest (--button-link-underline, default --border-strong;\n   transparent shows it on hover only) and takes the text's colour on hover and focus. After the sizes, so it drops their\n   height and padding but keeps their font size. */\n.button.link { min-width: 0; min-height: 0; padding: 0; gap: var(--space-tight); border: 0; background: transparent; color: var(--text-secondary); }\n.link .labelPhase { text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--button-link-underline, var(--border-strong)); transition: text-decoration-color var(--duration-fast) var(--ease-standard); }\n@media (hover: hover) and (pointer: fine) { .link:hover:not(:disabled) { color: var(--foreground); } .link:hover:not(:disabled) .labelPhase { text-decoration-color: currentColor; } }\n.link:focus-visible, .link:active:not(:disabled) { color: var(--foreground); }\n.link:focus-visible .labelPhase, .link:active:not(:disabled) .labelPhase { text-decoration-color: currentColor; }\n.link:disabled { opacity: 1; color: var(--text-muted); }\n.loader { position: absolute; left: 50%; top: 50%; display: grid; width: var(--space-inset); height: var(--space-inset); margin: calc(var(--space-inset) / -2); }\n.spinner { border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; corner-shape: round; animation: spin .7s linear infinite; }\n.loadingLabel { opacity: 0; }\n@keyframes spin { to { transform: rotate(360deg); } }\n@media (prefers-reduced-motion: reduce) { .button { transition: none; } .labelSlot { transition: opacity var(--duration-instant) linear; } .spinner { animation-duration: .01ms; animation-iteration-count: 1; } }\n"},{"path":"registry/components/avatar/avatar.tsx","type":"registry:component","target":"@components/silicon-ui/avatar/avatar.tsx","content":"\"use client\";\n\nimport { useLayoutEffect, useRef, useState, type HTMLAttributes } from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { SiliconImage } from \"../lib/silicon-provider\";\nimport { motionTokens } from \"../lib/motion-tokens\";\nimport styles from \"./avatar.module.css\";\nexport interface AvatarProps extends HTMLAttributes<HTMLSpanElement> { name: string; src?: string; /** `xs` (20px) is for dense lists such as space icons in a tree; `sm` 28, `md` 36, `lg` 48, `xl` 88. */ size?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\"; status?: \"online\" | \"offline\" }\nexport function Avatar({ name, src, size = \"md\", status, className, ...props }: AvatarProps) {\n  const initials = name.trim().split(/\\s+/).slice(0, 2).map(part => part[0]?.toUpperCase()).join(\"\");\n  const reduceMotion = !!useReducedMotion();\n  const image = useRef<HTMLImageElement>(null);\n  const [failedSrc, setFailedSrc] = useState<string>();\n  // A photo that is already decoded shows at once. One that is still loading waits, then fades in from a soft blur.\n  useLayoutEffect(() => { const node = image.current; if (node && !node.complete) node.dataset.loading = \"\"; }, [src]);\n  const showImage = src && failedSrc !== src;\n  return <span {...props} className={[styles.avatar, styles[size], className].filter(Boolean).join(\" \")} role=\"img\" aria-label={`${name}${status ? `, ${status}` : \"\"}`}>\n    {showImage ? <SiliconImage key={src} ref={image} src={src} alt=\"\" fill sizes={size === \"xl\" ? \"88px\" : size === \"lg\" ? \"48px\" : size === \"md\" ? \"36px\" : size === \"sm\" ? \"28px\" : \"20px\"} onLoad={event => { delete event.currentTarget.dataset.loading; }} onError={() => setFailedSrc(src)} /> : <span className={src ? styles.fallback : undefined} aria-hidden=\"true\">{initials}</span>}\n    <AnimatePresence initial={false}>{status && <motion.i key={status} className={[styles.status, styles[status]].join(\" \")} aria-hidden=\"true\" initial={{ opacity: 0, scale: .6 }} animate={{ opacity: 1, scale: 1 }} exit={{ opacity: 0, scale: .6, transition: { duration: reduceMotion ? 0 : motionTokens.duration.fast } }} transition={reduceMotion ? { duration: 0 } : motionTokens.spring.snappy} />}</AnimatePresence>\n  </span>;\n}\n"},{"path":"registry/components/avatar/avatar.module.css","type":"registry:component","target":"@components/silicon-ui/avatar/avatar.module.css","content":".avatar {\n  position: relative;\n  display: inline-grid;\n  flex: 0 0 auto;\n  place-items: center;\n  overflow: visible;\n  border: 1px solid var(--border);\n  border-radius: var(--avatar-radius); corner-shape: var(--avatar-corner-shape);\n  background: var(--surface-muted);\n  color: var(--foreground);\n  font-size: var(--text-xs);\n  font-weight: var(--weight-medium);\n}\n\n.avatar img {\n  pointer-events: none;\n  border-radius: inherit; corner-shape: inherit;\n  object-fit: cover;\n  transition: opacity var(--duration-standard) var(--ease-enter), filter var(--duration-standard) var(--ease-enter);\n}\n\n/* Set only while a photo is still downloading after mount, so cached photos never fade. */\n.avatar img[data-loading] {\n  opacity: 0;\n  filter: blur(4px);\n  transition: none;\n}\n\n.fallback { animation: avatar-fallback-in var(--duration-standard) var(--ease-enter) both; }\n\n/* Initials below the smallest type step, so two letters fit 20px. */\n.xs { width: 20px; height: 20px; font-size: calc(var(--text-xs) * .8); }\n.sm { width: 28px; height: 28px; font-size: var(--text-xs); }\n.md { width: 36px; height: 36px; }\n.lg { width: 48px; height: 48px; font-size: var(--text-sm); }\n.xl { width: 88px; height: 88px; font-size: var(--text-xl); }\n\n.status {\n  position: absolute;\n  right: 0;\n  bottom: 0;\n  z-index: 2;\n  width: 10px;\n  height: 10px;\n  border: 2px solid var(--surface);\n  border-radius: var(--radius-full); corner-shape: round;\n  box-shadow: 0 0 0 1px color-mix(in oklab, var(--border) 70%, transparent);\n}\n\n.xs .status { width: 6px; height: 6px; border-width: 1px; }\n.sm .status { width: 8px; height: 8px; border-width: 1.5px; }\n.lg .status { width: 12px; height: 12px; }\n.xl .status { width: 14px; height: 14px; right: var(--space-tight); bottom: var(--space-tight); }\n.online { background: var(--success); }\n.offline { background: var(--text-muted); }\n\n@keyframes avatar-fallback-in { from { opacity: 0; } to { opacity: 1; } }\n\n@media (prefers-reduced-motion: reduce) {\n  .avatar img { transition: none; }\n  .avatar img[data-loading] { filter: none; }\n  .fallback { animation: none; }\n}\n"},{"path":"lib/silicon-provider.tsx","type":"registry:lib","target":"@components/silicon-ui/lib/silicon-provider.tsx","content":"\"use client\";\n\n/**\n * Lets an app swap the link and image elements Silicon UI components render.\n *\n * Without a provider, Silicon UI renders a plain `<a>` and `<img>`, so components work in any React app (Vite, Remix, Astro,\n * plain React). Wrap the app once to use your framework's or your own components instead:\n *\n *   import Link from \"next/link\";\n *   import Image from \"next/image\";\n *   import { SiliconProvider } from \"@/components/silicon-ui/lib/silicon-provider\";\n *\n *   <SiliconProvider link={Link} image={Image}>{children}</SiliconProvider>\n *\n * Any component that accepts these props works, such as a locale-aware Link from next-intl or a React Router Link\n * wrapped to map `href` to `to`.\n */\nimport { createContext, createElement, useContext, useMemo, type AnchorHTMLAttributes, type ComponentType, type ImgHTMLAttributes, type ReactNode, type Ref } from \"react\";\n\n/** The props Silicon UI passes to a link: an href plus ordinary anchor attributes. */\nexport interface SiliconLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n  href: string;\n  ref?: Ref<HTMLAnchorElement>;\n}\n\n/**\n * The props Silicon UI passes to an image. A subset of next/image's props, so next/image can be passed as is: either `fill`\n * (cover the positioned parent) or `width` and `height`, plus `sizes` and `priority` as hints.\n */\nexport interface SiliconImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, \"src\" | \"alt\" | \"width\" | \"height\" | \"loading\" | \"srcSet\"> {\n  src: string;\n  alt: string;\n  width?: number;\n  height?: number;\n  /** Fills the nearest positioned parent, like next/image's `fill`. */\n  fill?: boolean;\n  /** Loads the image eagerly with high priority, like next/image's `priority`. */\n  priority?: boolean;\n  loading?: \"eager\" | \"lazy\";\n  ref?: Ref<HTMLImageElement>;\n}\n\nexport type SiliconLinkComponent = ComponentType<SiliconLinkProps>;\nexport type SiliconImageComponent = ComponentType<SiliconImageProps>;\n\n/** The default link: a plain anchor. */\nexport function SiliconAnchor(props: SiliconLinkProps) {\n  return <a {...props} />;\n}\n\nconst fillStyle = { position: \"absolute\", inset: 0, width: \"100%\", height: \"100%\" } as const;\n\n/** The default image: a plain, lazily decoded `<img>` that understands `fill` and `priority`. */\nexport function SiliconImg({ alt, fill, priority, loading, style, ...props }: SiliconImageProps) {\n  // eslint-disable-next-line @next/next/no-img-element -- the framework-free default; pass next/image through SiliconProvider instead.\n  return <img alt={alt} decoding=\"async\" {...props} loading={loading ?? (priority ? \"eager\" : \"lazy\")} fetchPriority={priority ? \"high\" : props.fetchPriority} style={fill ? { ...fillStyle, ...style } : style} />;\n}\n\ninterface SiliconComponents {\n  link: SiliconLinkComponent;\n  image: SiliconImageComponent;\n}\n\nconst SiliconContext = createContext<SiliconComponents>({ link: SiliconAnchor, image: SiliconImg });\n\nexport interface SiliconProviderProps {\n  /** The link component Silicon UI renders for navigation, such as next/link or your own wrapped Link. Defaults to `<a>`. */\n  link?: SiliconLinkComponent;\n  /** The image component Silicon UI renders for photos, such as next/image. Defaults to `<img>`. */\n  image?: SiliconImageComponent;\n  children: ReactNode;\n}\n\n/** Sets the link and image components for every Silicon UI component inside it. Nested providers inherit what they do not set. */\nexport function SiliconProvider({ link, image, children }: SiliconProviderProps) {\n  const parent = useContext(SiliconContext);\n  const value = useMemo(() => ({ link: link ?? parent.link, image: image ?? parent.image }), [link, image, parent]);\n  return <SiliconContext.Provider value={value}>{children}</SiliconContext.Provider>;\n}\n\n/** The link component from the nearest SiliconProvider, or a plain anchor. */\nexport const useArcLink = () => useContext(SiliconContext).link;\n/** The image component from the nearest SiliconProvider, or a plain img. */\nexport const useArcImage = () => useContext(SiliconContext).image;\n\n/** What Silicon UI components render for a link: the provider's link component, or a plain anchor. */\nexport function SiliconLink(props: SiliconLinkProps) {\n  return createElement(useArcLink(), props);\n}\n\n/** What Silicon UI components render for an image: the provider's image component, or a plain img. */\nexport function SiliconImage(props: SiliconImageProps) {\n  return createElement(useArcImage(), props);\n}\n"}],"docs":"Docs and live preview: https://ui.teamofsilicons.com/sign-in","meta":{"tier":"free","kind":"block","docs":"https://ui.teamofsilicons.com/sign-in","markdown":"https://ui.teamofsilicons.com/sign-in.md","status":"stable"}}