{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ds-lightbox",
  "title": "Lightbox",
  "description": "Visualizador de imagem em tela cheia com navegação anterior/próxima, setas do teclado e tira de miniaturas.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "@lema-ds/dialog",
    "@lema-ds/button",
    "@lema-ds/ui-i18n",
    "@lema-ds/ds-locale-provider"
  ],
  "files": [
    {
      "path": "components/ds/ds-lightbox.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { UI_I18N, type UILocale } from \"@/lib/ui-i18n\"\nimport { useUILocale } from \"@/components/ui/ds-locale-provider\"\nimport { Button } from \"@/components/ui/button\"\nimport { Dialog, DialogContent, DialogTitle } from \"@/components/ui/dialog\"\n\n// ── Types ──\n\nexport interface LightboxImage {\n  src: string\n  alt: string\n  caption?: React.ReactNode\n}\n\nexport interface LightboxProps {\n  images: LightboxImage[]\n  /** Currently shown image index (controlled). */\n  index: number\n  open: boolean\n  onOpenChange: (open: boolean) => void\n  onIndexChange: (index: number) => void\n  /** Shows a strip of clickable thumbnails below the main image. */\n  showThumbnails?: boolean\n  locale?: UILocale\n}\n\n// ── Component ──\n\n/**\n * A fullscreen image viewer with prev/next navigation, keyboard arrows, and\n * an optional thumbnail strip — pair with `ImageGallery` (each item's\n * `onClick` opens the lightbox at that index).\n */\nexport function Lightbox({\n  images,\n  index,\n  open,\n  onOpenChange,\n  onIndexChange,\n  showThumbnails = true,\n  locale: localeProp,\n}: LightboxProps) {\n  const locale = useUILocale(localeProp)\n  const t = UI_I18N[locale]?.lightbox ?? UI_I18N[\"en-US\"].lightbox\n  const image = images[index]\n\n  const goPrevious = React.useCallback(() => {\n    onIndexChange((index - 1 + images.length) % images.length)\n  }, [index, images.length, onIndexChange])\n\n  const goNext = React.useCallback(() => {\n    onIndexChange((index + 1) % images.length)\n  }, [index, images.length, onIndexChange])\n\n  const handleKeyDown = (event: React.KeyboardEvent) => {\n    if (event.key === \"ArrowLeft\") {\n      event.preventDefault()\n      goPrevious()\n    } else if (event.key === \"ArrowRight\") {\n      event.preventDefault()\n      goNext()\n    }\n  }\n\n  if (!image) return null\n\n  return (\n    <Dialog open={open} onOpenChange={onOpenChange}>\n      <DialogContent\n        onKeyDown={handleKeyDown}\n        className=\"max-w-4xl overflow-hidden border-border/60 bg-foreground/95 p-1 sm:rounded-2xl\"\n      >\n        <DialogTitle className=\"sr-only\">{image.alt}</DialogTitle>\n\n        <div className=\"relative flex aspect-video w-full items-center justify-center overflow-hidden rounded-xl bg-background\">\n          {/* eslint-disable-next-line @next/next/no-img-element */}\n          <img\n            src={image.src}\n            alt={image.alt}\n            loading=\"lazy\"\n            decoding=\"async\"\n            className=\"max-h-full max-w-full object-contain\"\n          />\n\n          {images.length > 1 && (\n            <>\n              <Button\n                type=\"button\"\n                variant=\"secondary\"\n                size=\"icon\"\n                onClick={goPrevious}\n                aria-label={t.previous}\n                className=\"absolute top-1/2 left-3 -translate-y-1/2 rounded-full\"\n              >\n                <ChevronLeftIcon aria-hidden=\"true\" />\n              </Button>\n              <Button\n                type=\"button\"\n                variant=\"secondary\"\n                size=\"icon\"\n                onClick={goNext}\n                aria-label={t.next}\n                className=\"absolute top-1/2 right-3 -translate-y-1/2 rounded-full\"\n              >\n                <ChevronRightIcon aria-hidden=\"true\" />\n              </Button>\n            </>\n          )}\n        </div>\n\n        <div className=\"flex items-center justify-between gap-3 px-3 pb-2\">\n          {image.caption && (\n            <p className=\"truncate text-sm text-background/80\">\n              {image.caption}\n            </p>\n          )}\n          {images.length > 1 && (\n            <span className=\"ml-auto shrink-0 text-xs text-background/60 tabular-nums\">\n              {index + 1} {t.of} {images.length}\n            </span>\n          )}\n        </div>\n\n        {showThumbnails && images.length > 1 && (\n          <div className=\"flex gap-2 overflow-x-auto px-3 pb-3\">\n            {images.map((thumb, thumbIndex) => (\n              <button\n                key={thumb.src}\n                type=\"button\"\n                onClick={() => onIndexChange(thumbIndex)}\n                aria-label={thumb.alt}\n                aria-current={thumbIndex === index}\n                className={cn(\n                  \"size-14 shrink-0 overflow-hidden rounded-lg opacity-50 ring-2 ring-transparent transition-all focus-visible:ring-ring focus-visible:outline-none\",\n                  thumbIndex === index && \"opacity-100 ring-white\"\n                )}\n              >\n                {/* eslint-disable-next-line @next/next/no-img-element */}\n                <img\n                  src={thumb.src}\n                  alt=\"\"\n                  loading=\"lazy\"\n                  decoding=\"async\"\n                  className=\"size-full object-cover\"\n                />\n              </button>\n            ))}\n          </div>\n        )}\n      </DialogContent>\n    </Dialog>\n  )\n}\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}
