streamlit-nightly 1.44.1.dev20250326__py3-none-any.whl → 1.44.1.dev20250327__py3-none-any.whl

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 (84) hide show
  1. streamlit/elements/lib/options_selector_utils.py +26 -5
  2. streamlit/elements/widgets/button_group.py +42 -11
  3. streamlit/elements/widgets/multiselect.py +166 -26
  4. streamlit/elements/widgets/selectbox.py +182 -38
  5. streamlit/proto/MultiSelect_pb2.py +4 -2
  6. streamlit/proto/MultiSelect_pb2.pyi +14 -2
  7. streamlit/proto/Selectbox_pb2.py +4 -2
  8. streamlit/proto/Selectbox_pb2.pyi +15 -2
  9. streamlit/static/index.html +1 -1
  10. streamlit/static/static/js/{FileDownload.esm.DyWffVOd.js → FileDownload.esm.jX-9l2Ep.js} +1 -1
  11. streamlit/static/static/js/{FileHelper.C5Rf1fu1.js → FileHelper.aCeQQwv9.js} +1 -1
  12. streamlit/static/static/js/{FormClearHelper.D2MZi-BE.js → FormClearHelper.CWUgHOqb.js} +1 -1
  13. streamlit/static/static/js/{Hooks.UTpr--3H.js → Hooks.z6bpnOa4.js} +1 -1
  14. streamlit/static/static/js/{InputInstructions.oXzay8Sc.js → InputInstructions.CxNXqmaa.js} +1 -1
  15. streamlit/static/static/js/{ProgressBar.Dkc6afbj.js → ProgressBar.DeJx_v03.js} +1 -1
  16. streamlit/static/static/js/{RenderInPortalIfExists.0vQEaJAa.js → RenderInPortalIfExists.BzVEnQEP.js} +1 -1
  17. streamlit/static/static/js/{Toolbar.BLonzKGv.js → Toolbar.Buaxb3gQ.js} +1 -1
  18. streamlit/static/static/js/{base-input.BVhyctGq.js → base-input.B02pchZb.js} +1 -1
  19. streamlit/static/static/js/{checkbox.DqunhWUH.js → checkbox.BNevNWhL.js} +1 -1
  20. streamlit/static/static/js/{createSuper.CpC2DZ-4.js → createSuper.HF1JI-bK.js} +1 -1
  21. streamlit/static/static/js/{data-grid-overlay-editor.BNc7oQAN.js → data-grid-overlay-editor.DHpEpsQ_.js} +1 -1
  22. streamlit/static/static/js/{downloader.BEmsLcSd.js → downloader.B32k91dq.js} +1 -1
  23. streamlit/static/static/js/{es6.Bka7yuWr.js → es6.j4L3xv_m.js} +2 -2
  24. streamlit/static/static/js/{iframeResizer.contentWindow.CseC9_0j.js → iframeResizer.contentWindow.DQOV--zq.js} +1 -1
  25. streamlit/static/static/js/{index.DcA9oLdi.js → index.1tdxODWC.js} +1 -1
  26. streamlit/static/static/js/{index.DDcRBpz_.js → index.B2-yUxP6.js} +1 -1
  27. streamlit/static/static/js/{index.NwBLa4vX.js → index.B28jf8c_.js} +13 -13
  28. streamlit/static/static/js/{index.DTByMWKb.js → index.BBHrAwbG.js} +1 -1
  29. streamlit/static/static/js/{index.DDfr2vz1.js → index.BDIF1v3E.js} +1 -1
  30. streamlit/static/static/js/{index.-uBfKDNW.js → index.BRDvEQpe.js} +1 -1
  31. streamlit/static/static/js/{index.CdRzA4dY.js → index.BT-PT2u0.js} +1 -1
  32. streamlit/static/static/js/{index.DPXDfP7O.js → index.BTG2J5Pk.js} +1 -1
  33. streamlit/static/static/js/{index.-GEjrTbP.js → index.BUz0sS-V.js} +1 -1
  34. streamlit/static/static/js/{index.sEBYkd7C.js → index.BeuGcxG8.js} +1 -1
  35. streamlit/static/static/js/{index.BgAs7EEH.js → index.BnYJb__c.js} +1 -1
  36. streamlit/static/static/js/{index.BGiS_myV.js → index.C-GJaT09.js} +12 -12
  37. streamlit/static/static/js/{index.CSzYGoqF.js → index.C1B9TyzK.js} +1 -1
  38. streamlit/static/static/js/{index.DfLVo1kK.js → index.CDMGlkYx.js} +1 -1
  39. streamlit/static/static/js/{index.DiZnms3l.js → index.CExICAHy.js} +1 -1
  40. streamlit/static/static/js/{index.Dg6pitBN.js → index.CKYXxi_d.js} +1 -1
  41. streamlit/static/static/js/index.CPMy5pwd.js +1 -0
  42. streamlit/static/static/js/{index.RS9NSuPn.js → index.CTgHTp02.js} +1 -1
  43. streamlit/static/static/js/{index.BPrkMaDs.js → index.CTwaWONb.js} +1 -1
  44. streamlit/static/static/js/{index.DH5gmTNJ.js → index.CcMFXZBL.js} +1 -1
  45. streamlit/static/static/js/index.ChvqDLgw.js +1 -0
  46. streamlit/static/static/js/{index.6ZLFnYFv.js → index.ClfebD_T.js} +1 -1
  47. streamlit/static/static/js/{index.CusXODwm.js → index.CpDe9l-f.js} +1 -1
  48. streamlit/static/static/js/{index.ByG1Ipsd.js → index.Cq_L2WtW.js} +1 -1
  49. streamlit/static/static/js/{index.D_RsV5T3.js → index.DBEif7dq.js} +2 -2
  50. streamlit/static/static/js/{index.DYmhwMwG.js → index.DNURUtUa.js} +2 -2
  51. streamlit/static/static/js/{index.DbB5iceE.js → index.DTDyF8nE.js} +1 -1
  52. streamlit/static/static/js/{index.C7zS3xAk.js → index.DaJw5fna.js} +1 -1
  53. streamlit/static/static/js/{index.-Ex9Sw0j.js → index.DbqewZ6W.js} +1 -1
  54. streamlit/static/static/js/{index.DvCWOxpn.js → index.DfvKnm4Q.js} +1 -1
  55. streamlit/static/static/js/{index.B9r4f8yP.js → index.DsRxnb2z.js} +1 -1
  56. streamlit/static/static/js/index.Nb8G9oM-.js +1 -0
  57. streamlit/static/static/js/{index.YDw6DAY-.js → index.R8Go3XlF.js} +1 -1
  58. streamlit/static/static/js/{index.BPw4HKmU.js → index.Uid-bSyh.js} +1 -1
  59. streamlit/static/static/js/{index.CHsi5M24.js → index.V3D0L00K.js} +1 -1
  60. streamlit/static/static/js/{index.K8WjTi1D.js → index.m0rRkw04.js} +1 -1
  61. streamlit/static/static/js/{index.BSsSumHQ.js → index.qkhdJyyt.js} +6 -6
  62. streamlit/static/static/js/{input.Cf4AxOS9.js → input.DogdK8Cg.js} +1 -1
  63. streamlit/static/static/js/{memory.x6zhEJ8E.js → memory.B_1d0kyG.js} +1 -1
  64. streamlit/static/static/js/{mergeWith.DL-_LuL_.js → mergeWith.9h0p6sC_.js} +1 -1
  65. streamlit/static/static/js/{number-overlay-editor.uQEd6gCw.js → number-overlay-editor.yRe6Yodu.js} +1 -1
  66. streamlit/static/static/js/{possibleConstructorReturn.6K8NTHlH.js → possibleConstructorReturn.C73_6grg.js} +1 -1
  67. streamlit/static/static/js/{sandbox.BY_N7kRf.js → sandbox.2u3nOS5d.js} +1 -1
  68. streamlit/static/static/js/{textarea.BoUKtqfY.js → textarea.DFCEFjUj.js} +1 -1
  69. streamlit/static/static/js/{timepicker.uTqYdkda.js → timepicker.GuNna1EN.js} +1 -1
  70. streamlit/static/static/js/{toConsumableArray.CA_5PwDK.js → toConsumableArray.DARzcvE5.js} +1 -1
  71. streamlit/static/static/js/{uniqueId.CmvPTKOg.js → uniqueId.fceb1ayN.js} +1 -1
  72. streamlit/static/static/js/{useBasicWidgetState.aMiqPmlk.js → useBasicWidgetState.D6255-xX.js} +1 -1
  73. streamlit/static/static/js/{useOnInputChange.DXi6gRKL.js → useOnInputChange.BjnOKne4.js} +1 -1
  74. streamlit/static/static/js/{withFullScreenWrapper._ccFC4BV.js → withFullScreenWrapper.B7h9p1kI.js} +1 -1
  75. streamlit/testing/v1/element_tree.py +8 -3
  76. {streamlit_nightly-1.44.1.dev20250326.dist-info → streamlit_nightly-1.44.1.dev20250327.dist-info}/METADATA +1 -1
  77. {streamlit_nightly-1.44.1.dev20250326.dist-info → streamlit_nightly-1.44.1.dev20250327.dist-info}/RECORD +81 -81
  78. streamlit/static/static/js/index.BgstN8el.js +0 -1
  79. streamlit/static/static/js/index.CRpHYHH-.js +0 -1
  80. streamlit/static/static/js/index.DByvN5ny.js +0 -1
  81. {streamlit_nightly-1.44.1.dev20250326.data → streamlit_nightly-1.44.1.dev20250327.data}/scripts/streamlit.cmd +0 -0
  82. {streamlit_nightly-1.44.1.dev20250326.dist-info → streamlit_nightly-1.44.1.dev20250327.dist-info}/WHEEL +0 -0
  83. {streamlit_nightly-1.44.1.dev20250326.dist-info → streamlit_nightly-1.44.1.dev20250327.dist-info}/entry_points.txt +0 -0
  84. {streamlit_nightly-1.44.1.dev20250326.dist-info → streamlit_nightly-1.44.1.dev20250327.dist-info}/top_level.txt +0 -0
