react-listing-engine 0.6.4 → 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.
Files changed (48) hide show
  1. package/README.md +54 -65
  2. package/dist/chunk-OXSYNZAJ.js +2 -0
  3. package/dist/chunk-PE27NATS.cjs +2 -0
  4. package/dist/index.cjs +2 -2
  5. package/dist/index.d.cts +95 -16
  6. package/dist/index.d.ts +95 -16
  7. package/dist/index.js +1 -1
  8. package/dist/{listing-app-wmMuDlVU.d.ts → listing-app-4Vs_SMNl.d.cts} +146 -26
  9. package/dist/{listing-app-DJbvx3oe.d.cts → listing-app-CkEGdUV9.d.ts} +146 -26
  10. package/dist/map-provider.interface-DT-v1plm.d.cts +67 -0
  11. package/dist/map-provider.interface-DT-v1plm.d.ts +67 -0
  12. package/dist/maps/google/index.d.cts +1 -2
  13. package/dist/maps/google/index.d.ts +1 -2
  14. package/dist/styled/index.cjs +1 -1
  15. package/dist/styled/index.d.cts +7 -10
  16. package/dist/styled/index.d.ts +7 -10
  17. package/dist/styled/index.js +1 -1
  18. package/dist/testing/index.d.cts +1 -2
  19. package/dist/testing/index.d.ts +1 -2
  20. package/package.json +3 -14
  21. package/dist/chunk-2VUHLHHX.cjs +0 -2
  22. package/dist/chunk-35KYEBAC.js +0 -2
  23. package/dist/chunk-5FBI2WIM.js +0 -2
  24. package/dist/chunk-6PZHSHU3.js +0 -2
  25. package/dist/chunk-CGT3RHJ7.js +0 -2
  26. package/dist/chunk-CHNUE46K.cjs +0 -2
  27. package/dist/chunk-EYXV5OMY.cjs +0 -2
  28. package/dist/chunk-LCQZIWBO.cjs +0 -2
  29. package/dist/chunk-R3FX2V3N.js +0 -2
  30. package/dist/chunk-RXHR66FS.cjs +0 -2
  31. package/dist/components-provider-CF0Mo0B8.d.cts +0 -120
  32. package/dist/components-provider-CjMxkxrP.d.ts +0 -120
  33. package/dist/entity-adapter.interface-BDgbSxhq.d.cts +0 -33
  34. package/dist/entity-adapter.interface-BDgbSxhq.d.ts +0 -33
  35. package/dist/listing-config-options.interface-ZJYY_ZvR.d.cts +0 -12
  36. package/dist/listing-config-options.interface-ZJYY_ZvR.d.ts +0 -12
  37. package/dist/map-provider.interface-BMnwW3ob.d.cts +0 -37
  38. package/dist/map-provider.interface-BxexMT3X.d.ts +0 -37
  39. package/dist/presets/rental/index.cjs +0 -2
  40. package/dist/presets/rental/index.d.cts +0 -266
  41. package/dist/presets/rental/index.d.ts +0 -266
  42. package/dist/presets/rental/index.js +0 -2
  43. package/dist/shadcn/index.cjs +0 -2
  44. package/dist/shadcn/index.d.cts +0 -261
  45. package/dist/shadcn/index.d.ts +0 -261
  46. package/dist/shadcn/index.js +0 -2
  47. package/dist/url-sync.controller-CsU_QxoS.d.cts +0 -89
  48. package/dist/url-sync.controller-DX67JivW.d.ts +0 -89
