streamlit-nightly 1.39.1.dev20241002__py2.py3-none-any.whl → 1.39.1.dev20241004__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/elements/image.py +52 -9
- streamlit/proto/Image_pb2.pyi +7 -3
- streamlit/static/asset-manifest.json +9 -9
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/1086.9d39d6cd.chunk.js +5 -0
- streamlit/static/static/js/1260.dc193a5e.chunk.js +5 -0
- streamlit/static/static/js/5618.34479f59.chunk.js +5 -0
- streamlit/static/static/js/7193.7582e347.chunk.js +1 -0
- streamlit/static/static/js/8166.9447a253.chunk.js +1 -0
- streamlit/static/static/js/954.ce49a8cf.chunk.js +5 -0
- streamlit/static/static/js/9923.790a85e7.chunk.js +1 -0
- streamlit/static/static/js/{main.bf449882.js → main.fb185886.js} +3 -3
- {streamlit_nightly-1.39.1.dev20241002.dist-info → streamlit_nightly-1.39.1.dev20241004.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.39.1.dev20241002.dist-info → streamlit_nightly-1.39.1.dev20241004.dist-info}/RECORD +19 -19
- streamlit/static/static/js/1086.00b01cb4.chunk.js +0 -5
- streamlit/static/static/js/1260.a40772f3.chunk.js +0 -5
- streamlit/static/static/js/5618.1b8c3294.chunk.js +0 -5
- streamlit/static/static/js/7193.2594a18c.chunk.js +0 -1
- streamlit/static/static/js/8166.11abccb8.chunk.js +0 -1
- streamlit/static/static/js/954.97e839a4.chunk.js +0 -5
- streamlit/static/static/js/9923.7061d124.chunk.js +0 -1
- /streamlit/static/static/js/{main.bf449882.js.LICENSE.txt → main.fb185886.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.39.1.dev20241002.data → streamlit_nightly-1.39.1.dev20241004.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.39.1.dev20241002.dist-info → streamlit_nightly-1.39.1.dev20241004.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.39.1.dev20241002.dist-info → streamlit_nightly-1.39.1.dev20241004.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.39.1.dev20241002.dist-info → streamlit_nightly-1.39.1.dev20241004.dist-info}/top_level.txt +0 -0
streamlit/elements/image.py
CHANGED
@@ -30,6 +30,7 @@ from typing import TYPE_CHECKING, Final, Literal, Sequence, Union, cast
|
|
30
30
|
from typing_extensions import TypeAlias
|
31
31
|
|
32
32
|
from streamlit import runtime, url_util
|
33
|
+
from streamlit.deprecation_util import show_deprecation_warning
|
33
34
|
from streamlit.errors import StreamlitAPIException
|
34
35
|
from streamlit.proto.Image_pb2 import ImageList as ImageListProto
|
35
36
|
from streamlit.runtime import caching
|
@@ -61,6 +62,8 @@ ImageFormat: TypeAlias = Literal["JPEG", "PNG", "GIF"]
|
|
61
62
|
ImageFormatOrAuto: TypeAlias = Literal[ImageFormat, "auto"]
|
62
63
|
|
63
64
|
|
65
|
+
# @see Image.proto
|
66
|
+
# @see WidthBehavior on the frontend
|
64
67
|
class WidthBehaviour(IntEnum):
|
65
68
|
"""
|
66
69
|
Special values that are recognized by the frontend and allow us to change the
|
@@ -70,6 +73,8 @@ class WidthBehaviour(IntEnum):
|
|
70
73
|
ORIGINAL = -1
|
71
74
|
COLUMN = -2
|
72
75
|
AUTO = -3
|
76
|
+
MIN_IMAGE_OR_CONTAINER = -4
|
77
|
+
MAX_IMAGE_OR_CONTAINER = -5
|
73
78
|
|
74
79
|
|
75
80
|
WidthBehaviour.ORIGINAL.__doc__ = """Display the image at its original width"""
|
@@ -94,6 +99,8 @@ class ImageMixin:
|
|
94
99
|
clamp: bool = False,
|
95
100
|
channels: Channels = "RGB",
|
96
101
|
output_format: ImageFormatOrAuto = "auto",
|
102
|
+
*,
|
103
|
+
use_container_width: bool = False,
|
97
104
|
) -> DeltaGenerator:
|
98
105
|
"""Display an image or list of images.
|
99
106
|
|
@@ -120,6 +127,9 @@ class ImageMixin:
|
|
120
127
|
If "always" or True, set the image's width to the column width.
|
121
128
|
If "never" or False, set the image's width to its natural size.
|
122
129
|
Note: if set, `use_column_width` takes precedence over the `width` parameter.
|
130
|
+
.. deprecated::
|
131
|
+
The `use_column_width` parameter has been deprecated and will be removed in a future release.
|
132
|
+
Please utilize the `use_container_width` parameter instead.
|
123
133
|
clamp : bool
|
124
134
|
Clamp image pixel values to a valid range ([0-255] per channel).
|
125
135
|
This is only meaningful for byte array images; the parameter is
|
@@ -137,6 +147,15 @@ class ImageMixin:
|
|
137
147
|
while diagrams should use the PNG format for lossless compression.
|
138
148
|
Defaults to "auto" which identifies the compression type based
|
139
149
|
on the type and format of the image argument.
|
150
|
+
use_container_width : bool
|
151
|
+
Whether to override the figure's native width with the width of the
|
152
|
+
parent container. If ``use_container_width`` is ``True``, Streamlit
|
153
|
+
sets the width of the figure to match the width of the parent
|
154
|
+
container. If ``use_container_width`` is ``False`` (default),
|
155
|
+
Streamlit sets the width of the image to its natural width, up to
|
156
|
+
the width of the parent container.
|
157
|
+
Note: if `use_container_width` is set to `True`, it will take
|
158
|
+
precedence over the `width` parameter
|
140
159
|
|
141
160
|
Example
|
142
161
|
-------
|
@@ -149,21 +168,45 @@ class ImageMixin:
|
|
149
168
|
|
150
169
|
"""
|
151
170
|
|
152
|
-
if
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
171
|
+
if use_container_width is True and use_column_width is not None:
|
172
|
+
raise StreamlitAPIException(
|
173
|
+
"`use_container_width` and `use_column_width` cannot be set at the same time.",
|
174
|
+
"Please utilize `use_container_width` since `use_column_width` is deprecated.",
|
175
|
+
)
|
176
|
+
|
177
|
+
image_width: int = (
|
178
|
+
WidthBehaviour.ORIGINAL if (width is None or width <= 0) else width
|
179
|
+
)
|
180
|
+
|
181
|
+
if use_column_width is not None:
|
182
|
+
show_deprecation_warning(
|
183
|
+
"The `use_column_width` parameter has been deprecated and will be removed "
|
184
|
+
"in a future release. Please utilize the `use_container_width` parameter instead."
|
185
|
+
)
|
186
|
+
|
187
|
+
if use_column_width == "auto":
|
188
|
+
image_width = WidthBehaviour.AUTO
|
189
|
+
elif use_column_width == "always" or use_column_width is True:
|
190
|
+
image_width = WidthBehaviour.COLUMN
|
191
|
+
elif use_column_width == "never" or use_column_width is False:
|
192
|
+
image_width = WidthBehaviour.ORIGINAL
|
193
|
+
|
194
|
+
else:
|
195
|
+
if use_container_width is True:
|
196
|
+
image_width = WidthBehaviour.MAX_IMAGE_OR_CONTAINER
|
197
|
+
elif image_width is not None and image_width > 0:
|
198
|
+
# Use the given width. It will be capped on the frontend if it
|
199
|
+
# exceeds the container width.
|
200
|
+
pass
|
201
|
+
elif use_container_width is False:
|
202
|
+
image_width = WidthBehaviour.MIN_IMAGE_OR_CONTAINER
|
160
203
|
|
161
204
|
image_list_proto = ImageListProto()
|
162
205
|
marshall_images(
|
163
206
|
self.dg._get_delta_path_str(),
|
164
207
|
image,
|
165
208
|
caption,
|
166
|
-
|
209
|
+
image_width,
|
167
210
|
image_list_proto,
|
168
211
|
clamp,
|
169
212
|
channels,
|
streamlit/proto/Image_pb2.pyi
CHANGED
@@ -61,11 +61,15 @@ class ImageList(google.protobuf.message.Message):
|
|
61
61
|
IMGS_FIELD_NUMBER: builtins.int
|
62
62
|
WIDTH_FIELD_NUMBER: builtins.int
|
63
63
|
width: builtins.int
|
64
|
-
"""
|
64
|
+
"""@see WidthBehaviour on the backend
|
65
|
+
@see WidthBehavior on the frontend
|
66
|
+
The width of each image.
|
65
67
|
>0 sets the image width explicitly
|
66
68
|
-1 means use the image width
|
67
|
-
-2 means use the column width
|
68
|
-
-3 means use the smaller of image width & column width
|
69
|
+
-2 means use the column width (deprecated)
|
70
|
+
-3 means use the smaller of image width & column width (deprecated)
|
71
|
+
-4 means use the smaller of image width & container width
|
72
|
+
-5 means use the larger of image width & container width
|
69
73
|
"""
|
70
74
|
@property
|
71
75
|
def imgs(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Image]: ...
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"files": {
|
3
3
|
"main.css": "./static/css/main.5513bd04.css",
|
4
|
-
"main.js": "./static/js/main.
|
4
|
+
"main.js": "./static/js/main.fb185886.js",
|
5
5
|
"static/js/6679.265ca09c.chunk.js": "./static/js/6679.265ca09c.chunk.js",
|
6
6
|
"static/js/9464.7e9a3c0a.chunk.js": "./static/js/9464.7e9a3c0a.chunk.js",
|
7
7
|
"static/js/9077.e0a8db2a.chunk.js": "./static/js/9077.e0a8db2a.chunk.js",
|
@@ -15,7 +15,7 @@
|
|
15
15
|
"static/js/3710.b80be2b0.chunk.js": "./static/js/3710.b80be2b0.chunk.js",
|
16
16
|
"static/js/8148.f51df66c.chunk.js": "./static/js/8148.f51df66c.chunk.js",
|
17
17
|
"static/js/84.414fa87b.chunk.js": "./static/js/84.414fa87b.chunk.js",
|
18
|
-
"static/js/9923.
|
18
|
+
"static/js/9923.790a85e7.chunk.js": "./static/js/9923.790a85e7.chunk.js",
|
19
19
|
"static/js/583.61ac7fde.chunk.js": "./static/js/583.61ac7fde.chunk.js",
|
20
20
|
"static/js/4827.f9cb5fa3.chunk.js": "./static/js/4827.f9cb5fa3.chunk.js",
|
21
21
|
"static/js/8237.b58252d4.chunk.js": "./static/js/8237.b58252d4.chunk.js",
|
@@ -25,22 +25,22 @@
|
|
25
25
|
"static/js/5625.d9509933.chunk.js": "./static/js/5625.d9509933.chunk.js",
|
26
26
|
"static/js/6141.43a8fda3.chunk.js": "./static/js/6141.43a8fda3.chunk.js",
|
27
27
|
"static/js/4103.374d188d.chunk.js": "./static/js/4103.374d188d.chunk.js",
|
28
|
-
"static/js/1086.
|
28
|
+
"static/js/1086.9d39d6cd.chunk.js": "./static/js/1086.9d39d6cd.chunk.js",
|
29
29
|
"static/js/245.f99079b1.chunk.js": "./static/js/245.f99079b1.chunk.js",
|
30
|
-
"static/js/7193.
|
30
|
+
"static/js/7193.7582e347.chunk.js": "./static/js/7193.7582e347.chunk.js",
|
31
31
|
"static/js/6360.6d7cfa35.chunk.js": "./static/js/6360.6d7cfa35.chunk.js",
|
32
32
|
"static/js/8790.0b98f286.chunk.js": "./static/js/8790.0b98f286.chunk.js",
|
33
33
|
"static/js/8815.ef4be53c.chunk.js": "./static/js/8815.ef4be53c.chunk.js",
|
34
34
|
"static/js/9528.746f7a0e.chunk.js": "./static/js/9528.746f7a0e.chunk.js",
|
35
35
|
"static/js/7809.304e2c99.chunk.js": "./static/js/7809.304e2c99.chunk.js",
|
36
36
|
"static/js/6088.1164e19b.chunk.js": "./static/js/6088.1164e19b.chunk.js",
|
37
|
-
"static/js/8166.
|
37
|
+
"static/js/8166.9447a253.chunk.js": "./static/js/8166.9447a253.chunk.js",
|
38
38
|
"static/js/9114.c234641e.chunk.js": "./static/js/9114.c234641e.chunk.js",
|
39
39
|
"static/js/5281.02b3ddc4.chunk.js": "./static/js/5281.02b3ddc4.chunk.js",
|
40
|
-
"static/js/5618.
|
41
|
-
"static/js/1260.
|
40
|
+
"static/js/5618.34479f59.chunk.js": "./static/js/5618.34479f59.chunk.js",
|
41
|
+
"static/js/1260.dc193a5e.chunk.js": "./static/js/1260.dc193a5e.chunk.js",
|
42
42
|
"static/js/3560.ce031236.chunk.js": "./static/js/3560.ce031236.chunk.js",
|
43
|
-
"static/js/954.
|
43
|
+
"static/js/954.ce49a8cf.chunk.js": "./static/js/954.ce49a8cf.chunk.js",
|
44
44
|
"static/js/3966.e0686958.chunk.js": "./static/js/3966.e0686958.chunk.js",
|
45
45
|
"static/js/8161.9b75f98a.chunk.js": "./static/js/8161.9b75f98a.chunk.js",
|
46
46
|
"static/js/6817.6adfea98.chunk.js": "./static/js/6817.6adfea98.chunk.js",
|
@@ -156,6 +156,6 @@
|
|
156
156
|
},
|
157
157
|
"entrypoints": [
|
158
158
|
"static/css/main.5513bd04.css",
|
159
|
-
"static/js/main.
|
159
|
+
"static/js/main.fb185886.js"
|
160
160
|
]
|
161
161
|
}
|
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.fb185886.js"></script><link href="./static/css/main.5513bd04.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[1086],{68035:(e,t,r)=>{r.d(t,{A:()=>c});r(58878);var n=r(25571),o=r(78286),i=r(89653);const a=r(60667).i7`
|
2
|
+
50% {
|
3
|
+
color: rgba(0, 0, 0, 0);
|
4
|
+
}
|
5
|
+
`,s=(0,i.A)("span",{target:"edlqvik0"})((e=>{let{includeDot:t,shouldBlink:r,theme:n}=e;return{...t?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:n.colors.gray,margin:`0 ${n.spacing.twoXS}`}}:{},...r?{color:n.colors.red,animationName:`${a}`,animationDuration:"0.5s",animationIterationCount:5}:{}}}),"");var l=r(90782);const c=e=>{let{dirty:t,value:r,inForm:i,maxLength:a,className:c,type:u="single",allowEnterToSubmit:d=!0}=e;const p=[],f=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];p.push((0,l.jsx)(s,{includeDot:p.length>0,shouldBlink:t,children:e},p.length))};if(d){const e=i?"submit form":"apply";if("multiline"===u){f(`Press ${(0,n.u_)()?"\u2318":"Ctrl"}+Enter to ${e}`)}else"single"===u&&f(`Press Enter to ${e}`)}return a&&("chat"!==u||t)&&f(`${r.length}/${a}`,t&&r.length>=a),(0,l.jsx)(o.tp,{"data-testid":"InputInstructions",className:c,children:p})}},1086:(e,t,r)=>{r.r(t),r.d(t,{default:()=>v});var n=r(58878),o=r(8151),i=r(68102),a=r(68622),s=n.forwardRef((function(e,t){return n.createElement(a.I,(0,i.A)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),n.createElement("rect",{width:24,height:24,fill:"none"}),n.createElement("path",{d:"M3 5.51v3.71c0 .46.31.86.76.97L11 12l-7.24 1.81c-.45.11-.76.51-.76.97v3.71c0 .72.73 1.2 1.39.92l15.42-6.49c.82-.34.82-1.5 0-1.84L4.39 4.58C3.73 4.31 3 4.79 3 5.51z"}))}));s.displayName="Send";var l=r(94928),c=r(64611),u=r(68035),d=r(58144),p=r(89653);const f=(0,p.A)("div",{target:"e1d2x3se4"})((e=>{var t;let{theme:r,width:n}=e;return{borderRadius:r.radii.default,display:"flex",backgroundColor:null!==(t=r.colors.widgetBackgroundColor)&&void 0!==t?t:r.colors.secondaryBg,width:`${n}px`}}),""),h=(0,p.A)("div",{target:"e1d2x3se3"})((e=>{let{theme:t}=e;return{backgroundColor:t.colors.transparent,position:"relative",flexGrow:1,borderRadius:t.radii.default,display:"flex",alignItems:"center"}}),""),y=(0,p.A)("button",{target:"e1d2x3se2"})((e=>{let{theme:t,disabled:r,extended:n}=e;const o=(0,d.iq)(t),[i,a]=o?[t.colors.gray60,t.colors.gray80]:[t.colors.gray80,t.colors.gray40];return{border:"none",backgroundColor:t.colors.transparent,borderTopRightRadius:n?t.radii.none:t.radii.default,borderTopLeftRadius:n?t.radii.default:t.radii.none,borderBottomRightRadius:t.radii.default,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:t.lineHeights.none,margin:t.spacing.none,padding:t.spacing.sm,color:r?i:a,pointerEvents:"auto","&:focus":{outline:"none"},":focus":{outline:"none"},"&:focus-visible":{backgroundColor:o?t.colors.gray10:t.colors.gray90},"&:hover":{backgroundColor:t.colors.primary,color:t.colors.white},"&:disabled, &:disabled:hover, &:disabled:active":{backgroundColor:t.colors.transparent,borderColor:t.colors.transparent,color:t.colors.gray}}}),""),g=(0,p.A)("div",{target:"e1d2x3se1"})((()=>({display:"flex",alignItems:"flex-end",height:"100%",position:"absolute",right:0,pointerEvents:"none"})),""),b=(0,p.A)("div",{target:"e1d2x3se0"})({name:"1lm6gnd",styles:"position:absolute;bottom:0px;right:3rem"});var m=r(90782);const v=function(e){let{width:t,element:r,widgetMgr:i,fragmentId:a}=e;const p=(0,o.u)(),[v,w]=(0,n.useState)(!1),[x,O]=(0,n.useState)(r.default),[j,C]=(0,n.useState)(0),S=(0,n.useRef)(null),A=(0,n.useRef)({minHeight:0,maxHeight:0}),k=()=>{S.current&&S.current.focus(),x&&(i.setStringTriggerValue(r,x,{fromUi:!0},a),w(!1),O(""),C(0))};(0,n.useEffect)((()=>{if(r.setValue){r.setValue=!1;const e=r.value||"";O(e),w(""!==e)}}),[r]),(0,n.useEffect)((()=>{if(S.current){const{offsetHeight:e}=S.current;A.current.minHeight=e,A.current.maxHeight=6.5*e}}),[S]);const{disabled:P,placeholder:R,maxChars:$}=r,E=(0,d.iq)(p),{minHeight:I,maxHeight:T}=A.current,B=E?p.colors.gray70:p.colors.gray80,z=!!(j>0&&S.current)&&Math.abs(j-I)>1;return(0,m.jsx)(f,{className:"stChatInput","data-testid":"stChatInput",width:t,children:(0,m.jsxs)(h,{children:[(0,m.jsx)(l.A,{inputRef:S,value:x,placeholder:R,onChange:e=>{const{value:t}=e.target,{maxChars:n}=r;0!==n&&t.length>n||(w(""!==t),O(t),C((()=>{let e=0;const{current:t}=S;if(t){const r=t.placeholder;t.placeholder="",t.style.height="auto",e=t.scrollHeight,t.placeholder=r,t.style.height=""}return e})()))},onKeyDown:e=>{const{metaKey:t,ctrlKey:r,shiftKey:n}=e;(e=>{var t;const{keyCode:r,key:n}=e;return("Enter"===n||13===r||10===r)&&!(!0===(null===(t=e.nativeEvent)||void 0===t?void 0:t.isComposing))})(e)&&!n&&!r&&!t&&(e.preventDefault(),k())},"aria-label":R,disabled:P,rows:1,overrides:{Root:{style:{minHeight:p.sizes.minElementHeight,outline:"none",backgroundColor:p.colors.transparent,borderLeftWidth:p.sizes.borderWidth,borderRightWidth:p.sizes.borderWidth,borderTopWidth:p.sizes.borderWidth,borderBottomWidth:p.sizes.borderWidth,width:`${t}px`}},InputContainer:{style:{backgroundColor:p.colors.transparent}},Input:{props:{"data-testid":"stChatInputTextArea"},style:{lineHeight:p.lineHeights.inputWidget,backgroundColor:p.colors.transparent,"::placeholder":{color:B},height:z?`${j+1}px`:"auto",maxHeight:T?`${T}px`:"none",paddingRight:"3rem",paddingLeft:p.spacing.sm,paddingBottom:p.spacing.sm,paddingTop:p.spacing.sm}}}}),t>p.breakpoints.hideWidgetDetails&&(0,m.jsx)(b,{children:(0,m.jsx)(u.A,{dirty:v,value:x,maxLength:$,type:"chat",inForm:!1})}),(0,m.jsx)(g,{children:(0,m.jsx)(y,{onClick:k,disabled:!v||P,extended:z,"data-testid":"stChatInputSubmitButton",children:(0,m.jsx)(c.A,{content:s,size:"xl",color:"inherit"})})})]})})}},94928:(e,t,r)=>{r.d(t,{A:()=>A});var n=r(58878),o=r(35331),i=r(18648),a=r(92850),s=r(57224),l=r(81301);function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach((function(t){d(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var p=(0,s.I4)("div",(function(e){return u(u({},(0,l.vt)(u(u({$positive:!1},e),{},{$hasIconTrailing:!1}))),{},{width:e.$resize?"fit-content":"100%"})}));p.displayName="StyledTextAreaRoot",p.displayName="StyledTextAreaRoot";var f=(0,s.I4)("div",(function(e){return(0,l.EO)(u({$positive:!1},e))}));f.displayName="StyledTextareaContainer",f.displayName="StyledTextareaContainer";var h=(0,s.I4)("textarea",(function(e){return u(u({},(0,l.n)(e)),{},{resize:e.$resize||"none"})}));function y(e){return y="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},y(e)}function g(){return g=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},g.apply(this,arguments)}function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(l){s=!0,o=l}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return m(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return m(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function v(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function w(e,t){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},w(e,t)}function x(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 r,n=j(e);if(t){var o=j(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===y(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return O(e)}(this,r)}}function O(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j(e){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},j(e)}function C(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}h.displayName="StyledTextarea",h.displayName="StyledTextarea";var 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&&w(e,t)}(c,e);var t,r,s,l=x(c);function c(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return C(O(e=l.call.apply(l,[this].concat(r))),"state",{isFocused:e.props.autoFocus||!1}),C(O(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t)})),C(O(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t)})),e}return t=c,(r=[{key:"render",value:function(){var e=this.props.overrides,t=void 0===e?{}:e,r=b((0,o._O)(t.Root,p),2),s=r[0],l=r[1],c=(0,o.Qp)({Input:{component:h},InputContainer:{component:f}},t);return n.createElement(s,g({"data-baseweb":"textarea",$isFocused:this.state.isFocused,$isReadOnly:this.props.readOnly,$disabled:this.props.disabled,$error:this.props.error,$positive:this.props.positive,$required:this.props.required,$resize:this.props.resize},l),n.createElement(i.A,g({},this.props,{type:a.GT.textarea,overrides:c,onFocus:this.onFocus,onBlur:this.onBlur,resize:this.props.resize})))}}])&&v(t.prototype,r),s&&v(t,s),Object.defineProperty(t,"prototype",{writable:!1}),c}(n.Component);C(S,"defaultProps",{autoFocus:!1,disabled:!1,readOnly:!1,error:!1,name:"",onBlur:function(){},onChange:function(){},onKeyDown:function(){},onKeyPress:function(){},onKeyUp:function(){},onFocus:function(){},overrides:{},placeholder:"",required:!1,rows:3,size:a.SK.default});const A=S}}]);
|
@@ -0,0 +1,5 @@
|
|
1
|
+
(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[1260],{68035:(t,e,r)=>{"use strict";r.d(e,{A:()=>u});r(58878);var n=r(25571),o=r(78286),i=r(89653);const s=r(60667).i7`
|
2
|
+
50% {
|
3
|
+
color: rgba(0, 0, 0, 0);
|
4
|
+
}
|
5
|
+
`,a=(0,i.A)("span",{target:"edlqvik0"})((t=>{let{includeDot:e,shouldBlink:r,theme:n}=t;return{...e?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:n.colors.gray,margin:`0 ${n.spacing.twoXS}`}}:{},...r?{color:n.colors.red,animationName:`${s}`,animationDuration:"0.5s",animationIterationCount:5}:{}}}),"");var l=r(90782);const u=t=>{let{dirty:e,value:r,inForm:i,maxLength:s,className:u,type:c="single",allowEnterToSubmit:d=!0}=t;const p=[],h=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];p.push((0,l.jsx)(a,{includeDot:p.length>0,shouldBlink:e,children:t},p.length))};if(d){const t=i?"submit form":"apply";if("multiline"===c){h(`Press ${(0,n.u_)()?"\u2318":"Ctrl"}+Enter to ${t}`)}else"single"===c&&h(`Press Enter to ${t}`)}return s&&("chat"!==c||e)&&h(`${r.length}/${s}`,e&&r.length>=s),(0,l.jsx)(o.tp,{"data-testid":"InputInstructions",className:u,children:p})}},34752:(t,e,r)=>{"use strict";r.d(e,{X:()=>s,o:()=>i});var n=r(58878),o=r(25571);class i{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(t,e,r){(0,o.se)(this.formClearListener)&&this.lastWidgetMgr===t&&this.lastFormId===e||(this.disconnect(),(0,o._L)(e)&&(this.formClearListener=t.addFormClearedListener(e,r),this.lastWidgetMgr=t,this.lastFormId=e))}disconnect(){var t;null===(t=this.formClearListener)||void 0===t||t.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function s(t){let{element:e,widgetMgr:r,onFormCleared:i}=t;(0,n.useEffect)((()=>{if(!(0,o._L)(e.formId))return;const t=r.addFormClearedListener(e.formId,i);return()=>{t.disconnect()}}),[e,r,i])}},81260:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>v});var n=r(58878),o=r(32698),i=r.n(o),s=r(59095),a=r(8151),l=r(29669),u=r(34752),c=r(68035),d=r(70474),p=r(78286),h=r(93480),f=r(997),m=r(25571);const y=(0,r(89653).A)("div",{target:"e11y4ecf0"})((t=>{let{width:e}=t;return{position:"relative",width:e}}),"");var b=r(90782);class g extends n.PureComponent{constructor(t){var e;super(t),e=this,this.formClearHelper=new u.o,this.id=void 0,this.state={dirty:!1,focused:!1,value:this.initialValue},this.commitWidgetValue=function(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{widgetMgr:n,element:o,fragmentId:i}=e.props;n.setStringValue(o,e.state.value,t,i),r&&e.setState({dirty:!1})},this.onFormCleared=()=>{this.setState(((t,e)=>{var r;return{value:null!==(r=e.element.default)&&void 0!==r?r:null}}),(()=>this.commitWidgetValue({fromUi:!0})))},this.onBlur=()=>{this.state.dirty&&this.commitWidgetValue({fromUi:!0}),this.setState({focused:!1})},this.onFocus=()=>this.setState({focused:!0}),this.onChange=t=>{const{value:e}=t.target,{element:r}=this.props,{maxChars:n}=r;0!==n&&e.length>n||((0,m.Ml)(this.props.element)?this.setState({dirty:!0,value:e},(()=>{this.commitWidgetValue({fromUi:!0},!1)})):this.setState({dirty:!0,value:e}))},this.onKeyPress=t=>{const{element:e,widgetMgr:r,fragmentId:n}=this.props,{formId:o}=e,i=r.allowFormEnterToSubmit(o);"Enter"===t.key&&(this.state.dirty&&this.commitWidgetValue({fromUi:!0}),i&&r.submitForm(o,n))},this.id=i()("text_input_")}get initialValue(){var t;const e=this.props.widgetMgr.getStringValue(this.props.element);return null!==(t=null!==e&&void 0!==e?e:this.props.element.default)&&void 0!==t?t:null}componentDidMount(){this.props.element.setValue?this.updateFromProtobuf():this.commitWidgetValue({fromUi:!1})}componentDidUpdate(){this.maybeUpdateFromProtobuf()}componentWillUnmount(){this.formClearHelper.disconnect()}maybeUpdateFromProtobuf(){const{setValue:t}=this.props.element;t&&this.updateFromProtobuf()}updateFromProtobuf(){const{value:t}=this.props.element;this.props.element.setValue=!1,this.setState({value:null!==t&&void 0!==t?t:null},(()=>{this.commitWidgetValue({fromUi:!1})}))}getTypeString(){return this.props.element.type===l.ks.Type.PASSWORD?"password":"text"}render(){var t;const{dirty:e,focused:r,value:n}=this.state,{element:o,width:i,disabled:a,widgetMgr:l,theme:u}=this.props,{placeholder:g,formId:v}=o,w=(0,m.Ml)({formId:v})?l.allowFormEnterToSubmit(v):e,O=r&&i>u.breakpoints.hideWidgetDetails;return this.formClearHelper.manageFormClearListener(l,v,this.onFormCleared),(0,b.jsxs)(y,{className:"stTextInput","data-testid":"stTextInput",width:i,children:[(0,b.jsx)(d.L,{label:o.label,disabled:a,labelVisibility:(0,m.yv)(null===(t=o.labelVisibility)||void 0===t?void 0:t.value),htmlFor:this.id,children:o.help&&(0,b.jsx)(p.j,{children:(0,b.jsx)(h.A,{content:o.help,placement:f.W.TOP_RIGHT})})}),(0,b.jsx)(s.A,{value:null!==n&&void 0!==n?n:"",placeholder:g,onBlur:this.onBlur,onFocus:this.onFocus,onChange:this.onChange,onKeyPress:this.onKeyPress,"aria-label":o.label,disabled:a,id:this.id,type:this.getTypeString(),autoComplete:o.autocomplete,overrides:{Input:{style:{minWidth:0,"::placeholder":{opacity:"0.7"},lineHeight:u.lineHeights.inputWidget,paddingRight:u.spacing.sm,paddingLeft:u.spacing.sm,paddingBottom:u.spacing.sm,paddingTop:u.spacing.sm}},Root:{props:{"data-testid":"stTextInputRootElement"},style:{height:u.sizes.minElementHeight,borderLeftWidth:u.sizes.borderWidth,borderRightWidth:u.sizes.borderWidth,borderTopWidth:u.sizes.borderWidth,borderBottomWidth:u.sizes.borderWidth}}}}),O&&(0,b.jsx)(c.A,{dirty:e,value:null!==n&&void 0!==n?n:"",maxLength:o.maxChars,inForm:(0,m.Ml)({formId:v}),allowEnterToSubmit:w})]})}}const v=(0,a.b)(g)},59095:(t,e,r)=>{"use strict";r.d(e,{A:()=>E});var n=r(58878),o=r(35331),i=r(4842),s=r(18648),a=r(81301),l=r(92850);function u(t){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u(t)}var c=["Root","StartEnhancer","EndEnhancer"],d=["startEnhancer","endEnhancer","overrides"];function p(){return p=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},p.apply(this,arguments)}function h(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!==typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,o,i=[],s=!0,a=!1;try{for(r=r.call(t);!(s=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);s=!0);}catch(l){a=!0,o=l}finally{try{s||null==r.return||r.return()}finally{if(a)throw o}}return i}(t,e)||function(t,e){if(!t)return;if("string"===typeof t)return f(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function m(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function y(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function b(t,e){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},b(t,e)}function g(t){var e=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(t){return!1}}();return function(){var r,n=w(t);if(e){var o=w(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(t,e){if(e&&("object"===u(e)||"function"===typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return v(t)}(this,r)}}function v(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function w(t){return w=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},w(t)}function O(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var S=function(t){!function(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&b(t,e)}(w,t);var e,r,u,f=g(w);function w(){var t;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,w);for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return O(v(t=f.call.apply(f,[this].concat(r))),"state",{isFocused:t.props.autoFocus||!1}),O(v(t),"onFocus",(function(e){t.setState({isFocused:!0}),t.props.onFocus(e)})),O(v(t),"onBlur",(function(e){t.setState({isFocused:!1}),t.props.onBlur(e)})),t}return e=w,(r=[{key:"render",value:function(){var t=this.props,e=t.startEnhancer,r=t.endEnhancer,u=t.overrides,f=u.Root,y=u.StartEnhancer,b=u.EndEnhancer,g=m(u,c),v=m(t,d),w=h((0,o._O)(f,a.bL),2),O=w[0],S=w[1],E=h((0,o._O)(y,a.P2),2),C=E[0],P=E[1],x=h((0,o._O)(b,a.P2),2),I=x[0],W=x[1],_=(0,i.e)(this.props,this.state);return n.createElement(O,p({"data-baseweb":"input"},_,S,{$adjoined:F(e,r),$hasIconTrailing:this.props.clearable||"password"==this.props.type}),j(e)&&n.createElement(C,p({},_,P,{$position:l.vN.start}),"function"===typeof e?e(_):e),n.createElement(s.A,p({},v,{overrides:g,adjoined:F(e,r),onFocus:this.onFocus,onBlur:this.onBlur})),j(r)&&n.createElement(I,p({},_,W,{$position:l.vN.end}),"function"===typeof r?r(_):r))}}])&&y(e.prototype,r),u&&y(e,u),Object.defineProperty(e,"prototype",{writable:!1}),w}(n.Component);function F(t,e){return j(t)&&j(e)?l.fb.both:j(t)?l.fb.left:j(e)?l.fb.right:l.fb.none}function j(t){return Boolean(t||0===t)}O(S,"defaultProps",{autoComplete:"on",autoFocus:!1,disabled:!1,name:"",onBlur:function(){},onFocus:function(){},overrides:{},required:!1,size:l.SK.default,startEnhancer:null,endEnhancer:null,clearable:!1,type:"text",readOnly:!1});const E=S},32698:(t,e,r)=>{var n=r(30136),o=0;t.exports=function(t){var e=++o;return n(t)+e}}}]);
|
@@ -0,0 +1,5 @@
|
|
1
|
+
(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[5618],{68035:(e,t,r)=>{"use strict";r.d(t,{A:()=>u});r(58878);var n=r(25571),o=r(78286),i=r(89653);const s=r(60667).i7`
|
2
|
+
50% {
|
3
|
+
color: rgba(0, 0, 0, 0);
|
4
|
+
}
|
5
|
+
`,a=(0,i.A)("span",{target:"edlqvik0"})((e=>{let{includeDot:t,shouldBlink:r,theme:n}=e;return{...t?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:n.colors.gray,margin:`0 ${n.spacing.twoXS}`}}:{},...r?{color:n.colors.red,animationName:`${s}`,animationDuration:"0.5s",animationIterationCount:5}:{}}}),"");var l=r(90782);const u=e=>{let{dirty:t,value:r,inForm:i,maxLength:s,className:u,type:c="single",allowEnterToSubmit:d=!0}=e;const p=[],f=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];p.push((0,l.jsx)(a,{includeDot:p.length>0,shouldBlink:t,children:e},p.length))};if(d){const e=i?"submit form":"apply";if("multiline"===c){f(`Press ${(0,n.u_)()?"\u2318":"Ctrl"}+Enter to ${e}`)}else"single"===c&&f(`Press Enter to ${e}`)}return s&&("chat"!==c||t)&&f(`${r.length}/${s}`,t&&r.length>=s),(0,l.jsx)(o.tp,{"data-testid":"InputInstructions",className:u,children:p})}},34752:(e,t,r)=>{"use strict";r.d(t,{X:()=>s,o:()=>i});var n=r(58878),o=r(25571);class i{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,r){(0,o.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,o._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,r),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}}function s(e){let{element:t,widgetMgr:r,onFormCleared:i}=e;(0,n.useEffect)((()=>{if(!(0,o._L)(t.formId))return;const e=r.addFormClearedListener(t.formId,i);return()=>{e.disconnect()}}),[t,r,i])}},25618:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>b});var n=r(58878),o=r(94928),i=r(8151),s=r(32698),a=r.n(s),l=r(34752),u=r(68035),c=r(70474),d=r(78286),p=r(93480),f=r(997),h=r(25571),m=r(90782);class y extends n.PureComponent{get initialValue(){var e;const t=this.props.widgetMgr.getStringValue(this.props.element);return null!==(e=null!==t&&void 0!==t?t:this.props.element.default)&&void 0!==e?e:null}constructor(e){super(e),this.formClearHelper=new l.o,this.id=void 0,this.state={dirty:!1,focused:!1,value:this.initialValue},this.commitWidgetValue=e=>{const{widgetMgr:t,element:r,fragmentId:n}=this.props;t.setStringValue(r,this.state.value,e,n),this.setState({dirty:!1})},this.onFormCleared=()=>{this.setState(((e,t)=>{var r;return{value:null!==(r=t.element.default)&&void 0!==r?r:null}}),(()=>this.commitWidgetValue({fromUi:!0})))},this.onBlur=()=>{this.state.dirty&&this.commitWidgetValue({fromUi:!0}),this.setState({focused:!1})},this.onFocus=()=>this.setState({focused:!0}),this.onChange=e=>{const{value:t}=e.target,{element:r}=this.props,{maxChars:n}=r;0!==n&&t.length>n||this.setState({dirty:!0,value:t})},this.isEnterKeyPressed=e=>{var t;const{keyCode:r,key:n}=e;return("Enter"===n||13===r||10===r)&&!(!0===(null===(t=e.nativeEvent)||void 0===t?void 0:t.isComposing))},this.onKeyDown=e=>{const{metaKey:t,ctrlKey:r}=e,{dirty:n}=this.state,{element:o,widgetMgr:i,fragmentId:s}=this.props,{formId:a}=o,l=i.allowFormEnterToSubmit(a);this.isEnterKeyPressed(e)&&(r||t)&&n&&(e.preventDefault(),this.commitWidgetValue({fromUi:!0}),l&&i.submitForm(a,s))},this.id=a()("text_area_")}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:null!==e&&void 0!==e?e:null},(()=>{this.commitWidgetValue({fromUi:!1})}))}render(){var e;const{element:t,disabled:r,width:n,widgetMgr:i,theme:s}=this.props,{dirty:a,focused:l,value:y}=this.state,b={width:n},{height:g,placeholder:v,formId:w}=t,O=(0,h.Ml)({formId:w})?i.allowFormEnterToSubmit(w):a,j=l&&n>s.breakpoints.hideWidgetDetails;this.formClearHelper.manageFormClearListener(i,w,this.onFormCleared);const F=g&&g<95?`${g}px`:"95px";return(0,m.jsxs)("div",{className:"stTextArea","data-testid":"stTextArea",style:b,children:[(0,m.jsx)(c.L,{label:t.label,disabled:r,labelVisibility:(0,h.yv)(null===(e=t.labelVisibility)||void 0===e?void 0:e.value),htmlFor:this.id,children:t.help&&(0,m.jsx)(d.j,{children:(0,m.jsx)(p.A,{content:t.help,placement:f.W.TOP_RIGHT})})}),(0,m.jsx)(o.A,{value:null!==y&&void 0!==y?y:"",placeholder:v,onBlur:this.onBlur,onFocus:this.onFocus,onChange:this.onChange,onKeyDown:this.onKeyDown,"aria-label":t.label,disabled:r,id:this.id,overrides:{Input:{style:{lineHeight:s.lineHeights.inputWidget,height:g?`${g}px`:"",minHeight:F,resize:"vertical","::placeholder":{opacity:"0.7"},paddingRight:s.spacing.lg,paddingLeft:s.spacing.lg,paddingBottom:s.spacing.lg,paddingTop:s.spacing.lg}},Root:{props:{"data-testid":"stTextAreaRootElement"},style:{borderLeftWidth:s.sizes.borderWidth,borderRightWidth:s.sizes.borderWidth,borderTopWidth:s.sizes.borderWidth,borderBottomWidth:s.sizes.borderWidth}}}}),j&&(0,m.jsx)(u.A,{dirty:a,value:null!==y&&void 0!==y?y:"",maxLength:t.maxChars,type:"multiline",inForm:(0,h.Ml)({formId:w}),allowEnterToSubmit:O})]})}}const b=(0,i.b)(y)},94928:(e,t,r)=>{"use strict";r.d(t,{A:()=>x});var n=r(58878),o=r(35331),i=r(18648),s=r(92850),a=r(57224),l=r(81301);function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){d(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var p=(0,a.I4)("div",(function(e){return c(c({},(0,l.vt)(c(c({$positive:!1},e),{},{$hasIconTrailing:!1}))),{},{width:e.$resize?"fit-content":"100%"})}));p.displayName="StyledTextAreaRoot",p.displayName="StyledTextAreaRoot";var f=(0,a.I4)("div",(function(e){return(0,l.EO)(c({$positive:!1},e))}));f.displayName="StyledTextareaContainer",f.displayName="StyledTextareaContainer";var h=(0,a.I4)("textarea",(function(e){return c(c({},(0,l.n)(e)),{},{resize:e.$resize||"none"})}));function m(e){return m="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},m(e)}function y(){return y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},y.apply(this,arguments)}function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,i=[],s=!0,a=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);s=!0);}catch(l){a=!0,o=l}finally{try{s||null==r.return||r.return()}finally{if(a)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return g(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function v(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function w(e,t){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},w(e,t)}function O(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 r,n=F(e);if(t){var o=F(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===m(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return j(e)}(this,r)}}function j(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function F(e){return F=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},F(e)}function S(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}h.displayName="StyledTextarea",h.displayName="StyledTextarea";var C=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&&w(e,t)}(u,e);var t,r,a,l=O(u);function u(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return S(j(e=l.call.apply(l,[this].concat(r))),"state",{isFocused:e.props.autoFocus||!1}),S(j(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t)})),S(j(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t)})),e}return t=u,(r=[{key:"render",value:function(){var e=this.props.overrides,t=void 0===e?{}:e,r=b((0,o._O)(t.Root,p),2),a=r[0],l=r[1],u=(0,o.Qp)({Input:{component:h},InputContainer:{component:f}},t);return n.createElement(a,y({"data-baseweb":"textarea",$isFocused:this.state.isFocused,$isReadOnly:this.props.readOnly,$disabled:this.props.disabled,$error:this.props.error,$positive:this.props.positive,$required:this.props.required,$resize:this.props.resize},l),n.createElement(i.A,y({},this.props,{type:s.GT.textarea,overrides:u,onFocus:this.onFocus,onBlur:this.onBlur,resize:this.props.resize})))}}])&&v(t.prototype,r),a&&v(t,a),Object.defineProperty(t,"prototype",{writable:!1}),u}(n.Component);S(C,"defaultProps",{autoFocus:!1,disabled:!1,readOnly:!1,error:!1,name:"",onBlur:function(){},onChange:function(){},onKeyDown:function(){},onKeyPress:function(){},onKeyUp:function(){},onFocus:function(){},overrides:{},placeholder:"",required:!1,rows:3,size:s.SK.default});const x=C},32698:(e,t,r)=>{var n=r(30136),o=0;e.exports=function(e){var t=++o;return n(e)+t}}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[7193],{17193:(e,t,r)=>{r.r(t),r.d(t,{default:()=>m});var a=r(58878),l=r(42637),i=r(25571),d=r(3101),o=r(90782);const s=(e,t)=>e.getStringValue(t),n=e=>{var t;return null!==(t=e.default)&&void 0!==t?t:null},g=e=>{var t;return null!==(t=e.value)&&void 0!==t?t:null},u=(e,t,r,a)=>{t.setStringValue(e,r.value,{fromUi:r.fromUi},a)},m=e=>{var t;let{element:r,disabled:m,widgetMgr:f,width:v,fragmentId:c}=e;const[h,M]=(0,d.t)({getStateFromWidgetMgr:s,getDefaultStateFromProto:n,getCurrStateFromProto:g,updateWidgetMgrState:u,element:r,widgetMgr:f,fragmentId:c}),C=(0,a.useCallback)((e=>{M({value:e,fromUi:!0})}),[M]);return(0,o.jsx)(l.A,{label:r.label,labelVisibility:(0,i.yv)(null===(t=r.labelVisibility)||void 0===t?void 0:t.value),help:r.help,onChange:C,disabled:m,width:v,value:h})}},34752:(e,t,r)=>{r.d(t,{X:()=>d,o:()=>i});var a=r(58878),l=r(25571);class i{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,r){(0,l.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,l._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,r),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}}function d(e){let{element:t,widgetMgr:r,onFormCleared:i}=e;(0,a.useEffect)((()=>{if(!(0,l._L)(t.formId))return;const e=r.addFormClearedListener(t.formId,i);return()=>{e.disconnect()}}),[t,r,i])}},3101:(e,t,r)=>{r.d(t,{_:()=>d,t:()=>o});var a=r(58878),l=r(34752),i=r(25571);function d(e){let{getStateFromWidgetMgr:t,getDefaultState:r,updateWidgetMgrState:d,element:o,widgetMgr:s,fragmentId:n}=e;const[g,u]=(0,a.useState)((()=>{var e;return null!==(e=t(s,o))&&void 0!==e?e:r(s,o)})),[m,f]=(0,a.useState)({value:g,fromUi:!1});(0,a.useEffect)((()=>{(0,i.hX)(m)||(f(null),u(m.value),d(o,s,m,n))}),[m,d,o,s,n]);const v=(0,a.useCallback)((()=>{f({value:r(s,o),fromUi:!0})}),[f,o,r,s]);return(0,l.X)({widgetMgr:s,element:o,onFormCleared:v}),[g,f]}function o(e){let{getStateFromWidgetMgr:t,getDefaultStateFromProto:r,getCurrStateFromProto:l,updateWidgetMgrState:i,element:o,widgetMgr:s,fragmentId:n}=e;const g=(0,a.useCallback)(((e,t)=>r(t)),[r]),[u,m]=d({getStateFromWidgetMgr:t,getDefaultState:g,updateWidgetMgrState:i,element:o,widgetMgr:s,fragmentId:n});return(0,a.useEffect)((()=>{o.setValue&&(o.setValue=!1,m({value:l(o),fromUi:!1}))}),[o,l,m]),[u,m]}}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[8166],{34752:(e,t,r)=>{r.d(t,{X:()=>o,o:()=>i});var a=r(58878),l=r(25571);class i{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,r){(0,l.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,l._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,r),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}}function o(e){let{element:t,widgetMgr:r,onFormCleared:i}=e;(0,a.useEffect)((()=>{if(!(0,l._L)(t.formId))return;const e=r.addFormClearedListener(t.formId,i);return()=>{e.disconnect()}}),[t,r,i])}},38166:(e,t,r)=>{r.r(t),r.d(t,{default:()=>m});var a=r(58878),l=r(4871),i=r(25571),o=r(3101),d=r(90782);const s=(e,t)=>e.getIntValue(t),n=e=>{var t;return null!==(t=e.default)&&void 0!==t?t:null},u=e=>{var t;return null!==(t=e.value)&&void 0!==t?t:null},g=(e,t,r,a)=>{t.setIntValue(e,r.value,{fromUi:r.fromUi},a)},m=e=>{let{disabled:t,element:r,widgetMgr:m,width:f,fragmentId:c}=e;const{options:v,help:h,label:M,labelVisibility:C,placeholder:p}=r,[F,S]=(0,o.t)({getStateFromWidgetMgr:s,getDefaultStateFromProto:n,getCurrStateFromProto:u,updateWidgetMgrState:g,element:r,widgetMgr:m,fragmentId:c}),b=(0,a.useCallback)((e=>{S({value:e,fromUi:!0})}),[S]),I=(0,i.hX)(r.default)&&!t;return(0,d.jsx)(l.Ay,{label:M,labelVisibility:(0,i.yv)(null===C||void 0===C?void 0:C.value),options:v,disabled:t,width:f,onChange:b,value:F,help:h,placeholder:p,clearable:I})}},3101:(e,t,r)=>{r.d(t,{_:()=>o,t:()=>d});var a=r(58878),l=r(34752),i=r(25571);function o(e){let{getStateFromWidgetMgr:t,getDefaultState:r,updateWidgetMgrState:o,element:d,widgetMgr:s,fragmentId:n}=e;const[u,g]=(0,a.useState)((()=>{var e;return null!==(e=t(s,d))&&void 0!==e?e:r(s,d)})),[m,f]=(0,a.useState)({value:u,fromUi:!1});(0,a.useEffect)((()=>{(0,i.hX)(m)||(f(null),g(m.value),o(d,s,m,n))}),[m,o,d,s,n]);const c=(0,a.useCallback)((()=>{f({value:r(s,d),fromUi:!0})}),[f,d,r,s]);return(0,l.X)({widgetMgr:s,element:d,onFormCleared:c}),[u,f]}function d(e){let{getStateFromWidgetMgr:t,getDefaultStateFromProto:r,getCurrStateFromProto:l,updateWidgetMgrState:i,element:d,widgetMgr:s,fragmentId:n}=e;const u=(0,a.useCallback)(((e,t)=>r(t)),[r]),[g,m]=o({getStateFromWidgetMgr:t,getDefaultState:u,updateWidgetMgrState:i,element:d,widgetMgr:s,fragmentId:n});return(0,a.useEffect)((()=>{d.setValue&&(d.setValue=!1,m({value:l(d),fromUi:!1}))}),[d,l,m]),[g,m]}}}]);
|
@@ -0,0 +1,5 @@
|
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[954],{68035:(e,t,r)=>{r.d(t,{A:()=>d});r(58878);var o=r(25571),i=r(78286),l=r(89653);const n=r(60667).i7`
|
2
|
+
50% {
|
3
|
+
color: rgba(0, 0, 0, 0);
|
4
|
+
}
|
5
|
+
`,a=(0,l.A)("span",{target:"edlqvik0"})((e=>{let{includeDot:t,shouldBlink:r,theme:o}=e;return{...t?{"&::before":{opacity:1,content:'"\u2022"',animation:"none",color:o.colors.gray,margin:`0 ${o.spacing.twoXS}`}}:{},...r?{color:o.colors.red,animationName:`${n}`,animationDuration:"0.5s",animationIterationCount:5}:{}}}),"");var s=r(90782);const d=e=>{let{dirty:t,value:r,inForm:l,maxLength:n,className:d,type:u="single",allowEnterToSubmit:c=!0}=e;const p=[],m=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];p.push((0,s.jsx)(a,{includeDot:p.length>0,shouldBlink:t,children:e},p.length))};if(c){const e=l?"submit form":"apply";if("multiline"===u){m(`Press ${(0,o.u_)()?"\u2318":"Ctrl"}+Enter to ${e}`)}else"single"===u&&m(`Press Enter to ${e}`)}return n&&("chat"!==u||t)&&m(`${r.length}/${n}`,t&&r.length>=n),(0,s.jsx)(i.tp,{"data-testid":"InputInstructions",className:d,children:p})}},34752:(e,t,r)=>{r.d(t,{X:()=>n,o:()=>l});var o=r(58878),i=r(25571);class l{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,r){(0,i.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,i._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,r),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}}function n(e){let{element:t,widgetMgr:r,onFormCleared:l}=e;(0,o.useEffect)((()=>{if(!(0,i._L)(t.formId))return;const e=r.addFormClearedListener(t.formId,l);return()=>{e.disconnect()}}),[t,r,l])}},10954:(e,t,r)=>{r.r(t),r.d(t,{default:()=>j});var o=r(58878),i=r(27774),l=r(94388),n=r(8151),a=r(34694),s=r(59095),d=r(32698),u=r.n(d),c=r(25571),p=r(34752),m=r(84996),h=r(29669),g=r(93480),b=r(997),f=r(64611),v=r(68035),y=r(70474),w=r(78286),I=r(89653);const C=(0,I.A)("div",{target:"e116k4er3"})((e=>{let{theme:t}=e;return{display:"flex",flexDirection:"row",flexWrap:"nowrap",alignItems:"center",height:t.sizes.minElementHeight,borderWidth:t.sizes.borderWidth,borderStyle:"solid",borderColor:t.colors.widgetBorderColor||t.colors.widgetBackgroundColor||t.colors.bgColor,transitionDuration:"200ms",transitionProperty:"border",transitionTimingFunction:"cubic-bezier(0.2, 0.8, 0.4, 1)",borderRadius:t.radii.default,overflow:"hidden","&.focused":{borderColor:t.colors.primary},input:{MozAppearance:"textfield","&::-webkit-inner-spin-button, &::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:t.spacing.none}}}}),""),T=(0,I.A)("div",{target:"e116k4er2"})({name:"76z9jo",styles:"display:flex;flex-direction:row;align-self:stretch"}),x=(0,I.A)("button",{target:"e116k4er1"})((e=>{let{theme:t}=e;return{margin:t.spacing.none,border:"none",height:t.sizes.full,display:"flex",alignItems:"center",width:"32px",justifyContent:"center",color:t.colors.bodyText,transition:"color 300ms, backgroundColor 300ms",backgroundColor:t.colors.widgetBackgroundColor||t.colors.secondaryBg,"&:hover:enabled, &:focus:enabled":{color:t.colors.white,backgroundColor:t.colors.primary,transition:"none",outline:"none"},"&:active":{outline:"none",border:"none"},"&:last-of-type":{borderTopRightRadius:t.radii.default,borderBottomRightRadius:t.radii.default},"&:disabled":{cursor:"not-allowed",color:t.colors.fadedText40}}}),""),k=(0,I.A)("div",{target:"e116k4er0"})((e=>{let{theme:t,clearable:r}=e;return{position:"absolute",marginRight:t.spacing.twoXS,left:0,right:64+(r?12:0)+"px"}}),"");var F=r(90782);const R=e=>{let{step:t,dataType:r}=e;return t||(r===h.Q7.DataType.INT?1:.01)},D=e=>{let{value:t,format:r,step:o,dataType:i}=e;if((0,c.hX)(t))return null;let l=function(e){return(0,c.hX)(e)||""===e?void 0:e}(r);if((0,c.hX)(l)&&(0,c.se)(o)){const e=o.toString();if(i===h.Q7.DataType.FLOAT&&0!==o&&e.includes(".")){l=`%0.${e.split(".")[1].length}f`}}if((0,c.hX)(l))return t.toString();try{return(0,a.sprintf)(l,t)}catch(n){return(0,m.FF)(`Error in sprintf(${l}, ${t}): ${n}`),String(t)}},j=(0,n.b)((e=>{var t;let{disabled:r,element:n,widgetMgr:a,width:d,theme:m,fragmentId:I}=e;const{dataType:j,id:L,formId:S,default:A,format:N}=n,W=n.hasMin?n.min:-1/0,E=n.hasMax?n.max:1/0,[M,B]=o.useState(R(n)),X=(e=>{var t;const r=e.element.dataType===h.Q7.DataType.INT?e.widgetMgr.getIntValue(e.element):e.widgetMgr.getDoubleValue(e.element);return null!==(t=null!==r&&void 0!==r?r:e.element.default)&&void 0!==t?t:null})({element:n,widgetMgr:a}),[$,V]=o.useState(!1),[_,U]=o.useState(X),[z,Q]=o.useState(D({value:X,...n,step:M})),[H,P]=o.useState(!1),O=o.useRef(null),G=o.useRef(new p.o),K=o.useRef(u()("number_input_")),q=((e,t,r)=>!(0,c.hX)(e)&&e-t>=r)(_,M,W),J=((e,t,r)=>!(0,c.hX)(e)&&e+t<=r)(_,M,E),Y=(0,c.Ml)({formId:S}),Z=Y?a.allowFormEnterToSubmit(S):$,ee=H&&d>m.breakpoints.hideWidgetDetails;o.useEffect((()=>{B(R({step:n.step,dataType:n.dataType}))}),[n.dataType,n.step]);const te=o.useCallback((e=>{let{value:t,source:r}=e;if((0,c.se)(t)&&(W>t||t>E)){var o;null===(o=O.current)||void 0===o||o.reportValidity()}else{var i;const e=null!==(i=null!==t&&void 0!==t?t:A)&&void 0!==i?i:null;switch(j){case h.Q7.DataType.INT:a.setIntValue({id:L,formId:S},e,r,I);break;case h.Q7.DataType.FLOAT:a.setDoubleValue({id:L,formId:S},e,r,I);break;default:throw new Error("Invalid data type")}V(!1),U(e),Q(D({value:e,dataType:j,format:N,step:M}))}}),[W,E,O,a,I,M,j,L,S,A,N]),re=()=>{const{value:e}=n;n.setValue=!1,U(null!==e&&void 0!==e?e:null),Q(D({value:null!==e&&void 0!==e?e:null,...n,step:M})),te({value:null!==e&&void 0!==e?e:null,source:{fromUi:!1}})};o.useEffect((()=>{const e=G.current;return n.setValue?re():te({value:_,source:{fromUi:!1}}),()=>{e.disconnect()}}),[]),n.setValue&&re();const oe=(0,c.hX)(n.default)&&!r;G.current.manageFormClearListener(a,n.formId,(()=>{var e;U(null!==(e=n.default)&&void 0!==e?e:null),te({value:_,source:{fromUi:!0}})}));const ie=o.useCallback((()=>{J&&(V(!0),te({value:(null!==_&&void 0!==_?_:W)+M,source:{fromUi:!0}}))}),[_,W,M,J]),le=o.useCallback((()=>{q&&(V(!0),te({value:(null!==_&&void 0!==_?_:E)-M,source:{fromUi:!0}}))}),[_,E,M,q]),ne=o.useCallback((e=>{const{key:t}=e;switch(t){case"ArrowUp":e.preventDefault(),ie();break;case"ArrowDown":e.preventDefault(),le()}}),[ie,le]),ae=o.useCallback((e=>{"Enter"===e.key&&($&&te({value:_,source:{fromUi:!0}}),a.allowFormEnterToSubmit(S)&&a.submitForm(S,I))}),[$,_,te,a,S,I]);return(0,F.jsxs)("div",{className:"stNumberInput","data-testid":"stNumberInput",style:{width:d},children:[(0,F.jsx)(y.L,{label:n.label,disabled:r,labelVisibility:(0,c.yv)(null===(t=n.labelVisibility)||void 0===t?void 0:t.value),htmlFor:K.current,children:n.help&&(0,F.jsx)(w.j,{children:(0,F.jsx)(g.A,{content:n.help,placement:b.W.TOP_RIGHT})})}),(0,F.jsxs)(C,{className:H?"focused":"","data-testid":"stNumberInputContainer",children:[(0,F.jsx)(s.A,{type:"number",inputRef:O,value:null!==z&&void 0!==z?z:"",placeholder:n.placeholder,onBlur:()=>($&&te({value:_,source:{fromUi:!0}}),void P(!1)),onFocus:()=>{P(!0)},onChange:e=>(e=>{const{value:t}=e.target;if(""===t)V(!0),U(null),Q(null);else{let e;e=n.dataType===h.Q7.DataType.INT?parseInt(t,10):parseFloat(t),V(!0),U(e),Q(t)}})(e),onKeyPress:e=>ae(e),onKeyDown:e=>ne(e),clearable:oe,clearOnEscape:oe,disabled:r,"aria-label":n.label,id:K.current,overrides:{ClearIcon:{props:{overrides:{Svg:{style:{color:m.colors.darkGray,transform:"scale(1.4)",width:m.spacing.twoXL,marginRight:"-1.25em",":hover":{fill:m.colors.bodyText}}}}}},Input:{props:{"data-testid":"stNumberInputField",step:M,min:W,max:E},style:{lineHeight:m.lineHeights.inputWidget,paddingRight:m.spacing.sm,paddingLeft:m.spacing.sm,paddingBottom:m.spacing.sm,paddingTop:m.spacing.sm}},InputContainer:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0})},Root:{style:()=>({borderTopRightRadius:0,borderBottomRightRadius:0,borderLeftWidth:0,borderRightWidth:0,borderTopWidth:0,borderBottomWidth:0})}}}),d>m.breakpoints.hideNumberInputControls&&(0,F.jsxs)(T,{children:[(0,F.jsx)(x,{"data-testid":"stNumberInputStepDown",onClick:le,disabled:!q||r,tabIndex:-1,children:(0,F.jsx)(f.A,{content:i.H,size:"xs",color:q?"inherit":"disabled"})}),(0,F.jsx)(x,{"data-testid":"stNumberInputStepUp",onClick:ie,disabled:!J||r,tabIndex:-1,children:(0,F.jsx)(f.A,{content:l.F,size:"xs",color:J?"inherit":"disabled"})})]})]}),ee&&(0,F.jsx)(k,{clearable:oe,children:(0,F.jsx)(v.A,{dirty:$,value:null!==z&&void 0!==z?z:"",inForm:Y,allowEnterToSubmit:Z})})]})}))}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[9923],{19923:(e,t,n)=>{n.r(t),n.d(t,{default:()=>c});n(58878);var i=n(22044),o=n(89653);const s=(0,o.A)("div",{target:"e115fcil2"})((e=>{let{theme:t}=e;return{display:"flex",flexDirection:"row",flexWrap:"wrap",rowGap:t.spacing.lg}}),""),r=(0,o.A)("div",{target:"e115fcil1"})((()=>({display:"flex",flexDirection:"column",alignItems:"stretch",width:"auto",flexGrow:0})),""),l=(0,o.A)("div",{target:"e115fcil0"})((e=>{let{theme:t}=e;return{fontFamily:t.genericFonts.bodyFont,fontSize:t.fontSizes.sm,color:t.colors.fadedText60,textAlign:"center",marginTop:t.spacing.xs,wordWrap:"break-word",padding:t.spacing.threeXS}}),"");var a,d=n(90782);!function(e){e[e.OriginalWidth=-1]="OriginalWidth",e[e.ColumnWidth=-2]="ColumnWidth",e[e.AutoWidth=-3]="AutoWidth",e[e.MinImageOrContainer=-4]="MinImageOrContainer",e[e.MaxImageOrContainer=-5]="MaxImageOrContainer"}(a||(a={}));const c=(0,i.A)((function(e){let t,{width:n,isFullScreen:i,element:o,height:c,endpoints:h}=e;const m=o.width;if([a.OriginalWidth,a.AutoWidth,a.MinImageOrContainer].includes(m))t=void 0;else if([a.ColumnWidth,a.MaxImageOrContainer].includes(m))t=n;else{if(!(m>0))throw Error(`Invalid image width: ${m}`);t=m}const u={};return c&&i?(u.maxHeight=c,u.objectFit="contain"):(u.width=t,u.maxWidth="100%"),(0,d.jsx)(s,{className:"stImage","data-testid":"stImage",style:{width:n},children:o.imgs.map(((e,t)=>{const n=e;return(0,d.jsxs)(r,{"data-testid":"stImageContainer",children:[(0,d.jsx)("img",{style:u,src:h.buildMediaURL(n.url),alt:t.toString()}),n.caption&&(0,d.jsx)(l,{"data-testid":"stImageCaption",style:u,children:` ${n.caption} `})]},t)}))})}))},22044:(e,t,n)=>{n.d(t,{A:()=>f});var i=n(58878),o=n(53124),s=n.n(o),r=n(8151),l=n(41514),a=n(67214),d=n(64611),c=n(84152),h=n(89653);const m=(0,h.A)("button",{target:"e1vs0wn31"})((e=>{let{isExpanded:t,theme:n}=e;const i=t?{right:"0.4rem",top:"0.5rem",backgroundColor:"transparent"}:{right:"-3.0rem",top:"-0.375rem",opacity:0,transform:"scale(0)",backgroundColor:n.colors.lightenedBg05};return{position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",zIndex:n.zIndices.sidebar+1,height:"2.5rem",width:"2.5rem",transition:"opacity 300ms 150ms, transform 300ms 150ms",border:"none",color:n.colors.fadedText60,borderRadius:"50%",...i,"&:focus":{outline:"none"},"&:active, &:focus-visible, &:hover":{opacity:1,outline:"none",transform:"scale(1)",color:n.colors.bodyText,transition:"none"}}}),""),u=(0,h.A)("div",{target:"e1vs0wn30"})((e=>{let{theme:t,isExpanded:n}=e;return{"&:hover":{[m]:{opacity:1,transform:"scale(1)",transition:"none"}},...n?{position:"fixed",top:0,left:0,bottom:0,right:0,background:t.colors.bgColor,zIndex:t.zIndices.fullscreenWrapper,padding:t.spacing.md,paddingTop:t.sizes.fullScreenHeaderHeight,overflow:["auto","overlay"],display:"flex",alignItems:"center",justifyContent:"center"}:{}}}),"");var p=n(90782);class g extends i.PureComponent{constructor(e){super(e),this.context=void 0,this.controlKeys=e=>{const{expanded:t}=this.state;27===e.keyCode&&t&&this.zoomOut()},this.zoomIn=()=>{document.body.style.overflow="hidden",this.context.setFullScreen(!0),this.setState({expanded:!0})},this.zoomOut=()=>{document.body.style.overflow="unset",this.context.setFullScreen(!1),this.setState({expanded:!1})},this.convertScssRemValueToPixels=e=>parseFloat(e)*parseFloat(getComputedStyle(document.documentElement).fontSize),this.getWindowDimensions=()=>{const e=this.convertScssRemValueToPixels(this.props.theme.spacing.md),t=this.convertScssRemValueToPixels(this.props.theme.sizes.fullScreenHeaderHeight);return{fullWidth:window.innerWidth-2*e,fullHeight:window.innerHeight-(e+t)}},this.updateWindowDimensions=()=>{this.setState(this.getWindowDimensions())},this.state={expanded:!1,...this.getWindowDimensions()}}componentDidMount(){window.addEventListener("resize",this.updateWindowDimensions),document.addEventListener("keydown",this.controlKeys,!1)}componentWillUnmount(){window.removeEventListener("resize",this.updateWindowDimensions),document.removeEventListener("keydown",this.controlKeys,!1)}render(){const{expanded:e,fullWidth:t,fullHeight:n}=this.state,{children:i,width:o,height:s,disableFullscreenMode:r}=this.props;let c=l.u,h=this.zoomIn,g="View fullscreen";return e&&(c=a.Q,h=this.zoomOut,g="Exit fullscreen"),(0,p.jsxs)(u,{isExpanded:e,"data-testid":"stFullScreenFrame",children:[!r&&(0,p.jsx)(m,{"data-testid":"StyledFullScreenButton",onClick:h,title:g,isExpanded:e,children:(0,p.jsx)(d.A,{content:c})}),i(e?{width:t,height:n,expanded:e,expand:this.zoomIn,collapse:this.zoomOut}:{width:o,height:s,expanded:e,expand:this.zoomIn,collapse:this.zoomOut})]})}}g.contextType=c.n;const x=(0,r.b)(g);const f=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];class n extends i.PureComponent{constructor(){super(...arguments),this.render=()=>{const{width:n,height:i,disableFullscreenMode:o}=this.props;return(0,p.jsx)(x,{width:n,height:i,disableFullscreenMode:t||o,children:t=>{let{width:n,height:i,expanded:o,expand:s,collapse:r}=t;return(0,p.jsx)(e,{...this.props,width:n,height:i,isFullScreen:o,expand:s,collapse:r})}})}}}return n.displayName=`withFullScreenWrapper(${e.displayName||e.name})`,s()(n,e)}},41514:(e,t,n)=>{n.d(t,{u:()=>r});var i=n(68102),o=n(58878),s=n(68622),r=o.forwardRef((function(e,t){return o.createElement(s.I,(0,i.A)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:t}),o.createElement("path",{d:"M0 0v4l1.5-1.5L3 4l1-1-1.5-1.5L4 0H0zm5 4L4 5l1.5 1.5L4 8h4V4L6.5 5.5 5 4z"}))}));r.displayName="FullscreenEnter"},67214:(e,t,n)=>{n.d(t,{Q:()=>r});var i=n(68102),o=n(58878),s=n(68622),r=o.forwardRef((function(e,t){return o.createElement(s.I,(0,i.A)({iconAttrs:{fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},iconVerticalAlign:"middle",iconViewBox:"0 0 8 8"},e,{ref:t}),o.createElement("path",{d:"M1 0L0 1l1.5 1.5L0 4h4V0L2.5 1.5 1 0zm3 4v4l1.5-1.5L7 8l1-1-1.5-1.5L8 4H4z"}))}));r.displayName="FullscreenExit"}}]);
|