import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
import React, { useEffect } from "react";
import classNames from "classnames";
import Popup from "../popup";
import { handleClick } from "./utils";
import { OffsetContext } from "./context";
import { ComponentDefaults } from "../../utils/typings";
var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
    position: 'left',
    width: '80%'
});
export var SideNavBar = function(props) {
    useEffect(function() {
        console.warn('Warning: SideNavBar is deprecated and will be removed in future versions. Please use NewComponent SideBar instead.');
    }, []);
    var classPrefix = 'nut-sidenavbar';
    var _ref = _object_spread({}, defaultProps, props), title = _ref.title, visible = _ref.visible, width = _ref.width, position = _ref.position, children = _ref.children, className = _ref.className, onClose = _ref.onClose, indent = _ref.indent, rest = _object_without_properties(_ref, [
        "title",
        "visible",
        "width",
        "position",
        "children",
        "className",
        "onClose",
        "indent"
    ]);
    var innerIndent = indent ? Number(indent) : 20;
    return /*#__PURE__*/ React.createElement(Popup, {
        visible: visible,
        style: {
            width: width,
            height: '100%'
        },
        position: position,
        onClose: onClose
    }, /*#__PURE__*/ React.createElement("div", _object_spread({
        className: classNames(classPrefix, className)
    }, rest), /*#__PURE__*/ React.createElement("div", {
        className: "".concat(classPrefix, "-content")
    }, /*#__PURE__*/ React.createElement("div", {
        className: "".concat(classPrefix, "-list sidenavbar-show"),
        onClick: handleClick
    }, /*#__PURE__*/ React.createElement("div", {
        className: "".concat(classPrefix, "-title ").concat(classPrefix, "-border-bt"),
        style: {
            paddingLeft: "".concat(innerIndent, "px")
        }
    }, title, " ", /*#__PURE__*/ React.createElement("i", {
        className: "arrow-icon arrow-down"
    })), /*#__PURE__*/ React.createElement(OffsetContext.Provider, {
        value: innerIndent
    }, /*#__PURE__*/ React.createElement("div", {
        className: "".concat(classPrefix, "-content")
    }, children))))));
};
SideNavBar.displayName = 'NutSideNavBar';
