@zj-dynamics/components-native 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/NOTICE.foundation +21 -0
- package/README.md +20 -2
- package/RulnarComponentsNative.podspec +16 -0
- package/dist/AutoLink.d.ts +9 -0
- package/dist/AutoLink.js +63 -0
- package/dist/BottomSheetKeyboardAwareScrollView.d.ts +12 -0
- package/dist/BottomSheetKeyboardAwareScrollView.js +19 -0
- package/dist/Button.d.ts +37 -0
- package/dist/Button.js +24 -0
- package/dist/Checkbox.d.ts +37 -0
- package/dist/Checkbox.js +73 -0
- package/dist/Content.d.ts +16 -0
- package/dist/Content.js +17 -0
- package/dist/ContentOverlay.d.ts +31 -0
- package/dist/ContentOverlay.js +151 -0
- package/dist/Divider.d.ts +6 -0
- package/dist/Divider.js +20 -0
- package/dist/Flex.d.ts +10 -0
- package/dist/Flex.js +19 -0
- package/dist/Icon.d.ts +11 -0
- package/dist/Icon.js +17 -0
- package/dist/InputCurrency.d.ts +12 -0
- package/dist/InputCurrency.js +57 -0
- package/dist/InputText.d.ts +32 -0
- package/dist/InputText.js +103 -0
- package/dist/NativeTextFields.d.ts +22 -0
- package/dist/NativeTextFields.js +59 -0
- package/dist/Switch.d.ts +17 -0
- package/dist/Switch.js +27 -0
- package/dist/controlledField.d.ts +4 -0
- package/dist/controlledField.js +9 -0
- package/dist/foundationText/ActionItem/ActionItem.d.ts +42 -0
- package/dist/foundationText/ActionItem/ActionItem.js +31 -0
- package/dist/foundationText/ActionItem/ActionItem.style.d.ts +21 -0
- package/dist/foundationText/ActionItem/ActionItem.style.js +24 -0
- package/dist/foundationText/ActionItem/ActionItemGroup.d.ts +12 -0
- package/dist/foundationText/ActionItem/ActionItemGroup.js +18 -0
- package/dist/foundationText/ActionItem/components/ActionItemContainer.d.ts +10 -0
- package/dist/foundationText/ActionItem/components/ActionItemContainer.js +17 -0
- package/dist/foundationText/ActionItem/components/ActionItemContainer.style.d.ts +10 -0
- package/dist/foundationText/ActionItem/components/ActionItemContainer.style.js +13 -0
- package/dist/foundationText/ActionItem/index.d.ts +4 -0
- package/dist/foundationText/ActionItem/index.js +3 -0
- package/dist/foundationText/ActionLabel/ActionLabel.d.ts +28 -0
- package/dist/foundationText/ActionLabel/ActionLabel.js +22 -0
- package/dist/foundationText/ActionLabel/index.d.ts +2 -0
- package/dist/foundationText/ActionLabel/index.js +1 -0
- package/dist/foundationText/ActivityIndicator/ActivityIndicator.d.ts +46 -0
- package/dist/foundationText/ActivityIndicator/ActivityIndicator.js +191 -0
- package/dist/foundationText/ActivityIndicator/index.d.ts +2 -0
- package/dist/foundationText/ActivityIndicator/index.js +1 -0
- package/dist/foundationText/Banner/Banner.d.ts +3 -0
- package/dist/foundationText/Banner/Banner.js +64 -0
- package/dist/foundationText/Banner/Banner.style.d.ts +56 -0
- package/dist/foundationText/Banner/Banner.style.js +59 -0
- package/dist/foundationText/Banner/components/BannerIcon/BannerIcon.d.ts +8 -0
- package/dist/foundationText/Banner/components/BannerIcon/BannerIcon.js +9 -0
- package/dist/foundationText/Banner/components/BannerIcon/BannerIcon.style.d.ts +18 -0
- package/dist/foundationText/Banner/components/BannerIcon/BannerIcon.style.js +21 -0
- package/dist/foundationText/Banner/index.d.ts +2 -0
- package/dist/foundationText/Banner/index.js +1 -0
- package/dist/foundationText/Banner/types.d.ts +63 -0
- package/dist/foundationText/Banner/types.js +1 -0
- package/dist/foundationText/BottomSheet/BottomSheet.d.ts +32 -0
- package/dist/foundationText/BottomSheet/BottomSheet.js +75 -0
- package/dist/foundationText/BottomSheet/BottomSheet.style.d.ts +26 -0
- package/dist/foundationText/BottomSheet/BottomSheet.style.js +30 -0
- package/dist/foundationText/BottomSheet/components/BottomSheetOption/BottomSheetOption.d.ts +13 -0
- package/dist/foundationText/BottomSheet/components/BottomSheetOption/BottomSheetOption.js +16 -0
- package/dist/foundationText/BottomSheet/components/BottomSheetOption/BottomSheetOption.styles.d.ts +16 -0
- package/dist/foundationText/BottomSheet/components/BottomSheetOption/BottomSheetOption.styles.js +19 -0
- package/dist/foundationText/BottomSheet/components/BottomSheetOption/index.d.ts +2 -0
- package/dist/foundationText/BottomSheet/components/BottomSheetOption/index.js +1 -0
- package/dist/foundationText/BottomSheet/hooks/useBottomSheetBackHandler.d.ts +8 -0
- package/dist/foundationText/BottomSheet/hooks/useBottomSheetBackHandler.js +25 -0
- package/dist/foundationText/BottomSheet/index.d.ts +4 -0
- package/dist/foundationText/BottomSheet/index.js +2 -0
- package/dist/foundationText/ButtonGroup/ButtonGroup.d.ts +30 -0
- package/dist/foundationText/ButtonGroup/ButtonGroup.js +25 -0
- package/dist/foundationText/ButtonGroup/ButtonGroup.style.d.ts +16 -0
- package/dist/foundationText/ButtonGroup/ButtonGroup.style.js +19 -0
- package/dist/foundationText/ButtonGroup/ButtonGroupAction.d.ts +47 -0
- package/dist/foundationText/ButtonGroup/ButtonGroupAction.js +11 -0
- package/dist/foundationText/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.d.ts +14 -0
- package/dist/foundationText/ButtonGroup/components/SecondaryActionSheet/SecondaryActionSheet.js +15 -0
- package/dist/foundationText/ButtonGroup/components/SecondaryActionSheet/index.d.ts +1 -0
- package/dist/foundationText/ButtonGroup/components/SecondaryActionSheet/index.js +1 -0
- package/dist/foundationText/ButtonGroup/index.d.ts +3 -0
- package/dist/foundationText/ButtonGroup/index.js +2 -0
- package/dist/foundationText/ButtonGroup/types.d.ts +7 -0
- package/dist/foundationText/ButtonGroup/types.js +1 -0
- package/dist/foundationText/ButtonGroup/utils.d.ts +19 -0
- package/dist/foundationText/ButtonGroup/utils.js +41 -0
- package/dist/foundationText/Card/Card.d.ts +41 -0
- package/dist/foundationText/Card/Card.js +26 -0
- package/dist/foundationText/Card/Card.style.d.ts +56 -0
- package/dist/foundationText/Card/Card.style.js +38 -0
- package/dist/foundationText/Card/components/InternalCardHeader.d.ts +10 -0
- package/dist/foundationText/Card/components/InternalCardHeader.js +16 -0
- package/dist/foundationText/Card/components/InternalCardHeader.style.d.ts +14 -0
- package/dist/foundationText/Card/components/InternalCardHeader.style.js +17 -0
- package/dist/foundationText/Card/components/index.d.ts +1 -0
- package/dist/foundationText/Card/components/index.js +1 -0
- package/dist/foundationText/Card/index.d.ts +2 -0
- package/dist/foundationText/Card/index.js +1 -0
- package/dist/foundationText/Chip/Chip.d.ts +45 -0
- package/dist/foundationText/Chip/Chip.js +88 -0
- package/dist/foundationText/Chip/Chip.style.d.ts +27 -0
- package/dist/foundationText/Chip/Chip.style.js +31 -0
- package/dist/foundationText/Chip/index.d.ts +2 -0
- package/dist/foundationText/Chip/index.js +1 -0
- package/dist/foundationText/ComponentSettingsContext/ComponentSettingsContext.d.ts +57 -0
- package/dist/foundationText/ComponentSettingsContext/ComponentSettingsContext.js +26 -0
- package/dist/foundationText/ComponentSettingsContext/index.d.ts +1 -0
- package/dist/foundationText/ComponentSettingsContext/index.js +1 -0
- package/dist/foundationText/Disclosure/Disclosure.d.ts +35 -0
- package/dist/foundationText/Disclosure/Disclosure.js +51 -0
- package/dist/foundationText/Disclosure/Disclosure.style.d.ts +19 -0
- package/dist/foundationText/Disclosure/Disclosure.style.js +22 -0
- package/dist/foundationText/Disclosure/constants.d.ts +1 -0
- package/dist/foundationText/Disclosure/constants.js +1 -0
- package/dist/foundationText/Disclosure/index.d.ts +1 -0
- package/dist/foundationText/Disclosure/index.js +1 -0
- package/dist/foundationText/EmptyState/EmptyState.d.ts +35 -0
- package/dist/foundationText/EmptyState/EmptyState.js +18 -0
- package/dist/foundationText/EmptyState/EmptyState.style.d.ts +6 -0
- package/dist/foundationText/EmptyState/EmptyState.style.js +9 -0
- package/dist/foundationText/EmptyState/index.d.ts +2 -0
- package/dist/foundationText/EmptyState/index.js +1 -0
- package/dist/foundationText/ErrorMessageWrapper/ErrorMessageWrapper.d.ts +22 -0
- package/dist/foundationText/ErrorMessageWrapper/ErrorMessageWrapper.js +35 -0
- package/dist/foundationText/ErrorMessageWrapper/ErrorMessageWrapper.style.d.ts +29 -0
- package/dist/foundationText/ErrorMessageWrapper/ErrorMessageWrapper.style.js +32 -0
- package/dist/foundationText/ErrorMessageWrapper/context/ErrorMessageContext.d.ts +3 -0
- package/dist/foundationText/ErrorMessageWrapper/context/ErrorMessageContext.js +11 -0
- package/dist/foundationText/ErrorMessageWrapper/context/ErrorMessageProvider.d.ts +7 -0
- package/dist/foundationText/ErrorMessageWrapper/context/ErrorMessageProvider.js +38 -0
- package/dist/foundationText/ErrorMessageWrapper/context/index.d.ts +2 -0
- package/dist/foundationText/ErrorMessageWrapper/context/index.js +2 -0
- package/dist/foundationText/ErrorMessageWrapper/context/types.d.ts +62 -0
- package/dist/foundationText/ErrorMessageWrapper/context/types.js +1 -0
- package/dist/foundationText/ErrorMessageWrapper/index.d.ts +2 -0
- package/dist/foundationText/ErrorMessageWrapper/index.js +2 -0
- package/dist/foundationText/Form/Form.d.ts +4 -0
- package/dist/foundationText/Form/Form.js +142 -0
- package/dist/foundationText/Form/Form.style.d.ts +31 -0
- package/dist/foundationText/Form/Form.style.js +34 -0
- package/dist/foundationText/Form/components/FormActionBar/FormActionBar.d.ts +13 -0
- package/dist/foundationText/Form/components/FormActionBar/FormActionBar.js +21 -0
- package/dist/foundationText/Form/components/FormActionBar/FormActionBar.style.d.ts +15 -0
- package/dist/foundationText/Form/components/FormActionBar/FormActionBar.style.js +11 -0
- package/dist/foundationText/Form/components/FormActionBar/index.d.ts +2 -0
- package/dist/foundationText/Form/components/FormActionBar/index.js +1 -0
- package/dist/foundationText/Form/components/FormBody/FormBody.d.ts +10 -0
- package/dist/foundationText/Form/components/FormBody/FormBody.js +18 -0
- package/dist/foundationText/Form/components/FormBody/FormBody.style.d.ts +24 -0
- package/dist/foundationText/Form/components/FormBody/FormBody.style.js +27 -0
- package/dist/foundationText/Form/components/FormBody/index.d.ts +1 -0
- package/dist/foundationText/Form/components/FormBody/index.js +1 -0
- package/dist/foundationText/Form/components/FormCache/FormCache.d.ts +10 -0
- package/dist/foundationText/Form/components/FormCache/FormCache.js +28 -0
- package/dist/foundationText/Form/components/FormErrorBanner/FormErrorBanner.d.ts +3 -0
- package/dist/foundationText/Form/components/FormErrorBanner/FormErrorBanner.js +14 -0
- package/dist/foundationText/Form/components/FormErrorBanner/index.d.ts +1 -0
- package/dist/foundationText/Form/components/FormErrorBanner/index.js +1 -0
- package/dist/foundationText/Form/components/FormMask/FormMask.d.ts +2 -0
- package/dist/foundationText/Form/components/FormMask/FormMask.js +9 -0
- package/dist/foundationText/Form/components/FormMask/FormMask.style.d.ts +13 -0
- package/dist/foundationText/Form/components/FormMask/FormMask.style.js +16 -0
- package/dist/foundationText/Form/components/FormMask/index.d.ts +1 -0
- package/dist/foundationText/Form/components/FormMask/index.js +1 -0
- package/dist/foundationText/Form/components/FormMessage/FormMessage.d.ts +19 -0
- package/dist/foundationText/Form/components/FormMessage/FormMessage.js +49 -0
- package/dist/foundationText/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.d.ts +8 -0
- package/dist/foundationText/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.js +27 -0
- package/dist/foundationText/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.style.d.ts +20 -0
- package/dist/foundationText/Form/components/FormMessage/components/InternalFormMessage/InternalFormMessage.style.js +18 -0
- package/dist/foundationText/Form/components/FormMessage/components/InternalFormMessage/index.d.ts +1 -0
- package/dist/foundationText/Form/components/FormMessage/components/InternalFormMessage/index.js +1 -0
- package/dist/foundationText/Form/components/FormMessage/index.d.ts +1 -0
- package/dist/foundationText/Form/components/FormMessage/index.js +1 -0
- package/dist/foundationText/Form/components/FormMessageBanner/FormMessageBanner.d.ts +7 -0
- package/dist/foundationText/Form/components/FormMessageBanner/FormMessageBanner.js +16 -0
- package/dist/foundationText/Form/components/FormMessageBanner/index.d.ts +1 -0
- package/dist/foundationText/Form/components/FormMessageBanner/index.js +1 -0
- package/dist/foundationText/Form/components/FormSaveButton/FormSaveButton.d.ts +3 -0
- package/dist/foundationText/Form/components/FormSaveButton/FormSaveButton.js +55 -0
- package/dist/foundationText/Form/components/FormSaveButton/index.d.ts +1 -0
- package/dist/foundationText/Form/components/FormSaveButton/index.js +1 -0
- package/dist/foundationText/Form/components/IOSKeyboardAwareScrollViewSpacer/IOSKeyboardAwareScrollViewSpacer.d.ts +6 -0
- package/dist/foundationText/Form/components/IOSKeyboardAwareScrollViewSpacer/IOSKeyboardAwareScrollViewSpacer.js +13 -0
- package/dist/foundationText/Form/constants.d.ts +2 -0
- package/dist/foundationText/Form/constants.js +2 -0
- package/dist/foundationText/Form/context/FormContext.d.ts +11 -0
- package/dist/foundationText/Form/context/FormContext.js +16 -0
- package/dist/foundationText/Form/context/index.d.ts +2 -0
- package/dist/foundationText/Form/context/index.js +1 -0
- package/dist/foundationText/Form/context/types.d.ts +26 -0
- package/dist/foundationText/Form/context/types.js +1 -0
- package/dist/foundationText/Form/hooks/useFormViewRefs.d.ts +10 -0
- package/dist/foundationText/Form/hooks/useFormViewRefs.js +13 -0
- package/dist/foundationText/Form/hooks/useInternalForm.d.ts +19 -0
- package/dist/foundationText/Form/hooks/useInternalForm.js +43 -0
- package/dist/foundationText/Form/hooks/useOfflineHandler.d.ts +1 -0
- package/dist/foundationText/Form/hooks/useOfflineHandler.js +23 -0
- package/dist/foundationText/Form/hooks/useSaveButtonPosition.d.ts +12 -0
- package/dist/foundationText/Form/hooks/useSaveButtonPosition.js +25 -0
- package/dist/foundationText/Form/hooks/useScreenInformation.d.ts +8 -0
- package/dist/foundationText/Form/hooks/useScreenInformation.js +15 -0
- package/dist/foundationText/Form/hooks/useScrollToError/index.d.ts +1 -0
- package/dist/foundationText/Form/hooks/useScrollToError/index.js +1 -0
- package/dist/foundationText/Form/hooks/useScrollToError/useScrollToError.d.ts +9 -0
- package/dist/foundationText/Form/hooks/useScrollToError/useScrollToError.js +64 -0
- package/dist/foundationText/Form/index.d.ts +5 -0
- package/dist/foundationText/Form/index.js +4 -0
- package/dist/foundationText/Form/types.d.ts +215 -0
- package/dist/foundationText/Form/types.js +10 -0
- package/dist/foundationText/FormField/FormField.d.ts +24 -0
- package/dist/foundationText/FormField/FormField.js +11 -0
- package/dist/foundationText/FormField/index.d.ts +1 -0
- package/dist/foundationText/FormField/index.js +1 -0
- package/dist/foundationText/FormatFile/FormatFile.d.ts +79 -0
- package/dist/foundationText/FormatFile/FormatFile.js +47 -0
- package/dist/foundationText/FormatFile/FormatFile.style.d.ts +15 -0
- package/dist/foundationText/FormatFile/FormatFile.style.js +19 -0
- package/dist/foundationText/FormatFile/FormatFileThumbnail.d.ts +58 -0
- package/dist/foundationText/FormatFile/FormatFileThumbnail.js +35 -0
- package/dist/foundationText/FormatFile/components/ErrorIcon/ErrorIcon.d.ts +2 -0
- package/dist/foundationText/FormatFile/components/ErrorIcon/ErrorIcon.js +9 -0
- package/dist/foundationText/FormatFile/components/ErrorIcon/ErrorIcon.style.d.ts +8 -0
- package/dist/foundationText/FormatFile/components/ErrorIcon/ErrorIcon.style.js +11 -0
- package/dist/foundationText/FormatFile/components/ErrorIcon/index.d.ts +1 -0
- package/dist/foundationText/FormatFile/components/ErrorIcon/index.js +1 -0
- package/dist/foundationText/FormatFile/components/FileView/FileView.d.ts +13 -0
- package/dist/foundationText/FormatFile/components/FileView/FileView.js +42 -0
- package/dist/foundationText/FormatFile/components/FileView/FileView.style.d.ts +64 -0
- package/dist/foundationText/FormatFile/components/FileView/FileView.style.js +70 -0
- package/dist/foundationText/FormatFile/components/FileView/index.d.ts +1 -0
- package/dist/foundationText/FormatFile/components/FileView/index.js +1 -0
- package/dist/foundationText/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.d.ts +12 -0
- package/dist/foundationText/FormatFile/components/FormatFileBottomSheet/FormatFileBottomSheet.js +17 -0
- package/dist/foundationText/FormatFile/components/FormatFileBottomSheet/index.d.ts +2 -0
- package/dist/foundationText/FormatFile/components/FormatFileBottomSheet/index.js +1 -0
- package/dist/foundationText/FormatFile/components/MediaView/MediaView.d.ts +14 -0
- package/dist/foundationText/FormatFile/components/MediaView/MediaView.js +108 -0
- package/dist/foundationText/FormatFile/components/MediaView/MediaView.style.d.ts +25 -0
- package/dist/foundationText/FormatFile/components/MediaView/MediaView.style.js +28 -0
- package/dist/foundationText/FormatFile/components/MediaView/index.d.ts +1 -0
- package/dist/foundationText/FormatFile/components/MediaView/index.js +1 -0
- package/dist/foundationText/FormatFile/components/ProgressBar/ProgressBar.d.ts +18 -0
- package/dist/foundationText/FormatFile/components/ProgressBar/ProgressBar.js +30 -0
- package/dist/foundationText/FormatFile/components/ProgressBar/ProgressBar.style.d.ts +13 -0
- package/dist/foundationText/FormatFile/components/ProgressBar/ProgressBar.style.js +16 -0
- package/dist/foundationText/FormatFile/components/ProgressBar/index.d.ts +1 -0
- package/dist/foundationText/FormatFile/components/ProgressBar/index.js +1 -0
- package/dist/foundationText/FormatFile/constants.d.ts +35 -0
- package/dist/foundationText/FormatFile/constants.js +74 -0
- package/dist/foundationText/FormatFile/context/FormatFileContext.d.ts +9 -0
- package/dist/foundationText/FormatFile/context/FormatFileContext.js +8 -0
- package/dist/foundationText/FormatFile/context/types.d.ts +9 -0
- package/dist/foundationText/FormatFile/context/types.js +1 -0
- package/dist/foundationText/FormatFile/index.d.ts +8 -0
- package/dist/foundationText/FormatFile/index.js +3 -0
- package/dist/foundationText/FormatFile/types.d.ts +105 -0
- package/dist/foundationText/FormatFile/types.js +8 -0
- package/dist/foundationText/FormatFile/utils/computeA11yLabel.d.ts +9 -0
- package/dist/foundationText/FormatFile/utils/computeA11yLabel.js +11 -0
- package/dist/foundationText/FormatFile/utils/createUseCreateThumbnail.d.ts +6 -0
- package/dist/foundationText/FormatFile/utils/createUseCreateThumbnail.js +27 -0
- package/dist/foundationText/FormatFile/utils/getFileCategory.d.ts +28 -0
- package/dist/foundationText/FormatFile/utils/getFileCategory.js +62 -0
- package/dist/foundationText/FormatFile/utils/index.d.ts +7 -0
- package/dist/foundationText/FormatFile/utils/index.js +6 -0
- package/dist/foundationText/FormatFile/utils/mapFileTypeToIconName.d.ts +17 -0
- package/dist/foundationText/FormatFile/utils/mapFileTypeToIconName.js +30 -0
- package/dist/foundationText/FormatFile/utils/parseFile.d.ts +3 -0
- package/dist/foundationText/FormatFile/utils/parseFile.js +58 -0
- package/dist/foundationText/FormatFile/utils/sanitizeFileName.d.ts +5 -0
- package/dist/foundationText/FormatFile/utils/sanitizeFileName.js +9 -0
- package/dist/foundationText/FormatFile/utils/truncateFileNameForLine.d.ts +24 -0
- package/dist/foundationText/FormatFile/utils/truncateFileNameForLine.js +58 -0
- package/dist/foundationText/Glimmer/Glimmer.d.ts +32 -0
- package/dist/foundationText/Glimmer/Glimmer.js +42 -0
- package/dist/foundationText/Glimmer/Glimmer.shape.style.d.ts +14 -0
- package/dist/foundationText/Glimmer/Glimmer.shape.style.js +17 -0
- package/dist/foundationText/Glimmer/Glimmer.size.style.d.ts +17 -0
- package/dist/foundationText/Glimmer/Glimmer.size.style.js +10 -0
- package/dist/foundationText/Glimmer/Glimmer.style.d.ts +26 -0
- package/dist/foundationText/Glimmer/Glimmer.style.js +30 -0
- package/dist/foundationText/Glimmer/index.d.ts +1 -0
- package/dist/foundationText/Glimmer/index.js +1 -0
- package/dist/foundationText/Heading/Heading.d.ts +38 -0
- package/dist/foundationText/Heading/Heading.js +53 -0
- package/dist/foundationText/Heading/index.d.ts +2 -0
- package/dist/foundationText/Heading/index.js +1 -0
- package/dist/foundationText/IconButton/IconButton.d.ts +35 -0
- package/dist/foundationText/IconButton/IconButton.js +9 -0
- package/dist/foundationText/IconButton/IconButton.style.d.ts +8 -0
- package/dist/foundationText/IconButton/IconButton.style.js +11 -0
- package/dist/foundationText/IconButton/index.d.ts +1 -0
- package/dist/foundationText/IconButton/index.js +1 -0
- package/dist/foundationText/InputCurrency/constants.d.ts +1 -0
- package/dist/foundationText/InputCurrency/constants.js +1 -0
- package/dist/foundationText/InputCurrency/utils.d.ts +9 -0
- package/dist/foundationText/InputCurrency/utils.js +57 -0
- package/dist/foundationText/InputDate/InputDate.d.ts +76 -0
- package/dist/foundationText/InputDate/InputDate.js +70 -0
- package/dist/foundationText/InputDate/index.d.ts +2 -0
- package/dist/foundationText/InputDate/index.js +1 -0
- package/dist/foundationText/InputFieldWrapper/CommonInputStyles.style.d.ts +10 -0
- package/dist/foundationText/InputFieldWrapper/CommonInputStyles.style.js +49 -0
- package/dist/foundationText/InputFieldWrapper/InputFieldWrapper.d.ts +92 -0
- package/dist/foundationText/InputFieldWrapper/InputFieldWrapper.js +99 -0
- package/dist/foundationText/InputFieldWrapper/InputFieldWrapper.style.d.ts +106 -0
- package/dist/foundationText/InputFieldWrapper/InputFieldWrapper.style.js +123 -0
- package/dist/foundationText/InputFieldWrapper/components/ClearAction/ClearAction.d.ts +10 -0
- package/dist/foundationText/InputFieldWrapper/components/ClearAction/ClearAction.js +11 -0
- package/dist/foundationText/InputFieldWrapper/components/ClearAction/ClearAction.style.d.ts +22 -0
- package/dist/foundationText/InputFieldWrapper/components/ClearAction/ClearAction.style.js +26 -0
- package/dist/foundationText/InputFieldWrapper/components/ClearAction/index.d.ts +1 -0
- package/dist/foundationText/InputFieldWrapper/components/ClearAction/index.js +1 -0
- package/dist/foundationText/InputFieldWrapper/components/Prefix/Prefix.d.ts +22 -0
- package/dist/foundationText/InputFieldWrapper/components/Prefix/Prefix.js +39 -0
- package/dist/foundationText/InputFieldWrapper/components/Suffix/Suffix.d.ts +25 -0
- package/dist/foundationText/InputFieldWrapper/components/Suffix/Suffix.js +40 -0
- package/dist/foundationText/InputFieldWrapper/index.d.ts +4 -0
- package/dist/foundationText/InputFieldWrapper/index.js +3 -0
- package/dist/foundationText/InputPressable/InputPressable.d.ts +91 -0
- package/dist/foundationText/InputPressable/InputPressable.js +42 -0
- package/dist/foundationText/InputPressable/InputPressable.style.d.ts +21 -0
- package/dist/foundationText/InputPressable/InputPressable.style.js +28 -0
- package/dist/foundationText/InputPressable/index.d.ts +2 -0
- package/dist/foundationText/InputPressable/index.js +1 -0
- package/dist/foundationText/InputSearch/components/FilterButton.d.ts +7 -0
- package/dist/foundationText/InputSearch/components/FilterButton.js +10 -0
- package/dist/foundationText/InputText/context/InputAccessoriesContext.d.ts +3 -0
- package/dist/foundationText/InputText/context/InputAccessoriesContext.js +16 -0
- package/dist/foundationText/InputText/context/InputAccessoriesProvider.d.ts +5 -0
- package/dist/foundationText/InputText/context/InputAccessoriesProvider.js +68 -0
- package/dist/foundationText/InputText/context/InputAccessoriesProvider.style.d.ts +17 -0
- package/dist/foundationText/InputText/context/InputAccessoriesProvider.style.js +23 -0
- package/dist/foundationText/InputText/context/index.d.ts +2 -0
- package/dist/foundationText/InputText/context/index.js +2 -0
- package/dist/foundationText/InputText/context/types.d.ts +23 -0
- package/dist/foundationText/InputText/context/types.js +1 -0
- package/dist/foundationText/InputTime/InputTime.d.ts +63 -0
- package/dist/foundationText/InputTime/InputTime.js +76 -0
- package/dist/foundationText/InputTime/InputTime.style.d.ts +6 -0
- package/dist/foundationText/InputTime/InputTime.style.js +7 -0
- package/dist/foundationText/InputTime/index.d.ts +2 -0
- package/dist/foundationText/InputTime/index.js +2 -0
- package/dist/foundationText/InputTime/utils/index.d.ts +11 -0
- package/dist/foundationText/InputTime/utils/index.js +16 -0
- package/dist/foundationText/ProgressBar/ProgressBar.d.ts +6 -0
- package/dist/foundationText/ProgressBar/ProgressBar.js +36 -0
- package/dist/foundationText/ProgressBar/ProgressBar.size.style.d.ts +11 -0
- package/dist/foundationText/ProgressBar/ProgressBar.size.style.js +6 -0
- package/dist/foundationText/ProgressBar/ProgressBar.style.d.ts +34 -0
- package/dist/foundationText/ProgressBar/ProgressBar.style.js +37 -0
- package/dist/foundationText/ProgressBar/ProgressBarInner.d.ts +12 -0
- package/dist/foundationText/ProgressBar/ProgressBarInner.js +25 -0
- package/dist/foundationText/ProgressBar/ProgressBarStepped.d.ts +12 -0
- package/dist/foundationText/ProgressBar/ProgressBarStepped.js +32 -0
- package/dist/foundationText/ProgressBar/index.d.ts +2 -0
- package/dist/foundationText/ProgressBar/index.js +1 -0
- package/dist/foundationText/ProgressBar/types.d.ts +61 -0
- package/dist/foundationText/ProgressBar/types.js +1 -0
- package/dist/foundationText/ProgressIndicator/ProgressIndicator.d.ts +3 -0
- package/dist/foundationText/ProgressIndicator/ProgressIndicator.js +105 -0
- package/dist/foundationText/ProgressIndicator/ProgressIndicator.size.style.d.ts +19 -0
- package/dist/foundationText/ProgressIndicator/ProgressIndicator.size.style.js +15 -0
- package/dist/foundationText/ProgressIndicator/ProgressIndicator.style.d.ts +48 -0
- package/dist/foundationText/ProgressIndicator/ProgressIndicator.style.js +51 -0
- package/dist/foundationText/ProgressIndicator/index.d.ts +2 -0
- package/dist/foundationText/ProgressIndicator/index.js +1 -0
- package/dist/foundationText/ProgressIndicator/types.d.ts +44 -0
- package/dist/foundationText/ProgressIndicator/types.js +1 -0
- package/dist/foundationText/Select/Select.d.ts +92 -0
- package/dist/foundationText/Select/Select.js +102 -0
- package/dist/foundationText/Select/Select.style.d.ts +29 -0
- package/dist/foundationText/Select/Select.style.js +55 -0
- package/dist/foundationText/Select/SelectComposableTypes.d.ts +50 -0
- package/dist/foundationText/Select/SelectComposableTypes.js +1 -0
- package/dist/foundationText/Select/SelectRoot.d.ts +12 -0
- package/dist/foundationText/Select/SelectRoot.js +69 -0
- package/dist/foundationText/Select/SelectRoot.style.d.ts +8 -0
- package/dist/foundationText/Select/SelectRoot.style.js +9 -0
- package/dist/foundationText/Select/components/SelectContent.d.ts +8 -0
- package/dist/foundationText/Select/components/SelectContent.js +34 -0
- package/dist/foundationText/Select/components/SelectDefaultPicker/SelectDefaultPicker.d.ts +5 -0
- package/dist/foundationText/Select/components/SelectDefaultPicker/SelectDefaultPicker.ios.d.ts +5 -0
- package/dist/foundationText/Select/components/SelectDefaultPicker/SelectDefaultPicker.ios.js +22 -0
- package/dist/foundationText/Select/components/SelectDefaultPicker/SelectDefaultPicker.js +15 -0
- package/dist/foundationText/Select/components/SelectDefaultPicker/SelectDefaultPicker.style.d.ts +30 -0
- package/dist/foundationText/Select/components/SelectDefaultPicker/SelectDefaultPicker.style.js +29 -0
- package/dist/foundationText/Select/components/SelectDefaultPicker/index.d.ts +1 -0
- package/dist/foundationText/Select/components/SelectDefaultPicker/index.js +1 -0
- package/dist/foundationText/Select/components/SelectFieldContext.d.ts +27 -0
- package/dist/foundationText/Select/components/SelectFieldContext.js +10 -0
- package/dist/foundationText/Select/components/SelectIOSPicker/SelectIOSPicker.d.ts +10 -0
- package/dist/foundationText/Select/components/SelectIOSPicker/SelectIOSPicker.js +2 -0
- package/dist/foundationText/Select/components/SelectIOSPicker/index.d.ts +1 -0
- package/dist/foundationText/Select/components/SelectIOSPicker/index.js +1 -0
- package/dist/foundationText/Select/components/SelectInternalPicker/SelectInternalPicker.d.ts +3 -0
- package/dist/foundationText/Select/components/SelectInternalPicker/SelectInternalPicker.js +14 -0
- package/dist/foundationText/Select/components/SelectInternalPicker/index.d.ts +1 -0
- package/dist/foundationText/Select/components/SelectInternalPicker/index.js +1 -0
- package/dist/foundationText/Select/components/SelectInternalPicker/utils.d.ts +3 -0
- package/dist/foundationText/Select/components/SelectInternalPicker/utils.js +13 -0
- package/dist/foundationText/Select/components/SelectItem.d.ts +32 -0
- package/dist/foundationText/Select/components/SelectItem.js +26 -0
- package/dist/foundationText/Select/components/SelectItem.style.d.ts +5 -0
- package/dist/foundationText/Select/components/SelectItem.style.js +6 -0
- package/dist/foundationText/Select/components/SelectLabel.d.ts +22 -0
- package/dist/foundationText/Select/components/SelectLabel.js +30 -0
- package/dist/foundationText/Select/components/SelectPressable/SelectPressable.d.ts +11 -0
- package/dist/foundationText/Select/components/SelectPressable/SelectPressable.js +17 -0
- package/dist/foundationText/Select/components/SelectPressable/SelectPressable.style.d.ts +5 -0
- package/dist/foundationText/Select/components/SelectPressable/SelectPressable.style.js +8 -0
- package/dist/foundationText/Select/components/SelectPressable/index.d.ts +1 -0
- package/dist/foundationText/Select/components/SelectPressable/index.js +1 -0
- package/dist/foundationText/Select/components/SelectTrigger.d.ts +20 -0
- package/dist/foundationText/Select/components/SelectTrigger.js +39 -0
- package/dist/foundationText/Select/components/SelectTrigger.style.d.ts +25 -0
- package/dist/foundationText/Select/components/SelectTrigger.style.js +31 -0
- package/dist/foundationText/Select/index.d.ts +4 -0
- package/dist/foundationText/Select/index.js +4 -0
- package/dist/foundationText/Select/types.d.ts +38 -0
- package/dist/foundationText/Select/types.js +1 -0
- package/dist/foundationText/StatusLabel/StatusLabel.d.ts +22 -0
- package/dist/foundationText/StatusLabel/StatusLabel.js +20 -0
- package/dist/foundationText/StatusLabel/StatusLabel.style.d.ts +23 -0
- package/dist/foundationText/StatusLabel/StatusLabel.style.js +29 -0
- package/dist/foundationText/StatusLabel/index.d.ts +2 -0
- package/dist/foundationText/StatusLabel/index.js +1 -0
- package/dist/foundationText/Text/Text.d.ts +76 -0
- package/dist/foundationText/Text/Text.js +39 -0
- package/dist/foundationText/Text/index.d.ts +2 -0
- package/dist/foundationText/Text/index.js +1 -0
- package/dist/foundationText/TextList/TextList.d.ts +30 -0
- package/dist/foundationText/TextList/TextList.js +11 -0
- package/dist/foundationText/TextList/TextList.style.d.ts +14 -0
- package/dist/foundationText/TextList/TextList.style.js +17 -0
- package/dist/foundationText/TextList/index.d.ts +1 -0
- package/dist/foundationText/TextList/index.js +1 -0
- package/dist/foundationText/ThumbnailList/ThumbnailList.d.ts +5 -0
- package/dist/foundationText/ThumbnailList/ThumbnailList.js +32 -0
- package/dist/foundationText/ThumbnailList/ThumbnailList.style.d.ts +47 -0
- package/dist/foundationText/ThumbnailList/ThumbnailList.style.js +50 -0
- package/dist/foundationText/ThumbnailList/index.d.ts +2 -0
- package/dist/foundationText/ThumbnailList/index.js +2 -0
- package/dist/foundationText/ThumbnailList/types.d.ts +15 -0
- package/dist/foundationText/ThumbnailList/types.js +5 -0
- package/dist/foundationText/Toast/Toast.d.ts +28 -0
- package/dist/foundationText/Toast/Toast.js +64 -0
- package/dist/foundationText/Toast/Toast.styles.d.ts +31 -0
- package/dist/foundationText/Toast/Toast.styles.js +31 -0
- package/dist/foundationText/Toast/index.d.ts +2 -0
- package/dist/foundationText/Toast/index.js +1 -0
- package/dist/foundationText/Typography/Typography.d.ts +126 -0
- package/dist/foundationText/Typography/Typography.js +124 -0
- package/dist/foundationText/Typography/Typography.style.d.ts +16 -0
- package/dist/foundationText/Typography/Typography.style.js +472 -0
- package/dist/foundationText/Typography/TypographyGestureDetector.d.ts +8 -0
- package/dist/foundationText/Typography/TypographyGestureDetector.js +11 -0
- package/dist/foundationText/Typography/index.d.ts +5 -0
- package/dist/foundationText/Typography/index.js +4 -0
- package/dist/foundationText/Typography/webFonts.d.ts +4 -0
- package/dist/foundationText/Typography/webFonts.js +34 -0
- package/dist/foundationText/capitalize.d.ts +1 -0
- package/dist/foundationText/capitalize.js +6 -0
- package/dist/foundationText/compatTheme.d.ts +8 -0
- package/dist/foundationText/compatTheme.js +14 -0
- package/dist/foundationText/dateFormatter.d.ts +6 -0
- package/dist/foundationText/dateFormatter.js +19 -0
- package/dist/foundationText/foundationMessages.d.ts +11 -0
- package/dist/foundationText/foundationMessages.js +24 -0
- package/dist/foundationText/messages-en.d.ts +38 -0
- package/dist/foundationText/messages-en.js +38 -0
- package/dist/foundationText/messages-es.d.ts +38 -0
- package/dist/foundationText/messages-es.js +38 -0
- package/dist/foundationText/primitives/HelperText/HelperText.d.ts +15 -0
- package/dist/foundationText/primitives/HelperText/HelperText.js +11 -0
- package/dist/foundationText/primitives/HelperText/HelperText.style.d.ts +16 -0
- package/dist/foundationText/primitives/HelperText/HelperText.style.js +19 -0
- package/dist/foundationText/primitives/HelperText/index.d.ts +2 -0
- package/dist/foundationText/primitives/HelperText/index.js +1 -0
- package/dist/foundationText/primitives/Portal/index.d.ts +1 -0
- package/dist/foundationText/primitives/Portal/index.js +7 -0
- package/dist/foundationText/primitives/Select/SelectPrimitive.d.ts +69 -0
- package/dist/foundationText/primitives/Select/SelectPrimitive.js +160 -0
- package/dist/foundationText/primitives/Select/SelectPrimitive.style.d.ts +114 -0
- package/dist/foundationText/primitives/Select/SelectPrimitive.style.js +130 -0
- package/dist/foundationText/primitives/Select/index.d.ts +2 -0
- package/dist/foundationText/primitives/Select/index.js +1 -0
- package/dist/foundationText/primitives/Select/nativeTypes.d.ts +84 -0
- package/dist/foundationText/primitives/Select/nativeTypes.js +1 -0
- package/dist/foundationText/primitives/Select/types.d.ts +41 -0
- package/dist/foundationText/primitives/Select/types.js +1 -0
- package/dist/foundationText/primitives/index.d.ts +3 -0
- package/dist/foundationText/primitives/index.js +3 -0
- package/dist/foundationTokens.d.ts +388 -0
- package/dist/foundationTokens.js +26 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.js +54 -0
- package/dist/legacyTheme.d.ts +18 -0
- package/dist/legacyTheme.js +23 -0
- package/dist/sheetContext.d.ts +3 -0
- package/dist/sheetContext.js +6 -0
- package/dist/theme.d.ts +29 -0
- package/dist/theme.js +42 -0
- package/dist/useFormController.d.ts +11 -0
- package/dist/useFormController.js +15 -0
- package/dist/useIsScreenReaderEnabled.d.ts +1 -0
- package/dist/useIsScreenReaderEnabled.js +21 -0
- package/ios/RulnarPickerManager.m +59 -0
- package/package.json +146 -4
- package/resources/meta.json +85 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import type { RegisterOptions } from "react-hook-form";
|
|
4
|
+
import { SelectRoot } from "./SelectRoot.js";
|
|
5
|
+
import { SelectTrigger } from "./components/SelectTrigger.js";
|
|
6
|
+
import { SelectLabel } from "./components/SelectLabel.js";
|
|
7
|
+
import { SelectContent } from "./components/SelectContent.js";
|
|
8
|
+
import { SelectItem, SelectItemPrefix, SelectItemSuffix } from "./components/SelectItem.js";
|
|
9
|
+
export interface SelectOption {
|
|
10
|
+
/**
|
|
11
|
+
* Text that shows up as the option
|
|
12
|
+
*/
|
|
13
|
+
readonly children: string;
|
|
14
|
+
/**
|
|
15
|
+
* The value that gets returned when an option is selected
|
|
16
|
+
*/
|
|
17
|
+
readonly value: string;
|
|
18
|
+
}
|
|
19
|
+
export interface SelectProps {
|
|
20
|
+
/**
|
|
21
|
+
* Current value of the component
|
|
22
|
+
*/
|
|
23
|
+
readonly value?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Default value for when the component is uncontrolled
|
|
26
|
+
*/
|
|
27
|
+
readonly defaultValue?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Adds a first option to let users select a "no value".
|
|
30
|
+
* Placeholder item selected by default until a selection is made.
|
|
31
|
+
*/
|
|
32
|
+
readonly placeholder?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Label text shown above the selection.
|
|
35
|
+
*/
|
|
36
|
+
readonly label?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Help text shown below the control.
|
|
39
|
+
*/
|
|
40
|
+
readonly assistiveText?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Callback that provides the new value when the selection changes
|
|
43
|
+
*/
|
|
44
|
+
readonly onChange?: (newValue?: string) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Disables input selection
|
|
47
|
+
*/
|
|
48
|
+
readonly disabled?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Indicates the current selection is invalid
|
|
51
|
+
*/
|
|
52
|
+
readonly invalid?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* VoiceOver will read this string when a user selects the element
|
|
55
|
+
*/
|
|
56
|
+
readonly accessibilityLabel?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Helps users understand what will happen when they perform an action
|
|
59
|
+
*/
|
|
60
|
+
readonly accessibilityHint?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Name of the input.
|
|
63
|
+
*/
|
|
64
|
+
readonly name?: string;
|
|
65
|
+
/**
|
|
66
|
+
* The options to select from
|
|
67
|
+
*/
|
|
68
|
+
readonly children: ReactElement<SelectOption>[];
|
|
69
|
+
/**
|
|
70
|
+
* The validations that will mark this component as invalid
|
|
71
|
+
*/
|
|
72
|
+
readonly validations?: RegisterOptions;
|
|
73
|
+
/**
|
|
74
|
+
* Used to locate this view in end-to-end tests.
|
|
75
|
+
*/
|
|
76
|
+
readonly testID?: string;
|
|
77
|
+
}
|
|
78
|
+
export declare function Select({ value, defaultValue, onChange, children, placeholder, label, assistiveText, disabled, invalid, validations, accessibilityLabel, name, testID, }: SelectProps): React.JSX.Element;
|
|
79
|
+
export declare namespace Select {
|
|
80
|
+
var Root: typeof SelectRoot;
|
|
81
|
+
var Trigger: typeof SelectTrigger;
|
|
82
|
+
var Value: ({ style, ...props }: import("../primitives/Select/types.js").SelectPrimitiveValueProps) => React.JSX.Element;
|
|
83
|
+
var Label: typeof SelectLabel;
|
|
84
|
+
var Content: typeof SelectContent;
|
|
85
|
+
var Item: typeof SelectItem;
|
|
86
|
+
var ItemPrefix: typeof SelectItemPrefix;
|
|
87
|
+
var ItemSuffix: typeof SelectItemSuffix;
|
|
88
|
+
var Group: ({ ...props }: import("../primitives/Select/types.js").SelectPrimitiveGroupProps) => React.JSX.Element;
|
|
89
|
+
var GroupLabel: ({ style, ref, ...props }: import("../primitives/Select/types.js").SelectPrimitiveLabelProps) => React.JSX.Element;
|
|
90
|
+
var Separator: ({ style, ref, ...props }: import("../primitives/Select/types.js").SelectPrimitiveSeparatorProps) => React.JSX.Element;
|
|
91
|
+
}
|
|
92
|
+
export declare function Option({ children }: SelectOption): React.JSX.Element;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
import { useStyles } from "./Select.style.js";
|
|
5
|
+
import { SelectInternalPicker } from "./components/SelectInternalPicker/index.js";
|
|
6
|
+
import { SelectRoot } from "./SelectRoot.js";
|
|
7
|
+
import { SelectTrigger } from "./components/SelectTrigger.js";
|
|
8
|
+
import { SelectLabel } from "./components/SelectLabel.js";
|
|
9
|
+
import { SelectContent } from "./components/SelectContent.js";
|
|
10
|
+
import { SelectItem, SelectItemPrefix, SelectItemSuffix, } from "./components/SelectItem.js";
|
|
11
|
+
import { SelectPrimitive } from "../primitives/Select/index.js";
|
|
12
|
+
import { InputFieldWrapper } from "../InputFieldWrapper/index.js";
|
|
13
|
+
import { Icon } from "../../Icon.js";
|
|
14
|
+
import { Text } from "../Text/index.js";
|
|
15
|
+
import { useFormController } from "../../useFormController.js";
|
|
16
|
+
import { useComponentMessages } from "../foundationMessages.js";
|
|
17
|
+
export function Select({ value, defaultValue, onChange, children, placeholder, label, assistiveText, disabled = false, invalid, validations, accessibilityLabel, name, testID, }) {
|
|
18
|
+
const { field, error } = useFormController({
|
|
19
|
+
name,
|
|
20
|
+
validations,
|
|
21
|
+
value: value ?? defaultValue,
|
|
22
|
+
});
|
|
23
|
+
const { t } = useComponentMessages();
|
|
24
|
+
const internalValue = value ?? field.value;
|
|
25
|
+
const textVariation = getTextVariation({
|
|
26
|
+
disabled,
|
|
27
|
+
invalid: invalid || !!error,
|
|
28
|
+
});
|
|
29
|
+
const valueTextVariation = disabled ? "disabled" : undefined;
|
|
30
|
+
const hasValue = internalValue && internalValue?.length > 0;
|
|
31
|
+
const styles = useStyles();
|
|
32
|
+
return (_jsx(InputFieldWrapper, { error: error, invalid: invalid || !!error, hasValue: hasValue, styleOverride: {
|
|
33
|
+
container: { paddingLeft: undefined },
|
|
34
|
+
}, ...(assistiveText !== undefined && { assistiveText: assistiveText }), children: _jsx(View, { testID: getTestID(testID), accessible: true, accessibilityLabel: getA11yLabel(), accessibilityValue: { text: getValue() }, accessibilityHint: t("Select.a11yHint"), accessibilityRole: "button", accessibilityState: { disabled: disabled }, children: _jsx(SelectInternalPicker, { disabled: disabled, options: getOptions(), onChange: handleChange, children: _jsxs(View, { style: [styles.container, (invalid || !!error) && styles.invalid], children: [label && (_jsx(Text, { level: "textSupporting", variation: textVariation, hideFromScreenReader: true, selectable: false, children: label })), _jsxs(View, { style: styles.input, children: [_jsx(View, { style: styles.value, children: _jsx(Text, { variation: disabled ? "disabled" : "base", hideFromScreenReader: true, selectable: false, children: getValue() }) }), _jsx(View, { style: styles.icon, children: _jsx(Icon, { name: "arrowDown", ...(valueTextVariation && { color: valueTextVariation }) }) })] })] }) }) }) }));
|
|
35
|
+
function getA11yLabel() {
|
|
36
|
+
let text = [accessibilityLabel || label, assistiveText];
|
|
37
|
+
text = text.filter(Boolean);
|
|
38
|
+
return text.join(", ");
|
|
39
|
+
}
|
|
40
|
+
function handleChange(val) {
|
|
41
|
+
onChange?.(val);
|
|
42
|
+
// need this onBlur for validations to occur
|
|
43
|
+
field.onBlur();
|
|
44
|
+
field.onChange(val);
|
|
45
|
+
}
|
|
46
|
+
function getOptions() {
|
|
47
|
+
const options = children.map(({ props }) => ({
|
|
48
|
+
label: props.children,
|
|
49
|
+
value: props.value,
|
|
50
|
+
isActive: props.value === internalValue,
|
|
51
|
+
}));
|
|
52
|
+
if (!internalValue || placeholder) {
|
|
53
|
+
options.unshift({
|
|
54
|
+
label: placeholder || t("Select.emptyValue"),
|
|
55
|
+
value: "",
|
|
56
|
+
isActive: !internalValue,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return options;
|
|
60
|
+
}
|
|
61
|
+
function getValue() {
|
|
62
|
+
const options = getOptions();
|
|
63
|
+
const activeValue = options.find(option => option.isActive);
|
|
64
|
+
return activeValue?.label || placeholder || t("Select.emptyValue");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The composable `Select.*` parts, attached as statics on the function
|
|
69
|
+
* declaration in this file — the docs site's prop generation
|
|
70
|
+
* (react-docgen-typescript) only discovers parts assigned here at compile
|
|
71
|
+
* time, not runtime attachments like `Object.assign`. Additive — the legacy
|
|
72
|
+
* props-driven `Select` + `Option` are unchanged (props, native picker,
|
|
73
|
+
* `ATL-Select` testID). See `Select.guide.md` for the parts and the
|
|
74
|
+
* composition model.
|
|
75
|
+
*/
|
|
76
|
+
Select.Root = SelectRoot;
|
|
77
|
+
Select.Trigger = SelectTrigger;
|
|
78
|
+
Select.Value = SelectPrimitive.Value;
|
|
79
|
+
Select.Label = SelectLabel;
|
|
80
|
+
Select.Content = SelectContent;
|
|
81
|
+
Select.Item = SelectItem;
|
|
82
|
+
Select.ItemPrefix = SelectItemPrefix;
|
|
83
|
+
Select.ItemSuffix = SelectItemSuffix;
|
|
84
|
+
Select.Group = SelectPrimitive.Group;
|
|
85
|
+
Select.GroupLabel = SelectPrimitive.Label;
|
|
86
|
+
Select.Separator = SelectPrimitive.Separator;
|
|
87
|
+
function getTextVariation({ invalid, disabled, }) {
|
|
88
|
+
if (invalid)
|
|
89
|
+
return "error";
|
|
90
|
+
if (disabled)
|
|
91
|
+
return "disabled";
|
|
92
|
+
return "subdued";
|
|
93
|
+
}
|
|
94
|
+
function getTestID(testID) {
|
|
95
|
+
if (testID) {
|
|
96
|
+
return `ATL-${testID}-Select`;
|
|
97
|
+
}
|
|
98
|
+
return "ATL-Select";
|
|
99
|
+
}
|
|
100
|
+
export function Option({ children }) {
|
|
101
|
+
return _jsx(_Fragment, { children: children });
|
|
102
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const useStyles: () => {
|
|
2
|
+
container: import("react-native").ViewStyle;
|
|
3
|
+
input: import("react-native").ViewStyle;
|
|
4
|
+
value: {
|
|
5
|
+
flexGrow: number;
|
|
6
|
+
flexShrink: number;
|
|
7
|
+
};
|
|
8
|
+
icon: {
|
|
9
|
+
position: "absolute";
|
|
10
|
+
bottom: "50%";
|
|
11
|
+
right: number;
|
|
12
|
+
flexGrow: number;
|
|
13
|
+
flexShrink: number;
|
|
14
|
+
};
|
|
15
|
+
invalid: {
|
|
16
|
+
color: string;
|
|
17
|
+
borderColor: string;
|
|
18
|
+
};
|
|
19
|
+
errorMessageWrapperIcon: {
|
|
20
|
+
flex: number;
|
|
21
|
+
flexBasis: "auto";
|
|
22
|
+
paddingTop: number;
|
|
23
|
+
paddingRight: number;
|
|
24
|
+
};
|
|
25
|
+
messageWrapper: {
|
|
26
|
+
paddingTop: number;
|
|
27
|
+
flexDirection: "row";
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { getCommonInputStyles } from "../InputFieldWrapper/index.js";
|
|
3
|
+
import { buildThemedStyles } from "../compatTheme.js";
|
|
4
|
+
export const useStyles = buildThemedStyles(tokens => {
|
|
5
|
+
const commonInputStyles = getCommonInputStyles(tokens);
|
|
6
|
+
return {
|
|
7
|
+
container: StyleSheet.flatten([
|
|
8
|
+
commonInputStyles.container,
|
|
9
|
+
{
|
|
10
|
+
flexDirection: "column",
|
|
11
|
+
justifyContent: "center",
|
|
12
|
+
minHeight: tokens["space-largest"] + tokens["space-small"],
|
|
13
|
+
marginVertical: 0,
|
|
14
|
+
borderWidth: 0,
|
|
15
|
+
backgroundColor: "transparent",
|
|
16
|
+
},
|
|
17
|
+
]),
|
|
18
|
+
input: StyleSheet.flatten([
|
|
19
|
+
commonInputStyles.input,
|
|
20
|
+
{
|
|
21
|
+
flexDirection: "row",
|
|
22
|
+
flexGrow: 0,
|
|
23
|
+
paddingTop: tokens["space-smaller"],
|
|
24
|
+
minHeight: 0,
|
|
25
|
+
minWidth: "100%",
|
|
26
|
+
paddingRight: tokens["space-small"],
|
|
27
|
+
},
|
|
28
|
+
]),
|
|
29
|
+
value: {
|
|
30
|
+
flexGrow: 1,
|
|
31
|
+
flexShrink: 1,
|
|
32
|
+
},
|
|
33
|
+
icon: {
|
|
34
|
+
position: "absolute",
|
|
35
|
+
bottom: "50%",
|
|
36
|
+
right: tokens["space-small"],
|
|
37
|
+
flexGrow: 0,
|
|
38
|
+
flexShrink: 0,
|
|
39
|
+
},
|
|
40
|
+
invalid: {
|
|
41
|
+
color: tokens["color-critical"],
|
|
42
|
+
borderColor: tokens["color-critical"],
|
|
43
|
+
},
|
|
44
|
+
errorMessageWrapperIcon: {
|
|
45
|
+
flex: 0,
|
|
46
|
+
flexBasis: "auto",
|
|
47
|
+
paddingTop: tokens["space-minuscule"],
|
|
48
|
+
paddingRight: tokens["space-smaller"],
|
|
49
|
+
},
|
|
50
|
+
messageWrapper: {
|
|
51
|
+
paddingTop: tokens["space-smaller"],
|
|
52
|
+
flexDirection: "row",
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { SelectPrimitiveRootProps } from "../primitives/Select/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Props for the composable `Select.Root` chrome — a presentational
|
|
5
|
+
* composition over `SelectPrimitive.Root`. Adds the optional field chrome
|
|
6
|
+
* (label, description / error) and the field-state flags (`invalid`,
|
|
7
|
+
* `status`, `readOnly`) that the styled trigger reads. Everything else passes
|
|
8
|
+
* through to `SelectPrimitive.Root` (and therefore `@rn-primitives/select`).
|
|
9
|
+
*
|
|
10
|
+
* Deliberately RHF-free: no `name`, no `validations`.
|
|
11
|
+
*/
|
|
12
|
+
export interface SelectRootProps extends SelectPrimitiveRootProps {
|
|
13
|
+
/**
|
|
14
|
+
* Where the field label renders: `"inside"` the trigger (small, above the value)
|
|
15
|
+
* or `"above"` it. DS-owned default (`"inside"`); overridable per instance.
|
|
16
|
+
* The label content itself is authored via `Select.Label`.
|
|
17
|
+
*/
|
|
18
|
+
readonly labelPlacement?: "above" | "inside";
|
|
19
|
+
/**
|
|
20
|
+
* Explicit accessible name for the trigger. Auto-derived from a string
|
|
21
|
+
* `Select.Label`; supply this when the label content is a non-string
|
|
22
|
+
* `ReactNode`, or to name a field that has no visible `Select.Label`.
|
|
23
|
+
*/
|
|
24
|
+
readonly accessibilityLabel?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Supporting text rendered below the trigger. A string renders as neutral
|
|
27
|
+
* `HelperText`; a `ReactNode` renders verbatim. Suppressed when `error` is
|
|
28
|
+
* present.
|
|
29
|
+
*/
|
|
30
|
+
readonly description?: string | ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* Error message rendered below the trigger as critical `HelperText` (string)
|
|
33
|
+
* or verbatim (`ReactNode`). Takes priority over `description` and applies
|
|
34
|
+
* the critical trigger styling.
|
|
35
|
+
*/
|
|
36
|
+
readonly error?: string | ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Applies the critical trigger styling without rendering an error message.
|
|
39
|
+
*/
|
|
40
|
+
readonly invalid?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* `critical` applies the critical trigger styling. Defaults to `neutral`.
|
|
43
|
+
*/
|
|
44
|
+
readonly status?: "neutral" | "critical";
|
|
45
|
+
/**
|
|
46
|
+
* Renders the trigger as non-interactive read-only presentation (subtle
|
|
47
|
+
* surface, no chevron, value as text). `disabled` takes precedence.
|
|
48
|
+
*/
|
|
49
|
+
readonly readOnly?: boolean;
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SelectRootProps } from "./SelectComposableTypes.js";
|
|
3
|
+
/**
|
|
4
|
+
* Composable `Select.Root` chrome: renders the optional `description` / `error`
|
|
5
|
+
* below the field (via `HelperText`), owns the field-state context, and places the
|
|
6
|
+
* field label. The label content is authored via `Select.Label` (registered into
|
|
7
|
+
* this context); `labelPlacement` decides whether it renders in the above slot
|
|
8
|
+
* (here) or the inside slot (`Select.Trigger`). `error` takes priority over
|
|
9
|
+
* `description`. See `Select.guide.md` for the label / accessibility / layering
|
|
10
|
+
* model.
|
|
11
|
+
*/
|
|
12
|
+
export declare function SelectRoot({ labelPlacement, accessibilityLabel: accessibilityLabelProp, description, error, invalid, status, readOnly, children, ...rootProps }: SelectRootProps): React.JSX.Element;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useCallback, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
import { useStyles } from "./SelectRoot.style.js";
|
|
5
|
+
import { SelectFieldContext } from "./components/SelectFieldContext.js";
|
|
6
|
+
import { FieldLabel } from "./components/SelectLabel.js";
|
|
7
|
+
import { HelperText } from "../primitives/HelperText/index.js";
|
|
8
|
+
import { SelectPrimitive } from "../primitives/Select/index.js";
|
|
9
|
+
/**
|
|
10
|
+
* Composable `Select.Root` chrome: renders the optional `description` / `error`
|
|
11
|
+
* below the field (via `HelperText`), owns the field-state context, and places the
|
|
12
|
+
* field label. The label content is authored via `Select.Label` (registered into
|
|
13
|
+
* this context); `labelPlacement` decides whether it renders in the above slot
|
|
14
|
+
* (here) or the inside slot (`Select.Trigger`). `error` takes priority over
|
|
15
|
+
* `description`. See `Select.guide.md` for the label / accessibility / layering
|
|
16
|
+
* model.
|
|
17
|
+
*/
|
|
18
|
+
export function SelectRoot({ labelPlacement = "inside", accessibilityLabel: accessibilityLabelProp, description, error, invalid, status, readOnly, children, ...rootProps }) {
|
|
19
|
+
const styles = useStyles();
|
|
20
|
+
// An empty / whitespace-only string error counts as "no error".
|
|
21
|
+
const hasError = typeof error === "string" ? error.trim().length > 0 : error != null;
|
|
22
|
+
const isInvalid = invalid === true || status === "critical" || hasError;
|
|
23
|
+
// A composed `Select.Label` registers its content + (for a string) its
|
|
24
|
+
// accessible name here.
|
|
25
|
+
const [registered, setRegistered] = useState();
|
|
26
|
+
// Track how many `Select.Label`s are mounted to warn on unsupported
|
|
27
|
+
// multi-label usage (the registry holds a single label — the last one wins).
|
|
28
|
+
const labelCount = useRef(0);
|
|
29
|
+
const registerLabel = useCallback((content, name) => {
|
|
30
|
+
labelCount.current += 1;
|
|
31
|
+
if (labelCount.current > 1) {
|
|
32
|
+
console.warn("Select: multiple <Select.Label> are composed — only one is supported; the last one wins.");
|
|
33
|
+
}
|
|
34
|
+
setRegistered({ content, ...(name !== undefined && { name }) });
|
|
35
|
+
}, []);
|
|
36
|
+
const unregisterLabel = useCallback(() => {
|
|
37
|
+
labelCount.current = Math.max(0, labelCount.current - 1);
|
|
38
|
+
setRegistered(undefined);
|
|
39
|
+
}, []);
|
|
40
|
+
const labelContent = registered?.content;
|
|
41
|
+
const accessibilityLabel = accessibilityLabelProp ?? registered?.name;
|
|
42
|
+
const fieldState = useMemo(() => ({
|
|
43
|
+
labelPlacement,
|
|
44
|
+
labelContent,
|
|
45
|
+
...(accessibilityLabel !== undefined && { accessibilityLabel }),
|
|
46
|
+
invalid: isInvalid,
|
|
47
|
+
...(readOnly !== undefined && { readOnly }),
|
|
48
|
+
registerLabel,
|
|
49
|
+
unregisterLabel,
|
|
50
|
+
}), [
|
|
51
|
+
labelPlacement,
|
|
52
|
+
labelContent,
|
|
53
|
+
accessibilityLabel,
|
|
54
|
+
isInvalid,
|
|
55
|
+
readOnly,
|
|
56
|
+
registerLabel,
|
|
57
|
+
unregisterLabel,
|
|
58
|
+
]);
|
|
59
|
+
return (_jsxs(View, { style: styles.container, children: [_jsx(SelectFieldContext.Provider, { value: fieldState, children: _jsxs(SelectPrimitive.Root, { style: styles.field, ...rootProps, children: [labelPlacement === "above" && _jsx(FieldLabel, {}), children] }) }), renderBelowField(hasError ? error : undefined, description)] }));
|
|
60
|
+
}
|
|
61
|
+
function renderBelowField(error, description) {
|
|
62
|
+
if (error != null) {
|
|
63
|
+
return typeof error === "string" ? (_jsx(HelperText, { message: error, status: "critical" })) : (error);
|
|
64
|
+
}
|
|
65
|
+
if (description != null) {
|
|
66
|
+
return typeof description === "string" ? (_jsx(HelperText, { message: description, status: "neutral" })) : (description);
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { SelectPrimitiveContentProps } from "../../primitives/Select/index.js";
|
|
3
|
+
export type SelectContentProps = SelectPrimitiveContentProps;
|
|
4
|
+
/**
|
|
5
|
+
* Folds the primitive Portal / Overlay / Content / Viewport into one dropdown
|
|
6
|
+
* part. Positioning lives in the primitive `Content`; props pass through.
|
|
7
|
+
*/
|
|
8
|
+
export declare function SelectContent({ children, ...props }: SelectContentProps): ReactElement;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Platform, StyleSheet, useWindowDimensions } from "react-native";
|
|
4
|
+
import { GestureHandlerRootView, ScrollView, } from "react-native-gesture-handler";
|
|
5
|
+
import { FullWindowOverlay } from "react-native-screens";
|
|
6
|
+
import { SelectPrimitive } from "../../primitives/Select/index.js";
|
|
7
|
+
/**
|
|
8
|
+
* iOS: draw the dropdown in a top-level window so it sits above native-stack
|
|
9
|
+
* modals the app-root host can't reach. GestureHandlerRootView restores gestures
|
|
10
|
+
* there so the inner ScrollView scrolls. Passthrough elsewhere.
|
|
11
|
+
*/
|
|
12
|
+
function ModalSafeOverlay({ children }) {
|
|
13
|
+
if (Platform.OS !== "ios") {
|
|
14
|
+
return _jsx(_Fragment, { children: children });
|
|
15
|
+
}
|
|
16
|
+
return (_jsx(FullWindowOverlay, { children: _jsx(GestureHandlerRootView, { style: styles.overlayRoot, children: children }) }));
|
|
17
|
+
}
|
|
18
|
+
// Cap the dropdown height (rn-primitives positions it but never caps it) so long
|
|
19
|
+
// lists scroll; a window fraction adapts across devices.
|
|
20
|
+
const MAX_HEIGHT_RATIO = 0.55;
|
|
21
|
+
/**
|
|
22
|
+
* Folds the primitive Portal / Overlay / Content / Viewport into one dropdown
|
|
23
|
+
* part. Positioning lives in the primitive `Content`; props pass through.
|
|
24
|
+
*/
|
|
25
|
+
export function SelectContent({ children, ...props }) {
|
|
26
|
+
const { height } = useWindowDimensions();
|
|
27
|
+
const maxHeight = Math.round(height * MAX_HEIGHT_RATIO);
|
|
28
|
+
return (_jsx(SelectPrimitive.Portal, { children: _jsx(ModalSafeOverlay, { children: _jsx(SelectPrimitive.Overlay, { children: _jsx(SelectPrimitive.Content, { ...props, children: _jsx(SelectPrimitive.Viewport, { children: _jsx(ScrollView, { style: { maxHeight }, bounces: false, keyboardShouldPersistTaps: "handled", children: children }) }) }) }) }) }));
|
|
29
|
+
}
|
|
30
|
+
const styles = StyleSheet.create({
|
|
31
|
+
overlayRoot: {
|
|
32
|
+
flex: 1,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SelectInternalPickerProps } from "../../types.js";
|
|
3
|
+
type SelectDefaultPickerProps = SelectInternalPickerProps;
|
|
4
|
+
export declare function SelectDefaultPicker({ children, options, disabled, onChange, }: SelectDefaultPickerProps): React.JSX.Element;
|
|
5
|
+
export {};
|
package/dist/foundationText/Select/components/SelectDefaultPicker/SelectDefaultPicker.ios.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SelectInternalPickerProps } from "../../types.js";
|
|
3
|
+
type SelectDefaultPickerProps = SelectInternalPickerProps;
|
|
4
|
+
export declare function SelectDefaultPicker({ children, options, onChange, }: SelectDefaultPickerProps): React.JSX.Element;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
import {
|
|
4
|
+
// Need to use iOS style button
|
|
5
|
+
Button, Modal, TouchableOpacity, View, } from "react-native";
|
|
6
|
+
import { Picker } from "@react-native-picker/picker";
|
|
7
|
+
import { SafeAreaView } from "react-native-safe-area-context";
|
|
8
|
+
import { styles } from "./SelectDefaultPicker.style.js";
|
|
9
|
+
import { SelectPressable } from "../SelectPressable/SelectPressable.js";
|
|
10
|
+
import { useComponentMessages } from "../../../foundationMessages.js";
|
|
11
|
+
export function SelectDefaultPicker({ children, options, onChange, }) {
|
|
12
|
+
const [show, setShow] = useState(false);
|
|
13
|
+
const { t } = useComponentMessages();
|
|
14
|
+
const selectedLanguage = options.find(option => option.isActive);
|
|
15
|
+
return (_jsxs(_Fragment, { children: [_jsx(SelectPressable, { onPress: showPicker, children: children }), _jsxs(Modal, { visible: show, transparent: true, animationType: "slide", onRequestClose: hidePicker, children: [_jsx(TouchableOpacity, { style: styles.overlay, onPress: hidePicker }), _jsx(View, { style: styles.actionBar, children: _jsx(Button, { title: t("done"), onPress: hidePicker }) }), _jsx(View, { style: styles.pickerContainer, testID: "select-wheel-picker", children: _jsx(SafeAreaView, { edges: ["bottom"], children: _jsx(Picker, { ...(selectedLanguage?.value !== undefined && { selectedValue: selectedLanguage?.value }), onValueChange: onChange, children: options.map(({ label, value }, i) => (_jsx(Picker.Item, { label: label, value: value }, i))) }) }) })] })] }));
|
|
16
|
+
function showPicker() {
|
|
17
|
+
setShow(true);
|
|
18
|
+
}
|
|
19
|
+
function hidePicker() {
|
|
20
|
+
setShow(false);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useRef } from "react";
|
|
3
|
+
import { Picker } from "@react-native-picker/picker";
|
|
4
|
+
import { styles } from "./SelectDefaultPicker.style.js";
|
|
5
|
+
import { SelectPressable } from "../SelectPressable/index.js";
|
|
6
|
+
import { useLegacyTheme } from "../../../compatTheme.js";
|
|
7
|
+
export function SelectDefaultPicker({ children, options, disabled, onChange, }) {
|
|
8
|
+
const selectedItem = options.find(option => option.isActive);
|
|
9
|
+
const pickerRef = useRef(null);
|
|
10
|
+
const { tokens } = useLegacyTheme();
|
|
11
|
+
return (_jsxs(SelectPressable, { onPress: pickerRef.current?.focus, children: [children, _jsx(Picker, { ref: pickerRef, ...(selectedItem?.value !== undefined && { selectedValue: selectedItem?.value }), onValueChange: onChange, mode: "dropdown", enabled: !disabled, style: styles.androidPickerContainer, children: options.map(({ label, value, isActive }, i) => (_jsx(Picker.Item, { label: label, value: value, color: isSelected(isActive) }, i))) })] }));
|
|
12
|
+
function isSelected(isActive) {
|
|
13
|
+
return isActive ? tokens["color-interactive"] : tokens["color-text"];
|
|
14
|
+
}
|
|
15
|
+
}
|
package/dist/foundationText/Select/components/SelectDefaultPicker/SelectDefaultPicker.style.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const styles: {
|
|
2
|
+
overlay: {
|
|
3
|
+
flex: number;
|
|
4
|
+
};
|
|
5
|
+
actionBar: {
|
|
6
|
+
flexDirection: "row";
|
|
7
|
+
height: number;
|
|
8
|
+
justifyContent: "flex-end";
|
|
9
|
+
alignItems: "center";
|
|
10
|
+
paddingHorizontal: number;
|
|
11
|
+
backgroundColor: string;
|
|
12
|
+
borderTopWidth: number;
|
|
13
|
+
borderTopColor: string;
|
|
14
|
+
zIndex: number;
|
|
15
|
+
};
|
|
16
|
+
pickerContainer: {
|
|
17
|
+
justifyContent: "center";
|
|
18
|
+
backgroundColor: string;
|
|
19
|
+
};
|
|
20
|
+
androidPickerContainer: {
|
|
21
|
+
position: "absolute";
|
|
22
|
+
top: number;
|
|
23
|
+
left: number;
|
|
24
|
+
width: "100%";
|
|
25
|
+
height: "100%";
|
|
26
|
+
color: string;
|
|
27
|
+
backgroundColor: string;
|
|
28
|
+
opacity: number;
|
|
29
|
+
};
|
|
30
|
+
};
|
package/dist/foundationText/Select/components/SelectDefaultPicker/SelectDefaultPicker.style.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
export const styles = StyleSheet.create({
|
|
3
|
+
overlay: { flex: 1 },
|
|
4
|
+
actionBar: {
|
|
5
|
+
flexDirection: "row",
|
|
6
|
+
height: 45,
|
|
7
|
+
justifyContent: "flex-end",
|
|
8
|
+
alignItems: "center",
|
|
9
|
+
paddingHorizontal: 10,
|
|
10
|
+
backgroundColor: "#f8f8f8",
|
|
11
|
+
borderTopWidth: 1,
|
|
12
|
+
borderTopColor: "#dedede",
|
|
13
|
+
zIndex: 2,
|
|
14
|
+
},
|
|
15
|
+
pickerContainer: {
|
|
16
|
+
justifyContent: "center",
|
|
17
|
+
backgroundColor: "#d0d4da",
|
|
18
|
+
},
|
|
19
|
+
androidPickerContainer: {
|
|
20
|
+
position: "absolute",
|
|
21
|
+
top: 0,
|
|
22
|
+
left: 0,
|
|
23
|
+
width: "100%",
|
|
24
|
+
height: "100%",
|
|
25
|
+
color: "transparent",
|
|
26
|
+
backgroundColor: "transparent",
|
|
27
|
+
opacity: 0,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./SelectDefaultPicker.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./SelectDefaultPicker.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/** Where the field label renders relative to the trigger. */
|
|
3
|
+
export type LabelPlacement = "above" | "inside";
|
|
4
|
+
/**
|
|
5
|
+
* Sugar-owned field state, provided by `Select.Root` and read by the sugar parts
|
|
6
|
+
* (`Select.Trigger`, `Select.Label`). `Select.Label` registers its content here
|
|
7
|
+
* (rather than rendering in place); `Select.Root` / `Select.Trigger` render it in
|
|
8
|
+
* the slot `labelPlacement` selects. See `Select.guide.md` for the model.
|
|
9
|
+
*/
|
|
10
|
+
export interface SelectFieldState {
|
|
11
|
+
/** Chosen label placement — above the trigger or inside it. */
|
|
12
|
+
readonly labelPlacement: LabelPlacement;
|
|
13
|
+
/** The label content to render — the registered `Select.Label` children. */
|
|
14
|
+
readonly labelContent?: ReactNode;
|
|
15
|
+
/** Resolved accessible name applied to the trigger. */
|
|
16
|
+
readonly accessibilityLabel?: string;
|
|
17
|
+
/** Resolved critical state (from `invalid` / `status` / `error`). */
|
|
18
|
+
readonly invalid?: boolean;
|
|
19
|
+
/** Render the trigger as a static, non-pressable read-only display. */
|
|
20
|
+
readonly readOnly?: boolean;
|
|
21
|
+
/** Register the label content (+ its accessible name, when it is a string). */
|
|
22
|
+
registerLabel(content: ReactNode, accessibleName?: string): void;
|
|
23
|
+
/** Clear a previously registered label (on `Select.Label` unmount). */
|
|
24
|
+
unregisterLabel(): void;
|
|
25
|
+
}
|
|
26
|
+
export declare const SelectFieldContext: import("react").Context<SelectFieldState>;
|
|
27
|
+
export declare function useSelectFieldState(): SelectFieldState;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
const noop = () => undefined;
|
|
3
|
+
export const SelectFieldContext = createContext({
|
|
4
|
+
labelPlacement: "inside",
|
|
5
|
+
registerLabel: noop,
|
|
6
|
+
unregisterLabel: noop,
|
|
7
|
+
});
|
|
8
|
+
export function useSelectFieldState() {
|
|
9
|
+
return useContext(SelectFieldContext);
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HostComponent } from "react-native";
|
|
2
|
+
import type { SelectInternalPickerProps, SelectOnOptionPressEvent } from "../../types.js";
|
|
3
|
+
interface NativeSelectIOSPickerProps extends Pick<SelectInternalPickerProps, "options" | "children"> {
|
|
4
|
+
/**
|
|
5
|
+
* Callback when one of the option is pressed
|
|
6
|
+
*/
|
|
7
|
+
readonly onOptionPress: (event: SelectOnOptionPressEvent) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const SelectIOSPicker: HostComponent<NativeSelectIOSPickerProps>;
|
|
10
|
+
export {};
|