{
  "name": "presentation-zoom-select",
  "type": "registry:component",
  "files": [
    {
      "path": "components/presentation-zoom-select.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport { useZoom } from \"@diceui/pptx\";\nimport { cn } from \"cn\";\nimport * as React from \"react\";\n\nimport {\n  Select,\n  SelectContent,\n  SelectItem,\n  SelectTrigger,\n  SelectValue,\n} from \"@/registry/bases/radix/ui/select\";\n\nconst ZOOM_LEVELS = [0.5, 0.75, 1, 1.5, 2];\n\ninterface PresentationZoomSelectProps extends Omit<\n  React.ComponentProps<typeof SelectTrigger>,\n  \"value\" | \"onValueChange\"\n> {\n  levels?: number[];\n}\n\nfunction PresentationZoomSelect({\n  levels = ZOOM_LEVELS,\n  className,\n  ...props\n}: PresentationZoomSelectProps) {\n  const { zoom, isAutoFit, setZoom, setAutoFit } = useZoom();\n  const percentage = `${Math.round(zoom * 100)}%`;\n  const itemClassName =\n    \"py-0.5 pr-6 pl-1.5 text-xs [&_svg:not([class*='size-'])]:size-3\";\n\n  return (\n    <Select\n      value={isAutoFit ? \"fit\" : String(zoom)}\n      onValueChange={(value) => {\n        if (value === \"fit\") setAutoFit(true);\n        else setZoom(Number(value));\n      }}\n    >\n      <SelectTrigger\n        size=\"sm\"\n        className={cn(\n          \"h-6 w-22 gap-1 rounded-md py-0 pr-1.5 pl-2 text-xs [&_svg:not([class*='size-'])]:size-3\",\n          className,\n        )}\n        {...props}\n      >\n        <SelectValue>\n          {isAutoFit ? `Fit · ${percentage}` : percentage}\n        </SelectValue>\n      </SelectTrigger>\n      <SelectContent className=\"min-w-22 p-0.5\">\n        <SelectItem value=\"fit\" className={itemClassName}>\n          Fit\n        </SelectItem>\n        {levels.map((level) => (\n          <SelectItem\n            key={level}\n            value={String(level)}\n            className={itemClassName}\n          >\n            {`${level * 100}%`}\n          </SelectItem>\n        ))}\n      </SelectContent>\n    </Select>\n  );\n}\n\nexport { PresentationZoomSelect };\n",
      "target": ""
    }
  ],
  "registryDependencies": [
    "select"
  ],
  "dependencies": [
    "cn",
    "@diceui/pptx"
  ]
}