Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pyi_hashes.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"reflex/components/datadisplay/code.pyi": "651fc3d417b998eb1c3d072328f505d0",
"reflex/components/datadisplay/dataeditor.pyi": "601c59f3ced6ab94fcf5527b90472a4f",
"reflex/components/datadisplay/shiki_code_block.pyi": "ac16fd6c23eef7ce0185437ecf2d529d",
"reflex/components/el/__init__.pyi": "09042a2db5e0637e99b5173430600522",
"reflex/components/el/__init__.pyi": "f07f5957ca4dc3d95ffdc2ddb75fe2f8",
"reflex/components/el/element.pyi": "323cfb5d67d8ccb58ac36c7cc7641dc3",
"reflex/components/el/elements/__init__.pyi": "baeddd04d4d3a82799420b2a6df368f6",
"reflex/components/el/elements/base.pyi": "697cd6716e3b1127b35299435c3d4e69",
Expand Down Expand Up @@ -114,12 +114,12 @@
"reflex/components/react_player/audio.pyi": "bd7e024d39ac641f8279ee0f6afd7985",
"reflex/components/react_player/react_player.pyi": "40db798bcb7fa40207d24f49722135ae",
"reflex/components/react_player/video.pyi": "22d84a7f57be13ece90cb30536d76c7d",
"reflex/components/recharts/__init__.pyi": "a52c9055e37c6ee25ded15688d45e8a5",
"reflex/components/recharts/cartesian.pyi": "5f893a3a6b1428a463cbbc4db5aa8097",
"reflex/components/recharts/__init__.pyi": "a060a4abcd018165bc499173e723cf9e",
"reflex/components/recharts/cartesian.pyi": "601e1acb0ad6bd93ce371d763220aabe",
"reflex/components/recharts/charts.pyi": "2f0a39f9c02de83d9e2d97763b4411af",
"reflex/components/recharts/general.pyi": "06d0e97776cc82b946fed465ab36fba4",
"reflex/components/recharts/polar.pyi": "7c445e98c1d0c95868411173de8fe85e",
"reflex/components/recharts/recharts.pyi": "f2739c20a27990a571d16133a40a0878",
"reflex/components/recharts/polar.pyi": "77ca6e0d992f5d5c0479de73db4f71ba",
"reflex/components/recharts/recharts.pyi": "bbaec232c2da035b31b5d0e3888f4801",
"reflex/components/sonner/toast.pyi": "6dc6d5d05d9a8d7d364c0326fb2e6503",
"reflex/components/suneditor/editor.pyi": "0a6dcab61cc2d750488601e3808080d9",
"reflex/experimental/layout.pyi": "fb4c52b954431d9a927fbdd612b562eb"
Expand Down
2 changes: 1 addition & 1 deletion reflex/components/recharts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@
],
"recharts": [
"LiteralAnimationEasing",
"LiteralAreaType",
"LiteralAxisType",
"LiteralBarChartStackOffset",
"LiteralComposedChartBaseValue",
"LiteralCurveType",
"LiteralDirection",
"LiteralGridType",
"LiteralIconType",
Expand Down
35 changes: 15 additions & 20 deletions reflex/components/recharts/cartesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
from reflex.vars.base import LiteralVar, Var

from .recharts import (
ACTIVE_DOT_TYPE,
LiteralAnimationEasing,
LiteralAreaType,
LiteralCurveType,
LiteralDirection,
LiteralIfOverflow,
LiteralInterval,
Expand Down Expand Up @@ -89,7 +90,7 @@ class Axis(Recharts):
ticks: Var[Sequence[str | int]]

# If set false, no ticks will be drawn.
tick: Var[bool]
tick: Var[bool | dict]

# The count of axis ticks. Not used if 'type' is 'category'. Default: 5
tick_count: Var[int]
Expand Down Expand Up @@ -275,6 +276,9 @@ class Cartesian(Recharts):
# The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none' optional
legend_type: Var[LiteralLegendType]

# If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. Default: False
label: Var[bool | dict[str, Any]]

# If set false, animation of bar will be disabled. Default: True
is_animation_active: Var[bool]

Expand Down Expand Up @@ -341,24 +345,21 @@ class Area(Cartesian):
fill: Var[str | Color] = LiteralVar.create(Color("accent", 5))

# The interpolation type of area. And customized interpolation function can be set to type. 'basis' | 'basisClosed' | 'basisOpen' | 'bumpX' | 'bumpY' | 'bump' | 'linear' | 'linearClosed' | 'natural' | 'monotoneX' | 'monotoneY' | 'monotone' | 'step' | 'stepBefore' | 'stepAfter'. Default: "monotone"
type_: Var[LiteralAreaType] = LiteralVar.create("monotone")
type_: Var[LiteralCurveType] = LiteralVar.create("monotone")

# If false set, dots will not be drawn. If true set, dots will be drawn which have the props calculated internally. Default: False
dot: Var[bool | dict[str, Any]]
dot: Var[ACTIVE_DOT_TYPE]

# The dot is shown when user enter an area chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. Default: {stroke: rx.color("accent", 2), fill: rx.color("accent", 10)}
active_dot: Var[bool | dict[str, Any]] = LiteralVar.create(
active_dot: Var[ACTIVE_DOT_TYPE] = LiteralVar.create(
{
"stroke": Color("accent", 2),
"fill": Color("accent", 10),
}
)

# If set false, labels will not be drawn. If set true, labels will be drawn which have the props calculated internally. Default: False
label: Var[bool]

# The value which can describle the line, usually calculated internally.
base_line: Var[str | Sequence[dict[str, Any]]]
base_line: Var[int | Sequence[dict[str, Any]]]

# The coordinates of all the points in the area, usually calculated internally.
points: Var[Sequence[dict[str, Any]]]
Expand Down Expand Up @@ -392,9 +393,6 @@ class Bar(Cartesian):
# If false set, background of bars will not be drawn. If true set, background of bars will be drawn which have the props calculated internally. Default: False
background: Var[bool]

# If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. Default: False
label: Var[bool]

# The stack id of bar, when two bars have the same value axis and same stack_id, then the two bars are stacked in order.
stack_id: Var[str]

Expand Down Expand Up @@ -431,7 +429,7 @@ class Line(Cartesian):
alias = "RechartsLine"

# The interpolation type of line. And customized interpolation function can be set to type. It's the same as type in Area.
type_: Var[LiteralAreaType]
type_: Var[LiteralCurveType]

# The color of the line stroke. Default: rx.color("accent", 9)
stroke: Var[str | Color] = LiteralVar.create(Color("accent", 9))
Expand All @@ -440,24 +438,21 @@ class Line(Cartesian):
stroke_width: Var[str | int | float]

# The dot is shown when mouse enter a line chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. Default: {"stroke": rx.color("accent", 10), "fill": rx.color("accent", 4)}
dot: Var[bool | dict[str, Any]] = LiteralVar.create(
dot: Var[ACTIVE_DOT_TYPE] = LiteralVar.create(
{
"stroke": Color("accent", 10),
"fill": Color("accent", 4),
}
)

# The dot is shown when user enter an area chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. Default: {"stroke": rx.color("accent", 2), "fill": rx.color("accent", 10)}
active_dot: Var[bool | dict[str, Any]] = LiteralVar.create(
active_dot: Var[ACTIVE_DOT_TYPE] = LiteralVar.create(
{
"stroke": Color("accent", 2),
"fill": Color("accent", 10),
}
)

# If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. Default: False
label: Var[bool]

# Hides the line when true, useful when toggling visibility state via legend. Default: False
hide: Var[bool]

Expand Down Expand Up @@ -849,10 +844,10 @@ class CartesianAxis(Grid):
view_box: Var[dict[str, Any]]

# If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line. Default: True
axis_line: Var[bool]
axis_line: Var[bool | dict]

# If set false, no ticks will be drawn.
tick: Var[bool]
tick: Var[bool | dict]

# If set false, no axis tick lines will be drawn. If set a object, the option is the configuration of tick lines. Default: True
tick_line: Var[bool]
Expand Down
9 changes: 5 additions & 4 deletions reflex/components/recharts/polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from reflex.vars.base import LiteralVar, Var

from .recharts import (
ACTIVE_DOT_TYPE,
LiteralAnimationEasing,
LiteralGridType,
LiteralLegendType,
Expand Down Expand Up @@ -65,10 +66,10 @@ class Pie(Recharts):
legend_type: Var[LiteralLegendType]

# If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. Default: False
label: Var[bool] = Var.create(False)
label: Var[bool | dict[str, Any]] = Var.create(False)

# If false set, label lines will not be drawn. If true set, label lines will be drawn which have the props calculated internally. Default: False
label_line: Var[bool]
label_line: Var[bool | dict[str, Any]]

# Valid children components
_valid_children: ClassVar[list[str]] = ["Cell", "LabelList", "Bare"]
Expand Down Expand Up @@ -126,7 +127,7 @@ class Radar(Recharts):
points: Var[Sequence[dict[str, Any]]]

# If false set, dots will not be drawn. Default: True
dot: Var[bool]
dot: Var[ACTIVE_DOT_TYPE]

# Stoke color. Default: rx.color("accent", 9)
stroke: Var[str | Color] = LiteralVar.create(Color("accent", 9))
Expand All @@ -141,7 +142,7 @@ class Radar(Recharts):
legend_type: Var[LiteralLegendType]

# If false set, labels will not be drawn. Default: True
label: Var[bool]
label: Var[bool | dict[str, Any]]

# If set false, animation of polygon will be disabled. Default: True in CSR, and False in SSR
is_animation_active: Var[bool]
Expand Down
22 changes: 12 additions & 10 deletions reflex/components/recharts/recharts.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""A component that wraps a recharts lib."""

from typing import Literal
from typing import Any, Literal

from reflex.components.component import Component, MemoizationLeaf, NoSSRComponent

Expand Down Expand Up @@ -73,25 +73,25 @@ class RechartsCharts(NoSSRComponent, MemoizationLeaf):
"center",
]
LiteralIconType = Literal[
"line",
"plainline",
"square",
"rect",
"circle",
"cross",
"diamond",
"line",
"plainline",
"rect",
"square",
"star",
"triangle",
"wye",
]
LiteralLegendType = Literal[
"line",
"plainline",
"square",
"rect",
"circle",
"cross",
"diamond",
"line",
"plainline",
"rect",
"square",
"star",
"triangle",
"wye",
Expand All @@ -103,7 +103,7 @@ class RechartsCharts(NoSSRComponent, MemoizationLeaf):
LiteralBarChartStackOffset = Literal["expand", "none", "wiggle", "silhouette", "sign"]
LiteralComposedChartBaseValue = Literal["dataMin", "dataMax", "auto"]
LiteralAxisType = Literal["number", "category"]
LiteralAreaType = Literal[
LiteralCurveType = Literal[
"basis",
"basisClosed",
"basisOpen",
Expand All @@ -126,3 +126,5 @@ class RechartsCharts(NoSSRComponent, MemoizationLeaf):
"preserveStart", "preserveEnd", "preserveStartEnd", "equidistantPreserveStart"
]
LiteralSyncMethod = Literal["index", "value"]

ACTIVE_DOT_TYPE = bool | dict[str, Any]