@algolia/autocomplete-js 1.9.3 → 1.10.0

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.
@@ -44,7 +44,7 @@ export declare function getDefaultOptions<TItem extends BaseItem>(options: Autoc
44
44
  autoComplete: "on" | "off";
45
45
  autoCorrect: "on" | "off";
46
46
  autoCapitalize: "on" | "off";
47
- enterKeyHint: "search" | "go";
47
+ enterKeyHint: import("@algolia/autocomplete-core").AutocompleteEnterKeyHint;
48
48
  spellCheck: "false";
49
49
  maxLength: number;
50
50
  type: "search";
@@ -69,7 +69,7 @@ export declare function getDefaultOptions<TItem extends BaseItem>(options: Autoc
69
69
  autoComplete: "on" | "off";
70
70
  autoCorrect: "on" | "off";
71
71
  autoCapitalize: "on" | "off";
72
- enterKeyHint: "search" | "go";
72
+ enterKeyHint: import("@algolia/autocomplete-core").AutocompleteEnterKeyHint;
73
73
  spellCheck: "false";
74
74
  maxLength: number;
75
75
  type: "search";
@@ -186,6 +186,7 @@ export declare function getDefaultOptions<TItem extends BaseItem>(options: Autoc
186
186
  onStateChange?(props: import("@algolia/autocomplete-shared").OnStateChangeProps<TItem>): void;
187
187
  plugins?: import("@algolia/autocomplete-shared").AutocompletePlugin<any, any>[] | undefined;
188
188
  debug?: boolean | undefined;
189
+ enterKeyHint?: import("@algolia/autocomplete-core").AutocompleteEnterKeyHint | undefined;
189
190
  placeholder?: string | undefined;
190
191
  autoFocus?: boolean | undefined;
191
192
  defaultActiveItemId?: number | null | undefined;
@@ -1,4 +1,4 @@
1
- /*! @algolia/autocomplete-js 1.9.3 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
1
+ /*! @algolia/autocomplete-js 1.10.0 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
4
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -347,7 +347,7 @@
347
347
  return undefined;
348
348
  }
349
349
 
350
- var version = '1.9.3';
350
+ var version = '1.10.0';
351
351
 
352
352
  var userAgents$1 = [{
353
353
  segment: 'autocomplete-core',
@@ -378,7 +378,8 @@
378
378
 
379
379
  function createClickedEvent(_ref) {
380
380
  var item = _ref.item,
381
- items = _ref.items;
381
+ _ref$items = _ref.items,
382
+ items = _ref$items === void 0 ? [] : _ref$items;
382
383
  return {
383
384
  index: item.__autocomplete_indexName,
384
385
  items: [item],
@@ -951,7 +952,8 @@
951
952
  onSelect(function (_ref5) {
952
953
  var item = _ref5.item,
953
954
  state = _ref5.state,
954
- event = _ref5.event;
955
+ event = _ref5.event,
956
+ source = _ref5.source;
955
957
  if (!isAlgoliaInsightsHit(item)) {
956
958
  return;
957
959
  }
@@ -964,12 +966,13 @@
964
966
  eventName: 'Item Selected'
965
967
  }, createClickedEvent({
966
968
  item: item,
967
- items: previousItems.current
969
+ items: source.getItems().filter(isAlgoliaInsightsHit)
968
970
  }))]
969
971
  });
970
972
  });
971
973
  onActive(function (_ref6) {
972
974
  var item = _ref6.item,
975
+ source = _ref6.source,
973
976
  state = _ref6.state,
974
977
  event = _ref6.event;
975
978
  if (!isAlgoliaInsightsHit(item)) {
@@ -984,7 +987,7 @@
984
987
  eventName: 'Item Active'
985
988
  }, createClickedEvent({
986
989
  item: item,
987
- items: previousItems.current
990
+ items: source.getItems().filter(isAlgoliaInsightsHit)
988
991
  }))]
989
992
  });
990
993
  });
@@ -1663,6 +1666,7 @@
1663
1666
  return _objectSpread$b(_objectSpread$b({
1664
1667
  debug: false,
1665
1668
  openOnFocus: false,
1669
+ enterKeyHint: undefined,
1666
1670
  placeholder: '',
1667
1671
  autoFocus: false,
1668
1672
  defaultActiveItemId: null,
@@ -2738,7 +2742,7 @@
2738
2742
  var activeItem = getActiveItem(store.getState());
2739
2743
  var userAgent = ((_props$environment$na = props.environment.navigator) === null || _props$environment$na === void 0 ? void 0 : _props$environment$na.userAgent) || '';
2740
2744
  var shouldFallbackKeyHint = isSamsung(userAgent);
2741
- var enterKeyHint = activeItem !== null && activeItem !== void 0 && activeItem.itemUrl && !shouldFallbackKeyHint ? 'go' : 'search';
2745
+ var enterKeyHint = props.enterKeyHint || (activeItem !== null && activeItem !== void 0 && activeItem.itemUrl && !shouldFallbackKeyHint ? 'go' : 'search');
2742
2746
  return _objectSpread$6({
2743
2747
  'aria-autocomplete': 'both',
2744
2748
  'aria-activedescendant': store.getState().isOpen && store.getState().activeItemId !== null ? "".concat(props.id, "-item-").concat(store.getState().activeItemId) : undefined,