import { useCallback, createElement } from "react";
import { Stack, FieldContainer, TextInput, Button } from "@contember/ui";
import { useRedirect } from "../../../routing/binding/useRedirect.js";
import { useForm } from "../../lib/useForm.js";
const initialValues = {
  token: ""
};
const FillResetPasswordTokenForm = ({ resetLink }) => {
  const redirect = useRedirect();
  const { register, isSubmitting, onSubmit } = useForm(initialValues, useCallback(async (values) => {
    redirect(resetLink(values.token));
  }, [redirect, resetLink]));
  return /* @__PURE__ */ createElement("form", {
    onSubmit
  }, /* @__PURE__ */ createElement(Stack, {
    direction: "vertical",
    gap: "large"
  }, /* @__PURE__ */ createElement(FieldContainer, {
    label: "Token"
  }, /* @__PURE__ */ createElement(TextInput, {
    ...register("token"),
    required: true
  })), /* @__PURE__ */ createElement(FieldContainer, {
    label: void 0
  }, /* @__PURE__ */ createElement(Button, {
    distinction: "primary",
    type: "submit",
    disabled: isSubmitting
  }, "Continue"))));
};
export { FillResetPasswordTokenForm };
//# sourceMappingURL=FillResetPasswordTokenForm.js.map
