@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ZJ Dynamics
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Octopusapp Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @zj-dynamics/components-native
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Rulnar components for React Native, including controls, forms, overlays, and theming. Use `@zj-dynamics/design` for brand definitions and `@zj-dynamics/design/native` for Native theme outputs.
|
|
4
|
+
|
|
5
|
+
Mount the app's gesture handler root and safe-area provider around `OverlayProvider`, then wrap the editor in `ThemeProvider`. A `ContentOverlay` ref exposes `open()` and `close()`. An `InputText` placed in a sheet coordinates with its keyboard and scroll view.
|
|
6
|
+
|
|
7
|
+
On Android, TalkBack enters the sheet at its title or Dismiss button. Pass the opening control's ref to `open(openerRef)` so TalkBack can return to it after the sheet closes. Attach that ref to a Rulnar `Button` or another native view that TalkBack can focus.
|
|
8
|
+
|
|
9
|
+
On Android, use an Activity configured with `android:windowSoftInputMode="adjustResize"` to match the overlay. The [Native QA handoff](../../docs/parity/NATIVE_QA_HANDOFF.md) records the tested Expo peer versions, the iOS keyboard patch for Gorhom Bottom Sheet `5.2.14`, and the steps for verifying both platforms.
|
|
10
|
+
|
|
11
|
+
## Foundations
|
|
12
|
+
|
|
13
|
+
Content, Flex and Divider read the pinned platform spacing and border scales. Typography, Heading, Text, TextList and StatusLabel use the frozen native component source with Rulnar theme tokens. Register the Inter body aliases and `Poppins-Bold`, `Poppins-ExtraBold`, and `Poppins-Black` for display text. Poppins is the approved native display substitute. The Expo fixture uses these aliases and maps its existing Poppins files to the Inter body aliases for the smoke screen. Product body-font registration and visual comparison remain acceptance steps.
|
|
14
|
+
|
|
15
|
+
## Security
|
|
16
|
+
|
|
17
|
+
Report suspected vulnerabilities privately to [rulnar-security@zjdynamics.com](mailto:rulnar-security@zjdynamics.com).
|
|
18
|
+
|
|
19
|
+
## License
|
|
20
|
+
|
|
21
|
+
The MIT license in `LICENSE` applies to Rulnar-owned code. Third-party materials retain their accompanying licenses and notices.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |spec|
|
|
6
|
+
spec.name = 'RulnarComponentsNative'
|
|
7
|
+
spec.version = package.fetch('version')
|
|
8
|
+
spec.summary = package.fetch('description')
|
|
9
|
+
spec.homepage = 'https://github.com/upwardbinkie/rulnar'
|
|
10
|
+
spec.license = package.fetch('license')
|
|
11
|
+
spec.author = 'ZJ Dynamics'
|
|
12
|
+
spec.platform = :ios, '13.4'
|
|
13
|
+
spec.source = { :git => 'https://github.com/upwardbinkie/rulnar.git', :tag => spec.version.to_s }
|
|
14
|
+
spec.source_files = 'ios/**/*.{h,m}'
|
|
15
|
+
spec.dependency 'React-Core'
|
|
16
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface AutoLinkProps {
|
|
2
|
+
readonly children: string;
|
|
3
|
+
readonly phone?: boolean;
|
|
4
|
+
readonly email?: boolean;
|
|
5
|
+
readonly urls?: boolean;
|
|
6
|
+
readonly bottomTabsVisible?: boolean;
|
|
7
|
+
readonly selectable?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function AutoLink({ children, bottomTabsVisible, selectable, phone, email, urls, }: AutoLinkProps): import("react").JSX.Element;
|
package/dist/AutoLink.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { Linking, Text as NativeText } from 'react-native';
|
|
4
|
+
import NativeClipboard from '@react-native-clipboard/clipboard';
|
|
5
|
+
import { Autolinker } from 'autolinker';
|
|
6
|
+
import { useComponentMessages } from './foundationText/foundationMessages.js';
|
|
7
|
+
import { useLegacyTheme } from './legacyTheme.js';
|
|
8
|
+
import { Text } from './foundationText/Text/index.js';
|
|
9
|
+
import { TypographyGestureDetector } from './foundationText/Typography/index.js';
|
|
10
|
+
import { showToast } from './foundationText/Toast/index.js';
|
|
11
|
+
const clipboardExport = NativeClipboard;
|
|
12
|
+
const clipboard = 'default' in clipboardExport ? clipboardExport.default : clipboardExport;
|
|
13
|
+
const copiedMessages = {
|
|
14
|
+
email: 'AutoLink.emailCopied',
|
|
15
|
+
phone: 'AutoLink.phoneCopied',
|
|
16
|
+
url: 'AutoLink.urlCopied',
|
|
17
|
+
};
|
|
18
|
+
function ignoreUrl(text, match) {
|
|
19
|
+
if (match.getType() !== 'url')
|
|
20
|
+
return false;
|
|
21
|
+
const found = match.getMatchedText().toLowerCase();
|
|
22
|
+
return !/https?:\/\/|www\./.test(found) &&
|
|
23
|
+
(/file:\/\/|ftp:\/\//.test(found) || text[match.getOffset() - 1] === '/');
|
|
24
|
+
}
|
|
25
|
+
function linkParts(text, phone, email, urls) {
|
|
26
|
+
const matches = new Autolinker({ phone, email, urls }).parse(text);
|
|
27
|
+
let cursor = 0;
|
|
28
|
+
const parts = [];
|
|
29
|
+
for (const match of matches) {
|
|
30
|
+
if (ignoreUrl(text, match))
|
|
31
|
+
continue;
|
|
32
|
+
const offset = match.getOffset();
|
|
33
|
+
const value = match.getMatchedText();
|
|
34
|
+
if (offset > cursor)
|
|
35
|
+
parts.push({ value: text.slice(cursor, offset), offset: cursor });
|
|
36
|
+
parts.push({ value, offset, match });
|
|
37
|
+
cursor = offset + value.length;
|
|
38
|
+
}
|
|
39
|
+
if (cursor < text.length)
|
|
40
|
+
parts.push({ value: text.slice(cursor), offset: cursor });
|
|
41
|
+
return parts;
|
|
42
|
+
}
|
|
43
|
+
export function AutoLink({ children = '', bottomTabsVisible = true, selectable = true, phone = true, email = true, urls = true, }) {
|
|
44
|
+
const { t } = useComponentMessages();
|
|
45
|
+
const { tokens } = useLegacyTheme();
|
|
46
|
+
const parts = useMemo(() => linkParts(children, phone, email, urls), [children, phone, email, urls]);
|
|
47
|
+
return _jsx(TypographyGestureDetector, { children: _jsx(NativeText, { selectable: selectable, selectionColor: tokens['color-brand--highlight'], children: parts.map(({ value, offset, match }) => {
|
|
48
|
+
if (!match)
|
|
49
|
+
return _jsx(Text, { selectable: selectable, children: value }, offset);
|
|
50
|
+
const address = match.getAnchorHref();
|
|
51
|
+
const kind = match.getType();
|
|
52
|
+
if (kind !== 'email' && kind !== 'phone' && kind !== 'url')
|
|
53
|
+
return _jsx(Text, { children: value }, offset);
|
|
54
|
+
const href = kind === 'email' ? 'mailto:' + encodeURIComponent(address.slice('mailto:'.length)) : address;
|
|
55
|
+
const copy = kind === 'url' ? address : address.slice(address.indexOf(':') + 1);
|
|
56
|
+
return _jsx(NativeText, { accessibilityRole: "link", onPress: () => {
|
|
57
|
+
void Linking.openURL(href).catch(() => undefined);
|
|
58
|
+
}, onLongPress: () => {
|
|
59
|
+
clipboard.setString(copy);
|
|
60
|
+
showToast({ message: t(copiedMessages[kind]), bottomTabsVisible });
|
|
61
|
+
}, children: _jsx(Text, { variation: "interactive", children: value }) }, offset);
|
|
62
|
+
}) }) });
|
|
63
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { KeyboardAwareScrollViewProps } from "react-native-keyboard-controller";
|
|
2
|
+
import { type BottomSheetScrollViewMethods } from "@gorhom/bottom-sheet";
|
|
3
|
+
declare const BottomSheetKeyboardAwareScrollView: import("react").NamedExoticComponent<{
|
|
4
|
+
bottomOffset?: number;
|
|
5
|
+
disableScrollOnKeyboardHide?: boolean;
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
extraKeyboardSpace?: number;
|
|
8
|
+
mode?: import("react-native-keyboard-controller").KeyboardAwareScrollViewMode;
|
|
9
|
+
ScrollViewComponent?: import("react-native-keyboard-controller/lib/typescript/components/ScrollViewWithBottomPadding/index.js").AnimatedScrollViewComponent;
|
|
10
|
+
} & import("react-native").ScrollViewProps & import("react").RefAttributes<BottomSheetScrollViewMethods>>;
|
|
11
|
+
export { BottomSheetKeyboardAwareScrollView };
|
|
12
|
+
export type { KeyboardAwareScrollViewProps };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { memo } from "react";
|
|
2
|
+
import { KeyboardAwareScrollView } from "react-native-keyboard-controller";
|
|
3
|
+
import { SCROLLABLE_TYPE, createBottomSheetScrollableComponent, } from "@gorhom/bottom-sheet";
|
|
4
|
+
import Reanimated from "react-native-reanimated";
|
|
5
|
+
/**
|
|
6
|
+
* A keyboard-aware scroll view component that integrates with @gorhom/bottom-sheet.
|
|
7
|
+
*
|
|
8
|
+
* This component wraps `KeyboardAwareScrollView` from `react-native-keyboard-controller`
|
|
9
|
+
* with the bottom sheet HOCs to ensure proper keyboard handling on Android when using
|
|
10
|
+
* TextInputs inside a BottomSheet.
|
|
11
|
+
*
|
|
12
|
+
* @see https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-aware-scroll-view#gorhombottom-sheet
|
|
13
|
+
*/
|
|
14
|
+
const AnimatedScrollView = Reanimated.createAnimatedComponent(KeyboardAwareScrollView);
|
|
15
|
+
const BottomSheetScrollViewComponent = createBottomSheetScrollableComponent(SCROLLABLE_TYPE.SCROLLVIEW, AnimatedScrollView);
|
|
16
|
+
const BottomSheetKeyboardAwareScrollView = memo(BottomSheetScrollViewComponent);
|
|
17
|
+
BottomSheetKeyboardAwareScrollView.displayName =
|
|
18
|
+
"BottomSheetKeyboardAwareScrollView";
|
|
19
|
+
export { BottomSheetKeyboardAwareScrollView };
|
package/dist/Button.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import type { Ref } from 'react';
|
|
3
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
4
|
+
import type { IconNames } from './Icon.js';
|
|
5
|
+
export type ButtonVariation = 'work' | 'cancel' | 'destructive' | 'learning';
|
|
6
|
+
export type ButtonType = 'primary' | 'secondary' | 'tertiary';
|
|
7
|
+
export type ButtonSize = 'small' | 'base';
|
|
8
|
+
interface ButtonOptions {
|
|
9
|
+
readonly ref?: Ref<View>;
|
|
10
|
+
readonly onPress?: () => void;
|
|
11
|
+
readonly variation?: ButtonVariation;
|
|
12
|
+
readonly type?: ButtonType;
|
|
13
|
+
readonly size?: ButtonSize;
|
|
14
|
+
readonly disabled?: boolean;
|
|
15
|
+
readonly loading?: boolean;
|
|
16
|
+
readonly fullWidth?: boolean;
|
|
17
|
+
readonly fullHeight?: boolean;
|
|
18
|
+
readonly accessibilityHint?: string;
|
|
19
|
+
readonly accessibilityLabel?: string;
|
|
20
|
+
readonly testID?: string;
|
|
21
|
+
readonly UNSAFE_style?: {
|
|
22
|
+
container?: StyleProp<ViewStyle>;
|
|
23
|
+
contentContainer?: StyleProp<ViewStyle>;
|
|
24
|
+
actionLabelContainer?: StyleProp<ViewStyle>;
|
|
25
|
+
iconContainer?: StyleProp<ViewStyle>;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export type ButtonProps = ButtonOptions & ({
|
|
29
|
+
readonly label: string;
|
|
30
|
+
readonly icon?: IconNames;
|
|
31
|
+
} | {
|
|
32
|
+
readonly label?: never;
|
|
33
|
+
readonly icon: IconNames;
|
|
34
|
+
readonly accessibilityLabel: string;
|
|
35
|
+
});
|
|
36
|
+
export declare function Button({ ref, label, onPress, variation, type, size, disabled, loading, fullWidth, fullHeight, accessibilityLabel, accessibilityHint, testID, UNSAFE_style, icon, }: ButtonProps): import("react").JSX.Element;
|
|
37
|
+
export {};
|
package/dist/Button.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ActivityIndicator, Text, TouchableHighlight, View } from 'react-native';
|
|
3
|
+
import { radii, spacing, typography } from '@zj-dynamics/design';
|
|
4
|
+
import { useTheme } from './theme.js';
|
|
5
|
+
import { Icon } from './Icon.js';
|
|
6
|
+
export function Button({ ref, label, onPress, variation = 'work', type = 'primary', size = 'base', disabled = false, loading = false, fullWidth = true, fullHeight = false, accessibilityLabel, accessibilityHint, testID, UNSAFE_style, icon, }) {
|
|
7
|
+
const { colors } = useTheme();
|
|
8
|
+
const accent = variation === 'destructive' ? colors.destructive :
|
|
9
|
+
variation === 'learning' ? colors.focus : variation === 'cancel' ? colors.textMuted : colors.interactive;
|
|
10
|
+
const solid = type === 'primary' && variation !== 'cancel';
|
|
11
|
+
const foreground = solid ? colors.textReverse : accent;
|
|
12
|
+
return _jsx(TouchableHighlight, { ref: ref, testID: testID, accessibilityRole: "button", accessibilityLabel: accessibilityLabel ?? label, accessibilityHint: accessibilityHint, accessibilityState: { disabled: disabled || loading, busy: loading }, disabled: disabled || loading, onPress: onPress, underlayColor: colors.interactiveSubtle, style: [
|
|
13
|
+
{ borderRadius: radii.control }, fullWidth && { alignSelf: 'stretch' },
|
|
14
|
+
fullHeight && { flexGrow: 1 }, UNSAFE_style?.container,
|
|
15
|
+
], children: _jsxs(View, { style: [
|
|
16
|
+
{ minHeight: size === 'small' ? 40 : 48, flexDirection: 'row', gap: spacing.small,
|
|
17
|
+
borderRadius: radii.control, borderWidth: 1, alignItems: 'center', justifyContent: 'center',
|
|
18
|
+
paddingHorizontal: spacing.base, paddingVertical: spacing.small,
|
|
19
|
+
backgroundColor: solid ? accent : colors.surface,
|
|
20
|
+
borderColor: type === 'tertiary' ? 'transparent' : solid ? accent : colors.border,
|
|
21
|
+
opacity: disabled ? .5 : 1 },
|
|
22
|
+
fullHeight && { flexGrow: 1 }, UNSAFE_style?.contentContainer,
|
|
23
|
+
], children: [loading && _jsx(ActivityIndicator, { color: foreground }), icon && _jsx(View, { style: UNSAFE_style?.iconContainer, children: _jsx(Icon, { name: icon, size: size, customColor: foreground }) }), label !== undefined && _jsx(View, { style: UNSAFE_style?.actionLabelContainer, children: _jsx(Text, { style: { color: foreground, fontSize: typography.fontSize, fontWeight: '600' }, children: label }) })] }) });
|
|
24
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
interface CheckboxPresentation {
|
|
3
|
+
readonly label?: string;
|
|
4
|
+
readonly defaultChecked?: boolean;
|
|
5
|
+
readonly indeterminate?: boolean;
|
|
6
|
+
readonly disabled?: boolean;
|
|
7
|
+
readonly assistiveText?: string;
|
|
8
|
+
readonly accessibilityLabel?: string;
|
|
9
|
+
}
|
|
10
|
+
export type CheckboxProps = CheckboxPresentation & ({
|
|
11
|
+
readonly checked: boolean;
|
|
12
|
+
readonly name?: string;
|
|
13
|
+
onChange(checked: boolean): void;
|
|
14
|
+
} | {
|
|
15
|
+
readonly checked?: never;
|
|
16
|
+
readonly name: string;
|
|
17
|
+
onChange?(checked: boolean): void;
|
|
18
|
+
});
|
|
19
|
+
export declare function Checkbox(props: CheckboxProps): import("react").JSX.Element;
|
|
20
|
+
export interface CheckboxGroupState {
|
|
21
|
+
parentChecked?: boolean;
|
|
22
|
+
childrenChecked: Record<string, boolean>;
|
|
23
|
+
}
|
|
24
|
+
interface CheckboxGroupPresentation extends CheckboxPresentation {
|
|
25
|
+
readonly children: ReactElement<CheckboxProps>[];
|
|
26
|
+
}
|
|
27
|
+
export type CheckboxGroupProps = CheckboxGroupPresentation & ({
|
|
28
|
+
readonly state: CheckboxGroupState;
|
|
29
|
+
readonly name?: string;
|
|
30
|
+
onChange(state: CheckboxGroupState): void;
|
|
31
|
+
} | {
|
|
32
|
+
readonly state?: never;
|
|
33
|
+
readonly name: string;
|
|
34
|
+
onChange?(state: CheckboxGroupState): void;
|
|
35
|
+
});
|
|
36
|
+
export declare function CheckboxGroup(props: CheckboxGroupProps): import("react").JSX.Element;
|
|
37
|
+
export {};
|
package/dist/Checkbox.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Children, Fragment, isValidElement } from 'react';
|
|
3
|
+
import { Pressable, View } from 'react-native';
|
|
4
|
+
import { Divider } from './Divider.js';
|
|
5
|
+
import { Icon } from './Icon.js';
|
|
6
|
+
import { Text } from './foundationText/Text/index.js';
|
|
7
|
+
import { useFoundationTokens } from './foundationTokens.js';
|
|
8
|
+
import { useControlledField } from './controlledField.js';
|
|
9
|
+
function CheckboxControl({ checked, label, indeterminate = false, disabled = false, assistiveText, accessibilityLabel, onChange }) {
|
|
10
|
+
const tokens = useFoundationTokens();
|
|
11
|
+
const dimension = tokens['space-large'] + tokens['space-smaller'];
|
|
12
|
+
const border = disabled ? tokens['color-disabled'] : tokens['color-interactive'];
|
|
13
|
+
const selected = checked || indeterminate;
|
|
14
|
+
const variation = disabled ? 'disabled' : 'subdued';
|
|
15
|
+
return _jsx(Pressable, { accessibilityRole: "checkbox", accessibilityLabel: accessibilityLabel || label, accessibilityState: { disabled, checked: indeterminate ? 'mixed' : checked }, disabled: disabled, onPress: () => onChange(!checked), style: ({ pressed }) => ({ width: '100%', opacity: pressed ? 0.2 : 1 }), children: _jsxs(View, { style: { minHeight: 48, flexDirection: 'row', justifyContent: 'space-between', alignItems: assistiveText ? 'flex-start' : 'center' }, children: [label && _jsxs(View, { style: { flex: 1, gap: tokens['space-smaller'] }, children: [_jsx(Text, { align: "start", variation: variation, children: label }), assistiveText && _jsx(Text, { align: "start", level: "textSupporting", variation: variation, children: assistiveText })] }), _jsx(View, { style: { width: dimension, height: dimension, justifyContent: 'flex-end', marginLeft: tokens['space-smaller'],
|
|
16
|
+
borderWidth: tokens['border-thick'], borderRadius: tokens['radius-base'], borderColor: border,
|
|
17
|
+
backgroundColor: selected ? border : tokens['color-overlay--dimmed'] }, children: selected && _jsx(Icon, { name: indeterminate ? 'minus2' : 'checkmark', color: "surface" }) })] }) });
|
|
18
|
+
}
|
|
19
|
+
function NamedCheckbox({ name, defaultChecked, onChange, ...props }) {
|
|
20
|
+
const field = useControlledField(name, defaultChecked ?? false);
|
|
21
|
+
return _jsx(CheckboxControl, { ...props, checked: field.value, onChange: checked => {
|
|
22
|
+
onChange?.(checked);
|
|
23
|
+
field.onChange(checked);
|
|
24
|
+
} });
|
|
25
|
+
}
|
|
26
|
+
export function Checkbox(props) {
|
|
27
|
+
if (props.checked !== undefined && props.onChange) {
|
|
28
|
+
return _jsx(CheckboxControl, { ...props, checked: props.checked, onChange: props.onChange });
|
|
29
|
+
}
|
|
30
|
+
if (props.name)
|
|
31
|
+
return _jsx(NamedCheckbox, { ...props, name: props.name });
|
|
32
|
+
throw new Error('Checkbox was given invalid props');
|
|
33
|
+
}
|
|
34
|
+
function getOptions(children) {
|
|
35
|
+
return Children.toArray(children).flatMap(child => {
|
|
36
|
+
if (!isValidElement(child))
|
|
37
|
+
return [];
|
|
38
|
+
const { name } = child.props;
|
|
39
|
+
if (!name)
|
|
40
|
+
throw new Error('You must provide a name to checkboxes in a checkbox group');
|
|
41
|
+
return [{ name, props: child.props }];
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function CheckboxGroupControls({ children, state, onChange, label, accessibilityLabel, disabled = false }) {
|
|
45
|
+
const tokens = useFoundationTokens();
|
|
46
|
+
const options = getOptions(children);
|
|
47
|
+
const entries = options.map(option => [option.name, state.childrenChecked[option.name] ?? false]);
|
|
48
|
+
const enabled = options.filter(option => !disabled && !option.props.disabled);
|
|
49
|
+
const mixed = entries.some(([, checked]) => checked) && entries.some(([, checked]) => !checked);
|
|
50
|
+
function update(values, empty) {
|
|
51
|
+
onChange({ childrenChecked: values, parentChecked: enabled.length ? enabled.every(({ name }) => values[name]) : empty });
|
|
52
|
+
}
|
|
53
|
+
return _jsxs(View, { children: [label && _jsxs(_Fragment, { children: [_jsx(CheckboxControl, { label: label, accessibilityLabel: accessibilityLabel || label, disabled: disabled, checked: state.parentChecked ?? false, indeterminate: mixed, onChange: checked => update(Object.fromEntries(entries.map(([name, previous]) => [name, enabled.some(option => option.name === name) ? checked : previous])), checked) }), _jsx(Divider, {})] }), _jsx(View, { style: label ? { marginLeft: tokens['space-large'] } : undefined, children: options.map(({ name, props }, index) => _jsxs(Fragment, { children: [_jsx(CheckboxControl, { ...props, disabled: disabled || props.disabled === true, checked: state.childrenChecked[name] ?? false, onChange: checked => {
|
|
54
|
+
props.onChange?.(checked);
|
|
55
|
+
update({ ...Object.fromEntries(entries), [name]: checked }, true);
|
|
56
|
+
} }), index < options.length - 1 && _jsx(Divider, {})] }, name)) })] });
|
|
57
|
+
}
|
|
58
|
+
function NamedCheckboxGroup({ name, onChange, children, ...props }) {
|
|
59
|
+
const field = useControlledField(name, { parentChecked: false,
|
|
60
|
+
childrenChecked: Object.fromEntries(getOptions(children).map(({ name: option }) => [option, false])) });
|
|
61
|
+
return _jsx(CheckboxGroupControls, { ...props, children: children, state: field.value, onChange: state => {
|
|
62
|
+
onChange?.(state);
|
|
63
|
+
field.onChange(state);
|
|
64
|
+
} });
|
|
65
|
+
}
|
|
66
|
+
export function CheckboxGroup(props) {
|
|
67
|
+
if (props.state !== undefined && props.onChange) {
|
|
68
|
+
return _jsx(CheckboxGroupControls, { ...props, state: props.state, onChange: props.onChange });
|
|
69
|
+
}
|
|
70
|
+
if (props.name)
|
|
71
|
+
return _jsx(NamedCheckboxGroup, { ...props, name: props.name });
|
|
72
|
+
throw new Error('CheckboxGroup passed invalid props');
|
|
73
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
export type Spacing = 'none' | 'minuscule' | 'smallest' | 'smaller' | 'small' | 'slim' | 'base' | 'large' | 'larger' | 'largest' | 'extravagant';
|
|
4
|
+
export interface ContentUnsafeStyle {
|
|
5
|
+
container?: StyleProp<ViewStyle>;
|
|
6
|
+
childWrapper?: StyleProp<ViewStyle>;
|
|
7
|
+
}
|
|
8
|
+
export interface ContentProps {
|
|
9
|
+
readonly children: ReactNode;
|
|
10
|
+
readonly spacing?: Spacing;
|
|
11
|
+
readonly childSpacing?: Spacing;
|
|
12
|
+
readonly direction?: 'horizontal' | 'vertical';
|
|
13
|
+
readonly UNSAFE_style?: ContentUnsafeStyle;
|
|
14
|
+
}
|
|
15
|
+
export declare function spaceValue(space: Spacing): number;
|
|
16
|
+
export declare function Content({ children, spacing, childSpacing, direction, UNSAFE_style }: ContentProps): import("react").JSX.Element;
|
package/dist/Content.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Children } from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { platformTokens } from './foundationTokens.js';
|
|
5
|
+
export function spaceValue(space) {
|
|
6
|
+
return space === 'none' ? 0 : platformTokens[`space-${space}`];
|
|
7
|
+
}
|
|
8
|
+
export function Content({ children, spacing = 'base', childSpacing = 'base', direction = 'vertical', UNSAFE_style }) {
|
|
9
|
+
const horizontal = direction === 'horizontal';
|
|
10
|
+
const items = Children.toArray(children);
|
|
11
|
+
const padding = spaceValue(childSpacing);
|
|
12
|
+
return (_jsx(View, { style: [horizontal && { flexDirection: 'row' }, { padding: spaceValue(spacing) }, UNSAFE_style?.container], children: items.length === 1 ? children : items.map((item, index) => (_jsx(View, { style: [
|
|
13
|
+
horizontal && { flexGrow: 1, flexShrink: 1, flexBasis: 0 },
|
|
14
|
+
index > 0 && (horizontal ? { paddingLeft: padding } : { paddingTop: padding }),
|
|
15
|
+
UNSAFE_style?.childWrapper,
|
|
16
|
+
], children: item }, index))) }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { PropsWithChildren, Ref, RefObject } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
export { useIsKeyboardHandledByScrollView } from './sheetContext.js';
|
|
4
|
+
export declare const OverlayProvider: ({ children, }: import("@gorhom/bottom-sheet/lib/typescript/components/bottomSheetModalProvider/types.js").BottomSheetModalProviderProps) => React.JSX.Element;
|
|
5
|
+
export interface ContentOverlayRef {
|
|
6
|
+
open(opener?: RefObject<View | null>): void;
|
|
7
|
+
close(): void;
|
|
8
|
+
}
|
|
9
|
+
export type ModalBackgroundColor = 'surface' | 'background';
|
|
10
|
+
export interface ContentOverlayProps extends PropsWithChildren {
|
|
11
|
+
ref?: Ref<ContentOverlayRef>;
|
|
12
|
+
title?: string;
|
|
13
|
+
onOpen?: () => void;
|
|
14
|
+
onClose?: () => void;
|
|
15
|
+
onBeforeExit?: () => void;
|
|
16
|
+
dismissLabel?: string;
|
|
17
|
+
scrollEnabled?: boolean;
|
|
18
|
+
modalBackgroundColor?: ModalBackgroundColor;
|
|
19
|
+
keyboardShouldPersistTaps?: boolean;
|
|
20
|
+
accessibilityLabel?: string;
|
|
21
|
+
fullScreen?: boolean;
|
|
22
|
+
showDismiss?: boolean;
|
|
23
|
+
isDraggable?: boolean;
|
|
24
|
+
adjustToContentHeight?: boolean;
|
|
25
|
+
enablePanDownToClose?: boolean;
|
|
26
|
+
allowDragWithBeforeExit?: boolean;
|
|
27
|
+
enableContentPanningGesture?: boolean;
|
|
28
|
+
snapPoints?: Array<number | string>;
|
|
29
|
+
loading?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare function ContentOverlay({ ref, children, title, onOpen, onClose, onBeforeExit, dismissLabel, scrollEnabled, modalBackgroundColor, keyboardShouldPersistTaps, accessibilityLabel, fullScreen, showDismiss, isDraggable, adjustToContentHeight, enablePanDownToClose, allowDragWithBeforeExit, enableContentPanningGesture, snapPoints, loading, }: ContentOverlayProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BottomSheetBackdrop, BottomSheetModal, BottomSheetModalProvider, BottomSheetScrollView } from '@gorhom/bottom-sheet';
|
|
3
|
+
import { createContext, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { AccessibilityInfo, BackHandler, Keyboard, Platform, StyleSheet, Text, View, useWindowDimensions } from 'react-native';
|
|
5
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
6
|
+
import { spacing, typography } from '@zj-dynamics/design';
|
|
7
|
+
import { Button } from './Button.js';
|
|
8
|
+
import { ScrollKeyboardContext, SheetInputContext } from './sheetContext.js';
|
|
9
|
+
import { BottomSheetKeyboardAwareScrollView } from './BottomSheetKeyboardAwareScrollView.js';
|
|
10
|
+
import { ThemeSnapshot, useThemeScope } from './theme.js';
|
|
11
|
+
import { useIsScreenReaderEnabled } from './useIsScreenReaderEnabled.js';
|
|
12
|
+
export { useIsKeyboardHandledByScrollView } from './sheetContext.js';
|
|
13
|
+
const OverlayAccessibilityContext = createContext(null);
|
|
14
|
+
function AndroidOverlayProvider({ children, ...props }) {
|
|
15
|
+
const [sheets, setSheets] = useState([]);
|
|
16
|
+
const setPresented = useCallback((id, presented) => {
|
|
17
|
+
setSheets(current => current.includes(id) === presented
|
|
18
|
+
? current
|
|
19
|
+
: presented ? [...current, id] : current.filter(sheet => sheet !== id));
|
|
20
|
+
}, []);
|
|
21
|
+
const top = sheets.at(-1);
|
|
22
|
+
const scope = useMemo(() => ({ top, setPresented }), [top, setPresented]);
|
|
23
|
+
return _jsx(OverlayAccessibilityContext.Provider, { value: scope, children: _jsx(BottomSheetModalProvider, { ...props, children: _jsx(View, { style: styles.app, collapsable: false, importantForAccessibility: top ? 'no-hide-descendants' : 'auto', children: children }) }) });
|
|
24
|
+
}
|
|
25
|
+
export const OverlayProvider = Platform.OS === 'android' ? AndroidOverlayProvider : BottomSheetModalProvider;
|
|
26
|
+
const fullHeight = ['100%'];
|
|
27
|
+
const styles = StyleSheet.create({ app: { flex: 1 } });
|
|
28
|
+
function useAndroidKeyboardOverlap(active) {
|
|
29
|
+
const { height } = useWindowDimensions();
|
|
30
|
+
const [keyboardTop, setKeyboardTop] = useState();
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!active || Platform.OS !== 'android')
|
|
33
|
+
return;
|
|
34
|
+
setKeyboardTop(Keyboard.metrics()?.screenY);
|
|
35
|
+
const show = Keyboard.addListener('keyboardDidShow', event => setKeyboardTop(event.endCoordinates.screenY));
|
|
36
|
+
const hide = Keyboard.addListener('keyboardDidHide', () => setKeyboardTop(undefined));
|
|
37
|
+
return () => {
|
|
38
|
+
show.remove();
|
|
39
|
+
hide.remove();
|
|
40
|
+
};
|
|
41
|
+
}, [active]);
|
|
42
|
+
// In an edge-to-edge Activity the keyboard can cover part of the React window
|
|
43
|
+
// even in resize mode. Add scroll travel for just the covered area.
|
|
44
|
+
return active && keyboardTop !== undefined ? Math.max(0, height - keyboardTop) : 0;
|
|
45
|
+
}
|
|
46
|
+
export function ContentOverlay({ ref, children, title, onOpen, onClose, onBeforeExit, dismissLabel, scrollEnabled = false, modalBackgroundColor = 'surface', keyboardShouldPersistTaps = false, accessibilityLabel, fullScreen = false, showDismiss = false, isDraggable = true, adjustToContentHeight = false, enablePanDownToClose, allowDragWithBeforeExit = false, enableContentPanningGesture, snapPoints, loading = false, }) {
|
|
47
|
+
const modal = useRef(null);
|
|
48
|
+
const opened = useRef(false);
|
|
49
|
+
const opener = useRef(undefined);
|
|
50
|
+
const restoreFocus = useRef(undefined);
|
|
51
|
+
const titleRef = useRef(null);
|
|
52
|
+
const dismissRef = useRef(null);
|
|
53
|
+
const sheetId = useRef(Symbol('ContentOverlay')).current;
|
|
54
|
+
const scope = useContext(OverlayAccessibilityContext);
|
|
55
|
+
const setPresented = scope?.setPresented;
|
|
56
|
+
const isTop = !scope || scope.top === sheetId;
|
|
57
|
+
const SheetContainer = useMemo(() => function SheetContainer({ children }) {
|
|
58
|
+
const current = useContext(OverlayAccessibilityContext);
|
|
59
|
+
return _jsx(View, { style: StyleSheet.absoluteFill, pointerEvents: "box-none", collapsable: false, importantForAccessibility: current?.top && current.top !== sheetId ? 'no-hide-descendants' : 'auto', children: children });
|
|
60
|
+
}, [sheetId]);
|
|
61
|
+
const [active, setActive] = useState(false);
|
|
62
|
+
const [position, setPosition] = useState(-1);
|
|
63
|
+
const insets = useSafeAreaInsets();
|
|
64
|
+
const keyboardOverlap = useAndroidKeyboardOverlap(active && !scrollEnabled);
|
|
65
|
+
const pinSheetAboveAndroidKeyboard = scrollEnabled && Platform.OS === 'android';
|
|
66
|
+
const ScrollView = scrollEnabled ? BottomSheetKeyboardAwareScrollView : BottomSheetScrollView;
|
|
67
|
+
const theme = useThemeScope();
|
|
68
|
+
const drags = isDraggable && (!onBeforeExit || allowDragWithBeforeExit);
|
|
69
|
+
const panToClose = enablePanDownToClose ?? drags;
|
|
70
|
+
const scrolls = enableContentPanningGesture ?? drags;
|
|
71
|
+
const readerEnabled = useIsScreenReaderEnabled();
|
|
72
|
+
const dismissVisible = showDismiss || fullScreen || readerEnabled || dismissLabel !== undefined ||
|
|
73
|
+
(!adjustToContentHeight && position === 0);
|
|
74
|
+
const resolvedSnapPoints = snapPoints?.length ? snapPoints : fullHeight;
|
|
75
|
+
const dynamicSize = !snapPoints?.length && (adjustToContentHeight || (!fullScreen && drags));
|
|
76
|
+
const close = useCallback(() => {
|
|
77
|
+
if (Platform.OS === 'android')
|
|
78
|
+
Keyboard.dismiss();
|
|
79
|
+
modal.current?.dismiss();
|
|
80
|
+
}, []);
|
|
81
|
+
const requestClose = useCallback(() => {
|
|
82
|
+
if (onBeforeExit)
|
|
83
|
+
onBeforeExit();
|
|
84
|
+
else
|
|
85
|
+
close();
|
|
86
|
+
}, [close, onBeforeExit]);
|
|
87
|
+
useImperativeHandle(ref, () => ({
|
|
88
|
+
open(trigger) {
|
|
89
|
+
if (!opened.current)
|
|
90
|
+
opener.current = trigger;
|
|
91
|
+
modal.current?.present();
|
|
92
|
+
},
|
|
93
|
+
close,
|
|
94
|
+
}), [close]);
|
|
95
|
+
useEffect(() => () => setPresented?.(sheetId, false), [setPresented, sheetId]);
|
|
96
|
+
const sentEntryFocus = useRef(false);
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
if (Platform.OS !== 'android' || !readerEnabled)
|
|
99
|
+
return;
|
|
100
|
+
if (active && (!isTop || sentEntryFocus.current))
|
|
101
|
+
return;
|
|
102
|
+
const frame = requestAnimationFrame(() => {
|
|
103
|
+
const target = active ? titleRef.current ?? dismissRef.current : restoreFocus.current?.current;
|
|
104
|
+
if (!target)
|
|
105
|
+
return;
|
|
106
|
+
if (active)
|
|
107
|
+
sentEntryFocus.current = true;
|
|
108
|
+
else
|
|
109
|
+
restoreFocus.current = undefined;
|
|
110
|
+
AccessibilityInfo.sendAccessibilityEvent(target, 'focus');
|
|
111
|
+
});
|
|
112
|
+
return () => cancelAnimationFrame(frame);
|
|
113
|
+
}, [active, isTop, readerEnabled]);
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
if (!active || Platform.OS !== 'android')
|
|
116
|
+
return;
|
|
117
|
+
const subscription = BackHandler.addEventListener('hardwareBackPress', () => {
|
|
118
|
+
requestClose();
|
|
119
|
+
return true;
|
|
120
|
+
});
|
|
121
|
+
return () => subscription.remove();
|
|
122
|
+
}, [active, requestClose]);
|
|
123
|
+
const backdrop = useCallback((props) => {
|
|
124
|
+
const content = _jsx(BottomSheetBackdrop, { ...props, appearsOnIndex: 0, disappearsOnIndex: -1, pressBehavior: onBeforeExit ? 'none' : 'close' });
|
|
125
|
+
return Platform.OS === 'android'
|
|
126
|
+
? _jsx(View, { style: StyleSheet.absoluteFill, pointerEvents: "box-none", importantForAccessibility: "no-hide-descendants", children: content })
|
|
127
|
+
: content;
|
|
128
|
+
}, [onBeforeExit]);
|
|
129
|
+
return _jsx(BottomSheetModal, { ref: modal, accessible: false, snapPoints: resolvedSnapPoints, ...(scope && { containerComponent: SheetContainer }), enableDynamicSizing: dynamicSize, topInset: insets.top, enablePanDownToClose: panToClose, ...(!drags && { handleComponent: null }), enableHandlePanningGesture: drags, enableContentPanningGesture: scrolls, keyboardBehavior: pinSheetAboveAndroidKeyboard ? 'fillParent' : 'interactive', keyboardBlurBehavior: "restore", android_keyboardInputMode: "adjustResize", backgroundStyle: { backgroundColor: theme.colors[modalBackgroundColor] }, handleIndicatorStyle: { backgroundColor: theme.colors.border }, backdropComponent: backdrop, onChange: (index, nextPosition) => {
|
|
130
|
+
setPosition(nextPosition);
|
|
131
|
+
if (index < 0 || opened.current)
|
|
132
|
+
return;
|
|
133
|
+
opened.current = true;
|
|
134
|
+
setPresented?.(sheetId, true);
|
|
135
|
+
setActive(true);
|
|
136
|
+
onOpen?.();
|
|
137
|
+
}, onDismiss: () => {
|
|
138
|
+
if (Platform.OS === 'android')
|
|
139
|
+
Keyboard.dismiss();
|
|
140
|
+
const wasOpen = opened.current;
|
|
141
|
+
opened.current = false;
|
|
142
|
+
sentEntryFocus.current = false;
|
|
143
|
+
restoreFocus.current = wasOpen ? opener.current : undefined;
|
|
144
|
+
opener.current = undefined;
|
|
145
|
+
setPresented?.(sheetId, false);
|
|
146
|
+
setActive(false);
|
|
147
|
+
if (wasOpen)
|
|
148
|
+
onClose?.();
|
|
149
|
+
}, children: _jsx(ThemeSnapshot, { value: theme, children: _jsx(ScrollKeyboardContext.Provider, { value: scrollEnabled, children: _jsx(SheetInputContext.Provider, { value: !scrollEnabled || pinSheetAboveAndroidKeyboard, children: _jsxs(ScrollView, { ...(scrollEnabled && { bottomOffset: 20 }), keyboardShouldPersistTaps: keyboardShouldPersistTaps ? 'handled' : 'never', contentContainerStyle: { paddingBottom: Math.max(spacing.base, insets.bottom) + keyboardOverlap }, children: [title && _jsx(Text, { ref: titleRef, accessibilityRole: "header", style: { color: loading ? theme.colors.textMuted : theme.colors.text,
|
|
150
|
+
fontSize: typography.fontSize, fontWeight: '600' }, children: title }), children, dismissVisible && _jsx(Button, { ref: dismissRef, label: dismissLabel ?? 'Dismiss', testID: "sheet-dismiss", type: "tertiary", variation: loading ? 'cancel' : 'work', ...(accessibilityLabel !== undefined && { accessibilityLabel }), onPress: requestClose })] }) }) }) }) });
|
|
151
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface DividerProps {
|
|
2
|
+
readonly size?: 'base' | 'large' | 'larger' | 'largest';
|
|
3
|
+
readonly direction?: 'horizontal' | 'vertical';
|
|
4
|
+
readonly testID?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function Divider({ size, direction, testID }: DividerProps): import("react").JSX.Element;
|
package/dist/Divider.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { platformTokens, useFoundationTokens } from './foundationTokens.js';
|
|
4
|
+
const widths = {
|
|
5
|
+
base: platformTokens['border-base'],
|
|
6
|
+
large: platformTokens['border-thick'],
|
|
7
|
+
larger: platformTokens['border-thicker'],
|
|
8
|
+
largest: platformTokens['border-thickest'],
|
|
9
|
+
};
|
|
10
|
+
const opacity = { base: 1, large: 0.875, larger: 0.625, largest: 0.375 };
|
|
11
|
+
export function Divider({ size = 'base', direction = 'horizontal', testID = 'Divider' }) {
|
|
12
|
+
const color = useFoundationTokens()['color-border'];
|
|
13
|
+
const borderColor = typeof color === 'string' ? color : platformTokens['color-border'];
|
|
14
|
+
return (_jsx(View, { testID: testID, style: [
|
|
15
|
+
{ margin: 0, opacity: opacity[size] },
|
|
16
|
+
direction === 'horizontal'
|
|
17
|
+
? { height: 1, width: 'auto', borderBottomColor: borderColor, borderBottomWidth: widths[size] }
|
|
18
|
+
: { height: '100%', width: 1, borderRightColor: borderColor, borderRightWidth: widths[size] },
|
|
19
|
+
] }));
|
|
20
|
+
}
|
package/dist/Flex.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
import type { ViewStyle } from 'react-native';
|
|
3
|
+
export type ColumnKeys = 'grow' | 'shrink';
|
|
4
|
+
export type FlexSpacing = 'none' | 'smallest' | 'smaller' | 'small' | 'base' | 'large';
|
|
5
|
+
export interface FlexProps {
|
|
6
|
+
readonly template?: ColumnKeys[];
|
|
7
|
+
readonly align?: ViewStyle['alignItems'];
|
|
8
|
+
readonly gap?: FlexSpacing;
|
|
9
|
+
}
|
|
10
|
+
export declare function Flex({ template, align, gap, children }: PropsWithChildren<FlexProps>): import("react").JSX.Element;
|