reflex 0.4.6a4__py3-none-any.whl → 0.4.7a1__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 (68) hide show
  1. reflex/.templates/apps/blank/code/blank.py +1 -0
  2. reflex/.templates/jinja/custom_components/pyproject.toml.jinja2 +1 -1
  3. reflex/.templates/jinja/custom_components/src.py.jinja2 +8 -8
  4. reflex/.templates/jinja/web/pages/index.js.jinja2 +0 -4
  5. reflex/.templates/jinja/web/pages/stateful_component.js.jinja2 +2 -6
  6. reflex/.templates/web/utils/state.js +6 -1
  7. reflex/__init__.py +2 -0
  8. reflex/__init__.pyi +2 -0
  9. reflex/app.py +12 -16
  10. reflex/app.pyi +2 -0
  11. reflex/compiler/compiler.py +10 -11
  12. reflex/compiler/utils.py +3 -3
  13. reflex/components/chakra/forms/pininput.py +2 -1
  14. reflex/components/component.py +71 -104
  15. reflex/components/core/banner.py +1 -1
  16. reflex/components/core/upload.py +2 -1
  17. reflex/components/datadisplay/__init__.py +1 -0
  18. reflex/components/datadisplay/logo.py +49 -0
  19. reflex/components/el/elements/forms.py +7 -4
  20. reflex/components/el/elements/forms.pyi +0 -1
  21. reflex/components/lucide/icon.py +3 -2
  22. reflex/components/lucide/icon.pyi +2 -2
  23. reflex/components/markdown/markdown.py +10 -6
  24. reflex/components/markdown/markdown.pyi +0 -3
  25. reflex/components/radix/themes/components/select.py +10 -3
  26. reflex/config.py +1 -1
  27. reflex/config.pyi +1 -1
  28. reflex/constants/base.py +4 -5
  29. reflex/constants/base.pyi +94 -0
  30. reflex/constants/compiler.py +8 -0
  31. reflex/custom_components/custom_components.py +1 -1
  32. reflex/experimental/__init__.py +14 -0
  33. reflex/experimental/hooks.py +75 -0
  34. reflex/page.py +1 -1
  35. reflex/reflex.py +18 -32
  36. reflex/style.py +4 -4
  37. reflex/testing.py +1 -1
  38. reflex/utils/console.py +6 -4
  39. reflex/utils/exec.py +17 -1
  40. reflex/utils/export.py +0 -3
  41. reflex/utils/prerequisites.py +239 -43
  42. reflex/utils/processes.py +6 -1
  43. reflex/utils/telemetry.py +14 -2
  44. reflex/vars.py +6 -6
  45. reflex/vars.pyi +2 -1
  46. {reflex-0.4.6a4.dist-info → reflex-0.4.7a1.dist-info}/METADATA +15 -10
  47. {reflex-0.4.6a4.dist-info → reflex-0.4.7a1.dist-info}/RECORD +50 -64
  48. {reflex-0.4.6a4.dist-info → reflex-0.4.7a1.dist-info}/WHEEL +1 -1
  49. reflex/.templates/apps/sidebar/README.md +0 -69
  50. reflex/.templates/apps/sidebar/assets/favicon.ico +0 -0
  51. reflex/.templates/apps/sidebar/assets/github.svg +0 -10
  52. reflex/.templates/apps/sidebar/assets/logo.svg +0 -68
  53. reflex/.templates/apps/sidebar/assets/paneleft.svg +0 -13
  54. reflex/.templates/apps/sidebar/assets/reflex_black.svg +0 -37
  55. reflex/.templates/apps/sidebar/assets/reflex_white.svg +0 -8
  56. reflex/.templates/apps/sidebar/code/__init__.py +0 -1
  57. reflex/.templates/apps/sidebar/code/components/__init__.py +0 -0
  58. reflex/.templates/apps/sidebar/code/components/sidebar.py +0 -152
  59. reflex/.templates/apps/sidebar/code/pages/__init__.py +0 -3
  60. reflex/.templates/apps/sidebar/code/pages/dashboard.py +0 -22
  61. reflex/.templates/apps/sidebar/code/pages/index.py +0 -18
  62. reflex/.templates/apps/sidebar/code/pages/settings.py +0 -61
  63. reflex/.templates/apps/sidebar/code/sidebar.py +0 -16
  64. reflex/.templates/apps/sidebar/code/styles.py +0 -60
  65. reflex/.templates/apps/sidebar/code/templates/__init__.py +0 -1
  66. reflex/.templates/apps/sidebar/code/templates/template.py +0 -145
  67. {reflex-0.4.6a4.dist-info → reflex-0.4.7a1.dist-info}/LICENSE +0 -0
  68. {reflex-0.4.6a4.dist-info → reflex-0.4.7a1.dist-info}/entry_points.txt +0 -0
