instantsearch.js 4.49.1 → 4.49.2
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/README.md +3 -3
- package/cjs/components/Answers/Answers.js +6 -16
- package/cjs/components/Breadcrumb/Breadcrumb.js +5 -12
- package/cjs/components/ClearRefinements/ClearRefinements.js +4 -11
- package/cjs/components/CurrentRefinements/CurrentRefinements.js +5 -12
- package/cjs/components/GeoSearchControls/GeoSearchButton.js +4 -6
- package/cjs/components/GeoSearchControls/GeoSearchControls.js +11 -20
- package/cjs/components/GeoSearchControls/GeoSearchToggle.js +4 -6
- package/cjs/components/Highlight/Highlight.js +3 -11
- package/cjs/components/Hits/Hits.js +8 -20
- package/cjs/components/InfiniteHits/InfiniteHits.js +13 -25
- package/cjs/components/InternalHighlight/InternalHighlight.js +0 -3
- package/cjs/components/MenuSelect/MenuSelect.js +9 -19
- package/cjs/components/Pagination/Pagination.js +10 -17
- package/cjs/components/Panel/Panel.js +7 -26
- package/cjs/components/PoweredBy/PoweredBy.js +4 -5
- package/cjs/components/QueryRuleCustomData/QueryRuleCustomData.js +2 -6
- package/cjs/components/RangeInput/RangeInput.js +16 -48
- package/cjs/components/RefinementList/RefinementList.js +19 -73
- package/cjs/components/RefinementList/RefinementListItem.js +8 -14
- package/cjs/components/RelevantSort/RelevantSort.js +4 -8
- package/cjs/components/ReverseHighlight/ReverseHighlight.js +3 -11
- package/cjs/components/ReverseSnippet/ReverseSnippet.js +3 -11
- package/cjs/components/SearchBox/SearchBox.js +25 -69
- package/cjs/components/Selector/Selector.js +3 -6
- package/cjs/components/Slider/Pit.js +3 -10
- package/cjs/components/Slider/Rheostat.js +63 -131
- package/cjs/components/Slider/Slider.js +28 -65
- package/cjs/components/Snippet/Snippet.js +3 -11
- package/cjs/components/Stats/Stats.js +7 -20
- package/cjs/components/Template/Template.js +8 -37
- package/cjs/components/ToggleRefinement/ToggleRefinement.js +4 -10
- package/cjs/components/VoiceSearch/VoiceSearch.js +8 -15
- package/cjs/connectors/answers/connectAnswers.js +21 -36
- package/cjs/connectors/autocomplete/connectAutocomplete.js +8 -25
- package/cjs/connectors/breadcrumb/connectBreadcrumb.js +17 -48
- package/cjs/connectors/clear-refinements/connectClearRefinements.js +27 -45
- package/cjs/connectors/configure/connectConfigure.js +6 -20
- package/cjs/connectors/configure-related-items/connectConfigureRelatedItems.js +11 -36
- package/cjs/connectors/current-refinements/connectCurrentRefinements.js +18 -57
- package/cjs/connectors/dynamic-widgets/connectDynamicWidgets.js +17 -37
- package/cjs/connectors/geo-search/connectGeoSearch.js +17 -47
- package/cjs/connectors/hierarchical-menu/connectHierarchicalMenu.js +38 -74
- package/cjs/connectors/hits/connectHits.js +10 -26
- package/cjs/connectors/hits/connectHitsWithInsights.js +0 -4
- package/cjs/connectors/hits-per-page/connectHitsPerPage.js +15 -38
- package/cjs/connectors/index.js +62 -96
- package/cjs/connectors/infinite-hits/connectInfiniteHits.js +26 -62
- package/cjs/connectors/infinite-hits/connectInfiniteHitsWithInsights.js +0 -4
- package/cjs/connectors/menu/connectMenu.js +28 -66
- package/cjs/connectors/numeric-menu/connectNumericMenu.js +24 -78
- package/cjs/connectors/pagination/Paginator.js +3 -20
- package/cjs/connectors/pagination/connectPagination.js +8 -25
- package/cjs/connectors/powered-by/connectPoweredBy.js +4 -13
- package/cjs/connectors/query-rules/connectQueryRules.js +32 -56
- package/cjs/connectors/range/connectRange.js +41 -101
- package/cjs/connectors/rating-menu/connectRatingMenu.js +23 -79
- package/cjs/connectors/refinement-list/connectRefinementList.js +37 -70
- package/cjs/connectors/relevant-sort/connectRelevantSort.js +4 -14
- package/cjs/connectors/search-box/connectSearchBox.js +7 -23
- package/cjs/connectors/sort-by/connectSortBy.js +11 -21
- package/cjs/connectors/stats/connectStats.js +4 -11
- package/cjs/connectors/toggle-refinement/connectToggleRefinement.js +29 -63
- package/cjs/connectors/voice-search/connectVoiceSearch.js +13 -35
- package/cjs/helpers/components/Highlight.js +4 -12
- package/cjs/helpers/components/ReverseHighlight.js +7 -19
- package/cjs/helpers/components/ReverseSnippet.js +7 -19
- package/cjs/helpers/components/Snippet.js +4 -12
- package/cjs/helpers/components/index.js +0 -8
- package/cjs/helpers/get-insights-anonymous-user-token.js +4 -15
- package/cjs/helpers/highlight.js +10 -16
- package/cjs/helpers/index.js +17 -31
- package/cjs/helpers/insights.js +5 -17
- package/cjs/helpers/reverseHighlight.js +10 -16
- package/cjs/helpers/reverseSnippet.js +10 -16
- package/cjs/helpers/snippet.js +10 -16
- package/cjs/index.js +3 -18
- package/cjs/lib/InstantSearch.js +79 -180
- package/cjs/lib/createHelpers.js +4 -11
- package/cjs/lib/formatNumber.js +0 -1
- package/cjs/lib/infiniteHitsCache/index.js +0 -2
- package/cjs/lib/infiniteHitsCache/sessionStorage.js +9 -18
- package/cjs/lib/insights/client.js +8 -34
- package/cjs/lib/insights/index.js +7 -13
- package/cjs/lib/insights/listener.js +4 -20
- package/cjs/lib/routers/history.js +63 -102
- package/cjs/lib/routers/index.js +0 -2
- package/cjs/lib/stateMappings/index.js +0 -3
- package/cjs/lib/stateMappings/simple.js +6 -13
- package/cjs/lib/stateMappings/singleIndex.js +1 -7
- package/cjs/lib/suit.js +2 -5
- package/cjs/lib/templating/index.js +0 -4
- package/cjs/lib/templating/prepareTemplateProps.js +8 -19
- package/cjs/lib/templating/renderTemplate.js +9 -24
- package/cjs/lib/utils/capitalize.js +0 -1
- package/cjs/lib/utils/checkIndexUiState.js +15 -43
- package/cjs/lib/utils/checkRendering.js +0 -2
- package/cjs/lib/utils/clearRefinements.js +2 -9
- package/cjs/lib/utils/concatHighlightedParts.js +1 -3
- package/cjs/lib/utils/createConcurrentSafePromise.js +0 -3
- package/cjs/lib/utils/createSendEventForFacet.js +7 -14
- package/cjs/lib/utils/createSendEventForHits.js +9 -33
- package/cjs/lib/utils/debounce.js +0 -3
- package/cjs/lib/utils/defer.js +0 -11
- package/cjs/lib/utils/detect-insights-client.js +0 -2
- package/cjs/lib/utils/documentation.js +2 -5
- package/cjs/lib/utils/escape-highlight.js +5 -22
- package/cjs/lib/utils/escape-html.js +9 -7
- package/cjs/lib/utils/escapeFacetValue.js +1 -5
- package/cjs/lib/utils/find.js +2 -5
- package/cjs/lib/utils/findIndex.js +0 -3
- package/cjs/lib/utils/geo-search.js +14 -34
- package/cjs/lib/utils/getAppIdAndApiKey.js +2 -3
- package/cjs/lib/utils/getContainerNode.js +0 -6
- package/cjs/lib/utils/getHighlightFromSiblings.js +0 -6
- package/cjs/lib/utils/getHighlightedParts.js +1 -4
- package/cjs/lib/utils/getObjectType.js +0 -1
- package/cjs/lib/utils/getPropertyByPath.js +0 -1
- package/cjs/lib/utils/getRefinements.js +13 -26
- package/cjs/lib/utils/getWidgetAttribute.js +0 -6
- package/cjs/lib/utils/hits-absolute-position.js +2 -6
- package/cjs/lib/utils/hits-query-id.js +2 -7
- package/cjs/lib/utils/index.js +0 -92
- package/cjs/lib/utils/isDomElement.js +0 -1
- package/cjs/lib/utils/isEqual.js +0 -8
- package/cjs/lib/utils/isFacetRefined.js +0 -1
- package/cjs/lib/utils/isFiniteNumber.js +0 -1
- package/cjs/lib/utils/isIndexWidget.js +0 -1
- package/cjs/lib/utils/isPlainObject.js +3 -11
- package/cjs/lib/utils/isSpecialClick.js +0 -1
- package/cjs/lib/utils/logger.js +3 -13
- package/cjs/lib/utils/mergeSearchParameters.js +16 -40
- package/cjs/lib/utils/noop.js +0 -1
- package/cjs/lib/utils/range.js +8 -14
- package/cjs/lib/utils/render-args.js +0 -2
- package/cjs/lib/utils/resolveSearchParameters.js +0 -3
- package/cjs/lib/utils/reverseHighlightedParts.js +2 -8
- package/cjs/lib/utils/safelyRunOnBrowser.js +7 -9
- package/cjs/lib/utils/serializer.js +1 -3
- package/cjs/lib/utils/setIndexHelperState.js +0 -5
- package/cjs/lib/utils/toArray.js +0 -1
- package/cjs/lib/utils/typedObject.js +0 -1
- package/cjs/lib/utils/uniq.js +0 -1
- package/cjs/lib/version.js +1 -1
- package/cjs/lib/voiceSearchHelper/index.js +8 -36
- package/cjs/middlewares/createInsightsMiddleware.js +15 -44
- package/cjs/middlewares/createMetadataMiddleware.js +4 -12
- package/cjs/middlewares/createRouterMiddleware.js +8 -19
- package/cjs/middlewares/index.js +0 -6
- package/cjs/types/algoliasearch.js +0 -2
- package/cjs/types/index.js +0 -28
- package/cjs/widgets/analytics/analytics.js +12 -47
- package/cjs/widgets/answers/answers.js +19 -39
- package/cjs/widgets/breadcrumb/breadcrumb.js +18 -38
- package/cjs/widgets/clear-refinements/clear-refinements.js +15 -35
- package/cjs/widgets/configure/configure.js +2 -10
- package/cjs/widgets/configure-related-items/configure-related-items.js +2 -10
- package/cjs/widgets/current-refinements/current-refinements.js +12 -30
- package/cjs/widgets/dynamic-widgets/dynamic-widgets.js +6 -25
- package/cjs/widgets/geo-search/GeoSearchRenderer.js +41 -68
- package/cjs/widgets/geo-search/createHTMLMarker.js +30 -60
- package/cjs/widgets/geo-search/defaultTemplates.js +0 -3
- package/cjs/widgets/geo-search/geo-search.js +27 -59
- package/cjs/widgets/hierarchical-menu/defaultTemplates.js +4 -7
- package/cjs/widgets/hierarchical-menu/hierarchical-menu.js +28 -47
- package/cjs/widgets/hits/hits.js +16 -37
- package/cjs/widgets/hits-per-page/hits-per-page.js +13 -31
- package/cjs/widgets/index/index.js +49 -95
- package/cjs/widgets/index.js +12 -50
- package/cjs/widgets/infinite-hits/infinite-hits.js +23 -44
- package/cjs/widgets/menu/defaultTemplates.js +3 -6
- package/cjs/widgets/menu/menu.js +23 -43
- package/cjs/widgets/menu-select/defaultTemplates.js +1 -3
- package/cjs/widgets/menu-select/menu-select.js +18 -38
- package/cjs/widgets/numeric-menu/defaultTemplates.js +3 -4
- package/cjs/widgets/numeric-menu/numeric-menu.js +17 -37
- package/cjs/widgets/pagination/pagination.js +32 -53
- package/cjs/widgets/panel/panel.js +20 -48
- package/cjs/widgets/places/places.js +16 -33
- package/cjs/widgets/powered-by/powered-by.js +10 -27
- package/cjs/widgets/query-rule-context/query-rule-context.js +2 -13
- package/cjs/widgets/query-rule-custom-data/query-rule-custom-data.js +14 -32
- package/cjs/widgets/range-input/range-input.js +23 -50
- package/cjs/widgets/range-slider/range-slider.js +28 -53
- package/cjs/widgets/rating-menu/defaultTemplates.js +8 -14
- package/cjs/widgets/rating-menu/rating-menu.js +17 -38
- package/cjs/widgets/refinement-list/defaultTemplates.js +5 -8
- package/cjs/widgets/refinement-list/refinement-list.js +39 -60
- package/cjs/widgets/relevant-sort/relevant-sort.js +10 -29
- package/cjs/widgets/search-box/defaultTemplates.js +0 -5
- package/cjs/widgets/search-box/search-box.js +31 -49
- package/cjs/widgets/sort-by/sort-by.js +11 -29
- package/cjs/widgets/stats/defaultTemplates.js +0 -1
- package/cjs/widgets/stats/stats.js +27 -57
- package/cjs/widgets/toggle-refinement/toggle-refinement.js +16 -36
- package/cjs/widgets/voice-search/defaultTemplates.js +4 -14
- package/cjs/widgets/voice-search/voice-search.js +17 -36
- package/dist/instantsearch.development.d.ts +8 -6
- package/dist/instantsearch.development.js +1722 -3088
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +8 -6
- package/dist/instantsearch.production.min.d.ts +8 -6
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/components/Answers/Answers.js +6 -11
- package/es/components/Breadcrumb/Breadcrumb.js +5 -7
- package/es/components/ClearRefinements/ClearRefinements.js +4 -6
- package/es/components/CurrentRefinements/CurrentRefinements.js +7 -10
- package/es/components/GeoSearchControls/GeoSearchButton.js +6 -6
- package/es/components/GeoSearchControls/GeoSearchControls.js +11 -13
- package/es/components/GeoSearchControls/GeoSearchToggle.js +6 -6
- package/es/components/Highlight/Highlight.js +3 -7
- package/es/components/Hits/Hits.js +8 -15
- package/es/components/InfiniteHits/InfiniteHits.js +13 -20
- package/es/components/MenuSelect/MenuSelect.js +9 -13
- package/es/components/Pagination/Pagination.js +12 -15
- package/es/components/Panel/Panel.js +7 -20
- package/es/components/PoweredBy/PoweredBy.js +6 -5
- package/es/components/QueryRuleCustomData/QueryRuleCustomData.js +4 -4
- package/es/components/RangeInput/RangeInput.js +16 -43
- package/es/components/RefinementList/RefinementList.js +19 -64
- package/es/components/RefinementList/RefinementListItem.js +8 -10
- package/es/components/RelevantSort/RelevantSort.js +6 -6
- package/es/components/ReverseHighlight/ReverseHighlight.js +3 -7
- package/es/components/ReverseSnippet/ReverseSnippet.js +3 -7
- package/es/components/SearchBox/SearchBox.js +25 -63
- package/es/components/Selector/Selector.js +5 -5
- package/es/components/Slider/Pit.js +3 -7
- package/es/components/Slider/Rheostat.js +64 -129
- package/es/components/Slider/Slider.js +28 -58
- package/es/components/Snippet/Snippet.js +3 -7
- package/es/components/Stats/Stats.js +7 -15
- package/es/components/Template/Template.js +8 -32
- package/es/components/ToggleRefinement/ToggleRefinement.js +4 -6
- package/es/components/VoiceSearch/VoiceSearch.js +10 -13
- package/es/connectors/answers/connectAnswers.js +21 -35
- package/es/connectors/autocomplete/connectAutocomplete.js +8 -23
- package/es/connectors/breadcrumb/connectBreadcrumb.js +17 -46
- package/es/connectors/clear-refinements/connectClearRefinements.js +27 -43
- package/es/connectors/configure/connectConfigure.js +7 -16
- package/es/connectors/configure-related-items/connectConfigureRelatedItems.js +11 -31
- package/es/connectors/current-refinements/connectCurrentRefinements.js +18 -55
- package/es/connectors/dynamic-widgets/connectDynamicWidgets.js +17 -35
- package/es/connectors/geo-search/connectGeoSearch.js +17 -45
- package/es/connectors/hierarchical-menu/connectHierarchicalMenu.js +38 -72
- package/es/connectors/hits/connectHits.js +10 -24
- package/es/connectors/hits-per-page/connectHitsPerPage.js +15 -36
- package/es/connectors/index.d.ts +2 -1
- package/es/connectors/index.js +6 -3
- package/es/connectors/infinite-hits/connectInfiniteHits.js +26 -60
- package/es/connectors/menu/connectMenu.js +28 -64
- package/es/connectors/numeric-menu/connectNumericMenu.js +24 -76
- package/es/connectors/pagination/Paginator.js +3 -19
- package/es/connectors/pagination/connectPagination.js +8 -21
- package/es/connectors/powered-by/connectPoweredBy.js +4 -11
- package/es/connectors/query-rules/connectQueryRules.js +32 -54
- package/es/connectors/range/connectRange.js +41 -99
- package/es/connectors/rating-menu/connectRatingMenu.js +23 -77
- package/es/connectors/refinement-list/connectRefinementList.js +37 -68
- package/es/connectors/relevant-sort/connectRelevantSort.js +4 -13
- package/es/connectors/search-box/connectSearchBox.js +7 -21
- package/es/connectors/sort-by/connectSortBy.js +11 -19
- package/es/connectors/stats/connectStats.js +4 -9
- package/es/connectors/toggle-refinement/connectToggleRefinement.js +29 -61
- package/es/connectors/voice-search/connectVoiceSearch.js +13 -31
- package/es/helpers/components/Highlight.js +4 -8
- package/es/helpers/components/ReverseHighlight.js +7 -15
- package/es/helpers/components/ReverseSnippet.js +7 -15
- package/es/helpers/components/Snippet.js +4 -8
- package/es/helpers/get-insights-anonymous-user-token.js +2 -10
- package/es/helpers/highlight.js +9 -11
- package/es/helpers/insights.js +3 -10
- package/es/helpers/reverseHighlight.js +9 -11
- package/es/helpers/reverseSnippet.js +9 -11
- package/es/helpers/snippet.js +9 -11
- package/es/index.js +0 -2
- package/es/lib/InstantSearch.js +79 -170
- package/es/lib/createHelpers.js +4 -8
- package/es/lib/infiniteHitsCache/sessionStorage.js +9 -16
- package/es/lib/insights/client.js +8 -32
- package/es/lib/insights/listener.js +6 -18
- package/es/lib/routers/history.js +63 -99
- package/es/lib/stateMappings/simple.js +6 -12
- package/es/lib/stateMappings/singleIndex.js +1 -6
- package/es/lib/suit.js +2 -3
- package/es/lib/templating/prepareTemplateProps.js +8 -18
- package/es/lib/templating/renderTemplate.js +9 -20
- package/es/lib/utils/checkIndexUiState.js +18 -40
- package/es/lib/utils/clearRefinements.js +2 -8
- package/es/lib/utils/concatHighlightedParts.js +1 -1
- package/es/lib/utils/createConcurrentSafePromise.js +0 -2
- package/es/lib/utils/createSendEventForFacet.js +7 -12
- package/es/lib/utils/createSendEventForHits.js +8 -30
- package/es/lib/utils/debounce.js +0 -2
- package/es/lib/utils/defer.js +0 -10
- package/es/lib/utils/documentation.js +2 -3
- package/es/lib/utils/escape-highlight.js +3 -16
- package/es/lib/utils/escape-html.js +9 -5
- package/es/lib/utils/escapeFacetValue.js +0 -2
- package/es/lib/utils/find.js +2 -4
- package/es/lib/utils/findIndex.js +0 -2
- package/es/lib/utils/geo-search.js +14 -32
- package/es/lib/utils/getAppIdAndApiKey.js +2 -2
- package/es/lib/utils/getContainerNode.js +1 -5
- package/es/lib/utils/getHighlightFromSiblings.js +0 -3
- package/es/lib/utils/getHighlightedParts.js +1 -2
- package/es/lib/utils/getRefinements.js +13 -24
- package/es/lib/utils/getWidgetAttribute.js +0 -5
- package/es/lib/utils/hits-absolute-position.js +2 -5
- package/es/lib/utils/hits-query-id.js +2 -6
- package/es/lib/utils/isEqual.js +0 -7
- package/es/lib/utils/isPlainObject.js +3 -10
- package/es/lib/utils/logger.js +2 -12
- package/es/lib/utils/mergeSearchParameters.js +16 -37
- package/es/lib/utils/range.js +8 -13
- package/es/lib/utils/resolveSearchParameters.js +0 -2
- package/es/lib/utils/reverseHighlightedParts.js +2 -6
- package/es/lib/utils/safelyRunOnBrowser.js +7 -8
- package/es/lib/utils/setIndexHelperState.js +0 -2
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/lib/voiceSearchHelper/index.js +8 -35
- package/es/middlewares/createInsightsMiddleware.js +15 -41
- package/es/middlewares/createMetadataMiddleware.js +3 -9
- package/es/middlewares/createRouterMiddleware.js +8 -13
- package/es/types/index.js +9 -5
- package/es/widgets/analytics/analytics.js +12 -45
- package/es/widgets/answers/answers.js +19 -28
- package/es/widgets/breadcrumb/breadcrumb.js +18 -27
- package/es/widgets/clear-refinements/clear-refinements.js +15 -24
- package/es/widgets/configure/configure.js +3 -6
- package/es/widgets/configure-related-items/configure-related-items.js +2 -7
- package/es/widgets/current-refinements/current-refinements.js +12 -21
- package/es/widgets/dynamic-widgets/dynamic-widgets.js +6 -20
- package/es/widgets/geo-search/GeoSearchRenderer.js +41 -63
- package/es/widgets/geo-search/createHTMLMarker.js +30 -59
- package/es/widgets/geo-search/defaultTemplates.js +2 -2
- package/es/widgets/geo-search/geo-search.js +27 -49
- package/es/widgets/hierarchical-menu/defaultTemplates.js +5 -4
- package/es/widgets/hierarchical-menu/hierarchical-menu.js +28 -36
- package/es/widgets/hits/hits.js +16 -25
- package/es/widgets/hits-per-page/hits-per-page.js +13 -22
- package/es/widgets/index/index.js +49 -91
- package/es/widgets/index.d.ts +2 -1
- package/es/widgets/index.js +4 -3
- package/es/widgets/infinite-hits/infinite-hits.js +23 -32
- package/es/widgets/menu/defaultTemplates.js +4 -3
- package/es/widgets/menu/menu.js +23 -32
- package/es/widgets/menu-select/defaultTemplates.js +1 -1
- package/es/widgets/menu-select/menu-select.js +18 -27
- package/es/widgets/numeric-menu/defaultTemplates.js +4 -3
- package/es/widgets/numeric-menu/numeric-menu.js +17 -26
- package/es/widgets/pagination/pagination.js +32 -44
- package/es/widgets/panel/panel.js +20 -40
- package/es/widgets/places/places.js +16 -32
- package/es/widgets/powered-by/powered-by.js +10 -18
- package/es/widgets/query-rule-context/query-rule-context.js +2 -9
- package/es/widgets/query-rule-custom-data/query-rule-custom-data.js +13 -22
- package/es/widgets/range-input/range-input.js +23 -40
- package/es/widgets/range-slider/range-slider.js +28 -44
- package/es/widgets/rating-menu/defaultTemplates.js +9 -12
- package/es/widgets/rating-menu/rating-menu.js +17 -27
- package/es/widgets/refinement-list/defaultTemplates.js +6 -5
- package/es/widgets/refinement-list/refinement-list.js +39 -48
- package/es/widgets/relevant-sort/relevant-sort.js +10 -19
- package/es/widgets/search-box/defaultTemplates.js +1 -4
- package/es/widgets/search-box/search-box.js +31 -39
- package/es/widgets/sort-by/sort-by.js +11 -20
- package/es/widgets/stats/stats.js +26 -45
- package/es/widgets/toggle-refinement/toggle-refinement.js +16 -25
- package/es/widgets/voice-search/defaultTemplates.js +5 -13
- package/es/widgets/voice-search/voice-search.js +17 -26
- package/package.json +20 -119
- package/scripts/transforms/__testfixtures__/addWidget-to-addWidgets/imported.input.js +0 -1
- package/scripts/transforms/__testfixtures__/addWidget-to-addWidgets/imported.output.js +0 -1
- package/CHANGELOG.md +0 -3693
|
@@ -1,72 +1,47 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
2
|
-
|
|
3
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
|
|
1
|
+
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); }
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
5
3
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
|
-
|
|
7
4
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
12
|
-
|
|
13
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
14
|
-
|
|
5
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
6
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
7
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
15
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
16
|
-
|
|
17
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
18
|
-
|
|
9
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
19
10
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
20
|
-
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
24
|
-
|
|
11
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
25
13
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
26
14
|
|
|
27
15
|
import { h, Component } from 'preact';
|
|
28
16
|
import { cx } from '@algolia/ui-components-shared';
|
|
29
17
|
import Template from "../Template/Template.js";
|
|
30
|
-
|
|
31
18
|
var RangeInput = /*#__PURE__*/function (_Component) {
|
|
32
19
|
_inherits(RangeInput, _Component);
|
|
33
|
-
|
|
34
20
|
var _super = _createSuper(RangeInput);
|
|
35
|
-
|
|
36
21
|
function RangeInput() {
|
|
37
22
|
var _this;
|
|
38
|
-
|
|
39
23
|
_classCallCheck(this, RangeInput);
|
|
40
|
-
|
|
41
24
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
42
25
|
args[_key] = arguments[_key];
|
|
43
26
|
}
|
|
44
|
-
|
|
45
27
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
46
|
-
|
|
47
28
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
48
29
|
min: _this.props.values.min,
|
|
49
30
|
max: _this.props.values.max
|
|
50
31
|
});
|
|
51
|
-
|
|
52
32
|
_defineProperty(_assertThisInitialized(_this), "onInput", function (key) {
|
|
53
33
|
return function (event) {
|
|
54
34
|
var _ref = event.currentTarget,
|
|
55
|
-
|
|
56
|
-
|
|
35
|
+
value = _ref.value;
|
|
57
36
|
_this.setState(_defineProperty({}, key, Number(value)));
|
|
58
37
|
};
|
|
59
38
|
});
|
|
60
|
-
|
|
61
39
|
_defineProperty(_assertThisInitialized(_this), "onSubmit", function (event) {
|
|
62
40
|
event.preventDefault();
|
|
63
|
-
|
|
64
41
|
_this.props.refine([_this.state.min, _this.state.max]);
|
|
65
42
|
});
|
|
66
|
-
|
|
67
43
|
return _this;
|
|
68
44
|
}
|
|
69
|
-
|
|
70
45
|
_createClass(RangeInput, [{
|
|
71
46
|
key: "componentWillReceiveProps",
|
|
72
47
|
value: function componentWillReceiveProps(nextProps) {
|
|
@@ -79,14 +54,14 @@ var RangeInput = /*#__PURE__*/function (_Component) {
|
|
|
79
54
|
key: "render",
|
|
80
55
|
value: function render() {
|
|
81
56
|
var _this$state = this.state,
|
|
82
|
-
|
|
83
|
-
|
|
57
|
+
minValue = _this$state.min,
|
|
58
|
+
maxValue = _this$state.max;
|
|
84
59
|
var _this$props = this.props,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
60
|
+
min = _this$props.min,
|
|
61
|
+
max = _this$props.max,
|
|
62
|
+
step = _this$props.step,
|
|
63
|
+
cssClasses = _this$props.cssClasses,
|
|
64
|
+
templateProps = _this$props.templateProps;
|
|
90
65
|
var isDisabled = min && max ? min >= max : false;
|
|
91
66
|
var hasRefinements = Boolean(minValue || maxValue);
|
|
92
67
|
var rootClassNames = cx(cssClasses.root, !hasRefinements && cssClasses.noRefinement);
|
|
@@ -136,8 +111,6 @@ var RangeInput = /*#__PURE__*/function (_Component) {
|
|
|
136
111
|
}))));
|
|
137
112
|
}
|
|
138
113
|
}]);
|
|
139
|
-
|
|
140
114
|
return RangeInput;
|
|
141
115
|
}(Component);
|
|
142
|
-
|
|
143
116
|
export default RangeInput;
|
|
@@ -1,35 +1,19 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
2
|
-
|
|
3
|
-
function
|
|
4
|
-
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6
|
-
|
|
7
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
8
|
-
|
|
1
|
+
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); }
|
|
2
|
+
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; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).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; }
|
|
4
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
9
5
|
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; }
|
|
10
|
-
|
|
11
6
|
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; }
|
|
12
|
-
|
|
13
7
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
14
|
-
|
|
15
8
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
16
|
-
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
20
|
-
|
|
21
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
22
|
-
|
|
9
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
10
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
23
12
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
24
|
-
|
|
25
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
26
|
-
|
|
13
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
27
14
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
28
|
-
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
32
|
-
|
|
15
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
16
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
33
17
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
34
18
|
|
|
35
19
|
import { h, createRef, Component } from 'preact';
|
|
@@ -42,29 +26,20 @@ var defaultProps = {
|
|
|
42
26
|
cssClasses: {},
|
|
43
27
|
depth: 0
|
|
44
28
|
};
|
|
45
|
-
|
|
46
29
|
function isHierarchicalMenuItem(facetValue) {
|
|
47
30
|
return facetValue.data !== undefined;
|
|
48
31
|
}
|
|
49
|
-
|
|
50
32
|
var RefinementList = /*#__PURE__*/function (_Component) {
|
|
51
33
|
_inherits(RefinementList, _Component);
|
|
52
|
-
|
|
53
34
|
var _super = _createSuper(RefinementList);
|
|
54
|
-
|
|
55
35
|
function RefinementList(props) {
|
|
56
36
|
var _this;
|
|
57
|
-
|
|
58
37
|
_classCallCheck(this, RefinementList);
|
|
59
|
-
|
|
60
38
|
_this = _super.call(this, props);
|
|
61
|
-
|
|
62
39
|
_defineProperty(_assertThisInitialized(_this), "searchBox", createRef());
|
|
63
|
-
|
|
64
40
|
_this.handleItemClick = _this.handleItemClick.bind(_assertThisInitialized(_this));
|
|
65
41
|
return _this;
|
|
66
42
|
}
|
|
67
|
-
|
|
68
43
|
_createClass(RefinementList, [{
|
|
69
44
|
key: "shouldComponentUpdate",
|
|
70
45
|
value: function shouldComponentUpdate(nextProps) {
|
|
@@ -80,12 +55,10 @@ var RefinementList = /*#__PURE__*/function (_Component) {
|
|
|
80
55
|
key: "_generateFacetItem",
|
|
81
56
|
value: function _generateFacetItem(facetValue) {
|
|
82
57
|
var subItems;
|
|
83
|
-
|
|
84
58
|
if (isHierarchicalMenuItem(facetValue) && Array.isArray(facetValue.data) && facetValue.data.length > 0) {
|
|
85
59
|
var _this$props$cssClasse = this.props.cssClasses,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
60
|
+
root = _this$props$cssClasse.root,
|
|
61
|
+
cssClasses = _objectWithoutProperties(_this$props$cssClasse, ["root"]);
|
|
89
62
|
subItems = h(RefinementList, _extends({}, this.props, {
|
|
90
63
|
// We want to keep `root` required for external usage but not for the
|
|
91
64
|
// sub items.
|
|
@@ -96,26 +69,20 @@ var RefinementList = /*#__PURE__*/function (_Component) {
|
|
|
96
69
|
className: this.props.cssClasses.childList
|
|
97
70
|
}));
|
|
98
71
|
}
|
|
99
|
-
|
|
100
72
|
var url = this.props.createURL(facetValue.value);
|
|
101
|
-
|
|
102
73
|
var templateData = _objectSpread(_objectSpread({}, facetValue), {}, {
|
|
103
74
|
url: url,
|
|
104
75
|
attribute: this.props.attribute,
|
|
105
76
|
cssClasses: this.props.cssClasses,
|
|
106
77
|
isFromSearch: this.props.isFromSearch
|
|
107
78
|
});
|
|
108
|
-
|
|
109
79
|
var key = facetValue.value;
|
|
110
|
-
|
|
111
80
|
if (facetValue.isRefined !== undefined) {
|
|
112
81
|
key += "/".concat(facetValue.isRefined);
|
|
113
82
|
}
|
|
114
|
-
|
|
115
83
|
if (facetValue.count !== undefined) {
|
|
116
84
|
key += "/".concat(facetValue.count);
|
|
117
85
|
}
|
|
118
|
-
|
|
119
86
|
var refinementListItemClassName = cx(this.props.cssClasses.item, facetValue.isRefined && this.props.cssClasses.selectedItem, !facetValue.count && this.props.cssClasses.disabledItem, Boolean(isHierarchicalMenuItem(facetValue) && Array.isArray(facetValue.data) && facetValue.data.length > 0) && this.props.cssClasses.parentItem);
|
|
120
87
|
return h(RefinementListItem, {
|
|
121
88
|
templateKey: "item",
|
|
@@ -128,7 +95,9 @@ var RefinementList = /*#__PURE__*/function (_Component) {
|
|
|
128
95
|
templateData: templateData,
|
|
129
96
|
templateProps: this.props.templateProps
|
|
130
97
|
});
|
|
131
|
-
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Click events on DOM tree like LABEL > INPUT will result in two click events
|
|
132
101
|
// instead of one.
|
|
133
102
|
// No matter the framework, see https://www.google.com/search?q=click+label+twice
|
|
134
103
|
//
|
|
@@ -143,48 +112,38 @@ var RefinementList = /*#__PURE__*/function (_Component) {
|
|
|
143
112
|
//
|
|
144
113
|
// Finally, we always stop propagation of the event to avoid multiple levels RefinementLists to fail: click
|
|
145
114
|
// on child would click on parent also
|
|
146
|
-
|
|
147
115
|
}, {
|
|
148
116
|
key: "handleItemClick",
|
|
149
117
|
value: function handleItemClick(_ref) {
|
|
150
118
|
var facetValueToRefine = _ref.facetValueToRefine,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
119
|
+
isRefined = _ref.isRefined,
|
|
120
|
+
originalEvent = _ref.originalEvent;
|
|
154
121
|
if (isSpecialClick(originalEvent)) {
|
|
155
122
|
// do not alter the default browser behavior
|
|
156
123
|
// if one special key is down
|
|
157
124
|
return;
|
|
158
125
|
}
|
|
159
|
-
|
|
160
126
|
if (!(originalEvent.target instanceof HTMLElement) || !(originalEvent.target.parentNode instanceof HTMLElement)) {
|
|
161
127
|
return;
|
|
162
128
|
}
|
|
163
|
-
|
|
164
129
|
if (isRefined && originalEvent.target.parentNode.querySelector('input[type="radio"]:checked')) {
|
|
165
130
|
// Prevent refinement for being reset if the user clicks on an already checked radio button
|
|
166
131
|
return;
|
|
167
132
|
}
|
|
168
|
-
|
|
169
133
|
if (originalEvent.target.tagName === 'INPUT') {
|
|
170
134
|
this.refine(facetValueToRefine);
|
|
171
135
|
return;
|
|
172
136
|
}
|
|
173
|
-
|
|
174
137
|
var parent = originalEvent.target;
|
|
175
|
-
|
|
176
138
|
while (parent !== originalEvent.currentTarget) {
|
|
177
139
|
if (parent.tagName === 'LABEL' && (parent.querySelector('input[type="checkbox"]') || parent.querySelector('input[type="radio"]'))) {
|
|
178
140
|
return;
|
|
179
141
|
}
|
|
180
|
-
|
|
181
142
|
if (parent.tagName === 'A' && parent.href) {
|
|
182
143
|
originalEvent.preventDefault();
|
|
183
144
|
}
|
|
184
|
-
|
|
185
145
|
parent = parent.parentNode;
|
|
186
146
|
}
|
|
187
|
-
|
|
188
147
|
originalEvent.stopPropagation();
|
|
189
148
|
this.refine(facetValueToRefine);
|
|
190
149
|
}
|
|
@@ -199,7 +158,6 @@ var RefinementList = /*#__PURE__*/function (_Component) {
|
|
|
199
158
|
key: "refineFirstValue",
|
|
200
159
|
value: function refineFirstValue() {
|
|
201
160
|
var firstValue = this.props.facetValues && this.props.facetValues[0];
|
|
202
|
-
|
|
203
161
|
if (firstValue) {
|
|
204
162
|
var actualValue = firstValue.value;
|
|
205
163
|
this.props.toggleRefinement(actualValue);
|
|
@@ -209,7 +167,6 @@ var RefinementList = /*#__PURE__*/function (_Component) {
|
|
|
209
167
|
key: "render",
|
|
210
168
|
value: function render() {
|
|
211
169
|
var _this2 = this;
|
|
212
|
-
|
|
213
170
|
var showMoreButtonClassName = cx(this.props.cssClasses.showMore, !(this.props.showMore === true && this.props.canToggleShowMore) && this.props.cssClasses.disabledShowMore);
|
|
214
171
|
var showMoreButton = this.props.showMore === true && h(Template, _extends({}, this.props.templateProps, {
|
|
215
172
|
templateKey: "showMoreText",
|
|
@@ -240,7 +197,8 @@ var RefinementList = /*#__PURE__*/function (_Component) {
|
|
|
240
197
|
},
|
|
241
198
|
onSubmit: function onSubmit() {
|
|
242
199
|
return _this2.refineFirstValue();
|
|
243
|
-
}
|
|
200
|
+
}
|
|
201
|
+
// This sets the search box to a controlled state because
|
|
244
202
|
// we don't rely on the `refine` prop but on `onChange`.
|
|
245
203
|
,
|
|
246
204
|
searchAsYouType: false
|
|
@@ -260,10 +218,7 @@ var RefinementList = /*#__PURE__*/function (_Component) {
|
|
|
260
218
|
}, this.props.children, searchBox, facetValues, noResults, showMoreButton);
|
|
261
219
|
}
|
|
262
220
|
}]);
|
|
263
|
-
|
|
264
221
|
return RefinementList;
|
|
265
222
|
}(Component);
|
|
266
|
-
|
|
267
223
|
_defineProperty(RefinementList, "defaultProps", defaultProps);
|
|
268
|
-
|
|
269
224
|
export default RefinementList;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
3
|
import { h } from 'preact';
|
|
4
4
|
import Template from "../Template/Template.js";
|
|
5
|
-
|
|
6
5
|
function RefinementListItem(_ref) {
|
|
7
6
|
var className = _ref.className,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
handleClick = _ref.handleClick,
|
|
8
|
+
facetValueToRefine = _ref.facetValueToRefine,
|
|
9
|
+
isRefined = _ref.isRefined,
|
|
10
|
+
templateProps = _ref.templateProps,
|
|
11
|
+
templateKey = _ref.templateKey,
|
|
12
|
+
templateData = _ref.templateData,
|
|
13
|
+
subItems = _ref.subItems;
|
|
15
14
|
return h("li", {
|
|
16
15
|
className: className,
|
|
17
16
|
onClick: function onClick(originalEvent) {
|
|
@@ -26,5 +25,4 @@ function RefinementListItem(_ref) {
|
|
|
26
25
|
data: templateData
|
|
27
26
|
})), subItems);
|
|
28
27
|
}
|
|
29
|
-
|
|
30
28
|
export default RefinementListItem;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
1
3
|
import { h } from 'preact';
|
|
2
4
|
import Template from "../Template/Template.js";
|
|
3
|
-
|
|
4
5
|
var RelevantSort = function RelevantSort(_ref) {
|
|
5
6
|
var cssClasses = _ref.cssClasses,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
templates = _ref.templates,
|
|
8
|
+
isRelevantSorted = _ref.isRelevantSorted,
|
|
9
|
+
isVirtualReplica = _ref.isVirtualReplica,
|
|
10
|
+
refine = _ref.refine;
|
|
10
11
|
return isVirtualReplica ? h("div", {
|
|
11
12
|
className: cssClasses.root
|
|
12
13
|
}, h(Template, {
|
|
@@ -37,5 +38,4 @@ var RelevantSort = function RelevantSort(_ref) {
|
|
|
37
38
|
}
|
|
38
39
|
}))) : null;
|
|
39
40
|
};
|
|
40
|
-
|
|
41
41
|
export default RelevantSort;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
2
|
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; }
|
|
4
|
-
|
|
5
3
|
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; }
|
|
6
|
-
|
|
7
4
|
import { cx } from '@algolia/ui-components-shared';
|
|
8
5
|
import { h } from 'preact';
|
|
9
6
|
import { InternalHighlight } from "../InternalHighlight/InternalHighlight.js";
|
|
10
7
|
export function ReverseHighlight(_ref) {
|
|
11
8
|
var _ref$classNames = _ref.classNames,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
10
|
+
props = _objectWithoutProperties(_ref, ["classNames"]);
|
|
15
11
|
return h(InternalHighlight, _extends({
|
|
16
12
|
classNames: {
|
|
17
13
|
root: cx('ais-ReverseHighlight', classNames.root),
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
2
|
-
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
2
|
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; }
|
|
4
|
-
|
|
5
3
|
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; }
|
|
6
|
-
|
|
7
4
|
import { cx } from '@algolia/ui-components-shared';
|
|
8
5
|
import { h } from 'preact';
|
|
9
6
|
import { InternalHighlight } from "../InternalHighlight/InternalHighlight.js";
|
|
10
7
|
export function ReverseSnippet(_ref) {
|
|
11
8
|
var _ref$classNames = _ref.classNames,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
10
|
+
props = _objectWithoutProperties(_ref, ["classNames"]);
|
|
15
11
|
return h(InternalHighlight, _extends({
|
|
16
12
|
classNames: {
|
|
17
13
|
root: cx('ais-ReverseSnippet', classNames.root),
|
|
@@ -1,25 +1,14 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
2
|
-
|
|
1
|
+
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); }
|
|
3
2
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
-
|
|
5
3
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
10
|
-
|
|
11
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
-
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
6
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
13
7
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
|
-
|
|
15
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
16
|
-
|
|
8
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
17
9
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
-
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
-
|
|
10
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
11
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
23
12
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
24
13
|
|
|
25
14
|
import { h, createRef, Component } from 'preact';
|
|
@@ -39,102 +28,77 @@ var defaultProps = {
|
|
|
39
28
|
onReset: noop,
|
|
40
29
|
refine: noop
|
|
41
30
|
};
|
|
42
|
-
|
|
43
31
|
var SearchBox = /*#__PURE__*/function (_Component) {
|
|
44
32
|
_inherits(SearchBox, _Component);
|
|
45
|
-
|
|
46
33
|
var _super = _createSuper(SearchBox);
|
|
47
|
-
|
|
48
34
|
function SearchBox() {
|
|
49
35
|
var _this;
|
|
50
|
-
|
|
51
36
|
_classCallCheck(this, SearchBox);
|
|
52
|
-
|
|
53
37
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
54
38
|
args[_key] = arguments[_key];
|
|
55
39
|
}
|
|
56
|
-
|
|
57
40
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
58
|
-
|
|
59
41
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
60
42
|
query: _this.props.query,
|
|
61
43
|
focused: false
|
|
62
44
|
});
|
|
63
|
-
|
|
64
45
|
_defineProperty(_assertThisInitialized(_this), "input", createRef());
|
|
65
|
-
|
|
66
46
|
_defineProperty(_assertThisInitialized(_this), "onInput", function (event) {
|
|
67
47
|
var _this$props = _this.props,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
48
|
+
searchAsYouType = _this$props.searchAsYouType,
|
|
49
|
+
refine = _this$props.refine,
|
|
50
|
+
onChange = _this$props.onChange;
|
|
71
51
|
var query = event.target.value;
|
|
72
|
-
|
|
73
52
|
if (searchAsYouType) {
|
|
74
53
|
refine(query);
|
|
75
54
|
}
|
|
76
|
-
|
|
77
55
|
_this.setState({
|
|
78
56
|
query: query
|
|
79
57
|
});
|
|
80
|
-
|
|
81
58
|
onChange(event);
|
|
82
59
|
});
|
|
83
|
-
|
|
84
60
|
_defineProperty(_assertThisInitialized(_this), "onSubmit", function (event) {
|
|
85
61
|
var _this$props2 = _this.props,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
62
|
+
searchAsYouType = _this$props2.searchAsYouType,
|
|
63
|
+
refine = _this$props2.refine,
|
|
64
|
+
onSubmit = _this$props2.onSubmit;
|
|
89
65
|
event.preventDefault();
|
|
90
66
|
event.stopPropagation();
|
|
91
|
-
|
|
92
67
|
if (_this.input.current) {
|
|
93
68
|
_this.input.current.blur();
|
|
94
69
|
}
|
|
95
|
-
|
|
96
70
|
if (!searchAsYouType) {
|
|
97
71
|
refine(_this.state.query);
|
|
98
72
|
}
|
|
99
|
-
|
|
100
73
|
onSubmit(event);
|
|
101
74
|
return false;
|
|
102
75
|
});
|
|
103
|
-
|
|
104
76
|
_defineProperty(_assertThisInitialized(_this), "onReset", function (event) {
|
|
105
77
|
var _this$props3 = _this.props,
|
|
106
|
-
|
|
107
|
-
|
|
78
|
+
refine = _this$props3.refine,
|
|
79
|
+
onReset = _this$props3.onReset;
|
|
108
80
|
var query = '';
|
|
109
|
-
|
|
110
81
|
if (_this.input.current) {
|
|
111
82
|
_this.input.current.focus();
|
|
112
83
|
}
|
|
113
|
-
|
|
114
84
|
refine(query);
|
|
115
|
-
|
|
116
85
|
_this.setState({
|
|
117
86
|
query: query
|
|
118
87
|
});
|
|
119
|
-
|
|
120
88
|
onReset(event);
|
|
121
89
|
});
|
|
122
|
-
|
|
123
90
|
_defineProperty(_assertThisInitialized(_this), "onBlur", function () {
|
|
124
91
|
_this.setState({
|
|
125
92
|
focused: false
|
|
126
93
|
});
|
|
127
94
|
});
|
|
128
|
-
|
|
129
95
|
_defineProperty(_assertThisInitialized(_this), "onFocus", function () {
|
|
130
96
|
_this.setState({
|
|
131
97
|
focused: true
|
|
132
98
|
});
|
|
133
99
|
});
|
|
134
|
-
|
|
135
100
|
return _this;
|
|
136
101
|
}
|
|
137
|
-
|
|
138
102
|
_createClass(SearchBox, [{
|
|
139
103
|
key: "resetInput",
|
|
140
104
|
value:
|
|
@@ -168,14 +132,14 @@ var SearchBox = /*#__PURE__*/function (_Component) {
|
|
|
168
132
|
key: "render",
|
|
169
133
|
value: function render() {
|
|
170
134
|
var _this$props4 = this.props,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
135
|
+
cssClasses = _this$props4.cssClasses,
|
|
136
|
+
placeholder = _this$props4.placeholder,
|
|
137
|
+
autofocus = _this$props4.autofocus,
|
|
138
|
+
showSubmit = _this$props4.showSubmit,
|
|
139
|
+
showReset = _this$props4.showReset,
|
|
140
|
+
showLoadingIndicator = _this$props4.showLoadingIndicator,
|
|
141
|
+
templates = _this$props4.templates,
|
|
142
|
+
isSearchStalled = _this$props4.isSearchStalled;
|
|
179
143
|
return h("div", {
|
|
180
144
|
className: cssClasses.root
|
|
181
145
|
}, h("form", {
|
|
@@ -195,7 +159,8 @@ var SearchBox = /*#__PURE__*/function (_Component) {
|
|
|
195
159
|
autoFocus: autofocus,
|
|
196
160
|
autoComplete: "off",
|
|
197
161
|
autoCorrect: "off",
|
|
198
|
-
autoCapitalize: "off"
|
|
162
|
+
autoCapitalize: "off"
|
|
163
|
+
// @ts-expect-error `spellCheck` attribute is missing in preact JSX types
|
|
199
164
|
,
|
|
200
165
|
spellCheck: "false",
|
|
201
166
|
maxLength: 512,
|
|
@@ -242,10 +207,7 @@ var SearchBox = /*#__PURE__*/function (_Component) {
|
|
|
242
207
|
})));
|
|
243
208
|
}
|
|
244
209
|
}]);
|
|
245
|
-
|
|
246
210
|
return SearchBox;
|
|
247
211
|
}(Component);
|
|
248
|
-
|
|
249
212
|
_defineProperty(SearchBox, "defaultProps", defaultProps);
|
|
250
|
-
|
|
251
213
|
export default SearchBox;
|