{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "sidebar-list",
  "title": "Sidebar List",
  "description": "Providerless sidebar list primitives for embedded viewer and domain sidebars.",
  "dependencies": [
    "@base-ui/react@^1.4.1"
  ],
  "registryDependencies": [
    "separator",
    "@retab/sidebar-row",
    "@retab/utils"
  ],
  "files": [
    {
      "path": "registry/new-york-v4/ui/sidebar-list.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\n\nimport { cn } from \"@/lib/utils\";\nimport { Separator } from \"@/components/ui/separator\";\n\nimport {\n  sidebarRowButtonVariants,\n  type SidebarRowButtonVariantProps,\n} from \"./sidebar-row\";\n\nfunction getSidebarListButtonType({\n  defaultElement = \"button\",\n  render,\n}: {\n  defaultElement?: \"a\" | \"button\";\n  render: unknown;\n}): React.ButtonHTMLAttributes<HTMLButtonElement>[\"type\"] | undefined {\n  if (\n    (!render && defaultElement === \"button\") ||\n    (React.isValidElement(render) && render.type === \"button\")\n  ) {\n    return \"button\";\n  }\n\n  return undefined;\n}\n\nfunction getSidebarListRender(\n  render: useRender.RenderProp | undefined,\n): useRender.RenderProp | undefined {\n  if (typeof render !== \"function\") return render;\n\n  return (\n    props: React.HTMLAttributes<HTMLElement>,\n    state: Record<string, unknown>,\n  ): React.ReactElement<unknown> => {\n    const element = render(props, state);\n\n    if (\n      React.isValidElement<React.ButtonHTMLAttributes<HTMLButtonElement>>(\n        element,\n      ) &&\n      element.type === \"button\" &&\n      element.props.type == null\n    ) {\n      return React.cloneElement(element, { type: \"button\" });\n    }\n\n    return element;\n  };\n}\n\nexport function SidebarListRoot({\n  className,\n  width,\n  style,\n  ...props\n}: React.ComponentProps<\"div\"> & {\n  width?: string;\n}): React.ReactElement {\n  return (\n    <div\n      className={cn(\n        \"bg-sidebar text-sidebar-foreground flex h-full min-h-0 w-(--sidebar-width) flex-col\",\n        className,\n      )}\n      data-sidebar-list=\"\"\n      data-slot=\"sidebar-list-root\"\n      style={\n        {\n          \"--sidebar-width\": width,\n          ...style,\n        } as React.CSSProperties\n      }\n      {...props}\n    />\n  );\n}\n\nexport function SidebarListHeader({\n  className,\n  ...props\n}: React.ComponentProps<\"div\">): React.ReactElement {\n  return (\n    <div\n      className={cn(\"flex flex-col gap-2 p-2\", className)}\n      data-slot=\"sidebar-list-header\"\n      {...props}\n    />\n  );\n}\n\nexport function SidebarListContent({\n  className,\n  ...props\n}: React.ComponentProps<\"div\">): React.ReactElement {\n  return (\n    <div\n      className={cn(\n        \"flex min-h-0 flex-1 flex-col gap-2 overflow-auto\",\n        className,\n      )}\n      data-slot=\"sidebar-list-content\"\n      {...props}\n    />\n  );\n}\n\nexport function SidebarListGroup({\n  className,\n  ...props\n}: React.ComponentProps<\"div\">): React.ReactElement {\n  return (\n    <div\n      className={cn(\"relative flex min-w-0 flex-col p-2\", className)}\n      data-slot=\"sidebar-list-group\"\n      {...props}\n    />\n  );\n}\n\nexport function SidebarListGroupLabel({\n  className,\n  ...props\n}: React.ComponentProps<\"div\">): React.ReactElement {\n  return (\n    <div\n      className={cn(\n        \"text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0\",\n        className,\n      )}\n      data-slot=\"sidebar-list-group-label\"\n      {...props}\n    />\n  );\n}\n\nexport function SidebarListGroupContent({\n  className,\n  ...props\n}: React.ComponentProps<\"div\">): React.ReactElement {\n  return (\n    <div\n      className={cn(\"w-full text-sm\", className)}\n      data-slot=\"sidebar-list-group-content\"\n      {...props}\n    />\n  );\n}\n\nexport function SidebarListMenu({\n  className,\n  ...props\n}: React.ComponentProps<\"ul\">): React.ReactElement {\n  return (\n    <ul\n      className={cn(\"flex w-full min-w-0 flex-col gap-1\", className)}\n      data-slot=\"sidebar-list-menu\"\n      {...props}\n    />\n  );\n}\n\nexport function SidebarListMenuItem({\n  className,\n  ...props\n}: React.ComponentProps<\"li\">): React.ReactElement {\n  return (\n    <li\n      className={cn(\"group/menu-item relative\", className)}\n      data-slot=\"sidebar-list-menu-item\"\n      {...props}\n    />\n  );\n}\n\nexport function SidebarListButton({\n  isActive = false,\n  variant = \"default\",\n  size = \"default\",\n  className,\n  render,\n  asChild = false,\n  children,\n  ...props\n}: useRender.ComponentProps<\"button\"> & {\n  isActive?: boolean;\n  asChild?: boolean;\n} & SidebarRowButtonVariantProps): React.ReactElement {\n  const renderValue =\n    render ??\n    (asChild && React.isValidElement(children)\n      ? (children as React.ReactElement<Record<string, unknown>>)\n      : undefined);\n\n  const defaultProps = {\n    children: asChild && React.isValidElement(children) ? undefined : children,\n    className: cn(sidebarRowButtonVariants({ size, variant }), className),\n    \"data-active\": isActive,\n    \"data-size\": size,\n    \"data-slot\": \"sidebar-list-button\",\n    type: getSidebarListButtonType({ render: renderValue }),\n  };\n\n  return useRender({\n    defaultTagName: \"button\",\n    props: mergeProps<\"button\">(defaultProps, props),\n    render: getSidebarListRender(renderValue),\n  });\n}\n\nexport function SidebarListSeparator({\n  className,\n  ...props\n}: React.ComponentProps<typeof Separator>): React.ReactElement {\n  return (\n    <Separator\n      className={cn(\"bg-sidebar-border mx-2 w-auto\", className)}\n      data-slot=\"sidebar-list-separator\"\n      {...props}\n    />\n  );\n}\n",
      "type": "registry:ui",
      "target": "@ui/sidebar-list.tsx"
    }
  ],
  "type": "registry:ui"
}