streamlit 1.48.1__py3-none-any.whl → 1.49.1__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 (203) hide show
  1. streamlit/__init__.py +3 -10
  2. streamlit/commands/logo.py +4 -3
  3. streamlit/commands/navigation.py +1 -1
  4. streamlit/commands/page_config.py +4 -1
  5. streamlit/components/v1/custom_component.py +2 -2
  6. streamlit/config.py +82 -1
  7. streamlit/connections/snowflake_connection.py +3 -1
  8. streamlit/delta_generator.py +3 -0
  9. streamlit/elements/arrow.py +155 -70
  10. streamlit/elements/bokeh_chart.py +13 -3
  11. streamlit/elements/deck_gl_json_chart.py +0 -1
  12. streamlit/elements/dialog_decorator.py +7 -59
  13. streamlit/elements/form.py +10 -1
  14. streamlit/elements/graphviz_chart.py +57 -6
  15. streamlit/elements/heading.py +17 -16
  16. streamlit/elements/image.py +64 -37
  17. streamlit/elements/layouts.py +2 -2
  18. streamlit/elements/lib/built_in_chart_utils.py +2 -5
  19. streamlit/elements/lib/column_config_utils.py +18 -4
  20. streamlit/elements/lib/column_types.py +75 -30
  21. streamlit/elements/lib/dialog.py +3 -3
  22. streamlit/elements/lib/image_utils.py +19 -11
  23. streamlit/elements/lib/layout_utils.py +19 -6
  24. streamlit/elements/lib/utils.py +20 -41
  25. streamlit/elements/markdown.py +7 -6
  26. streamlit/elements/media.py +6 -13
  27. streamlit/elements/metric.py +78 -1
  28. streamlit/elements/pdf.py +192 -0
  29. streamlit/elements/plotly_chart.py +3 -2
  30. streamlit/elements/pyplot.py +53 -11
  31. streamlit/elements/toast.py +81 -5
  32. streamlit/elements/vega_charts.py +3 -8
  33. streamlit/elements/widgets/audio_input.py +0 -1
  34. streamlit/elements/widgets/button.py +0 -4
  35. streamlit/elements/widgets/button_group.py +5 -4
  36. streamlit/elements/widgets/camera_input.py +0 -1
  37. streamlit/elements/widgets/chat.py +11 -13
  38. streamlit/elements/widgets/checkbox.py +0 -1
  39. streamlit/elements/widgets/color_picker.py +0 -1
  40. streamlit/elements/widgets/data_editor.py +142 -62
  41. streamlit/elements/widgets/file_uploader.py +74 -37
  42. streamlit/elements/widgets/multiselect.py +0 -1
  43. streamlit/elements/widgets/number_input.py +0 -1
  44. streamlit/elements/widgets/radio.py +0 -1
  45. streamlit/elements/widgets/select_slider.py +0 -1
  46. streamlit/elements/widgets/selectbox.py +0 -1
  47. streamlit/elements/widgets/slider.py +0 -1
  48. streamlit/elements/widgets/text_widgets.py +0 -2
  49. streamlit/elements/widgets/time_widgets.py +0 -2
  50. streamlit/errors.py +11 -0
  51. streamlit/material_icon_names.py +1 -1
  52. streamlit/proto/Arrow_pb2.py +14 -8
  53. streamlit/proto/Arrow_pb2.pyi +11 -3
  54. streamlit/proto/Block_pb2.py +16 -16
  55. streamlit/proto/Block_pb2.pyi +2 -0
  56. streamlit/proto/ChatInput_pb2.py +3 -3
  57. streamlit/proto/ChatInput_pb2.pyi +2 -0
  58. streamlit/proto/FileUploader_pb2.py +2 -2
  59. streamlit/proto/FileUploader_pb2.pyi +5 -1
  60. streamlit/proto/GraphVizChart_pb2.py +4 -2
  61. streamlit/proto/GraphVizChart_pb2.pyi +1 -1
  62. streamlit/proto/Image_pb2.py +4 -2
  63. streamlit/proto/Image_pb2.pyi +1 -10
  64. streamlit/proto/Metric_pb2.py +8 -6
  65. streamlit/proto/Metric_pb2.pyi +34 -10
  66. streamlit/proto/Toast_pb2.py +2 -2
  67. streamlit/proto/Toast_pb2.pyi +10 -1
  68. streamlit/runtime/caching/__init__.py +14 -2
  69. streamlit/runtime/caching/cache_data_api.py +0 -17
  70. streamlit/runtime/caching/cache_resource_api.py +0 -16
  71. streamlit/runtime/caching/cached_message_replay.py +8 -20
  72. streamlit/runtime/caching/hashing.py +31 -1
  73. streamlit/runtime/credentials.py +4 -4
  74. streamlit/runtime/fragment.py +0 -42
  75. streamlit/runtime/websocket_session_manager.py +1 -1
  76. streamlit/static/index.html +2 -2
  77. streamlit/static/manifest.json +223 -251
  78. streamlit/static/static/css/{index.CJVRHjQZ.css → index.C8X8rNzw.css} +1 -1
  79. streamlit/static/static/css/index.COe1010n.css +1 -0
  80. streamlit/static/static/js/{ErrorOutline.esm.DjObtx4K.js → ErrorOutline.esm.DcGrhbBP.js} +1 -1
  81. streamlit/static/static/js/{FileDownload.esm.Bz9nxNC5.js → FileDownload.esm.DgBvV6Pq.js} +1 -1
  82. streamlit/static/static/js/FileHelper.M6AAaeuA.js +5 -0
  83. streamlit/static/static/js/FormClearHelper.DHh1GFzm.js +1 -0
  84. streamlit/static/static/js/{Hooks.DEoLCfOE.js → Hooks.DGu1od_L.js} +1 -1
  85. streamlit/static/static/js/InputInstructions.z6sVgyYt.js +1 -0
  86. streamlit/static/static/js/Particles.DDVT-6Qc.js +1 -0
  87. streamlit/static/static/js/ProgressBar.BEY0cXXV.js +2 -0
  88. streamlit/static/static/js/Toolbar.DSnK1fUh.js +1 -0
  89. streamlit/static/static/js/{base-input.BmvSaPd2.js → base-input.CK3UVGp1.js} +4 -4
  90. streamlit/static/static/js/{checkbox.Cgxgc0et.js → checkbox.D8W881TL.js} +2 -2
  91. streamlit/static/static/js/createSuper.B6W-Dh9S.js +1 -0
  92. streamlit/static/static/js/data-grid-overlay-editor.DRTHOydk.js +1 -0
  93. streamlit/static/static/js/{downloader.M6jQeNDf.js → downloader.DiKpuU_S.js} +1 -1
  94. streamlit/static/static/js/es6.B8zRNPZ-.js +2 -0
  95. streamlit/static/static/js/iframeResizer.contentWindow.DIewJmmh.js +1 -0
  96. streamlit/static/static/js/index.452cqrrL.js +1 -0
  97. streamlit/static/static/js/index.4eF4NxG2.js +1 -0
  98. streamlit/static/static/js/index.B6U8LQo3.js +1 -0
  99. streamlit/static/static/js/index.B9mjBcgE.js +1 -0
  100. streamlit/static/static/js/index.BXYmrqnf.js +1 -0
  101. streamlit/static/static/js/index.B_8AnktO.js +1 -0
  102. streamlit/static/static/js/index.Bl7zGQSh.js +7 -0
  103. streamlit/static/static/js/index.BnEpvLEz.js +1 -0
  104. streamlit/static/static/js/{index.D1EayrNh.js → index.BnJIOYn9.js} +2 -2
  105. streamlit/static/static/js/index.Bte_9Lyq.js +1 -0
  106. streamlit/static/static/js/index.C1HcTl5K.js +1 -0
  107. streamlit/static/static/js/index.C7fRKRs4.js +1 -0
  108. streamlit/static/static/js/index.C7lSmSOP.js +1 -0
  109. streamlit/static/static/js/index.CD8HuT3N.js +976 -0
  110. streamlit/static/static/js/index.CP5TD2z1.js +1 -0
  111. streamlit/static/static/js/index.C_tmcx4B.js +1 -0
  112. streamlit/static/static/js/index.CcJf6BCU.js +3858 -0
  113. streamlit/static/static/js/{index.CbdWnLqS.js → index.CejBxbg1.js} +3 -3
  114. streamlit/static/static/js/index.Ch7MBCx0.js +5367 -0
  115. streamlit/static/static/js/index.CjXWwH-y.js +1 -0
  116. streamlit/static/static/js/index.CvYYtxD_.js +1 -0
  117. streamlit/static/static/js/index.D2-atlaQ.js +3 -0
  118. streamlit/static/static/js/index.D3K5nOu9.js +197 -0
  119. streamlit/static/static/js/index.D5naqx-J.js +1 -0
  120. streamlit/static/static/js/index.Dk4C7X3i.js +1 -0
  121. streamlit/static/static/js/index.DkKT3LUI.js +1 -0
  122. streamlit/static/static/js/index.DtYN2x4k.js +1 -0
  123. streamlit/static/static/js/index.MTPPBDHk.js +2 -0
  124. streamlit/static/static/js/{index.Cqa4gqqN.js → index.Ts_0SdB9.js} +1 -1
  125. streamlit/static/static/js/{index.CgZDfhN4.js → index.cnnXF7xQ.js} +2 -2
  126. streamlit/static/static/js/index.ho6NIXGl.js +1 -0
  127. streamlit/static/static/js/index.pqW9AMJD.js +3 -0
  128. streamlit/static/static/js/{index.D1jHqUJq.js → index.qhs54UAB.js} +1 -1
  129. streamlit/static/static/js/{index.tsvTLdio.js → index.urHgTgMQ.js} +9 -9
  130. streamlit/static/static/js/index.wzkv_11M.js +1 -0
  131. streamlit/static/static/js/index.yF5AncHY.js +1 -0
  132. streamlit/static/static/js/{index.BXDq9dj4.js → index.zecpGxtj.js} +1 -1
  133. streamlit/static/static/js/{input.DZd6EQlV.js → input.nzVJphXi.js} +2 -2
  134. streamlit/static/static/js/{memory.ptkfuI71.js → memory.CjCgTQz3.js} +1 -1
  135. streamlit/static/static/js/number-overlay-editor.DaRFzZEO.js +9 -0
  136. streamlit/static/static/js/{possibleConstructorReturn.Bd4ImlQ9.js → possibleConstructorReturn.DgiPnZ9N.js} +1 -1
  137. streamlit/static/static/js/{sandbox.DsH8LuID.js → sandbox.mithfq7Z.js} +1 -1
  138. streamlit/static/static/js/{timepicker.QVekV78C.js → timepicker.Dbl5KFh6.js} +4 -4
  139. streamlit/static/static/js/{toConsumableArray.BJvaP8gb.js → toConsumableArray.D-Dx88BQ.js} +3 -3
  140. streamlit/static/static/js/uniqueId.Bh26R_3S.js +1 -0
  141. streamlit/static/static/js/{useBasicWidgetState.DB3vMS9V.js → useBasicWidgetState.DeK-QJpD.js} +1 -1
  142. streamlit/static/static/js/{useTextInputAutoExpand.CBkGkaRt.js → useTextInputAutoExpand.4iAdLWD-.js} +2 -2
  143. streamlit/static/static/js/useUpdateUiValue.CmT7_nJN.js +1 -0
  144. streamlit/static/static/js/withFullScreenWrapper.DLp1ENGm.js +1 -0
  145. streamlit/static/static/media/MaterialSymbols-Rounded.CBxVaFdk.woff2 +0 -0
  146. streamlit/user_info.py +3 -1
  147. streamlit/web/server/browser_websocket_handler.py +15 -0
  148. {streamlit-1.48.1.dist-info → streamlit-1.49.1.dist-info}/METADATA +4 -2
  149. {streamlit-1.48.1.dist-info → streamlit-1.49.1.dist-info}/RECORD +153 -156
  150. streamlit/static/static/css/index.CQt5TjGB.css +0 -1
  151. streamlit/static/static/js/FileHelper.BrQvUXVD.js +0 -5
  152. streamlit/static/static/js/FormClearHelper.DF4gFAOO.js +0 -1
  153. streamlit/static/static/js/InputInstructions.D8zoMog9.js +0 -1
  154. streamlit/static/static/js/Particles.CCFySwdL.js +0 -1
  155. streamlit/static/static/js/ProgressBar.COK9j1l0.js +0 -2
  156. streamlit/static/static/js/Toolbar.Dt4jIKlY.js +0 -1
  157. streamlit/static/static/js/createSuper.siQeagI2.js +0 -1
  158. streamlit/static/static/js/data-grid-overlay-editor.Ct51iCb_.js +0 -1
  159. streamlit/static/static/js/es6.CMaUdEZ5.js +0 -2
  160. streamlit/static/static/js/iframeResizer.contentWindow.C33BryyP.js +0 -1
  161. streamlit/static/static/js/index.8GJD0eeD.js +0 -1
  162. streamlit/static/static/js/index.8QEYHMQD.js +0 -1
  163. streamlit/static/static/js/index.Ay41Wnu9.js +0 -1
  164. streamlit/static/static/js/index.BLiKiJ7_.js +0 -1
  165. streamlit/static/static/js/index.BT78cJmU.js +0 -1
  166. streamlit/static/static/js/index.BdGvnhlM.js +0 -1
  167. streamlit/static/static/js/index.BfasrT0d.js +0 -1
  168. streamlit/static/static/js/index.CCdtFMFG.js +0 -1
  169. streamlit/static/static/js/index.CFRGZDz1.js +0 -1
  170. streamlit/static/static/js/index.CFSFYiPA.js +0 -5366
  171. streamlit/static/static/js/index.CeiIiXap.js +0 -1
  172. streamlit/static/static/js/index.CzX2xpyc.js +0 -1
  173. streamlit/static/static/js/index.D1ErX5go.js +0 -2
  174. streamlit/static/static/js/index.D5gweoL5.js +0 -7
  175. streamlit/static/static/js/index.DByVKZgq.js +0 -1
  176. streamlit/static/static/js/index.DEND45D1.js +0 -3
  177. streamlit/static/static/js/index.DKN5MVff.js +0 -781
  178. streamlit/static/static/js/index.DfoxW1gP.js +0 -3855
  179. streamlit/static/static/js/index.Dtf1Ac0x.js +0 -1
  180. streamlit/static/static/js/index.DxrLhpeO.js +0 -1
  181. streamlit/static/static/js/index.J7o-_HIh.js +0 -1
  182. streamlit/static/static/js/index.LU8juINp.js +0 -197
  183. streamlit/static/static/js/index.L_N2iylt.js +0 -1
  184. streamlit/static/static/js/index.PZUX2kRz.js +0 -3
  185. streamlit/static/static/js/index.ROjU6K0k.js +0 -1
  186. streamlit/static/static/js/index.WSNLkF94.js +0 -1
  187. streamlit/static/static/js/index.X5W3gJLn.js +0 -1
  188. streamlit/static/static/js/index.k9LYqfSL.js +0 -1
  189. streamlit/static/static/js/index.pnHtHv_c.js +0 -203
  190. streamlit/static/static/js/index.tPUXqsfW.js +0 -1
  191. streamlit/static/static/js/mergeWith.GRNk8iwv.js +0 -1
  192. streamlit/static/static/js/number-overlay-editor.DXS2qb1U.js +0 -9
  193. streamlit/static/static/js/threshold.DjX0wlsa.js +0 -1
  194. streamlit/static/static/js/timer.CAwTRJ_g.js +0 -1
  195. streamlit/static/static/js/uniqueId.D_5M8Dgf.js +0 -1
  196. streamlit/static/static/js/useUpdateUiValue.C7ZKpLQK.js +0 -1
  197. streamlit/static/static/js/value.CgPGBV_l.js +0 -1
  198. streamlit/static/static/js/withFullScreenWrapper.C-gXt0Rl.js +0 -1
  199. streamlit/static/static/media/MaterialSymbols-Rounded.DsbC8sYI.woff2 +0 -0
  200. {streamlit-1.48.1.data → streamlit-1.49.1.data}/scripts/streamlit.cmd +0 -0
  201. {streamlit-1.48.1.dist-info → streamlit-1.49.1.dist-info}/WHEEL +0 -0
  202. {streamlit-1.48.1.dist-info → streamlit-1.49.1.dist-info}/entry_points.txt +0 -0
  203. {streamlit-1.48.1.dist-info → streamlit-1.49.1.dist-info}/top_level.txt +0 -0
