File tree Expand file tree Collapse file tree 3 files changed +11
-21
lines changed
compose-multiplatform-material/src
androidxCommonMain/kotlin/com/huanshankeji/compose/material
commonMain/kotlin/com/huanshankeji/compose/material
jsMain/kotlin/com/huanshankeji/compose/material Expand file tree Collapse file tree 3 files changed +11
-21
lines changed Original file line number Diff line number Diff line change 11package com.huanshankeji.compose.material
22
33import androidx.compose.runtime.Composable
4- import com.huanshankeji.compose.ui.Element
5- import com.huanshankeji.compose.ui.ModifierOrAttrs
6- import com.huanshankeji.compose.ui.toModifier
7-
8- actual abstract class TextFieldElement : Element ()
4+ import com.huanshankeji.compose.ui.Modifier
95
106@Composable
117actual fun TextField (
128 value : String ,
139 onValueChange : (String ) -> Unit ,
14- modifierOrAttrs : ModifierOrAttrs < TextFieldElement > ,
10+ modifier : Modifier ,
1511 enabled : Boolean ,
1612 label : String? ,
1713 leadingIcon : @Composable (() -> Unit )? ,
@@ -20,7 +16,7 @@ actual fun TextField(
2016 androidx.compose.material.TextField (
2117 value,
2218 onValueChange,
23- modifierOrAttrs.toModifier() ,
19+ modifier.platformModifier ,
2420 enabled = enabled,
2521 label = label?.let { { Text (it) } },
2622 leadingIcon = leadingIcon,
Original file line number Diff line number Diff line change 11package com.huanshankeji.compose.material
22
33import androidx.compose.runtime.Composable
4- import com.huanshankeji.compose.ui.Element
5- import com.huanshankeji.compose.ui.ModifierOrAttrs
6-
7- expect abstract class TextFieldElement : Element
4+ import com.huanshankeji.compose.ui.Modifier
85
96@Composable
107expect fun TextField (
118 value : String ,
129 onValueChange : (String ) -> Unit ,
13- modifierOrAttrs : ModifierOrAttrs < TextFieldElement > = null ,
10+ modifier : Modifier = Modifier ,
1411 enabled : Boolean = true,
1512 label : String? = null,
1613 /*
14+ // These 2 are not the same thing.
1715 placeholder: String? = null,
1816 helperText: String? = null,
1917 */
2018 leadingIcon : @Composable (() -> Unit )? = null,
21- trailingIcon : @Composable (() -> Unit )? = null,
19+ trailingIcon : @Composable (() -> Unit )? = null
2220)
Original file line number Diff line number Diff line change 11package com.huanshankeji.compose.material
22
33import androidx.compose.runtime.Composable
4- import com.huanshankeji.compose.ui.ModifierOrAttrs
5- import com.huanshankeji .compose.ui.toAttrs
4+ import com.huanshankeji.compose.ui.Modifier
5+ import com.varabyte.kobweb .compose.ui.toAttrs
66import dev.petuska.kmdc.textfield.MDCTextField
7- import org.w3c.dom.HTMLInputElement
8-
9- actual typealias TextFieldElement = HTMLInputElement
107
118@Composable
129actual fun TextField (
1310 value : String ,
1411 onValueChange : (String ) -> Unit ,
15- modifierOrAttrs : ModifierOrAttrs < TextFieldElement > ,
12+ modifier : Modifier ,
1613 enabled : Boolean ,
1714 label : String? ,
1815 leadingIcon : @Composable (() -> Unit )? ,
1916 trailingIcon : @Composable (() -> Unit )? ,
2017) =
2118 MDCTextField (value,
22- attrs = {
19+ attrs = modifier.platformModifier.toAttrs {
2320 onInput { onValueChange(it.value) }
24- modifierOrAttrs.toAttrs()?.let { it() }
2521 },
2622 disabled = ! enabled,
2723 label = label,
You can’t perform that action at this time.
0 commit comments