@jobber/components-native 0.84.4-match-mobi-55ef4ec.7 → 0.84.4-match-mobi-540af48.10
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/package.json +26 -15
- package/dist/src/ActionItem/ActionItemGroup.js +1 -1
- package/dist/src/AutoLink/components/Link/Link.js +1 -1
- package/dist/src/Banner/Banner.js +2 -0
- package/dist/src/Banner/components/BannerIcon/BannerIcon.style.js +3 -0
- package/dist/src/BottomSheet/BottomSheet.js +58 -32
- package/dist/src/BottomSheet/BottomSheet.style.js +8 -9
- package/dist/src/BottomSheet/hooks/useBottomSheetBackHandler.js +26 -0
- package/dist/src/Button/components/InternalButtonLoading/InternalButtonLoading.js +0 -1
- package/dist/src/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/src/Chip/Chip.js +12 -1
- package/dist/src/Chip/Chip.style.js +1 -1
- package/dist/src/Content/ContentHorizontal.style.js +15 -0
- package/dist/src/Content/ContentSpaceAround.style.js +15 -0
- package/dist/src/Content/ContentVertical.style.js +15 -0
- package/dist/src/ContentOverlay/ContentOverlay.js +5 -7
- package/dist/src/ContentOverlay/UNSAFE_WrappedModalize.js +23 -0
- package/dist/src/ErrorMessageWrapper/context/ErrorMessageProvider.js +1 -1
- package/dist/src/Form/Form.js +5 -2
- package/dist/src/Form/components/FormCache/FormCache.js +1 -0
- package/dist/src/Form/components/FormMessageBanner/FormMessageBanner.js +1 -1
- package/dist/src/Form/context/AtlantisFormContext.js +1 -0
- package/dist/src/Form/hooks/useInternalForm.js +6 -3
- package/dist/src/FormatFile/components/MediaView/MediaView.js +22 -5
- package/dist/src/FormatFile/utils/createUseCreateThumbnail.js +1 -1
- package/dist/src/InputCurrency/InputCurrency.js +42 -30
- package/dist/src/InputDate/InputDate.js +2 -2
- package/dist/src/InputEmail/InputEmail.js +12 -4
- package/dist/src/InputFieldWrapper/InputFieldWrapper.js +14 -12
- package/dist/src/InputFieldWrapper/InputFieldWrapper.style.js +1 -1
- package/dist/src/InputFieldWrapper/components/Prefix/Prefix.js +5 -2
- package/dist/src/InputFieldWrapper/components/Suffix/Suffix.js +5 -2
- package/dist/src/InputNumber/InputNumber.js +10 -4
- package/dist/src/InputPressable/InputPressable.js +20 -8
- package/dist/src/InputPressable/InputPressable.style.js +3 -0
- package/dist/src/InputSearch/InputSearch.js +1 -1
- package/dist/src/InputText/InputText.js +24 -13
- package/dist/src/InputText/InputText.style.js +4 -0
- package/dist/src/InputTime/InputTime.js +2 -2
- package/dist/src/Menu/Menu.js +2 -2
- package/dist/src/ProgressBar/ProgressBar.js +10 -6
- package/dist/src/ProgressBar/ProgressBarInner.js +3 -12
- package/dist/src/ProgressBar/ProgressBarStepped.js +7 -2
- package/dist/src/Select/Select.style.js +1 -0
- package/dist/src/Select/components/SelectPressable/SelectPressable.js +1 -1
- package/dist/src/StatusLabel/StatusLabel.style.js +2 -2
- package/dist/src/Switch/components/BaseSwitch/BaseSwitch.js +7 -1
- package/dist/src/Typography/Typography.js +16 -5
- package/dist/src/hooks/useAtlantisI18n/locales/en.json +1 -0
- package/dist/src/hooks/useAtlantisI18n/locales/es.json +1 -0
- package/dist/src/hooks/useFormController.js +6 -15
- package/dist/tsconfig.build.json +7 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/tsconfig.json +4 -6
- package/dist/types/src/ActionItem/ActionItem.d.ts +2 -1
- package/dist/types/src/ActionItem/ActionItemGroup.d.ts +2 -1
- package/dist/types/src/ActionItem/components/ActionItemContainer.d.ts +2 -1
- package/dist/types/src/ActionLabel/ActionLabel.d.ts +4 -3
- package/dist/types/src/ActivityIndicator/ActivityIndicator.d.ts +2 -1
- package/dist/types/src/AutoLink/AutoLink.d.ts +2 -1
- package/dist/types/src/AutoLink/components/ComposeTextWithLinks/ComposeTextWithLinks.d.ts +2 -1
- package/dist/types/src/AutoLink/components/Link/Link.d.ts +2 -1
- package/dist/types/src/Banner/Banner.d.ts +2 -1
- package/dist/types/src/Banner/components/BannerIcon/BannerIcon.d.ts +2 -1
- package/dist/types/src/Banner/components/BannerIcon/BannerIcon.style.d.ts +3 -0
- package/dist/types/src/Banner/types.d.ts +1 -1
- package/dist/types/src/BottomSheet/BottomSheet.d.ts +7 -3
- package/dist/types/src/BottomSheet/BottomSheet.style.d.ts +7 -14
- package/dist/types/src/BottomSheet/components/BottomSheetOption/BottomSheetOption.d.ts +2 -1
- package/dist/types/src/BottomSheet/hooks/useBottomSheetBackHandler.d.ts +8 -0
- package/dist/types/src/Button/Button.d.ts +2 -1
- package/dist/types/src/Button/components/InternalButtonLoading/InternalButtonLoading.d.ts +1 -1
- package/dist/types/src/ButtonGroup/ButtonGroup.d.ts +2 -1
- package/dist/types/src/ButtonGroup/ButtonGroupAction.d.ts +4 -3
- package/dist/types/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.d.ts +3 -2
- package/dist/types/src/Card/Card.d.ts +2 -1
- package/dist/types/src/Card/components/InternalCardHeader.d.ts +2 -1
- package/dist/types/src/Checkbox/Checkbox.d.ts +2 -1
- package/dist/types/src/Checkbox/CheckboxGroup.d.ts +2 -1
- package/dist/types/src/Chip/Chip.d.ts +2 -1
- package/dist/types/src/Content/Content.d.ts +3 -2
- package/dist/types/src/Content/ContentHorizontal.style.d.ts +15 -0
- package/dist/types/src/Content/ContentSpaceAround.style.d.ts +15 -0
- package/dist/types/src/Content/ContentVertical.style.d.ts +15 -0
- package/dist/types/src/ContentOverlay/ContentOverlay.d.ts +1 -1
- package/dist/types/src/ContentOverlay/UNSAFE_WrappedModalize.d.ts +3 -0
- package/dist/types/src/Disclosure/Disclosure.d.ts +1 -1
- package/dist/types/src/Divider/Divider.d.ts +2 -1
- package/dist/types/src/EmptyState/EmptyState.d.ts +2 -1
- package/dist/types/src/ErrorMessageWrapper/ErrorMessageWrapper.d.ts +2 -1
- package/dist/types/src/ErrorMessageWrapper/context/ErrorMessageProvider.d.ts +2 -1
- package/dist/types/src/ErrorMessageWrapper/context/types.d.ts +1 -1
- package/dist/types/src/Flex/Flex.d.ts +2 -1
- package/dist/types/src/Form/Form.d.ts +2 -1
- package/dist/types/src/Form/components/FormActionBar/FormActionBar.d.ts +3 -2
- package/dist/types/src/Form/components/FormBody/FormBody.d.ts +3 -2
- package/dist/types/src/Form/components/FormCache/FormCache.d.ts +4 -3
- package/dist/types/src/Form/components/FormErrorBanner/FormErrorBanner.d.ts +2 -1
- package/dist/types/src/Form/components/FormMask/FormMask.d.ts +2 -1
- package/dist/types/src/Form/components/FormMessage/FormMessage.d.ts +2 -1
- package/dist/types/src/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.d.ts +2 -1
- package/dist/types/src/Form/components/FormMessageBanner/FormMessageBanner.d.ts +2 -1
- package/dist/types/src/Form/components/FormSaveButton/FormSaveButton.d.ts +2 -1
- package/dist/types/src/Form/context/AtlantisFormContext.d.ts +2 -1
- package/dist/types/src/Form/context/types.d.ts +5 -4
- package/dist/types/src/Form/hooks/useFormViewRefs.d.ts +2 -2
- package/dist/types/src/Form/hooks/useInternalForm.d.ts +7 -7
- package/dist/types/src/Form/types.d.ts +13 -7
- package/dist/types/src/FormField/FormField.d.ts +1 -1
- package/dist/types/src/FormatFile/FormatFile.d.ts +2 -1
- package/dist/types/src/FormatFile/components/ErrorIcon/ErrorIcon.d.ts +2 -1
- package/dist/types/src/FormatFile/components/FileView/FileView.d.ts +2 -1
- package/dist/types/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.d.ts +3 -2
- package/dist/types/src/FormatFile/components/MediaView/MediaView.d.ts +2 -1
- package/dist/types/src/FormatFile/components/ProgressBar/ProgressBar.d.ts +2 -1
- package/dist/types/src/Heading/Heading.d.ts +4 -3
- package/dist/types/src/Icon/Icon.d.ts +2 -1
- package/dist/types/src/IconButton/IconButton.d.ts +1 -1
- package/dist/types/src/InputCurrency/InputCurrency.d.ts +2 -1
- package/dist/types/src/InputDate/InputDate.d.ts +4 -2
- package/dist/types/src/InputFieldWrapper/InputFieldWrapper.d.ts +9 -2
- package/dist/types/src/InputFieldWrapper/InputFieldWrapper.style.d.ts +1 -1
- package/dist/types/src/InputFieldWrapper/components/ClearAction/ClearAction.d.ts +2 -1
- package/dist/types/src/InputFieldWrapper/components/Prefix/Prefix.d.ts +4 -4
- package/dist/types/src/InputFieldWrapper/components/Suffix/Suffix.d.ts +4 -4
- package/dist/types/src/InputPressable/InputPressable.d.ts +9 -1
- package/dist/types/src/InputPressable/InputPressable.style.d.ts +3 -0
- package/dist/types/src/InputSearch/InputSearch.d.ts +1 -1
- package/dist/types/src/InputSearch/components/FilterButton.d.ts +2 -1
- package/dist/types/src/InputText/InputText.d.ts +11 -3
- package/dist/types/src/InputText/InputText.style.d.ts +4 -0
- package/dist/types/src/InputText/context/InputAccessoriesProvider.d.ts +2 -1
- package/dist/types/src/InputTime/InputTime.d.ts +4 -2
- package/dist/types/src/Menu/Menu.d.ts +2 -1
- package/dist/types/src/Menu/components/MenuOption/MenuOption.d.ts +2 -1
- package/dist/types/src/Menu/components/Overlay/Overlay.d.ts +2 -1
- package/dist/types/src/Menu/types.d.ts +6 -1
- package/dist/types/src/ProgressBar/ProgressBar.d.ts +2 -1
- package/dist/types/src/ProgressBar/ProgressBarInner.d.ts +5 -1
- package/dist/types/src/ProgressBar/ProgressBarStepped.d.ts +3 -1
- package/dist/types/src/ProgressBar/types.d.ts +20 -0
- package/dist/types/src/Select/Select.d.ts +3 -2
- package/dist/types/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.d.ts +2 -1
- package/dist/types/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.ios.d.ts +2 -1
- package/dist/types/src/Select/components/SelectInternalPicker/SelectInternalPicker.d.ts +2 -1
- package/dist/types/src/Select/components/SelectPressable/SelectPressable.d.ts +2 -1
- package/dist/types/src/StatusLabel/StatusLabel.d.ts +2 -1
- package/dist/types/src/StatusLabel/StatusLabel.style.d.ts +1 -1
- package/dist/types/src/Switch/Switch.d.ts +2 -1
- package/dist/types/src/Switch/components/BaseSwitch/BaseSwitch.d.ts +2 -1
- package/dist/types/src/Text/Text.d.ts +4 -3
- package/dist/types/src/TextList/TextList.d.ts +2 -1
- package/dist/types/src/ThumbnailList/ThumbnailList.d.ts +2 -1
- package/dist/types/src/Toast/Toast.d.ts +2 -1
- package/dist/types/src/Typography/Typography.d.ts +3 -3
- package/dist/types/src/Typography/TypographyGestureDetector.d.ts +2 -1
- package/dist/types/src/utils/test/MockSafeAreaProvider.d.ts +1 -1
- package/package.json +26 -15
- package/src/ActionItem/ActionItem.tsx +1 -1
- package/src/ActionItem/ActionItemGroup.tsx +1 -3
- package/src/ActionItem/components/ActionItemContainer.tsx +1 -1
- package/src/ActionLabel/ActionLabel.test.tsx +12 -0
- package/src/ActionLabel/ActionLabel.tsx +3 -3
- package/src/ActionLabel/__snapshots__/ActionLabel.test.tsx.snap +66 -0
- package/src/ActivityIndicator/ActivityIndicator.tsx +1 -3
- package/src/AtlantisContext/AtlantisContext.test.tsx +1 -1
- package/src/AtlantisThemeContext/AtlantisThemeContext.test.tsx +5 -5
- package/src/AutoLink/AutoLink.test.tsx +2 -4
- package/src/AutoLink/AutoLink.tsx +1 -1
- package/src/AutoLink/components/ComposeTextWithLinks/ComposeTextWithLinks.tsx +1 -1
- package/src/AutoLink/components/Link/Link.tsx +1 -5
- package/src/Banner/Banner.test.tsx +12 -0
- package/src/Banner/Banner.tsx +4 -2
- package/src/Banner/components/BannerIcon/BannerIcon.style.ts +3 -0
- package/src/Banner/components/BannerIcon/BannerIcon.tsx +1 -1
- package/src/Banner/types.ts +1 -1
- package/src/BottomSheet/BottomSheet.stories.tsx +128 -0
- package/src/BottomSheet/BottomSheet.style.ts +7 -14
- package/src/BottomSheet/BottomSheet.test.tsx +34 -39
- package/src/BottomSheet/BottomSheet.tsx +112 -92
- package/src/BottomSheet/components/BottomSheetOption/BottomSheetOption.tsx +1 -1
- package/src/BottomSheet/hooks/useBottomSheetBackHandler.test.ts +90 -0
- package/src/BottomSheet/hooks/useBottomSheetBackHandler.ts +41 -0
- package/src/Button/Button.tsx +1 -1
- package/src/Button/components/InternalButtonLoading/InternalButtonLoading.tsx +1 -2
- package/src/ButtonGroup/ButtonGroup.test.tsx +13 -11
- package/src/ButtonGroup/ButtonGroup.tsx +2 -2
- package/src/ButtonGroup/ButtonGroupAction.tsx +4 -4
- package/src/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.tsx +2 -2
- package/src/Card/Card.tsx +1 -1
- package/src/Card/components/InternalCardHeader.tsx +1 -1
- package/src/Checkbox/Checkbox.test.tsx +118 -1
- package/src/Checkbox/Checkbox.tsx +2 -2
- package/src/Checkbox/CheckboxGroup.test.tsx +3 -7
- package/src/Checkbox/CheckboxGroup.tsx +2 -2
- package/src/Chip/Chip.style.ts +1 -1
- package/src/Chip/Chip.tsx +20 -2
- package/src/Content/Content.tsx +7 -2
- package/src/Content/ContentHorizontal.style.ts +20 -0
- package/src/Content/ContentSpaceAround.style.ts +20 -0
- package/src/Content/ContentVertical.style.ts +20 -0
- package/src/ContentOverlay/ContentOverlay.test.tsx +34 -27
- package/src/ContentOverlay/ContentOverlay.tsx +7 -7
- package/src/ContentOverlay/UNSAFE_WrappedModalize.tsx +41 -0
- package/src/ContentOverlay/hooks/useKeyboardVisibility.test.ts +7 -7
- package/src/ContentOverlay/hooks/useViewLayoutHeight.test.ts +1 -1
- package/src/Disclosure/Disclosure.tsx +1 -1
- package/src/Divider/Divider.tsx +1 -1
- package/src/EmptyState/EmptyState.test.tsx +29 -42
- package/src/EmptyState/EmptyState.tsx +1 -1
- package/src/ErrorMessageWrapper/ErrorMessageWrapper.tsx +1 -1
- package/src/ErrorMessageWrapper/context/ErrorMessageProvider.tsx +3 -5
- package/src/ErrorMessageWrapper/context/types.ts +1 -1
- package/src/Flex/Flex.tsx +2 -2
- package/src/Form/Form.test.tsx +145 -2
- package/src/Form/Form.tsx +8 -1
- package/src/Form/components/FormActionBar/FormActionBar.tsx +3 -3
- package/src/Form/components/FormBody/FormBody.tsx +3 -3
- package/src/Form/components/FormCache/FormCache.tsx +5 -4
- package/src/Form/components/FormErrorBanner/FormErrorBanner.tsx +1 -1
- package/src/Form/components/FormMask/FormMask.tsx +1 -1
- package/src/Form/components/FormMessage/FormMessage.test.tsx +40 -27
- package/src/Form/components/FormMessage/FormMessage.tsx +1 -1
- package/src/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.tsx +1 -1
- package/src/Form/components/FormMessageBanner/FormMessageBanner.tsx +1 -3
- package/src/Form/components/FormSaveButton/FormSaveButton.test.tsx +2 -2
- package/src/Form/components/FormSaveButton/FormSaveButton.tsx +1 -1
- package/src/Form/context/AtlantisFormContext.test.tsx +1 -1
- package/src/Form/context/AtlantisFormContext.tsx +1 -0
- package/src/Form/context/types.ts +5 -4
- package/src/Form/hooks/useFormViewRefs.ts +4 -5
- package/src/Form/hooks/useInternalForm.ts +14 -6
- package/src/Form/hooks/useScrollToError/useScrollToError.test.tsx +2 -1
- package/src/Form/types.ts +14 -8
- package/src/FormField/FormField.tsx +1 -1
- package/src/FormatFile/FormatFile.test.tsx +21 -21
- package/src/FormatFile/FormatFile.tsx +3 -3
- package/src/FormatFile/components/ErrorIcon/ErrorIcon.tsx +1 -1
- package/src/FormatFile/components/FileView/FileView.tsx +1 -1
- package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.test.tsx +14 -14
- package/src/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.tsx +2 -2
- package/src/FormatFile/components/MediaView/MediaView.test.tsx +283 -0
- package/src/FormatFile/components/MediaView/MediaView.tsx +28 -7
- package/src/FormatFile/components/ProgressBar/ProgressBar.tsx +1 -1
- package/src/FormatFile/utils/createUseCreateThumbnail.ts +1 -1
- package/src/Glimmer/Glimmer.test.tsx +2 -2
- package/src/Heading/Heading.test.tsx +13 -0
- package/src/Heading/Heading.tsx +3 -3
- package/src/Heading/__snapshots__/Heading.test.tsx.snap +65 -0
- package/src/Icon/Icon.tsx +1 -1
- package/src/Icon/__snapshots__/Icon.test.tsx.snap +7 -0
- package/src/IconButton/IconButton.tsx +1 -1
- package/src/InputCurrency/InputCurrency.tsx +72 -58
- package/src/InputDate/InputDate.tsx +7 -3
- package/src/InputEmail/InputEmail.tsx +15 -8
- package/src/InputFieldWrapper/InputFieldWrapper.style.ts +1 -1
- package/src/InputFieldWrapper/InputFieldWrapper.test.tsx +48 -1
- package/src/InputFieldWrapper/InputFieldWrapper.tsx +39 -29
- package/src/InputFieldWrapper/components/ClearAction/ClearAction.tsx +1 -1
- package/src/InputFieldWrapper/components/Prefix/Prefix.test.tsx +8 -16
- package/src/InputFieldWrapper/components/Prefix/Prefix.tsx +8 -6
- package/src/InputFieldWrapper/components/Suffix/Suffix.test.tsx +2 -4
- package/src/InputFieldWrapper/components/Suffix/Suffix.tsx +8 -6
- package/src/InputNumber/InputNumber.tsx +11 -7
- package/src/InputPassword/InputPassword.tsx +1 -1
- package/src/InputPressable/InputPressable.style.ts +4 -0
- package/src/InputPressable/InputPressable.test.tsx +75 -1
- package/src/InputPressable/InputPressable.tsx +34 -8
- package/src/InputSearch/InputSearch.tsx +2 -1
- package/src/InputSearch/components/FilterButton.tsx +1 -1
- package/src/InputText/InputText.style.ts +5 -0
- package/src/InputText/InputText.test.tsx +190 -1
- package/src/InputText/InputText.tsx +37 -20
- package/src/InputText/context/InputAccessoriesProvider.tsx +1 -1
- package/src/InputTime/InputTime.tsx +7 -3
- package/src/Menu/Menu.tsx +3 -3
- package/src/Menu/components/MenuOption/MenuOption.tsx +1 -1
- package/src/Menu/components/Overlay/Overlay.tsx +1 -1
- package/src/Menu/types.ts +7 -1
- package/src/ProgressBar/ProgressBar.test.tsx +109 -0
- package/src/ProgressBar/ProgressBar.tsx +18 -2
- package/src/ProgressBar/ProgressBarInner.tsx +8 -11
- package/src/ProgressBar/ProgressBarStepped.tsx +12 -1
- package/src/ProgressBar/__snapshots__/ProgressBar.test.tsx.snap +14 -0
- package/src/ProgressBar/types.ts +22 -0
- package/src/Select/Select.style.ts +1 -0
- package/src/Select/Select.tsx +2 -2
- package/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.ios.tsx +1 -1
- package/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.tsx +1 -1
- package/src/Select/components/SelectInternalPicker/SelectInternalPicker.tsx +1 -1
- package/src/Select/components/SelectPressable/SelectPressable.tsx +1 -4
- package/src/StatusLabel/StatusLabel.style.ts +2 -2
- package/src/StatusLabel/StatusLabel.tsx +1 -1
- package/src/StatusLabel/__snapshots__/StatusLabel.test.tsx.snap +14 -14
- package/src/Switch/Switch.tsx +1 -1
- package/src/Switch/components/BaseSwitch/BaseSwitch.tsx +8 -2
- package/src/Text/Text.test.tsx +10 -0
- package/src/Text/Text.tsx +3 -3
- package/src/Text/__snapshots__/Text.test.tsx.snap +66 -0
- package/src/TextList/TextList.tsx +1 -1
- package/src/ThumbnailList/ThumbnailList.test.tsx +5 -5
- package/src/ThumbnailList/ThumbnailList.tsx +1 -1
- package/src/ThumbnailList/__snapshots__/ThumbnailList.test.tsx.snap +199 -1
- package/src/Toast/Toast.tsx +2 -2
- package/src/Typography/Typography.test.tsx +61 -0
- package/src/Typography/Typography.tsx +25 -9
- package/src/Typography/TypographyGestureDetector.tsx +1 -3
- package/src/Typography/__snapshots__/Typography.test.tsx.snap +222 -0
- package/src/hooks/useAtlantisI18n/locales/en.json +1 -0
- package/src/hooks/useAtlantisI18n/locales/es.json +1 -0
- package/src/hooks/useFormController.ts +7 -14
- package/src/utils/test/MockSafeAreaProvider.tsx +1 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -16,6 +16,10 @@ export const useVerticalStyles = buildThemedStyles(tokens => {
|
|
|
16
16
|
padding: 0,
|
|
17
17
|
},
|
|
18
18
|
|
|
19
|
+
minusculeChildSpace: {
|
|
20
|
+
paddingTop: tokens["space-minuscule"],
|
|
21
|
+
},
|
|
22
|
+
|
|
19
23
|
smallestChildSpace: {
|
|
20
24
|
paddingTop: tokens["space-smallest"],
|
|
21
25
|
},
|
|
@@ -28,6 +32,10 @@ export const useVerticalStyles = buildThemedStyles(tokens => {
|
|
|
28
32
|
paddingTop: tokens["space-small"],
|
|
29
33
|
},
|
|
30
34
|
|
|
35
|
+
slimChildSpace: {
|
|
36
|
+
paddingTop: tokens["space-slim"],
|
|
37
|
+
},
|
|
38
|
+
|
|
31
39
|
baseChildSpace: {
|
|
32
40
|
paddingTop: tokens["space-base"],
|
|
33
41
|
},
|
|
@@ -35,5 +43,17 @@ export const useVerticalStyles = buildThemedStyles(tokens => {
|
|
|
35
43
|
largeChildSpace: {
|
|
36
44
|
paddingTop: tokens["space-large"],
|
|
37
45
|
},
|
|
46
|
+
|
|
47
|
+
largerChildSpace: {
|
|
48
|
+
paddingTop: tokens["space-larger"],
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
largestChildSpace: {
|
|
52
|
+
paddingTop: tokens["space-largest"],
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
extravagantChildSpace: {
|
|
56
|
+
paddingTop: tokens["space-extravagant"],
|
|
57
|
+
},
|
|
38
58
|
};
|
|
39
59
|
});
|
|
@@ -4,7 +4,7 @@ import { AccessibilityInfo, View } from "react-native";
|
|
|
4
4
|
import { Host } from "react-native-portalize";
|
|
5
5
|
import type { ReactTestInstance } from "react-test-renderer";
|
|
6
6
|
import { act } from "react-test-renderer";
|
|
7
|
-
import type { ContentOverlayRef, ModalBackgroundColor } from "./
|
|
7
|
+
import type { ContentOverlayRef, ModalBackgroundColor } from "./types";
|
|
8
8
|
import { ContentOverlay } from "./ContentOverlay";
|
|
9
9
|
import { tokens } from "../utils/design";
|
|
10
10
|
import { Button } from "../Button";
|
|
@@ -106,23 +106,30 @@ function renderContentOverlay(
|
|
|
106
106
|
return renderResult;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
function renderAndOpenContentOverlay(
|
|
109
|
+
async function renderAndOpenContentOverlay(
|
|
110
|
+
defaultOptions = getDefaultOptions(),
|
|
111
|
+
) {
|
|
110
112
|
const rendered = renderContentOverlay(defaultOptions);
|
|
111
113
|
|
|
112
|
-
act(() => {
|
|
114
|
+
await act(async () => {
|
|
113
115
|
fireEvent.press(rendered.getByLabelText(defaultOptions.buttonLabel));
|
|
114
116
|
});
|
|
115
117
|
|
|
118
|
+
// Wait for the modal to open asynchronously (due to requestAnimationFrame)
|
|
119
|
+
await waitFor(() => {
|
|
120
|
+
expect(rendered.getByTestId("ATL-Overlay-Header")).toBeDefined();
|
|
121
|
+
});
|
|
122
|
+
|
|
116
123
|
return rendered;
|
|
117
124
|
}
|
|
118
125
|
|
|
119
126
|
describe("when open is called on the content overlay ref", () => {
|
|
120
|
-
it("should open the content overlay, exposing the content to the user", () => {
|
|
127
|
+
it("should open the content overlay, exposing the content to the user", async () => {
|
|
121
128
|
const options: testRendererOptions = {
|
|
122
129
|
...getDefaultOptions(),
|
|
123
130
|
text: "I am text within the content overlay",
|
|
124
131
|
};
|
|
125
|
-
const contentOverlayScreen = renderAndOpenContentOverlay(options);
|
|
132
|
+
const contentOverlayScreen = await renderAndOpenContentOverlay(options);
|
|
126
133
|
|
|
127
134
|
expect(contentOverlayScreen.getByText(options.text)).toBeDefined();
|
|
128
135
|
});
|
|
@@ -135,9 +142,9 @@ describe("when the close button is clicked on an open content overlay", () => {
|
|
|
135
142
|
text: "I am text within the content overlay",
|
|
136
143
|
showDismiss: true,
|
|
137
144
|
};
|
|
138
|
-
const contentOverlayScreen = renderAndOpenContentOverlay(options);
|
|
145
|
+
const contentOverlayScreen = await renderAndOpenContentOverlay(options);
|
|
139
146
|
|
|
140
|
-
act(() => {
|
|
147
|
+
await act(async () => {
|
|
141
148
|
fireEvent.press(
|
|
142
149
|
contentOverlayScreen.getByTestId("ATL-Overlay-CloseButton"),
|
|
143
150
|
);
|
|
@@ -156,9 +163,9 @@ describe("when the close button is clicked on an open content overlay with a def
|
|
|
156
163
|
onCloseCallback: jest.fn(),
|
|
157
164
|
showDismiss: true,
|
|
158
165
|
};
|
|
159
|
-
const contentOverlayScreen = renderAndOpenContentOverlay(options);
|
|
166
|
+
const contentOverlayScreen = await renderAndOpenContentOverlay(options);
|
|
160
167
|
|
|
161
|
-
act(() => {
|
|
168
|
+
await act(async () => {
|
|
162
169
|
fireEvent.press(
|
|
163
170
|
contentOverlayScreen.getByTestId("ATL-Overlay-CloseButton"),
|
|
164
171
|
);
|
|
@@ -191,7 +198,7 @@ describe("when the content overlay is created with a defined onOpen prop", () =>
|
|
|
191
198
|
...getDefaultOptions(),
|
|
192
199
|
onOpenCallback: jest.fn(),
|
|
193
200
|
};
|
|
194
|
-
renderAndOpenContentOverlay(options);
|
|
201
|
+
await renderAndOpenContentOverlay(options);
|
|
195
202
|
|
|
196
203
|
await waitFor(() => {
|
|
197
204
|
expect(options.onOpenCallback).toHaveBeenCalled();
|
|
@@ -201,25 +208,25 @@ describe("when the content overlay is created with a defined onOpen prop", () =>
|
|
|
201
208
|
});
|
|
202
209
|
|
|
203
210
|
describe("when title prop passed to content overlay", () => {
|
|
204
|
-
it("should set the header title", () => {
|
|
211
|
+
it("should set the header title", async () => {
|
|
205
212
|
const options: testRendererOptions = {
|
|
206
213
|
...getDefaultOptions(),
|
|
207
214
|
title: "Awesome Title",
|
|
208
215
|
};
|
|
209
|
-
const contentOverlayScreen = renderAndOpenContentOverlay(options);
|
|
216
|
+
const contentOverlayScreen = await renderAndOpenContentOverlay(options);
|
|
210
217
|
|
|
211
218
|
expect(contentOverlayScreen.getByText(options.title)).toBeDefined();
|
|
212
219
|
});
|
|
213
220
|
});
|
|
214
221
|
|
|
215
222
|
describe("when accessibilityLabel prop passed to content overlay", () => {
|
|
216
|
-
it("should set the header accessibilityLabel", () => {
|
|
223
|
+
it("should set the header accessibilityLabel", async () => {
|
|
217
224
|
const options: testRendererOptions = {
|
|
218
225
|
...getDefaultOptions(),
|
|
219
226
|
a11yLabel: "Awesome a11y Label",
|
|
220
227
|
showDismiss: true,
|
|
221
228
|
};
|
|
222
|
-
const contentOverlayScreen = renderAndOpenContentOverlay(options);
|
|
229
|
+
const contentOverlayScreen = await renderAndOpenContentOverlay(options);
|
|
223
230
|
|
|
224
231
|
expect(
|
|
225
232
|
contentOverlayScreen.getByLabelText(options.a11yLabel || "ohno"),
|
|
@@ -228,13 +235,13 @@ describe("when accessibilityLabel prop passed to content overlay", () => {
|
|
|
228
235
|
});
|
|
229
236
|
|
|
230
237
|
describe("when accessibilityLabel prop NOT passed to content overlay", () => {
|
|
231
|
-
it("should use default accessibilityLabel", () => {
|
|
238
|
+
it("should use default accessibilityLabel", async () => {
|
|
232
239
|
const options: testRendererOptions = {
|
|
233
240
|
...getDefaultOptions(),
|
|
234
241
|
title: "Awesome Title",
|
|
235
242
|
showDismiss: true,
|
|
236
243
|
};
|
|
237
|
-
const contentOverlayScreen = renderAndOpenContentOverlay(options);
|
|
244
|
+
const contentOverlayScreen = await renderAndOpenContentOverlay(options);
|
|
238
245
|
|
|
239
246
|
expect(
|
|
240
247
|
contentOverlayScreen.getAllByLabelText(`Close ${options.title} modal`),
|
|
@@ -251,7 +258,7 @@ describe("when there is a screen reader enabled", () => {
|
|
|
251
258
|
const options: testRendererOptions = {
|
|
252
259
|
...getDefaultOptions(),
|
|
253
260
|
};
|
|
254
|
-
const contentOverlayScreen = renderAndOpenContentOverlay(options);
|
|
261
|
+
const contentOverlayScreen = await renderAndOpenContentOverlay(options);
|
|
255
262
|
|
|
256
263
|
expect(
|
|
257
264
|
await contentOverlayScreen.findByTestId("ATL-Overlay-CloseButton"),
|
|
@@ -260,12 +267,12 @@ describe("when there is a screen reader enabled", () => {
|
|
|
260
267
|
});
|
|
261
268
|
|
|
262
269
|
describe("when fullScreen is set to true", () => {
|
|
263
|
-
it("should show the dismiss button", () => {
|
|
270
|
+
it("should show the dismiss button", async () => {
|
|
264
271
|
const options: testRendererOptions = {
|
|
265
272
|
...getDefaultOptions(),
|
|
266
273
|
fullScreen: true,
|
|
267
274
|
};
|
|
268
|
-
const contentOverlayScreen = renderAndOpenContentOverlay(options);
|
|
275
|
+
const contentOverlayScreen = await renderAndOpenContentOverlay(options);
|
|
269
276
|
expect(
|
|
270
277
|
contentOverlayScreen.getByTestId("ATL-Overlay-CloseButton"),
|
|
271
278
|
).toBeDefined();
|
|
@@ -273,12 +280,12 @@ describe("when fullScreen is set to true", () => {
|
|
|
273
280
|
});
|
|
274
281
|
|
|
275
282
|
describe("when showDismiss is set to true", () => {
|
|
276
|
-
it("should show the dismiss button", () => {
|
|
283
|
+
it("should show the dismiss button", async () => {
|
|
277
284
|
const options: testRendererOptions = {
|
|
278
285
|
...getDefaultOptions(),
|
|
279
286
|
showDismiss: true,
|
|
280
287
|
};
|
|
281
|
-
const contentOverlayScreen = renderAndOpenContentOverlay(options);
|
|
288
|
+
const contentOverlayScreen = await renderAndOpenContentOverlay(options);
|
|
282
289
|
expect(
|
|
283
290
|
contentOverlayScreen.getByTestId("ATL-Overlay-CloseButton"),
|
|
284
291
|
).toBeDefined();
|
|
@@ -292,9 +299,9 @@ describe("when the close button is clicked on an open content overlay with a def
|
|
|
292
299
|
onBeforeExitCallback: jest.fn(),
|
|
293
300
|
showDismiss: true,
|
|
294
301
|
};
|
|
295
|
-
const contentOverlayScreen = renderAndOpenContentOverlay(options);
|
|
302
|
+
const contentOverlayScreen = await renderAndOpenContentOverlay(options);
|
|
296
303
|
|
|
297
|
-
act(() => {
|
|
304
|
+
await act(async () => {
|
|
298
305
|
fireEvent.press(
|
|
299
306
|
contentOverlayScreen.getByTestId("ATL-Overlay-CloseButton"),
|
|
300
307
|
);
|
|
@@ -308,11 +315,11 @@ describe("when the close button is clicked on an open content overlay with a def
|
|
|
308
315
|
|
|
309
316
|
describe("modalBackgroundColor prop", () => {
|
|
310
317
|
describe("when using the default surface value", () => {
|
|
311
|
-
it("renders the component with the color-surface color", () => {
|
|
318
|
+
it("renders the component with the color-surface color", async () => {
|
|
312
319
|
const options: testRendererOptions = {
|
|
313
320
|
...getDefaultOptions(),
|
|
314
321
|
};
|
|
315
|
-
const contentOverlayScreen = renderAndOpenContentOverlay(options);
|
|
322
|
+
const contentOverlayScreen = await renderAndOpenContentOverlay(options);
|
|
316
323
|
const OverlayHeader = contentOverlayScreen.getByTestId(
|
|
317
324
|
"ATL-Overlay-Header",
|
|
318
325
|
).children[0] as ReactTestInstance;
|
|
@@ -337,12 +344,12 @@ describe("modalBackgroundColor prop", () => {
|
|
|
337
344
|
});
|
|
338
345
|
|
|
339
346
|
describe("when set to background", () => {
|
|
340
|
-
it("changes the backround color of the modal to color-surface--background", () => {
|
|
347
|
+
it("changes the backround color of the modal to color-surface--background", async () => {
|
|
341
348
|
const options: testRendererOptions = {
|
|
342
349
|
...getDefaultOptions(),
|
|
343
350
|
modalBackgroundColor: "background",
|
|
344
351
|
};
|
|
345
|
-
const contentOverlayScreen = renderAndOpenContentOverlay(options);
|
|
352
|
+
const contentOverlayScreen = await renderAndOpenContentOverlay(options);
|
|
346
353
|
const OverlayHeader = contentOverlayScreen.getByTestId(
|
|
347
354
|
"ATL-Overlay-Header",
|
|
348
355
|
).children[0] as ReactTestInstance;
|
|
@@ -7,7 +7,7 @@ import React, {
|
|
|
7
7
|
useRef,
|
|
8
8
|
useState,
|
|
9
9
|
} from "react";
|
|
10
|
-
import { Modalize } from "react-native-modalize";
|
|
10
|
+
import type { Modalize } from "react-native-modalize";
|
|
11
11
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
12
12
|
import type { NativeScrollEvent, NativeSyntheticEvent } from "react-native";
|
|
13
13
|
import {
|
|
@@ -26,6 +26,7 @@ import type {
|
|
|
26
26
|
ContentOverlayRef,
|
|
27
27
|
ModalBackgroundColor,
|
|
28
28
|
} from "./types";
|
|
29
|
+
import { UNSAFE_WrappedModalize } from "./UNSAFE_WrappedModalize";
|
|
29
30
|
import { useIsScreenReaderEnabled } from "../hooks";
|
|
30
31
|
import { IconButton } from "../IconButton";
|
|
31
32
|
import { Heading } from "../Heading";
|
|
@@ -56,7 +57,7 @@ function ContentOverlayInternal(
|
|
|
56
57
|
avoidKeyboardLikeIOS,
|
|
57
58
|
}: ContentOverlayProps,
|
|
58
59
|
ref: Ref<ContentOverlayRef>,
|
|
59
|
-
)
|
|
60
|
+
) {
|
|
60
61
|
isDraggable = onBeforeExit ? false : isDraggable;
|
|
61
62
|
const isCloseableOnOverlayTap = onBeforeExit ? false : true;
|
|
62
63
|
const { t } = useAtlantisI18n();
|
|
@@ -70,9 +71,9 @@ function ContentOverlayInternal(
|
|
|
70
71
|
const shouldShowDismiss =
|
|
71
72
|
showDismiss || isScreenReaderEnabled || isFullScreenOrTopPosition;
|
|
72
73
|
const [showHeaderShadow, setShowHeaderShadow] = useState<boolean>(false);
|
|
73
|
-
const overlayHeader = useRef<View>();
|
|
74
|
+
const overlayHeader = useRef<View>(null);
|
|
74
75
|
|
|
75
|
-
const internalRef = useRef<Modalize>();
|
|
76
|
+
const internalRef = useRef<Modalize>(null);
|
|
76
77
|
const [modalizeMethods, setModalizeMethods] = useState<ContentOverlayRef>();
|
|
77
78
|
const callbackInternalRef = useCallback((instance: Modalize) => {
|
|
78
79
|
if (instance && !internalRef.current) {
|
|
@@ -153,7 +154,7 @@ function ContentOverlayInternal(
|
|
|
153
154
|
return (
|
|
154
155
|
<>
|
|
155
156
|
{headerHeightKnown && childrenHeightKnown && (
|
|
156
|
-
<
|
|
157
|
+
<UNSAFE_WrappedModalize
|
|
157
158
|
ref={callbackInternalRef}
|
|
158
159
|
overlayStyle={styles.overlay}
|
|
159
160
|
handleStyle={styles.handle}
|
|
@@ -196,7 +197,7 @@ function ContentOverlayInternal(
|
|
|
196
197
|
>
|
|
197
198
|
{Platform.OS === "android" ? renderedHeader : undefined}
|
|
198
199
|
{renderedChildren}
|
|
199
|
-
</
|
|
200
|
+
</UNSAFE_WrappedModalize>
|
|
200
201
|
)}
|
|
201
202
|
{!childrenHeightKnown && (
|
|
202
203
|
<View style={[styles.hiddenContent, modalStyle]}>
|
|
@@ -243,7 +244,6 @@ function ContentOverlayInternal(
|
|
|
243
244
|
{shouldShowDismiss && (
|
|
244
245
|
<View
|
|
245
246
|
style={styles.dismissButton}
|
|
246
|
-
// @ts-expect-error tsc-ci
|
|
247
247
|
ref={overlayHeader}
|
|
248
248
|
accessibilityLabel={accessibilityLabel || closeOverlayA11YLabel}
|
|
249
249
|
accessible={true}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
forwardRef,
|
|
3
|
+
useImperativeHandle,
|
|
4
|
+
useRef,
|
|
5
|
+
useState,
|
|
6
|
+
} from "react";
|
|
7
|
+
import { Modalize } from "react-native-modalize";
|
|
8
|
+
import type { IHandles } from "react-native-modalize/lib/options";
|
|
9
|
+
|
|
10
|
+
type Props = React.ComponentProps<typeof Modalize>;
|
|
11
|
+
|
|
12
|
+
export const UNSAFE_WrappedModalize = forwardRef<IHandles | undefined, Props>(
|
|
13
|
+
(props, ref) => {
|
|
14
|
+
const innerRef = useRef<IHandles | null>(null);
|
|
15
|
+
const [openRenderId, setOpenRenderId] = useState(0);
|
|
16
|
+
|
|
17
|
+
useImperativeHandle(
|
|
18
|
+
ref,
|
|
19
|
+
() => ({
|
|
20
|
+
open(dest) {
|
|
21
|
+
setOpenRenderId(id => id + 1);
|
|
22
|
+
// Open on a fresh tick for additional safety
|
|
23
|
+
requestAnimationFrame(() => {
|
|
24
|
+
innerRef.current?.open(dest);
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
close(dest) {
|
|
28
|
+
innerRef.current?.close(dest);
|
|
29
|
+
},
|
|
30
|
+
}),
|
|
31
|
+
[],
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
// Use a unique key to force a remount, ensuring we get fresh gesture handler nodes within modalize
|
|
35
|
+
return (
|
|
36
|
+
<Modalize key={`modalize-${openRenderId}`} ref={innerRef} {...props} />
|
|
37
|
+
);
|
|
38
|
+
},
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
UNSAFE_WrappedModalize.displayName = "UNSAFE_WrappedModalize";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { act, renderHook } from "@testing-library/react-
|
|
1
|
+
import { act, renderHook } from "@testing-library/react-native";
|
|
2
2
|
import type { KeyboardEvent } from "react-native";
|
|
3
3
|
import { DeviceEventEmitter } from "react-native";
|
|
4
4
|
import { useKeyboardVisibility } from "./useKeyboardVisibility";
|
|
@@ -8,19 +8,19 @@ const keyboardEvent: Partial<KeyboardEvent> = {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
describe("when the user is typing", () => {
|
|
11
|
-
it("sets the isKeyboardVisible to true", () => {
|
|
11
|
+
it("sets the isKeyboardVisible to true", async () => {
|
|
12
12
|
const { result } = renderHook(() => useKeyboardVisibility());
|
|
13
13
|
|
|
14
|
-
act(() => {
|
|
14
|
+
await act(async () => {
|
|
15
15
|
DeviceEventEmitter.emit("keyboardDidShow", keyboardEvent);
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
expect(result.current.isKeyboardVisible).toBe(true);
|
|
19
19
|
});
|
|
20
|
-
it("the keyboardDidShow event emits the keyboard height", () => {
|
|
20
|
+
it("the keyboardDidShow event emits the keyboard height", async () => {
|
|
21
21
|
const { result } = renderHook(() => useKeyboardVisibility());
|
|
22
22
|
|
|
23
|
-
act(() => {
|
|
23
|
+
await act(async () => {
|
|
24
24
|
DeviceEventEmitter.emit("keyboardDidShow", keyboardEvent);
|
|
25
25
|
});
|
|
26
26
|
|
|
@@ -31,10 +31,10 @@ describe("when the user is typing", () => {
|
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
describe("when the user not typing", () => {
|
|
34
|
-
it("sets the isKeyboardVisible to false", () => {
|
|
34
|
+
it("sets the isKeyboardVisible to false", async () => {
|
|
35
35
|
const { result } = renderHook(() => useKeyboardVisibility());
|
|
36
36
|
|
|
37
|
-
act(() => {
|
|
37
|
+
await act(async () => {
|
|
38
38
|
DeviceEventEmitter.emit("keyboardDidHide");
|
|
39
39
|
});
|
|
40
40
|
|
package/src/Divider/Divider.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { fireEvent, render } from "@testing-library/react-native";
|
|
2
|
+
import { fireEvent, render, screen } from "@testing-library/react-native";
|
|
3
|
+
import { Path } from "react-native-svg";
|
|
3
4
|
import type { EmptyStateProps } from "./EmptyState";
|
|
4
5
|
import { EmptyState } from "./EmptyState";
|
|
5
|
-
import * as IconComponent from "../Icon/Icon";
|
|
6
6
|
|
|
7
7
|
const primaryOnPress = jest.fn();
|
|
8
8
|
const secondaryOnPress = jest.fn();
|
|
@@ -27,83 +27,70 @@ const component = (overrideProps?: Partial<EmptyStateProps>) => {
|
|
|
27
27
|
...overrideProps,
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
render(<EmptyState {...props} />);
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
const iconSpy = jest.spyOn(IconComponent, "Icon");
|
|
34
|
-
|
|
35
|
-
afterEach(() => jest.clearAllMocks());
|
|
36
|
-
|
|
37
33
|
describe("EmptyState", () => {
|
|
38
34
|
it("renders the title", () => {
|
|
39
|
-
|
|
35
|
+
component();
|
|
40
36
|
|
|
41
|
-
expect(getByText(defaultProps.title)).toBeDefined();
|
|
37
|
+
expect(screen.getByText(defaultProps.title)).toBeDefined();
|
|
42
38
|
});
|
|
43
39
|
|
|
44
40
|
it("renders the description", () => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
expect(getByText(defaultProps.description)).toBeDefined();
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it("renders the icon", () => {
|
|
51
|
-
const { getByTestId } = component();
|
|
41
|
+
component();
|
|
52
42
|
|
|
53
|
-
expect(
|
|
43
|
+
expect(screen.getByText(defaultProps.description)).toBeDefined();
|
|
54
44
|
});
|
|
55
45
|
|
|
56
|
-
it("
|
|
46
|
+
it("renders the icon with default color and large size", () => {
|
|
57
47
|
component();
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
48
|
+
const icon = screen.getByTestId(defaultProps.icon);
|
|
49
|
+
const path = icon.findByType(Path);
|
|
50
|
+
expect(path.props.fill).toBe("hsl(197, 90%, 12%)");
|
|
51
|
+
expect(icon.props.style).toEqual(
|
|
52
|
+
expect.arrayContaining([
|
|
53
|
+
expect.objectContaining({
|
|
54
|
+
width: 32,
|
|
55
|
+
height: 32,
|
|
56
|
+
}),
|
|
57
|
+
]),
|
|
66
58
|
);
|
|
67
59
|
});
|
|
68
60
|
|
|
69
|
-
it("
|
|
70
|
-
component({ iconColor: "
|
|
61
|
+
it("renders the correct icon color when specified", async () => {
|
|
62
|
+
component({ iconColor: "warning" });
|
|
71
63
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
name: "link",
|
|
76
|
-
size: "large",
|
|
77
|
-
},
|
|
78
|
-
{},
|
|
79
|
-
);
|
|
64
|
+
const icon = screen.getByTestId(defaultProps.icon);
|
|
65
|
+
const pathElement = icon.findByType(Path);
|
|
66
|
+
expect(pathElement.props.fill).toBe("hsl(51, 64%, 49%)");
|
|
80
67
|
});
|
|
81
68
|
|
|
82
69
|
it("renders the primary action and allows users to interact with it by clicking", () => {
|
|
83
|
-
|
|
70
|
+
component();
|
|
84
71
|
|
|
85
|
-
const button = getByLabelText(defaultProps.primaryAction.label);
|
|
72
|
+
const button = screen.getByLabelText(defaultProps.primaryAction.label);
|
|
86
73
|
expect(button).toBeDefined();
|
|
87
74
|
fireEvent.press(button);
|
|
88
75
|
expect(primaryOnPress).toHaveBeenCalledTimes(1);
|
|
89
76
|
});
|
|
90
77
|
|
|
91
78
|
it("renders the secondary action and allows users to interact with it by clicking", () => {
|
|
92
|
-
|
|
79
|
+
component();
|
|
93
80
|
|
|
94
|
-
const button = getByLabelText(defaultProps.secondaryAction.label);
|
|
81
|
+
const button = screen.getByLabelText(defaultProps.secondaryAction.label);
|
|
95
82
|
expect(button).toBeDefined();
|
|
96
83
|
fireEvent.press(button);
|
|
97
84
|
expect(secondaryOnPress).toHaveBeenCalledTimes(1);
|
|
98
85
|
});
|
|
99
86
|
|
|
100
87
|
it("does render buttons if neither primary nor secondary action is passed in", () => {
|
|
101
|
-
|
|
88
|
+
component({
|
|
102
89
|
description: "No buttons",
|
|
103
90
|
primaryAction: undefined,
|
|
104
91
|
secondaryAction: undefined,
|
|
105
92
|
});
|
|
106
93
|
|
|
107
|
-
expect(queryAllByRole("button")).toHaveLength(0);
|
|
94
|
+
expect(screen.queryAllByRole("button")).toHaveLength(0);
|
|
108
95
|
});
|
|
109
96
|
});
|
|
@@ -34,7 +34,7 @@ export function ErrorMessageWrapper({
|
|
|
34
34
|
message,
|
|
35
35
|
wrapFor = "default",
|
|
36
36
|
children,
|
|
37
|
-
}: ErrorMessageWrapperProps)
|
|
37
|
+
}: ErrorMessageWrapperProps) {
|
|
38
38
|
const errorMessageContext = useErrorMessageContext();
|
|
39
39
|
const register = errorMessageContext?.register;
|
|
40
40
|
const unregister = errorMessageContext?.unregister;
|
|
@@ -13,9 +13,7 @@ interface ErrorMessageProviderProps {
|
|
|
13
13
|
readonly children: ReactNode;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export function ErrorMessageProvider({
|
|
17
|
-
children,
|
|
18
|
-
}: ErrorMessageProviderProps): JSX.Element {
|
|
16
|
+
export function ErrorMessageProvider({ children }: ErrorMessageProviderProps) {
|
|
19
17
|
const [elements, setElements] = useState<
|
|
20
18
|
ErrorMessageContextProps["elements"]
|
|
21
19
|
>({});
|
|
@@ -51,13 +49,13 @@ export function ErrorMessageProvider({
|
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
51
|
|
|
54
|
-
function getMeasure(ref: RefObject<View>) {
|
|
52
|
+
function getMeasure(ref: RefObject<View | null>) {
|
|
55
53
|
return function measure(...args: Parameters<NativeMethods["measureLayout"]>) {
|
|
56
54
|
ref.current?.measureLayout(...args);
|
|
57
55
|
};
|
|
58
56
|
}
|
|
59
57
|
|
|
60
|
-
function getAccessibilityFocus(ref: RefObject<View>) {
|
|
58
|
+
function getAccessibilityFocus(ref: RefObject<View | null>) {
|
|
61
59
|
return function accessibilityFocus() {
|
|
62
60
|
const reactTag = findNodeHandle(ref.current);
|
|
63
61
|
reactTag &&
|
|
@@ -50,7 +50,7 @@ type ElementID = Element["id"];
|
|
|
50
50
|
export interface ErrorMessageContextRegisterParams {
|
|
51
51
|
readonly id: ElementID;
|
|
52
52
|
readonly hasErrorMessage: Methods["hasErrorMessage"];
|
|
53
|
-
readonly ref: RefObject<View>;
|
|
53
|
+
readonly ref: RefObject<View | null>;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export interface ErrorMessageContextProps {
|
package/src/Flex/Flex.tsx
CHANGED
|
@@ -11,7 +11,7 @@ export function Flex({
|
|
|
11
11
|
align = "center",
|
|
12
12
|
gap = "base",
|
|
13
13
|
children,
|
|
14
|
-
}: PropsWithChildren<FlexProps>)
|
|
14
|
+
}: PropsWithChildren<FlexProps>) {
|
|
15
15
|
if (template.length === 1) {
|
|
16
16
|
console.warn("Please use <Content /> component for a stacked layout");
|
|
17
17
|
}
|
|
@@ -54,7 +54,7 @@ function Row({
|
|
|
54
54
|
align = "center",
|
|
55
55
|
gap = "base",
|
|
56
56
|
children,
|
|
57
|
-
}: PropsWithChildren<FlexProps>)
|
|
57
|
+
}: PropsWithChildren<FlexProps>) {
|
|
58
58
|
return (
|
|
59
59
|
<View testID="ATL-Flex-Row" style={[styles.row, { alignItems: align }]}>
|
|
60
60
|
{Children.map(children, (child, index) => (
|