Fixing bugs in radix (#2316)

This commit is contained in:
Tom Gotsman 2023-12-20 13:52:56 -08:00 committed by GitHub
parent 8ac08e2cb4
commit 5c5d17df59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 564 additions and 42 deletions

View File

@ -25,6 +25,7 @@ from .contextmenu import (
ContextMenuTrigger,
)
from .dialog import (
DialogClose,
DialogContent,
DialogDescription,
DialogRoot,
@ -57,6 +58,7 @@ from .select import (
SelectTrigger,
)
from .separator import Separator
from .slider import Slider
from .switch import Switch
from .table import (
TableBody,
@ -67,9 +69,10 @@ from .table import (
TableRow,
TableRowHeaderCell,
)
from .tabs import TabsList, TabsRoot, TabsTrigger
from .tabs import TabsContent, TabsList, TabsRoot, TabsTrigger
from .textarea import TextArea
from .textfield import TextFieldInput, TextFieldRoot, TextFieldSlot
from .tooltip import Tooltip
# Alert Dialog
alertdialog = AlertDialog.create
@ -118,6 +121,7 @@ dialog_trigger = DialogTrigger.create
dialog_content = DialogContent.create
dialog_title = DialogTitle.create
dialog_description = DialogDescription.create
dialog_close = DialogClose.create
# Dropdown Menu
dropdownmenu_root = DropdownMenuRoot.create
@ -167,6 +171,9 @@ select_label = SelectLabel.create
# Separator
separator = Separator.create
# Slider
slider = Slider.create
# Switch
switch = Switch.create
@ -183,6 +190,7 @@ table_row_header_cell = TableRowHeaderCell.create
tabs_root = TabsRoot.create
tabs_list = TabsList.create
tabs_trigger = TabsTrigger.create
tabs_content = TabsContent.create
# Text Area
textarea = TextArea.create
@ -191,3 +199,6 @@ textarea = TextArea.create
textfield_root = TextFieldRoot.create
textfield_input = TextFieldInput.create
textfield_slot = TextFieldSlot.create
# Tooltip
tooltip = Tooltip.create

View File

@ -17,4 +17,4 @@ class AspectRatio(CommonMarginProps, RadixThemesComponent):
tag = "AspectRatio"
# The ratio of the width to the height of the element
ration: Var[Union[float, int]]
ratio: Var[Union[float, int]]

View File

@ -82,7 +82,7 @@ class AspectRatio(CommonMarginProps, RadixThemesComponent):
],
]
] = None,
ration: Optional[Union[Var[Union[float, int]], Union[float, int]]] = None,
ratio: Optional[Union[Var[Union[float, int]], Union[float, int]]] = None,
m: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
@ -187,7 +187,7 @@ class AspectRatio(CommonMarginProps, RadixThemesComponent):
*children: Child components.
color: map to CSS default color property.
color_scheme: map to radix color property.
ration: The ratio of the width to the height of the element
ratio: The ratio of the width to the height of the element
m: Margin: "0" - "9"
mx: Margin horizontal: "0" - "9"
my: Margin vertical: "0" - "9"

View File

@ -19,9 +19,6 @@ class Avatar(CommonMarginProps, RadixThemesComponent):
tag = "Avatar"
# The ratio of the width to the height of the element
ration: Var[float]
# The variant of the avatar
variant: Var[Literal["solid", "soft"]]

View File

@ -88,7 +88,6 @@ class Avatar(CommonMarginProps, RadixThemesComponent):
],
]
] = None,
ration: Optional[Union[Var[float], float]] = None,
variant: Optional[
Union[Var[Literal["solid", "soft"]], Literal["solid", "soft"]]
] = None,
@ -209,7 +208,6 @@ class Avatar(CommonMarginProps, RadixThemesComponent):
*children: Child components.
color: map to CSS default color property.
color_scheme: map to radix color property.
ration: The ratio of the width to the height of the element
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

View File

@ -19,14 +19,11 @@ class Badge(el.Span, CommonMarginProps, RadixThemesComponent):
tag = "Badge"
# The ratio of the width to the height of the element
ration: Var[float]
# The variant of the avatar
variant: Var[Literal["solid", "soft", "surface", "outline"]]
# The size of the avatar
size: Var[Literal[1, 2]]
size: Var[Literal["1", "2"]]
# Color theme of the avatar
color: Var[LiteralAccentColor]

View File

