@aws-amplify/ui-react-native 1.2.28 → 2.0.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/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} +2 -2
- package/dist/Authenticator/Defaults/{ResetPassword/ResetPassword.js → ForgotPassword/ForgotPassword.js} +1 -1
- 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 +11 -11
- 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/lib/Authenticator/Authenticator.js +17 -14
- package/lib/Authenticator/Defaults/{ResetPassword/ResetPassword.js → ForgotPassword/ForgotPassword.js} +1 -1
- 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/package.json +16 -31
- package/src/Authenticator/Authenticator.tsx +20 -17
- package/src/Authenticator/Defaults/{ResetPassword/ResetPassword.tsx → ForgotPassword/ForgotPassword.tsx} +3 -3
- 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 +13 -13
- 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/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
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/ui-react-native",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
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",
|
|
@@ -8,10 +8,9 @@ import {
|
|
|
8
8
|
useAuthenticator,
|
|
9
9
|
useAuthenticatorRoute,
|
|
10
10
|
useAuthenticatorInitMachine,
|
|
11
|
+
useSetUserAgent,
|
|
11
12
|
} from '@aws-amplify/ui-react-core';
|
|
12
13
|
|
|
13
|
-
import { configureComponent } from '@aws-amplify/ui';
|
|
14
|
-
|
|
15
14
|
import { useDeprecationWarning } from '../hooks';
|
|
16
15
|
import { DefaultContainer, InnerContainer } from './common';
|
|
17
16
|
import { TypedField, getRouteTypedFields } from './hooks';
|
|
@@ -24,8 +23,8 @@ import {
|
|
|
24
23
|
ConfirmSignUp,
|
|
25
24
|
ConfirmVerifyUser,
|
|
26
25
|
ForceNewPassword,
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
ForgotPassword,
|
|
27
|
+
SetupTotp,
|
|
29
28
|
SignIn,
|
|
30
29
|
SignUp,
|
|
31
30
|
VerifyUser,
|
|
@@ -37,8 +36,8 @@ const DEFAULTS = {
|
|
|
37
36
|
ConfirmSignUp,
|
|
38
37
|
ConfirmVerifyUser,
|
|
39
38
|
ForceNewPassword,
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
ForgotPassword,
|
|
40
|
+
SetupTotp,
|
|
42
41
|
SignIn,
|
|
43
42
|
SignUp,
|
|
44
43
|
VerifyUser,
|
|
@@ -61,19 +60,22 @@ function Authenticator({
|
|
|
61
60
|
useDeprecationWarning({
|
|
62
61
|
message:
|
|
63
62
|
'The `passwordSettings` prop has been deprecated and will be removed in a future major version of Amplify UI.',
|
|
64
|
-
shouldWarn: !!options?.passwordSettings,
|
|
63
|
+
// shouldWarn: !!options?.passwordSettings,
|
|
64
|
+
/**
|
|
65
|
+
* @migration turn off until getConfig returns zero config
|
|
66
|
+
*/
|
|
67
|
+
shouldWarn: false,
|
|
65
68
|
});
|
|
66
69
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}, []);
|
|
70
|
+
useSetUserAgent({
|
|
71
|
+
componentName: 'Authenticator',
|
|
72
|
+
packageName: 'react-native',
|
|
73
|
+
version: VERSION,
|
|
74
|
+
});
|
|
73
75
|
|
|
74
76
|
useAuthenticatorInitMachine(options);
|
|
75
77
|
|
|
76
|
-
const {
|
|
78
|
+
const { fields, route } = useAuthenticator(routePropSelector);
|
|
77
79
|
|
|
78
80
|
const components = useMemo(
|
|
79
81
|
// allow any to prevent TS from assuming that all fields are of type `TextFieldOptions`
|
|
@@ -84,8 +86,9 @@ function Authenticator({
|
|
|
84
86
|
const { Component, props } = useAuthenticatorRoute({ components });
|
|
85
87
|
|
|
86
88
|
const typedFields = getRouteTypedFields({ fields, route });
|
|
89
|
+
const isAuthenticatedRoute = route === 'authenticated' || route === 'signOut';
|
|
87
90
|
|
|
88
|
-
if (
|
|
91
|
+
if (isAuthenticatedRoute) {
|
|
89
92
|
return children ? <>{children}</> : null;
|
|
90
93
|
}
|
|
91
94
|
|
|
@@ -110,8 +113,8 @@ Authenticator.ConfirmSignIn = ConfirmSignIn;
|
|
|
110
113
|
Authenticator.ConfirmSignUp = ConfirmSignUp;
|
|
111
114
|
Authenticator.ConfirmVerifyUser = ConfirmVerifyUser;
|
|
112
115
|
Authenticator.ForceNewPassword = ForceNewPassword;
|
|
113
|
-
Authenticator.
|
|
114
|
-
Authenticator.
|
|
116
|
+
Authenticator.ForgotPassword = ForgotPassword;
|
|
117
|
+
Authenticator.SetupTotp = SetupTotp;
|
|
115
118
|
Authenticator.SignIn = SignIn;
|
|
116
119
|
Authenticator.SignUp = SignUp;
|
|
117
120
|
Authenticator.VerifyUser = VerifyUser;
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
} from '../../common';
|
|
10
10
|
import { useFieldValues } from '../../hooks';
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { DefaultForgotPasswordProps } from '../types';
|
|
13
13
|
|
|
14
|
-
const COMPONENT_NAME = '
|
|
14
|
+
const COMPONENT_NAME = 'ForgotPassword';
|
|
15
15
|
const {
|
|
16
16
|
getResetYourPasswordText,
|
|
17
17
|
getSendCodeText,
|
|
@@ -28,7 +28,7 @@ const ResetPassword = ({
|
|
|
28
28
|
toSignIn,
|
|
29
29
|
validationErrors,
|
|
30
30
|
...rest
|
|
31
|
-
}:
|
|
31
|
+
}: DefaultForgotPasswordProps): JSX.Element => {
|
|
32
32
|
const {
|
|
33
33
|
disableFormSubmit: disabled,
|
|
34
34
|
fields: fieldsWithHandlers,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ForgotPassword } from './ForgotPassword';
|