{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "Nav Item component",
  "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-->\n<script lang=\"ts\" module>\n  import type { Snippet } from \"svelte\";\n  import { variants } from \"../utils\";\n\n  /** NavItem: the classes of each value (shadcn/cva style). */\n  export 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  /** NavItem: the classes of each value (shadcn/cva style). */\n  export 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\n  export 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?: Snippet;\n    icon?: Snippet;\n    right?: Snippet;\n    onclick?: () => void;\n  };\n</script>\n\n<script lang=\"ts\">\n  import Box from \"../compose/Box.svelte\";\n  import ButtonPlain from \"../compose/ButtonPlain.svelte\";\n  import LinkPlain from \"../compose/LinkPlain.svelte\";\n  import NavItemRow from \"../components/nav-item-row.svelte\";\n  import { cn, urlOf } from \"../utils\";\n\n  let {\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 = $props();\n  const state = $derived(selected ? \"selected\" : \"default\");\n  const outer = $derived(\n    cn(\n      navItemVariants({ level: level, state: state }),\n      \"group in-data-[nav=collapsed]:justify-center\",\n      className,\n    )\n  );\n  const inner = $derived(\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  );\n</script>\n\n{#if 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{:else if 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{:else}\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{/if}\n",
      "path": "components/nav-item.svelte",
      "target": "components/nav-item.svelte"
    }
  ],
  "meta": {
    "category": "components",
    "kind": "component",
    "tags": [
      "svelte",
      "component"
    ]
  },
  "name": "nav-item",
  "registryDependencies": [
    "box",
    "button-plain",
    "link-plain",
    "nav-item-row",
    "utils"
  ],
  "runtime": "svelte",
  "title": "Nav Item",
  "type": "registry:component"
}
