@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.
Files changed (137) hide show
  1. package/dist/Authenticator/Authenticator.d.ts +83 -12
  2. package/dist/Authenticator/Authenticator.js +19 -16
  3. package/dist/Authenticator/Defaults/{ResetPassword/ResetPassword.d.ts → ForgotPassword/ForgotPassword.d.ts} +4 -4
  4. package/dist/Authenticator/Defaults/{ResetPassword/ResetPassword.js → ForgotPassword/ForgotPassword.js} +7 -7
  5. package/dist/Authenticator/Defaults/ForgotPassword/index.d.ts +1 -0
  6. package/dist/Authenticator/Defaults/ForgotPassword/index.js +1 -0
  7. package/dist/Authenticator/Defaults/{SetupTOTP/SetupTOTP.d.ts → SetupTotp/SetupTotp.d.ts} +4 -4
  8. package/dist/Authenticator/Defaults/{SetupTOTP/SetupTOTP.js → SetupTotp/SetupTotp.js} +10 -10
  9. package/dist/Authenticator/Defaults/SetupTotp/index.d.ts +1 -0
  10. package/dist/Authenticator/Defaults/SetupTotp/index.js +1 -0
  11. package/dist/Authenticator/Defaults/SetupTotp/styles.d.ts +5 -0
  12. package/dist/Authenticator/Defaults/SignIn/SignIn.d.ts +1 -1
  13. package/dist/Authenticator/Defaults/SignIn/SignIn.js +6 -5
  14. package/dist/Authenticator/Defaults/SignUp/SignUp.d.ts +1 -1
  15. package/dist/Authenticator/Defaults/SignUp/SignUp.js +4 -3
  16. package/dist/Authenticator/Defaults/index.d.ts +2 -2
  17. package/dist/Authenticator/Defaults/index.js +2 -2
  18. package/dist/Authenticator/Defaults/types.d.ts +13 -13
  19. package/dist/Authenticator/common/FederatedProviderButton/FederatedProviderButton.js +2 -4
  20. package/dist/Authenticator/common/FederatedProviderButton/types.d.ts +3 -1
  21. package/dist/Authenticator/common/FederatedProviderButtons/FederatedProviderButtons.d.ts +1 -1
  22. package/dist/Authenticator/common/FederatedProviderButtons/FederatedProviderButtons.js +24 -11
  23. package/dist/Authenticator/common/FederatedProviderButtons/styles.d.ts +2 -1
  24. package/dist/Authenticator/common/FederatedProviderButtons/styles.js +14 -4
  25. package/dist/Authenticator/common/FederatedProviderButtons/types.d.ts +5 -3
  26. package/dist/Authenticator/hooks/useFieldValues/useFieldValues.js +1 -1
  27. package/dist/Authenticator/hooks/useFieldValues/utils.js +1 -1
  28. package/dist/Authenticator/types.d.ts +1 -1
  29. package/dist/InAppMessaging/components/InAppMessageDisplay/handleMessageLinkAction.js +2 -2
  30. package/dist/InAppMessaging/hooks/useMessageImage/useMessageImage.d.ts +2 -2
  31. package/dist/InAppMessaging/hooks/useMessageImage/useMessageImage.js +2 -2
  32. package/dist/InAppMessaging/hooks/useMessageImage/utils.d.ts +2 -2
  33. package/dist/InAppMessaging/hooks/useMessageImage/utils.js +2 -2
  34. package/dist/InAppMessaging/hooks/useMessageProps/types.d.ts +2 -2
  35. package/dist/InAppMessaging/hooks/useMessageProps/utils.d.ts +2 -2
  36. package/dist/InAppMessaging/index.d.ts +1 -1
  37. package/dist/InAppMessaging/index.js +1 -0
  38. package/dist/assets/icons/icons.ts +3 -0
  39. package/dist/primitives/Button/styles.js +4 -2
  40. package/dist/primitives/Carousel/Carousel.js +1 -11
  41. package/dist/primitives/Divider/styles.js +4 -3
  42. package/dist/primitives/ErrorMessage/ErrorMessage.d.ts +1 -1
  43. package/dist/primitives/ErrorMessage/ErrorMessage.js +2 -2
  44. package/dist/primitives/Icon/Icon.d.ts +1 -1
  45. package/dist/primitives/Icon/Icon.js +2 -1
  46. package/dist/primitives/Icon/styles.js +1 -1
  47. package/dist/primitives/Radio/styles.js +1 -1
  48. package/dist/primitives/RadioGroup/RadioGroup.d.ts +1 -1
  49. package/dist/primitives/RadioGroup/RadioGroup.js +2 -2
  50. package/dist/primitives/Tabs/Tabs.d.ts +1 -1
  51. package/dist/primitives/Tabs/Tabs.js +2 -2
  52. package/dist/primitives/Tabs/styles.js +3 -3
  53. package/dist/utils/platform.d.ts +1 -2
  54. package/dist/version.d.ts +1 -1
  55. package/dist/version.js +1 -1
  56. package/lib/Authenticator/Authenticator.js +17 -14
  57. package/lib/Authenticator/Defaults/{ResetPassword/ResetPassword.js → ForgotPassword/ForgotPassword.js} +7 -7
  58. package/lib/Authenticator/Defaults/ForgotPassword/index.js +8 -0
  59. package/lib/Authenticator/Defaults/{SetupTOTP/SetupTOTP.js → SetupTotp/SetupTotp.js} +10 -10
  60. package/lib/Authenticator/Defaults/{SetupTOTP → SetupTotp}/index.js +3 -3
  61. package/lib/Authenticator/Defaults/SignIn/SignIn.js +5 -4
  62. package/lib/Authenticator/Defaults/SignUp/SignUp.js +3 -2
  63. package/lib/Authenticator/Defaults/index.js +5 -5
  64. package/lib/Authenticator/common/FederatedProviderButton/FederatedProviderButton.js +2 -4
  65. package/lib/Authenticator/common/FederatedProviderButtons/FederatedProviderButtons.js +22 -9
  66. package/lib/Authenticator/common/FederatedProviderButtons/styles.js +16 -5
  67. package/lib/Authenticator/hooks/useFieldValues/useFieldValues.js +8 -8
  68. package/lib/Authenticator/hooks/useFieldValues/utils.js +2 -2
  69. package/lib/InAppMessaging/components/InAppMessageDisplay/handleMessageLinkAction.js +2 -2
  70. package/lib/InAppMessaging/hooks/useMessageImage/types.js +1 -1
  71. package/lib/InAppMessaging/hooks/useMessageImage/useMessageImage.js +5 -5
  72. package/lib/InAppMessaging/hooks/useMessageImage/utils.js +2 -2
  73. package/lib/InAppMessaging/index.js +1 -0
  74. package/lib/assets/icons/icons.ts +3 -0
  75. package/lib/primitives/Button/styles.js +4 -2
  76. package/lib/primitives/Carousel/Carousel.js +1 -11
  77. package/lib/primitives/Divider/styles.js +4 -3
  78. package/lib/primitives/ErrorMessage/ErrorMessage.js +2 -2
  79. package/lib/primitives/Icon/Icon.js +2 -1
  80. package/lib/primitives/Icon/styles.js +2 -2
  81. package/lib/primitives/Radio/styles.js +1 -1
  82. package/lib/primitives/RadioGroup/RadioGroup.js +2 -2
  83. package/lib/primitives/Tabs/Tabs.js +2 -2
  84. package/lib/primitives/Tabs/styles.js +3 -3
  85. package/lib/version.js +1 -1
  86. package/package.json +16 -31
  87. package/src/Authenticator/Authenticator.tsx +20 -17
  88. package/src/Authenticator/Defaults/{ResetPassword/ResetPassword.tsx → ForgotPassword/ForgotPassword.tsx} +9 -9
  89. package/src/Authenticator/Defaults/ForgotPassword/index.ts +1 -0
  90. package/src/Authenticator/Defaults/{SetupTOTP/SetupTOTP.tsx → SetupTotp/SetupTotp.tsx} +13 -13
  91. package/src/Authenticator/Defaults/SetupTotp/index.ts +1 -0
  92. package/src/Authenticator/Defaults/{SetupTOTP → SetupTotp}/styles.ts +2 -2
  93. package/src/Authenticator/Defaults/SignIn/SignIn.tsx +15 -3
  94. package/src/Authenticator/Defaults/SignUp/SignUp.tsx +12 -0
  95. package/src/Authenticator/Defaults/index.ts +2 -2
  96. package/src/Authenticator/Defaults/types.ts +15 -15
  97. package/src/Authenticator/common/FederatedProviderButton/FederatedProviderButton.tsx +2 -4
  98. package/src/Authenticator/common/FederatedProviderButton/types.ts +3 -1
  99. package/src/Authenticator/common/FederatedProviderButtons/FederatedProviderButtons.tsx +41 -13
  100. package/src/Authenticator/common/FederatedProviderButtons/styles.ts +19 -4
  101. package/src/Authenticator/common/FederatedProviderButtons/types.ts +9 -6
  102. package/src/Authenticator/hooks/useFieldValues/useFieldValues.ts +1 -1
  103. package/src/Authenticator/hooks/useFieldValues/utils.ts +1 -1
  104. package/src/Authenticator/types.ts +1 -4
  105. package/src/InAppMessaging/components/InAppMessageDisplay/handleMessageLinkAction.ts +2 -2
  106. package/src/InAppMessaging/hooks/useMessageImage/useMessageImage.ts +6 -6
  107. package/src/InAppMessaging/hooks/useMessageImage/utils.ts +5 -5
  108. package/src/InAppMessaging/hooks/useMessageProps/types.ts +3 -3
  109. package/src/InAppMessaging/hooks/useMessageProps/utils.ts +2 -2
  110. package/src/InAppMessaging/index.ts +9 -0
  111. package/src/assets/icons/icons.ts +3 -0
  112. package/src/hooks/useDeviceOrientation/useDeviceOrientation.ts +6 -1
  113. package/src/primitives/Button/styles.ts +4 -2
  114. package/src/primitives/Carousel/Carousel.tsx +1 -10
  115. package/src/primitives/Divider/styles.ts +4 -3
  116. package/src/primitives/ErrorMessage/ErrorMessage.tsx +4 -1
  117. package/src/primitives/Icon/Icon.tsx +2 -0
  118. package/src/primitives/Icon/styles.ts +1 -1
  119. package/src/primitives/Radio/styles.ts +1 -1
  120. package/src/primitives/RadioGroup/RadioGroup.tsx +6 -1
  121. package/src/primitives/Tabs/Tabs.tsx +4 -1
  122. package/src/primitives/Tabs/styles.ts +3 -3
  123. package/src/version.ts +1 -1
  124. package/dist/Authenticator/Defaults/ResetPassword/index.d.ts +0 -1
  125. package/dist/Authenticator/Defaults/ResetPassword/index.js +0 -1
  126. package/dist/Authenticator/Defaults/SetupTOTP/index.d.ts +0 -1
  127. package/dist/Authenticator/Defaults/SetupTOTP/index.js +0 -1
  128. package/dist/Authenticator/Defaults/SetupTOTP/styles.d.ts +0 -5
  129. package/dist/Authenticator/common/FederatedProviderButton/styles.d.ts +0 -2
  130. package/dist/Authenticator/common/FederatedProviderButton/styles.js +0 -18
  131. package/lib/Authenticator/Defaults/ResetPassword/index.js +0 -8
  132. package/lib/Authenticator/common/FederatedProviderButton/styles.js +0 -21
  133. package/src/Authenticator/Defaults/ResetPassword/index.ts +0 -1
  134. package/src/Authenticator/Defaults/SetupTOTP/index.ts +0 -1
  135. package/src/Authenticator/common/FederatedProviderButton/styles.ts +0 -21
  136. /package/dist/Authenticator/Defaults/{SetupTOTP → SetupTotp}/styles.js +0 -0
  137. /package/lib/Authenticator/Defaults/{SetupTOTP → SetupTotp}/styles.js +0 -0
