reflex 0.2.5a1__py3-none-any.whl → 0.2.6__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.

@@ -13,12 +13,6 @@ export default function Component() {
13
13
  const { {{const.color_mode}}, {{const.toggle_color_mode}} } = {{const.use_color_mode}}()
14
14
  const focusRef = useRef();
15
15
 
16
- // Function to add new files to be uploaded.
17
- const File = files => {{state_name|react_setter}}(state => ({
18
- ...state,
19
- files,
20
- }))
21
-
22
16
  // Main event loop.
23
17
  const [Event, notConnected] = useContext(EventLoopContext)
24
18
 
reflex/compiler/utils.py CHANGED
@@ -126,11 +126,6 @@ def compile_state(state: Type[State]) -> Dict:
126
126
  initial_state = state().dict()
127
127
  except Exception:
128
128
  initial_state = state().dict(include_computed=False)
129
- initial_state.update(
130
- {
131
- "files": [],
132
- }
133
- )
134
129
  return format.format_state(initial_state)
135
130
 
136
131
 
@@ -1,6 +1,6 @@
1
1
  """Table components."""
2
2
 
3
- from typing import Any, List
3
+ from typing import Any, Dict, List, Union
4
4
 
5
5
  from reflex.components.component import Component
6
6
  from reflex.components.tags import Tag
@@ -38,7 +38,7 @@ class DataTable(Gridjs):
38
38
  resizable: Var[bool]
39
39
 
40
40
  # Enable pagination.
41
- pagination: Var[bool]
41
+ pagination: Var[Union[bool, Dict]]
42
42
 
43
43
  @classmethod
44
44
  def create(cls, *children, **props):
@@ -2,6 +2,8 @@
2
2
 
3
3
  from typing import Dict
4
4
 
5
+ from reflex.components.component import Component
6
+ from reflex.components.forms.debounce import DebounceInput
5
7
  from reflex.components.libs.chakra import ChakraComponent
6
8
  from reflex.event import EVENT_ARG
7
9
  from reflex.vars import Var
@@ -36,6 +38,29 @@ class Editable(ChakraComponent):
36
38
  # The initial value of the Editable in both edit and preview mode.
37
39
  default_value: Var[str]
38
40
 
41
+ @classmethod
42
+ def create(cls, *children, **props) -> Component:
43
+ """Create an Editable component.
44
+
45
+ Args:
46
+ children: The children of the component.
47
+ props: The properties of the component.
48
+
49
+ Returns:
50
+ The component.
51
+ """
52
+ if (
53
+ isinstance(props.get("value"), Var) and props.get("on_change")
54
+ ) or "debounce_timeout" in props:
55
+ # Create a debounced input if the user requests full control to avoid typing jank
56
+ # Currently default to 50ms, which appears to be a good balance
57
+ debounce_timeout = props.pop("debounce_timeout", 50)
58
+ return DebounceInput.create(
59
+ super().create(*children, **props),
60
+ debounce_timeout=debounce_timeout,
61
+ )
62
+ return super().create(*children, **props)
63
+
39
64
  def get_controlled_triggers(self) -> Dict[str, Var]:
40
65
  """Get the event triggers that pass the component's value to the handler.
41
66
 
@@ -81,10 +81,14 @@ class Input(ChakraComponent):
81
81
  Returns:
82
82
  The component.
83
83
  """
84
- if isinstance(props.get("value"), Var) and props.get("on_change"):
84
+ if (
85
+ isinstance(props.get("value"), Var) and props.get("on_change")
86
+ ) or "debounce_timeout" in props:
87
+ # Currently default to 50ms, which appears to be a good balance
88
+ debounce_timeout = props.pop("debounce_timeout", 50)
85
89
  # create a debounced input if the user requests full control to avoid typing jank
86
90
  return DebounceInput.create(
87
- super().create(*children, **props), debounce_timeout=0
91
+ super().create(*children, **props), debounce_timeout=debounce_timeout
88
92
  )
89
93
  return super().create(*children, **props)
90
94
 
@@ -43,6 +43,9 @@ class Slider(ChakraComponent):
43
43
  # The maximum value of the slider.
44
44
  max_: Var[int]
45
45
 
46
+ # The step in which increments/decrements have to be made
47
+ step: Var[int]
48
+
46
49
  # The minimum distance between slider thumbs. Useful for preventing the thumbs from being too close together.
47
50
  min_steps_between_thumbs: Var[int]
48
51
 
@@ -68,9 +68,13 @@ class TextArea(ChakraComponent):
68
68
  Returns:
69
69
  The component.
70
70
  """
71
- if isinstance(props.get("value"), Var) and props.get("on_change"):
71
+ if (
72
+ isinstance(props.get("value"), Var) and props.get("on_change")
73
+ ) or "debounce_timeout" in props:
74
+ # Currently default to 50ms, which appears to be a good balance
75
+ debounce_timeout = props.pop("debounce_timeout", 50)
72
76
  # create a debounced input if the user requests full control to avoid typing jank
73
77
  return DebounceInput.create(
74
- super().create(*children, **props), debounce_timeout=0
78
+ super().create(*children, **props), debounce_timeout=debounce_timeout
75
79
  )
76
80
  return super().create(*children, **props)
reflex/model.py CHANGED
@@ -43,12 +43,9 @@ def get_engine(url: Optional[str] = None):
43
43
  )
44
44
  # Print the SQL queries if the log level is INFO or lower.
45
45
  echo_db_query = os.environ.get("SQLALCHEMY_ECHO") == "True"
46
- return sqlmodel.create_engine(
47
- url,
48
- echo=echo_db_query,
49
- # Needed for the admin dash.
50
- connect_args={"check_same_thread": False},
51
- )
46
+ # Needed for the admin dash on sqlite.
47
+ connect_args = {"check_same_thread": False} if url.startswith("sqlite") else {}
48
+ return sqlmodel.create_engine(url, echo=echo_db_query, connect_args=connect_args)
52
49
 
53
50
 
54
51
  class Model(Base, sqlmodel.SQLModel):
reflex/vars.py CHANGED
@@ -30,7 +30,7 @@ from pydantic.fields import ModelField
30
30
 
31
31
  from reflex import constants
32
32
  from reflex.base import Base
33
- from reflex.utils import format, types
33
+ from reflex.utils import console, format, types
34
34
 
35
35
  if TYPE_CHECKING:
36
36
  from reflex.state import State
@@ -831,7 +831,16 @@ class BaseVar(Var, Base):
831
831
  state: The state within which we add the setter function.
832
832
  value: The value to set.
833
833
  """
834
- setattr(state, self.name, value)
834
+ if self.type_ in [int, float]:
835
+ try:
836
+ value = self.type_(value)
837
+ setattr(state, self.name, value)
838
+ except ValueError:
839
+ console.warn(
840
+ f"{self.name}: Failed conversion of {value} to '{self.type_.__name__}'. Value not set.",
841
+ )
842
+ else:
843
+ setattr(state, self.name, value)
835
844
 
836
845
  setter.__qualname__ = self.get_setter_name()
837
846
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: reflex
3
- Version: 0.2.5a1
3
+ Version: 0.2.6
4
4
  Summary: Web apps in pure Python.
5
5
  Home-page: https://reflex.dev
6
6
  License: Apache-2.0
@@ -28,6 +28,7 @@ Requires-Dist: platformdirs (>=3.10.0,<4.0.0)
28
28
  Requires-Dist: plotly (>=5.13.0,<6.0.0)
29
29
  Requires-Dist: psutil (>=5.9.4,<6.0.0)
30
30
  Requires-Dist: pydantic (>=1.10.2,<2.0.0)
31
+ Requires-Dist: python-engineio (!=4.6.0)
31
32
  Requires-Dist: python-multipart (>=0.0.5,<0.0.6)
32
33
  Requires-Dist: python-socketio (>=5.7.0,<6.0.0)
33
34
  Requires-Dist: redis (>=4.3.5,<5.0.0)
@@ -7,7 +7,7 @@ reflex/.templates/jinja/app/rxconfig.py.jinja2,sha256=4Uan_mriv72AodrWhZgWMz0lIY
7
7
  reflex/.templates/jinja/web/pages/_document.js.jinja2,sha256=E2r3MWp-gimAa6DdRs9ErQpPEyjS_yV5fdid_wdOOlA,182
8
8
  reflex/.templates/jinja/web/pages/base_page.js.jinja2,sha256=8P6hhm1v-XMpH4kE6Sn-XgM4Vp13H_jjPYfqlF9rdck,241
9
9
  reflex/.templates/jinja/web/pages/custom_component.js.jinja2,sha256=J4ASfE-IR3bFaFtxW4iUsyRSc3sqQ4ZiJjSIHWStaHY,252
10
- reflex/.templates/jinja/web/pages/index.js.jinja2,sha256=MX9FwnXbu9NXjeJZm2XO3-isXtjCjYSOS0x2jbKbr5E,1394
10
+ reflex/.templates/jinja/web/pages/index.js.jinja2,sha256=OEzbUm3wcccmuwm2tdaBeHW8ZNsOzXHTodcllmNCw28,1251
11
11
  reflex/.templates/jinja/web/pages/utils.js.jinja2,sha256=WHsRgEr5jRzEjrLsGReDuSbL1-1R5chv2wCrVerAmuE,3170
12
12
  reflex/.templates/jinja/web/tailwind.config.js.jinja2,sha256=Tl60dYXB_kDw-5OpgwD_o3azLKGkq_x-dgvUvne8zh0,356
13
13
  reflex/.templates/jinja/web/utils/context.js.jinja2,sha256=M62BkKLWTpvSPympSGsFMxSwxywgno55-nlVGYqBgA4,308
@@ -31,7 +31,7 @@ reflex/base.py,sha256=Dr5E2oBYBXWPMU7aanTzlnaQP3b1hkElOw2qwU2xGio,2438
31
31
  reflex/compiler/__init__.py,sha256=r8jqmDSFf09iV2lHlNhfc9XrTLjNxfDNwPYlxS4cmHE,27
32
32
  reflex/compiler/compiler.py,sha256=bH3UuLaIozr4Bw8gY9YyxATpxtWtQ7bf2ZavsK5AKw8,7363
33
33
  reflex/compiler/templates.py,sha256=zWgheEKmdgdrnmghRhJHPUx2hUwDfk_kl6xf9DgmOq0,2550
34
- reflex/compiler/utils.py,sha256=ZA_IrPYqyjlrqakQarINg1QMuCIxtjfyxGbLZpwbHj4,8759
34
+ reflex/compiler/utils.py,sha256=InTkxbhAMwxcZeoTNuBYmRKb8mYkUSSGHLjPcYBdxdk,8682
35
35
  reflex/components/__init__.py,sha256=aeIohhihROkblpRofBC5UDk65RfcGCSXOtneWZUYBRY,7651
36
36
  reflex/components/base/__init__.py,sha256=BIobn_49_ZsyQf-F50kOGq4FklfXiBRDTPCbPBM4p64,260
37
37
  reflex/components/base/bare.py,sha256=0qwlLcTulbWSSP1prpiRk-19UFJCXoiFP5UiW6LsF4s,719
@@ -45,7 +45,7 @@ reflex/components/component.py,sha256=d5W7go7uEVWluP49OY2R9CaPX4tBRDFDheNGwXC1Sb
45
45
  reflex/components/datadisplay/__init__.py,sha256=He8vj6DL88dSoPQzw3l_tp_C54PWsq3qai8V3d5pcy8,496
46
46
  reflex/components/datadisplay/badge.py,sha256=Zp1fPtvm7qCSOB7OWuraptDtt_OVqixyz7i34IQcMH0,330
47
47
  reflex/components/datadisplay/code.py,sha256=wFv8A71zKSKa9dy9xgv5vOQcMfinygffo5eTAoEHZu0,3495
48
- reflex/components/datadisplay/datatable.py,sha256=tGMlvS2F4B-lQD21Whe_hapurftH1eEZtqi8gxfVxEc,3951
48
+ reflex/components/datadisplay/datatable.py,sha256=rWiEN55Bc1IzElc6WVuXzhnYrQILTc-iHsfV4mEmrtQ,3977
49
49
  reflex/components/datadisplay/divider.py,sha256=ErCjdp7sQHLuRO9U9vPTQZEUlleSSS2oNQ6nMm8T1cc,533
50
50
  reflex/components/datadisplay/keyboard_key.py,sha256=gqSX2VqnC8zzkmHnwvnXtnfNpuEsGeBmaLCdo7TgNqg,185
51
51
  reflex/components/datadisplay/list.py,sha256=fLFKs48FryXjPSky_N9vyfnNfob6-zYs6UNVtXFOUug,1422
@@ -71,11 +71,11 @@ reflex/components/forms/copytoclipboard.py,sha256=h_TZ5n3Q4DAt95N8bZC_EFE0cYadZq
71
71
  reflex/components/forms/date_picker.py,sha256=wOlAp5buIhMNroqtqjuH5iI2QToOyoBtSktOebYR0S0,239
72
72
  reflex/components/forms/date_time_picker.py,sha256=qyLigyL5g7SSOYqX9COflULtdMIyD1WyWoSvIuvk6cE,273
73
73
  reflex/components/forms/debounce.py,sha256=yGtxghT0vfLmlEtPs0lamCONq4UTvhQ1KdYxq5E51Zw,3702
74
- reflex/components/forms/editable.py,sha256=tNaj3t4JGS2gQf12DnnC3-BE1vbz8On9hmgrzoa1fsc,1943
74
+ reflex/components/forms/editable.py,sha256=477a723qrlcsKfEJZUr8YWn99XsklPy3qPnnGUSobM0,2915
75
75
  reflex/components/forms/email.py,sha256=E1nbkBSeGtexTJihxLWeQ7U3wsfI4yTVwcbpQJvOsl0,239
76
76
  reflex/components/forms/form.py,sha256=WK5DoVaQSx2FZbrUydKR9DYEUG35RR06Iy8EX_pscgQ,3303
77
77
  reflex/components/forms/iconbutton.py,sha256=lS9lKNbiroU0tk-FjLUygc_CdlpFpV7pkEF2sV-kyPM,798
78
- reflex/components/forms/input.py,sha256=ASjWMaA1HUKXtpr8nk8d9KAFF-puxxpr-Fm6waJPDRU,3948
78
+ reflex/components/forms/input.py,sha256=ESsRJO9BNzvY7BDKZorNIz-Dk8smFVuYkNifvO1gygk,4159
79
79
  reflex/components/forms/multiselect.py,sha256=adAikiGnJp7N8cPKUJ_Qq9NLx5e9HeATw1t1aFetlGc,12659
80
80
  reflex/components/forms/numberinput.py,sha256=pEjXMmGJPq-651UsnFL-gD6QS-l9IdMVbJRGv0faNdY,3973
81
81
  reflex/components/forms/password.py,sha256=SDPKRpZrLCtm5WFBwOdcmLLUqDON22hV9F41vazINNA,249
@@ -83,9 +83,9 @@ reflex/components/forms/pininput.py,sha256=FDzwR2--2MN9gPwUr0IaJEObEHqNl5cRftSnH
83
83
  reflex/components/forms/radio.py,sha256=5R7HrXzGSvh2RDW1b5mcUBM1NOlMjQkWt9izH1NyblA,3029
84
84
  reflex/components/forms/rangeslider.py,sha256=5UbPWKcsZAZoqy8URZfbD5GKdM1wCg1NuBdpo4SDLkU,4177
85
85
  reflex/components/forms/select.py,sha256=XYBOMcLCP5rWWFq0QXjHr9jRWGhtTSWq7UcXdzhgKG8,3510
86
- reflex/components/forms/slider.py,sha256=rs0Mh5tTIEMGGbiRv9cljRb0-7tgjXzE6MtUqA8u5nI,3116
86
+ reflex/components/forms/slider.py,sha256=gOCYtvSJ6XEw__xiikxDNgiXDqioAe6_o45PNsvpW6c,3198
87
87
  reflex/components/forms/switch.py,sha256=RypVYfIIgEG1J01Rn-ZjsWi1YFQ3Wjgf816mgX-J8o8,1567
88
- reflex/components/forms/textarea.py,sha256=ooQS7n3EdTKMkTkGGelUUMH8poGGRodCb8qJmeKjBBo,2228
88
+ reflex/components/forms/textarea.py,sha256=KzohU2pFu-2NXjVrATAGhwRQyRFkRuYDu4WaR0jW-o4,2439
89
89
  reflex/components/forms/upload.py,sha256=nRQF4IPVqZjwXtqcpQr2waMJ9hnKLlYcwa2_RYt8FEs,3272
90
90
  reflex/components/graphing/__init__.py,sha256=DgocEd5NyaY1HfOJPZov3lGLgM-V7jUlnGiZRYdAh58,351
91
91
  reflex/components/graphing/plotly.py,sha256=B0EAf95yfbsB0PfMpjH39U0lmPCxTtaT09MHW84jKBI,1169
@@ -154,7 +154,7 @@ reflex/event.py,sha256=AlSDMzW731WHZdzqvpjENhxC3qRiRlR2E5xD3jwprwE,13408
154
154
  reflex/middleware/__init__.py,sha256=x7xTeDuc73Hjj43k1J63naC9x8vzFxl4sq7cCFBX7sk,111
155
155
  reflex/middleware/hydrate_middleware.py,sha256=IBz_ay8Bb3rezBzyC3F7BLb6p50GS2RRCs5gL5V3ECA,1727
156
156
  reflex/middleware/middleware.py,sha256=BJM_3GGLUi6oRf753vxRJueOUDm3eLC2pdY2hl1ez-4,1157
157
- reflex/model.py,sha256=ajqyHVOlGPB4dfR7JOOp80d8Ma3-e3dj8Z5SzRQN5-M,9622
157
+ reflex/model.py,sha256=LQT7FYK_Ak7AmlVga1OYNLSqg8t2TXzSTsQqn_nGUyw,9665
158
158
  reflex/page.py,sha256=y3elKn6gIWhjlcTrqG28yILIGCWvaLj8Tk1RrWds97M,1832
159
159
  reflex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
160
160
  reflex/reflex.py,sha256=9f1AeTOsvHbNsQsMMgs6VvegJbAQQYH_LCY60Hci11Y,10277
@@ -174,9 +174,9 @@ reflex/utils/processes.py,sha256=H8XshR7xRSF7iSYchRmIKJF108DTLAqghY77YemqXaI,719
174
174
  reflex/utils/telemetry.py,sha256=O7iidXpjOd_xpeqOfED4Vtjly55_yLGqeEm6nQSIjvY,2362
175
175
  reflex/utils/types.py,sha256=7ezGbccoEzTpTDB15zskP4I2zu0qVU1T7oIdPnjtfTY,4889
176
176
  reflex/utils/watch.py,sha256=1StctqX3jUwuZNDeikWI-363MpJX06PMQIJsHHwLSaE,2632
177
- reflex/vars.py,sha256=0OMnzSyQ_a44NXsglJgqRFQTekfpxprKWRPI-s4heoY,35840
178
- reflex-0.2.5a1.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
179
- reflex-0.2.5a1.dist-info/METADATA,sha256=RG0tJIsu3WZfwHV4jU30wvDx-rqEQkawj0D2JnFDcvU,10087
180
- reflex-0.2.5a1.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
181
- reflex-0.2.5a1.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
182
- reflex-0.2.5a1.dist-info/RECORD,,
177
+ reflex/vars.py,sha256=mKyMAsHxt9W4z40GjOsAOuuTnJRoJ2-_8qAuhLsdLu4,36238
178
+ reflex-0.2.6.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
179
+ reflex-0.2.6.dist-info/METADATA,sha256=Xn5KDIWyFKD5JTNFpFox4tMHLgiQXjdIz8hc6dTC03o,10126
180
+ reflex-0.2.6.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
181
+ reflex-0.2.6.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
182
+ reflex-0.2.6.dist-info/RECORD,,