@rocket.chat/onboarding-ui
Version:
Set of components and functions for the onboarding experience on Rocket.Chat
30 lines • 2.21 kB
JavaScript
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { FieldGroup, Field, EmailInput, ButtonGroup, Button, FieldLabel, FieldDescription, FieldRow, FieldError, } from '@rocket.chat/fuselage';
import { Form } from '@rocket.chat/layout';
import { useForm } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
var ResetPasswordForm = function (_a) {
var onSubmit = _a.onSubmit, validateEmail = _a.validateEmail, initialValues = _a.initialValues;
var t = useTranslation().t;
var _b = useForm({
mode: 'onChange',
defaultValues: __assign({}, initialValues),
}), register = _b.register, handleSubmit = _b.handleSubmit, _c = _b.formState, isValidating = _c.isValidating, isSubmitting = _c.isSubmitting, isValid = _c.isValid, errors = _c.errors;
return (_jsxs(Form, { onSubmit: handleSubmit(onSubmit), children: [_jsx(Form.Container, { children: _jsx(FieldGroup, { children: _jsxs(Field, { children: [_jsx(FieldLabel, { children: t('form.resetPasswordForm.fields.email.label') }), _jsx(FieldDescription, { children: t('form.resetPasswordForm.content.subtitle') }), _jsx(FieldRow, { children: _jsx(EmailInput, __assign({}, register('email', {
validate: validateEmail,
required: true,
}), { placeholder: t('form.resetPasswordForm.fields.email.placeholder') })) }), errors.email && _jsx(FieldError, { children: errors.email.message })] }) }) }), _jsx(Form.Footer, { children: _jsx(ButtonGroup, { children: _jsx(Button, { type: 'submit', primary: true, loading: isValidating || isSubmitting, disabled: !isValid, children: t('form.resetPasswordForm.action.submit') }) }) })] }));
};
export default ResetPasswordForm;
//# sourceMappingURL=ResetPasswordForm.js.map