/**
 * 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 { blockClass } from "../utils/util.js";
import { ConditionBuilderContext } from "../ConditionBuilderContext/ConditionBuilderProvider.js";
import { useTranslations } from "../utils/useTranslations.js";
import { ConditionBuilderItem } from "../ConditionBuilderItem/ConditionBuilderItem.js";
import { ItemOption } from "../ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js";
import { useDataConfigs } from "../utils/useDataConfigs.js";
import React, { useContext } from "react";
//#region src/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.jsx
/**
* Copyright IBM Corp. 2024
*
* 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 GroupConnector = () => {
	const { rootState, setRootState } = useContext(ConditionBuilderContext);
	const [conditionText] = useTranslations(["conditionText"]);
	const { connectorConfig } = useDataConfigs();
	const onStatementChangeHandler = (updatedStatement) => {
		setRootState({
			...rootState,
			operator: updatedStatement
		});
	};
	return /* @__PURE__ */ React.createElement("div", {
		className: `${blockClass}__group-separator ${blockClass}__group-separator-row`,
		role: "row",
		tabIndex: -1,
		"aria-level": 1
	}, /* @__PURE__ */ React.createElement(ConditionBuilderItem, {
		label: rootState.operator,
		title: conditionText,
		"data-name": "connectorField",
		popOverClassName: `${blockClass}__gap ${blockClass}__groupConnector`,
		className: `${blockClass}__statement-button`
	}, /* @__PURE__ */ React.createElement(ItemOption, {
		conditionState: {
			value: rootState.operator,
			label: conditionText
		},
		onChange: onStatementChangeHandler,
		config: { options: connectorConfig }
	})));
};
//#endregion
export { GroupConnector as default };
