@worldresources/wri-design-systems 2.200.1 → 2.201.0
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/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.esm.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3926,7 +3926,7 @@ function FM(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Obj
|
|
|
3926
3926
|
padding: 0;
|
|
3927
3927
|
padding-top: ${k(200)};
|
|
3928
3928
|
color: ${o?w("neutral",500):"inherit"};
|
|
3929
|
-
`),children:n.children}):null]},`${n.label}-${n.value}`);var o,s}))})}),exports.CloseButton=sg,exports.ClusterPoint=({onClick:e,triggerRef:n,showFocusState:r,count:o,mode:i,variant:s="cluster"})=>t.jsx(vb,{count:o,mode:i,onClick:e,ref:n,showFocusState:r,variant:s}),exports.Combobox=({label:t,required:o,caption:i,errorMessage:s,size:a,disabled:l,showOptionalLabel:c=!0,placeholder:d,labels:u,noMarginBottom:h,initialItems:p=[],multiple:f=!1,showSelectedItems:m=!1})=>{const[g,v]=n.useState([]),b=Mf("Combobox",u),{contains:y}=e.useFilter({sensitivity:"base"}),{collection:x,filter:w}=e.useListCollection({initialItems:p,filter:y});return r.jsxs("div",{css:Um(a,h),className:"ds-text-input-container",children:[s?r.jsx("div",{css:Km}):null,r.jsxs(e.Field.Root,{required:o,invalid:!!s,gap:"0",style:{marginLeft:s?"1.1875rem":"0px"},children:[t?r.jsxs(e.Field.Label,{css:Gm(a,l),"aria-label":t,children:[r.jsx(e.Field.RequiredIndicator,{"aria-label":b.requiredSymbolLabel}),t,!o&&c?r.jsx("span",{children:b.optionalSuffix}):null]}):null,i?r.jsx(e.Field.HelperText,{css:Zm(a,l),"aria-label":i,children:i}):null,s?r.jsx(e.Field.ErrorText,{css:Jm(a),"aria-label":s,children:s}):null,r.jsxs(e.Combobox.Root,{multiple:f,onValueChange:e=>{v(e.items.map((e=>({label:e.label,value:e.value}))))},value:g.map((e=>e.value)),collection:x,onInputValueChange:e=>w(e.inputValue),width:"20rem",size:"small"===a?"sm":"md",children:[r.jsxs(e.Combobox.Control,{children:[r.jsx(e.Combobox.Input,{placeholder:d,css:Xm(a),disabled:l,"aria-label":t||d||b.defaultInputAriaLabel}),r.jsxs(e.Combobox.IndicatorGroup,{children:[r.jsx(e.Combobox.ClearTrigger,{"aria-label":b.clearSelectionLabel}),r.jsx(e.Combobox.Trigger,{"aria-label":b.toggleOptionsLabel})]})]}),r.jsx(e.Portal,{children:r.jsx(e.Combobox.Positioner,{children:r.jsxs(e.Combobox.Content,{children:[r.jsx(e.Combobox.Empty,{children:b.noItemsFoundLabel}),x.items.map((t=>r.jsxs(e.Combobox.Item,{item:t,children:[t.label,r.jsx(e.Combobox.ItemIndicator,{})]},t.value)))]})})}),r.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"0.25rem",paddingTop:"0.5rem"},children:m&&g.map((e=>r.jsx(Nv,{label:e.label,variant:"info-white",onClose:()=>v((t=>t.filter((t=>t.value!==e.value)))),closable:!0},e.value)))})]})]})]})},exports.DesignSystemLocaleProvider=({labels:e,children:r})=>{const o=n.useMemo((()=>({labels:e})),[e]);return t.jsx(M.Provider,{value:o,children:r})},exports.ExtendableCard=({children:t,header:n,footer:o})=>r.jsx(e.Box,{css:Yw,children:r.jsx(e.Accordion.Root,{multiple:!0,children:r.jsxs(e.Accordion.Item,{value:"extendable-card-item",children:[r.jsxs(e.Accordion.ItemTrigger,{css:Qw,alignItems:"center",children:[r.jsx(e.Flex,{gap:3,flex:"1",overflow:"hidden",alignItems:"center",children:n}),r.jsx(e.Accordion.ItemIndicator,{children:r.jsx(If,{color:"var(--chakra-colors-neutral-700)",height:"1rem",width:"1rem"})})]}),r.jsxs(e.Accordion.ItemContent,{children:[t,o]})]})})}),exports.Footer=({children:e,label:t="© World Resources Institute",fixed:n,filled:o,maxWidth:i,additionalLogos:s})=>{const a=(new Date).getFullYear();return r.jsx("footer",{css:ZT(n,o),children:r.jsxs("div",{css:JT(i),children:[r.jsxs("div",{css:QT,children:[r.jsx(Wf,{height:"2rem",width:"5.6875rem"}),s&&s.map(((e,t)=>r.jsx("div",{children:e},t)))]}),r.jsx("div",{css:XT,children:e}),r.jsx("div",{children:r.jsxs("p",{css:YT,children:[t," ",a]})})]})})},exports.FormContainer=({label:e,error:t,children:o})=>{const i=n.useId(),s=e?`${i}-label`:void 0,a=t?`${i}-error`:void 0;return r.jsxs("div",{css:bg,role:"group","aria-labelledby":s,"aria-describedby":a,children:[t?r.jsx("div",{css:xg}):null,r.jsxs("div",{children:[e?r.jsx("p",{id:s,css:yg,children:e}):null,t?r.jsx("p",{id:a,css:wg,children:t}):null,o]})]})},exports.IconButton=Of,exports.InlineMessage=RT,exports.InputWithUnits=({label:t,caption:o,errorMessage:i,units:s,unitsPosition:a="end",defaultUnit:l="",defaultValue:c="",onChange:d,required:u,disabled:h})=>{const[p,f]=n.useState(c),[m,g]=n.useState(l?[l]:[s[0].value]),v=(e,t)=>{d&&d("end"===a?""+(t?`${p} ${e}`:`${e} ${m}`):""+(t?`${e} ${p}`:`${m} ${e}`))};return r.jsxs("div",{css:sv,children:[i?r.jsx("div",{css:cv}):null,r.jsxs("div",{style:{marginLeft:i?"1.1875rem":"0px"},children:[r.jsxs("p",{css:av(h),"aria-label":t,children:[u?r.jsx("span",{children:"*"}):null,t]}),r.jsx("p",{css:lv(h),"aria-label":o,children:o}),i?r.jsx("p",{css:dv,"aria-label":i,children:i}):null,r.jsxs(e.Group,{css:uv(!!i,a),attached:!0,children:["start"===a?r.jsx(Pv,{placeholder:"","aria-label":`${t} unit`,value:m,items:s,disabled:h,onChange:e=>{g(e),v(e?.[0],!0)}}):null,r.jsx(Ym,{type:"number","aria-label":`${t} value`,value:p,disabled:h,onChange:e=>{f(e.target.value),v(e.target.value)}}),"end"===a?r.jsx(Pv,{placeholder:"","aria-label":`${t} unit`,value:m,items:s,disabled:h,onChange:e=>{g(e),v(e?.[0],!0)}}):null]})]})]})},exports.ItemCount=ww,exports.LayerGroup=({label:t,caption:o,value:i,layerItems:s,onChangeForRadioVariant:a,labels:l})=>{const c=Mf("LayerGroup",l),[d,u]=n.useState({}),[h]=n.useState((e=>{const t=e.find((e=>"radio"===e.variant&&e.isDefaultSelected));return t?.name})(s));n.useEffect((()=>{let e={...d};s.forEach((n=>{n.isDefaultSelected&&(e={...e,["radio"===n.variant?t:n.name]:n.isDefaultSelected})})),u(e)}),[]);const p=(e,t,n,r)=>{const o={...d,[e]:t};u(o),n&&n(e,t,r)},f=Object.values(d).filter((e=>!0===e)).length,m=c.groupAriaLabel(t,f,o);return r.jsxs(e.Accordion.Item,{value:i,width:"100%",children:[r.jsxs(e.Accordion.ItemTrigger,{css:Nx,alignItems:"flex-start","aria-label":m,children:[r.jsxs(e.Box,{width:"full",display:"flex",flexDirection:"column",alignItems:"flex-start",children:[r.jsxs("span",{css:Dx,children:[t,r.jsx(Nv,{label:c.activeTagLabel(f),size:"small",variant:f>0?"success":"info-grey"})]}),r.jsx("div",{css:Ix,children:o})]}),r.jsx(e.Accordion.ItemIndicator,{display:"flex",children:r.jsx(If,{color:"var(--chakra-colors-neutral-700)",height:"1rem",width:"1rem"})})]}),r.jsx(e.Accordion.ItemContent,{paddingLeft:"1rem",paddingRight:"1rem",children:r.jsx(Bg,{name:t,value:h,customGap:"0",onChange:(e,t)=>p(e,!!t,a,t),children:s.map((e=>r.jsx(_x,{...e,onChange:(t,n)=>p(t,n,e.onChange)},e.label)))})})]})},exports.LayerGroupContainer=({children:t,defaultValue:n,...o})=>r.jsx("div",{css:Rx,style:{width:"100%"},children:r.jsx(e.Accordion.Root,{css:{},defaultValue:n,multiple:!0,...o,children:t})}),exports.LayerItem=_x,exports.LayerParameters=({label:t,children:o,openedByDefault:i})=>r.jsx("div",{children:r.jsx(e.Accordion.Root,{defaultValue:i?[t]:[],multiple:!0,children:r.jsxs(e.Accordion.Item,{css:Fx,value:t,children:[r.jsxs(e.Accordion.ItemTrigger,{css:qx,children:[r.jsx(e.Box,{width:"full",display:"flex",flexDirection:"column",alignItems:"flex-start",children:r.jsx("p",{css:Wx,children:t})}),r.jsx(e.Accordion.ItemIndicator,{display:"flex",children:r.jsx(If,{color:"var(--chakra-colors-neutral-700)",height:"1rem",width:"1rem"})})]}),r.jsx(e.Accordion.ItemContent,{css:Ux,children:n.Children.map(o,(e=>r.jsx("div",{className:"ds-layer-parameters-item-child",children:e})))})]})})}),exports.LegendItem=({layerName:e,dataUnit:t,onDrag:n,onUpClick:o,onDownClick:i,onRemoveClick:s,children:a,onInfoClick:l,onOpacityChanged:c,labels:d})=>{const u=Mf("LegendItem",d);return r.jsxs("div",{css:Kx,children:[r.jsx("div",{css:Gx,children:r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[r.jsx(Of,{icon:r.jsx(If,{rotate:"180"}),"aria-label":u.upLabel,onClick:o}),r.jsx(Of,{icon:r.jsx(If,{}),"aria-label":u.downLabel,onClick:i})]})}),r.jsxs("div",{style:{width:"100%"},children:[r.jsxs("div",{css:Zx,children:[r.jsxs("div",{children:[r.jsx("h3",{css:Jx,children:e}),r.jsx("p",{css:Xx,children:t})]}),r.jsx(Ef,{label:u.removeLabel,size:"small",variant:"secondary",rightIcon:r.jsx(zf,{}),onClick:s})]}),a,r.jsxs("div",{css:Yx,children:[r.jsx(Ef,{label:u.aboutDataLabel,size:"small",variant:"secondary",leftIcon:r.jsx(Df,{}),onClick:l}),r.jsx(rw,{defaultValue:80,onOpacityChanged:c})]})]})]})},exports.List=Ow,exports.MapControlsToolbar=({onZoomInClick:e,onZoomOutClick:n,onExpandClick:r,onShareClick:o,onPrintClick:i,onSettingsClick:s,onQuestionClick:a,vertical:l,expanded:c,showExpandedToggle:d,ariaLabel:u,labels:h})=>{const p=Mf("MapControlsToolbar",h),f=[{icon:t.jsx(Kf,{}),label:p.zoomInLabel,ariaLabel:p.zoomInAriaLabel,onClick:e},{icon:t.jsx(Gf,{}),label:p.zoomOutLabel,ariaLabel:p.zoomOutAriaLabel,onClick:n,gap:!0},{icon:t.jsx(Zf,{}),label:p.expandLabel,ariaLabel:p.expandAriaLabel,onClick:r,gap:!0},{icon:t.jsx(Jf,{}),label:p.shareLabel,ariaLabel:p.shareAriaLabel,onClick:o,gap:!0},{icon:t.jsx(Xf,{}),label:p.printLabel,ariaLabel:p.printAriaLabel,onClick:i,gap:!0},{icon:t.jsx(Yf,{}),label:p.settingsLabel,ariaLabel:p.settingsAriaLabel,onClick:s,gap:!0},{icon:t.jsx(Qf,{}),label:p.helpLabel,ariaLabel:p.helpAriaLabel,onClick:a}];return t.jsx(ug,{items:f,vertical:l,expanded:c,showExpandedToggle:d,ariaLabel:u||p.toolbarAriaLabel})},exports.MapMarker=vb,exports.MapMarkers=bb,exports.MapPopUp=({open:e,onOpenChange:t,anchorRef:o,header:i,content:s,footer:a,placement:c="bottom",offset:d=30,closeOnEscape:u=!0,closeOnOutsideClick:h=!1,labels:p})=>{const f=Mf("MapPopUp",p),m=n.useRef(null),{refs:g,floatingStyles:v,context:b,middlewareData:y,placement:x}=Sx({open:e,onOpenChange:t,placement:c,whileElementsMounted:Uy,middleware:[ox(d),(w={fallbackAxisSideDirection:"start"},{...Zy(w),options:[w,C]}),ix({padding:8}),sx({element:m})]});var w,C;n.useEffect((()=>{o?.current&&g.setReference(o.current)}),[o,g]);const k=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:i}=e,{enabled:s=!0,escapeKey:a=!0,outsidePress:c=!0,outsidePressEvent:d="pointerdown",referencePress:u=!1,referencePressEvent:h="pointerdown",ancestorScroll:p=!1,bubbles:f,capture:m}=t,g=yx(),v=$y("function"==typeof c?c:()=>!1),b="function"==typeof c?v:c,y=l.useRef(!1),{escapeKey:x,outsidePress:w}=Cx(f),{escapeKey:C,outsidePress:k}=Cx(m),S=l.useRef(!1),$=$y((e=>{var t;if(!n||!s||!a||"Escape"!==e.key)return;if(S.current)return;const o=null==(t=i.current.floatingContext)?void 0:t.nodeId,l=g?Cy(g.nodesRef.current,o):[];if(!x&&(e.stopPropagation(),l.length>0)){let e=!0;if(l.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)})),!e)return}r(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")})),j=$y((e=>{var t;const n=()=>{var t;$(e),null==(t=yy(e))||t.removeEventListener("keydown",n)};null==(t=yy(e))||t.addEventListener("keydown",n)})),M=$y((e=>{var t;const n=i.current.insideReactTree;i.current.insideReactTree=!1;const s=y.current;if(y.current=!1,"click"===d&&s)return;if(n)return;if("function"==typeof b&&!b(e))return;const a=yy(e),l="[data-floating-ui-inert]",c=wy(o.floating).querySelectorAll(l);let u=Sb(a)?a:null;for(;u&&!Vb(u);){const e=_b(u);if(Vb(e)||!Sb(e))break;u=e}if(c.length&&Sb(a)&&!a.matches("html,body")&&!by(a,o.floating)&&Array.from(c).every((e=>!by(u,e))))return;if($b(a)&&O){const t=Vb(a),n=Bb(a),r=/auto|scroll/,o=t||r.test(n.overflowX),i=t||r.test(n.overflowY),s=o&&a.clientWidth>0&&a.scrollWidth>a.clientWidth,l=i&&a.clientHeight>0&&a.scrollHeight>a.clientHeight,c="rtl"===n.direction,d=l&&(c?e.offsetX<=a.offsetWidth-a.clientWidth:e.offsetX>a.clientWidth),u=s&&e.offsetY>a.clientHeight;if(d||u)return}const h=null==(t=i.current.floatingContext)?void 0:t.nodeId,p=g&&Cy(g.nodesRef.current,h).some((t=>{var n;return xy(e,null==(n=t.context)?void 0:n.elements.floating)}));if(xy(e,o.floating)||xy(e,o.domReference)||p)return;const f=g?Cy(g.nodesRef.current,h):[];if(f.length>0){let e=!0;if(f.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)})),!e)return}r(!1,e,"outside-press")})),E=$y((e=>{var t;const n=()=>{var t;M(e),null==(t=yy(e))||t.removeEventListener(d,n)};null==(t=yy(e))||t.addEventListener(d,n)}));l.useEffect((()=>{if(!n||!s)return;i.current.__escapeKeyBubbles=x,i.current.__outsidePressBubbles=w;let e=-1;function t(e){r(!1,e,"ancestor-scroll")}function l(){window.clearTimeout(e),S.current=!0}function c(){e=window.setTimeout((()=>{S.current=!1}),Pb()?5:0)}const u=wy(o.floating);a&&(u.addEventListener("keydown",C?j:$,C),u.addEventListener("compositionstart",l),u.addEventListener("compositionend",c)),b&&u.addEventListener(d,k?E:M,k);let h=[];return p&&(Sb(o.domReference)&&(h=qb(o.domReference)),Sb(o.floating)&&(h=h.concat(qb(o.floating))),!Sb(o.reference)&&o.reference&&o.reference.contextElement&&(h=h.concat(qb(o.reference.contextElement)))),h=h.filter((e=>{var t;return e!==(null==(t=u.defaultView)?void 0:t.visualViewport)})),h.forEach((e=>{e.addEventListener("scroll",t,{passive:!0})})),()=>{a&&(u.removeEventListener("keydown",C?j:$,C),u.removeEventListener("compositionstart",l),u.removeEventListener("compositionend",c)),b&&u.removeEventListener(d,k?E:M,k),h.forEach((e=>{e.removeEventListener("scroll",t)})),window.clearTimeout(e)}}),[i,o,a,b,d,n,r,p,s,x,w,$,C,j,M,k,E]),l.useEffect((()=>{i.current.insideReactTree=!1}),[i,b,d]);const T=l.useMemo((()=>({onKeyDown:$,...u&&{[xx[h]]:e=>{r(!1,e.nativeEvent,"reference-press")},..."click"!==h&&{onClick(e){r(!1,e.nativeEvent,"reference-press")}}}})),[$,r,u,h]),O=l.useMemo((()=>({onKeyDown:$,onMouseDown(){y.current=!0},onMouseUp(){y.current=!0},[wx[d]]:()=>{i.current.insideReactTree=!0}})),[$,d,i]);return l.useMemo((()=>s?{reference:T,floating:O}:{}),[s,T,O])}(b,{escapeKey:u,outsidePress:h}),S=Mx(b,{role:"dialog"}),{getFloatingProps:$}=function(e){void 0===e&&(e=[]);const t=e.map((e=>null==e?void 0:e.reference)),n=e.map((e=>null==e?void 0:e.floating)),r=e.map((e=>null==e?void 0:e.item)),o=l.useCallback((t=>$x(t,e,"reference")),t),i=l.useCallback((t=>$x(t,e,"floating")),n),s=l.useCallback((t=>$x(t,e,"item")),r);return l.useMemo((()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:s})),[o,i,s])}([k,S]),{x:j,y:M}=y.arrow??{x:null,y:null},E={top:"bottom",right:"left",bottom:"top",left:"right"}[x.split("-")[0]];if(!e)return null;let T=d-1,O=4;return"left"!==E&&"right"!==E||(T=4,O=d-1),r.jsxs(r.Fragment,{children:[r.jsxs("div",{ref:g.setFloating,style:v,"aria-label":f.dialogAriaLabel,"aria-modal":!0,...$(),css:Ex,children:[r.jsxs("div",{css:Tx,children:[i,r.jsx(sg,{onClick:()=>t(!1),className:"ds-map-pop-up-close-button","aria-label":f.closeLabel})]}),r.jsx("div",{css:Ox,children:s}),a?r.jsx("div",{css:Lx,children:a}):null,r.jsx("div",{ref:m,css:Ax(T,O,j,M,E,d)})]}),r.jsx("div",{className:"fixed inset-0 z-[999] bg-black/20 backdrop-blur-[1px]",onClick:()=>h&&t(!1)})]})},exports.Menu=jm,exports.MobileSearch=({value:t,placeholder:o,showInfoMessage:i=!0,items:s=[],disabled:a,readOnly:l,id:c,name:d,autoFocus:u,autoComplete:h,onBlur:p,onFocus:f,onQueryChange:m,onCancel:g,onItemClick:v,onChange:b,labels:y})=>{const x=Mf("MobileSearch",y),[C,k]=n.useState(t??""),[S,$]=n.useState(!0),[j,M]=n.useState(!1),E=n.useRef(null),T="string"==typeof t,O=T?t:C;n.useEffect((()=>{T&&k(t)}),[T,t]),n.useEffect((()=>{m?.(O)}),[O,m]);const L=n.useMemo((()=>{const e=O.trim().toLowerCase();return e?s.filter((t=>`${t.id??""} ${t.label} ${t.caption??""}`.toLowerCase().includes(e))):s}),[s,O]),A=O.trim().length?x.matchingResultsTitle(L.length):x.recentSearchesTitle,R=O.length?r.jsx(sg,{onClick:()=>{T||k("");const e=E.current?.querySelector("input");e&&(e.value="",e.focus()),$(!0)}}):null;let N=w("neutral",500);return a?N=w("neutral",500):j&&(N=w("primary",700)),r.jsxs("div",{ref:E,css:NT,children:[r.jsxs("div",{css:DT,children:[r.jsx("div",{css:IT,children:r.jsx(e.InputGroup,{startElement:r.jsx(hm,{width:"1.25rem",height:"1.25rem",fill:N,"aria-hidden":"true"}),endElement:R,children:r.jsx(Ym,{label:"",value:O,placeholder:o??x.inputAriaLabel,onChange:e=>{T||k(e.target.value),$(!0),b?.(e)},onFocus:e=>{M(!0),$(!0),f?.(e)},onBlur:e=>{M(!1),p?.(e)},noMarginBottom:!0,type:"search","aria-label":o??x.inputAriaLabel,disabled:a,readOnly:l,id:c,name:d,autoFocus:u??!0,autoComplete:h,style:{paddingLeft:"2.5rem"}})})}),r.jsx(Ef,{css:PT,variant:"borderless",label:x.cancelLabel,onClick:()=>{T||k(""),$(!1);const e=E.current?.querySelector("input");e&&(e.value="",e.blur()),g?.()}})]}),S?r.jsxs("div",{css:zT,children:[r.jsx("h3",{css:VT,children:A}),i?r.jsx("div",{css:BT,children:r.jsx(RT,{label:x.infoLabel,variant:"info-white",size:"full-width"})}):null,r.jsx("ul",{css:HT,"aria-label":A,children:L.map((t=>r.jsx("li",{children:r.jsxs(e.chakra.button,{type:"button",css:_T,onClick:()=>(e=>{v?.(e)})(t),"aria-label":`${t.label}, ${t.caption??""}`,style:{width:"100%"},children:[t.icon??null,r.jsxs("div",{css:FT,children:[r.jsx("p",{css:qT,children:t.label}),r.jsx("p",{css:WT,children:t.caption})]})]})},t.id)))})]}):null]})},exports.MobileTabBar=({defaultValue:t,tabs:o,onTabClick:i,hideLabels:s,activationMode:a="manual",labels:l})=>{const c=Mf("MobileTabBar",l),d=o.length,[u,h]=n.useState((()=>oO(o,t)));return r.jsx("div",{css:eO,children:r.jsx(e.Tabs.Root,{width:"full",defaultValue:t||o?.[0]?.value,onValueChange:({value:e})=>(e=>{const t=oO(o,e);h(t),i&&i(e)})(e),activationMode:a,children:r.jsx(e.Tabs.List,{alignItems:"center",border:"none",children:o.map(((t,n)=>{const{label:o,icon:i,bagdeCount:a,"aria-label":l,"aria-describedby":h,disabled:p,...f}=t,m=`${t.value}-str-status`,g=u===n,v=[c.tabPositionStatus(n+1,d),g?c.selectedStatus:c.notSelectedStatus];p&&v.push(c.disabledStatus);const b=[h,m].filter(Boolean).join(" ")||void 0;return r.jsxs(e.Tabs.Trigger,{css:tO,"aria-label":l||o,"aria-disabled":!!p||void 0,"aria-describedby":b,disabled:p,...f,children:[r.jsxs("div",{css:nO,children:[i,a?r.jsx("div",{css:rO,className:"ds-badge-count",children:a}):null]}),s?null:r.jsx("p",{children:o}),r.jsx(e.VisuallyHidden,{id:m,children:v.join(", ")})]},t.value)}))})})})},exports.Modal=({header:t,content:o,footer:i,size:s="medium",width:a,height:l,maxHeight:c,draggable:d,blocking:u,open:h,onClose:p,labels:f})=>{const m=Mf("Modal",f),g=n.useRef(null);return h?r.jsx(e.Dialog.Root,{open:h,onOpenChange:p,placement:"center",scrollBehavior:"inside",closeOnInteractOutside:!d&&!u,preventScroll:!d&&!u,closeOnEscape:!u,defaultOpen:!0,children:r.jsxs(e.Portal,{children:[d?null:r.jsx(e.Dialog.Backdrop,{css:{background:"rgba(0, 0, 0, 0.64)"}}),r.jsx(YC,{disabled:!d,nodeRef:g,children:r.jsx(e.Dialog.Positioner,{ref:g,children:r.jsxs(e.Dialog.Content,{"aria-label":m.dialogAriaLabel,css:QC(s,a,l,c),children:[r.jsxs(e.Dialog.Header,{css:ek,children:[t,u?null:r.jsx(e.Dialog.CloseTrigger,{css:tk,asChild:!0,children:r.jsx(sg,{})})]}),r.jsx(e.Dialog.Body,{css:nk,children:o}),i?r.jsx(e.Dialog.Footer,{padding:"0.75rem",children:i}):null]})})})]})}):null},exports.MultiActionButton=({variant:t="primary",size:o="default",mainActionLabel:i,mainActionOnClick:s=()=>{},otherActions:a=[],disabled:l,mainActionLeftIcon:c,mainActionRightIcon:d,...u})=>{const[h,p]=n.useState(!1),f=l?`${i} action button with menu, disabled`:void 0;return r.jsxs(e.Group,{css:mg,attached:!0,tabIndex:l?0:void 0,"aria-disabled":l,"aria-label":f,role:"group",children:[r.jsx(Ef,{css:{},label:i,variant:t,size:o,onClick:s,disabled:l,leftIcon:c,rightIcon:d,...u}),r.jsxs(e.Menu.Root,{onOpenChange:({open:e})=>p(e),positioning:{placement:"bottom-end"},children:[r.jsx(e.Menu.Trigger,{css:pg(t),"data-group-item":!0,"data-last":!0,asChild:!0,children:r.jsx(Ef,{style:gg,"aria-label":`Open ${i} options`,"aria-haspopup":"menu","aria-expanded":h,variant:t,size:o,leftIcon:r.jsx(If,{"aria-hidden":"true",rotate:h?"180":"0",color:w("accessible","text-on-primary-mids")||w("primary",900)}),disabled:l})}),r.jsx(vg,{children:a.map((({label:t,value:n,onClick:i})=>r.jsx(e.Menu.Item,{css:fg(o),onClick:i,value:n,children:t},n)))})]})]})},exports.Navbar=({variant:e="default",theme:t="light",logo:o,linkRouter:i,pathname:s,navigationSection:a,utilitySection:l,actionsSection:c,maxWidth:d,fixed:u,onNavbarHeightChange:h,backgroundColor:p,labels:f})=>{const m=Mf("Navbar",f),g=n.useRef(null),v=n.useRef(null),b=n.useRef(null),[y,x]=n.useState(!1),[w,C]=n.useState(-1),[k,S]=n.useState("undefined"!=typeof window&&window?.innerWidth<=MO),[$,j]=n.useState(!1),M=i,E=n.useCallback((()=>{if(v.current&&g.current&&b.current){const e=g.current.getBoundingClientRect(),t=v.current.getBoundingClientRect(),n=b.current.getBoundingClientRect();t.width,e.width,window.innerWidth<=MO||window.innerWidth<=w?(h?.(96),x(!0)):window.innerWidth>MO&&window.innerWidth<=1440?e.right>=t.left?(h?.(96),x(!0),C(window.innerWidth)):window.innerWidth>w&&(h?.(48),x(!1),C(-1)):(h?.(48),x(!1),C(-1)),y&&(window.innerWidth<=MO||n.right>=t.left?(S(!0),h?.(48)):(S(!1),h?.(96)))}}),[w,y]);n.useEffect((()=>(E(),window.addEventListener("resize",E),()=>{window.removeEventListener("resize",E)})),[E]);const T="condensed"===e;return r.jsxs("nav",{css:iO(y&&!k,u,p,t,T),children:[r.jsxs("div",{css:aO(y&&!k,d,T),children:[r.jsxs("div",{css:lO(y&&!k||"dark"===t,T),ref:g,children:[o?r.jsx("div",{ref:b,css:cO,children:o}):null,r.jsx("div",{css:dO(y),children:a?.map((e=>e.link?r.jsx(M,{to:e.link,href:e.link,css:uO(s===e.link,t,T),children:e.label},e.label):r.jsx(jm,{theme:t,label:e.label,fontSize:T?"0.875rem":"1rem",items:e.items||[]},e.label)))})]}),r.jsx("div",{css:hO(T),ref:v,children:k?r.jsxs("button",{type:"button",onClick:()=>j(!$),"aria-label":$?m.closeMenuLabel:m.openMenuLabel,"aria-expanded":$,css:mO(t),children:[$?m.closeLabel:m.menuLabel,$?r.jsx(zf,{height:T?"0.75rem":"1rem",width:T?"0.75rem":"1rem"}):r.jsx(lm,{height:T?"0.75rem":"1rem",width:T?"0.75rem":"1rem"})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{css:hO(T),children:l?.map(((e,t)=>r.jsx("div",{css:pO(y),children:e},t)))}),c?.length?r.jsx("div",{css:fO(y),children:c.map((e=>r.jsx(Ef,{...e},e.ariaLabel)))}):null]})})]}),y&&!k?r.jsx("div",{css:sO(t,T),children:a?.map((e=>e.link?r.jsx(M,{to:e.link,href:e.link,css:uO(s===e.link,t,T),children:e.label},e.label):r.jsx(jm,{theme:t,label:e.label,fontSize:T?"0.875rem":"1rem",items:e.items||[]},e.label)))}):null,k?r.jsx(jO,{theme:t,variant:e,navigationSection:a,utilitySection:l,actionsSection:c,linkRouter:i,isOpen:$,setIsOpen:j,pathname:s,resolvedLabels:m}):null]})},exports.NavigationRail=({tabs:t=[],defaultValue:o,onTabClick:i,children:s,onOpenChange:a,labels:l})=>{const c=Mf("NavigationRail",l),[d,u]=n.useState(!1),[h,p]=n.useState(o||t?.[0]?.value),f=e=>{p(e),i&&i(e)},[m]=e.useMediaQuery(["(max-width: 48rem)"]);return m?r.jsxs(e.Tabs.Root,{defaultValue:h,onValueChange:({value:e})=>f(e),children:[r.jsx(e.Tabs.List,{style:{display:"flex",overflowX:"auto",whiteSpace:"nowrap",padding:"0.5rem",gap:"0.5rem"},children:t.map((t=>r.jsx(e.Tabs.Trigger,{value:t.value,css:{"--indicator-color":w("primary",500),flexShrink:0,padding:"0.625rem 1rem",color:w("neutral",600),"&[data-selected]":{color:w("neutral",800),fontWeight:600}},children:t.label},t.value)))}),t.map((t=>r.jsx(e.Tabs.Content,{value:t.value,children:s},t.value)))]}):r.jsxs("div",{style:{height:"calc(100vh - 3rem - 3.5rem)",position:"fixed",top:"3rem",left:0,display:"flex"},children:[r.jsxs("div",{css:EO,children:[r.jsx(e.Tabs.Root,{defaultValue:o||t?.[0]?.value,orientation:"horizontal",width:"full",onValueChange:({value:e})=>{f(e)},children:r.jsx(e.Tabs.List,{alignItems:"center",border:"none",style:{flexDirection:"column"},children:t.map((t=>r.jsx(e.Tabs.Trigger,{css:TO,"aria-label":t["aria-label"]||t.label,...t,children:r.jsxs(e.Box,{display:"flex",alignItems:"center",flexDirection:"column",gap:"0.3125rem",className:"ds-tab-label",children:[t.icon?r.jsx("div",{css:OO,children:t.icon}):null,r.jsx("p",{children:t.label})]})},t.label)))})}),s?r.jsx(e.Collapsible.Root,{onOpenChange:({open:e})=>{u(e),a&&a(!e)},children:r.jsxs(e.Collapsible.Trigger,{css:LO,children:[r.jsx("div",{css:OO,children:d?r.jsx(Af,{}):r.jsx(Lf,{})}),r.jsxs("div",{className:"ds-tab-label",children:[r.jsx("p",{children:d?c.showLabel:c.hideLabel}),r.jsx("p",{children:c.sidebarLabel})]})]})}):null]}),s?r.jsx(e.Collapsible.Root,{defaultOpen:!0,open:!d,children:r.jsx(e.Collapsible.Content,{height:"100%",children:r.jsx("div",{css:AO,role:"tabpanel","aria-labelledby":h,children:s})})}):null]})},exports.OptionCard=({defaultValue:t,items:n,onValueChange:o,variant:s,itemWidth:a,hideControl:l})=>r.jsx(e.RadioCard.Root,{defaultValue:t,onValueChange:o,children:r.jsx(e.HStack,{alignItems:"flex-start",flexWrap:"wrap",gap:"0.75rem",children:n?.map((t=>{return r.jsxs(e.RadioCard.Item,{css:(o=a,c=t.selectedColor,d=t.selectedBackgroundColor,i.css`
|
|
3929
|
+
`),children:n.children}):null]},`${n.label}-${n.value}`);var o,s}))})}),exports.CloseButton=sg,exports.ClusterPoint=({onClick:e,triggerRef:n,showFocusState:r,count:o,mode:i,variant:s="cluster"})=>t.jsx(vb,{count:o,mode:i,onClick:e,ref:n,showFocusState:r,variant:s}),exports.Combobox=({label:t,required:o,caption:i,errorMessage:s,size:a,disabled:l,showOptionalLabel:c=!0,placeholder:d,labels:u,noMarginBottom:h,initialItems:p=[],multiple:f=!1,showSelectedItems:m=!1})=>{const[g,v]=n.useState([]),b=Mf("Combobox",u),{contains:y}=e.useFilter({sensitivity:"base"}),{collection:x,filter:w}=e.useListCollection({initialItems:p,filter:y});return r.jsxs("div",{css:Um(a,h),className:"ds-text-input-container",children:[s?r.jsx("div",{css:Km}):null,r.jsxs(e.Field.Root,{required:o,invalid:!!s,gap:"0",style:{marginLeft:s?"1.1875rem":"0px"},children:[t?r.jsxs(e.Field.Label,{css:Gm(a,l),"aria-label":t,children:[r.jsx(e.Field.RequiredIndicator,{"aria-label":b.requiredSymbolLabel}),t,!o&&c?r.jsx("span",{children:b.optionalSuffix}):null]}):null,i?r.jsx(e.Field.HelperText,{css:Zm(a,l),"aria-label":i,children:i}):null,s?r.jsx(e.Field.ErrorText,{css:Jm(a),"aria-label":s,children:s}):null,r.jsxs(e.Combobox.Root,{multiple:f,onValueChange:e=>{v(e.items.map((e=>({label:e.label,value:e.value}))))},value:g.map((e=>e.value)),collection:x,onInputValueChange:e=>w(e.inputValue),width:"20rem",size:"small"===a?"sm":"md",children:[r.jsxs(e.Combobox.Control,{children:[r.jsx(e.Combobox.Input,{placeholder:d,css:Xm(a),disabled:l,"aria-label":t||d||b.defaultInputAriaLabel}),r.jsxs(e.Combobox.IndicatorGroup,{children:[r.jsx(e.Combobox.ClearTrigger,{"aria-label":b.clearSelectionLabel}),r.jsx(e.Combobox.Trigger,{"aria-label":b.toggleOptionsLabel})]})]}),r.jsx(e.Portal,{children:r.jsx(e.Combobox.Positioner,{children:r.jsxs(e.Combobox.Content,{children:[r.jsx(e.Combobox.Empty,{children:b.noItemsFoundLabel}),x.items.map((t=>r.jsxs(e.Combobox.Item,{item:t,children:[t.label,r.jsx(e.Combobox.ItemIndicator,{})]},t.value)))]})})}),r.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"0.25rem",paddingTop:"0.5rem"},children:m&&g.map((e=>r.jsx(Nv,{label:e.label,variant:"info-white",onClose:()=>v((t=>t.filter((t=>t.value!==e.value)))),closable:!0},e.value)))})]})]})]})},exports.DesignSystemLocaleProvider=({labels:e,children:r})=>{const o=n.useMemo((()=>({labels:e})),[e]);return t.jsx(M.Provider,{value:o,children:r})},exports.ExtendableCard=({children:t,header:n,footer:o})=>r.jsx(e.Box,{css:Yw,children:r.jsx(e.Accordion.Root,{multiple:!0,children:r.jsxs(e.Accordion.Item,{value:"extendable-card-item",children:[r.jsxs(e.Accordion.ItemTrigger,{css:Qw,alignItems:"center",children:[r.jsx(e.Flex,{gap:3,flex:"1",overflow:"hidden",alignItems:"center",children:n}),r.jsx(e.Accordion.ItemIndicator,{children:r.jsx(If,{color:"var(--chakra-colors-neutral-700)",height:"1rem",width:"1rem"})})]}),r.jsxs(e.Accordion.ItemContent,{children:[t,o]})]})})}),exports.Footer=({children:e,label:t="© World Resources Institute",fixed:n,filled:o,maxWidth:i,additionalLogos:s})=>{const a=(new Date).getFullYear();return r.jsx("footer",{css:ZT(n,o),children:r.jsxs("div",{css:JT(i),children:[r.jsxs("div",{css:QT,children:[r.jsx(Wf,{height:"2rem",width:"5.6875rem"}),s&&s.map(((e,t)=>r.jsx("div",{children:e},t)))]}),r.jsx("div",{css:XT,children:e}),r.jsx("div",{children:r.jsxs("p",{css:YT,children:[t," ",a]})})]})})},exports.FormContainer=({label:e,error:t,children:o})=>{const i=n.useId(),s=e?`${i}-label`:void 0,a=t?`${i}-error`:void 0;return r.jsxs("div",{css:bg,role:"group","aria-labelledby":s,"aria-describedby":a,children:[t?r.jsx("div",{css:xg}):null,r.jsxs("div",{children:[e?r.jsx("p",{id:s,css:yg,children:e}):null,t?r.jsx("p",{id:a,css:wg,children:t}):null,o]})]})},exports.IconButton=Of,exports.InlineMessage=RT,exports.InputWithUnits=({label:t,caption:o,errorMessage:i,units:s,unitsPosition:a="end",defaultUnit:l="",defaultValue:c="",onChange:d,required:u,disabled:h})=>{const[p,f]=n.useState(c),[m,g]=n.useState(l?[l]:[s[0].value]),v=(e,t)=>{d&&d("end"===a?""+(t?`${p} ${e}`:`${e} ${m}`):""+(t?`${e} ${p}`:`${m} ${e}`))};return r.jsxs("div",{css:sv,children:[i?r.jsx("div",{css:cv}):null,r.jsxs("div",{style:{marginLeft:i?"1.1875rem":"0px"},children:[r.jsxs("p",{css:av(h),"aria-label":t,children:[u?r.jsx("span",{children:"*"}):null,t]}),r.jsx("p",{css:lv(h),"aria-label":o,children:o}),i?r.jsx("p",{css:dv,"aria-label":i,children:i}):null,r.jsxs(e.Group,{css:uv(!!i,a),attached:!0,children:["start"===a?r.jsx(Pv,{placeholder:"","aria-label":`${t} unit`,value:m,items:s,disabled:h,onChange:e=>{g(e),v(e?.[0],!0)}}):null,r.jsx(Ym,{type:"number","aria-label":`${t} value`,value:p,disabled:h,onChange:e=>{f(e.target.value),v(e.target.value)}}),"end"===a?r.jsx(Pv,{placeholder:"","aria-label":`${t} unit`,value:m,items:s,disabled:h,onChange:e=>{g(e),v(e?.[0],!0)}}):null]})]})]})},exports.ItemCount=ww,exports.LayerGroup=({label:t,caption:o,value:i,layerItems:s,onChangeForRadioVariant:a,labels:l})=>{const c=Mf("LayerGroup",l),[d,u]=n.useState({}),[h]=n.useState((e=>{const t=e.find((e=>"radio"===e.variant&&e.isDefaultSelected));return t?.name})(s));n.useEffect((()=>{let e={...d};s.forEach((n=>{n.isDefaultSelected&&(e={...e,["radio"===n.variant?t:n.name]:n.isDefaultSelected})})),u(e)}),[]);const p=(e,t,n,r)=>{const o={...d,[e]:t};u(o),n&&n(e,t,r)},f=Object.values(d).filter((e=>!0===e)).length,m=c.groupAriaLabel(t,f,o);return r.jsxs(e.Accordion.Item,{value:i,width:"100%",children:[r.jsxs(e.Accordion.ItemTrigger,{css:Nx,alignItems:"flex-start","aria-label":m,children:[r.jsxs(e.Box,{width:"full",display:"flex",flexDirection:"column",alignItems:"flex-start",children:[r.jsxs("span",{css:Dx,children:[t,r.jsx(Nv,{label:c.activeTagLabel(f),size:"small",variant:f>0?"success":"info-grey"})]}),r.jsx("div",{css:Ix,children:o})]}),r.jsx(e.Accordion.ItemIndicator,{display:"flex",children:r.jsx(If,{color:"var(--chakra-colors-neutral-700)",height:"1rem",width:"1rem"})})]}),r.jsx(e.Accordion.ItemContent,{paddingLeft:"1rem",paddingRight:"1rem",children:r.jsx(Bg,{name:t,value:h,customGap:"0",onChange:(e,t)=>p(e,!!t,a,t),children:s.map((e=>r.jsx(_x,{...e,onChange:(t,n)=>p(t,n,e.onChange)},e.label)))})})]})},exports.LayerGroupContainer=({children:t,defaultValue:n,...o})=>r.jsx("div",{css:Rx,style:{width:"100%"},children:r.jsx(e.Accordion.Root,{css:{},defaultValue:n,multiple:!0,...o,children:t})}),exports.LayerItem=_x,exports.LayerParameters=({label:t,children:o,openedByDefault:i})=>r.jsx("div",{children:r.jsx(e.Accordion.Root,{defaultValue:i?[t]:[],multiple:!0,children:r.jsxs(e.Accordion.Item,{css:Fx,value:t,children:[r.jsxs(e.Accordion.ItemTrigger,{css:qx,children:[r.jsx(e.Box,{width:"full",display:"flex",flexDirection:"column",alignItems:"flex-start",children:r.jsx("p",{css:Wx,children:t})}),r.jsx(e.Accordion.ItemIndicator,{display:"flex",children:r.jsx(If,{color:"var(--chakra-colors-neutral-700)",height:"1rem",width:"1rem"})})]}),r.jsx(e.Accordion.ItemContent,{css:Ux,children:n.Children.map(o,(e=>r.jsx("div",{className:"ds-layer-parameters-item-child",children:e})))})]})})}),exports.LegendItem=({layerName:e,dataUnit:t,onDrag:n,onUpClick:o,onDownClick:i,onRemoveClick:s,children:a,onInfoClick:l,onOpacityChanged:c,labels:d})=>{const u=Mf("LegendItem",d);return r.jsxs("div",{css:Kx,children:[r.jsx("div",{css:Gx,children:r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[r.jsx(Of,{icon:r.jsx(If,{rotate:"180"}),"aria-label":u.upLabel,onClick:o}),r.jsx(Of,{icon:r.jsx(If,{}),"aria-label":u.downLabel,onClick:i})]})}),r.jsxs("div",{style:{width:"100%"},children:[r.jsxs("div",{css:Zx,children:[r.jsxs("div",{children:[r.jsx("h3",{css:Jx,children:e}),r.jsx("p",{css:Xx,children:t})]}),r.jsx(Ef,{label:u.removeLabel,size:"small",variant:"secondary",rightIcon:r.jsx(zf,{}),onClick:s})]}),a,r.jsxs("div",{css:Yx,children:[r.jsx(Ef,{label:u.aboutDataLabel,size:"small",variant:"secondary",leftIcon:r.jsx(Df,{}),onClick:l}),r.jsx(rw,{defaultValue:80,onOpacityChanged:c})]})]})]})},exports.List=Ow,exports.MapControlsToolbar=({onZoomInClick:e,onZoomOutClick:n,onExpandClick:r,onShareClick:o,onPrintClick:i,onSettingsClick:s,onQuestionClick:a,vertical:l,expanded:c,showExpandedToggle:d,ariaLabel:u,labels:h})=>{const p=Mf("MapControlsToolbar",h),f=[{icon:t.jsx(Kf,{}),label:p.zoomInLabel,ariaLabel:p.zoomInAriaLabel,onClick:e},{icon:t.jsx(Gf,{}),label:p.zoomOutLabel,ariaLabel:p.zoomOutAriaLabel,onClick:n,gap:!0},{icon:t.jsx(Zf,{}),label:p.expandLabel,ariaLabel:p.expandAriaLabel,onClick:r,gap:!0},{icon:t.jsx(Jf,{}),label:p.shareLabel,ariaLabel:p.shareAriaLabel,onClick:o,gap:!0},{icon:t.jsx(Xf,{}),label:p.printLabel,ariaLabel:p.printAriaLabel,onClick:i,gap:!0},{icon:t.jsx(Yf,{}),label:p.settingsLabel,ariaLabel:p.settingsAriaLabel,onClick:s,gap:!0},{icon:t.jsx(Qf,{}),label:p.helpLabel,ariaLabel:p.helpAriaLabel,onClick:a}];return t.jsx(ug,{items:f,vertical:l,expanded:c,showExpandedToggle:d,ariaLabel:u||p.toolbarAriaLabel})},exports.MapMarker=vb,exports.MapMarkers=bb,exports.MapPopUp=({open:e,onOpenChange:t,anchorRef:o,header:i,content:s,footer:a,placement:c="bottom",offset:d=30,closeOnEscape:u=!0,closeOnOutsideClick:h=!1,labels:p})=>{const f=Mf("MapPopUp",p),m=n.useRef(null),{refs:g,floatingStyles:v,context:b,middlewareData:y,placement:x}=Sx({open:e,onOpenChange:t,placement:c,whileElementsMounted:Uy,middleware:[ox(d),(w={fallbackAxisSideDirection:"start"},{...Zy(w),options:[w,C]}),ix({padding:8}),sx({element:m})]});var w,C;n.useEffect((()=>{o?.current&&g.setReference(o.current)}),[o,g]);const k=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:i}=e,{enabled:s=!0,escapeKey:a=!0,outsidePress:c=!0,outsidePressEvent:d="pointerdown",referencePress:u=!1,referencePressEvent:h="pointerdown",ancestorScroll:p=!1,bubbles:f,capture:m}=t,g=yx(),v=$y("function"==typeof c?c:()=>!1),b="function"==typeof c?v:c,y=l.useRef(!1),{escapeKey:x,outsidePress:w}=Cx(f),{escapeKey:C,outsidePress:k}=Cx(m),S=l.useRef(!1),$=$y((e=>{var t;if(!n||!s||!a||"Escape"!==e.key)return;if(S.current)return;const o=null==(t=i.current.floatingContext)?void 0:t.nodeId,l=g?Cy(g.nodesRef.current,o):[];if(!x&&(e.stopPropagation(),l.length>0)){let e=!0;if(l.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)})),!e)return}r(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")})),j=$y((e=>{var t;const n=()=>{var t;$(e),null==(t=yy(e))||t.removeEventListener("keydown",n)};null==(t=yy(e))||t.addEventListener("keydown",n)})),M=$y((e=>{var t;const n=i.current.insideReactTree;i.current.insideReactTree=!1;const s=y.current;if(y.current=!1,"click"===d&&s)return;if(n)return;if("function"==typeof b&&!b(e))return;const a=yy(e),l="[data-floating-ui-inert]",c=wy(o.floating).querySelectorAll(l);let u=Sb(a)?a:null;for(;u&&!Vb(u);){const e=_b(u);if(Vb(e)||!Sb(e))break;u=e}if(c.length&&Sb(a)&&!a.matches("html,body")&&!by(a,o.floating)&&Array.from(c).every((e=>!by(u,e))))return;if($b(a)&&O){const t=Vb(a),n=Bb(a),r=/auto|scroll/,o=t||r.test(n.overflowX),i=t||r.test(n.overflowY),s=o&&a.clientWidth>0&&a.scrollWidth>a.clientWidth,l=i&&a.clientHeight>0&&a.scrollHeight>a.clientHeight,c="rtl"===n.direction,d=l&&(c?e.offsetX<=a.offsetWidth-a.clientWidth:e.offsetX>a.clientWidth),u=s&&e.offsetY>a.clientHeight;if(d||u)return}const h=null==(t=i.current.floatingContext)?void 0:t.nodeId,p=g&&Cy(g.nodesRef.current,h).some((t=>{var n;return xy(e,null==(n=t.context)?void 0:n.elements.floating)}));if(xy(e,o.floating)||xy(e,o.domReference)||p)return;const f=g?Cy(g.nodesRef.current,h):[];if(f.length>0){let e=!0;if(f.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)})),!e)return}r(!1,e,"outside-press")})),E=$y((e=>{var t;const n=()=>{var t;M(e),null==(t=yy(e))||t.removeEventListener(d,n)};null==(t=yy(e))||t.addEventListener(d,n)}));l.useEffect((()=>{if(!n||!s)return;i.current.__escapeKeyBubbles=x,i.current.__outsidePressBubbles=w;let e=-1;function t(e){r(!1,e,"ancestor-scroll")}function l(){window.clearTimeout(e),S.current=!0}function c(){e=window.setTimeout((()=>{S.current=!1}),Pb()?5:0)}const u=wy(o.floating);a&&(u.addEventListener("keydown",C?j:$,C),u.addEventListener("compositionstart",l),u.addEventListener("compositionend",c)),b&&u.addEventListener(d,k?E:M,k);let h=[];return p&&(Sb(o.domReference)&&(h=qb(o.domReference)),Sb(o.floating)&&(h=h.concat(qb(o.floating))),!Sb(o.reference)&&o.reference&&o.reference.contextElement&&(h=h.concat(qb(o.reference.contextElement)))),h=h.filter((e=>{var t;return e!==(null==(t=u.defaultView)?void 0:t.visualViewport)})),h.forEach((e=>{e.addEventListener("scroll",t,{passive:!0})})),()=>{a&&(u.removeEventListener("keydown",C?j:$,C),u.removeEventListener("compositionstart",l),u.removeEventListener("compositionend",c)),b&&u.removeEventListener(d,k?E:M,k),h.forEach((e=>{e.removeEventListener("scroll",t)})),window.clearTimeout(e)}}),[i,o,a,b,d,n,r,p,s,x,w,$,C,j,M,k,E]),l.useEffect((()=>{i.current.insideReactTree=!1}),[i,b,d]);const T=l.useMemo((()=>({onKeyDown:$,...u&&{[xx[h]]:e=>{r(!1,e.nativeEvent,"reference-press")},..."click"!==h&&{onClick(e){r(!1,e.nativeEvent,"reference-press")}}}})),[$,r,u,h]),O=l.useMemo((()=>({onKeyDown:$,onMouseDown(){y.current=!0},onMouseUp(){y.current=!0},[wx[d]]:()=>{i.current.insideReactTree=!0}})),[$,d,i]);return l.useMemo((()=>s?{reference:T,floating:O}:{}),[s,T,O])}(b,{escapeKey:u,outsidePress:h}),S=Mx(b,{role:"dialog"}),{getFloatingProps:$}=function(e){void 0===e&&(e=[]);const t=e.map((e=>null==e?void 0:e.reference)),n=e.map((e=>null==e?void 0:e.floating)),r=e.map((e=>null==e?void 0:e.item)),o=l.useCallback((t=>$x(t,e,"reference")),t),i=l.useCallback((t=>$x(t,e,"floating")),n),s=l.useCallback((t=>$x(t,e,"item")),r);return l.useMemo((()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:s})),[o,i,s])}([k,S]),{x:j,y:M}=y.arrow??{x:null,y:null},E={top:"bottom",right:"left",bottom:"top",left:"right"}[x.split("-")[0]];if(!e)return null;let T=d-1,O=4;return"left"!==E&&"right"!==E||(T=4,O=d-1),r.jsxs(r.Fragment,{children:[r.jsxs("div",{ref:g.setFloating,style:v,"aria-label":f.dialogAriaLabel,"aria-modal":!0,...$(),css:Ex,children:[r.jsxs("div",{css:Tx,children:[i,r.jsx(sg,{onClick:()=>t(!1),className:"ds-map-pop-up-close-button","aria-label":f.closeLabel})]}),r.jsx("div",{css:Ox,children:s}),a?r.jsx("div",{css:Lx,children:a}):null,r.jsx("div",{ref:m,css:Ax(T,O,j,M,E,d)})]}),r.jsx("div",{className:"fixed inset-0 z-[999] bg-black/20 backdrop-blur-[1px]",onClick:()=>h&&t(!1)})]})},exports.Menu=jm,exports.MobileSearch=({value:t,placeholder:o,showInfoMessage:i=!0,items:s=[],disabled:a,readOnly:l,id:c,name:d,autoFocus:u,autoComplete:h,onBlur:p,onFocus:f,onQueryChange:m,onCancel:g,onItemClick:v,onChange:b,labels:y})=>{const x=Mf("MobileSearch",y),[C,k]=n.useState(t??""),[S,$]=n.useState(!0),[j,M]=n.useState(!1),E=n.useRef(null),T="string"==typeof t,O=T?t:C;n.useEffect((()=>{T&&k(t)}),[T,t]),n.useEffect((()=>{m?.(O)}),[O,m]);const L=n.useMemo((()=>{const e=O.trim().toLowerCase();return e?s.filter((t=>`${t.id??""} ${t.label} ${t.caption??""}`.toLowerCase().includes(e))):s}),[s,O]),A=O.trim().length?x.matchingResultsTitle(L.length):x.recentSearchesTitle,R=O.length?r.jsx(sg,{onClick:()=>{T||k("");const e=E.current?.querySelector("input");e&&(e.value="",e.focus()),$(!0)}}):null;let N=w("neutral",500);return a?N=w("neutral",500):j&&(N=w("primary",700)),r.jsxs("div",{ref:E,css:NT,children:[r.jsxs("div",{css:DT,children:[r.jsx("div",{css:IT,children:r.jsx(e.InputGroup,{startElement:r.jsx(hm,{width:"1.25rem",height:"1.25rem",fill:N,"aria-hidden":"true"}),endElement:R,children:r.jsx(Ym,{label:"",value:O,placeholder:o??x.inputAriaLabel,onChange:e=>{T||k(e.target.value),$(!0),b?.(e)},onFocus:e=>{M(!0),$(!0),f?.(e)},onBlur:e=>{M(!1),p?.(e)},noMarginBottom:!0,type:"search","aria-label":o??x.inputAriaLabel,disabled:a,readOnly:l,id:c,name:d,autoFocus:u??!0,autoComplete:h,style:{paddingLeft:"2.5rem"}})})}),r.jsx(Ef,{css:PT,variant:"borderless",label:x.cancelLabel,onClick:()=>{T||k(""),$(!1);const e=E.current?.querySelector("input");e&&(e.value="",e.blur()),g?.()}})]}),S?r.jsxs("div",{css:zT,children:[r.jsx("h3",{css:VT,children:A}),i?r.jsx("div",{css:BT,children:r.jsx(RT,{label:x.infoLabel,variant:"info-white",size:"full-width"})}):null,r.jsx("ul",{css:HT,"aria-label":A,children:L.map((t=>r.jsx("li",{children:r.jsxs(e.chakra.button,{type:"button",css:_T,onClick:()=>(e=>{v?.(e)})(t),"aria-label":`${t.label}, ${t.caption??""}`,style:{width:"100%"},children:[t.icon??null,r.jsxs("div",{css:FT,children:[r.jsx("p",{css:qT,children:t.label}),r.jsx("p",{css:WT,children:t.caption})]})]})},t.id)))})]}):null]})},exports.MobileTabBar=({defaultValue:t,tabs:o,onTabClick:i,hideLabels:s,activationMode:a="manual",labels:l})=>{const c=Mf("MobileTabBar",l),d=o.length,[u,h]=n.useState((()=>oO(o,t)));return r.jsx("div",{css:eO,children:r.jsx(e.Tabs.Root,{width:"full",defaultValue:t||o?.[0]?.value,onValueChange:({value:e})=>(e=>{const t=oO(o,e);h(t),i&&i(e)})(e),activationMode:a,children:r.jsx(e.Tabs.List,{alignItems:"center",border:"none",children:o.map(((t,n)=>{const{label:o,icon:i,bagdeCount:a,"aria-label":l,"aria-describedby":h,disabled:p,...f}=t,m=`${t.value}-str-status`,g=u===n,v=[c.tabPositionStatus(n+1,d),g?c.selectedStatus:c.notSelectedStatus];p&&v.push(c.disabledStatus);const b=[h,m].filter(Boolean).join(" ")||void 0;return r.jsxs(e.Tabs.Trigger,{css:tO,"aria-label":l||o,"aria-disabled":!!p||void 0,"aria-describedby":b,disabled:p,...f,children:[r.jsxs("div",{css:nO,children:[i,a?r.jsx("div",{css:rO,className:"ds-badge-count",children:a}):null]}),s?null:r.jsx("p",{children:o}),r.jsx(e.VisuallyHidden,{id:m,children:v.join(", ")})]},t.value)}))})})})},exports.Modal=({header:t,content:o,footer:i,size:s="medium",width:a,height:l,maxHeight:c,draggable:d,blocking:u,open:h,onClose:p,labels:f,lazyMount:m,unmountOnExit:g,restoreFocus:v,modal:b,initialFocusEl:y,finalFocusEl:x})=>{const w=Mf("Modal",f),C=n.useRef(null);return h?r.jsx(e.Dialog.Root,{open:h,onOpenChange:p,placement:"center",scrollBehavior:"inside",closeOnInteractOutside:!d&&!u,preventScroll:!d&&!u,closeOnEscape:!u,defaultOpen:!0,lazyMount:m,unmountOnExit:g,restoreFocus:v,modal:b,initialFocusEl:y,finalFocusEl:x,children:r.jsxs(e.Portal,{children:[d?null:r.jsx(e.Dialog.Backdrop,{css:{background:"rgba(0, 0, 0, 0.64)"}}),r.jsx(YC,{disabled:!d,nodeRef:C,children:r.jsx(e.Dialog.Positioner,{ref:C,children:r.jsxs(e.Dialog.Content,{"aria-label":w.dialogAriaLabel,css:QC(s,a,l,c),children:[r.jsxs(e.Dialog.Header,{css:ek,children:[t,u?null:r.jsx(e.Dialog.CloseTrigger,{css:tk,asChild:!0,children:r.jsx(sg,{})})]}),r.jsx(e.Dialog.Body,{css:nk,children:o}),i?r.jsx(e.Dialog.Footer,{padding:"0.75rem",children:i}):null]})})})]})}):null},exports.MultiActionButton=({variant:t="primary",size:o="default",mainActionLabel:i,mainActionOnClick:s=()=>{},otherActions:a=[],disabled:l,mainActionLeftIcon:c,mainActionRightIcon:d,...u})=>{const[h,p]=n.useState(!1),f=l?`${i} action button with menu, disabled`:void 0;return r.jsxs(e.Group,{css:mg,attached:!0,tabIndex:l?0:void 0,"aria-disabled":l,"aria-label":f,role:"group",children:[r.jsx(Ef,{css:{},label:i,variant:t,size:o,onClick:s,disabled:l,leftIcon:c,rightIcon:d,...u}),r.jsxs(e.Menu.Root,{onOpenChange:({open:e})=>p(e),positioning:{placement:"bottom-end"},children:[r.jsx(e.Menu.Trigger,{css:pg(t),"data-group-item":!0,"data-last":!0,asChild:!0,children:r.jsx(Ef,{style:gg,"aria-label":`Open ${i} options`,"aria-haspopup":"menu","aria-expanded":h,variant:t,size:o,leftIcon:r.jsx(If,{"aria-hidden":"true",rotate:h?"180":"0",color:w("accessible","text-on-primary-mids")||w("primary",900)}),disabled:l})}),r.jsx(vg,{children:a.map((({label:t,value:n,onClick:i})=>r.jsx(e.Menu.Item,{css:fg(o),onClick:i,value:n,children:t},n)))})]})]})},exports.Navbar=({variant:e="default",theme:t="light",logo:o,linkRouter:i,pathname:s,navigationSection:a,utilitySection:l,actionsSection:c,maxWidth:d,fixed:u,onNavbarHeightChange:h,backgroundColor:p,labels:f})=>{const m=Mf("Navbar",f),g=n.useRef(null),v=n.useRef(null),b=n.useRef(null),[y,x]=n.useState(!1),[w,C]=n.useState(-1),[k,S]=n.useState("undefined"!=typeof window&&window?.innerWidth<=MO),[$,j]=n.useState(!1),M=i,E=n.useCallback((()=>{if(v.current&&g.current&&b.current){const e=g.current.getBoundingClientRect(),t=v.current.getBoundingClientRect(),n=b.current.getBoundingClientRect();t.width,e.width,window.innerWidth<=MO||window.innerWidth<=w?(h?.(96),x(!0)):window.innerWidth>MO&&window.innerWidth<=1440?e.right>=t.left?(h?.(96),x(!0),C(window.innerWidth)):window.innerWidth>w&&(h?.(48),x(!1),C(-1)):(h?.(48),x(!1),C(-1)),y&&(window.innerWidth<=MO||n.right>=t.left?(S(!0),h?.(48)):(S(!1),h?.(96)))}}),[w,y]);n.useEffect((()=>(E(),window.addEventListener("resize",E),()=>{window.removeEventListener("resize",E)})),[E]);const T="condensed"===e;return r.jsxs("nav",{css:iO(y&&!k,u,p,t,T),children:[r.jsxs("div",{css:aO(y&&!k,d,T),children:[r.jsxs("div",{css:lO(y&&!k||"dark"===t,T),ref:g,children:[o?r.jsx("div",{ref:b,css:cO,children:o}):null,r.jsx("div",{css:dO(y),children:a?.map((e=>e.link?r.jsx(M,{to:e.link,href:e.link,css:uO(s===e.link,t,T),children:e.label},e.label):r.jsx(jm,{theme:t,label:e.label,fontSize:T?"0.875rem":"1rem",items:e.items||[]},e.label)))})]}),r.jsx("div",{css:hO(T),ref:v,children:k?r.jsxs("button",{type:"button",onClick:()=>j(!$),"aria-label":$?m.closeMenuLabel:m.openMenuLabel,"aria-expanded":$,css:mO(t),children:[$?m.closeLabel:m.menuLabel,$?r.jsx(zf,{height:T?"0.75rem":"1rem",width:T?"0.75rem":"1rem"}):r.jsx(lm,{height:T?"0.75rem":"1rem",width:T?"0.75rem":"1rem"})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{css:hO(T),children:l?.map(((e,t)=>r.jsx("div",{css:pO(y),children:e},t)))}),c?.length?r.jsx("div",{css:fO(y),children:c.map((e=>r.jsx(Ef,{...e},e.ariaLabel)))}):null]})})]}),y&&!k?r.jsx("div",{css:sO(t,T),children:a?.map((e=>e.link?r.jsx(M,{to:e.link,href:e.link,css:uO(s===e.link,t,T),children:e.label},e.label):r.jsx(jm,{theme:t,label:e.label,fontSize:T?"0.875rem":"1rem",items:e.items||[]},e.label)))}):null,k?r.jsx(jO,{theme:t,variant:e,navigationSection:a,utilitySection:l,actionsSection:c,linkRouter:i,isOpen:$,setIsOpen:j,pathname:s,resolvedLabels:m}):null]})},exports.NavigationRail=({tabs:t=[],defaultValue:o,onTabClick:i,children:s,onOpenChange:a,labels:l})=>{const c=Mf("NavigationRail",l),[d,u]=n.useState(!1),[h,p]=n.useState(o||t?.[0]?.value),f=e=>{p(e),i&&i(e)},[m]=e.useMediaQuery(["(max-width: 48rem)"]);return m?r.jsxs(e.Tabs.Root,{defaultValue:h,onValueChange:({value:e})=>f(e),children:[r.jsx(e.Tabs.List,{style:{display:"flex",overflowX:"auto",whiteSpace:"nowrap",padding:"0.5rem",gap:"0.5rem"},children:t.map((t=>r.jsx(e.Tabs.Trigger,{value:t.value,css:{"--indicator-color":w("primary",500),flexShrink:0,padding:"0.625rem 1rem",color:w("neutral",600),"&[data-selected]":{color:w("neutral",800),fontWeight:600}},children:t.label},t.value)))}),t.map((t=>r.jsx(e.Tabs.Content,{value:t.value,children:s},t.value)))]}):r.jsxs("div",{style:{height:"calc(100vh - 3rem - 3.5rem)",position:"fixed",top:"3rem",left:0,display:"flex"},children:[r.jsxs("div",{css:EO,children:[r.jsx(e.Tabs.Root,{defaultValue:o||t?.[0]?.value,orientation:"horizontal",width:"full",onValueChange:({value:e})=>{f(e)},children:r.jsx(e.Tabs.List,{alignItems:"center",border:"none",style:{flexDirection:"column"},children:t.map((t=>r.jsx(e.Tabs.Trigger,{css:TO,"aria-label":t["aria-label"]||t.label,...t,children:r.jsxs(e.Box,{display:"flex",alignItems:"center",flexDirection:"column",gap:"0.3125rem",className:"ds-tab-label",children:[t.icon?r.jsx("div",{css:OO,children:t.icon}):null,r.jsx("p",{children:t.label})]})},t.label)))})}),s?r.jsx(e.Collapsible.Root,{onOpenChange:({open:e})=>{u(e),a&&a(!e)},children:r.jsxs(e.Collapsible.Trigger,{css:LO,children:[r.jsx("div",{css:OO,children:d?r.jsx(Af,{}):r.jsx(Lf,{})}),r.jsxs("div",{className:"ds-tab-label",children:[r.jsx("p",{children:d?c.showLabel:c.hideLabel}),r.jsx("p",{children:c.sidebarLabel})]})]})}):null]}),s?r.jsx(e.Collapsible.Root,{defaultOpen:!0,open:!d,children:r.jsx(e.Collapsible.Content,{height:"100%",children:r.jsx("div",{css:AO,role:"tabpanel","aria-labelledby":h,children:s})})}):null]})},exports.OptionCard=({defaultValue:t,items:n,onValueChange:o,variant:s,itemWidth:a,hideControl:l})=>r.jsx(e.RadioCard.Root,{defaultValue:t,onValueChange:o,children:r.jsx(e.HStack,{alignItems:"flex-start",flexWrap:"wrap",gap:"0.75rem",children:n?.map((t=>{return r.jsxs(e.RadioCard.Item,{css:(o=a,c=t.selectedColor,d=t.selectedBackgroundColor,i.css`
|
|
3930
3930
|
width: ${o||"15.0625rem"};
|
|
3931
3931
|
min-height: 4.375rem;
|
|
3932
3932
|
padding: ${k(300)};
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import * as React$1 from 'react';
|
|
|
5
5
|
import React__default, { ReactNode, ReactElement, Ref } from 'react';
|
|
6
6
|
import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
|
|
7
7
|
import { Placement } from '@floating-ui/react';
|
|
8
|
+
import { MaybeElement } from '@zag-js/types';
|
|
8
9
|
|
|
9
10
|
type ColorVariant = 'neutral' | 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'accessible';
|
|
10
11
|
type FontSizeToken = 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 1000 | 1100;
|
|
@@ -1485,9 +1486,15 @@ type ModalProps = {
|
|
|
1485
1486
|
height?: SizeValue;
|
|
1486
1487
|
maxHeight?: SizeValue;
|
|
1487
1488
|
labels?: Partial<ModalLabels>;
|
|
1489
|
+
lazyMount?: boolean;
|
|
1490
|
+
unmountOnExit?: boolean;
|
|
1491
|
+
restoreFocus?: boolean;
|
|
1492
|
+
modal?: boolean;
|
|
1493
|
+
initialFocusEl?: () => MaybeElement;
|
|
1494
|
+
finalFocusEl?: () => MaybeElement;
|
|
1488
1495
|
};
|
|
1489
1496
|
|
|
1490
|
-
declare const Modal: ({ header, content, footer, size, width, height, maxHeight, draggable, blocking, open, onClose, labels, }: ModalProps) => _emotion_react_jsx_runtime.JSX.Element | null;
|
|
1497
|
+
declare const Modal: ({ header, content, footer, size, width, height, maxHeight, draggable, blocking, open, onClose, labels, lazyMount, unmountOnExit, restoreFocus, modal, initialFocusEl, finalFocusEl, }: ModalProps) => _emotion_react_jsx_runtime.JSX.Element | null;
|
|
1491
1498
|
|
|
1492
1499
|
type PanelProps = {
|
|
1493
1500
|
header?: React.ReactNode;
|
package/dist/index.esm.js
CHANGED
|
@@ -2637,7 +2637,7 @@ import{createSystem as e,defaultConfig as t,Button as n,Box as r,Spinner as o,Ic
|
|
|
2637
2637
|
top: ${He(300)};
|
|
2638
2638
|
`,U$=$e`
|
|
2639
2639
|
padding: ${He(300)};
|
|
2640
|
-
`,K$=({header:e,content:t,footer:n,size:r="medium",width:o,height:i,maxHeight:s,draggable:l,blocking:c,open:d,onClose:u,labels:h})=>{const
|
|
2640
|
+
`,K$=({header:e,content:t,footer:n,size:r="medium",width:o,height:i,maxHeight:s,draggable:l,blocking:c,open:d,onClose:u,labels:h,lazyMount:p,unmountOnExit:f,restoreFocus:m,modal:g,initialFocusEl:v,finalFocusEl:b})=>{const y=qm("Modal",h),w=ae(null);return d?ye(z.Root,{open:d,onOpenChange:u,placement:"center",scrollBehavior:"inside",closeOnInteractOutside:!l&&!c,preventScroll:!l&&!c,closeOnEscape:!c,defaultOpen:!0,lazyMount:p,unmountOnExit:f,restoreFocus:m,modal:g,initialFocusEl:v,finalFocusEl:b,children:be(a,{children:[l?null:ye(z.Backdrop,{css:{background:"rgba(0, 0, 0, 0.64)"}}),ye(j$,{disabled:!l,nodeRef:w,children:ye(z.Positioner,{ref:w,children:be(z.Content,{"aria-label":y.dialogAriaLabel,css:F$(r,o,i,s),children:[be(z.Header,{css:q$,children:[e,c?null:ye(z.CloseTrigger,{css:W$,asChild:!0,children:ye(Sv,{})})]}),ye(z.Body,{css:U$,children:t}),n?ye(z.Footer,{padding:"0.75rem",children:n}):null]})})})]})}):null},Z$=e=>$e`
|
|
2641
2641
|
height: 100%;
|
|
2642
2642
|
width: ${e||"20rem"};
|
|
2643
2643
|
background-color: ${ze("neutral",100)};
|