@coveo/atomic 3.33.8-pre.3f3b66cf8c → 3.33.8-pre.40f23746c4
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/components/_index.js +1 -2
- package/dist/atomic/components/analytics-config.js +1 -1
- package/dist/atomic/components/atomic-category-facet.js +1 -1
- package/dist/atomic/components/atomic-facet.js +1 -1
- package/dist/atomic/components/atomic-format-currency.js +1 -1
- package/dist/atomic/components/atomic-format-number.js +1 -1
- package/dist/atomic/components/atomic-format-unit.js +1 -1
- package/dist/atomic/components/atomic-insight-search-box.js +4 -3
- package/dist/atomic/components/atomic-insight-search-box.js.map +1 -1
- package/dist/atomic/components/atomic-numeric-facet.js +1 -1
- package/dist/atomic/components/atomic-quickview-modal2.js +1 -1
- package/dist/atomic/components/atomic-quickview.js +1 -1
- package/dist/atomic/components/atomic-result-children.js +1 -1
- package/dist/atomic/components/atomic-result-fields-list.js +1 -1
- package/dist/atomic/components/atomic-result-link.js +1 -1
- package/dist/atomic/components/atomic-result-list.js +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-recent-queries2.js +2 -2
- package/dist/atomic/components/atomic-search-box-recent-queries2.js.map +1 -1
- package/dist/atomic/components/atomic-search-box.js +6 -16
- 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-sort-dropdown.js +2 -2
- package/dist/atomic/components/atomic-sort-expression.js +1 -1
- 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/components/commerce/atomic-commerce-breadbox/atomic-commerce-breadbox.js +4 -1
- package/dist/atomic/components/components/commerce/atomic-commerce-interface/atomic-commerce-interface.js +2 -2
- package/dist/atomic/components/components/commerce/atomic-commerce-search-box/atomic-commerce-search-box.js +6 -13
- 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/layout/layout-styles-controller.js +1 -1
- package/dist/atomic/components/components/common/suggestions/suggestion-manager.js +1 -1
- package/dist/atomic/components/components/common/suggestions/{suggestions-events.js → suggestions-common.js} +18 -16
- package/dist/atomic/components/components/search/atomic-search-interface/atomic-search-interface.js +9 -11
- package/dist/atomic/components/global/environment.js +1 -1
- package/dist/atomic/components/index.js.map +1 -1
- package/dist/atomic/components/stencil-query-suggestions.js.map +1 -1
- package/dist/atomic/components/stencil-suggestion-manager.js +2 -20
- package/dist/atomic/components/stencil-suggestion-manager.js.map +1 -1
- package/dist/atomic/components/{suggestions-events.js → suggestions-common.js} +20 -18
- package/dist/atomic/components/suggestions-common.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-4915faeb.entry.js → p-094b61d4.entry.js} +2 -2
- package/dist/atomic/{p-2f98d428.entry.js → p-19bfc4df.entry.js} +2 -2
- package/dist/atomic/{p-fb1a1e2e.entry.js → p-1c6f7489.entry.js} +2 -2
- package/dist/atomic/p-1c6f7489.entry.js.map +1 -0
- package/dist/atomic/{p-8acb1466.entry.js → p-25eabe15.entry.js} +2 -2
- package/dist/atomic/p-29fd6768.js +2 -0
- package/dist/atomic/p-29fd6768.js.map +1 -0
- package/dist/atomic/p-2d27675d.entry.js +2 -0
- package/dist/atomic/p-2d27675d.entry.js.map +1 -0
- package/dist/atomic/{p-45c4685e.entry.js → p-33899ab5.entry.js} +2 -2
- package/dist/atomic/{p-a02b1209.entry.js → p-394c600f.entry.js} +2 -2
- package/dist/atomic/{p-be1b98a6.entry.js → p-3c823399.entry.js} +2 -2
- package/dist/atomic/{p-3213225f.entry.js → p-3db62800.entry.js} +2 -2
- package/dist/atomic/p-3db62800.entry.js.map +1 -0
- package/dist/atomic/{p-3af5c567.entry.js → p-45840906.entry.js} +2 -2
- package/dist/atomic/{p-d2d22ab2.entry.js → p-4b4b2626.entry.js} +2 -2
- package/dist/atomic/p-7601c3de.js +2 -0
- package/dist/atomic/p-7601c3de.js.map +1 -0
- package/dist/atomic/{p-8112f3b7.entry.js → p-795f331d.entry.js} +2 -2
- package/dist/atomic/{p-65373475.entry.js → p-7dd3d72f.entry.js} +2 -2
- package/dist/atomic/{p-d11b2b24.entry.js → p-80683e4c.entry.js} +2 -2
- package/dist/atomic/{p-71bb8125.entry.js → p-867fd04d.entry.js} +2 -2
- package/dist/atomic/{p-516b8165.entry.js → p-8bac9d25.entry.js} +2 -2
- package/dist/atomic/p-8bac9d25.entry.js.map +1 -0
- package/dist/atomic/{p-4e9d1f9e.entry.js → p-9349aa1a.entry.js} +2 -2
- package/dist/atomic/{p-ef64b06a.entry.js → p-9b241ca5.entry.js} +2 -2
- package/dist/atomic/{p-b4ad3036.entry.js → p-a278ffde.entry.js} +2 -2
- package/dist/atomic/{p-00a6ab8c.entry.js → p-a37fae7c.entry.js} +2 -2
- package/dist/atomic/p-a37fae7c.entry.js.map +1 -0
- package/dist/atomic/{p-4c30ca3e.entry.js → p-aed46103.entry.js} +2 -2
- package/dist/atomic/p-af93b44c.js.map +1 -1
- package/dist/atomic/{p-2a1a560e.js → p-b24d5e96.js} +2 -2
- package/dist/atomic/{p-f073a78d.entry.js → p-c23a07f5.entry.js} +2 -2
- package/dist/atomic/{p-5adbf098.entry.js → p-f4780315.entry.js} +2 -2
- package/dist/cjs/_index.cjs.js +2 -5
- package/dist/cjs/{analytics-config-ea852f00.js → analytics-config-e3a454e4.js} +2 -2
- package/dist/cjs/{analytics-config-ea852f00.js.map → analytics-config-e3a454e4.js.map} +1 -1
- package/dist/cjs/atomic-category-facet.cjs.entry.js +1 -1
- package/dist/cjs/atomic-facet.cjs.entry.js +1 -1
- package/dist/cjs/atomic-format-currency.cjs.entry.js +1 -1
- package/dist/cjs/atomic-format-number.cjs.entry.js +1 -1
- package/dist/cjs/atomic-format-unit.cjs.entry.js +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-numeric-facet.cjs.entry.js +1 -1
- package/dist/cjs/atomic-quickview-modal.cjs.entry.js +1 -1
- package/dist/cjs/atomic-quickview.cjs.entry.js +1 -1
- package/dist/cjs/atomic-recs-interface.cjs.entry.js +1 -1
- package/dist/cjs/atomic-result-children.cjs.entry.js +1 -1
- package/dist/cjs/atomic-result-fields-list.cjs.entry.js +1 -1
- package/dist/cjs/atomic-result-link.cjs.entry.js +1 -1
- package/dist/cjs/atomic-result-list.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_2.cjs.entry.js +5 -5
- package/dist/cjs/atomic-search-box-query-suggestions_2.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-search-box.cjs.entry.js +7 -18
- package/dist/cjs/atomic-search-box.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-smart-snippet-feedback-modal.cjs.entry.js +2 -2
- package/dist/cjs/atomic-sort-dropdown.cjs.entry.js +2 -2
- package/dist/cjs/atomic-sort-expression.cjs.entry.js +1 -1
- 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/index.cjs.js.map +1 -1
- package/dist/cjs/stencil-query-suggestions-03268ecc.js.map +1 -1
- package/dist/cjs/{stencil-suggestion-manager-2cba6d69.js → stencil-suggestion-manager-c0878ef2.js} +4 -4
- package/dist/cjs/{stencil-suggestion-manager-2cba6d69.js.map → stencil-suggestion-manager-c0878ef2.js.map} +1 -1
- package/dist/cjs/{suggestions-events-63dd0640.js → suggestions-common-5097a362.js} +21 -17
- package/dist/cjs/suggestions-common-5097a362.js.map +1 -0
- package/dist/cjs/version.cjs.js +2 -2
- package/dist/esm/_index.js +1 -2
- package/dist/esm/{analytics-config-3bfe2800.js → analytics-config-c65ccb06.js} +2 -2
- package/dist/esm/{analytics-config-3bfe2800.js.map → analytics-config-c65ccb06.js.map} +1 -1
- package/dist/esm/atomic-category-facet.entry.js +1 -1
- package/dist/esm/atomic-facet.entry.js +1 -1
- package/dist/esm/atomic-format-currency.entry.js +1 -1
- package/dist/esm/atomic-format-number.entry.js +1 -1
- package/dist/esm/atomic-format-unit.entry.js +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-numeric-facet.entry.js +1 -1
- package/dist/esm/atomic-quickview-modal.entry.js +1 -1
- package/dist/esm/atomic-quickview.entry.js +1 -1
- package/dist/esm/atomic-recs-interface.entry.js +1 -1
- package/dist/esm/atomic-result-children.entry.js +1 -1
- package/dist/esm/atomic-result-fields-list.entry.js +1 -1
- package/dist/esm/atomic-result-link.entry.js +1 -1
- package/dist/esm/atomic-result-list.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_2.entry.js +3 -3
- package/dist/esm/atomic-search-box-query-suggestions_2.entry.js.map +1 -1
- package/dist/esm/atomic-search-box.entry.js +6 -17
- package/dist/esm/atomic-search-box.entry.js.map +1 -1
- package/dist/esm/atomic-smart-snippet-feedback-modal.entry.js +2 -2
- package/dist/esm/atomic-sort-dropdown.entry.js +2 -2
- package/dist/esm/atomic-sort-expression.entry.js +1 -1
- 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/index.js.map +1 -1
- package/dist/esm/stencil-query-suggestions-5d6a46d7.js.map +1 -1
- package/dist/esm/{stencil-suggestion-manager-376f83e8.js → stencil-suggestion-manager-486094dd.js} +2 -2
- package/dist/esm/{stencil-suggestion-manager-376f83e8.js.map → stencil-suggestion-manager-486094dd.js.map} +1 -1
- package/dist/esm/{suggestions-events-b7a6f007.js → suggestions-common-2b20db26.js} +20 -18
- package/dist/esm/suggestions-common-2b20db26.js.map +1 -0
- package/dist/esm/version.js +2 -2
- package/dist/types/components/commerce/atomic-commerce-breadbox/atomic-commerce-breadbox.d.ts +2 -1
- package/dist/types/components/commerce/atomic-commerce-interface/atomic-commerce-interface.d.ts +2 -1
- package/dist/types/components/commerce/atomic-commerce-search-box/atomic-commerce-search-box.d.ts +0 -1
- 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-types.d.ts → suggestions-common.d.ts} +16 -6
- package/dist/types/components/search/atomic-search-box/atomic-search-box.d.ts +1 -2
- package/dist/types/components/search/atomic-search-interface/atomic-search-interface.d.ts +4 -4
- 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 -2
- package/dist/types/decorators/types.d.ts +1 -1
- package/dist/types/index.d.ts +1 -3
- package/docs/atomic-docs.json +3 -3
- package/package.json +3 -3
- package/dist/atomic/components/components/common/suggestions/suggestions-types.js +0 -1
- package/dist/atomic/components/components/common/suggestions/suggestions-utils.js +0 -18
- package/dist/atomic/components/suggestions-events.js.map +0 -1
- package/dist/atomic/p-00a6ab8c.entry.js.map +0 -1
- package/dist/atomic/p-0a051b8d.js +0 -2
- package/dist/atomic/p-0a051b8d.js.map +0 -1
- package/dist/atomic/p-16f4ce98.js +0 -2
- package/dist/atomic/p-16f4ce98.js.map +0 -1
- package/dist/atomic/p-3213225f.entry.js.map +0 -1
- package/dist/atomic/p-4b7a19db.js +0 -2
- package/dist/atomic/p-4b7a19db.js.map +0 -1
- package/dist/atomic/p-516b8165.entry.js.map +0 -1
- package/dist/atomic/p-79a9a372.entry.js +0 -2
- package/dist/atomic/p-79a9a372.entry.js.map +0 -1
- package/dist/atomic/p-fb1a1e2e.entry.js.map +0 -1
- package/dist/cjs/suggestions-events-63dd0640.js.map +0 -1
- package/dist/cjs/suggestions-utils-61000808.js +0 -25
- package/dist/cjs/suggestions-utils-61000808.js.map +0 -1
- package/dist/esm/suggestions-events-b7a6f007.js.map +0 -1
- package/dist/esm/suggestions-utils-591559a0.js +0 -22
- package/dist/esm/suggestions-utils-591559a0.js.map +0 -1
- package/dist/types/components/common/suggestions/suggestions-events.d.ts +0 -14
- package/dist/types/components/common/suggestions/suggestions-utils.d.ts +0 -15
- /package/dist/atomic/{p-4915faeb.entry.js.map → p-094b61d4.entry.js.map} +0 -0
- /package/dist/atomic/{p-2f98d428.entry.js.map → p-19bfc4df.entry.js.map} +0 -0
- /package/dist/atomic/{p-8acb1466.entry.js.map → p-25eabe15.entry.js.map} +0 -0
- /package/dist/atomic/{p-45c4685e.entry.js.map → p-33899ab5.entry.js.map} +0 -0
- /package/dist/atomic/{p-a02b1209.entry.js.map → p-394c600f.entry.js.map} +0 -0
- /package/dist/atomic/{p-be1b98a6.entry.js.map → p-3c823399.entry.js.map} +0 -0
- /package/dist/atomic/{p-3af5c567.entry.js.map → p-45840906.entry.js.map} +0 -0
- /package/dist/atomic/{p-d2d22ab2.entry.js.map → p-4b4b2626.entry.js.map} +0 -0
- /package/dist/atomic/{p-8112f3b7.entry.js.map → p-795f331d.entry.js.map} +0 -0
- /package/dist/atomic/{p-65373475.entry.js.map → p-7dd3d72f.entry.js.map} +0 -0
- /package/dist/atomic/{p-d11b2b24.entry.js.map → p-80683e4c.entry.js.map} +0 -0
- /package/dist/atomic/{p-71bb8125.entry.js.map → p-867fd04d.entry.js.map} +0 -0
- /package/dist/atomic/{p-4e9d1f9e.entry.js.map → p-9349aa1a.entry.js.map} +0 -0
- /package/dist/atomic/{p-ef64b06a.entry.js.map → p-9b241ca5.entry.js.map} +0 -0
- /package/dist/atomic/{p-b4ad3036.entry.js.map → p-a278ffde.entry.js.map} +0 -0
- /package/dist/atomic/{p-4c30ca3e.entry.js.map → p-aed46103.entry.js.map} +0 -0
- /package/dist/atomic/{p-2a1a560e.js.map → p-b24d5e96.js.map} +0 -0
- /package/dist/atomic/{p-f073a78d.entry.js.map → p-c23a07f5.entry.js.map} +0 -0
- /package/dist/atomic/{p-5adbf098.entry.js.map → p-f4780315.entry.js.map} +0 -0
|
@@ -1,22 +1,6 @@
|
|
|
1
1
|
import { c as closest } from './dom-utils-f6086cd3.js';
|
|
2
2
|
import { b as buildCustomEvent } from './event-utils-8de63ec3.js';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Dispatches an event which retrieves the `SearchBoxSuggestionsBindings` on a configured parent search box.
|
|
6
|
-
*
|
|
7
|
-
* @param event Event sent from the registered query suggestions to the parent search box
|
|
8
|
-
* @param element Element on which to dispatch the event, which must be the child of a configured search box
|
|
9
|
-
* @param allowedSearchBoxElements Optional array of allowed search box element selectors
|
|
10
|
-
*
|
|
11
|
-
* @throws Error if the element is not a child of an allowed search box element
|
|
12
|
-
*/
|
|
13
|
-
const dispatchSearchBoxSuggestionsEvent = (event, element, allowedSearchBoxElements = searchBoxElements) => {
|
|
14
|
-
const interfaceElement = closest(element, searchBoxElements.join(', '));
|
|
15
|
-
if (!interfaceElement) {
|
|
16
|
-
throw new Error(`The "${element.nodeName.toLowerCase()}" component was not handled, as it is not a child of the following elements: ${allowedSearchBoxElements.join(', ')}`);
|
|
17
|
-
}
|
|
18
|
-
void dispatchSearchBoxSuggestionsEventEventually(interfaceElement, element, event);
|
|
19
|
-
};
|
|
20
4
|
const searchBoxElements = [
|
|
21
5
|
'atomic-search-box',
|
|
22
6
|
'atomic-insight-search-box',
|
|
@@ -34,7 +18,25 @@ const dispatchSearchBoxSuggestionsEventEventually = async (interfaceElement, ele
|
|
|
34
18
|
}
|
|
35
19
|
element.dispatchEvent(buildCustomEvent('atomic/searchBoxSuggestion/register', event));
|
|
36
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Dispatches an event which retrieves the `SearchBoxSuggestionsBindings` on a configured parent search box.
|
|
23
|
+
* @param event Event sent from the registered query suggestions to the parent search box.
|
|
24
|
+
* @param element Element on which to dispatch the event, which must be the child of a configured search box.
|
|
25
|
+
*/
|
|
26
|
+
const dispatchSearchBoxSuggestionsEvent = (event, element, allowedSearchBoxElements = searchBoxElements) => {
|
|
27
|
+
const interfaceElement = closest(element, searchBoxElements.join(', '));
|
|
28
|
+
if (!interfaceElement) {
|
|
29
|
+
throw new Error(`The "${element.nodeName.toLowerCase()}" component was not handled, as it is not a child of the following elements: ${allowedSearchBoxElements.join(', ')}`);
|
|
30
|
+
}
|
|
31
|
+
void dispatchSearchBoxSuggestionsEventEventually(interfaceElement, element, event);
|
|
32
|
+
};
|
|
33
|
+
function elementHasNoQuery(el) {
|
|
34
|
+
return !el.query || el.query.trim() === '';
|
|
35
|
+
}
|
|
36
|
+
function elementHasQuery(el) {
|
|
37
|
+
return !!el.query && el.query.trim() !== '';
|
|
38
|
+
}
|
|
37
39
|
|
|
38
|
-
export { dispatchSearchBoxSuggestionsEvent as d };
|
|
40
|
+
export { elementHasNoQuery as a, dispatchSearchBoxSuggestionsEvent as d, elementHasQuery as e };
|
|
39
41
|
|
|
40
|
-
//# sourceMappingURL=suggestions-
|
|
42
|
+
//# sourceMappingURL=suggestions-common-2b20db26.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"suggestions-common-2b20db26.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}
|
package/dist/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const headlessVersion = '3.31.
|
|
2
|
-
export const atomicVersion = '3.33.8-pre.
|
|
1
|
+
export const headlessVersion = '3.31.0';
|
|
2
|
+
export const atomicVersion = '3.33.8-pre.40f23746c4';
|
package/dist/types/components/commerce/atomic-commerce-breadbox/atomic-commerce-breadbox.d.ts
CHANGED
|
@@ -53,7 +53,8 @@ export declare class AtomicCommerceBreadbox extends LitElement implements Initia
|
|
|
53
53
|
pathLimit: number;
|
|
54
54
|
initialize(): void;
|
|
55
55
|
willUpdate(changedProperties: Map<string, unknown>): void;
|
|
56
|
-
|
|
56
|
+
firstUpdated(): void;
|
|
57
|
+
updateCompleted(): void;
|
|
57
58
|
private validateProps;
|
|
58
59
|
disconnectedCallback(): void;
|
|
59
60
|
private get breadcrumbs();
|
package/dist/types/components/commerce/atomic-commerce-interface/atomic-commerce-interface.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export declare class AtomicCommerceInterface extends AtomicCommerceInterface_bas
|
|
|
26
26
|
private unsubscribeSummary?;
|
|
27
27
|
private initialized;
|
|
28
28
|
private store;
|
|
29
|
+
private _mobileBreakpointController;
|
|
29
30
|
private interfaceController;
|
|
30
31
|
static styles: CSSResultGroup;
|
|
31
32
|
/**
|
|
@@ -62,7 +63,7 @@ export declare class AtomicCommerceInterface extends AtomicCommerceInterface_bas
|
|
|
62
63
|
*/
|
|
63
64
|
reflectStateInUrl: boolean;
|
|
64
65
|
/**
|
|
65
|
-
*
|
|
66
|
+
* Disable state reflection in the URL parameters.
|
|
66
67
|
*/
|
|
67
68
|
disableStateReflectionInUrl: boolean;
|
|
68
69
|
/**
|
package/dist/types/components/commerce/atomic-commerce-search-box/atomic-commerce-search-box.d.ts
CHANGED
|
@@ -137,7 +137,6 @@ export declare class AtomicCommerceSearchBox extends LitElement implements Initi
|
|
|
137
137
|
private renderSuggestions;
|
|
138
138
|
private renderPanel;
|
|
139
139
|
private renderSuggestion;
|
|
140
|
-
private renderSlotContent;
|
|
141
140
|
render(): import("lit-html").TemplateResult<1>;
|
|
142
141
|
}
|
|
143
142
|
declare global {
|
|
@@ -2,7 +2,7 @@ import { type Product, type SearchBox } from '@coveo/headless/commerce';
|
|
|
2
2
|
import { LitElement } from 'lit';
|
|
3
3
|
import type { ItemRenderingFunction } from "../../common/item-list/item-list-common";
|
|
4
4
|
import type { ItemDisplayDensity, ItemDisplayImageSize } from "../../common/layout/display-options";
|
|
5
|
-
import type
|
|
5
|
+
import { type SearchBoxSuggestions, type SearchBoxSuggestionsBindings } from "../../common/suggestions/suggestions-common";
|
|
6
6
|
import type { SearchBoxSuggestionsComponent } from "../../../decorators/types";
|
|
7
7
|
import type { CommerceBindings } from '../atomic-commerce-interface/atomic-commerce-interface';
|
|
8
8
|
export type AriaLabelGenerator = (bindings: CommerceBindings, product: Product) => string | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type SearchBox } from '@coveo/headless/commerce';
|
|
2
2
|
import { LitElement } from 'lit';
|
|
3
|
-
import type
|
|
3
|
+
import { type SearchBoxSuggestions, type SearchBoxSuggestionsBindings } from "../../common/suggestions/suggestions-common";
|
|
4
4
|
import type { SearchBoxSuggestionsComponent } from "../../../decorators/types";
|
|
5
5
|
import type { CommerceBindings } from '../atomic-commerce-interface/atomic-commerce-interface';
|
|
6
6
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type SearchBox } from '@coveo/headless/commerce';
|
|
2
2
|
import { LitElement } from 'lit';
|
|
3
3
|
import type { SearchBoxSuggestionsComponent } from "../../../decorators/types";
|
|
4
|
-
import type
|
|
4
|
+
import { type SearchBoxSuggestions, type SearchBoxSuggestionsBindings } from '../../common/suggestions/suggestions-common';
|
|
5
5
|
import type { CommerceBindings } from '../atomic-commerce-interface/atomic-commerce-interface';
|
|
6
6
|
/**
|
|
7
7
|
* The `atomic-commerce-search-box-recent-queries` component can be added as a child of an `atomic-commerce-search-box` component, allowing for the configuration of recent query suggestions.
|
package/dist/types/components/common/atomic-suggestion-renderer/atomic-suggestion-renderer.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i18n } from 'i18next';
|
|
2
|
-
import { SearchBoxSuggestionElement } from '../suggestions/suggestions-
|
|
2
|
+
import { SearchBoxSuggestionElement } from '../suggestions/suggestions-common';
|
|
3
3
|
/**
|
|
4
4
|
* The `atomic-suggestion-renderer` component is used to render individual suggestions. It was created to isolate
|
|
5
5
|
* the rendering logic of the 'content' property of the `SearchBoxSuggestionElement` interface. This property can be Stencil
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { i18n } from 'i18next';
|
|
2
|
-
import type { SearchBoxSuggestionElement } from './suggestions-
|
|
2
|
+
import type { SearchBoxSuggestionElement } from './suggestions-common';
|
|
3
3
|
export declare const getPartialInstantItemElement: (i18n: i18n, itemTitle: string, itemUniqueId: string) => Pick<SearchBoxSuggestionElement, "ariaLabel" | "key" | "part">;
|
|
4
4
|
export declare const getPartialInstantItemShowAllElement: (i18n: i18n) => Pick<SearchBoxSuggestionElement, "key" | "part" | "ariaLabel">;
|
|
5
5
|
interface InstantItemShowAllButtonProps {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { i18n } from 'i18next';
|
|
2
|
-
import type { SearchBoxSuggestionElement } from './suggestions-
|
|
2
|
+
import type { SearchBoxSuggestionElement } from './suggestions-common';
|
|
3
3
|
export declare const getPartialRecentQueryElement: (value: string, i18n: i18n) => Pick<SearchBoxSuggestionElement, "ariaLabel" | "key" | "query" | "part">;
|
|
4
4
|
export declare const getPartialRecentQueryClearElement: (i18n: i18n) => Pick<SearchBoxSuggestionElement, "ariaLabel" | "key" | "part" | "hideIfLast">;
|
|
5
5
|
export interface RecentQueriesContainerProps {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FunctionalComponent } from '../../../stencil-public-runtime';
|
|
2
2
|
import { i18n } from 'i18next';
|
|
3
|
-
import { SearchBoxSuggestionElement } from './suggestions-
|
|
3
|
+
import { SearchBoxSuggestionElement } from './suggestions-common';
|
|
4
4
|
export declare const getPartialInstantItemElement: (i18n: i18n, itemTitle: string, itemUniqueId: string) => Pick<SearchBoxSuggestionElement, "ariaLabel" | "key" | "part">;
|
|
5
5
|
export declare const getPartialInstantItemShowAllElement: (i18n: i18n) => Pick<SearchBoxSuggestionElement, "key" | "part" | "ariaLabel">;
|
|
6
6
|
interface InstantItemShowAllButtonProps {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FunctionalComponent } from '../../../stencil-public-runtime';
|
|
2
2
|
import { i18n } from 'i18next';
|
|
3
|
-
import { SearchBoxSuggestionElement } from './suggestions-
|
|
3
|
+
import { SearchBoxSuggestionElement } from './suggestions-common.js';
|
|
4
4
|
interface Suggestion {
|
|
5
5
|
highlightedValue: string;
|
|
6
6
|
rawValue: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FunctionalComponent } from '../../../stencil-public-runtime';
|
|
2
2
|
import { i18n } from 'i18next';
|
|
3
|
-
import { SearchBoxSuggestionElement } from './suggestions-
|
|
3
|
+
import { SearchBoxSuggestionElement } from './suggestions-common';
|
|
4
4
|
export declare const getPartialRecentQueryElement: (value: string, i18n: i18n) => Pick<SearchBoxSuggestionElement, "ariaLabel" | "key" | "query" | "part">;
|
|
5
5
|
export declare const getPartialRecentQueryClearElement: (i18n: i18n) => Pick<SearchBoxSuggestionElement, "ariaLabel" | "key" | "part" | "hideIfLast">;
|
|
6
6
|
export declare const RecentQueriesContainer: FunctionalComponent;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type SearchBoxSuggestionElement, type SearchBoxSuggestionsBindings, type SearchBoxSuggestionsEvent } from './suggestions-common';
|
|
2
2
|
/**
|
|
3
3
|
* List of suggestions that will be displayed along other lists (e.g recent queries) when the search box's input is selected.
|
|
4
4
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LitElement } from 'lit';
|
|
2
|
-
import type
|
|
2
|
+
import { type SearchBoxSuggestionElement, type SearchBoxSuggestionsBindings, type SearchBoxSuggestionsEvent } from './suggestions-common';
|
|
3
3
|
/**
|
|
4
4
|
* List of suggestions that will be displayed along other lists (e.g recent queries) when the search box's input is selected.
|
|
5
5
|
*/
|
package/dist/types/components/common/suggestions/{suggestions-types.d.ts → suggestions-common.d.ts}
RENAMED
|
@@ -68,6 +68,15 @@ export interface SearchBoxSuggestions {
|
|
|
68
68
|
*/
|
|
69
69
|
onSuggestedQueryChange?(q: string): Promise<unknown>;
|
|
70
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Event sent from the registered query suggestions to the parent search box.
|
|
73
|
+
*/
|
|
74
|
+
export type SearchBoxSuggestionsEvent<SearchBoxController, Bindings = AnyBindings> = (
|
|
75
|
+
/**
|
|
76
|
+
* The bindings passed from the search box to the suggestions.
|
|
77
|
+
*/
|
|
78
|
+
bindings: SearchBoxSuggestionsBindings<SearchBoxController, Bindings>) => SearchBoxSuggestions;
|
|
79
|
+
declare const searchBoxElements: readonly ["atomic-search-box", "atomic-insight-search-box", "atomic-commerce-search-box"];
|
|
71
80
|
/**
|
|
72
81
|
* The bindings passed from the search box to the suggestions.
|
|
73
82
|
*/
|
|
@@ -115,10 +124,11 @@ export type SearchBoxSuggestionsBindings<SearchBoxController, Bindings = AnyBind
|
|
|
115
124
|
getSuggestionElements(): SearchBoxSuggestionElement[];
|
|
116
125
|
};
|
|
117
126
|
/**
|
|
118
|
-
*
|
|
127
|
+
* Dispatches an event which retrieves the `SearchBoxSuggestionsBindings` on a configured parent search box.
|
|
128
|
+
* @param event Event sent from the registered query suggestions to the parent search box.
|
|
129
|
+
* @param element Element on which to dispatch the event, which must be the child of a configured search box.
|
|
119
130
|
*/
|
|
120
|
-
export
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
bindings: SearchBoxSuggestionsBindings<SearchBoxController, Bindings>) => SearchBoxSuggestions;
|
|
131
|
+
export declare const dispatchSearchBoxSuggestionsEvent: <SearchBoxController, Bindings = AnyBindings>(event: SearchBoxSuggestionsEvent<SearchBoxController, Bindings>, element: HTMLElement, allowedSearchBoxElements?: readonly (typeof searchBoxElements)[number][]) => void;
|
|
132
|
+
export declare function elementHasNoQuery(el: SearchBoxSuggestionElement): boolean;
|
|
133
|
+
export declare function elementHasQuery(el: SearchBoxSuggestionElement): boolean;
|
|
134
|
+
export {};
|
|
@@ -2,7 +2,7 @@ import { SearchBox, StandaloneSearchBox } from '@coveo/headless';
|
|
|
2
2
|
import { EventEmitter } from '../../../stencil-public-runtime';
|
|
3
3
|
import { InitializableComponent } from '../../../utils/initialization-utils';
|
|
4
4
|
import { RedirectionPayload } from '../../common/search-box/redirection-payload';
|
|
5
|
-
import
|
|
5
|
+
import { SearchBoxSuggestionsEvent } from '../../common/suggestions/suggestions-common';
|
|
6
6
|
import { Bindings } from '../atomic-search-interface/atomic-search-interface';
|
|
7
7
|
/**
|
|
8
8
|
* The `atomic-search-box` component creates a search box with built-in support for suggestions.
|
|
@@ -161,6 +161,5 @@ export declare class AtomicSearchBox implements InitializableComponent<Bindings>
|
|
|
161
161
|
private getSearchInputLabel;
|
|
162
162
|
private announceNewActiveSuggestionToScreenReader;
|
|
163
163
|
private announceNewSuggestionsToScreenReader;
|
|
164
|
-
private renderSlotContent;
|
|
165
164
|
render(): any;
|
|
166
165
|
}
|
|
@@ -23,6 +23,7 @@ export declare class AtomicSearchInterface extends AtomicSearchInterface_base im
|
|
|
23
23
|
private unsubscribeSearchStatus;
|
|
24
24
|
private initialized;
|
|
25
25
|
private store;
|
|
26
|
+
private _mobileBreakpointController;
|
|
26
27
|
private interfaceController;
|
|
27
28
|
static styles: CSSResultGroup;
|
|
28
29
|
/**
|
|
@@ -79,7 +80,7 @@ export declare class AtomicSearchInterface extends AtomicSearchInterface_base im
|
|
|
79
80
|
*/
|
|
80
81
|
reflectStateInUrl: boolean;
|
|
81
82
|
/**
|
|
82
|
-
*
|
|
83
|
+
* Disable state reflection in the URL parameters.
|
|
83
84
|
*/
|
|
84
85
|
disableStateReflectionInUrl: boolean;
|
|
85
86
|
/**
|
|
@@ -110,7 +111,7 @@ export declare class AtomicSearchInterface extends AtomicSearchInterface_base im
|
|
|
110
111
|
*/
|
|
111
112
|
enableRelevanceInspector: boolean;
|
|
112
113
|
/**
|
|
113
|
-
*
|
|
114
|
+
* Disable the relevance inspector shortcut for this interface.
|
|
114
115
|
*/
|
|
115
116
|
disableRelevanceInspector: boolean;
|
|
116
117
|
private i18Initialized;
|
|
@@ -126,7 +127,7 @@ export declare class AtomicSearchInterface extends AtomicSearchInterface_base im
|
|
|
126
127
|
*/
|
|
127
128
|
initialize(options: InitializationOptions): Promise<void>;
|
|
128
129
|
/**
|
|
129
|
-
* Initializes the
|
|
130
|
+
* Initializes the connection with an already preconfigured [headless search engine](https://docs.coveo.com/en/headless/latest/reference/modules/Search.html, as opposed to the `initialize` method, which will internally create a new search engine instance.
|
|
130
131
|
* This bypasses the properties set on the component, such as analytics, searchHub, pipeline, language, timezone & logLevel.
|
|
131
132
|
*/
|
|
132
133
|
initializeWithSearchEngine(engine: SearchEngine): Promise<void>;
|
|
@@ -148,7 +149,6 @@ export declare class AtomicSearchInterface extends AtomicSearchInterface_base im
|
|
|
148
149
|
private getSearchConfiguration;
|
|
149
150
|
private get fragment();
|
|
150
151
|
private initUrlManager;
|
|
151
|
-
private handleRelevanceInspectorDoubleClick;
|
|
152
152
|
private initRelevanceInspector;
|
|
153
153
|
private initSearchStatus;
|
|
154
154
|
private updateHash;
|
|
@@ -2,7 +2,7 @@ import { Result, SearchBox } from '@coveo/headless';
|
|
|
2
2
|
import { InitializableComponent } from '../../../../utils/initialization-utils';
|
|
3
3
|
import { ItemRenderingFunction } from '../../../common/item-list/stencil-item-list-common';
|
|
4
4
|
import { ItemDisplayDensity, ItemDisplayImageSize } from '../../../common/layout/display-options';
|
|
5
|
-
import
|
|
5
|
+
import { SearchBoxSuggestions, SearchBoxSuggestionsBindings } from '../../../common/suggestions/suggestions-common';
|
|
6
6
|
import { Bindings } from '../../atomic-search-interface/atomic-search-interface';
|
|
7
7
|
export type AriaLabelGenerator = (bindings: Bindings, result: Result) => string | undefined;
|
|
8
8
|
/**
|
|
@@ -24,7 +24,7 @@ import { Bindings } from "./components/search/atomic-search-interface/atomic-sea
|
|
|
24
24
|
import { SearchStore } from "./components/search/atomic-search-interface/store";
|
|
25
25
|
import { RedirectionPayload } from "./components/common/search-box/redirection-payload";
|
|
26
26
|
import { AriaLabelGenerator } from "./components/search/search-box-suggestions/atomic-search-box-instant-results/atomic-search-box-instant-results";
|
|
27
|
-
import { SearchBoxSuggestionElement } from "./components/common/suggestions/suggestions-
|
|
27
|
+
import { SearchBoxSuggestionElement } from "./components/common/suggestions/suggestions-common";
|
|
28
28
|
export { AutomaticFacet, CategoryFacetSortCriterion, DateFilterRange, DateRangeRequest, FacetResultsMustMatch, FacetSortCriterion, FoldedResult, GeneratedAnswer, GeneratedAnswerCitation, InlineLink, InteractiveCitation, InteractiveResult, NumericFilter, NumericFilterState, RangeFacetRangeAlgorithm, RangeFacetSortCriterion, RelativeDateUnit, Result, ResultTemplate, ResultTemplateCondition, SearchStatus } from "@coveo/headless";
|
|
29
29
|
export { AtomicInterface } from "./utils/initialization-utils";
|
|
30
30
|
export { AnyBindings } from "./components/common/interface/bindings";
|
|
@@ -44,7 +44,7 @@ export { Bindings } from "./components/search/atomic-search-interface/atomic-sea
|
|
|
44
44
|
export { SearchStore } from "./components/search/atomic-search-interface/store";
|
|
45
45
|
export { RedirectionPayload } from "./components/common/search-box/redirection-payload";
|
|
46
46
|
export { AriaLabelGenerator } from "./components/search/search-box-suggestions/atomic-search-box-instant-results/atomic-search-box-instant-results";
|
|
47
|
-
export { SearchBoxSuggestionElement } from "./components/common/suggestions/suggestions-
|
|
47
|
+
export { SearchBoxSuggestionElement } from "./components/common/suggestions/suggestions-common";
|
|
48
48
|
export namespace Components {
|
|
49
49
|
/**
|
|
50
50
|
* An automatic facet is a special type of facet generated by the automatic facets feature.
|
|
@@ -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-common';
|
|
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,9 +5,7 @@ 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 } from './components/common/suggestions/suggestions-
|
|
9
|
-
export type { SearchBoxSuggestionElement, SearchBoxSuggestions, SearchBoxSuggestionsBindings, SearchBoxSuggestionsEvent, } from './components/common/suggestions/suggestions-types';
|
|
10
|
-
export { elementHasNoQuery, elementHasQuery, } from './components/common/suggestions/suggestions-utils';
|
|
8
|
+
export { dispatchSearchBoxSuggestionsEvent, SearchBoxSuggestionElement, SearchBoxSuggestions, SearchBoxSuggestionsBindings, SearchBoxSuggestionsEvent, } from './components/common/suggestions/suggestions-common';
|
|
11
9
|
export { RecsBindings } from './components/recommendations/atomic-recs-interface/atomic-recs-interface';
|
|
12
10
|
export { Bindings } from './components/search/atomic-search-interface/atomic-search-interface';
|
|
13
11
|
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-24T16:57:49",
|
|
3
3
|
"compiler": {
|
|
4
4
|
"name": "@stencil/core",
|
|
5
5
|
"version": "4.20.0",
|
|
@@ -15526,10 +15526,10 @@
|
|
|
15526
15526
|
"docstring": "",
|
|
15527
15527
|
"path": "src/components/common/layout/display-options.ts"
|
|
15528
15528
|
},
|
|
15529
|
-
"src/components/common/suggestions/suggestions-
|
|
15529
|
+
"src/components/common/suggestions/suggestions-common.ts::SearchBoxSuggestionElement": {
|
|
15530
15530
|
"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}",
|
|
15531
15531
|
"docstring": "Element which will be rendered in the list of suggestions.",
|
|
15532
|
-
"path": "src/components/common/suggestions/suggestions-
|
|
15532
|
+
"path": "src/components/common/suggestions/suggestions-common.ts"
|
|
15533
15533
|
},
|
|
15534
15534
|
"../headless/dist/definitions/index.d.ts::RelativeDateUnit": {
|
|
15535
15535
|
"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.40f23746c4",
|
|
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.0",
|
|
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.0",
|
|
157
157
|
"typescript": ">=5.0.0"
|
|
158
158
|
},
|
|
159
159
|
"peerDependenciesMeta": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks if a search box suggestion element has no query.
|
|
3
|
-
*
|
|
4
|
-
* @param el - The search box suggestion element to check
|
|
5
|
-
* @returns True if the element has no query or the query is whitespace-only
|
|
6
|
-
*/
|
|
7
|
-
export function elementHasNoQuery(el) {
|
|
8
|
-
return !el.query || el.query.trim() === '';
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Checks if a search box suggestion element has a query.
|
|
12
|
-
*
|
|
13
|
-
* @param el - The search box suggestion element to check
|
|
14
|
-
* @returns True if the element has a non-empty, non-whitespace query
|
|
15
|
-
*/
|
|
16
|
-
export function elementHasQuery(el) {
|
|
17
|
-
return !!el.query && el.query.trim() !== '';
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"suggestions-events.js","mappings":";;;AAOA;;;;;;;;;MASa,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;AAEF,MAAM,iBAAiB,GAAG;IACxB,mBAAmB;IACnB,2BAA2B;IAC3B,4BAA4B;CACpB,CAAC;AAEX,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;;;;","names":[],"sources":["src/components/common/suggestions/suggestions-events.ts"],"sourcesContent":["import 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';\nimport type {SearchBoxSuggestionsEvent} from './suggestions-types';\n\n/**\n * Dispatches an event which retrieves the `SearchBoxSuggestionsBindings` on a configured parent search box.\n *\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 * @param allowedSearchBoxElements Optional array of allowed search box element selectors\n *\n * @throws Error if the element is not a child of an allowed search box element\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\nconst searchBoxElements = [\n 'atomic-search-box',\n 'atomic-insight-search-box',\n 'atomic-commerce-search-box',\n] as const;\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"],"version":3}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["AtomicSuggestionRenderer","parts","part","this","isSelected","suggestion","query","classes","content","isHTMLElement","h","Fragment","ariaLabel","isButton","contentLabel","i18n","t","labelWithType","isMacOS","label","interpolation","escapeValue","position","index","count","lastIndex","isDoubleList","side","ensureContentForRenderedSuggestion","element","replaceChildren","el","HTMLElement","render","onSelect","Host","key","class","id","onMouseDown","e","preventDefault","onClick","onMouseOver","ref"],"sources":["src/components/common/atomic-suggestion-renderer/atomic-suggestion-renderer.tsx"],"sourcesContent":["import {isMacOS} from '@/src/utils/device-utils';\nimport {Component, Fragment, Host, Prop, VNode, h} from '@stencil/core';\nimport {i18n} from 'i18next';\nimport {SearchBoxSuggestionElement} from '../suggestions/suggestions-types';\n\n/**\n * The `atomic-suggestion-renderer` component is used to render individual suggestions. It was created to isolate\n * the rendering logic of the 'content' property of the `SearchBoxSuggestionElement` interface. This property can be Stencil\n * VNode or native Element so there must be a Stencil component to render it. For Lit components using this component, they will\n * use native Elements.\n *\n * @internal\n */\n@Component({\n tag: 'atomic-suggestion-renderer',\n shadow: false,\n})\nexport class AtomicSuggestionRenderer {\n @Prop() public i18n!: i18n;\n @Prop() public id!: string;\n @Prop() public suggestion!: SearchBoxSuggestionElement;\n @Prop() public isSelected!: boolean;\n @Prop() public side!: 'left' | 'right';\n @Prop() public index!: number;\n @Prop() public lastIndex!: number;\n @Prop() public isDoubleList!: boolean;\n @Prop() public onClick?: (e: Event) => void;\n @Prop() public onMouseOver?: (e: Event) => void;\n\n private get parts() {\n let part = 'suggestion';\n if (this.isSelected) {\n part += ' active-suggestion';\n }\n if (this.suggestion.query) {\n part += ' suggestion-with-query';\n }\n if (this.suggestion.part) {\n part += ` ${this.suggestion.part}`;\n }\n return part;\n }\n\n private get classes() {\n return `flex px-4 min-h-10 items-center text-left text-neutral-dark cursor-pointer ${\n this.isSelected ? 'bg-neutral-light' : ''\n }`;\n }\n\n private get content() {\n return this.isHTMLElement(this.suggestion.content) ? (\n <Fragment></Fragment>\n ) : (\n this.suggestion.content\n );\n }\n\n private ariaLabel(isButton: boolean) {\n const contentLabel =\n this.suggestion.ariaLabel ??\n this.suggestion.query ??\n this.i18n.t('no-title');\n\n const labelWithType =\n isMacOS() && isButton\n ? this.i18n.t('search-suggestion-button', {\n label: contentLabel,\n interpolation: {escapeValue: false},\n })\n : contentLabel;\n\n const position = this.index + 1;\n const count = this.lastIndex + 1;\n\n if (!this.isDoubleList) {\n return this.i18n.t('search-suggestion-single-list', {\n label: labelWithType,\n position,\n count,\n interpolation: {escapeValue: false},\n });\n }\n\n return this.i18n.t('search-suggestion-double-list', {\n label: labelWithType,\n position,\n count,\n side: this.i18n.t(this.side === 'left' ? 'left' : 'right'),\n interpolation: {escapeValue: false},\n });\n }\n\n private ensureContentForRenderedSuggestion(element: HTMLElement) {\n if (this.isHTMLElement(this.suggestion.content)) {\n element.replaceChildren(this.suggestion.content);\n }\n }\n\n private isHTMLElement(el: VNode | Element): el is HTMLElement {\n return el instanceof HTMLElement;\n }\n\n render() {\n const isButton = !!(this.suggestion.onSelect || this.suggestion.query);\n\n return (\n <Host class=\"contents\">\n {isButton ? (\n <button\n id={this.id}\n key={this.suggestion.key}\n part={this.parts}\n class={this.classes}\n onMouseDown={(e) => e.preventDefault()}\n onClick={(e: Event) => this.onClick?.(e)}\n onMouseOver={(e: Event) => this.onMouseOver?.(e)}\n data-query={this.suggestion.query}\n aria-label={this.ariaLabel(isButton)}\n ref={(el) => {\n if (!el) {\n return;\n }\n this.ensureContentForRenderedSuggestion(el);\n }}\n >\n {this.content}\n </button>\n ) : (\n <span\n id={this.id}\n key={this.suggestion.key}\n part={this.parts}\n class={this.classes}\n aria-label={this.ariaLabel(isButton)}\n ref={(el) => {\n if (!el) {\n return;\n }\n this.ensureContentForRenderedSuggestion(el);\n }}\n >\n {this.content}\n </span>\n )}\n </Host>\n );\n }\n}\n"],"mappings":"mGAiBaA,EAAwB,M,mQAYnC,SAAYC,GACV,IAAIC,EAAO,aACX,GAAIC,KAAKC,WAAY,CACnBF,GAAQ,oB,CAEV,GAAIC,KAAKE,WAAWC,MAAO,CACzBJ,GAAQ,wB,CAEV,GAAIC,KAAKE,WAAWH,KAAM,CACxBA,GAAQ,IAAIC,KAAKE,WAAWH,M,CAE9B,OAAOA,C,CAGT,WAAYK,GACV,MAAO,8EACLJ,KAAKC,WAAa,mBAAqB,I,CAI3C,WAAYI,GACV,OAAOL,KAAKM,cAAcN,KAAKE,WAAWG,SACxCE,EAACC,EAAQ,MAETR,KAAKE,WAAkB,O,CAInB,SAAAO,CAAUC,GAChB,MAAMC,EACJX,KAAKE,WAAWO,WAChBT,KAAKE,WAAWC,OAChBH,KAAKY,KAAKC,EAAE,YAEd,MAAMC,EACJC,KAAaL,EACTV,KAAKY,KAAKC,EAAE,2BAA4B,CACtCG,MAAOL,EACPM,cAAe,CAACC,YAAa,SAE/BP,EAEN,MAAMQ,EAAWnB,KAAKoB,MAAQ,EAC9B,MAAMC,EAAQrB,KAAKsB,UAAY,EAE/B,IAAKtB,KAAKuB,aAAc,CACtB,OAAOvB,KAAKY,KAAKC,EAAE,gCAAiC,CAClDG,MAAOF,EACPK,WACAE,QACAJ,cAAe,CAACC,YAAa,Q,CAIjC,OAAOlB,KAAKY,KAAKC,EAAE,gCAAiC,CAClDG,MAAOF,EACPK,WACAE,QACAG,KAAMxB,KAAKY,KAAKC,EAAEb,KAAKwB,OAAS,OAAS,OAAS,SAClDP,cAAe,CAACC,YAAa,Q,CAIzB,kCAAAO,CAAmCC,GACzC,GAAI1B,KAAKM,cAAcN,KAAKE,WAAWG,SAAU,CAC/CqB,EAAQC,gBAAgB3B,KAAKE,WAAWG,Q,EAIpC,aAAAC,CAAcsB,GACpB,OAAOA,aAAcC,W,CAGvB,MAAAC,GACE,MAAMpB,KAAcV,KAAKE,WAAW6B,UAAY/B,KAAKE,WAAWC,OAEhE,OACEI,EAACyB,EAAI,CAAAC,IAAA,2CAACC,MAAM,YACTxB,EACCH,EAAA,UACE4B,GAAInC,KAAKmC,GACTF,IAAKjC,KAAKE,WAAW+B,IACrBlC,KAAMC,KAAKF,MACXoC,MAAOlC,KAAKI,QACZgC,YAAcC,GAAMA,EAAEC,iBACtBC,QAAUF,GAAarC,KAAKuC,UAAUF,GACtCG,YAAcH,GAAarC,KAAKwC,cAAcH,GAAE,aACpCrC,KAAKE,WAAWC,MAAK,aACrBH,KAAKS,UAAUC,GAC3B+B,IAAMb,IACJ,IAAKA,EAAI,CACP,M,CAEF5B,KAAKyB,mCAAmCG,EAAG,GAG5C5B,KAAKK,SAGRE,EAAA,QACE4B,GAAInC,KAAKmC,GACTF,IAAKjC,KAAKE,WAAW+B,IACrBlC,KAAMC,KAAKF,MACXoC,MAAOlC,KAAKI,QAAO,aACPJ,KAAKS,UAAUC,GAC3B+B,IAAMb,IACJ,IAAKA,EAAI,CACP,M,CAEF5B,KAAKyB,mCAAmCG,EAAG,GAG5C5B,KAAKK,S","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["elementHasNoQuery","el","query","trim","elementHasQuery"],"sources":["src/components/common/suggestions/suggestions-utils.ts"],"sourcesContent":["import type {SearchBoxSuggestionElement} from './suggestions-types';\n\n/**\n * Checks if a search box suggestion element has no query.\n *\n * @param el - The search box suggestion element to check\n * @returns True if the element has no query or the query is whitespace-only\n */\nexport function elementHasNoQuery(el: SearchBoxSuggestionElement): boolean {\n return !el.query || el.query.trim() === '';\n}\n\n/**\n * Checks if a search box suggestion element has a query.\n *\n * @param el - The search box suggestion element to check\n * @returns True if the element has a non-empty, non-whitespace query\n */\nexport function elementHasQuery(el: SearchBoxSuggestionElement): boolean {\n return !!el.query && el.query.trim() !== '';\n}\n"],"mappings":"SAQgBA,EAAkBC,GAChC,OAAQA,EAAGC,OAASD,EAAGC,MAAMC,SAAW,EAC1C,C,SAQgBC,EAAgBH,GAC9B,QAASA,EAAGC,OAASD,EAAGC,MAAMC,SAAW,EAC3C,Q","ignoreList":[]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{h as t,f as s}from"./p-dc3df5ce.js";import{B as i}from"./p-b93ccff9.js";import{isNullOrUndefined as e}from"@coveo/bueno";import{D as n}from"./p-f284897c.js";import{d as r}from"./p-01c91b69.js";import{a as o,e as a}from"./p-0a051b8d.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,i)=>{const e=()=>{const t="flex bg-background w-full border border-neutral rounded-md focus-within:ring-3 absolute top-0 left-0";const i=s.disabled?"focus-within:border-disabled focus-within:ring-neutral":"focus-within:border-primary focus-within:ring-ring-primary";return[t,i].join(" ")};return t("div",{part:"wrapper",class:e(),onFocusout:s.onFocusout},i)};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:e,onClick:n,...r})=>t("div",{part:"clear-button-wrapper",class:"ml-2 flex items-center justify-center py-2"},t(i,{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:e.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 i=t?.parentNode;if(!i){return}if(t.value==="\n"){return}i.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:i,bindings:e,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:e.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 i=t.target;f(s??i);m(s??i)},autocomplete:"off",...v&&g(v),...y,value:c})),i&&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"})),!i&&c&&t(l,{inputRef:s,bindings:e,onClick:()=>{b();d(s)}}));function b(t,s){let i;const e=new Promise(((t,e)=>{i=setTimeout((()=>{e(new Error("Promise timed out."))}),s)}));return Promise.race([t,e]).then((()=>{clearTimeout(i)}))}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(e(this.panelInFocus)||e(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 i=t?this.previousActiveDescendantElement:s.firstElementChild;this.updateDescendants(i.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,i){const e=s==="left"?this.leftPanel:this.rightPanel;this.updateKeyboardActiveDescendant();if(this.panelInFocus===e){this.updateActiveDescendant(i)}else{this.updateDescendants(i)}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,i)=>{if(t.status==="fulfilled"){s.push(this.suggestions[i])}else{this.ownerSearchBoxProps.getLogger().warn("Some query suggestions are not being shown because the promise timed out.")}}));const i=(t,i=false)=>s.filter((s=>s.panel===t||!s.panel&&i)).sort(this.sortSuggestions);this.leftSuggestions=i("left",true);this.leftSuggestionElements=this.getAndFilterLeftSuggestionElements();this.rightSuggestions=i("right");this.rightSuggestionElements=this.getSuggestionElements(this.rightSuggestions);const e=this.allSuggestionElements.find(o)?.query||"";await this.updateSuggestedQuery(e)}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 i=n.sanitize(s);return!!t?.querySelector(`[${this.queryDataAttribute}="${CSS.escape(i)}"]`)}return this.activeDescendantElement?.closest("ul")===t}getAndFilterLeftSuggestionElements(){const t=this.getSuggestionElements(this.leftSuggestions);const s=new Set;const i=t.filter((t=>{if(e(t.query)){return true}if(s.has(t.query)){return false}else{s.add(t.query);return true}}));return i}getSuggestionElements(t){const s=t.flatMap((t=>t.renderItems()));const i=this.ownerSearchBoxProps.getNumberOfSuggestionsToDisplay()+s.filter(a).length;return s.slice(0,i)}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-16f4ce98.js.map
|