diff --git a/pyi_hashes.json b/pyi_hashes.json index a1140c49a3b..cd9ea8c97c9 100644 --- a/pyi_hashes.json +++ b/pyi_hashes.json @@ -27,11 +27,11 @@ "reflex/components/datadisplay/shiki_code_block.pyi": "ac16fd6c23eef7ce0185437ecf2d529d", "reflex/components/el/__init__.pyi": "09042a2db5e0637e99b5173430600522", "reflex/components/el/element.pyi": "323cfb5d67d8ccb58ac36c7cc7641dc3", - "reflex/components/el/elements/__init__.pyi": "280ed457675f3720e34b560a3f617739", + "reflex/components/el/elements/__init__.pyi": "baeddd04d4d3a82799420b2a6df368f6", "reflex/components/el/elements/base.pyi": "697cd6716e3b1127b35299435c3d4e69", "reflex/components/el/elements/forms.pyi": "7e067419808bca05125de4967d284935", "reflex/components/el/elements/inline.pyi": "ab31eec758f1cff8a9d51bf0935b9fca", - "reflex/components/el/elements/media.pyi": "ac99654959ed26b7b7d0f3dafa0ea2ab", + "reflex/components/el/elements/media.pyi": "c191a9e00223a97e26a0d6ab99a1919b", "reflex/components/el/elements/metadata.pyi": "eda94a3283bae6a9b61b4cb1e20c1dbd", "reflex/components/el/elements/other.pyi": "960bdac0bb9bf6b3cffd241f9b66c0fc", "reflex/components/el/elements/scripts.pyi": "ac3b8bfbd7777f33fb2c6aa109a5c627", diff --git a/reflex/components/el/elements/__init__.py b/reflex/components/el/elements/__init__.py index 173b9988ab5..4661d7ecfc1 100644 --- a/reflex/components/el/elements/__init__.py +++ b/reflex/components/el/elements/__init__.py @@ -69,6 +69,7 @@ "text", "line", "circle", + "g", "ellipse", "rect", "polygon", diff --git a/reflex/components/el/elements/media.py b/reflex/components/el/elements/media.py index e76f12751ae..3b2aac70ecb 100644 --- a/reflex/components/el/elements/media.py +++ b/reflex/components/el/elements/media.py @@ -484,6 +484,30 @@ class Path(BaseHTML): d: Var[str | int | float] +class G(BaseHTML): + """The SVG g component, used to group other SVG elements.""" + + tag = "g" + + # The fill color of the group. + fill: Var[str | Color] + + # The fill opacity of the group. + fill_opacity: Var[str | int | float] + + # The stroke color of the group. + stroke: Var[str | Color] + + # The stroke opacity of the group. + stroke_opacity: Var[str | int | float] + + # The stroke width of the group. + stroke_width: Var[str | int | float] + + # The transform applied to the group. + transform: Var[str] + + class SVG(ComponentNamespace): """SVG component namespace.""" @@ -498,6 +522,7 @@ class SVG(ComponentNamespace): linear_gradient = staticmethod(LinearGradient.create) radial_gradient = staticmethod(RadialGradient.create) defs = staticmethod(Defs.create) + g = staticmethod(G.create) __call__ = staticmethod(Svg.create) @@ -512,6 +537,7 @@ class SVG(ComponentNamespace): linear_gradient = LinearGradient.create radial_gradient = RadialGradient.create defs = Defs.create +g = G.create area = Area.create audio = Audio.create image = img = Img.create diff --git a/tests/units/components/el/test_svg.py b/tests/units/components/el/test_svg.py index e104c4e15b2..b6047a6e107 100644 --- a/tests/units/components/el/test_svg.py +++ b/tests/units/components/el/test_svg.py @@ -2,6 +2,7 @@ Circle, Defs, Ellipse, + G, Line, LinearGradient, Path, @@ -72,3 +73,8 @@ def test_text(): def test_stop(): stop = Stop.create().render() assert stop["name"] == '"stop"' + + +def test_g(): + g = G.create().render() + assert g["name"] == '"g"'