@@ -76,15 +76,7 @@ class BaseComponent(Base, ABC):
76
76
  """
77
77
 
78
78
  @abstractmethod
79
- def get_ref_hooks(self) -> set[str]:
80
- """Get the hooks required by refs in this component.
81
-
82
- Returns:
83
- The hooks for the refs.
84
- """
85
-
86
- @abstractmethod
87
- def get_hooks_internal(self) -> set[str]:
79
+ def _get_all_hooks_internal(self) -> dict[str, None]:
88
80
  """Get the reflex internal hooks for the component and its children.
89
81
 
90
82
  Returns:
@@ -92,7 +84,7 @@ class BaseComponent(Base, ABC):
92
84
  """
93
85
 
94
86
  @abstractmethod
95
- def get_hooks(self) -> set[str]:
87
+ def _get_all_hooks(self) -> dict[str, None]:
96
88
  """Get the React hooks for this component.
97
89
 
98
90
  Returns:
@@ -100,7 +92,7 @@ class BaseComponent(Base, ABC):
100
92
  """
101
93
 
102
94
  @abstractmethod
103
- def get_imports(self) -> imports.ImportDict:
95
+ def _get_all_imports(self) -> imports.ImportDict:
104
96
  """Get all the libraries and fields that are used by the component.
105
97
 
106
98
  Returns:
@@ -108,7 +100,7 @@ class BaseComponent(Base, ABC):
108
100
  """
109
101
 
110
102
  @abstractmethod
111
- def get_dynamic_imports(self) -> set[str]:
103
+ def _get_all_dynamic_imports(self) -> set[str]:
112
104
  """Get dynamic imports for the component.
113
105
 
114
106
  Returns:
@@ -116,7 +108,7 @@ class BaseComponent(Base, ABC):
116
108
  """
117
109
 
118
110
  @abstractmethod
119
- def get_custom_code(self) -> set[str]:
111
+ def _get_all_custom_code(self) -> set[str]:
120
112
  """Get custom code for the component.
121
113
 
122
114
  Returns:
@@ -124,7 +116,7 @@ class BaseComponent(Base, ABC):
124
116
  """
125
117
 
126
118
  @abstractmethod
127
- def get_refs(self) -> set[str]:
119
+ def _get_all_refs(self) -> set[str]:
128
120
  """Get the refs for the children of the component.
129
121
 
130
122
  Returns:
@@ -645,6 +637,9 @@ class Component(BaseComponent, ABC):
645
637
  )
646
638
  props[prop] = props.pop(under_prop)
647
639
 
640
+ # Filter out None props
641
+ props = {key: value for key, value in props.items() if value is not None}
642
+
648
643
  # Validate all the children.
649
644
  for child in children:
650
645
  # Make sure the child is a valid type.
@@ -674,7 +669,7 @@ class Component(BaseComponent, ABC):
674
669
  """
675
670
  self.style.update(style)
676
671
 
677
- def add_style(self, style: ComponentStyle) -> Component:
672
+ def _add_style_recursive(self, style: ComponentStyle) -> Component:
678
673
  """Add additional style to the component and its children.
679
674
 
680
675
  Args:
@@ -703,7 +698,7 @@ class Component(BaseComponent, ABC):
703
698
  # Skip BaseComponent and StatefulComponent children.
704
699
  if not isinstance(child, Component):
705
700
  continue
706
- child.add_style(style)
701
+ child._add_style_recursive(style)
707
702
  return self
708
703
 
709
704
  def _get_style(self) -> dict:
@@ -926,7 +921,7 @@ class Component(BaseComponent, ABC):
926
921
  """
927
922
  return None
928
923
 
929
- def get_custom_code(self) -> Set[str]:
924
+ def _get_all_custom_code(self) -> set[str]:
930
925
  """Get custom code for the component and its children.
931
926
 
932
927
  Returns:
@@ -942,7 +937,7 @@ class Component(BaseComponent, ABC):
942
937
 
943
938
  # Add the custom code for the children.
944
939
  for child in self.children:
945
- code |= child.get_custom_code()
940
+ code |= child._get_all_custom_code()
946
941
 
947
942
  # Return the code.
948
943
  return code
