"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = _default;
exports.switcherIconHandler = void 0;

var _react = _interopRequireDefault(require("react"));

var _classnames = _interopRequireDefault(require("classnames"));

var _rcTree = _interopRequireDefault(require("@titaui/rc-tree2"));

require("@titaui/rc-tree2/assets/index.css");

require("./index.css");

var _precls = _interopRequireDefault(require("./precls"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var switcherIconHandler = function switcherIconHandler(_ref) {
  var _classNames;

  var expanded = _ref.expanded,
      isLeaf = _ref.isLeaf;
  return /*#__PURE__*/_react["default"].createElement("span", {
    style: {
      visibility: isLeaf ? "hidden" : ""
    },
    className: (0, _classnames["default"])("".concat(_precls["default"], "__switcher"), (_classNames = {}, _defineProperty(_classNames, "".concat(_precls["default"], "__switcher-open"), expanded), _defineProperty(_classNames, "".concat(_precls["default"], "__switcher-close"), !expanded), _classNames))
  });
};

exports.switcherIconHandler = switcherIconHandler;

function _default(props) {
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(_precls["default"]))
  }, /*#__PURE__*/_react["default"].createElement(_rcTree["default"], _extends({
    icon: false,
    showIcon: false,
    checkable: false,
    multiple: false,
    selectNodeHighlight: false,
    motion: {
      motionName: "node-motion",
      motionAppear: false,
      onAppearStart: function onAppearStart() {
        return {
          height: 0
        };
      },
      onAppearActive: function onAppearActive(node) {
        return {
          height: node.scrollHeight
        };
      },
      onLeaveStart: function onLeaveStart(node) {
        return {
          height: node.offsetHeight
        };
      },
      onLeaveActive: function onLeaveActive() {
        return {
          height: 0
        };
      }
    },
    switcherIcon: switcherIconHandler,
    showIndicator: false // dropIndicatorRender={() => <span />}

  }, props)));
}