streamlit-nightly 1.21.1.dev20230424__py2.py3-none-any.whl → 1.21.1.dev20230425__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.
- streamlit/__init__.py +0 -7
- streamlit/elements/data_editor.py +104 -96
- streamlit/elements/file_uploader.py +17 -0
- streamlit/elements/layouts.py +0 -5
- streamlit/elements/lib/column_config_utils.py +371 -0
- streamlit/static/asset-manifest.json +20 -20
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{14.a19a6cd8.chunk.js → 14.9399e424.chunk.js} +1 -1
- streamlit/static/static/js/{227.087adf66.chunk.js → 227.9ccac1d5.chunk.js} +1 -1
- streamlit/static/static/js/{242.0daf8b47.chunk.js → 242.1b3289e0.chunk.js} +1 -1
- streamlit/static/static/js/{279.fdac58fc.chunk.js → 279.35b01780.chunk.js} +1 -1
- streamlit/static/static/js/{289.481fd42d.chunk.js → 289.e6157e40.chunk.js} +1 -1
- streamlit/static/static/js/{467.242e14ff.chunk.js → 467.50ac84df.chunk.js} +1 -1
- streamlit/static/static/js/{491.d0b710e9.chunk.js → 491.5a33a8ce.chunk.js} +1 -1
- streamlit/static/static/js/503.15864587.chunk.js +1 -0
- streamlit/static/static/js/{511.9f04ae9e.chunk.js → 511.e6ca580f.chunk.js} +1 -1
- streamlit/static/static/js/{578.ceaadcd5.chunk.js → 578.a65fcea0.chunk.js} +1 -1
- streamlit/static/static/js/{619.365611c8.chunk.js → 619.0325af0e.chunk.js} +1 -1
- streamlit/static/static/js/{628.7f41e2de.chunk.js → 628.9c70196b.chunk.js} +1 -1
- streamlit/static/static/js/{681.a2ba76c7.chunk.js → 681.9e30a8cd.chunk.js} +1 -1
- streamlit/static/static/js/{745.e2bcf16d.chunk.js → 745.e75ba963.chunk.js} +1 -1
- streamlit/static/static/js/{807.6789990f.chunk.js → 807.122f8b05.chunk.js} +1 -1
- streamlit/static/static/js/{828.096c1ad3.chunk.js → 828.0fde3da8.chunk.js} +1 -1
- streamlit/static/static/js/{871.ba625aee.chunk.js → 871.90a7dbae.chunk.js} +1 -1
- streamlit/static/static/js/{main.e7d9d363.js → main.ff35bd72.js} +2 -2
- {streamlit_nightly-1.21.1.dev20230424.dist-info → streamlit_nightly-1.21.1.dev20230425.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.21.1.dev20230424.dist-info → streamlit_nightly-1.21.1.dev20230425.dist-info}/RECORD +33 -33
- streamlit/elements/show.py +0 -105
- streamlit/static/static/js/728.79e35e5d.chunk.js +0 -1
- /streamlit/static/static/css/{728.23fa976d.chunk.css → 503.23fa976d.chunk.css} +0 -0
- /streamlit/static/static/js/{main.e7d9d363.js.LICENSE.txt → main.ff35bd72.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.21.1.dev20230424.data → streamlit_nightly-1.21.1.dev20230425.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.21.1.dev20230424.dist-info → streamlit_nightly-1.21.1.dev20230425.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.21.1.dev20230424.dist-info → streamlit_nightly-1.21.1.dev20230425.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.21.1.dev20230424.dist-info → streamlit_nightly-1.21.1.dev20230425.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,371 @@
|
|
1
|
+
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022)
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
|
17
|
+
import json
|
18
|
+
from enum import Enum
|
19
|
+
from typing import Any, Dict, List, Optional, Union
|
20
|
+
|
21
|
+
import pandas as pd
|
22
|
+
import pyarrow as pa
|
23
|
+
from typing_extensions import Literal, TypeAlias, TypedDict
|
24
|
+
|
25
|
+
from streamlit.proto.Arrow_pb2 import Arrow as ArrowProto
|
26
|
+
|
27
|
+
# The index identifier can be used to apply configuration options
|
28
|
+
IndexIdentifierType = Literal["index"]
|
29
|
+
INDEX_IDENTIFIER: IndexIdentifierType = "index"
|
30
|
+
|
31
|
+
# This is used as prefix for columns that are configured via the numerical position.
|
32
|
+
# The integer value is converted into a string key with this prefix.
|
33
|
+
# This needs to match with the prefix configured in the frontend.
|
34
|
+
_NUMERICAL_POSITION_PREFIX = "col:"
|
35
|
+
|
36
|
+
ColumnWidth = Literal["small", "medium", "large"]
|
37
|
+
|
38
|
+
# Type alias that represents all available column types
|
39
|
+
# which are configurable by the user.
|
40
|
+
ColumnType: TypeAlias = Literal[
|
41
|
+
"object", "text", "number", "checkbox", "selectbox", "list"
|
42
|
+
]
|
43
|
+
|
44
|
+
|
45
|
+
# The column data kind is used to describe the type of the data within the column.
|
46
|
+
class ColumnDataKind(str, Enum):
|
47
|
+
INTEGER = "integer"
|
48
|
+
FLOAT = "float"
|
49
|
+
DATE = "date"
|
50
|
+
TIME = "time"
|
51
|
+
DATETIME = "datetime"
|
52
|
+
BOOLEAN = "boolean"
|
53
|
+
STRING = "string"
|
54
|
+
TIMEDELTA = "timedelta"
|
55
|
+
PERIOD = "period"
|
56
|
+
INTERVAL = "interval"
|
57
|
+
BYTES = "bytes"
|
58
|
+
DECIMAL = "decimal"
|
59
|
+
COMPLEX = "complex"
|
60
|
+
LIST = "list"
|
61
|
+
DICT = "dict"
|
62
|
+
EMPTY = "empty"
|
63
|
+
UNKNOWN = "unknown"
|
64
|
+
|
65
|
+
|
66
|
+
# The dataframe schema is just a list of column data kinds
|
67
|
+
# based on the order of the columns in the underlying dataframe.
|
68
|
+
# The index column(s) are attached at the beginning of the list.
|
69
|
+
DataframeSchema: TypeAlias = List[ColumnDataKind]
|
70
|
+
|
71
|
+
|
72
|
+
def _determine_data_kind_via_arrow(field: pa.Field) -> ColumnDataKind:
|
73
|
+
"""Determine the data kind via the arrow type information.
|
74
|
+
|
75
|
+
The column data kind refers to the shared data type of the values
|
76
|
+
in the column (e.g. integer, float, string, bool).
|
77
|
+
|
78
|
+
Parameters
|
79
|
+
----------
|
80
|
+
|
81
|
+
field : pa.Field
|
82
|
+
The arrow field from the arrow table schema.
|
83
|
+
|
84
|
+
Returns
|
85
|
+
-------
|
86
|
+
ColumnDataKind
|
87
|
+
The data kind of the field.
|
88
|
+
"""
|
89
|
+
field_type = field.type
|
90
|
+
if pa.types.is_integer(field_type):
|
91
|
+
return ColumnDataKind.INTEGER
|
92
|
+
|
93
|
+
if pa.types.is_floating(field_type):
|
94
|
+
return ColumnDataKind.FLOAT
|
95
|
+
|
96
|
+
if pa.types.is_boolean(field_type):
|
97
|
+
return ColumnDataKind.BOOLEAN
|
98
|
+
|
99
|
+
if pa.types.is_string(field_type):
|
100
|
+
return ColumnDataKind.STRING
|
101
|
+
|
102
|
+
if pa.types.is_date(field_type):
|
103
|
+
return ColumnDataKind.DATE
|
104
|
+
|
105
|
+
if pa.types.is_time(field_type):
|
106
|
+
return ColumnDataKind.TIME
|
107
|
+
|
108
|
+
if pa.types.is_timestamp(field_type):
|
109
|
+
return ColumnDataKind.DATETIME
|
110
|
+
|
111
|
+
if pa.types.is_duration(field_type):
|
112
|
+
return ColumnDataKind.TIMEDELTA
|
113
|
+
|
114
|
+
if pa.types.is_list(field_type):
|
115
|
+
return ColumnDataKind.LIST
|
116
|
+
|
117
|
+
if pa.types.is_decimal(field_type):
|
118
|
+
return ColumnDataKind.DECIMAL
|
119
|
+
|
120
|
+
if pa.types.is_null(field_type):
|
121
|
+
return ColumnDataKind.EMPTY
|
122
|
+
|
123
|
+
# Interval does not seem to work correctly:
|
124
|
+
# if pa.types.is_interval(field_type):
|
125
|
+
# return ColumnDataKind.INTERVAL
|
126
|
+
|
127
|
+
if pa.types.is_binary(field_type):
|
128
|
+
return ColumnDataKind.BYTES
|
129
|
+
|
130
|
+
if pa.types.is_struct(field_type):
|
131
|
+
return ColumnDataKind.DICT
|
132
|
+
|
133
|
+
return ColumnDataKind.UNKNOWN
|
134
|
+
|
135
|
+
|
136
|
+
def _determine_data_kind_via_pandas_dtype(
|
137
|
+
column: pd.Series | pd.Index,
|
138
|
+
) -> ColumnDataKind:
|
139
|
+
"""Determine the data kind by using the pandas dtype.
|
140
|
+
|
141
|
+
The column data kind refers to the shared data type of the values
|
142
|
+
in the column (e.g. integer, float, string, bool).
|
143
|
+
|
144
|
+
Parameters
|
145
|
+
----------
|
146
|
+
column : pd.Series, pd.Index
|
147
|
+
The column for which the data kind should be determined.
|
148
|
+
|
149
|
+
Returns
|
150
|
+
-------
|
151
|
+
ColumnDataKind
|
152
|
+
The data kind of the column.
|
153
|
+
"""
|
154
|
+
column_dtype = column.dtype
|
155
|
+
if pd.api.types.is_bool_dtype(column_dtype):
|
156
|
+
return ColumnDataKind.BOOLEAN
|
157
|
+
|
158
|
+
if pd.api.types.is_integer_dtype(column_dtype):
|
159
|
+
return ColumnDataKind.INTEGER
|
160
|
+
|
161
|
+
if pd.api.types.is_float_dtype(column_dtype):
|
162
|
+
return ColumnDataKind.FLOAT
|
163
|
+
|
164
|
+
if pd.api.types.is_datetime64_any_dtype(column_dtype):
|
165
|
+
return ColumnDataKind.DATETIME
|
166
|
+
|
167
|
+
if pd.api.types.is_timedelta64_dtype(column_dtype):
|
168
|
+
return ColumnDataKind.TIMEDELTA
|
169
|
+
|
170
|
+
if pd.api.types.is_period_dtype(column_dtype):
|
171
|
+
return ColumnDataKind.PERIOD
|
172
|
+
|
173
|
+
if pd.api.types.is_interval_dtype(column_dtype):
|
174
|
+
return ColumnDataKind.INTERVAL
|
175
|
+
|
176
|
+
if pd.api.types.is_complex_dtype(column_dtype):
|
177
|
+
return ColumnDataKind.COMPLEX
|
178
|
+
|
179
|
+
if pd.api.types.is_object_dtype(
|
180
|
+
column_dtype
|
181
|
+
) is False and pd.api.types.is_string_dtype(column_dtype):
|
182
|
+
# The is_string_dtype
|
183
|
+
return ColumnDataKind.STRING
|
184
|
+
|
185
|
+
return ColumnDataKind.UNKNOWN
|
186
|
+
|
187
|
+
|
188
|
+
def _determine_data_kind_via_inferred_type(
|
189
|
+
column: pd.Series | pd.Index,
|
190
|
+
) -> ColumnDataKind:
|
191
|
+
"""Determine the data kind by inferring it from the underlying data.
|
192
|
+
|
193
|
+
The column data kind refers to the shared data type of the values
|
194
|
+
in the column (e.g. integer, float, string, bool).
|
195
|
+
|
196
|
+
Parameters
|
197
|
+
----------
|
198
|
+
column : pd.Series, pd.Index
|
199
|
+
The column to determine the data kind for.
|
200
|
+
|
201
|
+
Returns
|
202
|
+
-------
|
203
|
+
ColumnDataKind
|
204
|
+
The data kind of the column.
|
205
|
+
"""
|
206
|
+
|
207
|
+
inferred_type = pd.api.types.infer_dtype(column)
|
208
|
+
|
209
|
+
if inferred_type == "string":
|
210
|
+
return ColumnDataKind.STRING
|
211
|
+
|
212
|
+
if inferred_type == "bytes":
|
213
|
+
return ColumnDataKind.BYTES
|
214
|
+
|
215
|
+
if inferred_type in ["floating", "mixed-integer-float"]:
|
216
|
+
return ColumnDataKind.FLOAT
|
217
|
+
|
218
|
+
if inferred_type == "integer":
|
219
|
+
return ColumnDataKind.INTEGER
|
220
|
+
|
221
|
+
if inferred_type == "decimal":
|
222
|
+
return ColumnDataKind.DECIMAL
|
223
|
+
|
224
|
+
if inferred_type == "complex":
|
225
|
+
return ColumnDataKind.COMPLEX
|
226
|
+
|
227
|
+
if inferred_type == "boolean":
|
228
|
+
return ColumnDataKind.BOOLEAN
|
229
|
+
|
230
|
+
if inferred_type in ["datetime64", "datetime"]:
|
231
|
+
return ColumnDataKind.DATETIME
|
232
|
+
|
233
|
+
if inferred_type == "date":
|
234
|
+
return ColumnDataKind.DATE
|
235
|
+
|
236
|
+
if inferred_type in ["timedelta64", "timedelta"]:
|
237
|
+
return ColumnDataKind.TIMEDELTA
|
238
|
+
|
239
|
+
if inferred_type == "time":
|
240
|
+
return ColumnDataKind.TIME
|
241
|
+
|
242
|
+
if inferred_type == "period":
|
243
|
+
return ColumnDataKind.PERIOD
|
244
|
+
|
245
|
+
if inferred_type == "interval":
|
246
|
+
return ColumnDataKind.INTERVAL
|
247
|
+
|
248
|
+
if inferred_type == "empty":
|
249
|
+
return ColumnDataKind.EMPTY
|
250
|
+
|
251
|
+
# TODO(lukasmasuch): Unused types: mixed, unknown-array, categorical, mixed-integer
|
252
|
+
return ColumnDataKind.UNKNOWN
|
253
|
+
|
254
|
+
|
255
|
+
def _determine_data_kind(
|
256
|
+
column: pd.Series | pd.Index, field: Optional[pa.Field] = None
|
257
|
+
) -> ColumnDataKind:
|
258
|
+
"""Determine the data kind of a column.
|
259
|
+
|
260
|
+
The column data kind refers to the shared data type of the values
|
261
|
+
in the column (e.g. integer, float, string, bool).
|
262
|
+
|
263
|
+
Parameters
|
264
|
+
----------
|
265
|
+
column : pd.Series, pd.Index
|
266
|
+
The column to determine the data kind for.
|
267
|
+
field : pa.Field, optional
|
268
|
+
The arrow field from the arrow table schema.
|
269
|
+
|
270
|
+
Returns
|
271
|
+
-------
|
272
|
+
ColumnDataKind
|
273
|
+
The data kind of the column.
|
274
|
+
"""
|
275
|
+
|
276
|
+
if pd.api.types.is_categorical_dtype(column.dtype):
|
277
|
+
# Categorical columns can have different underlying data kinds
|
278
|
+
# depending on the categories.
|
279
|
+
return _determine_data_kind_via_inferred_type(column.dtype.categories)
|
280
|
+
|
281
|
+
if field is not None:
|
282
|
+
data_kind = _determine_data_kind_via_arrow(field)
|
283
|
+
if data_kind != ColumnDataKind.UNKNOWN:
|
284
|
+
return data_kind
|
285
|
+
|
286
|
+
if column.dtype.name == "object":
|
287
|
+
# If dtype is object, we need to infer the type from the column
|
288
|
+
return _determine_data_kind_via_inferred_type(column)
|
289
|
+
return _determine_data_kind_via_pandas_dtype(column)
|
290
|
+
|
291
|
+
|
292
|
+
def determine_dataframe_schema(
|
293
|
+
data_df: pd.DataFrame, arrow_schema: pa.Schema
|
294
|
+
) -> DataframeSchema:
|
295
|
+
"""Determine the schema of a dataframe.
|
296
|
+
|
297
|
+
Parameters
|
298
|
+
----------
|
299
|
+
data_df : pd.DataFrame
|
300
|
+
The dataframe to determine the schema of.
|
301
|
+
arrow_schema : pa.Schema
|
302
|
+
The Arrow schema of the dataframe.
|
303
|
+
|
304
|
+
Returns
|
305
|
+
-------
|
306
|
+
|
307
|
+
DataframeSchema
|
308
|
+
A list that contains the detected data type for the index and columns.
|
309
|
+
It starts with the index and then contains the columns in the original order.
|
310
|
+
"""
|
311
|
+
|
312
|
+
dataframe_schema: DataframeSchema = []
|
313
|
+
|
314
|
+
# Add type of index:
|
315
|
+
dataframe_schema.append(_determine_data_kind(data_df.index))
|
316
|
+
|
317
|
+
# Add types for all columns:
|
318
|
+
for i, column in enumerate(data_df.items()):
|
319
|
+
_, column_data = column
|
320
|
+
dataframe_schema.append(
|
321
|
+
_determine_data_kind(column_data, arrow_schema.field(i))
|
322
|
+
)
|
323
|
+
return dataframe_schema
|
324
|
+
|
325
|
+
|
326
|
+
class ColumnConfig(TypedDict, total=False):
|
327
|
+
title: Optional[str]
|
328
|
+
width: Optional[Literal["small", "medium", "large"]]
|
329
|
+
hidden: Optional[bool]
|
330
|
+
disabled: Optional[bool]
|
331
|
+
required: Optional[bool]
|
332
|
+
alignment: Optional[Literal["left", "center", "right"]]
|
333
|
+
help: Optional[str]
|
334
|
+
type: Optional[ColumnType]
|
335
|
+
type_options: Optional[Dict[str, Any]]
|
336
|
+
|
337
|
+
|
338
|
+
# A mapping of column names/IDs to column configs.
|
339
|
+
ColumnConfigMapping: TypeAlias = Dict[Union[IndexIdentifierType, str], ColumnConfig]
|
340
|
+
|
341
|
+
|
342
|
+
def marshall_column_config(
|
343
|
+
proto: ArrowProto, column_config_mapping: ColumnConfigMapping
|
344
|
+
) -> None:
|
345
|
+
"""Marshall the column config into the Arrow proto.
|
346
|
+
|
347
|
+
Parameters
|
348
|
+
----------
|
349
|
+
proto : ArrowProto
|
350
|
+
The proto to marshall into.
|
351
|
+
|
352
|
+
column_config_mapping : ColumnConfigMapping
|
353
|
+
The column config to marshall.
|
354
|
+
"""
|
355
|
+
|
356
|
+
# Ignore all None values and prefix columns specified by numerical index
|
357
|
+
def remove_none_values(input_dict: Dict[Any, Any]) -> Dict[Any, Any]:
|
358
|
+
new_dict = {}
|
359
|
+
for key, val in input_dict.items():
|
360
|
+
if isinstance(val, dict):
|
361
|
+
val = remove_none_values(val)
|
362
|
+
if val is not None:
|
363
|
+
new_dict[key] = val
|
364
|
+
return new_dict
|
365
|
+
|
366
|
+
proto.columns = json.dumps(
|
367
|
+
{
|
368
|
+
(f"{_NUMERICAL_POSITION_PREFIX}{str(k)}" if isinstance(k, int) else k): v
|
369
|
+
for (k, v) in remove_none_values(column_config_mapping).items()
|
370
|
+
}
|
371
|
+
)
|
@@ -1,40 +1,40 @@
|
|
1
1
|
{
|
2
2
|
"files": {
|
3
3
|
"main.css": "./static/css/main.f4a8738f.css",
|
4
|
-
"main.js": "./static/js/main.
|
4
|
+
"main.js": "./static/js/main.ff35bd72.js",
|
5
5
|
"static/js/464.53a4cca5.chunk.js": "./static/js/464.53a4cca5.chunk.js",
|
6
6
|
"static/js/248.1f4c1c4f.chunk.js": "./static/js/248.1f4c1c4f.chunk.js",
|
7
7
|
"static/js/787.35855372.chunk.js": "./static/js/787.35855372.chunk.js",
|
8
8
|
"static/js/274.dc861c12.chunk.js": "./static/js/274.dc861c12.chunk.js",
|
9
|
-
"static/css/
|
10
|
-
"static/js/
|
11
|
-
"static/js/745.
|
9
|
+
"static/css/503.23fa976d.chunk.css": "./static/css/503.23fa976d.chunk.css",
|
10
|
+
"static/js/503.15864587.chunk.js": "./static/js/503.15864587.chunk.js",
|
11
|
+
"static/js/745.e75ba963.chunk.js": "./static/js/745.e75ba963.chunk.js",
|
12
12
|
"static/js/261.7064465b.chunk.js": "./static/js/261.7064465b.chunk.js",
|
13
13
|
"static/js/187.23c06ae4.chunk.js": "./static/js/187.23c06ae4.chunk.js",
|
14
|
-
"static/js/491.
|
14
|
+
"static/js/491.5a33a8ce.chunk.js": "./static/js/491.5a33a8ce.chunk.js",
|
15
15
|
"static/js/510.7a54dd75.chunk.js": "./static/js/510.7a54dd75.chunk.js",
|
16
16
|
"static/js/429.c723ecb4.chunk.js": "./static/js/429.c723ecb4.chunk.js",
|
17
17
|
"static/js/705.9a33d07f.chunk.js": "./static/js/705.9a33d07f.chunk.js",
|
18
|
-
"static/js/578.
|
18
|
+
"static/js/578.a65fcea0.chunk.js": "./static/js/578.a65fcea0.chunk.js",
|
19
19
|
"static/js/634.d0ee8e33.chunk.js": "./static/js/634.d0ee8e33.chunk.js",
|
20
20
|
"static/js/784.21b8ebe2.chunk.js": "./static/js/784.21b8ebe2.chunk.js",
|
21
21
|
"static/js/551.1570fa55.chunk.js": "./static/js/551.1570fa55.chunk.js",
|
22
22
|
"static/js/830.7f4f1060.chunk.js": "./static/js/830.7f4f1060.chunk.js",
|
23
|
-
"static/js/681.
|
24
|
-
"static/js/242.
|
23
|
+
"static/js/681.9e30a8cd.chunk.js": "./static/js/681.9e30a8cd.chunk.js",
|
24
|
+
"static/js/242.1b3289e0.chunk.js": "./static/js/242.1b3289e0.chunk.js",
|
25
25
|
"static/js/334.fc426162.chunk.js": "./static/js/334.fc426162.chunk.js",
|
26
|
-
"static/js/828.
|
27
|
-
"static/js/619.
|
28
|
-
"static/js/807.
|
29
|
-
"static/js/467.
|
30
|
-
"static/js/279.
|
26
|
+
"static/js/828.0fde3da8.chunk.js": "./static/js/828.0fde3da8.chunk.js",
|
27
|
+
"static/js/619.0325af0e.chunk.js": "./static/js/619.0325af0e.chunk.js",
|
28
|
+
"static/js/807.122f8b05.chunk.js": "./static/js/807.122f8b05.chunk.js",
|
29
|
+
"static/js/467.50ac84df.chunk.js": "./static/js/467.50ac84df.chunk.js",
|
30
|
+
"static/js/279.35b01780.chunk.js": "./static/js/279.35b01780.chunk.js",
|
31
31
|
"static/js/157.ccd0341b.chunk.js": "./static/js/157.ccd0341b.chunk.js",
|
32
|
-
"static/js/14.
|
33
|
-
"static/js/511.
|
34
|
-
"static/js/289.
|
35
|
-
"static/js/628.
|
36
|
-
"static/js/227.
|
37
|
-
"static/js/871.
|
32
|
+
"static/js/14.9399e424.chunk.js": "./static/js/14.9399e424.chunk.js",
|
33
|
+
"static/js/511.e6ca580f.chunk.js": "./static/js/511.e6ca580f.chunk.js",
|
34
|
+
"static/js/289.e6157e40.chunk.js": "./static/js/289.e6157e40.chunk.js",
|
35
|
+
"static/js/628.9c70196b.chunk.js": "./static/js/628.9c70196b.chunk.js",
|
36
|
+
"static/js/227.9ccac1d5.chunk.js": "./static/js/227.9ccac1d5.chunk.js",
|
37
|
+
"static/js/871.90a7dbae.chunk.js": "./static/js/871.90a7dbae.chunk.js",
|
38
38
|
"static/js/714.ba8c0399.chunk.js": "./static/js/714.ba8c0399.chunk.js",
|
39
39
|
"static/js/432.fd437391.chunk.js": "./static/js/432.fd437391.chunk.js",
|
40
40
|
"static/js/998.983f28f4.chunk.js": "./static/js/998.983f28f4.chunk.js",
|
@@ -143,6 +143,6 @@
|
|
143
143
|
},
|
144
144
|
"entrypoints": [
|
145
145
|
"static/css/main.f4a8738f.css",
|
146
|
-
"static/js/main.
|
146
|
+
"static/js/main.ff35bd72.js"
|
147
147
|
]
|
148
148
|
}
|
streamlit/static/index.html
CHANGED
@@ -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"/><title>Streamlit</title><script>window.prerenderReady=!1</script><script defer="defer" src="./static/js/main.
|
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"/><title>Streamlit</title><script>window.prerenderReady=!1</script><script defer="defer" src="./static/js/main.ff35bd72.js"></script><link href="./static/css/main.f4a8738f.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.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[14],{28014:function(e,t,i){i.r(t),i.d(t,{default:function(){return F}});var n=i(1413),a=i(15671),r=i(43144),o=i(97326),l=i(60136),s=i(29388),u=i(47313),d=i(16031),m=i(78947),h=i(83985),c=i(17076),f=i(46332),p=i(7976),g=i(64243),b=i(70816),v=i.n(b),y=i(65167),T=i(73290),R=i(
|
1
|
+
"use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[14],{28014:function(e,t,i){i.r(t),i.d(t,{default:function(){return F}});var n=i(1413),a=i(15671),r=i(43144),o=i(97326),l=i(60136),s=i(29388),u=i(47313),d=i(16031),m=i(78947),h=i(83985),c=i(17076),f=i(46332),p=i(7976),g=i(64243),b=i(70816),v=i.n(b),y=i(65167),T=i(73290),R=i(10612),V=i(47167),k=i(2120),x=(0,V.Z)("div",{target:"e88czh83"})((function(e){var t=e.disabled,i=e.theme;return{alignItems:"center",backgroundColor:t?i.colors.gray:i.colors.primary,borderTopLeftRadius:"100%",borderTopRightRadius:"100%",borderBottomLeftRadius:"100%",borderBottomRightRadius:"100%",borderTopStyle:"none",borderBottomStyle:"none",borderRightStyle:"none",borderLeftStyle:"none",boxShadow:"none",display:"flex",height:i.radii.xl,justifyContent:"center",width:i.radii.xl,":focus":{outline:"none"},":focus-visible":{boxShadow:"0 0 0 0.2rem ".concat((0,k.DZ)(i.colors.primary,.5))}}}),""),w=(0,V.Z)("div",{target:"e88czh82"})((function(e){var t=e.disabled,i=e.theme;return{fontFamily:i.fonts.monospace,fontSize:i.fontSizes.sm,paddingBottom:i.spacing.twoThirdsSmFont,color:t?i.colors.gray:i.colors.primary,top:"-22px",position:"absolute",whiteSpace:"nowrap",backgroundColor:i.colors.transparent,lineHeight:i.lineHeights.base,fontWeight:"normal"}}),""),S=(0,V.Z)("div",{target:"e88czh81"})((function(e){var t=e.theme;return{paddingBottom:t.spacing.none,paddingLeft:t.spacing.none,paddingRight:t.spacing.none,paddingTop:t.spacing.twoThirdsSmFont,justifyContent:"space-between",alignItems:"center",display:"flex"}}),""),C=(0,V.Z)("div",{target:"e88czh80"})((function(e){var t=e.disabled,i=e.theme;return{lineHeight:i.lineHeights.base,fontWeight:"normal",fontSize:i.fontSizes.sm,fontFamily:i.fonts.monospace,color:t?i.colors.fadedText40:"inherit"}}),""),D=i(46417),B=function(e){(0,l.Z)(i,e);var t=(0,s.Z)(i);function i(e){var r;return(0,a.Z)(this,i),(r=t.call(this,e)).formClearHelper=new f.Kz,r.state=void 0,r.sliderRef=u.createRef(),r.thumbRef=[],r.thumbValueRef=[],r.commitWidgetValueDebounced=void 0,r.commitWidgetValue=function(e){r.props.widgetMgr.setDoubleArrayValue(r.props.element,r.state.value,e)},r.onFormCleared=function(){r.setState((function(e,t){return{value:t.element.default}}),(function(){return r.commitWidgetValue({fromUi:!0})}))},r.handleChange=function(e){var t=e.value;r.setState({value:t},(function(){return r.commitWidgetValueDebounced({fromUi:!0})}))},r.renderThumb=u.forwardRef((function(e,t){var i,a=e.$value,o=e.$thumbIndex,l=o||0;r.thumbRef[l]=t,(i=r.thumbValueRef)[l]||(i[l]=u.createRef());var s=a?r.formatValue(a[o]):"",m=(0,d.pick)(e,["role","style","aria-valuemax","aria-valuemin","aria-valuenow","tabIndex","onKeyUp","onKeyDown","onMouseEnter","onMouseLeave","draggable"]);return r.props.element.options.length>0||r.isDateTimeType(),r.thumbValueAlignment(r.thumbRef[l].current,r.thumbValueRef[l].current),(0,D.jsx)(x,(0,n.Z)((0,n.Z)({},m),{},{disabled:!0===e.$disabled,ref:r.thumbRef[l],"aria-valuetext":s,"aria-label":r.props.element.label,children:(0,D.jsx)(w,{className:"StyledThumbValue","data-testid":"stThumbValue",disabled:!0===e.$disabled,ref:r.thumbValueRef[l],children:s})}))})),r.renderTickBar=function(){var e=r.props,t=e.disabled,i=e.element,n=i.max,a=i.min;return(0,D.jsxs)(S,{"data-testid":"stTickBar",children:[(0,D.jsx)(C,{disabled:t,"data-testid":"stTickBarMin",children:r.formatValue(a)}),(0,D.jsx)(C,{disabled:t,"data-testid":"stTickBarMax",children:r.formatValue(n)})]})},r.commitWidgetValueDebounced=(0,g.Ds)(200,r.commitWidgetValue.bind((0,o.Z)(r))),r.state={value:r.initialValue},r}return(0,r.Z)(i,[{key:"initialValue",get:function(){var e=this.props.widgetMgr.getDoubleArrayValue(this.props.element);return void 0!==e?e:this.props.element.default}},{key:"componentDidMount",value:function(){for(var e=0;e<Math.min(this.thumbRef.length,this.thumbValueRef.length);e++)this.thumbValueAlignment(this.thumbRef[e].current,this.thumbValueRef[e].current);this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}},{key:"componentDidUpdate",value:function(){this.maybeUpdateFromProtobuf()}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maybeUpdateFromProtobuf",value:function(){this.props.element.setValue&&this.updateFromProtobuf()}},{key:"updateFromProtobuf",value:function(){var e=this,t=this.props.element.value;this.props.element.setValue=!1,this.setState({value:t},(function(){e.commitWidgetValue({fromUi:!1})}))}},{key:"value",get:function(){var e=this.props.element,t=e.min,i=e.max,n=this.state.value,a=n[0],r=n.length>1?n[1]:n[0];return a>r&&(a=r),a<t&&(a=t),a>i&&(a=i),r<t&&(r=t),r>i&&(r=i),n.length>1?[a,r]:[a]}},{key:"isDateTimeType",value:function(){var e=this.props.element.dataType;return e===p.iR.DataType.DATETIME||e===p.iR.DataType.DATE||e===p.iR.DataType.TIME}},{key:"formatValue",value:function(e){var t=this.props.element,i=t.format,n=t.options;return this.isDateTimeType()?v().utc(e/1e3).format(i):n.length>0?(0,c.sprintf)(i,n[e]):(0,c.sprintf)(i,e)}},{key:"thumbValueAlignment",value:function(e,t){var i=this.sliderRef.current;if(i&&e&&t){var n=i.getBoundingClientRect(),a=e.getBoundingClientRect(),r=t.getBoundingClientRect(),o=a.left+a.width/2,l=o-r.width/2<n.left,s=o+r.width/2>n.right;t.style.left=l?"0":"",t.style.right=s?"0":""}}},{key:"render",value:function(){var e,t=this.props,i=t.disabled,a=t.element,r=t.theme,o=t.width,l=t.widgetMgr,s=r.colors,u=r.fonts,d=r.fontSizes,h=r.spacing,c={width:o};return this.formClearHelper.manageFormClearListener(l,a.formId,this.onFormCleared),(0,D.jsxs)("div",{ref:this.sliderRef,className:"stSlider",style:c,children:[(0,D.jsx)(y.ON,{label:a.label,disabled:i,labelVisibility:(0,g.iF)(null===(e=a.labelVisibility)||void 0===e?void 0:e.value),children:a.help&&(0,D.jsx)(y.dT,{children:(0,D.jsx)(T.ZP,{content:a.help,placement:R.ug.TOP_RIGHT})})}),(0,D.jsx)(m.Z,{min:a.min,max:a.max,step:a.step,value:this.value,onChange:this.handleChange,disabled:i,overrides:{Root:{style:{paddingTop:h.twoThirdsSmFont}},Thumb:this.renderThumb,Tick:{style:{fontFamily:u.monospace,fontSize:d.sm}},Track:{style:{backgroundColor:"none !important",paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:h.twoThirdsSmFont}},InnerTrack:{style:function(e){var t=e.$disabled;return(0,n.Z)({height:"4px"},t?{background:s.darkenedBgMix25}:{})}},TickBar:this.renderTickBar}})]})}}]),i}(u.PureComponent),F=(0,h.b)(B)}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[227],{34227:function(e,t,n){n.r(t),n.d(t,{default:function(){return v}});var r=n(29439),i=n(15671),o=n(43144),a=n(60136),l=n(29388),u=n(47313),s=n(11197),p=n(46332),d=n(65167),m=n(73290),c=n(
|
1
|
+
"use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[227],{34227:function(e,t,n){n.r(t),n.d(t,{default:function(){return v}});var r=n(29439),i=n(15671),o=n(43144),a=n(60136),l=n(29388),u=n(47313),s=n(11197),p=n(46332),d=n(65167),m=n(73290),c=n(10612),f=n(64243),h=n(46417),g=function(e){(0,a.Z)(n,e);var t=(0,l.Z)(n);function n(){var e;(0,i.Z)(this,n);for(var o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return(e=t.call.apply(t,[this].concat(a))).formClearHelper=new p.Kz,e.state={value:e.initialValue},e.commitWidgetValue=function(t){e.props.widgetMgr.setStringValue(e.props.element,e.state.value,t)},e.onFormCleared=function(){e.setState((function(e,t){return{value:t.element.default}}),(function(){return e.commitWidgetValue({fromUi:!0})}))},e.handleChange=function(t){var n;n=null===t?e.initialValue:e.dateToString(t),e.setState({value:n},(function(){return e.commitWidgetValue({fromUi:!0})}))},e.stringToDate=function(e){var t=e.split(":").map(Number),n=(0,r.Z)(t,2),i=n[0],o=n[1],a=new Date;return a.setHours(i),a.setMinutes(o),a},e.dateToString=function(e){var t=e.getHours().toString().padStart(2,"0"),n=e.getMinutes().toString().padStart(2,"0");return"".concat(t,":").concat(n)},e}return(0,o.Z)(n,[{key:"initialValue",get:function(){var e=this.props.widgetMgr.getStringValue(this.props.element);return void 0!==e?e:this.props.element.default}},{key:"componentDidMount",value:function(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}},{key:"componentDidUpdate",value:function(){this.maybeUpdateFromProtobuf()}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maybeUpdateFromProtobuf",value:function(){this.props.element.setValue&&this.updateFromProtobuf()}},{key:"updateFromProtobuf",value:function(){var e=this,t=this.props.element.value;this.props.element.setValue=!1,this.setState({value:t},(function(){e.commitWidgetValue({fromUi:!1})}))}},{key:"render",value:function(){var e,t=this.props,n=t.disabled,r=t.width,i=t.element,o=t.widgetMgr,a={width:r},l={Select:{props:{disabled:n,overrides:{ControlContainer:{style:{borderLeftWidth:"1px",borderRightWidth:"1px",borderTopWidth:"1px",borderBottomWidth:"1px"}},IconsContainer:{style:function(){return{paddingRight:".5rem"}}},ValueContainer:{style:function(){return{paddingRight:".5rem",paddingLeft:".5rem",paddingBottom:".5rem",paddingTop:".5rem"}}},SingleValue:{props:{className:"stTimeInput-timeDisplay"}},Dropdown:{style:function(){return{paddingTop:0,paddingBottom:0}}},Popover:{props:{overrides:{Body:{style:function(){return{marginTop:"1px"}}}}}}}}}};return this.formClearHelper.manageFormClearListener(o,i.formId,this.onFormCleared),(0,h.jsxs)("div",{className:"stTimeInput",style:a,children:[(0,h.jsx)(d.ON,{label:i.label,disabled:n,labelVisibility:(0,f.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:i.help&&(0,h.jsx)(d.dT,{children:(0,h.jsx)(m.ZP,{content:i.help,placement:c.ug.TOP_RIGHT})})}),(0,h.jsx)(s.Z,{format:"24",step:i.step?Number(i.step):900,value:this.stringToDate(this.state.value),onChange:this.handleChange,overrides:l,creatable:!0,"aria-label":i.label})]})}}]),n}(u.PureComponent),v=g}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[242],{30242:function(e,t,o){o.r(t),o.d(t,{default:function(){return G}});var r=o(15671),i=o(43144),n=o(60136),a=o(29388),l=o(47313),c=o(83985),s=o(64243),u=o(74969),d=o(15160);function p(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 h(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?p(Object(o),!0).forEach((function(t){f(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):p(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function f(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function m(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 b(e){var t=e.$disabled,o=e.$theme.colors;return t?o.contentSecondary:o.contentPrimary}var g=(0,d.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"}}));g.displayName="Root",g.displayName="Root";var v=(0,d.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,c=n.animation,s=o?n.colors.tickMarkFillDisabled:r?n.colors.tickMarkFillError:n.colors.tickMarkFill,u=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(s,'"/>\n </svg>\n ')),d=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(s,'"/>\n </svg>\n ')),p=n.borders.checkboxBorderRadius,h=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:c.timing200,transitionTimingFunction:c.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:h,borderRightColor:h,borderTopColor:h,borderBottomColor:h,borderTopLeftRadius:p,borderTopRightRadius:p,borderBottomRightRadius:p,borderBottomLeftRadius:p,outline:a&&t?"3px solid ".concat(n.colors.accent):"none",display:"inline-block",verticalAlign:"middle",backgroundImage:i?"url('data:image/svg+xml,".concat(u,"');"):t?"url('data:image/svg+xml,".concat(d,"');"):null,backgroundColor:m(e),backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"contain",marginTop:n.sizing.scale0,marginBottom:n.sizing.scale0,marginLeft:n.sizing.scale0,marginRight:n.sizing.scale0}}));v.displayName="Checkmark",v.displayName="Checkmark";var y=(0,d.zo)("div",(function(e){var t=e.$theme.typography;return h(h(h({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"),f({},"padding".concat(t),n)}(e)),{},{color:b(e)},t.LabelMedium),{},{lineHeight:"24px"})}));y.displayName="Label",y.displayName="Label";var k=(0,d.zo)("input",{opacity:0,width:0,height:0,overflow:"hidden",margin:0,padding:0,position:"absolute"});k.displayName="Input",k.displayName="Input";var $=(0,d.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)}}));$.displayName="Toggle",$.displayName="Toggle";var w=(0,d.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}}));w.displayName="ToggleTrack",w.displayName="ToggleTrack";var F=Object.freeze({default:"default",toggle:"toggle",toggle_round:"toggle"}),x=(Object.freeze({top:"top",right:"right",bottom:"bottom",left:"left"}),o(75643));function R(e){return R="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},R(e)}function C(){return C=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},C.apply(this,arguments)}function O(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T(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 P(e,t){return P=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},P(e,t)}function S(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=M(e);if(t){var i=M(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return L(this,o)}}function L(e,t){if(t&&("object"===R(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return j(e)}function j(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function M(e){return M=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},M(e)}function E(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var B=function(e){return e.stopPropagation()},V=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&&P(e,t)}(n,e);var t,o,r,i=S(n);function n(){var e;O(this,n);for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return E(j(e=i.call.apply(i,[this].concat(o))),"state",{isFocused:e.props.autoFocus||!1,isFocusVisible:!1,isHovered:!1,isActive:!1}),E(j(e),"onMouseEnter",(function(t){e.setState({isHovered:!0}),e.props.onMouseEnter(t)})),E(j(e),"onMouseLeave",(function(t){e.setState({isHovered:!1,isActive:!1}),e.props.onMouseLeave(t)})),E(j(e),"onMouseDown",(function(t){e.setState({isActive:!0}),e.props.onMouseDown(t)})),E(j(e),"onMouseUp",(function(t){e.setState({isActive:!1}),e.props.onMouseUp(t)})),E(j(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t),(0,x.E)(t)&&e.setState({isFocusVisible:!0})})),E(j(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t),!1!==e.state.isFocusVisible&&e.setState({isFocusVisible:!1})})),e}return t=n,(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,r=e.onChange,i=e.labelPlacement,n=void 0===i?this.props.checkmarkType===F.toggle?"left":"right":i,a=e.inputRef,c=e.isIndeterminate,s=e.error,d=e.disabled,p=e.value,h=e.name,f=e.type,m=e.checked,b=e.children,x=e.required,R=e.title,O=o.Root,T=o.Checkmark,P=o.Label,S=o.Input,L=o.Toggle,j=o.ToggleTrack,M=(0,u.XG)(O)||g,E=(0,u.XG)(T)||v,V=(0,u.XG)(P)||y,z=(0,u.XG)(S)||k,H=(0,u.XG)(L)||$,D=(0,u.XG)(j)||w,I={onChange:r,onFocus:this.onFocus,onBlur:this.onBlur},A={onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},W={$isFocused:this.state.isFocused,$isFocusVisible:this.state.isFocusVisible,$isHovered:this.state.isHovered,$isActive:this.state.isActive,$error:s,$checked:m,$isIndeterminate:c,$required:x,$disabled:d,$value:p},U=b&&l.createElement(V,C({$labelPlacement:n},W,(0,u.ch)(P)),this.props.containsInteractiveElement?l.createElement("div",{onClick:function(e){return e.preventDefault()}},b):b);return l.createElement(M,C({"data-baseweb":"checkbox",title:R||null,$labelPlacement:n},W,A,(0,u.ch)(O)),("top"===n||"left"===n)&&U,this.props.checkmarkType===F.toggle?l.createElement(D,C({},W,(0,u.ch)(j)),l.createElement(H,C({},W,(0,u.ch)(L)))):l.createElement(E,C({},W,(0,u.ch)(T))),l.createElement(z,C({value:p,name:h,checked:m,required:x,"aria-label":this.props["aria-label"]||this.props.ariaLabel,"aria-checked":c?"mixed":m,"aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":s||null,"aria-required":x||null,disabled:d,type:f,ref:a,onClick:B},W,I,(0,u.ch)(S))),("bottom"===n||"right"===n)&&U)}}])&&T(t.prototype,o),r&&T(t,r),Object.defineProperty(t,"prototype",{writable:!1}),n}(l.Component);E(V,"defaultProps",{overrides:{},checked:!1,containsInteractiveElement:!1,disabled:!1,autoFocus:!1,isIndeterminate:!1,inputRef:l.createRef(),error:!1,type:"checkbox",checkmarkType:F.default,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});var z=V,H=o(2120),D=o(46332),I=o(73290),A=o(80213),W=o(65167),U=o(50412),N=(0,o(47167).Z)("div",{target:"ek41t0m0"})((function(e){var t=e.visibility;return{display:t===s.Ws.Collapsed?"none":"flex",visibility:t===s.Ws.Hidden?"hidden":"visible",verticalAlign:"middle",flexDirection:"row",alignItems:"center"}}),""),_=o(46417),Z=function(e){(0,n.Z)(o,e);var t=(0,a.Z)(o);function o(){var e;(0,r.Z)(this,o);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(e=t.call.apply(t,[this].concat(n))).formClearHelper=new D.Kz,e.state={value:e.initialValue},e.commitWidgetValue=function(t){e.props.widgetMgr.setBoolValue(e.props.element,e.state.value,t)},e.onFormCleared=function(){e.setState((function(e,t){return{value:t.element.default}}),(function(){return e.commitWidgetValue({fromUi:!0})}))},e.onChange=function(t){var o=t.target.checked;e.setState({value:o},(function(){return e.commitWidgetValue({fromUi:!0})}))},e}return(0,i.Z)(o,[{key:"initialValue",get:function(){var e=this.props.widgetMgr.getBoolValue(this.props.element);return void 0!==e?e:this.props.element.default}},{key:"componentDidMount",value:function(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}},{key:"componentDidUpdate",value:function(){this.maybeUpdateFromProtobuf()}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maybeUpdateFromProtobuf",value:function(){this.props.element.setValue&&this.updateFromProtobuf()}},{key:"updateFromProtobuf",value:function(){var e=this,t=this.props.element.value;this.props.element.setValue=!1,this.setState({value:t},(function(){e.commitWidgetValue({fromUi:!1})}))}},{key:"render",value:function(){var e,t=this.props,o=t.theme,r=t.width,i=t.element,n=t.disabled,a=t.widgetMgr,l=o.colors,c=o.spacing,u={width:r},d=n?l.fadedText40:l.bodyText;return this.formClearHelper.manageFormClearListener(a,i.formId,this.onFormCleared),(0,_.jsx)("div",{className:"row-widget stCheckbox",style:u,children:(0,_.jsx)(z,{checked:this.state.value,disabled:n,onChange:this.onChange,"aria-label":i.label,overrides:{Root:{style:function(e){var t=e.$isFocusVisible;return{marginBottom:0,marginTop:0,paddingRight:c.twoThirdsSmFont,backgroundColor:t?l.darkenedBgMix25:"",display:"flex",alignItems:"start"}}},Checkmark:{style:function(e){var t=e.$isFocusVisible,o=e.$checked,r=o&&!n?l.primary:l.fadedText40;return{outline:0,width:"1rem",height:"1rem",marginTop:"0.30rem",boxShadow:t&&o?"0 0 0 0.2rem ".concat((0,H.DZ)(l.primary,.5)):"",borderLeftWidth:"2px",borderRightWidth:"2px",borderTopWidth:"2px",borderBottomWidth:"2px",borderLeftColor:r,borderRightColor:r,borderTopColor:r,borderBottomColor:r}}},Label:{style:{color:d}}},children:(0,_.jsxs)(N,{visibility:(0,s.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:[(0,_.jsx)(U.Z,{source:i.label,allowHTML:!1,isLabel:!0,isCheckbox:!0}),i.help&&(0,_.jsx)(W.Hp,{color:d,children:(0,_.jsx)(I.ZP,{content:i.help,placement:A.ug.TOP_RIGHT})})]})})})}}]),o}(l.PureComponent),G=(0,c.b)(Z)}}]);
|
1
|
+
"use strict";(self.webpackChunkstreamlit_browser=self.webpackChunkstreamlit_browser||[]).push([[242],{30242:function(e,t,o){o.r(t),o.d(t,{default:function(){return G}});var r=o(15671),i=o(43144),n=o(60136),a=o(29388),l=o(47313),c=o(83985),s=o(64243),u=o(74969),d=o(15160);function p(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 h(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?p(Object(o),!0).forEach((function(t){f(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):p(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function f(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function m(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 b(e){var t=e.$disabled,o=e.$theme.colors;return t?o.contentSecondary:o.contentPrimary}var g=(0,d.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"}}));g.displayName="Root",g.displayName="Root";var v=(0,d.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,c=n.animation,s=o?n.colors.tickMarkFillDisabled:r?n.colors.tickMarkFillError:n.colors.tickMarkFill,u=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(s,'"/>\n </svg>\n ')),d=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(s,'"/>\n </svg>\n ')),p=n.borders.checkboxBorderRadius,h=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:c.timing200,transitionTimingFunction:c.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:h,borderRightColor:h,borderTopColor:h,borderBottomColor:h,borderTopLeftRadius:p,borderTopRightRadius:p,borderBottomRightRadius:p,borderBottomLeftRadius:p,outline:a&&t?"3px solid ".concat(n.colors.accent):"none",display:"inline-block",verticalAlign:"middle",backgroundImage:i?"url('data:image/svg+xml,".concat(u,"');"):t?"url('data:image/svg+xml,".concat(d,"');"):null,backgroundColor:m(e),backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"contain",marginTop:n.sizing.scale0,marginBottom:n.sizing.scale0,marginLeft:n.sizing.scale0,marginRight:n.sizing.scale0}}));v.displayName="Checkmark",v.displayName="Checkmark";var y=(0,d.zo)("div",(function(e){var t=e.$theme.typography;return h(h(h({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"),f({},"padding".concat(t),n)}(e)),{},{color:b(e)},t.LabelMedium),{},{lineHeight:"24px"})}));y.displayName="Label",y.displayName="Label";var k=(0,d.zo)("input",{opacity:0,width:0,height:0,overflow:"hidden",margin:0,padding:0,position:"absolute"});k.displayName="Input",k.displayName="Input";var $=(0,d.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)}}));$.displayName="Toggle",$.displayName="Toggle";var w=(0,d.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}}));w.displayName="ToggleTrack",w.displayName="ToggleTrack";var F=Object.freeze({default:"default",toggle:"toggle",toggle_round:"toggle"}),x=(Object.freeze({top:"top",right:"right",bottom:"bottom",left:"left"}),o(75643));function R(e){return R="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},R(e)}function C(){return C=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},C.apply(this,arguments)}function O(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T(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 P(e,t){return P=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},P(e,t)}function S(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=M(e);if(t){var i=M(this).constructor;o=Reflect.construct(r,arguments,i)}else o=r.apply(this,arguments);return L(this,o)}}function L(e,t){if(t&&("object"===R(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return j(e)}function j(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function M(e){return M=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},M(e)}function E(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var B=function(e){return e.stopPropagation()},V=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&&P(e,t)}(n,e);var t,o,r,i=S(n);function n(){var e;O(this,n);for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return E(j(e=i.call.apply(i,[this].concat(o))),"state",{isFocused:e.props.autoFocus||!1,isFocusVisible:!1,isHovered:!1,isActive:!1}),E(j(e),"onMouseEnter",(function(t){e.setState({isHovered:!0}),e.props.onMouseEnter(t)})),E(j(e),"onMouseLeave",(function(t){e.setState({isHovered:!1,isActive:!1}),e.props.onMouseLeave(t)})),E(j(e),"onMouseDown",(function(t){e.setState({isActive:!0}),e.props.onMouseDown(t)})),E(j(e),"onMouseUp",(function(t){e.setState({isActive:!1}),e.props.onMouseUp(t)})),E(j(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t),(0,x.E)(t)&&e.setState({isFocusVisible:!0})})),E(j(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t),!1!==e.state.isFocusVisible&&e.setState({isFocusVisible:!1})})),e}return t=n,(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,r=e.onChange,i=e.labelPlacement,n=void 0===i?this.props.checkmarkType===F.toggle?"left":"right":i,a=e.inputRef,c=e.isIndeterminate,s=e.error,d=e.disabled,p=e.value,h=e.name,f=e.type,m=e.checked,b=e.children,x=e.required,R=e.title,O=o.Root,T=o.Checkmark,P=o.Label,S=o.Input,L=o.Toggle,j=o.ToggleTrack,M=(0,u.XG)(O)||g,E=(0,u.XG)(T)||v,V=(0,u.XG)(P)||y,z=(0,u.XG)(S)||k,H=(0,u.XG)(L)||$,D=(0,u.XG)(j)||w,I={onChange:r,onFocus:this.onFocus,onBlur:this.onBlur},A={onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},W={$isFocused:this.state.isFocused,$isFocusVisible:this.state.isFocusVisible,$isHovered:this.state.isHovered,$isActive:this.state.isActive,$error:s,$checked:m,$isIndeterminate:c,$required:x,$disabled:d,$value:p},U=b&&l.createElement(V,C({$labelPlacement:n},W,(0,u.ch)(P)),this.props.containsInteractiveElement?l.createElement("div",{onClick:function(e){return e.preventDefault()}},b):b);return l.createElement(M,C({"data-baseweb":"checkbox",title:R||null,$labelPlacement:n},W,A,(0,u.ch)(O)),("top"===n||"left"===n)&&U,this.props.checkmarkType===F.toggle?l.createElement(D,C({},W,(0,u.ch)(j)),l.createElement(H,C({},W,(0,u.ch)(L)))):l.createElement(E,C({},W,(0,u.ch)(T))),l.createElement(z,C({value:p,name:h,checked:m,required:x,"aria-label":this.props["aria-label"]||this.props.ariaLabel,"aria-checked":c?"mixed":m,"aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":s||null,"aria-required":x||null,disabled:d,type:f,ref:a,onClick:B},W,I,(0,u.ch)(S))),("bottom"===n||"right"===n)&&U)}}])&&T(t.prototype,o),r&&T(t,r),Object.defineProperty(t,"prototype",{writable:!1}),n}(l.Component);E(V,"defaultProps",{overrides:{},checked:!1,containsInteractiveElement:!1,disabled:!1,autoFocus:!1,isIndeterminate:!1,inputRef:l.createRef(),error:!1,type:"checkbox",checkmarkType:F.default,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});var z=V,H=o(2120),D=o(46332),I=o(73290),A=o(10612),W=o(65167),U=o(50412),N=(0,o(47167).Z)("div",{target:"ek41t0m0"})((function(e){var t=e.visibility;return{display:t===s.Ws.Collapsed?"none":"flex",visibility:t===s.Ws.Hidden?"hidden":"visible",verticalAlign:"middle",flexDirection:"row",alignItems:"center"}}),""),_=o(46417),Z=function(e){(0,n.Z)(o,e);var t=(0,a.Z)(o);function o(){var e;(0,r.Z)(this,o);for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];return(e=t.call.apply(t,[this].concat(n))).formClearHelper=new D.Kz,e.state={value:e.initialValue},e.commitWidgetValue=function(t){e.props.widgetMgr.setBoolValue(e.props.element,e.state.value,t)},e.onFormCleared=function(){e.setState((function(e,t){return{value:t.element.default}}),(function(){return e.commitWidgetValue({fromUi:!0})}))},e.onChange=function(t){var o=t.target.checked;e.setState({value:o},(function(){return e.commitWidgetValue({fromUi:!0})}))},e}return(0,i.Z)(o,[{key:"initialValue",get:function(){var e=this.props.widgetMgr.getBoolValue(this.props.element);return void 0!==e?e:this.props.element.default}},{key:"componentDidMount",value:function(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}},{key:"componentDidUpdate",value:function(){this.maybeUpdateFromProtobuf()}},{key:"componentWillUnmount",value:function(){this.formClearHelper.disconnect()}},{key:"maybeUpdateFromProtobuf",value:function(){this.props.element.setValue&&this.updateFromProtobuf()}},{key:"updateFromProtobuf",value:function(){var e=this,t=this.props.element.value;this.props.element.setValue=!1,this.setState({value:t},(function(){e.commitWidgetValue({fromUi:!1})}))}},{key:"render",value:function(){var e,t=this.props,o=t.theme,r=t.width,i=t.element,n=t.disabled,a=t.widgetMgr,l=o.colors,c=o.spacing,u={width:r},d=n?l.fadedText40:l.bodyText;return this.formClearHelper.manageFormClearListener(a,i.formId,this.onFormCleared),(0,_.jsx)("div",{className:"row-widget stCheckbox",style:u,children:(0,_.jsx)(z,{checked:this.state.value,disabled:n,onChange:this.onChange,"aria-label":i.label,overrides:{Root:{style:function(e){var t=e.$isFocusVisible;return{marginBottom:0,marginTop:0,paddingRight:c.twoThirdsSmFont,backgroundColor:t?l.darkenedBgMix25:"",display:"flex",alignItems:"start"}}},Checkmark:{style:function(e){var t=e.$isFocusVisible,o=e.$checked,r=o&&!n?l.primary:l.fadedText40;return{outline:0,width:"1rem",height:"1rem",marginTop:"0.30rem",boxShadow:t&&o?"0 0 0 0.2rem ".concat((0,H.DZ)(l.primary,.5)):"",borderLeftWidth:"2px",borderRightWidth:"2px",borderTopWidth:"2px",borderBottomWidth:"2px",borderLeftColor:r,borderRightColor:r,borderTopColor:r,borderBottomColor:r}}},Label:{style:{color:d}}},children:(0,_.jsxs)(N,{visibility:(0,s.iF)(null===(e=i.labelVisibility)||void 0===e?void 0:e.value),children:[(0,_.jsx)(U.Z,{source:i.label,allowHTML:!1,isLabel:!0,isCheckbox:!0}),i.help&&(0,_.jsx)(W.Hp,{color:d,children:(0,_.jsx)(I.ZP,{content:i.help,placement:A.ug.TOP_RIGHT})})]})})})}}]),o}(l.PureComponent),G=(0,c.b)(Z)}}]);
|