@dloizides/auth-web 1.18.1 → 1.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/index.js +29 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.18.2
|
|
4
|
+
|
|
5
|
+
**Enter in a text field submits `<RegisterForm>` and `<LoginForm>`.**
|
|
6
|
+
|
|
7
|
+
- Every visible input now has `onSubmitEditing` wired to the same guarded submit as the button, plus
|
|
8
|
+
`returnKeyType="go"`. RN-web renders no `<form>`, so Enter in a field never submitted in any prior
|
|
9
|
+
version (no `onSubmitEditing` anywhere in auth-web history); only a focused button did.
|
|
10
|
+
- An OS key-repeat of a held Enter in a field is ignored (`useSubmitOnEnter`), so a held Enter is still
|
|
11
|
+
one attempt / one login. jsdom tests cover Enter in each of the seven register fields and both login fields.
|
|
12
|
+
|
|
3
13
|
## 1.18.1
|
|
4
14
|
|
|
5
15
|
**Review fixes for the 1.18.0 registration extraction.**
|
package/dist/index.js
CHANGED
|
@@ -638,6 +638,21 @@ function useLoginSubmit({
|
|
|
638
638
|
}, [runLogin]);
|
|
639
639
|
return { errorText, handleSubmit };
|
|
640
640
|
}
|
|
641
|
+
function isKeyRepeat(event) {
|
|
642
|
+
const native = event?.nativeEvent;
|
|
643
|
+
return native?.repeat === true;
|
|
644
|
+
}
|
|
645
|
+
function useSubmitOnEnter(submit) {
|
|
646
|
+
return react.useCallback(
|
|
647
|
+
(event) => {
|
|
648
|
+
if (isKeyRepeat(event)) {
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
submit();
|
|
652
|
+
},
|
|
653
|
+
[submit]
|
|
654
|
+
);
|
|
655
|
+
}
|
|
641
656
|
var BffAuthStatus = /* @__PURE__ */ ((BffAuthStatus2) => {
|
|
642
657
|
BffAuthStatus2["Loading"] = "loading";
|
|
643
658
|
BffAuthStatus2["Authenticated"] = "authenticated";
|
|
@@ -776,6 +791,7 @@ function LoginForm({
|
|
|
776
791
|
missingFieldsLabel: labels.missingFields,
|
|
777
792
|
invalidCredentialsLabel: labels.invalidCredentials
|
|
778
793
|
});
|
|
794
|
+
const handleSubmitEditing = useSubmitOnEnter(handleSubmit);
|
|
779
795
|
const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
780
796
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.title, children: labels.title }),
|
|
781
797
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.subtitle, children: labels.subtitle }),
|
|
@@ -791,10 +807,12 @@ function LoginForm({
|
|
|
791
807
|
editable: !isSubmitting,
|
|
792
808
|
placeholder: labels.usernamePlaceholder,
|
|
793
809
|
placeholderTextColor: theme.colors.textSecondary,
|
|
810
|
+
returnKeyType: "go",
|
|
794
811
|
style: styles3.input,
|
|
795
812
|
testID: withTestIdPrefix(AuthTestIds.loginUsernameInput, testIdPrefix),
|
|
796
813
|
value: username,
|
|
797
|
-
onChangeText: setUsername
|
|
814
|
+
onChangeText: setUsername,
|
|
815
|
+
onSubmitEditing: handleSubmitEditing
|
|
798
816
|
}
|
|
799
817
|
)
|
|
800
818
|
] }),
|
|
@@ -811,10 +829,12 @@ function LoginForm({
|
|
|
811
829
|
editable: !isSubmitting,
|
|
812
830
|
placeholder: labels.passwordPlaceholder,
|
|
813
831
|
placeholderTextColor: theme.colors.textSecondary,
|
|
832
|
+
returnKeyType: "go",
|
|
814
833
|
style: styles3.input,
|
|
815
834
|
testID: withTestIdPrefix(AuthTestIds.loginPasswordInput, testIdPrefix),
|
|
816
835
|
value: password,
|
|
817
|
-
onChangeText: setPassword
|
|
836
|
+
onChangeText: setPassword,
|
|
837
|
+
onSubmitEditing: handleSubmitEditing
|
|
818
838
|
}
|
|
819
839
|
)
|
|
820
840
|
] }),
|
|
@@ -4094,6 +4114,7 @@ function RegisterFormFields({
|
|
|
4094
4114
|
theme,
|
|
4095
4115
|
styles: styles3,
|
|
4096
4116
|
onChange,
|
|
4117
|
+
onSubmitEditing,
|
|
4097
4118
|
testIdPrefix
|
|
4098
4119
|
}) {
|
|
4099
4120
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -4113,11 +4134,13 @@ function RegisterFormFields({
|
|
|
4113
4134
|
keyboardType: config.keyboardType ?? "default",
|
|
4114
4135
|
placeholder: copy.placeholder,
|
|
4115
4136
|
placeholderTextColor: theme.colors.textSecondary,
|
|
4137
|
+
returnKeyType: "go",
|
|
4116
4138
|
secureTextEntry: config.secure === true,
|
|
4117
4139
|
style: styles3.input,
|
|
4118
4140
|
testID: withTestIdPrefix(config.testId, testIdPrefix),
|
|
4119
4141
|
value: values[config.key],
|
|
4120
|
-
onChangeText: (text) => onChange(config.key, text)
|
|
4142
|
+
onChangeText: (text) => onChange(config.key, text),
|
|
4143
|
+
onSubmitEditing
|
|
4121
4144
|
}
|
|
4122
4145
|
)
|
|
4123
4146
|
] }, config.key);
|
|
@@ -4342,6 +4365,7 @@ function RegisterForm({
|
|
|
4342
4365
|
const handlePress = react.useCallback(async () => {
|
|
4343
4366
|
routeRegisterOutcome(await submit(), { onSuccess, onError });
|
|
4344
4367
|
}, [onError, onSuccess, submit]);
|
|
4368
|
+
const handleSubmitEditing = useSubmitOnEnter(handlePress);
|
|
4345
4369
|
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles3.screen, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles3.card, testID: withTestIdPrefix(RegisterTestIds.form, testIdPrefix), children: [
|
|
4346
4370
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.title, children: labels.title }),
|
|
4347
4371
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles3.subtitle, children: labels.subtitle }),
|
|
@@ -4354,7 +4378,8 @@ function RegisterForm({
|
|
|
4354
4378
|
testIdPrefix,
|
|
4355
4379
|
theme,
|
|
4356
4380
|
values: state,
|
|
4357
|
-
onChange: setField
|
|
4381
|
+
onChange: setField,
|
|
4382
|
+
onSubmitEditing: handleSubmitEditing
|
|
4358
4383
|
}
|
|
4359
4384
|
),
|
|
4360
4385
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles3.fieldGroup, children: /* @__PURE__ */ jsxRuntime.jsx(
|