@aws-amplify/ui-react-native 1.2.14 → 1.2.16

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 (42) hide show
  1. package/.eslintrc.js +2 -2
  2. package/CHANGELOG.md +18 -0
  3. package/README.md +2 -2
  4. package/dist/Authenticator/Defaults/types.d.ts +22 -22
  5. package/dist/Authenticator/common/DefaultContainer/types.d.ts +1 -1
  6. package/dist/Authenticator/common/DefaultContent/types.d.ts +5 -5
  7. package/dist/Authenticator/common/DefaultFormFields/types.d.ts +4 -4
  8. package/dist/Authenticator/hooks/types.d.ts +12 -12
  9. package/dist/Authenticator/hooks/useFieldValues/types.d.ts +1 -1
  10. package/dist/Authenticator/hooks/useFieldValues/utils.js +3 -2
  11. package/dist/Authenticator/types.d.ts +2 -2
  12. package/dist/InAppMessaging/components/BannerMessage/BannerMessage.js +1 -1
  13. package/dist/InAppMessaging/components/FullScreenMessage/FullScreenMessage.js +1 -1
  14. package/dist/InAppMessaging/components/InAppMessageDisplay/types.d.ts +4 -4
  15. package/dist/InAppMessaging/components/MessageLayout/MessageLayout.js +2 -2
  16. package/dist/InAppMessaging/components/MessageLayout/types.d.ts +1 -0
  17. package/dist/InAppMessaging/components/ModalMessage/ModalMessage.js +1 -1
  18. package/dist/InAppMessaging/hooks/useMessageImage/types.d.ts +3 -3
  19. package/dist/InAppMessaging/hooks/useMessageProps/types.d.ts +1 -1
  20. package/dist/hooks/useDeviceOrientation/useDeviceOrientation.d.ts +1 -1
  21. package/dist/primitives/Button/types.d.ts +1 -1
  22. package/dist/primitives/Heading/types.d.ts +2 -2
  23. package/dist/primitives/Icon/types.d.ts +2 -2
  24. package/dist/primitives/Label/types.d.ts +2 -2
  25. package/dist/primitives/Radio/types.d.ts +2 -2
  26. package/dist/primitives/RadioGroup/types.d.ts +1 -1
  27. package/dist/primitives/Tabs/types.d.ts +1 -1
  28. package/dist/theme/types.d.ts +7 -7
  29. package/dist/version.d.ts +1 -1
  30. package/dist/version.js +1 -1
  31. package/package.json +4 -4
  32. package/src/Authenticator/hooks/useFieldValues/__tests__/utils.spec.ts +10 -2
  33. package/src/Authenticator/hooks/useFieldValues/utils.ts +3 -2
  34. package/src/InAppMessaging/components/BannerMessage/BannerMessage.tsx +1 -0
  35. package/src/InAppMessaging/components/BannerMessage/__tests__/__snapshots__/BannerMessage.spec.tsx.snap +4 -0
  36. package/src/InAppMessaging/components/FullScreenMessage/FullScreenMessage.tsx +1 -0
  37. package/src/InAppMessaging/components/FullScreenMessage/__tests__/__snapshots__/FullScreenMessage.spec.tsx.snap +2 -0
  38. package/src/InAppMessaging/components/MessageLayout/MessageLayout.tsx +2 -1
  39. package/src/InAppMessaging/components/MessageLayout/types.ts +1 -0
  40. package/src/InAppMessaging/components/ModalMessage/ModalMessage.tsx +1 -0
  41. package/src/InAppMessaging/components/ModalMessage/__tests__/__snapshots__/ModalMessage.spec.tsx.snap +5 -0
  42. package/src/version.ts +1 -1
