{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "Cart Summary Card component",
  "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-->\n<script lang=\"ts\" module>\n  import type { Snippet } from \"svelte\";\n  import type { Promo, CartSummaryLabels } from \"./cart-summary-card.types\";\n  import type { CartLine } from \"../blocks/cart-list.types\";\n  import type { SummaryRow } from \"../blocks/order-summary.types\";\n\n  export 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</script>\n\n<script lang=\"ts\">\n  import Badge from \"../compose/Badge.svelte\";\n  import Button from \"../compose/Button.svelte\";\n  import Group from \"../compose/Group.svelte\";\n  import Inline from \"../compose/Inline.svelte\";\n  import Input from \"../compose/Input.svelte\";\n  import List from \"../compose/List.svelte\";\n  import ListItem from \"../compose/ListItem.svelte\";\n  import Progress from \"../compose/Progress.svelte\";\n  import Stack from \"../compose/Stack.svelte\";\n  import Text from \"../compose/Text.svelte\";\n  import Title from \"../compose/Title.svelte\";\n  import MediaFrame from \"../components/media-frame.svelte\";\n  import { cn, fmtMoney, tpl } from \"../utils\";\n\n  let {\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 = $props();\n</script>\n\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  {#if (((items as string) === \"show\") && ((lines?.length ?? 0) > 0))}\n    <List tag=\"ul\" class=\"flex flex-col gap-4\" data-slot=\"summary-lines\">\n      {#each lines as line (line.id)}\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      {/each}\n    </List>\n  {/if}\n  {#if ((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      {#if ((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          {#each promos as c (c.id)}\n            <Badge variant=\"outline\" size=\"sm\">\n              {c.code}\n            </Badge>\n          {/each}\n        </Group>\n      {/if}\n    </Stack>\n  {/if}\n  {#if ((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  {/if}\n  {#if ((rows?.length ?? 0) > 0)}\n    <List tag=\"ul\" class=\"flex flex-col gap-2\">\n      {#each rows as row (row.id)}\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      {/each}\n    </List>\n  {/if}\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",
      "path": "components/cart-summary-card.svelte",
      "target": "components/cart-summary-card.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 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": [
      "svelte",
      "component"
    ]
  },
  "name": "cart-summary-card",
  "registryDependencies": [
    "badge",
    "button",
    "cart-list",
    "group",
    "inline",
    "input",
    "list",
    "list-item",
    "media-frame",
    "order-summary",
    "progress",
    "stack",
    "text",
    "title",
    "utils"
  ],
  "runtime": "svelte",
  "title": "Cart Summary Card",
  "type": "registry:component"
}
