reflex 0.4.9a2__py3-none-any.whl → 0.5.0a1__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 (131) hide show
  1. reflex/.templates/apps/blank/code/blank.py +19 -16
  2. reflex/.templates/apps/demo/code/pages/datatable.py +4 -4
  3. reflex/.templates/apps/demo/code/pages/forms.py +2 -2
  4. reflex/.templates/web/utils/helpers/debounce.js +17 -0
  5. reflex/.templates/web/utils/helpers/throttle.js +22 -0
  6. reflex/.templates/web/utils/state.js +21 -3
  7. reflex/__init__.py +6 -1
  8. reflex/__init__.pyi +4 -1
  9. reflex/app.py +157 -140
  10. reflex/app_module_for_backend.py +1 -1
  11. reflex/base.py +13 -15
  12. reflex/compiler/compiler.py +10 -1
  13. reflex/compiler/utils.py +3 -30
  14. reflex/components/__init__.py +1 -0
  15. reflex/components/chakra/datadisplay/list.py +1 -3
  16. reflex/components/chakra/datadisplay/list.pyi +3 -3
  17. reflex/components/chakra/disclosure/accordion.py +1 -1
  18. reflex/components/chakra/forms/pininput.pyi +1 -1
  19. reflex/components/chakra/media/icon.py +2 -2
  20. reflex/components/component.py +279 -32
  21. reflex/components/core/__init__.py +2 -2
  22. reflex/components/core/cond.py +1 -10
  23. reflex/components/core/debounce.py +5 -2
  24. reflex/components/core/debounce.pyi +4 -2
  25. reflex/components/core/foreach.py +1 -16
  26. reflex/components/core/html.py +6 -0
  27. reflex/components/core/match.py +2 -17
  28. reflex/components/core/upload.py +42 -1
  29. reflex/components/core/upload.pyi +199 -1
  30. reflex/components/datadisplay/code.py +7 -3
  31. reflex/components/datadisplay/code.pyi +3 -1
  32. reflex/components/el/elements/forms.py +1 -1
  33. reflex/components/el/elements/forms.pyi +1 -1
  34. reflex/components/lucide/icon.py +5 -13
  35. reflex/components/lucide/icon.pyi +0 -1
  36. reflex/components/markdown/markdown.py +5 -23
  37. reflex/components/markdown/markdown.pyi +1 -4
  38. reflex/components/radix/primitives/accordion.py +227 -406
  39. reflex/components/radix/primitives/accordion.pyi +369 -28
  40. reflex/components/radix/primitives/form.py +33 -29
  41. reflex/components/radix/primitives/form.pyi +7 -2
  42. reflex/components/radix/primitives/progress.py +17 -9
  43. reflex/components/radix/primitives/progress.pyi +2 -0
  44. reflex/components/radix/primitives/slider.py +30 -18
  45. reflex/components/radix/primitives/slider.pyi +4 -0
  46. reflex/components/radix/themes/base.py +8 -1
  47. reflex/components/radix/themes/base.pyi +79 -1
  48. reflex/components/radix/themes/color_mode.py +74 -30
  49. reflex/components/radix/themes/color_mode.pyi +26 -185
  50. reflex/components/radix/themes/components/__init__.py +17 -0
  51. reflex/components/radix/themes/components/badge.py +2 -1
  52. reflex/components/radix/themes/components/badge.pyi +3 -1
  53. reflex/components/radix/themes/components/button.py +3 -1
  54. reflex/components/radix/themes/components/button.pyi +4 -1
  55. reflex/components/radix/themes/components/checkbox_cards.py +48 -0
  56. reflex/components/radix/themes/components/checkbox_cards.pyi +264 -0
  57. reflex/components/radix/themes/components/checkbox_group.py +42 -0
  58. reflex/components/radix/themes/components/checkbox_group.pyi +253 -0
  59. reflex/components/radix/themes/components/data_list.py +63 -0
  60. reflex/components/radix/themes/components/data_list.pyi +426 -0
  61. reflex/components/radix/themes/components/icon_button.py +20 -17
  62. reflex/components/radix/themes/components/icon_button.pyi +5 -1
  63. reflex/components/radix/themes/components/progress.py +55 -0
  64. reflex/components/radix/themes/components/progress.pyi +180 -0
  65. reflex/components/radix/themes/components/radio.py +31 -0
  66. reflex/components/radix/themes/components/radio.pyi +169 -0
  67. reflex/components/radix/themes/components/radio_cards.py +48 -0
  68. reflex/components/radix/themes/components/radio_cards.pyi +264 -0
  69. reflex/components/radix/themes/components/radio_group.py +2 -4
  70. reflex/components/radix/themes/components/segmented_control.py +48 -0
  71. reflex/components/radix/themes/components/segmented_control.pyi +262 -0
  72. reflex/components/radix/themes/components/skeleton.py +32 -0
  73. reflex/components/radix/themes/components/skeleton.pyi +106 -0
  74. reflex/components/radix/themes/components/spinner.py +26 -0
  75. reflex/components/radix/themes/components/spinner.pyi +101 -0
  76. reflex/components/radix/themes/components/tabs.py +26 -1
  77. reflex/components/radix/themes/components/tabs.pyi +69 -9
  78. reflex/components/radix/themes/components/text_field.py +101 -71
  79. reflex/components/radix/themes/components/text_field.pyi +81 -499
  80. reflex/components/radix/themes/layout/base.py +2 -2
  81. reflex/components/radix/themes/layout/base.pyi +4 -4
  82. reflex/components/radix/themes/layout/center.py +8 -3
  83. reflex/components/radix/themes/layout/center.pyi +2 -1
  84. reflex/components/radix/themes/layout/container.py +30 -2
  85. reflex/components/radix/themes/layout/container.pyi +9 -30
  86. reflex/components/radix/themes/layout/list.py +10 -5
  87. reflex/components/radix/themes/layout/list.pyi +5 -21
  88. reflex/components/radix/themes/layout/spacer.py +8 -3
  89. reflex/components/radix/themes/layout/spacer.pyi +2 -1
  90. reflex/components/radix/themes/layout/stack.py +7 -1
  91. reflex/components/radix/themes/layout/stack.pyi +3 -3
  92. reflex/components/radix/themes/typography/link.py +10 -2
  93. reflex/components/radix/themes/typography/link.pyi +5 -4
  94. reflex/components/sonner/__init__.py +3 -0
  95. reflex/components/sonner/toast.py +267 -0
  96. reflex/components/sonner/toast.pyi +205 -0
  97. reflex/components/tags/iter_tag.py +9 -6
  98. reflex/config.py +30 -54
  99. reflex/constants/__init__.py +0 -2
  100. reflex/constants/base.py +0 -5
  101. reflex/constants/colors.py +2 -0
  102. reflex/constants/installer.py +5 -1
  103. reflex/constants/route.py +4 -0
  104. reflex/custom_components/custom_components.py +22 -1
  105. reflex/event.py +75 -30
  106. reflex/experimental/__init__.py +5 -0
  107. reflex/experimental/layout.py +24 -6
  108. reflex/model.py +2 -1
  109. reflex/page.py +7 -4
  110. reflex/reflex.py +8 -3
  111. reflex/route.py +39 -0
  112. reflex/state.py +128 -131
  113. reflex/style.py +20 -1
  114. reflex/testing.py +10 -6
  115. reflex/utils/console.py +3 -1
  116. reflex/utils/exec.py +20 -7
  117. reflex/utils/format.py +1 -1
  118. reflex/utils/imports.py +3 -1
  119. reflex/utils/prerequisites.py +141 -20
  120. reflex/utils/processes.py +21 -1
  121. reflex/utils/pyi_generator.py +95 -5
  122. reflex/utils/serializers.py +1 -1
  123. reflex/utils/telemetry.py +26 -4
  124. reflex/utils/types.py +62 -18
  125. reflex/vars.py +11 -5
  126. {reflex-0.4.9a2.dist-info → reflex-0.5.0a1.dist-info}/METADATA +16 -4
  127. {reflex-0.4.9a2.dist-info → reflex-0.5.0a1.dist-info}/RECORD +130 -108
  128. {reflex-0.4.9a2.dist-info → reflex-0.5.0a1.dist-info}/WHEEL +1 -1
  129. reflex/app.pyi +0 -149
  130. {reflex-0.4.9a2.dist-info → reflex-0.5.0a1.dist-info}/LICENSE +0 -0
  131. {reflex-0.4.9a2.dist-info → reflex-0.5.0a1.dist-info}/entry_points.txt +0 -0
