"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var SideBar_exports = {};
__export(SideBar_exports, {
  default: () => SideBar_default
});
module.exports = __toCommonJS(SideBar_exports);
var import_react = __toESM(require("react"));
var import_react_transition_group = require("react-transition-group");
var import_styled_components = __toESM(require("styled-components"));
var import_sideBar = __toESM(require("../../../navigation/sideBar"));
var import_Flex = __toESM(require("../../../layout/Flex"));
var import_Item = __toESM(require("../../../navigation/sideBar/Item"));
var import_Logo = __toESM(require("../../../navigation/sideBar/Logo"));
var import_Toggle = __toESM(require("../../../navigation/sideBar/Toggle"));
const Nav = (0, import_styled_components.default)(import_Flex.default)`
  position: relative;
  padding: ${(p) => `${p.theme.space[19]}px ${p.theme.space[5]}px 0`};
  row-gap: 1.5rem;
  height: 100vh;
  width: 14.875rem;
  color: ${(props) => props.theme.colors.neutral.c100};
  border-right: 1px solid ${(props) => props.theme.colors.neutral.c40};
  background-color: ${(props) => props.theme.colors.background.main};
  transition: width 200ms;
  will-change: width;
  flex-shrink: 0;
  z-index: ${(p) => p.theme.zIndexes[2]};

  &.nav-enter {
    width: ${(p) => p.theme.space[19]}px;
  }
  &.nav-enter-done {
    width: 14.875rem;
  }
  &.nav-exit {
    width: 14.875rem;
  }
  &.nav-exit-done {
    width: ${(p) => `${p.theme.space[19]}px`};
  }
`;
const TransparentMouseZone = import_styled_components.default.div`
  position: absolute;
  left: 100%;
  top: 0;
  width: ${(p) => `${p.theme.space[8]}px`};
  height: 100%;
`;
const SideBar = ({ children, onToggle, isExpanded = true }) => {
  const [isToggleDisplayed, setToggleDisplayed] = (0, import_react.useState)(false);
  const providerValue = (0, import_react.useMemo)(() => ({ isExpanded, onToggle }), [isExpanded, onToggle]);
  return /* @__PURE__ */ import_react.default.createElement(import_sideBar.default.Provider, { value: providerValue }, /* @__PURE__ */ import_react.default.createElement(import_react_transition_group.CSSTransition, { in: isExpanded, timeout: 200, classNames: "nav" }, /* @__PURE__ */ import_react.default.createElement(
    Nav,
    {
      flexDirection: "column",
      justifyContent: "flex-start",
      alignContent: "stretch",
      role: "navigation",
      "aria-label": "Main",
      onMouseEnter: () => setToggleDisplayed(true),
      onMouseLeave: () => setToggleDisplayed(false)
    },
    /* @__PURE__ */ import_react.default.createElement(TransparentMouseZone, null),
    /* @__PURE__ */ import_react.default.createElement(import_Toggle.default, { isDisplayed: isToggleDisplayed }),
    /* @__PURE__ */ import_react.default.createElement(import_Logo.default, null),
    /* @__PURE__ */ import_react.default.createElement(import_Flex.default, { flexDirection: "column", justifyContent: "flex-start", alignContent: "stretch" }, children)
  )));
};
SideBar.Item = import_Item.default;
var SideBar_default = SideBar;
//# sourceMappingURL=SideBar.js.map