@@ -955,7 +950,7 @@ class Component(BaseComponent, ABC):
955
950
  """
956
951
  return None
957
952
 
958
- def get_dynamic_imports(self) -> Set[str]:
953
+ def _get_all_dynamic_imports(self) -> Set[str]:
959
954
  """Get dynamic imports for the component and its children.
960
955
 
961
956
  Returns:
@@ -971,11 +966,11 @@ class Component(BaseComponent, ABC):
971
966
 
972
967
  # Get the dynamic imports from children
973
968
  for child in self.children:
974
- dynamic_imports |= child.get_dynamic_imports()
969
+ dynamic_imports |= child._get_all_dynamic_imports()
975
970
 
976
971
  for prop in self.get_component_props():
977
972
  if getattr(self, prop) is not None:
978
- dynamic_imports |= getattr(self, prop).get_dynamic_imports()
973
+ dynamic_imports |= getattr(self, prop)._get_all_dynamic_imports()
979
974
 
980
975
  # Return the dynamic imports
981
976
  return dynamic_imports
@@ -987,7 +982,7 @@ class Component(BaseComponent, ABC):
987
982
  The imports for the components props of the component.
988
983
  """
989
984
  return [
990
- getattr(self, prop).get_imports()
985
+ getattr(self, prop)._get_all_imports()
991
986
  for prop in self.get_component_props()
992
987
  if getattr(self, prop) is not None
993
988
  ]
@@ -1058,7 +1053,7 @@ class Component(BaseComponent, ABC):
1058
1053
  *var_imports,
1059
1054
  )
1060
1055
 
1061
- def get_imports(self, collapse: bool = False) -> imports.ImportDict:
1056
+ def _get_all_imports(self, collapse: bool = False) -> imports.ImportDict:
1062
1057
  """Get all the libraries and fields that are used by the component and its children.
1063
1058
 
1064
1059
  Args:
@@ -1068,7 +1063,7 @@ class Component(BaseComponent, ABC):
1068
1063
  The import dict with the required imports.
1069
1064
  """
1070
1065
  _imports = imports.merge_imports(
1071
- self._get_imports(), *[child.get_imports() for child in self.children]
1066
+ self._get_imports(), *[child._get_all_imports() for child in self.children]
1072
1067
  )
1073
1068
  return imports.collapse_imports(_imports) if collapse else _imports
1074
1069
 
@@ -1105,62 +1100,53 @@ class Component(BaseComponent, ABC):
1105
1100
  if ref is not None:
1106
1101
  return f"const {ref} = useRef(null); {str(Var.create_safe(ref).as_ref())} = {ref};"
1107
1102
 
1108
- def _get_vars_hooks(self) -> set[str]:
1103
+ def _get_vars_hooks(self) -> dict[str, None]:
1109
1104
  """Get the hooks required by vars referenced in this component.
1110
1105
 
1111
1106
  Returns:
1112
1107
  The hooks for the vars.
1113
1108
  """
1114
- vars_hooks = set()
1109
+ vars_hooks = {}
1115
1110
  for var in self._get_vars():
1116
1111
  if var._var_data:
1117
1112
  vars_hooks.update(var._var_data.hooks)
1118
1113
  return vars_hooks
1119
1114
 
1120
- def _get_events_hooks(self) -> set[str]:
1115
+ def _get_events_hooks(self) -> dict[str, None]:
1121
1116
  """Get the hooks required by events referenced in this component.
1122
1117
 
1123
1118
  Returns:
1124
1119
  The hooks for the events.
1125
1120
  """
1126
- if self.event_triggers:
1127
- return {Hooks.EVENTS}
1128
- return set()
1121
+ return {Hooks.EVENTS: None} if self.event_triggers else {}
1129
1122
 
1130
- def _get_special_hooks(self) -> set[str]:
1123
+ def _get_special_hooks(self) -> dict[str, None]:
1131
1124
  """Get the hooks required by special actions referenced in this component.
1132
1125
 
1133
1126
  Returns:
1134
1127
  The hooks for special actions.
1135
1128
  """
1136
- if self.autofocus:
1137
- return {
1138
- """
1139
- // Set focus to the specified element.
1140
- const focusRef = useRef(null)
1141
- useEffect(() => {
1142
- if (focusRef.current) {
1143
- focusRef.current.focus();
1144
- }
1145
- })""",
1146
- }
1147
- return set()
1129
+ return {Hooks.AUTOFOCUS: None} if self.autofocus else {}
1148
1130
 
1149
- def _get_hooks_internal(self) -> Set[str]:
1131
+ def _get_hooks_internal(self) -> dict[str, None]:
1150
1132
  """Get the React hooks for this component managed by the framework.
