{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ds-pricing-calculator",
  "registryDependencies": [
    "@lema-ds/slider",
    "@lema-ds/switch",
    "@lema-ds/label",
    "@lema-ds/button",
    "@lema-ds/badge",
    "@lema-ds/tokens"
  ],
  "files": [
    {
      "path": "components/ds/ds-pricing-calculator.tsx",
      "content": "\"use client\"\n\nimport React, { useState } from \"react\"\nimport { cn } from \"@/lib/utils\"\nimport { Slider } from \"@/components/ui/slider\"\nimport { Switch } from \"@/components/ui/switch\"\nimport { Label } from \"@/components/ui/label\"\nimport { Button } from \"@/components/ui/button\"\nimport { Badge } from \"@/components/ui/badge\"\n\n// ── Types ──\n\nexport interface PricingCalculatorProps extends React.HTMLAttributes<HTMLDivElement> {\n  basePrice?: number\n  unitLabel?: string\n  unitPrice?: number\n  minUnits?: number\n  maxUnits?: number\n  step?: number\n  discountPercent?: number\n  currency?: string\n  title?: string\n  description?: string\n  features?: string[]\n}\n\n// ── Component ──\n\nexport const PricingCalculator = React.forwardRef<\n  HTMLDivElement,\n  PricingCalculatorProps\n>(\n  (\n    {\n      basePrice = 0,\n      unitLabel = \"users\",\n      unitPrice = 15,\n      minUnits = 1,\n      maxUnits = 100,\n      step = 1,\n      discountPercent = 20,\n      currency = \"$\",\n      title = \"Calculate your plan\",\n      description = \"Adjust the required volume and see your final price instantly.\",\n      features = [\n        \"24/7 priority support\",\n        \"Advanced analytics\",\n        \"Unlimited integrations\",\n        \"SSO (Single Sign-On)\",\n      ],\n      className,\n      ...props\n    },\n    ref\n  ) => {\n    const [units, setUnits] = useState(minUnits)\n    const [isYearly, setIsYearly] = useState(false)\n\n    const calculatePrice = () => {\n      const rawPrice = basePrice + units * unitPrice\n      if (isYearly) {\n        return rawPrice * (1 - discountPercent / 100)\n      }\n      return rawPrice\n    }\n\n    const price = calculatePrice()\n\n    return (\n      <div\n        ref={ref}\n        className={cn(\n          \"grid w-full grid-cols-1 overflow-hidden rounded-2xl border border-border bg-card shadow-sm md:grid-cols-2\",\n          className\n        )}\n        {...props}\n      >\n        {/* Left: Controls */}\n        <div className=\"flex flex-col justify-center p-8 sm:p-10\">\n          <h3 className=\"text-2xl font-bold tracking-tight text-card-foreground\">\n            {title}\n          </h3>\n          <p className=\"mt-2 text-sm text-muted-foreground\">{description}</p>\n\n          <div className=\"mt-10 flex flex-col gap-6\">\n            <div className=\"flex flex-col gap-4\">\n              <div className=\"flex items-center justify-between\">\n                <Label className=\"text-base\">Quantity of {unitLabel}</Label>\n                <span className=\"text-xl font-bold text-foreground tabular-nums\">\n                  {units}\n                </span>\n              </div>\n              <Slider\n                value={[units]}\n                min={minUnits}\n                max={maxUnits}\n                step={step}\n                onValueChange={(vals) => setUnits(vals[0])}\n                className=\"py-4\"\n              />\n            </div>\n\n            <div className=\"flex items-center justify-between rounded-lg border border-border p-4\">\n              <div className=\"flex flex-col gap-1\">\n                <Label\n                  htmlFor=\"billing-toggle\"\n                  className=\"cursor-pointer text-base\"\n                >\n                  Annual Billing\n                </Label>\n                <p className=\"text-sm text-muted-foreground\">\n                  Save up to {discountPercent}%\n                </p>\n              </div>\n              <Switch\n                id=\"billing-toggle\"\n                checked={isYearly}\n                onCheckedChange={setIsYearly}\n              />\n            </div>\n          </div>\n        </div>\n\n        {/* Right: Result */}\n        <div className=\"flex flex-col justify-between bg-muted p-8 sm:p-10\">\n          <div>\n            <div className=\"mb-2 flex items-center justify-between\">\n              <h4 className=\"font-semibold text-foreground\">Plan Summary</h4>\n              {isYearly && (\n                <Badge\n                  variant=\"default\"\n                  className=\"bg-success text-success-foreground hover:bg-success/80\"\n                >\n                  Discount Applied\n                </Badge>\n              )}\n            </div>\n\n            <div className=\"my-8 flex items-baseline text-card-foreground\">\n              <span className=\"text-3xl font-semibold tracking-tight\">\n                {currency}\n              </span>\n              <span className=\"ml-1 text-6xl font-bold tracking-tight tabular-nums\">\n                {price.toLocaleString(\"en-US\", {\n                  minimumFractionDigits: 2,\n                  maximumFractionDigits: 2,\n                })}\n              </span>\n              <span className=\"ml-2 text-sm text-muted-foreground\">\n                / {isYearly ? \"month (billed annually)\" : \"month\"}\n              </span>\n            </div>\n\n            <ul className=\"flex flex-col gap-3\">\n              {features.map((feature, i) => (\n                <li\n                  key={i}\n                  className=\"flex items-center text-sm text-muted-foreground\"\n                >\n                  <CheckIcon className=\"mr-3 h-5 w-5 shrink-0 text-primary\" />\n                  {feature}\n                </li>\n              ))}\n            </ul>\n          </div>\n\n          <Button size=\"lg\" className=\"mt-10 w-full font-semibold\">\n            Subscribe Now\n          </Button>\n        </div>\n      </div>\n    )\n  }\n)\n\nPricingCalculator.displayName = \"PricingCalculator\"\n\nfunction CheckIcon(props: React.SVGProps<SVGSVGElement>) {\n  return (\n    <svg\n      {...props}\n      fill=\"none\"\n      stroke=\"currentColor\"\n      strokeWidth={2}\n      viewBox=\"0 0 24 24\"\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n    >\n      <polyline points=\"20 6 9 17 4 12\" />\n    </svg>\n  )\n}\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}
