synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
80 lines (79 loc) • 1.94 kB
JavaScript
import { jsxs as p, jsx as t } from "react/jsx-runtime";
import { useOneSageURL as h } from "../../utils/hooks/useOneSageURL.js";
import { Link as c, Button as w } from "@mui/material";
import { useState as a } from "react";
import P from "../TextField/TextField.js";
import b from "./PasswordField.js";
function L(i) {
const u = h("/resetPassword"), {
resetPasswordUrl: r = u.toString(),
onSubmit: d,
loginIsPending: o,
hideForgotPasswordButton: m
} = i, [s, l] = a(""), [n, g] = a("");
function f(e) {
e.preventDefault(), d(s, n);
}
return /* @__PURE__ */ p(
"form",
{
onSubmit: (e) => {
f(e);
},
children: [
/* @__PURE__ */ t(
P,
{
required: !0,
fullWidth: !0,
autoFocus: !0,
autoComplete: "username",
label: "Username or Email Address",
id: "username",
type: "text",
value: s,
onChange: (e) => l(e.target.value)
}
),
/* @__PURE__ */ t(
b,
{
value: n,
onChange: (e) => g(e.target.value)
}
),
!m && /* @__PURE__ */ t(
c,
{
href: r,
target: (
// If not on OneSage, open in new tab
r.startsWith("/") ? void 0 : "_blank"
),
children: "Forgot password?"
}
),
/* @__PURE__ */ t(
w,
{
fullWidth: !0,
type: "submit",
color: "primary",
variant: "contained",
disabled: o,
sx: {
height: "50px",
mt: 4,
mb: 2
},
children: o ? "Logging you in..." : "Sign in"
}
)
]
}
);
}
export {
L as default
};
//# sourceMappingURL=UsernamePasswordForm.js.map