diff --git a/docs/source/bootstrap.html.erb b/docs/source/bootstrap.html.erb index 6749ff80e..90a34ace5 100644 --- a/docs/source/bootstrap.html.erb +++ b/docs/source/bootstrap.html.erb @@ -8,6 +8,9 @@ layout: bootstrap diff --git a/docs/source/partials/documentation.md.erb b/docs/source/partials/documentation.md.erb index 8f02f64bb..0befb4a25 100644 --- a/docs/source/partials/documentation.md.erb +++ b/docs/source/partials/documentation.md.erb @@ -236,6 +236,17 @@ Type: **object** Algolia [JavaScript API client options](https://github.com/algolia/algoliasearch-client-js#client-options). This is an advanced option. + + + + +
autocompleteOptions
+ +Type: **object** + + +[autocomplete.js options](https://github.com/algolia/autocomplete.js#options) to configure the underlying +autocomplete.js instance. diff --git a/src/places.js b/src/places.js index 9e1025a4b..b2062030d 100644 --- a/src/places.js +++ b/src/places.js @@ -15,25 +15,23 @@ import pinIcon from './icons/address.svg'; export default function places(options) { const { container, - style + style, + autocompleteOptions: userAutocompleteOptions = {} } = options; const placesInstance = new EventEmitter(); - // https://github.com/algolia/autocomplete.js#options const autocompleteOptions = { autoselect: true, hint: false, cssClasses: { root: 'algolia-places' + (style === false ? '-nostyle' : ''), prefix: 'ap' + (style === false ? '-nostyle' : '') - } + }, + debug: process.env.NODE_ENV === 'development' ? true : false, + ...userAutocompleteOptions }; - if (process.env.NODE_ENV === 'development') { - autocompleteOptions.debug = true; - } - const autocompleteDataset = createAutocompleteDataset({ ...options, algoliasearch,