@@ -0,0 +1,67 @@
1
+ type EntityId = string | number;
2
+ interface Bounds {
3
+ west: number;
4
+ south: number;
5
+ east: number;
6
+ north: number;
7
+ }
8
+ interface LatLng {
9
+ lat: number;
10
+ lng: number;
11
+ }
12
+ interface PageRequest {
13
+ cursor?: string | null;
14
+ limit: number;
15
+ }
16
+ interface Page<T> {
17
+ items: T[];
18
+ nextCursor: string | null;
19
+ total?: number;
20
+ }
21
+ interface MapPoint<TEntity = unknown> {
22
+ id: EntityId;
23
+ position: LatLng;
24
+ entity: TEntity;
25
+ }
26
+ type QueryParams = Record<string, string | undefined>;
27
+ interface EntityAdapter<TEntity, TFilters> {
28
+ list(filters: TFilters, page: PageRequest): Promise<Page<TEntity>>;
29
+ getPoints(filters: TFilters, bounds: Bounds): Promise<MapPoint<TEntity>[]>;
30
+ getById?(id: EntityId): Promise<TEntity>;
31
+ }
32
+
33
+ /**
34
+ * Providers that need an API key take it via their factory (e.g. `googleProvider({ apiKey })`),
35
+ * not per-mount.
36
+ */
37
+ interface MapInitOptions {
38
+ apiKey?: string;
39
+ center?: LatLng;
40
+ zoom?: number;
41
+ }
42
+ interface MapHandle {
43
+ readonly raw: unknown;
44
+ }
45
+ interface RenderedLayer {
46
+ id: string;
47
+ markers: Array<{
48
+ id: string | number;
49
+ position: LatLng;
50
+ iconUrl?: string;
51
+ element?: HTMLElement;
52
+ }>;
53
+ clustering?: {
54
+ maxZoom?: number;
55
+ } | false;
56
+ onMarkerClick?(id: string | number): void;
57
+ }
58
+ type Unsubscribe = () => void;
59
+ interface MapProvider {
60
+ mount(el: HTMLElement, opts: MapInitOptions): Promise<MapHandle> | MapHandle;
61
+ renderLayer(handle: MapHandle, layer: RenderedLayer): Unsubscribe;
62
+ onBoundsChange(handle: MapHandle, cb: (b: Bounds) => void): Unsubscribe;
63
+ fitBounds(handle: MapHandle, b: Bounds): void;
64
+ destroy(handle: MapHandle): void;
65
+ }
66
+
67
+ export type { Bounds as B, EntityId as E, LatLng as L, MapPoint as M, Page as P, QueryParams as Q, RenderedLayer as R, Unsubscribe as U, MapProvider as a, EntityAdapter as b, MapHandle as c, MapInitOptions as d, PageRequest as e };
@@ -0,0 +1,67 @@
1
+ type EntityId = string | number;
2
+ interface Bounds {
3
+ west: number;
4
+ south: number;
5
+ east: number;
6
+ north: number;
7
+ }
8
+ interface LatLng {
9
+ lat: number;
10
+ lng: number;
11
+ }
12
+ interface PageRequest {
13
+ cursor?: string | null;
14
+ limit: number;
15
+ }
16
+ interface Page<T> {
17
+ items: T[];
18
+ nextCursor: string | null;
19
+ total?: number;
20
+ }
21
+ interface MapPoint<TEntity = unknown> {
22
+ id: EntityId;
23
+ position: LatLng;
24
+ entity: TEntity;
25
+ }
26
+ type QueryParams = Record<string, string | undefined>;
27
+ interface EntityAdapter<TEntity, TFilters> {
28
+ list(filters: TFilters, page: PageRequest): Promise<Page<TEntity>>;
29
+ getPoints(filters: TFilters, bounds: Bounds): Promise<MapPoint<TEntity>[]>;
30
+ getById?(id: EntityId): Promise<TEntity>;
31
+ }
32
+
33
+ /**
34
+ * Providers that need an API key take it via their factory (e.g. `googleProvider({ apiKey })`),
35
+ * not per-mount.
36
+ */
37
+ interface MapInitOptions {
38
+ apiKey?: string;
39
+ center?: LatLng;
40
+ zoom?: number;
41
+ }
42
+ interface MapHandle {
43
+ readonly raw: unknown;
44
+ }
45
+ interface RenderedLayer {
46
+ id: string;
47
+ markers: Array<{
48
+ id: string | number;
49
+ position: LatLng;
50
+ iconUrl?: string;
51
+ element?: HTMLElement;
52
+ }>;
53
+ clustering?: {
54
+ maxZoom?: number;
55
+ } | false;
56
+ onMarkerClick?(id: string | number): void;
57
+ }
58
+ type Unsubscribe = () => void;
59
+ interface MapProvider {
60
+ mount(el: HTMLElement, opts: MapInitOptions): Promise<MapHandle> | MapHandle;
61
+ renderLayer(handle: MapHandle, layer: RenderedLayer): Unsubscribe;
62
+ onBoundsChange(handle: MapHandle, cb: (b: Bounds) => void): Unsubscribe;
63
+ fitBounds(handle: MapHandle, b: Bounds): void;
64
+ destroy(handle: MapHandle): void;
65
+ }
66
+
67
+ export type { Bounds as B, EntityId as E, LatLng as L, MapPoint as M, Page as P, QueryParams as Q, RenderedLayer as R, Unsubscribe as U, MapProvider as a, EntityAdapter as b, MapHandle as c, MapInitOptions as d, PageRequest as e };
@@ -1,6 +1,5 @@
1
1
  import { APIOptions } from '@googlemaps/js-api-loader';