@@ -14,9 +14,9 @@
14
14
 
15
15
  from __future__ import annotations
16
16
 
17
- from typing import TYPE_CHECKING, cast
17
+ from typing import TYPE_CHECKING, Literal, cast
18
18
 
19
- from streamlit.errors import StreamlitAPIException
19
+ from streamlit.errors import StreamlitAPIException, StreamlitValueError
20
20
  from streamlit.proto.Toast_pb2 import Toast as ToastProto
21
21
  from streamlit.runtime.metrics_util import gather_metrics
22
22
  from streamlit.string_util import clean_text, validate_icon_or_emoji
@@ -41,6 +41,7 @@ class ToastMixin:
41
41
  body: SupportsStr,
42
42
  *, # keyword-only args:
43
43
  icon: str | None = None,
44
+ duration: Literal["short", "long", "infinite"] | int = "short",
44
45
  ) -> DeltaGenerator:
45
46
  """Display a short message, known as a notification "toast".
46
47
  The toast appears in the app's top-right corner and disappears after four seconds.
@@ -79,16 +80,91 @@ class ToastMixin:
79
80
  <https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
80
81
  font library.
81
82
 
83
+ duration : "short", "long", "infinite", or int
84
+ The time to display the toast message. This can be one of the
85
+ following:
82
86
 
83
- Example
84
- -------
87
+ - ``"short"`` (default): Displays for 4 seconds.
88
+ - ``"long"``: Displays for 10 seconds.
89
+ - ``"infinite"``: Shows the toast until the user dismisses it.
90
+ - An integer: Displays for the specified number of seconds.
91
+
92
+ Examples
93
+ --------
94
+ **Example 1: Show a toast message**
95
+
96
+ >>> import streamlit as st
97
+ >>>
98
+ >>> st.toast("Your edited image was saved!", icon="😍")
99
+
100
+ .. output::
101
+ https://doc-status-toast.streamlit.app
102
+ height: 200px
103
+
104
+ **Example 2: Show multiple toasts**
105
+
106
+ When multiple toasts are generated, they will stack. Hovering over a
107
+ toast will stop it from disappearing. When hovering ends, the toast
108
+ will disappear after time specified in ``duration``.
109
+
110
+ >>> import time
85
111
  >>> import streamlit as st
86
112
  >>>
87
- >>> st.toast('Your edited image was saved!', icon='😍')
113
+ >>> if st.button("Three cheers"):
114
+ >>> st.toast("Hip!")
115
+ >>> time.sleep(0.5)
116
+ >>> st.toast("Hip!")
117
+ >>> time.sleep(0.5)
118
+ >>> st.toast("Hooray!", icon="🎉")
119
+
120
+ .. output::
121
+ https://doc-status-toast1.streamlit.app
122
+ height: 300px
123
+
124
+ **Example 3: Update a toast message**
125
+
126
+ Toast messages can also be updated. Assign ``st.toast(my_message)`` to
127
+ a variable and use the ``.toast()`` method to update it. If a toast has
128
+ already disappeared or been dismissed, the update will not be seen.
129
+
130
+ >>> import time
131
+ >>> import streamlit as st
132
+ >>>
133
+ >>> def cook_breakfast():
134
+ >>> msg = st.toast("Gathering ingredients...")
135
+ >>> time.sleep(1)
136
+ >>> msg.toast("Cooking...")
137
+ >>> time.sleep(1)
138
+ >>> msg.toast("Ready!", icon="🥞")
139
+ >>>
140
+ >>> if st.button("Cook breakfast"):
141
+ >>> cook_breakfast()
142
+
143
+ .. output::
144
+ https://doc-status-toast2.streamlit.app
145
+ height: 200px
146
+
88
147
  """
