{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ds-header-mobile-drawer",
  "title": "Header Mobile Drawer",
  "description": "Sheet lateral para navegação mobile com accordion, brand header e footer de CTAs.",
  "dependencies": [
    "class-variance-authority",
    "lucide-react"
  ],
  "registryDependencies": [
    "@lema-ds/sheet",
    "@lema-ds/collapsible",
    "@lema-ds/button",
    "@lema-ds/separator",
    "@lema-ds/ui-i18n",
    "@lema-ds/ds-header-actions",
    "@lema-ds/ds-header-nav",
    "@lema-ds/ds-locale-provider",
    "@lema-ds/ds-link-provider"
  ],
  "files": [
    {
      "path": "components/ds/ds-header-mobile-drawer.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { DSLink } from \"@/components/ui/ds-link-provider\"\nimport { ChevronDownIcon, MenuIcon, XIcon } 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 {\n  Sheet,\n  SheetContent,\n  SheetDescription,\n  SheetHeader,\n  SheetTitle,\n  SheetTrigger,\n} from \"@/components/ui/sheet\"\nimport {\n  Collapsible,\n  CollapsibleContent,\n  CollapsibleTrigger,\n} from \"@/components/ui/collapsible\"\nimport { Separator } from \"@/components/ui/separator\"\nimport { type HeaderNavItem } from \"./ds-header-nav\"\nimport { type HeaderActionItem } from \"./ds-header-actions\"\n\n// ── Types ──────────────────────────────────────────────────────────────────\n\nexport interface HeaderMobileDrawerProps {\n  items: HeaderNavItem[]\n  actions?: HeaderActionItem[]\n  brand?: React.ReactNode\n  open?: boolean\n  onOpenChange?: (open: boolean) => void\n  locale?: UILocale\n  side?: \"left\" | \"right\"\n  className?: string\n  onNavigate?: (item: HeaderNavItem) => void\n}\n\n// ── Component ──────────────────────────────────────────────────────────────\n\nexport function HeaderMobileDrawer({\n  items,\n  actions,\n  brand,\n  open,\n  onOpenChange,\n  locale: localeProp,\n  side = \"right\",\n  className,\n  onNavigate,\n}: HeaderMobileDrawerProps) {\n  const locale = useUILocale(localeProp)\n  const [internalOpen, setInternalOpen] = React.useState(false)\n  const isControlled = open !== undefined\n  const resolvedOpen = isControlled ? open : internalOpen\n\n  const handleOpenChange = (next: boolean) => {\n    if (!isControlled) setInternalOpen(next)\n    onOpenChange?.(next)\n  }\n\n  return (\n    <Sheet open={resolvedOpen} onOpenChange={handleOpenChange}>\n      <SheetTrigger asChild>\n        <Button\n          variant=\"ghost\"\n          size=\"icon\"\n          aria-label={\n            resolvedOpen\n              ? UI_I18N[locale].header.closeMenu\n              : UI_I18N[locale].header.openMenu\n          }\n          aria-expanded={resolvedOpen}\n          aria-controls=\"header-mobile-drawer\"\n          className={cn(\"lg:hidden\", className)}\n          data-slot=\"header-mobile-trigger\"\n        >\n          {resolvedOpen ? (\n            <XIcon className=\"size-5\" />\n          ) : (\n            <MenuIcon className=\"size-5\" />\n          )}\n        </Button>\n      </SheetTrigger>\n      <SheetContent\n        id=\"header-mobile-drawer\"\n        side={side}\n        className=\"flex w-80 flex-col gap-0 p-0 sm:max-w-80\"\n        data-slot=\"header-mobile-drawer\"\n      >\n        <SheetHeader className=\"border-b p-4\">\n          <SheetTitle className=\"sr-only\">\n            {UI_I18N[locale].header.menu}\n          </SheetTitle>\n          <SheetDescription className=\"sr-only\">\n            {UI_I18N[locale].header.toggleNav}\n          </SheetDescription>\n          {brand && (\n            <div className=\"flex items-center gap-2 text-left\">{brand}</div>\n          )}\n        </SheetHeader>\n\n        <nav\n          aria-label={UI_I18N[locale].header.menu}\n          className=\"flex flex-1 flex-col gap-1 overflow-y-auto p-4\"\n        >\n          {items.map((item) => {\n            const hasChildren = item.children && item.children.length > 0\n\n            if (!hasChildren) {\n              if (item.href) {\n                return (\n                  <DSLink\n                    key={item.label}\n                    href={item.href}\n                    aria-current={item.active ? \"page\" : undefined}\n                    onClick={() => {\n                      onNavigate?.(item)\n                      handleOpenChange(false)\n                    }}\n                    className={cn(\n                      \"flex items-center gap-2 rounded-lg px-3 py-2.5 text-sm font-medium transition-colors hover:bg-muted focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none\",\n                      item.active && \"bg-muted text-foreground\"\n                    )}\n                  >\n                    {item.icon && (\n                      <span className=\"shrink-0 [&_svg]:size-4\">\n                        {item.icon}\n                      </span>\n                    )}\n                    <span className=\"flex-1 truncate\">{item.label}</span>\n                    {item.badge && (\n                      <span className=\"rounded-full bg-primary px-1.5 py-0.5 text-xs font-semibold text-primary-foreground\">\n                        {item.badge}\n                      </span>\n                    )}\n                  </DSLink>\n                )\n              }\n              return (\n                <span\n                  key={item.label}\n                  className=\"flex items-center gap-2 rounded-lg px-3 py-2.5 text-sm font-medium text-foreground\"\n                >\n                  {item.icon && (\n                    <span className=\"shrink-0 [&_svg]:size-4\">{item.icon}</span>\n                  )}\n                  <span className=\"flex-1 truncate\">{item.label}</span>\n                </span>\n              )\n            }\n\n            return (\n              <Collapsible key={item.label} className=\"group/collapsible\">\n                <CollapsibleTrigger\n                  className={cn(\n                    \"flex w-full items-center gap-2 rounded-lg px-3 py-2.5 text-sm font-medium transition-colors hover:bg-muted focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none\",\n                    item.active && \"bg-muted\"\n                  )}\n                >\n                  {item.icon && (\n                    <span className=\"shrink-0 [&_svg]:size-4\">{item.icon}</span>\n                  )}\n                  <span className=\"flex-1 truncate text-left\">\n                    {item.label}\n                  </span>\n                  {item.badge && (\n                    <span className=\"rounded-full bg-primary px-1.5 py-0.5 text-xs font-semibold text-primary-foreground\">\n                      {item.badge}\n                    </span>\n                  )}\n                  <ChevronDownIcon className=\"size-4 shrink-0 transition-transform group-data-[state=open]/collapsible:rotate-180\" />\n                </CollapsibleTrigger>\n                <CollapsibleContent className=\"mt-1 flex flex-col gap-1 pl-4\">\n                  {item.children?.map((child) => (\n                    <DSLink\n                      key={child.label}\n                      href={child.href ?? \"#\"}\n                      onClick={() => {\n                        onNavigate?.(child)\n                        handleOpenChange(false)\n                      }}\n                      className=\"flex flex-col gap-0.5 rounded-lg px-3 py-2 transition-colors hover:bg-muted focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none\"\n                    >\n                      <span className=\"flex items-center gap-2 text-sm font-medium text-foreground\">\n                        {child.icon && (\n                          <span className=\"shrink-0 [&_svg]:size-3.5\">\n                            {child.icon}\n                          </span>\n                        )}\n                        <span className=\"truncate\">{child.label}</span>\n                      </span>\n                      {child.description && (\n                        <span className=\"line-clamp-2 text-xs leading-snug text-muted-foreground\">\n                          {child.description}\n                        </span>\n                      )}\n                    </DSLink>\n                  ))}\n                </CollapsibleContent>\n              </Collapsible>\n            )\n          })}\n        </nav>\n\n        {actions && actions.length > 0 && (\n          <>\n            <Separator />\n            <div className=\"flex flex-col gap-2 p-4\">\n              {actions.map((action) => (\n                <Button\n                  key={action.label}\n                  variant={action.variant ?? \"default\"}\n                  size={action.size ?? \"default\"}\n                  disabled={action.disabled}\n                  aria-label={action.ariaLabel ?? action.label}\n                  onClick={() => {\n                    action.onClick?.()\n                    handleOpenChange(false)\n                  }}\n                  className=\"w-full justify-center\"\n                  asChild={!!action.href}\n                >\n                  {action.href ? (\n                    <a href={action.href}>{action.label}</a>\n                  ) : (\n                    <span>{action.label}</span>\n                  )}\n                </Button>\n              ))}\n            </div>\n          </>\n        )}\n      </SheetContent>\n    </Sheet>\n  )\n}\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}
