@algolia/autocomplete-js 1.5.4 → 1.5.5
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @algolia/autocomplete-js 1.5.
|
|
1
|
+
/*! @algolia/autocomplete-js 1.5.5 | 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) :
|
|
@@ -311,7 +311,7 @@
|
|
|
311
311
|
|
|
312
312
|
var noop = function noop() {};
|
|
313
313
|
|
|
314
|
-
var version = '1.5.
|
|
314
|
+
var version = '1.5.5';
|
|
315
315
|
|
|
316
316
|
var userAgents$1 = [{
|
|
317
317
|
segment: 'autocomplete-core',
|
|
@@ -584,6 +584,14 @@
|
|
|
584
584
|
});
|
|
585
585
|
}
|
|
586
586
|
|
|
587
|
+
var chromeRegex = /(crmo|crios|chrome)/i;
|
|
588
|
+
var edgeRegex = /edg(e|ios|a)?/i;
|
|
589
|
+
var samsungBrowserRegex = /samsungbrowser/i;
|
|
590
|
+
var chromiumRegex = /chromium/i;
|
|
591
|
+
function isChrome(userAgent) {
|
|
592
|
+
return Boolean(userAgent && userAgent.match(chromeRegex) && !userAgent.match(edgeRegex) && !userAgent.match(samsungBrowserRegex) && !userAgent.match(chromiumRegex));
|
|
593
|
+
}
|
|
594
|
+
|
|
587
595
|
// We don't have access to the autocomplete source when we call `onKeyDown`
|
|
588
596
|
// or `onClick` because those are native browser events.
|
|
589
597
|
// However, we can get the source from the suggestion index.
|
|
@@ -674,6 +682,11 @@
|
|
|
674
682
|
return parent === child || parent.contains(child);
|
|
675
683
|
}
|
|
676
684
|
|
|
685
|
+
var regex = /((gt|sm)-|galaxy nexus)|samsung[- ]/i;
|
|
686
|
+
function isSamsung(userAgent) {
|
|
687
|
+
return Boolean(userAgent && userAgent.match(regex));
|
|
688
|
+
}
|
|
689
|
+
|
|
677
690
|
function ownKeys$e(object, enumerableOnly) {
|
|
678
691
|
var keys = Object.keys(object);
|
|
679
692
|
|
|
@@ -1991,6 +2004,8 @@
|
|
|
1991
2004
|
};
|
|
1992
2005
|
|
|
1993
2006
|
var getInputProps = function getInputProps(providedProps) {
|
|
2007
|
+
var _props$environment$na;
|
|
2008
|
+
|
|
1994
2009
|
function onFocus(event) {
|
|
1995
2010
|
// We want to trigger a query when `openOnFocus` is true
|
|
1996
2011
|
// because the panel should open with the current query.
|
|
@@ -2016,6 +2031,9 @@
|
|
|
2016
2031
|
rest = _objectWithoutProperties$1(_ref2, _excluded4);
|
|
2017
2032
|
|
|
2018
2033
|
var activeItem = getActiveItem(store.getState());
|
|
2034
|
+
var userAgent = (_props$environment$na = props.environment.navigator) === null || _props$environment$na === void 0 ? void 0 : _props$environment$na.userAgent;
|
|
2035
|
+
var shouldFallbackKeyHint = isSamsung(userAgent) && isChrome(userAgent);
|
|
2036
|
+
var enterKeyHint = activeItem !== null && activeItem !== void 0 && activeItem.itemUrl && !shouldFallbackKeyHint ? 'go' : 'search';
|
|
2019
2037
|
return _objectSpread$6({
|
|
2020
2038
|
'aria-autocomplete': 'both',
|
|
2021
2039
|
'aria-activedescendant': store.getState().isOpen && store.getState().activeItemId !== null ? "".concat(props.id, "-item-").concat(store.getState().activeItemId) : undefined,
|
|
@@ -2026,7 +2044,7 @@
|
|
|
2026
2044
|
autoComplete: 'off',
|
|
2027
2045
|
autoCorrect: 'off',
|
|
2028
2046
|
autoCapitalize: 'off',
|
|
2029
|
-
enterKeyHint:
|
|
2047
|
+
enterKeyHint: enterKeyHint,
|
|
2030
2048
|
spellCheck: 'false',
|
|
2031
2049
|
autoFocus: props.autoFocus,
|
|
2032
2050
|
placeholder: props.placeholder,
|