reflex 0.5.3a2__py3-none-any.whl → 0.5.4a1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of reflex might be problematic. Click here for more details.

Files changed (50) hide show
  1. reflex/.templates/apps/demo/code/webui/state.py +3 -2
  2. reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js +19 -20
  3. reflex/.templates/web/utils/state.js +6 -0
  4. reflex/__init__.py +7 -1
  5. reflex/__init__.pyi +2 -0
  6. reflex/app.py +2 -5
  7. reflex/compiler/compiler.py +2 -2
  8. reflex/components/component.py +19 -6
  9. reflex/components/core/client_side_routing.py +2 -2
  10. reflex/components/core/client_side_routing.pyi +1 -0
  11. reflex/components/core/upload.py +1 -1
  12. reflex/components/datadisplay/dataeditor.py +7 -2
  13. reflex/components/datadisplay/dataeditor.pyi +1 -0
  14. reflex/components/el/elements/forms.py +18 -11
  15. reflex/components/el/elements/forms.pyi +1 -0
  16. reflex/components/markdown/markdown.py +1 -1
  17. reflex/components/plotly/plotly.py +76 -12
  18. reflex/components/plotly/plotly.pyi +15 -82
  19. reflex/components/radix/themes/base.py +9 -2
  20. reflex/components/radix/themes/base.pyi +1 -0
  21. reflex/components/recharts/cartesian.py +42 -14
  22. reflex/components/recharts/cartesian.pyi +81 -17
  23. reflex/components/recharts/charts.py +12 -21
  24. reflex/components/recharts/charts.pyi +53 -14
  25. reflex/components/sonner/toast.py +30 -14
  26. reflex/components/sonner/toast.pyi +8 -4
  27. reflex/config.py +22 -14
  28. reflex/constants/__init__.py +2 -0
  29. reflex/constants/config.py +7 -0
  30. reflex/event.py +12 -6
  31. reflex/experimental/__init__.py +22 -2
  32. reflex/experimental/client_state.py +81 -23
  33. reflex/experimental/hooks.py +29 -35
  34. reflex/experimental/layout.py +8 -3
  35. reflex/experimental/layout.pyi +536 -0
  36. reflex/reflex.py +9 -5
  37. reflex/style.py +1 -0
  38. reflex/testing.py +44 -13
  39. reflex/utils/format.py +8 -1
  40. reflex/utils/processes.py +27 -0
  41. reflex/utils/pyi_generator.py +11 -4
  42. reflex/utils/serializers.py +114 -15
  43. reflex/utils/types.py +6 -2
  44. reflex/vars.py +39 -10
  45. reflex/vars.pyi +2 -2
  46. {reflex-0.5.3a2.dist-info → reflex-0.5.4a1.dist-info}/METADATA +1 -1
  47. {reflex-0.5.3a2.dist-info → reflex-0.5.4a1.dist-info}/RECORD +50 -49
  48. {reflex-0.5.3a2.dist-info → reflex-0.5.4a1.dist-info}/LICENSE +0 -0
  49. {reflex-0.5.3a2.dist-info → reflex-0.5.4a1.dist-info}/WHEEL +0 -0
  50. {reflex-0.5.3a2.dist-info → reflex-0.5.4a1.dist-info}/entry_points.txt +0 -0
@@ -4,6 +4,7 @@ from __future__ import annotations
4
4
  from typing import Any, Dict, List, Union
5
5
 
6
6
  from reflex.constants import EventTriggers
7
+ from reflex.constants.colors import Color
7
8
  from reflex.vars import Var
8
9
 
