{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "The order summary card of the cart page and the checkout: the lines in short (optional), a promo code field with ready codes, the free-delivery progress, the totals, the button and a note. Static markup.",
  "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 * The order summary card of the cart page and the checkout: the lines in short (optional), a promo code field\n * with ready codes, the free-delivery progress, the totals, the button and a note. Static markup.\n */\nimport { For, type JSX } from \"solid-js\";\nimport { Badge, Button, Group, Inline, Input, List, ListItem, Progress, Stack, Text, Title } from \"../compose\";\nimport { MediaFrame } from \"../components/media-frame\";\nimport { cn, fmtMoney, tpl } from \"../utils\";\nimport type { Promo, CartSummaryLabels } from \"./cart-summary-card.types\";\nimport type { CartLine } from \"../blocks/cart-list.types\";\nimport type { SummaryRow } from \"../blocks/order-summary.types\";\n\nexport type CartSummaryCardProps = {\n  lines: CartLine[];\n  rows: SummaryRow[];\n  promos: Promo[];\n  labels: CartSummaryLabels;\n  items?: \"show\" | \"hide\";\n  promo?: \"show\" | \"hide\";\n  field?: string;\n  progress?: \"show\" | \"hide\";\n  value?: number;\n};\n\nexport function CartSummaryCard({\n  lines,\n  rows,\n  promos,\n  labels,\n  items = \"hide\",\n  promo = \"show\",\n  field = \"promo\",\n  progress = \"show\",\n  value = 70,\n}: CartSummaryCardProps) {\n  return (\n    <Stack gap=\"6\" align=\"stretch\" class=\"rounded bg-card inset-ring inset-ring-border p-6\" data-slot=\"summary\">\n      <Group gap=\"4\" align=\"baseline\" justify=\"between\">\n        <Title as={2} size=\"lg\" weight=\"semibold\">\n          {labels.title}\n        </Title>\n        <Text size=\"xs\" class=\"text-muted-foreground\">\n          {tpl(labels.items, ((lines?.length ?? 0) == null ? undefined : String((lines?.length ?? 0))))}\n        </Text>\n      </Group>\n      {(((items as string) === \"show\") && ((lines?.length ?? 0) > 0)) ? (\n        <List tag=\"ul\" class=\"flex flex-col gap-4\" data-slot=\"summary-lines\">\n          <For each={lines ?? []}>{(line) => (\n            <ListItem class=\"flex items-center gap-4 text-sm\" data-slot=\"cart-line\">\n              <MediaFrame alt={line.name} src={line.image} ratio=\"1/1\" class=\"size-12 shrink-0\" />\n              <Stack gap=\"0\" class=\"flex-1\">\n                <Text size=\"sm\" weight=\"semibold\">\n                  {line.name}\n                </Text>\n                <Text size=\"xs\" class=\"text-muted-foreground\">\n                  {tpl(\"{0} x {1}\", line.qty, fmtMoney(line.price, line.currency))}\n                </Text>\n              </Stack>\n              <Inline class=\"font-medium\">\n                {fmtMoney((line.price * line.qty), line.currency)}\n              </Inline>\n            </ListItem>\n          )}</For>\n        </List>\n      ) : null}\n      {((promo as string) === \"show\") ? (\n        <Stack gap=\"2\" align=\"stretch\" data-slot=\"promo\">\n          <Group gap=\"2\" align=\"center\">\n            <Input type=\"text\" name={field} aria-label={labels.promo} placeholder={labels.promo} class=\"min-w-0 flex-1\" />\n            <Button variant=\"outline\" size=\"default\" type=\"button\">\n              {labels.apply}\n            </Button>\n          </Group>\n          {((promos?.length ?? 0) > 0) ? (\n            <Group gap=\"2\" align=\"center\" class=\"flex-wrap\">\n              <Text size=\"xs\" class=\"text-muted-foreground\">\n                {labels.codes}\n              </Text>\n              <For each={promos ?? []}>{(c) => (\n                <Badge variant=\"outline\" size=\"sm\">\n                  {c.code}\n                </Badge>\n              )}</For>\n            </Group>\n          ) : null}\n        </Stack>\n      ) : null}\n      {((progress as string) === \"show\") ? (\n        <Stack gap=\"2\" align=\"stretch\" class=\"rounded bg-muted p-4\" data-slot=\"progress\">\n          <Text size=\"sm\">\n            {labels.progress}\n          </Text>\n          <Progress value={(value == null ? undefined : String(value))} max=\"100\" aria-label={labels.progress} />\n        </Stack>\n      ) : null}\n      {((rows?.length ?? 0) > 0) ? (\n        <List tag=\"ul\" class=\"flex flex-col gap-2\">\n          <For each={rows ?? []}>{(row) => (\n            <ListItem\n              class={cn(\n                \"flex items-center justify-between gap-4\",\n                (\n                  row.strong ? \"border-t border-border pt-4 text-base font-bold\"\n                  : \"text-sm text-muted-foreground\"\n                )\n              )}\n              data-slot=\"row\"\n            >\n              <Inline>\n                {row.label}\n              </Inline>\n              <Inline>\n                {fmtMoney(row.amount, row.currency)}\n              </Inline>\n            </ListItem>\n          )}</For>\n        </List>\n      ) : null}\n      <Button variant=\"default\" size=\"lg\" class=\"w-full\">\n        {labels.checkout}\n      </Button>\n      <Text size=\"xs\" class=\"text-muted-foreground\">\n        {labels.note}\n      </Text>\n    </Stack>\n  );\n}\n",
      "path": "components/cart-summary-card.tsx",
      "target": "components/cart-summary-card.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 Promo = {\n  id: string;\n  code: string;\n};\n\nexport type CartSummaryLabels = {\n  title: string;\n  items: string;\n  promo: string;\n  apply: string;\n  codes: string;\n  progress: string;\n  checkout: string;\n  note: string;\n};\n",
      "path": "components/cart-summary-card.types.ts",
      "target": "components/cart-summary-card.types.ts"
    }
  ],
  "meta": {
    "category": "components",
    "kind": "component",
    "tags": [
      "solid",
      "component"
    ]
  },
  "name": "cart-summary-card",
  "registryDependencies": [
    "cart-list",
    "compose",
    "media-frame",
    "order-summary",
    "utils"
  ],
  "runtime": "solid",
  "title": "Cart Summary Card",
  "type": "registry:component"
}
