streamlit-sortable-multiselect 0.6.0__tar.gz → 0.7.0__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 (18) hide show
  1. {streamlit_sortable_multiselect-0.6.0/streamlit_sortable_multiselect.egg-info → streamlit_sortable_multiselect-0.7.0}/PKG-INFO +34 -1
  2. streamlit_sortable_multiselect-0.7.0/README.md +116 -0
  3. {streamlit_sortable_multiselect-0.6.0 → streamlit_sortable_multiselect-0.7.0}/pyproject.toml +1 -1
  4. {streamlit_sortable_multiselect-0.6.0 → streamlit_sortable_multiselect-0.7.0}/streamlit_sortable_multiselect/__init__.py +21 -1
  5. streamlit_sortable_multiselect-0.7.0/streamlit_sortable_multiselect/frontend/build/assets/index-ACSWLoJh.js +67 -0
  6. streamlit_sortable_multiselect-0.6.0/streamlit_sortable_multiselect/frontend/build/assets/index-DU2qFdlq.css → streamlit_sortable_multiselect-0.7.0/streamlit_sortable_multiselect/frontend/build/assets/index-BKFJvHHF.css +1 -1
  7. {streamlit_sortable_multiselect-0.6.0 → streamlit_sortable_multiselect-0.7.0}/streamlit_sortable_multiselect/frontend/build/index.html +2 -2
  8. {streamlit_sortable_multiselect-0.6.0 → streamlit_sortable_multiselect-0.7.0/streamlit_sortable_multiselect.egg-info}/PKG-INFO +34 -1
  9. {streamlit_sortable_multiselect-0.6.0 → streamlit_sortable_multiselect-0.7.0}/streamlit_sortable_multiselect.egg-info/SOURCES.txt +2 -2
  10. {streamlit_sortable_multiselect-0.6.0 → streamlit_sortable_multiselect-0.7.0}/tests/test_wrapper.py +11 -0
  11. streamlit_sortable_multiselect-0.6.0/README.md +0 -83
  12. streamlit_sortable_multiselect-0.6.0/streamlit_sortable_multiselect/frontend/build/assets/index-Dg3JH2iL.js +0 -67
  13. {streamlit_sortable_multiselect-0.6.0 → streamlit_sortable_multiselect-0.7.0}/LICENSE +0 -0
  14. {streamlit_sortable_multiselect-0.6.0 → streamlit_sortable_multiselect-0.7.0}/MANIFEST.in +0 -0
  15. {streamlit_sortable_multiselect-0.6.0 → streamlit_sortable_multiselect-0.7.0}/setup.cfg +0 -0
  16. {streamlit_sortable_multiselect-0.6.0 → streamlit_sortable_multiselect-0.7.0}/streamlit_sortable_multiselect.egg-info/dependency_links.txt +0 -0
  17. {streamlit_sortable_multiselect-0.6.0 → streamlit_sortable_multiselect-0.7.0}/streamlit_sortable_multiselect.egg-info/requires.txt +0 -0
  18. {streamlit_sortable_multiselect-0.6.0 → streamlit_sortable_multiselect-0.7.0}/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.6.0
3
+ Version: 0.7.0
4
4
  Summary: A Streamlit custom component for selecting and reordering multiple string values.
5
5
  Author: Developer
6
6
  License-Expression: MIT
@@ -72,11 +72,44 @@ selected = sortable_multiselect(
72
72
  order_colors={1: "#fee2e2", 2: "#dcfce7"},
73
73
  max_selections=3,
74
74
  max_selections_placeholder="Choose up to 3 frameworks",
75
+ empty_message="No frameworks selected",
76
+ no_options_placeholder="All frameworks selected",
77
+ selected_position="top",
75
78
  )
76
79
 
77
80
  st.write(selected)
