reflex 0.5.9.dev1__py3-none-any.whl → 0.5.10a1__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 (169) hide show
  1. reflex/.templates/web/utils/client_side_routing.js +6 -1
  2. reflex/__init__.py +21 -2
  3. reflex/__init__.pyi +0 -1
  4. reflex/app.py +1 -1
  5. reflex/components/__init__.py +0 -1
  6. reflex/components/__init__.pyi +0 -1
  7. reflex/components/markdown/markdown.py +1 -1
  8. reflex/components/recharts/cartesian.py +3 -0
  9. reflex/components/recharts/cartesian.pyi +2 -0
  10. reflex/components/sonner/toast.py +27 -1
  11. reflex/components/sonner/toast.pyi +5 -0
  12. reflex/constants/base.py +2 -0
  13. reflex/constants/installer.py +2 -0
  14. reflex/experimental/hooks.py +1 -1
  15. reflex/reflex.py +0 -15
  16. reflex/state.py +22 -22
  17. reflex/testing.py +8 -3
  18. reflex/utils/prerequisites.py +16 -115
  19. reflex/utils/registry.py +48 -0
  20. reflex/utils/types.py +1 -1
  21. reflex/vars.py +4 -2
  22. {reflex-0.5.9.dev1.dist-info → reflex-0.5.10a1.dist-info}/METADATA +2 -1
  23. {reflex-0.5.9.dev1.dist-info → reflex-0.5.10a1.dist-info}/RECORD +26 -168
  24. reflex/components/chakra/__init__.py +0 -204
  25. reflex/components/chakra/base.py +0 -210
  26. reflex/components/chakra/base.pyi +0 -319
  27. reflex/components/chakra/datadisplay/__init__.py +0 -10
  28. reflex/components/chakra/datadisplay/badge.py +0 -16
  29. reflex/components/chakra/datadisplay/badge.pyi +0 -96
  30. reflex/components/chakra/datadisplay/code.py +0 -11
  31. reflex/components/chakra/datadisplay/code.pyi +0 -87
  32. reflex/components/chakra/datadisplay/divider.py +0 -20
  33. reflex/components/chakra/datadisplay/divider.pyi +0 -100
  34. reflex/components/chakra/datadisplay/keyboard_key.py +0 -9
  35. reflex/components/chakra/datadisplay/keyboard_key.pyi +0 -87
  36. reflex/components/chakra/datadisplay/list.py +0 -60
  37. reflex/components/chakra/datadisplay/list.pyi +0 -339
  38. reflex/components/chakra/datadisplay/stat.py +0 -80
  39. reflex/components/chakra/datadisplay/stat.pyi +0 -477
  40. reflex/components/chakra/datadisplay/table.py +0 -305
  41. reflex/components/chakra/datadisplay/table.pyi +0 -737
  42. reflex/components/chakra/datadisplay/tag.py +0 -85
  43. reflex/components/chakra/datadisplay/tag.pyi +0 -433
  44. reflex/components/chakra/disclosure/__init__.py +0 -14
  45. reflex/components/chakra/disclosure/accordion.py +0 -110
  46. reflex/components/chakra/disclosure/accordion.pyi +0 -411
  47. reflex/components/chakra/disclosure/tabs.py +0 -117
  48. reflex/components/chakra/disclosure/tabs.pyi +0 -496
  49. reflex/components/chakra/disclosure/transition.py +0 -73
  50. reflex/components/chakra/disclosure/transition.pyi +0 -509
  51. reflex/components/chakra/disclosure/visuallyhidden.py +0 -9
  52. reflex/components/chakra/disclosure/visuallyhidden.pyi +0 -87
  53. reflex/components/chakra/feedback/__init__.py +0 -7
  54. reflex/components/chakra/feedback/alert.py +0 -68
  55. reflex/components/chakra/feedback/alert.pyi +0 -335
  56. reflex/components/chakra/feedback/circularprogress.py +0 -68
  57. reflex/components/chakra/feedback/circularprogress.pyi +0 -185
  58. reflex/components/chakra/feedback/progress.py +0 -33
  59. reflex/components/chakra/feedback/progress.pyi +0 -101
  60. reflex/components/chakra/feedback/skeleton.py +0 -70
  61. reflex/components/chakra/feedback/skeleton.pyi +0 -271
  62. reflex/components/chakra/feedback/spinner.py +0 -25
  63. reflex/components/chakra/feedback/spinner.pyi +0 -102
  64. reflex/components/chakra/forms/__init__.py +0 -49
  65. reflex/components/chakra/forms/button.py +0 -83
  66. reflex/components/chakra/forms/button.pyi +0 -262
  67. reflex/components/chakra/forms/checkbox.py +0 -77
  68. reflex/components/chakra/forms/checkbox.pyi +0 -247
  69. reflex/components/chakra/forms/colormodeswitch.py +0 -104
  70. reflex/components/chakra/forms/colormodeswitch.pyi +0 -473
  71. reflex/components/chakra/forms/date_picker.py +0 -11
  72. reflex/components/chakra/forms/date_picker.pyi +0 -129
  73. reflex/components/chakra/forms/date_time_picker.py +0 -11
  74. reflex/components/chakra/forms/date_time_picker.pyi +0 -129
  75. reflex/components/chakra/forms/editable.py +0 -67
  76. reflex/components/chakra/forms/editable.pyi +0 -343
  77. reflex/components/chakra/forms/email.py +0 -11
  78. reflex/components/chakra/forms/email.pyi +0 -129
  79. reflex/components/chakra/forms/form.py +0 -103
  80. reflex/components/chakra/forms/form.pyi +0 -484
  81. reflex/components/chakra/forms/iconbutton.py +0 -38
  82. reflex/components/chakra/forms/iconbutton.pyi +0 -108
  83. reflex/components/chakra/forms/input.py +0 -130
  84. reflex/components/chakra/forms/input.pyi +0 -566
  85. reflex/components/chakra/forms/multiselect.py +0 -355
  86. reflex/components/chakra/forms/numberinput.py +0 -128
  87. reflex/components/chakra/forms/numberinput.pyi +0 -442
  88. reflex/components/chakra/forms/password.py +0 -11
  89. reflex/components/chakra/forms/password.pyi +0 -129
  90. reflex/components/chakra/forms/pininput.py +0 -201
  91. reflex/components/chakra/forms/pininput.pyi +0 -215
  92. reflex/components/chakra/forms/radio.py +0 -101
  93. reflex/components/chakra/forms/radio.pyi +0 -197
  94. reflex/components/chakra/forms/rangeslider.py +0 -149
  95. reflex/components/chakra/forms/rangeslider.pyi +0 -354
  96. reflex/components/chakra/forms/select.py +0 -103
  97. reflex/components/chakra/forms/select.pyi +0 -204
  98. reflex/components/chakra/forms/slider.py +0 -130
  99. reflex/components/chakra/forms/slider.pyi +0 -449
  100. reflex/components/chakra/forms/switch.py +0 -49
  101. reflex/components/chakra/forms/switch.pyi +0 -159
  102. reflex/components/chakra/forms/textarea.py +0 -79
  103. reflex/components/chakra/forms/textarea.pyi +0 -123
  104. reflex/components/chakra/forms/time_picker.py +0 -11
  105. reflex/components/chakra/forms/time_picker.pyi +0 -129
  106. reflex/components/chakra/layout/__init__.py +0 -14
  107. reflex/components/chakra/layout/aspect_ratio.py +0 -13
  108. reflex/components/chakra/layout/aspect_ratio.pyi +0 -89
  109. reflex/components/chakra/layout/box.py +0 -31
  110. reflex/components/chakra/layout/box.pyi +0 -93
  111. reflex/components/chakra/layout/card.py +0 -100
  112. reflex/components/chakra/layout/card.pyi +0 -379
  113. reflex/components/chakra/layout/center.py +0 -21
  114. reflex/components/chakra/layout/center.pyi +0 -239
  115. reflex/components/chakra/layout/container.py +0 -13
  116. reflex/components/chakra/layout/container.pyi +0 -89
  117. reflex/components/chakra/layout/flex.py +0 -33
  118. reflex/components/chakra/layout/flex.pyi +0 -101
  119. reflex/components/chakra/layout/grid.py +0 -125
  120. reflex/components/chakra/layout/grid.pyi +0 -293
  121. reflex/components/chakra/layout/spacer.py +0 -9
  122. reflex/components/chakra/layout/spacer.pyi +0 -87
  123. reflex/components/chakra/layout/stack.py +0 -48
  124. reflex/components/chakra/layout/stack.pyi +0 -305
  125. reflex/components/chakra/layout/wrap.py +0 -57
  126. reflex/components/chakra/layout/wrap.pyi +0 -179
  127. reflex/components/chakra/media/__init__.py +0 -7
  128. reflex/components/chakra/media/avatar.py +0 -58
  129. reflex/components/chakra/media/avatar.pyi +0 -267
  130. reflex/components/chakra/media/icon.py +0 -111
  131. reflex/components/chakra/media/icon.pyi +0 -171
  132. reflex/components/chakra/media/image.py +0 -74
  133. reflex/components/chakra/media/image.pyi +0 -118
  134. reflex/components/chakra/navigation/__init__.py +0 -18
  135. reflex/components/chakra/navigation/breadcrumb.py +0 -98
  136. reflex/components/chakra/navigation/breadcrumb.pyi +0 -351
  137. reflex/components/chakra/navigation/link.py +0 -62
  138. reflex/components/chakra/navigation/link.pyi +0 -105
  139. reflex/components/chakra/navigation/linkoverlay.py +0 -22
  140. reflex/components/chakra/navigation/linkoverlay.pyi +0 -167
  141. reflex/components/chakra/navigation/stepper.py +0 -113
  142. reflex/components/chakra/navigation/stepper.pyi +0 -762
  143. reflex/components/chakra/overlay/__init__.py +0 -50
  144. reflex/components/chakra/overlay/alertdialog.py +0 -153
  145. reflex/components/chakra/overlay/alertdialog.pyi +0 -612
  146. reflex/components/chakra/overlay/drawer.py +0 -168
  147. reflex/components/chakra/overlay/drawer.pyi +0 -652
  148. reflex/components/chakra/overlay/menu.py +0 -225
  149. reflex/components/chakra/overlay/menu.pyi +0 -708
  150. reflex/components/chakra/overlay/modal.py +0 -166
  151. reflex/components/chakra/overlay/modal.pyi +0 -600
  152. reflex/components/chakra/overlay/popover.py +0 -183
  153. reflex/components/chakra/overlay/popover.pyi +0 -757
  154. reflex/components/chakra/overlay/tooltip.py +0 -70
  155. reflex/components/chakra/overlay/tooltip.pyi +0 -129
  156. reflex/components/chakra/typography/__init__.py +0 -10
  157. reflex/components/chakra/typography/heading.py +0 -16
  158. reflex/components/chakra/typography/heading.pyi +0 -96
  159. reflex/components/chakra/typography/highlight.py +0 -23
  160. reflex/components/chakra/typography/highlight.pyi +0 -91
  161. reflex/components/chakra/typography/span.py +0 -15
  162. reflex/components/chakra/typography/span.pyi +0 -89
  163. reflex/components/chakra/typography/text.py +0 -18
  164. reflex/components/chakra/typography/text.pyi +0 -91
  165. reflex/components/media/__init__.py +0 -1
  166. reflex/components/media/icon.py +0 -3
  167. {reflex-0.5.9.dev1.dist-info → reflex-0.5.10a1.dist-info}/LICENSE +0 -0
  168. {reflex-0.5.9.dev1.dist-info → reflex-0.5.10a1.dist-info}/WHEEL +0 -0
  169. {reflex-0.5.9.dev1.dist-info → reflex-0.5.10a1.dist-info}/entry_points.txt +0 -0
