@zj-dynamics/components-native 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/NOTICE.foundation +21 -0
- package/README.md +20 -2
- package/RulnarComponentsNative.podspec +16 -0
- package/dist/AutoLink.d.ts +9 -0
- package/dist/AutoLink.js +63 -0
- package/dist/BottomSheetKeyboardAwareScrollView.d.ts +12 -0
- package/dist/BottomSheetKeyboardAwareScrollView.js +19 -0
- package/dist/Button.d.ts +37 -0
- package/dist/Button.js +24 -0
- package/dist/Checkbox.d.ts +37 -0
- package/dist/Checkbox.js +73 -0
- package/dist/Content.d.ts +16 -0
- package/dist/Content.js +17 -0
- package/dist/ContentOverlay.d.ts +31 -0
- package/dist/ContentOverlay.js +151 -0
- package/dist/Divider.d.ts +6 -0
- package/dist/Divider.js +20 -0
- package/dist/Flex.d.ts +10 -0
- package/dist/Flex.js +19 -0
- package/dist/Icon.d.ts +11 -0
- package/dist/Icon.js +17 -0
- package/dist/InputCurrency.d.ts +12 -0
- package/dist/InputCurrency.js +57 -0
- package/dist/InputText.d.ts +32 -0
- package/dist/InputText.js +103 -0
- package/dist/NativeTextFields.d.ts +22 -0
- package/dist/NativeTextFields.js +59 -0
- package/dist/Switch.d.ts +17 -0
- package/dist/Switch.js +27 -0
- package/dist/controlledField.d.ts +4 -0
- package/dist/controlledField.js +9 -0
- package/dist/foundationText/ActionItem/ActionItem.d.ts +42 -0
- package/dist/foundationText/ActionItem/ActionItem.js +31 -0
- package/dist/foundationText/ActionItem/ActionItem.style.d.ts +21 -0
- package/dist/foundationText/ActionItem/ActionItem.style.js +24 -0
- package/dist/foundationText/ActionItem/ActionItemGroup.d.ts +12 -0
- package/dist/foundationText/ActionItem/ActionItemGroup.js +18 -0
- package/dist/foundationText/ActionItem/components/ActionItemContainer.d.ts +10 -0
- package/dist/foundationText/ActionItem/components/ActionItemContainer.js +17 -0
- package/dist/foundationText/ActionItem/components/ActionItemContainer.style.d.ts +10 -0
- package/dist/foundationText/ActionItem/components/ActionItemContainer.style.js +13 -0
- package/dist/foundationText/ActionItem/index.d.ts +4 -0
- package/dist/foundationText/ActionItem/index.js +3 -0
- package/dist/foundationText/ActionLabel/ActionLabel.d.ts +28 -0
- package/dist/foundationText/ActionLabel/ActionLabel.js +22 -0
- package/dist/foundationText/ActionLabel/index.d.ts +2 -0
- package/dist/foundationText/ActionLabel/index.js +1 -0
- package/dist/foundationText/ActivityIndicator/ActivityIndicator.d.ts +46 -0
- package/dist/foundationText/ActivityIndicator/ActivityIndicator.js +191 -0
- package/dist/foundationText/ActivityIndicator/index.d.ts +2 -0
- package/dist/foundationText/ActivityIndicator/index.js +1 -0
- package/dist/foundationText/Banner/Banner.d.ts +3 -0
- package/dist/foundationText/Banner/Banner.js +64 -0
- package/dist/foundationText/Banner/Banner.style.d.ts +56 -0
- package/dist/foundationText/Banner/Banner.style.js +59 -0
- package/dist/foundationText/Banner/components/BannerIcon/BannerIcon.d.ts +8 -0
- package/dist/foundationText/Banner/components/BannerIcon/BannerIcon.js +9 -0
- package/dist/foundationText/Banner/components/BannerIcon/BannerIcon.style.d.ts +18 -0
- package/dist/foundationText/Banner/components/BannerIcon/BannerIcon.style.js +21 -0
- package/dist/foundationText/Banner/index.d.ts +2 -0
- package/dist/foundationText/Banner/index.js +1 -0
- package/dist/foundationText/Banner/types.d.ts +63 -0
- package/dist/foundationText/Banner/types.js +1 -0
- package/dist/foundationText/BottomSheet/BottomSheet.d.ts +32 -0
- package/dist/foundationText/BottomSheet/BottomSheet.js +75 -0
- package/dist/foundationText/BottomSheet/BottomSheet.style.d.ts +26 -0
- package/dist/foundationText/BottomSheet/BottomSheet.style.js +30 -0
- package/dist/foundationText/BottomSheet/components/BottomSheetOption/BottomSheetOption.d.ts +13 -0
- package/dist/foundationText/BottomSheet/components/BottomSheetOption/BottomSheetOption.js +16 -0
- package/dist/foundationText/BottomSheet/components/BottomSheetOption/BottomSheetOption.styles.d.ts +16 -0
- package/dist/foundationText/BottomSheet/components/BottomSheetOption/BottomSheetOption.styles.js +19 -0
- package/dist/foundationText/BottomSheet/components/BottomSheetOption/index.d.ts +2 -0
- package/dist/foundationText/BottomSheet/components/BottomSheetOption/index.js +1 -0
- package/dist/foundationText/BottomSheet/hooks/useBottomSheetBackHandler.d.ts +8 -0
- package/dist/foundationText/BottomSheet/hooks/useBottomSheetBackHandler.js +25 -0
- package/dist/foundationText/BottomSheet/index.d.ts +4 -0
- package/dist/foundationText/BottomSheet/index.js +2 -0
- package/dist/foundationText/ButtonGroup/ButtonGroup.d.ts +30 -0
- package/dist/foundationText/ButtonGroup/ButtonGroup.js +25 -0
- package/dist/foundationText/ButtonGroup/ButtonGroup.style.d.ts +16 -0
- package/dist/foundationText/ButtonGroup/ButtonGroup.style.js +19 -0
- package/dist/foundationText/ButtonGroup/ButtonGroupAction.d.ts +47 -0
- package/dist/foundationText/ButtonGroup/ButtonGroupAction.js +11 -0
- package/dist/foundationText/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.d.ts +14 -0
- package/dist/foundationText/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.js +15 -0
- package/dist/foundationText/ButtonGroup/components/SecondaryActionSheet/index.d.ts +1 -0
- package/dist/foundationText/ButtonGroup/components/SecondaryActionSheet/index.js +1 -0
- package/dist/foundationText/ButtonGroup/index.d.ts +3 -0
- package/dist/foundationText/ButtonGroup/index.js +2 -0
- package/dist/foundationText/ButtonGroup/types.d.ts +7 -0
- package/dist/foundationText/ButtonGroup/types.js +1 -0
- package/dist/foundationText/ButtonGroup/utils.d.ts +19 -0
- package/dist/foundationText/ButtonGroup/utils.js +41 -0
- package/dist/foundationText/Card/Card.d.ts +41 -0
- package/dist/foundationText/Card/Card.js +26 -0
- package/dist/foundationText/Card/Card.style.d.ts +56 -0
- package/dist/foundationText/Card/Card.style.js +38 -0
- package/dist/foundationText/Card/components/InternalCardHeader.d.ts +10 -0
- package/dist/foundationText/Card/components/InternalCardHeader.js +16 -0
- package/dist/foundationText/Card/components/InternalCardHeader.style.d.ts +14 -0
- package/dist/foundationText/Card/components/InternalCardHeader.style.js +17 -0
- package/dist/foundationText/Card/components/index.d.ts +1 -0
- package/dist/foundationText/Card/components/index.js +1 -0
- package/dist/foundationText/Card/index.d.ts +2 -0
- package/dist/foundationText/Card/index.js +1 -0
- package/dist/foundationText/Chip/Chip.d.ts +45 -0
- package/dist/foundationText/Chip/Chip.js +88 -0
- package/dist/foundationText/Chip/Chip.style.d.ts +27 -0
- package/dist/foundationText/Chip/Chip.style.js +31 -0
- package/dist/foundationText/Chip/index.d.ts +2 -0
- package/dist/foundationText/Chip/index.js +1 -0
- package/dist/foundationText/ComponentSettingsContext/ComponentSettingsContext.d.ts +57 -0
- package/dist/foundationText/ComponentSettingsContext/ComponentSettingsContext.js +26 -0
- package/dist/foundationText/ComponentSettingsContext/index.d.ts +1 -0
- package/dist/foundationText/ComponentSettingsContext/index.js +1 -0
- package/dist/foundationText/Disclosure/Disclosure.d.ts +35 -0
- package/dist/foundationText/Disclosure/Disclosure.js +51 -0
- package/dist/foundationText/Disclosure/Disclosure.style.d.ts +19 -0
- package/dist/foundationText/Disclosure/Disclosure.style.js +22 -0
- package/dist/foundationText/Disclosure/constants.d.ts +1 -0
- package/dist/foundationText/Disclosure/constants.js +1 -0
- package/dist/foundationText/Disclosure/index.d.ts +1 -0
- package/dist/foundationText/Disclosure/index.js +1 -0
- package/dist/foundationText/EmptyState/EmptyState.d.ts +35 -0
- package/dist/foundationText/EmptyState/EmptyState.js +18 -0
- package/dist/foundationText/EmptyState/EmptyState.style.d.ts +6 -0
- package/dist/foundationText/EmptyState/EmptyState.style.js +9 -0
- package/dist/foundationText/EmptyState/index.d.ts +2 -0
- package/dist/foundationText/EmptyState/index.js +1 -0
- package/dist/foundationText/ErrorMessageWrapper/ErrorMessageWrapper.d.ts +22 -0
- package/dist/foundationText/ErrorMessageWrapper/ErrorMessageWrapper.js +35 -0
- package/dist/foundationText/ErrorMessageWrapper/ErrorMessageWrapper.style.d.ts +29 -0
- package/dist/foundationText/ErrorMessageWrapper/ErrorMessageWrapper.style.js +32 -0
- package/dist/foundationText/ErrorMessageWrapper/context/ErrorMessageContext.d.ts +3 -0
- package/dist/foundationText/ErrorMessageWrapper/context/ErrorMessageContext.js +11 -0
- package/dist/foundationText/ErrorMessageWrapper/context/ErrorMessageProvider.d.ts +7 -0
- package/dist/foundationText/ErrorMessageWrapper/context/ErrorMessageProvider.js +38 -0
- package/dist/foundationText/ErrorMessageWrapper/context/index.d.ts +2 -0
- package/dist/foundationText/ErrorMessageWrapper/context/index.js +2 -0
- package/dist/foundationText/ErrorMessageWrapper/context/types.d.ts +62 -0
- package/dist/foundationText/ErrorMessageWrapper/context/types.js +1 -0
- package/dist/foundationText/ErrorMessageWrapper/index.d.ts +2 -0
- package/dist/foundationText/ErrorMessageWrapper/index.js +2 -0
- package/dist/foundationText/Form/Form.d.ts +4 -0
- package/dist/foundationText/Form/Form.js +142 -0
- package/dist/foundationText/Form/Form.style.d.ts +31 -0
- package/dist/foundationText/Form/Form.style.js +34 -0
- package/dist/foundationText/Form/components/FormActionBar/FormActionBar.d.ts +13 -0
- package/dist/foundationText/Form/components/FormActionBar/FormActionBar.js +21 -0
- package/dist/foundationText/Form/components/FormActionBar/FormActionBar.style.d.ts +15 -0
- package/dist/foundationText/Form/components/FormActionBar/FormActionBar.style.js +11 -0
- package/dist/foundationText/Form/components/FormActionBar/index.d.ts +2 -0
- package/dist/foundationText/Form/components/FormActionBar/index.js +1 -0
- package/dist/foundationText/Form/components/FormBody/FormBody.d.ts +10 -0
- package/dist/foundationText/Form/components/FormBody/FormBody.js +18 -0
- package/dist/foundationText/Form/components/FormBody/FormBody.style.d.ts +24 -0
- package/dist/foundationText/Form/components/FormBody/FormBody.style.js +27 -0
- package/dist/foundationText/Form/components/FormBody/index.d.ts +1 -0
- package/dist/foundationText/Form/components/FormBody/index.js +1 -0
- package/dist/foundationText/Form/components/FormCache/FormCache.d.ts +10 -0
- package/dist/foundationText/Form/components/FormCache/FormCache.js +28 -0
- package/dist/foundationText/Form/components/FormErrorBanner/FormErrorBanner.d.ts +3 -0
- package/dist/foundationText/Form/components/FormErrorBanner/FormErrorBanner.js +14 -0
- package/dist/foundationText/Form/components/FormErrorBanner/index.d.ts +1 -0
- package/dist/foundationText/Form/components/FormErrorBanner/index.js +1 -0
- package/dist/foundationText/Form/components/FormMask/FormMask.d.ts +2 -0
- package/dist/foundationText/Form/components/FormMask/FormMask.js +9 -0
- package/dist/foundationText/Form/components/FormMask/FormMask.style.d.ts +13 -0
- package/dist/foundationText/Form/components/FormMask/FormMask.style.js +16 -0
- package/dist/foundationText/Form/components/FormMask/index.d.ts +1 -0
- package/dist/foundationText/Form/components/FormMask/index.js +1 -0
- package/dist/foundationText/Form/components/FormMessage/FormMessage.d.ts +19 -0
- package/dist/foundationText/Form/components/FormMessage/FormMessage.js +49 -0
- package/dist/foundationText/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.d.ts +8 -0
- package/dist/foundationText/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.js +27 -0
- package/dist/foundationText/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.style.d.ts +20 -0
- package/dist/foundationText/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.style.js +18 -0
- package/dist/foundationText/Form/components/FormMessage/components/InternalFormMessage/index.d.ts +1 -0
- package/dist/foundationText/Form/components/FormMessage/components/InternalFormMessage/index.js +1 -0
- package/dist/foundationText/Form/components/FormMessage/index.d.ts +1 -0
- package/dist/foundationText/Form/components/FormMessage/index.js +1 -0
- package/dist/foundationText/Form/components/FormMessageBanner/FormMessageBanner.d.ts +7 -0
- package/dist/foundationText/Form/components/FormMessageBanner/FormMessageBanner.js +16 -0
- package/dist/foundationText/Form/components/FormMessageBanner/index.d.ts +1 -0
- package/dist/foundationText/Form/components/FormMessageBanner/index.js +1 -0
- package/dist/foundationText/Form/components/FormSaveButton/FormSaveButton.d.ts +3 -0
- package/dist/foundationText/Form/components/FormSaveButton/FormSaveButton.js +55 -0
- package/dist/foundationText/Form/components/FormSaveButton/index.d.ts +1 -0
- package/dist/foundationText/Form/components/FormSaveButton/index.js +1 -0
- package/dist/foundationText/Form/components/IOSKeyboardAwareScrollViewSpacer/IOSKeyboardAwareScrollViewSpacer.d.ts +6 -0
- package/dist/foundationText/Form/components/IOSKeyboardAwareScrollViewSpacer/IOSKeyboardAwareScrollViewSpacer.js +13 -0
- package/dist/foundationText/Form/constants.d.ts +2 -0
- package/dist/foundationText/Form/constants.js +2 -0
- package/dist/foundationText/Form/context/FormContext.d.ts +11 -0
- package/dist/foundationText/Form/context/FormContext.js +16 -0
- package/dist/foundationText/Form/context/index.d.ts +2 -0
- package/dist/foundationText/Form/context/index.js +1 -0
- package/dist/foundationText/Form/context/types.d.ts +26 -0
- package/dist/foundationText/Form/context/types.js +1 -0
- package/dist/foundationText/Form/hooks/useFormViewRefs.d.ts +10 -0
- package/dist/foundationText/Form/hooks/useFormViewRefs.js +13 -0
- package/dist/foundationText/Form/hooks/useInternalForm.d.ts +19 -0
- package/dist/foundationText/Form/hooks/useInternalForm.js +43 -0
- package/dist/foundationText/Form/hooks/useOfflineHandler.d.ts +1 -0
- package/dist/foundationText/Form/hooks/useOfflineHandler.js +23 -0
- package/dist/foundationText/Form/hooks/useSaveButtonPosition.d.ts +12 -0
- package/dist/foundationText/Form/hooks/useSaveButtonPosition.js +25 -0
- package/dist/foundationText/Form/hooks/useScreenInformation.d.ts +8 -0
- package/dist/foundationText/Form/hooks/useScreenInformation.js +15 -0
- package/dist/foundationText/Form/hooks/useScrollToError/index.d.ts +1 -0
- package/dist/foundationText/Form/hooks/useScrollToError/index.js +1 -0
- package/dist/foundationText/Form/hooks/useScrollToError/useScrollToError.d.ts +9 -0
- package/dist/foundationText/Form/hooks/useScrollToError/useScrollToError.js +64 -0
- package/dist/foundationText/Form/index.d.ts +5 -0
- package/dist/foundationText/Form/index.js +4 -0
- package/dist/foundationText/Form/types.d.ts +215 -0
- package/dist/foundationText/Form/types.js +10 -0
- package/dist/foundationText/FormField/FormField.d.ts +24 -0
- package/dist/foundationText/FormField/FormField.js +11 -0
- package/dist/foundationText/FormField/index.d.ts +1 -0
- package/dist/foundationText/FormField/index.js +1 -0
- package/dist/foundationText/FormatFile/FormatFile.d.ts +79 -0
- package/dist/foundationText/FormatFile/FormatFile.js +47 -0
- package/dist/foundationText/FormatFile/FormatFile.style.d.ts +15 -0
- package/dist/foundationText/FormatFile/FormatFile.style.js +19 -0
- package/dist/foundationText/FormatFile/FormatFileThumbnail.d.ts +58 -0
- package/dist/foundationText/FormatFile/FormatFileThumbnail.js +35 -0
- package/dist/foundationText/FormatFile/components/ErrorIcon/ErrorIcon.d.ts +2 -0
- package/dist/foundationText/FormatFile/components/ErrorIcon/ErrorIcon.js +9 -0
- package/dist/foundationText/FormatFile/components/ErrorIcon/ErrorIcon.style.d.ts +8 -0
- package/dist/foundationText/FormatFile/components/ErrorIcon/ErrorIcon.style.js +11 -0
- package/dist/foundationText/FormatFile/components/ErrorIcon/index.d.ts +1 -0
- package/dist/foundationText/FormatFile/components/ErrorIcon/index.js +1 -0
- package/dist/foundationText/FormatFile/components/FileView/FileView.d.ts +13 -0
- package/dist/foundationText/FormatFile/components/FileView/FileView.js +42 -0
- package/dist/foundationText/FormatFile/components/FileView/FileView.style.d.ts +64 -0
- package/dist/foundationText/FormatFile/components/FileView/FileView.style.js +70 -0
- package/dist/foundationText/FormatFile/components/FileView/index.d.ts +1 -0
- package/dist/foundationText/FormatFile/components/FileView/index.js +1 -0
- package/dist/foundationText/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.d.ts +12 -0
- package/dist/foundationText/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.js +17 -0
- package/dist/foundationText/FormatFile/components/FormatFileBottomSheet/index.d.ts +2 -0
- package/dist/foundationText/FormatFile/components/FormatFileBottomSheet/index.js +1 -0
- package/dist/foundationText/FormatFile/components/MediaView/MediaView.d.ts +14 -0
- package/dist/foundationText/FormatFile/components/MediaView/MediaView.js +108 -0
- package/dist/foundationText/FormatFile/components/MediaView/MediaView.style.d.ts +25 -0
- package/dist/foundationText/FormatFile/components/MediaView/MediaView.style.js +28 -0
- package/dist/foundationText/FormatFile/components/MediaView/index.d.ts +1 -0
- package/dist/foundationText/FormatFile/components/MediaView/index.js +1 -0
- package/dist/foundationText/FormatFile/components/ProgressBar/ProgressBar.d.ts +18 -0
- package/dist/foundationText/FormatFile/components/ProgressBar/ProgressBar.js +30 -0
- package/dist/foundationText/FormatFile/components/ProgressBar/ProgressBar.style.d.ts +13 -0
- package/dist/foundationText/FormatFile/components/ProgressBar/ProgressBar.style.js +16 -0
- package/dist/foundationText/FormatFile/components/ProgressBar/index.d.ts +1 -0
- package/dist/foundationText/FormatFile/components/ProgressBar/index.js +1 -0
- package/dist/foundationText/FormatFile/constants.d.ts +35 -0
- package/dist/foundationText/FormatFile/constants.js +74 -0
- package/dist/foundationText/FormatFile/context/FormatFileContext.d.ts +9 -0
- package/dist/foundationText/FormatFile/context/FormatFileContext.js +8 -0
- package/dist/foundationText/FormatFile/context/types.d.ts +9 -0
- package/dist/foundationText/FormatFile/context/types.js +1 -0
- package/dist/foundationText/FormatFile/index.d.ts +8 -0
- package/dist/foundationText/FormatFile/index.js +3 -0
- package/dist/foundationText/FormatFile/types.d.ts +105 -0
- package/dist/foundationText/FormatFile/types.js +8 -0
- package/dist/foundationText/FormatFile/utils/computeA11yLabel.d.ts +9 -0
- package/dist/foundationText/FormatFile/utils/computeA11yLabel.js +11 -0
- package/dist/foundationText/FormatFile/utils/createUseCreateThumbnail.d.ts +6 -0
- package/dist/foundationText/FormatFile/utils/createUseCreateThumbnail.js +27 -0
- package/dist/foundationText/FormatFile/utils/getFileCategory.d.ts +28 -0
- package/dist/foundationText/FormatFile/utils/getFileCategory.js +62 -0
- package/dist/foundationText/FormatFile/utils/index.d.ts +7 -0
- package/dist/foundationText/FormatFile/utils/index.js +6 -0
- package/dist/foundationText/FormatFile/utils/mapFileTypeToIconName.d.ts +17 -0
- package/dist/foundationText/FormatFile/utils/mapFileTypeToIconName.js +30 -0
- package/dist/foundationText/FormatFile/utils/parseFile.d.ts +3 -0
- package/dist/foundationText/FormatFile/utils/parseFile.js +58 -0
- package/dist/foundationText/FormatFile/utils/sanitizeFileName.d.ts +5 -0
- package/dist/foundationText/FormatFile/utils/sanitizeFileName.js +9 -0
- package/dist/foundationText/FormatFile/utils/truncateFileNameForLine.d.ts +24 -0
- package/dist/foundationText/FormatFile/utils/truncateFileNameForLine.js +58 -0
- package/dist/foundationText/Glimmer/Glimmer.d.ts +32 -0
- package/dist/foundationText/Glimmer/Glimmer.js +42 -0
- package/dist/foundationText/Glimmer/Glimmer.shape.style.d.ts +14 -0
- package/dist/foundationText/Glimmer/Glimmer.shape.style.js +17 -0
- package/dist/foundationText/Glimmer/Glimmer.size.style.d.ts +17 -0
- package/dist/foundationText/Glimmer/Glimmer.size.style.js +10 -0
- package/dist/foundationText/Glimmer/Glimmer.style.d.ts +26 -0
- package/dist/foundationText/Glimmer/Glimmer.style.js +30 -0
- package/dist/foundationText/Glimmer/index.d.ts +1 -0
- package/dist/foundationText/Glimmer/index.js +1 -0
- package/dist/foundationText/Heading/Heading.d.ts +38 -0
- package/dist/foundationText/Heading/Heading.js +53 -0
- package/dist/foundationText/Heading/index.d.ts +2 -0
- package/dist/foundationText/Heading/index.js +1 -0
- package/dist/foundationText/IconButton/IconButton.d.ts +35 -0
- package/dist/foundationText/IconButton/IconButton.js +9 -0
- package/dist/foundationText/IconButton/IconButton.style.d.ts +8 -0
- package/dist/foundationText/IconButton/IconButton.style.js +11 -0
- package/dist/foundationText/IconButton/index.d.ts +1 -0
- package/dist/foundationText/IconButton/index.js +1 -0
- package/dist/foundationText/InputCurrency/constants.d.ts +1 -0
- package/dist/foundationText/InputCurrency/constants.js +1 -0
- package/dist/foundationText/InputCurrency/utils.d.ts +9 -0
- package/dist/foundationText/InputCurrency/utils.js +57 -0
- package/dist/foundationText/InputDate/InputDate.d.ts +76 -0
- package/dist/foundationText/InputDate/InputDate.js +70 -0
- package/dist/foundationText/InputDate/index.d.ts +2 -0
- package/dist/foundationText/InputDate/index.js +1 -0
- package/dist/foundationText/InputFieldWrapper/CommonInputStyles.style.d.ts +10 -0
- package/dist/foundationText/InputFieldWrapper/CommonInputStyles.style.js +49 -0
- package/dist/foundationText/InputFieldWrapper/InputFieldWrapper.d.ts +92 -0
- package/dist/foundationText/InputFieldWrapper/InputFieldWrapper.js +99 -0
- package/dist/foundationText/InputFieldWrapper/InputFieldWrapper.style.d.ts +106 -0
- package/dist/foundationText/InputFieldWrapper/InputFieldWrapper.style.js +123 -0
- package/dist/foundationText/InputFieldWrapper/components/ClearAction/ClearAction.d.ts +10 -0
- package/dist/foundationText/InputFieldWrapper/components/ClearAction/ClearAction.js +11 -0
- package/dist/foundationText/InputFieldWrapper/components/ClearAction/ClearAction.style.d.ts +22 -0
- package/dist/foundationText/InputFieldWrapper/components/ClearAction/ClearAction.style.js +26 -0
- package/dist/foundationText/InputFieldWrapper/components/ClearAction/index.d.ts +1 -0
- package/dist/foundationText/InputFieldWrapper/components/ClearAction/index.js +1 -0
- package/dist/foundationText/InputFieldWrapper/components/Prefix/Prefix.d.ts +22 -0
- package/dist/foundationText/InputFieldWrapper/components/Prefix/Prefix.js +39 -0
- package/dist/foundationText/InputFieldWrapper/components/Suffix/Suffix.d.ts +25 -0
- package/dist/foundationText/InputFieldWrapper/components/Suffix/Suffix.js +40 -0
- package/dist/foundationText/InputFieldWrapper/index.d.ts +4 -0
- package/dist/foundationText/InputFieldWrapper/index.js +3 -0
- package/dist/foundationText/InputPressable/InputPressable.d.ts +91 -0
- package/dist/foundationText/InputPressable/InputPressable.js +42 -0
- package/dist/foundationText/InputPressable/InputPressable.style.d.ts +21 -0
- package/dist/foundationText/InputPressable/InputPressable.style.js +28 -0
- package/dist/foundationText/InputPressable/index.d.ts +2 -0
- package/dist/foundationText/InputPressable/index.js +1 -0
- package/dist/foundationText/InputSearch/components/FilterButton.d.ts +7 -0
- package/dist/foundationText/InputSearch/components/FilterButton.js +10 -0
- package/dist/foundationText/InputText/context/InputAccessoriesContext.d.ts +3 -0
- package/dist/foundationText/InputText/context/InputAccessoriesContext.js +16 -0
- package/dist/foundationText/InputText/context/InputAccessoriesProvider.d.ts +5 -0
- package/dist/foundationText/InputText/context/InputAccessoriesProvider.js +68 -0
- package/dist/foundationText/InputText/context/InputAccessoriesProvider.style.d.ts +17 -0
- package/dist/foundationText/InputText/context/InputAccessoriesProvider.style.js +23 -0
- package/dist/foundationText/InputText/context/index.d.ts +2 -0
- package/dist/foundationText/InputText/context/index.js +2 -0
- package/dist/foundationText/InputText/context/types.d.ts +23 -0
- package/dist/foundationText/InputText/context/types.js +1 -0
- package/dist/foundationText/InputTime/InputTime.d.ts +63 -0
- package/dist/foundationText/InputTime/InputTime.js +76 -0
- package/dist/foundationText/InputTime/InputTime.style.d.ts +6 -0
- package/dist/foundationText/InputTime/InputTime.style.js +7 -0
- package/dist/foundationText/InputTime/index.d.ts +2 -0
- package/dist/foundationText/InputTime/index.js +2 -0
- package/dist/foundationText/InputTime/utils/index.d.ts +11 -0
- package/dist/foundationText/InputTime/utils/index.js +16 -0
- package/dist/foundationText/ProgressBar/ProgressBar.d.ts +6 -0
- package/dist/foundationText/ProgressBar/ProgressBar.js +36 -0
- package/dist/foundationText/ProgressBar/ProgressBar.size.style.d.ts +11 -0
- package/dist/foundationText/ProgressBar/ProgressBar.size.style.js +6 -0
- package/dist/foundationText/ProgressBar/ProgressBar.style.d.ts +34 -0
- package/dist/foundationText/ProgressBar/ProgressBar.style.js +37 -0
- package/dist/foundationText/ProgressBar/ProgressBarInner.d.ts +12 -0
- package/dist/foundationText/ProgressBar/ProgressBarInner.js +25 -0
- package/dist/foundationText/ProgressBar/ProgressBarStepped.d.ts +12 -0
- package/dist/foundationText/ProgressBar/ProgressBarStepped.js +32 -0
- package/dist/foundationText/ProgressBar/index.d.ts +2 -0
- package/dist/foundationText/ProgressBar/index.js +1 -0
- package/dist/foundationText/ProgressBar/types.d.ts +61 -0
- package/dist/foundationText/ProgressBar/types.js +1 -0
- package/dist/foundationText/ProgressIndicator/ProgressIndicator.d.ts +3 -0
- package/dist/foundationText/ProgressIndicator/ProgressIndicator.js +105 -0
- package/dist/foundationText/ProgressIndicator/ProgressIndicator.size.style.d.ts +19 -0
- package/dist/foundationText/ProgressIndicator/ProgressIndicator.size.style.js +15 -0
- package/dist/foundationText/ProgressIndicator/ProgressIndicator.style.d.ts +48 -0
- package/dist/foundationText/ProgressIndicator/ProgressIndicator.style.js +51 -0
- package/dist/foundationText/ProgressIndicator/index.d.ts +2 -0
- package/dist/foundationText/ProgressIndicator/index.js +1 -0
- package/dist/foundationText/ProgressIndicator/types.d.ts +44 -0
- package/dist/foundationText/ProgressIndicator/types.js +1 -0
- package/dist/foundationText/Select/Select.d.ts +92 -0
- package/dist/foundationText/Select/Select.js +102 -0
- package/dist/foundationText/Select/Select.style.d.ts +29 -0
- package/dist/foundationText/Select/Select.style.js +55 -0
- package/dist/foundationText/Select/SelectComposableTypes.d.ts +50 -0
- package/dist/foundationText/Select/SelectComposableTypes.js +1 -0
- package/dist/foundationText/Select/SelectRoot.d.ts +12 -0
- package/dist/foundationText/Select/SelectRoot.js +69 -0
- package/dist/foundationText/Select/SelectRoot.style.d.ts +8 -0
- package/dist/foundationText/Select/SelectRoot.style.js +9 -0
- package/dist/foundationText/Select/components/SelectContent.d.ts +8 -0
- package/dist/foundationText/Select/components/SelectContent.js +34 -0
- package/dist/foundationText/Select/components/SelectDefaultPicker/SelectDefaultPicker.d.ts +5 -0
- package/dist/foundationText/Select/components/SelectDefaultPicker/SelectDefaultPicker.ios.d.ts +5 -0
- package/dist/foundationText/Select/components/SelectDefaultPicker/SelectDefaultPicker.ios.js +22 -0
- package/dist/foundationText/Select/components/SelectDefaultPicker/SelectDefaultPicker.js +15 -0
- package/dist/foundationText/Select/components/SelectDefaultPicker/SelectDefaultPicker.style.d.ts +30 -0
- package/dist/foundationText/Select/components/SelectDefaultPicker/SelectDefaultPicker.style.js +29 -0
- package/dist/foundationText/Select/components/SelectDefaultPicker/index.d.ts +1 -0
- package/dist/foundationText/Select/components/SelectDefaultPicker/index.js +1 -0
- package/dist/foundationText/Select/components/SelectFieldContext.d.ts +27 -0
- package/dist/foundationText/Select/components/SelectFieldContext.js +10 -0
- package/dist/foundationText/Select/components/SelectIOSPicker/SelectIOSPicker.d.ts +10 -0
- package/dist/foundationText/Select/components/SelectIOSPicker/SelectIOSPicker.js +2 -0
- package/dist/foundationText/Select/components/SelectIOSPicker/index.d.ts +1 -0
- package/dist/foundationText/Select/components/SelectIOSPicker/index.js +1 -0
- package/dist/foundationText/Select/components/SelectInternalPicker/SelectInternalPicker.d.ts +3 -0
- package/dist/foundationText/Select/components/SelectInternalPicker/SelectInternalPicker.js +14 -0
- package/dist/foundationText/Select/components/SelectInternalPicker/index.d.ts +1 -0
- package/dist/foundationText/Select/components/SelectInternalPicker/index.js +1 -0
- package/dist/foundationText/Select/components/SelectInternalPicker/utils.d.ts +3 -0
- package/dist/foundationText/Select/components/SelectInternalPicker/utils.js +13 -0
- package/dist/foundationText/Select/components/SelectItem.d.ts +32 -0
- package/dist/foundationText/Select/components/SelectItem.js +26 -0
- package/dist/foundationText/Select/components/SelectItem.style.d.ts +5 -0
- package/dist/foundationText/Select/components/SelectItem.style.js +6 -0
- package/dist/foundationText/Select/components/SelectLabel.d.ts +22 -0
- package/dist/foundationText/Select/components/SelectLabel.js +30 -0
- package/dist/foundationText/Select/components/SelectPressable/SelectPressable.d.ts +11 -0
- package/dist/foundationText/Select/components/SelectPressable/SelectPressable.js +17 -0
- package/dist/foundationText/Select/components/SelectPressable/SelectPressable.style.d.ts +5 -0
- package/dist/foundationText/Select/components/SelectPressable/SelectPressable.style.js +8 -0
- package/dist/foundationText/Select/components/SelectPressable/index.d.ts +1 -0
- package/dist/foundationText/Select/components/SelectPressable/index.js +1 -0
- package/dist/foundationText/Select/components/SelectTrigger.d.ts +20 -0
- package/dist/foundationText/Select/components/SelectTrigger.js +39 -0
- package/dist/foundationText/Select/components/SelectTrigger.style.d.ts +25 -0
- package/dist/foundationText/Select/components/SelectTrigger.style.js +31 -0
- package/dist/foundationText/Select/index.d.ts +4 -0
- package/dist/foundationText/Select/index.js +4 -0
- package/dist/foundationText/Select/types.d.ts +38 -0
- package/dist/foundationText/Select/types.js +1 -0
- package/dist/foundationText/StatusLabel/StatusLabel.d.ts +22 -0
- package/dist/foundationText/StatusLabel/StatusLabel.js +20 -0
- package/dist/foundationText/StatusLabel/StatusLabel.style.d.ts +23 -0
- package/dist/foundationText/StatusLabel/StatusLabel.style.js +29 -0
- package/dist/foundationText/StatusLabel/index.d.ts +2 -0
- package/dist/foundationText/StatusLabel/index.js +1 -0
- package/dist/foundationText/Text/Text.d.ts +76 -0
- package/dist/foundationText/Text/Text.js +39 -0
- package/dist/foundationText/Text/index.d.ts +2 -0
- package/dist/foundationText/Text/index.js +1 -0
- package/dist/foundationText/TextList/TextList.d.ts +30 -0
- package/dist/foundationText/TextList/TextList.js +11 -0
- package/dist/foundationText/TextList/TextList.style.d.ts +14 -0
- package/dist/foundationText/TextList/TextList.style.js +17 -0
- package/dist/foundationText/TextList/index.d.ts +1 -0
- package/dist/foundationText/TextList/index.js +1 -0
- package/dist/foundationText/ThumbnailList/ThumbnailList.d.ts +5 -0
- package/dist/foundationText/ThumbnailList/ThumbnailList.js +32 -0
- package/dist/foundationText/ThumbnailList/ThumbnailList.style.d.ts +47 -0
- package/dist/foundationText/ThumbnailList/ThumbnailList.style.js +50 -0
- package/dist/foundationText/ThumbnailList/index.d.ts +2 -0
- package/dist/foundationText/ThumbnailList/index.js +2 -0
- package/dist/foundationText/ThumbnailList/types.d.ts +15 -0
- package/dist/foundationText/ThumbnailList/types.js +5 -0
- package/dist/foundationText/Toast/Toast.d.ts +28 -0
- package/dist/foundationText/Toast/Toast.js +64 -0
- package/dist/foundationText/Toast/Toast.styles.d.ts +31 -0
- package/dist/foundationText/Toast/Toast.styles.js +31 -0
- package/dist/foundationText/Toast/index.d.ts +2 -0
- package/dist/foundationText/Toast/index.js +1 -0
- package/dist/foundationText/Typography/Typography.d.ts +126 -0
- package/dist/foundationText/Typography/Typography.js +124 -0
- package/dist/foundationText/Typography/Typography.style.d.ts +16 -0
- package/dist/foundationText/Typography/Typography.style.js +472 -0
- package/dist/foundationText/Typography/TypographyGestureDetector.d.ts +8 -0
- package/dist/foundationText/Typography/TypographyGestureDetector.js +11 -0
- package/dist/foundationText/Typography/index.d.ts +5 -0
- package/dist/foundationText/Typography/index.js +4 -0
- package/dist/foundationText/Typography/webFonts.d.ts +4 -0
- package/dist/foundationText/Typography/webFonts.js +34 -0
- package/dist/foundationText/capitalize.d.ts +1 -0
- package/dist/foundationText/capitalize.js +6 -0
- package/dist/foundationText/compatTheme.d.ts +8 -0
- package/dist/foundationText/compatTheme.js +14 -0
- package/dist/foundationText/dateFormatter.d.ts +6 -0
- package/dist/foundationText/dateFormatter.js +19 -0
- package/dist/foundationText/foundationMessages.d.ts +11 -0
- package/dist/foundationText/foundationMessages.js +24 -0
- package/dist/foundationText/messages-en.d.ts +38 -0
- package/dist/foundationText/messages-en.js +38 -0
- package/dist/foundationText/messages-es.d.ts +38 -0
- package/dist/foundationText/messages-es.js +38 -0
- package/dist/foundationText/primitives/HelperText/HelperText.d.ts +15 -0
- package/dist/foundationText/primitives/HelperText/HelperText.js +11 -0
- package/dist/foundationText/primitives/HelperText/HelperText.style.d.ts +16 -0
- package/dist/foundationText/primitives/HelperText/HelperText.style.js +19 -0
- package/dist/foundationText/primitives/HelperText/index.d.ts +2 -0
- package/dist/foundationText/primitives/HelperText/index.js +1 -0
- package/dist/foundationText/primitives/Portal/index.d.ts +1 -0
- package/dist/foundationText/primitives/Portal/index.js +7 -0
- package/dist/foundationText/primitives/Select/SelectPrimitive.d.ts +69 -0
- package/dist/foundationText/primitives/Select/SelectPrimitive.js +160 -0
- package/dist/foundationText/primitives/Select/SelectPrimitive.style.d.ts +114 -0
- package/dist/foundationText/primitives/Select/SelectPrimitive.style.js +130 -0
- package/dist/foundationText/primitives/Select/index.d.ts +2 -0
- package/dist/foundationText/primitives/Select/index.js +1 -0
- package/dist/foundationText/primitives/Select/nativeTypes.d.ts +84 -0
- package/dist/foundationText/primitives/Select/nativeTypes.js +1 -0
- package/dist/foundationText/primitives/Select/types.d.ts +41 -0
- package/dist/foundationText/primitives/Select/types.js +1 -0
- package/dist/foundationText/primitives/index.d.ts +3 -0
- package/dist/foundationText/primitives/index.js +3 -0
- package/dist/foundationTokens.d.ts +388 -0
- package/dist/foundationTokens.js +26 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.js +54 -0
- package/dist/legacyTheme.d.ts +18 -0
- package/dist/legacyTheme.js +23 -0
- package/dist/sheetContext.d.ts +3 -0
- package/dist/sheetContext.js +6 -0
- package/dist/theme.d.ts +29 -0
- package/dist/theme.js +42 -0
- package/dist/useFormController.d.ts +11 -0
- package/dist/useFormController.js +15 -0
- package/dist/useIsScreenReaderEnabled.d.ts +1 -0
- package/dist/useIsScreenReaderEnabled.js +21 -0
- package/ios/RulnarPickerManager.m +59 -0
- package/package.json +146 -4
- package/resources/meta.json +85 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
import { useStyles } from "./EmptyState.style.js";
|
|
5
|
+
import { Text } from "../Text/index.js";
|
|
6
|
+
import { Content } from "../../Content.js";
|
|
7
|
+
import { Icon } from "../../Icon.js";
|
|
8
|
+
import { Heading } from "../Heading/index.js";
|
|
9
|
+
import { Button } from "../../Button.js";
|
|
10
|
+
function ButtonAction({ action, type }) {
|
|
11
|
+
if (!action)
|
|
12
|
+
return _jsx(_Fragment, {});
|
|
13
|
+
return _jsx(Button, { fullWidth: false, type: type, ...action });
|
|
14
|
+
}
|
|
15
|
+
export function EmptyState({ icon, title, description, primaryAction, secondaryAction, iconColor = "icon", }) {
|
|
16
|
+
const styles = useStyles();
|
|
17
|
+
return (_jsxs(Content, { children: [icon && (_jsx(View, { style: styles.icon, children: _jsx(Icon, { name: icon, size: "large", color: iconColor }) })), _jsxs(Content, { spacing: "none", childSpacing: "small", children: [title && (_jsx(Heading, { level: "subHeading", align: "center", children: title })), description && _jsx(Text, { align: "center", children: description }), (primaryAction || secondaryAction) && (_jsxs(Content, { spacing: "none", childSpacing: "small", children: [_jsx(ButtonAction, { action: primaryAction, type: "primary" }), _jsx(ButtonAction, { action: secondaryAction, type: "tertiary" })] }))] })] }));
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EmptyState } from "./EmptyState.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
type WrapForTypes = "card" | "default";
|
|
4
|
+
interface ErrorMessageWrapperProps {
|
|
5
|
+
/**
|
|
6
|
+
* The message that shows up below the children
|
|
7
|
+
*/
|
|
8
|
+
readonly message?: string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Changes how it gets laid out on the UI
|
|
11
|
+
*/
|
|
12
|
+
readonly wrapFor?: WrapForTypes;
|
|
13
|
+
readonly children: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Adds an error message below the children but ensure the message gets read
|
|
17
|
+
* out first.
|
|
18
|
+
*
|
|
19
|
+
* This component is internal to Rulnar and shouldn't be used outside of it.
|
|
20
|
+
*/
|
|
21
|
+
export declare function ErrorMessageWrapper({ message, wrapFor, children, }: ErrorMessageWrapperProps): React.JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useEffect, useId, useRef } from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
import { useErrorMessageContext } from "./context/index.js";
|
|
5
|
+
import { useStyles } from "./ErrorMessageWrapper.style.js";
|
|
6
|
+
import { Icon } from "../../Icon.js";
|
|
7
|
+
import { Text } from "../Text/index.js";
|
|
8
|
+
/**
|
|
9
|
+
* Adds an error message below the children but ensure the message gets read
|
|
10
|
+
* out first.
|
|
11
|
+
*
|
|
12
|
+
* This component is internal to Rulnar and shouldn't be used outside of it.
|
|
13
|
+
*/
|
|
14
|
+
export function ErrorMessageWrapper({ message, wrapFor = "default", children, }) {
|
|
15
|
+
const errorMessageContext = useErrorMessageContext();
|
|
16
|
+
const register = errorMessageContext?.register;
|
|
17
|
+
const unregister = errorMessageContext?.unregister;
|
|
18
|
+
const a11yMessageRef = useRef(null);
|
|
19
|
+
const id = useId();
|
|
20
|
+
const hasErrorMessage = Boolean(message);
|
|
21
|
+
const styles = useStyles();
|
|
22
|
+
const wrapForStyle = {
|
|
23
|
+
card: styles.wrapForCard,
|
|
24
|
+
default: undefined,
|
|
25
|
+
};
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (register) {
|
|
28
|
+
register({ id, ref: a11yMessageRef, hasErrorMessage });
|
|
29
|
+
}
|
|
30
|
+
if (unregister) {
|
|
31
|
+
return () => unregister(id);
|
|
32
|
+
}
|
|
33
|
+
}, [id, hasErrorMessage, register, unregister]);
|
|
34
|
+
return (_jsxs(View, { style: [styles.wrapper], children: [hasErrorMessage && (_jsx(View, { ref: a11yMessageRef, accessible: true, accessibilityRole: "text", accessibilityLabel: message, pointerEvents: "none", style: styles.screenReaderMessage })), children, hasErrorMessage && (_jsxs(View, { style: [styles.messageWrapper, wrapForStyle[wrapFor]], children: [_jsx(View, { style: styles.messageWrapperIcon, children: _jsx(Icon, { name: "alert", size: "small", color: "critical" }) }), _jsx(View, { style: styles.messageWrapperContent, children: _jsx(Text, { variation: "error", level: "textSupporting", hideFromScreenReader: true, children: message }) })] }))] }));
|
|
35
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const useStyles: () => {
|
|
2
|
+
wrapper: {
|
|
3
|
+
position: "relative";
|
|
4
|
+
width: "100%";
|
|
5
|
+
};
|
|
6
|
+
wrapForCard: {
|
|
7
|
+
paddingHorizontal: number;
|
|
8
|
+
paddingVertical: number;
|
|
9
|
+
};
|
|
10
|
+
messageWrapper: {
|
|
11
|
+
flexDirection: "row";
|
|
12
|
+
};
|
|
13
|
+
messageWrapperIcon: {
|
|
14
|
+
flex: number;
|
|
15
|
+
flexBasis: "auto";
|
|
16
|
+
paddingTop: number;
|
|
17
|
+
paddingRight: number;
|
|
18
|
+
};
|
|
19
|
+
messageWrapperContent: {
|
|
20
|
+
flex: number;
|
|
21
|
+
};
|
|
22
|
+
screenReaderMessage: {
|
|
23
|
+
position: "absolute";
|
|
24
|
+
top: number;
|
|
25
|
+
left: number;
|
|
26
|
+
width: "100%";
|
|
27
|
+
height: "100%";
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { buildThemedStyles } from "../compatTheme.js";
|
|
2
|
+
export const useStyles = buildThemedStyles(tokens => {
|
|
3
|
+
return {
|
|
4
|
+
wrapper: {
|
|
5
|
+
position: "relative",
|
|
6
|
+
width: "100%",
|
|
7
|
+
},
|
|
8
|
+
wrapForCard: {
|
|
9
|
+
paddingHorizontal: tokens["space-base"],
|
|
10
|
+
paddingVertical: tokens["space-small"],
|
|
11
|
+
},
|
|
12
|
+
messageWrapper: {
|
|
13
|
+
flexDirection: "row",
|
|
14
|
+
},
|
|
15
|
+
messageWrapperIcon: {
|
|
16
|
+
flex: 0,
|
|
17
|
+
flexBasis: "auto",
|
|
18
|
+
paddingTop: tokens["space-minuscule"],
|
|
19
|
+
paddingRight: tokens["space-smaller"],
|
|
20
|
+
},
|
|
21
|
+
messageWrapperContent: {
|
|
22
|
+
flex: 1,
|
|
23
|
+
},
|
|
24
|
+
screenReaderMessage: {
|
|
25
|
+
position: "absolute",
|
|
26
|
+
top: 0,
|
|
27
|
+
left: 0,
|
|
28
|
+
width: "100%",
|
|
29
|
+
height: "100%",
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
const defaultValues = {
|
|
4
|
+
elements: {},
|
|
5
|
+
register: _ => undefined,
|
|
6
|
+
unregister: _ => undefined,
|
|
7
|
+
};
|
|
8
|
+
export const ErrorMessageContext = createContext(defaultValues);
|
|
9
|
+
export function useErrorMessageContext() {
|
|
10
|
+
return useContext(ErrorMessageContext);
|
|
11
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import { AccessibilityInfo, findNodeHandle } from "react-native";
|
|
4
|
+
import { ErrorMessageContext } from "./ErrorMessageContext.js";
|
|
5
|
+
export function ErrorMessageProvider({ children }) {
|
|
6
|
+
const [elements, setElements] = useState({});
|
|
7
|
+
return (_jsx(ErrorMessageContext.Provider, { value: {
|
|
8
|
+
elements,
|
|
9
|
+
register: handleRegister,
|
|
10
|
+
unregister: handleUnregister,
|
|
11
|
+
}, children: children }));
|
|
12
|
+
function handleRegister({ id, ref, hasErrorMessage, }) {
|
|
13
|
+
elements[id] = {
|
|
14
|
+
measure: getMeasure(ref),
|
|
15
|
+
accessibilityFocus: getAccessibilityFocus(ref),
|
|
16
|
+
hasErrorMessage,
|
|
17
|
+
};
|
|
18
|
+
setElements(elements);
|
|
19
|
+
}
|
|
20
|
+
function handleUnregister(id) {
|
|
21
|
+
delete elements[id];
|
|
22
|
+
setElements(elements);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function getMeasure(ref) {
|
|
26
|
+
return function measure(...args) {
|
|
27
|
+
ref.current?.measureLayout(...args);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function getAccessibilityFocus(ref) {
|
|
31
|
+
return function accessibilityFocus() {
|
|
32
|
+
const reactTag = findNodeHandle(ref.current);
|
|
33
|
+
reactTag &&
|
|
34
|
+
setTimeout(() => {
|
|
35
|
+
AccessibilityInfo.setAccessibilityFocus(reactTag);
|
|
36
|
+
}, 0);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { RefObject } from "react";
|
|
2
|
+
import type { NativeMethods, View } from "react-native";
|
|
3
|
+
interface Methods {
|
|
4
|
+
/**
|
|
5
|
+
* Requires the method that returns
|
|
6
|
+
* - x
|
|
7
|
+
* - y
|
|
8
|
+
* - width
|
|
9
|
+
* - height
|
|
10
|
+
*
|
|
11
|
+
* This determines the location of the element on screen.
|
|
12
|
+
*/
|
|
13
|
+
readonly measure: NativeMethods["measureLayout"];
|
|
14
|
+
/**
|
|
15
|
+
* Requires a method that makes accessible element be focused.
|
|
16
|
+
*
|
|
17
|
+
* **Example**
|
|
18
|
+
* ```
|
|
19
|
+
* function accessibilityFocus() {
|
|
20
|
+
* const reactTag = findNodeHandle(ref.current);
|
|
21
|
+
* AccessibilityInfo.setAccessibilityFocus(reactTag);
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
readonly accessibilityFocus: () => void;
|
|
26
|
+
/**
|
|
27
|
+
* Check if the registered element has an error.
|
|
28
|
+
*/
|
|
29
|
+
readonly hasErrorMessage: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface Element {
|
|
32
|
+
/**
|
|
33
|
+
* Used to easily identify the registered element so it's easier to modify or
|
|
34
|
+
* unregister it.
|
|
35
|
+
*/
|
|
36
|
+
readonly id: string;
|
|
37
|
+
/**
|
|
38
|
+
* Information about the element that you can access.
|
|
39
|
+
*/
|
|
40
|
+
readonly methods: Methods;
|
|
41
|
+
}
|
|
42
|
+
type ElementID = Element["id"];
|
|
43
|
+
export interface ErrorMessageContextRegisterParams {
|
|
44
|
+
readonly id: ElementID;
|
|
45
|
+
readonly hasErrorMessage: Methods["hasErrorMessage"];
|
|
46
|
+
readonly ref: RefObject<View | null>;
|
|
47
|
+
}
|
|
48
|
+
export interface ErrorMessageContextProps {
|
|
49
|
+
/**
|
|
50
|
+
* Registered elements.
|
|
51
|
+
*/
|
|
52
|
+
readonly elements: Record<ElementID, Element["methods"]>;
|
|
53
|
+
/**
|
|
54
|
+
* Registers the element to the context.
|
|
55
|
+
*/
|
|
56
|
+
readonly register: (params: ErrorMessageContextRegisterParams) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Un-registers the element from the context.
|
|
59
|
+
*/
|
|
60
|
+
readonly unregister: (id: ElementID) => void;
|
|
61
|
+
}
|
|
62
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React, { useCallback, useEffect, useState } from "react";
|
|
3
|
+
import { FormProvider } from "react-hook-form";
|
|
4
|
+
import { KeyboardAwareScrollView, KeyboardEvents, } from "react-native-keyboard-controller";
|
|
5
|
+
import { Keyboard, Platform, View, findNodeHandle } from "react-native";
|
|
6
|
+
import { useStyles } from "./Form.style.js";
|
|
7
|
+
import { FormErrorBanner } from "./components/FormErrorBanner/index.js";
|
|
8
|
+
import { KEYBOARD_SAVE_BUTTON_DISTANCE, KEYBOARD_TOP_PADDING_AUTO_SCROLL, } from "./constants.js";
|
|
9
|
+
import { FormMessageBanner } from "./components/FormMessageBanner/index.js";
|
|
10
|
+
import { FormSubmitErrorType } from "./types.js";
|
|
11
|
+
import { FormMask } from "./components/FormMask/index.js";
|
|
12
|
+
import { useInternalForm } from "./hooks/useInternalForm.js";
|
|
13
|
+
import { useFormViewRefs } from "./hooks/useFormViewRefs.js";
|
|
14
|
+
import { useScreenInformation } from "./hooks/useScreenInformation.js";
|
|
15
|
+
import { FormMessage } from "./components/FormMessage/index.js";
|
|
16
|
+
import { FormBody, useBottomPadding } from "./components/FormBody/index.js";
|
|
17
|
+
import { useOfflineHandler } from "./hooks/useOfflineHandler.js";
|
|
18
|
+
import { useScrollToError } from "./hooks/useScrollToError/index.js";
|
|
19
|
+
import { FormSaveButton } from "./components/FormSaveButton/index.js";
|
|
20
|
+
import { useSaveButtonPosition } from "./hooks/useSaveButtonPosition.js";
|
|
21
|
+
import { FormCache } from "./components/FormCache/FormCache.js";
|
|
22
|
+
import { useFormContext } from "./context/FormContext.js";
|
|
23
|
+
import { IOSKeyboardAwareScrollViewSpacer } from "./components/IOSKeyboardAwareScrollViewSpacer/IOSKeyboardAwareScrollViewSpacer.js";
|
|
24
|
+
import { InputAccessoriesProvider } from "../InputText/context/index.js";
|
|
25
|
+
import { platformTokens as tokens } from "../../foundationTokens.js";
|
|
26
|
+
import { ErrorMessageProvider } from "../ErrorMessageWrapper/index.js";
|
|
27
|
+
export function Form({ initialLoading, ...rest }) {
|
|
28
|
+
const child = initialLoading ? _jsx(FormMask, {}) : _jsx(InternalForm, { ...rest });
|
|
29
|
+
return (_jsx(InputAccessoriesProvider, { children: _jsx(ErrorMessageProvider, { children: child }) }));
|
|
30
|
+
}
|
|
31
|
+
// eslint-disable-next-line max-statements
|
|
32
|
+
function InternalForm({ children, onBeforeSubmit, onSubmit, onSubmitError, onSubmitSuccess, bannerErrors, bannerMessages, initialValues, mode = "onTouched", reValidateMode = "onChange", formRef, saveButtonLabel, renderStickySection, localCacheKey, localCacheExclude, localCacheId, secondaryActions, saveButtonOffset, showStickySaveButton = false, disableKeyboardAwareScroll = false, renderFooter, UNSAFE_allowDiscardLocalCacheWhenOffline, }) {
|
|
33
|
+
const { scrollViewRef, bottomViewRef, scrollToTop } = useFormViewRefs();
|
|
34
|
+
const [saveButtonHeight, setSaveButtonHeight] = useState(0);
|
|
35
|
+
const [messageBannerHeight, setMessageBannerHeight] = useState(0);
|
|
36
|
+
const { formMethods, handleSubmit, isSubmitting, removeListenerRef, setLocalCache, } = useInternalForm({
|
|
37
|
+
mode,
|
|
38
|
+
reValidateMode,
|
|
39
|
+
...(initialValues !== undefined && { initialValues }),
|
|
40
|
+
...(formRef !== undefined && { formRef }),
|
|
41
|
+
...(localCacheKey !== undefined && { localCacheKey }),
|
|
42
|
+
...(localCacheExclude !== undefined && { localCacheExclude }),
|
|
43
|
+
...(localCacheId !== undefined && { localCacheId }),
|
|
44
|
+
scrollViewRef,
|
|
45
|
+
saveButtonHeight,
|
|
46
|
+
messageBannerHeight,
|
|
47
|
+
...(UNSAFE_allowDiscardLocalCacheWhenOffline !== undefined && { UNSAFE_allowDiscardLocalCacheWhenOffline }),
|
|
48
|
+
});
|
|
49
|
+
const { windowHeight } = useScreenInformation();
|
|
50
|
+
const [keyboardHeight, setKeyboardHeight] = useState(0);
|
|
51
|
+
const [keyboardScreenY, setKeyboardScreenY] = useState(0);
|
|
52
|
+
const [formContentHeight, setFormContentHeight] = useState(0);
|
|
53
|
+
const [isBottomSheetOpen, setIsBottomSheetOpen] = useState(false);
|
|
54
|
+
const paddingBottom = useBottomPadding();
|
|
55
|
+
const { saveButtonPosition } = useSaveButtonPosition({
|
|
56
|
+
formContentHeight,
|
|
57
|
+
isBottomSheetOpen,
|
|
58
|
+
showStickySaveButton,
|
|
59
|
+
keyboardHeight,
|
|
60
|
+
keyboardScreenY,
|
|
61
|
+
});
|
|
62
|
+
const [isSecondaryActionLoading, setIsSecondaryActionLoading] = useState(false);
|
|
63
|
+
const extraViewHeight = paddingBottom + KEYBOARD_SAVE_BUTTON_DISTANCE;
|
|
64
|
+
const calculatedKeyboardHeight = keyboardHeight - extraViewHeight;
|
|
65
|
+
useScrollToError({
|
|
66
|
+
formState: formMethods.formState,
|
|
67
|
+
refNode: findNodeHandle(scrollViewRef.current),
|
|
68
|
+
setFocus: formMethods.setFocus,
|
|
69
|
+
...(scrollViewRef.current?.scrollTo !== undefined && { scrollTo: scrollViewRef.current.scrollTo }),
|
|
70
|
+
});
|
|
71
|
+
const handleOfflineSubmit = useOfflineHandler();
|
|
72
|
+
const handleKeyboardShow = useCallback((event) => {
|
|
73
|
+
setKeyboardHeight(event.height);
|
|
74
|
+
setKeyboardScreenY(windowHeight - event.height);
|
|
75
|
+
}, [windowHeight]);
|
|
76
|
+
const handleKeyboardHide = useCallback(() => {
|
|
77
|
+
setKeyboardHeight(0);
|
|
78
|
+
setKeyboardScreenY(0);
|
|
79
|
+
}, []);
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
const showEvent = Platform.OS === "ios" ? "keyboardWillShow" : "keyboardDidShow";
|
|
82
|
+
const hideEvent = Platform.OS === "ios" ? "keyboardWillHide" : "keyboardDidHide";
|
|
83
|
+
const showListener = KeyboardEvents.addListener(showEvent, handleKeyboardShow);
|
|
84
|
+
const hideListener = KeyboardEvents.addListener(hideEvent, handleKeyboardHide);
|
|
85
|
+
return () => {
|
|
86
|
+
showListener.remove();
|
|
87
|
+
hideListener.remove();
|
|
88
|
+
};
|
|
89
|
+
}, [handleKeyboardHide, handleKeyboardShow]);
|
|
90
|
+
const onLayout = (event) => {
|
|
91
|
+
setMessageBannerHeight(event.nativeEvent.layout.height);
|
|
92
|
+
};
|
|
93
|
+
const styles = useStyles();
|
|
94
|
+
const { edgeToEdgeEnabled } = useFormContext();
|
|
95
|
+
const offlineField = "offline";
|
|
96
|
+
return (_jsxs(FormProvider, { ...formMethods, children: [_jsxs(_Fragment, { children: [(isSubmitting || isSecondaryActionLoading) && _jsx(FormMask, {}), _jsx(FormCache, { ...(localCacheKey !== undefined && { localCacheKey: localCacheKey }), ...(localCacheExclude !== undefined && { localCacheExclude: localCacheExclude }), setLocalCache: setLocalCache }), _jsx(FormBody, { keyboardHeight: calculateSaveButtonOffset(), submit: handleSubmit(internalSubmit), isFormSubmitting: isSubmitting, ...(saveButtonLabel !== undefined && { saveButtonLabel: saveButtonLabel }), shouldRenderActionBar: saveButtonPosition === "sticky", ...(renderStickySection !== undefined && { renderStickySection: renderStickySection }), ...(secondaryActions !== undefined && { secondaryActions: secondaryActions }), setSecondaryActionLoading: setIsSecondaryActionLoading, setSaveButtonHeight: setSaveButtonHeight, ...(saveButtonOffset !== undefined && { saveButtonOffset: saveButtonOffset }), children: _jsxs(KeyboardAwareScrollView, { disableScrollOnKeyboardHide: true, enabled: !disableKeyboardAwareScroll, keyboardShouldPersistTaps: "handled", ref: scrollViewRef, bottomOffset: KEYBOARD_TOP_PADDING_AUTO_SCROLL, contentContainerStyle: !keyboardHeight && styles.scrollContentContainer, children: [_jsxs(View, { onLayout: ({ nativeEvent }) => {
|
|
97
|
+
setFormContentHeight(nativeEvent.layout.height);
|
|
98
|
+
}, children: [_jsxs(View, { onLayout: onLayout, children: [_jsx(FormMessageBanner, { ...(bannerMessages !== undefined && { bannerMessages: bannerMessages }) }), _jsx(FormErrorBanner, { networkError: bannerErrors?.networkError, ...(bannerErrors?.bannerError !== undefined && { bannerError: bannerErrors?.bannerError }) })] }), _jsx(View, { style: styles.formChildContainer, children: _jsxs(_Fragment, { children: [_jsx(View, { style: styles.formContent, children: children }), saveButtonPosition === "inline" && (_jsxs(View, { style: [
|
|
99
|
+
styles.fixedSaveButton,
|
|
100
|
+
(edgeToEdgeEnabled || Platform.OS !== "android") && {
|
|
101
|
+
marginBottom: paddingBottom,
|
|
102
|
+
},
|
|
103
|
+
], children: [renderStickySection ? (renderStickySection(handleSubmit(internalSubmit), saveButtonLabel, isSubmitting)) : (_jsx(FormSaveButton, { primaryAction: handleSubmit(internalSubmit), ...(saveButtonLabel !== undefined && { label: saveButtonLabel }), loading: isSubmitting, ...(secondaryActions !== undefined && { secondaryActions: secondaryActions }), setSecondaryActionLoading: setIsSecondaryActionLoading, onOpenBottomSheet: () => setIsBottomSheetOpen(true), onCloseBottomSheet: () => setIsBottomSheetOpen(false) })), disableKeyboardAwareScroll && (_jsx(IOSKeyboardAwareScrollViewSpacer, {}))] })), renderFooter] }) })] }), _jsx(View, { style: styles.safeArea, ref: bottomViewRef })] }) })] }), _jsx(FormMessage, {})] }));
|
|
104
|
+
async function internalSubmit(data) {
|
|
105
|
+
let performSubmit = true;
|
|
106
|
+
if (onBeforeSubmit) {
|
|
107
|
+
performSubmit = await onBeforeSubmit(data);
|
|
108
|
+
}
|
|
109
|
+
if (performSubmit) {
|
|
110
|
+
Keyboard.dismiss();
|
|
111
|
+
return onSubmit(data)
|
|
112
|
+
.then((result) => {
|
|
113
|
+
removeListenerRef.current?.();
|
|
114
|
+
onSubmitSuccess(result);
|
|
115
|
+
})
|
|
116
|
+
.catch(handleSubmitCatch);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function handleSubmitCatch(error) {
|
|
120
|
+
// Scroll to top of form to see error
|
|
121
|
+
scrollToTop();
|
|
122
|
+
onSubmitError(error);
|
|
123
|
+
if (error?.errorType === FormSubmitErrorType.NetworkError) {
|
|
124
|
+
formMethods.setError(offlineField, { type: "network", message: "Error saving form." });
|
|
125
|
+
handleOfflineSubmit(handleRetry, clearFormErrors)();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function clearFormErrors() {
|
|
129
|
+
formMethods.clearErrors(offlineField);
|
|
130
|
+
}
|
|
131
|
+
function handleRetry() {
|
|
132
|
+
clearFormErrors();
|
|
133
|
+
return handleSubmit(internalSubmit)();
|
|
134
|
+
}
|
|
135
|
+
function calculateSaveButtonOffset() {
|
|
136
|
+
if (saveButtonOffset) {
|
|
137
|
+
// Included the space-base because it's the padding of the FormActionBar
|
|
138
|
+
return calculatedKeyboardHeight - saveButtonOffset + tokens["space-base"];
|
|
139
|
+
}
|
|
140
|
+
return calculatedKeyboardHeight;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const useStyles: () => {
|
|
2
|
+
container: {
|
|
3
|
+
flex: number;
|
|
4
|
+
flexGrow: number;
|
|
5
|
+
width: "100%";
|
|
6
|
+
};
|
|
7
|
+
safeArea: {
|
|
8
|
+
backgroundColor: string;
|
|
9
|
+
};
|
|
10
|
+
scrollContentContainer: {
|
|
11
|
+
flexGrow: number;
|
|
12
|
+
};
|
|
13
|
+
scrollView: {
|
|
14
|
+
flexGrow: number;
|
|
15
|
+
};
|
|
16
|
+
formChildContainer: {
|
|
17
|
+
flexGrow: number;
|
|
18
|
+
justifyContent: "flex-start";
|
|
19
|
+
};
|
|
20
|
+
formContent: {
|
|
21
|
+
paddingVertical: number;
|
|
22
|
+
};
|
|
23
|
+
fixedSaveButton: {
|
|
24
|
+
padding: number;
|
|
25
|
+
backgroundColor: string;
|
|
26
|
+
};
|
|
27
|
+
activityIndicator: {
|
|
28
|
+
marginVertical: number;
|
|
29
|
+
flex: number;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { buildThemedStyles } from "../compatTheme.js";
|
|
2
|
+
export const useStyles = buildThemedStyles(tokens => {
|
|
3
|
+
return {
|
|
4
|
+
container: {
|
|
5
|
+
flex: 1,
|
|
6
|
+
flexGrow: 1,
|
|
7
|
+
width: "100%",
|
|
8
|
+
},
|
|
9
|
+
safeArea: {
|
|
10
|
+
backgroundColor: tokens["color-surface"],
|
|
11
|
+
},
|
|
12
|
+
scrollContentContainer: {
|
|
13
|
+
flexGrow: 1,
|
|
14
|
+
},
|
|
15
|
+
scrollView: {
|
|
16
|
+
flexGrow: 1,
|
|
17
|
+
},
|
|
18
|
+
formChildContainer: {
|
|
19
|
+
flexGrow: 1,
|
|
20
|
+
justifyContent: "flex-start",
|
|
21
|
+
},
|
|
22
|
+
formContent: {
|
|
23
|
+
paddingVertical: tokens["space-small"],
|
|
24
|
+
},
|
|
25
|
+
fixedSaveButton: {
|
|
26
|
+
padding: tokens["space-base"],
|
|
27
|
+
backgroundColor: tokens["color-surface"],
|
|
28
|
+
},
|
|
29
|
+
activityIndicator: {
|
|
30
|
+
marginVertical: tokens["space-base"],
|
|
31
|
+
flex: 1,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { type ReactElement } from "react";
|
|
2
|
+
import type { SecondaryActionProp } from "../../types.js";
|
|
3
|
+
export interface FormActionBarProps {
|
|
4
|
+
readonly keyboardHeight: number;
|
|
5
|
+
readonly isFormSubmitting: boolean;
|
|
6
|
+
readonly saveButtonLabel?: string;
|
|
7
|
+
readonly submit: () => Promise<void> | void;
|
|
8
|
+
readonly setSaveButtonHeight?: (height: number) => void;
|
|
9
|
+
readonly renderStickySection?: (onSubmit: () => void, label: string | undefined, isSubmitting: boolean) => ReactElement;
|
|
10
|
+
readonly secondaryActions?: SecondaryActionProp[];
|
|
11
|
+
readonly setSecondaryActionLoading?: (bool: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function FormActionBar({ keyboardHeight, submit, isFormSubmitting, saveButtonLabel, renderStickySection, setSaveButtonHeight, secondaryActions, setSecondaryActionLoading, }: FormActionBarProps): React.JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, {} from "react";
|
|
3
|
+
import { StyleSheet } from "react-native";
|
|
4
|
+
import Reanimated from "react-native-reanimated";
|
|
5
|
+
import { useStyles } from "./FormActionBar.style.js";
|
|
6
|
+
import { FormSaveButton } from "../FormSaveButton/index.js";
|
|
7
|
+
const ReanimatedView = Reanimated.View;
|
|
8
|
+
export function FormActionBar({ keyboardHeight, submit, isFormSubmitting, saveButtonLabel, renderStickySection, setSaveButtonHeight, secondaryActions, setSecondaryActionLoading, }) {
|
|
9
|
+
const styles = useStyles();
|
|
10
|
+
const buttonStyle = StyleSheet.flatten([
|
|
11
|
+
styles.saveButton,
|
|
12
|
+
{
|
|
13
|
+
position: keyboardHeight > 0 ? "absolute" : "relative",
|
|
14
|
+
bottom: 0,
|
|
15
|
+
},
|
|
16
|
+
]);
|
|
17
|
+
const onLayout = (event) => {
|
|
18
|
+
setSaveButtonHeight && setSaveButtonHeight(event.nativeEvent.layout.height);
|
|
19
|
+
};
|
|
20
|
+
return (_jsx(ReanimatedView, { style: buttonStyle, onLayout: onLayout, children: renderStickySection ? (renderStickySection(submit, saveButtonLabel, isFormSubmitting)) : (_jsx(FormSaveButton, { ...(setSecondaryActionLoading !== undefined && { setSecondaryActionLoading: setSecondaryActionLoading }), primaryAction: submit, loading: isFormSubmitting, ...(saveButtonLabel !== undefined && { label: saveButtonLabel }), ...(secondaryActions !== undefined && { secondaryActions: secondaryActions }) })) }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const useStyles: () => {
|
|
2
|
+
saveButton: {
|
|
3
|
+
shadowColor: string;
|
|
4
|
+
shadowOffset: {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
};
|
|
8
|
+
shadowOpacity: number;
|
|
9
|
+
shadowRadius: number;
|
|
10
|
+
elevation: number;
|
|
11
|
+
padding: number;
|
|
12
|
+
backgroundColor: string;
|
|
13
|
+
width: "100%";
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { buildThemedStyles } from "../../../compatTheme.js";
|
|
2
|
+
export const useStyles = buildThemedStyles(tokens => {
|
|
3
|
+
return {
|
|
4
|
+
saveButton: {
|
|
5
|
+
padding: tokens["space-base"],
|
|
6
|
+
backgroundColor: tokens["color-surface"],
|
|
7
|
+
width: "100%",
|
|
8
|
+
...tokens["shadow-high"],
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FormActionBar } from "./FormActionBar.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { type ReactElement } from "react";
|
|
2
|
+
import type { FormActionBarProps } from "../FormActionBar/index.js";
|
|
3
|
+
interface FormBodyProps extends FormActionBarProps {
|
|
4
|
+
readonly children: ReactElement;
|
|
5
|
+
readonly shouldRenderActionBar?: boolean;
|
|
6
|
+
readonly saveButtonOffset?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function FormBody({ isFormSubmitting, submit, keyboardHeight, children, saveButtonLabel, renderStickySection, shouldRenderActionBar, secondaryActions, setSecondaryActionLoading, setSaveButtonHeight, saveButtonOffset, }: FormBodyProps): React.JSX.Element;
|
|
9
|
+
export declare function useBottomPadding(): number;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React, { useMemo } from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
import { useStyles } from "./FormBody.style.js";
|
|
5
|
+
import { useScreenInformation } from "../../hooks/useScreenInformation.js";
|
|
6
|
+
import { FormActionBar } from "../FormActionBar/index.js";
|
|
7
|
+
import { platformTokens as tokens } from "../../../../foundationTokens.js";
|
|
8
|
+
export function FormBody({ isFormSubmitting, submit, keyboardHeight, children, saveButtonLabel, renderStickySection, shouldRenderActionBar = true, secondaryActions, setSecondaryActionLoading, setSaveButtonHeight, saveButtonOffset, }) {
|
|
9
|
+
const paddingBottom = useBottomPadding();
|
|
10
|
+
const fullViewPadding = useMemo(() => ({ paddingBottom }), [paddingBottom]);
|
|
11
|
+
const styles = useStyles();
|
|
12
|
+
return (_jsxs(_Fragment, { children: [_jsxs(View, { style: [styles.container], children: [children, shouldRenderActionBar && (_jsx(FormActionBar, { ...(setSecondaryActionLoading !== undefined && { setSecondaryActionLoading: setSecondaryActionLoading }), keyboardHeight: keyboardHeight, submit: submit, isFormSubmitting: isFormSubmitting, ...(saveButtonLabel !== undefined && { saveButtonLabel: saveButtonLabel }), ...(renderStickySection !== undefined && { renderStickySection: renderStickySection }), ...(secondaryActions !== undefined && { secondaryActions: secondaryActions }), ...(setSaveButtonHeight !== undefined && { setSaveButtonHeight: setSaveButtonHeight }) }))] }), shouldRenderActionBar && !saveButtonOffset && (_jsx(View, { style: [fullViewPadding, styles.safeArea], testID: "ATL-FormSafeArea" }))] }));
|
|
13
|
+
}
|
|
14
|
+
export function useBottomPadding() {
|
|
15
|
+
const { insets } = useScreenInformation();
|
|
16
|
+
const extraBottomSpace = insets.bottom - tokens["space-base"];
|
|
17
|
+
return extraBottomSpace >= 0 ? extraBottomSpace : 0;
|
|
18
|
+
}
|