@@ -9,41 +9,95 @@ from reflex.event import EventChain, EventHandler, EventSpec
9
9
  from reflex.style import Style
10
10
  from typing import Any, Dict, List, Literal, Optional, Union
11
11
  from reflex.components.component import Component, ComponentNamespace
12
- from reflex.components.core.match import Match
12
+ from reflex.components.core.colors import color
13
13
  from reflex.components.lucide.icon import Icon
14
14
  from reflex.components.radix.primitives.base import RadixPrimitiveComponent
15
15
  from reflex.components.radix.themes.base import LiteralAccentColor
16
- from reflex.style import (
17
- Style,
18
- convert_dict_to_style_and_format_emotion,
19
- format_as_emotion,
20
- )
16
+ from reflex.style import Style
21
17
  from reflex.utils import imports
22
- from reflex.vars import BaseVar, Var, VarData, get_uuid_string_var
18
+ from reflex.vars import Var, get_uuid_string_var
23
19
 
24
20
  LiteralAccordionType = Literal["single", "multiple"]
25
21
  LiteralAccordionDir = Literal["ltr", "rtl"]
26
22
  LiteralAccordionOrientation = Literal["vertical", "horizontal"]
27
- LiteralAccordionRootVariant = Literal["classic", "soft", "surface", "outline", "ghost"]
28
- LiteralAccordionRootColorScheme = Literal["primary", "accent"]
23
+ LiteralAccordionVariant = Literal["classic", "soft", "surface", "outline", "ghost"]
29
24
  DEFAULT_ANIMATION_DURATION = 250
