streamlit-nightly 1.52.3.dev20260113__py3-none-any.whl → 1.53.1.dev20260115__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 (135) hide show
  1. streamlit/__init__.py +0 -26
  2. streamlit/commands/logo.py +2 -0
  3. streamlit/commands/page_config.py +16 -16
  4. streamlit/components/v2/__init__.py +2 -2
  5. streamlit/config.py +29 -0
  6. streamlit/connections/base_connection.py +16 -4
  7. streamlit/connections/snowflake_connection.py +254 -205
  8. streamlit/elements/form.py +2 -2
  9. streamlit/elements/lib/streamlit_plotly_theme.py +9 -11
  10. streamlit/elements/metric.py +49 -48
  11. streamlit/elements/widgets/button.py +9 -9
  12. streamlit/elements/widgets/chat.py +5 -9
  13. streamlit/elements/widgets/data_editor.py +3 -3
  14. streamlit/elements/widgets/file_uploader.py +10 -11
  15. streamlit/elements/widgets/select_slider.py +4 -0
  16. streamlit/proto/NewSession_pb2.py +18 -18
  17. streamlit/proto/NewSession_pb2.pyi +5 -1
  18. streamlit/runtime/app_session.py +78 -58
  19. streamlit/runtime/caching/cache_data_api.py +25 -21
  20. streamlit/runtime/caching/cache_resource_api.py +69 -41
  21. streamlit/runtime/connection_factory.py +67 -41
  22. streamlit/runtime/scriptrunner_utils/script_run_context.py +0 -21
  23. streamlit/runtime/state/query_params.py +0 -19
  24. streamlit/static/index.html +1 -1
  25. streamlit/static/manifest.json +296 -296
  26. streamlit/static/static/js/{ErrorOutline.esm.BjVqd_6R.js → ErrorOutline.esm.CiSfK8ht.js} +1 -1
  27. streamlit/static/static/js/{FileDownload.esm.DJCSsghl.js → FileDownload.esm.ItNjcEfs.js} +1 -1
  28. streamlit/static/static/js/{FileHelper.C---TH7o.js → FileHelper.xS7f19FE.js} +1 -1
  29. streamlit/static/static/js/{FormClearHelper.C-6BC487.js → FormClearHelper.N8_BCinn.js} +1 -1
  30. streamlit/static/static/js/{InputInstructions.sxc3InCI.js → InputInstructions.CrsdK7CQ.js} +1 -1
  31. streamlit/static/static/js/Particles.BDlTHC3I.js +1 -0
  32. streamlit/static/static/js/{ProgressBar.BiYsyZCC.js → ProgressBar.Bk2qeHfS.js} +2 -2
  33. streamlit/static/static/js/{StreamlitSyntaxHighlighter.9jZF8jX1.js → StreamlitSyntaxHighlighter.BcuPrPcw.js} +1 -1
  34. streamlit/static/static/js/{TableChart.esm.BdA4Q1rZ.js → TableChart.esm.CP7XPz8I.js} +1 -1
  35. streamlit/static/static/js/Toolbar.DCJcLwve.js +1 -0
  36. streamlit/static/static/js/{WidgetLabelHelpIconInline.DxODTLS2.js → WidgetLabelHelpIconInline.BPqxu1b-.js} +1 -1
  37. streamlit/static/static/js/{base-input.Gf1cKuQR.js → base-input.x4muJJ13.js} +4 -4
  38. streamlit/static/static/js/{checkbox.CnoNruf3.js → checkbox.C5r4AIaH.js} +1 -1
  39. streamlit/static/static/js/{createDownloadLinkElement.B48AepiL.js → createDownloadLinkElement.C83kkEeT.js} +1 -1
  40. streamlit/static/static/js/{data-grid-overlay-editor.Cmdq9aqU.js → data-grid-overlay-editor.0sOWm4IB.js} +1 -1
  41. streamlit/static/static/js/{downloader.CQLoQdMX.js → downloader.C_6FfoEv.js} +1 -1
  42. streamlit/static/static/js/{embed.oKwocwU8.js → embed.BnJ6-SK4.js} +14 -14
  43. streamlit/static/static/js/{es6.BRxlY_y5.js → es6.44_BWfFd.js} +2 -2
  44. streamlit/static/static/js/{formatNumber.DaagZyZe.js → formatNumber.DhHZAosz.js} +1 -1
  45. streamlit/static/static/js/{iconPosition.Q3hNvmK4.js → iconPosition.shOoQuRR.js} +1 -1
  46. streamlit/static/static/js/{iframeResizer.contentWindow.B6EBvI9L.js → iframeResizer.contentWindow.savEE5Vs.js} +1 -1
  47. streamlit/static/static/js/{index.BF23fbfs.js → index.AdijUi9Z.js} +1 -1
  48. streamlit/static/static/js/{index.OpATzEaW.js → index.B5HlOnvq.js} +1 -1
  49. streamlit/static/static/js/{index.Ca7MUNWJ.js → index.B6ewTTej.js} +1 -1
  50. streamlit/static/static/js/{index.CP-hoxJM.js → index.B8Of3XXR.js} +1 -1
  51. streamlit/static/static/js/{index.whRT3Vm3.js → index.BCaCSVj6.js} +1 -1
  52. streamlit/static/static/js/index.BE7Rhig1.js +1 -0
  53. streamlit/static/static/js/{index.BkSwGJoh.js → index.BHpLZ7X6.js} +2 -2
  54. streamlit/static/static/js/{index.na9UBuse.js → index.BNvP8E5Q.js} +1 -1
  55. streamlit/static/static/js/{index.CYE7b5Du.js → index.BNzuyXeN.js} +2 -2
  56. streamlit/static/static/js/{index.slgxPafU.js → index.BT7o4A9V.js} +1 -1
  57. streamlit/static/static/js/{index.BXEC4cf3.js → index.BYY3iuVE.js} +1 -1
  58. streamlit/static/static/js/index.BZI7jTDf.js +1 -0
  59. streamlit/static/static/js/{index.19_qtO6t.js → index.BZXk3Qxq.js} +1 -1
  60. streamlit/static/static/js/{index.B03eQZoH.js → index.BhQvq6YD.js} +1 -1
  61. streamlit/static/static/js/{index.WXybx2Xq.js → index.BkIReLGJ.js} +3 -3
  62. streamlit/static/static/js/{index.BoX8d5rK.js → index.Bl7SMZUw.js} +1 -1
  63. streamlit/static/static/js/{index.BGBTkulf.js → index.BqtgAGnG.js} +2 -2
  64. streamlit/static/static/js/{index.KtjGDGY5.js → index.BwnLQnAk.js} +1 -1
  65. streamlit/static/static/js/index.C1coXTgf.js +2 -0
  66. streamlit/static/static/js/{index.CVlg41MB.js → index.C6uOmY9O.js} +1 -1
  67. streamlit/static/static/js/index.CF88nImM.js +1 -0
  68. streamlit/static/static/js/{index.CFCBhOfx.js → index.CFlGfFvq.js} +1 -1
  69. streamlit/static/static/js/{index.Xg-Qttib.js → index.CQgiNpC7.js} +1 -1
  70. streamlit/static/static/js/{index.CCFwVy90.js → index.CZJkiRFm.js} +1 -1
  71. streamlit/static/static/js/index.Ch1TdQMG.js +1 -0
  72. streamlit/static/static/js/{index.CvIqsWy1.js → index.Ck2mQvBi.js} +1 -1
  73. streamlit/static/static/js/{index.BAI9aHCq.js → index.CrD2lwZG.js} +1 -1
  74. streamlit/static/static/js/index.CySNwKoN.js +2 -0
  75. streamlit/static/static/js/index.D3LEkXqN.js +1 -0
  76. streamlit/static/static/js/{index.QTaWooav.js → index.D8BQH06Z.js} +1 -1
  77. streamlit/static/static/js/{index.B9kZB0o1.js → index.DBtWixG1.js} +1 -1
  78. streamlit/static/static/js/{index.BzwlrgZO.js → index.DIsNrJpC.js} +1 -1
  79. streamlit/static/static/js/{index.Fu73QtkD.js → index.DO3HICut.js} +1 -1
  80. streamlit/static/static/js/{index.KN1VmyYN.js → index.D_ziFad8.js} +1 -1
  81. streamlit/static/static/js/{index.pU9mQeVC.js → index.Dblsdn8d.js} +1 -1
  82. streamlit/static/static/js/{index.Boa0Egng.js → index.DcdD0ROn.js} +2 -2
  83. streamlit/static/static/js/{index.CvB9JBqS.js → index.DfHm3P22.js} +51 -51
  84. streamlit/static/static/js/{index.BRfGUOQ-.js → index.DiwhD0Ic.js} +46 -46
  85. streamlit/static/static/js/index.DvZDNiBV.js +11 -0
  86. streamlit/static/static/js/{index.CJ4oJe0V.js → index.HjydQ4bj.js} +1 -1
  87. streamlit/static/static/js/{index.BbSFVZ3p.js → index.HsxzYHNf.js} +1 -1
  88. streamlit/static/static/js/{index.BVT89mQw.js → index.SVJGpnpy.js} +1 -1
  89. streamlit/static/static/js/index.SjKkVSL7.js +1 -0
  90. streamlit/static/static/js/index.hX8_3tMP.js +1 -0
  91. streamlit/static/static/js/{index.CCQ5p_WC.js → index.jZin0w6_.js} +1 -1
  92. streamlit/static/static/js/{index.BnfTPrHb.js → index.pQvPlPcA.js} +4 -4
  93. streamlit/static/static/js/index.pzQTLx9j.js +1 -0
  94. streamlit/static/static/js/{index.D6X2coHR.js → index.s44_OVd6.js} +33 -33
  95. streamlit/static/static/js/{input.CPzINTl-.js → input.jAD-v9D6.js} +2 -2
  96. streamlit/static/static/js/{main.DSPn8dUe.js → main.Cas0fuOs.js} +1 -1
  97. streamlit/static/static/js/{memory.CfD8IGoU.js → memory.ENruL8Qk.js} +1 -1
  98. streamlit/static/static/js/{number-overlay-editor.4Ae0qegV.js → number-overlay-editor.DAOTdulh.js} +2 -2
  99. streamlit/static/static/js/{pandasStylerUtils.D2EjZ7k6.js → pandasStylerUtils.DChYgcPq.js} +1 -1
  100. streamlit/static/static/js/{sandbox.C6vcPIm0.js → sandbox.DWZYRCm0.js} +1 -1
  101. streamlit/static/static/js/{styled-components.BBmp8buj.js → styled-components.3lwVqgRW.js} +1 -1
  102. streamlit/static/static/js/{throttle.BPcPpy-S.js → throttle.DfOW1Cns.js} +1 -1
  103. streamlit/static/static/js/{timepicker.ryzkTs2C.js → timepicker.CXHgL5f9.js} +1 -1
  104. streamlit/static/static/js/{toConsumableArray.Dg1nDaB_.js → toConsumableArray.DiW0GSDV.js} +1 -1
  105. streamlit/static/static/js/uniqueId.Dfi3SGKZ.js +1 -0
  106. streamlit/static/static/js/{useBasicWidgetState.A4U5lzAm.js → useBasicWidgetState.DnPEt_f3.js} +1 -1
  107. streamlit/static/static/js/{useIntlLocale.DWJgLlNz.js → useIntlLocale.BZEGSOVD.js} +8 -8
  108. streamlit/static/static/js/{useTextInputAutoExpand.BrBonw8t.js → useTextInputAutoExpand.MGVZMqyt.js} +1 -1
  109. streamlit/static/static/js/useUpdateUiValue.CPl6CEx3.js +1 -0
  110. streamlit/static/static/js/{useWaveformController.CBlvXlgZ.js → useWaveformController.DOpzDyZu.js} +1 -1
  111. streamlit/static/static/js/{withCalculatedWidth.D4cpOyNe.js → withCalculatedWidth.DgKFTeif.js} +1 -1
  112. streamlit/static/static/js/{withFullScreenWrapper.BMim3w94.js → withFullScreenWrapper.K1jkwhPu.js} +1 -1
  113. streamlit/user_info.py +225 -166
  114. {streamlit_nightly-1.52.3.dev20260113.dist-info → streamlit_nightly-1.53.1.dev20260115.dist-info}/METADATA +1 -1
  115. {streamlit_nightly-1.52.3.dev20260113.dist-info → streamlit_nightly-1.53.1.dev20260115.dist-info}/RECORD +119 -120
  116. streamlit/commands/experimental_query_params.py +0 -169
  117. streamlit/static/static/js/Particles.S8yD7iW-.js +0 -1
  118. streamlit/static/static/js/Toolbar.B9DaaDfN.js +0 -1
  119. streamlit/static/static/js/index.43b777iP.js +0 -1
  120. streamlit/static/static/js/index.C0fSEz-3.js +0 -1
  121. streamlit/static/static/js/index.CIbgt5wY.js +0 -1
  122. streamlit/static/static/js/index.CSfsEKCF.js +0 -2
  123. streamlit/static/static/js/index.CrPjcPY1.js +0 -1
  124. streamlit/static/static/js/index.D1pK_Vw2.js +0 -1
  125. streamlit/static/static/js/index.DGYHxruh.js +0 -1
  126. streamlit/static/static/js/index.DJ7P09eb.js +0 -2
  127. streamlit/static/static/js/index.Dh5SAThV.js +0 -11
  128. streamlit/static/static/js/index.QHnxuesF.js +0 -1
  129. streamlit/static/static/js/index.j4fnjyHo.js +0 -1
  130. streamlit/static/static/js/uniqueId.BFHzT5KQ.js +0 -1
  131. streamlit/static/static/js/useUpdateUiValue.BkOWyNVX.js +0 -1
  132. {streamlit_nightly-1.52.3.dev20260113.data → streamlit_nightly-1.53.1.dev20260115.data}/scripts/streamlit.cmd +0 -0
  133. {streamlit_nightly-1.52.3.dev20260113.dist-info → streamlit_nightly-1.53.1.dev20260115.dist-info}/WHEEL +0 -0
  134. {streamlit_nightly-1.52.3.dev20260113.dist-info → streamlit_nightly-1.53.1.dev20260115.dist-info}/entry_points.txt +0 -0
  135. {streamlit_nightly-1.52.3.dev20260113.dist-info → streamlit_nightly-1.53.1.dev20260115.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
1
- import{r as o,L,I as M,B as w,u as T,o as U,j as u,b as A,c as P,D as j,a as N,J as Y}from"./index.BRfGUOQ-.js";import{m as z}from"./iconPosition.Q3hNvmK4.js";import{c as R}from"./createDownloadLinkElement.B48AepiL.js";function F(S){const{disabled:i,element:r,widgetMgr:B,endpoints:t,fragmentId:g}=S,{help:v,label:x,icon:I,ignoreRerun:h,type:p,url:k,deferredFileId:n}=r,b=r.shortcut?r.shortcut:void 0,[C,f]=o.useState(!1),[l,s]=o.useState(null),{enforceDownloadInNewTab:d=!1}=o.useContext(L),{requestDeferredFile:D}=o.useContext(M);let m=w.SECONDARY;p==="primary"?m=w.PRIMARY:p==="tertiary"&&(m=w.TERTIARY);const c=o.useMemo(()=>t.buildDownloadUrl(k),[t,k]);o.useEffect(()=>{n?.length||t.checkSourceUrlResponse(c,"Download Button")},[c,t,n]);const E=o.useCallback(async()=>{if(!D||!n){s("Deferred download not properly configured");return}f(!0),s(null);try{const e=await D(n);if(e.errorMsg){s(e.errorMsg),f(!1);return}const a=t.buildDownloadUrl(e.url);t.checkSourceUrlResponse(a,"Download Button"),R({filename:"",url:a,enforceDownloadInNewTab:d}).click()}catch(e){const a=e instanceof Error?e.message:"Download failed";s(a)}finally{f(!1)}},[D,n,t,d]),y=o.useCallback(()=>{if(i)return;h||B.setTriggerValue(r,{fromUi:!0},g),!!n?.length?E():R({filename:"",url:c,enforceDownloadInNewTab:d}).click()},[i,h,B,r,g,n,E,c,d]);return T({shortcut:b,disabled:i,onActivate:y}),o.useEffect(()=>{if(l){const e=setTimeout(()=>s(null),5e3);return()=>clearTimeout(e)}},[l]),U("div",{className:"stDownloadButton","data-testid":"stDownloadButton",children:[u(N,{help:v,containerWidth:!0,children:u(A,{kind:m,size:P.SMALL,disabled:i||C,onClick:y,containerWidth:!0,children:u(j,{icon:C?"spinner":I,iconPosition:z(r.iconPosition),label:x,shortcut:b})})}),l&&u(Y,{"data-testid":"stDownloadButtonError",children:l})]})}const O=o.memo(F);export{O as default};
1
+ import{r as o,L,H as M,B as w,u as T,o as U,j as u,b as A,c as P,D as j,a as N,I as Y}from"./index.DiwhD0Ic.js";import{m as z}from"./iconPosition.shOoQuRR.js";import{c as R}from"./createDownloadLinkElement.C83kkEeT.js";function F(S){const{disabled:i,element:r,widgetMgr:B,endpoints:t,fragmentId:g}=S,{help:v,label:x,icon:I,ignoreRerun:h,type:p,url:k,deferredFileId:n}=r,b=r.shortcut?r.shortcut:void 0,[C,f]=o.useState(!1),[l,s]=o.useState(null),{enforceDownloadInNewTab:d=!1}=o.useContext(L),{requestDeferredFile:D}=o.useContext(M);let m=w.SECONDARY;p==="primary"?m=w.PRIMARY:p==="tertiary"&&(m=w.TERTIARY);const c=o.useMemo(()=>t.buildDownloadUrl(k),[t,k]);o.useEffect(()=>{n?.length||t.checkSourceUrlResponse(c,"Download Button")},[c,t,n]);const E=o.useCallback(async()=>{if(!D||!n){s("Deferred download not properly configured");return}f(!0),s(null);try{const e=await D(n);if(e.errorMsg){s(e.errorMsg),f(!1);return}const a=t.buildDownloadUrl(e.url);t.checkSourceUrlResponse(a,"Download Button"),R({filename:"",url:a,enforceDownloadInNewTab:d}).click()}catch(e){const a=e instanceof Error?e.message:"Download failed";s(a)}finally{f(!1)}},[D,n,t,d]),y=o.useCallback(()=>{if(i)return;h||B.setTriggerValue(r,{fromUi:!0},g),!!n?.length?E():R({filename:"",url:c,enforceDownloadInNewTab:d}).click()},[i,h,B,r,g,n,E,c,d]);return T({shortcut:b,disabled:i,onActivate:y}),o.useEffect(()=>{if(l){const e=setTimeout(()=>s(null),5e3);return()=>clearTimeout(e)}},[l]),U("div",{className:"stDownloadButton","data-testid":"stDownloadButton",children:[u(N,{help:v,containerWidth:!0,children:u(A,{kind:m,size:P.SMALL,disabled:i||C,onClick:y,containerWidth:!0,children:u(j,{icon:C?"spinner":I,iconPosition:z(r.iconPosition),label:x,shortcut:b})})}),l&&u(Y,{"data-testid":"stDownloadButtonError",children:l})]})}const O=o.memo(F);export{O as default};
@@ -1,2 +1,2 @@
1
- import{ao as q,x as J,r as c,b9 as Q,l as Y,ba as ee,bb as l,j as L,o as te,p as re,P as ne,bc as oe,ad as ie,bd as ae,b as ue,B as C,c as x,D as le}from"./index.BRfGUOQ-.js";import{W as ce}from"./WidgetLabelHelpIconInline.DxODTLS2.js";import{u as se}from"./useBasicWidgetState.A4U5lzAm.js";import"./FormClearHelper.C-6BC487.js";var fe={secondary:"secondary"},N={default:"default"},pe={default:"default"},k=Object.freeze({radio:"radio",checkbox:"checkbox"}),z=q("div",function(e){var t=e.$shape,r=e.$length,n=e.$theme,o=r===1?void 0:t!==N.default?"-".concat(n.sizing.scale100):"-0.5px";return{display:"flex",marginLeft:o,marginRight:o}});z.displayName="StyledRoot";z.displayName="StyledRoot";function M(e){"@babel/helpers - typeof";return M=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},M(e)}function $(){return $=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},$.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 de(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){V(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 ye(e,t){return Se(e)||me(e,t)||he(e,t)||be()}function be(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function he(e,t){if(e){if(typeof e=="string")return K(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 K(e,t)}}function K(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 me(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,d;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));o=!0);}catch(s){i=!0,d=s}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw d}}return n}}function Se(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 ve(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 Oe(e,t,r){return t&&ve(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ee(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&&G(e,t)}function G(e,t){return G=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},G(e,t)}function _e(e){var t=Le();return function(){var n=B(e),o;if(t){var i=B(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return we(this,o)}}function we(e,t){if(t&&(M(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return F(e)}function F(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Le(){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 B(e){return B=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},B(e)}function V(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Re(e,t){return!Array.isArray(e)&&typeof e!="number"?!1:Array.isArray(e)?e.includes(t):e===t}var H=(function(e){Ee(r,e);var t=_e(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)),V(F(n),"childRefs",{}),n}return Oe(r,[{key:"render",value:function(){var o=this,i=this.props,a=i.overrides,d=a===void 0?{}:a,s=i.mode,y=s===void 0?k.checkbox:s,S=i.children,b=i.selected,E=i.disabled,f=i.onClick,h=i.kind,v=i.shape,m=i.size,I=J(d.Root,z),_=ye(I,2),A=_[0],R=_[1],w=this.props["aria-label"]||this.props.ariaLabel,p=y===k.radio,W=c.Children.count(S);return c.createElement(Q.Consumer,null,function(Z){return c.createElement(A,$({"aria-label":w||Z.buttongroup.ariaLabel,"data-baseweb":"button-group",role:p?"radiogroup":"group",$shape:v,$length:S.length},R),c.Children.map(S,function(g,P){if(!c.isValidElement(g))return null;var D=g.props.isSelected?g.props.isSelected:Re(b,P);return p&&(o.childRefs[P]=c.createRef()),c.cloneElement(g,{disabled:E||g.props.disabled,isSelected:D,ref:p?o.childRefs[P]:void 0,tabIndex:!p||D||p&&(!b||b===-1)&&P===0?0:-1,onKeyDown:function(u){if(p){var O=Number(b)?Number(b):0;if(u.key==="ArrowUp"||u.key==="ArrowLeft"){u.preventDefault&&u.preventDefault();var T=O-1<0?W-1:O-1;f&&f(u,T),o.childRefs[T].current&&o.childRefs[T].current.focus()}if(u.key==="ArrowDown"||u.key==="ArrowRight"){u.preventDefault&&u.preventDefault();var j=O+1>W-1?0:O+1;f&&f(u,j),o.childRefs[j].current&&o.childRefs[j].current.focus()}}},kind:h,onClick:function(u){E||(g.props.onClick&&g.props.onClick(u),f&&f(u,P))},shape:v,size:m,overrides:de({BaseButton:{style:function(u){var O=u.$theme;return S.length===1?{}:v!==N.default?{marginLeft:O.sizing.scale100,marginRight:O.sizing.scale100}:{marginLeft:"0.5px",marginRight:"0.5px"}},props:{"aria-checked":D,role:p?"radio":"checkbox"}}},g.props.overrides)})}))})}}]),r})(c.Component);V(H,"defaultProps",{disabled:!1,onClick:function(){},shape:N.default,size:pe.default,kind:fe.secondary});function Pe(e,t){return t.includes(e)?t.filter(r=>r!==e):[...t,e]}function Ce(e,t,r){return e===l.ClickMode.MULTI_SELECT?Pe(t,r??[]):r?.includes(t)?[]:[t]}function ke(e){return e.length===0?-1:e[0]}function Be(e,t,r,n){t.setIntArrayValue(e,r.value,{fromUi:r.fromUi},n)}function Ie(e,t,r){const n=r===l.Style.PILLS?C.PILLS:r===l.Style.BORDERLESS?C.BORDERLESS_ICON:C.SEGMENTED_CONTROL,o=r===l.Style.BORDERLESS?x.XSMALL:x.MEDIUM,i=n===C.PILLS||n===C.SEGMENTED_CONTROL,a=r===l.Style.BORDERLESS?"lg":"base";return{element:L(le,{icon:t,label:e,iconSize:a,useSmallerFont:i}),kind:n,size:o}}function Ae(e,t,r,n){return r.indexOf(n)>-1?!0:t!==l.ClickMode.SINGLE_SELECT||e!==l.SelectionVisualization.ALL_UP_TO_SELECTED?!1:r.length>0&&n<r[0]}function De(e,t){return e&&(t=`${t}Active`),t}function Te(e,t,r){const n={flexWrap:"wrap",maxWidth:r?"100%":"fit-content",margin:"0 0"},o=r?"100%":"auto";switch(e){case l.Style.BORDERLESS:return{...n,columnGap:t.threeXS,rowGap:t.threeXS};case l.Style.PILLS:return{...n,columnGap:t.twoXS,rowGap:t.twoXS,width:o};case l.Style.SEGMENTED_CONTROL:return{...n,columnGap:t.none,rowGap:t.twoXS,width:o};default:return n}}function je(e,t,r,n,o,i,a){const d=Ae(r,n,o,t);let s=e.content,y=e.contentIcon;return d&&(s=e.selectedContent?e.selectedContent:s,y=e.selectedContentIcon?e.selectedContentIcon:y),c.forwardRef(function(b,E){const{element:f,kind:h,size:v}=Ie(s??"",y??void 0,i),m=De(!!(d&&!e.selectedContent&&!e.selectedContentIcon),h);return L(ue,{...b,size:v,kind:m,containerWidth:a,children:f})})}function Me(e,t){return e.getIntArrayValue(t)}function $e(e){return e.default??[]}function Ge(e){return e.value??[]}function Ne(e){const{disabled:t,element:r,fragmentId:n,widgetMgr:o,widthConfig:i}=e,{clickMode:a,options:d,selectionVisualization:s,style:y,label:S,labelVisibility:b,help:E}=r,f=Y(),[h,v]=se({getStateFromWidgetMgr:Me,getDefaultStateFromProto:$e,getCurrStateFromProto:Ge,updateWidgetMgrState:Be,element:r,widgetMgr:o,fragmentId:n}),m=ee(i),I=(R,w)=>{const p=Ce(a,w,h);v({value:p,fromUi:!0})};let _;a===l.ClickMode.SINGLE_SELECT?_=k.radio:a===l.ClickMode.MULTI_SELECT&&(_=k.checkbox);const A=c.useMemo(()=>d.map((R,w)=>{const p=je(R,w,s,a,h,y,m);return L(p,{},`${R.content}-${w}`)}),[a,d,s,y,h,m]);return te(ae,{className:"stButtonGroup","data-testid":"stButtonGroup",containerWidth:m,children:[L(ie,{label:S,disabled:t,labelVisibility:re(b?.value??oe.LabelVisibilityOptions.COLLAPSED),children:E&&L(ce,{content:E,placement:ne.TOP,label:S})}),L(H,{disabled:t,mode:_,onClick:I,selected:a===l.ClickMode.MULTI_SELECT?h:ke(h),overrides:{Root:{style:c.useCallback(()=>Te(y,f.spacing,m),[y,f.spacing,m])}},children:A})]})}const xe=c.memo(Ne);export{xe as default};
1
+ import{am as q,w as J,r as c,b7 as Q,l as Y,b8 as ee,b9 as l,j as L,o as te,p as re,P as ne,ba as oe,ac as ie,bb as ae,b as ue,B as C,c as x,D as le}from"./index.DiwhD0Ic.js";import{W as ce}from"./WidgetLabelHelpIconInline.BPqxu1b-.js";import{u as se}from"./useBasicWidgetState.DnPEt_f3.js";import"./FormClearHelper.N8_BCinn.js";var fe={secondary:"secondary"},N={default:"default"},pe={default:"default"},k=Object.freeze({radio:"radio",checkbox:"checkbox"}),z=q("div",function(e){var t=e.$shape,r=e.$length,n=e.$theme,o=r===1?void 0:t!==N.default?"-".concat(n.sizing.scale100):"-0.5px";return{display:"flex",marginLeft:o,marginRight:o}});z.displayName="StyledRoot";z.displayName="StyledRoot";function M(e){"@babel/helpers - typeof";return M=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},M(e)}function $(){return $=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},$.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 de(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){V(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 ye(e,t){return Se(e)||he(e,t)||me(e,t)||be()}function be(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function me(e,t){if(e){if(typeof e=="string")return K(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 K(e,t)}}function K(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,d;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));o=!0);}catch(s){i=!0,d=s}finally{try{!o&&r.return!=null&&r.return()}finally{if(i)throw d}}return n}}function Se(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 ve(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 Oe(e,t,r){return t&&ve(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ee(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&&G(e,t)}function G(e,t){return G=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},G(e,t)}function _e(e){var t=Le();return function(){var n=B(e),o;if(t){var i=B(this).constructor;o=Reflect.construct(n,arguments,i)}else o=n.apply(this,arguments);return we(this,o)}}function we(e,t){if(t&&(M(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return F(e)}function F(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Le(){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 B(e){return B=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},B(e)}function V(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Re(e,t){return!Array.isArray(e)&&typeof e!="number"?!1:Array.isArray(e)?e.includes(t):e===t}var H=(function(e){Ee(r,e);var t=_e(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)),V(F(n),"childRefs",{}),n}return Oe(r,[{key:"render",value:function(){var o=this,i=this.props,a=i.overrides,d=a===void 0?{}:a,s=i.mode,y=s===void 0?k.checkbox:s,S=i.children,b=i.selected,E=i.disabled,f=i.onClick,m=i.kind,v=i.shape,h=i.size,I=J(d.Root,z),_=ye(I,2),A=_[0],R=_[1],w=this.props["aria-label"]||this.props.ariaLabel,p=y===k.radio,W=c.Children.count(S);return c.createElement(Q.Consumer,null,function(Z){return c.createElement(A,$({"aria-label":w||Z.buttongroup.ariaLabel,"data-baseweb":"button-group",role:p?"radiogroup":"group",$shape:v,$length:S.length},R),c.Children.map(S,function(g,P){if(!c.isValidElement(g))return null;var D=g.props.isSelected?g.props.isSelected:Re(b,P);return p&&(o.childRefs[P]=c.createRef()),c.cloneElement(g,{disabled:E||g.props.disabled,isSelected:D,ref:p?o.childRefs[P]:void 0,tabIndex:!p||D||p&&(!b||b===-1)&&P===0?0:-1,onKeyDown:function(u){if(p){var O=Number(b)?Number(b):0;if(u.key==="ArrowUp"||u.key==="ArrowLeft"){u.preventDefault&&u.preventDefault();var T=O-1<0?W-1:O-1;f&&f(u,T),o.childRefs[T].current&&o.childRefs[T].current.focus()}if(u.key==="ArrowDown"||u.key==="ArrowRight"){u.preventDefault&&u.preventDefault();var j=O+1>W-1?0:O+1;f&&f(u,j),o.childRefs[j].current&&o.childRefs[j].current.focus()}}},kind:m,onClick:function(u){E||(g.props.onClick&&g.props.onClick(u),f&&f(u,P))},shape:v,size:h,overrides:de({BaseButton:{style:function(u){var O=u.$theme;return S.length===1?{}:v!==N.default?{marginLeft:O.sizing.scale100,marginRight:O.sizing.scale100}:{marginLeft:"0.5px",marginRight:"0.5px"}},props:{"aria-checked":D,role:p?"radio":"checkbox"}}},g.props.overrides)})}))})}}]),r})(c.Component);V(H,"defaultProps",{disabled:!1,onClick:function(){},shape:N.default,size:pe.default,kind:fe.secondary});function Pe(e,t){return t.includes(e)?t.filter(r=>r!==e):[...t,e]}function Ce(e,t,r){return e===l.ClickMode.MULTI_SELECT?Pe(t,r??[]):r?.includes(t)?[]:[t]}function ke(e){return e.length===0?-1:e[0]}function Be(e,t,r,n){t.setIntArrayValue(e,r.value,{fromUi:r.fromUi},n)}function Ie(e,t,r){const n=r===l.Style.PILLS?C.PILLS:r===l.Style.BORDERLESS?C.BORDERLESS_ICON:C.SEGMENTED_CONTROL,o=r===l.Style.BORDERLESS?x.XSMALL:x.MEDIUM,i=n===C.PILLS||n===C.SEGMENTED_CONTROL,a=r===l.Style.BORDERLESS?"lg":"base";return{element:L(le,{icon:t,label:e,iconSize:a,useSmallerFont:i}),kind:n,size:o}}function Ae(e,t,r,n){return r.indexOf(n)>-1?!0:t!==l.ClickMode.SINGLE_SELECT||e!==l.SelectionVisualization.ALL_UP_TO_SELECTED?!1:r.length>0&&n<r[0]}function De(e,t){return e&&(t=`${t}Active`),t}function Te(e,t,r){const n={flexWrap:"wrap",maxWidth:r?"100%":"fit-content",margin:"0 0"},o=r?"100%":"auto";switch(e){case l.Style.BORDERLESS:return{...n,columnGap:t.threeXS,rowGap:t.threeXS};case l.Style.PILLS:return{...n,columnGap:t.twoXS,rowGap:t.twoXS,width:o};case l.Style.SEGMENTED_CONTROL:return{...n,columnGap:t.none,rowGap:t.twoXS,width:o};default:return n}}function je(e,t,r,n,o,i,a){const d=Ae(r,n,o,t);let s=e.content,y=e.contentIcon;return d&&(s=e.selectedContent?e.selectedContent:s,y=e.selectedContentIcon?e.selectedContentIcon:y),c.forwardRef(function(b,E){const{element:f,kind:m,size:v}=Ie(s??"",y??void 0,i),h=De(!!(d&&!e.selectedContent&&!e.selectedContentIcon),m);return L(ue,{...b,size:v,kind:h,containerWidth:a,children:f})})}function Me(e,t){return e.getIntArrayValue(t)}function $e(e){return e.default??[]}function Ge(e){return e.value??[]}function Ne(e){const{disabled:t,element:r,fragmentId:n,widgetMgr:o,widthConfig:i}=e,{clickMode:a,options:d,selectionVisualization:s,style:y,label:S,labelVisibility:b,help:E}=r,f=Y(),[m,v]=se({getStateFromWidgetMgr:Me,getDefaultStateFromProto:$e,getCurrStateFromProto:Ge,updateWidgetMgrState:Be,element:r,widgetMgr:o,fragmentId:n}),h=ee(i),I=(R,w)=>{const p=Ce(a,w,m);v({value:p,fromUi:!0})};let _;a===l.ClickMode.SINGLE_SELECT?_=k.radio:a===l.ClickMode.MULTI_SELECT&&(_=k.checkbox);const A=c.useMemo(()=>d.map((R,w)=>{const p=je(R,w,s,a,m,y,h);return L(p,{},`${R.content}-${w}`)}),[a,d,s,y,m,h]);return te(ae,{className:"stButtonGroup","data-testid":"stButtonGroup",containerWidth:h,children:[L(ie,{label:S,disabled:t,labelVisibility:re(b?.value??oe.LabelVisibilityOptions.COLLAPSED),children:E&&L(ce,{content:E,placement:ne.TOP,label:S})}),L(H,{disabled:t,mode:_,onClick:I,selected:a===l.ClickMode.MULTI_SELECT?m:ke(m),overrides:{Root:{style:c.useCallback(()=>Te(y,f.spacing,h),[y,f.spacing,h])}},children:A})]})}const xe=c.memo(Ne);export{xe as default};