Clean up Radix Avatar components props (#2375)

* clean up some props for some radix components

* pyi
This commit is contained in:
Martin Xu 2024-01-11 11:26:43 -08:00 committed by GitHub
parent c81fa261b2
commit a53af00480
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 25 additions and 23 deletions

View File

@ -11,8 +11,6 @@ from ..base import (
RadixThemesComponent,
)
LiteralSwitchSize = Literal["1", "2", "3", "4"]
class Avatar(CommonMarginProps, RadixThemesComponent):
"""A toggle switch alternative to the checkbox."""
@ -22,7 +20,7 @@ class Avatar(CommonMarginProps, RadixThemesComponent):
# The variant of the avatar
variant: Var[Literal["solid", "soft"]]
# The size of the avatar
# The size of the avatar: "1" - "9"
size: Var[LiteralSize]
# Color theme of the avatar
@ -33,3 +31,9 @@ class Avatar(CommonMarginProps, RadixThemesComponent):
# Override theme radius for avatar: "none" | "small" | "medium" | "large" | "full"
radius: Var[LiteralRadius]
# The src of the avatar image
src: Var[str]
# The rendered fallback text
fallback: Var[str]

View File

@ -17,8 +17,6 @@ from ..base import (
RadixThemesComponent,
)
LiteralSwitchSize = Literal["1", "2", "3", "4"]
class Avatar(CommonMarginProps, RadixThemesComponent):
@overload
@classmethod
@ -104,6 +102,8 @@ class Avatar(CommonMarginProps, RadixThemesComponent):
Literal["none", "small", "medium", "large", "full"],
]
] = None,
src: Optional[Union[Var[str], str]] = None,
fallback: Optional[Union[Var[str], str]] = None,
m: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
@ -209,9 +209,11 @@ class Avatar(CommonMarginProps, RadixThemesComponent):
color: map to CSS default color property.
color_scheme: map to radix color property.
variant: The variant of the avatar
size: The size of the avatar
size: The size of the avatar: "1" - "9"
high_contrast: Whether to render the avatar with higher contrast color against background
radius: Override theme radius for avatar: "none" | "small" | "medium" | "large" | "full"
src: The src of the avatar image
fallback: The rendered fallback text
m: Margin: "0" - "9"
mx: Margin horizontal: "0" - "9"
my: Margin vertical: "0" - "9"

View File

@ -11,25 +11,23 @@ from ..base import (
RadixThemesComponent,
)
LiteralSwitchSize = Literal["1", "2", "3", "4"]
class Badge(el.Span, CommonMarginProps, RadixThemesComponent):
"""A toggle switch alternative to the checkbox."""
tag = "Badge"
# The variant of the avatar
# The variant of the badge
variant: Var[Literal["solid", "soft", "surface", "outline"]]
# The size of the avatar
# The size of the badge
size: Var[Literal["1", "2"]]
# Color theme of the avatar
# Color theme of the badge
color: Var[LiteralAccentColor]
# Whether to render the avatar with higher contrast color against background
# Whether to render the badge with higher contrast color against background
high_contrast: Var[bool]
# Override theme radius for avatar: "none" | "small" | "medium" | "large" | "full"
# Override theme radius for badge: "none" | "small" | "medium" | "large" | "full"
radius: Var[LiteralRadius]

View File

@ -17,8 +17,6 @@ from ..base import (
RadixThemesComponent,
)
LiteralSwitchSize = Literal["1", "2", "3", "4"]
class Badge(el.Span, CommonMarginProps, RadixThemesComponent):
@overload
@classmethod
@ -249,10 +247,10 @@ class Badge(el.Span, CommonMarginProps, RadixThemesComponent):
*children: Child components.
color: map to CSS default color property.
color_scheme: map to radix color property.
variant: The variant of the avatar
size: The size of the avatar
high_contrast: Whether to render the avatar with higher contrast color against background
radius: Override theme radius for avatar: "none" | "small" | "medium" | "large" | "full"
variant: The variant of the badge
size: The size of the badge
high_contrast: Whether to render the badge with higher contrast color against background
radius: Override theme radius for badge: "none" | "small" | "medium" | "large" | "full"
access_key: Provides a hint for generating a keyboard shortcut for the current element.
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
content_editable: Indicates whether the element's content is editable.

View File

@ -50,7 +50,7 @@ class DialogContent(el.Div, CommonMarginProps, RadixThemesComponent):
tag = "Dialog.Content"
# Button size "1" - "4"
# DialogContent size "1" - "4"
size: Var[Literal[1, 2, 3, 4]]
def get_event_triggers(self) -> Dict[str, Any]:

View File

@ -832,7 +832,7 @@ class DialogContent(el.Div, CommonMarginProps, RadixThemesComponent):
*children: Child components.
color: map to CSS default color property.
color_scheme: map to radix color property.
size: Button size "1" - "4"
size: DialogContent size "1" - "4"
access_key: Provides a hint for generating a keyboard shortcut for the current element.
auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
content_editable: Indicates whether the element's content is editable.

View File

@ -26,7 +26,7 @@ class IconButton(el.Button, CommonMarginProps, RadixThemesComponent):
# Button size "1" - "4"
size: Var[LiteralButtonSize]
# Variant of button: "solid" | "soft" | "outline" | "ghost"
# Variant of button: "classic" | "solid" | "soft" | "surface" | "outline" | "ghost"
variant: Var[LiteralVariant]
# Override theme color for button

View File

@ -282,7 +282,7 @@ class IconButton(el.Button, CommonMarginProps, RadixThemesComponent):
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" - "4"
variant: Variant of button: "solid" | "soft" | "outline" | "ghost"
variant: Variant of button: "classic" | "solid" | "soft" | "surface" | "outline" | "ghost"
high_contrast: Whether to render the button with higher contrast color against background
radius: Override theme radius for button: "none" | "small" | "medium" | "large" | "full"
auto_focus: Automatically focuses the button when the page loads