1151
1133
 
1152
1134
  Downstream components should NOT override this method to avoid breaking
1153
1135
  framework functionality.
1154
1136
 
1155
1137
  Returns:
1156
- Set of internally managed hooks.
1138
+ The internally managed hooks.
1157
1139
  """
1158
- return (
1159
- self._get_vars_hooks()
1160
- | self._get_events_hooks()
1161
- | self._get_special_hooks()
1162
- | set(hook for hook in [self._get_mount_lifecycle_hook()] if hook)
1163
- )
1140
+ return {
1141
+ **{
1142
+ hook: None
1143
+ for hook in [self._get_ref_hook(), self._get_mount_lifecycle_hook()]
1144
+ if hook is not None
1145
+ },
1146
+ **self._get_vars_hooks(),
1147
+ **self._get_events_hooks(),
1148
+ **self._get_special_hooks(),
1149
+ }
1164
1150
 
1165
1151
  def _get_hooks(self) -> str | None:
1166
1152
  """Get the React hooks for this component.
@@ -1172,20 +1158,7 @@ class Component(BaseComponent, ABC):
1172
1158
  """
1173
1159
  return
1174
1160
 
1175
- def get_ref_hooks(self) -> Set[str]:
1176
- """Get the ref hooks for the component and its children.
1177
-
1178
- Returns:
1179
- The ref hooks.
1180
- """
1181
- ref_hook = self._get_ref_hook()
1182
- hooks = set() if ref_hook is None else {ref_hook}
1183
-
1184
- for child in self.children:
1185
- hooks |= child.get_ref_hooks()
1186
- return hooks
1187
-
1188
- def get_hooks_internal(self) -> set[str]:
1161
+ def _get_all_hooks_internal(self) -> dict[str, None]:
1189
1162
  """Get the reflex internal hooks for the component and its children.
1190
1163
 
1191
1164
  Returns:
@@ -1196,26 +1169,26 @@ class Component(BaseComponent, ABC):
1196
1169
 
1197
1170
  # Add the hook code for the children.
1198
1171
  for child in self.children:
1199
- code |= child.get_hooks_internal()
1172
+ code = {**code, **child._get_all_hooks_internal()}
1200
1173
 
1201
1174
  return code
1202
1175
 
1203
- def get_hooks(self) -> Set[str]:
1176
+ def _get_all_hooks(self) -> dict[str, None]:
1204
1177
  """Get the React hooks for this component and its children.
1205
1178
 
1206
1179
  Returns:
1207
1180
  The code that should appear just before returning the rendered component.
1208
1181
  """
1209
- code = set()
1182
+ code = {}
1210
1183
 
1211
1184
  # Add the hook code for this component.
1212
1185
  hooks = self._get_hooks()
1213
1186
  if hooks is not None:
1214
- code.add(hooks)
1187
+ code[hooks] = None
1215
1188
 
1216
1189
  # Add the hook code for the children.
1217
1190
  for child in self.children:
1218
- code |= child.get_hooks()
1191
+ code = {**code, **child._get_all_hooks()}
1219
1192
 
1220
1193
  return code
1221
1194
 
@@ -1230,7 +1203,7 @@ class Component(BaseComponent, ABC):
1230
1203
  return None
1231
1204
  return format.format_ref(self.id)
1232
1205
 
1233
- def get_refs(self) -> Set[str]:
1206
+ def _get_all_refs(self) -> set[str]:
1234
1207
  """Get the refs for the children of the component.
1235
1208
 
1236
1209
  Returns:
@@ -1241,10 +1214,10 @@ class Component(BaseComponent, ABC):
1241
1214
  if ref is not None:
1242
1215
  refs.add(ref)
1243
1216
  for child in self.children:
1244
- refs |= child.get_refs()
1217
+ refs |= child._get_all_refs()
1245
1218
  return refs
1246
1219
 
1247
- def get_custom_components(
1220
+ def _get_all_custom_components(
1248
1221
  self, seen: set[str] | None = None
1249
1222
  ) -> Set[CustomComponent]:
1250
1223
  """Get all the custom components used by the component.
@@ -1264,7 +1237,7 @@ class Component(BaseComponent, ABC):
1264
1237
  # Skip BaseComponent and StatefulComponent children.
1265
1238
  if not isinstance(child, Component):
1266
1239
  continue
