streamlit-nightly 1.35.1.dev20240611__py2.py3-none-any.whl → 1.35.1.dev20240612__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.
@@ -130,6 +130,7 @@ class LayoutsMixin:
130
130
  block_proto = BlockProto()
131
131
  block_proto.allow_empty = False
132
132
  block_proto.vertical.border = border or False
133
+
133
134
  if height:
134
135
  # Activate scrolling container behavior:
135
136
  block_proto.allow_empty = True
@@ -144,7 +145,11 @@ class LayoutsMixin:
144
145
 
145
146
  @gather_metrics("columns")
146
147
  def columns(
147
- self, spec: SpecType, *, gap: str | None = "small"
148
+ self,
149
+ spec: SpecType,
150
+ *,
151
+ gap: Literal["small", "medium", "large"] = "small",
152
+ vertical_alignment: Literal["top", "center", "bottom"] = "top",
148
153
  ) -> list[DeltaGenerator]:
149
154
  """Insert containers laid out as side-by-side columns.
150
155
 
@@ -176,6 +181,9 @@ class LayoutsMixin:
176
181
  gap : "small", "medium", or "large"
177
182
  The size of the gap between the columns. Defaults to "small".
178
183
 
184
+ vertical_alignment : "top", "center", or "bottom"
185
+ The vertical alignment of the content inside the columns. Defaults to "top".
186
+
179
187
  Returns
180
188
  -------
181
189
  list of containers
@@ -225,13 +233,6 @@ class LayoutsMixin:
225
233
 
226
234
  """
227
235
  weights = spec
228
- weights_exception = StreamlitAPIException(
229
- "The input argument to st.columns must be either a "
230
- "positive integer or a list of positive numeric weights. "
231
- "See [documentation](https://docs.streamlit.io/library/api-reference/layout/st.columns) "
232
- "for more information."
233
- )
234
-
235
236
  if isinstance(weights, int):
236
237
  # If the user provided a single number, expand into equal weights.
237
238
  # E.g. (1,) * 3 => (1, 1, 1)
@@ -239,7 +240,26 @@ class LayoutsMixin:
239
240
  weights = (1,) * weights
240
241
 
241
242
  if len(weights) == 0 or any(weight <= 0 for weight in weights):
242
- raise weights_exception
243
+ raise StreamlitAPIException(
244
+ "The input argument to st.columns must be either a "
245
+ "positive integer or a list of positive numeric weights. "
246
+ "See [documentation](https://docs.streamlit.io/library/api-reference/layout/st.columns) "
247
+ "for more information."
248
+ )
249
+
250
+ vertical_alignment_mapping: dict[
251
+ str, BlockProto.Column.VerticalAlignment.ValueType
252
+ ] = {
253
+ "top": BlockProto.Column.VerticalAlignment.TOP,
254
+ "center": BlockProto.Column.VerticalAlignment.CENTER,
255
+ "bottom": BlockProto.Column.VerticalAlignment.BOTTOM,
256
+ }
257
+
258
+ if vertical_alignment not in vertical_alignment_mapping:
259
+ raise StreamlitAPIException(
260
+ 'The `vertical_alignment` argument to st.columns must be "top", "center", or "bottom". \n'
261
+ f"The argument passed was {vertical_alignment}."
262
+ )
243
263
 
244
264
  def column_gap(gap):
245
265
  if isinstance(gap, str):
@@ -260,6 +280,9 @@ class LayoutsMixin:
260
280
  col_proto = BlockProto()
261
281
  col_proto.column.weight = normalized_weight
262
282
  col_proto.column.gap = gap_size
283
+ col_proto.column.vertical_alignment = vertical_alignment_mapping[
284
+ vertical_alignment
285
+ ]
263
286
  col_proto.allow_empty = True
264
287
  return col_proto
265
288
 
@@ -14,7 +14,7 @@ _sym_db = _symbol_database.Default()
14
14
 
15
15
 
16
16
 
