@algolia/autocomplete-core 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.
@@ -21,6 +21,7 @@ export function getDefaultProps(props, pluginSubscribers) {
21
21
  return _objectSpread(_objectSpread({
22
22
  debug: false,
23
23
  openOnFocus: false,
24
+ enterKeyHint: undefined,
24
25
  placeholder: '',
25
26
  autoFocus: false,
26
27
  defaultActiveItemId: null,
@@ -144,7 +144,7 @@ export function getPropGetters(_ref) {
144
144
  var activeItem = getActiveItem(store.getState());
145
145
  var userAgent = ((_props$environment$na = props.environment.navigator) === null || _props$environment$na === void 0 ? void 0 : _props$environment$na.userAgent) || '';
146
146
  var shouldFallbackKeyHint = isSamsung(userAgent);
147
- var enterKeyHint = activeItem !== null && activeItem !== void 0 && activeItem.itemUrl && !shouldFallbackKeyHint ? 'go' : 'search';
147
+ var enterKeyHint = props.enterKeyHint || (activeItem !== null && activeItem !== void 0 && activeItem.itemUrl && !shouldFallbackKeyHint ? 'go' : 'search');
148
148
  return _objectSpread({
149
149
  'aria-autocomplete': 'both',
150
150
  'aria-activedescendant': store.getState().isOpen && store.getState().activeItemId !== null ? "".concat(props.id, "-item-").concat(store.getState().activeItemId) : undefined,
@@ -1,4 +1,4 @@
1
- /*! @algolia/autocomplete-core 1.9.3 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
1
+ /*! @algolia/autocomplete-core 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) :
@@ -291,7 +291,7 @@
291
291
  return undefined;
292
292
  }
293
293
 
294
- var version = '1.9.3';
294
+ var version = '1.10.0';
295
295
 
296
296
  var userAgents = [{
297
297
  segment: 'autocomplete-core',
@@ -322,7 +322,8 @@
322
322
 
323
323
  function createClickedEvent(_ref) {
324
324
  var item = _ref.item,
325
- items = _ref.items;
325
+ _ref$items = _ref.items,
326
+ items = _ref$items === void 0 ? [] : _ref$items;
326
327
  return {
327
328
  index: item.__autocomplete_indexName,
328
329
  items: [item],
@@ -895,7 +896,8 @@
895
896
  onSelect(function (_ref5) {
896
897
  var item = _ref5.item,
897
898
  state = _ref5.state,
898
- event = _ref5.event;
899
+ event = _ref5.event,
900
+ source = _ref5.source;
899
901
  if (!isAlgoliaInsightsHit(item)) {
900
902
  return;
901
903
  }
@@ -908,12 +910,13 @@
908
910
  eventName: 'Item Selected'
909
911
  }, createClickedEvent({
910
912
  item: item,
911
- items: previousItems.current
913
+ items: source.getItems().filter(isAlgoliaInsightsHit)
912
914
  }))]
913
915
  });
914
916
  });
915
917
  onActive(function (_ref6) {
916
918
  var item = _ref6.item,
919
+ source = _ref6.source,
917
920
  state = _ref6.state,
918
921
  event = _ref6.event;
919
922
  if (!isAlgoliaInsightsHit(item)) {
@@ -928,7 +931,7 @@
928
931
  eventName: 'Item Active'
929
932
  }, createClickedEvent({
930
933
  item: item,
931
- items: previousItems.current
934
+ items: source.getItems().filter(isAlgoliaInsightsHit)
932
935
  }))]
933
936
  });
934
937
  });
@@ -1350,6 +1353,7 @@
1350
1353
  return _objectSpread2(_objectSpread2({
1351
1354
  debug: false,
1352
1355
  openOnFocus: false,
1356
+ enterKeyHint: undefined,
1353
1357
  placeholder: '',
1354
1358
  autoFocus: false,
1355
1359
  defaultActiveItemId: null,
@@ -2029,7 +2033,7 @@
2029
2033
  var activeItem = getActiveItem(store.getState());
2030
2034
  var userAgent = ((_props$environment$na = props.environment.navigator) === null || _props$environment$na === void 0 ? void 0 : _props$environment$na.userAgent) || '';
2031
2035
  var shouldFallbackKeyHint = isSamsung(userAgent);
2032
- var enterKeyHint = activeItem !== null && activeItem !== void 0 && activeItem.itemUrl && !shouldFallbackKeyHint ? 'go' : 'search';
2036
+ var enterKeyHint = props.enterKeyHint || (activeItem !== null && activeItem !== void 0 && activeItem.itemUrl && !shouldFallbackKeyHint ? 'go' : 'search');
2033
2037
  return _objectSpread2({
2034
2038
  'aria-autocomplete': 'both',
2035
2039
  'aria-activedescendant': store.getState().isOpen && store.getState().activeItemId !== null ? "".concat(props.id, "-item-").concat(store.getState().activeItemId) : undefined,