reflex 0.5.9a1__py3-none-any.whl → 0.5.10__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/__init__.py +21 -2
- reflex/__init__.pyi +0 -1
- reflex/app.py +1 -1
- reflex/components/__init__.py +0 -1
- reflex/components/__init__.pyi +0 -1
- reflex/components/markdown/markdown.py +1 -1
- reflex/components/recharts/cartesian.py +3 -0
- reflex/components/recharts/cartesian.pyi +2 -0
- reflex/components/sonner/toast.py +27 -1
- reflex/components/sonner/toast.pyi +5 -0
- reflex/constants/base.py +2 -0
- reflex/constants/installer.py +2 -0
- reflex/experimental/hooks.py +1 -1
- reflex/reflex.py +0 -15
- reflex/state.py +22 -22
- reflex/testing.py +8 -3
- reflex/utils/net.py +43 -0
- reflex/utils/prerequisites.py +27 -126
- reflex/utils/registry.py +48 -0
- reflex/utils/types.py +1 -1
- reflex/vars.py +4 -2
- {reflex-0.5.9a1.dist-info → reflex-0.5.10.dist-info}/METADATA +2 -1
- {reflex-0.5.9a1.dist-info → reflex-0.5.10.dist-info}/RECORD +26 -167
- reflex/components/chakra/__init__.py +0 -204
- reflex/components/chakra/base.py +0 -210
- reflex/components/chakra/base.pyi +0 -319
- reflex/components/chakra/datadisplay/__init__.py +0 -10
- reflex/components/chakra/datadisplay/badge.py +0 -16
- reflex/components/chakra/datadisplay/badge.pyi +0 -96
- reflex/components/chakra/datadisplay/code.py +0 -11
- reflex/components/chakra/datadisplay/code.pyi +0 -87
- reflex/components/chakra/datadisplay/divider.py +0 -20
- reflex/components/chakra/datadisplay/divider.pyi +0 -100
- reflex/components/chakra/datadisplay/keyboard_key.py +0 -9
- reflex/components/chakra/datadisplay/keyboard_key.pyi +0 -87
- reflex/components/chakra/datadisplay/list.py +0 -60
- reflex/components/chakra/datadisplay/list.pyi +0 -339
- reflex/components/chakra/datadisplay/stat.py +0 -80
- reflex/components/chakra/datadisplay/stat.pyi +0 -477
- reflex/components/chakra/datadisplay/table.py +0 -305
- reflex/components/chakra/datadisplay/table.pyi +0 -737
- reflex/components/chakra/datadisplay/tag.py +0 -85
- reflex/components/chakra/datadisplay/tag.pyi +0 -433
- reflex/components/chakra/disclosure/__init__.py +0 -14
- reflex/components/chakra/disclosure/accordion.py +0 -110
- reflex/components/chakra/disclosure/accordion.pyi +0 -411
- reflex/components/chakra/disclosure/tabs.py +0 -117
- reflex/components/chakra/disclosure/tabs.pyi +0 -496
- reflex/components/chakra/disclosure/transition.py +0 -73
- reflex/components/chakra/disclosure/transition.pyi +0 -509
- reflex/components/chakra/disclosure/visuallyhidden.py +0 -9
- reflex/components/chakra/disclosure/visuallyhidden.pyi +0 -87
- reflex/components/chakra/feedback/__init__.py +0 -7
- reflex/components/chakra/feedback/alert.py +0 -68
- reflex/components/chakra/feedback/alert.pyi +0 -335
- reflex/components/chakra/feedback/circularprogress.py +0 -68
- reflex/components/chakra/feedback/circularprogress.pyi +0 -185
- reflex/components/chakra/feedback/progress.py +0 -33
- reflex/components/chakra/feedback/progress.pyi +0 -101
- reflex/components/chakra/feedback/skeleton.py +0 -70
- reflex/components/chakra/feedback/skeleton.pyi +0 -271
- reflex/components/chakra/feedback/spinner.py +0 -25
- reflex/components/chakra/feedback/spinner.pyi +0 -102
- reflex/components/chakra/forms/__init__.py +0 -49
- reflex/components/chakra/forms/button.py +0 -83
- reflex/components/chakra/forms/button.pyi +0 -262
- reflex/components/chakra/forms/checkbox.py +0 -77
- reflex/components/chakra/forms/checkbox.pyi +0 -247
- reflex/components/chakra/forms/colormodeswitch.py +0 -104
- reflex/components/chakra/forms/colormodeswitch.pyi +0 -473
- reflex/components/chakra/forms/date_picker.py +0 -11
- reflex/components/chakra/forms/date_picker.pyi +0 -129
- reflex/components/chakra/forms/date_time_picker.py +0 -11
- reflex/components/chakra/forms/date_time_picker.pyi +0 -129
- reflex/components/chakra/forms/editable.py +0 -67
- reflex/components/chakra/forms/editable.pyi +0 -343
- reflex/components/chakra/forms/email.py +0 -11
- reflex/components/chakra/forms/email.pyi +0 -129
- reflex/components/chakra/forms/form.py +0 -103
- reflex/components/chakra/forms/form.pyi +0 -484
- reflex/components/chakra/forms/iconbutton.py +0 -38
- reflex/components/chakra/forms/iconbutton.pyi +0 -108
- reflex/components/chakra/forms/input.py +0 -130
- reflex/components/chakra/forms/input.pyi +0 -566
- reflex/components/chakra/forms/multiselect.py +0 -355
- reflex/components/chakra/forms/numberinput.py +0 -128
- reflex/components/chakra/forms/numberinput.pyi +0 -442
- reflex/components/chakra/forms/password.py +0 -11
- reflex/components/chakra/forms/password.pyi +0 -129
- reflex/components/chakra/forms/pininput.py +0 -201
- reflex/components/chakra/forms/pininput.pyi +0 -215
- reflex/components/chakra/forms/radio.py +0 -101
- reflex/components/chakra/forms/radio.pyi +0 -197
- reflex/components/chakra/forms/rangeslider.py +0 -149
- reflex/components/chakra/forms/rangeslider.pyi +0 -354
- reflex/components/chakra/forms/select.py +0 -103
- reflex/components/chakra/forms/select.pyi +0 -204
- reflex/components/chakra/forms/slider.py +0 -130
- reflex/components/chakra/forms/slider.pyi +0 -449
- reflex/components/chakra/forms/switch.py +0 -49
- reflex/components/chakra/forms/switch.pyi +0 -159
- reflex/components/chakra/forms/textarea.py +0 -79
- reflex/components/chakra/forms/textarea.pyi +0 -123
- reflex/components/chakra/forms/time_picker.py +0 -11
- reflex/components/chakra/forms/time_picker.pyi +0 -129
- reflex/components/chakra/layout/__init__.py +0 -14
- reflex/components/chakra/layout/aspect_ratio.py +0 -13
- reflex/components/chakra/layout/aspect_ratio.pyi +0 -89
- reflex/components/chakra/layout/box.py +0 -31
- reflex/components/chakra/layout/box.pyi +0 -93
- reflex/components/chakra/layout/card.py +0 -100
- reflex/components/chakra/layout/card.pyi +0 -379
- reflex/components/chakra/layout/center.py +0 -21
- reflex/components/chakra/layout/center.pyi +0 -239
- reflex/components/chakra/layout/container.py +0 -13
- reflex/components/chakra/layout/container.pyi +0 -89
- reflex/components/chakra/layout/flex.py +0 -33
- reflex/components/chakra/layout/flex.pyi +0 -101
- reflex/components/chakra/layout/grid.py +0 -125
- reflex/components/chakra/layout/grid.pyi +0 -293
- reflex/components/chakra/layout/spacer.py +0 -9
- reflex/components/chakra/layout/spacer.pyi +0 -87
- reflex/components/chakra/layout/stack.py +0 -48
- reflex/components/chakra/layout/stack.pyi +0 -305
- reflex/components/chakra/layout/wrap.py +0 -57
- reflex/components/chakra/layout/wrap.pyi +0 -179
- reflex/components/chakra/media/__init__.py +0 -7
- reflex/components/chakra/media/avatar.py +0 -58
- reflex/components/chakra/media/avatar.pyi +0 -267
- reflex/components/chakra/media/icon.py +0 -111
- reflex/components/chakra/media/icon.pyi +0 -171
- reflex/components/chakra/media/image.py +0 -74
- reflex/components/chakra/media/image.pyi +0 -118
- reflex/components/chakra/navigation/__init__.py +0 -18
- reflex/components/chakra/navigation/breadcrumb.py +0 -98
- reflex/components/chakra/navigation/breadcrumb.pyi +0 -351
- reflex/components/chakra/navigation/link.py +0 -62
- reflex/components/chakra/navigation/link.pyi +0 -105
- reflex/components/chakra/navigation/linkoverlay.py +0 -22
- reflex/components/chakra/navigation/linkoverlay.pyi +0 -167
- reflex/components/chakra/navigation/stepper.py +0 -113
- reflex/components/chakra/navigation/stepper.pyi +0 -762
- reflex/components/chakra/overlay/__init__.py +0 -50
- reflex/components/chakra/overlay/alertdialog.py +0 -153
- reflex/components/chakra/overlay/alertdialog.pyi +0 -612
- reflex/components/chakra/overlay/drawer.py +0 -168
- reflex/components/chakra/overlay/drawer.pyi +0 -652
- reflex/components/chakra/overlay/menu.py +0 -225
- reflex/components/chakra/overlay/menu.pyi +0 -708
- reflex/components/chakra/overlay/modal.py +0 -166
- reflex/components/chakra/overlay/modal.pyi +0 -600
- reflex/components/chakra/overlay/popover.py +0 -183
- reflex/components/chakra/overlay/popover.pyi +0 -757
- reflex/components/chakra/overlay/tooltip.py +0 -70
- reflex/components/chakra/overlay/tooltip.pyi +0 -129
- reflex/components/chakra/typography/__init__.py +0 -10
- reflex/components/chakra/typography/heading.py +0 -16
- reflex/components/chakra/typography/heading.pyi +0 -96
- reflex/components/chakra/typography/highlight.py +0 -23
- reflex/components/chakra/typography/highlight.pyi +0 -91
- reflex/components/chakra/typography/span.py +0 -15
- reflex/components/chakra/typography/span.pyi +0 -89
- reflex/components/chakra/typography/text.py +0 -18
- reflex/components/chakra/typography/text.pyi +0 -91
- reflex/components/media/__init__.py +0 -1
- reflex/components/media/icon.py +0 -3
- {reflex-0.5.9a1.dist-info → reflex-0.5.10.dist-info}/LICENSE +0 -0
- {reflex-0.5.9a1.dist-info → reflex-0.5.10.dist-info}/WHEEL +0 -0
- {reflex-0.5.9a1.dist-info → reflex-0.5.10.dist-info}/entry_points.txt +0 -0
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"""A select component."""
|
|
2
|
-
|
|
3
|
-
from typing import Any, List
|
|
4
|
-
|
|
5
|
-
from reflex.components.chakra import ChakraComponent, LiteralInputVariant
|
|
6
|
-
from reflex.components.chakra.typography.text import Text
|
|
7
|
-
from reflex.components.component import Component
|
|
8
|
-
from reflex.components.core.foreach import Foreach
|
|
9
|
-
from reflex.event import EventHandler
|
|
10
|
-
from reflex.utils.types import _issubclass
|
|
11
|
-
from reflex.vars import Var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class Select(ChakraComponent):
|
|
15
|
-
"""Select component is a component that allows users pick a value from predefined options. Ideally, it should be used when there are more than 5 options, otherwise you might consider using a radio group instead."""
|
|
16
|
-
|
|
17
|
-
tag = "Select"
|
|
18
|
-
|
|
19
|
-
# State var to bind the select.
|
|
20
|
-
value: Var[str]
|
|
21
|
-
|
|
22
|
-
# The default value of the select.
|
|
23
|
-
default_value: Var[str]
|
|
24
|
-
|
|
25
|
-
# The placeholder text.
|
|
26
|
-
placeholder: Var[str]
|
|
27
|
-
|
|
28
|
-
# The border color when the select is invalid.
|
|
29
|
-
error_border_color: Var[str]
|
|
30
|
-
|
|
31
|
-
# The border color when the select is focused.
|
|
32
|
-
focus_border_color: Var[str]
|
|
33
|
-
|
|
34
|
-
# If true, the select will be disabled.
|
|
35
|
-
is_disabled: Var[bool]
|
|
36
|
-
|
|
37
|
-
# If true, the form control will be invalid. This has 2 side effects: - The FormLabel and FormErrorIcon will have `data-invalid` set to true - The form element (e.g, Input) will have `aria-invalid` set to true
|
|
38
|
-
is_invalid: Var[bool]
|
|
39
|
-
|
|
40
|
-
# If true, the form control will be required. This has 2 side effects: - The FormLabel will show a required indicator - The form element (e.g, Input) will have `aria-required` set to true
|
|
41
|
-
is_required: Var[bool]
|
|
42
|
-
|
|
43
|
-
# "outline" | "filled" | "flushed" | "unstyled"
|
|
44
|
-
variant: Var[LiteralInputVariant]
|
|
45
|
-
|
|
46
|
-
# The size of the select.
|
|
47
|
-
size: Var[str]
|
|
48
|
-
|
|
49
|
-
# The name of the form field
|
|
50
|
-
name: Var[str]
|
|
51
|
-
|
|
52
|
-
# Fired when the value changes.
|
|
53
|
-
on_change: EventHandler[lambda e0: [e0.target.value]]
|
|
54
|
-
|
|
55
|
-
@classmethod
|
|
56
|
-
def create(cls, *children, **props) -> Component:
|
|
57
|
-
"""Create a select component.
|
|
58
|
-
|
|
59
|
-
If a list is provided as the first children, a default component
|
|
60
|
-
will be created for each item in the list.
|
|
61
|
-
|
|
62
|
-
Args:
|
|
63
|
-
*children: The children of the component.
|
|
64
|
-
**props: The props of the component.
|
|
65
|
-
|
|
66
|
-
Returns:
|
|
67
|
-
The component.
|
|
68
|
-
"""
|
|
69
|
-
if len(children) == 1 and isinstance(children[0], list):
|
|
70
|
-
children = [Option.create(child) for child in children[0]]
|
|
71
|
-
if (
|
|
72
|
-
len(children) == 1
|
|
73
|
-
and isinstance(children[0], Var)
|
|
74
|
-
and _issubclass(children[0]._var_type, List)
|
|
75
|
-
):
|
|
76
|
-
children = [Foreach.create(children[0], lambda item: Option.create(item))]
|
|
77
|
-
return super().create(*children, **props)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
class Option(Text):
|
|
81
|
-
"""A select option."""
|
|
82
|
-
|
|
83
|
-
tag = "option"
|
|
84
|
-
|
|
85
|
-
value: Var[Any]
|
|
86
|
-
|
|
87
|
-
@classmethod
|
|
88
|
-
def create(cls, *children, **props) -> Component:
|
|
89
|
-
"""Create a select option component.
|
|
90
|
-
|
|
91
|
-
By default, the value of the option is the text of the option.
|
|
92
|
-
|
|
93
|
-
Args:
|
|
94
|
-
*children: The children of the component.
|
|
95
|
-
**props: The props of the component.
|
|
96
|
-
|
|
97
|
-
Returns:
|
|
98
|
-
The component.
|
|
99
|
-
"""
|
|
100
|
-
if "value" not in props:
|
|
101
|
-
assert len(children) == 1
|
|
102
|
-
props["value"] = children[0]
|
|
103
|
-
return super().create(*children, **props)
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
"""Stub file for reflex/components/chakra/forms/select.py"""
|
|
2
|
-
|
|
3
|
-
# ------------------- DO NOT EDIT ----------------------
|
|
4
|
-
# This file was generated by `reflex/utils/pyi_generator.py`!
|
|
5
|
-
# ------------------------------------------------------
|
|
6
|
-
from typing import Any, Callable, Dict, Literal, Optional, Union, overload
|
|
7
|
-
|
|
8
|
-
from reflex.components.chakra import ChakraComponent
|
|
9
|
-
from reflex.components.chakra.typography.text import Text
|
|
10
|
-
from reflex.event import EventHandler, EventSpec
|
|
11
|
-
from reflex.style import Style
|
|
12
|
-
from reflex.vars import BaseVar, Var
|
|
13
|
-
|
|
14
|
-
class Select(ChakraComponent):
|
|
15
|
-
@overload
|
|
16
|
-
@classmethod
|
|
17
|
-
def create( # type: ignore
|
|
18
|
-
cls,
|
|
19
|
-
*children,
|
|
20
|
-
value: Optional[Union[Var[str], str]] = None,
|
|
21
|
-
default_value: Optional[Union[Var[str], str]] = None,
|
|
22
|
-
placeholder: Optional[Union[Var[str], str]] = None,
|
|
23
|
-
error_border_color: Optional[Union[Var[str], str]] = None,
|
|
24
|
-
focus_border_color: Optional[Union[Var[str], str]] = None,
|
|
25
|
-
is_disabled: Optional[Union[Var[bool], bool]] = None,
|
|
26
|
-
is_invalid: Optional[Union[Var[bool], bool]] = None,
|
|
27
|
-
is_required: Optional[Union[Var[bool], bool]] = None,
|
|
28
|
-
variant: Optional[
|
|
29
|
-
Union[
|
|
30
|
-
Var[Literal["outline", "filled", "flushed", "unstyled"]],
|
|
31
|
-
Literal["outline", "filled", "flushed", "unstyled"],
|
|
32
|
-
]
|
|
33
|
-
] = None,
|
|
34
|
-
size: Optional[Union[Var[str], str]] = None,
|
|
35
|
-
name: Optional[Union[Var[str], str]] = None,
|
|
36
|
-
style: Optional[Style] = None,
|
|
37
|
-
key: Optional[Any] = None,
|
|
38
|
-
id: Optional[Any] = None,
|
|
39
|
-
class_name: Optional[Any] = None,
|
|
40
|
-
autofocus: Optional[bool] = None,
|
|
41
|
-
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
42
|
-
on_blur: Optional[
|
|
43
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
44
|
-
] = None,
|
|
45
|
-
on_change: Optional[
|
|
46
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
47
|
-
] = None,
|
|
48
|
-
on_click: Optional[
|
|
49
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
50
|
-
] = None,
|
|
51
|
-
on_context_menu: Optional[
|
|
52
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
53
|
-
] = None,
|
|
54
|
-
on_double_click: Optional[
|
|
55
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
56
|
-
] = None,
|
|
57
|
-
on_focus: Optional[
|
|
58
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
59
|
-
] = None,
|
|
60
|
-
on_mount: Optional[
|
|
61
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
62
|
-
] = None,
|
|
63
|
-
on_mouse_down: Optional[
|
|
64
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
65
|
-
] = None,
|
|
66
|
-
on_mouse_enter: Optional[
|
|
67
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
68
|
-
] = None,
|
|
69
|
-
on_mouse_leave: Optional[
|
|
70
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
71
|
-
] = None,
|
|
72
|
-
on_mouse_move: Optional[
|
|
73
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
74
|
-
] = None,
|
|
75
|
-
on_mouse_out: Optional[
|
|
76
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
77
|
-
] = None,
|
|
78
|
-
on_mouse_over: Optional[
|
|
79
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
80
|
-
] = None,
|
|
81
|
-
on_mouse_up: Optional[
|
|
82
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
83
|
-
] = None,
|
|
84
|
-
on_scroll: Optional[
|
|
85
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
86
|
-
] = None,
|
|
87
|
-
on_unmount: Optional[
|
|
88
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
89
|
-
] = None,
|
|
90
|
-
**props,
|
|
91
|
-
) -> "Select":
|
|
92
|
-
"""Create a select component.
|
|
93
|
-
|
|
94
|
-
If a list is provided as the first children, a default component
|
|
95
|
-
will be created for each item in the list.
|
|
96
|
-
|
|
97
|
-
Args:
|
|
98
|
-
*children: The children of the component.
|
|
99
|
-
value: State var to bind the select.
|
|
100
|
-
default_value: The default value of the select.
|
|
101
|
-
placeholder: The placeholder text.
|
|
102
|
-
error_border_color: The border color when the select is invalid.
|
|
103
|
-
focus_border_color: The border color when the select is focused.
|
|
104
|
-
is_disabled: If true, the select will be disabled.
|
|
105
|
-
is_invalid: If true, the form control will be invalid. This has 2 side effects: - The FormLabel and FormErrorIcon will have `data-invalid` set to true - The form element (e.g, Input) will have `aria-invalid` set to true
|
|
106
|
-
is_required: If true, the form control will be required. This has 2 side effects: - The FormLabel will show a required indicator - The form element (e.g, Input) will have `aria-required` set to true
|
|
107
|
-
variant: "outline" | "filled" | "flushed" | "unstyled"
|
|
108
|
-
size: The size of the select.
|
|
109
|
-
name: The name of the form field
|
|
110
|
-
style: The style of the component.
|
|
111
|
-
key: A unique key for the component.
|
|
112
|
-
id: The id for the component.
|
|
113
|
-
class_name: The class name for the component.
|
|
114
|
-
autofocus: Whether the component should take the focus once the page is loaded
|
|
115
|
-
custom_attrs: custom attribute
|
|
116
|
-
**props: The props of the component.
|
|
117
|
-
|
|
118
|
-
Returns:
|
|
119
|
-
The component.
|
|
120
|
-
"""
|
|
121
|
-
...
|
|
122
|
-
|
|
123
|
-
class Option(Text):
|
|
124
|
-
@overload
|
|
125
|
-
@classmethod
|
|
126
|
-
def create( # type: ignore
|
|
127
|
-
cls,
|
|
128
|
-
*children,
|
|
129
|
-
value: Optional[Union[Var[Any], Any]] = None,
|
|
130
|
-
as_: Optional[Union[Var[str], str]] = None,
|
|
131
|
-
no_of_lines: Optional[Union[Var[int], int]] = None,
|
|
132
|
-
style: Optional[Style] = None,
|
|
133
|
-
key: Optional[Any] = None,
|
|
134
|
-
id: Optional[Any] = None,
|
|
135
|
-
class_name: Optional[Any] = None,
|
|
136
|
-
autofocus: Optional[bool] = None,
|
|
137
|
-
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
138
|
-
on_blur: Optional[
|
|
139
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
140
|
-
] = None,
|
|
141
|
-
on_click: Optional[
|
|
142
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
143
|
-
] = None,
|
|
144
|
-
on_context_menu: Optional[
|
|
145
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
146
|
-
] = None,
|
|
147
|
-
on_double_click: Optional[
|
|
148
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
149
|
-
] = None,
|
|
150
|
-
on_focus: Optional[
|
|
151
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
152
|
-
] = None,
|
|
153
|
-
on_mount: Optional[
|
|
154
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
155
|
-
] = None,
|
|
156
|
-
on_mouse_down: Optional[
|
|
157
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
158
|
-
] = None,
|
|
159
|
-
on_mouse_enter: Optional[
|
|
160
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
161
|
-
] = None,
|
|
162
|
-
on_mouse_leave: Optional[
|
|
163
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
164
|
-
] = None,
|
|
165
|
-
on_mouse_move: Optional[
|
|
166
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
167
|
-
] = None,
|
|
168
|
-
on_mouse_out: Optional[
|
|
169
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
170
|
-
] = None,
|
|
171
|
-
on_mouse_over: Optional[
|
|
172
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
173
|
-
] = None,
|
|
174
|
-
on_mouse_up: Optional[
|
|
175
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
176
|
-
] = None,
|
|
177
|
-
on_scroll: Optional[
|
|
178
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
179
|
-
] = None,
|
|
180
|
-
on_unmount: Optional[
|
|
181
|
-
Union[EventHandler, EventSpec, list, Callable, BaseVar]
|
|
182
|
-
] = None,
|
|
183
|
-
**props,
|
|
184
|
-
) -> "Option":
|
|
185
|
-
"""Create a select option component.
|
|
186
|
-
|
|
187
|
-
By default, the value of the option is the text of the option.
|
|
188
|
-
|
|
189
|
-
Args:
|
|
190
|
-
*children: The children of the component.
|
|
191
|
-
as_: Override the tag. The default tag is `<p>`.
|
|
192
|
-
no_of_lines: Truncate text after a specific number of lines. It will render an ellipsis when the text exceeds the width of the viewport or max_width prop.
|
|
193
|
-
style: The style of the component.
|
|
194
|
-
key: A unique key for the component.
|
|
195
|
-
id: The id for the component.
|
|
196
|
-
class_name: The class name for the component.
|
|
197
|
-
autofocus: Whether the component should take the focus once the page is loaded
|
|
198
|
-
custom_attrs: custom attribute
|
|
199
|
-
**props: The props of the component.
|
|
200
|
-
|
|
201
|
-
Returns:
|
|
202
|
-
The component.
|
|
203
|
-
"""
|
|
204
|
-
...
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"""A slider component."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from typing import Literal
|
|
6
|
-
|
|
7
|
-
from reflex.components.chakra import ChakraComponent, LiteralChakraDirection
|
|
8
|
-
from reflex.components.component import Component
|
|
9
|
-
from reflex.event import EventHandler
|
|
10
|
-
from reflex.vars import Var
|
|
11
|
-
|
|
12
|
-
LiteralLayout = Literal["horizontal", "vertical"]
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class Slider(ChakraComponent):
|
|
16
|
-
"""The wrapper that provides context and functionality for all children."""
|
|
17
|
-
|
|
18
|
-
tag = "Slider"
|
|
19
|
-
|
|
20
|
-
# State var to bind the input.
|
|
21
|
-
value: Var[int]
|
|
22
|
-
|
|
23
|
-
# The color scheme.
|
|
24
|
-
color_scheme: Var[str]
|
|
25
|
-
|
|
26
|
-
# The placeholder text.
|
|
27
|
-
default_value: Var[int]
|
|
28
|
-
|
|
29
|
-
# The writing mode ("ltr" | "rtl")
|
|
30
|
-
direction: Var[LiteralChakraDirection]
|
|
31
|
-
|
|
32
|
-
# If false, the slider handle will not capture focus when value changes.
|
|
33
|
-
focus_thumb_on_change: Var[bool]
|
|
34
|
-
|
|
35
|
-
# If true, the slider will be disabled
|
|
36
|
-
is_disabled: Var[bool]
|
|
37
|
-
|
|
38
|
-
# If true, the slider will be in `read-only` state.
|
|
39
|
-
is_read_only: Var[bool]
|
|
40
|
-
|
|
41
|
-
# If true, the value will be incremented or decremented in reverse.
|
|
42
|
-
is_reversed: Var[bool]
|
|
43
|
-
|
|
44
|
-
# The minimum value of the slider.
|
|
45
|
-
min_: Var[int]
|
|
46
|
-
|
|
47
|
-
# The maximum value of the slider.
|
|
48
|
-
max_: Var[int]
|
|
49
|
-
|
|
50
|
-
# The step in which increments/decrements have to be made
|
|
51
|
-
step: Var[int]
|
|
52
|
-
|
|
53
|
-
# The minimum distance between slider thumbs. Useful for preventing the thumbs from being too close together.
|
|
54
|
-
min_steps_between_thumbs: Var[int]
|
|
55
|
-
|
|
56
|
-
# Oreintation of the slider vertical | horizontal.
|
|
57
|
-
orientation: Var[LiteralLayout]
|
|
58
|
-
|
|
59
|
-
# Minimum height of the slider.
|
|
60
|
-
min_h: Var[str]
|
|
61
|
-
|
|
62
|
-
# Minimum width of the slider.
|
|
63
|
-
min_w: Var[str]
|
|
64
|
-
|
|
65
|
-
# Maximum height of the slider.
|
|
66
|
-
max_h: Var[str]
|
|
67
|
-
|
|
68
|
-
# Maximum width of the slider.
|
|
69
|
-
max_w: Var[str]
|
|
70
|
-
|
|
71
|
-
# The name of the form field
|
|
72
|
-
name: Var[str]
|
|
73
|
-
|
|
74
|
-
# Fired when the value changes.
|
|
75
|
-
on_change: EventHandler[lambda e0: [e0]]
|
|
76
|
-
|
|
77
|
-
# Fired when the value starts changing.
|
|
78
|
-
on_change_start: EventHandler[lambda e0: [e0]]
|
|
79
|
-
|
|
80
|
-
# Fired when the value stops changing.
|
|
81
|
-
on_change_end: EventHandler[lambda e0: [e0]]
|
|
82
|
-
|
|
83
|
-
@classmethod
|
|
84
|
-
def create(cls, *children, **props) -> Component:
|
|
85
|
-
"""Create a slider component.
|
|
86
|
-
|
|
87
|
-
If no children are provided, a default slider will be created.
|
|
88
|
-
|
|
89
|
-
Args:
|
|
90
|
-
*children: The children of the component.
|
|
91
|
-
**props: The properties of the component.
|
|
92
|
-
|
|
93
|
-
Returns:
|
|
94
|
-
The slider component.
|
|
95
|
-
"""
|
|
96
|
-
if len(children) == 0:
|
|
97
|
-
children = [
|
|
98
|
-
SliderTrack.create(
|
|
99
|
-
SliderFilledTrack.create(),
|
|
100
|
-
),
|
|
101
|
-
SliderThumb.create(),
|
|
102
|
-
]
|
|
103
|
-
return super().create(*children, **props)
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
class SliderTrack(ChakraComponent):
|
|
107
|
-
"""The empty part of the slider that shows the track."""
|
|
108
|
-
|
|
109
|
-
tag = "SliderTrack"
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
class SliderFilledTrack(ChakraComponent):
|
|
113
|
-
"""The filled part of the slider."""
|
|
114
|
-
|
|
115
|
-
tag = "SliderFilledTrack"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
class SliderThumb(ChakraComponent):
|
|
119
|
-
"""The handle that's used to change the slider value."""
|
|
120
|
-
|
|
121
|
-
tag = "SliderThumb"
|
|
122
|
-
|
|
123
|
-
# The size of the thumb.
|
|
124
|
-
box_size: Var[str]
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
class SliderMark(ChakraComponent):
|
|
128
|
-
"""The label or mark that shows names for specific slider values."""
|
|
129
|
-
|
|
130
|
-
tag = "SliderMark"
|