/**
 * 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_TearsheetWrapper = require("./Datagrid/addons/CustomizeColumns/TearsheetWrapper.js");
const require_ButtonWrapper = require("./Datagrid/addons/CustomizeColumns/ButtonWrapper.js");
let react = require("react");
react = require_runtime.__toESM(react);
//#region src/components/Datagrid/useCustomizeColumns.tsx
/**
* Copyright IBM Corp. 2021, 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 useInstance = (instance) => {
	const { customizeColumnsProps } = instance;
	const { labels } = customizeColumnsProps || {};
	const [isTearsheetOpen, setIsTearsheetOpen] = react.useState(false);
	const launcherButtonRef = react.useRef(null);
	const CustomizeColumnsButton = react.useCallback((props) => /* @__PURE__ */ react.createElement(require_ButtonWrapper.default, {
		...props,
		iconTooltipLabel: labels?.iconTooltipLabel,
		isTearsheetOpen,
		setIsTearsheetOpen,
		ref: launcherButtonRef
	}), [isTearsheetOpen, labels?.iconTooltipLabel]);
	const CustomizeColumnsTearsheet = react.useCallback((props) => /* @__PURE__ */ react.createElement(require_TearsheetWrapper.default, {
		...props,
		launcherButtonRef
	}), [launcherButtonRef]);
	Object.assign(instance, {
		customizeColumnsProps: {
			...customizeColumnsProps,
			isTearsheetOpen,
			setIsTearsheetOpen
		},
		CustomizeColumnsButton,
		CustomizeColumnsTearsheet
	});
};
const useCustomizeColumns = (hooks) => {
	hooks.useInstance.push(useInstance);
};
//#endregion
exports.default = useCustomizeColumns;
