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,127 +0,0 @@
|
|
|
1
|
-
"""Welcome to Reflex! This file outlines the steps to create a basic app."""
|
|
2
|
-
|
|
3
|
-
from typing import Callable
|
|
4
|
-
|
|
5
|
-
import reflex as rx
|
|
6
|
-
|
|
7
|
-
from .pages import chatapp_page, datatable_page, forms_page, graphing_page, home_page
|
|
8
|
-
from .sidebar import sidebar
|
|
9
|
-
from .state import State
|
|
10
|
-
from .styles import *
|
|
11
|
-
|
|
12
|
-
meta = [
|
|
13
|
-
{
|
|
14
|
-
"name": "viewport",
|
|
15
|
-
"content": "width=device-width, shrink-to-fit=no, initial-scale=1",
|
|
16
|
-
},
|
|
17
|
-
]
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def template(main_content: Callable[[], rx.Component]) -> rx.Component:
|
|
21
|
-
"""The template for each page of the app.
|
|
22
|
-
|
|
23
|
-
Args:
|
|
24
|
-
main_content (Callable[[], rx.Component]): The main content of the page.
|
|
25
|
-
|
|
26
|
-
Returns:
|
|
27
|
-
rx.Component: The template for each page of the app.
|
|
28
|
-
"""
|
|
29
|
-
menu_button = rx.chakra.box(
|
|
30
|
-
rx.chakra.menu(
|
|
31
|
-
rx.chakra.menu_button(
|
|
32
|
-
rx.chakra.icon(
|
|
33
|
-
tag="hamburger",
|
|
34
|
-
size="4em",
|
|
35
|
-
color=text_color,
|
|
36
|
-
),
|
|
37
|
-
),
|
|
38
|
-
rx.chakra.menu_list(
|
|
39
|
-
rx.chakra.menu_item(rx.chakra.link("Home", href="/", width="100%")),
|
|
40
|
-
rx.chakra.menu_divider(),
|
|
41
|
-
rx.chakra.menu_item(
|
|
42
|
-
rx.chakra.link(
|
|
43
|
-
"About", href="https://github.com/reflex-dev", width="100%"
|
|
44
|
-
)
|
|
45
|
-
),
|
|
46
|
-
rx.chakra.menu_item(
|
|
47
|
-
rx.chakra.link(
|
|
48
|
-
"Contact", href="mailto:founders@reflex.dev", width="100%"
|
|
49
|
-
)
|
|
50
|
-
),
|
|
51
|
-
),
|
|
52
|
-
),
|
|
53
|
-
position="fixed",
|
|
54
|
-
right="1.5em",
|
|
55
|
-
top="1.5em",
|
|
56
|
-
z_index="500",
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
return rx.chakra.hstack(
|
|
60
|
-
sidebar(),
|
|
61
|
-
main_content(),
|
|
62
|
-
rx.chakra.spacer(),
|
|
63
|
-
menu_button,
|
|
64
|
-
align_items="flex-start",
|
|
65
|
-
transition="left 0.5s, width 0.5s",
|
|
66
|
-
position="relative",
|
|
67
|
-
left=rx.cond(State.sidebar_displayed, "0px", f"-{sidebar_width}"),
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
@rx.page("/", meta=meta)
|
|
72
|
-
@template
|
|
73
|
-
def home() -> rx.Component:
|
|
74
|
-
"""Home page.
|
|
75
|
-
|
|
76
|
-
Returns:
|
|
77
|
-
rx.Component: The home page.
|
|
78
|
-
"""
|
|
79
|
-
return home_page()
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
@rx.page("/forms", meta=meta)
|
|
83
|
-
@template
|
|
84
|
-
def forms() -> rx.Component:
|
|
85
|
-
"""Forms page.
|
|
86
|
-
|
|
87
|
-
Returns:
|
|
88
|
-
rx.Component: The settings page.
|
|
89
|
-
"""
|
|
90
|
-
return forms_page()
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
@rx.page("/graphing", meta=meta)
|
|
94
|
-
@template
|
|
95
|
-
def graphing() -> rx.Component:
|
|
96
|
-
"""Graphing page.
|
|
97
|
-
|
|
98
|
-
Returns:
|
|
99
|
-
rx.Component: The graphing page.
|
|
100
|
-
"""
|
|
101
|
-
return graphing_page()
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
@rx.page("/datatable", meta=meta)
|
|
105
|
-
@template
|
|
106
|
-
def datatable() -> rx.Component:
|
|
107
|
-
"""Data Table page.
|
|
108
|
-
|
|
109
|
-
Returns:
|
|
110
|
-
rx.Component: The chatapp page.
|
|
111
|
-
"""
|
|
112
|
-
return datatable_page()
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
@rx.page("/chatapp", meta=meta)
|
|
116
|
-
@template
|
|
117
|
-
def chatapp() -> rx.Component:
|
|
118
|
-
"""Chatapp page.
|
|
119
|
-
|
|
120
|
-
Returns:
|
|
121
|
-
rx.Component: The chatapp page.
|
|
122
|
-
"""
|
|
123
|
-
return chatapp_page()
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
# Create the app.
|
|
127
|
-
app = rx.App(style=base_style)
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"""The main Chat app."""
|
|
2
|
-
|
|
3
|
-
import reflex as rx
|
|
4
|
-
|
|
5
|
-
from ..styles import *
|
|
6
|
-
from ..webui import styles
|
|
7
|
-
from ..webui.components import chat, modal, navbar, sidebar
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def chatapp_page() -> rx.Component:
|
|
11
|
-
"""The main app.
|
|
12
|
-
|
|
13
|
-
Returns:
|
|
14
|
-
The UI for the main app.
|
|
15
|
-
"""
|
|
16
|
-
return rx.chakra.box(
|
|
17
|
-
rx.chakra.vstack(
|
|
18
|
-
navbar(),
|
|
19
|
-
chat.chat(),
|
|
20
|
-
chat.action_bar(),
|
|
21
|
-
sidebar(),
|
|
22
|
-
modal(),
|
|
23
|
-
bg=styles.bg_dark_color,
|
|
24
|
-
color=styles.text_light_color,
|
|
25
|
-
min_h="100vh",
|
|
26
|
-
align_items="stretch",
|
|
27
|
-
spacing="0",
|
|
28
|
-
style=template_content_style,
|
|
29
|
-
),
|
|
30
|
-
style=template_page_style,
|
|
31
|
-
)
|
|
@@ -1,360 +0,0 @@
|
|
|
1
|
-
"""The settings page for the template."""
|
|
2
|
-
|
|
3
|
-
from typing import Any
|
|
4
|
-
|
|
5
|
-
import reflex as rx
|
|
6
|
-
from reflex.components.datadisplay.dataeditor import DataEditorTheme
|
|
7
|
-
|
|
8
|
-
from ..styles import *
|
|
9
|
-
from ..webui.state import State
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class DataTableState(State):
|
|
13
|
-
"""Datatable state."""
|
|
14
|
-
|
|
15
|
-
cols: list[Any] = [
|
|
16
|
-
{"title": "Title", "type": "str"},
|
|
17
|
-
{
|
|
18
|
-
"title": "Name",
|
|
19
|
-
"type": "str",
|
|
20
|
-
"group": "Data",
|
|
21
|
-
"width": 300,
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"title": "Birth",
|
|
25
|
-
"type": "str",
|
|
26
|
-
"group": "Data",
|
|
27
|
-
"width": 150,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"title": "Human",
|
|
31
|
-
"type": "bool",
|
|
32
|
-
"group": "Data",
|
|
33
|
-
"width": 80,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"title": "House",
|
|
37
|
-
"type": "str",
|
|
38
|
-
"group": "Data",
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"title": "Wand",
|
|
42
|
-
"type": "str",
|
|
43
|
-
"group": "Data",
|
|
44
|
-
"width": 250,
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"title": "Patronus",
|
|
48
|
-
"type": "str",
|
|
49
|
-
"group": "Data",
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
"title": "Blood status",
|
|
53
|
-
"type": "str",
|
|
54
|
-
"group": "Data",
|
|
55
|
-
"width": 200,
|
|
56
|
-
},
|
|
57
|
-
]
|
|
58
|
-
|
|
59
|
-
data = [
|
|
60
|
-
[
|
|
61
|
-
"1",
|
|
62
|
-
"Harry James Potter",
|
|
63
|
-
"31 July 1980",
|
|
64
|
-
True,
|
|
65
|
-
"Gryffindor",
|
|
66
|
-
"11' Holly phoenix feather",
|
|
67
|
-
"Stag",
|
|
68
|
-
"Half-blood",
|
|
69
|
-
],
|
|
70
|
-
[
|
|
71
|
-
"2",
|
|
72
|
-
"Ronald Bilius Weasley",
|
|
73
|
-
"1 March 1980",
|
|
74
|
-
True,
|
|
75
|
-
"Gryffindor",
|
|
76
|
-
"12' Ash unicorn tail hair",
|
|
77
|
-
"Jack Russell terrier",
|
|
78
|
-
"Pure-blood",
|
|
79
|
-
],
|
|
80
|
-
[
|
|
81
|
-
"3",
|
|
82
|
-
"Hermione Jean Granger",
|
|
83
|
-
"19 September, 1979",
|
|
84
|
-
True,
|
|
85
|
-
"Gryffindor",
|
|
86
|
-
"10¾' vine wood dragon heartstring",
|
|
87
|
-
"Otter",
|
|
88
|
-
"Muggle-born",
|
|
89
|
-
],
|
|
90
|
-
[
|
|
91
|
-
"4",
|
|
92
|
-
"Albus Percival Wulfric Brian Dumbledore",
|
|
93
|
-
"Late August 1881",
|
|
94
|
-
True,
|
|
95
|
-
"Gryffindor",
|
|
96
|
-
"15' Elder Thestral tail hair core",
|
|
97
|
-
"Phoenix",
|
|
98
|
-
"Half-blood",
|
|
99
|
-
],
|
|
100
|
-
[
|
|
101
|
-
"5",
|
|
102
|
-
"Rubeus Hagrid",
|
|
103
|
-
"6 December 1928",
|
|
104
|
-
False,
|
|
105
|
-
"Gryffindor",
|
|
106
|
-
"16' Oak unknown core",
|
|
107
|
-
"None",
|
|
108
|
-
"Part-Human (Half-giant)",
|
|
109
|
-
],
|
|
110
|
-
[
|
|
111
|
-
"6",
|
|
112
|
-
"Fred Weasley",
|
|
113
|
-
"1 April, 1978",
|
|
114
|
-
True,
|
|
115
|
-
"Gryffindor",
|
|
116
|
-
"Unknown",
|
|
117
|
-
"Unknown",
|
|
118
|
-
"Pure-blood",
|
|
119
|
-
],
|
|
120
|
-
[
|
|
121
|
-
"7",
|
|
122
|
-
"George Weasley",
|
|
123
|
-
"1 April, 1978",
|
|
124
|
-
True,
|
|
125
|
-
"Gryffindor",
|
|
126
|
-
"Unknown",
|
|
127
|
-
"Unknown",
|
|
128
|
-
"Pure-blood",
|
|
129
|
-
],
|
|
130
|
-
]
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
code_show = """rx.chakra.hstack(
|
|
134
|
-
rx.chakra.divider(orientation="vertical", height="100vh", border="solid black 1px"),
|
|
135
|
-
rx.chakra.vstack(
|
|
136
|
-
rx.chakra.box(
|
|
137
|
-
rx.data_editor(
|
|
138
|
-
columns=DataTableState.cols,
|
|
139
|
-
data=DataTableState.data,
|
|
140
|
-
draw_focus_ring=True,
|
|
141
|
-
row_height=50,
|
|
142
|
-
smooth_scroll_x=True,
|
|
143
|
-
smooth_scroll_y=True,
|
|
144
|
-
column_select="single",
|
|
145
|
-
# style
|
|
146
|
-
theme=DataEditorTheme(**darkTheme),
|
|
147
|
-
width="80vw",
|
|
148
|
-
height="80vh",
|
|
149
|
-
),
|
|
150
|
-
),
|
|
151
|
-
rx.chakra.spacer(),
|
|
152
|
-
height="100vh",
|
|
153
|
-
spacing="25",
|
|
154
|
-
),
|
|
155
|
-
)"""
|
|
156
|
-
|
|
157
|
-
state_show = """class DataTableState(State):
|
|
158
|
-
cols: list[Any] = [
|
|
159
|
-
{"title": "Title", "type": "str"},
|
|
160
|
-
{
|
|
161
|
-
"title": "Name",
|
|
162
|
-
"type": "str",
|
|
163
|
-
"group": "Data",
|
|
164
|
-
"width": 300,
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
"title": "Birth",
|
|
168
|
-
"type": "str",
|
|
169
|
-
"group": "Data",
|
|
170
|
-
"width": 150,
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
"title": "Human",
|
|
174
|
-
"type": "bool",
|
|
175
|
-
"group": "Data",
|
|
176
|
-
"width": 80,
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
"title": "House",
|
|
180
|
-
"type": "str",
|
|
181
|
-
"group": "Data",
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
"title": "Wand",
|
|
185
|
-
"type": "str",
|
|
186
|
-
"group": "Data",
|
|
187
|
-
"width": 250,
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
"title": "Patronus",
|
|
191
|
-
"type": "str",
|
|
192
|
-
"group": "Data",
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
"title": "Blood status",
|
|
196
|
-
"type": "str",
|
|
197
|
-
"group": "Data",
|
|
198
|
-
"width": 200,
|
|
199
|
-
},
|
|
200
|
-
]"""
|
|
201
|
-
|
|
202
|
-
data_show = """[
|
|
203
|
-
["1", "Harry James Potter", "31 July 1980", True, "Gryffindor", "11' Holly phoenix feather", "Stag", "Half-blood"],
|
|
204
|
-
["2", "Ronald Bilius Weasley", "1 March 1980", True,"Gryffindor", "12' Ash unicorn tail hair", "Jack Russell terrier", "Pure-blood"],
|
|
205
|
-
["3", "Hermione Jean Granger", "19 September, 1979", True, "Gryffindor", "10¾' vine wood dragon heartstring", "Otter", "Muggle-born"],
|
|
206
|
-
["4", "Albus Percival Wulfric Brian Dumbledore", "Late August 1881", True, "Gryffindor", "15' Elder Thestral tail hair core", "Phoenix", "Half-blood"],
|
|
207
|
-
["5", "Rubeus Hagrid", "6 December 1928", False, "Gryffindor", "16' Oak unknown core", "None", "Part-Human (Half-giant)"],
|
|
208
|
-
["6", "Fred Weasley", "1 April, 1978", True, "Gryffindor", "Unknown", "Unknown", "Pure-blood"],
|
|
209
|
-
["7", "George Weasley", "1 April, 1978", True, "Gryffindor", "Unknown", "Unknown", "Pure-blood"],
|
|
210
|
-
]"""
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
darkTheme = {
|
|
214
|
-
"accent_color": "#8c96ff",
|
|
215
|
-
"accent_light": "rgba(202, 206, 255, 0.253)",
|
|
216
|
-
"text_dark": "#ffffff",
|
|
217
|
-
"text_medium": "#b8b8b8",
|
|
218
|
-
"text_light": "#a0a0a0",
|
|
219
|
-
"text_bubble": "#ffffff",
|
|
220
|
-
"bg_icon_header": "#b8b8b8",
|
|
221
|
-
"fg_icon_header": "#000000",
|
|
222
|
-
"text_header": "#a1a1a1",
|
|
223
|
-
"text_header_selected": "#000000",
|
|
224
|
-
"bg_cell": "#16161b",
|
|
225
|
-
"bg_cell_medium": "#202027",
|
|
226
|
-
"bg_header": "#212121",
|
|
227
|
-
"bg_header_has_focus": "#474747",
|
|
228
|
-
"bg_header_hovered": "#404040",
|
|
229
|
-
"bg_bubble": "#212121",
|
|
230
|
-
"bg_bubble_selected": "#000000",
|
|
231
|
-
"bg_search_result": "#423c24",
|
|
232
|
-
"border_color": "rgba(225,225,225,0.2)",
|
|
233
|
-
"drilldown_border": "rgba(225,225,225,0.4)",
|
|
234
|
-
"link_color": "#4F5DFF",
|
|
235
|
-
"header_font_style": "bold 14px",
|
|
236
|
-
"base_font_style": "13px",
|
|
237
|
-
"font_family": "Inter, Roboto, -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Ubuntu, noto, arial, sans-serif",
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
darkTheme_show = """darkTheme={
|
|
241
|
-
"accent_color": "#8c96ff",
|
|
242
|
-
"accent_light": "rgba(202, 206, 255, 0.253)",
|
|
243
|
-
"text_dark": "#ffffff",
|
|
244
|
-
"text_medium": "#b8b8b8",
|
|
245
|
-
"text_light": "#a0a0a0",
|
|
246
|
-
"text_bubble": "#ffffff",
|
|
247
|
-
"bg_icon_header": "#b8b8b8",
|
|
248
|
-
"fg_icon_header": "#000000",
|
|
249
|
-
"text_header": "#a1a1a1",
|
|
250
|
-
"text_header_selected": "#000000",
|
|
251
|
-
"bg_cell": "#16161b",
|
|
252
|
-
"bg_cell_medium": "#202027",
|
|
253
|
-
"bg_header": "#212121",
|
|
254
|
-
"bg_header_has_focus": "#474747",
|
|
255
|
-
"bg_header_hovered": "#404040",
|
|
256
|
-
"bg_bubble": "#212121",
|
|
257
|
-
"bg_bubble_selected": "#000000",
|
|
258
|
-
"bg_search_result": "#423c24",
|
|
259
|
-
"border_color": "rgba(225,225,225,0.2)",
|
|
260
|
-
"drilldown_border": "rgba(225,225,225,0.4)",
|
|
261
|
-
"link_color": "#4F5DFF",
|
|
262
|
-
"header_font_style": "bold 14px",
|
|
263
|
-
"base_font_style": "13px",
|
|
264
|
-
"font_family": "Inter, Roboto, -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Ubuntu, noto, arial, sans-serif",
|
|
265
|
-
}"""
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
def datatable_page() -> rx.Component:
|
|
269
|
-
"""The UI for the settings page.
|
|
270
|
-
|
|
271
|
-
Returns:
|
|
272
|
-
rx.Component: The UI for the settings page.
|
|
273
|
-
"""
|
|
274
|
-
return rx.chakra.box(
|
|
275
|
-
rx.chakra.vstack(
|
|
276
|
-
rx.chakra.heading(
|
|
277
|
-
"Data Table Demo",
|
|
278
|
-
font_size="3em",
|
|
279
|
-
),
|
|
280
|
-
rx.chakra.hstack(
|
|
281
|
-
rx.chakra.vstack(
|
|
282
|
-
rx.chakra.box(
|
|
283
|
-
rx.data_editor(
|
|
284
|
-
columns=DataTableState.cols,
|
|
285
|
-
data=DataTableState.data,
|
|
286
|
-
draw_focus_ring=True,
|
|
287
|
-
row_height=50,
|
|
288
|
-
smooth_scroll_x=True,
|
|
289
|
-
smooth_scroll_y=True,
|
|
290
|
-
column_select="single",
|
|
291
|
-
# style
|
|
292
|
-
theme=DataEditorTheme(**darkTheme),
|
|
293
|
-
width="80vw",
|
|
294
|
-
),
|
|
295
|
-
),
|
|
296
|
-
rx.chakra.spacer(),
|
|
297
|
-
spacing="25",
|
|
298
|
-
),
|
|
299
|
-
),
|
|
300
|
-
rx.chakra.tabs(
|
|
301
|
-
rx.chakra.tab_list(
|
|
302
|
-
rx.chakra.tab("Code", style=tab_style),
|
|
303
|
-
rx.chakra.tab("Data", style=tab_style),
|
|
304
|
-
rx.chakra.tab("State", style=tab_style),
|
|
305
|
-
rx.chakra.tab("Styling", style=tab_style),
|
|
306
|
-
padding_x=0,
|
|
307
|
-
),
|
|
308
|
-
rx.chakra.tab_panels(
|
|
309
|
-
rx.chakra.tab_panel(
|
|
310
|
-
rx.code_block(
|
|
311
|
-
code_show,
|
|
312
|
-
language="python",
|
|
313
|
-
show_line_numbers=True,
|
|
314
|
-
),
|
|
315
|
-
width="100%",
|
|
316
|
-
padding_x=0,
|
|
317
|
-
padding_y=".25em",
|
|
318
|
-
),
|
|
319
|
-
rx.chakra.tab_panel(
|
|
320
|
-
rx.code_block(
|
|
321
|
-
data_show,
|
|
322
|
-
language="python",
|
|
323
|
-
show_line_numbers=True,
|
|
324
|
-
),
|
|
325
|
-
width="100%",
|
|
326
|
-
padding_x=0,
|
|
327
|
-
padding_y=".25em",
|
|
328
|
-
),
|
|
329
|
-
rx.chakra.tab_panel(
|
|
330
|
-
rx.code_block(
|
|
331
|
-
state_show,
|
|
332
|
-
language="python",
|
|
333
|
-
show_line_numbers=True,
|
|
334
|
-
),
|
|
335
|
-
width="100%",
|
|
336
|
-
padding_x=0,
|
|
337
|
-
padding_y=".25em",
|
|
338
|
-
),
|
|
339
|
-
rx.chakra.tab_panel(
|
|
340
|
-
rx.code_block(
|
|
341
|
-
darkTheme_show,
|
|
342
|
-
language="python",
|
|
343
|
-
show_line_numbers=True,
|
|
344
|
-
),
|
|
345
|
-
width="100%",
|
|
346
|
-
padding_x=0,
|
|
347
|
-
padding_y=".25em",
|
|
348
|
-
),
|
|
349
|
-
width="100%",
|
|
350
|
-
),
|
|
351
|
-
variant="unstyled",
|
|
352
|
-
color_scheme="purple",
|
|
353
|
-
align="end",
|
|
354
|
-
width="100%",
|
|
355
|
-
padding_top=".5em",
|
|
356
|
-
),
|
|
357
|
-
style=template_content_style,
|
|
358
|
-
),
|
|
359
|
-
style=template_page_style,
|
|
360
|
-
)
|