11package com.huanshankeji.compose.html.material3
22
3- import androidx.compose.runtime.Composable
4- import com.huanshankeji.compose.web.attributes.Attrs
5- import com.huanshankeji.compose.web.attributes.attr
6- import com.huanshankeji.compose.web.attributes.ext.label
7- import com.huanshankeji.compose.web.attributes.slot
8- import org.jetbrains.compose.web.attributes.AttrsScope
93import org.jetbrains.compose.web.dom.ElementScope
10- import org.jetbrains.compose.web. dom.TagElement
4+ import org.w3c. dom.Element
115import org.w3c.dom.HTMLElement
126
137/*
@@ -16,57 +10,17 @@ https://material-web.dev/components/fab/
1610https://material-web.dev/components/fab/stories/
1711 */
1812
19- @Composable
20- private fun CommonMdFab (
21- tagName : String ,
22- variant : String? ,
23- size : String? ,
24- label : String? ,
25- lowered : Boolean? ,
26- attrs : Attrs <HTMLElement >? ,
27- content : @Composable (MdFabScope .() -> Unit )?
28- ) =
29- TagElement (tagName, {
30- variant?.let { attr(" variant" , it) }
31- size?.let { attr(" size" , it) }
32- label?.let { label(it) }
33- lowered?.let { attr(" lowered" , it) }
34-
35- attrs?.invoke(this )
36- }, content?.let {
37- { MdFabScope (this ).it() }
38- })
39-
40- @Composable
41- fun MdFab (
42- variant : String? = null,
43- size : String? = null,
44- label : String? = null,
45- lowered : Boolean? = null,
46- attrs : Attrs <HTMLElement >? = null,
47- content : @Composable (MdFabScope .() -> Unit )?
48- ) {
49- require(" @material/web/fab/fab.js" )
50-
51- CommonMdFab (" md-fab" , variant, size, label, lowered, attrs, content)
52- }
53-
54- @Composable
55- fun MdBrandedFab (
56- variant : String? = null,
57- size : String? = null,
58- label : String? = null,
59- lowered : Boolean? = null,
60- attrs : Attrs <HTMLElement >? = null,
61- content : @Composable (MdFabScope .() -> Unit )?
13+ fun <TElement : Element > SimplifiedTagElement (
14+ content : (ElementScope <TElement >.() -> Unit )?
6215) {
63- require(" @material/web/fab/branded-fab.js" )
64-
65- CommonMdFab (" md-branded-fab" , variant, size, label, lowered, attrs, content)
16+ TODO ()
6617}
6718
19+ class MdFabScope (val elementScope : ElementScope <HTMLElement >)
6820
69- class MdFabScope (val elementScope : ElementScope <HTMLElement >) {
70- fun AttrsScope <* >.slotEqIcon () =
71- slot(" icon" )
72- }
21+ private fun SimplifiedMdFab (
22+ content : (MdFabScope .() -> Unit )?
23+ ) =
24+ SimplifiedTagElement (content?.let {
25+ { MdFabScope (this ).it() }
26+ })
0 commit comments