@@ -1,2 +1,3 @@
1
+ import { StrictTheme } from '../../../theme';
1
2
  import { FederatedProviderButtonStyle } from './types';
2
- export declare const styles: FederatedProviderButtonStyle;
3
+ export declare const getThemedStyles: (theme: StrictTheme) => FederatedProviderButtonStyle;
@@ -1,5 +1,15 @@
1
- export const styles = {
2
- button: { marginVertical: 8 },
3
- container: { paddingVertical: 4 },
4
- text: { paddingVertical: 8, textAlign: 'center' },
1
+ import { StyleSheet } from 'react-native';
2
+ export const getThemedStyles = (theme) => {
3
+ const { space } = theme.tokens;
4
+ return StyleSheet.create({
5
+ button: {
6
+ marginVertical: space.xs,
7
+ },
8
+ dividerLabel: {
9
+ textAlign: 'center',
10
+ },
11
+ container: {
12
+ marginHorizontal: space.small,
13
+ },
14
+ });
5
15
  };
@@ -1,9 +1,11 @@
1
- import { TextStyle, ViewStyle } from 'react-native';
1
+ import { StyleProp, TextStyle, ViewProps, ViewStyle } from 'react-native';
2
2
  import { AuthenticatorMachineContext } from '@aws-amplify/ui-react-core';
3
- export interface FederatedProviderButtonsProps extends Pick<AuthenticatorMachineContext, 'socialProviders' | 'toFederatedSignIn'> {
3
+ export interface FederatedProviderButtonsProps extends Pick<AuthenticatorMachineContext, 'route' | 'socialProviders' | 'toFederatedSignIn'>, ViewProps {
4
+ buttonStyle?: StyleProp<ViewStyle>;
5
+ dividerLabelStyle?: StyleProp<TextStyle>;
4
6
  }
5
7
  export interface FederatedProviderButtonStyle {
6
8
  button: ViewStyle;
7
9
  container: ViewStyle;
8
- text: TextStyle;
10
+ dividerLabel: TextStyle;
9
11
  }
@@ -1,5 +1,5 @@
1
1
  import { useMemo, useState } from 'react';
2
- import { Logger } from 'aws-amplify';
2
+ import { ConsoleLogger as Logger } from 'aws-amplify/utils';
3
3
  import { getSanitizedTextFields, getSanitizedRadioFields, isRadioFieldOptions, runFieldValidation, } from './utils';
4
4
  const logger = new Logger('Authenticator');
5
5
  export default function useFieldValues({ componentName, fields = [], handleBlur, handleChange, handleSubmit, validationErrors, }) {
@@ -1,4 +1,4 @@
1
- import { Logger } from 'aws-amplify';
1
+ import { ConsoleLogger as Logger } from 'aws-amplify/utils';
2
2
  import { authenticatorTextUtil, isString, isUnverifiedContactMethodType, isValidEmail, UnverifiedContactMethodType, } from '@aws-amplify/ui';
3
3
  import { isAuthenticatorComponentRouteKey, } from '@aws-amplify/ui-react-core';
4
4
  import { KEY_ALLOW_LIST } from './constants';
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { AuthenticatorMachineOptions } from '@aws-amplify/ui';
3
3
  import { DefaultContainerComponent } from './common';
4
4
  import { Components } from './Defaults';
5
- type SupportedAuthenticatorMachineOptions = Omit<AuthenticatorMachineOptions, 'socialProviders' | 'formFields'>;
5
+ type SupportedAuthenticatorMachineOptions = Omit<AuthenticatorMachineOptions, 'formFields'>;
6
6
  export interface AuthenticatorProps extends SupportedAuthenticatorMachineOptions {
7
7
  children?: React.ReactNode;
8
8
  Container?: DefaultContainerComponent;
@@ -1,6 +1,6 @@
1
1
  import { Linking } from 'react-native';
2
- import { ConsoleLogger as Logger } from '@aws-amplify/core';
3
- const logger = new Logger('Notifications.InAppMessaging');
2
+ import { ConsoleLogger as Logger } from 'aws-amplify/utils';
3
+ const logger = new Logger('InAppMessaging');
4
4
  const handleMessageLinkAction = async (url) => {
5
5
  let supported = false;
6
6
  try {
@@ -1,4 +1,4 @@
1
- import { MessageImage, MessageLayout } from '@aws-amplify/ui-react-core-notifications';
1
+ import { InAppMessageImage, InAppMessageLayout } from '@aws-amplify/ui-react-core-notifications';
2
2
  import { UseMessageImage } from './types';
3
3
  /**
4
4
  * Handles prefetching and dimension setting for message images
@@ -7,4 +7,4 @@ import { UseMessageImage } from './types';
7
7
  * @param layout message layout
8
8
  * @returns message image dimensions and rendering related booleans
9
9
  */
10
- export default function useMessageImage(image: MessageImage | undefined, layout: MessageLayout): UseMessageImage;
10
+ export default function useMessageImage(image: InAppMessageImage | undefined, layout: InAppMessageLayout): UseMessageImage;
@@ -1,9 +1,9 @@
1
1
  import { useEffect, useRef, useState } from 'react';
2
2
  import { Image } from 'react-native';
3
- import { ConsoleLogger as Logger } from '@aws-amplify/core';
3
+ import { ConsoleLogger as Logger } from 'aws-amplify/utils';
4
4
  import { ImagePrefetchStatus } from './types';
5
5
  import { getLayoutImageDimensions, prefetchNetworkImage } from './utils';
6
- const logger = new Logger('Notifications.InAppMessaging');
6
+ const logger = new Logger('InAppMessaging');
7
7
  /**
8
8
  * Handles prefetching and dimension setting for message images
9
9
  *
@@ -1,4 +1,4 @@
1
- import { MessageLayout } from '@aws-amplify/ui-react-core-notifications';
1
+ import { InAppMessageLayout } from '@aws-amplify/ui-react-core-notifications';
2
2
  import { ImageDimensions, ImageLoadingState } from './types';
3
3
  export declare const prefetchNetworkImage: (url: string) => Promise<ImageLoadingState>;
4
- export declare const getLayoutImageDimensions: (imageHeight: number, imageWidth: number, layout: MessageLayout) => ImageDimensions;
4
+ export declare const getLayoutImageDimensions: (imageHeight: number, imageWidth: number, layout: InAppMessageLayout) => ImageDimensions;
@@ -1,7 +1,7 @@
1
1
  import { Image } from 'react-native';
2
- import { ConsoleLogger as Logger } from '@aws-amplify/core';
2
+ import { ConsoleLogger as Logger } from 'aws-amplify/utils';
3
3
  import { BANNER_IMAGE_SCREEN_SIZE, CAROUSEL_IMAGE_SCREEN_SIZE, FULL_SCREEN_IMAGE_SCREEN_SIZE, MODAL_IMAGE_SCREEN_SIZE, } from './constants';
4
- const logger = new Logger('Notifications.InAppMessaging');
4
+ const logger = new Logger('InAppMessaging');
5
5
  const inAppMessageImageSizes = {
6
6
  BOTTOM_BANNER: BANNER_IMAGE_SCREEN_SIZE,
7
7
  MIDDLE_BANNER: BANNER_IMAGE_SCREEN_SIZE,
@@ -1,5 +1,5 @@
1
1
  import { ColorValue, ImageStyle, StyleProp, TextStyle, ViewStyle } from 'react-native';
2
- import { MessageLayout, MessagePayloadStyle } from '@aws-amplify/ui-react-core-notifications';
2
+ import { InAppMessageLayout, MessagePayloadStyle } from '@aws-amplify/ui-react-core-notifications';
3
3
  import { ButtonProps } from '../../../primitives';
4
4
  import { ImageDimensions } from '../useMessageImage';
5
5
  /**
@@ -35,7 +35,7 @@ export interface MessageStyleParams {
35
35
  /**
36
36
  * message specific layout
37
37
  */
38
- layout: MessageLayout;
38
+ layout: InAppMessageLayout;
39
39
  /**
40
40
  * style params to derive resolved style from
41
41
  */
@@ -1,4 +1,4 @@
1
- import { MessageComponentBaseProps, MessageLayout, MessagePayloadStyle } from '@aws-amplify/ui-react-core-notifications';
1
+ import { InAppMessageLayout, MessageComponentBaseProps, MessagePayloadStyle } from '@aws-amplify/ui-react-core-notifications';
2
2
  import { MessageButtonStyleParams, MessageButtonStyleProps, MessageComponentStyles, MessageContainerAndWrapperStyle, MessageStyleParams } from './types';
3
3
  /**
4
4
  * Parse and assign appropriate button container and text style from style objects params
@@ -13,7 +13,7 @@ export declare const getComponentButtonStyle: ({ styleParams, buttonType, }: Mes
13
13
  * @param {InAppMessageLayout} layout - message layout
14
14
  * @returns {Boolean} boolean indicating whether entire screen should be filled
15
15
  */
16
- export declare const shouldFillDeviceScreen: (layout: MessageLayout) => boolean;
16
+ export declare const shouldFillDeviceScreen: (layout: InAppMessageLayout) => boolean;
17
17
  /**
18
18
  * Parse and assign appropriate message container and wrapper style from style params
19
19
  *
@@ -1,2 +1,2 @@
1
- export { InAppMessagingProvider, useInAppMessaging, } from '@aws-amplify/ui-react-core-notifications';
1
+ export { InAppMessage, InAppMessageAction, InAppMessageButton, InAppMessageContent, InAppMessageImage, InAppMessageLayout, InAppMessagingProvider, InAppMessageStyle, InAppMessageTextAlign, useInAppMessaging, } from '@aws-amplify/ui-react-core-notifications';
2
2
  export { BannerMessageProps, CarouselMessageProps, FullScreenMessageProps, ModalMessageProps, InAppMessageDisplay, MessageComponents, withInAppMessaging, } from './components';
@@ -1,2 +1,3 @@
1
+ // re-export in-app types from '@aws-amplify/ui-react-core-notifications'
1
2
  export { InAppMessagingProvider, useInAppMessaging, } from '@aws-amplify/ui-react-core-notifications';
2
3
  export { InAppMessageDisplay, withInAppMessaging, } from './components';
@@ -1,3 +1,6 @@
1
+ // disable `@typescript-eslint/no-var-requires` for this file
2
+ // .png icons will be removed in favor of .svg icons
3
+ /* eslint-disable @typescript-eslint/no-var-requires */
1
4
  import { ImageSourcePropType } from 'react-native';
2
5
 
3
6
  const icons = {
@@ -5,8 +5,10 @@ export const getThemedStyles = (theme) => {
5
5
  return StyleSheet.create({
6
6
  container: {
7
7
  alignItems: 'center',
8
- backgroundColor: colors.transparent,
9
8
  justifyContent: 'center',
9
+ flexDirection: 'row',
10
+ gap: space.small,
11
+ backgroundColor: colors.transparent,
10
12
  paddingVertical: space.small,
11
13
  paddingHorizontal: space.medium,
12
14
  borderRadius: radii.small,
@@ -18,7 +20,7 @@ export const getThemedStyles = (theme) => {
18
20
  ...components?.button?.containerDefault,
19
21
  },
20
22
  containerPrimary: {
21
- backgroundColor: colors.brand.primary[80],
23
+ backgroundColor: colors.primary[80],
22
24
  ...components?.button?.containerPrimary,
23
25
  },
24
26
  containerLink: {
@@ -1,6 +1,5 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import { Dimensions, FlatList, View, } from 'react-native';
3
- import { isFunction } from '@aws-amplify/ui';
4
3
  import CarouselPageIndicator from './CarouselPageIndicator';
5
4
  import { VIEWABILITY_CONFIG } from './constants';
6
5
  import { styles } from './styles';
@@ -37,16 +36,7 @@ export default function Carousel(props) {
37
36
  updateOrientation(window.width);
38
37
  };
39
38
  const subscription = Dimensions.addEventListener('change', orientationHandler);
40
- // Clean up listener. Dimensions.removeEventListener is deprecated as of React Native 0.65 but it is technically
41
- // available so try to remove via a `EmitterSubscription` first before falling back to `removeEventListener`
42
- return () => {
43
- if (isFunction(subscription?.remove)) {
44
- subscription.remove();
45
- }
46
- else {
47
- Dimensions.removeEventListener('change', orientationHandler);
48
- }
49
- };
39
+ return subscription.remove;
50
40
  }, [updateOrientation]);
51
41
  const carouselRenderItem = (renderInfo) => (<View style={{ width }}>{renderItem(renderInfo)}</View>);
52
42
  if (!data?.length) {
@@ -1,7 +1,7 @@
1
1
  import { StyleSheet } from 'react-native';
2
2
  export const getThemedStyles = (theme) => {
3
3
  const { tokens, components } = theme;
4
- const { colors, fontSizes, space } = tokens;
4
+ const { colors, fontSizes, space, borderWidths } = tokens;
5
5
  return StyleSheet.create({
6
6
  container: {
7
7
  alignItems: 'center',
@@ -12,12 +12,13 @@ export const getThemedStyles = (theme) => {
12
12
  fontSize: fontSizes.medium,
13
13
  margin: space.medium,
14
14
  textAlign: 'center',
15
+ color: colors.font.tertiary,
15
16
  ...components?.divider?.label,
16
17
  },
17
18
  line: {
18
- backgroundColor: colors.black,
19
+ backgroundColor: colors.border.secondary,
19
20
  flex: 1,
20
- height: StyleSheet.hairlineWidth,
21
+ height: borderWidths.small,
21
22
  ...components?.divider?.line,
22
23
  },
23
24
  });
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { ErrorMessageProps } from './types';
3
3
  export declare const CLOSE_BUTTON_TEST_ID = "authenticator--error-message--close-button";
4
- export default function ErrorMessage({ children, iconStyle, labelStyle, onDismiss, style, ...rest }: ErrorMessageProps): JSX.Element;
4
+ export default function ErrorMessage({ accessible, accessibilityRole, children, iconStyle, labelStyle, onDismiss, style, ...rest }: ErrorMessageProps): JSX.Element;
@@ -6,10 +6,10 @@ import { IconButton } from '../IconButton';
6
6
  import { useTheme } from '../../theme';
7
7
  import { getThemedStyles } from './styles';
8
8
  export const CLOSE_BUTTON_TEST_ID = 'authenticator--error-message--close-button';
9
- export default function ErrorMessage({ children, iconStyle, labelStyle, onDismiss, style, ...rest }) {
9
+ export default function ErrorMessage({ accessible = true, accessibilityRole = 'alert', children, iconStyle, labelStyle, onDismiss, style, ...rest }) {
10
10
  const theme = useTheme();
11
11
  const themedStyle = getThemedStyles(theme);
12
- return (<View {...rest} accessibilityRole="alert" style={[themedStyle.container, style]}>
12
+ return (<View {...rest} accessible={accessible} accessibilityRole={accessibilityRole} style={[themedStyle.container, style]}>
13
13
  <Icon size={20} source={icons.error} style={[themedStyle.icon, iconStyle]}/>
14
14
  <Text style={[themedStyle.label, labelStyle]}>{children}</Text>
15
15
  {onDismiss ? (<IconButton onPress={onDismiss} size={20} source={icons.close} style={themedStyle.icon} testID={CLOSE_BUTTON_TEST_ID}/>) : null}
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { IconProps } from './types';
3
- export default function Icon({ accessibilityRole, animated, color, size, style, ...rest }: IconProps): JSX.Element;
3
+ export default function Icon({ accessible, accessibilityRole, animated, color, size, style, ...rest }: IconProps): JSX.Element;
@@ -2,11 +2,12 @@ import React, { useMemo } from 'react';
2
2
  import { Animated, Image } from 'react-native';
3
3
  import { useTheme } from '../../theme';
4
4
  import { getThemedStyles } from './styles';
5
- export default function Icon({ accessibilityRole = 'image', animated, color, size, style, ...rest }) {
5
+ export default function Icon({ accessible = true, accessibilityRole = 'image', animated, color, size, style, ...rest }) {
6
6
  const theme = useTheme();
7
7
  const themedStyle = useMemo(() => getThemedStyles(theme, color, size), [theme, color, size]);
8
8
  const imageProps = {
9
9
  ...rest,
10
+ accessible,
10
11
  accessibilityRole,
11
12
  style: [themedStyle.icon, style],
12
13
  };
@@ -1,5 +1,5 @@
1
1
  import { StyleSheet } from 'react-native';
2
- import { ConsoleLogger as Logger } from '@aws-amplify/core';
2
+ import { ConsoleLogger as Logger } from 'aws-amplify/utils';
3
3
  import { iconSizes } from './constants';
4
4
  const logger = new Logger('Icon-logger');
5
5
  const getIconSize = (size) => {
@@ -26,7 +26,7 @@ export const getThemedStyles = (theme) => {
26
26
  ...components?.radio?.radioContainer,
27
27
  },
28
28
  radioDot: {
29
- backgroundColor: colors.brand.primary[80],
29
+ backgroundColor: colors.primary[80],
30
30
  borderRadius: ROUNDED_BORDER_RADIUS,
31
31
  ...components?.radio?.radioDot,
32
32
  },
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { RadioGroupProps } from './types';
3
- export default function RadioGroup<T>({ accessibilityRole, children, direction, disabled, initialValue, label, labelPosition, labelStyle, onChange, onValueChange, size, style, ...rest }: RadioGroupProps<T>): JSX.Element;
3
+ export default function RadioGroup<T>({ accessible, accessibilityRole, children, direction, disabled, initialValue, label, labelPosition, labelStyle, onChange, onValueChange, size, style, ...rest }: RadioGroupProps<T>): JSX.Element;
@@ -5,7 +5,7 @@ import { useTheme } from '../../theme';
5
5
  import { Label } from '../Label';
6
6
  import { getFlexDirectionFromLabelPosition } from '../Label/utils';
7
7
  import { getThemedStyles } from './styles';
8
- export default function RadioGroup({ accessibilityRole = 'radiogroup', children, direction = 'vertical', disabled, initialValue, label, labelPosition = 'top', labelStyle, onChange, onValueChange, size, style, ...rest }) {
8
+ export default function RadioGroup({ accessible = true, accessibilityRole = 'radiogroup', children, direction = 'vertical', disabled, initialValue, label, labelPosition = 'top', labelStyle, onChange, onValueChange, size, style, ...rest }) {
9
9
  const theme = useTheme();
10
10
  const themedStyle = getThemedStyles(theme);
11
11
  const [value, setValue] = useState(initialValue);
@@ -27,7 +27,7 @@ export default function RadioGroup({ accessibilityRole = 'radiogroup', children,
27
27
  onChange?.(nextValue);
28
28
  }, [onChange]);
29
29
  return (<View {...rest} style={[themedStyle.container, containerStyle, style]}>
30
- <View accessibilityRole={accessibilityRole} style={childContainerStyle}>
30
+ <View accessible={accessible} accessibilityRole={accessibilityRole} style={childContainerStyle}>
31
31
  {Children.map(children, (child) => {
32
32
  if (isValidElement(child)) {
33
33
  const { disabled: childDisabled, onChange: childOnChange, value: childValue, size: childSize, } = child.props;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { TabsProps } from './types';
3
- export default function Tabs({ children, indicatorPosition, onChange, selectedIndex, style, ...rest }: TabsProps): JSX.Element;
3
+ export default function Tabs({ accessible, accessibilityRole, children, indicatorPosition, onChange, selectedIndex, style, ...rest }: TabsProps): JSX.Element;
@@ -2,13 +2,13 @@ import React, { Children, cloneElement, isValidElement } from 'react';
2
2
  import { View } from 'react-native';
3
3
  import { useTheme } from '../../theme';
4
4
  import { getThemedStyles } from './styles';
5
- export default function Tabs({ children, indicatorPosition = 'bottom', onChange, selectedIndex = 0, style, ...rest }) {
5
+ export default function Tabs({ accessible = true, accessibilityRole = 'tablist', children, indicatorPosition = 'bottom', onChange, selectedIndex = 0, style, ...rest }) {
6
6
  const theme = useTheme();
7
7
  const themedStyle = getThemedStyles(theme, indicatorPosition);
8
8
  const handleOnChange = (nextIndex) => {
9
9
  onChange?.(nextIndex);
10
10
  };
11
- return (<View {...rest} accessibilityRole="tablist" style={[themedStyle.tabList, style]}>
11
+ return (<View {...rest} accessible={accessible} accessibilityRole={accessibilityRole} style={[themedStyle.tabList, style]}>
12
12
  {Children.map(children, (child, index) => {
13
13
  if (isValidElement(child)) {
14
14
  return cloneElement(child, {
@@ -4,12 +4,12 @@ export const getThemedStyles = (theme, indicatorPosition) => {
4
4
  const selectedTabBorderStyles = {};
5
5
  const tabBorderStyles = {};
6
6
  if (indicatorPosition && indicatorPosition === 'top') {
7
- selectedTabBorderStyles.borderTopColor = colors.brand.primary[80];
7
+ selectedTabBorderStyles.borderTopColor = colors.primary[80];
8
8
  tabBorderStyles.borderTopWidth = borderWidths.medium;
9
9
  tabBorderStyles.borderTopColor = colors.border.secondary;
10
10
  }
11
11
  else {
12
- selectedTabBorderStyles.borderBottomColor = colors.brand.primary[80];
12
+ selectedTabBorderStyles.borderBottomColor = colors.primary[80];
13
13
  tabBorderStyles.borderBottomWidth = borderWidths.medium;
14
14
  tabBorderStyles.borderBottomColor = colors.border.secondary;
15
15
  }
@@ -46,7 +46,7 @@ export const getThemedStyles = (theme, indicatorPosition) => {
46
46
  },
47
47
  selected: {
48
48
  backgroundColor: colors.background.primary,
49
- color: colors.brand.primary[80],
49
+ color: colors.primary[80],
50
50
  ...selectedTabBorderStyles,
51
51
  ...components?.tabs?.selected,
52
52
  },
@@ -11,9 +11,8 @@ declare const _default: {
11
11
  };
12
12
  OS: "ios";
13
13
  isPad: boolean;
14
- isTVOS: boolean;
15
- Version: string;
16
14
  isTV: boolean;
15
+ Version: string;
17
16
  isTesting: boolean;
18
17
  select<T>(specifics: ({
19
18
  ios?: T | undefined;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.2.28";
1
+ export declare const VERSION = "2.0.1";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.2.28';
1
+ export const VERSION = '2.0.1';
@@ -4,7 +4,6 @@ const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
5
  const react_native_safe_area_context_1 = require("react-native-safe-area-context");
6
6
  const ui_react_core_1 = require("@aws-amplify/ui-react-core");
7
- const ui_1 = require("@aws-amplify/ui");
8
7
  const hooks_1 = require("../hooks");
9
8
  const common_1 = require("./common");
10
9
  const hooks_2 = require("./hooks");
@@ -16,8 +15,8 @@ const DEFAULTS = {
16
15
  ConfirmSignUp: Defaults_1.ConfirmSignUp,
17
16
  ConfirmVerifyUser: Defaults_1.ConfirmVerifyUser,
18
17
  ForceNewPassword: Defaults_1.ForceNewPassword,
19
- ResetPassword: Defaults_1.ResetPassword,
20
- SetupTOTP: Defaults_1.SetupTOTP,
18
+ ForgotPassword: Defaults_1.ForgotPassword,
19
+ SetupTotp: Defaults_1.SetupTotp,
21
20
  SignIn: Defaults_1.SignIn,
22
21
  SignUp: Defaults_1.SignUp,
23
22
  VerifyUser: Defaults_1.VerifyUser,
@@ -28,22 +27,26 @@ const routePropSelector = ({ route, }) => [
28
27
  function Authenticator({ children, components: overrides, Container = common_1.DefaultContainer, Footer, Header, ...options }) {
29
28
  (0, hooks_1.useDeprecationWarning)({
30
29
  message: 'The `passwordSettings` prop has been deprecated and will be removed in a future major version of Amplify UI.',
31
- shouldWarn: !!options?.passwordSettings,
30
+ // shouldWarn: !!options?.passwordSettings,
31
+ /**
32
+ * @migration turn off until getConfig returns zero config
33
+ */
34
+ shouldWarn: false,
35
+ });
36
+ (0, ui_react_core_1.useSetUserAgent)({
37
+ componentName: 'Authenticator',
38
+ packageName: 'react-native',
39
+ version: version_1.VERSION,
32
40
  });
33
- react_1.default.useEffect(() => {
34
- (0, ui_1.configureComponent)({
35
- packageName: '@aws-amplify/ui-react-native',
36
- version: version_1.VERSION,
37
- });
38
- }, []);
39
41
  (0, ui_react_core_1.useAuthenticatorInitMachine)(options);
40
- const { authStatus, fields, route } = (0, ui_react_core_1.useAuthenticator)(routePropSelector);
42
+ const { fields, route } = (0, ui_react_core_1.useAuthenticator)(routePropSelector);
41
43
  const components = (0, react_1.useMemo)(
42
44
  // allow any to prevent TS from assuming that all fields are of type `TextFieldOptions`
43
45
  () => (0, ui_react_core_1.resolveAuthenticatorComponents)(DEFAULTS, overrides), [overrides]);
44
46
  const { Component, props } = (0, ui_react_core_1.useAuthenticatorRoute)({ components });
45
47
  const typedFields = (0, hooks_2.getRouteTypedFields)({ fields, route });
46
- if (authStatus === 'authenticated') {
48
+ const isAuthenticatedRoute = route === 'authenticated' || route === 'signOut';
49
+ if (isAuthenticatedRoute) {
47
50
  return children ? <>{children}</> : null;
48
51
  }
49
52
  return (<react_native_safe_area_context_1.SafeAreaProvider>
@@ -64,8 +67,8 @@ Authenticator.ConfirmSignIn = Defaults_1.ConfirmSignIn;
64
67
  Authenticator.ConfirmSignUp = Defaults_1.ConfirmSignUp;
65
68
  Authenticator.ConfirmVerifyUser = Defaults_1.ConfirmVerifyUser;
66
69
  Authenticator.ForceNewPassword = Defaults_1.ForceNewPassword;
67
- Authenticator.ResetPassword = Defaults_1.ResetPassword;
68
- Authenticator.SetupTOTP = Defaults_1.SetupTOTP;
70
+ Authenticator.ForgotPassword = Defaults_1.ForgotPassword;
71
+ Authenticator.SetupTotp = Defaults_1.SetupTotp;
69
72
  Authenticator.SignIn = Defaults_1.SignIn;
70
73
  Authenticator.SignUp = Defaults_1.SignUp;
71
74
  Authenticator.VerifyUser = Defaults_1.VerifyUser;
@@ -5,9 +5,9 @@ const react_1 = tslib_1.__importStar(require("react"));
5
5
  const ui_1 = require("@aws-amplify/ui");
6
6
  const common_1 = require("../../common");
7
7
  const hooks_1 = require("../../hooks");
8
- const COMPONENT_NAME = 'ResetPassword';
8
+ const COMPONENT_NAME = 'ForgotPassword';
9
9
  const { getResetYourPasswordText, getSendCodeText, getSendingText, getBackToSignInText, } = ui_1.authenticatorTextUtil;
10
- const ResetPassword = ({ fields, handleBlur, handleChange, handleSubmit, isPending, toSignIn, validationErrors, ...rest }) => {
10
+ const ForgotPassword = ({ fields, handleBlur, handleChange, handleSubmit, isPending, toSignIn, validationErrors, ...rest }) => {
11
11
  const { disableFormSubmit: disabled, fields: fieldsWithHandlers, fieldValidationErrors, handleFormSubmit, } = (0, hooks_1.useFieldValues)({
12
12
  componentName: COMPONENT_NAME,
13
13
  fields,
@@ -35,8 +35,8 @@ const ResetPassword = ({ fields, handleBlur, handleChange, handleSubmit, isPendi
35
35
  ]);
36
36
  return (<common_1.DefaultContent {...rest} buttons={buttons} headerText={headerText} fields={fieldsWithHandlers} isPending={isPending} validationErrors={fieldValidationErrors}/>);
37
37
  };
38
- ResetPassword.Footer = common_1.DefaultFooter;
39
- ResetPassword.FormFields = common_1.DefaultTextFormFields;
40
- ResetPassword.Header = common_1.DefaultHeader;
41
- ResetPassword.displayName = COMPONENT_NAME;
42
- exports.default = ResetPassword;
38
+ ForgotPassword.Footer = common_1.DefaultFooter;
39
+ ForgotPassword.FormFields = common_1.DefaultTextFormFields;
40
+ ForgotPassword.Header = common_1.DefaultHeader;
41
+ ForgotPassword.displayName = COMPONENT_NAME;
42
+ exports.default = ForgotPassword;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ForgotPassword = void 0;
7
+ var ForgotPassword_1 = require("./ForgotPassword");
8
+ Object.defineProperty(exports, "ForgotPassword", { enumerable: true, get: function () { return __importDefault(ForgotPassword_1).default; } });
@@ -7,9 +7,9 @@ const primitives_1 = require("../../../primitives");
7
7
  const common_1 = require("../../common");
8
8
  const hooks_1 = require("../../hooks");
9
9
  const styles_1 = require("./styles");
10
- const COMPONENT_NAME = 'SetupTOTP';
11
- const { getBackToSignInText, getConfirmingText, getConfirmText, getSetupTOTPText, getSetupTOTPInstructionsText, } = ui_1.authenticatorTextUtil;
12
- const SetupTOTP = ({ fields, handleBlur, handleChange, handleSubmit, isPending, toSignIn, totpSecretCode, validationErrors, ...rest }) => {
10
+ const COMPONENT_NAME = 'SetupTotp';
11
+ const { getBackToSignInText, getConfirmingText, getConfirmText, getSetupTotpText, getSetupTotpInstructionsText, } = ui_1.authenticatorTextUtil;
12
+ const SetupTotp = ({ fields, handleBlur, handleChange, handleSubmit, isPending, toSignIn, totpSecretCode, validationErrors, ...rest }) => {
13
13
  const { disableFormSubmit: disabled, fields: fieldsWithHandlers, fieldValidationErrors, handleFormSubmit, } = (0, hooks_1.useFieldValues)({
14
14
  componentName: COMPONENT_NAME,
15
15
  fields,
@@ -18,12 +18,12 @@ const SetupTOTP = ({ fields, handleBlur, handleChange, handleSubmit, isPending,
18
18
  handleSubmit,
19
19
  validationErrors,
20
20
  });
21
- const headerText = getSetupTOTPText();
21
+ const headerText = getSetupTotpText();
22
22
  const primaryButtonText = isPending ? getConfirmingText() : getConfirmText();
23
23
  const secondaryButtonText = getBackToSignInText();
24
24
  const body = (<>
25
25
  <primitives_1.Label style={styles_1.styles.secretKeyText}>
26
- {getSetupTOTPInstructionsText()}
26
+ {getSetupTotpInstructionsText()}
27
27
  </primitives_1.Label>
28
28
  <primitives_1.Label selectable style={styles_1.styles.secretKeyText}>
29
29
  {totpSecretCode}
@@ -45,8 +45,8 @@ const SetupTOTP = ({ fields, handleBlur, handleChange, handleSubmit, isPending,
45
45
  ]);
46
46
  return (<common_1.DefaultContent {...rest} body={body} buttons={buttons} headerText={headerText} fields={fieldsWithHandlers} isPending={isPending} validationErrors={fieldValidationErrors}/>);
47
47
  };
48
- SetupTOTP.Footer = common_1.DefaultFooter;
49
- SetupTOTP.FormFields = common_1.DefaultTextFormFields;
50
- SetupTOTP.Header = common_1.DefaultHeader;
51
- SetupTOTP.displayName = COMPONENT_NAME;
52
- exports.default = SetupTOTP;
48
+ SetupTotp.Footer = common_1.DefaultFooter;
49
+ SetupTotp.FormFields = common_1.DefaultTextFormFields;
50
+ SetupTotp.Header = common_1.DefaultHeader;
51
+ SetupTotp.displayName = COMPONENT_NAME;
52
+ exports.default = SetupTotp;
@@ -3,6 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SetupTOTP = void 0;
7
- var SetupTOTP_1 = require("./SetupTOTP");
8
- Object.defineProperty(exports, "SetupTOTP", { enumerable: true, get: function () { return __importDefault(SetupTOTP_1).default; } });
6
+ exports.SetupTotp = void 0;
7
+ var SetupTotp_1 = require("./SetupTotp");
8
+ Object.defineProperty(exports, "SetupTotp", { enumerable: true, get: function () { return __importDefault(SetupTotp_1).default; } });
@@ -6,7 +6,7 @@ const ui_1 = require("@aws-amplify/ui");
6
6
  const common_1 = require("../../common");
7
7
  const hooks_1 = require("../../hooks");
8
8
  const COMPONENT_NAME = 'SignIn';
9
- const SignIn = ({ fields, handleBlur, handleChange, handleSubmit, hideSignUp, toResetPassword, toSignUp, validationErrors, ...rest }) => {
9
+ const SignIn = ({ fields, handleBlur, handleChange, handleSubmit, hideSignUp, socialProviders, toFederatedSignIn, toForgotPassword, toSignUp, validationErrors, ...rest }) => {
10
10
  const { getSignInTabText, getSignInText, getSignUpTabText, getForgotPasswordText, } = ui_1.authenticatorTextUtil;
11
11
  const { disableFormSubmit: disabled, fields: fieldsWithHandlers, fieldValidationErrors, handleFormSubmit, } = (0, hooks_1.useFieldValues)({
12
12
  componentName: COMPONENT_NAME,
@@ -20,10 +20,11 @@ const SignIn = ({ fields, handleBlur, handleChange, handleSubmit, hideSignUp, to
20
20
  const forgotPasswordText = getForgotPasswordText(true);
21
21
  const signInText = getSignInText();
22
22
  const signUpText = getSignUpTabText();
23
+ const body = socialProviders ? (<common_1.FederatedProviderButtons route="signIn" socialProviders={socialProviders} toFederatedSignIn={toFederatedSignIn}/>) : null;
23
24
  const buttons = (0, react_1.useMemo)(() => {
24
25
  const forgotPassword = {
25
26
  children: forgotPasswordText,
26
- onPress: toResetPassword,
27
+ onPress: toForgotPassword,
27
28
  };
28
29
  return {
29
30
  primary: { children: signInText, disabled, onPress: handleFormSubmit },
@@ -38,10 +39,10 @@ const SignIn = ({ fields, handleBlur, handleChange, handleSubmit, hideSignUp, to
38
39
  hideSignUp,
39
40
  signInText,
40
41
  signUpText,
41
- toResetPassword,
42
+ toForgotPassword,
42
43
  toSignUp,
43
44
  ]);
44
- return (<common_1.DefaultContent {...rest} buttons={buttons} fields={fieldsWithHandlers} headerText={headerText} validationErrors={fieldValidationErrors}/>);
45
+ return (<common_1.DefaultContent {...rest} body={body} buttons={buttons} fields={fieldsWithHandlers} headerText={headerText} validationErrors={fieldValidationErrors}/>);
45
46
  };
46
47
  SignIn.Footer = common_1.DefaultFooter;
47
48
  SignIn.FormFields = common_1.DefaultTextFormFields;