@@ -13,13 +13,16 @@
13
13
  # limitations under the License.
14
14
  from __future__ import annotations
15
15
 
16
- from dataclasses import dataclass
17
16
  from textwrap import dedent
18
- from typing import TYPE_CHECKING, Any, Callable, Generic, cast, overload
17
+ from typing import TYPE_CHECKING, Any, Callable, Generic, Literal, cast, overload
19
18
 
20
19
  from streamlit.dataframe_util import OptionSequence, convert_anything_to_list
21
20
  from streamlit.elements.lib.form_utils import current_form_id
22
- from streamlit.elements.lib.options_selector_utils import index_, maybe_coerce_enum
21
+ from streamlit.elements.lib.options_selector_utils import (
22
+ create_mappings,
23
+ index_,
24
+ maybe_coerce_enum,
25
+ )
23
26
  from streamlit.elements.lib.policies import (
24
27
  check_widget_policies,
25
28
  maybe_raise_label_warnings,
@@ -54,25 +57,80 @@ if TYPE_CHECKING:
54
57
  from streamlit.delta_generator import DeltaGenerator
55
58
 
56
59
 
57
- @dataclass
58
60
  class SelectboxSerde(Generic[T]):
59
61
  options: Sequence[T]
60
- index: int | None
62
+ formatted_options: list[str]
63
+ formatted_option_to_option_index: dict[str, int]
64
+ default_option_index: int | None
65
+
66
+ def __init__(
67
+ self,
68
+ options: Sequence[T],
69
+ *,
70
+ formatted_options: list[str],
71
+ formatted_option_to_option_index: dict[str, int],
72
+ default_option_index: int | None = None,
73
+ ):
74
+ """Initialize the SelectboxSerde.
61
75
 
62
- def serialize(self, v: object) -> int | None:
76
+ We do not store an option_to_formatted_option mapping because the generic
77
+ options might not be hashable, which would raise a RuntimeError. So we do
78
+ two lookups: option -> index -> formatted_option[index].
79
+
80
+
81
+ Parameters
82
+ ----------
83
+ options : Sequence[T]
84
+ The sequence of selectable options.
85
+ formatted_options : list[str]
86
+ The string representations of each option. The formatted_options correspond
87
+ to the options sequence by index.
88
+ formatted_option_to_option_index : dict[str, int]
89
+ A mapping from formatted option strings to their corresponding indices in
90
+ the options sequence.
91
+ default_option_index : int or None, optional
92
+ The index of the default option to use when no selection is made.
93
+ If None, no default option is selected.
94
+ """
95
+
96
+ self.options = options
97
+ self.formatted_options = formatted_options
98
+ self.formatted_option_to_option_index = formatted_option_to_option_index
99
+ self.default_option_index = default_option_index
100
+
101
+ def serialize(self, v: T | str | None) -> str | None:
63
102
  if v is None:
64
103
  return None
65
104
  if len(self.options) == 0:
66
- return 0
67
- return index_(self.options, v)
105
+ return ""
106
+
107
+ # we don't check for isinstance(v, str) because this could lead to wrong
108
+ # results if v is a string that is part of the options itself as it would
109
+ # skip formatting in that case
110
+ try:
111
+ option_index = index_(self.options, v)
112
+ return self.formatted_options[option_index]
113
+ except ValueError:
114
+ # we know that v is a string, otherwise it would have been found in the
115
+ # options
116
+ return cast("str", v)
68
117
 
69
118
  def deserialize(
70
119
  self,
71
- ui_value: int | None,
120
+ ui_value: str | None,
72
121
  widget_id: str = "",
73
- ) -> T | None:
74
- idx = ui_value if ui_value is not None else self.index
75
- return self.options[idx] if idx is not None and len(self.options) > 0 else None
122
+ ) -> T | str | None:
123
+ # check if the option is pointing to a generic option type T,
124
+ # otherwise return the option itself
125
+ if ui_value is None:
126
+ return (
127
+ self.options[self.default_option_index]
128
+ if self.default_option_index is not None and len(self.options) > 0
129
+ else None
130
+ )
131
+
132
+ option_index = self.formatted_option_to_option_index.get(ui_value)
133
+ return self.options[option_index] if option_index is not None else ui_value
76
134
 
