var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
import React from "react";
import { cl } from "../../../utils/helpers/index.js";
import { useMergeRefs } from "../../../utils/hooks/index.js";
import { DragAndDropDragHandler } from "../drag-handler/DragAndDropDragHandler.js";
import { useDragAndDropContext } from "../root/DragAndDrop.context.js";
/**
 * TODO
 *
 * @see 🏷️ {@link DragAndDropItemProps}
 * @example
 * ```tsx
 * <DragAndDrop.Item numOfSelectedRows={selectedRows.length} onClear={handleClear}>
 *   TODO
 * </DragAndDrop.Item>
 * ```
 */
const DragAndDropItem = React.forwardRef((_a, forwardedRef) => {
    var _b;
    var { children, id, index, className, isOverlay = false, itemLabel } = _a, rest = __rest(_a, ["children", "id", "index", "className", "isOverlay", "itemLabel"]);
    const ref = React.useRef(null);
    const mergedRef = useMergeRefs(forwardedRef, ref);
    const context = useDragAndDropContext();
    const item = { id, index };
    const isDropTarget = ((_b = context === null || context === void 0 ? void 0 : context.dropTarget) === null || _b === void 0 ? void 0 : _b.id) === id;
    return (React.createElement("li", Object.assign({ id: isOverlay ? undefined : id }, rest, { ref: mergedRef, "data-dnd-id": isOverlay ? undefined : id, "data-dnd-index": isOverlay ? undefined : index, className: cl("aksel-data-table__drag-and-drop-item", className), "data-drop-target": isOverlay ? undefined : isDropTarget, "data-overlay": isOverlay }),
        React.createElement(DragAndDropDragHandler, { item: item, itemRef: ref, isOverlay: isOverlay, itemLabel: itemLabel }),
        React.createElement("div", null, children)));
});
export default DragAndDropItem;
export { DragAndDropItem };
//# sourceMappingURL=DragAndDropItem.js.map