reflex 0.3.9a3__py3-none-any.whl → 0.3.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 +3 -1
- reflex/__init__.pyi +3 -1
- reflex/app.py +116 -86
- reflex/compiler/compiler.py +110 -0
- reflex/compiler/utils.py +13 -12
- reflex/components/base/app_wrap.pyi +1 -0
- reflex/components/base/body.pyi +2 -0
- reflex/components/base/document.pyi +10 -0
- reflex/components/base/fragment.pyi +2 -0
- reflex/components/base/head.pyi +4 -0
- reflex/components/base/link.pyi +4 -0
- reflex/components/base/meta.pyi +8 -0
- reflex/components/base/script.pyi +2 -0
- reflex/components/chakra/base.pyi +7 -0
- reflex/components/chakra/datadisplay/badge.pyi +2 -0
- reflex/components/chakra/datadisplay/code.pyi +4 -0
- reflex/components/chakra/datadisplay/divider.pyi +2 -0
- reflex/components/chakra/datadisplay/keyboard_key.pyi +2 -0
- reflex/components/chakra/datadisplay/list.pyi +8 -0
- reflex/components/chakra/datadisplay/stat.pyi +12 -0
- reflex/components/chakra/datadisplay/table.pyi +18 -0
- reflex/components/chakra/datadisplay/tag.pyi +9 -0
- reflex/components/chakra/disclosure/accordion.pyi +10 -0
- reflex/components/chakra/disclosure/tabs.py +8 -0
- reflex/components/chakra/disclosure/tabs.pyi +10 -0
- reflex/components/chakra/disclosure/transition.pyi +12 -0
- reflex/components/chakra/disclosure/visuallyhidden.pyi +2 -0
- reflex/components/chakra/feedback/alert.pyi +8 -0
- reflex/components/chakra/feedback/circularprogress.pyi +4 -0
- reflex/components/chakra/feedback/progress.pyi +2 -0
- reflex/components/chakra/feedback/skeleton.pyi +6 -0
- reflex/components/chakra/feedback/spinner.pyi +2 -0
- reflex/components/chakra/forms/button.pyi +4 -0
- reflex/components/chakra/forms/checkbox.pyi +4 -0
- reflex/components/chakra/forms/colormodeswitch.pyi +7 -0
- reflex/components/chakra/forms/date_picker.pyi +2 -0
- reflex/components/chakra/forms/date_time_picker.pyi +2 -0
- reflex/components/chakra/forms/editable.pyi +8 -0
- reflex/components/chakra/forms/email.pyi +2 -0
- reflex/components/chakra/forms/form.pyi +10 -0
- reflex/components/chakra/forms/iconbutton.py +1 -0
- reflex/components/chakra/forms/iconbutton.pyi +2 -0
- reflex/components/chakra/forms/input.pyi +12 -0
- reflex/components/chakra/forms/numberinput.pyi +10 -0
- reflex/components/chakra/forms/password.pyi +2 -0
- reflex/components/chakra/forms/pininput.pyi +4 -0
- reflex/components/chakra/forms/radio.pyi +4 -0
- reflex/components/chakra/forms/rangeslider.pyi +8 -0
- reflex/components/chakra/forms/select.pyi +4 -0
- reflex/components/chakra/forms/slider.pyi +10 -0
- reflex/components/chakra/forms/switch.pyi +2 -0
- reflex/components/chakra/forms/textarea.pyi +2 -0
- reflex/components/chakra/forms/time_picker.pyi +2 -0
- reflex/components/chakra/layout/aspect_ratio.pyi +2 -0
- reflex/components/chakra/layout/box.pyi +2 -0
- reflex/components/chakra/layout/card.pyi +7 -0
- reflex/components/chakra/layout/center.pyi +6 -0
- reflex/components/chakra/layout/container.pyi +2 -0
- reflex/components/chakra/layout/flex.pyi +2 -0
- reflex/components/chakra/layout/grid.pyi +6 -0
- reflex/components/chakra/layout/html.pyi +2 -0
- reflex/components/chakra/layout/spacer.pyi +2 -0
- reflex/components/chakra/layout/stack.pyi +6 -0
- reflex/components/chakra/layout/wrap.pyi +4 -0
- reflex/components/chakra/media/avatar.pyi +6 -0
- reflex/components/chakra/media/icon.pyi +4 -0
- reflex/components/chakra/media/image.pyi +2 -0
- reflex/components/chakra/navigation/breadcrumb.pyi +8 -0
- reflex/components/chakra/navigation/link.pyi +2 -0
- reflex/components/chakra/navigation/linkoverlay.pyi +4 -0
- reflex/components/chakra/navigation/stepper.pyi +18 -0
- reflex/components/chakra/overlay/alertdialog.pyi +14 -0
- reflex/components/chakra/overlay/drawer.pyi +14 -0
- reflex/components/chakra/overlay/menu.pyi +16 -0
- reflex/components/chakra/overlay/modal.pyi +14 -0
- reflex/components/chakra/overlay/popover.pyi +18 -0
- reflex/components/chakra/overlay/tooltip.pyi +2 -0
- reflex/components/chakra/typography/heading.pyi +2 -0
- reflex/components/chakra/typography/highlight.pyi +2 -0
- reflex/components/chakra/typography/span.pyi +2 -0
- reflex/components/chakra/typography/text.pyi +2 -0
- reflex/components/component.py +41 -3
- reflex/components/core/__init__.py +2 -0
- reflex/components/core/banner.pyi +3 -0
- reflex/components/core/client_side_routing.pyi +4 -0
- reflex/components/core/colors.py +21 -0
- reflex/components/core/cond.py +11 -2
- reflex/components/core/debounce.pyi +1 -0
- reflex/components/core/layout/__init__.py +1 -0
- reflex/components/core/match.py +44 -18
- reflex/components/core/upload.py +8 -2
- reflex/components/core/upload.pyi +7 -1
- reflex/components/datadisplay/dataeditor.pyi +2 -0
- reflex/components/el/element.pyi +2 -0
- reflex/components/el/elements/base.pyi +2 -0
- reflex/components/el/elements/forms.py +3 -0
- reflex/components/el/elements/forms.pyi +32 -0
- reflex/components/el/elements/inline.pyi +56 -0
- reflex/components/el/elements/media.pyi +28 -0
- reflex/components/el/elements/metadata.pyi +10 -0
- reflex/components/el/elements/other.pyi +14 -0
- reflex/components/el/elements/scripts.pyi +6 -0
- reflex/components/el/elements/sectioning.pyi +30 -0
- reflex/components/el/elements/tables.pyi +20 -0
- reflex/components/el/elements/typography.pyi +30 -0
- reflex/components/gridjs/datatable.pyi +4 -0
- reflex/components/lucide/__init__.py +5 -0
- reflex/components/lucide/icon.py +1484 -0
- reflex/components/lucide/icon.pyi +1594 -0
- reflex/components/markdown/markdown.pyi +2 -0
- reflex/components/moment/moment.pyi +2 -0
- reflex/components/next/base.pyi +2 -0
- reflex/components/next/image.pyi +2 -0
- reflex/components/next/link.pyi +2 -0
- reflex/components/next/video.pyi +2 -0
- reflex/components/plotly/plotly.pyi +4 -0
- reflex/components/radix/primitives/__init__.py +10 -0
- reflex/components/radix/primitives/accordion.py +51 -32
- reflex/components/radix/primitives/accordion.pyi +16 -3
- reflex/components/radix/primitives/base.pyi +4 -0
- reflex/components/radix/primitives/drawer.py +240 -0
- reflex/components/radix/primitives/drawer.pyi +814 -0
- reflex/components/radix/primitives/form.py +40 -7
- reflex/components/radix/primitives/form.pyi +32 -10
- reflex/components/radix/primitives/progress.py +2 -2
- reflex/components/radix/primitives/progress.pyi +6 -0
- reflex/components/radix/primitives/slider.pyi +10 -0
- reflex/components/radix/themes/base.py +46 -12
- reflex/components/radix/themes/base.pyi +23 -9
- reflex/components/radix/themes/components/__init__.py +4 -2
- reflex/components/radix/themes/components/alertdialog.py +13 -12
- reflex/components/radix/themes/components/alertdialog.pyi +23 -351
- reflex/components/radix/themes/components/aspectratio.py +2 -5
- reflex/components/radix/themes/components/aspectratio.pyi +4 -51
- reflex/components/radix/themes/components/avatar.py +3 -4
- reflex/components/radix/themes/components/avatar.pyi +4 -57
- reflex/components/radix/themes/components/badge.py +3 -4
- reflex/components/radix/themes/components/badge.pyi +4 -56
- reflex/components/radix/themes/components/button.py +2 -3
- reflex/components/radix/themes/components/button.pyi +3 -51
- reflex/components/radix/themes/components/callout.py +9 -12
- reflex/components/radix/themes/components/callout.pyi +24 -217
- reflex/components/radix/themes/components/card.py +1 -2
- reflex/components/radix/themes/components/card.pyi +4 -51
- reflex/components/radix/themes/components/checkbox.py +11 -5
- reflex/components/radix/themes/components/checkbox.pyi +13 -112
- reflex/components/radix/themes/components/contextmenu.py +21 -21
- reflex/components/radix/themes/components/contextmenu.pyi +26 -401
- reflex/components/radix/themes/components/dialog.py +13 -16
- reflex/components/radix/themes/components/dialog.pyi +20 -303
- reflex/components/radix/themes/components/dropdownmenu.py +196 -32
- reflex/components/radix/themes/components/dropdownmenu.pyi +147 -389
- reflex/components/radix/themes/components/hovercard.py +5 -5
- reflex/components/radix/themes/components/hovercard.pyi +11 -151
- reflex/components/radix/themes/components/iconbutton.py +56 -4
- reflex/components/radix/themes/components/iconbutton.pyi +25 -71
- reflex/components/radix/themes/components/icons.pyi +4 -0
- reflex/components/radix/themes/components/inset.py +1 -2
- reflex/components/radix/themes/components/inset.pyi +4 -51
- reflex/components/radix/themes/components/popover.py +12 -12
- reflex/components/radix/themes/components/popover.pyi +14 -201
- reflex/components/radix/themes/components/radiogroup.py +47 -20
- reflex/components/radix/themes/components/radiogroup.pyi +26 -171
- reflex/components/radix/themes/components/scrollarea.py +2 -3
- reflex/components/radix/themes/components/scrollarea.pyi +4 -51
- reflex/components/radix/themes/components/select.py +28 -25
- reflex/components/radix/themes/components/select.pyi +43 -419
- reflex/components/radix/themes/components/separator.py +4 -5
- reflex/components/radix/themes/components/separator.pyi +5 -52
- reflex/components/radix/themes/components/slider.py +8 -5
- reflex/components/radix/themes/components/slider.pyi +9 -60
- reflex/components/radix/themes/components/switch.py +6 -4
- reflex/components/radix/themes/components/switch.pyi +5 -53
- reflex/components/radix/themes/components/table.py +14 -15
- reflex/components/radix/themes/components/table.pyi +22 -351
- reflex/components/radix/themes/components/tabs.py +9 -6
- reflex/components/radix/themes/components/tabs.pyi +18 -205
- reflex/components/radix/themes/components/textarea.py +2 -3
- reflex/components/radix/themes/components/textarea.pyi +10 -53
- reflex/components/radix/themes/components/textfield.py +105 -4
- reflex/components/radix/themes/components/textfield.pyi +200 -108
- reflex/components/radix/themes/components/tooltip.py +102 -2
- reflex/components/radix/themes/components/tooltip.pyi +66 -110
- reflex/components/radix/themes/layout/__init__.py +7 -0
- reflex/components/radix/themes/layout/base.pyi +2 -0
- reflex/components/radix/themes/layout/box.py +2 -2
- reflex/components/radix/themes/layout/box.pyi +4 -104
- reflex/components/radix/themes/layout/center.py +19 -0
- reflex/components/radix/themes/layout/center.pyi +261 -0
- reflex/components/radix/themes/layout/container.py +2 -2
- reflex/components/radix/themes/layout/container.pyi +4 -104
- reflex/components/radix/themes/layout/flex.py +2 -2
- reflex/components/radix/themes/layout/flex.pyi +4 -105
- reflex/components/radix/themes/layout/grid.pyi +2 -0
- reflex/components/radix/themes/layout/section.py +2 -2
- reflex/components/radix/themes/layout/section.pyi +4 -104
- reflex/components/radix/themes/layout/spacer.py +19 -0
- reflex/components/radix/themes/layout/spacer.pyi +261 -0
- reflex/components/radix/themes/layout/stack.py +60 -0
- reflex/components/radix/themes/layout/stack.pyi +537 -0
- reflex/components/radix/themes/typography/blockquote.py +2 -3
- reflex/components/radix/themes/typography/blockquote.pyi +4 -51
- reflex/components/radix/themes/typography/code.py +2 -3
- reflex/components/radix/themes/typography/code.pyi +4 -56
- reflex/components/radix/themes/typography/em.py +1 -2
- reflex/components/radix/themes/typography/em.pyi +4 -51
- reflex/components/radix/themes/typography/heading.py +2 -3
- reflex/components/radix/themes/typography/heading.pyi +4 -51
- reflex/components/radix/themes/typography/kbd.py +1 -2
- reflex/components/radix/themes/typography/kbd.pyi +4 -51
- reflex/components/radix/themes/typography/link.py +34 -3
- reflex/components/radix/themes/typography/link.pyi +41 -86
- reflex/components/radix/themes/typography/quote.py +1 -2
- reflex/components/radix/themes/typography/quote.pyi +4 -51
- reflex/components/radix/themes/typography/strong.py +1 -2
- reflex/components/radix/themes/typography/strong.pyi +4 -51
- reflex/components/radix/themes/typography/text.py +2 -3
- reflex/components/radix/themes/typography/text.pyi +4 -51
- reflex/components/radix/themes/typography.py +10 -11
- reflex/components/react_player/audio.pyi +2 -0
- reflex/components/react_player/react_player.pyi +2 -0
- reflex/components/react_player/video.pyi +2 -0
- reflex/components/recharts/cartesian.pyi +38 -0
- reflex/components/recharts/charts.pyi +22 -0
- reflex/components/recharts/general.pyi +10 -0
- reflex/components/recharts/polar.pyi +12 -0
- reflex/components/recharts/recharts.pyi +4 -0
- reflex/components/suneditor/editor.pyi +2 -0
- reflex/components/tags/tag.py +1 -1
- reflex/constants/base.py +5 -1
- reflex/constants/colors.py +80 -0
- reflex/constants/event.py +10 -1
- reflex/page.py +1 -1
- reflex/reflex.py +4 -0
- reflex/style.py +8 -3
- reflex/testing.py +21 -10
- reflex/utils/format.py +13 -9
- reflex/utils/prerequisites.py +41 -3
- reflex/utils/serializers.py +14 -0
- reflex/utils/telemetry.py +8 -2
- reflex/utils/types.py +36 -2
- reflex/vars.py +53 -18
- {reflex-0.3.9a3.dist-info → reflex-0.3.10.dist-info}/METADATA +1 -2
- {reflex-0.3.9a3.dist-info → reflex-0.3.10.dist-info}/RECORD +247 -233
- {reflex-0.3.9a3.dist-info → reflex-0.3.10.dist-info}/WHEEL +1 -1
- {reflex-0.3.9a3.dist-info → reflex-0.3.10.dist-info}/LICENSE +0 -0
- {reflex-0.3.9a3.dist-info → reflex-0.3.10.dist-info}/entry_points.txt +0 -0
|
@@ -10,11 +10,11 @@ from reflex.style import Style
|
|
|
10
10
|
from typing import Literal, Union
|
|
11
11
|
from reflex import el
|
|
12
12
|
from reflex.vars import Var
|
|
13
|
-
from ..base import
|
|
13
|
+
from ..base import RadixThemesComponent
|
|
14
14
|
|
|
15
15
|
LiteralButtonSize = Literal["1", "2", "3", "4"]
|
|
16
16
|
|
|
17
|
-
class Inset(el.Div,
|
|
17
|
+
class Inset(el.Div, RadixThemesComponent):
|
|
18
18
|
@overload
|
|
19
19
|
@classmethod
|
|
20
20
|
def create( # type: ignore
|
|
@@ -145,53 +145,12 @@ class Inset(el.Div, CommonMarginProps, RadixThemesComponent):
|
|
|
145
145
|
translate: Optional[
|
|
146
146
|
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
147
147
|
] = None,
|
|
148
|
-
m: Optional[
|
|
149
|
-
Union[
|
|
150
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
151
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
152
|
-
]
|
|
153
|
-
] = None,
|
|
154
|
-
mx: Optional[
|
|
155
|
-
Union[
|
|
156
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
157
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
158
|
-
]
|
|
159
|
-
] = None,
|
|
160
|
-
my: Optional[
|
|
161
|
-
Union[
|
|
162
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
163
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
164
|
-
]
|
|
165
|
-
] = None,
|
|
166
|
-
mt: Optional[
|
|
167
|
-
Union[
|
|
168
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
169
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
170
|
-
]
|
|
171
|
-
] = None,
|
|
172
|
-
mr: Optional[
|
|
173
|
-
Union[
|
|
174
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
175
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
176
|
-
]
|
|
177
|
-
] = None,
|
|
178
|
-
mb: Optional[
|
|
179
|
-
Union[
|
|
180
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
181
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
182
|
-
]
|
|
183
|
-
] = None,
|
|
184
|
-
ml: Optional[
|
|
185
|
-
Union[
|
|
186
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
187
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
188
|
-
]
|
|
189
|
-
] = None,
|
|
190
148
|
style: Optional[Style] = None,
|
|
191
149
|
key: Optional[Any] = None,
|
|
192
150
|
id: Optional[Any] = None,
|
|
193
151
|
class_name: Optional[Any] = None,
|
|
194
152
|
autofocus: Optional[bool] = None,
|
|
153
|
+
_rename_props: Optional[Dict[str, str]] = None,
|
|
195
154
|
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
196
155
|
on_blur: Optional[
|
|
197
156
|
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
@@ -275,18 +234,12 @@ class Inset(el.Div, CommonMarginProps, RadixThemesComponent):
|
|
|
275
234
|
tab_index: Defines the position of the current element in the tabbing order.
|
|
276
235
|
title: Defines a tooltip for the element.
|
|
277
236
|
translate: Specifies whether the content of an element should be translated or not.
|
|
278
|
-
m: Margin: "0" - "9"
|
|
279
|
-
mx: Margin horizontal: "0" - "9"
|
|
280
|
-
my: Margin vertical: "0" - "9"
|
|
281
|
-
mt: Margin top: "0" - "9"
|
|
282
|
-
mr: Margin right: "0" - "9"
|
|
283
|
-
mb: Margin bottom: "0" - "9"
|
|
284
|
-
ml: Margin left: "0" - "9"
|
|
285
237
|
style: The style of the component.
|
|
286
238
|
key: A unique key for the component.
|
|
287
239
|
id: The id for the component.
|
|
288
240
|
class_name: The class name for the component.
|
|
289
241
|
autofocus: Whether the component should take the focus once the page is loaded
|
|
242
|
+
_rename_props: props to change the name of
|
|
290
243
|
custom_attrs: custom attribute
|
|
291
244
|
**props: Component properties.
|
|
292
245
|
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
from typing import Any, Dict, Literal
|
|
3
3
|
|
|
4
4
|
from reflex import el
|
|
5
|
+
from reflex.constants import EventTriggers
|
|
5
6
|
from reflex.vars import Var
|
|
6
7
|
|
|
7
8
|
from ..base import (
|
|
8
|
-
CommonMarginProps,
|
|
9
9
|
RadixThemesComponent,
|
|
10
10
|
)
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
class PopoverRoot(
|
|
13
|
+
class PopoverRoot(RadixThemesComponent):
|
|
14
14
|
"""Trigger an action or event, such as submitting a form or displaying a dialog."""
|
|
15
15
|
|
|
16
16
|
tag = "Popover.Root"
|
|
@@ -29,17 +29,17 @@ class PopoverRoot(CommonMarginProps, RadixThemesComponent):
|
|
|
29
29
|
"""
|
|
30
30
|
return {
|
|
31
31
|
**super().get_event_triggers(),
|
|
32
|
-
|
|
32
|
+
EventTriggers.ON_OPEN_CHANGE: lambda e0: [e0],
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
class PopoverTrigger(
|
|
36
|
+
class PopoverTrigger(RadixThemesComponent):
|
|
37
37
|
"""Trigger an action or event, such as submitting a form or displaying a dialog."""
|
|
38
38
|
|
|
39
39
|
tag = "Popover.Trigger"
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
class PopoverContent(el.Div,
|
|
42
|
+
class PopoverContent(el.Div, RadixThemesComponent):
|
|
43
43
|
"""Trigger an action or event, such as submitting a form or displaying a dialog."""
|
|
44
44
|
|
|
45
45
|
tag = "Popover.Content"
|
|
@@ -70,16 +70,16 @@ class PopoverContent(el.Div, CommonMarginProps, RadixThemesComponent):
|
|
|
70
70
|
"""
|
|
71
71
|
return {
|
|
72
72
|
**super().get_event_triggers(),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
EventTriggers.ON_OPEN_AUTO_FOCUS: lambda e0: [e0],
|
|
74
|
+
EventTriggers.ON_CLOSE_AUTO_FOCUS: lambda e0: [e0],
|
|
75
|
+
EventTriggers.ON_ESCAPE_KEY_DOWN: lambda e0: [e0],
|
|
76
|
+
EventTriggers.ON_POINTER_DOWN_OUTSIDE: lambda e0: [e0],
|
|
77
|
+
EventTriggers.ON_FOCUS_OUTSIDE: lambda e0: [e0],
|
|
78
|
+
EventTriggers.ON_INTERACT_OUTSIDE: lambda e0: [e0],
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
class PopoverClose(
|
|
82
|
+
class PopoverClose(RadixThemesComponent):
|
|
83
83
|
"""Trigger an action or event, such as submitting a form or displaying a dialog."""
|
|
84
84
|
|
|
85
85
|
tag = "Popover.Close"
|
|
@@ -9,10 +9,11 @@ from reflex.event import EventChain, EventHandler, EventSpec
|
|
|
9
9
|
from reflex.style import Style
|
|
10
10
|
from typing import Any, Dict, Literal
|
|
11
11
|
from reflex import el
|
|
12
|
+
from reflex.constants import EventTriggers
|
|
12
13
|
from reflex.vars import Var
|
|
13
|
-
from ..base import
|
|
14
|
+
from ..base import RadixThemesComponent
|
|
14
15
|
|
|
15
|
-
class PopoverRoot(
|
|
16
|
+
class PopoverRoot(RadixThemesComponent):
|
|
16
17
|
def get_event_triggers(self) -> Dict[str, Any]: ...
|
|
17
18
|
@overload
|
|
18
19
|
@classmethod
|
|
@@ -84,53 +85,12 @@ class PopoverRoot(CommonMarginProps, RadixThemesComponent):
|
|
|
84
85
|
] = None,
|
|
85
86
|
open: Optional[Union[Var[bool], bool]] = None,
|
|
86
87
|
modal: Optional[Union[Var[bool], bool]] = None,
|
|
87
|
-
m: Optional[
|
|
88
|
-
Union[
|
|
89
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
90
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
91
|
-
]
|
|
92
|
-
] = None,
|
|
93
|
-
mx: Optional[
|
|
94
|
-
Union[
|
|
95
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
96
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
97
|
-
]
|
|
98
|
-
] = None,
|
|
99
|
-
my: Optional[
|
|
100
|
-
Union[
|
|
101
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
102
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
103
|
-
]
|
|
104
|
-
] = None,
|
|
105
|
-
mt: Optional[
|
|
106
|
-
Union[
|
|
107
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
108
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
109
|
-
]
|
|
110
|
-
] = None,
|
|
111
|
-
mr: Optional[
|
|
112
|
-
Union[
|
|
113
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
114
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
115
|
-
]
|
|
116
|
-
] = None,
|
|
117
|
-
mb: Optional[
|
|
118
|
-
Union[
|
|
119
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
120
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
121
|
-
]
|
|
122
|
-
] = None,
|
|
123
|
-
ml: Optional[
|
|
124
|
-
Union[
|
|
125
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
126
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
127
|
-
]
|
|
128
|
-
] = None,
|
|
129
88
|
style: Optional[Style] = None,
|
|
130
89
|
key: Optional[Any] = None,
|
|
131
90
|
id: Optional[Any] = None,
|
|
132
91
|
class_name: Optional[Any] = None,
|
|
133
92
|
autofocus: Optional[bool] = None,
|
|
93
|
+
_rename_props: Optional[Dict[str, str]] = None,
|
|
134
94
|
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
135
95
|
on_blur: Optional[
|
|
136
96
|
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
@@ -193,18 +153,12 @@ class PopoverRoot(CommonMarginProps, RadixThemesComponent):
|
|
|
193
153
|
color_scheme: map to radix color property.
|
|
194
154
|
open: The controlled open state of the popover.
|
|
195
155
|
modal: The modality of the popover. When set to true, interaction with outside elements will be disabled and only popover content will be visible to screen readers.
|
|
196
|
-
m: Margin: "0" - "9"
|
|
197
|
-
mx: Margin horizontal: "0" - "9"
|
|
198
|
-
my: Margin vertical: "0" - "9"
|
|
199
|
-
mt: Margin top: "0" - "9"
|
|
200
|
-
mr: Margin right: "0" - "9"
|
|
201
|
-
mb: Margin bottom: "0" - "9"
|
|
202
|
-
ml: Margin left: "0" - "9"
|
|
203
156
|
style: The style of the component.
|
|
204
157
|
key: A unique key for the component.
|
|
205
158
|
id: The id for the component.
|
|
206
159
|
class_name: The class name for the component.
|
|
207
160
|
autofocus: Whether the component should take the focus once the page is loaded
|
|
161
|
+
_rename_props: props to change the name of
|
|
208
162
|
custom_attrs: custom attribute
|
|
209
163
|
**props: Component properties.
|
|
210
164
|
|
|
@@ -213,7 +167,7 @@ class PopoverRoot(CommonMarginProps, RadixThemesComponent):
|
|
|
213
167
|
"""
|
|
214
168
|
...
|
|
215
169
|
|
|
216
|
-
class PopoverTrigger(
|
|
170
|
+
class PopoverTrigger(RadixThemesComponent):
|
|
217
171
|
@overload
|
|
218
172
|
@classmethod
|
|
219
173
|
def create( # type: ignore
|
|
@@ -282,53 +236,12 @@ class PopoverTrigger(CommonMarginProps, RadixThemesComponent):
|
|
|
282
236
|
],
|
|
283
237
|
]
|
|
284
238
|
] = None,
|
|
285
|
-
m: Optional[
|
|
286
|
-
Union[
|
|
287
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
288
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
289
|
-
]
|
|
290
|
-
] = None,
|
|
291
|
-
mx: Optional[
|
|
292
|
-
Union[
|
|
293
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
294
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
295
|
-
]
|
|
296
|
-
] = None,
|
|
297
|
-
my: Optional[
|
|
298
|
-
Union[
|
|
299
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
300
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
301
|
-
]
|
|
302
|
-
] = None,
|
|
303
|
-
mt: Optional[
|
|
304
|
-
Union[
|
|
305
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
306
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
307
|
-
]
|
|
308
|
-
] = None,
|
|
309
|
-
mr: Optional[
|
|
310
|
-
Union[
|
|
311
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
312
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
313
|
-
]
|
|
314
|
-
] = None,
|
|
315
|
-
mb: Optional[
|
|
316
|
-
Union[
|
|
317
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
318
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
319
|
-
]
|
|
320
|
-
] = None,
|
|
321
|
-
ml: Optional[
|
|
322
|
-
Union[
|
|
323
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
324
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
325
|
-
]
|
|
326
|
-
] = None,
|
|
327
239
|
style: Optional[Style] = None,
|
|
328
240
|
key: Optional[Any] = None,
|
|
329
241
|
id: Optional[Any] = None,
|
|
330
242
|
class_name: Optional[Any] = None,
|
|
331
243
|
autofocus: Optional[bool] = None,
|
|
244
|
+
_rename_props: Optional[Dict[str, str]] = None,
|
|
332
245
|
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
333
246
|
on_blur: Optional[
|
|
334
247
|
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
@@ -386,18 +299,12 @@ class PopoverTrigger(CommonMarginProps, RadixThemesComponent):
|
|
|
386
299
|
*children: Child components.
|
|
387
300
|
color: map to CSS default color property.
|
|
388
301
|
color_scheme: map to radix color property.
|
|
389
|
-
m: Margin: "0" - "9"
|
|
390
|
-
mx: Margin horizontal: "0" - "9"
|
|
391
|
-
my: Margin vertical: "0" - "9"
|
|
392
|
-
mt: Margin top: "0" - "9"
|
|
393
|
-
mr: Margin right: "0" - "9"
|
|
394
|
-
mb: Margin bottom: "0" - "9"
|
|
395
|
-
ml: Margin left: "0" - "9"
|
|
396
302
|
style: The style of the component.
|
|
397
303
|
key: A unique key for the component.
|
|
398
304
|
id: The id for the component.
|
|
399
305
|
class_name: The class name for the component.
|
|
400
306
|
autofocus: Whether the component should take the focus once the page is loaded
|
|
307
|
+
_rename_props: props to change the name of
|
|
401
308
|
custom_attrs: custom attribute
|
|
402
309
|
**props: Component properties.
|
|
403
310
|
|
|
@@ -406,7 +313,7 @@ class PopoverTrigger(CommonMarginProps, RadixThemesComponent):
|
|
|
406
313
|
"""
|
|
407
314
|
...
|
|
408
315
|
|
|
409
|
-
class PopoverContent(el.Div,
|
|
316
|
+
class PopoverContent(el.Div, RadixThemesComponent):
|
|
410
317
|
def get_event_triggers(self) -> Dict[str, Any]: ...
|
|
411
318
|
@overload
|
|
412
319
|
@classmethod
|
|
@@ -535,53 +442,12 @@ class PopoverContent(el.Div, CommonMarginProps, RadixThemesComponent):
|
|
|
535
442
|
translate: Optional[
|
|
536
443
|
Union[Var[Union[str, int, bool]], Union[str, int, bool]]
|
|
537
444
|
] = None,
|
|
538
|
-
m: Optional[
|
|
539
|
-
Union[
|
|
540
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
541
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
542
|
-
]
|
|
543
|
-
] = None,
|
|
544
|
-
mx: Optional[
|
|
545
|
-
Union[
|
|
546
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
547
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
548
|
-
]
|
|
549
|
-
] = None,
|
|
550
|
-
my: Optional[
|
|
551
|
-
Union[
|
|
552
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
553
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
554
|
-
]
|
|
555
|
-
] = None,
|
|
556
|
-
mt: Optional[
|
|
557
|
-
Union[
|
|
558
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
559
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
560
|
-
]
|
|
561
|
-
] = None,
|
|
562
|
-
mr: Optional[
|
|
563
|
-
Union[
|
|
564
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
565
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
566
|
-
]
|
|
567
|
-
] = None,
|
|
568
|
-
mb: Optional[
|
|
569
|
-
Union[
|
|
570
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
571
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
572
|
-
]
|
|
573
|
-
] = None,
|
|
574
|
-
ml: Optional[
|
|
575
|
-
Union[
|
|
576
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
577
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
578
|
-
]
|
|
579
|
-
] = None,
|
|
580
445
|
style: Optional[Style] = None,
|
|
581
446
|
key: Optional[Any] = None,
|
|
582
447
|
id: Optional[Any] = None,
|
|
583
448
|
class_name: Optional[Any] = None,
|
|
584
449
|
autofocus: Optional[bool] = None,
|
|
450
|
+
_rename_props: Optional[Dict[str, str]] = None,
|
|
585
451
|
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
586
452
|
on_blur: Optional[
|
|
587
453
|
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
@@ -680,18 +546,12 @@ class PopoverContent(el.Div, CommonMarginProps, RadixThemesComponent):
|
|
|
680
546
|
tab_index: Defines the position of the current element in the tabbing order.
|
|
681
547
|
title: Defines a tooltip for the element.
|
|
682
548
|
translate: Specifies whether the content of an element should be translated or not.
|
|
683
|
-
m: Margin: "0" - "9"
|
|
684
|
-
mx: Margin horizontal: "0" - "9"
|
|
685
|
-
my: Margin vertical: "0" - "9"
|
|
686
|
-
mt: Margin top: "0" - "9"
|
|
687
|
-
mr: Margin right: "0" - "9"
|
|
688
|
-
mb: Margin bottom: "0" - "9"
|
|
689
|
-
ml: Margin left: "0" - "9"
|
|
690
549
|
style: The style of the component.
|
|
691
550
|
key: A unique key for the component.
|
|
692
551
|
id: The id for the component.
|
|
693
552
|
class_name: The class name for the component.
|
|
694
553
|
autofocus: Whether the component should take the focus once the page is loaded
|
|
554
|
+
_rename_props: props to change the name of
|
|
695
555
|
custom_attrs: custom attribute
|
|
696
556
|
**props: Component properties.
|
|
697
557
|
|
|
@@ -700,7 +560,7 @@ class PopoverContent(el.Div, CommonMarginProps, RadixThemesComponent):
|
|
|
700
560
|
"""
|
|
701
561
|
...
|
|
702
562
|
|
|
703
|
-
class PopoverClose(
|
|
563
|
+
class PopoverClose(RadixThemesComponent):
|
|
704
564
|
@overload
|
|
705
565
|
@classmethod
|
|
706
566
|
def create( # type: ignore
|
|
@@ -769,53 +629,12 @@ class PopoverClose(CommonMarginProps, RadixThemesComponent):
|
|
|
769
629
|
],
|
|
770
630
|
]
|
|
771
631
|
] = None,
|
|
772
|
-
m: Optional[
|
|
773
|
-
Union[
|
|
774
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
775
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
776
|
-
]
|
|
777
|
-
] = None,
|
|
778
|
-
mx: Optional[
|
|
779
|
-
Union[
|
|
780
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
781
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
782
|
-
]
|
|
783
|
-
] = None,
|
|
784
|
-
my: Optional[
|
|
785
|
-
Union[
|
|
786
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
787
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
788
|
-
]
|
|
789
|
-
] = None,
|
|
790
|
-
mt: Optional[
|
|
791
|
-
Union[
|
|
792
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
793
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
794
|
-
]
|
|
795
|
-
] = None,
|
|
796
|
-
mr: Optional[
|
|
797
|
-
Union[
|
|
798
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
799
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
800
|
-
]
|
|
801
|
-
] = None,
|
|
802
|
-
mb: Optional[
|
|
803
|
-
Union[
|
|
804
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
805
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
806
|
-
]
|
|
807
|
-
] = None,
|
|
808
|
-
ml: Optional[
|
|
809
|
-
Union[
|
|
810
|
-
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
811
|
-
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
812
|
-
]
|
|
813
|
-
] = None,
|
|
814
632
|
style: Optional[Style] = None,
|
|
815
633
|
key: Optional[Any] = None,
|
|
816
634
|
id: Optional[Any] = None,
|
|
817
635
|
class_name: Optional[Any] = None,
|
|
818
636
|
autofocus: Optional[bool] = None,
|
|
637
|
+
_rename_props: Optional[Dict[str, str]] = None,
|
|
819
638
|
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
820
639
|
on_blur: Optional[
|
|
821
640
|
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
@@ -873,18 +692,12 @@ class PopoverClose(CommonMarginProps, RadixThemesComponent):
|
|
|
873
692
|
*children: Child components.
|
|
874
693
|
color: map to CSS default color property.
|
|
875
694
|
color_scheme: map to radix color property.
|
|
876
|
-
m: Margin: "0" - "9"
|
|
877
|
-
mx: Margin horizontal: "0" - "9"
|
|
878
|
-
my: Margin vertical: "0" - "9"
|
|
879
|
-
mt: Margin top: "0" - "9"
|
|
880
|
-
mr: Margin right: "0" - "9"
|
|
881
|
-
mb: Margin bottom: "0" - "9"
|
|
882
|
-
ml: Margin left: "0" - "9"
|
|
883
695
|
style: The style of the component.
|
|
884
696
|
key: A unique key for the component.
|
|
885
697
|
id: The id for the component.
|
|
886
698
|
class_name: The class name for the component.
|
|
887
699
|
autofocus: Whether the component should take the focus once the page is loaded
|
|
700
|
+
_rename_props: props to change the name of
|
|
888
701
|
custom_attrs: custom attribute
|
|
889
702
|
**props: Component properties.
|
|
890
703
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"""Interactive components provided by @radix-ui/themes."""
|
|
2
|
-
from typing import Any, Dict, List, Literal
|
|
2
|
+
from typing import Any, Dict, List, Literal, Optional, Union
|
|
3
3
|
|
|
4
4
|
import reflex as rx
|
|
5
5
|
from reflex.components.component import Component
|
|
6
6
|
from reflex.components.radix.themes.layout.flex import Flex
|
|
7
7
|
from reflex.components.radix.themes.typography.text import Text
|
|
8
|
+
from reflex.constants import EventTriggers
|
|
8
9
|
from reflex.vars import Var
|
|
9
10
|
|
|
10
11
|
from ..base import (
|
|
11
|
-
CommonMarginProps,
|
|
12
12
|
LiteralAccentColor,
|
|
13
13
|
LiteralSize,
|
|
14
14
|
RadixThemesComponent,
|
|
@@ -17,8 +17,8 @@ from ..base import (
|
|
|
17
17
|
LiteralFlexDirection = Literal["row", "column", "row-reverse", "column-reverse"]
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
class RadioGroupRoot(
|
|
21
|
-
"""
|
|
20
|
+
class RadioGroupRoot(RadixThemesComponent):
|
|
21
|
+
"""A set of interactive radio buttons where only one can be selected at a time."""
|
|
22
22
|
|
|
23
23
|
tag = "RadioGroup.Root"
|
|
24
24
|
|
|
@@ -29,15 +29,15 @@ class RadioGroupRoot(CommonMarginProps, RadixThemesComponent):
|
|
|
29
29
|
variant: Var[Literal["classic", "surface", "soft"]]
|
|
30
30
|
|
|
31
31
|
# The color of the radio group
|
|
32
|
-
|
|
32
|
+
color_scheme: Var[LiteralAccentColor]
|
|
33
33
|
|
|
34
34
|
# Whether to render the radio group with higher contrast color against background
|
|
35
35
|
high_contrast: Var[bool]
|
|
36
36
|
|
|
37
|
-
# The controlled value of the radio item to check. Should be used in conjunction with
|
|
37
|
+
# The controlled value of the radio item to check. Should be used in conjunction with on_change.
|
|
38
38
|
value: Var[str]
|
|
39
39
|
|
|
40
|
-
# The initial value of checked radio item. Should be used in conjunction with
|
|
40
|
+
# The initial value of checked radio item. Should be used in conjunction with on_change.
|
|
41
41
|
default_value: Var[str]
|
|
42
42
|
|
|
43
43
|
# Whether the radio group is disabled
|
|
@@ -55,6 +55,9 @@ class RadioGroupRoot(CommonMarginProps, RadixThemesComponent):
|
|
|
55
55
|
# When true, keyboard navigation will loop from last item to first, and vice versa.
|
|
56
56
|
loop: Var[bool]
|
|
57
57
|
|
|
58
|
+
# Props to rename
|
|
59
|
+
_rename_props = {"onChange": "onValueChange"}
|
|
60
|
+
|
|
58
61
|
def get_event_triggers(self) -> Dict[str, Any]:
|
|
59
62
|
"""Get the events triggers signatures for the component.
|
|
60
63
|
|
|
@@ -63,16 +66,16 @@ class RadioGroupRoot(CommonMarginProps, RadixThemesComponent):
|
|
|
63
66
|
"""
|
|
64
67
|
return {
|
|
65
68
|
**super().get_event_triggers(),
|
|
66
|
-
|
|
69
|
+
EventTriggers.ON_CHANGE: lambda e0: [e0],
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
|
|
70
|
-
class RadioGroupItem(
|
|
71
|
-
"""
|
|
73
|
+
class RadioGroupItem(RadixThemesComponent):
|
|
74
|
+
"""An item in the group that can be checked."""
|
|
72
75
|
|
|
73
76
|
tag = "RadioGroup.Item"
|
|
74
77
|
|
|
75
|
-
# The value of the radio item to check. Should be used in conjunction with
|
|
78
|
+
# The value of the radio item to check. Should be used in conjunction with on_change.
|
|
76
79
|
value: Var[str]
|
|
77
80
|
|
|
78
81
|
# When true, prevents the user from interacting with the radio item.
|
|
@@ -98,7 +101,11 @@ class HighLevelRadioGroup(RadioGroupRoot):
|
|
|
98
101
|
size: Var[Literal["1", "2", "3"]] = Var.create_safe("2")
|
|
99
102
|
|
|
100
103
|
@classmethod
|
|
101
|
-
def create(
|
|
104
|
+
def create(
|
|
105
|
+
cls,
|
|
106
|
+
items: Var[List[Optional[Union[str, int, float, list, dict, bool]]]],
|
|
107
|
+
**props
|
|
108
|
+
) -> Component:
|
|
102
109
|
"""Create a radio group component.
|
|
103
110
|
|
|
104
111
|
Args:
|
|
@@ -111,29 +118,49 @@ class HighLevelRadioGroup(RadioGroupRoot):
|
|
|
111
118
|
direction = props.pop("direction", "column")
|
|
112
119
|
gap = props.pop("gap", "2")
|
|
113
120
|
size = props.pop("size", "2")
|
|
121
|
+
default_value = props.pop("default_value", "")
|
|
122
|
+
|
|
123
|
+
# convert only non-strings to json(JSON.stringify) so quotes are not rendered
|
|
124
|
+
# for string literal types.
|
|
125
|
+
if (
|
|
126
|
+
type(default_value) is str
|
|
127
|
+
or isinstance(default_value, Var)
|
|
128
|
+
and default_value._var_type is str
|
|
129
|
+
):
|
|
130
|
+
default_value = Var.create(default_value, _var_is_string=True) # type: ignore
|
|
131
|
+
else:
|
|
132
|
+
default_value = (
|
|
133
|
+
Var.create(default_value).to_string()._replace(_var_is_local=False) # type: ignore
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
def radio_group_item(value: str | Var) -> Component:
|
|
137
|
+
item_value = Var.create(value) # type: ignore
|
|
138
|
+
item_value = rx.cond(
|
|
139
|
+
item_value._type() == str, # type: ignore
|
|
140
|
+
item_value,
|
|
141
|
+
item_value.to_string()._replace(_var_is_local=False), # type: ignore
|
|
142
|
+
)._replace(_var_type=str)
|
|
114
143
|
|
|
115
|
-
def radio_group_item(value: str) -> Component:
|
|
116
144
|
return Text.create(
|
|
117
145
|
Flex.create(
|
|
118
|
-
RadioGroupItem.create(value=
|
|
119
|
-
|
|
146
|
+
RadioGroupItem.create(value=item_value),
|
|
147
|
+
item_value,
|
|
120
148
|
gap="2",
|
|
121
149
|
),
|
|
122
150
|
size=size,
|
|
123
151
|
as_="label",
|
|
124
152
|
)
|
|
125
153
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
else:
|
|
129
|
-
child = [radio_group_item(value) for value in items] # type: ignore
|
|
154
|
+
items = Var.create(items) # type: ignore
|
|
155
|
+
children = [rx.foreach(items, radio_group_item)]
|
|
130
156
|
|
|
131
157
|
return RadioGroupRoot.create(
|
|
132
158
|
Flex.create(
|
|
133
|
-
*
|
|
159
|
+
*children,
|
|
134
160
|
direction=direction,
|
|
135
161
|
gap=gap,
|
|
136
162
|
),
|
|
137
163
|
size=size,
|
|
164
|
+
default_value=default_value,
|
|
138
165
|
**props,
|
|
139
166
|
)
|