/**
 * 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_useFocus = require("../../global/js/hooks/useFocus.js");
const require_devtools = require("../../global/js/utils/devtools.js");
const require_usePortalTarget = require("../../global/js/hooks/usePortalTarget.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/AboutModal/AboutModal.tsx
/**
* Copyright IBM Corp. 2020, 2021
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
var import_classnames = /* @__PURE__ */ require_runtime.__toESM(require_index.default);
const blockClass = `${require_settings.pkg.prefix}--about-modal`;
const componentName = "AboutModal";
/**
* The `AboutModal` component provides a way to communicate product information
* to users. It is triggered by a user’s action, appears on top of the main
* page content, and is persistent until dismissed. The purpose of this modal
* should be immediately apparent to the user, with a clear and obvious path
* to completion.
*/
const AboutModal = react.default.forwardRef(({ additionalInfo, className, closeIconDescription, copyrightText, content, links, logo, modalAriaLabel, onClose, open, portalTarget: portalTargetIn, title, version, ...rest }, ref) => {
	const bodyRef = (0, react.useRef)(null);
	const localRef = (0, react.useRef)(void 0);
	const modalRef = ref || localRef;
	const contentRef = (0, react.useRef)(null);
	const contentId = require_uuidv4.default();
	const renderPortalUse = require_usePortalTarget.usePortalTarget(portalTargetIn);
	const { claimFocus } = require_useFocus.useFocus(modalRef);
	(0, react.useEffect)(() => {
		bodyRef.current = contentRef.current?.parentElement;
	}, [bodyRef]);
	(0, react.useEffect)(() => {
		if (open) claimFocus();
	}, [modalRef, open]);
	return renderPortalUse(/* @__PURE__ */ react.default.createElement(_carbon_react.unstable_FeatureFlags, { enableExperimentalFocusWrapWithoutSentinels: true }, /* @__PURE__ */ react.default.createElement(_carbon_react.ComposedModal, {
		...rest,
		className: (0, import_classnames.default)(blockClass, className),
		"aria-label": modalAriaLabel,
		ref: modalRef,
		onClose,
		open,
		...require_devtools.getDevtoolsProps(componentName)
	}, /* @__PURE__ */ react.default.createElement("div", { className: `${blockClass}__logo` }, logo), /* @__PURE__ */ react.default.createElement(_carbon_react.ModalHeader, {
		className: `${blockClass}__header`,
		closeModal: onClose,
		iconDescription: closeIconDescription,
		label: title,
		labelClassName: `${blockClass}__title`
	}), /* @__PURE__ */ react.default.createElement(_carbon_react.ModalBody, { className: `${blockClass}__body` }, /* @__PURE__ */ react.default.createElement("div", {
		className: `${blockClass}__body-content`,
		ref: contentRef,
		id: contentId
	}, /* @__PURE__ */ react.default.createElement("div", { className: `${blockClass}__version` }, version), links && links.length > 0 && /* @__PURE__ */ react.default.createElement("div", { className: `${blockClass}__links-container` }, links.map((link, i) => /* @__PURE__ */ react.default.createElement(react.default.Fragment, { key: i }, link))), content && /* @__PURE__ */ react.default.createElement("p", { className: `${blockClass}__content` }, content), copyrightText && /* @__PURE__ */ react.default.createElement("p", { className: `${blockClass}__copyright-text` }, copyrightText))), additionalInfo && /* @__PURE__ */ react.default.createElement(_carbon_react.ModalFooter, { className: `${blockClass}__footer` }, additionalInfo))));
});
AboutModal.displayName = componentName;
AboutModal.propTypes = {
	/**
	* Provide additional detail for the modal footer, such as logos of
	* technologies used in the product, legally required for some products
	*/
	additionalInfo: prop_types.default.node,
	/**
	* Specify an optional className to be applied to the modal root node
	*/
	className: prop_types.default.string,
	/**
	* Provide an accessible name for the close icon
	*/
	closeIconDescription: prop_types.default.string.isRequired,
	/**
	* Provide any relevant product disclaimers or legal information
	*/
	content: prop_types.default.node,
	/**
	* Specify the first year of product release to the current year
	*/
	copyrightText: prop_types.default.string.isRequired,
	/**
	* Provide an array of Carbon `Link`s for additional detail about the
	* product
	*/
	links: prop_types.default.arrayOf(prop_types.default.element),
	/**
	* Provide a visual representation of the product
	*/
	logo: prop_types.default.node.isRequired,
	/**
	* Specify an aria-label for the modal
	*/
	modalAriaLabel: prop_types.default.string,
	/**
	* Specify an optional handler for closing modal. Returning `false`
	* prevents the modal from closing
	*/
	onClose: prop_types.default.func,
	/**
	* Specify whether the modal is currently open
	*/
	open: prop_types.default.bool,
	/**
	* Provide the DOM node where the modal should be rendered.
	* Defaults to `document.body`
	*/
	portalTarget: prop_types.default.node,
	/**
	* Provide the product name for the modal header
	*/
	title: prop_types.default.node.isRequired,
	/**
	* Provide the product’s version number
	*/
	version: prop_types.default.string.isRequired
};
//#endregion
exports.AboutModal = AboutModal;
