浏览代码

add fixes to rx.progress

Brandon Hsiao 1 年之前
父节点
当前提交
977a9d632b
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      reflex/components/radix/primitives/progress.py

+ 3 - 3
reflex/components/radix/primitives/progress.py

@@ -65,7 +65,7 @@ class ProgressIndicator(ProgressComponent):
                 "&[data_state='loading']": {
                 "&[data_state='loading']": {
                     "transition": f"transform {DEFAULT_ANIMATION_DURATION}ms linear",
                     "transition": f"transform {DEFAULT_ANIMATION_DURATION}ms linear",
                 },
                 },
-                "transform": f"translateX(-{100 - self.value}%)",  # type: ignore
+                "transform": f"translateX(calc(-100% + {self.value}%))",  # type: ignore
                 "boxShadow": "inset 0 0 0 1px var(--gray-a5)",
                 "boxShadow": "inset 0 0 0 1px var(--gray-a5)",
             }
             }
         )
         )
@@ -78,7 +78,7 @@ class Progress(SimpleNamespace):
     indicator = staticmethod(ProgressIndicator.create)
     indicator = staticmethod(ProgressIndicator.create)
 
 
     @staticmethod
     @staticmethod
-    def __call__(**props) -> Component:
+    def __call__(width: Optional[str] = "100%", **props) -> Component:
         """High level API for progress bar.
         """High level API for progress bar.
 
 
         Args:
         Args:
@@ -88,7 +88,7 @@ class Progress(SimpleNamespace):
             The progress bar.
             The progress bar.
         """
         """
         return ProgressRoot.create(
         return ProgressRoot.create(
-            ProgressIndicator.create(value=props.get("value")),
+            ProgressIndicator.create(width=width, value=props.get("value")),
             **props,
             **props,
         )
         )