@@ -1,305 +0,0 @@
1
- """Table components."""
2
-
3
- from typing import List, Tuple
4
-
5
- from reflex.components.chakra import ChakraComponent
6
- from reflex.components.component import Component
7
- from reflex.components.core.foreach import Foreach
8
- from reflex.utils import types
9
- from reflex.vars import Var
10
-
11
-
12
- class Table(ChakraComponent):
13
- """A table component."""
14
-
15
- tag = "Table"
16
-
17
- # The color scheme of the table
18
- color_scheme: Var[str]
19
-
20
- # The variant of the table style to use
21
- variant: Var[str]
22
-
23
- # The size of the table
24
- size: Var[str]
25
-
26
- # The placement of the table caption.
27
- placement: Var[str]
28
-
29
- @classmethod
30
- def create(
31
- cls, *children, caption=None, headers=None, rows=None, footers=None, **props
32
- ) -> Component:
33
- """Create a table component.
34
-
35
- Args:
36
- *children: The children of the component.
37
- caption: The caption of the table component.
38
- headers: The headers of the table component.
39
- rows: The rows of the table component.
40
- footers: The footers of the table component.
41
- **props: The properties of the component.
42
-
43
- Returns:
44
- The table component.
45
- """
46
- if len(children) == 0:
47
- children = []
48
-
49
- if caption is not None:
50
- children.append(TableCaption.create(caption))
51
-
52
- if headers is not None:
53
- children.append(Thead.create(headers=headers))
54
-
55
- if rows is not None:
56
- children.append(Tbody.create(rows=rows))
57
-
58
- if footers is not None:
59
- children.append(Tfoot.create(footers=footers))
60
- return super().create(*children, **props)
61
-
62
-
63
- class Thead(ChakraComponent):
64
- """A table header component."""
65
-
66
- tag = "Thead"
67
-
68
- # invalid children components
69
- _invalid_children: List[str] = ["Tbody", "Thead", "Tfoot"]
70
-
71
- @classmethod
72
- def create(cls, *children, headers=None, **props) -> Component:
73
- """Create a table header component.
74
-
75
- Args:
76
- *children: The children of the component.
77
- headers (list, optional): List of headers. Defaults to None.
78
- **props: The properties of the component.
79
-
80
- Returns:
81
- The table header component.
82
-
83
- """
84
- if len(children) == 0:
85
- cls.validate_headers(headers)
86
-
87
- children = [Tr.create(cell_type="header", cells=headers)]
88
- return super().create(*children, **props)
89
-
90
- @staticmethod
91
- def validate_headers(headers):
92
- """Type checking for table headers.
93
-
94
- Args:
95
- headers: The table headers.
96
-
97
- Raises:
98
- TypeError: If headers are not of type list or type tuple.
99
-
100
- """
101
- allowed_types = (list, tuple)
102
- if (
103
- (
104
- isinstance(headers, Var)
105
- and not types.check_type_in_allowed_types(
106
- headers._var_type, allowed_types
107
- )
108
- )
109
- or not isinstance(headers, Var)
110
- and not types.check_type_in_allowed_types(type(headers), allowed_types)
111
- ):
112
- raise TypeError("table headers should be a list or tuple")
113
-
114
-
115
- class Tbody(ChakraComponent):
116
- """A table body component."""
117
-
118
- tag = "Tbody"
119
-
120
- # invalid children components
121
- _invalid_children: List[str] = ["Tbody", "Thead", "Tfoot", "Td", "Th"]
122
-
123
- @classmethod
124
- def create(cls, *children, rows=None, **props) -> Component:
125
- """Create a table body component.
126
-
127
- Args:
128
- *children: The children of the component.
129
- rows (list[list], optional): The rows of the table body. Defaults to None.
130
- **props: The properties of the component.
131
-
132
- Returns:
133
- Component: The table body component
134
- """
135
- if len(children) == 0:
136
- cls.validate_rows(rows) if rows is not None else None
137
-
138
- if isinstance(rows, Var):
139
- children = [
140
- Foreach.create(
141
- rows, lambda row: Tr.create(cell_type="data", cells=row)
142
- )
143
- ]
144
- else:
145
- children = [
146
- Tr.create(cell_type="data", cells=row) for row in rows or []
147
- ]
148
- return super().create(*children, **props)
149
-
150
- @staticmethod
151
- def validate_rows(rows):
152
- """Type checking for table rows.
153
-
154
- Args:
155
- rows: Table rows.
156
-
157
- Raises:
158
- TypeError: If rows are not lists or tuples containing inner lists or tuples.
159
- """
160
- allowed_subclasses = (List, Tuple)
161
- if isinstance(rows, Var):
162
- outer_type = rows._var_type
163
- inner_type = (
164
- outer_type.__args__[0] if hasattr(outer_type, "__args__") else None
165
- )
166
-
167
- # check that the outer container and inner container types are lists or tuples.
168
- if not (
169
- types._issubclass(types.get_base_class(outer_type), allowed_subclasses)
170
- and (
171
- inner_type is None
172
- or types._issubclass(
173
- types.get_base_class(inner_type), allowed_subclasses
174
- )
175
- )
176
- ):
177
- raise TypeError(
178
- f"table rows should be a list or tuple containing inner lists or tuples. Got {outer_type} instead"
179
- )
180
- elif not (
181
- types._issubclass(type(rows), allowed_subclasses)
182
- and (not rows or types._issubclass(type(rows[0]), allowed_subclasses))
183
- ):
184
- raise TypeError(
185
- "table rows should be a list or tuple containing inner lists or tuples."
186
- )
187
-
188
-
189
- class Tfoot(ChakraComponent):
190
- """A table footer component."""
191
-
192
- tag = "Tfoot"
193
-
194
- # invalid children components
195
- _invalid_children: List[str] = ["Tbody", "Thead", "Td", "Th", "Tfoot"]
196
-
197
- @classmethod
198
- def create(cls, *children, footers=None, **props) -> Component:
199
- """Create a table footer component.
200
-
201
- Args:
202
- *children: The children of the component.
203
- footers (list, optional): List of footers. Defaults to None.
204
- **props: The properties of the component.
205
-
206
- Returns:
207
- The table footer component.
208
- """
209
- if len(children) == 0:
210
- cls.validate_footers(footers)
211
- children = [Tr.create(cell_type="header", cells=footers)]
212
- return super().create(*children, **props)
213
-
214
- @staticmethod
215
- def validate_footers(footers):
216
- """Type checking for table footers.
217
-
218
- Args:
219
- footers: Table rows.
220
-
221
- Raises:
222
- TypeError: If footers are not of type list.
223
- """
224
- allowed_types = (list, tuple)
225
- if (
226
- (
227
- isinstance(footers, Var)
228
- and not types.check_type_in_allowed_types(
229
- footers._var_type, allowed_types
230
- )
231
- )
232
- or not isinstance(footers, Var)
233
- and not types.check_type_in_allowed_types(type(footers), allowed_types)
234
- ):
235
- raise TypeError("table headers should be a list or tuple")
236
-
237
-
238
- class Tr(ChakraComponent):
239
- """A table row component."""
240
-
241
- tag = "Tr"
242
-
243
- # invalid children components
244
- _invalid_children: List[str] = ["Tbody", "Thead", "Tfoot", "Tr"]
245
-
246
- @classmethod
247
- def create(cls, *children, cell_type: str = "", cells=None, **props) -> Component:
248
- """Create a table row component.
249
-
250
- Args:
251
- *children: The children of the component.
252
- cell_type: the type of cells in this table row. "header" or "data". Defaults to None.
253
- cells: The cells value to add in the table row. Defaults to None.
254
- **props: The properties of the component.
255
-
256
- Returns:
257
- The table row component
258
- """
259
- types = {"header": Th, "data": Td}
260
- cell_cls = types.get(cell_type)
261
- if len(children) == 0 and cell_cls:
262
- if isinstance(cells, Var):
263
- children = [Foreach.create(cells, cell_cls.create)]
264
- else:
265
- children = [cell_cls.create(cell) for cell in cells or []]
266
- return super().create(*children, **props)
267
-
268
-
269
- class Th(ChakraComponent):
270
- """A table header cell component."""
271
-
272
- tag = "Th"
273
-
274
- # invalid children components
275
- _invalid_children: List[str] = ["Tbody", "Thead", "Tr", "Td", "Th"]
276
-
277
- # Aligns the cell content to the right.
278
- is_numeric: Var[bool]
279
-
280
-
281
- class Td(ChakraComponent):
282
- """A table data cell component."""
283
-
284
- tag = "Td"
285
-
286
- # invalid children components
287
- _invalid_children: List[str] = ["Tbody", "Thead"]
288
-
289
- # Aligns the cell content to the right.
290
- is_numeric: Var[bool]
291
-
292
-
293
- class TableCaption(ChakraComponent):
294
- """A table caption component."""
295
-
296
- tag = "TableCaption"
297
-
298
- # The placement of the table caption. This sets the `caption-side` CSS attribute.
299
- placement: Var[str]
300
-
301
-
302
- class TableContainer(ChakraComponent):
303
- """The table container component renders a div that wraps the table component."""
304
-
305
- tag = "TableContainer"