streamlit-nightly 1.38.1.dev20240923__py2.py3-none-any.whl → 1.38.1.dev20240924__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/__init__.py +0 -1
- streamlit/elements/deck_gl_json_chart.py +260 -36
- streamlit/elements/widgets/button_group.py +1 -1
- streamlit/proto/DeckGlJsonChart_pb2.py +4 -2
- streamlit/proto/DeckGlJsonChart_pb2.pyi +40 -2
- streamlit/runtime/state/common.py +2 -0
- streamlit/runtime/state/widgets.py +2 -1
- streamlit/static/asset-manifest.json +12 -12
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/195.8e0d331c.chunk.js +2 -0
- streamlit/static/static/js/238.f9bc20d9.chunk.js +1 -0
- streamlit/static/static/js/245.f99079b1.chunk.js +1 -0
- streamlit/static/static/js/3710.a5101ccc.chunk.js +1 -0
- streamlit/static/static/js/{5625.fe6c22ad.chunk.js → 5625.d9509933.chunk.js} +1 -1
- streamlit/static/static/js/{6088.c137d543.chunk.js → 6088.1164e19b.chunk.js} +1 -1
- streamlit/static/static/js/8642.58110d15.chunk.js +2 -0
- streamlit/static/static/js/{8815.0284d089.chunk.js → 8815.9d336691.chunk.js} +1 -1
- streamlit/static/static/js/{9943.d18fdff1.chunk.js → 9943.2d62e2c4.chunk.js} +1 -1
- streamlit/static/static/js/{main.829dd23b.js → main.133ce9b9.js} +4 -4
- {streamlit_nightly-1.38.1.dev20240923.dist-info → streamlit_nightly-1.38.1.dev20240924.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.38.1.dev20240923.dist-info → streamlit_nightly-1.38.1.dev20240924.dist-info}/RECORD +29 -29
- streamlit/static/static/js/2055.bca43613.chunk.js +0 -1
- streamlit/static/static/js/245.68a062da.chunk.js +0 -1
- streamlit/static/static/js/6789.f8dde736.chunk.js +0 -2
- streamlit/static/static/js/8485.81bdf474.chunk.js +0 -1
- streamlit/static/static/js/8642.dfef7dcb.chunk.js +0 -2
- /streamlit/static/static/css/{6789.81b3d18f.chunk.css → 195.81b3d18f.chunk.css} +0 -0
- /streamlit/static/static/js/{6789.f8dde736.chunk.js.LICENSE.txt → 195.8e0d331c.chunk.js.LICENSE.txt} +0 -0
- /streamlit/static/static/js/{8642.dfef7dcb.chunk.js.LICENSE.txt → 8642.58110d15.chunk.js.LICENSE.txt} +0 -0
- /streamlit/static/static/js/{main.829dd23b.js.LICENSE.txt → main.133ce9b9.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.38.1.dev20240923.data → streamlit_nightly-1.38.1.dev20240924.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.38.1.dev20240923.dist-info → streamlit_nightly-1.38.1.dev20240924.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.38.1.dev20240923.dist-info → streamlit_nightly-1.38.1.dev20240924.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.38.1.dev20240923.dist-info → streamlit_nightly-1.38.1.dev20240924.dist-info}/top_level.txt +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[238],{22044:(e,t,n)=>{n.d(t,{A:()=>f});var s=n(58878),o=n(53124),i=n.n(o),r=n(8151),l=n(41514),d=n(67214),a=n(64611),c=n(84152),h=n(89653);const m=(0,h.A)("button",{target:"e1vs0wn31"})((e=>{let{isExpanded:t,theme:n}=e;const s=t?{right:"0.4rem",top:"0.5rem",backgroundColor:"transparent"}:{right:"-3.0rem",top:"-0.375rem",opacity:0,transform:"scale(0)",backgroundColor:n.colors.lightenedBg05};return{position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",zIndex:n.zIndices.sidebar+1,height:"2.5rem",width:"2.5rem",transition:"opacity 300ms 150ms, transform 300ms 150ms",border:"none",color:n.colors.fadedText60,borderRadius:"50%",...s,"&:focus":{outline:"none"},"&:active, &:focus-visible, &:hover":{opacity:1,outline:"none",transform:"scale(1)",color:n.colors.bodyText,transition:"none"}}}),""),p=(0,h.A)("div",{target:"e1vs0wn30"})((e=>{let{theme:t,isExpanded:n}=e;return{"&:hover":{[m]:{opacity:1,transform:"scale(1)",transition:"none"}},...n?{position:"fixed",top:0,left:0,bottom:0,right:0,background:t.colors.bgColor,zIndex:t.zIndices.fullscreenWrapper,padding:t.spacing.md,paddingTop:t.sizes.fullScreenHeaderHeight,overflow:["auto","overlay"],display:"flex",alignItems:"center",justifyContent:"center"}:{}}}),"");var u=n(90782);class g extends s.PureComponent{constructor(e){super(e),this.context=void 0,this.controlKeys=e=>{const{expanded:t}=this.state;27===e.keyCode&&t&&this.zoomOut()},this.zoomIn=()=>{document.body.style.overflow="hidden",this.context.setFullScreen(!0),this.setState({expanded:!0})},this.zoomOut=()=>{document.body.style.overflow="unset",this.context.setFullScreen(!1),this.setState({expanded:!1})},this.convertScssRemValueToPixels=e=>parseFloat(e)*parseFloat(getComputedStyle(document.documentElement).fontSize),this.getWindowDimensions=()=>{const e=this.convertScssRemValueToPixels(this.props.theme.spacing.md),t=this.convertScssRemValueToPixels(this.props.theme.sizes.fullScreenHeaderHeight);return{fullWidth:window.innerWidth-2*e,fullHeight:window.innerHeight-(e+t)}},this.updateWindowDimensions=()=>{this.setState(this.getWindowDimensions())},this.state={expanded:!1,...this.getWindowDimensions()}}componentDidMount(){window.addEventListener("resize",this.updateWindowDimensions),document.addEventListener("keydown",this.controlKeys,!1)}componentWillUnmount(){window.removeEventListener("resize",this.updateWindowDimensions),document.removeEventListener("keydown",this.controlKeys,!1)}render(){const{expanded:e,fullWidth:t,fullHeight:n}=this.state,{children:s,width:o,height:i,disableFullscreenMode:r}=this.props;let c=l.u,h=this.zoomIn,g="View fullscreen";return e&&(c=d.Q,h=this.zoomOut,g="Exit fullscreen"),(0,u.jsxs)(p,{isExpanded:e,"data-testid":"stFullScreenFrame",children:[!r&&(0,u.jsx)(m,{"data-testid":"StyledFullScreenButton",onClick:h,title:g,isExpanded:e,children:(0,u.jsx)(a.A,{content:c})}),s(e?{width:t,height:n,expanded:e,expand:this.zoomIn,collapse:this.zoomOut}:{width:o,height:i,expanded:e,expand:this.zoomIn,collapse:this.zoomOut})]})}}g.contextType=c.n;const x=(0,r.b)(g);const f=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];class n extends s.PureComponent{constructor(){super(...arguments),this.render=()=>{const{width:n,height:s,disableFullscreenMode:o}=this.props;return(0,u.jsx)(x,{width:n,height:s,disableFullscreenMode:t||o,children:t=>{let{width:n,height:s,expanded:o,expand:i,collapse:r}=t;return(0,u.jsx)(e,{...this.props,width:n,height:s,isFullScreen:o,expand:i,collapse:r})}})}}}return n.displayName=`withFullScreenWrapper(${e.displayName||e.name})`,i()(n,e)}},85850:(e,t,n)=>{n.d(t,{K:()=>f,A:()=>v});n(58878);var s=n(8151),o=n(12274),i=n(63186),r=n(34914),l=n(997),d=n(36459),a=n(84720),c=n(64611),h=n(89653),m=n(58144);const p="-2.4rem",u=(0,h.A)("div",{target:"e2wxzia1"})((e=>{let{theme:t,locked:n,target:s}=e;return{padding:`${t.spacing.sm} 0 ${t.spacing.sm} ${t.spacing.sm}`,position:"absolute",top:n?p:"-1rem",right:t.spacing.none,transition:"none",...!n&&{opacity:0,"&:active, &:focus-visible, &:hover":{transition:"opacity 150ms 100ms, top 100ms 100ms",opacity:1,top:p},...s&&{[`${s}:hover &, ${s}:active &, ${s}:focus-visible &`]:{transition:"opacity 150ms 100ms, top 100ms 100ms",opacity:1,top:p}}}}}),""),g=(0,h.A)("div",{target:"e2wxzia0"})((e=>{let{theme:t}=e;return{color:(0,m.iq)(t)?t.colors.fadedText60:t.colors.bodyText,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-end",boxShadow:"1px 2px 8px rgba(0, 0, 0, 0.08)",borderRadius:t.radii.default,backgroundColor:t.colors.lightenedBg05,width:"fit-content",zIndex:t.zIndices.sidebar+1}}),"");var x=n(90782);function f(e){let{label:t,show_label:n,icon:o,onClick:i}=e;const h=(0,s.u)(),m=n?t:"";return(0,x.jsx)("div",{"data-testid":"stElementToolbarButton",children:(0,x.jsx)(l.A,{content:(0,x.jsx)(r.Ay,{source:t,allowHTML:!1,style:{fontSize:h.fontSizes.sm}}),placement:l.W.TOP,onMouseEnterDelay:1e3,inline:!0,children:(0,x.jsxs)(d.Ay,{onClick:e=>{i&&i(),e.stopPropagation()},kind:a.KX.ELEMENT_TOOLBAR,children:[o&&(0,x.jsx)(c.A,{content:o,size:"md",testid:"stElementToolbarButtonIcon"}),m&&(0,x.jsx)("span",{children:m})]})})})}const v=e=>{let{onExpand:t,onCollapse:n,isFullScreen:s,locked:r,children:l,target:d,disableFullscreenMode:a}=e;return(0,x.jsx)(u,{className:"stElementToolbar","data-testid":"stElementToolbar",locked:r||s,target:d,children:(0,x.jsxs)(g,{children:[l,t&&!a&&!s&&(0,x.jsx)(f,{label:"Fullscreen",icon:o.g,onClick:()=>t()}),n&&!a&&s&&(0,x.jsx)(f,{label:"Close fullscreen",icon:i.Q,onClick:()=>n()})]})})}},34752:(e,t,n)=>{n.d(t,{X:()=>r,o:()=>i});var s=n(58878),o=n(25571);class i{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,n){(0,o.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,o._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,n),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function r(e){let{element:t,widgetMgr:n,onFormCleared:i}=e;(0,s.useEffect)((()=>{if(!(0,o._L)(t.formId))return;const e=n.addFormClearedListener(t.formId,i);return()=>{e.disconnect()}}),[t,n,i])}}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[245],{245:(e,t,r)=>{r.r(t),r.d(t,{default:()=>G});var o=r(58878),i=r(8151),n=r(35331),a=r(57224);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(e){var t=e.$disabled,r=e.$checked,o=e.$isIndeterminate,i=e.$error,n=e.$isHovered,a=e.$isActive,l=e.$theme.colors;return t?r||o?l.tickFillDisabled:l.tickFill:i&&(o||r)?a?l.tickFillErrorSelectedHoverActive:n?l.tickFillErrorSelectedHover:l.tickFillErrorSelected:i?a?l.tickFillErrorHoverActive:n?l.tickFillErrorHover:l.tickFillError:o||r?a?l.tickFillSelectedHoverActive:n?l.tickFillSelectedHover:l.tickFillSelected:a?l.tickFillActive:n?l.tickFillHover:l.tickFill}function u(e){var t=e.$disabled,r=e.$theme.colors;return t?r.contentSecondary:r.contentPrimary}var g=(0,a.I4)("label",(function(e){var t=e.$disabled,r=e.$labelPlacement;return{flexDirection:"top"===r||"bottom"===r?"column":"row",display:"flex",alignItems:"top"===r||"bottom"===r?"center":"flex-start",cursor:t?"not-allowed":"pointer",userSelect:"none"}}));g.displayName="Root",g.displayName="Root";var p=(0,a.I4)("span",(function(e){var t=e.$checked,r=e.$disabled,o=e.$error,i=e.$isIndeterminate,n=e.$theme,a=e.$isFocusVisible,l=n.sizing,c=n.animation,s=r?n.colors.tickMarkFillDisabled:o?n.colors.tickMarkFillError:n.colors.tickMarkFill,u=encodeURIComponent('\n <svg width="14" height="4" viewBox="0 0 14 4" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M14 0.5H0V3.5H14V0.5Z" fill="'.concat(s,'"/>\n </svg>\n ')),g=encodeURIComponent('\n <svg width="17" height="13" viewBox="0 0 17 13" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M6.50002 12.6L0.400024 6.60002L2.60002 4.40002L6.50002 8.40002L13.9 0.900024L16.1 3.10002L6.50002 12.6Z" fill="'.concat(s,'"/>\n </svg>\n ')),p=n.borders.checkboxBorderRadius,h=function(e){var t=e.$disabled,r=e.$checked,o=e.$error,i=e.$isIndeterminate,n=e.$theme,a=e.$isFocusVisible,l=n.colors;return t?l.tickFillDisabled:r||i?"transparent":o?l.borderNegative:a?l.borderSelected:l.tickBorder}(e);return{flex:"0 0 auto",transitionDuration:c.timing200,transitionTimingFunction:c.easeOutCurve,transitionProperty:"background-image, border-color, background-color",width:l.scale700,height:l.scale700,left:"4px",top:"4px",boxSizing:"border-box",borderLeftStyle:"solid",borderRightStyle:"solid",borderTopStyle:"solid",borderBottomStyle:"solid",borderLeftWidth:"3px",borderRightWidth:"3px",borderTopWidth:"3px",borderBottomWidth:"3px",borderLeftColor:h,borderRightColor:h,borderTopColor:h,borderBottomColor:h,borderTopLeftRadius:p,borderTopRightRadius:p,borderBottomRightRadius:p,borderBottomLeftRadius:p,outline:a&&t?"3px solid ".concat(n.colors.accent):"none",display:"inline-block",verticalAlign:"middle",backgroundImage:i?"url('data:image/svg+xml,".concat(u,"');"):t?"url('data:image/svg+xml,".concat(g,"');"):null,backgroundColor:d(e),backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"contain",marginTop:n.sizing.scale0,marginBottom:n.sizing.scale0,marginLeft:n.sizing.scale0,marginRight:n.sizing.scale0}}));p.displayName="Checkmark",p.displayName="Checkmark";var h=(0,a.I4)("div",(function(e){var t=e.$theme.typography;return c(c(c({verticalAlign:"middle"},function(e){var t,r=e.$labelPlacement,o=void 0===r?"":r,i=e.$theme,n=i.sizing.scale300;switch(o){case"top":t="Bottom";break;case"bottom":t="Top";break;case"left":t="Right";break;default:t="Left"}return"rtl"===i.direction&&"Left"===t?t="Right":"rtl"===i.direction&&"Right"===t&&(t="Left"),s({},"padding".concat(t),n)}(e)),{},{color:u(e)},t.LabelMedium),{},{lineHeight:"24px"})}));h.displayName="Label",h.displayName="Label";var m=(0,a.I4)("input",{opacity:0,width:0,height:0,overflow:"hidden",margin:0,padding:0,position:"absolute"});m.displayName="Input",m.displayName="Input";var b=(0,a.I4)("div",(function(e){var t=e.$theme.colors.toggleFill;return e.$disabled?t=e.$theme.colors.toggleFillDisabled:e.$checked&&e.$error?t=e.$theme.colors.tickFillErrorSelected:e.$checked&&(t=e.$theme.colors.toggleFillChecked),{backgroundColor:t,borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible?"0 0 0 3px ".concat(e.$theme.colors.accent):e.$isHovered&&!e.$disabled?e.$theme.lighting.shadow500:e.$theme.lighting.shadow400,outline:"none",height:e.$theme.sizing.scale700,width:e.$theme.sizing.scale700,transform:e.$checked?"translateX(".concat("rtl"===e.$theme.direction?"-100%":"100%",")"):null,transition:"transform ".concat(e.$theme.animation.timing200)}}));b.displayName="Toggle",b.displayName="Toggle";var f=(0,a.I4)("div",(function(e){var t=e.$theme.colors.toggleTrackFill;return e.$disabled?t=e.$theme.colors.toggleTrackFillDisabled:e.$error&&e.$checked&&(t=e.$theme.colors.tickFillError),{alignItems:"center",backgroundColor:t,borderTopLeftRadius:"7px",borderTopRightRadius:"7px",borderBottomRightRadius:"7px",borderBottomLeftRadius:"7px",display:"flex",height:e.$theme.sizing.scale550,marginTop:e.$theme.sizing.scale200,marginBottom:e.$theme.sizing.scale100,marginLeft:e.$theme.sizing.scale200,marginRight:e.$theme.sizing.scale100,width:e.$theme.sizing.scale1000}}));f.displayName="ToggleTrack",f.displayName="ToggleTrack";var v=Object.freeze({default:"default",toggle:"toggle",toggle_round:"toggle"}),y=Object.freeze({top:"top",right:"right",bottom:"bottom",left:"left"}),k=r(56498);function $(e){return $="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$(e)}function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},w.apply(this,arguments)}function F(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function S(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,o=R(e);if(t){var i=R(this).constructor;r=Reflect.construct(o,arguments,i)}else r=o.apply(this,arguments);return function(e,t){if(t&&("object"===$(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return C(e)}(this,r)}}function C(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}function L(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var T=function(e){return e.stopPropagation()},M=function(e){!function(e,t){if("function"!==typeof t&&null!==t)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&&x(e,t)}(l,e);var t,r,i,a=S(l);function l(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l);for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return L(C(e=a.call.apply(a,[this].concat(r))),"state",{isFocused:e.props.autoFocus||!1,isFocusVisible:!1,isHovered:!1,isActive:!1}),L(C(e),"onMouseEnter",(function(t){e.setState({isHovered:!0}),e.props.onMouseEnter(t)})),L(C(e),"onMouseLeave",(function(t){e.setState({isHovered:!1,isActive:!1}),e.props.onMouseLeave(t)})),L(C(e),"onMouseDown",(function(t){e.setState({isActive:!0}),e.props.onMouseDown(t)})),L(C(e),"onMouseUp",(function(t){e.setState({isActive:!1}),e.props.onMouseUp(t)})),L(C(e),"onFocus",(function(t){e.setState({isFocused:!0}),e.props.onFocus(t),(0,k.pP)(t)&&e.setState({isFocusVisible:!0})})),L(C(e),"onBlur",(function(t){e.setState({isFocused:!1}),e.props.onBlur(t),!1!==e.state.isFocusVisible&&e.setState({isFocusVisible:!1})})),e}return t=l,(r=[{key:"componentDidMount",value:function(){var e=this.props,t=e.autoFocus,r=e.inputRef;t&&r.current&&r.current.focus()}},{key:"render",value:function(){var e=this.props,t=e.overrides,r=void 0===t?{}:t,i=e.onChange,a=e.labelPlacement,l=void 0===a?this.props.checkmarkType===v.toggle?"left":"right":a,c=e.inputRef,s=e.isIndeterminate,d=e.error,u=e.disabled,y=e.value,k=e.name,$=e.type,F=e.checked,x=e.children,S=e.required,C=e.title,R=r.Root,L=r.Checkmark,M=r.Label,O=r.Input,P=r.Toggle,j=r.ToggleTrack,I=(0,n.De)(R)||g,B=(0,n.De)(L)||p,E=(0,n.De)(M)||h,D=(0,n.De)(O)||m,W=(0,n.De)(P)||b,H=(0,n.De)(j)||f,z={onChange:i,onFocus:this.onFocus,onBlur:this.onBlur},V={onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},_={$isFocused:this.state.isFocused,$isFocusVisible:this.state.isFocusVisible,$isHovered:this.state.isHovered,$isActive:this.state.isActive,$error:d,$checked:F,$isIndeterminate:s,$required:S,$disabled:u,$value:y},A=x&&o.createElement(E,w({$labelPlacement:l},_,(0,n.PC)(M)),this.props.containsInteractiveElement?o.createElement("div",{onClick:function(e){return e.preventDefault()}},x):x);return o.createElement(I,w({"data-baseweb":"checkbox",title:C||null,$labelPlacement:l},_,V,(0,n.PC)(R)),("top"===l||"left"===l)&&A,this.props.checkmarkType===v.toggle?o.createElement(H,w({},_,(0,n.PC)(j)),o.createElement(W,w({},_,(0,n.PC)(P)))):o.createElement(B,w({},_,(0,n.PC)(L))),o.createElement(D,w({value:y,name:k,checked:F,required:S,"aria-label":this.props["aria-label"]||this.props.ariaLabel,"aria-checked":s?"mixed":F,"aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":d||null,"aria-required":S||null,disabled:u,type:$,ref:c,onClick:T},_,z,(0,n.PC)(O))),("bottom"===l||"right"===l)&&A)}}])&&F(t.prototype,r),i&&F(t,i),Object.defineProperty(t,"prototype",{writable:!1}),l}(o.Component);L(M,"defaultProps",{overrides:{},checked:!1,containsInteractiveElement:!1,disabled:!1,autoFocus:!1,isIndeterminate:!1,inputRef:o.createRef(),error:!1,type:"checkbox",checkmarkType:v.default,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});const O=M;var P=r(32735),j=r(25571),I=r(29669),B=r(3101),E=r(58144),D=r(93480),W=r(997),H=r(78286),z=r(34914),V=r(90114),_=r(90782);function A(e){var t;let{width:r,element:n,disabled:a,widgetMgr:l,fragmentId:c}=e;const[s,d]=(0,B.t)({getStateFromWidgetMgr:N,getDefaultStateFromProto:U,getCurrStateFromProto:X,updateWidgetMgrState:q,element:n,widgetMgr:l,fragmentId:c}),u=(0,o.useCallback)((e=>{d({value:e.target.checked,fromUi:!0})}),[d]),g=(0,i.u)(),{colors:p,spacing:h,sizes:m}=g,b=(0,E.iq)(g),f=a?p.fadedText40:p.bodyText;return(0,_.jsx)(V.p,{className:"row-widget stCheckbox","data-testid":"stCheckbox",width:r,children:(0,_.jsx)(O,{checked:s,disabled:a,onChange:u,"aria-label":n.label,checkmarkType:n.type===I.Sc.StyleType.TOGGLE?v.toggle:v.default,labelPlacement:y.right,overrides:{Root:{style:e=>{let{$isFocusVisible:t}=e;return{marginBottom:h.none,marginTop:h.none,paddingRight:h.twoThirdsSmFont,backgroundColor:t?p.darkenedBgMix25:"",display:"flex",alignItems:"start"}}},Toggle:{style:e=>{let{$checked:t}=e,r=b?p.bgColor:p.bodyText;return a&&(r=b?p.gray70:p.gray90),{width:`calc(${m.checkbox} - ${g.spacing.twoXS})`,height:`calc(${m.checkbox} - ${g.spacing.twoXS})`,transform:t?`translateX(${m.checkbox})`:"",backgroundColor:r,boxShadow:""}}},ToggleTrack:{style:e=>{let{$checked:t,$isHovered:r}=e,o=p.fadedText40;return r&&!a&&(o=p.fadedText20),t&&!a&&(o=p.primary),{marginRight:0,marginLeft:0,marginBottom:0,marginTop:g.spacing.twoXS,paddingLeft:g.spacing.threeXS,paddingRight:g.spacing.threeXS,width:`calc(2 * ${m.checkbox})`,minWidth:`calc(2 * ${m.checkbox})`,height:m.checkbox,minHeight:m.checkbox,borderBottomLeftRadius:g.radii.lg,borderTopLeftRadius:g.radii.lg,borderBottomRightRadius:g.radii.lg,borderTopRightRadius:g.radii.lg,backgroundColor:o}}},Checkmark:{style:e=>{let{$isFocusVisible:t,$checked:r}=e;const o=r&&!a?p.primary:p.fadedText40;return{outline:0,width:m.checkbox,height:m.checkbox,marginTop:g.spacing.twoXS,marginLeft:0,marginBottom:0,boxShadow:t&&r?`0 0 0 0.2rem ${(0,P.No)(p.primary,.5)}`:"",borderLeftWidth:m.borderWidth,borderRightWidth:m.borderWidth,borderTopWidth:m.borderWidth,borderBottomWidth:m.borderWidth,borderLeftColor:o,borderRightColor:o,borderTopColor:o,borderBottomColor:o}}},Label:{style:{position:"relative",color:f}}},children:(0,_.jsxs)(V.x,{visibility:(0,j.yv)(null===(t=n.labelVisibility)||void 0===t?void 0:t.value),"data-testid":"stWidgetLabel",children:[(0,_.jsx)(z.Ay,{source:n.label,allowHTML:!1,isLabel:!0,largerLabel:!0}),n.help&&(0,_.jsx)(H.Cl,{color:f,children:(0,_.jsx)(D.A,{content:n.help,placement:W.W.TOP_RIGHT})})]})})})}function N(e,t){return e.getBoolValue(t)}function U(e){var t;return null!==(t=e.default)&&void 0!==t?t:null}function X(e){var t;return null!==(t=e.value)&&void 0!==t?t:null}function q(e,t,r,o){t.setBoolValue(e,r.value,{fromUi:r.fromUi},o)}const G=(0,o.memo)(A)},34752:(e,t,r)=>{r.d(t,{X:()=>a,o:()=>n});var o=r(58878),i=r(25571);class n{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,r){(0,i.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,i._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,r),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function a(e){let{element:t,widgetMgr:r,onFormCleared:n}=e;(0,o.useEffect)((()=>{if(!(0,i._L)(t.formId))return;const e=r.addFormClearedListener(t.formId,n);return()=>{e.disconnect()}}),[t,r,n])}},3101:(e,t,r)=>{r.d(t,{_:()=>a,t:()=>l});var o=r(58878),i=r(34752),n=r(25571);function a(e){let{getStateFromWidgetMgr:t,getDefaultState:r,updateWidgetMgrState:a,element:l,widgetMgr:c,fragmentId:s}=e;const[d,u]=(0,o.useState)((()=>{var e;return null!==(e=t(c,l))&&void 0!==e?e:r(c,l)})),[g,p]=(0,o.useState)({value:d,fromUi:!1});(0,o.useEffect)((()=>{(0,n.hX)(g)||(p(null),u(g.value),a(l,c,g,s))}),[g,a,l,c,s]);const h=(0,o.useCallback)((()=>{p({value:r(c,l),fromUi:!0})}),[p,l,r,c]);return(0,i.X)({widgetMgr:c,element:l,onFormCleared:h}),[d,p]}function l(e){let{getStateFromWidgetMgr:t,getDefaultStateFromProto:r,getCurrStateFromProto:i,updateWidgetMgrState:n,element:l,widgetMgr:c,fragmentId:s}=e;const d=(0,o.useCallback)(((e,t)=>r(t)),[r]),[u,g]=a({getStateFromWidgetMgr:t,getDefaultState:d,updateWidgetMgrState:n,element:l,widgetMgr:c,fragmentId:s});return(0,o.useEffect)((()=>{l.setValue&&(l.setValue=!1,g({value:i(l),fromUi:!1}))}),[l,i,g]),[u,g]}}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[3710],{40223:(e,t,o)=>{"use strict";o.r(t),o.d(t,{default:()=>xe});var i=o(58878),n=o(6334),r=o(72192),l=o(59353),a=o(78025),s=o(43338),c=o(8151),d=o(68994),h=o(58144),u=o(85850),g=o(22044),m=o(29669);var p=o(53124),b=o.n(p),f=o(32782),y=o(67253),v=o(1780),w=o(84152),S=o(6240),x=o(90782);const j=e=>{let{error:t,width:o,deltaType:i}=e;return t instanceof C?(0,x.jsx)(S.A,{width:o,name:"No Mapbox token provided",message:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("p",{children:["To use ",(0,x.jsxs)("code",{children:["st.",i]})," or ",(0,x.jsx)("code",{children:"st.map"})," you need to set up a Mapbox access token."]}),(0,x.jsxs)("p",{children:["To get a token, create an account at"," ",(0,x.jsx)("a",{href:"https://mapbox.com",children:"https://mapbox.com"}),". It's free for moderate usage levels!"]}),(0,x.jsxs)("p",{children:["Once you have a token, just set it using the Streamlit config option ",(0,x.jsx)("code",{children:"mapbox.token"})," and don't forget to restart your Streamlit server at this point if it's still running, then reload this tab."]}),(0,x.jsxs)("p",{children:["See"," ",(0,x.jsx)("a",{href:"https://docs.streamlit.io/develop/api-reference/configuration/config.toml",children:"our documentation"})," ","for more info on how to set config options."]})]})}):t instanceof k?(0,x.jsx)(S.A,{width:o,name:"Error fetching Streamlit Mapbox token",message:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("p",{children:"This app requires an internet connection."}),(0,x.jsx)("p",{children:"Please check your connection and try again."}),(0,x.jsxs)("p",{children:["If you think this is a bug, please file bug report"," ",(0,x.jsx)("a",{href:"https://github.com/streamlit/streamlit/issues/new/choose",children:"here"}),"."]})]})}):(0,x.jsx)(S.A,{width:o,name:"Error fetching Streamlit Mapbox token",message:t.message})};class C extends Error{}class k extends Error{}const A="https://data.streamlit.io/tokens.json",F="mapbox",M=e=>t=>{class o extends i.PureComponent{constructor(o){super(o),this.context=void 0,this.initMapboxToken=async()=>{try{const e=await f.A.get(A),{[F]:t}=e.data;if(!t)throw new Error(`Missing token ${F}`);this.setState({mapboxToken:t,isFetching:!1})}catch(e){const t=(0,y.$)(e);throw this.setState({mapboxTokenError:t,isFetching:!1}),new k(`${t.message} (${A})`)}},this.render=()=>{const{mapboxToken:o,mapboxTokenError:i,isFetching:n}=this.state,{width:r}=this.props;return i?(0,x.jsx)(j,{width:r,error:i,deltaType:e}):n?(0,x.jsx)(v.E,{element:m.EA.create({style:m.EA.SkeletonStyle.ELEMENT})}):(0,x.jsx)(t,{...this.props,mapboxToken:o,width:r})},this.state={isFetching:!0,mapboxToken:void 0,mapboxTokenError:void 0}}componentDidMount(){const e=this.props.element.mapboxToken||this.context.libConfig.mapboxToken;e?this.setState({mapboxToken:e,isFetching:!1}):this.initMapboxToken()}}return o.displayName=`withMapboxToken(${t.displayName||t.name})`,o.contextType=w.n,b()(o,t)};var T=o(89653);const N=(0,T.A)("div",{target:"e1az0zs51"})((e=>{let{width:t,height:o}=e;return{position:"relative",height:o,width:t}}),""),E=(0,T.A)("div",{target:"e1az0zs50"})((e=>{let{theme:t}=e;return{position:"absolute",right:"2.625rem",top:t.spacing.md,zIndex:1,"button:not(:disabled)":{background:t.colors.bgColor,"& + button":{borderTopColor:t.colors.secondaryBg},"& span":{filter:(0,h.iq)(t)?"":"invert(100%)"}}}}),"");var I=o(21640),O=o(71034),V=o.n(O),$=o(32735);var W=o(3101),D=o(14251),U=o(86202),P=o(26592),_=o(64639),z=o(73417),J=o(27126),B=o(38287);const L={classes:{...z,...o(19720),...B,...o(14249),CartoLayer:D.A},functions:{colorBins:U.A,colorCategories:P.A,colorContinuous:_.A}},G=new J.A({configuration:L});var X=o(44605),q=o(24983),Z=o(68212),K=o(20302),R=o(52265),H=o(60152),Q=o(70023),Y=o(6934),ee=o(34676),te=o(36217),oe=o(79579),ie=o(5830),ne=o(74839),re=o(16554),le=o(10762),ae=o(71749),se=o(45310),ce=o(26642),de=o(38610),he=o(41881);const ue={[ie.A.layerName]:["getFillColor"],[ne.A.layerName]:["getFillColor"],[re.Ay.layerName]:["getFillColor"],[le.A.layerName]:["getFillColor"],[ae.A.layerName]:["getFillColor"],[se.A.layerName]:["getFillColor"],[ce.A.layerName]:["getColor"],[X.A.layerName]:["getTargetColor","getSourceColor"],[q.A.layerName]:["getFillColor"],[Z.A.layerName]:["getFillColor"],[K.A.layerName]:["getColor"],[R.A.layerName]:["getColor"],[H.A.layerName]:["getColor"],[Q.A.layerName]:["getColor"],[Y.A.layerName]:["getFillColor"],[ee.A.layerName]:["getFillColor"],[te.A.layerName]:["getFillColor"],[oe.A.layerName]:["getColor"],[de.A.layerName]:["getColor"],[he.A.layerName]:["getColor"]},ge=e=>{let{isSelected:t,object:o,objectInfo:i,opacity:n,originalFillFunction:r}=e;const l=(e=>{let{object:t,objectInfo:o,originalFillFunction:i}=e;const n="function"===typeof i?i(t,o):i;if(Array.isArray(n))return[n[0]||0,n[1]||0,n[2]||0,n[3]||255];if("string"===typeof n&&n.startsWith("@@=")){const e=G.convert({originalColor:n}).originalColor(t);return[e[0]||0,e[1]||0,e[2]||0,e[3]||255]}return null})({object:o,objectInfo:i,originalFillFunction:r});if(!l)return null;let a=0;return a=t?Math.max("number"===typeof l[3]?l[3]:n,n):Math.min("number"===typeof l[3]?l[3]:n,n),[l[0]||0,l[1]||0,l[2]||0,a]},me={selection:{indices:{},objects:{}}},pe=(e,t)=>{const o=t.match(/{(.*?)}/g);return o&&o.forEach((o=>{const i=o.substring(1,o.length-1);e.object.hasOwnProperty(i)?t=t.replace(o,e.object[i]):e.object.hasOwnProperty("properties")&&e.object.properties.hasOwnProperty(i)&&(t=t.replace(o,e.object.properties[i]))})),t};function be(e,t){if(!t.id)return me;const o=e.getElementState(t.id,"selection");return null!==o&&void 0!==o?o:me}function fe(e,t){if(!t.id)return me;const o=e.getStringValue(t),i=o?I.A.parse(o):null;return null!==i&&void 0!==i?i:me}function ye(e,t,o,i){e.id&&t.setStringValue(e,JSON.stringify(o.value),{fromUi:o.fromUi},i)}const ve=e=>{var t;const{element:o,fragmentId:n,height:r,isFullScreen:l,isLightTheme:a,theme:s,widgetMgr:c,width:d}=e,{selectionMode:h,tooltip:u,useContainerWidth:g}=o,m=null!==l&&void 0!==l&&l,[p,b]=(0,W._)({element:o,getDefaultState:be,getStateFromWidgetMgr:fe,updateWidgetMgrState:ye,widgetMgr:c,fragmentId:n}),[f,y]=(0,i.useState)({bearing:0,pitch:0,zoom:11}),{height:v,width:w}=(e=>{let{container:t,element:o,heightFallback:n="auto",isFullScreen:r,shouldUseContainerWidth:l,widthFallback:a="auto"}=e;return{width:(0,i.useMemo)((()=>l||r?"100%":o.width||t.width||a),[t.width,o.width,r,l,a]),height:(0,i.useMemo)((()=>r&&t.height?t.height:o.height||t.height||n),[r,o.height,t.height,n])}})({element:o,isFullScreen:m,shouldUseContainerWidth:g,container:{height:r,width:d},heightFallback:(null===(t=f.initialViewState)||void 0===t?void 0:t.height)||500}),[S,x]=(0,i.useState)({}),j=h[0],C=void 0!==j,k=C&&Object.keys(p.selection.indices).length>0,A=(0,i.useMemo)((()=>Object.freeze(I.A.parse(o.json))),[m,a,o.json]),F=(0,i.useMemo)((()=>{const e={...A};if(e.mapStyle||(e.mapStyle=`mapbox://styles/mapbox/${a?"light":"dark"}-v9`),m?Object.assign(e.initialViewState,{width:w,height:v}):(e.initialViewState.height||(e.initialViewState.height=500),g&&(e.initialViewState.width=w)),e.layers){const t=Object.values(p.selection.indices).some((e=>null===e||void 0===e?void 0:e.length)),o=e.layers.some((e=>Object.hasOwn(e,"pickable")));e.layers=e.layers.map((e=>{var i,n;if(!e||Array.isArray(e)||!C)return e;o||(e.pickable=!0);const r=`${e.id||null}`,l=(null===p||void 0===p||null===(i=p.selection)||void 0===i||null===(n=i.indices)||void 0===n?void 0:n[r])||[],a=ue[e["@@type"]];if(!a)return e;const c={...e};return a.forEach((o=>{var i;c.updateTriggers={[o]:[...(null===(i=c.updateTriggers)||void 0===i?void 0:i[o])||[],l,t]};if(!t)return c;const n=e[o],r=(0,$.Du)(s.colors.primary),a=(0,$.Du)(s.colors.gray20);c[o]=(e,t)=>(e=>{let{isSelected:t,object:o,objectInfo:i,originalFillFunction:n,selectedColor:r,selectedOpacity:l=255,unselectedColor:a,unselectedOpacity:s=Math.floor(102)}=e;return t?ge({opacity:l,isSelected:!0,object:o,objectInfo:i,originalFillFunction:n})||r:ge({opacity:s,isSelected:!1,object:o,objectInfo:i,originalFillFunction:n})||a})({isSelected:l.includes(t.index),object:e,objectInfo:t,originalFillFunction:n,selectedColor:r,unselectedColor:a})})),c}))}return null===e||void 0===e||delete e.views,G.convert(e)}),[p.selection.indices,v,m,a,C,A,g,s.colors.gray20,s.colors.primary,w]);(0,i.useEffect)((()=>{if(!V()(F.initialViewState,S)){const e=Object.keys(F.initialViewState).reduce(((e,t)=>F.initialViewState[t]===S[t]?e:{...e,[t]:F.initialViewState[t]}),{});y({...f,...e}),x(F.initialViewState)}}),[F.initialViewState,S,f]);const M=(0,i.useCallback)((e=>{if(!e||!e.object||!u)return null;const t=I.A.parse(u);return t.html?t.html=pe(e,t.html):t.text=pe(e,t.text),t}),[u]),T=(0,i.useCallback)((e=>{let{viewState:t}=e;y(t)}),[y]);return{createTooltip:M,data:p,deck:F,hasActiveSelection:k,height:v,isSelectionModeActivated:C,onViewStateChange:T,selectionMode:j,setSelection:b,viewState:f,width:w}};o(93298);(0,s.mk)([l.y,a.B]);const we=me.selection,Se=[],xe=M("st.pydeck_chart")((0,g.A)((e=>{const{collapse:t,disabled:o,disableFullscreenMode:l,element:a,expand:s,fragmentId:g,height:p,isFullScreen:b,mapboxToken:f,widgetMgr:y,width:v}=e,{mapboxToken:w}=a,S=(0,c.u)(),{createTooltip:j,data:C,deck:k,hasActiveSelection:A,height:F,isSelectionModeActivated:M,onViewStateChange:T,selectionMode:I,setSelection:O,viewState:V,width:$}=ve({element:a,fragmentId:g,height:p,isFullScreen:b,isLightTheme:(0,h.iq)(S),theme:S,widgetMgr:y,width:v}),[W,D]=(0,i.useState)(!1);(0,i.useEffect)((()=>{D(!0)}),[]);const U=(0,i.useCallback)((e=>{var t;if(void 0===I)return;const{index:o,object:i}=e,n=`${(null===(t=e.layer)||void 0===t?void 0:t.id)||null}`,r=C,l=-1===o,a=(()=>{if(l)return we;switch(I){case m.Xw.SelectionMode.SINGLE_OBJECT:var e;return(null===(e=r.selection.indices[n])||void 0===e?void 0:e[0])===o?we:{indices:{[`${n}`]:[o]},objects:{[`${n}`]:[i]}};case m.Xw.SelectionMode.MULTI_OBJECT:{const e=new Map(((null===r||void 0===r||null===(t=r.selection)||void 0===t||null===(a=t.indices)||void 0===a?void 0:a[n])||[]).map(((e,t)=>{var o,i,l;return[e,null===(o=r.selection)||void 0===o||null===(i=o.objects)||void 0===i||null===(l=i[n])||void 0===l?void 0:l[t]]})));if(e.has(o)?e.delete(o):e.set(o,i),0===e.size){const{[n]:e,...t}=r.selection.indices,{[n]:o,...i}=r.selection.objects;return{indices:t,objects:i}}return{indices:{...r.selection.indices,[`${n}`]:Array.from(e.keys())},objects:{...r.selection.objects,[`${n}`]:Array.from(e.values())}}}default:throw(e=>{throw new Error(`Reached a branch with non-exhaustive item: ${e}`)})(I),new Error("Invalid selection mode")}var t,a})();JSON.stringify(a)!==JSON.stringify(r.selection)&&O({fromUi:!0,value:{selection:a}})}),[I,C,O]),P=(0,i.useCallback)((()=>{O({value:{selection:we},fromUi:!0})}),[O]);return(0,x.jsxs)(N,{className:"stDeckGlJsonChart","data-testid":"stDeckGlJsonChart",width:$,height:F,children:[(0,x.jsx)(u.A,{isFullScreen:b,disableFullscreenMode:l,onExpand:s,onCollapse:t,target:N,locked:!(!A||o)||void 0,children:A&&!o&&(0,x.jsx)(u.K,{label:"Clear selection",onClick:P,icon:d.b})}),(0,x.jsxs)(n.A,{viewState:V,onViewStateChange:T,height:F,width:$,layers:W?k.layers:Se,getTooltip:j,ContextProvider:r.wZ.Provider,controller:!0,onClick:M&&!o?U:void 0,children:[(0,x.jsx)(r.b,{height:F,width:$,mapStyle:k.mapStyle&&("string"===typeof k.mapStyle?k.mapStyle:k.mapStyle[0]),mapboxApiAccessToken:w||f}),(0,x.jsx)(E,{children:(0,x.jsx)(r.ov,{"data-testid":"stDeckGlJsonChartZoomButton",showCompass:!1})})]})]})}),!0))},3101:(e,t,o)=>{"use strict";o.d(t,{_:()=>l,t:()=>a});var i=o(58878),n=o(34752),r=o(25571);function l(e){let{getStateFromWidgetMgr:t,getDefaultState:o,updateWidgetMgrState:l,element:a,widgetMgr:s,fragmentId:c}=e;const[d,h]=(0,i.useState)((()=>{var e;return null!==(e=t(s,a))&&void 0!==e?e:o(s,a)})),[u,g]=(0,i.useState)({value:d,fromUi:!1});(0,i.useEffect)((()=>{(0,r.hX)(u)||(g(null),h(u.value),l(a,s,u,c))}),[u,l,a,s,c]);const m=(0,i.useCallback)((()=>{g({value:o(s,a),fromUi:!0})}),[g,a,o,s]);return(0,n.X)({widgetMgr:s,element:a,onFormCleared:m}),[d,g]}function a(e){let{getStateFromWidgetMgr:t,getDefaultStateFromProto:o,getCurrStateFromProto:n,updateWidgetMgrState:r,element:a,widgetMgr:s,fragmentId:c}=e;const d=(0,i.useCallback)(((e,t)=>o(t)),[o]),[h,u]=l({getStateFromWidgetMgr:t,getDefaultState:d,updateWidgetMgrState:r,element:a,widgetMgr:s,fragmentId:c});return(0,i.useEffect)((()=>{a.setValue&&(a.setValue=!1,u({value:n(a),fromUi:!1}))}),[a,n,u]),[h,u]}},63872:()=>{},35111:()=>{}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[5625],{15625:(e,t,r)=>{r.r(t),r.d(t,{default:()=>V});var n=r(58878),o=r(8151),i=Object.freeze({radio:"radio",checkbox:"checkbox"}),l=(Object.freeze({change:"change"}),"default"),a=r(35331),c=r(65266),u=(0,r(57224).I4)("div",(function(e){var t=e.$shape,r=e.$length,n=e.$theme,o=1===r?void 0:t!==l?"-".concat(n.sizing.scale100):"-0.5px";return{display:"flex",marginLeft:o,marginRight:o}}));function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function f(){return f=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},f.apply(this,arguments)}function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){O(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,i=[],l=!0,a=!1;try{for(r=r.call(e);!(l=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(c){a=!0,o=c}finally{try{l||null==r.return||r.return()}finally{if(a)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return b(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return b(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function h(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 m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},m(e,t)}function v(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=S(e);if(t){var o=S(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===s(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return g(e)}(this,r)}}function g(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}function O(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}u.displayName="StyledRoot",u.displayName="StyledRoot";var C=function(e){!function(e,t){if("function"!==typeof t&&null!==t)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&&m(e,t)}(d,e);var t,r,o,s=v(d);function d(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return O(g(e=s.call.apply(s,[this].concat(r))),"childRefs",{}),e}return t=d,r=[{key:"render",value:function(){var e=this,t=this.props,r=t.overrides,o=void 0===r?{}:r,s=t.mode,d=void 0===s?i.checkbox:s,b=t.children,h=t.selected,m=t.disabled,v=t.onClick,g=t.kind,S=t.shape,O=t.size,C=y((0,a._O)(o.Root,u),2),L=C[0],j=C[1],w=this.props["aria-label"]||this.props.ariaLabel,E=d===i.radio,k=n.Children.count(b);return n.createElement(c.U.Consumer,null,(function(t){return n.createElement(L,f({"aria-label":w||t.buttongroup.ariaLabel,"data-baseweb":"button-group",role:E?"radiogroup":"group",$shape:S,$length:b.length},j),n.Children.map(b,(function(t,r){if(!n.isValidElement(t))return null;var o=t.props.isSelected?t.props.isSelected:function(e,t){return!(!Array.isArray(e)&&"number"!==typeof e)&&(Array.isArray(e)?e.includes(t):e===t)}(h,r);return E&&(e.childRefs[r]=n.createRef()),n.cloneElement(t,{disabled:m||t.props.disabled,isSelected:o,ref:E?e.childRefs[r]:void 0,tabIndex:!E||o||E&&(!h||-1===h)&&0===r?0:-1,onKeyDown:function(t){if(E){var r=Number(h)?Number(h):0;if("ArrowUp"===t.key||"ArrowLeft"===t.key){t.preventDefault&&t.preventDefault();var n=r-1<0?k-1:r-1;v&&v(t,n),e.childRefs[n].current&&e.childRefs[n].current.focus()}if("ArrowDown"===t.key||"ArrowRight"===t.key){t.preventDefault&&t.preventDefault();var o=r+1>k-1?0:r+1;v&&v(t,o),e.childRefs[o].current&&e.childRefs[o].current.focus()}}},kind:g,onClick:function(e){m||(t.props.onClick&&t.props.onClick(e),v&&v(e,r))},shape:S,size:O,overrides:p({BaseButton:{style:function(e){var t=e.$theme;return 1===b.length?{}:S!==l?{marginLeft:t.sizing.scale100,marginRight:t.sizing.scale100}:{marginLeft:"0.5px",marginRight:"0.5px"}},props:{"aria-checked":o,role:E?"radio":"checkbox"}}},t.props.overrides)})})))}))}}],r&&h(t.prototype,r),o&&h(t,o),Object.defineProperty(t,"prototype",{writable:!1}),d}(n.Component);O(C,"defaultProps",{disabled:!1,onClick:function(){},shape:l,size:"default",kind:"secondary"});var L=r(34914),j=r(84720),w=r(36459),E=r(94426),k=r(29669),R=r(70474),P=r(78286),I=r(93480),M=r(997),x=r(25571),A=r(3101),_=r(90782);function D(e,t,r,n){t.setIntArrayValue(e,r.value,{fromUi:r.fromUi},n)}function T(e,t,r,o,i,l){const a=function(e,t,r,n){return r.indexOf(n)>-1||t===k.e2.ClickMode.SINGLE_SELECT&&e===k.e2.SelectionVisualization.ALL_UP_TO_SELECTED&&r.length>0&&n<r[0]}(r,o,i,t);let c=e.content,u=e.contentIcon;return a&&(c=e.selectedContent?e.selectedContent:c,u=e.selectedContentIcon?e.selectedContentIcon:u),(0,n.forwardRef)((function(t,r){var n,o;const{element:i,kind:s,size:f}=function(e,t,r){const n=r===k.e2.Style.PILLS?j.KX.PILLS:r===k.e2.Style.BORDERLESS?j.KX.BORDERLESS_ICON:j.KX.SEGMENT,o=r===k.e2.Style.BORDERLESS?j.Pj.XSMALL:j.Pj.MEDIUM,i=r===k.e2.Style.BORDERLESS?"lg":"base";return{element:(0,_.jsxs)(_.Fragment,{children:[t&&(0,_.jsx)(E.$,{size:i,iconValue:t}),e&&(0,_.jsx)(L.Ay,{source:e,allowHTML:!1})]}),kind:n,size:o}}(null!==(n=c)&&void 0!==n?n:"",null!==(o=u)&&void 0!==o?o:void 0,l),d=function(e,t){return e&&(t=`${t}Active`),t}(!(!a||e.selectedContent||e.selectedContentIcon),s);return(0,_.jsx)(w.Ay,{...t,size:f,kind:d,children:i})}))}function F(e,t){return e.getIntArrayValue(t)}function z(e){var t;return null!==(t=e.default)&&void 0!==t?t:null}function U(e){var t;return null!==(t=e.value)&&void 0!==t?t:null}function B(e){var t;const{disabled:r,element:l,fragmentId:a,widgetMgr:c}=e,{clickMode:u,options:s,selectionVisualization:f,style:d,label:p,labelVisibility:y,help:b}=l,h=(0,o.u)(),[m,v]=(0,A.t)({getStateFromWidgetMgr:F,getDefaultStateFromProto:z,getCurrStateFromProto:U,updateWidgetMgrState:D,element:l,widgetMgr:c,fragmentId:a});let g;u===k.e2.ClickMode.SINGLE_SELECT?g=i.radio:u===k.e2.ClickMode.MULTI_SELECT&&(g=i.checkbox);const S=(0,n.useMemo)((()=>s.map(((e,t)=>{const r=T(e,t,f,u,m,d);return(0,_.jsx)(r,{},`${e.content}-${t}`)}))),[u,s,f,d,m]),O=d===k.e2.Style.BORDERLESS?h.spacing.threeXS:h.spacing.twoXS;return(0,_.jsxs)("div",{className:"stButtonGroup","data-testid":"stButtonGroup",children:[(0,_.jsx)(R.L,{label:p,disabled:r,labelVisibility:(0,x.yv)(null!==(t=null===y||void 0===y?void 0:y.value)&&void 0!==t?t:k.Qx.LabelVisibilityOptions.COLLAPSED),children:b&&(0,_.jsx)(P.Cl,{children:(0,_.jsx)(I.A,{content:b,placement:M.W.TOP})})}),(0,_.jsx)(C,{disabled:r,mode:g,onClick:(e,t)=>{const r=function(e,t,r){return e==k.e2.ClickMode.MULTI_SELECT?function(e,t){return t.includes(e)?t.filter((t=>t!==e)):[...t,e]}(t,null!==r&&void 0!==r?r:[]):null!==r&&void 0!==r&&r.includes(t)?[]:[t]}(u,t,m);v({value:r,fromUi:!0})},selected:u===k.e2.ClickMode.MULTI_SELECT?m:(L=m,0===L.length?-1:L[0]),overrides:{Root:{style:{flexWrap:"wrap",gap:O}}},children:S})]});var L}const V=(0,n.memo)(B)},34752:(e,t,r)=>{r.d(t,{X:()=>l,o:()=>i});var n=r(58878),o=r(25571);class i{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,r){(0,o.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,o._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,r),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function l(e){let{element:t,widgetMgr:r,onFormCleared:i}=e;(0,n.useEffect)((()=>{if(!(0,o._L)(t.formId))return;const e=r.addFormClearedListener(t.formId,i);return()=>{e.disconnect()}}),[t,r,i])}},3101:(e,t,r)=>{r.d(t,{t:()=>l});var n=r(58878),o=r(34752),i=r(25571);function l(e){let{getStateFromWidgetMgr:t,getDefaultStateFromProto:r,getCurrStateFromProto:l,updateWidgetMgrState:a,element:c,widgetMgr:u,fragmentId:s}=e;const[f,d]=(0,n.useState)((()=>{var e;return null!==(e=t(u,c))&&void 0!==e?e:r(c)})),[p,y]=(0,n.useState)({value:f,fromUi:!1});(0,n.useEffect)((()=>{(0,i.hX)(p)||(y(null),d(p.value),a(c,u,p,s))}),[p,a,c,u,s]),(0,n.useEffect)((()=>{c.setValue&&(c.setValue=!1,y({value:l(c),fromUi:!1}))}),[c,l]);const b=(0,n.useCallback)((()=>{y({value:r(c),fromUi:!0})}),[y,c,r]);return(0,o.X)({widgetMgr:u,element:c,onFormCleared:b}),[f,y]}}}]);
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[5625],{15625:(e,t,r)=>{r.r(t),r.d(t,{default:()=>B});var n=r(58878),o=r(8151),i=Object.freeze({radio:"radio",checkbox:"checkbox"}),l=(Object.freeze({change:"change"}),"default"),a=r(35331),c=r(65266),u=(0,r(57224).I4)("div",(function(e){var t=e.$shape,r=e.$length,n=e.$theme,o=1===r?void 0:t!==l?"-".concat(n.sizing.scale100):"-0.5px";return{display:"flex",marginLeft:o,marginRight:o}}));function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function f(){return f=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},f.apply(this,arguments)}function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){O(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,i=[],l=!0,a=!1;try{for(r=r.call(e);!(l=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(c){a=!0,o=c}finally{try{l||null==r.return||r.return()}finally{if(a)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return y(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return y(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function m(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 b(e,t){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},b(e,t)}function h(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=S(e);if(t){var o=S(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===s(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return v(e)}(this,r)}}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}function O(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}u.displayName="StyledRoot",u.displayName="StyledRoot";var C=function(e){!function(e,t){if("function"!==typeof t&&null!==t)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&&b(e,t)}(d,e);var t,r,o,s=h(d);function d(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,d);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return O(v(e=s.call.apply(s,[this].concat(r))),"childRefs",{}),e}return t=d,r=[{key:"render",value:function(){var e=this,t=this.props,r=t.overrides,o=void 0===r?{}:r,s=t.mode,d=void 0===s?i.checkbox:s,y=t.children,m=t.selected,b=t.disabled,h=t.onClick,v=t.kind,S=t.shape,O=t.size,C=g((0,a._O)(o.Root,u),2),w=C[0],L=C[1],j=this.props["aria-label"]||this.props.ariaLabel,E=d===i.radio,k=n.Children.count(y);return n.createElement(c.U.Consumer,null,(function(t){return n.createElement(w,f({"aria-label":j||t.buttongroup.ariaLabel,"data-baseweb":"button-group",role:E?"radiogroup":"group",$shape:S,$length:y.length},L),n.Children.map(y,(function(t,r){if(!n.isValidElement(t))return null;var o=t.props.isSelected?t.props.isSelected:function(e,t){return!(!Array.isArray(e)&&"number"!==typeof e)&&(Array.isArray(e)?e.includes(t):e===t)}(m,r);return E&&(e.childRefs[r]=n.createRef()),n.cloneElement(t,{disabled:b||t.props.disabled,isSelected:o,ref:E?e.childRefs[r]:void 0,tabIndex:!E||o||E&&(!m||-1===m)&&0===r?0:-1,onKeyDown:function(t){if(E){var r=Number(m)?Number(m):0;if("ArrowUp"===t.key||"ArrowLeft"===t.key){t.preventDefault&&t.preventDefault();var n=r-1<0?k-1:r-1;h&&h(t,n),e.childRefs[n].current&&e.childRefs[n].current.focus()}if("ArrowDown"===t.key||"ArrowRight"===t.key){t.preventDefault&&t.preventDefault();var o=r+1>k-1?0:r+1;h&&h(t,o),e.childRefs[o].current&&e.childRefs[o].current.focus()}}},kind:v,onClick:function(e){b||(t.props.onClick&&t.props.onClick(e),h&&h(e,r))},shape:S,size:O,overrides:p({BaseButton:{style:function(e){var t=e.$theme;return 1===y.length?{}:S!==l?{marginLeft:t.sizing.scale100,marginRight:t.sizing.scale100}:{marginLeft:"0.5px",marginRight:"0.5px"}},props:{"aria-checked":o,role:E?"radio":"checkbox"}}},t.props.overrides)})})))}))}}],r&&m(t.prototype,r),o&&m(t,o),Object.defineProperty(t,"prototype",{writable:!1}),d}(n.Component);O(C,"defaultProps",{disabled:!1,onClick:function(){},shape:l,size:"default",kind:"secondary"});var w=r(34914),L=r(84720),j=r(36459),E=r(94426),k=r(29669),M=r(70474),R=r(78286),I=r(93480),P=r(997),x=r(25571),_=r(3101),A=r(90782);function D(e,t,r,n){t.setIntArrayValue(e,r.value,{fromUi:r.fromUi},n)}function F(e,t,r,o,i,l){const a=function(e,t,r,n){return r.indexOf(n)>-1||t===k.e2.ClickMode.SINGLE_SELECT&&e===k.e2.SelectionVisualization.ALL_UP_TO_SELECTED&&r.length>0&&n<r[0]}(r,o,i,t);let c=e.content,u=e.contentIcon;return a&&(c=e.selectedContent?e.selectedContent:c,u=e.selectedContentIcon?e.selectedContentIcon:u),(0,n.forwardRef)((function(t,r){var n,o;const{element:i,kind:s,size:f}=function(e,t,r){const n=r===k.e2.Style.PILLS?L.KX.PILLS:r===k.e2.Style.BORDERLESS?L.KX.BORDERLESS_ICON:L.KX.SEGMENT,o=r===k.e2.Style.BORDERLESS?L.Pj.XSMALL:L.Pj.MEDIUM,i=r===k.e2.Style.BORDERLESS?"lg":"base";return{element:(0,A.jsxs)(A.Fragment,{children:[t&&(0,A.jsx)(E.$,{size:i,iconValue:t}),e&&(0,A.jsx)(w.Ay,{source:e,allowHTML:!1})]}),kind:n,size:o}}(null!==(n=c)&&void 0!==n?n:"",null!==(o=u)&&void 0!==o?o:void 0,l),d=function(e,t){return e&&(t=`${t}Active`),t}(!(!a||e.selectedContent||e.selectedContentIcon),s);return(0,A.jsx)(j.Ay,{...t,size:f,kind:d,children:i})}))}function T(e,t){return e.getIntArrayValue(t)}function z(e){var t;return null!==(t=e.default)&&void 0!==t?t:null}function U(e){var t;return null!==(t=e.value)&&void 0!==t?t:null}function W(e){var t;const{disabled:r,element:l,fragmentId:a,widgetMgr:c}=e,{clickMode:u,options:s,selectionVisualization:f,style:d,label:p,labelVisibility:g,help:y}=l,m=(0,o.u)(),[b,h]=(0,_.t)({getStateFromWidgetMgr:T,getDefaultStateFromProto:z,getCurrStateFromProto:U,updateWidgetMgrState:D,element:l,widgetMgr:c,fragmentId:a});let v;u===k.e2.ClickMode.SINGLE_SELECT?v=i.radio:u===k.e2.ClickMode.MULTI_SELECT&&(v=i.checkbox);const S=(0,n.useMemo)((()=>s.map(((e,t)=>{const r=F(e,t,f,u,b,d);return(0,A.jsx)(r,{},`${e.content}-${t}`)}))),[u,s,f,d,b]),O=d===k.e2.Style.BORDERLESS?m.spacing.threeXS:m.spacing.twoXS;return(0,A.jsxs)("div",{className:"stButtonGroup","data-testid":"stButtonGroup",children:[(0,A.jsx)(M.L,{label:p,disabled:r,labelVisibility:(0,x.yv)(null!==(t=null===g||void 0===g?void 0:g.value)&&void 0!==t?t:k.Qx.LabelVisibilityOptions.COLLAPSED),children:y&&(0,A.jsx)(R.Cl,{children:(0,A.jsx)(I.A,{content:y,placement:P.W.TOP})})}),(0,A.jsx)(C,{disabled:r,mode:v,onClick:(e,t)=>{const r=function(e,t,r){return e==k.e2.ClickMode.MULTI_SELECT?function(e,t){return t.includes(e)?t.filter((t=>t!==e)):[...t,e]}(t,null!==r&&void 0!==r?r:[]):null!==r&&void 0!==r&&r.includes(t)?[]:[t]}(u,t,b);h({value:r,fromUi:!0})},selected:u===k.e2.ClickMode.MULTI_SELECT?b:(w=b,0===w.length?-1:w[0]),overrides:{Root:{style:{flexWrap:"wrap",gap:O}}},children:S})]});var w}const B=(0,n.memo)(W)},34752:(e,t,r)=>{r.d(t,{X:()=>l,o:()=>i});var n=r(58878),o=r(25571);class i{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,r){(0,o.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,o._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,r),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function l(e){let{element:t,widgetMgr:r,onFormCleared:i}=e;(0,n.useEffect)((()=>{if(!(0,o._L)(t.formId))return;const e=r.addFormClearedListener(t.formId,i);return()=>{e.disconnect()}}),[t,r,i])}},3101:(e,t,r)=>{r.d(t,{_:()=>l,t:()=>a});var n=r(58878),o=r(34752),i=r(25571);function l(e){let{getStateFromWidgetMgr:t,getDefaultState:r,updateWidgetMgrState:l,element:a,widgetMgr:c,fragmentId:u}=e;const[s,f]=(0,n.useState)((()=>{var e;return null!==(e=t(c,a))&&void 0!==e?e:r(c,a)})),[d,p]=(0,n.useState)({value:s,fromUi:!1});(0,n.useEffect)((()=>{(0,i.hX)(d)||(p(null),f(d.value),l(a,c,d,u))}),[d,l,a,c,u]);const g=(0,n.useCallback)((()=>{p({value:r(c,a),fromUi:!0})}),[p,a,r,c]);return(0,o.X)({widgetMgr:c,element:a,onFormCleared:g}),[s,p]}function a(e){let{getStateFromWidgetMgr:t,getDefaultStateFromProto:r,getCurrStateFromProto:o,updateWidgetMgrState:i,element:a,widgetMgr:c,fragmentId:u}=e;const s=(0,n.useCallback)(((e,t)=>r(t)),[r]),[f,d]=l({getStateFromWidgetMgr:t,getDefaultState:s,updateWidgetMgrState:i,element:a,widgetMgr:c,fragmentId:u});return(0,n.useEffect)((()=>{a.setValue&&(a.setValue=!1,d({value:o(a),fromUi:!1}))}),[a,o,d]),[f,d]}}}]);
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[6088],{34752:(e,t,r)=>{r.d(t,{X:()=>a,o:()=>i});var o=r(58878),n=r(25571);class i{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,r){(0,n.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,n._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,r),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function a(e){let{element:t,widgetMgr:r,onFormCleared:i}=e;(0,o.useEffect)((()=>{if(!(0,n._L)(t.formId))return;const e=r.addFormClearedListener(t.formId,i);return()=>{e.disconnect()}}),[t,r,i])}},76088:(e,t,r)=>{r.r(t),r.d(t,{default:()=>fe});var o=r(58878),n=r(8151),i=r(35331),a=r(57224);function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){c(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var u=0,p=1,d=2;function f(e){return e.$isActive?d:e.$isHovered?p:u}function h(e){var t=e.$theme.colors,r=e.$disabled,o=e.$checked,n=e.$isFocusVisible,i=e.$error;if(r)return t.tickFillDisabled;if(!o)return n?t.borderSelected:i?t.tickBorderError:t.tickBorder;if(i)switch(f(e)){case u:return t.tickFillErrorSelected;case p:return t.tickFillErrorSelectedHover;case d:return t.tickFillErrorSelectedHoverActive}else switch(f(e)){case u:return t.tickFillSelected;case p:return t.tickFillSelectedHover;case d:return t.tickFillSelectedHoverActive}return null}function b(e){var t=e.$theme.colors;if(e.$disabled)return t.tickMarkFillDisabled;if(e.$checked)return t.tickMarkFill;if(e.$error)switch(f(e)){case u:return t.tickFillError;case p:return t.tickFillErrorHover;case d:return t.tickFillErrorHoverActive}else switch(f(e)){case u:return t.tickFill;case p:return t.tickFillHover;case d:return t.tickFillActive}}function m(e){var t=e.$disabled,r=e.$theme.colors;return t?r.contentSecondary:r.contentPrimary}var g=(0,a.I4)("div",(function(e){var t=e.$disabled,r=e.$align;return{display:"flex",flexWrap:"wrap",flexDirection:"horizontal"===r?"row":"column",alignItems:"horizontal"===r?"center":"flex-start",cursor:t?"not-allowed":"pointer","-webkit-tap-highlight-color":"transparent"}}));g.displayName="RadioGroupRoot",g.displayName="RadioGroupRoot";var v=(0,a.I4)("label",(function(e){var t,r=e.$disabled,o=e.$hasDescription,n=e.$labelPlacement,i=e.$theme,a=e.$align,s=i.sizing,l="horizontal"===a,u="rtl"===i.direction?"Left":"Right";return c(t={flexDirection:"top"===n||"bottom"===n?"column":"row",display:"flex",alignItems:"center",cursor:r?"not-allowed":"pointer",marginTop:s.scale200},"margin".concat(u),l?s.scale200:null),c(t,"marginBottom",o&&!l?null:s.scale200),t}));v.displayName="Root",v.displayName="Root";var y=(0,a.I4)("div",(function(e){var t=e.$theme,r=t.animation,o=t.sizing;return{backgroundColor:b(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",height:e.$checked?o.scale200:o.scale550,transitionDuration:r.timing200,transitionTimingFunction:r.easeOutCurve,width:e.$checked?o.scale200:o.scale550}}));y.displayName="RadioMarkInner",y.displayName="RadioMarkInner";var w=(0,a.I4)("div",(function(e){var t=e.$theme,r=t.animation,o=t.sizing;return{alignItems:"center",backgroundColor:h(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible&&e.$checked?"0 0 0 3px ".concat(e.$theme.colors.accent):"none",display:"flex",height:o.scale700,justifyContent:"center",marginTop:o.scale0,marginRight:o.scale0,marginBottom:o.scale0,marginLeft:o.scale0,outline:"none",verticalAlign:"middle",width:o.scale700,flexShrink:0,transitionDuration:r.timing200,transitionTimingFunction:r.easeOutCurve}}));w.displayName="RadioMarkOuter",w.displayName="RadioMarkOuter";var O=(0,a.I4)("div",(function(e){var t=e.$theme.typography;return l(l({verticalAlign:"middle"},function(e){var t,r=e.$labelPlacement,o=void 0===r?"":r,n=e.$theme;switch(o){case"top":t="Bottom";break;case"bottom":t="Top";break;case"left":t="rtl"===n.direction?"Left":"Right";break;default:t="rtl"===n.direction?"Right":"Left"}var i=n.sizing.scale300;return c({},"padding".concat(t),i)}(e)),{},{color:m(e)},t.LabelMedium)}));O.displayName="Label",O.displayName="Label";var R=(0,a.I4)("input",{width:0,height:0,marginTop:0,marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,clip:"rect(0 0 0 0)",position:"absolute"});R.displayName="Input",R.displayName="Input";var k=(0,a.I4)("div",(function(e){var t,r=e.$theme,o=e.$align,n="horizontal"===o,i="rtl"===r.direction?"Right":"Left",a="rtl"===r.direction?"Left":"Right";return l(l({},r.typography.ParagraphSmall),{},(c(t={color:r.colors.contentSecondary,cursor:"auto"},"margin".concat(i),"horizontal"===o?null:r.sizing.scale900),c(t,"margin".concat(a),n?r.sizing.scale200:null),c(t,"maxWidth","240px"),t))}));k.displayName="Description",k.displayName="Description";var F=r(56498);function M(e){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},M(e)}function S(){return S=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},S.apply(this,arguments)}function j(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var o,n,i=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(o=r.next()).done)&&(i.push(o.value),!t||i.length!==t);a=!0);}catch(l){s=!0,n=l}finally{try{a||null==r.return||r.return()}finally{if(s)throw n}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return $(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function P(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function E(e,t){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},E(e,t)}function I(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,o=x(e);if(t){var n=x(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return function(e,t){if(t&&("object"===M(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return L(e)}(this,r)}}function L(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function x(e){return x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},x(e)}function C(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var T=function(e){!function(e,t){if("function"!==typeof t&&null!==t)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(e,t)}(s,e);var t,r,n,a=I(s);function s(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s);for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return C(L(e=a.call.apply(a,[this].concat(r))),"state",{isFocusVisible:!1,focusedRadioIndex:-1}),C(L(e),"handleFocus",(function(t,r){(0,F.pP)(t)&&e.setState({isFocusVisible:!0}),e.setState({focusedRadioIndex:r}),e.props.onFocus&&e.props.onFocus(t)})),C(L(e),"handleBlur",(function(t,r){!1!==e.state.isFocusVisible&&e.setState({isFocusVisible:!1}),e.setState({focusedRadioIndex:-1}),e.props.onBlur&&e.props.onBlur(t)})),e}return t=s,(r=[{key:"render",value:function(){var e=this,t=this.props.overrides,r=void 0===t?{}:t,n=j((0,i._O)(r.RadioGroupRoot,g),2),a=n[0],s=n[1];return o.createElement(a,S({id:this.props.id,role:"radiogroup","aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props.error||null,"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],$align:this.props.align,$disabled:this.props.disabled,$error:this.props.error,$required:this.props.required},s),o.Children.map(this.props.children,(function(t,r){if(!o.isValidElement(t))return null;var n=e.props.value===t.props.value;return o.cloneElement(t,{align:e.props.align,autoFocus:e.props.autoFocus,checked:n,disabled:e.props.disabled||t.props.disabled,error:e.props.error,isFocused:e.state.focusedRadioIndex===r,isFocusVisible:e.state.isFocusVisible,tabIndex:0===r&&!e.props.value||n?"0":"-1",labelPlacement:e.props.labelPlacement,name:e.props.name,onBlur:function(t){return e.handleBlur(t,r)},onFocus:function(t){return e.handleFocus(t,r)},onChange:e.props.onChange,onMouseEnter:e.props.onMouseEnter,onMouseLeave:e.props.onMouseLeave})})))}}])&&P(t.prototype,r),n&&P(t,n),Object.defineProperty(t,"prototype",{writable:!1}),s}(o.Component);C(T,"defaultProps",{name:"",value:"",disabled:!1,autoFocus:!1,labelPlacement:"right",align:"vertical",error:!1,required:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onFocus:function(){},onBlur:function(){},overrides:{}});const _=T;var A="vertical",B="horizontal";function D(e){return D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},D(e)}function z(){return z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},z.apply(this,arguments)}function V(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var o,n,i=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(o=r.next()).done)&&(i.push(o.value),!t||i.length!==t);a=!0);}catch(l){s=!0,n=l}finally{try{a||null==r.return||r.return()}finally{if(s)throw n}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return H(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return H(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function H(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function N(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function U(e,t){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},U(e,t)}function W(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,o=G(e);if(t){var n=G(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return function(e,t){if(t&&("object"===D(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return q(e)}(this,r)}}function q(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function G(e){return G=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},G(e)}function X(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var J=function(e){return e.stopPropagation()},K=function(e){!function(e,t){if("function"!==typeof t&&null!==t)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&&U(e,t)}(s,e);var t,r,n,a=W(s);function s(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s);for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return X(q(e=a.call.apply(a,[this].concat(r))),"state",{isActive:!1,isHovered:!1}),X(q(e),"onMouseEnter",(function(t){e.setState({isHovered:!0}),e.props.onMouseEnter&&e.props.onMouseEnter(t)})),X(q(e),"onMouseLeave",(function(t){e.setState({isHovered:!1}),e.props.onMouseLeave&&e.props.onMouseLeave(t)})),X(q(e),"onMouseDown",(function(t){e.setState({isActive:!0}),e.props.onMouseDown&&e.props.onMouseDown(t)})),X(q(e),"onMouseUp",(function(t){e.setState({isActive:!1}),e.props.onMouseUp&&e.props.onMouseUp(t)})),e}return t=s,(r=[{key:"componentDidMount",value:function(){var e;this.props.autoFocus&&null!==(e=this.props.inputRef)&&void 0!==e&&e.current&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var e,t=this.props.overrides,r=void 0===t?{}:t,n=V((0,i._O)(r.Root,v),2),a=n[0],s=n[1],l=V((0,i._O)(r.Label,O),2),c=l[0],u=l[1],p=V((0,i._O)(r.Input,R),2),d=p[0],f=p[1],h=V((0,i._O)(r.Description,k),2),b=h[0],m=h[1],g=V((0,i._O)(r.RadioMarkInner,y),2),F=g[0],M=g[1],S=V((0,i._O)(r.RadioMarkOuter,w),2),j=S[0],$=S[1],P={$align:this.props.align,$checked:this.props.checked,$disabled:this.props.disabled,$hasDescription:!!this.props.description,$isActive:this.state.isActive,$error:this.props.error,$isFocused:this.props.isFocused,$isFocusVisible:this.props.isFocused&&this.props.isFocusVisible,$isHovered:this.state.isHovered,$labelPlacement:this.props.labelPlacement,$required:this.props.required,$value:this.props.value},E=o.createElement(c,z({},P,u),this.props.containsInteractiveElement?o.createElement("div",{onClick:function(e){return e.preventDefault()}},this.props.children):this.props.children);return o.createElement(o.Fragment,null,o.createElement(a,z({"data-baseweb":"radio",onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},P,s),("top"===(e=this.props.labelPlacement)||"left"===e)&&E,o.createElement(j,z({},P,$),o.createElement(F,z({},P,M))),o.createElement(d,z({"aria-invalid":this.props.error||null,checked:this.props.checked,disabled:this.props.disabled,name:this.props.name,onBlur:this.props.onBlur,onFocus:this.props.onFocus,onClick:J,onChange:this.props.onChange,ref:this.props.inputRef,required:this.props.required,tabIndex:this.props.tabIndex,type:"radio",value:this.props.value},P,f)),function(e){return"bottom"===e||"right"===e}(this.props.labelPlacement)&&E),!!this.props.description&&o.createElement(b,z({},P,m),this.props.description))}}])&&N(t.prototype,r),n&&N(t,n),Object.defineProperty(t,"prototype",{writable:!1}),s}(o.Component);X(K,"defaultProps",{overrides:{},containsInteractiveElement:!1,checked:!1,disabled:!1,autoFocus:!1,inputRef:o.createRef(),align:"vertical",error:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});const Q=K;var Y=r(70474),Z=r(78286),ee=r(93480),te=r(997),re=r(34914),oe=r(90782);function ne(e){let{disabled:t,horizontal:r,width:i,value:a,onChange:s,options:l,captions:c,label:u,labelVisibility:p,help:d}=e;const[f,h]=(0,o.useState)(null!==a&&void 0!==a?a:null);(0,o.useEffect)((()=>{a!==f&&h(null!==a&&void 0!==a?a:null)}),[a]);const b=(0,o.useCallback)((e=>{const t=parseInt(e.target.value,10);h(t),s(t)}),[s]),m=(0,n.u)(),{colors:g,radii:v}=m,y={width:i},w=c.length>0,O=l.length>0,R=O?l:["No options to select."],k=t||!O;return(0,oe.jsxs)("div",{className:"stRadio","data-testid":"stRadio",style:y,children:[(0,oe.jsx)(Y.L,{label:u,disabled:k,labelVisibility:p,children:d&&(0,oe.jsx)(Z.Cl,{children:(0,oe.jsx)(ee.A,{content:d,placement:te.W.TOP_RIGHT})})}),(0,oe.jsx)(_,{onChange:b,value:null!==f?f.toString():void 0,disabled:k,align:r?B:A,"aria-label":u,"data-testid":"stRadioGroup",overrides:{RadioGroupRoot:{style:{gap:w?m.spacing.sm:m.spacing.none,minHeight:m.sizes.minElementHeight}}},children:R.map(((e,t)=>{return(0,oe.jsxs)(Q,{value:t.toString(),overrides:{Root:{style:e=>{let{$isFocusVisible:t}=e;return{marginBottom:m.spacing.none,marginTop:m.spacing.none,marginRight:w?m.spacing.sm:m.spacing.lg,paddingLeft:m.spacing.none,alignItems:"start",paddingRight:m.spacing.threeXS,backgroundColor:t?g.darkenedBgMix25:"",borderTopLeftRadius:v.md,borderTopRightRadius:v.md,borderBottomLeftRadius:v.md,borderBottomRightRadius:v.md}}},RadioMarkOuter:{style:e=>{let{$checked:t}=e;return{width:m.sizes.checkbox,height:m.sizes.checkbox,marginTop:"0.35rem",marginRight:m.spacing.none,marginLeft:m.spacing.none,backgroundColor:t&&!k?g.primary:g.fadedText40}}},RadioMarkInner:{style:e=>{let{$checked:t}=e;return{height:t?"6px":`calc(${m.sizes.checkbox} - ${m.spacing.threeXS})`,width:t?"6px":`calc(${m.sizes.checkbox} - ${m.spacing.threeXS})`}}},Label:{style:{color:k?g.fadedText40:g.bodyText,position:"relative",top:m.spacing.px}}},children:[(0,oe.jsx)(re.Ay,{source:e,allowHTML:!1,isLabel:!0,largerLabel:!0}),w&&(0,oe.jsx)(re.Ay,{source:(o=c[t],""==o&&r&&w?" ":o),allowHTML:!1,isCaption:!0,isLabel:!0})]},t);var o}))})]})}const ie=(0,o.memo)(ne);var ae=r(3101),se=r(25571);function le(e){let{disabled:t,element:r,widgetMgr:n,width:i,fragmentId:a}=e;const[s,l]=(0,ae.t)({getStateFromWidgetMgr:ce,getDefaultStateFromProto:ue,getCurrStateFromProto:pe,updateWidgetMgrState:de,element:r,widgetMgr:n,fragmentId:a}),c=(0,o.useCallback)((e=>{l({value:e,fromUi:!0})}),[l]),{horizontal:u,options:p,captions:d,label:f,labelVisibility:h,help:b}=r;return(0,oe.jsx)(ie,{label:f,onChange:c,options:p,captions:d,width:i,disabled:t,horizontal:u,labelVisibility:(0,se.yv)(null===h||void 0===h?void 0:h.value),value:null!==s&&void 0!==s?s:null,help:b})}function ce(e,t){return e.getIntValue(t)}function ue(e){var t;return null!==(t=e.default)&&void 0!==t?t:null}function pe(e){var t;return null!==(t=e.value)&&void 0!==t?t:null}function de(e,t,r,o){var n;t.setIntValue(e,null!==(n=r.value)&&void 0!==n?n:null,{fromUi:r.fromUi},o)}const fe=(0,o.memo)(le)},3101:(e,t,r)=>{r.d(t,{t:()=>a});var o=r(58878),n=r(34752),i=r(25571);function a(e){let{getStateFromWidgetMgr:t,getDefaultStateFromProto:r,getCurrStateFromProto:a,updateWidgetMgrState:s,element:l,widgetMgr:c,fragmentId:u}=e;const[p,d]=(0,o.useState)((()=>{var e;return null!==(e=t(c,l))&&void 0!==e?e:r(l)})),[f,h]=(0,o.useState)({value:p,fromUi:!1});(0,o.useEffect)((()=>{(0,i.hX)(f)||(h(null),d(f.value),s(l,c,f,u))}),[f,s,l,c,u]),(0,o.useEffect)((()=>{l.setValue&&(l.setValue=!1,h({value:a(l),fromUi:!1}))}),[l,a]);const b=(0,o.useCallback)((()=>{h({value:r(l),fromUi:!0})}),[h,l,r]);return(0,n.X)({widgetMgr:c,element:l,onFormCleared:b}),[p,h]}}}]);
|
1
|
+
"use strict";(self.webpackChunk_streamlit_app=self.webpackChunk_streamlit_app||[]).push([[6088],{34752:(e,t,r)=>{r.d(t,{X:()=>a,o:()=>i});var n=r(58878),o=r(25571);class i{constructor(){this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}manageFormClearListener(e,t,r){(0,o.se)(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),(0,o._L)(t)&&(this.formClearListener=e.addFormClearedListener(t,r),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){var e;null===(e=this.formClearListener)||void 0===e||e.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function a(e){let{element:t,widgetMgr:r,onFormCleared:i}=e;(0,n.useEffect)((()=>{if(!(0,o._L)(t.formId))return;const e=r.addFormClearedListener(t.formId,i);return()=>{e.disconnect()}}),[t,r,i])}},76088:(e,t,r)=>{r.r(t),r.d(t,{default:()=>fe});var n=r(58878),o=r(8151),i=r(35331),a=r(57224);function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){c(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var u=0,p=1,d=2;function f(e){return e.$isActive?d:e.$isHovered?p:u}function h(e){var t=e.$theme.colors,r=e.$disabled,n=e.$checked,o=e.$isFocusVisible,i=e.$error;if(r)return t.tickFillDisabled;if(!n)return o?t.borderSelected:i?t.tickBorderError:t.tickBorder;if(i)switch(f(e)){case u:return t.tickFillErrorSelected;case p:return t.tickFillErrorSelectedHover;case d:return t.tickFillErrorSelectedHoverActive}else switch(f(e)){case u:return t.tickFillSelected;case p:return t.tickFillSelectedHover;case d:return t.tickFillSelectedHoverActive}return null}function b(e){var t=e.$theme.colors;if(e.$disabled)return t.tickMarkFillDisabled;if(e.$checked)return t.tickMarkFill;if(e.$error)switch(f(e)){case u:return t.tickFillError;case p:return t.tickFillErrorHover;case d:return t.tickFillErrorHoverActive}else switch(f(e)){case u:return t.tickFill;case p:return t.tickFillHover;case d:return t.tickFillActive}}function m(e){var t=e.$disabled,r=e.$theme.colors;return t?r.contentSecondary:r.contentPrimary}var g=(0,a.I4)("div",(function(e){var t=e.$disabled,r=e.$align;return{display:"flex",flexWrap:"wrap",flexDirection:"horizontal"===r?"row":"column",alignItems:"horizontal"===r?"center":"flex-start",cursor:t?"not-allowed":"pointer","-webkit-tap-highlight-color":"transparent"}}));g.displayName="RadioGroupRoot",g.displayName="RadioGroupRoot";var v=(0,a.I4)("label",(function(e){var t,r=e.$disabled,n=e.$hasDescription,o=e.$labelPlacement,i=e.$theme,a=e.$align,s=i.sizing,l="horizontal"===a,u="rtl"===i.direction?"Left":"Right";return c(t={flexDirection:"top"===o||"bottom"===o?"column":"row",display:"flex",alignItems:"center",cursor:r?"not-allowed":"pointer",marginTop:s.scale200},"margin".concat(u),l?s.scale200:null),c(t,"marginBottom",n&&!l?null:s.scale200),t}));v.displayName="Root",v.displayName="Root";var y=(0,a.I4)("div",(function(e){var t=e.$theme,r=t.animation,n=t.sizing;return{backgroundColor:b(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",height:e.$checked?n.scale200:n.scale550,transitionDuration:r.timing200,transitionTimingFunction:r.easeOutCurve,width:e.$checked?n.scale200:n.scale550}}));y.displayName="RadioMarkInner",y.displayName="RadioMarkInner";var w=(0,a.I4)("div",(function(e){var t=e.$theme,r=t.animation,n=t.sizing;return{alignItems:"center",backgroundColor:h(e),borderTopLeftRadius:"50%",borderTopRightRadius:"50%",borderBottomRightRadius:"50%",borderBottomLeftRadius:"50%",boxShadow:e.$isFocusVisible&&e.$checked?"0 0 0 3px ".concat(e.$theme.colors.accent):"none",display:"flex",height:n.scale700,justifyContent:"center",marginTop:n.scale0,marginRight:n.scale0,marginBottom:n.scale0,marginLeft:n.scale0,outline:"none",verticalAlign:"middle",width:n.scale700,flexShrink:0,transitionDuration:r.timing200,transitionTimingFunction:r.easeOutCurve}}));w.displayName="RadioMarkOuter",w.displayName="RadioMarkOuter";var O=(0,a.I4)("div",(function(e){var t=e.$theme.typography;return l(l({verticalAlign:"middle"},function(e){var t,r=e.$labelPlacement,n=void 0===r?"":r,o=e.$theme;switch(n){case"top":t="Bottom";break;case"bottom":t="Top";break;case"left":t="rtl"===o.direction?"Left":"Right";break;default:t="rtl"===o.direction?"Right":"Left"}var i=o.sizing.scale300;return c({},"padding".concat(t),i)}(e)),{},{color:m(e)},t.LabelMedium)}));O.displayName="Label",O.displayName="Label";var R=(0,a.I4)("input",{width:0,height:0,marginTop:0,marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,clip:"rect(0 0 0 0)",position:"absolute"});R.displayName="Input",R.displayName="Input";var k=(0,a.I4)("div",(function(e){var t,r=e.$theme,n=e.$align,o="horizontal"===n,i="rtl"===r.direction?"Right":"Left",a="rtl"===r.direction?"Left":"Right";return l(l({},r.typography.ParagraphSmall),{},(c(t={color:r.colors.contentSecondary,cursor:"auto"},"margin".concat(i),"horizontal"===n?null:r.sizing.scale900),c(t,"margin".concat(a),o?r.sizing.scale200:null),c(t,"maxWidth","240px"),t))}));k.displayName="Description",k.displayName="Description";var M=r(56498);function S(e){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S(e)}function F(){return F=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},F.apply(this,arguments)}function j(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(l){s=!0,o=l}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return $(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function P(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 I(e,t){return I=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},I(e,t)}function E(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=x(e);if(t){var o=x(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===S(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return L(e)}(this,r)}}function L(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function x(e){return x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},x(e)}function C(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var _=function(e){!function(e,t){if("function"!==typeof t&&null!==t)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&&I(e,t)}(s,e);var t,r,o,a=E(s);function s(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return C(L(e=a.call.apply(a,[this].concat(r))),"state",{isFocusVisible:!1,focusedRadioIndex:-1}),C(L(e),"handleFocus",(function(t,r){(0,M.pP)(t)&&e.setState({isFocusVisible:!0}),e.setState({focusedRadioIndex:r}),e.props.onFocus&&e.props.onFocus(t)})),C(L(e),"handleBlur",(function(t,r){!1!==e.state.isFocusVisible&&e.setState({isFocusVisible:!1}),e.setState({focusedRadioIndex:-1}),e.props.onBlur&&e.props.onBlur(t)})),e}return t=s,(r=[{key:"render",value:function(){var e=this,t=this.props.overrides,r=void 0===t?{}:t,o=j((0,i._O)(r.RadioGroupRoot,g),2),a=o[0],s=o[1];return n.createElement(a,F({id:this.props.id,role:"radiogroup","aria-describedby":this.props["aria-describedby"],"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props.error||null,"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],$align:this.props.align,$disabled:this.props.disabled,$error:this.props.error,$required:this.props.required},s),n.Children.map(this.props.children,(function(t,r){if(!n.isValidElement(t))return null;var o=e.props.value===t.props.value;return n.cloneElement(t,{align:e.props.align,autoFocus:e.props.autoFocus,checked:o,disabled:e.props.disabled||t.props.disabled,error:e.props.error,isFocused:e.state.focusedRadioIndex===r,isFocusVisible:e.state.isFocusVisible,tabIndex:0===r&&!e.props.value||o?"0":"-1",labelPlacement:e.props.labelPlacement,name:e.props.name,onBlur:function(t){return e.handleBlur(t,r)},onFocus:function(t){return e.handleFocus(t,r)},onChange:e.props.onChange,onMouseEnter:e.props.onMouseEnter,onMouseLeave:e.props.onMouseLeave})})))}}])&&P(t.prototype,r),o&&P(t,o),Object.defineProperty(t,"prototype",{writable:!1}),s}(n.Component);C(_,"defaultProps",{name:"",value:"",disabled:!1,autoFocus:!1,labelPlacement:"right",align:"vertical",error:!1,required:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onFocus:function(){},onBlur:function(){},overrides:{}});const T=_;var A="vertical",D="horizontal";function B(e){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},B(e)}function z(){return z=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},z.apply(this,arguments)}function V(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(l){s=!0,o=l}finally{try{a||null==r.return||r.return()}finally{if(s)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return H(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return H(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function H(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function N(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 W(e,t){return W=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},W(e,t)}function U(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=G(e);if(t){var o=G(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===B(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return q(e)}(this,r)}}function q(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function G(e){return G=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},G(e)}function X(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var J=function(e){return e.stopPropagation()},K=function(e){!function(e,t){if("function"!==typeof t&&null!==t)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&&W(e,t)}(s,e);var t,r,o,a=U(s);function s(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return X(q(e=a.call.apply(a,[this].concat(r))),"state",{isActive:!1,isHovered:!1}),X(q(e),"onMouseEnter",(function(t){e.setState({isHovered:!0}),e.props.onMouseEnter&&e.props.onMouseEnter(t)})),X(q(e),"onMouseLeave",(function(t){e.setState({isHovered:!1}),e.props.onMouseLeave&&e.props.onMouseLeave(t)})),X(q(e),"onMouseDown",(function(t){e.setState({isActive:!0}),e.props.onMouseDown&&e.props.onMouseDown(t)})),X(q(e),"onMouseUp",(function(t){e.setState({isActive:!1}),e.props.onMouseUp&&e.props.onMouseUp(t)})),e}return t=s,(r=[{key:"componentDidMount",value:function(){var e;this.props.autoFocus&&null!==(e=this.props.inputRef)&&void 0!==e&&e.current&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var e,t=this.props.overrides,r=void 0===t?{}:t,o=V((0,i._O)(r.Root,v),2),a=o[0],s=o[1],l=V((0,i._O)(r.Label,O),2),c=l[0],u=l[1],p=V((0,i._O)(r.Input,R),2),d=p[0],f=p[1],h=V((0,i._O)(r.Description,k),2),b=h[0],m=h[1],g=V((0,i._O)(r.RadioMarkInner,y),2),M=g[0],S=g[1],F=V((0,i._O)(r.RadioMarkOuter,w),2),j=F[0],$=F[1],P={$align:this.props.align,$checked:this.props.checked,$disabled:this.props.disabled,$hasDescription:!!this.props.description,$isActive:this.state.isActive,$error:this.props.error,$isFocused:this.props.isFocused,$isFocusVisible:this.props.isFocused&&this.props.isFocusVisible,$isHovered:this.state.isHovered,$labelPlacement:this.props.labelPlacement,$required:this.props.required,$value:this.props.value},I=n.createElement(c,z({},P,u),this.props.containsInteractiveElement?n.createElement("div",{onClick:function(e){return e.preventDefault()}},this.props.children):this.props.children);return n.createElement(n.Fragment,null,n.createElement(a,z({"data-baseweb":"radio",onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp},P,s),("top"===(e=this.props.labelPlacement)||"left"===e)&&I,n.createElement(j,z({},P,$),n.createElement(M,z({},P,S))),n.createElement(d,z({"aria-invalid":this.props.error||null,checked:this.props.checked,disabled:this.props.disabled,name:this.props.name,onBlur:this.props.onBlur,onFocus:this.props.onFocus,onClick:J,onChange:this.props.onChange,ref:this.props.inputRef,required:this.props.required,tabIndex:this.props.tabIndex,type:"radio",value:this.props.value},P,f)),function(e){return"bottom"===e||"right"===e}(this.props.labelPlacement)&&I),!!this.props.description&&n.createElement(b,z({},P,m),this.props.description))}}])&&N(t.prototype,r),o&&N(t,o),Object.defineProperty(t,"prototype",{writable:!1}),s}(n.Component);X(K,"defaultProps",{overrides:{},containsInteractiveElement:!1,checked:!1,disabled:!1,autoFocus:!1,inputRef:n.createRef(),align:"vertical",error:!1,onChange:function(){},onMouseEnter:function(){},onMouseLeave:function(){},onMouseDown:function(){},onMouseUp:function(){},onFocus:function(){},onBlur:function(){}});const Q=K;var Y=r(70474),Z=r(78286),ee=r(93480),te=r(997),re=r(34914),ne=r(90782);function oe(e){let{disabled:t,horizontal:r,width:i,value:a,onChange:s,options:l,captions:c,label:u,labelVisibility:p,help:d}=e;const[f,h]=(0,n.useState)(null!==a&&void 0!==a?a:null);(0,n.useEffect)((()=>{a!==f&&h(null!==a&&void 0!==a?a:null)}),[a]);const b=(0,n.useCallback)((e=>{const t=parseInt(e.target.value,10);h(t),s(t)}),[s]),m=(0,o.u)(),{colors:g,radii:v}=m,y={width:i},w=c.length>0,O=l.length>0,R=O?l:["No options to select."],k=t||!O;return(0,ne.jsxs)("div",{className:"stRadio","data-testid":"stRadio",style:y,children:[(0,ne.jsx)(Y.L,{label:u,disabled:k,labelVisibility:p,children:d&&(0,ne.jsx)(Z.Cl,{children:(0,ne.jsx)(ee.A,{content:d,placement:te.W.TOP_RIGHT})})}),(0,ne.jsx)(T,{onChange:b,value:null!==f?f.toString():void 0,disabled:k,align:r?D:A,"aria-label":u,"data-testid":"stRadioGroup",overrides:{RadioGroupRoot:{style:{gap:w?m.spacing.sm:m.spacing.none,minHeight:m.sizes.minElementHeight}}},children:R.map(((e,t)=>{return(0,ne.jsxs)(Q,{value:t.toString(),overrides:{Root:{style:e=>{let{$isFocusVisible:t}=e;return{marginBottom:m.spacing.none,marginTop:m.spacing.none,marginRight:w?m.spacing.sm:m.spacing.lg,paddingLeft:m.spacing.none,alignItems:"start",paddingRight:m.spacing.threeXS,backgroundColor:t?g.darkenedBgMix25:"",borderTopLeftRadius:v.md,borderTopRightRadius:v.md,borderBottomLeftRadius:v.md,borderBottomRightRadius:v.md}}},RadioMarkOuter:{style:e=>{let{$checked:t}=e;return{width:m.sizes.checkbox,height:m.sizes.checkbox,marginTop:"0.35rem",marginRight:m.spacing.none,marginLeft:m.spacing.none,backgroundColor:t&&!k?g.primary:g.fadedText40}}},RadioMarkInner:{style:e=>{let{$checked:t}=e;return{height:t?"6px":`calc(${m.sizes.checkbox} - ${m.spacing.threeXS})`,width:t?"6px":`calc(${m.sizes.checkbox} - ${m.spacing.threeXS})`}}},Label:{style:{color:k?g.fadedText40:g.bodyText,position:"relative",top:m.spacing.px}}},children:[(0,ne.jsx)(re.Ay,{source:e,allowHTML:!1,isLabel:!0,largerLabel:!0}),w&&(0,ne.jsx)(re.Ay,{source:(n=c[t],""==n&&r&&w?" ":n),allowHTML:!1,isCaption:!0,isLabel:!0})]},t);var n}))})]})}const ie=(0,n.memo)(oe);var ae=r(3101),se=r(25571);function le(e){let{disabled:t,element:r,widgetMgr:o,width:i,fragmentId:a}=e;const[s,l]=(0,ae.t)({getStateFromWidgetMgr:ce,getDefaultStateFromProto:ue,getCurrStateFromProto:pe,updateWidgetMgrState:de,element:r,widgetMgr:o,fragmentId:a}),c=(0,n.useCallback)((e=>{l({value:e,fromUi:!0})}),[l]),{horizontal:u,options:p,captions:d,label:f,labelVisibility:h,help:b}=r;return(0,ne.jsx)(ie,{label:f,onChange:c,options:p,captions:d,width:i,disabled:t,horizontal:u,labelVisibility:(0,se.yv)(null===h||void 0===h?void 0:h.value),value:null!==s&&void 0!==s?s:null,help:b})}function ce(e,t){return e.getIntValue(t)}function ue(e){var t;return null!==(t=e.default)&&void 0!==t?t:null}function pe(e){var t;return null!==(t=e.value)&&void 0!==t?t:null}function de(e,t,r,n){var o;t.setIntValue(e,null!==(o=r.value)&&void 0!==o?o:null,{fromUi:r.fromUi},n)}const fe=(0,n.memo)(le)},3101:(e,t,r)=>{r.d(t,{_:()=>a,t:()=>s});var n=r(58878),o=r(34752),i=r(25571);function a(e){let{getStateFromWidgetMgr:t,getDefaultState:r,updateWidgetMgrState:a,element:s,widgetMgr:l,fragmentId:c}=e;const[u,p]=(0,n.useState)((()=>{var e;return null!==(e=t(l,s))&&void 0!==e?e:r(l,s)})),[d,f]=(0,n.useState)({value:u,fromUi:!1});(0,n.useEffect)((()=>{(0,i.hX)(d)||(f(null),p(d.value),a(s,l,d,c))}),[d,a,s,l,c]);const h=(0,n.useCallback)((()=>{f({value:r(l,s),fromUi:!0})}),[f,s,r,l]);return(0,o.X)({widgetMgr:l,element:s,onFormCleared:h}),[u,f]}function s(e){let{getStateFromWidgetMgr:t,getDefaultStateFromProto:r,getCurrStateFromProto:o,updateWidgetMgrState:i,element:s,widgetMgr:l,fragmentId:c}=e;const u=(0,n.useCallback)(((e,t)=>r(t)),[r]),[p,d]=a({getStateFromWidgetMgr:t,getDefaultState:u,updateWidgetMgrState:i,element:s,widgetMgr:l,fragmentId:c});return(0,n.useEffect)((()=>{s.setValue&&(s.setValue=!1,d({value:o(s),fromUi:!1}))}),[s,o,d]),[p,d]}}}]);
|