streamlit-nightly 1.53.1.dev20260114__py3-none-any.whl → 1.53.1.dev20260116__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- streamlit/__init__.py +0 -26
- streamlit/auth_util.py +90 -1
- streamlit/cli_util.py +2 -1
- streamlit/commands/echo.py +2 -2
- streamlit/commands/execution_control.py +1 -1
- streamlit/commands/navigation.py +1 -1
- streamlit/components/types/base_custom_component.py +0 -2
- streamlit/components/v1/custom_component.py +0 -2
- streamlit/components/v2/component_path_utils.py +1 -1
- streamlit/components/v2/manifest_scanner.py +8 -3
- streamlit/components/v2/presentation.py +1 -1
- streamlit/config.py +44 -13
- streamlit/config_util.py +5 -5
- streamlit/dataframe_util.py +5 -5
- streamlit/elements/arrow.py +11 -6
- streamlit/elements/deck_gl_json_chart.py +1 -1
- streamlit/elements/exception.py +4 -2
- streamlit/elements/form.py +1 -1
- streamlit/elements/layouts.py +1 -1
- streamlit/elements/lib/built_in_chart_utils.py +7 -7
- streamlit/elements/lib/column_config_utils.py +6 -6
- streamlit/elements/lib/dialog.py +1 -1
- streamlit/elements/lib/image_utils.py +4 -4
- streamlit/elements/lib/layout_utils.py +1 -1
- streamlit/elements/lib/policies.py +1 -1
- streamlit/elements/lib/streamlit_plotly_theme.py +9 -11
- streamlit/elements/lib/utils.py +1 -1
- streamlit/elements/map.py +6 -6
- streamlit/elements/plotly_chart.py +2 -2
- streamlit/elements/toast.py +1 -1
- streamlit/elements/vega_charts.py +2 -2
- streamlit/elements/widgets/button.py +3 -3
- streamlit/elements/widgets/button_group.py +3 -3
- streamlit/elements/widgets/chat.py +1 -1
- streamlit/elements/widgets/data_editor.py +6 -6
- streamlit/elements/widgets/number_input.py +1 -1
- streamlit/elements/widgets/slider.py +5 -5
- streamlit/elements/widgets/time_widgets.py +91 -10
- streamlit/elements/write.py +1 -1
- streamlit/env_util.py +1 -1
- streamlit/errors.py +0 -14
- streamlit/proto/NewSession_pb2.py +18 -18
- streamlit/proto/NewSession_pb2.pyi +5 -1
- streamlit/runtime/app_session.py +78 -59
- streamlit/runtime/caching/cache_data_api.py +3 -3
- streamlit/runtime/caching/cache_errors.py +0 -2
- streamlit/runtime/caching/cache_resource_api.py +1 -1
- streamlit/runtime/caching/cache_utils.py +2 -2
- streamlit/runtime/caching/hashing.py +1 -3
- streamlit/runtime/caching/storage/cache_storage_protocol.py +0 -3
- streamlit/runtime/connection_factory.py +1 -1
- streamlit/runtime/runtime.py +6 -6
- streamlit/runtime/scriptrunner_utils/exceptions.py +0 -4
- streamlit/runtime/scriptrunner_utils/script_run_context.py +0 -21
- streamlit/runtime/secrets.py +2 -3
- streamlit/runtime/state/query_params.py +0 -19
- streamlit/runtime/state/session_state.py +1 -1
- streamlit/runtime/stats.py +0 -7
- streamlit/static/index.html +1 -1
- streamlit/static/manifest.json +299 -299
- streamlit/static/static/js/{ErrorOutline.esm.BAZUU4id.js → ErrorOutline.esm.CiSfK8ht.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.C6tTTniR.js → FileDownload.esm.ItNjcEfs.js} +1 -1
- streamlit/static/static/js/{FileHelper.BOHlwlc9.js → FileHelper.xS7f19FE.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.D4lty7rT.js → FormClearHelper.N8_BCinn.js} +1 -1
- streamlit/static/static/js/{InputInstructions.BWw9lhud.js → InputInstructions.CrsdK7CQ.js} +1 -1
- streamlit/static/static/js/Particles.BDlTHC3I.js +1 -0
- streamlit/static/static/js/{ProgressBar.DCHh4N3P.js → ProgressBar.Bk2qeHfS.js} +2 -2
- streamlit/static/static/js/{StreamlitSyntaxHighlighter.BRydQwEj.js → StreamlitSyntaxHighlighter.BcuPrPcw.js} +1 -1
- streamlit/static/static/js/{TableChart.esm.7KFX5I_G.js → TableChart.esm.CP7XPz8I.js} +1 -1
- streamlit/static/static/js/Toolbar.DCJcLwve.js +1 -0
- streamlit/static/static/js/{WidgetLabelHelpIconInline.CzodezAH.js → WidgetLabelHelpIconInline.BPqxu1b-.js} +1 -1
- streamlit/static/static/js/{base-input.Cg7NpsfS.js → base-input.x4muJJ13.js} +4 -4
- streamlit/static/static/js/{checkbox.Bs20OTna.js → checkbox.C5r4AIaH.js} +1 -1
- streamlit/static/static/js/{createDownloadLinkElement.DSqCyu38.js → createDownloadLinkElement.C83kkEeT.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.Ch4SqNfY.js → data-grid-overlay-editor.0sOWm4IB.js} +1 -1
- streamlit/static/static/js/{downloader.Oj5CTGJA.js → downloader.C_6FfoEv.js} +1 -1
- streamlit/static/static/js/{embed.CqzzUq73.js → embed.BnJ6-SK4.js} +14 -14
- streamlit/static/static/js/{es6.CYrlw0Vn.js → es6.44_BWfFd.js} +2 -2
- streamlit/static/static/js/{formatNumber.CT_v8e75.js → formatNumber.DhHZAosz.js} +1 -1
- streamlit/static/static/js/{iconPosition.DPAvXTmd.js → iconPosition.shOoQuRR.js} +1 -1
- streamlit/static/static/js/{iframeResizer.contentWindow.T4DvQsIf.js → iframeResizer.contentWindow.savEE5Vs.js} +1 -1
- streamlit/static/static/js/{index.BoWBzl6h.js → index.AdijUi9Z.js} +1 -1
- streamlit/static/static/js/{index.Dtd5z2rM.js → index.B5HlOnvq.js} +1 -1
- streamlit/static/static/js/{index.MtwRNvlS.js → index.B6ewTTej.js} +1 -1
- streamlit/static/static/js/{index.D7KbBAWb.js → index.B8Of3XXR.js} +1 -1
- streamlit/static/static/js/{index.xCV2qwtw.js → index.BCaCSVj6.js} +1 -1
- streamlit/static/static/js/index.BE7Rhig1.js +1 -0
- streamlit/static/static/js/{index.DL_Ooizi.js → index.BHpLZ7X6.js} +2 -2
- streamlit/static/static/js/{index.BPxuKK0S.js → index.BNvP8E5Q.js} +1 -1
- streamlit/static/static/js/{index.LOA31DFn.js → index.BNzuyXeN.js} +2 -2
- streamlit/static/static/js/{index.Cfe-tCQJ.js → index.BT7o4A9V.js} +1 -1
- streamlit/static/static/js/{index.BZ8xp-w9.js → index.BYY3iuVE.js} +1 -1
- streamlit/static/static/js/index.BZI7jTDf.js +1 -0
- streamlit/static/static/js/{index.CGRIbGGV.js → index.BZXk3Qxq.js} +1 -1
- streamlit/static/static/js/{index.CVXiBeDI.js → index.BhQvq6YD.js} +1 -1
- streamlit/static/static/js/{index.CnXxoVEM.js → index.BkIReLGJ.js} +3 -3
- streamlit/static/static/js/{index.AGYZDQZm.js → index.Bl7SMZUw.js} +1 -1
- streamlit/static/static/js/{index.b-MrPulo.js → index.BqtgAGnG.js} +2 -2
- streamlit/static/static/js/{index.B3HdcUdo.js → index.BwnLQnAk.js} +1 -1
- streamlit/static/static/js/index.C1coXTgf.js +2 -0
- streamlit/static/static/js/{index.DXRGd--0.js → index.C6uOmY9O.js} +1 -1
- streamlit/static/static/js/index.CF88nImM.js +1 -0
- streamlit/static/static/js/{index.B9Oowxt8.js → index.CFlGfFvq.js} +1 -1
- streamlit/static/static/js/{index.wngeYhKj.js → index.CQgiNpC7.js} +1 -1
- streamlit/static/static/js/{index.D84XHt50.js → index.CZJkiRFm.js} +1 -1
- streamlit/static/static/js/index.Ch1TdQMG.js +1 -0
- streamlit/static/static/js/{index.Yj6vcyFD.js → index.Ck2mQvBi.js} +1 -1
- streamlit/static/static/js/{index.DPlPEuq6.js → index.CrD2lwZG.js} +1 -1
- streamlit/static/static/js/index.CySNwKoN.js +2 -0
- streamlit/static/static/js/index.D3LEkXqN.js +1 -0
- streamlit/static/static/js/{index.BTA0d5oq.js → index.D8BQH06Z.js} +1 -1
- streamlit/static/static/js/{index.B8ZZdPqF.js → index.DBtWixG1.js} +1 -1
- streamlit/static/static/js/{index.CVKk1nkB.js → index.DIsNrJpC.js} +1 -1
- streamlit/static/static/js/{index.CPYB1awG.js → index.DO3HICut.js} +1 -1
- streamlit/static/static/js/{index.D6HCANv6.js → index.D_ziFad8.js} +1 -1
- streamlit/static/static/js/{index.BTqav7_K.js → index.Dblsdn8d.js} +1 -1
- streamlit/static/static/js/{index.Dg9k4R8B.js → index.DcdD0ROn.js} +2 -2
- streamlit/static/static/js/{index.tLZuZM89.js → index.DfHm3P22.js} +51 -51
- streamlit/static/static/js/{index.CXVpBAvU.js → index.DiwhD0Ic.js} +46 -46
- streamlit/static/static/js/index.DvZDNiBV.js +11 -0
- streamlit/static/static/js/{index.DQzRwgrT.js → index.HjydQ4bj.js} +1 -1
- streamlit/static/static/js/{index.XHtvnZ0-.js → index.HsxzYHNf.js} +1 -1
- streamlit/static/static/js/{index.DesNeXSA.js → index.SVJGpnpy.js} +1 -1
- streamlit/static/static/js/index.SjKkVSL7.js +1 -0
- streamlit/static/static/js/index.hX8_3tMP.js +1 -0
- streamlit/static/static/js/{index.BEzgNZOm.js → index.jZin0w6_.js} +1 -1
- streamlit/static/static/js/{index.DzldU3Hy.js → index.pQvPlPcA.js} +4 -4
- streamlit/static/static/js/index.pzQTLx9j.js +1 -0
- streamlit/static/static/js/{index.ClFk8x0U.js → index.s44_OVd6.js} +33 -33
- streamlit/static/static/js/{input.CYXuTqoa.js → input.jAD-v9D6.js} +2 -2
- streamlit/static/static/js/{main.BE-siVKv.js → main.Cas0fuOs.js} +1 -1
- streamlit/static/static/js/{memory.V554ztRg.js → memory.ENruL8Qk.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.BiUTOXIl.js → number-overlay-editor.DAOTdulh.js} +2 -2
- streamlit/static/static/js/{pandasStylerUtils.Dej3Tstq.js → pandasStylerUtils.DChYgcPq.js} +1 -1
- streamlit/static/static/js/{sandbox.gpd7KGMo.js → sandbox.DWZYRCm0.js} +1 -1
- streamlit/static/static/js/{styled-components.Coj4dr6D.js → styled-components.3lwVqgRW.js} +1 -1
- streamlit/static/static/js/{throttle.gZUdtYp7.js → throttle.DfOW1Cns.js} +1 -1
- streamlit/static/static/js/{timepicker.B-Y4aU15.js → timepicker.CXHgL5f9.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.CcKcKvEd.js → toConsumableArray.DiW0GSDV.js} +1 -1
- streamlit/static/static/js/uniqueId.Dfi3SGKZ.js +1 -0
- streamlit/static/static/js/{useBasicWidgetState.D-fc_aIL.js → useBasicWidgetState.DnPEt_f3.js} +1 -1
- streamlit/static/static/js/{useIntlLocale.CY32IeNt.js → useIntlLocale.BZEGSOVD.js} +8 -8
- streamlit/static/static/js/{useTextInputAutoExpand.C0jK7TwF.js → useTextInputAutoExpand.MGVZMqyt.js} +1 -1
- streamlit/static/static/js/useUpdateUiValue.CPl6CEx3.js +1 -0
- streamlit/static/static/js/{useWaveformController.BLEIAIDo.js → useWaveformController.DOpzDyZu.js} +1 -1
- streamlit/static/static/js/{withCalculatedWidth.B3oSlRC0.js → withCalculatedWidth.DgKFTeif.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.Cw_ebNmr.js → withFullScreenWrapper.K1jkwhPu.js} +1 -1
- streamlit/string_util.py +2 -2
- streamlit/testing/v1/element_tree.py +8 -10
- streamlit/type_util.py +2 -2
- streamlit/url_util.py +2 -2
- streamlit/user_info.py +2 -2
- streamlit/util.py +1 -1
- streamlit/watcher/path_watcher.py +1 -1
- streamlit/web/cli.py +1 -4
- streamlit/web/server/app_discovery.py +2 -1
- streamlit/web/server/oauth_authlib_routes.py +14 -42
- streamlit/web/server/server.py +1 -1
- streamlit/web/server/server_util.py +1 -1
- streamlit/web/server/starlette/starlette_auth_routes.py +94 -16
- streamlit/web/server/starlette/starlette_routes.py +9 -3
- streamlit/web/server/starlette/starlette_server.py +2 -2
- {streamlit_nightly-1.53.1.dev20260114.dist-info → streamlit_nightly-1.53.1.dev20260116.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.53.1.dev20260114.dist-info → streamlit_nightly-1.53.1.dev20260116.dist-info}/RECORD +168 -169
- streamlit/commands/experimental_query_params.py +0 -169
- streamlit/static/static/js/Particles.BDi7fIn-.js +0 -1
- streamlit/static/static/js/Toolbar.guIuiwEF.js +0 -1
- streamlit/static/static/js/index.BJnWg9Jq.js +0 -1
- streamlit/static/static/js/index.Bqgt60FU.js +0 -1
- streamlit/static/static/js/index.BsYYrijt.js +0 -11
- streamlit/static/static/js/index.CJQq5LcR.js +0 -2
- streamlit/static/static/js/index.Cw4eSvJ7.js +0 -1
- streamlit/static/static/js/index.DNyw7S7Z.js +0 -1
- streamlit/static/static/js/index.DZDt5hYD.js +0 -1
- streamlit/static/static/js/index.Do9A7QCt.js +0 -1
- streamlit/static/static/js/index.DrSH3pK3.js +0 -2
- streamlit/static/static/js/index.GZi6GTJa.js +0 -1
- streamlit/static/static/js/index.hcUYvTqs.js +0 -1
- streamlit/static/static/js/uniqueId.PRn3V1WU.js +0 -1
- streamlit/static/static/js/useUpdateUiValue.CDQloDgB.js +0 -1
- {streamlit_nightly-1.53.1.dev20260114.data → streamlit_nightly-1.53.1.dev20260116.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.53.1.dev20260114.dist-info → streamlit_nightly-1.53.1.dev20260116.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.53.1.dev20260114.dist-info → streamlit_nightly-1.53.1.dev20260116.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.53.1.dev20260114.dist-info → streamlit_nightly-1.53.1.dev20260116.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as o,E as L,_ as k,z as p,aa as Se,o as x,j as a,ax as I,b as V,c as Ue,B as M,h as ve,$ as be,k as Ce,aj as ee,bh as Ie,e as D,bU as Ee,p as Be,ab as De,ac as Le,bP as ke,bQ as Ve}from"./index.DiwhD0Ic.js";import{u as Me}from"./FormClearHelper.N8_BCinn.js";import{g as oe,F as R,a as Re,D as Pe,I as Ae,s as Ne,b as Te}from"./FileHelper.xS7f19FE.js";import{S as We,P as He}from"./ProgressBar.Bk2qeHfS.js";import{U as j}from"./UploadFileInfo.Dr-zDST7.js";const $e=e=>{const t=o.useRef();return o.useEffect(()=>{t.current=e},[e]),t.current};var ne=o.forwardRef(function(e,t){var n={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(L,k({iconAttrs:n,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),o.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),o.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12l4.58-4.59z"}))});ne.displayName="ChevronLeft";var le=o.forwardRef(function(e,t){var n={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(L,k({iconAttrs:n,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),o.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),o.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6-6-6z"}))});le.displayName="ChevronRight";var se=o.forwardRef(function(e,t){var n={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(L,k({iconAttrs:n,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),o.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),o.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"}))});se.displayName="Clear";var ae=o.forwardRef(function(e,t){var n={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(L,k({iconAttrs:n,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),o.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),o.createElement("path",{d:"M19.35 10.04A7.49 7.49 0 0012 4C9.11 4 6.6 5.64 5.35 8.04A5.994 5.994 0 000 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95A5.469 5.469 0 0112 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11A2.98 2.98 0 0122 15c0 1.65-1.35 3-3 3zM8 13h2.55v3h2.9v-3H16l-4-4z"}))});ae.displayName="CloudUpload";var ie=o.forwardRef(function(e,t){var n={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(L,k({iconAttrs:n,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:t}),o.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}))});ie.displayName="Error";const re=p("section",{target:"ewslnz90"})(({isDisabled:e,theme:t})=>({display:"flex",gap:t.spacing.lg,alignItems:"center",padding:t.spacing.lg,backgroundColor:t.colors.secondaryBg,borderRadius:t.radii.default,border:t.colors.widgetBorderColor?`${t.sizes.borderWidth} solid ${t.colors.widgetBorderColor}`:void 0,height:t.sizes.largestElementHeight,":focus":{outline:"none"},":focus-visible":{boxShadow:t.shadows.focusRingOutline},cursor:e?"not-allowed":"pointer"})),je=p("div",{target:"ewslnz91"})(({theme:e})=>({marginRight:"auto",alignItems:"center",display:"flex",gap:e.spacing.lg,minWidth:0,width:"100%"})),ce=p("span",{target:"ewslnz92"})(({theme:e})=>({color:e.colors.darkenedBgMix100})),de=p("span",{target:"ewslnz93"})(({theme:e,disabled:t})=>({color:t?e.colors.fadedText40:e.colors.bodyText})),Xe=p("span",{target:"ewslnz94"})(({theme:e,disabled:t})=>({fontSize:e.fontSizes.sm,color:t?e.colors.fadedText40:e.colors.fadedText60,display:"block",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",maxWidth:"100%"})),Oe=p("div",{target:"ewslnz95"})({display:"flex",flexDirection:"column",minWidth:0,maxWidth:"100%"}),qe=p("span",{target:"ewslnz96"})({whiteSpace:"nowrap"}),pe=p("div",{target:"ewslnz97"})(({theme:e})=>({left:0,right:0,lineHeight:e.lineHeights.tight,paddingTop:e.spacing.md,paddingLeft:e.spacing.lg,paddingRight:e.spacing.lg})),_e=p("ul",{target:"ewslnz98"})(({theme:e})=>({listStyleType:"none",margin:e.spacing.none,padding:e.spacing.none})),ue=p("li",{target:"ewslnz99"})(({theme:e})=>({margin:e.spacing.none,padding:e.spacing.none})),ge=p("div",{target:"ewslnz910"})(({theme:e})=>({display:"flex",alignItems:"baseline",flex:1,paddingLeft:e.spacing.lg,overflow:"hidden"})),fe=p("div",{target:"ewslnz911"})(({theme:e,disabled:t})=>({marginRight:e.spacing.sm,marginBottom:e.spacing.twoXS,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:t?e.colors.fadedText40:e.colors.bodyText})),he=p("div",{target:"ewslnz912"})(({theme:e})=>({display:"flex",alignItems:"center",marginBottom:e.spacing.twoXS})),Ke=p("span",{target:"ewslnz913"})(({theme:e})=>({marginRight:e.spacing.twoXS})),Qe=p("div",{target:"ewslnz914"})(({theme:e,disabled:t})=>({display:"flex",padding:e.spacing.twoXS,color:t?e.colors.fadedText40:e.colors.darkenedBgMix100})),Fe=p("small",{target:"ewslnz915"})(({theme:e})=>({color:e.colors.redTextColor,fontSize:e.fontSizes.sm,height:e.fontSizes.sm,lineHeight:e.fontSizes.sm,display:"flex",alignItems:"center",whiteSpace:"nowrap"})),me=p("span",{target:"ewslnz916"})({}),Ye=e=>({[re]:{display:"flex",flexDirection:"column",alignItems:"flex-start",height:"auto",gap:e.spacing.sm},[ce]:{display:"none"},[de]:{marginBottom:e.spacing.twoXS},[pe]:{paddingRight:e.spacing.lg},[he]:{maxWidth:"inherit",flex:1,alignItems:"flex-start",marginBottom:e.spacing.sm},[fe]:{width:e.sizes.full},[ge]:{flexDirection:"column"},[Fe]:{height:"auto",whiteSpace:"initial"},[me]:{display:"none"},[ue]:{margin:e.spacing.none,padding:e.spacing.none}}),Ge=p("div",{target:"ewslnz917"})(({theme:e,width:t})=>{if(t<Se("23rem"))return Ye(e)}),Je=({multiple:e,acceptedExtensions:t,maxSizeBytes:n,acceptDirectory:i=!1,disabled:d})=>{const y=()=>i?"directories":e?"files":"file",c=()=>t.length?` • ${t.map(w=>w.replace(/^\./,"").toUpperCase()).join(", ")}`:null,F=()=>`Limit ${oe(n,R.Byte,0)} per file`;return x(je,{"data-testid":"stFileUploaderDropzoneInstructions",children:[a(ce,{children:a(I,{content:ae,size:"threeXL"})}),x(Oe,{children:[x(de,{disabled:d,children:["Drag and drop ",y()," here"]}),x(Xe,{disabled:d,children:[F(),c()]})]})]})},Ze=o.memo(Je),et=({onDrop:e,multiple:t,acceptedExtensions:n,maxSizeBytes:i,disabled:d,label:y,acceptDirectory:c=!1})=>a(Pe,{onDrop:e,multiple:t,accept:Re(n),maxSize:i,disabled:d,useFsAccessApi:!1,children:({getRootProps:F,getInputProps:w})=>{const U=w({multiple:t||!!c});return x(re,{...F(),"data-testid":"stFileUploaderDropzone",isDisabled:d,"aria-label":y,"aria-disabled":d,children:[a("input",{"data-testid":"stFileUploaderDropzoneInput",...U,...c&&{webkitdirectory:""}}),a(Ze,{multiple:t,acceptedExtensions:n,maxSizeBytes:i,acceptDirectory:c,disabled:d}),a(qe,{children:a(V,{kind:M.SECONDARY,disabled:d,size:Ue.SMALL,children:c?"Browse directories":"Browse files"})})]})}}),tt=o.memo(et),we=p("small",{target:"e1xq3mgd0"})(({kind:e,disabled:t,theme:n})=>{const{redTextColor:i,fadedText60:d,fadedText40:y}=n.colors;let c=d;return t&&(c=y),e==="danger"&&(c=i),{color:c,fontSize:n.fontSizes.sm,lineHeight:n.lineHeights.tight}}),ot=({fileInfo:e,disabled:t})=>e.status.type==="uploading"?a(He,{value:e.status.progress,size:We.SMALL}):e.status.type==="error"?x(Fe,{children:[a(Ke,{"data-testid":"stFileUploaderFileErrorMessage",children:e.status.errorMessage}),a(me,{children:a(I,{content:ie,size:"lg"})})]}):e.status.type==="uploaded"?a(we,{disabled:t,children:oe(e.size,R.Byte)}):null,nt=({fileInfo:e,onDelete:t,disabled:n})=>x(he,{className:"stFileUploaderFile","data-testid":"stFileUploaderFile",children:[a(Qe,{disabled:n,children:a(I,{content:Ae,size:"twoXL"})}),x(ge,{className:"stFileUploaderFileData",children:[a(fe,{className:"stFileUploaderFileName","data-testid":"stFileUploaderFileName",title:e.name,disabled:n,children:e.name}),a(ot,{fileInfo:e,disabled:n})]}),a("div",{"data-testid":"stFileUploaderDeleteBtn",children:a(V,{onClick:()=>t(e.id),kind:M.MINIMAL,disabled:n,"aria-label":`Remove ${e.name}`,children:a(I,{content:se,size:"lg"})})})]}),lt=o.memo(nt),st=p("div",{target:"e1o0u1j0"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",paddingBottom:e.spacing.twoXS,marginBottom:e.spacing.twoXS})),at=p("div",{target:"e1o0u1j1"})(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",color:e.colors.fadedText40})),it=({currentPage:e,totalPages:t,onNext:n,onPrevious:i})=>x(st,{"data-testid":"stFileUploaderPagination",children:[a(we,{children:`Showing page ${e} of ${t}`}),x(at,{children:[a(V,{onClick:i,kind:M.MINIMAL,children:a(I,{content:ne,size:"xl"})}),a(V,{onClick:n,kind:M.MINIMAL,children:a(I,{content:le,size:"xl"})})]})]}),rt=o.memo(it),te=(e,t)=>Math.ceil(e.length/t),ct=e=>ve(({pageSize:n,items:i,resetOnAdd:d,...y})=>{const[c,F]=o.useState(0),[w,U]=o.useState(()=>te(i,n)),u=$e(i);o.useEffect(()=>{u&&u.length!==i.length&&U(te(i,n)),u&&u.length<i.length?d&&F(0):c+1>=w&&F(w-1)},[i,c,n,u,d,w]);const E=()=>{F(Math.min(c+1,w-1))},v=()=>{F(Math.max(0,c-1))},P=i.slice(c*n,c*n+n);return x(be,{children:[a(e,{items:P,...y}),i.length>n?a(rt,{pageSize:n,totalPages:w,currentPage:c+1,onNext:E,onPrevious:v}):null]})},e),dt=({items:e,onDelete:t,disabled:n})=>a(_e,{children:e.map(i=>a(ue,{children:a(lt,{fileInfo:i,onDelete:t,disabled:n})},i.id))}),pt=ct(dt),ut=e=>a(pe,{children:a(pt,{...e})}),gt=o.memo(ut),ft=(e,t)=>{const n=t.getFileUploaderStateValue(e);if(D(n))return{files:[],nextLocalId:1};const{uploadedFileInfo:i}=n;if(D(i)||i.length===0)return{files:[],nextLocalId:1};let d=1;return{files:i.map(c=>{const F=c.name,w=c.size,U=c.fileId,u=c.fileUrls,E=new j(F,w,d,{type:"uploaded",fileId:U,fileUrls:u});return d+=1,E}),nextLocalId:d}},$=e=>{const t=e.filter(n=>n.status.type==="uploaded").map(n=>{const{name:i,size:d,status:y}=n,{fileId:c,fileUrls:F}=y;return new ke({fileId:c,fileUrls:F,name:i,size:d})});return new Ve({uploadedFileInfo:t})},ht=({disabled:e,element:t,widgetMgr:n,uploadClient:i,fragmentId:d})=>{const{width:y,elementRef:c}=Ce(),{files:F,nextLocalId:w}=o.useMemo(()=>ft(t,n),[t,n]),U=o.useRef(w),[u,E]=o.useState(()=>F),v=o.useRef(u);o.useEffect(()=>{v.current=u},[u]);const[P,X]=o.useState(!1),B=o.useCallback(()=>{const l=U.current;return U.current+=1,l},[]),A=o.useMemo(()=>{const l=t.maxUploadSizeMb;return Ne(l,R.Megabyte,R.Byte)},[t.maxUploadSizeMb]),S=o.useCallback(l=>{ee.flushSync(()=>{E(s=>{const r=typeof l=="function"?l(s):l;return v.current=r,r})})},[]),N=o.useCallback(l=>{ee.flushSync(()=>{X(l)})},[X]),O=o.useCallback(l=>{S(s=>[...s,l])},[S]),T=o.useCallback(l=>{l.length!==0&&S(s=>[...s,...l])},[S]),q=o.useCallback(l=>{S(s=>s.filter(r=>r.id!==l))},[S]),b=o.useCallback((l,s)=>{S(r=>r.map(g=>g.id===l?s:g))},[S]),C=o.useCallback(l=>v.current.find(s=>s.id===l),[]),_=u.some(l=>l.status.type==="uploading")||P?"updating":"ready";o.useEffect(()=>{n.getFileUploaderStateValue(t)===void 0&&n.setFileUploaderStateValue(t,$(v.current),{fromUi:!1},d)},[n,t,d]),o.useEffect(()=>{if(_!=="ready")return;const l=$(u),s=n.getFileUploaderStateValue(t);Ie(l,s)||n.setFileUploaderStateValue(t,l,{fromUi:!0},d)},[_,u,n,t,d]);const ye=o.useCallback(()=>{S(()=>[]);const l=$([]);n.setFileUploaderStateValue(t,l,{fromUi:!0},d)},[t,d,S,n]);Me({element:t,widgetMgr:n,onFormCleared:ye});const K=o.useCallback(l=>{const s=t.type;if(!s||s.length===0)return!0;const r=l.name.toLowerCase();return s.some(g=>r.endsWith(g.toLowerCase()))},[t.type]),Q=o.useCallback(l=>{const s=[],r=[];return l.forEach(g=>{K(g)?s.push(g):r.push({file:g,errors:[{code:"file-invalid-type",message:`${g.type} files are not allowed.`}]})}),{accepted:s,rejected:r}},[K]),Y=o.useCallback((l,s)=>{const r=C(l);D(r)||r.status.type!=="uploading"||b(r.id,r.setStatus({type:"uploaded",fileId:s.fileId,fileUrls:s}))},[C,b]),G=o.useCallback((l,s)=>{const r=C(s);if(D(r)||r.status.type!=="uploading")return;const g=Math.round(l.loaded*100/l.total);r.status.progress!==g&&b(s,r.setStatus({type:"uploading",abortController:r.status.abortController,progress:g}))},[C,b]),J=o.useCallback((l,s)=>{const r=new AbortController,g=s.webkitRelativePath||s.name,f=new j(g,s.size,B(),{type:"uploading",abortController:r,progress:1});O(f),i.uploadFile(t,l.uploadUrl,s,h=>G(h,f.id),r.signal).then(()=>Y(f.id,l)).catch(h=>{h instanceof DOMException&&h.name==="AbortError"||b(f.id,f.setStatus({type:"error",errorMessage:h?h.toString():"Unknown error"}))})},[O,t,B,Y,G,b,i]),W=o.useCallback(l=>{if(e)return;const s=C(l);D(s)||(s.status.type==="uploading"&&s.status.abortController.abort(),s.status.type==="uploaded"&&s.status.fileUrls.deleteUrl&&i.deleteFile(s.status.fileUrls.deleteUrl),q(l))},[e,C,q,i]),xe=o.useCallback((l,s)=>{const{multipleFiles:r}=t,g=!!t.acceptDirectory;let f=[...l],h=[...s];if(g&&f.length>0){const{accepted:z,rejected:m}=Q(f);f=z,h=[...h,...m]}if(!r&&f.length===0&&h.length>1){const z=h.findIndex(m=>m.errors.length===1&&m.errors[0].code==="too-many-files");z>=0&&(f.push(h[z].file),h.splice(z,1))}if(i.fetchFileURLs(f).then(z=>{if(!r&&f.length>0){const m=v.current.find(H=>H.status.type!=="error");if(m){N(!0);try{W(m.id)}finally{N(!1)}}}Ee(z,f).forEach(([m,H])=>{J(m,H)})}).catch(z=>{T(f.map(m=>new j(m.name,m.size,B(),{type:"error",errorMessage:z})))}),h.length>0){const z=h.map(m=>Te(m,B(),A));T(z)}},[T,W,t,Q,A,B,i,J,N]),Z=o.useMemo(()=>u.slice().reverse(),[u]),ze=t.type;return x(Ge,{className:"stFileUploader","data-testid":"stFileUploader",width:y,ref:c,children:[a(Le,{label:t.label,disabled:e,labelVisibility:Be(t.labelVisibility?.value),children:t.help&&a(De,{content:t.help,label:t.label})}),a(tt,{onDrop:xe,multiple:t.multipleFiles,acceptedExtensions:ze,maxSizeBytes:A,label:t.label,disabled:e,acceptDirectory:!!t.acceptDirectory}),Z.length>0&&a(gt,{items:Z,pageSize:3,onDelete:W,resetOnAdd:!0,disabled:e})]})},zt=o.memo(ht);export{zt as default};
|