{
  "$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\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"
    },
    {
      "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-->\n<script lang=\"ts\">\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};\n</script>\n\n<script setup lang=\"ts\">\nimport Button from \"../compose/Button.vue\";\nimport Group from \"../compose/Group.vue\";\nimport Range from \"../compose/Range.vue\";\nimport Stack from \"../compose/Stack.vue\";\nimport Text from \"../compose/Text.vue\";\nimport SectionFrame from \"../components/section-frame.vue\";\nimport { cn, fmtMoney, tpl, urlOf } from \"../utils\";\n\nconst {\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} = defineProps<UsageCalculatorProps>();\nconst emit = defineEmits<{ usage: [value: string] }>();\n</script>\n\n<template>\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        @input=\"(event: Event & { currentTarget: HTMLInputElement }) => emit('usage', event.currentTarget.value)\"\n      />\n      <Group v-if=\"((ends as string) === 'show')\" 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      <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</template>\n",
      "path": "blocks/usage-calculator.vue",
      "target": "blocks/usage-calculator.vue"
    }
  ],
  "meta": {
    "category": "marketing",
    "group": "pricing",
    "kind": "block",
    "tags": [
      "vue",
      "block"
    ]
  },
  "name": "usage-calculator",
  "registryDependencies": [
    "button",
    "group",
    "range",
    "section-frame",
    "stack",
    "text",
    "utils"
  ],
  "runtime": "vue",
  "title": "Usage Calculator",
  "type": "registry:block"
}
