/**
 * 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 { getDevtoolsProps } from "../../global/js/utils/devtools.js";
import "../../global/js/utils/props-helper.js";
import uuidv4 from "../../global/js/utils/uuidv4.js";
import { SidePanel } from "../SidePanel/SidePanel.js";
import React from "react";
import PropTypes from "prop-types";
import { Form } from "@carbon/react";

//#region src/components/EditSidePanel/EditSidePanel.tsx
var import_classnames = /* @__PURE__ */ __toESM(require_classnames());
const blockClass = `${pkg.prefix}--edit-side-panel`;
const componentName = "EditSidePanel";
/**
* **This component is deprecated.** <br>
* Use with medium complexity edits if the user needs page context.
* @deprecated
*/
const EditSidePanel = React.forwardRef(({ children, className, disableSubmit, id, formTitle, formDescription, onRequestClose, onRequestSubmit, open, placement = "right", primaryButtonText, secondaryButtonText, selectorPrimaryFocus, selectorPageContent, size = "md", slideIn, subtitle, title, ...rest }, ref) => {
	const actions = [{
		label: primaryButtonText,
		onClick: (event) => {
			event.preventDefault();
			onRequestSubmit?.();
		},
		kind: "primary",
		disabled: disableSubmit,
		type: "submit"
	}, {
		label: secondaryButtonText,
		onClick: onRequestClose,
		kind: "secondary"
	}];
	const formTitleId = uuidv4();
	return /* @__PURE__ */ React.createElement(SidePanel, {
		...rest,
		open,
		ref,
		selectorPageContent,
		onRequestClose,
		title,
		subtitle,
		selectorPrimaryFocus,
		id,
		...getDevtoolsProps(componentName),
		placement,
		slideIn,
		animateTitle: false,
		className: (0, import_classnames.default)(blockClass, className),
		size,
		preventCloseOnClickOutside: true,
		actions
	}, formTitle && /* @__PURE__ */ React.createElement("h3", {
		id: formTitleId,
		className: `${blockClass}__form-title-text ${blockClass}__content-text`
	}, formTitle), formDescription && /* @__PURE__ */ React.createElement("p", { className: `${blockClass}__form-description-text ${blockClass}__content-text` }, formDescription), /* @__PURE__ */ React.createElement(Form, {
		className: `${blockClass}__form`,
		"aria-labelledby": formTitleId
	}, children));
});
/**@ts-ignore*/
EditSidePanel.deprecated = {
	level: "warn",
	details: `This component is deprecated and will be removed in the next major version.`
};
EditSidePanel.displayName = componentName;
EditSidePanel.propTypes = {
	children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
	className: PropTypes.string,
	disableSubmit: PropTypes.bool,
	formDescription: PropTypes.node,
	formTitle: PropTypes.node.isRequired,
	id: PropTypes.string,
	onRequestClose: PropTypes.func,
	onRequestSubmit: PropTypes.func,
	open: PropTypes.bool.isRequired,
	placement: PropTypes.oneOf(["left", "right"]),
	primaryButtonText: PropTypes.string.isRequired,
	secondaryButtonText: PropTypes.string.isRequired,
	selectorPageContent: PropTypes.string,
	selectorPrimaryFocus: PropTypes.node.isRequired,
	size: PropTypes.oneOf([
		"xs",
		"sm",
		"md",
		"lg",
		"2xl"
	]),
	slideIn: PropTypes.bool,
	slug: PropTypes.node,
	subtitle: PropTypes.node,
	title: PropTypes.node.isRequired
};

//#endregion
export { EditSidePanel };