{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "sortable-list",
  "type": "registry:ui",
  "title": "Sortable List",
  "dependencies": [
    "@base-ui-next/react"
  ],
  "registryDependencies": [
    "https://hamur.dev/r/react/utils.json",
    "https://hamur.dev/r/react/button.json"
  ],
  "files": [
    {
      "path": "react/sortable-list.tsx",
      "content": "'use client'\n\nimport type * as React from 'react' // base-ui-next/ui sortable-list@0.1.1\nimport { SortableList as SortableListPrimitive } from '@base-ui-next/react/sortable-list'\nimport { cn } from '@/lib/utils'\nimport { buttonVariants } from '@/components/ui/button'\n\nconst sortableListClassName = 'w-full'\n\nconst sortableListListClassName =\n  'flex flex-col gap-1 data-[orientation=horizontal]:flex-row data-[orientation=grid]:grid data-[orientation=grid]:grid-cols-[repeat(auto-fill,minmax(8rem,1fr))]'\n\nconst sortableListItemClassName =\n  'relative flex items-center gap-2 rounded-md border bg-background px-2 py-1.5 [transform:translate(var(--sortable-item-translate-x,0),var(--sortable-item-translate-y,0))] in-data-[sorting]:not-data-[dragging]:transition-transform data-dragging:z-10 data-dragging:shadow-md data-dragging:ring-1 data-dragging:ring-ring/30 data-grabbed:outline-2 data-grabbed:outline-ring'\n\nconst sortableListHandleClassName =\n  'cursor-grab text-muted-foreground data-dragging:cursor-grabbing aria-disabled:opacity-50'\n\nconst sortableListMoveButtonClassName = 'text-muted-foreground aria-disabled:opacity-50'\n\nconst sortableListIconClassName = 'size-4'\n\nconst sortableListVerticalIconClassName = 'in-data-[orientation=horizontal]:hidden'\n\nconst sortableListHorizontalIconClassName = 'hidden in-data-[orientation=horizontal]:block'\n\nconst sortableListMoveHorizontalIconClassName =\n  'hidden in-data-[orientation=horizontal]:block rtl:-scale-x-100'\n\ntype SortableListMoveTarget = SortableListPrimitive.MoveButton.Props['to']\n\nconst verticalDots = [\n  [9, 12],\n  [9, 5],\n  [9, 19],\n  [15, 12],\n  [15, 5],\n  [15, 19],\n]\nconst horizontalDots = [\n  [12, 9],\n  [19, 9],\n  [5, 9],\n  [12, 15],\n  [19, 15],\n  [5, 15],\n]\n\nconst moveIcons: Record<SortableListMoveTarget, { vertical: string[]; horizontal: string[] }> = {\n  previous: { vertical: ['m18 15-6-6-6 6'], horizontal: ['m15 18-6-6 6-6'] },\n  next: { vertical: ['m6 9 6 6 6-6'], horizontal: ['m9 18 6-6-6-6'] },\n  first: {\n    vertical: ['m17 11-5-5-5 5', 'm17 18-5-5-5 5'],\n    horizontal: ['m11 17-5-5 5-5', 'm18 17-5-5 5-5'],\n  },\n  last: {\n    vertical: ['m7 6 5 5 5-5', 'm7 13 5 5 5-5'],\n    horizontal: ['m6 17 5-5-5-5', 'm13 17 5-5-5-5'],\n  },\n}\n\nfunction SvgIcon({ children, className, ...props }: React.ComponentProps<'svg'>) {\n  return (\n    <svg\n      xmlns=\"http://www.w3.org/2000/svg\"\n      viewBox=\"0 0 24 24\"\n      fill=\"none\"\n      stroke=\"currentColor\"\n      strokeWidth=\"2\"\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n      aria-hidden=\"true\"\n      className={cn(sortableListIconClassName, className)}\n      {...props}\n    >\n      {children}\n    </svg>\n  )\n}\n\nfunction SortableList({ className, ...props }: SortableListPrimitive.Root.Props) {\n  return (\n    <SortableListPrimitive.Root\n      data-slot=\"sortable-list\"\n      className={cn(sortableListClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction SortableListList({ className, ...props }: SortableListPrimitive.List.Props) {\n  return (\n    <SortableListPrimitive.List\n      data-slot=\"sortable-list-list\"\n      className={cn(sortableListListClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction SortableListItem({ className, ...props }: SortableListPrimitive.Item.Props) {\n  return (\n    <SortableListPrimitive.Item\n      data-slot=\"sortable-list-item\"\n      className={cn(sortableListItemClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction SortableListHandle({ className, children, ...props }: SortableListPrimitive.Handle.Props) {\n  return (\n    <SortableListPrimitive.Handle\n      data-slot=\"sortable-list-handle\"\n      className={cn(\n        buttonVariants({ variant: 'ghost', size: 'icon-xs' }),\n        sortableListHandleClassName,\n        className,\n      )}\n      {...props}\n    >\n      {children ?? (\n        <>\n          <SvgIcon className={sortableListVerticalIconClassName}>\n            {verticalDots.map(([cx, cy]) => (\n              <circle key={`${cx}-${cy}`} cx={cx} cy={cy} r=\"1\" />\n            ))}\n          </SvgIcon>\n          <SvgIcon className={sortableListHorizontalIconClassName}>\n            {horizontalDots.map(([cx, cy]) => (\n              <circle key={`${cx}-${cy}`} cx={cx} cy={cy} r=\"1\" />\n            ))}\n          </SvgIcon>\n        </>\n      )}\n    </SortableListPrimitive.Handle>\n  )\n}\n\nfunction SortableListMoveButton({\n  className,\n  children,\n  to,\n  ...props\n}: SortableListPrimitive.MoveButton.Props) {\n  return (\n    <SortableListPrimitive.MoveButton\n      data-slot=\"sortable-list-move-button\"\n      to={to}\n      className={cn(\n        buttonVariants({ variant: 'ghost', size: 'icon-xs' }),\n        sortableListMoveButtonClassName,\n        className,\n      )}\n      {...props}\n    >\n      {children ?? (\n        <>\n          <SvgIcon className={sortableListVerticalIconClassName}>\n            {moveIcons[to].vertical.map((d) => (\n              <path key={d} d={d} />\n            ))}\n          </SvgIcon>\n          <SvgIcon className={sortableListMoveHorizontalIconClassName}>\n            {moveIcons[to].horizontal.map((d) => (\n              <path key={d} d={d} />\n            ))}\n          </SvgIcon>\n        </>\n      )}\n    </SortableListPrimitive.MoveButton>\n  )\n}\n\nexport {\n  SortableList,\n  SortableListHandle,\n  SortableListItem,\n  SortableListList,\n  SortableListMoveButton,\n}\n",
      "type": "registry:ui",
      "target": "@ui/sortable-list.tsx"
    }
  ],
  "meta": {
    "baseUiNext": {
      "version": "0.1.1",
      "hash": "25481deabe5fae3139a67f5aed9b339859bed11d3bc41581d192102985c6ca67",
      "files": {
        "@ui/sortable-list.tsx": "22f46c5a3df986f1e89ec813904b46214d2e3d2a7289c9c0f38c8018ea476ea9"
      }
    }
  }
}
