import { useEffect as e, useRef as t, useState as n } from "react";
import r from "prop-types";
import { jsx as i, jsxs as a } from "react/jsx-runtime";
import o from "classnames";
//#region src/plugins/dropdown-menu/components/DropdownMenu/DropdownMenu.jsx
var s = ({ children: r = [], label: s, isLong: c = !1 }) => {
	let l = t(null), [u, d] = n(!1), f = (e) => {
		l.current !== null && !l.current.contains(e.target) && d(!1);
	}, p = () => {
		d(!u);
	};
	return e(() => (document.addEventListener("mousedown", f), () => {
		document.removeEventListener("mousedown", f);
	}), []), /* @__PURE__ */ a("div", {
		className: o("dd-menu dd-menu-left", { long: c }),
		ref: l,
		children: [/* @__PURE__ */ i("span", {
			className: "menu-item",
			role: "button",
			tabIndex: 0,
			"aria-haspopup": "true",
			"aria-expanded": u,
			onClick: p,
			children: s
		}), u && /* @__PURE__ */ i("div", {
			className: "dd-menu-items",
			"aria-labelledby": "Dropdown",
			onClick: p,
			role: "menu",
			tabIndex: 0,
			children: /* @__PURE__ */ i("ul", {
				className: "dd-items-left",
				children: r
			})
		})]
	});
};
s.propTypes = {
	label: r.string.isRequired,
	children: r.oneOfType([r.array, r.element]),
	isLong: r.bool
};
//#endregion
//#region src/plugins/dropdown-menu/components/DropdownMenuNested/DropdownMenuNested.jsx
var c = ({ children: e = [], label: t, isLong: r = !1 }) => {
	let [s, c] = n(!1);
	return /* @__PURE__ */ a("li", {
		className: o("nested-dd-menu nested-reverse", { long: r }),
		onMouseEnter: () => {
			c(!0);
		},
		onMouseLeave: () => {
			c(!1);
		},
		children: [/* @__PURE__ */ a("button", {
			type: "button",
			children: [
				t,
				"\xA0\xA0",
				/* @__PURE__ */ i("b", { children: ">" })
			]
		}), /* @__PURE__ */ i("span", {
			className: "dd-item-ignore",
			children: s && /* @__PURE__ */ i("ul", { children: e })
		})]
	});
};
c.propTypes = {
	label: r.string.isRequired,
	children: r.oneOfType([r.array, r.element]),
	isLong: r.bool
};
//#endregion
//#region src/plugins/dropdown-menu/components/DropdownMenuItem/DropdownMenuItem.jsx
var l = ({ children: e, onClick: t }) => /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i("li", {
	className: "dropdown-item",
	children: /* @__PURE__ */ i("button", {
		type: "button",
		onClick: t,
		children: e
	})
}) });
l.propTypes = {
	children: r.node.isRequired,
	onClick: r.func.isRequired
};
//#endregion
//#region src/plugins/dropdown-menu/components/DropdownMenuItemDivider.jsx
var u = () => /* @__PURE__ */ i("li", { role: "separator" }), d = () => ({ components: {
	DropdownMenu: s,
	DropdownMenuNested: c,
	DropdownMenuItem: l,
	DropdownMenuItemDivider: u
} });
//#endregion
export { d as default };

//# sourceMappingURL=index.js.map