@dloizides/auth-web 1.20.0 → 1.21.0

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/dist/index.d.mts CHANGED
@@ -685,6 +685,12 @@ interface LoginFormProps {
685
685
  * unconditional — omit it and every nonce bump applies.
686
686
  */
687
687
  prefillIntent?: PrefillIntent;
688
+ /**
689
+ * When `true`, the username field is an email field: `type="email"` +
690
+ * `autocomplete="username"` on web, the email keyboard + `username` content
691
+ * type on native. Defaults to `false` (plain text field, as before).
692
+ */
693
+ emailUsername?: boolean;
688
694
  }
689
695
 
690
696
  /**
@@ -702,7 +708,7 @@ interface LoginFormProps {
702
708
  */
703
709
 
704
710
  /** Themeable password-login form built on `useBffAuth`. */
705
- declare function LoginForm({ client, theme: themeProp, labels: labelsProp, onSuccess, onForgotPassword, onSignUp, testIdPrefix, chromeless, initialUsername, initialPassword, prefillNonce, prefillIntent, }: Readonly<LoginFormProps>): ReactElement;
711
+ declare function LoginForm({ client, theme: themeProp, labels: labelsProp, onSuccess, onForgotPassword, onSignUp, testIdPrefix, chromeless, initialUsername, initialPassword, prefillNonce, prefillIntent, emailUsername, }: Readonly<LoginFormProps>): ReactElement;
706
712
 
707
713
  /**
708
714
  * `<ForgotPasswordForm>` — the ready-made, themeable "request a reset link"
package/dist/index.d.ts CHANGED
@@ -685,6 +685,12 @@ interface LoginFormProps {
685
685
  * unconditional — omit it and every nonce bump applies.
686
686
  */
687
687
  prefillIntent?: PrefillIntent;
688
+ /**
689
+ * When `true`, the username field is an email field: `type="email"` +
690
+ * `autocomplete="username"` on web, the email keyboard + `username` content
691
+ * type on native. Defaults to `false` (plain text field, as before).
692
+ */
693
+ emailUsername?: boolean;
688
694
  }
689
695
 
690
696
  /**
@@ -702,7 +708,7 @@ interface LoginFormProps {
702
708
  */
703
709
 
704
710
  /** Themeable password-login form built on `useBffAuth`. */
705
- declare function LoginForm({ client, theme: themeProp, labels: labelsProp, onSuccess, onForgotPassword, onSignUp, testIdPrefix, chromeless, initialUsername, initialPassword, prefillNonce, prefillIntent, }: Readonly<LoginFormProps>): ReactElement;
711
+ declare function LoginForm({ client, theme: themeProp, labels: labelsProp, onSuccess, onForgotPassword, onSignUp, testIdPrefix, chromeless, initialUsername, initialPassword, prefillNonce, prefillIntent, emailUsername, }: Readonly<LoginFormProps>): ReactElement;
706
712
 
707
713
  /**
708
714
  * `<ForgotPasswordForm>` — the ready-made, themeable "request a reset link"
package/dist/index.js CHANGED
@@ -661,6 +661,18 @@ function useSubmitOnEnter(submit) {
661
661
  [submit]
662
662
  );
663
663
  }
664
+
665
+ // src/components/usernameFieldProps.ts
666
+ var EMAIL_USERNAME_PROPS = {
667
+ autoComplete: "username",
668
+ inputMode: "email",
669
+ keyboardType: "email-address",
670
+ textContentType: "username"
671
+ };
672
+ var NO_EXTRA_PROPS = {};
673
+ function usernameFieldProps(emailUsername) {
674
+ return emailUsername ? EMAIL_USERNAME_PROPS : NO_EXTRA_PROPS;
675
+ }
664
676
  var BffAuthStatus = /* @__PURE__ */ ((BffAuthStatus2) => {
665
677
  BffAuthStatus2["Loading"] = "loading";
666
678
  BffAuthStatus2["Authenticated"] = "authenticated";
@@ -776,7 +788,8 @@ function LoginForm({
776
788
  initialUsername,
777
789
  initialPassword,
778
790
  prefillNonce,
779
- prefillIntent
791
+ prefillIntent,
792
+ emailUsername = false
780
793
  }) {
781
794
  const theme = useAuthTheme(themeProp);
782
795
  const styles3 = useAuthStyles(theme);
@@ -808,6 +821,7 @@ function LoginForm({
808
821
  /* @__PURE__ */ jsxRuntime.jsx(
809
822
  reactNative.TextInput,
810
823
  {
824
+ ...usernameFieldProps(emailUsername),
811
825
  accessibilityHint: labels.usernamePlaceholder,
812
826
  accessibilityLabel: labels.usernameLabel,
813
827
  autoCapitalize: "none",