{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"contact-section","type":"registry:block","title":"Contact section","description":"A validated contact form that morphs into a confirmation, support channels, and office cards with local times.","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/copy-button.json","https://ui.teamofsilicons.com/r/input.json","https://ui.teamofsilicons.com/r/segmented-control.json","https://ui.teamofsilicons.com/r/textarea.json"],"files":[{"path":"registry/blocks/contact-section/contact-section.tsx","type":"registry:component","target":"@components/silicon-ui/blocks/contact-section/contact-section.tsx","content":"\"use client\";\n\nimport { forwardRef, useEffect, useId, useLayoutEffect, useRef, useState } from \"react\";\nimport type { FormEvent, KeyboardEvent, ReactNode } from \"react\";\nimport { AnimatePresence, LayoutGroup, motion, useAnimate, useIsPresent, useReducedMotion } from \"motion/react\";\nimport type { Variants } from \"motion/react\";\nimport { Check, Clock, Mail, MessageCircle, Phone, Users } from \"lucide-react\";\nimport { Avatar } from \"../../avatar/avatar\";\nimport { Button } from \"../../button/button\";\nimport { CopyButton } from \"../../copy-button/copy-button\";\nimport { Input } from \"../../input/input\";\nimport SegmentedControl from \"../../segmented-control/segmented-control\";\nimport { Textarea } from \"../../textarea/textarea\";\nimport { motionTokens } from \"../../lib/motion-tokens\";\nimport { person } from \"../../lib/media\";\nimport styles from \"./contact-section.module.css\";\n\nexport type ContactSectionVariant = \"form\" | \"channels\" | \"offices\";\n\nexport interface ContactMessage {\n  name: string;\n  email: string;\n  topic: string;\n  message: string;\n}\n\nexport interface ContactChannel {\n  value: string;\n  label: string;\n  /** One line under the label in the list, such as a response time. */\n  meta: string;\n  icon?: ReactNode;\n  /** The detail shown when the channel is selected. */\n  detail: ReactNode;\n}\n\nexport interface ContactOffice {\n  city: string;\n  /** IANA time zone, used for the live local time and open status. */\n  timeZone: string;\n  address: string[];\n  email?: string;\n  /** Opening hours in local 24 hour time. Defaults to 9 to 18. */\n  hours?: [number, number];\n}\n\nexport interface ContactSectionProps {\n  /** `form` validates and morphs into a confirmation, `channels` lists ways to reach you, `offices` shows live local times. */\n  variant?: ContactSectionVariant;\n  title?: string;\n  description?: string;\n  /** Topics offered in the form. */\n  topics?: string[];\n  /** Called with a valid message. Reject to keep the form and show an error; resolve to show the confirmation. */\n  onSubmit?: (message: ContactMessage) => void | Promise<void>;\n  channels?: ContactChannel[];\n  /** Selected channel (controlled). */\n  channel?: string;\n  defaultChannel?: string;\n  onChannelChange?: (value: string) => void;\n  offices?: ContactOffice[];\n  className?: string;\n}\n\ntype Bezier = [number, number, number, number];\nconst enter = [...motionTokens.ease.enter] as Bezier;\nconst standard = [...motionTokens.ease.standard] as Bezier;\nconst EMAIL = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]{2,}$/;\nconst MAX_MESSAGE = 500;\n\n/** Faces slide along one axis in the direction of travel and settle out of a soft blur. */\nconst faceVariants: Variants = {\n  hidden: ({ direction, axis }: { direction: number; axis: \"x\" | \"y\" }) => ({ opacity: 0, x: axis === \"x\" ? direction * 18 : 0, y: axis === \"y\" ? direction * 18 : 0, filter: `blur(${motionTokens.blur.soft}px)` }),\n  shown: { opacity: 1, x: 0, y: 0, filter: \"blur(0px)\", transition: { x: motionTokens.spring.smooth, y: motionTokens.spring.smooth, opacity: { duration: motionTokens.duration.standard, ease: enter, delay: .04 }, filter: { duration: motionTokens.duration.standard, ease: enter, delay: .04 } } },\n  gone: ({ direction, axis }: { direction: number; axis: \"x\" | \"y\" }) => ({ opacity: 0, x: axis === \"x\" ? direction * -12 : 0, y: axis === \"y\" ? direction * -12 : 0, filter: `blur(${motionTokens.blur.soft}px)`, transition: { duration: motionTokens.duration.fast, ease: standard } }),\n};\nconst fadeVariants: Variants = { hidden: { opacity: 0 }, shown: { opacity: 1, transition: { duration: motionTokens.duration.fast } }, gone: { opacity: 0, transition: { duration: motionTokens.duration.instant } } };\n\nfunction Face({ children, custom, reduced, className }: { children: ReactNode; custom: { direction: number; axis: \"x\" | \"y\" }; reduced: boolean; className?: string }) {\n  const present = useIsPresent();\n  return <motion.div className={className} data-face=\"\" data-leaving={present ? undefined : \"\"} inert={!present} custom={custom} variants={reduced ? fadeVariants : faceVariants} initial=\"hidden\" animate=\"shown\" exit=\"gone\">{children}</motion.div>;\n}\n\n/**\n * One surface that springs from the height of its old content to the new one when `faceKey` changes, while the faces\n * crossfade along an axis. Between switches the height is automatic, so fields that grow inside it never get clipped.\n */\nfunction MorphPanel({ faceKey, direction = 1, axis = \"y\", reduced, className, children, ...rest }: { faceKey: string; direction?: number; axis?: \"x\" | \"y\"; reduced: boolean; className?: string; children: ReactNode; id?: string; role?: string; \"aria-labelledby\"?: string }) {\n  const [scope, animate] = useAnimate<HTMLDivElement>();\n  const lastKey = useRef(faceKey);\n  const lastHeight = useRef(0);\n  useEffect(() => {\n    const node = scope.current;\n    if (!node || typeof ResizeObserver === \"undefined\") return;\n    lastHeight.current = node.offsetHeight;\n    const observer = new ResizeObserver(() => { lastHeight.current = node.offsetHeight; });\n    observer.observe(node);\n    return () => observer.disconnect();\n  }, [scope]);\n  useLayoutEffect(() => {\n    if (lastKey.current === faceKey) return;\n    lastKey.current = faceKey;\n    const node = scope.current;\n    const face = node?.querySelector<HTMLElement>(\":scope > [data-face]:not([data-leaving])\");\n    if (!node || !face || reduced) return;\n    const from = lastHeight.current || node.offsetHeight;\n    const to = face.offsetHeight;\n    if (Math.abs(from - to) < 1) return;\n    node.style.setProperty(\"height\", `${from}px`);\n    const controls = animate(node, { height: [from, to] }, motionTokens.spring.smooth);\n    controls.then(() => node.style.removeProperty(\"height\"));\n    return () => { controls.stop(); node.style.removeProperty(\"height\"); };\n  }, [faceKey, animate, scope, reduced]);\n  return <div ref={scope} className={[styles.morph, className].filter(Boolean).join(\" \")} {...rest}>\n    <AnimatePresence initial={false} mode=\"popLayout\" custom={{ direction, axis }}>\n      <Face key={faceKey} custom={{ direction, axis }} reduced={reduced} className={styles.face}>{children}</Face>\n    </AnimatePresence>\n  </div>;\n}\n\n/** Topic chips as a radio group: a highlight glides to the choice and arrow keys move it. */\nfunction TopicPicker({ topics, value, onChange, reduced }: { topics: string[]; value: string; onChange: (topic: string) => void; reduced: boolean }) {\n  const id = useId();\n  const refs = useRef<(HTMLButtonElement | null)[]>([]);\n  function onKeyDown(event: KeyboardEvent) {\n    const delta = event.key === \"ArrowRight\" || event.key === \"ArrowDown\" ? 1 : event.key === \"ArrowLeft\" || event.key === \"ArrowUp\" ? -1 : 0;\n    if (!delta) return;\n    event.preventDefault();\n    const next = (topics.indexOf(value) + delta + topics.length) % topics.length;\n    onChange(topics[next]!);\n    refs.current[next]?.focus();\n  }\n  return <div className={styles.topicField}>\n    <span id={`${id}-label`} className={styles.fieldLabel}>Topic</span>\n    <LayoutGroup id={id}>\n      <div className={styles.topics} role=\"radiogroup\" aria-labelledby={`${id}-label`} onKeyDown={onKeyDown}>\n        {topics.map((topic, index) => <button key={topic} ref={node => { refs.current[index] = node; }} type=\"button\" role=\"radio\" aria-checked={topic === value} tabIndex={topic === value ? 0 : -1} className={styles.topic} onClick={() => onChange(topic)}>\n          {topic === value && <motion.span layoutId=\"topic\" className={styles.topicHighlight} transition={reduced ? { duration: 0 } : motionTokens.spring.morph} aria-hidden=\"true\" />}\n          <span>{topic}</span>\n        </button>)}\n      </div>\n    </LayoutGroup>\n  </div>;\n}\n\ntype Errors = Partial<Record<\"name\" | \"email\" | \"message\", string>>;\nfunction validate(values: { name: string; email: string; message: string }): Errors {\n  const errors: Errors = {};\n  if (!values.name.trim()) errors.name = \"Enter your name\";\n  if (!values.email.trim()) errors.email = \"Enter your email address\";\n  else if (!EMAIL.test(values.email.trim())) errors.email = \"Enter an email like name@example.com\";\n  if (values.message.trim().length < 20) errors.message = values.message.trim() ? \"Add a little more detail, at least 20 characters\" : \"Tell us how we can help\";\n  return errors;\n}\n\nfunction ContactForm({ topics, onSubmit, reduced }: { topics: string[]; onSubmit?: ContactSectionProps[\"onSubmit\"]; reduced: boolean }) {\n  const [values, setValues] = useState({ name: \"\", email: \"\", message: \"\" });\n  const [topic, setTopic] = useState(topics[0] ?? \"\");\n  const [errors, setErrors] = useState<Errors>({});\n  const [submitted, setSubmitted] = useState(false);\n  const [phase, setPhase] = useState<\"editing\" | \"sending\" | \"sent\">(\"editing\");\n  const [failure, setFailure] = useState<string | null>(null);\n  const [sentTo, setSentTo] = useState({ name: \"\", email: \"\" });\n  const nameRef = useRef<HTMLInputElement>(null), emailRef = useRef<HTMLInputElement>(null), messageRef = useRef<HTMLTextAreaElement>(null);\n  const restoreFocus = useRef(false);\n  const successRef = useRef<HTMLHeadingElement>(null);\n\n  useEffect(() => {\n    if (phase === \"sent\") successRef.current?.focus();\n    if (phase === \"editing\" && restoreFocus.current) { restoreFocus.current = false; nameRef.current?.focus(); }\n  }, [phase]);\n\n  const update = (field: keyof typeof values) => (event: { target: { value: string } }) => {\n    const next = { ...values, [field]: event.target.value };\n    setValues(next);\n    if (submitted) setErrors(validate(next));\n  };\n\n  async function submit(event: FormEvent) {\n    event.preventDefault();\n    if (phase !== \"editing\") return;\n    setSubmitted(true);\n    setFailure(null);\n    const found = validate(values);\n    setErrors(found);\n    if (found.name) { nameRef.current?.focus(); return; }\n    if (found.email) { emailRef.current?.focus(); return; }\n    if (found.message) { messageRef.current?.focus(); return; }\n    setPhase(\"sending\");\n    const payload = { name: values.name.trim(), email: values.email.trim(), topic, message: values.message.trim() };\n    try {\n      await (onSubmit ? onSubmit(payload) : new Promise(resolve => setTimeout(resolve, 1100)));\n      setSentTo({ name: payload.name.split(/\\s+/)[0]!, email: payload.email });\n      setPhase(\"sent\");\n    } catch {\n      setPhase(\"editing\");\n      setFailure(\"We couldn't send your message. Check your connection and try again.\");\n    }\n  }\n\n  function reset() {\n    setValues({ name: \"\", email: \"\", message: \"\" });\n    setErrors({});\n    setSubmitted(false);\n    setFailure(null);\n    restoreFocus.current = true;\n    setPhase(\"editing\");\n  }\n\n  const left = MAX_MESSAGE - values.message.length;\n  return <MorphPanel faceKey={phase === \"sent\" ? \"sent\" : \"form\"} direction={phase === \"sent\" ? 1 : -1} reduced={reduced} className={styles.formCard}>\n    {phase === \"sent\"\n      ? <div className={styles.success} aria-live=\"polite\">\n          <span className={styles.successMark} aria-hidden=\"true\">\n            <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n              <motion.path d=\"M5 12.5l4.5 4.5L19 7.5\" initial={reduced ? false : { pathLength: 0 }} animate={{ pathLength: 1 }} transition={{ duration: reduced ? 0 : .42, ease: enter, delay: .16 }} />\n            </svg>\n          </span>\n          <h3 ref={successRef} tabIndex={-1} className={styles.successTitle}>Thanks, {sentTo.name}</h3>\n          <p className={styles.successText}>Your message is with our {topic.toLowerCase()} team. We&rsquo;ll reply to {sentTo.email} within one business day.</p>\n          <Button variant=\"secondary\" onClick={reset}>Send another message</Button>\n        </div>\n      : <form className={styles.formBody} onSubmit={submit} noValidate aria-label=\"Contact form\">\n          <div className={styles.row}>\n            <Input ref={nameRef} label=\"Name\" name=\"name\" autoComplete=\"name\" placeholder=\"Emma Collins\" value={values.name} onChange={update(\"name\")} error={errors.name} readOnly={phase === \"sending\"} />\n            <Input ref={emailRef} label=\"Work email\" name=\"email\" type=\"email\" inputMode=\"email\" autoComplete=\"email\" placeholder=\"emma@northwind.example\" value={values.email} onChange={update(\"email\")} error={errors.email} readOnly={phase === \"sending\"} />\n          </div>\n          <TopicPicker topics={topics} value={topic} onChange={setTopic} reduced={reduced} />\n          <Textarea ref={messageRef} label=\"Message\" name=\"message\" rows={4} maxLength={MAX_MESSAGE} placeholder=\"What are you building?\" value={values.message} onChange={update(\"message\")} error={errors.message} description={`${left} characters left`} readOnly={phase === \"sending\"} />\n          <AnimatePresence initial={false}>\n            {failure && <motion.p key=\"failure\" role=\"alert\" className={styles.failure} initial={{ opacity: 0, height: 0 }} animate={{ opacity: 1, height: \"auto\" }} exit={{ opacity: 0, height: 0 }} transition={reduced ? { duration: 0 } : { height: motionTokens.spring.smooth, opacity: { duration: motionTokens.duration.fast, ease: standard } }}>{failure}</motion.p>}\n          </AnimatePresence>\n          <div className={styles.submitRow}>\n            <p className={styles.fine}>We reply within one business day.</p>\n            <Button type=\"submit\" variant=\"primary\" loading={phase === \"sending\"}>Send message</Button>\n          </div>\n        </form>}\n  </MorphPanel>;\n}\n\nconst hannah = person(\"hannah-walsh\");\nconst ICON = { size: 18, strokeWidth: 1.75, \"aria-hidden\": true } as const;\n\n/** A demo action that confirms in place: the label morphs, and the result stays visible below it. */\nfunction ConfirmAction({ idle, busy, done, note }: { idle: string; busy?: boolean; done: string; note?: ReactNode }) {\n  const reduced = !!useReducedMotion();\n  const [state, setState] = useState<\"idle\" | \"busy\" | \"done\">(\"idle\");\n  const timer = useRef<number | undefined>(undefined);\n  useEffect(() => () => window.clearTimeout(timer.current), []);\n  return <div className={styles.confirm}>\n    <Button variant={state === \"done\" ? \"secondary\" : \"primary\"} loading={state === \"busy\"} onClick={() => {\n      if (state !== \"idle\") { setState(\"idle\"); return; }\n      if (busy) { setState(\"busy\"); timer.current = window.setTimeout(() => setState(\"done\"), 800); } else setState(\"done\");\n    }}>\n      {state === \"done\" ? <><Check size={15} strokeWidth={2.25} aria-hidden=\"true\" />{done}</> : idle}\n    </Button>\n    <div aria-live=\"polite\">\n      <AnimatePresence initial={false}>\n        {state === \"done\" && note && <motion.div key=\"note\" className={styles.confirmNote} initial={{ opacity: 0, height: 0 }} animate={{ opacity: 1, height: \"auto\" }} exit={{ opacity: 0, height: 0 }} transition={reduced ? { duration: 0 } : { height: motionTokens.spring.smooth, opacity: { duration: motionTokens.duration.fast, ease: standard } }}>{note}</motion.div>}\n      </AnimatePresence>\n    </div>\n  </div>;\n}\n\nexport const contactExampleChannels: ContactChannel[] = [\n  {\n    value: \"chat\", label: \"Chat with support\", meta: \"Replies in about 4 minutes\", icon: <MessageCircle {...ICON} />,\n    detail: <>\n      <h3>Chat with support</h3>\n      <p>Hannah and Jordan are online now. Chat is best for quick questions about installing, theming, or a component that misbehaves.</p>\n      <ConfirmAction idle=\"Start a chat\" busy done=\"Chat started\" note={<span className={styles.agent}><Avatar name={hannah.name} src={hannah.src} size=\"sm\" status=\"online\" /><span><strong>{hannah.name}</strong> joined the chat. Say hello.</span></span>} />\n    </>,\n  },\n  {\n    value: \"email\", label: \"Email support\", meta: \"Replies within a business day\", icon: <Mail {...ICON} />,\n    detail: <>\n      <h3>Email support</h3>\n      <p>Send screenshots, links, or a reproduction. Every message gets a reply from a person within one business day.</p>\n      <div className={styles.copyRow}><span>support@example.com</span><CopyButton value=\"support@example.com\" label=\"Copy email\" /></div>\n    </>,\n  },\n  {\n    value: \"sales\", label: \"Talk to sales\", meta: \"Weekdays, 9am to 6pm PT\", icon: <Phone {...ICON} />,\n    detail: <>\n      <h3>Talk to sales</h3>\n      <p>Licensing for a larger team, invoicing, or a security review. Tyler will walk you through it on a 20 minute call.</p>\n      <div className={styles.copyRow}><span className={styles.tabular}>+1 (415) 555-0132</span><CopyButton value=\"+14155550132\" label=\"Copy number\" /></div>\n      <ConfirmAction idle=\"Request a call\" busy done=\"Call requested\" note=\"Tyler will email you a few times that work this week.\" />\n    </>,\n  },\n  {\n    value: \"community\", label: \"Ask the community\", meta: \"4,200 members\", icon: <Users {...ICON} />,\n    detail: <>\n      <h3>Ask the community</h3>\n      <p>Designers and engineers who ship with Silicon UI answer questions about components, theming, and motion, usually within the hour.</p>\n      <ConfirmAction idle=\"Open the forum\" done=\"Forum opened\" note=\"The forum opens in a new tab on the live site.\" />\n    </>,\n  },\n];\n\nexport const contactExampleOffices: ContactOffice[] = [\n  { city: \"San Francisco\", timeZone: \"America/Los_Angeles\", address: [\"100 Example Street, Floor 4\", \"San Francisco, CA 94000\"], email: \"sf@example.com\" },\n  { city: \"New York\", timeZone: \"America/New_York\", address: [\"200 Sample Avenue, Suite 12\", \"New York, NY 10000\"], email: \"nyc@example.com\" },\n  { city: \"Lisbon\", timeZone: \"Europe/Lisbon\", address: [\"Rua do Exemplo 10, 3º\", \"1000-000 Lisboa, Portugal\"], email: \"lisbon@example.com\" },\n];\n\nfunction useNow(intervalMs: number) {\n  const [now, setNow] = useState<Date | null>(null);\n  useEffect(() => {\n    const tick = () => setNow(new Date());\n    tick();\n    const timer = window.setInterval(tick, intervalMs);\n    return () => window.clearInterval(timer);\n  }, [intervalMs]);\n  return now;\n}\n\nfunction officeState(office: ContactOffice, now: Date | null) {\n  if (!now) return { time: \"--:--\", open: null as boolean | null };\n  const parts = new Intl.DateTimeFormat(\"en-US\", { timeZone: office.timeZone, hour: \"numeric\", minute: \"2-digit\", weekday: \"short\", hourCycle: \"h23\" }).formatToParts(now);\n  const get = (type: string) => parts.find(part => part.type === type)?.value ?? \"\";\n  const hour = Number(get(\"hour\")), weekday = get(\"weekday\");\n  const [start, end] = office.hours ?? [9, 18];\n  const time = new Intl.DateTimeFormat(\"en-US\", { timeZone: office.timeZone, hour: \"numeric\", minute: \"2-digit\" }).format(now);\n  return { time, open: weekday !== \"Sat\" && weekday !== \"Sun\" && hour >= start && hour < end };\n}\n\nconst hourLabel = (hour: number) => `${hour % 12 || 12}${hour < 12 || hour === 24 ? \"am\" : \"pm\"}`;\n\nfunction Offices({ offices }: { offices: ContactOffice[] }) {\n  const now = useNow(15000);\n  return <ul className={styles.offices}>\n    {offices.map(office => {\n      const { time, open } = officeState(office, now);\n      return <li key={office.city} className={styles.office}>\n        <div className={styles.officeHead}>\n          <h3>{office.city}</h3>\n          <span className={styles.officeTime}><Clock size={14} strokeWidth={1.75} aria-hidden=\"true\" /><span className={styles.tabular}>{time}</span></span>\n        </div>\n        <span className={styles.officeStatus} data-open={open === null ? undefined : open ? \"\" : undefined} data-closed={open === false ? \"\" : undefined}>\n          <span className={styles.statusDot} aria-hidden=\"true\" />{open === null ? \"Checking hours\" : open ? `Open until ${hourLabel((office.hours ?? [9, 18])[1])}` : \"Closed now\"}\n        </span>\n        <address className={styles.address}>{office.address.map(line => <span key={line}>{line}</span>)}</address>\n        <div className={styles.officeActions}>\n          {office.email && <a className={styles.officeLink} href={`mailto:${office.email}`}>{office.email}</a>}\n          <CopyButton value={office.address.join(\", \")} label=\"Copy address\" variant=\"plain\" />\n        </div>\n      </li>;\n    })}\n  </ul>;\n}\n\nfunction Channels({ channels, value, onChange, reduced }: { channels: ContactChannel[]; value: string; onChange: (value: string) => void; reduced: boolean }) {\n  const id = useId();\n  const [direction, setDirection] = useState(1);\n  const refs = useRef<(HTMLButtonElement | null)[]>([]);\n  const active = channels.find(channel => channel.value === value) ?? channels[0]!;\n  const choose = (next: string) => {\n    if (next === active.value) return;\n    setDirection(Math.sign(channels.findIndex(channel => channel.value === next) - channels.indexOf(active)) || 1);\n    onChange(next);\n  };\n  function onKeyDown(event: KeyboardEvent) {\n    const delta = event.key === \"ArrowDown\" || event.key === \"ArrowRight\" ? 1 : event.key === \"ArrowUp\" || event.key === \"ArrowLeft\" ? -1 : 0;\n    const edge = event.key === \"Home\" ? 0 : event.key === \"End\" ? channels.length - 1 : -1;\n    if (!delta && edge < 0) return;\n    event.preventDefault();\n    const next = edge >= 0 ? edge : (channels.indexOf(active) + delta + channels.length) % channels.length;\n    choose(channels[next]!.value);\n    refs.current[next]?.focus();\n  }\n  return <div className={styles.channels}>\n    <LayoutGroup id={id}>\n      <div className={styles.channelList} role=\"tablist\" aria-orientation=\"vertical\" aria-label=\"Ways to reach us\" onKeyDown={onKeyDown}>\n        {channels.map((channel, index) => {\n          const selected = channel.value === active.value;\n          return <button key={channel.value} ref={node => { refs.current[index] = node; }} type=\"button\" role=\"tab\" id={`${id}-tab-${channel.value}`} aria-selected={selected} aria-controls={`${id}-panel`} tabIndex={selected ? 0 : -1} className={styles.channel} onClick={() => choose(channel.value)}>\n            {selected && <motion.span layoutId=\"channel\" className={styles.channelHighlight} transition={reduced ? { duration: 0 } : motionTokens.spring.morph} aria-hidden=\"true\" />}\n            <span className={styles.channelIcon}>{channel.icon}</span>\n            <span className={styles.channelText}><span>{channel.label}</span><span>{channel.meta}</span></span>\n          </button>;\n        })}\n      </div>\n    </LayoutGroup>\n    <MorphPanel faceKey={active.value} direction={direction} axis=\"y\" reduced={reduced} className={styles.channelPanel} id={`${id}-panel`} role=\"tabpanel\" aria-labelledby={`${id}-tab-${active.value}`}>\n      <div className={styles.channelDetail}>{active.detail}</div>\n    </MorphPanel>\n  </div>;\n}\n\n/**\n * A contact section in three layouts: a validated form whose card springs into a confirmation, a list of support\n * channels whose detail panel morphs to each channel, and office cards with live local times and open status.\n */\nexport const ContactSection = forwardRef<HTMLElement, ContactSectionProps>(function ContactSection({\n  variant = \"form\",\n  title,\n  description,\n  topics = [\"Sales\", \"Support\", \"Partnerships\", \"Press\"],\n  onSubmit,\n  channels = contactExampleChannels,\n  channel: channelProp,\n  defaultChannel,\n  onChannelChange,\n  offices = contactExampleOffices,\n  className,\n}, ref) {\n  const id = useId();\n  const reduced = !!useReducedMotion();\n  const [innerChannel, setInnerChannel] = useState(defaultChannel ?? channels[0]?.value ?? \"\");\n  const activeChannel = channelProp ?? innerChannel;\n  const setChannel = (next: string) => { if (channelProp === undefined) setInnerChannel(next); onChannelChange?.(next); };\n  const copy = {\n    form: { title: \"Talk to our team\", description: \"Questions about licensing, a bug you can't pin down, or a component you wish existed. A person reads every message.\" },\n    channels: { title: \"Get help your way\", description: \"Pick whatever suits the question. Every channel reaches the same small team.\" },\n    offices: { title: \"Visit us\", description: \"We work across three time zones, so someone is usually awake. Drop by for coffee, just let us know first.\" },\n  }[variant];\n\n  return <section ref={ref} className={[styles.contact, className].filter(Boolean).join(\" \")} data-variant={variant} aria-labelledby={`${id}-title`}>\n    <div className={styles.inner}>\n      <div className={styles.intro}>\n        <h2 id={`${id}-title`} className={styles.title}>{title ?? copy.title}</h2>\n        <p className={styles.description}>{description ?? copy.description}</p>\n        {variant === \"form\" && <ul className={styles.facts}>\n          <li><Clock size={16} strokeWidth={1.75} aria-hidden=\"true\" />Replies within one business day</li>\n          <li><Mail size={16} strokeWidth={1.75} aria-hidden=\"true\" /><span>hello@example.com</span><CopyButton value=\"hello@example.com\" label=\"Copy email\" iconOnly variant=\"plain\" /></li>\n        </ul>}\n      </div>\n      {variant === \"form\" && <ContactForm topics={topics} onSubmit={onSubmit} reduced={reduced} />}\n      {variant === \"channels\" && <Channels channels={channels} value={activeChannel} onChange={setChannel} reduced={reduced} />}\n      {variant === \"offices\" && <Offices offices={offices} />}\n    </div>\n  </section>;\n});\n\nContactSection.displayName = \"ContactSection\";\n\nconst variantOptions = [{ value: \"form\", label: \"Form\" }, { value: \"channels\", label: \"Channels\" }, { value: \"offices\", label: \"Offices\" }];\n\n/** Preview: the contact section with a switch between its three layouts. Messages are simulated and never sent. */\nexport function ContactSectionBlock({ variant: initial = \"form\" }: { variant?: ContactSectionVariant }) {\n  const [variant, setVariant] = useState<ContactSectionVariant>(initial);\n  return <div className={styles.preview}>\n    <SegmentedControl label=\"Contact layout\" options={variantOptions} value={variant} onValueChange={next => setVariant(next as ContactSectionVariant)} />\n    <div className={styles.frame}>\n      <ContactSection key={variant} variant={variant} />\n    </div>\n  </div>;\n}\n\nexport default ContactSectionBlock;\n"},{"path":"registry/blocks/contact-section/contact-section.module.css","type":"registry:component","target":"@components/silicon-ui/blocks/contact-section/contact-section.module.css","content":".contact { container: contact / inline-size; background: var(--background); color: var(--foreground); font-family: var(--font-body); letter-spacing: var(--tracking-body); }\n.tabular { font-variant-numeric: tabular-nums; }\n\n.inner { display: grid; max-width: 1120px; gap: var(--space-page); margin: 0 auto; padding: var(--space-screen) var(--space-block); }\n.contact[data-variant=\"form\"] .inner { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); align-items: start; gap: var(--space-page); }\n.intro { display: grid; align-content: start; gap: var(--space-group); max-width: 520px; }\n.title { margin: 0; font-family: var(--font-display); font-size: clamp(var(--text-2xl), var(--text-base) + 3cqi, var(--text-4xl)); font-weight: var(--weight-medium); letter-spacing: var(--tracking-display); line-height: var(--leading-display); text-wrap: balance; }\n.description { margin: 0; color: var(--text-secondary); font-size: var(--text-base); line-height: 1.5; text-wrap: pretty; }\n.facts { display: grid; gap: var(--space-related); margin: var(--space-inset) 0 0; padding: 0; list-style: none; }\n.facts li { display: flex; min-height: 32px; align-items: center; gap: var(--space-related); color: var(--text-secondary); font-size: var(--text-sm); }\n.facts svg { flex: none; }\n\n/* Morphing surface: height springs between faces; the leaving face floats out of flow. */\n.morph { position: relative; overflow: hidden; }\n.face { width: 100%; }\n\n.formCard { border: 1px solid var(--border); border-radius: var(--radius-container); corner-shape: var(--corner-shape); background: var(--surface); }\n.formCard > .face { padding: var(--space-section); }\n.formBody { display: grid; gap: var(--space-comfort); }\n.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-inset); }\n.topicField { display: grid; }\n.fieldLabel { margin-bottom: var(--space-related); color: var(--foreground); font-size: var(--text-sm); font-weight: var(--weight-medium); line-height: var(--leading-body); }\n.topics { display: flex; flex-wrap: wrap; gap: var(--space-tight); }\n.topic { position: relative; isolation: isolate; height: var(--control-height-sm); border: 1px solid var(--border); border-radius: var(--radius-full); corner-shape: round; padding: 0 var(--space-inset); background: none; color: var(--text-secondary); font: inherit; font-size: var(--text-sm); font-weight: var(--weight-medium); cursor: pointer; -webkit-tap-highlight-color: transparent; transition: color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard); }\n.topic[aria-checked=\"true\"] { border-color: transparent; color: var(--control-glyph); }\n@media (hover: hover) and (pointer: fine) { .topic:not([aria-checked=\"true\"]):hover { border-color: var(--border-strong); color: var(--foreground); } }\n.topicHighlight { position: absolute; z-index: -1; inset: -1px; border-radius: inherit; corner-shape: inherit; background: var(--control-on); }\n.failure { overflow: hidden; margin: 0; color: var(--danger); font-size: var(--text-sm); }\n.submitRow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-group) var(--space-inset); }\n.fine { margin: 0; color: var(--text-muted); font-size: var(--text-sm); }\n\n.success { display: grid; justify-items: center; gap: var(--space-group); padding: var(--space-page) var(--space-related); text-align: center; }\n.successMark { display: grid; width: 52px; height: 52px; place-items: center; margin-bottom: var(--space-related); border-radius: 50%; corner-shape: round; background: color-mix(in oklab, var(--success) 13%, transparent); color: var(--success); }\n.successMark svg { width: 26px; height: 26px; }\n.successTitle { margin: 0; font-family: var(--font-display); font-size: var(--text-2xl); font-weight: var(--weight-medium); letter-spacing: var(--tracking-display); line-height: var(--leading-display); }\n.successText { max-width: 360px; margin: 0 0 var(--space-group); color: var(--text-secondary); font-size: var(--text-sm); line-height: 1.55; }\n\n/* Channels: a tab list beside one detail surface that morphs to each channel. */\n.channels { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); align-items: start; gap: var(--space-section); }\n.channelList { display: grid; gap: var(--space-hair); }\n.channel { position: relative; isolation: isolate; display: flex; align-items: center; gap: var(--space-group); border: 0; border-radius: var(--radius-control); corner-shape: var(--corner-shape); padding: var(--space-group) var(--space-inset); background: none; color: var(--foreground); font: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }\n.channelHighlight { position: absolute; z-index: -1; inset: 0; border-radius: inherit; corner-shape: inherit; background: var(--surface-muted); }\n.channelIcon { display: flex; flex: none; color: var(--text-muted); transition: color var(--duration-fast) var(--ease-standard); }\n.channel[aria-selected=\"true\"] .channelIcon { color: var(--accent); }\n.channelText { display: grid; gap: 1px; min-width: 0; }\n.channelText > span:first-child { font-size: var(--text-sm); font-weight: var(--weight-medium); }\n.channelText > span:last-child { overflow: hidden; color: var(--text-muted); font-size: var(--text-xs); text-overflow: ellipsis; white-space: nowrap; }\n@media (hover: hover) and (pointer: fine) { .channel:hover .channelIcon { color: var(--foreground); } }\n.channelPanel { border: 1px solid var(--border); border-radius: var(--radius-container); corner-shape: var(--corner-shape); background: var(--surface); }\n.channelPanel > .face { padding: var(--space-section); }\n.channelDetail { display: grid; justify-items: start; gap: var(--space-group); }\n.channelDetail h3 { margin: 0; font-size: var(--text-lg); font-weight: var(--weight-medium); line-height: var(--leading-body); }\n.channelDetail p { max-width: 480px; margin: 0 0 var(--space-related); color: var(--text-secondary); font-size: var(--text-sm); line-height: 1.6; }\n.copyRow { display: flex; width: min(100%, 360px); align-items: center; justify-content: space-between; gap: var(--space-group); border: 1px solid var(--border); border-radius: var(--radius-control); corner-shape: var(--corner-shape); padding: var(--space-tight) var(--space-tight) var(--space-tight) var(--space-inset); font-size: var(--text-sm); }\n.copyRow > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.confirm { display: grid; justify-items: start; gap: var(--space-related); }\n.confirmNote { overflow: hidden; color: var(--text-secondary); font-size: var(--text-sm); }\n.agent { display: flex; align-items: center; gap: var(--space-related); padding-top: var(--space-tight); }\n.agent strong { color: var(--foreground); font-weight: var(--weight-medium); }\n\n/* Offices */\n.offices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-inset); margin: 0; padding: 0; list-style: none; }\n.office { display: grid; align-content: start; gap: var(--space-group); border: 1px solid var(--border); border-radius: var(--radius-container); corner-shape: var(--corner-shape); padding: var(--space-section); background: var(--surface); }\n.officeHead { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-group); }\n.officeHead h3 { margin: 0; font-size: var(--text-lg); font-weight: var(--weight-medium); line-height: var(--leading-body); }\n/* Baseline alignment lets the time text, not the clock icon, sit on the city's baseline. */\n.officeTime { display: inline-flex; flex: none; align-items: baseline; gap: var(--space-related); color: var(--text-secondary); font-size: var(--text-sm); }\n.officeTime svg { align-self: center; }\n.officeStatus { display: inline-flex; align-items: center; gap: var(--space-related); color: var(--text-secondary); font-size: var(--text-sm); }\n.statusDot { width: 7px; height: 7px; border-radius: 50%; corner-shape: round; background: var(--border-strong); transition: background-color var(--duration-standard) var(--ease-standard); }\n.officeStatus[data-open] .statusDot { background: var(--success); box-shadow: 0 0 0 3px color-mix(in oklab, var(--success) 18%, transparent); }\n.address { display: grid; margin-top: var(--space-tight); color: var(--text-secondary); font-size: var(--text-sm); font-style: normal; line-height: 1.55; }\n.officeActions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-related); margin-top: var(--space-related); border-top: 1px solid var(--border-subtle); padding-top: var(--space-group); }\n.officeLink { color: var(--foreground); font-size: var(--text-sm); text-decoration: none; }\n@media (hover: hover) and (pointer: fine) { .officeLink:hover { text-decoration: underline; text-underline-offset: 3px; } }\n\n@container contact (max-width: 820px) {\n  .contact[data-variant=\"form\"] .inner { grid-template-columns: minmax(0, 1fr); gap: var(--space-block); }\n  .channels { grid-template-columns: minmax(0, 1fr); }\n  .channelList { display: flex; overflow-x: auto; scrollbar-width: none; }\n  .channelList::-webkit-scrollbar { display: none; }\n  .channel { flex: none; }\n  .channelText > span:last-child { display: none; }\n}\n@container contact (max-width: 520px) {\n  .inner { padding: var(--space-page) var(--space-inset); }\n  .row { grid-template-columns: minmax(0, 1fr); }\n  .formCard > .face, .channelPanel > .face { padding: var(--space-comfort); }\n  .submitRow > button { width: 100%; }\n}\n\n.preview { display: grid; width: 100%; justify-items: center; gap: var(--space-inset); }\n.frame { width: 100%; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-control); corner-shape: var(--corner-shape); background: var(--background); }\n.previewNote { min-height: 20px; margin: 0; color: var(--text-muted); font-size: var(--text-xs); }\n\n@media (prefers-reduced-motion: reduce) {\n  .topic, .channelIcon, .statusDot { transition: none; }\n}\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/textarea/textarea.tsx","type":"registry:component","target":"@components/silicon-ui/textarea/textarea.tsx","content":"\"use client\";\nimport { forwardRef, useEffect, useId, useRef, useState } from \"react\";\nimport type { TextareaHTMLAttributes } from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { motionTokens } from \"../lib/motion-tokens\";\nimport styles from \"./textarea.module.css\";\nexport interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> { label: string; description?: string; error?: string }\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: 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}:${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.fast, 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?: 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]) => { if (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={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 Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(function Textarea({ label, description, error, id, className, ...props }, ref) {\n  const generatedId = useId(); const controlId = id ?? generatedId;\n  const hintId = description ? `${controlId}-description` : undefined; const errorId = error ? `${controlId}-error` : undefined;\n  return <div className={styles.field}><label htmlFor={controlId}>{label}</label><textarea {...props} id={controlId} ref={ref} className={[styles.control, className].filter(Boolean).join(\" \")} aria-invalid={error ? true : props[\"aria-invalid\"]} aria-describedby={[props[\"aria-describedby\"], hintId, errorId].filter(Boolean).join(\" \") || undefined}/><FieldMessage id={hintId} text={description} className={styles.hint} /><FieldMessage id={errorId} text={error} className={styles.error} alert /></div>;\n});\n"},{"path":"registry/components/textarea/textarea.module.css","type":"registry:component","target":"@components/silicon-ui/textarea/textarea.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.field label { margin-bottom: var(--space-related); font-size: var(--text-sm); font-weight: var(--weight-medium); letter-spacing: var(--tracking-body); }\n/* Same focus language as Input: the ring contracts onto the border while it fades in, and the box never changes size. */\n.control { width: 100%; min-height: 110px; resize: vertical; border: 1px solid var(--border-strong); border-radius: var(--radius-control); padding: var(--space-group); background: var(--surface); color: var(--foreground); font: inherit; font-size: var(--field-text-size, var(--text-sm)); line-height: var(--leading-body); outline: none; box-shadow: 0 0 0 6px transparent; transition: border-color var(--duration-fast) var(--ease-standard), box-shadow var(--duration-standard) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard); }\n.control::placeholder { color: var(--text-muted); }\n@media (hover: hover) and (pointer: fine) { .control:hover:not(:disabled, [aria-invalid=\"true\"]) { border-color: var(--foreground); } }\n.control:focus-visible { border-color: var(--foreground); box-shadow: 0 0 0 3px var(--focus-ring); outline: 2px solid transparent; outline-offset: 2px; }\n.control[aria-invalid=\"true\"] { border-color: var(--danger); }\n.control:disabled { cursor: not-allowed; background: var(--surface-muted); opacity: .6; }\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.hint, .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.hint { 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) { .control { transition: none; } }\n"},{"path":"registry/components/segmented-control/segmented-control.tsx","type":"registry:component","target":"@components/silicon-ui/segmented-control/segmented-control.tsx","content":"\"use client\";\n\nimport { useEffect, useId, useLayoutEffect, useRef, type KeyboardEvent, type ReactNode } from \"react\";\nimport { LayoutGroup, motion, useReducedMotion } from \"motion/react\";\nimport { motionTokens } from \"../lib/motion-tokens\";\nimport { FluidHoverHighlight, useFluidHover } from \"../lib/fluid-hover\";\nimport styles from \"./segmented-control.module.css\";\n\nexport interface Segment { value: string; label: string; /** Optional content after the label, such as a badge. */ accessory?: ReactNode; }\nexport interface SegmentedControlProps {\n  options: Segment[];\n  value: string;\n  onValueChange: (value: string) => void;\n  label?: string;\n  /** Called when the pointer or focus reaches an option, before it is chosen. Use it to start loading what that option shows. */\n  onOptionIntent?: (value: string) => void;\n  /** `sm` (default) or `xs`, a compact 24px control for dense UI such as an Edit/Read toggle in a toolbar. */\n  size?: \"sm\" | \"xs\";\n  className?: string;\n}\n\nexport default function SegmentedControl({ options, value, onValueChange, label, onOptionIntent, size = \"sm\", className }: SegmentedControlProps) {\n  const id = useId();\n  const reduced = useReducedMotion();\n  const track = useRef<HTMLDivElement>(null);\n  // Fluid hover: the nearest option is lit and a click in a gap picks it. Focus already moves the selection, so it leaves the fill alone.\n  const hover = useFluidHover(track, { items: \"[data-value]\", axis: \"x\", followFocus: false });\n\n  // When the options are wider than the container, the track scrolls inside itself. Edges fade only on the side with more to see.\n  useLayoutEffect(() => {\n    const node = track.current;\n    if (!node) return;\n    const edges = () => {\n      const rest = node.scrollWidth - node.clientWidth - node.scrollLeft;\n      node.toggleAttribute(\"data-fade-start\", node.scrollLeft > 1);\n      node.toggleAttribute(\"data-fade-end\", rest > 1);\n    };\n    edges();\n    node.addEventListener(\"scroll\", edges, { passive: true });\n    const observer = typeof ResizeObserver === \"undefined\" ? null : new ResizeObserver(edges);\n    observer?.observe(node);\n    return () => { node.removeEventListener(\"scroll\", edges); observer?.disconnect(); };\n  }, [options.length]);\n\n  // The selected option is always scrolled fully into view, with a little room so it clears the fade.\n  const first = useRef(true);\n  useEffect(() => {\n    const node = track.current;\n    const button = node?.querySelector<HTMLElement>('[aria-pressed=\"true\"]');\n    if (!node || !button || node.scrollWidth <= node.clientWidth) { first.current = false; return; }\n    const room = 20, start = button.offsetLeft - room, end = button.offsetLeft + button.offsetWidth + room - node.clientWidth;\n    const left = node.scrollLeft > start ? start : node.scrollLeft < end ? end : node.scrollLeft;\n    if (left !== node.scrollLeft) node.scrollTo({ left: Math.max(0, left), behavior: first.current || reduced ? \"auto\" : \"smooth\" });\n    first.current = false;\n  }, [value, reduced]);\n\n  // Arrow keys, Home and End move the selection like a tab list; only the selected option is a tab stop.\n  const selectedIndex = Math.max(0, options.findIndex(option => option.value === value));\n  const onKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n    const last = options.length - 1;\n    const target = event.key === \"ArrowRight\" || event.key === \"ArrowDown\" ? (selectedIndex === last ? 0 : selectedIndex + 1)\n      : event.key === \"ArrowLeft\" || event.key === \"ArrowUp\" ? (selectedIndex === 0 ? last : selectedIndex - 1)\n        : event.key === \"Home\" ? 0 : event.key === \"End\" ? last : -1;\n    if (target < 0 || !options[target]) return;\n    event.preventDefault();\n    onValueChange(options[target].value);\n    track.current?.querySelector<HTMLElement>(`[data-value=\"${CSS.escape(options[target].value)}\"]`)?.focus({ preventScroll: true });\n  };\n\n  return <div className={`${styles.root} ${className ?? \"\"}`} role=\"group\" aria-label={label} data-size={size}>\n    <LayoutGroup id={id}><motion.div ref={track} layoutScroll className={styles.track} {...hover.handlers}>\n      <FluidHoverHighlight hover={hover} className={styles.hover} />\n      {options.map((option, index) => <button key={option.value} id={`${id}-${option.value}`} className={styles.button} type=\"button\" data-value={option.value} aria-pressed={value === option.value} tabIndex={index === selectedIndex ? 0 : -1} onClick={() => onValueChange(option.value)} onKeyDown={onKeyDown} onPointerEnter={onOptionIntent ? () => onOptionIntent(option.value) : undefined} onFocus={onOptionIntent ? () => onOptionIntent(option.value) : undefined}>\n        {value === option.value && <motion.span className={styles.selection} layoutId=\"selection\" layoutDependency={value} transition={reduced ? { duration: 0 } : motionTokens.spring.morph} aria-hidden=\"true\" />}\n        <span className={styles.label}>{option.label}{option.accessory}</span>\n      </button>)}\n    </motion.div></LayoutGroup>\n  </div>;\n}\n"},{"path":"registry/components/segmented-control/segmented-control.module.css","type":"registry:component","target":"@components/silicon-ui/segmented-control/segmented-control.module.css","content":"/* The frame can shrink below its content inside flex and grid parents; the track then scrolls inside it. */\n.root { display: inline-flex; min-width: 0; max-width: 100%; flex-shrink: 1; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface-muted); }\n/* The track owns the stacking context so the gliding highlight passes under every label, not over earlier ones. */\n.track { --fade-start: 0px; --fade-end: 0px; position: relative; isolation: isolate; display: flex; min-width: 0; gap: var(--space-hair); overflow-x: auto; overscroll-behavior-x: contain; padding: var(--space-hair); border-radius: inherit; corner-shape: inherit; scrollbar-width: none; -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fade-start), #000 calc(100% - var(--fade-end)), transparent); mask-image: linear-gradient(to right, transparent, #000 var(--fade-start), #000 calc(100% - var(--fade-end)), transparent); }\n.track::-webkit-scrollbar { display: none; }\n.track[data-fade-start] { --fade-start: 20px; }\n.track[data-fade-end] { --fade-end: 20px; }\n/* Items never scale or change weight; only the highlight travels and the label color follows it. */\n.button { position: relative; flex: 0 0 auto; min-height: var(--control-height-sm); border: 0; border-radius: calc(var(--radius-control) - var(--space-hair)); padding: 0 var(--space-group); background: transparent; color: var(--text-muted); font: inherit; font-size: var(--text-sm); font-weight: var(--weight-medium); white-space: nowrap; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: color var(--duration-fast) var(--ease-standard); }\n/* The frame around the options is 2px, as in Tabs: too thin to hold the keyboard ring outside an option, so it is drawn inside. */\n.button:focus-visible { --focus-outline-offset: -3px; }\n@media (hover: hover) and (pointer: fine) { .button:hover { color: var(--foreground); } }\n.button:active, .button[aria-pressed=\"true\"] { color: var(--foreground); }\n/* The hover fill glides under the options and under the selection, so the selected option never changes on hover. */\n.hover { z-index: -1; border-radius: calc(var(--radius-control) - var(--space-hair)); corner-shape: var(--corner-shape); background: color-mix(in oklab, var(--foreground) 5%, transparent); }\n.selection { position: absolute; z-index: -1; inset: 0; border: 1px solid var(--border); border-radius: inherit; corner-shape: inherit; background: var(--surface); box-shadow: var(--shadow-resting); }\n.label { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: var(--space-related); }\n/* Compact: 24px segments at the small type step. */\n.root[data-size=\"xs\"] .button { min-height: var(--control-height-xs); padding: 0 var(--space-related); font-size: var(--text-xs); }\n@media (max-width: 380px) { .button { padding: 0 var(--space-group); } }\n@media (prefers-reduced-motion: reduce) { .button { 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/copy-button/copy-button.tsx","type":"registry:component","target":"@components/silicon-ui/copy-button/copy-button.tsx","content":"\"use client\";\n\nimport { useState } from \"react\";\nimport { AnimatePresence, motion, useReducedMotion, type TargetAndTransition, type Transition } from \"motion/react\";\nimport { CircleAlert, Copy } from \"lucide-react\";\nimport { motionTokens } from \"../lib/motion-tokens\";\nimport { useCopyFeedback } from \"../lib/use-copy-feedback\";\nimport styles from \"./copy-button.module.css\";\n\nexport interface CopyButtonProps {\n  value: string;\n  label?: string;\n  className?: string;\n  iconOnly?: boolean;\n  variant?: \"outline\" | \"plain\";\n  disabled?: boolean;\n  onCopied?: () => void;\n}\n\n/** Copy feedback is deliberately unhurried: a slow, almost critically damped spring and long, soft crossfades read as calm, never busy.\n *  The same motion plays in reverse when the confirmation hands back to idle, so nothing ever snaps. */\nconst settle = { type: \"spring\", visualDuration: motionTokens.spring.slow.visualDuration, bounce: .06 } as const;\nconst enter = { duration: motionTokens.duration.standard, ease: [...motionTokens.ease.enter] } as const;\nconst leave = { duration: motionTokens.duration.exit, ease: [...motionTokens.ease.standard] } as const;\nconst instant = { duration: motionTokens.duration.instant } as const;\nconst soft = `blur(${motionTokens.blur.soft}px)`;\nconst rest: TargetAndTransition = { opacity: 1, y: 0, scale: 1, filter: \"blur(0px)\" };\nconst fadeIn: TargetAndTransition = { ...rest, opacity: 0 };\nconst fadeOut: TargetAndTransition = { opacity: 0, transition: instant };\n/** Icons trade places in one soft breath: the old glyph shrinks into a blur while the new one grows out of it on the slow spring. */\nconst iconIn: TargetAndTransition = { opacity: 0, scale: .6, filter: soft };\nconst iconOut: TargetAndTransition = { opacity: 0, scale: .6, filter: soft, transition: { duration: motionTokens.duration.exit, ease: [...motionTokens.ease.standard] } };\nconst iconEnter: Transition = { scale: settle, opacity: { ...enter, delay: .03 }, filter: { ...enter, delay: .03 } };\n/** Letters rise about .3em out of a soft blur; the outgoing ones lift away a little faster. */\nconst glyphIn: TargetAndTransition = { opacity: 0, y: 4, filter: soft };\nconst glyphOut: TargetAndTransition = { opacity: 0, y: -3, filter: soft, transition: leave };\n\n/** The success tick draws itself from its short stroke, the way a hand would write it: quick to start, then easing into place while the icon settles. */\nfunction DrawnCheck({ reduced }: { reduced: boolean }) {\n  return <svg width={16} height={16} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth={1.75} strokeLinecap=\"round\" strokeLinejoin=\"round\">\n    <motion.path d=\"M4 12l5 5L20 6\" initial={reduced ? false : { pathLength: 0, opacity: 0 }} animate={{ pathLength: 1, opacity: 1 }} transition={{ pathLength: { duration: .5, ease: [...motionTokens.ease.standard], delay: .05 }, opacity: { duration: .01, delay: .05 } }} />\n  </svg>;\n}\n\ntype Glyph = { id: string; char: string; order: number };\nconst toGlyphs = (chars: string[], seq: number): Glyph[] => chars.map((char, order) => ({ id: `${seq}:${order}`, char, order }));\n\n/** Shared leading and trailing characters keep their identity, so \"Copy\" to \"Copied\" only replaces the changed letters. */\nfunction useGlyphs(text: string) {\n  const [state, setState] = useState(() => ({ text, seq: 0, glyphs: toGlyphs([...text], 0) }));\n  if (state.text === text) return state.glyphs;\n  const prev = [...state.text], next = [...text];\n  let start = 0, end = 0;\n  while (start < prev.length && start < next.length && prev[start] === next[start]) start++;\n  while (end < prev.length - start && end < next.length - start && prev[prev.length - 1 - end] === next[next.length - 1 - end]) end++;\n  if (start < 2) start = 0;\n  if (end < 2) end = 0;\n  const seq = state.seq + 1;\n  const glyphs = [...state.glyphs.slice(0, start), ...toGlyphs(next.slice(start, next.length - end), seq), ...state.glyphs.slice(state.glyphs.length - end)];\n  setState({ text, seq, glyphs });\n  return glyphs;\n}\n\n/**\n * The label cell already reserves its widest state, so the row stays put and only the letters move. It is a layout root:\n * the letters measure their glide inside the label only, so when the button itself moves (a page entering, a panel\n * sliding, a list reflowing) they ride along instead of flying in from where the button used to be.\n */\nfunction MorphText({ text, reduced }: { text: string; reduced: boolean }) {\n  const glyphs = useGlyphs(text);\n  return <motion.span className={styles.glyphs} layoutRoot>\n    <AnimatePresence mode=\"popLayout\" initial={false}>\n      {glyphs.map(glyph => <motion.span key={glyph.id} className={styles.glyph} layout={reduced ? false : \"position\"} layoutDependency={text} initial={reduced ? fadeIn : glyphIn} animate={rest} exit={reduced ? fadeOut : glyphOut} transition={reduced ? instant : { ...enter, delay: Math.min(glyph.order * .02, .12), layout: settle }}>{glyph.char}</motion.span>)}\n    </AnimatePresence>\n  </motion.span>;\n}\n\nexport function CopyButton({ value, label = \"Copy\", className, iconOnly = false, variant = \"outline\", disabled, onCopied }: CopyButtonProps) {\n  const { state, copy } = useCopyFeedback();\n  const reduced = useReducedMotion() ?? false;\n  const text = state === \"copied\" ? \"Copied\" : state === \"error\" ? \"Failed\" : label;\n\n  async function handleCopy() {\n    if (await copy(value)) onCopied?.();\n  }\n\n  return <><button\n    type=\"button\"\n    className={[styles.button, iconOnly && styles.iconOnly, variant === \"plain\" && styles.plain, className].filter(Boolean).join(\" \")}\n    onClick={() => void handleCopy()}\n    aria-label={label}\n    data-copy-state={state}\n    disabled={disabled}\n  >\n    <span className={styles.icon} aria-hidden=\"true\">\n      <AnimatePresence initial={false}>\n        <motion.span key={state} className={styles.iconInner} data-state={state} initial={reduced ? fadeIn : iconIn} animate={rest} exit={reduced ? fadeOut : iconOut} transition={reduced ? instant : iconEnter}>\n          {state === \"copied\" ? <DrawnCheck reduced={reduced} /> : state === \"error\" ? <CircleAlert size={16} strokeWidth={1.75} /> : <Copy size={16} strokeWidth={1.75} />}\n        </motion.span>\n      </AnimatePresence>\n    </span>\n    {!iconOnly && <span className={styles.label} aria-hidden=\"true\">\n      <span className={styles.measure}>{label}</span><span className={styles.measure}>Copied</span><span className={styles.measure}>Failed</span>\n      <MorphText text={text} reduced={reduced} />\n    </span>}\n  </button><span className={styles.srOnly} role=\"status\" aria-live=\"polite\">{state === \"idle\" ? \"\" : state === \"error\" ? `${label}: Could not copy` : `${label}: Copied`}</span></>;\n}\n"},{"path":"registry/components/copy-button/copy-button.module.css","type":"registry:component","target":"@components/silicon-ui/copy-button/copy-button.module.css","content":"/* Width never changes: the label cell reserves its widest state while icon and letters crossfade inside it. Press releases on the spring curve. */\n.button { display: inline-flex; width: max-content; max-width: 100%; min-height: var(--control-height-sm); align-items: center; justify-content: center; gap: var(--space-related); border: 1px solid var(--border); border-radius: var(--radius-control); padding: 0 var(--space-group); background: var(--surface); color: var(--foreground); font: inherit; font-size: var(--text-sm); font-weight: var(--weight-medium); cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard), transform var(--duration-spring) var(--ease-spring); }\n.button:active:not(:disabled) { transform: scale(.97); transition-duration: var(--duration-fast), var(--duration-fast), var(--duration-fast), var(--duration-instant); transition-timing-function: var(--ease-standard); }\n.iconOnly:active:not(:disabled) { transform: scale(.96); }\n@media (hover: hover) and (pointer: fine) { .button:hover:not(:disabled) { background: var(--surface-muted); border-color: var(--border-strong); } .plain:hover:not(:disabled) { border-color: transparent; background: var(--surface-muted); color: var(--foreground); } }\n.button:disabled { cursor: not-allowed; opacity: .5; }\n/* Each icon carries its own color, so the outgoing glyph never tints on its way out. */\n.icon { position: relative; display: grid; width: 16px; height: 16px; flex: none; }\n.iconInner { position: absolute; inset: 0; display: grid; place-items: center; }\n.iconInner[data-state=\"copied\"] { color: var(--success); }\n.iconInner[data-state=\"error\"] { color: var(--danger); }\n/* The inline padding gives blurred edge letters room before the horizontal clip; the negative margin keeps the box the same size. */\n.label { display: grid; min-width: 0; margin-inline: calc(var(--space-tight) * -1); padding-inline: var(--space-tight); overflow-x: clip; text-align: left; white-space: nowrap; }\n.measure, .glyphs { grid-area: 1 / 1; }\n.measure { visibility: hidden; }\n.glyphs { position: relative; display: inline-flex; justify-self: start; white-space: pre; }\n.glyph { display: inline-block; }\n.iconOnly { width: var(--control-height-sm); padding: 0; }\n.plain { border-color: transparent; background: transparent; color: var(--text-secondary); }\n.srOnly { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }\n@media (prefers-reduced-motion: reduce) { .button { transition: none; } .button:active:not(:disabled) { transform: none; } }\n"},{"path":"lib/use-copy-feedback.ts","type":"registry:lib","target":"@components/silicon-ui/lib/use-copy-feedback.ts","content":"\"use client\";\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport type CopyFeedbackState = \"idle\" | \"copied\" | \"error\";\n\n/** Shared clipboard state for actions that render their own button or menu. */\nexport function useCopyFeedback(duration = 1900) {\n  const [state, setState] = useState<CopyFeedbackState>(\"idle\");\n  const [activeKey, setActiveKey] = useState<string | null>(null);\n  const timeout = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n  const reset = useCallback(() => {\n    if (timeout.current) clearTimeout(timeout.current);\n    timeout.current = null;\n    setState(\"idle\");\n    setActiveKey(null);\n  }, []);\n\n  useEffect(() => () => {\n    if (timeout.current) clearTimeout(timeout.current);\n  }, []);\n\n  const copy = useCallback(async (value: string, key = \"default\") => {\n    if (timeout.current) clearTimeout(timeout.current);\n    setActiveKey(key);\n    try {\n      await navigator.clipboard.writeText(value);\n      setState(\"copied\");\n      timeout.current = setTimeout(reset, duration);\n      return true;\n    } catch {\n      setState(\"error\");\n      timeout.current = setTimeout(reset, duration);\n      return false;\n    }\n  }, [duration, reset]);\n\n  return { state, activeKey, copy, reset };\n}\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"},{"path":"lib/fluid-hover.tsx","type":"registry:lib","target":"@components/silicon-ui/lib/fluid-hover.tsx","content":"\"use client\";\n\n/**\n * Fluid hover: in a set of items (a menu, a list, tabs, a grid), the item nearest the pointer is lit, even while the\n * pointer is in a gap, the padding or past the last item, and one highlight springs between items. A click in a gap goes\n * to the lit item, so what is lit is what a click hits. A new pointer entry fades the highlight in where it lands instead\n * of sliding it over from the last item. The keyboard moves it without travel, and reduced motion keeps the fade but\n * drops the travel.\n *\n *   const list = useRef<HTMLUListElement>(null);\n *   const hover = useFluidHover(list, { items: \"[data-item]\" });\n *   <ul ref={list} className={styles.list} {...hover.handlers}>      // .list { position: relative }\n *     <FluidHoverHighlight hover={hover} className={styles.highlight} />\n *     …items…\n *   </ul>\n *\n * Adapted from Fluid Functionalism's use-fluid-hover and fluid-hover-highlight by Micka Touillaud (MIT),\n * https://github.com/mickadesign/fluid-functionalism. Items are found by a selector instead of registering themselves,\n * so a component adopts it without changing its items.\n */\nimport { useEffect, useEffectEvent, useRef, useState } from \"react\";\nimport type { FocusEvent, MouseEvent, PointerEvent, RefObject } from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { motionTokens } from \"./motion-tokens\";\n\n/** An item's box in the container's own layout space (unaffected by transforms or scrolling). */\nexport interface FluidRect { top: number; left: number; width: number; height: number }\n\nexport interface FluidHoverState {\n  /** Where the highlight sits, or null when nothing is lit. */\n  rect: FluidRect | null;\n  /** The lit item. */\n  item: HTMLElement | null;\n  /** False when the highlight should jump (keyboard, a resize) rather than travel. */\n  glide: boolean;\n  /** Steps on each new pointer entry, so the highlight fades in where it lands. */\n  session: number;\n}\n\nexport interface FluidHoverOptions {\n  /** Selector for the items inside the container. */\n  items: string;\n  /** \"y\" for lists (default), \"x\" for a row of tabs, \"xy\" for grids. */\n  axis?: \"x\" | \"y\" | \"xy\";\n  /** Items the highlight skips (and a gap click never activates). Defaults to disabled or aria-disabled items. */\n  isItemDisabled?: (item: HTMLElement) => boolean;\n  /** \"skip\" (default) lights the nearest enabled item even over a disabled one; \"clear\" lights nothing over a disabled item (a calendar's unavailable days). */\n  disabled?: \"skip\" | \"clear\";\n  /** Route a click in a gap to the lit item. On by default; turn it off where empty space should stay inert. */\n  gapClick?: boolean;\n  /** Light the item that receives keyboard focus. On by default. */\n  followFocus?: boolean;\n}\n\nconst defaultDisabled = (item: HTMLElement) =>\n  item.matches(\":disabled, [aria-disabled='true'], [data-disabled]\");\n\n/** Controls that sit between items keep their own clicks. */\nconst CONTROL = \"input, textarea, select, button, a, summary, [contenteditable], [role='textbox'], [role='searchbox'], [role='button']\";\n\n/** The item's box relative to the container, summing offsets through positioned ancestors in between. */\nexport function rectOf(item: HTMLElement, container: HTMLElement): FluidRect {\n  let top = item.offsetTop, left = item.offsetLeft;\n  let parent = item.offsetParent as HTMLElement | null;\n  while (parent && parent !== container && container.contains(parent)) {\n    top += parent.offsetTop + parent.clientTop;\n    left += parent.offsetLeft + parent.clientLeft;\n    parent = parent.offsetParent as HTMLElement | null;\n  }\n  return { top, left, width: item.offsetWidth, height: item.offsetHeight };\n}\n\n/**\n * The item the pointer is inside, or else the one whose edge is nearest along the axis (both axes for a grid). Edges, not\n * centres, so a gap next to a wide item still lights the item the pointer is closer to.\n */\nexport function pickNearest(items: HTMLElement[], x: number, y: number, axis: \"x\" | \"y\" | \"xy\"): HTMLElement | null {\n  let nearest: HTMLElement | null = null, best = Infinity;\n  for (const item of items) {\n    const r = item.getBoundingClientRect();\n    if (!r.width && !r.height) continue;\n    if (x >= r.left && x <= r.right && y >= r.top && y <= r.bottom) return item;\n    const dx = Math.max(r.left - x, 0, x - r.right), dy = Math.max(r.top - y, 0, y - r.bottom);\n    const distance = axis === \"x\" ? dx : axis === \"y\" ? dy : Math.hypot(dx, dy);\n    if (distance < best) { best = distance; nearest = item; }\n  }\n  return nearest;\n}\n\n/** Hands a gap click to the item as a real mouse click (detail, modifiers and coordinates kept), so the item reads it as a pointer press, not a keyboard one. */\nfunction forwardClick(item: HTMLElement, event: MouseEvent<HTMLElement>) {\n  const { detail, clientX, clientY, screenX, screenY, ctrlKey, shiftKey, altKey, metaKey, button, buttons } = event;\n  item.dispatchEvent(new globalThis.MouseEvent(\"click\", { bubbles: true, cancelable: true, composed: true, view: window, detail, clientX, clientY, screenX, screenY, ctrlKey, shiftKey, altKey, metaKey, button, buttons }));\n}\n\n/** Whether an event happened inside the element whose handler hears it, not in a portalled child (a submenu, a tooltip). */\nconst isOwn = (event: { currentTarget: EventTarget; target: EventTarget }) =>\n  !(event.currentTarget instanceof Node) || !(event.target instanceof Node) || event.currentTarget.contains(event.target);\n\nexport function useFluidHover<T extends HTMLElement>(container: RefObject<T | null>, options: FluidHoverOptions) {\n  const { items: selector, axis = \"y\", isItemDisabled = defaultDisabled, disabled = \"skip\", gapClick = true, followFocus = true } = options;\n  const [state, setState] = useState<FluidHoverState>({ rect: null, item: null, glide: false, session: 0 });\n  const current = useRef(state);\n  const pointer = useRef(false);\n  const entering = useRef(false);\n  const frame = useRef(0);\n\n  function commit(next: FluidHoverState) {\n    const prev = current.current;\n    if (prev.item === next.item && prev.session === next.session && sameRect(prev.rect, next.rect)) return;\n    current.current = next;\n    setState(next);\n  }\n\n  function light(item: HTMLElement | null, glide: boolean) {\n    const root = container.current;\n    if (!root || !item) return commit({ ...current.current, rect: null, item: null, glide });\n    let session = current.current.session;\n    if (entering.current) { entering.current = false; session += 1; }\n    commit({ rect: rectOf(item, root), item, glide: glide && session === current.current.session, session });\n  }\n\n  const enabledItems = () => {\n    const root = container.current;\n    return root ? [...root.querySelectorAll<HTMLElement>(selector)].filter(item => !isItemDisabled(item)) : [];\n  };\n\n  // The lit item can move under a still highlight (a resize, content above it changing): follow it without travel.\n  const follow = useEffectEvent(() => { const { item } = current.current; if (item?.isConnected) light(item, false); });\n  useEffect(() => {\n    const root = container.current;\n    if (!root || typeof ResizeObserver === \"undefined\") return;\n    const observer = new ResizeObserver(() => follow());\n    observer.observe(root);\n    return () => observer.disconnect();\n  }, [container]);\n  useEffect(() => () => cancelAnimationFrame(frame.current), []);\n\n  const handlers = {\n    onMouseEnter: () => { entering.current = true; },\n    onMouseMove: (event: MouseEvent<T>) => {\n      if (!isOwn(event)) return;\n      pointer.current = true;\n      const { clientX, clientY } = event;\n      cancelAnimationFrame(frame.current);\n      frame.current = requestAnimationFrame(() => {\n        const over = disabled === \"clear\" ? document.elementFromPoint(clientX, clientY)?.closest<HTMLElement>(selector) : null;\n        light(over && isItemDisabled(over) ? null : pickNearest(enabledItems(), clientX, clientY, axis), true);\n      });\n    },\n    onMouseLeave: () => { cancelAnimationFrame(frame.current); entering.current = false; light(null, false); },\n    onKeyDownCapture: () => { pointer.current = false; },\n    onFocus: (event: FocusEvent<T>) => {\n      if (!followFocus || pointer.current || !isOwn(event)) return;\n      const item = event.target instanceof HTMLElement ? event.target.closest<HTMLElement>(selector) : null;\n      if (item && container.current?.contains(item) && !isItemDisabled(item)) light(item, false);\n    },\n    onBlur: (event: FocusEvent<T>) => {\n      if (!pointer.current && !event.currentTarget.contains(event.relatedTarget as Node | null)) light(null, false);\n    },\n    onClick: (event: MouseEvent<T>) => {\n      if (!gapClick || !isOwn(event)) return;\n      const target = event.target as Element;\n      if (!target.isConnected || target.closest(selector) || target.closest(CONTROL)) return;\n      const { item } = current.current;\n      if (item?.isConnected && !isItemDisabled(item)) forwardClick(item, event);\n    },\n  };\n\n  /** Clears the highlight at once, such as when a menu opens again. */\n  const reset = () => { cancelAnimationFrame(frame.current); entering.current = true; light(null, false); };\n\n  return { ...state, handlers, reset, light };\n}\n\nexport interface NearestItemOptions extends Omit<FluidHoverOptions, \"followFocus\"> {\n  /** Called with the nearest enabled item as the mouse moves over the container. */\n  onPick: (item: HTMLElement) => void;\n}\n\n/**\n * Fluid hover's picking without its highlight, for a list that already keeps its own active item and highlight (a listbox\n * with aria-activedescendant, a roving list): the mouse picks the nearest enabled item, gaps and padding included, and a\n * click in a gap goes to that item. Spread the result on the container.\n */\n// A hook only so callbacks that touch refs can be passed during render; it keeps no state.\nexport function useNearestItem<T extends HTMLElement>({ items: selector, axis = \"y\", isItemDisabled = defaultDisabled, gapClick = true, onPick }: NearestItemOptions) {\n  const nearest = (event: MouseEvent<T>) => {\n    if (!isOwn(event)) return null;\n    const items = [...event.currentTarget.querySelectorAll<HTMLElement>(selector)].filter(item => !isItemDisabled(item));\n    return pickNearest(items, event.clientX, event.clientY, axis);\n  };\n  return {\n    onPointerMove: (event: PointerEvent<T>) => { if (event.pointerType !== \"mouse\") return; const item = nearest(event); if (item) onPick(item); },\n    onClick: (event: MouseEvent<T>) => {\n      if (!gapClick) return;\n      const target = event.target as Element;\n      if (!target.isConnected || target.closest(selector) || target.closest(CONTROL)) return;\n      const item = nearest(event);\n      if (item) forwardClick(item, event);\n    },\n  };\n}\n\nconst sameRect = (a: FluidRect | null, b: FluidRect | null) =>\n  a === b || (!!a && !!b && a.top === b.top && a.left === b.left && a.width === b.width && a.height === b.height);\n\nexport interface FluidHoverHighlightProps {\n  /** The state from useFluidHover (or any { rect, glide, session }). */\n  hover: Pick<FluidHoverState, \"rect\" | \"glide\" | \"session\">;\n  /** Radius, fill, z-index. The container must be position: relative; the highlight is placed at its top-left corner. */\n  className?: string;\n  /** Extra attributes for styling, such as data-tone. */\n  tone?: string;\n}\n\n/** The one highlight a fluid hover set renders: it springs between items on transforms, and fades in and out. */\nexport function FluidHoverHighlight({ hover, className, tone }: FluidHoverHighlightProps) {\n  const reduced = useReducedMotion() ?? false;\n  const { rect, glide, session } = hover;\n  const place = rect ? { x: rect.left, y: rect.top, width: rect.width, height: rect.height } : undefined;\n  return (\n    <AnimatePresence initial={false}>\n      {place ? (\n        <motion.span key={session} className={className} data-tone={tone} aria-hidden=\"true\"\n          style={{ position: \"absolute\", top: 0, left: 0, pointerEvents: \"none\" }}\n          initial={{ opacity: 0, ...place }}\n          animate={{ opacity: 1, ...place }}\n          exit={{ opacity: 0, transition: motionTokens.spring.fast.exit }}\n          transition={{ default: glide && !reduced ? motionTokens.spring.fast : { duration: 0 }, opacity: { duration: motionTokens.duration.fast } }} />\n      ) : null}\n    </AnimatePresence>\n  );\n}\n"}],"docs":"Docs and live preview: https://ui.teamofsilicons.com/contact-section","meta":{"tier":"free","kind":"block","docs":"https://ui.teamofsilicons.com/contact-section","markdown":"https://ui.teamofsilicons.com/contact-section.md","status":"stable"}}