@expo/ui 55.0.2 → 55.0.3
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/CHANGELOG.md +31 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/AnimatedVisibilityView.kt +130 -0
- package/android/src/main/java/expo/modules/ui/CardView.kt +138 -34
- package/android/src/main/java/expo/modules/ui/CheckboxView.kt +98 -0
- package/android/src/main/java/expo/modules/ui/ChipView.kt +267 -142
- package/android/src/main/java/expo/modules/ui/DatePickerView.kt +258 -70
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +204 -57
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +44 -1
- package/android/src/main/java/expo/modules/ui/ProgressView.kt +189 -89
- package/android/src/main/java/expo/modules/ui/RadioButtonView.kt +3 -7
- package/android/src/main/java/expo/modules/ui/SegmentedButtonView.kt +115 -0
- package/android/src/main/java/expo/modules/ui/SegmentedControlView.kt +35 -0
- package/android/src/main/java/expo/modules/ui/SliderView.kt +70 -12
- package/android/src/main/java/expo/modules/ui/SwitchView.kt +53 -161
- package/android/src/main/java/expo/modules/ui/ToggleButtonView.kt +95 -57
- package/android/src/main/java/expo/modules/ui/button/Button.kt +117 -158
- package/android/src/main/java/expo/modules/ui/button/FloatingActionButton.kt +92 -0
- package/android/src/main/java/expo/modules/ui/button/IconButton.kt +73 -86
- package/android/src/main/java/expo/modules/ui/menu/DropdownMenu.kt +39 -0
- package/android/src/main/java/expo/modules/ui/menu/DropdownMenuItem.kt +70 -0
- package/android/src/main/java/expo/modules/ui/menu/DropdownMenuRecords.kt +18 -0
- package/build/jetpack-compose/AnimatedVisibility/index.d.ts +134 -0
- package/build/jetpack-compose/AnimatedVisibility/index.d.ts.map +1 -0
- package/build/jetpack-compose/AnimatedVisibility/symbols.d.ts +3 -0
- package/build/jetpack-compose/AnimatedVisibility/symbols.d.ts.map +1 -0
- package/build/jetpack-compose/Button/index.d.ts +65 -51
- package/build/jetpack-compose/Button/index.d.ts.map +1 -1
- package/build/jetpack-compose/Card/index.d.ts +72 -14
- package/build/jetpack-compose/Card/index.d.ts.map +1 -1
- package/build/jetpack-compose/Checkbox/index.d.ts +73 -0
- package/build/jetpack-compose/Checkbox/index.d.ts.map +1 -0
- package/build/jetpack-compose/Chip/index.d.ts +247 -27
- package/build/jetpack-compose/Chip/index.d.ts.map +1 -1
- package/build/jetpack-compose/DatePicker/index.d.ts +38 -3
- package/build/jetpack-compose/DatePicker/index.d.ts.map +1 -1
- package/build/jetpack-compose/DropdownMenu/DropdownMenuItem.d.ts +70 -0
- package/build/jetpack-compose/DropdownMenu/DropdownMenuItem.d.ts.map +1 -0
- package/build/jetpack-compose/DropdownMenu/index.d.ts +68 -0
- package/build/jetpack-compose/DropdownMenu/index.d.ts.map +1 -0
- package/build/jetpack-compose/FloatingActionButton/index.d.ts +150 -0
- package/build/jetpack-compose/FloatingActionButton/index.d.ts.map +1 -0
- package/build/jetpack-compose/HorizontalFloatingToolbar/index.d.ts +2 -2
- package/build/jetpack-compose/HorizontalFloatingToolbar/index.d.ts.map +1 -1
- package/build/jetpack-compose/IconButton/index.d.ts +45 -29
- package/build/jetpack-compose/IconButton/index.d.ts.map +1 -1
- package/build/jetpack-compose/MultiChoiceSegmentedButtonRow/index.d.ts +17 -0
- package/build/jetpack-compose/MultiChoiceSegmentedButtonRow/index.d.ts.map +1 -0
- package/build/jetpack-compose/Progress/index.d.ts +78 -35
- package/build/jetpack-compose/Progress/index.d.ts.map +1 -1
- package/build/jetpack-compose/RadioButton/index.d.ts +2 -2
- package/build/jetpack-compose/RadioButton/index.d.ts.map +1 -1
- package/build/jetpack-compose/SegmentedButton/index.d.ts +74 -0
- package/build/jetpack-compose/SegmentedButton/index.d.ts.map +1 -0
- package/build/jetpack-compose/SingleChoiceSegmentedButtonRow/index.d.ts +17 -0
- package/build/jetpack-compose/SingleChoiceSegmentedButtonRow/index.d.ts.map +1 -0
- package/build/jetpack-compose/Slider/index.d.ts +34 -10
- package/build/jetpack-compose/Slider/index.d.ts.map +1 -1
- package/build/jetpack-compose/Switch/index.d.ts +10 -50
- package/build/jetpack-compose/Switch/index.d.ts.map +1 -1
- package/build/jetpack-compose/ToggleButton/index.d.ts +60 -32
- package/build/jetpack-compose/ToggleButton/index.d.ts.map +1 -1
- package/build/jetpack-compose/index.d.ts +5 -4
- package/build/jetpack-compose/index.d.ts.map +1 -1
- package/build/jetpack-compose/modifiers/index.d.ts +18 -1
- package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/ProgressView/index.d.ts +1 -5
- package/build/swift-ui/ProgressView/index.d.ts.map +1 -1
- package/build/swift-ui/Stepper/index.d.ts +3 -3
- package/build/swift-ui/Stepper/index.d.ts.map +1 -1
- package/build/swift-ui/Text/index.d.ts +33 -1
- package/build/swift-ui/Text/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +22 -1
- package/build/swift-ui/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/shapes/index.d.ts +2 -2
- package/build/swift-ui/types.d.ts +7 -0
- package/build/swift-ui/types.d.ts.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/BottomSheetView.swift +1 -6
- package/ios/ClosedRangeDateRecord.swift +10 -0
- package/ios/ColorPickerView.swift +9 -8
- package/ios/ConfirmationDialog/ConfirmationDialog.swift +4 -6
- package/ios/DatePickerView.swift +7 -5
- package/ios/DisclosureGroupView.swift +5 -7
- package/ios/ListView.swift +6 -14
- package/ios/Modifiers/DefaultScrollAnchorForRoleModifier.swift +32 -0
- package/ios/Modifiers/DefaultScrollAnchorModifier.swift +16 -0
- package/ios/Modifiers/ViewModifierRegistry.swift +8 -0
- package/ios/Picker/PickerView.swift +6 -10
- package/ios/Popover/PopoverView.swift +3 -5
- package/ios/ProgressView.swift +0 -5
- package/ios/SectionView.swift +3 -5
- package/ios/SliderView.swift +8 -6
- package/ios/StepperView.swift +12 -16
- package/ios/TextView.swift +37 -1
- package/ios/Toggle/ToggleView.swift +5 -7
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.2/expo.modules.ui-55.0.2.module → 55.0.3/expo.modules.ui-55.0.3.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.2/expo.modules.ui-55.0.2.pom → 55.0.3/expo.modules.ui-55.0.3.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
- package/package.json +5 -2
- package/src/jetpack-compose/AnimatedVisibility/index.tsx +206 -0
- package/src/jetpack-compose/AnimatedVisibility/symbols.ts +8 -0
- package/src/jetpack-compose/Button/index.tsx +69 -92
- package/src/jetpack-compose/Card/index.tsx +105 -29
- package/src/jetpack-compose/Checkbox/index.tsx +126 -0
- package/src/jetpack-compose/Chip/index.tsx +391 -51
- package/src/jetpack-compose/DatePicker/index.tsx +112 -7
- package/src/jetpack-compose/DropdownMenu/DropdownMenuItem.tsx +126 -0
- package/src/jetpack-compose/DropdownMenu/index.tsx +107 -0
- package/src/jetpack-compose/FloatingActionButton/index.tsx +207 -0
- package/src/jetpack-compose/HorizontalFloatingToolbar/index.tsx +4 -2
- package/src/jetpack-compose/IconButton/index.tsx +49 -56
- package/src/jetpack-compose/MultiChoiceSegmentedButtonRow/index.tsx +34 -0
- package/src/jetpack-compose/Progress/index.tsx +120 -62
- package/src/jetpack-compose/RadioButton/index.tsx +8 -9
- package/src/jetpack-compose/SegmentedButton/index.tsx +109 -0
- package/src/jetpack-compose/SingleChoiceSegmentedButtonRow/index.tsx +34 -0
- package/src/jetpack-compose/Slider/index.tsx +76 -29
- package/src/jetpack-compose/Switch/index.tsx +17 -87
- package/src/jetpack-compose/ToggleButton/index.tsx +67 -43
- package/src/jetpack-compose/index.ts +5 -4
- package/src/jetpack-compose/modifiers/index.ts +26 -2
- package/src/swift-ui/ProgressView/index.tsx +1 -3
- package/src/swift-ui/Stepper/index.tsx +7 -7
- package/src/swift-ui/Text/index.tsx +66 -2
- package/src/swift-ui/modifiers/index.ts +40 -0
- package/src/swift-ui/types.ts +5 -0
- package/android/src/main/java/expo/modules/ui/FilterChipView.kt +0 -59
- package/android/src/main/java/expo/modules/ui/PickerView.kt +0 -161
- package/android/src/main/java/expo/modules/ui/TextButtonView.kt +0 -33
- package/android/src/main/java/expo/modules/ui/menu/ContextMenu.kt +0 -183
- package/android/src/main/java/expo/modules/ui/menu/ContextMenuRecords.kt +0 -64
- package/build/jetpack-compose/Button/types.d.ts +0 -5
- package/build/jetpack-compose/Button/types.d.ts.map +0 -1
- package/build/jetpack-compose/ContextMenu/Submenu.d.ts +0 -17
- package/build/jetpack-compose/ContextMenu/Submenu.d.ts.map +0 -1
- package/build/jetpack-compose/ContextMenu/index.d.ts +0 -65
- package/build/jetpack-compose/ContextMenu/index.d.ts.map +0 -1
- package/build/jetpack-compose/ContextMenu/utils.d.ts +0 -24
- package/build/jetpack-compose/ContextMenu/utils.d.ts.map +0 -1
- package/build/jetpack-compose/FilterChip/index.d.ts +0 -49
- package/build/jetpack-compose/FilterChip/index.d.ts.map +0 -1
- package/build/jetpack-compose/Picker/index.d.ts +0 -62
- package/build/jetpack-compose/Picker/index.d.ts.map +0 -1
- package/build/jetpack-compose/TextButton/index.d.ts +0 -29
- package/build/jetpack-compose/TextButton/index.d.ts.map +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.sha512 +0 -1
- package/src/jetpack-compose/Button/types.ts +0 -57
- package/src/jetpack-compose/ContextMenu/Submenu.tsx +0 -21
- package/src/jetpack-compose/ContextMenu/index.tsx +0 -149
- package/src/jetpack-compose/ContextMenu/utils.ts +0 -144
- package/src/jetpack-compose/FilterChip/index.tsx +0 -89
- package/src/jetpack-compose/Picker/index.tsx +0 -90
- package/src/jetpack-compose/TextButton/index.tsx +0 -55
|
@@ -1,184 +1,309 @@
|
|
|
1
1
|
package expo.modules.ui
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import androidx.compose.foundation.
|
|
5
|
-
import androidx.compose.foundation.layout.size
|
|
6
|
-
import androidx.compose.foundation.layout.wrapContentSize
|
|
3
|
+
import android.graphics.Color
|
|
4
|
+
import androidx.compose.foundation.BorderStroke
|
|
7
5
|
import androidx.compose.material3.AssistChip
|
|
8
6
|
import androidx.compose.material3.AssistChipDefaults
|
|
9
7
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
10
8
|
import androidx.compose.material3.FilterChip
|
|
11
9
|
import androidx.compose.material3.FilterChipDefaults
|
|
12
|
-
import androidx.compose.material3.Icon
|
|
13
10
|
import androidx.compose.material3.InputChip
|
|
14
|
-
import androidx.compose.material3.
|
|
11
|
+
import androidx.compose.material3.InputChipDefaults
|
|
15
12
|
import androidx.compose.material3.SuggestionChip
|
|
16
|
-
import androidx.compose.material3.
|
|
13
|
+
import androidx.compose.material3.SuggestionChipDefaults
|
|
17
14
|
import androidx.compose.runtime.Composable
|
|
18
|
-
import androidx.compose.ui.
|
|
19
|
-
import androidx.compose.ui.Modifier
|
|
20
|
-
import androidx.compose.ui.graphics.Color
|
|
21
|
-
import androidx.compose.ui.text.style.TextAlign
|
|
15
|
+
import androidx.compose.ui.graphics.Color as ComposeColor
|
|
22
16
|
import androidx.compose.ui.unit.dp
|
|
17
|
+
import expo.modules.kotlin.records.Field
|
|
23
18
|
import expo.modules.kotlin.records.Record
|
|
19
|
+
import expo.modules.kotlin.views.ComposableScope
|
|
24
20
|
import expo.modules.kotlin.views.ComposeProps
|
|
25
21
|
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
26
22
|
import java.io.Serializable
|
|
27
23
|
|
|
28
24
|
open class ChipPressedEvent : Record, Serializable
|
|
29
25
|
|
|
30
|
-
|
|
31
|
-
val
|
|
32
|
-
val
|
|
33
|
-
val
|
|
34
|
-
val
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
class AssistChipColors : Record {
|
|
27
|
+
@Field val containerColor: Color? = null
|
|
28
|
+
@Field val labelColor: Color? = null
|
|
29
|
+
@Field val leadingIconContentColor: Color? = null
|
|
30
|
+
@Field val trailingIconContentColor: Color? = null
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
class FilterChipColors : Record {
|
|
34
|
+
@Field val containerColor: Color? = null
|
|
35
|
+
@Field val labelColor: Color? = null
|
|
36
|
+
@Field val iconColor: Color? = null
|
|
37
|
+
@Field val selectedContainerColor: Color? = null
|
|
38
|
+
@Field val selectedLabelColor: Color? = null
|
|
39
|
+
@Field val selectedLeadingIconColor: Color? = null
|
|
40
|
+
@Field val selectedTrailingIconColor: Color? = null
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
class InputChipColors : Record {
|
|
44
|
+
@Field val containerColor: Color? = null
|
|
45
|
+
@Field val labelColor: Color? = null
|
|
46
|
+
@Field val leadingIconColor: Color? = null
|
|
47
|
+
@Field val trailingIconColor: Color? = null
|
|
48
|
+
@Field val selectedContainerColor: Color? = null
|
|
49
|
+
@Field val selectedLabelColor: Color? = null
|
|
50
|
+
@Field val selectedLeadingIconColor: Color? = null
|
|
51
|
+
@Field val selectedTrailingIconColor: Color? = null
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
class SuggestionChipColors : Record {
|
|
55
|
+
@Field val containerColor: Color? = null
|
|
56
|
+
@Field val labelColor: Color? = null
|
|
57
|
+
@Field val iconContentColor: Color? = null
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
class ChipBorder : Record {
|
|
61
|
+
@Field val width: Float = 1f
|
|
62
|
+
@Field val color: Color? = null
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private fun FunctionalComposableScope.slotContent(slotName: String): (@Composable () -> Unit)? {
|
|
66
|
+
return findChildSlotView(view, slotName)?.let { slotView ->
|
|
67
|
+
{
|
|
68
|
+
with(ComposableScope()) {
|
|
69
|
+
with(slotView) {
|
|
70
|
+
Content()
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// region AssistChip
|
|
78
|
+
|
|
79
|
+
data class AssistChipProps(
|
|
37
80
|
val enabled: Boolean = true,
|
|
38
|
-
val
|
|
81
|
+
val colors: AssistChipColors = AssistChipColors(),
|
|
82
|
+
val elevation: Float? = null,
|
|
83
|
+
val border: ChipBorder? = null,
|
|
39
84
|
val modifiers: ModifierList = emptyList()
|
|
40
85
|
) : ComposeProps
|
|
41
86
|
|
|
42
|
-
@OptIn(ExperimentalMaterial3Api::class)
|
|
43
87
|
@Composable
|
|
44
|
-
fun FunctionalComposableScope.
|
|
45
|
-
props:
|
|
46
|
-
onPress: (ChipPressedEvent) -> Unit
|
|
47
|
-
onDismiss: (ChipPressedEvent) -> Unit
|
|
88
|
+
fun FunctionalComposableScope.AssistChipContent(
|
|
89
|
+
props: AssistChipProps,
|
|
90
|
+
onPress: (ChipPressedEvent) -> Unit
|
|
48
91
|
) {
|
|
49
|
-
val
|
|
50
|
-
.padding(4.dp)
|
|
51
|
-
.wrapContentSize(Alignment.Center)
|
|
52
|
-
|
|
53
|
-
@Composable
|
|
54
|
-
fun AssistChipComposable() {
|
|
55
|
-
AssistChip(
|
|
56
|
-
onClick = { onPress(ChipPressedEvent()) },
|
|
57
|
-
label = { ChipText(label = props.label, textStyle = props.textStyle) },
|
|
58
|
-
leadingIcon = {
|
|
59
|
-
props.leadingIcon?.let {
|
|
60
|
-
ChipIcon(iconName = it, iconSize = props.iconSize)
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
trailingIcon = {
|
|
64
|
-
props.trailingIcon?.let {
|
|
65
|
-
ChipIcon(iconName = it, iconSize = props.iconSize)
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
enabled = props.enabled,
|
|
69
|
-
colors = AssistChipDefaults.assistChipColors(),
|
|
70
|
-
border = AssistChipDefaults.assistChipBorder(enabled = props.enabled),
|
|
71
|
-
modifier = chipModifier
|
|
72
|
-
)
|
|
73
|
-
}
|
|
92
|
+
val modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
74
93
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
null
|
|
87
|
-
},
|
|
88
|
-
trailingIcon = {
|
|
89
|
-
props.trailingIcon?.let {
|
|
90
|
-
ChipIcon(iconName = it, iconSize = props.iconSize)
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
enabled = props.enabled,
|
|
94
|
-
colors = FilterChipDefaults.filterChipColors(),
|
|
95
|
-
border = FilterChipDefaults.filterChipBorder(enabled = props.enabled, selected = props.selected),
|
|
96
|
-
modifier = chipModifier
|
|
97
|
-
)
|
|
94
|
+
val colors = AssistChipDefaults.assistChipColors(
|
|
95
|
+
containerColor = props.colors.containerColor.composeOrNull ?: ComposeColor.Unspecified,
|
|
96
|
+
labelColor = props.colors.labelColor.composeOrNull ?: ComposeColor.Unspecified,
|
|
97
|
+
leadingIconContentColor = props.colors.leadingIconContentColor.composeOrNull ?: ComposeColor.Unspecified,
|
|
98
|
+
trailingIconContentColor = props.colors.trailingIconContentColor.composeOrNull ?: ComposeColor.Unspecified
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
val elevation = if (props.elevation != null) {
|
|
102
|
+
AssistChipDefaults.assistChipElevation(elevation = props.elevation.dp)
|
|
103
|
+
} else {
|
|
104
|
+
AssistChipDefaults.assistChipElevation()
|
|
98
105
|
}
|
|
99
106
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
props.leadingIcon?.let {
|
|
110
|
-
ChipIcon(iconName = it, iconSize = props.iconSize)
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
trailingIcon = {
|
|
114
|
-
ChipIcon(
|
|
115
|
-
iconName = props.trailingIcon ?: "filled.Close",
|
|
116
|
-
iconSize = props.iconSize
|
|
117
|
-
)
|
|
118
|
-
},
|
|
119
|
-
modifier = chipModifier
|
|
120
|
-
)
|
|
107
|
+
val border = if (props.border != null) {
|
|
108
|
+
val borderColor = props.border.color.composeOrNull
|
|
109
|
+
if (borderColor != null) {
|
|
110
|
+
BorderStroke(props.border.width.dp, borderColor)
|
|
111
|
+
} else {
|
|
112
|
+
AssistChipDefaults.assistChipBorder(enabled = props.enabled, borderWidth = props.border.width.dp)
|
|
113
|
+
}
|
|
114
|
+
} else {
|
|
115
|
+
AssistChipDefaults.assistChipBorder(enabled = props.enabled)
|
|
121
116
|
}
|
|
122
117
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
118
|
+
AssistChip(
|
|
119
|
+
onClick = { onPress(ChipPressedEvent()) },
|
|
120
|
+
label = slotContent("label") ?: {},
|
|
121
|
+
leadingIcon = slotContent("leadingIcon"),
|
|
122
|
+
trailingIcon = slotContent("trailingIcon"),
|
|
123
|
+
enabled = props.enabled,
|
|
124
|
+
colors = colors,
|
|
125
|
+
elevation = elevation,
|
|
126
|
+
border = border,
|
|
127
|
+
modifier = modifier
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// endregion
|
|
132
|
+
|
|
133
|
+
// region FilterChip
|
|
134
|
+
|
|
135
|
+
data class FilterChipProps(
|
|
136
|
+
val selected: Boolean = false,
|
|
137
|
+
val enabled: Boolean = true,
|
|
138
|
+
val colors: FilterChipColors = FilterChipColors(),
|
|
139
|
+
val elevation: Float? = null,
|
|
140
|
+
val border: ChipBorder? = null,
|
|
141
|
+
val modifiers: ModifierList = emptyList()
|
|
142
|
+
) : ComposeProps
|
|
143
|
+
|
|
144
|
+
@Composable
|
|
145
|
+
fun FunctionalComposableScope.FilterChipContent(
|
|
146
|
+
props: FilterChipProps,
|
|
147
|
+
onPress: (ChipPressedEvent) -> Unit
|
|
148
|
+
) {
|
|
149
|
+
val modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
150
|
+
|
|
151
|
+
val colors = FilterChipDefaults.filterChipColors(
|
|
152
|
+
containerColor = props.colors.containerColor.composeOrNull ?: ComposeColor.Unspecified,
|
|
153
|
+
labelColor = props.colors.labelColor.composeOrNull ?: ComposeColor.Unspecified,
|
|
154
|
+
iconColor = props.colors.iconColor.composeOrNull ?: ComposeColor.Unspecified,
|
|
155
|
+
selectedContainerColor = props.colors.selectedContainerColor.composeOrNull ?: ComposeColor.Unspecified,
|
|
156
|
+
selectedLabelColor = props.colors.selectedLabelColor.composeOrNull ?: ComposeColor.Unspecified,
|
|
157
|
+
selectedLeadingIconColor = props.colors.selectedLeadingIconColor.composeOrNull ?: ComposeColor.Unspecified,
|
|
158
|
+
selectedTrailingIconColor = props.colors.selectedTrailingIconColor.composeOrNull ?: ComposeColor.Unspecified
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
val elevation = if (props.elevation != null) {
|
|
162
|
+
FilterChipDefaults.filterChipElevation(elevation = props.elevation.dp)
|
|
163
|
+
} else {
|
|
164
|
+
FilterChipDefaults.filterChipElevation()
|
|
135
165
|
}
|
|
136
166
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
167
|
+
val border = if (props.border != null) {
|
|
168
|
+
val borderColor = props.border.color.composeOrNull
|
|
169
|
+
if (borderColor != null) {
|
|
170
|
+
BorderStroke(props.border.width.dp, borderColor)
|
|
171
|
+
} else {
|
|
172
|
+
FilterChipDefaults.filterChipBorder(enabled = props.enabled, selected = props.selected, borderWidth = props.border.width.dp)
|
|
173
|
+
}
|
|
174
|
+
} else {
|
|
175
|
+
FilterChipDefaults.filterChipBorder(enabled = props.enabled, selected = props.selected)
|
|
143
176
|
}
|
|
177
|
+
|
|
178
|
+
FilterChip(
|
|
179
|
+
selected = props.selected,
|
|
180
|
+
onClick = { onPress(ChipPressedEvent()) },
|
|
181
|
+
label = slotContent("label") ?: {},
|
|
182
|
+
leadingIcon = slotContent("leadingIcon"),
|
|
183
|
+
trailingIcon = slotContent("trailingIcon"),
|
|
184
|
+
enabled = props.enabled,
|
|
185
|
+
colors = colors,
|
|
186
|
+
elevation = elevation,
|
|
187
|
+
border = border,
|
|
188
|
+
modifier = modifier
|
|
189
|
+
)
|
|
144
190
|
}
|
|
145
191
|
|
|
192
|
+
// endregion
|
|
193
|
+
|
|
194
|
+
// region InputChip
|
|
195
|
+
|
|
196
|
+
data class InputChipProps(
|
|
197
|
+
val enabled: Boolean = true,
|
|
198
|
+
val selected: Boolean = false,
|
|
199
|
+
val colors: InputChipColors = InputChipColors(),
|
|
200
|
+
val elevation: Float? = null,
|
|
201
|
+
val border: ChipBorder? = null,
|
|
202
|
+
val modifiers: ModifierList = emptyList()
|
|
203
|
+
) : ComposeProps
|
|
204
|
+
|
|
205
|
+
@OptIn(ExperimentalMaterial3Api::class)
|
|
146
206
|
@Composable
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
207
|
+
fun FunctionalComposableScope.InputChipContent(
|
|
208
|
+
props: InputChipProps,
|
|
209
|
+
onPress: (ChipPressedEvent) -> Unit
|
|
210
|
+
) {
|
|
211
|
+
val modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
212
|
+
|
|
213
|
+
val colors = InputChipDefaults.inputChipColors(
|
|
214
|
+
containerColor = props.colors.containerColor.composeOrNull ?: ComposeColor.Unspecified,
|
|
215
|
+
labelColor = props.colors.labelColor.composeOrNull ?: ComposeColor.Unspecified,
|
|
216
|
+
leadingIconColor = props.colors.leadingIconColor.composeOrNull ?: ComposeColor.Unspecified,
|
|
217
|
+
trailingIconColor = props.colors.trailingIconColor.composeOrNull ?: ComposeColor.Unspecified,
|
|
218
|
+
selectedContainerColor = props.colors.selectedContainerColor.composeOrNull ?: ComposeColor.Unspecified,
|
|
219
|
+
selectedLabelColor = props.colors.selectedLabelColor.composeOrNull ?: ComposeColor.Unspecified,
|
|
220
|
+
selectedLeadingIconColor = props.colors.selectedLeadingIconColor.composeOrNull ?: ComposeColor.Unspecified,
|
|
221
|
+
selectedTrailingIconColor = props.colors.selectedTrailingIconColor.composeOrNull ?: ComposeColor.Unspecified
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
val elevation = if (props.elevation != null) {
|
|
225
|
+
InputChipDefaults.inputChipElevation(elevation = props.elevation.dp)
|
|
226
|
+
} else {
|
|
227
|
+
InputChipDefaults.inputChipElevation()
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
val border = if (props.border != null) {
|
|
231
|
+
val borderColor = props.border.color.composeOrNull
|
|
232
|
+
if (borderColor != null) {
|
|
233
|
+
BorderStroke(props.border.width.dp, borderColor)
|
|
234
|
+
} else {
|
|
235
|
+
InputChipDefaults.inputChipBorder(enabled = props.enabled, selected = props.selected, borderWidth = props.border.width.dp)
|
|
236
|
+
}
|
|
237
|
+
} else {
|
|
238
|
+
InputChipDefaults.inputChipBorder(enabled = props.enabled, selected = props.selected)
|
|
164
239
|
}
|
|
240
|
+
|
|
241
|
+
InputChip(
|
|
242
|
+
onClick = { onPress(ChipPressedEvent()) },
|
|
243
|
+
label = slotContent("label") ?: {},
|
|
244
|
+
enabled = props.enabled,
|
|
245
|
+
selected = props.selected,
|
|
246
|
+
avatar = slotContent("avatar"),
|
|
247
|
+
trailingIcon = slotContent("trailingIcon"),
|
|
248
|
+
colors = colors,
|
|
249
|
+
elevation = elevation,
|
|
250
|
+
border = border,
|
|
251
|
+
modifier = modifier
|
|
252
|
+
)
|
|
165
253
|
}
|
|
166
254
|
|
|
255
|
+
// endregion
|
|
256
|
+
|
|
257
|
+
// region SuggestionChip
|
|
258
|
+
|
|
259
|
+
data class SuggestionChipProps(
|
|
260
|
+
val enabled: Boolean = true,
|
|
261
|
+
val colors: SuggestionChipColors = SuggestionChipColors(),
|
|
262
|
+
val elevation: Float? = null,
|
|
263
|
+
val border: ChipBorder? = null,
|
|
264
|
+
val modifiers: ModifierList = emptyList()
|
|
265
|
+
) : ComposeProps
|
|
266
|
+
|
|
167
267
|
@Composable
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
tint: Color = MaterialTheme.colorScheme.primary,
|
|
172
|
-
modifier: Modifier = Modifier
|
|
268
|
+
fun FunctionalComposableScope.SuggestionChipContent(
|
|
269
|
+
props: SuggestionChipProps,
|
|
270
|
+
onPress: (ChipPressedEvent) -> Unit
|
|
173
271
|
) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
272
|
+
val modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
273
|
+
|
|
274
|
+
val colors = SuggestionChipDefaults.suggestionChipColors(
|
|
275
|
+
containerColor = props.colors.containerColor.composeOrNull ?: ComposeColor.Unspecified,
|
|
276
|
+
labelColor = props.colors.labelColor.composeOrNull ?: ComposeColor.Unspecified,
|
|
277
|
+
iconContentColor = props.colors.iconContentColor.composeOrNull ?: ComposeColor.Unspecified
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
val elevation = if (props.elevation != null) {
|
|
281
|
+
SuggestionChipDefaults.suggestionChipElevation(elevation = props.elevation.dp)
|
|
282
|
+
} else {
|
|
283
|
+
SuggestionChipDefaults.suggestionChipElevation()
|
|
183
284
|
}
|
|
285
|
+
|
|
286
|
+
val border = if (props.border != null) {
|
|
287
|
+
val borderColor = props.border.color.composeOrNull
|
|
288
|
+
if (borderColor != null) {
|
|
289
|
+
BorderStroke(props.border.width.dp, borderColor)
|
|
290
|
+
} else {
|
|
291
|
+
SuggestionChipDefaults.suggestionChipBorder(enabled = props.enabled, borderWidth = props.border.width.dp)
|
|
292
|
+
}
|
|
293
|
+
} else {
|
|
294
|
+
SuggestionChipDefaults.suggestionChipBorder(enabled = props.enabled)
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
SuggestionChip(
|
|
298
|
+
onClick = { onPress(ChipPressedEvent()) },
|
|
299
|
+
label = slotContent("label") ?: {},
|
|
300
|
+
icon = slotContent("icon"),
|
|
301
|
+
enabled = props.enabled,
|
|
302
|
+
colors = colors,
|
|
303
|
+
elevation = elevation,
|
|
304
|
+
border = border,
|
|
305
|
+
modifier = modifier
|
|
306
|
+
)
|
|
184
307
|
}
|
|
308
|
+
|
|
309
|
+
// endregion
|