@digitransit-component/digitransit-component-autosuggest 1.8.7 → 1.8.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/README.md +13 -2
- package/index.js +7 -0
- package/lib/index.development.js +46 -0
- package/lib/index.js +6 -6
- package/lib/index.js.map +1 -1
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -43,14 +43,21 @@ const searchContext = {
|
|
|
43
43
|
clearFutureRoutes: () => ({}), // Function that clears future routes
|
|
44
44
|
};
|
|
45
45
|
const lang = 'fi'; // en, fi or sv
|
|
46
|
-
const onSelect = () => {
|
|
46
|
+
const onSelect = (item, id) => {
|
|
47
47
|
// Funtionality when user selects a suggesions. No default implementation is given.
|
|
48
48
|
return null;
|
|
49
49
|
};
|
|
50
|
-
const onClear =
|
|
50
|
+
const onClear = id => {
|
|
51
51
|
// Called when user clicks the clear search string button. No default implementation.
|
|
52
52
|
return null;
|
|
53
53
|
};
|
|
54
|
+
const getAutoSuggestIcons: {
|
|
55
|
+
// Called for every city bike station rendered as a search suggestion. Should return the icon and
|
|
56
|
+
// color used for that station. Two icons are available, 'citybike-stop-digitransit' anditybike-stop-digitransit-secondary'.
|
|
57
|
+
citybikes: station => {
|
|
58
|
+
return ['citybike-stop-digitransit', '#f2b62d'];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
54
61
|
const transportMode = undefined;
|
|
55
62
|
const placeholder = "stop-near-you";
|
|
56
63
|
const targets = ['Locations', 'Stops', 'Routes']; // Defines what you are searching. all available options are Locations, Stops, Routes, BikeRentalStations, FutureRoutes, MapPosition and CurrentPosition. Leave empty to search all targets.
|
|
@@ -67,6 +74,7 @@ return (
|
|
|
67
74
|
onClear={onClear}
|
|
68
75
|
autoFocus={false} // defines that should this field be automatically focused when page is loaded.
|
|
69
76
|
lang={lang}
|
|
77
|
+
getAutoSuggestIcons={getAutoSuggestIcons}
|
|
70
78
|
transportMode={transportMode} // transportmode with which we filter the routes, e.g. route-BUS
|
|
71
79
|
geocodingSize={10} // defines how many stops and stations to fetch from geocoding. Useful if you want to filter the results and still get a reasonable amount of suggestions.
|
|
72
80
|
filterResults={results => return results} // Optional filtering function for routes and stops
|
|
@@ -76,6 +84,9 @@ return (
|
|
|
76
84
|
sources={sources}
|
|
77
85
|
targets={targets}
|
|
78
86
|
isMobile // Optional. Defaults to false. Whether to use mobile search.
|
|
87
|
+
mobileLabel="Custom label" // Optional. Custom label text for autosuggest field on mobile.
|
|
88
|
+
inputClassName="" // Optional. Custom classname applied to the input element of the component for providing CSS styles.
|
|
89
|
+
translatedPlaceholder= // Optional. Custon translated placeholder text for autosuggest field.
|
|
79
90
|
```
|
|
80
91
|
|
|
81
92
|
<!-- This file is automatically generated. Please don't edit it directly:
|