{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "navbar-16",
  "title": "Dashboard navbar",
  "description": "A search field, a test mode switch, tool menus and a button to create an item.",
  "dependencies": [
    "@base-ui/react",
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/dropdown-menu.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/input.json",
    "https://ui.ndekocode.dev/r/label.json",
    "https://ui.ndekocode.dev/r/popover.json",
    "https://ui.ndekocode.dev/r/recipes.json",
    "https://ui.ndekocode.dev/r/switch.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/components/navbar/navbar-16.tsx",
      "content": "import { InfoMenu } from '@/registry/ndeko/components/navbar/_parts/info-menu';\nimport { NotificationMenu } from '@/registry/ndeko/components/navbar/_parts/notification-menu';\nimport { SearchField } from '@/registry/ndeko/components/navbar/_parts/search-field';\nimport { SettingsMenu } from '@/registry/ndeko/components/navbar/_parts/settings-menu';\nimport { LayoutGridIcon, PlusIcon } from '@/registry/ndeko/lib/icons';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Label } from '@/registry/ndeko/ui/label';\nimport { Switch } from '@/registry/ndeko/ui/switch';\n\nexport default function Navbar16() {\n  return (\n    <header className='hairline-b border-border px-4 md:px-6'>\n      <div className='flex h-16 items-center justify-between gap-4'>\n        <SearchField containerClassName='flex-1' className='max-w-xs' />\n        <div className='flex items-center gap-4'>\n          <Label className='max-md:hidden'>\n            Test mode\n            <Switch defaultChecked />\n          </Label>\n          <div className='flex items-center gap-1'>\n            <Button\n              variant='ghost'\n              size='icon'\n              aria-label='Open apps'\n              className='text-muted-foreground'\n            >\n              <LayoutGridIcon />\n            </Button>\n            <InfoMenu />\n            <NotificationMenu />\n            <SettingsMenu />\n          </div>\n          <Button size='icon' aria-label='Create item'>\n            <PlusIcon />\n          </Button>\n        </div>\n      </div>\n    </header>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/navbar/navbar-16.tsx"
    },
    {
      "path": "registry/ndeko/components/navbar/_parts/info-menu.tsx",
      "content": "import { Menu } from '@base-ui/react/menu';\n\nimport {\n  BookIcon,\n  InfoIcon,\n  LifeBuoyIcon,\n  MessageCircleMoreIcon,\n} from '@/registry/ndeko/lib/icons';\nimport { MENU_ITEM } from '@/registry/ndeko/lib/recipes';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuGroup,\n  DropdownMenuGroupLabel,\n  DropdownMenuTrigger,\n} from '@/registry/ndeko/ui/dropdown-menu';\n\nfunction InfoMenu() {\n  return (\n    <DropdownMenu>\n      <DropdownMenuTrigger\n        render={\n          <Button\n            variant='ghost'\n            size='icon'\n            aria-label='Open help menu'\n            className='text-muted-foreground'\n          />\n        }\n      >\n        <InfoIcon />\n      </DropdownMenuTrigger>\n      <DropdownMenuContent align='end'>\n        <DropdownMenuGroup>\n          <DropdownMenuGroupLabel>Need help?</DropdownMenuGroupLabel>\n          <Menu.LinkItem href='#' closeOnClick className={MENU_ITEM}>\n            <BookIcon />\n            Documentation\n          </Menu.LinkItem>\n          <Menu.LinkItem href='#' closeOnClick className={MENU_ITEM}>\n            <LifeBuoyIcon />\n            Support\n          </Menu.LinkItem>\n          <Menu.LinkItem href='#' closeOnClick className={MENU_ITEM}>\n            <MessageCircleMoreIcon />\n            Contact us\n          </Menu.LinkItem>\n        </DropdownMenuGroup>\n      </DropdownMenuContent>\n    </DropdownMenu>\n  );\n}\n\nexport { InfoMenu };\n",
      "type": "registry:component",
      "target": "components/navbar/_parts/info-menu.tsx"
    },
    {
      "path": "registry/ndeko/components/navbar/_parts/notification-menu.tsx",
      "content": "'use client';\n\nimport {\n  AnimatePresence,\n  motion,\n  type Transition,\n  type Variants,\n} from 'motion/react';\nimport { useState } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { BellIcon } from '@/registry/ndeko/lib/icons';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport {\n  Popover,\n  PopoverContent,\n  PopoverTitle,\n  PopoverTrigger,\n} from '@/registry/ndeko/ui/popover';\n\ntype Notification = {\n  id: number;\n  user: string;\n  action: string;\n  target: string;\n  timestamp: string;\n  isUnread: boolean;\n};\n\nconst INITIAL_NOTIFICATIONS: Notification[] = [\n  {\n    id: 1,\n    user: 'Chris Tompson',\n    action: 'requested review on',\n    target: 'PR #42: Feature implementation',\n    timestamp: '15 minutes ago',\n    isUnread: true,\n  },\n  {\n    id: 2,\n    user: 'Emma Davis',\n    action: 'shared',\n    target: 'New component library',\n    timestamp: '45 minutes ago',\n    isUnread: true,\n  },\n  {\n    id: 3,\n    user: 'James Wilson',\n    action: 'assigned you to',\n    target: 'API integration task',\n    timestamp: '4 hours ago',\n    isUnread: false,\n  },\n  {\n    id: 4,\n    user: 'Alex Morgan',\n    action: 'replied to your comment in',\n    target: 'Authentication flow',\n    timestamp: '12 hours ago',\n    isUnread: false,\n  },\n  {\n    id: 5,\n    user: 'Sarah Chen',\n    action: 'commented on',\n    target: 'Dashboard redesign',\n    timestamp: '2 days ago',\n    isUnread: false,\n  },\n  {\n    id: 6,\n    user: 'Noah Patel',\n    action: 'mentioned you in',\n    target: 'Launch page open graph image',\n    timestamp: '2 weeks ago',\n    isUnread: false,\n  },\n];\n\nconst SWAP_TRANSITION: Transition = { duration: 0.15, ease: [0.2, 0, 0, 1] };\nconst EXIT_TRANSITION: Transition = { duration: 0.1, ease: [0.2, 0, 0, 1] };\n\nconst POP_VARIANTS: Variants = {\n  enter: { opacity: 0, scale: 0.6, filter: 'blur(2px)' },\n  visible: { opacity: 1, scale: 1, filter: 'blur(0px)' },\n  exit: {\n    opacity: 0,\n    scale: 0.6,\n    filter: 'blur(2px)',\n    transition: EXIT_TRANSITION,\n  },\n};\n\nconst FADE_VARIANTS: Variants = {\n  enter: { opacity: 0 },\n  visible: { opacity: 1 },\n  exit: { opacity: 0, transition: EXIT_TRANSITION },\n};\n\nfunction popVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_VARIANTS;\n  }\n  return POP_VARIANTS;\n}\n\nfunction notificationsLabelOf(unreadCount: number) {\n  if (unreadCount === 0) {\n    return 'Open notifications';\n  }\n  if (unreadCount === 1) {\n    return 'Open notifications, 1 unread';\n  }\n  return `Open notifications, ${unreadCount} unread`;\n}\n\nfunction markAsRead(notification: Notification) {\n  return { ...notification, isUnread: false };\n}\n\nfunction NotificationMenu() {\n  const [notifications, setNotifications] = useState(INITIAL_NOTIFICATIONS);\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const popVariants = popVariantsOf(shouldReduceMotion);\n  const unreadCount = notifications.filter(\n    (notification) => notification.isUnread\n  ).length;\n  const hasUnread = unreadCount > 0;\n\n  function markAllAsRead() {\n    setNotifications((current) => current.map(markAsRead));\n  }\n\n  function markOneAsRead(id: number) {\n    setNotifications((current) =>\n      current.map((notification) => {\n        if (notification.id !== id) {\n          return notification;\n        }\n        return markAsRead(notification);\n      })\n    );\n  }\n\n  return (\n    <Popover>\n      <PopoverTrigger\n        render={\n          <Button\n            variant='ghost'\n            size='icon'\n            aria-label={notificationsLabelOf(unreadCount)}\n            className='text-muted-foreground'\n          />\n        }\n      >\n        <BellIcon />\n        <AnimatePresence initial={false}>\n          {hasUnread && (\n            <motion.span\n              key='unread-dot'\n              aria-hidden='true'\n              className='bg-primary absolute top-1.5 right-1.5 size-1.5 rounded-full'\n              variants={popVariants}\n              initial='enter'\n              animate='visible'\n              exit='exit'\n              transition={SWAP_TRANSITION}\n            />\n          )}\n        </AnimatePresence>\n      </PopoverTrigger>\n      <PopoverContent align='end' className='w-80 p-1'>\n        <div className='flex items-baseline justify-between gap-4 px-3 py-2'>\n          <PopoverTitle>Notifications</PopoverTitle>\n          <Button\n            variant='link'\n            size='sm'\n            onClick={markAllAsRead}\n            disabled={!hasUnread}\n            focusableWhenDisabled\n            className='h-auto p-0 text-xs'\n          >\n            Mark all as read\n          </Button>\n        </div>\n        <ul className='flex flex-col'>\n          {notifications.map((notification) => (\n            <li\n              key={notification.id}\n              className='has-focus-visible:bg-foreground/5 hover:bg-foreground/5 relative flex items-start gap-3 rounded-md px-3 py-2 transition-colors duration-150'\n            >\n              <div className='flex min-w-0 flex-1 flex-col gap-1'>\n                <button\n                  type='button'\n                  onClick={() => markOneAsRead(notification.id)}\n                  className='text-muted-foreground text-left outline-none after:absolute after:inset-0'\n                >\n                  <span className='text-foreground font-medium'>\n                    {notification.user}\n                  </span>{' '}\n                  {notification.action}{' '}\n                  <span className='text-foreground font-medium'>\n                    {notification.target}\n                  </span>\n                  .\n                </button>\n                <span className='text-muted-foreground text-xs'>\n                  {notification.timestamp}\n                </span>\n              </div>\n              <span className='flex size-1.5 shrink-0 self-center'>\n                <AnimatePresence initial={false}>\n                  {notification.isUnread && (\n                    <motion.span\n                      key='unread'\n                      className='bg-primary size-1.5 rounded-full'\n                      variants={popVariants}\n                      initial='enter'\n                      animate='visible'\n                      exit='exit'\n                      transition={SWAP_TRANSITION}\n                    >\n                      <span className='sr-only'>Unread</span>\n                    </motion.span>\n                  )}\n                </AnimatePresence>\n              </span>\n            </li>\n          ))}\n        </ul>\n      </PopoverContent>\n    </Popover>\n  );\n}\n\nexport { NotificationMenu };\n",
      "type": "registry:component",
      "target": "components/navbar/_parts/notification-menu.tsx"
    },
    {
      "path": "registry/ndeko/components/navbar/_parts/search-field.tsx",
      "content": "import { SearchIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Input, type InputProps } from '@/registry/ndeko/ui/input';\n\ntype SearchFieldProps = Omit<InputProps, 'type'> & {\n  end?: React.ReactNode;\n  containerClassName?: string;\n};\n\nfunction SearchField({\n  end,\n  className,\n  containerClassName,\n  ...props\n}: SearchFieldProps) {\n  const hasEnd = end !== undefined;\n\n  return (\n    <div className={cn('relative', containerClassName)}>\n      <Input\n        type='search'\n        placeholder='Search…'\n        aria-label='Search'\n        className={cn('peer ps-8', hasEnd && 'pe-10', className)}\n        {...props}\n      />\n      <span\n        aria-hidden='true'\n        className='text-muted-foreground/80 pointer-events-none absolute inset-y-0 start-0 flex items-center ps-2.5 peer-disabled:opacity-50'\n      >\n        <SearchIcon className='size-4' />\n      </span>\n      {hasEnd && (\n        <span className='absolute inset-y-0 end-0 flex items-center pe-1.5'>\n          {end}\n        </span>\n      )}\n    </div>\n  );\n}\n\nexport { SearchField };\n",
      "type": "registry:component",
      "target": "components/navbar/_parts/search-field.tsx"
    },
    {
      "path": "registry/ndeko/components/navbar/_parts/settings-menu.tsx",
      "content": "import { SettingsIcon } from '@/registry/ndeko/lib/icons';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuTrigger,\n} from '@/registry/ndeko/ui/dropdown-menu';\n\nfunction SettingsMenu() {\n  return (\n    <DropdownMenu>\n      <DropdownMenuTrigger\n        render={\n          <Button\n            variant='ghost'\n            size='icon'\n            aria-label='Open settings menu'\n            className='text-muted-foreground'\n          />\n        }\n      >\n        <SettingsIcon />\n      </DropdownMenuTrigger>\n      <DropdownMenuContent align='end' className='max-w-64'>\n        <DropdownMenuItem>Appearance</DropdownMenuItem>\n        <DropdownMenuItem>Preferences</DropdownMenuItem>\n        <DropdownMenuItem>API settings</DropdownMenuItem>\n      </DropdownMenuContent>\n    </DropdownMenu>\n  );\n}\n\nexport { SettingsMenu };\n",
      "type": "registry:component",
      "target": "components/navbar/_parts/settings-menu.tsx"
    }
  ],
  "categories": [
    "components",
    "navbar"
  ],
  "type": "registry:component"
}