78
81
  ```
79
82
 
83
+ ## Settings
84
+
85
+ `sortable_multiselect` returns the selected option values as a `list[str]` in the current display order.
86
+
87
+ | Argument | Type | Default | Description |
88
+ | --- | --- | --- | --- |
89
+ | `label` | `str` | required | Label displayed above the component. |
90
+ | `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. |
91
+ | `default` | `Sequence[str] \| None` | `None` | Initially selected values, in the initial order. Values must exist in `options` and must not contain duplicates. |
92
+ | `placeholder` | `str` | `"Select..."` | Placeholder shown in the search/add input when options are available. |
93
+ | `disabled` | `bool` | `False` | Disables searching, selecting, removing, dragging, and move buttons. |
94
+ | `show_move_buttons` | `bool` | `True` | Shows up/down buttons on selected items. Drag sorting remains available unless `disabled=True`. |
95
+ | `show_numbers` | `bool` | `False` | Shows 1-based position numbers before selected item labels. |
96
+ | `base_color` | `str \| None` | `None` | Background color applied to all selected items. Accepts CSS color values such as `"#eef2ff"` or `"lightblue"`. |
97
+ | `order_colors` | `Mapping[int, str] \| None` | `None` | Per-position selected item background colors. Keys are 1-based positions, for example `{1: "#fee2e2", 2: "#dcfce7"}`. These override `base_color` for matching positions. |
98
+ | `max_selections` | `int \| None` | `None` | Maximum number of selected items. `None` means no limit. Use `0` to prevent any selections. |
99
+ | `max_selections_placeholder` | `str` | `"Selection limit reached"` | Placeholder shown when `max_selections` has been reached. This takes precedence over `placeholder` and `no_options_placeholder`. |
100
+ | `empty_message` | `str` | `"No items selected"` | Message shown where the selected list appears when no items are selected. |
101
+ | `no_options_placeholder` | `str` | `"No more options"` | Placeholder shown when every option is already selected and there are no more options to add. |
102
+ | `selected_position` | `str` | `"bottom"` | Position of the selected item list relative to the search/add input. Use `"bottom"` or `"top"`. |
103
+ | `key` | `str \| None` | `None` | Optional Streamlit component key. Use this when rendering multiple sortable multiselects. |
104
+
105
+ Option dictionaries use this shape:
106
+
107
+ ```python
108
+ {"label": "Python", "value": "python", "icon_url": "https://www.python.org/static/favicon.ico"}
109
+ ```
110
+
111
+ `icon_url` may be omitted. The returned value is always the `value`, not the display `label`.
112
+
80
113
  Build the frontend before packaging or using release mode:
81
114
 
82
115
  ```bash
@@ -0,0 +1,116 @@
1
+ # streamlit-sortable-multiselect
2
+
3
+ A Streamlit custom component for searching, selecting, and reordering multiple string values.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ python -m pip install streamlit-sortable-multiselect
9
+ ```
10
+
11
+ For local development:
12
+
13
+ ```bash
14
+ python -m pip install -e ".[dev]"
15
+ ```
16
+
17
+ For frontend development:
18
+
19
+ ```bash
20
+ cd streamlit_sortable_multiselect/frontend
21
+ npm install
22
+ npm run dev
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ```python
28
+ import streamlit as st
29
+ from streamlit_sortable_multiselect import sortable_multiselect
30
+
31
+ selected = sortable_multiselect(
32
+ "Favorite frameworks",
33
+ options=[
34
+ {"label": "Streamlit", "value": "streamlit", "icon_url": "https://streamlit.io/images/brand/streamlit-mark-color.png"},
35
+ {"label": "FastAPI", "value": "fastapi", "icon_url": "https://fastapi.tiangolo.com/img/favicon.png"},
36
+ {"label": "Django", "value": "django"},
37
+ {"label": "Flask", "value": "flask"},
38
+ ],
39
+ default=["streamlit"],
40
+ placeholder="Search frameworks...",
41
+ show_move_buttons=True,
42
+ show_numbers=True,
43
+ base_color="#eef2ff",
44
+ order_colors={1: "#fee2e2", 2: "#dcfce7"},
45
+ max_selections=3,
46
+ max_selections_placeholder="Choose up to 3 frameworks",
47
+ empty_message="No frameworks selected",
48
+ no_options_placeholder="All frameworks selected",
49
+ selected_position="top",
50
+ )
51
+
52
+ st.write(selected)
53
+ ```
54
+
55
+ ## Settings
56
+
57
+ `sortable_multiselect` returns the selected option values as a `list[str]` in the current display order.
58
+
59
+ | Argument | Type | Default | Description |
60
+ | --- | --- | --- | --- |
61
+ | `label` | `str` | required | Label displayed above the component. |
62
+ | `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. |
63
+ | `default` | `Sequence[str] \| None` | `None` | Initially selected values, in the initial order. Values must exist in `options` and must not contain duplicates. |
64
+ | `placeholder` | `str` | `"Select..."` | Placeholder shown in the search/add input when options are available. |
65
+ | `disabled` | `bool` | `False` | Disables searching, selecting, removing, dragging, and move buttons. |
66
+ | `show_move_buttons` | `bool` | `True` | Shows up/down buttons on selected items. Drag sorting remains available unless `disabled=True`. |
67
+ | `show_numbers` | `bool` | `False` | Shows 1-based position numbers before selected item labels. |
68
+ | `base_color` | `str \| None` | `None` | Background color applied to all selected items. Accepts CSS color values such as `"#eef2ff"` or `"lightblue"`. |
69
+ | `order_colors` | `Mapping[int, str] \| None` | `None` | Per-position selected item background colors. Keys are 1-based positions, for example `{1: "#fee2e2", 2: "#dcfce7"}`. These override `base_color` for matching positions. |
70
+ | `max_selections` | `int \| None` | `None` | Maximum number of selected items. `None` means no limit. Use `0` to prevent any selections. |
71
+ | `max_selections_placeholder` | `str` | `"Selection limit reached"` | Placeholder shown when `max_selections` has been reached. This takes precedence over `placeholder` and `no_options_placeholder`. |
72
+ | `empty_message` | `str` | `"No items selected"` | Message shown where the selected list appears when no items are selected. |
73
+ | `no_options_placeholder` | `str` | `"No more options"` | Placeholder shown when every option is already selected and there are no more options to add. |
74
+ | `selected_position` | `str` | `"bottom"` | Position of the selected item list relative to the search/add input. Use `"bottom"` or `"top"`. |
75
+ | `key` | `str \| None` | `None` | Optional Streamlit component key. Use this when rendering multiple sortable multiselects. |
76
+
77
+ Option dictionaries use this shape:
78
+
79
+ ```python
80
+ {"label": "Python", "value": "python", "icon_url": "https://www.python.org/static/favicon.ico"}
81
+ ```
82
+
83
+ `icon_url` may be omitted. The returned value is always the `value`, not the display `label`.
84
+
85
+ Build the frontend before packaging or using release mode:
86
+
87
+ ```bash
88
+ cd streamlit_sortable_multiselect/frontend
89
+ npm run build
90
+ ```
91
+
92
+ Run the example app:
93
+
94
+ ```bash
95
+ streamlit run examples/basic.py
96
+ ```
97
+
98
+ ## Release
99
+
100
+ Build and check the distribution files:
101
+
102
+ ```bash
103
+ cd streamlit_sortable_multiselect/frontend
104
+ npm install
105
+ npm run build
106
+ cd ../..
107
+ python -m pip install -e ".[dev]"
108
+ python -m build
109
+ python -m twine check dist/*
110
+ ```
111
+
112
+ Upload to PyPI with an API token:
113
+
114
+ ```bash
115
+ python -m twine upload dist/*
116
+ ```
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "streamlit-sortable-multiselect"
7
- version = "0.6.0"
7
+ version = "0.7.0"
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"
@@ -8,7 +8,7 @@ from typing import Any, Iterable, Mapping, Sequence, cast
8
8
 
