fix match import in iconbutton (#2552)
This commit is contained in:
parent
2b7e7450f8
commit
798b72825d
@ -1,4 +1,5 @@
|
||||
"""rx.match."""
|
||||
|
||||
import textwrap
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
|
||||
|
@ -6,7 +6,7 @@ from types import SimpleNamespace
|
||||
from typing import Any, Dict, List, Literal
|
||||
|
||||
from reflex.components.component import Component
|
||||
from reflex.components.core import match
|
||||
from reflex.components.core.match import Match
|
||||
from reflex.components.lucide.icon import Icon
|
||||
from reflex.components.radix.primitives.base import RadixPrimitiveComponent
|
||||
from reflex.components.radix.themes.base import LiteralAccentColor
|
||||
@ -37,7 +37,7 @@ def get_theme_accordion_root(variant: Var[str], color_scheme: Var[str]) -> BaseV
|
||||
Returns:
|
||||
The theme for the accordion root component.
|
||||
"""
|
||||
return match( # type: ignore
|
||||
return Match.create( # type: ignore
|
||||
variant,
|
||||
(
|
||||
"soft",
|
||||
@ -86,7 +86,7 @@ def get_theme_accordion_root(variant: Var[str], color_scheme: Var[str]) -> BaseV
|
||||
"background_color": f"var(--{color_scheme}-9)",
|
||||
"box_shadow": "0 2px 10px var(--black-a4)",
|
||||
}
|
||||
)
|
||||
),
|
||||
# defaults to classic
|
||||
)
|
||||
|
||||
@ -140,7 +140,7 @@ def get_theme_accordion_trigger(variant: str | Var, color_scheme: str | Var) ->
|
||||
Returns:
|
||||
The theme for the accordion trigger component.
|
||||
"""
|
||||
return match( # type: ignore
|
||||
return Match.create( # type: ignore
|
||||
variant,
|
||||
(
|
||||
"soft",
|
||||
@ -240,7 +240,7 @@ def get_theme_accordion_content(variant: str | Var, color_scheme: str | Var) ->
|
||||
Returns:
|
||||
The theme for the accordion content component.
|
||||
"""
|
||||
return match( # type: ignore
|
||||
return Match.create( # type: ignore
|
||||
variant,
|
||||
(
|
||||
"outline",
|
||||
@ -270,12 +270,12 @@ def get_theme_accordion_content(variant: str | Var, color_scheme: str | Var) ->
|
||||
{
|
||||
"overflow": "hidden",
|
||||
"font_size": "10px",
|
||||
"color": match(
|
||||
"color": Match.create(
|
||||
variant,
|
||||
("classic", f"var(--{color_scheme}-9-contrast)"),
|
||||
f"var(--{color_scheme}-11)",
|
||||
),
|
||||
"background_color": match(
|
||||
"background_color": Match.create(
|
||||
variant,
|
||||
("classic", f"var(--{color_scheme}-9)"),
|
||||
f"var(--{color_scheme}-3)",
|
||||
@ -344,7 +344,7 @@ class AccordionRoot(AccordionComponent):
|
||||
# The var_data associated with the component.
|
||||
_var_data: VarData = VarData() # type: ignore
|
||||
|
||||
_valid_children: List[str] = ["AccordionItem"]
|
||||
_valid_children: List[str] = ["AccordionItem", "Foreach"]
|
||||
|
||||
@classmethod
|
||||
def create(cls, *children, **props) -> Component:
|
||||
|
@ -10,7 +10,7 @@ from reflex.style import Style
|
||||
from types import SimpleNamespace
|
||||
from typing import Any, Dict, List, Literal
|
||||
from reflex.components.component import Component
|
||||
from reflex.components.core import match
|
||||
from reflex.components.core.match import Match
|
||||
from reflex.components.lucide.icon import Icon
|
||||
from reflex.components.radix.primitives.base import RadixPrimitiveComponent
|
||||
from reflex.components.radix.themes.base import LiteralAccentColor
|
||||
|
@ -4,7 +4,7 @@ from typing import Literal
|
||||
|
||||
from reflex import el
|
||||
from reflex.components.component import Component
|
||||
from reflex.components.core import match
|
||||
from reflex.components.core.match import Match
|
||||
from reflex.components.lucide import Icon
|
||||
from reflex.style import Style
|
||||
from reflex.vars import Var
|
||||
@ -77,7 +77,7 @@ class IconButton(el.Button, RadixThemesComponent):
|
||||
}
|
||||
children[0].size = RADIX_TO_LUCIDE_SIZE[props["size"]]
|
||||
else:
|
||||
children[0].size = match(
|
||||
children[0].size = Match.create(
|
||||
props["size"],
|
||||
("1", "12px"),
|
||||
("2", "24px"),
|
||||
|
@ -10,7 +10,7 @@ from reflex.style import Style
|
||||
from typing import Literal
|
||||
from reflex import el
|
||||
from reflex.components.component import Component
|
||||
from reflex.components.core import match
|
||||
from reflex.components.core.match import Match
|
||||
from reflex.components.lucide import Icon
|
||||
from reflex.style import Style
|
||||
from reflex.vars import Var
|
||||
|
Loading…
Reference in New Issue
Block a user