reflex 0.5.10a3__py3-none-any.whl → 0.6.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 (237) hide show
  1. reflex/.templates/jinja/web/pages/utils.js.jinja2 +4 -4
  2. reflex/.templates/jinja/web/utils/context.js.jinja2 +1 -1
  3. reflex/.templates/jinja/web/utils/theme.js.jinja2 +1 -1
  4. reflex/__init__.py +3 -2
  5. reflex/__init__.pyi +2 -2
  6. reflex/app.py +43 -9
  7. reflex/base.py +3 -2
  8. reflex/compiler/compiler.py +6 -6
  9. reflex/compiler/utils.py +5 -3
  10. reflex/components/base/app_wrap.py +2 -4
  11. reflex/components/base/app_wrap.pyi +17 -17
  12. reflex/components/base/bare.py +7 -4
  13. reflex/components/base/body.pyi +17 -17
  14. reflex/components/base/document.pyi +81 -81
  15. reflex/components/base/error_boundary.py +10 -8
  16. reflex/components/base/error_boundary.pyi +20 -19
  17. reflex/components/base/fragment.pyi +17 -17
  18. reflex/components/base/head.pyi +33 -33
  19. reflex/components/base/link.pyi +34 -33
  20. reflex/components/base/meta.pyi +65 -65
  21. reflex/components/base/script.py +2 -1
  22. reflex/components/base/script.pyi +21 -20
  23. reflex/components/component.py +116 -145
  24. reflex/components/core/banner.py +59 -60
  25. reflex/components/core/banner.pyi +86 -150
  26. reflex/components/core/client_side_routing.py +2 -1
  27. reflex/components/core/client_side_routing.pyi +34 -33
  28. reflex/components/core/clipboard.py +2 -2
  29. reflex/components/core/clipboard.pyi +19 -18
  30. reflex/components/core/cond.py +21 -44
  31. reflex/components/core/debounce.py +6 -8
  32. reflex/components/core/debounce.pyi +19 -18
  33. reflex/components/core/foreach.py +5 -14
  34. reflex/components/core/html.pyi +18 -17
  35. reflex/components/core/match.py +36 -43
  36. reflex/components/core/upload.py +32 -25
  37. reflex/components/core/upload.pyi +84 -73
  38. reflex/components/datadisplay/code.py +55 -28
  39. reflex/components/datadisplay/code.pyi +20 -17
  40. reflex/components/datadisplay/dataeditor.py +17 -11
  41. reflex/components/datadisplay/dataeditor.pyi +34 -33
  42. reflex/components/el/__init__.py +0 -1
  43. reflex/components/el/__init__.pyi +0 -11
  44. reflex/components/el/element.pyi +17 -17
  45. reflex/components/el/elements/__init__.py +1 -7
  46. reflex/components/el/elements/__init__.pyi +1 -15
  47. reflex/components/el/elements/base.pyi +18 -17
  48. reflex/components/el/elements/forms.py +24 -31
  49. reflex/components/el/elements/forms.pyi +237 -236
  50. reflex/components/el/elements/inline.pyi +450 -449
  51. reflex/components/el/elements/media.py +0 -21
  52. reflex/components/el/elements/media.pyi +338 -337
  53. reflex/components/el/elements/metadata.py +3 -2
  54. reflex/components/el/elements/metadata.pyi +98 -97
  55. reflex/components/el/elements/other.pyi +114 -113
  56. reflex/components/el/elements/scripts.pyi +50 -49
  57. reflex/components/el/elements/sectioning.pyi +242 -241
  58. reflex/components/el/elements/tables.pyi +162 -161
  59. reflex/components/el/elements/typography.pyi +242 -241
  60. reflex/components/gridjs/datatable.py +13 -14
  61. reflex/components/gridjs/datatable.pyi +34 -33
  62. reflex/components/lucide/icon.py +2 -126
  63. reflex/components/lucide/icon.pyi +34 -142
  64. reflex/components/markdown/markdown.py +30 -35
  65. reflex/components/markdown/markdown.pyi +29 -32
  66. reflex/components/moment/moment.pyi +19 -18
  67. reflex/components/next/base.pyi +17 -17
  68. reflex/components/next/image.py +0 -4
  69. reflex/components/next/image.pyi +20 -19
  70. reflex/components/next/link.pyi +18 -17
  71. reflex/components/next/video.pyi +18 -17
  72. reflex/components/plotly/plotly.py +16 -28
  73. reflex/components/plotly/plotly.pyi +36 -35
  74. reflex/components/props.py +21 -10
  75. reflex/components/radix/__init__.pyi +1 -1
  76. reflex/components/radix/primitives/__init__.pyi +0 -1
  77. reflex/components/radix/primitives/accordion.py +7 -8
  78. reflex/components/radix/primitives/accordion.pyi +117 -116
  79. reflex/components/radix/primitives/base.pyi +34 -33
  80. reflex/components/radix/primitives/drawer.pyi +169 -168
  81. reflex/components/radix/primitives/form.pyi +168 -167
  82. reflex/components/radix/primitives/progress.pyi +82 -81
  83. reflex/components/radix/primitives/slider.pyi +84 -83
  84. reflex/components/radix/themes/base.py +8 -4
  85. reflex/components/radix/themes/base.pyi +114 -113
  86. reflex/components/radix/themes/color_mode.py +12 -21
  87. reflex/components/radix/themes/color_mode.pyi +67 -67
  88. reflex/components/radix/themes/components/__init__.pyi +1 -0
  89. reflex/components/radix/themes/components/alert_dialog.pyi +118 -117
  90. reflex/components/radix/themes/components/aspect_ratio.pyi +18 -17
  91. reflex/components/radix/themes/components/avatar.pyi +18 -17
  92. reflex/components/radix/themes/components/badge.pyi +18 -17
  93. reflex/components/radix/themes/components/button.pyi +18 -17
  94. reflex/components/radix/themes/components/callout.pyi +82 -81
  95. reflex/components/radix/themes/components/card.pyi +18 -17
  96. reflex/components/radix/themes/components/checkbox.py +2 -3
  97. reflex/components/radix/themes/components/checkbox.pyi +53 -52
  98. reflex/components/radix/themes/components/checkbox_cards.pyi +34 -33
  99. reflex/components/radix/themes/components/checkbox_group.pyi +34 -33
  100. reflex/components/radix/themes/components/context_menu.pyi +140 -139
  101. reflex/components/radix/themes/components/data_list.py +5 -0
  102. reflex/components/radix/themes/components/data_list.pyi +71 -65
  103. reflex/components/radix/themes/components/dialog.pyi +121 -120
  104. reflex/components/radix/themes/components/dropdown_menu.pyi +142 -141
  105. reflex/components/radix/themes/components/hover_card.pyi +68 -67
  106. reflex/components/radix/themes/components/icon_button.py +2 -1
  107. reflex/components/radix/themes/components/icon_button.pyi +18 -17
  108. reflex/components/radix/themes/components/inset.pyi +18 -17
  109. reflex/components/radix/themes/components/popover.pyi +73 -72
  110. reflex/components/radix/themes/components/progress.pyi +18 -17
  111. reflex/components/radix/themes/components/radio.pyi +18 -17
  112. reflex/components/radix/themes/components/radio_cards.pyi +35 -34
  113. reflex/components/radix/themes/components/radio_group.py +35 -31
  114. reflex/components/radix/themes/components/radio_group.pyi +73 -66
  115. reflex/components/radix/themes/components/scroll_area.pyi +18 -17
  116. reflex/components/radix/themes/components/segmented_control.pyi +35 -34
  117. reflex/components/radix/themes/components/select.py +2 -1
  118. reflex/components/radix/themes/components/select.pyi +155 -154
  119. reflex/components/radix/themes/components/separator.py +2 -3
  120. reflex/components/radix/themes/components/separator.pyi +18 -17
  121. reflex/components/radix/themes/components/skeleton.pyi +18 -17
  122. reflex/components/radix/themes/components/slider.py +2 -1
  123. reflex/components/radix/themes/components/slider.pyi +20 -19
  124. reflex/components/radix/themes/components/spinner.pyi +18 -17
  125. reflex/components/radix/themes/components/switch.pyi +19 -18
  126. reflex/components/radix/themes/components/table.pyi +114 -113
  127. reflex/components/radix/themes/components/tabs.pyi +84 -83
  128. reflex/components/radix/themes/components/text_area.pyi +21 -20
  129. reflex/components/radix/themes/components/text_field.py +0 -79
  130. reflex/components/radix/themes/components/text_field.pyi +57 -63
  131. reflex/components/radix/themes/components/tooltip.pyi +21 -20
  132. reflex/components/radix/themes/layout/base.pyi +18 -17
  133. reflex/components/radix/themes/layout/box.pyi +18 -17
  134. reflex/components/radix/themes/layout/center.pyi +18 -17
  135. reflex/components/radix/themes/layout/container.py +2 -3
  136. reflex/components/radix/themes/layout/container.pyi +18 -17
  137. reflex/components/radix/themes/layout/flex.pyi +18 -17
  138. reflex/components/radix/themes/layout/grid.pyi +18 -17
  139. reflex/components/radix/themes/layout/list.py +5 -4
  140. reflex/components/radix/themes/layout/list.pyi +86 -85
  141. reflex/components/radix/themes/layout/section.py +2 -3
  142. reflex/components/radix/themes/layout/section.pyi +18 -17
  143. reflex/components/radix/themes/layout/spacer.pyi +18 -17
  144. reflex/components/radix/themes/layout/stack.pyi +50 -49
  145. reflex/components/radix/themes/typography/blockquote.pyi +18 -17
  146. reflex/components/radix/themes/typography/code.pyi +18 -17
  147. reflex/components/radix/themes/typography/heading.pyi +18 -17
  148. reflex/components/radix/themes/typography/link.pyi +18 -17
  149. reflex/components/radix/themes/typography/text.pyi +114 -113
  150. reflex/components/react_player/audio.pyi +34 -33
  151. reflex/components/react_player/react_player.pyi +34 -33
  152. reflex/components/react_player/video.pyi +34 -33
  153. reflex/components/recharts/cartesian.py +23 -19
  154. reflex/components/recharts/cartesian.pyi +297 -296
  155. reflex/components/recharts/charts.py +6 -5
  156. reflex/components/recharts/charts.pyi +179 -178
  157. reflex/components/recharts/general.py +8 -7
  158. reflex/components/recharts/general.pyi +82 -81
  159. reflex/components/recharts/polar.py +14 -13
  160. reflex/components/recharts/polar.pyi +76 -75
  161. reflex/components/recharts/recharts.pyi +33 -33
  162. reflex/components/sonner/toast.py +30 -33
  163. reflex/components/sonner/toast.pyi +27 -25
  164. reflex/components/suneditor/editor.py +2 -1
  165. reflex/components/suneditor/editor.pyi +27 -26
  166. reflex/components/tags/iter_tag.py +16 -16
  167. reflex/components/tags/tag.py +8 -10
  168. reflex/constants/base.py +3 -1
  169. reflex/constants/event.py +1 -0
  170. reflex/event.py +89 -79
  171. reflex/experimental/__init__.py +25 -6
  172. reflex/experimental/client_state.py +34 -58
  173. reflex/experimental/hooks.py +13 -18
  174. reflex/experimental/layout.py +5 -5
  175. reflex/experimental/layout.pyi +84 -83
  176. reflex/{experimental/vars → ivars}/__init__.py +0 -1
  177. reflex/ivars/base.py +2180 -0
  178. reflex/ivars/function.py +200 -0
  179. reflex/ivars/number.py +1137 -0
  180. reflex/ivars/object.py +564 -0
  181. reflex/ivars/sequence.py +1601 -0
  182. reflex/model.py +22 -0
  183. reflex/reflex.py +4 -0
  184. reflex/state.py +388 -73
  185. reflex/style.py +52 -34
  186. reflex/testing.py +8 -3
  187. reflex/utils/exceptions.py +12 -0
  188. reflex/utils/exec.py +0 -14
  189. reflex/utils/format.py +74 -223
  190. reflex/utils/net.py +43 -0
  191. reflex/utils/path_ops.py +13 -1
  192. reflex/utils/prerequisites.py +46 -26
  193. reflex/utils/pyi_generator.py +5 -4
  194. reflex/utils/serializers.py +13 -31
  195. reflex/utils/types.py +44 -9
  196. reflex/vars.py +127 -2230
  197. {reflex-0.5.10a3.dist-info → reflex-0.6.0a1.dist-info}/METADATA +4 -6
  198. reflex-0.6.0a1.dist-info/RECORD +384 -0
  199. reflex/.templates/apps/demo/.gitignore +0 -4
  200. reflex/.templates/apps/demo/assets/favicon.ico +0 -0
  201. reflex/.templates/apps/demo/assets/github.svg +0 -10
  202. reflex/.templates/apps/demo/assets/icon.svg +0 -37
  203. reflex/.templates/apps/demo/assets/logo.svg +0 -68
  204. reflex/.templates/apps/demo/assets/paneleft.svg +0 -13
  205. reflex/.templates/apps/demo/code/__init__.py +0 -1
  206. reflex/.templates/apps/demo/code/demo.py +0 -127
  207. reflex/.templates/apps/demo/code/pages/__init__.py +0 -7
  208. reflex/.templates/apps/demo/code/pages/chatapp.py +0 -31
  209. reflex/.templates/apps/demo/code/pages/datatable.py +0 -360
  210. reflex/.templates/apps/demo/code/pages/forms.py +0 -257
  211. reflex/.templates/apps/demo/code/pages/graphing.py +0 -253
  212. reflex/.templates/apps/demo/code/pages/home.py +0 -56
  213. reflex/.templates/apps/demo/code/sidebar.py +0 -178
  214. reflex/.templates/apps/demo/code/state.py +0 -22
  215. reflex/.templates/apps/demo/code/states/form_state.py +0 -40
  216. reflex/.templates/apps/demo/code/states/pie_state.py +0 -47
  217. reflex/.templates/apps/demo/code/styles.py +0 -68
  218. reflex/.templates/apps/demo/code/webui/__init__.py +0 -0
  219. reflex/.templates/apps/demo/code/webui/components/__init__.py +0 -4
  220. reflex/.templates/apps/demo/code/webui/components/chat.py +0 -118
  221. reflex/.templates/apps/demo/code/webui/components/loading_icon.py +0 -19
  222. reflex/.templates/apps/demo/code/webui/components/modal.py +0 -56
  223. reflex/.templates/apps/demo/code/webui/components/navbar.py +0 -70
  224. reflex/.templates/apps/demo/code/webui/components/sidebar.py +0 -66
  225. reflex/.templates/apps/demo/code/webui/state.py +0 -146
  226. reflex/.templates/apps/demo/code/webui/styles.py +0 -88
  227. reflex/experimental/vars/base.py +0 -583
  228. reflex/experimental/vars/function.py +0 -290
  229. reflex/experimental/vars/number.py +0 -1458
  230. reflex/experimental/vars/object.py +0 -804
  231. reflex/experimental/vars/sequence.py +0 -1764
  232. reflex/utils/watch.py +0 -96
  233. reflex/vars.pyi +0 -218
  234. reflex-0.5.10a3.dist-info/RECORD +0 -413
  235. {reflex-0.5.10a3.dist-info → reflex-0.6.0a1.dist-info}/LICENSE +0 -0
  236. {reflex-0.5.10a3.dist-info → reflex-0.6.0a1.dist-info}/WHEEL +0 -0
  237. {reflex-0.5.10a3.dist-info → reflex-0.6.0a1.dist-info}/entry_points.txt +0 -0