package/.eslintrc.js CHANGED
@@ -1,9 +1,9 @@
1
1
  module.exports = {
2
2
  ignorePatterns: ['dist', '.eslintrc.js', '*.config.js', 'jest.setup.js'],
3
- extends: ['amplify-ui/react'],
3
+ extends: ['@aws-amplify/amplify-ui/react'],
4
4
  overrides: [
5
5
  {
6
- extends: ['amplify-ui/jest'],
6
+ extends: ['@aws-amplify/amplify-ui/jest'],
7
7
  files: ['**/__mocks__/**', '**/__tests__/**'],
8
8
  },
9
9
  ],
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @aws-amplify/ui-react-native
2
2
 
3
+ ## 1.2.16
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3806](https://github.com/aws-amplify/amplify-ui/pull/3806) [`998a8c74f`](https://github.com/aws-amplify/amplify-ui/commit/998a8c74ff42c250d0d028efb20afa2d54528c86) Thanks [@calebpollman](https://github.com/calebpollman)! - fix(ui): add event callbacks to defaultAuthHubHandler
8
+
9
+ - Updated dependencies [[`998a8c74f`](https://github.com/aws-amplify/amplify-ui/commit/998a8c74ff42c250d0d028efb20afa2d54528c86), [`82f3968b7`](https://github.com/aws-amplify/amplify-ui/commit/82f3968b7f750f069bda4ad7bfa9c34d7ee6091f)]:
10
+ - @aws-amplify/ui-react-core@2.1.21
11
+ - @aws-amplify/ui@5.6.2
12
+
13
+ ## 1.2.15
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [[`4ca838978`](https://github.com/aws-amplify/amplify-ui/commit/4ca838978d23a086f80859a7cb57f184ff49e2d4), [`d6a3676f2`](https://github.com/aws-amplify/amplify-ui/commit/d6a3676f2295ed39fa83b9d31a9540f3437ba129), [`37d63424e`](https://github.com/aws-amplify/amplify-ui/commit/37d63424e23e971713f76d201ce829ec6974fc54)]:
18
+ - @aws-amplify/ui@5.6.1
19
+ - @aws-amplify/ui-react-core@2.1.20
20
+
3
21
  ## 1.2.14
4
22
 
5
23
  ### Patch Changes
package/README.md CHANGED
@@ -7,7 +7,7 @@ Amplify UI is an open-source UI library with cloud-connected components that are
7
7
  3. Data-bound components that make it easy to display dynamic data, like DataStoreCollections.
8
8
  4. Theming capabilities that allow you to customize the appearance of Amplify UI to match your brand.
9
9
 
10
- ## React Native Documentation
10
+ ## React Native Documentation 📖
11
11
 
12
12
  - https://ui.docs.amplify.aws/react-native
13
13
 
@@ -18,6 +18,6 @@ Amplify UI is an open-source UI library with cloud-connected components that are
18
18
  - **Accessible** Amplify UI components follow [WCAG](https://www.w3.org/WAI/standards-guidelines/wcag/) and [WAI-ARIA](https://www.w3.org/TR/wai-aria-1.2/) best practices and guidelines such as color contrast, keyboard navigation, accessible labels, and focus management.
19
19
  - **Primitive components (React only right now)** Primitive components are used in the connected components, like Authenticator, you can also customize them and use them to build the rest of your UI.
20
20
 
21
- ## We love contributors!!
21
+ ## We love contributors!!
22
22
 
23
23
  See our contributing guide [CONTRIBUTING.md](/CONTRIBUTING.md) to help us scale Amplify UI!
@@ -20,69 +20,69 @@ export interface SignUpStyle {
20
20
  }
21
21
  export interface VerifyUserStyle {
22
22
  }
23
- export declare type DefaultComponents<FieldType = {}, Props = {}> = AuthenticatorComponentDefaults<FieldType, Props>;
24
- export declare type DefaultConfirmResetPasswordComponent = DefaultComponents<TextFieldOptionsType, {
23
+ export type DefaultComponents<FieldType = {}, Props = {}> = AuthenticatorComponentDefaults<FieldType, Props>;
24
+ export type DefaultConfirmResetPasswordComponent = DefaultComponents<TextFieldOptionsType, {
25
25
  style?: ConfirmResetPasswordStyle;
26
26
  }>['ConfirmResetPassword'];
27
- export declare type DefaultConfirmSignInComponent = DefaultComponents<TextFieldOptionsType, {
27
+ export type DefaultConfirmSignInComponent = DefaultComponents<TextFieldOptionsType, {
28
28
  style?: ConfirmSignInStyle;
29
29
  }>['ConfirmSignIn'];
30
- export declare type DefaultConfirmSignUpComponent = DefaultComponents<TextFieldOptionsType, {
30
+ export type DefaultConfirmSignUpComponent = DefaultComponents<TextFieldOptionsType, {
31
31
  style?: ConfirmSignUpStyle;
32
32
  }>['ConfirmSignUp'];
33
- export declare type DefaultConfirmVerifyUserComponent = DefaultComponents<TextFieldOptionsType, {
33
+ export type DefaultConfirmVerifyUserComponent = DefaultComponents<TextFieldOptionsType, {
34
34
  style?: ConfirmVerifyUserStyle;
35
35
  }>['ConfirmVerifyUser'];
36
- export declare type DefaultForceNewPasswordComponent = DefaultComponents<TextFieldOptionsType, {
36
+ export type DefaultForceNewPasswordComponent = DefaultComponents<TextFieldOptionsType, {
37
37
  style?: ForceNewPasswordStyle;
38
38
  }>['ForceNewPassword'];
39
- export declare type DefaultResetPasswordComponent = DefaultComponents<TextFieldOptionsType, {
39
+ export type DefaultResetPasswordComponent = DefaultComponents<TextFieldOptionsType, {
40
40
  style?: ResetPasswordStyle;
41
41
  }>['ResetPassword'];
42
- export declare type DefaultSetupTOTPComponent = DefaultComponents<TextFieldOptionsType, {
42
+ export type DefaultSetupTOTPComponent = DefaultComponents<TextFieldOptionsType, {
43
43
  style?: SetupTOTPStyle;
44
44
  }>['SetupTOTP'];
45
- export declare type DefaultSignInComponent = DefaultComponents<TextFieldOptionsType, {
45
+ export type DefaultSignInComponent = DefaultComponents<TextFieldOptionsType, {
46
46
  style?: SignInStyle;
47
47
  }>['SignIn'];
48
- export declare type DefaultSignUpComponent = DefaultComponents<TextFieldOptionsType, {
48
+ export type DefaultSignUpComponent = DefaultComponents<TextFieldOptionsType, {
49
49
  style?: SignUpStyle;
50
50
  }>['SignUp'];
51
- export declare type DefaultVerifyUserComponent = DefaultComponents<RadioFieldOptions, {
51
+ export type DefaultVerifyUserComponent = DefaultComponents<RadioFieldOptions, {
52
52
  style?: VerifyUserStyle;
53
53
  }>['VerifyUser'];
54
54
  /**
55
55
  * Custom Authenticator components
56
56
  */
57
- declare type OverrideComponents<FieldType = {}, Props = {}> = AuthenticatorComponentOverrides<FieldType, Props>;
58
- declare type ConfirmSignInComponent<P = {}> = OverrideComponents<TextFieldOptionsType, {
57
+ type OverrideComponents<FieldType = {}, Props = {}> = AuthenticatorComponentOverrides<FieldType, Props>;
58
+ type ConfirmSignInComponent<P = {}> = OverrideComponents<TextFieldOptionsType, {
59
59
  style?: ConfirmSignInStyle;
60
60
  } & P>['ConfirmSignIn'];
61
- declare type ConfirmSignUpComponent<P = {}> = OverrideComponents<TextFieldOptionsType, {
61
+ type ConfirmSignUpComponent<P = {}> = OverrideComponents<TextFieldOptionsType, {
62
62
  style?: ConfirmSignUpStyle;
63
63
  } & P>['ConfirmSignUp'];
64
- declare type ConfirmResetPasswordComponent<P = {}> = OverrideComponents<TextFieldOptionsType, {
64
+ type ConfirmResetPasswordComponent<P = {}> = OverrideComponents<TextFieldOptionsType, {
65
65
  style?: ConfirmResetPasswordStyle;
66
66
  } & P>['ConfirmResetPassword'];
67
- declare type ConfirmVerifyUserComponent<P = {}> = OverrideComponents<TextFieldOptionsType, {
67
+ type ConfirmVerifyUserComponent<P = {}> = OverrideComponents<TextFieldOptionsType, {
68
68
  style?: ConfirmVerifyUserStyle;
69
69
  } & P>['ConfirmVerifyUser'];
70
- declare type ForceNewPasswordComponent<P = {}> = OverrideComponents<TextFieldOptionsType, {
70
+ type ForceNewPasswordComponent<P = {}> = OverrideComponents<TextFieldOptionsType, {
71
71
  style?: ForceNewPasswordStyle;
72
72
  } & P>['ForceNewPassword'];
73
- declare type ResetPasswordComponent<P = {}> = OverrideComponents<TextFieldOptionsType, {
73
+ type ResetPasswordComponent<P = {}> = OverrideComponents<TextFieldOptionsType, {
74
74
  style?: ResetPasswordStyle;
75
75
  } & P>['ResetPassword'];
76
- declare type SetupTOTPComponent<P = {}> = OverrideComponents<TextFieldOptionsType, {
76
+ type SetupTOTPComponent<P = {}> = OverrideComponents<TextFieldOptionsType, {
77
77
  style?: SetupTOTPStyle;
78
78
  } & P>['SetupTOTP'];
79
- declare type SignInComponent<P = {}> = OverrideComponents<TextFieldOptionsType, {
79
+ type SignInComponent<P = {}> = OverrideComponents<TextFieldOptionsType, {
80
80
  style?: SignInStyle;
81
81
  } & P>['SignIn'];
82
- declare type SignUpComponent<P = {}> = OverrideComponents<TextFieldOptionsType, {
82
+ type SignUpComponent<P = {}> = OverrideComponents<TextFieldOptionsType, {
83
83
  style?: SignUpStyle;
84
84
  } & P>['SignUp'];
85
- declare type VerifyUserComponent<P = {}> = OverrideComponents<RadioFieldOptions, {
85
+ type VerifyUserComponent<P = {}> = OverrideComponents<RadioFieldOptions, {
86
86
  style?: VerifyUserStyle;
87
87
  } & P>['VerifyUser'];
88
88
  /**
@@ -9,7 +9,7 @@ export interface ContainerProps extends ScrollViewProps, Pick<KeyboardAvoidingVi
9
9
  keyboardAvoidingViewStyle?: StyleProp<ViewStyle>;
10
10
  scrollViewContentContainerStyle?: StyleProp<ViewStyle>;
11
11
  }
12
- export declare type DefaultContainerComponent<P = {}> = React.ComponentType<ContainerProps & P>;
12
+ export type DefaultContainerComponent<P = {}> = React.ComponentType<ContainerProps & P>;
13
13
  export interface InnerContainerStyles {
14
14
  container: ViewStyle;
15
15
  }
@@ -24,19 +24,19 @@ export interface DefaultContentStyle {
24
24
  link?: ViewStyle;
25
25
  linksContainer?: ViewStyle;
26
26
  }
27
- export declare type DefaultContentStyleProps = {
27
+ export type DefaultContentStyleProps = {
28
28
  [Key in keyof DefaultContentStyle]: StyleProp<DefaultContentStyle[Key]>;
29
29
  } & DefaultFormFieldsStyle;
30
- declare type DefaultComponentProps<FieldsType> = AuthenticatorComponentDefaultProps<FieldsType>[AuthenticatorRouteComponentName];
31
- declare type AuthenticatorButtonProps = Omit<ButtonProps, 'children'> & {
30
+ type DefaultComponentProps<FieldsType> = AuthenticatorComponentDefaultProps<FieldsType>[AuthenticatorRouteComponentName];
31
+ type AuthenticatorButtonProps = Omit<ButtonProps, 'children'> & {
32
32
  children: string;
33
33
  };
34
- declare type DefaultButtons = {
34
+ type DefaultButtons = {
35
35
  primary: AuthenticatorButtonProps;
36
36
  secondary?: AuthenticatorButtonProps;
37
37
  links?: AuthenticatorButtonProps[];
38
38
  };
39
- export declare type DefaultContentProps<FieldsType extends TextFieldOptionsType | RadioFieldOptions | unknown = unknown> = Pick<DefaultComponentProps<FieldsType>, 'error' | 'Footer' | 'isPending'> & {
39
+ export type DefaultContentProps<FieldsType extends TextFieldOptionsType | RadioFieldOptions | unknown = unknown> = Pick<DefaultComponentProps<FieldsType>, 'error' | 'Footer' | 'isPending'> & {
40
40
  buttons: DefaultButtons;
41
41
  body?: React.ReactNode;
42
42
  fields: FieldsType[];
@@ -1,7 +1,7 @@
1
1
  import { StyleProp, TextStyle, ViewStyle } from 'react-native';
2
2
  import { AuthenticatorFormFieldsComponent } from '@aws-amplify/ui-react-core';
3
3
  import { RadioFieldOptions, TextFieldOptionsType } from '../../hooks';
4
- export declare type FieldProps = Omit<TextFieldOptionsType, 'name'> & {
4
+ export type FieldProps = Omit<TextFieldOptionsType, 'name'> & {
5
5
  disabled: boolean;
6
6
  };
7
7
  export interface FieldErrorsProps {
@@ -17,6 +17,6 @@ export interface DefaultFormFieldsStyle {
17
17
  fieldStyle?: StyleProp<TextStyle>;
18
18
  style?: StyleProp<ViewStyle>;
19
19
  }
20
- export declare type DefaultFormFieldsComponent<FieldsType> = AuthenticatorFormFieldsComponent<FieldsType, DefaultFormFieldsStyle>;
21
- export declare type DefaultTextFormFieldsComponent = DefaultFormFieldsComponent<TextFieldOptionsType>;
22
- export declare type DefaultRadioFormFieldsComponent = DefaultFormFieldsComponent<RadioFieldOptions>;
20
+ export type DefaultFormFieldsComponent<FieldsType> = AuthenticatorFormFieldsComponent<FieldsType, DefaultFormFieldsStyle>;
21
+ export type DefaultTextFormFieldsComponent = DefaultFormFieldsComponent<TextFieldOptionsType>;
22
+ export type DefaultRadioFormFieldsComponent = DefaultFormFieldsComponent<RadioFieldOptions>;
@@ -1,24 +1,24 @@
1
1
  import { TextFieldProps, PasswordFieldProps, PhoneNumberFieldProps, RadioProps } from '../../primitives';
2
- export declare type MachineFieldTypeKey = 'password' | 'tel';
3
- export declare type AuthenticatorFieldTypeKey = 'password' | 'phone' | 'default' | 'radio';
4
- declare type RadioFieldOnBlur = RadioProps<string>['onBlur'];
5
- export declare type TextFieldOnBlur = TextFieldProps['onBlur'];
6
- export declare type OnChangeText = TextFieldProps['onChangeText'];
7
- declare type FieldOptions<FieldProps, Type extends AuthenticatorFieldTypeKey> = {
2
+ export type MachineFieldTypeKey = 'password' | 'tel';
3
+ export type AuthenticatorFieldTypeKey = 'password' | 'phone' | 'default' | 'radio';
4
+ type RadioFieldOnBlur = RadioProps<string>['onBlur'];
5
+ export type TextFieldOnBlur = TextFieldProps['onBlur'];
6
+ export type OnChangeText = TextFieldProps['onChangeText'];
7
+ type FieldOptions<FieldProps, Type extends AuthenticatorFieldTypeKey> = {
8
8
  name: string;
9
9
  onBlur?: Type extends 'radio' ? RadioFieldOnBlur : TextFieldOnBlur;
10
10
  required?: boolean;
11
11
  type: Type;
12
12
  } & Omit<FieldProps, 'disabled' | 'onBlur'>;
13
- declare type PasswordFieldOptions = FieldOptions<PasswordFieldProps, 'password'>;
14
- declare type PhoneFieldOptions = FieldOptions<PhoneNumberFieldProps, 'phone'>;
15
- declare type DefaultFieldOptions = FieldOptions<TextFieldProps, 'default'>;
16
- export declare type TextFieldOptionsType = (PasswordFieldOptions | PhoneFieldOptions | DefaultFieldOptions) & {
13
+ type PasswordFieldOptions = FieldOptions<PasswordFieldProps, 'password'>;
14
+ type PhoneFieldOptions = FieldOptions<PhoneNumberFieldProps, 'phone'>;
15
+ type DefaultFieldOptions = FieldOptions<TextFieldProps, 'default'>;
16
+ export type TextFieldOptionsType = (PasswordFieldOptions | PhoneFieldOptions | DefaultFieldOptions) & {
17
17
  labelHidden?: boolean;
18
18
  };
19
- export declare type RadioFieldOptions = FieldOptions<RadioProps<string>, 'radio'>;
19
+ export type RadioFieldOptions = FieldOptions<RadioProps<string>, 'radio'>;
20
20
  /**
21
21
  * `field` options union
22
22
  */
23
- export declare type TypedField = RadioFieldOptions | TextFieldOptionsType;
23
+ export type TypedField = RadioFieldOptions | TextFieldOptionsType;
24
24
  export {};
@@ -1,6 +1,6 @@
1
1
  import { AuthenticatorComponentDefaultProps, AuthenticatorRouteComponentName } from '@aws-amplify/ui-react-core';
2
2
  import { TypedField } from '../types';
3
- export declare type MachineEventHandlers = Pick<AuthenticatorComponentDefaultProps[AuthenticatorRouteComponentName], 'handleBlur' | 'handleChange' | 'handleSubmit'>;
3
+ export type MachineEventHandlers = Pick<AuthenticatorComponentDefaultProps[AuthenticatorRouteComponentName], 'handleBlur' | 'handleChange' | 'handleSubmit'>;
4
4
  export interface UseFieldValuesParams<FieldType extends TypedField> {
5
5
  componentName: AuthenticatorRouteComponentName;
6
6
  fields: FieldType[];
@@ -66,6 +66,7 @@ const getFieldType = (type) => {
66
66
  */
67
67
  export const getTypedField = ({ type: machineFieldType, name, ...field }) => {
68
68
  const type = getFieldType(machineFieldType);
69
+ const testID = `authenticator__text-field__input-${name}`;
69
70
  return Object.entries(field).reduce((acc, [key, value]) => {
70
71
  // early return if key is not allowed
71
72
  if (!isKeyAllowed(key)) {
@@ -74,9 +75,9 @@ export const getTypedField = ({ type: machineFieldType, name, ...field }) => {
74
75
  // map to `required` prop
75
76
  if (key === 'isRequired' || key === 'required') {
76
77
  // `TypedField` props expects `required` key
77
- return { ...acc, required: value };
78
+ return { ...acc, required: value, testID };
78
79
  }
79
- return { ...acc, [key]: value };
80
+ return { ...acc, [key]: value, testID };
80
81
  },
81
82
  // initialize `acc` with field `name` and `type`
82
83
  { name, type });
@@ -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
- declare type SupportedAuthenticatorMachineOptions = Omit<AuthenticatorMachineOptions, 'socialProviders' | 'formFields'>;
5
+ type SupportedAuthenticatorMachineOptions = Omit<AuthenticatorMachineOptions, 'socialProviders' | 'formFields'>;
6
6
  export interface AuthenticatorProps extends SupportedAuthenticatorMachineOptions {
7
7
  children?: React.ReactNode;
8
8
  Container?: DefaultContainerComponent;
@@ -10,5 +10,5 @@ export interface AuthenticatorProps extends SupportedAuthenticatorMachineOptions
10
10
  Header?: React.ComponentType;
11
11
  components?: Components;
12
12
  }
13
- export declare type WithAuthenticatorOptions = Omit<AuthenticatorProps, 'children'>;
13
+ export type WithAuthenticatorOptions = Omit<AuthenticatorProps, 'children'>;
14
14
  export {};
@@ -11,6 +11,6 @@ export default function BannerMessage({ position = 'top', ...props }) {
11
11
  }
12
12
  const { wrapper, ...messageStyles } = styles;
13
13
  return (<MessageWrapper style={wrapper}>
14
- <MessageLayout {...props} {...messageProps} orientation="landscape" styles={messageStyles}/>
14
+ <MessageLayout {...props} {...messageProps} orientation="landscape" styles={messageStyles} testID={`inappmessaging-${position}banner-dialog`}/>
15
15
  </MessageWrapper>);
16
16
  }
@@ -13,6 +13,6 @@ export default function FullScreenMessage(props) {
13
13
  }
14
14
  const { wrapper, ...messageStyles } = styles;
15
15
  return (<MessageWrapper style={wrapper}>
16
- <MessageLayout {...props} {...messageProps} orientation={deviceOrientation} styles={messageStyles}/>
16
+ <MessageLayout {...props} {...messageProps} orientation={deviceOrientation} styles={messageStyles} testID={`inappmessaging-fullscreen-dialog`}/>
17
17
  </MessageWrapper>);
18
18
  }
@@ -3,10 +3,10 @@ import { BannerMessageProps } from '../BannerMessage';
3
3
  import { CarouselMessageProps } from '../CarouselMessage';
4
4
  import { FullScreenMessageProps } from '../FullScreenMessage';
5
5
  import { ModalMessageProps } from '../ModalMessage';
6
- declare type BannerStyle = BannerMessageProps['style'];
7
- declare type CarouselStyle = CarouselMessageProps['style'];
8
- declare type FullScreenStyle = FullScreenMessageProps['style'];
9
- declare type ModalStyle = ModalMessageProps['style'];
6
+ type BannerStyle = BannerMessageProps['style'];
7
+ type CarouselStyle = CarouselMessageProps['style'];
8
+ type FullScreenStyle = FullScreenMessageProps['style'];
9
+ type ModalStyle = ModalMessageProps['style'];
10
10
  export interface MessageDefaultComponents {
11
11
  BannerMessage: BannerMessageComponent<BannerStyle>;
12
12
  CarouselMessage: CarouselMessageComponent<CarouselStyle>;
@@ -4,9 +4,9 @@ import { icons } from '../../../assets';
4
4
  import { Button, IconButton } from '../../../primitives';
5
5
  import { ICON_BUTTON_HIT_SLOP, ICON_BUTTON_SIZE, IN_APP_MESSAGING_TEST_ID, } from '../../constants';
6
6
  export default function MessageLayout({ orientation, ...props }) {
7
- const { body, hasButtons, hasPrimaryButton, hasRenderableImage, hasSecondaryButton, header, image, onClose, primaryButton, secondaryButton, styles, } = props;
7
+ const { body, hasButtons, hasPrimaryButton, hasRenderableImage, hasSecondaryButton, header, image, onClose, primaryButton, secondaryButton, styles, testID, } = props;
8
8
  const iconButton = (<IconButton color={styles.iconButton.iconColor} hitSlop={ICON_BUTTON_HIT_SLOP} onPress={onClose} size={ICON_BUTTON_SIZE} source={icons.close} style={styles.iconButton.container} testID={IN_APP_MESSAGING_TEST_ID.CLOSE_BUTTON}/>);
9
- return (<View style={styles.container}>
9
+ return (<View style={styles.container} testID={testID}>
10
10
  <View style={styles.contentContainer}>
11
11
  {orientation === 'portrait' && iconButton}
12
12
  {hasRenderableImage && (<View style={styles.imageContainer}>
@@ -4,4 +4,5 @@ import { MessageComponentStyles, MessageOverrideStyle, UseMessageProps } from '.
4
4
  export interface LayoutProps extends Omit<MessageComponentBaseProps<MessageOverrideStyle>, 'style'>, Omit<UseMessageProps, 'shouldRenderMessage' | 'styles'> {
5
5
  orientation: DeviceOrientation;
6
6
  styles: Omit<MessageComponentStyles, 'wrapper'>;
7
+ testID?: string;
7
8
  }
@@ -13,6 +13,6 @@ export default function ModalMessage(props) {
13
13
  }
14
14
  const { wrapper, ...messageStyles } = styles;
15
15
  return (<MessageWrapper style={wrapper}>
16
- <MessageLayout {...props} {...messageProps} orientation={deviceOrientation} styles={messageStyles}/>
16
+ <MessageLayout {...props} {...messageProps} orientation={deviceOrientation} styles={messageStyles} testID={`inappmessaging-modal-dialog`}/>
17
17
  </MessageWrapper>);
18
18
  }
@@ -1,14 +1,14 @@
1
- export declare type ImageDimensions = {
1
+ export type ImageDimensions = {
2
2
  height: number | undefined;
3
3
  width: number | undefined;
4
4
  };
5
- export declare type ImageLoadingState = 'loaded' | 'failed';
5
+ export type ImageLoadingState = 'loaded' | 'failed';
6
6
  export declare enum ImagePrefetchStatus {
7
7
  Failure = "FAILURE",
8
8
  Fetching = "FETCHING",
9
9
  Success = "SUCCESS"
10
10
  }
11
- export declare type UseMessageImage = {
11
+ export type UseMessageImage = {
12
12
  hasRenderableImage: boolean;
13
13
  imageDimensions: ImageDimensions;
14
14
  isImageFetching: boolean;
@@ -22,7 +22,7 @@ export interface MessageComponentStyles {
22
22
  textContainer: StyleProp<ViewStyle>;
23
23
  wrapper: StyleProp<ViewStyle>;
24
24
  }
25
- export declare type GetDefaultStyle<AdditionalStyle = unknown> = (imageDimensions: ImageDimensions, additionalStyle?: AdditionalStyle) => MessageDefaultStyle;
25
+ export type GetDefaultStyle<AdditionalStyle = unknown> = (imageDimensions: ImageDimensions, additionalStyle?: AdditionalStyle) => MessageDefaultStyle;
26
26
  export interface UseMessageProps {
27
27
  hasButtons: boolean;
28
28
  hasPrimaryButton: boolean;
@@ -1,4 +1,4 @@
1
- export declare type DeviceOrientation = 'portrait' | 'landscape';
1
+ export type DeviceOrientation = 'portrait' | 'landscape';
2
2
  export default function useDeviceOrientation(): {
3
3
  deviceOrientation: DeviceOrientation;
4
4
  isLandscapeMode: boolean;
@@ -1,5 +1,5 @@
1
1
  import { PressableProps, StyleProp, TextStyle, ViewStyle } from 'react-native';
2
- export declare type ButtonVariant = 'primary' | 'default' | 'link';
2
+ export type ButtonVariant = 'primary' | 'default' | 'link';
3
3
  export interface ButtonProps extends PressableProps {
4
4
  textStyle?: StyleProp<TextStyle>;
5
5
  variant?: ButtonVariant;
@@ -1,9 +1,9 @@
1
1
  import { TextProps, TextStyle } from 'react-native';
2
- declare type Level = 1 | 2 | 3 | 4 | 5 | 6;
2
+ type Level = 1 | 2 | 3 | 4 | 5 | 6;
3
3
  export interface HeadingProps extends TextProps {
4
4
  level?: Level;
5
5
  }
6
- export declare type HeadingStyles = {
6
+ export type HeadingStyles = {
7
7
  text?: TextStyle;
8
8
  } & {
9
9
  [key in Level]: TextStyle;
@@ -1,6 +1,6 @@
1
1
  import { ColorValue, ImageProps, ImageStyle } from 'react-native';
2
- export declare type Size = 'xs' | 'small' | 'medium' | 'large' | 'xl';
3
- export declare type IconSizes = Record<Size, number>;
2
+ export type Size = 'xs' | 'small' | 'medium' | 'large' | 'xl';
3
+ export type IconSizes = Record<Size, number>;
4
4
  export interface IconStyles {
5
5
  icon?: ImageStyle;
6
6
  }
@@ -6,8 +6,8 @@ export interface LabelProps extends TextProps {
6
6
  */
7
7
  variant?: LabelVariant;
8
8
  }
9
- export declare type LabelPosition = 'start' | 'end' | 'top' | 'bottom';
10
- export declare type LabelVariant = 'primary' | 'secondary' | 'tertiary' | 'error' | 'warning' | 'info' | 'success';
9
+ export type LabelPosition = 'start' | 'end' | 'top' | 'bottom';
10
+ export type LabelVariant = 'primary' | 'secondary' | 'tertiary' | 'error' | 'warning' | 'info' | 'success';
11
11
  export interface LabelStyles {
12
12
  text?: TextStyle;
13
13
  primary?: TextStyle;
@@ -1,6 +1,6 @@
1
1
  import { PressableProps, StyleProp, TextStyle, ViewStyle } from 'react-native';
2
2
  import { LabelPosition } from '../Label/types';
3
- export declare type Size = number | 'small' | 'medium' | 'large';
3
+ export type Size = number | 'small' | 'medium' | 'large';
4
4
  export interface RadioProps<T> extends PressableProps {
5
5
  disabled?: boolean;
6
6
  label?: string;
@@ -13,7 +13,7 @@ export interface RadioProps<T> extends PressableProps {
13
13
  selected?: boolean;
14
14
  value: T;
15
15
  }
16
- export declare type RadioDimensions = Pick<ViewStyle, 'height' | 'width'>;
16
+ export type RadioDimensions = Pick<ViewStyle, 'height' | 'width'>;
17
17
  export interface RadioStyles {
18
18
  container?: ViewStyle;
19
19
  disabled?: ViewStyle;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { TextStyle, ViewProps, ViewStyle } from 'react-native';
3
3
  import { RadioProps } from '../Radio';
4
- export declare type Direction = 'vertical' | 'horizontal';
4
+ export type Direction = 'vertical' | 'horizontal';
5
5
  export interface RadioGroupProps<T> extends Pick<RadioProps<T>, 'accessibilityRole' | 'disabled' | 'label' | 'labelPosition' | 'labelStyle' | 'onChange' | 'size'>, ViewProps {
6
6
  children: React.ReactElement<RadioProps<T>>[];
7
7
  direction?: Direction;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { TextStyle, ViewProps, ViewStyle } from 'react-native';
3
3
  import { ButtonProps } from '../Button';
4
- declare type IndicatorPosition = 'top' | 'bottom';
4
+ type IndicatorPosition = 'top' | 'bottom';
5
5
  export interface TabsProps extends ViewProps {
6
6
  /**
7
7
  * @description
@@ -1,7 +1,7 @@
1
1
  import { ReactNativeTokens } from '@aws-amplify/ui';
2
2
  import { ButtonStyles, CheckboxStyles, DividerStyles, ErrorMessageStyles, HeadingStyles, IconStyles, IconButtonStyles, LabelStyles, PasswordFieldStyles, PhoneNumberFieldStyles, RadioStyles, RadioGroupStyles, TabsStyles, TextFieldStyles } from '../primitives';
3
- declare type ComponentTheme<ComponentType, Output> = Output extends 'output' ? ComponentType : ((tokens: StrictTheme['tokens']) => ComponentType) | ComponentType;
4
- export declare type Components<Output> = Record<string, object> & {
3
+ type ComponentTheme<ComponentType, Output> = Output extends 'output' ? ComponentType : ((tokens: StrictTheme['tokens']) => ComponentType) | ComponentType;
4
+ export type Components<Output> = Record<string, object> & {
5
5
  button?: ComponentTheme<ButtonStyles, Output>;
6
6
  checkbox?: ComponentTheme<CheckboxStyles, Output>;
7
7
  divider?: ComponentTheme<DividerStyles, Output>;
@@ -17,13 +17,13 @@ export declare type Components<Output> = Record<string, object> & {
17
17
  tabs?: ComponentTheme<TabsStyles, Output>;
18
18
  textField?: ComponentTheme<TextFieldStyles, Output>;
19
19
  };
20
- export declare type ColorMode = 'light' | 'dark' | 'system' | null;
21
- export declare type Override = Omit<Theme, 'overrides'> & {
20
+ export type ColorMode = 'light' | 'dark' | 'system' | null;
21
+ export type Override = Omit<Theme, 'overrides'> & {
22
22
  colorMode?: ColorMode;
23
23
  };
24
- export declare type StrictTokens = ReactNativeTokens<'required'>;
25
- export declare type Tokens = ReactNativeTokens<'optional'>;
26
- declare type OmittedComponents = 'checkbox' | 'divider' | 'tabs';
24
+ export type StrictTokens = ReactNativeTokens<'required'>;
25
+ export type Tokens = ReactNativeTokens<'optional'>;
26
+ type OmittedComponents = 'checkbox' | 'divider' | 'tabs';
27
27
  /**
28
28
  * A custom Theme with all properties optional.
29
29
  */
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.2.14";
1
+ export declare const VERSION = "1.2.16";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.2.14';
1
+ export const VERSION = '1.2.16';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui-react-native",
3
- "version": "1.2.14",
3
+ "version": "1.2.16",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,6 +18,7 @@
18
18
  "typecheck": "tsc --noEmit"
19
19
  },
20
20
  "devDependencies": {
21
+ "@aws-amplify/eslint-config-amplify-ui": "0.0.0",
21
22
  "@babel/cli": "^7.17.10",
22
23
  "@babel/core": "^7.17.10",
23
24
  "@babel/preset-env": "^7.17.10",
@@ -28,7 +29,6 @@
28
29
  "@types/react-test-renderer": "^17.0.1",
29
30
  "babel-jest": "^28.0.3",
30
31
  "eslint": "^8.14.0",
31
- "eslint-config-amplify-ui": "0.0.0",
32
32
  "metro-react-native-babel-preset": "^0.70.2",
33
33
  "react": "^17.0.2",
34
34
  "react-native": "^0.68.1",
@@ -37,8 +37,8 @@
37
37
  "rimraf": "^3.0.2"
38
38
  },
39
39
  "dependencies": {
40
- "@aws-amplify/ui": "5.6.0",
41
- "@aws-amplify/ui-react-core": "2.1.19"
40
+ "@aws-amplify/ui": "5.6.2",
41
+ "@aws-amplify/ui-react-core": "2.1.21"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "aws-amplify": ">= 5.0.1",
@@ -23,7 +23,11 @@ const phoneField = {
23
23
  name: 'phonenumber',
24
24
  type: 'tel',
25
25
  };
26
- const textField = { order: 3, name: 'username', isRequired: true };
26
+ const textField = {
27
+ order: 3,
28
+ name: 'username',
29
+ isRequired: true,
30
+ };
27
31
 
28
32
  const radioField = { type: 'radio', name: 'email', value: 'hello@world.com' };
29
33
 
@@ -191,7 +195,10 @@ describe('getRouteTypedFields', () => {
191
195
  });
192
196
 
193
197
  const expected = [
194
- passwordField,
198
+ {
199
+ ...passwordField,
200
+ testID: `authenticator__text-field__input-${passwordField.name}`,
201
+ },
195
202
  {
196
203
  name: phoneField.name,
197
204
  type: 'phone',
@@ -200,6 +207,7 @@ describe('getRouteTypedFields', () => {
200
207
  name: textField.name,
201
208
  required: textField.isRequired,
202
209
  type: 'default',
210
+ testID: `authenticator__text-field__input-${textField.name}`,
203
211
  },
204
212
  ];
205
213
 
@@ -130,6 +130,7 @@ export const getTypedField = ({
130
130
  ...field
131
131
  }: AuthenticatorLegacyField): TypedField => {
132
132
  const type = getFieldType(machineFieldType);
133
+ const testID = `authenticator__text-field__input-${name}`;
133
134
 
134
135
  return Object.entries(field).reduce(
135
136
  (acc, [key, value]) => {
@@ -141,10 +142,10 @@ export const getTypedField = ({
141
142
  // map to `required` prop
142
143
  if (key === 'isRequired' || key === 'required') {
143
144
  // `TypedField` props expects `required` key
144
- return { ...acc, required: value as boolean };
145
+ return { ...acc, required: value as boolean, testID };
145
146
  }
146
147
 
147
- return { ...acc, [key]: value };
148
+ return { ...acc, [key]: value, testID };
148
149
  },
149
150
  // initialize `acc` with field `name` and `type`
150
151
  { name, type } as TypedField
@@ -31,6 +31,7 @@ export default function BannerMessage({
31
31
  {...messageProps}
32
32
  orientation="landscape"
33
33
  styles={messageStyles}
34
+ testID={`inappmessaging-${position}banner-dialog`}
34
35
  />
35
36
  </MessageWrapper>
36
37
  );
@@ -29,6 +29,7 @@ exports[`BannerMessage correctly handles a primaryButton button prop 1`] = `
29
29
  Object {},
30
30
  ]
31
31
  }
32
+ testID="inappmessaging-topbanner-dialog"
32
33
  >
33
34
  <View
34
35
  style={
@@ -215,6 +216,7 @@ exports[`BannerMessage correctly handles a secondaryButton button prop 1`] = `
215
216
  Object {},
216
217
  ]
217
218
  }
219
+ testID="inappmessaging-topbanner-dialog"
218
220
  >
219
221
  <View
220
222
  style={
@@ -401,6 +403,7 @@ exports[`BannerMessage renders a message as expected with an image 1`] = `
401
403
  Object {},
402
404
  ]
403
405
  }
406
+ testID="inappmessaging-topbanner-dialog"
404
407
  >
405
408
  <View
406
409
  style={
@@ -534,6 +537,7 @@ exports[`BannerMessage renders a message as expected without an image 1`] = `
534
537
  Object {},
535
538
  ]
536
539
  }
540
+ testID="inappmessaging-topbanner-dialog"
537
541
  >
538
542
  <View
539
543
  style={
@@ -32,6 +32,7 @@ export default function FullScreenMessage(
32
32
  {...messageProps}
33
33
  orientation={deviceOrientation}
34
34
  styles={messageStyles}
35
+ testID={`inappmessaging-fullscreen-dialog`}
35
36
  />
36
37
  </MessageWrapper>
37
38
  );
@@ -115,6 +115,7 @@ exports[`FullScreenMessage renders as expected in landscape mode 1`] = `
115
115
  },
116
116
  }
117
117
  }
118
+ testID="inappmessaging-fullscreen-dialog"
118
119
  />
119
120
  </MessageWrapper>
120
121
  `;
@@ -231,6 +232,7 @@ exports[`FullScreenMessage renders as expected in portrait mode 1`] = `
231
232
  },
232
233
  }
233
234
  }
235
+ testID="inappmessaging-fullscreen-dialog"
234
236
  />
235
237
  </MessageWrapper>
236
238
  `;
@@ -29,6 +29,7 @@ export default function MessageLayout({
29
29
  primaryButton,
30
30
  secondaryButton,
31
31
  styles,
32
+ testID,
32
33
  } = props;
33
34
 
34
35
  const iconButton = (
@@ -44,7 +45,7 @@ export default function MessageLayout({
44
45
  );
45
46
 
46
47
  return (
47
- <View style={styles.container}>
48
+ <View style={styles.container} testID={testID}>
48
49
  <View style={styles.contentContainer}>
49
50
  {orientation === 'portrait' && iconButton}
50
51
  {hasRenderableImage && (
@@ -12,4 +12,5 @@ export interface LayoutProps
12
12
  Omit<UseMessageProps, 'shouldRenderMessage' | 'styles'> {
13
13
  orientation: DeviceOrientation;
14
14
  styles: Omit<MessageComponentStyles, 'wrapper'>;
15
+ testID?: string;
15
16
  }
@@ -31,6 +31,7 @@ export default function ModalMessage(
31
31
  {...messageProps}
32
32
  orientation={deviceOrientation}
33
33
  styles={messageStyles}
34
+ testID={`inappmessaging-modal-dialog`}
34
35
  />
35
36
  </MessageWrapper>
36
37
  );
@@ -29,6 +29,7 @@ exports[`ModalMessage correctly handles a primaryButton prop 1`] = `
29
29
  Object {},
30
30
  ]
31
31
  }
32
+ testID="inappmessaging-modal-dialog"
32
33
  >
33
34
  <View
34
35
  style={
@@ -215,6 +216,7 @@ exports[`ModalMessage correctly handles a secondaryButton prop 1`] = `
215
216
  Object {},
216
217
  ]
217
218
  }
219
+ testID="inappmessaging-modal-dialog"
218
220
  >
219
221
  <View
220
222
  style={
@@ -401,6 +403,7 @@ exports[`ModalMessage renders a message as expected with an image 1`] = `
401
403
  Object {},
402
404
  ]
403
405
  }
406
+ testID="inappmessaging-modal-dialog"
404
407
  >
405
408
  <View
406
409
  style={
@@ -534,6 +537,7 @@ exports[`ModalMessage renders as expected in landscape mode 1`] = `
534
537
  Object {},
535
538
  ]
536
539
  }
540
+ testID="inappmessaging-modal-dialog"
537
541
  >
538
542
  <View
539
543
  style={
@@ -644,6 +648,7 @@ exports[`ModalMessage renders as expected in portrait mode 1`] = `
644
648
  Object {},
645
649
  ]
646
650
  }
651
+ testID="inappmessaging-modal-dialog"
647
652
  >
648
653
  <View
649
654
  style={
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.2.14';
1
+ export const VERSION = '1.2.16';