30
25
 
31
- def get_theme_accordion_root(variant: Var[str], color_scheme: Var[str]) -> BaseVar: ...
32
- def get_theme_accordion_item(): ...
33
- def get_theme_accordion_header() -> dict[str, str]: ...
34
- def get_theme_accordion_trigger(
35
- variant: str | Var, color_scheme: str | Var
36
- ) -> BaseVar: ...
37
- def get_theme_accordion_content(
38
- variant: str | Var, color_scheme: str | Var
39
- ) -> BaseVar: ...
40
-
41
26
  class AccordionComponent(RadixPrimitiveComponent):
27
+ def add_style(self) -> Style | None: ...
42
28
  @overload
43
29
  @classmethod
44
30
  def create( # type: ignore
45
31
  cls,
46
32
  *children,
33
+ color_scheme: Optional[
34
+ Union[
35
+ Var[
36
+ Literal[
37
+ "tomato",
38
+ "red",
39
+ "ruby",
40
+ "crimson",
41
+ "pink",
42
+ "plum",
43
+ "purple",
44
+ "violet",
45
+ "iris",
46
+ "indigo",
47
+ "blue",
48
+ "cyan",
49
+ "teal",
50
+ "jade",
51
+ "green",
52
+ "grass",
53
+ "brown",
54
+ "orange",
55
+ "sky",
56
+ "mint",
57
+ "lime",
58
+ "yellow",
59
+ "amber",
60
+ "gold",
61
+ "bronze",
62
+ "gray",
63
+ ]
64
+ ],
65
+ Literal[
66
+ "tomato",
67
+ "red",
68
+ "ruby",
69
+ "crimson",
70
+ "pink",
71
+ "plum",
72
+ "purple",
73
+ "violet",
74
+ "iris",
75
+ "indigo",
76
+ "blue",
77
+ "cyan",
78
+ "teal",
79
+ "jade",
80
+ "green",
81
+ "grass",
82
+ "brown",
83
+ "orange",
84
+ "sky",
85
+ "mint",
86
+ "lime",
87
+ "yellow",
88
+ "amber",
89
+ "gold",
90
+ "bronze",
91
+ "gray",
92
+ ],
93
+ ]
94
+ ] = None,
95
+ variant: Optional[
96
+ Union[
97
+ Var[Literal["classic", "soft", "surface", "outline", "ghost"]],
98
+ Literal["classic", "soft", "surface", "outline", "ghost"],
99
+ ]
100
+ ] = None,
47
101
  as_child: Optional[Union[Var[bool], bool]] = None,
48
102
  style: Optional[Style] = None,
49
103
  key: Optional[Any] = None,
@@ -102,6 +156,8 @@ class AccordionComponent(RadixPrimitiveComponent):
102
156
 
103
157
  Args:
104
158
  *children: The children of the component.
159
+ color_scheme: The color scheme of the component.
160
+ variant: The variant of the component.
105
161
  as_child: Change the default rendered element for the one passed as a child.
106
162
  style: The style of the component.
107
163
  key: A unique key for the component.
@@ -208,8 +264,6 @@ class AccordionRoot(AccordionComponent):
208
264
  ],
