reflex 0.3.9a1__py3-none-any.whl → 0.3.9a2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of reflex might be problematic. Click here for more details.
- reflex/.templates/jinja/web/pages/utils.js.jinja2 +1 -1
- reflex/app.py +3 -4
- reflex/components/component.py +3 -1
- reflex/components/core/match.py +8 -4
- reflex/components/markdown/markdown.py +1 -0
- reflex/components/radix/__init__.py +2 -0
- reflex/components/radix/primitives/__init__.py +14 -1
- reflex/components/radix/primitives/accordion.py +426 -69
- reflex/components/radix/primitives/accordion.pyi +41 -11
- reflex/components/radix/primitives/base.py +4 -0
- reflex/components/radix/primitives/base.pyi +81 -0
- reflex/components/radix/primitives/form.py +4 -2
- reflex/components/radix/primitives/form.pyi +2 -2
- reflex/components/radix/primitives/progress.py +4 -2
- reflex/components/radix/primitives/progress.pyi +2 -2
- reflex/components/radix/primitives/slider.py +7 -5
- reflex/components/radix/primitives/slider.pyi +5 -5
- reflex/components/radix/themes/components/__init__.py +6 -2
- reflex/components/radix/themes/components/callout.py +36 -5
- reflex/components/radix/themes/components/callout.pyi +273 -9
- reflex/components/radix/themes/components/checkbox.py +41 -4
- reflex/components/radix/themes/components/checkbox.pyi +231 -8
- reflex/components/radix/themes/components/icons.py +1 -0
- reflex/components/radix/themes/components/radiogroup.py +65 -1
- reflex/components/radix/themes/components/radiogroup.pyi +252 -2
- reflex/components/radix/themes/components/select.py +81 -1
- reflex/components/radix/themes/components/select.pyi +237 -1
- reflex/state.py +6 -3
- reflex/style.py +15 -0
- reflex/utils/prerequisites.py +3 -1
- reflex/utils/types.py +4 -1
- reflex/vars.py +36 -3
- {reflex-0.3.9a1.dist-info → reflex-0.3.9a2.dist-info}/METADATA +1 -1
- {reflex-0.3.9a1.dist-info → reflex-0.3.9a2.dist-info}/RECORD +37 -37
- {reflex-0.3.9a1.dist-info → reflex-0.3.9a2.dist-info}/LICENSE +0 -0
- {reflex-0.3.9a1.dist-info → reflex-0.3.9a2.dist-info}/WHEEL +0 -0
- {reflex-0.3.9a1.dist-info → reflex-0.3.9a2.dist-info}/entry_points.txt +0 -0
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"""Interactive components provided by @radix-ui/themes."""
|
|
2
2
|
from typing import Any, Dict, Literal
|
|
3
3
|
|
|
4
|
+
from reflex.components.component import Component
|
|
5
|
+
from reflex.components.radix.themes.layout.flex import Flex
|
|
6
|
+
from reflex.components.radix.themes.typography.text import Text
|
|
4
7
|
from reflex.vars import Var
|
|
5
8
|
|
|
6
9
|
from ..base import (
|
|
7
10
|
CommonMarginProps,
|
|
8
11
|
LiteralAccentColor,
|
|
9
|
-
|
|
12
|
+
LiteralSize,
|
|
10
13
|
LiteralVariant,
|
|
11
14
|
RadixThemesComponent,
|
|
12
15
|
)
|
|
@@ -34,9 +37,6 @@ class Checkbox(CommonMarginProps, RadixThemesComponent):
|
|
|
34
37
|
# Whether to render the button with higher contrast color against background
|
|
35
38
|
high_contrast: Var[bool]
|
|
36
39
|
|
|
37
|
-
# Override theme radius for button: "none" | "small" | "medium" | "large" | "full"
|
|
38
|
-
radius: Var[LiteralRadius]
|
|
39
|
-
|
|
40
40
|
# Whether the checkbox is checked by default
|
|
41
41
|
default_checked: Var[bool]
|
|
42
42
|
|
|
@@ -65,3 +65,40 @@ class Checkbox(CommonMarginProps, RadixThemesComponent):
|
|
|
65
65
|
**super().get_event_triggers(),
|
|
66
66
|
"on_checked_change": lambda e0: [e0],
|
|
67
67
|
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class HighLevelCheckbox(Checkbox):
|
|
71
|
+
"""A checkbox component with a label."""
|
|
72
|
+
|
|
73
|
+
# The text label for the checkbox.
|
|
74
|
+
text: Var[str]
|
|
75
|
+
|
|
76
|
+
# The gap between the checkbox and the label.
|
|
77
|
+
gap: Var[LiteralSize]
|
|
78
|
+
|
|
79
|
+
# The size of the checkbox.
|
|
80
|
+
size: Var[LiteralCheckboxSize]
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def create(cls, text: Var[str] = Var.create_safe(""), **props) -> Component:
|
|
84
|
+
"""Create a checkbox with a label.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
text: The text of the label.
|
|
88
|
+
**props: Additional properties to apply to the checkbox item.
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
The checkbox component with a label.
|
|
92
|
+
"""
|
|
93
|
+
gap = props.pop("gap", "2")
|
|
94
|
+
size = props.pop("size", "2")
|
|
95
|
+
|
|
96
|
+
return Text.create(
|
|
97
|
+
Flex.create(
|
|
98
|
+
Checkbox.create(size=size, **props),
|
|
99
|
+
text,
|
|
100
|
+
gap=gap,
|
|
101
|
+
),
|
|
102
|
+
as_="label",
|
|
103
|
+
size=size,
|
|
104
|
+
)
|
|
@@ -8,11 +8,14 @@ from reflex.vars import Var, BaseVar, ComputedVar
|
|
|
8
8
|
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
9
|
from reflex.style import Style
|
|
10
10
|
from typing import Any, Dict, Literal
|
|
11
|
+
from reflex.components.component import Component
|
|
12
|
+
from reflex.components.radix.themes.layout.flex import Flex
|
|
13
|
+
from reflex.components.radix.themes.typography.text import Text
|
|
11
14
|
from reflex.vars import Var
|
|
12
15
|
from ..base import (
|
|
13
16
|
CommonMarginProps,
|
|
14
17
|
LiteralAccentColor,
|
|
15
|
-
|
|
18
|
+
LiteralSize,
|
|
16
19
|
LiteralVariant,
|
|
17
20
|
RadixThemesComponent,
|
|
18
21
|
)
|
|
@@ -100,12 +103,6 @@ class Checkbox(CommonMarginProps, RadixThemesComponent):
|
|
|
100
103
|
]
|
|
101
104
|
] = None,
|
|
102
105
|
high_contrast: Optional[Union[Var[bool], bool]] = None,
|
|
103
|
-
radius: Optional[
|
|
104
|
-
Union[
|
|
105
|
-
Var[Literal["none", "small", "medium", "large", "full"]],
|
|
106
|
-
Literal["none", "small", "medium", "large", "full"],
|
|
107
|
-
]
|
|
108
|
-
] = None,
|
|
109
106
|
default_checked: Optional[Union[Var[bool], bool]] = None,
|
|
110
107
|
checked: Optional[Union[Var[bool], bool]] = None,
|
|
111
108
|
disabled: Optional[Union[Var[bool], bool]] = None,
|
|
@@ -223,7 +220,6 @@ class Checkbox(CommonMarginProps, RadixThemesComponent):
|
|
|
223
220
|
size: Button size "1" - "3"
|
|
224
221
|
variant: Variant of button: "solid" | "soft" | "outline" | "ghost"
|
|
225
222
|
high_contrast: Whether to render the button with higher contrast color against background
|
|
226
|
-
radius: Override theme radius for button: "none" | "small" | "medium" | "large" | "full"
|
|
227
223
|
default_checked: Whether the checkbox is checked by default
|
|
228
224
|
checked: Whether the checkbox is checked
|
|
229
225
|
disabled: Whether the checkbox is disabled
|
|
@@ -249,3 +245,230 @@ class Checkbox(CommonMarginProps, RadixThemesComponent):
|
|
|
249
245
|
A new component instance.
|
|
250
246
|
"""
|
|
251
247
|
...
|
|
248
|
+
|
|
249
|
+
class HighLevelCheckbox(Checkbox):
|
|
250
|
+
@overload
|
|
251
|
+
@classmethod
|
|
252
|
+
def create( # type: ignore
|
|
253
|
+
cls,
|
|
254
|
+
*children,
|
|
255
|
+
text: Optional[Union[Var[str], str]] = None,
|
|
256
|
+
gap: Optional[
|
|
257
|
+
Union[
|
|
258
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
259
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
260
|
+
]
|
|
261
|
+
] = None,
|
|
262
|
+
size: Optional[
|
|
263
|
+
Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
|
|
264
|
+
] = None,
|
|
265
|
+
as_child: Optional[Union[Var[bool], bool]] = None,
|
|
266
|
+
variant: Optional[
|
|
267
|
+
Union[
|
|
268
|
+
Var[Literal["classic", "solid", "soft", "surface", "outline", "ghost"]],
|
|
269
|
+
Literal["classic", "solid", "soft", "surface", "outline", "ghost"],
|
|
270
|
+
]
|
|
271
|
+
] = None,
|
|
272
|
+
color: Optional[
|
|
273
|
+
Union[
|
|
274
|
+
Var[
|
|
275
|
+
Literal[
|
|
276
|
+
"tomato",
|
|
277
|
+
"red",
|
|
278
|
+
"ruby",
|
|
279
|
+
"crimson",
|
|
280
|
+
"pink",
|
|
281
|
+
"plum",
|
|
282
|
+
"purple",
|
|
283
|
+
"violet",
|
|
284
|
+
"iris",
|
|
285
|
+
"indigo",
|
|
286
|
+
"blue",
|
|
287
|
+
"cyan",
|
|
288
|
+
"teal",
|
|
289
|
+
"jade",
|
|
290
|
+
"green",
|
|
291
|
+
"grass",
|
|
292
|
+
"brown",
|
|
293
|
+
"orange",
|
|
294
|
+
"sky",
|
|
295
|
+
"mint",
|
|
296
|
+
"lime",
|
|
297
|
+
"yellow",
|
|
298
|
+
"amber",
|
|
299
|
+
"gold",
|
|
300
|
+
"bronze",
|
|
301
|
+
"gray",
|
|
302
|
+
]
|
|
303
|
+
],
|
|
304
|
+
Literal[
|
|
305
|
+
"tomato",
|
|
306
|
+
"red",
|
|
307
|
+
"ruby",
|
|
308
|
+
"crimson",
|
|
309
|
+
"pink",
|
|
310
|
+
"plum",
|
|
311
|
+
"purple",
|
|
312
|
+
"violet",
|
|
313
|
+
"iris",
|
|
314
|
+
"indigo",
|
|
315
|
+
"blue",
|
|
316
|
+
"cyan",
|
|
317
|
+
"teal",
|
|
318
|
+
"jade",
|
|
319
|
+
"green",
|
|
320
|
+
"grass",
|
|
321
|
+
"brown",
|
|
322
|
+
"orange",
|
|
323
|
+
"sky",
|
|
324
|
+
"mint",
|
|
325
|
+
"lime",
|
|
326
|
+
"yellow",
|
|
327
|
+
"amber",
|
|
328
|
+
"gold",
|
|
329
|
+
"bronze",
|
|
330
|
+
"gray",
|
|
331
|
+
],
|
|
332
|
+
]
|
|
333
|
+
] = None,
|
|
334
|
+
high_contrast: Optional[Union[Var[bool], bool]] = None,
|
|
335
|
+
default_checked: Optional[Union[Var[bool], bool]] = None,
|
|
336
|
+
checked: Optional[Union[Var[bool], bool]] = None,
|
|
337
|
+
disabled: Optional[Union[Var[bool], bool]] = None,
|
|
338
|
+
required: Optional[Union[Var[bool], bool]] = None,
|
|
339
|
+
name: Optional[Union[Var[str], str]] = None,
|
|
340
|
+
value: Optional[Union[Var[str], str]] = None,
|
|
341
|
+
m: Optional[
|
|
342
|
+
Union[
|
|
343
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
344
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
345
|
+
]
|
|
346
|
+
] = None,
|
|
347
|
+
mx: Optional[
|
|
348
|
+
Union[
|
|
349
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
350
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
351
|
+
]
|
|
352
|
+
] = None,
|
|
353
|
+
my: Optional[
|
|
354
|
+
Union[
|
|
355
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
356
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
357
|
+
]
|
|
358
|
+
] = None,
|
|
359
|
+
mt: Optional[
|
|
360
|
+
Union[
|
|
361
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
362
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
363
|
+
]
|
|
364
|
+
] = None,
|
|
365
|
+
mr: Optional[
|
|
366
|
+
Union[
|
|
367
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
368
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
369
|
+
]
|
|
370
|
+
] = None,
|
|
371
|
+
mb: Optional[
|
|
372
|
+
Union[
|
|
373
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
374
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
375
|
+
]
|
|
376
|
+
] = None,
|
|
377
|
+
ml: Optional[
|
|
378
|
+
Union[
|
|
379
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
380
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
381
|
+
]
|
|
382
|
+
] = None,
|
|
383
|
+
style: Optional[Style] = None,
|
|
384
|
+
key: Optional[Any] = None,
|
|
385
|
+
id: Optional[Any] = None,
|
|
386
|
+
class_name: Optional[Any] = None,
|
|
387
|
+
autofocus: Optional[bool] = None,
|
|
388
|
+
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
389
|
+
on_blur: Optional[
|
|
390
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
391
|
+
] = None,
|
|
392
|
+
on_checked_change: Optional[
|
|
393
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
394
|
+
] = None,
|
|
395
|
+
on_click: Optional[
|
|
396
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
397
|
+
] = None,
|
|
398
|
+
on_context_menu: Optional[
|
|
399
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
400
|
+
] = None,
|
|
401
|
+
on_double_click: Optional[
|
|
402
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
403
|
+
] = None,
|
|
404
|
+
on_focus: Optional[
|
|
405
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
406
|
+
] = None,
|
|
407
|
+
on_mount: Optional[
|
|
408
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
409
|
+
] = None,
|
|
410
|
+
on_mouse_down: Optional[
|
|
411
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
412
|
+
] = None,
|
|
413
|
+
on_mouse_enter: Optional[
|
|
414
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
415
|
+
] = None,
|
|
416
|
+
on_mouse_leave: Optional[
|
|
417
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
418
|
+
] = None,
|
|
419
|
+
on_mouse_move: Optional[
|
|
420
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
421
|
+
] = None,
|
|
422
|
+
on_mouse_out: Optional[
|
|
423
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
424
|
+
] = None,
|
|
425
|
+
on_mouse_over: Optional[
|
|
426
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
427
|
+
] = None,
|
|
428
|
+
on_mouse_up: Optional[
|
|
429
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
430
|
+
] = None,
|
|
431
|
+
on_scroll: Optional[
|
|
432
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
433
|
+
] = None,
|
|
434
|
+
on_unmount: Optional[
|
|
435
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
436
|
+
] = None,
|
|
437
|
+
**props
|
|
438
|
+
) -> "HighLevelCheckbox":
|
|
439
|
+
"""Create a checkbox with a label.
|
|
440
|
+
|
|
441
|
+
Args:
|
|
442
|
+
text: The text of the label.
|
|
443
|
+
text: The text label for the checkbox.
|
|
444
|
+
gap: The gap between the checkbox and the label.
|
|
445
|
+
size: Button size "1" - "3"
|
|
446
|
+
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
447
|
+
variant: Variant of button: "solid" | "soft" | "outline" | "ghost"
|
|
448
|
+
color: Override theme color for button
|
|
449
|
+
high_contrast: Whether to render the button with higher contrast color against background
|
|
450
|
+
default_checked: Whether the checkbox is checked by default
|
|
451
|
+
checked: Whether the checkbox is checked
|
|
452
|
+
disabled: Whether the checkbox is disabled
|
|
453
|
+
required: Whether the checkbox is required
|
|
454
|
+
name: The name of the checkbox control when submitting the form.
|
|
455
|
+
value: The value of the checkbox control when submitting the form.
|
|
456
|
+
m: Margin: "0" - "9"
|
|
457
|
+
mx: Margin horizontal: "0" - "9"
|
|
458
|
+
my: Margin vertical: "0" - "9"
|
|
459
|
+
mt: Margin top: "0" - "9"
|
|
460
|
+
mr: Margin right: "0" - "9"
|
|
461
|
+
mb: Margin bottom: "0" - "9"
|
|
462
|
+
ml: Margin left: "0" - "9"
|
|
463
|
+
style: The style of the component.
|
|
464
|
+
key: A unique key for the component.
|
|
465
|
+
id: The id for the component.
|
|
466
|
+
class_name: The class name for the component.
|
|
467
|
+
autofocus: Whether the component should take the focus once the page is loaded
|
|
468
|
+
custom_attrs: custom attribute
|
|
469
|
+
**props: Additional properties to apply to the checkbox item.
|
|
470
|
+
|
|
471
|
+
Returns:
|
|
472
|
+
The checkbox component with a label.
|
|
473
|
+
"""
|
|
474
|
+
...
|
|
@@ -46,6 +46,7 @@ class Icon(RadixIconComponent):
|
|
|
46
46
|
f"Invalid icon tag: {props['tag']}. Please use one of the following: {sorted(ICON_LIST)}"
|
|
47
47
|
)
|
|
48
48
|
props["tag"] = format.to_title_case(props["tag"]) + "Icon"
|
|
49
|
+
props["alias"] = f"RadixThemes{props['tag']}"
|
|
49
50
|
return super().create(*children, **props)
|
|
50
51
|
|
|
51
52
|
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
"""Interactive components provided by @radix-ui/themes."""
|
|
2
|
-
from typing import Any, Dict, Literal
|
|
2
|
+
from typing import Any, Dict, List, Literal
|
|
3
3
|
|
|
4
|
+
import reflex as rx
|
|
5
|
+
from reflex.components.component import Component
|
|
6
|
+
from reflex.components.radix.themes.layout.flex import Flex
|
|
7
|
+
from reflex.components.radix.themes.typography.text import Text
|
|
4
8
|
from reflex.vars import Var
|
|
5
9
|
|
|
6
10
|
from ..base import (
|
|
7
11
|
CommonMarginProps,
|
|
8
12
|
LiteralAccentColor,
|
|
13
|
+
LiteralSize,
|
|
9
14
|
RadixThemesComponent,
|
|
10
15
|
)
|
|
11
16
|
|
|
17
|
+
LiteralFlexDirection = Literal["row", "column", "row-reverse", "column-reverse"]
|
|
18
|
+
|
|
12
19
|
|
|
13
20
|
class RadioGroupRoot(CommonMarginProps, RadixThemesComponent):
|
|
14
21
|
"""Trigger an action or event, such as submitting a form or displaying a dialog."""
|
|
@@ -73,3 +80,60 @@ class RadioGroupItem(CommonMarginProps, RadixThemesComponent):
|
|
|
73
80
|
|
|
74
81
|
# When true, indicates that the user must check the radio item before the owning form can be submitted.
|
|
75
82
|
required: Var[bool]
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class HighLevelRadioGroup(RadioGroupRoot):
|
|
86
|
+
"""High level wrapper for the RadioGroup component."""
|
|
87
|
+
|
|
88
|
+
# The items of the radio group.
|
|
89
|
+
items: Var[List[str]]
|
|
90
|
+
|
|
91
|
+
# The direction of the radio group.
|
|
92
|
+
direction: Var[LiteralFlexDirection] = Var.create_safe("column")
|
|
93
|
+
|
|
94
|
+
# The gap between the items of the radio group.
|
|
95
|
+
gap: Var[LiteralSize] = Var.create_safe("2")
|
|
96
|
+
|
|
97
|
+
# The size of the radio group.
|
|
98
|
+
size: Var[Literal["1", "2", "3"]] = Var.create_safe("2")
|
|
99
|
+
|
|
100
|
+
@classmethod
|
|
101
|
+
def create(cls, items: Var[List[str]], **props) -> Component:
|
|
102
|
+
"""Create a radio group component.
|
|
103
|
+
|
|
104
|
+
Args:
|
|
105
|
+
items: The items of the radio group.
|
|
106
|
+
**props: Additional properties to apply to the accordion item.
|
|
107
|
+
|
|
108
|
+
Returns:
|
|
109
|
+
The created radio group component.
|
|
110
|
+
"""
|
|
111
|
+
direction = props.pop("direction", "column")
|
|
112
|
+
gap = props.pop("gap", "2")
|
|
113
|
+
size = props.pop("size", "2")
|
|
114
|
+
|
|
115
|
+
def radio_group_item(value: str) -> Component:
|
|
116
|
+
return Text.create(
|
|
117
|
+
Flex.create(
|
|
118
|
+
RadioGroupItem.create(value=value),
|
|
119
|
+
value,
|
|
120
|
+
gap="2",
|
|
121
|
+
),
|
|
122
|
+
size=size,
|
|
123
|
+
as_="label",
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
if isinstance(items, Var):
|
|
127
|
+
child = [rx.foreach(items, radio_group_item)]
|
|
128
|
+
else:
|
|
129
|
+
child = [radio_group_item(value) for value in items] # type: ignore
|
|
130
|
+
|
|
131
|
+
return RadioGroupRoot.create(
|
|
132
|
+
Flex.create(
|
|
133
|
+
*child,
|
|
134
|
+
direction=direction,
|
|
135
|
+
gap=gap,
|
|
136
|
+
),
|
|
137
|
+
size=size,
|
|
138
|
+
**props,
|
|
139
|
+
)
|
|
@@ -7,9 +7,20 @@ from typing import Any, Dict, Literal, Optional, Union, overload
|
|
|
7
7
|
from reflex.vars import Var, BaseVar, ComputedVar
|
|
8
8
|
from reflex.event import EventChain, EventHandler, EventSpec
|
|
9
9
|
from reflex.style import Style
|
|
10
|
-
from typing import Any, Dict, Literal
|
|
10
|
+
from typing import Any, Dict, List, Literal
|
|
11
|
+
import reflex as rx
|
|
12
|
+
from reflex.components.component import Component
|
|
13
|
+
from reflex.components.radix.themes.layout.flex import Flex
|
|
14
|
+
from reflex.components.radix.themes.typography.text import Text
|
|
11
15
|
from reflex.vars import Var
|
|
12
|
-
from ..base import
|
|
16
|
+
from ..base import (
|
|
17
|
+
CommonMarginProps,
|
|
18
|
+
LiteralAccentColor,
|
|
19
|
+
LiteralSize,
|
|
20
|
+
RadixThemesComponent,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
LiteralFlexDirection = Literal["row", "column", "row-reverse", "column-reverse"]
|
|
13
24
|
|
|
14
25
|
class RadioGroupRoot(CommonMarginProps, RadixThemesComponent):
|
|
15
26
|
def get_event_triggers(self) -> Dict[str, Any]: ...
|
|
@@ -438,3 +449,242 @@ class RadioGroupItem(CommonMarginProps, RadixThemesComponent):
|
|
|
438
449
|
A new component instance.
|
|
439
450
|
"""
|
|
440
451
|
...
|
|
452
|
+
|
|
453
|
+
class HighLevelRadioGroup(RadioGroupRoot):
|
|
454
|
+
@overload
|
|
455
|
+
@classmethod
|
|
456
|
+
def create( # type: ignore
|
|
457
|
+
cls,
|
|
458
|
+
*children,
|
|
459
|
+
items: Optional[Union[Var[List[str]], List[str]]] = None,
|
|
460
|
+
direction: Optional[
|
|
461
|
+
Union[
|
|
462
|
+
Var[Literal["row", "column", "row-reverse", "column-reverse"]],
|
|
463
|
+
Literal["row", "column", "row-reverse", "column-reverse"],
|
|
464
|
+
]
|
|
465
|
+
] = None,
|
|
466
|
+
gap: Optional[
|
|
467
|
+
Union[
|
|
468
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
469
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
470
|
+
]
|
|
471
|
+
] = None,
|
|
472
|
+
size: Optional[
|
|
473
|
+
Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
|
|
474
|
+
] = None,
|
|
475
|
+
variant: Optional[
|
|
476
|
+
Union[
|
|
477
|
+
Var[Literal["classic", "surface", "soft"]],
|
|
478
|
+
Literal["classic", "surface", "soft"],
|
|
479
|
+
]
|
|
480
|
+
] = None,
|
|
481
|
+
color: Optional[
|
|
482
|
+
Union[
|
|
483
|
+
Var[
|
|
484
|
+
Literal[
|
|
485
|
+
"tomato",
|
|
486
|
+
"red",
|
|
487
|
+
"ruby",
|
|
488
|
+
"crimson",
|
|
489
|
+
"pink",
|
|
490
|
+
"plum",
|
|
491
|
+
"purple",
|
|
492
|
+
"violet",
|
|
493
|
+
"iris",
|
|
494
|
+
"indigo",
|
|
495
|
+
"blue",
|
|
496
|
+
"cyan",
|
|
497
|
+
"teal",
|
|
498
|
+
"jade",
|
|
499
|
+
"green",
|
|
500
|
+
"grass",
|
|
501
|
+
"brown",
|
|
502
|
+
"orange",
|
|
503
|
+
"sky",
|
|
504
|
+
"mint",
|
|
505
|
+
"lime",
|
|
506
|
+
"yellow",
|
|
507
|
+
"amber",
|
|
508
|
+
"gold",
|
|
509
|
+
"bronze",
|
|
510
|
+
"gray",
|
|
511
|
+
]
|
|
512
|
+
],
|
|
513
|
+
Literal[
|
|
514
|
+
"tomato",
|
|
515
|
+
"red",
|
|
516
|
+
"ruby",
|
|
517
|
+
"crimson",
|
|
518
|
+
"pink",
|
|
519
|
+
"plum",
|
|
520
|
+
"purple",
|
|
521
|
+
"violet",
|
|
522
|
+
"iris",
|
|
523
|
+
"indigo",
|
|
524
|
+
"blue",
|
|
525
|
+
"cyan",
|
|
526
|
+
"teal",
|
|
527
|
+
"jade",
|
|
528
|
+
"green",
|
|
529
|
+
"grass",
|
|
530
|
+
"brown",
|
|
531
|
+
"orange",
|
|
532
|
+
"sky",
|
|
533
|
+
"mint",
|
|
534
|
+
"lime",
|
|
535
|
+
"yellow",
|
|
536
|
+
"amber",
|
|
537
|
+
"gold",
|
|
538
|
+
"bronze",
|
|
539
|
+
"gray",
|
|
540
|
+
],
|
|
541
|
+
]
|
|
542
|
+
] = None,
|
|
543
|
+
high_contrast: Optional[Union[Var[bool], bool]] = None,
|
|
544
|
+
value: Optional[Union[Var[str], str]] = None,
|
|
545
|
+
default_value: Optional[Union[Var[str], str]] = None,
|
|
546
|
+
disabled: Optional[Union[Var[bool], bool]] = None,
|
|
547
|
+
name: Optional[Union[Var[str], str]] = None,
|
|
548
|
+
required: Optional[Union[Var[bool], bool]] = None,
|
|
549
|
+
orientation: Optional[
|
|
550
|
+
Union[
|
|
551
|
+
Var[Literal["horizontal", "vertical"]],
|
|
552
|
+
Literal["horizontal", "vertical"],
|
|
553
|
+
]
|
|
554
|
+
] = None,
|
|
555
|
+
loop: Optional[Union[Var[bool], bool]] = None,
|
|
556
|
+
m: 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
|
+
mx: 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
|
+
my: 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
|
+
mt: 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
|
+
mr: Optional[
|
|
581
|
+
Union[
|
|
582
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
583
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
584
|
+
]
|
|
585
|
+
] = None,
|
|
586
|
+
mb: Optional[
|
|
587
|
+
Union[
|
|
588
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
589
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
590
|
+
]
|
|
591
|
+
] = None,
|
|
592
|
+
ml: Optional[
|
|
593
|
+
Union[
|
|
594
|
+
Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]],
|
|
595
|
+
Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
596
|
+
]
|
|
597
|
+
] = None,
|
|
598
|
+
style: Optional[Style] = None,
|
|
599
|
+
key: Optional[Any] = None,
|
|
600
|
+
id: Optional[Any] = None,
|
|
601
|
+
class_name: Optional[Any] = None,
|
|
602
|
+
autofocus: Optional[bool] = None,
|
|
603
|
+
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
|
|
604
|
+
on_blur: Optional[
|
|
605
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
606
|
+
] = None,
|
|
607
|
+
on_click: Optional[
|
|
608
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
609
|
+
] = None,
|
|
610
|
+
on_context_menu: Optional[
|
|
611
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
612
|
+
] = None,
|
|
613
|
+
on_double_click: Optional[
|
|
614
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
615
|
+
] = None,
|
|
616
|
+
on_focus: Optional[
|
|
617
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
618
|
+
] = None,
|
|
619
|
+
on_mount: Optional[
|
|
620
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
621
|
+
] = None,
|
|
622
|
+
on_mouse_down: Optional[
|
|
623
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
624
|
+
] = None,
|
|
625
|
+
on_mouse_enter: Optional[
|
|
626
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
627
|
+
] = None,
|
|
628
|
+
on_mouse_leave: Optional[
|
|
629
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
630
|
+
] = None,
|
|
631
|
+
on_mouse_move: Optional[
|
|
632
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
633
|
+
] = None,
|
|
634
|
+
on_mouse_out: Optional[
|
|
635
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
636
|
+
] = None,
|
|
637
|
+
on_mouse_over: Optional[
|
|
638
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
639
|
+
] = None,
|
|
640
|
+
on_mouse_up: Optional[
|
|
641
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
642
|
+
] = None,
|
|
643
|
+
on_scroll: Optional[
|
|
644
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
645
|
+
] = None,
|
|
646
|
+
on_unmount: Optional[
|
|
647
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
648
|
+
] = None,
|
|
649
|
+
on_value_change: Optional[
|
|
650
|
+
Union[EventHandler, EventSpec, list, function, BaseVar]
|
|
651
|
+
] = None,
|
|
652
|
+
**props
|
|
653
|
+
) -> "HighLevelRadioGroup":
|
|
654
|
+
"""Create a radio group component.
|
|
655
|
+
|
|
656
|
+
Args:
|
|
657
|
+
items: The items of the radio group.
|
|
658
|
+
items: The items of the radio group.
|
|
659
|
+
direction: The direction of the radio group.
|
|
660
|
+
gap: The gap between the items of the radio group.
|
|
661
|
+
size: The size of the radio group: "1" | "2" | "3"
|
|
662
|
+
variant: The variant of the radio group
|
|
663
|
+
color: The color of the radio group
|
|
664
|
+
high_contrast: Whether to render the radio group with higher contrast color against background
|
|
665
|
+
value: The controlled value of the radio item to check. Should be used in conjunction with onValueChange.
|
|
666
|
+
default_value: The initial value of checked radio item. Should be used in conjunction with onValueChange.
|
|
667
|
+
disabled: Whether the radio group is disabled
|
|
668
|
+
name: The name of the group. Submitted with its owning form as part of a name/value pair.
|
|
669
|
+
required: Whether the radio group is required
|
|
670
|
+
orientation: The orientation of the component.
|
|
671
|
+
loop: When true, keyboard navigation will loop from last item to first, and vice versa.
|
|
672
|
+
m: Margin: "0" - "9"
|
|
673
|
+
mx: Margin horizontal: "0" - "9"
|
|
674
|
+
my: Margin vertical: "0" - "9"
|
|
675
|
+
mt: Margin top: "0" - "9"
|
|
676
|
+
mr: Margin right: "0" - "9"
|
|
677
|
+
mb: Margin bottom: "0" - "9"
|
|
678
|
+
ml: Margin left: "0" - "9"
|
|
679
|
+
style: The style of the component.
|
|
680
|
+
key: A unique key for the component.
|
|
681
|
+
id: The id for the component.
|
|
682
|
+
class_name: The class name for the component.
|
|
683
|
+
autofocus: Whether the component should take the focus once the page is loaded
|
|
684
|
+
custom_attrs: custom attribute
|
|
685
|
+
**props: Additional properties to apply to the accordion item.
|
|
686
|
+
|
|
687
|
+
Returns:
|
|
688
|
+
The created radio group component.
|
|
689
|
+
"""
|
|
690
|
+
...
|