streamlit-nightly 1.42.3.dev20250222__py2.py3-none-any.whl → 1.42.3.dev20250224__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- streamlit/dataframe_util.py +6 -1
- streamlit/elements/bokeh_chart.py +6 -0
- streamlit/elements/markdown.py +2 -0
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{FileDownload.esm.B1kyp21I.js → FileDownload.esm.Db6P60XC.js} +1 -1
- streamlit/static/static/js/FileHelper.LHDgAkEu.js +5 -0
- streamlit/static/static/js/{FormClearHelper.CEl0YyS3.js → FormClearHelper.BkPbs0OF.js} +1 -1
- streamlit/static/static/js/{Hooks.B_-0sclb.js → Hooks.CW1Ujj-E.js} +1 -1
- streamlit/static/static/js/{InputInstructions.M8GsfWtP.js → InputInstructions.CHpHVupe.js} +1 -1
- streamlit/static/static/js/{ProgressBar.DDliFXvs.js → ProgressBar.CSZV-k_M.js} +2 -2
- streamlit/static/static/js/{RenderInPortalIfExists.DON5no2j.js → RenderInPortalIfExists.CrI9B0Qh.js} +1 -1
- streamlit/static/static/js/{Toolbar.DGwjBtCI.js → Toolbar.CfNF-56q.js} +1 -1
- streamlit/static/static/js/{base-input.Dz6cKnV_.js → base-input.BBFJwxWO.js} +4 -4
- streamlit/static/static/js/{createSuper.bXxYJzro.js → createSuper.rz8EjYR0.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.BrHDbHOn.js → data-grid-overlay-editor.DUagmDpG.js} +1 -1
- streamlit/static/static/js/{downloader.BUh1naKp.js → downloader.DEY2_Oao.js} +1 -1
- streamlit/static/static/js/{es6.C8XVTTHj.js → es6.Cbt8Qb0v.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.DGWt48-l.js → iframeResizer.contentWindow.DlY1zPt7.js} +1 -1
- streamlit/static/static/js/{index.6zGrdP7S.js → index.7HEH_7fJ.js} +15 -15
- streamlit/static/static/js/{index.DvUg88R_.js → index.8pg9ijwI.js} +1 -1
- streamlit/static/static/js/{index.jSEMrPEJ.js → index.B5Q1lb1E.js} +1 -1
- streamlit/static/static/js/{index.DgCaLwAb.js → index.BFFhpOhV.js} +1 -1
- streamlit/static/static/js/{index.DU4gaNU_.js → index.BcIDRdbw.js} +1 -1
- streamlit/static/static/js/index.Bhf5i-o4.js +1 -0
- streamlit/static/static/js/{index.DcA_kXA1.js → index.BtBNIxWC.js} +2 -2
- streamlit/static/static/js/{index.BhKdTR4z.js → index.Bv1JbhEf.js} +1 -1
- streamlit/static/static/js/index.C29vTftb.js +3865 -0
- streamlit/static/static/js/{index.94WymsOx.js → index.C3FZ8TOb.js} +3 -3
- streamlit/static/static/js/index.C41AtD-D.js +1 -0
- streamlit/static/static/js/{index.C5zcxetk.js → index.C9kvqGu0.js} +1 -1
- streamlit/static/static/js/{index.DO1Rv491.js → index.CIDueoC2.js} +1 -1
- streamlit/static/static/js/{index.C2skmlN3.js → index.CUFUpykP.js} +2 -2
- streamlit/static/static/js/index.CUWXxL_C.js +1 -0
- streamlit/static/static/js/{index.BBotNZr-.js → index.CUepHEom.js} +1 -1
- streamlit/static/static/js/index.C_SUbLL7.js +1 -0
- streamlit/static/static/js/index.CdiPATR3.js +197 -0
- streamlit/static/static/js/index.CgZ_3VRU.js +1 -0
- streamlit/static/static/js/{index.BiCX2JZK.js → index.CjN5S59O.js} +1 -1
- streamlit/static/static/js/{index.B66JaJi3.js → index.Con6tiNg.js} +1 -1
- streamlit/static/static/js/{index.D-4pSvTG.js → index.D1sfL1bE.js} +1 -1
- streamlit/static/static/js/{index.CNDCHhth.js → index.D2PC_wwi.js} +1 -1
- streamlit/static/static/js/index.D8mp5ppE.js +201 -0
- streamlit/static/static/js/{index.C2VChsA1.js → index.DEz7mrAp.js} +1 -1
- streamlit/static/static/js/{index.BrXMfzqp.js → index.DPZJrrNj.js} +1 -1
- streamlit/static/static/js/{index.DB9G9YYY.js → index.Df3vkO_v.js} +1 -1
- streamlit/static/static/js/{index.BXFE-6NA.js → index.DuUcgXrv.js} +1 -1
- streamlit/static/static/js/{index.lCzpOFcS.js → index.DxvQWdtj.js} +1 -1
- streamlit/static/static/js/{index.D_tVZ0u0.js → index.DymllY6d.js} +2 -2
- streamlit/static/static/js/{index.Da7VTJGp.js → index.G1PSqufB.js} +2 -2
- streamlit/static/static/js/{index.B1Y_k9Fh.js → index.I2Ij_yHL.js} +1 -1
- streamlit/static/static/js/{index.NifETEVc.js → index.InwDjRN5.js} +1 -1
- streamlit/static/static/js/{index.iYzAfcLx.js → index.LmMDdxLh.js} +1 -1
- streamlit/static/static/js/{index.C9nK-VoQ.js → index.LypQPPkP.js} +3 -3
- streamlit/static/static/js/index.RDHMaPCV.js +1 -0
- streamlit/static/static/js/index.jj20zRA4.js +1 -0
- streamlit/static/static/js/{input.DqK048_c.js → input.QeLiGsyn.js} +2 -2
- streamlit/static/static/js/{memory.BYwXutbg.js → memory.0fYVo8Wx.js} +1 -1
- streamlit/static/static/js/{mergeWith.CwfhUp-s.js → mergeWith.AOqADio_.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.B-1TJraW.js → number-overlay-editor.DAvAckzz.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.CCjgmGB4.js → possibleConstructorReturn.C4RsC1R8.js} +1 -1
- streamlit/static/static/js/{sandbox.CzVH3fBX.js → sandbox.DT2p3KTe.js} +1 -1
- streamlit/static/static/js/{textarea.D47OO5VD.js → textarea.DQh9RYKV.js} +2 -2
- streamlit/static/static/js/{timepicker.Dq2FqiYO.js → timepicker.Br_cR0hi.js} +4 -4
- streamlit/static/static/js/{toConsumableArray.7OyX1dIj.js → toConsumableArray.CzYSWELu.js} +1 -1
- streamlit/static/static/js/{uniqueId.naIyoATl.js → uniqueId.BdUnRe3-.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.DH0ClB0l.js → useBasicWidgetState.6R32QW2v.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.3GZT2mEx.js → useOnInputChange.C4OiWI1_.js} +1 -1
- streamlit/static/static/js/withFullScreenWrapper.BLeP_b5i.js +1 -0
- streamlit/user_info.py +8 -2
- {streamlit_nightly-1.42.3.dev20250222.dist-info → streamlit_nightly-1.42.3.dev20250224.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.42.3.dev20250222.dist-info → streamlit_nightly-1.42.3.dev20250224.dist-info}/RECORD +75 -75
- streamlit/static/static/js/FileDropzone.uWzTac7M.js +0 -5
- streamlit/static/static/js/index.BUnE-2Mi.js +0 -201
- streamlit/static/static/js/index.BxBwZJQr.js +0 -1
- streamlit/static/static/js/index.CNYNhiEk.js +0 -1
- streamlit/static/static/js/index.CUKOkOB2.js +0 -197
- streamlit/static/static/js/index.Ceuq3IzZ.js +0 -1
- streamlit/static/static/js/index.ChSsIvr7.js +0 -3865
- streamlit/static/static/js/index.DKFH0WYB.js +0 -1
- streamlit/static/static/js/index.DQT0NMTW.js +0 -1
- streamlit/static/static/js/index.DiXeiIyQ.js +0 -1
- streamlit/static/static/js/index.Dl_RyApM.js +0 -1
- streamlit/static/static/js/withFullScreenWrapper.HzikaPlG.js +0 -1
- {streamlit_nightly-1.42.3.dev20250222.data → streamlit_nightly-1.42.3.dev20250224.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.42.3.dev20250222.dist-info → streamlit_nightly-1.42.3.dev20250224.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.42.3.dev20250222.dist-info → streamlit_nightly-1.42.3.dev20250224.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.42.3.dev20250222.dist-info → streamlit_nightly-1.42.3.dev20250224.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
|
|
1
|
-
import{n as o,
|
1
|
+
import{n as o,bn as S,i as f,r as g,R as l,j as r,B as u,c5 as $,aC as m}from"./index.7HEH_7fJ.js";const x=o(S,{shouldForwardProp:f,target:"e12gfcky0"})(({theme:e})=>({fontSize:e.fontSizes.sm,width:e.sizes.spinnerSize,height:e.sizes.spinnerSize,borderWidth:e.sizes.spinnerThickness,justifyContents:"center",padding:e.spacing.none,margin:e.spacing.none,borderColor:e.colors.borderColor,borderTopColor:e.colors.secondary,flexGrow:0,flexShrink:0})),y=o("div",{target:"e12gfcky1"})(({theme:e,cache:s})=>({...s?{paddingBottom:e.spacing.lg,background:`linear-gradient(to bottom, ${e.colors.bgColor} 0%, ${e.colors.bgColor} 80%, transparent 100%)`}:null})),T=o("div",{target:"e12gfcky2"})(({theme:e})=>({opacity:.6,fontSize:e.fontSizes.sm})),h=o("div",{target:"e12gfcky3"})(({theme:e})=>({display:"flex",gap:e.spacing.sm,alignItems:"center",width:"100%"})),b=e=>{const s=Math.floor(e/3600),n=Math.floor(e%3600/60),t=e%60;if(s===0&&n===0)return`(${t.toFixed(1)} seconds)`;if(s===0){const d=`${n} minute${n===1?"":"s"}`,p=t===0?"":`, ${t.toFixed(1)} seconds`;return`(${d}${p})`}const i=`${s} hour${s===1?"":"s"}`,a=n===0?"":`, ${n} minute${n===1?"":"s"}`,c=t===0?"":`, ${t.toFixed(1)} seconds`;return`(${i}${a}${c})`};function z({element:e}){const{cache:s,showTime:n}=e,[t,i]=l.useState(0);return l.useEffect(()=>{if(!n)return;const a=setInterval(()=>{i(c=>c+.1)},100);return()=>clearInterval(a)},[n]),r(y,{className:$({stSpinner:!0,stCacheSpinner:s}),"data-testid":"stSpinner",cache:s,children:u(h,{children:[r(x,{}),r(m,{source:e.text,allowHTML:!1}),n&&r(T,{children:b(t)})]})})}const k=g.memo(z);export{k as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{n,r as t,M as i,j as c,
|
1
|
+
import{n,r as t,M as i,j as c,b1 as d,b2 as e,K as g}from"./index.7HEH_7fJ.js";const l=n("iframe",{target:"e3tg43n0"})(({theme:o,disableScrolling:r})=>({width:"100%",colorScheme:"normal",border:"none",padding:o.spacing.none,margin:o.spacing.none,overflow:r?"hidden":void 0}));function s(o){return g(o)||o===""?void 0:o}function m({element:o}){const r=s(o.src),a=i(r)?void 0:s(o.srcdoc);return c(l,{className:"stIFrame","data-testid":"stIFrame",allow:e,disableScrolling:!o.scrolling,src:r,srcDoc:a,height:o.height,scrolling:o.scrolling?"auto":"no",sandbox:d,title:"st.iframe"})}const I=t.memo(m);export{I as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{r as u,R as f,
|
1
|
+
import{r as u,R as f,aD as m,b5 as i,j as t,b6 as b,bq as B,b4 as p,b7 as D}from"./index.7HEH_7fJ.js";import{c as w}from"./createDownloadLinkElement.DZMwyjvU.js";function h(n,o,e){return w({enforceDownloadInNewTab:e,url:n.buildMediaURL(o),filename:""})}function R(n){const{disabled:o,element:e,widgetMgr:l,endpoints:s,fragmentId:r}=n,{libConfig:{enforceDownloadInNewTab:d=!1}}=f.useContext(m);let a=i.SECONDARY;e.type==="primary"?a=i.PRIMARY:e.type==="tertiary"&&(a=i.TERTIARY);const c=()=>{e.ignoreRerun||l.setTriggerValue(e,{fromUi:!0},r),h(s,e.url,d).click()};return t("div",{className:"stDownloadButton","data-testid":"stDownloadButton",children:t(b,{help:e.help,children:t(B,{kind:a,size:p.SMALL,disabled:o,onClick:c,fluidWidth:e.useContainerWidth||!!e.help,children:t(D,{icon:e.icon,label:e.label})})})})}const L=u.memo(R);export{L as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{r as s,K as b,j as S,
|
1
|
+
import{r as s,K as b,j as S,bs as d,c6 as x}from"./index.7HEH_7fJ.js";import{a as V}from"./useBasicWidgetState.6R32QW2v.js";import"./FormClearHelper.BkPbs0OF.js";const v=(t,e)=>t.getIntValue(e),U=t=>t.default??null,h=t=>t.value??null,C=(t,e,o,a)=>{e.setIntValue(t,o.value,{fromUi:o.fromUi},a)},F=({disabled:t,element:e,widgetMgr:o,fragmentId:a})=>{const{options:u,help:n,label:c,labelVisibility:r,placeholder:i}=e,[m,l]=V({getStateFromWidgetMgr:v,getDefaultStateFromProto:U,getCurrStateFromProto:h,updateWidgetMgrState:C,element:e,widgetMgr:o,fragmentId:a}),g=s.useCallback(p=>{l({value:p,fromUi:!0})},[l]),f=b(e.default)&&!t;return S(x,{label:c,labelVisibility:d(r==null?void 0:r.value),options:u,disabled:t,onChange:g,value:m,help:n,placeholder:i,clearable:f})},j=s.memo(F);export{j as default};
|
@@ -0,0 +1 @@
|
|
1
|
+
import{n as R,r,y as M,c1 as T,c2 as W,B as C,j as l,bs as V,bF as L,bt as O,ba as P,bu as k,c0 as B,c3 as E,bY as N,c4 as $,bD as F}from"./index.7HEH_7fJ.js";import{a as A}from"./useBasicWidgetState.6R32QW2v.js";import"./FormClearHelper.BkPbs0OF.js";const D=R("div",{target:"euzcfsp0"})(({theme:s})=>({"span[aria-disabled='true']":{background:s.colors.fadedText05}})),H=(s,t)=>s.getIntArrayValue(t),U=s=>s.default??null,j=s=>s.value??null,G=(s,t,a,u)=>{t.setIntArrayValue(s,a.value,{fromUi:a.fromUi},u)},K=s=>{var S;const{element:t,widgetMgr:a,fragmentId:u}=s,e=M(),[n,g]=A({getStateFromWidgetMgr:H,getDefaultStateFromProto:U,getCurrStateFromProto:j,updateWidgetMgrState:G,element:t,widgetMgr:a,fragmentId:u}),m=t.maxSelections>0&&n.length>=t.maxSelections,y=r.useMemo(()=>{if(t.maxSelections===0)return"No results";if(n.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,n.length]),f=r.useMemo(()=>n.map(o=>{const i=t.options[o];return{value:o.toString(),label:i}}),[t.options,n]),h=r.useCallback(o=>{const i=()=>{var d;const p=(d=o.option)==null?void 0:d.value;return parseInt(p,10)};switch(o.type){case"remove":return T(n,i());case"clear":return[];case"select":return n.concat([i()]);default:throw new Error(`State transition is unknown: ${o.type}`)}},[n]),v=r.useCallback(o=>{t.maxSelections&&o.type==="select"&&n.length>=t.maxSelections||g({value:h(o),fromUi:!0})},[t.maxSelections,h,g,n.length]),x=r.useCallback((o,i)=>{if(m)return[];const p=o.filter(d=>!n.includes(Number(d.value)));return W(p,i)},[m,n]),{options:c}=t,b=c.length===0?!0:s.disabled,z=c.length===0?"No options to select.":t.placeholder,w=c.map((o,i)=>({label:o,value:i.toString()})),I=c.length>10;return C("div",{className:"stMultiSelect","data-testid":"stMultiSelect",children:[l(k,{label:t.label,disabled:b,labelVisibility:V((S=t.labelVisibility)==null?void 0:S.value),children:t.help&&l(L,{children:l(O,{content:t.help,placement:P.TOP_RIGHT})})}),l(D,{children:l(B,{options:w,labelKey:"label",valueKey:"value","aria-label":t.label,placeholder:z,type:$.select,multi:!0,onChange:v,value:f,disabled:b,size:"compact",noResultsMsg:y,filterOptions:x,closeOnSelect:!1,overrides:{Popover:{props:{overrides:{Body:{style:()=>({marginTop:e.spacing.px})}}}},SelectArrow:{component:N,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",opacity:"0.7"})},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:F.isMobile&&I===!1?"readonly":null}},Dropdown:{component:E}}})})]})},q=r.memo(K);export{q as default};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{
|
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
|
1
|
+
import{bw as Z,bx as J,r as f,by as Q,y as Y,bz as s,j as v,B as ee,bs as te,bA as re,bt as ne,ba as oe,bB as ie,bu as ae,bq as ue,b5 as P,b4 as W,b7 as le}from"./index.7HEH_7fJ.js";import{a as ce}from"./useBasicWidgetState.6R32QW2v.js";import"./FormClearHelper.BkPbs0OF.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
|
+
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=B(e),o;if(t){var i=B(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 B(e){return B=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},B(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,C=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,A=J(p.Root,z),O=de(A,2),E=O[0],L=O[1],H=this.props["aria-label"]||this.props.ariaLabel,g=C===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 Pe(e,t,r){return e==s.ClickMode.MULTI_SELECT?Re(t,r??[]):r!=null&&r.includes(t)?[]:[t]}function Ce(e){return e.length===0?-1:e[0]}function ke(e,t,r,n){t.setIntArrayValue(e,r.value,{fromUi:r.fromUi},n)}function Be(e,t,r){const n=r===s.Style.PILLS?P.PILLS:r===s.Style.BORDERLESS?P.BORDERLESS_ICON:P.SEGMENTED_CONTROL,o=r===s.Style.BORDERLESS?W.XSMALL:W.MEDIUM,i=n===P.PILLS||n===P.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 Ae(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=Ae(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:_}=Be(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:C,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=Pe(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 A=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:C,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:Ce(l),overrides:{Root:{style:f.useCallback(()=>Te(c,h.spacing),[c,h.spacing])}},children:A})]})}const Ue=f.memo(Ge);export{Ue as default};
|