@makeen.io/material-ui-kit
Version:
Makeen UI components kit. Based on material-ui.
18 lines • 1.3 kB
JavaScript
import React from "react";
import Button from "@material-ui/core/Button";
import Card from "@material-ui/core/Card";
import CardContent from "@material-ui/core/CardContent";
import _ from "lodash";
import { useForm } from "react-hook-form";
import { MuiFormLayout, MuiHeader } from "../../../..";
export default function MuiForm(props) {var
actions = props.actions,schema = props.schema,title = props.title,description = props.description,layout = props.layout;
var formObject = useForm({ mode: "onBlur" });
return /*#__PURE__*/React.createElement("form", { onSubmit: formObject.handleSubmit(console.log) }, /*#__PURE__*/
React.createElement(Card, null, /*#__PURE__*/
React.createElement(CardContent, null, /*#__PURE__*/
React.createElement(MuiHeader, { type: "main", title: title, description: description }), /*#__PURE__*/
React.createElement(MuiFormLayout, { schema: schema, layout: layout, formObject: formObject })), /*#__PURE__*/
React.createElement(CardContent, null, _.map(actions, function (action, index) {return /*#__PURE__*/React.createElement(Button, { type: action.type, color: action.btnType, variant: "contained", disabled: !formObject.formState.isValid && action.type === "submit", key: String(index) }, action.title);}))));
}
//# sourceMappingURL=MuiForm.js.map