From c81fa261b262d1161dc7bc688cd1e06f46a10df1 Mon Sep 17 00:00:00 2001 From: Tom Gotsman <64492814+tgberkeley@users.noreply.github.com> Date: Wed, 10 Jan 2024 17:56:04 -0800 Subject: [PATCH] update radix components (#2380) * update radix components * update for pyi * updates for pre commit * update pyi again --------- Co-authored-by: Tom Gotsman --- .../radix/themes/components/alertdialog.py | 8 ++++---- .../radix/themes/components/alertdialog.pyi | 9 ++++++++- .../radix/themes/components/radiogroup.py | 3 +++ .../radix/themes/components/radiogroup.pyi | 2 ++ .../components/radix/themes/components/select.py | 15 ++++++++++++--- .../components/radix/themes/components/select.pyi | 12 +++++++++--- .../components/radix/themes/components/slider.py | 9 ++++++--- .../components/radix/themes/components/slider.pyi | 8 +++++--- 8 files changed, 49 insertions(+), 17 deletions(-) diff --git a/reflex/components/radix/themes/components/alertdialog.py b/reflex/components/radix/themes/components/alertdialog.py index 5f4782ce5..e259c0996 100644 --- a/reflex/components/radix/themes/components/alertdialog.py +++ b/reflex/components/radix/themes/components/alertdialog.py @@ -4,10 +4,7 @@ from typing import Any, Dict, Literal from reflex import el from reflex.vars import Var -from ..base import ( - CommonMarginProps, - RadixThemesComponent, -) +from ..base import CommonMarginProps, LiteralSize, RadixThemesComponent LiteralSwitchSize = Literal["1", "2", "3", "4"] @@ -43,6 +40,9 @@ class AlertDialogContent(el.Div, CommonMarginProps, RadixThemesComponent): tag = "AlertDialog.Content" + # The size of the content. + size: Var[LiteralSize] + # Whether to force mount the content on open. force_mount: Var[bool] diff --git a/reflex/components/radix/themes/components/alertdialog.pyi b/reflex/components/radix/themes/components/alertdialog.pyi index 089268aae..fbcd8d660 100644 --- a/reflex/components/radix/themes/components/alertdialog.pyi +++ b/reflex/components/radix/themes/components/alertdialog.pyi @@ -10,7 +10,7 @@ from reflex.style import Style from typing import Any, Dict, Literal from reflex import el from reflex.vars import Var -from ..base import CommonMarginProps, RadixThemesComponent +from ..base import CommonMarginProps, LiteralSize, RadixThemesComponent LiteralSwitchSize = Literal["1", "2", "3", "4"] @@ -476,6 +476,12 @@ class AlertDialogContent(el.Div, CommonMarginProps, RadixThemesComponent): ], ] ] = None, + size: Optional[ + Union[ + Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]], + Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"], + ] + ] = None, force_mount: Optional[Union[Var[bool], bool]] = None, access_key: Optional[ Union[Var[Union[str, int, bool]], Union[str, int, bool]] @@ -633,6 +639,7 @@ class AlertDialogContent(el.Div, CommonMarginProps, RadixThemesComponent): *children: Child components. color: map to CSS default color property. color_scheme: map to radix color property. + size: The size of the content. force_mount: Whether to force mount the content on open. access_key: Provides a hint for generating a keyboard shortcut for the current element. auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user. diff --git a/reflex/components/radix/themes/components/radiogroup.py b/reflex/components/radix/themes/components/radiogroup.py index cef8445b3..78c29c070 100644 --- a/reflex/components/radix/themes/components/radiogroup.py +++ b/reflex/components/radix/themes/components/radiogroup.py @@ -36,6 +36,9 @@ class RadioGroupRoot(CommonMarginProps, RadixThemesComponent): # Whether the radio group is disabled disabled: Var[bool] + # The name of the group. Submitted with its owning form as part of a name/value pair. + name: Var[str] + # Whether the radio group is required required: Var[bool] diff --git a/reflex/components/radix/themes/components/radiogroup.pyi b/reflex/components/radix/themes/components/radiogroup.pyi index 34d727fa1..658c228c6 100644 --- a/reflex/components/radix/themes/components/radiogroup.pyi +++ b/reflex/components/radix/themes/components/radiogroup.pyi @@ -94,6 +94,7 @@ class RadioGroupRoot(CommonMarginProps, RadixThemesComponent): value: Optional[Union[Var[str], str]] = None, default_value: Optional[Union[Var[str], str]] = None, disabled: Optional[Union[Var[bool], bool]] = None, + name: Optional[Union[Var[str], str]] = None, required: Optional[Union[Var[bool], bool]] = None, orientation: Optional[ Union[ @@ -215,6 +216,7 @@ class RadioGroupRoot(CommonMarginProps, RadixThemesComponent): value: The controlled value of the radio item to check. Should be used in conjunction with onValueChange. default_value: The initial value of checked radio item. Should be used in conjunction with onValueChange. disabled: Whether the radio group is disabled + name: The name of the group. Submitted with its owning form as part of a name/value pair. required: Whether the radio group is required orientation: The orientation of the component. loop: When true, keyboard navigation will loop from last item to first, and vice versa. diff --git a/reflex/components/radix/themes/components/select.py b/reflex/components/radix/themes/components/select.py index 7a3fb3c8d..e62c76a12 100644 --- a/reflex/components/radix/themes/components/select.py +++ b/reflex/components/radix/themes/components/select.py @@ -24,18 +24,24 @@ class SelectRoot(CommonMarginProps, RadixThemesComponent): # The value of the select when initially rendered. Use when you do not need to control the state of the select. default_value: Var[str] - # The controlled value of the select. Use when you need to control the state of the select. + # The controlled value of the select. Should be used in conjunction with on_value_change. value: Var[str] # The open state of the select when it is initially rendered. Use when you do not need to control its open state. default_open: Var[bool] - # The controlled open state of the select. Must be used in conjunction with onOpenChange. + # The controlled open state of the select. Must be used in conjunction with on_open_change. open: Var[bool] # The name of the select control when submitting the form. name: Var[str] + # When True, prevents the user from interacting with select. + disabled: Var[bool] + + # When True, indicates that the user must select a value before the owning form can be submitted. + required: Var[bool] + def get_event_triggers(self) -> Dict[str, Any]: """Get the events triggers signatures for the component. @@ -121,9 +127,12 @@ class SelectItem(CommonMarginProps, RadixThemesComponent): tag = "Select.Item" - # The value of the select item when submitting the form. + # The value given as data when submitting a form with a name. value: Var[str] + # Whether the select item is disabled + disabled: Var[bool] + class SelectLabel(CommonMarginProps, RadixThemesComponent): """Trigger an action or event, such as submitting a form or displaying a dialog.""" diff --git a/reflex/components/radix/themes/components/select.pyi b/reflex/components/radix/themes/components/select.pyi index cd8b65545..142ff5864 100644 --- a/reflex/components/radix/themes/components/select.pyi +++ b/reflex/components/radix/themes/components/select.pyi @@ -94,6 +94,8 @@ class SelectRoot(CommonMarginProps, RadixThemesComponent): default_open: Optional[Union[Var[bool], bool]] = None, open: Optional[Union[Var[bool], bool]] = None, name: Optional[Union[Var[str], str]] = None, + disabled: Optional[Union[Var[bool], bool]] = None, + required: Optional[Union[Var[bool], bool]] = None, m: Optional[ Union[ Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]], @@ -206,10 +208,12 @@ class SelectRoot(CommonMarginProps, RadixThemesComponent): color_scheme: map to radix color property. size: The size of the select: "1" | "2" | "3" default_value: The value of the select when initially rendered. Use when you do not need to control the state of the select. - value: The controlled value of the select. Use when you need to control the state of the select. + value: The controlled value of the select. Should be used in conjunction with on_value_change. default_open: The open state of the select when it is initially rendered. Use when you do not need to control its open state. - open: The controlled open state of the select. Must be used in conjunction with onOpenChange. + open: The controlled open state of the select. Must be used in conjunction with on_open_change. name: The name of the select control when submitting the form. + disabled: When True, prevents the user from interacting with select. + required: When True, indicates that the user must select a value before the owning form can be submitted. m: Margin: "0" - "9" mx: Margin horizontal: "0" - "9" my: Margin vertical: "0" - "9" @@ -936,6 +940,7 @@ class SelectItem(CommonMarginProps, RadixThemesComponent): ] ] = None, value: Optional[Union[Var[str], str]] = None, + disabled: Optional[Union[Var[bool], bool]] = None, m: Optional[ Union[ Var[Literal["1", "2", "3", "4", "5", "6", "7", "8", "9"]], @@ -1040,7 +1045,8 @@ class SelectItem(CommonMarginProps, RadixThemesComponent): *children: Child components. color: map to CSS default color property. color_scheme: map to radix color property. - value: The value of the select item when submitting the form. + value: The value given as data when submitting a form with a name. + disabled: Whether the select item is disabled m: Margin: "0" - "9" mx: Margin horizontal: "0" - "9" my: Margin vertical: "0" - "9" diff --git a/reflex/components/radix/themes/components/slider.py b/reflex/components/radix/themes/components/slider.py index 9f48d2fbc..5ef0efa12 100644 --- a/reflex/components/radix/themes/components/slider.py +++ b/reflex/components/radix/themes/components/slider.py @@ -40,14 +40,17 @@ class Slider(CommonMarginProps, RadixThemesComponent): # The controlled value of the slider. Must be used in conjunction with onValueChange. value: Var[float] + # The name of the slider. Submitted with its owning form as part of a name/value pair. + name: Var[str] + # The minimum value of the slider. - min: Var[float] + min: Var[float, int] # The maximum value of the slider. - max: Var[float] + max: Var[float, int] # The step value of the slider. - step: Var[float] + step: Var[float, int] # Whether the slider is disabled disabled: Var[bool] diff --git a/reflex/components/radix/themes/components/slider.pyi b/reflex/components/radix/themes/components/slider.pyi index 607208948..8602e2471 100644 --- a/reflex/components/radix/themes/components/slider.pyi +++ b/reflex/components/radix/themes/components/slider.pyi @@ -105,9 +105,10 @@ class Slider(CommonMarginProps, RadixThemesComponent): ] = None, default_value: Optional[Union[Var[List[float]], List[float]]] = None, value: Optional[Union[Var[float], float]] = None, - min: Optional[Union[Var[float], float]] = None, - max: Optional[Union[Var[float], float]] = None, - step: Optional[Union[Var[float], float]] = None, + name: Optional[Union[Var[str], str]] = None, + min: Optional[Union[Var[float, int], float, int]] = None, + max: Optional[Union[Var[float, int], float, int]] = None, + step: Optional[Union[Var[float, int], float, int]] = None, disabled: Optional[Union[Var[bool], bool]] = None, orientation: Optional[ Union[ @@ -232,6 +233,7 @@ class Slider(CommonMarginProps, RadixThemesComponent): radius: Override theme radius for button: "none" | "small" | "medium" | "large" | "full" default_value: The value of the slider when initially rendered. Use when you do not need to control the state of the slider. value: The controlled value of the slider. Must be used in conjunction with onValueChange. + name: The name of the slider. Submitted with its owning form as part of a name/value pair. min: The minimum value of the slider. max: The maximum value of the slider. step: The step value of the slider.