streamlit-sortable-multiselect 0.7.8__tar.gz → 0.7.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (17) hide show
  1. {streamlit_sortable_multiselect-0.7.8/streamlit_sortable_multiselect.egg-info → streamlit_sortable_multiselect-0.7.9}/PKG-INFO +20 -1
  2. {streamlit_sortable_multiselect-0.7.8 → streamlit_sortable_multiselect-0.7.9}/README.md +19 -0
  3. {streamlit_sortable_multiselect-0.7.8 → streamlit_sortable_multiselect-0.7.9}/pyproject.toml +1 -1
  4. {streamlit_sortable_multiselect-0.7.8 → streamlit_sortable_multiselect-0.7.9}/streamlit_sortable_multiselect/__init__.py +9 -1
  5. streamlit_sortable_multiselect-0.7.9/streamlit_sortable_multiselect/frontend/build/assets/index-CWWibq9B.js +67 -0
  6. {streamlit_sortable_multiselect-0.7.8 → streamlit_sortable_multiselect-0.7.9}/streamlit_sortable_multiselect/frontend/build/index.html +1 -1
  7. {streamlit_sortable_multiselect-0.7.8 → streamlit_sortable_multiselect-0.7.9/streamlit_sortable_multiselect.egg-info}/PKG-INFO +20 -1
  8. {streamlit_sortable_multiselect-0.7.8 → streamlit_sortable_multiselect-0.7.9}/streamlit_sortable_multiselect.egg-info/SOURCES.txt +1 -1
  9. {streamlit_sortable_multiselect-0.7.8 → streamlit_sortable_multiselect-0.7.9}/tests/test_wrapper.py +5 -1
  10. streamlit_sortable_multiselect-0.7.8/streamlit_sortable_multiselect/frontend/build/assets/index-9M_rp0G-.js +0 -67
  11. {streamlit_sortable_multiselect-0.7.8 → streamlit_sortable_multiselect-0.7.9}/LICENSE +0 -0
  12. {streamlit_sortable_multiselect-0.7.8 → streamlit_sortable_multiselect-0.7.9}/MANIFEST.in +0 -0
  13. {streamlit_sortable_multiselect-0.7.8 → streamlit_sortable_multiselect-0.7.9}/setup.cfg +0 -0
  14. {streamlit_sortable_multiselect-0.7.8 → streamlit_sortable_multiselect-0.7.9}/streamlit_sortable_multiselect/frontend/build/assets/index-B1hHAom_.css +0 -0
  15. {streamlit_sortable_multiselect-0.7.8 → streamlit_sortable_multiselect-0.7.9}/streamlit_sortable_multiselect.egg-info/dependency_links.txt +0 -0
  16. {streamlit_sortable_multiselect-0.7.8 → streamlit_sortable_multiselect-0.7.9}/streamlit_sortable_multiselect.egg-info/requires.txt +0 -0
  17. {streamlit_sortable_multiselect-0.7.8 → streamlit_sortable_multiselect-0.7.9}/streamlit_sortable_multiselect.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streamlit-sortable-multiselect
3
- Version: 0.7.8
3
+ Version: 0.7.9
4
4
  Summary: A Streamlit custom component for selecting and reordering multiple string values.
5
5
  Author: Kentaro Aoki
6
6
  License-Expression: MIT
@@ -97,6 +97,7 @@ st.write(selected)
97
97
  | `label` | `str` | required | Label displayed above the component. |
98
98
  | `options` | `Sequence[str \| Mapping[str, Any]]` | required | Available options. Each option can be a plain string, or a dictionary with `label`, `value`, and optional `icon_url`. Option values must be unique. |
99
99
  | `default` | `Sequence[str] \| None` | `None` | Initially selected values, in the initial order. Changing the values or their order replaces the current selection. Values must exist in `options` and must not contain duplicates. |
100
+ | `default_revision` | `str \| int \| None` | `None` | Change this value to reapply `default` when its values and order are unchanged. |
100
101
  | `placeholder` | `str` | `"Select..."` | Placeholder shown in the search/add input when options are available. |
101
102
  | `disabled` | `bool` | `False` | Disables searching, selecting, removing, dragging, and move buttons. |
102
103
  | `show_move_buttons` | `bool` | `True` | Shows up/down buttons on selected items. Drag sorting remains available unless `disabled=True`. |
@@ -129,6 +130,24 @@ st.write(selected)
129
130
  | `suggestions_error_message` | `str` | `"Failed to load suggestions"` | Message shown when the request or response cannot be processed. |
130
131
  | `key` | `str \| None` | `None` | Optional Streamlit component key. Use this when rendering multiple sortable multiselects. |
131
132
 
