[REF-3592]Promote rx.progress
from radix themes (#3878)
* Promote `rx.progress` from radix themes * fix pyi * add warning when accessing `rx._x.progress`
This commit is contained in:
parent
d0b9b955b8
commit
dade940632
@ -140,6 +140,7 @@ RADIX_THEMES_COMPONENTS_MAPPING: dict = {
|
|||||||
"components.radix.themes.components.radio_group": ["radio", "radio_group"],
|
"components.radix.themes.components.radio_group": ["radio", "radio_group"],
|
||||||
"components.radix.themes.components.dropdown_menu": ["menu", "dropdown_menu"],
|
"components.radix.themes.components.dropdown_menu": ["menu", "dropdown_menu"],
|
||||||
"components.radix.themes.components.separator": ["divider", "separator"],
|
"components.radix.themes.components.separator": ["divider", "separator"],
|
||||||
|
"components.radix.themes.components.progress": ["progress"],
|
||||||
}
|
}
|
||||||
|
|
||||||
RADIX_THEMES_LAYOUT_MAPPING: dict = {
|
RADIX_THEMES_LAYOUT_MAPPING: dict = {
|
||||||
@ -205,7 +206,6 @@ RADIX_PRIMITIVES_MAPPING: dict = {
|
|||||||
"components.radix.primitives.form": [
|
"components.radix.primitives.form": [
|
||||||
"form",
|
"form",
|
||||||
],
|
],
|
||||||
"components.radix.primitives.progress": ["progress"],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
COMPONENTS_CORE_MAPPING: dict = {
|
COMPONENTS_CORE_MAPPING: dict = {
|
||||||
|
@ -71,7 +71,6 @@ from .components.plotly import plotly as plotly
|
|||||||
from .components.radix.primitives.accordion import accordion as accordion
|
from .components.radix.primitives.accordion import accordion as accordion
|
||||||
from .components.radix.primitives.drawer import drawer as drawer
|
from .components.radix.primitives.drawer import drawer as drawer
|
||||||
from .components.radix.primitives.form import form as form
|
from .components.radix.primitives.form import form as form
|
||||||
from .components.radix.primitives.progress import progress as progress
|
|
||||||
from .components.radix.themes.base import theme as theme
|
from .components.radix.themes.base import theme as theme
|
||||||
from .components.radix.themes.base import theme_panel as theme_panel
|
from .components.radix.themes.base import theme_panel as theme_panel
|
||||||
from .components.radix.themes.color_mode import color_mode as color_mode
|
from .components.radix.themes.color_mode import color_mode as color_mode
|
||||||
@ -106,6 +105,7 @@ from .components.radix.themes.components.hover_card import hover_card as hover_c
|
|||||||
from .components.radix.themes.components.icon_button import icon_button as icon_button
|
from .components.radix.themes.components.icon_button import icon_button as icon_button
|
||||||
from .components.radix.themes.components.inset import inset as inset
|
from .components.radix.themes.components.inset import inset as inset
|
||||||
from .components.radix.themes.components.popover import popover as popover
|
from .components.radix.themes.components.popover import popover as popover
|
||||||
|
from .components.radix.themes.components.progress import progress as progress
|
||||||
from .components.radix.themes.components.radio_cards import radio_cards as radio_cards
|
from .components.radix.themes.components.radio_cards import radio_cards as radio_cards
|
||||||
from .components.radix.themes.components.radio_group import radio as radio
|
from .components.radix.themes.components.radio_group import radio as radio
|
||||||
from .components.radix.themes.components.radio_group import radio_group as radio_group
|
from .components.radix.themes.components.radio_group import radio_group as radio_group
|
||||||
|
@ -8,7 +8,6 @@ from . import themes as themes
|
|||||||
from .primitives.accordion import accordion as accordion
|
from .primitives.accordion import accordion as accordion
|
||||||
from .primitives.drawer import drawer as drawer
|
from .primitives.drawer import drawer as drawer
|
||||||
from .primitives.form import form as form
|
from .primitives.form import form as form
|
||||||
from .primitives.progress import progress as progress
|
|
||||||
from .themes.base import theme as theme
|
from .themes.base import theme as theme
|
||||||
from .themes.base import theme_panel as theme_panel
|
from .themes.base import theme_panel as theme_panel
|
||||||
from .themes.color_mode import color_mode as color_mode
|
from .themes.color_mode import color_mode as color_mode
|
||||||
@ -31,6 +30,7 @@ from .themes.components.hover_card import hover_card as hover_card
|
|||||||
from .themes.components.icon_button import icon_button as icon_button
|
from .themes.components.icon_button import icon_button as icon_button
|
||||||
from .themes.components.inset import inset as inset
|
from .themes.components.inset import inset as inset
|
||||||
from .themes.components.popover import popover as popover
|
from .themes.components.popover import popover as popover
|
||||||
|
from .themes.components.progress import progress as progress
|
||||||
from .themes.components.radio_cards import radio_cards as radio_cards
|
from .themes.components.radio_cards import radio_cards as radio_cards
|
||||||
from .themes.components.radio_group import radio as radio
|
from .themes.components.radio_group import radio as radio
|
||||||
from .themes.components.radio_group import radio_group as radio_group
|
from .themes.components.radio_group import radio_group as radio_group
|
||||||
|
@ -6,4 +6,3 @@
|
|||||||
from .accordion import accordion as accordion
|
from .accordion import accordion as accordion
|
||||||
from .drawer import drawer as drawer
|
from .drawer import drawer as drawer
|
||||||
from .form import form as form
|
from .form import form as form
|
||||||
from .progress import progress as progress
|
|
||||||
|
@ -22,6 +22,7 @@ from .hover_card import hover_card as hover_card
|
|||||||
from .icon_button import icon_button as icon_button
|
from .icon_button import icon_button as icon_button
|
||||||
from .inset import inset as inset
|
from .inset import inset as inset
|
||||||
from .popover import popover as popover
|
from .popover import popover as popover
|
||||||
|
from .progress import progress as progress
|
||||||
from .radio_cards import radio_cards as radio_cards
|
from .radio_cards import radio_cards as radio_cards
|
||||||
from .radio_group import radio as radio
|
from .radio_group import radio as radio
|
||||||
from .radio_group import radio_group as radio_group
|
from .radio_group import radio_group as radio_group
|
||||||
|
@ -32,18 +32,39 @@ class ExperimentalNamespace(SimpleNamespace):
|
|||||||
Returns:
|
Returns:
|
||||||
The toast namespace.
|
The toast namespace.
|
||||||
"""
|
"""
|
||||||
if "toast" not in _EMITTED_PROMOTION_WARNINGS:
|
self.register_component_warning("toast")
|
||||||
_EMITTED_PROMOTION_WARNINGS.add("toast")
|
|
||||||
warn(f"`rx._x.toast` was promoted to `rx.toast`.")
|
|
||||||
return toast
|
return toast
|
||||||
|
|
||||||
|
@property
|
||||||
|
def progress(self):
|
||||||
|
"""Temporary property returning the toast namespace.
|
||||||
|
|
||||||
|
Remove this property when toast is fully promoted.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
The toast namespace.
|
||||||
|
"""
|
||||||
|
self.register_component_warning("progress")
|
||||||
|
return progress
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def register_component_warning(component_name: str):
|
||||||
|
"""Add component to emitted warnings and throw a warning if it
|
||||||
|
doesn't exist.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
component_name: name of the component.
|
||||||
|
"""
|
||||||
|
if component_name not in _EMITTED_PROMOTION_WARNINGS:
|
||||||
|
_EMITTED_PROMOTION_WARNINGS.add(component_name)
|
||||||
|
warn(f"`rx._x.{component_name}` was promoted to `rx.{component_name}`.")
|
||||||
|
|
||||||
|
|
||||||
_x = ExperimentalNamespace(
|
_x = ExperimentalNamespace(
|
||||||
asset=asset,
|
asset=asset,
|
||||||
client_state=ClientStateVar.create,
|
client_state=ClientStateVar.create,
|
||||||
hooks=hooks,
|
hooks=hooks,
|
||||||
layout=layout,
|
layout=layout,
|
||||||
progress=progress,
|
|
||||||
PropsBase=PropsBase,
|
PropsBase=PropsBase,
|
||||||
run_in_thread=run_in_thread,
|
run_in_thread=run_in_thread,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user