{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "Categories as chips, a bar, a side list, tiles, or chips under a toolbar.",
  "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\nexport type Category = {\n  id: string;\n  name: string;\n  icon: string;\n  count: number;\n  href?: string;\n};\n\nexport type CategoryTools = {\n  /** label of the search field */\n  search?: string;\n  /** label of the sort select */\n  sort?: string;\n  /** the chosen sort */\n  sortValue?: string;\n  /** how many products are shown */\n  shown?: string;\n  /** the text in the search field */\n  query?: string;\n};\n",
      "path": "blocks/category-nav.types.ts",
      "target": "blocks/category-nav.types.ts"
    },
    {
      "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  Navigation between product categories as chips, a bar with an underline, a side list, tiles with a big icon,\n  or chips under a toolbar (search, sort and the number shown). The current one carries aria-current. Axes:\n  layout (chips, bar, sidebar, tiles, toolbar), count (show, hide), icon (show, hide), density.\n-->\n<script lang=\"ts\">\nimport type { Category, CategoryTools } from \"./category-nav.types\";\n\nexport type CategoryNavProps = {\n  label: string;\n  categories: Category[];\n  current?: string;\n  layout?: \"chips\" | \"bar\" | \"sidebar\" | \"tiles\" | \"toolbar\";\n  count?: \"show\" | \"hide\";\n  icon?: \"show\" | \"hide\";\n  density?: \"default\" | \"compact\";\n  tools?: CategoryTools;\n  landmarkLabel?: string;\n};\n</script>\n\n<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport Block from \"../compose/Block.vue\";\nimport Container from \"../compose/Container.vue\";\nimport Group from \"../compose/Group.vue\";\nimport Inline from \"../compose/Inline.vue\";\nimport List from \"../compose/List.vue\";\nimport ListItem from \"../compose/ListItem.vue\";\nimport LucideIcon from \"../icons/LucideIcon.vue\";\nimport Select from \"../compose/Select.vue\";\nimport SelectOption from \"../compose/SelectOption.vue\";\nimport Text from \"../compose/Text.vue\";\nimport MenuEntry from \"../components/menu-entry.vue\";\nimport SearchField from \"../components/search-field.vue\";\nimport { cn } from \"../utils\";\n\nconst {\n  label,\n  categories,\n  current = \"all\",\n  layout = \"chips\",\n  count = \"show\",\n  icon = \"show\",\n  density = \"default\",\n  tools,\n  landmarkLabel,\n} = defineProps<CategoryNavProps>();\nconst chipLike = computed(() => ((layout as string) === \"chips\") || ((layout as string) === \"toolbar\"));\nconst tiles = computed(() => (layout as string) === \"tiles\");\nconst linkShape = computed(() =>\n  chipLike.value ? \"inline-flex h-8 items-center gap-2 rounded px-3 inset-ring inset-ring-border\"\n  : (layout as string) === \"bar\" ? \"inline-flex items-center gap-2 -mb-px border-b px-1 py-2\"\n  : tiles.value ? \"flex h-full flex-col items-start gap-4 rounded p-4 inset-ring inset-ring-border\"\n  : \"inline-flex w-full items-center gap-2 rounded px-3 py-2\"\n);\nconst currentLook = computed(() =>\n  chipLike.value ? \"bg-primary text-primary-foreground\"\n  : (layout as string) === \"bar\" ? \"border-foreground font-semibold\"\n  : tiles.value ? \"inset-ring-foreground font-semibold\"\n  : \"bg-muted font-semibold\"\n);\nconst otherLook = computed(() => ((layout as string) === \"bar\") ? \"border-transparent\" : \"\");\nconst listShape = computed(() =>\n  (layout as string) === \"sidebar\" ? \"flex flex-col gap-2\"\n  : (layout as string) === \"bar\" ? \"flex flex-wrap gap-2 gap-x-4 border-b border-border\"\n  : tiles.value ? \"grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-6\"\n  : \"flex flex-wrap gap-2\"\n);\n</script>\n\n<template>\n  <Block tag=\"nav\" :aria-label=\"(landmarkLabel ?? label)\" :data-layout=\"layout\" data-slot=\"category-nav\">\n    <Container\n      :class=\"cn('mx-auto w-full max-w-6xl px-4', (((density as string) === 'compact') ? 'py-2' : 'py-4'))\"\n      data-slot=\"container\"\n    >\n      <Group\n        v-if=\"((layout as string) === 'toolbar')\"\n        gap=\"4\"\n        align=\"center\"\n        class=\"mb-4 flex-wrap\"\n        data-slot=\"toolbar\"\n      >\n        <SearchField :value=\"(tools?.query ?? '')\" :label=\"(tools?.search ?? '')\" :placeholder=\"tools?.search\" />\n        <Select name=\"sort\" size=\"sm\" :aria-label=\"tools?.sort\" class=\"w-48\">\n          <SelectOption value=\"sort\" :label=\"tools?.sortValue\" :selected=\"true\" />\n        </Select>\n        <Text size=\"sm\" class=\"text-muted-foreground\">\n          {{ tools?.shown }}\n        </Text>\n      </Group>\n      <List v-if=\"((categories?.length ?? 0) > 0)\" tag=\"ul\" :class=\"listShape\" data-slot=\"items\">\n        <ListItem v-for=\"c in categories\" :key=\"c.id\" data-slot=\"categories-row\">\n          <MenuEntry\n            :href=\"c.href\"\n            :class=\"cn('text-sm', linkShape, ((c.id === current) ? currentLook : otherLook))\"\n            :current=\"(c.id === current)\"\n            testid=\"item\"\n            :block=\"true\"\n          >\n            <template v-if=\"((icon as string) === 'show')\">\n              <Inline v-if=\"tiles\" class=\"flex size-10 items-center justify-center rounded bg-muted\">\n                <LucideIcon :name=\"c.icon\" :size=\"20\" />\n              </Inline>\n              <LucideIcon v-else :name=\"c.icon\" :size=\"16\" />\n            </template>\n            <Inline>\n              {{ c.name }}\n            </Inline>\n            <Text v-if=\"((count as string) === 'show')\" size=\"xs\" class=\"text-muted-foreground\">\n              {{ (c.count == null ? undefined : String(c.count)) }}\n            </Text>\n          </MenuEntry>\n        </ListItem>\n      </List>\n    </Container>\n  </Block>\n</template>\n",
      "path": "blocks/category-nav.vue",
      "target": "blocks/category-nav.vue"
    }
  ],
  "meta": {
    "category": "commerce",
    "group": "catalog",
    "kind": "block",
    "tags": [
      "vue",
      "block"
    ]
  },
  "name": "category-nav",
  "registryDependencies": [
    "block",
    "container",
    "group",
    "inline",
    "list",
    "list-item",
    "lucide-icon",
    "menu-entry",
    "search-field",
    "select",
    "select-option",
    "text",
    "utils"
  ],
  "runtime": "vue",
  "title": "Category Nav",
  "type": "registry:block"
}
