@coveo/atomic 3.33.8-pre.a63ab7ef87 → 3.33.8-pre.a6ca64b34f
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/atomic/_atomic.esm.js +1 -1
- package/dist/atomic/atomic.esm.js.map +1 -1
- package/dist/atomic/components/_index.d.ts +0 -2
- package/dist/atomic/components/_index.js +2 -2
- package/dist/atomic/components/analytics-config.js +1 -1
- package/dist/atomic/components/atomic-insight-history-toggle.js +2 -2
- package/dist/atomic/components/atomic-insight-history-toggle.js.map +1 -1
- package/dist/atomic/components/atomic-insight-search-box.js +3 -4
- package/dist/atomic/components/atomic-insight-search-box.js.map +1 -1
- package/dist/atomic/components/atomic-insight-user-actions-toggle.js +2 -2
- package/dist/atomic/components/atomic-insight-user-actions-toggle.js.map +1 -1
- package/dist/atomic/components/atomic-search-box-instant-results.js +2 -2
- package/dist/atomic/components/atomic-search-box-instant-results.js.map +1 -1
- package/dist/atomic/components/atomic-search-box-query-suggestions2.js +2 -2
- package/dist/atomic/components/atomic-search-box-query-suggestions2.js.map +1 -1
- package/dist/atomic/components/atomic-search-box.js +7 -14
- package/dist/atomic/components/atomic-search-box.js.map +1 -1
- package/dist/atomic/components/atomic-smart-snippet-feedback-modal2.js +2 -2
- package/dist/atomic/components/atomic-suggestion-renderer2.js +1 -1
- package/dist/atomic/components/atomic-suggestion-renderer2.js.map +1 -1
- package/dist/atomic/components/atomic-tab-manager.js +1 -1
- package/dist/atomic/components/clock.js +2 -2
- package/dist/atomic/components/components/commerce/atomic-commerce-search-box/atomic-commerce-search-box.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-commerce-search-box-instant-products/atomic-commerce-search-box-instant-products.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-commerce-search-box-query-suggestions/atomic-commerce-search-box-query-suggestions.js +1 -1
- package/dist/atomic/components/components/commerce/atomic-commerce-search-box-recent-queries/atomic-commerce-search-box-recent-queries.js +1 -1
- package/dist/atomic/components/components/common/atomic-modal/atomic-modal.js +0 -2
- package/dist/atomic/components/components/common/suggestions/suggestion-manager.js +1 -1
- package/dist/atomic/components/components/common/suggestions/{suggestions-common.js → suggestions-events.js} +16 -18
- package/dist/atomic/components/components/common/suggestions/suggestions-types.js +1 -0
- package/dist/atomic/components/components/common/suggestions/suggestions-utils.js +18 -0
- package/dist/atomic/components/components/search/atomic-search-box-recent-queries/atomic-search-box-recent-queries.js +144 -0
- package/dist/atomic/components/components/search/index.js +1 -0
- package/dist/atomic/components/components/search/lazy-index.js +1 -0
- package/dist/atomic/components/global/environment.js +1 -1
- package/dist/atomic/components/stencil-query-suggestions.js.map +1 -1
- package/dist/atomic/components/stencil-suggestion-manager.js +20 -2
- package/dist/atomic/components/stencil-suggestion-manager.js.map +1 -1
- package/dist/atomic/components/{suggestions-common.js → suggestions-events.js} +18 -20
- package/dist/atomic/components/suggestions-events.js.map +1 -0
- package/dist/atomic/index.esm.js +1 -1
- package/dist/atomic/index.esm.js.map +1 -1
- package/dist/atomic/p-0a051b8d.js +2 -0
- package/dist/atomic/p-0a051b8d.js.map +1 -0
- package/dist/atomic/p-16f4ce98.js +2 -0
- package/dist/atomic/p-16f4ce98.js.map +1 -0
- package/dist/atomic/{p-8867af82.entry.js → p-26a51a77.entry.js} +2 -2
- package/dist/atomic/p-26a51a77.entry.js.map +1 -0
- package/dist/atomic/p-2e9db4ca.entry.js +2 -0
- package/dist/atomic/p-2e9db4ca.entry.js.map +1 -0
- package/dist/atomic/{p-aa2a81fd.entry.js → p-39e63678.entry.js} +2 -2
- package/dist/atomic/{p-bf41fa4b.entry.js → p-3a5257b5.entry.js} +2 -2
- package/dist/atomic/p-4b7a19db.js +2 -0
- package/dist/atomic/p-4b7a19db.js.map +1 -0
- package/dist/atomic/{p-6e6d686e.entry.js → p-7383fd32.entry.js} +2 -2
- package/dist/atomic/{p-ac6028fa.js → p-82cda72d.js} +2 -2
- package/dist/atomic/{p-187c3a74.entry.js → p-9187a339.entry.js} +2 -2
- package/dist/atomic/{p-b7cfb454.entry.js → p-ad0f197a.entry.js} +2 -2
- package/dist/atomic/{p-7a625c7e.entry.js → p-ae98c582.entry.js} +2 -2
- package/dist/atomic/p-af93b44c.js.map +1 -1
- package/dist/atomic/{p-6329ff94.entry.js → p-ba4bf29f.entry.js} +2 -2
- package/dist/atomic/{p-3d847e45.entry.js → p-c88a3d2d.entry.js} +2 -2
- package/dist/atomic/p-c88a3d2d.entry.js.map +1 -0
- package/dist/atomic/{p-36e71b99.entry.js → p-d0f47b33.entry.js} +2 -2
- package/dist/atomic/p-d0f47b33.entry.js.map +1 -0
- package/dist/atomic/{p-c280cd05.js → p-e1cc5150.js} +1 -1
- package/dist/atomic/{p-aa4224ea.entry.js → p-fbfe913d.entry.js} +2 -2
- package/dist/atomic/p-fbfe913d.entry.js.map +1 -0
- package/dist/cjs/_index.cjs.js +5 -2
- package/dist/cjs/_loader.cjs.js +1 -1
- package/dist/cjs/{analytics-config-1d91a49a.js → analytics-config-4c6d87cf.js} +2 -2
- package/dist/cjs/{analytics-config-1d91a49a.js.map → analytics-config-4c6d87cf.js.map} +1 -1
- package/dist/cjs/atomic-insight-history-toggle.cjs.entry.js +2 -2
- package/dist/cjs/atomic-insight-history-toggle.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-insight-interface.cjs.entry.js +1 -1
- package/dist/cjs/atomic-insight-search-box.cjs.entry.js +5 -5
- package/dist/cjs/atomic-insight-search-box.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-insight-user-actions-toggle.cjs.entry.js +2 -2
- package/dist/cjs/atomic-insight-user-actions-toggle.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-recs-interface.cjs.entry.js +1 -1
- package/dist/cjs/atomic-search-box-instant-results.cjs.entry.js +3 -3
- package/dist/cjs/atomic-search-box-instant-results.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-search-box-query-suggestions.cjs.entry.js +76 -0
- package/dist/cjs/atomic-search-box-query-suggestions.cjs.entry.js.map +1 -0
- package/dist/cjs/atomic-search-box.cjs.entry.js +7 -7
- package/dist/cjs/atomic-search-box.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-search-interface.cjs.entry.js +1 -1
- package/dist/cjs/atomic-smart-snippet-feedback-modal.cjs.entry.js +2 -2
- package/dist/cjs/atomic-suggestion-renderer.cjs.entry.js +1 -1
- package/dist/cjs/atomic-suggestion-renderer.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-tab-manager.cjs.entry.js +1 -1
- package/dist/cjs/atomic.cjs.js +1 -1
- package/dist/cjs/clock-7aeb19d0.js +7 -0
- package/dist/cjs/clock-7aeb19d0.js.map +1 -0
- package/dist/cjs/index-757bc886.js +2 -2
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/stencil-query-suggestions-03268ecc.js.map +1 -1
- package/dist/cjs/{stencil-suggestion-manager-c0878ef2.js → stencil-suggestion-manager-2cba6d69.js} +4 -4
- package/dist/cjs/{stencil-suggestion-manager-c0878ef2.js.map → stencil-suggestion-manager-2cba6d69.js.map} +1 -1
- package/dist/cjs/{suggestions-common-5097a362.js → suggestions-events-63dd0640.js} +17 -21
- package/dist/cjs/suggestions-events-63dd0640.js.map +1 -0
- package/dist/cjs/suggestions-utils-61000808.js +25 -0
- package/dist/cjs/suggestions-utils-61000808.js.map +1 -0
- package/dist/cjs/version.cjs.js +2 -2
- package/dist/esm/_index.js +2 -1
- package/dist/esm/_loader.js +1 -1
- package/dist/esm/{analytics-config-4fd089ca.js → analytics-config-46d030a5.js} +2 -2
- package/dist/esm/{analytics-config-4fd089ca.js.map → analytics-config-46d030a5.js.map} +1 -1
- package/dist/esm/atomic-insight-history-toggle.entry.js +2 -2
- package/dist/esm/atomic-insight-history-toggle.entry.js.map +1 -1
- package/dist/esm/atomic-insight-interface.entry.js +1 -1
- package/dist/esm/atomic-insight-search-box.entry.js +4 -4
- package/dist/esm/atomic-insight-search-box.entry.js.map +1 -1
- package/dist/esm/atomic-insight-user-actions-toggle.entry.js +2 -2
- package/dist/esm/atomic-insight-user-actions-toggle.entry.js.map +1 -1
- package/dist/esm/atomic-recs-interface.entry.js +1 -1
- package/dist/esm/atomic-search-box-instant-results.entry.js +2 -2
- package/dist/esm/atomic-search-box-instant-results.entry.js.map +1 -1
- package/dist/esm/atomic-search-box-query-suggestions.entry.js +72 -0
- package/dist/esm/atomic-search-box-query-suggestions.entry.js.map +1 -0
- package/dist/esm/atomic-search-box.entry.js +6 -6
- package/dist/esm/atomic-search-box.entry.js.map +1 -1
- package/dist/esm/atomic-search-interface.entry.js +1 -1
- package/dist/esm/atomic-smart-snippet-feedback-modal.entry.js +2 -2
- package/dist/esm/atomic-suggestion-renderer.entry.js +1 -1
- package/dist/esm/atomic-suggestion-renderer.entry.js.map +1 -1
- package/dist/esm/atomic-tab-manager.entry.js +1 -1
- package/dist/esm/atomic.js +1 -1
- package/dist/esm/clock-b1f5d7f7.js +5 -0
- package/dist/esm/clock-b1f5d7f7.js.map +1 -0
- package/dist/esm/index-3f35faca.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/stencil-query-suggestions-5d6a46d7.js.map +1 -1
- package/dist/esm/{stencil-suggestion-manager-486094dd.js → stencil-suggestion-manager-376f83e8.js} +2 -2
- package/dist/esm/{stencil-suggestion-manager-486094dd.js.map → stencil-suggestion-manager-376f83e8.js.map} +1 -1
- package/dist/esm/{suggestions-common-2b20db26.js → suggestions-events-b7a6f007.js} +18 -20
- package/dist/esm/suggestions-events-b7a6f007.js.map +1 -0
- package/dist/esm/suggestions-utils-591559a0.js +22 -0
- package/dist/esm/suggestions-utils-591559a0.js.map +1 -0
- package/dist/esm/version.js +2 -2
- package/dist/types/components/commerce/atomic-commerce-search-box-instant-products/atomic-commerce-search-box-instant-products.d.ts +1 -1
- package/dist/types/components/commerce/atomic-commerce-search-box-query-suggestions/atomic-commerce-search-box-query-suggestions.d.ts +1 -1
- package/dist/types/components/commerce/atomic-commerce-search-box-recent-queries/atomic-commerce-search-box-recent-queries.d.ts +1 -1
- package/dist/types/components/common/atomic-suggestion-renderer/atomic-suggestion-renderer.d.ts +1 -1
- package/dist/types/components/common/suggestions/instant-item.d.ts +1 -1
- package/dist/types/components/common/suggestions/query-suggestions.d.ts +1 -1
- package/dist/types/components/common/suggestions/recent-queries.d.ts +1 -1
- package/dist/types/components/common/suggestions/stencil-instant-item.d.ts +1 -1
- package/dist/types/components/common/suggestions/stencil-query-suggestions.d.ts +1 -1
- package/dist/types/components/common/suggestions/stencil-recent-queries.d.ts +1 -1
- package/dist/types/components/common/suggestions/stencil-suggestion-manager.d.ts +1 -1
- package/dist/types/components/common/suggestions/suggestion-manager.d.ts +1 -1
- package/dist/types/components/common/suggestions/suggestions-events.d.ts +14 -0
- package/dist/types/components/common/suggestions/{suggestions-common.d.ts → suggestions-types.d.ts} +6 -16
- package/dist/types/components/common/suggestions/suggestions-utils.d.ts +15 -0
- package/dist/types/components/search/atomic-search-box/atomic-search-box.d.ts +1 -1
- package/dist/types/components/search/{search-box-suggestions/atomic-search-box-recent-queries → atomic-search-box-recent-queries}/atomic-search-box-recent-queries.d.ts +10 -6
- package/dist/types/components/search/index.d.ts +1 -0
- package/dist/types/components/search/search-box-suggestions/atomic-search-box-instant-results/atomic-search-box-instant-results.d.ts +1 -1
- package/dist/types/components.d.ts +2 -51
- package/dist/types/decorators/types.d.ts +1 -1
- package/dist/types/index.d.ts +3 -1
- package/docs/atomic-docs.json +3 -100
- package/package.json +3 -3
- package/dist/atomic/components/atomic-search-box-recent-queries.d.ts +0 -11
- package/dist/atomic/components/atomic-search-box-recent-queries.js +0 -8
- package/dist/atomic/components/atomic-search-box-recent-queries.js.map +0 -1
- package/dist/atomic/components/atomic-search-box-recent-queries2.js +0 -183
- package/dist/atomic/components/atomic-search-box-recent-queries2.js.map +0 -1
- package/dist/atomic/components/suggestions-common.js.map +0 -1
- package/dist/atomic/p-29fd6768.js +0 -2
- package/dist/atomic/p-29fd6768.js.map +0 -1
- package/dist/atomic/p-36e71b99.entry.js.map +0 -1
- package/dist/atomic/p-3d847e45.entry.js.map +0 -1
- package/dist/atomic/p-7601c3de.js +0 -2
- package/dist/atomic/p-7601c3de.js.map +0 -1
- package/dist/atomic/p-8867af82.entry.js.map +0 -1
- package/dist/atomic/p-aa4224ea.entry.js.map +0 -1
- package/dist/atomic/p-c1bf43cf.entry.js +0 -2
- package/dist/atomic/p-c1bf43cf.entry.js.map +0 -1
- package/dist/cjs/atomic-search-box-query-suggestions_2.cjs.entry.js +0 -234
- package/dist/cjs/atomic-search-box-query-suggestions_2.cjs.entry.js.map +0 -1
- package/dist/cjs/clock-f03ff827.js +0 -7
- package/dist/cjs/clock-f03ff827.js.map +0 -1
- package/dist/cjs/suggestions-common-5097a362.js.map +0 -1
- package/dist/esm/atomic-search-box-query-suggestions_2.entry.js +0 -229
- package/dist/esm/atomic-search-box-query-suggestions_2.entry.js.map +0 -1
- package/dist/esm/clock-add3e9a5.js +0 -5
- package/dist/esm/clock-add3e9a5.js.map +0 -1
- package/dist/esm/suggestions-common-2b20db26.js.map +0 -1
- /package/dist/atomic/{p-aa2a81fd.entry.js.map → p-39e63678.entry.js.map} +0 -0
- /package/dist/atomic/{p-bf41fa4b.entry.js.map → p-3a5257b5.entry.js.map} +0 -0
- /package/dist/atomic/{p-6e6d686e.entry.js.map → p-7383fd32.entry.js.map} +0 -0
- /package/dist/atomic/{p-ac6028fa.js.map → p-82cda72d.js.map} +0 -0
- /package/dist/atomic/{p-187c3a74.entry.js.map → p-9187a339.entry.js.map} +0 -0
- /package/dist/atomic/{p-b7cfb454.entry.js.map → p-ad0f197a.entry.js.map} +0 -0
- /package/dist/atomic/{p-7a625c7e.entry.js.map → p-ae98c582.entry.js.map} +0 -0
- /package/dist/atomic/{p-6329ff94.entry.js.map → p-ba4bf29f.entry.js.map} +0 -0
- /package/dist/atomic/{p-c280cd05.js.map → p-e1cc5150.js.map} +0 -0
@@ -26,7 +26,7 @@ import { RedirectionPayload } from "./components/common/search-box/redirection-p
|
|
26
26
|
import { AriaLabelGenerator } from "./components/search/search-box-suggestions/atomic-search-box-instant-results/atomic-search-box-instant-results";
|
27
27
|
import { InitializationOptions } from "./components/search/atomic-search-interface/atomic-search-interface";
|
28
28
|
import { StandaloneSearchBoxData } from "./utils/local-storage-utils";
|
29
|
-
import { SearchBoxSuggestionElement } from "./components/common/suggestions/suggestions-
|
29
|
+
import { SearchBoxSuggestionElement } from "./components/common/suggestions/suggestions-types";
|
30
30
|
export { AutomaticFacet, CategoryFacetSortCriterion, DateFilterRange, DateRangeRequest, FacetResultsMustMatch, FacetSortCriterion, FoldedResult, GeneratedAnswer, GeneratedAnswerCitation, InlineLink, InteractiveCitation, InteractiveResult, LogLevel, NumericFilter, NumericFilterState, RangeFacetRangeAlgorithm, RangeFacetSortCriterion, RelativeDateUnit, Result, ResultTemplate, ResultTemplateCondition, SearchEngine, SearchStatus } from "@coveo/headless";
|
31
31
|
export { AtomicInterface } from "./utils/initialization-utils";
|
32
32
|
export { AnyBindings } from "./components/common/interface/bindings";
|
@@ -48,7 +48,7 @@ export { RedirectionPayload } from "./components/common/search-box/redirection-p
|
|
48
48
|
export { AriaLabelGenerator } from "./components/search/search-box-suggestions/atomic-search-box-instant-results/atomic-search-box-instant-results";
|
49
49
|
export { InitializationOptions } from "./components/search/atomic-search-interface/atomic-search-interface";
|
50
50
|
export { StandaloneSearchBoxData } from "./utils/local-storage-utils";
|
51
|
-
export { SearchBoxSuggestionElement } from "./components/common/suggestions/suggestions-
|
51
|
+
export { SearchBoxSuggestionElement } from "./components/common/suggestions/suggestions-types";
|
52
52
|
export namespace Components {
|
53
53
|
/**
|
54
54
|
* An automatic facet is a special type of facet generated by the automatic facets feature.
|
@@ -2432,23 +2432,6 @@ export namespace Components {
|
|
2432
2432
|
*/
|
2433
2433
|
"maxWithoutQuery"?: number;
|
2434
2434
|
}
|
2435
|
-
/**
|
2436
|
-
* The `atomic-search-box-recent-queries` component can be added as a child of an `atomic-search-box` component, allowing for the configuration of recent query suggestions.
|
2437
|
-
*/
|
2438
|
-
interface AtomicSearchBoxRecentQueries {
|
2439
|
-
/**
|
2440
|
-
* The SVG icon to display. - Use a value that starts with `http://`, `https://`, `./`, or `../`, to fetch and display an icon from a given location. - Use a value that starts with `assets://`, to display an icon from the Atomic package. - Use a stringified SVG to display it directly.
|
2441
|
-
*/
|
2442
|
-
"icon"?: string;
|
2443
|
-
/**
|
2444
|
-
* The maximum number of suggestions that will be displayed if the user has typed something into the input field.
|
2445
|
-
*/
|
2446
|
-
"maxWithQuery": number;
|
2447
|
-
/**
|
2448
|
-
* The maximum number of suggestions that will be displayed initially when the input field is empty.
|
2449
|
-
*/
|
2450
|
-
"maxWithoutQuery"?: number;
|
2451
|
-
}
|
2452
2435
|
/**
|
2453
2436
|
* The `atomic-search-interface` component is the parent to all other atomic components in a search page. It handles the headless search engine and localization configurations.
|
2454
2437
|
*/
|
@@ -4203,15 +4186,6 @@ declare global {
|
|
4203
4186
|
prototype: HTMLAtomicSearchBoxQuerySuggestionsElement;
|
4204
4187
|
new (): HTMLAtomicSearchBoxQuerySuggestionsElement;
|
4205
4188
|
};
|
4206
|
-
/**
|
4207
|
-
* The `atomic-search-box-recent-queries` component can be added as a child of an `atomic-search-box` component, allowing for the configuration of recent query suggestions.
|
4208
|
-
*/
|
4209
|
-
interface HTMLAtomicSearchBoxRecentQueriesElement extends Components.AtomicSearchBoxRecentQueries, HTMLStencilElement {
|
4210
|
-
}
|
4211
|
-
var HTMLAtomicSearchBoxRecentQueriesElement: {
|
4212
|
-
prototype: HTMLAtomicSearchBoxRecentQueriesElement;
|
4213
|
-
new (): HTMLAtomicSearchBoxRecentQueriesElement;
|
4214
|
-
};
|
4215
4189
|
/**
|
4216
4190
|
* The `atomic-search-interface` component is the parent to all other atomic components in a search page. It handles the headless search engine and localization configurations.
|
4217
4191
|
*/
|
@@ -4616,7 +4590,6 @@ declare global {
|
|
4616
4590
|
"atomic-search-box": HTMLAtomicSearchBoxElement;
|
4617
4591
|
"atomic-search-box-instant-results": HTMLAtomicSearchBoxInstantResultsElement;
|
4618
4592
|
"atomic-search-box-query-suggestions": HTMLAtomicSearchBoxQuerySuggestionsElement;
|
4619
|
-
"atomic-search-box-recent-queries": HTMLAtomicSearchBoxRecentQueriesElement;
|
4620
4593
|
"atomic-search-interface": HTMLAtomicSearchInterfaceElement;
|
4621
4594
|
"atomic-segmented-facet": HTMLAtomicSegmentedFacetElement;
|
4622
4595
|
"atomic-segmented-facet-scrollable": HTMLAtomicSegmentedFacetScrollableElement;
|
@@ -6899,23 +6872,6 @@ declare namespace LocalJSX {
|
|
6899
6872
|
*/
|
6900
6873
|
"maxWithoutQuery"?: number;
|
6901
6874
|
}
|
6902
|
-
/**
|
6903
|
-
* The `atomic-search-box-recent-queries` component can be added as a child of an `atomic-search-box` component, allowing for the configuration of recent query suggestions.
|
6904
|
-
*/
|
6905
|
-
interface AtomicSearchBoxRecentQueries {
|
6906
|
-
/**
|
6907
|
-
* The SVG icon to display. - Use a value that starts with `http://`, `https://`, `./`, or `../`, to fetch and display an icon from a given location. - Use a value that starts with `assets://`, to display an icon from the Atomic package. - Use a stringified SVG to display it directly.
|
6908
|
-
*/
|
6909
|
-
"icon"?: string;
|
6910
|
-
/**
|
6911
|
-
* The maximum number of suggestions that will be displayed if the user has typed something into the input field.
|
6912
|
-
*/
|
6913
|
-
"maxWithQuery"?: number;
|
6914
|
-
/**
|
6915
|
-
* The maximum number of suggestions that will be displayed initially when the input field is empty.
|
6916
|
-
*/
|
6917
|
-
"maxWithoutQuery"?: number;
|
6918
|
-
}
|
6919
6875
|
/**
|
6920
6876
|
* The `atomic-search-interface` component is the parent to all other atomic components in a search page. It handles the headless search engine and localization configurations.
|
6921
6877
|
*/
|
@@ -7488,7 +7444,6 @@ declare namespace LocalJSX {
|
|
7488
7444
|
"atomic-search-box": AtomicSearchBox;
|
7489
7445
|
"atomic-search-box-instant-results": AtomicSearchBoxInstantResults;
|
7490
7446
|
"atomic-search-box-query-suggestions": AtomicSearchBoxQuerySuggestions;
|
7491
|
-
"atomic-search-box-recent-queries": AtomicSearchBoxRecentQueries;
|
7492
7447
|
"atomic-search-interface": AtomicSearchInterface;
|
7493
7448
|
"atomic-segmented-facet": AtomicSegmentedFacet;
|
7494
7449
|
"atomic-segmented-facet-scrollable": AtomicSegmentedFacetScrollable;
|
@@ -8005,10 +7960,6 @@ declare module "@stencil/core" {
|
|
8005
7960
|
* The `atomic-search-box-query-suggestions` component can be added as a child of an `atomic-search-box` component, allowing for the configuration of query suggestion behavior.
|
8006
7961
|
*/
|
8007
7962
|
"atomic-search-box-query-suggestions": LocalJSX.AtomicSearchBoxQuerySuggestions & JSXBase.HTMLAttributes<HTMLAtomicSearchBoxQuerySuggestionsElement>;
|
8008
|
-
/**
|
8009
|
-
* The `atomic-search-box-recent-queries` component can be added as a child of an `atomic-search-box` component, allowing for the configuration of recent query suggestions.
|
8010
|
-
*/
|
8011
|
-
"atomic-search-box-recent-queries": LocalJSX.AtomicSearchBoxRecentQueries & JSXBase.HTMLAttributes<HTMLAtomicSearchBoxRecentQueriesElement>;
|
8012
7963
|
/**
|
8013
7964
|
* The `atomic-search-interface` component is the parent to all other atomic components in a search page. It handles the headless search engine and localization configurations.
|
8014
7965
|
*/
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { LitElement, TemplateResult } from 'lit';
|
2
2
|
import type { TemplateResultType } from 'lit/directive-helpers.js';
|
3
3
|
import type { AnyBindings } from '../components/common/interface/bindings';
|
4
|
-
import type { SearchBoxSuggestions } from '../components/common/suggestions/suggestions-
|
4
|
+
import type { SearchBoxSuggestions } from '../components/common/suggestions/suggestions-types';
|
5
5
|
export type GenericRender<T extends TemplateResultType> = TemplateResult<T>;
|
6
6
|
export type RenderGuardDecorator<Component, T extends TemplateResultType, Descriptor = TypedPropertyDescriptor<() => GenericRender<T>>> = (target: Component, propertyKey: 'render', descriptor: Descriptor) => Descriptor;
|
7
7
|
/**
|
package/dist/types/index.d.ts
CHANGED
@@ -5,7 +5,9 @@ export { SelectChildProductEventArgs } from './components/commerce/atomic-produc
|
|
5
5
|
export { productContext } from './components/commerce/product-template-component-utils/stencil-product-template-decorators';
|
6
6
|
export { PopoverChildFacet } from './components/common/facets/popover/popover-type';
|
7
7
|
export { RedirectionPayload } from './components/common/search-box/redirection-payload';
|
8
|
-
export { dispatchSearchBoxSuggestionsEvent
|
8
|
+
export { dispatchSearchBoxSuggestionsEvent } from './components/common/suggestions/suggestions-events';
|
9
|
+
export type { SearchBoxSuggestionElement, SearchBoxSuggestions, SearchBoxSuggestionsBindings, SearchBoxSuggestionsEvent, } from './components/common/suggestions/suggestions-types';
|
10
|
+
export { elementHasNoQuery, elementHasQuery, } from './components/common/suggestions/suggestions-utils';
|
9
11
|
export { RecsBindings } from './components/recommendations/atomic-recs-interface/atomic-recs-interface';
|
10
12
|
export { Bindings } from './components/search/atomic-search-interface/atomic-search-interface';
|
11
13
|
export { resultContext } from './components/search/result-template-components/result-template-decorators';
|
package/docs/atomic-docs.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"timestamp": "2025-09-
|
2
|
+
"timestamp": "2025-09-25T19:21:07",
|
3
3
|
"compiler": {
|
4
4
|
"name": "@stencil/core",
|
5
5
|
"version": "4.20.0",
|
@@ -12480,13 +12480,11 @@
|
|
12480
12480
|
"dependents": [],
|
12481
12481
|
"dependencies": [
|
12482
12482
|
"atomic-suggestion-renderer",
|
12483
|
-
"atomic-search-box-recent-queries",
|
12484
12483
|
"atomic-search-box-query-suggestions"
|
12485
12484
|
],
|
12486
12485
|
"dependencyGraph": {
|
12487
12486
|
"atomic-search-box": [
|
12488
12487
|
"atomic-suggestion-renderer",
|
12489
|
-
"atomic-search-box-recent-queries",
|
12490
12488
|
"atomic-search-box-query-suggestions"
|
12491
12489
|
]
|
12492
12490
|
}
|
@@ -12805,101 +12803,6 @@
|
|
12805
12803
|
]
|
12806
12804
|
}
|
12807
12805
|
},
|
12808
|
-
{
|
12809
|
-
"filePath": "src/components/search/search-box-suggestions/atomic-search-box-recent-queries/atomic-search-box-recent-queries.tsx",
|
12810
|
-
"encapsulation": "shadow",
|
12811
|
-
"tag": "atomic-search-box-recent-queries",
|
12812
|
-
"docs": "The `atomic-search-box-recent-queries` component can be added as a child of an `atomic-search-box` component, allowing for the configuration of recent query suggestions.",
|
12813
|
-
"docsTags": [],
|
12814
|
-
"usage": {},
|
12815
|
-
"props": [
|
12816
|
-
{
|
12817
|
-
"name": "icon",
|
12818
|
-
"type": "string | undefined",
|
12819
|
-
"complexType": {
|
12820
|
-
"original": "string",
|
12821
|
-
"resolved": "string | undefined",
|
12822
|
-
"references": {}
|
12823
|
-
},
|
12824
|
-
"mutable": false,
|
12825
|
-
"attr": "icon",
|
12826
|
-
"reflectToAttr": false,
|
12827
|
-
"docs": "The SVG icon to display.\n\n- Use a value that starts with `http://`, `https://`, `./`, or `../`, to fetch and display an icon from a given location.\n- Use a value that starts with `assets://`, to display an icon from the Atomic package.\n- Use a stringified SVG to display it directly.",
|
12828
|
-
"docsTags": [],
|
12829
|
-
"values": [
|
12830
|
-
{
|
12831
|
-
"type": "string"
|
12832
|
-
},
|
12833
|
-
{
|
12834
|
-
"type": "undefined"
|
12835
|
-
}
|
12836
|
-
],
|
12837
|
-
"optional": true,
|
12838
|
-
"required": false
|
12839
|
-
},
|
12840
|
-
{
|
12841
|
-
"name": "maxWithQuery",
|
12842
|
-
"type": "number",
|
12843
|
-
"complexType": {
|
12844
|
-
"original": "number",
|
12845
|
-
"resolved": "number",
|
12846
|
-
"references": {}
|
12847
|
-
},
|
12848
|
-
"mutable": false,
|
12849
|
-
"attr": "max-with-query",
|
12850
|
-
"reflectToAttr": true,
|
12851
|
-
"docs": "The maximum number of suggestions that will be displayed if the user has typed something into the input field.",
|
12852
|
-
"docsTags": [],
|
12853
|
-
"default": "3",
|
12854
|
-
"values": [
|
12855
|
-
{
|
12856
|
-
"type": "number"
|
12857
|
-
}
|
12858
|
-
],
|
12859
|
-
"optional": false,
|
12860
|
-
"required": false
|
12861
|
-
},
|
12862
|
-
{
|
12863
|
-
"name": "maxWithoutQuery",
|
12864
|
-
"type": "number | undefined",
|
12865
|
-
"complexType": {
|
12866
|
-
"original": "number",
|
12867
|
-
"resolved": "number | undefined",
|
12868
|
-
"references": {}
|
12869
|
-
},
|
12870
|
-
"mutable": false,
|
12871
|
-
"attr": "max-without-query",
|
12872
|
-
"reflectToAttr": true,
|
12873
|
-
"docs": "The maximum number of suggestions that will be displayed initially when the input field is empty.",
|
12874
|
-
"docsTags": [],
|
12875
|
-
"values": [
|
12876
|
-
{
|
12877
|
-
"type": "number"
|
12878
|
-
},
|
12879
|
-
{
|
12880
|
-
"type": "undefined"
|
12881
|
-
}
|
12882
|
-
],
|
12883
|
-
"optional": true,
|
12884
|
-
"required": false
|
12885
|
-
}
|
12886
|
-
],
|
12887
|
-
"methods": [],
|
12888
|
-
"events": [],
|
12889
|
-
"listeners": [],
|
12890
|
-
"styles": [],
|
12891
|
-
"slots": [],
|
12892
|
-
"parts": [],
|
12893
|
-
"dependents": [
|
12894
|
-
"atomic-search-box"
|
12895
|
-
],
|
12896
|
-
"dependencies": [],
|
12897
|
-
"dependencyGraph": {
|
12898
|
-
"atomic-search-box": [
|
12899
|
-
"atomic-search-box-recent-queries"
|
12900
|
-
]
|
12901
|
-
}
|
12902
|
-
},
|
12903
12806
|
{
|
12904
12807
|
"filePath": "src/components/search/atomic-search-interface/atomic-search-interface.tsx",
|
12905
12808
|
"encapsulation": "shadow",
|
@@ -16089,10 +15992,10 @@
|
|
16089
15992
|
"docstring": "",
|
16090
15993
|
"path": "src/components/common/layout/display-options.ts"
|
16091
15994
|
},
|
16092
|
-
"src/components/common/suggestions/suggestions-
|
15995
|
+
"src/components/common/suggestions/suggestions-types.ts::SearchBoxSuggestionElement": {
|
16093
15996
|
"declaration": "export interface SearchBoxSuggestionElement {\n /**\n * Stable identity which enables Stencil to reuse DOM elements for better performance.\n * The best way to pick a key is to use a string that uniquely identifies that list item among its siblings (often your data will already have IDs).\n */\n key: string;\n /**\n * Rendered content of the element.\n *\n * @remarks\n * The `VNode` type will be deprecated in v4 as we are detaching from Stencil.\n */\n content: Element | VNode;\n /**\n * Hook called when the selection is selected.\n * @param e DOM event.\n */\n onSelect?(e: Event): void;\n /**\n * The query associated with the suggestion which will replace the query in the search box if the suggestion is selected.\n */\n query?: string;\n /**\n * For improved accessibility, provide this property with additional information.\n * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label\n */\n ariaLabel?: string;\n /**\n * Adds a specific shadow part attribute that can be selected with the CSS ::part pseudo-element.\n * https://developer.mozilla.org/en-US/docs/Web/CSS/::part\n */\n part?: string;\n /**\n * Hide the suggestion if it's the last in the list.\n */\n hideIfLast?: boolean;\n}",
|
16094
15997
|
"docstring": "Element which will be rendered in the list of suggestions.",
|
16095
|
-
"path": "src/components/common/suggestions/suggestions-
|
15998
|
+
"path": "src/components/common/suggestions/suggestions-types.ts"
|
16096
15999
|
},
|
16097
16000
|
"../headless/dist/definitions/index.d.ts::RelativeDateUnit": {
|
16098
16001
|
"declaration": "any",
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@coveo/atomic",
|
3
3
|
"type": "module",
|
4
|
-
"version": "3.33.8-pre.
|
4
|
+
"version": "3.33.8-pre.a6ca64b34f",
|
5
5
|
"description": "A web-component library for building modern UIs interfacing with the Coveo platform",
|
6
6
|
"homepage": "https://docs.coveo.com/en/atomic/latest/",
|
7
7
|
"repository": {
|
@@ -81,7 +81,7 @@
|
|
81
81
|
},
|
82
82
|
"dependencies": {
|
83
83
|
"@coveo/bueno": "1.1.2",
|
84
|
-
"@coveo/headless": "3.31.
|
84
|
+
"@coveo/headless": "3.31.1-pre.a6ca64b34f",
|
85
85
|
"@lit/context": "1.1.6",
|
86
86
|
"@open-wc/lit-helpers": "0.7.0",
|
87
87
|
"@popperjs/core": "2.11.8",
|
@@ -153,7 +153,7 @@
|
|
153
153
|
},
|
154
154
|
"peerDependencies": {
|
155
155
|
"@coveo/bueno": "1.1.2",
|
156
|
-
"@coveo/headless": "3.31.
|
156
|
+
"@coveo/headless": "3.31.1-pre.a6ca64b34f",
|
157
157
|
"typescript": ">=5.0.0"
|
158
158
|
},
|
159
159
|
"peerDependenciesMeta": {
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import type { Components, JSX } from "../../types/components";
|
2
|
-
|
3
|
-
interface AtomicSearchBoxRecentQueries extends Components.AtomicSearchBoxRecentQueries, HTMLElement {}
|
4
|
-
export const AtomicSearchBoxRecentQueries: {
|
5
|
-
prototype: AtomicSearchBoxRecentQueries;
|
6
|
-
new (): AtomicSearchBoxRecentQueries;
|
7
|
-
};
|
8
|
-
/**
|
9
|
-
* Used to define this component and all nested components recursively.
|
10
|
-
*/
|
11
|
-
export const defineCustomElement: () => void;
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import { A as AtomicSearchBoxRecentQueries$1, d as defineCustomElement$1 } from './atomic-search-box-recent-queries2.js';
|
2
|
-
|
3
|
-
const AtomicSearchBoxRecentQueries = AtomicSearchBoxRecentQueries$1;
|
4
|
-
const defineCustomElement = defineCustomElement$1;
|
5
|
-
|
6
|
-
export { AtomicSearchBoxRecentQueries, defineCustomElement };
|
7
|
-
|
8
|
-
//# sourceMappingURL=atomic-search-box-recent-queries.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"file":"atomic-search-box-recent-queries.js","mappings":";;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
@@ -1,183 +0,0 @@
|
|
1
|
-
import { h, proxyCustomElement, HTMLElement } from '@stencil/core/internal/client';
|
2
|
-
import { HighlightUtils, buildRecentQueriesList } from '@coveo/headless';
|
3
|
-
import { C as Clock } from './clock.js';
|
4
|
-
import { a as SafeStorage, S as StorageItems } from './local-storage-utils.js';
|
5
|
-
import { o as once } from './utils.js';
|
6
|
-
import { e as encodeForDomAttribute } from './string-utils.js';
|
7
|
-
import { d as dispatchSearchBoxSuggestionsEvent } from './suggestions-common.js';
|
8
|
-
|
9
|
-
const getPartialRecentQueryElement = (value, i18n) => {
|
10
|
-
return {
|
11
|
-
part: 'recent-query-item',
|
12
|
-
query: value,
|
13
|
-
key: `recent-${encodeForDomAttribute(value)}`,
|
14
|
-
ariaLabel: i18n.t('recent-query-suggestion-label', {
|
15
|
-
query: value,
|
16
|
-
interpolation: { escapeValue: false },
|
17
|
-
}),
|
18
|
-
};
|
19
|
-
};
|
20
|
-
const getPartialRecentQueryClearElement = (i18n) => {
|
21
|
-
return {
|
22
|
-
key: 'recent-query-clear',
|
23
|
-
ariaLabel: i18n.t('clear-recent-searches', {
|
24
|
-
interpolation: { escapeValue: false },
|
25
|
-
}),
|
26
|
-
part: 'recent-query-title-item suggestion-divider',
|
27
|
-
hideIfLast: true,
|
28
|
-
};
|
29
|
-
};
|
30
|
-
const RecentQueriesContainer = (_, children) => {
|
31
|
-
return (h("div", { part: "recent-query-content", class: "flex items-center text-left break-all" }, children));
|
32
|
-
};
|
33
|
-
const RecentQueryIcon = ({ icon, }) => {
|
34
|
-
return (h("atomic-icon", { part: "recent-query-icon", icon: icon, class: "mr-2 h-4 w-4 shrink-0" }));
|
35
|
-
};
|
36
|
-
const RecentQueryText = ({ query, value, }) => {
|
37
|
-
if (query === '') {
|
38
|
-
return (h("span", { part: "recent-query-text", class: "line-clamp-2 break-all" }, value));
|
39
|
-
}
|
40
|
-
return (h("span", { part: "recent-query-text", class: "line-clamp-2 break-all", innerHTML: HighlightUtils.highlightString({
|
41
|
-
content: value,
|
42
|
-
openingDelimiter: '<span part="recent-query-text-highlight" class="font-bold">',
|
43
|
-
closingDelimiter: '</span>',
|
44
|
-
highlights: [
|
45
|
-
{
|
46
|
-
offset: query.length,
|
47
|
-
length: value.length - query.length,
|
48
|
-
},
|
49
|
-
],
|
50
|
-
}) }));
|
51
|
-
};
|
52
|
-
const RecentQueryClear = ({ i18n, }) => {
|
53
|
-
return (h("div", { part: "recent-query-title-content", class: "flex w-full justify-between" },
|
54
|
-
h("span", { class: "font-bold", part: "recent-query-title" }, i18n.t('recent-searches')),
|
55
|
-
h("span", { part: "recent-query-clear" }, i18n.t('clear'))));
|
56
|
-
};
|
57
|
-
|
58
|
-
const AtomicSearchBoxRecentQueries = /*@__PURE__*/ proxyCustomElement(class AtomicSearchBoxRecentQueries extends HTMLElement {
|
59
|
-
constructor() {
|
60
|
-
super();
|
61
|
-
this.__registerHost();
|
62
|
-
this.__attachShadow();
|
63
|
-
/**
|
64
|
-
* The maximum number of suggestions that will be displayed if the user has typed something into the input field.
|
65
|
-
*/
|
66
|
-
this.maxWithQuery = 3;
|
67
|
-
this.warnUser = once(() => this.bindings.engine.logger.warn('Because analytics are disabled, the recent queries feature is deactivated.'));
|
68
|
-
this.error = undefined;
|
69
|
-
this.icon = undefined;
|
70
|
-
this.maxWithQuery = 3;
|
71
|
-
this.maxWithoutQuery = undefined;
|
72
|
-
}
|
73
|
-
componentWillLoad() {
|
74
|
-
try {
|
75
|
-
dispatchSearchBoxSuggestionsEvent((bindings) => {
|
76
|
-
this.bindings = bindings;
|
77
|
-
return this.initialize();
|
78
|
-
}, this.host, ['atomic-search-box']);
|
79
|
-
}
|
80
|
-
catch (error) {
|
81
|
-
this.error = error;
|
82
|
-
}
|
83
|
-
}
|
84
|
-
renderIcon() {
|
85
|
-
return this.icon || Clock;
|
86
|
-
}
|
87
|
-
initialize() {
|
88
|
-
this.storage = new SafeStorage();
|
89
|
-
this.recentQueriesList = buildRecentQueriesList(this.bindings.engine, {
|
90
|
-
initialState: { queries: this.retrieveLocalStorage() },
|
91
|
-
options: { maxLength: 1000, clearFilters: this.bindings.clearFilters },
|
92
|
-
});
|
93
|
-
this.recentQueriesList.subscribe(() => this.updateLocalStorage());
|
94
|
-
return {
|
95
|
-
position: Array.from(this.host.parentNode.children).indexOf(this.host),
|
96
|
-
renderItems: () => this.renderItems(),
|
97
|
-
};
|
98
|
-
}
|
99
|
-
retrieveLocalStorage() {
|
100
|
-
return this.storage.getParsedJSON(StorageItems.RECENT_QUERIES, []);
|
101
|
-
}
|
102
|
-
updateLocalStorage() {
|
103
|
-
if (!this.recentQueriesList.state.analyticsEnabled) {
|
104
|
-
return this.disableFeature();
|
105
|
-
}
|
106
|
-
return this.storage.setJSON(StorageItems.RECENT_QUERIES, this.recentQueriesList.state.queries);
|
107
|
-
}
|
108
|
-
disableFeature() {
|
109
|
-
this.warnUser();
|
110
|
-
this.storage.removeItem(StorageItems.RECENT_QUERIES);
|
111
|
-
}
|
112
|
-
renderItems() {
|
113
|
-
if (!this.recentQueriesList.state.analyticsEnabled) {
|
114
|
-
return [];
|
115
|
-
}
|
116
|
-
const query = this.bindings.searchBoxController.state.value;
|
117
|
-
const hasQuery = query !== '';
|
118
|
-
const max = hasQuery ? this.maxWithQuery : this.maxWithoutQuery;
|
119
|
-
const filteredQueries = this.recentQueriesList.state.queries
|
120
|
-
.filter((recentQuery) => recentQuery.toLowerCase().startsWith(query.toLowerCase()))
|
121
|
-
.slice(0, max);
|
122
|
-
const suggestionElements = filteredQueries.map((value) => this.renderItem(value));
|
123
|
-
if (suggestionElements.length) {
|
124
|
-
suggestionElements.unshift(this.renderClear());
|
125
|
-
}
|
126
|
-
return suggestionElements;
|
127
|
-
}
|
128
|
-
renderClear() {
|
129
|
-
const partialItem = getPartialRecentQueryClearElement(this.bindings.i18n);
|
130
|
-
return {
|
131
|
-
...partialItem,
|
132
|
-
content: h(RecentQueryClear, { i18n: this.bindings.i18n }),
|
133
|
-
onSelect: () => {
|
134
|
-
this.recentQueriesList.clear();
|
135
|
-
this.bindings.triggerSuggestions();
|
136
|
-
},
|
137
|
-
};
|
138
|
-
}
|
139
|
-
renderItem(value) {
|
140
|
-
const query = this.bindings.searchBoxController.state.value;
|
141
|
-
const partialItem = getPartialRecentQueryElement(value, this.bindings.i18n);
|
142
|
-
return {
|
143
|
-
...partialItem,
|
144
|
-
content: (h(RecentQueriesContainer, null, h(RecentQueryIcon, { icon: this.renderIcon() }), h(RecentQueryText, { query: query, value: value }))),
|
145
|
-
onSelect: () => {
|
146
|
-
if (this.bindings.isStandalone) {
|
147
|
-
this.bindings.searchBoxController.updateText(value);
|
148
|
-
this.bindings.searchBoxController.submit();
|
149
|
-
return;
|
150
|
-
}
|
151
|
-
this.recentQueriesList.executeRecentQuery(this.recentQueriesList.state.queries.indexOf(value));
|
152
|
-
},
|
153
|
-
};
|
154
|
-
}
|
155
|
-
render() {
|
156
|
-
if (this.error) {
|
157
|
-
return (h("atomic-component-error", { key: 'b6a45a61e27fa0a9b9767b79d220423bee93bde6', element: this.host, error: this.error }));
|
158
|
-
}
|
159
|
-
}
|
160
|
-
get host() { return this; }
|
161
|
-
}, [1, "atomic-search-box-recent-queries", {
|
162
|
-
"icon": [1],
|
163
|
-
"maxWithQuery": [514, "max-with-query"],
|
164
|
-
"maxWithoutQuery": [514, "max-without-query"],
|
165
|
-
"error": [32]
|
166
|
-
}]);
|
167
|
-
function defineCustomElement() {
|
168
|
-
if (typeof customElements === "undefined") {
|
169
|
-
return;
|
170
|
-
}
|
171
|
-
const components = ["atomic-search-box-recent-queries"];
|
172
|
-
components.forEach(tagName => { switch (tagName) {
|
173
|
-
case "atomic-search-box-recent-queries":
|
174
|
-
if (!customElements.get(tagName)) {
|
175
|
-
customElements.define(tagName, AtomicSearchBoxRecentQueries);
|
176
|
-
}
|
177
|
-
break;
|
178
|
-
} });
|
179
|
-
}
|
180
|
-
|
181
|
-
export { AtomicSearchBoxRecentQueries as A, defineCustomElement as d };
|
182
|
-
|
183
|
-
//# sourceMappingURL=atomic-search-box-recent-queries2.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"file":"atomic-search-box-recent-queries2.js","mappings":";;;;;;;;AAMO,MAAM,4BAA4B,GAAG,CAC1C,KAAa,EACb,IAAU;IAEV,OAAO;QACL,IAAI,EAAE,mBAAmB;QACzB,KAAK,EAAE,KAAK;QACZ,GAAG,EAAE,UAAU,qBAAqB,CAAC,KAAK,CAA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AK,EAAE,KAAK,GAAI,CACxB,CAC1B;YAED,QAAQ,EAAE;gBACR,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE;oBAC9B,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;oBACpD,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,MAAM,EAAE,CAAC;oBAC3C,OAAO;iBACR;gBAED,IAAI,CAAC,iBAAiB,CAAC,kBAAkB,CACvC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CACpD,CAAC;aACH;SACF,CAAC;KACH;IAEM,MAAM;QACX,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,QACE,+EACE,OAAO,EAAE,IAAI,CAAC,IAAI,EAClB,KAAK,EAAE,IAAI,CAAC,KAAK,GACO,EAC1B;SACH;KACF;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/common/suggestions/stencil-recent-queries.tsx","src/components/search/search-box-suggestions/atomic-search-box-recent-queries/atomic-search-box-recent-queries.tsx"],"sourcesContent":["import {HighlightUtils} from '@coveo/headless';\nimport {FunctionalComponent, h} from '@stencil/core';\nimport {i18n} from 'i18next';\nimport {encodeForDomAttribute} from '../../../utils/string-utils';\nimport {SearchBoxSuggestionElement} from './suggestions-common';\n\nexport const getPartialRecentQueryElement = (\n value: string,\n i18n: i18n\n): Pick<SearchBoxSuggestionElement, 'ariaLabel' | 'key' | 'query' | 'part'> => {\n return {\n part: 'recent-query-item',\n query: value,\n key: `recent-${encodeForDomAttribute(value)}`,\n ariaLabel: i18n.t('recent-query-suggestion-label', {\n query: value,\n interpolation: {escapeValue: false},\n }),\n };\n};\n\nexport const getPartialRecentQueryClearElement = (\n i18n: i18n\n): Pick<\n SearchBoxSuggestionElement,\n 'ariaLabel' | 'key' | 'part' | 'hideIfLast'\n> => {\n return {\n key: 'recent-query-clear',\n ariaLabel: i18n.t('clear-recent-searches', {\n interpolation: {escapeValue: false},\n }),\n part: 'recent-query-title-item suggestion-divider',\n hideIfLast: true,\n };\n};\n\nexport const RecentQueriesContainer: FunctionalComponent = (_, children) => {\n return (\n <div\n part=\"recent-query-content\"\n class=\"flex items-center text-left break-all\"\n >\n {children}\n </div>\n );\n};\n\ninterface RecentQueryIconProps {\n icon: string;\n}\n\nexport const RecentQueryIcon: FunctionalComponent<RecentQueryIconProps> = ({\n icon,\n}) => {\n return (\n <atomic-icon\n part=\"recent-query-icon\"\n icon={icon}\n class=\"mr-2 h-4 w-4 shrink-0\"\n ></atomic-icon>\n );\n};\n\ninterface RecentQueryTextProps {\n query: string;\n value: string;\n}\n\nexport const RecentQueryText: FunctionalComponent<RecentQueryTextProps> = ({\n query,\n value,\n}) => {\n if (query === '') {\n return (\n <span part=\"recent-query-text\" class=\"line-clamp-2 break-all\">\n {value}\n </span>\n );\n }\n return (\n <span\n part=\"recent-query-text\"\n class=\"line-clamp-2 break-all\"\n innerHTML={HighlightUtils.highlightString({\n content: value,\n openingDelimiter:\n '<span part=\"recent-query-text-highlight\" class=\"font-bold\">',\n closingDelimiter: '</span>',\n highlights: [\n {\n offset: query.length,\n length: value.length - query.length,\n },\n ],\n })}\n ></span>\n );\n};\n\ninterface RecentQueryClearProps {\n i18n: i18n;\n}\n\nexport const RecentQueryClear: FunctionalComponent<RecentQueryClearProps> = ({\n i18n,\n}) => {\n return (\n <div part=\"recent-query-title-content\" class=\"flex w-full justify-between\">\n <span class=\"font-bold\" part=\"recent-query-title\">\n {i18n.t('recent-searches')}\n </span>\n <span part=\"recent-query-clear\">{i18n.t('clear')}</span>\n </div>\n );\n};\n","import {\n buildRecentQueriesList,\n RecentQueriesList,\n SearchBox,\n} from '@coveo/headless';\nimport {Component, Element, Prop, State, h} from '@stencil/core';\nimport Clock from '../../../../images/clock.svg';\nimport {SafeStorage, StorageItems} from '../../../../utils/local-storage-utils';\nimport {once} from '../../../../utils/utils';\nimport {\n getPartialRecentQueryClearElement,\n getPartialRecentQueryElement,\n RecentQueriesContainer,\n RecentQueryClear,\n RecentQueryIcon,\n RecentQueryText,\n} from '../../../common/suggestions/stencil-recent-queries';\nimport {\n dispatchSearchBoxSuggestionsEvent,\n SearchBoxSuggestionElement,\n SearchBoxSuggestions,\n SearchBoxSuggestionsBindings,\n} from '../../../common/suggestions/suggestions-common';\nimport {Bindings} from '../../atomic-search-interface/atomic-search-interface';\n\n/**\n * The `atomic-search-box-recent-queries` component can be added as a child of an `atomic-search-box` component, allowing for the configuration of recent query suggestions.\n */\n@Component({\n tag: 'atomic-search-box-recent-queries',\n shadow: true,\n})\nexport class AtomicSearchBoxRecentQueries {\n private bindings!: SearchBoxSuggestionsBindings<SearchBox, Bindings>;\n private recentQueriesList!: RecentQueriesList;\n private storage!: SafeStorage;\n\n @Element() private host!: HTMLElement;\n\n @State() public error!: Error;\n\n /**\n * The SVG icon to display.\n *\n * - Use a value that starts with `http://`, `https://`, `./`, or `../`, to fetch and display an icon from a given location.\n * - Use a value that starts with `assets://`, to display an icon from the Atomic package.\n * - Use a stringified SVG to display it directly.\n */\n @Prop() public icon?: string;\n\n /**\n * The maximum number of suggestions that will be displayed if the user has typed something into the input field.\n */\n @Prop({reflect: true}) public maxWithQuery = 3;\n /**\n * The maximum number of suggestions that will be displayed initially when the input field is empty.\n */\n @Prop({reflect: true}) public maxWithoutQuery?: number;\n\n componentWillLoad() {\n try {\n dispatchSearchBoxSuggestionsEvent<SearchBox, Bindings>(\n (bindings) => {\n this.bindings = bindings;\n return this.initialize();\n },\n this.host,\n ['atomic-search-box']\n );\n } catch (error) {\n this.error = error as Error;\n }\n }\n\n private renderIcon() {\n return this.icon || Clock;\n }\n\n private initialize(): SearchBoxSuggestions {\n this.storage = new SafeStorage();\n this.recentQueriesList = buildRecentQueriesList(this.bindings.engine, {\n initialState: {queries: this.retrieveLocalStorage()},\n options: {maxLength: 1000, clearFilters: this.bindings.clearFilters},\n });\n\n this.recentQueriesList.subscribe(() => this.updateLocalStorage());\n\n return {\n position: Array.from(this.host.parentNode!.children).indexOf(this.host),\n renderItems: () => this.renderItems(),\n };\n }\n\n private retrieveLocalStorage() {\n return this.storage.getParsedJSON(StorageItems.RECENT_QUERIES, []);\n }\n\n private updateLocalStorage() {\n if (!this.recentQueriesList.state.analyticsEnabled) {\n return this.disableFeature();\n }\n\n return this.storage.setJSON(\n StorageItems.RECENT_QUERIES,\n this.recentQueriesList.state.queries\n );\n }\n\n private warnUser = once(() =>\n this.bindings.engine.logger.warn(\n 'Because analytics are disabled, the recent queries feature is deactivated.'\n )\n );\n\n private disableFeature() {\n this.warnUser();\n this.storage.removeItem(StorageItems.RECENT_QUERIES);\n }\n\n private renderItems(): SearchBoxSuggestionElement[] {\n if (!this.recentQueriesList.state.analyticsEnabled) {\n return [];\n }\n\n const query = this.bindings.searchBoxController.state.value;\n const hasQuery = query !== '';\n const max = hasQuery ? this.maxWithQuery : this.maxWithoutQuery;\n const filteredQueries = this.recentQueriesList.state.queries\n .filter((recentQuery) =>\n recentQuery.toLowerCase().startsWith(query.toLowerCase())\n )\n .slice(0, max);\n\n const suggestionElements: SearchBoxSuggestionElement[] =\n filteredQueries.map((value) => this.renderItem(value));\n if (suggestionElements.length) {\n suggestionElements.unshift(this.renderClear());\n }\n\n return suggestionElements;\n }\n\n private renderClear(): SearchBoxSuggestionElement {\n const partialItem = getPartialRecentQueryClearElement(this.bindings.i18n);\n\n return {\n ...partialItem,\n content: <RecentQueryClear i18n={this.bindings.i18n} />,\n onSelect: () => {\n this.recentQueriesList.clear();\n this.bindings.triggerSuggestions();\n },\n };\n }\n\n private renderItem(value: string): SearchBoxSuggestionElement {\n const query = this.bindings.searchBoxController.state.value;\n const partialItem = getPartialRecentQueryElement(value, this.bindings.i18n);\n return {\n ...partialItem,\n content: (\n <RecentQueriesContainer>\n <RecentQueryIcon icon={this.renderIcon()} />\n <RecentQueryText query={query} value={value} />\n </RecentQueriesContainer>\n ),\n\n onSelect: () => {\n if (this.bindings.isStandalone) {\n this.bindings.searchBoxController.updateText(value);\n this.bindings.searchBoxController.submit();\n return;\n }\n\n this.recentQueriesList.executeRecentQuery(\n this.recentQueriesList.state.queries.indexOf(value)\n );\n },\n };\n }\n\n public render() {\n if (this.error) {\n return (\n <atomic-component-error\n element={this.host}\n error={this.error}\n ></atomic-component-error>\n );\n }\n }\n}\n"],"version":3}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"file":"suggestions-common.js","mappings":";;;AA0FA,MAAM,iBAAiB,GAAG;IACxB,mBAAmB;IACnB,2BAA2B;IAC3B,4BAA4B;CACpB,CAAC;AAoDX,MAAM,mBAAmB,GAAG,CAAC,SAAkB,KAC7C,gBAAgB,IAAK,SAAwB;IAC5C,SAAwB,CAAC,cAAc,YAAY,OAAO,CAAC;AAE9D,MAAM,2CAA2C,GAAG,OAIlD,gBAAyB,EACzB,OAAoB,EACpB,KAA+D;IAE/D,MAAM,cAAc,CAAC,WAAW,CAAC,gBAAgB,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;IAC1E,IAAI,mBAAmB,CAAC,gBAAgB,CAAC,EAAE;QACzC,MAAM,gBAAgB,CAAC,cAAc,CAAC;KACvC;SAAM,IAAI,kBAAkB,IAAI,gBAAgB,EAAE;QACjD,MAAO,gBAAuC,CAAC,gBAAgB,EAAE,CAAC;KACnE;IACD,OAAO,CAAC,aAAa,CACnB,gBAAgB,CAAC,qCAAqC,EAAE,KAAK,CAAC,CAC/D,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;MAKa,iCAAiC,GAAG,CAI/C,KAA+D,EAC/D,OAAoB,EACpB,2BAA0E,iBAAiB;IAE3F,MAAM,gBAAgB,GAAG,OAAO,CAAC,OAAO,EAAE,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACxE,IAAI,CAAC,gBAAgB,EAAE;QACrB,MAAM,IAAI,KAAK,CACb,QAAQ,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,gFAAgF,wBAAwB,CAAC,IAAI,CACjJ,IAAI,CACL,EAAE,CACJ,CAAC;KACH;IACD,KAAK,2CAA2C,CAC9C,gBAAgB,EAChB,OAAO,EACP,KAAK,CACN,CAAC;AACJ,EAAE;SAEc,iBAAiB,CAAC,EAA8B;IAC9D,OAAO,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;AAC7C,CAAC;SAEe,eAAe,CAAC,EAA8B;IAC5D,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;AAC9C;;;;","names":[],"sources":["src/components/common/suggestions/suggestions-common.ts"],"sourcesContent":["import type {VNode} from '@stencil/core';\nimport type {HTMLStencilElement} from '@stencil/core/internal';\nimport type {LitElement} from 'lit';\nimport {closest} from '../../../utils/dom-utils';\nimport {buildCustomEvent} from '../../../utils/event-utils';\nimport type {AnyBindings} from '../interface/bindings';\n\n/**\n * Element which will be rendered in the list of suggestions.\n */\nexport interface SearchBoxSuggestionElement {\n /**\n * Stable identity which enables Stencil to reuse DOM elements for better performance.\n * The best way to pick a key is to use a string that uniquely identifies that list item among its siblings (often your data will already have IDs).\n */\n key: string;\n /**\n * Rendered content of the element.\n *\n * @remarks\n * The `VNode` type will be deprecated in v4 as we are detaching from Stencil.\n */\n content: Element | VNode;\n /**\n * Hook called when the selection is selected.\n * @param e DOM event.\n */\n onSelect?(e: Event): void;\n /**\n * The query associated with the suggestion which will replace the query in the search box if the suggestion is selected.\n */\n query?: string;\n /**\n * For improved accessibility, provide this property with additional information.\n * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label\n */\n ariaLabel?: string;\n /**\n * Adds a specific shadow part attribute that can be selected with the CSS ::part pseudo-element.\n * https://developer.mozilla.org/en-US/docs/Web/CSS/::part\n */\n part?: string;\n /**\n * Hide the suggestion if it's the last in the list.\n */\n hideIfLast?: boolean;\n}\n\n/**\n * List of suggestions that will be displayed along other lists (e.g recent queries) when the search box's input is selected.\n */\nexport interface SearchBoxSuggestions {\n /**\n * The search box will sort the position of suggestions using this value. The lowest value being first.\n * By default, the DOM position will be used.\n */\n position: number;\n /**\n * Whether the suggestions should be listed in the right or left panel. By default, the suggestions are listed in the right panel.\n */\n panel?: 'left' | 'right';\n /**\n * Method that returns the list of elements which will be rendered in the list of suggestions.\n */\n renderItems(): SearchBoxSuggestionElement[];\n /**\n * Hook called when the user changes the search box's input value. This can lead to all the query suggestions being updated.\n */\n onInput?(): Promise<unknown>;\n /**\n * Hook called when the suggested query changes as a user traverses through the list of suggestions.\n * This is used for instant results, which are rendered based on the current suggested query.\n * @param q The new suggested query.\n */\n onSuggestedQueryChange?(q: string): Promise<unknown>;\n}\n\n/**\n * Event sent from the registered query suggestions to the parent search box.\n */\nexport type SearchBoxSuggestionsEvent<\n SearchBoxController,\n Bindings = AnyBindings,\n> = (\n /**\n * The bindings passed from the search box to the suggestions.\n */\n bindings: SearchBoxSuggestionsBindings<SearchBoxController, Bindings>\n) => SearchBoxSuggestions;\n\nconst searchBoxElements = [\n 'atomic-search-box',\n 'atomic-insight-search-box',\n 'atomic-commerce-search-box',\n] as const;\n\n/**\n * The bindings passed from the search box to the suggestions.\n */\nexport type SearchBoxSuggestionsBindings<\n SearchBoxController,\n Bindings = AnyBindings,\n> = Bindings & {\n /**\n * The unique id of the search box.\n */\n id: string;\n /**\n * Whether the search box is [standalone](https://docs.coveo.com/en/atomic/latest/usage/ssb/).\n */\n isStandalone: boolean;\n /**\n * The search box headless controller.\n */\n searchBoxController: SearchBoxController;\n /**\n * The number of queries to display when the user interacts with the search box.\n */\n numberOfQueries: number;\n /**\n * Whether to clear all active query filters when the end user submits a new query from the search box.\n */\n clearFilters: boolean;\n /**\n * Retrieves the suggested query, meaning the query that would be sent if the search is executed.\n * The suggested query changes as a user traverses through the list of suggestions.\n */\n suggestedQuery(): string;\n /**\n * Removes the current suggestions.\n */\n clearSuggestions(): void;\n /**\n * Triggers update & retrieval of all suggestions.\n */\n triggerSuggestions(): void;\n /**\n * Retrieves the current suggestions.\n */\n getSuggestions(): SearchBoxSuggestions[];\n /**\n * Retrieves the current suggestions elements.\n */\n getSuggestionElements(): SearchBoxSuggestionElement[];\n};\n\nconst isLitElementLoosely = (candidate: unknown): candidate is LitElement =>\n 'updateComplete' in (candidate as LitElement) &&\n (candidate as LitElement).updateComplete instanceof Promise;\n\nconst dispatchSearchBoxSuggestionsEventEventually = async <\n SearchBoxController,\n Bindings = AnyBindings,\n>(\n interfaceElement: Element,\n element: HTMLElement,\n event: SearchBoxSuggestionsEvent<SearchBoxController, Bindings>\n) => {\n await customElements.whenDefined(interfaceElement.nodeName.toLowerCase());\n if (isLitElementLoosely(interfaceElement)) {\n await interfaceElement.updateComplete;\n } else if ('componentOnReady' in interfaceElement) {\n await (interfaceElement as HTMLStencilElement).componentOnReady();\n }\n element.dispatchEvent(\n buildCustomEvent('atomic/searchBoxSuggestion/register', event)\n );\n};\n\n/**\n * Dispatches an event which retrieves the `SearchBoxSuggestionsBindings` on a configured parent search box.\n * @param event Event sent from the registered query suggestions to the parent search box.\n * @param element Element on which to dispatch the event, which must be the child of a configured search box.\n */\nexport const dispatchSearchBoxSuggestionsEvent = <\n SearchBoxController,\n Bindings = AnyBindings,\n>(\n event: SearchBoxSuggestionsEvent<SearchBoxController, Bindings>,\n element: HTMLElement,\n allowedSearchBoxElements: readonly (typeof searchBoxElements)[number][] = searchBoxElements\n) => {\n const interfaceElement = closest(element, searchBoxElements.join(', '));\n if (!interfaceElement) {\n throw new Error(\n `The \"${element.nodeName.toLowerCase()}\" component was not handled, as it is not a child of the following elements: ${allowedSearchBoxElements.join(\n ', '\n )}`\n );\n }\n void dispatchSearchBoxSuggestionsEventEventually(\n interfaceElement,\n element,\n event\n );\n};\n\nexport function elementHasNoQuery(el: SearchBoxSuggestionElement) {\n return !el.query || el.query.trim() === '';\n}\n\nexport function elementHasQuery(el: SearchBoxSuggestionElement) {\n return !!el.query && el.query.trim() !== '';\n}\n"],"version":3}
|
@@ -1,2 +0,0 @@
|
|
1
|
-
import{h as t,f as s}from"./p-dc3df5ce.js";import{B as e}from"./p-b93ccff9.js";import{isNullOrUndefined as i}from"@coveo/bueno";import{D as n}from"./p-f284897c.js";import{d as r}from"./p-01c91b69.js";import{e as o,a}from"./p-7601c3de.js";const h=`<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">\n<circle cx="7" cy="7" r="6.5" stroke="currentColor"/>\n<path d="M16 16L12 12" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>\n`;const u=(s,e)=>{const i=()=>{const t="flex bg-background w-full border border-neutral rounded-md focus-within:ring-3 absolute top-0 left-0";const e=s.disabled?"focus-within:border-disabled focus-within:ring-neutral":"focus-within:border-primary focus-within:ring-ring-primary";return[t,e].join(" ")};return t("div",{part:"wrapper",class:i(),onFocusout:s.onFocusout},e)};const c=`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M15 1.00012L1.00012 14.9999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>\n<path d="M0.999878 1L14.9999 15" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>\n`;const l=({inputRef:s,bindings:i,onClick:n,...r})=>t("div",{part:"clear-button-wrapper",class:"ml-2 flex items-center justify-center py-2"},t(e,{style:"text-transparent",part:"clear-button",class:"text-neutral-dark flex h-8 w-8 shrink-0 items-center justify-center",onClick:()=>{n?.();s?.focus()},ariaLabel:i.i18n.t("clear"),...r},t("atomic-icon",{part:"clear-icon",icon:c,class:"h-4 w-4"})));function g(t){return{autocomplete:"off",autocapitalize:"off",autocorrect:"off",...t.activeDescendant&&{"aria-activedescendant":t.activeDescendant},"aria-autocomplete":"both","aria-haspopup":"true","aria-controls":t.id}}function f(t,s){const e=t?.parentNode;if(!e){return}if(t.value==="\n"){return}e.dataset.replicatedValue=s??t.value}function d(t){const s=t?.parentNode;if(s){delete s.dataset.replicatedValue}}function p(t){const s=t?.parentNode;if(s){s.classList.remove("expanded")}}function m(t){const s=t?.parentNode;if(s){s.classList.add("expanded")}}const w=({textAreaRef:s,loading:e,bindings:i,onInput:n,onFocus:r,onBlur:o,onChange:a,onKeyDown:h,onKeyUp:u,value:c,ariaLabel:w,onClear:b,popup:v,...y})=>t("div",{class:"flex grow overflow-hidden"},t("div",{part:"textarea-expander",class:"grid grow overflow-hidden"},t("textarea",{part:"textarea","aria-label":w,placeholder:i.i18n.t("search"),class:"placeholder-neutral-dark",rows:1,onInput:t=>{n?.(t);f(s)},onKeyDown:t=>{f(s);if(t.key==="Enter"){if(t.shiftKey){return}t.preventDefault()}h?.(t)},onKeyUp:t=>{u?.(t);if(t.key==="Enter"){t.preventDefault();return}f(s)},onBlur:t=>{o?.(t);p(s);f(s)},onChange:t=>{a?.(t);f(s)},onFocus:t=>{r?.(t);const e=t.target;f(s??e);m(s??e)},autocomplete:"off",...v&&g(v),...y,value:c})),e&&t("div",{class:"searchbox-button-wrapper ml-2 flex items-center justify-center"},t("span",{part:"loading",class:"loading mr-2 grid h-5 w-5 animate-spin place-items-center rounded-full bg-linear-to-r"})),!e&&c&&t(l,{inputRef:s,bindings:i,onClick:()=>{b();d(s)}}));function b(t,s){let e;const i=new Promise(((t,i)=>{e=setTimeout((()=>{i(new Error("Promise timed out."))}),s)}));return Promise.race([t,i]).then((()=>{clearTimeout(e)}))}class v{constructor(t){this.ownerSearchBoxProps=t;this.suggestions=[];this.leftSuggestionElements=[];this.rightSuggestionElements=[];this.leftPanel=undefined;this.rightPanel=undefined;this.activeDescendant="";this.suggestedQuery="";this.keyboardActiveDescendant="";this.queryDataAttribute="data-query";this.suggestionEvents=[];this.previousActiveDescendantElement=null;this.leftSuggestions=[];this.rightSuggestions=[];this.triggerSuggestions=r((()=>this.executeQuerySuggestion()),this.ownerSearchBoxProps.getSuggestionDelay())}get partialSuggestionBindings(){return{suggestedQuery:()=>this.suggestedQuery,clearSuggestions:()=>this.clearSuggestions(),triggerSuggestions:()=>this.triggerSuggestions(),getSuggestions:()=>this.suggestions,getSuggestionElements:()=>this.allSuggestionElements}}get activeDescendantElement(){if(!this.hasActiveDescendant){return null}return this.leftPanel?.querySelector(`#${this.activeDescendant}`)||this.rightPanel?.querySelector(`#${this.activeDescendant}`)||null}onSubmit(){this.clickOnActiveElement();this.clearSuggestions()}updateActiveDescendant(t=""){this.activeDescendant=t;s(this.ownerSearchBoxProps.getHost())}updateKeyboardActiveDescendant(t=""){this.keyboardActiveDescendant=t}clickOnActiveElement(){this.activeDescendantElement?.click();this.updateActiveDescendant()}isRightPanelInFocus(){if(i(this.panelInFocus)||i(this.rightPanel)){return false}return this.panelInFocus===this.rightPanel}initializeSuggestions(t){this.suggestions=this.suggestionEvents.map((s=>s(t)))}registerSuggestionsFromEvent(t,s){t.preventDefault();t.stopPropagation();this.suggestionEvents.push(t.detail);this.suggestions.push(t.detail(s))}registerSuggestions(t){this.suggestions.push(t)}get isDoubleList(){return Boolean(this.leftSuggestionElements.length&&this.rightSuggestionElements.length)}focusPanel(t){const s=t==="left"?this.leftPanel:this.rightPanel;if(this.panelInFocus===s){return}if(s?.firstElementChild){const t=this.previousActiveDescendantElement&&s.contains(this.previousActiveDescendantElement);const e=t?this.previousActiveDescendantElement:s.firstElementChild;this.updateDescendants(e.id)}}clearSuggestions(){this.clearSuggestionElements();this.updateActiveDescendant()}async focusNextValue(){if(!this.hasSuggestions||!this.nextOrFirstValue){return}await this.focusValue(this.nextOrFirstValue)}async focusValue(t){this.updateKeyboardActiveDescendant(t.id);this.updateActiveDescendant(t.id);this.scrollActiveDescendantIntoView();await this.updateQueryFromSuggestion()}async onSuggestionMouseOver(t,s,e){const i=s==="left"?this.leftPanel:this.rightPanel;this.updateKeyboardActiveDescendant();if(this.panelInFocus===i){this.updateActiveDescendant(e)}else{this.updateDescendants(e)}if(t.query){await this.updateSuggestedQuery(t.query)}}async onSuggestionClick(t,s){if(t.query){this.clearSuggestions();await this.updateOwnerSearchboxQuery(t.query)}t.onSelect?.(s)}get hasSuggestions(){return!!this.allSuggestionElements.length}get allSuggestionElements(){return[...this.leftSuggestionElements,...this.rightSuggestionElements]}async focusPreviousValue(){if(this.firstValue===this.activeDescendantElement){this.updateKeyboardActiveDescendant();this.updateActiveDescendant();return}if(!this.hasSuggestions||!this.previousOrLastValue){return}await this.focusValue(this.previousOrLastValue)}get hasActiveDescendant(){return this.activeDescendant!==""}async executeQuerySuggestion(){this.updateActiveDescendant();const t=await Promise.allSettled(this.suggestions.map((t=>b(t.onInput?t.onInput():Promise.resolve(),this.ownerSearchBoxProps.getSuggestionTimeout()))));const s=[];t.forEach(((t,e)=>{if(t.status==="fulfilled"){s.push(this.suggestions[e])}else{this.ownerSearchBoxProps.getLogger().warn("Some query suggestions are not being shown because the promise timed out.")}}));const e=(t,e=false)=>s.filter((s=>s.panel===t||!s.panel&&e)).sort(this.sortSuggestions);this.leftSuggestions=e("left",true);this.leftSuggestionElements=this.getAndFilterLeftSuggestionElements();this.rightSuggestions=e("right");this.rightSuggestionElements=this.getSuggestionElements(this.rightSuggestions);const i=this.allSuggestionElements.find(o)?.query||"";await this.updateSuggestedQuery(i)}get lastValue(){return this.panelInFocus?.lastElementChild}get previousOrLastValue(){if(!this.hasActiveDescendant){return this.lastValue?.firstChild}const t=this.activeDescendantElement?.parentElement;return t?.previousElementSibling?.firstChild||this.firstValue?.firstChild}sortSuggestions(t,s){return t.position-s.position}get nextOrFirstValue(){if(!this.hasActiveDescendant){return this.firstValue?.firstChild}const t=this.activeDescendantElement?.parentElement;return t?.nextElementSibling?.firstChild||this.firstValue?.firstChild}get firstValue(){return this.panelInFocus?.firstElementChild}get panelInFocus(){if(this.leftPanel?.contains(this.activeDescendantElement)){return this.leftPanel}if(this.rightPanel?.contains(this.activeDescendantElement)){return this.rightPanel}return this.leftPanel||this.rightPanel}scrollActiveDescendantIntoView(){this.activeDescendantElement?.scrollIntoView({block:"nearest"})}async updateQueryFromSuggestion(){const t=this.activeDescendantElement?.getAttribute(this.queryDataAttribute);await this.updateOwnerSearchboxQuery(t||"")}async updateOwnerSearchboxQuery(t){if(t&&this.ownerSearchBoxProps.getSearchBoxValue()!==t){this.ownerSearchBoxProps.updateQuery(t);await this.updateSuggestedQuery(t)}}async updateSuggestedQuery(t){await Promise.allSettled(this.suggestions.map((s=>b(s.onSuggestedQueryChange?s.onSuggestedQueryChange(t):Promise.resolve(),this.ownerSearchBoxProps.getSuggestionTimeout()))));this.suggestedQuery=t;this.updateSuggestionElements(t);s(this.ownerSearchBoxProps.getHost())}updateSuggestionElements(t){if(!this.isPanelInFocus(this.leftPanel,t)){this.leftSuggestionElements=this.getAndFilterLeftSuggestionElements()}if(!this.isPanelInFocus(this.rightPanel,t)){this.rightSuggestionElements=this.getSuggestionElements(this.rightSuggestions)}}forceUpdate(){this.updateSuggestionElements(this.suggestedQuery);s(this.ownerSearchBoxProps.getHost())}isPanelInFocus(t,s){if(!this.activeDescendantElement){return false}if(s){const e=n.sanitize(s);return!!t?.querySelector(`[${this.queryDataAttribute}="${CSS.escape(e)}"]`)}return this.activeDescendantElement?.closest("ul")===t}getAndFilterLeftSuggestionElements(){const t=this.getSuggestionElements(this.leftSuggestions);const s=new Set;const e=t.filter((t=>{if(i(t.query)){return true}if(s.has(t.query)){return false}else{s.add(t.query);return true}}));return e}getSuggestionElements(t){const s=t.flatMap((t=>t.renderItems()));const e=this.ownerSearchBoxProps.getNumberOfSuggestionsToDisplay()+s.filter(a).length;return s.slice(0,e)}updateDescendants(t=""){const s=this.activeDescendantElement;this.previousActiveDescendantElement=s;this.updateActiveDescendant(t)}clearSuggestionElements(){this.leftSuggestionElements=[];this.rightSuggestionElements=[]}}export{v as S,h as a,w as b,u as c};
|
2
|
-
//# sourceMappingURL=p-29fd6768.js.map
|