{
  "$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<!--\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\" module>\n  import type { Snippet } from \"svelte\";\n  import type { Faq, FaqTab, FaqSearch, FaqFilter } from \"./faq-list.types\";\n\n  export 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    onquery?: (text: string) => void;\n    oncategory?: (value: string) => void;\n  };\n</script>\n\n<script lang=\"ts\">\n  import Box from \"../compose/Box.svelte\";\n  import Disclosure from \"../compose/Disclosure.svelte\";\n  import Grid from \"../compose/Grid.svelte\";\n  import Stack from \"../compose/Stack.svelte\";\n  import Summary from \"../compose/Summary.svelte\";\n  import Text from \"../compose/Text.svelte\";\n  import EmptyState from \"../components/empty-state.svelte\";\n  import SearchField from \"../components/search-field.svelte\";\n  import SectionFrame from \"../components/section-frame.svelte\";\n  import Switcher from \"../components/switcher.svelte\";\n  import SwitcherItem from \"../components/switcher-item.svelte\";\n  import { tpl } from \"../utils\";\n\n  let {\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    onquery,\n    oncategory,\n  }: FaqListProps = $props();\n  const inCategory = $derived(items.filter((i) => !filter?.category || i[\"category\"] === filter?.category));\n  const shown = $derived(inCategory.filter((i) => !search?.query || String(i[\"question\"]).toLowerCase().includes(String(search?.query).toLowerCase())));\n</script>\n\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  {#if (search?.mode === \"field\")}\n    <SearchField\n      label={(search?.label ?? \"\")}\n      placeholder={search?.label}\n      value={(search?.query ?? \"\")}\n      onvalue={(arg: string) => onquery?.(arg)}\n    />\n  {/if}\n  {#if (filter?.mode === \"categories\")}\n    <Switcher label={filter?.label}>\n      {#each filter?.tabs as tab (tab.id)}\n        <SwitcherItem active={(tab.value === filter?.category)} onclick={() => oncategory?.(tab.value)}>\n          {tab.title}\n        </SwitcherItem>\n      {/each}\n    </Switcher>\n  {/if}\n  {#if ((shown?.length ?? 0) === 0)}\n    <EmptyState icon=\"circle-question-mark\" title={empty} />\n  {/if}\n  {#if ((layout as string) === \"chat\")}\n    <Stack gap=\"4\" align=\"stretch\" data-slot=\"faq\">\n      {#each shown as item (item.id)}\n        <Stack 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      {/each}\n    </Stack>\n  {:else}\n    <Grid cols={(((cols as string) === \"2\") ? \"1-2\" : \"1\")} class=\"items-start gap-x-8\" data-slot=\"faq\">\n      {#each shown as item (item.id)}\n        <Disclosure variant=\"item\" name={(multiple ? undefined : tpl(\"{0}-faq\", (id ?? \"faq\")))} data-slot=\"faq-item\">\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      {/each}\n    </Grid>\n  {/if}\n</SectionFrame>\n",
      "path": "blocks/faq-list.svelte",
      "target": "blocks/faq-list.svelte"
    },
    {
      "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"
    }
  ],
  "meta": {
    "category": "marketing",
    "group": "faq",
    "kind": "block",
    "tags": [
      "svelte",
      "block"
    ]
  },
  "name": "faq-list",
  "registryDependencies": [
    "box",
    "disclosure",
    "empty-state",
    "grid",
    "search-field",
    "section-frame",
    "stack",
    "summary",
    "switcher",
    "switcher-item",
    "text",
    "utils"
  ],
  "runtime": "svelte",
  "title": "Faq List",
  "type": "registry:block"
}