9
10
  from .recharts import (
@@ -32,6 +33,12 @@ class Axis(Recharts):
32
33
  # If set true, the axis do not display in the chart.
33
34
  hide: Var[bool]
34
35
 
36
+ # The width of axis which is usually calculated internally.
37
+ width: Var[Union[str, int]]
38
+
39
+ # The height of axis, which can be setted by user.
40
+ height: Var[Union[str, int]]
41
+
35
42
  # The orientation of axis 'top' | 'bottom'
36
43
  orientation: Var[LiteralOrientationTopBottom]
37
44
 
@@ -50,9 +57,6 @@ class Axis(Recharts):
50
57
  # If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line.
51
58
  axis_line: Var[bool]
52
59
 
53
- # If set false, no axis tick lines will be drawn. If set a object, the option is the configuration of tick lines.
54
- tick_line: Var[bool]
55
-
56
60
  # If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside.
57
61
  mirror: Var[bool]
58
62
 
@@ -76,6 +80,8 @@ class Axis(Recharts):
76
80
  """
77
81
  return {
78
82
  EventTriggers.ON_CLICK: lambda: [],
83
+ EventTriggers.ON_MOUSE_UP: lambda: [],
84
+ EventTriggers.ON_MOUSE_DOWN: lambda: [],
79
85
  EventTriggers.ON_MOUSE_MOVE: lambda: [],
80
86
  EventTriggers.ON_MOUSE_OVER: lambda: [],
81
87
  EventTriggers.ON_MOUSE_OUT: lambda: [],
@@ -91,6 +97,9 @@ class XAxis(Axis):
91
97
 
92
98
  alias = "RechartsXAxis"
93
99
 
100
+ # Ensures that all datapoints within a chart contribute to its domain calculation, even when they are hidden
101
+ include_hidden: Var[bool] = Var.create_safe(False)
102
+
94
103
 
95
104
  class YAxis(Axis):
96
105
  """A YAxis component in Recharts."""
@@ -134,7 +143,7 @@ class Brush(Recharts):
134
143
  alias = "RechartsBrush"
135
144
 
136
145
  # Stroke color
137
- stroke: Var[str]
146
+ stroke: Var[Union[str, Color]]
138
147
 
139
148
  # The key of data displayed in the axis.
140
149
  data_key: Var[Union[str, int]]
@@ -204,6 +213,8 @@ class Cartesian(Recharts):
204
213
  return {
205
214
  EventTriggers.ON_CLICK: lambda: [],
206
215
  EventTriggers.ON_MOUSE_MOVE: lambda: [],
216
+ EventTriggers.ON_MOUSE_UP: lambda: [],
217
+ EventTriggers.ON_MOUSE_DOWN: lambda: [],
207
218
  EventTriggers.ON_MOUSE_OVER: lambda: [],
208
219
  EventTriggers.ON_MOUSE_OUT: lambda: [],
209
220
  EventTriggers.ON_MOUSE_ENTER: lambda: [],
@@ -219,13 +230,13 @@ class Area(Cartesian):
219
230
  alias = "RechartsArea"
220
231
 
221
232
  # The color of the line stroke.
222
- stroke: Var[str]
233
+ stroke: Var[Union[str, Color]]
223
234
 
224
235
  # The width of the line stroke.
225
236
  stroke_width: Var[int]
226
237
 
227
238
  # The color of the area fill.
228
- fill: Var[str]
239
+ fill: Var[Union[str, Color]]
229
240
 
230
241
  # 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' |
231
242
  type_: Var[LiteralAreaType]
@@ -254,13 +265,13 @@ class Bar(Cartesian):
254
265
  alias = "RechartsBar"
255
266
 
256
267
  # The color of the line stroke.
257
- stroke: Var[str]
268
+ stroke: Var[Union[str, Color]]
258
269
 
259
270
  # The width of the line stroke.
260
271
  stroke_width: Var[int]
261
272
 
262
273
  # The width of the line stroke.
263
- fill: Var[str]
274
+ fill: Var[Union[str, Color]]
264
275
 
265
276
  # 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.
266
277
  background: Var[bool]
@@ -292,7 +303,7 @@ class Line(Cartesian):
292
303
  type_: Var[LiteralAreaType]
293
304
 
294
305
  # The color of the line stroke.
295
- stroke: Var[str]
306
+ stroke: Var[Union[str, Color]]
296
307
 
297
308
  # The width of the line stroke.
298
309
  stoke_width: Var[int]
@@ -339,7 +350,7 @@ class Scatter(Cartesian):
339
350
  line_type: Var[LiteralLineType]
340
351
 
341
352
  # The fill
342
- fill: Var[str]
353
+ fill: Var[Union[str, Color]]
343
354
 
344
355
  # the name
345
356
  name: Var[Union[str, int]]
@@ -370,6 +381,23 @@ class Funnel(Cartesian):
370
381
  # Valid children components
371
382
  _valid_children: List[str] = ["LabelList", "Cell"]
372
383
 
384
+ def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
385
+ """Get the event triggers that pass the component's value to the handler.
386
+
387
+ Returns:
388
+ A dict mapping the event trigger to the var that is passed to the handler.
389
+ """
390
+ return {
391
+ EventTriggers.ON_CLICK: lambda: [],
392
+ EventTriggers.ON_MOUSE_MOVE: lambda: [],
393
+ EventTriggers.ON_MOUSE_UP: lambda: [],
394
+ EventTriggers.ON_MOUSE_DOWN: lambda: [],
395
+ EventTriggers.ON_MOUSE_OVER: lambda: [],
396
+ EventTriggers.ON_MOUSE_OUT: lambda: [],
397
+ EventTriggers.ON_MOUSE_ENTER: lambda: [],
398
+ EventTriggers.ON_MOUSE_LEAVE: lambda: [],
399
+ }
400
+
373
401
 
374
402
  class ErrorBar(Recharts):
375
403
  """An ErrorBar component in Recharts."""
@@ -388,7 +416,7 @@ class ErrorBar(Recharts):
388
416
  width: Var[int]
389
417
 
390
418
  # The stroke color of error bar.
391
- stroke: Var[str]
419
+ stroke: Var[Union[str, Color]]
392
420
 
393
421
  # The stroke width of error bar.
394
422
  stroke_width: Var[int]
@@ -464,10 +492,10 @@ class ReferenceArea(Recharts):
464
492
  alias = "RechartsReferenceArea"
465
493
 
466
494
  # Stroke color
467
- stroke: Var[str]
495
+ stroke: Var[Union[str, Color]]
468
496
 
469
497
  # Fill color
470
- fill: Var[str]
498
+ fill: Var[Union[str, Color]]
471
499
 
472
500
  # The opacity of area.
473
501
  fill_opacity: Var[float]
@@ -530,7 +558,7 @@ class CartesianGrid(Grid):
530
558
  vertical: Var[Dict[str, Any]]
531
559
 
532
560
  # The background of grid.
533
- fill: Var[str]
561
+ fill: Var[Union[str, Color]]
534
562
 
535
563
  # The opacity of the background used to fill the space between grid lines
536
564
  fill_opacity: Var[float]
@@ -9,6 +9,7 @@ from reflex.event import EventChain, EventHandler, EventSpec
9
9
  from reflex.style import Style
10
10
  from typing import Any, Dict, List, Union
11
11
  from reflex.constants import EventTriggers
12
+ from reflex.constants.colors import Color
12
13
  from reflex.vars import Var
13
14
  from .recharts import (
14
15
  LiteralAnimationEasing,
@@ -35,6 +36,8 @@ class Axis(Recharts):
35
36
  *children,
36
37
  data_key: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None,
37
38
  hide: Optional[Union[Var[bool], bool]] = None,
39
+ width: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None,
40
+ height: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None,
38
41
  orientation: Optional[
39
42
  Union[Var[Literal["top", "bottom"]], Literal["top", "bottom"]]
40
43
  ] = None,
@@ -45,7 +48,6 @@ class Axis(Recharts):
45
48
  allow_data_overflow: Optional[Union[Var[bool], bool]] = None,
46
49
  allow_duplicated_category: Optional[Union[Var[bool], bool]] = None,
47
50
  axis_line: Optional[Union[Var[bool], bool]] = None,
48
- tick_line: Optional[Union[Var[bool], bool]] = None,
49
51
  mirror: Optional[Union[Var[bool], bool]] = None,
50
52
  reversed: Optional[Union[Var[bool], bool]] = None,
51
53
  scale: Optional[
@@ -99,6 +101,9 @@ class Axis(Recharts):
99
101
  on_click: Optional[
100
102
  Union[EventHandler, EventSpec, list, function, BaseVar]
101
103
  ] = None,
104
+ on_mouse_down: Optional[
105
+ Union[EventHandler, EventSpec, list, function, BaseVar]
106
+ ] = None,
102
107
  on_mouse_enter: Optional[
103
108
  Union[EventHandler, EventSpec, list, function, BaseVar]
104
109
  ] = None,
@@ -114,6 +119,9 @@ class Axis(Recharts):
114
119
  on_mouse_over: Optional[
115
120
  Union[EventHandler, EventSpec, list, function, BaseVar]
116
121
  ] = None,
122
+ on_mouse_up: Optional[
123
+ Union[EventHandler, EventSpec, list, function, BaseVar]
124
+ ] = None,
117
125
  **props
118
126
  ) -> "Axis":
119
127
  """Create the component.
@@ -122,13 +130,14 @@ class Axis(Recharts):
122
130
  *children: The children of the component.
123
131
  data_key: The key of a group of data which should be unique in an area chart.
124
132
  hide: If set true, the axis do not display in the chart.
133
+ width: The width of axis which is usually calculated internally.
134
+ height: The height of axis, which can be setted by user.
125
135
  orientation: The orientation of axis 'top' | 'bottom'
126
136
  type_: The type of axis 'number' | 'category'
127
137
  allow_decimals: Allow the ticks of XAxis to be decimals or not.
128
138
  allow_data_overflow: When domain of the axis is specified and the type of the axis is 'number', if allowDataOverflow is set to be false, the domain will be adjusted when the minimum value of data is smaller than domain[0] or the maximum value of data is greater than domain[1] so that the axis displays all data values. If set to true, graphic elements (line, area, bars) will be clipped to conform to the specified domain.
129
139
  allow_duplicated_category: Allow the axis has duplicated categorys or not when the type of axis is "category".
130
140
  axis_line: If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line.
131
- tick_line: If set false, no axis tick lines will be drawn. If set a object, the option is the configuration of tick lines.
132
141
  mirror: If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside.
133
142
  reversed: Reverse the ticks or not.
134
143
  scale: If 'auto' set, the scale function is decided by the type of chart, and the props type. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold' | Function
@@ -153,8 +162,11 @@ class XAxis(Axis):
153
162
  def create( # type: ignore
154
163
  cls,
155
164
  *children,
165
+ include_hidden: Optional[Union[Var[bool], bool]] = None,
156
166
  data_key: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None,
157
167
  hide: Optional[Union[Var[bool], bool]] = None,
168
+ width: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None,
169
+ height: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None,
158
170
  orientation: Optional[
159
171
  Union[Var[Literal["top", "bottom"]], Literal["top", "bottom"]]
160
172
  ] = None,
@@ -165,7 +177,6 @@ class XAxis(Axis):
165
177
  allow_data_overflow: Optional[Union[Var[bool], bool]] = None,
166
178
  allow_duplicated_category: Optional[Union[Var[bool], bool]] = None,
167
179
  axis_line: Optional[Union[Var[bool], bool]] = None,
168
- tick_line: Optional[Union[Var[bool], bool]] = None,
169
180
  mirror: Optional[Union[Var[bool], bool]] = None,
170
181
  reversed: Optional[Union[Var[bool], bool]] = None,
171
182
  scale: Optional[
@@ -219,6 +230,9 @@ class XAxis(Axis):
219
230
  on_click: Optional[
220
231
  Union[EventHandler, EventSpec, list, function, BaseVar]
221
232
  ] = None,
233
+ on_mouse_down: Optional[
234
+ Union[EventHandler, EventSpec, list, function, BaseVar]
235
+ ] = None,
222
236
  on_mouse_enter: Optional[
223
237
  Union[EventHandler, EventSpec, list, function, BaseVar]
224
238
  ] = None,
@@ -234,21 +248,26 @@ class XAxis(Axis):
234
248
  on_mouse_over: Optional[
235
249
  Union[EventHandler, EventSpec, list, function, BaseVar]
236
250
  ] = None,
251
+ on_mouse_up: Optional[
252
+ Union[EventHandler, EventSpec, list, function, BaseVar]
253
+ ] = None,
237
254
  **props
238
255
  ) -> "XAxis":
239
256
  """Create the component.
240
257
 
241
258
  Args:
242
259
  *children: The children of the component.
260
+ include_hidden: Ensures that all datapoints within a chart contribute to its domain calculation, even when they are hidden
243
261
  data_key: The key of a group of data which should be unique in an area chart.
244
262
  hide: If set true, the axis do not display in the chart.
263
+ width: The width of axis which is usually calculated internally.
264
+ height: The height of axis, which can be setted by user.
245
265
  orientation: The orientation of axis 'top' | 'bottom'
246
266
  type_: The type of axis 'number' | 'category'
247
267
  allow_decimals: Allow the ticks of XAxis to be decimals or not.
248
268
  allow_data_overflow: When domain of the axis is specified and the type of the axis is 'number', if allowDataOverflow is set to be false, the domain will be adjusted when the minimum value of data is smaller than domain[0] or the maximum value of data is greater than domain[1] so that the axis displays all data values. If set to true, graphic elements (line, area, bars) will be clipped to conform to the specified domain.
249
269
  allow_duplicated_category: Allow the axis has duplicated categorys or not when the type of axis is "category".
250
270
  axis_line: If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line.
251
- tick_line: If set false, no axis tick lines will be drawn. If set a object, the option is the configuration of tick lines.
252
271
  mirror: If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside.
253
272
  reversed: Reverse the ticks or not.
254
273
  scale: If 'auto' set, the scale function is decided by the type of chart, and the props type. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold' | Function
@@ -275,6 +294,8 @@ class YAxis(Axis):
275
294
  *children,
276
295
  data_key: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None,
277
296
  hide: Optional[Union[Var[bool], bool]] = None,
297
+ width: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None,
298
+ height: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None,
278
299
  orientation: Optional[
279
300
  Union[Var[Literal["top", "bottom"]], Literal["top", "bottom"]]
280
301
  ] = None,
@@ -285,7 +306,6 @@ class YAxis(Axis):
285
306
  allow_data_overflow: Optional[Union[Var[bool], bool]] = None,
286
307
  allow_duplicated_category: Optional[Union[Var[bool], bool]] = None,
287
308
  axis_line: Optional[Union[Var[bool], bool]] = None,
288
- tick_line: Optional[Union[Var[bool], bool]] = None,
289
309
  mirror: Optional[Union[Var[bool], bool]] = None,
290
310
  reversed: Optional[Union[Var[bool], bool]] = None,
291
311
  scale: Optional[
@@ -339,6 +359,9 @@ class YAxis(Axis):
339
359
  on_click: Optional[
340
360
  Union[EventHandler, EventSpec, list, function, BaseVar]
341
361
  ] = None,
362
+ on_mouse_down: Optional[
363
+ Union[EventHandler, EventSpec, list, function, BaseVar]
364
+ ] = None,
342
365
  on_mouse_enter: Optional[
343
366
  Union[EventHandler, EventSpec, list, function, BaseVar]
344
367
  ] = None,
@@ -354,6 +377,9 @@ class YAxis(Axis):
354
377
  on_mouse_over: Optional[
355
378
  Union[EventHandler, EventSpec, list, function, BaseVar]
356
379
  ] = None,
380
+ on_mouse_up: Optional[
381
+ Union[EventHandler, EventSpec, list, function, BaseVar]
382
+ ] = None,
357
383
  **props
358
384
  ) -> "YAxis":
359
385
  """Create the component.
@@ -362,13 +388,14 @@ class YAxis(Axis):
362
388
  *children: The children of the component.
363
389
  data_key: The key of a group of data which should be unique in an area chart.
364
390
  hide: If set true, the axis do not display in the chart.
391
+ width: The width of axis which is usually calculated internally.
392
+ height: The height of axis, which can be setted by user.
365
393
  orientation: The orientation of axis 'top' | 'bottom'
366
394
  type_: The type of axis 'number' | 'category'
367
395
  allow_decimals: Allow the ticks of XAxis to be decimals or not.
368
396
  allow_data_overflow: When domain of the axis is specified and the type of the axis is 'number', if allowDataOverflow is set to be false, the domain will be adjusted when the minimum value of data is smaller than domain[0] or the maximum value of data is greater than domain[1] so that the axis displays all data values. If set to true, graphic elements (line, area, bars) will be clipped to conform to the specified domain.
369
397
  allow_duplicated_category: Allow the axis has duplicated categorys or not when the type of axis is "category".
370
398
  axis_line: If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line.
371
- tick_line: If set false, no axis tick lines will be drawn. If set a object, the option is the configuration of tick lines.
372
399
  mirror: If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside.
373
400
  reversed: Reverse the ticks or not.
374
401
  scale: If 'auto' set, the scale function is decided by the type of chart, and the props type. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold' | Function
@@ -519,7 +546,7 @@ class Brush(Recharts):
519
546
  def create( # type: ignore
520
547
  cls,
521
548
  *children,
522
- stroke: Optional[Union[Var[str], str]] = None,
549
+ stroke: Optional[Union[Var[Union[str, Color]], Union[str, Color]]] = None,
523
550
  data_key: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None,
524
551
  x: Optional[Union[Var[int], int]] = None,
525
552
  y: Optional[Union[Var[int], int]] = None,
@@ -594,6 +621,9 @@ class Cartesian(Recharts):
594
621
  on_click: Optional[
595
622
  Union[EventHandler, EventSpec, list, function, BaseVar]
596
623
  ] = None,
624
+ on_mouse_down: Optional[
625
+ Union[EventHandler, EventSpec, list, function, BaseVar]
626
+ ] = None,
597
627
  on_mouse_enter: Optional[
598
628
  Union[EventHandler, EventSpec, list, function, BaseVar]
599
629
  ] = None,
@@ -609,6 +639,9 @@ class Cartesian(Recharts):
609
639
  on_mouse_over: Optional[
610
640
  Union[EventHandler, EventSpec, list, function, BaseVar]
611
641
  ] = None,
642
+ on_mouse_up: Optional[
643
+ Union[EventHandler, EventSpec, list, function, BaseVar]
644
+ ] = None,
612
645
  **props
613
646
  ) -> "Cartesian":
614
647
  """Create the component.
@@ -638,9 +671,9 @@ class Area(Cartesian):
638
671
  def create( # type: ignore
639
672
  cls,
640
673
  *children,
641
- stroke: Optional[Union[Var[str], str]] = None,
674
+ stroke: Optional[Union[Var[Union[str, Color]], Union[str, Color]]] = None,
642
675
  stroke_width: Optional[Union[Var[int], int]] = None,
643
- fill: Optional[Union[Var[str], str]] = None,
676
+ fill: Optional[Union[Var[Union[str, Color]], Union[str, Color]]] = None,
644
677
  type_: Optional[
645
678
  Union[
646
679
  Var[
@@ -703,6 +736,9 @@ class Area(Cartesian):
703
736
  on_click: Optional[
704
737
  Union[EventHandler, EventSpec, list, function, BaseVar]
705
738
  ] = None,
739
+ on_mouse_down: Optional[
740
+ Union[EventHandler, EventSpec, list, function, BaseVar]
741
+ ] = None,
706
742
  on_mouse_enter: Optional[
707
743
  Union[EventHandler, EventSpec, list, function, BaseVar]
708
744
  ] = None,
@@ -718,6 +754,9 @@ class Area(Cartesian):
718
754
  on_mouse_over: Optional[
719
755
  Union[EventHandler, EventSpec, list, function, BaseVar]
720
756
  ] = None,
757
+ on_mouse_up: Optional[
758
+ Union[EventHandler, EventSpec, list, function, BaseVar]
759
+ ] = None,
721
760
  **props
722
761
  ) -> "Area":
723
762
  """Create the component.
@@ -755,9 +794,9 @@ class Bar(Cartesian):
755
794
  def create( # type: ignore
756
795
  cls,
757
796
  *children,
758
- stroke: Optional[Union[Var[str], str]] = None,
797
+ stroke: Optional[Union[Var[Union[str, Color]], Union[str, Color]]] = None,
759
798
  stroke_width: Optional[Union[Var[int], int]] = None,
760
- fill: Optional[Union[Var[str], str]] = None,
799
+ fill: Optional[Union[Var[Union[str, Color]], Union[str, Color]]] = None,
761
800
  background: Optional[Union[Var[bool], bool]] = None,
762
801
  label: Optional[Union[Var[bool], bool]] = None,
763
802
  stack_id: Optional[Union[Var[str], str]] = None,
@@ -781,6 +820,9 @@ class Bar(Cartesian):
781
820
  on_click: Optional[
782
821
  Union[EventHandler, EventSpec, list, function, BaseVar]
783
822
  ] = None,
823
+ on_mouse_down: Optional[
824
+ Union[EventHandler, EventSpec, list, function, BaseVar]
825
+ ] = None,
784
826
  on_mouse_enter: Optional[
785
827
  Union[EventHandler, EventSpec, list, function, BaseVar]
786
828
  ] = None,
@@ -796,6 +838,9 @@ class Bar(Cartesian):
796
838
  on_mouse_over: Optional[
797
839
  Union[EventHandler, EventSpec, list, function, BaseVar]
798
840
  ] = None,
841
+ on_mouse_up: Optional[
842
+ Union[EventHandler, EventSpec, list, function, BaseVar]
843
+ ] = None,
799
844
  **props
800
845
  ) -> "Bar":
801
846
  """Create the component.
@@ -873,7 +918,7 @@ class Line(Cartesian):
873
918
  ],
874
919
  ]
875
920
  ] = None,
876
- stroke: Optional[Union[Var[str], str]] = None,
921
+ stroke: Optional[Union[Var[Union[str, Color]], Union[str, Color]]] = None,
877
922
  stoke_width: Optional[Union[Var[int], int]] = None,
878
923
  dot: Optional[Union[Var[bool], bool]] = None,
879
924
  active_dot: Optional[Union[Var[bool], bool]] = None,
@@ -898,6 +943,9 @@ class Line(Cartesian):
898
943
  on_click: Optional[
899
944
  Union[EventHandler, EventSpec, list, function, BaseVar]
900
945
  ] = None,
946
+ on_mouse_down: Optional[
947
+ Union[EventHandler, EventSpec, list, function, BaseVar]
948
+ ] = None,
901
949
  on_mouse_enter: Optional[
902
950
  Union[EventHandler, EventSpec, list, function, BaseVar]
903
951
  ] = None,
@@ -913,6 +961,9 @@ class Line(Cartesian):
913
961
  on_mouse_over: Optional[
914
962
  Union[EventHandler, EventSpec, list, function, BaseVar]
915
963
  ] = None,
964
+ on_mouse_up: Optional[
965
+ Union[EventHandler, EventSpec, list, function, BaseVar]
966
+ ] = None,
916
967
  **props
917
968
  ) -> "Line":
918
969
  """Create the component.
@@ -974,7 +1025,7 @@ class Scatter(Cartesian):
974
1025
  line_type: Optional[
975
1026
  Union[Var[Literal["joint", "fitting"]], Literal["joint", "fitting"]]
976
1027
  ] = None,
977
- fill: Optional[Union[Var[str], str]] = None,
1028
+ fill: Optional[Union[Var[Union[str, Color]], Union[str, Color]]] = None,
978
1029
  name: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None,
979
1030
  layout: Optional[
980
1031
  Union[
@@ -994,6 +1045,9 @@ class Scatter(Cartesian):
994
1045
  on_click: Optional[
995
1046
  Union[EventHandler, EventSpec, list, function, BaseVar]
996
1047
  ] = None,
1048
+ on_mouse_down: Optional[
1049
+ Union[EventHandler, EventSpec, list, function, BaseVar]
1050
+ ] = None,
997
1051
  on_mouse_enter: Optional[
998
1052
  Union[EventHandler, EventSpec, list, function, BaseVar]
999
1053
  ] = None,
@@ -1009,6 +1063,9 @@ class Scatter(Cartesian):
1009
1063
  on_mouse_over: Optional[
1010
1064
  Union[EventHandler, EventSpec, list, function, BaseVar]
1011
1065
  ] = None,
1066
+ on_mouse_up: Optional[
1067
+ Union[EventHandler, EventSpec, list, function, BaseVar]
1068
+ ] = None,
1012
1069
  **props
1013
1070
  ) -> "Scatter":
1014
1071
  """Create the component.
@@ -1040,6 +1097,7 @@ class Scatter(Cartesian):
1040
1097
  ...
1041
1098
 
1042
1099
  class Funnel(Cartesian):
1100
+ def get_event_triggers(self) -> dict[str, Union[Var, Any]]: ...
1043
1101
  @overload
1044
1102
  @classmethod
1045
1103
  def create( # type: ignore
@@ -1072,6 +1130,9 @@ class Funnel(Cartesian):
1072
1130
  on_click: Optional[
1073
1131
  Union[EventHandler, EventSpec, list, function, BaseVar]
1074
1132
  ] = None,
1133
+ on_mouse_down: Optional[
1134
+ Union[EventHandler, EventSpec, list, function, BaseVar]
1135
+ ] = None,
1075
1136
  on_mouse_enter: Optional[
1076
1137
  Union[EventHandler, EventSpec, list, function, BaseVar]
1077
1138
  ] = None,
@@ -1087,6 +1148,9 @@ class Funnel(Cartesian):
1087
1148
  on_mouse_over: Optional[
1088
1149
  Union[EventHandler, EventSpec, list, function, BaseVar]
1089
1150
  ] = None,
1151
+ on_mouse_up: Optional[
1152
+ Union[EventHandler, EventSpec, list, function, BaseVar]
1153
+ ] = None,
1090
1154
  **props
1091
1155
  ) -> "Funnel":
1092
1156
  """Create the component.
@@ -1125,7 +1189,7 @@ class ErrorBar(Recharts):
1125
1189
  ] = None,
1126
1190
  data_key: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None,
1127
1191
  width: Optional[Union[Var[int], int]] = None,
1128
- stroke: Optional[Union[Var[str], str]] = None,
1192
+ stroke: Optional[Union[Var[Union[str, Color]], Union[str, Color]]] = None,
1129
1193
  stroke_width: Optional[Union[Var[int], int]] = None,
1130
1194
  style: Optional[Style] = None,
1131
1195
  key: Optional[Any] = None,
@@ -1463,8 +1527,8 @@ class ReferenceArea(Recharts):
1463
1527
  def create( # type: ignore
1464
1528
  cls,
1465
1529
  *children,
1466
- stroke: Optional[Union[Var[str], str]] = None,
1467
- fill: Optional[Union[Var[str], str]] = None,
1530
+ stroke: Optional[Union[Var[Union[str, Color]], Union[str, Color]]] = None,
1531
+ fill: Optional[Union[Var[Union[str, Color]], Union[str, Color]]] = None,
1468
1532
  fill_opacity: Optional[Union[Var[float], float]] = None,
1469
1533
  x_axis_id: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None,
1470
1534
  y_axis_id: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None,
@@ -1652,7 +1716,7 @@ class CartesianGrid(Grid):
1652
1716
  *children,
1653
1717
  horizontal: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None,
1654
1718
  vertical: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None,
1655
- fill: Optional[Union[Var[str], str]] = None,
1719
+ fill: Optional[Union[Var[Union[str, Color]], Union[str, Color]]] = None,
1656
1720
  fill_opacity: Optional[Union[Var[float], float]] = None,
1657
1721
  stroke_dasharray: Optional[Union[Var[str], str]] = None,
1658
1722
  x: Optional[Union[Var[int], int]] = None,
@@ -6,6 +6,7 @@ from typing import Any, Dict, List, Union
6
6
  from reflex.components.component import Component
7
7
  from reflex.components.recharts.general import ResponsiveContainer
8
8
  from reflex.constants import EventTriggers
9
+ from reflex.event import EventHandler
9
10
  from reflex.vars import Var
10
11
 
11
12
  from .recharts import (
@@ -126,9 +127,6 @@ class AreaChart(ChartBase):
126
127
  # The base value of area. Number | 'dataMin' | 'dataMax' | 'auto'
127
128
  base_value: Var[Union[int, LiteralComposedChartBaseValue]]
128
129
 
129
- # The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape.
130
- stack_offset: Var[LiteralStackOffset]
131
-
132
130
  # Valid children components
133
131
  _valid_children: List[str] = [
134
132
  "XAxis",
@@ -152,10 +150,10 @@ class BarChart(ChartBase):
152
150
  alias = "RechartsBarChart"
153
151
 
154
152
  # The gap between two bar categories, which can be a percent value or a fixed value. Percentage | Number
155
- bar_category_gap: Var[Union[str, int]] # type: ignore
153
+ bar_category_gap: Var[Union[str, int]] = Var.create_safe("10%") # type: ignore
156
154
 
157
155
  # The gap between two bars in the same category, which can be a percent value or a fixed value. Percentage | Number
158
- bar_gap: Var[Union[str, int]] # type: ignore
156
+ bar_gap: Var[Union[str, int]] = Var.create_safe(4) # type: ignore
159
157
 
160
158
  # The width of all the bars in the chart. Number
161
159
  bar_size: Var[int]
@@ -319,7 +317,6 @@ class RadarChart(ChartBase):
319
317
  return {
320
318
  EventTriggers.ON_CLICK: lambda: [],
321
319
  EventTriggers.ON_MOUSE_ENTER: lambda: [],
322
- EventTriggers.ON_MOUSE_MOVE: lambda: [],
323
320
  EventTriggers.ON_MOUSE_LEAVE: lambda: [],
324
321
  }
325
322
 
@@ -377,7 +374,6 @@ class RadialBarChart(ChartBase):
377
374
  return {
378
375
  EventTriggers.ON_CLICK: lambda: [],
379
376
  EventTriggers.ON_MOUSE_ENTER: lambda: [],
380
- EventTriggers.ON_MOUSE_MOVE: lambda: [],
381
377
  EventTriggers.ON_MOUSE_LEAVE: lambda: [],
382
378
  }
383
379
 
@@ -412,10 +408,12 @@ class ScatterChart(ChartBase):
412
408
  """
413
409
  return {
414
410
  EventTriggers.ON_CLICK: lambda: [],
411
+ EventTriggers.ON_MOUSE_DOWN: lambda: [],
412
+ EventTriggers.ON_MOUSE_UP: lambda: [],
413
+ EventTriggers.ON_MOUSE_MOVE: lambda: [],
415
414
  EventTriggers.ON_MOUSE_OVER: lambda: [],
416
415
  EventTriggers.ON_MOUSE_OUT: lambda: [],
417
416
  EventTriggers.ON_MOUSE_ENTER: lambda: [],
418
- EventTriggers.ON_MOUSE_MOVE: lambda: [],
419
417
  EventTriggers.ON_MOUSE_LEAVE: lambda: [],
420
418
  }
421
419
 
@@ -457,19 +455,6 @@ class FunnelChart(RechartsCharts):
457
455
  # Valid children components
458
456
  _valid_children: List[str] = ["Legend", "GraphingTooltip", "Funnel"]
459
457
 
460
- def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
461
- """Get the event triggers that pass the component's value to the handler.
462
-
463
- Returns:
464
- A dict mapping the event trigger to the var that is passed to the handler.
465
- """
466
- return {
467
- EventTriggers.ON_CLICK: lambda: [],
468
- EventTriggers.ON_MOUSE_ENTER: lambda: [],
469
- EventTriggers.ON_MOUSE_MOVE: lambda: [],
470
- EventTriggers.ON_MOUSE_LEAVE: lambda: [],
471
- }
472
-
473
458
 
474
459
  class Treemap(RechartsCharts):
475
460
  """A Treemap chart component in Recharts."""
@@ -505,6 +490,12 @@ class Treemap(RechartsCharts):
505
490
  # The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'
506
491
  animation_easing: Var[LiteralAnimationEasing]
507
492
 
493
+ # The customized event handler of animation start
494
+ on_animation_start: EventHandler[lambda: []]
495
+
496
+ # The customized event handler of animation end
497
+ on_animation_end: EventHandler[lambda: []]
498
+
508
499
  @classmethod
509
500
  def create(cls, *children, **props) -> Component:
510
501
  """Create a chart component.