133
+ To reset a component to the same `default` after the user changes its selection,
134
+ increment or otherwise change `default_revision`:
135
+
136
+ ```python
137
+ if "reset_revision" not in st.session_state:
138
+ st.session_state.reset_revision = 0
139
+
140
+ if st.button("Reset languages"):
141
+ st.session_state.reset_revision += 1
142
+
143
+ selected = sortable_multiselect(
144
+ "Languages",
145
+ options=["Python", "TypeScript", "Rust"],
146
+ default=["Python"],
147
+ default_revision=st.session_state.reset_revision,
148
+ )
149
+ ```
150
+
132
151
  Option dictionaries use this shape:
133
152
 
134
153
  ```python
@@ -69,6 +69,7 @@ st.write(selected)
69
69
  | `label` | `str` | required | Label displayed above the component. |
70
70
  | `options` | `Sequence[str \| Mapping[str, Any]]` | required | Available options. Each option can be a plain string, or a dictionary with `label`, `value`, and optional `icon_url`. Option values must be unique. |
71
71
  | `default` | `Sequence[str] \| None` | `None` | Initially selected values, in the initial order. Changing the values or their order replaces the current selection. Values must exist in `options` and must not contain duplicates. |
72
+ | `default_revision` | `str \| int \| None` | `None` | Change this value to reapply `default` when its values and order are unchanged. |
72
73
  | `placeholder` | `str` | `"Select..."` | Placeholder shown in the search/add input when options are available. |
73
74
  | `disabled` | `bool` | `False` | Disables searching, selecting, removing, dragging, and move buttons. |
74
75
  | `show_move_buttons` | `bool` | `True` | Shows up/down buttons on selected items. Drag sorting remains available unless `disabled=True`. |
@@ -101,6 +102,24 @@ st.write(selected)
101
102
  | `suggestions_error_message` | `str` | `"Failed to load suggestions"` | Message shown when the request or response cannot be processed. |
102
103
  | `key` | `str \| None` | `None` | Optional Streamlit component key. Use this when rendering multiple sortable multiselects. |
103
104
 
105
+ To reset a component to the same `default` after the user changes its selection,
106
+ increment or otherwise change `default_revision`:
107
+
108
+ ```python
109
+ if "reset_revision" not in st.session_state:
110
+ st.session_state.reset_revision = 0
111
+
112
+ if st.button("Reset languages"):
113
+ st.session_state.reset_revision += 1
114
+
115
+ selected = sortable_multiselect(
116
+ "Languages",
117
+ options=["Python", "TypeScript", "Rust"],
118
+ default=["Python"],
119
+ default_revision=st.session_state.reset_revision,
120
+ )
121
+ ```
122
+
104
123
  Option dictionaries use this shape:
105
124
 
106
125
  ```python
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "streamlit-sortable-multiselect"
7
- version = "0.7.8"
7
+ version = "0.7.9"
8
8
  description = "A Streamlit custom component for selecting and reordering multiple string values."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -9,7 +9,7 @@ from urllib.parse import urlparse
9
9
 
10
10
  import streamlit.components.v1 as components
11
11
 
12
- __version__ = "0.7.8"
12
+ __version__ = "0.7.9"
13
13
  __all__ = ["COLOR_FIELDS", "COLOR_SOURCES", "ColorValue", "sortable_multiselect"]
14
14
 
15
15
  _COMPONENT_NAME = "streamlit_sortable_multiselect"
@@ -320,6 +320,7 @@ def sortable_multiselect(
320
320
  tooltip_color: ColorValue | None = None,
321
321
  suggestions_color_path: str | None = None,
322
322
  key: str | None = None,
323
+ default_revision: str | int | None = None,
323
324
  ) -> list[str]:
324
325
  """Select multiple string values and return them in user-defined order.
325
326
 
@@ -401,6 +402,8 @@ def sortable_multiselect(
401
402
  Optional dot-separated path to each suggestion's color. None disables API colors.
402
403
  key:
403
404
  Optional Streamlit component key.
405
+ default_revision:
406
+ Change this value to reapply default even when its values and order are unchanged.
404
407
  """
405
408
  if not isinstance(label, str):
406
409
  raise TypeError("label must be a string.")
@@ -424,6 +427,10 @@ def sortable_multiselect(
424
427
  raise TypeError("show_numbers must be a bool.")
425
428
  if not isinstance(single_select_display, bool):
426
429
  raise TypeError("single_select_display must be a bool.")
430
+ if default_revision is not None and (
431
+ isinstance(default_revision, bool) or not isinstance(default_revision, (str, int))
432
+ ):
433
+ raise TypeError("default_revision must be a string, an integer, or None.")
427
434
 
428
435
  base_color_value = None if base_color is None else _require_color("base_color", base_color)
429
436
  tooltip_color_value = (
@@ -535,6 +542,7 @@ def sortable_multiselect(
535
542
  suggestions_debounce_ms=suggestions_debounce_ms_value,
536
543
  suggestions_loading_message=suggestions_loading_message,
537
544
  suggestions_error_message=suggestions_error_message,
545
+ default_revision=default_revision,
538
546
  key=key,
539
547
  default=default_values,
540
548
  )