1267
- custom_components |= child.get_custom_components(seen=seen)
1240
+ custom_components |= child._get_all_custom_components(seen=seen)
1268
1241
  return custom_components
1269
1242
 
1270
1243
  @property
@@ -1288,7 +1261,7 @@ class Component(BaseComponent, ABC):
1288
1261
  """
1289
1262
  return {}
1290
1263
 
1291
- def get_app_wrap_components(self) -> dict[tuple[int, str], Component]:
1264
+ def _get_all_app_wrap_components(self) -> dict[tuple[int, str], Component]:
1292
1265
  """Get the app wrap components for the component and its children.
1293
1266
 
1294
1267
  Returns:
@@ -1298,14 +1271,14 @@ class Component(BaseComponent, ABC):
1298
1271
  components = self._get_app_wrap_components()
1299
1272
 
1300
1273
  for component in tuple(components.values()):
1301
- components.update(component.get_app_wrap_components())
1274
+ components.update(component._get_all_app_wrap_components())
1302
1275
 
1303
1276
  # Add the app wrap components for the children.
1304
1277
  for child in self.children:
1305
1278
  # Skip BaseComponent and StatefulComponent children.
1306
1279
  if not isinstance(child, Component):
1307
1280
  continue
1308
- components.update(child.get_app_wrap_components())
1281
+ components.update(child._get_all_app_wrap_components())
1309
1282
 
1310
1283
  # Return the components.
1311
1284
  return components
@@ -1374,8 +1347,8 @@ class CustomComponent(Component):
1374
1347
  self.component_props[key] = value
1375
1348
  value = base_value._replace(
1376
1349
  merge_var_data=VarData( # type: ignore
1377
- imports=value.get_imports(),
1378
- hooks=value.get_hooks(),
1350
+ imports=value._get_all_imports(),
1351
+ hooks=value._get_all_hooks(),
1379
1352
  )
1380
1353
  )
1381
1354
  else:
@@ -1414,7 +1387,7 @@ class CustomComponent(Component):
1414
1387
  """
1415
1388
  return set()
1416
1389
 
1417
- def get_custom_components(
1390
+ def _get_all_custom_components(
1418
1391
  self, seen: set[str] | None = None
1419
1392
  ) -> Set[CustomComponent]:
1420
1393
  """Get all the custom components used by the component.
@@ -1430,12 +1403,12 @@ class CustomComponent(Component):
1430
1403
  # Store the seen components in a set to avoid infinite recursion.
1431
1404
  if seen is None:
1432
1405
  seen = set()
1433
- custom_components = {self} | super().get_custom_components(seen=seen)
1406
+ custom_components = {self} | super()._get_all_custom_components(seen=seen)
1434
1407
 
1435
1408
  # Avoid adding the same component twice.
1436
1409
  if self.tag not in seen:
1437
1410
  seen.add(self.tag)
1438
- custom_components |= self.get_component(self).get_custom_components(
1411
+ custom_components |= self.get_component(self)._get_all_custom_components(
1439
1412
  seen=seen
1440
1413
  )
1441
1414
 
@@ -1447,7 +1420,9 @@ class CustomComponent(Component):
1447
1420
  seen.add(child_component.tag)
1448
1421
  if isinstance(child_component, CustomComponent):
1449
1422
  custom_components |= {child_component}
1450
- custom_components |= child_component.get_custom_components(seen=seen)
1423
+ custom_components |= child_component._get_all_custom_components(
1424
+ seen=seen
1425
+ )
1451
1426
  return custom_components
1452
1427
 
1453
1428
  def _render(self) -> Tag:
@@ -1851,31 +1826,23 @@ class StatefulComponent(BaseComponent):
1851
1826
  )
1852
1827
  return trigger_memo
1853
1828
 
1854
- def get_ref_hooks(self) -> set[str]:
1855
- """Get the ref hooks for the component and its children.
1856
-
1857
- Returns:
1858
- The ref hooks.
1859
- """
1860
- return set()
1861
-
1862
- def get_hooks_internal(self) -> set[str]:
1829
+ def _get_all_hooks_internal(self) -> dict[str, None]:
1863
1830
  """Get the reflex internal hooks for the component and its children.
1864
1831
 
1865
1832
  Returns:
1866
1833
  The code that should appear just before user-defined hooks.
1867
1834
  """
1868
- return set()
1835
+ return {}
1869
1836
 
1870
- def get_hooks(self) -> set[str]:
1837
+ def _get_all_hooks(self) -> dict[str, None]:
1871
1838
  """Get the React hooks for this component.
1872
1839
 
1873
1840
  Returns:
1874
1841
  The code that should appear just before returning the rendered component.
1875
1842
  """
