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,178 +0,0 @@
|
|
|
1
|
-
"""Sidebar component for the app."""
|
|
2
|
-
|
|
3
|
-
import reflex as rx
|
|
4
|
-
|
|
5
|
-
from .state import State
|
|
6
|
-
from .styles import *
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def sidebar_header() -> rx.Component:
|
|
10
|
-
"""Sidebar header.
|
|
11
|
-
|
|
12
|
-
Returns:
|
|
13
|
-
rx.Component: The sidebar header component.
|
|
14
|
-
"""
|
|
15
|
-
return rx.chakra.hstack(
|
|
16
|
-
rx.chakra.image(
|
|
17
|
-
src="/icon.svg",
|
|
18
|
-
height="2em",
|
|
19
|
-
),
|
|
20
|
-
rx.chakra.spacer(),
|
|
21
|
-
rx.chakra.link(
|
|
22
|
-
rx.chakra.center(
|
|
23
|
-
rx.chakra.image(
|
|
24
|
-
src="/github.svg",
|
|
25
|
-
height="3em",
|
|
26
|
-
padding="0.5em",
|
|
27
|
-
),
|
|
28
|
-
box_shadow=box_shadow,
|
|
29
|
-
bg="transparent",
|
|
30
|
-
border_radius=border_radius,
|
|
31
|
-
_hover={
|
|
32
|
-
"bg": accent_color,
|
|
33
|
-
},
|
|
34
|
-
),
|
|
35
|
-
href="https://github.com/reflex-dev/reflex",
|
|
36
|
-
),
|
|
37
|
-
width="100%",
|
|
38
|
-
border_bottom=border,
|
|
39
|
-
padding="1em",
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def sidebar_footer() -> rx.Component:
|
|
44
|
-
"""Sidebar footer.
|
|
45
|
-
|
|
46
|
-
Returns:
|
|
47
|
-
rx.Component: The sidebar footer component.
|
|
48
|
-
"""
|
|
49
|
-
return rx.chakra.hstack(
|
|
50
|
-
rx.chakra.link(
|
|
51
|
-
rx.chakra.center(
|
|
52
|
-
rx.chakra.image(
|
|
53
|
-
src="/paneleft.svg",
|
|
54
|
-
height="2em",
|
|
55
|
-
padding="0.5em",
|
|
56
|
-
),
|
|
57
|
-
bg="transparent",
|
|
58
|
-
border_radius=border_radius,
|
|
59
|
-
**hover_accent_bg,
|
|
60
|
-
),
|
|
61
|
-
on_click=State.toggle_sidebar_displayed,
|
|
62
|
-
transform=rx.cond(~State.sidebar_displayed, "rotate(180deg)", ""),
|
|
63
|
-
transition="transform 0.5s, left 0.5s",
|
|
64
|
-
position="relative",
|
|
65
|
-
left=rx.cond(State.sidebar_displayed, "0px", "20.5em"),
|
|
66
|
-
**overlapping_button_style,
|
|
67
|
-
),
|
|
68
|
-
rx.chakra.spacer(),
|
|
69
|
-
rx.chakra.link(
|
|
70
|
-
rx.chakra.text(
|
|
71
|
-
"Docs",
|
|
72
|
-
),
|
|
73
|
-
href="https://reflex.dev/docs/getting-started/introduction/",
|
|
74
|
-
),
|
|
75
|
-
rx.chakra.link(
|
|
76
|
-
rx.chakra.text(
|
|
77
|
-
"Blog",
|
|
78
|
-
),
|
|
79
|
-
href="https://reflex.dev/blog/",
|
|
80
|
-
),
|
|
81
|
-
width="100%",
|
|
82
|
-
border_top=border,
|
|
83
|
-
padding="1em",
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
def sidebar_item(text: str, icon: str, url: str) -> rx.Component:
|
|
88
|
-
"""Sidebar item.
|
|
89
|
-
|
|
90
|
-
Args:
|
|
91
|
-
text (str): The text of the item.
|
|
92
|
-
icon (str): The icon of the item.
|
|
93
|
-
url (str): The URL of the item.
|
|
94
|
-
|
|
95
|
-
Returns:
|
|
96
|
-
rx.Component: The sidebar item component.
|
|
97
|
-
"""
|
|
98
|
-
return rx.chakra.link(
|
|
99
|
-
rx.chakra.hstack(
|
|
100
|
-
rx.chakra.image(
|
|
101
|
-
src=icon,
|
|
102
|
-
height="2.5em",
|
|
103
|
-
padding="0.5em",
|
|
104
|
-
),
|
|
105
|
-
rx.chakra.text(
|
|
106
|
-
text,
|
|
107
|
-
),
|
|
108
|
-
bg=rx.cond(
|
|
109
|
-
State.origin_url == f"/{text.lower()}/",
|
|
110
|
-
accent_color,
|
|
111
|
-
"transparent",
|
|
112
|
-
),
|
|
113
|
-
color=rx.cond(
|
|
114
|
-
State.origin_url == f"/{text.lower()}/",
|
|
115
|
-
accent_text_color,
|
|
116
|
-
text_color,
|
|
117
|
-
),
|
|
118
|
-
border_radius=border_radius,
|
|
119
|
-
box_shadow=box_shadow,
|
|
120
|
-
width="100%",
|
|
121
|
-
padding_x="1em",
|
|
122
|
-
),
|
|
123
|
-
href=url,
|
|
124
|
-
width="100%",
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
def sidebar() -> rx.Component:
|
|
129
|
-
"""Sidebar.
|
|
130
|
-
|
|
131
|
-
Returns:
|
|
132
|
-
rx.Component: The sidebar component.
|
|
133
|
-
"""
|
|
134
|
-
return rx.chakra.box(
|
|
135
|
-
rx.chakra.vstack(
|
|
136
|
-
sidebar_header(),
|
|
137
|
-
rx.chakra.vstack(
|
|
138
|
-
sidebar_item(
|
|
139
|
-
"Welcome",
|
|
140
|
-
"/github.svg",
|
|
141
|
-
"/",
|
|
142
|
-
),
|
|
143
|
-
sidebar_item(
|
|
144
|
-
"Graphing Demo",
|
|
145
|
-
"/github.svg",
|
|
146
|
-
"/graphing",
|
|
147
|
-
),
|
|
148
|
-
sidebar_item(
|
|
149
|
-
"Data Table Demo",
|
|
150
|
-
"/github.svg",
|
|
151
|
-
"/datatable",
|
|
152
|
-
),
|
|
153
|
-
sidebar_item(
|
|
154
|
-
"Forms Demo",
|
|
155
|
-
"/github.svg",
|
|
156
|
-
"/forms",
|
|
157
|
-
),
|
|
158
|
-
sidebar_item(
|
|
159
|
-
"Chat App Demo",
|
|
160
|
-
"/github.svg",
|
|
161
|
-
"/chatapp",
|
|
162
|
-
),
|
|
163
|
-
width="100%",
|
|
164
|
-
overflow_y="auto",
|
|
165
|
-
align_items="flex-start",
|
|
166
|
-
padding="1em",
|
|
167
|
-
),
|
|
168
|
-
rx.chakra.spacer(),
|
|
169
|
-
sidebar_footer(),
|
|
170
|
-
height="100dvh",
|
|
171
|
-
),
|
|
172
|
-
display=["none", "none", "block"],
|
|
173
|
-
min_width=sidebar_width,
|
|
174
|
-
height="100%",
|
|
175
|
-
position="sticky",
|
|
176
|
-
top="0px",
|
|
177
|
-
border_right=border,
|
|
178
|
-
)
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"""Base state for the app."""
|
|
2
|
-
|
|
3
|
-
import reflex as rx
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class State(rx.State):
|
|
7
|
-
"""State for the app."""
|
|
8
|
-
|
|
9
|
-
sidebar_displayed: bool = True
|
|
10
|
-
|
|
11
|
-
@rx.var
|
|
12
|
-
def origin_url(self) -> str:
|
|
13
|
-
"""Get the url of the current page.
|
|
14
|
-
|
|
15
|
-
Returns:
|
|
16
|
-
str: The url of the current page.
|
|
17
|
-
"""
|
|
18
|
-
return self.router_data.get("asPath", "")
|
|
19
|
-
|
|
20
|
-
def toggle_sidebar_displayed(self) -> None:
|
|
21
|
-
"""Toggle the sidebar displayed."""
|
|
22
|
-
self.sidebar_displayed = not self.sidebar_displayed
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import reflex as rx
|
|
2
|
-
|
|
3
|
-
from ..state import State
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class FormState(State):
|
|
7
|
-
"""Form state."""
|
|
8
|
-
|
|
9
|
-
form_data: dict = {}
|
|
10
|
-
|
|
11
|
-
def handle_submit(self, form_data: dict):
|
|
12
|
-
"""Handle the form submit.
|
|
13
|
-
|
|
14
|
-
Args:
|
|
15
|
-
form_data: The form data.
|
|
16
|
-
"""
|
|
17
|
-
self.form_data = form_data
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class UploadState(State):
|
|
21
|
-
"""The app state."""
|
|
22
|
-
|
|
23
|
-
# The images to show.
|
|
24
|
-
img: list[str]
|
|
25
|
-
|
|
26
|
-
async def handle_upload(self, files: list[rx.UploadFile]):
|
|
27
|
-
"""Handle the upload of file(s).
|
|
28
|
-
|
|
29
|
-
Args:
|
|
30
|
-
files: The uploaded files.
|
|
31
|
-
"""
|
|
32
|
-
for file in files:
|
|
33
|
-
upload_data = await file.read()
|
|
34
|
-
outfile = rx.get_asset_path(file.filename)
|
|
35
|
-
# Save the file.
|
|
36
|
-
with open(outfile, "wb") as file_object:
|
|
37
|
-
file_object.write(upload_data)
|
|
38
|
-
|
|
39
|
-
# Update the img var.
|
|
40
|
-
self.img.append(f"/{file.filename}")
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
from typing import Any
|
|
2
|
-
|
|
3
|
-
import reflex as rx
|
|
4
|
-
|
|
5
|
-
from ..state import State
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class PieChartState(State):
|
|
9
|
-
"""Pie Chart State."""
|
|
10
|
-
|
|
11
|
-
resources: list[dict[str, Any]] = [
|
|
12
|
-
dict(type_="🏆", count=1),
|
|
13
|
-
dict(type_="🪵", count=1),
|
|
14
|
-
dict(type_="🥑", count=1),
|
|
15
|
-
dict(type_="🧱", count=1),
|
|
16
|
-
]
|
|
17
|
-
|
|
18
|
-
@rx.cached_var
|
|
19
|
-
def resource_types(self) -> list[str]:
|
|
20
|
-
"""Get the resource types.
|
|
21
|
-
|
|
22
|
-
Returns:
|
|
23
|
-
The resource types.
|
|
24
|
-
"""
|
|
25
|
-
return [r["type_"] for r in self.resources]
|
|
26
|
-
|
|
27
|
-
def increment(self, type_: str):
|
|
28
|
-
"""Increment the count of a resource type.
|
|
29
|
-
|
|
30
|
-
Args:
|
|
31
|
-
type_: The type of resource to increment.
|
|
32
|
-
"""
|
|
33
|
-
for resource in self.resources:
|
|
34
|
-
if resource["type_"] == type_:
|
|
35
|
-
resource["count"] += 1
|
|
36
|
-
break
|
|
37
|
-
|
|
38
|
-
def decrement(self, type_: str):
|
|
39
|
-
"""Decrement the count of a resource type.
|
|
40
|
-
|
|
41
|
-
Args:
|
|
42
|
-
type_: The type of resource to decrement.
|
|
43
|
-
"""
|
|
44
|
-
for resource in self.resources:
|
|
45
|
-
if resource["type_"] == type_ and resource["count"] > 0:
|
|
46
|
-
resource["count"] -= 1
|
|
47
|
-
break
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"""Styles for the app."""
|
|
2
|
-
|
|
3
|
-
import reflex as rx
|
|
4
|
-
|
|
5
|
-
from .state import State
|
|
6
|
-
|
|
7
|
-
border_radius = "0.375rem"
|
|
8
|
-
box_shadow = "0px 0px 0px 1px rgba(84, 82, 95, 0.14)"
|
|
9
|
-
border = "1px solid #F4F3F6"
|
|
10
|
-
text_color = "black"
|
|
11
|
-
accent_text_color = "#1A1060"
|
|
12
|
-
accent_color = "#F5EFFE"
|
|
13
|
-
hover_accent_color = {"_hover": {"color": accent_color}}
|
|
14
|
-
hover_accent_bg = {"_hover": {"bg": accent_color}}
|
|
15
|
-
content_width_vw = "90vw"
|
|
16
|
-
sidebar_width = "20em"
|
|
17
|
-
|
|
18
|
-
template_page_style = {
|
|
19
|
-
"padding_top": "5em",
|
|
20
|
-
"padding_x": "2em",
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
template_content_style = {
|
|
24
|
-
"width": rx.cond(
|
|
25
|
-
State.sidebar_displayed,
|
|
26
|
-
f"calc({content_width_vw} - {sidebar_width})",
|
|
27
|
-
content_width_vw,
|
|
28
|
-
),
|
|
29
|
-
"min-width": sidebar_width,
|
|
30
|
-
"align_items": "flex-start",
|
|
31
|
-
"box_shadow": box_shadow,
|
|
32
|
-
"border_radius": border_radius,
|
|
33
|
-
"padding": "1em",
|
|
34
|
-
"margin_bottom": "2em",
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
link_style = {
|
|
38
|
-
"color": text_color,
|
|
39
|
-
"text_decoration": "none",
|
|
40
|
-
**hover_accent_color,
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
overlapping_button_style = {
|
|
44
|
-
"background_color": "white",
|
|
45
|
-
"border": border,
|
|
46
|
-
"border_radius": border_radius,
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
base_style = {
|
|
50
|
-
rx.chakra.MenuButton: {
|
|
51
|
-
"width": "3em",
|
|
52
|
-
"height": "3em",
|
|
53
|
-
**overlapping_button_style,
|
|
54
|
-
},
|
|
55
|
-
rx.chakra.MenuItem: hover_accent_bg,
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
tab_style = {
|
|
59
|
-
"color": "#494369",
|
|
60
|
-
"font_weight": 600,
|
|
61
|
-
"_selected": {
|
|
62
|
-
"color": "#5646ED",
|
|
63
|
-
"bg": "#F5EFFE",
|
|
64
|
-
"padding_x": "0.5em",
|
|
65
|
-
"padding_y": "0.25em",
|
|
66
|
-
"border_radius": "8px",
|
|
67
|
-
},
|
|
68
|
-
}
|
|
File without changes
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import reflex as rx
|
|
2
|
-
|
|
3
|
-
from ...webui import styles
|
|
4
|
-
from ...webui.components import loading_icon
|
|
5
|
-
from ...webui.state import QA, State
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def message(qa: QA) -> rx.Component:
|
|
9
|
-
"""A single question/answer message.
|
|
10
|
-
|
|
11
|
-
Args:
|
|
12
|
-
qa: The question/answer pair.
|
|
13
|
-
|
|
14
|
-
Returns:
|
|
15
|
-
A component displaying the question/answer pair.
|
|
16
|
-
"""
|
|
17
|
-
return rx.chakra.box(
|
|
18
|
-
rx.chakra.box(
|
|
19
|
-
rx.chakra.text(
|
|
20
|
-
qa.question,
|
|
21
|
-
bg=styles.border_color,
|
|
22
|
-
shadow=styles.shadow_light,
|
|
23
|
-
**styles.message_style,
|
|
24
|
-
),
|
|
25
|
-
text_align="right",
|
|
26
|
-
margin_top="1em",
|
|
27
|
-
),
|
|
28
|
-
rx.chakra.box(
|
|
29
|
-
rx.chakra.text(
|
|
30
|
-
qa.answer,
|
|
31
|
-
bg=styles.accent_color,
|
|
32
|
-
shadow=styles.shadow_light,
|
|
33
|
-
**styles.message_style,
|
|
34
|
-
),
|
|
35
|
-
text_align="left",
|
|
36
|
-
padding_top="1em",
|
|
37
|
-
),
|
|
38
|
-
width="100%",
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def chat() -> rx.Component:
|
|
43
|
-
"""List all the messages in a single conversation.
|
|
44
|
-
|
|
45
|
-
Returns:
|
|
46
|
-
A component displaying all the messages in a single conversation.
|
|
47
|
-
"""
|
|
48
|
-
return rx.chakra.vstack(
|
|
49
|
-
rx.chakra.box(rx.foreach(State.chats[State.current_chat], message)),
|
|
50
|
-
py="8",
|
|
51
|
-
flex="1",
|
|
52
|
-
width="100%",
|
|
53
|
-
max_w="3xl",
|
|
54
|
-
padding_x="4",
|
|
55
|
-
align_self="center",
|
|
56
|
-
overflow="hidden",
|
|
57
|
-
padding_bottom="5em",
|
|
58
|
-
**styles.base_style[rx.chakra.Vstack],
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
def action_bar() -> rx.Component:
|
|
63
|
-
"""The action bar to send a new message.
|
|
64
|
-
|
|
65
|
-
Returns:
|
|
66
|
-
The action bar to send a new message.
|
|
67
|
-
"""
|
|
68
|
-
return rx.chakra.box(
|
|
69
|
-
rx.chakra.vstack(
|
|
70
|
-
rx.chakra.form(
|
|
71
|
-
rx.chakra.form_control(
|
|
72
|
-
rx.chakra.hstack(
|
|
73
|
-
rx.chakra.input(
|
|
74
|
-
placeholder="Type something...",
|
|
75
|
-
value=State.question,
|
|
76
|
-
on_change=State.set_question,
|
|
77
|
-
_placeholder={"color": "#fffa"},
|
|
78
|
-
_hover={"border_color": styles.accent_color},
|
|
79
|
-
style=styles.input_style,
|
|
80
|
-
),
|
|
81
|
-
rx.chakra.button(
|
|
82
|
-
rx.cond(
|
|
83
|
-
State.processing,
|
|
84
|
-
loading_icon(height="1em"),
|
|
85
|
-
rx.chakra.text("Send"),
|
|
86
|
-
),
|
|
87
|
-
type_="submit",
|
|
88
|
-
_hover={"bg": styles.accent_color},
|
|
89
|
-
style=styles.input_style,
|
|
90
|
-
),
|
|
91
|
-
**styles.base_style[rx.chakra.Hstack],
|
|
92
|
-
),
|
|
93
|
-
is_disabled=State.processing,
|
|
94
|
-
),
|
|
95
|
-
on_submit=State.process_question,
|
|
96
|
-
width="100%",
|
|
97
|
-
),
|
|
98
|
-
rx.chakra.text(
|
|
99
|
-
"ReflexGPT may return factually incorrect or misleading responses. Use discretion.",
|
|
100
|
-
font_size="xs",
|
|
101
|
-
color="#fff6",
|
|
102
|
-
text_align="center",
|
|
103
|
-
),
|
|
104
|
-
width="100%",
|
|
105
|
-
max_w="3xl",
|
|
106
|
-
mx="auto",
|
|
107
|
-
**styles.base_style[rx.chakra.Vstack],
|
|
108
|
-
),
|
|
109
|
-
position="sticky",
|
|
110
|
-
bottom="0",
|
|
111
|
-
left="0",
|
|
112
|
-
py="4",
|
|
113
|
-
backdrop_filter="auto",
|
|
114
|
-
backdrop_blur="lg",
|
|
115
|
-
border_top=f"1px solid {styles.border_color}",
|
|
116
|
-
align_items="stretch",
|
|
117
|
-
width="100%",
|
|
118
|
-
)
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import reflex as rx
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class LoadingIcon(rx.Component):
|
|
5
|
-
"""A custom loading icon component."""
|
|
6
|
-
|
|
7
|
-
library = "react-loading-icons"
|
|
8
|
-
tag = "SpinningCircles"
|
|
9
|
-
stroke: rx.Var[str]
|
|
10
|
-
stroke_opacity: rx.Var[str]
|
|
11
|
-
fill: rx.Var[str]
|
|
12
|
-
fill_opacity: rx.Var[str]
|
|
13
|
-
stroke_width: rx.Var[str]
|
|
14
|
-
speed: rx.Var[str]
|
|
15
|
-
height: rx.Var[str]
|
|
16
|
-
on_change: rx.EventHandler[lambda status: [status]]
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
loading_icon = LoadingIcon.create
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import reflex as rx
|
|
2
|
-
|
|
3
|
-
from ...webui.state import State
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def modal() -> rx.Component:
|
|
7
|
-
"""A modal to create a new chat.
|
|
8
|
-
|
|
9
|
-
Returns:
|
|
10
|
-
The modal component.
|
|
11
|
-
"""
|
|
12
|
-
return rx.chakra.modal(
|
|
13
|
-
rx.chakra.modal_overlay(
|
|
14
|
-
rx.chakra.modal_content(
|
|
15
|
-
rx.chakra.modal_header(
|
|
16
|
-
rx.chakra.hstack(
|
|
17
|
-
rx.chakra.text("Create new chat"),
|
|
18
|
-
rx.chakra.icon(
|
|
19
|
-
tag="close",
|
|
20
|
-
font_size="sm",
|
|
21
|
-
on_click=State.toggle_modal,
|
|
22
|
-
color="#fff8",
|
|
23
|
-
_hover={"color": "#fff"},
|
|
24
|
-
cursor="pointer",
|
|
25
|
-
),
|
|
26
|
-
align_items="center",
|
|
27
|
-
justify_content="space-between",
|
|
28
|
-
)
|
|
29
|
-
),
|
|
30
|
-
rx.chakra.modal_body(
|
|
31
|
-
rx.chakra.input(
|
|
32
|
-
placeholder="Type something...",
|
|
33
|
-
on_blur=State.set_new_chat_name,
|
|
34
|
-
bg="#222",
|
|
35
|
-
border_color="#fff3",
|
|
36
|
-
_placeholder={"color": "#fffa"},
|
|
37
|
-
),
|
|
38
|
-
),
|
|
39
|
-
rx.chakra.modal_footer(
|
|
40
|
-
rx.chakra.button(
|
|
41
|
-
"Create",
|
|
42
|
-
bg="#5535d4",
|
|
43
|
-
box_shadow="md",
|
|
44
|
-
px="4",
|
|
45
|
-
py="2",
|
|
46
|
-
h="auto",
|
|
47
|
-
_hover={"bg": "#4c2db3"},
|
|
48
|
-
on_click=State.create_chat,
|
|
49
|
-
),
|
|
50
|
-
),
|
|
51
|
-
bg="#222",
|
|
52
|
-
color="#fff",
|
|
53
|
-
),
|
|
54
|
-
),
|
|
55
|
-
is_open=State.modal_open,
|
|
56
|
-
)
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import reflex as rx
|
|
2
|
-
|
|
3
|
-
from ...webui import styles
|
|
4
|
-
from ...webui.state import State
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def navbar():
|
|
8
|
-
return rx.chakra.box(
|
|
9
|
-
rx.chakra.hstack(
|
|
10
|
-
rx.chakra.hstack(
|
|
11
|
-
rx.chakra.icon(
|
|
12
|
-
tag="hamburger",
|
|
13
|
-
mr=4,
|
|
14
|
-
on_click=State.toggle_drawer,
|
|
15
|
-
cursor="pointer",
|
|
16
|
-
),
|
|
17
|
-
rx.chakra.link(
|
|
18
|
-
rx.chakra.box(
|
|
19
|
-
rx.chakra.image(src="favicon.ico", width=30, height="auto"),
|
|
20
|
-
p="1",
|
|
21
|
-
border_radius="6",
|
|
22
|
-
bg="#F0F0F0",
|
|
23
|
-
mr="2",
|
|
24
|
-
),
|
|
25
|
-
href="/",
|
|
26
|
-
),
|
|
27
|
-
rx.chakra.breadcrumb(
|
|
28
|
-
rx.chakra.breadcrumb_item(
|
|
29
|
-
rx.chakra.heading("ReflexGPT", size="sm"),
|
|
30
|
-
),
|
|
31
|
-
rx.chakra.breadcrumb_item(
|
|
32
|
-
rx.chakra.text(
|
|
33
|
-
State.current_chat, size="sm", font_weight="normal"
|
|
34
|
-
),
|
|
35
|
-
),
|
|
36
|
-
),
|
|
37
|
-
),
|
|
38
|
-
rx.chakra.hstack(
|
|
39
|
-
rx.chakra.button(
|
|
40
|
-
"+ New chat",
|
|
41
|
-
bg=styles.accent_color,
|
|
42
|
-
px="4",
|
|
43
|
-
py="2",
|
|
44
|
-
h="auto",
|
|
45
|
-
on_click=State.toggle_modal,
|
|
46
|
-
),
|
|
47
|
-
rx.chakra.menu(
|
|
48
|
-
rx.chakra.menu_button(
|
|
49
|
-
rx.chakra.avatar(name="User", size="md"),
|
|
50
|
-
rx.chakra.box(),
|
|
51
|
-
),
|
|
52
|
-
rx.chakra.menu_list(
|
|
53
|
-
rx.chakra.menu_item("Help"),
|
|
54
|
-
rx.chakra.menu_divider(),
|
|
55
|
-
rx.chakra.menu_item("Settings"),
|
|
56
|
-
),
|
|
57
|
-
),
|
|
58
|
-
spacing="8",
|
|
59
|
-
),
|
|
60
|
-
justify="space-between",
|
|
61
|
-
),
|
|
62
|
-
bg=styles.bg_dark_color,
|
|
63
|
-
backdrop_filter="auto",
|
|
64
|
-
backdrop_blur="lg",
|
|
65
|
-
p="4",
|
|
66
|
-
border_bottom=f"1px solid {styles.border_color}",
|
|
67
|
-
position="sticky",
|
|
68
|
-
top="0",
|
|
69
|
-
z_index="100",
|
|
70
|
-
)
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import reflex as rx
|
|
2
|
-
|
|
3
|
-
from ...webui import styles
|
|
4
|
-
from ...webui.state import State
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def sidebar_chat(chat: str) -> rx.Component:
|
|
8
|
-
"""A sidebar chat item.
|
|
9
|
-
|
|
10
|
-
Args:
|
|
11
|
-
chat: The chat item.
|
|
12
|
-
|
|
13
|
-
Returns:
|
|
14
|
-
The sidebar chat item.
|
|
15
|
-
"""
|
|
16
|
-
return rx.chakra.hstack(
|
|
17
|
-
rx.chakra.box(
|
|
18
|
-
chat,
|
|
19
|
-
on_click=lambda: State.set_chat(chat),
|
|
20
|
-
style=styles.sidebar_style,
|
|
21
|
-
color=styles.icon_color,
|
|
22
|
-
flex="1",
|
|
23
|
-
),
|
|
24
|
-
rx.chakra.box(
|
|
25
|
-
rx.chakra.icon(
|
|
26
|
-
tag="delete",
|
|
27
|
-
style=styles.icon_style,
|
|
28
|
-
on_click=State.delete_chat,
|
|
29
|
-
),
|
|
30
|
-
style=styles.sidebar_style,
|
|
31
|
-
),
|
|
32
|
-
color=styles.text_light_color,
|
|
33
|
-
cursor="pointer",
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def sidebar() -> rx.Component:
|
|
38
|
-
"""The sidebar component.
|
|
39
|
-
|
|
40
|
-
Returns:
|
|
41
|
-
The sidebar component.
|
|
42
|
-
"""
|
|
43
|
-
return rx.chakra.drawer(
|
|
44
|
-
rx.chakra.drawer_overlay(
|
|
45
|
-
rx.chakra.drawer_content(
|
|
46
|
-
rx.chakra.drawer_header(
|
|
47
|
-
rx.chakra.hstack(
|
|
48
|
-
rx.chakra.text("Chats"),
|
|
49
|
-
rx.chakra.icon(
|
|
50
|
-
tag="close",
|
|
51
|
-
on_click=State.toggle_drawer,
|
|
52
|
-
style=styles.icon_style,
|
|
53
|
-
),
|
|
54
|
-
)
|
|
55
|
-
),
|
|
56
|
-
rx.chakra.drawer_body(
|
|
57
|
-
rx.chakra.vstack(
|
|
58
|
-
rx.foreach(State.chat_titles, lambda chat: sidebar_chat(chat)),
|
|
59
|
-
align_items="stretch",
|
|
60
|
-
)
|
|
61
|
-
),
|
|
62
|
-
),
|
|
63
|
-
),
|
|
64
|
-
placement="left",
|
|
65
|
-
is_open=State.drawer_open,
|
|
66
|
-
)
|