"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.listItemSectionBuilder = exports.default = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireDefault(require("react"));
var _Divider = _interopRequireDefault(require("../Divider"));
var _Text = _interopRequireWildcard(require("../Text"));
var _TextButton = _interopRequireDefault(require("../TextButton"));
var _StringUtils = require("../utils/StringUtils");
var _ListItemSection = require("./ListItemSection.constants");
var _ListItemSectionSt = require("./ListItemSection.st.css.js");
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/ListItemSection/ListItemSection.tsx";
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
var ListItemSection = _ref => {
  var {
    type = _ListItemSection.TYPES.TITLE,
    ellipsis = false,
    dataHook,
    className,
    title,
    suffix,
    onClick
  } = _ref;
  var isSeparatorElement = type === _ListItemSection.TYPES.WHITESPACE || type === _ListItemSection.TYPES.DIVIDER;
  var isSubheader = type === _ListItemSection.TYPES.SUBHEADER;
  if (isSeparatorElement) {
    return /*#__PURE__*/_react.default.createElement("div", {
      className: (0, _ListItemSectionSt.st)(_ListItemSectionSt.classes.root, {
        [type]: true
      }),
      "data-hook": dataHook,
      onClick: e => e.stopPropagation(),
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 29,
        columnNumber: 7
      }
    }, type === _ListItemSection.TYPES.DIVIDER && /*#__PURE__*/_react.default.createElement(_Divider.default, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 34,
        columnNumber: 36
      }
    }));
  }
  return /*#__PURE__*/_react.default.createElement("div", {
    className: (0, _ListItemSectionSt.st)(_ListItemSectionSt.classes.root, {
      subheader: isSubheader,
      ellipsis,
      suffix: !!suffix
    }, className),
    "data-hook": dataHook,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 40,
      columnNumber: 5
    }
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _ListItemSectionSt.classes.titleWrapper,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 52,
      columnNumber: 7
    }
  }, /*#__PURE__*/_react.default.createElement(_Text.default, {
    dataHook: _ListItemSection.dataHooks.TITLE,
    tagName: "div",
    size: "small",
    className: _ListItemSectionSt.classes.title,
    ellipsis: ellipsis,
    enterDelay: 300,
    weight: isSubheader ? _Text.WEIGHTS.normal : _Text.WEIGHTS.bold,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 53,
      columnNumber: 9
    }
  }, title)), suffix && (0, _StringUtils.isString)(suffix) && /*#__PURE__*/_react.default.createElement("div", {
    className: _ListItemSectionSt.classes.suffixWrapper,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 66,
      columnNumber: 9
    }
  }, /*#__PURE__*/_react.default.createElement(_TextButton.default, {
    ellipsis: ellipsis,
    dataHook: _ListItemSection.dataHooks.SUFFIX,
    size: "tiny",
    onClick: onClick,
    className: _ListItemSectionSt.classes.suffix,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 67,
      columnNumber: 11
    }
  }, suffix)), suffix && !(0, _StringUtils.isString)(suffix) && /*#__PURE__*/_react.default.createElement("div", {
    "data-hook": _ListItemSection.dataHooks.SUFFIX,
    className: _ListItemSectionSt.classes.suffixWrapper,
    onClick: onClick,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 79,
      columnNumber: 9
    }
  }, suffix));
};
ListItemSection.displayName = 'ListItemSection';
var _default = exports.default = ListItemSection;
var listItemSectionBuilder = _ref2 => {
  var {
    id,
    className,
    dataHook,
    type,
    title,
    suffix,
    ellipsis
  } = _ref2;
  return {
    id,
    overrideOptionStyle: true,
    disabled: true,
    prefix: undefined,
    label: undefined,
    value: props => /*#__PURE__*/_react.default.createElement(ListItemSection, (0, _extends2.default)({
      className: className,
      dataHook: dataHook,
      type: type,
      title: title,
      suffix: suffix,
      ellipsis: ellipsis
    }, props, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 110,
        columnNumber: 5
      }
    }))
  };
};
exports.listItemSectionBuilder = listItemSectionBuilder;
//# sourceMappingURL=ListItemSection.js.map