streamlit-nightly 1.43.3.dev20250324__py3-none-any.whl → 1.44.1.dev20250326__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 (84) hide show
  1. streamlit/config.py +70 -25
  2. streamlit/elements/exception.py +8 -0
  3. streamlit/elements/markdown.py +35 -21
  4. streamlit/elements/widgets/number_input.py +11 -6
  5. streamlit/elements/widgets/slider.py +17 -5
  6. streamlit/material_icon_names.py +1 -1
  7. streamlit/proto/MetricsEvent_pb2.py +1 -1
  8. streamlit/proto/MetricsEvent_pb2.pyi +10 -10
  9. streamlit/runtime/context.py +21 -1
  10. streamlit/static/index.html +2 -2
  11. streamlit/static/static/css/{index.BOl9eq08.css → index.DKr_zoDj.css} +1 -1
  12. streamlit/static/static/js/{FileDownload.esm.DIlnitWB.js → FileDownload.esm.DyWffVOd.js} +1 -1
  13. streamlit/static/static/js/{FileHelper.KvWFUw_P.js → FileHelper.C5Rf1fu1.js} +1 -1
  14. streamlit/static/static/js/{FormClearHelper.CyEIoAU7.js → FormClearHelper.D2MZi-BE.js} +1 -1
  15. streamlit/static/static/js/{Hooks.CGlNtuXA.js → Hooks.UTpr--3H.js} +1 -1
  16. streamlit/static/static/js/{InputInstructions.Gw6d6QM8.js → InputInstructions.oXzay8Sc.js} +1 -1
  17. streamlit/static/static/js/{ProgressBar.CzEGt_ze.js → ProgressBar.Dkc6afbj.js} +1 -1
  18. streamlit/static/static/js/{RenderInPortalIfExists.CuMtThMP.js → RenderInPortalIfExists.0vQEaJAa.js} +1 -1
  19. streamlit/static/static/js/{Toolbar.Bq1OwJ3s.js → Toolbar.BLonzKGv.js} +1 -1
  20. streamlit/static/static/js/{base-input.DIEsEK6k.js → base-input.BVhyctGq.js} +1 -1
  21. streamlit/static/static/js/{checkbox.DlvrBnOk.js → checkbox.DqunhWUH.js} +1 -1
  22. streamlit/static/static/js/{createSuper.Ck3SfvAY.js → createSuper.CpC2DZ-4.js} +1 -1
  23. streamlit/static/static/js/{data-grid-overlay-editor.DJffL7IE.js → data-grid-overlay-editor.BNc7oQAN.js} +1 -1
  24. streamlit/static/static/js/{downloader.5RyfsT4Q.js → downloader.BEmsLcSd.js} +1 -1
  25. streamlit/static/static/js/{es6.BZLzosaK.js → es6.Bka7yuWr.js} +2 -2
  26. streamlit/static/static/js/{iframeResizer.contentWindow.BObQcmGt.js → iframeResizer.contentWindow.CseC9_0j.js} +1 -1
  27. streamlit/static/static/js/{index.Cmv4rRpV.js → index.-Ex9Sw0j.js} +1 -1
  28. streamlit/static/static/js/{index.CSzH9XbP.js → index.-GEjrTbP.js} +1 -1
  29. streamlit/static/static/js/{index.DNPMLwqR.js → index.-uBfKDNW.js} +1 -1
  30. streamlit/static/static/js/{index.pmLVrqeq.js → index.6ZLFnYFv.js} +1 -1
  31. streamlit/static/static/js/{index.DCG_M3sj.js → index.B9r4f8yP.js} +1 -1
  32. streamlit/static/static/js/{index.CmWpy-_w.js → index.BGiS_myV.js} +1 -1
  33. streamlit/static/static/js/{index.CtoshGgl.js → index.BPrkMaDs.js} +1 -1
  34. streamlit/static/static/js/{index.JOTMsfbe.js → index.BPw4HKmU.js} +1 -1
  35. streamlit/static/static/js/{index.CnZGzNni.js → index.BSsSumHQ.js} +5 -5
  36. streamlit/static/static/js/{index.EePHpMJs.js → index.BgAs7EEH.js} +1 -1
  37. streamlit/static/static/js/{index.CO0zn1S0.js → index.BgstN8el.js} +1 -1
  38. streamlit/static/static/js/{index.BbQCsSu8.js → index.ByG1Ipsd.js} +1 -1
  39. streamlit/static/static/js/{index.BGbUzuRh.js → index.C7zS3xAk.js} +1 -1
  40. streamlit/static/static/js/{index.uOyQEYYB.js → index.CHsi5M24.js} +1 -1
  41. streamlit/static/static/js/{index.Dikm-NhC.js → index.CRpHYHH-.js} +1 -1
  42. streamlit/static/static/js/{index.BrfxfIQx.js → index.CSzYGoqF.js} +1 -1
  43. streamlit/static/static/js/{index.Crthd-_C.js → index.CdRzA4dY.js} +1 -1
  44. streamlit/static/static/js/{index.DnRcoJiQ.js → index.CusXODwm.js} +1 -1
  45. streamlit/static/static/js/{index.CJ1b2hLc.js → index.DByvN5ny.js} +1 -1
  46. streamlit/static/static/js/{index.m03R_C2M.js → index.DDcRBpz_.js} +1 -1
  47. streamlit/static/static/js/{index.B0a-0dE-.js → index.DDfr2vz1.js} +1 -1
  48. streamlit/static/static/js/{index.Pe3uxm8H.js → index.DH5gmTNJ.js} +1 -1
  49. streamlit/static/static/js/{index.CscliOXE.js → index.DPXDfP7O.js} +1 -1
  50. streamlit/static/static/js/{index.CeVyYlbb.js → index.DTByMWKb.js} +1 -1
  51. streamlit/static/static/js/{index.CeXwOaW3.js → index.DYmhwMwG.js} +1 -1
  52. streamlit/static/static/js/{index.WkqIK0MD.js → index.D_RsV5T3.js} +1 -1
  53. streamlit/static/static/js/{index.F_5_o4iG.js → index.DbB5iceE.js} +1 -1
  54. streamlit/static/static/js/{index.DzzKb95t.js → index.DcA9oLdi.js} +1 -1
  55. streamlit/static/static/js/{index.BqkHlhBZ.js → index.DfLVo1kK.js} +1 -1
  56. streamlit/static/static/js/{index.Cdhezq0G.js → index.Dg6pitBN.js} +1 -1
  57. streamlit/static/static/js/{index.Bw9ypWXW.js → index.DiZnms3l.js} +1 -1
  58. streamlit/static/static/js/{index.BpP4PaU6.js → index.DvCWOxpn.js} +1 -1
  59. streamlit/static/static/js/{index.CmWhyYnm.js → index.K8WjTi1D.js} +1 -1
  60. streamlit/static/static/js/{index.Bc34Jyud.js → index.NwBLa4vX.js} +9 -9
  61. streamlit/static/static/js/{index.BGjwwe7S.js → index.RS9NSuPn.js} +1 -1
  62. streamlit/static/static/js/{index.BH7umdkZ.js → index.YDw6DAY-.js} +1 -1
  63. streamlit/static/static/js/{index.DZlmDQG1.js → index.sEBYkd7C.js} +5 -5
  64. streamlit/static/static/js/{input.D4-snIy8.js → input.Cf4AxOS9.js} +1 -1
  65. streamlit/static/static/js/{memory.DfGhTK_n.js → memory.x6zhEJ8E.js} +1 -1
  66. streamlit/static/static/js/{mergeWith.2UmuQo0t.js → mergeWith.DL-_LuL_.js} +1 -1
  67. streamlit/static/static/js/{number-overlay-editor.CLSvrmK2.js → number-overlay-editor.uQEd6gCw.js} +1 -1
  68. streamlit/static/static/js/{possibleConstructorReturn.j4WjydV3.js → possibleConstructorReturn.6K8NTHlH.js} +1 -1
  69. streamlit/static/static/js/{sandbox.dGrV7zVE.js → sandbox.BY_N7kRf.js} +1 -1
  70. streamlit/static/static/js/{textarea.2ZfcIYmZ.js → textarea.BoUKtqfY.js} +1 -1
  71. streamlit/static/static/js/{timepicker.BveH-8js.js → timepicker.uTqYdkda.js} +1 -1
  72. streamlit/static/static/js/{toConsumableArray.CkHCjwX9.js → toConsumableArray.CA_5PwDK.js} +1 -1
  73. streamlit/static/static/js/{uniqueId.Bnywonrs.js → uniqueId.CmvPTKOg.js} +1 -1
  74. streamlit/static/static/js/{useBasicWidgetState.CYjuP8Fb.js → useBasicWidgetState.aMiqPmlk.js} +1 -1
  75. streamlit/static/static/js/{useOnInputChange.BAUMwlPg.js → useOnInputChange.DXi6gRKL.js} +1 -1
  76. streamlit/static/static/js/{withFullScreenWrapper.BltJBw92.js → withFullScreenWrapper._ccFC4BV.js} +1 -1
  77. streamlit/static/static/media/MaterialSymbols-Rounded.C21bROXx.woff2 +0 -0
  78. {streamlit_nightly-1.43.3.dev20250324.dist-info → streamlit_nightly-1.44.1.dev20250326.dist-info}/METADATA +1 -1
  79. {streamlit_nightly-1.43.3.dev20250324.dist-info → streamlit_nightly-1.44.1.dev20250326.dist-info}/RECORD +83 -83
  80. {streamlit_nightly-1.43.3.dev20250324.dist-info → streamlit_nightly-1.44.1.dev20250326.dist-info}/WHEEL +1 -1
  81. streamlit/static/static/media/MaterialSymbols-Rounded.BFCIvovZ.woff2 +0 -0
  82. {streamlit_nightly-1.43.3.dev20250324.data → streamlit_nightly-1.44.1.dev20250326.data}/scripts/streamlit.cmd +0 -0
  83. {streamlit_nightly-1.43.3.dev20250324.dist-info → streamlit_nightly-1.44.1.dev20250326.dist-info}/entry_points.txt +0 -0
  84. {streamlit_nightly-1.43.3.dev20250324.dist-info → streamlit_nightly-1.44.1.dev20250326.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
1
- import{r as f,z as T,B as C,j as n,C as y,br as L,aC as S,bz as W,bs as B,ba as w,bJ as R,J as $,bK as E,bL as P}from"./index.Bc34Jyud.js";import{a as v}from"./useBasicWidgetState.CYjuP8Fb.js";import{a as X,L as H,S as p}from"./checkbox.DlvrBnOk.js";import"./FormClearHelper.CyEIoAU7.js";function M({element:e,disabled:a,widgetMgr:s,fragmentId:d}){var m;const[x,g]=v({getStateFromWidgetMgr:V,getDefaultStateFromProto:z,getCurrStateFromProto:I,updateWidgetMgrState:j,element:e,widgetMgr:s,fragmentId:d}),k=f.useCallback(i=>{g({value:i.target.checked,fromUi:!0})},[g]),t=T(),{colors:o,spacing:h,sizes:r}=t,b=C(t),u=a?o.fadedText40:o.bodyText;return n(P,{className:"row-widget stCheckbox","data-testid":"stCheckbox",children:n(X,{checked:x,disabled:a,onChange:k,"aria-label":e.label,checkmarkType:e.type===E.StyleType.TOGGLE?p.toggle:p.default,labelPlacement:H.right,overrides:{Root:{style:({$isFocusVisible:i})=>({marginBottom:h.none,marginTop:h.none,backgroundColor:i?o.darkenedBgMix25:"",display:"flex",alignItems:"start"})},Toggle:{style:({$checked:i})=>{let c=b?o.bgColor:o.bodyText;return a&&(c=b?o.gray70:o.gray90),{width:`calc(${r.checkbox} - ${t.spacing.twoXS})`,height:`calc(${r.checkbox} - ${t.spacing.twoXS})`,transform:i?`translateX(${r.checkbox})`:"",backgroundColor:c,boxShadow:""}}},ToggleTrack:{style:({$checked:i,$isHovered:c})=>{let l=o.fadedText40;return c&&!a&&(l=o.fadedText20),i&&!a&&(l=o.primary),{marginRight:0,marginLeft:0,marginBottom:0,marginTop:t.spacing.twoXS,paddingLeft:t.spacing.threeXS,paddingRight:t.spacing.threeXS,width:`calc(2 * ${r.checkbox})`,minWidth:`calc(2 * ${r.checkbox})`,height:r.checkbox,minHeight:r.checkbox,borderBottomLeftRadius:t.radii.full,borderTopLeftRadius:t.radii.full,borderBottomRightRadius:t.radii.full,borderTopRightRadius:t.radii.full,backgroundColor:l}}},Checkmark:{style:({$isFocusVisible:i,$checked:c})=>{const l=c&&!a?o.primary:o.fadedText40;return{outline:0,width:r.checkbox,height:r.checkbox,marginTop:t.spacing.twoXS,marginLeft:0,marginBottom:0,boxShadow:i&&c?`0 0 0 0.2rem ${$(o.primary,.5)}`:"",borderLeftWidth:r.borderWidth,borderRightWidth:r.borderWidth,borderTopWidth:r.borderWidth,borderBottomWidth:r.borderWidth,borderLeftColor:l,borderRightColor:l,borderTopColor:l,borderBottomColor:l}}},Label:{style:{lineHeight:t.lineHeights.small,paddingLeft:t.spacing.sm,position:"relative",color:u}}},children:y(R,{visibility:L((m=e.labelVisibility)==null?void 0:m.value),"data-testid":"stWidgetLabel",children:[n(S,{source:e.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),e.help&&n(W,{color:u,children:n(B,{content:e.help,placement:w.TOP_RIGHT})})]})})})}function V(e,a){return e.getBoolValue(a)}function z(e){return e.default??null}function I(e){return e.value??null}function j(e,a,s,d){a.setBoolValue(e,s.value,{fromUi:s.fromUi},d)}const A=f.memo(M);export{A as default};
1
+ import{r as f,z as T,B as C,j as n,C as y,br as L,aC as S,bz as W,bs as B,ba as w,bJ as R,J as $,bK as E,bL as P}from"./index.NwBLa4vX.js";import{a as v}from"./useBasicWidgetState.aMiqPmlk.js";import{a as X,L as H,S as p}from"./checkbox.DqunhWUH.js";import"./FormClearHelper.D2MZi-BE.js";function M({element:e,disabled:a,widgetMgr:s,fragmentId:d}){var m;const[x,g]=v({getStateFromWidgetMgr:V,getDefaultStateFromProto:z,getCurrStateFromProto:I,updateWidgetMgrState:j,element:e,widgetMgr:s,fragmentId:d}),k=f.useCallback(i=>{g({value:i.target.checked,fromUi:!0})},[g]),t=T(),{colors:o,spacing:h,sizes:r}=t,b=C(t),u=a?o.fadedText40:o.bodyText;return n(P,{className:"row-widget stCheckbox","data-testid":"stCheckbox",children:n(X,{checked:x,disabled:a,onChange:k,"aria-label":e.label,checkmarkType:e.type===E.StyleType.TOGGLE?p.toggle:p.default,labelPlacement:H.right,overrides:{Root:{style:({$isFocusVisible:i})=>({marginBottom:h.none,marginTop:h.none,backgroundColor:i?o.darkenedBgMix25:"",display:"flex",alignItems:"start"})},Toggle:{style:({$checked:i})=>{let c=b?o.bgColor:o.bodyText;return a&&(c=b?o.gray70:o.gray90),{width:`calc(${r.checkbox} - ${t.spacing.twoXS})`,height:`calc(${r.checkbox} - ${t.spacing.twoXS})`,transform:i?`translateX(${r.checkbox})`:"",backgroundColor:c,boxShadow:""}}},ToggleTrack:{style:({$checked:i,$isHovered:c})=>{let l=o.fadedText40;return c&&!a&&(l=o.fadedText20),i&&!a&&(l=o.primary),{marginRight:0,marginLeft:0,marginBottom:0,marginTop:t.spacing.twoXS,paddingLeft:t.spacing.threeXS,paddingRight:t.spacing.threeXS,width:`calc(2 * ${r.checkbox})`,minWidth:`calc(2 * ${r.checkbox})`,height:r.checkbox,minHeight:r.checkbox,borderBottomLeftRadius:t.radii.full,borderTopLeftRadius:t.radii.full,borderBottomRightRadius:t.radii.full,borderTopRightRadius:t.radii.full,backgroundColor:l}}},Checkmark:{style:({$isFocusVisible:i,$checked:c})=>{const l=c&&!a?o.primary:o.fadedText40;return{outline:0,width:r.checkbox,height:r.checkbox,marginTop:t.spacing.twoXS,marginLeft:0,marginBottom:0,boxShadow:i&&c?`0 0 0 0.2rem ${$(o.primary,.5)}`:"",borderLeftWidth:r.borderWidth,borderRightWidth:r.borderWidth,borderTopWidth:r.borderWidth,borderBottomWidth:r.borderWidth,borderLeftColor:l,borderRightColor:l,borderTopColor:l,borderBottomColor:l}}},Label:{style:{lineHeight:t.lineHeights.small,paddingLeft:t.spacing.sm,position:"relative",color:u}}},children:y(R,{visibility:L((m=e.labelVisibility)==null?void 0:m.value),"data-testid":"stWidgetLabel",children:[n(S,{source:e.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),e.help&&n(W,{color:u,children:n(B,{content:e.help,placement:w.TOP_RIGHT})})]})})})}function V(e,a){return e.getBoolValue(a)}function z(e){return e.default??null}function I(e){return e.value??null}function j(e,a,s,d){a.setBoolValue(e,s.value,{fromUi:s.fromUi},d)}const A=f.memo(M);export{A as default};
@@ -1,2 +1,2 @@
1
- import{bv as q,bw as J,r as f,bx as Q,z as Y,by as s,j as S,C as ee,br as te,bz as re,bs as ne,ba as oe,bA as ie,bt as ae,bp as ue,b5 as C,b4 as W,b7 as le}from"./index.Bc34Jyud.js";import{a as ce}from"./useBasicWidgetState.CYjuP8Fb.js";import"./FormClearHelper.CyEIoAU7.js";var se={secondary:"secondary"},G={default:"default"},fe={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!==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{bv as q,bw as J,r as f,bx as Q,z as Y,by as s,j as S,C as ee,br as te,bz as re,bs as ne,ba as oe,bA as ie,bt as ae,bp as ue,b5 as C,b4 as W,b7 as le}from"./index.NwBLa4vX.js";import{a as ce}from"./useBasicWidgetState.aMiqPmlk.js";import"./FormClearHelper.D2MZi-BE.js";var se={secondary:"secondary"},G={default:"default"},fe={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!==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 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 Se(e,t,r){return t&&ve(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 Se(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,I=J(p.Root,z),O=de(I,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(Z){return f.createElement(E,M({"aria-label":H||Z.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 T=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:T,ref:g?o.childRefs[R]:void 0,tabIndex:!g||T||g&&(!y||y===-1)&&R===0?0:-1,onKeyDown:function(u){if(g){var v=Number(y)?Number(y):0;if(u.key==="ArrowUp"||u.key==="ArrowLeft"){u.preventDefault&&u.preventDefault();var B=v-1<0?V-1:v-1;l&&l(u,B),o.childRefs[B].current&&o.childRefs[B].current.focus()}if(u.key==="ArrowDown"||u.key==="ArrowRight"){u.preventDefault&&u.preventDefault();var D=v+1>V-1?0:v+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 v=u.$theme;return d.length===1?{}:m!==G.default?{marginLeft:v.sizing.scale100,marginRight:v.sizing.scale100}:{marginLeft:"0.5px",marginRight:"0.5px"}},props:{"aria-checked":T,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:S(le,{icon:t,label:e,iconSize:a,useSmallerFont:i}),kind:n,size:o}}function Ie(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 Te(e,t){return e&&(t=`${t}Active`),t}function Be(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=Ie(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=Te(!!(a&&!e.selectedContent&&!e.selectedContentIcon),l);return S(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 I=f.useMemo(()=>a.map((O,E)=>{const L=De(O,E,p,i,l,c);return S(L,{},`${O.content}-${E}`)}),[i,a,p,c,l]);return ee("div",{className:"stButtonGroup","data-testid":"stButtonGroup",children:[S(ae,{label:P,disabled:t,labelVisibility:te((d==null?void 0:d.value)??ie.LabelVisibilityOptions.COLLAPSED),children:y&&S(re,{children:S(ne,{content:y,placement:oe.TOP})})}),S(F,{disabled:t,mode:w,onClick:m,selected:i===s.ClickMode.MULTI_SELECT?l:Pe(l),overrides:{Root:{style:f.useCallback(()=>Be(c,h.spacing),[c,h.spacing])}},children:I})]})}const Ue=f.memo(Ge);export{Ue as default};