1876
- return set()
1843
+ return {}
1877
1844
 
1878
- def get_imports(self) -> imports.ImportDict:
1845
+ def _get_all_imports(self) -> imports.ImportDict:
1879
1846
  """Get all the libraries and fields that are used by the component.
1880
1847
 
1881
1848
  Returns:
@@ -1887,9 +1854,9 @@ class StatefulComponent(BaseComponent):
1887
1854
  ImportVar(tag=self.tag)
1888
1855
  ]
1889
1856
  }
1890
- return self.component.get_imports()
1857
+ return self.component._get_all_imports()
1891
1858
 
1892
- def get_dynamic_imports(self) -> set[str]:
1859
+ def _get_all_dynamic_imports(self) -> set[str]:
1893
1860
  """Get dynamic imports for the component.
1894
1861
 
1895
1862
  Returns:
@@ -1897,9 +1864,9 @@ class StatefulComponent(BaseComponent):
1897
1864
  """
1898
1865
  if self.rendered_as_shared:
1899
1866
  return set()
1900
- return self.component.get_dynamic_imports()
1867
+ return self.component._get_all_dynamic_imports()
1901
1868
 
1902
- def get_custom_code(self) -> set[str]:
1869
+ def _get_all_custom_code(self) -> set[str]:
1903
1870
  """Get custom code for the component.
1904
1871
 
1905
1872
  Returns:
@@ -1907,9 +1874,9 @@ class StatefulComponent(BaseComponent):
1907
1874
  """
1908
1875
  if self.rendered_as_shared:
1909
1876
  return set()
1910
- return self.component.get_custom_code().union({self.code})
1877
+ return self.component._get_all_custom_code().union({self.code})
1911
1878
 
1912
- def get_refs(self) -> set[str]:
1879
+ def _get_all_refs(self) -> set[str]:
1913
1880
  """Get the refs for the children of the component.
1914
1881
 
1915
1882
  Returns:
@@ -1917,7 +1884,7 @@ class StatefulComponent(BaseComponent):
1917
1884
  """
1918
1885
  if self.rendered_as_shared:
1919
1886
  return set()
1920
- return self.component.get_refs()
1887
+ return self.component._get_all_refs()
1921
1888
 
1922
1889
  def render(self) -> dict:
1923
1890
  """Define how to render the component in React.
@@ -1975,7 +1942,7 @@ class MemoizationLeaf(Component):
1975
1942
  The memoization leaf
