/**
 * 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 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/CreateSidePanel/CreateSidePanel.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.
*/
var import_classnames = /* @__PURE__ */ __toESM(require_classnames());
const blockClass = `${pkg.prefix}--create-side-panel`;
const componentName = "CreateSidePanel";
/**
* Use with medium complexity creations if the user needs page context. On-page content can be seen and interacted with.
*/
const CreateSidePanel = React.forwardRef(({ className, children, disableSubmit, formTitle, formDescription, id, onRequestClose, onRequestSubmit, open, primaryButtonText, secondaryButtonText, selectorPageContent, selectorPrimaryFocus, 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 selectorPageContent && /* @__PURE__ */ React.createElement(SidePanel, {
		...rest,
		id,
		open,
		ref,
		selectorPageContent,
		onRequestClose,
		title,
		subtitle,
		selectorPrimaryFocus,
		...getDevtoolsProps(componentName),
		placement: "right",
		slideIn: true,
		animateTitle: false,
		className: (0, import_classnames.default)(blockClass, className),
		size: "md",
		actions
	}, /* @__PURE__ */ React.createElement("h3", {
		className: `${blockClass}__form-title-text ${blockClass}__content-text`,
		id: formTitleId
	}, formTitle), /* @__PURE__ */ React.createElement("p", { className: `${blockClass}__form-description-text ${blockClass}__content-text` }, formDescription), /* @__PURE__ */ React.createElement(Form, {
		className: `${blockClass}__form`,
		"aria-labelledby": formTitleId,
		onSubmit: (e) => e.preventDefault()
	}, children));
});
CreateSidePanel.displayName = componentName;
CreateSidePanel.propTypes = {
	children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
	className: PropTypes.string,
	description: PropTypes.node,
	disableSubmit: PropTypes.bool,
	formDescription: PropTypes.node,
	formTitle: PropTypes.node.isRequired,
	id: PropTypes.string,
	onRequestClose: PropTypes.func,
	onRequestSubmit: PropTypes.func,
	open: PropTypes.bool,
	primaryButtonText: PropTypes.string.isRequired,
	secondaryButtonText: PropTypes.string.isRequired,
	selectorPageContent: PropTypes.string.isRequired,
	selectorPrimaryFocus: PropTypes.node.isRequired,
	slug: PropTypes.node,
	subtitle: PropTypes.node,
	title: PropTypes.string.isRequired
};

//#endregion
export { CreateSidePanel };