Home / File/ item-picker.tsx — ui Source File

item-picker.tsx — ui Source File

Architecture documentation for item-picker.tsx, a tsx file in the ui codebase. 9 imports, 0 dependents.

File tsx DesignEngine PreviewSystem 9 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  4c6a85bd_ede3_a357_edb5_0823fadf5bba["item-picker.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  4c6a85bd_ede3_a357_edb5_0823fadf5bba --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  79511111_e2db_7710_6e07_29cc266a5518["script"]
  4c6a85bd_ede3_a357_edb5_0823fadf5bba --> 79511111_e2db_7710_6e07_29cc266a5518
  81821566_3643_c91a_1397_57950c94b526["core-free-icons"]
  4c6a85bd_ede3_a357_edb5_0823fadf5bba --> 81821566_3643_c91a_1397_57950c94b526
  614a3ef5_2f09_8b4c_c7b8_666db5a9ce32["react"]
  4c6a85bd_ede3_a357_edb5_0823fadf5bba --> 614a3ef5_2f09_8b4c_c7b8_666db5a9ce32
  ceec689a_1334_a657_3c35_094070222b09["schema"]
  4c6a85bd_ede3_a357_edb5_0823fadf5bba --> ceec689a_1334_a657_3c35_094070222b09
  57e86e45_ac6e_7278_be08_9092724e8401["button"]
  4c6a85bd_ede3_a357_edb5_0823fadf5bba --> 57e86e45_ac6e_7278_be08_9092724e8401
  6d1cf5d7_7c9c_773c_b933_f0caf9552951["combobox"]
  4c6a85bd_ede3_a357_edb5_0823fadf5bba --> 6d1cf5d7_7c9c_773c_b933_f0caf9552951
  c27c6e95_5daf_4dd4_dc3a_add496837570["search-params"]
  4c6a85bd_ede3_a357_edb5_0823fadf5bba --> c27c6e95_5daf_4dd4_dc3a_add496837570
  6156f09f_aa48_556c_0ab3_48876ebebd75["utils"]
  4c6a85bd_ede3_a357_edb5_0823fadf5bba --> 6156f09f_aa48_556c_0ab3_48876ebebd75
  style 4c6a85bd_ede3_a357_edb5_0823fadf5bba fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"
import Script from "next/script"
import { Search01Icon } from "@hugeicons/core-free-icons"
import { HugeiconsIcon } from "@hugeicons/react"
import { type RegistryItem } from "shadcn/schema"

import { Button } from "@/registry/new-york-v4/ui/button"
import {
  Combobox,
  ComboboxCollection,
  ComboboxContent,
  ComboboxEmpty,
  ComboboxGroup,
  ComboboxInput,
  ComboboxItem,
  ComboboxLabel,
  ComboboxList,
  ComboboxTrigger,
  ComboboxValue,
} from "@/registry/new-york-v4/ui/combobox"
import { useDesignSystemSearchParams } from "@/app/(create)/lib/search-params"
import { groupItemsByType } from "@/app/(create)/lib/utils"

export const CMD_K_FORWARD_TYPE = "cmd-k-forward"

const cachedGroupedItems = React.cache(
  (items: Pick<RegistryItem, "name" | "title" | "type">[]) => {
    return groupItemsByType(items)
  }
)

export function ItemPicker({
  items,
}: {
  items: Pick<RegistryItem, "name" | "title" | "type">[]
}) {
  const [open, setOpen] = React.useState(false)
  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]
  )

  React.useEffect(() => {
    const down = (e: KeyboardEvent) => {
      if ((e.key === "k" || e.key === "p") && (e.metaKey || e.ctrlKey)) {
        e.preventDefault()
        setOpen((open) => !open)
      }
    }

    document.addEventListener("keydown", down)
    return () => document.removeEventListener("keydown", down)
  }, [])

// ... (134 more lines)

Domain

Subdomains

Dependencies

  • button
  • combobox
  • core-free-icons
  • react
  • react
  • schema
  • script
  • search-params
  • utils

Frequently Asked Questions

What does item-picker.tsx do?
item-picker.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-picker.tsx?
item-picker.tsx defines 3 function(s): ItemPicker, ItemPickerScript, cachedGroupedItems.
What does item-picker.tsx depend on?
item-picker.tsx imports 9 module(s): button, combobox, core-free-icons, react, react, schema, script, search-params, and 1 more.
Where is item-picker.tsx in the architecture?
item-picker.tsx is located at apps/v4/app/(create)/components/item-picker.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