1976
1943
  """
1977
1944
  comp = super().create(*children, **props)
1978
- if comp.get_hooks() or comp.get_hooks_internal():
1945
+ if comp._get_all_hooks() or comp._get_all_hooks_internal():
1979
1946
  comp._memoization_mode = cls._memoization_mode.copy(
1980
1947
  update={"disposition": MemoizationDisposition.ALWAYS}
1981
1948
  )
@@ -22,7 +22,7 @@ from reflex.vars import Var, VarData
22
22
 
23
23
  connect_error_var_data: VarData = VarData( # type: ignore
24
24
  imports=Imports.EVENTS,
25
- hooks={Hooks.EVENTS},
25
+ hooks={Hooks.EVENTS: None},
26
26
  )
27
27
 
28
28
  connection_error: Var = Var.create_safe(
@@ -1,4 +1,5 @@
1
1
  """A file upload component."""
2
+
2
3
  from __future__ import annotations
3
4
 
4
5
  import os
@@ -31,7 +32,7 @@ upload_files_context_var_data: VarData = VarData( # type: ignore
31
32
  },
32
33
  },
33
34
  hooks={
34
- "const [filesById, setFilesById] = useContext(UploadFilesContext);",
35
+ "const [filesById, setFilesById] = useContext(UploadFilesContext);": None,
35
36
  },
36
37
  )
37
38
 
@@ -4,6 +4,7 @@ from .code import CodeBlock
4
4
  from .code import LiteralCodeBlockTheme as LiteralCodeBlockTheme
5
5
  from .code import LiteralCodeLanguage as LiteralCodeLanguage
6
6
  from .dataeditor import DataEditor, DataEditorTheme
7
+ from .logo import logo
7
8
 
8
9
  code_block = CodeBlock.create
9
10
  data_editor = DataEditor.create
@@ -0,0 +1,49 @@
1
+ """A Reflex logo component."""
2
+ import reflex as rx
3
+
4
+
5
+ def logo(**props):
6
+ """A Reflex logo.
7
+
8
+ Args:
9
+ **props: The props to pass to the component.
10
+
11
+ Returns:
12
+ The logo component.
13
+ """
14
+ light_mode_logo = """<svg width="56" height="12" viewBox="0 0 56 12" fill="none" xmlns="http://www.w3.org/2000/svg">
15
+ <path d="M0 11.6V0.400024H8.96V4.88002H6.72V2.64002H2.24V4.88002H6.72V7.12002H2.24V11.6H0ZM6.72 11.6V7.12002H8.96V11.6H6.72Z" fill="#110F1F"/>
16
+ <path d="M11.2 11.6V0.400024H17.92V2.64002H13.44V4.88002H17.92V7.12002H13.44V9.36002H17.92V11.6H11.2Z" fill="#110F1F"/>
17
+ <path d="M20.16 11.6V0.400024H26.88V2.64002H22.4V4.88002H26.88V7.12002H22.4V11.6H20.16Z" fill="#110F1F"/>
18
+ <path d="M29.12 11.6V0.400024H31.36V9.36002H35.84V11.6H29.12Z" fill="#110F1F"/>
19
+ <path d="M38.08 11.6V0.400024H44.8V2.64002H40.32V4.88002H44.8V7.12002H40.32V9.36002H44.8V11.6H38.08Z" fill="#110F1F"/>
20
+ <path d="M47.04 4.88002V0.400024H49.28V4.88002H47.04ZM53.76 4.88002V0.400024H56V4.88002H53.76ZM49.28 7.12002V4.88002H53.76V7.12002H49.28ZM47.04 11.6V7.12002H49.28V11.6H47.04ZM53.76 11.6V7.12002H56V11.6H53.76Z" fill="#110F1F"/>
21
+ </svg>"""
22
+
23
+ dark_mode_logo = """<svg width="56" height="12" viewBox="0 0 56 12" fill="none" xmlns="http://www.w3.org/2000/svg">
24
+ <path d="M0 11.5999V0.399902H8.96V4.8799H6.72V2.6399H2.24V4.8799H6.72V7.1199H2.24V11.5999H0ZM6.72 11.5999V7.1199H8.96V11.5999H6.72Z" fill="white"/>
25
+ <path d="M11.2 11.5999V0.399902H17.92V2.6399H13.44V4.8799H17.92V7.1199H13.44V9.3599H17.92V11.5999H11.2Z" fill="white"/>
26
+ <path d="M20.16 11.5999V0.399902H26.88V2.6399H22.4V4.8799H26.88V7.1199H22.4V11.5999H20.16Z" fill="white"/>
27
+ <path d="M29.12 11.5999V0.399902H31.36V9.3599H35.84V11.5999H29.12Z" fill="white"/>
28
+ <path d="M38.08 11.5999V0.399902H44.8V2.6399H40.32V4.8799H44.8V7.1199H40.32V9.3599H44.8V11.5999H38.08Z" fill="white"/>
29
+ <path d="M47.04 4.8799V0.399902H49.28V4.8799H47.04ZM53.76 4.8799V0.399902H56V4.8799H53.76ZM49.28 7.1199V4.8799H53.76V7.1199H49.28ZM47.04 11.5999V7.1199H49.28V11.5999H47.04ZM53.76 11.5999V7.1199H56V11.5999H53.76Z" fill="white"/>
30
+ </svg>"""
31
+
32
+ return rx.center(
33
+ rx.link(
34
+ rx.hstack(
35
+ "Built with ",
36
+ rx.color_mode_cond(
37
+ rx.html(light_mode_logo),
38
+ rx.html(dark_mode_logo),
39
+ ),
40
+ text_align="center",
41
+ align="center",
42
+ padding="1em",
43
+ ),
44
+ href="https://reflex.dev",
45
+ size="3",
46
+ ),
47
+ width=props.pop("width", "100%"),
48
+ **props,
49
+ )
@@ -1,4 +1,5 @@
1
1
  """Element classes. This is an auto-generated file. Do not edit. See ../generate.py."""
2
+
2
3
  from __future__ import annotations
3
4
 
4
5
  from hashlib import md5
@@ -162,7 +163,9 @@ class Form(BaseHTML):
162
163
  props["handle_submit_unique_name"] = ""
163
164
  form = super().create(*children, **props)
164
165
  form.handle_submit_unique_name = md5(
165
- str(form.get_hooks_internal().union(form.get_hooks())).encode("utf-8")
166
+ str({**form._get_all_hooks_internal(), **form._get_all_hooks()}).encode(
167
+ "utf-8"
168
+ )
166
169
  ).hexdigest()
167
170
  return form
168
171
 
@@ -207,7 +210,7 @@ class Form(BaseHTML):
207
210
  def _get_form_refs(self) -> Dict[str, Any]:
208
211
  # Send all the input refs to the handler.
209
212
  form_refs = {}
210
- for ref in self.get_refs():
213
+ for ref in self._get_all_refs():
211
214
  # when ref start with refs_ it's an array of refs, so we need different method
212
215
  # to collect data
213
216
  if ref.startswith("refs_"):
@@ -592,13 +595,13 @@ class Textarea(BaseHTML):
592
595
  "enter_key_submit",
593
596
  ]
594
597
 
595
- def get_custom_code(self) -> Set[str]:
598
+ def _get_all_custom_code(self) -> Set[str]:
596
599
  """Include the custom code for auto_height and enter_key_submit functionality.
