streamlit-nightly 1.37.2.dev20240822__py2.py3-none-any.whl → 1.37.2.dev20240824__py2.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.
@@ -86,6 +86,7 @@ class ButtonMixin:
86
86
  kwargs: WidgetKwargs | None = None,
87
87
  *, # keyword-only arguments:
88
88
  type: Literal["primary", "secondary"] = "secondary",
89
+ icon: str | None = None,
89
90
  disabled: bool = False,
90
91
  use_container_width: bool = False,
91
92
  ) -> bool:
@@ -134,6 +135,23 @@ class ButtonMixin:
134
135
  button with additional emphasis or "secondary" for a normal button. Defaults
135
136
  to "secondary".
136
137
 
138
+ icon : str or None
139
+ An optional emoji or icon to display next to the button label. If ``icon``
140
+ is ``None`` (default), no icon is displayed. If ``icon`` is a
141
+ string, the following options are valid:
142
+
143
+ * A single-character emoji. For example, you can set ``icon="🚨"``
144
+ or ``icon="🔥"``. Emoji short codes are not supported.
145
+
146
+ * An icon from the Material Symbols library (rounded style) in the
147
+ format ``":material/icon_name:"`` where "icon_name" is the name
148
+ of the icon in snake case.
149
+
150
+ For example, ``icon=":material/thumb_up:"`` will display the
151
+ Thumb Up icon. Find additional icons in the `Material Symbols \
152
+ <https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
153
+ font library.
154
+
137
155
  disabled : bool
138
156
  An optional boolean, which disables the button if set to True. The
139
157
  default is False.
@@ -188,6 +206,7 @@ class ButtonMixin:
188
206
  kwargs=kwargs,
189
207
  disabled=disabled,
190
208
  type=type,
209
+ icon=icon,
191
210
  use_container_width=use_container_width,
192
211
  ctx=ctx,
193
212
  )
@@ -761,6 +780,7 @@ class ButtonMixin:
761
780
  kwargs: WidgetKwargs | None = None,
762
781
  *, # keyword-only arguments:
763
782
  type: Literal["primary", "secondary"] = "secondary",
783
+ icon: str | None = None,
764
784
  disabled: bool = False,
765
785
  use_container_width: bool = False,
766
786
  ctx: ScriptRunContext | None = None,
@@ -780,6 +800,7 @@ class ButtonMixin:
780
800
  "button",
781
801
  user_key=key,
782
802
  label=label,
803
+ icon=icon,
783
804
  key=key,
784
805
  help=help,
785
806
  is_form_submitter=is_form_submitter,
@@ -816,6 +837,9 @@ class ButtonMixin:
816
837
  if help is not None:
817
838
  button_proto.help = dedent(help)
818
839
 
840
+ if icon is not None:
841
+ button_proto.icon = validate_icon_or_emoji(icon)
842
+
819
843
  serde = ButtonSerde()
820
844
 
821
845
  button_state = register_widget(
@@ -14,7 +14,7 @@ _sym_db = _symbol_database.Default()
14
14
 
15
15
 
16
16
 
17
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1cstreamlit/proto/Button.proto\"\xab\x01\n\x06\x42utton\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 \x01(\x08\x12\x0c\n\x04help\x18\x04 \x01(\t\x12\x0f\n\x07\x66orm_id\x18\x05 \x01(\t\x12\x19\n\x11is_form_submitter\x18\x06 \x01(\x08\x12\x0c\n\x04type\x18\x07 \x01(\t\x12\x10\n\x08\x64isabled\x18\x08 \x01(\x08\x12\x1b\n\x13use_container_width\x18\t \x01(\x08\x42+\n\x1c\x63om.snowflake.apps.streamlitB\x0b\x42uttonProtob\x06proto3')
17
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1cstreamlit/proto/Button.proto\"\xb9\x01\n\x06\x42utton\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 \x01(\x08\x12\x0c\n\x04help\x18\x04 \x01(\t\x12\x0f\n\x07\x66orm_id\x18\x05 \x01(\t\x12\x19\n\x11is_form_submitter\x18\x06 \x01(\x08\x12\x0c\n\x04type\x18\x07 \x01(\t\x12\x10\n\x08\x64isabled\x18\x08 \x01(\x08\x12\x1b\n\x13use_container_width\x18\t \x01(\x08\x12\x0c\n\x04icon\x18\n \x01(\tB+\n\x1c\x63om.snowflake.apps.streamlitB\x0b\x42uttonProtob\x06proto3')
18
18
 
19
19
  _globals = globals()
20
20
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -23,5 +23,5 @@ if not _descriptor._USE_C_DESCRIPTORS:
23
23
  _globals['DESCRIPTOR']._loaded_options = None
24
24
  _globals['DESCRIPTOR']._serialized_options = b'\n\034com.snowflake.apps.streamlitB\013ButtonProto'
25
25
  _globals['_BUTTON']._serialized_start=33
26
- _globals['_BUTTON']._serialized_end=204
26
+ _globals['_BUTTON']._serialized_end=218
27
27
  # @@protoc_insertion_point(module_scope)
@@ -37,6 +37,7 @@ class Button(google.protobuf.message.Message):
37
37
  TYPE_FIELD_NUMBER: builtins.int
38
38
  DISABLED_FIELD_NUMBER: builtins.int
39
39
  USE_CONTAINER_WIDTH_FIELD_NUMBER: builtins.int
40
+ ICON_FIELD_NUMBER: builtins.int
40
41
  id: builtins.str
41
42
  label: builtins.str
42
43
  default: builtins.bool
@@ -50,6 +51,7 @@ class Button(google.protobuf.message.Message):
50
51
  type: builtins.str
51
52
  disabled: builtins.bool
52
53
  use_container_width: builtins.bool
54
+ icon: builtins.str
53
55
  def __init__(
54
56
  self,
55
57
  *,
@@ -62,7 +64,8 @@ class Button(google.protobuf.message.Message):
62
64
  type: builtins.str = ...,
63
65
  disabled: builtins.bool = ...,
64
66
  use_container_width: builtins.bool = ...,
67
+ icon: builtins.str = ...,
65
68
  ) -> None: ...
66
- def ClearField(self, field_name: typing.Literal["default", b"default", "disabled", b"disabled", "form_id", b"form_id", "help", b"help", "id", b"id", "is_form_submitter", b"is_form_submitter", "label", b"label", "type", b"type", "use_container_width", b"use_container_width"]) -> None: ...
69
+ def ClearField(self, field_name: typing.Literal["default", b"default", "disabled", b"disabled", "form_id", b"form_id", "help", b"help", "icon", b"icon", "id", b"id", "is_form_submitter", b"is_form_submitter", "label", b"label", "type", b"type", "use_container_width", b"use_container_width"]) -> None: ...
67
70
 
68
71
  global___Button = Button
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "files": {
3
3
  "main.css": "./static/css/main.5513bd04.css",
4
- "main.js": "./static/js/main.33cac65c.js",
4
+ "main.js": "./static/js/main.771fbdca.js",
5
5
  "static/js/9336.3e046ad7.chunk.js": "./static/js/9336.3e046ad7.chunk.js",
6
6
  "static/js/9330.32e8a53a.chunk.js": "./static/js/9330.32e8a53a.chunk.js",
7
7
  "static/js/2736.3d50ec7f.chunk.js": "./static/js/2736.3d50ec7f.chunk.js",
@@ -20,7 +20,7 @@
20
20
  "static/js/4113.786b0142.chunk.js": "./static/js/4113.786b0142.chunk.js",
21
21
  "static/js/1168.7c30158a.chunk.js": "./static/js/1168.7c30158a.chunk.js",
22
22
  "static/js/178.ddebe26b.chunk.js": "./static/js/178.ddebe26b.chunk.js",
23
- "static/js/1792.d126bbd9.chunk.js": "./static/js/1792.d126bbd9.chunk.js",
23
+ "static/js/1792.61097259.chunk.js": "./static/js/1792.61097259.chunk.js",
24
24
  "static/js/1116.85ec79d5.chunk.js": "./static/js/1116.85ec79d5.chunk.js",
25
25
  "static/js/3513.5e3a04f2.chunk.js": "./static/js/3513.5e3a04f2.chunk.js",
26
26
  "static/js/7602.a6e1d802.chunk.js": "./static/js/7602.a6e1d802.chunk.js",
@@ -153,6 +153,6 @@
153
153
  },
154
154
  "entrypoints": [
155
155
  "static/css/main.5513bd04.css",
156
- "static/js/main.33cac65c.js"
156
+ "static/js/main.771fbdca.js"
157
157
  ]
158
158
  }
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><link rel="shortcut icon" href="./favicon.png"/><link rel="preload" href="./static/media/SourceSansPro-Regular.0d69e5ff5e92ac64a0c9.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-SemiBold.abed79cd0df1827e18cf.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-Bold.118dea98980e20a81ced.woff2" as="font" type="font/woff2" crossorigin><title>Streamlit</title><script>window.prerenderReady=!1</script><script defer="defer" src="./static/js/main.33cac65c.js"></script><link href="./static/css/main.5513bd04.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><link rel="shortcut icon" href="./favicon.png"/><link rel="preload" href="./static/media/SourceSansPro-Regular.0d69e5ff5e92ac64a0c9.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-SemiBold.abed79cd0df1827e18cf.woff2" as="font" type="font/woff2" crossorigin><link rel="preload" href="./static/media/SourceSansPro-Bold.118dea98980e20a81ced.woff2" as="font" type="font/woff2" crossorigin><title>Streamlit</title><script>window.prerenderReady=!1</script><script defer="defer" src="./static/js/main.771fbdca.js"></script><link href="./static/css/main.5513bd04.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[1792],{61792:(e,t,s)=>{s.r(t),s.d(t,{default:()=>c});s(66845);var i=s(25621),l=s(81354),a=s(27446),n=s(9003),r=s(22704),d=s(12596),o=s(40864);const c=function(e){const{colors:t}=(0,i.u)(),{disabled:s,element:c,widgetMgr:u,width:h,fragmentId:p}=e,m={width:h},b="primary"===c.type?l.nW.PRIMARY:l.nW.SECONDARY,g=!c.help||h,f=c.icon.startsWith(":material");return(0,o.jsx)("div",{className:"stButton","data-testid":"stButton",style:m,children:(0,o.jsx)(a.t,{help:c.help,children:(0,o.jsxs)(n.ZP,{kind:b,size:l.V5.SMALL,disabled:s,fluidWidth:!!c.useContainerWidth&&g,onClick:()=>u.setTriggerValue(c,{fromUi:!0},p),children:[c.icon&&(0,o.jsx)(r.p,{size:f?"lg":"base",margin:f?"0 sm 0 0":"0 md 0 0",color:t.bodyText,iconValue:c.icon}),(0,o.jsx)(d.ZP,{source:c.label,allowHTML:!1,isLabel:!0,largerLabel:!0,disableLinks:!0})]})})})}}}]);