@ttoss/react-auth 1.6.0 → 1.6.1

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/esm/index.js CHANGED
@@ -76,7 +76,7 @@ var useAuth = () => {
76
76
  };
77
77
 
78
78
  // src/Auth.tsx
79
- import * as React4 from "react";
79
+ import * as React3 from "react";
80
80
  import { Auth as AmplifyAuth } from "aws-amplify";
81
81
 
82
82
  // src/AuthCard.tsx
@@ -258,7 +258,7 @@ var AuthFullScreen = ({
258
258
 
259
259
  // src/AuthSignIn.tsx
260
260
  import { Button as Button2, Flex as Flex3, Link, Text } from "@ttoss/ui";
261
- import { Form as Form2, FormFieldInput as FormFieldInput2, useForm as useForm2, yup as yup2, yupResolver as yupResolver2 } from "@ttoss/forms";
261
+ import { Form as Form2, FormFieldInput as FormFieldInput2, FormFieldPassword, useForm as useForm2, yup as yup2, yupResolver as yupResolver2 } from "@ttoss/forms";
262
262
 
263
263
  // ../cloud-auth/dist/esm/index.js
264
264
  var PASSWORD_MINIMUM_LENGTH = 8;
@@ -503,31 +503,6 @@ createAuthTemplate.CognitoUserPoolLogicalId = CognitoUserPoolLogicalId;
503
503
  createAuthTemplate.CognitoUserPoolClientLogicalId = CognitoUserPoolClientLogicalId;
504
504
  createAuthTemplate.CognitoIdentityPoolLogicalId = CognitoIdentityPoolLogicalId;
505
505
 
506
- // src/useHidePassInput.ts
507
- import * as React3 from "react";
508
- var useHidePassInput = (defaultValue = true) => {
509
- const [hidePass, setHidePass] = React3.useState(Boolean(defaultValue));
510
- const {
511
- icon,
512
- inputType
513
- } = React3.useMemo(() => {
514
- return {
515
- icon: hidePass ? "view-off" : "view-on",
516
- inputType: hidePass ? "password" : "text"
517
- };
518
- }, [hidePass]);
519
- const handleClick = () => {
520
- setHidePass(prev => {
521
- return !prev;
522
- });
523
- };
524
- return {
525
- handleClick,
526
- icon,
527
- inputType
528
- };
529
- };
530
-
531
506
  // src/AuthSignIn.tsx
532
507
  import { useI18n as useI18n2 } from "@ttoss/react-i18n";
533
508
  import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
@@ -540,11 +515,6 @@ var AuthSignIn = ({
540
515
  const {
541
516
  intl
542
517
  } = useI18n2();
543
- const {
544
- handleClick,
545
- icon,
546
- inputType
547
- } = useHidePassInput();
548
518
  const schema = yup2.object().shape({
549
519
  email: yup2.string().required(intl.formatMessage({
550
520
  id: "r+QgO+",
@@ -640,11 +610,8 @@ var AuthSignIn = ({
640
610
  "value": "Email"
641
611
  }]
642
612
  })
643
- }), /* @__PURE__ */jsx5(FormFieldInput2, {
613
+ }), /* @__PURE__ */jsx5(FormFieldPassword, {
644
614
  name: "password",
645
- trailingIcon: icon,
646
- onTrailingIconClick: handleClick,
647
- type: inputType,
648
615
  label: intl.formatMessage({
649
616
  id: "PylVqx",
650
617
  defaultMessage: [{
@@ -839,7 +806,7 @@ var AuthLogic = () => {
839
806
  const {
840
807
  setLoading
841
808
  } = useNotifications2();
842
- const onSignIn = React4.useCallback(async ({
809
+ const onSignIn = React3.useCallback(async ({
843
810
  email,
844
811
  password
845
812
  }) => {
@@ -861,7 +828,7 @@ var AuthLogic = () => {
861
828
  setLoading(false);
862
829
  }
863
830
  }, [send, setLoading]);
864
- const onSignUp = React4.useCallback(async ({
831
+ const onSignUp = React3.useCallback(async ({
865
832
  email,
866
833
  password
867
834
  }) => {
@@ -882,7 +849,7 @@ var AuthLogic = () => {
882
849
  setLoading(false);
883
850
  }
884
851
  }, [send, setLoading]);
885
- const onConfirmSignUp = React4.useCallback(async ({
852
+ const onConfirmSignUp = React3.useCallback(async ({
886
853
  email,
887
854
  code
888
855
  }) => {
@@ -897,7 +864,7 @@ var AuthLogic = () => {
897
864
  setLoading(false);
898
865
  }
899
866
  }, [send, setLoading]);
900
- const onReturnToSignIn = React4.useCallback(() => {
867
+ const onReturnToSignIn = React3.useCallback(() => {
901
868
  send({
902
869
  type: "RETURN_TO_SIGN_IN"
903
870
  });
@@ -931,7 +898,7 @@ var Auth2 = ({
931
898
  logo,
932
899
  fullScreen = true
933
900
  }) => {
934
- const withLogoNode = React4.useMemo(() => {
901
+ const withLogoNode = React3.useMemo(() => {
935
902
  return /* @__PURE__ */jsx7(LogoProvider, {
936
903
  logo,
937
904
  children: /* @__PURE__ */jsx7(AuthLogic, {})
package/dist/index.js CHANGED
@@ -120,7 +120,7 @@ var useAuth = () => {
120
120
  };
121
121
 
122
122
  // src/Auth.tsx
123
- var React4 = __toESM(require("react"));
123
+ var React3 = __toESM(require("react"));
124
124
  var import_aws_amplify2 = require("aws-amplify");
125
125
 
126
126
  // src/AuthCard.tsx
@@ -547,31 +547,6 @@ createAuthTemplate.CognitoUserPoolLogicalId = CognitoUserPoolLogicalId;
547
547
  createAuthTemplate.CognitoUserPoolClientLogicalId = CognitoUserPoolClientLogicalId;
548
548
  createAuthTemplate.CognitoIdentityPoolLogicalId = CognitoIdentityPoolLogicalId;
549
549
 
550
- // src/useHidePassInput.ts
551
- var React3 = __toESM(require("react"));
552
- var useHidePassInput = (defaultValue = true) => {
553
- const [hidePass, setHidePass] = React3.useState(Boolean(defaultValue));
554
- const {
555
- icon,
556
- inputType
557
- } = React3.useMemo(() => {
558
- return {
559
- icon: hidePass ? "view-off" : "view-on",
560
- inputType: hidePass ? "password" : "text"
561
- };
562
- }, [hidePass]);
563
- const handleClick = () => {
564
- setHidePass(prev => {
565
- return !prev;
566
- });
567
- };
568
- return {
569
- handleClick,
570
- icon,
571
- inputType
572
- };
573
- };
574
-
575
550
  // src/AuthSignIn.tsx
576
551
  var import_react_i18n2 = require("@ttoss/react-i18n");
577
552
  var import_jsx_runtime5 = require("react/jsx-runtime");
@@ -584,11 +559,6 @@ var AuthSignIn = ({
584
559
  const {
585
560
  intl
586
561
  } = (0, import_react_i18n2.useI18n)();
587
- const {
588
- handleClick,
589
- icon,
590
- inputType
591
- } = useHidePassInput();
592
562
  const schema = import_forms2.yup.object().shape({
593
563
  email: import_forms2.yup.string().required(intl.formatMessage({
594
564
  id: "r+QgO+",
@@ -684,11 +654,8 @@ var AuthSignIn = ({
684
654
  "value": "Email"
685
655
  }]
686
656
  })
687
- }), /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_forms2.FormFieldInput, {
657
+ }), /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_forms2.FormFieldPassword, {
688
658
  name: "password",
689
- trailingIcon: icon,
690
- onTrailingIconClick: handleClick,
691
- type: inputType,
692
659
  label: intl.formatMessage({
693
660
  id: "PylVqx",
694
661
  defaultMessage: [{
@@ -883,7 +850,7 @@ var AuthLogic = () => {
883
850
  const {
884
851
  setLoading
885
852
  } = (0, import_react_notifications2.useNotifications)();
886
- const onSignIn = React4.useCallback(async ({
853
+ const onSignIn = React3.useCallback(async ({
887
854
  email,
888
855
  password
889
856
  }) => {
@@ -905,7 +872,7 @@ var AuthLogic = () => {
905
872
  setLoading(false);
906
873
  }
907
874
  }, [send, setLoading]);
908
- const onSignUp = React4.useCallback(async ({
875
+ const onSignUp = React3.useCallback(async ({
909
876
  email,
910
877
  password
911
878
  }) => {
@@ -926,7 +893,7 @@ var AuthLogic = () => {
926
893
  setLoading(false);
927
894
  }
928
895
  }, [send, setLoading]);
929
- const onConfirmSignUp = React4.useCallback(async ({
896
+ const onConfirmSignUp = React3.useCallback(async ({
930
897
  email,
931
898
  code
932
899
  }) => {
@@ -941,7 +908,7 @@ var AuthLogic = () => {
941
908
  setLoading(false);
942
909
  }
943
910
  }, [send, setLoading]);
944
- const onReturnToSignIn = React4.useCallback(() => {
911
+ const onReturnToSignIn = React3.useCallback(() => {
945
912
  send({
946
913
  type: "RETURN_TO_SIGN_IN"
947
914
  });
@@ -975,7 +942,7 @@ var Auth2 = ({
975
942
  logo,
976
943
  fullScreen = true
977
944
  }) => {
978
- const withLogoNode = React4.useMemo(() => {
945
+ const withLogoNode = React3.useMemo(() => {
979
946
  return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(LogoProvider, {
980
947
  logo,
981
948
  children: /* @__PURE__ */(0, import_jsx_runtime7.jsx)(AuthLogic, {})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/react-auth",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "ttoss authentication module for React apps.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "ttoss",
@@ -19,14 +19,14 @@
19
19
  "dependencies": {
20
20
  "@xstate/react": "^3.2.2",
21
21
  "xstate": "^4.37.2",
22
- "@ttoss/forms": "^0.17.1"
22
+ "@ttoss/forms": "^0.17.2"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "aws-amplify": "^5.0.0",
26
26
  "react": ">=16.8.0",
27
- "@ttoss/react-notifications": "^1.22.1",
28
- "@ttoss/ui": "^1.36.1",
29
- "@ttoss/react-i18n": "^1.22.0"
27
+ "@ttoss/react-i18n": "^1.22.0",
28
+ "@ttoss/react-notifications": "^1.22.2",
29
+ "@ttoss/ui": "^1.36.2"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/react": "^18.2.5",
@@ -37,9 +37,9 @@
37
37
  "@ttoss/config": "^1.30.0",
38
38
  "@ttoss/i18n-cli": "^0.5.0",
39
39
  "@ttoss/react-i18n": "^1.22.0",
40
- "@ttoss/react-notifications": "^1.22.1",
40
+ "@ttoss/react-notifications": "^1.22.2",
41
41
  "@ttoss/test-utils": "^1.23.0",
42
- "@ttoss/ui": "^1.36.1"
42
+ "@ttoss/ui": "^1.36.2"
43
43
  },
44
44
  "keywords": [
45
45
  "React",
@@ -1,8 +1,14 @@
1
1
  import { AuthCard } from './AuthCard';
2
2
  import { Button, Flex, Link, Text } from '@ttoss/ui';
3
- import { Form, FormFieldInput, useForm, yup, yupResolver } from '@ttoss/forms';
3
+ import {
4
+ Form,
5
+ FormFieldInput,
6
+ FormFieldPassword,
7
+ useForm,
8
+ yup,
9
+ yupResolver,
10
+ } from '@ttoss/forms';
4
11
  import { PASSWORD_MINIMUM_LENGTH } from '@ttoss/cloud-auth';
5
- import { useHidePassInput } from './useHidePassInput';
6
12
  import { useI18n } from '@ttoss/react-i18n';
7
13
  import type { OnSignIn, OnSignInInput } from './types';
8
14
 
@@ -22,8 +28,6 @@ export const AuthSignIn = ({
22
28
  }: AuthSignInProps) => {
23
29
  const { intl } = useI18n();
24
30
 
25
- const { handleClick, icon, inputType } = useHidePassInput();
26
-
27
31
  const schema = yup.object().shape({
28
32
  email: yup
29
33
  .string()
@@ -105,11 +109,8 @@ export const AuthSignIn = ({
105
109
  defaultMessage: 'Email',
106
110
  })}
107
111
  />
108
- <FormFieldInput
112
+ <FormFieldPassword
109
113
  name="password"
110
- trailingIcon={icon}
111
- onTrailingIconClick={handleClick}
112
- type={inputType}
113
114
  label={intl.formatMessage({
114
115
  description: 'Password label.',
115
116
  defaultMessage: 'Password',
@@ -1,26 +0,0 @@
1
- import * as React from 'react';
2
-
3
- export const useHidePassInput = (defaultValue = true) => {
4
- const [hidePass, setHidePass] = React.useState<boolean>(
5
- Boolean(defaultValue)
6
- );
7
-
8
- const { icon, inputType } = React.useMemo(() => {
9
- return {
10
- icon: hidePass ? 'view-off' : 'view-on',
11
- inputType: hidePass ? 'password' : 'text',
12
- };
13
- }, [hidePass]);
14
-
15
- const handleClick = () => {
16
- setHidePass((prev) => {
17
- return !prev;
18
- });
19
- };
20
-
21
- return {
22
- handleClick,
23
- icon,
24
- inputType,
25
- };
26
- };