{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "A sidebar list item: icon, label and an optional right slot. With `href` it is a link, with `interactive` a button, otherwise a static box.",
  "devDependencies": [],
  "digest": "0.1.0",
  "files": [
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n/**\n * A sidebar list item: icon, label and an optional right slot. With `href` it is a link, with `interactive` a\n * button, otherwise a static box.\n */\nimport { type JSX } from \"solid-js\";\nimport { Box, ButtonPlain, LinkPlain } from \"../compose\";\nimport { NavItemRow } from \"../components/nav-item-row\";\nimport { cn, urlOf, variants } from \"../utils\";\n\n/** NavItem: the classes of each value (shadcn/cva style). */\nexport const navItemVariants = variants({\n  base: \"flex w-full items-center p-2 rounded\",\n  variants: {\n    level: {\n      \"1\": \"\",\n      \"2\": \"\",\n      \"3\": \"pr-2 pl-12\",\n      \"4\": \"pr-2 pl-20\",\n    },\n    state: {\n      default: \"\",\n      selected: \"\",\n    },\n  },\n  defaultVariants: { level: \"1\", state: \"default\" },\n});\n\n/** NavItem: the classes of each value (shadcn/cva style). */\nexport const navItemContentVariants = variants({\n  base:\n    \"flex h-8 min-w-0 flex-1 items-center justify-between px-4 py-2 text-xs font-bold text-muted-foreground \" +\n    \"inset-ring inset-ring-transparent rounded\",\n  variants: {\n    level: {\n      \"1\": \"\",\n      \"2\": \"\",\n      \"3\": \"px-2\",\n      \"4\": \"px-2\",\n    },\n    state: {\n      default: \"\",\n      selected: \"bg-background text-foreground inset-ring-border\",\n    },\n  },\n  defaultVariants: { level: \"1\", state: \"default\" },\n});\n\nexport type NavItemProps = {\n  selected?: boolean;\n  level?: \"1\" | \"2\" | \"3\" | \"4\";\n  href?: string;\n  interactive?: boolean;\n  reserveRight?: boolean;\n  contentClass?: string;\n  class?: string;\n  children?: JSX.Element;\n  icon?: JSX.Element;\n  right?: JSX.Element;\n  onClick?: () => void;\n};\n\nexport function NavItem({\n  selected = false,\n  level,\n  href,\n  interactive = false,\n  reserveRight = false,\n  contentClass,\n  class: className,\n  children,\n  icon,\n  right,\n  onClick,\n}: NavItemProps) {\n  const state = selected ? \"selected\" : \"default\";\n  const outer =\n    cn(\n      navItemVariants({ level: level, state: state }),\n      \"group in-data-[nav=collapsed]:justify-center\",\n      className,\n    );\n  const inner =\n    cn(\n      navItemContentVariants({ level: level, state: state }),\n      (!selected && \"group-hover:bg-muted\"),\n      \"in-data-[nav=collapsed]:w-10 in-data-[nav=collapsed]:flex-none in-data-[nav=collapsed]:justify-center in-data-[nav=collapsed]:px-0\",\n      contentClass,\n    );\n  return (\n    <>\n      {href ? (\n        <LinkPlain\n          href={urlOf(href)}\n          class={outer}\n          aria-current={(selected ? \"page\" : undefined)}\n          data-slot=\"nav-item\"\n          data-state={state}\n          onClick={() => onClick?.()}\n        >\n          <NavItemRow inner={inner} reserveRight={reserveRight} icon={icon} right={right} children={children} />\n        </LinkPlain>\n      ) : interactive ? (\n        <ButtonPlain\n          type=\"button\"\n          class={cn(outer, \"text-left\")}\n          aria-current={(selected ? \"page\" : undefined)}\n          data-slot=\"nav-item\"\n          data-state={state}\n          onClick={() => onClick?.()}\n        >\n          <NavItemRow inner={inner} reserveRight={reserveRight} icon={icon} right={right} children={children} />\n        </ButtonPlain>\n      ) : (\n        <Box class={outer} aria-current={(selected ? \"page\" : undefined)} data-slot=\"nav-item\" data-state={state}>\n          <NavItemRow inner={inner} reserveRight={reserveRight} icon={icon} right={right} children={children} />\n        </Box>\n      )}\n    </>\n  );\n}\n",
      "path": "components/nav-item.tsx",
      "target": "components/nav-item.tsx"
    }
  ],
  "meta": {
    "category": "components",
    "kind": "component",
    "tags": [
      "solid",
      "component"
    ]
  },
  "name": "nav-item",
  "registryDependencies": [
    "compose",
    "nav-item-row",
    "utils"
  ],
  "runtime": "solid",
  "title": "Nav Item",
  "type": "registry:component"
}