@@ -1,127 +0,0 @@
1
- """Welcome to Reflex! This file outlines the steps to create a basic app."""
2
-
3
- from typing import Callable
4
-
5
- import reflex as rx
6
-
7
- from .pages import chatapp_page, datatable_page, forms_page, graphing_page, home_page
8
- from .sidebar import sidebar
9
- from .state import State
10
- from .styles import *
11
-
12
- meta = [
13
- {
14
- "name": "viewport",
15
- "content": "width=device-width, shrink-to-fit=no, initial-scale=1",
16
- },
17
- ]
18
-
19
-
20
- def template(main_content: Callable[[], rx.Component]) -> rx.Component:
21
- """The template for each page of the app.
22
-
23
- Args:
24
- main_content (Callable[[], rx.Component]): The main content of the page.
25
-
26
- Returns:
27
- rx.Component: The template for each page of the app.
28
- """
29
- menu_button = rx.chakra.box(
30
- rx.chakra.menu(
31
- rx.chakra.menu_button(
32
- rx.chakra.icon(
33
- tag="hamburger",
34
- size="4em",
35
- color=text_color,
36
- ),
37
- ),
38
- rx.chakra.menu_list(
39
- rx.chakra.menu_item(rx.chakra.link("Home", href="/", width="100%")),
40
- rx.chakra.menu_divider(),
41
- rx.chakra.menu_item(
42
- rx.chakra.link(
43
- "About", href="https://github.com/reflex-dev", width="100%"
44
- )
45
- ),
46
- rx.chakra.menu_item(
47
- rx.chakra.link(
48
- "Contact", href="mailto:founders@reflex.dev", width="100%"
49
- )
50
- ),
51
- ),
52
- ),
53
- position="fixed",
54
- right="1.5em",
55
- top="1.5em",
56
- z_index="500",
57
- )
58
-
59
- return rx.chakra.hstack(
60
- sidebar(),
61
- main_content(),
62
- rx.chakra.spacer(),
63
- menu_button,
64
- align_items="flex-start",
65
- transition="left 0.5s, width 0.5s",
66
- position="relative",
67
- left=rx.cond(State.sidebar_displayed, "0px", f"-{sidebar_width}"),
68
- )
69
-
70
-
71
- @rx.page("/", meta=meta)
72
- @template
73
- def home() -> rx.Component:
74
- """Home page.
75
-
76
- Returns:
77
- rx.Component: The home page.
78
- """
79
- return home_page()
80
-
81
-
82
- @rx.page("/forms", meta=meta)
83
- @template
84
- def forms() -> rx.Component:
85
- """Forms page.
86
-
87
- Returns:
88
- rx.Component: The settings page.
89
- """
90
- return forms_page()
91
-
92
-
93
- @rx.page("/graphing", meta=meta)
94
- @template
95
- def graphing() -> rx.Component:
96
- """Graphing page.
97
-
98
- Returns:
99
- rx.Component: The graphing page.
100
- """
101
- return graphing_page()
102
-
103
-
104
- @rx.page("/datatable", meta=meta)
105
- @template
106
- def datatable() -> rx.Component:
107
- """Data Table page.
108
-
109
- Returns:
110
- rx.Component: The chatapp page.
111
- """
112
- return datatable_page()
113
-
114
-
115
- @rx.page("/chatapp", meta=meta)
116
- @template
117
- def chatapp() -> rx.Component:
118
- """Chatapp page.
119
-
120
- Returns:
121
- rx.Component: The chatapp page.
122
- """
123
- return chatapp_page()
124
-
125
-
126
- # Create the app.
127
- app = rx.App(style=base_style)
@@ -1,7 +0,0 @@
1
- """The pages of the app."""
2
-
3
- from .chatapp import chatapp_page
4
- from .datatable import datatable_page
5
- from .forms import forms_page
6
- from .graphing import graphing_page
7
- from .home import home_page
@@ -1,31 +0,0 @@
1
- """The main Chat app."""
2
-
3
- import reflex as rx
4
-
5
- from ..styles import *
6
- from ..webui import styles
7
- from ..webui.components import chat, modal, navbar, sidebar
8
-
9
-
10
- def chatapp_page() -> rx.Component:
11
- """The main app.
12
-
13
- Returns:
14
- The UI for the main app.
15
- """
16
- return rx.chakra.box(
17
- rx.chakra.vstack(
18
- navbar(),
19
- chat.chat(),
20
- chat.action_bar(),
21
- sidebar(),
22
- modal(),
23
- bg=styles.bg_dark_color,
24
- color=styles.text_light_color,
25
- min_h="100vh",
26
- align_items="stretch",
27
- spacing="0",
28
- style=template_content_style,
29
- ),
30
- style=template_page_style,
31
- )
@@ -1,360 +0,0 @@
1
- """The settings page for the template."""
2
-
3
- from typing import Any
4
-
5
- import reflex as rx
6
- from reflex.components.datadisplay.dataeditor import DataEditorTheme
7
-
8
- from ..styles import *
9
- from ..webui.state import State
10
-
11
-
12
- class DataTableState(State):
13
- """Datatable state."""
14
-
15
- cols: list[Any] = [
16
- {"title": "Title", "type": "str"},
17
- {
18
- "title": "Name",
19
- "type": "str",
20
- "group": "Data",
21
- "width": 300,
22
- },
23
- {
24
- "title": "Birth",
25
- "type": "str",
26
- "group": "Data",
27
- "width": 150,
28
- },
29
- {
30
- "title": "Human",
31
- "type": "bool",
32
- "group": "Data",
33
- "width": 80,
34
- },
35
- {
36
- "title": "House",
37
- "type": "str",
38
- "group": "Data",
39
- },
40
- {
41
- "title": "Wand",
42
- "type": "str",
43
- "group": "Data",
44
- "width": 250,
45
- },
46
- {
47
- "title": "Patronus",
48
- "type": "str",
49
- "group": "Data",
50
- },
51
- {
52
- "title": "Blood status",
53
- "type": "str",
54
- "group": "Data",
55
- "width": 200,
56
- },
57
- ]
58
-
59
- data = [
60
- [
61
- "1",
62
- "Harry James Potter",
63
- "31 July 1980",
64
- True,
65
- "Gryffindor",
66
- "11' Holly phoenix feather",
67
- "Stag",
68
- "Half-blood",
69
- ],
70
- [
71
- "2",
72
- "Ronald Bilius Weasley",
73
- "1 March 1980",
74
- True,
75
- "Gryffindor",
76
- "12' Ash unicorn tail hair",
77
- "Jack Russell terrier",
78
- "Pure-blood",
79
- ],
80
- [
81
- "3",
82
- "Hermione Jean Granger",
83
- "19 September, 1979",
84
- True,
85
- "Gryffindor",
86
- "10¾' vine wood dragon heartstring",
87
- "Otter",
88
- "Muggle-born",
89
- ],
90
- [
91
- "4",
92
- "Albus Percival Wulfric Brian Dumbledore",
93
- "Late August 1881",
94
- True,
95
- "Gryffindor",
96
- "15' Elder Thestral tail hair core",
97
- "Phoenix",
98
- "Half-blood",
99
- ],
100
- [
101
- "5",
102
- "Rubeus Hagrid",
103
- "6 December 1928",
104
- False,
105
- "Gryffindor",
106
- "16' Oak unknown core",
107
- "None",
108
- "Part-Human (Half-giant)",
109
- ],
110
- [
111
- "6",
112
- "Fred Weasley",
113
- "1 April, 1978",
114
- True,
115
- "Gryffindor",
116
- "Unknown",
117
- "Unknown",
118
- "Pure-blood",
119
- ],
120
- [
121
- "7",
122
- "George Weasley",
123
- "1 April, 1978",
124
- True,
125
- "Gryffindor",
126
- "Unknown",
127
- "Unknown",
128
- "Pure-blood",
129
- ],
130
- ]
131
-
132
-
133
- code_show = """rx.chakra.hstack(
134
- rx.chakra.divider(orientation="vertical", height="100vh", border="solid black 1px"),
135
- rx.chakra.vstack(
136
- rx.chakra.box(
137
- rx.data_editor(
138
- columns=DataTableState.cols,
139
- data=DataTableState.data,
140
- draw_focus_ring=True,
141
- row_height=50,
142
- smooth_scroll_x=True,
143
- smooth_scroll_y=True,
144
- column_select="single",
145
- # style
146
- theme=DataEditorTheme(**darkTheme),
147
- width="80vw",
148
- height="80vh",
149
- ),
150
- ),
151
- rx.chakra.spacer(),
152
- height="100vh",
153
- spacing="25",
154
- ),
155
- )"""
156
-
157
- state_show = """class DataTableState(State):
158
- cols: list[Any] = [
159
- {"title": "Title", "type": "str"},
160
- {
161
- "title": "Name",
162
- "type": "str",
163
- "group": "Data",
164
- "width": 300,
165
- },
166
- {
167
- "title": "Birth",
168
- "type": "str",
169
- "group": "Data",
170
- "width": 150,
171
- },
172
- {
173
- "title": "Human",
174
- "type": "bool",
175
- "group": "Data",
176
- "width": 80,
177
- },
178
- {
179
- "title": "House",
180
- "type": "str",
181
- "group": "Data",
182
- },
183
- {
184
- "title": "Wand",
185
- "type": "str",
186
- "group": "Data",
187
- "width": 250,
188
- },
189
- {
190
- "title": "Patronus",
191
- "type": "str",
192
- "group": "Data",
193
- },
194
- {
195
- "title": "Blood status",
196
- "type": "str",
197
- "group": "Data",
198
- "width": 200,
199
- },
200
- ]"""
201
-
202
- data_show = """[
203
- ["1", "Harry James Potter", "31 July 1980", True, "Gryffindor", "11' Holly phoenix feather", "Stag", "Half-blood"],
204
- ["2", "Ronald Bilius Weasley", "1 March 1980", True,"Gryffindor", "12' Ash unicorn tail hair", "Jack Russell terrier", "Pure-blood"],
205
- ["3", "Hermione Jean Granger", "19 September, 1979", True, "Gryffindor", "10¾' vine wood dragon heartstring", "Otter", "Muggle-born"],
206
- ["4", "Albus Percival Wulfric Brian Dumbledore", "Late August 1881", True, "Gryffindor", "15' Elder Thestral tail hair core", "Phoenix", "Half-blood"],
207
- ["5", "Rubeus Hagrid", "6 December 1928", False, "Gryffindor", "16' Oak unknown core", "None", "Part-Human (Half-giant)"],
208
- ["6", "Fred Weasley", "1 April, 1978", True, "Gryffindor", "Unknown", "Unknown", "Pure-blood"],
209
- ["7", "George Weasley", "1 April, 1978", True, "Gryffindor", "Unknown", "Unknown", "Pure-blood"],
210
- ]"""
211
-
212
-
213
- darkTheme = {
214
- "accent_color": "#8c96ff",
215
- "accent_light": "rgba(202, 206, 255, 0.253)",
216
- "text_dark": "#ffffff",
217
- "text_medium": "#b8b8b8",
218
- "text_light": "#a0a0a0",
219
- "text_bubble": "#ffffff",
220
- "bg_icon_header": "#b8b8b8",
221
- "fg_icon_header": "#000000",
222
- "text_header": "#a1a1a1",
223
- "text_header_selected": "#000000",
224
- "bg_cell": "#16161b",
225
- "bg_cell_medium": "#202027",
226
- "bg_header": "#212121",
227
- "bg_header_has_focus": "#474747",
228
- "bg_header_hovered": "#404040",
229
- "bg_bubble": "#212121",
230
- "bg_bubble_selected": "#000000",
231
- "bg_search_result": "#423c24",
232
- "border_color": "rgba(225,225,225,0.2)",
233
- "drilldown_border": "rgba(225,225,225,0.4)",
234
- "link_color": "#4F5DFF",
235
- "header_font_style": "bold 14px",
236
- "base_font_style": "13px",
237
- "font_family": "Inter, Roboto, -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Ubuntu, noto, arial, sans-serif",
238
- }
239
-
240
- darkTheme_show = """darkTheme={
241
- "accent_color": "#8c96ff",
242
- "accent_light": "rgba(202, 206, 255, 0.253)",
243
- "text_dark": "#ffffff",
244
- "text_medium": "#b8b8b8",
245
- "text_light": "#a0a0a0",
246
- "text_bubble": "#ffffff",
247
- "bg_icon_header": "#b8b8b8",
248
- "fg_icon_header": "#000000",
249
- "text_header": "#a1a1a1",
250
- "text_header_selected": "#000000",
251
- "bg_cell": "#16161b",
252
- "bg_cell_medium": "#202027",
253
- "bg_header": "#212121",
254
- "bg_header_has_focus": "#474747",
255
- "bg_header_hovered": "#404040",
256
- "bg_bubble": "#212121",
257
- "bg_bubble_selected": "#000000",
258
- "bg_search_result": "#423c24",
259
- "border_color": "rgba(225,225,225,0.2)",
260
- "drilldown_border": "rgba(225,225,225,0.4)",
261
- "link_color": "#4F5DFF",
262
- "header_font_style": "bold 14px",
263
- "base_font_style": "13px",
264
- "font_family": "Inter, Roboto, -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Ubuntu, noto, arial, sans-serif",
265
- }"""
266
-
267
-
268
- def datatable_page() -> rx.Component:
269
- """The UI for the settings page.
270
-
271
- Returns:
272
- rx.Component: The UI for the settings page.
273
- """
274
- return rx.chakra.box(
275
- rx.chakra.vstack(
276
- rx.chakra.heading(
277
- "Data Table Demo",
278
- font_size="3em",
279
- ),
280
- rx.chakra.hstack(
281
- rx.chakra.vstack(
282
- rx.chakra.box(
283
- rx.data_editor(
284
- columns=DataTableState.cols,
285
- data=DataTableState.data,
286
- draw_focus_ring=True,
287
- row_height=50,
288
- smooth_scroll_x=True,
289
- smooth_scroll_y=True,
290
- column_select="single",
291
- # style
292
- theme=DataEditorTheme(**darkTheme),
293
- width="80vw",
294
- ),
295
- ),
296
- rx.chakra.spacer(),
297
- spacing="25",
298
- ),
299
- ),
300
- rx.chakra.tabs(
301
- rx.chakra.tab_list(
302
- rx.chakra.tab("Code", style=tab_style),
303
- rx.chakra.tab("Data", style=tab_style),
304
- rx.chakra.tab("State", style=tab_style),
305
- rx.chakra.tab("Styling", style=tab_style),
306
- padding_x=0,
307
- ),
308
- rx.chakra.tab_panels(
309
- rx.chakra.tab_panel(
310
- rx.code_block(
311
- code_show,
312
- language="python",
313
- show_line_numbers=True,
314
- ),
315
- width="100%",
316
- padding_x=0,
317
- padding_y=".25em",
318
- ),
319
- rx.chakra.tab_panel(
320
- rx.code_block(
321
- data_show,
322
- language="python",
323
- show_line_numbers=True,
324
- ),
325
- width="100%",
326
- padding_x=0,
327
- padding_y=".25em",
328
- ),
329
- rx.chakra.tab_panel(
330
- rx.code_block(
331
- state_show,
332
- language="python",
333
- show_line_numbers=True,
334
- ),
335
- width="100%",
336
- padding_x=0,
337
- padding_y=".25em",
338
- ),
339
- rx.chakra.tab_panel(
340
- rx.code_block(
341
- darkTheme_show,
342
- language="python",
343
- show_line_numbers=True,
344
- ),
345
- width="100%",
346
- padding_x=0,
347
- padding_y=".25em",
348
- ),
349
- width="100%",
350
- ),
351
- variant="unstyled",
352
- color_scheme="purple",
353
- align="end",
354
- width="100%",
355
- padding_top=".5em",
356
- ),
357
- style=template_content_style,
358
- ),
359
- style=template_page_style,
360
- )