File tree Expand file tree Collapse file tree 3 files changed +6
-16
lines changed
compose-html-material3/src/jsMain/kotlin/com/huanshankeji/compose/html/material3 Expand file tree Collapse file tree 3 files changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -16,10 +16,6 @@ https://material-web.dev/components/fab/
1616https://material-web.dev/components/fab/stories/
1717 */
1818
19- // a workaround for probably a bug, needed since Kotlin 2.0.0 because of "Cannot infer type for this parameter. Please specify it explicitly."
20- private fun (@Composable MdFabScope .() -> Unit ).toHTMLElementContent(): @Composable ElementScope <HTMLElement >.() -> Unit =
21- { MdFabScope (this ).this @toHTMLElementContent() }
22-
2319@Composable
2420private fun CommonMdFab (
2521 tagName : String ,
@@ -37,7 +33,9 @@ private fun CommonMdFab(
3733 lowered?.let { attr(" lowered" , it) }
3834
3935 attrs?.invoke(this )
40- }, content?.toHTMLElementContent())
36+ }, content?.let {
37+ { MdFabScope (this ).it() }
38+ })
4139
4240@Composable
4341fun MdFab (
Original file line number Diff line number Diff line change @@ -16,10 +16,6 @@ https://github.com/material-components/material-web/blob/main/labs/navigationtab
1616https://github.com/material-components/material-web/blob/main/labs/navigationbar/demo/stories.ts (navigation bar storybook)
1717 */
1818
19- // a workaround for probably a bug, needed since Kotlin 2.0.0 because of "Cannot infer type for this parameter. Please specify it explicitly."
20- private fun (@Composable MdNavigationTabScope .() -> Unit ).toHTMLElementContent(): @Composable ElementScope <HTMLElement >.() -> Unit =
21- { MdNavigationTabScope (this ).(this @toHTMLElementContent)() }
22-
2319@MaterialWebLabsApi
2420@Composable
2521fun MdNavigationTab (
@@ -43,7 +39,7 @@ fun MdNavigationTab(
4339 attrIfNotNull(" show-badge" , showBadge)
4440
4541 attrs?.invoke(this )
46- }, content?.toHTMLElementContent() )
42+ }, content?.let { { MdNavigationTabScope ( this ).it() } } )
4743}
4844
4945class MdNavigationTabScope (val elementScope : ElementScope <HTMLElement >) {
Original file line number Diff line number Diff line change @@ -19,10 +19,6 @@ https://material-web.dev/components/text-field/
1919https://material-web.dev/components/text-field/stories/
2020*/
2121
22- // a workaround for probably a bug, needed since Kotlin 2.0.0 because of "Cannot infer type for this parameter. Please specify it explicitly."
23- private fun (@Composable MdTextFieldScope .() -> Unit ).toHTMLElementContent(): @Composable ElementScope <HTMLElement >.() -> Unit =
24- { MdTextFieldScope (this ).(this @toHTMLElementContent)() }
25-
2622@Composable
2723private fun CommonTextField (
2824 tagName : String ,
@@ -53,7 +49,7 @@ private fun CommonTextField(
5349 type : InputType <* >? ,
5450 autocomplete : AutoComplete ? ,
5551 attrs : Attrs <HTMLElement >? ,
56- content : @Composable ( MdTextFieldScope .() -> Unit )?
52+ content : ( @Composable MdTextFieldScope .() -> Unit )?
5753) =
5854 TagElement (tagName, {
5955 disabled(disabled)
@@ -84,7 +80,7 @@ private fun CommonTextField(
8480 autoComplete(autocomplete)
8581
8682 attrs?.invoke(this )
87- }, content?.toHTMLElementContent() )
83+ }, content?.let { { MdTextFieldScope ( this ).it() } } )
8884
8985@Composable
9086fun MdFilledTextField (
You can’t perform that action at this time.
0 commit comments