(function (blocks, element, blockEditor, components) { var el = element.createElement; var useBlockProps = blockEditor.useBlockProps; var BlockControls = blockEditor.BlockControls; var AlignmentToolbar = blockEditor.AlignmentToolbar; var TextControl = components.TextControl; blocks.registerBlockType("maple/mortgage-calculator", { title: "Mortgage Calculator", icon: "calculator", category: "common", attributes: { align: { type: "string", }, }, supports: { align: true, }, edit: function (props) { const blockProps = useBlockProps({ className: props.attributes.align ? "align" + props.attributes.align : "", }); return [ el( BlockControls, { key: "controls" }, el(AlignmentToolbar, { value: props.attributes.align, onChange: (newAlign) => { props.setAttributes({ align: newAlign }); }, }), ), el( "div", blockProps, el("h2", {}, "Mortgage Calculator"), el( "form", { className: "maple-calc-form" }, el( "div", { className: "form-group" }, el(TextControl, { label: "Loan Amount ($)", type: "number", value: "", onChange: () => {}, }), ), el( "div", { className: "form-group" }, el(TextControl, { label: "Interest Rate (%)", type: "number", value: "", onChange: () => {}, }), ), el( "div", { className: "form-group" }, el(TextControl, { label: "Loan Term (Years)", type: "number", value: "", onChange: () => {}, }), ), el( "button", { type: "button", className: "calculate-button" }, "Calculate", ), ), el( "div", { className: "results" }, el("h3", {}, "Results"), el("p", {}, el("strong", {}, "Monthly Payment: "), "$---"), el("p", {}, el("strong", {}, "Total Payment: "), "$---"), el("p", {}, el("strong", {}, "Total Interest: "), "$---"), el( "div", { className: "chart-container" }, el("canvas", { className: "mortgage-chart" }), ), ), ), ]; }, save: function () { return null; }, }); })( window.wp.blocks, window.wp.element, window.wp.blockEditor, window.wp.components, );