{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "Questions as native disclosures.",
  "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 Faq = {\n  id: string;\n  question: string;\n  answer: string;\n  category?: string;\n};\n\nexport type FaqTab = {\n  id: string;\n  title: string;\n  value: string;\n};\n\nexport type FaqSearch = {\n  /** field: a search field above the questions */\n  mode?: \"none\" | \"field\";\n  /** accessible name and placeholder of the search field */\n  label?: string;\n  /** the text the questions are filtered by */\n  query?: string;\n};\n\nexport type FaqFilter = {\n  /** categories: tabs above the questions */\n  mode?: \"none\" | \"categories\";\n  /** the category tabs */\n  tabs?: FaqTab[];\n  /** accessible name of the tabs */\n  label?: string;\n  /** the value of the chosen tab */\n  category?: string;\n};\n",
      "path": "blocks/faq-list.types.ts",
      "target": "blocks/faq-list.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  A section with a heading and the questions. Axes: layout (accordion: native disclosures that open without\n  script; chat: question and answer as alternating bubbles), columns (1, 2), search mode (none, field: a search\n  field above; the page filters by `search.query`), filter mode (none, categories: tabs above; the page filters\n  by `filter.category`), density, tone.\n-->\n<script lang=\"ts\">\nimport type { Faq, FaqTab, FaqSearch, FaqFilter } from \"./faq-list.types\";\n\nexport type FaqListProps = {\n  id: string;\n  title: string;\n  items: Faq[];\n  search?: FaqSearch;\n  filter?: FaqFilter;\n  layout?: \"accordion\" | \"chat\";\n  cols?: \"1\" | \"2\";\n  empty?: string;\n  multiple?: boolean;\n  tone?: \"default\" | \"muted\";\n  density?: \"roomy\" | \"default\" | \"compact\";\n  landmarkLabel?: string;\n};\n</script>\n\n<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport Box from \"../compose/Box.vue\";\nimport Disclosure from \"../compose/Disclosure.vue\";\nimport Grid from \"../compose/Grid.vue\";\nimport Stack from \"../compose/Stack.vue\";\nimport Summary from \"../compose/Summary.vue\";\nimport Text from \"../compose/Text.vue\";\nimport EmptyState from \"../components/empty-state.vue\";\nimport SearchField from \"../components/search-field.vue\";\nimport SectionFrame from \"../components/section-frame.vue\";\nimport Switcher from \"../components/switcher.vue\";\nimport SwitcherItem from \"../components/switcher-item.vue\";\nimport { tpl } from \"../utils\";\n\nconst {\n  id,\n  title,\n  items,\n  search,\n  filter,\n  layout = \"accordion\",\n  cols = \"1\",\n  empty = \"\",\n  multiple = false,\n  tone = \"default\",\n  density = \"default\",\n  landmarkLabel,\n} = defineProps<FaqListProps>();\nconst emit = defineEmits<{ query: [text: string], category: [value: string] }>();\nconst inCategory = computed(() => items.filter((i) => !filter?.category || i[\"category\"] === filter?.category));\nconst shown = computed(() =>\n  inCategory.value.filter((i) => !search?.query || String(i[\"question\"]).toLowerCase().includes(String(search?.query).toLowerCase()))\n);\n</script>\n\n<template>\n  <SectionFrame\n    :id=\"id\"\n    :title=\"title\"\n    :tone=\"tone\"\n    :density=\"density\"\n    :measure=\"(((layout as string) === 'chat') ? '2xl' : 'default')\"\n    :landmarkLabel=\"landmarkLabel\"\n  >\n    <SearchField v-if=\"(search?.mode === 'field')\"\n      :label=\"(search?.label ?? '')\"\n      :placeholder=\"search?.label\"\n      :value=\"(search?.query ?? '')\"\n      @value=\"(arg: string) => emit('query', arg)\"\n    />\n    <Switcher v-if=\"(filter?.mode === 'categories')\" :label=\"filter?.label\">\n      <SwitcherItem\n        v-for=\"tab in filter?.tabs\"\n        :key=\"tab.id\"\n        :active=\"(tab.value === filter?.category)\"\n        @click=\"() => emit('category', tab.value)\"\n      >\n        {{ tab.title }}\n      </SwitcherItem>\n    </Switcher>\n    <EmptyState v-if=\"((shown?.length ?? 0) === 0)\" icon=\"circle-question-mark\" :title=\"empty\" />\n    <Stack v-if=\"((layout as string) === 'chat')\" gap=\"4\" align=\"stretch\" data-slot=\"faq\">\n      <Stack v-for=\"item in shown\" :key=\"item.id\" gap=\"2\" align=\"stretch\" data-slot=\"faq-item\">\n        <Box class=\"ml-auto max-w-xs sm:max-w-md rounded bg-primary px-4 py-4 text-primary-foreground\">\n          <Text size=\"sm\" weight=\"semibold\">\n            {{ item.question }}\n          </Text>\n        </Box>\n        <Box class=\"mr-auto max-w-xs sm:max-w-md rounded bg-muted px-4 py-4\">\n          <Text size=\"sm\">\n            {{ item.answer }}\n          </Text>\n        </Box>\n      </Stack>\n    </Stack>\n    <Grid v-else :cols=\"(((cols as string) === '2') ? '1-2' : '1')\" class=\"items-start gap-x-8\" data-slot=\"faq\">\n      <Disclosure\n        v-for=\"item in shown\"\n        :key=\"item.id\"\n        variant=\"item\"\n        :name=\"(multiple ? undefined : tpl('{0}-faq', (id ?? 'faq')))\"\n        data-slot=\"faq-item\"\n      >\n        <Summary variant=\"item\">\n          {{ item.question }}\n        </Summary>\n        <Text size=\"sm\" class=\"pb-4 text-muted-foreground\">\n          {{ item.answer }}\n        </Text>\n      </Disclosure>\n    </Grid>\n  </SectionFrame>\n</template>\n",
      "path": "blocks/faq-list.vue",
      "target": "blocks/faq-list.vue"
    }
  ],
  "meta": {
    "category": "marketing",
    "group": "faq",
    "kind": "block",
    "tags": [
      "vue",
      "block"
    ]
  },
  "name": "faq-list",
  "registryDependencies": [
    "box",
    "disclosure",
    "empty-state",
    "grid",
    "search-field",
    "section-frame",
    "stack",
    "summary",
    "switcher",
    "switcher-item",
    "text",
    "utils"
  ],
  "runtime": "vue",
  "title": "Faq List",
  "type": "registry:block"
}
