item-explorer.tsx — ui Source File
Architecture documentation for item-explorer.tsx, a tsx file in the ui codebase. 10 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 93421982_5a44_a7db_7503_3ebc25cb0fcb["item-explorer.tsx"] 1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"] 93421982_5a44_a7db_7503_3ebc25cb0fcb --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2 ba3d44f3_7b34_f9cc_6283_44817785c0df["link"] 93421982_5a44_a7db_7503_3ebc25cb0fcb --> ba3d44f3_7b34_f9cc_6283_44817785c0df d39cd1e4_1b2d_9aa2_1d29_fd0b4bfb61c3["lucide-react"] 93421982_5a44_a7db_7503_3ebc25cb0fcb --> d39cd1e4_1b2d_9aa2_1d29_fd0b4bfb61c3 ceec689a_1334_a657_3c35_094070222b09["schema"] 93421982_5a44_a7db_7503_3ebc25cb0fcb --> ceec689a_1334_a657_3c35_094070222b09 79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"] 93421982_5a44_a7db_7503_3ebc25cb0fcb --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81 c544a3e1_3972_d827_a6cc_0c6a194dbe9e["bases"] 93421982_5a44_a7db_7503_3ebc25cb0fcb --> c544a3e1_3972_d827_a6cc_0c6a194dbe9e 72adfc27_1b6f_cf8f_62c6_bf495c5c0910["collapsible"] 93421982_5a44_a7db_7503_3ebc25cb0fcb --> 72adfc27_1b6f_cf8f_62c6_bf495c5c0910 12632a83_ef01_5f03_4110_ed33d49893b7["sidebar"] 93421982_5a44_a7db_7503_3ebc25cb0fcb --> 12632a83_ef01_5f03_4110_ed33d49893b7 c27c6e95_5daf_4dd4_dc3a_add496837570["search-params"] 93421982_5a44_a7db_7503_3ebc25cb0fcb --> c27c6e95_5daf_4dd4_dc3a_add496837570 6156f09f_aa48_556c_0ab3_48876ebebd75["utils"] 93421982_5a44_a7db_7503_3ebc25cb0fcb --> 6156f09f_aa48_556c_0ab3_48876ebebd75 style 93421982_5a44_a7db_7503_3ebc25cb0fcb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"use client"
import * as React from "react"
import Link from "next/link"
import { ChevronRightIcon } from "lucide-react"
import { type RegistryItem } from "shadcn/schema"
import { cn } from "@/lib/utils"
import { type Base } from "@/registry/bases"
import {
Collapsible,
CollapsibleContent,
CollapsibleTrigger,
} from "@/registry/new-york-v4/ui/collapsible"
import {
Sidebar,
SidebarContent,
SidebarGroup,
SidebarGroupContent,
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem,
} from "@/registry/new-york-v4/ui/sidebar"
import { useDesignSystemSearchParams } from "@/app/(create)/lib/search-params"
import { groupItemsByType } from "@/app/(create)/lib/utils"
const cachedGroupedItems = React.cache(
(items: Pick<RegistryItem, "name" | "title" | "type">[]) => {
return groupItemsByType(items)
}
)
export function ItemExplorer({
base,
items,
}: {
base: Base["name"]
items: Pick<RegistryItem, "name" | "title" | "type">[]
}) {
const [params, setParams] = useDesignSystemSearchParams()
const groupedItems = React.useMemo(() => cachedGroupedItems(items), [items])
const currentItem = React.useMemo(
() => items.find((item) => item.name === params.item) ?? null,
[items, params.item]
)
return (
<Sidebar
className="sticky z-30 hidden h-[calc(100svh-var(--header-height)-2rem)] overscroll-none bg-transparent xl:flex"
collapsible="none"
>
<SidebarContent className="no-scrollbar -mx-1 overflow-x-hidden">
{groupedItems.map((group) => (
<Collapsible
key={group.type}
defaultOpen
className="group/collapsible"
>
<SidebarGroup className="px-1 py-0">
<CollapsibleTrigger className="flex w-full items-center gap-1 py-1.5 text-[0.8rem] font-medium [&[data-state=open]>svg]:rotate-90">
<ChevronRightIcon className="text-muted-foreground size-3.5 transition-transform" />
<span>{group.title}</span>
</CollapsibleTrigger>
<CollapsibleContent>
<SidebarGroupContent>
<SidebarMenu className="border-border/50 relative ml-1.5 border-l pl-2">
{group.items.map((item, index) => (
<SidebarMenuItem key={item.name} className="relative">
<div
className={cn(
"border-border/50 absolute top-1/2 -left-2 h-px w-2 border-t",
index === group.items.length - 1 && "bg-sidebar"
)}
/>
{index === group.items.length - 1 && (
<div className="bg-sidebar absolute top-1/2 -bottom-1 -left-2.5 w-1" />
)}
<SidebarMenuButton
onClick={() => setParams({ item: item.name })}
className="data-[active=true]:bg-accent data-[active=true]:border-accent 3xl:fixed:w-full 3xl:fixed:max-w-48 relative h-[26px] w-fit cursor-pointer overflow-visible border border-transparent text-[0.8rem] font-normal after:absolute after:inset-x-0 after:-inset-y-1 after:z-0 after:rounded-md"
data-active={item.name === currentItem?.name}
isActive={item.name === currentItem?.name}
>
{item.title}
<span className="absolute inset-0 flex w-(--sidebar-width) bg-transparent" />
</SidebarMenuButton>
<Link
href={`/preview/${base}/${item.name}`}
prefetch
className="sr-only"
tabIndex={-1}
>
{item.title}
</Link>
</SidebarMenuItem>
))}
</SidebarMenu>
</SidebarGroupContent>
</CollapsibleContent>
</SidebarGroup>
</Collapsible>
))}
</SidebarContent>
</Sidebar>
)
}
Domain
Subdomains
Functions
Dependencies
- bases
- collapsible
- link
- lucide-react
- react
- schema
- search-params
- sidebar
- utils
- utils
Source
Frequently Asked Questions
What does item-explorer.tsx do?
item-explorer.tsx is a source file in the ui codebase, written in tsx. It belongs to the DesignEngine domain, PreviewSystem subdomain.
What functions are defined in item-explorer.tsx?
item-explorer.tsx defines 2 function(s): ItemExplorer, cachedGroupedItems.
What does item-explorer.tsx depend on?
item-explorer.tsx imports 10 module(s): bases, collapsible, link, lucide-react, react, schema, search-params, sidebar, and 2 more.
Where is item-explorer.tsx in the architecture?
item-explorer.tsx is located at apps/v4/app/(create)/components/item-explorer.tsx (domain: DesignEngine, subdomain: PreviewSystem, directory: apps/v4/app/(create)/components).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free