{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "notification-center",
  "title": "Notification Center",
  "description": "Updates grouped by date with unread state, filters, per-item toggles, and bulk actions.",
  "dependencies": [
    "class-variance-authority",
    "lucide-react"
  ],
  "registryDependencies": [
    "button",
    "https://uaiblocks.dev/r/uai-theme.json",
    "https://uaiblocks.dev/r/empty-state.json",
    "https://uaiblocks.dev/r/page-tabs.json",
    "https://uaiblocks.dev/r/uai-utils.json"
  ],
  "files": [
    {
      "path": "src/registry/uai/blocks/notification-center.tsx",
      "content": "\"use client\";\n\nimport { cva } from \"class-variance-authority\";\nimport { Mail, MailOpen } from \"lucide-react\";\nimport { type ComponentProps, createContext, useContext, useId, useState } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n  EmptyState,\n  type EmptyStateProps,\n  type EmptyStateVariant,\n} from \"@/components/ui/uai/empty-state\";\nimport { PageTabs, type PageTabsProps, type PageTabsVariant } from \"@/components/ui/uai/page-tabs\";\nimport { cn } from \"@/lib/uai-utils\";\n\nexport const NOTIFICATION_CENTER_VARIANTS = [\"panel\", \"page\", \"compact\"] as const;\nexport type NotificationCenterVariant = (typeof NOTIFICATION_CENTER_VARIANTS)[number];\nexport type NotificationCenterProps = ComponentProps<\"section\"> & {\n  variant?: NotificationCenterVariant;\n};\n\ntype CenterContext = { id: string; variant: NotificationCenterVariant };\nconst Context = createContext<CenterContext | null>(null);\nfunction useCenter(part: string) {\n  const context = useContext(Context);\n  if (!context) throw new Error(`${part} must be used within NotificationCenter`);\n  return context;\n}\nconst GroupContext = createContext<string | null>(null);\ntype ItemContextValue = { id: string; read: boolean; setRead: (read: boolean) => void };\nconst ItemContext = createContext<ItemContextValue | null>(null);\nfunction useItem(part: string) {\n  const context = useContext(ItemContext);\n  if (!context) throw new Error(`${part} must be used within NotificationCenterItem`);\n  return context;\n}\n\nconst tabVariants: Record<NotificationCenterVariant, PageTabsVariant> = {\n  panel: \"underline\",\n  page: \"pill\",\n  compact: \"segmented\",\n};\nconst emptyVariants: Record<NotificationCenterVariant, EmptyStateVariant> = {\n  panel: \"plain\",\n  page: \"plain\",\n  compact: \"compact\",\n};\nconst buttonInteraction =\n  \"transition-[background-color,color,scale] duration-[120ms,120ms,140ms] ease-[ease-out,ease-out,cubic-bezier(0.23,1,0.32,1)] bg-transparent text-muted-foreground focus-visible:ring-0 focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring motion-reduce:transition-none\";\n\nconst notificationCenterVariants = cva(\n  \"grid min-w-0 content-start text-[13px]/[18px] text-foreground\",\n  {\n    variants: {\n      variant: {\n        panel: \"gap-3.5 rounded-[14px] border bg-card px-3 pt-4 pb-3\",\n        page: \"gap-3.5 rounded-[14px] border-0 bg-transparent p-0\",\n        compact: \"gap-2 rounded-xl border bg-card p-2.5\",\n      },\n    },\n  },\n);\n\nexport function NotificationCenter({\n  variant = \"panel\",\n  className,\n  children,\n  ...props\n}: NotificationCenterProps) {\n  const id = useId();\n  return (\n    <Context.Provider value={{ id, variant }}>\n      <section\n        aria-labelledby={`${id}-title`}\n        data-slot=\"notification-center\"\n        data-variant={variant}\n        className={cn(notificationCenterVariants({ variant }), className)}\n        {...props}\n      >\n        {children}\n      </section>\n    </Context.Provider>\n  );\n}\n\nexport function NotificationCenterHeader({ className, ...props }: ComponentProps<\"div\">) {\n  const { variant } = useCenter(\"NotificationCenterHeader\");\n  return (\n    <div\n      data-slot=\"notification-center-header\"\n      className={cn(\n        \"flex min-w-0 flex-wrap items-center justify-between gap-2\",\n        variant === \"panel\" && \"px-1\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\nexport function NotificationCenterTitle({ className, ...props }: ComponentProps<\"h2\">) {\n  const context = useCenter(\"NotificationCenterTitle\");\n  return (\n    <h2\n      data-slot=\"notification-center-title\"\n      className={cn(\n        \"m-0 flex items-center gap-2 font-semibold tracking-[-0.01em]\",\n        context.variant === \"page\" ? \"text-lg/6\" : \"text-[15px]/5\",\n        className,\n      )}\n      {...props}\n      id={`${context.id}-title`}\n    />\n  );\n}\n\n/** Unread total beside the title. Write the full phrase, such as \"4 unread\". */\nexport function NotificationCenterCount({ className, ...props }: ComponentProps<\"span\">) {\n  useCenter(\"NotificationCenterCount\");\n  return (\n    <span\n      data-slot=\"notification-center-count\"\n      className={cn(\n        \"rounded-full bg-primary/14 px-2 text-[11.5px]/5 font-medium tracking-normal text-primary-ink tabular-nums\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\nexport function NotificationCenterActions({ className, ...props }: ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"notification-center-actions\"\n      className={cn(\"flex flex-wrap items-center gap-1\", className)}\n      {...props}\n    />\n  );\n}\n\n/** A bulk action such as \"Mark all as read\". */\nexport function NotificationCenterAction({\n  type = \"button\",\n  className,\n  ...props\n}: ComponentProps<\"button\">) {\n  const context = useCenter(\"NotificationCenterAction\");\n  return (\n    <Button\n      data-slot=\"notification-center-action\"\n      variant=\"ghost\"\n      className={cn(\n        \"cursor-pointer justify-start gap-1.5 rounded-full border-0 px-2.5 py-0 text-[12.5px] has-[>svg]:px-2.5\",\n        buttonInteraction,\n        \"hover:bg-accent hover:text-foreground active:enabled:scale-[0.97] motion-reduce:active:enabled:scale-100 dark:hover:bg-accent\",\n        \"disabled:cursor-not-allowed disabled:text-subtle-foreground disabled:opacity-55\",\n        context.variant === \"compact\" ? \"h-6.5\" : \"h-7\",\n        className,\n      )}\n      {...props}\n      type={type}\n    />\n  );\n}\n\n/** Filters such as All, Unread, and Mentions. Compose Page Tabs parts inside it. */\nexport function NotificationCenterTabs(props: Omit<PageTabsProps, \"variant\">) {\n  const context = useCenter(\"NotificationCenterTabs\");\n  return <PageTabs {...props} variant={tabVariants[context.variant]} />;\n}\n\n/** Notifications that share a date, such as Today or Yesterday. */\nexport function NotificationCenterGroup({ className, ...props }: ComponentProps<\"section\">) {\n  const context = useCenter(\"NotificationCenterGroup\");\n  const id = useId();\n  return (\n    <GroupContext.Provider value={id}>\n      <section\n        aria-labelledby={id}\n        data-slot=\"notification-center-group\"\n        className={cn(\n          \"grid min-w-0\",\n          context.variant === \"compact\" ? \"gap-1\" : \"gap-1.5\",\n          className,\n        )}\n        {...props}\n      />\n    </GroupContext.Provider>\n  );\n}\n\nexport function NotificationCenterGroupDate({ className, ...props }: ComponentProps<\"h3\">) {\n  const id = useContext(GroupContext);\n  if (!id)\n    throw new Error(\"NotificationCenterGroupDate must be used within NotificationCenterGroup\");\n  return (\n    <h3\n      data-slot=\"notification-center-group-date\"\n      className={cn(\n        \"m-0 px-1 pt-1 pb-0.5 text-[11.5px]/4 font-medium text-subtle-foreground\",\n        className,\n      )}\n      {...props}\n      id={id}\n    />\n  );\n}\n\nexport function NotificationCenterList({ className, ...props }: ComponentProps<\"ul\">) {\n  return (\n    <ul\n      data-slot=\"notification-center-list\"\n      className={cn(\"m-0 grid list-none gap-0.5 p-0\", className)}\n      {...props}\n    />\n  );\n}\n\nexport type NotificationCenterItemProps = ComponentProps<\"li\"> & {\n  read?: boolean;\n  defaultRead?: boolean;\n  onReadChange?: (read: boolean) => void;\n};\n\nexport function NotificationCenterItem({\n  read,\n  defaultRead = false,\n  onReadChange,\n  className,\n  children,\n  ...props\n}: NotificationCenterItemProps) {\n  const { variant } = useCenter(\"NotificationCenterItem\");\n  const id = useId();\n  const [internal, setInternal] = useState(defaultRead);\n  const current = read ?? internal;\n  const setRead = (next: boolean) => {\n    if (next === current) return;\n    if (read === undefined) setInternal(next);\n    onReadChange?.(next);\n  };\n  const compact = variant === \"compact\";\n  return (\n    <ItemContext.Provider value={{ id, read: current, setRead }}>\n      <li\n        data-slot=\"notification-center-item\"\n        className={cn(\n          \"group/notification-item grid min-w-0 grid-cols-[8px_minmax(0,1fr)_auto] items-start\",\n          \"transition-[background-color,color] duration-120 ease-[ease-out] hover:bg-accent\",\n          \"animate-[enter_240ms_cubic-bezier(0.23,1,0.32,1)_both] fade-in-0 slide-in-from-bottom-1 nth-2:[animation-delay:40ms] nth-3:[animation-delay:80ms] nth-[n+4]:[animation-delay:120ms]\",\n          \"motion-reduce:animate-none motion-reduce:transition-none\",\n          current ? \"bg-transparent\" : \"bg-accent/70\",\n          compact\n            ? \"gap-x-2 rounded-lg px-2 py-1.5\"\n            : \"gap-x-2.5 rounded-[10px] py-2.5 pr-2.5 pl-3\",\n          className,\n        )}\n        {...props}\n        data-read={current || undefined}\n      >\n        <span\n          aria-hidden=\"true\"\n          className={cn(\n            \"mt-1.5 ml-px size-1.5 rounded-full transition-[background-color] duration-120 ease-[ease-out]\",\n            current ? \"bg-transparent\" : \"bg-primary\",\n          )}\n        />\n        {children}\n      </li>\n    </ItemContext.Provider>\n  );\n}\n\nexport function NotificationCenterItemContent({ className, ...props }: ComponentProps<\"div\">) {\n  useItem(\"NotificationCenterItemContent\");\n  return (\n    <div\n      data-slot=\"notification-center-item-content\"\n      className={cn(\"grid min-w-0 gap-0.5\", className)}\n      {...props}\n    />\n  );\n}\n\n/** The notification headline. Unread items announce \"Unread\" before it. */\nexport function NotificationCenterItemTitle({\n  children,\n  className,\n  ...props\n}: ComponentProps<\"p\">) {\n  const item = useItem(\"NotificationCenterItemTitle\");\n  return (\n    <p\n      data-slot=\"notification-center-item-title\"\n      className={cn(\n        \"m-0 font-medium wrap-anywhere\",\n        item.read ? \"text-muted-foreground\" : \"text-foreground\",\n        className,\n      )}\n      {...props}\n      id={`${item.id}-title`}\n    >\n      {item.read ? null : <span className=\"sr-only\">Unread: </span>}\n      {children}\n    </p>\n  );\n}\n\nexport function NotificationCenterItemDescription({ className, ...props }: ComponentProps<\"p\">) {\n  useItem(\"NotificationCenterItemDescription\");\n  return (\n    <p\n      data-slot=\"notification-center-item-description\"\n      className={cn(\"m-0 text-[12.5px] text-muted-foreground wrap-anywhere\", className)}\n      {...props}\n    />\n  );\n}\n\nexport function NotificationCenterItemTime({ className, ...props }: ComponentProps<\"time\">) {\n  useItem(\"NotificationCenterItemTime\");\n  return (\n    <time\n      data-slot=\"notification-center-item-time\"\n      className={cn(\n        \"text-[11.5px]/[18px] whitespace-nowrap text-subtle-foreground tabular-nums\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\nexport function NotificationCenterItemActions({ className, ...props }: ComponentProps<\"div\">) {\n  useItem(\"NotificationCenterItemActions\");\n  return (\n    <div\n      data-slot=\"notification-center-item-actions\"\n      className={cn(\"flex items-center gap-0.5\", className)}\n      {...props}\n    />\n  );\n}\n\n/** Toggles the item between read and unread. */\nexport function NotificationCenterItemToggle({\n  onClick,\n  className,\n  ...props\n}: Omit<ComponentProps<\"button\">, \"children\">) {\n  const { variant } = useCenter(\"NotificationCenterItemToggle\");\n  const item = useItem(\"NotificationCenterItemToggle\");\n  const Icon = item.read ? Mail : MailOpen;\n  return (\n    <Button\n      type=\"button\"\n      variant=\"ghost\"\n      size=\"icon\"\n      aria-label={item.read ? \"Mark as unread\" : \"Mark as read\"}\n      aria-describedby={`${item.id}-title`}\n      title={item.read ? \"Mark as unread\" : \"Mark as read\"}\n      data-slot=\"notification-center-item-toggle\"\n      className={cn(\n        \"grid cursor-pointer place-items-center rounded-lg border-0 p-0\",\n        buttonInteraction,\n        \"hover:bg-accent hover:text-foreground active:scale-[0.97] motion-reduce:active:scale-100 dark:hover:bg-accent\",\n        \"opacity-70 group-hover/notification-item:opacity-100 focus-visible:opacity-100 [@media(hover:none)]:opacity-100\",\n        variant === \"compact\" ? \"size-6\" : \"size-7\",\n        className,\n      )}\n      {...props}\n      onClick={(event) => {\n        onClick?.(event);\n        if (!event.defaultPrevented) item.setRead(!item.read);\n      }}\n    >\n      <Icon size={15} strokeWidth={1.75} aria-hidden=\"true\" className=\"size-[15px]\" />\n    </Button>\n  );\n}\n\n/** Shown when a filter has no notifications. Compose Empty State parts inside it. */\nexport function NotificationCenterEmpty(props: Omit<EmptyStateProps, \"variant\">) {\n  const context = useCenter(\"NotificationCenterEmpty\");\n  return <EmptyState {...props} variant={emptyVariants[context.variant]} />;\n}\n",
      "type": "registry:component",
      "target": "@components/uai/notification-center.tsx"
    }
  ],
  "categories": [
    "application"
  ],
  "type": "registry:block"
}