react-listing-engine 0.6.5 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -40
- package/dist/chunk-OXSYNZAJ.js +2 -0
- package/dist/chunk-PE27NATS.cjs +2 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +93 -11
- package/dist/index.d.ts +93 -11
- package/dist/index.js +1 -1
- package/dist/{listing-app-BSJKGh7k.d.ts → listing-app-4Vs_SMNl.d.cts} +145 -23
- package/dist/{listing-app-BMoMKD4c.d.cts → listing-app-CkEGdUV9.d.ts} +145 -23
- package/dist/styled/index.cjs +1 -1
- package/dist/styled/index.d.cts +6 -7
- package/dist/styled/index.d.ts +6 -7
- package/dist/styled/index.js +1 -1
- package/package.json +3 -9
- package/dist/chunk-2VUHLHHX.cjs +0 -2
- package/dist/chunk-35KYEBAC.js +0 -2
- package/dist/chunk-CGT3RHJ7.js +0 -2
- package/dist/chunk-EYXV5OMY.cjs +0 -2
- package/dist/chunk-R3FX2V3N.js +0 -2
- package/dist/chunk-RXHR66FS.cjs +0 -2
- package/dist/components-provider-FinfaqUT.d.cts +0 -131
- package/dist/components-provider-cWVWEDXC.d.ts +0 -131
- package/dist/shadcn/index.cjs +0 -2
- package/dist/shadcn/index.d.cts +0 -259
- package/dist/shadcn/index.d.ts +0 -259
- package/dist/shadcn/index.js +0 -2
- package/dist/url-sync.controller-DK5W_0OZ.d.ts +0 -89
- package/dist/url-sync.controller-DXSIWgTa.d.cts +0 -89
package/dist/styled/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { d as IListingCardProps, f as IListingEmptyProps, g as IListingFilterPanelProps, h as IListingLoadingProps, i as IListingMarkerProps, j as IListingPopupProps, k as IListingResultHeaderProps, l as IListingSearchProps, m as IListingSidebarProps, a as IListingToolbarProps, e as IListingComponents } from '../
|
|
4
|
-
export { B as BottomNav,
|
|
3
|
+
import { d as IListingCardProps, f as IListingEmptyProps, g as IListingFilterPanelProps, h as IListingLoadingProps, i as IListingMarkerProps, j as IListingPopupProps, k as IListingResultHeaderProps, l as IListingSearchProps, m as IListingSidebarProps, a as IListingToolbarProps, e as IListingComponents } from '../listing-app-4Vs_SMNl.cjs';
|
|
4
|
+
export { B as BottomNav, p as BottomNavView, q as IBottomNavAction, r as IBottomNavProps, s as IStyledListingLayoutProps, L as ListingApp, t as ListingAppMapProp, n as ListingAppProps, S as StyledListingLayout } from '../listing-app-4Vs_SMNl.cjs';
|
|
5
5
|
import '../map-provider.interface-DT-v1plm.cjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -33,7 +33,7 @@ declare function StyledMarker({ point }: IListingMarkerProps): react.JSX.Element
|
|
|
33
33
|
* accessible close button. `role="group"` + `aria-label` (rather than
|
|
34
34
|
* `role="dialog"`) since this is a non-modal, non-focus-trapped popup
|
|
35
35
|
* anchored to a map marker -- `dialog` without modality/focus management
|
|
36
|
-
* would misrepresent it to AT users.
|
|
36
|
+
* would misrepresent it to AT users.
|
|
37
37
|
*/
|
|
38
38
|
declare function StyledPopup({ entity, onClose }: IListingPopupProps): react.JSX.Element;
|
|
39
39
|
|
|
@@ -56,7 +56,7 @@ declare function StyledToolbar({ children }: IListingToolbarProps): react.JSX.El
|
|
|
56
56
|
* of the box -- pair it with `import 'react-listing-engine/styles.css'`; use
|
|
57
57
|
* `ListingComponentsProvider` directly (with your own components for some or
|
|
58
58
|
* all slots) otherwise -- the two compose fine since `ListingComponentsProvider`
|
|
59
|
-
* falls back per-slot.
|
|
59
|
+
* falls back per-slot.
|
|
60
60
|
*/
|
|
61
61
|
declare function StyledComponentsProviderWithDefaults({ children }: {
|
|
62
62
|
children: ReactNode;
|
|
@@ -64,8 +64,7 @@ declare function StyledComponentsProviderWithDefaults({ children }: {
|
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* Every `/styled` default, keyed by slot -- the single source of truth for
|
|
67
|
-
* `StyledComponentsProviderWithDefaults
|
|
68
|
-
* `shadcnDefaultComponents`.
|
|
67
|
+
* `StyledComponentsProviderWithDefaults`.
|
|
69
68
|
*
|
|
70
69
|
* Kept as a plain object, not JSX, so a caller can merge it with
|
|
71
70
|
* `{ ...styledDefaultComponents, ...overrides }` and hand the result to ONE
|
|
@@ -89,7 +88,7 @@ interface IBottomSheetProps {
|
|
|
89
88
|
/**
|
|
90
89
|
* Dependency-free mobile bottom sheet -- the `/styled` adapter's own modal
|
|
91
90
|
* primitive, used by `StyledListingLayout` for the mobile filters panel.
|
|
92
|
-
* Deliberately
|
|
91
|
+
* Deliberately dependency-free (no Radix or other UI-library sheet): `/styled`
|
|
93
92
|
* ships zero UI dependencies beyond `react`/`react-dom`, so this is a small
|
|
94
93
|
* hand-rolled implementation covering just what a filters sheet needs --
|
|
95
94
|
* portal, backdrop-click/Escape-to-close, a body-scroll lock, and the
|
package/dist/styled/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { d as IListingCardProps, f as IListingEmptyProps, g as IListingFilterPanelProps, h as IListingLoadingProps, i as IListingMarkerProps, j as IListingPopupProps, k as IListingResultHeaderProps, l as IListingSearchProps, m as IListingSidebarProps, a as IListingToolbarProps, e as IListingComponents } from '../
|
|
4
|
-
export { B as BottomNav,
|
|
3
|
+
import { d as IListingCardProps, f as IListingEmptyProps, g as IListingFilterPanelProps, h as IListingLoadingProps, i as IListingMarkerProps, j as IListingPopupProps, k as IListingResultHeaderProps, l as IListingSearchProps, m as IListingSidebarProps, a as IListingToolbarProps, e as IListingComponents } from '../listing-app-CkEGdUV9.js';
|
|
4
|
+
export { B as BottomNav, p as BottomNavView, q as IBottomNavAction, r as IBottomNavProps, s as IStyledListingLayoutProps, L as ListingApp, t as ListingAppMapProp, n as ListingAppProps, S as StyledListingLayout } from '../listing-app-CkEGdUV9.js';
|
|
5
5
|
import '../map-provider.interface-DT-v1plm.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -33,7 +33,7 @@ declare function StyledMarker({ point }: IListingMarkerProps): react.JSX.Element
|
|
|
33
33
|
* accessible close button. `role="group"` + `aria-label` (rather than
|
|
34
34
|
* `role="dialog"`) since this is a non-modal, non-focus-trapped popup
|
|
35
35
|
* anchored to a map marker -- `dialog` without modality/focus management
|
|
36
|
-
* would misrepresent it to AT users.
|
|
36
|
+
* would misrepresent it to AT users.
|
|
37
37
|
*/
|
|
38
38
|
declare function StyledPopup({ entity, onClose }: IListingPopupProps): react.JSX.Element;
|
|
39
39
|
|
|
@@ -56,7 +56,7 @@ declare function StyledToolbar({ children }: IListingToolbarProps): react.JSX.El
|
|
|
56
56
|
* of the box -- pair it with `import 'react-listing-engine/styles.css'`; use
|
|
57
57
|
* `ListingComponentsProvider` directly (with your own components for some or
|
|
58
58
|
* all slots) otherwise -- the two compose fine since `ListingComponentsProvider`
|
|
59
|
-
* falls back per-slot.
|
|
59
|
+
* falls back per-slot.
|
|
60
60
|
*/
|
|
61
61
|
declare function StyledComponentsProviderWithDefaults({ children }: {
|
|
62
62
|
children: ReactNode;
|
|
@@ -64,8 +64,7 @@ declare function StyledComponentsProviderWithDefaults({ children }: {
|
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* Every `/styled` default, keyed by slot -- the single source of truth for
|
|
67
|
-
* `StyledComponentsProviderWithDefaults
|
|
68
|
-
* `shadcnDefaultComponents`.
|
|
67
|
+
* `StyledComponentsProviderWithDefaults`.
|
|
69
68
|
*
|
|
70
69
|
* Kept as a plain object, not JSX, so a caller can merge it with
|
|
71
70
|
* `{ ...styledDefaultComponents, ...overrides }` and hand the result to ONE
|
|
@@ -89,7 +88,7 @@ interface IBottomSheetProps {
|
|
|
89
88
|
/**
|
|
90
89
|
* Dependency-free mobile bottom sheet -- the `/styled` adapter's own modal
|
|
91
90
|
* primitive, used by `StyledListingLayout` for the mobile filters panel.
|
|
92
|
-
* Deliberately
|
|
91
|
+
* Deliberately dependency-free (no Radix or other UI-library sheet): `/styled`
|
|
93
92
|
* ships zero UI dependencies beyond `react`/`react-dom`, so this is a small
|
|
94
93
|
* hand-rolled implementation covering just what a filters sheet needs --
|
|
95
94
|
* portal, backdrop-click/Escape-to-close, a body-scroll lock, and the
|
package/dist/styled/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{
|
|
2
|
+
import{D as r,E as p,F as i,G as d,H as y,I as l,J as n,K as m,L as s,M as a,N as t,O as S,P as f,Q as P,R as u,p as e}from"../chunk-OXSYNZAJ.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,d as StyledLoading,y as StyledMarker,l as StyledPopup,n as StyledResultHeader,m as StyledSearch,s as StyledSidebar,a as StyledToolbar,t as styledDefaultComponents};
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-listing-engine",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6",
|
|
4
4
|
"license": "MIT",
|
|
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
|
|
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": [
|
|
7
7
|
{
|
|
8
8
|
"type": "github",
|
|
@@ -26,8 +26,7 @@
|
|
|
26
26
|
"typescript",
|
|
27
27
|
"nextjs",
|
|
28
28
|
"react18",
|
|
29
|
-
"react19"
|
|
30
|
-
"shadcn"
|
|
29
|
+
"react19"
|
|
31
30
|
],
|
|
32
31
|
"author": "knazark",
|
|
33
32
|
"type": "module",
|
|
@@ -43,11 +42,6 @@
|
|
|
43
42
|
"import": "./dist/index.js",
|
|
44
43
|
"require": "./dist/index.cjs"
|
|
45
44
|
},
|
|
46
|
-
"./shadcn": {
|
|
47
|
-
"types": "./dist/shadcn/index.d.ts",
|
|
48
|
-
"import": "./dist/shadcn/index.js",
|
|
49
|
-
"require": "./dist/shadcn/index.cjs"
|
|
50
|
-
},
|
|
51
45
|
"./styled": {
|
|
52
46
|
"types": "./dist/styled/index.d.ts",
|
|
53
47
|
"import": "./dist/styled/index.js",
|
package/dist/chunk-2VUHLHHX.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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
|
-
function n(i,t){let r=new Set([...Object.keys(i),...Object.keys(t)]);for(let s of r)if(i[s]!==t[s])return!1;return!0}var e= (_class =class{__init() {this.isSyncing=!1}__init2() {this.unsubscribeEngine=null}__init3() {this.unsubscribeHistory=null}constructor(t){;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.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);n(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}}}, _class);exports.a = e;
|
package/dist/chunk-35KYEBAC.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
function n(i,t){let r=new Set([...Object.keys(i),...Object.keys(t)]);for(let s of r)if(i[s]!==t[s])return!1;return!0}var e=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);n(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}}};export{e as a};
|
package/dist/chunk-CGT3RHJ7.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{A as de,B as pe,h as X,i as Y,j,k as ee,l as te,n as re,p as ie,q as x,s as k,u as oe,v as B,w as ne,x as se,y as le,z as ae}from"./chunk-R3FX2V3N.js";import{useEffect as Fe,useRef as _e}from"react";function ce(e,t){let r=k(),i=_e(t);i.current=t,Fe(()=>r.on(e,n=>i.current(n)),[r,e])}function L(e){return typeof e!="number"?e:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(e)}import{Fragment as Ee,jsx as m,jsxs as ue}from"react/jsx-runtime";function Me(e){return e?"rle-card rle-card--selected":"rle-card"}function O({item:e,selected:t,onSelect:r}){let i=e??{},n=Me(t),s=ue(Ee,{children:[i.imageUrl?m("img",{src:i.imageUrl,alt:i.title??"",className:"rle-card-media"}):m("div",{className:"rle-card-media rle-card-media--placeholder","aria-hidden":"true"}),ue("div",{className:"rle-card-body",children:[i.title&&m("span",{className:"rle-card-title",children:i.title}),i.subtitle&&m("span",{className:"rle-card-address",children:i.subtitle}),i.badge&&m("div",{className:"rle-card-info",children:m("span",{className:"rle-card-info-item",children:i.badge})}),i.price!=null&&m("span",{className:"rle-card-price",children:L(i.price)})]})]});return r?m("button",{type:"button",onClick:r,"aria-pressed":t??!1,className:n,children:s}):m("article",{className:n,children:s})}import{jsx as I,jsxs as me}from"react/jsx-runtime";function H(e){return me("div",{role:"status",className:"rle-empty",children:[me("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:[I("circle",{cx:"11",cy:"11",r:"7"}),I("path",{d:"m21 21-4.3-4.3"})]}),I("p",{className:"rle-empty-title",children:"No results"}),I("p",{className:"rle-empty-hint",children:"Try adjusting your filters or search terms."})]})}import{jsx as Re}from"react/jsx-runtime";function V({children:e}){return Re("div",{className:"rle-filter-panel",children:e})}import{jsx as F,jsxs as Te}from"react/jsx-runtime";function D(e){return F("div",{className:"rle-loading",role:"status","aria-busy":"true","aria-label":"Loading results",children:Array.from({length:3}).map((t,r)=>Te("div",{className:"rle-loading-item",children:[F("div",{className:"rle-skeleton",style:{aspectRatio:"4 / 3",width:"100%"}}),F("div",{className:"rle-skeleton",style:{height:16,width:"65%"}}),F("div",{className:"rle-skeleton",style:{height:12,width:"35%"}})]},r))})}import{jsx as Ae}from"react/jsx-runtime";function K({point:e}){let t=e.entity??{};return Ae("span",{className:"rle-pin",children:t.price!=null?L(t.price):""})}import{jsx as N,jsxs as W}from"react/jsx-runtime";function $({entity:e,onClose:t}){let r=e??{};return W("div",{className:"rle-popup",role:"group","aria-label":"Location details",children:[N("button",{type:"button",onClick:t,"aria-label":"Close",className:"rle-popup-close",children:W("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:[N("path",{d:"M18 6 6 18"}),N("path",{d:"m6 6 12 12"})]})}),W("div",{children:[r.title&&N("div",{className:"rle-card-title",children:r.title}),r.subtitle&&N("div",{className:"rle-card-address",children:r.subtitle}),r.price!=null&&N("div",{className:"rle-card-price",children:L(r.price)})]})]})}import{jsx as Be}from"react/jsx-runtime";function z({count:e,total:t}){let r=t!=null&&t!==e?`${e} of ${t} results`:`${e} results`;return Be("div",{className:"rle-result-header",children:r})}import{jsx as Oe}from"react/jsx-runtime";function U({value:e,onChange:t,placeholder:r}){return Oe("input",{type:"search",value:e,placeholder:r,onChange:i=>t(i.target.value),"aria-label":r??"Search",className:"rle-input"})}import{jsx as He}from"react/jsx-runtime";function Z({children:e}){return He("aside",{className:"rle-sidebar",children:e})}import{jsx as Ve}from"react/jsx-runtime";function q({children:e}){return Ve("div",{className:"rle-toolbar",children:e})}var fe={Card:O,Marker:K,Popup:$,Sidebar:Z,FilterPanel:V,Search:U,Empty:H,Loading:D,ResultHeader:z,Toolbar:q};import{jsx as o,jsxs as h}from"react/jsx-runtime";function ve({view:e,onViewChange:t}){return o("nav",{className:"rle-bottom-nav","aria-label":"Listing navigation",children:h("div",{className:"rle-viewtoggle",role:"group","aria-label":"View",children:[h("button",{type:"button",className:`rle-viewtoggle__btn${e==="list"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":e==="list",onClick:()=>t("list"),children:[o(De,{}),"List"]}),h("button",{type:"button",className:`rle-viewtoggle__btn${e==="map"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":e==="map",onClick:()=>t("map"),children:[o(Ke,{}),"Map"]})]})})}function ge(){return h("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:[o("line",{x1:"4",y1:"6",x2:"20",y2:"6"}),o("circle",{cx:"9",cy:"6",r:"2",fill:"currentColor",stroke:"none"}),o("line",{x1:"4",y1:"12",x2:"20",y2:"12"}),o("circle",{cx:"15",cy:"12",r:"2",fill:"currentColor",stroke:"none"}),o("line",{x1:"4",y1:"18",x2:"20",y2:"18"}),o("circle",{cx:"11",cy:"18",r:"2",fill:"currentColor",stroke:"none"})]})}function De(){return h("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("line",{x1:"8",y1:"6",x2:"20",y2:"6"}),o("line",{x1:"8",y1:"12",x2:"20",y2:"12"}),o("line",{x1:"8",y1:"18",x2:"20",y2:"18"}),o("line",{x1:"4",y1:"6",x2:"4.01",y2:"6"}),o("line",{x1:"4",y1:"12",x2:"4.01",y2:"12"}),o("line",{x1:"4",y1:"18",x2:"4.01",y2:"18"})]})}function Ke(){return h("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("polygon",{points:"1 6 8 3 16 6 23 3 23 18 16 21 8 18 1 21 1 6"}),o("line",{x1:"8",y1:"3",x2:"8",y2:"18"}),o("line",{x1:"16",y1:"6",x2:"16",y2:"21"})]})}function ye(){return h("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:[o("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),o("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}import{useEffect as G,useRef as We,useState as he}from"react";import{createPortal as $e}from"react-dom";import{Fragment as Ue,jsx as f,jsxs as _}from"react/jsx-runtime";function be({open:e,onOpenChange:t,title:r,children:i,footer:n}){let s=We(null),[l,c]=he(!1),[d,v]=he(!1);return G(()=>{if(!e){v(!1),c(!1);return}c(!0);let p=requestAnimationFrame(()=>v(!0));return()=>cancelAnimationFrame(p)},[e]),G(()=>{if(!l)return;let p=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=p}},[l]),G(()=>{if(!l)return;s.current?.focus();function p(g){g.key==="Escape"&&t(!1)}return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[l,t]),!l||typeof document>"u"?null:$e(_(Ue,{children:[f("div",{className:`rle-sheet-backdrop${d?" rle-sheet-backdrop--open":""}`,onClick:()=>t(!1),"aria-hidden":"true"}),_("div",{ref:s,className:`rle-sheet${d?" rle-sheet--open":""}`,role:"dialog","aria-modal":"true","aria-label":r,tabIndex:-1,children:[f("div",{className:"rle-sheet__handle","aria-hidden":"true"}),_("div",{className:"rle-sheet__header",children:[r&&f("div",{className:"rle-sheet__title",children:r}),f("button",{type:"button",className:"rle-sheet__close",onClick:()=>t(!1),"aria-label":"Close",children:f(ze,{})})]}),f("div",{className:"rle-sheet__body",children:i}),n&&f("div",{className:"rle-sheet__footer",children:n})]})]}),document.body)}function ze(){return _("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("path",{d:"M18 6 6 18"}),f("path",{d:"m6 6 12 12"})]})}import{useEffect as Se,useRef as Ze,useState as M}from"react";import{jsx as b,jsxs as Le}from"react/jsx-runtime";function Ne({search:e,onFiltersClick:t,filterCount:r=0,action:i}){let{Search:n}=x();return Le("header",{className:"rle-mobile-header",children:[e&&b("div",{className:"rle-mobile-header__search",children:b(n,{value:e.value,onChange:e.onChange,placeholder:e.placeholder})}),Le("button",{type:"button",className:"rle-mobile-header__btn",onClick:t,children:[b(ge,{}),b("span",{children:"Filters"}),r>0&&b("span",{className:"rle-mobile-header__count",children:r})]}),i&&b("button",{type:"button",className:"rle-mobile-header__btn rle-mobile-header__btn--icon",onClick:i.onClick,"aria-label":i.label,children:i.icon??b(ye,{})})]})}import{Fragment as Je,jsx as a,jsxs as y}from"react/jsx-runtime";var qe=a("div",{className:"rle-empty",children:"Map unavailable"});function Ge(){let e=Ze(null),[t,r]=M(!0),[i,n]=M(!0);return Se(()=>{let s=e.current;if(!s)return;let l=()=>{let{clientWidth:v,scrollLeft:p,scrollWidth:g}=s;r(p<=0),n(p+v>=g-1)};l(),s.addEventListener("scroll",l,{passive:!0});let c,d;return typeof ResizeObserver<"u"&&(c=new ResizeObserver(l),c.observe(s)),typeof MutationObserver<"u"&&(d=new MutationObserver(l),d.observe(s,{characterData:!0,childList:!0,subtree:!0})),()=>{s.removeEventListener("scroll",l),c?.disconnect(),d?.disconnect()}},[]),{atEnd:i,atStart:t,ref:e}}function we({search:e,toolbarEnd:t,mobileAction:r,autoFetch:i=!0,hasMap:n=!0,mapCenter:s,mapZoom:l,className:c}){let d=k(),{Search:v}=x(),p=ne(),{filters:g}=oe(),[P,E]=M("list"),[C,u]=M(!1),{atEnd:R,atStart:T,ref:A}=Ge(),S=e?{value:String(g[e.filterKey]??""),onChange:w=>{d.applyFilters({[e.filterKey]:w||void 0})},placeholder:e.placeholder}:void 0;Se(()=>{i!==!1&&d.applyFilters({})},[d,i]);let Ce=()=>{let w=d.filters.list().reduce((Ie,Q)=>Object.assign(Ie,Q.toParams(Q.fromParams({}))),{});d.applyFilters(w)},xe=d.filters.list().filter(w=>w.isActive?.(g)).length,ke=p.total??p.items.length;return y("div",{className:c?`rle-app ${c}`:"rle-app",children:[y("div",{className:"rle-filter-bar",children:[y("div",{className:"rle-filter-bar__scroll",ref:A,children:[S&&a("div",{className:"rle-filter-bar__search",children:a(v,{value:S.value,onChange:S.onChange,placeholder:S.placeholder})}),a(B,{className:"rle-filters-row",groupClassName:"rle-filter-group",hideLabels:!0})]}),!T&&a("div",{className:"rle-filter-bar__fade rle-filter-bar__fade--start","aria-hidden":"true"}),!R&&a("div",{className:"rle-filter-bar__fade rle-filter-bar__fade--end","aria-hidden":"true"})]}),a(Ne,{search:S,onFiltersClick:()=>u(!0),filterCount:xe,action:r}),y("div",{className:`rle-body ${n?"rle-split":"rle-body--list-only"}`,"data-mobile-view":P,children:[y("div",{className:"rle-list",children:[y("div",{className:"rle-list-header",children:[a(de,{}),t&&a("div",{className:"rle-list-header__toolbar",children:t})]}),a(se,{className:"rle-list-grid"}),a(ae,{})]}),n&&a("div",{className:"rle-map",children:a(le,{center:s,zoom:l,fallback:qe})})]}),n&&a(ve,{view:P,onViewChange:E}),a(be,{title:"Filters",open:C,onOpenChange:u,footer:y(Je,{children:[a("button",{type:"button",className:"rle-btn rle-btn--ghost",onClick:Ce,children:"Clear all"}),y("button",{type:"button",className:"rle-btn rle-btn--primary",onClick:()=>u(!1),children:["Show ",ke," results"]})]}),children:a(B,{className:"rle-filter-stack",groupClassName:"rle-filter-group"})})]})}import{useEffect as Qe,useRef as Xe,useState as Ye}from"react";import{jsx as J,jsxs as tt}from"react/jsx-runtime";function Pe(e){return"provider"in e}function je(e){let t=e!=null&&!Pe(e),r=t?e.apiKey:void 0,i=t?e.mapId:void 0,[n,s]=Ye(()=>!e||Pe(e)?{ready:!0,provider:e?.provider}:{ready:!1});return Qe(()=>{if(!r)return;let l=!1;return import("./maps/google/index.js").then(({googleProvider:c})=>{l||s({ready:!0,provider:c({apiKey:r,mapId:i})})}),()=>{l=!0}},[r,i]),n}function et({onFiltersChange:e}){let t=Xe(e);return t.current=e,ce("FiltersChanged",r=>{r.type==="FiltersChanged"&&t.current(r.filters)}),null}function pr(e){let{datasets:t,filters:r,map:i,components:n,initialFilters:s,onFiltersChange:l,mobileAction:c,search:d,toolbarEnd:v,config:p,autoFetch:g,className:P}=e,{ready:E,provider:C}=je(i);if(!E)return null;let u=[];for(let A of t)u.push(ee(A));r&&u.push(te(r)),C&&u.push(j(C)),s&&u.push(re(s)),p&&u.push(Y(p));let R=X(...u),T={...fe,...n};return tt(pe,{...R,children:[l&&J(et,{onFiltersChange:l}),J(ie,{...T,children:J(we,{className:P,search:d,toolbarEnd:v,mobileAction:c,autoFetch:g,hasMap:i!=null,mapCenter:i?.center,mapZoom:i?.zoom})})]})}export{ce as a,O as b,H as c,V as d,D as e,K as f,$ as g,z as h,U as i,Z as j,q as k,fe as l,ve as m,be as n,we as o,pr as p};
|
package/dist/chunk-EYXV5OMY.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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; var _class3; var _class4; var _class5;"use client";
|
|
2
|
-
var S= (_class =class{__init() {this.listeners=new Set}constructor(t){;_class.prototype.__init.call(this);this.state=this.freezeState({filters:{...t.filters},results:{items:[],nextCursor:null},bounds:null,selection:null,pagination:{mode:_nullishCoalesce(t.mode, () => ("paged")),loading:!1},layers:{},points:{}})}getState(){return this.state}setFilters(t){this.setState({filters:{...this.state.filters,...t}})}setResults(t){this.setState({results:{items:[...t.items],nextCursor:t.nextCursor,total:t.total}})}appendResults(t){this.setState({results:{items:[...this.state.results.items,...t.items],nextCursor:t.nextCursor,total:t.total}})}setBounds(t){this.setState({bounds:t?{...t}:null})}setSelection(t){this.setState({selection:t})}setLayerVisible(t,e){this.setState({layers:{...this.state.layers,[t]:e}})}setLoading(t){this.setState({pagination:{...this.state.pagination,loading:t}})}setPoints(t,e){this.setState({points:{...this.state.points,[t]:[...e]}})}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}setState(t){this.state=this.freezeState({...this.state,...t}),this.notify()}notify(){for(let t of this.listeners)t()}freezeState(t){Object.freeze(t.filters),Object.freeze(t.results.items),Object.freeze(t.results),t.bounds&&Object.freeze(t.bounds),Object.freeze(t.pagination),Object.freeze(t.layers);for(let e of Object.values(t.points))Object.freeze(e);return Object.freeze(t.points),Object.freeze(t)}}, _class);var P= (_class2 =class{constructor() { _class2.prototype.__init2.call(this); }__init2() {this.defs=new Map}add(t){if(this.defs.has(t.key))throw new Error(`FilterRegistry: filter "${t.key}" is already registered`);return this.defs.set(t.key,{...t}),this}remove(t){return this.defs.delete(t),this}replace(t,e){if(!this.defs.has(t))throw new Error(`FilterRegistry: cannot replace unregistered filter "${t}"`);return this.defs.set(t,{...e,key:t}),this}reorder(t){let e=this.list(),n=t.filter(r=>this.defs.has(r));n.forEach((r,o)=>{this.defs.get(r).order=o});let s=new Set(n);return e.filter(r=>!s.has(r.key)).forEach((r,o)=>{r.order=n.length+o}),this}list(){return[...this.defs.values()].sort((t,e)=>t.order-e.order)}has(t){return this.defs.has(t)}toFilters(t){return this.list().filter(n=>Object.hasOwn(t,n.key)).map(n=>n.toParams(t[n.key])).reduce((n,s)=>({...n,...s}),{})}activeKeys(t){return this.list().filter(e=>_optionalChain([e, 'access', _2 => _2.isActive, 'optionalCall', _3 => _3(t)])).map(e=>e.key)}}, _class2);var w= (_class3 =class{constructor() { _class3.prototype.__init3.call(this); }__init3() {this.defs=new Map}add(t){if(this.defs.has(t.id))throw new Error(`DatasetRegistry: dataset "${t.id}" is already registered`);return this.defs.set(t.id,{...t}),this}get(t){return this.defs.get(t)}has(t){return this.defs.has(t)}list(){return[...this.defs.values()]}visibleIds(){return this.list().filter(t=>_optionalChain([t, 'access', _4 => _4.visible, 'optionalCall', _5 => _5()])!==!1).map(t=>t.id)}}, _class3);var R= (_class4 =class{constructor() { _class4.prototype.__init4.call(this); }__init4() {this.map=new Map}dispose(){this.map.clear()}emit(t){let e=this.map.get(t.type);if(e)for(let s of[...e])s(t);let n=this.map.get("*");if(n)for(let s of[...n])s(t)}on(t,e){let n=this.map.get(t);return n||(n=new Set,this.map.set(t,n)),n.add(e),()=>{n.delete(e)}}}, _class4);var B={pagination:"paged",pageSize:20,debounceMs:250};var x=class{constructor(t){this.options=Object.freeze({...B,...t})}};var D= (_class5 =class{__init5() {this.emitter=new R}__init6() {this.debounceTimer=null}__init7() {this.debounceResolve=null}__init8() {this.queryToken=0}__init9() {this.pointsToken=0}constructor(t){;_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);this.datasets=t.datasets,this.filters=_nullishCoalesce(t.filters, () => (new P)),this.map=t.map,this.config=new x(t.config);let e=_nullishCoalesce(t.primaryDatasetId, () => (_optionalChain([this, 'access', _6 => _6.datasets, 'access', _7 => _7.list, 'call', _8 => _8(), 'access', _9 => _9[0], 'optionalAccess', _10 => _10.id])));if(e==null||!this.datasets.has(e))throw new Error(`ListingEngine: primary dataset "${_nullishCoalesce(e, () => (""))}" is not registered \u2014 pass a valid primaryDatasetId or register at least one dataset`);this.primaryDatasetId=e,this.store=new S({filters:_nullishCoalesce(t.initialFilters, () => ({})),mode:this.config.options.pagination})}get state(){return this.store.getState()}get options(){return this.config.options}applyFilters(t){this.store.setFilters(t),this.emitter.emit({type:"FiltersChanged",filters:this.currentFilters()}),this.clearDebounce();let e=++this.queryToken,n=this.config.options.debounceMs;return n<=0?this.runQuery(e):new Promise(s=>{this.debounceResolve=s,this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.debounceResolve=null,s(this.runQuery(e))},n)})}async loadPage(){let t=this.state.results.nextCursor;if(t===null)return;let e=++this.queryToken,n=this.primaryDataset();this.store.setLoading(!0);try{let s=await n.adapter.list(this.currentFilters(),{cursor:t,limit:this.config.options.pageSize});if(e!==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{e===this.queryToken&&this.store.setLoading(!1)}}async loadPoints(t){this.store.setBounds(t),this.emitter.emit({type:"BoundsChanged",bounds:t});let e=this.currentFilters(),n=++this.pointsToken;await Promise.allSettled(this.datasets.visibleIds().map(async s=>{let r=this.datasets.get(s);if(!r)return;let o=await r.adapter.getPoints(e,t);n===this.pointsToken&&this.store.setPoints(s,o)}))}selectPoint(t,e){this.store.setSelection(e);let n=_optionalChain([this, 'access', _11 => _11.state, 'access', _12 => _12.points, 'access', _13 => _13[t], 'optionalAccess', _14 => _14.find, 'call', _15 => _15(s=>s.id===e)]);n&&this.emitter.emit({type:"PointClicked",datasetId:t,id:e,entity:n.entity})}toggleLayer(t){let n=!(_nullishCoalesce(this.state.layers[t], () => (!0)));this.store.setLayerVisible(t,n),this.emitter.emit({type:"LayerToggled",datasetId:t,visible:n})}subscribe(t){return this.store.subscribe(t)}on(t,e){return this.emitter.on(t,e)}dispose(){this.clearDebounce(),this.emitter.dispose()}async runQuery(t){if(t!==this.queryToken)return;let e=this.primaryDataset();this.store.setLoading(!0);try{let n=await e.adapter.list(this.currentFilters(),{cursor:null,limit:this.config.options.pageSize});if(t!==this.queryToken)return;this.store.setResults(n),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.items.length})}finally{t===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 Mt(...i){let t={config:{},filters:new P,datasets:new w};for(let e of i)e(t);return t}var Ot=i=>t=>{t.config={...t.config,...i}},Nt= exports.j =i=>t=>{t.map=i},zt= exports.k =i=>t=>{t.datasets.add(i)},Bt= exports.l =i=>t=>{i(t.filters)},Ut= exports.m =i=>t=>{t.urlSync=i},Ht= exports.n =i=>t=>{t.initialFilters=i},jt= exports.o =i=>t=>{t.primaryDatasetId=i};var _react = require('react');var _jsxruntime = require('react/jsx-runtime');function G(i){return String(_nullishCoalesce(_optionalChain([i, 'optionalAccess', _16 => _16.title]), () => ("")))}var W=({item:i})=>_jsxruntime.jsx.call(void 0, "div",{children:G(i)}),X=()=>_jsxruntime.jsx.call(void 0, "div",{}),J=()=>_jsxruntime.jsx.call(void 0, "div",{}),Y=({children:i})=>_jsxruntime.jsx.call(void 0, "div",{children:i}),Z=({children:i})=>_jsxruntime.jsx.call(void 0, "div",{children:i}),tt=({value:i,onChange:t,placeholder:e})=>_jsxruntime.jsx.call(void 0, "input",{type:"search",value:i,placeholder:e,onChange:n=>t(n.target.value),"aria-label":_nullishCoalesce(e, () => ("Search"))}),et=()=>_jsxruntime.jsx.call(void 0, "div",{role:"status",children:"No results"}),it=()=>_jsxruntime.jsx.call(void 0, "div",{role:"status","aria-busy":"true",children:"Loading\u2026"}),nt=({count:i})=>_jsxruntime.jsxs.call(void 0, "div",{children:[i," results"]}),st=({children:i})=>_jsxruntime.jsx.call(void 0, "div",{children:i}),c={Card:W,Marker:X,Popup:J,Sidebar:Y,FilterPanel:Z,Search:tt,Empty:et,Loading:it,ResultHeader:nt,Toolbar:st},U=_react.createContext.call(void 0, c);function Vt(i){let{Card:t,Marker:e,Popup:n,Sidebar:s,FilterPanel:r,Search:o,Empty:a,Loading:l,ResultHeader:L,Toolbar:y,children:k}=i,b={Card:_nullishCoalesce(t, () => (c.Card)),Marker:_nullishCoalesce(e, () => (c.Marker)),Popup:_nullishCoalesce(n, () => (c.Popup)),Sidebar:_nullishCoalesce(s, () => (c.Sidebar)),FilterPanel:_nullishCoalesce(r, () => (c.FilterPanel)),Search:_nullishCoalesce(o, () => (c.Search)),Empty:_nullishCoalesce(a, () => (c.Empty)),Loading:_nullishCoalesce(l, () => (c.Loading)),ResultHeader:_nullishCoalesce(L, () => (c.ResultHeader)),Toolbar:_nullishCoalesce(y, () => (c.Toolbar))};return _jsxruntime.jsx.call(void 0, U.Provider,{value:b,children:k})}function v(){return _react.useContext.call(void 0, U)}var M=_react.createContext.call(void 0, null);function d(){let i=_react.useContext.call(void 0, M);if(i===null)throw new Error("useListing must be used within a <ListingProvider>");return i}function m(){let i=d(),t=_react.useCallback.call(void 0, n=>i.subscribe(n),[i]),e=_react.useCallback.call(void 0, ()=>i.state,[i]);return _react.useSyncExternalStore.call(void 0, t,e,e)}function q(){let i=d(),t=m(),e=_react.useCallback.call(void 0, s=>i.applyFilters(s),[i]),n=_react.useCallback.call(void 0, (s,r)=>i.applyFilters({[s]:r}),[i]);return{filters:t.filters,set:e,setField:n}}function ae({className:i,groupClassName:t,hideLabels:e}={}){let n=d(),{FilterPanel:s}=v(),{filters:r}=q();return _jsxruntime.jsx.call(void 0, s,{children:_jsxruntime.jsx.call(void 0, "div",{className:_nullishCoalesce(i, () => ("space-y-5")),children:n.filters.list().map(o=>{if(typeof o.render=="string")return _jsxruntime.jsx.call(void 0, "div",{"data-filter":o.key,className:t},o.key);let a=o.render;return _jsxruntime.jsxs.call(void 0, "div",{className:t,children:[o.label&&!e&&_jsxruntime.jsx.call(void 0, "div",{className:"mb-1.5 text-[13px] font-medium text-foreground",children:o.label}),_jsxruntime.jsx.call(void 0, a,{value:o.fromParams(r),onChange:l=>{n.applyFilters(o.toParams(l))}})]},o.key)})})})}function O(){return m().results}function ut(i,t){if(i&&typeof i=="object"&&"id"in i){let e=i.id;if(typeof e=="string"||typeof e=="number")return e}return t}function ye({className:i}={}){let t=d(),{items:e}=O(),{pagination:n,selection:s}=m(),{Card:r,Empty:o,Loading:a}=v();return n.loading&&e.length===0?_jsxruntime.jsx.call(void 0, a,{}):e.length===0?_jsxruntime.jsx.call(void 0, o,{}):_jsxruntime.jsx.call(void 0, "div",{role:"list",className:i,children:e.map((l,L)=>{let y=ut(l,L);return _jsxruntime.jsx.call(void 0, r,{item:l,selected:s===y,onSelect:()=>t.selectPoint(t.primaryDatasetId,y)},y)})})}var ct={west:-179.9,south:-85,east:179.9,north:85},A=.1,V=.02;function gt(i){if(i.length===0)return null;let t=i[0].lng,e=i[0].lng,n=i[0].lat,s=i[0].lat;for(let{lat:a,lng:l}of i)l<t&&(t=l),l>e&&(e=l),a<n&&(n=a),a>s&&(s=a);let r=s>n?(s-n)*A:V,o=e>t?(e-t)*A:V;return{west:t-o,east:e+o,south:n-r,north:s+r}}function ve(i){let{center:t,zoom:e,fallback:n}=i,s=d(),r=m(),o=_react.useRef.call(void 0, null),a=_react.useRef.call(void 0, null),[l,L]=_react.useState.call(void 0, !1),y=_react.useRef.call(void 0, !1),k=_react.useRef.call(void 0, !1),b=_react.useRef.call(void 0, !1),p=s.map;return _react.useEffect.call(void 0, ()=>{let T=a.current;if(!p||!T)return;let h=[];for(let u of Object.keys(r.points)){if(r.layers[u]===!1)continue;let g=s.datasets.get(u),E=_nullishCoalesce(r.points[u], () => ([])),_={id:u,markers:E.map(F=>({id:F.id,position:F.position,iconUrl:_optionalChain([g, 'optionalAccess', _17 => _17.marker, 'access', _18 => _18.iconUrl, 'optionalCall', _19 => _19(F.entity)]),element:_optionalChain([g, 'optionalAccess', _20 => _20.marker, 'access', _21 => _21.element, 'optionalCall', _22 => _22(F.entity)])})),clustering:_optionalChain([g, 'optionalAccess', _23 => _23.clustering]),onMarkerClick:F=>s.selectPoint(u,F)};h.push(p.renderLayer(T,_))}return()=>{h.forEach(u=>u())}},[s,p,l,r.points,r.layers]),_react.useEffect.call(void 0, ()=>{if(!o.current||!p)return;let T=o.current,h=!1,u=null;return(async()=>{let g=await p.mount(T,{center:t,zoom:e});if(h){p.destroy(g);return}a.current=g,u=p.onBoundsChange(g,E=>{b.current?b.current=!1:k.current=!0,s.loadPoints(E)}),L(!0),s.loadPoints(ct)})(),()=>{h=!0,_optionalChain([u, 'optionalCall', _24 => _24()]),a.current&&(p.destroy(a.current),a.current=null),L(!1)}},[s,p]),_react.useEffect.call(void 0, ()=>{let T=a.current;if(!p||!T||t||y.current||k.current)return;let h=[];for(let g of Object.keys(r.points))if(r.layers[g]!==!1)for(let E of _nullishCoalesce(r.points[g], () => ([])))h.push(E.position);let u=gt(h);u&&(y.current=!0,b.current=!0,p.fitBounds(T,u))},[p,t,l,r.points,r.layers]),_jsxruntime.jsx.call(void 0, "div",{ref:o,className:!p&&n?"flex h-full min-h-0 w-full items-center justify-center":"h-full min-h-0 w-full",children:!p&&n})}function ke(){let i=d(),{results:t,pagination:e}=m();return t.nextCursor==null?null:_jsxruntime.jsx.call(void 0, "button",{type:"button",disabled:e.loading,onClick:()=>{i.loadPage()},children:"Load more"})}function De(){let{items:i,total:t}=O(),{ResultHeader:e}=v();return _jsxruntime.jsx.call(void 0, e,{count:i.length,total:t})}function Ue(i){let{children:t,...e}=i,[n]=_react.useState.call(void 0, ()=>e),[s,r]=_react.useState.call(void 0, null);return _react.useEffect.call(void 0, ()=>{let o=new D({datasets:n.datasets,filters:n.filters,config:n.config,map:n.map,initialFilters:n.initialFilters,primaryDatasetId:n.primaryDatasetId});return n.urlSync&&n.urlSync.start(o),r(o),()=>{n.urlSync&&n.urlSync.stop(),o.dispose(),r(a=>a===o?null:a)}},[n]),s?_jsxruntime.jsx.call(void 0, M.Provider,{value:s,children:t}):null}exports.a = S; exports.b = P; exports.c = w; exports.d = R; exports.e = B; exports.f = x; exports.g = D; exports.h = Mt; exports.i = Ot; exports.j = Nt; exports.k = zt; exports.l = Bt; exports.m = Ut; exports.n = Ht; exports.o = jt; exports.p = Vt; exports.q = v; exports.r = M; exports.s = d; exports.t = m; exports.u = q; exports.v = ae; exports.w = O; exports.x = ye; exports.y = ve; exports.z = ke; exports.A = De; exports.B = Ue;
|
package/dist/chunk-R3FX2V3N.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
var S=class{state;listeners=new Set;constructor(t){this.state=this.freezeState({filters:{...t.filters},results:{items:[],nextCursor:null},bounds:null,selection:null,pagination:{mode:t.mode??"paged",loading:!1},layers:{},points:{}})}getState(){return this.state}setFilters(t){this.setState({filters:{...this.state.filters,...t}})}setResults(t){this.setState({results:{items:[...t.items],nextCursor:t.nextCursor,total:t.total}})}appendResults(t){this.setState({results:{items:[...this.state.results.items,...t.items],nextCursor:t.nextCursor,total:t.total}})}setBounds(t){this.setState({bounds:t?{...t}:null})}setSelection(t){this.setState({selection:t})}setLayerVisible(t,e){this.setState({layers:{...this.state.layers,[t]:e}})}setLoading(t){this.setState({pagination:{...this.state.pagination,loading:t}})}setPoints(t,e){this.setState({points:{...this.state.points,[t]:[...e]}})}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}setState(t){this.state=this.freezeState({...this.state,...t}),this.notify()}notify(){for(let t of this.listeners)t()}freezeState(t){Object.freeze(t.filters),Object.freeze(t.results.items),Object.freeze(t.results),t.bounds&&Object.freeze(t.bounds),Object.freeze(t.pagination),Object.freeze(t.layers);for(let e of Object.values(t.points))Object.freeze(e);return Object.freeze(t.points),Object.freeze(t)}};var P=class{defs=new Map;add(t){if(this.defs.has(t.key))throw new Error(`FilterRegistry: filter "${t.key}" is already registered`);return this.defs.set(t.key,{...t}),this}remove(t){return this.defs.delete(t),this}replace(t,e){if(!this.defs.has(t))throw new Error(`FilterRegistry: cannot replace unregistered filter "${t}"`);return this.defs.set(t,{...e,key:t}),this}reorder(t){let e=this.list(),n=t.filter(r=>this.defs.has(r));n.forEach((r,o)=>{this.defs.get(r).order=o});let s=new Set(n);return e.filter(r=>!s.has(r.key)).forEach((r,o)=>{r.order=n.length+o}),this}list(){return[...this.defs.values()].sort((t,e)=>t.order-e.order)}has(t){return this.defs.has(t)}toFilters(t){return this.list().filter(n=>Object.hasOwn(t,n.key)).map(n=>n.toParams(t[n.key])).reduce((n,s)=>({...n,...s}),{})}activeKeys(t){return this.list().filter(e=>e.isActive?.(t)).map(e=>e.key)}};var w=class{defs=new Map;add(t){if(this.defs.has(t.id))throw new Error(`DatasetRegistry: dataset "${t.id}" is already registered`);return this.defs.set(t.id,{...t}),this}get(t){return this.defs.get(t)}has(t){return this.defs.has(t)}list(){return[...this.defs.values()]}visibleIds(){return this.list().filter(t=>t.visible?.()!==!1).map(t=>t.id)}};var R=class{map=new Map;dispose(){this.map.clear()}emit(t){let e=this.map.get(t.type);if(e)for(let s of[...e])s(t);let n=this.map.get("*");if(n)for(let s of[...n])s(t)}on(t,e){let n=this.map.get(t);return n||(n=new Set,this.map.set(t,n)),n.add(e),()=>{n.delete(e)}}};var B={pagination:"paged",pageSize:20,debounceMs:250};var x=class{options;constructor(t){this.options=Object.freeze({...B,...t})}};var D=class{filters;map;datasets;primaryDatasetId;store;emitter=new R;config;debounceTimer=null;debounceResolve=null;queryToken=0;pointsToken=0;constructor(t){this.datasets=t.datasets,this.filters=t.filters??new P,this.map=t.map,this.config=new x(t.config);let e=t.primaryDatasetId??this.datasets.list()[0]?.id;if(e==null||!this.datasets.has(e))throw new Error(`ListingEngine: primary dataset "${e??""}" is not registered \u2014 pass a valid primaryDatasetId or register at least one dataset`);this.primaryDatasetId=e,this.store=new S({filters:t.initialFilters??{},mode:this.config.options.pagination})}get state(){return this.store.getState()}get options(){return this.config.options}applyFilters(t){this.store.setFilters(t),this.emitter.emit({type:"FiltersChanged",filters:this.currentFilters()}),this.clearDebounce();let e=++this.queryToken,n=this.config.options.debounceMs;return n<=0?this.runQuery(e):new Promise(s=>{this.debounceResolve=s,this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.debounceResolve=null,s(this.runQuery(e))},n)})}async loadPage(){let t=this.state.results.nextCursor;if(t===null)return;let e=++this.queryToken,n=this.primaryDataset();this.store.setLoading(!0);try{let s=await n.adapter.list(this.currentFilters(),{cursor:t,limit:this.config.options.pageSize});if(e!==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{e===this.queryToken&&this.store.setLoading(!1)}}async loadPoints(t){this.store.setBounds(t),this.emitter.emit({type:"BoundsChanged",bounds:t});let e=this.currentFilters(),n=++this.pointsToken;await Promise.allSettled(this.datasets.visibleIds().map(async s=>{let r=this.datasets.get(s);if(!r)return;let o=await r.adapter.getPoints(e,t);n===this.pointsToken&&this.store.setPoints(s,o)}))}selectPoint(t,e){this.store.setSelection(e);let n=this.state.points[t]?.find(s=>s.id===e);n&&this.emitter.emit({type:"PointClicked",datasetId:t,id:e,entity:n.entity})}toggleLayer(t){let n=!(this.state.layers[t]??!0);this.store.setLayerVisible(t,n),this.emitter.emit({type:"LayerToggled",datasetId:t,visible:n})}subscribe(t){return this.store.subscribe(t)}on(t,e){return this.emitter.on(t,e)}dispose(){this.clearDebounce(),this.emitter.dispose()}async runQuery(t){if(t!==this.queryToken)return;let e=this.primaryDataset();this.store.setLoading(!0);try{let n=await e.adapter.list(this.currentFilters(),{cursor:null,limit:this.config.options.pageSize});if(t!==this.queryToken)return;this.store.setResults(n),this.emitter.emit({type:"ResultsLoaded",datasetId:this.primaryDatasetId,count:n.items.length})}finally{t===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 Mt(...i){let t={config:{},filters:new P,datasets:new w};for(let e of i)e(t);return t}var Ot=i=>t=>{t.config={...t.config,...i}},Nt=i=>t=>{t.map=i},zt=i=>t=>{t.datasets.add(i)},Bt=i=>t=>{i(t.filters)},Ut=i=>t=>{t.urlSync=i},Ht=i=>t=>{t.initialFilters=i},jt=i=>t=>{t.primaryDatasetId=i};import{createContext as $,useContext as Q}from"react";import{jsx as f,jsxs as rt}from"react/jsx-runtime";function G(i){return String(i?.title??"")}var W=({item:i})=>f("div",{children:G(i)}),X=()=>f("div",{}),J=()=>f("div",{}),Y=({children:i})=>f("div",{children:i}),Z=({children:i})=>f("div",{children:i}),tt=({value:i,onChange:t,placeholder:e})=>f("input",{type:"search",value:i,placeholder:e,onChange:n=>t(n.target.value),"aria-label":e??"Search"}),et=()=>f("div",{role:"status",children:"No results"}),it=()=>f("div",{role:"status","aria-busy":"true",children:"Loading\u2026"}),nt=({count:i})=>rt("div",{children:[i," results"]}),st=({children:i})=>f("div",{children:i}),c={Card:W,Marker:X,Popup:J,Sidebar:Y,FilterPanel:Z,Search:tt,Empty:et,Loading:it,ResultHeader:nt,Toolbar:st},U=$(c);function Vt(i){let{Card:t,Marker:e,Popup:n,Sidebar:s,FilterPanel:r,Search:o,Empty:a,Loading:l,ResultHeader:L,Toolbar:y,children:k}=i,b={Card:t??c.Card,Marker:e??c.Marker,Popup:n??c.Popup,Sidebar:s??c.Sidebar,FilterPanel:r??c.FilterPanel,Search:o??c.Search,Empty:a??c.Empty,Loading:l??c.Loading,ResultHeader:L??c.ResultHeader,Toolbar:y??c.Toolbar};return f(U.Provider,{value:b,children:k})}function v(){return Q(U)}import{createContext as ot}from"react";var M=ot(null);import{useContext as at}from"react";function d(){let i=at(M);if(i===null)throw new Error("useListing must be used within a <ListingProvider>");return i}import{useCallback as H,useSyncExternalStore as lt}from"react";function m(){let i=d(),t=H(n=>i.subscribe(n),[i]),e=H(()=>i.state,[i]);return lt(t,e,e)}import{useCallback as j}from"react";function q(){let i=d(),t=m(),e=j(s=>i.applyFilters(s),[i]),n=j((s,r)=>i.applyFilters({[s]:r}),[i]);return{filters:t.filters,set:e,setField:n}}import{jsx as I,jsxs as pt}from"react/jsx-runtime";function ae({className:i,groupClassName:t,hideLabels:e}={}){let n=d(),{FilterPanel:s}=v(),{filters:r}=q();return I(s,{children:I("div",{className:i??"space-y-5",children:n.filters.list().map(o=>{if(typeof o.render=="string")return I("div",{"data-filter":o.key,className:t},o.key);let a=o.render;return pt("div",{className:t,children:[o.label&&!e&&I("div",{className:"mb-1.5 text-[13px] font-medium text-foreground",children:o.label}),I(a,{value:o.fromParams(r),onChange:l=>{n.applyFilters(o.toParams(l))}})]},o.key)})})})}function O(){return m().results}import{jsx as N}from"react/jsx-runtime";function ut(i,t){if(i&&typeof i=="object"&&"id"in i){let e=i.id;if(typeof e=="string"||typeof e=="number")return e}return t}function ye({className:i}={}){let t=d(),{items:e}=O(),{pagination:n,selection:s}=m(),{Card:r,Empty:o,Loading:a}=v();return n.loading&&e.length===0?N(a,{}):e.length===0?N(o,{}):N("div",{role:"list",className:i,children:e.map((l,L)=>{let y=ut(l,L);return N(r,{item:l,selected:s===y,onSelect:()=>t.selectPoint(t.primaryDatasetId,y)},y)})})}import{useEffect as z,useRef as C,useState as dt}from"react";import{jsx as ft}from"react/jsx-runtime";var ct={west:-179.9,south:-85,east:179.9,north:85},A=.1,V=.02;function gt(i){if(i.length===0)return null;let t=i[0].lng,e=i[0].lng,n=i[0].lat,s=i[0].lat;for(let{lat:a,lng:l}of i)l<t&&(t=l),l>e&&(e=l),a<n&&(n=a),a>s&&(s=a);let r=s>n?(s-n)*A:V,o=e>t?(e-t)*A:V;return{west:t-o,east:e+o,south:n-r,north:s+r}}function ve(i){let{center:t,zoom:e,fallback:n}=i,s=d(),r=m(),o=C(null),a=C(null),[l,L]=dt(!1),y=C(!1),k=C(!1),b=C(!1),p=s.map;return z(()=>{let T=a.current;if(!p||!T)return;let h=[];for(let u of Object.keys(r.points)){if(r.layers[u]===!1)continue;let g=s.datasets.get(u),E=r.points[u]??[],_={id:u,markers:E.map(F=>({id:F.id,position:F.position,iconUrl:g?.marker.iconUrl?.(F.entity),element:g?.marker.element?.(F.entity)})),clustering:g?.clustering,onMarkerClick:F=>s.selectPoint(u,F)};h.push(p.renderLayer(T,_))}return()=>{h.forEach(u=>u())}},[s,p,l,r.points,r.layers]),z(()=>{if(!o.current||!p)return;let T=o.current,h=!1,u=null;return(async()=>{let g=await p.mount(T,{center:t,zoom:e});if(h){p.destroy(g);return}a.current=g,u=p.onBoundsChange(g,E=>{b.current?b.current=!1:k.current=!0,s.loadPoints(E)}),L(!0),s.loadPoints(ct)})(),()=>{h=!0,u?.(),a.current&&(p.destroy(a.current),a.current=null),L(!1)}},[s,p]),z(()=>{let T=a.current;if(!p||!T||t||y.current||k.current)return;let h=[];for(let g of Object.keys(r.points))if(r.layers[g]!==!1)for(let E of r.points[g]??[])h.push(E.position);let u=gt(h);u&&(y.current=!0,b.current=!0,p.fitBounds(T,u))},[p,t,l,r.points,r.layers]),ft("div",{ref:o,className:!p&&n?"flex h-full min-h-0 w-full items-center justify-center":"h-full min-h-0 w-full",children:!p&&n})}import{jsx as mt}from"react/jsx-runtime";function ke(){let i=d(),{results:t,pagination:e}=m();return t.nextCursor==null?null:mt("button",{type:"button",disabled:e.loading,onClick:()=>{i.loadPage()},children:"Load more"})}import{jsx as yt}from"react/jsx-runtime";function De(){let{items:i,total:t}=O(),{ResultHeader:e}=v();return yt(e,{count:i.length,total:t})}import{useEffect as ht,useState as K}from"react";import{jsx as Tt}from"react/jsx-runtime";function Ue(i){let{children:t,...e}=i,[n]=K(()=>e),[s,r]=K(null);return ht(()=>{let o=new D({datasets:n.datasets,filters:n.filters,config:n.config,map:n.map,initialFilters:n.initialFilters,primaryDatasetId:n.primaryDatasetId});return n.urlSync&&n.urlSync.start(o),r(o),()=>{n.urlSync&&n.urlSync.stop(),o.dispose(),r(a=>a===o?null:a)}},[n]),s?Tt(M.Provider,{value:s,children:t}):null}export{S as a,P as b,w as c,R as d,B as e,x as f,D as g,Mt as h,Ot as i,Nt as j,zt as k,Bt as l,Ut as m,Ht as n,jt as o,Vt as p,v as q,M as r,d as s,m as t,q as u,ae as v,O as w,ye as x,ve as y,ke as z,De as A,Ue as B};
|
package/dist/chunk-RXHR66FS.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; }"use client";
|
|
2
|
-
var _chunkEYXV5OMYcjs = require('./chunk-EYXV5OMY.cjs');var _react = require('react');function ce(e,t){let r=_chunkEYXV5OMYcjs.s.call(void 0, ),i=_react.useRef.call(void 0, t);i.current=t,_react.useEffect.call(void 0, ()=>r.on(e,n=>i.current(n)),[r,e])}function L(e){return typeof e!="number"?e:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(e)}var _jsxruntime = require('react/jsx-runtime');function Me(e){return e?"rle-card rle-card--selected":"rle-card"}function O({item:e,selected:t,onSelect:r}){let i=_nullishCoalesce(e, () => ({})),n=Me(t),s=_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[i.imageUrl?_jsxruntime.jsx.call(void 0, "img",{src:i.imageUrl,alt:_nullishCoalesce(i.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:[i.title&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-title",children:i.title}),i.subtitle&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-address",children:i.subtitle}),i.badge&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-info",children:_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-info-item",children:i.badge})}),i.price!=null&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-card-price",children:L(i.price)})]})]});return r?_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:r,"aria-pressed":_nullishCoalesce(t, () => (!1)),className:n,children:s}):_jsxruntime.jsx.call(void 0, "article",{className:n,children:s})}function H(e){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 V({children:e}){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-panel",children:e})}function D(e){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((t,r)=>_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%"}})]},r))})}function K({point:e}){let t=_nullishCoalesce(e.entity, () => ({}));return _jsxruntime.jsx.call(void 0, "span",{className:"rle-pin",children:t.price!=null?L(t.price):""})}function $({entity:e,onClose:t}){let r=_nullishCoalesce(e, () => ({}));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:t,"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:[r.title&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-title",children:r.title}),r.subtitle&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-address",children:r.subtitle}),r.price!=null&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-card-price",children:L(r.price)})]})]})}function z({count:e,total:t}){let r=t!=null&&t!==e?`${e} of ${t} results`:`${e} results`;return _jsxruntime.jsx.call(void 0, "div",{className:"rle-result-header",children:r})}function U({value:e,onChange:t,placeholder:r}){return _jsxruntime.jsx.call(void 0, "input",{type:"search",value:e,placeholder:r,onChange:i=>t(i.target.value),"aria-label":_nullishCoalesce(r, () => ("Search")),className:"rle-input"})}function Z({children:e}){return _jsxruntime.jsx.call(void 0, "aside",{className:"rle-sidebar",children:e})}function q({children:e}){return _jsxruntime.jsx.call(void 0, "div",{className:"rle-toolbar",children:e})}var fe={Card:O,Marker:K,Popup:$,Sidebar:Z,FilterPanel:V,Search:U,Empty:H,Loading:D,ResultHeader:z,Toolbar:q};function ve({view:e,onViewChange:t}){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${e==="list"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":e==="list",onClick:()=>t("list"),children:[_jsxruntime.jsx.call(void 0, De,{}),"List"]}),_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:`rle-viewtoggle__btn${e==="map"?" rle-viewtoggle__btn--active":""}`,"aria-pressed":e==="map",onClick:()=>t("map"),children:[_jsxruntime.jsx.call(void 0, Ke,{}),"Map"]})]})})}function ge(){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 De(){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 Ke(){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 ye(){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 _reactdom = require('react-dom');function be({open:e,onOpenChange:t,title:r,children:i,footer:n}){let s=_react.useRef.call(void 0, null),[l,c]=_react.useState.call(void 0, !1),[d,v]=_react.useState.call(void 0, !1);return _react.useEffect.call(void 0, ()=>{if(!e){v(!1),c(!1);return}c(!0);let p=requestAnimationFrame(()=>v(!0));return()=>cancelAnimationFrame(p)},[e]),_react.useEffect.call(void 0, ()=>{if(!l)return;let p=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=p}},[l]),_react.useEffect.call(void 0, ()=>{if(!l)return;_optionalChain([s, 'access', _2 => _2.current, 'optionalAccess', _3 => _3.focus, 'call', _4 => _4()]);function p(g){g.key==="Escape"&&t(!1)}return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[l,t]),!l||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:()=>t(!1),"aria-hidden":"true"}),_jsxruntime.jsxs.call(void 0, "div",{ref:s,className:`rle-sheet${d?" rle-sheet--open":""}`,role:"dialog","aria-modal":"true","aria-label":r,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:[r&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__title",children:r}),_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-sheet__close",onClick:()=>t(!1),"aria-label":"Close",children:_jsxruntime.jsx.call(void 0, ze,{})})]}),_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__body",children:i}),n&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-sheet__footer",children:n})]})]}),document.body)}function ze(){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 Ne({search:e,onFiltersClick:t,filterCount:r=0,action:i}){let{Search:n}=_chunkEYXV5OMYcjs.q.call(void 0, );return _jsxruntime.jsxs.call(void 0, "header",{className:"rle-mobile-header",children:[e&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-mobile-header__search",children:_jsxruntime.jsx.call(void 0, n,{value:e.value,onChange:e.onChange,placeholder:e.placeholder})}),_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"rle-mobile-header__btn",onClick:t,children:[_jsxruntime.jsx.call(void 0, ge,{}),_jsxruntime.jsx.call(void 0, "span",{children:"Filters"}),r>0&&_jsxruntime.jsx.call(void 0, "span",{className:"rle-mobile-header__count",children:r})]}),i&&_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-mobile-header__btn rle-mobile-header__btn--icon",onClick:i.onClick,"aria-label":i.label,children:_nullishCoalesce(i.icon, () => (_jsxruntime.jsx.call(void 0, ye,{})))})]})}var qe=_jsxruntime.jsx.call(void 0, "div",{className:"rle-empty",children:"Map unavailable"});function Ge(){let e=_react.useRef.call(void 0, null),[t,r]=_react.useState.call(void 0, !0),[i,n]=_react.useState.call(void 0, !0);return _react.useEffect.call(void 0, ()=>{let s=e.current;if(!s)return;let l=()=>{let{clientWidth:v,scrollLeft:p,scrollWidth:g}=s;r(p<=0),n(p+v>=g-1)};l(),s.addEventListener("scroll",l,{passive:!0});let c,d;return typeof ResizeObserver<"u"&&(c=new ResizeObserver(l),c.observe(s)),typeof MutationObserver<"u"&&(d=new MutationObserver(l),d.observe(s,{characterData:!0,childList:!0,subtree:!0})),()=>{s.removeEventListener("scroll",l),_optionalChain([c, 'optionalAccess', _5 => _5.disconnect, 'call', _6 => _6()]),_optionalChain([d, 'optionalAccess', _7 => _7.disconnect, 'call', _8 => _8()])}},[]),{atEnd:i,atStart:t,ref:e}}function we({search:e,toolbarEnd:t,mobileAction:r,autoFetch:i=!0,hasMap:n=!0,mapCenter:s,mapZoom:l,className:c}){let d=_chunkEYXV5OMYcjs.s.call(void 0, ),{Search:v}=_chunkEYXV5OMYcjs.q.call(void 0, ),p=_chunkEYXV5OMYcjs.w.call(void 0, ),{filters:g}=_chunkEYXV5OMYcjs.u.call(void 0, ),[P,E]=_react.useState.call(void 0, "list"),[C,u]=_react.useState.call(void 0, !1),{atEnd:R,atStart:T,ref:A}=Ge(),S=e?{value:String(_nullishCoalesce(g[e.filterKey], () => (""))),onChange:w=>{d.applyFilters({[e.filterKey]:w||void 0})},placeholder:e.placeholder}:void 0;_react.useEffect.call(void 0, ()=>{i!==!1&&d.applyFilters({})},[d,i]);let Ce=()=>{let w=d.filters.list().reduce((Ie,Q)=>Object.assign(Ie,Q.toParams(Q.fromParams({}))),{});d.applyFilters(w)},xe=d.filters.list().filter(w=>_optionalChain([w, 'access', _9 => _9.isActive, 'optionalCall', _10 => _10(g)])).length,ke=_nullishCoalesce(p.total, () => (p.items.length));return _jsxruntime.jsxs.call(void 0, "div",{className:c?`rle-app ${c}`:"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:A,children:[S&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__search",children:_jsxruntime.jsx.call(void 0, v,{value:S.value,onChange:S.onChange,placeholder:S.placeholder})}),_jsxruntime.jsx.call(void 0, _chunkEYXV5OMYcjs.v,{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"}),!R&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-filter-bar__fade rle-filter-bar__fade--end","aria-hidden":"true"})]}),_jsxruntime.jsx.call(void 0, Ne,{search:S,onFiltersClick:()=>u(!0),filterCount:xe,action:r}),_jsxruntime.jsxs.call(void 0, "div",{className:`rle-body ${n?"rle-split":"rle-body--list-only"}`,"data-mobile-view":P,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, _chunkEYXV5OMYcjs.A,{}),t&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-list-header__toolbar",children:t})]}),_jsxruntime.jsx.call(void 0, _chunkEYXV5OMYcjs.x,{className:"rle-list-grid"}),_jsxruntime.jsx.call(void 0, _chunkEYXV5OMYcjs.z,{})]}),n&&_jsxruntime.jsx.call(void 0, "div",{className:"rle-map",children:_jsxruntime.jsx.call(void 0, _chunkEYXV5OMYcjs.y,{center:s,zoom:l,fallback:qe})})]}),n&&_jsxruntime.jsx.call(void 0, ve,{view:P,onViewChange:E}),_jsxruntime.jsx.call(void 0, be,{title:"Filters",open:C,onOpenChange:u,footer:_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",className:"rle-btn rle-btn--ghost",onClick:Ce,children:"Clear all"}),_jsxruntime.jsxs.call(void 0, "button",{type:"button",className:"rle-btn rle-btn--primary",onClick:()=>u(!1),children:["Show ",ke," results"]})]}),children:_jsxruntime.jsx.call(void 0, _chunkEYXV5OMYcjs.v,{className:"rle-filter-stack",groupClassName:"rle-filter-group"})})]})}function Pe(e){return"provider"in e}function je(e){let t=e!=null&&!Pe(e),r=t?e.apiKey:void 0,i=t?e.mapId:void 0,[n,s]=_react.useState.call(void 0, ()=>!e||Pe(e)?{ready:!0,provider:_optionalChain([e, 'optionalAccess', _11 => _11.provider])}:{ready:!1});return _react.useEffect.call(void 0, ()=>{if(!r)return;let l=!1;return Promise.resolve().then(() => _interopRequireWildcard(require("./maps/google/index.cjs"))).then(({googleProvider:c})=>{l||s({ready:!0,provider:c({apiKey:r,mapId:i})})}),()=>{l=!0}},[r,i]),n}function et({onFiltersChange:e}){let t=_react.useRef.call(void 0, e);return t.current=e,ce("FiltersChanged",r=>{r.type==="FiltersChanged"&&t.current(r.filters)}),null}function pr(e){let{datasets:t,filters:r,map:i,components:n,initialFilters:s,onFiltersChange:l,mobileAction:c,search:d,toolbarEnd:v,config:p,autoFetch:g,className:P}=e,{ready:E,provider:C}=je(i);if(!E)return null;let u=[];for(let A of t)u.push(_chunkEYXV5OMYcjs.k.call(void 0, A));r&&u.push(_chunkEYXV5OMYcjs.l.call(void 0, r)),C&&u.push(_chunkEYXV5OMYcjs.j.call(void 0, C)),s&&u.push(_chunkEYXV5OMYcjs.n.call(void 0, s)),p&&u.push(_chunkEYXV5OMYcjs.i.call(void 0, p));let R=_chunkEYXV5OMYcjs.h.call(void 0, ...u),T={...fe,...n};return _jsxruntime.jsxs.call(void 0, _chunkEYXV5OMYcjs.B,{...R,children:[l&&_jsxruntime.jsx.call(void 0, et,{onFiltersChange:l}),_jsxruntime.jsx.call(void 0, _chunkEYXV5OMYcjs.p,{...T,children:_jsxruntime.jsx.call(void 0, we,{className:P,search:d,toolbarEnd:v,mobileAction:c,autoFetch:g,hasMap:i!=null,mapCenter:_optionalChain([i, 'optionalAccess', _12 => _12.center]),mapZoom:_optionalChain([i, 'optionalAccess', _13 => _13.zoom])})})]})}exports.a = ce; exports.b = O; exports.c = H; exports.d = V; exports.e = D; exports.f = K; exports.g = $; exports.h = z; exports.i = U; exports.j = Z; exports.k = q; exports.l = fe; exports.m = ve; exports.n = be; exports.o = we; exports.p = pr;
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { b as EntityAdapter, M as MapPoint } from './map-provider.interface-DT-v1plm.cjs';
|
|
2
|
-
import * as react from 'react';
|
|
3
|
-
import { ComponentType, ReactNode } from 'react';
|
|
4
|
-
|
|
5
|
-
interface FilterControlProps<TValue> {
|
|
6
|
-
value: TValue;
|
|
7
|
-
onChange(next: TValue): void;
|
|
8
|
-
}
|
|
9
|
-
interface FilterDefinition<TFilters, TValue = unknown> {
|
|
10
|
-
key: string;
|
|
11
|
-
order: number;
|
|
12
|
-
render: string | ComponentType<FilterControlProps<TValue>>;
|
|
13
|
-
toParams(value: TValue): Partial<TFilters>;
|
|
14
|
-
fromParams(filters: TFilters): TValue;
|
|
15
|
-
isActive?(filters: TFilters): boolean;
|
|
16
|
-
/** Optional human-readable label rendered above the control by `ListingFilters`. Omit for an unlabeled filter (backward compatible). */
|
|
17
|
-
label?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface ClusterOptions {
|
|
21
|
-
maxZoom?: number;
|
|
22
|
-
radius?: number;
|
|
23
|
-
}
|
|
24
|
-
interface MarkerRenderer<TEntity> {
|
|
25
|
-
iconUrl?(entity: TEntity): string;
|
|
26
|
-
element?(entity: TEntity): HTMLElement;
|
|
27
|
-
onClick?(entity: TEntity): void;
|
|
28
|
-
}
|
|
29
|
-
interface DatasetDefinition<TEntity, TFilters> {
|
|
30
|
-
id: string;
|
|
31
|
-
adapter: EntityAdapter<TEntity, TFilters>;
|
|
32
|
-
marker: MarkerRenderer<TEntity>;
|
|
33
|
-
clustering?: ClusterOptions | false;
|
|
34
|
-
visible?: () => boolean;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
declare enum PaginationMode {
|
|
38
|
-
Paged = "paged",
|
|
39
|
-
Infinite = "infinite"
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
interface IListingConfigOptions {
|
|
43
|
-
pagination: PaginationMode;
|
|
44
|
-
pageSize: number;
|
|
45
|
-
debounceMs: number;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Framework-free registry for `FilterDefinition`s: programmatic add / remove /
|
|
50
|
-
* reorder / replace, plus folding raw control values into `TFilters`
|
|
51
|
-
* (`toFilters`) and reporting which registered filters currently affect an
|
|
52
|
-
* applied `TFilters` (`activeKeys`).
|
|
53
|
-
*
|
|
54
|
-
* Defs are stored by VALUE (shallow-cloned on `add`/`replace`), never by the
|
|
55
|
-
* caller's original reference — `reorder()` rewrites `order` in place on the
|
|
56
|
-
* registry's own copy. This is deliberate: the same `FilterDefinition` object
|
|
57
|
-
* can legitimately be registered in more than one `FilterRegistry` instance
|
|
58
|
-
* (e.g. two listing pages sharing a base filter set), and without cloning,
|
|
59
|
-
* one registry's `reorder()` would silently mutate `.order` on the shared
|
|
60
|
-
* object and bleed into every other registry (and the caller) holding it.
|
|
61
|
-
*/
|
|
62
|
-
declare class FilterRegistry<TFilters> {
|
|
63
|
-
private readonly defs;
|
|
64
|
-
add<TValue = unknown>(def: FilterDefinition<TFilters, TValue>): this;
|
|
65
|
-
remove(key: string): this;
|
|
66
|
-
replace<TValue = unknown>(key: string, def: FilterDefinition<TFilters, TValue>): this;
|
|
67
|
-
reorder(keys: string[]): this;
|
|
68
|
-
list(): FilterDefinition<TFilters>[];
|
|
69
|
-
has(key: string): boolean;
|
|
70
|
-
toFilters(values: Record<string, unknown>): TFilters;
|
|
71
|
-
activeKeys(filters: TFilters): string[];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
interface IListingCardProps {
|
|
75
|
-
item: unknown;
|
|
76
|
-
selected?: boolean;
|
|
77
|
-
onSelect?: () => void;
|
|
78
|
-
}
|
|
79
|
-
interface IListingMarkerProps {
|
|
80
|
-
point: MapPoint<unknown>;
|
|
81
|
-
}
|
|
82
|
-
interface IListingPopupProps {
|
|
83
|
-
entity: unknown;
|
|
84
|
-
onClose?: () => void;
|
|
85
|
-
}
|
|
86
|
-
interface IListingSidebarProps {
|
|
87
|
-
children?: ReactNode;
|
|
88
|
-
}
|
|
89
|
-
interface IListingFilterPanelProps {
|
|
90
|
-
children?: ReactNode;
|
|
91
|
-
}
|
|
92
|
-
interface IListingSearchProps {
|
|
93
|
-
value: string;
|
|
94
|
-
onChange(value: string): void;
|
|
95
|
-
placeholder?: string;
|
|
96
|
-
}
|
|
97
|
-
interface IListingEmptyProps {
|
|
98
|
-
}
|
|
99
|
-
interface IListingLoadingProps {
|
|
100
|
-
}
|
|
101
|
-
interface IListingResultHeaderProps {
|
|
102
|
-
count: number;
|
|
103
|
-
total?: number;
|
|
104
|
-
}
|
|
105
|
-
interface IListingToolbarProps {
|
|
106
|
-
children?: ReactNode;
|
|
107
|
-
}
|
|
108
|
-
interface IListingComponents {
|
|
109
|
-
Card: ComponentType<IListingCardProps>;
|
|
110
|
-
Marker: ComponentType<IListingMarkerProps>;
|
|
111
|
-
Popup: ComponentType<IListingPopupProps>;
|
|
112
|
-
Sidebar: ComponentType<IListingSidebarProps>;
|
|
113
|
-
FilterPanel: ComponentType<IListingFilterPanelProps>;
|
|
114
|
-
Search: ComponentType<IListingSearchProps>;
|
|
115
|
-
Empty: ComponentType<IListingEmptyProps>;
|
|
116
|
-
Loading: ComponentType<IListingLoadingProps>;
|
|
117
|
-
ResultHeader: ComponentType<IListingResultHeaderProps>;
|
|
118
|
-
Toolbar: ComponentType<IListingToolbarProps>;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Injection point for custom-component overrides. Every slot is optional —
|
|
122
|
-
* anything not provided falls back to the (unstyled) default. Mirrors
|
|
123
|
-
* `react-wizard-engine`'s `WizardComponentsProvider`: explicit per-slot
|
|
124
|
-
* `provided ?? defaults.X` merge, not a generic/reflective loop.
|
|
125
|
-
*/
|
|
126
|
-
declare function ListingComponentsProvider(props: Partial<IListingComponents> & {
|
|
127
|
-
children: ReactNode;
|
|
128
|
-
}): react.JSX.Element;
|
|
129
|
-
declare function useListingComponents(): IListingComponents;
|
|
130
|
-
|
|
131
|
-
export { type ClusterOptions as C, type DatasetDefinition as D, FilterRegistry as F, type IListingConfigOptions as I, ListingComponentsProvider as L, type MarkerRenderer as M, PaginationMode as P, type IListingToolbarProps as a, type FilterControlProps as b, type FilterDefinition as c, type IListingCardProps as d, type IListingComponents as e, type IListingEmptyProps as f, type IListingFilterPanelProps as g, type IListingLoadingProps as h, type IListingMarkerProps as i, type IListingPopupProps as j, type IListingResultHeaderProps as k, type IListingSearchProps as l, type IListingSidebarProps as m, useListingComponents as u };
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { b as EntityAdapter, M as MapPoint } from './map-provider.interface-DT-v1plm.js';
|
|
2
|
-
import * as react from 'react';
|
|
3
|
-
import { ComponentType, ReactNode } from 'react';
|
|
4
|
-
|
|
5
|
-
interface FilterControlProps<TValue> {
|
|
6
|
-
value: TValue;
|
|
7
|
-
onChange(next: TValue): void;
|
|
8
|
-
}
|
|
9
|
-
interface FilterDefinition<TFilters, TValue = unknown> {
|
|
10
|
-
key: string;
|
|
11
|
-
order: number;
|
|
12
|
-
render: string | ComponentType<FilterControlProps<TValue>>;
|
|
13
|
-
toParams(value: TValue): Partial<TFilters>;
|
|
14
|
-
fromParams(filters: TFilters): TValue;
|
|
15
|
-
isActive?(filters: TFilters): boolean;
|
|
16
|
-
/** Optional human-readable label rendered above the control by `ListingFilters`. Omit for an unlabeled filter (backward compatible). */
|
|
17
|
-
label?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface ClusterOptions {
|
|
21
|
-
maxZoom?: number;
|
|
22
|
-
radius?: number;
|
|
23
|
-
}
|
|
24
|
-
interface MarkerRenderer<TEntity> {
|
|
25
|
-
iconUrl?(entity: TEntity): string;
|
|
26
|
-
element?(entity: TEntity): HTMLElement;
|
|
27
|
-
onClick?(entity: TEntity): void;
|
|
28
|
-
}
|
|
29
|
-
interface DatasetDefinition<TEntity, TFilters> {
|
|
30
|
-
id: string;
|
|
31
|
-
adapter: EntityAdapter<TEntity, TFilters>;
|
|
32
|
-
marker: MarkerRenderer<TEntity>;
|
|
33
|
-
clustering?: ClusterOptions | false;
|
|
34
|
-
visible?: () => boolean;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
declare enum PaginationMode {
|
|
38
|
-
Paged = "paged",
|
|
39
|
-
Infinite = "infinite"
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
interface IListingConfigOptions {
|
|
43
|
-
pagination: PaginationMode;
|
|
44
|
-
pageSize: number;
|
|
45
|
-
debounceMs: number;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Framework-free registry for `FilterDefinition`s: programmatic add / remove /
|
|
50
|
-
* reorder / replace, plus folding raw control values into `TFilters`
|
|
51
|
-
* (`toFilters`) and reporting which registered filters currently affect an
|
|
52
|
-
* applied `TFilters` (`activeKeys`).
|
|
53
|
-
*
|
|
54
|
-
* Defs are stored by VALUE (shallow-cloned on `add`/`replace`), never by the
|
|
55
|
-
* caller's original reference — `reorder()` rewrites `order` in place on the
|
|
56
|
-
* registry's own copy. This is deliberate: the same `FilterDefinition` object
|
|
57
|
-
* can legitimately be registered in more than one `FilterRegistry` instance
|
|
58
|
-
* (e.g. two listing pages sharing a base filter set), and without cloning,
|
|
59
|
-
* one registry's `reorder()` would silently mutate `.order` on the shared
|
|
60
|
-
* object and bleed into every other registry (and the caller) holding it.
|
|
61
|
-
*/
|
|
62
|
-
declare class FilterRegistry<TFilters> {
|
|
63
|
-
private readonly defs;
|
|
64
|
-
add<TValue = unknown>(def: FilterDefinition<TFilters, TValue>): this;
|
|
65
|
-
remove(key: string): this;
|
|
66
|
-
replace<TValue = unknown>(key: string, def: FilterDefinition<TFilters, TValue>): this;
|
|
67
|
-
reorder(keys: string[]): this;
|
|
68
|
-
list(): FilterDefinition<TFilters>[];
|
|
69
|
-
has(key: string): boolean;
|
|
70
|
-
toFilters(values: Record<string, unknown>): TFilters;
|
|
71
|
-
activeKeys(filters: TFilters): string[];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
interface IListingCardProps {
|
|
75
|
-
item: unknown;
|
|
76
|
-
selected?: boolean;
|
|
77
|
-
onSelect?: () => void;
|
|
78
|
-
}
|
|
79
|
-
interface IListingMarkerProps {
|
|
80
|
-
point: MapPoint<unknown>;
|
|
81
|
-
}
|
|
82
|
-
interface IListingPopupProps {
|
|
83
|
-
entity: unknown;
|
|
84
|
-
onClose?: () => void;
|
|
85
|
-
}
|
|
86
|
-
interface IListingSidebarProps {
|
|
87
|
-
children?: ReactNode;
|
|
88
|
-
}
|
|
89
|
-
interface IListingFilterPanelProps {
|
|
90
|
-
children?: ReactNode;
|
|
91
|
-
}
|
|
92
|
-
interface IListingSearchProps {
|
|
93
|
-
value: string;
|
|
94
|
-
onChange(value: string): void;
|
|
95
|
-
placeholder?: string;
|
|
96
|
-
}
|
|
97
|
-
interface IListingEmptyProps {
|
|
98
|
-
}
|
|
99
|
-
interface IListingLoadingProps {
|
|
100
|
-
}
|
|
101
|
-
interface IListingResultHeaderProps {
|
|
102
|
-
count: number;
|
|
103
|
-
total?: number;
|
|
104
|
-
}
|
|
105
|
-
interface IListingToolbarProps {
|
|
106
|
-
children?: ReactNode;
|
|
107
|
-
}
|
|
108
|
-
interface IListingComponents {
|
|
109
|
-
Card: ComponentType<IListingCardProps>;
|
|
110
|
-
Marker: ComponentType<IListingMarkerProps>;
|
|
111
|
-
Popup: ComponentType<IListingPopupProps>;
|
|
112
|
-
Sidebar: ComponentType<IListingSidebarProps>;
|
|
113
|
-
FilterPanel: ComponentType<IListingFilterPanelProps>;
|
|
114
|
-
Search: ComponentType<IListingSearchProps>;
|
|
115
|
-
Empty: ComponentType<IListingEmptyProps>;
|
|
116
|
-
Loading: ComponentType<IListingLoadingProps>;
|
|
117
|
-
ResultHeader: ComponentType<IListingResultHeaderProps>;
|
|
118
|
-
Toolbar: ComponentType<IListingToolbarProps>;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Injection point for custom-component overrides. Every slot is optional —
|
|
122
|
-
* anything not provided falls back to the (unstyled) default. Mirrors
|
|
123
|
-
* `react-wizard-engine`'s `WizardComponentsProvider`: explicit per-slot
|
|
124
|
-
* `provided ?? defaults.X` merge, not a generic/reflective loop.
|
|
125
|
-
*/
|
|
126
|
-
declare function ListingComponentsProvider(props: Partial<IListingComponents> & {
|
|
127
|
-
children: ReactNode;
|
|
128
|
-
}): react.JSX.Element;
|
|
129
|
-
declare function useListingComponents(): IListingComponents;
|
|
130
|
-
|
|
131
|
-
export { type ClusterOptions as C, type DatasetDefinition as D, FilterRegistry as F, type IListingConfigOptions as I, ListingComponentsProvider as L, type MarkerRenderer as M, PaginationMode as P, type IListingToolbarProps as a, type FilterControlProps as b, type FilterDefinition as c, type IListingCardProps as d, type IListingComponents as e, type IListingEmptyProps as f, type IListingFilterPanelProps as g, type IListingLoadingProps as h, type IListingMarkerProps as i, type IListingPopupProps as j, type IListingResultHeaderProps as k, type IListingSearchProps as l, type IListingSidebarProps as m, useListingComponents as u };
|
package/dist/shadcn/index.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; }"use client";
|
|
2
|
-
var _chunk2VUHLHHXcjs = require('../chunk-2VUHLHHX.cjs');var _chunkEYXV5OMYcjs = require('../chunk-EYXV5OMY.cjs');var _clsx = require('clsx');var _tailwindmerge = require('tailwind-merge');function s(...e){return _tailwindmerge.twMerge.call(void 0, _clsx.clsx.call(void 0, e))}var _jsxruntime = require('react/jsx-runtime');function ae(e){return typeof e!="number"?e:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(e)}function w({item:e,selected:o,onSelect:t}){let r=_nullishCoalesce(e, () => ({})),l=s("flex w-full flex-col overflow-hidden rounded-lg border bg-card text-left text-card-foreground shadow-sm","motion-safe:transition-shadow",t&&"hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",o&&"ring-2 ring-ring"),a=_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[r.imageUrl&&_jsxruntime.jsx.call(void 0, "img",{src:r.imageUrl,alt:_nullishCoalesce(r.title, () => ("")),className:"aspect-video w-full rounded-t-lg object-cover"}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-1 flex-col gap-1 p-3",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex items-start justify-between gap-2",children:[r.title&&_jsxruntime.jsx.call(void 0, "span",{className:"font-medium",children:r.title}),r.badge&&_jsxruntime.jsx.call(void 0, "span",{className:"shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:r.badge})]}),r.subtitle&&_jsxruntime.jsx.call(void 0, "span",{className:"text-sm text-muted-foreground",children:r.subtitle}),r.price!=null&&_jsxruntime.jsx.call(void 0, "span",{className:"mt-1 font-semibold tabular-nums",children:ae(r.price)})]})]});return t?_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:t,"aria-pressed":_nullishCoalesce(o, () => (!1)),className:l,children:a}):_jsxruntime.jsx.call(void 0, "article",{className:l,children:a})}function C(e){return _jsxruntime.jsxs.call(void 0, "div",{role:"status",className:"flex flex-col items-center justify-center gap-2 px-4 py-12 text-center text-muted-foreground",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:"h-8 w-8","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:"text-sm font-medium text-foreground",children:"No results"}),_jsxruntime.jsx.call(void 0, "p",{className:"text-xs text-muted-foreground",children:"Try adjusting your filters or search terms."})]})}function I({children:e}){return _jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col gap-3",children:e})}function D(e){return _jsxruntime.jsx.call(void 0, "div",{className:"flex flex-col gap-3 p-3",role:"status","aria-busy":"true","aria-label":"Loading results",children:Array.from({length:3}).map((o,t)=>_jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col gap-2 motion-safe:animate-pulse",children:[_jsxruntime.jsx.call(void 0, "div",{className:"aspect-video w-full rounded-md bg-muted"}),_jsxruntime.jsx.call(void 0, "div",{className:"h-4 w-2/3 rounded-md bg-muted"}),_jsxruntime.jsx.call(void 0, "div",{className:"h-3 w-1/3 rounded-md bg-muted"})]},t))})}function M({point:e}){let o=_nullishCoalesce(e.entity, () => ({}));return _jsxruntime.jsx.call(void 0, "span",{className:"rounded-full border bg-background px-2 py-0.5 text-xs font-medium tabular-nums shadow-sm",children:_nullishCoalesce(o.price, () => (""))})}function F({entity:e,onClose:o}){let t=_nullishCoalesce(e, () => ({}));return _jsxruntime.jsxs.call(void 0, "div",{className:"relative w-64 rounded-lg border bg-popover p-3 text-popover-foreground shadow-md",role:"group","aria-label":"Location details",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:o,"aria-label":"Close",className:"absolute right-2 top-2 rounded-md p-1 text-muted-foreground motion-safe:transition-colors hover:bg-foreground/[0.06] hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",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",className:"h-4 w-4","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",{className:"pr-6",children:[t.title&&_jsxruntime.jsx.call(void 0, "div",{className:"font-medium",children:t.title}),t.subtitle&&_jsxruntime.jsx.call(void 0, "div",{className:"text-sm text-muted-foreground",children:t.subtitle}),t.price!=null&&_jsxruntime.jsx.call(void 0, "div",{className:"mt-1 font-semibold tabular-nums",children:t.price})]})]})}function S({count:e,total:o}){let t=o!=null&&o!==e?`${e} of ${o} results`:`${e} results`;return _jsxruntime.jsx.call(void 0, "div",{className:"text-sm tabular-nums text-muted-foreground",children:t})}function T({value:e,onChange:o,placeholder:t}){return _jsxruntime.jsx.call(void 0, "input",{type:"search",value:e,placeholder:t,onChange:r=>o(r.target.value),"aria-label":_nullishCoalesce(t, () => ("Search")),className:s("h-9 w-full rounded-md border bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground","focus-visible:border-ring focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring")})}function R({children:e}){return _jsxruntime.jsx.call(void 0, "aside",{className:"flex w-full flex-col gap-4 p-4 md:border-r md:border-border",children:e})}function A({children:e}){return _jsxruntime.jsx.call(void 0, "div",{className:"flex items-center gap-2 border-b p-2",children:e})}var g={Card:w,Marker:M,Popup:F,Sidebar:R,FilterPanel:I,Search:T,Empty:C,Loading:D,ResultHeader:S,Toolbar:A};function ge({children:e}){return _jsxruntime.jsx.call(void 0, _chunkEYXV5OMYcjs.p,{...g,children:e})}var _react = require('react');var Le=_jsxruntime.jsx.call(void 0, "p",{className:"px-4 text-center text-sm text-muted-foreground",children:"Map unavailable - provide a Google Maps API key"});function E({search:e,className:o,toolbarEnd:t,autoFetch:r=!0,mapCenter:l,mapZoom:a}){let p=_chunkEYXV5OMYcjs.s.call(void 0, ),{Search:u}=_chunkEYXV5OMYcjs.q.call(void 0, ),[f,y]=_react.useState.call(void 0, "list");_react.useEffect.call(void 0, ()=>{r!==!1&&p.applyFilters({})},[p,r]);let h=f==="map"?"hidden md:block":"block",P=f==="list"?"hidden md:block":"block";return _jsxruntime.jsxs.call(void 0, "div",{className:s("flex h-full min-h-0 w-full flex-col bg-background text-foreground",o),"data-slot":"listing-layout",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"sticky top-0 z-10 flex flex-wrap items-end gap-3 border-b border-border bg-background p-3","data-slot":"listing-layout-filter-bar",children:[e&&_jsxruntime.jsx.call(void 0, "div",{className:"w-full min-w-0 sm:w-auto sm:max-w-xs sm:flex-1",children:_jsxruntime.jsx.call(void 0, u,{value:e.value,onChange:e.onChange,placeholder:e.placeholder})}),_jsxruntime.jsx.call(void 0, _chunkEYXV5OMYcjs.v,{className:"flex flex-wrap items-end gap-3",groupClassName:"min-w-0"}),_jsxruntime.jsxs.call(void 0, "div",{className:"ml-auto flex items-center gap-3",children:[_jsxruntime.jsx.call(void 0, _chunkEYXV5OMYcjs.A,{}),t]})]}),_jsxruntime.jsx.call(void 0, "div",{className:"flex items-center justify-center gap-1 border-b border-border bg-background p-2 md:hidden","data-slot":"listing-layout-mobile-toggle",children:_jsxruntime.jsx.call(void 0, "div",{role:"group","aria-label":"View",className:"inline-flex rounded-md border border-border p-0.5",children:[{view:"list",label:"List"},{view:"map",label:"Map"}].map(({view:d,label:n})=>_jsxruntime.jsx.call(void 0, "button",{type:"button","aria-pressed":f===d,onClick:()=>y(d),className:s("rounded-[5px] px-3 py-1 text-sm font-medium motion-safe:transition-colors",f===d?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-foreground/[0.06] hover:text-foreground"),children:n},d))})}),_jsxruntime.jsxs.call(void 0, "div",{className:"grid min-h-0 flex-1 md:grid-cols-[minmax(340px,42%)_1fr]","data-slot":"listing-layout-split",children:[_jsxruntime.jsxs.call(void 0, "div",{className:s("min-h-0 overflow-y-auto p-3",h),"data-slot":"listing-layout-list",children:[_jsxruntime.jsx.call(void 0, _chunkEYXV5OMYcjs.x,{className:"grid content-start gap-3 [grid-template-columns:repeat(auto-fill,minmax(200px,1fr))]"}),_jsxruntime.jsx.call(void 0, "div",{className:"mt-4 flex justify-center",children:_jsxruntime.jsx.call(void 0, _chunkEYXV5OMYcjs.z,{})})]}),_jsxruntime.jsx.call(void 0, "div",{className:s("min-h-0 md:sticky md:top-0",P),"data-slot":"listing-layout-map",children:_jsxruntime.jsx.call(void 0, _chunkEYXV5OMYcjs.y,{center:l,zoom:a,fallback:Le})})]})]})}function ee(e){return"provider"in e}function Pe(e){let o=e!=null&&!ee(e),t=o?e.apiKey:void 0,r=o?e.mapId:void 0,[l,a]=_react.useState.call(void 0, ()=>!e||ee(e)?{ready:!0,provider:_optionalChain([e, 'optionalAccess', _2 => _2.provider])}:{ready:!1});return _react.useEffect.call(void 0, ()=>{if(!t)return;let p=!1;return Promise.resolve().then(() => _interopRequireWildcard(require("../maps/google/index.cjs"))).then(({googleProvider:u})=>{p||a({ready:!0,provider:u({apiKey:t,mapId:r})})}),()=>{p=!0}},[t,r]),l}function Ne(e){let{datasets:o,filters:t,map:r,components:l,urlSync:a,initialFilters:p,config:u,className:f,search:y,autoFetch:h}=e,{ready:P,provider:d}=Pe(r);if(!P)return null;let n=[];for(let oe of o)n.push(_chunkEYXV5OMYcjs.k.call(void 0, oe));t&&n.push(_chunkEYXV5OMYcjs.l.call(void 0, t)),d&&n.push(_chunkEYXV5OMYcjs.j.call(void 0, d)),a instanceof _chunk2VUHLHHXcjs.a&&n.push(_chunkEYXV5OMYcjs.m.call(void 0, a)),p&&n.push(_chunkEYXV5OMYcjs.n.call(void 0, p)),u&&n.push(_chunkEYXV5OMYcjs.i.call(void 0, u));let te=_chunkEYXV5OMYcjs.h.call(void 0, ...n),re={...g,...l};return _jsxruntime.jsx.call(void 0, _chunkEYXV5OMYcjs.B,{...te,children:_jsxruntime.jsx.call(void 0, _chunkEYXV5OMYcjs.p,{...re,children:_jsxruntime.jsx.call(void 0, E,{className:f,search:y,autoFetch:h,mapCenter:_optionalChain([r, 'optionalAccess', _3 => _3.center]),mapZoom:_optionalChain([r, 'optionalAccess', _4 => _4.zoom])})})})}exports.DefaultCard = w; exports.DefaultEmpty = C; exports.DefaultFilterPanel = I; exports.DefaultLoading = D; exports.DefaultMarker = M; exports.DefaultPopup = F; exports.DefaultResultHeader = S; exports.DefaultSearch = T; exports.DefaultSidebar = R; exports.DefaultToolbar = A; exports.ListingApp = Ne; exports.ListingComponentsProviderWithDefaults = ge; exports.ListingLayout = E; exports.cn = s; exports.shadcnDefaultComponents = g;
|