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.

Files changed (169) hide show
  1. reflex/__init__.py +21 -2
  2. reflex/__init__.pyi +0 -1
  3. reflex/app.py +1 -1
  4. reflex/components/__init__.py +0 -1
  5. reflex/components/__init__.pyi +0 -1
  6. reflex/components/markdown/markdown.py +1 -1
  7. reflex/components/recharts/cartesian.py +3 -0
  8. reflex/components/recharts/cartesian.pyi +2 -0
  9. reflex/components/sonner/toast.py +27 -1
  10. reflex/components/sonner/toast.pyi +5 -0
  11. reflex/constants/base.py +2 -0
  12. reflex/constants/installer.py +2 -0
  13. reflex/experimental/hooks.py +1 -1
  14. reflex/reflex.py +0 -15
  15. reflex/state.py +22 -22
  16. reflex/testing.py +8 -3
  17. reflex/utils/net.py +43 -0
  18. reflex/utils/prerequisites.py +27 -126
  19. reflex/utils/registry.py +48 -0
  20. reflex/utils/types.py +1 -1
  21. reflex/vars.py +4 -2
  22. {reflex-0.5.9a1.dist-info → reflex-0.5.10.dist-info}/METADATA +2 -1
  23. {reflex-0.5.9a1.dist-info → reflex-0.5.10.dist-info}/RECORD +26 -167
  24. reflex/components/chakra/__init__.py +0 -204
  25. reflex/components/chakra/base.py +0 -210
  26. reflex/components/chakra/base.pyi +0 -319
  27. reflex/components/chakra/datadisplay/__init__.py +0 -10
  28. reflex/components/chakra/datadisplay/badge.py +0 -16
  29. reflex/components/chakra/datadisplay/badge.pyi +0 -96
  30. reflex/components/chakra/datadisplay/code.py +0 -11
  31. reflex/components/chakra/datadisplay/code.pyi +0 -87
  32. reflex/components/chakra/datadisplay/divider.py +0 -20
  33. reflex/components/chakra/datadisplay/divider.pyi +0 -100
  34. reflex/components/chakra/datadisplay/keyboard_key.py +0 -9
  35. reflex/components/chakra/datadisplay/keyboard_key.pyi +0 -87
  36. reflex/components/chakra/datadisplay/list.py +0 -60
  37. reflex/components/chakra/datadisplay/list.pyi +0 -339
  38. reflex/components/chakra/datadisplay/stat.py +0 -80
  39. reflex/components/chakra/datadisplay/stat.pyi +0 -477
  40. reflex/components/chakra/datadisplay/table.py +0 -305
  41. reflex/components/chakra/datadisplay/table.pyi +0 -737
  42. reflex/components/chakra/datadisplay/tag.py +0 -85
  43. reflex/components/chakra/datadisplay/tag.pyi +0 -433
  44. reflex/components/chakra/disclosure/__init__.py +0 -14
  45. reflex/components/chakra/disclosure/accordion.py +0 -110
  46. reflex/components/chakra/disclosure/accordion.pyi +0 -411
  47. reflex/components/chakra/disclosure/tabs.py +0 -117
  48. reflex/components/chakra/disclosure/tabs.pyi +0 -496
  49. reflex/components/chakra/disclosure/transition.py +0 -73
  50. reflex/components/chakra/disclosure/transition.pyi +0 -509
  51. reflex/components/chakra/disclosure/visuallyhidden.py +0 -9
  52. reflex/components/chakra/disclosure/visuallyhidden.pyi +0 -87
  53. reflex/components/chakra/feedback/__init__.py +0 -7
  54. reflex/components/chakra/feedback/alert.py +0 -68
  55. reflex/components/chakra/feedback/alert.pyi +0 -335
  56. reflex/components/chakra/feedback/circularprogress.py +0 -68
  57. reflex/components/chakra/feedback/circularprogress.pyi +0 -185
  58. reflex/components/chakra/feedback/progress.py +0 -33
  59. reflex/components/chakra/feedback/progress.pyi +0 -101
  60. reflex/components/chakra/feedback/skeleton.py +0 -70
  61. reflex/components/chakra/feedback/skeleton.pyi +0 -271
  62. reflex/components/chakra/feedback/spinner.py +0 -25
  63. reflex/components/chakra/feedback/spinner.pyi +0 -102
  64. reflex/components/chakra/forms/__init__.py +0 -49
  65. reflex/components/chakra/forms/button.py +0 -83
  66. reflex/components/chakra/forms/button.pyi +0 -262
  67. reflex/components/chakra/forms/checkbox.py +0 -77
  68. reflex/components/chakra/forms/checkbox.pyi +0 -247
  69. reflex/components/chakra/forms/colormodeswitch.py +0 -104
  70. reflex/components/chakra/forms/colormodeswitch.pyi +0 -473
  71. reflex/components/chakra/forms/date_picker.py +0 -11
  72. reflex/components/chakra/forms/date_picker.pyi +0 -129
  73. reflex/components/chakra/forms/date_time_picker.py +0 -11
  74. reflex/components/chakra/forms/date_time_picker.pyi +0 -129
  75. reflex/components/chakra/forms/editable.py +0 -67
  76. reflex/components/chakra/forms/editable.pyi +0 -343
  77. reflex/components/chakra/forms/email.py +0 -11
  78. reflex/components/chakra/forms/email.pyi +0 -129
  79. reflex/components/chakra/forms/form.py +0 -103
  80. reflex/components/chakra/forms/form.pyi +0 -484
  81. reflex/components/chakra/forms/iconbutton.py +0 -38
  82. reflex/components/chakra/forms/iconbutton.pyi +0 -108
  83. reflex/components/chakra/forms/input.py +0 -130
  84. reflex/components/chakra/forms/input.pyi +0 -566
  85. reflex/components/chakra/forms/multiselect.py +0 -355
  86. reflex/components/chakra/forms/numberinput.py +0 -128
  87. reflex/components/chakra/forms/numberinput.pyi +0 -442
  88. reflex/components/chakra/forms/password.py +0 -11
  89. reflex/components/chakra/forms/password.pyi +0 -129
  90. reflex/components/chakra/forms/pininput.py +0 -201
  91. reflex/components/chakra/forms/pininput.pyi +0 -215
  92. reflex/components/chakra/forms/radio.py +0 -101
  93. reflex/components/chakra/forms/radio.pyi +0 -197
  94. reflex/components/chakra/forms/rangeslider.py +0 -149
  95. reflex/components/chakra/forms/rangeslider.pyi +0 -354
  96. reflex/components/chakra/forms/select.py +0 -103
  97. reflex/components/chakra/forms/select.pyi +0 -204
  98. reflex/components/chakra/forms/slider.py +0 -130
  99. reflex/components/chakra/forms/slider.pyi +0 -449
  100. reflex/components/chakra/forms/switch.py +0 -49
  101. reflex/components/chakra/forms/switch.pyi +0 -159
  102. reflex/components/chakra/forms/textarea.py +0 -79
  103. reflex/components/chakra/forms/textarea.pyi +0 -123
  104. reflex/components/chakra/forms/time_picker.py +0 -11
  105. reflex/components/chakra/forms/time_picker.pyi +0 -129
  106. reflex/components/chakra/layout/__init__.py +0 -14
  107. reflex/components/chakra/layout/aspect_ratio.py +0 -13
  108. reflex/components/chakra/layout/aspect_ratio.pyi +0 -89
  109. reflex/components/chakra/layout/box.py +0 -31
  110. reflex/components/chakra/layout/box.pyi +0 -93
  111. reflex/components/chakra/layout/card.py +0 -100
  112. reflex/components/chakra/layout/card.pyi +0 -379
  113. reflex/components/chakra/layout/center.py +0 -21
  114. reflex/components/chakra/layout/center.pyi +0 -239
  115. reflex/components/chakra/layout/container.py +0 -13
  116. reflex/components/chakra/layout/container.pyi +0 -89
  117. reflex/components/chakra/layout/flex.py +0 -33
  118. reflex/components/chakra/layout/flex.pyi +0 -101
  119. reflex/components/chakra/layout/grid.py +0 -125
  120. reflex/components/chakra/layout/grid.pyi +0 -293
  121. reflex/components/chakra/layout/spacer.py +0 -9
  122. reflex/components/chakra/layout/spacer.pyi +0 -87
  123. reflex/components/chakra/layout/stack.py +0 -48
  124. reflex/components/chakra/layout/stack.pyi +0 -305
  125. reflex/components/chakra/layout/wrap.py +0 -57
  126. reflex/components/chakra/layout/wrap.pyi +0 -179
  127. reflex/components/chakra/media/__init__.py +0 -7
  128. reflex/components/chakra/media/avatar.py +0 -58
  129. reflex/components/chakra/media/avatar.pyi +0 -267
  130. reflex/components/chakra/media/icon.py +0 -111
  131. reflex/components/chakra/media/icon.pyi +0 -171
  132. reflex/components/chakra/media/image.py +0 -74
  133. reflex/components/chakra/media/image.pyi +0 -118
  134. reflex/components/chakra/navigation/__init__.py +0 -18
  135. reflex/components/chakra/navigation/breadcrumb.py +0 -98
  136. reflex/components/chakra/navigation/breadcrumb.pyi +0 -351
  137. reflex/components/chakra/navigation/link.py +0 -62
  138. reflex/components/chakra/navigation/link.pyi +0 -105
  139. reflex/components/chakra/navigation/linkoverlay.py +0 -22
  140. reflex/components/chakra/navigation/linkoverlay.pyi +0 -167
  141. reflex/components/chakra/navigation/stepper.py +0 -113
  142. reflex/components/chakra/navigation/stepper.pyi +0 -762
  143. reflex/components/chakra/overlay/__init__.py +0 -50
  144. reflex/components/chakra/overlay/alertdialog.py +0 -153
  145. reflex/components/chakra/overlay/alertdialog.pyi +0 -612
  146. reflex/components/chakra/overlay/drawer.py +0 -168
  147. reflex/components/chakra/overlay/drawer.pyi +0 -652
  148. reflex/components/chakra/overlay/menu.py +0 -225
  149. reflex/components/chakra/overlay/menu.pyi +0 -708
  150. reflex/components/chakra/overlay/modal.py +0 -166
  151. reflex/components/chakra/overlay/modal.pyi +0 -600
  152. reflex/components/chakra/overlay/popover.py +0 -183
  153. reflex/components/chakra/overlay/popover.pyi +0 -757
  154. reflex/components/chakra/overlay/tooltip.py +0 -70
  155. reflex/components/chakra/overlay/tooltip.pyi +0 -129
  156. reflex/components/chakra/typography/__init__.py +0 -10
  157. reflex/components/chakra/typography/heading.py +0 -16
  158. reflex/components/chakra/typography/heading.pyi +0 -96
  159. reflex/components/chakra/typography/highlight.py +0 -23
  160. reflex/components/chakra/typography/highlight.pyi +0 -91
  161. reflex/components/chakra/typography/span.py +0 -15
  162. reflex/components/chakra/typography/span.pyi +0 -89
  163. reflex/components/chakra/typography/text.py +0 -18
  164. reflex/components/chakra/typography/text.pyi +0 -91
  165. reflex/components/media/__init__.py +0 -1
  166. reflex/components/media/icon.py +0 -3
  167. {reflex-0.5.9a1.dist-info → reflex-0.5.10.dist-info}/LICENSE +0 -0
  168. {reflex-0.5.9a1.dist-info → reflex-0.5.10.dist-info}/WHEEL +0 -0
  169. {reflex-0.5.9a1.dist-info → reflex-0.5.10.dist-info}/entry_points.txt +0 -0
