"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 DropdownGeneric_stories_exports = {};
__export(DropdownGeneric_stories_exports, {
  DropdownGeneric: () => DropdownGeneric,
  default: () => DropdownGeneric_stories_default
});
module.exports = __toCommonJS(DropdownGeneric_stories_exports);
var import_react = __toESM(require("react"));
var import_Flex = __toESM(require("../../layout/Flex"));
var import_Box = __toESM(require("../../layout/Box"));
var import_Text = __toESM(require("../../asorted/Text"));
var import_Alert = __toESM(require("../../message/Alert"));
var import__ = __toESM(require("."));
var import_Divider = __toESM(require("../../asorted/Divider"));
const SmallChild = () => /* @__PURE__ */ import_react.default.createElement(
  import_Flex.default,
  {
    height: 200,
    width: 180,
    padding: 10,
    backgroundColor: "neutral.c30",
    justifyContent: "center",
    alignItems: "center"
  },
  /* @__PURE__ */ import_react.default.createElement(import_Text.default, { variant: "small", color: "neutral.c60", textAlign: "center" }, "I'm a simple div with a grey background and no margin passed as children of the dropdown component.")
);
const BigChild = ({ containerProps }) => /* @__PURE__ */ import_react.default.createElement(
  import_Box.default,
  {
    padding: 10,
    flexDirection: "column",
    width: "300px",
    justifyContent: "center",
    alignItems: "center",
    ...containerProps
  },
  /* @__PURE__ */ import_react.default.createElement(import_Text.default, { variant: "small", color: "neutral.c60", textAlign: "center" }, "If the children node of the dropdown is bigger than the available space, the dropdown will restrict its own height to avoid overflowing and its inner container will scroll."),
  /* @__PURE__ */ import_react.default.createElement(import_Box.default, { height: "100px", width: "100%", backgroundColor: "primary.c100" }),
  /* @__PURE__ */ import_react.default.createElement(import_Box.default, { height: "100px", width: "100%", backgroundColor: "primary.c90" }),
  /* @__PURE__ */ import_react.default.createElement(import_Box.default, { height: "100px", width: "100%", backgroundColor: "primary.c80" }),
  /* @__PURE__ */ import_react.default.createElement(import_Box.default, { height: "100px", width: "100%", backgroundColor: "primary.c70" }),
  /* @__PURE__ */ import_react.default.createElement(import_Box.default, { height: "100px", width: "100%", backgroundColor: "primary.c60" })
);
const BottomPlaceholder = () => /* @__PURE__ */ import_react.default.createElement(
  import_Flex.default,
  {
    width: "100%",
    height: "100px",
    backgroundColor: "neutral.c30",
    justifyContent: "center",
    alignItems: "center",
    padding: 20
  },
  /* @__PURE__ */ import_react.default.createElement(import_Text.default, { variant: "small", color: "palette.neutral.c50", textAlign: "center" }, "Ignore me, I'm just an item placed below to illustrate that the dropdown is a floating component")
);
const DropdownStoryTemplate = (props) => {
  const { containerProps = {}, big = false, bigWithMaxHeight = false, ...rest } = props;
  return /* @__PURE__ */ import_react.default.createElement(import_Flex.default, { flexDirection: "column", ...containerProps }, /* @__PURE__ */ import_react.default.createElement(import__.default, { ...rest }, big ? bigWithMaxHeight ? /* @__PURE__ */ import_react.default.createElement(BigChild, { containerProps: { maxHeight: "400px", overflow: "scroll" } }) : /* @__PURE__ */ import_react.default.createElement(BigChild, null) : /* @__PURE__ */ import_react.default.createElement(SmallChild, null)), /* @__PURE__ */ import_react.default.createElement(BottomPlaceholder, null));
};
const DropdownGeneric = (args) => {
  const alignItemsPossibilities = ["flex-start", "center", "flex-end"];
  const containerPropsPossibilities = alignItemsPossibilities.map((alignItems) => ({ alignItems }));
  return /* @__PURE__ */ import_react.default.createElement(import_Flex.default, { flexDirection: "column", rowGap: 5 }, /* @__PURE__ */ import_react.default.createElement(import_Text.default, { variant: "h5" }, "Small content:"), containerPropsPossibilities.map(
    (containerProps) => DropdownStoryTemplate({ ...args, containerProps })
  ), /* @__PURE__ */ import_react.default.createElement(import_Divider.default, null), /* @__PURE__ */ import_react.default.createElement(import_Text.default, { variant: "h5" }, "Big content:"), containerPropsPossibilities.map(
    (containerProps) => DropdownStoryTemplate({ ...args, big: true, containerProps })
  ), /* @__PURE__ */ import_react.default.createElement(import_Divider.default, null), /* @__PURE__ */ import_react.default.createElement(import_Text.default, { variant: "h5" }, "Big content (max height on child)"), /* @__PURE__ */ import_react.default.createElement(
    import_Alert.default,
    {
      type: "info",
      title: "In the following examples, the component passed as a child has its own internal maxHeight\n        setup"
    }
  ), containerPropsPossibilities.map(
    (containerProps) => DropdownStoryTemplate({ ...args, big: true, bigWithMaxHeight: true, containerProps })
  ));
};
var DropdownGeneric_stories_default = {
  title: "Form/SelectAndDialogs",
  component: import__.default,
  argTypes: {
    label: { type: "string" },
    placement: { control: { type: "select" } },
    closeOnClickOutside: { type: "boolean" },
    closeOnClickInside: { type: "boolean" },
    disabled: { type: "boolean" },
    flipDisabled: { type: "boolean" }
  },
  args: {
    label: "Label",
    placement: "bottom",
    closeOnClickOutside: true,
    closeOnClickInside: false,
    disabled: false,
    flipDisabled: false
  }
};
//# sourceMappingURL=DropdownGeneric.stories.js.map
