Skip to content

Commit

Permalink
add svg radialGradient to media.py and media.pyi
Browse files Browse the repository at this point in the history
  • Loading branch information
ChinoUkaegbu committed Sep 26, 2024
1 parent de1864a commit 7416310
Show file tree
Hide file tree
Showing 2 changed files with 159 additions and 0 deletions.
34 changes: 34 additions & 0 deletions reflex/components/el/elements/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,39 @@ class LinearGradient(BaseHTML):
y2: Var[Union[str, int, bool]]


class RadialGradient(BaseHTML):
"""Display the radialGradient element."""

tag = "radialGradient"

# The x coordinate of the end circle of the radial gradient.
cx: Var[Union[str, int, bool]]

# The y coordinate of the end circle of the radial gradient.
cy: Var[Union[str, int, bool]]

# The radius of the start circle of the radial gradient.
fr: Var[Union[str, int, bool]]

# The x coordinate of the start circle of the radial gradient.
fx: Var[Union[str, int, bool]]

# The y coordinate of the start circle of the radial gradient.
fy: Var[Union[str, int, bool]]

# Units for the gradient.
gradient_units: Var[Union[str, bool]]

# Transform applied to the gradient.
gradient_transform: Var[Union[str, bool]]

# The radius of the end circle of the radial gradient.
r: Var[Union[str, int, bool]]

# Method used to spread the gradient.
spread_method: Var[Union[str, bool]]


class Stop(BaseHTML):
"""Display the stop element."""

Expand Down Expand Up @@ -461,6 +494,7 @@ class SVG(ComponentNamespace):
path = staticmethod(Path.create)
stop = staticmethod(Stop.create)
linear_gradient = staticmethod(LinearGradient.create)
radial_gradient = staticmethod(RadialGradient.create)
defs = staticmethod(Defs.create)
__call__ = staticmethod(Svg.create)

Expand Down
125 changes: 125 additions & 0 deletions reflex/components/el/elements/media.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2352,6 +2352,130 @@ class LinearGradient(BaseHTML):
"""
...

class RadialGradient(BaseHTML):
@overload
@classmethod
def create( # type: ignore
cls,
*children,
cx: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
cy: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
fr: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
fx: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
fy: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
gradient_units: Optional[Union[Var[Union[bool, str]], bool, str]] = None,
gradient_transform: Optional[Union[Var[Union[bool, str]], bool, str]] = None,
r: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
spread_method: Optional[Union[Var[Union[bool, str]], bool, str]] = None,
access_key: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
auto_capitalize: Optional[
Union[Var[Union[bool, int, str]], bool, int, str]
] = None,
content_editable: Optional[
Union[Var[Union[bool, int, str]], bool, int, str]
] = None,
context_menu: Optional[
Union[Var[Union[bool, int, str]], bool, int, str]
] = None,
dir: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
draggable: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
enter_key_hint: Optional[
Union[Var[Union[bool, int, str]], bool, int, str]
] = None,
hidden: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
input_mode: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
item_prop: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
lang: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
role: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
slot: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
spell_check: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
tab_index: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = None,
title: Optional[Union[Var[Union[bool, int, str]], bool, int, str]] = 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, Callable, Var]] = None,
on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
on_context_menu: Optional[
Union[EventHandler, EventSpec, list, Callable, Var]
] = None,
on_double_click: Optional[
Union[EventHandler, EventSpec, list, Callable, Var]
] = None,
on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
on_mouse_down: Optional[
Union[EventHandler, EventSpec, list, Callable, Var]
] = None,
on_mouse_enter: Optional[
Union[EventHandler, EventSpec, list, Callable, Var]
] = None,
on_mouse_leave: Optional[
Union[EventHandler, EventSpec, list, Callable, Var]
] = None,
on_mouse_move: Optional[
Union[EventHandler, EventSpec, list, Callable, Var]
] = None,
on_mouse_out: Optional[
Union[EventHandler, EventSpec, list, Callable, Var]
] = None,
on_mouse_over: Optional[
Union[EventHandler, EventSpec, list, Callable, Var]
] = None,
on_mouse_up: Optional[
Union[EventHandler, EventSpec, list, Callable, Var]
] = None,
on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
on_unmount: Optional[
Union[EventHandler, EventSpec, list, Callable, Var]
] = None,
**props,
) -> "RadialGradient":
"""Create the component.
Args:
*children: The children of the component.
cx: The x coordinate of the end circle of the radial gradient.
cy: The y coordinate of the end circle of the radial gradient.
fr: The radius of the start circle of the radial gradient.
fx: The x coordinate of the start circle of the radial gradient.
fy: The y coordinate of the start circle of the radial gradient.
gradient_units: Units for the gradient.
gradient_transform: Transform applied to the gradient.
r: The radius of the end circle of the radial gradient.
spread_method: Method used to spread the gradient.
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.
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: The props of the component.
Returns:
The component.
"""
...

class Stop(BaseHTML):
@overload
@classmethod
Expand Down Expand Up @@ -2585,6 +2709,7 @@ class SVG(ComponentNamespace):
path = staticmethod(Path.create)
stop = staticmethod(Stop.create)
linear_gradient = staticmethod(LinearGradient.create)
radial_gradient = staticmethod(RadialGradient.create)
defs = staticmethod(Defs.create)

@staticmethod
Expand Down

0 comments on commit 7416310

Please sign in to comment.