77
135
 
78
136
  class SelectboxMixin:
@@ -82,53 +140,113 @@ class SelectboxMixin:
82
140
  label: str,
83
141
  options: OptionSequence[T],
84
142
  index: int = 0,
85
- format_func: Callable[[Any], Any] = str,
143
+ format_func: Callable[[Any], str] = str,
86
144
  key: Key | None = None,
87
145
  help: str | None = None,
88
146
  on_change: WidgetCallback | None = None,
89
147
  args: WidgetArgs | None = None,
90
148
  kwargs: WidgetKwargs | None = None,
91
149
  *, # keyword-only arguments:
92
- placeholder: str = "Choose an option",
150
+ placeholder: str | None = None,
93
151
  disabled: bool = False,
94
152
  label_visibility: LabelVisibility = "visible",
153
+ accept_new_options: Literal[False] = False,
95
154
  ) -> T: ...
96
155
 
156
+ @overload
157
+ def selectbox(
158
+ self,
159
+ label: str,
160
+ options: OptionSequence[T],
161
+ index: int = 0,
162
+ format_func: Callable[[Any], str] = str,
163
+ key: Key | None = None,
164
+ help: str | None = None,
165
+ on_change: WidgetCallback | None = None,
166
+ args: WidgetArgs | None = None,
167
+ kwargs: WidgetKwargs | None = None,
168
+ *, # keyword-only arguments:
169
+ placeholder: str | None = None,
170
+ disabled: bool = False,
171
+ label_visibility: LabelVisibility = "visible",
172
+ accept_new_options: Literal[True] = True,
173
+ ) -> T | str: ...
174
+
97
175
  @overload
