var __assign = this && this.__assign || function () {
  __assign = Object.assign || function (t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
      s = arguments[i];

      for (var p in s) {
        if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
      }
    }

    return t;
  };

  return __assign.apply(this, arguments);
};

import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import * as React from 'react';
import { Draggable } from 'react-beautiful-dnd';
import Icon from "../icon";
var itemCls = "dmc-sort-list-item";
var handleCls = itemCls + "-handle";
var labelCls = itemCls + "-label";

var SortListItem = function SortListItem(props) {
  var item = props.item,
      index = props.index,
      renderItem = props.renderItem,
      valueKey = props.valueKey,
      labelKey = props.labelKey,
      removable = props.removable,
      disabled = props.disabled,
      isObj = props.isObj;
  var key = isObj ? item[valueKey] : item;
  return _jsx(Draggable, __assign({
    index: index,
    isDragDisabled: disabled,
    draggableId: key
  }, {
    children: function children(provided) {
      return renderItem ? renderItem(provided, item, index) : _jsxs("div", __assign({
        ref: provided.innerRef
      }, provided.draggableProps, {
        className: itemCls
      }, {
        children: [!disabled && _jsx(Icon, __assign({
          icon: "drag-handle",
          className: handleCls
        }, provided.dragHandleProps), void 0), _jsx("div", __assign({
          className: labelCls
        }, {
          children: isObj ? item[labelKey] : item
        }), void 0), removable && _jsx(Icon, {
          icon: "close"
        }, void 0)]
      }), void 0);
    }
  }), void 0);
};

SortListItem.displayName = 'SortListItem';
export default SortListItem;
var SortListItemMemo = /*#__PURE__*/React.memo(SortListItem);
SortListItemMemo.displayName = 'SortListItemMemo';
export { SortListItemMemo };

