@mapfirst.ai/react 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +27 -2
- package/dist/index.d.ts +27 -2
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -78,7 +78,6 @@ declare const SearchIcon: React__default.FC<IconProps>;
|
|
|
78
78
|
declare const CloseIcon: React__default.FC<IconProps>;
|
|
79
79
|
declare const EditIcon: React__default.FC<IconProps>;
|
|
80
80
|
declare const NextIcon: React__default.FC<IconProps>;
|
|
81
|
-
declare const AiIcon: React__default.FC<IconProps>;
|
|
82
81
|
declare const StarIcon: React__default.FC<IconProps & {
|
|
83
82
|
fill?: string;
|
|
84
83
|
}>;
|
|
@@ -477,6 +476,32 @@ declare function useSmartFilterSearch(mapFirst: MapFirstCore | null): {
|
|
|
477
476
|
isLoading: boolean;
|
|
478
477
|
error: Error | null;
|
|
479
478
|
};
|
|
479
|
+
/**
|
|
480
|
+
* Hook to perform a bounds search when the user moves the map
|
|
481
|
+
*
|
|
482
|
+
* @example
|
|
483
|
+
* ```tsx
|
|
484
|
+
* const { mapFirst, state } = useMapFirstCore({ ... });
|
|
485
|
+
* const { performBoundsSearch, isSearching } = useMapFirstBoundsSearch(mapFirst);
|
|
486
|
+
*
|
|
487
|
+
* // When user clicks "Search this area" button
|
|
488
|
+
* <button onClick={performBoundsSearch} disabled={!state.pendingBounds || isSearching}>
|
|
489
|
+
* Search this area
|
|
490
|
+
* </button>
|
|
491
|
+
* ```
|
|
492
|
+
*/
|
|
493
|
+
declare function useMapFirstBoundsSearch(mapFirst: MapFirstCore | null): {
|
|
494
|
+
performBoundsSearch: () => Promise<{
|
|
495
|
+
location_id?: number;
|
|
496
|
+
filters: _mapfirst_ai_core.FilterSchema;
|
|
497
|
+
properties: Property[];
|
|
498
|
+
isComplete: boolean | undefined;
|
|
499
|
+
pollingLink: string | undefined;
|
|
500
|
+
durationSeconds: number;
|
|
501
|
+
} | null>;
|
|
502
|
+
isSearching: boolean;
|
|
503
|
+
error: Error | null;
|
|
504
|
+
};
|
|
480
505
|
/**
|
|
481
506
|
* Helper component that simply renders the markers it receives so non-React environments
|
|
482
507
|
* can verify data flows before wiring the SDK into a map.
|
|
@@ -485,4 +510,4 @@ declare function MarkerDebugList({ markers }: {
|
|
|
485
510
|
markers: Property[];
|
|
486
511
|
}): react_jsx_runtime.JSX.Element;
|
|
487
512
|
|
|
488
|
-
export {
|
|
513
|
+
export { Chip, type ChipProps, CloseIcon, EditIcon, type Filter, FilterChips, type FilterChipsProps, type IconProps, type Locale, MarkerDebugList, MinRatingFilterChip, NextIcon, PriceRangeFilterChip, type PriceRangeValue, RestaurantPriceLevelChip, type RestaurantPriceLevelChipProps, SearchIcon, SmartFilter$1 as SmartFilter, type SmartFilterProps, StarIcon, TransformedQueryChip, type TransformedQueryChipProps, createMinRatingFilterLabel, createPriceRangeFilterLabel, formatRatingValue, renderStars, useFilterScroll, useGoogleMapsAttachment, useIsPortrait, useMapFirst, useMapFirstBoundsSearch, useMapFirstCore, useMapFirstProperties, useMapFirstSelectedProperty, useMapLibreAttachment, useMapboxAttachment, usePrimaryType, usePropertiesSearch, useSelectedMarker, useSmartFilterSearch, useTranslation };
|
package/dist/index.d.ts
CHANGED
|
@@ -78,7 +78,6 @@ declare const SearchIcon: React__default.FC<IconProps>;
|
|
|
78
78
|
declare const CloseIcon: React__default.FC<IconProps>;
|
|
79
79
|
declare const EditIcon: React__default.FC<IconProps>;
|
|
80
80
|
declare const NextIcon: React__default.FC<IconProps>;
|
|
81
|
-
declare const AiIcon: React__default.FC<IconProps>;
|
|
82
81
|
declare const StarIcon: React__default.FC<IconProps & {
|
|
83
82
|
fill?: string;
|
|
84
83
|
}>;
|
|
@@ -477,6 +476,32 @@ declare function useSmartFilterSearch(mapFirst: MapFirstCore | null): {
|
|
|
477
476
|
isLoading: boolean;
|
|
478
477
|
error: Error | null;
|
|
479
478
|
};
|
|
479
|
+
/**
|
|
480
|
+
* Hook to perform a bounds search when the user moves the map
|
|
481
|
+
*
|
|
482
|
+
* @example
|
|
483
|
+
* ```tsx
|
|
484
|
+
* const { mapFirst, state } = useMapFirstCore({ ... });
|
|
485
|
+
* const { performBoundsSearch, isSearching } = useMapFirstBoundsSearch(mapFirst);
|
|
486
|
+
*
|
|
487
|
+
* // When user clicks "Search this area" button
|
|
488
|
+
* <button onClick={performBoundsSearch} disabled={!state.pendingBounds || isSearching}>
|
|
489
|
+
* Search this area
|
|
490
|
+
* </button>
|
|
491
|
+
* ```
|
|
492
|
+
*/
|
|
493
|
+
declare function useMapFirstBoundsSearch(mapFirst: MapFirstCore | null): {
|
|
494
|
+
performBoundsSearch: () => Promise<{
|
|
495
|
+
location_id?: number;
|
|
496
|
+
filters: _mapfirst_ai_core.FilterSchema;
|
|
497
|
+
properties: Property[];
|
|
498
|
+
isComplete: boolean | undefined;
|
|
499
|
+
pollingLink: string | undefined;
|
|
500
|
+
durationSeconds: number;
|
|
501
|
+
} | null>;
|
|
502
|
+
isSearching: boolean;
|
|
503
|
+
error: Error | null;
|
|
504
|
+
};
|
|
480
505
|
/**
|
|
481
506
|
* Helper component that simply renders the markers it receives so non-React environments
|
|
482
507
|
* can verify data flows before wiring the SDK into a map.
|
|
@@ -485,4 +510,4 @@ declare function MarkerDebugList({ markers }: {
|
|
|
485
510
|
markers: Property[];
|
|
486
511
|
}): react_jsx_runtime.JSX.Element;
|
|
487
512
|
|
|
488
|
-
export {
|
|
513
|
+
export { Chip, type ChipProps, CloseIcon, EditIcon, type Filter, FilterChips, type FilterChipsProps, type IconProps, type Locale, MarkerDebugList, MinRatingFilterChip, NextIcon, PriceRangeFilterChip, type PriceRangeValue, RestaurantPriceLevelChip, type RestaurantPriceLevelChipProps, SearchIcon, SmartFilter$1 as SmartFilter, type SmartFilterProps, StarIcon, TransformedQueryChip, type TransformedQueryChipProps, createMinRatingFilterLabel, createPriceRangeFilterLabel, formatRatingValue, renderStars, useFilterScroll, useGoogleMapsAttachment, useIsPortrait, useMapFirst, useMapFirstBoundsSearch, useMapFirstCore, useMapFirstProperties, useMapFirstSelectedProperty, useMapLibreAttachment, useMapboxAttachment, usePrimaryType, usePropertiesSearch, useSelectedMarker, useSmartFilterSearch, useTranslation };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";var Ee=Object.create;var J=Object.defineProperty;var Me=Object.getOwnPropertyDescriptor;var Ie=Object.getOwnPropertyNames;var Te=Object.getPrototypeOf,Be=Object.prototype.hasOwnProperty;var He=(e,t)=>{for(var o in t)J(e,o,{get:t[o],enumerable:!0})},Se=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ie(t))!Be.call(e,i)&&i!==o&&J(e,i,{get:()=>t[i],enumerable:!(s=Me(t,i))||s.enumerable});return e};var ee=(e,t,o)=>(o=e!=null?Ee(Te(e)):{},Se(t||!e||!e.__esModule?J(o,"default",{value:e,enumerable:!0}):o,e)),Ne=e=>Se(J({},"__esModule",{value:!0}),e);var kt={};He(kt,{AiIcon:()=>fe,Chip:()=>re,CloseIcon:()=>D,EditIcon:()=>G,FilterChips:()=>pe,MarkerDebugList:()=>Pt,MinRatingFilterChip:()=>Z,NextIcon:()=>te,PriceRangeFilterChip:()=>ie,RestaurantPriceLevelChip:()=>se,SearchIcon:()=>j,SmartFilter:()=>Le,StarIcon:()=>ye,TransformedQueryChip:()=>ae,createMinRatingFilterLabel:()=>_e,createPriceRangeFilterLabel:()=>Ve,formatRatingValue:()=>ne,renderStars:()=>Ce,useFilterScroll:()=>le,useGoogleMapsAttachment:()=>bt,useIsPortrait:()=>de,useMapFirst:()=>St,useMapFirstCore:()=>dt,useMapFirstProperties:()=>mt,useMapFirstSelectedProperty:()=>gt,useMapLibreAttachment:()=>ht,useMapboxAttachment:()=>xt,usePrimaryType:()=>ft,usePropertiesSearch:()=>vt,useSelectedMarker:()=>yt,useSmartFilterSearch:()=>Ct,useTranslation:()=>I});module.exports=Ne(kt);var g=ee(require("react")),xe=require("@mapfirst.ai/core");var $=require("react");var P=require("react/jsx-runtime"),j=({className:e,style:t})=>(0,P.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:[(0,P.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,P.jsx)("path",{d:"m21 21-4.35-4.35"})]}),D=({className:e,style:t})=>(0,P.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:[(0,P.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,P.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),G=({className:e,style:t})=>(0,P.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:[(0,P.jsx)("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),(0,P.jsx)("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),te=({className:e,style:t})=>(0,P.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:(0,P.jsx)("polyline",{points:"9 18 15 12 9 6"})}),fe=({className:e,style:t})=>(0,P.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:[(0,P.jsx)("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),(0,P.jsx)("path",{d:"M2 17l10 5 10-5"}),(0,P.jsx)("path",{d:"M2 12l10 5 10-5"})]}),ye=({className:e,style:t,fill:o="none"})=>(0,P.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:o,stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:(0,P.jsx)("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})});var ce=ee(require("react"));var ve=ee(require("react"));var V=require("react/jsx-runtime"),De={position:"relative",backgroundColor:"white",color:"black",fontSize:"14px",borderRadius:"9999px",padding:"0 16px",paddingRight:"20px",border:"1px solid #03852e",display:"flex",alignItems:"center",gap:"8px",flexShrink:0,height:"34px"},Ae={position:"absolute",top:"-8px",right:"-8px",padding:"2px",borderRadius:"50%",backgroundColor:"white",border:"1px solid #03852e",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s"},ze={width:"17px",height:"17px"},re=({label:e,icon:t,remove:o,style:s})=>{let[i,p]=ve.default.useState(!1);return(0,V.jsxs)("div",{style:{...De,...s},children:[t&&(0,V.jsx)("span",{style:{display:"flex",alignItems:"center"},children:t}),(0,V.jsx)("span",{style:{whiteSpace:"nowrap"},children:e}),(0,V.jsx)("button",{style:{...Ae,backgroundColor:i?"#e5e5e5":"white"},onClick:o,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),"aria-label":"Remove filter",children:(0,V.jsx)(D,{style:ze})})]})};var be=require("react");var U=require("react"),We={"smartFilter.placeholder":"Search for hotels, restaurants, or attractions...","smartFilter.typingPrompt":"Type to search...","smartFilter.nav.previous":"Previous filters","smartFilter.nav.next":"Next filters","smartFilter.toast.locationRequired":"Please select a location first","smartFilter.clearAll":"Clear all","smartFilter.minRating.suffix":"+","smartFilter.minRating.label":"{{value}}+","smartFilter.minRating.remove":"Remove rating filter","smartFilter.minRating.setTo":"Set rating to {{rating}}","smartFilter.priceRange.label":"Price Range","smartFilter.priceRange.remove":"Remove price filter","smartFilter.priceRange.edit":"Edit price","smartFilter.transformedQuery.remove":"Remove search query","smartFilter.transformedQuery.edit":"Edit search query","smartFilter.restaurantPriceLevel.label":"Price Level","smartFilter.restaurantPriceLevel.remove":"Remove price level filter","smartFilter.restaurantPriceLevel.none":"Any","smartFilter.restaurantPriceLevel.options.cheapEats":"Cheap Eats","smartFilter.restaurantPriceLevel.options.midRange":"Mid Range","smartFilter.restaurantPriceLevel.options.fineDining":"Fine Dining"},Oe=(e,t="USD")=>new Intl.NumberFormat("en-US",{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:0}).format(e),I=(e,t)=>{let[o,s]=(0,U.useState)("en"),i=(0,U.useCallback)((u,c)=>{let n={...We,...e}[u]||u;return c&&Object.keys(c).forEach(a=>{n=n.replace(new RegExp(`{{${a}}}`,"g"),String(c[a]))}),n},[e]),p=(0,U.useCallback)((u,c)=>t?t(u,c):Oe(u,c),[t]);return{t:i,locale:o,setLocale:s,formatCurrency:p}};var q=require("react/jsx-runtime"),Ce=e=>{let t=[],o=Math.floor(e),s=e%1!==0,i={display:"block",width:"12px",height:"12px",borderRadius:"50%",border:"1px solid #03852e",pointerEvents:"none"},p={...i,backgroundColor:"#03852e"},u={...i,background:"linear-gradient(90deg, #03852e 50%, transparent 50%)"};for(let r=0;r<o;r+=1)t.push((0,q.jsx)("span",{style:p},`full-${r}`));s&&t.push((0,q.jsx)("span",{style:u},"half"));let c=Math.max(0,5-Math.ceil(e));for(let r=0;r<c;r+=1)t.push((0,q.jsx)("span",{style:i},`empty-${r}`));return t},_e=(e,t)=>(0,q.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[(0,q.jsx)("span",{style:{display:"flex",gap:"1px",userSelect:"none"},children:Ce(e)})," ",t]}),ne=e=>e.toFixed(1),Ve=(e,t,o,s)=>`${s(e,o)} - ${s(t!=null?t:0,o)}`;var M=require("react/jsx-runtime"),qe={position:"relative",backgroundColor:"white",color:"black",fontSize:"14px",borderRadius:"9999px",padding:"0 16px",paddingRight:"20px",border:"1px solid #03852e",display:"flex",gap:"8px",alignItems:"center",justifyContent:"center",flexShrink:0,height:"34px"},Qe={position:"absolute",top:"-8px",right:"-8px",padding:"2px",borderRadius:"50%",backgroundColor:"white",border:"1px solid #03852e",cursor:"pointer",transition:"background-color 0.2s"},Ke={display:"flex",gap:"1px",userSelect:"none"},he={display:"block",width:"12px",height:"12px",borderRadius:"50%",border:"1px solid #03852e",pointerEvents:"none"},oe={position:"absolute",top:0,height:"100%",cursor:"pointer",backgroundColor:"transparent",border:"none",padding:0},Z=({rating:e,onChange:t,onRemove:o,star:s=!1})=>{let[i,p]=(0,be.useState)(null),[u,c]=(0,be.useState)(!1),{t:r}=I(),n=i!=null?i:e,a=f=>s&&f?f.toString():r("smartFilter.minRating.label",{value:ne(f)}),l=r("smartFilter.minRating.remove"),m=f=>r("smartFilter.minRating.setTo",{rating:ne(f)}),F=f=>{let S=f+1;return n>=S?"full":n>=S-.5?"half":"empty"},v=f=>{p(null),f!==e&&t(f)},k=f=>{var x;let S=f.relatedTarget;(!S||!((x=f.currentTarget.closest("[data-min-rating-chip]"))!=null&&x.contains(S)))&&p(null)};return(0,M.jsxs)("div",{style:qe,"data-min-rating-chip":!0,children:[(0,M.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"4px"},onMouseLeave:()=>p(null),children:[(0,M.jsx)("div",{style:Ke,children:Array.from({length:5}).map((f,S)=>{let x=F(S),h=S+1,w=h-.5;if(s)return(0,M.jsxs)("div",{style:{position:"relative",width:"16px",height:"16px"},children:[(0,M.jsx)(ye,{fill:n>=h?"#03852e":"none",style:{width:"16px",height:"16px",pointerEvents:"none"}}),(0,M.jsx)("button",{type:"button",style:{...oe,left:0,width:"50%",borderRadius:"50% 0 0 50%"},onMouseEnter:()=>p(w),onFocus:()=>p(w),onBlur:k,onClick:()=>v(w),"aria-label":m(w),title:a(w)}),(0,M.jsx)("button",{type:"button",style:{...oe,left:"50%",width:"50%",borderRadius:"0 50% 50% 0"},onMouseEnter:()=>p(h),onFocus:()=>p(h),onBlur:k,onClick:()=>v(h),"aria-label":m(h),title:a(h)})]},S);let N=x==="full"?{...he,backgroundColor:"#03852e"}:he,_={...he,background:"linear-gradient(90deg, #03852e 50%, transparent 50%)"};return(0,M.jsxs)("div",{style:{position:"relative",width:"12px",height:"12px"},children:[(0,M.jsx)("span",{style:x==="half"?_:N}),(0,M.jsx)("button",{type:"button",style:{...oe,left:0,width:"50%",borderRadius:"50% 0 0 50%",outline:"2px solid transparent",outlineOffset:"1px"},onMouseEnter:()=>p(w),onFocus:()=>p(w),onBlur:k,onClick:()=>v(w),"aria-label":m(w),title:a(w)}),(0,M.jsx)("button",{type:"button",style:{...oe,left:"50%",width:"50%",borderRadius:"0 50% 50% 0",outline:"2px solid transparent",outlineOffset:"1px"},onMouseEnter:()=>p(h),onFocus:()=>p(h),onBlur:k,onClick:()=>v(h),"aria-label":m(h),title:a(h)})]},S)})}),(0,M.jsx)("span",{style:{whiteSpace:"nowrap"},children:a(n)})]}),(0,M.jsx)("button",{style:{...Qe,backgroundColor:u?"#e5e5e5":"white"},onClick:o,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),"aria-label":l,title:l,children:(0,M.jsx)(D,{style:{width:"17px",height:"17px"}})})]})};var Q=require("react");var R=require("react/jsx-runtime"),$e={position:"relative",backgroundColor:"white",color:"black",fontSize:"14px",borderRadius:"9999px",padding:"0 16px",border:"1px solid #03852e",display:"flex",alignItems:"center",gap:"8px",flexShrink:0,height:"34px"},Ye={position:"absolute",top:"-8px",right:"-8px",padding:"2px",borderRadius:"50%",backgroundColor:"white",border:"1px solid #03852e",cursor:"pointer",transition:"background-color 0.2s"},je={outline:"none",fontSize:"16px",backgroundColor:"transparent",borderRadius:"2px",padding:"2px 8px",width:"64px",textAlign:"center",border:"none"},Ge={padding:"4px",borderRadius:"50%",cursor:"pointer",transition:"background-color 0.2s",border:"none",backgroundColor:"transparent",color:"#737373",display:"flex",alignItems:"center",justifyContent:"center"},Pe=({boundary:e,label:t,value:o,placeholder:s,currency:i,isOptional:p=!1,showRemoveButton:u=!1,removeLabel:c,editLabel:r,showAddWhenEmpty:n=!1,onCommit:a,onRemove:l})=>{let[m,F]=(0,Q.useState)(o!==void 0?String(o):""),[v,k]=(0,Q.useState)(!1),[f,S]=(0,Q.useState)(!1),[x,h]=(0,Q.useState)(!1),w=o!==void 0;(0,Q.useEffect)(()=>{F(o!==void 0?String(o):""),k(!1)},[o]);let N=()=>{F(o!==void 0?String(o):"")},_=()=>{if(m.trim()===""){if(p){a(void 0),F("");return}N();return}let y=Number(m);if(!Number.isFinite(y)){N();return}let A=Math.max(0,y);if(A===o){N();return}a(A)};return(0,R.jsxs)("div",{style:$e,children:[(0,R.jsx)("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},children:t}),v?(0,R.jsx)("input",{value:m,onChange:y=>{let A=y.target.value.replace(/[^\d]/g,"");F(A)},onBlur:()=>{_(),k(!1)},onKeyDown:y=>{if(y.key==="Enter"){y.preventDefault(),y.currentTarget.blur(),k(!1);return}if(y.key==="Escape"){y.preventDefault(),N(),y.currentTarget.blur(),k(!1);return}y.key.length===1&&/[0-9]/.test(y.key)||y.key==="Backspace"||y.key==="Delete"||y.key==="Tab"||y.key==="ArrowLeft"||y.key==="ArrowRight"||y.key==="Home"||y.key==="End"||y.preventDefault()},placeholder:s,inputMode:"numeric",pattern:"[0-9]*","aria-label":t,style:je,autoFocus:!0}):w?(0,R.jsxs)("span",{style:{fontSize:"16px"},children:[i,o]}):n?(0,R.jsx)("button",{type:"button",style:{fontSize:"16px",color:"#737373",cursor:"pointer",border:"none",backgroundColor:"transparent",padding:0},onClick:()=>k(!0),"aria-label":r,children:"+"}):(0,R.jsx)("span",{style:{fontSize:"16px",color:"#737373"},children:"-"}),(!n||n&&v)&&(0,R.jsx)("span",{style:{color:"#737373",fontSize:"12px"},children:i}),!v&&(!n||w)&&(0,R.jsx)("button",{type:"button",style:{...Ge,backgroundColor:f?"#e5e5e5":"transparent"},"aria-label":r,title:r,onClick:()=>k(!0),onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1),children:(0,R.jsx)(G,{})}),u&&(0,R.jsx)("button",{style:{...Ye,backgroundColor:x?"#e5e5e5":"white"},onClick:l,onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),"aria-label":c,title:c,children:(0,R.jsx)(D,{style:{width:"17px",height:"17px"}})})]})},ie=({priceRange:e,currency:t,onChange:o,onRemove:s})=>{let{t:i}=I(),p="Min",u="Max",c=i("smartFilter.priceRange.remove"),r=i("smartFilter.priceRange.edit"),n=(a,l)=>{let m={min:e.min,max:e.max};a==="min"?(m.min=l,l!==void 0&&e.max!==void 0&&l>e.max&&(m.max=l)):(m.max=l,l!==void 0&&e.min!==void 0&&l<e.min&&(m.min=l)),(m.min!==e.min||m.max!==e.max)&&o(m)};return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Pe,{boundary:"min",label:p,value:e.min,currency:t,editLabel:r,showRemoveButton:e.min!==void 0&&e.min!==0,onCommit:a=>n("min",a),onRemove:s}),(0,R.jsx)(Pe,{boundary:"max",label:u,value:e.max,currency:t,isOptional:!0,showRemoveButton:e.max!==void 0,removeLabel:c,editLabel:r,showAddWhenEmpty:!0,onCommit:a=>n("max",a),onRemove:s})]})};var Re=ee(require("react"));var B=require("react/jsx-runtime"),Ue={position:"relative",backgroundColor:"white",color:"black",fontSize:"14px",borderRadius:"9999px",padding:"0 16px",paddingRight:"20px",border:"1px solid #03852e",display:"flex",alignItems:"center",gap:"16px",flexShrink:0,height:"34px"},Ze={position:"absolute",top:"-8px",right:"-8px",padding:"2px",borderRadius:"50%",backgroundColor:"white",border:"1px solid #03852e",cursor:"pointer",transition:"background-color 0.2s"},ke=[{value:"Cheap Eats",key:"cheapEats"},{value:"Mid Range",key:"midRange"},{value:"Fine Dining",key:"fineDining"}],se=({values:e,onChange:t,onRemove:o})=>{let{t:s}=I(),[i,p]=Re.default.useState(!1),u=s("smartFilter.restaurantPriceLevel.label"),c=s("smartFilter.restaurantPriceLevel.remove"),r=s("smartFilter.restaurantPriceLevel.none"),n=a=>{let{value:l,checked:m}=a.target,F=l,v=new Set(e);m?v.add(F):v.delete(F);let k=ke.filter(f=>v.has(f.value)).map(f=>f.value);t(k)};return(0,B.jsxs)("div",{style:Ue,children:[(0,B.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[(0,B.jsx)("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},children:u}),(0,B.jsxs)("div",{style:{display:"flex",gap:"12px"},children:[ke.map(a=>{let l=s(`smartFilter.restaurantPriceLevel.options.${a.key}`),m=`price-level-${a.key}`;return(0,B.jsxs)("label",{htmlFor:m,style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"12px",cursor:"pointer"},children:[(0,B.jsx)("input",{id:m,type:"checkbox",value:a.value,checked:e.includes(a.value),onChange:n,style:{accentColor:"#03852e",cursor:"pointer"}}),(0,B.jsx)("span",{children:l})]},a.value)}),e.length===0&&(0,B.jsx)("span",{style:{fontSize:"12px",color:"#737373"},children:r})]})]}),(0,B.jsx)("button",{style:{...Ze,backgroundColor:i?"#e5e5e5":"white"},onClick:o,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),"aria-label":c!=null?c:u,title:c!=null?c:u,children:(0,B.jsx)(D,{style:{width:"17px",height:"17px"}})})]})};var O=require("react");var z=require("react/jsx-runtime"),Xe={position:"relative",backgroundColor:"white",color:"black",fontSize:"14px",borderRadius:"9999px",padding:"0 16px",paddingRight:"20px",border:"1px solid #03852e",display:"flex",alignItems:"center",gap:"8px",flexShrink:0,userSelect:"none",height:"34px"},Je={position:"absolute",top:"-8px",right:"-8px",padding:"2px",borderRadius:"50%",backgroundColor:"white",border:"1px solid #03852e",cursor:"pointer",transition:"background-color 0.2s"},et={backgroundColor:"#ececec",borderRadius:"2px",padding:"2px 8px",outline:"none",fontSize:"16px",minWidth:"8ch",border:"none"},tt={padding:"4px",borderRadius:"50%",cursor:"pointer",transition:"background-color 0.2s",color:"#737373",border:"none",backgroundColor:"transparent",display:"flex",alignItems:"center",justifyContent:"center"},ae=({value:e,onChange:t,onRemove:o})=>{let s=(0,O.useRef)(null),[i,p]=(0,O.useState)(e),[u,c]=(0,O.useState)(!1),[r,n]=(0,O.useState)(!1),[a,l]=(0,O.useState)(!1),{t:m}=I(),F=m("smartFilter.transformedQuery.remove"),v=m("smartFilter.transformedQuery.edit");(0,O.useEffect)(()=>{p(e),c(!1)},[e]);let k=()=>{let x=i.trim();if(!x.length){p(e);return}x!==e&&t(x)};return(0,z.jsxs)("div",{style:Xe,children:[(0,z.jsx)(j,{style:{width:"16px",height:"16px",color:"#03852e"}}),u?(0,z.jsx)("input",{ref:s,value:i,onChange:x=>{p(x.target.value)},onBlur:()=>{k(),c(!1)},onKeyDown:x=>{if(x.key==="Enter"){x.preventDefault(),x.currentTarget.blur();return}if(x.key==="Escape"){x.preventDefault(),p(e),x.currentTarget.blur();return}},"aria-label":v,style:et,autoFocus:!0}):(0,z.jsx)("span",{style:{fontSize:"16px"},children:e}),!u&&(0,z.jsx)("button",{type:"button",style:{...tt,backgroundColor:r?"#e5e5e5":"transparent"},"aria-label":v,title:v,onClick:()=>c(!0),onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:(0,z.jsx)(G,{})}),(0,z.jsx)("button",{style:{...Je,backgroundColor:a?"#e5e5e5":"white"},onClick:o,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),"aria-label":F,title:F,children:(0,z.jsx)(D,{style:{width:"17px",height:"17px"}})})]})};var W=require("react"),le=e=>{let t=(0,W.useRef)(null),[o,s]=(0,W.useState)(!0),[i,p]=(0,W.useState)(!0),u=(0,W.useCallback)(()=>{let r=t.current;if(!r){s(!0),p(!0);return}let{scrollLeft:n,scrollWidth:a,clientWidth:l}=r;s(n<=0),p(n+l>=a-1)},[]);(0,W.useEffect)(()=>{let r=t.current;if(u(),!r)return;let n=()=>u();return r.addEventListener("scroll",n,{passive:!0}),window.addEventListener("resize",u),()=>{r.removeEventListener("scroll",n),window.removeEventListener("resize",u)}},[e,u]);let c=(0,W.useCallback)(r=>{let n=t.current;if(!n)return;let a=n.clientWidth*.7;n.scrollBy({left:r==="next"?a:-a,behavior:"smooth"})},[]);return{scrollerRef:t,atStart:o,atEnd:i,scrollByDir:c}};var C=require("react/jsx-runtime"),rt={position:"relative",width:"100%"},nt={display:"flex",gap:"8px",overflowX:"auto",alignItems:"center",width:"100%",scrollbarWidth:"none",msOverflowStyle:"none"},Fe={pointerEvents:"none",position:"absolute",top:0,bottom:0,width:"40px"},we={position:"absolute",top:"50%",transform:"translateY(-50%)",backgroundColor:"white",color:"#003c30",border:"1px solid #003c30",padding:"4px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",cursor:"pointer"},pe=({filters:e,isPortrait:t,currency:o,minRatingSuffix:s,clearAllLabel:i,previousFiltersLabel:p,nextFiltersLabel:u,formatCurrency:c,onFilterChange:r,onResetFilters:n,onClearAll:a})=>{let{scrollerRef:l,atStart:m,atEnd:F,scrollByDir:v}=le(e.length),{t:k}=I(),[f,S]=ce.default.useState(null),[x,h]=ce.default.useState(!1),[w,N]=ce.default.useState(!1),_={...nt,padding:t?"8px 16px":"8px"};return(0,C.jsxs)("div",{style:rt,children:[(0,C.jsxs)("div",{ref:l,style:{..._,WebkitOverflowScrolling:"touch"},children:[(0,C.jsx)("style",{children:`
|
|
1
|
+
"use strict";var Le=Object.create;var J=Object.defineProperty;var Ee=Object.getOwnPropertyDescriptor;var Me=Object.getOwnPropertyNames;var Ie=Object.getPrototypeOf,Te=Object.prototype.hasOwnProperty;var Be=(e,t)=>{for(var o in t)J(e,o,{get:t[o],enumerable:!0})},Se=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Me(t))!Te.call(e,a)&&a!==o&&J(e,a,{get:()=>t[a],enumerable:!(i=Ee(t,a))||i.enumerable});return e};var me=(e,t,o)=>(o=e!=null?Le(Ie(e)):{},Se(t||!e||!e.__esModule?J(o,"default",{value:e,enumerable:!0}):o,e)),He=e=>Se(J({},"__esModule",{value:!0}),e);var St={};Be(St,{Chip:()=>te,CloseIcon:()=>fe,EditIcon:()=>G,FilterChips:()=>ce,MarkerDebugList:()=>bt,MinRatingFilterChip:()=>Y,NextIcon:()=>ee,PriceRangeFilterChip:()=>oe,RestaurantPriceLevelChip:()=>ie,SearchIcon:()=>$,SmartFilter:()=>we,StarIcon:()=>ge,TransformedQueryChip:()=>ae,createMinRatingFilterLabel:()=>We,createPriceRangeFilterLabel:()=>_e,formatRatingValue:()=>re,renderStars:()=>Ce,useFilterScroll:()=>se,useGoogleMapsAttachment:()=>dt,useIsPortrait:()=>ue,useMapFirst:()=>ft,useMapFirstBoundsSearch:()=>ht,useMapFirstCore:()=>at,useMapFirstProperties:()=>st,useMapFirstSelectedProperty:()=>lt,useMapLibreAttachment:()=>ut,useMapboxAttachment:()=>mt,usePrimaryType:()=>ct,usePropertiesSearch:()=>gt,useSelectedMarker:()=>pt,useSmartFilterSearch:()=>yt,useTranslation:()=>E});module.exports=He(St);var m=me(require("react")),be=require("@mapfirst.ai/core");var q=require("react");var le=me(require("react"));var xe=me(require("react"));var w=require("react/jsx-runtime"),$=({className:e,style:t})=>(0,w.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:[(0,w.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,w.jsx)("path",{d:"m21 21-4.35-4.35"})]}),fe=({className:e,style:t})=>(0,w.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:[(0,w.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,w.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),G=({className:e,style:t})=>(0,w.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:[(0,w.jsx)("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),(0,w.jsx)("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),ee=({className:e,style:t})=>(0,w.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:(0,w.jsx)("polyline",{points:"9 18 15 12 9 6"})}),ge=({className:e,style:t,fill:o="none"})=>(0,w.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:o,stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,style:{width:"1em",height:"1em",...t},children:(0,w.jsx)("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})});var ye=require("react/jsx-runtime"),Ne={position:"absolute",top:"-8px",right:"-8px",padding:"2px",borderRadius:"50%",backgroundColor:"white",border:"1px solid #03852e",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s"},De={width:"17px",height:"17px"},H=({onClick:e,style:t})=>{let[o,i]=xe.default.useState(!1);return(0,ye.jsx)("button",{style:{...Ne,backgroundColor:o?"#e5e5e5":"white",...t},onClick:e,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),"aria-label":"Remove filter",children:(0,ye.jsx)(fe,{style:De})})};var _=require("react/jsx-runtime"),ze={position:"relative",backgroundColor:"white",color:"black",fontSize:"14px",borderRadius:"9999px",padding:"0 16px",paddingRight:"20px",border:"1px solid #03852e",display:"flex",alignItems:"center",gap:"8px",flexShrink:0,height:"34px"},te=({label:e,icon:t,remove:o,style:i})=>(0,_.jsxs)("div",{style:{...ze,...i},children:[t&&(0,_.jsx)("span",{style:{display:"flex",alignItems:"center"},children:t}),(0,_.jsx)("span",{style:{whiteSpace:"nowrap"},children:e}),(0,_.jsx)(H,{onClick:o})]});var ve=require("react");var U=require("react"),Ae={"smartFilter.typingPrompt":"Search for hotels, restaurants, or attractions...","smartFilter.nav.previous":"Previous filters","smartFilter.nav.next":"Next filters","smartFilter.toast.locationRequired":"Please select a location first","smartFilter.clearAll":"Clear all","smartFilter.minRating.suffix":"+","smartFilter.minRating.label":"{{value}}+","smartFilter.minRating.remove":"Remove rating filter","smartFilter.minRating.setTo":"Set rating to {{rating}}","smartFilter.priceRange.label":"Price Range","smartFilter.priceRange.remove":"Remove price filter","smartFilter.priceRange.edit":"Edit price","smartFilter.transformedQuery.remove":"Remove search query","smartFilter.transformedQuery.edit":"Edit search query","smartFilter.restaurantPriceLevel.label":"Price Level","smartFilter.restaurantPriceLevel.remove":"Remove price level filter","smartFilter.restaurantPriceLevel.none":"Any","smartFilter.restaurantPriceLevel.options.cheapEats":"Cheap Eats","smartFilter.restaurantPriceLevel.options.midRange":"Mid Range","smartFilter.restaurantPriceLevel.options.fineDining":"Fine Dining"},Oe=(e,t="USD")=>new Intl.NumberFormat("en-US",{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:0}).format(e),E=(e,t)=>{let[o,i]=(0,U.useState)("en"),a=(0,U.useCallback)((u,p)=>{let n={...Ae,...e}[u]||u;return p&&Object.keys(p).forEach(s=>{n=n.replace(new RegExp(`{{${s}}}`,"g"),String(p[s]))}),n},[e]),d=(0,U.useCallback)((u,p)=>t?t(u,p):Oe(u,p),[t]);return{t:a,locale:o,setLocale:i,formatCurrency:d}};var W=require("react/jsx-runtime"),Ce=e=>{let t=[],o=Math.floor(e),i=e%1!==0,a={display:"block",width:"12px",height:"12px",borderRadius:"50%",border:"1px solid #03852e",pointerEvents:"none"},d={...a,backgroundColor:"#03852e"},u={...a,background:"linear-gradient(90deg, #03852e 50%, transparent 50%)"};for(let r=0;r<o;r+=1)t.push((0,W.jsx)("span",{style:d},`full-${r}`));i&&t.push((0,W.jsx)("span",{style:u},"half"));let p=Math.max(0,5-Math.ceil(e));for(let r=0;r<p;r+=1)t.push((0,W.jsx)("span",{style:a},`empty-${r}`));return t},We=(e,t)=>(0,W.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[(0,W.jsx)("span",{style:{display:"flex",gap:"1px",userSelect:"none"},children:Ce(e)})," ",t]}),re=e=>e.toFixed(1),_e=(e,t,o,i)=>`${i(e,o)} - ${i(t!=null?t:0,o)}`;var L=require("react/jsx-runtime"),Ve={position:"relative",backgroundColor:"white",color:"black",fontSize:"14px",borderRadius:"9999px",padding:"0 16px",paddingRight:"20px",border:"1px solid #03852e",display:"flex",gap:"8px",alignItems:"center",justifyContent:"center",flexShrink:0,height:"34px"},qe={display:"flex",gap:"1px",userSelect:"none"},he={display:"block",width:"12px",height:"12px",borderRadius:"50%",border:"1px solid #03852e",pointerEvents:"none"},ne={position:"absolute",top:0,height:"100%",cursor:"pointer",backgroundColor:"transparent",border:"none",padding:0},Y=({rating:e,onChange:t,onRemove:o,star:i=!1})=>{let[a,d]=(0,ve.useState)(null),{t:u}=E(),p=a!=null?a:e,r=g=>i&&g?g.toString():u("smartFilter.minRating.label",{value:re(g)}),n=u("smartFilter.minRating.remove"),s=g=>u("smartFilter.minRating.setTo",{rating:re(g)}),c=g=>{let b=g+1;return p>=b?"full":p>=b-.5?"half":"empty"},f=g=>{d(null),g!==e&&t(g)},v=g=>{var y;let b=g.relatedTarget;(!b||!((y=g.currentTarget.closest("[data-min-rating-chip]"))!=null&&y.contains(b)))&&d(null)};return(0,L.jsxs)("div",{style:Ve,"data-min-rating-chip":!0,children:[(0,L.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"4px"},onMouseLeave:()=>d(null),children:[(0,L.jsx)("div",{style:qe,children:Array.from({length:5}).map((g,b)=>{let y=c(b),h=b+1,P=h-.5;if(i)return(0,L.jsxs)("div",{style:{position:"relative",width:"16px",height:"16px"},children:[(0,L.jsx)(ge,{fill:p>=h?"#03852e":"none",style:{width:"16px",height:"16px",pointerEvents:"none"}}),(0,L.jsx)("button",{type:"button",style:{...ne,left:0,width:"50%",borderRadius:"50% 0 0 50%"},onMouseEnter:()=>d(P),onFocus:()=>d(P),onBlur:v,onClick:()=>f(P),"aria-label":s(P),title:r(P)}),(0,L.jsx)("button",{type:"button",style:{...ne,left:"50%",width:"50%",borderRadius:"0 50% 50% 0"},onMouseEnter:()=>d(h),onFocus:()=>d(h),onBlur:v,onClick:()=>f(h),"aria-label":s(h),title:r(h)})]},b);let R=y==="full"?{...he,backgroundColor:"#03852e"}:he,O={...he,background:"linear-gradient(90deg, #03852e 50%, transparent 50%)"};return(0,L.jsxs)("div",{style:{position:"relative",width:"12px",height:"12px"},children:[(0,L.jsx)("span",{style:y==="half"?O:R}),(0,L.jsx)("button",{type:"button",style:{...ne,left:0,width:"50%",borderRadius:"50% 0 0 50%",outline:"2px solid transparent",outlineOffset:"1px"},onMouseEnter:()=>d(P),onFocus:()=>d(P),onBlur:v,onClick:()=>f(P),"aria-label":s(P),title:r(P)}),(0,L.jsx)("button",{type:"button",style:{...ne,left:"50%",width:"50%",borderRadius:"0 50% 50% 0",outline:"2px solid transparent",outlineOffset:"1px"},onMouseEnter:()=>d(h),onFocus:()=>d(h),onBlur:v,onClick:()=>f(h),"aria-label":s(h),title:r(h)})]},b)})}),(0,L.jsx)("span",{style:{whiteSpace:"nowrap"},children:r(p)})]}),(0,L.jsx)(H,{onClick:o})]})};var V=require("react");var F=require("react/jsx-runtime"),Qe={position:"relative",backgroundColor:"white",color:"black",fontSize:"14px",borderRadius:"9999px",padding:"0 16px",border:"1px solid #03852e",display:"flex",alignItems:"center",gap:"8px",flexShrink:0,height:"34px"},Ke={outline:"none",fontSize:"16px",backgroundColor:"transparent",borderRadius:"2px",padding:"2px 8px",width:"64px",textAlign:"center",border:"none"},$e={padding:"4px",borderRadius:"50%",cursor:"pointer",transition:"background-color 0.2s",border:"none",backgroundColor:"transparent",color:"#737373",display:"flex",alignItems:"center",justifyContent:"center"},Pe=({boundary:e,label:t,value:o,placeholder:i,currency:a,isOptional:d=!1,showRemoveButton:u=!1,removeLabel:p,editLabel:r,showAddWhenEmpty:n=!1,onCommit:s,onRemove:c})=>{let[f,v]=(0,V.useState)(o!==void 0?String(o):""),[g,b]=(0,V.useState)(!1),[y,h]=(0,V.useState)(!1),P=o!==void 0;(0,V.useEffect)(()=>{v(o!==void 0?String(o):""),b(!1)},[o]);let R=()=>{v(o!==void 0?String(o):"")},O=()=>{if(f.trim()===""){if(d){s(void 0),v("");return}R();return}let l=Number(f);if(!Number.isFinite(l)){R();return}let M=Math.max(0,l);if(M===o){R();return}s(M)};return(0,F.jsxs)("div",{style:Qe,children:[(0,F.jsx)("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},children:t}),g?(0,F.jsx)("input",{value:f,onChange:l=>{let M=l.target.value.replace(/[^\d]/g,"");v(M)},onBlur:()=>{O(),b(!1)},onKeyDown:l=>{if(l.key==="Enter"){l.preventDefault(),l.currentTarget.blur(),b(!1);return}if(l.key==="Escape"){l.preventDefault(),R(),l.currentTarget.blur(),b(!1);return}l.key.length===1&&/[0-9]/.test(l.key)||l.key==="Backspace"||l.key==="Delete"||l.key==="Tab"||l.key==="ArrowLeft"||l.key==="ArrowRight"||l.key==="Home"||l.key==="End"||l.preventDefault()},placeholder:i,inputMode:"numeric",pattern:"[0-9]*","aria-label":t,style:Ke,autoFocus:!0}):P?(0,F.jsxs)("span",{style:{fontSize:"16px"},children:[a,o]}):n?(0,F.jsx)("button",{type:"button",style:{fontSize:"16px",color:"#737373",cursor:"pointer",border:"none",backgroundColor:"transparent",padding:0},onClick:()=>b(!0),"aria-label":r,children:"+"}):(0,F.jsx)("span",{style:{fontSize:"16px",color:"#737373"},children:"-"}),(!n||n&&g)&&(0,F.jsx)("span",{style:{color:"#737373",fontSize:"12px"},children:a}),!g&&(!n||P)&&(0,F.jsx)("button",{type:"button",style:{...$e,backgroundColor:y?"#e5e5e5":"transparent"},"aria-label":r,title:r,onClick:()=>b(!0),onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:(0,F.jsx)(G,{})}),u&&(0,F.jsx)(H,{onClick:c})]})},oe=({priceRange:e,currency:t,onChange:o,onRemove:i})=>{let{t:a}=E(),d="Min",u="Max",p=a("smartFilter.priceRange.remove"),r=a("smartFilter.priceRange.edit"),n=(s,c)=>{let f={min:e.min,max:e.max};s==="min"?(f.min=c,c!==void 0&&e.max!==void 0&&c>e.max&&(f.max=c)):(f.max=c,c!==void 0&&e.min!==void 0&&c<e.min&&(f.min=c)),(f.min!==e.min||f.max!==e.max)&&o(f)};return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Pe,{boundary:"min",label:d,value:e.min,currency:t,editLabel:r,showRemoveButton:e.min!==void 0&&e.min!==0,onCommit:s=>n("min",s),onRemove:i}),(0,F.jsx)(Pe,{boundary:"max",label:u,value:e.max,currency:t,isOptional:!0,showRemoveButton:e.max!==void 0,removeLabel:p,editLabel:r,showAddWhenEmpty:!0,onCommit:s=>n("max",s),onRemove:i})]})};var T=require("react/jsx-runtime"),Ge={position:"relative",backgroundColor:"white",color:"black",fontSize:"14px",borderRadius:"9999px",padding:"0 16px",paddingRight:"20px",border:"1px solid #03852e",display:"flex",alignItems:"center",gap:"16px",flexShrink:0,height:"34px"},ke=[{value:"Cheap Eats",key:"cheapEats"},{value:"Mid Range",key:"midRange"},{value:"Fine Dining",key:"fineDining"}],ie=({values:e,onChange:t,onRemove:o})=>{let{t:i}=E(),a=i("smartFilter.restaurantPriceLevel.label"),d=i("smartFilter.restaurantPriceLevel.remove"),u=i("smartFilter.restaurantPriceLevel.none"),p=r=>{let{value:n,checked:s}=r.target,c=n,f=new Set(e);s?f.add(c):f.delete(c);let v=ke.filter(g=>f.has(g.value)).map(g=>g.value);t(v)};return(0,T.jsxs)("div",{style:Ge,children:[(0,T.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[(0,T.jsx)("span",{style:{fontSize:"10px",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},children:a}),(0,T.jsxs)("div",{style:{display:"flex",gap:"12px"},children:[ke.map(r=>{let n=i(`smartFilter.restaurantPriceLevel.options.${r.key}`),s=`price-level-${r.key}`;return(0,T.jsxs)("label",{htmlFor:s,style:{display:"flex",alignItems:"center",gap:"4px",fontSize:"12px",cursor:"pointer"},children:[(0,T.jsx)("input",{id:s,type:"checkbox",value:r.value,checked:e.includes(r.value),onChange:p,style:{accentColor:"#03852e",cursor:"pointer"}}),(0,T.jsx)("span",{children:n})]},r.value)}),e.length===0&&(0,T.jsx)("span",{style:{fontSize:"12px",color:"#737373"},children:u})]})]}),(0,T.jsx)(H,{onClick:o})]})};var A=require("react");var D=require("react/jsx-runtime"),Ue={position:"relative",backgroundColor:"white",color:"black",fontSize:"14px",borderRadius:"9999px",padding:"0 16px",paddingRight:"20px",border:"1px solid #03852e",display:"flex",alignItems:"center",gap:"8px",flexShrink:0,userSelect:"none",height:"34px"},Ye={backgroundColor:"#ececec",borderRadius:"2px",padding:"2px 8px",outline:"none",fontSize:"16px",minWidth:"8ch",border:"none"},Ze={padding:"4px",borderRadius:"50%",cursor:"pointer",transition:"background-color 0.2s",color:"#737373",border:"none",backgroundColor:"transparent",display:"flex",alignItems:"center",justifyContent:"center"},ae=({value:e,onChange:t,onRemove:o})=>{let i=(0,A.useRef)(null),[a,d]=(0,A.useState)(e),[u,p]=(0,A.useState)(!1),[r,n]=(0,A.useState)(!1),{t:s}=E(),c=s("smartFilter.transformedQuery.remove"),f=s("smartFilter.transformedQuery.edit");(0,A.useEffect)(()=>{d(e),p(!1)},[e]);let v=()=>{let y=a.trim();if(!y.length){d(e);return}y!==e&&t(y)};return(0,D.jsxs)("div",{style:Ue,children:[(0,D.jsx)($,{style:{width:"16px",height:"16px",color:"#03852e"}}),u?(0,D.jsx)("input",{ref:i,value:a,onChange:y=>{d(y.target.value)},onBlur:()=>{v(),p(!1)},onKeyDown:y=>{if(y.key==="Enter"){y.preventDefault(),y.currentTarget.blur();return}if(y.key==="Escape"){y.preventDefault(),d(e),y.currentTarget.blur();return}},"aria-label":f,style:Ye,autoFocus:!0}):(0,D.jsx)("span",{style:{fontSize:"16px"},children:e}),!u&&(0,D.jsx)("button",{type:"button",style:{...Ze,backgroundColor:r?"#e5e5e5":"transparent"},"aria-label":f,title:f,onClick:()=>p(!0),onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:(0,D.jsx)(G,{})}),(0,D.jsx)(H,{onClick:o})]})};var N=require("react"),se=e=>{let t=(0,N.useRef)(null),[o,i]=(0,N.useState)(!0),[a,d]=(0,N.useState)(!0),u=(0,N.useCallback)(()=>{let r=t.current;if(!r){i(!0),d(!0);return}let{scrollLeft:n,scrollWidth:s,clientWidth:c}=r;i(n<=0),d(n+c>=s-1)},[]);(0,N.useEffect)(()=>{let r=t.current;if(u(),!r)return;let n=()=>u();return r.addEventListener("scroll",n,{passive:!0}),window.addEventListener("resize",u),()=>{r.removeEventListener("scroll",n),window.removeEventListener("resize",u)}},[e,u]);let p=(0,N.useCallback)(r=>{let n=t.current;if(!n)return;let s=n.clientWidth*.7;n.scrollBy({left:r==="next"?s:-s,behavior:"smooth"})},[]);return{scrollerRef:t,atStart:o,atEnd:a,scrollByDir:p}};var C=require("react/jsx-runtime"),je={position:"relative",width:"100%"},Xe={display:"flex",gap:"8px",overflowX:"auto",alignItems:"center",width:"100%",scrollbarWidth:"none",msOverflowStyle:"none"},Fe={pointerEvents:"none",position:"absolute",top:0,bottom:0,width:"40px"},Re={position:"absolute",top:"50%",transform:"translateY(-50%)",backgroundColor:"white",color:"#003c30",border:"1px solid #003c30",padding:"4px",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",cursor:"pointer"},ce=({filters:e,isPortrait:t,currency:o,minRatingSuffix:i,clearAllLabel:a,previousFiltersLabel:d,nextFiltersLabel:u,formatCurrency:p,onFilterChange:r,onResetFilters:n,onClearAll:s})=>{let{scrollerRef:c,atStart:f,atEnd:v,scrollByDir:g}=se(e.length),{t:b}=E(),[y,h]=le.default.useState(null),[P,R]=le.default.useState(!1),[O,K]=le.default.useState(!1),Z={...Xe,padding:t?"8px 16px":"8px"};return(0,C.jsxs)("div",{style:je,children:[(0,C.jsxs)("div",{ref:c,style:{...Z,WebkitOverflowScrolling:"touch"},children:[(0,C.jsx)("style",{children:`
|
|
2
2
|
div::-webkit-scrollbar {
|
|
3
3
|
display: none;
|
|
4
4
|
}
|
|
5
|
-
`}),(0,C.jsx)("button",{style:{flexShrink:0,backgroundColor:
|
|
5
|
+
`}),(0,C.jsx)("button",{style:{flexShrink:0,backgroundColor:P?"#03a03e":"#03852e",borderRadius:"50%",padding:"8px",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",transition:"background-color 0.2s"},onClick:n,onMouseEnter:()=>R(!0),onMouseLeave:()=>R(!1),children:(0,C.jsx)($,{style:{width:"20px",height:"20px",color:"white"}})}),e.map(l=>{var j,X,z;let M=()=>(0,C.jsx)(te,{label:l.label,icon:l.icon,remove:()=>{r(e.filter(S=>S.id!==l.id))}},l.id);if(l.type==="minRating"){let S=(j=l.numericValue)!=null?j:Number(l.value);return Number.isFinite(S)?(0,C.jsx)(Y,{rating:S,onChange:k=>{let x=e.map(I=>I.id===l.id?{...I,numericValue:k,value:String(k)}:I);r(x)},onRemove:()=>void r(e.filter(k=>k.id!==l.id))},l.id):M()}if(l.type==="starRating"){let S=(X=l.numericValue)!=null?X:Number(l.value);return Number.isFinite(S)?(0,C.jsx)(Y,{star:!0,rating:S,onChange:k=>{let x=e.map(I=>I.id===l.id?{...I,numericValue:k,value:String(k)}:I);r(x)},onRemove:()=>void r(e.filter(k=>k.id!==l.id))},l.id):M()}return l.type==="priceRange"&&l.priceRange?(0,C.jsx)(oe,{priceRange:l.priceRange,currency:o,onChange:S=>{let k=e.map(x=>x.id===l.id?{...x,priceRange:S}:x);r(k)},onRemove:()=>void r(e.filter(S=>S.id!==l.id))},l.id):l.type==="transformed_query"?(0,C.jsx)(ae,{value:l.value,onChange:S=>{let k=e.map(x=>x.id===l.id?{...x,value:S}:x);r(k)},onRemove:()=>void r(e.filter(S=>S.id!==l.id))},l.id):l.type==="selected_restaurant_price_levels"?(0,C.jsx)(ie,{values:(z=l.priceLevels)!=null?z:[],onChange:S=>{let k=e.map(x=>x.id===l.id?{...x,priceLevels:S}:x);r(k)},onRemove:()=>void r(e.filter(S=>S.id!==l.id))},l.id):M()}),(0,C.jsx)("button",{style:{flexShrink:0,padding:"4px 16px",borderRadius:"9999px",cursor:"pointer",fontSize:"14px",userSelect:"none",border:"none",backgroundColor:O?"#e5e5e5":"transparent",transition:"background-color 0.2s"},onClick:s,onMouseEnter:()=>K(!0),onMouseLeave:()=>K(!1),children:a})]}),!f&&(0,C.jsx)("div",{"aria-hidden":"true",style:{...Fe,left:0,background:"linear-gradient(to right, white, transparent)"}}),!v&&(0,C.jsx)("div",{"aria-hidden":"true",style:{...Fe,right:0,background:"linear-gradient(to left, white, transparent)"}}),!f&&(0,C.jsx)("button",{type:"button","aria-label":d,style:{...Re,left:"4px",transform:"translateY(-50%) rotate(180deg)",backgroundColor:y==="prev"?"#e5e5e5":"white"},onClick:()=>g("prev"),onMouseEnter:()=>h("prev"),onMouseLeave:()=>h(null),children:(0,C.jsx)(ee,{style:{width:"20px",height:"20px"}})}),!v&&(0,C.jsx)("button",{type:"button","aria-label":u,style:{...Re,right:"4px",backgroundColor:y==="next"?"#e5e5e5":"white"},onClick:()=>g("next"),onMouseEnter:()=>h("next"),onMouseLeave:()=>h(null),children:(0,C.jsx)(ee,{style:{width:"20px",height:"20px"}})})]})};var pe=require("react"),ue=()=>{let[e,t]=(0,pe.useState)(typeof window!="undefined"?window.innerHeight>window.innerWidth:!1);return(0,pe.useEffect)(()=>{if(typeof window=="undefined")return;let o=()=>{t(window.innerHeight>window.innerWidth)};return window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]),e};var B=require("react/jsx-runtime"),Je={position:"relative",display:"flex",flexDirection:"column",gap:"8px",width:"100%"},et={position:"relative",display:"flex",alignItems:"center",gap:"8px",width:"100%"},tt={position:"relative",display:"flex",alignItems:"center",flex:1,backgroundColor:"white",borderRadius:"24px",border:"1px solid #e5e5e5",padding:"0 16px",boxShadow:"0 1px 3px rgba(0,0,0,0.1)"},rt={flex:1,border:"none",outline:"none",fontSize:"16px",backgroundColor:"transparent",color:"#000",padding:"10px"},nt={position:"absolute",right:"16px",top:"50%",transform:"translateY(-50%)"},ot={width:"20px",height:"20px",border:"2px solid #e5e5e5",borderTop:"2px solid #03852e",borderRadius:"50%",animation:"spin 1s linear infinite"},it={position:"absolute",padding:"10px",color:"#737373",pointerEvents:"none",fontSize:"16px"},we=({mapFirst:e,filters:t,value:o,isSearching:i=!1,placeholder:a,onSearch:d,onFilterChange:u,onValueChange:p,showTypingPrompt:r=!0,customTranslations:n,currency:s="USD",style:c,inputStyle:f,containerStyle:v})=>{let[g,b]=(0,q.useState)(""),y=o!==void 0?o:g,h=p||b,P=ue(),{t:R,formatCurrency:O}=E(n),K=R("smartFilter.minRating.suffix"),Z=a||R("smartFilter.typingPrompt"),l=R("smartFilter.nav.previous"),M=R("smartFilter.nav.next"),j=R("smartFilter.clearAll"),X=async x=>{x.preventDefault();let I=y.trim();if(!(!I||i))try{await d(I)}catch(de){console.error("Search error:",de)}},z=(0,q.useCallback)(async(x,I)=>{if(!i)try{await u(x)}catch(de){console.error("Filter change error:",de)}},[i,u]),S=(0,q.useCallback)(()=>{z([])},[z]),k=(0,q.useCallback)(()=>{z([],!0),h("")},[z,h]);return(0,B.jsxs)("div",{style:{...Je,...v},children:[(0,B.jsx)("style",{children:`
|
|
6
6
|
@keyframes spin {
|
|
7
7
|
0% { transform: rotate(0deg); }
|
|
8
8
|
100% { transform: rotate(360deg); }
|
|
9
9
|
}
|
|
10
|
-
`}),(0,
|
|
10
|
+
`}),(0,B.jsx)("form",{onSubmit:X,style:{...et,...c},children:(0,B.jsxs)("div",{style:tt,children:[(0,B.jsx)("input",{type:"text",value:y,onChange:x=>h(x.target.value),disabled:i,style:{...rt,...f},autoComplete:"off","aria-label":"Smart search"}),r&&y.length===0&&!i&&(0,B.jsx)("span",{style:it,children:Z}),i&&(0,B.jsx)("div",{style:nt,children:(0,B.jsx)("div",{style:ot})})]})}),t.length>0&&(0,B.jsx)(ce,{filters:t,isPortrait:P,currency:s,minRatingSuffix:K,clearAllLabel:j,previousFiltersLabel:l,nextFiltersLabel:M,formatCurrency:O,onFilterChange:z,onResetFilters:S,onClearAll:k})]})};var Q=require("react/jsx-runtime");function at(e){let t=m.default.useRef(null),[o,i]=m.default.useState(null),a=m.default.useRef(e);return m.default.useEffect(()=>{a.current=e}),m.default.useEffect(()=>{let d=a.current,u={adapter:null,...d,callbacks:{...d.callbacks,onPropertiesChange:r=>{var n,s;i(c=>c?{...c,properties:r}:null),(s=(n=a.current.callbacks)==null?void 0:n.onPropertiesChange)==null||s.call(n,r)},onSelectedPropertyChange:r=>{var n,s;i(c=>c?{...c,selectedPropertyId:r}:null),(s=(n=a.current.callbacks)==null?void 0:n.onSelectedPropertyChange)==null||s.call(n,r)},onPrimaryTypeChange:r=>{var n,s;i(c=>c?{...c,primary:r}:null),(s=(n=a.current.callbacks)==null?void 0:n.onPrimaryTypeChange)==null||s.call(n,r)},onFiltersChange:r=>{var n,s;i(c=>c?{...c,filters:r}:null),(s=(n=a.current.callbacks)==null?void 0:n.onFiltersChange)==null||s.call(n,r)},onBoundsChange:r=>{var n,s;i(c=>c?{...c,bounds:r}:null),(s=(n=a.current.callbacks)==null?void 0:n.onBoundsChange)==null||s.call(n,r)},onPendingBoundsChange:r=>{var n,s;i(c=>c?{...c,pendingBounds:r}:null),(s=(n=a.current.callbacks)==null?void 0:n.onPendingBoundsChange)==null||s.call(n,r)},onCenterChange:(r,n)=>{var s,c;i(f=>f?{...f,center:r,zoom:n}:null),(c=(s=a.current.callbacks)==null?void 0:s.onCenterChange)==null||c.call(s,r,n)},onZoomChange:r=>{var n,s;i(c=>c?{...c,zoom:r}:null),(s=(n=a.current.callbacks)==null?void 0:n.onZoomChange)==null||s.call(n,r)},onActiveLocationChange:r=>{var n,s;i(c=>c?{...c,activeLocation:r}:null),(s=(n=a.current.callbacks)==null?void 0:n.onActiveLocationChange)==null||s.call(n,r)},onLoadingStateChange:r=>{var n,s;i(c=>c?{...c,initialLoading:r}:null),(s=(n=a.current.callbacks)==null?void 0:n.onLoadingStateChange)==null||s.call(n,r)},onSearchingStateChange:r=>{var n,s;i(c=>c?{...c,isSearching:r}:null),(s=(n=a.current.callbacks)==null?void 0:n.onSearchingStateChange)==null||s.call(n,r)}}},p=new be.MapFirstCore(u);return t.current=p,i(p.getState()),()=>{p.destroy(),t.current=null,i(null)}},[]),{mapFirst:t.current,state:o}}function st(e){let[t,o]=m.default.useState([]);return m.default.useEffect(()=>{if(!e){o([]);return}o(e.getState().properties)},[e]),t}function lt(e){let[t,o]=m.default.useState(null);return m.default.useEffect(()=>{if(!e){o(null);return}o(e.getState().selectedPropertyId)},[e]),t}function ct(e){let[t,o]=m.default.useState("Accommodation");m.default.useEffect(()=>{if(!e){o("Accommodation");return}o(e.getState().primary)},[e]);let i=m.default.useCallback(a=>{e&&(e.setPrimaryType(a),o(a))},[e]);return[t,i]}function pt(e){let[t,o]=m.default.useState(null);m.default.useEffect(()=>{if(!e){o(null);return}o(e.getState().selectedPropertyId)},[e]);let i=m.default.useCallback(a=>{e&&e.setSelectedMarker(a)},[e]);return[t,i]}function ut({mapFirst:e,map:t,maplibregl:o,onMarkerClick:i}){let a=m.default.useRef(!1);m.default.useEffect(()=>{!e||!t||a.current||(e.attachMap(t,{platform:"maplibre",maplibregl:o,onMarkerClick:i}),a.current=!0)},[e,t,o,i])}function dt({mapFirst:e,map:t,google:o,onMarkerClick:i}){let a=m.default.useRef(!1);m.default.useEffect(()=>{!e||!t||a.current||(e.attachMap(t,{platform:"google",google:o,onMarkerClick:i}),a.current=!0)},[e,t,o,i])}function mt({mapFirst:e,map:t,mapboxgl:o,onMarkerClick:i}){let a=m.default.useRef(!1);m.default.useEffect(()=>{!e||!t||a.current||(e.attachMap(t,{platform:"mapbox",mapboxgl:o,onMarkerClick:i}),a.current=!0)},[e,t,o,i])}function ft(e){let t=m.default.useRef(null);return m.default.useEffect(()=>{if(!e)return;let o=new be.MapFirstCore(e);return t.current=o,()=>{o.destroy(),t.current=null}},[e]),t}function gt(e){let[t,o]=m.default.useState(!1),[i,a]=m.default.useState(null);return{search:m.default.useCallback(async u=>{if(!e){let p=new Error("MapFirst instance not available");throw a(p),p}o(!0),a(null);try{return await e.runPropertiesSearch({...u,onError:r=>{let n=r instanceof Error?r:new Error(String(r));a(n)}})}catch(p){let r=p instanceof Error?p:new Error(String(p));throw a(r),r}finally{o(!1)}},[e]),isLoading:t,error:i}}function yt(e){let[t,o]=m.default.useState(!1),[i,a]=m.default.useState(null);return{search:m.default.useCallback(async u=>{if(!e){let p=new Error("MapFirst instance not available");throw a(p),p}o(!0),a(null);try{return await e.runSmartFilterSearch({...u,onError:r=>{let n=r instanceof Error?r:new Error(String(r));a(n)}})}catch(p){let r=p instanceof Error?p:new Error(String(p));throw a(r),r}finally{o(!1)}},[e]),isLoading:t,error:i}}function ht(e){let[t,o]=m.default.useState(!1),[i,a]=m.default.useState(null);return{performBoundsSearch:m.default.useCallback(async()=>{if(!e)return null;o(!0),a(null);try{return await e.performBoundsSearch()}catch(u){let p=u instanceof Error?u:new Error(String(u));throw a(p),p}finally{o(!1)}},[e]),isSearching:t,error:i}}function bt({markers:e}){return(0,Q.jsxs)("div",{style:{fontFamily:"sans-serif",fontSize:14},children:[(0,Q.jsx)("strong",{children:"Markers"}),(0,Q.jsx)("ul",{children:e.map(t=>{var o,i,a,d,u,p;return(0,Q.jsxs)("li",{children:[t.name," \u2014 ",(a=(i=(o=t.location)==null?void 0:o.lat)==null?void 0:i.toFixed(3))!=null?a:"n/a",","," ",(p=(u=(d=t.location)==null?void 0:d.lon)==null?void 0:u.toFixed(3))!=null?p:"n/a"]},String(t.tripadvisor_id))})})]})}0&&(module.exports={Chip,CloseIcon,EditIcon,FilterChips,MarkerDebugList,MinRatingFilterChip,NextIcon,PriceRangeFilterChip,RestaurantPriceLevelChip,SearchIcon,SmartFilter,StarIcon,TransformedQueryChip,createMinRatingFilterLabel,createPriceRangeFilterLabel,formatRatingValue,renderStars,useFilterScroll,useGoogleMapsAttachment,useIsPortrait,useMapFirst,useMapFirstBoundsSearch,useMapFirstCore,useMapFirstProperties,useMapFirstSelectedProperty,useMapLibreAttachment,useMapboxAttachment,usePrimaryType,usePropertiesSearch,useSelectedMarker,useSmartFilterSearch,useTranslation});
|
|
11
11
|
//# sourceMappingURL=index.js.map
|