89
148
  toast_proto = ToastProto()
90
149
  toast_proto.body = clean_text(validate_text(body))
91
150
  toast_proto.icon = validate_icon_or_emoji(icon)
151
+
152
+ if duration in ["short", "long", "infinite"] or (
153
+ isinstance(duration, int) and duration > 0
154
+ ):
155
+ if duration == "short":
156
+ toast_proto.duration = 4
157
+ elif duration == "long":
158
+ toast_proto.duration = 10
159
+ elif duration == "infinite":
160
+ toast_proto.duration = 0
161
+ else:
162
+ toast_proto.duration = duration
163
+ else:
164
+ raise StreamlitValueError(
165
+ "duration", ["short", "long", "infinite", "a positive integer"]
166
+ )
167
+
92
168
  return self.dg._enqueue("toast", toast_proto)
93
169
 
94
170
  @property
@@ -387,18 +387,14 @@ def _convert_altair_to_vega_lite_spec(
387
387
  alt.data_transformers.register("id", id_transform) # type: ignore[arg-type,attr-defined,unused-ignore]
388
388
 
389
389
  # alt.themes was deprecated in Altair 5.5.0 in favor of alt.theme
390
- altair_theme = (
391
- alt.themes if type_util.is_altair_version_less_than("5.5.0") else alt.theme
390
+ alt_theme = (
391
+ alt.themes if type_util.is_altair_version_less_than("5.5.0") else alt.theme # ty: ignore[unresolved-attribute]
392
392
  )
393
393
 
394
394
  # The default altair theme has some width/height defaults defined
395
395
  # which are not useful for Streamlit. Therefore, we change the theme to
396
396
  # "none" to avoid those defaults.
397
- with (
398
- altair_theme.enable("none")
399
- if altair_theme.active == "default"
400
- else nullcontext()
401
- ): # type: ignore[attr-defined,unused-ignore]
397
+ with alt_theme.enable("none") if alt_theme.active == "default" else nullcontext(): # ty: ignore
402
398
  with alt.data_transformers.enable("id"): # type: ignore[attr-defined,unused-ignore]
403
399
  chart_dict = altair_chart.to_dict()
404
400
 
@@ -2083,7 +2079,6 @@ class VegaChartsMixin:
2083
2079
  vega_lite_proto.id = compute_and_register_element_id(
2084
2080
  "arrow_vega_lite_chart",
2085
2081
  user_key=key,
2086
- form_id=vega_lite_proto.form_id,
2087
2082
  dg=self.dg,
2088
2083
  vega_lite_spec=vega_lite_proto.spec,
2089
2084
  # The data is either in vega_lite_proto.data.data
@@ -239,7 +239,6 @@ class AudioInputMixin:
239
239
  element_id = compute_and_register_element_id(
240
240
  "audio_input",
241
241
  user_key=key,
242
- form_id=current_form_id(self.dg),
243
242
  dg=self.dg,
244
243
  label=label,
245
244
  help=help,
@@ -914,8 +914,6 @@ class ButtonMixin:
914
914
  element_id = compute_and_register_element_id(
915
915
  "download_button",
916
916
  user_key=key,
917
- # download_button is not allowed to be used in a form.
918
- form_id=None,
919
917
  dg=self.dg,
920
918
  label=label,
921
919
  icon=icon,
@@ -1123,8 +1121,6 @@ class ButtonMixin:
1123
1121
  element_id = compute_and_register_element_id(
1124
1122
  "button",
1125
1123
  user_key=key,
1126
- # Only the
1127
- form_id=form_id,
1128
1124
  dg=self.dg,
1129
1125
  label=label,
1130
1126
  icon=icon,
@@ -1031,7 +1031,6 @@ class ButtonGroupMixin:
1031
1031
 
1032
1032
  check_widget_policies(self.dg, key, on_change, default_value=_default)
1033
1033
 
1034
- widget_name = "button_group"
1035
1034
  ctx = get_script_run_ctx()
1036
1035
  form_id = current_form_id(self.dg)
1037
1036
  formatted_options = (
@@ -1042,10 +1041,12 @@ class ButtonGroupMixin:
1042
1041
  for index, _ in enumerate(indexable_options)
1043
1042
  ]
1044
1043
  )
1044
+
1045
1045
  element_id = compute_and_register_element_id(
1046
- widget_name,
1046
+ # The borderless style is used by st.feedback, but users expect to see
1047
+ # "feedback" in errors
1048
+ "feedback" if style == "borderless" else style,
1047
1049
  user_key=key,
1048
- form_id=form_id,
1049
1050
  dg=self.dg,
1050
1051
  options=formatted_options,
1051
1052
  default=default,
@@ -1088,7 +1089,7 @@ class ButtonGroupMixin:
1088
1089
  if ctx:
1089
1090
  save_for_app_testing(ctx, element_id, format_func)
1090
1091
 
1091
- self.dg._enqueue(widget_name, proto, layout_config=layout_config)
1092
+ self.dg._enqueue("button_group", proto, layout_config=layout_config)
1092
1093
 
1093
1094
  return widget_state
1094
1095
 
@@ -234,7 +234,6 @@ class CameraInputMixin:
234
234
  element_id = compute_and_register_element_id(
235
235
  "camera_input",
236
236
  user_key=key,
237
- form_id=current_form_id(self.dg),
238
237
  dg=self.dg,
239
238
  label=label,
240
239
  help=help,
@@ -32,7 +32,7 @@ from streamlit.elements.lib.file_uploader_utils import (
32
32
  normalize_upload_file_type,
33
33
  )
34
34
  from streamlit.elements.lib.form_utils import is_in_form
35
- from streamlit.elements.lib.image_utils import AtomicImage, WidthBehavior, image_to_url
35
+ from streamlit.elements.lib.image_utils import AtomicImage, image_to_url
36
36
  from streamlit.elements.lib.layout_utils import (
37
37
  LayoutConfig,
38
38
  Width,
@@ -147,7 +147,7 @@ def _process_avatar_input(
147
147
  try:
148
148
  return AvatarType.IMAGE, image_to_url(
149
149
  avatar,
150
- width=WidthBehavior.ORIGINAL,
150
+ layout_config=LayoutConfig(width="content"),
151
151
  clamp=False,
152
152
  channels="RGB",
153
153
  output_format="auto",
@@ -391,7 +391,7 @@ class ChatMixin:
391
391
  *,
392
392
  key: Key | None = None,
393
393
  max_chars: int | None = None,
394
- accept_file: Literal[True, "multiple"],
394
+ accept_file: Literal[True, "multiple", "directory"],
395
395
  file_type: str | Sequence[str] | None = None,
396
396
  disabled: bool = False,
397
397
  on_submit: WidgetCallback | None = None,
@@ -407,7 +407,7 @@ class ChatMixin:
407
407
  *,
408
408
  key: Key | None = None,
409
409
  max_chars: int | None = None,
410
- accept_file: bool | Literal["multiple"] = False,
410
+ accept_file: bool | Literal["multiple", "directory"] = False,
411
411
  file_type: str | Sequence[str] | None = None,
412
412
  disabled: bool = False,
413
413
  on_submit: WidgetCallback | None = None,
@@ -433,7 +433,7 @@ class ChatMixin:
433
433
  The maximum number of characters that can be entered. If this is
434
434
  ``None`` (default), there will be no maximum.
435
435
 
436
- accept_file : bool or str
436
+ accept_file : bool, "multiple", or "directory"
437
437
  Whether the chat input should accept files. This can be one of the
438
438
  following values:
439
439
 
@@ -442,9 +442,9 @@ class ChatMixin:
442
442
  - ``True``: The user can add a single file to their submission.
443
443
  - ``"multiple"``: The user can add multiple files to their
444
444
  submission.
445
-
446
- When the widget is configured to accept files, the accepted file
447
- types can be configured with the ``file_type`` parameter.
445
+ - ``"directory"``: The user can add multiple files to their
446
+ submission by selecting a directory. If ``file_type`` is set,
447
+ only files matching those type(s) will be uploaded.
448
448
 
449
449
  By default, uploaded files are limited to 200 MB each. You can
450
450
  configure this using the ``server.maxUploadSize`` config option.
@@ -614,9 +614,9 @@ class ChatMixin:
614
614
  writes_allowed=True,
615
615
  )
616
616
 
617
- if accept_file not in {True, False, "multiple"}:
617
+ if accept_file not in {True, False, "multiple", "directory"}:
618
618
  raise StreamlitAPIException(
619
- "The `accept_file` parameter must be a boolean or 'multiple'."
619
+ "The `accept_file` parameter must be a boolean or 'multiple' or 'directory'."
620
620
  )
621
621
 
622
622
  ctx = get_script_run_ctx()
@@ -624,8 +624,6 @@ class ChatMixin:
624
624
  element_id = compute_and_register_element_id(
625
625
  "chat_input",
626
626
  user_key=key,
627
- # chat_input is not allowed to be used in a form.
628
- form_id=None,
629
627
  dg=self.dg,
630
628
  placeholder=placeholder,
631
629
  max_chars=max_chars,
@@ -677,7 +675,7 @@ class ChatMixin:
677
675
  chat_input_proto.max_upload_size_mb = config.get_option("server.maxUploadSize")
678
676
 
679
677
  serde = ChatInputSerde(
680
- accept_files=bool(accept_file),
678
+ accept_files=accept_file in {True, "multiple", "directory"},
681
679
  allowed_types=file_type,
682
680
  )
683
681
  widget_state = register_widget( # type: ignore[misc]
@@ -342,7 +342,6 @@ class CheckboxMixin:
342
342
  element_id = compute_and_register_element_id(
343
343
  "toggle" if type == CheckboxProto.StyleType.TOGGLE else "checkbox",
344
344
  user_key=key,
345
- form_id=current_form_id(self.dg),
346
345
  dg=self.dg,
347
346
  label=label,
348
347
  value=bool(value),
@@ -219,7 +219,6 @@ class ColorPickerMixin:
219
219
  element_id = compute_and_register_element_id(
220
220
  "color_picker",
221
221
  user_key=key,
222
- form_id=current_form_id(self.dg),
223
222
  dg=self.dg,
224
223
  label=label,
225
224
  value=str(value),