react-listing-engine 0.7.7 → 0.7.9
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 +12 -0
- package/dist/chunk-76JZ5SOA.cjs +2 -0
- package/dist/chunk-Q55G4XMJ.js +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +42 -14
- package/dist/index.d.ts +42 -14
- package/dist/index.js +1 -1
- package/dist/{listing-app-B2i6Ohza.d.cts → listing-app-4RjoW6x-.d.ts} +6 -6
- package/dist/{listing-app-z3cah3BH.d.ts → listing-app-B8lXqvd5.d.cts} +6 -6
- package/dist/{map-provider.interface-l-oTHRTZ.d.cts → map-provider.interface-B_8-GtsW.d.cts} +7 -0
- package/dist/{map-provider.interface-l-oTHRTZ.d.ts → map-provider.interface-B_8-GtsW.d.ts} +7 -0
- package/dist/maps/google/index.d.cts +1 -1
- package/dist/maps/google/index.d.ts +1 -1
- package/dist/styled/index.cjs +1 -1
- package/dist/styled/index.d.cts +3 -3
- package/dist/styled/index.d.ts +3 -3
- package/dist/styled/index.js +1 -1
- package/dist/styles.css +74 -3
- package/dist/testing/index.cjs +1 -1
- package/dist/testing/index.d.cts +5 -2
- package/dist/testing/index.d.ts +5 -2
- package/dist/testing/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-CT3V6J2U.js +0 -2
- package/dist/chunk-JMYPJAXI.cjs +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# react-listing-engine
|
|
2
2
|
|
|
3
|
+
## 0.7.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Numbered offset pagination for Paged mode: `PageRequest.offset`, `engine.goToPage(index)`, `pagination.pageIndex` in the store, and `ListingPagination` now renders a classic "1 2 3 … N" pager (windowed past 7 pages, aria-complete) in Paged mode with a known total — "Load more" remains the Infinite-mode UI. The styled layout scrolls the list back to top on page jumps. The in-memory testing adapter honors `offset`.
|
|
8
|
+
|
|
9
|
+
## 0.7.8
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Reposition and rename the just-added filter-bar slot: `filterBarEnd` -> `filterBarStart`, rendered BETWEEN the search box and the quick-filters row (search, [slot] | filters...). The end position read as an afterthought; an advanced-filters trigger belongs next to the search box.
|
|
14
|
+
|
|
3
15
|
## 0.7.7
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5;"use client";
|
|
2
|
+
var J= (_class =class{__init() {this.listeners=new Set}constructor(e){;_class.prototype.__init.call(this);this.state=this.freezeState({filters:{...e.filters},results:{items:[],nextCursor:null},bounds:null,selection:null,hovered:null,pagination:{mode:_nullishCoalesce(e.mode, () => ("paged")),loading:!1,pageIndex:0},layers:{},points:{}})}getState(){return this.state}setFilters(e){this.setState({filters:{...this.state.filters,...e}})}setResults(e){this.setState({results:{items:[...e.items],nextCursor:e.nextCursor,total:e.total}})}appendResults(e){this.setState({results:{items:[...this.state.results.items,...e.items],nextCursor:e.nextCursor,total:e.total}})}setBounds(e){this.setState({bounds:e?{...e}:null})}setSelection(e){this.setState({selection:e})}setHovered(e){this.setState({hovered:e})}setLayerVisible(e,i){this.setState({layers:{...this.state.layers,[e]:i}})}setLoading(e){this.setState({pagination:{...this.state.pagination,loading:e}})}setPageIndex(e){this.setState({pagination:{...this.state.pagination,pageIndex:e}})}setPoints(e,i){this.setState({points:{...this.state.points,[e]:[...i]}})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setState(e){this.state=this.freezeState({...this.state,...e}),this.notify()}notify(){for(let e of this.listeners)e()}freezeState(e){Object.freeze(e.filters),Object.freeze(e.results.items),Object.freeze(e.results),e.bounds&&Object.freeze(e.bounds),Object.freeze(e.pagination),Object.freeze(e.layers);for(let i of Object.values(e.points))Object.freeze(i);return Object.freeze(e.points),Object.freeze(e)}}, _class);var U= (_class2 =class{constructor() { _class2.prototype.__init2.call(this); }__init2() {this.defs=new Map}add(e){if(this.defs.has(e.key))throw new Error(`FilterRegistry: filter "${e.key}" is already registered`);return this.defs.set(e.key,{...e}),this}remove(e){return this.defs.delete(e),this}replace(e,i){if(!this.defs.has(e))throw new Error(`FilterRegistry: cannot replace unregistered filter "${e}"`);return this.defs.set(e,{...i,key:e}),this}reorder(e){let i=this.list(),r=e.filter(s=>this.defs.has(s));r.forEach((s,o)=>{this.defs.get(s).order=o});let n=new Set(r);return i.filter(s=>!n.has(s.key)).forEach((s,o)=>{s.order=r.length+o}),this}list(){return[...this.defs.values()].sort((e,i)=>e.order-i.order)}has(e){return this.defs.has(e)}toFilters(e){return this.list().filter(r=>Object.hasOwn(e,r.key)).map(r=>r.toParams(e[r.key])).reduce((r,n)=>({...r,...n}),{})}activeKeys(e){return this.list().filter(i=>_optionalChain([i, 'access', _2 => _2.isActive, 'optionalCall', _3 => _3(e)])).map(i=>i.key)}clearedParams(){return this.list().reduce((e,i)=>Object.assign(e,i.toParams(i.fromParams({}))),{})}}, _class2);var Y= (_class3 =class{constructor() { _class3.prototype.__init3.call(this); }__init3() {this.defs=new Map}add(e){if(this.defs.has(e.id))throw new Error(`DatasetRegistry: dataset "${e.id}" is already registered`);return this.defs.set(e.id,{...e}),this}get(e){return this.defs.get(e)}has(e){return this.defs.has(e)}list(){return[...this.defs.values()]}visibleIds(){return this.list().filter(e=>_optionalChain([e, 'access', _4 => _4.visible, 'optionalCall', _5 => _5()])!==!1).map(e=>e.id)}}, _class3);var ee= (_class4 =class{constructor() { _class4.prototype.__init4.call(this); }__init4() {this.map=new Map}dispose(){this.map.clear()}emit(e){let i=this.map.get(e.type);if(i)for(let n of[...i])n(e);let r=this.map.get("*");if(r)for(let n of[...r])n(e)}on(e,i){let r=this.map.get(e);return r||(r=new Set,this.map.set(e,r)),r.add(i),()=>{r.delete(i)}}}, _class4);var Be={pagination:"paged",pageSize:20,debounceMs:250};var te=class{constructor(e){this.options=Object.freeze({...Be,...e})}};var ie= (_class5 =class{__init5() {this.emitter=new ee}__init6() {this.debounceTimer=null}__init7() {this.debounceResolve=null}__init8() {this.queryToken=0}__init9() {this.pointsToken=0}__init10() {this.mapHandle=null}constructor(e){;_class5.prototype.__init5.call(this);_class5.prototype.__init6.call(this);_class5.prototype.__init7.call(this);_class5.prototype.__init8.call(this);_class5.prototype.__init9.call(this);_class5.prototype.__init10.call(this);this.datasets=e.datasets,this.filters=_nullishCoalesce(e.filters, () => (new U)),this.map=e.map,this.config=new te(e.config);let i=_nullishCoalesce(e.primaryDatasetId, () => (_optionalChain([this, 'access', _6 => _6.datasets, 'access', _7 => _7.list, 'call', _8 => _8(), 'access', _9 => _9[0], 'optionalAccess', _10 => _10.id])));if(i==null||!this.datasets.has(i))throw new Error(`ListingEngine: primary dataset "${_nullishCoalesce(i, () => (""))}" is not registered \u2014 pass a valid primaryDatasetId or register at least one dataset`);this.primaryDatasetId=i,this.store=new J({filters:_nullishCoalesce(e.initialFilters, () => ({})),mode:this.config.options.pagination})}get state(){return this.store.getState()}get options(){return this.config.options}applyFilters(e){this.store.setFilters(e),this.emitter.emit({type:"FiltersChanged",filters:this.currentFilters()}),this.clearDebounce();let i=++this.queryToken,r=this.config.options.debounceMs;return r<=0?this.runQuery(i):new Promise(n=>{this.debounceResolve=n,this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.debounceResolve=null,n(this.runQuery(i))},r)})}async loadPage(){let e=this.state.results.nextCursor;if(e===null)return;let i=++this.queryToken,r=this.primaryDataset();this.store.setLoading(!0);try{let n=await r.adapter.list(this.currentFilters(),{cursor:e,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.config.options.pagination==="infinite"?this.store.appendResults(n):this.store.setResults(n),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.items.length})}finally{i===this.queryToken&&this.store.setLoading(!1)}}async goToPage(e){if(e<0)return;let i=++this.queryToken,r=this.primaryDataset();this.store.setLoading(!0);try{let n=await r.adapter.list(this.currentFilters(),{offset:e*this.config.options.pageSize,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.store.setResults(n),this.store.setPageIndex(e),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.items.length})}finally{i===this.queryToken&&this.store.setLoading(!1)}}async loadPoints(e){this.store.setBounds(e),this.emitter.emit({type:"BoundsChanged",bounds:e});let i=this.currentFilters(),r=++this.pointsToken;await Promise.allSettled(this.datasets.visibleIds().map(async n=>{let s=this.datasets.get(n);if(!s)return;let o=await s.adapter.getPoints(i,e);r===this.pointsToken&&this.store.setPoints(n,o)}))}setMapHandle(e){this.mapHandle=e}fitBounds(e){!this.map||!this.mapHandle||this.map.fitBounds(this.mapHandle,e)}selectPoint(e,i){this.store.setSelection(i);let r=_optionalChain([this, 'access', _11 => _11.state, 'access', _12 => _12.points, 'access', _13 => _13[e], 'optionalAccess', _14 => _14.find, 'call', _15 => _15(n=>n.id===i)]);r&&this.emitter.emit({type:"PointClicked",datasetId:e,id:r.id,entity:r.entity})}setHovered(e,i){this.store.setHovered(i)}toggleLayer(e){let r=!(_nullishCoalesce(this.state.layers[e], () => (!0)));this.store.setLayerVisible(e,r),this.emitter.emit({type:"LayerToggled",datasetId:e,visible:r})}subscribe(e){return this.store.subscribe(e)}on(e,i){return this.emitter.on(e,i)}dispose(){this.clearDebounce(),this.emitter.dispose(),this.mapHandle=null}async runQuery(e){if(e!==this.queryToken)return;let i=this.primaryDataset();this.store.setLoading(!0);try{let r=await i.adapter.list(this.currentFilters(),{cursor:null,limit:this.config.options.pageSize});if(e!==this.queryToken)return;this.store.setResults(r),this.store.setPageIndex(0),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:r.items.length})}finally{e===this.queryToken&&this.store.setLoading(!1)}}primaryDataset(){return this.datasets.get(this.primaryDatasetId)}currentFilters(){return this.store.getState().filters}clearDebounce(){this.debounceTimer!==null&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.debounceResolve!==null&&(this.debounceResolve(),this.debounceResolve=null)}}, _class5);function He(...t){let e={config:{},filters:new U,datasets:new Y};for(let i of t)i(e);return e}var Ae=t=>e=>{e.config={...e.config,...t}},ze= exports.j =t=>e=>{e.map=t},Ue= exports.k =t=>e=>{e.datasets.add(t)},Ke= exports.l =t=>e=>{t(e.filters)},Ni= exports.m =t=>e=>{e.urlSync=t},Ve= exports.n =t=>e=>{e.initialFilters=t},Ri= exports.o =t=>e=>{e.primaryDatasetId=t};var _react = require('react');var _jsxruntime = require('react/jsx-runtime');function vt(t){return String(_nullishCoalesce(_optionalChain([t, 'optionalAccess', _16 => _16.title]), () => ("")))}var bt=({item:t})=>_jsxruntime.jsx.call(void 0, "div",{children:vt(t)}),Lt=()=>_jsxruntime.jsx.call(void 0, "div",{}),me= exports.p =()=>_jsxruntime.jsx.call(void 0, "div",{}),Tt=({children:t})=>_jsxruntime.jsx.call(void 0, "div",{children:t}),Pt=({children:t})=>_jsxruntime.jsx.call(void 0, "div",{children:t}),Ft=({value:t,onChange:e,placeholder:i})=>_jsxruntime.jsx.call(void 0, "input",{type:"search",value:t,placeholder:i,onChange:r=>e(r.target.value),"aria-label":_nullishCoalesce(i, () => ("Search"))}),St=()=>_jsxruntime.jsx.call(void 0, "div",{role:"status",children:"No results"}),Ct=()=>_jsxruntime.jsx.call(void 0, "div",{role:"status","aria-busy":"true",children:"Loading\u2026"}),kt=({count:t})=>_jsxruntime.jsxs.call(void 0, "div",{children:[t," results"]}),wt=({children:t})=>_jsxruntime.jsx.call(void 0, "div",{children:t}),E={Card:bt,Marker:Lt,Popup:me,Sidebar:Tt,FilterPanel:Pt,Search:Ft,Empty:St,Loading:Ct,ResultHeader:kt,Toolbar:wt},qe=_react.createContext.call(void 0, E);function $e(t){let{Card:e,Marker:i,Popup:r,Sidebar:n,FilterPanel:s,Search:o,Empty:d,Loading:p,ResultHeader:l,Toolbar:a,children:g}=t,b={Card:_nullishCoalesce(e, () => (E.Card)),Marker:_nullishCoalesce(i, () => (E.Marker)),Popup:_nullishCoalesce(r, () => (E.Popup)),Sidebar:_nullishCoalesce(n, () => (E.Sidebar)),FilterPanel:_nullishCoalesce(s, () => (E.FilterPanel)),Search:_nullishCoalesce(o, () => (E.Search)),Empty:_nullishCoalesce(d, () => (E.Empty)),Loading:_nullishCoalesce(p, () => (E.Loading)),ResultHeader:_nullishCoalesce(l, () => (E.ResultHeader)),Toolbar:_nullishCoalesce(a, () => (E.Toolbar))};return _jsxruntime.jsx.call(void 0, qe.Provider,{value:b,children:g})}function P(){return _react.useContext.call(void 0, qe)}var re=_react.createContext.call(void 0, null);function y(){let t=_react.useContext.call(void 0, re);if(t===null)throw new Error("useListing must be used within a <ListingProvider>");return t}function F(){let t=y(),e=_react.useCallback.call(void 0, r=>t.subscribe(r),[t]),i=_react.useCallback.call(void 0, ()=>t.state,[t]);return _react.useSyncExternalStore.call(void 0, e,i,i)}function ne(){let t=y(),e=F(),i=_react.useCallback.call(void 0, n=>t.applyFilters(n),[t]),r=_react.useCallback.call(void 0, (n,s)=>t.applyFilters({[n]:s}),[t]);return{filters:e.filters,set:i,setField:r}}function ge({className:t,groupClassName:e,hideLabels:i,draft:r,onDraftChange:n}={}){let s=y(),{FilterPanel:o}=P(),{filters:d}=ne(),p=r!==void 0&&n!==void 0,l=p?r:d;return _jsxruntime.jsx.call(void 0, o,{children:_jsxruntime.jsx.call(void 0, "div",{className:_nullishCoalesce(t, () => ("space-y-5")),children:s.filters.list().map(a=>{if(typeof a.render=="string")return _jsxruntime.jsx.call(void 0, "div",{"data-filter":a.key,className:e},a.key);let g=a.render;return _jsxruntime.jsxs.call(void 0, "div",{className:e,children:[a.label&&!i&&_jsxruntime.jsx.call(void 0, "div",{className:"mb-1.5 text-[13px] font-medium text-foreground",children:a.label}),_jsxruntime.jsx.call(void 0, g,{value:a.fromParams(l),onChange:b=>p?n(a.toParams(b)):void s.applyFilters(a.toParams(b))})]},a.key)})})})}function K(){return F().results}function Mt(t,e){if(t&&typeof t=="object"&&"id"in t){let i=t.id;if(typeof i=="string"||typeof i=="number")return i}return e}function Ge({className:t}={}){let e=y(),{items:i}=K(),{pagination:r,selection:n}=F(),{Card:s,Empty:o,Loading:d}=P();return r.loading&&i.length===0?_jsxruntime.jsx.call(void 0, d,{}):i.length===0?_jsxruntime.jsx.call(void 0, o,{}):_jsxruntime.jsx.call(void 0, "div",{role:"list",className:t,children:i.map((p,l)=>{let a=Mt(p,l);return _jsxruntime.jsx.call(void 0, s,{item:p,selected:n===a,onSelect:()=>e.selectPoint(e.primaryDatasetId,a)},a)})})}var _reactdom = require('react-dom');var _t={west:-179.9,south:-85,east:179.9,north:85},Ze=.1,Xe=.02;function Ot(t){if(t.length===0)return null;let e=t[0].lng,i=t[0].lng,r=t[0].lat,n=t[0].lat;for(let{lat:d,lng:p}of t)p<e&&(e=p),p>i&&(i=p),d<r&&(r=d),d>n&&(n=d);let s=n>r?(n-r)*Ze:Xe,o=i>e?(i-e)*Ze:Xe;return{west:e-o,east:i+o,south:r-s,north:n+s}}function Ye(t){let{center:e,zoom:i,fallback:r,mapControls:n}=t,s=y(),o=F(),d=_react.useRef.call(void 0, null),p=_react.useRef.call(void 0, null),l=_react.useRef.call(void 0, null),[a,g]=_react.useState.call(void 0, !1),b=_react.useRef.call(void 0, !1),x=_react.useRef.call(void 0, !1),C=_react.useRef.call(void 0, !1),c=s.map;_react.useEffect.call(void 0, ()=>{let T=l.current;if(!c||!T)return;let h=[];for(let u of Object.keys(o.points)){if(o.layers[u]===!1)continue;let f=s.datasets.get(u),I=_nullishCoalesce(o.points[u], () => ([])),$={id:u,markers:I.map(R=>({id:R.id,position:R.position,iconUrl:_optionalChain([f, 'optionalAccess', _17 => _17.marker, 'access', _18 => _18.iconUrl, 'optionalCall', _19 => _19(R.entity)]),element:_optionalChain([f, 'optionalAccess', _20 => _20.marker, 'access', _21 => _21.element, 'optionalCall', _22 => _22(R.entity)])})),clustering:_optionalChain([f, 'optionalAccess', _23 => _23.clustering]),onMarkerClick:R=>s.selectPoint(u,R)};h.push(c.renderLayer(T,$))}return()=>{h.forEach(u=>u())}},[s,c,a,o.points,o.layers]),_react.useEffect.call(void 0, ()=>{if(!d.current||!c)return;let T=d.current,h=!1,u=null;return(async()=>{let f=await c.mount(T,{center:e,zoom:i,fullscreenTarget:_nullishCoalesce(p.current, () => (void 0))});if(h){c.destroy(f);return}l.current=f,s.setMapHandle(f),u=c.onBoundsChange(f,I=>{C.current?C.current=!1:x.current=!0,s.loadPoints(I)}),g(!0),s.loadPoints(_t)})(),()=>{h=!0,_optionalChain([u, 'optionalCall', _24 => _24()]),l.current&&(c.destroy(l.current),l.current=null,s.setMapHandle(null)),g(!1)}},[s,c]),_react.useEffect.call(void 0, ()=>{let T=l.current;if(!c||!T||e||b.current||x.current)return;let h=[];for(let f of Object.keys(o.points))if(o.layers[f]!==!1)for(let I of _nullishCoalesce(o.points[f], () => ([])))h.push(I.position);let u=Ot(h);u&&(b.current=!0,C.current=!0,c.fitBounds(T,u))},[c,e,a,o.points,o.layers]),_react.useEffect.call(void 0, ()=>{_optionalChain([c, 'optionalAccess', _25 => _25.updateMarkerStates, 'call', _26 => _26(o.selection,o.hovered)])},[c,a,o.selection,o.hovered]);let{Popup:L}=P(),N=L!==me,k=_nullishCoalesce(o.points[s.primaryDatasetId], () => ([])),z=o.selection!=null?k.find(T=>T.id===o.selection):void 0,[w,D]=_react.useState.call(void 0, null),X=_react.useRef.call(void 0, z);return X.current=z,_react.useEffect.call(void 0, ()=>{let T=l.current;if(!c||!T||!N)return;let h=X.current;if(!h)return;let u=c.mountOverlay(h.position);D({entity:h.entity,position:h.position,container:u.container});let f=()=>s.selectPoint(s.primaryDatasetId,null),I=R=>{R.key==="Escape"&&f()};document.addEventListener("keydown",I);let $=c.onMapClick(f);return()=>{document.removeEventListener("keydown",I),$(),u.unmount(),D(null)}},[s,c,a,o.selection,N]),_jsxruntime.jsxs.call(void 0, "div",{ref:p,className:"relative h-full min-h-0 w-full",children:[_jsxruntime.jsxs.call(void 0, "div",{ref:d,className:!c&&r?"flex h-full min-h-0 w-full items-center justify-center":"h-full min-h-0 w-full",children:[!c&&r,N&&w?_reactdom.createPortal.call(void 0, _jsxruntime.jsx.call(void 0, L,{entity:w.entity,onClose:()=>s.selectPoint(s.primaryDatasetId,null)}),w.container):null]}),n!=null&&_jsxruntime.jsx.call(void 0, "div",{className:"pointer-events-none absolute inset-0",children:_jsxruntime.jsx.call(void 0, "div",{className:"pointer-events-auto",children:n})})]})}var ye="gap";function Bt(t,e){if(t<=7)return Array.from({length:t},(s,o)=>o+1);let i=Math.max(2,e-1),r=Math.min(t-1,e+1),n=[1];i>2&&n.push(ye);for(let s=i;s<=r;s+=1)n.push(s);return r<t-1&&n.push(ye),n.push(t),n}function et(){let t=y(),{results:e,pagination:i}=F();if(i.mode==="infinite")return e.nextCursor==null?null:_jsxruntime.jsx.call(void 0, "button",{type:"button",disabled:i.loading,onClick:()=>{t.loadPage()},children:"Load more"});let r=t.options.pageSize,{pageIndex:n}=i,s=n+1,o=e.total!=null?Math.ceil(e.total/r):null,d=o!=null?s<o:e.nextCursor!=null||e.items.length>=r;if(o!=null?o<=1:n===0&&!d)return null;let p=l=>()=>{t.goToPage(l)};return _jsxruntime.jsxs.call(void 0, "nav",{className:"rle-pagination","aria-label":"Pagination",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-page-btn rle-page-btn--nav","aria-label":"Previous page",disabled:i.loading||n===0,onClick:p(n-1),children:"\u2039"}),o!=null&&Bt(o,s).map((l,a)=>l===ye?_jsxruntime.jsx.call(void 0, "span",{className:"rle-page-ellipsis",children:"\u2026"},`gap-${a}`):_jsxruntime.jsx.call(void 0, "button",{type:"button",className:l===s?"rle-page-btn rle-page-btn--active":"rle-page-btn","aria-label":`Page ${l}`,"aria-current":l===s?"page":void 0,disabled:i.loading,onClick:p(l-1),children:l},l)),_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-page-btn rle-page-btn--nav","aria-label":"Next page",disabled:i.loading||!d,onClick:p(n+1),children:"\u203A"})]})}function tt(){let{items:t,total:e}=K(),{ResultHeader:i}=P();return _jsxruntime.jsx.call(void 0, i,{count:t.length,total:e})}function it(t,e){let i=y(),r=_react.useRef.call(void 0, e);r.current=e,_react.useEffect.call(void 0, ()=>i.on(t,n=>r.current(n)),[i,t])}function nt(t){let{children:e,...i}=t,[r]=_react.useState.call(void 0, ()=>i),[n,s]=_react.useState.call(void 0, null);return _react.useEffect.call(void 0, ()=>{let o=new ie({datasets:r.datasets,filters:r.filters,config:r.config,map:r.map,initialFilters:r.initialFilters,primaryDatasetId:r.primaryDatasetId});return r.urlSync&&r.urlSync.start(o),s(o),()=>{r.urlSync&&r.urlSync.stop(),o.dispose(),s(d=>d===o?null:d)}},[r]),n?_jsxruntime.jsx.call(void 0, re.Provider,{value:n,children:e}):null}function V(t){return typeof t!="number"?t:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(t)}function qt(t){return t?"rle-card rle-card--selected":"rle-card"}function he({item:t,selected:e,onSelect:i}){let r=_nullishCoalesce(t, () => ({})),n=qt(e),s=_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[r.imageUrl?_jsxruntime.jsx.call(void 0, "img",{src:r.imageUrl,alt:_nullishCoalesce(r.title, () => ("")),className:"rle-card-media"}):_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-media rle-card-media--placeholder","aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{className:"rle-card-body",children:[r.title&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-title",children:r.title}),r.subtitle&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-address",children:r.subtitle}),r.badge&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-info",children:_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-info-item",children:r.badge})}),r.price!=null&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-price",children:V(r.price)})]})]});return i?_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:i,"aria-pressed":_nullishCoalesce(e, () => (!1)),className:n,children:s}):_jsxruntime.jsx.call(void 0, "article",{className:n,children:s})}function ve(t){return _jsxruntime.jsxs.call(void 0, "div",{role:"status",className:"rle-empty",children:[_jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",className:"rle-empty-icon","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"11",cy:"11",r:"7"}),_jsxruntime.jsx.call(void 0, "path",{d:"m21 21-4.3-4.3"})]}),_jsxruntime.jsx.call(void 0, "p",{className:"rle-empty-title",children:"No results"}),_jsxruntime.jsx.call(void 0, "p",{className:"rle-empty-hint",children:"Try adjusting your filters or search terms."})]})}function be({children:t}){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-panel",children:t})}function Le(t){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-loading",role:"status","aria-busy":"true","aria-label":"Loading results",children:Array.from({length:3}).map((e,i)=>_jsxruntime.jsxs.call(void 0, "div",{className:"rle-loading-item",children:[_jsxruntime.jsx.call(void 0, "div",{className:"rle-skeleton",style:{aspectRatio:"4 / 3",width:"100%"}}),_jsxruntime.jsx.call(void 0, "div",{className:"rle-skeleton",style:{height:16,width:"65%"}}),_jsxruntime.jsx.call(void 0, "div",{className:"rle-skeleton",style:{height:12,width:"35%"}})]},i))})}function Te({point:t}){let e=_nullishCoalesce(t.entity, () => ({}));return _jsxruntime.jsx.call(void 0, "span",{className:"rle-pin",children:e.price!=null?V(e.price):""})}function Fe({entity:t,onClose:e}){let i=_nullishCoalesce(t, () => ({}));return _jsxruntime.jsxs.call(void 0, "div",{className:"rle-popup",role:"group","aria-label":"Location details",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:e,"aria-label":"Close",className:"rle-popup-close",children:_jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "path",{d:"M18 6 6 18"}),_jsxruntime.jsx.call(void 0, "path",{d:"m6 6 12 12"})]})}),_jsxruntime.jsxs.call(void 0, "div",{children:[i.title&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-title",children:i.title}),i.subtitle&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-address",children:i.subtitle}),i.price!=null&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-price",children:V(i.price)})]})]})}function Se({count:t,total:e}){let i=e!=null&&e!==t?`${t} of ${e} results`:`${t} results`;return _jsxruntime.jsx.call(void 0, "div",{className:"rle-result-header",children:i})}function Ce({value:t,onChange:e,placeholder:i}){return _jsxruntime.jsx.call(void 0, "input",{type:"search",value:t,placeholder:i,onChange:r=>e(r.target.value),"aria-label":_nullishCoalesce(i, () => ("Search")),className:"rle-input"})}function ke({children:t}){return _jsxruntime.jsx.call(void 0, "aside",{className:"rle-sidebar",children:t})}function we({children:t}){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-toolbar",children:t})}var at={Card:he,Marker:Te,Popup:Fe,Sidebar:ke,FilterPanel:be,Search:Ce,Empty:ve,Loading:Le,ResultHeader:Se,Toolbar:we};function lt({view:t,onViewChange:e}){return _jsxruntime.jsx.call(void 0, "nav",{className:"rle-bottom-nav","aria-label":"Listing navigation",children:_jsxruntime.jsxs.call(void 0, "div",{className:"rle-viewtoggle",role:"group","aria-label":"View",children:[_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:`rle-viewtoggle__btn${t==="list"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":t==="list",onClick:()=>e("list"),children:[_jsxruntime.jsx.call(void 0, Yt,{}),"List"]}),_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:`rle-viewtoggle__btn${t==="map"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":t==="map",onClick:()=>e("map"),children:[_jsxruntime.jsx.call(void 0, ei,{}),"Map"]})]})})}function Yt(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "line",{x1:"8",y1:"6",x2:"20",y2:"6"}),_jsxruntime.jsx.call(void 0, "line",{x1:"8",y1:"12",x2:"20",y2:"12"}),_jsxruntime.jsx.call(void 0, "line",{x1:"8",y1:"18",x2:"20",y2:"18"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"6",x2:"4.01",y2:"6"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"12",x2:"4.01",y2:"12"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"18",x2:"4.01",y2:"18"})]})}function ei(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "polygon",{points:"1 6 8 3 16 6 23 3 23 18 16 21 8 18 1 21 1 6"}),_jsxruntime.jsx.call(void 0, "line",{x1:"8",y1:"3",x2:"8",y2:"18"}),_jsxruntime.jsx.call(void 0, "line",{x1:"16",y1:"6",x2:"16",y2:"21"})]})}function pt({open:t,onOpenChange:e,title:i,children:r,footer:n}){let s=_react.useRef.call(void 0, null),[o,d]=_react.useState.call(void 0, !1),[p,l]=_react.useState.call(void 0, !1);return _react.useEffect.call(void 0, ()=>{if(!t){l(!1),d(!1);return}d(!0);let a=requestAnimationFrame(()=>l(!0));return()=>cancelAnimationFrame(a)},[t]),_react.useEffect.call(void 0, ()=>{if(!o)return;let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a}},[o]),_react.useEffect.call(void 0, ()=>{if(!o)return;_optionalChain([s, 'access', _27 => _27.current, 'optionalAccess', _28 => _28.focus, 'call', _29 => _29()]);function a(g){g.key==="Escape"&&e(!1)}return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[o,e]),!o||typeof document>"u"?null:_reactdom.createPortal.call(void 0, _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "div",{className:`rle-sheet-backdrop${p?" rle-sheet-backdrop--open":""}`,onClick:()=>e(!1),"aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{ref:s,className:`rle-sheet${p?" rle-sheet--open":""}`,role:"dialog","aria-modal":"true","aria-label":i,tabIndex:-1,children:[_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__handle","aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{className:"rle-sheet__header",children:[i&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__title",children:i}),_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-sheet__close",onClick:()=>e(!1),"aria-label":"Close",children:_jsxruntime.jsx.call(void 0, ri,{})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__body",children:r}),n&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__footer",children:n})]})]}),document.body)}function ri(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "path",{d:"M18 6 6 18"}),_jsxruntime.jsx.call(void 0, "path",{d:"m6 6 12 12"})]})}function ct({search:t,onFiltersClick:e,filterCount:i=0,action:r}){let{Search:n}=P();return _jsxruntime.jsxs.call(void 0, "header",{className:"rle-mobile-header",children:[t&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-mobile-header__search",children:_jsxruntime.jsx.call(void 0, n,{value:t.value,onChange:t.onChange,placeholder:t.placeholder})}),_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"rle-btn rle-mobile-header__btn",onClick:e,children:[_jsxruntime.jsx.call(void 0, si,{}),_jsxruntime.jsx.call(void 0, "span",{children:"Filters"}),i>0&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-mobile-header__count",children:i})]}),r&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-btn rle-mobile-header__btn rle-mobile-header__btn--icon",onClick:r.onClick,"aria-label":r.label,children:_nullishCoalesce(r.icon, () => (_jsxruntime.jsx.call(void 0, oi,{})))})]})}function si(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"6",x2:"20",y2:"6"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"9",cy:"6",r:"2",fill:"currentColor",stroke:"none"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"12",x2:"20",y2:"12"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"15",cy:"12",r:"2",fill:"currentColor",stroke:"none"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"18",x2:"20",y2:"18"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"11",cy:"18",r:"2",fill:"currentColor",stroke:"none"})]})}function oi(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "line",{x1:"12",y1:"5",x2:"12",y2:"19"}),_jsxruntime.jsx.call(void 0, "line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}var ai=_jsxruntime.jsx.call(void 0, "div",{className:"rle-empty",children:"Map unavailable"});function li(){let t=_react.useRef.call(void 0, null),[e,i]=_react.useState.call(void 0, !0),[r,n]=_react.useState.call(void 0, !0);return _react.useEffect.call(void 0, ()=>{let s=t.current;if(!s)return;let o=()=>{let{clientWidth:g,scrollLeft:b,scrollWidth:x}=s;i(b<=0),n(b+g>=x-1)},d=0,p=()=>{d||(d=requestAnimationFrame(()=>{d=0,o()}))};o(),s.addEventListener("scroll",o,{passive:!0});let l,a;return typeof ResizeObserver<"u"&&(l=new ResizeObserver(o),l.observe(s)),typeof MutationObserver<"u"&&(a=new MutationObserver(p),a.observe(s,{characterData:!0,childList:!0,subtree:!0})),()=>{s.removeEventListener("scroll",o),_optionalChain([l, 'optionalAccess', _30 => _30.disconnect, 'call', _31 => _31()]),_optionalChain([a, 'optionalAccess', _32 => _32.disconnect, 'call', _33 => _33()]),d&&cancelAnimationFrame(d)}},[]),{atEnd:r,atStart:e,ref:t}}function di(t,e){if(t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;let i=t,r=e,n=new Set([...Object.keys(i),...Object.keys(r)]);for(let s of n)if(i[s]!==r[s])return!1;return!0}function ut({search:t,filterBarStart:e,toolbarEnd:i,mobileAction:r,autoFetch:n=!0,hasMap:s,mapCenter:o,mapZoom:d,mapControls:p,mobileSheetFooter:l,className:a}){let g=y(),{Search:b}=P(),x=K(),{filters:C,set:c}=ne(),{pagination:L}=F(),N=_nullishCoalesce(s, () => (g.map!=null)),[k,z]=_react.useState.call(void 0, "list"),[w,D]=_react.useState.call(void 0, !1),{atEnd:X,atStart:T,ref:h}=li(),u=_react.useRef.call(void 0, null);_react.useEffect.call(void 0, ()=>{L.mode==="paged"&&u.current&&(u.current.scrollTop=0)},[L.mode,L.pageIndex]);let[f,I]=_react.useState.call(void 0, C),[$,R]=_react.useState.call(void 0, w);w!==$&&(R(w),w&&I(C));let Ne=ue=>I(ft=>({...ft,...ue})),[Re,Me]=_react.useState.call(void 0, !1),ce=_react.useRef.call(void 0, !1);_react.useEffect.call(void 0, ()=>{if(Re){if(L.loading){ce.current=!0;return}ce.current&&(ce.current=!1,Me(!1),D(!1))}},[Re,L.loading]);let W=t?{value:String(_nullishCoalesce(C[t.filterKey], () => (""))),onChange:ue=>{c({[t.filterKey]:ue||void 0})},placeholder:t.placeholder}:void 0;_react.useEffect.call(void 0, ()=>{n!==!1&&g.applyFilters({})},[g,n]);let De=()=>{Ne(g.filters.clearedParams())},_e=()=>{if(di(f,C)){D(!1);return}Me(!0),g.applyFilters(f)},gt=g.filters.activeKeys(C).length,Oe=_nullishCoalesce(x.total, () => (x.items.length));return _jsxruntime.jsxs.call(void 0, "div",{className:a?`rle-app ${a}`:"rle-app",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-filter-bar",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-filter-bar__scroll",ref:h,children:[W&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__search",children:_jsxruntime.jsx.call(void 0, b,{value:W.value,onChange:W.onChange,placeholder:W.placeholder})}),e&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__slot",children:e}),_jsxruntime.jsx.call(void 0, ge,{className:"rle-filters-row",groupClassName:"rle-filter-group",hideLabels:!0})]}),!T&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__fade rle-filter-bar__fade--start","aria-hidden":"true"}),!X&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__fade rle-filter-bar__fade--end","aria-hidden":"true"})]}),_jsxruntime.jsx.call(void 0, ct,{search:W,onFiltersClick:()=>D(!0),filterCount:gt,action:r}),_jsxruntime.jsxs.call(void 0, "div",{className:`rle-body ${N?"rle-split":"rle-body--list-only"}`,"data-mobile-view":k,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-list",ref:u,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-list-header",children:[_jsxruntime.jsx.call(void 0, tt,{}),i&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-list-header__toolbar",children:i})]}),_jsxruntime.jsx.call(void 0, Ge,{className:"rle-list-grid"}),_jsxruntime.jsx.call(void 0, et,{})]}),N&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-map",children:_jsxruntime.jsx.call(void 0, Ye,{center:o,zoom:d,fallback:ai,mapControls:p})})]}),N&&_jsxruntime.jsx.call(void 0, lt,{view:k,onViewChange:z}),_jsxruntime.jsx.call(void 0, pt,{title:"Filters",open:w,onOpenChange:D,footer:l?l({draft:f,apply:_e,clear:De,resultCount:Oe,loading:L.loading}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-btn rle-btn--ghost",onClick:De,children:"Clear all"}),_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-btn rle-btn--primary rle-sheet__apply",disabled:L.loading,onClick:_e,children:L.loading?_jsxruntime.jsx.call(void 0, "span",{className:"rle-spinner","aria-label":"Updating results"}):`Show ${Oe} results`})]}),children:_jsxruntime.jsx.call(void 0, ge,{className:"rle-filter-stack",groupClassName:"rle-filter-group",draft:f,onDraftChange:Ne})})]})}function mt(t){return"provider"in t}function gi(t){let e=t!=null&&!mt(t),i=e?t.apiKey:void 0,r=e?t.mapId:void 0,n=e?t.mapOptions:void 0,s=e?t.styles:void 0,[o,d]=_react.useState.call(void 0, ()=>!t||mt(t)?{ready:!0,provider:_optionalChain([t, 'optionalAccess', _34 => _34.provider])}:{ready:!1});return _react.useEffect.call(void 0, ()=>{if(!i)return;let p=!1;return Promise.resolve().then(() => _interopRequireWildcard(require("./maps/google/index.cjs"))).then(({googleProvider:l})=>{p||d({ready:!0,provider:l({apiKey:i,mapId:r,mapOptions:n,styles:s})})}),()=>{p=!0}},[i,r]),o}function fi({onFiltersChange:t}){let e=_react.useRef.call(void 0, t);return e.current=t,it("FiltersChanged",i=>{i.type==="FiltersChanged"&&e.current(i.filters)}),null}function On(t){let{datasets:e,filters:i,map:r,components:n,initialFilters:s,onFiltersChange:o,mobileAction:d,search:p,filterBarStart:l,toolbarEnd:a,mapControls:g,mobileSheetFooter:b,config:x,autoFetch:C,className:c}=t,{ready:L,provider:N}=gi(r);if(!L)return null;let k=[];for(let D of e)k.push(Ue(D));i&&k.push(Ke(i)),N&&k.push(ze(N)),s&&k.push(Ve(s)),x&&k.push(Ae(x));let z=He(...k),w={...at,...n};return _jsxruntime.jsxs.call(void 0, nt,{...z,children:[o&&_jsxruntime.jsx.call(void 0, fi,{onFiltersChange:o}),_jsxruntime.jsx.call(void 0, $e,{...w,children:_jsxruntime.jsx.call(void 0, ut,{className:c,search:p,filterBarStart:l,toolbarEnd:a,mobileAction:d,autoFetch:C,mapCenter:_optionalChain([r, 'optionalAccess', _35 => _35.center]),mapZoom:_optionalChain([r, 'optionalAccess', _36 => _36.zoom]),mapControls:g,mobileSheetFooter:b})})]})}exports.a = J; exports.b = U; exports.c = Y; exports.d = ee; exports.e = Be; exports.f = te; exports.g = ie; exports.h = He; exports.i = Ae; exports.j = ze; exports.k = Ue; exports.l = Ke; exports.m = Ni; exports.n = Ve; exports.o = Ri; exports.p = me; exports.q = $e; exports.r = P; exports.s = re; exports.t = y; exports.u = F; exports.v = ne; exports.w = ge; exports.x = K; exports.y = Ge; exports.z = Ye; exports.A = et; exports.B = tt; exports.C = it; exports.D = nt; exports.E = he; exports.F = ve; exports.G = be; exports.H = Le; exports.I = Te; exports.J = Fe; exports.K = Se; exports.L = Ce; exports.M = ke; exports.N = we; exports.O = at; exports.P = lt; exports.Q = pt; exports.R = ut; exports.S = On;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var J=class{state;listeners=new Set;constructor(e){this.state=this.freezeState({filters:{...e.filters},results:{items:[],nextCursor:null},bounds:null,selection:null,hovered:null,pagination:{mode:e.mode??"paged",loading:!1,pageIndex:0},layers:{},points:{}})}getState(){return this.state}setFilters(e){this.setState({filters:{...this.state.filters,...e}})}setResults(e){this.setState({results:{items:[...e.items],nextCursor:e.nextCursor,total:e.total}})}appendResults(e){this.setState({results:{items:[...this.state.results.items,...e.items],nextCursor:e.nextCursor,total:e.total}})}setBounds(e){this.setState({bounds:e?{...e}:null})}setSelection(e){this.setState({selection:e})}setHovered(e){this.setState({hovered:e})}setLayerVisible(e,i){this.setState({layers:{...this.state.layers,[e]:i}})}setLoading(e){this.setState({pagination:{...this.state.pagination,loading:e}})}setPageIndex(e){this.setState({pagination:{...this.state.pagination,pageIndex:e}})}setPoints(e,i){this.setState({points:{...this.state.points,[e]:[...i]}})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setState(e){this.state=this.freezeState({...this.state,...e}),this.notify()}notify(){for(let e of this.listeners)e()}freezeState(e){Object.freeze(e.filters),Object.freeze(e.results.items),Object.freeze(e.results),e.bounds&&Object.freeze(e.bounds),Object.freeze(e.pagination),Object.freeze(e.layers);for(let i of Object.values(e.points))Object.freeze(i);return Object.freeze(e.points),Object.freeze(e)}};var U=class{defs=new Map;add(e){if(this.defs.has(e.key))throw new Error(`FilterRegistry: filter "${e.key}" is already registered`);return this.defs.set(e.key,{...e}),this}remove(e){return this.defs.delete(e),this}replace(e,i){if(!this.defs.has(e))throw new Error(`FilterRegistry: cannot replace unregistered filter "${e}"`);return this.defs.set(e,{...i,key:e}),this}reorder(e){let i=this.list(),r=e.filter(s=>this.defs.has(s));r.forEach((s,o)=>{this.defs.get(s).order=o});let n=new Set(r);return i.filter(s=>!n.has(s.key)).forEach((s,o)=>{s.order=r.length+o}),this}list(){return[...this.defs.values()].sort((e,i)=>e.order-i.order)}has(e){return this.defs.has(e)}toFilters(e){return this.list().filter(r=>Object.hasOwn(e,r.key)).map(r=>r.toParams(e[r.key])).reduce((r,n)=>({...r,...n}),{})}activeKeys(e){return this.list().filter(i=>i.isActive?.(e)).map(i=>i.key)}clearedParams(){return this.list().reduce((e,i)=>Object.assign(e,i.toParams(i.fromParams({}))),{})}};var Y=class{defs=new Map;add(e){if(this.defs.has(e.id))throw new Error(`DatasetRegistry: dataset "${e.id}" is already registered`);return this.defs.set(e.id,{...e}),this}get(e){return this.defs.get(e)}has(e){return this.defs.has(e)}list(){return[...this.defs.values()]}visibleIds(){return this.list().filter(e=>e.visible?.()!==!1).map(e=>e.id)}};var ee=class{map=new Map;dispose(){this.map.clear()}emit(e){let i=this.map.get(e.type);if(i)for(let n of[...i])n(e);let r=this.map.get("*");if(r)for(let n of[...r])n(e)}on(e,i){let r=this.map.get(e);return r||(r=new Set,this.map.set(e,r)),r.add(i),()=>{r.delete(i)}}};var Be={pagination:"paged",pageSize:20,debounceMs:250};var te=class{options;constructor(e){this.options=Object.freeze({...Be,...e})}};var ie=class{filters;map;datasets;primaryDatasetId;store;emitter=new ee;config;debounceTimer=null;debounceResolve=null;queryToken=0;pointsToken=0;mapHandle=null;constructor(e){this.datasets=e.datasets,this.filters=e.filters??new U,this.map=e.map,this.config=new te(e.config);let i=e.primaryDatasetId??this.datasets.list()[0]?.id;if(i==null||!this.datasets.has(i))throw new Error(`ListingEngine: primary dataset "${i??""}" is not registered \u2014 pass a valid primaryDatasetId or register at least one dataset`);this.primaryDatasetId=i,this.store=new J({filters:e.initialFilters??{},mode:this.config.options.pagination})}get state(){return this.store.getState()}get options(){return this.config.options}applyFilters(e){this.store.setFilters(e),this.emitter.emit({type:"FiltersChanged",filters:this.currentFilters()}),this.clearDebounce();let i=++this.queryToken,r=this.config.options.debounceMs;return r<=0?this.runQuery(i):new Promise(n=>{this.debounceResolve=n,this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.debounceResolve=null,n(this.runQuery(i))},r)})}async loadPage(){let e=this.state.results.nextCursor;if(e===null)return;let i=++this.queryToken,r=this.primaryDataset();this.store.setLoading(!0);try{let n=await r.adapter.list(this.currentFilters(),{cursor:e,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.config.options.pagination==="infinite"?this.store.appendResults(n):this.store.setResults(n),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.items.length})}finally{i===this.queryToken&&this.store.setLoading(!1)}}async goToPage(e){if(e<0)return;let i=++this.queryToken,r=this.primaryDataset();this.store.setLoading(!0);try{let n=await r.adapter.list(this.currentFilters(),{offset:e*this.config.options.pageSize,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.store.setResults(n),this.store.setPageIndex(e),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.items.length})}finally{i===this.queryToken&&this.store.setLoading(!1)}}async loadPoints(e){this.store.setBounds(e),this.emitter.emit({type:"BoundsChanged",bounds:e});let i=this.currentFilters(),r=++this.pointsToken;await Promise.allSettled(this.datasets.visibleIds().map(async n=>{let s=this.datasets.get(n);if(!s)return;let o=await s.adapter.getPoints(i,e);r===this.pointsToken&&this.store.setPoints(n,o)}))}setMapHandle(e){this.mapHandle=e}fitBounds(e){!this.map||!this.mapHandle||this.map.fitBounds(this.mapHandle,e)}selectPoint(e,i){this.store.setSelection(i);let r=this.state.points[e]?.find(n=>n.id===i);r&&this.emitter.emit({type:"PointClicked",datasetId:e,id:r.id,entity:r.entity})}setHovered(e,i){this.store.setHovered(i)}toggleLayer(e){let r=!(this.state.layers[e]??!0);this.store.setLayerVisible(e,r),this.emitter.emit({type:"LayerToggled",datasetId:e,visible:r})}subscribe(e){return this.store.subscribe(e)}on(e,i){return this.emitter.on(e,i)}dispose(){this.clearDebounce(),this.emitter.dispose(),this.mapHandle=null}async runQuery(e){if(e!==this.queryToken)return;let i=this.primaryDataset();this.store.setLoading(!0);try{let r=await i.adapter.list(this.currentFilters(),{cursor:null,limit:this.config.options.pageSize});if(e!==this.queryToken)return;this.store.setResults(r),this.store.setPageIndex(0),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:r.items.length})}finally{e===this.queryToken&&this.store.setLoading(!1)}}primaryDataset(){return this.datasets.get(this.primaryDatasetId)}currentFilters(){return this.store.getState().filters}clearDebounce(){this.debounceTimer!==null&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.debounceResolve!==null&&(this.debounceResolve(),this.debounceResolve=null)}};function He(...t){let e={config:{},filters:new U,datasets:new Y};for(let i of t)i(e);return e}var Ae=t=>e=>{e.config={...e.config,...t}},ze=t=>e=>{e.map=t},Ue=t=>e=>{e.datasets.add(t)},Ke=t=>e=>{t(e.filters)},Ni=t=>e=>{e.urlSync=t},Ve=t=>e=>{e.initialFilters=t},Ri=t=>e=>{e.primaryDatasetId=t};import{createContext as yt,useContext as ht}from"react";import{jsx as M,jsxs as It}from"react/jsx-runtime";function vt(t){return String(t?.title??"")}var bt=({item:t})=>M("div",{children:vt(t)}),Lt=()=>M("div",{}),me=()=>M("div",{}),Tt=({children:t})=>M("div",{children:t}),Pt=({children:t})=>M("div",{children:t}),Ft=({value:t,onChange:e,placeholder:i})=>M("input",{type:"search",value:t,placeholder:i,onChange:r=>e(r.target.value),"aria-label":i??"Search"}),St=()=>M("div",{role:"status",children:"No results"}),Ct=()=>M("div",{role:"status","aria-busy":"true",children:"Loading\u2026"}),kt=({count:t})=>It("div",{children:[t," results"]}),wt=({children:t})=>M("div",{children:t}),E={Card:bt,Marker:Lt,Popup:me,Sidebar:Tt,FilterPanel:Pt,Search:Ft,Empty:St,Loading:Ct,ResultHeader:kt,Toolbar:wt},qe=yt(E);function $e(t){let{Card:e,Marker:i,Popup:r,Sidebar:n,FilterPanel:s,Search:o,Empty:d,Loading:p,ResultHeader:l,Toolbar:a,children:g}=t,b={Card:e??E.Card,Marker:i??E.Marker,Popup:r??E.Popup,Sidebar:n??E.Sidebar,FilterPanel:s??E.FilterPanel,Search:o??E.Search,Empty:d??E.Empty,Loading:p??E.Loading,ResultHeader:l??E.ResultHeader,Toolbar:a??E.Toolbar};return M(qe.Provider,{value:b,children:g})}function P(){return ht(qe)}import{createContext as Et}from"react";var re=Et(null);import{useContext as xt}from"react";function y(){let t=xt(re);if(t===null)throw new Error("useListing must be used within a <ListingProvider>");return t}import{useCallback as We,useSyncExternalStore as Nt}from"react";function F(){let t=y(),e=We(r=>t.subscribe(r),[t]),i=We(()=>t.state,[t]);return Nt(e,i,i)}import{useCallback as je}from"react";function ne(){let t=y(),e=F(),i=je(n=>t.applyFilters(n),[t]),r=je((n,s)=>t.applyFilters({[n]:s}),[t]);return{filters:e.filters,set:i,setField:r}}import{jsx as j,jsxs as Rt}from"react/jsx-runtime";function ge({className:t,groupClassName:e,hideLabels:i,draft:r,onDraftChange:n}={}){let s=y(),{FilterPanel:o}=P(),{filters:d}=ne(),p=r!==void 0&&n!==void 0,l=p?r:d;return j(o,{children:j("div",{className:t??"space-y-5",children:s.filters.list().map(a=>{if(typeof a.render=="string")return j("div",{"data-filter":a.key,className:e},a.key);let g=a.render;return Rt("div",{className:e,children:[a.label&&!i&&j("div",{className:"mb-1.5 text-[13px] font-medium text-foreground",children:a.label}),j(g,{value:a.fromParams(l),onChange:b=>p?n(a.toParams(b)):void s.applyFilters(a.toParams(b))})]},a.key)})})})}function K(){return F().results}import{jsx as se}from"react/jsx-runtime";function Mt(t,e){if(t&&typeof t=="object"&&"id"in t){let i=t.id;if(typeof i=="string"||typeof i=="number")return i}return e}function Ge({className:t}={}){let e=y(),{items:i}=K(),{pagination:r,selection:n}=F(),{Card:s,Empty:o,Loading:d}=P();return r.loading&&i.length===0?se(d,{}):i.length===0?se(o,{}):se("div",{role:"list",className:t,children:i.map((p,l)=>{let a=Mt(p,l);return se(s,{item:p,selected:n===a,onSelect:()=>e.selectPoint(e.primaryDatasetId,a)},a)})})}import{useEffect as G,useRef as B,useState as Qe}from"react";import{createPortal as Dt}from"react-dom";import{jsx as fe,jsxs as Je}from"react/jsx-runtime";var _t={west:-179.9,south:-85,east:179.9,north:85},Ze=.1,Xe=.02;function Ot(t){if(t.length===0)return null;let e=t[0].lng,i=t[0].lng,r=t[0].lat,n=t[0].lat;for(let{lat:d,lng:p}of t)p<e&&(e=p),p>i&&(i=p),d<r&&(r=d),d>n&&(n=d);let s=n>r?(n-r)*Ze:Xe,o=i>e?(i-e)*Ze:Xe;return{west:e-o,east:i+o,south:r-s,north:n+s}}function Ye(t){let{center:e,zoom:i,fallback:r,mapControls:n}=t,s=y(),o=F(),d=B(null),p=B(null),l=B(null),[a,g]=Qe(!1),b=B(!1),x=B(!1),C=B(!1),c=s.map;G(()=>{let T=l.current;if(!c||!T)return;let h=[];for(let u of Object.keys(o.points)){if(o.layers[u]===!1)continue;let f=s.datasets.get(u),I=o.points[u]??[],$={id:u,markers:I.map(R=>({id:R.id,position:R.position,iconUrl:f?.marker.iconUrl?.(R.entity),element:f?.marker.element?.(R.entity)})),clustering:f?.clustering,onMarkerClick:R=>s.selectPoint(u,R)};h.push(c.renderLayer(T,$))}return()=>{h.forEach(u=>u())}},[s,c,a,o.points,o.layers]),G(()=>{if(!d.current||!c)return;let T=d.current,h=!1,u=null;return(async()=>{let f=await c.mount(T,{center:e,zoom:i,fullscreenTarget:p.current??void 0});if(h){c.destroy(f);return}l.current=f,s.setMapHandle(f),u=c.onBoundsChange(f,I=>{C.current?C.current=!1:x.current=!0,s.loadPoints(I)}),g(!0),s.loadPoints(_t)})(),()=>{h=!0,u?.(),l.current&&(c.destroy(l.current),l.current=null,s.setMapHandle(null)),g(!1)}},[s,c]),G(()=>{let T=l.current;if(!c||!T||e||b.current||x.current)return;let h=[];for(let f of Object.keys(o.points))if(o.layers[f]!==!1)for(let I of o.points[f]??[])h.push(I.position);let u=Ot(h);u&&(b.current=!0,C.current=!0,c.fitBounds(T,u))},[c,e,a,o.points,o.layers]),G(()=>{c?.updateMarkerStates(o.selection,o.hovered)},[c,a,o.selection,o.hovered]);let{Popup:L}=P(),N=L!==me,k=o.points[s.primaryDatasetId]??[],z=o.selection!=null?k.find(T=>T.id===o.selection):void 0,[w,D]=Qe(null),X=B(z);return X.current=z,G(()=>{let T=l.current;if(!c||!T||!N)return;let h=X.current;if(!h)return;let u=c.mountOverlay(h.position);D({entity:h.entity,position:h.position,container:u.container});let f=()=>s.selectPoint(s.primaryDatasetId,null),I=R=>{R.key==="Escape"&&f()};document.addEventListener("keydown",I);let $=c.onMapClick(f);return()=>{document.removeEventListener("keydown",I),$(),u.unmount(),D(null)}},[s,c,a,o.selection,N]),Je("div",{ref:p,className:"relative h-full min-h-0 w-full",children:[Je("div",{ref:d,className:!c&&r?"flex h-full min-h-0 w-full items-center justify-center":"h-full min-h-0 w-full",children:[!c&&r,N&&w?Dt(fe(L,{entity:w.entity,onClose:()=>s.selectPoint(s.primaryDatasetId,null)}),w.container):null]}),n!=null&&fe("div",{className:"pointer-events-none absolute inset-0",children:fe("div",{className:"pointer-events-auto",children:n})})]})}import{jsx as Q,jsxs as Ht}from"react/jsx-runtime";var ye="gap";function Bt(t,e){if(t<=7)return Array.from({length:t},(s,o)=>o+1);let i=Math.max(2,e-1),r=Math.min(t-1,e+1),n=[1];i>2&&n.push(ye);for(let s=i;s<=r;s+=1)n.push(s);return r<t-1&&n.push(ye),n.push(t),n}function et(){let t=y(),{results:e,pagination:i}=F();if(i.mode==="infinite")return e.nextCursor==null?null:Q("button",{type:"button",disabled:i.loading,onClick:()=>{t.loadPage()},children:"Load more"});let r=t.options.pageSize,{pageIndex:n}=i,s=n+1,o=e.total!=null?Math.ceil(e.total/r):null,d=o!=null?s<o:e.nextCursor!=null||e.items.length>=r;if(o!=null?o<=1:n===0&&!d)return null;let p=l=>()=>{t.goToPage(l)};return Ht("nav",{className:"rle-pagination","aria-label":"Pagination",children:[Q("button",{type:"button",className:"rle-page-btn rle-page-btn--nav","aria-label":"Previous page",disabled:i.loading||n===0,onClick:p(n-1),children:"\u2039"}),o!=null&&Bt(o,s).map((l,a)=>l===ye?Q("span",{className:"rle-page-ellipsis",children:"\u2026"},`gap-${a}`):Q("button",{type:"button",className:l===s?"rle-page-btn rle-page-btn--active":"rle-page-btn","aria-label":`Page ${l}`,"aria-current":l===s?"page":void 0,disabled:i.loading,onClick:p(l-1),children:l},l)),Q("button",{type:"button",className:"rle-page-btn rle-page-btn--nav","aria-label":"Next page",disabled:i.loading||!d,onClick:p(n+1),children:"\u203A"})]})}import{jsx as At}from"react/jsx-runtime";function tt(){let{items:t,total:e}=K(),{ResultHeader:i}=P();return At(i,{count:t.length,total:e})}import{useEffect as zt,useRef as Ut}from"react";function it(t,e){let i=y(),r=Ut(e);r.current=e,zt(()=>i.on(t,n=>r.current(n)),[i,t])}import{useEffect as Kt,useState as rt}from"react";import{jsx as Vt}from"react/jsx-runtime";function nt(t){let{children:e,...i}=t,[r]=rt(()=>i),[n,s]=rt(null);return Kt(()=>{let o=new ie({datasets:r.datasets,filters:r.filters,config:r.config,map:r.map,initialFilters:r.initialFilters,primaryDatasetId:r.primaryDatasetId});return r.urlSync&&r.urlSync.start(o),s(o),()=>{r.urlSync&&r.urlSync.stop(),o.dispose(),s(d=>d===o?null:d)}},[r]),n?Vt(re.Provider,{value:n,children:e}):null}function V(t){return typeof t!="number"?t:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(t)}import{Fragment as $t,jsx as _,jsxs as st}from"react/jsx-runtime";function qt(t){return t?"rle-card rle-card--selected":"rle-card"}function he({item:t,selected:e,onSelect:i}){let r=t??{},n=qt(e),s=st($t,{children:[r.imageUrl?_("img",{src:r.imageUrl,alt:r.title??"",className:"rle-card-media"}):_("div",{className:"rle-card-media rle-card-media--placeholder","aria-hidden":"true"}),st("div",{className:"rle-card-body",children:[r.title&&_("span",{className:"rle-card-title",children:r.title}),r.subtitle&&_("span",{className:"rle-card-address",children:r.subtitle}),r.badge&&_("div",{className:"rle-card-info",children:_("span",{className:"rle-card-info-item",children:r.badge})}),r.price!=null&&_("span",{className:"rle-card-price",children:V(r.price)})]})]});return i?_("button",{type:"button",onClick:i,"aria-pressed":e??!1,className:n,children:s}):_("article",{className:n,children:s})}import{jsx as oe,jsxs as ot}from"react/jsx-runtime";function ve(t){return ot("div",{role:"status",className:"rle-empty",children:[ot("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",className:"rle-empty-icon","aria-hidden":"true",children:[oe("circle",{cx:"11",cy:"11",r:"7"}),oe("path",{d:"m21 21-4.3-4.3"})]}),oe("p",{className:"rle-empty-title",children:"No results"}),oe("p",{className:"rle-empty-hint",children:"Try adjusting your filters or search terms."})]})}import{jsx as Wt}from"react/jsx-runtime";function be({children:t}){return Wt("div",{className:"rle-filter-panel",children:t})}import{jsx as ae,jsxs as jt}from"react/jsx-runtime";function Le(t){return ae("div",{className:"rle-loading",role:"status","aria-busy":"true","aria-label":"Loading results",children:Array.from({length:3}).map((e,i)=>jt("div",{className:"rle-loading-item",children:[ae("div",{className:"rle-skeleton",style:{aspectRatio:"4 / 3",width:"100%"}}),ae("div",{className:"rle-skeleton",style:{height:16,width:"65%"}}),ae("div",{className:"rle-skeleton",style:{height:12,width:"35%"}})]},i))})}import{jsx as Gt}from"react/jsx-runtime";function Te({point:t}){let e=t.entity??{};return Gt("span",{className:"rle-pin",children:e.price!=null?V(e.price):""})}import{jsx as q,jsxs as Pe}from"react/jsx-runtime";function Fe({entity:t,onClose:e}){let i=t??{};return Pe("div",{className:"rle-popup",role:"group","aria-label":"Location details",children:[q("button",{type:"button",onClick:e,"aria-label":"Close",className:"rle-popup-close",children:Pe("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[q("path",{d:"M18 6 6 18"}),q("path",{d:"m6 6 12 12"})]})}),Pe("div",{children:[i.title&&q("div",{className:"rle-card-title",children:i.title}),i.subtitle&&q("div",{className:"rle-card-address",children:i.subtitle}),i.price!=null&&q("div",{className:"rle-card-price",children:V(i.price)})]})]})}import{jsx as Qt}from"react/jsx-runtime";function Se({count:t,total:e}){let i=e!=null&&e!==t?`${t} of ${e} results`:`${t} results`;return Qt("div",{className:"rle-result-header",children:i})}import{jsx as Zt}from"react/jsx-runtime";function Ce({value:t,onChange:e,placeholder:i}){return Zt("input",{type:"search",value:t,placeholder:i,onChange:r=>e(r.target.value),"aria-label":i??"Search",className:"rle-input"})}import{jsx as Xt}from"react/jsx-runtime";function ke({children:t}){return Xt("aside",{className:"rle-sidebar",children:t})}import{jsx as Jt}from"react/jsx-runtime";function we({children:t}){return Jt("div",{className:"rle-toolbar",children:t})}var at={Card:he,Marker:Te,Popup:Fe,Sidebar:ke,FilterPanel:be,Search:Ce,Empty:ve,Loading:Le,ResultHeader:Se,Toolbar:we};import{jsx as S,jsxs as Z}from"react/jsx-runtime";function lt({view:t,onViewChange:e}){return S("nav",{className:"rle-bottom-nav","aria-label":"Listing navigation",children:Z("div",{className:"rle-viewtoggle",role:"group","aria-label":"View",children:[Z("button",{type:"button",className:`rle-viewtoggle__btn${t==="list"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":t==="list",onClick:()=>e("list"),children:[S(Yt,{}),"List"]}),Z("button",{type:"button",className:`rle-viewtoggle__btn${t==="map"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":t==="map",onClick:()=>e("map"),children:[S(ei,{}),"Map"]})]})})}function Yt(){return Z("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[S("line",{x1:"8",y1:"6",x2:"20",y2:"6"}),S("line",{x1:"8",y1:"12",x2:"20",y2:"12"}),S("line",{x1:"8",y1:"18",x2:"20",y2:"18"}),S("line",{x1:"4",y1:"6",x2:"4.01",y2:"6"}),S("line",{x1:"4",y1:"12",x2:"4.01",y2:"12"}),S("line",{x1:"4",y1:"18",x2:"4.01",y2:"18"})]})}function ei(){return Z("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[S("polygon",{points:"1 6 8 3 16 6 23 3 23 18 16 21 8 18 1 21 1 6"}),S("line",{x1:"8",y1:"3",x2:"8",y2:"18"}),S("line",{x1:"16",y1:"6",x2:"16",y2:"21"})]})}import{useEffect as Ie,useRef as ti,useState as dt}from"react";import{createPortal as ii}from"react-dom";import{Fragment as ni,jsx as O,jsxs as le}from"react/jsx-runtime";function pt({open:t,onOpenChange:e,title:i,children:r,footer:n}){let s=ti(null),[o,d]=dt(!1),[p,l]=dt(!1);return Ie(()=>{if(!t){l(!1),d(!1);return}d(!0);let a=requestAnimationFrame(()=>l(!0));return()=>cancelAnimationFrame(a)},[t]),Ie(()=>{if(!o)return;let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a}},[o]),Ie(()=>{if(!o)return;s.current?.focus();function a(g){g.key==="Escape"&&e(!1)}return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[o,e]),!o||typeof document>"u"?null:ii(le(ni,{children:[O("div",{className:`rle-sheet-backdrop${p?" rle-sheet-backdrop--open":""}`,onClick:()=>e(!1),"aria-hidden":"true"}),le("div",{ref:s,className:`rle-sheet${p?" rle-sheet--open":""}`,role:"dialog","aria-modal":"true","aria-label":i,tabIndex:-1,children:[O("div",{className:"rle-sheet__handle","aria-hidden":"true"}),le("div",{className:"rle-sheet__header",children:[i&&O("div",{className:"rle-sheet__title",children:i}),O("button",{type:"button",className:"rle-sheet__close",onClick:()=>e(!1),"aria-label":"Close",children:O(ri,{})})]}),O("div",{className:"rle-sheet__body",children:r}),n&&O("div",{className:"rle-sheet__footer",children:n})]})]}),document.body)}function ri(){return le("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[O("path",{d:"M18 6 6 18"}),O("path",{d:"m6 6 12 12"})]})}import{useEffect as pe,useRef as Ee,useState as A}from"react";import{jsx as v,jsxs as de}from"react/jsx-runtime";function ct({search:t,onFiltersClick:e,filterCount:i=0,action:r}){let{Search:n}=P();return de("header",{className:"rle-mobile-header",children:[t&&v("div",{className:"rle-mobile-header__search",children:v(n,{value:t.value,onChange:t.onChange,placeholder:t.placeholder})}),de("button",{type:"button",className:"rle-btn rle-mobile-header__btn",onClick:e,children:[v(si,{}),v("span",{children:"Filters"}),i>0&&v("span",{className:"rle-mobile-header__count",children:i})]}),r&&v("button",{type:"button",className:"rle-btn rle-mobile-header__btn rle-mobile-header__btn--icon",onClick:r.onClick,"aria-label":r.label,children:r.icon??v(oi,{})})]})}function si(){return de("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[v("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),v("circle",{cx:"9",cy:"6",r:"2",fill:"currentColor",stroke:"none"}),v("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),v("circle",{cx:"15",cy:"12",r:"2",fill:"currentColor",stroke:"none"}),v("line",{x1:"4",y1:"18",x2:"20",y2:"18"}),v("circle",{cx:"11",cy:"18",r:"2",fill:"currentColor",stroke:"none"})]})}function oi(){return de("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[v("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),v("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}import{Fragment as pi,jsx as m,jsxs as H}from"react/jsx-runtime";var ai=m("div",{className:"rle-empty",children:"Map unavailable"});function li(){let t=Ee(null),[e,i]=A(!0),[r,n]=A(!0);return pe(()=>{let s=t.current;if(!s)return;let o=()=>{let{clientWidth:g,scrollLeft:b,scrollWidth:x}=s;i(b<=0),n(b+g>=x-1)},d=0,p=()=>{d||(d=requestAnimationFrame(()=>{d=0,o()}))};o(),s.addEventListener("scroll",o,{passive:!0});let l,a;return typeof ResizeObserver<"u"&&(l=new ResizeObserver(o),l.observe(s)),typeof MutationObserver<"u"&&(a=new MutationObserver(p),a.observe(s,{characterData:!0,childList:!0,subtree:!0})),()=>{s.removeEventListener("scroll",o),l?.disconnect(),a?.disconnect(),d&&cancelAnimationFrame(d)}},[]),{atEnd:r,atStart:e,ref:t}}function di(t,e){if(t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;let i=t,r=e,n=new Set([...Object.keys(i),...Object.keys(r)]);for(let s of n)if(i[s]!==r[s])return!1;return!0}function ut({search:t,filterBarStart:e,toolbarEnd:i,mobileAction:r,autoFetch:n=!0,hasMap:s,mapCenter:o,mapZoom:d,mapControls:p,mobileSheetFooter:l,className:a}){let g=y(),{Search:b}=P(),x=K(),{filters:C,set:c}=ne(),{pagination:L}=F(),N=s??g.map!=null,[k,z]=A("list"),[w,D]=A(!1),{atEnd:X,atStart:T,ref:h}=li(),u=Ee(null);pe(()=>{L.mode==="paged"&&u.current&&(u.current.scrollTop=0)},[L.mode,L.pageIndex]);let[f,I]=A(C),[$,R]=A(w);w!==$&&(R(w),w&&I(C));let Ne=ue=>I(ft=>({...ft,...ue})),[Re,Me]=A(!1),ce=Ee(!1);pe(()=>{if(Re){if(L.loading){ce.current=!0;return}ce.current&&(ce.current=!1,Me(!1),D(!1))}},[Re,L.loading]);let W=t?{value:String(C[t.filterKey]??""),onChange:ue=>{c({[t.filterKey]:ue||void 0})},placeholder:t.placeholder}:void 0;pe(()=>{n!==!1&&g.applyFilters({})},[g,n]);let De=()=>{Ne(g.filters.clearedParams())},_e=()=>{if(di(f,C)){D(!1);return}Me(!0),g.applyFilters(f)},gt=g.filters.activeKeys(C).length,Oe=x.total??x.items.length;return H("div",{className:a?`rle-app ${a}`:"rle-app",children:[H("div",{className:"rle-filter-bar",children:[H("div",{className:"rle-filter-bar__scroll",ref:h,children:[W&&m("div",{className:"rle-filter-bar__search",children:m(b,{value:W.value,onChange:W.onChange,placeholder:W.placeholder})}),e&&m("div",{className:"rle-filter-bar__slot",children:e}),m(ge,{className:"rle-filters-row",groupClassName:"rle-filter-group",hideLabels:!0})]}),!T&&m("div",{className:"rle-filter-bar__fade rle-filter-bar__fade--start","aria-hidden":"true"}),!X&&m("div",{className:"rle-filter-bar__fade rle-filter-bar__fade--end","aria-hidden":"true"})]}),m(ct,{search:W,onFiltersClick:()=>D(!0),filterCount:gt,action:r}),H("div",{className:`rle-body ${N?"rle-split":"rle-body--list-only"}`,"data-mobile-view":k,children:[H("div",{className:"rle-list",ref:u,children:[H("div",{className:"rle-list-header",children:[m(tt,{}),i&&m("div",{className:"rle-list-header__toolbar",children:i})]}),m(Ge,{className:"rle-list-grid"}),m(et,{})]}),N&&m("div",{className:"rle-map",children:m(Ye,{center:o,zoom:d,fallback:ai,mapControls:p})})]}),N&&m(lt,{view:k,onViewChange:z}),m(pt,{title:"Filters",open:w,onOpenChange:D,footer:l?l({draft:f,apply:_e,clear:De,resultCount:Oe,loading:L.loading}):H(pi,{children:[m("button",{type:"button",className:"rle-btn rle-btn--ghost",onClick:De,children:"Clear all"}),m("button",{type:"button",className:"rle-btn rle-btn--primary rle-sheet__apply",disabled:L.loading,onClick:_e,children:L.loading?m("span",{className:"rle-spinner","aria-label":"Updating results"}):`Show ${Oe} results`})]}),children:m(ge,{className:"rle-filter-stack",groupClassName:"rle-filter-group",draft:f,onDraftChange:Ne})})]})}import{useEffect as ci,useRef as ui,useState as mi}from"react";import{jsx as xe,jsxs as yi}from"react/jsx-runtime";function mt(t){return"provider"in t}function gi(t){let e=t!=null&&!mt(t),i=e?t.apiKey:void 0,r=e?t.mapId:void 0,n=e?t.mapOptions:void 0,s=e?t.styles:void 0,[o,d]=mi(()=>!t||mt(t)?{ready:!0,provider:t?.provider}:{ready:!1});return ci(()=>{if(!i)return;let p=!1;return import("./maps/google/index.js").then(({googleProvider:l})=>{p||d({ready:!0,provider:l({apiKey:i,mapId:r,mapOptions:n,styles:s})})}),()=>{p=!0}},[i,r]),o}function fi({onFiltersChange:t}){let e=ui(t);return e.current=t,it("FiltersChanged",i=>{i.type==="FiltersChanged"&&e.current(i.filters)}),null}function On(t){let{datasets:e,filters:i,map:r,components:n,initialFilters:s,onFiltersChange:o,mobileAction:d,search:p,filterBarStart:l,toolbarEnd:a,mapControls:g,mobileSheetFooter:b,config:x,autoFetch:C,className:c}=t,{ready:L,provider:N}=gi(r);if(!L)return null;let k=[];for(let D of e)k.push(Ue(D));i&&k.push(Ke(i)),N&&k.push(ze(N)),s&&k.push(Ve(s)),x&&k.push(Ae(x));let z=He(...k),w={...at,...n};return yi(nt,{...z,children:[o&&xe(fi,{onFiltersChange:o}),xe($e,{...w,children:xe(ut,{className:c,search:p,filterBarStart:l,toolbarEnd:a,mobileAction:d,autoFetch:C,mapCenter:r?.center,mapZoom:r?.zoom,mapControls:g,mobileSheetFooter:b})})]})}export{J as a,U as b,Y as c,ee as d,Be as e,te as f,ie as g,He as h,Ae as i,ze as j,Ue as k,Ke as l,Ni as m,Ve as n,Ri as o,me as p,$e as q,P as r,re as s,y as t,F as u,ne as v,ge as w,K as x,Ge as y,Ye as z,et as A,tt as B,it as C,nt as D,he as E,ve as F,be as G,Le as H,Te as I,Fe as J,Se as K,Ce as L,ke as M,we as N,at as O,lt as P,pt as Q,ut as R,On as S};
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;"use client";
|
|
2
|
-
var
|
|
2
|
+
var _chunk76JZ5SOAcjs = require('./chunk-76JZ5SOA.cjs');var b=(r=>(r.Paged="paged",r.Infinite="infinite",r))(b||{});var v=(i=>(i.FiltersChanged="FiltersChanged",i.ResultsLoaded="ResultsLoaded",i.PointClicked="PointClicked",i.BoundsChanged="BoundsChanged",i.LayerToggled="LayerToggled",i))(v||{});var d= (_class =class{__init() {this.listeners=new Set}constructor(t={}){;_class.prototype.__init.call(this);this.query={...t}}getQuery(){return{...this.query}}setQuery(t){this.query={...t},this.notify()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){for(let t of[...this.listeners])t()}}, _class);function F(e,t){let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let s of r)if(e[s]!==t[s])return!1;return!0}var h= (_class2 =class{__init2() {this.isSyncing=!1}__init3() {this.unsubscribeEngine=null}__init4() {this.unsubscribeHistory=null}constructor(t){;_class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this);_class2.prototype.__init4.call(this);this.history=t.history,this.toQueryFn=t.toQuery,this.toFiltersFn=t.toFilters,this.hydrateOnStart=_nullishCoalesce(t.hydrateOnStart, () => (!0))}start(t){this.stop(),this.unsubscribeEngine=t.subscribe(()=>{this.isSyncing||this.syncEngineToHistory(t)}),this.unsubscribeHistory=this.history.subscribe(()=>{this.isSyncing||this.withSyncGuard(()=>{this.applyFiltersSafely(t,this.toFiltersFn(this.history.getQuery()))})}),this.hydrateOnStart&&this.withSyncGuard(()=>{this.applyFiltersSafely(t,this.toFiltersFn(this.history.getQuery()))})}stop(){_optionalChain([this, 'access', _ => _.unsubscribeEngine, 'optionalCall', _2 => _2()]),this.unsubscribeEngine=null,_optionalChain([this, 'access', _3 => _3.unsubscribeHistory, 'optionalCall', _4 => _4()]),this.unsubscribeHistory=null}syncEngineToHistory(t){let r=this.toQueryFn(t.state.filters);F(r,this.history.getQuery())||this.withSyncGuard(()=>this.history.setQuery(r))}applyFiltersSafely(t,r){Promise.resolve(t.applyFilters(r)).catch(()=>{})}withSyncGuard(t){this.isSyncing=!0;try{t()}finally{this.isSyncing=!1}}}, _class2);var f=class{constructor(t={}){this.mode=_nullishCoalesce(t.mode, () => ("replace"))}getQuery(){if(typeof window>"u")return{};let t=new URLSearchParams(window.location.search),r={};for(let[s,o]of t)o!==""&&(r[s]=o);return r}setQuery(t){if(typeof window>"u")return;let r=new URLSearchParams;for(let[c,l]of Object.entries(t))l===void 0||l===""||r.set(c,l);let s=r.toString(),o=s?`?${s}`:"";if(o===window.location.search)return;let i=`${window.location.pathname}${o}${window.location.hash}`;this.mode==="push"?window.history.pushState(window.history.state,"",i):window.history.replaceState(window.history.state,"",i)}subscribe(t){return typeof window>"u"?()=>{}:(window.addEventListener("popstate",t),()=>{window.removeEventListener("popstate",t)})}};var _jsxruntime = require('react/jsx-runtime');function st({children:e}){let{Toolbar:t}=_chunk76JZ5SOAcjs.r.call(void 0, );return _jsxruntime.jsx.call(void 0, t,{children:e})}var _react = require('react');function ut(){let e=_chunk76JZ5SOAcjs.t.call(void 0, ),t=_chunk76JZ5SOAcjs.u.call(void 0, ),r=_react.useCallback.call(void 0, n=>e.loadPoints(n),[e]),s=_react.useCallback.call(void 0, (n,g)=>e.selectPoint(n,g),[e]),o=_react.useCallback.call(void 0, n=>e.setHovered(e.primaryDatasetId,n),[e]),i=_react.useCallback.call(void 0, ()=>_optionalChain([e, 'access', _5 => _5.map, 'optionalAccess', _6 => _6.zoomIn, 'call', _7 => _7()]),[e]),c=_react.useCallback.call(void 0, ()=>_optionalChain([e, 'access', _8 => _8.map, 'optionalAccess', _9 => _9.zoomOut, 'call', _10 => _10()]),[e]),l=_react.useCallback.call(void 0, ()=>_optionalChain([e, 'access', _11 => _11.map, 'optionalAccess', _12 => _12.toggleFullscreen, 'call', _13 => _13()]),[e]),m=_react.useCallback.call(void 0, n=>e.fitBounds(n),[e]);return{bounds:t.bounds,points:t.points,hovered:t.hovered,loadPoints:r,selectPoint:s,setHovered:o,zoomIn:i,zoomOut:c,toggleFullscreen:l,fitBounds:m}}function ht(e){let t=_chunk76JZ5SOAcjs.t.call(void 0, ),r=_chunk76JZ5SOAcjs.u.call(void 0, ),s=_react.useCallback.call(void 0, ()=>t.toggleLayer(e),[t,e]);return{visible:_nullishCoalesce(r.layers[e], () => (!0)),points:_nullishCoalesce(r.points[e], () => ([])),toggle:s}}exports.BrowserHistoryPort = f; exports.DatasetRegistry = _chunk76JZ5SOAcjs.c; exports.FallbackPopup = _chunk76JZ5SOAcjs.p; exports.FilterRegistry = _chunk76JZ5SOAcjs.b; exports.ListingApp = _chunk76JZ5SOAcjs.S; exports.ListingComponentsProvider = _chunk76JZ5SOAcjs.q; exports.ListingConfig = _chunk76JZ5SOAcjs.f; exports.ListingEngine = _chunk76JZ5SOAcjs.g; exports.ListingEngineContext = _chunk76JZ5SOAcjs.s; exports.ListingEventType = v; exports.ListingFilters = _chunk76JZ5SOAcjs.w; exports.ListingList = _chunk76JZ5SOAcjs.y; exports.ListingMap = _chunk76JZ5SOAcjs.z; exports.ListingPagination = _chunk76JZ5SOAcjs.A; exports.ListingProvider = _chunk76JZ5SOAcjs.D; exports.ListingResultHeader = _chunk76JZ5SOAcjs.B; exports.ListingStore = _chunk76JZ5SOAcjs.a; exports.ListingToolbar = st; exports.MemoryHistoryPort = d; exports.PaginationMode = b; exports.TypedEmitter = _chunk76JZ5SOAcjs.d; exports.UrlSyncController = h; exports.composeListingProviders = _chunk76JZ5SOAcjs.h; exports.listingDefaultConfig = _chunk76JZ5SOAcjs.e; exports.useListing = _chunk76JZ5SOAcjs.t; exports.useListingComponents = _chunk76JZ5SOAcjs.r; exports.useListingEvent = _chunk76JZ5SOAcjs.C; exports.useListingFilters = _chunk76JZ5SOAcjs.v; exports.useListingLayer = ht; exports.useListingMap = ut; exports.useListingResults = _chunk76JZ5SOAcjs.x; exports.useListingState = _chunk76JZ5SOAcjs.u; exports.withConfig = _chunk76JZ5SOAcjs.i; exports.withDataset = _chunk76JZ5SOAcjs.k; exports.withFilters = _chunk76JZ5SOAcjs.l; exports.withInitialFilters = _chunk76JZ5SOAcjs.n; exports.withMap = _chunk76JZ5SOAcjs.j; exports.withPrimaryDataset = _chunk76JZ5SOAcjs.o; exports.withUrlSync = _chunk76JZ5SOAcjs.m;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { P as Page, B as Bounds, E as EntityId, M as MapPoint, U as Unsubscribe, a as MapProvider, b as MapHandle, Q as QueryParams, L as LatLng } from './map-provider.interface-
|
|
2
|
-
export { c as EntityAdapter, d as MapInitOptions, e as MapOverlayHandle, f as PageRequest, R as RenderedLayer } from './map-provider.interface-
|
|
3
|
-
import { P as PaginationMode, D as DatasetDefinition, I as IListingConfigOptions, F as FilterRegistry, a as IListingToolbarProps } from './listing-app-
|
|
4
|
-
export { C as ClusterOptions, b as FallbackPopup, c as FilterControlProps, d as FilterDefinition, e as IListingCardProps, f as IListingComponents, g as IListingEmptyProps, h as IListingFilterPanelProps, i as IListingLoadingProps, j as IListingMarkerProps, k as IListingPopupProps, l as IListingResultHeaderProps, m as IListingSearchProps, n as IListingSidebarProps, L as ListingApp, o as ListingAppProps, p as ListingComponentsProvider, M as MarkerRenderer, q as MobileSheetFooterContext, u as useListingComponents } from './listing-app-
|
|
1
|
+
import { P as Page, B as Bounds, E as EntityId, M as MapPoint, U as Unsubscribe, a as MapProvider, b as MapHandle, Q as QueryParams, L as LatLng } from './map-provider.interface-B_8-GtsW.cjs';
|
|
2
|
+
export { c as EntityAdapter, d as MapInitOptions, e as MapOverlayHandle, f as PageRequest, R as RenderedLayer } from './map-provider.interface-B_8-GtsW.cjs';
|
|
3
|
+
import { P as PaginationMode, D as DatasetDefinition, I as IListingConfigOptions, F as FilterRegistry, a as IListingToolbarProps } from './listing-app-B8lXqvd5.cjs';
|
|
4
|
+
export { C as ClusterOptions, b as FallbackPopup, c as FilterControlProps, d as FilterDefinition, e as IListingCardProps, f as IListingComponents, g as IListingEmptyProps, h as IListingFilterPanelProps, i as IListingLoadingProps, j as IListingMarkerProps, k as IListingPopupProps, l as IListingResultHeaderProps, m as IListingSearchProps, n as IListingSidebarProps, L as ListingApp, o as ListingAppProps, p as ListingComponentsProvider, M as MarkerRenderer, q as MobileSheetFooterContext, u as useListingComponents } from './listing-app-B8lXqvd5.cjs';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import { ReactNode } from 'react';
|
|
7
7
|
|
|
@@ -22,6 +22,7 @@ interface ListingState<TEntity, TFilters> {
|
|
|
22
22
|
pagination: {
|
|
23
23
|
mode: PaginationMode;
|
|
24
24
|
loading: boolean;
|
|
25
|
+
pageIndex: number;
|
|
25
26
|
};
|
|
26
27
|
layers: Record<string, boolean>;
|
|
27
28
|
points: Readonly<Record<string, ReadonlyArray<MapPoint<unknown>>>>;
|
|
@@ -47,6 +48,7 @@ declare class ListingStore<TEntity, TFilters> {
|
|
|
47
48
|
setHovered(id: EntityId | null): void;
|
|
48
49
|
setLayerVisible(id: string, visible: boolean): void;
|
|
49
50
|
setLoading(loading: boolean): void;
|
|
51
|
+
setPageIndex(index: number): void;
|
|
50
52
|
setPoints(datasetId: string, points: MapPoint<unknown>[]): void;
|
|
51
53
|
subscribe(cb: Listener$1): Unsubscribe;
|
|
52
54
|
private setState;
|
|
@@ -184,6 +186,7 @@ declare class ListingEngine<TEntity, TFilters> {
|
|
|
184
186
|
readonly pagination: {
|
|
185
187
|
readonly mode: PaginationMode;
|
|
186
188
|
readonly loading: boolean;
|
|
189
|
+
readonly pageIndex: number;
|
|
187
190
|
};
|
|
188
191
|
readonly layers: {
|
|
189
192
|
readonly [x: string]: boolean;
|
|
@@ -202,6 +205,17 @@ declare class ListingEngine<TEntity, TFilters> {
|
|
|
202
205
|
get options(): Readonly<IListingConfigOptions>;
|
|
203
206
|
applyFilters(patch: Partial<TFilters>): Promise<void>;
|
|
204
207
|
loadPage(): Promise<void>;
|
|
208
|
+
/**
|
|
209
|
+
* Numbered/offset pagination for `PaginationMode.Paged`: fetches the
|
|
210
|
+
* 0-based page `index` with an offset-based `PageRequest`
|
|
211
|
+
* (`offset = index * pageSize` — see that field's doc; numbered pagination
|
|
212
|
+
* needs an offset-capable adapter) and REPLACES the current results,
|
|
213
|
+
* recording the landed page in `state.pagination.pageIndex`. No-op for a
|
|
214
|
+
* negative index. Same last-wins token + loading discipline as
|
|
215
|
+
* `loadPage()`, so a slow, superseded page fetch never clobbers a newer
|
|
216
|
+
* one (and never leaves `loading` stuck true).
|
|
217
|
+
*/
|
|
218
|
+
goToPage(index: number): Promise<void>;
|
|
205
219
|
loadPoints(bounds: Bounds): Promise<void>;
|
|
206
220
|
setMapHandle(handle: MapHandle | null): void;
|
|
207
221
|
/**
|
|
@@ -652,17 +666,30 @@ interface IListingMapProps {
|
|
|
652
666
|
declare function ListingMap(props: IListingMapProps): react.JSX.Element;
|
|
653
667
|
|
|
654
668
|
/**
|
|
655
|
-
* Structure-only
|
|
656
|
-
*
|
|
657
|
-
*
|
|
658
|
-
*
|
|
659
|
-
*
|
|
669
|
+
* Structure-only pagination control, dispatching on `pagination.mode`:
|
|
670
|
+
*
|
|
671
|
+
* - `Infinite`: the original "Load more" button, unchanged — renders NOTHING
|
|
672
|
+
* when there is no next page (`results.nextCursor == null`), and while a
|
|
673
|
+
* query is in flight the button is disabled; clicking calls
|
|
674
|
+
* `engine.loadPage()`.
|
|
675
|
+
* - `Paged` with a KNOWN `results.total`: a numbered "1 2 3 … N" pager
|
|
676
|
+
* (`totalPages = ceil(total / pageSize)`), rendered as a
|
|
677
|
+
* `<nav class="rle-pagination">` with prev/next buttons plus one button
|
|
678
|
+
* per page (windowed past 7 pages — see `buildPageItems`). Clicking page
|
|
679
|
+
* `n` calls `engine.goToPage(n - 1)` (0-based). Renders nothing when
|
|
680
|
+
* there is at most one page — no dangling chrome under a short list.
|
|
681
|
+
* - `Paged` with UNKNOWN total: just prev/next. With no `total` there is no
|
|
682
|
+
* page count to draw, so "has a next page" is derived instead: a full
|
|
683
|
+
* page (`items.length >= pageSize`) may have more behind it, and a
|
|
684
|
+
* non-null `nextCursor` (the legacy cursor-driven path) definitely does.
|
|
685
|
+
* A short/empty page with no cursor is the end. Kept deliberately simple —
|
|
686
|
+
* offset-capable adapters that want the numbered pager should return
|
|
687
|
+
* `total`.
|
|
660
688
|
*
|
|
661
|
-
*
|
|
662
|
-
*
|
|
663
|
-
*
|
|
664
|
-
*
|
|
665
|
-
* exists.
|
|
689
|
+
* All buttons are disabled while `pagination.loading`. Renders plain
|
|
690
|
+
* `<button>`s rather than an injected component: `useListingComponents()`
|
|
691
|
+
* has no `Button` slot yet (same rationale as before this component grew
|
|
692
|
+
* Paged support).
|
|
666
693
|
*/
|
|
667
694
|
declare function ListingPagination(): react.JSX.Element | null;
|
|
668
695
|
|
|
@@ -740,6 +767,7 @@ declare function useListingState<TEntity = unknown, TFilters = unknown>(): {
|
|
|
740
767
|
readonly pagination: {
|
|
741
768
|
readonly mode: PaginationMode;
|
|
742
769
|
readonly loading: boolean;
|
|
770
|
+
readonly pageIndex: number;
|
|
743
771
|
};
|
|
744
772
|
readonly layers: {
|
|
745
773
|
readonly [x: string]: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { P as Page, B as Bounds, E as EntityId, M as MapPoint, U as Unsubscribe, a as MapProvider, b as MapHandle, Q as QueryParams, L as LatLng } from './map-provider.interface-
|
|
2
|
-
export { c as EntityAdapter, d as MapInitOptions, e as MapOverlayHandle, f as PageRequest, R as RenderedLayer } from './map-provider.interface-
|
|
3
|
-
import { P as PaginationMode, D as DatasetDefinition, I as IListingConfigOptions, F as FilterRegistry, a as IListingToolbarProps } from './listing-app-
|
|
4
|
-
export { C as ClusterOptions, b as FallbackPopup, c as FilterControlProps, d as FilterDefinition, e as IListingCardProps, f as IListingComponents, g as IListingEmptyProps, h as IListingFilterPanelProps, i as IListingLoadingProps, j as IListingMarkerProps, k as IListingPopupProps, l as IListingResultHeaderProps, m as IListingSearchProps, n as IListingSidebarProps, L as ListingApp, o as ListingAppProps, p as ListingComponentsProvider, M as MarkerRenderer, q as MobileSheetFooterContext, u as useListingComponents } from './listing-app-
|
|
1
|
+
import { P as Page, B as Bounds, E as EntityId, M as MapPoint, U as Unsubscribe, a as MapProvider, b as MapHandle, Q as QueryParams, L as LatLng } from './map-provider.interface-B_8-GtsW.js';
|
|
2
|
+
export { c as EntityAdapter, d as MapInitOptions, e as MapOverlayHandle, f as PageRequest, R as RenderedLayer } from './map-provider.interface-B_8-GtsW.js';
|
|
3
|
+
import { P as PaginationMode, D as DatasetDefinition, I as IListingConfigOptions, F as FilterRegistry, a as IListingToolbarProps } from './listing-app-4RjoW6x-.js';
|
|
4
|
+
export { C as ClusterOptions, b as FallbackPopup, c as FilterControlProps, d as FilterDefinition, e as IListingCardProps, f as IListingComponents, g as IListingEmptyProps, h as IListingFilterPanelProps, i as IListingLoadingProps, j as IListingMarkerProps, k as IListingPopupProps, l as IListingResultHeaderProps, m as IListingSearchProps, n as IListingSidebarProps, L as ListingApp, o as ListingAppProps, p as ListingComponentsProvider, M as MarkerRenderer, q as MobileSheetFooterContext, u as useListingComponents } from './listing-app-4RjoW6x-.js';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import { ReactNode } from 'react';
|
|
7
7
|
|
|
@@ -22,6 +22,7 @@ interface ListingState<TEntity, TFilters> {
|
|
|
22
22
|
pagination: {
|
|
23
23
|
mode: PaginationMode;
|
|
24
24
|
loading: boolean;
|
|
25
|
+
pageIndex: number;
|
|
25
26
|
};
|
|
26
27
|
layers: Record<string, boolean>;
|
|
27
28
|
points: Readonly<Record<string, ReadonlyArray<MapPoint<unknown>>>>;
|
|
@@ -47,6 +48,7 @@ declare class ListingStore<TEntity, TFilters> {
|
|
|
47
48
|
setHovered(id: EntityId | null): void;
|
|
48
49
|
setLayerVisible(id: string, visible: boolean): void;
|
|
49
50
|
setLoading(loading: boolean): void;
|
|
51
|
+
setPageIndex(index: number): void;
|
|
50
52
|
setPoints(datasetId: string, points: MapPoint<unknown>[]): void;
|
|
51
53
|
subscribe(cb: Listener$1): Unsubscribe;
|
|
52
54
|
private setState;
|
|
@@ -184,6 +186,7 @@ declare class ListingEngine<TEntity, TFilters> {
|
|
|
184
186
|
readonly pagination: {
|
|
185
187
|
readonly mode: PaginationMode;
|
|
186
188
|
readonly loading: boolean;
|
|
189
|
+
readonly pageIndex: number;
|
|
187
190
|
};
|
|
188
191
|
readonly layers: {
|
|
189
192
|
readonly [x: string]: boolean;
|
|
@@ -202,6 +205,17 @@ declare class ListingEngine<TEntity, TFilters> {
|
|
|
202
205
|
get options(): Readonly<IListingConfigOptions>;
|
|
203
206
|
applyFilters(patch: Partial<TFilters>): Promise<void>;
|
|
204
207
|
loadPage(): Promise<void>;
|
|
208
|
+
/**
|
|
209
|
+
* Numbered/offset pagination for `PaginationMode.Paged`: fetches the
|
|
210
|
+
* 0-based page `index` with an offset-based `PageRequest`
|
|
211
|
+
* (`offset = index * pageSize` — see that field's doc; numbered pagination
|
|
212
|
+
* needs an offset-capable adapter) and REPLACES the current results,
|
|
213
|
+
* recording the landed page in `state.pagination.pageIndex`. No-op for a
|
|
214
|
+
* negative index. Same last-wins token + loading discipline as
|
|
215
|
+
* `loadPage()`, so a slow, superseded page fetch never clobbers a newer
|
|
216
|
+
* one (and never leaves `loading` stuck true).
|
|
217
|
+
*/
|
|
218
|
+
goToPage(index: number): Promise<void>;
|
|
205
219
|
loadPoints(bounds: Bounds): Promise<void>;
|
|
206
220
|
setMapHandle(handle: MapHandle | null): void;
|
|
207
221
|
/**
|
|
@@ -652,17 +666,30 @@ interface IListingMapProps {
|
|
|
652
666
|
declare function ListingMap(props: IListingMapProps): react.JSX.Element;
|
|
653
667
|
|
|
654
668
|
/**
|
|
655
|
-
* Structure-only
|
|
656
|
-
*
|
|
657
|
-
*
|
|
658
|
-
*
|
|
659
|
-
*
|
|
669
|
+
* Structure-only pagination control, dispatching on `pagination.mode`:
|
|
670
|
+
*
|
|
671
|
+
* - `Infinite`: the original "Load more" button, unchanged — renders NOTHING
|
|
672
|
+
* when there is no next page (`results.nextCursor == null`), and while a
|
|
673
|
+
* query is in flight the button is disabled; clicking calls
|
|
674
|
+
* `engine.loadPage()`.
|
|
675
|
+
* - `Paged` with a KNOWN `results.total`: a numbered "1 2 3 … N" pager
|
|
676
|
+
* (`totalPages = ceil(total / pageSize)`), rendered as a
|
|
677
|
+
* `<nav class="rle-pagination">` with prev/next buttons plus one button
|
|
678
|
+
* per page (windowed past 7 pages — see `buildPageItems`). Clicking page
|
|
679
|
+
* `n` calls `engine.goToPage(n - 1)` (0-based). Renders nothing when
|
|
680
|
+
* there is at most one page — no dangling chrome under a short list.
|
|
681
|
+
* - `Paged` with UNKNOWN total: just prev/next. With no `total` there is no
|
|
682
|
+
* page count to draw, so "has a next page" is derived instead: a full
|
|
683
|
+
* page (`items.length >= pageSize`) may have more behind it, and a
|
|
684
|
+
* non-null `nextCursor` (the legacy cursor-driven path) definitely does.
|
|
685
|
+
* A short/empty page with no cursor is the end. Kept deliberately simple —
|
|
686
|
+
* offset-capable adapters that want the numbered pager should return
|
|
687
|
+
* `total`.
|
|
660
688
|
*
|
|
661
|
-
*
|
|
662
|
-
*
|
|
663
|
-
*
|
|
664
|
-
*
|
|
665
|
-
* exists.
|
|
689
|
+
* All buttons are disabled while `pagination.loading`. Renders plain
|
|
690
|
+
* `<button>`s rather than an injected component: `useListingComponents()`
|
|
691
|
+
* has no `Button` slot yet (same rationale as before this component grew
|
|
692
|
+
* Paged support).
|
|
666
693
|
*/
|
|
667
694
|
declare function ListingPagination(): react.JSX.Element | null;
|
|
668
695
|
|
|
@@ -740,6 +767,7 @@ declare function useListingState<TEntity = unknown, TFilters = unknown>(): {
|
|
|
740
767
|
readonly pagination: {
|
|
741
768
|
readonly mode: PaginationMode;
|
|
742
769
|
readonly loading: boolean;
|
|
770
|
+
readonly pageIndex: number;
|
|
743
771
|
};
|
|
744
772
|
readonly layers: {
|
|
745
773
|
readonly [x: string]: boolean;
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{A as V,B as W,C as X,D as Y,S as P,a as Q,b as x,c as T,d as L,e as H,f as O,g as E,h as k,i as q,j as C,k as I,l as B,m as U,n as z,o as G,p as R,q as $,r as p,s as j,t as u,u as y,v as A,w as D,x as J,y as K,z as N}from"./chunk-
|
|
2
|
+
import{A as V,B as W,C as X,D as Y,S as P,a as Q,b as x,c as T,d as L,e as H,f as O,g as E,h as k,i as q,j as C,k as I,l as B,m as U,n as z,o as G,p as R,q as $,r as p,s as j,t as u,u as y,v as A,w as D,x as J,y as K,z as N}from"./chunk-Q55G4XMJ.js";var b=(r=>(r.Paged="paged",r.Infinite="infinite",r))(b||{});var v=(i=>(i.FiltersChanged="FiltersChanged",i.ResultsLoaded="ResultsLoaded",i.PointClicked="PointClicked",i.BoundsChanged="BoundsChanged",i.LayerToggled="LayerToggled",i))(v||{});var d=class{query;listeners=new Set;constructor(t={}){this.query={...t}}getQuery(){return{...this.query}}setQuery(t){this.query={...t},this.notify()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){for(let t of[...this.listeners])t()}};function F(e,t){let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let s of r)if(e[s]!==t[s])return!1;return!0}var h=class{history;toQueryFn;toFiltersFn;hydrateOnStart;isSyncing=!1;unsubscribeEngine=null;unsubscribeHistory=null;constructor(t){this.history=t.history,this.toQueryFn=t.toQuery,this.toFiltersFn=t.toFilters,this.hydrateOnStart=t.hydrateOnStart??!0}start(t){this.stop(),this.unsubscribeEngine=t.subscribe(()=>{this.isSyncing||this.syncEngineToHistory(t)}),this.unsubscribeHistory=this.history.subscribe(()=>{this.isSyncing||this.withSyncGuard(()=>{this.applyFiltersSafely(t,this.toFiltersFn(this.history.getQuery()))})}),this.hydrateOnStart&&this.withSyncGuard(()=>{this.applyFiltersSafely(t,this.toFiltersFn(this.history.getQuery()))})}stop(){this.unsubscribeEngine?.(),this.unsubscribeEngine=null,this.unsubscribeHistory?.(),this.unsubscribeHistory=null}syncEngineToHistory(t){let r=this.toQueryFn(t.state.filters);F(r,this.history.getQuery())||this.withSyncGuard(()=>this.history.setQuery(r))}applyFiltersSafely(t,r){Promise.resolve(t.applyFilters(r)).catch(()=>{})}withSyncGuard(t){this.isSyncing=!0;try{t()}finally{this.isSyncing=!1}}};var f=class{mode;constructor(t={}){this.mode=t.mode??"replace"}getQuery(){if(typeof window>"u")return{};let t=new URLSearchParams(window.location.search),r={};for(let[s,o]of t)o!==""&&(r[s]=o);return r}setQuery(t){if(typeof window>"u")return;let r=new URLSearchParams;for(let[c,l]of Object.entries(t))l===void 0||l===""||r.set(c,l);let s=r.toString(),o=s?`?${s}`:"";if(o===window.location.search)return;let i=`${window.location.pathname}${o}${window.location.hash}`;this.mode==="push"?window.history.pushState(window.history.state,"",i):window.history.replaceState(window.history.state,"",i)}subscribe(t){return typeof window>"u"?()=>{}:(window.addEventListener("popstate",t),()=>{window.removeEventListener("popstate",t)})}};import{jsx as w}from"react/jsx-runtime";function st({children:e}){let{Toolbar:t}=p();return w(t,{children:e})}import{useCallback as a}from"react";function ut(){let e=u(),t=y(),r=a(n=>e.loadPoints(n),[e]),s=a((n,g)=>e.selectPoint(n,g),[e]),o=a(n=>e.setHovered(e.primaryDatasetId,n),[e]),i=a(()=>e.map?.zoomIn(),[e]),c=a(()=>e.map?.zoomOut(),[e]),l=a(()=>e.map?.toggleFullscreen(),[e]),m=a(n=>e.fitBounds(n),[e]);return{bounds:t.bounds,points:t.points,hovered:t.hovered,loadPoints:r,selectPoint:s,setHovered:o,zoomIn:i,zoomOut:c,toggleFullscreen:l,fitBounds:m}}import{useCallback as S}from"react";function ht(e){let t=u(),r=y(),s=S(()=>t.toggleLayer(e),[t,e]);return{visible:r.layers[e]??!0,points:r.points[e]??[],toggle:s}}export{f as BrowserHistoryPort,T as DatasetRegistry,R as FallbackPopup,x as FilterRegistry,P as ListingApp,$ as ListingComponentsProvider,O as ListingConfig,E as ListingEngine,j as ListingEngineContext,v as ListingEventType,D as ListingFilters,K as ListingList,N as ListingMap,V as ListingPagination,Y as ListingProvider,W as ListingResultHeader,Q as ListingStore,st as ListingToolbar,d as MemoryHistoryPort,b as PaginationMode,L as TypedEmitter,h as UrlSyncController,k as composeListingProviders,H as listingDefaultConfig,u as useListing,p as useListingComponents,X as useListingEvent,A as useListingFilters,ht as useListingLayer,ut as useListingMap,J as useListingResults,y as useListingState,q as withConfig,I as withDataset,B as withFilters,z as withInitialFilters,C as withMap,G as withPrimaryDataset,U as withUrlSync};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ComponentType, ReactNode } from 'react';
|
|
3
|
-
import { c as EntityAdapter, M as MapPoint, L as LatLng, a as MapProvider } from './map-provider.interface-
|
|
3
|
+
import { c as EntityAdapter, M as MapPoint, L as LatLng, a as MapProvider } from './map-provider.interface-B_8-GtsW.js';
|
|
4
4
|
|
|
5
5
|
interface FilterControlProps<TValue> {
|
|
6
6
|
value: TValue;
|
|
@@ -188,8 +188,8 @@ interface IStyledListingLayoutProps<TFilters = unknown> {
|
|
|
188
188
|
filterKey: string;
|
|
189
189
|
placeholder?: string;
|
|
190
190
|
};
|
|
191
|
-
/** Extra content rendered
|
|
192
|
-
|
|
191
|
+
/** Extra content rendered in the desktop filter bar between the search box and the `<ListingFilters>` row (e.g. an "advanced filters" modal trigger). Scrolls with the bar. Desktop-only by construction -- the whole filter bar is CSS-hidden below the mobile breakpoint. */
|
|
192
|
+
filterBarStart?: ReactNode;
|
|
193
193
|
/** Extra content rendered in `.rle-list-header` (above the list), to the right of `ListingResultHeader` (e.g. a sort control + save-search). */
|
|
194
194
|
toolbarEnd?: ReactNode;
|
|
195
195
|
/** Optional mobile-header action button (e.g. "Save"), forwarded verbatim to `<MobileHeader action={...} />`. Omit to render just the search + Filters button there. */
|
|
@@ -290,7 +290,7 @@ interface IStyledListingLayoutProps<TFilters = unknown> {
|
|
|
290
290
|
* default -- pass `autoFetch={false}`
|
|
291
291
|
* to opt out and drive the first fetch yourself.
|
|
292
292
|
*/
|
|
293
|
-
declare function StyledListingLayout<TFilters = unknown>({ search,
|
|
293
|
+
declare function StyledListingLayout<TFilters = unknown>({ search, filterBarStart, toolbarEnd, mobileAction, autoFetch, hasMap: hasMapProp, mapCenter, mapZoom, mapControls, mobileSheetFooter, className, }: IStyledListingLayoutProps<TFilters>): react.JSX.Element;
|
|
294
294
|
|
|
295
295
|
/**
|
|
296
296
|
* Two-shape `map` prop: pass a ready `MapProvider`, or the `{ apiKey, mapId? }`
|
|
@@ -363,8 +363,8 @@ interface ListingAppProps<TFilters> {
|
|
|
363
363
|
/** The mobile header action (e.g. "Save"/"Add") -- forwarded verbatim to `StyledListingLayout`/`MobileHeader`. */
|
|
364
364
|
mobileAction?: IBottomNavAction;
|
|
365
365
|
search?: IStyledListingLayoutProps['search'];
|
|
366
|
-
/** Forwarded verbatim to `StyledListingLayout`'s `
|
|
367
|
-
|
|
366
|
+
/** Forwarded verbatim to `StyledListingLayout`'s `filterBarStart` -- extra content between the search box and the quick-filters row in the desktop filter bar (see that prop's doc comment). */
|
|
367
|
+
filterBarStart?: IStyledListingLayoutProps['filterBarStart'];
|
|
368
368
|
toolbarEnd?: IStyledListingLayoutProps['toolbarEnd'];
|
|
369
369
|
/**
|
|
370
370
|
* Rendered as an absolutely-positioned overlay floating over the map (e.g. zoom/fullscreen
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ComponentType, ReactNode } from 'react';
|
|
3
|
-
import { c as EntityAdapter, M as MapPoint, L as LatLng, a as MapProvider } from './map-provider.interface-
|
|
3
|
+
import { c as EntityAdapter, M as MapPoint, L as LatLng, a as MapProvider } from './map-provider.interface-B_8-GtsW.cjs';
|
|
4
4
|
|
|
5
5
|
interface FilterControlProps<TValue> {
|
|
6
6
|
value: TValue;
|
|
@@ -188,8 +188,8 @@ interface IStyledListingLayoutProps<TFilters = unknown> {
|
|
|
188
188
|
filterKey: string;
|
|
189
189
|
placeholder?: string;
|
|
190
190
|
};
|
|
191
|
-
/** Extra content rendered
|
|
192
|
-
|
|
191
|
+
/** Extra content rendered in the desktop filter bar between the search box and the `<ListingFilters>` row (e.g. an "advanced filters" modal trigger). Scrolls with the bar. Desktop-only by construction -- the whole filter bar is CSS-hidden below the mobile breakpoint. */
|
|
192
|
+
filterBarStart?: ReactNode;
|
|
193
193
|
/** Extra content rendered in `.rle-list-header` (above the list), to the right of `ListingResultHeader` (e.g. a sort control + save-search). */
|
|
194
194
|
toolbarEnd?: ReactNode;
|
|
195
195
|
/** Optional mobile-header action button (e.g. "Save"), forwarded verbatim to `<MobileHeader action={...} />`. Omit to render just the search + Filters button there. */
|
|
@@ -290,7 +290,7 @@ interface IStyledListingLayoutProps<TFilters = unknown> {
|
|
|
290
290
|
* default -- pass `autoFetch={false}`
|
|
291
291
|
* to opt out and drive the first fetch yourself.
|
|
292
292
|
*/
|
|
293
|
-
declare function StyledListingLayout<TFilters = unknown>({ search,
|
|
293
|
+
declare function StyledListingLayout<TFilters = unknown>({ search, filterBarStart, toolbarEnd, mobileAction, autoFetch, hasMap: hasMapProp, mapCenter, mapZoom, mapControls, mobileSheetFooter, className, }: IStyledListingLayoutProps<TFilters>): react.JSX.Element;
|
|
294
294
|
|
|
295
295
|
/**
|
|
296
296
|
* Two-shape `map` prop: pass a ready `MapProvider`, or the `{ apiKey, mapId? }`
|
|
@@ -363,8 +363,8 @@ interface ListingAppProps<TFilters> {
|
|
|
363
363
|
/** The mobile header action (e.g. "Save"/"Add") -- forwarded verbatim to `StyledListingLayout`/`MobileHeader`. */
|
|
364
364
|
mobileAction?: IBottomNavAction;
|
|
365
365
|
search?: IStyledListingLayoutProps['search'];
|
|
366
|
-
/** Forwarded verbatim to `StyledListingLayout`'s `
|
|
367
|
-
|
|
366
|
+
/** Forwarded verbatim to `StyledListingLayout`'s `filterBarStart` -- extra content between the search box and the quick-filters row in the desktop filter bar (see that prop's doc comment). */
|
|
367
|
+
filterBarStart?: IStyledListingLayoutProps['filterBarStart'];
|
|
368
368
|
toolbarEnd?: IStyledListingLayoutProps['toolbarEnd'];
|
|
369
369
|
/**
|
|
370
370
|
* Rendered as an absolutely-positioned overlay floating over the map (e.g. zoom/fullscreen
|
package/dist/{map-provider.interface-l-oTHRTZ.d.cts → map-provider.interface-B_8-GtsW.d.cts}
RENAMED
|
@@ -12,6 +12,13 @@ interface LatLng {
|
|
|
12
12
|
interface PageRequest {
|
|
13
13
|
cursor?: string | null;
|
|
14
14
|
limit: number;
|
|
15
|
+
/**
|
|
16
|
+
* 0-based row offset for numbered/paged pagination (`ListingEngine#goToPage`
|
|
17
|
+
* sends `pageIndex * pageSize`). Adapters backed by offset-capable APIs
|
|
18
|
+
* honor it; cursor-only adapters may ignore it. When both `cursor` and
|
|
19
|
+
* `offset` appear, `cursor` wins.
|
|
20
|
+
*/
|
|
21
|
+
offset?: number;
|
|
15
22
|
}
|
|
16
23
|
interface Page<T> {
|
|
17
24
|
items: T[];
|
|
@@ -12,6 +12,13 @@ interface LatLng {
|
|
|
12
12
|
interface PageRequest {
|
|
13
13
|
cursor?: string | null;
|
|
14
14
|
limit: number;
|
|
15
|
+
/**
|
|
16
|
+
* 0-based row offset for numbered/paged pagination (`ListingEngine#goToPage`
|
|
17
|
+
* sends `pageIndex * pageSize`). Adapters backed by offset-capable APIs
|
|
18
|
+
* honor it; cursor-only adapters may ignore it. When both `cursor` and
|
|
19
|
+
* `offset` appear, `cursor` wins.
|
|
20
|
+
*/
|
|
21
|
+
offset?: number;
|
|
15
22
|
}
|
|
16
23
|
interface Page<T> {
|
|
17
24
|
items: T[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { APIOptions } from '@googlemaps/js-api-loader';
|
|
2
|
-
import { a as MapProvider } from '../../map-provider.interface-
|
|
2
|
+
import { a as MapProvider } from '../../map-provider.interface-B_8-GtsW.cjs';
|
|
3
3
|
|
|
4
4
|
interface GoogleMapsProviderConfig {
|
|
5
5
|
/** Google Maps JavaScript API key. Required -- there is no hardcoded fallback. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { APIOptions } from '@googlemaps/js-api-loader';
|
|
2
|
-
import { a as MapProvider } from '../../map-provider.interface-
|
|
2
|
+
import { a as MapProvider } from '../../map-provider.interface-B_8-GtsW.js';
|
|
3
3
|
|
|
4
4
|
interface GoogleMapsProviderConfig {
|
|
5
5
|
/** Google Maps JavaScript API key. Required -- there is no hardcoded fallback. */
|
package/dist/styled/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
-
var
|
|
2
|
+
var _chunk76JZ5SOAcjs = require('../chunk-76JZ5SOA.cjs');var _jsxruntime = require('react/jsx-runtime');function L({children:o}){return _jsxruntime.jsx.call(void 0, _chunk76JZ5SOAcjs.q,{..._chunk76JZ5SOAcjs.O,children:o})}exports.BottomNav = _chunk76JZ5SOAcjs.P; exports.BottomSheet = _chunk76JZ5SOAcjs.Q; exports.ListingApp = _chunk76JZ5SOAcjs.S; exports.StyledCard = _chunk76JZ5SOAcjs.E; exports.StyledComponentsProviderWithDefaults = L; exports.StyledEmpty = _chunk76JZ5SOAcjs.F; exports.StyledFilterPanel = _chunk76JZ5SOAcjs.G; exports.StyledListingLayout = _chunk76JZ5SOAcjs.R; exports.StyledLoading = _chunk76JZ5SOAcjs.H; exports.StyledMarker = _chunk76JZ5SOAcjs.I; exports.StyledPopup = _chunk76JZ5SOAcjs.J; exports.StyledResultHeader = _chunk76JZ5SOAcjs.K; exports.StyledSearch = _chunk76JZ5SOAcjs.L; exports.StyledSidebar = _chunk76JZ5SOAcjs.M; exports.StyledToolbar = _chunk76JZ5SOAcjs.N; exports.styledDefaultComponents = _chunk76JZ5SOAcjs.O;
|
package/dist/styled/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { e as IListingCardProps, g as IListingEmptyProps, h as IListingFilterPanelProps, i as IListingLoadingProps, j as IListingMarkerProps, k as IListingPopupProps, l as IListingResultHeaderProps, m as IListingSearchProps, n as IListingSidebarProps, a as IListingToolbarProps, f as IListingComponents } from '../listing-app-
|
|
4
|
-
export { B as BottomNav, r as BottomNavView, s as IBottomNavAction, t as IBottomNavProps, v as IStyledListingLayoutProps, L as ListingApp, w as ListingAppMapProp, o as ListingAppProps, q as MobileSheetFooterContext, S as StyledListingLayout } from '../listing-app-
|
|
5
|
-
import '../map-provider.interface-
|
|
3
|
+
import { e as IListingCardProps, g as IListingEmptyProps, h as IListingFilterPanelProps, i as IListingLoadingProps, j as IListingMarkerProps, k as IListingPopupProps, l as IListingResultHeaderProps, m as IListingSearchProps, n as IListingSidebarProps, a as IListingToolbarProps, f as IListingComponents } from '../listing-app-B8lXqvd5.cjs';
|
|
4
|
+
export { B as BottomNav, r as BottomNavView, s as IBottomNavAction, t as IBottomNavProps, v as IStyledListingLayoutProps, L as ListingApp, w as ListingAppMapProp, o as ListingAppProps, q as MobileSheetFooterContext, S as StyledListingLayout } from '../listing-app-B8lXqvd5.cjs';
|
|
5
|
+
import '../map-provider.interface-B_8-GtsW.cjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Default `/styled` `Card` slot. Renders an optional image, title, subtitle,
|
package/dist/styled/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { e as IListingCardProps, g as IListingEmptyProps, h as IListingFilterPanelProps, i as IListingLoadingProps, j as IListingMarkerProps, k as IListingPopupProps, l as IListingResultHeaderProps, m as IListingSearchProps, n as IListingSidebarProps, a as IListingToolbarProps, f as IListingComponents } from '../listing-app-
|
|
4
|
-
export { B as BottomNav, r as BottomNavView, s as IBottomNavAction, t as IBottomNavProps, v as IStyledListingLayoutProps, L as ListingApp, w as ListingAppMapProp, o as ListingAppProps, q as MobileSheetFooterContext, S as StyledListingLayout } from '../listing-app-
|
|
5
|
-
import '../map-provider.interface-
|
|
3
|
+
import { e as IListingCardProps, g as IListingEmptyProps, h as IListingFilterPanelProps, i as IListingLoadingProps, j as IListingMarkerProps, k as IListingPopupProps, l as IListingResultHeaderProps, m as IListingSearchProps, n as IListingSidebarProps, a as IListingToolbarProps, f as IListingComponents } from '../listing-app-4RjoW6x-.js';
|
|
4
|
+
export { B as BottomNav, r as BottomNavView, s as IBottomNavAction, t as IBottomNavProps, v as IStyledListingLayoutProps, L as ListingApp, w as ListingAppMapProp, o as ListingAppProps, q as MobileSheetFooterContext, S as StyledListingLayout } from '../listing-app-4RjoW6x-.js';
|
|
5
|
+
import '../map-provider.interface-B_8-GtsW.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Default `/styled` `Card` slot. Renders an optional image, title, subtitle,
|
package/dist/styled/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{E as r,F as p,G as i,H as y,I as d,J as l,K as n,L as m,M as s,N as a,O as t,P as S,Q as f,R as P,S as u,q as e}from"../chunk-
|
|
2
|
+
import{E as r,F as p,G as i,H as y,I as d,J as l,K as n,L as m,M as s,N as a,O as t,P as S,Q as f,R as P,S as u,q as e}from"../chunk-Q55G4XMJ.js";import{jsx as g}from"react/jsx-runtime";function L({children:o}){return g(e,{...t,children:o})}export{S as BottomNav,f as BottomSheet,u as ListingApp,r as StyledCard,L as StyledComponentsProviderWithDefaults,p as StyledEmpty,i as StyledFilterPanel,P as StyledListingLayout,y as StyledLoading,d as StyledMarker,l as StyledPopup,n as StyledResultHeader,m as StyledSearch,s as StyledSidebar,a as StyledToolbar,t as styledDefaultComponents};
|
package/dist/styles.css
CHANGED
|
@@ -582,6 +582,77 @@
|
|
|
582
582
|
font-size: var(--rle-fs-sm);
|
|
583
583
|
}
|
|
584
584
|
|
|
585
|
+
/* -----------------------------------------------------------------------
|
|
586
|
+
* Numbered pagination (Paged mode) -- `ListingPagination`'s "1 2 3 … N"
|
|
587
|
+
* pager. Rendered inside `.rle-list` after the results grid; `flex-shrink: 0`
|
|
588
|
+
* mirrors the guard the other in-scroller blocks use so the pager never gets
|
|
589
|
+
* crushed if `.rle-list` becomes a flex column.
|
|
590
|
+
* --------------------------------------------------------------------- */
|
|
591
|
+
|
|
592
|
+
.rle-pagination {
|
|
593
|
+
display: flex;
|
|
594
|
+
flex-shrink: 0;
|
|
595
|
+
align-items: center;
|
|
596
|
+
justify-content: center;
|
|
597
|
+
gap: var(--rle-space);
|
|
598
|
+
padding: var(--rle-space) 0;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
.rle-page-btn {
|
|
602
|
+
display: inline-flex;
|
|
603
|
+
align-items: center;
|
|
604
|
+
justify-content: center;
|
|
605
|
+
height: 36px;
|
|
606
|
+
min-width: 36px;
|
|
607
|
+
padding: 0 0.5em;
|
|
608
|
+
background: var(--rle-surface);
|
|
609
|
+
border: 1px solid var(--rle-border);
|
|
610
|
+
border-radius: var(--rle-radius-sm);
|
|
611
|
+
color: var(--rle-fg);
|
|
612
|
+
font-size: var(--rle-fs-md);
|
|
613
|
+
font-variant-numeric: tabular-nums;
|
|
614
|
+
cursor: pointer;
|
|
615
|
+
transition:
|
|
616
|
+
background-color 150ms ease,
|
|
617
|
+
border-color 150ms ease,
|
|
618
|
+
box-shadow 150ms ease,
|
|
619
|
+
color 150ms ease;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
/* Hover wash explicitly scoped to enabled, non-active buttons -- the active
|
|
623
|
+
page must keep its primary fill (its own brightness hover below) and a
|
|
624
|
+
disabled button must not light up, and neither exclusion can be left to
|
|
625
|
+
source-order/specificity races against this 3-pseudo selector. */
|
|
626
|
+
.rle-page-btn:hover:not(:disabled):not(.rle-page-btn--active) {
|
|
627
|
+
background: var(--rle-muted-bg);
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
.rle-page-btn:focus-visible {
|
|
631
|
+
outline: none;
|
|
632
|
+
border-color: var(--rle-primary);
|
|
633
|
+
box-shadow: 0 0 0 3px var(--rle-ring);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
.rle-page-btn:disabled {
|
|
637
|
+
opacity: 0.5;
|
|
638
|
+
cursor: default;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
.rle-page-btn--active {
|
|
642
|
+
background: var(--rle-primary);
|
|
643
|
+
border-color: transparent;
|
|
644
|
+
color: var(--rle-primary-contrast);
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
.rle-page-btn--active:hover:not(:disabled) {
|
|
648
|
+
filter: brightness(0.94);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
.rle-page-ellipsis {
|
|
652
|
+
color: var(--rle-muted);
|
|
653
|
+
font-size: var(--rle-fs-md);
|
|
654
|
+
}
|
|
655
|
+
|
|
585
656
|
/* -----------------------------------------------------------------------
|
|
586
657
|
* Layout shell -- the responsive "filter bar + list/map split" chrome
|
|
587
658
|
* `StyledListingLayout` composes the `~/react` structure-only components
|
|
@@ -686,9 +757,9 @@
|
|
|
686
757
|
gap: var(--rle-space);
|
|
687
758
|
}
|
|
688
759
|
|
|
689
|
-
/* Consumer slot
|
|
690
|
-
as the row itself, never shrinks into the scroll. */
|
|
691
|
-
.rle-filter-
|
|
760
|
+
/* Consumer slot between the search box and the filters row (`filterBarStart`)
|
|
761
|
+
-- same rhythm as the row itself, never shrinks into the scroll. */
|
|
762
|
+
.rle-filter-bar__slot {
|
|
692
763
|
display: flex;
|
|
693
764
|
flex-shrink: 0;
|
|
694
765
|
align-items: center;
|
package/dist/testing/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;"use client";
|
|
2
|
-
var o= (_class =class{constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);_class.prototype.__init9.call(this);_class.prototype.__init10.call(this);_class.prototype.__init11.call(this);_class.prototype.__init12.call(this); }__init() {this.mounts=[]}__init2() {this.renderedLayers=[]}__init3() {this.removedLayers=[]}__init4() {this.fitBoundsCalls=[]}__init5() {this.destroyed=[]}__init6() {this.destroyCount=0}__init7() {this.markerStates=null}__init8() {this.overlays=[]}__init9() {this.zoomCalls=[]}__init10() {this.fullscreenToggles=0}__init11() {this.boundsListeners=new Set}__init12() {this.mapClickListeners=new Set}mount(t,e){let n={raw:{el:t,opts:e}};return this.mounts.push(n),this.fullscreenTarget=_nullishCoalesce(e.fullscreenTarget, () => (t)),n}renderLayer(t,e){this.renderedLayers.push(e);let n=!1;return()=>{if(n)return;n=!0;let s=this.renderedLayers.indexOf(e);s!==-1&&(this.renderedLayers.splice(s,1),this.removedLayers.push(e))}}onBoundsChange(t,e){return this.boundsListeners.add(e),()=>{this.boundsListeners.delete(e)}}emitBounds(t){for(let e of this.boundsListeners)e(t)}onMapClick(t){return this.mapClickListeners.add(t),()=>{this.mapClickListeners.delete(t)}}emitMapClick(){for(let t of this.mapClickListeners)t()}fitBounds(t,e){this.fitBoundsCalls.push(e)}destroy(t){this.destroyed.push(t),this.destroyCount+=1,this.boundsListeners.clear(),this.mapClickListeners.clear()}updateMarkerStates(t,e){this.markerStates={selected:t,hovered:e}}mountOverlay(t){let e=document.createElement("div");document.body.appendChild(e);let n={container:e,position:t};return this.overlays.push(n),{container:e,setPosition:s=>{n.position=s},unmount:()=>{e.remove();let s=this.overlays.indexOf(n);s!==-1&&this.overlays.splice(s,1)}}}zoomIn(){this.zoomCalls.push("in")}zoomOut(){this.zoomCalls.push("out")}toggleFullscreen(){this.fullscreenToggles+=1,this.fullscreenTarget&&typeof this.fullscreenTarget.requestFullscreen=="function"&&_optionalChain([this, 'access', _ => _.fullscreenTarget, 'access', _2 => _2.requestFullscreen, 'call', _3 => _3(), 'optionalAccess', _4 => _4.catch, 'call', _5 => _5(()=>{})])}}, _class);var a=class{constructor(t,e,n,s=r=>r.id){this.rows=t;this.predicate=e;this.toLatLng=n;this.idOf=s}async list(t,e){let n=this.rows.filter(u=>this.predicate(u,t)),s=e.cursor
|
|
2
|
+
var o= (_class =class{constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);_class.prototype.__init9.call(this);_class.prototype.__init10.call(this);_class.prototype.__init11.call(this);_class.prototype.__init12.call(this); }__init() {this.mounts=[]}__init2() {this.renderedLayers=[]}__init3() {this.removedLayers=[]}__init4() {this.fitBoundsCalls=[]}__init5() {this.destroyed=[]}__init6() {this.destroyCount=0}__init7() {this.markerStates=null}__init8() {this.overlays=[]}__init9() {this.zoomCalls=[]}__init10() {this.fullscreenToggles=0}__init11() {this.boundsListeners=new Set}__init12() {this.mapClickListeners=new Set}mount(t,e){let n={raw:{el:t,opts:e}};return this.mounts.push(n),this.fullscreenTarget=_nullishCoalesce(e.fullscreenTarget, () => (t)),n}renderLayer(t,e){this.renderedLayers.push(e);let n=!1;return()=>{if(n)return;n=!0;let s=this.renderedLayers.indexOf(e);s!==-1&&(this.renderedLayers.splice(s,1),this.removedLayers.push(e))}}onBoundsChange(t,e){return this.boundsListeners.add(e),()=>{this.boundsListeners.delete(e)}}emitBounds(t){for(let e of this.boundsListeners)e(t)}onMapClick(t){return this.mapClickListeners.add(t),()=>{this.mapClickListeners.delete(t)}}emitMapClick(){for(let t of this.mapClickListeners)t()}fitBounds(t,e){this.fitBoundsCalls.push(e)}destroy(t){this.destroyed.push(t),this.destroyCount+=1,this.boundsListeners.clear(),this.mapClickListeners.clear()}updateMarkerStates(t,e){this.markerStates={selected:t,hovered:e}}mountOverlay(t){let e=document.createElement("div");document.body.appendChild(e);let n={container:e,position:t};return this.overlays.push(n),{container:e,setPosition:s=>{n.position=s},unmount:()=>{e.remove();let s=this.overlays.indexOf(n);s!==-1&&this.overlays.splice(s,1)}}}zoomIn(){this.zoomCalls.push("in")}zoomOut(){this.zoomCalls.push("out")}toggleFullscreen(){this.fullscreenToggles+=1,this.fullscreenTarget&&typeof this.fullscreenTarget.requestFullscreen=="function"&&_optionalChain([this, 'access', _ => _.fullscreenTarget, 'access', _2 => _2.requestFullscreen, 'call', _3 => _3(), 'optionalAccess', _4 => _4.catch, 'call', _5 => _5(()=>{})])}}, _class);var a=class{constructor(t,e,n,s=r=>r.id){this.rows=t;this.predicate=e;this.toLatLng=n;this.idOf=s}async list(t,e){let n=this.rows.filter(u=>this.predicate(u,t)),s=e.cursor!=null?Number(e.cursor)+1:_nullishCoalesce(e.offset, () => (0)),r=n.slice(s,s+e.limit),i=s+r.length-1,l=i+1<n.length;return{items:r,nextCursor:l?String(i):null,total:n.length}}async getPoints(t,e){let s=this.rows.filter(r=>this.predicate(r,t)).map(r=>({id:this.idOf(r),position:this.toLatLng(r),entity:r}));return e?s.filter(r=>this.isInBounds(r.position,e)):s}async getById(t){let e=this.rows.find(n=>this.idOf(n)===t);if(!e)throw new Error(`InMemoryEntityAdapter: no row with id "${String(t)}"`);return e}isInBounds(t,e){return t.lat<=e.north&&t.lat>=e.south&&t.lng>=e.west&&t.lng<=e.east}};exports.FakeMapProvider = o; exports.InMemoryEntityAdapter = a;
|
package/dist/testing/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as MapProvider, b as MapHandle, R as RenderedLayer, B as Bounds, E as EntityId, L as LatLng, d as MapInitOptions, U as Unsubscribe, e as MapOverlayHandle, c as EntityAdapter, f as PageRequest, P as Page, M as MapPoint } from '../map-provider.interface-
|
|
1
|
+
import { a as MapProvider, b as MapHandle, R as RenderedLayer, B as Bounds, E as EntityId, L as LatLng, d as MapInitOptions, U as Unsubscribe, e as MapOverlayHandle, c as EntityAdapter, f as PageRequest, P as Page, M as MapPoint } from '../map-provider.interface-B_8-GtsW.cjs';
|
|
2
2
|
|
|
3
3
|
type BoundsListener = (b: Bounds) => void;
|
|
4
4
|
/** One live overlay record kept by `FakeMapProvider.mountOverlay` for assertions. */
|
|
@@ -65,7 +65,10 @@ declare class FakeMapProvider implements MapProvider {
|
|
|
65
65
|
* `predicate` and paginates by array index: `cursor` is the (stringified)
|
|
66
66
|
* index of the last row already served (`null` means start from the
|
|
67
67
|
* beginning), and the returned `nextCursor` is that same kind of value for
|
|
68
|
-
* the next call — `null` once nothing is left.
|
|
68
|
+
* the next call — `null` once nothing is left. It is also offset-capable:
|
|
69
|
+
* with no cursor, `offset` positions the window directly (cursor wins when
|
|
70
|
+
* both appear, matching `PageRequest`'s contract), which is what
|
|
71
|
+
* `ListingEngine#goToPage`'s numbered pagination sends. `getPoints()` runs the same
|
|
69
72
|
* predicate filter and projects each surviving row through `toLatLng`
|
|
70
73
|
* (further narrowed to `bounds` when one is given). `idOf` defaults to
|
|
71
74
|
* reading `row.id`, mirroring most real adapters, but can be overridden for
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as MapProvider, b as MapHandle, R as RenderedLayer, B as Bounds, E as EntityId, L as LatLng, d as MapInitOptions, U as Unsubscribe, e as MapOverlayHandle, c as EntityAdapter, f as PageRequest, P as Page, M as MapPoint } from '../map-provider.interface-
|
|
1
|
+
import { a as MapProvider, b as MapHandle, R as RenderedLayer, B as Bounds, E as EntityId, L as LatLng, d as MapInitOptions, U as Unsubscribe, e as MapOverlayHandle, c as EntityAdapter, f as PageRequest, P as Page, M as MapPoint } from '../map-provider.interface-B_8-GtsW.js';
|
|
2
2
|
|
|
3
3
|
type BoundsListener = (b: Bounds) => void;
|
|
4
4
|
/** One live overlay record kept by `FakeMapProvider.mountOverlay` for assertions. */
|
|
@@ -65,7 +65,10 @@ declare class FakeMapProvider implements MapProvider {
|
|
|
65
65
|
* `predicate` and paginates by array index: `cursor` is the (stringified)
|
|
66
66
|
* index of the last row already served (`null` means start from the
|
|
67
67
|
* beginning), and the returned `nextCursor` is that same kind of value for
|
|
68
|
-
* the next call — `null` once nothing is left.
|
|
68
|
+
* the next call — `null` once nothing is left. It is also offset-capable:
|
|
69
|
+
* with no cursor, `offset` positions the window directly (cursor wins when
|
|
70
|
+
* both appear, matching `PageRequest`'s contract), which is what
|
|
71
|
+
* `ListingEngine#goToPage`'s numbered pagination sends. `getPoints()` runs the same
|
|
69
72
|
* predicate filter and projects each surviving row through `toLatLng`
|
|
70
73
|
* (further narrowed to `bounds` when one is given). `idOf` defaults to
|
|
71
74
|
* reading `row.id`, mirroring most real adapters, but can be overridden for
|
package/dist/testing/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var o=class{mounts=[];renderedLayers=[];removedLayers=[];fitBoundsCalls=[];destroyed=[];destroyCount=0;markerStates=null;overlays=[];zoomCalls=[];fullscreenToggles=0;fullscreenTarget;boundsListeners=new Set;mapClickListeners=new Set;mount(t,e){let n={raw:{el:t,opts:e}};return this.mounts.push(n),this.fullscreenTarget=e.fullscreenTarget??t,n}renderLayer(t,e){this.renderedLayers.push(e);let n=!1;return()=>{if(n)return;n=!0;let s=this.renderedLayers.indexOf(e);s!==-1&&(this.renderedLayers.splice(s,1),this.removedLayers.push(e))}}onBoundsChange(t,e){return this.boundsListeners.add(e),()=>{this.boundsListeners.delete(e)}}emitBounds(t){for(let e of this.boundsListeners)e(t)}onMapClick(t){return this.mapClickListeners.add(t),()=>{this.mapClickListeners.delete(t)}}emitMapClick(){for(let t of this.mapClickListeners)t()}fitBounds(t,e){this.fitBoundsCalls.push(e)}destroy(t){this.destroyed.push(t),this.destroyCount+=1,this.boundsListeners.clear(),this.mapClickListeners.clear()}updateMarkerStates(t,e){this.markerStates={selected:t,hovered:e}}mountOverlay(t){let e=document.createElement("div");document.body.appendChild(e);let n={container:e,position:t};return this.overlays.push(n),{container:e,setPosition:s=>{n.position=s},unmount:()=>{e.remove();let s=this.overlays.indexOf(n);s!==-1&&this.overlays.splice(s,1)}}}zoomIn(){this.zoomCalls.push("in")}zoomOut(){this.zoomCalls.push("out")}toggleFullscreen(){this.fullscreenToggles+=1,this.fullscreenTarget&&typeof this.fullscreenTarget.requestFullscreen=="function"&&this.fullscreenTarget.requestFullscreen()?.catch(()=>{})}};var a=class{constructor(t,e,n,s=r=>r.id){this.rows=t;this.predicate=e;this.toLatLng=n;this.idOf=s}rows;predicate;toLatLng;idOf;async list(t,e){let n=this.rows.filter(u=>this.predicate(u,t)),s=e.cursor
|
|
2
|
+
var o=class{mounts=[];renderedLayers=[];removedLayers=[];fitBoundsCalls=[];destroyed=[];destroyCount=0;markerStates=null;overlays=[];zoomCalls=[];fullscreenToggles=0;fullscreenTarget;boundsListeners=new Set;mapClickListeners=new Set;mount(t,e){let n={raw:{el:t,opts:e}};return this.mounts.push(n),this.fullscreenTarget=e.fullscreenTarget??t,n}renderLayer(t,e){this.renderedLayers.push(e);let n=!1;return()=>{if(n)return;n=!0;let s=this.renderedLayers.indexOf(e);s!==-1&&(this.renderedLayers.splice(s,1),this.removedLayers.push(e))}}onBoundsChange(t,e){return this.boundsListeners.add(e),()=>{this.boundsListeners.delete(e)}}emitBounds(t){for(let e of this.boundsListeners)e(t)}onMapClick(t){return this.mapClickListeners.add(t),()=>{this.mapClickListeners.delete(t)}}emitMapClick(){for(let t of this.mapClickListeners)t()}fitBounds(t,e){this.fitBoundsCalls.push(e)}destroy(t){this.destroyed.push(t),this.destroyCount+=1,this.boundsListeners.clear(),this.mapClickListeners.clear()}updateMarkerStates(t,e){this.markerStates={selected:t,hovered:e}}mountOverlay(t){let e=document.createElement("div");document.body.appendChild(e);let n={container:e,position:t};return this.overlays.push(n),{container:e,setPosition:s=>{n.position=s},unmount:()=>{e.remove();let s=this.overlays.indexOf(n);s!==-1&&this.overlays.splice(s,1)}}}zoomIn(){this.zoomCalls.push("in")}zoomOut(){this.zoomCalls.push("out")}toggleFullscreen(){this.fullscreenToggles+=1,this.fullscreenTarget&&typeof this.fullscreenTarget.requestFullscreen=="function"&&this.fullscreenTarget.requestFullscreen()?.catch(()=>{})}};var a=class{constructor(t,e,n,s=r=>r.id){this.rows=t;this.predicate=e;this.toLatLng=n;this.idOf=s}rows;predicate;toLatLng;idOf;async list(t,e){let n=this.rows.filter(u=>this.predicate(u,t)),s=e.cursor!=null?Number(e.cursor)+1:e.offset??0,r=n.slice(s,s+e.limit),i=s+r.length-1,l=i+1<n.length;return{items:r,nextCursor:l?String(i):null,total:n.length}}async getPoints(t,e){let s=this.rows.filter(r=>this.predicate(r,t)).map(r=>({id:this.idOf(r),position:this.toLatLng(r),entity:r}));return e?s.filter(r=>this.isInBounds(r.position,e)):s}async getById(t){let e=this.rows.find(n=>this.idOf(n)===t);if(!e)throw new Error(`InMemoryEntityAdapter: no row with id "${String(t)}"`);return e}isInBounds(t,e){return t.lat<=e.north&&t.lat>=e.south&&t.lng>=e.west&&t.lng<=e.east}};export{o as FakeMapProvider,a as InMemoryEntityAdapter};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-listing-engine",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Headless, composable listing engine for React: filterable list + Google-Maps multi-layer map, with pluggable data adapters, a filter/dataset registry, injectable components, and a Tailwind-free styled adapter.",
|
|
6
6
|
"funding": [
|
package/dist/chunk-CT3V6J2U.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
var X=class{state;listeners=new Set;constructor(e){this.state=this.freezeState({filters:{...e.filters},results:{items:[],nextCursor:null},bounds:null,selection:null,hovered:null,pagination:{mode:e.mode??"paged",loading:!1},layers:{},points:{}})}getState(){return this.state}setFilters(e){this.setState({filters:{...this.state.filters,...e}})}setResults(e){this.setState({results:{items:[...e.items],nextCursor:e.nextCursor,total:e.total}})}appendResults(e){this.setState({results:{items:[...this.state.results.items,...e.items],nextCursor:e.nextCursor,total:e.total}})}setBounds(e){this.setState({bounds:e?{...e}:null})}setSelection(e){this.setState({selection:e})}setHovered(e){this.setState({hovered:e})}setLayerVisible(e,i){this.setState({layers:{...this.state.layers,[e]:i}})}setLoading(e){this.setState({pagination:{...this.state.pagination,loading:e}})}setPoints(e,i){this.setState({points:{...this.state.points,[e]:[...i]}})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setState(e){this.state=this.freezeState({...this.state,...e}),this.notify()}notify(){for(let e of this.listeners)e()}freezeState(e){Object.freeze(e.filters),Object.freeze(e.results.items),Object.freeze(e.results),e.bounds&&Object.freeze(e.bounds),Object.freeze(e.pagination),Object.freeze(e.layers);for(let i of Object.values(e.points))Object.freeze(i);return Object.freeze(e.points),Object.freeze(e)}};var U=class{defs=new Map;add(e){if(this.defs.has(e.key))throw new Error(`FilterRegistry: filter "${e.key}" is already registered`);return this.defs.set(e.key,{...e}),this}remove(e){return this.defs.delete(e),this}replace(e,i){if(!this.defs.has(e))throw new Error(`FilterRegistry: cannot replace unregistered filter "${e}"`);return this.defs.set(e,{...i,key:e}),this}reorder(e){let i=this.list(),r=e.filter(n=>this.defs.has(n));r.forEach((n,o)=>{this.defs.get(n).order=o});let s=new Set(r);return i.filter(n=>!s.has(n.key)).forEach((n,o)=>{n.order=r.length+o}),this}list(){return[...this.defs.values()].sort((e,i)=>e.order-i.order)}has(e){return this.defs.has(e)}toFilters(e){return this.list().filter(r=>Object.hasOwn(e,r.key)).map(r=>r.toParams(e[r.key])).reduce((r,s)=>({...r,...s}),{})}activeKeys(e){return this.list().filter(i=>i.isActive?.(e)).map(i=>i.key)}clearedParams(){return this.list().reduce((e,i)=>Object.assign(e,i.toParams(i.fromParams({}))),{})}};var J=class{defs=new Map;add(e){if(this.defs.has(e.id))throw new Error(`DatasetRegistry: dataset "${e.id}" is already registered`);return this.defs.set(e.id,{...e}),this}get(e){return this.defs.get(e)}has(e){return this.defs.has(e)}list(){return[...this.defs.values()]}visibleIds(){return this.list().filter(e=>e.visible?.()!==!1).map(e=>e.id)}};var Y=class{map=new Map;dispose(){this.map.clear()}emit(e){let i=this.map.get(e.type);if(i)for(let s of[...i])s(e);let r=this.map.get("*");if(r)for(let s of[...r])s(e)}on(e,i){let r=this.map.get(e);return r||(r=new Set,this.map.set(e,r)),r.add(i),()=>{r.delete(i)}}};var Me={pagination:"paged",pageSize:20,debounceMs:250};var ee=class{options;constructor(e){this.options=Object.freeze({...Me,...e})}};var te=class{filters;map;datasets;primaryDatasetId;store;emitter=new Y;config;debounceTimer=null;debounceResolve=null;queryToken=0;pointsToken=0;mapHandle=null;constructor(e){this.datasets=e.datasets,this.filters=e.filters??new U,this.map=e.map,this.config=new ee(e.config);let i=e.primaryDatasetId??this.datasets.list()[0]?.id;if(i==null||!this.datasets.has(i))throw new Error(`ListingEngine: primary dataset "${i??""}" is not registered \u2014 pass a valid primaryDatasetId or register at least one dataset`);this.primaryDatasetId=i,this.store=new X({filters:e.initialFilters??{},mode:this.config.options.pagination})}get state(){return this.store.getState()}get options(){return this.config.options}applyFilters(e){this.store.setFilters(e),this.emitter.emit({type:"FiltersChanged",filters:this.currentFilters()}),this.clearDebounce();let i=++this.queryToken,r=this.config.options.debounceMs;return r<=0?this.runQuery(i):new Promise(s=>{this.debounceResolve=s,this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.debounceResolve=null,s(this.runQuery(i))},r)})}async loadPage(){let e=this.state.results.nextCursor;if(e===null)return;let i=++this.queryToken,r=this.primaryDataset();this.store.setLoading(!0);try{let s=await r.adapter.list(this.currentFilters(),{cursor:e,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.config.options.pagination==="infinite"?this.store.appendResults(s):this.store.setResults(s),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:s.items.length})}finally{i===this.queryToken&&this.store.setLoading(!1)}}async loadPoints(e){this.store.setBounds(e),this.emitter.emit({type:"BoundsChanged",bounds:e});let i=this.currentFilters(),r=++this.pointsToken;await Promise.allSettled(this.datasets.visibleIds().map(async s=>{let n=this.datasets.get(s);if(!n)return;let o=await n.adapter.getPoints(i,e);r===this.pointsToken&&this.store.setPoints(s,o)}))}setMapHandle(e){this.mapHandle=e}fitBounds(e){!this.map||!this.mapHandle||this.map.fitBounds(this.mapHandle,e)}selectPoint(e,i){this.store.setSelection(i);let r=this.state.points[e]?.find(s=>s.id===i);r&&this.emitter.emit({type:"PointClicked",datasetId:e,id:r.id,entity:r.entity})}setHovered(e,i){this.store.setHovered(i)}toggleLayer(e){let r=!(this.state.layers[e]??!0);this.store.setLayerVisible(e,r),this.emitter.emit({type:"LayerToggled",datasetId:e,visible:r})}subscribe(e){return this.store.subscribe(e)}on(e,i){return this.emitter.on(e,i)}dispose(){this.clearDebounce(),this.emitter.dispose(),this.mapHandle=null}async runQuery(e){if(e!==this.queryToken)return;let i=this.primaryDataset();this.store.setLoading(!0);try{let r=await i.adapter.list(this.currentFilters(),{cursor:null,limit:this.config.options.pageSize});if(e!==this.queryToken)return;this.store.setResults(r),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:r.items.length})}finally{e===this.queryToken&&this.store.setLoading(!1)}}primaryDataset(){return this.datasets.get(this.primaryDatasetId)}currentFilters(){return this.store.getState().filters}clearDebounce(){this.debounceTimer!==null&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.debounceResolve!==null&&(this.debounceResolve(),this.debounceResolve=null)}};function De(...t){let e={config:{},filters:new U,datasets:new J};for(let i of t)i(e);return e}var Oe=t=>e=>{e.config={...e.config,...t}},_e=t=>e=>{e.map=t},Be=t=>e=>{e.datasets.add(t)},He=t=>e=>{t(e.filters)},ki=t=>e=>{e.urlSync=t},Ae=t=>e=>{e.initialFilters=t},Ii=t=>e=>{e.primaryDatasetId=t};import{createContext as mt,useContext as ft}from"react";import{jsx as M,jsxs as wt}from"react/jsx-runtime";function gt(t){return String(t?.title??"")}var yt=({item:t})=>M("div",{children:gt(t)}),ht=()=>M("div",{}),ce=()=>M("div",{}),vt=({children:t})=>M("div",{children:t}),Lt=({children:t})=>M("div",{children:t}),bt=({value:t,onChange:e,placeholder:i})=>M("input",{type:"search",value:t,placeholder:i,onChange:r=>e(r.target.value),"aria-label":i??"Search"}),Tt=()=>M("div",{role:"status",children:"No results"}),Pt=()=>M("div",{role:"status","aria-busy":"true",children:"Loading\u2026"}),Ft=({count:t})=>wt("div",{children:[t," results"]}),Ct=({children:t})=>M("div",{children:t}),I={Card:yt,Marker:ht,Popup:ce,Sidebar:vt,FilterPanel:Lt,Search:bt,Empty:Tt,Loading:Pt,ResultHeader:Ft,Toolbar:Ct},ze=mt(I);function Ue(t){let{Card:e,Marker:i,Popup:r,Sidebar:s,FilterPanel:n,Search:o,Empty:l,Loading:d,ResultHeader:p,Toolbar:a,children:f}=t,L={Card:e??I.Card,Marker:i??I.Marker,Popup:r??I.Popup,Sidebar:s??I.Sidebar,FilterPanel:n??I.FilterPanel,Search:o??I.Search,Empty:l??I.Empty,Loading:d??I.Loading,ResultHeader:p??I.ResultHeader,Toolbar:a??I.Toolbar};return M(ze.Provider,{value:L,children:f})}function T(){return ft(ze)}import{createContext as St}from"react";var ie=St(null);import{useContext as kt}from"react";function y(){let t=kt(ie);if(t===null)throw new Error("useListing must be used within a <ListingProvider>");return t}import{useCallback as Ke,useSyncExternalStore as It}from"react";function P(){let t=y(),e=Ke(r=>t.subscribe(r),[t]),i=Ke(()=>t.state,[t]);return It(e,i,i)}import{useCallback as Ve}from"react";function re(){let t=y(),e=P(),i=Ve(s=>t.applyFilters(s),[t]),r=Ve((s,n)=>t.applyFilters({[s]:n}),[t]);return{filters:e.filters,set:i,setField:r}}import{jsx as j,jsxs as Et}from"react/jsx-runtime";function ue({className:t,groupClassName:e,hideLabels:i,draft:r,onDraftChange:s}={}){let n=y(),{FilterPanel:o}=T(),{filters:l}=re(),d=r!==void 0&&s!==void 0,p=d?r:l;return j(o,{children:j("div",{className:t??"space-y-5",children:n.filters.list().map(a=>{if(typeof a.render=="string")return j("div",{"data-filter":a.key,className:e},a.key);let f=a.render;return Et("div",{className:e,children:[a.label&&!i&&j("div",{className:"mb-1.5 text-[13px] font-medium text-foreground",children:a.label}),j(f,{value:a.fromParams(p),onChange:L=>d?s(a.toParams(L)):void n.applyFilters(a.toParams(L))})]},a.key)})})})}function K(){return P().results}import{jsx as ne}from"react/jsx-runtime";function xt(t,e){if(t&&typeof t=="object"&&"id"in t){let i=t.id;if(typeof i=="string"||typeof i=="number")return i}return e}function $e({className:t}={}){let e=y(),{items:i}=K(),{pagination:r,selection:s}=P(),{Card:n,Empty:o,Loading:l}=T();return r.loading&&i.length===0?ne(l,{}):i.length===0?ne(o,{}):ne("div",{role:"list",className:t,children:i.map((d,p)=>{let a=xt(d,p);return ne(n,{item:d,selected:s===a,onSelect:()=>e.selectPoint(e.primaryDatasetId,a)},a)})})}import{useEffect as Q,useRef as B,useState as We}from"react";import{createPortal as Nt}from"react-dom";import{jsx as me,jsxs as Qe}from"react/jsx-runtime";var Rt={west:-179.9,south:-85,east:179.9,north:85},qe=.1,je=.02;function Mt(t){if(t.length===0)return null;let e=t[0].lng,i=t[0].lng,r=t[0].lat,s=t[0].lat;for(let{lat:l,lng:d}of t)d<e&&(e=d),d>i&&(i=d),l<r&&(r=l),l>s&&(s=l);let n=s>r?(s-r)*qe:je,o=i>e?(i-e)*qe:je;return{west:e-o,east:i+o,south:r-n,north:s+n}}function Ge(t){let{center:e,zoom:i,fallback:r,mapControls:s}=t,n=y(),o=P(),l=B(null),d=B(null),p=B(null),[a,f]=We(!1),L=B(!1),E=B(!1),C=B(!1),c=n.map;Q(()=>{let b=p.current;if(!c||!b)return;let h=[];for(let u of Object.keys(o.points)){if(o.layers[u]===!1)continue;let g=n.datasets.get(u),R=o.points[u]??[],W={id:u,markers:R.map(k=>({id:k.id,position:k.position,iconUrl:g?.marker.iconUrl?.(k.entity),element:g?.marker.element?.(k.entity)})),clustering:g?.clustering,onMarkerClick:k=>n.selectPoint(u,k)};h.push(c.renderLayer(b,W))}return()=>{h.forEach(u=>u())}},[n,c,a,o.points,o.layers]),Q(()=>{if(!l.current||!c)return;let b=l.current,h=!1,u=null;return(async()=>{let g=await c.mount(b,{center:e,zoom:i,fullscreenTarget:d.current??void 0});if(h){c.destroy(g);return}p.current=g,n.setMapHandle(g),u=c.onBoundsChange(g,R=>{C.current?C.current=!1:E.current=!0,n.loadPoints(R)}),f(!0),n.loadPoints(Rt)})(),()=>{h=!0,u?.(),p.current&&(c.destroy(p.current),p.current=null,n.setMapHandle(null)),f(!1)}},[n,c]),Q(()=>{let b=p.current;if(!c||!b||e||L.current||E.current)return;let h=[];for(let g of Object.keys(o.points))if(o.layers[g]!==!1)for(let R of o.points[g]??[])h.push(R.position);let u=Mt(h);u&&(L.current=!0,C.current=!0,c.fitBounds(b,u))},[c,e,a,o.points,o.layers]),Q(()=>{c?.updateMarkerStates(o.selection,o.hovered)},[c,a,o.selection,o.hovered]);let{Popup:x}=T(),N=x!==ce,w=o.points[n.primaryDatasetId]??[],z=o.selection!=null?w.find(b=>b.id===o.selection):void 0,[S,D]=We(null),Z=B(z);return Z.current=z,Q(()=>{let b=p.current;if(!c||!b||!N)return;let h=Z.current;if(!h)return;let u=c.mountOverlay(h.position);D({entity:h.entity,position:h.position,container:u.container});let g=()=>n.selectPoint(n.primaryDatasetId,null),R=k=>{k.key==="Escape"&&g()};document.addEventListener("keydown",R);let W=c.onMapClick(g);return()=>{document.removeEventListener("keydown",R),W(),u.unmount(),D(null)}},[n,c,a,o.selection,N]),Qe("div",{ref:d,className:"relative h-full min-h-0 w-full",children:[Qe("div",{ref:l,className:!c&&r?"flex h-full min-h-0 w-full items-center justify-center":"h-full min-h-0 w-full",children:[!c&&r,N&&S?Nt(me(x,{entity:S.entity,onClose:()=>n.selectPoint(n.primaryDatasetId,null)}),S.container):null]}),s!=null&&me("div",{className:"pointer-events-none absolute inset-0",children:me("div",{className:"pointer-events-auto",children:s})})]})}import{jsx as Dt}from"react/jsx-runtime";function Ze(){let t=y(),{results:e,pagination:i}=P();return e.nextCursor==null?null:Dt("button",{type:"button",disabled:i.loading,onClick:()=>{t.loadPage()},children:"Load more"})}import{jsx as Ot}from"react/jsx-runtime";function Xe(){let{items:t,total:e}=K(),{ResultHeader:i}=T();return Ot(i,{count:t.length,total:e})}import{useEffect as _t,useRef as Bt}from"react";function Je(t,e){let i=y(),r=Bt(e);r.current=e,_t(()=>i.on(t,s=>r.current(s)),[i,t])}import{useEffect as Ht,useState as Ye}from"react";import{jsx as At}from"react/jsx-runtime";function et(t){let{children:e,...i}=t,[r]=Ye(()=>i),[s,n]=Ye(null);return Ht(()=>{let o=new te({datasets:r.datasets,filters:r.filters,config:r.config,map:r.map,initialFilters:r.initialFilters,primaryDatasetId:r.primaryDatasetId});return r.urlSync&&r.urlSync.start(o),n(o),()=>{r.urlSync&&r.urlSync.stop(),o.dispose(),n(l=>l===o?null:l)}},[r]),s?At(ie.Provider,{value:s,children:e}):null}function V(t){return typeof t!="number"?t:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(t)}import{Fragment as Ut,jsx as O,jsxs as tt}from"react/jsx-runtime";function zt(t){return t?"rle-card rle-card--selected":"rle-card"}function fe({item:t,selected:e,onSelect:i}){let r=t??{},s=zt(e),n=tt(Ut,{children:[r.imageUrl?O("img",{src:r.imageUrl,alt:r.title??"",className:"rle-card-media"}):O("div",{className:"rle-card-media rle-card-media--placeholder","aria-hidden":"true"}),tt("div",{className:"rle-card-body",children:[r.title&&O("span",{className:"rle-card-title",children:r.title}),r.subtitle&&O("span",{className:"rle-card-address",children:r.subtitle}),r.badge&&O("div",{className:"rle-card-info",children:O("span",{className:"rle-card-info-item",children:r.badge})}),r.price!=null&&O("span",{className:"rle-card-price",children:V(r.price)})]})]});return i?O("button",{type:"button",onClick:i,"aria-pressed":e??!1,className:s,children:n}):O("article",{className:s,children:n})}import{jsx as se,jsxs as it}from"react/jsx-runtime";function ge(t){return it("div",{role:"status",className:"rle-empty",children:[it("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",className:"rle-empty-icon","aria-hidden":"true",children:[se("circle",{cx:"11",cy:"11",r:"7"}),se("path",{d:"m21 21-4.3-4.3"})]}),se("p",{className:"rle-empty-title",children:"No results"}),se("p",{className:"rle-empty-hint",children:"Try adjusting your filters or search terms."})]})}import{jsx as Kt}from"react/jsx-runtime";function ye({children:t}){return Kt("div",{className:"rle-filter-panel",children:t})}import{jsx as oe,jsxs as Vt}from"react/jsx-runtime";function he(t){return oe("div",{className:"rle-loading",role:"status","aria-busy":"true","aria-label":"Loading results",children:Array.from({length:3}).map((e,i)=>Vt("div",{className:"rle-loading-item",children:[oe("div",{className:"rle-skeleton",style:{aspectRatio:"4 / 3",width:"100%"}}),oe("div",{className:"rle-skeleton",style:{height:16,width:"65%"}}),oe("div",{className:"rle-skeleton",style:{height:12,width:"35%"}})]},i))})}import{jsx as $t}from"react/jsx-runtime";function ve({point:t}){let e=t.entity??{};return $t("span",{className:"rle-pin",children:e.price!=null?V(e.price):""})}import{jsx as $,jsxs as Le}from"react/jsx-runtime";function be({entity:t,onClose:e}){let i=t??{};return Le("div",{className:"rle-popup",role:"group","aria-label":"Location details",children:[$("button",{type:"button",onClick:e,"aria-label":"Close",className:"rle-popup-close",children:Le("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[$("path",{d:"M18 6 6 18"}),$("path",{d:"m6 6 12 12"})]})}),Le("div",{children:[i.title&&$("div",{className:"rle-card-title",children:i.title}),i.subtitle&&$("div",{className:"rle-card-address",children:i.subtitle}),i.price!=null&&$("div",{className:"rle-card-price",children:V(i.price)})]})]})}import{jsx as Wt}from"react/jsx-runtime";function Te({count:t,total:e}){let i=e!=null&&e!==t?`${t} of ${e} results`:`${t} results`;return Wt("div",{className:"rle-result-header",children:i})}import{jsx as qt}from"react/jsx-runtime";function Pe({value:t,onChange:e,placeholder:i}){return qt("input",{type:"search",value:t,placeholder:i,onChange:r=>e(r.target.value),"aria-label":i??"Search",className:"rle-input"})}import{jsx as jt}from"react/jsx-runtime";function Fe({children:t}){return jt("aside",{className:"rle-sidebar",children:t})}import{jsx as Qt}from"react/jsx-runtime";function Ce({children:t}){return Qt("div",{className:"rle-toolbar",children:t})}var rt={Card:fe,Marker:ve,Popup:be,Sidebar:Fe,FilterPanel:ye,Search:Pe,Empty:ge,Loading:he,ResultHeader:Te,Toolbar:Ce};import{jsx as F,jsxs as G}from"react/jsx-runtime";function nt({view:t,onViewChange:e}){return F("nav",{className:"rle-bottom-nav","aria-label":"Listing navigation",children:G("div",{className:"rle-viewtoggle",role:"group","aria-label":"View",children:[G("button",{type:"button",className:`rle-viewtoggle__btn${t==="list"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":t==="list",onClick:()=>e("list"),children:[F(Gt,{}),"List"]}),G("button",{type:"button",className:`rle-viewtoggle__btn${t==="map"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":t==="map",onClick:()=>e("map"),children:[F(Zt,{}),"Map"]})]})})}function Gt(){return G("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[F("line",{x1:"8",y1:"6",x2:"20",y2:"6"}),F("line",{x1:"8",y1:"12",x2:"20",y2:"12"}),F("line",{x1:"8",y1:"18",x2:"20",y2:"18"}),F("line",{x1:"4",y1:"6",x2:"4.01",y2:"6"}),F("line",{x1:"4",y1:"12",x2:"4.01",y2:"12"}),F("line",{x1:"4",y1:"18",x2:"4.01",y2:"18"})]})}function Zt(){return G("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[F("polygon",{points:"1 6 8 3 16 6 23 3 23 18 16 21 8 18 1 21 1 6"}),F("line",{x1:"8",y1:"3",x2:"8",y2:"18"}),F("line",{x1:"16",y1:"6",x2:"16",y2:"21"})]})}import{useEffect as we,useRef as Xt,useState as st}from"react";import{createPortal as Jt}from"react-dom";import{Fragment as ei,jsx as _,jsxs as ae}from"react/jsx-runtime";function ot({open:t,onOpenChange:e,title:i,children:r,footer:s}){let n=Xt(null),[o,l]=st(!1),[d,p]=st(!1);return we(()=>{if(!t){p(!1),l(!1);return}l(!0);let a=requestAnimationFrame(()=>p(!0));return()=>cancelAnimationFrame(a)},[t]),we(()=>{if(!o)return;let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a}},[o]),we(()=>{if(!o)return;n.current?.focus();function a(f){f.key==="Escape"&&e(!1)}return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[o,e]),!o||typeof document>"u"?null:Jt(ae(ei,{children:[_("div",{className:`rle-sheet-backdrop${d?" rle-sheet-backdrop--open":""}`,onClick:()=>e(!1),"aria-hidden":"true"}),ae("div",{ref:n,className:`rle-sheet${d?" rle-sheet--open":""}`,role:"dialog","aria-modal":"true","aria-label":i,tabIndex:-1,children:[_("div",{className:"rle-sheet__handle","aria-hidden":"true"}),ae("div",{className:"rle-sheet__header",children:[i&&_("div",{className:"rle-sheet__title",children:i}),_("button",{type:"button",className:"rle-sheet__close",onClick:()=>e(!1),"aria-label":"Close",children:_(Yt,{})})]}),_("div",{className:"rle-sheet__body",children:r}),s&&_("div",{className:"rle-sheet__footer",children:s})]})]}),document.body)}function Yt(){return ae("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_("path",{d:"M18 6 6 18"}),_("path",{d:"m6 6 12 12"})]})}import{useEffect as Se,useRef as lt,useState as A}from"react";import{jsx as v,jsxs as le}from"react/jsx-runtime";function at({search:t,onFiltersClick:e,filterCount:i=0,action:r}){let{Search:s}=T();return le("header",{className:"rle-mobile-header",children:[t&&v("div",{className:"rle-mobile-header__search",children:v(s,{value:t.value,onChange:t.onChange,placeholder:t.placeholder})}),le("button",{type:"button",className:"rle-btn rle-mobile-header__btn",onClick:e,children:[v(ti,{}),v("span",{children:"Filters"}),i>0&&v("span",{className:"rle-mobile-header__count",children:i})]}),r&&v("button",{type:"button",className:"rle-btn rle-mobile-header__btn rle-mobile-header__btn--icon",onClick:r.onClick,"aria-label":r.label,children:r.icon??v(ii,{})})]})}function ti(){return le("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[v("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),v("circle",{cx:"9",cy:"6",r:"2",fill:"currentColor",stroke:"none"}),v("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),v("circle",{cx:"15",cy:"12",r:"2",fill:"currentColor",stroke:"none"}),v("line",{x1:"4",y1:"18",x2:"20",y2:"18"}),v("circle",{cx:"11",cy:"18",r:"2",fill:"currentColor",stroke:"none"})]})}function ii(){return le("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[v("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),v("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}import{Fragment as oi,jsx as m,jsxs as H}from"react/jsx-runtime";var ri=m("div",{className:"rle-empty",children:"Map unavailable"});function ni(){let t=lt(null),[e,i]=A(!0),[r,s]=A(!0);return Se(()=>{let n=t.current;if(!n)return;let o=()=>{let{clientWidth:f,scrollLeft:L,scrollWidth:E}=n;i(L<=0),s(L+f>=E-1)},l=0,d=()=>{l||(l=requestAnimationFrame(()=>{l=0,o()}))};o(),n.addEventListener("scroll",o,{passive:!0});let p,a;return typeof ResizeObserver<"u"&&(p=new ResizeObserver(o),p.observe(n)),typeof MutationObserver<"u"&&(a=new MutationObserver(d),a.observe(n,{characterData:!0,childList:!0,subtree:!0})),()=>{n.removeEventListener("scroll",o),p?.disconnect(),a?.disconnect(),l&&cancelAnimationFrame(l)}},[]),{atEnd:r,atStart:e,ref:t}}function si(t,e){if(t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;let i=t,r=e,s=new Set([...Object.keys(i),...Object.keys(r)]);for(let n of s)if(i[n]!==r[n])return!1;return!0}function dt({search:t,filterBarEnd:e,toolbarEnd:i,mobileAction:r,autoFetch:s=!0,hasMap:n,mapCenter:o,mapZoom:l,mapControls:d,mobileSheetFooter:p,className:a}){let f=y(),{Search:L}=T(),E=K(),{filters:C,set:c}=re(),{pagination:x}=P(),N=n??f.map!=null,[w,z]=A("list"),[S,D]=A(!1),{atEnd:Z,atStart:b,ref:h}=ni(),[u,g]=A(C),[R,W]=A(S);S!==R&&(W(S),S&&g(C));let k=pe=>g(ut=>({...ut,...pe})),[Ie,Ee]=A(!1),de=lt(!1);Se(()=>{if(Ie){if(x.loading){de.current=!0;return}de.current&&(de.current=!1,Ee(!1),D(!1))}},[Ie,x.loading]);let q=t?{value:String(C[t.filterKey]??""),onChange:pe=>{c({[t.filterKey]:pe||void 0})},placeholder:t.placeholder}:void 0;Se(()=>{s!==!1&&f.applyFilters({})},[f,s]);let xe=()=>{k(f.filters.clearedParams())},Ne=()=>{if(si(u,C)){D(!1);return}Ee(!0),f.applyFilters(u)},ct=f.filters.activeKeys(C).length,Re=E.total??E.items.length;return H("div",{className:a?`rle-app ${a}`:"rle-app",children:[H("div",{className:"rle-filter-bar",children:[H("div",{className:"rle-filter-bar__scroll",ref:h,children:[q&&m("div",{className:"rle-filter-bar__search",children:m(L,{value:q.value,onChange:q.onChange,placeholder:q.placeholder})}),m(ue,{className:"rle-filters-row",groupClassName:"rle-filter-group",hideLabels:!0}),e&&m("div",{className:"rle-filter-bar__end",children:e})]}),!b&&m("div",{className:"rle-filter-bar__fade rle-filter-bar__fade--start","aria-hidden":"true"}),!Z&&m("div",{className:"rle-filter-bar__fade rle-filter-bar__fade--end","aria-hidden":"true"})]}),m(at,{search:q,onFiltersClick:()=>D(!0),filterCount:ct,action:r}),H("div",{className:`rle-body ${N?"rle-split":"rle-body--list-only"}`,"data-mobile-view":w,children:[H("div",{className:"rle-list",children:[H("div",{className:"rle-list-header",children:[m(Xe,{}),i&&m("div",{className:"rle-list-header__toolbar",children:i})]}),m($e,{className:"rle-list-grid"}),m(Ze,{})]}),N&&m("div",{className:"rle-map",children:m(Ge,{center:o,zoom:l,fallback:ri,mapControls:d})})]}),N&&m(nt,{view:w,onViewChange:z}),m(ot,{title:"Filters",open:S,onOpenChange:D,footer:p?p({draft:u,apply:Ne,clear:xe,resultCount:Re,loading:x.loading}):H(oi,{children:[m("button",{type:"button",className:"rle-btn rle-btn--ghost",onClick:xe,children:"Clear all"}),m("button",{type:"button",className:"rle-btn rle-btn--primary rle-sheet__apply",disabled:x.loading,onClick:Ne,children:x.loading?m("span",{className:"rle-spinner","aria-label":"Updating results"}):`Show ${Re} results`})]}),children:m(ue,{className:"rle-filter-stack",groupClassName:"rle-filter-group",draft:u,onDraftChange:k})})]})}import{useEffect as ai,useRef as li,useState as di}from"react";import{jsx as ke,jsxs as ui}from"react/jsx-runtime";function pt(t){return"provider"in t}function pi(t){let e=t!=null&&!pt(t),i=e?t.apiKey:void 0,r=e?t.mapId:void 0,s=e?t.mapOptions:void 0,n=e?t.styles:void 0,[o,l]=di(()=>!t||pt(t)?{ready:!0,provider:t?.provider}:{ready:!1});return ai(()=>{if(!i)return;let d=!1;return import("./maps/google/index.js").then(({googleProvider:p})=>{d||l({ready:!0,provider:p({apiKey:i,mapId:r,mapOptions:s,styles:n})})}),()=>{d=!0}},[i,r]),o}function ci({onFiltersChange:t}){let e=li(t);return e.current=t,Je("FiltersChanged",i=>{i.type==="FiltersChanged"&&e.current(i.filters)}),null}function Rn(t){let{datasets:e,filters:i,map:r,components:s,initialFilters:n,onFiltersChange:o,mobileAction:l,search:d,filterBarEnd:p,toolbarEnd:a,mapControls:f,mobileSheetFooter:L,config:E,autoFetch:C,className:c}=t,{ready:x,provider:N}=pi(r);if(!x)return null;let w=[];for(let D of e)w.push(Be(D));i&&w.push(He(i)),N&&w.push(_e(N)),n&&w.push(Ae(n)),E&&w.push(Oe(E));let z=De(...w),S={...rt,...s};return ui(et,{...z,children:[o&&ke(ci,{onFiltersChange:o}),ke(Ue,{...S,children:ke(dt,{className:c,search:d,filterBarEnd:p,toolbarEnd:a,mobileAction:l,autoFetch:C,mapCenter:r?.center,mapZoom:r?.zoom,mapControls:f,mobileSheetFooter:L})})]})}export{X as a,U as b,J as c,Y as d,Me as e,ee as f,te as g,De as h,Oe as i,_e as j,Be as k,He as l,ki as m,Ae as n,Ii as o,ce as p,Ue as q,T as r,ie as s,y as t,P as u,re as v,ue as w,K as x,$e as y,Ge as z,Ze as A,Xe as B,Je as C,et as D,fe as E,ge as F,ye as G,he as H,ve as I,be as J,Te as K,Pe as L,Fe as M,Ce as N,rt as O,nt as P,ot as Q,dt as R,Rn as S};
|
package/dist/chunk-JMYPJAXI.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5;"use client";
|
|
2
|
-
var X= (_class =class{__init() {this.listeners=new Set}constructor(e){;_class.prototype.__init.call(this);this.state=this.freezeState({filters:{...e.filters},results:{items:[],nextCursor:null},bounds:null,selection:null,hovered:null,pagination:{mode:_nullishCoalesce(e.mode, () => ("paged")),loading:!1},layers:{},points:{}})}getState(){return this.state}setFilters(e){this.setState({filters:{...this.state.filters,...e}})}setResults(e){this.setState({results:{items:[...e.items],nextCursor:e.nextCursor,total:e.total}})}appendResults(e){this.setState({results:{items:[...this.state.results.items,...e.items],nextCursor:e.nextCursor,total:e.total}})}setBounds(e){this.setState({bounds:e?{...e}:null})}setSelection(e){this.setState({selection:e})}setHovered(e){this.setState({hovered:e})}setLayerVisible(e,i){this.setState({layers:{...this.state.layers,[e]:i}})}setLoading(e){this.setState({pagination:{...this.state.pagination,loading:e}})}setPoints(e,i){this.setState({points:{...this.state.points,[e]:[...i]}})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setState(e){this.state=this.freezeState({...this.state,...e}),this.notify()}notify(){for(let e of this.listeners)e()}freezeState(e){Object.freeze(e.filters),Object.freeze(e.results.items),Object.freeze(e.results),e.bounds&&Object.freeze(e.bounds),Object.freeze(e.pagination),Object.freeze(e.layers);for(let i of Object.values(e.points))Object.freeze(i);return Object.freeze(e.points),Object.freeze(e)}}, _class);var U= (_class2 =class{constructor() { _class2.prototype.__init2.call(this); }__init2() {this.defs=new Map}add(e){if(this.defs.has(e.key))throw new Error(`FilterRegistry: filter "${e.key}" is already registered`);return this.defs.set(e.key,{...e}),this}remove(e){return this.defs.delete(e),this}replace(e,i){if(!this.defs.has(e))throw new Error(`FilterRegistry: cannot replace unregistered filter "${e}"`);return this.defs.set(e,{...i,key:e}),this}reorder(e){let i=this.list(),r=e.filter(n=>this.defs.has(n));r.forEach((n,o)=>{this.defs.get(n).order=o});let s=new Set(r);return i.filter(n=>!s.has(n.key)).forEach((n,o)=>{n.order=r.length+o}),this}list(){return[...this.defs.values()].sort((e,i)=>e.order-i.order)}has(e){return this.defs.has(e)}toFilters(e){return this.list().filter(r=>Object.hasOwn(e,r.key)).map(r=>r.toParams(e[r.key])).reduce((r,s)=>({...r,...s}),{})}activeKeys(e){return this.list().filter(i=>_optionalChain([i, 'access', _2 => _2.isActive, 'optionalCall', _3 => _3(e)])).map(i=>i.key)}clearedParams(){return this.list().reduce((e,i)=>Object.assign(e,i.toParams(i.fromParams({}))),{})}}, _class2);var J= (_class3 =class{constructor() { _class3.prototype.__init3.call(this); }__init3() {this.defs=new Map}add(e){if(this.defs.has(e.id))throw new Error(`DatasetRegistry: dataset "${e.id}" is already registered`);return this.defs.set(e.id,{...e}),this}get(e){return this.defs.get(e)}has(e){return this.defs.has(e)}list(){return[...this.defs.values()]}visibleIds(){return this.list().filter(e=>_optionalChain([e, 'access', _4 => _4.visible, 'optionalCall', _5 => _5()])!==!1).map(e=>e.id)}}, _class3);var Y= (_class4 =class{constructor() { _class4.prototype.__init4.call(this); }__init4() {this.map=new Map}dispose(){this.map.clear()}emit(e){let i=this.map.get(e.type);if(i)for(let s of[...i])s(e);let r=this.map.get("*");if(r)for(let s of[...r])s(e)}on(e,i){let r=this.map.get(e);return r||(r=new Set,this.map.set(e,r)),r.add(i),()=>{r.delete(i)}}}, _class4);var Me={pagination:"paged",pageSize:20,debounceMs:250};var ee=class{constructor(e){this.options=Object.freeze({...Me,...e})}};var te= (_class5 =class{__init5() {this.emitter=new Y}__init6() {this.debounceTimer=null}__init7() {this.debounceResolve=null}__init8() {this.queryToken=0}__init9() {this.pointsToken=0}__init10() {this.mapHandle=null}constructor(e){;_class5.prototype.__init5.call(this);_class5.prototype.__init6.call(this);_class5.prototype.__init7.call(this);_class5.prototype.__init8.call(this);_class5.prototype.__init9.call(this);_class5.prototype.__init10.call(this);this.datasets=e.datasets,this.filters=_nullishCoalesce(e.filters, () => (new U)),this.map=e.map,this.config=new ee(e.config);let i=_nullishCoalesce(e.primaryDatasetId, () => (_optionalChain([this, 'access', _6 => _6.datasets, 'access', _7 => _7.list, 'call', _8 => _8(), 'access', _9 => _9[0], 'optionalAccess', _10 => _10.id])));if(i==null||!this.datasets.has(i))throw new Error(`ListingEngine: primary dataset "${_nullishCoalesce(i, () => (""))}" is not registered \u2014 pass a valid primaryDatasetId or register at least one dataset`);this.primaryDatasetId=i,this.store=new X({filters:_nullishCoalesce(e.initialFilters, () => ({})),mode:this.config.options.pagination})}get state(){return this.store.getState()}get options(){return this.config.options}applyFilters(e){this.store.setFilters(e),this.emitter.emit({type:"FiltersChanged",filters:this.currentFilters()}),this.clearDebounce();let i=++this.queryToken,r=this.config.options.debounceMs;return r<=0?this.runQuery(i):new Promise(s=>{this.debounceResolve=s,this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.debounceResolve=null,s(this.runQuery(i))},r)})}async loadPage(){let e=this.state.results.nextCursor;if(e===null)return;let i=++this.queryToken,r=this.primaryDataset();this.store.setLoading(!0);try{let s=await r.adapter.list(this.currentFilters(),{cursor:e,limit:this.config.options.pageSize});if(i!==this.queryToken)return;this.config.options.pagination==="infinite"?this.store.appendResults(s):this.store.setResults(s),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:s.items.length})}finally{i===this.queryToken&&this.store.setLoading(!1)}}async loadPoints(e){this.store.setBounds(e),this.emitter.emit({type:"BoundsChanged",bounds:e});let i=this.currentFilters(),r=++this.pointsToken;await Promise.allSettled(this.datasets.visibleIds().map(async s=>{let n=this.datasets.get(s);if(!n)return;let o=await n.adapter.getPoints(i,e);r===this.pointsToken&&this.store.setPoints(s,o)}))}setMapHandle(e){this.mapHandle=e}fitBounds(e){!this.map||!this.mapHandle||this.map.fitBounds(this.mapHandle,e)}selectPoint(e,i){this.store.setSelection(i);let r=_optionalChain([this, 'access', _11 => _11.state, 'access', _12 => _12.points, 'access', _13 => _13[e], 'optionalAccess', _14 => _14.find, 'call', _15 => _15(s=>s.id===i)]);r&&this.emitter.emit({type:"PointClicked",datasetId:e,id:r.id,entity:r.entity})}setHovered(e,i){this.store.setHovered(i)}toggleLayer(e){let r=!(_nullishCoalesce(this.state.layers[e], () => (!0)));this.store.setLayerVisible(e,r),this.emitter.emit({type:"LayerToggled",datasetId:e,visible:r})}subscribe(e){return this.store.subscribe(e)}on(e,i){return this.emitter.on(e,i)}dispose(){this.clearDebounce(),this.emitter.dispose(),this.mapHandle=null}async runQuery(e){if(e!==this.queryToken)return;let i=this.primaryDataset();this.store.setLoading(!0);try{let r=await i.adapter.list(this.currentFilters(),{cursor:null,limit:this.config.options.pageSize});if(e!==this.queryToken)return;this.store.setResults(r),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:r.items.length})}finally{e===this.queryToken&&this.store.setLoading(!1)}}primaryDataset(){return this.datasets.get(this.primaryDatasetId)}currentFilters(){return this.store.getState().filters}clearDebounce(){this.debounceTimer!==null&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.debounceResolve!==null&&(this.debounceResolve(),this.debounceResolve=null)}}, _class5);function De(...t){let e={config:{},filters:new U,datasets:new J};for(let i of t)i(e);return e}var Oe=t=>e=>{e.config={...e.config,...t}},_e= exports.j =t=>e=>{e.map=t},Be= exports.k =t=>e=>{e.datasets.add(t)},He= exports.l =t=>e=>{t(e.filters)},ki= exports.m =t=>e=>{e.urlSync=t},Ae= exports.n =t=>e=>{e.initialFilters=t},Ii= exports.o =t=>e=>{e.primaryDatasetId=t};var _react = require('react');var _jsxruntime = require('react/jsx-runtime');function gt(t){return String(_nullishCoalesce(_optionalChain([t, 'optionalAccess', _16 => _16.title]), () => ("")))}var yt=({item:t})=>_jsxruntime.jsx.call(void 0, "div",{children:gt(t)}),ht=()=>_jsxruntime.jsx.call(void 0, "div",{}),ce= exports.p =()=>_jsxruntime.jsx.call(void 0, "div",{}),vt=({children:t})=>_jsxruntime.jsx.call(void 0, "div",{children:t}),Lt=({children:t})=>_jsxruntime.jsx.call(void 0, "div",{children:t}),bt=({value:t,onChange:e,placeholder:i})=>_jsxruntime.jsx.call(void 0, "input",{type:"search",value:t,placeholder:i,onChange:r=>e(r.target.value),"aria-label":_nullishCoalesce(i, () => ("Search"))}),Tt=()=>_jsxruntime.jsx.call(void 0, "div",{role:"status",children:"No results"}),Pt=()=>_jsxruntime.jsx.call(void 0, "div",{role:"status","aria-busy":"true",children:"Loading\u2026"}),Ft=({count:t})=>_jsxruntime.jsxs.call(void 0, "div",{children:[t," results"]}),Ct=({children:t})=>_jsxruntime.jsx.call(void 0, "div",{children:t}),I={Card:yt,Marker:ht,Popup:ce,Sidebar:vt,FilterPanel:Lt,Search:bt,Empty:Tt,Loading:Pt,ResultHeader:Ft,Toolbar:Ct},ze=_react.createContext.call(void 0, I);function Ue(t){let{Card:e,Marker:i,Popup:r,Sidebar:s,FilterPanel:n,Search:o,Empty:l,Loading:d,ResultHeader:p,Toolbar:a,children:f}=t,L={Card:_nullishCoalesce(e, () => (I.Card)),Marker:_nullishCoalesce(i, () => (I.Marker)),Popup:_nullishCoalesce(r, () => (I.Popup)),Sidebar:_nullishCoalesce(s, () => (I.Sidebar)),FilterPanel:_nullishCoalesce(n, () => (I.FilterPanel)),Search:_nullishCoalesce(o, () => (I.Search)),Empty:_nullishCoalesce(l, () => (I.Empty)),Loading:_nullishCoalesce(d, () => (I.Loading)),ResultHeader:_nullishCoalesce(p, () => (I.ResultHeader)),Toolbar:_nullishCoalesce(a, () => (I.Toolbar))};return _jsxruntime.jsx.call(void 0, ze.Provider,{value:L,children:f})}function T(){return _react.useContext.call(void 0, ze)}var ie=_react.createContext.call(void 0, null);function y(){let t=_react.useContext.call(void 0, ie);if(t===null)throw new Error("useListing must be used within a <ListingProvider>");return t}function P(){let t=y(),e=_react.useCallback.call(void 0, r=>t.subscribe(r),[t]),i=_react.useCallback.call(void 0, ()=>t.state,[t]);return _react.useSyncExternalStore.call(void 0, e,i,i)}function re(){let t=y(),e=P(),i=_react.useCallback.call(void 0, s=>t.applyFilters(s),[t]),r=_react.useCallback.call(void 0, (s,n)=>t.applyFilters({[s]:n}),[t]);return{filters:e.filters,set:i,setField:r}}function ue({className:t,groupClassName:e,hideLabels:i,draft:r,onDraftChange:s}={}){let n=y(),{FilterPanel:o}=T(),{filters:l}=re(),d=r!==void 0&&s!==void 0,p=d?r:l;return _jsxruntime.jsx.call(void 0, o,{children:_jsxruntime.jsx.call(void 0, "div",{className:_nullishCoalesce(t, () => ("space-y-5")),children:n.filters.list().map(a=>{if(typeof a.render=="string")return _jsxruntime.jsx.call(void 0, "div",{"data-filter":a.key,className:e},a.key);let f=a.render;return _jsxruntime.jsxs.call(void 0, "div",{className:e,children:[a.label&&!i&&_jsxruntime.jsx.call(void 0, "div",{className:"mb-1.5 text-[13px] font-medium text-foreground",children:a.label}),_jsxruntime.jsx.call(void 0, f,{value:a.fromParams(p),onChange:L=>d?s(a.toParams(L)):void n.applyFilters(a.toParams(L))})]},a.key)})})})}function K(){return P().results}function xt(t,e){if(t&&typeof t=="object"&&"id"in t){let i=t.id;if(typeof i=="string"||typeof i=="number")return i}return e}function $e({className:t}={}){let e=y(),{items:i}=K(),{pagination:r,selection:s}=P(),{Card:n,Empty:o,Loading:l}=T();return r.loading&&i.length===0?_jsxruntime.jsx.call(void 0, l,{}):i.length===0?_jsxruntime.jsx.call(void 0, o,{}):_jsxruntime.jsx.call(void 0, "div",{role:"list",className:t,children:i.map((d,p)=>{let a=xt(d,p);return _jsxruntime.jsx.call(void 0, n,{item:d,selected:s===a,onSelect:()=>e.selectPoint(e.primaryDatasetId,a)},a)})})}var _reactdom = require('react-dom');var Rt={west:-179.9,south:-85,east:179.9,north:85},qe=.1,je=.02;function Mt(t){if(t.length===0)return null;let e=t[0].lng,i=t[0].lng,r=t[0].lat,s=t[0].lat;for(let{lat:l,lng:d}of t)d<e&&(e=d),d>i&&(i=d),l<r&&(r=l),l>s&&(s=l);let n=s>r?(s-r)*qe:je,o=i>e?(i-e)*qe:je;return{west:e-o,east:i+o,south:r-n,north:s+n}}function Ge(t){let{center:e,zoom:i,fallback:r,mapControls:s}=t,n=y(),o=P(),l=_react.useRef.call(void 0, null),d=_react.useRef.call(void 0, null),p=_react.useRef.call(void 0, null),[a,f]=_react.useState.call(void 0, !1),L=_react.useRef.call(void 0, !1),E=_react.useRef.call(void 0, !1),C=_react.useRef.call(void 0, !1),c=n.map;_react.useEffect.call(void 0, ()=>{let b=p.current;if(!c||!b)return;let h=[];for(let u of Object.keys(o.points)){if(o.layers[u]===!1)continue;let g=n.datasets.get(u),R=_nullishCoalesce(o.points[u], () => ([])),W={id:u,markers:R.map(k=>({id:k.id,position:k.position,iconUrl:_optionalChain([g, 'optionalAccess', _17 => _17.marker, 'access', _18 => _18.iconUrl, 'optionalCall', _19 => _19(k.entity)]),element:_optionalChain([g, 'optionalAccess', _20 => _20.marker, 'access', _21 => _21.element, 'optionalCall', _22 => _22(k.entity)])})),clustering:_optionalChain([g, 'optionalAccess', _23 => _23.clustering]),onMarkerClick:k=>n.selectPoint(u,k)};h.push(c.renderLayer(b,W))}return()=>{h.forEach(u=>u())}},[n,c,a,o.points,o.layers]),_react.useEffect.call(void 0, ()=>{if(!l.current||!c)return;let b=l.current,h=!1,u=null;return(async()=>{let g=await c.mount(b,{center:e,zoom:i,fullscreenTarget:_nullishCoalesce(d.current, () => (void 0))});if(h){c.destroy(g);return}p.current=g,n.setMapHandle(g),u=c.onBoundsChange(g,R=>{C.current?C.current=!1:E.current=!0,n.loadPoints(R)}),f(!0),n.loadPoints(Rt)})(),()=>{h=!0,_optionalChain([u, 'optionalCall', _24 => _24()]),p.current&&(c.destroy(p.current),p.current=null,n.setMapHandle(null)),f(!1)}},[n,c]),_react.useEffect.call(void 0, ()=>{let b=p.current;if(!c||!b||e||L.current||E.current)return;let h=[];for(let g of Object.keys(o.points))if(o.layers[g]!==!1)for(let R of _nullishCoalesce(o.points[g], () => ([])))h.push(R.position);let u=Mt(h);u&&(L.current=!0,C.current=!0,c.fitBounds(b,u))},[c,e,a,o.points,o.layers]),_react.useEffect.call(void 0, ()=>{_optionalChain([c, 'optionalAccess', _25 => _25.updateMarkerStates, 'call', _26 => _26(o.selection,o.hovered)])},[c,a,o.selection,o.hovered]);let{Popup:x}=T(),N=x!==ce,w=_nullishCoalesce(o.points[n.primaryDatasetId], () => ([])),z=o.selection!=null?w.find(b=>b.id===o.selection):void 0,[S,D]=_react.useState.call(void 0, null),Z=_react.useRef.call(void 0, z);return Z.current=z,_react.useEffect.call(void 0, ()=>{let b=p.current;if(!c||!b||!N)return;let h=Z.current;if(!h)return;let u=c.mountOverlay(h.position);D({entity:h.entity,position:h.position,container:u.container});let g=()=>n.selectPoint(n.primaryDatasetId,null),R=k=>{k.key==="Escape"&&g()};document.addEventListener("keydown",R);let W=c.onMapClick(g);return()=>{document.removeEventListener("keydown",R),W(),u.unmount(),D(null)}},[n,c,a,o.selection,N]),_jsxruntime.jsxs.call(void 0, "div",{ref:d,className:"relative h-full min-h-0 w-full",children:[_jsxruntime.jsxs.call(void 0, "div",{ref:l,className:!c&&r?"flex h-full min-h-0 w-full items-center justify-center":"h-full min-h-0 w-full",children:[!c&&r,N&&S?_reactdom.createPortal.call(void 0, _jsxruntime.jsx.call(void 0, x,{entity:S.entity,onClose:()=>n.selectPoint(n.primaryDatasetId,null)}),S.container):null]}),s!=null&&_jsxruntime.jsx.call(void 0, "div",{className:"pointer-events-none absolute inset-0",children:_jsxruntime.jsx.call(void 0, "div",{className:"pointer-events-auto",children:s})})]})}function Ze(){let t=y(),{results:e,pagination:i}=P();return e.nextCursor==null?null:_jsxruntime.jsx.call(void 0, "button",{type:"button",disabled:i.loading,onClick:()=>{t.loadPage()},children:"Load more"})}function Xe(){let{items:t,total:e}=K(),{ResultHeader:i}=T();return _jsxruntime.jsx.call(void 0, i,{count:t.length,total:e})}function Je(t,e){let i=y(),r=_react.useRef.call(void 0, e);r.current=e,_react.useEffect.call(void 0, ()=>i.on(t,s=>r.current(s)),[i,t])}function et(t){let{children:e,...i}=t,[r]=_react.useState.call(void 0, ()=>i),[s,n]=_react.useState.call(void 0, null);return _react.useEffect.call(void 0, ()=>{let o=new te({datasets:r.datasets,filters:r.filters,config:r.config,map:r.map,initialFilters:r.initialFilters,primaryDatasetId:r.primaryDatasetId});return r.urlSync&&r.urlSync.start(o),n(o),()=>{r.urlSync&&r.urlSync.stop(),o.dispose(),n(l=>l===o?null:l)}},[r]),s?_jsxruntime.jsx.call(void 0, ie.Provider,{value:s,children:e}):null}function V(t){return typeof t!="number"?t:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(t)}function zt(t){return t?"rle-card rle-card--selected":"rle-card"}function fe({item:t,selected:e,onSelect:i}){let r=_nullishCoalesce(t, () => ({})),s=zt(e),n=_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[r.imageUrl?_jsxruntime.jsx.call(void 0, "img",{src:r.imageUrl,alt:_nullishCoalesce(r.title, () => ("")),className:"rle-card-media"}):_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-media rle-card-media--placeholder","aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{className:"rle-card-body",children:[r.title&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-title",children:r.title}),r.subtitle&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-address",children:r.subtitle}),r.badge&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-info",children:_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-info-item",children:r.badge})}),r.price!=null&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-price",children:V(r.price)})]})]});return i?_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:i,"aria-pressed":_nullishCoalesce(e, () => (!1)),className:s,children:n}):_jsxruntime.jsx.call(void 0, "article",{className:s,children:n})}function ge(t){return _jsxruntime.jsxs.call(void 0, "div",{role:"status",className:"rle-empty",children:[_jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",className:"rle-empty-icon","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "circle",{cx:"11",cy:"11",r:"7"}),_jsxruntime.jsx.call(void 0, "path",{d:"m21 21-4.3-4.3"})]}),_jsxruntime.jsx.call(void 0, "p",{className:"rle-empty-title",children:"No results"}),_jsxruntime.jsx.call(void 0, "p",{className:"rle-empty-hint",children:"Try adjusting your filters or search terms."})]})}function ye({children:t}){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-panel",children:t})}function he(t){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-loading",role:"status","aria-busy":"true","aria-label":"Loading results",children:Array.from({length:3}).map((e,i)=>_jsxruntime.jsxs.call(void 0, "div",{className:"rle-loading-item",children:[_jsxruntime.jsx.call(void 0, "div",{className:"rle-skeleton",style:{aspectRatio:"4 / 3",width:"100%"}}),_jsxruntime.jsx.call(void 0, "div",{className:"rle-skeleton",style:{height:16,width:"65%"}}),_jsxruntime.jsx.call(void 0, "div",{className:"rle-skeleton",style:{height:12,width:"35%"}})]},i))})}function ve({point:t}){let e=_nullishCoalesce(t.entity, () => ({}));return _jsxruntime.jsx.call(void 0, "span",{className:"rle-pin",children:e.price!=null?V(e.price):""})}function be({entity:t,onClose:e}){let i=_nullishCoalesce(t, () => ({}));return _jsxruntime.jsxs.call(void 0, "div",{className:"rle-popup",role:"group","aria-label":"Location details",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:e,"aria-label":"Close",className:"rle-popup-close",children:_jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "path",{d:"M18 6 6 18"}),_jsxruntime.jsx.call(void 0, "path",{d:"m6 6 12 12"})]})}),_jsxruntime.jsxs.call(void 0, "div",{children:[i.title&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-title",children:i.title}),i.subtitle&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-address",children:i.subtitle}),i.price!=null&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-price",children:V(i.price)})]})]})}function Te({count:t,total:e}){let i=e!=null&&e!==t?`${t} of ${e} results`:`${t} results`;return _jsxruntime.jsx.call(void 0, "div",{className:"rle-result-header",children:i})}function Pe({value:t,onChange:e,placeholder:i}){return _jsxruntime.jsx.call(void 0, "input",{type:"search",value:t,placeholder:i,onChange:r=>e(r.target.value),"aria-label":_nullishCoalesce(i, () => ("Search")),className:"rle-input"})}function Fe({children:t}){return _jsxruntime.jsx.call(void 0, "aside",{className:"rle-sidebar",children:t})}function Ce({children:t}){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-toolbar",children:t})}var rt={Card:fe,Marker:ve,Popup:be,Sidebar:Fe,FilterPanel:ye,Search:Pe,Empty:ge,Loading:he,ResultHeader:Te,Toolbar:Ce};function nt({view:t,onViewChange:e}){return _jsxruntime.jsx.call(void 0, "nav",{className:"rle-bottom-nav","aria-label":"Listing navigation",children:_jsxruntime.jsxs.call(void 0, "div",{className:"rle-viewtoggle",role:"group","aria-label":"View",children:[_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:`rle-viewtoggle__btn${t==="list"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":t==="list",onClick:()=>e("list"),children:[_jsxruntime.jsx.call(void 0, Gt,{}),"List"]}),_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:`rle-viewtoggle__btn${t==="map"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":t==="map",onClick:()=>e("map"),children:[_jsxruntime.jsx.call(void 0, Zt,{}),"Map"]})]})})}function Gt(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "line",{x1:"8",y1:"6",x2:"20",y2:"6"}),_jsxruntime.jsx.call(void 0, "line",{x1:"8",y1:"12",x2:"20",y2:"12"}),_jsxruntime.jsx.call(void 0, "line",{x1:"8",y1:"18",x2:"20",y2:"18"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"6",x2:"4.01",y2:"6"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"12",x2:"4.01",y2:"12"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"18",x2:"4.01",y2:"18"})]})}function Zt(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "polygon",{points:"1 6 8 3 16 6 23 3 23 18 16 21 8 18 1 21 1 6"}),_jsxruntime.jsx.call(void 0, "line",{x1:"8",y1:"3",x2:"8",y2:"18"}),_jsxruntime.jsx.call(void 0, "line",{x1:"16",y1:"6",x2:"16",y2:"21"})]})}function ot({open:t,onOpenChange:e,title:i,children:r,footer:s}){let n=_react.useRef.call(void 0, null),[o,l]=_react.useState.call(void 0, !1),[d,p]=_react.useState.call(void 0, !1);return _react.useEffect.call(void 0, ()=>{if(!t){p(!1),l(!1);return}l(!0);let a=requestAnimationFrame(()=>p(!0));return()=>cancelAnimationFrame(a)},[t]),_react.useEffect.call(void 0, ()=>{if(!o)return;let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a}},[o]),_react.useEffect.call(void 0, ()=>{if(!o)return;_optionalChain([n, 'access', _27 => _27.current, 'optionalAccess', _28 => _28.focus, 'call', _29 => _29()]);function a(f){f.key==="Escape"&&e(!1)}return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[o,e]),!o||typeof document>"u"?null:_reactdom.createPortal.call(void 0, _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "div",{className:`rle-sheet-backdrop${d?" rle-sheet-backdrop--open":""}`,onClick:()=>e(!1),"aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{ref:n,className:`rle-sheet${d?" rle-sheet--open":""}`,role:"dialog","aria-modal":"true","aria-label":i,tabIndex:-1,children:[_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__handle","aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{className:"rle-sheet__header",children:[i&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__title",children:i}),_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-sheet__close",onClick:()=>e(!1),"aria-label":"Close",children:_jsxruntime.jsx.call(void 0, Yt,{})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__body",children:r}),s&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__footer",children:s})]})]}),document.body)}function Yt(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",width:"16",height:"16","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "path",{d:"M18 6 6 18"}),_jsxruntime.jsx.call(void 0, "path",{d:"m6 6 12 12"})]})}function at({search:t,onFiltersClick:e,filterCount:i=0,action:r}){let{Search:s}=T();return _jsxruntime.jsxs.call(void 0, "header",{className:"rle-mobile-header",children:[t&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-mobile-header__search",children:_jsxruntime.jsx.call(void 0, s,{value:t.value,onChange:t.onChange,placeholder:t.placeholder})}),_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"rle-btn rle-mobile-header__btn",onClick:e,children:[_jsxruntime.jsx.call(void 0, ti,{}),_jsxruntime.jsx.call(void 0, "span",{children:"Filters"}),i>0&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-mobile-header__count",children:i})]}),r&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-btn rle-mobile-header__btn rle-mobile-header__btn--icon",onClick:r.onClick,"aria-label":r.label,children:_nullishCoalesce(r.icon, () => (_jsxruntime.jsx.call(void 0, ii,{})))})]})}function ti(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"6",x2:"20",y2:"6"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"9",cy:"6",r:"2",fill:"currentColor",stroke:"none"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"12",x2:"20",y2:"12"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"15",cy:"12",r:"2",fill:"currentColor",stroke:"none"}),_jsxruntime.jsx.call(void 0, "line",{x1:"4",y1:"18",x2:"20",y2:"18"}),_jsxruntime.jsx.call(void 0, "circle",{cx:"11",cy:"18",r:"2",fill:"currentColor",stroke:"none"})]})}function ii(){return _jsxruntime.jsxs.call(void 0, "svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[_jsxruntime.jsx.call(void 0, "line",{x1:"12",y1:"5",x2:"12",y2:"19"}),_jsxruntime.jsx.call(void 0, "line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}var ri=_jsxruntime.jsx.call(void 0, "div",{className:"rle-empty",children:"Map unavailable"});function ni(){let t=_react.useRef.call(void 0, null),[e,i]=_react.useState.call(void 0, !0),[r,s]=_react.useState.call(void 0, !0);return _react.useEffect.call(void 0, ()=>{let n=t.current;if(!n)return;let o=()=>{let{clientWidth:f,scrollLeft:L,scrollWidth:E}=n;i(L<=0),s(L+f>=E-1)},l=0,d=()=>{l||(l=requestAnimationFrame(()=>{l=0,o()}))};o(),n.addEventListener("scroll",o,{passive:!0});let p,a;return typeof ResizeObserver<"u"&&(p=new ResizeObserver(o),p.observe(n)),typeof MutationObserver<"u"&&(a=new MutationObserver(d),a.observe(n,{characterData:!0,childList:!0,subtree:!0})),()=>{n.removeEventListener("scroll",o),_optionalChain([p, 'optionalAccess', _30 => _30.disconnect, 'call', _31 => _31()]),_optionalChain([a, 'optionalAccess', _32 => _32.disconnect, 'call', _33 => _33()]),l&&cancelAnimationFrame(l)}},[]),{atEnd:r,atStart:e,ref:t}}function si(t,e){if(t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;let i=t,r=e,s=new Set([...Object.keys(i),...Object.keys(r)]);for(let n of s)if(i[n]!==r[n])return!1;return!0}function dt({search:t,filterBarEnd:e,toolbarEnd:i,mobileAction:r,autoFetch:s=!0,hasMap:n,mapCenter:o,mapZoom:l,mapControls:d,mobileSheetFooter:p,className:a}){let f=y(),{Search:L}=T(),E=K(),{filters:C,set:c}=re(),{pagination:x}=P(),N=_nullishCoalesce(n, () => (f.map!=null)),[w,z]=_react.useState.call(void 0, "list"),[S,D]=_react.useState.call(void 0, !1),{atEnd:Z,atStart:b,ref:h}=ni(),[u,g]=_react.useState.call(void 0, C),[R,W]=_react.useState.call(void 0, S);S!==R&&(W(S),S&&g(C));let k=pe=>g(ut=>({...ut,...pe})),[Ie,Ee]=_react.useState.call(void 0, !1),de=_react.useRef.call(void 0, !1);_react.useEffect.call(void 0, ()=>{if(Ie){if(x.loading){de.current=!0;return}de.current&&(de.current=!1,Ee(!1),D(!1))}},[Ie,x.loading]);let q=t?{value:String(_nullishCoalesce(C[t.filterKey], () => (""))),onChange:pe=>{c({[t.filterKey]:pe||void 0})},placeholder:t.placeholder}:void 0;_react.useEffect.call(void 0, ()=>{s!==!1&&f.applyFilters({})},[f,s]);let xe=()=>{k(f.filters.clearedParams())},Ne=()=>{if(si(u,C)){D(!1);return}Ee(!0),f.applyFilters(u)},ct=f.filters.activeKeys(C).length,Re=_nullishCoalesce(E.total, () => (E.items.length));return _jsxruntime.jsxs.call(void 0, "div",{className:a?`rle-app ${a}`:"rle-app",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-filter-bar",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-filter-bar__scroll",ref:h,children:[q&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__search",children:_jsxruntime.jsx.call(void 0, L,{value:q.value,onChange:q.onChange,placeholder:q.placeholder})}),_jsxruntime.jsx.call(void 0, ue,{className:"rle-filters-row",groupClassName:"rle-filter-group",hideLabels:!0}),e&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__end",children:e})]}),!b&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__fade rle-filter-bar__fade--start","aria-hidden":"true"}),!Z&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__fade rle-filter-bar__fade--end","aria-hidden":"true"})]}),_jsxruntime.jsx.call(void 0, at,{search:q,onFiltersClick:()=>D(!0),filterCount:ct,action:r}),_jsxruntime.jsxs.call(void 0, "div",{className:`rle-body ${N?"rle-split":"rle-body--list-only"}`,"data-mobile-view":w,children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-list",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"rle-list-header",children:[_jsxruntime.jsx.call(void 0, Xe,{}),i&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-list-header__toolbar",children:i})]}),_jsxruntime.jsx.call(void 0, $e,{className:"rle-list-grid"}),_jsxruntime.jsx.call(void 0, Ze,{})]}),N&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-map",children:_jsxruntime.jsx.call(void 0, Ge,{center:o,zoom:l,fallback:ri,mapControls:d})})]}),N&&_jsxruntime.jsx.call(void 0, nt,{view:w,onViewChange:z}),_jsxruntime.jsx.call(void 0, ot,{title:"Filters",open:S,onOpenChange:D,footer:p?p({draft:u,apply:Ne,clear:xe,resultCount:Re,loading:x.loading}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-btn rle-btn--ghost",onClick:xe,children:"Clear all"}),_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-btn rle-btn--primary rle-sheet__apply",disabled:x.loading,onClick:Ne,children:x.loading?_jsxruntime.jsx.call(void 0, "span",{className:"rle-spinner","aria-label":"Updating results"}):`Show ${Re} results`})]}),children:_jsxruntime.jsx.call(void 0, ue,{className:"rle-filter-stack",groupClassName:"rle-filter-group",draft:u,onDraftChange:k})})]})}function pt(t){return"provider"in t}function pi(t){let e=t!=null&&!pt(t),i=e?t.apiKey:void 0,r=e?t.mapId:void 0,s=e?t.mapOptions:void 0,n=e?t.styles:void 0,[o,l]=_react.useState.call(void 0, ()=>!t||pt(t)?{ready:!0,provider:_optionalChain([t, 'optionalAccess', _34 => _34.provider])}:{ready:!1});return _react.useEffect.call(void 0, ()=>{if(!i)return;let d=!1;return Promise.resolve().then(() => _interopRequireWildcard(require("./maps/google/index.cjs"))).then(({googleProvider:p})=>{d||l({ready:!0,provider:p({apiKey:i,mapId:r,mapOptions:s,styles:n})})}),()=>{d=!0}},[i,r]),o}function ci({onFiltersChange:t}){let e=_react.useRef.call(void 0, t);return e.current=t,Je("FiltersChanged",i=>{i.type==="FiltersChanged"&&e.current(i.filters)}),null}function Rn(t){let{datasets:e,filters:i,map:r,components:s,initialFilters:n,onFiltersChange:o,mobileAction:l,search:d,filterBarEnd:p,toolbarEnd:a,mapControls:f,mobileSheetFooter:L,config:E,autoFetch:C,className:c}=t,{ready:x,provider:N}=pi(r);if(!x)return null;let w=[];for(let D of e)w.push(Be(D));i&&w.push(He(i)),N&&w.push(_e(N)),n&&w.push(Ae(n)),E&&w.push(Oe(E));let z=De(...w),S={...rt,...s};return _jsxruntime.jsxs.call(void 0, et,{...z,children:[o&&_jsxruntime.jsx.call(void 0, ci,{onFiltersChange:o}),_jsxruntime.jsx.call(void 0, Ue,{...S,children:_jsxruntime.jsx.call(void 0, dt,{className:c,search:d,filterBarEnd:p,toolbarEnd:a,mobileAction:l,autoFetch:C,mapCenter:_optionalChain([r, 'optionalAccess', _35 => _35.center]),mapZoom:_optionalChain([r, 'optionalAccess', _36 => _36.zoom]),mapControls:f,mobileSheetFooter:L})})]})}exports.a = X; exports.b = U; exports.c = J; exports.d = Y; exports.e = Me; exports.f = ee; exports.g = te; exports.h = De; exports.i = Oe; exports.j = _e; exports.k = Be; exports.l = He; exports.m = ki; exports.n = Ae; exports.o = Ii; exports.p = ce; exports.q = Ue; exports.r = T; exports.s = ie; exports.t = y; exports.u = P; exports.v = re; exports.w = ue; exports.x = K; exports.y = $e; exports.z = Ge; exports.A = Ze; exports.B = Xe; exports.C = Je; exports.D = et; exports.E = fe; exports.F = ge; exports.G = ye; exports.H = he; exports.I = ve; exports.J = be; exports.K = Te; exports.L = Pe; exports.M = Fe; exports.N = Ce; exports.O = rt; exports.P = nt; exports.Q = ot; exports.R = dt; exports.S = Rn;
|