UNPKG

mui-extended

Version:

Extended UI Components built on Material UI

21 lines (20 loc) 1.46 kB
import { __assign, __rest } from "tslib"; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { FormControl, FormHelperText, FormLabel } from "@mui/material"; import { forwardRef } from "react"; import { debugRender } from "../debug"; export var withFormInputControl = function (ControlledInput) { return forwardRef(function FormInputControl(_a, ref) { var // FormControlAttributes labelProps = _a.labelProps, helperTextProps = _a.helperTextProps, // FormFieldProps label = _a.label, error = _a.error, disabled = _a.disabled, helperText = _a.helperText, // ControlledInputProps name = _a.name, value = _a.value, onChange = _a.onChange, onBlur = _a.onBlur, // input props InputProps = _a.InputProps, children = _a.children, props = __rest(_a, ["labelProps", "helperTextProps", "label", "error", "disabled", "helperText", "name", "value", "onChange", "onBlur", "InputProps", "children"]); debugRender(name); return (_jsxs(FormControl, __assign({}, props, { variant: "standard", error: error, disabled: disabled, ref: ref, children: [_jsx(FormLabel, __assign({}, labelProps, { children: label })), _jsx(ControlledInput, __assign({}, InputProps, { name: name, value: value, onChange: onChange, onBlur: onBlur, disabled: disabled, children: children })), _jsx(FormHelperText, __assign({}, helperTextProps, { children: helperText }))] }))); }); };