209
265
  ]
210
266
  ] = None,
211
- _dynamic_themes: Optional[Union[Var[dict], dict]] = None,
212
- _var_data: Optional[VarData] = None,
213
267
  as_child: Optional[Union[Var[bool], bool]] = None,
214
268
  style: Optional[Style] = None,
215
269
  key: Optional[Any] = None,
@@ -278,10 +332,8 @@ class AccordionRoot(AccordionComponent):
278
332
  disabled: Whether or not the accordion is disabled.
279
333
  dir: The reading direction of the accordion when applicable.
280
334
  orientation: The orientation of the accordion.
281
- variant: The variant of the accordion.
282
- color_scheme: The color scheme of the accordion.
283
- _dynamic_themes: dynamic themes of the accordion generated at compile time.
284
- _var_data: The var_data associated with the component.
335
+ variant: The variant of the component.
336
+ color_scheme: The color scheme of the component.
285
337
  as_child: Change the default rendered element for the one passed as a child.
286
338
  style: The style of the component.
287
339
  key: A unique key for the component.
@@ -296,6 +348,7 @@ class AccordionRoot(AccordionComponent):
296
348
  """
297
349
  ...
298
350
  def get_event_triggers(self) -> Dict[str, Any]: ...
351
+ def add_style(self): ...
299
352
 
300
353
  class AccordionItem(AccordionComponent):
301
354
  @overload
@@ -303,10 +356,78 @@ class AccordionItem(AccordionComponent):
303
356
  def create( # type: ignore
304
357
  cls,
305
358
  *children,
306
- header: Optional[Component | Var] = None,
307
- content: Optional[Component | Var] = None,
359
+ header: Optional[Union[Component, Var]] = None,
360
+ content: Optional[Union[Component, Var]] = None,
308
361
  value: Optional[Union[Var[str], str]] = None,
309
362
  disabled: Optional[Union[Var[bool], bool]] = None,
363
+ color_scheme: Optional[
364
+ Union[
365
+ Var[
366
+ Literal[
367
+ "tomato",
368
+ "red",
369
+ "ruby",
370
+ "crimson",
371
+ "pink",
372
+ "plum",
373
+ "purple",
374
+ "violet",
375
+ "iris",
376
+ "indigo",
377
+ "blue",
378
+ "cyan",
379
+ "teal",
380
+ "jade",
381
+ "green",
382
+ "grass",
383
+ "brown",
384
+ "orange",
385
+ "sky",
386
+ "mint",
387
+ "lime",
388
+ "yellow",
389
+ "amber",
390
+ "gold",
391
+ "bronze",
392
+ "gray",
393
+ ]
394
+ ],
395
+ Literal[
396
+ "tomato",
397
+ "red",
398
+ "ruby",
399
+ "crimson",
400
+ "pink",
401
+ "plum",
402
+ "purple",
403
+ "violet",
404
+ "iris",
405
+ "indigo",
406
+ "blue",
407
+ "cyan",
408
+ "teal",
409
+ "jade",
410
+ "green",
411
+ "grass",
412
+ "brown",
413
+ "orange",
414
+ "sky",
415
+ "mint",
416
+ "lime",
417
+ "yellow",
418
+ "amber",
419
+ "gold",
420
+ "bronze",
421
+ "gray",
422
+ ],
423
+ ]
424
+ ] = None,
425
+ variant: Optional[
426
+ Union[
427
+ Var[Literal["classic", "soft", "surface", "outline", "ghost"]],
428
+ Literal["classic", "soft", "surface", "outline", "ghost"],
429
+ ]
430
+ ] = None,
310
431
  as_child: Optional[Union[Var[bool], bool]] = None,
311
432
  style: Optional[Style] = None,
312
433
  key: Optional[Any] = None,
@@ -364,11 +485,13 @@ class AccordionItem(AccordionComponent):
364
485
  """Create an accordion item.
