"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.PickerTableListItem = PickerTableListItem;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireDefault(require("react"));
var _designSystem = require("@wix/design-system");
var _wixUiIconsCommon = require("@wix/wix-ui-icons-common");
var _PickerTableListItemStCss = require("./PickerTableListItem.st.css.js");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/PickerTableListItem/PickerTableListItem.tsx";
function PickerTableListItem(props) {
  const {
    dataHook,
    showDivider,
    keyedItem,
    state,
    primaryAction,
    primaryActionWidth = 'auto',
    title,
    subtitle,
    extraNode,
    disabled,
    checkbox,
    multiple,
    options: optionsProp = [],
    ...tableListItemProps
  } = props;
  const {
    collection
  } = state;
  const name = collection.itemName(keyedItem.item);
  const {
    start,
    end
  } = optionsProp.reduce((prev, current) => {
    const column = {
      value: undefined,
      ...current
    };
    if (current.end) {
      prev.end.push(column);
    } else {
      prev.start.push(column);
    }
    return prev;
  }, {
    start: [],
    end: []
  });
  if (!start.length) {
    start.push({
      align: 'left',
      width: '84px',
      value: /*#__PURE__*/_react.default.createElement(_designSystem.Avatar, {
        size: "size60",
        name: name,
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 75,
          columnNumber: 16
        }
      })
    }, {
      align: 'left',
      value: /*#__PURE__*/_react.default.createElement(_designSystem.Text, {
        dataHook: "selector-title",
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 79,
          columnNumber: 16
        }
      }, name)
    });
  }
  const options = [...start, {
    width: primaryActionWidth,
    value: primaryAction || /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.ChevronRightLarge, {
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 88,
        columnNumber: 31
      }
    }),
    align: 'right'
  }, ...end];
  return /*#__PURE__*/_react.default.createElement(_designSystem.TableListItem, (0, _extends2.default)({
    className: (0, _PickerTableListItemStCss.st)(_PickerTableListItemStCss.classes.root),
    verticalPadding: "medium",
    dataHook: dataHook
  }, tableListItemProps, {
    options: options,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 95,
      columnNumber: 5
    }
  }));
}
//# sourceMappingURL=PickerTableListItem.js.map