17
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1bstreamlit/proto/Block.proto\"\xbe\x08\n\x05\x42lock\x12#\n\x08vertical\x18\x01 \x01(\x0b\x32\x0f.Block.VerticalH\x00\x12\'\n\nhorizontal\x18\x02 \x01(\x0b\x32\x11.Block.HorizontalH\x00\x12\x1f\n\x06\x63olumn\x18\x03 \x01(\x0b\x32\r.Block.ColumnH\x00\x12\'\n\nexpandable\x18\x04 \x01(\x0b\x32\x11.Block.ExpandableH\x00\x12\x1b\n\x04\x66orm\x18\x05 \x01(\x0b\x32\x0b.Block.FormH\x00\x12,\n\rtab_container\x18\x06 \x01(\x0b\x32\x13.Block.TabContainerH\x00\x12\x19\n\x03tab\x18\x07 \x01(\x0b\x32\n.Block.TabH\x00\x12*\n\x0c\x63hat_message\x18\t \x01(\x0b\x32\x12.Block.ChatMessageH\x00\x12!\n\x07popover\x18\n \x01(\x0b\x32\x0e.Block.PopoverH\x00\x12\x1f\n\x06\x64ialog\x18\x0b \x01(\x0b\x32\r.Block.DialogH\x00\x12\x13\n\x0b\x61llow_empty\x18\x08 \x01(\x08\x1a*\n\x08Vertical\x12\x0e\n\x06\x62order\x18\x01 \x01(\x08\x12\x0e\n\x06height\x18\x02 \x01(\r\x1a\x19\n\nHorizontal\x12\x0b\n\x03gap\x18\x01 \x01(\t\x1a%\n\x06\x43olumn\x12\x0e\n\x06weight\x18\x01 \x01(\x01\x12\x0b\n\x03gap\x18\x02 \x01(\t\x1aM\n\nExpandable\x12\r\n\x05label\x18\x01 \x01(\t\x12\x15\n\x08\x65xpanded\x18\x02 \x01(\x08H\x00\x88\x01\x01\x12\x0c\n\x04icon\x18\x03 \x01(\tB\x0b\n\t_expanded\x1a\x9d\x01\n\x06\x44ialog\x12\r\n\x05title\x18\x01 \x01(\t\x12\x13\n\x0b\x64ismissible\x18\x02 \x01(\x08\x12(\n\x05width\x18\x03 \x01(\x0e\x32\x19.Block.Dialog.DialogWidth\x12\x14\n\x07is_open\x18\x04 \x01(\x08H\x00\x88\x01\x01\"#\n\x0b\x44ialogWidth\x12\t\n\x05SMALL\x10\x00\x12\t\n\x05LARGE\x10\x01\x42\n\n\x08_is_open\x1a@\n\x04\x46orm\x12\x0f\n\x07\x66orm_id\x18\x01 \x01(\t\x12\x17\n\x0f\x63lear_on_submit\x18\x02 \x01(\x08\x12\x0e\n\x06\x62order\x18\x03 \x01(\x08\x1a\x0e\n\x0cTabContainer\x1a\x14\n\x03Tab\x12\r\n\x05label\x18\x01 \x01(\t\x1aU\n\x07Popover\x12\r\n\x05label\x18\x01 \x01(\t\x12\x1b\n\x13use_container_width\x18\x02 \x01(\x08\x12\x0c\n\x04help\x18\x03 \x01(\t\x12\x10\n\x08\x64isabled\x18\x04 \x01(\x08\x1a\x8d\x01\n\x0b\x43hatMessage\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06\x61vatar\x18\x02 \x01(\t\x12\x32\n\x0b\x61vatar_type\x18\x03 \x01(\x0e\x32\x1d.Block.ChatMessage.AvatarType\",\n\nAvatarType\x12\t\n\x05IMAGE\x10\x00\x12\t\n\x05\x45MOJI\x10\x01\x12\x08\n\x04ICON\x10\x02\x42\x06\n\x04typeB*\n\x1c\x63om.snowflake.apps.streamlitB\nBlockProtob\x06proto3')
17
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1bstreamlit/proto/Block.proto\"\xb2\t\n\x05\x42lock\x12#\n\x08vertical\x18\x01 \x01(\x0b\x32\x0f.Block.VerticalH\x00\x12\'\n\nhorizontal\x18\x02 \x01(\x0b\x32\x11.Block.HorizontalH\x00\x12\x1f\n\x06\x63olumn\x18\x03 \x01(\x0b\x32\r.Block.ColumnH\x00\x12\'\n\nexpandable\x18\x04 \x01(\x0b\x32\x11.Block.ExpandableH\x00\x12\x1b\n\x04\x66orm\x18\x05 \x01(\x0b\x32\x0b.Block.FormH\x00\x12,\n\rtab_container\x18\x06 \x01(\x0b\x32\x13.Block.TabContainerH\x00\x12\x19\n\x03tab\x18\x07 \x01(\x0b\x32\n.Block.TabH\x00\x12*\n\x0c\x63hat_message\x18\t \x01(\x0b\x32\x12.Block.ChatMessageH\x00\x12!\n\x07popover\x18\n \x01(\x0b\x32\x0e.Block.PopoverH\x00\x12\x1f\n\x06\x64ialog\x18\x0b \x01(\x0b\x32\r.Block.DialogH\x00\x12\x13\n\x0b\x61llow_empty\x18\x08 \x01(\x08\x1a*\n\x08Vertical\x12\x0e\n\x06\x62order\x18\x01 \x01(\x08\x12\x0e\n\x06height\x18\x02 \x01(\r\x1a\x19\n\nHorizontal\x12\x0b\n\x03gap\x18\x01 \x01(\t\x1a\x98\x01\n\x06\x43olumn\x12\x0e\n\x06weight\x18\x01 \x01(\x01\x12\x0b\n\x03gap\x18\x02 \x01(\t\x12;\n\x12vertical_alignment\x18\x03 \x01(\x0e\x32\x1f.Block.Column.VerticalAlignment\"4\n\x11VerticalAlignment\x12\x07\n\x03TOP\x10\x00\x12\n\n\x06\x43\x45NTER\x10\x01\x12\n\n\x06\x42OTTOM\x10\x02\x1aM\n\nExpandable\x12\r\n\x05label\x18\x01 \x01(\t\x12\x15\n\x08\x65xpanded\x18\x02 \x01(\x08H\x00\x88\x01\x01\x12\x0c\n\x04icon\x18\x03 \x01(\tB\x0b\n\t_expanded\x1a\x9d\x01\n\x06\x44ialog\x12\r\n\x05title\x18\x01 \x01(\t\x12\x13\n\x0b\x64ismissible\x18\x02 \x01(\x08\x12(\n\x05width\x18\x03 \x01(\x0e\x32\x19.Block.Dialog.DialogWidth\x12\x14\n\x07is_open\x18\x04 \x01(\x08H\x00\x88\x01\x01\"#\n\x0b\x44ialogWidth\x12\t\n\x05SMALL\x10\x00\x12\t\n\x05LARGE\x10\x01\x42\n\n\x08_is_open\x1a@\n\x04\x46orm\x12\x0f\n\x07\x66orm_id\x18\x01 \x01(\t\x12\x17\n\x0f\x63lear_on_submit\x18\x02 \x01(\x08\x12\x0e\n\x06\x62order\x18\x03 \x01(\x08\x1a\x0e\n\x0cTabContainer\x1a\x14\n\x03Tab\x12\r\n\x05label\x18\x01 \x01(\t\x1aU\n\x07Popover\x12\r\n\x05label\x18\x01 \x01(\t\x12\x1b\n\x13use_container_width\x18\x02 \x01(\x08\x12\x0c\n\x04help\x18\x03 \x01(\t\x12\x10\n\x08\x64isabled\x18\x04 \x01(\x08\x1a\x8d\x01\n\x0b\x43hatMessage\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0e\n\x06\x61vatar\x18\x02 \x01(\t\x12\x32\n\x0b\x61vatar_type\x18\x03 \x01(\x0e\x32\x1d.Block.ChatMessage.AvatarType\",\n\nAvatarType\x12\t\n\x05IMAGE\x10\x00\x12\t\n\x05\x45MOJI\x10\x01\x12\x08\n\x04ICON\x10\x02\x42\x06\n\x04typeB*\n\x1c\x63om.snowflake.apps.streamlitB\nBlockProtob\x06proto3')
18
18
 
19
19
  _globals = globals()
20
20
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -23,29 +23,31 @@ 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\nBlockProto'
25
25
  _globals['_BLOCK']._serialized_start=32
26
- _globals['_BLOCK']._serialized_end=1118
26
+ _globals['_BLOCK']._serialized_end=1234
27
27
  _globals['_BLOCK_VERTICAL']._serialized_start=428
