Remove dropdown menu sub content extra props (#2582)
This commit is contained in:
parent
0da21ea605
commit
71e4d539f6
@ -11,11 +11,11 @@ from reflex.vars import Var
|
||||
from ..base import (
|
||||
LiteralAccentColor,
|
||||
LiteralSize,
|
||||
LiteralVariant,
|
||||
RadixThemesComponent,
|
||||
)
|
||||
|
||||
LiteralCheckboxSize = Literal["1", "2", "3"]
|
||||
LiteralCheckboxVariant = Literal["classic", "surface", "soft"]
|
||||
|
||||
|
||||
class Checkbox(RadixThemesComponent):
|
||||
@ -26,16 +26,16 @@ class Checkbox(RadixThemesComponent):
|
||||
# Change the default rendered element for the one passed as a child, merging their props and behavior.
|
||||
as_child: Var[bool]
|
||||
|
||||
# Button size "1" - "3"
|
||||
# Checkbox size "1" - "3"
|
||||
size: Var[LiteralCheckboxSize]
|
||||
|
||||
# Variant of button: "solid" | "soft" | "outline" | "ghost"
|
||||
variant: Var[LiteralVariant]
|
||||
# Variant of checkbox: "classic" | "surface" | "soft"
|
||||
variant: Var[LiteralCheckboxVariant]
|
||||
|
||||
# Override theme color for button
|
||||
# Override theme color for checkbox
|
||||
color_scheme: Var[LiteralAccentColor]
|
||||
|
||||
# Whether to render the button with higher contrast color against background
|
||||
# Whether to render the checkbox with higher contrast color against background
|
||||
high_contrast: Var[bool]
|
||||
|
||||
# Whether the checkbox is checked by default
|
||||
@ -71,18 +71,64 @@ class Checkbox(RadixThemesComponent):
|
||||
}
|
||||
|
||||
|
||||
class HighLevelCheckbox(Checkbox):
|
||||
class HighLevelCheckbox(RadixThemesComponent):
|
||||
"""A checkbox component with a label."""
|
||||
|
||||
tag = "Checkbox"
|
||||
|
||||
# The text label for the checkbox.
|
||||
text: Var[str]
|
||||
|
||||
# The gap between the checkbox and the label.
|
||||
gap: Var[LiteralSize]
|
||||
|
||||
# The size of the checkbox.
|
||||
# The size of the checkbox "1" - "3".
|
||||
size: Var[LiteralCheckboxSize]
|
||||
|
||||
# Change the default rendered element for the one passed as a child, merging their props and behavior.
|
||||
as_child: Var[bool]
|
||||
|
||||
# Variant of checkbox: "classic" | "surface" | "soft"
|
||||
variant: Var[LiteralCheckboxVariant]
|
||||
|
||||
# Override theme color for checkbox
|
||||
color_scheme: Var[LiteralAccentColor]
|
||||
|
||||
# Whether to render the checkbox with higher contrast color against background
|
||||
high_contrast: Var[bool]
|
||||
|
||||
# Whether the checkbox is checked by default
|
||||
default_checked: Var[bool]
|
||||
|
||||
# Whether the checkbox is checked
|
||||
checked: Var[bool]
|
||||
|
||||
# Whether the checkbox is disabled
|
||||
disabled: Var[bool]
|
||||
|
||||
# Whether the checkbox is required
|
||||
required: Var[bool]
|
||||
|
||||
# The name of the checkbox control when submitting the form.
|
||||
name: Var[str]
|
||||
|
||||
# The value of the checkbox control when submitting the form.
|
||||
value: Var[str]
|
||||
|
||||
# Props to rename
|
||||
_rename_props = {"onChange": "onCheckedChange"}
|
||||
|
||||
def get_event_triggers(self) -> Dict[str, Any]:
|
||||
"""Get the events triggers signatures for the component.
|
||||
|
||||
Returns:
|
||||
The signatures of the event triggers.
|
||||
"""
|
||||
return {
|
||||
**super().get_event_triggers(),
|
||||
EventTriggers.ON_CHANGE: lambda e0: [e0],
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def create(cls, text: Var[str] = Var.create_safe(""), **props) -> Component:
|
||||
"""Create a checkbox with a label.
|
||||
|
@ -14,9 +14,10 @@ from reflex.components.radix.themes.layout.flex import Flex
|
||||
from reflex.components.radix.themes.typography.text import Text
|
||||
from reflex.constants import EventTriggers
|
||||
from reflex.vars import Var
|
||||
from ..base import LiteralAccentColor, LiteralSize, LiteralVariant, RadixThemesComponent
|
||||
from ..base import LiteralAccentColor, LiteralSize, RadixThemesComponent
|
||||
|
||||
LiteralCheckboxSize = Literal["1", "2", "3"]
|
||||
LiteralCheckboxVariant = Literal["classic", "surface", "soft"]
|
||||
|
||||
class Checkbox(RadixThemesComponent):
|
||||
def get_event_triggers(self) -> Dict[str, Any]: ...
|
||||
@ -94,8 +95,8 @@ class Checkbox(RadixThemesComponent):
|
||||
] = None,
|
||||
variant: Optional[
|
||||
Union[
|
||||
Var[Literal["classic", "solid", "soft", "surface", "outline", "ghost"]],
|
||||
Literal["classic", "solid", "soft", "surface", "outline", "ghost"],
|
||||
Var[Literal["classic", "surface", "soft"]],
|
||||
Literal["classic", "surface", "soft"],
|
||||
]
|
||||
] = None,
|
||||
high_contrast: Optional[Union[Var[bool], bool]] = None,
|
||||
@ -172,9 +173,9 @@ class Checkbox(RadixThemesComponent):
|
||||
color: map to CSS default color property.
|
||||
color_scheme: map to radix color property.
|
||||
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
||||
size: Button size "1" - "3"
|
||||
variant: Variant of button: "solid" | "soft" | "outline" | "ghost"
|
||||
high_contrast: Whether to render the button with higher contrast color against background
|
||||
size: Checkbox size "1" - "3"
|
||||
variant: Variant of checkbox: "classic" | "surface" | "soft"
|
||||
high_contrast: Whether to render the checkbox with higher contrast color against background
|
||||
default_checked: Whether the checkbox is checked by default
|
||||
checked: Whether the checkbox is checked
|
||||
disabled: Whether the checkbox is disabled
|
||||
@ -195,7 +196,8 @@ class Checkbox(RadixThemesComponent):
|
||||
"""
|
||||
...
|
||||
|
||||
class HighLevelCheckbox(Checkbox):
|
||||
class HighLevelCheckbox(RadixThemesComponent):
|
||||
def get_event_triggers(self) -> Dict[str, Any]: ...
|
||||
@overload
|
||||
@classmethod
|
||||
def create( # type: ignore
|
||||
@ -214,8 +216,8 @@ class HighLevelCheckbox(Checkbox):
|
||||
as_child: Optional[Union[Var[bool], bool]] = None,
|
||||
variant: Optional[
|
||||
Union[
|
||||
Var[Literal["classic", "solid", "soft", "surface", "outline", "ghost"]],
|
||||
Literal["classic", "solid", "soft", "surface", "outline", "ghost"],
|
||||
Var[Literal["classic", "surface", "soft"]],
|
||||
Literal["classic", "surface", "soft"],
|
||||
]
|
||||
] = None,
|
||||
color_scheme: Optional[
|
||||
@ -350,11 +352,11 @@ class HighLevelCheckbox(Checkbox):
|
||||
text: The text of the label.
|
||||
text: The text label for the checkbox.
|
||||
gap: The gap between the checkbox and the label.
|
||||
size: Button size "1" - "3"
|
||||
size: The size of the checkbox "1" - "3".
|
||||
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
||||
variant: Variant of button: "solid" | "soft" | "outline" | "ghost"
|
||||
color_scheme: Override theme color for button
|
||||
high_contrast: Whether to render the button with higher contrast color against background
|
||||
variant: Variant of checkbox: "classic" | "surface" | "soft"
|
||||
color_scheme: Override theme color for checkbox
|
||||
high_contrast: Whether to render the checkbox with higher contrast color against background
|
||||
default_checked: Whether the checkbox is checked by default
|
||||
checked: Whether the checkbox is checked
|
||||
disabled: Whether the checkbox is disabled
|
||||
@ -392,8 +394,8 @@ class CheckboxNamespace(SimpleNamespace):
|
||||
as_child: Optional[Union[Var[bool], bool]] = None,
|
||||
variant: Optional[
|
||||
Union[
|
||||
Var[Literal["classic", "solid", "soft", "surface", "outline", "ghost"]],
|
||||
Literal["classic", "solid", "soft", "surface", "outline", "ghost"],
|
||||
Var[Literal["classic", "surface", "soft"]],
|
||||
Literal["classic", "surface", "soft"],
|
||||
]
|
||||
] = None,
|
||||
color_scheme: Optional[
|
||||
@ -528,11 +530,11 @@ class CheckboxNamespace(SimpleNamespace):
|
||||
text: The text of the label.
|
||||
text: The text label for the checkbox.
|
||||
gap: The gap between the checkbox and the label.
|
||||
size: Button size "1" - "3"
|
||||
size: The size of the checkbox "1" - "3".
|
||||
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
||||
variant: Variant of button: "solid" | "soft" | "outline" | "ghost"
|
||||
color_scheme: Override theme color for button
|
||||
high_contrast: Whether to render the button with higher contrast color against background
|
||||
variant: Variant of checkbox: "classic" | "surface" | "soft"
|
||||
color_scheme: Override theme color for checkbox
|
||||
high_contrast: Whether to render the checkbox with higher contrast color against background
|
||||
default_checked: Whether the checkbox is checked by default
|
||||
checked: Whether the checkbox is checked
|
||||
disabled: Whether the checkbox is disabled
|
||||
|
@ -185,18 +185,6 @@ class DropdownMenuSubContent(RadixThemesComponent):
|
||||
|
||||
tag = "DropdownMenu.SubContent"
|
||||
|
||||
# Dropdown Menu Sub Content size "1" - "2"
|
||||
size: Var[LiteralSizeType]
|
||||
|
||||
# Variant of Dropdown Menu Sub Content: "solid" | "soft"
|
||||
variant: Var[LiteralVariantType]
|
||||
|
||||
# Override theme color for Dropdown Menu Sub Content
|
||||
color_scheme: Var[LiteralAccentColor]
|
||||
|
||||
# Whether to render the component with higher contrast color against background
|
||||
high_contrast: Var[bool]
|
||||
|
||||
# Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False.
|
||||
as_child: Var[bool]
|
||||
|
||||
|
@ -915,11 +915,6 @@ class DropdownMenuSubContent(RadixThemesComponent):
|
||||
],
|
||||
]
|
||||
] = None,
|
||||
size: Optional[Union[Var[Literal["1", "2"]], Literal["1", "2"]]] = None,
|
||||
variant: Optional[
|
||||
Union[Var[Literal["solid", "soft"]], Literal["solid", "soft"]]
|
||||
] = None,
|
||||
high_contrast: Optional[Union[Var[bool], bool]] = None,
|
||||
as_child: Optional[Union[Var[bool], bool]] = None,
|
||||
loop: Optional[Union[Var[bool], bool]] = None,
|
||||
force_mount: Optional[Union[Var[bool], bool]] = None,
|
||||
@ -1014,9 +1009,6 @@ class DropdownMenuSubContent(RadixThemesComponent):
|
||||
*children: Child components.
|
||||
color: map to CSS default color property.
|
||||
color_scheme: map to radix color property.
|
||||
size: Dropdown Menu Sub Content size "1" - "2"
|
||||
variant: Variant of Dropdown Menu Sub Content: "solid" | "soft"
|
||||
high_contrast: Whether to render the component with higher contrast color against background
|
||||
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior. Defaults to False.
|
||||
loop: When True, keyboard navigation will loop from last item to first, and vice versa. Defaults to False.
|
||||
force_mount: Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.
|
||||
|
Loading…
Reference in New Issue
Block a user