@aws-amplify/ui-react-native 1.2.28 → 2.0.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/Authenticator/Authenticator.d.ts +83 -12
- package/dist/Authenticator/Authenticator.js +19 -16
- package/dist/Authenticator/Defaults/{ResetPassword/ResetPassword.d.ts → ForgotPassword/ForgotPassword.d.ts} +4 -4
- package/dist/Authenticator/Defaults/{ResetPassword/ResetPassword.js → ForgotPassword/ForgotPassword.js} +7 -7
- package/dist/Authenticator/Defaults/ForgotPassword/index.d.ts +1 -0
- package/dist/Authenticator/Defaults/ForgotPassword/index.js +1 -0
- package/dist/Authenticator/Defaults/{SetupTOTP/SetupTOTP.d.ts → SetupTotp/SetupTotp.d.ts} +4 -4
- package/dist/Authenticator/Defaults/{SetupTOTP/SetupTOTP.js → SetupTotp/SetupTotp.js} +10 -10
- package/dist/Authenticator/Defaults/SetupTotp/index.d.ts +1 -0
- package/dist/Authenticator/Defaults/SetupTotp/index.js +1 -0
- package/dist/Authenticator/Defaults/SetupTotp/styles.d.ts +5 -0
- package/dist/Authenticator/Defaults/SignIn/SignIn.d.ts +1 -1
- package/dist/Authenticator/Defaults/SignIn/SignIn.js +6 -5
- package/dist/Authenticator/Defaults/SignUp/SignUp.d.ts +1 -1
- package/dist/Authenticator/Defaults/SignUp/SignUp.js +4 -3
- package/dist/Authenticator/Defaults/index.d.ts +2 -2
- package/dist/Authenticator/Defaults/index.js +2 -2
- package/dist/Authenticator/Defaults/types.d.ts +13 -13
- package/dist/Authenticator/common/FederatedProviderButton/FederatedProviderButton.js +2 -4
- package/dist/Authenticator/common/FederatedProviderButton/types.d.ts +3 -1
- package/dist/Authenticator/common/FederatedProviderButtons/FederatedProviderButtons.d.ts +1 -1
- package/dist/Authenticator/common/FederatedProviderButtons/FederatedProviderButtons.js +24 -11
- package/dist/Authenticator/common/FederatedProviderButtons/styles.d.ts +2 -1
- package/dist/Authenticator/common/FederatedProviderButtons/styles.js +14 -4
- package/dist/Authenticator/common/FederatedProviderButtons/types.d.ts +5 -3
- package/dist/Authenticator/hooks/useFieldValues/useFieldValues.js +1 -1
- package/dist/Authenticator/hooks/useFieldValues/utils.js +1 -1
- package/dist/Authenticator/types.d.ts +1 -1
- package/dist/InAppMessaging/components/InAppMessageDisplay/handleMessageLinkAction.js +2 -2
- package/dist/InAppMessaging/hooks/useMessageImage/useMessageImage.d.ts +2 -2
- package/dist/InAppMessaging/hooks/useMessageImage/useMessageImage.js +2 -2
- package/dist/InAppMessaging/hooks/useMessageImage/utils.d.ts +2 -2
- package/dist/InAppMessaging/hooks/useMessageImage/utils.js +2 -2
- package/dist/InAppMessaging/hooks/useMessageProps/types.d.ts +2 -2
- package/dist/InAppMessaging/hooks/useMessageProps/utils.d.ts +2 -2
- package/dist/InAppMessaging/index.d.ts +1 -1
- package/dist/InAppMessaging/index.js +1 -0
- package/dist/assets/icons/icons.ts +3 -0
- package/dist/primitives/Button/styles.js +4 -2
- package/dist/primitives/Carousel/Carousel.js +1 -11
- package/dist/primitives/Divider/styles.js +4 -3
- package/dist/primitives/ErrorMessage/ErrorMessage.d.ts +1 -1
- package/dist/primitives/ErrorMessage/ErrorMessage.js +2 -2
- package/dist/primitives/Icon/Icon.d.ts +1 -1
- package/dist/primitives/Icon/Icon.js +2 -1
- package/dist/primitives/Icon/styles.js +1 -1
- package/dist/primitives/Radio/styles.js +1 -1
- package/dist/primitives/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/primitives/RadioGroup/RadioGroup.js +2 -2
- package/dist/primitives/Tabs/Tabs.d.ts +1 -1
- package/dist/primitives/Tabs/Tabs.js +2 -2
- package/dist/primitives/Tabs/styles.js +3 -3
- package/dist/utils/platform.d.ts +1 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/lib/Authenticator/Authenticator.js +17 -14
- package/lib/Authenticator/Defaults/{ResetPassword/ResetPassword.js → ForgotPassword/ForgotPassword.js} +7 -7
- package/lib/Authenticator/Defaults/ForgotPassword/index.js +8 -0
- package/lib/Authenticator/Defaults/{SetupTOTP/SetupTOTP.js → SetupTotp/SetupTotp.js} +10 -10
- package/lib/Authenticator/Defaults/{SetupTOTP → SetupTotp}/index.js +3 -3
- package/lib/Authenticator/Defaults/SignIn/SignIn.js +5 -4
- package/lib/Authenticator/Defaults/SignUp/SignUp.js +3 -2
- package/lib/Authenticator/Defaults/index.js +5 -5
- package/lib/Authenticator/common/FederatedProviderButton/FederatedProviderButton.js +2 -4
- package/lib/Authenticator/common/FederatedProviderButtons/FederatedProviderButtons.js +22 -9
- package/lib/Authenticator/common/FederatedProviderButtons/styles.js +16 -5
- package/lib/Authenticator/hooks/useFieldValues/useFieldValues.js +8 -8
- package/lib/Authenticator/hooks/useFieldValues/utils.js +2 -2
- package/lib/InAppMessaging/components/InAppMessageDisplay/handleMessageLinkAction.js +2 -2
- package/lib/InAppMessaging/hooks/useMessageImage/types.js +1 -1
- package/lib/InAppMessaging/hooks/useMessageImage/useMessageImage.js +5 -5
- package/lib/InAppMessaging/hooks/useMessageImage/utils.js +2 -2
- package/lib/InAppMessaging/index.js +1 -0
- package/lib/assets/icons/icons.ts +3 -0
- package/lib/primitives/Button/styles.js +4 -2
- package/lib/primitives/Carousel/Carousel.js +1 -11
- package/lib/primitives/Divider/styles.js +4 -3
- package/lib/primitives/ErrorMessage/ErrorMessage.js +2 -2
- package/lib/primitives/Icon/Icon.js +2 -1
- package/lib/primitives/Icon/styles.js +2 -2
- package/lib/primitives/Radio/styles.js +1 -1
- package/lib/primitives/RadioGroup/RadioGroup.js +2 -2
- package/lib/primitives/Tabs/Tabs.js +2 -2
- package/lib/primitives/Tabs/styles.js +3 -3
- package/lib/version.js +1 -1
- package/package.json +16 -31
- package/src/Authenticator/Authenticator.tsx +20 -17
- package/src/Authenticator/Defaults/{ResetPassword/ResetPassword.tsx → ForgotPassword/ForgotPassword.tsx} +9 -9
- package/src/Authenticator/Defaults/ForgotPassword/index.ts +1 -0
- package/src/Authenticator/Defaults/{SetupTOTP/SetupTOTP.tsx → SetupTotp/SetupTotp.tsx} +13 -13
- package/src/Authenticator/Defaults/SetupTotp/index.ts +1 -0
- package/src/Authenticator/Defaults/{SetupTOTP → SetupTotp}/styles.ts +2 -2
- package/src/Authenticator/Defaults/SignIn/SignIn.tsx +15 -3
- package/src/Authenticator/Defaults/SignUp/SignUp.tsx +12 -0
- package/src/Authenticator/Defaults/index.ts +2 -2
- package/src/Authenticator/Defaults/types.ts +15 -15
- package/src/Authenticator/common/FederatedProviderButton/FederatedProviderButton.tsx +2 -4
- package/src/Authenticator/common/FederatedProviderButton/types.ts +3 -1
- package/src/Authenticator/common/FederatedProviderButtons/FederatedProviderButtons.tsx +41 -13
- package/src/Authenticator/common/FederatedProviderButtons/styles.ts +19 -4
- package/src/Authenticator/common/FederatedProviderButtons/types.ts +9 -6
- package/src/Authenticator/hooks/useFieldValues/useFieldValues.ts +1 -1
- package/src/Authenticator/hooks/useFieldValues/utils.ts +1 -1
- package/src/Authenticator/types.ts +1 -4
- package/src/InAppMessaging/components/InAppMessageDisplay/handleMessageLinkAction.ts +2 -2
- package/src/InAppMessaging/hooks/useMessageImage/useMessageImage.ts +6 -6
- package/src/InAppMessaging/hooks/useMessageImage/utils.ts +5 -5
- package/src/InAppMessaging/hooks/useMessageProps/types.ts +3 -3
- package/src/InAppMessaging/hooks/useMessageProps/utils.ts +2 -2
- package/src/InAppMessaging/index.ts +9 -0
- package/src/assets/icons/icons.ts +3 -0
- package/src/hooks/useDeviceOrientation/useDeviceOrientation.ts +6 -1
- package/src/primitives/Button/styles.ts +4 -2
- package/src/primitives/Carousel/Carousel.tsx +1 -10
- package/src/primitives/Divider/styles.ts +4 -3
- package/src/primitives/ErrorMessage/ErrorMessage.tsx +4 -1
- package/src/primitives/Icon/Icon.tsx +2 -0
- package/src/primitives/Icon/styles.ts +1 -1
- package/src/primitives/Radio/styles.ts +1 -1
- package/src/primitives/RadioGroup/RadioGroup.tsx +6 -1
- package/src/primitives/Tabs/Tabs.tsx +4 -1
- package/src/primitives/Tabs/styles.ts +3 -3
- package/src/version.ts +1 -1
- package/dist/Authenticator/Defaults/ResetPassword/index.d.ts +0 -1
- package/dist/Authenticator/Defaults/ResetPassword/index.js +0 -1
- package/dist/Authenticator/Defaults/SetupTOTP/index.d.ts +0 -1
- package/dist/Authenticator/Defaults/SetupTOTP/index.js +0 -1
- package/dist/Authenticator/Defaults/SetupTOTP/styles.d.ts +0 -5
- package/dist/Authenticator/common/FederatedProviderButton/styles.d.ts +0 -2
- package/dist/Authenticator/common/FederatedProviderButton/styles.js +0 -18
- package/lib/Authenticator/Defaults/ResetPassword/index.js +0 -8
- package/lib/Authenticator/common/FederatedProviderButton/styles.js +0 -21
- package/src/Authenticator/Defaults/ResetPassword/index.ts +0 -1
- package/src/Authenticator/Defaults/SetupTOTP/index.ts +0 -1
- package/src/Authenticator/common/FederatedProviderButton/styles.ts +0 -21
- /package/dist/Authenticator/Defaults/{SetupTOTP → SetupTotp}/styles.js +0 -0
- /package/lib/Authenticator/Defaults/{SetupTOTP → SetupTotp}/styles.js +0 -0
|
@@ -7,7 +7,7 @@ const common_1 = require("../../common");
|
|
|
7
7
|
const hooks_1 = require("../../hooks");
|
|
8
8
|
const COMPONENT_NAME = 'SignUp';
|
|
9
9
|
const { getCreateAccountText, getCreatingAccountText, getSignInTabText, getSignUpTabText, } = ui_1.authenticatorTextUtil;
|
|
10
|
-
const SignUp = ({ fields, handleBlur, handleChange, handleSubmit, hasValidationErrors, hideSignIn, isPending, toSignIn, validationErrors, ...rest }) => {
|
|
10
|
+
const SignUp = ({ fields, handleBlur, handleChange, handleSubmit, hasValidationErrors, hideSignIn, isPending, socialProviders, toFederatedSignIn, toSignIn, validationErrors, ...rest }) => {
|
|
11
11
|
const { disableFormSubmit, fields: fieldsWithHandlers, fieldValidationErrors, handleFormSubmit, } = (0, hooks_1.useFieldValues)({
|
|
12
12
|
componentName: COMPONENT_NAME,
|
|
13
13
|
fields,
|
|
@@ -22,6 +22,7 @@ const SignUp = ({ fields, handleBlur, handleChange, handleSubmit, hasValidationE
|
|
|
22
22
|
? getCreatingAccountText()
|
|
23
23
|
: getCreateAccountText();
|
|
24
24
|
const secondaryButtonText = getSignInTabText();
|
|
25
|
+
const body = socialProviders ? (<common_1.FederatedProviderButtons route="signUp" socialProviders={socialProviders} toFederatedSignIn={toFederatedSignIn}/>) : null;
|
|
25
26
|
const buttons = (0, react_1.useMemo)(() => ({
|
|
26
27
|
primary: {
|
|
27
28
|
children: primaryButtonText,
|
|
@@ -39,7 +40,7 @@ const SignUp = ({ fields, handleBlur, handleChange, handleSubmit, hasValidationE
|
|
|
39
40
|
secondaryButtonText,
|
|
40
41
|
toSignIn,
|
|
41
42
|
]);
|
|
42
|
-
return (<common_1.DefaultContent {...rest} buttons={buttons} fields={fieldsWithHandlers} headerText={headerText} isPending={isPending} validationErrors={fieldValidationErrors}/>);
|
|
43
|
+
return (<common_1.DefaultContent {...rest} body={body} buttons={buttons} fields={fieldsWithHandlers} headerText={headerText} isPending={isPending} validationErrors={fieldValidationErrors}/>);
|
|
43
44
|
};
|
|
44
45
|
SignUp.Footer = common_1.DefaultFooter;
|
|
45
46
|
SignUp.FormFields = common_1.DefaultTextFormFields;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VerifyUser = exports.SignUp = exports.SignIn = exports.
|
|
3
|
+
exports.VerifyUser = exports.SignUp = exports.SignIn = exports.SetupTotp = exports.ForgotPassword = exports.ForceNewPassword = exports.ConfirmVerifyUser = exports.ConfirmSignUp = exports.ConfirmSignIn = exports.ConfirmResetPassword = void 0;
|
|
4
4
|
var ConfirmResetPassword_1 = require("./ConfirmResetPassword");
|
|
5
5
|
Object.defineProperty(exports, "ConfirmResetPassword", { enumerable: true, get: function () { return ConfirmResetPassword_1.ConfirmResetPassword; } });
|
|
6
6
|
var ConfirmSignIn_1 = require("./ConfirmSignIn");
|
|
@@ -11,10 +11,10 @@ var ConfirmVerifyUser_1 = require("./ConfirmVerifyUser");
|
|
|
11
11
|
Object.defineProperty(exports, "ConfirmVerifyUser", { enumerable: true, get: function () { return ConfirmVerifyUser_1.ConfirmVerifyUser; } });
|
|
12
12
|
var ForceNewPassword_1 = require("./ForceNewPassword");
|
|
13
13
|
Object.defineProperty(exports, "ForceNewPassword", { enumerable: true, get: function () { return ForceNewPassword_1.ForceNewPassword; } });
|
|
14
|
-
var
|
|
15
|
-
Object.defineProperty(exports, "
|
|
16
|
-
var
|
|
17
|
-
Object.defineProperty(exports, "
|
|
14
|
+
var ForgotPassword_1 = require("./ForgotPassword");
|
|
15
|
+
Object.defineProperty(exports, "ForgotPassword", { enumerable: true, get: function () { return ForgotPassword_1.ForgotPassword; } });
|
|
16
|
+
var SetupTotp_1 = require("./SetupTotp");
|
|
17
|
+
Object.defineProperty(exports, "SetupTotp", { enumerable: true, get: function () { return SetupTotp_1.SetupTotp; } });
|
|
18
18
|
var SignIn_1 = require("./SignIn");
|
|
19
19
|
Object.defineProperty(exports, "SignIn", { enumerable: true, get: function () { return SignIn_1.SignIn; } });
|
|
20
20
|
var SignUp_1 = require("./SignUp");
|
|
@@ -4,15 +4,13 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
5
|
const primitives_1 = require("../../../primitives");
|
|
6
6
|
const hooks_1 = require("../../../hooks");
|
|
7
|
-
const styles_1 = require("./styles");
|
|
8
7
|
function FederatedProviderButton({ children, source, style, textStyle, ...rest }) {
|
|
9
8
|
const pressableStyle = (0, hooks_1.usePressableContainerStyles)({
|
|
10
|
-
containerStyle: styles_1.styles.container,
|
|
11
9
|
overrideStyle: style,
|
|
12
10
|
});
|
|
13
11
|
return (<primitives_1.Button {...rest} style={pressableStyle}>
|
|
14
|
-
<primitives_1.Icon source={source}
|
|
15
|
-
<primitives_1.Label style={
|
|
12
|
+
<primitives_1.Icon source={source} size={20}/>
|
|
13
|
+
<primitives_1.Label style={textStyle}>{children}</primitives_1.Label>
|
|
16
14
|
</primitives_1.Button>);
|
|
17
15
|
}
|
|
18
16
|
exports.default = FederatedProviderButton;
|
|
@@ -3,24 +3,37 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const react_native_1 = require("react-native");
|
|
6
|
+
const auth_1 = require("aws-amplify/auth");
|
|
6
7
|
const ui_1 = require("@aws-amplify/ui");
|
|
7
|
-
const assets_1 = require("../../../assets");
|
|
8
|
-
const FederatedProviderButton_1 = require("../FederatedProviderButton");
|
|
9
8
|
const primitives_1 = require("../../../primitives");
|
|
9
|
+
const theme_1 = require("../../../theme");
|
|
10
|
+
const FederatedProviderButton_1 = require("../FederatedProviderButton");
|
|
11
|
+
const assets_1 = require("../../../assets");
|
|
10
12
|
const styles_1 = require("./styles");
|
|
11
|
-
|
|
13
|
+
const { getSignInWithFederationText, getOrText } = ui_1.authenticatorTextUtil;
|
|
14
|
+
// use `signInWithRedirect` directly instead of `toFederatedSignIn`
|
|
15
|
+
// exposed on `useAuthenticator` for RN. `@aws-amplify/rtn-web-browser`
|
|
16
|
+
// does not emit an event on federated sign in flow cancellation,
|
|
17
|
+
// preventing the `Authenticator` from updating state and leaving the
|
|
18
|
+
// UI in a "pending" state
|
|
19
|
+
const handleSignInWithRedirect = (provider) => (0, auth_1.signInWithRedirect)({ provider: (0, ui_1.capitalize)(provider) });
|
|
20
|
+
function FederatedProviderButtons({ buttonStyle, dividerLabelStyle, route, socialProviders, style, }) {
|
|
21
|
+
const theme = (0, theme_1.useTheme)();
|
|
22
|
+
const themedStyle = (0, styles_1.getThemedStyles)(theme);
|
|
12
23
|
const providerButtons = (0, react_1.useMemo)(() => socialProviders?.map((provider) => {
|
|
13
24
|
const providerIconSource = assets_1.icons[`${provider}Logo`];
|
|
14
25
|
const handlePress = () => {
|
|
15
|
-
|
|
26
|
+
handleSignInWithRedirect(provider);
|
|
16
27
|
};
|
|
17
|
-
return (<FederatedProviderButton_1.FederatedProviderButton key={provider} onPress={handlePress} source={providerIconSource} style={
|
|
18
|
-
{
|
|
28
|
+
return (<FederatedProviderButton_1.FederatedProviderButton key={provider} onPress={handlePress} source={providerIconSource} style={[themedStyle.button, buttonStyle]}>
|
|
29
|
+
{getSignInWithFederationText(route, provider)}
|
|
19
30
|
</FederatedProviderButton_1.FederatedProviderButton>);
|
|
20
|
-
}), [socialProviders,
|
|
21
|
-
return providerButtons?.length ? (<react_native_1.View style={
|
|
31
|
+
}), [route, socialProviders, themedStyle, buttonStyle]);
|
|
32
|
+
return providerButtons?.length ? (<react_native_1.View style={[themedStyle.container, style]} testID="amplify__federated-provider-buttons">
|
|
22
33
|
{providerButtons}
|
|
23
|
-
<primitives_1.Divider labelStyle={
|
|
34
|
+
<primitives_1.Divider labelStyle={[themedStyle.dividerLabel, dividerLabelStyle]}>
|
|
35
|
+
{getOrText()}
|
|
36
|
+
</primitives_1.Divider>
|
|
24
37
|
</react_native_1.View>) : null;
|
|
25
38
|
}
|
|
26
39
|
exports.default = FederatedProviderButtons;
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
exports.getThemedStyles = void 0;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
const getThemedStyles = (theme) => {
|
|
6
|
+
const { space } = theme.tokens;
|
|
7
|
+
return react_native_1.StyleSheet.create({
|
|
8
|
+
button: {
|
|
9
|
+
marginVertical: space.xs,
|
|
10
|
+
},
|
|
11
|
+
dividerLabel: {
|
|
12
|
+
textAlign: 'center',
|
|
13
|
+
},
|
|
14
|
+
container: {
|
|
15
|
+
marginHorizontal: space.small,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
8
18
|
};
|
|
19
|
+
exports.getThemedStyles = getThemedStyles;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const react_1 = require("react");
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const logger = new
|
|
4
|
+
const utils_1 = require("aws-amplify/utils");
|
|
5
|
+
const utils_2 = require("./utils");
|
|
6
|
+
const logger = new utils_1.ConsoleLogger('Authenticator');
|
|
7
7
|
function useFieldValues({ componentName, fields = [], handleBlur, handleChange, handleSubmit, validationErrors, }) {
|
|
8
8
|
const [values, setValues] = (0, react_1.useState)({});
|
|
9
9
|
const [touched, setTouched] = (0, react_1.useState)({});
|
|
@@ -15,12 +15,12 @@ function useFieldValues({ componentName, fields = [], handleBlur, handleChange,
|
|
|
15
15
|
return [];
|
|
16
16
|
}
|
|
17
17
|
if (isRadioFieldComponent) {
|
|
18
|
-
return (0,
|
|
18
|
+
return (0, utils_2.getSanitizedRadioFields)(fields, componentName);
|
|
19
19
|
}
|
|
20
|
-
return (0,
|
|
20
|
+
return (0, utils_2.getSanitizedTextFields)(fields, componentName);
|
|
21
21
|
}, [componentName, fields, isRadioFieldComponent]);
|
|
22
22
|
const fieldsWithHandlers = sanitizedFields.map((field) => {
|
|
23
|
-
if ((0,
|
|
23
|
+
if ((0, utils_2.isRadioFieldOptions)(field)) {
|
|
24
24
|
const onChange = (value) => {
|
|
25
25
|
// call `onChange` passed as radio `field` option
|
|
26
26
|
field.onChange?.(value);
|
|
@@ -38,7 +38,7 @@ function useFieldValues({ componentName, fields = [], handleBlur, handleChange,
|
|
|
38
38
|
handleBlur({ name, value: values[name] });
|
|
39
39
|
setFieldValidationErrors({
|
|
40
40
|
...fieldValidationErrors,
|
|
41
|
-
[name]: (0,
|
|
41
|
+
[name]: (0, utils_2.runFieldValidation)(field, values[name], validationErrors),
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
44
|
const onChangeText = (value) => {
|
|
@@ -49,7 +49,7 @@ function useFieldValues({ componentName, fields = [], handleBlur, handleChange,
|
|
|
49
49
|
if (touched[name]) {
|
|
50
50
|
setFieldValidationErrors({
|
|
51
51
|
...fieldValidationErrors,
|
|
52
|
-
[name]: (0,
|
|
52
|
+
[name]: (0, utils_2.runFieldValidation)(field, value, validationErrors),
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
setValues({ ...values, [name]: value });
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.runFieldValidation = exports.getRouteTypedFields = exports.getTypedFields = exports.getTypedField = exports.getSanitizedTextFields = exports.getSanitizedRadioFields = exports.isRadioFieldOptions = void 0;
|
|
4
|
-
const
|
|
4
|
+
const utils_1 = require("aws-amplify/utils");
|
|
5
5
|
const ui_1 = require("@aws-amplify/ui");
|
|
6
6
|
const ui_react_core_1 = require("@aws-amplify/ui-react-core");
|
|
7
7
|
const constants_1 = require("./constants");
|
|
8
|
-
const logger = new
|
|
8
|
+
const logger = new utils_1.ConsoleLogger('Authenticator');
|
|
9
9
|
const { getInvalidEmailText, getRequiredFieldText } = ui_1.authenticatorTextUtil;
|
|
10
10
|
const isRadioFieldOptions = (field) => field?.type === 'radio';
|
|
11
11
|
exports.isRadioFieldOptions = isRadioFieldOptions;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const react_native_1 = require("react-native");
|
|
4
|
-
const
|
|
5
|
-
const logger = new
|
|
4
|
+
const utils_1 = require("aws-amplify/utils");
|
|
5
|
+
const logger = new utils_1.ConsoleLogger('InAppMessaging');
|
|
6
6
|
const handleMessageLinkAction = async (url) => {
|
|
7
7
|
let supported = false;
|
|
8
8
|
try {
|
|
@@ -6,4 +6,4 @@ var ImagePrefetchStatus;
|
|
|
6
6
|
ImagePrefetchStatus["Failure"] = "FAILURE";
|
|
7
7
|
ImagePrefetchStatus["Fetching"] = "FETCHING";
|
|
8
8
|
ImagePrefetchStatus["Success"] = "SUCCESS";
|
|
9
|
-
})(ImagePrefetchStatus
|
|
9
|
+
})(ImagePrefetchStatus || (exports.ImagePrefetchStatus = ImagePrefetchStatus = {}));
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const react_1 = require("react");
|
|
4
4
|
const react_native_1 = require("react-native");
|
|
5
|
-
const
|
|
5
|
+
const utils_1 = require("aws-amplify/utils");
|
|
6
6
|
const types_1 = require("./types");
|
|
7
|
-
const
|
|
8
|
-
const logger = new
|
|
7
|
+
const utils_2 = require("./utils");
|
|
8
|
+
const logger = new utils_1.ConsoleLogger('InAppMessaging');
|
|
9
9
|
/**
|
|
10
10
|
* Handles prefetching and dimension setting for message images
|
|
11
11
|
*
|
|
@@ -28,11 +28,11 @@ function useMessageImage(image, layout) {
|
|
|
28
28
|
if (!shouldPrefetch) {
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
(0,
|
|
31
|
+
(0, utils_2.prefetchNetworkImage)(src).then((prefetchResult) => {
|
|
32
32
|
if (prefetchResult === 'loaded') {
|
|
33
33
|
// get image size once loaded
|
|
34
34
|
react_native_1.Image.getSize(src, (imageWidth, imageHeight) => {
|
|
35
|
-
const { height, width } = (0,
|
|
35
|
+
const { height, width } = (0, utils_2.getLayoutImageDimensions)(imageHeight, imageWidth, layout);
|
|
36
36
|
imageDimensions.height = height;
|
|
37
37
|
imageDimensions.width = width;
|
|
38
38
|
setPrefetchStatus(types_1.ImagePrefetchStatus.Success);
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getLayoutImageDimensions = exports.prefetchNetworkImage = void 0;
|
|
4
4
|
const react_native_1 = require("react-native");
|
|
5
|
-
const
|
|
5
|
+
const utils_1 = require("aws-amplify/utils");
|
|
6
6
|
const constants_1 = require("./constants");
|
|
7
|
-
const logger = new
|
|
7
|
+
const logger = new utils_1.ConsoleLogger('InAppMessaging');
|
|
8
8
|
const inAppMessageImageSizes = {
|
|
9
9
|
BOTTOM_BANNER: constants_1.BANNER_IMAGE_SCREEN_SIZE,
|
|
10
10
|
MIDDLE_BANNER: constants_1.BANNER_IMAGE_SCREEN_SIZE,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withInAppMessaging = exports.InAppMessageDisplay = exports.useInAppMessaging = exports.InAppMessagingProvider = void 0;
|
|
4
|
+
// re-export in-app types from '@aws-amplify/ui-react-core-notifications'
|
|
4
5
|
var ui_react_core_notifications_1 = require("@aws-amplify/ui-react-core-notifications");
|
|
5
6
|
Object.defineProperty(exports, "InAppMessagingProvider", { enumerable: true, get: function () { return ui_react_core_notifications_1.InAppMessagingProvider; } });
|
|
6
7
|
Object.defineProperty(exports, "useInAppMessaging", { enumerable: true, get: function () { return ui_react_core_notifications_1.useInAppMessaging; } });
|
|
@@ -8,8 +8,10 @@ const getThemedStyles = (theme) => {
|
|
|
8
8
|
return react_native_1.StyleSheet.create({
|
|
9
9
|
container: {
|
|
10
10
|
alignItems: 'center',
|
|
11
|
-
backgroundColor: colors.transparent,
|
|
12
11
|
justifyContent: 'center',
|
|
12
|
+
flexDirection: 'row',
|
|
13
|
+
gap: space.small,
|
|
14
|
+
backgroundColor: colors.transparent,
|
|
13
15
|
paddingVertical: space.small,
|
|
14
16
|
paddingHorizontal: space.medium,
|
|
15
17
|
borderRadius: radii.small,
|
|
@@ -21,7 +23,7 @@ const getThemedStyles = (theme) => {
|
|
|
21
23
|
...components?.button?.containerDefault,
|
|
22
24
|
},
|
|
23
25
|
containerPrimary: {
|
|
24
|
-
backgroundColor: colors.
|
|
26
|
+
backgroundColor: colors.primary[80],
|
|
25
27
|
...components?.button?.containerPrimary,
|
|
26
28
|
},
|
|
27
29
|
containerLink: {
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const react_native_1 = require("react-native");
|
|
6
|
-
const ui_1 = require("@aws-amplify/ui");
|
|
7
6
|
const CarouselPageIndicator_1 = tslib_1.__importDefault(require("./CarouselPageIndicator"));
|
|
8
7
|
const constants_1 = require("./constants");
|
|
9
8
|
const styles_1 = require("./styles");
|
|
@@ -40,16 +39,7 @@ function Carousel(props) {
|
|
|
40
39
|
updateOrientation(window.width);
|
|
41
40
|
};
|
|
42
41
|
const subscription = react_native_1.Dimensions.addEventListener('change', orientationHandler);
|
|
43
|
-
|
|
44
|
-
// available so try to remove via a `EmitterSubscription` first before falling back to `removeEventListener`
|
|
45
|
-
return () => {
|
|
46
|
-
if ((0, ui_1.isFunction)(subscription?.remove)) {
|
|
47
|
-
subscription.remove();
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
react_native_1.Dimensions.removeEventListener('change', orientationHandler);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
42
|
+
return subscription.remove;
|
|
53
43
|
}, [updateOrientation]);
|
|
54
44
|
const carouselRenderItem = (renderInfo) => (<react_native_1.View style={{ width }}>{renderItem(renderInfo)}</react_native_1.View>);
|
|
55
45
|
if (!data?.length) {
|
|
@@ -4,7 +4,7 @@ exports.getThemedStyles = void 0;
|
|
|
4
4
|
const react_native_1 = require("react-native");
|
|
5
5
|
const getThemedStyles = (theme) => {
|
|
6
6
|
const { tokens, components } = theme;
|
|
7
|
-
const { colors, fontSizes, space } = tokens;
|
|
7
|
+
const { colors, fontSizes, space, borderWidths } = tokens;
|
|
8
8
|
return react_native_1.StyleSheet.create({
|
|
9
9
|
container: {
|
|
10
10
|
alignItems: 'center',
|
|
@@ -15,12 +15,13 @@ const getThemedStyles = (theme) => {
|
|
|
15
15
|
fontSize: fontSizes.medium,
|
|
16
16
|
margin: space.medium,
|
|
17
17
|
textAlign: 'center',
|
|
18
|
+
color: colors.font.tertiary,
|
|
18
19
|
...components?.divider?.label,
|
|
19
20
|
},
|
|
20
21
|
line: {
|
|
21
|
-
backgroundColor: colors.
|
|
22
|
+
backgroundColor: colors.border.secondary,
|
|
22
23
|
flex: 1,
|
|
23
|
-
height:
|
|
24
|
+
height: borderWidths.small,
|
|
24
25
|
...components?.divider?.line,
|
|
25
26
|
},
|
|
26
27
|
});
|
|
@@ -10,10 +10,10 @@ const IconButton_1 = require("../IconButton");
|
|
|
10
10
|
const theme_1 = require("../../theme");
|
|
11
11
|
const styles_1 = require("./styles");
|
|
12
12
|
exports.CLOSE_BUTTON_TEST_ID = 'authenticator--error-message--close-button';
|
|
13
|
-
function ErrorMessage({ children, iconStyle, labelStyle, onDismiss, style, ...rest }) {
|
|
13
|
+
function ErrorMessage({ accessible = true, accessibilityRole = 'alert', children, iconStyle, labelStyle, onDismiss, style, ...rest }) {
|
|
14
14
|
const theme = (0, theme_1.useTheme)();
|
|
15
15
|
const themedStyle = (0, styles_1.getThemedStyles)(theme);
|
|
16
|
-
return (<react_native_1.View {...rest} accessibilityRole=
|
|
16
|
+
return (<react_native_1.View {...rest} accessible={accessible} accessibilityRole={accessibilityRole} style={[themedStyle.container, style]}>
|
|
17
17
|
<Icon_1.Icon size={20} source={assets_1.icons.error} style={[themedStyle.icon, iconStyle]}/>
|
|
18
18
|
<react_native_1.Text style={[themedStyle.label, labelStyle]}>{children}</react_native_1.Text>
|
|
19
19
|
{onDismiss ? (<IconButton_1.IconButton onPress={onDismiss} size={20} source={assets_1.icons.close} style={themedStyle.icon} testID={exports.CLOSE_BUTTON_TEST_ID}/>) : null}
|
|
@@ -5,11 +5,12 @@ const react_1 = tslib_1.__importStar(require("react"));
|
|
|
5
5
|
const react_native_1 = require("react-native");
|
|
6
6
|
const theme_1 = require("../../theme");
|
|
7
7
|
const styles_1 = require("./styles");
|
|
8
|
-
function Icon({ accessibilityRole = 'image', animated, color, size, style, ...rest }) {
|
|
8
|
+
function Icon({ accessible = true, accessibilityRole = 'image', animated, color, size, style, ...rest }) {
|
|
9
9
|
const theme = (0, theme_1.useTheme)();
|
|
10
10
|
const themedStyle = (0, react_1.useMemo)(() => (0, styles_1.getThemedStyles)(theme, color, size), [theme, color, size]);
|
|
11
11
|
const imageProps = {
|
|
12
12
|
...rest,
|
|
13
|
+
accessible,
|
|
13
14
|
accessibilityRole,
|
|
14
15
|
style: [themedStyle.icon, style],
|
|
15
16
|
};
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getThemedStyles = void 0;
|
|
4
4
|
const react_native_1 = require("react-native");
|
|
5
|
-
const
|
|
5
|
+
const utils_1 = require("aws-amplify/utils");
|
|
6
6
|
const constants_1 = require("./constants");
|
|
7
|
-
const logger = new
|
|
7
|
+
const logger = new utils_1.ConsoleLogger('Icon-logger');
|
|
8
8
|
const getIconSize = (size) => {
|
|
9
9
|
if (!size) {
|
|
10
10
|
return constants_1.iconSizes.medium;
|
|
@@ -29,7 +29,7 @@ const getThemedStyles = (theme) => {
|
|
|
29
29
|
...components?.radio?.radioContainer,
|
|
30
30
|
},
|
|
31
31
|
radioDot: {
|
|
32
|
-
backgroundColor: colors.
|
|
32
|
+
backgroundColor: colors.primary[80],
|
|
33
33
|
borderRadius: ROUNDED_BORDER_RADIUS,
|
|
34
34
|
...components?.radio?.radioDot,
|
|
35
35
|
},
|
|
@@ -8,7 +8,7 @@ const theme_1 = require("../../theme");
|
|
|
8
8
|
const Label_1 = require("../Label");
|
|
9
9
|
const utils_1 = require("../Label/utils");
|
|
10
10
|
const styles_1 = require("./styles");
|
|
11
|
-
function RadioGroup({ accessibilityRole = 'radiogroup', children, direction = 'vertical', disabled, initialValue, label, labelPosition = 'top', labelStyle, onChange, onValueChange, size, style, ...rest }) {
|
|
11
|
+
function RadioGroup({ accessible = true, accessibilityRole = 'radiogroup', children, direction = 'vertical', disabled, initialValue, label, labelPosition = 'top', labelStyle, onChange, onValueChange, size, style, ...rest }) {
|
|
12
12
|
const theme = (0, theme_1.useTheme)();
|
|
13
13
|
const themedStyle = (0, styles_1.getThemedStyles)(theme);
|
|
14
14
|
const [value, setValue] = (0, react_1.useState)(initialValue);
|
|
@@ -30,7 +30,7 @@ function RadioGroup({ accessibilityRole = 'radiogroup', children, direction = 'v
|
|
|
30
30
|
onChange?.(nextValue);
|
|
31
31
|
}, [onChange]);
|
|
32
32
|
return (<react_native_1.View {...rest} style={[themedStyle.container, containerStyle, style]}>
|
|
33
|
-
<react_native_1.View accessibilityRole={accessibilityRole} style={childContainerStyle}>
|
|
33
|
+
<react_native_1.View accessible={accessible} accessibilityRole={accessibilityRole} style={childContainerStyle}>
|
|
34
34
|
{react_1.Children.map(children, (child) => {
|
|
35
35
|
if ((0, react_1.isValidElement)(child)) {
|
|
36
36
|
const { disabled: childDisabled, onChange: childOnChange, value: childValue, size: childSize, } = child.props;
|
|
@@ -5,13 +5,13 @@ const react_1 = tslib_1.__importStar(require("react"));
|
|
|
5
5
|
const react_native_1 = require("react-native");
|
|
6
6
|
const theme_1 = require("../../theme");
|
|
7
7
|
const styles_1 = require("./styles");
|
|
8
|
-
function Tabs({ children, indicatorPosition = 'bottom', onChange, selectedIndex = 0, style, ...rest }) {
|
|
8
|
+
function Tabs({ accessible = true, accessibilityRole = 'tablist', children, indicatorPosition = 'bottom', onChange, selectedIndex = 0, style, ...rest }) {
|
|
9
9
|
const theme = (0, theme_1.useTheme)();
|
|
10
10
|
const themedStyle = (0, styles_1.getThemedStyles)(theme, indicatorPosition);
|
|
11
11
|
const handleOnChange = (nextIndex) => {
|
|
12
12
|
onChange?.(nextIndex);
|
|
13
13
|
};
|
|
14
|
-
return (<react_native_1.View {...rest} accessibilityRole=
|
|
14
|
+
return (<react_native_1.View {...rest} accessible={accessible} accessibilityRole={accessibilityRole} style={[themedStyle.tabList, style]}>
|
|
15
15
|
{react_1.Children.map(children, (child, index) => {
|
|
16
16
|
if ((0, react_1.isValidElement)(child)) {
|
|
17
17
|
return (0, react_1.cloneElement)(child, {
|
|
@@ -7,12 +7,12 @@ const getThemedStyles = (theme, indicatorPosition) => {
|
|
|
7
7
|
const selectedTabBorderStyles = {};
|
|
8
8
|
const tabBorderStyles = {};
|
|
9
9
|
if (indicatorPosition && indicatorPosition === 'top') {
|
|
10
|
-
selectedTabBorderStyles.borderTopColor = colors.
|
|
10
|
+
selectedTabBorderStyles.borderTopColor = colors.primary[80];
|
|
11
11
|
tabBorderStyles.borderTopWidth = borderWidths.medium;
|
|
12
12
|
tabBorderStyles.borderTopColor = colors.border.secondary;
|
|
13
13
|
}
|
|
14
14
|
else {
|
|
15
|
-
selectedTabBorderStyles.borderBottomColor = colors.
|
|
15
|
+
selectedTabBorderStyles.borderBottomColor = colors.primary[80];
|
|
16
16
|
tabBorderStyles.borderBottomWidth = borderWidths.medium;
|
|
17
17
|
tabBorderStyles.borderBottomColor = colors.border.secondary;
|
|
18
18
|
}
|
|
@@ -49,7 +49,7 @@ const getThemedStyles = (theme, indicatorPosition) => {
|
|
|
49
49
|
},
|
|
50
50
|
selected: {
|
|
51
51
|
backgroundColor: colors.background.primary,
|
|
52
|
-
color: colors.
|
|
52
|
+
color: colors.primary[80],
|
|
53
53
|
...selectedTabBorderStyles,
|
|
54
54
|
...components?.tabs?.selected,
|
|
55
55
|
},
|
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": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -11,47 +11,32 @@
|
|
|
11
11
|
"build:cjs": "tsc --project tsconfig.cjs.json && cp -a src/assets/icons lib/assets",
|
|
12
12
|
"build:esm": "tsc --project tsconfig.esm.json && cp -a src/assets/icons dist/assets",
|
|
13
13
|
"clean": "rimraf dist",
|
|
14
|
-
"dev": "
|
|
14
|
+
"dev": "tsc --watch",
|
|
15
15
|
"lint": "yarn typecheck && eslint src",
|
|
16
16
|
"prebuild": "rimraf dist",
|
|
17
17
|
"test": "jest",
|
|
18
|
-
"test:ci": "yarn test",
|
|
19
18
|
"test:watch": "yarn test --watch",
|
|
20
19
|
"typecheck": "tsc --noEmit"
|
|
21
20
|
},
|
|
22
21
|
"devDependencies": {
|
|
23
|
-
"@aws-amplify/
|
|
24
|
-
"@babel/cli": "^7.
|
|
25
|
-
"@babel/core": "^7.
|
|
26
|
-
"@babel/preset-env": "^7.
|
|
27
|
-
"@
|
|
28
|
-
"@testing-library/react-native": "^
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"@types/react-test-renderer": "^17.0.1",
|
|
32
|
-
"babel-jest": "^28.0.3",
|
|
33
|
-
"eslint": "^8.44.0",
|
|
34
|
-
"jest": "^27.0.4",
|
|
35
|
-
"metro-react-native-babel-preset": "^0.70.2",
|
|
36
|
-
"react": "^17.0.2",
|
|
37
|
-
"react-native": "^0.68.1",
|
|
38
|
-
"react-native-safe-area-context": "^4.2.5",
|
|
39
|
-
"react-test-renderer": "^17.0.2",
|
|
40
|
-
"rimraf": "^3.0.2"
|
|
22
|
+
"@aws-amplify/react-native": "^1.0.1",
|
|
23
|
+
"@babel/cli": "^7.23.0",
|
|
24
|
+
"@babel/core": "^7.23.2",
|
|
25
|
+
"@babel/preset-env": "^7.23.2",
|
|
26
|
+
"@babel/preset-typescript": "^7.23.2",
|
|
27
|
+
"@testing-library/react-native": "^12.3.0",
|
|
28
|
+
"metro-react-native-babel-preset": "^0.77.0",
|
|
29
|
+
"react-native-safe-area-context": "^4.7.3"
|
|
41
30
|
},
|
|
42
31
|
"dependencies": {
|
|
43
|
-
"@aws-amplify/ui": "
|
|
44
|
-
"@aws-amplify/ui-react-core": "
|
|
45
|
-
"@aws-amplify/ui-react-core-notifications": "
|
|
32
|
+
"@aws-amplify/ui": "6.0.0",
|
|
33
|
+
"@aws-amplify/ui-react-core": "3.0.0",
|
|
34
|
+
"@aws-amplify/ui-react-core-notifications": "2.0.0"
|
|
46
35
|
},
|
|
47
36
|
"peerDependencies": {
|
|
48
|
-
"aws-amplify": "^
|
|
49
|
-
"react": "
|
|
50
|
-
"react-native": "
|
|
51
|
-
"react-native-safe-area-context": ">= 4.2.5"
|
|
52
|
-
},
|
|
53
|
-
"resolutions": {
|
|
54
|
-
"@types/react": "^17.0.2"
|
|
37
|
+
"aws-amplify": "^6.0.2",
|
|
38
|
+
"react-native": "^0.70 || ^0.71 || ^0.72",
|
|
39
|
+
"react-native-safe-area-context": "^4.2.5"
|
|
55
40
|
},
|
|
56
41
|
"files": [
|
|
57
42
|
"dist",
|