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.
- reflex/.templates/jinja/web/pages/utils.js.jinja2 +4 -4
- reflex/.templates/jinja/web/utils/context.js.jinja2 +1 -1
- reflex/.templates/jinja/web/utils/theme.js.jinja2 +1 -1
- reflex/__init__.py +3 -2
- reflex/__init__.pyi +2 -2
- reflex/app.py +43 -9
- reflex/base.py +3 -2
- reflex/compiler/compiler.py +6 -6
- reflex/compiler/utils.py +5 -3
- reflex/components/base/app_wrap.py +2 -4
- reflex/components/base/app_wrap.pyi +17 -17
- reflex/components/base/bare.py +7 -4
- reflex/components/base/body.pyi +17 -17
- reflex/components/base/document.pyi +81 -81
- reflex/components/base/error_boundary.py +10 -8
- reflex/components/base/error_boundary.pyi +20 -19
- reflex/components/base/fragment.pyi +17 -17
- reflex/components/base/head.pyi +33 -33
- reflex/components/base/link.pyi +34 -33
- reflex/components/base/meta.pyi +65 -65
- reflex/components/base/script.py +2 -1
- reflex/components/base/script.pyi +21 -20
- reflex/components/component.py +116 -145
- reflex/components/core/banner.py +59 -60
- reflex/components/core/banner.pyi +86 -150
- reflex/components/core/client_side_routing.py +2 -1
- reflex/components/core/client_side_routing.pyi +34 -33
- reflex/components/core/clipboard.py +2 -2
- reflex/components/core/clipboard.pyi +19 -18
- reflex/components/core/cond.py +21 -44
- reflex/components/core/debounce.py +6 -8
- reflex/components/core/debounce.pyi +19 -18
- reflex/components/core/foreach.py +5 -14
- reflex/components/core/html.pyi +18 -17
- reflex/components/core/match.py +36 -43
- reflex/components/core/upload.py +32 -25
- reflex/components/core/upload.pyi +84 -73
- reflex/components/datadisplay/code.py +55 -28
- reflex/components/datadisplay/code.pyi +20 -17
- reflex/components/datadisplay/dataeditor.py +17 -11
- reflex/components/datadisplay/dataeditor.pyi +34 -33
- reflex/components/el/__init__.py +0 -1
- reflex/components/el/__init__.pyi +0 -11
- reflex/components/el/element.pyi +17 -17
- reflex/components/el/elements/__init__.py +1 -7
- reflex/components/el/elements/__init__.pyi +1 -15
- reflex/components/el/elements/base.pyi +18 -17
- reflex/components/el/elements/forms.py +24 -31
- reflex/components/el/elements/forms.pyi +237 -236
- reflex/components/el/elements/inline.pyi +450 -449
- reflex/components/el/elements/media.py +0 -21
- reflex/components/el/elements/media.pyi +338 -337
- reflex/components/el/elements/metadata.py +3 -2
- reflex/components/el/elements/metadata.pyi +98 -97
- reflex/components/el/elements/other.pyi +114 -113
- reflex/components/el/elements/scripts.pyi +50 -49
- reflex/components/el/elements/sectioning.pyi +242 -241
- reflex/components/el/elements/tables.pyi +162 -161
- reflex/components/el/elements/typography.pyi +242 -241
- reflex/components/gridjs/datatable.py +13 -14
- reflex/components/gridjs/datatable.pyi +34 -33
- reflex/components/lucide/icon.py +2 -126
- reflex/components/lucide/icon.pyi +34 -142
- reflex/components/markdown/markdown.py +30 -35
- reflex/components/markdown/markdown.pyi +29 -32
- reflex/components/moment/moment.pyi +19 -18
- reflex/components/next/base.pyi +17 -17
- reflex/components/next/image.py +0 -4
- reflex/components/next/image.pyi +20 -19
- reflex/components/next/link.pyi +18 -17
- reflex/components/next/video.pyi +18 -17
- reflex/components/plotly/plotly.py +16 -28
- reflex/components/plotly/plotly.pyi +36 -35
- reflex/components/props.py +21 -10
- reflex/components/radix/__init__.pyi +1 -1
- reflex/components/radix/primitives/__init__.pyi +0 -1
- reflex/components/radix/primitives/accordion.py +7 -8
- reflex/components/radix/primitives/accordion.pyi +117 -116
- reflex/components/radix/primitives/base.pyi +34 -33
- reflex/components/radix/primitives/drawer.pyi +169 -168
- reflex/components/radix/primitives/form.pyi +168 -167
- reflex/components/radix/primitives/progress.pyi +82 -81
- reflex/components/radix/primitives/slider.pyi +84 -83
- reflex/components/radix/themes/base.py +8 -4
- reflex/components/radix/themes/base.pyi +114 -113
- reflex/components/radix/themes/color_mode.py +12 -21
- reflex/components/radix/themes/color_mode.pyi +67 -67
- reflex/components/radix/themes/components/__init__.pyi +1 -0
- reflex/components/radix/themes/components/alert_dialog.pyi +118 -117
- reflex/components/radix/themes/components/aspect_ratio.pyi +18 -17
- reflex/components/radix/themes/components/avatar.pyi +18 -17
- reflex/components/radix/themes/components/badge.pyi +18 -17
- reflex/components/radix/themes/components/button.pyi +18 -17
- reflex/components/radix/themes/components/callout.pyi +82 -81
- reflex/components/radix/themes/components/card.pyi +18 -17
- reflex/components/radix/themes/components/checkbox.py +2 -3
- reflex/components/radix/themes/components/checkbox.pyi +53 -52
- reflex/components/radix/themes/components/checkbox_cards.pyi +34 -33
- reflex/components/radix/themes/components/checkbox_group.pyi +34 -33
- reflex/components/radix/themes/components/context_menu.pyi +140 -139
- reflex/components/radix/themes/components/data_list.py +5 -0
- reflex/components/radix/themes/components/data_list.pyi +71 -65
- reflex/components/radix/themes/components/dialog.pyi +121 -120
- reflex/components/radix/themes/components/dropdown_menu.pyi +142 -141
- reflex/components/radix/themes/components/hover_card.pyi +68 -67
- reflex/components/radix/themes/components/icon_button.py +2 -1
- reflex/components/radix/themes/components/icon_button.pyi +18 -17
- reflex/components/radix/themes/components/inset.pyi +18 -17
- reflex/components/radix/themes/components/popover.pyi +73 -72
- reflex/components/radix/themes/components/progress.pyi +18 -17
- reflex/components/radix/themes/components/radio.pyi +18 -17
- reflex/components/radix/themes/components/radio_cards.pyi +35 -34
- reflex/components/radix/themes/components/radio_group.py +35 -31
- reflex/components/radix/themes/components/radio_group.pyi +73 -66
- reflex/components/radix/themes/components/scroll_area.pyi +18 -17
- reflex/components/radix/themes/components/segmented_control.pyi +35 -34
- reflex/components/radix/themes/components/select.py +2 -1
- reflex/components/radix/themes/components/select.pyi +155 -154
- reflex/components/radix/themes/components/separator.py +2 -3
- reflex/components/radix/themes/components/separator.pyi +18 -17
- reflex/components/radix/themes/components/skeleton.pyi +18 -17
- reflex/components/radix/themes/components/slider.py +2 -1
- reflex/components/radix/themes/components/slider.pyi +20 -19
- reflex/components/radix/themes/components/spinner.pyi +18 -17
- reflex/components/radix/themes/components/switch.pyi +19 -18
- reflex/components/radix/themes/components/table.pyi +114 -113
- reflex/components/radix/themes/components/tabs.pyi +84 -83
- reflex/components/radix/themes/components/text_area.pyi +21 -20
- reflex/components/radix/themes/components/text_field.py +0 -79
- reflex/components/radix/themes/components/text_field.pyi +57 -63
- reflex/components/radix/themes/components/tooltip.pyi +21 -20
- reflex/components/radix/themes/layout/base.pyi +18 -17
- reflex/components/radix/themes/layout/box.pyi +18 -17
- reflex/components/radix/themes/layout/center.pyi +18 -17
- reflex/components/radix/themes/layout/container.py +2 -3
- reflex/components/radix/themes/layout/container.pyi +18 -17
- reflex/components/radix/themes/layout/flex.pyi +18 -17
- reflex/components/radix/themes/layout/grid.pyi +18 -17
- reflex/components/radix/themes/layout/list.py +5 -4
- reflex/components/radix/themes/layout/list.pyi +86 -85
- reflex/components/radix/themes/layout/section.py +2 -3
- reflex/components/radix/themes/layout/section.pyi +18 -17
- reflex/components/radix/themes/layout/spacer.pyi +18 -17
- reflex/components/radix/themes/layout/stack.pyi +50 -49
- reflex/components/radix/themes/typography/blockquote.pyi +18 -17
- reflex/components/radix/themes/typography/code.pyi +18 -17
- reflex/components/radix/themes/typography/heading.pyi +18 -17
- reflex/components/radix/themes/typography/link.pyi +18 -17
- reflex/components/radix/themes/typography/text.pyi +114 -113
- reflex/components/react_player/audio.pyi +34 -33
- reflex/components/react_player/react_player.pyi +34 -33
- reflex/components/react_player/video.pyi +34 -33
- reflex/components/recharts/cartesian.py +23 -19
- reflex/components/recharts/cartesian.pyi +297 -296
- reflex/components/recharts/charts.py +6 -5
- reflex/components/recharts/charts.pyi +179 -178
- reflex/components/recharts/general.py +8 -7
- reflex/components/recharts/general.pyi +82 -81
- reflex/components/recharts/polar.py +14 -13
- reflex/components/recharts/polar.pyi +76 -75
- reflex/components/recharts/recharts.pyi +33 -33
- reflex/components/sonner/toast.py +30 -33
- reflex/components/sonner/toast.pyi +27 -25
- reflex/components/suneditor/editor.py +2 -1
- reflex/components/suneditor/editor.pyi +27 -26
- reflex/components/tags/iter_tag.py +16 -16
- reflex/components/tags/tag.py +8 -10
- reflex/constants/base.py +3 -1
- reflex/constants/event.py +1 -0
- reflex/event.py +89 -79
- reflex/experimental/__init__.py +25 -6
- reflex/experimental/client_state.py +34 -58
- reflex/experimental/hooks.py +13 -18
- reflex/experimental/layout.py +5 -5
- reflex/experimental/layout.pyi +84 -83
- reflex/{experimental/vars → ivars}/__init__.py +0 -1
- reflex/ivars/base.py +2180 -0
- reflex/ivars/function.py +200 -0
- reflex/ivars/number.py +1137 -0
- reflex/ivars/object.py +564 -0
- reflex/ivars/sequence.py +1601 -0
- reflex/model.py +22 -0
- reflex/reflex.py +4 -0
- reflex/state.py +388 -73
- reflex/style.py +52 -34
- reflex/testing.py +8 -3
- reflex/utils/exceptions.py +12 -0
- reflex/utils/exec.py +0 -14
- reflex/utils/format.py +74 -223
- reflex/utils/net.py +43 -0
- reflex/utils/path_ops.py +13 -1
- reflex/utils/prerequisites.py +46 -26
- reflex/utils/pyi_generator.py +5 -4
- reflex/utils/serializers.py +13 -31
- reflex/utils/types.py +44 -9
- reflex/vars.py +127 -2230
- {reflex-0.5.10a3.dist-info → reflex-0.6.0a1.dist-info}/METADATA +4 -6
- reflex-0.6.0a1.dist-info/RECORD +384 -0
- reflex/.templates/apps/demo/.gitignore +0 -4
- reflex/.templates/apps/demo/assets/favicon.ico +0 -0
- reflex/.templates/apps/demo/assets/github.svg +0 -10
- reflex/.templates/apps/demo/assets/icon.svg +0 -37
- reflex/.templates/apps/demo/assets/logo.svg +0 -68
- reflex/.templates/apps/demo/assets/paneleft.svg +0 -13
- reflex/.templates/apps/demo/code/__init__.py +0 -1
- reflex/.templates/apps/demo/code/demo.py +0 -127
- reflex/.templates/apps/demo/code/pages/__init__.py +0 -7
- reflex/.templates/apps/demo/code/pages/chatapp.py +0 -31
- reflex/.templates/apps/demo/code/pages/datatable.py +0 -360
- reflex/.templates/apps/demo/code/pages/forms.py +0 -257
- reflex/.templates/apps/demo/code/pages/graphing.py +0 -253
- reflex/.templates/apps/demo/code/pages/home.py +0 -56
- reflex/.templates/apps/demo/code/sidebar.py +0 -178
- reflex/.templates/apps/demo/code/state.py +0 -22
- reflex/.templates/apps/demo/code/states/form_state.py +0 -40
- reflex/.templates/apps/demo/code/states/pie_state.py +0 -47
- reflex/.templates/apps/demo/code/styles.py +0 -68
- reflex/.templates/apps/demo/code/webui/__init__.py +0 -0
- reflex/.templates/apps/demo/code/webui/components/__init__.py +0 -4
- reflex/.templates/apps/demo/code/webui/components/chat.py +0 -118
- reflex/.templates/apps/demo/code/webui/components/loading_icon.py +0 -19
- reflex/.templates/apps/demo/code/webui/components/modal.py +0 -56
- reflex/.templates/apps/demo/code/webui/components/navbar.py +0 -70
- reflex/.templates/apps/demo/code/webui/components/sidebar.py +0 -66
- reflex/.templates/apps/demo/code/webui/state.py +0 -146
- reflex/.templates/apps/demo/code/webui/styles.py +0 -88
- reflex/experimental/vars/base.py +0 -583
- reflex/experimental/vars/function.py +0 -290
- reflex/experimental/vars/number.py +0 -1458
- reflex/experimental/vars/object.py +0 -804
- reflex/experimental/vars/sequence.py +0 -1764
- reflex/utils/watch.py +0 -96
- reflex/vars.pyi +0 -218
- reflex-0.5.10a3.dist-info/RECORD +0 -413
- {reflex-0.5.10a3.dist-info → reflex-0.6.0a1.dist-info}/LICENSE +0 -0
- {reflex-0.5.10a3.dist-info → reflex-0.6.0a1.dist-info}/WHEEL +0 -0
- {reflex-0.5.10a3.dist-info → reflex-0.6.0a1.dist-info}/entry_points.txt +0 -0
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
"""The settings page for the template."""
|
|
2
|
-
|
|
3
|
-
import reflex as rx
|
|
4
|
-
|
|
5
|
-
from ..states.form_state import FormState, UploadState
|
|
6
|
-
from ..styles import *
|
|
7
|
-
|
|
8
|
-
forms_1_code = """rx.chakra.vstack(
|
|
9
|
-
rx.chakra.form(
|
|
10
|
-
rx.chakra.vstack(
|
|
11
|
-
rx.chakra.input(
|
|
12
|
-
placeholder="First Name",
|
|
13
|
-
id="first_name",
|
|
14
|
-
),
|
|
15
|
-
rx.chakra.input(
|
|
16
|
-
placeholder="Last Name", id="last_name"
|
|
17
|
-
),
|
|
18
|
-
rx.chakra.hstack(
|
|
19
|
-
rx.chakra.checkbox("Checked", id="check"),
|
|
20
|
-
rx.chakra.switch("Switched", id="switch"),
|
|
21
|
-
),
|
|
22
|
-
rx.chakra.button("Submit",
|
|
23
|
-
type_="submit",
|
|
24
|
-
bg="#ecfdf5",
|
|
25
|
-
color="#047857",
|
|
26
|
-
border_radius="lg",
|
|
27
|
-
),
|
|
28
|
-
),
|
|
29
|
-
on_submit=FormState.handle_submit,
|
|
30
|
-
),
|
|
31
|
-
rx.chakra.divider(),
|
|
32
|
-
rx.chakra.heading("Results"),
|
|
33
|
-
rx.chakra.text(FormState.form_data.to_string()),
|
|
34
|
-
width="100%",
|
|
35
|
-
)"""
|
|
36
|
-
|
|
37
|
-
color = "rgb(107,99,246)"
|
|
38
|
-
|
|
39
|
-
forms_1_state = """class FormState(rx.State):
|
|
40
|
-
|
|
41
|
-
form_data: dict = {}
|
|
42
|
-
|
|
43
|
-
def handle_submit(self, form_data: dict):
|
|
44
|
-
"Handle the form submit."
|
|
45
|
-
self.form_data = form_data"""
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
forms_2_code = """rx.chakra.vstack(
|
|
49
|
-
rx.upload(
|
|
50
|
-
rx.chakra.vstack(
|
|
51
|
-
rx.chakra.button(
|
|
52
|
-
"Select File",
|
|
53
|
-
color=color,
|
|
54
|
-
bg="white",
|
|
55
|
-
border=f"1px solid {color}",
|
|
56
|
-
),
|
|
57
|
-
rx.chakra.text(
|
|
58
|
-
"Drag and drop files here or click to select files"
|
|
59
|
-
),
|
|
60
|
-
),
|
|
61
|
-
border=f"1px dotted {color}",
|
|
62
|
-
padding="5em",
|
|
63
|
-
),
|
|
64
|
-
rx.chakra.hstack(rx.foreach(rx.selected_files, rx.chakra.text)),
|
|
65
|
-
rx.chakra.button(
|
|
66
|
-
"Upload",
|
|
67
|
-
on_click=lambda: UploadState.handle_upload(
|
|
68
|
-
rx.upload_files()
|
|
69
|
-
),
|
|
70
|
-
),
|
|
71
|
-
rx.chakra.button(
|
|
72
|
-
"Clear",
|
|
73
|
-
on_click=rx.clear_selected_files,
|
|
74
|
-
),
|
|
75
|
-
rx.foreach(
|
|
76
|
-
UploadState.img, lambda img: rx.chakra.image(src=img, width="20%", height="auto",)
|
|
77
|
-
),
|
|
78
|
-
padding="5em",
|
|
79
|
-
width="100%",
|
|
80
|
-
)"""
|
|
81
|
-
|
|
82
|
-
forms_2_state = """class UploadState(State):
|
|
83
|
-
"The app state."
|
|
84
|
-
|
|
85
|
-
# The images to show.
|
|
86
|
-
img: list[str]
|
|
87
|
-
|
|
88
|
-
async def handle_upload(
|
|
89
|
-
self, files: list[rx.UploadFile]
|
|
90
|
-
):
|
|
91
|
-
"Handle the upload of file(s).
|
|
92
|
-
|
|
93
|
-
Args:
|
|
94
|
-
files: The uploaded files.
|
|
95
|
-
"
|
|
96
|
-
for file in files:
|
|
97
|
-
upload_data = await file.read()
|
|
98
|
-
outfile = rx.get_asset_path(file.filename)
|
|
99
|
-
# Save the file.
|
|
100
|
-
with open(outfile, "wb") as file_object:
|
|
101
|
-
file_object.write(upload_data)
|
|
102
|
-
|
|
103
|
-
# Update the img var.
|
|
104
|
-
self.img.append(f"/{file.filename}")"""
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
def forms_page() -> rx.Component:
|
|
108
|
-
"""The UI for the settings page.
|
|
109
|
-
|
|
110
|
-
Returns:
|
|
111
|
-
rx.Component: The UI for the settings page.
|
|
112
|
-
"""
|
|
113
|
-
return rx.chakra.box(
|
|
114
|
-
rx.chakra.vstack(
|
|
115
|
-
rx.chakra.heading(
|
|
116
|
-
"Forms Demo",
|
|
117
|
-
font_size="3em",
|
|
118
|
-
),
|
|
119
|
-
rx.chakra.vstack(
|
|
120
|
-
rx.chakra.form(
|
|
121
|
-
rx.chakra.vstack(
|
|
122
|
-
rx.chakra.input(
|
|
123
|
-
placeholder="First Name",
|
|
124
|
-
id="first_name",
|
|
125
|
-
),
|
|
126
|
-
rx.chakra.input(placeholder="Last Name", id="last_name"),
|
|
127
|
-
rx.chakra.hstack(
|
|
128
|
-
rx.chakra.checkbox("Checked", id="check"),
|
|
129
|
-
rx.chakra.switch("Switched", id="switch"),
|
|
130
|
-
),
|
|
131
|
-
rx.chakra.button(
|
|
132
|
-
"Submit",
|
|
133
|
-
type_="submit",
|
|
134
|
-
bg="#ecfdf5",
|
|
135
|
-
color="#047857",
|
|
136
|
-
border_radius="lg",
|
|
137
|
-
),
|
|
138
|
-
),
|
|
139
|
-
on_submit=FormState.handle_submit,
|
|
140
|
-
),
|
|
141
|
-
rx.chakra.divider(),
|
|
142
|
-
rx.chakra.heading("Results"),
|
|
143
|
-
rx.chakra.text(FormState.form_data.to_string()),
|
|
144
|
-
width="100%",
|
|
145
|
-
),
|
|
146
|
-
rx.chakra.tabs(
|
|
147
|
-
rx.chakra.tab_list(
|
|
148
|
-
rx.chakra.tab("Code", style=tab_style),
|
|
149
|
-
rx.chakra.tab("State", style=tab_style),
|
|
150
|
-
padding_x=0,
|
|
151
|
-
),
|
|
152
|
-
rx.chakra.tab_panels(
|
|
153
|
-
rx.chakra.tab_panel(
|
|
154
|
-
rx.code_block(
|
|
155
|
-
forms_1_code,
|
|
156
|
-
language="python",
|
|
157
|
-
show_line_numbers=True,
|
|
158
|
-
),
|
|
159
|
-
width="100%",
|
|
160
|
-
padding_x=0,
|
|
161
|
-
padding_y=".25em",
|
|
162
|
-
),
|
|
163
|
-
rx.chakra.tab_panel(
|
|
164
|
-
rx.code_block(
|
|
165
|
-
forms_1_state,
|
|
166
|
-
language="python",
|
|
167
|
-
show_line_numbers=True,
|
|
168
|
-
),
|
|
169
|
-
width="100%",
|
|
170
|
-
padding_x=0,
|
|
171
|
-
padding_y=".25em",
|
|
172
|
-
),
|
|
173
|
-
width="100%",
|
|
174
|
-
),
|
|
175
|
-
variant="unstyled",
|
|
176
|
-
color_scheme="purple",
|
|
177
|
-
align="end",
|
|
178
|
-
width="100%",
|
|
179
|
-
padding_top=".5em",
|
|
180
|
-
),
|
|
181
|
-
rx.chakra.heading("Upload Example", font_size="3em"),
|
|
182
|
-
rx.chakra.text("Try uploading some images and see how they look."),
|
|
183
|
-
rx.chakra.vstack(
|
|
184
|
-
rx.upload(
|
|
185
|
-
rx.chakra.vstack(
|
|
186
|
-
rx.chakra.button(
|
|
187
|
-
"Select File",
|
|
188
|
-
color=color,
|
|
189
|
-
bg="white",
|
|
190
|
-
border=f"1px solid {color}",
|
|
191
|
-
),
|
|
192
|
-
rx.chakra.text(
|
|
193
|
-
"Drag and drop files here or click to select files"
|
|
194
|
-
),
|
|
195
|
-
),
|
|
196
|
-
border=f"1px dotted {color}",
|
|
197
|
-
padding="5em",
|
|
198
|
-
),
|
|
199
|
-
rx.chakra.hstack(rx.foreach(rx.selected_files, rx.chakra.text)),
|
|
200
|
-
rx.chakra.button(
|
|
201
|
-
"Upload",
|
|
202
|
-
on_click=lambda: UploadState.handle_upload(rx.upload_files()),
|
|
203
|
-
),
|
|
204
|
-
rx.chakra.button(
|
|
205
|
-
"Clear",
|
|
206
|
-
on_click=rx.clear_selected_files,
|
|
207
|
-
),
|
|
208
|
-
rx.foreach(
|
|
209
|
-
UploadState.img,
|
|
210
|
-
lambda img: rx.chakra.image(
|
|
211
|
-
src=img,
|
|
212
|
-
width="20%",
|
|
213
|
-
height="auto",
|
|
214
|
-
),
|
|
215
|
-
),
|
|
216
|
-
padding="5em",
|
|
217
|
-
width="100%",
|
|
218
|
-
),
|
|
219
|
-
rx.chakra.tabs(
|
|
220
|
-
rx.chakra.tab_list(
|
|
221
|
-
rx.chakra.tab("Code", style=tab_style),
|
|
222
|
-
rx.chakra.tab("State", style=tab_style),
|
|
223
|
-
padding_x=0,
|
|
224
|
-
),
|
|
225
|
-
rx.chakra.tab_panels(
|
|
226
|
-
rx.chakra.tab_panel(
|
|
227
|
-
rx.code_block(
|
|
228
|
-
forms_2_code,
|
|
229
|
-
language="python",
|
|
230
|
-
show_line_numbers=True,
|
|
231
|
-
),
|
|
232
|
-
width="100%",
|
|
233
|
-
padding_x=0,
|
|
234
|
-
padding_y=".25em",
|
|
235
|
-
),
|
|
236
|
-
rx.chakra.tab_panel(
|
|
237
|
-
rx.code_block(
|
|
238
|
-
forms_2_state,
|
|
239
|
-
language="python",
|
|
240
|
-
show_line_numbers=True,
|
|
241
|
-
),
|
|
242
|
-
width="100%",
|
|
243
|
-
padding_x=0,
|
|
244
|
-
padding_y=".25em",
|
|
245
|
-
),
|
|
246
|
-
width="100%",
|
|
247
|
-
),
|
|
248
|
-
variant="unstyled",
|
|
249
|
-
color_scheme="purple",
|
|
250
|
-
align="end",
|
|
251
|
-
width="100%",
|
|
252
|
-
padding_top=".5em",
|
|
253
|
-
),
|
|
254
|
-
style=template_content_style,
|
|
255
|
-
),
|
|
256
|
-
style=template_page_style,
|
|
257
|
-
)
|
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
"""The dashboard page for the template."""
|
|
2
|
-
|
|
3
|
-
import reflex as rx
|
|
4
|
-
|
|
5
|
-
from ..states.pie_state import PieChartState
|
|
6
|
-
from ..styles import *
|
|
7
|
-
|
|
8
|
-
data_1 = [
|
|
9
|
-
{"name": "Page A", "uv": 4000, "pv": 2400, "amt": 2400},
|
|
10
|
-
{"name": "Page B", "uv": 3000, "pv": 1398, "amt": 2210},
|
|
11
|
-
{"name": "Page C", "uv": 2000, "pv": 9800, "amt": 2290},
|
|
12
|
-
{"name": "Page D", "uv": 2780, "pv": 3908, "amt": 2000},
|
|
13
|
-
{"name": "Page E", "uv": 1890, "pv": 4800, "amt": 2181},
|
|
14
|
-
{"name": "Page F", "uv": 2390, "pv": 3800, "amt": 2500},
|
|
15
|
-
{"name": "Page G", "uv": 3490, "pv": 4300, "amt": 2100},
|
|
16
|
-
]
|
|
17
|
-
data_1_show = """[
|
|
18
|
-
{"name": "Page A", "uv": 4000, "pv": 2400, "amt": 2400},
|
|
19
|
-
{"name": "Page B", "uv": 3000, "pv": 1398, "amt": 2210},
|
|
20
|
-
{"name": "Page C", "uv": 2000, "pv": 9800, "amt": 2290},
|
|
21
|
-
{"name": "Page D", "uv": 2780, "pv": 3908, "amt": 2000},
|
|
22
|
-
{"name": "Page E", "uv": 1890, "pv": 4800, "amt": 2181},
|
|
23
|
-
{"name": "Page F", "uv": 2390, "pv": 3800, "amt": 2500},
|
|
24
|
-
{"name": "Page G", "uv": 3490, "pv": 4300, "amt": 2100},
|
|
25
|
-
]"""
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
graph_1_code = """rx.recharts.composed_chart(
|
|
29
|
-
rx.recharts.area(
|
|
30
|
-
data_key="uv", stroke="#8884d8", fill="#8884d8"
|
|
31
|
-
),
|
|
32
|
-
rx.recharts.bar(
|
|
33
|
-
data_key="amt", bar_size=20, fill="#413ea0"
|
|
34
|
-
),
|
|
35
|
-
rx.recharts.line(
|
|
36
|
-
data_key="pv", type_="monotone", stroke="#ff7300"
|
|
37
|
-
),
|
|
38
|
-
rx.recharts.x_axis(data_key="name"),
|
|
39
|
-
rx.recharts.y_axis(),
|
|
40
|
-
rx.recharts.cartesian_grid(stroke_dasharray="3 3"),
|
|
41
|
-
rx.recharts.graphing_tooltip(),
|
|
42
|
-
data=data,
|
|
43
|
-
)"""
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
graph_2_code = """rx.recharts.pie_chart(
|
|
47
|
-
rx.recharts.pie(
|
|
48
|
-
data=PieChartState.resources,
|
|
49
|
-
data_key="count",
|
|
50
|
-
name_key="type_",
|
|
51
|
-
cx="50%",
|
|
52
|
-
cy="50%",
|
|
53
|
-
start_angle=180,
|
|
54
|
-
end_angle=0,
|
|
55
|
-
fill="#8884d8",
|
|
56
|
-
label=True,
|
|
57
|
-
),
|
|
58
|
-
rx.recharts.graphing_tooltip(),
|
|
59
|
-
),
|
|
60
|
-
rx.chakra.vstack(
|
|
61
|
-
rx.foreach(
|
|
62
|
-
PieChartState.resource_types,
|
|
63
|
-
lambda type_, i: rx.chakra.hstack(
|
|
64
|
-
rx.chakra.button(
|
|
65
|
-
"-",
|
|
66
|
-
on_click=PieChartState.decrement(type_),
|
|
67
|
-
),
|
|
68
|
-
rx.chakra.text(
|
|
69
|
-
type_,
|
|
70
|
-
PieChartState.resources[i]["count"],
|
|
71
|
-
),
|
|
72
|
-
rx.chakra.button(
|
|
73
|
-
"+",
|
|
74
|
-
on_click=PieChartState.increment(type_),
|
|
75
|
-
),
|
|
76
|
-
),
|
|
77
|
-
),
|
|
78
|
-
)"""
|
|
79
|
-
|
|
80
|
-
graph_2_state = """class PieChartState(rx.State):
|
|
81
|
-
resources: list[dict[str, Any]] = [
|
|
82
|
-
dict(type_="🏆", count=1),
|
|
83
|
-
dict(type_="🪵", count=1),
|
|
84
|
-
dict(type_="🥑", count=1),
|
|
85
|
-
dict(type_="🧱", count=1),
|
|
86
|
-
]
|
|
87
|
-
|
|
88
|
-
@rx.cached_var
|
|
89
|
-
def resource_types(self) -> list[str]:
|
|
90
|
-
return [r["type_"] for r in self.resources]
|
|
91
|
-
|
|
92
|
-
def increment(self, type_: str):
|
|
93
|
-
for resource in self.resources:
|
|
94
|
-
if resource["type_"] == type_:
|
|
95
|
-
resource["count"] += 1
|
|
96
|
-
break
|
|
97
|
-
|
|
98
|
-
def decrement(self, type_: str):
|
|
99
|
-
for resource in self.resources:
|
|
100
|
-
if (
|
|
101
|
-
resource["type_"] == type_
|
|
102
|
-
and resource["count"] > 0
|
|
103
|
-
):
|
|
104
|
-
resource["count"] -= 1
|
|
105
|
-
break
|
|
106
|
-
"""
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
def graphing_page() -> rx.Component:
|
|
110
|
-
"""The UI for the dashboard page.
|
|
111
|
-
|
|
112
|
-
Returns:
|
|
113
|
-
rx.Component: The UI for the dashboard page.
|
|
114
|
-
"""
|
|
115
|
-
return rx.chakra.box(
|
|
116
|
-
rx.chakra.vstack(
|
|
117
|
-
rx.chakra.heading(
|
|
118
|
-
"Graphing Demo",
|
|
119
|
-
font_size="3em",
|
|
120
|
-
),
|
|
121
|
-
rx.chakra.heading(
|
|
122
|
-
"Composed Chart",
|
|
123
|
-
font_size="2em",
|
|
124
|
-
),
|
|
125
|
-
rx.chakra.stack(
|
|
126
|
-
rx.recharts.composed_chart(
|
|
127
|
-
rx.recharts.area(data_key="uv", stroke="#8884d8", fill="#8884d8"),
|
|
128
|
-
rx.recharts.bar(data_key="amt", bar_size=20, fill="#413ea0"),
|
|
129
|
-
rx.recharts.line(data_key="pv", type_="monotone", stroke="#ff7300"),
|
|
130
|
-
rx.recharts.x_axis(data_key="name"),
|
|
131
|
-
rx.recharts.y_axis(),
|
|
132
|
-
rx.recharts.cartesian_grid(stroke_dasharray="3 3"),
|
|
133
|
-
rx.recharts.graphing_tooltip(),
|
|
134
|
-
data=data_1,
|
|
135
|
-
# height="15em",
|
|
136
|
-
),
|
|
137
|
-
width="100%",
|
|
138
|
-
height="20em",
|
|
139
|
-
),
|
|
140
|
-
rx.chakra.tabs(
|
|
141
|
-
rx.chakra.tab_list(
|
|
142
|
-
rx.chakra.tab("Code", style=tab_style),
|
|
143
|
-
rx.chakra.tab("Data", style=tab_style),
|
|
144
|
-
padding_x=0,
|
|
145
|
-
),
|
|
146
|
-
rx.chakra.tab_panels(
|
|
147
|
-
rx.chakra.tab_panel(
|
|
148
|
-
rx.code_block(
|
|
149
|
-
graph_1_code,
|
|
150
|
-
language="python",
|
|
151
|
-
show_line_numbers=True,
|
|
152
|
-
),
|
|
153
|
-
width="100%",
|
|
154
|
-
padding_x=0,
|
|
155
|
-
padding_y=".25em",
|
|
156
|
-
),
|
|
157
|
-
rx.chakra.tab_panel(
|
|
158
|
-
rx.code_block(
|
|
159
|
-
data_1_show,
|
|
160
|
-
language="python",
|
|
161
|
-
show_line_numbers=True,
|
|
162
|
-
),
|
|
163
|
-
width="100%",
|
|
164
|
-
padding_x=0,
|
|
165
|
-
padding_y=".25em",
|
|
166
|
-
),
|
|
167
|
-
width="100%",
|
|
168
|
-
),
|
|
169
|
-
variant="unstyled",
|
|
170
|
-
color_scheme="purple",
|
|
171
|
-
align="end",
|
|
172
|
-
width="100%",
|
|
173
|
-
padding_top=".5em",
|
|
174
|
-
),
|
|
175
|
-
rx.chakra.heading("Interactive Example", font_size="2em"),
|
|
176
|
-
rx.chakra.hstack(
|
|
177
|
-
rx.recharts.pie_chart(
|
|
178
|
-
rx.recharts.pie(
|
|
179
|
-
data=PieChartState.resources,
|
|
180
|
-
data_key="count",
|
|
181
|
-
name_key="type_",
|
|
182
|
-
cx="50%",
|
|
183
|
-
cy="50%",
|
|
184
|
-
start_angle=180,
|
|
185
|
-
end_angle=0,
|
|
186
|
-
fill="#8884d8",
|
|
187
|
-
label=True,
|
|
188
|
-
),
|
|
189
|
-
rx.recharts.graphing_tooltip(),
|
|
190
|
-
),
|
|
191
|
-
rx.chakra.vstack(
|
|
192
|
-
rx.foreach(
|
|
193
|
-
PieChartState.resource_types,
|
|
194
|
-
lambda type_, i: rx.chakra.hstack(
|
|
195
|
-
rx.chakra.button(
|
|
196
|
-
"-",
|
|
197
|
-
on_click=PieChartState.decrement(type_),
|
|
198
|
-
),
|
|
199
|
-
rx.chakra.text(
|
|
200
|
-
type_,
|
|
201
|
-
PieChartState.resources[i]["count"],
|
|
202
|
-
),
|
|
203
|
-
rx.chakra.button(
|
|
204
|
-
"+",
|
|
205
|
-
on_click=PieChartState.increment(type_),
|
|
206
|
-
),
|
|
207
|
-
),
|
|
208
|
-
),
|
|
209
|
-
),
|
|
210
|
-
width="100%",
|
|
211
|
-
height="15em",
|
|
212
|
-
),
|
|
213
|
-
rx.chakra.tabs(
|
|
214
|
-
rx.chakra.tab_list(
|
|
215
|
-
rx.chakra.tab("Code", style=tab_style),
|
|
216
|
-
rx.chakra.tab("State", style=tab_style),
|
|
217
|
-
padding_x=0,
|
|
218
|
-
),
|
|
219
|
-
rx.chakra.tab_panels(
|
|
220
|
-
rx.chakra.tab_panel(
|
|
221
|
-
rx.code_block(
|
|
222
|
-
graph_2_code,
|
|
223
|
-
language="python",
|
|
224
|
-
show_line_numbers=True,
|
|
225
|
-
),
|
|
226
|
-
width="100%",
|
|
227
|
-
padding_x=0,
|
|
228
|
-
padding_y=".25em",
|
|
229
|
-
),
|
|
230
|
-
rx.chakra.tab_panel(
|
|
231
|
-
rx.code_block(
|
|
232
|
-
graph_2_state,
|
|
233
|
-
language="python",
|
|
234
|
-
show_line_numbers=True,
|
|
235
|
-
),
|
|
236
|
-
width="100%",
|
|
237
|
-
padding_x=0,
|
|
238
|
-
padding_y=".25em",
|
|
239
|
-
),
|
|
240
|
-
width="100%",
|
|
241
|
-
),
|
|
242
|
-
variant="unstyled",
|
|
243
|
-
color_scheme="purple",
|
|
244
|
-
align="end",
|
|
245
|
-
width="100%",
|
|
246
|
-
padding_top=".5em",
|
|
247
|
-
),
|
|
248
|
-
style=template_content_style,
|
|
249
|
-
min_h="100vh",
|
|
250
|
-
),
|
|
251
|
-
style=template_page_style,
|
|
252
|
-
min_h="100vh",
|
|
253
|
-
)
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"""The home page of the app."""
|
|
2
|
-
|
|
3
|
-
import reflex as rx
|
|
4
|
-
|
|
5
|
-
from ..styles import *
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def home_page() -> rx.Component:
|
|
9
|
-
"""The UI for the home page.
|
|
10
|
-
|
|
11
|
-
Returns:
|
|
12
|
-
rx.Component: The UI for the home page.
|
|
13
|
-
"""
|
|
14
|
-
return rx.chakra.box(
|
|
15
|
-
rx.chakra.vstack(
|
|
16
|
-
rx.chakra.heading(
|
|
17
|
-
"Welcome to Reflex! 👋",
|
|
18
|
-
font_size="3em",
|
|
19
|
-
),
|
|
20
|
-
rx.chakra.text(
|
|
21
|
-
"Reflex is an open-source app framework built specifically to allow you to build web apps in pure python. 👈 Select a demo from the sidebar to see some examples of what Reflex can do!",
|
|
22
|
-
),
|
|
23
|
-
rx.chakra.heading(
|
|
24
|
-
"Things to check out:",
|
|
25
|
-
font_size="2em",
|
|
26
|
-
),
|
|
27
|
-
rx.chakra.unordered_list(
|
|
28
|
-
rx.chakra.list_item(
|
|
29
|
-
"Take a look at ",
|
|
30
|
-
rx.chakra.link(
|
|
31
|
-
"reflex.dev",
|
|
32
|
-
href="https://reflex.dev",
|
|
33
|
-
color="rgb(107,99,246)",
|
|
34
|
-
),
|
|
35
|
-
),
|
|
36
|
-
rx.chakra.list_item(
|
|
37
|
-
"Check out our ",
|
|
38
|
-
rx.chakra.link(
|
|
39
|
-
"docs",
|
|
40
|
-
href="https://reflex.dev/docs/getting-started/introduction/",
|
|
41
|
-
color="rgb(107,99,246)",
|
|
42
|
-
),
|
|
43
|
-
),
|
|
44
|
-
rx.chakra.list_item(
|
|
45
|
-
"Ask a question in our ",
|
|
46
|
-
rx.chakra.link(
|
|
47
|
-
"community",
|
|
48
|
-
href="https://discord.gg/T5WSbC2YtQ",
|
|
49
|
-
color="rgb(107,99,246)",
|
|
50
|
-
),
|
|
51
|
-
),
|
|
52
|
-
),
|
|
53
|
-
style=template_content_style,
|
|
54
|
-
),
|
|
55
|
-
style=template_page_style,
|
|
56
|
-
)
|