"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 Side_stories_exports = {};
__export(Side_stories_exports, {
  Default: () => Default,
  default: () => Side_stories_default
});
module.exports = __toCommonJS(Side_stories_exports);
var import_react = __toESM(require("react"));
var import_styled_components = __toESM(require("styled-components"));
var import_Button = __toESM(require("../../cta/Button"));
var import_helpers = require("../../helpers");
var import_index = __toESM(require("./index"));
var import_Provider = __toESM(require("./Provider"));
const DummyContentWrapper = import_styled_components.default.div`
  width: 100%;
  background-color: ${(p) => p.color};
  align-items: center;
  padding: ${(p) => p.theme.space[4]}px;
`;
const onBackLvl1 = () => (0, import_Provider.setSide)(DummyContent, {
  left: true
});
const onBackLvl2 = () => (0, import_Provider.setSide)(DummySubContentLvl1, {
  onBack: onBackLvl1,
  left: true
});
const DummyContent = () => /* @__PURE__ */ import_react.default.createElement(DummyContentWrapper, { color: "#957DAD" }, /* @__PURE__ */ import_react.default.createElement(
  import_Button.default,
  {
    onClick: () => (0, import_Provider.setSide)(DummySubContentLvl1, {
      onBack: onBackLvl1,
      left: true
    })
  },
  "Go to level 2"
));
const DummySubContentLvl1 = () => /* @__PURE__ */ import_react.default.createElement(DummyContentWrapper, { color: "#E0BBE4" }, /* @__PURE__ */ import_react.default.createElement(
  import_Button.default,
  {
    onClick: () => (0, import_Provider.setSide)(DummySubContentLvl2, {
      onBack: onBackLvl2,
      left: true
    })
  },
  "Go to level 3"
), /* @__PURE__ */ import_react.default.createElement("div", null, import_helpers.lipsum));
const DummySubContentLvl2 = () => /* @__PURE__ */ import_react.default.createElement(DummyContentWrapper, { color: "#FEC8D8" }, /* @__PURE__ */ import_react.default.createElement("div", null, import_helpers.lipsum));
const components = {
  DummyContent,
  DummySubContentLvl1,
  DummySubContentLvl2
};
var Side_stories_default = {
  title: "Layout/Drawer/Side",
  component: import_index.default,
  argTypes: {
    isOpen: {
      type: "boolean",
      value: true,
      description: "Is open",
      required: false,
      control: {
        type: "boolean"
      }
    },
    title: {
      type: "text",
      description: "Side default title",
      control: {
        type: "text"
      },
      required: false
    },
    big: {
      type: "boolean",
      value: true,
      description: "Larger width side drawer.",
      required: false,
      control: {
        type: "boolean"
      }
    }
  },
  args: {
    title: "Default title",
    isOpen: true
  }
};
const Template = (args) => {
  const onClose = (0, import_react.useCallback)(() => (0, import_Provider.setSide)(null), []);
  const onOpen = (0, import_react.useCallback)(() => (0, import_Provider.setSide)(components.DummyContent), []);
  (0, import_react.useEffect)(() => {
    if (args.isOpen)
      onOpen();
    if (!args.isOpen)
      onClose();
  }, [args.isOpen, onClose, onOpen]);
  return /* @__PURE__ */ import_react.default.createElement(import_Provider.default, null, /* @__PURE__ */ import_react.default.createElement(import_index.default, { ...args }));
};
const Default = Template.bind({});
Default.args = {};
//# sourceMappingURL=Side.stories.js.map