28
28
  _globals['_BLOCK_VERTICAL']._serialized_end=470
29
29
  _globals['_BLOCK_HORIZONTAL']._serialized_start=472
30
30
  _globals['_BLOCK_HORIZONTAL']._serialized_end=497
31
- _globals['_BLOCK_COLUMN']._serialized_start=499
32
- _globals['_BLOCK_COLUMN']._serialized_end=536
33
- _globals['_BLOCK_EXPANDABLE']._serialized_start=538
34
- _globals['_BLOCK_EXPANDABLE']._serialized_end=615
35
- _globals['_BLOCK_DIALOG']._serialized_start=618
36
- _globals['_BLOCK_DIALOG']._serialized_end=775
37
- _globals['_BLOCK_DIALOG_DIALOGWIDTH']._serialized_start=728
38
- _globals['_BLOCK_DIALOG_DIALOGWIDTH']._serialized_end=763
39
- _globals['_BLOCK_FORM']._serialized_start=777
40
- _globals['_BLOCK_FORM']._serialized_end=841
41
- _globals['_BLOCK_TABCONTAINER']._serialized_start=843
42
- _globals['_BLOCK_TABCONTAINER']._serialized_end=857
43
- _globals['_BLOCK_TAB']._serialized_start=859
44
- _globals['_BLOCK_TAB']._serialized_end=879
45
- _globals['_BLOCK_POPOVER']._serialized_start=881
46
- _globals['_BLOCK_POPOVER']._serialized_end=966
47
- _globals['_BLOCK_CHATMESSAGE']._serialized_start=969
48
- _globals['_BLOCK_CHATMESSAGE']._serialized_end=1110
49
- _globals['_BLOCK_CHATMESSAGE_AVATARTYPE']._serialized_start=1066
50
- _globals['_BLOCK_CHATMESSAGE_AVATARTYPE']._serialized_end=1110
31
+ _globals['_BLOCK_COLUMN']._serialized_start=500
32
+ _globals['_BLOCK_COLUMN']._serialized_end=652
33
+ _globals['_BLOCK_COLUMN_VERTICALALIGNMENT']._serialized_start=600
34
+ _globals['_BLOCK_COLUMN_VERTICALALIGNMENT']._serialized_end=652
35
+ _globals['_BLOCK_EXPANDABLE']._serialized_start=654
36
+ _globals['_BLOCK_EXPANDABLE']._serialized_end=731
37
+ _globals['_BLOCK_DIALOG']._serialized_start=734
38
+ _globals['_BLOCK_DIALOG']._serialized_end=891
39
+ _globals['_BLOCK_DIALOG_DIALOGWIDTH']._serialized_start=844
40
+ _globals['_BLOCK_DIALOG_DIALOGWIDTH']._serialized_end=879
41
+ _globals['_BLOCK_FORM']._serialized_start=893
42
+ _globals['_BLOCK_FORM']._serialized_end=957
43
+ _globals['_BLOCK_TABCONTAINER']._serialized_start=959
44
+ _globals['_BLOCK_TABCONTAINER']._serialized_end=973
45
+ _globals['_BLOCK_TAB']._serialized_start=975
46
+ _globals['_BLOCK_TAB']._serialized_end=995
47
+ _globals['_BLOCK_POPOVER']._serialized_start=997
48
+ _globals['_BLOCK_POPOVER']._serialized_end=1082
49
+ _globals['_BLOCK_CHATMESSAGE']._serialized_start=1085
50
+ _globals['_BLOCK_CHATMESSAGE']._serialized_end=1226
51
+ _globals['_BLOCK_CHATMESSAGE_AVATARTYPE']._serialized_start=1182
52
+ _globals['_BLOCK_CHATMESSAGE_AVATARTYPE']._serialized_end=1226
51
53
  # @@protoc_insertion_point(module_scope)
@@ -69,17 +69,35 @@ class Block(google.protobuf.message.Message):
69
69
  class Column(google.protobuf.message.Message):
70
70
  DESCRIPTOR: google.protobuf.descriptor.Descriptor
71
71
 
72
+ class _VerticalAlignment:
73
+ ValueType = typing.NewType("ValueType", builtins.int)
74
+ V: typing_extensions.TypeAlias = ValueType
75
+
76
+ class _VerticalAlignmentEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[Block.Column._VerticalAlignment.ValueType], builtins.type):
77
+ DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
78
+ TOP: Block.Column._VerticalAlignment.ValueType # 0
79
+ CENTER: Block.Column._VerticalAlignment.ValueType # 1
80
+ BOTTOM: Block.Column._VerticalAlignment.ValueType # 2
81
+
82
+ class VerticalAlignment(_VerticalAlignment, metaclass=_VerticalAlignmentEnumTypeWrapper): ...
83
+ TOP: Block.Column.VerticalAlignment.ValueType # 0
84
+ CENTER: Block.Column.VerticalAlignment.ValueType # 1
85
+ BOTTOM: Block.Column.VerticalAlignment.ValueType # 2
86
+
72
87
  WEIGHT_FIELD_NUMBER: builtins.int
73
88
  GAP_FIELD_NUMBER: builtins.int
89
+ VERTICAL_ALIGNMENT_FIELD_NUMBER: builtins.int
74
90
  weight: builtins.float
75
91
  gap: builtins.str
92
+ vertical_alignment: global___Block.Column.VerticalAlignment.ValueType
76
93
  def __init__(
77
94
  self,
78
95
  *,
79
96
  weight: builtins.float = ...,
80
97
  gap: builtins.str = ...,
98
+ vertical_alignment: global___Block.Column.VerticalAlignment.ValueType = ...,
81
99
  ) -> None: ...
82
- def ClearField(self, field_name: typing.Literal["gap", b"gap", "weight", b"weight"]) -> None: ...
100
+ def ClearField(self, field_name: typing.Literal["gap", b"gap", "vertical_alignment", b"vertical_alignment", "weight", b"weight"]) -> None: ...
83
101
 
84
102
  @typing.final
