@proximahq-dev/map 1.1.1 → 1.1.3
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/README.md +1 -1
- package/dist/proxima-map.umd.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
### Import mapbox style at the top of the page
|
|
8
8
|
|
|
9
|
-
```<link rel="stylesheet" href="https://unpkg.com/@proximahq-dev/map@latest/dist/
|
|
9
|
+
```<link rel="stylesheet" href="https://unpkg.com/@proximahq-dev/map@latest/dist/style.css">```
|
|
10
10
|
|
|
11
11
|
### Create a wrapper element to contain the component
|
|
12
12
|
|
package/dist/proxima-map.umd.js
CHANGED
|
@@ -2364,7 +2364,7 @@ html body {
|
|
|
2364
2364
|
top: ${o}px !important;
|
|
2365
2365
|
left: ${D}px !important;
|
|
2366
2366
|
}
|
|
2367
|
-
`),()=>{document.head.removeChild(F)}},[s]),vr.jsx(kU,{isPresent:s,childRef:f,sizeRef:_,children:B.cloneElement(i,{ref:f})})}const NU=({children:i,initial:s,isPresent:c,onExitComplete:f,custom:_,presenceAffectsLayout:T,mode:E})=>{const A=rb(BU),o=B.useId(),D=B.useCallback(V=>{A.set(V,!0);for(const W of A.values())if(!W)return;f&&f()},[A,f]),F=B.useMemo(()=>({id:o,initial:s,isPresent:c,custom:_,onExitComplete:D,register:V=>(A.set(V,!1),()=>A.delete(V))}),T?[Math.random(),D]:[c,D]);return B.useMemo(()=>{A.forEach((V,W)=>A.set(W,!1))},[c]),B.useEffect(()=>{!c&&!A.size&&f&&f()},[c]),E==="popLayout"&&(i=vr.jsx(FU,{isPresent:c,children:i})),vr.jsx(Oy.Provider,{value:F,children:i})};function BU(){return new Map}const jy=i=>i.key||"";function TP(i){const s=[];return B.Children.forEach(i,c=>{B.isValidElement(c)&&s.push(c)}),s}const VU=({children:i,exitBeforeEnter:s,custom:c,initial:f=!0,onExitComplete:_,presenceAffectsLayout:T=!0,mode:E="sync"})=>{const A=B.useMemo(()=>TP(i),[i]),o=A.map(jy),D=B.useRef(!0),F=B.useRef(A),V=rb(()=>new Map),[W,Z]=B.useState(A),[Q,ee]=B.useState(A);cP(()=>{D.current=!1,F.current=A;for(let ne=0;ne<Q.length;ne++){const ue=jy(Q[ne]);o.includes(ue)?V.delete(ue):V.get(ue)!==!0&&V.set(ue,!1)}},[Q,o.length,o.join("-")]);const K=[];if(A!==W){let ne=[...A];for(let ue=0;ue<Q.length;ue++){const Te=Q[ue],ve=jy(Te);o.includes(ve)||(ne.splice(ue,0,Te),K.push(Te))}E==="wait"&&K.length&&(ne=K),ee(TP(ne)),Z(A);return}const{forceRender:ae}=B.useContext(G1);return vr.jsx(vr.Fragment,{children:Q.map(ne=>{const ue=jy(ne),Te=A===Q||o.includes(ue),ve=()=>{if(V.has(ue))V.set(ue,!0);else return;let Se=!0;V.forEach(Ce=>{Ce||(Se=!1)}),Se&&(ae==null||ae(),ee(F.current),_&&_())};return vr.jsx(NU,{isPresent:Te,initial:!D.current||f?void 0:!1,custom:Te?void 0:c,presenceAffectsLayout:T,mode:E,onExitComplete:Te?void 0:ve,children:ne},ue)})})},jU=()=>{const{categories:i,handleFilterChange:s,filters:c,maxDistance:f}=D_(),_=i.filter(T=>T.name!=="DEVELOPMENT").map(T=>({label:Jv(T.name),value:T.name}));return vr.jsxs("div",{className:"filter-content",children:[vr.jsxs("div",{className:"filter-section",children:[vr.jsx("h4",{children:"Type"}),vr.jsx(zp,{mode:"multiple",style:{width:"100%"},placeholder:"Select categories",options:_,value:c.Category||[],onChange:T=>s("Category",T),allowClear:!0,maxTagCount:5,listHeight:300})]}),vr.jsxs("div",{className:"filter-section",children:[vr.jsx("h4",{children:"Distance"}),vr.jsxs("div",{className:"slider-range-labels",children:[vr.jsx("span",{children:"0 km"}),vr.jsxs("span",{children:[f," km"]})]}),vr.jsx(d6,{range:{draggableTrack:!0},min:0,max:f,step:.1,value:c.distanceInKm||[0,f],onChange:T=>s("distanceInKm",T)})]})]})},$U=()=>{const{sort:i,handleSort:s}=D_(),c=`${i.orderBy}-${i.order}`,f=_=>{if(_===c)s("","asc");else{const[T,E]=_.split("-");s(T,E)}};return vr.jsxs("div",{className:"sort-content",children:[vr.jsxs("div",{className:"sort-section",children:[vr.jsx("h4",{children:"Distance"}),vr.jsxs("div",{className:"sort-options",children:[vr.jsxs("div",{className:"sort-option",children:[vr.jsx("span",{className:"label",children:"Closest"}),vr.jsx(Np,{checked:c==="distanceInKm-asc",onChange:()=>f("distanceInKm-asc")})]}),vr.jsxs("div",{className:"sort-option",children:[vr.jsx("span",{className:"label",children:"Farthest"}),vr.jsx(Np,{checked:c==="distanceInKm-desc",onChange:()=>f("distanceInKm-desc")})]})]})]}),vr.jsxs("div",{className:"sort-section",children:[vr.jsx("h4",{children:"Point of Interest"}),vr.jsxs("div",{className:"sort-options",children:[vr.jsxs("div",{className:"sort-option",children:[vr.jsx("span",{className:"label",children:"A - Z"}),vr.jsx(Np,{checked:c==="properties.Name-asc",onChange:()=>f("properties.Name-asc")})]}),vr.jsxs("div",{className:"sort-option",children:[vr.jsx("span",{className:"label",children:"Z - A"}),vr.jsx(Np,{checked:c==="properties.Name-desc",onChange:()=>f("properties.Name-desc")})]})]})]})]})},UU=()=>vr.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[vr.jsx("path",{d:"M10 16.25C13.4518 16.25 16.25 13.4518 16.25 10C16.25 6.54822 13.4518 3.75 10 3.75C6.54822 3.75 3.75 6.54822 3.75 10C3.75 13.4518 6.54822 16.25 10 16.25Z",stroke:"#4D5456","stroke-width":"1.25","stroke-linecap":"round","stroke-linejoin":"round"}),vr.jsx("path",{d:"M10 12.5C11.3807 12.5 12.5 11.3807 12.5 10C12.5 8.61929 11.3807 7.5 10 7.5C8.61929 7.5 7.5 8.61929 7.5 10C7.5 11.3807 8.61929 12.5 10 12.5Z",stroke:"#4D5456","stroke-width":"1.25","stroke-linecap":"round","stroke-linejoin":"round"}),vr.jsx("path",{d:"M10 3.33341V1.66675",stroke:"#4D5456","stroke-width":"1.25","stroke-linecap":"round","stroke-linejoin":"round"}),vr.jsx("path",{d:"M3.33341 10H1.66675",stroke:"#4D5456","stroke-width":"1.25","stroke-linecap":"round","stroke-linejoin":"round"}),vr.jsx("path",{d:"M10 16.6667V18.3334",stroke:"#4D5456","stroke-width":"1.25","stroke-linecap":"round","stroke-linejoin":"round"}),vr.jsx("path",{d:"M16.6667 10H18.3334",stroke:"#4D5456","stroke-width":"1.25","stroke-linecap":"round","stroke-linejoin":"round"})]}),HU=()=>vr.jsx("svg",{width:"11",height:"11",viewBox:"0 0 11 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:vr.jsx("path",{d:"M1.75293 14L4.00987 11.2222M8.52376 14L7.01913 11.2222L4.76219 9.13889L5.5145 4.97222M5.5145 2.19444C5.5145 2.37862 5.59377 2.55526 5.73485 2.68549C5.87594 2.81572 6.06729 2.88889 6.26682 2.88889C6.46634 2.88889 6.6577 2.81572 6.79879 2.68549C6.93987 2.55526 7.01913 2.37862 7.01913 2.19444C7.01913 2.01027 6.93987 1.83363 6.79879 1.7034C6.6577 1.57316 6.46634 1.5 6.26682 1.5C6.06729 1.5 5.87594 1.57316 5.73485 1.7034C5.59377 1.83363 5.5145 2.01027 5.5145 2.19444Z",stroke:"currentColor",strokeWidth:"1.38889",strokeLinecap:"round",strokeLinejoin:"round"})}),GU=()=>vr.jsx("svg",{width:"11",height:"11",viewBox:"0 0 512 512",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:vr.jsx("path",{d:"M38.59,225c-2.31,78.89-.44,161.14,3.08,202,0,31.59,21.18,26.37,21.18,26.37H82.77v34.1C82.77,501,96.69,512,113.86,512S145,501,145,487.51v-34.1H376.35v34.1c0,13.54,14,24.49,31.14,24.49s31.14-11,31.14-24.49v-34.1h6.48s25,3.41,26.58-11.45c0-40.78,2.59-131.21.44-216.55a25.7,25.7,0,0,0,18.17-24.54V150.8a25.83,25.83,0,0,0-23.77-25.63C462.34,84.33,455.68,52.49,445.11,40,401.71-11.44,97.41-15.19,62.91,40c-8.48,13.54-14.42,45.23-18.38,85.28A25.72,25.72,0,0,0,21.7,150.8v50.07A25.75,25.75,0,0,0,38.59,225Zm102,188.1A33.2,33.2,0,1,1,173.77,380,33.2,33.2,0,0,1,140.55,413.13Zm229,0A33.2,33.2,0,1,1,402.82,380,33.22,33.22,0,0,1,369.58,413.13ZM137.18,47.3H370.85V82.69H137.18Zm-40.93,55H411.78V267.83H96.25Z",fill:"currentColor"})}),WU=()=>{var Se;const{filteredFeatures:i,categories:s,setActiveFeature:c,filters:f,developmentPin:_,clearFilters:T,clearSort:E,sort:A,maxDistance:o}=D_(),[D,F]=B.useState(null),[V,W]=B.useState(null),[Z,Q]=B.useState(!0),[ee,K]=B.useState(null),ae=Ce=>{F(D===Ce.properties.Number?null:Ce.properties.Number),c(Ce)},ne=Ce=>{W(V===Ce?null:Ce)},ue=((Se=f.Category)==null?void 0:Se.length)>0||f.distanceInKm&&(f.distanceInKm[0]>0||f.distanceInKm[1]<o),Te=A.orderBy!=="",ve=Ce=>{K(ee===Ce?null:Ce)};return vr.jsxs("div",{className:`hover-widget-container ${Z?"expanded":"collapsed"}`,children:[vr.jsxs("div",{className:"widget-header",onClick:()=>Q(!Z),children:[vr.jsx("h2",{className:"widget-title",children:"Points of Interest"}),vr.jsx(Op,{className:"expand-icon",style:{fontSize:"18px"}})]}),vr.jsxs(lb.div,{initial:!1,animate:{height:Z?"auto":0,opacity:Z?1:0},transition:{duration:.3,ease:"easeInOut"},style:{overflow:"auto"},children:[vr.jsxs("div",{className:"categories-container",children:[vr.jsx("div",{className:"development-item",children:vr.jsxs("div",{className:"poi-item",onClick:()=>{c(_),F(_.properties.Number)},children:[vr.jsx("span",{className:"poi-name",children:_.properties.Name}),vr.jsx(UU,{})]})}),vr.jsx(VU,{initial:!1,children:s.filter(Ce=>Ce.name==="DEVELOPMENT"?!1:i.some(ye=>ye.properties.Category===Ce.name&&ye.properties.Number!==0)).map(Ce=>vr.jsxs(lb.div,{className:"category-section",initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{opacity:{duration:.2},height:{duration:.3}},children:[vr.jsxs("div",{className:"category-header",onClick:()=>ne(Ce.name),children:[vr.jsx("span",{children:Jv(Ce.name)}),vr.jsx("span",{className:"expand-icon",children:V===Ce.name?vr.jsx(Op,{style:{fontSize:"12px"}}):vr.jsx(Op,{style:{fontSize:"12px",transform:"rotate(-90deg)"}})})]}),vr.jsx(lb.div,{initial:!1,animate:{height:V===Ce.name?"auto":0,opacity:V===Ce.name?1:0},transition:{duration:.3,ease:"easeInOut"},style:{overflow:"hidden"},children:vr.jsx("div",{className:"category-content",children:i.filter(Ae=>Ae.properties.Category===Ce.name&&Ae.properties.Number!==0).map(Ae=>vr.jsxs("div",{className:"poi-container",children:[vr.jsxs("div",{className:"poi-item",onClick:()=>ae(Ae),children:[vr.jsxs("span",{className:"poi-number",children:[Ae.properties.Number,"."]}),vr.jsx("span",{className:"poi-name",children:Ae.properties.Name})]}),D===Ae.properties.Number&&vr.jsxs("div",{className:"distance-info",children:[vr.jsx(HU,{}),vr.jsxs("span",{children:[Ae.distanceInMin," min"]}),vr.jsx(m6,{}),vr.jsxs("span",{children:[Ae.drivingDistanceInMin," min"]}),vr.jsx(GU,{}),vr.jsxs("span",{children:[Ae.busDistanceInMin," min"]})]})]},Ae.properties.Number))})})]},Ce.name))})]}),vr.jsx("div",{className:"filters-container",children:vr.jsx(cy,{activeKey:ee==="filters"?["filters"]:[],onChange:()=>ve("filters"),children:vr.jsx(cy.Panel,{header:vr.jsxs("div",{className:"filter-header",children:[vr.jsxs("div",{className:"header-left",children:[vr.jsx("span",{children:"Filters"}),ue&&vr.jsx(RT,{style:{backgroundColor:"#F5222D",color:"white",borderRadius:"20px",padding:"0 6px",fontWeight:600},count:i.filter(Ce=>Ce.properties.Number!==0).length})]}),vr.jsxs("div",{className:"header-right",children:[ue&&vr.jsx(my,{type:"link",onClick:T,children:"Clear"}),vr.jsx(Op,{className:"expand-icon",style:{fontSize:"18px"}})]})]}),children:vr.jsx(jU,{})},"filters")})}),vr.jsx("div",{className:"sort-container",children:vr.jsx(cy,{activeKey:ee==="sort"?["sort"]:[],onChange:()=>ve("sort"),children:vr.jsx(cy.Panel,{header:vr.jsxs("div",{className:"sort-header",children:[vr.jsx("div",{className:"header-left",children:vr.jsx("span",{children:"Sort"})}),vr.jsxs("div",{className:"header-right",children:[Te&&vr.jsx(my,{type:"link",onClick:E,children:"Clear"}),vr.jsx(Op,{className:"expand-icon",style:{fontSize:"18px"}})]})]}),children:vr.jsx($U,{})},"sort")})})]})]})},qU=({mapboxToken:i,mapboxStyleUrl:s,initialCenter:c,initialZoom:f,initialFeatures:_})=>vr.jsx(FL,{initialFeatures:_,children:vr.jsxs("div",{className:"proxima-map-container",children:[vr.jsx("div",{className:"map-wrapper",children:vr.jsx(BL,{accessToken:i,styleUrl:s,center:c,zoom:f})}),vr.jsx(WU,{})]})}),ZU=async(i,s,c,f)=>{var _,T;try{const E=await fetch("https://cms.proximahq.io/graphql",{method:"POST",headers:{"Content-Type":"application/json",authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiMDZiNDgwOWYtYWQyZS00MzE1LTkxMGItYWQ2ZDBlNDk4ZjQ1In0sImlhdCI6MTY4MDczMzMzM30.yxzZfDId5rR7jt7LLVWItSYbDOq8N5tT0juLC61dVUc"},body:JSON.stringify({query:i,variables:s,dataString:c,nestedString:f})});if(!E.ok)throw console.error(`HTTP error: ${E.status}: ${E.statusText}`),new Error(`HTTP error: ${E.status}: ${E.statusText}`);const A=await E.json();if(A.errors)throw new Error(`GraphQL error: ${c}: ${A.errors.map(D=>D.message).join(", ")}`);const o=f?(_=A.data)==null?void 0:_[c][f]:(T=A.data)==null?void 0:T[c];if(!o&&!A.data.hasOwnProperty(c))throw new Error(`${c} is missing`);return o}catch(E){throw E}},KU=async i=>await ZU(`query MapboxInfo($slug: String!, $pageCategory: String) {
|
|
2367
|
+
`),()=>{document.head.removeChild(F)}},[s]),vr.jsx(kU,{isPresent:s,childRef:f,sizeRef:_,children:B.cloneElement(i,{ref:f})})}const NU=({children:i,initial:s,isPresent:c,onExitComplete:f,custom:_,presenceAffectsLayout:T,mode:E})=>{const A=rb(BU),o=B.useId(),D=B.useCallback(V=>{A.set(V,!0);for(const W of A.values())if(!W)return;f&&f()},[A,f]),F=B.useMemo(()=>({id:o,initial:s,isPresent:c,custom:_,onExitComplete:D,register:V=>(A.set(V,!1),()=>A.delete(V))}),T?[Math.random(),D]:[c,D]);return B.useMemo(()=>{A.forEach((V,W)=>A.set(W,!1))},[c]),B.useEffect(()=>{!c&&!A.size&&f&&f()},[c]),E==="popLayout"&&(i=vr.jsx(FU,{isPresent:c,children:i})),vr.jsx(Oy.Provider,{value:F,children:i})};function BU(){return new Map}const jy=i=>i.key||"";function TP(i){const s=[];return B.Children.forEach(i,c=>{B.isValidElement(c)&&s.push(c)}),s}const VU=({children:i,exitBeforeEnter:s,custom:c,initial:f=!0,onExitComplete:_,presenceAffectsLayout:T=!0,mode:E="sync"})=>{const A=B.useMemo(()=>TP(i),[i]),o=A.map(jy),D=B.useRef(!0),F=B.useRef(A),V=rb(()=>new Map),[W,Z]=B.useState(A),[Q,ee]=B.useState(A);cP(()=>{D.current=!1,F.current=A;for(let ne=0;ne<Q.length;ne++){const ue=jy(Q[ne]);o.includes(ue)?V.delete(ue):V.get(ue)!==!0&&V.set(ue,!1)}},[Q,o.length,o.join("-")]);const K=[];if(A!==W){let ne=[...A];for(let ue=0;ue<Q.length;ue++){const Te=Q[ue],ve=jy(Te);o.includes(ve)||(ne.splice(ue,0,Te),K.push(Te))}E==="wait"&&K.length&&(ne=K),ee(TP(ne)),Z(A);return}const{forceRender:ae}=B.useContext(G1);return vr.jsx(vr.Fragment,{children:Q.map(ne=>{const ue=jy(ne),Te=A===Q||o.includes(ue),ve=()=>{if(V.has(ue))V.set(ue,!0);else return;let Se=!0;V.forEach(Ce=>{Ce||(Se=!1)}),Se&&(ae==null||ae(),ee(F.current),_&&_())};return vr.jsx(NU,{isPresent:Te,initial:!D.current||f?void 0:!1,custom:Te?void 0:c,presenceAffectsLayout:T,mode:E,onExitComplete:Te?void 0:ve,children:ne},ue)})})},jU=()=>{const{categories:i,handleFilterChange:s,filters:c,maxDistance:f}=D_(),_=i.filter(T=>T.name!=="DEVELOPMENT").map(T=>({label:Jv(T.name),value:T.name}));return vr.jsxs("div",{className:"filter-content",children:[vr.jsxs("div",{className:"filter-section",children:[vr.jsx("h4",{children:"Type"}),vr.jsx(zp,{mode:"multiple",style:{width:"100%"},placeholder:"Select categories",options:_,value:c.Category||[],onChange:T=>s("Category",T),allowClear:!0,maxTagCount:5,listHeight:300})]}),vr.jsxs("div",{className:"filter-section",children:[vr.jsx("h4",{children:"Distance"}),vr.jsxs("div",{className:"slider-range-labels",children:[vr.jsx("span",{children:"0 km"}),vr.jsxs("span",{children:[f," km"]})]}),vr.jsx(d6,{range:{draggableTrack:!0},min:0,max:f,step:.1,value:c.distanceInKm||[0,f],pushable:.6,onChange:T=>s("distanceInKm",T)})]})]})},$U=()=>{const{sort:i,handleSort:s}=D_(),c=`${i.orderBy}-${i.order}`,f=_=>{if(_===c)s("","asc");else{const[T,E]=_.split("-");s(T,E)}};return vr.jsxs("div",{className:"sort-content",children:[vr.jsxs("div",{className:"sort-section",children:[vr.jsx("h4",{children:"Distance"}),vr.jsxs("div",{className:"sort-options",children:[vr.jsxs("div",{className:"sort-option",children:[vr.jsx("span",{className:"label",children:"Closest"}),vr.jsx(Np,{checked:c==="distanceInKm-asc",onChange:()=>f("distanceInKm-asc")})]}),vr.jsxs("div",{className:"sort-option",children:[vr.jsx("span",{className:"label",children:"Farthest"}),vr.jsx(Np,{checked:c==="distanceInKm-desc",onChange:()=>f("distanceInKm-desc")})]})]})]}),vr.jsxs("div",{className:"sort-section",children:[vr.jsx("h4",{children:"Point of Interest"}),vr.jsxs("div",{className:"sort-options",children:[vr.jsxs("div",{className:"sort-option",children:[vr.jsx("span",{className:"label",children:"A - Z"}),vr.jsx(Np,{checked:c==="properties.Name-asc",onChange:()=>f("properties.Name-asc")})]}),vr.jsxs("div",{className:"sort-option",children:[vr.jsx("span",{className:"label",children:"Z - A"}),vr.jsx(Np,{checked:c==="properties.Name-desc",onChange:()=>f("properties.Name-desc")})]})]})]})]})},UU=()=>vr.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[vr.jsx("path",{d:"M10 16.25C13.4518 16.25 16.25 13.4518 16.25 10C16.25 6.54822 13.4518 3.75 10 3.75C6.54822 3.75 3.75 6.54822 3.75 10C3.75 13.4518 6.54822 16.25 10 16.25Z",stroke:"#4D5456","stroke-width":"1.25","stroke-linecap":"round","stroke-linejoin":"round"}),vr.jsx("path",{d:"M10 12.5C11.3807 12.5 12.5 11.3807 12.5 10C12.5 8.61929 11.3807 7.5 10 7.5C8.61929 7.5 7.5 8.61929 7.5 10C7.5 11.3807 8.61929 12.5 10 12.5Z",stroke:"#4D5456","stroke-width":"1.25","stroke-linecap":"round","stroke-linejoin":"round"}),vr.jsx("path",{d:"M10 3.33341V1.66675",stroke:"#4D5456","stroke-width":"1.25","stroke-linecap":"round","stroke-linejoin":"round"}),vr.jsx("path",{d:"M3.33341 10H1.66675",stroke:"#4D5456","stroke-width":"1.25","stroke-linecap":"round","stroke-linejoin":"round"}),vr.jsx("path",{d:"M10 16.6667V18.3334",stroke:"#4D5456","stroke-width":"1.25","stroke-linecap":"round","stroke-linejoin":"round"}),vr.jsx("path",{d:"M16.6667 10H18.3334",stroke:"#4D5456","stroke-width":"1.25","stroke-linecap":"round","stroke-linejoin":"round"})]}),HU=()=>vr.jsx("svg",{width:"11",height:"11",viewBox:"0 0 11 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:vr.jsx("path",{d:"M1.75293 14L4.00987 11.2222M8.52376 14L7.01913 11.2222L4.76219 9.13889L5.5145 4.97222M5.5145 2.19444C5.5145 2.37862 5.59377 2.55526 5.73485 2.68549C5.87594 2.81572 6.06729 2.88889 6.26682 2.88889C6.46634 2.88889 6.6577 2.81572 6.79879 2.68549C6.93987 2.55526 7.01913 2.37862 7.01913 2.19444C7.01913 2.01027 6.93987 1.83363 6.79879 1.7034C6.6577 1.57316 6.46634 1.5 6.26682 1.5C6.06729 1.5 5.87594 1.57316 5.73485 1.7034C5.59377 1.83363 5.5145 2.01027 5.5145 2.19444Z",stroke:"currentColor",strokeWidth:"1.38889",strokeLinecap:"round",strokeLinejoin:"round"})}),GU=()=>vr.jsx("svg",{width:"11",height:"11",viewBox:"0 0 512 512",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:vr.jsx("path",{d:"M38.59,225c-2.31,78.89-.44,161.14,3.08,202,0,31.59,21.18,26.37,21.18,26.37H82.77v34.1C82.77,501,96.69,512,113.86,512S145,501,145,487.51v-34.1H376.35v34.1c0,13.54,14,24.49,31.14,24.49s31.14-11,31.14-24.49v-34.1h6.48s25,3.41,26.58-11.45c0-40.78,2.59-131.21.44-216.55a25.7,25.7,0,0,0,18.17-24.54V150.8a25.83,25.83,0,0,0-23.77-25.63C462.34,84.33,455.68,52.49,445.11,40,401.71-11.44,97.41-15.19,62.91,40c-8.48,13.54-14.42,45.23-18.38,85.28A25.72,25.72,0,0,0,21.7,150.8v50.07A25.75,25.75,0,0,0,38.59,225Zm102,188.1A33.2,33.2,0,1,1,173.77,380,33.2,33.2,0,0,1,140.55,413.13Zm229,0A33.2,33.2,0,1,1,402.82,380,33.22,33.22,0,0,1,369.58,413.13ZM137.18,47.3H370.85V82.69H137.18Zm-40.93,55H411.78V267.83H96.25Z",fill:"currentColor"})}),WU=()=>{var Se;const{filteredFeatures:i,categories:s,setActiveFeature:c,filters:f,developmentPin:_,clearFilters:T,clearSort:E,sort:A,maxDistance:o}=D_(),[D,F]=B.useState(null),[V,W]=B.useState(null),[Z,Q]=B.useState(!0),[ee,K]=B.useState(null),ae=Ce=>{F(D===Ce.properties.Number?null:Ce.properties.Number),c(Ce)},ne=Ce=>{W(V===Ce?null:Ce)},ue=((Se=f.Category)==null?void 0:Se.length)>0||f.distanceInKm&&(f.distanceInKm[0]>0||f.distanceInKm[1]<o),Te=A.orderBy!=="",ve=Ce=>{K(ee===Ce?null:Ce)};return vr.jsxs("div",{className:`hover-widget-container ${Z?"expanded":"collapsed"}`,children:[vr.jsxs("div",{className:"widget-header",onClick:()=>Q(!Z),children:[vr.jsx("h2",{className:"widget-title",children:"Points of Interest"}),vr.jsx(Op,{className:"expand-icon",style:{fontSize:"18px"}})]}),vr.jsxs(lb.div,{initial:!1,animate:{height:Z?"auto":0,opacity:Z?1:0},transition:{duration:.3,ease:"easeInOut"},style:{overflow:"auto"},children:[vr.jsxs("div",{className:"categories-container",children:[vr.jsx("div",{className:"development-item",children:vr.jsxs("div",{className:"poi-item",onClick:()=>{c(_),F(_.properties.Number)},children:[vr.jsx("span",{className:"poi-name",children:_.properties.Name}),vr.jsx(UU,{})]})}),vr.jsx(VU,{initial:!1,children:s.filter(Ce=>Ce.name==="DEVELOPMENT"?!1:i.some(ye=>ye.properties.Category===Ce.name&&ye.properties.Number!==0)).map(Ce=>vr.jsxs(lb.div,{className:"category-section",initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{opacity:{duration:.2},height:{duration:.3}},children:[vr.jsxs("div",{className:"category-header",onClick:()=>ne(Ce.name),children:[vr.jsx("span",{children:Jv(Ce.name)}),vr.jsx("span",{className:"expand-icon",children:V===Ce.name?vr.jsx(Op,{style:{fontSize:"12px"}}):vr.jsx(Op,{style:{fontSize:"12px",transform:"rotate(-90deg)"}})})]}),vr.jsx(lb.div,{initial:!1,animate:{height:V===Ce.name?"auto":0,opacity:V===Ce.name?1:0},transition:{duration:.3,ease:"easeInOut"},style:{overflow:"hidden"},children:vr.jsx("div",{className:"category-content",children:i.filter(Ae=>Ae.properties.Category===Ce.name&&Ae.properties.Number!==0).map(Ae=>vr.jsxs("div",{className:"poi-container",children:[vr.jsxs("div",{className:"poi-item",onClick:()=>ae(Ae),children:[vr.jsxs("span",{className:"poi-number",children:[Ae.properties.Number,"."]}),vr.jsx("span",{className:"poi-name",children:Ae.properties.Name})]}),D===Ae.properties.Number&&vr.jsxs("div",{className:"distance-info",children:[vr.jsx(HU,{}),vr.jsxs("span",{children:[Ae.distanceInMin," min"]}),vr.jsx(m6,{}),vr.jsxs("span",{children:[Ae.drivingDistanceInMin," min"]}),vr.jsx(GU,{}),vr.jsxs("span",{children:[Ae.busDistanceInMin," min"]})]})]},Ae.properties.Number))})})]},Ce.name))})]}),vr.jsx("div",{className:"filters-container",children:vr.jsx(cy,{activeKey:ee==="filters"?["filters"]:[],onChange:()=>ve("filters"),children:vr.jsx(cy.Panel,{header:vr.jsxs("div",{className:"filter-header",children:[vr.jsxs("div",{className:"header-left",children:[vr.jsx("span",{children:"Filters"}),ue&&vr.jsx(RT,{style:{backgroundColor:"#F5222D",color:"white",borderRadius:"20px",padding:"0 6px",fontWeight:600},count:i.filter(Ce=>Ce.properties.Number!==0).length})]}),vr.jsxs("div",{className:"header-right",children:[ue&&vr.jsx(my,{type:"link",onClick:T,children:"Clear"}),vr.jsx(Op,{className:"expand-icon",style:{fontSize:"18px"}})]})]}),children:vr.jsx(jU,{})},"filters")})}),vr.jsx("div",{className:"sort-container",children:vr.jsx(cy,{activeKey:ee==="sort"?["sort"]:[],onChange:()=>ve("sort"),children:vr.jsx(cy.Panel,{header:vr.jsxs("div",{className:"sort-header",children:[vr.jsx("div",{className:"header-left",children:vr.jsx("span",{children:"Sort"})}),vr.jsxs("div",{className:"header-right",children:[Te&&vr.jsx(my,{type:"link",onClick:E,children:"Clear"}),vr.jsx(Op,{className:"expand-icon",style:{fontSize:"18px"}})]})]}),children:vr.jsx($U,{})},"sort")})})]})]})},qU=({mapboxToken:i,mapboxStyleUrl:s,initialCenter:c,initialZoom:f,initialFeatures:_})=>vr.jsx(FL,{initialFeatures:_,children:vr.jsxs("div",{className:"proxima-map-container",children:[vr.jsx("div",{className:"map-wrapper",children:vr.jsx(BL,{accessToken:i,styleUrl:s,center:c,zoom:f})}),vr.jsx(WU,{})]})}),ZU=async(i,s,c,f)=>{var _,T;try{const E=await fetch("https://cms.proximahq.io/graphql",{method:"POST",headers:{"Content-Type":"application/json",authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiMDZiNDgwOWYtYWQyZS00MzE1LTkxMGItYWQ2ZDBlNDk4ZjQ1In0sImlhdCI6MTY4MDczMzMzM30.yxzZfDId5rR7jt7LLVWItSYbDOq8N5tT0juLC61dVUc"},body:JSON.stringify({query:i,variables:s,dataString:c,nestedString:f})});if(!E.ok)throw console.error(`HTTP error: ${E.status}: ${E.statusText}`),new Error(`HTTP error: ${E.status}: ${E.statusText}`);const A=await E.json();if(A.errors)throw new Error(`GraphQL error: ${c}: ${A.errors.map(D=>D.message).join(", ")}`);const o=f?(_=A.data)==null?void 0:_[c][f]:(T=A.data)==null?void 0:T[c];if(!o&&!A.data.hasOwnProperty(c))throw new Error(`${c} is missing`);return o}catch(E){throw E}},KU=async i=>await ZU(`query MapboxInfo($slug: String!, $pageCategory: String) {
|
|
2368
2368
|
project(slug: $slug, pageCategory: $pageCategory) {
|
|
2369
2369
|
id
|
|
2370
2370
|
slug
|