pytech-ui 1.0.30 → 1.0.32
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 -21
- package/README.md +40 -40
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
- package/android/.gradle/nb-cache/trust/8732A504261C070E1F639E78DF65F8E6DC6FFC865B3D7178A7609BB57105805F +1 -1
- package/android/build.gradle +48 -47
- package/android/src/main/AndroidManifest.xml +2 -2
- package/android/src/main/java/expo/modules/pytechui/Dialog.kt +39 -39
- package/android/src/main/java/expo/modules/pytechui/ForEach/ForEachRecords.kt +23 -23
- package/android/src/main/java/expo/modules/pytechui/ForEach/index.kt +82 -82
- package/android/src/main/java/expo/modules/pytechui/Gradient/GradientView.kt +124 -124
- package/android/src/main/java/expo/modules/pytechui/Icon/index.kt +36 -36
- package/android/src/main/java/expo/modules/pytechui/Icon/utils.kt +42 -42
- package/android/src/main/java/expo/modules/pytechui/ListItem/Data/ListItemDataRecords.kt +84 -84
- package/android/src/main/java/expo/modules/pytechui/ListItem/Data/ListItemFromData.kt +127 -127
- package/android/src/main/java/expo/modules/pytechui/ListItem/Slots/ListItemFromSlots.kt +60 -60
- package/android/src/main/java/expo/modules/pytechui/ListItem/Slots/types.kt +42 -42
- package/android/src/main/java/expo/modules/pytechui/ListItem/_shared/Decorator/Decorator.kt +79 -79
- package/android/src/main/java/expo/modules/pytechui/ListItem/_shared/Decorator/Divider.kt +36 -36
- package/android/src/main/java/expo/modules/pytechui/ListItem/_shared/Decorator/utilsDecorator.kt +19 -19
- package/android/src/main/java/expo/modules/pytechui/ListItem/_shared/Dynamic/Dynamic.kt +163 -163
- package/android/src/main/java/expo/modules/pytechui/ListItem/_shared/Dynamic/Row.kt +136 -136
- package/android/src/main/java/expo/modules/pytechui/Navigation/NavigationWrapperView.kt +80 -0
- package/android/src/main/java/expo/modules/pytechui/PytechUiModifiers.kt +93 -93
- package/android/src/main/java/expo/modules/pytechui/PytechUiModule.kt +186 -168
- package/android/src/main/java/expo/modules/pytechui/SearchBar.kt +213 -213
- package/android/src/main/java/expo/modules/pytechui/Section/SectionHost.kt +81 -81
- package/android/src/main/java/expo/modules/pytechui/Section/SectionHostView.kt +65 -65
- package/android/src/main/java/expo/modules/pytechui/TextField.kt +251 -251
- package/android/src/main/java/expo/modules/pytechui/TypographySlot/TypographySlotBridge.kt +120 -120
- package/android/src/main/java/expo/modules/pytechui/TypographySlot/constants.kt +47 -47
- package/android/src/main/java/expo/modules/pytechui/extended-theme/ExtendedThemeView.kt +19 -19
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Colors/ExtendedColorBridge.kt +76 -76
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Constants/Constants.kt +10 -10
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/AppBarLargeFlexibleTokens.kt +20 -20
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/AppBarLargeTokens.kt +19 -19
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/AppBarMediumFlexibleTokens.kt +20 -20
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/AppBarMediumTokens.kt +19 -19
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/AppBarSmallTokens.kt +19 -19
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/AppBarTokens.kt +23 -23
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/AssistChipTokens.kt +25 -25
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/BadgeTokens.kt +20 -20
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/BaselineButtonTokens.kt +26 -26
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/BottomAppBarTokens.kt +19 -19
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/ButtonGroupSmallTokens.kt +20 -20
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/ButtonLargeTokens.kt +24 -24
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/ButtonMediumTokens.kt +24 -24
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/ButtonSmallTokens.kt +24 -24
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/ButtonXLargeTokens.kt +24 -24
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/ButtonXSmallTokens.kt +24 -24
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/CheckboxTokens.kt +35 -35
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/CircularProgressIndicatorTokens.kt +25 -25
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/ConnectedButtonGroupSmallTokens.kt +21 -21
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/DateInputModalTokens.kt +22 -22
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/DatePickerModalTokens.kt +33 -33
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/DialogTokens.kt +19 -19
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/DividerTokens.kt +19 -19
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/DockedToolbarTokens.kt +23 -23
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/DragHandleTokens.kt +25 -25
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/ElevatedButtonTokens.kt +19 -19
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/ElevatedCardTokens.kt +20 -20
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/ElevationTokens.kt +24 -24
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/ExpressiveMotionTokens.kt +28 -28
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/ExtendedFabLargeTokens.kt +23 -23
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/ExtendedFabMediumTokens.kt +24 -24
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/ExtendedFabPrimaryTokens.kt +20 -20
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/ExtendedFabSmallTokens.kt +23 -23
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/FabBaselineTokens.kt +21 -21
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/FabLargeTokens.kt +21 -21
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/FabMediumTokens.kt +22 -22
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/FabMenuBaselineTokens.kt +28 -28
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/FabSmallTokens.kt +21 -21
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/FilledAutocompleteTokens.kt +31 -31
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/FilledButtonTokens.kt +19 -19
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/FilledCardTokens.kt +20 -20
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/FilledIconButtonTokens.kt +18 -18
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/FilledTextFieldTokens.kt +31 -31
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/FilledTonalButtonTokens.kt +23 -23
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/FilledTonalIconButtonTokens.kt +18 -18
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/FilterChipTokens.kt +28 -28
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/FloatingToolbarTokens.kt +23 -23
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/IconButtonTokens.kt +17 -17
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/InputChipTokens.kt +30 -30
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/LargeIconButtonTokens.kt +27 -27
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/LinearProgressIndicatorTokens.kt +28 -28
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/ListTokens.kt +57 -57
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/LoadingIndicatorTokens.kt +21 -21
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/MediumIconButtonTokens.kt +27 -27
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/MotionTokens.kt +44 -44
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/NavigationBarHorizontalItemTokens.kt +22 -22
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/NavigationBarTokens.kt +23 -23
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/NavigationBarVerticalItemTokens.kt +22 -22
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/NavigationDrawerTokens.kt +23 -23
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/NavigationRailBaselineItemTokens.kt +25 -25
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/NavigationRailCollapsedTokens.kt +23 -23
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/NavigationRailExpandedTokens.kt +22 -22
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/NavigationRailHorizontalItemTokens.kt +24 -24
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/NavigationRailVerticalItemTokens.kt +24 -24
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/OutlinedAutocompleteTokens.kt +30 -30
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/OutlinedButtonTokens.kt +19 -19
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/OutlinedCardTokens.kt +21 -21
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/OutlinedIconButtonTokens.kt +18 -18
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/OutlinedSegmentedButtonTokens.kt +24 -24
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/OutlinedTextFieldTokens.kt +31 -31
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/PrimaryNavigationTabTokens.kt +24 -24
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/RadioButtonTokens.kt +22 -22
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/ScrimTokens.kt +17 -17
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/SearchBarTokens.kt +20 -20
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/SearchViewTokens.kt +20 -20
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/SecondaryNavigationTabTokens.kt +21 -21
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/SegmentedMenuTokens.kt +42 -42
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/ShapeTokens.kt +74 -74
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/SheetBottomTokens.kt +20 -20
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/SliderTokens.kt +39 -39
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/SmallIconButtonTokens.kt +27 -27
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/SnackbarTokens.kt +21 -21
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/SplitButtonLargeTokens.kt +26 -26
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/SplitButtonMediumTokens.kt +26 -26
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/SplitButtonSmallTokens.kt +26 -26
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/SplitButtonXLargeTokens.kt +26 -26
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/SplitButtonXSmallTokens.kt +27 -27
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/StandardMenuTokens.kt +25 -25
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/StandardMotionTokens.kt +27 -27
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/StateTokens.kt +20 -20
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/SuggestionChipTokens.kt +25 -25
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/SwitchTokens.kt +37 -37
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/TextButtonTokens.kt +18 -18
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/TimeInputTokens.kt +24 -24
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/TimePickerTokens.kt +30 -30
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/TonalButtonTokens.kt +19 -19
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/TypeScaleTokens.kt +72 -72
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/VibrantMenuTokens.kt +26 -26
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/XLargeIconButtonTokens.kt +27 -27
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/assets/XSmallIconButtonTokens.kt +27 -27
- package/android/src/main/java/expo/modules/pytechui/extended-theme/assets/Tokens/index.kt +216 -216
- package/android/src/main/java/expo/modules/pytechui/extended-theme/index.kt +38 -38
- package/android/src/main/java/expo/modules/pytechui/utils/children.kt +126 -126
- package/android/src/main/java/expo/modules/pytechui/utils/modifiers.kt +44 -44
- package/build/constants/utils.d.ts +1 -1
- package/build/contexts/alert/components/Alert/index.js +16 -16
- package/build/contexts/alert/components/Button/index.js +5 -5
- package/build/contexts/alert/components/Provider/index.ios.js +2 -2
- package/build/contexts/alert/components/Provider/index.js +3 -3
- package/build/contexts/alert/context/provider.d.ts +1 -1
- package/build/contexts/alert/context/provider.js +1 -1
- package/build/contexts/app/context.d.ts +1 -1
- package/build/contexts/app/context.js +15 -15
- package/build/contexts/app/index.d.ts +2 -2
- package/build/contexts/app/index.js +2 -2
- package/build/contexts/app/src/Head/index.d.ts +1 -1
- package/build/contexts/app/src/Head/index.web.js +12 -12
- package/build/contexts/app/src/Wrapper/index.d.ts +1 -1
- package/build/contexts/app/src/Wrapper/index.js +2 -2
- package/build/contexts/app/src/styles.css +16 -16
- package/build/contexts/app/types.d.ts +1 -1
- package/build/contexts/router/index.d.ts +1 -1
- package/build/contexts/router/index.js +3 -3
- package/build/jetpack-compose/components/Columns/CommonColumn/index.js +2 -2
- package/build/jetpack-compose/components/Columns/CommonColumn/types.d.ts +1 -1
- package/build/jetpack-compose/components/Columns/CommonColumn/utils.d.ts +1 -1
- package/build/jetpack-compose/components/Columns/CommonColumn/utils.js +1 -1
- package/build/jetpack-compose/components/DropdownMenu/index.d.ts +1 -1
- package/build/jetpack-compose/components/DropdownMenu/index.js +3 -3
- package/build/jetpack-compose/components/DropdownPicker/Picker.d.ts +3 -3
- package/build/jetpack-compose/components/DropdownPicker/Picker.js +24 -24
- package/build/jetpack-compose/components/DropdownPicker/PickerItem.js +5 -5
- package/build/jetpack-compose/components/DropdownPicker/context.d.ts +4 -10
- package/build/jetpack-compose/components/ForEach/src/ForEach.d.ts +1 -1
- package/build/jetpack-compose/components/ForEach/src/ForEach.js +5 -5
- package/build/jetpack-compose/components/ForEach/src/ListItem.d.ts +1 -1
- package/build/jetpack-compose/components/ForEach/src/types.d.ts +1 -1
- package/build/jetpack-compose/components/Gradient/Gradient.js +1 -1
- package/build/jetpack-compose/components/Gradient/types.d.ts +1 -1
- package/build/jetpack-compose/components/Host.d.ts +4 -3
- package/build/jetpack-compose/components/Host.js +6 -2
- package/build/jetpack-compose/components/Icon/Icon/Icon.js +1 -1
- package/build/jetpack-compose/components/Icon/index.d.ts +1 -1
- package/build/jetpack-compose/components/IconSection/IconSection.js +19 -19
- package/build/jetpack-compose/components/IconSection/types.d.ts +1 -1
- package/build/jetpack-compose/components/IconSection/utils.js +1 -1
- package/build/jetpack-compose/components/List/CommonColumn.js +3 -3
- package/build/jetpack-compose/components/List/index.d.ts +1 -1
- package/build/jetpack-compose/components/List/index.js +11 -11
- package/build/jetpack-compose/components/ListItem/SlotListItem.d.ts +2 -2
- package/build/jetpack-compose/components/ListItem/SlotListItem.js +9 -9
- package/build/jetpack-compose/components/Menu/src/components/Divider.js +2 -2
- package/build/jetpack-compose/components/Menu/src/components/Icon.d.ts +1 -1
- package/build/jetpack-compose/components/Menu/src/components/Icon.js +1 -1
- package/build/jetpack-compose/components/Menu/src/components/Item.d.ts +2 -3
- package/build/jetpack-compose/components/Menu/src/components/Item.js +26 -26
- package/build/jetpack-compose/components/Menu/src/components/Label.d.ts +4 -1
- package/build/jetpack-compose/components/Menu/src/components/Label.js +3 -3
- package/build/jetpack-compose/components/Menu/src/components/Menu.d.ts +2 -2
- package/build/jetpack-compose/components/Menu/src/components/Menu.js +26 -26
- package/build/jetpack-compose/components/Menu/src/components/Trigger.js +7 -7
- package/build/jetpack-compose/components/Menu/src/context.d.ts +8 -6
- package/build/jetpack-compose/components/Menu/src/utils.js +3 -3
- package/build/jetpack-compose/components/NavigationButton.d.ts +7 -0
- package/build/jetpack-compose/components/NavigationButton.js +16 -0
- package/build/jetpack-compose/components/NavigationWrapper.d.ts +10 -0
- package/build/jetpack-compose/components/NavigationWrapper.js +16 -0
- package/build/jetpack-compose/components/PagePicker/Item.js +11 -11
- package/build/jetpack-compose/components/PagePicker/Picker.js +5 -5
- package/build/jetpack-compose/components/PagePicker/context/index.d.ts +1 -1
- package/build/jetpack-compose/components/PagePicker/context/index.js +8 -8
- package/build/jetpack-compose/components/PullToRefreshBox.js +1 -1
- package/build/jetpack-compose/components/SearchBar.d.ts +1 -1
- package/build/jetpack-compose/components/SearchBar.js +1 -1
- package/build/jetpack-compose/components/Section/components/Column.d.ts +1 -1
- package/build/jetpack-compose/components/Section/components/Column.js +3 -3
- package/build/jetpack-compose/components/Section/components/Section.js +18 -18
- package/build/jetpack-compose/components/Section/components/Slot.d.ts +1 -1
- package/build/jetpack-compose/components/Section/components/Slot.js +3 -3
- package/build/jetpack-compose/components/SectionHost/index.d.ts +1 -1
- package/build/jetpack-compose/components/SectionHost/index.js +3 -3
- package/build/jetpack-compose/components/TextField.d.ts +1 -1
- package/build/jetpack-compose/components/TextField.js +1 -1
- package/build/jetpack-compose/components/TextSlot.js +2 -3
- package/build/jetpack-compose/extended-theme/assets/Colors/index.js +2 -2
- package/build/jetpack-compose/index.d.ts +2 -0
- package/build/jetpack-compose/index.js +2 -0
- package/build/jetpack-compose/modifiers/flexWeight.d.ts +1 -1
- package/build/jetpack-compose/modifiers/heightIn.d.ts +1 -1
- package/build/swift-ui/Image.js +2 -2
- package/build/swift-ui/ListItem.js +2 -2
- package/build/swift-ui/Slot.js +2 -2
- package/build/swift-ui/Text.js +2 -2
- package/build/universal/Column/index.android.js +2 -2
- package/build/universal/Column/index.ios.js +2 -2
- package/build/universal/Column/index.js +2 -2
- package/build/universal/Host/index.ios.js +2 -2
- package/build/universal/Row/index.android.js +2 -2
- package/build/universal/Row/index.ios.js +2 -2
- package/build/universal/Row/index.js +2 -2
- package/expo-module.config.json +11 -11
- package/ios/ChevronForwardView.swift +21 -21
- package/ios/GradientView.swift +40 -40
- package/ios/ImageView.swift +32 -32
- package/ios/ListItem.swift +161 -161
- package/ios/PytechUi.podspec +24 -24
- package/ios/PytechUiModule.swift +15 -15
- package/ios/SlotView.swift +107 -107
- package/ios/_shared/utils.swift +58 -58
- package/package.json +19 -15
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
package expo.modules.pytechui.section
|
|
2
|
-
|
|
3
|
-
import android.view.View
|
|
4
|
-
import android.view.ViewGroup
|
|
5
|
-
import androidx.compose.runtime.Composable
|
|
6
|
-
import androidx.compose.runtime.DisposableEffect
|
|
7
|
-
import androidx.compose.runtime.getValue
|
|
8
|
-
import androidx.compose.runtime.mutableIntStateOf
|
|
9
|
-
import androidx.compose.runtime.remember
|
|
10
|
-
import androidx.compose.runtime.setValue
|
|
11
|
-
import expo.modules.kotlin.views.ComposeProps
|
|
12
|
-
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
13
|
-
import expo.modules.pytechui.Children
|
|
14
|
-
import expo.modules.pytechui.getHost
|
|
15
|
-
import expo.modules.ui.ModifierList
|
|
16
|
-
|
|
17
|
-
data class SectionHostProps(
|
|
18
|
-
val modifiers: ModifierList = emptyList(),
|
|
19
|
-
) : ComposeProps
|
|
20
|
-
|
|
21
|
-
@Composable
|
|
22
|
-
internal fun FunctionalComposableScope.SectionHostViewContent(
|
|
23
|
-
@Suppress("UNUSED_PARAMETER") props: SectionHostProps,
|
|
24
|
-
) {
|
|
25
|
-
val host = getHost() ?: return
|
|
26
|
-
val state = remember(host) {
|
|
27
|
-
SectionHostState().also { host.tag = it }
|
|
28
|
-
}
|
|
29
|
-
var childGeneration by remember(host) { mutableIntStateOf(host.childCount) }
|
|
30
|
-
|
|
31
|
-
DisposableEffect(host) {
|
|
32
|
-
fun syncPositions() {
|
|
33
|
-
val count = host.childCount
|
|
34
|
-
if (childGeneration != count) {
|
|
35
|
-
childGeneration = count
|
|
36
|
-
}
|
|
37
|
-
state.update(host.collectListItemViewsDeep())
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
syncPositions()
|
|
41
|
-
|
|
42
|
-
val hierarchyListener = object : ViewGroup.OnHierarchyChangeListener {
|
|
43
|
-
override fun onChildViewAdded(parent: View?, child: View?) = syncPositions()
|
|
44
|
-
override fun onChildViewRemoved(parent: View?, child: View?) = syncPositions()
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
val layoutListener = View.OnLayoutChangeListener { _, _, _, _, _, _, _, _, _ ->
|
|
48
|
-
syncPositions()
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
host.setOnHierarchyChangeListener(hierarchyListener)
|
|
52
|
-
host.addOnLayoutChangeListener(layoutListener)
|
|
53
|
-
|
|
54
|
-
onDispose {
|
|
55
|
-
host.setOnHierarchyChangeListener(null)
|
|
56
|
-
host.removeOnLayoutChangeListener(layoutListener)
|
|
57
|
-
host.tag = null
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@Suppress("UNUSED_VARIABLE")
|
|
62
|
-
val generation = state.generation.intValue
|
|
63
|
-
|
|
64
|
-
Children()
|
|
65
|
-
}
|
|
1
|
+
package expo.modules.pytechui.section
|
|
2
|
+
|
|
3
|
+
import android.view.View
|
|
4
|
+
import android.view.ViewGroup
|
|
5
|
+
import androidx.compose.runtime.Composable
|
|
6
|
+
import androidx.compose.runtime.DisposableEffect
|
|
7
|
+
import androidx.compose.runtime.getValue
|
|
8
|
+
import androidx.compose.runtime.mutableIntStateOf
|
|
9
|
+
import androidx.compose.runtime.remember
|
|
10
|
+
import androidx.compose.runtime.setValue
|
|
11
|
+
import expo.modules.kotlin.views.ComposeProps
|
|
12
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
13
|
+
import expo.modules.pytechui.Children
|
|
14
|
+
import expo.modules.pytechui.getHost
|
|
15
|
+
import expo.modules.ui.ModifierList
|
|
16
|
+
|
|
17
|
+
data class SectionHostProps(
|
|
18
|
+
val modifiers: ModifierList = emptyList(),
|
|
19
|
+
) : ComposeProps
|
|
20
|
+
|
|
21
|
+
@Composable
|
|
22
|
+
internal fun FunctionalComposableScope.SectionHostViewContent(
|
|
23
|
+
@Suppress("UNUSED_PARAMETER") props: SectionHostProps,
|
|
24
|
+
) {
|
|
25
|
+
val host = getHost() ?: return
|
|
26
|
+
val state = remember(host) {
|
|
27
|
+
SectionHostState().also { host.tag = it }
|
|
28
|
+
}
|
|
29
|
+
var childGeneration by remember(host) { mutableIntStateOf(host.childCount) }
|
|
30
|
+
|
|
31
|
+
DisposableEffect(host) {
|
|
32
|
+
fun syncPositions() {
|
|
33
|
+
val count = host.childCount
|
|
34
|
+
if (childGeneration != count) {
|
|
35
|
+
childGeneration = count
|
|
36
|
+
}
|
|
37
|
+
state.update(host.collectListItemViewsDeep())
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
syncPositions()
|
|
41
|
+
|
|
42
|
+
val hierarchyListener = object : ViewGroup.OnHierarchyChangeListener {
|
|
43
|
+
override fun onChildViewAdded(parent: View?, child: View?) = syncPositions()
|
|
44
|
+
override fun onChildViewRemoved(parent: View?, child: View?) = syncPositions()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
val layoutListener = View.OnLayoutChangeListener { _, _, _, _, _, _, _, _, _ ->
|
|
48
|
+
syncPositions()
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
host.setOnHierarchyChangeListener(hierarchyListener)
|
|
52
|
+
host.addOnLayoutChangeListener(layoutListener)
|
|
53
|
+
|
|
54
|
+
onDispose {
|
|
55
|
+
host.setOnHierarchyChangeListener(null)
|
|
56
|
+
host.removeOnLayoutChangeListener(layoutListener)
|
|
57
|
+
host.tag = null
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@Suppress("UNUSED_VARIABLE")
|
|
62
|
+
val generation = state.generation.intValue
|
|
63
|
+
|
|
64
|
+
Children()
|
|
65
|
+
}
|
|
@@ -1,251 +1,251 @@
|
|
|
1
|
-
package expo.modules.pytechui
|
|
2
|
-
|
|
3
|
-
import androidx.compose.foundation.layout.Arrangement
|
|
4
|
-
import androidx.compose.foundation.layout.Box
|
|
5
|
-
import androidx.compose.foundation.layout.Row
|
|
6
|
-
import androidx.compose.foundation.layout.fillMaxWidth
|
|
7
|
-
import androidx.compose.foundation.layout.height
|
|
8
|
-
import androidx.compose.foundation.text.BasicTextField
|
|
9
|
-
import androidx.compose.foundation.text.KeyboardActions
|
|
10
|
-
import androidx.compose.foundation.text.KeyboardOptions
|
|
11
|
-
import androidx.compose.material3.LocalTextStyle
|
|
12
|
-
import androidx.compose.material3.Text
|
|
13
|
-
import androidx.compose.runtime.Composable
|
|
14
|
-
import androidx.compose.runtime.LaunchedEffect
|
|
15
|
-
import androidx.compose.runtime.getValue
|
|
16
|
-
import androidx.compose.runtime.mutableStateOf
|
|
17
|
-
import androidx.compose.runtime.remember
|
|
18
|
-
import androidx.compose.runtime.setValue
|
|
19
|
-
import androidx.compose.ui.Alignment
|
|
20
|
-
import androidx.compose.ui.Modifier
|
|
21
|
-
import androidx.compose.ui.focus.FocusDirection
|
|
22
|
-
import androidx.compose.ui.focus.FocusManager
|
|
23
|
-
import androidx.compose.ui.focus.FocusRequester
|
|
24
|
-
import androidx.compose.ui.focus.focusRequester
|
|
25
|
-
import androidx.compose.ui.focus.onFocusChanged
|
|
26
|
-
import androidx.compose.ui.graphics.SolidColor
|
|
27
|
-
import androidx.compose.ui.platform.LocalFocusManager
|
|
28
|
-
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
|
29
|
-
import androidx.compose.ui.text.input.ImeAction
|
|
30
|
-
import androidx.compose.ui.text.input.KeyboardCapitalization
|
|
31
|
-
import androidx.compose.ui.text.input.KeyboardType
|
|
32
|
-
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
|
33
|
-
import androidx.compose.ui.text.input.VisualTransformation
|
|
34
|
-
import expo.modules.kotlin.records.Field
|
|
35
|
-
import expo.modules.kotlin.records.Record
|
|
36
|
-
import expo.modules.kotlin.types.OptimizedRecord
|
|
37
|
-
import expo.modules.kotlin.views.AsyncFunctionHandle
|
|
38
|
-
import expo.modules.kotlin.views.ComposeProps
|
|
39
|
-
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
40
|
-
import expo.modules.pytechui.theme.ExtendedTheme
|
|
41
|
-
import expo.modules.ui.ModifierList
|
|
42
|
-
import java.io.Serializable
|
|
43
|
-
import androidx.compose.foundation.relocation.BringIntoViewRequester
|
|
44
|
-
import androidx.compose.foundation.relocation.bringIntoViewRequester
|
|
45
|
-
import androidx.compose.runtime.rememberCoroutineScope
|
|
46
|
-
import androidx.compose.ui.focus.onFocusEvent
|
|
47
|
-
import kotlinx.coroutines.delay
|
|
48
|
-
import kotlinx.coroutines.launch
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
data class TextFieldValueChangeEvent(
|
|
52
|
-
@Field val value: String = ""
|
|
53
|
-
) : Record, Serializable
|
|
54
|
-
|
|
55
|
-
data class TextFieldFocusChangeEvent(
|
|
56
|
-
@Field val value: Boolean = false
|
|
57
|
-
) : Record, Serializable
|
|
58
|
-
|
|
59
|
-
@OptimizedRecord
|
|
60
|
-
data class TextFieldKeyboardOptionsRecord(
|
|
61
|
-
@Field val capitalization: String? = null,
|
|
62
|
-
@Field val autoCorrectEnabled: Boolean? = null,
|
|
63
|
-
@Field val keyboardType: String? = null,
|
|
64
|
-
@Field val imeAction: String? = null
|
|
65
|
-
) : Record
|
|
66
|
-
|
|
67
|
-
data class KeyboardActionEvent(
|
|
68
|
-
@Field val action: String,
|
|
69
|
-
@Field val value: String
|
|
70
|
-
) : Record
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* [value] es solo el valor inicial; el texto editado vive en estado interno.
|
|
74
|
-
* [headlineText] opcional: se muestra a la izquierda del campo (misma fila que el input).
|
|
75
|
-
*/
|
|
76
|
-
data class TextFieldProps(
|
|
77
|
-
val value: String = "",
|
|
78
|
-
val placeholder: String? = null,
|
|
79
|
-
val headlineText: String? = null,
|
|
80
|
-
val enabled: Boolean = true,
|
|
81
|
-
val autoFocus: Boolean = false,
|
|
82
|
-
val lines: Int = 1,
|
|
83
|
-
val keyboardOptions: TextFieldKeyboardOptionsRecord? = null,
|
|
84
|
-
val rowModifiers: ModifierList = emptyList(),
|
|
85
|
-
val textFieldModifiers: ModifierList = emptyList()
|
|
86
|
-
) : ComposeProps
|
|
87
|
-
|
|
88
|
-
private fun String?.toKeyboardType(): KeyboardType = when (this) {
|
|
89
|
-
"text" -> KeyboardType.Text
|
|
90
|
-
"number" -> KeyboardType.Number
|
|
91
|
-
"email" -> KeyboardType.Email
|
|
92
|
-
"phone" -> KeyboardType.Phone
|
|
93
|
-
"decimal" -> KeyboardType.Decimal
|
|
94
|
-
"password" -> KeyboardType.Password
|
|
95
|
-
"ascii" -> KeyboardType.Ascii
|
|
96
|
-
"uri" -> KeyboardType.Uri
|
|
97
|
-
"numberPassword" -> KeyboardType.NumberPassword
|
|
98
|
-
else -> KeyboardType.Text
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
private fun String?.toCapitalization(): KeyboardCapitalization = when (this) {
|
|
102
|
-
"characters" -> KeyboardCapitalization.Characters
|
|
103
|
-
"none" -> KeyboardCapitalization.None
|
|
104
|
-
"sentences" -> KeyboardCapitalization.Sentences
|
|
105
|
-
"words" -> KeyboardCapitalization.Words
|
|
106
|
-
else -> KeyboardCapitalization.None
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
private fun String?.toImeAction(): ImeAction = when (this) {
|
|
110
|
-
"default" -> ImeAction.Default
|
|
111
|
-
"none" -> ImeAction.None
|
|
112
|
-
"go" -> ImeAction.Go
|
|
113
|
-
"search" -> ImeAction.Search
|
|
114
|
-
"send" -> ImeAction.Send
|
|
115
|
-
"previous" -> ImeAction.Previous
|
|
116
|
-
"next" -> ImeAction.Next
|
|
117
|
-
"done" -> ImeAction.Done
|
|
118
|
-
else -> ImeAction.Default
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
private fun FocusManager.performDefaultKeyboardAction(imeAction: ImeAction) {
|
|
122
|
-
when (imeAction) {
|
|
123
|
-
ImeAction.Next -> clearFocus() //moveFocus(FocusDirection.Down)
|
|
124
|
-
ImeAction.Previous -> clearFocus() //moveFocus(FocusDirection.Up)
|
|
125
|
-
ImeAction.Done, ImeAction.Go, ImeAction.Search, ImeAction.Send -> clearFocus()
|
|
126
|
-
else -> Unit
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
data class ExampleComposeViewProps(
|
|
131
|
-
@Field val title: String = "",
|
|
132
|
-
@Field val modifiers: ModifierList = emptyList()
|
|
133
|
-
) : ComposeProps
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
@Composable
|
|
137
|
-
internal fun FunctionalComposableScope.TextFieldContent(
|
|
138
|
-
props: TextFieldProps,
|
|
139
|
-
focus: AsyncFunctionHandle<Unit>,
|
|
140
|
-
blur: AsyncFunctionHandle<Unit>,
|
|
141
|
-
onValueChange: (String) -> Unit,
|
|
142
|
-
onFocusChanged: (Boolean) -> Unit,
|
|
143
|
-
onKeyboardActionTriggered: (KeyboardActionEvent) -> Unit
|
|
144
|
-
) {
|
|
145
|
-
var text by remember { mutableStateOf(props.value) }
|
|
146
|
-
val focusManager = LocalFocusManager.current
|
|
147
|
-
val focusRequester = remember { FocusRequester() }
|
|
148
|
-
val keyboardController = LocalSoftwareKeyboardController.current
|
|
149
|
-
|
|
150
|
-
focus.handle {
|
|
151
|
-
focusRequester.requestFocus()
|
|
152
|
-
keyboardController?.show()
|
|
153
|
-
}
|
|
154
|
-
blur.handle {
|
|
155
|
-
focusManager.clearFocus()
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
if (props.autoFocus) {
|
|
159
|
-
LaunchedEffect(Unit) {
|
|
160
|
-
delay(300)
|
|
161
|
-
runCatching {
|
|
162
|
-
focusRequester.requestFocus()
|
|
163
|
-
keyboardController?.show()
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
val kbOpts = props.keyboardOptions
|
|
169
|
-
val keyboardTypeKey = kbOpts?.keyboardType
|
|
170
|
-
val visualTransformation =
|
|
171
|
-
if (keyboardTypeKey == "password" || keyboardTypeKey == "numberPassword") {
|
|
172
|
-
PasswordVisualTransformation()
|
|
173
|
-
} else {
|
|
174
|
-
VisualTransformation.None
|
|
175
|
-
}
|
|
176
|
-
val keyboardOptions = KeyboardOptions.Default.copy(
|
|
177
|
-
keyboardType = keyboardTypeKey.toKeyboardType(),
|
|
178
|
-
autoCorrectEnabled = kbOpts?.autoCorrectEnabled ?: true,
|
|
179
|
-
capitalization = kbOpts?.capitalization.toCapitalization(),
|
|
180
|
-
imeAction = kbOpts?.imeAction.toImeAction()
|
|
181
|
-
)
|
|
182
|
-
val currentText = { text }
|
|
183
|
-
val keyboardActions = KeyboardActions(
|
|
184
|
-
onDone = {
|
|
185
|
-
focusManager.performDefaultKeyboardAction(ImeAction.Done)
|
|
186
|
-
onKeyboardActionTriggered(KeyboardActionEvent("done", currentText()))
|
|
187
|
-
},
|
|
188
|
-
onGo = {
|
|
189
|
-
focusManager.performDefaultKeyboardAction(ImeAction.Go)
|
|
190
|
-
onKeyboardActionTriggered(KeyboardActionEvent("go", currentText()))
|
|
191
|
-
},
|
|
192
|
-
onNext = {
|
|
193
|
-
focusManager.performDefaultKeyboardAction(ImeAction.Next)
|
|
194
|
-
onKeyboardActionTriggered(KeyboardActionEvent("next", currentText()))
|
|
195
|
-
},
|
|
196
|
-
onPrevious = {
|
|
197
|
-
focusManager.performDefaultKeyboardAction(ImeAction.Previous)
|
|
198
|
-
onKeyboardActionTriggered(KeyboardActionEvent("previous", currentText()))
|
|
199
|
-
},
|
|
200
|
-
onSearch = {
|
|
201
|
-
focusManager.performDefaultKeyboardAction(ImeAction.Search)
|
|
202
|
-
onKeyboardActionTriggered(KeyboardActionEvent("search", currentText()))
|
|
203
|
-
},
|
|
204
|
-
onSend = {
|
|
205
|
-
focusManager.performDefaultKeyboardAction(ImeAction.Send)
|
|
206
|
-
onKeyboardActionTriggered(KeyboardActionEvent("send", currentText()))
|
|
207
|
-
},
|
|
208
|
-
)
|
|
209
|
-
|
|
210
|
-
val bringIntoViewRequester = remember { BringIntoViewRequester() }
|
|
211
|
-
val scope = rememberCoroutineScope()
|
|
212
|
-
|
|
213
|
-
BasicTextField(
|
|
214
|
-
value = text,
|
|
215
|
-
onValueChange = { newValue ->
|
|
216
|
-
text = newValue
|
|
217
|
-
onValueChange(newValue)
|
|
218
|
-
},
|
|
219
|
-
modifier = Modifier
|
|
220
|
-
.fillMaxWidth()
|
|
221
|
-
.focusRequester(focusRequester)
|
|
222
|
-
.onFocusChanged { onFocusChanged(it.isFocused) }
|
|
223
|
-
.bringIntoViewRequester(bringIntoViewRequester)
|
|
224
|
-
.onFocusChanged { focusState ->
|
|
225
|
-
onFocusChanged(focusState.isFocused)
|
|
226
|
-
if (focusState.isFocused) {
|
|
227
|
-
scope.launch {
|
|
228
|
-
kotlinx.coroutines.delay(100)
|
|
229
|
-
bringIntoViewRequester.bringIntoView()
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
|
-
enabled = props.enabled,
|
|
234
|
-
textStyle = LocalTextStyle.current,
|
|
235
|
-
singleLine = props.lines == 1,
|
|
236
|
-
maxLines = if (props.lines > 1) props.lines.coerceAtLeast(2) else Int.MAX_VALUE,
|
|
237
|
-
cursorBrush = SolidColor(ExtendedTheme.colorScheme.systemBlue),
|
|
238
|
-
keyboardOptions = keyboardOptions,
|
|
239
|
-
keyboardActions = keyboardActions,
|
|
240
|
-
visualTransformation = visualTransformation,
|
|
241
|
-
decorationBox = { innerTextField ->
|
|
242
|
-
if (text.isEmpty() && !props.placeholder.isNullOrBlank()) {
|
|
243
|
-
Text(
|
|
244
|
-
text = props.placeholder!!,
|
|
245
|
-
color = ExtendedTheme.colorScheme.placeholderText
|
|
246
|
-
)
|
|
247
|
-
}
|
|
248
|
-
innerTextField()
|
|
249
|
-
},
|
|
250
|
-
)
|
|
251
|
-
}
|
|
1
|
+
package expo.modules.pytechui
|
|
2
|
+
|
|
3
|
+
import androidx.compose.foundation.layout.Arrangement
|
|
4
|
+
import androidx.compose.foundation.layout.Box
|
|
5
|
+
import androidx.compose.foundation.layout.Row
|
|
6
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
7
|
+
import androidx.compose.foundation.layout.height
|
|
8
|
+
import androidx.compose.foundation.text.BasicTextField
|
|
9
|
+
import androidx.compose.foundation.text.KeyboardActions
|
|
10
|
+
import androidx.compose.foundation.text.KeyboardOptions
|
|
11
|
+
import androidx.compose.material3.LocalTextStyle
|
|
12
|
+
import androidx.compose.material3.Text
|
|
13
|
+
import androidx.compose.runtime.Composable
|
|
14
|
+
import androidx.compose.runtime.LaunchedEffect
|
|
15
|
+
import androidx.compose.runtime.getValue
|
|
16
|
+
import androidx.compose.runtime.mutableStateOf
|
|
17
|
+
import androidx.compose.runtime.remember
|
|
18
|
+
import androidx.compose.runtime.setValue
|
|
19
|
+
import androidx.compose.ui.Alignment
|
|
20
|
+
import androidx.compose.ui.Modifier
|
|
21
|
+
import androidx.compose.ui.focus.FocusDirection
|
|
22
|
+
import androidx.compose.ui.focus.FocusManager
|
|
23
|
+
import androidx.compose.ui.focus.FocusRequester
|
|
24
|
+
import androidx.compose.ui.focus.focusRequester
|
|
25
|
+
import androidx.compose.ui.focus.onFocusChanged
|
|
26
|
+
import androidx.compose.ui.graphics.SolidColor
|
|
27
|
+
import androidx.compose.ui.platform.LocalFocusManager
|
|
28
|
+
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
|
29
|
+
import androidx.compose.ui.text.input.ImeAction
|
|
30
|
+
import androidx.compose.ui.text.input.KeyboardCapitalization
|
|
31
|
+
import androidx.compose.ui.text.input.KeyboardType
|
|
32
|
+
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
|
33
|
+
import androidx.compose.ui.text.input.VisualTransformation
|
|
34
|
+
import expo.modules.kotlin.records.Field
|
|
35
|
+
import expo.modules.kotlin.records.Record
|
|
36
|
+
import expo.modules.kotlin.types.OptimizedRecord
|
|
37
|
+
import expo.modules.kotlin.views.AsyncFunctionHandle
|
|
38
|
+
import expo.modules.kotlin.views.ComposeProps
|
|
39
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
40
|
+
import expo.modules.pytechui.theme.ExtendedTheme
|
|
41
|
+
import expo.modules.ui.ModifierList
|
|
42
|
+
import java.io.Serializable
|
|
43
|
+
import androidx.compose.foundation.relocation.BringIntoViewRequester
|
|
44
|
+
import androidx.compose.foundation.relocation.bringIntoViewRequester
|
|
45
|
+
import androidx.compose.runtime.rememberCoroutineScope
|
|
46
|
+
import androidx.compose.ui.focus.onFocusEvent
|
|
47
|
+
import kotlinx.coroutines.delay
|
|
48
|
+
import kotlinx.coroutines.launch
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
data class TextFieldValueChangeEvent(
|
|
52
|
+
@Field val value: String = ""
|
|
53
|
+
) : Record, Serializable
|
|
54
|
+
|
|
55
|
+
data class TextFieldFocusChangeEvent(
|
|
56
|
+
@Field val value: Boolean = false
|
|
57
|
+
) : Record, Serializable
|
|
58
|
+
|
|
59
|
+
@OptimizedRecord
|
|
60
|
+
data class TextFieldKeyboardOptionsRecord(
|
|
61
|
+
@Field val capitalization: String? = null,
|
|
62
|
+
@Field val autoCorrectEnabled: Boolean? = null,
|
|
63
|
+
@Field val keyboardType: String? = null,
|
|
64
|
+
@Field val imeAction: String? = null
|
|
65
|
+
) : Record
|
|
66
|
+
|
|
67
|
+
data class KeyboardActionEvent(
|
|
68
|
+
@Field val action: String,
|
|
69
|
+
@Field val value: String
|
|
70
|
+
) : Record
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* [value] es solo el valor inicial; el texto editado vive en estado interno.
|
|
74
|
+
* [headlineText] opcional: se muestra a la izquierda del campo (misma fila que el input).
|
|
75
|
+
*/
|
|
76
|
+
data class TextFieldProps(
|
|
77
|
+
val value: String = "",
|
|
78
|
+
val placeholder: String? = null,
|
|
79
|
+
val headlineText: String? = null,
|
|
80
|
+
val enabled: Boolean = true,
|
|
81
|
+
val autoFocus: Boolean = false,
|
|
82
|
+
val lines: Int = 1,
|
|
83
|
+
val keyboardOptions: TextFieldKeyboardOptionsRecord? = null,
|
|
84
|
+
val rowModifiers: ModifierList = emptyList(),
|
|
85
|
+
val textFieldModifiers: ModifierList = emptyList()
|
|
86
|
+
) : ComposeProps
|
|
87
|
+
|
|
88
|
+
private fun String?.toKeyboardType(): KeyboardType = when (this) {
|
|
89
|
+
"text" -> KeyboardType.Text
|
|
90
|
+
"number" -> KeyboardType.Number
|
|
91
|
+
"email" -> KeyboardType.Email
|
|
92
|
+
"phone" -> KeyboardType.Phone
|
|
93
|
+
"decimal" -> KeyboardType.Decimal
|
|
94
|
+
"password" -> KeyboardType.Password
|
|
95
|
+
"ascii" -> KeyboardType.Ascii
|
|
96
|
+
"uri" -> KeyboardType.Uri
|
|
97
|
+
"numberPassword" -> KeyboardType.NumberPassword
|
|
98
|
+
else -> KeyboardType.Text
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
private fun String?.toCapitalization(): KeyboardCapitalization = when (this) {
|
|
102
|
+
"characters" -> KeyboardCapitalization.Characters
|
|
103
|
+
"none" -> KeyboardCapitalization.None
|
|
104
|
+
"sentences" -> KeyboardCapitalization.Sentences
|
|
105
|
+
"words" -> KeyboardCapitalization.Words
|
|
106
|
+
else -> KeyboardCapitalization.None
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private fun String?.toImeAction(): ImeAction = when (this) {
|
|
110
|
+
"default" -> ImeAction.Default
|
|
111
|
+
"none" -> ImeAction.None
|
|
112
|
+
"go" -> ImeAction.Go
|
|
113
|
+
"search" -> ImeAction.Search
|
|
114
|
+
"send" -> ImeAction.Send
|
|
115
|
+
"previous" -> ImeAction.Previous
|
|
116
|
+
"next" -> ImeAction.Next
|
|
117
|
+
"done" -> ImeAction.Done
|
|
118
|
+
else -> ImeAction.Default
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
private fun FocusManager.performDefaultKeyboardAction(imeAction: ImeAction) {
|
|
122
|
+
when (imeAction) {
|
|
123
|
+
ImeAction.Next -> clearFocus() //moveFocus(FocusDirection.Down)
|
|
124
|
+
ImeAction.Previous -> clearFocus() //moveFocus(FocusDirection.Up)
|
|
125
|
+
ImeAction.Done, ImeAction.Go, ImeAction.Search, ImeAction.Send -> clearFocus()
|
|
126
|
+
else -> Unit
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
data class ExampleComposeViewProps(
|
|
131
|
+
@Field val title: String = "",
|
|
132
|
+
@Field val modifiers: ModifierList = emptyList()
|
|
133
|
+
) : ComposeProps
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
@Composable
|
|
137
|
+
internal fun FunctionalComposableScope.TextFieldContent(
|
|
138
|
+
props: TextFieldProps,
|
|
139
|
+
focus: AsyncFunctionHandle<Unit>,
|
|
140
|
+
blur: AsyncFunctionHandle<Unit>,
|
|
141
|
+
onValueChange: (String) -> Unit,
|
|
142
|
+
onFocusChanged: (Boolean) -> Unit,
|
|
143
|
+
onKeyboardActionTriggered: (KeyboardActionEvent) -> Unit
|
|
144
|
+
) {
|
|
145
|
+
var text by remember { mutableStateOf(props.value) }
|
|
146
|
+
val focusManager = LocalFocusManager.current
|
|
147
|
+
val focusRequester = remember { FocusRequester() }
|
|
148
|
+
val keyboardController = LocalSoftwareKeyboardController.current
|
|
149
|
+
|
|
150
|
+
focus.handle {
|
|
151
|
+
focusRequester.requestFocus()
|
|
152
|
+
keyboardController?.show()
|
|
153
|
+
}
|
|
154
|
+
blur.handle {
|
|
155
|
+
focusManager.clearFocus()
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (props.autoFocus) {
|
|
159
|
+
LaunchedEffect(Unit) {
|
|
160
|
+
delay(300)
|
|
161
|
+
runCatching {
|
|
162
|
+
focusRequester.requestFocus()
|
|
163
|
+
keyboardController?.show()
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
val kbOpts = props.keyboardOptions
|
|
169
|
+
val keyboardTypeKey = kbOpts?.keyboardType
|
|
170
|
+
val visualTransformation =
|
|
171
|
+
if (keyboardTypeKey == "password" || keyboardTypeKey == "numberPassword") {
|
|
172
|
+
PasswordVisualTransformation()
|
|
173
|
+
} else {
|
|
174
|
+
VisualTransformation.None
|
|
175
|
+
}
|
|
176
|
+
val keyboardOptions = KeyboardOptions.Default.copy(
|
|
177
|
+
keyboardType = keyboardTypeKey.toKeyboardType(),
|
|
178
|
+
autoCorrectEnabled = kbOpts?.autoCorrectEnabled ?: true,
|
|
179
|
+
capitalization = kbOpts?.capitalization.toCapitalization(),
|
|
180
|
+
imeAction = kbOpts?.imeAction.toImeAction()
|
|
181
|
+
)
|
|
182
|
+
val currentText = { text }
|
|
183
|
+
val keyboardActions = KeyboardActions(
|
|
184
|
+
onDone = {
|
|
185
|
+
focusManager.performDefaultKeyboardAction(ImeAction.Done)
|
|
186
|
+
onKeyboardActionTriggered(KeyboardActionEvent("done", currentText()))
|
|
187
|
+
},
|
|
188
|
+
onGo = {
|
|
189
|
+
focusManager.performDefaultKeyboardAction(ImeAction.Go)
|
|
190
|
+
onKeyboardActionTriggered(KeyboardActionEvent("go", currentText()))
|
|
191
|
+
},
|
|
192
|
+
onNext = {
|
|
193
|
+
focusManager.performDefaultKeyboardAction(ImeAction.Next)
|
|
194
|
+
onKeyboardActionTriggered(KeyboardActionEvent("next", currentText()))
|
|
195
|
+
},
|
|
196
|
+
onPrevious = {
|
|
197
|
+
focusManager.performDefaultKeyboardAction(ImeAction.Previous)
|
|
198
|
+
onKeyboardActionTriggered(KeyboardActionEvent("previous", currentText()))
|
|
199
|
+
},
|
|
200
|
+
onSearch = {
|
|
201
|
+
focusManager.performDefaultKeyboardAction(ImeAction.Search)
|
|
202
|
+
onKeyboardActionTriggered(KeyboardActionEvent("search", currentText()))
|
|
203
|
+
},
|
|
204
|
+
onSend = {
|
|
205
|
+
focusManager.performDefaultKeyboardAction(ImeAction.Send)
|
|
206
|
+
onKeyboardActionTriggered(KeyboardActionEvent("send", currentText()))
|
|
207
|
+
},
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
val bringIntoViewRequester = remember { BringIntoViewRequester() }
|
|
211
|
+
val scope = rememberCoroutineScope()
|
|
212
|
+
|
|
213
|
+
BasicTextField(
|
|
214
|
+
value = text,
|
|
215
|
+
onValueChange = { newValue ->
|
|
216
|
+
text = newValue
|
|
217
|
+
onValueChange(newValue)
|
|
218
|
+
},
|
|
219
|
+
modifier = Modifier
|
|
220
|
+
.fillMaxWidth()
|
|
221
|
+
.focusRequester(focusRequester)
|
|
222
|
+
.onFocusChanged { onFocusChanged(it.isFocused) }
|
|
223
|
+
.bringIntoViewRequester(bringIntoViewRequester)
|
|
224
|
+
.onFocusChanged { focusState ->
|
|
225
|
+
onFocusChanged(focusState.isFocused)
|
|
226
|
+
if (focusState.isFocused) {
|
|
227
|
+
scope.launch {
|
|
228
|
+
kotlinx.coroutines.delay(100)
|
|
229
|
+
bringIntoViewRequester.bringIntoView()
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
enabled = props.enabled,
|
|
234
|
+
textStyle = LocalTextStyle.current,
|
|
235
|
+
singleLine = props.lines == 1,
|
|
236
|
+
maxLines = if (props.lines > 1) props.lines.coerceAtLeast(2) else Int.MAX_VALUE,
|
|
237
|
+
cursorBrush = SolidColor(ExtendedTheme.colorScheme.systemBlue),
|
|
238
|
+
keyboardOptions = keyboardOptions,
|
|
239
|
+
keyboardActions = keyboardActions,
|
|
240
|
+
visualTransformation = visualTransformation,
|
|
241
|
+
decorationBox = { innerTextField ->
|
|
242
|
+
if (text.isEmpty() && !props.placeholder.isNullOrBlank()) {
|
|
243
|
+
Text(
|
|
244
|
+
text = props.placeholder!!,
|
|
245
|
+
color = ExtendedTheme.colorScheme.placeholderText
|
|
246
|
+
)
|
|
247
|
+
}
|
|
248
|
+
innerTextField()
|
|
249
|
+
},
|
|
250
|
+
)
|
|
251
|
+
}
|