{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "A slider for how much is used and the price it gives. The estimate follows the slider; the page keeps the value.",
  "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 price that follows a slider: the chosen amount of use, the price per unit and the estimate. The page keeps\n * the amount and updates it on the `usage` event. Axes: layout (card, plain), ends (show: the smallest and the\n * largest amount under the slider, hide), tone.\n */\nimport { type JSX } from \"solid-js\";\nimport { Button, Group, Range, Stack, Text } from \"../compose\";\nimport { SectionFrame } from \"../components/section-frame\";\nimport { cn, fmtMoney, tpl, urlOf } from \"../utils\";\nimport type { UsageSlider, UsagePrice } from \"./usage-calculator.types\";\n\nexport type UsageCalculatorProps = {\n  id: string;\n  title: string;\n  text: string;\n  usage: number;\n  slider: UsageSlider;\n  price: UsagePrice;\n  cta: string;\n  href?: string;\n  layout?: \"card\" | \"plain\";\n  ends?: \"show\" | \"hide\";\n  tone?: \"default\" | \"muted\";\n  landmarkLabel?: string;\n  onUsage?: (value: string) => void;\n};\n\nexport function UsageCalculator({\n  id,\n  title,\n  text,\n  usage,\n  slider,\n  price,\n  cta,\n  href,\n  layout = \"card\",\n  ends = \"show\",\n  tone = \"default\",\n  landmarkLabel,\n  onUsage,\n}: UsageCalculatorProps) {\n  return (\n    <SectionFrame id={id} title={title} lead={text} tone={tone} align=\"center\" landmarkLabel={landmarkLabel}>\n      <Stack\n        gap=\"4\"\n        align=\"stretch\"\n        class={cn(\n          \"mx-auto w-full max-w-xl\",\n          (((layout as string) === \"card\") ? \"rounded bg-card p-6 inset-ring inset-ring-border\" : \"\")\n        )}\n        data-slot=\"usage\"\n      >\n        <Group justify=\"between\" align=\"baseline\">\n          <Text size=\"xl\" weight=\"bold\">\n            {tpl(slider.unit, usage)}\n          </Text>\n          <Text size=\"sm\" class=\"text-muted-foreground\">\n            {slider.label}\n          </Text>\n        </Group>\n        <Range\n          min={slider.min}\n          max={slider.max}\n          value={usage}\n          aria-label={slider.label}\n          data-slot=\"slider\"\n          onInput={(event: InputEvent & { currentTarget: HTMLInputElement }) => onUsage?.(event.currentTarget.value)}\n        />\n        {((ends as string) === \"show\") ? (\n          <Group justify=\"between\" data-slot=\"ends\">\n            <Text size=\"xs\" class=\"text-muted-foreground\">\n              {tpl(slider.unit, slider.min)}\n            </Text>\n            <Text size=\"xs\" class=\"text-muted-foreground\">\n              {tpl(slider.unit, slider.max)}\n            </Text>\n          </Group>\n        ) : null}\n        <Group justify=\"between\" align=\"center\" class=\"flex-wrap\">\n          <Stack gap=\"0\">\n            <Text size=\"xs\" class=\"text-muted-foreground\">\n              {price.label}\n            </Text>\n            <Text size=\"4xl\" weight=\"bold\" data-slot=\"estimate\">\n              {fmtMoney((usage * price.rate), price.currency)}\n            </Text>\n          </Stack>\n          <Button variant=\"default\" size=\"default\" href={urlOf(href)}>\n            {cta}\n          </Button>\n        </Group>\n      </Stack>\n    </SectionFrame>\n  );\n}\n",
      "path": "blocks/usage-calculator.tsx",
      "target": "blocks/usage-calculator.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 UsageSlider = {\n  min: number;\n  max: number;\n  /** accessible name of the slider */\n  label: string;\n  /** template of an amount, e.g. `｛0｝ credits` */\n  unit: string;\n};\n\nexport type UsagePrice = {\n  /** price of one unit in minor units (cents) */\n  rate: number;\n  currency: string;\n  /** name of the estimate */\n  label: string;\n};\n",
      "path": "blocks/usage-calculator.types.ts",
      "target": "blocks/usage-calculator.types.ts"
    }
  ],
  "meta": {
    "category": "marketing",
    "group": "pricing",
    "kind": "block",
    "tags": [
      "solid",
      "block"
    ]
  },
  "name": "usage-calculator",
  "registryDependencies": [
    "compose",
    "section-frame",
    "utils"
  ],
  "runtime": "solid",
  "title": "Usage Calculator",
  "type": "registry:block"
}
