{"name":"aspect-ratio","type":"registry:ui","files":[{"path":"aspect-ratio.tsx","type":"registry:ui","content":"import { mergeProps } from \"@base-ui/react/merge-props\"\nimport { useRender } from \"@base-ui/react/use-render\"\n\nimport { cn } from \"@/lib/utils\"\n\ninterface AspectRatioProps extends useRender.ComponentProps<\"div\"> {\n  /** Width divided by height, such as `16 / 9`. Defaults to a square. */\n  ratio?: number\n}\n\n// CSS aspect-ratio sizes the box from its width, so it needs no padding hack\n// or absolutely positioned child. Overflow is clipped so media filling the\n// box with object-cover keeps the rounded corners a caller adds.\nfunction AspectRatio({\n  ratio = 1,\n  className,\n  style,\n  render,\n  ...props\n}: AspectRatioProps) {\n  const safeRatio = Number.isFinite(ratio) && ratio > 0 ? ratio : 1\n\n  const defaultProps = {\n    \"data-slot\": \"aspect-ratio\",\n    className: cn(\n      \"relative w-full overflow-hidden [&>img]:size-full [&>img]:object-cover [&>video]:size-full [&>video]:object-cover [&>iframe]:size-full [&>iframe]:border-0\",\n      className\n    ),\n    style: { aspectRatio: String(safeRatio), ...style },\n  }\n\n  return useRender({\n    defaultTagName: \"div\",\n    render,\n    props: mergeProps<\"div\">(defaultProps, props),\n  })\n}\n\nexport { AspectRatio }\nexport type { AspectRatioProps }\n","target":"components/ui/aspect-ratio.tsx"}],"dependencies":["@base-ui/react"]}