/**
 * 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.
 */

import { __toESM } from "../../_virtual/_rolldown/runtime.js";
import { require_classnames } from "../../node_modules/classnames/index.js";
import { pkg } from "../../settings.js";
import { AddSelectRow } from "./AddSelectRow.js";
import useFocus from "./hooks/useFocus.js";
import React from "react";
import PropTypes from "prop-types";

//#region src/components/AddSelect/AddSelectList.jsx
var import_classnames = /* @__PURE__ */ __toESM(require_classnames());
const blockClass = `${pkg.prefix}--add-select__selections`;
const componentName = "AddSelectList";
let AddSelectList = ({ filteredItems, multi, ...rest }) => {
	const [focus, setFocus] = useFocus(filteredItems.length);
	return /* @__PURE__ */ React.createElement("div", {
		id: "add-select-focus",
		className: (0, import_classnames.default)(`${blockClass}-wrapper`, { [`${blockClass}-wrapper-multi`]: multi })
	}, /* @__PURE__ */ React.createElement("div", { className: `${blockClass}` }, /* @__PURE__ */ React.createElement("div", {
		className: `${blockClass}-body`,
		role: "treegrid",
		"aria-label": "add select tree label"
	}, filteredItems.map((item, index) => /* @__PURE__ */ React.createElement(AddSelectRow, {
		key: item.id,
		index,
		focus,
		setSize: filteredItems.length,
		item,
		multi,
		setFocus,
		...rest
	})))));
};
AddSelectList.propTypes = {
	filteredItems: PropTypes.array,
	focus: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
	multi: PropTypes.bool
};
AddSelectList.displayName = componentName;

//#endregion
export { AddSelectList };