{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"notification-center","type":"registry:block","title":"Notification center","description":"A home for updates with read state, grouped information, and animated disclosure.","categories":["blocks"],"dependencies":["@radix-ui/react-popover","lucide-react","motion"],"registryDependencies":["https://ui.teamofsilicons.com/r/silicon-motion-tokens.json","https://ui.teamofsilicons.com/r/avatar.json"],"files":[{"path":"registry/components/notification-center/notification-center.tsx","type":"registry:component","target":"@components/silicon-ui/notification-center/notification-center.tsx","content":"\"use client\";\n\nimport { useEffect, useId, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type ReactNode } from \"react\";\nimport { AnimatePresence, animate, motion, useIsPresent, useMotionValue, useReducedMotion, type AnimationPlaybackControls, type HTMLMotionProps, type TargetAndTransition, type Transition, type Variants } from \"motion/react\";\nimport { Bell, Check, CheckCheck, CircleCheck, CircleDot, MessageCircle, TriangleAlert, X } from \"lucide-react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { Avatar } from \"../avatar/avatar\";\nimport { motionTokens } from \"../lib/motion-tokens\";\nimport styles from \"./notification-center.module.css\";\n\nexport interface NotificationItem {\n  id: string;\n  title: string;\n  description?: string;\n  time: string;\n  read?: boolean;\n  tone?: \"info\" | \"success\" | \"warning\";\n  /** A local portrait asset for person-generated updates. */\n  actor?: { name: string; photo: string };\n}\n\nexport interface NotificationCenterProps {\n  notifications: NotificationItem[];\n  label?: string;\n  onReadChange?: (notification: NotificationItem, read: boolean) => void;\n  onDismiss?: (notification: NotificationItem) => void;\n  open?: boolean;\n  onOpenChange?: (open: boolean) => void;\n  avoidCollisions?: boolean;\n}\n\ntype View = \"all\" | \"unread\";\n\nconst enter: Transition = { duration: motionTokens.duration.standard, ease: [...motionTokens.ease.enter] };\nconst exitFast: Transition = { duration: motionTokens.duration.fast, ease: [...motionTokens.ease.standard] };\nconst instant: Transition = { duration: 0 };\nconst textIn: TargetAndTransition = { opacity: 0, y: \"0.3em\", filter: `blur(${motionTokens.blur.soft}px)` };\nconst textOut: TargetAndTransition = { opacity: 0, y: \"-0.3em\", filter: `blur(${motionTokens.blur.subtle}px)`, transition: exitFast };\nconst iconIn: TargetAndTransition = { opacity: 0, scale: .6, filter: `blur(${motionTokens.blur.subtle}px)` };\nconst shown: TargetAndTransition = { opacity: 1, y: \"0em\", scale: 1, filter: \"blur(0px)\" };\nconst fadeOut: TargetAndTransition = { opacity: 0, transition: { duration: motionTokens.duration.instant } };\n/** Bulk actions cascade down the list, capped so the whole sweep stays under a quarter second. */\nconst cascade = (index: number) => Math.min(index * motionTokens.stagger.item, .2);\n\n/** Outgoing copies are hidden from assistive tech while they fade, so live text reads only the current value. */\nfunction Swap(props: HTMLMotionProps<\"span\">) {\n  const present = useIsPresent();\n  return <motion.span {...props} aria-hidden={present ? props[\"aria-hidden\"] : true} />;\n}\n\nfunction SwapText({ children, reduce }: { children: string; reduce: boolean | null }) {\n  return <span className={styles.swap}><AnimatePresence mode=\"popLayout\" initial={false}><Swap key={children} className={styles.swapLine} initial={reduce ? { opacity: 0 } : textIn} animate={shown} exit={reduce ? fadeOut : textOut} transition={reduce ? instant : enter}>{children}</Swap></AnimatePresence></span>;\n}\n\nconst rollVariants: Variants = {\n  enter: (direction: number) => ({ opacity: 0, y: direction >= 0 ? \"0.7em\" : \"-0.7em\", filter: `blur(${motionTokens.blur.subtle}px)` }),\n  center: { opacity: 1, y: \"0em\", filter: \"blur(0px)\" },\n  exit: (direction: number) => ({ opacity: 0, y: direction >= 0 ? \"-0.7em\" : \"0.7em\", filter: `blur(${motionTokens.blur.subtle}px)`, transition: exitFast }),\n};\n\n/** Counts roll like an odometer: a higher number rises from below, a lower one drops from above. */\nfunction RollingCount({ value, display = String(value), reduce }: { value: number; display?: string; reduce: boolean | null }) {\n  const [previous, setPrevious] = useState(value);\n  const [direction, setDirection] = useState(0);\n  if (value !== previous) { setDirection(value > previous ? 1 : -1); setPrevious(value); }\n  return <span className={styles.roll}><AnimatePresence mode=\"popLayout\" initial={false} custom={direction}>\n    <Swap key={display} className={styles.rollValue} custom={direction} variants={reduce ? undefined : rollVariants} initial={reduce ? { opacity: 0 } : \"enter\"} animate={reduce ? { opacity: 1 } : \"center\"} exit={reduce ? fadeOut : \"exit\"} transition={reduce ? instant : { y: motionTokens.spring.snappy, opacity: exitFast, filter: exitFast }}>{display}</Swap>\n  </AnimatePresence></span>;\n}\n\n/** Follows the width of its content. After `morphKey` changes the width springs from the old size to the new one, then returns to auto, so a longer label grows the control instead of snapping it. */\nfunction MorphWidth({ reduce, morphKey, children }: { reduce: boolean | null; morphKey: string; children: ReactNode }) {\n  const frame = useRef<HTMLSpanElement>(null);\n  const content = useRef<HTMLSpanElement>(null);\n  const width = useMotionValue<number | \"auto\">(\"auto\");\n  const changedAt = useRef(0);\n  useLayoutEffect(() => { changedAt.current = performance.now(); }, [morphKey]);\n  useEffect(() => {\n    const node = content.current;\n    if (!node || typeof ResizeObserver === \"undefined\") return;\n    let last: number | undefined;\n    let controls: AnimationPlaybackControls | undefined;\n    const settle = () => { width.jump(\"auto\"); if (frame.current) frame.current.style.width = \"auto\"; };\n    const observer = new ResizeObserver(([entry]) => {\n      if (!entry) return;\n      const next = entry.borderBoxSize?.[0]?.inlineSize ?? node.offsetWidth;\n      const current = width.get();\n      const from = typeof current === \"number\" ? current : last;\n      last = next;\n      controls?.stop();\n      if (reduce || from === undefined || from === next || performance.now() - changedAt.current > 120) return settle();\n      // Pin the old width before this frame paints, then spring to the new one.\n      if (frame.current) frame.current.style.width = `${from}px`;\n      controls = animate(width, [from, next], { ...motionTokens.spring.morph, onComplete: settle });\n    });\n    observer.observe(node);\n    return () => { observer.disconnect(); controls?.stop(); };\n  }, [width, reduce]);\n  return <motion.span ref={frame} className={styles.morph} style={{ width }}><span ref={content} className={styles.morphContent}>{children}</span></motion.span>;\n}\n\nfunction NotificationVisual({ item }: { item: NotificationItem }) {\n  if (item.actor) return <Avatar name={item.actor.name} src={item.actor.photo} size=\"md\" />;\n  return <span className={[styles.eventIcon, styles[item.tone ?? \"info\"]].join(\" \")} aria-hidden=\"true\">\n    {item.tone === \"warning\" ? <TriangleAlert size={18} strokeWidth={1.7} /> : item.tone === \"success\" ? <CircleCheck size={18} strokeWidth={1.7} /> : <MessageCircle size={18} strokeWidth={1.7} />}\n  </span>;\n}\n\nexport function NotificationCenter({ notifications: initial, label = \"Notifications\", onReadChange, onDismiss, open, onOpenChange, avoidCollisions = true }: NotificationCenterProps) {\n  const reduce = useReducedMotion();\n  const layoutId = useId();\n  const [internalOpen, setInternalOpen] = useState(false);\n  const [items, setItems] = useState(initial);\n  const [view, setView] = useState<View>(\"all\");\n  const [expandedId, setExpandedId] = useState<string | null>(null);\n  const [bulk, setBulk] = useState(false);\n  const itemRefs = useRef(new Map<string, HTMLButtonElement>());\n  const allTabRef = useRef<HTMLButtonElement>(null);\n  const unreadTabRef = useRef<HTMLButtonElement>(null);\n  const isOpen = open ?? internalOpen;\n  const unreadCount = useMemo(() => items.filter((item) => !item.read).length, [items]);\n  const readCount = items.length - unreadCount;\n  const visible = view === \"unread\" ? items.filter((item) => !item.read) : items;\n  const summary = unreadCount ? `${unreadCount} update${unreadCount === 1 ? \"\" : \"s\"} waiting for you` : \"You’re all caught up\";\n\n  function setOpen(next: boolean) {\n    if (open === undefined) setInternalOpen(next);\n    onOpenChange?.(next);\n  }\n\n  function toggleRead(item: NotificationItem) {\n    const next = !item.read;\n    if (next && view === \"unread\") {\n      const index = visible.findIndex((entry) => entry.id === item.id);\n      const nextId = visible[index + 1]?.id ?? visible[index - 1]?.id;\n      requestAnimationFrame(() => nextId ? itemRefs.current.get(nextId)?.focus() : unreadTabRef.current?.focus());\n    }\n    setBulk(false);\n    setItems((current) => current.map((entry) => entry.id === item.id ? { ...entry, read: next } : entry));\n    if (next && view === \"unread\") setExpandedId(null);\n    onReadChange?.(item, next);\n  }\n\n  function markAllRead() {\n    items.filter((item) => !item.read).forEach((item) => onReadChange?.(item, true));\n    setBulk(true);\n    setItems((current) => current.map((item) => ({ ...item, read: true })));\n    setExpandedId(null);\n    requestAnimationFrame(() => (view === \"unread\" ? unreadTabRef : allTabRef).current?.focus());\n  }\n\n  function dismiss(item: NotificationItem) {\n    const index = visible.findIndex((entry) => entry.id === item.id);\n    const nextId = visible[index + 1]?.id ?? visible[index - 1]?.id;\n    requestAnimationFrame(() => nextId ? itemRefs.current.get(nextId)?.focus() : unreadTabRef.current?.focus());\n    setBulk(false);\n    setItems((current) => current.filter((entry) => entry.id !== item.id));\n    if (expandedId === item.id) setExpandedId(null);\n    onDismiss?.(item);\n  }\n\n  function clearRead() {\n    items.filter((item) => item.read).forEach((item) => onDismiss?.(item));\n    setBulk(true);\n    setItems((current) => current.filter((item) => !item.read));\n    requestAnimationFrame(() => allTabRef.current?.focus());\n  }\n\n  const height: Transition = reduce ? instant : { height: motionTokens.spring.smooth, opacity: enter };\n\n  return <PopoverPrimitive.Root open={isOpen} onOpenChange={setOpen}>\n    <PopoverPrimitive.Trigger asChild>\n      {/* The trigger anchors the panel, so it gives press feedback with color only; scaling it would shift the panel. */}\n      <button className={styles.trigger} type=\"button\" aria-label={`${label}${unreadCount ? `, ${unreadCount} unread` : \"\"}`}>\n        <motion.span animate={{ rotate: isOpen && !reduce ? -12 : 0 }} transition={reduce ? instant : motionTokens.spring.snappy}><Bell size={19} strokeWidth={1.75} aria-hidden=\"true\" /></motion.span>\n        <AnimatePresence initial={false}>{unreadCount > 0 && <motion.span key=\"badge\" className={styles.badge} aria-hidden=\"true\" initial={reduce ? { opacity: 0 } : { opacity: 0, scale: .6 }} animate={{ opacity: 1, scale: 1 }} exit={reduce ? fadeOut : { opacity: 0, scale: .6, transition: exitFast }} transition={reduce ? instant : motionTokens.spring.snappy}><RollingCount value={unreadCount} display={unreadCount > 9 ? \"9+\" : String(unreadCount)} reduce={reduce} /></motion.span>}</AnimatePresence>\n      </button>\n    </PopoverPrimitive.Trigger>\n    <PopoverPrimitive.Portal>\n      <PopoverPrimitive.Content className={styles.panel} align=\"center\" side=\"bottom\" sideOffset={12} collisionPadding={12} avoidCollisions={avoidCollisions} aria-label={label}>\n        <div className={styles.header}>\n          <div><div className={styles.heading}><h2>{label}</h2><span className={styles.count}><RollingCount value={unreadCount} reduce={reduce} /></span></div><p aria-live=\"polite\"><SwapText reduce={reduce}>{summary}</SwapText></p></div>\n          <PopoverPrimitive.Close className={styles.close} aria-label=\"Close notifications\"><X size={17} strokeWidth={1.75} aria-hidden=\"true\" /></PopoverPrimitive.Close>\n        </div>\n\n        <div className={styles.toolbar}>\n          <div className={styles.viewSwitch} role=\"group\" aria-label=\"Show notifications\">\n            {([\"all\", \"unread\"] as const).map((next) => <button key={next} ref={next === \"unread\" ? unreadTabRef : allTabRef} type=\"button\" className={view === next ? styles.viewActive : undefined} aria-pressed={view === next} onClick={() => { setBulk(false); setView(next); setExpandedId(null); }}>{view === next && <motion.span className={styles.viewHighlight} layoutId={`${layoutId}-view`} transition={reduce ? instant : motionTokens.spring.morph} />}<span>{next === \"all\" ? \"All\" : \"Unread\"}</span></button>)}\n          </div>\n          <AnimatePresence initial={false}>{unreadCount > 0 && <motion.button key=\"mark-all\" type=\"button\" className={styles.markAll} onClick={markAllRead} initial={reduce ? { opacity: 0 } : { opacity: 0, filter: `blur(${motionTokens.blur.subtle}px)` }} animate={{ opacity: 1, filter: \"blur(0px)\" }} exit={reduce ? fadeOut : { opacity: 0, filter: `blur(${motionTokens.blur.subtle}px)`, transition: exitFast }} transition={reduce ? instant : enter}><CheckCheck size={15} strokeWidth={1.75} aria-hidden=\"true\" /><span>Mark all read</span></motion.button>}</AnimatePresence>\n        </div>\n\n        {/* Rows collapse their own height on the way out, so the list and the panel close the gap together. */}\n        <div className={styles.list} role=\"list\" aria-label={view === \"all\" ? \"All notifications\" : \"Unread notifications\"}>\n          <AnimatePresence initial={false} custom={bulk}>\n            {visible.map((item, index) => <motion.div key={item.id} role=\"listitem\" className={styles.row} custom={bulk}\n              variants={{ exit: (isBulk: boolean) => reduce ? fadeOut : { height: 0, opacity: 0, transition: { height: { ...motionTokens.spring.smooth, delay: isBulk ? cascade(index) : 0 }, opacity: { ...exitFast, delay: isBulk ? cascade(index) : 0 } } } }}\n              initial={reduce ? { opacity: 0 } : { height: 0 }} animate={{ height: \"auto\", opacity: 1 }} exit=\"exit\" transition={height}>\n              <article className={[styles.item, item.read ? styles.itemRead : \"\", expandedId === item.id ? styles.itemExpanded : \"\"].filter(Boolean).join(\" \")} style={{ \"--index\": Math.min(index, 7) } as CSSProperties}>\n                <div className={styles.itemMain}>\n                  <NotificationVisual item={item} />\n                  <button ref={(node) => { if (node) itemRefs.current.set(item.id, node); else itemRefs.current.delete(item.id); }} type=\"button\" className={styles.itemToggle} aria-expanded={expandedId === item.id} aria-label={`${item.title}${item.read ? \"\" : \", unread\"}. ${expandedId === item.id ? \"Hide details\" : \"Show details\"}`} onClick={() => setExpandedId((current) => current === item.id ? null : item.id)}>\n                    <span className={styles.itemTitle}><strong>{item.title}</strong>\n                      <AnimatePresence initial={false} custom={bulk}>{!item.read && <motion.span key=\"dot\" className={styles.unreadDot} aria-hidden=\"true\" custom={bulk}\n                        variants={{ exit: (isBulk: boolean) => reduce ? fadeOut : { opacity: 0, scale: .3, transition: { ...exitFast, delay: isBulk ? cascade(index) : 0 } } }}\n                        initial={reduce ? { opacity: 0 } : { opacity: 0, scale: .3 }} animate={{ opacity: 1, scale: 1 }} exit=\"exit\" transition={reduce ? instant : motionTokens.spring.snappy} />}</AnimatePresence>\n                    </span>\n                    <span className={styles.itemPreview}>{item.description ?? (item.actor ? `From ${item.actor.name}` : \"View update details\")}</span>\n                  </button>\n                  <time className={styles.time}>{item.time}</time>\n                </div>\n                <AnimatePresence initial={false}>\n                  {expandedId === item.id && <motion.div className={styles.details} initial={reduce ? { opacity: 0 } : { height: 0, opacity: 0 }} animate={{ height: \"auto\", opacity: 1 }} exit={reduce ? fadeOut : { height: 0, opacity: 0, transition: { height: motionTokens.spring.smooth, opacity: exitFast } }} transition={height}>\n                    <p>{item.description ?? (item.actor ? `${item.actor.name} shared an update with you.` : \"This update is ready to review.\")}</p>\n                    <div className={styles.itemActions}>\n                      <button type=\"button\" onClick={() => toggleRead(item)}><MorphWidth reduce={reduce} morphKey={item.read ? \"read\" : \"unread\"}>\n                        <span className={styles.actionIcon}><AnimatePresence mode=\"popLayout\" initial={false}><Swap key={item.read ? \"unread\" : \"read\"} className={styles.actionGlyph} initial={reduce ? { opacity: 0 } : iconIn} animate={shown} exit={reduce ? fadeOut : { ...iconIn, transition: exitFast }} transition={reduce ? instant : motionTokens.spring.snappy}>{item.read ? <CircleDot size={14} strokeWidth={1.75} aria-hidden=\"true\" /> : <Check size={14} strokeWidth={1.75} aria-hidden=\"true\" />}</Swap></AnimatePresence></span>\n                        <SwapText reduce={reduce}>{item.read ? \"Mark unread\" : \"Mark read\"}</SwapText>\n                      </MorphWidth></button>\n                      <button type=\"button\" onClick={() => dismiss(item)}><X size={14} strokeWidth={1.75} aria-hidden=\"true\" />Dismiss</button>\n                    </div>\n                  </motion.div>}\n                </AnimatePresence>\n              </article>\n            </motion.div>)}\n            {/* The empty state opens its height on the same spring the rows close on, so the panel morphs between them instead of stacking both. After a bulk action it waits for the cascade to get going, so the panel never grows before it shrinks. */}\n            {visible.length === 0 && <motion.div key=\"empty\" className={styles.emptyFrame} initial={reduce ? { opacity: 0 } : { height: 0, opacity: 0 }} animate={{ height: \"auto\", opacity: 1 }} exit={reduce ? fadeOut : { height: 0, opacity: 0, transition: { height: motionTokens.spring.smooth, opacity: exitFast } }} transition={reduce ? instant : { height: { ...motionTokens.spring.smooth, delay: bulk ? cascade(3) : 0 }, opacity: { ...enter, delay: motionTokens.duration.fast } }}>\n              <motion.div className={styles.empty} initial={reduce ? false : { y: 6 }} animate={{ y: 0 }} transition={reduce ? instant : { ...enter, delay: motionTokens.duration.fast }}><CircleCheck size={24} strokeWidth={1.5} aria-hidden=\"true\" /><strong><SwapText reduce={reduce}>{view === \"unread\" ? \"Nothing unread\" : \"All clear\"}</SwapText></strong><p><SwapText reduce={reduce}>{view === \"unread\" ? \"You’ve seen every update.\" : \"New updates will appear here.\"}</SwapText></p>{view === \"unread\" && items.length > 0 && <button type=\"button\" onClick={() => { setBulk(false); setView(\"all\"); }}>View all updates</button>}</motion.div>\n            </motion.div>}\n          </AnimatePresence>\n        </div>\n\n        <AnimatePresence initial={false}>{readCount > 0 && <motion.div key=\"footer\" className={styles.footerFrame} initial={reduce ? { opacity: 0 } : { height: 0, opacity: 0 }} animate={{ height: \"auto\", opacity: 1 }} exit={reduce ? fadeOut : { height: 0, opacity: 0, transition: { height: motionTokens.spring.smooth, opacity: exitFast } }} transition={height}>\n          <div className={styles.footer}><span><RollingCount value={readCount} reduce={reduce} /> read</span><button type=\"button\" onClick={clearRead}>Clear read</button></div>\n        </motion.div>}</AnimatePresence>\n      </PopoverPrimitive.Content>\n    </PopoverPrimitive.Portal>\n  </PopoverPrimitive.Root>;\n}\n\nexport default NotificationCenter;\n"},{"path":"registry/components/notification-center/notification-center.module.css","type":"registry:component","target":"@components/silicon-ui/notification-center/notification-center.module.css","content":".trigger { position: relative; display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--border); border-radius: var(--radius-control); corner-shape: var(--corner-shape); background: var(--surface); color: var(--foreground); cursor: pointer; transition: border-color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard); }\n.trigger[data-state=\"open\"], .trigger:active { border-color: var(--border-strong); background: var(--surface-muted); }\n@media (hover: hover) and (pointer: fine) { .trigger:hover { border-color: var(--border-strong); background: var(--surface-muted); } }\n.trigger > span:first-child { display: grid; place-items: center; }\n.badge { position: absolute; top: calc(var(--space-related) * -1); right: calc(var(--space-related) * -1); display: grid; min-width: 20px; height: 20px; padding: 0 var(--space-tight); place-items: center; overflow: hidden; border: 2px solid var(--surface); border-radius: var(--radius-full); corner-shape: round; background: var(--foreground); color: var(--background); font-size: var(--text-xs); font-weight: var(--weight-medium); line-height: 1; font-variant-numeric: tabular-nums; }\n.panel { z-index: var(--layer-popover); display: flex; flex-direction: column; width: min(424px, calc(100vw - 24px)); max-height: min(590px, calc(100vh - 24px)); overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-container); corner-shape: var(--corner-shape); background: var(--surface-raised); color: var(--foreground); box-shadow: var(--shadow-floating); font-family: var(--font-body); letter-spacing: var(--tracking-body); transform-origin: var(--radix-popover-content-transform-origin); }\n/* The panel grows out of the bell: it starts a few pixels toward the trigger on whichever side Radix placed it, and leaves faster than it arrives. */\n.panel { --panel-x: 0px; --panel-y: -6px; }\n.panel[data-side=\"top\"] { --panel-y: 6px; }\n.panel[data-side=\"left\"] { --panel-x: 6px; --panel-y: 0px; }\n.panel[data-side=\"right\"] { --panel-x: -6px; --panel-y: 0px; }\n.panel[data-state=\"open\"] { animation: panel-open var(--duration-standard) var(--ease-enter) both; }\n.panel[data-state=\"closed\"] { animation: panel-close var(--duration-instant) var(--ease-standard) both; }\n.header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-group); padding: var(--space-section) var(--space-section) var(--space-comfort); }\n.heading { display: flex; align-items: center; gap: var(--space-related); }\n.heading h2 { margin: 0; font-size: var(--text-xl); font-weight: var(--weight-medium); letter-spacing: var(--tracking-body); line-height: 1.2; }\n.count { display: grid; min-width: 21px; height: 21px; padding: 0 var(--space-tight); place-items: center; overflow: hidden; border-radius: var(--radius-detail); corner-shape: var(--corner-shape); background: var(--surface-muted); color: var(--text-secondary); font-size: var(--text-xs); line-height: 1; font-variant-numeric: tabular-nums; }\n.header p { position: relative; margin: var(--space-tight) 0 0; color: var(--text-secondary); font-size: var(--text-xs); line-height: var(--leading-body); }\n.close { display: grid; width: 30px; height: 30px; flex: none; place-items: center; border: 0; border-radius: var(--radius-detail); corner-shape: var(--corner-shape); background: transparent; color: var(--text-muted); cursor: pointer; transition: transform var(--duration-spring) var(--ease-spring), color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard); }\n.close:active { transform: scale(.96); }\n.toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-group); min-height: 52px; padding: 0 var(--space-inset) var(--space-group) var(--space-comfort); border-bottom: 1px solid var(--border-subtle); }\n.viewSwitch { display: inline-flex; align-items: center; gap: var(--space-tight); }\n.viewSwitch button { position: relative; isolation: isolate; min-width: 61px; height: 31px; padding: 0 var(--space-group); border: 0; border-radius: var(--radius-detail); corner-shape: var(--corner-shape); background: transparent; color: var(--text-secondary); font: inherit; font-size: var(--text-xs); cursor: pointer; transition: color var(--duration-fast) var(--ease-standard); }\n.viewSwitch .viewActive { color: var(--foreground); }\n.viewSwitch button > span:last-child { position: relative; z-index: 1; }\n.viewHighlight { position: absolute; z-index: -1; inset: 0; border-radius: var(--radius-detail); corner-shape: var(--corner-shape); background: var(--surface-muted); }\n.markAll { display: inline-flex; align-items: center; gap: var(--space-related); padding: var(--space-related) 0; border: 0; background: transparent; color: var(--text-secondary); font: inherit; font-size: var(--text-xs); white-space: nowrap; cursor: pointer; transition: transform var(--duration-spring) var(--ease-spring), color var(--duration-fast) var(--ease-standard); }\n.markAll:active { transform: scale(.97); }\n.list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--space-related) var(--space-group) var(--space-group); scrollbar-width: none; }\n.list::-webkit-scrollbar { display: none; }\n.row { overflow: hidden; }\n/* Rows settle in with a short cascade when the panel opens or a view adds them. */\n.item { position: relative; padding: var(--space-group); border-radius: calc(var(--radius-container) - var(--space-group)); corner-shape: var(--corner-shape); transition: background var(--duration-fast) var(--ease-standard); animation: item-in var(--duration-standard) var(--ease-enter) calc(var(--index, 0) * 35ms) both; }\n.itemExpanded { background: var(--surface-muted); }\n.itemRead .itemTitle strong { color: var(--text-secondary); }\n.itemMain { display: flex; align-items: flex-start; gap: var(--space-group); min-width: 0; }\n.eventIcon { display: grid; width: 36px; height: 36px; flex: none; place-items: center; color: var(--accent); }\n.eventIcon.success { color: var(--success); }\n.eventIcon.warning { color: var(--warning); }\n.itemToggle { display: grid; min-width: 0; flex: 1; gap: var(--space-tight); padding: var(--space-hair) 0 0; border: 0; background: transparent; color: var(--foreground); text-align: left; font: inherit; cursor: pointer; }\n.itemTitle { display: flex; align-items: center; gap: var(--space-related); min-width: 0; min-height: 20px; }\n.itemTitle strong { overflow: hidden; font-size: var(--text-sm); font-weight: var(--weight-medium); line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }\n.unreadDot { display: block; width: 6px; height: 6px; flex: none; border-radius: 50%; corner-shape: round; background: var(--foreground); }\n.itemPreview { overflow: hidden; color: var(--text-secondary); font-size: var(--text-xs); line-height: var(--leading-body); text-overflow: ellipsis; white-space: nowrap; }\n.time { flex: none; padding-top: var(--space-tight); color: var(--text-muted); font-size: var(--text-xs); line-height: var(--leading-body); font-variant-numeric: tabular-nums; white-space: nowrap; }\n.details { overflow: hidden; padding-left: var(--space-page); }\n.details p { margin: var(--space-group) 0; color: var(--text-secondary); font-size: var(--text-xs); line-height: var(--leading-body); }\n.itemActions { display: flex; flex-wrap: wrap; gap: var(--space-related); padding-bottom: var(--space-tight); }\n.itemActions button { display: inline-flex; align-items: center; gap: var(--space-tight); height: 30px; padding: 0 var(--space-group); overflow: clip; border: 1px solid var(--border); border-radius: var(--radius-detail); corner-shape: var(--corner-shape); background: transparent; color: var(--foreground); font: inherit; font-size: var(--text-xs); line-height: 1; white-space: nowrap; cursor: pointer; transition: transform var(--duration-spring) var(--ease-spring), border-color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard); }\n.itemActions button:active { transform: scale(.97); }\n/* Quick press, spring release: the resting transition above carries the spring back. */\n.close:active, .markAll:active, .itemActions button:active, .footer button:active { transition-duration: var(--duration-instant); transition-timing-function: var(--ease-standard); }\n.morph { display: inline-flex; align-items: center; }\n.morphContent { position: relative; display: inline-flex; width: max-content; align-items: center; gap: var(--space-tight); }\n.actionIcon, .actionGlyph { position: relative; display: grid; place-items: center; }\n.swap { position: relative; display: inline-block; max-width: 100%; vertical-align: top; }\n.swapLine { display: block; }\n.roll { position: relative; display: inline-grid; vertical-align: top; }\n.rollValue { display: block; }\n.emptyFrame { overflow: hidden; }\n.empty { display: grid; justify-items: center; align-content: center; min-height: 190px; padding: var(--space-section) var(--space-group); text-align: center; }\n.empty > svg { margin-bottom: var(--space-group); color: var(--text-muted); }\n.empty strong { font-size: var(--text-sm); font-weight: var(--weight-medium); }\n.empty p { margin: var(--space-tight) 0 0; color: var(--text-secondary); font-size: var(--text-xs); }\n.empty button { margin-top: var(--space-inset); padding: 0; border: 0; background: transparent; color: var(--foreground); font: inherit; font-size: var(--text-xs); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }\n.footerFrame { flex: none; overflow: hidden; }\n.footer { display: flex; align-items: center; justify-content: space-between; gap: var(--space-group); min-height: 46px; padding: var(--space-related) var(--space-section); border-top: 1px solid var(--border-subtle); color: var(--text-muted); font-size: var(--text-xs); }\n.footer button { padding: var(--space-tight) 0; border: 0; background: transparent; color: var(--text-secondary); font: inherit; font-size: var(--text-xs); cursor: pointer; transition: transform var(--duration-spring) var(--ease-spring), color var(--duration-fast) var(--ease-standard); }\n.footer button:active { transform: scale(.97); }\n@media (hover: hover) and (pointer: fine) {\n  .close:hover, .item:hover { background: var(--surface-muted); }\n  .close:hover, .viewSwitch button:hover, .markAll:hover, .footer button:hover { color: var(--foreground); }\n  .itemActions button:hover { border-color: var(--border-strong); background: var(--surface); }\n}\n@keyframes panel-open { from { opacity: 0; transform: translate(var(--panel-x), var(--panel-y)) scale(.97); } }\n@keyframes panel-close { to { opacity: 0; transform: translate(calc(var(--panel-x) / 2), calc(var(--panel-y) / 2)) scale(.98); } }\n@keyframes item-in { from { opacity: 0; transform: translateY(4px); } }\n@media (max-width: 380px) { .header { padding: var(--space-comfort) var(--space-inset) var(--space-inset); } .heading h2 { font-size: var(--text-lg); } .toolbar { align-items: flex-start; padding: 0 var(--space-group) var(--space-group); } .list { padding: var(--space-related) var(--space-tight); } .item { padding-inline: var(--space-related); } .itemMain { gap: var(--space-related); } .details { padding-left: var(--space-page); } .itemActions { gap: var(--space-tight); } .itemActions button { padding-inline: var(--space-related); } .markAll span { display: none; } .footer { padding-inline: var(--space-inset); } }\n@media (prefers-reduced-motion: reduce) { .panel[data-state], .trigger, .close, .viewSwitch button, .markAll, .item, .itemActions button, .footer button { animation: none; transition-duration: 0ms; } .close:active, .markAll:active, .itemActions button:active, .footer button:active { transform: none; } }\n"},{"path":"registry/components/avatar/avatar.tsx","type":"registry:component","target":"@components/silicon-ui/avatar/avatar.tsx","content":"\"use client\";\n\nimport { useLayoutEffect, useRef, useState, type HTMLAttributes } from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { SiliconImage } from \"../lib/silicon-provider\";\nimport { motionTokens } from \"../lib/motion-tokens\";\nimport styles from \"./avatar.module.css\";\nexport interface AvatarProps extends HTMLAttributes<HTMLSpanElement> { name: string; src?: string; /** `xs` (20px) is for dense lists such as space icons in a tree; `sm` 28, `md` 36, `lg` 48, `xl` 88. */ size?: \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\"; status?: \"online\" | \"offline\" }\nexport function Avatar({ name, src, size = \"md\", status, className, ...props }: AvatarProps) {\n  const initials = name.trim().split(/\\s+/).slice(0, 2).map(part => part[0]?.toUpperCase()).join(\"\");\n  const reduceMotion = !!useReducedMotion();\n  const image = useRef<HTMLImageElement>(null);\n  const [failedSrc, setFailedSrc] = useState<string>();\n  // A photo that is already decoded shows at once. One that is still loading waits, then fades in from a soft blur.\n  useLayoutEffect(() => { const node = image.current; if (node && !node.complete) node.dataset.loading = \"\"; }, [src]);\n  const showImage = src && failedSrc !== src;\n  return <span {...props} className={[styles.avatar, styles[size], className].filter(Boolean).join(\" \")} role=\"img\" aria-label={`${name}${status ? `, ${status}` : \"\"}`}>\n    {showImage ? <SiliconImage key={src} ref={image} src={src} alt=\"\" fill sizes={size === \"xl\" ? \"88px\" : size === \"lg\" ? \"48px\" : size === \"md\" ? \"36px\" : size === \"sm\" ? \"28px\" : \"20px\"} onLoad={event => { delete event.currentTarget.dataset.loading; }} onError={() => setFailedSrc(src)} /> : <span className={src ? styles.fallback : undefined} aria-hidden=\"true\">{initials}</span>}\n    <AnimatePresence initial={false}>{status && <motion.i key={status} className={[styles.status, styles[status]].join(\" \")} aria-hidden=\"true\" initial={{ opacity: 0, scale: .6 }} animate={{ opacity: 1, scale: 1 }} exit={{ opacity: 0, scale: .6, transition: { duration: reduceMotion ? 0 : motionTokens.duration.fast } }} transition={reduceMotion ? { duration: 0 } : motionTokens.spring.snappy} />}</AnimatePresence>\n  </span>;\n}\n"},{"path":"registry/components/avatar/avatar.module.css","type":"registry:component","target":"@components/silicon-ui/avatar/avatar.module.css","content":".avatar {\n  position: relative;\n  display: inline-grid;\n  flex: 0 0 auto;\n  place-items: center;\n  overflow: visible;\n  border: 1px solid var(--border);\n  border-radius: var(--avatar-radius); corner-shape: var(--avatar-corner-shape);\n  background: var(--surface-muted);\n  color: var(--foreground);\n  font-size: var(--text-xs);\n  font-weight: var(--weight-medium);\n}\n\n.avatar img {\n  pointer-events: none;\n  border-radius: inherit; corner-shape: inherit;\n  object-fit: cover;\n  transition: opacity var(--duration-standard) var(--ease-enter), filter var(--duration-standard) var(--ease-enter);\n}\n\n/* Set only while a photo is still downloading after mount, so cached photos never fade. */\n.avatar img[data-loading] {\n  opacity: 0;\n  filter: blur(4px);\n  transition: none;\n}\n\n.fallback { animation: avatar-fallback-in var(--duration-standard) var(--ease-enter) both; }\n\n/* Initials below the smallest type step, so two letters fit 20px. */\n.xs { width: 20px; height: 20px; font-size: calc(var(--text-xs) * .8); }\n.sm { width: 28px; height: 28px; font-size: var(--text-xs); }\n.md { width: 36px; height: 36px; }\n.lg { width: 48px; height: 48px; font-size: var(--text-sm); }\n.xl { width: 88px; height: 88px; font-size: var(--text-xl); }\n\n.status {\n  position: absolute;\n  right: 0;\n  bottom: 0;\n  z-index: 2;\n  width: 10px;\n  height: 10px;\n  border: 2px solid var(--surface);\n  border-radius: var(--radius-full); corner-shape: round;\n  box-shadow: 0 0 0 1px color-mix(in oklab, var(--border) 70%, transparent);\n}\n\n.xs .status { width: 6px; height: 6px; border-width: 1px; }\n.sm .status { width: 8px; height: 8px; border-width: 1.5px; }\n.lg .status { width: 12px; height: 12px; }\n.xl .status { width: 14px; height: 14px; right: var(--space-tight); bottom: var(--space-tight); }\n.online { background: var(--success); }\n.offline { background: var(--text-muted); }\n\n@keyframes avatar-fallback-in { from { opacity: 0; } to { opacity: 1; } }\n\n@media (prefers-reduced-motion: reduce) {\n  .avatar img { transition: none; }\n  .avatar img[data-loading] { filter: none; }\n  .fallback { animation: none; }\n}\n"},{"path":"lib/silicon-provider.tsx","type":"registry:lib","target":"@components/silicon-ui/lib/silicon-provider.tsx","content":"\"use client\";\n\n/**\n * Lets an app swap the link and image elements Silicon UI components render.\n *\n * Without a provider, Silicon UI renders a plain `<a>` and `<img>`, so components work in any React app (Vite, Remix, Astro,\n * plain React). Wrap the app once to use your framework's or your own components instead:\n *\n *   import Link from \"next/link\";\n *   import Image from \"next/image\";\n *   import { SiliconProvider } from \"@/components/silicon-ui/lib/silicon-provider\";\n *\n *   <SiliconProvider link={Link} image={Image}>{children}</SiliconProvider>\n *\n * Any component that accepts these props works, such as a locale-aware Link from next-intl or a React Router Link\n * wrapped to map `href` to `to`.\n */\nimport { createContext, createElement, useContext, useMemo, type AnchorHTMLAttributes, type ComponentType, type ImgHTMLAttributes, type ReactNode, type Ref } from \"react\";\n\n/** The props Silicon UI passes to a link: an href plus ordinary anchor attributes. */\nexport interface SiliconLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n  href: string;\n  ref?: Ref<HTMLAnchorElement>;\n}\n\n/**\n * The props Silicon UI passes to an image. A subset of next/image's props, so next/image can be passed as is: either `fill`\n * (cover the positioned parent) or `width` and `height`, plus `sizes` and `priority` as hints.\n */\nexport interface SiliconImageProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, \"src\" | \"alt\" | \"width\" | \"height\" | \"loading\" | \"srcSet\"> {\n  src: string;\n  alt: string;\n  width?: number;\n  height?: number;\n  /** Fills the nearest positioned parent, like next/image's `fill`. */\n  fill?: boolean;\n  /** Loads the image eagerly with high priority, like next/image's `priority`. */\n  priority?: boolean;\n  loading?: \"eager\" | \"lazy\";\n  ref?: Ref<HTMLImageElement>;\n}\n\nexport type SiliconLinkComponent = ComponentType<SiliconLinkProps>;\nexport type SiliconImageComponent = ComponentType<SiliconImageProps>;\n\n/** The default link: a plain anchor. */\nexport function SiliconAnchor(props: SiliconLinkProps) {\n  return <a {...props} />;\n}\n\nconst fillStyle = { position: \"absolute\", inset: 0, width: \"100%\", height: \"100%\" } as const;\n\n/** The default image: a plain, lazily decoded `<img>` that understands `fill` and `priority`. */\nexport function SiliconImg({ alt, fill, priority, loading, style, ...props }: SiliconImageProps) {\n  // eslint-disable-next-line @next/next/no-img-element -- the framework-free default; pass next/image through SiliconProvider instead.\n  return <img alt={alt} decoding=\"async\" {...props} loading={loading ?? (priority ? \"eager\" : \"lazy\")} fetchPriority={priority ? \"high\" : props.fetchPriority} style={fill ? { ...fillStyle, ...style } : style} />;\n}\n\ninterface SiliconComponents {\n  link: SiliconLinkComponent;\n  image: SiliconImageComponent;\n}\n\nconst SiliconContext = createContext<SiliconComponents>({ link: SiliconAnchor, image: SiliconImg });\n\nexport interface SiliconProviderProps {\n  /** The link component Silicon UI renders for navigation, such as next/link or your own wrapped Link. Defaults to `<a>`. */\n  link?: SiliconLinkComponent;\n  /** The image component Silicon UI renders for photos, such as next/image. Defaults to `<img>`. */\n  image?: SiliconImageComponent;\n  children: ReactNode;\n}\n\n/** Sets the link and image components for every Silicon UI component inside it. Nested providers inherit what they do not set. */\nexport function SiliconProvider({ link, image, children }: SiliconProviderProps) {\n  const parent = useContext(SiliconContext);\n  const value = useMemo(() => ({ link: link ?? parent.link, image: image ?? parent.image }), [link, image, parent]);\n  return <SiliconContext.Provider value={value}>{children}</SiliconContext.Provider>;\n}\n\n/** The link component from the nearest SiliconProvider, or a plain anchor. */\nexport const useArcLink = () => useContext(SiliconContext).link;\n/** The image component from the nearest SiliconProvider, or a plain img. */\nexport const useArcImage = () => useContext(SiliconContext).image;\n\n/** What Silicon UI components render for a link: the provider's link component, or a plain anchor. */\nexport function SiliconLink(props: SiliconLinkProps) {\n  return createElement(useArcLink(), props);\n}\n\n/** What Silicon UI components render for an image: the provider's image component, or a plain img. */\nexport function SiliconImage(props: SiliconImageProps) {\n  return createElement(useArcImage(), props);\n}\n"}],"docs":"Docs and live preview: https://ui.teamofsilicons.com/notification-center","meta":{"tier":"free","kind":"block","docs":"https://ui.teamofsilicons.com/notification-center","markdown":"https://ui.teamofsilicons.com/notification-center.md","status":"stable"}}