98
176
  def selectbox(
99
177
  self,
100
178
  label: str,
101
179
  options: OptionSequence[T],
102
180
  index: None,
103
- format_func: Callable[[Any], Any] = str,
181
+ format_func: Callable[[Any], str] = str,
104
182
  key: Key | None = None,
105
183
  help: str | None = None,
106
184
  on_change: WidgetCallback | None = None,
107
185
  args: WidgetArgs | None = None,
108
186
  kwargs: WidgetKwargs | None = None,
109
187
  *, # keyword-only arguments:
110
- placeholder: str = "Choose an option",
188
+ placeholder: str | None = None,
111
189
  disabled: bool = False,
112
190
  label_visibility: LabelVisibility = "visible",
191
+ accept_new_options: Literal[False] = False,
113
192
  ) -> T | None: ...
114
193
 
194
+ @overload
195
+ def selectbox(
196
+ self,
197
+ label: str,
198
+ options: OptionSequence[T],
199
+ index: None,
200
+ format_func: Callable[[Any], str] = str,
201
+ key: Key | None = None,
202
+ help: str | None = None,
203
+ on_change: WidgetCallback | None = None,
204
+ args: WidgetArgs | None = None,
205
+ kwargs: WidgetKwargs | None = None,
206
+ *, # keyword-only arguments:
207
+ placeholder: str | None = None,
208
+ disabled: bool = False,
209
+ label_visibility: LabelVisibility = "visible",
210
+ accept_new_options: Literal[True] = True,
211
+ ) -> T | str | None: ...
212
+
213
+ @overload
214
+ def selectbox(
215
+ self,
216
+ label: str,
217
+ options: OptionSequence[T],
218
+ index: int | None = 0,
219
+ format_func: Callable[[Any], str] = str,
220
+ key: Key | None = None,
221
+ help: str | None = None,
222
+ on_change: WidgetCallback | None = None,
223
+ args: WidgetArgs | None = None,
224
+ kwargs: WidgetKwargs | None = None,
225
+ *, # keyword-only arguments:
226
+ placeholder: str | None = None,
227
+ disabled: bool = False,
228
+ label_visibility: LabelVisibility = "visible",
229
+ accept_new_options: bool = False,
230
+ ) -> T | str | None: ...
231
+
115
232
  @gather_metrics("selectbox")