85
103
  class Expandable(google.protobuf.message.Message):
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "files": {
3
3
  "main.css": "./static/css/main.3aaaea00.css",
4
- "main.js": "./static/js/main.dc75074b.js",
4
+ "main.js": "./static/js/main.0ebf040e.js",
5
5
  "static/js/9336.3e046ad7.chunk.js": "./static/js/9336.3e046ad7.chunk.js",
6
6
  "static/js/9330.2b4c99e0.chunk.js": "./static/js/9330.2b4c99e0.chunk.js",
7
7
  "static/js/2736.4336e2b9.chunk.js": "./static/js/2736.4336e2b9.chunk.js",
@@ -24,7 +24,7 @@
24
24
  "static/js/3513.7dedbda2.chunk.js": "./static/js/3513.7dedbda2.chunk.js",
25
25
  "static/js/7602.a20a999b.chunk.js": "./static/js/7602.a20a999b.chunk.js",
26
26
  "static/js/6013.f6083314.chunk.js": "./static/js/6013.f6083314.chunk.js",
27
- "static/js/8492.8ad745d1.chunk.js": "./static/js/8492.8ad745d1.chunk.js",
27
+ "static/js/4335.b492cdb7.chunk.js": "./static/js/4335.b492cdb7.chunk.js",
28
28
  "static/js/4177.69f9f18d.chunk.js": "./static/js/4177.69f9f18d.chunk.js",
29
29
  "static/js/1451.229b62c4.chunk.js": "./static/js/1451.229b62c4.chunk.js",
30
30
  "static/js/2634.1249dc7a.chunk.js": "./static/js/2634.1249dc7a.chunk.js",
@@ -151,6 +151,6 @@
151
151
  },
152
152
  "entrypoints": [
153
153
  "static/css/main.3aaaea00.css",
154
- "static/js/main.dc75074b.js"
154
+ "static/js/main.0ebf040e.js"
155
155
  ]
156
156
  }