9
9
  import streamlit.components.v1 as components
10
10
 
11
- __version__ = "0.6.0"
11
+ __version__ = "0.7.0"
12
12
  __all__ = ["sortable_multiselect"]
13
13
 
14
14
  _COMPONENT_NAME = "streamlit_sortable_multiselect"
@@ -107,6 +107,9 @@ def sortable_multiselect(
107
107
  order_colors: Mapping[int, str] | None = None,
108
108
  max_selections: int | None = None,
109
109
  max_selections_placeholder: str = "Selection limit reached",
110
+ empty_message: str = "No items selected",
111
+ no_options_placeholder: str = "No more options",
112
+ selected_position: str = "bottom",
110
113
  key: str | None = None,
111
114
  ) -> list[str]:
112
115
  """Select multiple string values and return them in user-defined order.
@@ -135,6 +138,12 @@ def sortable_multiselect(
135
138
  Maximum number of selected items. None means no limit.
136
139
  max_selections_placeholder:
137
140
  Placeholder text shown when the maximum selection count is reached.
141
+ empty_message:
142
+ Text shown when no items are selected.
143
+ no_options_placeholder:
144
+ Placeholder text shown when there are no more options to add.
145
+ selected_position:
146
+ Position of selected items relative to the select control. Use "bottom" or "top".
138
147
  key:
139
148
  Optional Streamlit component key.
140
149
  """
@@ -144,6 +153,14 @@ def sortable_multiselect(
144
153
  raise TypeError("placeholder must be a string.")
145
154
  if not isinstance(max_selections_placeholder, str):
146
155
  raise TypeError("max_selections_placeholder must be a string.")
156
+ if not isinstance(empty_message, str):
157
+ raise TypeError("empty_message must be a string.")
158
+ if not isinstance(no_options_placeholder, str):
159
+ raise TypeError("no_options_placeholder must be a string.")
160
+ if not isinstance(selected_position, str):
161
+ raise TypeError("selected_position must be a string.")
162
+ if selected_position not in {"bottom", "top"}:
163
+ raise ValueError('selected_position must be "bottom" or "top".')
147
164
  if not isinstance(disabled, bool):
148
165
  raise TypeError("disabled must be a bool.")
149
166
  if not isinstance(show_move_buttons, bool):
@@ -187,6 +204,9 @@ def sortable_multiselect(
187
204
  order_colors=order_color_values,
188
205
  max_selections=max_selection_count,
189
206
  max_selections_placeholder=max_selections_placeholder,
207
+ empty_message=empty_message,
208
+ no_options_placeholder=no_options_placeholder,
209
+ selected_position=selected_position,
190
210
  key=key,
191
211
  default=default_values,
192
212
  )