@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
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.84.4-match-mobi-
|
|
3
|
+
"version": "0.84.4-match-mobi-540af48.10+540af48e1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"build": "npm run build:clean && npm run compile",
|
|
33
33
|
"bootstrap": "npm run build",
|
|
34
34
|
"prepack": "npm run build",
|
|
35
|
-
"compile": "tsc -
|
|
35
|
+
"compile": "tsc -p tsconfig.build.json",
|
|
36
36
|
"build:clean": "rm -rf ./dist",
|
|
37
37
|
"storybook": "storybook dev -p 6008 --disable-telemetry",
|
|
38
|
-
"build
|
|
38
|
+
"storybook:build": "storybook build --disable-telemetry"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@react-native-clipboard/clipboard": "^1.11.2",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"autolinker": "^4.0.0",
|
|
44
44
|
"deepmerge": "^4.2.2",
|
|
45
45
|
"lodash": "^4.17.21",
|
|
46
|
-
"react-hook-form": "^7.
|
|
47
|
-
"react-intl": "^
|
|
46
|
+
"react-hook-form": "^7.52.0",
|
|
47
|
+
"react-intl": "^7.1.11",
|
|
48
48
|
"react-native-keyboard-aware-scroll-view": "^0.9.5",
|
|
49
49
|
"react-native-modalize": "^2.0.13",
|
|
50
50
|
"react-native-portalize": "^1.0.7",
|
|
@@ -53,30 +53,41 @@
|
|
|
53
53
|
"ts-xor": "^1.1.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
+
"@gorhom/bottom-sheet": "^5.2.8",
|
|
57
|
+
"@react-native-community/datetimepicker": "^8.4.5",
|
|
58
|
+
"@react-native/babel-preset": "^0.82.1",
|
|
56
59
|
"@storybook/addon-a11y": "^9.1.2",
|
|
57
60
|
"@storybook/react": "^9.1.2",
|
|
58
61
|
"@storybook/react-native-web-vite": "^9.1.2",
|
|
59
|
-
"@testing-library/
|
|
60
|
-
"@testing-library/react-native": "^12.0.1",
|
|
62
|
+
"@testing-library/react-native": "^13.3.3",
|
|
61
63
|
"@types/lodash.chunk": "^4.2.7",
|
|
62
64
|
"@types/lodash.debounce": "^4.0.7",
|
|
63
65
|
"@types/lodash.identity": "^3.0.7",
|
|
64
|
-
"@types/react": "^18.0.28",
|
|
65
66
|
"@types/react-native-uuid": "^1.4.0",
|
|
66
|
-
"
|
|
67
|
-
"
|
|
67
|
+
"@types/react-test-renderer": "19.1.0",
|
|
68
|
+
"date-fns": "^2.30.0",
|
|
69
|
+
"date-fns-tz": "^2.0.0",
|
|
70
|
+
"react-native": "^0.82.1",
|
|
71
|
+
"react-native-gesture-handler": "^2.29.1",
|
|
72
|
+
"react-native-modal-datetime-picker": "^18.0.0",
|
|
73
|
+
"react-native-reanimated": "^3.7.1",
|
|
74
|
+
"react-native-safe-area-context": "^5.4.0",
|
|
75
|
+
"react-native-svg": "^15.1.0",
|
|
76
|
+
"react-native-web": "^0.20.0",
|
|
77
|
+
"react-test-renderer": "^19.1.1",
|
|
68
78
|
"storybook": "^9.1.2"
|
|
69
79
|
},
|
|
70
80
|
"peerDependencies": {
|
|
71
81
|
"@babel/core": "^7.4.5",
|
|
82
|
+
"@gorhom/bottom-sheet": "^5.2.8",
|
|
72
83
|
"@jobber/design": "*",
|
|
73
84
|
"@react-native-community/datetimepicker": ">=6.7.0",
|
|
74
85
|
"date-fns": "^2.30.0",
|
|
75
86
|
"date-fns-tz": "^2.0.0",
|
|
76
|
-
"react": "^
|
|
77
|
-
"react-intl": "^6
|
|
78
|
-
"react-native": ">=0.
|
|
79
|
-
"react-native-gesture-handler": ">=2.
|
|
87
|
+
"react": "^19",
|
|
88
|
+
"react-intl": "^6 || ^7",
|
|
89
|
+
"react-native": ">=0.79.5",
|
|
90
|
+
"react-native-gesture-handler": ">=2.22.0",
|
|
80
91
|
"react-native-keyboard-aware-scroll-view": "^0.9.5",
|
|
81
92
|
"react-native-modal-datetime-picker": " >=13.0.0",
|
|
82
93
|
"react-native-modalize": "^2.0.13",
|
|
@@ -85,5 +96,5 @@
|
|
|
85
96
|
"react-native-safe-area-context": "^5.4.0",
|
|
86
97
|
"react-native-svg": ">=12.0.0"
|
|
87
98
|
},
|
|
88
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "540af48e1dfd90116999584f50bca29c4ab9e0ba"
|
|
89
100
|
}
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { View } from "react-native";
|
|
3
3
|
import { useStyles } from "./ActionItem.style";
|
|
4
4
|
import { Divider } from "../Divider";
|
|
5
|
-
export function ActionItemGroup({ children
|
|
5
|
+
export function ActionItemGroup({ children }) {
|
|
6
6
|
return React.createElement(View, null, renderChildren(children));
|
|
7
7
|
}
|
|
8
8
|
function renderChildren(children) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Text as RNText } from "react-native";
|
|
3
3
|
import { Text } from "../../../Text";
|
|
4
|
-
export function Link({ children, onPress, onLongPress
|
|
4
|
+
export function Link({ children, onPress, onLongPress }) {
|
|
5
5
|
return (React.createElement(RNText, { onPress: onPress, onLongPress: onLongPress },
|
|
6
6
|
React.createElement(Text, { variation: "interactive" }, children)));
|
|
7
7
|
}
|
|
@@ -1,52 +1,78 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { Modalize } from "react-native-modalize";
|
|
3
|
-
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
1
|
+
import React, { useCallback, useImperativeHandle, useRef } from "react";
|
|
4
2
|
import { Keyboard, View } from "react-native";
|
|
5
|
-
import {
|
|
3
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
4
|
+
import RNBottomSheet, { BottomSheetBackdrop, BottomSheetView, } from "@gorhom/bottom-sheet";
|
|
5
|
+
import { tokens } from "@jobber/design";
|
|
6
6
|
import { useStyles } from "./BottomSheet.style";
|
|
7
|
-
import {
|
|
7
|
+
import { BottomSheetOption } from "./components/BottomSheetOption";
|
|
8
|
+
import { useBottomSheetBackHandler } from "./hooks/useBottomSheetBackHandler";
|
|
8
9
|
import { Divider } from "../Divider";
|
|
9
10
|
import { Heading } from "../Heading";
|
|
11
|
+
import { useIsScreenReaderEnabled } from "../hooks";
|
|
10
12
|
import { useAtlantisI18n } from "../hooks/useAtlantisI18n";
|
|
11
|
-
export
|
|
12
|
-
function BottomSheetInternal({ children, showCancel, loading = false, heading, onOpen, onClose, }, ref) {
|
|
13
|
-
const isScreenReaderEnabled = useIsScreenReaderEnabled();
|
|
14
|
-
const [open, setOpen] = useState(false);
|
|
13
|
+
export function BottomSheet({ children, showCancel, loading = false, heading, onOpen, onClose, ref, }) {
|
|
15
14
|
const styles = useStyles();
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
15
|
+
const isScreenReaderEnabled = useIsScreenReaderEnabled();
|
|
16
|
+
const cancellable = (showCancel && !loading) || isScreenReaderEnabled;
|
|
17
|
+
const { t } = useAtlantisI18n();
|
|
18
|
+
const insets = useSafeAreaInsets();
|
|
19
|
+
const previousIndexRef = useRef(-1);
|
|
20
|
+
const bottomSheetRef = useRef(null);
|
|
21
|
+
const { handleSheetPositionChange } = useBottomSheetBackHandler(bottomSheetRef);
|
|
22
|
+
useImperativeHandle(ref, () => ({
|
|
23
|
+
open: () => {
|
|
24
|
+
var _a;
|
|
25
|
+
(_a = bottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.expand();
|
|
26
|
+
},
|
|
27
|
+
close: () => {
|
|
28
|
+
close();
|
|
29
|
+
},
|
|
30
|
+
}));
|
|
31
|
+
const close = useCallback(() => {
|
|
32
|
+
var _a;
|
|
33
|
+
(_a = bottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
34
|
+
}, []);
|
|
35
|
+
const handleChange = (index) => {
|
|
36
|
+
// Handle Android back button
|
|
37
|
+
handleSheetPositionChange(index);
|
|
38
|
+
const previousIndex = previousIndexRef.current;
|
|
39
|
+
if (previousIndex === -1 && index >= 0) {
|
|
40
|
+
// Transitioned from closed to open
|
|
41
|
+
dismissKeyboard();
|
|
42
|
+
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
43
|
+
}
|
|
44
|
+
else if (previousIndex >= 0 && index === -1) {
|
|
45
|
+
// Transitioned from open to closed
|
|
46
|
+
dismissKeyboard();
|
|
47
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
48
|
+
}
|
|
49
|
+
previousIndexRef.current = index;
|
|
50
|
+
};
|
|
51
|
+
return (React.createElement(RNBottomSheet, { ref: bottomSheetRef, index: -1, backdropComponent: Backdrop, backgroundStyle: styles.background, enablePanDownToClose: true, onChange: handleChange, keyboardBlurBehavior: "restore", handleStyle: styles.handle },
|
|
52
|
+
React.createElement(BottomSheetView, { style: {
|
|
53
|
+
paddingBottom: insets.bottom + tokens["space-small"],
|
|
54
|
+
paddingTop: tokens["space-small"],
|
|
55
|
+
} },
|
|
56
|
+
heading && React.createElement(Header, { heading: heading, styles: styles }),
|
|
57
|
+
children,
|
|
58
|
+
cancellable && (React.createElement(Footer, { styles: styles, close: close, cancelLabel: t("cancel") })))));
|
|
32
59
|
}
|
|
33
60
|
function Header({ heading, styles, }) {
|
|
34
61
|
return (React.createElement(View, { style: styles.header },
|
|
35
62
|
React.createElement(Heading, { level: "subtitle" }, heading)));
|
|
36
63
|
}
|
|
37
|
-
function Footer({
|
|
38
|
-
|
|
39
|
-
const { t } = useAtlantisI18n();
|
|
40
|
-
return (React.createElement(View, { style: { marginBottom: insets.bottom } }, cancellable && (React.createElement(View, { style: styles.children },
|
|
64
|
+
function Footer({ styles, close, cancelLabel, }) {
|
|
65
|
+
return (React.createElement(View, null,
|
|
41
66
|
React.createElement(View, { style: styles.footerDivider },
|
|
42
67
|
React.createElement(Divider, null)),
|
|
43
|
-
React.createElement(BottomSheetOption, { text:
|
|
68
|
+
React.createElement(BottomSheetOption, { text: cancelLabel, icon: "remove", onPress: close })));
|
|
44
69
|
}
|
|
45
70
|
function dismissKeyboard() {
|
|
46
71
|
//Dismisses the keyboard before opening the bottom sheet.
|
|
47
72
|
//In the case where an input text field is focused we don't want to show the bottom sheet behind or above keyboard
|
|
48
73
|
Keyboard.dismiss();
|
|
49
74
|
}
|
|
50
|
-
function
|
|
51
|
-
|
|
75
|
+
function Backdrop(bottomSheetBackdropProps) {
|
|
76
|
+
const styles = useStyles();
|
|
77
|
+
return (React.createElement(BottomSheetBackdrop, Object.assign({}, bottomSheetBackdropProps, { appearsOnIndex: 0, disappearsOnIndex: -1, style: styles.backdrop, opacity: 1 })));
|
|
52
78
|
}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import { Dimensions, StyleSheet } from "react-native";
|
|
2
1
|
import { buildThemedStyles } from "../AtlantisThemeContext";
|
|
3
|
-
const { height } = Dimensions.get("window");
|
|
4
2
|
export const useStyles = buildThemedStyles(tokens => {
|
|
5
3
|
const modalBorderRadius = tokens["radius-larger"];
|
|
6
4
|
return {
|
|
7
|
-
|
|
8
|
-
backgroundColor: "
|
|
5
|
+
backdrop: {
|
|
6
|
+
backgroundColor: tokens["color-overlay"],
|
|
9
7
|
},
|
|
10
|
-
|
|
11
|
-
modal: {
|
|
8
|
+
background: {
|
|
12
9
|
borderTopLeftRadius: modalBorderRadius,
|
|
13
10
|
borderTopRightRadius: modalBorderRadius,
|
|
14
|
-
paddingTop: tokens["space-small"],
|
|
15
11
|
},
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
footerContainer: {
|
|
13
|
+
backgroundColor: tokens["color-surface"],
|
|
18
14
|
},
|
|
19
15
|
header: {
|
|
20
16
|
paddingHorizontal: tokens["space-base"],
|
|
@@ -26,5 +22,8 @@ export const useStyles = buildThemedStyles(tokens => {
|
|
|
26
22
|
marginTop: tokens["space-small"],
|
|
27
23
|
marginBottom: tokens["space-smaller"],
|
|
28
24
|
},
|
|
25
|
+
handle: {
|
|
26
|
+
display: "none",
|
|
27
|
+
},
|
|
29
28
|
};
|
|
30
29
|
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useCallback, useRef } from "react";
|
|
2
|
+
import { BackHandler } from "react-native";
|
|
3
|
+
/**
|
|
4
|
+
* Hook that closes the bottom sheet on the hardware back button press if it is visible
|
|
5
|
+
* @param bottomSheetRef ref to the bottom sheet component
|
|
6
|
+
*/
|
|
7
|
+
export function useBottomSheetBackHandler(bottomSheetRef) {
|
|
8
|
+
const backHandlerSubscriptionRef = useRef(null);
|
|
9
|
+
const handleSheetPositionChange = useCallback((index) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const isBottomSheetVisible = index >= 0;
|
|
12
|
+
if (isBottomSheetVisible && !backHandlerSubscriptionRef.current) {
|
|
13
|
+
// Setup the back handler if the bottom sheet is right in front of the user
|
|
14
|
+
backHandlerSubscriptionRef.current = BackHandler.addEventListener("hardwareBackPress", () => {
|
|
15
|
+
var _a;
|
|
16
|
+
(_a = bottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
17
|
+
return true;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
else if (!isBottomSheetVisible) {
|
|
21
|
+
(_a = backHandlerSubscriptionRef.current) === null || _a === void 0 ? void 0 : _a.remove();
|
|
22
|
+
backHandlerSubscriptionRef.current = null;
|
|
23
|
+
}
|
|
24
|
+
}, [bottomSheetRef]);
|
|
25
|
+
return { handleSheetPositionChange };
|
|
26
|
+
}
|
|
@@ -8,7 +8,6 @@ const offset = PixelRatio.roundToNearestPixel(imageWidth / PixelRatio.get());
|
|
|
8
8
|
const leftOffset = -1 * offset;
|
|
9
9
|
// looks like deprecation for FlatList in reanimated is cascading down to other exports
|
|
10
10
|
// This is not createAnimatedComponent(FlatList), we are fine
|
|
11
|
-
// eslint-disable-next-line import/no-deprecated
|
|
12
11
|
const AnimatedImage = Animated.createAnimatedComponent(ImageBackground);
|
|
13
12
|
function InternalButtonLoadingInternal({ variation, type, }) {
|
|
14
13
|
const translateX = useSharedValue(0);
|
|
@@ -9,7 +9,7 @@ import { useAtlantisI18n } from "../hooks/useAtlantisI18n";
|
|
|
9
9
|
export function ButtonGroup({ children, showCancelInBottomSheet, bottomSheetHeading, onOpenBottomSheet, onCloseBottomSheet, allowTapWhenOffline = false, }) {
|
|
10
10
|
const { t } = useAtlantisI18n();
|
|
11
11
|
const { handlePress } = usePreventTapWhenOffline();
|
|
12
|
-
const secondaryActionsRef = useRef();
|
|
12
|
+
const secondaryActionsRef = useRef(null);
|
|
13
13
|
const { primaryActions, secondaryActions } = getActions(children);
|
|
14
14
|
const styles = useStyles();
|
|
15
15
|
return (React.createElement(View, { style: styles.buttonGroup },
|
package/dist/src/Chip/Chip.js
CHANGED
|
@@ -19,6 +19,7 @@ export function Chip({ icon, label, onPress, isDismissible, isActive, inactiveBa
|
|
|
19
19
|
: tokens["color-interactive--background"],
|
|
20
20
|
},
|
|
21
21
|
isActive && { backgroundColor: accentColor },
|
|
22
|
+
getBorderStyle(inactiveBackgroundColor, tokens),
|
|
22
23
|
];
|
|
23
24
|
const dismiss = (isActive || inactiveBackgroundColor === "surface") &&
|
|
24
25
|
styles.activeDismissIcon;
|
|
@@ -27,7 +28,7 @@ export function Chip({ icon, label, onPress, isDismissible, isActive, inactiveBa
|
|
|
27
28
|
iconCustomColor: iconColor,
|
|
28
29
|
dismissColor: dismiss,
|
|
29
30
|
};
|
|
30
|
-
}, [accent, isActive, inactiveBackgroundColor]);
|
|
31
|
+
}, [accent, isActive, inactiveBackgroundColor, getBorderStyle, styles]);
|
|
31
32
|
const accessibilityState = useMemo(() => {
|
|
32
33
|
const checkableRoles = ["radio", "switch", "togglebutton", "checkbox"];
|
|
33
34
|
if (checkableRoles.includes(accessibilityRole)) {
|
|
@@ -43,3 +44,13 @@ export function Chip({ icon, label, onPress, isDismissible, isActive, inactiveBa
|
|
|
43
44
|
isDismissible && (React.createElement(View, { style: [styles.dismissIcon, dismissColor] },
|
|
44
45
|
React.createElement(Icon, { name: "remove", size: "small" })))));
|
|
45
46
|
}
|
|
47
|
+
function getBorderStyle(inactiveBackgroundColor, tokens) {
|
|
48
|
+
let borderColor = "transparent";
|
|
49
|
+
if (inactiveBackgroundColor === "surface") {
|
|
50
|
+
borderColor = tokens["color-border"];
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
borderColor,
|
|
54
|
+
borderWidth: tokens["border-base"],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -10,7 +10,7 @@ export const useStyles = buildThemedStyles(tokens => {
|
|
|
10
10
|
justifyContent: "center",
|
|
11
11
|
marginHorizontal: tokens["space-smaller"],
|
|
12
12
|
marginTop: tokens["space-small"],
|
|
13
|
-
paddingHorizontal: tokens["space-
|
|
13
|
+
paddingHorizontal: tokens["space-base"],
|
|
14
14
|
},
|
|
15
15
|
iconLeft: {
|
|
16
16
|
marginHorizontal: tokens["space-smallest"],
|
|
@@ -12,6 +12,9 @@ export const useHorizontalStyles = buildThemedStyles(tokens => {
|
|
|
12
12
|
noneChildSpace: {
|
|
13
13
|
padding: 0,
|
|
14
14
|
},
|
|
15
|
+
minusculeChildSpace: {
|
|
16
|
+
paddingLeft: tokens["space-minuscule"],
|
|
17
|
+
},
|
|
15
18
|
smallestChildSpace: {
|
|
16
19
|
paddingLeft: tokens["space-smallest"],
|
|
17
20
|
},
|
|
@@ -21,11 +24,23 @@ export const useHorizontalStyles = buildThemedStyles(tokens => {
|
|
|
21
24
|
smallChildSpace: {
|
|
22
25
|
paddingLeft: tokens["space-small"],
|
|
23
26
|
},
|
|
27
|
+
slimChildSpace: {
|
|
28
|
+
paddingLeft: tokens["space-slim"],
|
|
29
|
+
},
|
|
24
30
|
baseChildSpace: {
|
|
25
31
|
paddingLeft: tokens["space-base"],
|
|
26
32
|
},
|
|
27
33
|
largeChildSpace: {
|
|
28
34
|
paddingLeft: tokens["space-large"],
|
|
29
35
|
},
|
|
36
|
+
largerChildSpace: {
|
|
37
|
+
paddingLeft: tokens["space-larger"],
|
|
38
|
+
},
|
|
39
|
+
largestChildSpace: {
|
|
40
|
+
paddingLeft: tokens["space-largest"],
|
|
41
|
+
},
|
|
42
|
+
extravagantChildSpace: {
|
|
43
|
+
paddingLeft: tokens["space-extravagant"],
|
|
44
|
+
},
|
|
30
45
|
};
|
|
31
46
|
});
|
|
@@ -4,6 +4,9 @@ export const useSpaceAroundStyles = buildThemedStyles(tokens => {
|
|
|
4
4
|
noneSpace: {
|
|
5
5
|
padding: 0,
|
|
6
6
|
},
|
|
7
|
+
minusculeSpace: {
|
|
8
|
+
padding: tokens["space-minuscule"],
|
|
9
|
+
},
|
|
7
10
|
smallestSpace: {
|
|
8
11
|
padding: tokens["space-smallest"],
|
|
9
12
|
},
|
|
@@ -13,11 +16,23 @@ export const useSpaceAroundStyles = buildThemedStyles(tokens => {
|
|
|
13
16
|
smallSpace: {
|
|
14
17
|
padding: tokens["space-small"],
|
|
15
18
|
},
|
|
19
|
+
slimSpace: {
|
|
20
|
+
padding: tokens["space-slim"],
|
|
21
|
+
},
|
|
16
22
|
baseSpace: {
|
|
17
23
|
padding: tokens["space-base"],
|
|
18
24
|
},
|
|
19
25
|
largeSpace: {
|
|
20
26
|
padding: tokens["space-large"],
|
|
21
27
|
},
|
|
28
|
+
largerSpace: {
|
|
29
|
+
padding: tokens["space-larger"],
|
|
30
|
+
},
|
|
31
|
+
largestSpace: {
|
|
32
|
+
padding: tokens["space-largest"],
|
|
33
|
+
},
|
|
34
|
+
extravagantSpace: {
|
|
35
|
+
padding: tokens["space-extravagant"],
|
|
36
|
+
},
|
|
22
37
|
};
|
|
23
38
|
});
|
|
@@ -12,6 +12,9 @@ export const useVerticalStyles = buildThemedStyles(tokens => {
|
|
|
12
12
|
noneChildSpace: {
|
|
13
13
|
padding: 0,
|
|
14
14
|
},
|
|
15
|
+
minusculeChildSpace: {
|
|
16
|
+
paddingTop: tokens["space-minuscule"],
|
|
17
|
+
},
|
|
15
18
|
smallestChildSpace: {
|
|
16
19
|
paddingTop: tokens["space-smallest"],
|
|
17
20
|
},
|
|
@@ -21,11 +24,23 @@ export const useVerticalStyles = buildThemedStyles(tokens => {
|
|
|
21
24
|
smallChildSpace: {
|
|
22
25
|
paddingTop: tokens["space-small"],
|
|
23
26
|
},
|
|
27
|
+
slimChildSpace: {
|
|
28
|
+
paddingTop: tokens["space-slim"],
|
|
29
|
+
},
|
|
24
30
|
baseChildSpace: {
|
|
25
31
|
paddingTop: tokens["space-base"],
|
|
26
32
|
},
|
|
27
33
|
largeChildSpace: {
|
|
28
34
|
paddingTop: tokens["space-large"],
|
|
29
35
|
},
|
|
36
|
+
largerChildSpace: {
|
|
37
|
+
paddingTop: tokens["space-larger"],
|
|
38
|
+
},
|
|
39
|
+
largestChildSpace: {
|
|
40
|
+
paddingTop: tokens["space-largest"],
|
|
41
|
+
},
|
|
42
|
+
extravagantChildSpace: {
|
|
43
|
+
paddingTop: tokens["space-extravagant"],
|
|
44
|
+
},
|
|
30
45
|
};
|
|
31
46
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { forwardRef, useCallback, useImperativeHandle, useMemo, useRef, useState, } from "react";
|
|
2
|
-
import { Modalize } from "react-native-modalize";
|
|
3
2
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
4
3
|
import { AccessibilityInfo, Platform, View, findNodeHandle, useWindowDimensions, } from "react-native";
|
|
5
4
|
import { Portal } from "react-native-portalize";
|
|
6
5
|
import { useKeyboardVisibility } from "./hooks/useKeyboardVisibility";
|
|
7
6
|
import { useStyles } from "./ContentOverlay.style";
|
|
8
7
|
import { useViewLayoutHeight } from "./hooks/useViewLayoutHeight";
|
|
8
|
+
import { UNSAFE_WrappedModalize } from "./UNSAFE_WrappedModalize";
|
|
9
9
|
import { useIsScreenReaderEnabled } from "../hooks";
|
|
10
10
|
import { IconButton } from "../IconButton";
|
|
11
11
|
import { Heading } from "../Heading";
|
|
@@ -26,8 +26,8 @@ function ContentOverlayInternal({ children, title, accessibilityLabel, fullScree
|
|
|
26
26
|
const isFullScreenOrTopPosition = fullScreen || (!adjustToContentHeight && position === "top");
|
|
27
27
|
const shouldShowDismiss = showDismiss || isScreenReaderEnabled || isFullScreenOrTopPosition;
|
|
28
28
|
const [showHeaderShadow, setShowHeaderShadow] = useState(false);
|
|
29
|
-
const overlayHeader = useRef();
|
|
30
|
-
const internalRef = useRef();
|
|
29
|
+
const overlayHeader = useRef(null);
|
|
30
|
+
const internalRef = useRef(null);
|
|
31
31
|
const [modalizeMethods, setModalizeMethods] = useState();
|
|
32
32
|
const callbackInternalRef = useCallback((instance) => {
|
|
33
33
|
if (instance && !internalRef.current) {
|
|
@@ -86,7 +86,7 @@ function ContentOverlayInternal({ children, title, accessibilityLabel, fullScree
|
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
88
|
return (React.createElement(React.Fragment, null,
|
|
89
|
-
headerHeightKnown && childrenHeightKnown && (React.createElement(
|
|
89
|
+
headerHeightKnown && childrenHeightKnown && (React.createElement(UNSAFE_WrappedModalize, { ref: callbackInternalRef, overlayStyle: styles.overlay, handleStyle: styles.handle, handlePosition: "inside", modalStyle: modalStyle, modalTopOffset: tokens["space-larger"], snapPoint: snapPoint, closeSnapPointStraightEnabled: false, withHandle: isDraggable, panGestureEnabled: isDraggable, adjustToContentHeight: adjustToContentHeight, disableScrollIfPossible: !adjustToContentHeight, onClose: onClose, onOpen: onOpen, keyboardAvoidingBehavior: keyboardAvoidingBehavior, avoidKeyboardLikeIOS: avoidKeyboardLikeIOS, childrenStyle: styles.childrenStyle, onBackButtonPress: onCloseController, closeOnOverlayTap: isCloseableOnOverlayTap, onOpened: () => {
|
|
90
90
|
if (overlayHeader.current) {
|
|
91
91
|
const reactTag = findNodeHandle(overlayHeader.current);
|
|
92
92
|
if (reactTag) {
|
|
@@ -124,9 +124,7 @@ function ContentOverlayInternal({ children, title, accessibilityLabel, fullScree
|
|
|
124
124
|
: styles.titleWithoutDismiss,
|
|
125
125
|
] },
|
|
126
126
|
React.createElement(Heading, { level: "subtitle", variation: loading ? "subdued" : "heading", align: "start" }, title)),
|
|
127
|
-
shouldShowDismiss && (React.createElement(View, { style: styles.dismissButton,
|
|
128
|
-
// @ts-expect-error tsc-ci
|
|
129
|
-
ref: overlayHeader, accessibilityLabel: accessibilityLabel || closeOverlayA11YLabel, accessible: true },
|
|
127
|
+
shouldShowDismiss && (React.createElement(View, { style: styles.dismissButton, ref: overlayHeader, accessibilityLabel: accessibilityLabel || closeOverlayA11YLabel, accessible: true },
|
|
130
128
|
React.createElement(IconButton, { name: "cross", customColor: loading ? tokens["color-disabled"] : tokens["color-heading"], onPress: () => onCloseController(), accessibilityLabel: closeOverlayA11YLabel, testID: "ATL-Overlay-CloseButton" }))))));
|
|
131
129
|
}
|
|
132
130
|
function renderChildren() {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { forwardRef, useImperativeHandle, useRef, useState, } from "react";
|
|
2
|
+
import { Modalize } from "react-native-modalize";
|
|
3
|
+
export const UNSAFE_WrappedModalize = forwardRef((props, ref) => {
|
|
4
|
+
const innerRef = useRef(null);
|
|
5
|
+
const [openRenderId, setOpenRenderId] = useState(0);
|
|
6
|
+
useImperativeHandle(ref, () => ({
|
|
7
|
+
open(dest) {
|
|
8
|
+
setOpenRenderId(id => id + 1);
|
|
9
|
+
// Open on a fresh tick for additional safety
|
|
10
|
+
requestAnimationFrame(() => {
|
|
11
|
+
var _a;
|
|
12
|
+
(_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.open(dest);
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
close(dest) {
|
|
16
|
+
var _a;
|
|
17
|
+
(_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.close(dest);
|
|
18
|
+
},
|
|
19
|
+
}), []);
|
|
20
|
+
// Use a unique key to force a remount, ensuring we get fresh gesture handler nodes within modalize
|
|
21
|
+
return (React.createElement(Modalize, Object.assign({ key: `modalize-${openRenderId}`, ref: innerRef }, props)));
|
|
22
|
+
});
|
|
23
|
+
UNSAFE_WrappedModalize.displayName = "UNSAFE_WrappedModalize";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { AccessibilityInfo, findNodeHandle } from "react-native";
|
|
3
3
|
import { ErrorMessageContext } from "./ErrorMessageContext";
|
|
4
|
-
export function ErrorMessageProvider({ children
|
|
4
|
+
export function ErrorMessageProvider({ children }) {
|
|
5
5
|
const [elements, setElements] = useState({});
|
|
6
6
|
return (React.createElement(ErrorMessageContext.Provider, { value: {
|
|
7
7
|
elements,
|
package/dist/src/Form/Form.js
CHANGED
|
@@ -38,6 +38,7 @@ import { useScrollToError } from "./hooks/useScrollToError";
|
|
|
38
38
|
import { FormSaveButton } from "./components/FormSaveButton";
|
|
39
39
|
import { useSaveButtonPosition } from "./hooks/useSaveButtonPosition";
|
|
40
40
|
import { FormCache } from "./components/FormCache/FormCache";
|
|
41
|
+
import { useAtlantisFormContext } from "./context/AtlantisFormContext";
|
|
41
42
|
import { InputAccessoriesProvider } from "../InputText";
|
|
42
43
|
import { tokens } from "../utils/design";
|
|
43
44
|
import { ErrorMessageProvider } from "../ErrorMessageWrapper";
|
|
@@ -48,7 +49,7 @@ export function Form(_a) {
|
|
|
48
49
|
React.createElement(ErrorMessageProvider, null, child)));
|
|
49
50
|
}
|
|
50
51
|
// eslint-disable-next-line max-statements
|
|
51
|
-
function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSubmitSuccess, bannerErrors, bannerMessages, initialValues, mode = "onTouched", reValidateMode = "onChange", formRef, saveButtonLabel, renderStickySection, localCacheKey, localCacheExclude, localCacheId, secondaryActions, saveButtonOffset, showStickySaveButton = false, renderFooter, }) {
|
|
52
|
+
function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSubmitSuccess, bannerErrors, bannerMessages, initialValues, mode = "onTouched", reValidateMode = "onChange", formRef, saveButtonLabel, renderStickySection, localCacheKey, localCacheExclude, localCacheId, secondaryActions, saveButtonOffset, showStickySaveButton = false, renderFooter, UNSAFE_allowDiscardLocalCacheWhenOffline, }) {
|
|
52
53
|
var _a;
|
|
53
54
|
const { scrollViewRef, bottomViewRef, scrollToTop } = useFormViewRefs();
|
|
54
55
|
const [saveButtonHeight, setSaveButtonHeight] = useState(0);
|
|
@@ -64,6 +65,7 @@ function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSub
|
|
|
64
65
|
scrollViewRef,
|
|
65
66
|
saveButtonHeight,
|
|
66
67
|
messageBannerHeight,
|
|
68
|
+
UNSAFE_allowDiscardLocalCacheWhenOffline,
|
|
67
69
|
});
|
|
68
70
|
const { windowHeight, headerHeight } = useScreenInformation();
|
|
69
71
|
const [keyboardHeight, setKeyboardHeight] = useState(0);
|
|
@@ -102,12 +104,13 @@ function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSub
|
|
|
102
104
|
setMessageBannerHeight(event.nativeEvent.layout.height);
|
|
103
105
|
};
|
|
104
106
|
const styles = useStyles();
|
|
107
|
+
const { edgeToEdgeEnabled } = useAtlantisFormContext();
|
|
105
108
|
return (React.createElement(FormProvider, Object.assign({}, formMethods),
|
|
106
109
|
React.createElement(React.Fragment, null,
|
|
107
110
|
(isSubmitting || isSecondaryActionLoading) && React.createElement(FormMask, null),
|
|
108
111
|
React.createElement(FormCache, { localCacheKey: localCacheKey, localCacheExclude: localCacheExclude, setLocalCache: setLocalCache }),
|
|
109
112
|
React.createElement(FormBody, { keyboardHeight: calculateSaveButtonOffset(), submit: handleSubmit(internalSubmit), isFormSubmitting: isSubmitting, saveButtonLabel: saveButtonLabel, shouldRenderActionBar: saveButtonPosition === "sticky", renderStickySection: renderStickySection, secondaryActions: secondaryActions, setSecondaryActionLoading: setIsSecondaryActionLoading, setSaveButtonHeight: setSaveButtonHeight, saveButtonOffset: saveButtonOffset },
|
|
110
|
-
React.createElement(KeyboardAwareScrollView, Object.assign({ enableResetScrollToCoords: false, enableAutomaticScroll: true, keyboardOpeningTime: Platform.OS === "ios" ? tokens["timing-slowest"] : 0, keyboardShouldPersistTaps: "handled", ref: scrollViewRef }, keyboardProps, { extraHeight: headerHeight, contentContainerStyle: !keyboardHeight && styles.scrollContentContainer }),
|
|
113
|
+
React.createElement(KeyboardAwareScrollView, Object.assign({ enableResetScrollToCoords: false, enableAutomaticScroll: true, enableOnAndroid: edgeToEdgeEnabled, keyboardOpeningTime: Platform.OS === "ios" ? tokens["timing-slowest"] : 0, keyboardShouldPersistTaps: "handled", ref: scrollViewRef }, keyboardProps, { extraHeight: headerHeight, extraScrollHeight: edgeToEdgeEnabled ? tokens["space-large"] : 0, contentContainerStyle: !keyboardHeight && styles.scrollContentContainer }),
|
|
111
114
|
React.createElement(View, { onLayout: ({ nativeEvent }) => {
|
|
112
115
|
setFormContentHeight(nativeEvent.layout.height);
|
|
113
116
|
} },
|
|
@@ -28,5 +28,6 @@ export function FormCache({ localCacheExclude, localCacheKey, setLocalCache, })
|
|
|
28
28
|
setLocalCache(formData);
|
|
29
29
|
}
|
|
30
30
|
}, [formData, isDirty, localCacheExclude, setLocalCache, shouldExclude]);
|
|
31
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
31
32
|
return React.createElement(React.Fragment, null);
|
|
32
33
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { FormBannerMessageType } from "../../types";
|
|
3
3
|
import { Banner } from "../../../Banner";
|
|
4
|
-
export function FormMessageBanner({ bannerMessages
|
|
4
|
+
export function FormMessageBanner({ bannerMessages }) {
|
|
5
5
|
return (React.createElement(React.Fragment, null, bannerMessages === null || bannerMessages === void 0 ? void 0 : bannerMessages.map((message, index) => (React.createElement(Banner, { key: index, text: message.message, type: getBannerType(message.messageType) })))));
|
|
6
6
|
}
|
|
7
7
|
function getBannerType(messageType) {
|
|
@@ -8,6 +8,7 @@ export const atlantisFormContextDefaultValues = {
|
|
|
8
8
|
setLocalCache: () => undefined,
|
|
9
9
|
removeLocalCache: () => undefined,
|
|
10
10
|
}),
|
|
11
|
+
edgeToEdgeEnabled: false,
|
|
11
12
|
};
|
|
12
13
|
export const AtlantisFormContext = createContext(atlantisFormContextDefaultValues);
|
|
13
14
|
export function useAtlantisFormContext() {
|