365
486
 
366
487
  Args:
488
+ *children: The list of children to use if header and content are not provided.
367
489
  header: The header of the accordion item.
368
490
  content: The content of the accordion item.
369
- *children: The list of children to use if header and content are not provided.
370
491
  value: A unique identifier for the item.
371
492
  disabled: When true, prevents the user from interacting with the item.
493
+ color_scheme: The color scheme of the component.
494
+ variant: The variant of the component.
372
495
  as_child: Change the default rendered element for the one passed as a child.
373
496
  style: The style of the component.
374
497
  key: A unique key for the component.
@@ -382,6 +505,7 @@ class AccordionItem(AccordionComponent):
382
505
  The accordion item.
383
506
  """
384
507
  ...
508
+ def add_style(self) -> Style | None: ...
385
509
 
386
510
  class AccordionHeader(AccordionComponent):
387
511
  @overload
@@ -389,6 +513,74 @@ class AccordionHeader(AccordionComponent):
389
513
  def create( # type: ignore
390
514
  cls,
391
515
  *children,
516
+ color_scheme: Optional[
517
+ Union[
518
+ Var[
519
+ Literal[
520
+ "tomato",
521
+ "red",
522
+ "ruby",
523
+ "crimson",
524
+ "pink",
525
+ "plum",
526
+ "purple",
527
+ "violet",
528
+ "iris",
529
+ "indigo",
530
+ "blue",
531
+ "cyan",
532
+ "teal",
533
+ "jade",
534
+ "green",
535
+ "grass",
536
+ "brown",
537
+ "orange",
538
+ "sky",
539
+ "mint",
540
+ "lime",
541
+ "yellow",
542
+ "amber",
543
+ "gold",
544
+ "bronze",
545
+ "gray",
546
+ ]
547
+ ],
548
+ Literal[
549
+ "tomato",
550
+ "red",
551
+ "ruby",
552
+ "crimson",
553
+ "pink",
554
+ "plum",
555
+ "purple",
556
+ "violet",
557
+ "iris",
558
+ "indigo",
559
+ "blue",
560
+ "cyan",
561
+ "teal",
562
+ "jade",
563
+ "green",
564
+ "grass",
565
+ "brown",
566
+ "orange",
567
+ "sky",
568
+ "mint",
569
+ "lime",
570
+ "yellow",
571
+ "amber",
572
+ "gold",
573
+ "bronze",
574
+ "gray",
575
+ ],
576
+ ]
577
+ ] = None,
578
+ variant: Optional[
579
+ Union[
580
+ Var[Literal["classic", "soft", "surface", "outline", "ghost"]],
581
+ Literal["classic", "soft", "surface", "outline", "ghost"],
582
+ ]
583
+ ] = None,
392
584
  as_child: Optional[Union[Var[bool], bool]] = None,
393
585
  style: Optional[Style] = None,
394
586
  key: Optional[Any] = None,
@@ -447,6 +639,8 @@ class AccordionHeader(AccordionComponent):
447
639
 
448
640
  Args:
449
641
  *children: The children of the component.
642
+ color_scheme: The color scheme of the component.
643
+ variant: The variant of the component.
450
644
  as_child: Change the default rendered element for the one passed as a child.
451
645
  style: The style of the component.
452
646
  key: A unique key for the component.
@@ -460,6 +654,9 @@ class AccordionHeader(AccordionComponent):
460
654
  The Accordion header Component.
461
655
  """