597
600
 
598
601
  Returns:
599
602
  The custom code for the component.
600
603
  """
601
- custom_code = super().get_custom_code()
604
+ custom_code = super()._get_all_custom_code()
602
605
  if self.auto_height is not None:
603
606
  custom_code.add(AUTO_HEIGHT_JS)
604
607
  if self.enter_key_submit is not None:
@@ -2022,7 +2022,6 @@ AUTO_HEIGHT_JS = '\nconst autoHeightOnInput = (e, is_enabled) => {\n if (is_e
2022
2022
  ENTER_KEY_SUBMIT_JS = "\nconst enterKeySubmitOnKeyDown = (e, is_enabled) => {\n if (is_enabled && e.which === 13 && !e.shiftKey) {\n e.preventDefault();\n if (!e.repeat) {\n if (e.target.form) {\n e.target.form.requestSubmit();\n }\n }\n }\n}\n"
2023
2023
 
2024
2024
  class Textarea(BaseHTML):
2025
- def get_custom_code(self) -> Set[str]: ...
2026
2025
  def get_event_triggers(self) -> Dict[str, Any]: ...
2027
2026
  @overload
2028
2027
  @classmethod
@@ -53,6 +53,7 @@ class Icon(LucideIconComponent):
53
53
  if children:
54
54
  if len(children) == 1 and type(children[0]) == str:
55
55
  props["tag"] = children[0]
56
+ children = []
56
57
  else:
57
58
  raise AttributeError(
58
59
  f"Passing multiple children to Icon component is not allowed: remove positional arguments {children[1:]} to fix"
@@ -129,7 +130,7 @@ RENAMED_ICONS_05 = {
129
130
  "dot_square": "square_dot",
130
131
  "download_cloud": "cloud_download",
131
132
  "equal_square": "square_equal",
132
- "form_input": "rectangle_elipsis",
133
+ "form_input": "rectangle_ellipsis",
133
134
  "function_square": "square_function",
134
135
  "gantt_chart_square": "square_gantt_chart",
135
136
  "gauge_circle": "circle_gauge",
@@ -140,7 +141,7 @@ RENAMED_ICONS_05 = {
140
141
  "ice_cream_2": "ice_cream_bowl",
141
142
  "indent": "indent_increase",
142
143
  "kanban_square": "square_kanban",
143
- "kanban_square_dashed": "square_kanban_dashed",
144
+ "kanban_square_dashed": "square_dashed_kanban",
144
145
  "laptop_2": "laptop_minimal",
145
146
  "library_square": "square_library",
146
147
  "loader_2": "loader_circle",
@@ -221,7 +221,7 @@ RENAMED_ICONS_05 = {
221
221
  "dot_square": "square_dot",
222
222
  "download_cloud": "cloud_download",
223
223
  "equal_square": "square_equal",
224
- "form_input": "rectangle_elipsis",
224
+ "form_input": "rectangle_ellipsis",
225
225
  "function_square": "square_function",
226
226
  "gantt_chart_square": "square_gantt_chart",
227
227
  "gauge_circle": "circle_gauge",
@@ -232,7 +232,7 @@ RENAMED_ICONS_05 = {
232
232
  "ice_cream_2": "ice_cream_bowl",
233
233
  "indent": "indent_increase",
234
234
  "kanban_square": "square_kanban",
235
- "kanban_square_dashed": "square_kanban_dashed",
235
+ "kanban_square_dashed": "square_dashed_kanban",
236
236
  "laptop_2": "laptop_minimal",
237
237
  "library_square": "square_library",
238
238
  "loader_2": "loader_circle",