@aws-amplify/ui-react-core 2.1.25 → 2.1.27
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.
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { isUndefined } from '@aws-amplify/ui';
|
|
2
2
|
import usePreviousValue from './usePreviousValue.mjs';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @param value `value` to track for updates
|
|
6
|
+
* @param ignoreFirstRender whether to ignore initial render. defaults to `false`
|
|
7
|
+
* @returns a boolean representing whether the tracked `value` has updated between renders
|
|
8
|
+
*
|
|
9
|
+
* Returns `false`:
|
|
10
|
+
* - on initial render when ignoring first render
|
|
11
|
+
* - current and previous `value` are equal
|
|
12
|
+
*
|
|
13
|
+
* Returns `true`:
|
|
14
|
+
* - on initial render when not ignoring first render (default behavior)
|
|
15
|
+
* - current and previous `value` are not equal
|
|
16
|
+
*/
|
|
4
17
|
function useHasValueUpdated(value, ignoreFirstRender = false) {
|
|
5
18
|
const previous = usePreviousValue(value);
|
|
6
19
|
const shouldIgnoreChange = isUndefined(previous) && ignoreFirstRender;
|
package/dist/index.js
CHANGED
|
@@ -506,6 +506,19 @@ function usePreviousValue(value) {
|
|
|
506
506
|
return previous.current;
|
|
507
507
|
}
|
|
508
508
|
|
|
509
|
+
/**
|
|
510
|
+
* @param value `value` to track for updates
|
|
511
|
+
* @param ignoreFirstRender whether to ignore initial render. defaults to `false`
|
|
512
|
+
* @returns a boolean representing whether the tracked `value` has updated between renders
|
|
513
|
+
*
|
|
514
|
+
* Returns `false`:
|
|
515
|
+
* - on initial render when ignoring first render
|
|
516
|
+
* - current and previous `value` are equal
|
|
517
|
+
*
|
|
518
|
+
* Returns `true`:
|
|
519
|
+
* - on initial render when not ignoring first render (default behavior)
|
|
520
|
+
* - current and previous `value` are not equal
|
|
521
|
+
*/
|
|
509
522
|
function useHasValueUpdated(value, ignoreFirstRender = false) {
|
|
510
523
|
const previous = usePreviousValue(value);
|
|
511
524
|
const shouldIgnoreChange = ui.isUndefined(previous) && ignoreFirstRender;
|
|
@@ -54,30 +54,30 @@ export type ConfirmResetPasswordBaseProps<FieldType = {}> = {
|
|
|
54
54
|
export type ConfirmSignInBaseProps<FieldType = {}> = {
|
|
55
55
|
challengeName: AuthChallengeName;
|
|
56
56
|
toSignIn: UseAuthenticator['toSignIn'];
|
|
57
|
-
} & CommonRouteProps & ComponentSlots<FieldType
|
|
57
|
+
} & CommonRouteProps & ComponentSlots<FieldType> & ValidationProps;
|
|
58
58
|
export type ConfirmSignUpBaseProps<FieldType = {}> = {
|
|
59
59
|
codeDeliveryDetails: UseAuthenticator['codeDeliveryDetails'];
|
|
60
60
|
resendCode: UseAuthenticator['resendCode'];
|
|
61
|
-
} & CommonRouteProps & ComponentSlots<FieldType
|
|
61
|
+
} & CommonRouteProps & ComponentSlots<FieldType> & ValidationProps;
|
|
62
62
|
export type ConfirmVerifyUserProps<FieldType = {}> = {
|
|
63
63
|
skipVerification: UseAuthenticator['skipVerification'];
|
|
64
|
-
} & CommonRouteProps & ComponentSlots<FieldType
|
|
64
|
+
} & CommonRouteProps & ComponentSlots<FieldType> & ValidationProps;
|
|
65
65
|
export type ForceResetPasswordBaseProps<FieldType = {}> = {
|
|
66
66
|
toSignIn: UseAuthenticator['toSignIn'];
|
|
67
67
|
} & CommonRouteProps & ComponentSlots<FieldType> & ValidationProps;
|
|
68
68
|
export type ResetPasswordBaseProps<FieldType = {}> = {
|
|
69
69
|
toSignIn: UseAuthenticator['toSignIn'];
|
|
70
|
-
} & CommonRouteProps & ComponentSlots<FieldType
|
|
70
|
+
} & CommonRouteProps & ComponentSlots<FieldType> & ValidationProps;
|
|
71
71
|
export type SetupTOTPBaseProps<FieldType = {}> = {
|
|
72
72
|
toSignIn: UseAuthenticator['toSignIn'];
|
|
73
73
|
totpSecretCode: UseAuthenticator['totpSecretCode'];
|
|
74
|
-
} & CommonRouteProps & ComponentSlots<FieldType
|
|
74
|
+
} & CommonRouteProps & ComponentSlots<FieldType> & ValidationProps;
|
|
75
75
|
export type SignInBaseProps<FieldType = {}> = {
|
|
76
76
|
hideSignUp?: boolean;
|
|
77
77
|
toFederatedSignIn: UseAuthenticator['toFederatedSignIn'];
|
|
78
78
|
toResetPassword: UseAuthenticator['toResetPassword'];
|
|
79
79
|
toSignUp: UseAuthenticator['toSignUp'];
|
|
80
|
-
} & CommonRouteProps & ComponentSlots<FieldType
|
|
80
|
+
} & CommonRouteProps & ComponentSlots<FieldType> & ValidationProps;
|
|
81
81
|
export type SignUpBaseProps<FieldType = {}> = {
|
|
82
82
|
hideSignIn?: boolean;
|
|
83
83
|
toFederatedSignIn: UseAuthenticator['toFederatedSignIn'];
|
|
@@ -85,7 +85,7 @@ export type SignUpBaseProps<FieldType = {}> = {
|
|
|
85
85
|
} & CommonRouteProps & ComponentSlots<FieldType> & ValidationProps;
|
|
86
86
|
export type VerifyUserProps<FieldType = {}> = {
|
|
87
87
|
skipVerification: UseAuthenticator['skipVerification'];
|
|
88
|
-
} & CommonRouteProps & ComponentSlots<FieldType
|
|
88
|
+
} & CommonRouteProps & ComponentSlots<FieldType> & ValidationProps;
|
|
89
89
|
export interface DefaultProps<FieldType = {}> {
|
|
90
90
|
ConfirmSignIn: ConfirmSignInBaseProps<FieldType>;
|
|
91
91
|
ConfirmSignUp: ConfirmSignUpBaseProps<FieldType>;
|
|
@@ -1 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param value `value` to track for updates
|
|
3
|
+
* @param ignoreFirstRender whether to ignore initial render. defaults to `false`
|
|
4
|
+
* @returns a boolean representing whether the tracked `value` has updated between renders
|
|
5
|
+
*
|
|
6
|
+
* Returns `false`:
|
|
7
|
+
* - on initial render when ignoring first render
|
|
8
|
+
* - current and previous `value` are equal
|
|
9
|
+
*
|
|
10
|
+
* Returns `true`:
|
|
11
|
+
* - on initial render when not ignoring first render (default behavior)
|
|
12
|
+
* - current and previous `value` are not equal
|
|
13
|
+
*/
|
|
1
14
|
export default function useHasValueUpdated<Value>(value: Value, ignoreFirstRender?: boolean): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/ui-react-core",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.27",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/esm/index.mjs",
|
|
6
6
|
"react-native": "dist/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"typecheck": "tsc --noEmit"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@aws-amplify/ui": "5.6.
|
|
34
|
+
"@aws-amplify/ui": "5.6.8",
|
|
35
35
|
"@xstate/react": "3.0.1",
|
|
36
36
|
"lodash": "4.17.21",
|
|
37
37
|
"xstate": "^4.33.6"
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@types/react": "^17.0.2",
|
|
50
50
|
"@types/react-dom": "^17.0.13",
|
|
51
51
|
"@types/react-test-renderer": "^17.0.1",
|
|
52
|
-
"eslint": "^8.
|
|
52
|
+
"eslint": "^8.44.0",
|
|
53
53
|
"jest": "^27.0.4",
|
|
54
54
|
"prettier": "2.4.1",
|
|
55
55
|
"react": "^17.0.2",
|