{
  "$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 */\nimport { For, type JSX } from \"solid-js\";\nimport { Box, Disclosure, Grid, Stack, Summary, Text } from \"../compose\";\nimport { EmptyState } from \"../components/empty-state\";\nimport { SearchField } from \"../components/search-field\";\nimport { SectionFrame } from \"../components/section-frame\";\nimport { Switcher } from \"../components/switcher\";\nimport { SwitcherItem } from \"../components/switcher-item\";\nimport { tpl } from \"../utils\";\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  onQuery?: (text: string) => void;\n  onCategory?: (value: string) => void;\n};\n\nexport function FaqList({\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) {\n  const inCategory = items.filter((i) => !filter?.category || i[\"category\"] === filter?.category);\n  const shown = inCategory.filter((i) => !search?.query || String(i[\"question\"]).toLowerCase().includes(String(search?.query).toLowerCase()));\n  return (\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      {(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      ) : null}\n      {(filter?.mode === \"categories\") ? (\n        <Switcher label={filter?.label}>\n          <For each={filter?.tabs ?? []}>{(tab) => (\n            <SwitcherItem active={(tab.value === filter?.category)} onClick={() => onCategory?.(tab.value)}>\n              {tab.title}\n            </SwitcherItem>\n          )}</For>\n        </Switcher>\n      ) : null}\n      {((shown?.length ?? 0) === 0) ? (\n        <EmptyState icon=\"circle-question-mark\" title={empty} />\n      ) : null}\n      {((layout as string) === \"chat\") ? (\n        <Stack gap=\"4\" align=\"stretch\" data-slot=\"faq\">\n          <For each={shown ?? []}>{(item) => (\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          )}</For>\n        </Stack>\n      ) : (\n        <Grid cols={(((cols as string) === \"2\") ? \"1-2\" : \"1\")} class=\"items-start gap-x-8\" data-slot=\"faq\">\n          <For each={shown ?? []}>{(item) => (\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          )}</For>\n        </Grid>\n      )}\n    </SectionFrame>\n  );\n}\n",
      "path": "blocks/faq-list.tsx",
      "target": "blocks/faq-list.tsx"
    },
    {
      "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": [
      "solid",
      "block"
    ]
  },
  "name": "faq-list",
  "registryDependencies": [
    "compose",
    "empty-state",
    "search-field",
    "section-frame",
    "switcher",
    "switcher-item",
    "utils"
  ],
  "runtime": "solid",
  "title": "Faq List",
  "type": "registry:block"
}
