@sonic-equipment/ui 220.0.0 → 221.0.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.
- package/dist/algolia/algolia-search-provider.js +2 -2
- package/dist/algolia/use-algolia-search.d.ts +1 -1
- package/dist/global-search/plugins/categories-plugin.d.ts +1 -1
- package/dist/global-search/plugins/categories-plugin.js +1 -1
- package/dist/global-search/plugins/popular-categories-plugin.d.ts +1 -1
- package/dist/global-search/plugins/popular-categories-plugin.js +1 -1
- package/dist/global-search/plugins/popular-searches-plugin.d.ts +1 -1
- package/dist/global-search/plugins/popular-searches-plugin.js +1 -1
- package/dist/global-search/plugins/query-suggestions-plugin.d.ts +1 -1
- package/dist/global-search/plugins/query-suggestions-plugin.js +1 -1
- package/dist/global-search/plugins/quick-access-plugin.d.ts +1 -1
- package/dist/global-search/plugins/quick-access-plugin.js +1 -1
- package/dist/global-search/plugins/recent-searches-plugin.d.ts +1 -1
- package/dist/global-search/plugins/recent-searches-plugin.js +2 -1
- package/dist/global-search/search-highlight/highlight.d.ts +1 -1
- package/dist/global-search/search-highlight/highlight.js +1 -1
- package/dist/global-search/types.d.ts +1 -1
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/checkOptions.js +7 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/createAutocomplete.js +109 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/createStore.js +31 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/getAutocompleteSetters.js +51 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/getCompletion.js +12 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/getDefaultProps.js +135 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/getPropGetters.js +355 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/metadata.js +44 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/onInput.js +148 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/onKeyDown.js +202 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/reshape.js +48 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/resolve.js +119 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/stateReducer.js +149 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/utils/createCancelablePromise.js +50 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/utils/createCancelablePromiseList.js +42 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/utils/createConcurrentSafePromise.js +38 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/utils/getActiveItem.js +79 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/utils/getAutocompleteElementId.js +12 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/utils/getNativeEvent.js +5 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/utils/getNextActiveItemId.js +31 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/utils/getNormalizedSources.js +53 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/utils/getPluginSubmitPromise.js +39 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/utils/isOrContainsNode.js +5 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/utils/isSamsung.js +6 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-core@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-core/dist/esm/utils/mapToAlgoliaResponse.js +25 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-js@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-js/dist/esm/requesters/createAlgoliaRequester.js +16 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-js@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-js/dist/esm/requesters/getAlgoliaResults.js +12 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-js@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0_search-insights@2.17.3/node_modules/@algolia/autocomplete-js/dist/esm/userAgents.js +8 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-plugin-algolia-insights@1.19.2_@algolia_client-search@4.24.0_algoliasea_57b3nqmtgbeobm4sw3iw2qdpxy/node_modules/@algolia/autocomplete-plugin-algolia-insights/dist/esm/createAlgoliaInsightsPlugin.js +252 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-plugin-algolia-insights@1.19.2_@algolia_client-search@4.24.0_algoliasea_57b3nqmtgbeobm4sw3iw2qdpxy/node_modules/@algolia/autocomplete-plugin-algolia-insights/dist/esm/createClickedEvent.js +16 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-plugin-algolia-insights@1.19.2_@algolia_client-search@4.24.0_algoliasea_57b3nqmtgbeobm4sw3iw2qdpxy/node_modules/@algolia/autocomplete-plugin-algolia-insights/dist/esm/createSearchInsightsApi.js +209 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-plugin-algolia-insights@1.19.2_@algolia_client-search@4.24.0_algoliasea_57b3nqmtgbeobm4sw3iw2qdpxy/node_modules/@algolia/autocomplete-plugin-algolia-insights/dist/esm/createViewedEvents.js +18 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-plugin-algolia-insights@1.19.2_@algolia_client-search@4.24.0_algoliasea_57b3nqmtgbeobm4sw3iw2qdpxy/node_modules/@algolia/autocomplete-plugin-algolia-insights/dist/esm/isAlgoliaInsightsHit.js +5 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-plugin-algolia-insights@1.19.2_@algolia_client-search@4.24.0_algoliasea_57b3nqmtgbeobm4sw3iw2qdpxy/node_modules/@algolia/autocomplete-plugin-algolia-insights/dist/esm/isModernInsightsClient.js +25 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-plugin-query-suggestions@1.19.2_@algolia_client-search@4.24.0_algoliase_q33j3oaxy2utuyscyksb32r6mu/node_modules/@algolia/autocomplete-plugin-query-suggestions/dist/esm/constants.js +7 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-plugin-query-suggestions@1.19.2_@algolia_client-search@4.24.0_algoliase_q33j3oaxy2utuyscyksb32r6mu/node_modules/@algolia/autocomplete-plugin-query-suggestions/dist/esm/createQuerySuggestionsPlugin.js +118 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-plugin-query-suggestions@1.19.2_@algolia_client-search@4.24.0_algoliase_q33j3oaxy2utuyscyksb32r6mu/node_modules/@algolia/autocomplete-plugin-query-suggestions/dist/esm/getTemplates.js +64 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-plugin-recent-searches@1.19.2_@algolia_client-search@4.24.0_algoliasear_fyqsds3bt3rvcvjy7dxjzgxvaa/node_modules/@algolia/autocomplete-plugin-recent-searches/dist/esm/addHighlightedAttribute.js +21 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-plugin-recent-searches@1.19.2_@algolia_client-search@4.24.0_algoliasear_fyqsds3bt3rvcvjy7dxjzgxvaa/node_modules/@algolia/autocomplete-plugin-recent-searches/dist/esm/constants.js +10 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-plugin-recent-searches@1.19.2_@algolia_client-search@4.24.0_algoliasear_fyqsds3bt3rvcvjy7dxjzgxvaa/node_modules/@algolia/autocomplete-plugin-recent-searches/dist/esm/createLocalStorage.js +36 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-plugin-recent-searches@1.19.2_@algolia_client-search@4.24.0_algoliasear_fyqsds3bt3rvcvjy7dxjzgxvaa/node_modules/@algolia/autocomplete-plugin-recent-searches/dist/esm/createLocalStorageRecentSearchesPlugin.js +49 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-plugin-recent-searches@1.19.2_@algolia_client-search@4.24.0_algoliasear_fyqsds3bt3rvcvjy7dxjzgxvaa/node_modules/@algolia/autocomplete-plugin-recent-searches/dist/esm/createRecentSearchesPlugin.js +137 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-plugin-recent-searches@1.19.2_@algolia_client-search@4.24.0_algoliasear_fyqsds3bt3rvcvjy7dxjzgxvaa/node_modules/@algolia/autocomplete-plugin-recent-searches/dist/esm/createStorageApi.js +16 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-plugin-recent-searches@1.19.2_@algolia_client-search@4.24.0_algoliasear_fyqsds3bt3rvcvjy7dxjzgxvaa/node_modules/@algolia/autocomplete-plugin-recent-searches/dist/esm/getLocalStorage.js +33 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-plugin-recent-searches@1.19.2_@algolia_client-search@4.24.0_algoliasear_fyqsds3bt3rvcvjy7dxjzgxvaa/node_modules/@algolia/autocomplete-plugin-recent-searches/dist/esm/getTemplates.js +72 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-plugin-recent-searches@1.19.2_@algolia_client-search@4.24.0_algoliasear_fyqsds3bt3rvcvjy7dxjzgxvaa/node_modules/@algolia/autocomplete-plugin-recent-searches/dist/esm/search.js +25 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-preset-algolia@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-preset-algolia/dist/esm/constants/index.js +4 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-preset-algolia@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-preset-algolia/dist/esm/highlight/parseAlgoliaHitHighlight.js +25 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-preset-algolia@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-preset-algolia/dist/esm/highlight/parseAttribute.js +51 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-preset-algolia@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-preset-algolia/dist/esm/requester/createAlgoliaRequester.js +6 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-preset-algolia@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-preset-algolia/dist/esm/requester/createRequester.js +37 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-preset-algolia@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-preset-algolia/dist/esm/requester/getAlgoliaResults.js +19 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-preset-algolia@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-preset-algolia/dist/esm/search/fetchAlgoliaResults.js +69 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-preset-algolia@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-preset-algolia/dist/esm/utils/getAppIdAndApiKey.js +16 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-shared@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-shared/dist/esm/createRef.js +7 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-shared@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-shared/dist/esm/debounce.js +16 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-shared@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-shared/dist/esm/decycle.js +34 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-shared@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-shared/dist/esm/flatten.js +7 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-shared@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-shared/dist/esm/generateAutocompleteId.js +6 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-shared@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-shared/dist/esm/getAttributeValueByPath.js +7 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-shared@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-shared/dist/esm/getItemsCount.js +10 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-shared@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-shared/dist/esm/invariant.js +15 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-shared@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-shared/dist/esm/isEqual.js +26 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-shared@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-shared/dist/esm/noop.js +3 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-shared@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-shared/dist/esm/safelyRunOnBrowser.js +13 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-shared@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-shared/dist/esm/userAgents.js +8 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-shared@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-shared/dist/esm/version.js +3 -0
- package/dist/node_modules/.pnpm/@algolia_autocomplete-shared@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-shared/dist/esm/warn.js +26 -0
- package/dist/shared/utils/uuid.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { onInput } from './onInput.js';
|
|
2
|
+
import { onKeyDown } from './onKeyDown.js';
|
|
3
|
+
import { isSamsung } from './utils/isSamsung.js';
|
|
4
|
+
import { getNativeEvent } from './utils/getNativeEvent.js';
|
|
5
|
+
import { isOrContainsNode } from './utils/isOrContainsNode.js';
|
|
6
|
+
import { getAutocompleteElementId } from './utils/getAutocompleteElementId.js';
|
|
7
|
+
import { getActiveItem } from './utils/getActiveItem.js';
|
|
8
|
+
import { noop } from '../../../../../../@algolia_autocomplete-shared@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-shared/dist/esm/noop.js';
|
|
9
|
+
import { getPluginSubmitPromise } from './utils/getPluginSubmitPromise.js';
|
|
10
|
+
|
|
11
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
12
|
+
var _excluded = ["props", "refresh", "store"],
|
|
13
|
+
_excluded2 = ["inputElement", "formElement", "panelElement"],
|
|
14
|
+
_excluded3 = ["inputElement"],
|
|
15
|
+
_excluded4 = ["inputElement", "maxLength"],
|
|
16
|
+
_excluded5 = ["source"],
|
|
17
|
+
_excluded6 = ["item", "source"];
|
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
22
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
23
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
24
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
25
|
+
function getPropGetters(_ref) {
|
|
26
|
+
var props = _ref.props,
|
|
27
|
+
refresh = _ref.refresh,
|
|
28
|
+
store = _ref.store,
|
|
29
|
+
setters = _objectWithoutProperties(_ref, _excluded);
|
|
30
|
+
var getEnvironmentProps = function getEnvironmentProps(providedProps) {
|
|
31
|
+
var inputElement = providedProps.inputElement,
|
|
32
|
+
formElement = providedProps.formElement,
|
|
33
|
+
panelElement = providedProps.panelElement,
|
|
34
|
+
rest = _objectWithoutProperties(providedProps, _excluded2);
|
|
35
|
+
function onMouseDownOrTouchStart(event) {
|
|
36
|
+
// The `onTouchStart`/`onMouseDown` events shouldn't trigger the `blur`
|
|
37
|
+
// handler when it's not an interaction with Autocomplete.
|
|
38
|
+
// We detect it with the following heuristics:
|
|
39
|
+
// - the panel is closed AND there are no pending requests
|
|
40
|
+
// (no interaction with the autocomplete, no future state updates)
|
|
41
|
+
// - OR the touched target is the input element (should open the panel)
|
|
42
|
+
var isAutocompleteInteraction = store.getState().isOpen || !store.pendingRequests.isEmpty();
|
|
43
|
+
if (!isAutocompleteInteraction || event.target === inputElement) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// @TODO: support cases where there are multiple Autocomplete instances.
|
|
48
|
+
// Right now, a second instance makes this computation return false.
|
|
49
|
+
var isTargetWithinAutocomplete = [formElement, panelElement].some(function (contextNode) {
|
|
50
|
+
return isOrContainsNode(contextNode, event.target);
|
|
51
|
+
});
|
|
52
|
+
if (isTargetWithinAutocomplete === false) {
|
|
53
|
+
store.dispatch('blur', null);
|
|
54
|
+
|
|
55
|
+
// If requests are still pending when the user closes the panel, they
|
|
56
|
+
// could reopen the panel once they resolve.
|
|
57
|
+
// We want to prevent any subsequent query from reopening the panel
|
|
58
|
+
// because it would result in an unsolicited UI behavior.
|
|
59
|
+
if (!props.debug) {
|
|
60
|
+
store.pendingRequests.cancelAll();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return _objectSpread({
|
|
65
|
+
// We do not rely on the native `blur` event of the input to close the
|
|
66
|
+
// panel, but rather on a custom `touchstart`/`mousedown` event outside
|
|
67
|
+
// of the autocomplete elements.
|
|
68
|
+
// This ensures we don't mistakenly interpret interactions within the
|
|
69
|
+
// autocomplete (but outside of the input) as a signal to close the panel.
|
|
70
|
+
// For example, clicking reset button causes an input blur, but if
|
|
71
|
+
// `openOnFocus=true`, it shouldn't close the panel.
|
|
72
|
+
// On touch devices, scrolling results (`touchmove`) causes an input blur
|
|
73
|
+
// but shouldn't close the panel.
|
|
74
|
+
onTouchStart: onMouseDownOrTouchStart,
|
|
75
|
+
onMouseDown: onMouseDownOrTouchStart,
|
|
76
|
+
// When scrolling on touch devices (mobiles, tablets, etc.), we want to
|
|
77
|
+
// mimic the native platform behavior where the input is blurred to
|
|
78
|
+
// hide the virtual keyboard. This gives more vertical space to
|
|
79
|
+
// discover all the suggestions showing up in the panel.
|
|
80
|
+
onTouchMove: function onTouchMove(event) {
|
|
81
|
+
if (store.getState().isOpen === false || inputElement !== props.environment.document.activeElement || event.target === inputElement) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
inputElement.blur();
|
|
85
|
+
}
|
|
86
|
+
}, rest);
|
|
87
|
+
};
|
|
88
|
+
var getRootProps = function getRootProps(rest) {
|
|
89
|
+
return _objectSpread({
|
|
90
|
+
role: 'combobox',
|
|
91
|
+
'aria-expanded': store.getState().isOpen,
|
|
92
|
+
'aria-haspopup': 'listbox',
|
|
93
|
+
'aria-controls': store.getState().isOpen ? store.getState().collections.map(function (_ref2) {
|
|
94
|
+
var source = _ref2.source;
|
|
95
|
+
return getAutocompleteElementId(props.id, 'list', source);
|
|
96
|
+
}).join(' ') : undefined,
|
|
97
|
+
'aria-labelledby': getAutocompleteElementId(props.id, 'label')
|
|
98
|
+
}, rest);
|
|
99
|
+
};
|
|
100
|
+
var getFormProps = function getFormProps(providedProps) {
|
|
101
|
+
providedProps.inputElement;
|
|
102
|
+
var rest = _objectWithoutProperties(providedProps, _excluded3);
|
|
103
|
+
var handleSubmit = function handleSubmit(event) {
|
|
104
|
+
var _providedProps$inputE;
|
|
105
|
+
props.onSubmit(_objectSpread({
|
|
106
|
+
event: event,
|
|
107
|
+
refresh: refresh,
|
|
108
|
+
state: store.getState()
|
|
109
|
+
}, setters));
|
|
110
|
+
store.dispatch('submit', null);
|
|
111
|
+
(_providedProps$inputE = providedProps.inputElement) === null || _providedProps$inputE === void 0 ? void 0 : _providedProps$inputE.blur();
|
|
112
|
+
};
|
|
113
|
+
return _objectSpread({
|
|
114
|
+
action: '',
|
|
115
|
+
noValidate: true,
|
|
116
|
+
role: 'search',
|
|
117
|
+
onSubmit: function onSubmit(event) {
|
|
118
|
+
event.preventDefault();
|
|
119
|
+
var waitForSubmit = getPluginSubmitPromise(props.plugins, store.pendingRequests);
|
|
120
|
+
if (waitForSubmit !== undefined) {
|
|
121
|
+
waitForSubmit.then(function () {
|
|
122
|
+
return handleSubmit(event);
|
|
123
|
+
});
|
|
124
|
+
} else {
|
|
125
|
+
handleSubmit(event);
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
onReset: function onReset(event) {
|
|
129
|
+
var _providedProps$inputE2;
|
|
130
|
+
event.preventDefault();
|
|
131
|
+
props.onReset(_objectSpread({
|
|
132
|
+
event: event,
|
|
133
|
+
refresh: refresh,
|
|
134
|
+
state: store.getState()
|
|
135
|
+
}, setters));
|
|
136
|
+
store.dispatch('reset', null);
|
|
137
|
+
(_providedProps$inputE2 = providedProps.inputElement) === null || _providedProps$inputE2 === void 0 ? void 0 : _providedProps$inputE2.focus();
|
|
138
|
+
}
|
|
139
|
+
}, rest);
|
|
140
|
+
};
|
|
141
|
+
var getInputProps = function getInputProps(providedProps) {
|
|
142
|
+
var _props$environment$na;
|
|
143
|
+
function onFocus(event) {
|
|
144
|
+
// We want to trigger a query when `openOnFocus` is true
|
|
145
|
+
// because the panel should open with the current query.
|
|
146
|
+
if (props.openOnFocus || Boolean(store.getState().query)) {
|
|
147
|
+
onInput(_objectSpread({
|
|
148
|
+
event: event,
|
|
149
|
+
props: props,
|
|
150
|
+
query: store.getState().completion || store.getState().query,
|
|
151
|
+
refresh: refresh,
|
|
152
|
+
store: store
|
|
153
|
+
}, setters));
|
|
154
|
+
}
|
|
155
|
+
store.dispatch('focus', null);
|
|
156
|
+
}
|
|
157
|
+
var _ref3 = providedProps || {};
|
|
158
|
+
_ref3.inputElement;
|
|
159
|
+
var _ref3$maxLength = _ref3.maxLength,
|
|
160
|
+
maxLength = _ref3$maxLength === void 0 ? 512 : _ref3$maxLength,
|
|
161
|
+
rest = _objectWithoutProperties(_ref3, _excluded4);
|
|
162
|
+
var activeItem = getActiveItem(store.getState());
|
|
163
|
+
var userAgent = ((_props$environment$na = props.environment.navigator) === null || _props$environment$na === void 0 ? void 0 : _props$environment$na.userAgent) || '';
|
|
164
|
+
var shouldFallbackKeyHint = isSamsung(userAgent);
|
|
165
|
+
var enterKeyHint = props.enterKeyHint || (activeItem !== null && activeItem !== void 0 && activeItem.itemUrl && !shouldFallbackKeyHint ? 'go' : 'search');
|
|
166
|
+
return _objectSpread({
|
|
167
|
+
'aria-autocomplete': 'both',
|
|
168
|
+
'aria-activedescendant': store.getState().isOpen && store.getState().activeItemId !== null ? getAutocompleteElementId(props.id, "item-".concat(store.getState().activeItemId), activeItem === null || activeItem === void 0 ? void 0 : activeItem.source) : undefined,
|
|
169
|
+
'aria-controls': store.getState().isOpen ? store.getState().collections.filter(function (collection) {
|
|
170
|
+
return collection.items.length > 0;
|
|
171
|
+
}).map(function (_ref4) {
|
|
172
|
+
var source = _ref4.source;
|
|
173
|
+
return getAutocompleteElementId(props.id, 'list', source);
|
|
174
|
+
}).join(' ') : undefined,
|
|
175
|
+
'aria-labelledby': getAutocompleteElementId(props.id, 'label'),
|
|
176
|
+
value: store.getState().completion || store.getState().query,
|
|
177
|
+
id: getAutocompleteElementId(props.id, 'input'),
|
|
178
|
+
autoComplete: 'off',
|
|
179
|
+
autoCorrect: 'off',
|
|
180
|
+
autoCapitalize: 'off',
|
|
181
|
+
enterKeyHint: enterKeyHint,
|
|
182
|
+
spellCheck: 'false',
|
|
183
|
+
autoFocus: props.autoFocus,
|
|
184
|
+
placeholder: props.placeholder,
|
|
185
|
+
maxLength: maxLength,
|
|
186
|
+
type: 'search',
|
|
187
|
+
onChange: function onChange(event) {
|
|
188
|
+
var value = event.currentTarget.value;
|
|
189
|
+
if (props.ignoreCompositionEvents && getNativeEvent(event).isComposing) {
|
|
190
|
+
setters.setQuery(value);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
onInput(_objectSpread({
|
|
194
|
+
event: event,
|
|
195
|
+
props: props,
|
|
196
|
+
query: value.slice(0, maxLength),
|
|
197
|
+
refresh: refresh,
|
|
198
|
+
store: store
|
|
199
|
+
}, setters));
|
|
200
|
+
},
|
|
201
|
+
onCompositionEnd: function onCompositionEnd(event) {
|
|
202
|
+
onInput(_objectSpread({
|
|
203
|
+
event: event,
|
|
204
|
+
props: props,
|
|
205
|
+
query: event.currentTarget.value.slice(0, maxLength),
|
|
206
|
+
refresh: refresh,
|
|
207
|
+
store: store
|
|
208
|
+
}, setters));
|
|
209
|
+
},
|
|
210
|
+
onKeyDown: function onKeyDown$1(event) {
|
|
211
|
+
if (getNativeEvent(event).isComposing) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
onKeyDown(_objectSpread({
|
|
215
|
+
event: event,
|
|
216
|
+
props: props,
|
|
217
|
+
refresh: refresh,
|
|
218
|
+
store: store
|
|
219
|
+
}, setters));
|
|
220
|
+
},
|
|
221
|
+
onFocus: onFocus,
|
|
222
|
+
// We don't rely on the `blur` event.
|
|
223
|
+
// See explanation in `onTouchStart`/`onMouseDown`.
|
|
224
|
+
// @MAJOR See if we need to keep this handler.
|
|
225
|
+
onBlur: noop,
|
|
226
|
+
onClick: function onClick(event) {
|
|
227
|
+
// When the panel is closed and you click on the input while
|
|
228
|
+
// the input is focused, the `onFocus` event is not triggered
|
|
229
|
+
// (default browser behavior).
|
|
230
|
+
// In an autocomplete context, it makes sense to open the panel in this
|
|
231
|
+
// case.
|
|
232
|
+
// We mimic this event by catching the `onClick` event which
|
|
233
|
+
// triggers the `onFocus` for the panel to open.
|
|
234
|
+
if (providedProps.inputElement === props.environment.document.activeElement && !store.getState().isOpen) {
|
|
235
|
+
onFocus(event);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}, rest);
|
|
239
|
+
};
|
|
240
|
+
var getLabelProps = function getLabelProps(rest) {
|
|
241
|
+
return _objectSpread({
|
|
242
|
+
htmlFor: getAutocompleteElementId(props.id, 'input'),
|
|
243
|
+
id: getAutocompleteElementId(props.id, 'label')
|
|
244
|
+
}, rest);
|
|
245
|
+
};
|
|
246
|
+
var getListProps = function getListProps(providedProps) {
|
|
247
|
+
var _ref5 = providedProps || {},
|
|
248
|
+
source = _ref5.source,
|
|
249
|
+
rest = _objectWithoutProperties(_ref5, _excluded5);
|
|
250
|
+
return _objectSpread({
|
|
251
|
+
role: 'listbox',
|
|
252
|
+
'aria-labelledby': getAutocompleteElementId(props.id, 'label'),
|
|
253
|
+
id: getAutocompleteElementId(props.id, 'list', source)
|
|
254
|
+
}, rest);
|
|
255
|
+
};
|
|
256
|
+
var getPanelProps = function getPanelProps(rest) {
|
|
257
|
+
return _objectSpread({
|
|
258
|
+
onMouseDown: function onMouseDown(event) {
|
|
259
|
+
// Prevents the `activeElement` from being changed to the panel so
|
|
260
|
+
// that the blur event is not triggered, otherwise it closes the
|
|
261
|
+
// panel.
|
|
262
|
+
event.preventDefault();
|
|
263
|
+
},
|
|
264
|
+
onMouseLeave: function onMouseLeave() {
|
|
265
|
+
store.dispatch('mouseleave', null);
|
|
266
|
+
}
|
|
267
|
+
}, rest);
|
|
268
|
+
};
|
|
269
|
+
var getItemProps = function getItemProps(providedProps) {
|
|
270
|
+
var item = providedProps.item,
|
|
271
|
+
source = providedProps.source,
|
|
272
|
+
rest = _objectWithoutProperties(providedProps, _excluded6);
|
|
273
|
+
return _objectSpread({
|
|
274
|
+
id: getAutocompleteElementId(props.id, "item-".concat(item.__autocomplete_id), source),
|
|
275
|
+
role: 'option',
|
|
276
|
+
'aria-selected': store.getState().activeItemId === item.__autocomplete_id,
|
|
277
|
+
onMouseMove: function onMouseMove(event) {
|
|
278
|
+
if (item.__autocomplete_id === store.getState().activeItemId) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
store.dispatch('mousemove', item.__autocomplete_id);
|
|
282
|
+
var activeItem = getActiveItem(store.getState());
|
|
283
|
+
if (store.getState().activeItemId !== null && activeItem) {
|
|
284
|
+
var _item = activeItem.item,
|
|
285
|
+
itemInputValue = activeItem.itemInputValue,
|
|
286
|
+
itemUrl = activeItem.itemUrl,
|
|
287
|
+
_source = activeItem.source;
|
|
288
|
+
_source.onActive(_objectSpread({
|
|
289
|
+
event: event,
|
|
290
|
+
item: _item,
|
|
291
|
+
itemInputValue: itemInputValue,
|
|
292
|
+
itemUrl: itemUrl,
|
|
293
|
+
refresh: refresh,
|
|
294
|
+
source: _source,
|
|
295
|
+
state: store.getState()
|
|
296
|
+
}, setters));
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
onMouseDown: function onMouseDown(event) {
|
|
300
|
+
// Prevents the `activeElement` from being changed to the item so it
|
|
301
|
+
// can remain with the current `activeElement`.
|
|
302
|
+
event.preventDefault();
|
|
303
|
+
},
|
|
304
|
+
onClick: function onClick(event) {
|
|
305
|
+
var itemInputValue = source.getItemInputValue({
|
|
306
|
+
item: item,
|
|
307
|
+
state: store.getState()
|
|
308
|
+
});
|
|
309
|
+
var itemUrl = source.getItemUrl({
|
|
310
|
+
item: item,
|
|
311
|
+
state: store.getState()
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
// If `getItemUrl` is provided, it means that the suggestion
|
|
315
|
+
// is a link, not plain text that aims at updating the query.
|
|
316
|
+
// We can therefore skip the state change because it will update
|
|
317
|
+
// the `activeItemId`, resulting in a UI flash, especially
|
|
318
|
+
// noticeable on mobile.
|
|
319
|
+
var runPreCommand = itemUrl ? Promise.resolve() : onInput(_objectSpread({
|
|
320
|
+
event: event,
|
|
321
|
+
nextState: {
|
|
322
|
+
isOpen: false
|
|
323
|
+
},
|
|
324
|
+
props: props,
|
|
325
|
+
query: itemInputValue,
|
|
326
|
+
refresh: refresh,
|
|
327
|
+
store: store
|
|
328
|
+
}, setters));
|
|
329
|
+
runPreCommand.then(function () {
|
|
330
|
+
source.onSelect(_objectSpread({
|
|
331
|
+
event: event,
|
|
332
|
+
item: item,
|
|
333
|
+
itemInputValue: itemInputValue,
|
|
334
|
+
itemUrl: itemUrl,
|
|
335
|
+
refresh: refresh,
|
|
336
|
+
source: source,
|
|
337
|
+
state: store.getState()
|
|
338
|
+
}, setters));
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
}, rest);
|
|
342
|
+
};
|
|
343
|
+
return {
|
|
344
|
+
getEnvironmentProps: getEnvironmentProps,
|
|
345
|
+
getRootProps: getRootProps,
|
|
346
|
+
getFormProps: getFormProps,
|
|
347
|
+
getLabelProps: getLabelProps,
|
|
348
|
+
getInputProps: getInputProps,
|
|
349
|
+
getPanelProps: getPanelProps,
|
|
350
|
+
getListProps: getListProps,
|
|
351
|
+
getItemProps: getItemProps
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
export { getPropGetters };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { userAgents } from '../../../../../../@algolia_autocomplete-shared@1.19.2_@algolia_client-search@4.24.0_algoliasearch@4.24.0/node_modules/@algolia/autocomplete-shared/dist/esm/userAgents.js';
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
9
|
+
function getMetadata(_ref) {
|
|
10
|
+
var _, _options$__autocomple, _options$__autocomple2, _options$__autocomple3;
|
|
11
|
+
var plugins = _ref.plugins,
|
|
12
|
+
options = _ref.options;
|
|
13
|
+
var optionsKey = (_ = (((_options$__autocomple = options.__autocomplete_metadata) === null || _options$__autocomple === void 0 ? void 0 : _options$__autocomple.userAgents) || [])[0]) === null || _ === void 0 ? void 0 : _.segment;
|
|
14
|
+
var extraOptions = optionsKey ? _defineProperty({}, optionsKey, Object.keys(((_options$__autocomple2 = options.__autocomplete_metadata) === null || _options$__autocomple2 === void 0 ? void 0 : _options$__autocomple2.options) || {})) : {};
|
|
15
|
+
return {
|
|
16
|
+
plugins: plugins.map(function (plugin) {
|
|
17
|
+
return {
|
|
18
|
+
name: plugin.name,
|
|
19
|
+
options: Object.keys(plugin.__autocomplete_pluginOptions || [])
|
|
20
|
+
};
|
|
21
|
+
}),
|
|
22
|
+
options: _objectSpread({
|
|
23
|
+
'autocomplete-core': Object.keys(options)
|
|
24
|
+
}, extraOptions),
|
|
25
|
+
ua: userAgents.concat(((_options$__autocomple3 = options.__autocomplete_metadata) === null || _options$__autocomple3 === void 0 ? void 0 : _options$__autocomple3.userAgents) || [])
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function injectMetadata(_ref3) {
|
|
29
|
+
var _environment$navigato, _environment$navigato2;
|
|
30
|
+
var metadata = _ref3.metadata,
|
|
31
|
+
environment = _ref3.environment;
|
|
32
|
+
var isMetadataEnabled = (_environment$navigato = environment.navigator) === null || _environment$navigato === void 0 ? void 0 : (_environment$navigato2 = _environment$navigato.userAgent) === null || _environment$navigato2 === void 0 ? void 0 : _environment$navigato2.includes('Algolia Crawler');
|
|
33
|
+
if (isMetadataEnabled) {
|
|
34
|
+
var metadataContainer = environment.document.createElement('meta');
|
|
35
|
+
var headRef = environment.document.querySelector('head');
|
|
36
|
+
metadataContainer.name = 'algolia:metadata';
|
|
37
|
+
setTimeout(function () {
|
|
38
|
+
metadataContainer.content = JSON.stringify(metadata);
|
|
39
|
+
headRef.appendChild(metadataContainer);
|
|
40
|
+
}, 0);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { getMetadata, injectMetadata };
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { reshape } from './reshape.js';
|
|
2
|
+
import { preResolve, resolve, postResolve } from './resolve.js';
|
|
3
|
+
import { cancelable } from './utils/createCancelablePromise.js';
|
|
4
|
+
import { createConcurrentSafePromise } from './utils/createConcurrentSafePromise.js';
|
|
5
|
+
import { getActiveItem } from './utils/getActiveItem.js';
|
|
6
|
+
|
|
7
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
8
|
+
var _excluded = ["event", "nextState", "props", "query", "refresh", "store"];
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
15
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
16
|
+
var lastStalledId = null;
|
|
17
|
+
var runConcurrentSafePromise = createConcurrentSafePromise();
|
|
18
|
+
function onInput(_ref) {
|
|
19
|
+
var event = _ref.event,
|
|
20
|
+
_ref$nextState = _ref.nextState,
|
|
21
|
+
nextState = _ref$nextState === void 0 ? {} : _ref$nextState,
|
|
22
|
+
props = _ref.props,
|
|
23
|
+
query = _ref.query,
|
|
24
|
+
refresh = _ref.refresh,
|
|
25
|
+
store = _ref.store,
|
|
26
|
+
setters = _objectWithoutProperties(_ref, _excluded);
|
|
27
|
+
if (lastStalledId) {
|
|
28
|
+
props.environment.clearTimeout(lastStalledId);
|
|
29
|
+
}
|
|
30
|
+
var setCollections = setters.setCollections,
|
|
31
|
+
setIsOpen = setters.setIsOpen,
|
|
32
|
+
setQuery = setters.setQuery,
|
|
33
|
+
setActiveItemId = setters.setActiveItemId,
|
|
34
|
+
setStatus = setters.setStatus,
|
|
35
|
+
setContext = setters.setContext;
|
|
36
|
+
setQuery(query);
|
|
37
|
+
setActiveItemId(props.defaultActiveItemId);
|
|
38
|
+
if (!query && props.openOnFocus === false) {
|
|
39
|
+
var _nextState$isOpen;
|
|
40
|
+
var collections = store.getState().collections.map(function (collection) {
|
|
41
|
+
return _objectSpread(_objectSpread({}, collection), {}, {
|
|
42
|
+
items: []
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
setStatus('idle');
|
|
46
|
+
setCollections(collections);
|
|
47
|
+
setIsOpen((_nextState$isOpen = nextState.isOpen) !== null && _nextState$isOpen !== void 0 ? _nextState$isOpen : props.shouldPanelOpen({
|
|
48
|
+
state: store.getState()
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
// We make sure to update the latest resolved value of the tracked
|
|
52
|
+
// promises to keep late resolving promises from "cancelling" the state
|
|
53
|
+
// updates performed in this code path.
|
|
54
|
+
// We chain with a void promise to respect `onInput`'s expected return type.
|
|
55
|
+
var _request = cancelable(runConcurrentSafePromise(collections).then(function () {
|
|
56
|
+
return Promise.resolve();
|
|
57
|
+
}));
|
|
58
|
+
return store.pendingRequests.add(_request);
|
|
59
|
+
}
|
|
60
|
+
setStatus('loading');
|
|
61
|
+
lastStalledId = props.environment.setTimeout(function () {
|
|
62
|
+
setStatus('stalled');
|
|
63
|
+
}, props.stallThreshold);
|
|
64
|
+
|
|
65
|
+
// We track the entire promise chain triggered by `onInput` before mutating
|
|
66
|
+
// the Autocomplete state to make sure that any state manipulation is based on
|
|
67
|
+
// fresh data regardless of when promises individually resolve.
|
|
68
|
+
// We don't track nested promises and only rely on the full chain resolution,
|
|
69
|
+
// meaning we should only ever manipulate the state once this concurrent-safe
|
|
70
|
+
// promise is resolved.
|
|
71
|
+
var request = cancelable(runConcurrentSafePromise(props.getSources(_objectSpread({
|
|
72
|
+
query: query,
|
|
73
|
+
refresh: refresh,
|
|
74
|
+
state: store.getState()
|
|
75
|
+
}, setters)).then(function (sources) {
|
|
76
|
+
return Promise.all(sources.map(function (source) {
|
|
77
|
+
return Promise.resolve(source.getItems(_objectSpread({
|
|
78
|
+
query: query,
|
|
79
|
+
refresh: refresh,
|
|
80
|
+
state: store.getState()
|
|
81
|
+
}, setters))).then(function (itemsOrDescription) {
|
|
82
|
+
return preResolve(itemsOrDescription, source.sourceId, store.getState());
|
|
83
|
+
});
|
|
84
|
+
})).then(resolve).then(function (responses) {
|
|
85
|
+
var __automaticInsights = responses.some(function (_ref2) {
|
|
86
|
+
var items = _ref2.items;
|
|
87
|
+
return isSearchResponseWithAutomaticInsightsFlag(items);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// No need to pollute the context if `__automaticInsights=false`
|
|
91
|
+
if (__automaticInsights) {
|
|
92
|
+
var _store$getState$conte;
|
|
93
|
+
setContext({
|
|
94
|
+
algoliaInsightsPlugin: _objectSpread(_objectSpread({}, ((_store$getState$conte = store.getState().context) === null || _store$getState$conte === void 0 ? void 0 : _store$getState$conte.algoliaInsightsPlugin) || {}), {}, {
|
|
95
|
+
__automaticInsights: __automaticInsights
|
|
96
|
+
})
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return postResolve(responses, sources, store);
|
|
100
|
+
}).then(function (collections) {
|
|
101
|
+
return reshape({
|
|
102
|
+
collections: collections,
|
|
103
|
+
props: props,
|
|
104
|
+
state: store.getState()
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}))).then(function (collections) {
|
|
108
|
+
var _nextState$isOpen2;
|
|
109
|
+
// Parameters passed to `onInput` could be stale when the following code
|
|
110
|
+
// executes, because `onInput` calls may not resolve in order.
|
|
111
|
+
// If it becomes a problem we'll need to save the last passed parameters.
|
|
112
|
+
// See: https://codesandbox.io/s/agitated-cookies-y290z
|
|
113
|
+
|
|
114
|
+
setStatus('idle');
|
|
115
|
+
setCollections(collections);
|
|
116
|
+
var isPanelOpen = props.shouldPanelOpen({
|
|
117
|
+
state: store.getState()
|
|
118
|
+
});
|
|
119
|
+
setIsOpen((_nextState$isOpen2 = nextState.isOpen) !== null && _nextState$isOpen2 !== void 0 ? _nextState$isOpen2 : props.openOnFocus && !query && isPanelOpen || isPanelOpen);
|
|
120
|
+
var highlightedItem = getActiveItem(store.getState());
|
|
121
|
+
if (store.getState().activeItemId !== null && highlightedItem) {
|
|
122
|
+
var item = highlightedItem.item,
|
|
123
|
+
itemInputValue = highlightedItem.itemInputValue,
|
|
124
|
+
itemUrl = highlightedItem.itemUrl,
|
|
125
|
+
source = highlightedItem.source;
|
|
126
|
+
source.onActive(_objectSpread({
|
|
127
|
+
event: event,
|
|
128
|
+
item: item,
|
|
129
|
+
itemInputValue: itemInputValue,
|
|
130
|
+
itemUrl: itemUrl,
|
|
131
|
+
refresh: refresh,
|
|
132
|
+
source: source,
|
|
133
|
+
state: store.getState()
|
|
134
|
+
}, setters));
|
|
135
|
+
}
|
|
136
|
+
}).finally(function () {
|
|
137
|
+
setStatus('idle');
|
|
138
|
+
if (lastStalledId) {
|
|
139
|
+
props.environment.clearTimeout(lastStalledId);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
return store.pendingRequests.add(request);
|
|
143
|
+
}
|
|
144
|
+
function isSearchResponseWithAutomaticInsightsFlag(items) {
|
|
145
|
+
return !Array.isArray(items) && Boolean(items === null || items === void 0 ? void 0 : items._automaticInsights);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export { onInput };
|