{
  "$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/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n// Source: packages/compose-gen/specs/organisms/usage-calculator.json\n\npackage blocks\n\nimport (\n\t\"github.com/ui8kit/codegen/generated/templ/ui/box\"\n\t\"github.com/ui8kit/codegen/generated/templ/ui/button\"\n\t\"github.com/ui8kit/codegen/generated/templ/compose\"\n\t\"github.com/ui8kit/codegen/generated/templ/ui/input\"\n\t\"github.com/ui8kit/codegen/generated/templ/ui/text\"\n\tuiutils \"github.com/ui8kit/codegen/generated/templ/orgutils\"\n)\n\n// UsageCalculatorProps are the props of UsageCalculator; the values are the JSON shapes of the TypeScript props.\ntype UsageCalculatorProps struct {\n\tId any `json:\"id\"`\n\tTitle any `json:\"title\"`\n\tText any `json:\"text\"`\n\tUsage any `json:\"usage\"`\n\tSlider any `json:\"slider\"`\n\tPrice any `json:\"price\"`\n\tCta any `json:\"cta\"`\n\tHref any `json:\"href\"`\n\tLayout any `json:\"layout\"`\n\tEnds any `json:\"ends\"`\n\tTone any `json:\"tone\"`\n\tLandmarkLabel any `json:\"landmarkLabel\"`\n}\n\n// A price that follows a slider: the chosen amount of use, the price per unit and the estimate. The page keeps the amount and updates it on the `usage` event. Axes: layout (card, plain), ends (show: the smallest and the largest amount under the slider, hide), tone.\ntempl UsageCalculator(p UsageCalculatorProps) {\n\t{{ vId := p.Id }}\n\t{{ vTitle := p.Title }}\n\t{{ vText := p.Text }}\n\t{{ vUsage := p.Usage }}\n\t{{ vSlider := p.Slider }}\n\t{{ vPrice := p.Price }}\n\t{{ vCta := p.Cta }}\n\t{{ vHref := p.Href }}\n\t{{ vLayout := uiutils.Def(p.Layout, \"card\") }}\n\t{{ vEnds := uiutils.Def(p.Ends, \"show\") }}\n\t{{ vTone := uiutils.Def(p.Tone, \"default\") }}\n\t{{ vLandmarkLabel := p.LandmarkLabel }}\n\t@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Lead: vText, Tone: vTone, Align: \"center\", LandmarkLabel: vLandmarkLabel}) {\n\t\t@compose.Stack(compose.StackProps{Gap: \"4\", Align: \"stretch\", BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv(\"mx-auto w-full max-w-xl\", uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, \"card\")), \"rounded bg-card p-6 inset-ring inset-ring-border\", \"\"))), Attrs: uiutils.Attrs(\"data-slot\", \"usage\")}}) {\n\t\t\t@compose.Group(compose.GroupProps{Justify: \"between\", Align: \"baseline\", BoxProps: box.BoxProps{}}) {\n\t\t\t\t@compose.Text(compose.TextProps{Size: \"xl\", Weight: \"bold\", TextProps: text.TextProps{}}) {\n\t\t\t\t\t{ uiutils.Text(uiutils.Tpl(uiutils.Get(vSlider, \"unit\"), vUsage)) }\n\t\t\t\t}\n\t\t\t\t@compose.Text(compose.TextProps{Size: \"sm\", TextProps: text.TextProps{Class: \"text-muted-foreground\"}}) {\n\t\t\t\t\t{ uiutils.Text(uiutils.Get(vSlider, \"label\")) }\n\t\t\t\t}\n\t\t\t}\n\t\t\t@compose.Range(compose.RangeProps{InputProps: input.InputProps{Min: uiutils.S(uiutils.Get(vSlider, \"min\")), Max: uiutils.S(uiutils.Get(vSlider, \"max\")), Value: uiutils.SP(vUsage), Attrs: uiutils.Attrs(\"aria-label\", uiutils.Get(vSlider, \"label\"), \"data-slot\", \"slider\")}})\n\t\t\tif uiutils.Eq(vEnds, \"show\") {\n\t\t\t\t@compose.Group(compose.GroupProps{Justify: \"between\", BoxProps: box.BoxProps{Attrs: uiutils.Attrs(\"data-slot\", \"ends\")}}) {\n\t\t\t\t\t@compose.Text(compose.TextProps{Size: \"xs\", TextProps: text.TextProps{Class: \"text-muted-foreground\"}}) {\n\t\t\t\t\t\t{ uiutils.Text(uiutils.Tpl(uiutils.Get(vSlider, \"unit\"), uiutils.Get(vSlider, \"min\"))) }\n\t\t\t\t\t}\n\t\t\t\t\t@compose.Text(compose.TextProps{Size: \"xs\", TextProps: text.TextProps{Class: \"text-muted-foreground\"}}) {\n\t\t\t\t\t\t{ uiutils.Text(uiutils.Tpl(uiutils.Get(vSlider, \"unit\"), uiutils.Get(vSlider, \"max\"))) }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t@compose.Group(compose.GroupProps{Justify: \"between\", Align: \"center\", BoxProps: box.BoxProps{Class: \"flex-wrap\"}}) {\n\t\t\t\t@compose.Stack(compose.StackProps{Gap: \"0\", BoxProps: box.BoxProps{}}) {\n\t\t\t\t\t@compose.Text(compose.TextProps{Size: \"xs\", TextProps: text.TextProps{Class: \"text-muted-foreground\"}}) {\n\t\t\t\t\t\t{ uiutils.Text(uiutils.Get(vPrice, \"label\")) }\n\t\t\t\t\t}\n\t\t\t\t\t@compose.Text(compose.TextProps{Size: \"4xl\", Weight: \"bold\", TextProps: text.TextProps{Attrs: uiutils.Attrs(\"data-slot\", \"estimate\")}}) {\n\t\t\t\t\t\t{ uiutils.Text(uiutils.Money(uiutils.Mul(vUsage, uiutils.Get(vPrice, \"rate\")), uiutils.Get(vPrice, \"currency\"))) }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t@compose.Button(compose.ButtonProps{Variant: \"default\", Size: \"default\", ButtonProps: button.ButtonProps{Href: uiutils.URL(vHref, false)}}) {\n\t\t\t\t\t{ uiutils.Text(vCta) }\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n",
      "path": "blocks/usage-calculator.templ",
      "target": "blocks/usage-calculator.templ"
    }
  ],
  "meta": {
    "category": "marketing",
    "group": "pricing",
    "kind": "block",
    "tags": [
      "templ",
      "block"
    ]
  },
  "name": "usage-calculator",
  "registryDependencies": [
    "button",
    "group",
    "kit-box",
    "kit-button",
    "kit-input",
    "kit-text",
    "range",
    "section-frame",
    "stack",
    "text",
    "utils"
  ],
  "runtime": "templ",
  "title": "Usage Calculator",
  "type": "registry:block"
}