462
656
  ...
657
+ def add_style(self) -> Style | None: ...
658
+
659
+ cubic_bezier = "cubic-bezier(0.87, 0, 0.13, 1)"
463
660
 
464
661
  class AccordionTrigger(AccordionComponent):
465
662
  @overload
@@ -467,6 +664,74 @@ class AccordionTrigger(AccordionComponent):
467
664
  def create( # type: ignore
468
665
  cls,
469
666
  *children,
667
+ color_scheme: Optional[
668
+ Union[
669
+ Var[
670
+ Literal[
671
+ "tomato",
672
+ "red",
673
+ "ruby",
674
+ "crimson",
675
+ "pink",
676
+ "plum",
677
+ "purple",
678
+ "violet",
679
+ "iris",
680
+ "indigo",
681
+ "blue",
682
+ "cyan",
683
+ "teal",
684
+ "jade",
685
+ "green",
686
+ "grass",
687
+ "brown",
688
+ "orange",
689
+ "sky",
690
+ "mint",
691
+ "lime",
692
+ "yellow",
693
+ "amber",
694
+ "gold",
695
+ "bronze",
696
+ "gray",
697
+ ]
698
+ ],
699
+ Literal[
700
+ "tomato",
701
+ "red",
702
+ "ruby",
703
+ "crimson",
704
+ "pink",
705
+ "plum",
706
+ "purple",
707
+ "violet",
708
+ "iris",
709
+ "indigo",
710
+ "blue",
711
+ "cyan",
712
+ "teal",
713
+ "jade",
714
+ "green",
715
+ "grass",
716
+ "brown",
717
+ "orange",
718
+ "sky",
719
+ "mint",
720
+ "lime",
721
+ "yellow",
722
+ "amber",
723
+ "gold",
724
+ "bronze",
725
+ "gray",
726
+ ],
727
+ ]
728
+ ] = None,
729
+ variant: Optional[
730
+ Union[
731
+ Var[Literal["classic", "soft", "surface", "outline", "ghost"]],
732
+ Literal["classic", "soft", "surface", "outline", "ghost"],
733
+ ]
734
+ ] = None,
470
735
  as_child: Optional[Union[Var[bool], bool]] = None,
471
736
  style: Optional[Style] = None,
472
737
  key: Optional[Any] = None,
@@ -525,6 +790,8 @@ class AccordionTrigger(AccordionComponent):
525
790
 
526
791
  Args:
527
792
  *children: The children of the component.
793
+ color_scheme: The color scheme of the component.
794
+ variant: The variant of the component.
528
795
  as_child: Change the default rendered element for the one passed as a child.
529
796
  style: The style of the component.
530
797
  key: A unique key for the component.
@@ -538,6 +805,7 @@ class AccordionTrigger(AccordionComponent):
538
805
  The Accordion trigger Component.
539
806
  """
540
807
  ...
808
+ def add_style(self) -> Style | None: ...
541
809
 
542
810
  class AccordionIcon(Icon):
543
811
  @overload
@@ -618,11 +886,80 @@ class AccordionIcon(Icon):
618
886
  ...
619
887
 
620
888
  class AccordionContent(AccordionComponent):
889
+ def add_imports(self) -> imports.ImportDict: ...
621
890
  @overload
622
891
  @classmethod
623
892
  def create( # type: ignore
624
893
  cls,
625
894
  *children,
895
+ color_scheme: Optional[
896
+ Union[
897
+ Var[
898
+ Literal[
899
+ "tomato",
900
+ "red",
901
+ "ruby",
902
+ "crimson",
903
+ "pink",
904
+ "plum",
905
+ "purple",
906
+ "violet",
907
+ "iris",
908
+ "indigo",
909
+ "blue",
910
+ "cyan",
911
+ "teal",
912
+ "jade",
913
+ "green",
914
+ "grass",
915
+ "brown",
916
+ "orange",
917
+ "sky",
918
+ "mint",
919
+ "lime",
920
+ "yellow",
921
+ "amber",
922
+ "gold",
923
+ "bronze",
924
+ "gray",
925
+ ]
926
+ ],
927
+ Literal[
928
+ "tomato",
929
+ "red",
930
+ "ruby",
931
+ "crimson",
932
+ "pink",
933
+ "plum",
934
+ "purple",
935
+ "violet",
936
+ "iris",
937
+ "indigo",
938
+ "blue",
939
+ "cyan",
940
+ "teal",
941
+ "jade",
942
+ "green",
943
+ "grass",
944
+ "brown",
945
+ "orange",
946
+ "sky",
947
+ "mint",
948
+ "lime",
949
+ "yellow",
950
+ "amber",
951
+ "gold",
952
+ "bronze",
953
+ "gray",
954
+ ],
955
+ ]
956
+ ] = None,
957
+ variant: Optional[
958
+ Union[
959
+ Var[Literal["classic", "soft", "surface", "outline", "ghost"]],
960
+ Literal["classic", "soft", "surface", "outline", "ghost"],
961
+ ]
962
+ ] = None,
626
963
  as_child: Optional[Union[Var[bool], bool]] = None,
627
964
  style: Optional[Style] = None,
628
965
  key: Optional[Any] = None,
@@ -681,6 +1018,8 @@ class AccordionContent(AccordionComponent):
681
1018
 
682
1019
  Args:
683
1020
  *children: The children of the component.
1021
+ color_scheme: The color scheme of the component.
1022
+ variant: The variant of the component.
684
1023
  as_child: Change the default rendered element for the one passed as a child.
685
1024
  style: The style of the component.
686
1025
  key: A unique key for the component.
@@ -694,6 +1033,8 @@ class AccordionContent(AccordionComponent):
694
1033
  The Accordion content Component.
695
1034
  """
696
1035
  ...
1036
+ def add_custom_code(self) -> list[str]: ...
1037
+ def add_style(self) -> Style | None: ...
697
1038
 
698
1039
  class Accordion(ComponentNamespace):
699
1040
  content = staticmethod(AccordionContent.create)
@@ -4,10 +4,11 @@ from __future__ import annotations
4
4
 
5
5
  from typing import Any, Dict, Literal
6
6
 
7
- from reflex.components.component import Component, ComponentNamespace
7
+ from reflex.components.component import ComponentNamespace
8
8
  from reflex.components.el.elements.forms import Form as HTMLForm
9
- from reflex.components.radix.themes.components.text_field import TextFieldInput
9
+ from reflex.components.radix.themes.components.text_field import TextFieldRoot
10
10
  from reflex.constants.event import EventTriggers
11
+ from reflex.style import Style
11
12
  from reflex.vars import Var
12
13
 
13
14
  from .base import RadixPrimitiveComponentWithClassName
@@ -37,11 +38,13 @@ class FormRoot(FormComponent, HTMLForm):
37
38
  EventTriggers.ON_CLEAR_SERVER_ERRORS: lambda: [],
38
39
  }
