"use client";
import { jsx } from "react/jsx-runtime";
import * as React from "react";
import { GripVertical } from "lucide-react";
import { cn } from "@open-mercato/shared/lib/utils";
import { IconButton } from "../../primitives/icon-button.js";
const SortableGroupHandleContext = React.createContext(null);
const SortableGroupHandleProvider = SortableGroupHandleContext.Provider;
function useSortableGroupHandle() {
  return React.useContext(SortableGroupHandleContext);
}
function SortableGroupHandle({ ariaLabel, className }) {
  const handle = useSortableGroupHandle();
  if (!handle) return null;
  const { ref, attributes, listeners, disabled } = handle;
  return /* @__PURE__ */ jsx(
    IconButton,
    {
      type: "button",
      variant: "ghost",
      size: "xs",
      ref,
      "aria-label": ariaLabel,
      disabled,
      className: cn(
        "cursor-grab text-muted-foreground hover:text-foreground active:cursor-grabbing focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-sm",
        className
      ),
      ...attributes,
      ...listeners ?? {},
      children: /* @__PURE__ */ jsx(GripVertical, { className: "size-4" })
    }
  );
}
export {
  SortableGroupHandle,
  SortableGroupHandleProvider,
  useSortableGroupHandle
};
//# sourceMappingURL=SortableGroupHandle.js.map
