streamlit-nightly 1.45.1.dev20250429__py3-none-any.whl → 1.45.1.dev20250430__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.
Files changed (96) hide show
  1. streamlit/cli_util.py +1 -1
  2. streamlit/commands/page_config.py +1 -1
  3. streamlit/config.py +3 -3
  4. streamlit/elements/doc_string.py +24 -3
  5. streamlit/elements/json.py +13 -0
  6. streamlit/elements/metric.py +1 -1
  7. streamlit/elements/progress.py +25 -1
  8. streamlit/elements/widgets/audio_input.py +21 -0
  9. streamlit/navigation/page.py +1 -1
  10. streamlit/proto/AudioInput_pb2.py +4 -3
  11. streamlit/proto/AudioInput_pb2.pyi +7 -2
  12. streamlit/proto/DocString_pb2.py +6 -5
  13. streamlit/proto/DocString_pb2.pyi +9 -1
  14. streamlit/proto/Json_pb2.py +4 -3
  15. streamlit/proto/Json_pb2.pyi +9 -2
  16. streamlit/proto/Progress_pb2.py +4 -3
  17. streamlit/proto/Progress_pb2.pyi +7 -1
  18. streamlit/runtime/caching/cache_data_api.py +1 -1
  19. streamlit/runtime/caching/cache_utils.py +3 -2
  20. streamlit/runtime/credentials.py +1 -0
  21. streamlit/runtime/scriptrunner/script_runner.py +4 -4
  22. streamlit/static/index.html +1 -1
  23. streamlit/static/static/js/{ErrorOutline.esm.BJh3F07v.js → ErrorOutline.esm.JdVs1Qkg.js} +1 -1
  24. streamlit/static/static/js/{FileDownload.esm.BpUJskrZ.js → FileDownload.esm.BlQJ4vNG.js} +1 -1
  25. streamlit/static/static/js/{FileHelper.DKXMFthp.js → FileHelper.V4GYCyDu.js} +1 -1
  26. streamlit/static/static/js/{FormClearHelper.CcbGU8qM.js → FormClearHelper.CyxVAl63.js} +1 -1
  27. streamlit/static/static/js/{Hooks.CyZIh6nK.js → Hooks.CwzpXjfg.js} +1 -1
  28. streamlit/static/static/js/{InputInstructions.nbkV1h_d.js → InputInstructions.DLh-ti71.js} +1 -1
  29. streamlit/static/static/js/{ProgressBar.DeCaMWV9.js → ProgressBar.C7bBETsY.js} +1 -1
  30. streamlit/static/static/js/{RenderInPortalIfExists.D_SwWwav.js → RenderInPortalIfExists.BMvxq2hn.js} +1 -1
  31. streamlit/static/static/js/{Toolbar.BAN-49vk.js → Toolbar.CotfqUm6.js} +1 -1
  32. streamlit/static/static/js/{base-input.BGFZMByD.js → base-input.BxaSmpU7.js} +1 -1
  33. streamlit/static/static/js/{checkbox.B_-BK4qi.js → checkbox.CrglCerk.js} +1 -1
  34. streamlit/static/static/js/{createSuper.BxyEvip2.js → createSuper.Bs0C396a.js} +1 -1
  35. streamlit/static/static/js/{data-grid-overlay-editor.DmJscfNY.js → data-grid-overlay-editor.D0k84F-1.js} +1 -1
  36. streamlit/static/static/js/{downloader.Cv_h08Sg.js → downloader.BpZrmdUi.js} +1 -1
  37. streamlit/static/static/js/{es6.BEoJ6t5B.js → es6.DD8ccAPk.js} +2 -2
  38. streamlit/static/static/js/{iframeResizer.contentWindow.DnBVl60m.js → iframeResizer.contentWindow.7G5YE4ki.js} +1 -1
  39. streamlit/static/static/js/{index.C7tk-BaI.js → index.5p5xlu27.js} +1 -1
  40. streamlit/static/static/js/{index.D39reA1n.js → index.65FBensJ.js} +1 -1
  41. streamlit/static/static/js/{index.CmBGzoYB.js → index.80LGX7Ne.js} +1 -1
  42. streamlit/static/static/js/{index.z-3XVs6d.js → index.9sjzZWLH.js} +1 -1
  43. streamlit/static/static/js/{index.Bnv2GQ1f.js → index.B2lDS5vI.js} +1 -1
  44. streamlit/static/static/js/{index.Dw_iEQ1s.js → index.B3VXbj_b.js} +1 -1
  45. streamlit/static/static/js/{index.DbVBJOze.js → index.BDLXYKTS.js} +1 -1
  46. streamlit/static/static/js/{index.t3xwOrU9.js → index.BF0CTyRa.js} +1 -1
  47. streamlit/static/static/js/{index.BpqJCHW4.js → index.BI5f0VII.js} +1 -1
  48. streamlit/static/static/js/{index.CzaH4EJh.js → index.BNhdn2vD.js} +1 -1
  49. streamlit/static/static/js/{index.DwTevPv_.js → index.BNm3tuep.js} +1 -1
  50. streamlit/static/static/js/{index.DewKSDBK.js → index.BQqNcnRp.js} +63 -63
  51. streamlit/static/static/js/{index.Bk2dieuB.js → index.BjKCKyJI.js} +1 -1
  52. streamlit/static/static/js/{index.iV6t3ri-.js → index.C2kSDT38.js} +1 -1
  53. streamlit/static/static/js/{index.DipBpxzK.js → index.CMjYL7Ho.js} +1 -1
  54. streamlit/static/static/js/{index.Dz3G_3mZ.js → index.COBwb1mq.js} +1 -1
  55. streamlit/static/static/js/{index.BCUsUBov.js → index.COpV4IZK.js} +1 -1
  56. streamlit/static/static/js/{index.D_Z8_2ei.js → index.Cgzj9ewR.js} +1 -1
  57. streamlit/static/static/js/{index.DKS3g4Ws.js → index.CkutRj8u.js} +1 -1
  58. streamlit/static/static/js/{index.BzbL2a8R.js → index.Co5UsG7W.js} +1 -1
  59. streamlit/static/static/js/{index.BsajPDiD.js → index.CveEeb4Q.js} +1 -1
  60. streamlit/static/static/js/{index.BooesbgI.js → index.Czzj5-re.js} +1 -1
  61. streamlit/static/static/js/{index.CRdGuqu3.js → index.D1wWsFMc.js} +1 -1
  62. streamlit/static/static/js/{index.Bp2P-ne7.js → index.D5GLQoRz.js} +1 -1
  63. streamlit/static/static/js/{index.DoNPe-YW.js → index.DICnhvRg.js} +1 -1
  64. streamlit/static/static/js/{index.CWwqcOXB.js → index.DK_eUkea.js} +1 -1
  65. streamlit/static/static/js/{index.BDoHOUEu.js → index.DM4oCpFy.js} +1 -1
  66. streamlit/static/static/js/{index.BlpcPmc8.js → index.DO535td0.js} +1 -1
  67. streamlit/static/static/js/{index.0QGnttRw.js → index.DUF1Zxw6.js} +1 -1
  68. streamlit/static/static/js/{index.CA2NGDaW.js → index.DW80zFo4.js} +1 -1
  69. streamlit/static/static/js/{index.CT0nwqsw.js → index.DX2vW3qb.js} +1 -1
  70. streamlit/static/static/js/{index.tbMYLMrS.js → index.DfgXsqtW.js} +1 -1
  71. streamlit/static/static/js/{index.7LZxcVw4.js → index.Dq6k7Ztd.js} +1 -1
  72. streamlit/static/static/js/{index.BBlDwZ3d.js → index.Dz4o-tqP.js} +5 -5
  73. streamlit/static/static/js/{index.CeEGQX9i.js → index.Olz7Xaf0.js} +1 -1
  74. streamlit/static/static/js/{index.BJrY61fW.js → index.SARy_Med.js} +1 -1
  75. streamlit/static/static/js/{index.WP3FKPhV.js → index.rHb0nIsm.js} +1 -1
  76. streamlit/static/static/js/{input.B2MDikVk.js → input.ChMez782.js} +1 -1
  77. streamlit/static/static/js/{memory.BCb625DQ.js → memory.DEIZt-uk.js} +1 -1
  78. streamlit/static/static/js/{mergeWith.COIRyAFl.js → mergeWith.DV3wfmZj.js} +1 -1
  79. streamlit/static/static/js/{number-overlay-editor.2CkzyF3w.js → number-overlay-editor.CVWV51LZ.js} +1 -1
  80. streamlit/static/static/js/{possibleConstructorReturn.3T2FklLD.js → possibleConstructorReturn.D8SHK4fu.js} +1 -1
  81. streamlit/static/static/js/{sandbox.Cc6yBPvx.js → sandbox.2Y0eB1Fb.js} +1 -1
  82. streamlit/static/static/js/{textarea.C7jOKez6.js → textarea.CfOMMQUp.js} +1 -1
  83. streamlit/static/static/js/{timepicker.BjMKxgZK.js → timepicker.BCEVqM6L.js} +1 -1
  84. streamlit/static/static/js/{toConsumableArray.BQ7m3eYw.js → toConsumableArray.CgIgbjyR.js} +1 -1
  85. streamlit/static/static/js/{uniqueId.CJ7dn8nU.js → uniqueId.CasOW7eQ.js} +1 -1
  86. streamlit/static/static/js/{useBasicWidgetState.QdMR1Kj8.js → useBasicWidgetState.DM0uW3hG.js} +1 -1
  87. streamlit/static/static/js/{useOnInputChange.DppkR64F.js → useOnInputChange.C9p9DssL.js} +1 -1
  88. streamlit/static/static/js/{withFullScreenWrapper.C2Ah-iZc.js → withFullScreenWrapper.Du9h1SFo.js} +1 -1
  89. streamlit/web/cli.py +1 -1
  90. streamlit/web/server/server_util.py +1 -1
  91. {streamlit_nightly-1.45.1.dev20250429.dist-info → streamlit_nightly-1.45.1.dev20250430.dist-info}/METADATA +1 -1
  92. {streamlit_nightly-1.45.1.dev20250429.dist-info → streamlit_nightly-1.45.1.dev20250430.dist-info}/RECORD +96 -96
  93. {streamlit_nightly-1.45.1.dev20250429.dist-info → streamlit_nightly-1.45.1.dev20250430.dist-info}/WHEEL +1 -1
  94. {streamlit_nightly-1.45.1.dev20250429.data → streamlit_nightly-1.45.1.dev20250430.data}/scripts/streamlit.cmd +0 -0
  95. {streamlit_nightly-1.45.1.dev20250429.dist-info → streamlit_nightly-1.45.1.dev20250430.dist-info}/entry_points.txt +0 -0
  96. {streamlit_nightly-1.45.1.dev20250429.dist-info → streamlit_nightly-1.45.1.dev20250430.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
1
- import{n as U,r as a,bj as R,j as m,l as w}from"./index.DewKSDBK.js";const A=U("iframe",{target:"eymnmwl0"})(({theme:r})=>({colorScheme:"normal",border:"none",padding:r.spacing.none,margin:r.spacing.none,width:"100%",aspectRatio:"16 / 9"})),O=w.getLogger("Video"),P={width:"100%"};function $({element:r,endpoints:i,elementMgr:p}){const s=a.useRef(null),{type:v,url:f,startTime:n,subtitles:u,endTime:c,loop:l,autoplay:S,muted:g}=r,T=a.useMemo(()=>{if(!r.id)return!0;const e=p.getElementState(r.id,"preventAutoplay");return e||p.setElementState(r.id,"preventAutoplay",!0),e??!1},[r.id,p]),E=a.useMemo(()=>JSON.stringify(u?u.map(e=>i.buildMediaURL(`${e.url}`)):[]),[u,i]);a.useEffect(()=>{const e=JSON.parse(E);e.length!==0&&e.forEach(t=>{i.checkSourceUrlResponse(t,"Video Subtitle")})},[E,i]),a.useEffect(()=>{s.current&&(s.current.currentTime=n)},[n]),a.useEffect(()=>{const e=s.current,t=()=>{e&&(e.currentTime=r.startTime)};return e&&e.addEventListener("loadedmetadata",t),()=>{e&&e.removeEventListener("loadedmetadata",t)}},[r]),a.useEffect(()=>{const e=s.current;if(!e)return;let t=!1;const d=()=>{c>0&&e.currentTime>=c&&(l?(e.currentTime=n||0,e.play()):t||(t=!0,e.pause()))};return c>0&&e.addEventListener("timeupdate",d),()=>{e&&c>0&&e.removeEventListener("timeupdate",d)}},[c,l,n]),a.useEffect(()=>{const e=s.current;if(!e)return;const t=()=>{l&&(e.currentTime=n||0,e.play())};return e.addEventListener("ended",t),()=>{e&&e.removeEventListener("ended",t)}},[l,n]);const V=e=>{const{startTime:t,endTime:d,loop:b,autoplay:L,muted:N}=r,o=new URL(e);if(t&&!isNaN(t)&&o.searchParams.append("start",t.toString()),d&&!isNaN(d)&&o.searchParams.append("end",d.toString()),b){o.searchParams.append("loop","1");const y=o.pathname.split("/").pop();y&&o.searchParams.append("playlist",y)}return L&&o.searchParams.append("autoplay","1"),N&&o.searchParams.append("mute","1"),o.toString()};if(v===R.Type.YOUTUBE_IFRAME)return m(A,{className:"stVideo","data-testid":"stVideo",title:f,src:V(f),allow:"autoplay; encrypted-media",allowFullScreen:!0});const h=e=>{const t=e.currentTarget.src;O.error(`Client Error: Video source error - ${t}`),i.sendClientErrorToHost("Video","Video source failed to load","onerror triggered",t)};return m("video",{className:"stVideo","data-testid":"stVideo",ref:s,controls:!0,muted:g,autoPlay:S&&!T,src:i.buildMediaURL(f),style:P,crossOrigin:void 0,onError:h,children:u&&u.map((e,t)=>m("track",{kind:"captions",src:i.buildMediaURL(`${e.url}`),label:`${e.label}`,default:t===0,"data-testid":"stVideoSubtitle"},t))})}const M=a.memo($);export{M as default};
1
+ import{n as U,r as a,bj as R,j as m,l as w}from"./index.BQqNcnRp.js";const A=U("iframe",{target:"eymnmwl0"})(({theme:r})=>({colorScheme:"normal",border:"none",padding:r.spacing.none,margin:r.spacing.none,width:"100%",aspectRatio:"16 / 9"})),O=w.getLogger("Video"),P={width:"100%"};function $({element:r,endpoints:i,elementMgr:p}){const s=a.useRef(null),{type:v,url:f,startTime:n,subtitles:u,endTime:c,loop:l,autoplay:S,muted:g}=r,T=a.useMemo(()=>{if(!r.id)return!0;const e=p.getElementState(r.id,"preventAutoplay");return e||p.setElementState(r.id,"preventAutoplay",!0),e??!1},[r.id,p]),E=a.useMemo(()=>JSON.stringify(u?u.map(e=>i.buildMediaURL(`${e.url}`)):[]),[u,i]);a.useEffect(()=>{const e=JSON.parse(E);e.length!==0&&e.forEach(t=>{i.checkSourceUrlResponse(t,"Video Subtitle")})},[E,i]),a.useEffect(()=>{s.current&&(s.current.currentTime=n)},[n]),a.useEffect(()=>{const e=s.current,t=()=>{e&&(e.currentTime=r.startTime)};return e&&e.addEventListener("loadedmetadata",t),()=>{e&&e.removeEventListener("loadedmetadata",t)}},[r]),a.useEffect(()=>{const e=s.current;if(!e)return;let t=!1;const d=()=>{c>0&&e.currentTime>=c&&(l?(e.currentTime=n||0,e.play()):t||(t=!0,e.pause()))};return c>0&&e.addEventListener("timeupdate",d),()=>{e&&c>0&&e.removeEventListener("timeupdate",d)}},[c,l,n]),a.useEffect(()=>{const e=s.current;if(!e)return;const t=()=>{l&&(e.currentTime=n||0,e.play())};return e.addEventListener("ended",t),()=>{e&&e.removeEventListener("ended",t)}},[l,n]);const V=e=>{const{startTime:t,endTime:d,loop:b,autoplay:L,muted:N}=r,o=new URL(e);if(t&&!isNaN(t)&&o.searchParams.append("start",t.toString()),d&&!isNaN(d)&&o.searchParams.append("end",d.toString()),b){o.searchParams.append("loop","1");const y=o.pathname.split("/").pop();y&&o.searchParams.append("playlist",y)}return L&&o.searchParams.append("autoplay","1"),N&&o.searchParams.append("mute","1"),o.toString()};if(v===R.Type.YOUTUBE_IFRAME)return m(A,{className:"stVideo","data-testid":"stVideo",title:f,src:V(f),allow:"autoplay; encrypted-media",allowFullScreen:!0});const h=e=>{const t=e.currentTarget.src;O.error(`Client Error: Video source error - ${t}`),i.sendClientErrorToHost("Video","Video source failed to load","onerror triggered",t)};return m("video",{className:"stVideo","data-testid":"stVideo",ref:s,controls:!0,muted:g,autoPlay:S&&!T,src:i.buildMediaURL(f),style:P,crossOrigin:void 0,onError:h,children:u&&u.map((e,t)=>m("track",{kind:"captions",src:i.buildMediaURL(`${e.url}`),label:`${e.label}`,default:t===0,"data-testid":"stVideoSubtitle"},t))})}const M=a.memo($);export{M as default};
@@ -1 +1 @@
1
- import{n as T,r as l,z as M,c2 as W,c3 as C,C as I,j as r,bs as V,bG as O,bt as L,bb as N,bu as P,c1 as k,c4 as E,bZ as $,c5 as A,bD as B}from"./index.DewKSDBK.js";import{a as D}from"./useBasicWidgetState.QdMR1Kj8.js";import"./FormClearHelper.CcbGU8qM.js";const F=T("div",{target:"euzcfsp0"})(({theme:s})=>({"span[aria-disabled='true']":{background:s.colors.fadedText05}})),H=(s,t)=>s.getStringArrayValue(t),G=s=>s.default.map(t=>s.options[t])??null,U=s=>s.rawValues??null,j=(s,t,n,p)=>{t.setStringArrayValue(s,n.value,{fromUi:n.fromUi},p)},K=s=>{var S;const{element:t,widgetMgr:n,fragmentId:p}=s,e=M(),[i,m]=D({getStateFromWidgetMgr:H,getDefaultStateFromProto:G,getCurrStateFromProto:U,updateWidgetMgrState:j,element:t,widgetMgr:n,fragmentId:p}),h=t.maxSelections>0&&i.length>=t.maxSelections,f=l.useMemo(()=>{if(t.maxSelections===0)return"No results";if(i.length===t.maxSelections){const o=t.maxSelections!==1?"options":"option";return`You can only select up to ${t.maxSelections} ${o}. Remove an option first.`}return"No results"},[t.maxSelections,i.length]),y=l.useMemo(()=>i.map(o=>({value:o,label:o})),[i]),b=l.useCallback(o=>{var c,d;switch(o.type){case"remove":return W(i,(c=o.option)==null?void 0:c.value);case"clear":return[];case"select":return i.concat([(d=o.option)==null?void 0:d.value]);default:throw new Error(`State transition is unknown: ${o.type}`)}},[i]),v=l.useCallback(o=>{t.maxSelections&&o.type==="select"&&i.length>=t.maxSelections||m({value:b(o),fromUi:!0})},[t.maxSelections,b,m,i.length]),x=l.useCallback((o,c)=>{if(h)return[];const d=o.filter(R=>!i.includes(R.value));return C(d,c)},[h,i]),{options:u}=t;let a=s.disabled,g=t.placeholder;u.length===0&&(t.acceptNewOptions?g="Add options":(g="No options to select",a=!0));const z=u.map(o=>({label:o,value:o})),w=u.length>10;return I("div",{className:"stMultiSelect","data-testid":"stMultiSelect",children:[r(P,{label:t.label,disabled:a,labelVisibility:V((S=t.labelVisibility)==null?void 0:S.value),children:t.help&&r(O,{children:r(L,{content:t.help,placement:N.TOP_RIGHT})})}),r(F,{children:r(k,{creatable:t.acceptNewOptions??!1,options:z,labelKey:"label",valueKey:"value","aria-label":t.label,placeholder:g,type:A.select,multi:!0,onChange:v,value:y,disabled:a,size:"compact",noResultsMsg:f,filterOptions:x,closeOnSelect:!1,overrides:{Popover:{props:{overrides:{Body:{style:()=>({marginTop:e.spacing.px})}}}},SelectArrow:{component:$,props:{overrides:{Svg:{style:()=>({width:e.iconSizes.xl,height:e.iconSizes.xl})}}}},IconsContainer:{style:()=>({paddingRight:e.spacing.sm})},ControlContainer:{style:{minHeight:e.sizes.minElementHeight,borderLeftWidth:e.sizes.borderWidth,borderRightWidth:e.sizes.borderWidth,borderTopWidth:e.sizes.borderWidth,borderBottomWidth:e.sizes.borderWidth}},Placeholder:{style:()=>({flex:"inherit",color:a?e.colors.fadedText40:e.colors.fadedText60})},ValueContainer:{style:()=>({paddingLeft:e.spacing.sm,paddingTop:e.spacing.none,paddingBottom:e.spacing.none,paddingRight:e.spacing.none})},ClearIcon:{props:{overrides:{Svg:{style:{color:e.colors.darkGray,padding:e.spacing.threeXS,height:e.sizes.clearIconSize,width:e.sizes.clearIconSize,cursor:"pointer",":hover":{fill:e.colors.bodyText}}}}}},SearchIcon:{style:{color:e.colors.darkGray}},Tag:{props:{overrides:{Root:{style:{borderTopLeftRadius:e.radii.md,borderTopRightRadius:e.radii.md,borderBottomRightRadius:e.radii.md,borderBottomLeftRadius:e.radii.md,fontSize:e.fontSizes.md,paddingLeft:e.spacing.sm,marginLeft:e.spacing.none,marginRight:e.spacing.sm,height:`calc(${e.sizes.minElementHeight} - 2 * ${e.spacing.xs})`,maxWidth:`calc(100% - ${e.spacing.lg})`,cursor:"default !important"}},Action:{style:{paddingLeft:0}},ActionIcon:{props:{overrides:{Svg:{style:{width:"0.625em",height:"0.625em"}}}}}}}},MultiValue:{props:{overrides:{Root:{style:{fontSize:e.fontSizes.sm}}}}},Input:{props:{readOnly:B.isMobile&&w===!1?"readonly":null}},Dropdown:{component:E}}})})]})},_=l.memo(K);export{_ as default};
1
+ import{n as T,r as l,z as M,c2 as W,c3 as C,C as I,j as r,bs as V,bG as O,bt as L,bb as N,bu as P,c1 as k,c4 as E,bZ as $,c5 as A,bD as B}from"./index.BQqNcnRp.js";import{a as D}from"./useBasicWidgetState.DM0uW3hG.js";import"./FormClearHelper.CyxVAl63.js";const F=T("div",{target:"euzcfsp0"})(({theme:s})=>({"span[aria-disabled='true']":{background:s.colors.fadedText05}})),H=(s,t)=>s.getStringArrayValue(t),G=s=>s.default.map(t=>s.options[t])??null,U=s=>s.rawValues??null,j=(s,t,n,p)=>{t.setStringArrayValue(s,n.value,{fromUi:n.fromUi},p)},K=s=>{var S;const{element:t,widgetMgr:n,fragmentId:p}=s,e=M(),[i,m]=D({getStateFromWidgetMgr:H,getDefaultStateFromProto:G,getCurrStateFromProto:U,updateWidgetMgrState:j,element:t,widgetMgr:n,fragmentId:p}),h=t.maxSelections>0&&i.length>=t.maxSelections,f=l.useMemo(()=>{if(t.maxSelections===0)return"No results";if(i.length===t.maxSelections){const o=t.maxSelections!==1?"options":"option";return`You can only select up to ${t.maxSelections} ${o}. Remove an option first.`}return"No results"},[t.maxSelections,i.length]),y=l.useMemo(()=>i.map(o=>({value:o,label:o})),[i]),b=l.useCallback(o=>{var c,d;switch(o.type){case"remove":return W(i,(c=o.option)==null?void 0:c.value);case"clear":return[];case"select":return i.concat([(d=o.option)==null?void 0:d.value]);default:throw new Error(`State transition is unknown: ${o.type}`)}},[i]),v=l.useCallback(o=>{t.maxSelections&&o.type==="select"&&i.length>=t.maxSelections||m({value:b(o),fromUi:!0})},[t.maxSelections,b,m,i.length]),x=l.useCallback((o,c)=>{if(h)return[];const d=o.filter(R=>!i.includes(R.value));return C(d,c)},[h,i]),{options:u}=t;let a=s.disabled,g=t.placeholder;u.length===0&&(t.acceptNewOptions?g="Add options":(g="No options to select",a=!0));const z=u.map(o=>({label:o,value:o})),w=u.length>10;return I("div",{className:"stMultiSelect","data-testid":"stMultiSelect",children:[r(P,{label:t.label,disabled:a,labelVisibility:V((S=t.labelVisibility)==null?void 0:S.value),children:t.help&&r(O,{children:r(L,{content:t.help,placement:N.TOP_RIGHT})})}),r(F,{children:r(k,{creatable:t.acceptNewOptions??!1,options:z,labelKey:"label",valueKey:"value","aria-label":t.label,placeholder:g,type:A.select,multi:!0,onChange:v,value:y,disabled:a,size:"compact",noResultsMsg:f,filterOptions:x,closeOnSelect:!1,overrides:{Popover:{props:{overrides:{Body:{style:()=>({marginTop:e.spacing.px})}}}},SelectArrow:{component:$,props:{overrides:{Svg:{style:()=>({width:e.iconSizes.xl,height:e.iconSizes.xl})}}}},IconsContainer:{style:()=>({paddingRight:e.spacing.sm})},ControlContainer:{style:{minHeight:e.sizes.minElementHeight,borderLeftWidth:e.sizes.borderWidth,borderRightWidth:e.sizes.borderWidth,borderTopWidth:e.sizes.borderWidth,borderBottomWidth:e.sizes.borderWidth}},Placeholder:{style:()=>({flex:"inherit",color:a?e.colors.fadedText40:e.colors.fadedText60})},ValueContainer:{style:()=>({paddingLeft:e.spacing.sm,paddingTop:e.spacing.none,paddingBottom:e.spacing.none,paddingRight:e.spacing.none})},ClearIcon:{props:{overrides:{Svg:{style:{color:e.colors.darkGray,padding:e.spacing.threeXS,height:e.sizes.clearIconSize,width:e.sizes.clearIconSize,cursor:"pointer",":hover":{fill:e.colors.bodyText}}}}}},SearchIcon:{style:{color:e.colors.darkGray}},Tag:{props:{overrides:{Root:{style:{borderTopLeftRadius:e.radii.md,borderTopRightRadius:e.radii.md,borderBottomRightRadius:e.radii.md,borderBottomLeftRadius:e.radii.md,fontSize:e.fontSizes.md,paddingLeft:e.spacing.sm,marginLeft:e.spacing.none,marginRight:e.spacing.sm,height:`calc(${e.sizes.minElementHeight} - 2 * ${e.spacing.xs})`,maxWidth:`calc(100% - ${e.spacing.lg})`,cursor:"default !important"}},Action:{style:{paddingLeft:0}},ActionIcon:{props:{overrides:{Svg:{style:{width:"0.625em",height:"0.625em"}}}}}}}},MultiValue:{props:{overrides:{Root:{style:{fontSize:e.fontSizes.sm}}}}},Input:{props:{readOnly:B.isMobile&&w===!1?"readonly":null}},Dropdown:{component:E}}})})]})},_=l.memo(K);export{_ as default};
@@ -1,2 +1,2 @@
1
- import{bw as Z,bx as J,r as f,by as Q,z as Y,bz as s,j as v,C as ee,bs as te,bA as re,bt as ne,bb as oe,bB as ie,bu as ae,bq as ue,b6 as C,b5 as W,b8 as le}from"./index.DewKSDBK.js";import{a as ce}from"./useBasicWidgetState.QdMR1Kj8.js";import"./FormClearHelper.CcbGU8qM.js";var se={secondary:"secondary"},G={default:"default"},fe={default:"default"},k=Object.freeze({radio:"radio",checkbox:"checkbox"}),z=Z("div",function(e){var t=e.$shape,r=e.$length,n=e.$theme,o=r===1?void 0:t!==G.default?"-".concat(n.sizing.scale100):"-0.5px";return{display:"flex",marginLeft:o,marginRight:o}});z.displayName="StyledRoot";z.displayName="StyledRoot";function j(e){"@babel/helpers - typeof";return j=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(e)}function M(){return M=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},M.apply(this,arguments)}function x(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function pe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?x(Object(r),!0).forEach(function(n){N(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function de(e,t){return me(e)||he(e,t)||be(e,t)||ye()}function ye(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{bw as Z,bx as J,r as f,by as Q,z as Y,bz as s,j as v,C as ee,bs as te,bA as re,bt as ne,bb as oe,bB as ie,bu as ae,bq as ue,b6 as C,b5 as W,b8 as le}from"./index.BQqNcnRp.js";import{a as ce}from"./useBasicWidgetState.DM0uW3hG.js";import"./FormClearHelper.CyxVAl63.js";var se={secondary:"secondary"},G={default:"default"},fe={default:"default"},k=Object.freeze({radio:"radio",checkbox:"checkbox"}),z=Z("div",function(e){var t=e.$shape,r=e.$length,n=e.$theme,o=r===1?void 0:t!==G.default?"-".concat(n.sizing.scale100):"-0.5px";return{display:"flex",marginLeft:o,marginRight:o}});z.displayName="StyledRoot";z.displayName="StyledRoot";function j(e){"@babel/helpers - typeof";return j=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(e)}function M(){return M=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},M.apply(this,arguments)}function x(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function pe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?x(Object(r),!0).forEach(function(n){N(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function de(e,t){return me(e)||he(e,t)||be(e,t)||ye()}function ye(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function be(e,t){if(e){if(typeof e=="string")return X(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return X(e,t)}}function X(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function he(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,i=!1,a,p;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));o=!0);}catch(c){i=!0,p=c}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw p}}return n}}function me(e){if(Array.isArray(e))return e}function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Se(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 ve(e,t,r){return t&&Se(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Oe(e,t){if(typeof t!="function"&&t!==null)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&&$(e,t)}function $(e,t){return $=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},$(e,t)}function Ee(e){var t=we();return function(){var n=A(e),o;if(t){var i=A(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return _e(this,o)}}function _e(e,t){if(t&&(j(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return K(e)}function K(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function we(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function A(e){return A=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},A(e)}function N(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Le(e,t){return!Array.isArray(e)&&typeof e!="number"?!1:Array.isArray(e)?e.includes(t):e===t}var F=function(e){Oe(r,e);var t=Ee(r);function r(){var n;ge(this,r);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=t.call.apply(t,[this].concat(i)),N(K(n),"childRefs",{}),n}return ve(r,[{key:"render",value:function(){var o=this,i=this.props,a=i.overrides,p=a===void 0?{}:a,c=i.mode,P=c===void 0?k.checkbox:c,d=i.children,y=i.selected,h=i.disabled,l=i.onClick,_=i.kind,m=i.shape,w=i.size,B=J(p.Root,z),O=de(B,2),E=O[0],L=O[1],H=this.props["aria-label"]||this.props.ariaLabel,g=P===k.radio,V=f.Children.count(d);return f.createElement(Q.Consumer,null,function(q){return f.createElement(E,M({"aria-label":H||q.buttongroup.ariaLabel,"data-baseweb":"button-group",role:g?"radiogroup":"group",$shape:m,$length:d.length},L),f.Children.map(d,function(b,R){if(!f.isValidElement(b))return null;var I=b.props.isSelected?b.props.isSelected:Le(y,R);return g&&(o.childRefs[R]=f.createRef()),f.cloneElement(b,{disabled:h||b.props.disabled,isSelected:I,ref:g?o.childRefs[R]:void 0,tabIndex:!g||I||g&&(!y||y===-1)&&R===0?0:-1,onKeyDown:function(u){if(g){var S=Number(y)?Number(y):0;if(u.key==="ArrowUp"||u.key==="ArrowLeft"){u.preventDefault&&u.preventDefault();var T=S-1<0?V-1:S-1;l&&l(u,T),o.childRefs[T].current&&o.childRefs[T].current.focus()}if(u.key==="ArrowDown"||u.key==="ArrowRight"){u.preventDefault&&u.preventDefault();var D=S+1>V-1?0:S+1;l&&l(u,D),o.childRefs[D].current&&o.childRefs[D].current.focus()}}},kind:_,onClick:function(u){h||(b.props.onClick&&b.props.onClick(u),l&&l(u,R))},shape:m,size:w,overrides:pe({BaseButton:{style:function(u){var S=u.$theme;return d.length===1?{}:m!==G.default?{marginLeft:S.sizing.scale100,marginRight:S.sizing.scale100}:{marginLeft:"0.5px",marginRight:"0.5px"}},props:{"aria-checked":I,role:g?"radio":"checkbox"}}},b.props.overrides)})}))})}}]),r}(f.Component);N(F,"defaultProps",{disabled:!1,onClick:function(){},shape:G.default,size:fe.default,kind:se.secondary});function Re(e,t){return t.includes(e)?t.filter(r=>r!==e):[...t,e]}function Ce(e,t,r){return e==s.ClickMode.MULTI_SELECT?Re(t,r??[]):r!=null&&r.includes(t)?[]:[t]}function Pe(e){return e.length===0?-1:e[0]}function ke(e,t,r,n){t.setIntArrayValue(e,r.value,{fromUi:r.fromUi},n)}function Ae(e,t,r){const n=r===s.Style.PILLS?C.PILLS:r===s.Style.BORDERLESS?C.BORDERLESS_ICON:C.SEGMENTED_CONTROL,o=r===s.Style.BORDERLESS?W.XSMALL:W.MEDIUM,i=n===C.PILLS||n===C.SEGMENTED_CONTROL,a=r===s.Style.BORDERLESS?"lg":"base";return{element:v(le,{icon:t,label:e,iconSize:a,useSmallerFont:i}),kind:n,size:o}}function Be(e,t,r,n){return r.indexOf(n)>-1?!0:t!==s.ClickMode.SINGLE_SELECT||e!==s.SelectionVisualization.ALL_UP_TO_SELECTED?!1:r.length>0&&n<r[0]}function Ie(e,t){return e&&(t=`${t}Active`),t}function Te(e,t){const r={flexWrap:"wrap",maxWidth:"fit-content"};switch(e){case s.Style.BORDERLESS:return{...r,columnGap:t.threeXS,rowGap:t.threeXS};case s.Style.PILLS:return{...r,columnGap:t.twoXS,rowGap:t.twoXS};case s.Style.SEGMENTED_CONTROL:return{...r,columnGap:t.none,rowGap:t.twoXS,"::after":{content:"''",flex:1e4}};default:return r}}function De(e,t,r,n,o,i){const a=Be(r,n,o,t);let p=e.content,c=e.contentIcon;return a&&(p=e.selectedContent?e.selectedContent:p,c=e.selectedContentIcon?e.selectedContentIcon:c),f.forwardRef(function(d,y){const{element:h,kind:l,size:_}=Ae(p??"",c??void 0,i),m=Ie(!!(a&&!e.selectedContent&&!e.selectedContentIcon),l);return v(ue,{...d,size:_,kind:m,children:h})})}function je(e,t){return e.getIntArrayValue(t)}function Me(e){return e.default??null}function $e(e){return e.value??null}function Ge(e){const{disabled:t,element:r,fragmentId:n,widgetMgr:o}=e,{clickMode:i,options:a,selectionVisualization:p,style:c,label:P,labelVisibility:d,help:y}=r,h=Y(),[l,_]=ce({getStateFromWidgetMgr:je,getDefaultStateFromProto:Me,getCurrStateFromProto:$e,updateWidgetMgrState:ke,element:r,widgetMgr:o,fragmentId:n}),m=(O,E)=>{const L=Ce(i,E,l);_({value:L,fromUi:!0})};let w;i===s.ClickMode.SINGLE_SELECT?w=k.radio:i===s.ClickMode.MULTI_SELECT&&(w=k.checkbox);const B=f.useMemo(()=>a.map((O,E)=>{const L=De(O,E,p,i,l,c);return v(L,{},`${O.content}-${E}`)}),[i,a,p,c,l]);return ee("div",{className:"stButtonGroup","data-testid":"stButtonGroup",children:[v(ae,{label:P,disabled:t,labelVisibility:te((d==null?void 0:d.value)??ie.LabelVisibilityOptions.COLLAPSED),children:y&&v(re,{children:v(ne,{content:y,placement:oe.TOP})})}),v(F,{disabled:t,mode:w,onClick:m,selected:i===s.ClickMode.MULTI_SELECT?l:Pe(l),overrides:{Root:{style:f.useCallback(()=>Te(c,h.spacing),[c,h.spacing])}},children:B})]})}const Ue=f.memo(Ge);export{Ue as default};