39
40
 
40
- def _apply_theme(self, theme: Component):
41
- return {
42
- "width": "260px",
43
- **self.style,
44
- }
41
+ def add_style(self) -> Style | None:
42
+ """Add style to the component.
43
+
44
+ Returns:
45
+ The style of the component.
46
+ """
47
+ return Style({"width": "260px"})
45
48
 
46
49
 
47
50
  class FormField(FormComponent):
@@ -57,12 +60,13 @@ class FormField(FormComponent):
57
60
  # Flag to mark the form field as invalid, for server side validation.
58
61
  server_invalid: Var[bool]
59
62
 
60
- def _apply_theme(self, theme: Component):
61
- return {
62
- "display": "grid",
63
- "margin_bottom": "10px",
64
- **self.style,
65
- }
63
+ def add_style(self) -> Style | None:
64
+ """Add style to the component.
65
+
66
+ Returns:
67
+ The style of the component.
68
+ """
69
+ return Style({"display": "grid", "margin_bottom": "10px"})
66
70
 
67
71
 
68
72
  class FormLabel(FormComponent):
@@ -72,13 +76,13 @@ class FormLabel(FormComponent):
72
76
 
73
77
  alias = "RadixFormLabel"
74
78
 
75
- def _apply_theme(self, theme: Component):
76
- return {
77
- "font_size": "15px",
78
- "font_weight": "500",
79
- "line_height": "35px",
80
- **self.style,
81
- }
79
+ def add_style(self) -> Style | None:
80
+ """Add style to the component.
81
+
82
+ Returns:
83
+ The style of the component.
84
+ """
85
+ return Style({"font_size": "15px", "font_weight": "500", "line_height": "35px"})
82
86
 
