1- __all__  =  (
2-     "insert_nav_panel" ,
3-     "remove_nav_panel" ,
4-     "hide_nav_panel" ,
5-     "show_nav_panel" ,
6- )
1+ __all__  =  ("insert_nav_panel" , "remove_nav_panel" , "update_nav_panel" )
72
83import  sys 
94from  typing  import  Optional , Union 
@@ -59,8 +54,7 @@ def insert_nav_panel(
5954    See Also 
6055    -------- 
6156    ~remove_nav_panel 
62-     ~show_nav_panel 
63-     ~hide_nav_panel 
57+     ~update_nav_panel 
6458    ~shiny.ui.nav_panel 
6559    """ 
6660
@@ -109,8 +103,7 @@ def remove_nav_panel(id: str, target: str, session: Optional[Session] = None) ->
109103    See Also 
110104    -------- 
111105    ~insert_nav_panel 
112-     ~show_nav_panel 
113-     ~hide_nav_panel 
106+     ~update_nav_panel 
114107    ~shiny.ui.nav_panel 
115108    """ 
116109
@@ -124,80 +117,47 @@ def remove_nav_panel(id: str, target: str, session: Optional[Session] = None) ->
124117
125118
126119@add_example () 
127- def  show_nav_panel (
128-     id : str , target : str , select : bool  =  False , session : Optional [Session ] =  None 
120+ def  update_nav_panel (
121+     id : str ,
122+     target : str ,
123+     method : Literal ["show" , "hide" ],
124+     session : Optional [Session ] =  None ,
129125) ->  None :
130126    """ 
131-     Show a navigation item 
127+     Show/hide  a navigation item 
132128
133129    Parameters 
134130    ---------- 
135131    id 
136132        The `id` of the relevant navigation container (i.e., `navset_*()` object). 
137133    target 
138134        The `value` of an existing :func:`shiny.ui.nav` item to show. 
139-     select  
140-         Whether the nav item's content should also be shown . 
135+     method  
136+         The action to perform on the nav_panel (`"show"` or `"hide"`) . 
141137    session 
142138        A :class:`~shiny.Session` instance. If not provided, it is inferred via 
143139        :func:`~shiny.session.get_current_session`. 
144140
145141    Note 
146142    ---- 
147-     For `show_nav_panel()` to be relevant/useful, a :func:`shiny.ui.nav` item must 
148-     have been hidden using :func:`~hide_nav_panel`. 
143+     On reveal, the `nav_panel` will not be the active tab. To change the active tab, use `~update_navs()` 
149144
150145    See Also 
151146    -------- 
152-     ~hide_nav_panel 
153147    ~insert_nav_panel 
154148    ~remove_nav_panel 
155149    ~shiny.ui.nav_panel 
150+     ~update_navs 
156151    """ 
157152
158153    session  =  require_active_session (session )
159154
160155    id  =  resolve_id (id )
161-     if  select :
162-         update_navs (id , selected = target )
163156
164157    msg  =  {
165158        "inputId" : id ,
166159        "target" : target ,
167-         "type" : "show" ,
168-     }
169- 
170-     session ._send_message_sync ({"shiny-change-tab-visibility" : msg })
171- 
172- 
173- def  hide_nav_panel (id : str , target : str , session : Optional [Session ] =  None ) ->  None :
174-     """ 
175-     Hide a navigation item 
176- 
177-     Parameters 
178-     ---------- 
179-     id 
180-         The `id` of the relevant navigation container (i.e., `navset_*()` object). 
181-     target 
182-         The `value` of an existing :func:`shiny.ui.nav` item to hide. 
183-     session 
184-         A :class:`~shiny.Session` instance. If not provided, it is inferred via 
185-         :func:`~shiny.session.get_current_session`. 
186- 
187-     See Also 
188-     -------- 
189-     ~show_nav_panel 
190-     ~insert_nav_panel 
191-     ~remove_nav_panel 
192-     ~shiny.ui.nav_panel 
193-     """ 
194- 
195-     session  =  require_active_session (session )
196- 
197-     msg  =  {
198-         "inputId" : resolve_id (id ),
199-         "target" : target ,
200-         "type" : "hide" ,
160+         "type" : method ,
201161    }
202162
203163    session ._send_message_sync ({"shiny-change-tab-visibility" : msg })
0 commit comments