reflex 0.5.10a3__py3-none-any.whl → 0.6.0__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/custom_components/pyproject.toml.jinja2 +2 -2
- reflex/.templates/jinja/web/pages/_app.js.jinja2 +1 -1
- 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/.templates/web/utils/state.js +3 -1
- reflex/__init__.py +10 -3
- reflex/__init__.pyi +3 -2
- reflex/app.py +47 -11
- reflex/app_module_for_backend.py +1 -1
- reflex/base.py +3 -2
- reflex/compiler/compiler.py +5 -5
- reflex/compiler/utils.py +5 -3
- reflex/components/base/app_wrap.py +2 -4
- reflex/components/base/app_wrap.pyi +16 -26
- reflex/components/base/bare.py +6 -4
- reflex/components/base/body.pyi +16 -26
- reflex/components/base/document.pyi +76 -126
- reflex/components/base/error_boundary.py +9 -8
- reflex/components/base/error_boundary.pyi +18 -30
- reflex/components/base/fragment.pyi +16 -26
- reflex/components/base/head.pyi +31 -51
- reflex/components/base/link.py +1 -1
- reflex/components/base/link.pyi +31 -51
- reflex/components/base/meta.pyi +61 -101
- reflex/components/base/script.py +2 -2
- reflex/components/base/script.pyi +20 -36
- reflex/components/component.py +107 -130
- reflex/components/core/banner.py +61 -66
- reflex/components/core/banner.pyi +129 -230
- reflex/components/core/client_side_routing.py +2 -2
- reflex/components/core/client_side_routing.pyi +31 -51
- reflex/components/core/clipboard.py +4 -3
- reflex/components/core/clipboard.pyi +19 -31
- reflex/components/core/cond.py +21 -44
- reflex/components/core/debounce.py +7 -9
- reflex/components/core/debounce.pyi +19 -31
- reflex/components/core/foreach.py +4 -14
- reflex/components/core/html.py +1 -1
- reflex/components/core/html.pyi +34 -44
- reflex/components/core/match.py +36 -43
- reflex/components/core/upload.py +27 -26
- reflex/components/core/upload.pyi +81 -116
- reflex/components/datadisplay/code.py +55 -29
- reflex/components/datadisplay/code.pyi +303 -410
- reflex/components/datadisplay/dataeditor.py +13 -9
- reflex/components/datadisplay/dataeditor.pyi +39 -51
- reflex/components/el/__init__.py +0 -1
- reflex/components/el/__init__.pyi +0 -11
- reflex/components/el/element.pyi +16 -26
- reflex/components/el/elements/__init__.py +1 -7
- reflex/components/el/elements/__init__.pyi +1 -15
- reflex/components/el/elements/base.py +1 -1
- reflex/components/el/elements/base.pyi +33 -43
- reflex/components/el/elements/forms.py +26 -33
- reflex/components/el/elements/forms.pyi +542 -694
- reflex/components/el/elements/inline.py +1 -1
- reflex/components/el/elements/inline.pyi +909 -1189
- reflex/components/el/elements/media.py +1 -22
- reflex/components/el/elements/media.pyi +765 -975
- reflex/components/el/elements/metadata.py +3 -5
- reflex/components/el/elements/metadata.pyi +175 -235
- reflex/components/el/elements/other.py +1 -1
- reflex/components/el/elements/other.pyi +228 -298
- reflex/components/el/elements/scripts.py +1 -1
- reflex/components/el/elements/scripts.pyi +106 -136
- reflex/components/el/elements/sectioning.py +0 -2
- reflex/components/el/elements/sectioning.pyi +481 -631
- reflex/components/el/elements/tables.py +1 -1
- reflex/components/el/elements/tables.pyi +341 -441
- reflex/components/el/elements/typography.py +1 -1
- reflex/components/el/elements/typography.pyi +491 -641
- reflex/components/gridjs/datatable.py +9 -13
- reflex/components/gridjs/datatable.pyi +33 -53
- reflex/components/lucide/icon.py +3 -127
- reflex/components/lucide/icon.pyi +31 -160
- reflex/components/markdown/markdown.py +32 -42
- reflex/components/markdown/markdown.pyi +28 -41
- reflex/components/moment/moment.py +13 -12
- reflex/components/moment/moment.pyi +22 -33
- reflex/components/next/base.pyi +16 -26
- reflex/components/next/image.py +1 -5
- reflex/components/next/image.pyi +21 -35
- reflex/components/next/link.py +1 -1
- reflex/components/next/link.pyi +16 -26
- reflex/components/next/video.py +1 -1
- reflex/components/next/video.pyi +16 -26
- reflex/components/plotly/plotly.py +17 -30
- reflex/components/plotly/plotly.pyi +38 -52
- reflex/components/props.py +21 -10
- reflex/components/radix/__init__.pyi +2 -1
- reflex/components/radix/primitives/accordion.py +6 -7
- reflex/components/radix/primitives/accordion.pyi +415 -485
- reflex/components/radix/primitives/base.py +1 -1
- reflex/components/radix/primitives/base.pyi +31 -51
- reflex/components/radix/primitives/drawer.py +1 -1
- reflex/components/radix/primitives/drawer.pyi +162 -262
- reflex/components/radix/primitives/form.py +1 -1
- reflex/components/radix/primitives/form.pyi +247 -353
- reflex/components/radix/primitives/progress.py +1 -1
- reflex/components/radix/primitives/progress.pyi +226 -276
- reflex/components/radix/primitives/slider.py +1 -1
- reflex/components/radix/primitives/slider.pyi +82 -132
- reflex/components/radix/themes/base.py +8 -25
- reflex/components/radix/themes/base.pyi +171 -242
- reflex/components/radix/themes/color_mode.py +11 -20
- reflex/components/radix/themes/color_mode.pyi +198 -231
- reflex/components/radix/themes/components/__init__.pyi +1 -0
- reflex/components/radix/themes/components/alert_dialog.py +1 -1
- reflex/components/radix/themes/components/alert_dialog.pyi +129 -199
- reflex/components/radix/themes/components/aspect_ratio.py +1 -1
- reflex/components/radix/themes/components/aspect_ratio.pyi +16 -26
- reflex/components/radix/themes/components/avatar.py +1 -1
- reflex/components/radix/themes/components/avatar.pyi +69 -79
- reflex/components/radix/themes/components/badge.py +1 -1
- reflex/components/radix/themes/components/badge.pyi +87 -97
- reflex/components/radix/themes/components/button.py +1 -1
- reflex/components/radix/themes/components/button.pyi +97 -107
- reflex/components/radix/themes/components/callout.py +1 -1
- reflex/components/radix/themes/components/callout.pyi +317 -367
- reflex/components/radix/themes/components/card.py +1 -1
- reflex/components/radix/themes/components/card.pyi +37 -47
- reflex/components/radix/themes/components/checkbox.py +2 -4
- reflex/components/radix/themes/components/checkbox.pyi +205 -241
- reflex/components/radix/themes/components/checkbox_cards.py +1 -1
- reflex/components/radix/themes/components/checkbox_cards.pyi +92 -112
- reflex/components/radix/themes/components/checkbox_group.py +1 -1
- reflex/components/radix/themes/components/checkbox_group.pyi +84 -104
- reflex/components/radix/themes/components/context_menu.py +1 -1
- reflex/components/radix/themes/components/context_menu.pyi +230 -310
- reflex/components/radix/themes/components/data_list.py +6 -1
- reflex/components/radix/themes/components/data_list.pyi +131 -166
- reflex/components/radix/themes/components/dialog.py +1 -1
- reflex/components/radix/themes/components/dialog.pyi +132 -202
- reflex/components/radix/themes/components/dropdown_menu.py +1 -1
- reflex/components/radix/themes/components/dropdown_menu.pyi +241 -323
- reflex/components/radix/themes/components/hover_card.py +1 -1
- reflex/components/radix/themes/components/hover_card.pyi +86 -126
- reflex/components/radix/themes/components/icon_button.py +1 -1
- reflex/components/radix/themes/components/icon_button.pyi +97 -107
- reflex/components/radix/themes/components/inset.py +1 -1
- reflex/components/radix/themes/components/inset.pyi +46 -56
- reflex/components/radix/themes/components/popover.py +1 -1
- reflex/components/radix/themes/components/popover.pyi +91 -131
- reflex/components/radix/themes/components/progress.py +1 -1
- reflex/components/radix/themes/components/progress.pyi +70 -80
- reflex/components/radix/themes/components/radio.py +1 -1
- reflex/components/radix/themes/components/radio.pyi +68 -78
- reflex/components/radix/themes/components/radio_cards.py +1 -1
- reflex/components/radix/themes/components/radio_cards.pyi +96 -116
- reflex/components/radix/themes/components/radio_group.py +32 -31
- reflex/components/radix/themes/components/radio_group.pyi +230 -266
- reflex/components/radix/themes/components/scroll_area.py +1 -1
- reflex/components/radix/themes/components/scroll_area.pyi +20 -30
- reflex/components/radix/themes/components/segmented_control.py +1 -1
- reflex/components/radix/themes/components/segmented_control.pyi +88 -110
- reflex/components/radix/themes/components/select.py +1 -1
- reflex/components/radix/themes/components/select.pyi +365 -461
- reflex/components/radix/themes/components/separator.py +2 -4
- reflex/components/radix/themes/components/separator.pyi +68 -78
- reflex/components/radix/themes/components/skeleton.py +1 -1
- reflex/components/radix/themes/components/skeleton.pyi +22 -32
- reflex/components/radix/themes/components/slider.py +1 -1
- reflex/components/radix/themes/components/slider.pyi +74 -86
- reflex/components/radix/themes/components/spinner.py +1 -1
- reflex/components/radix/themes/components/spinner.pyi +18 -28
- reflex/components/radix/themes/components/switch.py +1 -1
- reflex/components/radix/themes/components/switch.pyi +70 -82
- reflex/components/radix/themes/components/table.py +1 -1
- reflex/components/radix/themes/components/table.pyi +254 -324
- reflex/components/radix/themes/components/tabs.py +1 -1
- reflex/components/radix/themes/components/tabs.pyi +134 -188
- reflex/components/radix/themes/components/text_area.py +1 -1
- reflex/components/radix/themes/components/text_area.pyi +95 -109
- reflex/components/radix/themes/components/text_field.py +1 -80
- reflex/components/radix/themes/components/text_field.pyi +245 -290
- reflex/components/radix/themes/components/tooltip.py +1 -1
- reflex/components/radix/themes/components/tooltip.pyi +25 -35
- reflex/components/radix/themes/layout/__init__.pyi +1 -0
- reflex/components/radix/themes/layout/base.py +1 -1
- reflex/components/radix/themes/layout/base.pyi +55 -65
- reflex/components/radix/themes/layout/box.pyi +33 -43
- reflex/components/radix/themes/layout/center.pyi +55 -65
- reflex/components/radix/themes/layout/container.py +2 -4
- reflex/components/radix/themes/layout/container.pyi +35 -45
- reflex/components/radix/themes/layout/flex.py +1 -1
- reflex/components/radix/themes/layout/flex.pyi +55 -65
- reflex/components/radix/themes/layout/grid.py +1 -1
- reflex/components/radix/themes/layout/grid.pyi +63 -73
- reflex/components/radix/themes/layout/list.py +1 -1
- reflex/components/radix/themes/layout/list.pyi +188 -238
- reflex/components/radix/themes/layout/section.py +2 -4
- reflex/components/radix/themes/layout/section.pyi +35 -45
- reflex/components/radix/themes/layout/spacer.pyi +55 -65
- reflex/components/radix/themes/layout/stack.py +1 -1
- reflex/components/radix/themes/layout/stack.pyi +125 -155
- reflex/components/radix/themes/typography/blockquote.py +1 -1
- reflex/components/radix/themes/typography/blockquote.pyi +88 -98
- reflex/components/radix/themes/typography/code.py +1 -1
- reflex/components/radix/themes/typography/code.pyi +89 -99
- reflex/components/radix/themes/typography/heading.py +1 -1
- reflex/components/radix/themes/typography/heading.pyi +95 -105
- reflex/components/radix/themes/typography/link.py +1 -1
- reflex/components/radix/themes/typography/link.pyi +101 -111
- reflex/components/radix/themes/typography/text.py +1 -1
- reflex/components/radix/themes/typography/text.pyi +494 -564
- reflex/components/react_player/audio.pyi +32 -58
- reflex/components/react_player/react_player.py +1 -1
- reflex/components/react_player/react_player.pyi +32 -58
- reflex/components/react_player/video.pyi +32 -58
- reflex/components/recharts/cartesian.py +22 -19
- reflex/components/recharts/cartesian.pyi +658 -840
- reflex/components/recharts/charts.py +3 -3
- reflex/components/recharts/charts.pyi +238 -342
- reflex/components/recharts/general.py +8 -8
- reflex/components/recharts/general.pyi +175 -225
- reflex/components/recharts/polar.py +11 -11
- reflex/components/recharts/polar.pyi +135 -171
- reflex/components/recharts/recharts.pyi +31 -51
- reflex/components/sonner/toast.py +27 -31
- reflex/components/sonner/toast.pyi +36 -45
- reflex/components/suneditor/editor.py +1 -1
- reflex/components/suneditor/editor.pyi +54 -76
- reflex/components/tags/cond_tag.py +6 -4
- reflex/components/tags/iter_tag.py +37 -25
- reflex/components/tags/match_tag.py +6 -4
- reflex/components/tags/tag.py +43 -28
- reflex/constants/base.py +3 -1
- reflex/constants/event.py +1 -0
- reflex/custom_components/custom_components.py +3 -1
- reflex/event.py +166 -108
- reflex/experimental/__init__.py +25 -6
- reflex/experimental/client_state.py +34 -57
- reflex/experimental/hooks.py +12 -17
- reflex/experimental/layout.py +4 -4
- reflex/experimental/layout.pyi +130 -180
- reflex/middleware/hydrate_middleware.py +2 -0
- reflex/middleware/middleware.py +3 -3
- reflex/model.py +22 -0
- reflex/reflex.py +4 -0
- reflex/state.py +491 -110
- reflex/style.py +56 -39
- reflex/testing.py +8 -3
- reflex/utils/exceptions.py +32 -0
- reflex/utils/exec.py +0 -14
- reflex/utils/format.py +80 -209
- reflex/utils/imports.py +16 -73
- reflex/utils/net.py +43 -0
- reflex/utils/path_ops.py +13 -1
- reflex/utils/prerequisites.py +81 -41
- reflex/utils/pyi_generator.py +12 -6
- reflex/utils/serializers.py +13 -41
- reflex/utils/telemetry.py +3 -2
- reflex/utils/types.py +47 -7
- reflex/{experimental/vars → vars}/__init__.py +6 -3
- reflex/vars/base.py +2563 -0
- reflex/vars/function.py +196 -0
- reflex/vars/number.py +1158 -0
- reflex/vars/object.py +562 -0
- reflex/vars/sequence.py +1604 -0
- {reflex-0.5.10a3.dist-info → reflex-0.6.0.dist-info}/METADATA +6 -9
- reflex-0.6.0.dist-info/RECORD +382 -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/.templates/web/components/reflex/chakra_color_mode_provider.js +0 -36
- 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.py +0 -2604
- reflex/vars.pyi +0 -218
- reflex-0.5.10a3.dist-info/RECORD +0 -413
- {reflex-0.5.10a3.dist-info → reflex-0.6.0.dist-info}/LICENSE +0 -0
- {reflex-0.5.10a3.dist-info → reflex-0.6.0.dist-info}/WHEEL +0 -0
- {reflex-0.5.10a3.dist-info → reflex-0.6.0.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
|
-
)
|