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,127 +1,127 @@
|
|
|
1
|
-
package expo.modules.pytechui.ListItem
|
|
2
|
-
|
|
3
|
-
import androidx.compose.foundation.clickable
|
|
4
|
-
import androidx.compose.foundation.layout.fillMaxWidth
|
|
5
|
-
import androidx.compose.foundation.layout.size
|
|
6
|
-
import androidx.compose.material3.Icon
|
|
7
|
-
import androidx.compose.material3.Text
|
|
8
|
-
import androidx.compose.runtime.Composable
|
|
9
|
-
import androidx.compose.ui.Modifier
|
|
10
|
-
import androidx.compose.ui.text.style.TextOverflow
|
|
11
|
-
import androidx.compose.ui.unit.dp
|
|
12
|
-
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
13
|
-
import expo.modules.pytechui.TypographySlot.Typographies
|
|
14
|
-
import expo.modules.pytechui.gradient.GradientCircle
|
|
15
|
-
import expo.modules.pytechui.components.Icon.parseIconSource
|
|
16
|
-
import expo.modules.pytechui.getModifier
|
|
17
|
-
import expo.modules.pytechui.theme.ExtendedTheme
|
|
18
|
-
import expo.modules.pytechui.theme.tokens.ListTokens
|
|
19
|
-
import expo.modules.ui.TextOverflowType
|
|
20
|
-
import expo.modules.ui.compose
|
|
21
|
-
|
|
22
|
-
@Composable
|
|
23
|
-
internal fun FunctionalComposableScope.ListItemFromData(
|
|
24
|
-
props: ListItemProps,
|
|
25
|
-
content: ListItemContentRecord,
|
|
26
|
-
onPress: (() -> Unit)?,
|
|
27
|
-
) {
|
|
28
|
-
val isFirst = props.isFirst ?: true
|
|
29
|
-
val isLast = props.isLast ?: true
|
|
30
|
-
val pressModifier = if (onPress != null) Modifier.clickable(onClick = onPress) else Modifier
|
|
31
|
-
|
|
32
|
-
Decorator(
|
|
33
|
-
isFirst = isFirst,
|
|
34
|
-
isLast = isLast,
|
|
35
|
-
showDivider = props.showDivider,
|
|
36
|
-
modifier = getModifier(props.modifiers).then(pressModifier),
|
|
37
|
-
) { innerProps ->
|
|
38
|
-
ListItemDynamic(
|
|
39
|
-
props = props,
|
|
40
|
-
modifier = Modifier.fillMaxWidth(),
|
|
41
|
-
innerProps = innerProps,
|
|
42
|
-
leadingContent = content.leadingContent?.let { slot ->
|
|
43
|
-
{ RenderSlotContent("leadingcontent", slot) }
|
|
44
|
-
},
|
|
45
|
-
overlineContent = content.overlineContent?.let { slot ->
|
|
46
|
-
{ RenderSlotContent("overlinecontent", slot) }
|
|
47
|
-
},
|
|
48
|
-
supportingContent = content.supportingContent?.let { slot ->
|
|
49
|
-
{ RenderSlotContent("supportingcontent", slot) }
|
|
50
|
-
},
|
|
51
|
-
headlineContent = content.headlineContent?.let { slot ->
|
|
52
|
-
{ RenderSlotContent("headlinecontent", slot) }
|
|
53
|
-
},
|
|
54
|
-
trailingContent = content.trailingContent?.let { slot ->
|
|
55
|
-
{ RenderSlotContent("trailingcontent", slot) }
|
|
56
|
-
},
|
|
57
|
-
)
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@Composable
|
|
62
|
-
private fun FunctionalComposableScope.RenderSlotContent(
|
|
63
|
-
slotName: String,
|
|
64
|
-
content: ListItemSlotContentRecord,
|
|
65
|
-
) {
|
|
66
|
-
val slotProps = content.props ?: return
|
|
67
|
-
|
|
68
|
-
when (content.type) {
|
|
69
|
-
"gradient" -> GradientSlotContent(slotProps)
|
|
70
|
-
"icon" -> IconSlotContent(slotProps)
|
|
71
|
-
else -> TextSlotContent(slotName, slotProps)
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
@Composable
|
|
76
|
-
private fun FunctionalComposableScope.IconSlotContent(props: ListItemSlotPropsRecord) {
|
|
77
|
-
val imageVector = parseIconSource(props.source) ?: return
|
|
78
|
-
val sizeModifier = props.size?.toFloat()?.dp?.let { Modifier.size(it) }
|
|
79
|
-
?: Modifier.size(ListTokens.ItemLeadingIconSize)
|
|
80
|
-
|
|
81
|
-
Icon(
|
|
82
|
-
imageVector = imageVector,
|
|
83
|
-
contentDescription = props.contentDescription,
|
|
84
|
-
tint = props.tint?.compose ?: ExtendedTheme.colorScheme.link,
|
|
85
|
-
modifier = getModifier(props.modifiers).then(sizeModifier),
|
|
86
|
-
)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
@Composable
|
|
90
|
-
private fun GradientSlotContent(props: ListItemSlotPropsRecord) {
|
|
91
|
-
GradientCircle(
|
|
92
|
-
text = props.text,
|
|
93
|
-
fontSize = props.fontSize,
|
|
94
|
-
sizeDp = props.size?.toFloat(),
|
|
95
|
-
lightColor = props.colors?.light?.compose,
|
|
96
|
-
darkColor = props.colors?.dark?.compose,
|
|
97
|
-
source = props.source,
|
|
98
|
-
iconSize = props.iconSize?.toFloat(),
|
|
99
|
-
)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
@Composable
|
|
103
|
-
private fun FunctionalComposableScope.TextSlotContent(
|
|
104
|
-
slotName: String,
|
|
105
|
-
props: ListItemSlotPropsRecord,
|
|
106
|
-
) {
|
|
107
|
-
val text = props.text ?: return
|
|
108
|
-
val spec = Typographies.specs[slotName.lowercase()]
|
|
109
|
-
|
|
110
|
-
Text(
|
|
111
|
-
text = text,
|
|
112
|
-
modifier = getModifier(props.modifiers).then(
|
|
113
|
-
if (slotName == "headlinecontent") Modifier.fillMaxWidth() else Modifier
|
|
114
|
-
),
|
|
115
|
-
maxLines = props.maxLines ?: spec?.maxLines ?: Int.MAX_VALUE,
|
|
116
|
-
overflow = props.overflow?.toComposeTextOverflow()
|
|
117
|
-
?: spec?.overflow?.toComposeTextOverflow()
|
|
118
|
-
?: TextOverflow.Clip,
|
|
119
|
-
)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
private fun String.toComposeTextOverflow(): TextOverflow? = when (lowercase()) {
|
|
123
|
-
"clip" -> TextOverflow.Clip
|
|
124
|
-
"ellipsis" -> TextOverflow.Ellipsis
|
|
125
|
-
"visible" -> TextOverflow.Visible
|
|
126
|
-
else -> null
|
|
127
|
-
}
|
|
1
|
+
package expo.modules.pytechui.ListItem
|
|
2
|
+
|
|
3
|
+
import androidx.compose.foundation.clickable
|
|
4
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
5
|
+
import androidx.compose.foundation.layout.size
|
|
6
|
+
import androidx.compose.material3.Icon
|
|
7
|
+
import androidx.compose.material3.Text
|
|
8
|
+
import androidx.compose.runtime.Composable
|
|
9
|
+
import androidx.compose.ui.Modifier
|
|
10
|
+
import androidx.compose.ui.text.style.TextOverflow
|
|
11
|
+
import androidx.compose.ui.unit.dp
|
|
12
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
13
|
+
import expo.modules.pytechui.TypographySlot.Typographies
|
|
14
|
+
import expo.modules.pytechui.gradient.GradientCircle
|
|
15
|
+
import expo.modules.pytechui.components.Icon.parseIconSource
|
|
16
|
+
import expo.modules.pytechui.getModifier
|
|
17
|
+
import expo.modules.pytechui.theme.ExtendedTheme
|
|
18
|
+
import expo.modules.pytechui.theme.tokens.ListTokens
|
|
19
|
+
import expo.modules.ui.TextOverflowType
|
|
20
|
+
import expo.modules.ui.compose
|
|
21
|
+
|
|
22
|
+
@Composable
|
|
23
|
+
internal fun FunctionalComposableScope.ListItemFromData(
|
|
24
|
+
props: ListItemProps,
|
|
25
|
+
content: ListItemContentRecord,
|
|
26
|
+
onPress: (() -> Unit)?,
|
|
27
|
+
) {
|
|
28
|
+
val isFirst = props.isFirst ?: true
|
|
29
|
+
val isLast = props.isLast ?: true
|
|
30
|
+
val pressModifier = if (onPress != null) Modifier.clickable(onClick = onPress) else Modifier
|
|
31
|
+
|
|
32
|
+
Decorator(
|
|
33
|
+
isFirst = isFirst,
|
|
34
|
+
isLast = isLast,
|
|
35
|
+
showDivider = props.showDivider,
|
|
36
|
+
modifier = getModifier(props.modifiers).then(pressModifier),
|
|
37
|
+
) { innerProps ->
|
|
38
|
+
ListItemDynamic(
|
|
39
|
+
props = props,
|
|
40
|
+
modifier = Modifier.fillMaxWidth(),
|
|
41
|
+
innerProps = innerProps,
|
|
42
|
+
leadingContent = content.leadingContent?.let { slot ->
|
|
43
|
+
{ RenderSlotContent("leadingcontent", slot) }
|
|
44
|
+
},
|
|
45
|
+
overlineContent = content.overlineContent?.let { slot ->
|
|
46
|
+
{ RenderSlotContent("overlinecontent", slot) }
|
|
47
|
+
},
|
|
48
|
+
supportingContent = content.supportingContent?.let { slot ->
|
|
49
|
+
{ RenderSlotContent("supportingcontent", slot) }
|
|
50
|
+
},
|
|
51
|
+
headlineContent = content.headlineContent?.let { slot ->
|
|
52
|
+
{ RenderSlotContent("headlinecontent", slot) }
|
|
53
|
+
},
|
|
54
|
+
trailingContent = content.trailingContent?.let { slot ->
|
|
55
|
+
{ RenderSlotContent("trailingcontent", slot) }
|
|
56
|
+
},
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@Composable
|
|
62
|
+
private fun FunctionalComposableScope.RenderSlotContent(
|
|
63
|
+
slotName: String,
|
|
64
|
+
content: ListItemSlotContentRecord,
|
|
65
|
+
) {
|
|
66
|
+
val slotProps = content.props ?: return
|
|
67
|
+
|
|
68
|
+
when (content.type) {
|
|
69
|
+
"gradient" -> GradientSlotContent(slotProps)
|
|
70
|
+
"icon" -> IconSlotContent(slotProps)
|
|
71
|
+
else -> TextSlotContent(slotName, slotProps)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@Composable
|
|
76
|
+
private fun FunctionalComposableScope.IconSlotContent(props: ListItemSlotPropsRecord) {
|
|
77
|
+
val imageVector = parseIconSource(props.source) ?: return
|
|
78
|
+
val sizeModifier = props.size?.toFloat()?.dp?.let { Modifier.size(it) }
|
|
79
|
+
?: Modifier.size(ListTokens.ItemLeadingIconSize)
|
|
80
|
+
|
|
81
|
+
Icon(
|
|
82
|
+
imageVector = imageVector,
|
|
83
|
+
contentDescription = props.contentDescription,
|
|
84
|
+
tint = props.tint?.compose ?: ExtendedTheme.colorScheme.link,
|
|
85
|
+
modifier = getModifier(props.modifiers).then(sizeModifier),
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@Composable
|
|
90
|
+
private fun GradientSlotContent(props: ListItemSlotPropsRecord) {
|
|
91
|
+
GradientCircle(
|
|
92
|
+
text = props.text,
|
|
93
|
+
fontSize = props.fontSize,
|
|
94
|
+
sizeDp = props.size?.toFloat(),
|
|
95
|
+
lightColor = props.colors?.light?.compose,
|
|
96
|
+
darkColor = props.colors?.dark?.compose,
|
|
97
|
+
source = props.source,
|
|
98
|
+
iconSize = props.iconSize?.toFloat(),
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@Composable
|
|
103
|
+
private fun FunctionalComposableScope.TextSlotContent(
|
|
104
|
+
slotName: String,
|
|
105
|
+
props: ListItemSlotPropsRecord,
|
|
106
|
+
) {
|
|
107
|
+
val text = props.text ?: return
|
|
108
|
+
val spec = Typographies.specs[slotName.lowercase()]
|
|
109
|
+
|
|
110
|
+
Text(
|
|
111
|
+
text = text,
|
|
112
|
+
modifier = getModifier(props.modifiers).then(
|
|
113
|
+
if (slotName == "headlinecontent") Modifier.fillMaxWidth() else Modifier
|
|
114
|
+
),
|
|
115
|
+
maxLines = props.maxLines ?: spec?.maxLines ?: Int.MAX_VALUE,
|
|
116
|
+
overflow = props.overflow?.toComposeTextOverflow()
|
|
117
|
+
?: spec?.overflow?.toComposeTextOverflow()
|
|
118
|
+
?: TextOverflow.Clip,
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
private fun String.toComposeTextOverflow(): TextOverflow? = when (lowercase()) {
|
|
123
|
+
"clip" -> TextOverflow.Clip
|
|
124
|
+
"ellipsis" -> TextOverflow.Ellipsis
|
|
125
|
+
"visible" -> TextOverflow.Visible
|
|
126
|
+
else -> null
|
|
127
|
+
}
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
package expo.modules.pytechui.ListItem
|
|
2
|
-
|
|
3
|
-
import androidx.compose.foundation.layout.fillMaxWidth
|
|
4
|
-
import androidx.compose.runtime.Composable
|
|
5
|
-
import androidx.compose.ui.Modifier
|
|
6
|
-
import expo.modules.kotlin.views.ExpoComposeView
|
|
7
|
-
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
8
|
-
import expo.modules.ui.SlotView
|
|
9
|
-
|
|
10
|
-
import expo.modules.pytechui.getModifier
|
|
11
|
-
import expo.modules.pytechui.section.sectionItemPosition
|
|
12
|
-
import expo.modules.pytechui.ListItem.ListItemDynamic
|
|
13
|
-
import expo.modules.pytechui.ListItem.Decorator
|
|
14
|
-
import expo.modules.pytechui.ListItem.RenderSlot
|
|
15
|
-
import expo.modules.pytechui.findChildBySlotName
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// Crea el ListItem desde los slots
|
|
21
|
-
|
|
22
|
-
@Composable
|
|
23
|
-
internal fun FunctionalComposableScope.ListItemFromSlots(props: ListItemProps) {
|
|
24
|
-
val composeView = view as ExpoComposeView<*>
|
|
25
|
-
val sectionPosition = composeView.sectionItemPosition(props)
|
|
26
|
-
|
|
27
|
-
val isFirst = sectionPosition?.isFirst ?: (props.isFirst ?: true)
|
|
28
|
-
val isLast = sectionPosition?.isLast ?: (props.isLast ?: true)
|
|
29
|
-
|
|
30
|
-
val headlineSlot = findChildBySlotName("headlineContent")
|
|
31
|
-
val overlineSlot = findChildBySlotName("overlineContent")
|
|
32
|
-
val supportingSlot = findChildBySlotName("supportingContent")
|
|
33
|
-
val leadingSlot = findChildBySlotName("leadingContent")
|
|
34
|
-
val trailingSlot = findChildBySlotName("trailingContent")
|
|
35
|
-
Decorator(
|
|
36
|
-
isFirst = isFirst,
|
|
37
|
-
isLast = isLast,
|
|
38
|
-
showDivider = props.showDivider,
|
|
39
|
-
modifier = getModifier(props.modifiers),
|
|
40
|
-
) { innerProps ->
|
|
41
|
-
ListItemDynamic(
|
|
42
|
-
props = props,
|
|
43
|
-
modifier = Modifier.fillMaxWidth(),
|
|
44
|
-
innerProps = innerProps,
|
|
45
|
-
leadingContent = leadingSlot?.let { slot -> { RenderSlot(slot) } },
|
|
46
|
-
overlineContent = overlineSlot?.let { slot -> { RenderSlot(slot) } },
|
|
47
|
-
supportingContent = supportingSlot?.let { slot -> { RenderSlot(slot) } },
|
|
48
|
-
headlineContent = headlineSlot?.let { slot -> { RenderSlot(slot) } },
|
|
49
|
-
trailingContent = trailingSlot?.let { slot -> { RenderSlot(slot) } },
|
|
50
|
-
)
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
@Composable
|
|
56
|
-
internal fun FunctionalComposableScope.RenderSlot(slot: SlotView) {
|
|
57
|
-
with(composableScope) {
|
|
58
|
-
with(slot) { Content() }
|
|
59
|
-
}
|
|
60
|
-
}
|
|
1
|
+
package expo.modules.pytechui.ListItem
|
|
2
|
+
|
|
3
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
4
|
+
import androidx.compose.runtime.Composable
|
|
5
|
+
import androidx.compose.ui.Modifier
|
|
6
|
+
import expo.modules.kotlin.views.ExpoComposeView
|
|
7
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
8
|
+
import expo.modules.ui.SlotView
|
|
9
|
+
|
|
10
|
+
import expo.modules.pytechui.getModifier
|
|
11
|
+
import expo.modules.pytechui.section.sectionItemPosition
|
|
12
|
+
import expo.modules.pytechui.ListItem.ListItemDynamic
|
|
13
|
+
import expo.modules.pytechui.ListItem.Decorator
|
|
14
|
+
import expo.modules.pytechui.ListItem.RenderSlot
|
|
15
|
+
import expo.modules.pytechui.findChildBySlotName
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
// Crea el ListItem desde los slots
|
|
21
|
+
|
|
22
|
+
@Composable
|
|
23
|
+
internal fun FunctionalComposableScope.ListItemFromSlots(props: ListItemProps) {
|
|
24
|
+
val composeView = view as ExpoComposeView<*>
|
|
25
|
+
val sectionPosition = composeView.sectionItemPosition(props)
|
|
26
|
+
|
|
27
|
+
val isFirst = sectionPosition?.isFirst ?: (props.isFirst ?: true)
|
|
28
|
+
val isLast = sectionPosition?.isLast ?: (props.isLast ?: true)
|
|
29
|
+
|
|
30
|
+
val headlineSlot = findChildBySlotName("headlineContent")
|
|
31
|
+
val overlineSlot = findChildBySlotName("overlineContent")
|
|
32
|
+
val supportingSlot = findChildBySlotName("supportingContent")
|
|
33
|
+
val leadingSlot = findChildBySlotName("leadingContent")
|
|
34
|
+
val trailingSlot = findChildBySlotName("trailingContent")
|
|
35
|
+
Decorator(
|
|
36
|
+
isFirst = isFirst,
|
|
37
|
+
isLast = isLast,
|
|
38
|
+
showDivider = props.showDivider,
|
|
39
|
+
modifier = getModifier(props.modifiers),
|
|
40
|
+
) { innerProps ->
|
|
41
|
+
ListItemDynamic(
|
|
42
|
+
props = props,
|
|
43
|
+
modifier = Modifier.fillMaxWidth(),
|
|
44
|
+
innerProps = innerProps,
|
|
45
|
+
leadingContent = leadingSlot?.let { slot -> { RenderSlot(slot) } },
|
|
46
|
+
overlineContent = overlineSlot?.let { slot -> { RenderSlot(slot) } },
|
|
47
|
+
supportingContent = supportingSlot?.let { slot -> { RenderSlot(slot) } },
|
|
48
|
+
headlineContent = headlineSlot?.let { slot -> { RenderSlot(slot) } },
|
|
49
|
+
trailingContent = trailingSlot?.let { slot -> { RenderSlot(slot) } },
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@Composable
|
|
56
|
+
internal fun FunctionalComposableScope.RenderSlot(slot: SlotView) {
|
|
57
|
+
with(composableScope) {
|
|
58
|
+
with(slot) { Content() }
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
package expo.modules.pytechui.ListItem
|
|
2
|
-
|
|
3
|
-
import android.graphics.Color
|
|
4
|
-
import androidx.compose.ui.unit.Dp
|
|
5
|
-
import expo.modules.kotlin.records.Field
|
|
6
|
-
import expo.modules.kotlin.records.Record
|
|
7
|
-
import expo.modules.kotlin.types.OptimizedRecord
|
|
8
|
-
import expo.modules.kotlin.views.ComposeProps
|
|
9
|
-
import expo.modules.kotlin.views.OptimizedComposeProps
|
|
10
|
-
import expo.modules.ui.ModifierList
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@OptimizedRecord
|
|
15
|
-
data class ListItemColorsRecord(
|
|
16
|
-
@Field val containerColor: Color? = null,
|
|
17
|
-
@Field val contentColor: Color? = null,
|
|
18
|
-
@Field val leadingContentColor: Color? = null,
|
|
19
|
-
@Field val trailingContentColor: Color? = null,
|
|
20
|
-
@Field val supportingContentColor: Color? = null,
|
|
21
|
-
@Field val overlineContentColor: Color? = null,
|
|
22
|
-
) : Record
|
|
23
|
-
|
|
24
|
-
@OptimizedComposeProps
|
|
25
|
-
data class ListItemProps(
|
|
26
|
-
|
|
27
|
-
val showDivider: Boolean = true,
|
|
28
|
-
val isFirst: Boolean? = null,
|
|
29
|
-
val isLast: Boolean? = null,
|
|
30
|
-
val hasNavigationLink: Boolean? = null,
|
|
31
|
-
|
|
32
|
-
val tonalElevation: Float? = null,
|
|
33
|
-
val shadowElevation: Float? = null,
|
|
34
|
-
val colors: ListItemColorsRecord? = null,
|
|
35
|
-
val modifiers: ModifierList = emptyList(),
|
|
36
|
-
|
|
37
|
-
) : ComposeProps
|
|
38
|
-
|
|
39
|
-
/** Props internas de Kotlin; el callback no puede venir del bridge JS. */
|
|
40
|
-
internal data class ListItemInnerProps(
|
|
41
|
-
val onLeadingWidthChanged: ((Dp) -> Unit)? = null,
|
|
42
|
-
)
|
|
1
|
+
package expo.modules.pytechui.ListItem
|
|
2
|
+
|
|
3
|
+
import android.graphics.Color
|
|
4
|
+
import androidx.compose.ui.unit.Dp
|
|
5
|
+
import expo.modules.kotlin.records.Field
|
|
6
|
+
import expo.modules.kotlin.records.Record
|
|
7
|
+
import expo.modules.kotlin.types.OptimizedRecord
|
|
8
|
+
import expo.modules.kotlin.views.ComposeProps
|
|
9
|
+
import expo.modules.kotlin.views.OptimizedComposeProps
|
|
10
|
+
import expo.modules.ui.ModifierList
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@OptimizedRecord
|
|
15
|
+
data class ListItemColorsRecord(
|
|
16
|
+
@Field val containerColor: Color? = null,
|
|
17
|
+
@Field val contentColor: Color? = null,
|
|
18
|
+
@Field val leadingContentColor: Color? = null,
|
|
19
|
+
@Field val trailingContentColor: Color? = null,
|
|
20
|
+
@Field val supportingContentColor: Color? = null,
|
|
21
|
+
@Field val overlineContentColor: Color? = null,
|
|
22
|
+
) : Record
|
|
23
|
+
|
|
24
|
+
@OptimizedComposeProps
|
|
25
|
+
data class ListItemProps(
|
|
26
|
+
|
|
27
|
+
val showDivider: Boolean = true,
|
|
28
|
+
val isFirst: Boolean? = null,
|
|
29
|
+
val isLast: Boolean? = null,
|
|
30
|
+
val hasNavigationLink: Boolean? = null,
|
|
31
|
+
|
|
32
|
+
val tonalElevation: Float? = null,
|
|
33
|
+
val shadowElevation: Float? = null,
|
|
34
|
+
val colors: ListItemColorsRecord? = null,
|
|
35
|
+
val modifiers: ModifierList = emptyList(),
|
|
36
|
+
|
|
37
|
+
) : ComposeProps
|
|
38
|
+
|
|
39
|
+
/** Props internas de Kotlin; el callback no puede venir del bridge JS. */
|
|
40
|
+
internal data class ListItemInnerProps(
|
|
41
|
+
val onLeadingWidthChanged: ((Dp) -> Unit)? = null,
|
|
42
|
+
)
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
package expo.modules.pytechui.ListItem
|
|
2
|
-
|
|
3
|
-
import androidx.compose.foundation.background
|
|
4
|
-
import androidx.compose.foundation.layout.Column
|
|
5
|
-
import androidx.compose.foundation.layout.fillMaxWidth
|
|
6
|
-
import androidx.compose.runtime.Composable
|
|
7
|
-
import androidx.compose.runtime.getValue
|
|
8
|
-
import androidx.compose.runtime.mutableStateOf
|
|
9
|
-
import androidx.compose.runtime.remember
|
|
10
|
-
import androidx.compose.runtime.setValue
|
|
11
|
-
import androidx.compose.ui.Modifier
|
|
12
|
-
import androidx.compose.ui.draw.clip
|
|
13
|
-
import androidx.compose.ui.unit.dp
|
|
14
|
-
|
|
15
|
-
import expo.modules.pytechui.theme.ExtendedTheme
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/*
|
|
20
|
-
|
|
21
|
-
Decorator para el ListItem
|
|
22
|
-
|
|
23
|
-
Agrega:
|
|
24
|
-
|
|
25
|
-
- Background
|
|
26
|
-
- Shape
|
|
27
|
-
- Divider
|
|
28
|
-
|
|
29
|
-
Tiene la logica interna del LeadingWidth
|
|
30
|
-
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
@Composable
|
|
34
|
-
internal fun Decorator(
|
|
35
|
-
isFirst: Boolean,
|
|
36
|
-
isLast: Boolean,
|
|
37
|
-
showDivider: Boolean = true,
|
|
38
|
-
modifier: Modifier = Modifier,
|
|
39
|
-
content: @Composable (ListItemInnerProps) -> Unit,
|
|
40
|
-
|
|
41
|
-
) {
|
|
42
|
-
|
|
43
|
-
val shouldShowDivider = showDivider && !isLast
|
|
44
|
-
val backgroundColor = ExtendedTheme.colorScheme.secondarySystemGroupedBackground
|
|
45
|
-
val shape =
|
|
46
|
-
if (isFirst || isLast) {
|
|
47
|
-
itemClipShape(isFirst, isLast)
|
|
48
|
-
} else {
|
|
49
|
-
null
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
var leadingWidth by remember { mutableStateOf(0.dp) }
|
|
53
|
-
val shapeModifier = if (shape != null) {
|
|
54
|
-
Modifier.clip(shape).background(backgroundColor, shape)
|
|
55
|
-
} else {
|
|
56
|
-
Modifier.background(backgroundColor)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// clickable debe ir después de clip para que el ripple respete las esquinas
|
|
60
|
-
val rowModifier = Modifier
|
|
61
|
-
.fillMaxWidth()
|
|
62
|
-
.then(shapeModifier)
|
|
63
|
-
.then(modifier)
|
|
64
|
-
|
|
65
|
-
Column(modifier = rowModifier) {
|
|
66
|
-
content(
|
|
67
|
-
ListItemInnerProps(
|
|
68
|
-
onLeadingWidthChanged =
|
|
69
|
-
if (shouldShowDivider) {
|
|
70
|
-
{ width -> if (width != leadingWidth) { leadingWidth = width } }
|
|
71
|
-
} else {
|
|
72
|
-
null
|
|
73
|
-
},
|
|
74
|
-
),
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
if (shouldShowDivider) { ListItemDivider(leadingWidth = leadingWidth) }
|
|
78
|
-
}
|
|
79
|
-
}
|
|
1
|
+
package expo.modules.pytechui.ListItem
|
|
2
|
+
|
|
3
|
+
import androidx.compose.foundation.background
|
|
4
|
+
import androidx.compose.foundation.layout.Column
|
|
5
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
6
|
+
import androidx.compose.runtime.Composable
|
|
7
|
+
import androidx.compose.runtime.getValue
|
|
8
|
+
import androidx.compose.runtime.mutableStateOf
|
|
9
|
+
import androidx.compose.runtime.remember
|
|
10
|
+
import androidx.compose.runtime.setValue
|
|
11
|
+
import androidx.compose.ui.Modifier
|
|
12
|
+
import androidx.compose.ui.draw.clip
|
|
13
|
+
import androidx.compose.ui.unit.dp
|
|
14
|
+
|
|
15
|
+
import expo.modules.pytechui.theme.ExtendedTheme
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
|
|
21
|
+
Decorator para el ListItem
|
|
22
|
+
|
|
23
|
+
Agrega:
|
|
24
|
+
|
|
25
|
+
- Background
|
|
26
|
+
- Shape
|
|
27
|
+
- Divider
|
|
28
|
+
|
|
29
|
+
Tiene la logica interna del LeadingWidth
|
|
30
|
+
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
@Composable
|
|
34
|
+
internal fun Decorator(
|
|
35
|
+
isFirst: Boolean,
|
|
36
|
+
isLast: Boolean,
|
|
37
|
+
showDivider: Boolean = true,
|
|
38
|
+
modifier: Modifier = Modifier,
|
|
39
|
+
content: @Composable (ListItemInnerProps) -> Unit,
|
|
40
|
+
|
|
41
|
+
) {
|
|
42
|
+
|
|
43
|
+
val shouldShowDivider = showDivider && !isLast
|
|
44
|
+
val backgroundColor = ExtendedTheme.colorScheme.secondarySystemGroupedBackground
|
|
45
|
+
val shape =
|
|
46
|
+
if (isFirst || isLast) {
|
|
47
|
+
itemClipShape(isFirst, isLast)
|
|
48
|
+
} else {
|
|
49
|
+
null
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
var leadingWidth by remember { mutableStateOf(0.dp) }
|
|
53
|
+
val shapeModifier = if (shape != null) {
|
|
54
|
+
Modifier.clip(shape).background(backgroundColor, shape)
|
|
55
|
+
} else {
|
|
56
|
+
Modifier.background(backgroundColor)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// clickable debe ir después de clip para que el ripple respete las esquinas
|
|
60
|
+
val rowModifier = Modifier
|
|
61
|
+
.fillMaxWidth()
|
|
62
|
+
.then(shapeModifier)
|
|
63
|
+
.then(modifier)
|
|
64
|
+
|
|
65
|
+
Column(modifier = rowModifier) {
|
|
66
|
+
content(
|
|
67
|
+
ListItemInnerProps(
|
|
68
|
+
onLeadingWidthChanged =
|
|
69
|
+
if (shouldShowDivider) {
|
|
70
|
+
{ width -> if (width != leadingWidth) { leadingWidth = width } }
|
|
71
|
+
} else {
|
|
72
|
+
null
|
|
73
|
+
},
|
|
74
|
+
),
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
if (shouldShowDivider) { ListItemDivider(leadingWidth = leadingWidth) }
|
|
78
|
+
}
|
|
79
|
+
}
|