@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/dist/Flex.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Children, Fragment } from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { Content, spaceValue } from './Content.js';
|
|
5
|
+
const columns = {
|
|
6
|
+
grow: { flexGrow: 1, flexShrink: 0, flexBasis: 0 },
|
|
7
|
+
shrink: { flexGrow: 0, flexShrink: 1 },
|
|
8
|
+
};
|
|
9
|
+
export function Flex({ template = [], align = 'center', gap = 'base', children }) {
|
|
10
|
+
if (template.length === 1)
|
|
11
|
+
console.warn('Please use <Content /> component for a stacked layout');
|
|
12
|
+
const items = Children.toArray(children);
|
|
13
|
+
const width = template.length || items.length || 1;
|
|
14
|
+
const rows = Array.from({ length: Math.ceil(items.length / width) }, (_, row) => items.slice(row * width, (row + 1) * width));
|
|
15
|
+
return _jsx(Content, { spacing: "none", childSpacing: gap, children: rows.map((row, rowIndex) => {
|
|
16
|
+
const cells = rows.length === 1 ? row : Array.from({ length: width }, (_, index) => row[index] ?? _jsx(Fragment, {}, index));
|
|
17
|
+
return _jsx(View, { testID: "ATL-Flex-Row", style: { flexDirection: 'row', alignItems: align }, children: cells.map((child, index) => (_jsx(View, { style: [columns[template[index] ?? 'grow'], index > 0 && { paddingLeft: spaceValue(gap) }], children: child }, index))) }, rowIndex);
|
|
18
|
+
}) });
|
|
19
|
+
}
|
package/dist/Icon.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IconColorNames, IconNames, IconSizes } from '@zj-dynamics/design/native';
|
|
2
|
+
export type { IconColorNames, IconNames, IconSizes } from '@zj-dynamics/design/native';
|
|
3
|
+
export { iconNames, isIconName } from '@zj-dynamics/design/native';
|
|
4
|
+
export interface IconProps {
|
|
5
|
+
readonly name: IconNames;
|
|
6
|
+
readonly color?: IconColorNames;
|
|
7
|
+
readonly size?: IconSizes;
|
|
8
|
+
readonly customColor?: string;
|
|
9
|
+
readonly testID?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function Icon({ name, color, customColor, size, testID }: IconProps): import("react").JSX.Element;
|
package/dist/Icon.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Path, Svg } from 'react-native-svg';
|
|
3
|
+
import { getIcon } from '@zj-dynamics/design/native';
|
|
4
|
+
import { useFoundationTokens } from './foundationTokens.js';
|
|
5
|
+
export { iconNames, isIconName } from '@zj-dynamics/design/native';
|
|
6
|
+
export function Icon({ name, color, customColor, size = 'base', testID }) {
|
|
7
|
+
const tokens = useFoundationTokens();
|
|
8
|
+
const { svgStyle, paths, viewBox } = getIcon({
|
|
9
|
+
name, size, platform: 'mobile', format: 'js', tokens,
|
|
10
|
+
...(color !== undefined && { color }),
|
|
11
|
+
...(customColor !== undefined && { customColor }),
|
|
12
|
+
});
|
|
13
|
+
return (_jsx(Svg, { style: { ...svgStyle, display: 'flex' }, testID: testID || name, viewBox: viewBox, children: paths?.map((path, index) => {
|
|
14
|
+
const fill = path.fill ?? (customColor || svgStyle.fill);
|
|
15
|
+
return _jsx(Path, { d: path.d, ...(fill !== undefined && { fill }), ...(path.fillOpacity !== undefined && { fillOpacity: path.fillOpacity }), ...(path.opacity !== undefined && { opacity: path.opacity }) }, index);
|
|
16
|
+
}) }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { InputTextProps } from './InputText.js';
|
|
2
|
+
export interface InputCurrencyProps extends Omit<InputTextProps, 'keyboard' | 'onChange' | 'onChangeText' | 'value' | 'defaultValue'> {
|
|
3
|
+
readonly showCurrencySymbol?: boolean;
|
|
4
|
+
readonly decimalPlaces?: number;
|
|
5
|
+
readonly maxDecimalPlaces?: number;
|
|
6
|
+
readonly maxLength?: number;
|
|
7
|
+
readonly onChange?: (value?: number | string) => void;
|
|
8
|
+
readonly value?: number;
|
|
9
|
+
readonly defaultValue?: number;
|
|
10
|
+
readonly keyboard?: 'decimal-pad' | 'numbers-and-punctuation';
|
|
11
|
+
}
|
|
12
|
+
export declare function InputCurrency({ showCurrencySymbol, decimalPlaces, maxDecimalPlaces, maxLength, value, defaultValue, onChange, keyboard, validations, prefix, transform, ...props }: InputCurrencyProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
import { InputText } from './InputText.js';
|
|
5
|
+
import { useComponentSettings } from './foundationText/ComponentSettingsContext/index.js';
|
|
6
|
+
import { useComponentMessages } from './foundationText/foundationMessages.js';
|
|
7
|
+
const numberPattern = /^[-+]?(?:[0-9]*\.[0-9]+|[0-9]+)$/;
|
|
8
|
+
export function InputCurrency({ showCurrencySymbol = true, decimalPlaces = 2, maxDecimalPlaces = 5, maxLength = 10, value, defaultValue, onChange, keyboard, validations, prefix, transform, ...props }) {
|
|
9
|
+
const { locale, floatSeparators: { decimal, group }, currencySymbol } = useComponentSettings();
|
|
10
|
+
const { t } = useComponentMessages();
|
|
11
|
+
const maximum = Math.max(0, Math.min(20, Math.trunc(maxDecimalPlaces)));
|
|
12
|
+
const minimum = Math.max(0, Math.min(maximum, Math.trunc(decimalPlaces)));
|
|
13
|
+
const format = useMemo(() => new Intl.NumberFormat(locale, { maximumFractionDigits: maximum }), [locale, maximum]);
|
|
14
|
+
const [lastEdit, setLastEdit] = useState();
|
|
15
|
+
function show(input) {
|
|
16
|
+
if (input == null)
|
|
17
|
+
return '';
|
|
18
|
+
if (lastEdit && String(lastEdit.output) === String(input))
|
|
19
|
+
return lastEdit.display;
|
|
20
|
+
if (input === '')
|
|
21
|
+
return '';
|
|
22
|
+
const amount = Number(input);
|
|
23
|
+
return Number.isFinite(amount) ? format.format(amount) : String(input);
|
|
24
|
+
}
|
|
25
|
+
function parse(text) {
|
|
26
|
+
const typed = text ?? '';
|
|
27
|
+
const normalized = (group ? typed.split(group).join('') : typed).replace(decimal, '.');
|
|
28
|
+
const [integer, fraction] = normalized.split('.');
|
|
29
|
+
if (integer === undefined || !/^[+-]?\d*$/.test(integer) ||
|
|
30
|
+
(fraction !== undefined && !/^\d*$/.test(fraction)) || normalized.split('.').length > 2) {
|
|
31
|
+
return normalized;
|
|
32
|
+
}
|
|
33
|
+
const sign = integer.startsWith('-') || integer.startsWith('+') ? integer.charAt(0) : '';
|
|
34
|
+
const digits = integer.slice(sign.length).slice(0, Math.max(1, maxLength));
|
|
35
|
+
const limited = sign + digits + (fraction === undefined ? '' : '.' + fraction.slice(0, maximum));
|
|
36
|
+
if (!numberPattern.test(limited) || limited.endsWith('.') || (fraction !== undefined && limited.endsWith('0'))) {
|
|
37
|
+
setLastEdit({ output: limited, display: limited.replace('.', decimal) });
|
|
38
|
+
return limited;
|
|
39
|
+
}
|
|
40
|
+
const places = Math.max(minimum, fraction?.length ?? 0);
|
|
41
|
+
const precision = 10 ** Math.min(places, maximum);
|
|
42
|
+
const result = Math.round(Number(limited) * precision) / precision;
|
|
43
|
+
setLastEdit({ output: result, display: format.format(result) });
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
const affix = showCurrencySymbol ? { label: currencySymbol } : prefix;
|
|
47
|
+
return _jsx(InputText, { ...props, ...(affix !== undefined && { prefix: affix }), keyboard: Platform.OS === 'ios' ? keyboard ?? 'numbers-and-punctuation' : 'numeric', ...(value !== undefined && { value: String(value) }), ...(defaultValue !== undefined && { defaultValue: String(defaultValue) }), ...(onChange !== undefined && { onChangeText: onChange }), validations: Object.assign({ pattern: { value: numberPattern, message: t('errors.notANumber') } }, validations), transform: {
|
|
48
|
+
input: raw => {
|
|
49
|
+
const display = show(raw);
|
|
50
|
+
return transform?.input ? transform.input(display) : display;
|
|
51
|
+
},
|
|
52
|
+
output: raw => {
|
|
53
|
+
const amount = parse(raw);
|
|
54
|
+
return transform?.output ? transform.output(amount) : amount;
|
|
55
|
+
},
|
|
56
|
+
} });
|
|
57
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TextInput } from 'react-native';
|
|
2
|
+
import type { StyleProp, TextInputProps, TextStyle } from 'react-native';
|
|
3
|
+
import type { RegisterOptions } from 'react-hook-form';
|
|
4
|
+
import type { Clearable } from '@zj-dynamics/hooks/useShowClear';
|
|
5
|
+
import type { InputFieldStyleOverride } from './foundationText/InputFieldWrapper/InputFieldWrapper.js';
|
|
6
|
+
import type { InputFieldWrapperProps } from './foundationText/InputFieldWrapper/index.js';
|
|
7
|
+
export type InputTextRef = Pick<TextInput, 'clear' | 'focus' | 'blur'>;
|
|
8
|
+
interface InputTextStyleOverride extends InputFieldStyleOverride {
|
|
9
|
+
inputText?: StyleProp<TextStyle>;
|
|
10
|
+
}
|
|
11
|
+
export interface InputTextProps extends Omit<TextInputProps, 'readOnly'>, Pick<InputFieldWrapperProps, 'toolbar' | 'toolbarVisibility' | 'loading' | 'loadingType' | 'prefix' | 'suffix'> {
|
|
12
|
+
readonly ref?: React.Ref<InputTextRef>;
|
|
13
|
+
readonly label?: string;
|
|
14
|
+
readonly description?: string;
|
|
15
|
+
readonly error?: string;
|
|
16
|
+
readonly invalid?: boolean | string;
|
|
17
|
+
readonly disabled?: boolean;
|
|
18
|
+
readonly readonly?: boolean;
|
|
19
|
+
readonly name?: string;
|
|
20
|
+
readonly assistiveText?: string;
|
|
21
|
+
readonly showMiniLabel?: boolean;
|
|
22
|
+
readonly keyboard?: TextInputProps['keyboardType'];
|
|
23
|
+
readonly validations?: RegisterOptions;
|
|
24
|
+
readonly clearable?: Clearable;
|
|
25
|
+
readonly styleOverride?: InputTextStyleOverride;
|
|
26
|
+
readonly transform?: {
|
|
27
|
+
input?: (value: any) => string | undefined;
|
|
28
|
+
output?: (value: string | undefined) => any;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export declare function InputText({ ref, label, description, error, invalid, disabled, readonly, editable, accessibilityLabel, accessibilityHint, accessibilityState, style, name, placeholder, assistiveText, showMiniLabel, keyboard, keyboardType, validations, clearable, styleOverride, transform, value, defaultValue, onChangeText, onFocus, onBlur, onSubmitEditing, multiline, prefix, suffix, toolbar, toolbarVisibility, loading, loadingType, ...props }: InputTextProps): import("react").JSX.Element;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BottomSheetTextInput } from '@gorhom/bottom-sheet';
|
|
3
|
+
import { useCallback, useContext, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
4
|
+
import { Platform, Text, TextInput } from 'react-native';
|
|
5
|
+
import { useShowClear } from '@zj-dynamics/hooks/useShowClear';
|
|
6
|
+
import { InputFieldWrapper } from './foundationText/InputFieldWrapper/index.js';
|
|
7
|
+
import { useCommonInputStyles } from './foundationText/InputFieldWrapper/CommonInputStyles.style.js';
|
|
8
|
+
import { SheetInputContext } from './sheetContext.js';
|
|
9
|
+
import { useTheme } from './theme.js';
|
|
10
|
+
import { useFormController } from './useFormController.js';
|
|
11
|
+
import { useInputAccessoriesContext } from './foundationText/InputText/context/index.js';
|
|
12
|
+
function asText(value) {
|
|
13
|
+
return value == null ? '' : String(value);
|
|
14
|
+
}
|
|
15
|
+
export function InputText({ ref, label, description, error, invalid, disabled = false, readonly = false, editable = true, accessibilityLabel, accessibilityHint, accessibilityState, style, name, placeholder, assistiveText, showMiniLabel = true, keyboard, keyboardType, validations, clearable, styleOverride, transform, value, defaultValue, onChangeText, onFocus, onBlur, onSubmitEditing, multiline = false, prefix, suffix, toolbar, toolbarVisibility, loading, loadingType, ...props }) {
|
|
16
|
+
const insideSheet = useContext(SheetInputContext);
|
|
17
|
+
const { colors } = useTheme();
|
|
18
|
+
const styles = useCommonInputStyles();
|
|
19
|
+
const hostRef = useRef(null);
|
|
20
|
+
const [focused, setFocused] = useState(false);
|
|
21
|
+
const { field, error: validationError } = useFormController({ name, value: value ?? defaultValue ?? '', validations });
|
|
22
|
+
const { inputAccessoryID, register, unregister, setFocusedInput, canFocusNext, onFocusNext } = useInputAccessoriesContext();
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!editable || disabled || readonly)
|
|
25
|
+
return;
|
|
26
|
+
register(field.name, () => hostRef.current?.focus());
|
|
27
|
+
return () => unregister(field.name);
|
|
28
|
+
}, [disabled, editable, field.name, readonly, register, unregister]);
|
|
29
|
+
const fieldValue = value ?? field.value;
|
|
30
|
+
const display = (transform?.input ? transform.input(fieldValue) : asText(fieldValue)) ?? '';
|
|
31
|
+
const hasValue = display.length > 0;
|
|
32
|
+
const floatLabel = hasValue && showMiniLabel;
|
|
33
|
+
const showClear = useShowClear({
|
|
34
|
+
clearable: clearable ?? (multiline ? 'never' : 'while-editing'),
|
|
35
|
+
multiline, focused, hasValue, readonly, disabled: disabled || !editable,
|
|
36
|
+
});
|
|
37
|
+
const update = (next) => {
|
|
38
|
+
const changes = transform?.output ? transform.output(next) : next;
|
|
39
|
+
field.onChange(changes);
|
|
40
|
+
// The frozen InputText contract kept a string callback even when specialist wrappers supplied a transform.
|
|
41
|
+
onChangeText?.(changes);
|
|
42
|
+
};
|
|
43
|
+
useImperativeHandle(ref, () => ({
|
|
44
|
+
clear: () => update(''),
|
|
45
|
+
focus: () => hostRef.current?.focus(),
|
|
46
|
+
blur: () => hostRef.current?.blur(),
|
|
47
|
+
}));
|
|
48
|
+
const help = assistiveText ?? description;
|
|
49
|
+
const hint = [accessibilityHint, help, error].filter(Boolean).join(' ');
|
|
50
|
+
const hostProps = {
|
|
51
|
+
...props,
|
|
52
|
+
editable: editable && !disabled && !readonly,
|
|
53
|
+
accessibilityLabel: accessibilityLabel ?? label ?? placeholder,
|
|
54
|
+
accessibilityHint: hint || undefined,
|
|
55
|
+
accessibilityState: { ...accessibilityState, disabled, ...(loading !== undefined && { busy: loading }) },
|
|
56
|
+
placeholder: Platform.OS === 'android' ? accessibilityLabel ?? label ?? placeholder : undefined,
|
|
57
|
+
placeholderTextColor: 'transparent',
|
|
58
|
+
keyboardType: keyboard ?? keyboardType,
|
|
59
|
+
multiline,
|
|
60
|
+
...(inputAccessoryID !== undefined && { inputAccessoryViewID: inputAccessoryID }),
|
|
61
|
+
...(Platform.OS === 'android' && !multiline && inputAccessoryID !== undefined && canFocusNext && {
|
|
62
|
+
returnKeyType: 'next', submitBehavior: 'submit',
|
|
63
|
+
}),
|
|
64
|
+
value: display,
|
|
65
|
+
onSubmitEditing(event) {
|
|
66
|
+
onSubmitEditing?.(event);
|
|
67
|
+
if (Platform.OS === 'android' && !multiline)
|
|
68
|
+
onFocusNext();
|
|
69
|
+
},
|
|
70
|
+
onChangeText(next) {
|
|
71
|
+
update(Platform.OS === 'ios' ? next.replace(/\uFFFC/g, '') : next);
|
|
72
|
+
},
|
|
73
|
+
onFocus(event) {
|
|
74
|
+
setFocusedInput(field.name);
|
|
75
|
+
setFocused(true);
|
|
76
|
+
onFocus?.(event);
|
|
77
|
+
},
|
|
78
|
+
onBlur(event) {
|
|
79
|
+
const trimmed = display.trim();
|
|
80
|
+
if (trimmed !== display && !readonly && editable && !disabled)
|
|
81
|
+
update(trimmed);
|
|
82
|
+
field.onBlur();
|
|
83
|
+
setFocusedInput('');
|
|
84
|
+
setFocused(false);
|
|
85
|
+
onBlur?.(event);
|
|
86
|
+
},
|
|
87
|
+
style: [
|
|
88
|
+
styles.input,
|
|
89
|
+
floatLabel && { paddingTop: 12 },
|
|
90
|
+
disabled && styles.inputDisabled,
|
|
91
|
+
multiline && { textAlignVertical: 'top' },
|
|
92
|
+
loading && loadingType === 'glimmer' && { color: 'transparent' },
|
|
93
|
+
styleOverride?.inputText,
|
|
94
|
+
style,
|
|
95
|
+
],
|
|
96
|
+
};
|
|
97
|
+
const registerRef = field.ref;
|
|
98
|
+
const attach = useCallback((instance) => {
|
|
99
|
+
hostRef.current = instance ?? null;
|
|
100
|
+
registerRef(hostRef.current);
|
|
101
|
+
}, [registerRef]);
|
|
102
|
+
return _jsxs(_Fragment, { children: [label && _jsx(Text, { style: { color: colors.text, fontWeight: '600' }, children: label }), _jsx(InputFieldWrapper, { invalid: error || invalid, error: validationError, disabled: disabled, focused: focused, multiline: multiline, hasValue: hasValue, onClear: () => update(''), showClearAction: Boolean(showClear), placeholderMode: hasValue ? floatLabel ? 'mini' : 'hidden' : 'normal', ...(placeholder !== undefined && { placeholder }), ...(help !== undefined && { assistiveText: help }), ...(prefix !== undefined && { prefix }), ...(suffix !== undefined && { suffix }), ...(toolbar !== undefined && { toolbar }), ...(toolbarVisibility !== undefined && { toolbarVisibility }), ...(loading !== undefined && { loading }), ...(loadingType !== undefined && { loadingType }), ...(styleOverride !== undefined && { styleOverride }), children: insideSheet ? _jsx(BottomSheetTextInput, { ...hostProps, ref: attach }) : _jsx(TextInput, { ...hostProps, ref: attach }) })] });
|
|
103
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { InputTextProps, InputTextRef } from './InputText.js';
|
|
2
|
+
export type InputEmailProps = Omit<InputTextProps, 'keyboard'>;
|
|
3
|
+
export declare function InputEmail({ validations, ...props }: InputEmailProps): import("react").JSX.Element;
|
|
4
|
+
export interface InputNumberProps extends Omit<InputTextProps, 'keyboard' | 'onChange' | 'onChangeText' | 'value' | 'defaultValue'> {
|
|
5
|
+
readonly value?: number;
|
|
6
|
+
readonly defaultValue?: number;
|
|
7
|
+
readonly onChange?: (newValue?: number | string) => void;
|
|
8
|
+
readonly keyboard?: 'decimal-pad' | 'numbers-and-punctuation';
|
|
9
|
+
}
|
|
10
|
+
export declare function InputNumber({ value, defaultValue, onChange, validations, keyboard, transform, ...props }: InputNumberProps): import("react").JSX.Element;
|
|
11
|
+
export interface InputPasswordProps extends Omit<InputTextProps, 'keyboard' | 'secureTextEntry' | 'textContentType' | 'clearable'> {
|
|
12
|
+
readonly usePrivacyEye?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function InputPassword({ usePrivacyEye, suffix, validations, ...props }: InputPasswordProps): import("react").JSX.Element;
|
|
15
|
+
export interface InputSearchProps extends Pick<InputTextProps, 'accessibilityHint' | 'accessibilityLabel' | 'autoFocus' | 'placeholder' | 'prefix' | 'showMiniLabel'> {
|
|
16
|
+
readonly ref?: React.Ref<InputTextRef>;
|
|
17
|
+
readonly onChange: (value: string) => void;
|
|
18
|
+
readonly onDebouncedChange: (value: string) => void;
|
|
19
|
+
readonly value: string;
|
|
20
|
+
readonly wait?: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function InputSearch({ value, onChange, onDebouncedChange, wait, ...props }: InputSearchProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
import { useDebounce } from '@zj-dynamics/hooks/useDebounce';
|
|
5
|
+
import { InputText } from './InputText.js';
|
|
6
|
+
import { useComponentMessages } from './foundationText/foundationMessages.js';
|
|
7
|
+
export function InputEmail({ validations, ...props }) {
|
|
8
|
+
const { t } = useComponentMessages();
|
|
9
|
+
return _jsx(InputText, { ...props, keyboard: "email-address", autoCapitalize: "none", autoCorrect: false, validations: Object.assign({ pattern: {
|
|
10
|
+
value: /^[^\s@]+@[^\s@]+$/,
|
|
11
|
+
message: t('InputEmail.enterEmail'),
|
|
12
|
+
} }, validations) });
|
|
13
|
+
}
|
|
14
|
+
const completeNumber = /^[-+]?(?:[0-9]*\.[0-9]+|[0-9]+|[0-9]+(?:\.?[0-9]+)?e[-+]?[0-9]+)$/;
|
|
15
|
+
function shouldShowUserValue(value) {
|
|
16
|
+
return /^[-+]?[0-9]*\.$/.test(value) ||
|
|
17
|
+
/^[-+]?[0-9]+(?:\.?[0-9]+)?e$/.test(value) ||
|
|
18
|
+
/^[-+]+$/.test(value) || /^[-+]?[0-9]*\.[0-9]*0+$/.test(value);
|
|
19
|
+
}
|
|
20
|
+
function useNumberTransform(controlledValue) {
|
|
21
|
+
const [typed, setTyped] = useState(controlledValue?.toString() ?? '');
|
|
22
|
+
return {
|
|
23
|
+
inputTransform(internalValue) {
|
|
24
|
+
return shouldShowUserValue(typed) ? typed : internalValue?.toString();
|
|
25
|
+
},
|
|
26
|
+
outputTransform(value) {
|
|
27
|
+
setTyped(value);
|
|
28
|
+
return completeNumber.test(value) ? Number.parseFloat(value) : value;
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export function InputNumber({ value, defaultValue, onChange, validations, keyboard, transform, ...props }) {
|
|
33
|
+
const { t } = useComponentMessages();
|
|
34
|
+
const converters = useNumberTransform(value);
|
|
35
|
+
return _jsx(InputText, { ...props, keyboard: Platform.OS === 'ios' ? keyboard ?? 'numbers-and-punctuation' : 'numeric', ...(value !== undefined && { value: String(value) }), ...(defaultValue !== undefined && { defaultValue: String(defaultValue) }), validations: Object.assign({ pattern: { value: completeNumber, message: t('errors.notANumber') } }, validations), ...(onChange !== undefined && { onChangeText: onChange }), transform: {
|
|
36
|
+
input: input => {
|
|
37
|
+
const display = converters.inputTransform(input);
|
|
38
|
+
return transform?.input ? transform.input(display) : display;
|
|
39
|
+
},
|
|
40
|
+
output: raw => {
|
|
41
|
+
const result = converters.outputTransform(raw ?? '');
|
|
42
|
+
return transform?.output ? transform.output(result) : result;
|
|
43
|
+
},
|
|
44
|
+
} });
|
|
45
|
+
}
|
|
46
|
+
export function InputPassword({ usePrivacyEye = true, suffix, validations, ...props }) {
|
|
47
|
+
const { t } = useComponentMessages();
|
|
48
|
+
const [hidden, setHidden] = useState(true);
|
|
49
|
+
return _jsx(InputText, { ...props, keyboard: "default", secureTextEntry: hidden, textContentType: "password", clearable: "never", validations: { required: { value: true, message: t('InputPassword.enterPassword') }, ...validations }, ...(usePrivacyEye ? { suffix: {
|
|
50
|
+
icon: hidden ? 'eye' : 'eyeCrossed',
|
|
51
|
+
onPress: () => setHidden(current => !current),
|
|
52
|
+
accessibilityLabel: t(hidden ? 'InputPassword.show' : 'InputPassword.hide'),
|
|
53
|
+
} } : suffix !== undefined && { suffix }) });
|
|
54
|
+
}
|
|
55
|
+
export function InputSearch({ value, onChange, onDebouncedChange, wait = 300, ...props }) {
|
|
56
|
+
const search = useDebounce(onDebouncedChange, wait);
|
|
57
|
+
useEffect(() => { search(value); }, [search, value]);
|
|
58
|
+
return _jsx(InputText, { ...props, value: value, onChangeText: onChange, autoCorrect: false });
|
|
59
|
+
}
|
package/dist/Switch.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface SwitchOptions {
|
|
2
|
+
readonly value?: boolean;
|
|
3
|
+
readonly defaultValue?: boolean;
|
|
4
|
+
readonly disabled?: boolean;
|
|
5
|
+
readonly accessibilityLabel?: string;
|
|
6
|
+
readonly name?: string;
|
|
7
|
+
onValueChange?(value: boolean): void;
|
|
8
|
+
}
|
|
9
|
+
export type SwitchProps = SwitchOptions & ({
|
|
10
|
+
readonly label?: never;
|
|
11
|
+
readonly description?: never;
|
|
12
|
+
} | {
|
|
13
|
+
readonly label: string;
|
|
14
|
+
readonly description?: string;
|
|
15
|
+
});
|
|
16
|
+
export declare function Switch({ value, defaultValue, disabled, accessibilityLabel, name, onValueChange, label, description }: SwitchProps): import("react").JSX.Element;
|
|
17
|
+
export {};
|
package/dist/Switch.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Platform, View } from 'react-native';
|
|
4
|
+
import { Switch as NativeSwitch } from 'react-native-gesture-handler';
|
|
5
|
+
import { Text } from './foundationText/Text/index.js';
|
|
6
|
+
import { useFoundationTokens } from './foundationTokens.js';
|
|
7
|
+
import { useControlledField } from './controlledField.js';
|
|
8
|
+
export function Switch({ value, defaultValue, disabled = false, accessibilityLabel, name, onValueChange, label, description }) {
|
|
9
|
+
const field = useControlledField(name, value ?? defaultValue ?? false);
|
|
10
|
+
const checked = value ?? field.value;
|
|
11
|
+
const tokens = useFoundationTokens();
|
|
12
|
+
const android = Platform.OS === 'android';
|
|
13
|
+
const [labelWidth, setLabelWidth] = useState();
|
|
14
|
+
const trackColor = android ? {
|
|
15
|
+
true: disabled ? tokens['color-disabled--secondary'] : tokens['color-surface'],
|
|
16
|
+
false: disabled ? tokens['color-disabled--secondary'] : tokens['color-disabled'],
|
|
17
|
+
} : { true: tokens['color-interactive'], false: tokens['color-interactive--background'] };
|
|
18
|
+
const thumbColor = disabled ? tokens['color-disabled'] : checked
|
|
19
|
+
? tokens['color-interactive'] : tokens['color-interactive--background'];
|
|
20
|
+
return _jsxs(View, { style: { marginVertical: tokens['space-base'] }, children: [_jsxs(View, { style: { flexDirection: 'row', width: '100%' }, children: [label && _jsx(View, { testID: "switch-label-view", onLayout: event => setLabelWidth(event.nativeEvent.layout.width), style: { flex: 1, justifyContent: 'center', marginRight: tokens['space-small'] }, children: _jsx(Text, { variation: disabled ? 'disabled' : 'base', children: label }) }), _jsx(NativeSwitch, { value: checked, disabled: disabled, trackColor: trackColor, ...(android && { thumbColor }), ...(!android && Number(Platform.Version.toString().split('.')[0]) !== 26 &&
|
|
21
|
+
{ ios_backgroundColor: tokens['color-interactive--background'] }), accessibilityLabel: accessibilityLabel || label, accessibilityRole: "switch", accessibilityState: { disabled, checked }, onValueChange: next => {
|
|
22
|
+
if (disabled)
|
|
23
|
+
return;
|
|
24
|
+
onValueChange?.(next);
|
|
25
|
+
field.onChange(next);
|
|
26
|
+
} })] }), description && _jsx(View, { testID: "switch-description-view", style: { marginTop: tokens['space-smaller'], maxWidth: labelWidth }, children: _jsx(Text, { level: "textSupporting", variation: "subdued", children: description }) })] });
|
|
27
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useId } from 'react';
|
|
2
|
+
import { useController, useForm, useFormContext } from 'react-hook-form';
|
|
3
|
+
export function useControlledField(name, defaultValue) {
|
|
4
|
+
const generated = useId();
|
|
5
|
+
const localForm = useForm({ mode: 'onTouched' });
|
|
6
|
+
const parentForm = useFormContext();
|
|
7
|
+
const { field } = useController({ name: name || generated, control: (parentForm ?? localForm).control, defaultValue });
|
|
8
|
+
return { value: field.value, onChange: (value) => field.onChange(value) };
|
|
9
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import type { IconColorNames, IconNames } from "@zj-dynamics/design/native";
|
|
4
|
+
export interface ActionItemProps {
|
|
5
|
+
/**
|
|
6
|
+
* Title of the Action Item
|
|
7
|
+
*/
|
|
8
|
+
readonly title?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Name of the icon to display before content
|
|
11
|
+
*/
|
|
12
|
+
readonly icon?: IconNames;
|
|
13
|
+
/**
|
|
14
|
+
* Colour of the icon displayed before content
|
|
15
|
+
*/
|
|
16
|
+
readonly iconColor?: IconColorNames;
|
|
17
|
+
/**
|
|
18
|
+
* Content to display.
|
|
19
|
+
*/
|
|
20
|
+
readonly children?: ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* Action icon to display
|
|
23
|
+
*/
|
|
24
|
+
readonly actionIcon?: ActionIconNames;
|
|
25
|
+
/**
|
|
26
|
+
* Colour of the action icon
|
|
27
|
+
*/
|
|
28
|
+
readonly actionIconColour?: ActionIconColour;
|
|
29
|
+
/**
|
|
30
|
+
* Alignment of action icon
|
|
31
|
+
*/
|
|
32
|
+
readonly actionIconAlignment?: "flex-start" | "flex-end" | "center";
|
|
33
|
+
/**
|
|
34
|
+
* Press handler
|
|
35
|
+
*/
|
|
36
|
+
readonly onPress?: () => void;
|
|
37
|
+
readonly testID?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare function ActionItem({ title, icon, iconColor, children, actionIcon, actionIconColour, actionIconAlignment, onPress, testID, }: ActionItemProps): React.JSX.Element;
|
|
40
|
+
type ActionIconColour = "interactive" | "destructive" | "informative" | "subtle";
|
|
41
|
+
type ActionIconNames = IconNames | "editpencil";
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { 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 "./ActionItem.style.js";
|
|
5
|
+
import { ActionItemContainer } from "./components/ActionItemContainer.js";
|
|
6
|
+
import { Typography } from "../Typography/index.js";
|
|
7
|
+
import { Icon } from "../../Icon.js";
|
|
8
|
+
export function ActionItem({ title, icon, iconColor, children, actionIcon = "edit", actionIconColour = "interactive", actionIconAlignment = "center", onPress, testID = "actionItem", }) {
|
|
9
|
+
const actionIconStyle = {
|
|
10
|
+
justifyContent: actionIconAlignment,
|
|
11
|
+
};
|
|
12
|
+
const styles = useStyles();
|
|
13
|
+
const addIconOffset = icon || onPress ? styles.offsetForIcons : undefined;
|
|
14
|
+
const titlePadding = children ? styles.titlePadding : undefined;
|
|
15
|
+
return (_jsxs(ActionItemContainer, { testID: testID, ...(onPress && { onPress }), ...(title !== undefined && { title }), children: [icon && (_jsx(View, { style: styles.icon, children: _jsx(Icon, { name: icon, ...(iconColor !== undefined && { color: iconColor }) }) })), _jsxs(View, { style: [styles.content, addIconOffset], children: [title && (_jsx(View, { style: titlePadding, children: _jsx(Typography, { color: "heading", fontFamily: "base", fontWeight: "bold", size: "default", lineHeight: "base", accessibilityRole: "header", children: title }) })), children] }), onPress && (_jsx(View, { style: [actionIconStyle, styles.actionIcon], children: _jsx(Icon, { name: getActionIcon(actionIcon), color: getActionIconColour(actionIconColour) }) }))] }));
|
|
16
|
+
}
|
|
17
|
+
function getActionIconColour(actionIconColour) {
|
|
18
|
+
if (actionIconColour === "subtle") {
|
|
19
|
+
return "interactiveSubtle";
|
|
20
|
+
}
|
|
21
|
+
return actionIconColour;
|
|
22
|
+
}
|
|
23
|
+
function getActionIcon(icon) {
|
|
24
|
+
if (icon === "edit") {
|
|
25
|
+
return "longArrowRight";
|
|
26
|
+
}
|
|
27
|
+
else if (icon === "editpencil") {
|
|
28
|
+
return "edit";
|
|
29
|
+
}
|
|
30
|
+
return icon;
|
|
31
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const useStyles: () => {
|
|
2
|
+
actionItemHorizontalOffset: {
|
|
3
|
+
paddingHorizontal: number;
|
|
4
|
+
};
|
|
5
|
+
icon: {
|
|
6
|
+
justifyContent: "flex-start";
|
|
7
|
+
paddingRight: number;
|
|
8
|
+
};
|
|
9
|
+
titlePadding: {
|
|
10
|
+
paddingBottom: number;
|
|
11
|
+
};
|
|
12
|
+
content: {
|
|
13
|
+
flex: number;
|
|
14
|
+
};
|
|
15
|
+
offsetForIcons: {
|
|
16
|
+
paddingTop: number;
|
|
17
|
+
};
|
|
18
|
+
actionIcon: {
|
|
19
|
+
paddingLeft: number;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { buildThemedStyles } from "../compatTheme.js";
|
|
2
|
+
export const useStyles = buildThemedStyles(tokens => {
|
|
3
|
+
return {
|
|
4
|
+
actionItemHorizontalOffset: {
|
|
5
|
+
paddingHorizontal: tokens["space-base"],
|
|
6
|
+
},
|
|
7
|
+
icon: {
|
|
8
|
+
justifyContent: "flex-start",
|
|
9
|
+
paddingRight: tokens["space-small"],
|
|
10
|
+
},
|
|
11
|
+
titlePadding: {
|
|
12
|
+
paddingBottom: tokens["space-smaller"],
|
|
13
|
+
},
|
|
14
|
+
content: {
|
|
15
|
+
flex: 1,
|
|
16
|
+
},
|
|
17
|
+
offsetForIcons: {
|
|
18
|
+
paddingTop: tokens["space-smallest"],
|
|
19
|
+
},
|
|
20
|
+
actionIcon: {
|
|
21
|
+
paddingLeft: tokens["space-small"],
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import type { ActionItem, ActionItemProps } from "./ActionItem.js";
|
|
4
|
+
export type ActionItemElement = ReactElement<ActionItemProps, typeof ActionItem> | boolean | null | undefined;
|
|
5
|
+
interface ActionItemGroupProps {
|
|
6
|
+
/**
|
|
7
|
+
* Action Items
|
|
8
|
+
*/
|
|
9
|
+
readonly children: ActionItemElement | ActionItemElement[];
|
|
10
|
+
}
|
|
11
|
+
export declare function ActionItemGroup({ children }: ActionItemGroupProps): React.JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { 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 "./ActionItem.style.js";
|
|
5
|
+
import { Divider } from "../../Divider.js";
|
|
6
|
+
export function ActionItemGroup({ children }) {
|
|
7
|
+
const styles = useStyles();
|
|
8
|
+
return _jsx(View, { children: renderChildren(children, styles) });
|
|
9
|
+
}
|
|
10
|
+
function renderChildren(children, styles) {
|
|
11
|
+
const childArray = React.Children.toArray(children);
|
|
12
|
+
if (childArray.length === 1)
|
|
13
|
+
return children;
|
|
14
|
+
return childArray.map((child, index) => {
|
|
15
|
+
const isSubsequentChild = index !== 0;
|
|
16
|
+
return (_jsxs(View, { children: [isSubsequentChild && (_jsx(View, { style: styles.actionItemHorizontalOffset, children: _jsx(Divider, {}) })), child] }, index));
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
interface ActionItemContainerProps {
|
|
4
|
+
readonly children: ReactNode;
|
|
5
|
+
readonly title?: string;
|
|
6
|
+
readonly onPress?: () => void;
|
|
7
|
+
readonly testID?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function ActionItemContainer({ onPress, title, children, testID, }: ActionItemContainerProps): React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Pressable, View } from "react-native";
|
|
4
|
+
import { useStyles } from "./ActionItemContainer.style.js";
|
|
5
|
+
import { useStyles as useActionItemStyles } from "../ActionItem.style.js";
|
|
6
|
+
export function ActionItemContainer({ onPress, title, children, testID, }) {
|
|
7
|
+
const styles = useStyles();
|
|
8
|
+
const actionItemStyles = useActionItemStyles();
|
|
9
|
+
if (onPress) {
|
|
10
|
+
return (_jsx(Pressable, { onPress: onPress, style: ({ pressed }) => [
|
|
11
|
+
styles.container,
|
|
12
|
+
actionItemStyles.actionItemHorizontalOffset,
|
|
13
|
+
pressed && styles.pressed,
|
|
14
|
+
], accessibilityRole: "button", accessibilityLabel: title, testID: testID, children: children }));
|
|
15
|
+
}
|
|
16
|
+
return (_jsx(View, { style: [styles.container, actionItemStyles.actionItemHorizontalOffset], testID: testID, children: children }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { buildThemedStyles } from "../../compatTheme.js";
|
|
2
|
+
export const useStyles = buildThemedStyles(tokens => {
|
|
3
|
+
return {
|
|
4
|
+
container: {
|
|
5
|
+
width: "100%",
|
|
6
|
+
flexDirection: "row",
|
|
7
|
+
paddingVertical: tokens["space-base"],
|
|
8
|
+
},
|
|
9
|
+
pressed: {
|
|
10
|
+
opacity: tokens["opacity-pressed"],
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
});
|