import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
import TextField from "@material-ui/core/TextField";
export const PropertyEditorText = (props) => {
    var _a;
    const onChange = (event) => {
        if (props.parentDefaultValue &&
            event.target.value === props.parentDefaultValue) {
            Reflect.set(props.editObject, props.propertyName, null);
        }
        else {
            Reflect.set(props.editObject, props.propertyName, event.target.value);
        }
        props.updateCallback();
    };
    const onKeyDown = (event) => {
        event.stopPropagation();
    };
    const value = (_a = Reflect.get(props.editObject, props.propertyName)) !== null && _a !== void 0 ? _a : props.parentDefaultValue;
    return (_jsx(_Fragment, { children: _jsx(TextField, { "data-testid": `property-${props.propertyName}-text`, error: Boolean(props.issue), value: value || "", label: props.label, onChange: onChange, onKeyDown: onKeyDown, variant: "outlined", autoFocus: props.autoFocus, helperText: props.issue ? props.issue.issue : props.hint }, void 0) }, void 0));
};
//# sourceMappingURL=PropertyEditorText.js.map