2
- import { M as MapProvider } from '../../map-provider.interface-BMnwW3ob.cjs';
3
- import '../../entity-adapter.interface-BDgbSxhq.cjs';
2
+ import { a as MapProvider } from '../../map-provider.interface-DT-v1plm.cjs';
4
3
 
5
4
  interface GoogleMapsProviderConfig {
6
5
  /** Google Maps JavaScript API key. Required -- there is no hardcoded fallback. */
@@ -1,6 +1,5 @@
1
1
  import { APIOptions } from '@googlemaps/js-api-loader';
2
- import { M as MapProvider } from '../../map-provider.interface-BxexMT3X.js';
3
- import '../../entity-adapter.interface-BDgbSxhq.js';
2
+ import { a as MapProvider } from '../../map-provider.interface-DT-v1plm.js';
4
3
 
5
4
  interface GoogleMapsProviderConfig {
6
5
  /** Google Maps JavaScript API key. Required -- there is no hardcoded fallback. */
@@ -1,2 +1,2 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
- var _chunkRXHR66FScjs = require('../chunk-RXHR66FS.cjs');var _chunkEYXV5OMYcjs = require('../chunk-EYXV5OMY.cjs');var _jsxruntime = require('react/jsx-runtime');function L({children:o}){return _jsxruntime.jsx.call(void 0, _chunkEYXV5OMYcjs.p,{..._chunkRXHR66FScjs.l,children:o})}exports.BottomNav = _chunkRXHR66FScjs.m; exports.BottomSheet = _chunkRXHR66FScjs.n; exports.ListingApp = _chunkRXHR66FScjs.p; exports.StyledCard = _chunkRXHR66FScjs.b; exports.StyledComponentsProviderWithDefaults = L; exports.StyledEmpty = _chunkRXHR66FScjs.c; exports.StyledFilterPanel = _chunkRXHR66FScjs.d; exports.StyledListingLayout = _chunkRXHR66FScjs.o; exports.StyledLoading = _chunkRXHR66FScjs.e; exports.StyledMarker = _chunkRXHR66FScjs.f; exports.StyledPopup = _chunkRXHR66FScjs.g; exports.StyledResultHeader = _chunkRXHR66FScjs.h; exports.StyledSearch = _chunkRXHR66FScjs.i; exports.StyledSidebar = _chunkRXHR66FScjs.j; exports.StyledToolbar = _chunkRXHR66FScjs.k; exports.styledDefaultComponents = _chunkRXHR66FScjs.l;
2
+ var _chunkPE27NATScjs = require('../chunk-PE27NATS.cjs');var _jsxruntime = require('react/jsx-runtime');function L({children:o}){return _jsxruntime.jsx.call(void 0, _chunkPE27NATScjs.p,{..._chunkPE27NATScjs.N,children:o})}exports.BottomNav = _chunkPE27NATScjs.O; exports.BottomSheet = _chunkPE27NATScjs.P; exports.ListingApp = _chunkPE27NATScjs.R; exports.StyledCard = _chunkPE27NATScjs.D; exports.StyledComponentsProviderWithDefaults = L; exports.StyledEmpty = _chunkPE27NATScjs.E; exports.StyledFilterPanel = _chunkPE27NATScjs.F; exports.StyledListingLayout = _chunkPE27NATScjs.Q; exports.StyledLoading = _chunkPE27NATScjs.G; exports.StyledMarker = _chunkPE27NATScjs.H; exports.StyledPopup = _chunkPE27NATScjs.I; exports.StyledResultHeader = _chunkPE27NATScjs.J; exports.StyledSearch = _chunkPE27NATScjs.K; exports.StyledSidebar = _chunkPE27NATScjs.L; exports.StyledToolbar = _chunkPE27NATScjs.M; exports.styledDefaultComponents = _chunkPE27NATScjs.N;
@@ -1,10 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { c as IListingCardProps, e as IListingEmptyProps, f as IListingFilterPanelProps, g as IListingLoadingProps, h as IListingMarkerProps, i as IListingPopupProps, j as IListingResultHeaderProps, k as IListingSearchProps, l as IListingSidebarProps, I as IListingToolbarProps, d as IListingComponents } from '../components-provider-CF0Mo0B8.cjs';
4
- export { B as BottomNav, b as BottomNavView, I as IBottomNavAction, c as IBottomNavProps, d as IStyledListingLayoutProps, L as ListingApp, e as ListingAppMapProp, a as ListingAppProps, S as StyledListingLayout } from '../listing-app-DJbvx3oe.cjs';
5
- import '../entity-adapter.interface-BDgbSxhq.cjs';
6
- import '../map-provider.interface-BMnwW3ob.cjs';
7
- import '../listing-config-options.interface-ZJYY_ZvR.cjs';
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
+ import '../map-provider.interface-DT-v1plm.cjs';
8
6
 
9
7
  /**
10
8
  * Default `/styled` `Card` slot. Renders an optional image, title, subtitle,
@@ -35,7 +33,7 @@ declare function StyledMarker({ point }: IListingMarkerProps): react.JSX.Element
35
33
  * accessible close button. `role="group"` + `aria-label` (rather than
36
34
  * `role="dialog"`) since this is a non-modal, non-focus-trapped popup
37
35
  * anchored to a map marker -- `dialog` without modality/focus management
38
- * would misrepresent it to AT users. Mirrors `/shadcn`'s `DefaultPopup`.
36
+ * would misrepresent it to AT users.
39
37
  */
40
38
  declare function StyledPopup({ entity, onClose }: IListingPopupProps): react.JSX.Element;
41
39
 
@@ -58,7 +56,7 @@ declare function StyledToolbar({ children }: IListingToolbarProps): react.JSX.El
58
56
  * of the box -- pair it with `import 'react-listing-engine/styles.css'`; use
59
57
  * `ListingComponentsProvider` directly (with your own components for some or
60
58
  * all slots) otherwise -- the two compose fine since `ListingComponentsProvider`
61
- * falls back per-slot. Mirrors `/shadcn`'s `ListingComponentsProviderWithDefaults`.
59
+ * falls back per-slot.
62
60
  */
63
61
  declare function StyledComponentsProviderWithDefaults({ children }: {
64
62
  children: ReactNode;
@@ -66,8 +64,7 @@ declare function StyledComponentsProviderWithDefaults({ children }: {
66
64
 
67
65
  /**
68
66
  * Every `/styled` default, keyed by slot -- the single source of truth for
69
- * `StyledComponentsProviderWithDefaults`, mirroring `/shadcn`'s
70
- * `shadcnDefaultComponents`.
67
+ * `StyledComponentsProviderWithDefaults`.
71
68
  *
72
69
  * Kept as a plain object, not JSX, so a caller can merge it with
73
70
  * `{ ...styledDefaultComponents, ...overrides }` and hand the result to ONE
@@ -91,7 +88,7 @@ interface IBottomSheetProps {
91
88
  /**
92
89
  * Dependency-free mobile bottom sheet -- the `/styled` adapter's own modal
93
90
  * primitive, used by `StyledListingLayout` for the mobile filters panel.
94
- * Deliberately NOT the `~/shadcn` adapter's Radix-based `Sheet`: `/styled`
91
+ * Deliberately dependency-free (no Radix or other UI-library sheet): `/styled`
95
92
  * ships zero UI dependencies beyond `react`/`react-dom`, so this is a small
96
93
  * hand-rolled implementation covering just what a filters sheet needs --
97
94
  * portal, backdrop-click/Escape-to-close, a body-scroll lock, and the
@@ -1,10 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { c as IListingCardProps, e as IListingEmptyProps, f as IListingFilterPanelProps, g as IListingLoadingProps, h as IListingMarkerProps, i as IListingPopupProps, j as IListingResultHeaderProps, k as IListingSearchProps, l as IListingSidebarProps, I as IListingToolbarProps, d as IListingComponents } from '../components-provider-CjMxkxrP.js';
4
- export { B as BottomNav, b as BottomNavView, I as IBottomNavAction, c as IBottomNavProps, d as IStyledListingLayoutProps, L as ListingApp, e as ListingAppMapProp, a as ListingAppProps, S as StyledListingLayout } from '../listing-app-wmMuDlVU.js';
5
- import '../entity-adapter.interface-BDgbSxhq.js';
6
- import '../map-provider.interface-BxexMT3X.js';
7
- import '../listing-config-options.interface-ZJYY_ZvR.js';
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
+ import '../map-provider.interface-DT-v1plm.js';
8
6
 
9
7
  /**
10
8
  * Default `/styled` `Card` slot. Renders an optional image, title, subtitle,
@@ -35,7 +33,7 @@ declare function StyledMarker({ point }: IListingMarkerProps): react.JSX.Element
35
33
  * accessible close button. `role="group"` + `aria-label` (rather than
36
34
  * `role="dialog"`) since this is a non-modal, non-focus-trapped popup
37
35
  * anchored to a map marker -- `dialog` without modality/focus management
38
- * would misrepresent it to AT users. Mirrors `/shadcn`'s `DefaultPopup`.
36
+ * would misrepresent it to AT users.
39
37
  */
40
38
  declare function StyledPopup({ entity, onClose }: IListingPopupProps): react.JSX.Element;
41
39
 
@@ -58,7 +56,7 @@ declare function StyledToolbar({ children }: IListingToolbarProps): react.JSX.El
58
56
  * of the box -- pair it with `import 'react-listing-engine/styles.css'`; use
59
57
  * `ListingComponentsProvider` directly (with your own components for some or
60
58
  * all slots) otherwise -- the two compose fine since `ListingComponentsProvider`
61
- * falls back per-slot. Mirrors `/shadcn`'s `ListingComponentsProviderWithDefaults`.
59
+ * falls back per-slot.
62
60
  */
63
61
  declare function StyledComponentsProviderWithDefaults({ children }: {
64
62
  children: ReactNode;
@@ -66,8 +64,7 @@ declare function StyledComponentsProviderWithDefaults({ children }: {
66
64
 
67
65
  /**
68
66
  * Every `/styled` default, keyed by slot -- the single source of truth for
69
- * `StyledComponentsProviderWithDefaults`, mirroring `/shadcn`'s
70
- * `shadcnDefaultComponents`.
67
+ * `StyledComponentsProviderWithDefaults`.
71
68
  *
72
69
  * Kept as a plain object, not JSX, so a caller can merge it with
73
70
  * `{ ...styledDefaultComponents, ...overrides }` and hand the result to ONE
@@ -91,7 +88,7 @@ interface IBottomSheetProps {
91
88
  /**
92
89
  * Dependency-free mobile bottom sheet -- the `/styled` adapter's own modal
93
90
  * primitive, used by `StyledListingLayout` for the mobile filters panel.
94
- * Deliberately NOT the `~/shadcn` adapter's Radix-based `Sheet`: `/styled`
91
+ * Deliberately dependency-free (no Radix or other UI-library sheet): `/styled`
95
92
  * ships zero UI dependencies beyond `react`/`react-dom`, so this is a small
96
93
  * hand-rolled implementation covering just what a filters sheet needs --
97
94
  * portal, backdrop-click/Escape-to-close, a body-scroll lock, and the
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{b as r,c as p,d as i,e as d,f as y,g as l,h as n,i as m,j as s,k as a,l as t,m as S,n as f,o as P,p as u}from"../chunk-CGT3RHJ7.js";import{p as e}from"../chunk-R3FX2V3N.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};
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};
@@ -1,5 +1,4 @@
1
- import { B as Bounds, a as EntityAdapter, L as LatLng, E as EntityId, b as PageRequest, P as Page, M as MapPoint } from '../entity-adapter.interface-BDgbSxhq.cjs';
2
- import { M as MapProvider, a as MapHandle, R as RenderedLayer, b as MapInitOptions, U as Unsubscribe } from '../map-provider.interface-BMnwW3ob.cjs';
1
+ import { a as MapProvider, c as MapHandle, R as RenderedLayer, B as Bounds, d as MapInitOptions, U as Unsubscribe, b as EntityAdapter, L as LatLng, E as EntityId, e as PageRequest, P as Page, M as MapPoint } from '../map-provider.interface-DT-v1plm.cjs';
3
2
 
4
3
  type BoundsListener = (b: Bounds) => void;
5
4
  /**
@@ -1,5 +1,4 @@
1
- import { B as Bounds, a as EntityAdapter, L as LatLng, E as EntityId, b as PageRequest, P as Page, M as MapPoint } from '../entity-adapter.interface-BDgbSxhq.js';
2
- import { M as MapProvider, a as MapHandle, R as RenderedLayer, b as MapInitOptions, U as Unsubscribe } from '../map-provider.interface-BxexMT3X.js';
1
+ import { a as MapProvider, c as MapHandle, R as RenderedLayer, B as Bounds, d as MapInitOptions, U as Unsubscribe, b as EntityAdapter, L as LatLng, E as EntityId, e as PageRequest, P as Page, M as MapPoint } from '../map-provider.interface-DT-v1plm.js';
3
2
 
4
3
  type BoundsListener = (b: Bounds) => void;
5
4
  /**
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "react-listing-engine",
3
- "version": "0.6.4",
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 shadcn-compatible styled adapter.",
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",
@@ -59,11 +53,6 @@
59
53
  "import": "./dist/maps/google/index.js",
60
54
  "require": "./dist/maps/google/index.cjs"
61
55
  },
62
- "./presets/rental": {
63
- "types": "./dist/presets/rental/index.d.ts",
64
- "import": "./dist/presets/rental/index.js",
65
- "require": "./dist/presets/rental/index.cjs"
66
- },
67
56
  "./testing": {
68
57
  "types": "./dist/testing/index.d.ts",
69
58
  "import": "./dist/testing/index.js",
@@ -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;
@@ -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};
@@ -1,2 +0,0 @@
1
- "use client";
2
- var i=class{mode;constructor(e={}){this.mode=e.mode??"replace"}getQuery(){if(typeof window>"u")return{};let e=new URLSearchParams(window.location.search),t={};for(let[r,o]of e)o!==""&&(t[r]=o);return t}setQuery(e){if(typeof window>"u")return;let t=new URLSearchParams;for(let[a,n]of Object.entries(e))n===void 0||n===""||t.set(a,n);let r=t.toString(),o=r?`?${r}`:"";if(o===window.location.search)return;let s=`${window.location.pathname}${o}${window.location.hash}`;this.mode==="push"?window.history.pushState(window.history.state,"",s):window.history.replaceState(window.history.state,"",s)}subscribe(e){return typeof window>"u"?()=>{}:(window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e)})}};export{i as a};
@@ -1,2 +0,0 @@
1
- "use client";
2
- import{clsx as t}from"clsx";import{twMerge as e}from"tailwind-merge";function l(...r){return e(t(r))}export{l as a};
@@ -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};
@@ -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(); } }"use client";
2
- var i=class{constructor(e={}){this.mode=_nullishCoalesce(e.mode, () => ("replace"))}getQuery(){if(typeof window>"u")return{};let e=new URLSearchParams(window.location.search),t={};for(let[r,o]of e)o!==""&&(t[r]=o);return t}setQuery(e){if(typeof window>"u")return;let t=new URLSearchParams;for(let[a,n]of Object.entries(e))n===void 0||n===""||t.set(a,n);let r=t.toString(),o=r?`?${r}`:"";if(o===window.location.search)return;let s=`${window.location.pathname}${o}${window.location.hash}`;this.mode==="push"?window.history.pushState(window.history.state,"",s):window.history.replaceState(window.history.state,"",s)}subscribe(e){return typeof window>"u"?()=>{}:(window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e)})}};exports.a = i;
@@ -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;
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
- var _clsx = require('clsx');var _tailwindmerge = require('tailwind-merge');function l(...r){return _tailwindmerge.twMerge.call(void 0, _clsx.clsx.call(void 0, r))}exports.a = l;
@@ -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};
@@ -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;