streamlit-sortable-multiselect 0.7.1__tar.gz → 0.7.3__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.7.1/streamlit_sortable_multiselect.egg-info → streamlit_sortable_multiselect-0.7.3}/PKG-INFO +5 -1
  2. {streamlit_sortable_multiselect-0.7.1 → streamlit_sortable_multiselect-0.7.3}/README.md +4 -0
  3. {streamlit_sortable_multiselect-0.7.1 → streamlit_sortable_multiselect-0.7.3}/pyproject.toml +1 -1
  4. {streamlit_sortable_multiselect-0.7.1 → streamlit_sortable_multiselect-0.7.3}/streamlit_sortable_multiselect/__init__.py +27 -1
  5. streamlit_sortable_multiselect-0.7.3/streamlit_sortable_multiselect/frontend/build/assets/index-DdljhZDS.js +67 -0
  6. streamlit_sortable_multiselect-0.7.3/streamlit_sortable_multiselect/frontend/build/assets/index-DobBL0Fg.css +1 -0
  7. {streamlit_sortable_multiselect-0.7.1 → streamlit_sortable_multiselect-0.7.3}/streamlit_sortable_multiselect/frontend/build/index.html +2 -2
  8. {streamlit_sortable_multiselect-0.7.1 → streamlit_sortable_multiselect-0.7.3/streamlit_sortable_multiselect.egg-info}/PKG-INFO +5 -1
  9. {streamlit_sortable_multiselect-0.7.1 → streamlit_sortable_multiselect-0.7.3}/streamlit_sortable_multiselect.egg-info/SOURCES.txt +2 -2
  10. {streamlit_sortable_multiselect-0.7.1 → streamlit_sortable_multiselect-0.7.3}/tests/test_wrapper.py +12 -0
  11. streamlit_sortable_multiselect-0.7.1/streamlit_sortable_multiselect/frontend/build/assets/index-ACSWLoJh.js +0 -67
  12. streamlit_sortable_multiselect-0.7.1/streamlit_sortable_multiselect/frontend/build/assets/index-BKFJvHHF.css +0 -1
  13. {streamlit_sortable_multiselect-0.7.1 → streamlit_sortable_multiselect-0.7.3}/LICENSE +0 -0
  14. {streamlit_sortable_multiselect-0.7.1 → streamlit_sortable_multiselect-0.7.3}/MANIFEST.in +0 -0
  15. {streamlit_sortable_multiselect-0.7.1 → streamlit_sortable_multiselect-0.7.3}/setup.cfg +0 -0
  16. {streamlit_sortable_multiselect-0.7.1 → streamlit_sortable_multiselect-0.7.3}/streamlit_sortable_multiselect.egg-info/dependency_links.txt +0 -0
  17. {streamlit_sortable_multiselect-0.7.1 → streamlit_sortable_multiselect-0.7.3}/streamlit_sortable_multiselect.egg-info/requires.txt +0 -0
  18. {streamlit_sortable_multiselect-0.7.1 → streamlit_sortable_multiselect-0.7.3}/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.1
3
+ Version: 0.7.3
4
4
  Summary: A Streamlit custom component for selecting and reordering multiple string values.
5
5
  Author: Kentaro Aoki
6
6
  License-Expression: MIT
@@ -75,6 +75,8 @@ selected = sortable_multiselect(
75
75
  empty_message="No frameworks selected",
76
76
  no_options_placeholder="All frameworks selected",
77
77
  selected_position="top",
78
+ icon_size=24,
79
+ options_max_height=260,
78
80
  )
79
81
 
80
82
  st.write(selected)
@@ -100,6 +102,8 @@ st.write(selected)
100
102
  | `empty_message` | `str` | `"No items selected"` | Message shown where the selected list appears when no items are selected. |
101
103
  | `no_options_placeholder` | `str` | `"No more options"` | Placeholder shown when every option is already selected and there are no more options to add. |
102
104
  | `selected_position` | `str` | `"bottom"` | Position of the selected item list relative to the search/add input. Use `"bottom"` or `"top"`. |
105
+ | `icon_size` | `int` | `20` | Icon display size in pixels for `icon_url` images. Images are displayed inside a square area while preserving their aspect ratio. |
106
+ | `options_max_height` | `int` | `190` | Maximum height in pixels for the available options dropdown. |
103
107
  | `key` | `str \| None` | `None` | Optional Streamlit component key. Use this when rendering multiple sortable multiselects. |
104
108
 
