@carto/meridian-ds 1.3.1 → 1.3.2
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.
- package/CHANGELOG.md +6 -0
- package/dist/widgets/index.cjs +1 -1
- package/dist/widgets/index.js +254 -254
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
3
5
|
## 1.0
|
|
4
6
|
|
|
7
|
+
### 1.3.2
|
|
8
|
+
|
|
9
|
+
- Prevent LegendLayerTitle from being UPPERCASE [#118](https://github.com/CartoDB/meridian-ds/pull/118)
|
|
10
|
+
|
|
5
11
|
### 1.3.1
|
|
6
12
|
|
|
7
13
|
- New loading state for Button component [#116](https://github.com/CartoDB/meridian-ds/pull/116)
|
package/dist/widgets/index.cjs
CHANGED
|
@@ -30,4 +30,4 @@
|
|
|
30
30
|
<p style="${r}">${a.name}</p>
|
|
31
31
|
<p style="${s}">${String(l.marker)} ${c} (${g} %)</p>
|
|
32
32
|
`.trim()}const Or=e=>e,$r=()=>{},De=[],Rr="260px";function Fr({names:e=De,data:n=De,labels:i=De,colors:r=De,height:s=Rr,animation:l=!0,formatter:a=Or,tooltipFormatter:p=Nr,selectedCategories:c=[],onCategorySelected:g=$r,isLoading:h=!1}){const d=o.useTheme(),y=u.useRef(),f=u.useMemo(()=>n.map((b,S)=>Dr(b,r[S],i[S],d,c)),[n,r,i,d,c]),m=u.useMemo(()=>{const b=f.length>1;let S;p&&(S=E=>p(E,a,b));const k={trigger:"item",show:!0,backgroundColor:d.palette.black[90],textStyle:{color:d.palette.common.white},confine:!0,borderWidth:0,formatter:S},w={data:b?f.map((E,L)=>e[L]):(f[0]??[]).map(E=>E.name),selectedMode:!1,type:"scroll",left:j.SPACING,bottom:j.SPACING*-.5,itemGap:j.SPACING*3,icon:"circle",itemWidth:j.SPACING,itemHeight:j.SPACING,textStyle:{...d.typography.overline,color:d.palette.text.primary,fontWeight:400,lineHeight:1,verticalAlign:"bottom",padding:[0,0,0,j.SPACING*.5]},inactiveColor:d.palette.text.disabled,pageIcons:{horizontal:["path://M15.41 7.41 14 6 8 12 14 18 15.41 16.59 10.83 12z","path://M9 16.59 13.3265857 12 9 7.41 10.3319838 6 16 12 10.3319838 18z"]},pageIconSize:j.SPACING*1.5,pageIconColor:d.palette.text.secondary,pageIconInactiveColor:d.palette.text.disabled,pageTextStyle:{fontFamily:d.typography.overline.fontFamily,fontSize:j.SPACING*1.5,lineHeight:j.SPACING*1.75,fontWeight:400,color:d.palette.text.primary}},C={formatter:({name:E,percent:L})=>`{per|${a(L)}%}
|
|
33
|
-
{b|${E}}`,position:"center",rich:{b:{fontFamily:d.typography.overline.fontFamily,fontSize:j.SPACING*1.75,lineHeight:j.SPACING*1.75,fontWeight:400,color:d.palette.text.primary},per:{...d.typography.overline,fontSize:j.SPACING*3,lineHeight:j.SPACING*4.5,fontWeight:600,color:d.palette.text.primary}}},M=f.map((E,L)=>{var P;return{type:"pie",name:e[L],itemStyle:{color:(P=E[0])==null?void 0:P.color},animation:l,data:E.map(N=>({...N,itemStyle:{color:N.color}})),radius:L===0?["75%","90%"]:["56%","72%"],selectedOffset:0,hoverOffset:5,bottom:j.SPACING*2.5,avoidLabelOverlap:!0,label:{show:!1,...C},emphasis:{label:{show:!0,formatter:C.formatter,rich:C.rich}}}});return{grid:{left:0,top:0,right:0,bottom:0},tooltip:k,legend:w,series:M}},[d,e,l,f,a,p]),v={mouseover:(b,S)=>{f.length===1&&(b.seriesIndex!==0||b.dataIndex!==0)&&S.dispatchAction({type:"downplay",seriesIndex:0,dataIndex:0})},mouseout:(b,S)=>{f.length===1&&S.dispatchAction({type:"highlight",seriesIndex:0,dataIndex:0})},click:b=>{const k=f[b.seriesIndex][b.dataIndex].key,T=c.includes(k),w=new Set(c);T?w.delete(k):w.add(k);const C=f[0].length;let M=Array.from(w);M.length===C&&(M=[]),g(M)}};u.useEffect(()=>{y.current&&y.current.dispatchAction({type:f.length===1?"highlight":"downplay",seriesIndex:0,dataIndex:0})},[f]);function x(b){y.current=b}return f.length?h?t.jsx(Ft,{height:s}):t.jsx(ye,{onChartReady:x,notMerge:!0,option:m,onEvents:v,style:{maxHeight:s,width:"100%"}}):null}const Wr=()=>{};function nn({icon:e,hoverTooltip:n,clickTooltip:i,enabled:r,onEnabledChange:s=Wr,tooltipPlacement:l="bottom"}){const[a,p]=u.useState(!1),[c,g]=u.useState(r);u.useEffect(()=>{g(r)},[r]),u.useEffect(()=>{if(r){const d=y=>{y.key==="Escape"&&s&&s(!1)};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d)}}},[r,s]);const h=c?i:n;return t.jsx(o.ClickAwayListener,{onClickAway:()=>g(!1),children:t.jsx(o.Tooltip,{title:h,placement:l,open:a,onOpen:()=>p(!0),onClose:()=>{c||p(!1)},children:t.jsx(o.ToggleButton,{value:"selectedMode",selected:r,onClick:()=>s&&s(!r),children:e})})})}const _r=o.styled(o.IconButton,{shouldForwardProp:e=>e!=="isOpen"})(({isOpen:e,theme:n})=>({color:n.palette.text.secondary,width:n.spacing(3),transform:`rotate(${e?"180":"0"}deg)`,backgroundColor:e?n.palette.action.hover:void 0})),Gr=o.styled(o.MenuItem,{shouldForwardProp:e=>e!=="disabled"})(({disabled:e,theme:n})=>({...e&&{pointerEvents:"none",color:n.palette.text.disabled}})),zr=o.styled(o.MenuItem)(()=>({"&.Mui-disabled":{opacity:1}})),Hr=()=>{};function on({selectionModes:e,editModes:n,selectedMode:i,onSelectMode:r=Hr,enabled:s,tooltipPlacement:l="bottom",tooltipText:a="",menuHeaderText:p="",editDisabled:c}){const g=o.useTheme(),[h,d]=u.useState(null),y=!!h,f=k=>d(k.currentTarget),m=()=>d(null),v=k=>{r&&r(k),m()},x=!!e.length&&!!n.length,b=k=>n.some(T=>T.id===k.id);function S(k){return t.jsx(Gr,{selected:s&&i===k.id,onClick:()=>v(k.id),disabled:c&&b(k),children:t.jsxs(o.Box,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[k.icon,t.jsx(o.Box,{ml:2,children:t.jsx(j.Typography,{variant:"body2",color:"inherit",children:o.capitalize(k.label)})})]})},k.id)}return t.jsxs(t.Fragment,{children:[t.jsx(o.Tooltip,{title:a,placement:l,children:t.jsx(_r,{id:"feature-selection-menu-button","aria-controls":"feature-selection-menu","aria-haspopup":"true","aria-expanded":y?"true":void 0,onClick:f,isOpen:y,children:t.jsx(ee.KeyboardArrowDown,{})})}),t.jsxs(o.Menu,{id:"feature-selection-menu",style:{zIndex:g.zIndex.tooltip+1},anchorEl:h,open:y,onClose:m,MenuListProps:{"aria-labelledby":"feature-selection-menu-button"},children:[p&&t.jsx(zr,{disabled:!0,children:t.jsx(j.Typography,{variant:"caption",color:"textSecondary",children:p})}),!!e.length&&e.map(S),x&&t.jsx(o.Divider,{sx:{margin:({spacing:k})=>k(1,0)}}),!!n.length&&n.map(S)]})]})}const Yr=o.styled(o.List)(({theme:e})=>({display:"flex",alignItems:"center",marginLeft:e.spacing(1.5),padding:e.spacing(.5),overflowX:"auto",maxWidth:"100%",scrollbarWidth:"none",msOverflowStyle:"none","&::-webkit-scrollbar":{display:"none"}})),Vr=()=>{};function rn({features:e,onSelectGeometry:n=Vr,onDeleteGeometry:i,chipTooltip:r,disabledChipTooltip:s,size:l="medium",tooltipPlacement:a="bottom",chipLabel:p}){const c=Z.useIntl(),g=j.useImperativeIntl(c);function h(m){return m==="MultiPoint"?g.formatMessage({id:"c4r.widgets.featureSelection.point"}):m==="MultiLineString"?g.formatMessage({id:"c4r.widgets.featureSelection.lineString"}):m==="MultiPolygon"||m==="Polygon"||m==="GeometryCollection"?g.formatMessage({id:"c4r.widgets.featureSelection.polygon"}):m}function d(m,v){var b;const x=h(m.geometry.type);return p||((b=m.properties)==null?void 0:b.name)||`${x} ${v+1}`}const[y,f]=u.useState(!1);return t.jsx(o.Box,{sx:{overflowX:"auto"},children:t.jsx(Yr,{sx:{gap:l==="small"?.5:1},children:e.map((m,v)=>{var T,w;const x=(T=m.properties)==null?void 0:T.disabled,b=(w=m.properties)==null?void 0:w.invalid;let S=r;x&&(S=s||r),b&&(S=g.formatMessage({id:"c4r.widgets.featureSelection.invalid"})),y&&(S=g.formatMessage({id:"c4r.widgets.featureSelection.remove"}));let k="secondary";return x&&(k="default"),b&&(k="error"),t.jsx(o.ListItem,{disablePadding:!0,children:t.jsx(o.Tooltip,{disableHoverListener:x?!s:!r,title:S,placement:a,children:t.jsx(o.Chip,{size:l,label:d(m,v),color:k,onClick:()=>n(m),onDelete:i?()=>i(m):void 0,icon:b?t.jsx(ee.ErrorOutline,{color:"error"}):void 0,deleteIcon:t.jsx(ee.Cancel,{onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1)})})})},v)})})})}const Ur=o.styled(o.Paper)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",maxHeight:e.spacing(5),padding:e.spacing(.5)})),qr=[];function Kr({selectionModes:e,editModes:n=qr,selectedMode:i,onSelectMode:r,enabled:s=!1,onEnabledChange:l,geometry:a,onSelectGeometry:p,onDeleteGeometry:c,tooltipPlacement:g="bottom",size:h="medium",chipLabel:d}){const y=Z.useIntl(),f=j.useImperativeIntl(y),m=u.useMemo(()=>e.map(T=>({...T,label:f.formatMessage({id:`c4r.widgets.featureSelection.${It(T.id)}`})})),[e,f]),v=u.useMemo(()=>n.map(T=>({...T,label:f.formatMessage({id:`c4r.widgets.featureSelection.${It(T.id)}`})})),[n,f]),x=u.useMemo(()=>{const w=[...m.map(C=>({...C,isEdit:!1})),...v.map(C=>({...C,isEdit:!0}))].find(C=>C.id===i);if(!w)throw new Error(`Selected mode "${i}" not supported`);return w},[v,m,i]),b=o.capitalize((x==null?void 0:x.label)||""),S=x!=null&&x.isEdit?b:f.formatMessage({id:"c4r.widgets.featureSelection.selectTool"},{label:b}),k=x!=null&&x.isEdit?f.formatMessage({id:"c4r.widgets.featureSelection.clickToEdit"}):f.formatMessage({id:"c4r.widgets.featureSelection.clickToCreate"});return t.jsxs(Ur,{children:[t.jsx(nn,{icon:x==null?void 0:x.icon,hoverTooltip:S,clickTooltip:k,enabled:s,onEnabledChange:l,tooltipPlacement:g}),t.jsx(on,{selectionModes:m,editModes:v,selectedMode:i,onSelectMode:r,enabled:s,tooltipPlacement:g,tooltipText:f.formatMessage({id:"c4r.widgets.featureSelection.selectMode"}),menuHeaderText:f.formatMessage({id:"c4r.widgets.featureSelection.chooseSelectionMode"}),editDisabled:!a}),!!a&&t.jsx(rn,{features:[a],onSelectGeometry:p,onDeleteGeometry:c,disabledChipTooltip:f.formatMessage({id:"c4r.widgets.featureSelection.applyMask"}),chipTooltip:f.formatMessage({id:"c4r.widgets.featureSelection.clearMask"}),tooltipPlacement:g,size:h,chipLabel:d})]})}function It(e){return e.charAt(0).toLowerCase()+e.slice(1)}const sn=240,Xr=o.styled(o.Paper,{shouldForwardProp:e=>e!=="collapsed"})(({theme:e,collapsed:n})=>({width:n?"min-content":sn,background:e.palette.background.paper,maxHeight:"calc(100% - 120px)",display:"flex",flexDirection:"column"})),Zr=o.styled("header",{shouldForwardProp:e=>e!=="collapsed"})(({theme:e,collapsed:n})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:e.spacing(1),paddingLeft:e.spacing(2),borderBottom:n?void 0:`1px solid ${e.palette.divider}`})),Jr=o.styled("header")(({theme:e})=>({padding:e.spacing(1.5),paddingRight:e.spacing(2),gap:e.spacing(.5),display:"flex",justifyContent:"space-between",position:"sticky",zIndex:2,top:0,background:e.palette.background.paper})),Qr=o.styled("div")(({theme:e})=>({display:"flex",gap:e.spacing(2),alignItems:"center",padding:e.spacing(1),minWidth:`calc(${sn}px - ${e.spacing(4)})`})),es=o.styled(o.TextField)(({theme:e})=>({display:"flex",width:e.spacing(7.5),flexShrink:0,"input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:0}})),ts=o.styled("ul",{shouldForwardProp:e=>e!=="opacity"})(({theme:e,opacity:n})=>({opacity:n,margin:0,padding:0,display:"flex",flexDirection:"column",gap:e.spacing(1)})),ln=o.styled("ul")(({theme:e})=>({margin:0,padding:0,paddingBottom:e.spacing(1),display:"flex",flexDirection:"column"})),ns=o.styled("li")(()=>({display:"flex",alignItems:"center"})),os=o.styled("div")(({theme:e})=>({marginRight:e.spacing(1.5),width:j.ICON_SIZE_MEDIUM,height:j.ICON_SIZE_MEDIUM,"& img":{margin:"auto",display:"block"}})),Tt=o.styled(o.Box,{shouldForwardProp:e=>e!=="width"})(({width:e,theme:n})=>({width:e,overflow:"auto",maxHeight:`calc(100% - ${n.spacing(1.5)})`})),is=o.styled("section")(({theme:e})=>({"&:not(:first-of-type)":{borderTop:`1px solid ${e.palette.divider}`}})),rs=o.styled("div")(()=>({flexGrow:1,flexShrink:1,minWidth:0}));function ss({menuRef:e,open:n,toggleOpen:i,opacity:r,onChange:s}){const l=Z.useIntl(),a=j.useImperativeIntl(l);function p(c){const g=parseInt(c.target.value||"0"),h=Math.min(Math.max(g,0),100);s(h/100)}return t.jsxs(t.Fragment,{children:[t.jsx(o.Tooltip,{title:a.formatMessage({id:"c4r.widgets.legend.opacity"}),children:t.jsx(o.IconButton,{size:"small",color:n?"primary":"default",onClick:()=>i(!n),children:t.jsx(Te.SwatchSquare,{})})}),t.jsx(o.Popover,{open:n,onClose:()=>i(!1),anchorEl:e.current,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{root:{sx:{transform:"translate(-12px, 36px)"}}},children:t.jsxs(Qr,{children:[t.jsx(o.Slider,{value:r*100,onChange:(c,g)=>s(g/100),min:0,max:100,step:1}),t.jsx(es,{size:"small",type:"number",value:Math.round(r*100),onChange:p,inputProps:{step:1,min:0,max:100,style:{appearance:"textfield"},"data-testid":"opacity-slider"},InputProps:{endAdornment:t.jsxs(o.InputAdornment,{position:"end",sx:{margin:0},children:[" ","%"]})}})]})})]})}function ot({title:e,visible:n,typographyProps:i}){const r=u.useRef(null),[s,l]=u.useState(!1);u.useLayoutEffect(()=>{if(n&&r.current){const{offsetWidth:p,scrollWidth:c}=r.current;l(p<c)}},[e,n]);const a=t.jsx(j.Typography,{ref:r,color:n?"textPrimary":"textSecondary",variant:"button",weight:"medium",component:"p",noWrap:!0,my:.25,...i,children:e});return s?t.jsx(o.Tooltip,{title:e,children:a}):a}var ce=(e=>(e.CATEGORY="category",e.ICON="icon",e.CONTINUOUS_RAMP="continuous_ramp",e.BINS="bins",e.PROPORTION="proportion",e))(ce||{});const qe=20;function an({legend:e}){const{labels:n=[],colors:i=[],isStrokeColor:r=!1,customMarkers:s,maskedMarkers:l=!0}=e,a=Me.getPalette(i,n.length),p=n.length>qe,c=Z.useIntl(),g=j.useImperativeIntl(c);return t.jsxs(t.Fragment,{children:[t.jsx(ln,{"data-testid":"categories-legend",children:n.slice(0,qe).map((h,d)=>t.jsx(ds,{label:String(h),color:a[d%a.length],icon:s&&Array.isArray(s)?s[d]:s,maskedIcon:l,isStrokeColor:r},`${h}${d}`))}),p&&t.jsx(j.Typography,{variant:"caption",color:"textSecondary",component:"div",py:2,children:g.formatMessage({id:"c4r.widgets.legend.maxCategories"},{n:qe})})]})}const ls=({isMax:e,color:n,isStrokeColor:i,theme:r})=>({border:"2px solid transparent","&::after":{position:"absolute",display:e?"block":"none",content:'""',width:r.spacing(2),height:r.spacing(2),border:`2px solid ${r.palette.grey[900]}`,transform:"translate(-30%, -30%)",borderRadius:"50%",boxSizing:"content-box"},...i?{borderColor:n}:{backgroundColor:n}}),as=({icon:e,color:n,maskedIcon:i})=>({maskRepeat:"no-repeat",maskSize:"cover",backgroundRepeat:"no-repeat",backgroundSize:"cover",...i?{backgroundColor:n,maskImage:`url(${e})`,WebkitMaskImage:`url(${e})`}:{backgroundColor:"rgba(0,0,0,0)",backgroundImage:`url(${e})`}}),cs=o.styled(o.Box,{shouldForwardProp:e=>e!=="icon"&&e!=="maskedIcon"&&e!=="color"&&e!=="isStrokeColor"})(({icon:e,maskedIcon:n,color:i,isStrokeColor:r,theme:s})=>({whiteSpace:"nowrap",display:"block",width:s.spacing(1.5),height:s.spacing(1.5),flexShrink:"0",borderRadius:"50%",position:"relative",border:"2px solid transparent",...e?as({icon:e,color:i,maskedIcon:n}):ls({color:i,isStrokeColor:r,theme:s})}));function ds({label:e,isStrokeColor:n,color:i="#000",icon:r,maskedIcon:s}){return t.jsxs(o.Box,{component:"li",sx:{display:"flex",alignItems:"center"},children:[t.jsx(cs,{className:"marker",mr:1.5,component:"span",icon:r,maskedIcon:s,isStrokeColor:n,color:i}),t.jsx(ot,{title:e,visible:!0,typographyProps:{variant:"overline",my:.75}})]})}const Ne=6,We={0:12,1:9,2:6,3:3},us=o.styled(o.Box,{shouldForwardProp:e=>e!=="index"})(({index:e=0,theme:n})=>{const i=n.spacing(We[e]),r=n.spacing(We[e]);return{border:`solid 1px ${n.palette.divider}`,backgroundColor:n.palette.background.default,borderRadius:"50%",position:"absolute",right:0,bottom:0,width:i,height:r}}),ps=o.styled(o.Box)(({theme:{spacing:e}})=>({display:"flex",justifyContent:"flex-end",flexShrink:0,position:"relative",width:e(We[0]),height:e(We[0])})),gs=o.styled(o.Box)(({theme:{spacing:e}})=>({display:"flex",gap:e(1),alignItems:"stretch",justifyContent:"stretch",padding:e(2,0)})),hs=o.styled(o.Box)(()=>({display:"flex",flexDirection:"column",justifyContent:"space-around",gap:1,flexGrow:1,flexShrink:1}));function cn({legend:e}){const n=Z.useIntl(),i=j.useImperativeIntl(n),r=e.showMinMax??!0,{min:s,max:l,error:a}=fs(e),[p,c]=a?[0,0]:xs(s,l);return t.jsxs(gs,{"data-testid":"proportion-legend",children:[t.jsx(ps,{children:[...Array(4)].map((g,h)=>t.jsx(us,{index:h,component:"span"},h))}),t.jsx(hs,{children:a?t.jsx(o.Box,{maxWidth:240,children:t.jsx(j.Typography,{variant:"overline",children:"You need to specify valid numbers for the labels property"})}):t.jsxs(t.Fragment,{children:[t.jsxs(j.Typography,{variant:"overline",color:"textSecondary",children:[r&&i.formatMessage({id:"c4r.widgets.legend.max"})+": ",n.formatNumber(l,{maximumSignificantDigits:Ne})]}),t.jsx(j.Typography,{variant:"overline",color:"textSecondary",children:n.formatNumber(c,{maximumSignificantDigits:Ne})}),t.jsx(j.Typography,{variant:"overline",color:"textSecondary",children:n.formatNumber(p,{maximumSignificantDigits:Ne})}),t.jsxs(j.Typography,{variant:"overline",color:"textSecondary",children:[r&&i.formatMessage({id:"c4r.widgets.legend.min"})+": ",n.formatNumber(s,{maximumSignificantDigits:Ne})]})]})})]})}function dn({labels:e}){let n=e==null?void 0:e[e.length-1],i=e==null?void 0:e[0];return Number.isFinite(i)||(i=parseInt(String(i),10)),Number.isFinite(n)||(n=parseInt(String(n),10)),[i,n]}function fs(e){let n=!1;const[i,r]=dn(e);return(Number.isNaN(i)||Number.isNaN(r))&&(n=!0),{min:i,max:r,error:n}}function xs(e,n){const i=(n-e)/3;return[e+i,n-i]}function un({legend:e}){const{labels:n=[],icons:i=[]}=e;return t.jsx(ln,{"data-testid":"icon-legend",children:n.map((r,s)=>t.jsxs(ns,{children:[t.jsx(os,{children:t.jsx("img",{src:i[s],alt:r,width:"auto",height:j.ICON_SIZE_MEDIUM})}),t.jsx(ot,{visible:!0,title:r,typographyProps:{variant:"overline",my:.75}})]},r))})}function ms(e){return typeof e[0]=="object"&&"label"in e[0]}function Qe({isContinuous:e=!1,legend:n}){const{labels:i=[],colors:r=[],showMinMax:s=!0}=n,l=Me.getPalette(r,!i.length||e?2:i.length+1),a=ms(i),p=a?i.map(({value:m})=>m):i,c=a?i.map(({label:m})=>m):i,[g,h]=dn({labels:p}),d=Number.isNaN(g)||Number.isNaN(h);let y=c[c.length-1],f=c[0];return!e&&s&&(f="< "+f,y="≥ "+y),t.jsx(o.Box,{py:2,"data-testid":"ramp-legend",children:d?t.jsx(o.Box,{maxWidth:240,children:t.jsx(j.Typography,{variant:"overline",children:"You need to specify valid numbers for the labels property"})}):t.jsxs(t.Fragment,{children:[t.jsx(o.Box,{display:"flex",pb:1,children:e?t.jsx(ys,{"data-testid":"step-continuous",palette:l}):t.jsx(js,{palette:l,labels:c,max:y,min:f})}),t.jsxs(o.Box,{display:"flex",justifyContent:"space-between",children:[t.jsx(j.Typography,{variant:"overlineDelicate",color:"textSecondary",children:f}),t.jsx(j.Typography,{variant:"overlineDelicate",color:"textSecondary",children:y})]})]})})}const ys=o.styled(o.Box,{shouldForwardProp:e=>e!=="palette"})(({palette:e,theme:n})=>({display:"block",flexGrow:1,height:n.spacing(1),borderRadius:n.spacing(.5),background:`linear-gradient(to right, ${e.join()})`})),vs=o.styled(o.Box,{shouldForwardProp:e=>e!=="color"})(({color:e,theme:n})=>({display:"block",flexGrow:1,height:n.spacing(1),backgroundColor:e,"&:first-of-type":{borderRadius:n.spacing(.5,0,0,.5)},"&:last-of-type":{borderRadius:n.spacing(0,.5,.5,0)}}));function js({labels:e=[],palette:n=[],max:i,min:r}){const s=e.length?[r,...e]:[r,i];return t.jsx(t.Fragment,{children:s.map((l,a)=>{const p=a===0?r:a===s.length-1?i:`${l} - ${s[a+1]}`;return t.jsx(o.Tooltip,{title:p,children:t.jsx(vs,{"data-testid":"step-discontinuous",color:n[a]})},a)})})}const ws={[ce.CATEGORY]:an,[ce.PROPORTION]:cn,[ce.ICON]:un,[ce.BINS]:e=>t.jsx(Qe,{...e,isContinuous:!1}),[ce.CONTINUOUS_RAMP]:e=>t.jsx(Qe,{...e,isContinuous:!0})};function bs({legend:e}){const n=Z.useIntl(),i=j.useImperativeIntl(n);return e.select||!e.type?null:t.jsxs(j.Typography,{variant:"body2",color:"textSecondary",component:"p",children:[e.type," ",i.formatMessage({id:"c4r.widgets.legend.notSupported"}),"."]})}function Ss(e){return e.type===ce.PROPORTION?"c4r.widgets.legend.subtitles.proportion":e.type===ce.ICON||e.customMarkers?"c4r.widgets.legend.subtitles.icon":e.isStrokeColor?"c4r.widgets.legend.subtitles.strokeColor":"c4r.widgets.legend.subtitles.color"}function ks({layer:e,legend:n,customLegendTypes:i,onChangeSelection:r}){var h;const s=Z.useIntl(),l=j.useImperativeIntl(s),a=n.type,c=ws[a]??i[a]??bs,g=((h=n.select)==null?void 0:h.options)??[];return t.jsxs(o.Box,{component:"li","data-testid":"legend-layer-variable",px:2,children:[n.attr?t.jsxs(o.Box,{pb:1,children:[t.jsx(j.Typography,{gutterBottom:!0,variant:"overlineDelicate",color:"textSecondary",component:"p",children:l.formatMessage({id:Ss(n)})}),t.jsx(j.Typography,{variant:"caption",component:"p",children:n.attr})]}):null,n.select?t.jsxs(o.Box,{pb:1,children:[t.jsx(j.Typography,{variant:"caption",weight:"medium",component:"p",children:n.select.label}),t.jsx(o.Select,{"data-testid":"legend-layer-variable-select",name:"legend-select",value:n.select.value,renderValue:d=>{var y;return((y=g.find(f=>f.value===d))==null?void 0:y.label)??d},onChange:d=>r(d.target.value),MenuProps:{transformOrigin:{vertical:"bottom",horizontal:"left"},anchorOrigin:{vertical:"top",horizontal:"left"},PaperProps:{style:{maxHeight:240}}},children:g.map(d=>t.jsx(o.MenuItem,{value:d.value,children:t.jsx(o.ListItemText,{primary:d.label})},d.value))})]}):null,t.jsx(c,{layer:e,legend:n})]})}const Is={};function pn(e){return e?Array.isArray(e)?e.every(n=>pn(n)):!e.select&&!e.type:!0}function Mt({customLegendTypes:e=Is,layer:n,onChangeCollapsed:i,onChangeOpacity:r,onChangeVisibility:s,onChangeSelection:l,maxZoom:a=21,minZoom:p=0,currentZoom:c=0}){const g=Z.useIntl(),h=j.useImperativeIntl(g),d=u.useRef(null),[y,f]=u.useState(!1),m=n.id,v=n.title,x=n.visible??!0,b=n.switchable??!0,S=n.collapsed??!1,k=(n.collapsible??!0)&&!pn(n.legend),T=n.opacity??1,w=n.showOpacityControl??!0,C=x&&!S,M=C?t.jsx(ee.ExpandLess,{}):t.jsx(ee.ExpandMore,{}),D=(n==null?void 0:n.minZoom)!==void 0||(n==null?void 0:n.maxZoom)!==void 0,E=n.minZoom??p,L=n.maxZoom??a,P=D&&(E>p||L<a),N=c<E||c>L,V=Ts({intl:h,minZoom:p,maxZoom:a,layerMinZoom:E,layerMaxZoom:L}),_=n.helperText??(P?V:""),A=u.useMemo(()=>n.legend?Array.isArray(n.legend)?n.legend:[n.legend]:[],[n.legend]);return n.legend?t.jsxs(is,{"data-testid":"legend-layer","aria-label":v,children:[t.jsxs(Jr,{ref:d,children:[k&&t.jsx(o.IconButton,{size:"small","aria-label":h.formatMessage({id:S?"c4r.widgets.legend.expand":"c4r.widgets.legend.collapse"}),disabled:!x,onClick:()=>i({id:m,collapsed:!S}),children:M}),t.jsxs(rs,{children:[t.jsx(ot,{visible:x,title:v??""}),P&&t.jsx(o.Tooltip,{title:h.formatMessage({id:"c4r.widgets.legend.zoomLevelTooltip"}),children:t.jsxs(j.Typography,{color:x?"textPrimary":"textSecondary",variant:"caption",component:"p",children:[h.formatMessage({id:"c4r.widgets.legend.zoomLevel"})," ",n.minZoom," - ",n.maxZoom]})})]}),w&&x&&!S&&t.jsx(ss,{menuRef:d,open:y,toggleOpen:f,opacity:T,onChange:$=>r({id:m,opacity:$})}),b&&t.jsx(o.Tooltip,{title:h.formatMessage({id:x?"c4r.widgets.legend.hideLayer":"c4r.widgets.legend.showLayer"}),children:t.jsx(o.IconButton,{size:"small",onClick:()=>s({id:m,collapsed:x?S:!1,visible:!x}),children:x?t.jsx(ee.VisibilityOutlined,{}):t.jsx(ee.VisibilityOffOutlined,{})})})]}),t.jsxs(o.Collapse,{unmountOnExit:!0,timeout:100,in:C,children:[t.jsx(ts,{"data-testid":"legend-layer-variable-list",opacity:N?.5:1,children:A.map(($,I)=>t.jsx(ks,{legend:$,layer:n,customLegendTypes:e,onChangeSelection:O=>l({id:m,index:I,selection:O})},`${$.type}-${I}`))}),_&&t.jsx(j.Typography,{variant:"caption",color:"textSecondary",component:"div",p:2,children:t.jsx("div",{dangerouslySetInnerHTML:{__html:_}})})]})]}):null}function Ts({intl:e,minZoom:n,maxZoom:i,layerMinZoom:r,layerMaxZoom:s}){const l=e.formatMessage({id:"c4r.widgets.legend.and"}),a=e.formatMessage({id:"c4r.widgets.legend.lowerThan"}),p=e.formatMessage({id:"c4r.widgets.legend.greaterThan"}),c=e.formatMessage({id:"c4r.widgets.legend.zoomNote"}),g=s<i?`${a} ${s}`:"",h=r>n?`${p} ${r}`:"",d=[g,h].filter(Boolean).join(` ${l} `);return d?`${c} ${d}`:""}const Ms={},Ie=()=>{},Cs=[];function As({customLegendTypes:e=Ms,layers:n=Cs,collapsed:i=!1,onChangeCollapsed:r=Ie,onChangeVisibility:s=Ie,onChangeOpacity:l=Ie,onChangeLegendRowCollapsed:a=Ie,onChangeSelection:p=Ie,title:c="Layers",maxZoom:g=20,minZoom:h=0,currentZoom:d,isMobile:y,sx:f}){const m=Z.useIntl(),v=j.useImperativeIntl(m),x=t.jsxs(Zr,{collapsed:i,children:[t.jsx(j.Typography,{variant:"caption",flexGrow:1,children:c}),t.jsx(o.Tooltip,{title:v.formatMessage({id:"c4r.widgets.legend.close"}),children:t.jsx(o.IconButton,{size:"small",onClick:()=>r(!0),children:t.jsx(ee.Close,{})})})]}),b=t.jsx(o.Tooltip,{title:v.formatMessage({id:"c4r.widgets.legend.open"}),children:t.jsx(o.IconButton,{"aria-label":c,onClick:()=>r(!1),children:t.jsx(ee.LayersOutlined,{})})});return t.jsx(Xr,{sx:f,elevation:3,collapsed:i||!!y,children:y?t.jsxs(t.Fragment,{children:[b,t.jsxs(o.Drawer,{anchor:"bottom",open:!i,onClose:()=>r(!0),children:[x,t.jsx(Tt,{children:n.map(S=>t.jsx(Mt,{layer:S,onChangeCollapsed:a,onChangeOpacity:l,onChangeVisibility:s,onChangeSelection:p,maxZoom:g,minZoom:h,currentZoom:d,customLegendTypes:e},S.id))})]})]}):t.jsxs(t.Fragment,{children:[i?b:x,t.jsx(Tt,{width:i?0:void 0,children:t.jsx(o.Collapse,{unmountOnExit:!0,in:!i,timeout:500,children:n.map(S=>t.jsx(Mt,{layer:S,onChangeCollapsed:a,onChangeOpacity:l,onChangeVisibility:s,onChangeSelection:p,maxZoom:g,minZoom:h,currentZoom:d,customLegendTypes:e},S.id))})})]})})}function Ct({color:e=void 0,children:n}){return n?t.jsx(o.Box,{mt:.5,children:t.jsx(j.Typography,{component:"div",variant:"caption",color:e??"inherit",style:{fontWeight:"normal"},children:n})}):t.jsx(o.Box,{mt:-1})}function Es({title:e="No data available",body:n="There are no results for the combination of filters applied to your data. Try tweaking your filters, or zoom and pan the map to adjust the Map View.",severity:i=void 0,...r}){return i?t.jsx(bn.Alert,{title:e,severity:i,...r,children:t.jsx(Ct,{children:n})}):t.jsxs(o.Box,{...r,children:[e&&t.jsx(j.Typography,{variant:"body2",children:e}),t.jsx(Ct,{color:"textSecondary",children:n})]})}const Bs=o.styled(o.Box,{shouldForwardProp:e=>e!=="margin"})(({theme:e,margin:n})=>({margin:0,position:"relative",maxWidth:"100%",padding:n??e.spacing(2,2.5)})),Ps=o.styled(o.LinearProgress)(({theme:e})=>({position:"absolute",top:0,left:0,width:"100%",height:e.spacing(.25)})),Ls=o.styled(o.Grid,{shouldForwardProp:e=>e!=="expanded"})(({theme:e,expanded:n=!0})=>({display:"flex",flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",width:"100%",...n?{minHeight:e.spacing(3)}:{height:e.spacing(3)},padding:0})),Ds=o.styled(o.Button,{shouldForwardProp:e=>e!=="expandable"})(({theme:e,expandable:n=!0})=>({flex:1,padding:0,alignItems:"flex-start",justifyContent:"flex-start",height:"auto",minHeight:"auto",marginBottom:e.spacing(1),cursor:n?"pointer":"default","& .MuiButton-startIcon":{marginTop:"3px",marginRight:e.spacing(1)},"&:hover":{background:"none"}})),gn=({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",width:e.spacing(3),height:e.spacing(3),color:e.palette.text.secondary}),Ns=o.styled(ee.ExpandLess)(({theme:e})=>gn({theme:e})),Os=o.styled(ee.ExpandMore)(({theme:e})=>gn({theme:e})),$s=o.styled(o.Typography,{shouldForwardProp:e=>e!=="expanded"})(({expanded:e=!0})=>({wordBreak:"break-word",overflow:"hidden",...e&&{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},...!e&&{whiteSpace:"nowrap",textOverflow:"ellipsis"}})),Rs=o.styled(o.Grid)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),marginRight:e.spacing(-.5),marginLeft:e.spacing(1)})),At=o.styled(o.IconButton)(({theme:e})=>({color:e.palette.text.secondary})),Fs=o.styled(o.Menu)(({theme:e})=>({".MuiPaper-root":{marginTop:e.spacing(5),maxHeight:e.spacing(21),minWidth:e.spacing(16)}})),Et=[],Ws=t.jsx(ee.MoreVert,{});function _s({title:e,actions:n=Et,options:i=Et,optionsIcon:r=Ws,children:s,contentProps:l,disabled:a=!1,expandable:p=!0,expanded:c=!0,onExpandedChange:g,footer:h,headerItems:d,isLoading:y=!1,margin:f}){const m=u.createRef(),[v,x]=u.useState(!0),b=c!==void 0&&g!==void 0,S=p!==!1?b?c:v:!0,k=b?g:x,[T,w]=u.useState(null),C=!!T,M=()=>{p&&k(!S)},D=N=>w(N.currentTarget),E=()=>w(null);function L(N){N&&N(),E()}const P=N=>t.jsx(At,{"aria-label":N.label,onClick:N.action,size:"small",children:N.icon},N.id);return a?s?t.jsx(t.Fragment,{children:s}):null:t.jsxs(Bs,{margin:f,component:"section","aria-label":e,children:[y?t.jsx(Ps,{}):null,t.jsxs(Ls,{container:!0,expanded:c,children:[t.jsx(Ds,{expandable:p,startIcon:p&&t.jsx(o.Icon,{children:S?t.jsx(Ns,{}):t.jsx(Os,{})}),onClick:M,tabIndex:p?0:-1,children:t.jsx(o.Tooltip,{title:e,children:t.jsx($s,{expanded:c,align:"left",variant:"subtitle1",children:e})})}),t.jsxs(Rs,{item:!0,children:[d,n.length>0&&n.map(N=>N.tooltip?t.jsx(o.Tooltip,{title:N.tooltip.text,placement:N.tooltip.placement??"top",children:P(N)},N.id):P(N)),i.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(At,{"aria-label":"options","aria-controls":"options-menu","aria-haspopup":"true",onClick:D,size:"small",children:r}),t.jsx(Fs,{id:"options-menu",elevation:8,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:T,keepMounted:!0,open:C,onClose:E,children:i.map(N=>t.jsx(o.MenuItem,{selected:N.selected,onClick:()=>L(N.action),children:N.name},N.id))})]})]})]}),t.jsx(o.Collapse,{ref:m,in:S,timeout:"auto",unmountOnExit:!0,children:t.jsxs(o.Box,{...l,children:[t.jsx(o.Box,{pt:1,children:s}),h??t.jsx(o.Box,{children:h})]})})]})}exports.BarWidgetUI=Dn;exports.CategoryWidgetUI=Vn;exports.ComparativeCategoryWidgetUI=Sr;exports.ComparativeFormulaWidgetUI=Pr;exports.ComparativePieWidgetUI=Fr;exports.FeatureSelectionUIDropdown=on;exports.FeatureSelectionUIGeometryChips=rn;exports.FeatureSelectionUIToggleButton=nn;exports.FeatureSelectionWidgetUI=Kr;exports.FormulaWidgetUI=Xn;exports.GroupDateTypes=ae;exports.HistogramWidgetUI=ro;exports.LEGEND_TYPES=ce;exports.LegendCategories=an;exports.LegendIcon=un;exports.LegendProportion=cn;exports.LegendRamp=Qe;exports.LegendWidgetUI=As;exports.NoDataAlert=Es;exports.PieWidgetUI=Do;exports.RangeWidgetUI=Ho;exports.ScatterPlotWidgetUI=Qo;exports.TIME_SERIES_CHART_TYPES=Ge;exports.TableWidgetUI=di;exports.TimeSeriesProvider=Yt;exports.TimeSeriesWidgetUI=tr;exports.WrapperWidgetUI=_s;exports.useTimeSeriesContext=ze;exports.useTimeSeriesInteractivity=Vt;
|
|
33
|
+
{b|${E}}`,position:"center",rich:{b:{fontFamily:d.typography.overline.fontFamily,fontSize:j.SPACING*1.75,lineHeight:j.SPACING*1.75,fontWeight:400,color:d.palette.text.primary},per:{...d.typography.overline,fontSize:j.SPACING*3,lineHeight:j.SPACING*4.5,fontWeight:600,color:d.palette.text.primary}}},M=f.map((E,L)=>{var P;return{type:"pie",name:e[L],itemStyle:{color:(P=E[0])==null?void 0:P.color},animation:l,data:E.map(N=>({...N,itemStyle:{color:N.color}})),radius:L===0?["75%","90%"]:["56%","72%"],selectedOffset:0,hoverOffset:5,bottom:j.SPACING*2.5,avoidLabelOverlap:!0,label:{show:!1,...C},emphasis:{label:{show:!0,formatter:C.formatter,rich:C.rich}}}});return{grid:{left:0,top:0,right:0,bottom:0},tooltip:k,legend:w,series:M}},[d,e,l,f,a,p]),v={mouseover:(b,S)=>{f.length===1&&(b.seriesIndex!==0||b.dataIndex!==0)&&S.dispatchAction({type:"downplay",seriesIndex:0,dataIndex:0})},mouseout:(b,S)=>{f.length===1&&S.dispatchAction({type:"highlight",seriesIndex:0,dataIndex:0})},click:b=>{const k=f[b.seriesIndex][b.dataIndex].key,T=c.includes(k),w=new Set(c);T?w.delete(k):w.add(k);const C=f[0].length;let M=Array.from(w);M.length===C&&(M=[]),g(M)}};u.useEffect(()=>{y.current&&y.current.dispatchAction({type:f.length===1?"highlight":"downplay",seriesIndex:0,dataIndex:0})},[f]);function x(b){y.current=b}return f.length?h?t.jsx(Ft,{height:s}):t.jsx(ye,{onChartReady:x,notMerge:!0,option:m,onEvents:v,style:{maxHeight:s,width:"100%"}}):null}const Wr=()=>{};function nn({icon:e,hoverTooltip:n,clickTooltip:i,enabled:r,onEnabledChange:s=Wr,tooltipPlacement:l="bottom"}){const[a,p]=u.useState(!1),[c,g]=u.useState(r);u.useEffect(()=>{g(r)},[r]),u.useEffect(()=>{if(r){const d=y=>{y.key==="Escape"&&s&&s(!1)};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d)}}},[r,s]);const h=c?i:n;return t.jsx(o.ClickAwayListener,{onClickAway:()=>g(!1),children:t.jsx(o.Tooltip,{title:h,placement:l,open:a,onOpen:()=>p(!0),onClose:()=>{c||p(!1)},children:t.jsx(o.ToggleButton,{value:"selectedMode",selected:r,onClick:()=>s&&s(!r),children:e})})})}const _r=o.styled(o.IconButton,{shouldForwardProp:e=>e!=="isOpen"})(({isOpen:e,theme:n})=>({color:n.palette.text.secondary,width:n.spacing(3),transform:`rotate(${e?"180":"0"}deg)`,backgroundColor:e?n.palette.action.hover:void 0})),Gr=o.styled(o.MenuItem,{shouldForwardProp:e=>e!=="disabled"})(({disabled:e,theme:n})=>({...e&&{pointerEvents:"none",color:n.palette.text.disabled}})),zr=o.styled(o.MenuItem)(()=>({"&.Mui-disabled":{opacity:1}})),Hr=()=>{};function on({selectionModes:e,editModes:n,selectedMode:i,onSelectMode:r=Hr,enabled:s,tooltipPlacement:l="bottom",tooltipText:a="",menuHeaderText:p="",editDisabled:c}){const g=o.useTheme(),[h,d]=u.useState(null),y=!!h,f=k=>d(k.currentTarget),m=()=>d(null),v=k=>{r&&r(k),m()},x=!!e.length&&!!n.length,b=k=>n.some(T=>T.id===k.id);function S(k){return t.jsx(Gr,{selected:s&&i===k.id,onClick:()=>v(k.id),disabled:c&&b(k),children:t.jsxs(o.Box,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[k.icon,t.jsx(o.Box,{ml:2,children:t.jsx(j.Typography,{variant:"body2",color:"inherit",children:o.capitalize(k.label)})})]})},k.id)}return t.jsxs(t.Fragment,{children:[t.jsx(o.Tooltip,{title:a,placement:l,children:t.jsx(_r,{id:"feature-selection-menu-button","aria-controls":"feature-selection-menu","aria-haspopup":"true","aria-expanded":y?"true":void 0,onClick:f,isOpen:y,children:t.jsx(ee.KeyboardArrowDown,{})})}),t.jsxs(o.Menu,{id:"feature-selection-menu",style:{zIndex:g.zIndex.tooltip+1},anchorEl:h,open:y,onClose:m,MenuListProps:{"aria-labelledby":"feature-selection-menu-button"},children:[p&&t.jsx(zr,{disabled:!0,children:t.jsx(j.Typography,{variant:"caption",color:"textSecondary",children:p})}),!!e.length&&e.map(S),x&&t.jsx(o.Divider,{sx:{margin:({spacing:k})=>k(1,0)}}),!!n.length&&n.map(S)]})]})}const Yr=o.styled(o.List)(({theme:e})=>({display:"flex",alignItems:"center",marginLeft:e.spacing(1.5),padding:e.spacing(.5),overflowX:"auto",maxWidth:"100%",scrollbarWidth:"none",msOverflowStyle:"none","&::-webkit-scrollbar":{display:"none"}})),Vr=()=>{};function rn({features:e,onSelectGeometry:n=Vr,onDeleteGeometry:i,chipTooltip:r,disabledChipTooltip:s,size:l="medium",tooltipPlacement:a="bottom",chipLabel:p}){const c=Z.useIntl(),g=j.useImperativeIntl(c);function h(m){return m==="MultiPoint"?g.formatMessage({id:"c4r.widgets.featureSelection.point"}):m==="MultiLineString"?g.formatMessage({id:"c4r.widgets.featureSelection.lineString"}):m==="MultiPolygon"||m==="Polygon"||m==="GeometryCollection"?g.formatMessage({id:"c4r.widgets.featureSelection.polygon"}):m}function d(m,v){var b;const x=h(m.geometry.type);return p||((b=m.properties)==null?void 0:b.name)||`${x} ${v+1}`}const[y,f]=u.useState(!1);return t.jsx(o.Box,{sx:{overflowX:"auto"},children:t.jsx(Yr,{sx:{gap:l==="small"?.5:1},children:e.map((m,v)=>{var T,w;const x=(T=m.properties)==null?void 0:T.disabled,b=(w=m.properties)==null?void 0:w.invalid;let S=r;x&&(S=s||r),b&&(S=g.formatMessage({id:"c4r.widgets.featureSelection.invalid"})),y&&(S=g.formatMessage({id:"c4r.widgets.featureSelection.remove"}));let k="secondary";return x&&(k="default"),b&&(k="error"),t.jsx(o.ListItem,{disablePadding:!0,children:t.jsx(o.Tooltip,{disableHoverListener:x?!s:!r,title:S,placement:a,children:t.jsx(o.Chip,{size:l,label:d(m,v),color:k,onClick:()=>n(m),onDelete:i?()=>i(m):void 0,icon:b?t.jsx(ee.ErrorOutline,{color:"error"}):void 0,deleteIcon:t.jsx(ee.Cancel,{onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1)})})})},v)})})})}const Ur=o.styled(o.Paper)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",maxHeight:e.spacing(5),padding:e.spacing(.5)})),qr=[];function Kr({selectionModes:e,editModes:n=qr,selectedMode:i,onSelectMode:r,enabled:s=!1,onEnabledChange:l,geometry:a,onSelectGeometry:p,onDeleteGeometry:c,tooltipPlacement:g="bottom",size:h="medium",chipLabel:d}){const y=Z.useIntl(),f=j.useImperativeIntl(y),m=u.useMemo(()=>e.map(T=>({...T,label:f.formatMessage({id:`c4r.widgets.featureSelection.${It(T.id)}`})})),[e,f]),v=u.useMemo(()=>n.map(T=>({...T,label:f.formatMessage({id:`c4r.widgets.featureSelection.${It(T.id)}`})})),[n,f]),x=u.useMemo(()=>{const w=[...m.map(C=>({...C,isEdit:!1})),...v.map(C=>({...C,isEdit:!0}))].find(C=>C.id===i);if(!w)throw new Error(`Selected mode "${i}" not supported`);return w},[v,m,i]),b=o.capitalize((x==null?void 0:x.label)||""),S=x!=null&&x.isEdit?b:f.formatMessage({id:"c4r.widgets.featureSelection.selectTool"},{label:b}),k=x!=null&&x.isEdit?f.formatMessage({id:"c4r.widgets.featureSelection.clickToEdit"}):f.formatMessage({id:"c4r.widgets.featureSelection.clickToCreate"});return t.jsxs(Ur,{children:[t.jsx(nn,{icon:x==null?void 0:x.icon,hoverTooltip:S,clickTooltip:k,enabled:s,onEnabledChange:l,tooltipPlacement:g}),t.jsx(on,{selectionModes:m,editModes:v,selectedMode:i,onSelectMode:r,enabled:s,tooltipPlacement:g,tooltipText:f.formatMessage({id:"c4r.widgets.featureSelection.selectMode"}),menuHeaderText:f.formatMessage({id:"c4r.widgets.featureSelection.chooseSelectionMode"}),editDisabled:!a}),!!a&&t.jsx(rn,{features:[a],onSelectGeometry:p,onDeleteGeometry:c,disabledChipTooltip:f.formatMessage({id:"c4r.widgets.featureSelection.applyMask"}),chipTooltip:f.formatMessage({id:"c4r.widgets.featureSelection.clearMask"}),tooltipPlacement:g,size:h,chipLabel:d})]})}function It(e){return e.charAt(0).toLowerCase()+e.slice(1)}const sn=240,Xr=o.styled(o.Paper,{shouldForwardProp:e=>e!=="collapsed"})(({theme:e,collapsed:n})=>({width:n?"min-content":sn,background:e.palette.background.paper,maxHeight:"calc(100% - 120px)",display:"flex",flexDirection:"column"})),Zr=o.styled("header",{shouldForwardProp:e=>e!=="collapsed"})(({theme:e,collapsed:n})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:e.spacing(1),paddingLeft:e.spacing(2),borderBottom:n?void 0:`1px solid ${e.palette.divider}`})),Jr=o.styled("header")(({theme:e})=>({padding:e.spacing(1.5),paddingRight:e.spacing(2),gap:e.spacing(.5),display:"flex",justifyContent:"space-between",position:"sticky",zIndex:2,top:0,background:e.palette.background.paper})),Qr=o.styled("div")(({theme:e})=>({display:"flex",gap:e.spacing(2),alignItems:"center",padding:e.spacing(1),minWidth:`calc(${sn}px - ${e.spacing(4)})`})),es=o.styled(o.TextField)(({theme:e})=>({display:"flex",width:e.spacing(7.5),flexShrink:0,"input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:0}})),ts=o.styled("ul",{shouldForwardProp:e=>e!=="opacity"})(({theme:e,opacity:n})=>({opacity:n,margin:0,padding:0,display:"flex",flexDirection:"column",gap:e.spacing(1)})),ln=o.styled("ul")(({theme:e})=>({margin:0,padding:0,paddingBottom:e.spacing(1),display:"flex",flexDirection:"column"})),ns=o.styled("li")(()=>({display:"flex",alignItems:"center"})),os=o.styled("div")(({theme:e})=>({marginRight:e.spacing(1.5),width:j.ICON_SIZE_MEDIUM,height:j.ICON_SIZE_MEDIUM,"& img":{margin:"auto",display:"block"}})),Tt=o.styled(o.Box,{shouldForwardProp:e=>e!=="width"})(({width:e,theme:n})=>({width:e,overflow:"auto",maxHeight:`calc(100% - ${n.spacing(1.5)})`})),is=o.styled("section")(({theme:e})=>({"&:not(:first-of-type)":{borderTop:`1px solid ${e.palette.divider}`}})),rs=o.styled("div")(()=>({flexGrow:1,flexShrink:1,minWidth:0}));function ss({menuRef:e,open:n,toggleOpen:i,opacity:r,onChange:s}){const l=Z.useIntl(),a=j.useImperativeIntl(l);function p(c){const g=parseInt(c.target.value||"0"),h=Math.min(Math.max(g,0),100);s(h/100)}return t.jsxs(t.Fragment,{children:[t.jsx(o.Tooltip,{title:a.formatMessage({id:"c4r.widgets.legend.opacity"}),children:t.jsx(o.IconButton,{size:"small",color:n?"primary":"default",onClick:()=>i(!n),children:t.jsx(Te.SwatchSquare,{})})}),t.jsx(o.Popover,{open:n,onClose:()=>i(!1),anchorEl:e.current,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{root:{sx:{transform:"translate(-12px, 36px)"}}},children:t.jsxs(Qr,{children:[t.jsx(o.Slider,{value:r*100,onChange:(c,g)=>s(g/100),min:0,max:100,step:1}),t.jsx(es,{size:"small",type:"number",value:Math.round(r*100),onChange:p,inputProps:{step:1,min:0,max:100,style:{appearance:"textfield"},"data-testid":"opacity-slider"},InputProps:{endAdornment:t.jsxs(o.InputAdornment,{position:"end",sx:{margin:0},children:[" ","%"]})}})]})})]})}function ot({title:e,visible:n,typographyProps:i}){const r=u.useRef(null),[s,l]=u.useState(!1);u.useLayoutEffect(()=>{if(n&&r.current){const{offsetWidth:p,scrollWidth:c}=r.current;l(p<c)}},[e,n]);const a=t.jsx(j.Typography,{ref:r,color:n?"textPrimary":"textSecondary",weight:"medium",component:"p",noWrap:!0,my:.25,textTransform:"none",...i,children:e});return s?t.jsx(o.Tooltip,{title:e,children:a}):a}var ce=(e=>(e.CATEGORY="category",e.ICON="icon",e.CONTINUOUS_RAMP="continuous_ramp",e.BINS="bins",e.PROPORTION="proportion",e))(ce||{});const qe=20;function an({legend:e}){const{labels:n=[],colors:i=[],isStrokeColor:r=!1,customMarkers:s,maskedMarkers:l=!0}=e,a=Me.getPalette(i,n.length),p=n.length>qe,c=Z.useIntl(),g=j.useImperativeIntl(c);return t.jsxs(t.Fragment,{children:[t.jsx(ln,{"data-testid":"categories-legend",children:n.slice(0,qe).map((h,d)=>t.jsx(ds,{label:String(h),color:a[d%a.length],icon:s&&Array.isArray(s)?s[d]:s,maskedIcon:l,isStrokeColor:r},`${h}${d}`))}),p&&t.jsx(j.Typography,{variant:"caption",color:"textSecondary",component:"div",py:2,children:g.formatMessage({id:"c4r.widgets.legend.maxCategories"},{n:qe})})]})}const ls=({isMax:e,color:n,isStrokeColor:i,theme:r})=>({border:"2px solid transparent","&::after":{position:"absolute",display:e?"block":"none",content:'""',width:r.spacing(2),height:r.spacing(2),border:`2px solid ${r.palette.grey[900]}`,transform:"translate(-30%, -30%)",borderRadius:"50%",boxSizing:"content-box"},...i?{borderColor:n}:{backgroundColor:n}}),as=({icon:e,color:n,maskedIcon:i})=>({maskRepeat:"no-repeat",maskSize:"cover",backgroundRepeat:"no-repeat",backgroundSize:"cover",...i?{backgroundColor:n,maskImage:`url(${e})`,WebkitMaskImage:`url(${e})`}:{backgroundColor:"rgba(0,0,0,0)",backgroundImage:`url(${e})`}}),cs=o.styled(o.Box,{shouldForwardProp:e=>e!=="icon"&&e!=="maskedIcon"&&e!=="color"&&e!=="isStrokeColor"})(({icon:e,maskedIcon:n,color:i,isStrokeColor:r,theme:s})=>({whiteSpace:"nowrap",display:"block",width:s.spacing(1.5),height:s.spacing(1.5),flexShrink:"0",borderRadius:"50%",position:"relative",border:"2px solid transparent",...e?as({icon:e,color:i,maskedIcon:n}):ls({color:i,isStrokeColor:r,theme:s})}));function ds({label:e,isStrokeColor:n,color:i="#000",icon:r,maskedIcon:s}){return t.jsxs(o.Box,{component:"li",sx:{display:"flex",alignItems:"center"},children:[t.jsx(cs,{className:"marker",mr:1.5,component:"span",icon:r,maskedIcon:s,isStrokeColor:n,color:i}),t.jsx(ot,{title:e,visible:!0,typographyProps:{variant:"overline",my:.75}})]})}const Ne=6,We={0:12,1:9,2:6,3:3},us=o.styled(o.Box,{shouldForwardProp:e=>e!=="index"})(({index:e=0,theme:n})=>{const i=n.spacing(We[e]),r=n.spacing(We[e]);return{border:`solid 1px ${n.palette.divider}`,backgroundColor:n.palette.background.default,borderRadius:"50%",position:"absolute",right:0,bottom:0,width:i,height:r}}),ps=o.styled(o.Box)(({theme:{spacing:e}})=>({display:"flex",justifyContent:"flex-end",flexShrink:0,position:"relative",width:e(We[0]),height:e(We[0])})),gs=o.styled(o.Box)(({theme:{spacing:e}})=>({display:"flex",gap:e(1),alignItems:"stretch",justifyContent:"stretch",padding:e(2,0)})),hs=o.styled(o.Box)(()=>({display:"flex",flexDirection:"column",justifyContent:"space-around",gap:1,flexGrow:1,flexShrink:1}));function cn({legend:e}){const n=Z.useIntl(),i=j.useImperativeIntl(n),r=e.showMinMax??!0,{min:s,max:l,error:a}=fs(e),[p,c]=a?[0,0]:xs(s,l);return t.jsxs(gs,{"data-testid":"proportion-legend",children:[t.jsx(ps,{children:[...Array(4)].map((g,h)=>t.jsx(us,{index:h,component:"span"},h))}),t.jsx(hs,{children:a?t.jsx(o.Box,{maxWidth:240,children:t.jsx(j.Typography,{variant:"overline",children:"You need to specify valid numbers for the labels property"})}):t.jsxs(t.Fragment,{children:[t.jsxs(j.Typography,{variant:"overline",color:"textSecondary",children:[r&&i.formatMessage({id:"c4r.widgets.legend.max"})+": ",n.formatNumber(l,{maximumSignificantDigits:Ne})]}),t.jsx(j.Typography,{variant:"overline",color:"textSecondary",children:n.formatNumber(c,{maximumSignificantDigits:Ne})}),t.jsx(j.Typography,{variant:"overline",color:"textSecondary",children:n.formatNumber(p,{maximumSignificantDigits:Ne})}),t.jsxs(j.Typography,{variant:"overline",color:"textSecondary",children:[r&&i.formatMessage({id:"c4r.widgets.legend.min"})+": ",n.formatNumber(s,{maximumSignificantDigits:Ne})]})]})})]})}function dn({labels:e}){let n=e==null?void 0:e[e.length-1],i=e==null?void 0:e[0];return Number.isFinite(i)||(i=parseInt(String(i),10)),Number.isFinite(n)||(n=parseInt(String(n),10)),[i,n]}function fs(e){let n=!1;const[i,r]=dn(e);return(Number.isNaN(i)||Number.isNaN(r))&&(n=!0),{min:i,max:r,error:n}}function xs(e,n){const i=(n-e)/3;return[e+i,n-i]}function un({legend:e}){const{labels:n=[],icons:i=[]}=e;return t.jsx(ln,{"data-testid":"icon-legend",children:n.map((r,s)=>t.jsxs(ns,{children:[t.jsx(os,{children:t.jsx("img",{src:i[s],alt:r,width:"auto",height:j.ICON_SIZE_MEDIUM})}),t.jsx(ot,{visible:!0,title:r,typographyProps:{variant:"overline",my:.75}})]},r))})}function ms(e){return typeof e[0]=="object"&&"label"in e[0]}function Qe({isContinuous:e=!1,legend:n}){const{labels:i=[],colors:r=[],showMinMax:s=!0}=n,l=Me.getPalette(r,!i.length||e?2:i.length+1),a=ms(i),p=a?i.map(({value:m})=>m):i,c=a?i.map(({label:m})=>m):i,[g,h]=dn({labels:p}),d=Number.isNaN(g)||Number.isNaN(h);let y=c[c.length-1],f=c[0];return!e&&s&&(f="< "+f,y="≥ "+y),t.jsx(o.Box,{py:2,"data-testid":"ramp-legend",children:d?t.jsx(o.Box,{maxWidth:240,children:t.jsx(j.Typography,{variant:"overline",children:"You need to specify valid numbers for the labels property"})}):t.jsxs(t.Fragment,{children:[t.jsx(o.Box,{display:"flex",pb:1,children:e?t.jsx(ys,{"data-testid":"step-continuous",palette:l}):t.jsx(js,{palette:l,labels:c,max:y,min:f})}),t.jsxs(o.Box,{display:"flex",justifyContent:"space-between",children:[t.jsx(j.Typography,{variant:"overlineDelicate",color:"textSecondary",children:f}),t.jsx(j.Typography,{variant:"overlineDelicate",color:"textSecondary",children:y})]})]})})}const ys=o.styled(o.Box,{shouldForwardProp:e=>e!=="palette"})(({palette:e,theme:n})=>({display:"block",flexGrow:1,height:n.spacing(1),borderRadius:n.spacing(.5),background:`linear-gradient(to right, ${e.join()})`})),vs=o.styled(o.Box,{shouldForwardProp:e=>e!=="color"})(({color:e,theme:n})=>({display:"block",flexGrow:1,height:n.spacing(1),backgroundColor:e,"&:first-of-type":{borderRadius:n.spacing(.5,0,0,.5)},"&:last-of-type":{borderRadius:n.spacing(0,.5,.5,0)}}));function js({labels:e=[],palette:n=[],max:i,min:r}){const s=e.length?[r,...e]:[r,i];return t.jsx(t.Fragment,{children:s.map((l,a)=>{const p=a===0?r:a===s.length-1?i:`${l} - ${s[a+1]}`;return t.jsx(o.Tooltip,{title:p,children:t.jsx(vs,{"data-testid":"step-discontinuous",color:n[a]})},a)})})}const ws={[ce.CATEGORY]:an,[ce.PROPORTION]:cn,[ce.ICON]:un,[ce.BINS]:e=>t.jsx(Qe,{...e,isContinuous:!1}),[ce.CONTINUOUS_RAMP]:e=>t.jsx(Qe,{...e,isContinuous:!0})};function bs({legend:e}){const n=Z.useIntl(),i=j.useImperativeIntl(n);return e.select||!e.type?null:t.jsxs(j.Typography,{variant:"body2",color:"textSecondary",component:"p",children:[e.type," ",i.formatMessage({id:"c4r.widgets.legend.notSupported"}),"."]})}function Ss(e){return e.type===ce.PROPORTION?"c4r.widgets.legend.subtitles.proportion":e.type===ce.ICON||e.customMarkers?"c4r.widgets.legend.subtitles.icon":e.isStrokeColor?"c4r.widgets.legend.subtitles.strokeColor":"c4r.widgets.legend.subtitles.color"}function ks({layer:e,legend:n,customLegendTypes:i,onChangeSelection:r}){var h;const s=Z.useIntl(),l=j.useImperativeIntl(s),a=n.type,c=ws[a]??i[a]??bs,g=((h=n.select)==null?void 0:h.options)??[];return t.jsxs(o.Box,{component:"li","data-testid":"legend-layer-variable",px:2,children:[n.attr?t.jsxs(o.Box,{pb:1,children:[t.jsx(j.Typography,{gutterBottom:!0,variant:"overlineDelicate",color:"textSecondary",component:"p",children:l.formatMessage({id:Ss(n)})}),t.jsx(j.Typography,{variant:"caption",component:"p",children:n.attr})]}):null,n.select?t.jsxs(o.Box,{pb:1,children:[t.jsx(j.Typography,{variant:"caption",weight:"medium",component:"p",children:n.select.label}),t.jsx(o.Select,{"data-testid":"legend-layer-variable-select",name:"legend-select",value:n.select.value,renderValue:d=>{var y;return((y=g.find(f=>f.value===d))==null?void 0:y.label)??d},onChange:d=>r(d.target.value),MenuProps:{transformOrigin:{vertical:"bottom",horizontal:"left"},anchorOrigin:{vertical:"top",horizontal:"left"},PaperProps:{style:{maxHeight:240}}},children:g.map(d=>t.jsx(o.MenuItem,{value:d.value,children:t.jsx(o.ListItemText,{primary:d.label})},d.value))})]}):null,t.jsx(c,{layer:e,legend:n})]})}const Is={};function pn(e){return e?Array.isArray(e)?e.every(n=>pn(n)):!e.select&&!e.type:!0}function Mt({customLegendTypes:e=Is,layer:n,onChangeCollapsed:i,onChangeOpacity:r,onChangeVisibility:s,onChangeSelection:l,maxZoom:a=21,minZoom:p=0,currentZoom:c=0}){const g=Z.useIntl(),h=j.useImperativeIntl(g),d=u.useRef(null),[y,f]=u.useState(!1),m=n.id,v=n.title,x=n.visible??!0,b=n.switchable??!0,S=n.collapsed??!1,k=(n.collapsible??!0)&&!pn(n.legend),T=n.opacity??1,w=n.showOpacityControl??!0,C=x&&!S,M=C?t.jsx(ee.ExpandLess,{}):t.jsx(ee.ExpandMore,{}),D=(n==null?void 0:n.minZoom)!==void 0||(n==null?void 0:n.maxZoom)!==void 0,E=n.minZoom??p,L=n.maxZoom??a,P=D&&(E>p||L<a),N=c<E||c>L,V=Ts({intl:h,minZoom:p,maxZoom:a,layerMinZoom:E,layerMaxZoom:L}),_=n.helperText??(P?V:""),A=u.useMemo(()=>n.legend?Array.isArray(n.legend)?n.legend:[n.legend]:[],[n.legend]);return n.legend?t.jsxs(is,{"data-testid":"legend-layer","aria-label":v,children:[t.jsxs(Jr,{ref:d,children:[k&&t.jsx(o.IconButton,{size:"small","aria-label":h.formatMessage({id:S?"c4r.widgets.legend.expand":"c4r.widgets.legend.collapse"}),disabled:!x,onClick:()=>i({id:m,collapsed:!S}),children:M}),t.jsxs(rs,{children:[t.jsx(ot,{visible:x,title:v??""}),P&&t.jsx(o.Tooltip,{title:h.formatMessage({id:"c4r.widgets.legend.zoomLevelTooltip"}),children:t.jsxs(j.Typography,{color:x?"textPrimary":"textSecondary",variant:"caption",component:"p",children:[h.formatMessage({id:"c4r.widgets.legend.zoomLevel"})," ",n.minZoom," - ",n.maxZoom]})})]}),w&&x&&!S&&t.jsx(ss,{menuRef:d,open:y,toggleOpen:f,opacity:T,onChange:$=>r({id:m,opacity:$})}),b&&t.jsx(o.Tooltip,{title:h.formatMessage({id:x?"c4r.widgets.legend.hideLayer":"c4r.widgets.legend.showLayer"}),children:t.jsx(o.IconButton,{size:"small",onClick:()=>s({id:m,collapsed:x?S:!1,visible:!x}),children:x?t.jsx(ee.VisibilityOutlined,{}):t.jsx(ee.VisibilityOffOutlined,{})})})]}),t.jsxs(o.Collapse,{unmountOnExit:!0,timeout:100,in:C,children:[t.jsx(ts,{"data-testid":"legend-layer-variable-list",opacity:N?.5:1,children:A.map(($,I)=>t.jsx(ks,{legend:$,layer:n,customLegendTypes:e,onChangeSelection:O=>l({id:m,index:I,selection:O})},`${$.type}-${I}`))}),_&&t.jsx(j.Typography,{variant:"caption",color:"textSecondary",component:"div",p:2,children:t.jsx("div",{dangerouslySetInnerHTML:{__html:_}})})]})]}):null}function Ts({intl:e,minZoom:n,maxZoom:i,layerMinZoom:r,layerMaxZoom:s}){const l=e.formatMessage({id:"c4r.widgets.legend.and"}),a=e.formatMessage({id:"c4r.widgets.legend.lowerThan"}),p=e.formatMessage({id:"c4r.widgets.legend.greaterThan"}),c=e.formatMessage({id:"c4r.widgets.legend.zoomNote"}),g=s<i?`${a} ${s}`:"",h=r>n?`${p} ${r}`:"",d=[g,h].filter(Boolean).join(` ${l} `);return d?`${c} ${d}`:""}const Ms={},Ie=()=>{},Cs=[];function As({customLegendTypes:e=Ms,layers:n=Cs,collapsed:i=!1,onChangeCollapsed:r=Ie,onChangeVisibility:s=Ie,onChangeOpacity:l=Ie,onChangeLegendRowCollapsed:a=Ie,onChangeSelection:p=Ie,title:c="Layers",maxZoom:g=20,minZoom:h=0,currentZoom:d,isMobile:y,sx:f}){const m=Z.useIntl(),v=j.useImperativeIntl(m),x=t.jsxs(Zr,{collapsed:i,children:[t.jsx(j.Typography,{variant:"caption",flexGrow:1,children:c}),t.jsx(o.Tooltip,{title:v.formatMessage({id:"c4r.widgets.legend.close"}),children:t.jsx(o.IconButton,{size:"small",onClick:()=>r(!0),children:t.jsx(ee.Close,{})})})]}),b=t.jsx(o.Tooltip,{title:v.formatMessage({id:"c4r.widgets.legend.open"}),children:t.jsx(o.IconButton,{"aria-label":c,onClick:()=>r(!1),children:t.jsx(ee.LayersOutlined,{})})});return t.jsx(Xr,{sx:f,elevation:3,collapsed:i||!!y,children:y?t.jsxs(t.Fragment,{children:[b,t.jsxs(o.Drawer,{anchor:"bottom",open:!i,onClose:()=>r(!0),children:[x,t.jsx(Tt,{children:n.map(S=>t.jsx(Mt,{layer:S,onChangeCollapsed:a,onChangeOpacity:l,onChangeVisibility:s,onChangeSelection:p,maxZoom:g,minZoom:h,currentZoom:d,customLegendTypes:e},S.id))})]})]}):t.jsxs(t.Fragment,{children:[i?b:x,t.jsx(Tt,{width:i?0:void 0,children:t.jsx(o.Collapse,{unmountOnExit:!0,in:!i,timeout:500,children:n.map(S=>t.jsx(Mt,{layer:S,onChangeCollapsed:a,onChangeOpacity:l,onChangeVisibility:s,onChangeSelection:p,maxZoom:g,minZoom:h,currentZoom:d,customLegendTypes:e},S.id))})})]})})}function Ct({color:e=void 0,children:n}){return n?t.jsx(o.Box,{mt:.5,children:t.jsx(j.Typography,{component:"div",variant:"caption",color:e??"inherit",style:{fontWeight:"normal"},children:n})}):t.jsx(o.Box,{mt:-1})}function Es({title:e="No data available",body:n="There are no results for the combination of filters applied to your data. Try tweaking your filters, or zoom and pan the map to adjust the Map View.",severity:i=void 0,...r}){return i?t.jsx(bn.Alert,{title:e,severity:i,...r,children:t.jsx(Ct,{children:n})}):t.jsxs(o.Box,{...r,children:[e&&t.jsx(j.Typography,{variant:"body2",children:e}),t.jsx(Ct,{color:"textSecondary",children:n})]})}const Bs=o.styled(o.Box,{shouldForwardProp:e=>e!=="margin"})(({theme:e,margin:n})=>({margin:0,position:"relative",maxWidth:"100%",padding:n??e.spacing(2,2.5)})),Ps=o.styled(o.LinearProgress)(({theme:e})=>({position:"absolute",top:0,left:0,width:"100%",height:e.spacing(.25)})),Ls=o.styled(o.Grid,{shouldForwardProp:e=>e!=="expanded"})(({theme:e,expanded:n=!0})=>({display:"flex",flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",width:"100%",...n?{minHeight:e.spacing(3)}:{height:e.spacing(3)},padding:0})),Ds=o.styled(o.Button,{shouldForwardProp:e=>e!=="expandable"})(({theme:e,expandable:n=!0})=>({flex:1,padding:0,alignItems:"flex-start",justifyContent:"flex-start",height:"auto",minHeight:"auto",marginBottom:e.spacing(1),cursor:n?"pointer":"default","& .MuiButton-startIcon":{marginTop:"3px",marginRight:e.spacing(1)},"&:hover":{background:"none"}})),gn=({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",width:e.spacing(3),height:e.spacing(3),color:e.palette.text.secondary}),Ns=o.styled(ee.ExpandLess)(({theme:e})=>gn({theme:e})),Os=o.styled(ee.ExpandMore)(({theme:e})=>gn({theme:e})),$s=o.styled(o.Typography,{shouldForwardProp:e=>e!=="expanded"})(({expanded:e=!0})=>({wordBreak:"break-word",overflow:"hidden",...e&&{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},...!e&&{whiteSpace:"nowrap",textOverflow:"ellipsis"}})),Rs=o.styled(o.Grid)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),marginRight:e.spacing(-.5),marginLeft:e.spacing(1)})),At=o.styled(o.IconButton)(({theme:e})=>({color:e.palette.text.secondary})),Fs=o.styled(o.Menu)(({theme:e})=>({".MuiPaper-root":{marginTop:e.spacing(5),maxHeight:e.spacing(21),minWidth:e.spacing(16)}})),Et=[],Ws=t.jsx(ee.MoreVert,{});function _s({title:e,actions:n=Et,options:i=Et,optionsIcon:r=Ws,children:s,contentProps:l,disabled:a=!1,expandable:p=!0,expanded:c=!0,onExpandedChange:g,footer:h,headerItems:d,isLoading:y=!1,margin:f}){const m=u.createRef(),[v,x]=u.useState(!0),b=c!==void 0&&g!==void 0,S=p!==!1?b?c:v:!0,k=b?g:x,[T,w]=u.useState(null),C=!!T,M=()=>{p&&k(!S)},D=N=>w(N.currentTarget),E=()=>w(null);function L(N){N&&N(),E()}const P=N=>t.jsx(At,{"aria-label":N.label,onClick:N.action,size:"small",children:N.icon},N.id);return a?s?t.jsx(t.Fragment,{children:s}):null:t.jsxs(Bs,{margin:f,component:"section","aria-label":e,children:[y?t.jsx(Ps,{}):null,t.jsxs(Ls,{container:!0,expanded:c,children:[t.jsx(Ds,{expandable:p,startIcon:p&&t.jsx(o.Icon,{children:S?t.jsx(Ns,{}):t.jsx(Os,{})}),onClick:M,tabIndex:p?0:-1,children:t.jsx(o.Tooltip,{title:e,children:t.jsx($s,{expanded:c,align:"left",variant:"subtitle1",children:e})})}),t.jsxs(Rs,{item:!0,children:[d,n.length>0&&n.map(N=>N.tooltip?t.jsx(o.Tooltip,{title:N.tooltip.text,placement:N.tooltip.placement??"top",children:P(N)},N.id):P(N)),i.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(At,{"aria-label":"options","aria-controls":"options-menu","aria-haspopup":"true",onClick:D,size:"small",children:r}),t.jsx(Fs,{id:"options-menu",elevation:8,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:T,keepMounted:!0,open:C,onClose:E,children:i.map(N=>t.jsx(o.MenuItem,{selected:N.selected,onClick:()=>L(N.action),children:N.name},N.id))})]})]})]}),t.jsx(o.Collapse,{ref:m,in:S,timeout:"auto",unmountOnExit:!0,children:t.jsxs(o.Box,{...l,children:[t.jsx(o.Box,{pt:1,children:s}),h??t.jsx(o.Box,{children:h})]})})]})}exports.BarWidgetUI=Dn;exports.CategoryWidgetUI=Vn;exports.ComparativeCategoryWidgetUI=Sr;exports.ComparativeFormulaWidgetUI=Pr;exports.ComparativePieWidgetUI=Fr;exports.FeatureSelectionUIDropdown=on;exports.FeatureSelectionUIGeometryChips=rn;exports.FeatureSelectionUIToggleButton=nn;exports.FeatureSelectionWidgetUI=Kr;exports.FormulaWidgetUI=Xn;exports.GroupDateTypes=ae;exports.HistogramWidgetUI=ro;exports.LEGEND_TYPES=ce;exports.LegendCategories=an;exports.LegendIcon=un;exports.LegendProportion=cn;exports.LegendRamp=Qe;exports.LegendWidgetUI=As;exports.NoDataAlert=Es;exports.PieWidgetUI=Do;exports.RangeWidgetUI=Ho;exports.ScatterPlotWidgetUI=Qo;exports.TIME_SERIES_CHART_TYPES=Ge;exports.TableWidgetUI=di;exports.TimeSeriesProvider=Yt;exports.TimeSeriesWidgetUI=tr;exports.WrapperWidgetUI=_s;exports.useTimeSeriesContext=ze;exports.useTimeSeriesInteractivity=Vt;
|