pytech-ui 1.0.30 → 1.0.31
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 +47 -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/PytechUiModifiers.kt +93 -93
- package/android/src/main/java/expo/modules/pytechui/PytechUiModule.kt +168 -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/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/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/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,213 +1,213 @@
|
|
|
1
|
-
@file:OptIn(ExperimentalMaterial3Api::class)
|
|
2
|
-
|
|
3
|
-
package expo.modules.pytechui
|
|
4
|
-
|
|
5
|
-
import androidx.activity.compose.BackHandler
|
|
6
|
-
import androidx.compose.foundation.layout.Box
|
|
7
|
-
import androidx.compose.foundation.layout.fillMaxWidth
|
|
8
|
-
import androidx.compose.foundation.layout.height
|
|
9
|
-
import androidx.compose.foundation.layout.offset
|
|
10
|
-
import androidx.compose.foundation.layout.size
|
|
11
|
-
import androidx.compose.foundation.relocation.BringIntoViewRequester
|
|
12
|
-
import androidx.compose.foundation.relocation.bringIntoViewRequester
|
|
13
|
-
import androidx.compose.foundation.text.input.rememberTextFieldState
|
|
14
|
-
import androidx.compose.material.icons.Icons
|
|
15
|
-
import androidx.compose.material.icons.rounded.ArrowBackIosNew
|
|
16
|
-
import androidx.compose.material.icons.rounded.Clear
|
|
17
|
-
import androidx.compose.material.icons.rounded.Search
|
|
18
|
-
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
19
|
-
import androidx.compose.material3.Icon
|
|
20
|
-
import androidx.compose.material3.IconButton
|
|
21
|
-
import androidx.compose.material3.LocalTextStyle
|
|
22
|
-
import androidx.compose.material3.SearchBarDefaults
|
|
23
|
-
import androidx.compose.material3.Surface
|
|
24
|
-
import androidx.compose.material3.Text
|
|
25
|
-
import androidx.compose.runtime.Composable
|
|
26
|
-
import androidx.compose.runtime.LaunchedEffect
|
|
27
|
-
import androidx.compose.runtime.snapshotFlow
|
|
28
|
-
import androidx.compose.runtime.getValue
|
|
29
|
-
import androidx.compose.runtime.mutableStateOf
|
|
30
|
-
import androidx.compose.runtime.remember
|
|
31
|
-
import androidx.compose.runtime.rememberCoroutineScope
|
|
32
|
-
import androidx.compose.runtime.setValue
|
|
33
|
-
import androidx.compose.ui.Modifier
|
|
34
|
-
import androidx.compose.ui.Alignment
|
|
35
|
-
import androidx.compose.ui.focus.FocusRequester
|
|
36
|
-
import androidx.compose.ui.focus.focusRequester
|
|
37
|
-
import androidx.compose.ui.focus.onFocusChanged
|
|
38
|
-
import androidx.compose.ui.graphics.Color
|
|
39
|
-
import androidx.compose.ui.platform.LocalFocusManager
|
|
40
|
-
import androidx.compose.ui.unit.dp
|
|
41
|
-
import expo.modules.kotlin.views.ComposeProps
|
|
42
|
-
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
43
|
-
import expo.modules.ui.ModifierList
|
|
44
|
-
import kotlinx.coroutines.delay
|
|
45
|
-
import kotlinx.coroutines.launch
|
|
46
|
-
|
|
47
|
-
import expo.modules.pytechui.theme.tokens.SearchBarTokens
|
|
48
|
-
import expo.modules.pytechui.theme.ExtendedTheme
|
|
49
|
-
|
|
50
|
-
import java.io.Serializable
|
|
51
|
-
import expo.modules.kotlin.records.Field
|
|
52
|
-
import expo.modules.kotlin.records.Record
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
data class SearchBarDismissEvent(
|
|
57
|
-
@Field val dismissed: Boolean = true,
|
|
58
|
-
) : Record, Serializable
|
|
59
|
-
|
|
60
|
-
data class SearchBarChangeTextEvent(
|
|
61
|
-
@Field val text: String = "",
|
|
62
|
-
) : Record, Serializable
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Campo de búsqueda con look de chip M3 (sin expandir a pantalla completa).
|
|
67
|
-
*/
|
|
68
|
-
data class SearchBarProps(
|
|
69
|
-
val placeholder: String? = null,
|
|
70
|
-
val autoFocus: Boolean = false,
|
|
71
|
-
/** Si es true, muestra ← clicable; si es false, muestra lupa decorativa. */
|
|
72
|
-
val showBackButton: Boolean = true,
|
|
73
|
-
val modifiers: ModifierList = emptyList(),
|
|
74
|
-
) : ComposeProps
|
|
75
|
-
|
|
76
|
-
@Composable
|
|
77
|
-
internal fun FunctionalComposableScope.SearchBarViewContent(
|
|
78
|
-
props: SearchBarProps,
|
|
79
|
-
onDismiss: () -> Unit = {},
|
|
80
|
-
onChangeText: (String) -> Unit = {},
|
|
81
|
-
) {
|
|
82
|
-
val textFieldState = rememberTextFieldState()
|
|
83
|
-
val focusRequester = remember { FocusRequester() }
|
|
84
|
-
val bringIntoViewRequester = remember { BringIntoViewRequester() }
|
|
85
|
-
val scope = rememberCoroutineScope()
|
|
86
|
-
val focusManager = LocalFocusManager.current
|
|
87
|
-
var isFocused by remember { mutableStateOf(false) }
|
|
88
|
-
|
|
89
|
-
val dismiss = {
|
|
90
|
-
focusManager.clearFocus()
|
|
91
|
-
onChangeText("")
|
|
92
|
-
onDismiss()
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (props.autoFocus) {
|
|
96
|
-
LaunchedEffect(Unit) {
|
|
97
|
-
delay(150)
|
|
98
|
-
runCatching { focusRequester.requestFocus() }
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
BackHandler(enabled = props.showBackButton && isFocused) {
|
|
103
|
-
dismiss()
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
LaunchedEffect(textFieldState) {
|
|
107
|
-
try {
|
|
108
|
-
snapshotFlow { textFieldState.text.toString() }.collect { text ->
|
|
109
|
-
onChangeText(text)
|
|
110
|
-
}
|
|
111
|
-
} finally {
|
|
112
|
-
onChangeText("")
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
val labelColor = ExtendedTheme.colorScheme.label
|
|
117
|
-
val placeholderColor = ExtendedTheme.colorScheme.placeholderText
|
|
118
|
-
val fieldTextStyle = LocalTextStyle.current
|
|
119
|
-
|
|
120
|
-
Surface(
|
|
121
|
-
modifier = Modifier
|
|
122
|
-
.fillMaxWidth()
|
|
123
|
-
.height(SearchBarTokens.ContainerHeight),
|
|
124
|
-
shape = SearchBarDefaults.inputFieldShape,
|
|
125
|
-
color = ExtendedTheme.colorScheme.secondarySystemGroupedBackground,
|
|
126
|
-
|
|
127
|
-
) {
|
|
128
|
-
SearchBarDefaults.InputField(
|
|
129
|
-
state = textFieldState,
|
|
130
|
-
onSearch = { focusManager.clearFocus() },
|
|
131
|
-
expanded = false,
|
|
132
|
-
onExpandedChange = { /* nunca expandir */ },
|
|
133
|
-
textStyle = fieldTextStyle,
|
|
134
|
-
placeholder = {
|
|
135
|
-
val text = props.placeholder
|
|
136
|
-
if (!text.isNullOrBlank()) {
|
|
137
|
-
Text(
|
|
138
|
-
text = text,
|
|
139
|
-
style = fieldTextStyle,
|
|
140
|
-
color = placeholderColor,
|
|
141
|
-
)
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
leadingIcon = {
|
|
145
|
-
if (props.showBackButton) {
|
|
146
|
-
IconButton(
|
|
147
|
-
onClick = dismiss,
|
|
148
|
-
) {
|
|
149
|
-
Icon(
|
|
150
|
-
imageVector = Icons.Rounded.ArrowBackIosNew,
|
|
151
|
-
contentDescription = "Volver",
|
|
152
|
-
tint = labelColor,
|
|
153
|
-
modifier = Modifier.size(20.dp),
|
|
154
|
-
)
|
|
155
|
-
}
|
|
156
|
-
} else {
|
|
157
|
-
Icon(
|
|
158
|
-
imageVector = Icons.Rounded.Search,
|
|
159
|
-
contentDescription = "Buscar",
|
|
160
|
-
tint = labelColor,
|
|
161
|
-
modifier = Modifier.size(24.dp),
|
|
162
|
-
)
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
trailingIcon = {
|
|
166
|
-
if (textFieldState.text.isNotEmpty()) {
|
|
167
|
-
IconButton(
|
|
168
|
-
onClick = {
|
|
169
|
-
textFieldState.edit {
|
|
170
|
-
replace(0, length, "")
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
) {
|
|
174
|
-
Icon(
|
|
175
|
-
imageVector = Icons.Rounded.Clear,
|
|
176
|
-
contentDescription = "Borrar",
|
|
177
|
-
tint = labelColor,
|
|
178
|
-
modifier = Modifier.size(24.dp),
|
|
179
|
-
)
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
modifier = Modifier
|
|
184
|
-
.fillMaxWidth()
|
|
185
|
-
.focusRequester(focusRequester)
|
|
186
|
-
.bringIntoViewRequester(bringIntoViewRequester)
|
|
187
|
-
.onFocusChanged { focusState ->
|
|
188
|
-
isFocused = focusState.isFocused
|
|
189
|
-
if (focusState.isFocused) {
|
|
190
|
-
scope.launch {
|
|
191
|
-
delay(100)
|
|
192
|
-
bringIntoViewRequester.bringIntoView()
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
shape = SearchBarDefaults.inputFieldShape,
|
|
197
|
-
colors = SearchBarDefaults.inputFieldColors(
|
|
198
|
-
focusedTextColor = labelColor,
|
|
199
|
-
unfocusedTextColor = labelColor,
|
|
200
|
-
focusedPlaceholderColor = placeholderColor,
|
|
201
|
-
unfocusedPlaceholderColor = placeholderColor,
|
|
202
|
-
focusedLeadingIconColor = labelColor,
|
|
203
|
-
unfocusedLeadingIconColor = labelColor,
|
|
204
|
-
focusedTrailingIconColor = labelColor,
|
|
205
|
-
unfocusedTrailingIconColor = labelColor,
|
|
206
|
-
cursorColor = ExtendedTheme.colorScheme.systemBlue,
|
|
207
|
-
focusedContainerColor = Color.Transparent,
|
|
208
|
-
unfocusedContainerColor = Color.Transparent,
|
|
209
|
-
disabledContainerColor = Color.Transparent,
|
|
210
|
-
),
|
|
211
|
-
)
|
|
212
|
-
}
|
|
213
|
-
}
|
|
1
|
+
@file:OptIn(ExperimentalMaterial3Api::class)
|
|
2
|
+
|
|
3
|
+
package expo.modules.pytechui
|
|
4
|
+
|
|
5
|
+
import androidx.activity.compose.BackHandler
|
|
6
|
+
import androidx.compose.foundation.layout.Box
|
|
7
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
8
|
+
import androidx.compose.foundation.layout.height
|
|
9
|
+
import androidx.compose.foundation.layout.offset
|
|
10
|
+
import androidx.compose.foundation.layout.size
|
|
11
|
+
import androidx.compose.foundation.relocation.BringIntoViewRequester
|
|
12
|
+
import androidx.compose.foundation.relocation.bringIntoViewRequester
|
|
13
|
+
import androidx.compose.foundation.text.input.rememberTextFieldState
|
|
14
|
+
import androidx.compose.material.icons.Icons
|
|
15
|
+
import androidx.compose.material.icons.rounded.ArrowBackIosNew
|
|
16
|
+
import androidx.compose.material.icons.rounded.Clear
|
|
17
|
+
import androidx.compose.material.icons.rounded.Search
|
|
18
|
+
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
19
|
+
import androidx.compose.material3.Icon
|
|
20
|
+
import androidx.compose.material3.IconButton
|
|
21
|
+
import androidx.compose.material3.LocalTextStyle
|
|
22
|
+
import androidx.compose.material3.SearchBarDefaults
|
|
23
|
+
import androidx.compose.material3.Surface
|
|
24
|
+
import androidx.compose.material3.Text
|
|
25
|
+
import androidx.compose.runtime.Composable
|
|
26
|
+
import androidx.compose.runtime.LaunchedEffect
|
|
27
|
+
import androidx.compose.runtime.snapshotFlow
|
|
28
|
+
import androidx.compose.runtime.getValue
|
|
29
|
+
import androidx.compose.runtime.mutableStateOf
|
|
30
|
+
import androidx.compose.runtime.remember
|
|
31
|
+
import androidx.compose.runtime.rememberCoroutineScope
|
|
32
|
+
import androidx.compose.runtime.setValue
|
|
33
|
+
import androidx.compose.ui.Modifier
|
|
34
|
+
import androidx.compose.ui.Alignment
|
|
35
|
+
import androidx.compose.ui.focus.FocusRequester
|
|
36
|
+
import androidx.compose.ui.focus.focusRequester
|
|
37
|
+
import androidx.compose.ui.focus.onFocusChanged
|
|
38
|
+
import androidx.compose.ui.graphics.Color
|
|
39
|
+
import androidx.compose.ui.platform.LocalFocusManager
|
|
40
|
+
import androidx.compose.ui.unit.dp
|
|
41
|
+
import expo.modules.kotlin.views.ComposeProps
|
|
42
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
43
|
+
import expo.modules.ui.ModifierList
|
|
44
|
+
import kotlinx.coroutines.delay
|
|
45
|
+
import kotlinx.coroutines.launch
|
|
46
|
+
|
|
47
|
+
import expo.modules.pytechui.theme.tokens.SearchBarTokens
|
|
48
|
+
import expo.modules.pytechui.theme.ExtendedTheme
|
|
49
|
+
|
|
50
|
+
import java.io.Serializable
|
|
51
|
+
import expo.modules.kotlin.records.Field
|
|
52
|
+
import expo.modules.kotlin.records.Record
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
data class SearchBarDismissEvent(
|
|
57
|
+
@Field val dismissed: Boolean = true,
|
|
58
|
+
) : Record, Serializable
|
|
59
|
+
|
|
60
|
+
data class SearchBarChangeTextEvent(
|
|
61
|
+
@Field val text: String = "",
|
|
62
|
+
) : Record, Serializable
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Campo de búsqueda con look de chip M3 (sin expandir a pantalla completa).
|
|
67
|
+
*/
|
|
68
|
+
data class SearchBarProps(
|
|
69
|
+
val placeholder: String? = null,
|
|
70
|
+
val autoFocus: Boolean = false,
|
|
71
|
+
/** Si es true, muestra ← clicable; si es false, muestra lupa decorativa. */
|
|
72
|
+
val showBackButton: Boolean = true,
|
|
73
|
+
val modifiers: ModifierList = emptyList(),
|
|
74
|
+
) : ComposeProps
|
|
75
|
+
|
|
76
|
+
@Composable
|
|
77
|
+
internal fun FunctionalComposableScope.SearchBarViewContent(
|
|
78
|
+
props: SearchBarProps,
|
|
79
|
+
onDismiss: () -> Unit = {},
|
|
80
|
+
onChangeText: (String) -> Unit = {},
|
|
81
|
+
) {
|
|
82
|
+
val textFieldState = rememberTextFieldState()
|
|
83
|
+
val focusRequester = remember { FocusRequester() }
|
|
84
|
+
val bringIntoViewRequester = remember { BringIntoViewRequester() }
|
|
85
|
+
val scope = rememberCoroutineScope()
|
|
86
|
+
val focusManager = LocalFocusManager.current
|
|
87
|
+
var isFocused by remember { mutableStateOf(false) }
|
|
88
|
+
|
|
89
|
+
val dismiss = {
|
|
90
|
+
focusManager.clearFocus()
|
|
91
|
+
onChangeText("")
|
|
92
|
+
onDismiss()
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (props.autoFocus) {
|
|
96
|
+
LaunchedEffect(Unit) {
|
|
97
|
+
delay(150)
|
|
98
|
+
runCatching { focusRequester.requestFocus() }
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
BackHandler(enabled = props.showBackButton && isFocused) {
|
|
103
|
+
dismiss()
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
LaunchedEffect(textFieldState) {
|
|
107
|
+
try {
|
|
108
|
+
snapshotFlow { textFieldState.text.toString() }.collect { text ->
|
|
109
|
+
onChangeText(text)
|
|
110
|
+
}
|
|
111
|
+
} finally {
|
|
112
|
+
onChangeText("")
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
val labelColor = ExtendedTheme.colorScheme.label
|
|
117
|
+
val placeholderColor = ExtendedTheme.colorScheme.placeholderText
|
|
118
|
+
val fieldTextStyle = LocalTextStyle.current
|
|
119
|
+
|
|
120
|
+
Surface(
|
|
121
|
+
modifier = Modifier
|
|
122
|
+
.fillMaxWidth()
|
|
123
|
+
.height(SearchBarTokens.ContainerHeight),
|
|
124
|
+
shape = SearchBarDefaults.inputFieldShape,
|
|
125
|
+
color = ExtendedTheme.colorScheme.secondarySystemGroupedBackground,
|
|
126
|
+
|
|
127
|
+
) {
|
|
128
|
+
SearchBarDefaults.InputField(
|
|
129
|
+
state = textFieldState,
|
|
130
|
+
onSearch = { focusManager.clearFocus() },
|
|
131
|
+
expanded = false,
|
|
132
|
+
onExpandedChange = { /* nunca expandir */ },
|
|
133
|
+
textStyle = fieldTextStyle,
|
|
134
|
+
placeholder = {
|
|
135
|
+
val text = props.placeholder
|
|
136
|
+
if (!text.isNullOrBlank()) {
|
|
137
|
+
Text(
|
|
138
|
+
text = text,
|
|
139
|
+
style = fieldTextStyle,
|
|
140
|
+
color = placeholderColor,
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
leadingIcon = {
|
|
145
|
+
if (props.showBackButton) {
|
|
146
|
+
IconButton(
|
|
147
|
+
onClick = dismiss,
|
|
148
|
+
) {
|
|
149
|
+
Icon(
|
|
150
|
+
imageVector = Icons.Rounded.ArrowBackIosNew,
|
|
151
|
+
contentDescription = "Volver",
|
|
152
|
+
tint = labelColor,
|
|
153
|
+
modifier = Modifier.size(20.dp),
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
Icon(
|
|
158
|
+
imageVector = Icons.Rounded.Search,
|
|
159
|
+
contentDescription = "Buscar",
|
|
160
|
+
tint = labelColor,
|
|
161
|
+
modifier = Modifier.size(24.dp),
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
trailingIcon = {
|
|
166
|
+
if (textFieldState.text.isNotEmpty()) {
|
|
167
|
+
IconButton(
|
|
168
|
+
onClick = {
|
|
169
|
+
textFieldState.edit {
|
|
170
|
+
replace(0, length, "")
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
) {
|
|
174
|
+
Icon(
|
|
175
|
+
imageVector = Icons.Rounded.Clear,
|
|
176
|
+
contentDescription = "Borrar",
|
|
177
|
+
tint = labelColor,
|
|
178
|
+
modifier = Modifier.size(24.dp),
|
|
179
|
+
)
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
modifier = Modifier
|
|
184
|
+
.fillMaxWidth()
|
|
185
|
+
.focusRequester(focusRequester)
|
|
186
|
+
.bringIntoViewRequester(bringIntoViewRequester)
|
|
187
|
+
.onFocusChanged { focusState ->
|
|
188
|
+
isFocused = focusState.isFocused
|
|
189
|
+
if (focusState.isFocused) {
|
|
190
|
+
scope.launch {
|
|
191
|
+
delay(100)
|
|
192
|
+
bringIntoViewRequester.bringIntoView()
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
shape = SearchBarDefaults.inputFieldShape,
|
|
197
|
+
colors = SearchBarDefaults.inputFieldColors(
|
|
198
|
+
focusedTextColor = labelColor,
|
|
199
|
+
unfocusedTextColor = labelColor,
|
|
200
|
+
focusedPlaceholderColor = placeholderColor,
|
|
201
|
+
unfocusedPlaceholderColor = placeholderColor,
|
|
202
|
+
focusedLeadingIconColor = labelColor,
|
|
203
|
+
unfocusedLeadingIconColor = labelColor,
|
|
204
|
+
focusedTrailingIconColor = labelColor,
|
|
205
|
+
unfocusedTrailingIconColor = labelColor,
|
|
206
|
+
cursorColor = ExtendedTheme.colorScheme.systemBlue,
|
|
207
|
+
focusedContainerColor = Color.Transparent,
|
|
208
|
+
unfocusedContainerColor = Color.Transparent,
|
|
209
|
+
disabledContainerColor = Color.Transparent,
|
|
210
|
+
),
|
|
211
|
+
)
|
|
212
|
+
}
|
|
213
|
+
}
|
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
package expo.modules.pytechui.section
|
|
2
|
-
|
|
3
|
-
import android.view.View
|
|
4
|
-
import android.view.ViewGroup
|
|
5
|
-
import androidx.compose.runtime.mutableIntStateOf
|
|
6
|
-
import expo.modules.kotlin.views.ExpoComposeView
|
|
7
|
-
import expo.modules.pytechui.ListItem.ListItemProps
|
|
8
|
-
|
|
9
|
-
internal val SectionHostStateTag = Any()
|
|
10
|
-
internal const val LIST_ITEM_VIEW_NAME = "ListItemView"
|
|
11
|
-
|
|
12
|
-
data class SectionItemPosition(
|
|
13
|
-
val isFirst: Boolean,
|
|
14
|
-
val isLast: Boolean,
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
internal class SectionHostState {
|
|
18
|
-
val generation = mutableIntStateOf(0)
|
|
19
|
-
private val positions = mutableMapOf<ExpoComposeView<*>, SectionItemPosition>()
|
|
20
|
-
|
|
21
|
-
fun update(listItems: List<ExpoComposeView<*>>) {
|
|
22
|
-
positions.clear()
|
|
23
|
-
listItems.forEachIndexed { index, view ->
|
|
24
|
-
positions[view] = SectionItemPosition(
|
|
25
|
-
isFirst = index == 0,
|
|
26
|
-
isLast = index == listItems.lastIndex,
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
generation.intValue++
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
fun positionFor(view: ExpoComposeView<*>): SectionItemPosition? = positions[view]
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
internal fun isListItemView(view: ExpoComposeView<*>): Boolean {
|
|
36
|
-
if (view.props is ListItemProps) return true
|
|
37
|
-
return view.javaClass.name.contains(LIST_ITEM_VIEW_NAME, ignoreCase = true)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
internal fun ViewGroup.collectListItemViewsDeep(): List<ExpoComposeView<*>> {
|
|
41
|
-
val result = mutableListOf<ExpoComposeView<*>>()
|
|
42
|
-
collectListItemViewsDeepInto(result)
|
|
43
|
-
return result
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
private fun ViewGroup.collectListItemViewsDeepInto(out: MutableList<ExpoComposeView<*>>) {
|
|
47
|
-
for (i in 0 until childCount) {
|
|
48
|
-
when (val child = getChildAt(i)) {
|
|
49
|
-
is ExpoComposeView<*> -> {
|
|
50
|
-
if (isListItemView(child)) {
|
|
51
|
-
out.add(child)
|
|
52
|
-
}
|
|
53
|
-
if (child is ViewGroup) {
|
|
54
|
-
child.collectListItemViewsDeepInto(out)
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
is ViewGroup -> child.collectListItemViewsDeepInto(out)
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
internal fun View.findSectionHostState(): SectionHostState? {
|
|
63
|
-
var current: View? = this
|
|
64
|
-
while (current != null) {
|
|
65
|
-
(current.tag as? SectionHostState)?.let { return it }
|
|
66
|
-
current = current.parent as? View
|
|
67
|
-
}
|
|
68
|
-
return null
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
internal fun ExpoComposeView<*>.sectionItemPosition(props: ListItemProps): SectionItemPosition? {
|
|
72
|
-
props.isFirst?.let { isFirst ->
|
|
73
|
-
props.isLast?.let { isLast ->
|
|
74
|
-
return SectionItemPosition(isFirst = isFirst, isLast = isLast)
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
val hostState = (this as View).findSectionHostState() ?: return null
|
|
78
|
-
@Suppress("UNUSED_VARIABLE")
|
|
79
|
-
val generation = hostState.generation.intValue
|
|
80
|
-
return hostState.positionFor(this)
|
|
81
|
-
}
|
|
1
|
+
package expo.modules.pytechui.section
|
|
2
|
+
|
|
3
|
+
import android.view.View
|
|
4
|
+
import android.view.ViewGroup
|
|
5
|
+
import androidx.compose.runtime.mutableIntStateOf
|
|
6
|
+
import expo.modules.kotlin.views.ExpoComposeView
|
|
7
|
+
import expo.modules.pytechui.ListItem.ListItemProps
|
|
8
|
+
|
|
9
|
+
internal val SectionHostStateTag = Any()
|
|
10
|
+
internal const val LIST_ITEM_VIEW_NAME = "ListItemView"
|
|
11
|
+
|
|
12
|
+
data class SectionItemPosition(
|
|
13
|
+
val isFirst: Boolean,
|
|
14
|
+
val isLast: Boolean,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
internal class SectionHostState {
|
|
18
|
+
val generation = mutableIntStateOf(0)
|
|
19
|
+
private val positions = mutableMapOf<ExpoComposeView<*>, SectionItemPosition>()
|
|
20
|
+
|
|
21
|
+
fun update(listItems: List<ExpoComposeView<*>>) {
|
|
22
|
+
positions.clear()
|
|
23
|
+
listItems.forEachIndexed { index, view ->
|
|
24
|
+
positions[view] = SectionItemPosition(
|
|
25
|
+
isFirst = index == 0,
|
|
26
|
+
isLast = index == listItems.lastIndex,
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
generation.intValue++
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
fun positionFor(view: ExpoComposeView<*>): SectionItemPosition? = positions[view]
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
internal fun isListItemView(view: ExpoComposeView<*>): Boolean {
|
|
36
|
+
if (view.props is ListItemProps) return true
|
|
37
|
+
return view.javaClass.name.contains(LIST_ITEM_VIEW_NAME, ignoreCase = true)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
internal fun ViewGroup.collectListItemViewsDeep(): List<ExpoComposeView<*>> {
|
|
41
|
+
val result = mutableListOf<ExpoComposeView<*>>()
|
|
42
|
+
collectListItemViewsDeepInto(result)
|
|
43
|
+
return result
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private fun ViewGroup.collectListItemViewsDeepInto(out: MutableList<ExpoComposeView<*>>) {
|
|
47
|
+
for (i in 0 until childCount) {
|
|
48
|
+
when (val child = getChildAt(i)) {
|
|
49
|
+
is ExpoComposeView<*> -> {
|
|
50
|
+
if (isListItemView(child)) {
|
|
51
|
+
out.add(child)
|
|
52
|
+
}
|
|
53
|
+
if (child is ViewGroup) {
|
|
54
|
+
child.collectListItemViewsDeepInto(out)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
is ViewGroup -> child.collectListItemViewsDeepInto(out)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
internal fun View.findSectionHostState(): SectionHostState? {
|
|
63
|
+
var current: View? = this
|
|
64
|
+
while (current != null) {
|
|
65
|
+
(current.tag as? SectionHostState)?.let { return it }
|
|
66
|
+
current = current.parent as? View
|
|
67
|
+
}
|
|
68
|
+
return null
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
internal fun ExpoComposeView<*>.sectionItemPosition(props: ListItemProps): SectionItemPosition? {
|
|
72
|
+
props.isFirst?.let { isFirst ->
|
|
73
|
+
props.isLast?.let { isLast ->
|
|
74
|
+
return SectionItemPosition(isFirst = isFirst, isLast = isLast)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
val hostState = (this as View).findSectionHostState() ?: return null
|
|
78
|
+
@Suppress("UNUSED_VARIABLE")
|
|
79
|
+
val generation = hostState.generation.intValue
|
|
80
|
+
return hostState.positionFor(this)
|
|
81
|
+
}
|