@@ -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.dc75074b.js"></script><link href="./static/css/main.3aaaea00.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.0ebf040e.js"></script><link href="./static/css/main.3aaaea00.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[8492],{28492:(e,t,o)=>{o.r(t),o.d(t,{default:()=>N});var r=o(66845),i=o(25621),n=o(50641),a=o(80318),l=o(80745);function s(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function c(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?s(Object(o),!0).forEach((function(t){d(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):s(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function d(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function u(e){var t=e.$disabled,o=e.$checked,r=e.$isIndeterminate,i=e.$error,n=e.$isHovered,a=e.$isActive,l=e.$theme.colors;return t?o||r?l.tickFillDisabled:l.tickFill:i&&(r||o)?a?l.tickFillErrorSelectedHoverActive:n?l.tickFillErrorSelectedHover:l.tickFillErrorSelected:i?a?l.tickFillErrorHoverActive:n?l.tickFillErrorHover:l.tickFillError:r||o?a?l.tickFillSelectedHoverActive:n?l.tickFillSelectedHover:l.tickFillSelected:a?l.tickFillActive:n?l.tickFillHover:l.tickFill}function p(e){var t=e.$disabled,o=e.$theme.colors;return t?o.contentSecondary:o.contentPrimary}var h=(0,l.zo)("label",(function(e){var t=e.$disabled,o=e.$labelPlacement;return{flexDirection:"top"===o||"bottom"===o?"column":"row",display:"flex",alignItems:"top"===o||"bottom"===o?"center":"flex-start",cursor:t?"not-allowed":"pointer",userSelect:"none"}}));h.displayName="Root",h.displayName="Root";var m=(0,l.zo)("span",(function(e){var t=e.$checked,o=e.$disabled,r=e.$error,i=e.$isIndeterminate,n=e.$theme,a=e.$isFocusVisible,l=n.sizing,s=n.animation,c=o?n.colors.tickMarkFillDisabled:r?n.colors.tickMarkFillError:n.colors.tickMarkFill,d=encodeURIComponent('\n <svg width="14" height="4" viewBox="0 0 14 4" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M14 0.5H0V3.5H14V0.5Z" fill="'.concat(c,'"/>\n </svg>\n ')),p=encodeURIComponent('\n <svg width="17" height="13" viewBox="0 0 17 13" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M6.50002 12.6L0.400024 6.60002L2.60002 4.40002L6.50002 8.40002L13.9 0.900024L16.1 3.10002L6.50002 12.6Z" fill="'.concat(c,'"/>\n </svg>\n ')),h=n.borders.checkboxBorderRadius,m=function(e){var t=e.$disabled,o=e.$checked,r=e.$error,i=e.$isIndeterminate,n=e.$theme,a=e.$isFocusVisible,l=n.colors;return t?l.tickFillDisabled:o||i?"transparent":r?l.borderNegative:a?l.borderSelected:l.tickBorder}(e);return{flex:"0 0 auto",transitionDuration:s.timing200,transitionTimingFunction:s.easeOutCurve,transitionProperty:"background-image, border-color, background-color",width:l.scale700,height:l.scale700,left:"4px",top:"4px",boxSizing:"border-box",borderLeftStyle:"solid",borderRightStyle:"solid",borderTopStyle:"solid",borderBottomStyle:"solid",borderLeftWidth:"3px",borderRightWidth:"3px",borderTopWidth:"3px",borderBottomWidth:"3px",borderLeftColor:m,borderRightColor:m,borderTopColor:m,borderBottomColor:m,borderTopLeftRadius:h,borderTopRightRadius:h,borderBottomRightRadius:h,borderBottomLeftRadius:h,outline:a&&t?"3px solid ".concat(n.colors.accent):"none",display:"inline-block",verticalAlign:"middle",backgroundImage:i?"url('data:image/svg+xml,".concat(d,"');"):t?"url('data:image/svg+xml,".concat(p,"');"):null,backgroundColor:u(e),backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"contain",marginTop:n.sizing.scale0,marginBottom:n.sizing.scale0,marginLeft:n.sizing.scale0,marginRight:n.sizing.scale0}}));m.displayName="Checkmark",m.displayName="Checkmark";var g=(0,l.zo)("div",(function(e){var t=e.$theme.typography;return c(c(c({verticalAlign:"middle"},function(e){var t,o=e.$labelPlacement,r=void 0===o?"":o,i=e.$theme,n=i.sizing.scale300;switch(r){case"top":t="Bottom";break;case"bottom":t="Top";break;case"left":t="Right";break;default:t="Left"}return"rtl"===i.direction&&"Left"===t?t="Right":"rtl"===i.direction&&"Right"===t&&(t="Left"),d({},"padding".concat(t),n)}(e)),{},{color:p(e)},t.LabelMedium),{},{lineHeight:"24px"})}));g.displayName="Label",g.displayName="Label";var b=(0,l.zo)("input",{opacity:0,width:0,height:0,overflow:"hidden",margin:0,padding:0,position:"absolute"});b.displayName="Input",b.displayName="Input";var f=(0,l.zo)("div",(function(e){var t=e.$theme.colors.toggleFill;return e.$disabled?t=e.$theme.colors.toggleFillDisabled:e.$checked&&e.$error?t=e.$theme.colors.tickFillErrorSelected:e.$checked&&(t=e.$theme.colors.toggleFillChecked),{backgroundColor:t,borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible?"0 0 0 3px ".concat(e.$theme.colors.accent):e.$isHovered&&!e.$disabled?e.$theme.lighting.shadow500:e.$theme.lighting.shadow400,outline:"none",height:e.$theme.sizing.scale700,width:e.$theme.sizing.scale700,transform:e.$checked?"translateX(".concat("rtl"===e.$theme.direction?"-100%":"100%",")"):null,transition:"transform ".concat(e.$theme.animation.timing200)}}));f.displayName="Toggle",f.displayName="Toggle";var v=(0,l.zo)("div",(function(e){var t=e.$theme.colors.toggleTrackFill;return e.$disabled?t=e.$theme.colors.toggleTrackFillDisabled:e.$error&&e.$checked&&(t=e.$theme.colors.tickFillError),{alignItems:"center",backgroundColor:t,borderTopLeftRadius:"7px",borderTopRightRadius:"7px",borderBottomRightRadius:"7px",borderBottomLeftRadius:"7px",display:"flex",height:e.$theme.sizing.scale550,marginTop:e.$theme.sizing.scale200,marginBottom:e.$theme.sizing.scale100,marginLeft:e.$theme.sizing.scale200,marginRight:e.$theme.sizing.scale100,width:e.$theme.sizing.scale1000}}));v.displayName="ToggleTrack",v.displayName="ToggleTrack";var y=Object.freeze({default:"default",toggle:"toggle",toggle_round:"toggle"}),k=Object.freeze({top:"top",right:"right",bottom:"bottom",left:"left"}),$=o(17964);function w(e){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(e)}function F(){return F=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},F.apply(this,arguments)}function x(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function R(e,t){return R=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},R(e,t)}function C(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var o,r=L(e);if(t){var i=L(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return function(e,t){if(t&&("object"===w(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return T(e)}(this,o)}}function T(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function L(e){return L=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},L(e)}function O(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var S=function(e){return e.stopPropagation()},P=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&R(e,t)}(l,e);var t,o,i,n=C(l);function l(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l);for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return O(T(e=n.call.apply(n,[this].concat(o))),"state",{isFocused:e.props.autoFocus||!1,isFocusVisible:!1,isHovered:!1,isActive:!1}),O(T(e),"onMouseEnter",(function(t){e.setState({isHovered:!0}),e.props.onMouseEnter(t)})),O(T(e),"onMouseLeave",(function(t){e.setState({isHovered:!1,isActive:!1}),e.props.onMouseLeave(t)})),O(T(e),"onMouseDown",(function(t){e.setState({isActive:!0}),e.props.onMouseDown(t)})),O(T(e),"onMouseUp",(function(t){e.setState({isActive:!1}),e.props.onMouseUp(t)})),O(T(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t),(0,$.E)(t)&&e.setState({isFocusVisible:!0})})),O(T(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t),!1!==e.state.isFocusVisible&&e.setState({isFocusVisible:!1})})),e}return t=l,(o=[{key:"componentDidMount",value:function(){var e=this.props,t=e.autoFocus,o=e.inputRef;t&&o.current&&o.current.focus()}},{key:"render",value:function(){var e=this.props,t=e.overrides,o=void 0===t?{}:t,i=e.onChange,n=e.labelPlacement,l=void 0===n?this.props.checkmarkType===y.toggle?"left":"right":n,s=e.inputRef,c=e.isIndeterminate,d=e.error,u=e.disabled,p=e.value,k=e.name,$=e.type,w=e.checked,x=e.children,R=e.required,C=e.title,T=o.Root,L=o.Checkmark,O=o.Label,P=o.Input,M=o.Toggle,j=o.ToggleTrack,B=(0,a.XG)(T)||h,E=(0,a.XG)(L)||m,H=(0,a.XG)(O)||g,I=(0,a.XG)(P)||b,V=(0,a.XG)(M)||f,W=(0,a.XG)(j)||v,z={onChange:i,onFocus:this.onFocus,onBlur:this.onBlur},D={onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},A={$isFocused:this.state.isFocused,$isFocusVisible:this.state.isFocusVisible,$isHovered:this.state.isHovered,$isActive:this.state.isActive,$error:d,$checked:w,$isIndeterminate:c,$required:R,$disabled:u,$value:p},U=x&&r.createElement(H,F({$labelPlacement:l},A,(0,a.ch)(O)),this.props.containsInteractiveElement?r.createElement("div",{onClick:function(e){return e.preventDefault()}},x):x);return r.createElement(B,F({"data-baseweb":"checkbox",title:C||null,$labelPlacement:l},A,D,(0,a.ch)(T)),("top"===l||"left"===l)&&U,this.props.checkmarkType===y.toggle?r.createElement(W,F({},A,(0,a.ch)(j)),r.createElement(V,F({},A,(0,a.ch)(M)))):r.createElement(E,F({},A,(0,a.ch)(L))),r.createElement(I,F({value:p,name:k,checked:w,required:R,"aria-label":this.props["aria-label"]||this.props.ariaLabel,"aria-checked":c?"mixed":w,"aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":d||null,"aria-required":R||null,disabled:u,type:$,ref:s,onClick:S},A,z,(0,a.ch)(P))),("bottom"===l||"right"===l)&&U)}}])&&x(t.prototype,o),i&&x(t,i),Object.defineProperty(t,"prototype",{writable:!1}),l}(r.Component);O(P,"defaultProps",{overrides:{},checked:!1,containsInteractiveElement:!1,disabled:!1,autoFocus:!1,isIndeterminate:!1,inputRef:r.createRef(),error:!1,type:"checkbox",checkmarkType:y.default,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});const M=P;var j=o(16295),B=o(35704),E=o(87814),H=o(27466),I=o(8879),V=o(68411),W=o(86659),z=o(63730);const D=(0,o(1515).Z)("div",{target:"edwcd610"})((e=>{let{visibility:t}=e;return{display:t===n.Ws.Collapsed?"none":"flex",visibility:t===n.Ws.Hidden?"hidden":"visible",verticalAlign:"middle",flexDirection:"row",alignItems:"center"}}),"");var A=o(40864);class U extends r.PureComponent{constructor(){super(...arguments),this.formClearHelper=new E.K,this.state={value:this.initialValue},this.commitWidgetValue=e=>{const{widgetMgr:t,element:o,fragmentId:r}=this.props;t.setBoolValue(o,this.state.value,e,r)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.onChange=e=>{const t=e.target.checked;this.setState({value:t},(()=>this.commitWidgetValue({fromUi:!0})))}}get initialValue(){const e=this.props.widgetMgr.getBoolValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}render(){var e;const{theme:t,width:o,element:r,disabled:i,widgetMgr:a}=this.props,{colors:l,spacing:s,sizes:c}=t,d=(0,H.Iy)(t),u={width:o},p=i?l.fadedText40:l.bodyText;return this.formClearHelper.manageFormClearListener(a,r.formId,this.onFormCleared),(0,A.jsx)("div",{className:"row-widget stCheckbox","data-testid":"stCheckbox",style:u,children:(0,A.jsx)(M,{checked:this.state.value,disabled:i,onChange:this.onChange,"aria-label":r.label,checkmarkType:r.type===j.XZ.StyleType.TOGGLE?y.toggle:y.default,labelPlacement:k.right,overrides:{Root:{style:e=>{let{$isFocusVisible:t}=e;return{marginBottom:0,marginTop:0,paddingRight:s.twoThirdsSmFont,backgroundColor:t?l.darkenedBgMix25:"",display:"flex",alignItems:"start"}}},Toggle:{style:e=>{let{$checked:t}=e,o=d?l.bgColor:l.bodyText;return i&&(o=d?l.gray70:l.gray90),{width:"12px",height:"12px",transform:t?"translateX(16px)":"",backgroundColor:o,boxShadow:""}}},ToggleTrack:{style:e=>{let{$checked:o,$isHovered:r}=e,n=l.fadedText40;return r&&!i&&(n=l.fadedText20),o&&!i&&(n=l.primary),{marginRight:0,marginLeft:0,paddingLeft:"2px",paddingRight:"2px",width:"32px",minWidth:"32px",height:"16px",minHeight:"16px",borderBottomLeftRadius:t.radii.lg,borderTopLeftRadius:t.radii.lg,borderBottomRightRadius:t.radii.lg,borderTopRightRadius:t.radii.lg,backgroundColor:n}}},Checkmark:{style:e=>{let{$isFocusVisible:t,$checked:o}=e;const r=o&&!i?l.primary:l.fadedText40;return{outline:0,width:"1rem",height:"1rem",marginTop:"0.30rem",marginLeft:0,boxShadow:t&&o?"0 0 0 0.2rem ".concat((0,B.DZ)(l.primary,.5)):"",borderLeftWidth:c.borderWidth,borderRightWidth:c.borderWidth,borderTopWidth:c.borderWidth,borderBottomWidth:c.borderWidth,borderLeftColor:r,borderRightColor:r,borderTopColor:r,borderBottomColor:r}}},Label:{style:{position:"relative",top:"1px",color:p}}},children:(0,A.jsxs)(D,{visibility:(0,n.iF)(null===(e=r.labelVisibility)||void 0===e?void 0:e.value),"data-testid":"stWidgetLabel",children:[(0,A.jsx)(z.ZP,{source:r.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),r.help&&(0,A.jsx)(W.Hp,{color:p,children:(0,A.jsx)(I.Z,{content:r.help,placement:V.u.TOP_RIGHT})})]})})})}}const N=(0,i.b)(U)},87814:(e,t,o)=>{o.d(t,{K:()=>i});var r=o(50641);class i{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,o){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,r.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,o),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}}}]);
1
+ "use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[4335],{94335:(e,t,o)=>{o.r(t),o.d(t,{default:()=>N});var r=o(66845),i=o(25621),n=o(50641),a=o(80318),l=o(80745);function s(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function c(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?s(Object(o),!0).forEach((function(t){d(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):s(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function d(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function u(e){var t=e.$disabled,o=e.$checked,r=e.$isIndeterminate,i=e.$error,n=e.$isHovered,a=e.$isActive,l=e.$theme.colors;return t?o||r?l.tickFillDisabled:l.tickFill:i&&(r||o)?a?l.tickFillErrorSelectedHoverActive:n?l.tickFillErrorSelectedHover:l.tickFillErrorSelected:i?a?l.tickFillErrorHoverActive:n?l.tickFillErrorHover:l.tickFillError:r||o?a?l.tickFillSelectedHoverActive:n?l.tickFillSelectedHover:l.tickFillSelected:a?l.tickFillActive:n?l.tickFillHover:l.tickFill}function p(e){var t=e.$disabled,o=e.$theme.colors;return t?o.contentSecondary:o.contentPrimary}var h=(0,l.zo)("label",(function(e){var t=e.$disabled,o=e.$labelPlacement;return{flexDirection:"top"===o||"bottom"===o?"column":"row",display:"flex",alignItems:"top"===o||"bottom"===o?"center":"flex-start",cursor:t?"not-allowed":"pointer",userSelect:"none"}}));h.displayName="Root",h.displayName="Root";var m=(0,l.zo)("span",(function(e){var t=e.$checked,o=e.$disabled,r=e.$error,i=e.$isIndeterminate,n=e.$theme,a=e.$isFocusVisible,l=n.sizing,s=n.animation,c=o?n.colors.tickMarkFillDisabled:r?n.colors.tickMarkFillError:n.colors.tickMarkFill,d=encodeURIComponent('\n <svg width="14" height="4" viewBox="0 0 14 4" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M14 0.5H0V3.5H14V0.5Z" fill="'.concat(c,'"/>\n </svg>\n ')),p=encodeURIComponent('\n <svg width="17" height="13" viewBox="0 0 17 13" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M6.50002 12.6L0.400024 6.60002L2.60002 4.40002L6.50002 8.40002L13.9 0.900024L16.1 3.10002L6.50002 12.6Z" fill="'.concat(c,'"/>\n </svg>\n ')),h=n.borders.checkboxBorderRadius,m=function(e){var t=e.$disabled,o=e.$checked,r=e.$error,i=e.$isIndeterminate,n=e.$theme,a=e.$isFocusVisible,l=n.colors;return t?l.tickFillDisabled:o||i?"transparent":r?l.borderNegative:a?l.borderSelected:l.tickBorder}(e);return{flex:"0 0 auto",transitionDuration:s.timing200,transitionTimingFunction:s.easeOutCurve,transitionProperty:"background-image, border-color, background-color",width:l.scale700,height:l.scale700,left:"4px",top:"4px",boxSizing:"border-box",borderLeftStyle:"solid",borderRightStyle:"solid",borderTopStyle:"solid",borderBottomStyle:"solid",borderLeftWidth:"3px",borderRightWidth:"3px",borderTopWidth:"3px",borderBottomWidth:"3px",borderLeftColor:m,borderRightColor:m,borderTopColor:m,borderBottomColor:m,borderTopLeftRadius:h,borderTopRightRadius:h,borderBottomRightRadius:h,borderBottomLeftRadius:h,outline:a&&t?"3px solid ".concat(n.colors.accent):"none",display:"inline-block",verticalAlign:"middle",backgroundImage:i?"url('data:image/svg+xml,".concat(d,"');"):t?"url('data:image/svg+xml,".concat(p,"');"):null,backgroundColor:u(e),backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"contain",marginTop:n.sizing.scale0,marginBottom:n.sizing.scale0,marginLeft:n.sizing.scale0,marginRight:n.sizing.scale0}}));m.displayName="Checkmark",m.displayName="Checkmark";var g=(0,l.zo)("div",(function(e){var t=e.$theme.typography;return c(c(c({verticalAlign:"middle"},function(e){var t,o=e.$labelPlacement,r=void 0===o?"":o,i=e.$theme,n=i.sizing.scale300;switch(r){case"top":t="Bottom";break;case"bottom":t="Top";break;case"left":t="Right";break;default:t="Left"}return"rtl"===i.direction&&"Left"===t?t="Right":"rtl"===i.direction&&"Right"===t&&(t="Left"),d({},"padding".concat(t),n)}(e)),{},{color:p(e)},t.LabelMedium),{},{lineHeight:"24px"})}));g.displayName="Label",g.displayName="Label";var b=(0,l.zo)("input",{opacity:0,width:0,height:0,overflow:"hidden",margin:0,padding:0,position:"absolute"});b.displayName="Input",b.displayName="Input";var f=(0,l.zo)("div",(function(e){var t=e.$theme.colors.toggleFill;return e.$disabled?t=e.$theme.colors.toggleFillDisabled:e.$checked&&e.$error?t=e.$theme.colors.tickFillErrorSelected:e.$checked&&(t=e.$theme.colors.toggleFillChecked),{backgroundColor:t,borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible?"0 0 0 3px ".concat(e.$theme.colors.accent):e.$isHovered&&!e.$disabled?e.$theme.lighting.shadow500:e.$theme.lighting.shadow400,outline:"none",height:e.$theme.sizing.scale700,width:e.$theme.sizing.scale700,transform:e.$checked?"translateX(".concat("rtl"===e.$theme.direction?"-100%":"100%",")"):null,transition:"transform ".concat(e.$theme.animation.timing200)}}));f.displayName="Toggle",f.displayName="Toggle";var v=(0,l.zo)("div",(function(e){var t=e.$theme.colors.toggleTrackFill;return e.$disabled?t=e.$theme.colors.toggleTrackFillDisabled:e.$error&&e.$checked&&(t=e.$theme.colors.tickFillError),{alignItems:"center",backgroundColor:t,borderTopLeftRadius:"7px",borderTopRightRadius:"7px",borderBottomRightRadius:"7px",borderBottomLeftRadius:"7px",display:"flex",height:e.$theme.sizing.scale550,marginTop:e.$theme.sizing.scale200,marginBottom:e.$theme.sizing.scale100,marginLeft:e.$theme.sizing.scale200,marginRight:e.$theme.sizing.scale100,width:e.$theme.sizing.scale1000}}));v.displayName="ToggleTrack",v.displayName="ToggleTrack";var y=Object.freeze({default:"default",toggle:"toggle",toggle_round:"toggle"}),k=Object.freeze({top:"top",right:"right",bottom:"bottom",left:"left"}),$=o(17964);function w(e){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(e)}function F(){return F=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},F.apply(this,arguments)}function x(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function R(e,t){return R=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},R(e,t)}function T(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var o,r=L(e);if(t){var i=L(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return function(e,t){if(t&&("object"===w(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return C(e)}(this,o)}}function C(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function L(e){return L=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},L(e)}function O(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var P=function(e){return e.stopPropagation()},S=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&R(e,t)}(l,e);var t,o,i,n=T(l);function l(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l);for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return O(C(e=n.call.apply(n,[this].concat(o))),"state",{isFocused:e.props.autoFocus||!1,isFocusVisible:!1,isHovered:!1,isActive:!1}),O(C(e),"onMouseEnter",(function(t){e.setState({isHovered:!0}),e.props.onMouseEnter(t)})),O(C(e),"onMouseLeave",(function(t){e.setState({isHovered:!1,isActive:!1}),e.props.onMouseLeave(t)})),O(C(e),"onMouseDown",(function(t){e.setState({isActive:!0}),e.props.onMouseDown(t)})),O(C(e),"onMouseUp",(function(t){e.setState({isActive:!1}),e.props.onMouseUp(t)})),O(C(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t),(0,$.E)(t)&&e.setState({isFocusVisible:!0})})),O(C(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t),!1!==e.state.isFocusVisible&&e.setState({isFocusVisible:!1})})),e}return t=l,(o=[{key:"componentDidMount",value:function(){var e=this.props,t=e.autoFocus,o=e.inputRef;t&&o.current&&o.current.focus()}},{key:"render",value:function(){var e=this.props,t=e.overrides,o=void 0===t?{}:t,i=e.onChange,n=e.labelPlacement,l=void 0===n?this.props.checkmarkType===y.toggle?"left":"right":n,s=e.inputRef,c=e.isIndeterminate,d=e.error,u=e.disabled,p=e.value,k=e.name,$=e.type,w=e.checked,x=e.children,R=e.required,T=e.title,C=o.Root,L=o.Checkmark,O=o.Label,S=o.Input,M=o.Toggle,j=o.ToggleTrack,B=(0,a.XG)(C)||h,E=(0,a.XG)(L)||m,H=(0,a.XG)(O)||g,V=(0,a.XG)(S)||b,z=(0,a.XG)(M)||f,I=(0,a.XG)(j)||v,W={onChange:i,onFocus:this.onFocus,onBlur:this.onBlur},D={onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},U={$isFocused:this.state.isFocused,$isFocusVisible:this.state.isFocusVisible,$isHovered:this.state.isHovered,$isActive:this.state.isActive,$error:d,$checked:w,$isIndeterminate:c,$required:R,$disabled:u,$value:p},A=x&&r.createElement(H,F({$labelPlacement:l},U,(0,a.ch)(O)),this.props.containsInteractiveElement?r.createElement("div",{onClick:function(e){return e.preventDefault()}},x):x);return r.createElement(B,F({"data-baseweb":"checkbox",title:T||null,$labelPlacement:l},U,D,(0,a.ch)(C)),("top"===l||"left"===l)&&A,this.props.checkmarkType===y.toggle?r.createElement(I,F({},U,(0,a.ch)(j)),r.createElement(z,F({},U,(0,a.ch)(M)))):r.createElement(E,F({},U,(0,a.ch)(L))),r.createElement(V,F({value:p,name:k,checked:w,required:R,"aria-label":this.props["aria-label"]||this.props.ariaLabel,"aria-checked":c?"mixed":w,"aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":d||null,"aria-required":R||null,disabled:u,type:$,ref:s,onClick:P},U,W,(0,a.ch)(S))),("bottom"===l||"right"===l)&&A)}}])&&x(t.prototype,o),i&&x(t,i),Object.defineProperty(t,"prototype",{writable:!1}),l}(r.Component);O(S,"defaultProps",{overrides:{},checked:!1,containsInteractiveElement:!1,disabled:!1,autoFocus:!1,isIndeterminate:!1,inputRef:r.createRef(),error:!1,type:"checkbox",checkmarkType:y.default,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});const M=S;var j=o(16295),B=o(35704),E=o(87814),H=o(27466),V=o(8879),z=o(68411),I=o(86659),W=o(63730),D=o(86977),U=o(40864);class A extends r.PureComponent{constructor(){super(...arguments),this.formClearHelper=new E.K,this.state={value:this.initialValue},this.commitWidgetValue=e=>{const{widgetMgr:t,element:o,fragmentId:r}=this.props;t.setBoolValue(o,this.state.value,e,r)},this.onFormCleared=()=>{this.setState(((e,t)=>({value:t.element.default})),(()=>this.commitWidgetValue({fromUi:!0})))},this.onChange=e=>{const t=e.target.checked;this.setState({value:t},(()=>this.commitWidgetValue({fromUi:!0})))}}get initialValue(){const e=this.props.widgetMgr.getBoolValue(this.props.element);return void 0!==e?e:this.props.element.default}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:e}=this.props.element;e&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:e}=this.props.element;this.props.element.setValue=!1,this.setState({value:e},(()=>{this.commitWidgetValue({fromUi:!1})}))}render(){var e;const{theme:t,width:o,element:r,disabled:i,widgetMgr:a}=this.props,{colors:l,spacing:s,sizes:c}=t,d=(0,H.Iy)(t),u=i?l.fadedText40:l.bodyText;return this.formClearHelper.manageFormClearListener(a,r.formId,this.onFormCleared),(0,U.jsx)(D.P,{className:"row-widget stCheckbox","data-testid":"stCheckbox",width:o,children:(0,U.jsx)(M,{checked:this.state.value,disabled:i,onChange:this.onChange,"aria-label":r.label,checkmarkType:r.type===j.XZ.StyleType.TOGGLE?y.toggle:y.default,labelPlacement:k.right,overrides:{Root:{style:e=>{let{$isFocusVisible:t}=e;return{marginBottom:0,marginTop:0,paddingRight:s.twoThirdsSmFont,backgroundColor:t?l.darkenedBgMix25:"",display:"flex",alignItems:"start"}}},Toggle:{style:e=>{let{$checked:t}=e,o=d?l.bgColor:l.bodyText;return i&&(o=d?l.gray70:l.gray90),{width:"12px",height:"12px",transform:t?"translateX(16px)":"",backgroundColor:o,boxShadow:""}}},ToggleTrack:{style:e=>{let{$checked:o,$isHovered:r}=e,n=l.fadedText40;return r&&!i&&(n=l.fadedText20),o&&!i&&(n=l.primary),{marginRight:0,marginLeft:0,paddingLeft:"2px",paddingRight:"2px",width:"32px",minWidth:"32px",height:"16px",minHeight:"16px",borderBottomLeftRadius:t.radii.lg,borderTopLeftRadius:t.radii.lg,borderBottomRightRadius:t.radii.lg,borderTopRightRadius:t.radii.lg,backgroundColor:n}}},Checkmark:{style:e=>{let{$isFocusVisible:t,$checked:o}=e;const r=o&&!i?l.primary:l.fadedText40;return{outline:0,width:"1rem",height:"1rem",marginTop:"0.30rem",marginLeft:0,boxShadow:t&&o?"0 0 0 0.2rem ".concat((0,B.DZ)(l.primary,.5)):"",borderLeftWidth:c.borderWidth,borderRightWidth:c.borderWidth,borderTopWidth:c.borderWidth,borderBottomWidth:c.borderWidth,borderLeftColor:r,borderRightColor:r,borderTopColor:r,borderBottomColor:r}}},Label:{style:{position:"relative",top:"1px",color:u}}},children:(0,U.jsxs)(D.H,{visibility:(0,n.iF)(null===(e=r.labelVisibility)||void 0===e?void 0:e.value),"data-testid":"stWidgetLabel",children:[(0,U.jsx)(W.ZP,{source:r.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),r.help&&(0,U.jsx)(I.Hp,{color:u,children:(0,U.jsx)(V.Z,{content:r.help,placement:z.u.TOP_RIGHT})})]})})})}}const N=(0,i.b)(A)},87814:(e,t,o)=>{o.d(t,{K:()=>i});var r=o(50641);class i{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,o){null!=this.formClearListener&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,r.bM)(t)&&(this.formClearListener=e.addFormClearedListener(t,o),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}}}]);