@aws-amplify/ui-react-native 1.2.22 → 1.2.23
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/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/lib/Authenticator/Authenticator.js +72 -0
- package/lib/Authenticator/Defaults/ConfirmResetPassword/ConfirmResetPassword.js +43 -0
- package/lib/Authenticator/Defaults/ConfirmResetPassword/index.js +8 -0
- package/lib/Authenticator/Defaults/ConfirmSignIn/ConfirmSignIn.js +42 -0
- package/lib/Authenticator/Defaults/ConfirmSignIn/index.js +8 -0
- package/lib/Authenticator/Defaults/ConfirmSignUp/ConfirmSignUp.js +43 -0
- package/lib/Authenticator/Defaults/ConfirmSignUp/index.js +8 -0
- package/lib/Authenticator/Defaults/ConfirmVerifyUser/ConfirmVerifyUser.js +42 -0
- package/lib/Authenticator/Defaults/ConfirmVerifyUser/index.js +8 -0
- package/lib/Authenticator/Defaults/ForceNewPassword/ForceNewPassword.js +45 -0
- package/lib/Authenticator/Defaults/ForceNewPassword/index.js +8 -0
- package/lib/Authenticator/Defaults/ResetPassword/ResetPassword.js +42 -0
- package/lib/Authenticator/Defaults/ResetPassword/index.js +8 -0
- package/lib/Authenticator/Defaults/SetupTOTP/SetupTOTP.js +52 -0
- package/lib/Authenticator/Defaults/SetupTOTP/index.js +8 -0
- package/lib/Authenticator/Defaults/SetupTOTP/styles.js +8 -0
- package/lib/Authenticator/Defaults/SignIn/SignIn.js +50 -0
- package/lib/Authenticator/Defaults/SignIn/index.js +8 -0
- package/lib/Authenticator/Defaults/SignUp/SignUp.js +48 -0
- package/lib/Authenticator/Defaults/SignUp/index.js +8 -0
- package/lib/Authenticator/Defaults/VerifyUser/VerifyUser.js +33 -0
- package/lib/Authenticator/Defaults/VerifyUser/index.js +8 -0
- package/lib/Authenticator/Defaults/index.js +23 -0
- package/lib/Authenticator/Defaults/types.js +2 -0
- package/lib/Authenticator/common/DefaultContainer/DefaultContainer.js +37 -0
- package/lib/Authenticator/common/DefaultContainer/InnerContainer.js +15 -0
- package/lib/Authenticator/common/DefaultContainer/index.js +10 -0
- package/lib/Authenticator/common/DefaultContainer/styles.js +31 -0
- package/lib/Authenticator/common/DefaultContainer/types.js +2 -0
- package/lib/Authenticator/common/DefaultContent/DefaultContent.js +33 -0
- package/lib/Authenticator/common/DefaultContent/index.js +8 -0
- package/lib/Authenticator/common/DefaultContent/styles.js +54 -0
- package/lib/Authenticator/common/DefaultContent/types.js +2 -0
- package/lib/Authenticator/common/DefaultFooter/DefaultFooter.js +9 -0
- package/lib/Authenticator/common/DefaultFooter/index.js +8 -0
- package/lib/Authenticator/common/DefaultFooter/types.js +2 -0
- package/lib/Authenticator/common/DefaultFormFields/DefaultRadioFormFields.js +28 -0
- package/lib/Authenticator/common/DefaultFormFields/DefaultTextFormFields.js +21 -0
- package/lib/Authenticator/common/DefaultFormFields/Field.js +37 -0
- package/lib/Authenticator/common/DefaultFormFields/FieldErrors.js +17 -0
- package/lib/Authenticator/common/DefaultFormFields/index.js +10 -0
- package/lib/Authenticator/common/DefaultFormFields/types.js +2 -0
- package/lib/Authenticator/common/DefaultHeader/DefaultHeader.js +11 -0
- package/lib/Authenticator/common/DefaultHeader/index.js +8 -0
- package/lib/Authenticator/common/DefaultHeader/types.js +2 -0
- package/lib/Authenticator/common/FederatedProviderButton/FederatedProviderButton.js +18 -0
- package/lib/Authenticator/common/FederatedProviderButton/index.js +8 -0
- package/lib/Authenticator/common/FederatedProviderButton/styles.js +21 -0
- package/lib/Authenticator/common/FederatedProviderButton/types.js +2 -0
- package/lib/Authenticator/common/FederatedProviderButtons/FederatedProviderButtons.js +26 -0
- package/lib/Authenticator/common/FederatedProviderButtons/index.js +8 -0
- package/lib/Authenticator/common/FederatedProviderButtons/styles.js +8 -0
- package/lib/Authenticator/common/FederatedProviderButtons/types.js +2 -0
- package/lib/Authenticator/common/index.js +10 -0
- package/lib/Authenticator/hooks/index.js +5 -0
- package/lib/Authenticator/hooks/types.js +2 -0
- package/lib/Authenticator/hooks/useFieldValues/constants.js +11 -0
- package/lib/Authenticator/hooks/useFieldValues/index.js +10 -0
- package/lib/Authenticator/hooks/useFieldValues/types.js +2 -0
- package/lib/Authenticator/hooks/useFieldValues/useFieldValues.js +101 -0
- package/lib/Authenticator/hooks/useFieldValues/utils.js +139 -0
- package/lib/Authenticator/index.js +13 -0
- package/lib/Authenticator/types.js +2 -0
- package/lib/Authenticator/withAuthenticator.js +15 -0
- package/lib/InAppMessaging/components/BannerMessage/BannerMessage.js +20 -0
- package/lib/InAppMessaging/components/BannerMessage/index.js +8 -0
- package/lib/InAppMessaging/components/BannerMessage/styles.js +81 -0
- package/lib/InAppMessaging/components/BannerMessage/types.js +2 -0
- package/lib/InAppMessaging/components/CarouselMessage/CarouselMessage.js +25 -0
- package/lib/InAppMessaging/components/CarouselMessage/CarouselMessageItem.js +22 -0
- package/lib/InAppMessaging/components/CarouselMessage/index.js +8 -0
- package/lib/InAppMessaging/components/CarouselMessage/styles.js +103 -0
- package/lib/InAppMessaging/components/CarouselMessage/types.js +2 -0
- package/lib/InAppMessaging/components/FullScreenMessage/FullScreenMessage.js +22 -0
- package/lib/InAppMessaging/components/FullScreenMessage/index.js +8 -0
- package/lib/InAppMessaging/components/FullScreenMessage/styles.js +91 -0
- package/lib/InAppMessaging/components/FullScreenMessage/types.js +2 -0
- package/lib/InAppMessaging/components/InAppMessageDisplay/InAppMessageDisplay.js +32 -0
- package/lib/InAppMessaging/components/InAppMessageDisplay/handleMessageLinkAction.js +26 -0
- package/lib/InAppMessaging/components/InAppMessageDisplay/index.js +8 -0
- package/lib/InAppMessaging/components/InAppMessageDisplay/types.js +2 -0
- package/lib/InAppMessaging/components/MessageLayout/MessageLayout.js +38 -0
- package/lib/InAppMessaging/components/MessageLayout/index.js +8 -0
- package/lib/InAppMessaging/components/MessageLayout/types.js +2 -0
- package/lib/InAppMessaging/components/MessageWrapper/MessageWrapper.js +24 -0
- package/lib/InAppMessaging/components/MessageWrapper/index.js +8 -0
- package/lib/InAppMessaging/components/MessageWrapper/styles.js +8 -0
- package/lib/InAppMessaging/components/MessageWrapper/types.js +2 -0
- package/lib/InAppMessaging/components/ModalMessage/ModalMessage.js +22 -0
- package/lib/InAppMessaging/components/ModalMessage/index.js +8 -0
- package/lib/InAppMessaging/components/ModalMessage/styles.js +104 -0
- package/lib/InAppMessaging/components/ModalMessage/types.js +2 -0
- package/lib/InAppMessaging/components/index.js +7 -0
- package/lib/InAppMessaging/components/withInAppMessaging/index.js +8 -0
- package/lib/InAppMessaging/components/withInAppMessaging/withInAppMessaging.js +15 -0
- package/lib/InAppMessaging/constants.js +48 -0
- package/lib/InAppMessaging/hooks/index.js +7 -0
- package/lib/InAppMessaging/hooks/useMessageImage/constants.js +21 -0
- package/lib/InAppMessaging/hooks/useMessageImage/index.js +8 -0
- package/lib/InAppMessaging/hooks/useMessageImage/types.js +9 -0
- package/lib/InAppMessaging/hooks/useMessageImage/useMessageImage.js +53 -0
- package/lib/InAppMessaging/hooks/useMessageImage/utils.js +61 -0
- package/lib/InAppMessaging/hooks/useMessageProps/index.js +8 -0
- package/lib/InAppMessaging/hooks/useMessageProps/types.js +2 -0
- package/lib/InAppMessaging/hooks/useMessageProps/useMessageProps.js +52 -0
- package/lib/InAppMessaging/hooks/useMessageProps/utils.js +201 -0
- package/lib/InAppMessaging/index.js +9 -0
- package/lib/assets/icons/amazonLogo.png +0 -0
- package/lib/assets/icons/amazonLogo@2x.png +0 -0
- package/lib/assets/icons/amazonLogo@3x.png +0 -0
- package/lib/assets/icons/appleLogo.png +0 -0
- package/lib/assets/icons/appleLogo@2x.png +0 -0
- package/lib/assets/icons/appleLogo@3x.png +0 -0
- package/lib/assets/icons/checkboxFilled.png +0 -0
- package/lib/assets/icons/checkboxFilled@2x.png +0 -0
- package/lib/assets/icons/checkboxFilled@3x.png +0 -0
- package/lib/assets/icons/checkboxOutline.png +0 -0
- package/lib/assets/icons/checkboxOutline@2x.png +0 -0
- package/lib/assets/icons/checkboxOutline@3x.png +0 -0
- package/lib/assets/icons/close.png +0 -0
- package/lib/assets/icons/close@2x.png +0 -0
- package/lib/assets/icons/close@3x.png +0 -0
- package/lib/assets/icons/copy.png +0 -0
- package/lib/assets/icons/copy@2x.png +0 -0
- package/lib/assets/icons/copy@3x.png +0 -0
- package/lib/assets/icons/error.png +0 -0
- package/lib/assets/icons/error@2x.png +0 -0
- package/lib/assets/icons/error@3x.png +0 -0
- package/lib/assets/icons/facebookLogo.png +0 -0
- package/lib/assets/icons/facebookLogo@2x.png +0 -0
- package/lib/assets/icons/facebookLogo@3x.png +0 -0
- package/lib/assets/icons/googleLogo.png +0 -0
- package/lib/assets/icons/googleLogo@2x.png +0 -0
- package/lib/assets/icons/googleLogo@3x.png +0 -0
- package/lib/assets/icons/index.js +16 -0
- package/lib/assets/icons/index.ts +17 -0
- package/lib/assets/icons/visibilityOff.png +0 -0
- package/lib/assets/icons/visibilityOff@2x.png +0 -0
- package/lib/assets/icons/visibilityOff@3x.png +0 -0
- package/lib/assets/icons/visibilityOn.png +0 -0
- package/lib/assets/icons/visibilityOn@2x.png +0 -0
- package/lib/assets/icons/visibilityOn@3x.png +0 -0
- package/lib/assets/index.js +8 -0
- package/lib/hooks/index.js +9 -0
- package/lib/hooks/useDeprecationWarning/index.js +8 -0
- package/lib/hooks/useDeprecationWarning/useDeprecationWarning.js +13 -0
- package/lib/hooks/useDeviceOrientation/index.js +8 -0
- package/lib/hooks/useDeviceOrientation/useDeviceOrientation.js +37 -0
- package/lib/hooks/usePressableContainerStyles/index.js +5 -0
- package/lib/hooks/usePressableContainerStyles/usePressableContainerStyles.js +19 -0
- package/lib/index.js +14 -0
- package/lib/primitives/Button/Button.js +31 -0
- package/lib/primitives/Button/index.js +8 -0
- package/lib/primitives/Button/styles.js +55 -0
- package/lib/primitives/Button/types.js +2 -0
- package/lib/primitives/Carousel/Carousel.js +63 -0
- package/lib/primitives/Carousel/CarouselPageIndicator.js +14 -0
- package/lib/primitives/Carousel/constants.js +21 -0
- package/lib/primitives/Carousel/index.js +10 -0
- package/lib/primitives/Carousel/styles.js +14 -0
- package/lib/primitives/Carousel/types.js +2 -0
- package/lib/primitives/Checkbox/Checkbox.js +28 -0
- package/lib/primitives/Checkbox/index.js +8 -0
- package/lib/primitives/Checkbox/styles.js +28 -0
- package/lib/primitives/Checkbox/types.js +2 -0
- package/lib/primitives/Divider/Divider.js +22 -0
- package/lib/primitives/Divider/index.js +8 -0
- package/lib/primitives/Divider/styles.js +28 -0
- package/lib/primitives/Divider/types.js +2 -0
- package/lib/primitives/ErrorMessage/ErrorMessage.js +22 -0
- package/lib/primitives/ErrorMessage/index.js +8 -0
- package/lib/primitives/ErrorMessage/styles.js +30 -0
- package/lib/primitives/ErrorMessage/types.js +2 -0
- package/lib/primitives/Heading/Heading.js +15 -0
- package/lib/primitives/Heading/index.js +8 -0
- package/lib/primitives/Heading/styles.js +51 -0
- package/lib/primitives/Heading/types.js +2 -0
- package/lib/primitives/Icon/Icon.js +21 -0
- package/lib/primitives/Icon/constants.js +10 -0
- package/lib/primitives/Icon/index.js +10 -0
- package/lib/primitives/Icon/styles.js +34 -0
- package/lib/primitives/Icon/types.js +2 -0
- package/lib/primitives/IconButton/IconButton.js +26 -0
- package/lib/primitives/IconButton/index.js +8 -0
- package/lib/primitives/IconButton/styles.js +21 -0
- package/lib/primitives/IconButton/types.js +2 -0
- package/lib/primitives/Label/Label.js +16 -0
- package/lib/primitives/Label/index.js +8 -0
- package/lib/primitives/Label/styles.js +45 -0
- package/lib/primitives/Label/types.js +2 -0
- package/lib/primitives/Label/utils.js +25 -0
- package/lib/primitives/PasswordField/PasswordField.js +24 -0
- package/lib/primitives/PasswordField/index.js +8 -0
- package/lib/primitives/PasswordField/styles.js +17 -0
- package/lib/primitives/PasswordField/types.js +2 -0
- package/lib/primitives/PhoneNumberField/PhoneNumberField.js +13 -0
- package/lib/primitives/PhoneNumberField/index.js +8 -0
- package/lib/primitives/PhoneNumberField/styles.js +22 -0
- package/lib/primitives/PhoneNumberField/types.js +2 -0
- package/lib/primitives/Radio/Radio.js +46 -0
- package/lib/primitives/Radio/getRadioDimensions.js +43 -0
- package/lib/primitives/Radio/index.js +8 -0
- package/lib/primitives/Radio/styles.js +68 -0
- package/lib/primitives/Radio/types.js +2 -0
- package/lib/primitives/RadioGroup/RadioGroup.js +55 -0
- package/lib/primitives/RadioGroup/index.js +8 -0
- package/lib/primitives/RadioGroup/styles.js +20 -0
- package/lib/primitives/RadioGroup/types.js +2 -0
- package/lib/primitives/Tabs/Tab.js +27 -0
- package/lib/primitives/Tabs/Tabs.js +29 -0
- package/lib/primitives/Tabs/index.js +10 -0
- package/lib/primitives/Tabs/styles.js +58 -0
- package/lib/primitives/Tabs/types.js +2 -0
- package/lib/primitives/TextField/TextField.js +31 -0
- package/lib/primitives/TextField/index.js +8 -0
- package/lib/primitives/TextField/styles.js +46 -0
- package/lib/primitives/TextField/types.js +2 -0
- package/lib/primitives/index.js +18 -0
- package/lib/theme/ThemeContext.js +9 -0
- package/lib/theme/ThemeProvider.js +12 -0
- package/lib/theme/createTheme.js +113 -0
- package/lib/theme/defaultTheme.js +11 -0
- package/lib/theme/index.js +12 -0
- package/lib/theme/types.js +2 -0
- package/lib/theme/useTheme.js +11 -0
- package/lib/utils/font.js +8 -0
- package/lib/utils/index.js +10 -0
- package/lib/utils/platform.js +21 -0
- package/lib/version.js +4 -0
- package/package.json +19 -10
- package/src/version.ts +1 -1
- package/.eslintrc.js +0 -12
- package/.lintstagedrc.js +0 -6
- package/.turbo/turbo-build.log +0 -3
- package/CHANGELOG.md +0 -332
- package/babel.config.js +0 -3
- package/dist/assets/index.ts +0 -1
- package/jest.config.js +0 -22
- package/jest.setup.js +0 -3
- package/src/Authenticator/Defaults/ConfirmResetPassword/__tests__/ConfirmResetPassword.spec.tsx +0 -89
- package/src/Authenticator/Defaults/ConfirmResetPassword/__tests__/__snapshots__/ConfirmResetPassword.spec.tsx.snap +0 -1090
- package/src/Authenticator/Defaults/ConfirmSignIn/__tests__/ConfirmSignIn.spec.tsx +0 -78
- package/src/Authenticator/Defaults/ConfirmSignIn/__tests__/__snapshots__/ConfirmSignIn.spec.tsx.snap +0 -512
- package/src/Authenticator/Defaults/ConfirmSignUp/__tests__/ConfirmSignUp.spec.tsx +0 -64
- package/src/Authenticator/Defaults/ConfirmSignUp/__tests__/__snapshots__/ConfirmSignUp.spec.tsx.snap +0 -528
- package/src/Authenticator/Defaults/ConfirmVerifyUser/__tests__/ConfirmVerifyUser.spec.tsx +0 -71
- package/src/Authenticator/Defaults/ConfirmVerifyUser/__tests__/__snapshots__/ConfirmVerifyUser.spec.tsx.snap +0 -492
- package/src/Authenticator/Defaults/ForceNewPassword/__tests__/ForceNewPassword.spec.tsx +0 -79
- package/src/Authenticator/Defaults/ForceNewPassword/__tests__/__snapshots__/ForceNewPassword.spec.tsx.snap +0 -896
- package/src/Authenticator/Defaults/ResetPassword/__tests__/ResetPassword.spec.tsx +0 -78
- package/src/Authenticator/Defaults/ResetPassword/__tests__/__snapshots__/ResetPassword.spec.tsx.snap +0 -512
- package/src/Authenticator/Defaults/SetupTOTP/__tests__/SetupTOTP.spec.tsx +0 -85
- package/src/Authenticator/Defaults/SetupTOTP/__tests__/__snapshots__/SetupTOTP.spec.tsx.snap +0 -602
- package/src/Authenticator/Defaults/SignIn/__tests__/SignIn.spec.tsx +0 -67
- package/src/Authenticator/Defaults/SignIn/__tests__/__snapshots__/SignIn.spec.tsx.snap +0 -1281
- package/src/Authenticator/Defaults/SignUp/__tests__/SignUp.spec.tsx +0 -102
- package/src/Authenticator/Defaults/SignUp/__tests__/__snapshots__/SignUp.spec.tsx.snap +0 -3122
- package/src/Authenticator/Defaults/VerifyUser/__tests__/VerifyUser.spec.tsx +0 -107
- package/src/Authenticator/Defaults/VerifyUser/__tests__/__snapshots__/VerifyUser.spec.tsx.snap +0 -692
- package/src/Authenticator/__tests__/Authenticator.spec.tsx +0 -131
- package/src/Authenticator/__tests__/__snapshots__/Authenticator.spec.tsx.snap +0 -90
- package/src/Authenticator/__tests__/__snapshots__/withAuthenticator.spec.tsx.snap +0 -68
- package/src/Authenticator/__tests__/withAuthenticator.spec.tsx +0 -73
- package/src/Authenticator/common/DefaultContainer/__tests__/DefaultContainer.spec.tsx +0 -19
- package/src/Authenticator/common/DefaultContainer/__tests__/__snapshots__/DefaultContainer.spec.tsx.snap +0 -83
- package/src/Authenticator/common/DefaultFooter/__tests__/DefaultFooter.spec.tsx +0 -26
- package/src/Authenticator/common/DefaultFooter/__tests__/__snapshots__/DefaultFooter.spec.tsx.snap +0 -40
- package/src/Authenticator/common/DefaultFormFields/__tests__/DefaultFormFields.spec.tsx +0 -15
- package/src/Authenticator/common/DefaultFormFields/__tests__/FieldErrors.spec.tsx +0 -29
- package/src/Authenticator/common/DefaultFormFields/__tests__/__snapshots__/DefaultFormFields.spec.tsx.snap +0 -3
- package/src/Authenticator/common/DefaultFormFields/__tests__/__snapshots__/FieldErrors.spec.tsx.snap +0 -32
- package/src/Authenticator/common/DefaultHeader/__tests__/DefaultHeader.spec.tsx +0 -23
- package/src/Authenticator/common/DefaultHeader/__tests__/__snapshots__/DefaultHeader.spec.tsx.snap +0 -24
- package/src/Authenticator/common/FederatedProviderButton/__tests__/FederatedProviderButton.spec.tsx +0 -67
- package/src/Authenticator/common/FederatedProviderButton/__tests__/__snapshots__/FederatedProviderButton.spec.tsx.snap +0 -185
- package/src/Authenticator/common/FederatedProviderButtons/__tests__/FederatedProviderButtons.spec.tsx +0 -55
- package/src/Authenticator/common/FederatedProviderButtons/__tests__/__snapshots__/FederatedProviderButtons.spec.tsx.snap +0 -167
- package/src/Authenticator/hooks/useFieldValues/__tests__/useFieldValues.spec.ts +0 -399
- package/src/Authenticator/hooks/useFieldValues/__tests__/utils.spec.ts +0 -282
- package/src/InAppMessaging/components/BannerMessage/__tests__/BannerMessage.spec.tsx +0 -151
- package/src/InAppMessaging/components/BannerMessage/__tests__/__snapshots__/BannerMessage.spec.tsx.snap +0 -618
- package/src/InAppMessaging/components/CarouselMessage/__tests__/CarouselMessage.spec.tsx +0 -92
- package/src/InAppMessaging/components/CarouselMessage/__tests__/CarouselMessageItem.spec.tsx +0 -50
- package/src/InAppMessaging/components/CarouselMessage/__tests__/__snapshots__/CarouselMessage.spec.tsx.snap +0 -124
- package/src/InAppMessaging/components/CarouselMessage/__tests__/__snapshots__/CarouselMessageItem.spec.tsx.snap +0 -248
- package/src/InAppMessaging/components/FullScreenMessage/__tests__/FullScreenMessage.spec.tsx +0 -53
- package/src/InAppMessaging/components/FullScreenMessage/__tests__/__snapshots__/FullScreenMessage.spec.tsx.snap +0 -238
- package/src/InAppMessaging/components/InAppMessageDisplay/__tests__/InAppMessageDisplay.spec.tsx +0 -34
- package/src/InAppMessaging/components/InAppMessageDisplay/__tests__/__snapshots__/InAppMessageDisplay.spec.tsx.snap +0 -9
- package/src/InAppMessaging/components/InAppMessageDisplay/__tests__/handleMessageLinkAction.spec.ts +0 -51
- package/src/InAppMessaging/components/MessageWrapper/__tests__/MessageWrapper.spec.tsx +0 -19
- package/src/InAppMessaging/components/MessageWrapper/__tests__/__snapshots__/MessageWrapper.spec.tsx.snap +0 -35
- package/src/InAppMessaging/components/ModalMessage/__tests__/ModalMessage.spec.tsx +0 -169
- package/src/InAppMessaging/components/ModalMessage/__tests__/__snapshots__/ModalMessage.spec.tsx.snap +0 -727
- package/src/InAppMessaging/components/withInAppMessaging/__tests__/__snapshots__/withInAppMessaging.spec.tsx.snap +0 -3
- package/src/InAppMessaging/components/withInAppMessaging/__tests__/withInAppMessaging.spec.tsx +0 -15
- package/src/InAppMessaging/hooks/useMessageImage/__tests__/useMessageImage.spec.ts +0 -141
- package/src/InAppMessaging/hooks/useMessageImage/__tests__/utils.spec.ts +0 -107
- package/src/InAppMessaging/hooks/useMessageProps/__tests__/__snapshots__/utils.spec.ts.snap +0 -223
- package/src/InAppMessaging/hooks/useMessageProps/__tests__/useMessageProps.spec.ts +0 -162
- package/src/InAppMessaging/hooks/useMessageProps/__tests__/utils.spec.ts +0 -355
- package/src/__mocks__/@react-native-async-storage/async-storage.ts +0 -2
- package/src/__mocks__/@react-native-community/netinfo.ts +0 -3
- package/src/__mocks__/react-native-safe-area-context.ts +0 -9
- package/src/__tests__/__snapshots__/index.spec.ts.snap +0 -26
- package/src/__tests__/index.spec.ts +0 -8
- package/src/hooks/useDeprecationWarning/__tests__/useDeprecationWarning.spec.ts +0 -42
- package/src/hooks/useDeviceOrientation/__tests__/useDeviceOrientation.spec.ts +0 -89
- package/src/hooks/usePressableContainerStyles/__tests__/usePressableContainerStyles.spec.ts +0 -68
- package/src/primitives/Button/__tests__/Button.spec.tsx +0 -92
- package/src/primitives/Button/__tests__/__snapshots__/Button.spec.tsx.snap +0 -143
- package/src/primitives/Carousel/__tests__/Carousel.spec.tsx +0 -174
- package/src/primitives/Carousel/__tests__/CarouselPageIndicator.spec.tsx +0 -73
- package/src/primitives/Carousel/__tests__/__snapshots__/Carousel.spec.tsx.snap +0 -310
- package/src/primitives/Carousel/__tests__/__snapshots__/CarouselPageIndicator.spec.tsx.snap +0 -191
- package/src/primitives/Checkbox/__tests__/Checkbox.spec.tsx +0 -150
- package/src/primitives/Checkbox/__tests__/__snapshots__/Checkbox.spec.tsx.snap +0 -527
- package/src/primitives/Divider/__tests__/Divider.spec.tsx +0 -50
- package/src/primitives/Divider/__tests__/__snapshots__/Divider.spec.tsx.snap +0 -165
- package/src/primitives/ErrorMessage/__tests__/ErrorMessage.spec.tsx +0 -60
- package/src/primitives/ErrorMessage/__tests__/__snapshots__/ErrorMessage.spec.tsx.snap +0 -123
- package/src/primitives/Heading/__tests__/Heading.spec.tsx +0 -73
- package/src/primitives/Heading/__tests__/__snapshots__/Heading.spec.tsx.snap +0 -171
- package/src/primitives/Icon/__tests__/Icon.spec.tsx +0 -100
- package/src/primitives/Icon/__tests__/__snapshots__/Icon.spec.tsx.snap +0 -139
- package/src/primitives/IconButton/__tests__/IconButton.spec.tsx +0 -71
- package/src/primitives/IconButton/__tests__/__snapshots__/IconButton.spec.tsx.snap +0 -192
- package/src/primitives/Label/__tests__/Label.spec.tsx +0 -75
- package/src/primitives/Label/__tests__/__snapshots__/Label.spec.tsx.snap +0 -91
- package/src/primitives/PasswordField/__tests__/PasswordField.spec.tsx +0 -110
- package/src/primitives/PasswordField/__tests__/__snapshots__/PasswordField.spec.tsx.snap +0 -625
- package/src/primitives/PhoneNumberField/__tests__/PhoneNumberField.spec.tsx +0 -53
- package/src/primitives/PhoneNumberField/__tests__/__snapshots__/PhoneNumberField.spec.tsx.snap +0 -188
- package/src/primitives/Radio/__tests__/Radio.spec.tsx +0 -166
- package/src/primitives/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +0 -678
- package/src/primitives/RadioGroup/__tests__/RadioGroup.spec.tsx +0 -183
- package/src/primitives/RadioGroup/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +0 -1789
- package/src/primitives/Tabs/__tests__/Tab.spec.tsx +0 -75
- package/src/primitives/Tabs/__tests__/Tabs.spec.tsx +0 -81
- package/src/primitives/Tabs/__tests__/__snapshots__/Tab.spec.tsx.snap +0 -278
- package/src/primitives/Tabs/__tests__/__snapshots__/Tabs.spec.tsx.snap +0 -163
- package/src/primitives/TextField/__tests__/TextField.spec.tsx +0 -202
- package/src/primitives/TextField/__tests__/__snapshots__/TextField.spec.tsx.snap +0 -507
- package/src/theme/__tests__/ThemeProvider.spec.tsx +0 -23
- package/src/theme/__tests__/__snapshots__/useTheme.spec.tsx.snap +0 -226
- package/src/theme/__tests__/createTheme.spec.ts +0 -244
- package/src/theme/__tests__/useTheme.spec.tsx +0 -51
- package/tsconfig.dist.json +0 -4
- package/tsconfig.json +0 -9
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Divider applies theme and style props 1`] = `
|
|
4
|
-
<View
|
|
5
|
-
style={
|
|
6
|
-
Array [
|
|
7
|
-
Object {
|
|
8
|
-
"alignItems": "center",
|
|
9
|
-
"flexDirection": "row",
|
|
10
|
-
},
|
|
11
|
-
undefined,
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
>
|
|
15
|
-
<View
|
|
16
|
-
style={
|
|
17
|
-
Array [
|
|
18
|
-
Object {
|
|
19
|
-
"backgroundColor": "hsl(0, 0%, 0%)",
|
|
20
|
-
"flex": 1,
|
|
21
|
-
"height": 0.5,
|
|
22
|
-
},
|
|
23
|
-
Object {
|
|
24
|
-
"backgroundColor": "blue",
|
|
25
|
-
},
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
testID="amplify__divider__line"
|
|
29
|
-
/>
|
|
30
|
-
<Text
|
|
31
|
-
accessibilityRole="text"
|
|
32
|
-
style={
|
|
33
|
-
Array [
|
|
34
|
-
Object {
|
|
35
|
-
"fontSize": 16,
|
|
36
|
-
"fontWeight": "400",
|
|
37
|
-
"lineHeight": 24,
|
|
38
|
-
},
|
|
39
|
-
Object {
|
|
40
|
-
"color": "hsl(210, 50%, 10%)",
|
|
41
|
-
},
|
|
42
|
-
Array [
|
|
43
|
-
Object {
|
|
44
|
-
"fontSize": 16,
|
|
45
|
-
"margin": 16,
|
|
46
|
-
"textAlign": "center",
|
|
47
|
-
},
|
|
48
|
-
Object {
|
|
49
|
-
"color": "red",
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
>
|
|
55
|
-
Divider label
|
|
56
|
-
</Text>
|
|
57
|
-
<View
|
|
58
|
-
style={
|
|
59
|
-
Array [
|
|
60
|
-
Object {
|
|
61
|
-
"backgroundColor": "hsl(0, 0%, 0%)",
|
|
62
|
-
"flex": 1,
|
|
63
|
-
"height": 0.5,
|
|
64
|
-
},
|
|
65
|
-
Object {
|
|
66
|
-
"backgroundColor": "blue",
|
|
67
|
-
},
|
|
68
|
-
]
|
|
69
|
-
}
|
|
70
|
-
/>
|
|
71
|
-
</View>
|
|
72
|
-
`;
|
|
73
|
-
|
|
74
|
-
exports[`Divider renders as expected with label 1`] = `
|
|
75
|
-
<View
|
|
76
|
-
style={
|
|
77
|
-
Array [
|
|
78
|
-
Object {
|
|
79
|
-
"alignItems": "center",
|
|
80
|
-
"flexDirection": "row",
|
|
81
|
-
},
|
|
82
|
-
undefined,
|
|
83
|
-
]
|
|
84
|
-
}
|
|
85
|
-
>
|
|
86
|
-
<View
|
|
87
|
-
style={
|
|
88
|
-
Array [
|
|
89
|
-
Object {
|
|
90
|
-
"backgroundColor": "hsl(0, 0%, 0%)",
|
|
91
|
-
"flex": 1,
|
|
92
|
-
"height": 0.5,
|
|
93
|
-
},
|
|
94
|
-
undefined,
|
|
95
|
-
]
|
|
96
|
-
}
|
|
97
|
-
testID="amplify__divider__line"
|
|
98
|
-
/>
|
|
99
|
-
<Text
|
|
100
|
-
accessibilityRole="text"
|
|
101
|
-
style={
|
|
102
|
-
Array [
|
|
103
|
-
Object {
|
|
104
|
-
"fontSize": 16,
|
|
105
|
-
"fontWeight": "400",
|
|
106
|
-
"lineHeight": 24,
|
|
107
|
-
},
|
|
108
|
-
Object {
|
|
109
|
-
"color": "hsl(210, 50%, 10%)",
|
|
110
|
-
},
|
|
111
|
-
Array [
|
|
112
|
-
Object {
|
|
113
|
-
"fontSize": 16,
|
|
114
|
-
"margin": 16,
|
|
115
|
-
"textAlign": "center",
|
|
116
|
-
},
|
|
117
|
-
undefined,
|
|
118
|
-
],
|
|
119
|
-
]
|
|
120
|
-
}
|
|
121
|
-
>
|
|
122
|
-
Divider label
|
|
123
|
-
</Text>
|
|
124
|
-
<View
|
|
125
|
-
style={
|
|
126
|
-
Array [
|
|
127
|
-
Object {
|
|
128
|
-
"backgroundColor": "hsl(0, 0%, 0%)",
|
|
129
|
-
"flex": 1,
|
|
130
|
-
"height": 0.5,
|
|
131
|
-
},
|
|
132
|
-
undefined,
|
|
133
|
-
]
|
|
134
|
-
}
|
|
135
|
-
/>
|
|
136
|
-
</View>
|
|
137
|
-
`;
|
|
138
|
-
|
|
139
|
-
exports[`Divider renders as expected without label 1`] = `
|
|
140
|
-
<View
|
|
141
|
-
style={
|
|
142
|
-
Array [
|
|
143
|
-
Object {
|
|
144
|
-
"alignItems": "center",
|
|
145
|
-
"flexDirection": "row",
|
|
146
|
-
},
|
|
147
|
-
undefined,
|
|
148
|
-
]
|
|
149
|
-
}
|
|
150
|
-
>
|
|
151
|
-
<View
|
|
152
|
-
style={
|
|
153
|
-
Array [
|
|
154
|
-
Object {
|
|
155
|
-
"backgroundColor": "hsl(0, 0%, 0%)",
|
|
156
|
-
"flex": 1,
|
|
157
|
-
"height": 0.5,
|
|
158
|
-
},
|
|
159
|
-
undefined,
|
|
160
|
-
]
|
|
161
|
-
}
|
|
162
|
-
testID="amplify__divider__line"
|
|
163
|
-
/>
|
|
164
|
-
</View>
|
|
165
|
-
`;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { fireEvent, render, renderHook } from '@testing-library/react-native';
|
|
3
|
-
|
|
4
|
-
import { useTheme } from '../../../theme';
|
|
5
|
-
import { CLOSE_BUTTON_TEST_ID } from '../ErrorMessage';
|
|
6
|
-
import ErrorMessage from '../ErrorMessage';
|
|
7
|
-
import { getThemedStyles } from '../styles';
|
|
8
|
-
|
|
9
|
-
describe('ErrorMessage', () => {
|
|
10
|
-
it('renders default ErrorMessage as expected', () => {
|
|
11
|
-
const { toJSON, queryByTestId } = render(
|
|
12
|
-
<ErrorMessage>Default ErrorMessage</ErrorMessage>
|
|
13
|
-
);
|
|
14
|
-
expect(toJSON()).toMatchSnapshot();
|
|
15
|
-
expect(queryByTestId(CLOSE_BUTTON_TEST_ID)).toBeFalsy();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('handles an onDismiss callback', () => {
|
|
19
|
-
const customOnDismiss = jest.fn();
|
|
20
|
-
const { getByTestId } = render(
|
|
21
|
-
<ErrorMessage onDismiss={customOnDismiss}>
|
|
22
|
-
Default ErrorMessage
|
|
23
|
-
</ErrorMessage>
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
const dismissButton = getByTestId(CLOSE_BUTTON_TEST_ID);
|
|
27
|
-
fireEvent.press(dismissButton);
|
|
28
|
-
|
|
29
|
-
expect(customOnDismiss).toHaveBeenCalledTimes(1);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('applies theme and style props', () => {
|
|
33
|
-
const customStyle = { backgroundColor: 'blue' };
|
|
34
|
-
const customLabelStyle = { color: 'white' };
|
|
35
|
-
const labelText = 'Themed ErrorMessage';
|
|
36
|
-
|
|
37
|
-
const { getByRole, getByText, toJSON } = render(
|
|
38
|
-
<ErrorMessage labelStyle={customLabelStyle} style={customStyle}>
|
|
39
|
-
{labelText}
|
|
40
|
-
</ErrorMessage>
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
const { result } = renderHook(() => useTheme());
|
|
44
|
-
const themedStyle = getThemedStyles(result.current);
|
|
45
|
-
|
|
46
|
-
const alert = getByRole('alert');
|
|
47
|
-
const label = getByText(labelText);
|
|
48
|
-
|
|
49
|
-
expect(alert.props.style).toStrictEqual([
|
|
50
|
-
themedStyle.container,
|
|
51
|
-
customStyle,
|
|
52
|
-
]);
|
|
53
|
-
|
|
54
|
-
expect(label.props.style).toStrictEqual([
|
|
55
|
-
themedStyle.label,
|
|
56
|
-
customLabelStyle,
|
|
57
|
-
]);
|
|
58
|
-
expect(toJSON()).toMatchSnapshot();
|
|
59
|
-
});
|
|
60
|
-
});
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`ErrorMessage applies theme and style props 1`] = `
|
|
4
|
-
<View
|
|
5
|
-
accessibilityRole="alert"
|
|
6
|
-
style={
|
|
7
|
-
Array [
|
|
8
|
-
Object {
|
|
9
|
-
"alignItems": "center",
|
|
10
|
-
"backgroundColor": "hsl(0, 75%, 85%)",
|
|
11
|
-
"flexDirection": "row",
|
|
12
|
-
"paddingHorizontal": 8,
|
|
13
|
-
"paddingVertical": 12,
|
|
14
|
-
},
|
|
15
|
-
Object {
|
|
16
|
-
"backgroundColor": "blue",
|
|
17
|
-
},
|
|
18
|
-
]
|
|
19
|
-
}
|
|
20
|
-
>
|
|
21
|
-
<Image
|
|
22
|
-
accessibilityRole="image"
|
|
23
|
-
source={
|
|
24
|
-
Object {
|
|
25
|
-
"testUri": "../../../src/assets/icons/error.png",
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
style={
|
|
29
|
-
Array [
|
|
30
|
-
Object {
|
|
31
|
-
"height": 20,
|
|
32
|
-
"resizeMode": "contain",
|
|
33
|
-
"tintColor": undefined,
|
|
34
|
-
"width": 20,
|
|
35
|
-
},
|
|
36
|
-
Array [
|
|
37
|
-
Object {
|
|
38
|
-
"margin": 8,
|
|
39
|
-
"tintColor": "hsl(0, 100%, 20%)",
|
|
40
|
-
},
|
|
41
|
-
undefined,
|
|
42
|
-
],
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
/>
|
|
46
|
-
<Text
|
|
47
|
-
style={
|
|
48
|
-
Array [
|
|
49
|
-
Object {
|
|
50
|
-
"color": "hsl(0, 100%, 20%)",
|
|
51
|
-
"flex": 1,
|
|
52
|
-
"fontSize": 16,
|
|
53
|
-
"paddingHorizontal": 8,
|
|
54
|
-
},
|
|
55
|
-
Object {
|
|
56
|
-
"color": "white",
|
|
57
|
-
},
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
>
|
|
61
|
-
Themed ErrorMessage
|
|
62
|
-
</Text>
|
|
63
|
-
</View>
|
|
64
|
-
`;
|
|
65
|
-
|
|
66
|
-
exports[`ErrorMessage renders default ErrorMessage as expected 1`] = `
|
|
67
|
-
<View
|
|
68
|
-
accessibilityRole="alert"
|
|
69
|
-
style={
|
|
70
|
-
Array [
|
|
71
|
-
Object {
|
|
72
|
-
"alignItems": "center",
|
|
73
|
-
"backgroundColor": "hsl(0, 75%, 85%)",
|
|
74
|
-
"flexDirection": "row",
|
|
75
|
-
"paddingHorizontal": 8,
|
|
76
|
-
"paddingVertical": 12,
|
|
77
|
-
},
|
|
78
|
-
undefined,
|
|
79
|
-
]
|
|
80
|
-
}
|
|
81
|
-
>
|
|
82
|
-
<Image
|
|
83
|
-
accessibilityRole="image"
|
|
84
|
-
source={
|
|
85
|
-
Object {
|
|
86
|
-
"testUri": "../../../src/assets/icons/error.png",
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
style={
|
|
90
|
-
Array [
|
|
91
|
-
Object {
|
|
92
|
-
"height": 20,
|
|
93
|
-
"resizeMode": "contain",
|
|
94
|
-
"tintColor": undefined,
|
|
95
|
-
"width": 20,
|
|
96
|
-
},
|
|
97
|
-
Array [
|
|
98
|
-
Object {
|
|
99
|
-
"margin": 8,
|
|
100
|
-
"tintColor": "hsl(0, 100%, 20%)",
|
|
101
|
-
},
|
|
102
|
-
undefined,
|
|
103
|
-
],
|
|
104
|
-
]
|
|
105
|
-
}
|
|
106
|
-
/>
|
|
107
|
-
<Text
|
|
108
|
-
style={
|
|
109
|
-
Array [
|
|
110
|
-
Object {
|
|
111
|
-
"color": "hsl(0, 100%, 20%)",
|
|
112
|
-
"flex": 1,
|
|
113
|
-
"fontSize": 16,
|
|
114
|
-
"paddingHorizontal": 8,
|
|
115
|
-
},
|
|
116
|
-
undefined,
|
|
117
|
-
]
|
|
118
|
-
}
|
|
119
|
-
>
|
|
120
|
-
Default ErrorMessage
|
|
121
|
-
</Text>
|
|
122
|
-
</View>
|
|
123
|
-
`;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, renderHook } from '@testing-library/react-native';
|
|
3
|
-
|
|
4
|
-
import { useTheme } from '../../../theme';
|
|
5
|
-
import Heading from '../Heading';
|
|
6
|
-
import { HeadingProps } from '../types';
|
|
7
|
-
import { getThemedStyles } from '../styles';
|
|
8
|
-
|
|
9
|
-
const levels: HeadingProps['level'][] = [1, 2, 3, 4, 5, 6];
|
|
10
|
-
|
|
11
|
-
describe('Heading', () => {
|
|
12
|
-
it('renders a level 6 Heading by default', () => {
|
|
13
|
-
const title = 'Test Heading';
|
|
14
|
-
|
|
15
|
-
const { toJSON, getByText } = render(<Heading>{title}</Heading>);
|
|
16
|
-
|
|
17
|
-
const { result } = renderHook(() => useTheme());
|
|
18
|
-
const themedStyle = getThemedStyles(result.current);
|
|
19
|
-
|
|
20
|
-
const heading = getByText(title);
|
|
21
|
-
|
|
22
|
-
expect(heading.props.style).toStrictEqual([
|
|
23
|
-
themedStyle.text,
|
|
24
|
-
themedStyle[6],
|
|
25
|
-
undefined,
|
|
26
|
-
]);
|
|
27
|
-
|
|
28
|
-
expect(toJSON()).toMatchSnapshot();
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it.each(levels)('renders a level %i Heading as expected', (level) => {
|
|
32
|
-
const title = `Heading level ${level}`;
|
|
33
|
-
|
|
34
|
-
const { toJSON, getByText } = render(
|
|
35
|
-
<Heading level={level}>{title}</Heading>
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
const { result } = renderHook(() => useTheme());
|
|
39
|
-
const themedStyle = getThemedStyles(result.current);
|
|
40
|
-
|
|
41
|
-
const heading = getByText(title);
|
|
42
|
-
|
|
43
|
-
expect(heading.props.style).toStrictEqual([
|
|
44
|
-
themedStyle.text,
|
|
45
|
-
themedStyle[level ?? 6],
|
|
46
|
-
undefined,
|
|
47
|
-
]);
|
|
48
|
-
|
|
49
|
-
expect(toJSON()).toMatchSnapshot();
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('applies theme and style props', () => {
|
|
53
|
-
const customStyle = { color: 'red' };
|
|
54
|
-
const title = 'Styled Heading';
|
|
55
|
-
|
|
56
|
-
const { toJSON, getByText } = render(
|
|
57
|
-
<Heading style={customStyle}>{title}</Heading>
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
const { result } = renderHook(() => useTheme());
|
|
61
|
-
const themedStyle = getThemedStyles(result.current);
|
|
62
|
-
|
|
63
|
-
const heading = getByText(title);
|
|
64
|
-
|
|
65
|
-
expect(heading.props.style).toStrictEqual([
|
|
66
|
-
themedStyle.text,
|
|
67
|
-
themedStyle[6],
|
|
68
|
-
customStyle,
|
|
69
|
-
]);
|
|
70
|
-
|
|
71
|
-
expect(toJSON()).toMatchSnapshot();
|
|
72
|
-
});
|
|
73
|
-
});
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Heading applies theme and style props 1`] = `
|
|
4
|
-
<Text
|
|
5
|
-
accessibilityRole="header"
|
|
6
|
-
style={
|
|
7
|
-
Array [
|
|
8
|
-
Object {
|
|
9
|
-
"color": "hsl(210, 50%, 10%)",
|
|
10
|
-
},
|
|
11
|
-
Object {
|
|
12
|
-
"fontSize": 14,
|
|
13
|
-
"fontWeight": "700",
|
|
14
|
-
"lineHeight": 21,
|
|
15
|
-
},
|
|
16
|
-
Object {
|
|
17
|
-
"color": "red",
|
|
18
|
-
},
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
>
|
|
22
|
-
Styled Heading
|
|
23
|
-
</Text>
|
|
24
|
-
`;
|
|
25
|
-
|
|
26
|
-
exports[`Heading renders a level 1 Heading as expected 1`] = `
|
|
27
|
-
<Text
|
|
28
|
-
accessibilityRole="header"
|
|
29
|
-
style={
|
|
30
|
-
Array [
|
|
31
|
-
Object {
|
|
32
|
-
"color": "hsl(210, 50%, 10%)",
|
|
33
|
-
},
|
|
34
|
-
Object {
|
|
35
|
-
"fontSize": 40,
|
|
36
|
-
"fontWeight": "300",
|
|
37
|
-
"lineHeight": 60,
|
|
38
|
-
},
|
|
39
|
-
undefined,
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
>
|
|
43
|
-
Heading level 1
|
|
44
|
-
</Text>
|
|
45
|
-
`;
|
|
46
|
-
|
|
47
|
-
exports[`Heading renders a level 2 Heading as expected 1`] = `
|
|
48
|
-
<Text
|
|
49
|
-
accessibilityRole="header"
|
|
50
|
-
style={
|
|
51
|
-
Array [
|
|
52
|
-
Object {
|
|
53
|
-
"color": "hsl(210, 50%, 10%)",
|
|
54
|
-
},
|
|
55
|
-
Object {
|
|
56
|
-
"fontSize": 32,
|
|
57
|
-
"fontWeight": "400",
|
|
58
|
-
"lineHeight": 48,
|
|
59
|
-
},
|
|
60
|
-
undefined,
|
|
61
|
-
]
|
|
62
|
-
}
|
|
63
|
-
>
|
|
64
|
-
Heading level 2
|
|
65
|
-
</Text>
|
|
66
|
-
`;
|
|
67
|
-
|
|
68
|
-
exports[`Heading renders a level 3 Heading as expected 1`] = `
|
|
69
|
-
<Text
|
|
70
|
-
accessibilityRole="header"
|
|
71
|
-
style={
|
|
72
|
-
Array [
|
|
73
|
-
Object {
|
|
74
|
-
"color": "hsl(210, 50%, 10%)",
|
|
75
|
-
},
|
|
76
|
-
Object {
|
|
77
|
-
"fontSize": 24,
|
|
78
|
-
"fontWeight": "500",
|
|
79
|
-
"lineHeight": 36,
|
|
80
|
-
},
|
|
81
|
-
undefined,
|
|
82
|
-
]
|
|
83
|
-
}
|
|
84
|
-
>
|
|
85
|
-
Heading level 3
|
|
86
|
-
</Text>
|
|
87
|
-
`;
|
|
88
|
-
|
|
89
|
-
exports[`Heading renders a level 4 Heading as expected 1`] = `
|
|
90
|
-
<Text
|
|
91
|
-
accessibilityRole="header"
|
|
92
|
-
style={
|
|
93
|
-
Array [
|
|
94
|
-
Object {
|
|
95
|
-
"color": "hsl(210, 50%, 10%)",
|
|
96
|
-
},
|
|
97
|
-
Object {
|
|
98
|
-
"fontSize": 20,
|
|
99
|
-
"fontWeight": "500",
|
|
100
|
-
"lineHeight": 30,
|
|
101
|
-
},
|
|
102
|
-
undefined,
|
|
103
|
-
]
|
|
104
|
-
}
|
|
105
|
-
>
|
|
106
|
-
Heading level 4
|
|
107
|
-
</Text>
|
|
108
|
-
`;
|
|
109
|
-
|
|
110
|
-
exports[`Heading renders a level 5 Heading as expected 1`] = `
|
|
111
|
-
<Text
|
|
112
|
-
accessibilityRole="header"
|
|
113
|
-
style={
|
|
114
|
-
Array [
|
|
115
|
-
Object {
|
|
116
|
-
"color": "hsl(210, 50%, 10%)",
|
|
117
|
-
},
|
|
118
|
-
Object {
|
|
119
|
-
"fontSize": 16,
|
|
120
|
-
"fontWeight": "600",
|
|
121
|
-
"lineHeight": 24,
|
|
122
|
-
},
|
|
123
|
-
undefined,
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
>
|
|
127
|
-
Heading level 5
|
|
128
|
-
</Text>
|
|
129
|
-
`;
|
|
130
|
-
|
|
131
|
-
exports[`Heading renders a level 6 Heading as expected 1`] = `
|
|
132
|
-
<Text
|
|
133
|
-
accessibilityRole="header"
|
|
134
|
-
style={
|
|
135
|
-
Array [
|
|
136
|
-
Object {
|
|
137
|
-
"color": "hsl(210, 50%, 10%)",
|
|
138
|
-
},
|
|
139
|
-
Object {
|
|
140
|
-
"fontSize": 14,
|
|
141
|
-
"fontWeight": "700",
|
|
142
|
-
"lineHeight": 21,
|
|
143
|
-
},
|
|
144
|
-
undefined,
|
|
145
|
-
]
|
|
146
|
-
}
|
|
147
|
-
>
|
|
148
|
-
Heading level 6
|
|
149
|
-
</Text>
|
|
150
|
-
`;
|
|
151
|
-
|
|
152
|
-
exports[`Heading renders a level 6 Heading by default 1`] = `
|
|
153
|
-
<Text
|
|
154
|
-
accessibilityRole="header"
|
|
155
|
-
style={
|
|
156
|
-
Array [
|
|
157
|
-
Object {
|
|
158
|
-
"color": "hsl(210, 50%, 10%)",
|
|
159
|
-
},
|
|
160
|
-
Object {
|
|
161
|
-
"fontSize": 14,
|
|
162
|
-
"fontWeight": "700",
|
|
163
|
-
"lineHeight": 21,
|
|
164
|
-
},
|
|
165
|
-
undefined,
|
|
166
|
-
]
|
|
167
|
-
}
|
|
168
|
-
>
|
|
169
|
-
Test Heading
|
|
170
|
-
</Text>
|
|
171
|
-
`;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, renderHook } from '@testing-library/react-native';
|
|
3
|
-
import { ConsoleLogger as Logger } from '@aws-amplify/core';
|
|
4
|
-
|
|
5
|
-
import { useTheme } from '../../../theme';
|
|
6
|
-
import { getThemedStyles } from '../styles';
|
|
7
|
-
import Icon from '../Icon';
|
|
8
|
-
import { IconProps, iconSizes } from '..';
|
|
9
|
-
import { Size } from '../types';
|
|
10
|
-
|
|
11
|
-
// use empty mockImplementation to turn off console output
|
|
12
|
-
const warnSpy = jest.spyOn(Logger.prototype, 'warn').mockImplementation();
|
|
13
|
-
|
|
14
|
-
const MOCK_SOURCE = { uri: 'mock.png' };
|
|
15
|
-
const testID = 'iconTestID';
|
|
16
|
-
const props: IconProps = {
|
|
17
|
-
source: MOCK_SOURCE,
|
|
18
|
-
testID,
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
describe('Icon', () => {
|
|
22
|
-
it('renders as expected', () => {
|
|
23
|
-
const { toJSON, getByTestId } = render(<Icon {...props} />);
|
|
24
|
-
expect(toJSON()).toMatchSnapshot();
|
|
25
|
-
|
|
26
|
-
const { result } = renderHook(() => useTheme());
|
|
27
|
-
const themedStyle = getThemedStyles(result.current);
|
|
28
|
-
|
|
29
|
-
const image = getByTestId(testID);
|
|
30
|
-
expect(image.props.accessibilityRole).toEqual('image');
|
|
31
|
-
expect(image.props.source).toEqual(MOCK_SOURCE);
|
|
32
|
-
|
|
33
|
-
expect(themedStyle.icon.height).toEqual(iconSizes.medium);
|
|
34
|
-
expect(themedStyle.icon.width).toEqual(iconSizes.medium);
|
|
35
|
-
expect(image.props.style).toStrictEqual([themedStyle.icon, undefined]);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('renders as expected with custom styles', () => {
|
|
39
|
-
const customStyle = { tintColor: 'red' };
|
|
40
|
-
const { toJSON, getByTestId } = render(
|
|
41
|
-
<Icon {...props} style={customStyle} />
|
|
42
|
-
);
|
|
43
|
-
expect(toJSON()).toMatchSnapshot();
|
|
44
|
-
|
|
45
|
-
const { result } = renderHook(() => useTheme());
|
|
46
|
-
const themedStyle = getThemedStyles(result.current);
|
|
47
|
-
|
|
48
|
-
expect(getByTestId(testID).props.style).toStrictEqual([
|
|
49
|
-
themedStyle.icon,
|
|
50
|
-
customStyle,
|
|
51
|
-
]);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('renders an animated icon', () => {
|
|
55
|
-
const { toJSON } = render(<Icon {...props} animated />);
|
|
56
|
-
expect(toJSON()).toMatchSnapshot();
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('should override size as number', () => {
|
|
60
|
-
const testSize = 22;
|
|
61
|
-
const { toJSON, getByTestId } = render(<Icon {...props} size={testSize} />);
|
|
62
|
-
expect(toJSON()).toMatchSnapshot();
|
|
63
|
-
|
|
64
|
-
const { result } = renderHook(() => useTheme());
|
|
65
|
-
const themedStyle = getThemedStyles(result.current, undefined, testSize);
|
|
66
|
-
|
|
67
|
-
const image = getByTestId(testID);
|
|
68
|
-
expect(themedStyle.icon.height).toEqual(testSize);
|
|
69
|
-
expect(themedStyle.icon.width).toEqual(testSize);
|
|
70
|
-
expect(image.props.style).toStrictEqual([themedStyle.icon, undefined]);
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it('should override size as string', () => {
|
|
74
|
-
const testSize = 'large';
|
|
75
|
-
const { toJSON, getByTestId } = render(<Icon {...props} size={testSize} />);
|
|
76
|
-
expect(toJSON()).toMatchSnapshot();
|
|
77
|
-
|
|
78
|
-
const { result } = renderHook(() => useTheme());
|
|
79
|
-
const themedStyle = getThemedStyles(result.current, undefined, testSize);
|
|
80
|
-
|
|
81
|
-
const image = getByTestId(testID);
|
|
82
|
-
expect(themedStyle.icon.height).toEqual(iconSizes[testSize]);
|
|
83
|
-
expect(themedStyle.icon.width).toEqual(iconSizes[testSize]);
|
|
84
|
-
expect(image.props.style).toStrictEqual([themedStyle.icon, undefined]);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('throws an error for invalid size type', () => {
|
|
88
|
-
const invalidSize = 'small_medium' as unknown as Size;
|
|
89
|
-
|
|
90
|
-
const { toJSON } = render(<Icon {...props} size={invalidSize} />);
|
|
91
|
-
expect(toJSON()).toMatchSnapshot();
|
|
92
|
-
|
|
93
|
-
expect(warnSpy).toHaveBeenCalledTimes(1);
|
|
94
|
-
expect(warnSpy).toHaveBeenCalledWith(
|
|
95
|
-
`"${invalidSize}" is not a valid icon size. Available values are: ${Object.keys(
|
|
96
|
-
iconSizes
|
|
97
|
-
)}`
|
|
98
|
-
);
|
|
99
|
-
});
|
|
100
|
-
});
|