streamlit-nightly 1.35.1.dev20240610__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.
- streamlit/__init__.py +5 -1
- streamlit/case_converters.py +2 -2
- streamlit/cli_util.py +2 -2
- streamlit/color_util.py +2 -2
- streamlit/commands/experimental_query_params.py +6 -8
- streamlit/commands/logo.py +4 -9
- streamlit/commands/navigation.py +6 -4
- streamlit/components/lib/local_component_registry.py +4 -2
- streamlit/components/types/base_component_registry.py +3 -2
- streamlit/components/v1/component_arrow.py +2 -1
- streamlit/components/v1/component_registry.py +6 -2
- streamlit/components/v1/components.py +4 -2
- streamlit/components/v1/custom_component.py +6 -6
- streamlit/config.py +15 -12
- streamlit/connections/snowflake_connection.py +2 -1
- streamlit/connections/snowpark_connection.py +2 -4
- streamlit/connections/sql_connection.py +2 -1
- streamlit/delta_generator.py +3 -4
- streamlit/elements/arrow.py +3 -6
- streamlit/elements/code.py +1 -1
- streamlit/elements/dialog_decorator.py +10 -8
- streamlit/elements/doc_string.py +1 -1
- streamlit/elements/exception.py +1 -1
- streamlit/elements/form.py +1 -1
- streamlit/elements/heading.py +1 -1
- streamlit/elements/html.py +1 -1
- streamlit/elements/image.py +5 -3
- streamlit/elements/layouts.py +36 -13
- streamlit/elements/lib/built_in_chart_utils.py +24 -12
- streamlit/elements/lib/column_config_utils.py +2 -1
- streamlit/elements/lib/dialog.py +8 -5
- streamlit/elements/lib/dicttools.py +3 -3
- streamlit/elements/lib/mutable_status_container.py +8 -5
- streamlit/elements/lib/pandas_styler_utils.py +2 -1
- streamlit/elements/lib/subtitle_utils.py +0 -1
- streamlit/elements/lib/utils.py +8 -10
- streamlit/elements/plotly_chart.py +5 -10
- streamlit/elements/pyplot.py +0 -1
- streamlit/elements/toast.py +2 -2
- streamlit/elements/vega_charts.py +46 -10
- streamlit/elements/widgets/color_picker.py +6 -4
- streamlit/elements/widgets/file_uploader.py +4 -8
- streamlit/elements/widgets/multiselect.py +2 -4
- streamlit/elements/widgets/number_input.py +4 -8
- streamlit/elements/widgets/select_slider.py +1 -1
- streamlit/elements/widgets/slider.py +2 -5
- streamlit/elements/widgets/time_widgets.py +5 -5
- streamlit/errors.py +1 -6
- streamlit/git_util.py +2 -2
- streamlit/hello/Animation_Demo.py +0 -1
- streamlit/logger.py +1 -1
- streamlit/navigation/page.py +6 -1
- streamlit/net_util.py +2 -5
- streamlit/proto/AutoRerun_pb2.py +3 -2
- streamlit/proto/Block_pb2.py +24 -22
- streamlit/proto/Block_pb2.pyi +19 -1
- streamlit/runtime/app_session.py +7 -7
- streamlit/runtime/caching/__init__.py +9 -13
- streamlit/runtime/caching/cache_data_api.py +18 -7
- streamlit/runtime/caching/cache_errors.py +8 -6
- streamlit/runtime/caching/cache_resource_api.py +10 -9
- streamlit/runtime/caching/cache_utils.py +10 -7
- streamlit/runtime/caching/cached_message_replay.py +10 -9
- streamlit/runtime/caching/hashing.py +3 -3
- streamlit/runtime/caching/storage/cache_storage_protocol.py +1 -1
- streamlit/runtime/connection_factory.py +4 -2
- streamlit/runtime/credentials.py +11 -20
- streamlit/runtime/forward_msg_cache.py +10 -11
- streamlit/runtime/forward_msg_queue.py +6 -4
- streamlit/runtime/fragment.py +7 -9
- streamlit/runtime/media_file_manager.py +4 -4
- streamlit/runtime/memory_media_file_storage.py +7 -8
- streamlit/runtime/metrics_util.py +2 -4
- streamlit/runtime/pages_manager.py +41 -41
- streamlit/runtime/runtime.py +4 -4
- streamlit/runtime/runtime_util.py +7 -12
- streamlit/runtime/scriptrunner/magic.py +1 -1
- streamlit/runtime/scriptrunner/script_requests.py +4 -2
- streamlit/runtime/scriptrunner/script_run_context.py +15 -15
- streamlit/runtime/scriptrunner/script_runner.py +8 -8
- streamlit/runtime/secrets.py +3 -5
- streamlit/runtime/session_manager.py +8 -7
- streamlit/runtime/state/common.py +1 -1
- streamlit/runtime/state/query_params_proxy.py +5 -10
- streamlit/runtime/state/safe_session_state.py +8 -7
- streamlit/runtime/state/widgets.py +27 -27
- streamlit/runtime/stats.py +1 -1
- streamlit/runtime/uploaded_file_manager.py +4 -2
- streamlit/runtime/websocket_session_manager.py +6 -4
- streamlit/static/asset-manifest.json +3 -3
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{8492.8ad745d1.chunk.js → 4335.b492cdb7.chunk.js} +1 -1
- streamlit/static/static/js/main.0ebf040e.js +2 -0
- streamlit/string_util.py +1 -1
- streamlit/testing/v1/app_test.py +4 -2
- streamlit/testing/v1/element_tree.py +33 -37
- streamlit/testing/v1/local_script_runner.py +7 -7
- streamlit/time_util.py +2 -4
- streamlit/type_util.py +16 -29
- streamlit/user_info.py +4 -2
- streamlit/util.py +1 -1
- streamlit/watcher/event_based_path_watcher.py +6 -3
- streamlit/watcher/local_sources_watcher.py +11 -7
- streamlit/web/bootstrap.py +1 -1
- streamlit/web/cache_storage_manager_config.py +5 -1
- streamlit/web/cli.py +9 -4
- streamlit/web/server/browser_websocket_handler.py +7 -8
- streamlit/web/server/component_request_handler.py +4 -2
- streamlit/web/server/routes.py +3 -3
- streamlit/web/server/server.py +12 -12
- streamlit/web/server/server_util.py +5 -6
- streamlit/web/server/stats_request_handler.py +1 -1
- streamlit/web/server/upload_file_request_handler.py +5 -3
- {streamlit_nightly-1.35.1.dev20240610.dist-info → streamlit_nightly-1.35.1.dev20240612.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.35.1.dev20240610.dist-info → streamlit_nightly-1.35.1.dev20240612.dist-info}/RECORD +120 -120
- streamlit/static/static/js/main.dc75074b.js +0 -2
- /streamlit/static/static/js/{main.dc75074b.js.LICENSE.txt → main.0ebf040e.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.35.1.dev20240610.data → streamlit_nightly-1.35.1.dev20240612.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.35.1.dev20240610.dist-info → streamlit_nightly-1.35.1.dev20240612.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.35.1.dev20240610.dist-info → streamlit_nightly-1.35.1.dev20240612.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.35.1.dev20240610.dist-info → streamlit_nightly-1.35.1.dev20240612.dist-info}/top_level.txt +0 -0
@@ -34,10 +34,10 @@ from streamlit.runtime.state.common import (
|
|
34
34
|
WidgetSerializer,
|
35
35
|
user_key_from_widget_id,
|
36
36
|
)
|
37
|
-
from streamlit.type_util import ValueFieldName
|
38
37
|
|
39
38
|
if TYPE_CHECKING:
|
40
39
|
from streamlit.runtime.scriptrunner import ScriptRunContext
|
40
|
+
from streamlit.type_util import ValueFieldName
|
41
41
|
|
42
42
|
|
43
43
|
ElementType: TypeAlias = str
|
@@ -48,32 +48,32 @@ ElementType: TypeAlias = str
|
|
48
48
|
# not able to always rely on the proto as the type may be needed earlier.
|
49
49
|
# Thankfully, in these cases (when value_type == "trigger_value"), the static
|
50
50
|
# table here being slightly inaccurate should never pose a problem.
|
51
|
-
ELEMENT_TYPE_TO_VALUE_TYPE: Final[
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
51
|
+
ELEMENT_TYPE_TO_VALUE_TYPE: Final[Mapping[ElementType, ValueFieldName]] = (
|
52
|
+
MappingProxyType(
|
53
|
+
{
|
54
|
+
"button": "trigger_value",
|
55
|
+
"camera_input": "file_uploader_state_value",
|
56
|
+
"checkbox": "bool_value",
|
57
|
+
"chat_input": "string_trigger_value",
|
58
|
+
"color_picker": "string_value",
|
59
|
+
"component_instance": "json_value",
|
60
|
+
"data_editor": "string_value",
|
61
|
+
"dataframe": "string_value",
|
62
|
+
"date_input": "string_array_value",
|
63
|
+
"download_button": "trigger_value",
|
64
|
+
"file_uploader": "file_uploader_state_value",
|
65
|
+
"multiselect": "int_array_value",
|
66
|
+
"number_input": "double_value",
|
67
|
+
"plotly_chart": "string_value",
|
68
|
+
"radio": "int_value",
|
69
|
+
"selectbox": "int_value",
|
70
|
+
"slider": "double_array_value",
|
71
|
+
"text_area": "string_value",
|
72
|
+
"text_input": "string_value",
|
73
|
+
"time_input": "string_value",
|
74
|
+
"vega_lite_chart": "string_value",
|
75
|
+
}
|
76
|
+
)
|
77
77
|
)
|
78
78
|
|
79
79
|
|
streamlit/runtime/stats.py
CHANGED
@@ -76,7 +76,7 @@ def group_stats(stats: list[CacheStat]) -> list[CacheStat]:
|
|
76
76
|
CacheStat(
|
77
77
|
category_name=category_name,
|
78
78
|
cache_name=cache_name,
|
79
|
-
byte_length=sum(
|
79
|
+
byte_length=sum(item.byte_length for item in single_group_stats),
|
80
80
|
)
|
81
81
|
)
|
82
82
|
return result
|
@@ -16,12 +16,14 @@ from __future__ import annotations
|
|
16
16
|
|
17
17
|
import io
|
18
18
|
from abc import abstractmethod
|
19
|
-
from typing import NamedTuple, Protocol, Sequence
|
19
|
+
from typing import TYPE_CHECKING, NamedTuple, Protocol, Sequence
|
20
20
|
|
21
21
|
from streamlit import util
|
22
|
-
from streamlit.proto.Common_pb2 import FileURLs as FileURLsProto
|
23
22
|
from streamlit.runtime.stats import CacheStatsProvider
|
24
23
|
|
24
|
+
if TYPE_CHECKING:
|
25
|
+
from streamlit.proto.Common_pb2 import FileURLs as FileURLsProto
|
26
|
+
|
25
27
|
|
26
28
|
class UploadedFileRec(NamedTuple):
|
27
29
|
"""Metadata and raw bytes for an uploaded file. Immutable."""
|
@@ -14,12 +14,10 @@
|
|
14
14
|
|
15
15
|
from __future__ import annotations
|
16
16
|
|
17
|
-
from typing import Callable, Final, List, cast
|
17
|
+
from typing import TYPE_CHECKING, Callable, Final, List, cast
|
18
18
|
|
19
19
|
from streamlit.logger import get_logger
|
20
20
|
from streamlit.runtime.app_session import AppSession
|
21
|
-
from streamlit.runtime.script_data import ScriptData
|
22
|
-
from streamlit.runtime.scriptrunner.script_cache import ScriptCache
|
23
21
|
from streamlit.runtime.session_manager import (
|
24
22
|
ActiveSessionInfo,
|
25
23
|
SessionClient,
|
@@ -27,7 +25,11 @@ from streamlit.runtime.session_manager import (
|
|
27
25
|
SessionManager,
|
28
26
|
SessionStorage,
|
29
27
|
)
|
30
|
-
|
28
|
+
|
29
|
+
if TYPE_CHECKING:
|
30
|
+
from streamlit.runtime.script_data import ScriptData
|
31
|
+
from streamlit.runtime.scriptrunner.script_cache import ScriptCache
|
32
|
+
from streamlit.runtime.uploaded_file_manager import UploadedFileManager
|
31
33
|
|
32
34
|
_LOGGER: Final = get_logger(__name__)
|
33
35
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"files": {
|
3
3
|
"main.css": "./static/css/main.3aaaea00.css",
|
4
|
-
"main.js": "./static/js/main.
|
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/
|
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.
|
154
|
+
"static/js/main.0ebf040e.js"
|
155
155
|
]
|
156
156
|
}
|
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"/><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.
|
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}}}}]);
|