@@ -1,201 +0,0 @@
1
- """A pin input component."""
2
-
3
- from __future__ import annotations
4
-
5
- from typing import Optional
6
-
7
- from reflex.components.chakra import ChakraComponent, LiteralInputVariant
8
- from reflex.components.component import Component
9
- from reflex.components.tags.tag import Tag
10
- from reflex.event import EventHandler
11
- from reflex.utils import format
12
- from reflex.utils.imports import ImportDict, merge_imports
13
- from reflex.vars import Var
14
-
15
-
16
- class PinInput(ChakraComponent):
17
- """The component that provides context to all the pin-input fields."""
18
-
19
- tag = "PinInput"
20
-
21
- # State var to bind the input.
22
- value: Var[str]
23
-
24
- # If true, the pin input receives focus on mount
25
- auto_focus: Var[bool]
26
-
27
- # The default value of the pin input
28
- default_value: Var[str]
29
-
30
- # The border color when the input is invalid.
31
- error_border_color: Var[str]
32
-
33
- # The border color when the input is focused.
34
- focus_border_color: Var[str]
35
-
36
- # The top-level id string that will be applied to the input fields. The index of the input will be appended to this top-level id.
37
- id_: Var[str]
38
-
39
- # The length of the number input.
40
- length: Var[int]
41
-
42
- # If true, the pin input component is put in the disabled state
43
- is_disabled: Var[bool]
44
-
45
- # If true, the pin input component is put in the invalid state
46
- is_invalid: Var[bool]
47
-
48
- # If true, focus will move automatically to the next input once filled
49
- manage_focus: Var[bool]
50
-
51
- # If true, the input's value will be masked just like `type=password`
52
- mask: Var[bool]
53
-
54
- # The placeholder for the pin input
55
- placeholder: Var[str]
56
-
57
- # The type of values the pin-input should allow ("number" | "alphanumeric").
58
- type_: Var[str]
59
-
60
- # "outline" | "flushed" | "filled" | "unstyled"
61
- variant: Var[LiteralInputVariant]
62
-
63
- # The name of the form field
64
- name: Var[str]
65
-
66
- # Fired when the pin input is changed.
67
- on_change: EventHandler[lambda e0: [e0]]
68
-
69
- # Fired when the pin input is completed.
70
- on_complete: EventHandler[lambda e0: [e0]]
71
-
72
- def _get_imports(self) -> ImportDict:
73
- """Include PinInputField explicitly because it may not be a child component at compile time.
74
-
75
- Returns:
76
- The merged import dict.
77
- """
78
- range_var = Var.range(0)
79
- return merge_imports(
80
- super()._get_imports(),
81
- PinInputField()._get_all_imports(), # type: ignore
82
- range_var._var_data.imports if range_var._var_data is not None else {},
83
- )
84
-
85
- def get_ref(self) -> str | None:
86
- """Override ref handling to handle array refs.
87
-
88
- PinInputFields may be created dynamically, so it's not possible
89
- to compute their ref at compile time, so we return a cheating
90
- guess if the id is specified.
91
-
92
- The `ref` for this outer component will always be stripped off, so what
93
- is returned here only matters for form ref collection purposes.
94
-
95
- Returns:
96
- None.
97
- """
98
- if any(isinstance(c, PinInputField) for c in self.children):
99
- return None
100
- if self.id:
101
- return format.format_array_ref(self.id, idx=self.length)
102
- return super().get_ref()
103
-
104
- def _get_ref_hook(self) -> Optional[str]:
105
- """Override the base _get_ref_hook to handle array refs.
106
-
107
- Returns:
108
- The overrided hooks.
109
- """
110
- if self.id:
111
- ref = format.format_array_ref(self.id, None)
112
- refs_declaration = Var.range(self.length).foreach(
113
- lambda: Var.create_safe("useRef(null)", _var_is_string=False),
114
- )
115
- refs_declaration._var_is_local = True
116
- if ref:
117
- return (
118
- f"const {ref} = {str(refs_declaration)}; "
119
- f"{str(Var.create_safe(ref, _var_is_string=False).as_ref())} = {ref}"
120
- )
121
- return super()._get_ref_hook()
122
-
123
- def _render(self) -> Tag:
124
- """Override the base _render to remove the fake get_ref.
125
-
126
- Returns:
127
- The rendered component.
128
- """
129
- return super()._render().remove_props("ref")
130
-
131
- @classmethod
132
- def create(cls, *children, **props) -> Component:
133
- """Create a pin input component.
134
-
135
- If no children are passed in, the component will create a default pin input
136
- based on the length prop.
137
-
138
- Args:
139
- *children: The children of the component.
140
- **props: The props of the component.
141
-
142
- Returns:
143
- The pin input component.
144
- """
145
- if children:
146
- props.pop("length", None)
147
- elif "length" in props:
148
- field_props = {}
149
- if "id" in props:
150
- field_props["id"] = props["id"]
151
- if "name" in props:
152
- field_props["name"] = props["name"]
153
- children = [
154
- PinInputField.for_length(props["length"], **field_props),
155
- ]
156
- return super().create(*children, **props)
157
-
158
-
159
- class PinInputField(ChakraComponent):
160
- """The text field that user types in - must be a direct child of PinInput."""
161
-
162
- tag = "PinInputField"
163
-
164
- # the position of the PinInputField inside the PinInput.
165
- # Default to None because it is assigned by PinInput when created.
166
- index: Optional[Var[int]] = None
167
-
168
- # The name of the form field
169
- name: Var[str]
170
-
171
- @classmethod
172
- def for_length(cls, length: Var | int, **props) -> Var:
173
- """Create a PinInputField for a PinInput with a given length.
174
-
175
- Args:
176
- length: The length of the PinInput.
177
- props: The props of each PinInputField (name will become indexed).
178
-
179
- Returns:
180
- The PinInputField.
181
- """
182
- name = props.get("name")
183
-
184
- def _create(i):
185
- if name is not None:
186
- props["name"] = f"{name}-{i}"
187
- return PinInputField.create(**props, index=i, key=i)
188
-
189
- return Var.range(length).foreach(_create) # type: ignore
190
-
191
- def _get_ref_hook(self) -> Optional[str]:
192
- return None
193
-
194
- def get_ref(self):
195
- """Get the array ref for the pin input.
196
-
197
- Returns:
198
- The array ref.
199
- """
200
- if self.id:
201
- return format.format_array_ref(self.id, self.index)
@@ -1,215 +0,0 @@
1
- """Stub file for reflex/components/chakra/forms/pininput.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.event import EventHandler, EventSpec
10
- from reflex.style import Style
11
- from reflex.vars import BaseVar, Var
12
-
13
- class PinInput(ChakraComponent):
14
- def get_ref(self) -> str | None: ...
15
- @overload
16
- @classmethod
17
- def create( # type: ignore
18
- cls,
19
- *children,
20
- value: Optional[Union[Var[str], str]] = None,
21
- auto_focus: Optional[Union[Var[bool], bool]] = None,
22
- default_value: 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
- id_: Optional[Union[Var[str], str]] = None,
26
- length: Optional[Union[Var[int], int]] = None,
27
- is_disabled: Optional[Union[Var[bool], bool]] = None,
28
- is_invalid: Optional[Union[Var[bool], bool]] = None,
29
- manage_focus: Optional[Union[Var[bool], bool]] = None,
30
- mask: Optional[Union[Var[bool], bool]] = None,
31
- placeholder: Optional[Union[Var[str], str]] = None,
32
- type_: Optional[Union[Var[str], str]] = None,
33
- variant: Optional[
34
- Union[
35
- Var[Literal["outline", "filled", "flushed", "unstyled"]],
36
- Literal["outline", "filled", "flushed", "unstyled"],
37
- ]
38
- ] = None,
39
- name: Optional[Union[Var[str], str]] = None,
40
- style: Optional[Style] = None,
41
- key: Optional[Any] = None,
42
- id: Optional[Any] = None,
43
- class_name: Optional[Any] = None,
44
- autofocus: Optional[bool] = None,
45
- custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
46
- on_blur: Optional[
47
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
48
- ] = None,
49
- on_change: Optional[
50
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
51
- ] = None,
52
- on_click: Optional[
53
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
54
- ] = None,
55
- on_complete: Optional[
56
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
57
- ] = None,
58
- on_context_menu: Optional[
59
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
60
- ] = None,
61
- on_double_click: Optional[
62
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
63
- ] = None,
64
- on_focus: Optional[
65
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
66
- ] = None,
67
- on_mount: Optional[
68
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
69
- ] = None,
70
- on_mouse_down: Optional[
71
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
72
- ] = None,
73
- on_mouse_enter: Optional[
74
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
75
- ] = None,
76
- on_mouse_leave: Optional[
77
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
78
- ] = None,
79
- on_mouse_move: Optional[
80
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
81
- ] = None,
82
- on_mouse_out: Optional[
83
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
84
- ] = None,
85
- on_mouse_over: Optional[
86
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
87
- ] = None,
88
- on_mouse_up: Optional[
89
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
90
- ] = None,
91
- on_scroll: Optional[
92
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
93
- ] = None,
94
- on_unmount: Optional[
95
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
96
- ] = None,
97
- **props,
98
- ) -> "PinInput":
99
- """Create a pin input component.
100
-
101
- If no children are passed in, the component will create a default pin input
102
- based on the length prop.
103
-
104
- Args:
105
- *children: The children of the component.
106
- value: State var to bind the input.
107
- auto_focus: If true, the pin input receives focus on mount
108
- default_value: The default value of the pin input
109
- error_border_color: The border color when the input is invalid.
110
- focus_border_color: The border color when the input is focused.
111
- id_: The top-level id string that will be applied to the input fields. The index of the input will be appended to this top-level id.
112
- length: The length of the number input.
113
- is_disabled: If true, the pin input component is put in the disabled state
114
- is_invalid: If true, the pin input component is put in the invalid state
115
- manage_focus: If true, focus will move automatically to the next input once filled
116
- mask: If true, the input's value will be masked just like `type=password`
117
- placeholder: The placeholder for the pin input
118
- type_: The type of values the pin-input should allow ("number" | "alphanumeric").
119
- variant: "outline" | "flushed" | "filled" | "unstyled"
120
- name: The name of the form field
121
- style: The style of the component.
122
- key: A unique key for the component.
123
- id: The id for the component.
124
- class_name: The class name for the component.
125
- autofocus: Whether the component should take the focus once the page is loaded
126
- custom_attrs: custom attribute
127
- **props: The props of the component.
128
-
129
- Returns:
130
- The pin input component.
131
- """
132
- ...
133
-
134
- class PinInputField(ChakraComponent):
135
- @classmethod
136
- def for_length(cls, length: Var | int, **props) -> Var: ...
137
- def get_ref(self): ...
138
- @overload
139
- @classmethod
140
- def create( # type: ignore
141
- cls,
142
- *children,
143
- index: Optional[Union[Var[int], int]] = None,
144
- name: Optional[Union[Var[str], str]] = None,
145
- style: Optional[Style] = None,
146
- key: Optional[Any] = None,
147
- id: Optional[Any] = None,
148
- class_name: Optional[Any] = None,
149
- autofocus: Optional[bool] = None,
150
- custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
151
- on_blur: Optional[
152
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
153
- ] = None,
154
- on_click: Optional[
155
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
156
- ] = None,
157
- on_context_menu: Optional[
158
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
159
- ] = None,
160
- on_double_click: Optional[
161
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
162
- ] = None,
163
- on_focus: Optional[
164
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
165
- ] = None,
166
- on_mount: Optional[
167
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
168
- ] = None,
169
- on_mouse_down: Optional[
170
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
171
- ] = None,
172
- on_mouse_enter: Optional[
173
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
174
- ] = None,
175
- on_mouse_leave: Optional[
176
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
177
- ] = None,
178
- on_mouse_move: Optional[
179
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
180
- ] = None,
181
- on_mouse_out: Optional[
182
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
183
- ] = None,
184
- on_mouse_over: Optional[
185
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
186
- ] = None,
187
- on_mouse_up: Optional[
188
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
189
- ] = None,
190
- on_scroll: Optional[
191
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
192
- ] = None,
193
- on_unmount: Optional[
194
- Union[EventHandler, EventSpec, list, Callable, BaseVar]
195
- ] = None,
196
- **props,
197
- ) -> "PinInputField":
198
- """Create the component.
199
-
200
- Args:
201
- *children: The children of the component.
202
- index: the position of the PinInputField inside the PinInput. Default to None because it is assigned by PinInput when created.
203
- name: The name of the form field
204
- style: The style of the component.
205
- key: A unique key for the component.
206
- id: The id for the component.
207
- class_name: The class name for the component.
208
- autofocus: Whether the component should take the focus once the page is loaded
209
- custom_attrs: custom attribute
210
- **props: The props of the component.
211
-
212
- Returns:
213
- The component.
214
- """
215
- ...
@@ -1,101 +0,0 @@
1
- """A radio component."""
2
-
3
- from typing import Any, List
4
-
5
- from reflex.components.chakra import ChakraComponent
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 RadioGroup(ChakraComponent):
15
- """A grouping of individual radio options."""
16
-
17
- tag = "RadioGroup"
18
-
19
- # State var to bind the input.
20
- value: Var[Any]
21
-
22
- # The default value.
23
- default_value: Var[Any]
24
-
25
- # The name of the form field
26
- name: Var[str]
27
-
28
- # Fired when the radio group value changes.
29
- on_change: EventHandler[lambda e0: [e0]]
30
-
31
- @classmethod
32
- def create(cls, *children, **props) -> Component:
33
- """Create a radio group component.
34
-
35
- Args:
36
- *children: The children of the component.
37
- **props: The props of the component.
38
-
39
- Returns:
40
- The component.
41
- """
42
- if len(children) == 1 and isinstance(children[0], list):
43
- children = [Radio.create(child) for child in children[0]]
44
- if (
45
- len(children) == 1
46
- and isinstance(children[0], Var)
47
- and _issubclass(children[0]._var_type, List)
48
- ):
49
- children = [Foreach.create(children[0], lambda item: Radio.create(item))]
50
- return super().create(*children, **props)
51
-
52
-
53
- class Radio(Text):
54
- """Radios are used when only one choice may be selected in a series of options."""
55
-
56
- tag = "Radio"
57
-
58
- # Value of radio.
59
- value: Var[Any]
60
-
61
- # The default value.
62
- default_value: Var[Any]
63
-
64
- # The color scheme.
65
- color_scheme: Var[str]
66
-
67
- # If true, the radio will be initially checked.
68
- default_checked: Var[bool]
69
-
70
- # If true, the radio will be checked. You'll need to pass onChange to update its value (since it is now controlled)
71
- is_checked: Var[bool]
72
-
73
- # If true, the radio will be disabled.
74
- is_disabled: Var[bool]
75
-
76
- # If true, the radio button will be invalid. This also sets `aria-invalid` to true.
77
- is_invalid: Var[bool]
78
-
79
- # If true, the radio will be read-only
80
- is_read_only: Var[bool]
81
-
82
- # If true, the radio button will be required. This also sets `aria-required` to true.
83
- is_required: Var[bool]
84
-
85
- @classmethod
86
- def create(cls, *children, **props) -> Component:
87
- """Create a radio component.
88
-
89
- By default, the value is bound to the first child.
90
-
91
- Args:
92
- *children: The children of the component.
93
- **props: The props of the component.
94
-
95
- Returns:
96
- The radio component.
97
- """
98
- if "value" not in props:
99
- assert len(children) == 1
100
- props["value"] = children[0]
101
- return super().create(*children, **props)