105
109
  Option dictionaries use this shape:
@@ -47,6 +47,8 @@ selected = sortable_multiselect(
47
47
  empty_message="No frameworks selected",
48
48
  no_options_placeholder="All frameworks selected",
49
49
  selected_position="top",
50
+ icon_size=24,
51
+ options_max_height=260,
50
52
  )
51
53
 
52
54
  st.write(selected)
@@ -72,6 +74,8 @@ st.write(selected)
72
74
  | `empty_message` | `str` | `"No items selected"` | Message shown where the selected list appears when no items are selected. |
73
75
  | `no_options_placeholder` | `str` | `"No more options"` | Placeholder shown when every option is already selected and there are no more options to add. |
74
76
  | `selected_position` | `str` | `"bottom"` | Position of the selected item list relative to the search/add input. Use `"bottom"` or `"top"`. |
77
+ | `icon_size` | `int` | `20` | Icon display size in pixels for `icon_url` images. Images are displayed inside a square area while preserving their aspect ratio. |
78
+ | `options_max_height` | `int` | `190` | Maximum height in pixels for the available options dropdown. |
75
79
  | `key` | `str \| None` | `None` | Optional Streamlit component key. Use this when rendering multiple sortable multiselects. |
76
80
 
77
81
  Option dictionaries use this shape:
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "streamlit-sortable-multiselect"
7
- version = "0.7.1"
7
+ version = "0.7.3"
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.7.1"
11
+ __version__ = "0.7.3"
12
12
  __all__ = ["sortable_multiselect"]
13
13
 
14
14
  _COMPONENT_NAME = "streamlit_sortable_multiselect"
@@ -95,6 +95,22 @@ def _validate_max_selections(max_selections: int | None) -> int | None:
95
95
  return max_selections
96
96
 
97
97
 
98
+ def _validate_icon_size(icon_size: int) -> int:
99
+ if isinstance(icon_size, bool) or not isinstance(icon_size, int):
100
+ raise TypeError("icon_size must be an integer.")
101
+ if icon_size < 1:
102
+ raise ValueError("icon_size must be 1 or greater.")
103
+ return icon_size
104
+
105
+
106
+ def _validate_options_max_height(options_max_height: int) -> int:
107
+ if isinstance(options_max_height, bool) or not isinstance(options_max_height, int):
108
+ raise TypeError("options_max_height must be an integer.")
109
+ if options_max_height < 1:
110
+ raise ValueError("options_max_height must be 1 or greater.")
111
+ return options_max_height
112
+
113
+
98
114
  def sortable_multiselect(
99
115
  label: str,
100
116
  options: Sequence[str | Mapping[str, Any]],
@@ -110,6 +126,8 @@ def sortable_multiselect(
110
126
  empty_message: str = "No items selected",
111
127
  no_options_placeholder: str = "No more options",
112
128
  selected_position: str = "bottom",
129
+ icon_size: int = 20,
130
+ options_max_height: int = 190,
113
131
  key: str | None = None,
114
132
  ) -> list[str]:
115
133
  """Select multiple string values and return them in user-defined order.
@@ -144,6 +162,10 @@ def sortable_multiselect(
144
162
  Placeholder text shown when there are no more options to add.
145
163
  selected_position:
146
164
  Position of selected items relative to the select control. Use "bottom" or "top".
165
+ icon_size:
166
+ Icon display size in pixels. Images keep their aspect ratio within this square size.
167
+ options_max_height:
168
+ Maximum height in pixels for the available options dropdown.
147
169
  key:
148
170
  Optional Streamlit component key.
149
171
  """
@@ -175,6 +197,8 @@ def sortable_multiselect(
175
197
  default_values = _validate_string_sequence("default", default)
176
198
  order_color_values = _validate_order_colors(order_colors)
177
199
  max_selection_count = _validate_max_selections(max_selections)
200
+ icon_size_value = _validate_icon_size(icon_size)
201
+ options_max_height_value = _validate_options_max_height(options_max_height)
178
202
 
179
203
  duplicate_options = sorted({value for value in option_values if option_values.count(value) > 1})
180
204
  if duplicate_options:
@@ -207,6 +231,8 @@ def sortable_multiselect(
207
231
  empty_message=empty_message,
208
232
  no_options_placeholder=no_options_placeholder,
209
233
  selected_position=selected_position,
234
+ icon_size=icon_size_value,
235
+ options_max_height=options_max_height_value,
210
236
  key=key,
211
237
  default=default_values,
212
238
  )