@mapfirst.ai/react 0.0.94 → 0.0.97
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 +41 -34
- package/dist/index.d.ts +41 -34
- package/dist/index.js +201 -160
- package/dist/index.mjs +165 -122
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import * as _mapfirst_ai_core from '@mapfirst.ai/core';
|
|
|
2
2
|
import { PropertyType, PriceLevel, BaseMapFirstOptions, MapFirstCore, MapState, Property, MapLibreNamespace, MarkerOptions, GoogleMapsNamespace, MapboxNamespace, LeafletNamespace } from '@mapfirst.ai/core';
|
|
3
3
|
export { ActiveLocation, ApiFiltersResponse, BaseMapFirstOptions, Environment, FilterSchema, FilterState, GoogleMapsNamespace, LeafletAdapter, MapBounds, MapFirstCore, MapFirstOptions, MapLibreNamespace, MapState, MapStateCallbacks, MapStateUpdate, MapboxNamespace, Price, PriceLevel, PropertiesFetchError, Property, PropertyType, TripAdvisorImage, TripAdvisorImageResponse, ViewState, convertToApiFilters, fetchImages, fetchProperties, isWebGLSupported, processApiFilters } from '@mapfirst.ai/core';
|
|
4
4
|
import * as React$1 from 'react';
|
|
5
|
-
import React__default, { FunctionComponent,
|
|
5
|
+
import React__default, { FunctionComponent, ReactNode, CSSProperties } from 'react';
|
|
6
6
|
|
|
7
7
|
type Filter = {
|
|
8
8
|
id: string;
|
|
@@ -20,47 +20,46 @@ type PriceRangeValue = {
|
|
|
20
20
|
max?: number;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
+
/** Per-element style overrides for the SmartFilter component tree. */
|
|
24
|
+
interface SmartFilterStyles {
|
|
25
|
+
/** Outer wrapper div */
|
|
26
|
+
container?: CSSProperties;
|
|
27
|
+
/** Horizontally-scrollable chips row */
|
|
28
|
+
scrollContainer?: CSSProperties;
|
|
29
|
+
/** Generic text chips (amenities, hotel style, etc.) */
|
|
30
|
+
chip?: CSSProperties;
|
|
31
|
+
/** minRating / starRating interactive chip container */
|
|
32
|
+
minRatingChip?: CSSProperties;
|
|
33
|
+
/** Price range chip container */
|
|
34
|
+
priceRangeChip?: CSSProperties;
|
|
35
|
+
/** Transformed-query chip container */
|
|
36
|
+
transformedQueryChip?: CSSProperties;
|
|
37
|
+
/** Restaurant price-level chip container */
|
|
38
|
+
restaurantPriceLevelChip?: CSSProperties;
|
|
39
|
+
/** Prev / next scroll nav buttons */
|
|
40
|
+
navButton?: CSSProperties;
|
|
41
|
+
/** "Clear all" button */
|
|
42
|
+
clearAllButton?: CSSProperties;
|
|
43
|
+
}
|
|
23
44
|
interface SmartFilterProps {
|
|
24
45
|
filters: Filter[];
|
|
25
46
|
isSearching?: boolean;
|
|
26
47
|
onFilterChange: (filters: Filter[]) => Promise<void> | void;
|
|
27
48
|
customTranslations?: Record<string, string>;
|
|
28
49
|
currency?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Content rendered as the first item inside the scroll row, before any
|
|
52
|
+
* chips. Use this to place a sticky-looking action button (e.g. a search /
|
|
53
|
+
* reset icon) that scrolls together with the chips.
|
|
54
|
+
*/
|
|
55
|
+
beforeContent?: ReactNode;
|
|
56
|
+
/** Fine-grained style overrides for every visual part of the component. */
|
|
57
|
+
styles?: SmartFilterStyles;
|
|
58
|
+
/** @deprecated Use `styles.container` instead. */
|
|
29
59
|
style?: CSSProperties;
|
|
60
|
+
/** @deprecated Use `styles.container` instead. */
|
|
30
61
|
containerStyle?: CSSProperties;
|
|
31
62
|
}
|
|
32
|
-
/**
|
|
33
|
-
* SmartFilter component for AI-powered search with filter chips.
|
|
34
|
-
* Provides a search input with smart filtering capabilities.
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```tsx
|
|
38
|
-
* const { mapFirst, state } = useMapFirstCore({ ... });
|
|
39
|
-
* const [filters, setFilters] = useState<Filter[]>([]);
|
|
40
|
-
* const [searchValue, setSearchValue] = useState("");
|
|
41
|
-
*
|
|
42
|
-
* const handleSearch = async (query: string, currentFilters?: Filter[]) => {
|
|
43
|
-
* // Perform search using mapFirst.runSmartFilterSearch
|
|
44
|
-
* const result = await mapFirst.runSmartFilterSearch({
|
|
45
|
-
* query,
|
|
46
|
-
* filters: currentFilters
|
|
47
|
-
* });
|
|
48
|
-
* // Update filters based on response
|
|
49
|
-
* };
|
|
50
|
-
*
|
|
51
|
-
* return (
|
|
52
|
-
* <SmartFilter
|
|
53
|
-
* mapFirst={mapFirst}
|
|
54
|
-
* filters={filters}
|
|
55
|
-
* value={searchValue}
|
|
56
|
-
* isSearching={state?.isSearching}
|
|
57
|
-
* onSearch={handleSearch}
|
|
58
|
-
* onFilterChange={setFilters}
|
|
59
|
-
* onValueChange={setSearchValue}
|
|
60
|
-
* />
|
|
61
|
-
* );
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
63
|
declare const SmartFilter$1: FunctionComponent<SmartFilterProps>;
|
|
65
64
|
|
|
66
65
|
interface IconProps {
|
|
@@ -94,6 +93,10 @@ interface FilterChipsProps {
|
|
|
94
93
|
onFilterChange: (filters: Filter[], clearAll?: boolean) => void | Promise<void>;
|
|
95
94
|
onResetFilters: () => void;
|
|
96
95
|
onClearAll: () => void;
|
|
96
|
+
/** Rendered as the first item in the scroll row, before any chips. */
|
|
97
|
+
beforeContent?: ReactNode;
|
|
98
|
+
/** Style overrides forwarded from SmartFilter. */
|
|
99
|
+
styles?: SmartFilterStyles;
|
|
97
100
|
}
|
|
98
101
|
declare const FilterChips: FunctionComponent<FilterChipsProps>;
|
|
99
102
|
|
|
@@ -102,6 +105,7 @@ declare const MinRatingFilterChip: FunctionComponent<{
|
|
|
102
105
|
rating: number;
|
|
103
106
|
onChange: (rating: number) => void;
|
|
104
107
|
onRemove: () => void;
|
|
108
|
+
style?: CSSProperties;
|
|
105
109
|
}>;
|
|
106
110
|
|
|
107
111
|
declare const PriceRangeFilterChip: FunctionComponent<{
|
|
@@ -109,12 +113,14 @@ declare const PriceRangeFilterChip: FunctionComponent<{
|
|
|
109
113
|
currency: string;
|
|
110
114
|
onChange: (range: PriceRangeValue) => void;
|
|
111
115
|
onRemove: () => void;
|
|
116
|
+
style?: CSSProperties;
|
|
112
117
|
}>;
|
|
113
118
|
|
|
114
119
|
interface RestaurantPriceLevelChipProps {
|
|
115
120
|
values: PriceLevel[];
|
|
116
121
|
onChange: (values: PriceLevel[]) => void;
|
|
117
122
|
onRemove: () => void;
|
|
123
|
+
style?: CSSProperties;
|
|
118
124
|
}
|
|
119
125
|
declare const RestaurantPriceLevelChip: FunctionComponent<RestaurantPriceLevelChipProps>;
|
|
120
126
|
|
|
@@ -122,6 +128,7 @@ interface TransformedQueryChipProps {
|
|
|
122
128
|
value: string;
|
|
123
129
|
onChange: (nextValue: string) => void;
|
|
124
130
|
onRemove: () => void;
|
|
131
|
+
style?: CSSProperties;
|
|
125
132
|
}
|
|
126
133
|
declare const TransformedQueryChip: FunctionComponent<TransformedQueryChipProps>;
|
|
127
134
|
|
|
@@ -303,4 +310,4 @@ declare function useMapFirst(options: BaseMapFirstOptions): {
|
|
|
303
310
|
}) => void;
|
|
304
311
|
};
|
|
305
312
|
|
|
306
|
-
export { Chip, type ChipProps, CloseIcon, EditIcon, type Filter, FilterChips, type FilterChipsProps, type IconProps, type Locale, MinRatingFilterChip, NextIcon, PriceRangeFilterChip, type PriceRangeValue, RestaurantPriceLevelChip, type RestaurantPriceLevelChipProps, SearchIcon, SmartFilter$1 as SmartFilter, type SmartFilterProps, StarIcon, TransformedQueryChip, type TransformedQueryChipProps, createMinRatingFilterLabel, createPriceRangeFilterLabel, formatRatingValue, renderStars, useFilterScroll, useMapFirst, useTranslation };
|
|
313
|
+
export { Chip, type ChipProps, CloseIcon, EditIcon, type Filter, FilterChips, type FilterChipsProps, type IconProps, type Locale, MinRatingFilterChip, NextIcon, PriceRangeFilterChip, type PriceRangeValue, RestaurantPriceLevelChip, type RestaurantPriceLevelChipProps, SearchIcon, SmartFilter$1 as SmartFilter, type SmartFilterProps, type SmartFilterStyles, StarIcon, TransformedQueryChip, type TransformedQueryChipProps, createMinRatingFilterLabel, createPriceRangeFilterLabel, formatRatingValue, renderStars, useFilterScroll, useMapFirst, useTranslation };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as _mapfirst_ai_core from '@mapfirst.ai/core';
|
|
|
2
2
|
import { PropertyType, PriceLevel, BaseMapFirstOptions, MapFirstCore, MapState, Property, MapLibreNamespace, MarkerOptions, GoogleMapsNamespace, MapboxNamespace, LeafletNamespace } from '@mapfirst.ai/core';
|
|
3
3
|
export { ActiveLocation, ApiFiltersResponse, BaseMapFirstOptions, Environment, FilterSchema, FilterState, GoogleMapsNamespace, LeafletAdapter, MapBounds, MapFirstCore, MapFirstOptions, MapLibreNamespace, MapState, MapStateCallbacks, MapStateUpdate, MapboxNamespace, Price, PriceLevel, PropertiesFetchError, Property, PropertyType, TripAdvisorImage, TripAdvisorImageResponse, ViewState, convertToApiFilters, fetchImages, fetchProperties, isWebGLSupported, processApiFilters } from '@mapfirst.ai/core';
|
|
4
4
|
import * as React$1 from 'react';
|
|
5
|
-
import React__default, { FunctionComponent,
|
|
5
|
+
import React__default, { FunctionComponent, ReactNode, CSSProperties } from 'react';
|
|
6
6
|
|
|
7
7
|
type Filter = {
|
|
8
8
|
id: string;
|
|
@@ -20,47 +20,46 @@ type PriceRangeValue = {
|
|
|
20
20
|
max?: number;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
+
/** Per-element style overrides for the SmartFilter component tree. */
|
|
24
|
+
interface SmartFilterStyles {
|
|
25
|
+
/** Outer wrapper div */
|
|
26
|
+
container?: CSSProperties;
|
|
27
|
+
/** Horizontally-scrollable chips row */
|
|
28
|
+
scrollContainer?: CSSProperties;
|
|
29
|
+
/** Generic text chips (amenities, hotel style, etc.) */
|
|
30
|
+
chip?: CSSProperties;
|
|
31
|
+
/** minRating / starRating interactive chip container */
|
|
32
|
+
minRatingChip?: CSSProperties;
|
|
33
|
+
/** Price range chip container */
|
|
34
|
+
priceRangeChip?: CSSProperties;
|
|
35
|
+
/** Transformed-query chip container */
|
|
36
|
+
transformedQueryChip?: CSSProperties;
|
|
37
|
+
/** Restaurant price-level chip container */
|
|
38
|
+
restaurantPriceLevelChip?: CSSProperties;
|
|
39
|
+
/** Prev / next scroll nav buttons */
|
|
40
|
+
navButton?: CSSProperties;
|
|
41
|
+
/** "Clear all" button */
|
|
42
|
+
clearAllButton?: CSSProperties;
|
|
43
|
+
}
|
|
23
44
|
interface SmartFilterProps {
|
|
24
45
|
filters: Filter[];
|
|
25
46
|
isSearching?: boolean;
|
|
26
47
|
onFilterChange: (filters: Filter[]) => Promise<void> | void;
|
|
27
48
|
customTranslations?: Record<string, string>;
|
|
28
49
|
currency?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Content rendered as the first item inside the scroll row, before any
|
|
52
|
+
* chips. Use this to place a sticky-looking action button (e.g. a search /
|
|
53
|
+
* reset icon) that scrolls together with the chips.
|
|
54
|
+
*/
|
|
55
|
+
beforeContent?: ReactNode;
|
|
56
|
+
/** Fine-grained style overrides for every visual part of the component. */
|
|
57
|
+
styles?: SmartFilterStyles;
|
|
58
|
+
/** @deprecated Use `styles.container` instead. */
|
|
29
59
|
style?: CSSProperties;
|
|
60
|
+
/** @deprecated Use `styles.container` instead. */
|
|
30
61
|
containerStyle?: CSSProperties;
|
|
31
62
|
}
|
|
32
|
-
/**
|
|
33
|
-
* SmartFilter component for AI-powered search with filter chips.
|
|
34
|
-
* Provides a search input with smart filtering capabilities.
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```tsx
|
|
38
|
-
* const { mapFirst, state } = useMapFirstCore({ ... });
|
|
39
|
-
* const [filters, setFilters] = useState<Filter[]>([]);
|
|
40
|
-
* const [searchValue, setSearchValue] = useState("");
|
|
41
|
-
*
|
|
42
|
-
* const handleSearch = async (query: string, currentFilters?: Filter[]) => {
|
|
43
|
-
* // Perform search using mapFirst.runSmartFilterSearch
|
|
44
|
-
* const result = await mapFirst.runSmartFilterSearch({
|
|
45
|
-
* query,
|
|
46
|
-
* filters: currentFilters
|
|
47
|
-
* });
|
|
48
|
-
* // Update filters based on response
|
|
49
|
-
* };
|
|
50
|
-
*
|
|
51
|
-
* return (
|
|
52
|
-
* <SmartFilter
|
|
53
|
-
* mapFirst={mapFirst}
|
|
54
|
-
* filters={filters}
|
|
55
|
-
* value={searchValue}
|
|
56
|
-
* isSearching={state?.isSearching}
|
|
57
|
-
* onSearch={handleSearch}
|
|
58
|
-
* onFilterChange={setFilters}
|
|
59
|
-
* onValueChange={setSearchValue}
|
|
60
|
-
* />
|
|
61
|
-
* );
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
63
|
declare const SmartFilter$1: FunctionComponent<SmartFilterProps>;
|
|
65
64
|
|
|
66
65
|
interface IconProps {
|
|
@@ -94,6 +93,10 @@ interface FilterChipsProps {
|
|
|
94
93
|
onFilterChange: (filters: Filter[], clearAll?: boolean) => void | Promise<void>;
|
|
95
94
|
onResetFilters: () => void;
|
|
96
95
|
onClearAll: () => void;
|
|
96
|
+
/** Rendered as the first item in the scroll row, before any chips. */
|
|
97
|
+
beforeContent?: ReactNode;
|
|
98
|
+
/** Style overrides forwarded from SmartFilter. */
|
|
99
|
+
styles?: SmartFilterStyles;
|
|
97
100
|
}
|
|
98
101
|
declare const FilterChips: FunctionComponent<FilterChipsProps>;
|
|
99
102
|
|
|
@@ -102,6 +105,7 @@ declare const MinRatingFilterChip: FunctionComponent<{
|
|
|
102
105
|
rating: number;
|
|
103
106
|
onChange: (rating: number) => void;
|
|
104
107
|
onRemove: () => void;
|
|
108
|
+
style?: CSSProperties;
|
|
105
109
|
}>;
|
|
106
110
|
|
|
107
111
|
declare const PriceRangeFilterChip: FunctionComponent<{
|
|
@@ -109,12 +113,14 @@ declare const PriceRangeFilterChip: FunctionComponent<{
|
|
|
109
113
|
currency: string;
|
|
110
114
|
onChange: (range: PriceRangeValue) => void;
|
|
111
115
|
onRemove: () => void;
|
|
116
|
+
style?: CSSProperties;
|
|
112
117
|
}>;
|
|
113
118
|
|
|
114
119
|
interface RestaurantPriceLevelChipProps {
|
|
115
120
|
values: PriceLevel[];
|
|
116
121
|
onChange: (values: PriceLevel[]) => void;
|
|
117
122
|
onRemove: () => void;
|
|
123
|
+
style?: CSSProperties;
|
|
118
124
|
}
|
|
119
125
|
declare const RestaurantPriceLevelChip: FunctionComponent<RestaurantPriceLevelChipProps>;
|
|
120
126
|
|
|
@@ -122,6 +128,7 @@ interface TransformedQueryChipProps {
|
|
|
122
128
|
value: string;
|
|
123
129
|
onChange: (nextValue: string) => void;
|
|
124
130
|
onRemove: () => void;
|
|
131
|
+
style?: CSSProperties;
|
|
125
132
|
}
|
|
126
133
|
declare const TransformedQueryChip: FunctionComponent<TransformedQueryChipProps>;
|
|
127
134
|
|
|
@@ -303,4 +310,4 @@ declare function useMapFirst(options: BaseMapFirstOptions): {
|
|
|
303
310
|
}) => void;
|
|
304
311
|
};
|
|
305
312
|
|
|
306
|
-
export { Chip, type ChipProps, CloseIcon, EditIcon, type Filter, FilterChips, type FilterChipsProps, type IconProps, type Locale, MinRatingFilterChip, NextIcon, PriceRangeFilterChip, type PriceRangeValue, RestaurantPriceLevelChip, type RestaurantPriceLevelChipProps, SearchIcon, SmartFilter$1 as SmartFilter, type SmartFilterProps, StarIcon, TransformedQueryChip, type TransformedQueryChipProps, createMinRatingFilterLabel, createPriceRangeFilterLabel, formatRatingValue, renderStars, useFilterScroll, useMapFirst, useTranslation };
|
|
313
|
+
export { Chip, type ChipProps, CloseIcon, EditIcon, type Filter, FilterChips, type FilterChipsProps, type IconProps, type Locale, MinRatingFilterChip, NextIcon, PriceRangeFilterChip, type PriceRangeValue, RestaurantPriceLevelChip, type RestaurantPriceLevelChipProps, SearchIcon, SmartFilter$1 as SmartFilter, type SmartFilterProps, type SmartFilterStyles, StarIcon, TransformedQueryChip, type TransformedQueryChipProps, createMinRatingFilterLabel, createPriceRangeFilterLabel, formatRatingValue, renderStars, useFilterScroll, useMapFirst, useTranslation };
|