/**
 * Copyright IBM Corp. 2020, 2026
 *
 * This source code is licensed under the Apache-2.0 license found in the
 * LICENSE file in the root directory of this source tree.
 */

const require_runtime = require("../../_virtual/_rolldown/runtime.js");
const require_index = require("../../node_modules/classnames/index.js");
const require_settings = require("../../settings.js");
const require_uuidv4 = require("../../global/js/utils/uuidv4.js");
let react = require("react");
react = require_runtime.__toESM(react);
let prop_types = require("prop-types");
prop_types = require_runtime.__toESM(prop_types);
let _carbon_react = require("@carbon/react");
//#region src/components/ActionBar/ActionBarOverflowItems.tsx
var import_classnames = /* @__PURE__ */ require_runtime.__toESM(require_index.default);
const blockClass = `${require_settings.pkg.prefix}--action-bar-overflow-items`;
const componentName = "ActionBar";
const ActionBarOverflowItems = ({ className, menuOptionsClass, overflowItems, overflowAriaLabel, overflowMenuRef }) => {
	const internalId = (0, react.useRef)(require_uuidv4.default());
	return /* @__PURE__ */ react.default.createElement("div", { ref: overflowMenuRef }, /* @__PURE__ */ react.default.createElement(_carbon_react.OverflowMenu, {
		"aria-label": overflowAriaLabel,
		className: (0, import_classnames.default)(blockClass, className),
		direction: "bottom",
		flipped: true,
		iconDescription: overflowAriaLabel,
		menuOptionsClass: (0, import_classnames.default)(`${blockClass}__options`, menuOptionsClass)
	}, react.default.Children.map(overflowItems, (item, index) => {
		const ItemIcon = item?.props.renderIcon;
		return /* @__PURE__ */ react.default.createElement(_carbon_react.OverflowMenuItem, {
			className: `${blockClass}__item`,
			onClick: item?.props.onClick,
			itemText: /* @__PURE__ */ react.default.createElement("div", {
				className: `${blockClass}__item-content`,
				"aria-describedby": `${internalId.current}-${index}--item-label`
			}, /* @__PURE__ */ react.default.createElement("span", {
				className: `${blockClass}__item-label`,
				id: `${internalId.current}-${index}--item-label`
			}, item?.props.label), typeof item?.props.renderIcon === "function" ? /* @__PURE__ */ react.default.createElement(ItemIcon, null) : item?.props.renderIcon)
		});
	})));
};
ActionBarOverflowItems.displayName = componentName;
ActionBarOverflowItems.propTypes = {
	/**
	* className
	*/
	className: prop_types.default.string,
	/**
	* class name applied to the overflow options
	*/
	menuOptionsClass: prop_types.default.string,
	/**
	* overflowAriaLabel label for open close button overflow used for action bar items that do nto fit.
	*/
	overflowAriaLabel: prop_types.default.string,
	/**
	* overflowItems: items to bre shown in the ActionBar overflow menu
	*/
	overflowItems: prop_types.default.arrayOf(prop_types.default.element),
	/**
	* overflowMenuRef for the overflow menu width that is needed to calculate the width of the action bar with overflow
	*/
	/**@ts-ignore */
	overflowMenuRef: prop_types.default.oneOfType([
		prop_types.default.shape({ current: prop_types.default.elementType }),
		prop_types.default.object,
		prop_types.default.func
	]),
	/**
	* Optional tab index
	*/
	tabIndex: prop_types.default.number
};
//#endregion
exports.ActionBarOverflowItems = ActionBarOverflowItems;
