import { __exportAll } from "../../../_virtual/_rolldown/runtime.mjs";
import { Field } from "../../../utilities/form/Field.mjs";
import { c } from "react-compiler-runtime";
import React from "react";
import { TextField, makeStyles } from "@material-ui/core";
//#region src/UI/property/widgets/TextPropertyWidget.jsx
var TextPropertyWidget_exports = /* @__PURE__ */ __exportAll({
	BaseTextPropertyWidget: () => BaseTextPropertyWidget,
	default: () => TextPropertyWidget
});
const useStyles = makeStyles((theme) => ({
	input: {
		height: 34,
		padding: 0
	},
	formTextInput: { fontSize: 14 },
	labelRoot: { fontSize: 14 }
}));
/**
* Base component for all property widgets that are based on TextField
*/
const BaseTextPropertyWidget = (props) => {
	const $ = c(17);
	let extraProps;
	let property;
	let propertyType;
	if ($[0] !== props) {
		const { propertyType: t0, property: t1, initialData, ...t2 } = props;
		propertyType = t0;
		property = t1;
		extraProps = t2;
		$[0] = props;
		$[1] = extraProps;
		$[2] = property;
		$[3] = propertyType;
	} else {
		extraProps = $[1];
		property = $[2];
		propertyType = $[3];
	}
	const { key, label, required } = property;
	const classes = useStyles();
	const t0 = `${propertyType}:${key}`;
	const t1 = `${propertyType}:${key}`;
	const t2 = !!required;
	let t3;
	if ($[4] !== classes.formTextInput || $[5] !== classes.input) {
		t3 = { classes: {
			root: classes.input,
			input: classes.formTextInput
		} };
		$[4] = classes.formTextInput;
		$[5] = classes.input;
		$[6] = t3;
	} else t3 = $[6];
	let t4;
	if ($[7] !== classes.labelRoot) {
		t4 = { classes: { root: classes.labelRoot } };
		$[7] = classes.labelRoot;
		$[8] = t4;
	} else t4 = $[8];
	let t5;
	if ($[9] !== extraProps || $[10] !== label || $[11] !== t0 || $[12] !== t1 || $[13] !== t2 || $[14] !== t3 || $[15] !== t4) {
		t5 = /* @__PURE__ */ React.createElement(Field, {
			component: TextField,
			id: t0,
			name: t1,
			label,
			variant: "outlined",
			margin: "dense",
			color: "primary",
			size: "small",
			required: t2,
			fullWidth: true,
			InputProps: t3,
			InputLabelProps: t4,
			...extraProps
		});
		$[9] = extraProps;
		$[10] = label;
		$[11] = t0;
		$[12] = t1;
		$[13] = t2;
		$[14] = t3;
		$[15] = t4;
		$[16] = t5;
	} else t5 = $[16];
	return t5;
};
/**
* `text` property widget
*
* Outputs a basic TextField
*/
const TextPropertyWidget = (props) => {
	const $ = c(2);
	let t0;
	if ($[0] !== props) {
		t0 = /* @__PURE__ */ React.createElement(BaseTextPropertyWidget, props);
		$[0] = props;
		$[1] = t0;
	} else t0 = $[1];
	return t0;
};
//#endregion
export { BaseTextPropertyWidget, TextPropertyWidget_exports, TextPropertyWidget as default };

//# sourceMappingURL=TextPropertyWidget.mjs.map