@ -88,14 +88,13 @@ class Badge(el.Span, CommonMarginProps, RadixThemesComponent):
],
]
] = None,
ration: Optional[Union[Var[float], float]] = None,
variant: Optional[
Union[
Var[Literal["solid", "soft", "surface", "outline"]],
Literal["solid", "soft", "surface", "outline"],
]
] = None,
size: Optional[Union[Var[Literal[1, 2]], Literal[1, 2]]] = None,
size: Optional[Union[Var[Literal["1", "2"]], Literal["1", "2"]]] = None,
high_contrast: Optional[Union[Var[bool], bool]] = None,
radius: Optional[
Union[
@ -250,7 +249,6 @@ class Badge(el.Span, CommonMarginProps, RadixThemesComponent):
*children: Child components.
color: map to CSS default color property.
color_scheme: map to radix color property.
ration: The ratio of the width to the height of the element
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

View File

@ -12,7 +12,7 @@ from ..base import (
RadixThemesComponent,
)
LiteralButtonSize = Literal[1, 2, 3, 4]
LiteralButtonSize = Literal["1", "2", "3", "4"]
class Button(el.Button, CommonMarginProps, RadixThemesComponent):

View File

@ -18,7 +18,7 @@ from ..base import (
RadixThemesComponent,
)
LiteralButtonSize = Literal[1, 2, 3, 4]
LiteralButtonSize = Literal["1", "2", "3", "4"]
class Button(el.Button, CommonMarginProps, RadixThemesComponent):
@overload
@ -90,7 +90,9 @@ class Button(el.Button, CommonMarginProps, RadixThemesComponent):
]
] = None,
as_child: Optional[Union[Var[bool], bool]] = None,
size: Optional[Union[Var[Literal[1, 2, 3, 4]], Literal[1, 2, 3, 4]]] = None,
size: Optional[
Union[Var[Literal["1", "2", "3", "4"]], Literal["1", "2", "3", "4"]]
] = None,
variant: Optional[
Union[
Var[Literal["classic", "solid", "soft", "surface", "outline", "ghost"]],

View File

@ -19,7 +19,7 @@ class Card(el.Div, CommonMarginProps, RadixThemesComponent):
as_child: Var[bool]
# Button size "1" - "5"
size: Var[Literal[1, 2, 3, 4, 5]]
size: Var[Literal["1", "2", "3", "4", "5"]]
# Variant of button: "solid" | "soft" | "outline" | "ghost"
variant: Var[Literal["surface", "classic", "ghost"]]

View File

@ -83,7 +83,9 @@ class Card(el.Div, CommonMarginProps, RadixThemesComponent):
] = None,
as_child: Optional[Union[Var[bool], bool]] = None,
size: Optional[
Union[Var[Literal[1, 2, 3, 4, 5]], Literal[1, 2, 3, 4, 5]]
Union[
Var[Literal["1", "2", "3", "4", "5"]], Literal["1", "2", "3", "4", "5"]
]
] = None,
variant: Optional[
Union[

View File

@ -73,3 +73,9 @@ class DialogDescription(CommonMarginProps, RadixThemesComponent):
"""Trigger an action or event, such as submitting a form or displaying a dialog."""
tag = "Dialog.Description"
class DialogClose(CommonMarginProps, RadixThemesComponent):
"""Trigger an action or event, such as submitting a form or displaying a dialog."""
tag = "Dialog.Close"

View File

@ -1062,3 +1062,196 @@ class DialogDescription(CommonMarginProps, RadixThemesComponent):
A new component instance.
"""
...
class DialogClose(CommonMarginProps, RadixThemesComponent):
@overload
@classmethod
def create( # type: ignore
cls,
*children,
color: Optional[Union[Var[str], str]] = None,
color_scheme: Optional[
Union[
Var[
Literal[
"tomato",
"red",
"ruby",
"crimson",
"pink",
"plum",
"purple",
"violet",
"iris",
"indigo",
"blue",
"cyan",
"teal",
"jade",
"green",
"grass",
"brown",
"orange",
"sky",
"mint",
"lime",
"yellow",
"amber",
"gold",
"bronze",
"gray",
]
],
Literal[
"tomato",
"red",
"ruby",
"crimson",
"pink",
"plum",
"purple",
"violet",
"iris",
"indigo",
"blue",
"cyan",
"teal",
"jade",
"green",
"grass",
"brown",
"orange",
"sky",
"mint",
"lime",
"yellow",
"amber",
"gold",
"bronze",
"gray",
],
]
] = None,
m: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
]
] = None,
mx: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
]
] = None,
my: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
]
] = None,
mt: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
]
] = None,
mr: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
]
] = None,
mb: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
]
] = None,
ml: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
]
] = None,
style: Optional[Style] = None,
key: Optional[Any] = None,
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
on_blur: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_click: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_context_menu: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_double_click: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_focus: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mount: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_down: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_enter: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_leave: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_move: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_out: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_over: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_up: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_scroll: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_unmount: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
**props
) -> "DialogClose":
"""Create a new component instance.
Will prepend "RadixThemes" to the component tag to avoid conflicts with
other UI libraries for common names, like Text and Button.
Args:
*children: Child components.
color: map to CSS default color property.
color_scheme: map to radix color property.
m: Margin: "0" - "9"
mx: Margin horizontal: "0" - "9"
my: Margin vertical: "0" - "9"
mt: Margin top: "0" - "9"
mr: Margin right: "0" - "9"
mb: Margin bottom: "0" - "9"
ml: Margin left: "0" - "9"
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
class_name: The class name for the component.
autofocus: Whether the component should take the focus once the page is loaded
custom_attrs: custom attribute
**props: Component properties.
Returns:
A new component instance.
"""
...

View File

@ -16,7 +16,7 @@ class RadioGroupRoot(CommonMarginProps, RadixThemesComponent):
tag = "RadioGroup.Root"
# The size of the radio group: "1" | "2" | "3"
size: Var[Literal[1, 2, 3]]
size: Var[Literal["1", "2", "3"]]
# The variant of the radio group
variant: Var[Literal["classic", "surface", "soft"]]

View File

@ -81,7 +81,9 @@ class RadioGroupRoot(CommonMarginProps, RadixThemesComponent):
],
]
] = None,
size: Optional[Union[Var[Literal[1, 2, 3]], Literal[1, 2, 3]]] = None,
size: Optional[
Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
] = None,
variant: Optional[
Union[
Var[Literal["classic", "surface", "soft"]],

View File

@ -1,5 +1,5 @@
"""Interactive components provided by @radix-ui/themes."""
from typing import Any, Dict, Literal
from typing import Any, Dict, List, Literal
from reflex.vars import Var
@ -19,8 +19,8 @@ class Slider(CommonMarginProps, 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" - "4"
size: Var[Literal[1, 2, 3]]
# Button size "1" - "3"
size: Var[Literal["1", "2", "3"]]
# Variant of button
variant: Var[Literal["classic", "surface", "soft"]]
@ -35,7 +35,7 @@ class Slider(CommonMarginProps, RadixThemesComponent):
radius: Var[LiteralRadius]
# The value of the slider when initially rendered. Use when you do not need to control the state of the slider.
default_value: Var[float]
default_value: Var[List[float]]
# The controlled value of the slider. Must be used in conjunction with onValueChange.
value: Var[float]

View File

@ -7,7 +7,7 @@ from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.vars import Var, BaseVar, ComputedVar
from reflex.event import EventChain, EventHandler, EventSpec
from reflex.style import Style
from typing import Any, Dict, Literal
from typing import Any, Dict, List, Literal
from reflex.vars import Var
from ..base import (
CommonMarginProps,
@ -87,7 +87,9 @@ class Slider(CommonMarginProps, RadixThemesComponent):
]
] = None,
as_child: Optional[Union[Var[bool], bool]] = None,
size: Optional[Union[Var[Literal[1, 2, 3]], Literal[1, 2, 3]]] = None,
size: Optional[
Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
] = None,
variant: Optional[
Union[
Var[Literal["classic", "surface", "soft"]],
@ -101,7 +103,7 @@ class Slider(CommonMarginProps, RadixThemesComponent):
Literal["none", "small", "medium", "large", "full"],
]
] = None,
default_value: Optional[Union[Var[float], float]] = None,
default_value: Optional[Union[Var[List[float]], List[float]]] = None,
value: Optional[Union[Var[float], float]] = None,
min: Optional[Union[Var[float], float]] = None,
max: Optional[Union[Var[float], float]] = None,
@ -224,7 +226,7 @@ class Slider(CommonMarginProps, 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" - "4"
size: Button size "1" - "3"
variant: Variant of button
high_contrast: Whether to render the button with higher contrast color against background
radius: Override theme radius for button: "none" | "small" | "medium" | "large" | "full"

View File

@ -16,7 +16,7 @@ class TableRoot(el.Table, CommonMarginProps, RadixThemesComponent):
tag = "Table.Root"
# The size of the table: "1" | "2" | "3"
size: Var[Literal[1, 2, 3]]
size: Var[Literal["1", "2", "3"]]
# The variant of the table
variant: Var[Literal["surface", "ghost"]]

View File

@ -81,7 +81,9 @@ class TableRoot(el.Table, CommonMarginProps, RadixThemesComponent):
],
]
] = None,
size: Optional[Union[Var[Literal[1, 2, 3]], Literal[1, 2, 3]]] = None,
size: Optional[
Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
] = None,
variant: Optional[
Union[Var[Literal["surface", "ghost"]], Literal["surface", "ghost"]]
] = None,

View File

@ -14,10 +14,7 @@ class TabsRoot(CommonMarginProps, RadixThemesComponent):
tag = "Tabs.Root"
# The size of the table: "1" | "2" | "3"
size: Var[Literal[1, 2, 3]]
# The variant of the table
# The variant of the tab
variant: Var[Literal["surface", "ghost"]]
# The value of the tab that should be active when initially rendered. Use when you do not need to control the state of the tabs.
@ -63,3 +60,6 @@ class TabsContent(CommonMarginProps, RadixThemesComponent):
"""Trigger an action or event, such as submitting a form or displaying a dialog."""
tag = "Tabs.Content"
# The value of the tab. Must be unique for each tab.
value: Var[str]

View File

@ -81,7 +81,6 @@ class TabsRoot(CommonMarginProps, RadixThemesComponent):
],
]
] = None,
size: Optional[Union[Var[Literal[1, 2, 3]], Literal[1, 2, 3]]] = None,
variant: Optional[
Union[Var[Literal["surface", "ghost"]], Literal["surface", "ghost"]]
] = None,
@ -200,8 +199,7 @@ class TabsRoot(CommonMarginProps, RadixThemesComponent):
*children: Child components.
color: map to CSS default color property.
color_scheme: map to radix color property.
size: The size of the table: "1" | "2" | "3"
variant: The variant of the table
variant: The variant of the tab
default_value: The value of the tab that should be active when initially rendered. Use when you do not need to control the state of the tabs.
value: The controlled value of the tab that should be active. Use when you need to control the state of the tabs.
orientation: The orientation of the tabs.
@ -684,6 +682,7 @@ class TabsContent(CommonMarginProps, RadixThemesComponent):
],
]
] = None,
value: Optional[Union[Var[str], str]] = None,
m: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
@ -788,6 +787,7 @@ class TabsContent(CommonMarginProps, RadixThemesComponent):
*children: Child components.
color: map to CSS default color property.
color_scheme: map to radix color property.
value: The value of the tab. Must be unique for each tab.
m: Margin: "0" - "9"
mx: Margin horizontal: "0" - "9"
my: Margin vertical: "0" - "9"

View File

@ -0,0 +1,15 @@
"""Interactive components provided by @radix-ui/themes."""
from reflex.vars import Var
from ..base import (
CommonMarginProps,
RadixThemesComponent,
)
class Tooltip(CommonMarginProps, RadixThemesComponent):
"""Floating element that provides a control with contextual information via pointer or focus."""
tag = "Tooltip"
content: Var[str]

View File

@ -0,0 +1,205 @@
"""Stub file for reflex/components/radix/themes/components/tooltip.py"""
# ------------------- DO NOT EDIT ----------------------
# This file was generated by `scripts/pyi_generator.py`!
# ------------------------------------------------------
from typing import Any, Dict, Literal, Optional, Union, overload
from reflex.vars import Var, BaseVar, ComputedVar
from reflex.event import EventChain, EventHandler, EventSpec
from reflex.style import Style
from reflex.vars import Var
from ..base import CommonMarginProps, RadixThemesComponent
class Tooltip(CommonMarginProps, RadixThemesComponent):
@overload
@classmethod
def create( # type: ignore
cls,
*children,
color: Optional[Union[Var[str], str]] = None,
color_scheme: Optional[
Union[
Var[
Literal[
"tomato",
"red",
"ruby",
"crimson",
"pink",
"plum",
"purple",
"violet",
"iris",
"indigo",
"blue",
"cyan",
"teal",
"jade",
"green",
"grass",
"brown",
"orange",
"sky",
"mint",
"lime",
"yellow",
"amber",
"gold",
"bronze",
"gray",
]
],
Literal[
"tomato",
"red",
"ruby",
"crimson",
"pink",
"plum",
"purple",
"violet",
"iris",
"indigo",
"blue",
"cyan",
"teal",
"jade",
"green",
"grass",
"brown",
"orange",
"sky",
"mint",
"lime",
"yellow",
"amber",
"gold",
"bronze",
"gray",
],
]
] = None,
content: Optional[Union[Var[str], str]] = None,
m: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
]
] = None,
mx: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
]
] = None,
my: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
]
] = None,
mt: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
]
] = None,
mr: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
]
] = None,
mb: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
]
] = None,
ml: Optional[
Union[
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
]
] = None,
style: Optional[Style] = None,
key: Optional[Any] = None,
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
on_blur: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_click: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_context_menu: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_double_click: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_focus: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mount: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_down: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_enter: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_leave: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_move: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_out: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_over: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_mouse_up: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_scroll: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
on_unmount: Optional[
Union[EventHandler, EventSpec, list, function, BaseVar]
] = None,
**props
) -> "Tooltip":
"""Create a new component instance.
Will prepend "RadixThemes" to the component tag to avoid conflicts with
other UI libraries for common names, like Text and Button.
Args:
*children: Child components.
color: map to CSS default color property.
color_scheme: map to radix color property.
m: Margin: "0" - "9"
mx: Margin horizontal: "0" - "9"
my: Margin vertical: "0" - "9"
mt: Margin top: "0" - "9"
mr: Margin right: "0" - "9"
mb: Margin bottom: "0" - "9"
ml: Margin left: "0" - "9"
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
class_name: The class name for the component.
autofocus: Whether the component should take the focus once the page is loaded
custom_attrs: custom attribute
**props: Component properties.
Returns:
A new component instance.
"""
...

View File

@ -6,6 +6,7 @@ from __future__ import annotations
from typing import Literal
from reflex.components.el.elements.inline import A
from reflex.vars import Var
from ..base import (
@ -22,7 +23,7 @@ from .base import (
LiteralLinkUnderline = Literal["auto", "hover", "always"]
class Link(CommonMarginProps, RadixThemesComponent):
class Link(CommonMarginProps, RadixThemesComponent, A):
"""A semantic element for navigation between pages."""
tag = "Link"

View File

@ -8,13 +8,14 @@ from reflex.vars import Var, BaseVar, ComputedVar
from reflex.event import EventChain, EventHandler, EventSpec
from reflex.style import Style
from typing import Literal
from reflex.components.el.elements.inline import A
from reflex.vars import Var
from ..base import CommonMarginProps, LiteralAccentColor, RadixThemesComponent
from .base import LiteralTextSize, LiteralTextTrim, LiteralTextWeight
LiteralLinkUnderline = Literal["auto", "hover", "always"]
class Link(CommonMarginProps, RadixThemesComponent):
class Link(CommonMarginProps, RadixThemesComponent, A):
@overload
@classmethod
def create( # type: ignore
@ -151,6 +152,70 @@ class Link(CommonMarginProps, RadixThemesComponent):
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
]
] = None,
download: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
href: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
href_lang: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
media: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
ping: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
referrer_policy: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
rel: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
shape: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
target: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
access_key: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
auto_capitalize: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
content_editable: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
context_menu: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
dir: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
draggable: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
enter_key_hint: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
hidden: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
input_mode: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
item_prop: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
lang: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
role: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
slot: Optional[Union[Var[Union[str, int, bool]], Union[str, int, bool]]] = None,
spell_check: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
tab_index: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
title: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
translate: Optional[
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
] = None,
style: Optional[Style] = None,
key: Optional[Any] = None,
id: Optional[Any] = None,
@ -226,6 +291,32 @@ class Link(CommonMarginProps, RadixThemesComponent):
mr: Margin right: "0" - "9"
mb: Margin bottom: "0" - "9"
ml: Margin left: "0" - "9"
download: Specifies that the target (the file specified in the href attribute) will be downloaded when a user clicks on the hyperlink.
href: Specifies the URL of the page the link goes to
href_lang: Specifies the language of the linked document
media: Specifies what media/device the linked document is optimized for
ping: Specifies which referrer is sent when fetching the resource
referrer_policy: Specifies the relationship between the current document and the linked document
rel: Specifies the relationship between the linked document and the current document
shape: Specifies the shape of the area
target: Specifies where to open the linked document
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.
context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
dir: Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)
draggable: Defines whether the element can be dragged.
enter_key_hint: Hints what media types the media element is able to play.
hidden: Defines whether the element is hidden.
input_mode: Defines the type of the element.
item_prop: Defines the name of the element for metadata purposes.
lang: Defines the language used in the element.
role: Defines the role of the element.
slot: Assigns a slot in a shadow DOM shadow tree to an element.
spell_check: Defines whether the element may be checked for spelling errors.
tab_index: Defines the position of the current element in the tabbing order.
title: Defines a tooltip for the element.
translate: Specifies whether the content of an element should be translated or not.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.