Преглед изворни кода

Allow access to position from HighLevelSelect (#2829)

hjpr пре 1 година
родитељ
комит
4413cb4038

+ 6 - 1
reflex/components/radix/themes/components/select.py

@@ -184,6 +184,9 @@ class HighLevelSelect(SelectRoot):
     # The width of the select.
     # The width of the select.
     width: Var[str]
     width: Var[str]
 
 
+    # The positioning mode to use. Default is "item-aligned".
+    position: Var[Literal["item-aligned", "popper"]]
+
     @classmethod
     @classmethod
     def create(cls, items: Union[List[str], Var[List[str]]], **props) -> Component:
     def create(cls, items: Union[List[str], Var[List[str]]], **props) -> Component:
         """Create a select component.
         """Create a select component.
@@ -196,7 +199,9 @@ class HighLevelSelect(SelectRoot):
             The select component.
             The select component.
         """
         """
         content_props = {
         content_props = {
-            prop: props.pop(prop) for prop in ["high_contrast"] if prop in props
+            prop: props.pop(prop)
+            for prop in ["high_contrast", "position"]
+            if prop in props
         }
         }
 
 
         trigger_props = {
         trigger_props = {

+ 14 - 0
reflex/components/radix/themes/components/select.pyi

@@ -864,6 +864,12 @@ class HighLevelSelect(SelectRoot):
             ]
             ]
         ] = None,
         ] = None,
         width: Optional[Union[Var[str], str]] = None,
         width: Optional[Union[Var[str], str]] = None,
+        position: Optional[
+            Union[
+                Var[Literal["item-aligned", "popper"]],
+                Literal["item-aligned", "popper"],
+            ]
+        ] = None,
         size: Optional[
         size: Optional[
             Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
             Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
         ] = None,
         ] = None,
@@ -945,6 +951,7 @@ class HighLevelSelect(SelectRoot):
             variant: The variant of the select.
             variant: The variant of the select.
             radius: The radius of the select.
             radius: The radius of the select.
             width: The width of the select.
             width: The width of the select.
+            position: The positioning mode to use. Default is "item-aligned".
             size: The size of the select: "1" | "2" | "3"
             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.
             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. Should be used in conjunction with on_change.
             value: The controlled value of the select. Should be used in conjunction with on_change.
@@ -1057,6 +1064,12 @@ class Select(ComponentNamespace):
             ]
             ]
         ] = None,
         ] = None,
         width: Optional[Union[Var[str], str]] = None,
         width: Optional[Union[Var[str], str]] = None,
+        position: Optional[
+            Union[
+                Var[Literal["item-aligned", "popper"]],
+                Literal["item-aligned", "popper"],
+            ]
+        ] = None,
         size: Optional[
         size: Optional[
             Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
             Union[Var[Literal["1", "2", "3"]], Literal["1", "2", "3"]]
         ] = None,
         ] = None,
@@ -1138,6 +1151,7 @@ class Select(ComponentNamespace):
             variant: The variant of the select.
             variant: The variant of the select.
             radius: The radius of the select.
             radius: The radius of the select.
             width: The width of the select.
             width: The width of the select.
+            position: The positioning mode to use. Default is "item-aligned".
             size: The size of the select: "1" | "2" | "3"
             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.
             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. Should be used in conjunction with on_change.
             value: The controlled value of the select. Should be used in conjunction with on_change.