@aws-amplify/ui-react-native 2.1.2 → 2.1.3
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/Authenticator/common/DefaultFormFields/DefaultRadioFormFields.js +11 -16
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/lib/Authenticator/common/DefaultFormFields/DefaultRadioFormFields.js +10 -15
- package/lib/version.js +1 -1
- package/package.json +4 -4
- package/src/Authenticator/common/DefaultFormFields/DefaultRadioFormFields.tsx +24 -23
- package/src/version.ts +1 -1
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { censorContactMethod } from '@aws-amplify/ui';
|
|
3
3
|
import { Radio, RadioGroup } from '../../../primitives';
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const splitEmail = value.split('@');
|
|
8
|
-
const censoredName = censorAllButFirstAndLast(splitEmail[0]);
|
|
9
|
-
censoredVal = `${censoredName}@${splitEmail[1]}`;
|
|
10
|
-
}
|
|
11
|
-
else if (name === 'phone_number') {
|
|
12
|
-
censoredVal = censorPhoneNumber(value);
|
|
13
|
-
}
|
|
14
|
-
return censoredVal;
|
|
4
|
+
const attributeMap = {
|
|
5
|
+
email: 'Email',
|
|
6
|
+
phone_number: 'Phone Number',
|
|
15
7
|
};
|
|
16
8
|
const DefaultRadioFormFields = ({ fields, fieldContainerStyle, fieldLabelStyle, isPending, style, }) => {
|
|
17
9
|
return (<RadioGroup disabled={isPending} style={style}>
|
|
18
|
-
{(fields ?? []).map(({ name, value, ...props }) =>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
{(fields ?? []).map(({ name, value, ...props }) => {
|
|
11
|
+
const attributeType = attributeMap[name];
|
|
12
|
+
return (<Radio {...props} key={value}
|
|
13
|
+
// value has to be name, because Auth is only interested in the
|
|
14
|
+
// string "email" or "phone_number", not the actual value
|
|
15
|
+
value={name} label={censorContactMethod(attributeType, value)} labelStyle={fieldLabelStyle} style={fieldContainerStyle}/>);
|
|
16
|
+
})}
|
|
22
17
|
</RadioGroup>);
|
|
23
18
|
};
|
|
24
19
|
DefaultRadioFormFields.displayName = 'FormFields';
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.1.
|
|
1
|
+
export declare const VERSION = "2.1.3";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '2.1.
|
|
1
|
+
export const VERSION = '2.1.3';
|
|
@@ -4,24 +4,19 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
5
|
const ui_1 = require("@aws-amplify/ui");
|
|
6
6
|
const primitives_1 = require("../../../primitives");
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const splitEmail = value.split('@');
|
|
11
|
-
const censoredName = (0, ui_1.censorAllButFirstAndLast)(splitEmail[0]);
|
|
12
|
-
censoredVal = `${censoredName}@${splitEmail[1]}`;
|
|
13
|
-
}
|
|
14
|
-
else if (name === 'phone_number') {
|
|
15
|
-
censoredVal = (0, ui_1.censorPhoneNumber)(value);
|
|
16
|
-
}
|
|
17
|
-
return censoredVal;
|
|
7
|
+
const attributeMap = {
|
|
8
|
+
email: 'Email',
|
|
9
|
+
phone_number: 'Phone Number',
|
|
18
10
|
};
|
|
19
11
|
const DefaultRadioFormFields = ({ fields, fieldContainerStyle, fieldLabelStyle, isPending, style, }) => {
|
|
20
12
|
return (<primitives_1.RadioGroup disabled={isPending} style={style}>
|
|
21
|
-
{(fields ?? []).map(({ name, value, ...props }) =>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
{(fields ?? []).map(({ name, value, ...props }) => {
|
|
14
|
+
const attributeType = attributeMap[name];
|
|
15
|
+
return (<primitives_1.Radio {...props} key={value}
|
|
16
|
+
// value has to be name, because Auth is only interested in the
|
|
17
|
+
// string "email" or "phone_number", not the actual value
|
|
18
|
+
value={name} label={(0, ui_1.censorContactMethod)(attributeType, value)} labelStyle={fieldLabelStyle} style={fieldContainerStyle}/>);
|
|
19
|
+
})}
|
|
25
20
|
</primitives_1.RadioGroup>);
|
|
26
21
|
};
|
|
27
22
|
DefaultRadioFormFields.displayName = 'FormFields';
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/ui-react-native",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"react-native-safe-area-context": "^4.7.3"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@aws-amplify/ui": "6.0.
|
|
33
|
-
"@aws-amplify/ui-react-core": "3.0.
|
|
34
|
-
"@aws-amplify/ui-react-core-notifications": "2.0.
|
|
32
|
+
"@aws-amplify/ui": "6.0.11",
|
|
33
|
+
"@aws-amplify/ui-react-core": "3.0.11",
|
|
34
|
+
"@aws-amplify/ui-react-core-notifications": "2.0.11"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"aws-amplify": "^6.0.2",
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { censorContactMethod, ContactMethod } from '@aws-amplify/ui';
|
|
3
3
|
|
|
4
4
|
import { Radio, RadioGroup } from '../../../primitives';
|
|
5
5
|
import { DefaultRadioFormFieldsProps } from './types';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const censoredName = censorAllButFirstAndLast(splitEmail[0]);
|
|
7
|
+
interface AttributeMap {
|
|
8
|
+
email: ContactMethod;
|
|
9
|
+
phone_number: ContactMethod;
|
|
10
|
+
}
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
return censoredVal;
|
|
12
|
+
const attributeMap: AttributeMap = {
|
|
13
|
+
email: 'Email',
|
|
14
|
+
phone_number: 'Phone Number',
|
|
18
15
|
};
|
|
19
16
|
|
|
20
17
|
const DefaultRadioFormFields = ({
|
|
@@ -26,18 +23,22 @@ const DefaultRadioFormFields = ({
|
|
|
26
23
|
}: DefaultRadioFormFieldsProps): JSX.Element => {
|
|
27
24
|
return (
|
|
28
25
|
<RadioGroup disabled={isPending} style={style}>
|
|
29
|
-
{(fields ?? []).map(({ name, value, ...props }) =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
{(fields ?? []).map(({ name, value, ...props }) => {
|
|
27
|
+
const attributeType = attributeMap[name as keyof AttributeMap];
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Radio
|
|
31
|
+
{...props}
|
|
32
|
+
key={value}
|
|
33
|
+
// value has to be name, because Auth is only interested in the
|
|
34
|
+
// string "email" or "phone_number", not the actual value
|
|
35
|
+
value={name}
|
|
36
|
+
label={censorContactMethod(attributeType, value)}
|
|
37
|
+
labelStyle={fieldLabelStyle}
|
|
38
|
+
style={fieldContainerStyle}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
})}
|
|
41
42
|
</RadioGroup>
|
|
42
43
|
);
|
|
43
44
|
};
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '2.1.
|
|
1
|
+
export const VERSION = '2.1.3';
|