116
233
  def selectbox(
117
234
  self,
118
235
  label: str,
119
236
  options: OptionSequence[T],
120
237
  index: int | None = 0,
121
- format_func: Callable[[Any], Any] = str,
238
+ format_func: Callable[[Any], str] = str,
122
239
  key: Key | None = None,
123
240
  help: str | None = None,
124
241
  on_change: WidgetCallback | None = None,
125
242
  args: WidgetArgs | None = None,
126
243
  kwargs: WidgetKwargs | None = None,
127
244
  *, # keyword-only arguments:
128
- placeholder: str = "Choose an option",
245
+ placeholder: str | None = None,
129
246
  disabled: bool = False,
130
247
  label_visibility: LabelVisibility = "visible",
131
- ) -> T | None:
248
+ accept_new_options: bool = False,
249
+ ) -> T | str | None:
132
250
  r"""Display a select widget.
133
251
 
134
252
  Parameters
@@ -197,7 +315,8 @@ class SelectboxMixin:
197
315
 
198
316
  placeholder : str
199
317
  A string to display when no options are selected.
200
- Defaults to "Choose an option".
318
+ Defaults to "Choose an option." or, if
319
+ ``accept_new_options`` is set to ``True``, to "Choose or add an option".
201
320
 
202
321
  disabled : bool
203
322
  An optional boolean that disables the selectbox if set to ``True``.
@@ -209,6 +328,11 @@ class SelectboxMixin:
209
328
  label, which can help keep the widget alligned with other widgets.
210
329
  If this is ``"collapsed"``, Streamlit displays no label or spacer.
211
330
 
331
+ accept_new_options : bool
332
+ If ``True``, the user can enter a new option in the UI that is not part of
333
+ passed the options. The newly entered option gets selected.
334
+ The default is ``False``.
335
+
212
336
  Returns
213
337
  -------
214
338
  any
@@ -261,6 +385,7 @@ class SelectboxMixin:
261
385
  placeholder=placeholder,
262
386
  disabled=disabled,
263
387
  label_visibility=label_visibility,
388
+ accept_new_options=accept_new_options,
264
389
  ctx=ctx,
265
390
  )
266
391
 
@@ -276,11 +401,12 @@ class SelectboxMixin:
276
401
  args: WidgetArgs | None = None,
277
402
  kwargs: WidgetKwargs | None = None,
278
403
  *, # keyword-only arguments:
279
- placeholder: str = "Choose an option",
404
+ placeholder: str | None = None,
280
405
  disabled: bool = False,
281
406
  label_visibility: LabelVisibility = "visible",
407
+ accept_new_options: bool = False,
282
408
  ctx: ScriptRunContext | None = None,
283
- ) -> T | None:
409
+ ) -> T | str | None:
284
410
  key = to_key(key)
285
411
 
286
412
  check_widget_policies(
@@ -294,27 +420,40 @@ class SelectboxMixin:
294
420
  opt = convert_anything_to_list(options)
295
421
  check_python_comparable(opt)
296
422
 
423
+ if not isinstance(index, int) and index is not None:
424
+ raise StreamlitAPIException(
425
+ "Selectbox Value has invalid type: %s" % type(index).__name__
426
+ )
427
+
428
+ if index is not None and len(opt) > 0 and not 0 <= index < len(opt):
429
+ raise StreamlitAPIException(
430
+ "Selectbox index must be greater than or equal to 0 "
431
+ "and less than the length of options."
432
+ )
433
+
434
+ if placeholder is None:
435
+ placeholder = (
436
+ "Choose an option"
437
+ if not accept_new_options
438
+ else "Choose or add an option"
439
+ )
440
+
441
+ formatted_options, formatted_option_to_option_index = create_mappings(
442
+ opt, format_func
443
+ )
444
+
297
445
  element_id = compute_and_register_element_id(
298
446
  "selectbox",
299
447
  user_key=key,
300
448
  form_id=current_form_id(self.dg),
301
449
  label=label,
302
- options=[str(format_func(option)) for option in opt],
450
+ options=formatted_options,
303
451
  index=index,
304
452
  help=help,
305
453
  placeholder=placeholder,
454
+ accept_new_options=accept_new_options,
306
455
  )
307
456
 
308
- if not isinstance(index, int) and index is not None:
309
- raise StreamlitAPIException(
310
- "Selectbox Value has invalid type: %s" % type(index).__name__
311
- )
312
-
313
- if index is not None and len(opt) > 0 and not 0 <= index < len(opt):
314
- raise StreamlitAPIException(
315
- "Selectbox index must be greater than or equal to 0 and less than the length of options."
316
- )
317
-
318
457
  session_state = get_session_state().filtered_state
319
458
  if key is not None and key in session_state and session_state[key] is None:
320
459
  index = None
@@ -324,19 +463,24 @@ class SelectboxMixin:
324
463
  selectbox_proto.label = label
325
464
  if index is not None:
326
465
  selectbox_proto.default = index
327
- selectbox_proto.options[:] = [str(format_func(option)) for option in opt]
466
+ selectbox_proto.options[:] = formatted_options
328
467
  selectbox_proto.form_id = current_form_id(self.dg)
329
468
  selectbox_proto.placeholder = placeholder
330
469
  selectbox_proto.disabled = disabled
331
470
  selectbox_proto.label_visibility.value = get_label_visibility_proto_value(
332
471
  label_visibility
333
472
  )
473
+ selectbox_proto.accept_new_options = accept_new_options
334
474
 
335
475
  if help is not None:
336
476
  selectbox_proto.help = dedent(help)
337
477
 
338
- serde = SelectboxSerde(opt, index)
339
-
478
+ serde = SelectboxSerde(
479
+ opt,
480
+ formatted_options=formatted_options,
481
+ formatted_option_to_option_index=formatted_option_to_option_index,
482
+ default_option_index=index,
483
+ )
340
484
  widget_state = register_widget(
341
485
  selectbox_proto.id,
342
486
  on_change_handler=on_change,
@@ -345,14 +489,14 @@ class SelectboxMixin:
345
489
  deserializer=serde.deserialize,
346
490
  serializer=serde.serialize,
347
491
  ctx=ctx,
348
- value_type="int_value",
492
+ value_type="string_value",
349
493
  )
350
494
  widget_state = maybe_coerce_enum(widget_state, options, opt)
351
495
 
352
496
  if widget_state.value_changed:
353
497
  serialized_value = serde.serialize(widget_state.value)
354
498
  if serialized_value is not None:
355
- selectbox_proto.value = serialized_value
499
+ selectbox_proto.raw_value = serialized_value
356
500
  selectbox_proto.set_value = True
357
501
 
358
502
  if ctx:
@@ -15,7 +15,7 @@ _sym_db = _symbol_database.Default()
15
15
  from streamlit.proto import LabelVisibilityMessage_pb2 as streamlit_dot_proto_dot_LabelVisibilityMessage__pb2
16
16
 
17
17
 
18
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!streamlit/proto/MultiSelect.proto\x1a,streamlit/proto/LabelVisibilityMessage.proto\"\xfd\x01\n\x0bMultiSelect\x12\n\n\x02id\x18\x01 \x01(\t\x12\r\n\x05label\x18\x02 \x01(\t\x12\x0f\n\x07\x64\x65\x66\x61ult\x18\x03 \x03(\x05\x12\x0f\n\x07options\x18\x04 \x03(\t\x12\x0c\n\x04help\x18\x05 \x01(\t\x12\x0f\n\x07\x66orm_id\x18\x06 \x01(\t\x12\r\n\x05value\x18\x07 \x03(\x05\x12\x11\n\tset_value\x18\x08 \x01(\x08\x12\x10\n\x08\x64isabled\x18\t \x01(\x08\x12\x31\n\x10label_visibility\x18\n \x01(\x0b\x32\x17.LabelVisibilityMessage\x12\x16\n\x0emax_selections\x18\x0b \x01(\x05\x12\x13\n\x0bplaceholder\x18\x0c \x01(\tB0\n\x1c\x63om.snowflake.apps.streamlitB\x10MultiSelectProtob\x06proto3')
18
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!streamlit/proto/MultiSelect.proto\x1a,streamlit/proto/LabelVisibilityMessage.proto\"\xcd\x02\n\x0bMultiSelect\x12\n\n\x02id\x18\x01 \x01(\t\x12\r\n\x05label\x18\x02 \x01(\t\x12\x0f\n\x07\x64\x65\x66\x61ult\x18\x03 \x03(\x05\x12\x0f\n\x07options\x18\x04 \x03(\t\x12\x0c\n\x04help\x18\x05 \x01(\t\x12\x0f\n\x07\x66orm_id\x18\x06 \x01(\t\x12\x11\n\x05value\x18\x07 \x03(\x05\x42\x02\x18\x01\x12\x12\n\nraw_values\x18\x0e \x03(\t\x12\x11\n\tset_value\x18\x08 \x01(\x08\x12\x10\n\x08\x64isabled\x18\t \x01(\x08\x12\x31\n\x10label_visibility\x18\n \x01(\x0b\x32\x17.LabelVisibilityMessage\x12\x16\n\x0emax_selections\x18\x0b \x01(\x05\x12\x13\n\x0bplaceholder\x18\x0c \x01(\t\x12\x1f\n\x12\x61\x63\x63\x65pt_new_options\x18\r \x01(\x08H\x00\x88\x01\x01\x42\x15\n\x13_accept_new_optionsB0\n\x1c\x63om.snowflake.apps.streamlitB\x10MultiSelectProtob\x06proto3')
19
19
 
20
20
  _globals = globals()
21
21
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -23,6 +23,8 @@ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'streamlit.proto.MultiSelect
23
23
  if not _descriptor._USE_C_DESCRIPTORS:
24
24
  _globals['DESCRIPTOR']._loaded_options = None
25
25
  _globals['DESCRIPTOR']._serialized_options = b'\n\034com.snowflake.apps.streamlitB\020MultiSelectProto'
26
+ _globals['_MULTISELECT'].fields_by_name['value']._loaded_options = None
27
+ _globals['_MULTISELECT'].fields_by_name['value']._serialized_options = b'\030\001'
26
28
  _globals['_MULTISELECT']._serialized_start=84
27
- _globals['_MULTISELECT']._serialized_end=337
29
+ _globals['_MULTISELECT']._serialized_end=417
28
30
  # @@protoc_insertion_point(module_scope)
@@ -38,11 +38,13 @@ class MultiSelect(google.protobuf.message.Message):
38
38
  HELP_FIELD_NUMBER: builtins.int
39
39
  FORM_ID_FIELD_NUMBER: builtins.int
40
40
  VALUE_FIELD_NUMBER: builtins.int
41
+ RAW_VALUES_FIELD_NUMBER: builtins.int
41
42
  SET_VALUE_FIELD_NUMBER: builtins.int
42
43
  DISABLED_FIELD_NUMBER: builtins.int
43
44
  LABEL_VISIBILITY_FIELD_NUMBER: builtins.int
44
45
  MAX_SELECTIONS_FIELD_NUMBER: builtins.int
45
46
  PLACEHOLDER_FIELD_NUMBER: builtins.int
47
+ ACCEPT_NEW_OPTIONS_FIELD_NUMBER: builtins.int
46
48
  id: builtins.str
47
49
  label: builtins.str
48
50
  help: builtins.str
@@ -51,12 +53,19 @@ class MultiSelect(google.protobuf.message.Message):
51
53
  disabled: builtins.bool
52
54
  max_selections: builtins.int
53
55
  placeholder: builtins.str
56
+ accept_new_options: builtins.bool
54
57
  @property
55
58
  def default(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: ...
56
59
  @property
57
60
  def options(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]: ...
58
61
  @property
59
62
  def value(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: ...
63
+ @property
64
+ def raw_values(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
65
+ """after we introduced accept_new_options, we send the option as a string
66
+ instead of an index to keep it simple.
67
+ """
68
+
60
69
  @property
61
70
  def label_visibility(self) -> streamlit.proto.LabelVisibilityMessage_pb2.LabelVisibilityMessage: ...
62
71
  def __init__(
@@ -69,13 +78,16 @@ class MultiSelect(google.protobuf.message.Message):
69
78
  help: builtins.str = ...,
70
79
  form_id: builtins.str = ...,
71
80
  value: collections.abc.Iterable[builtins.int] | None = ...,
81
+ raw_values: collections.abc.Iterable[builtins.str] | None = ...,
72
82
  set_value: builtins.bool = ...,
73
83
  disabled: builtins.bool = ...,
74
84
  label_visibility: streamlit.proto.LabelVisibilityMessage_pb2.LabelVisibilityMessage | None = ...,
75
85
  max_selections: builtins.int = ...,
76
86
  placeholder: builtins.str = ...,
87
+ accept_new_options: builtins.bool | None = ...,
77
88
  ) -> None: ...
78
- def HasField(self, field_name: typing.Literal["label_visibility", b"label_visibility"]) -> builtins.bool: ...
79
- def ClearField(self, field_name: typing.Literal["default", b"default", "disabled", b"disabled", "form_id", b"form_id", "help", b"help", "id", b"id", "label", b"label", "label_visibility", b"label_visibility", "max_selections", b"max_selections", "options", b"options", "placeholder", b"placeholder", "set_value", b"set_value", "value", b"value"]) -> None: ...
89
+ def HasField(self, field_name: typing.Literal["_accept_new_options", b"_accept_new_options", "accept_new_options", b"accept_new_options", "label_visibility", b"label_visibility"]) -> builtins.bool: ...
90
+ def ClearField(self, field_name: typing.Literal["_accept_new_options", b"_accept_new_options", "accept_new_options", b"accept_new_options", "default", b"default", "disabled", b"disabled", "form_id", b"form_id", "help", b"help", "id", b"id", "label", b"label", "label_visibility", b"label_visibility", "max_selections", b"max_selections", "options", b"options", "placeholder", b"placeholder", "raw_values", b"raw_values", "set_value", b"set_value", "value", b"value"]) -> None: ...
91
+ def WhichOneof(self, oneof_group: typing.Literal["_accept_new_options", b"_accept_new_options"]) -> typing.Literal["accept_new_options"] | None: ...
80
92
 
81
93
  global___MultiSelect = MultiSelect
@@ -15,7 +15,7 @@ _sym_db = _symbol_database.Default()
15
15
  from streamlit.proto import LabelVisibilityMessage_pb2 as streamlit_dot_proto_dot_LabelVisibilityMessage__pb2
16
16
 
17
17
 
18
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1fstreamlit/proto/Selectbox.proto\x1a,streamlit/proto/LabelVisibilityMessage.proto\"\x83\x02\n\tSelectbox\x12\n\n\x02id\x18\x01 \x01(\t\x12\r\n\x05label\x18\x02 \x01(\t\x12\x14\n\x07\x64\x65\x66\x61ult\x18\x03 \x01(\x05H\x00\x88\x01\x01\x12\x0f\n\x07options\x18\x04 \x03(\t\x12\x0c\n\x04help\x18\x05 \x01(\t\x12\x0f\n\x07\x66orm_id\x18\x06 \x01(\t\x12\x12\n\x05value\x18\x07 \x01(\x05H\x01\x88\x01\x01\x12\x11\n\tset_value\x18\x08 \x01(\x08\x12\x10\n\x08\x64isabled\x18\t \x01(\x08\x12\x31\n\x10label_visibility\x18\n \x01(\x0b\x32\x17.LabelVisibilityMessage\x12\x13\n\x0bplaceholder\x18\x0b \x01(\tB\n\n\x08_defaultB\x08\n\x06_valueB.\n\x1c\x63om.snowflake.apps.streamlitB\x0eSelectboxProtob\x06proto3')
18
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1fstreamlit/proto/Selectbox.proto\x1a,streamlit/proto/LabelVisibilityMessage.proto\"\xe5\x02\n\tSelectbox\x12\n\n\x02id\x18\x01 \x01(\t\x12\r\n\x05label\x18\x02 \x01(\t\x12\x14\n\x07\x64\x65\x66\x61ult\x18\x03 \x01(\x05H\x00\x88\x01\x01\x12\x0f\n\x07options\x18\x04 \x03(\t\x12\x0c\n\x04help\x18\x05 \x01(\t\x12\x0f\n\x07\x66orm_id\x18\x06 \x01(\t\x12\x16\n\x05value\x18\x07 \x01(\x05\x42\x02\x18\x01H\x01\x88\x01\x01\x12\x16\n\traw_value\x18\r \x01(\tH\x02\x88\x01\x01\x12\x11\n\tset_value\x18\x08 \x01(\x08\x12\x10\n\x08\x64isabled\x18\t \x01(\x08\x12\x31\n\x10label_visibility\x18\n \x01(\x0b\x32\x17.LabelVisibilityMessage\x12\x13\n\x0bplaceholder\x18\x0b \x01(\t\x12\x1f\n\x12\x61\x63\x63\x65pt_new_options\x18\x0c \x01(\x08H\x03\x88\x01\x01\x42\n\n\x08_defaultB\x08\n\x06_valueB\x0c\n\n_raw_valueB\x15\n\x13_accept_new_optionsB.\n\x1c\x63om.snowflake.apps.streamlitB\x0eSelectboxProtob\x06proto3')
19
19
 
20
20
  _globals = globals()
21
21
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -23,6 +23,8 @@ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'streamlit.proto.Selectbox_p
23
23
  if not _descriptor._USE_C_DESCRIPTORS:
24
24
  _globals['DESCRIPTOR']._loaded_options = None
25
25
  _globals['DESCRIPTOR']._serialized_options = b'\n\034com.snowflake.apps.streamlitB\016SelectboxProto'
26
+ _globals['_SELECTBOX'].fields_by_name['value']._loaded_options = None
27
+ _globals['_SELECTBOX'].fields_by_name['value']._serialized_options = b'\030\001'
26
28
  _globals['_SELECTBOX']._serialized_start=82
27
- _globals['_SELECTBOX']._serialized_end=341
29
+ _globals['_SELECTBOX']._serialized_end=439
28
30
  # @@protoc_insertion_point(module_scope)
@@ -38,19 +38,26 @@ class Selectbox(google.protobuf.message.Message):
38
38
  HELP_FIELD_NUMBER: builtins.int
39
39
  FORM_ID_FIELD_NUMBER: builtins.int
40
40
  VALUE_FIELD_NUMBER: builtins.int
41
+ RAW_VALUE_FIELD_NUMBER: builtins.int
41
42
  SET_VALUE_FIELD_NUMBER: builtins.int
42
43
  DISABLED_FIELD_NUMBER: builtins.int
43
44
  LABEL_VISIBILITY_FIELD_NUMBER: builtins.int
44
45
  PLACEHOLDER_FIELD_NUMBER: builtins.int
46
+ ACCEPT_NEW_OPTIONS_FIELD_NUMBER: builtins.int
45
47
  id: builtins.str
46
48
  label: builtins.str
47
49
  default: builtins.int
48
50
  help: builtins.str
49
51
  form_id: builtins.str
50
52
  value: builtins.int
53
+ raw_value: builtins.str
54
+ """after we introduced accept_new_options, we send the option as a string
55
+ instead of an index to keep it simple.
56
+ """
51
57
  set_value: builtins.bool
52
58
  disabled: builtins.bool
53
59
  placeholder: builtins.str
60
+ accept_new_options: builtins.bool
54
61
  @property
55
62
  def options(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]: ...
56
63
  @property
@@ -65,16 +72,22 @@ class Selectbox(google.protobuf.message.Message):
65
72
  help: builtins.str = ...,
66
73
  form_id: builtins.str = ...,
67
74
  value: builtins.int | None = ...,
75
+ raw_value: builtins.str | None = ...,
68
76
  set_value: builtins.bool = ...,
69
77
  disabled: builtins.bool = ...,
70
78
  label_visibility: streamlit.proto.LabelVisibilityMessage_pb2.LabelVisibilityMessage | None = ...,
71
79
  placeholder: builtins.str = ...,
80
+ accept_new_options: builtins.bool | None = ...,
72
81
  ) -> None: ...
73
- def HasField(self, field_name: typing.Literal["_default", b"_default", "_value", b"_value", "default", b"default", "label_visibility", b"label_visibility", "value", b"value"]) -> builtins.bool: ...
74
- def ClearField(self, field_name: typing.Literal["_default", b"_default", "_value", b"_value", "default", b"default", "disabled", b"disabled", "form_id", b"form_id", "help", b"help", "id", b"id", "label", b"label", "label_visibility", b"label_visibility", "options", b"options", "placeholder", b"placeholder", "set_value", b"set_value", "value", b"value"]) -> None: ...
82
+ def HasField(self, field_name: typing.Literal["_accept_new_options", b"_accept_new_options", "_default", b"_default", "_raw_value", b"_raw_value", "_value", b"_value", "accept_new_options", b"accept_new_options", "default", b"default", "label_visibility", b"label_visibility", "raw_value", b"raw_value", "value", b"value"]) -> builtins.bool: ...
83
+ def ClearField(self, field_name: typing.Literal["_accept_new_options", b"_accept_new_options", "_default", b"_default", "_raw_value", b"_raw_value", "_value", b"_value", "accept_new_options", b"accept_new_options", "default", b"default", "disabled", b"disabled", "form_id", b"form_id", "help", b"help", "id", b"id", "label", b"label", "label_visibility", b"label_visibility", "options", b"options", "placeholder", b"placeholder", "raw_value", b"raw_value", "set_value", b"set_value", "value", b"value"]) -> None: ...
84
+ @typing.overload
85
+ def WhichOneof(self, oneof_group: typing.Literal["_accept_new_options", b"_accept_new_options"]) -> typing.Literal["accept_new_options"] | None: ...
75
86
  @typing.overload
76
87
  def WhichOneof(self, oneof_group: typing.Literal["_default", b"_default"]) -> typing.Literal["default"] | None: ...
77
88
  @typing.overload
89
+ def WhichOneof(self, oneof_group: typing.Literal["_raw_value", b"_raw_value"]) -> typing.Literal["raw_value"] | None: ...
90
+ @typing.overload
78
91
  def WhichOneof(self, oneof_group: typing.Literal["_value", b"_value"]) -> typing.Literal["value"] | None: ...
79
92
 
80
93
  global___Selectbox = Selectbox
@@ -51,7 +51,7 @@
51
51
  <script>
52
52
  window.prerenderReady = false
53
53
  </script>
54
- <script type="module" crossorigin src="./static/js/index.NwBLa4vX.js"></script>
54
+ <script type="module" crossorigin src="./static/js/index.B28jf8c_.js"></script>
55
55
  <link rel="stylesheet" crossorigin href="./static/css/index.DKr_zoDj.css">
56
56
  </head>
57
57
  <body>
@@ -1 +1 @@
1
- import{r as e,E as n,_ as a}from"./index.NwBLa4vX.js";var o=e.forwardRef(function(t,r){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return e.createElement(n,a({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:r}),e.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),e.createElement("path",{d:"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"}))});o.displayName="Delete";var i=e.forwardRef(function(t,r){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return e.createElement(n,a({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:r}),e.createElement("rect",{width:24,height:24,fill:"none"}),e.createElement("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zm-1-4l-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5 5-5z"}))});i.displayName="FileDownload";export{o as D,i as F};
1
+ import{r as e,E as n,_ as a}from"./index.B28jf8c_.js";var o=e.forwardRef(function(t,r){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return e.createElement(n,a({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:r}),e.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),e.createElement("path",{d:"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"}))});o.displayName="Delete";var i=e.forwardRef(function(t,r){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return e.createElement(n,a({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:r}),e.createElement("rect",{width:24,height:24,fill:"none"}),e.createElement("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zm-1-4l-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5 5-5z"}))});i.displayName="FileDownload";export{o as D,i as F};