Skip to content

Commit 478ceb7

Browse files
refactor: separate _input_select_impl()
1 parent ca671cd commit 478ceb7

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

shiny/ui/_input_select.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def input_selectize(
113113
"""
114114
resolved_id = resolve_id(id)
115115

116-
x = input_select(
116+
x = _input_select_impl(
117117
id=resolved_id,
118118
label=label,
119119
choices=restore_input(resolved_id, choices),
@@ -192,6 +192,37 @@ def input_select(
192192
* :func:`~shiny.ui.input_radio_buttons`
193193
* :func:`~shiny.ui.input_checkbox_group`
194194
"""
195+
resolved_id = resolve_id(id)
196+
197+
x = _input_select_impl(
198+
id=resolved_id,
199+
label=label,
200+
choices=restore_input(resolved_id, choices),
201+
selected=selected,
202+
multiple=multiple,
203+
selectize=selectize,
204+
width=width,
205+
size=size,
206+
remove_button=remove_button,
207+
options=options,
208+
)
209+
210+
return x
211+
212+
213+
def _input_select_impl(
214+
id: str,
215+
label: TagChild,
216+
choices: SelectChoicesArg,
217+
*,
218+
selected: Optional[str | list[str]] = None,
219+
multiple: bool = False,
220+
selectize: bool = False,
221+
width: Optional[str] = None,
222+
size: Optional[str] = None,
223+
remove_button: Optional[bool] = None,
224+
options: Optional[dict[str, Jsonifiable | JSEval]] = None,
225+
) -> Tag:
195226
if options is not None and selectize is False:
196227
raise Exception("Options can only be set when selectize is `True`.")
197228

0 commit comments

Comments
 (0)