83
87
 
84
88
  class FormControl(FormComponent):
@@ -108,9 +112,9 @@ class FormControl(FormComponent):
108
112
  f"FormControl can only have at most one child, got {len(children)} children"
109
113
  )
110
114
  for child in children:
111
- if not isinstance(child, TextFieldInput):
115
+ if not isinstance(child, TextFieldRoot):
112
116
  raise TypeError(
113
- "Only Radix TextFieldInput is allowed as child of FormControl"
117
+ "Only Radix TextFieldRoot is allowed as child of FormControl"
114
118
  )
115
119
  return super().create(*children, **props)
116
120
 
@@ -145,13 +149,13 @@ class FormMessage(FormComponent):
145
149
  # Forces the message to be shown. This is useful when using server-side validation.
146
150
  force_match: Var[bool]
147
151
 
148
- def _apply_theme(self, theme: Component):
149
- return {
150
- "font_size": "13px",
151
- "opacity": "0.8",
152
- "color": "white",
153
- **self.style,
154
- }
152
+ def add_style(self) -> Style | None:
153
+ """Add style to the component.
154
+
155
+ Returns:
156
+ The style of the component.
157
+ """
158
+ return Style({"font_size": "13px", "opacity": "0.8", "color": "white"})
155
159
 
156
160
 
157
161
  class FormValidityState(FormComponent):
@@ -8,10 +8,11 @@ from reflex.vars import Var, BaseVar, ComputedVar
8
8
  from reflex.event import EventChain, EventHandler, EventSpec
9
9
  from reflex.style import Style
10
10
  from typing import Any, Dict, Literal
11
- from reflex.components.component import Component, ComponentNamespace
11
+ from reflex.components.component import ComponentNamespace
12
12
  from reflex.components.el.elements.forms import Form as HTMLForm
13
- from reflex.components.radix.themes.components.text_field import TextFieldInput
13
+ from reflex.components.radix.themes.components.text_field import TextFieldRoot
14
14
  from reflex.constants.event import EventTriggers
15
+ from reflex.style import Style
15
16
  from reflex.vars import Var
16
17
  from .base import RadixPrimitiveComponentWithClassName
17
18
 
@@ -95,6 +96,7 @@ class FormComponent(RadixPrimitiveComponentWithClassName):
95
96
 
96
97
  class FormRoot(FormComponent, HTMLForm):
97
98
  def get_event_triggers(self) -> Dict[str, Any]: ...
99
+ def add_style(self) -> Style | None: ...
98
100
  @overload
99
101
  @classmethod
100
102
  def create( # type: ignore
@@ -273,6 +275,7 @@ class FormRoot(FormComponent, HTMLForm):
273
275
  ...
274
276
 
275
277
  class FormField(FormComponent):
278
+ def add_style(self) -> Style | None: ...
276
279
  @overload
277
280
  @classmethod
278
281
  def create( # type: ignore
@@ -355,6 +358,7 @@ class FormField(FormComponent):
355
358
  ...
356
359
 
357
360
  class FormLabel(FormComponent):
361
+ def add_style(self) -> Style | None: ...
358
362
  @overload
359
363
  @classmethod
360
364
  def create( # type: ignore
@@ -528,6 +532,7 @@ LiteralMatcher = Literal[
528
532
  ]
529
533
 
530
534
  class FormMessage(FormComponent):
535
+ def add_style(self) -> Style | None: ...
531
536
  @overload
532
537
  @classmethod
533
538
  def create( # type: ignore