@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
|
@@ -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.Label = void 0;
|
|
7
|
+
var Label_1 = require("./Label");
|
|
8
|
+
Object.defineProperty(exports, "Label", { enumerable: true, get: function () { return __importDefault(Label_1).default; } });
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getThemedStyles = void 0;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
const getThemedStyles = (theme) => {
|
|
7
|
+
const { components, tokens: { colors, fontSizes, fontWeights }, } = theme;
|
|
8
|
+
return react_native_1.StyleSheet.create({
|
|
9
|
+
text: {
|
|
10
|
+
fontSize: fontSizes.medium,
|
|
11
|
+
fontWeight: fontWeights.normal,
|
|
12
|
+
lineHeight: (0, utils_1.getLineHeight)(fontSizes.medium),
|
|
13
|
+
...components?.label?.text,
|
|
14
|
+
},
|
|
15
|
+
primary: {
|
|
16
|
+
color: colors.font.primary,
|
|
17
|
+
...components?.label?.primary,
|
|
18
|
+
},
|
|
19
|
+
secondary: {
|
|
20
|
+
color: colors.font.secondary,
|
|
21
|
+
...components?.label?.secondary,
|
|
22
|
+
},
|
|
23
|
+
tertiary: {
|
|
24
|
+
color: colors.font.tertiary,
|
|
25
|
+
...components?.label?.tertiary,
|
|
26
|
+
},
|
|
27
|
+
error: {
|
|
28
|
+
color: colors.font.error,
|
|
29
|
+
...components?.label?.error,
|
|
30
|
+
},
|
|
31
|
+
warning: {
|
|
32
|
+
color: colors.font.warning,
|
|
33
|
+
...components?.label?.warning,
|
|
34
|
+
},
|
|
35
|
+
success: {
|
|
36
|
+
color: colors.font.success,
|
|
37
|
+
...components?.label?.success,
|
|
38
|
+
},
|
|
39
|
+
info: {
|
|
40
|
+
color: colors.font.info,
|
|
41
|
+
...components?.label?.info,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
exports.getThemedStyles = getThemedStyles;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFlexDirectionFromLabelPosition = void 0;
|
|
4
|
+
const FLEX_DIRECTIONS = {
|
|
5
|
+
start: 'row-reverse',
|
|
6
|
+
end: 'row',
|
|
7
|
+
top: 'column-reverse',
|
|
8
|
+
bottom: 'column',
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The `flexDirection` value returned from `getFlexDirectionFromLabelPosition`
|
|
12
|
+
* assumes a `Label` component follows the `Primary` component it labels inside
|
|
13
|
+
* the `Container` that the `flexDirection` is applied to.
|
|
14
|
+
*
|
|
15
|
+
* Example Usage:
|
|
16
|
+
* ```jsx
|
|
17
|
+
* const flexDirection = getFlexDirectionFromLabelPosition(labelPosition);
|
|
18
|
+
* <Container style={{ flexDirection }}>
|
|
19
|
+
* <Primary />
|
|
20
|
+
* <Label />
|
|
21
|
+
* </Container>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
const getFlexDirectionFromLabelPosition = (position) => FLEX_DIRECTIONS[position];
|
|
25
|
+
exports.getFlexDirectionFromLabelPosition = getFlexDirectionFromLabelPosition;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const assets_1 = require("../../assets");
|
|
6
|
+
const theme_1 = require("../../theme");
|
|
7
|
+
const IconButton_1 = require("../IconButton");
|
|
8
|
+
const TextField_1 = require("../TextField");
|
|
9
|
+
const styles_1 = require("./styles");
|
|
10
|
+
const ui_1 = require("@aws-amplify/ui");
|
|
11
|
+
const { getHidePasswordText, getShowPasswordText } = ui_1.authenticatorTextUtil;
|
|
12
|
+
function PasswordField({ disabled, iconAccessibilityLabel, iconStyle, secureTextEntry = true, showPasswordButton = true, style, ...rest }) {
|
|
13
|
+
const theme = (0, theme_1.useTheme)();
|
|
14
|
+
const themedStyle = (0, styles_1.getThemedStyles)(theme);
|
|
15
|
+
const [obscureText, setObscureText] = (0, react_1.useState)(secureTextEntry);
|
|
16
|
+
const handleOnPress = react_1.default.useCallback(() => {
|
|
17
|
+
setObscureText(!obscureText);
|
|
18
|
+
}, [obscureText]);
|
|
19
|
+
const toggleVisibilityAccessibilityLabel = iconAccessibilityLabel ?? obscureText
|
|
20
|
+
? getShowPasswordText()
|
|
21
|
+
: getHidePasswordText();
|
|
22
|
+
return (<TextField_1.TextField {...rest} disabled={disabled} secureTextEntry={obscureText} style={[themedStyle.container, style]} endAccessory={showPasswordButton ? (<IconButton_1.IconButton accessibilityLabel={toggleVisibilityAccessibilityLabel} disabled={disabled} iconStyle={[themedStyle.icon, iconStyle]} size={16} source={obscureText ? assets_1.icons.visibilityOff : assets_1.icons.visibilityOn} onPress={handleOnPress}/>) : null}/>);
|
|
23
|
+
}
|
|
24
|
+
exports.default = PasswordField;
|
|
@@ -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.PasswordField = void 0;
|
|
7
|
+
var PasswordField_1 = require("./PasswordField");
|
|
8
|
+
Object.defineProperty(exports, "PasswordField", { enumerable: true, get: function () { return __importDefault(PasswordField_1).default; } });
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getThemedStyles = void 0;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
const getThemedStyles = ({ components, tokens: { colors }, }) => {
|
|
6
|
+
return react_native_1.StyleSheet.create({
|
|
7
|
+
container: {
|
|
8
|
+
...components?.passwordField?.container,
|
|
9
|
+
},
|
|
10
|
+
icon: {
|
|
11
|
+
// match to `TextField` placeholder color
|
|
12
|
+
tintColor: colors.font.tertiary,
|
|
13
|
+
...components?.passwordField?.icon,
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
exports.getThemedStyles = getThemedStyles;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
+
const theme_1 = require("../../theme");
|
|
6
|
+
const styles_1 = require("./styles");
|
|
7
|
+
const TextField_1 = require("../TextField");
|
|
8
|
+
function PhoneNumberField({ disabled, fieldStyle, labelStyle, style, ...rest }) {
|
|
9
|
+
const theme = (0, theme_1.useTheme)();
|
|
10
|
+
const themedStyle = (0, styles_1.getThemedStyles)(theme);
|
|
11
|
+
return (<TextField_1.TextField {...rest} disabled={disabled} fieldStyle={[themedStyle.field, fieldStyle]} keyboardType="phone-pad" labelStyle={[themedStyle.label, labelStyle]} style={[themedStyle.container, style]}/>);
|
|
12
|
+
}
|
|
13
|
+
exports.default = PhoneNumberField;
|
|
@@ -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.PhoneNumberField = void 0;
|
|
7
|
+
var PhoneNumberField_1 = require("./PhoneNumberField");
|
|
8
|
+
Object.defineProperty(exports, "PhoneNumberField", { enumerable: true, get: function () { return __importDefault(PhoneNumberField_1).default; } });
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getThemedStyles = void 0;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
const getThemedStyles = (theme) => {
|
|
6
|
+
const { components } = theme;
|
|
7
|
+
return react_native_1.StyleSheet.create({
|
|
8
|
+
container: {
|
|
9
|
+
...components?.phoneNumberField?.container,
|
|
10
|
+
},
|
|
11
|
+
fieldContainer: {
|
|
12
|
+
...components?.phoneNumberField?.fieldContainer,
|
|
13
|
+
},
|
|
14
|
+
field: {
|
|
15
|
+
...components?.phoneNumberField?.field,
|
|
16
|
+
},
|
|
17
|
+
label: {
|
|
18
|
+
...components?.phoneNumberField?.label,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
exports.getThemedStyles = getThemedStyles;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DOT_TEST_ID = exports.CONTAINER_TEST_ID = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const react_native_1 = require("react-native");
|
|
7
|
+
const theme_1 = require("../../theme");
|
|
8
|
+
const Label_1 = require("../Label");
|
|
9
|
+
const utils_1 = require("../Label/utils");
|
|
10
|
+
const hooks_1 = require("../../hooks");
|
|
11
|
+
const styles_1 = require("./styles");
|
|
12
|
+
const getRadioDimensions_1 = require("./getRadioDimensions");
|
|
13
|
+
exports.CONTAINER_TEST_ID = 'amplify__radio-button__container';
|
|
14
|
+
exports.DOT_TEST_ID = 'amplify__radio-button__dot';
|
|
15
|
+
function Radio({ accessibilityRole = 'radio', disabled, label, labelPosition = 'end', labelStyle, onChange, onPress, radioContainerStyle, radioDotStyle, selected, size = 'medium', style, value, ...rest }) {
|
|
16
|
+
const theme = (0, theme_1.useTheme)();
|
|
17
|
+
const themedStyle = (0, styles_1.getThemedStyles)(theme);
|
|
18
|
+
const handleOnChange = (0, react_1.useCallback)((event) => {
|
|
19
|
+
if (!disabled) {
|
|
20
|
+
onChange?.(value);
|
|
21
|
+
onPress?.(event);
|
|
22
|
+
}
|
|
23
|
+
}, [disabled, onChange, onPress, value]);
|
|
24
|
+
const containerStyle = (0, react_1.useMemo)(() => ({
|
|
25
|
+
...themedStyle.container,
|
|
26
|
+
flexDirection: (0, utils_1.getFlexDirectionFromLabelPosition)(labelPosition),
|
|
27
|
+
...(disabled && themedStyle.disabled),
|
|
28
|
+
}), [disabled, labelPosition, themedStyle]);
|
|
29
|
+
const pressableStyle = (0, hooks_1.usePressableContainerStyles)({
|
|
30
|
+
overrideStyle: style,
|
|
31
|
+
containerStyle,
|
|
32
|
+
pressedStyle: themedStyle.pressed,
|
|
33
|
+
});
|
|
34
|
+
const { radioContainerDimensions, radioDotDimensions } = (0, react_1.useMemo)(() => (0, getRadioDimensions_1.getRadioDimensions)(size, themedStyle), [size, themedStyle]);
|
|
35
|
+
return (<react_native_1.Pressable {...rest} accessibilityRole={accessibilityRole} onPress={handleOnChange} style={pressableStyle}>
|
|
36
|
+
<react_native_1.View style={[
|
|
37
|
+
themedStyle.radioContainer,
|
|
38
|
+
radioContainerDimensions,
|
|
39
|
+
radioContainerStyle,
|
|
40
|
+
]} testID={exports.CONTAINER_TEST_ID}>
|
|
41
|
+
{selected ? (<react_native_1.View style={[themedStyle.radioDot, radioDotDimensions, radioDotStyle]} testID={exports.DOT_TEST_ID}/>) : null}
|
|
42
|
+
</react_native_1.View>
|
|
43
|
+
{label ? <Label_1.Label style={labelStyle}>{label}</Label_1.Label> : null}
|
|
44
|
+
</react_native_1.Pressable>);
|
|
45
|
+
}
|
|
46
|
+
exports.default = Radio;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRadioDimensions = exports.RADIO_DOT_PROPORTION = void 0;
|
|
4
|
+
const ui_1 = require("@aws-amplify/ui");
|
|
5
|
+
/**
|
|
6
|
+
* These utility functions are used to apply styles to
|
|
7
|
+
* the two nested View's comprising the Radio:
|
|
8
|
+
* - The outer <View> is named 'radioContainer'
|
|
9
|
+
* - The inner <View> is named 'radioDot'
|
|
10
|
+
*
|
|
11
|
+
* If a customer passes a number to the `size` prop, then we simply calculate the dimensions
|
|
12
|
+
* for both the 'radioContainer' and 'radioDot' based on that number.
|
|
13
|
+
*
|
|
14
|
+
* If a customer passes a string ('small' | 'medium' | 'large') to the `size` prop,
|
|
15
|
+
* then we return the respective dimensions as defined in the `styles` object
|
|
16
|
+
* (e.g., 'small' => { radioContainerSmall, radioDotSmall } )
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* We landed on this value for the ratio of the Radio dot to the Radio container
|
|
20
|
+
* because it looks aesthetically proportional. Incidentally, this value is also
|
|
21
|
+
* an approximation of the golden ratio conjugate.
|
|
22
|
+
*/
|
|
23
|
+
exports.RADIO_DOT_PROPORTION = 0.6;
|
|
24
|
+
const getRadioDimensions = (size, styles) => {
|
|
25
|
+
if (typeof size === 'number') {
|
|
26
|
+
return {
|
|
27
|
+
radioContainerDimensions: {
|
|
28
|
+
height: size,
|
|
29
|
+
width: size,
|
|
30
|
+
},
|
|
31
|
+
radioDotDimensions: {
|
|
32
|
+
height: size * exports.RADIO_DOT_PROPORTION,
|
|
33
|
+
width: size * exports.RADIO_DOT_PROPORTION,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const sizeKey = (0, ui_1.capitalize)(size);
|
|
38
|
+
return {
|
|
39
|
+
radioContainerDimensions: styles[`radioContainer${sizeKey}`],
|
|
40
|
+
radioDotDimensions: styles[`radioDot${sizeKey}`],
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
exports.getRadioDimensions = getRadioDimensions;
|
|
@@ -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.Radio = void 0;
|
|
7
|
+
var Radio_1 = require("./Radio");
|
|
8
|
+
Object.defineProperty(exports, "Radio", { enumerable: true, get: function () { return __importDefault(Radio_1).default; } });
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getThemedStyles = void 0;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
const getRadioDimensions_1 = require("./getRadioDimensions");
|
|
6
|
+
const ROUNDED_BORDER_RADIUS = 999;
|
|
7
|
+
const getThemedStyles = (theme) => {
|
|
8
|
+
const { components, tokens: { colors, fontSizes, opacities, borderWidths, space }, } = theme;
|
|
9
|
+
return react_native_1.StyleSheet.create({
|
|
10
|
+
container: {
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
...components?.radio?.container,
|
|
13
|
+
},
|
|
14
|
+
disabled: {
|
|
15
|
+
opacity: opacities[60],
|
|
16
|
+
...components?.radio?.disabled,
|
|
17
|
+
},
|
|
18
|
+
pressed: {
|
|
19
|
+
opacity: opacities[60],
|
|
20
|
+
...components?.radio?.pressed,
|
|
21
|
+
},
|
|
22
|
+
radioContainer: {
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
borderColor: colors.border.primary,
|
|
25
|
+
borderRadius: ROUNDED_BORDER_RADIUS,
|
|
26
|
+
borderWidth: borderWidths.medium,
|
|
27
|
+
justifyContent: 'center',
|
|
28
|
+
margin: space.xxs,
|
|
29
|
+
...components?.radio?.radioContainer,
|
|
30
|
+
},
|
|
31
|
+
radioDot: {
|
|
32
|
+
backgroundColor: colors.brand.primary[80],
|
|
33
|
+
borderRadius: ROUNDED_BORDER_RADIUS,
|
|
34
|
+
...components?.radio?.radioDot,
|
|
35
|
+
},
|
|
36
|
+
radioContainerLarge: {
|
|
37
|
+
height: fontSizes.xl,
|
|
38
|
+
width: fontSizes.xl,
|
|
39
|
+
...components?.radio?.radioContainerLarge,
|
|
40
|
+
},
|
|
41
|
+
radioContainerMedium: {
|
|
42
|
+
height: fontSizes.large,
|
|
43
|
+
width: fontSizes.large,
|
|
44
|
+
...components?.radio?.radioContainerMedium,
|
|
45
|
+
},
|
|
46
|
+
radioContainerSmall: {
|
|
47
|
+
height: fontSizes.medium,
|
|
48
|
+
width: fontSizes.medium,
|
|
49
|
+
...components?.radio?.radioContainerSmall,
|
|
50
|
+
},
|
|
51
|
+
radioDotLarge: {
|
|
52
|
+
height: fontSizes.xl * getRadioDimensions_1.RADIO_DOT_PROPORTION,
|
|
53
|
+
width: fontSizes.xl * getRadioDimensions_1.RADIO_DOT_PROPORTION,
|
|
54
|
+
...components?.radio?.radioDotLarge,
|
|
55
|
+
},
|
|
56
|
+
radioDotMedium: {
|
|
57
|
+
height: fontSizes.large * getRadioDimensions_1.RADIO_DOT_PROPORTION,
|
|
58
|
+
width: fontSizes.large * getRadioDimensions_1.RADIO_DOT_PROPORTION,
|
|
59
|
+
...components?.radio?.radioDotMedium,
|
|
60
|
+
},
|
|
61
|
+
radioDotSmall: {
|
|
62
|
+
height: fontSizes.medium * getRadioDimensions_1.RADIO_DOT_PROPORTION,
|
|
63
|
+
width: fontSizes.medium * getRadioDimensions_1.RADIO_DOT_PROPORTION,
|
|
64
|
+
...components?.radio?.radioDotSmall,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
exports.getThemedStyles = getThemedStyles;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const ui_react_core_1 = require("@aws-amplify/ui-react-core");
|
|
7
|
+
const theme_1 = require("../../theme");
|
|
8
|
+
const Label_1 = require("../Label");
|
|
9
|
+
const utils_1 = require("../Label/utils");
|
|
10
|
+
const styles_1 = require("./styles");
|
|
11
|
+
function RadioGroup({ accessibilityRole = 'radiogroup', children, direction = 'vertical', disabled, initialValue, label, labelPosition = 'top', labelStyle, onChange, onValueChange, size, style, ...rest }) {
|
|
12
|
+
const theme = (0, theme_1.useTheme)();
|
|
13
|
+
const themedStyle = (0, styles_1.getThemedStyles)(theme);
|
|
14
|
+
const [value, setValue] = (0, react_1.useState)(initialValue);
|
|
15
|
+
// track `hasValueUpdated` and `hasOnValueChangeUpdated`,
|
|
16
|
+
// only call `onValueChange` on `value` update
|
|
17
|
+
const hasValueUpdated = (0, ui_react_core_1.useHasValueUpdated)(value);
|
|
18
|
+
const hasOnValueChangeUpdated = (0, ui_react_core_1.useHasValueUpdated)(onValueChange);
|
|
19
|
+
(0, react_1.useEffect)(() => {
|
|
20
|
+
if (hasValueUpdated) {
|
|
21
|
+
onValueChange?.(value);
|
|
22
|
+
}
|
|
23
|
+
}, [hasOnValueChangeUpdated, hasValueUpdated, onValueChange, value]);
|
|
24
|
+
const containerStyle = (0, react_1.useMemo)(() => ({
|
|
25
|
+
flexDirection: (0, utils_1.getFlexDirectionFromLabelPosition)(labelPosition),
|
|
26
|
+
}), [labelPosition]);
|
|
27
|
+
const childContainerStyle = (0, react_1.useMemo)(() => ({ flexDirection: direction === 'horizontal' ? 'row' : 'column' }), [direction]);
|
|
28
|
+
const handleChange = (0, react_1.useCallback)((nextValue) => {
|
|
29
|
+
setValue(nextValue);
|
|
30
|
+
onChange?.(nextValue);
|
|
31
|
+
}, [onChange]);
|
|
32
|
+
return (<react_native_1.View {...rest} style={[themedStyle.container, containerStyle, style]}>
|
|
33
|
+
<react_native_1.View accessibilityRole={accessibilityRole} style={childContainerStyle}>
|
|
34
|
+
{react_1.Children.map(children, (child) => {
|
|
35
|
+
if ((0, react_1.isValidElement)(child)) {
|
|
36
|
+
const { disabled: childDisabled, onChange: childOnChange, value: childValue, size: childSize, } = child.props;
|
|
37
|
+
const isChildDisabled = typeof childDisabled === 'boolean' ? childDisabled : disabled;
|
|
38
|
+
const isChildSelected = childValue === value;
|
|
39
|
+
return (0, react_1.cloneElement)(child, {
|
|
40
|
+
...child.props,
|
|
41
|
+
disabled: isChildDisabled,
|
|
42
|
+
onChange: (nextValue) => {
|
|
43
|
+
childOnChange?.(nextValue);
|
|
44
|
+
handleChange(nextValue);
|
|
45
|
+
},
|
|
46
|
+
selected: isChildSelected,
|
|
47
|
+
size: childSize ?? size,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
})}
|
|
51
|
+
</react_native_1.View>
|
|
52
|
+
{label ? (<Label_1.Label style={[themedStyle.label, labelStyle]}>{label}</Label_1.Label>) : null}
|
|
53
|
+
</react_native_1.View>);
|
|
54
|
+
}
|
|
55
|
+
exports.default = RadioGroup;
|
|
@@ -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.RadioGroup = void 0;
|
|
7
|
+
var RadioGroup_1 = require("./RadioGroup");
|
|
8
|
+
Object.defineProperty(exports, "RadioGroup", { enumerable: true, get: function () { return __importDefault(RadioGroup_1).default; } });
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getThemedStyles = void 0;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
const getThemedStyles = (theme) => {
|
|
6
|
+
const { components } = theme;
|
|
7
|
+
return react_native_1.StyleSheet.create({
|
|
8
|
+
container: {
|
|
9
|
+
...components?.radioGroup?.container,
|
|
10
|
+
},
|
|
11
|
+
label: {
|
|
12
|
+
/**
|
|
13
|
+
* The RadioGroup label inherits its styles from the Label primitive,
|
|
14
|
+
* and also supports customization via a Theme.
|
|
15
|
+
*/
|
|
16
|
+
...components?.radioGroup?.label,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
exports.getThemedStyles = getThemedStyles;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const theme_1 = require("../../theme");
|
|
6
|
+
const hooks_1 = require("../../hooks");
|
|
7
|
+
const Button_1 = require("../Button");
|
|
8
|
+
const styles_1 = require("./styles");
|
|
9
|
+
function Tab({ children, selected, style, textStyle, indicatorPosition, ...rest }) {
|
|
10
|
+
const theme = (0, theme_1.useTheme)();
|
|
11
|
+
const themedStyle = (0, styles_1.getThemedStyles)(theme, indicatorPosition);
|
|
12
|
+
const selectedStyles = selected ? themedStyle.selected : null;
|
|
13
|
+
const containerStyle = (0, react_1.useMemo)(() => ({
|
|
14
|
+
...themedStyle.tab,
|
|
15
|
+
...(selected && themedStyle.readonly),
|
|
16
|
+
...selectedStyles,
|
|
17
|
+
}), [selected, selectedStyles, themedStyle]);
|
|
18
|
+
const pressableStyle = (0, hooks_1.usePressableContainerStyles)({
|
|
19
|
+
overrideStyle: style,
|
|
20
|
+
containerStyle,
|
|
21
|
+
pressedStyle: themedStyle.pressed,
|
|
22
|
+
});
|
|
23
|
+
return (<Button_1.Button {...rest} accessibilityRole="tab" style={pressableStyle} textStyle={[themedStyle.tabText, textStyle, selectedStyles]}>
|
|
24
|
+
{children}
|
|
25
|
+
</Button_1.Button>);
|
|
26
|
+
}
|
|
27
|
+
exports.default = Tab;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const theme_1 = require("../../theme");
|
|
7
|
+
const styles_1 = require("./styles");
|
|
8
|
+
function Tabs({ children, indicatorPosition = 'bottom', onChange, selectedIndex = 0, style, ...rest }) {
|
|
9
|
+
const theme = (0, theme_1.useTheme)();
|
|
10
|
+
const themedStyle = (0, styles_1.getThemedStyles)(theme, indicatorPosition);
|
|
11
|
+
const handleOnChange = (nextIndex) => {
|
|
12
|
+
onChange?.(nextIndex);
|
|
13
|
+
};
|
|
14
|
+
return (<react_native_1.View {...rest} accessibilityRole="tablist" style={[themedStyle.tabList, style]}>
|
|
15
|
+
{react_1.Children.map(children, (child, index) => {
|
|
16
|
+
if ((0, react_1.isValidElement)(child)) {
|
|
17
|
+
return (0, react_1.cloneElement)(child, {
|
|
18
|
+
onPress: (event) => {
|
|
19
|
+
child.props.onPress?.(event);
|
|
20
|
+
handleOnChange(index);
|
|
21
|
+
},
|
|
22
|
+
indicatorPosition,
|
|
23
|
+
selected: index === selectedIndex,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
})}
|
|
27
|
+
</react_native_1.View>);
|
|
28
|
+
}
|
|
29
|
+
exports.default = Tabs;
|
|
@@ -0,0 +1,10 @@
|
|
|
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.Tabs = exports.Tab = void 0;
|
|
7
|
+
var Tab_1 = require("./Tab");
|
|
8
|
+
Object.defineProperty(exports, "Tab", { enumerable: true, get: function () { return __importDefault(Tab_1).default; } });
|
|
9
|
+
var Tabs_1 = require("./Tabs");
|
|
10
|
+
Object.defineProperty(exports, "Tabs", { enumerable: true, get: function () { return __importDefault(Tabs_1).default; } });
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getThemedStyles = void 0;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
const getThemedStyles = (theme, indicatorPosition) => {
|
|
6
|
+
const { components, tokens: { colors, fontSizes, fontWeights, opacities, space, borderWidths }, } = theme;
|
|
7
|
+
const selectedTabBorderStyles = {};
|
|
8
|
+
const tabBorderStyles = {};
|
|
9
|
+
if (indicatorPosition && indicatorPosition === 'top') {
|
|
10
|
+
selectedTabBorderStyles.borderTopColor = colors.brand.primary[80];
|
|
11
|
+
tabBorderStyles.borderTopWidth = borderWidths.medium;
|
|
12
|
+
tabBorderStyles.borderTopColor = colors.border.secondary;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
selectedTabBorderStyles.borderBottomColor = colors.brand.primary[80];
|
|
16
|
+
tabBorderStyles.borderBottomWidth = borderWidths.medium;
|
|
17
|
+
tabBorderStyles.borderBottomColor = colors.border.secondary;
|
|
18
|
+
}
|
|
19
|
+
return react_native_1.StyleSheet.create({
|
|
20
|
+
readonly: {
|
|
21
|
+
opacity: opacities[100],
|
|
22
|
+
...components?.tabs?.readonly,
|
|
23
|
+
},
|
|
24
|
+
pressed: {
|
|
25
|
+
opacity: opacities[60],
|
|
26
|
+
...components?.tabs?.pressed,
|
|
27
|
+
},
|
|
28
|
+
tabList: {
|
|
29
|
+
flexDirection: 'row',
|
|
30
|
+
width: '100%',
|
|
31
|
+
...components?.tabs?.tabList,
|
|
32
|
+
},
|
|
33
|
+
tab: {
|
|
34
|
+
backgroundColor: colors.transparent,
|
|
35
|
+
borderRadius: 0,
|
|
36
|
+
flexBasis: 0,
|
|
37
|
+
flexGrow: 1,
|
|
38
|
+
paddingVertical: space.small,
|
|
39
|
+
paddingHorizontal: space.medium,
|
|
40
|
+
borderWidth: 0,
|
|
41
|
+
...tabBorderStyles,
|
|
42
|
+
...components?.tabs?.tab,
|
|
43
|
+
},
|
|
44
|
+
tabText: {
|
|
45
|
+
color: colors.font.secondary,
|
|
46
|
+
fontSize: fontSizes.medium,
|
|
47
|
+
fontWeight: fontWeights.bold,
|
|
48
|
+
...components?.tabs?.tabText,
|
|
49
|
+
},
|
|
50
|
+
selected: {
|
|
51
|
+
backgroundColor: colors.background.primary,
|
|
52
|
+
color: colors.brand.primary[80],
|
|
53
|
+
...selectedTabBorderStyles,
|
|
54
|
+
...components?.tabs?.selected,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
exports.getThemedStyles = getThemedStyles;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.INPUT_CONTAINER_TEST_ID = exports.TEXTFIELD_CONTAINER_TEST_ID = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const react_native_1 = require("react-native");
|
|
7
|
+
const Label_1 = require("../Label");
|
|
8
|
+
const theme_1 = require("../../theme");
|
|
9
|
+
const styles_1 = require("./styles");
|
|
10
|
+
exports.TEXTFIELD_CONTAINER_TEST_ID = 'amplify__text-field-container';
|
|
11
|
+
exports.INPUT_CONTAINER_TEST_ID = 'amplify__text-field__input-container';
|
|
12
|
+
function TextField({ accessibilityLabel, accessibilityRole, accessibilityState, accessible = true, autoCapitalize = 'none', disabled, endAccessory, error, errorMessage, errorMessageStyle, fieldStyle, label, labelStyle, style, ...rest }) {
|
|
13
|
+
const theme = (0, theme_1.useTheme)();
|
|
14
|
+
const themedStyle = (0, react_1.useMemo)(() => (0, styles_1.getThemedStyles)(theme), [theme]);
|
|
15
|
+
const fieldContainerStyle = (0, react_1.useMemo)(() => ({
|
|
16
|
+
...themedStyle.fieldContainer,
|
|
17
|
+
...(disabled && themedStyle.disabled),
|
|
18
|
+
...(error && themedStyle.error),
|
|
19
|
+
}), [disabled, error, themedStyle]);
|
|
20
|
+
return (<react_native_1.View testID={exports.TEXTFIELD_CONTAINER_TEST_ID} style={[themedStyle.container, style]}>
|
|
21
|
+
{label ? (<Label_1.Label accessibilityLabel={label} style={[themedStyle.label, labelStyle]}>
|
|
22
|
+
{label}
|
|
23
|
+
</Label_1.Label>) : null}
|
|
24
|
+
<react_native_1.View accessible style={fieldContainerStyle} testID={exports.INPUT_CONTAINER_TEST_ID}>
|
|
25
|
+
<react_native_1.TextInput {...rest} accessible={accessible} accessibilityLabel={label ? undefined : accessibilityLabel} accessibilityRole={accessibilityRole} accessibilityState={{ disabled, ...accessibilityState }} autoCapitalize={autoCapitalize} editable={!disabled} placeholderTextColor={theme.tokens.colors.font.tertiary} style={[themedStyle.field, fieldStyle]}/>
|
|
26
|
+
{endAccessory ?? null}
|
|
27
|
+
</react_native_1.View>
|
|
28
|
+
{error && errorMessage ? (<Label_1.Label style={errorMessageStyle}>{errorMessage}</Label_1.Label>) : null}
|
|
29
|
+
</react_native_1.View>);
|
|
30
|
+
}
|
|
31
|
+
exports.default = TextField;
|
|
@@ -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.TextField = void 0;
|
|
7
|
+
var TextField_1 = require("./TextField");
|
|
8
|
+
Object.defineProperty(exports, "TextField", { enumerable: true, get: function () { return __importDefault(TextField_1).default; } });
|