@coveo/atomic 3.64.1 → 3.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +236 -102
- package/dist/cjs/components/commerce/atomic-commerce-search-box/atomic-commerce-search-box.cjs +108 -13
- package/dist/cjs/components/commerce/product-list/product-template-provider.cjs +2 -0
- package/dist/cjs/components/common/atomic-modal/atomic-modal.cjs +8 -1
- package/dist/cjs/components/common/atomic-tab-popover/atomic-tab-popover.cjs +1 -0
- package/dist/cjs/components/common/facets/timeframe-facet-common.cjs +2 -2
- package/dist/cjs/components/common/generated-answer/generated-content/markdown-utils.cjs +1 -0
- package/dist/cjs/components/common/item-list/result-template-provider.cjs +1 -0
- package/dist/cjs/components/common/result-templates/result-template-controller.cjs +1 -0
- package/dist/cjs/components/common/suggestions/suggestion-manager.cjs +3 -0
- package/dist/cjs/components/insight/atomic-insight-facet/atomic-insight-facet.cjs +2 -2
- package/dist/cjs/components/insight/atomic-insight-result-attach-to-case-indicator/atomic-insight-result-attach-to-case-indicator.cjs +1 -0
- package/dist/cjs/components/insight/atomic-insight-user-actions-session/atomic-insight-user-actions-session.cjs +1 -0
- package/dist/cjs/components/insight/atomic-insight-user-actions-session/user-action.cjs +1 -0
- package/dist/cjs/components/search/atomic-rating-range-facet/atomic-rating-range-facet.cjs +3 -4
- package/dist/cjs/components/search/atomic-search-box/atomic-search-box.cjs +107 -13
- package/dist/cjs/components/search/atomic-search-box-instant-results/atomic-search-box-instant-results.cjs +1 -0
- package/dist/cjs/global/environment.cjs +1 -1
- package/dist/cjs/utils/tailwind.global.tw.css.cjs +1 -1
- package/dist/cjs/versions.cjs +1 -1
- package/dist/esm/components/commerce/atomic-commerce-search-box/atomic-commerce-search-box.js +109 -14
- package/dist/esm/components/commerce/product-list/product-template-provider.js +2 -0
- package/dist/esm/components/common/atomic-modal/atomic-modal.js +9 -2
- package/dist/esm/components/common/atomic-tab-popover/atomic-tab-popover.js +1 -0
- package/dist/esm/components/common/facets/timeframe-facet-common.js +2 -2
- package/dist/esm/components/common/generated-answer/generated-content/markdown-utils.js +1 -0
- package/dist/esm/components/common/item-list/result-template-provider.js +1 -0
- package/dist/esm/components/common/result-templates/result-template-controller.js +1 -0
- package/dist/esm/components/common/suggestions/suggestion-manager.js +3 -0
- package/dist/esm/components/insight/atomic-insight-facet/atomic-insight-facet.js +2 -2
- package/dist/esm/components/insight/atomic-insight-result-attach-to-case-indicator/atomic-insight-result-attach-to-case-indicator.js +1 -0
- package/dist/esm/components/insight/atomic-insight-user-actions-session/atomic-insight-user-actions-session.js +1 -0
- package/dist/esm/components/insight/atomic-insight-user-actions-session/user-action.js +1 -0
- package/dist/esm/components/search/atomic-rating-range-facet/atomic-rating-range-facet.js +3 -4
- package/dist/esm/components/search/atomic-search-box/atomic-search-box.js +109 -15
- package/dist/esm/components/search/atomic-search-box-instant-results/atomic-search-box-instant-results.js +1 -0
- package/dist/esm/global/environment.js +1 -1
- package/dist/esm/utils/tailwind.global.tw.css.js +1 -1
- package/dist/esm/versions.js +1 -1
- package/dist/types/components/commerce/atomic-commerce-search-box/atomic-commerce-search-box.d.ts +23 -6
- package/dist/types/components/commerce/product-list/product-template-provider.d.ts +2 -0
- package/dist/types/components/common/atomic-modal/atomic-modal.d.ts +6 -0
- package/dist/types/components/common/atomic-tab-popover/atomic-tab-popover.d.ts +1 -0
- package/dist/types/components/common/generated-answer/generated-content/markdown-utils.d.ts +1 -0
- package/dist/types/components/common/item-list/result-template-provider.d.ts +1 -0
- package/dist/types/components/common/layout/item-layout-sections.d.ts +1 -1
- package/dist/types/components/common/result-templates/result-template-controller.d.ts +1 -0
- package/dist/types/components/insight/atomic-insight-result-attach-to-case-indicator/atomic-insight-result-attach-to-case-indicator.d.ts +1 -0
- package/dist/types/components/insight/atomic-insight-user-actions-session/atomic-insight-user-actions-session.d.ts +1 -0
- package/dist/types/components/insight/atomic-insight-user-actions-session/user-action.d.ts +1 -0
- package/dist/types/components/search/atomic-search-box/atomic-search-box.d.ts +23 -6
- package/dist/types/components/search/atomic-search-box-instant-results/atomic-search-box-instant-results.d.ts +1 -0
- package/package.json +26 -25
|
@@ -44,6 +44,7 @@ const bindings_mixin_cjs_namespaceObject = require("../../../mixins/bindings-mix
|
|
|
44
44
|
const event_utils_cjs_namespaceObject = require("../../../utils/event-utils.cjs");
|
|
45
45
|
const replace_breakpoint_utils_cjs_namespaceObject = require("../../../utils/replace-breakpoint-utils.cjs");
|
|
46
46
|
const utils_cjs_namespaceObject = require("../../../utils/utils.cjs");
|
|
47
|
+
require("../atomic-focus-trap/atomic-focus-trap.cjs");
|
|
47
48
|
function _ts_decorate(decorators, target, key, desc) {
|
|
48
49
|
var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
49
50
|
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -84,7 +85,7 @@ class AtomicModal extends (0, bindings_mixin_cjs_namespaceObject.InitializeBindi
|
|
|
84
85
|
role="dialog"
|
|
85
86
|
aria-modal=${this.isOpen ? 'true' : 'false'}
|
|
86
87
|
aria-labelledby=${this.headerId}
|
|
87
|
-
.source=${this.source}
|
|
88
|
+
.source=${this.source ?? this.focusedElementBeforeOpen}
|
|
88
89
|
.container=${this.container ?? this}
|
|
89
90
|
${(0, ref_js_namespaceObject.ref)(this.focusTrap)}
|
|
90
91
|
.scope=${this.scope ?? this.bindings?.interfaceElement ?? document.body}
|
|
@@ -128,6 +129,8 @@ class AtomicModal extends (0, bindings_mixin_cjs_namespaceObject.InitializeBindi
|
|
|
128
129
|
}
|
|
129
130
|
async handleModalOpen() {
|
|
130
131
|
const executionId = this.createExecutionTracker();
|
|
132
|
+
const focusedElement = (0, utils_cjs_namespaceObject.getFocusedElement)();
|
|
133
|
+
this.focusedElementBeforeOpen = focusedElement instanceof HTMLElement && !(0, utils_cjs_namespaceObject.isAncestorOf)(this, focusedElement) ? focusedElement : void 0;
|
|
131
134
|
if (!this.shouldRender) {
|
|
132
135
|
this.shouldRender = true;
|
|
133
136
|
await this.updateComplete;
|
|
@@ -345,6 +348,10 @@ _ts_decorate([
|
|
|
345
348
|
}),
|
|
346
349
|
_ts_metadata("design:type", "u" < typeof HTMLElement ? Object : HTMLElement)
|
|
347
350
|
], AtomicModal.prototype, "source", void 0);
|
|
351
|
+
_ts_decorate([
|
|
352
|
+
(0, decorators_js_namespaceObject.state)(),
|
|
353
|
+
_ts_metadata("design:type", "u" < typeof HTMLElement ? Object : HTMLElement)
|
|
354
|
+
], AtomicModal.prototype, "focusedElementBeforeOpen", void 0);
|
|
348
355
|
_ts_decorate([
|
|
349
356
|
(0, error_guard_cjs_namespaceObject.errorGuard)(),
|
|
350
357
|
_ts_metadata("design:type", Function),
|
|
@@ -51,6 +51,7 @@ const error_guard_cjs_namespaceObject = require("../../../decorators/error-guard
|
|
|
51
51
|
const with_tailwind_styles_cjs_namespaceObject = require("../../../decorators/with-tailwind-styles.cjs");
|
|
52
52
|
const arrow_bottom_rounded_cjs_namespaceObject = require("../../../images/arrow-bottom-rounded.cjs");
|
|
53
53
|
var arrow_bottom_rounded_cjs_default = /*#__PURE__*/ __webpack_require__.n(arrow_bottom_rounded_cjs_namespaceObject);
|
|
54
|
+
require("../atomic-icon/atomic-icon.cjs");
|
|
54
55
|
function _ts_decorate(decorators, target, key, desc) {
|
|
55
56
|
var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
56
57
|
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -188,8 +188,8 @@ class TimeframeFacetCommon {
|
|
|
188
188
|
label: this.props.label
|
|
189
189
|
}
|
|
190
190
|
})((0, external_lit_namespaceObject.html)`<ul class="mt-3" part="values">
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
${children}
|
|
192
|
+
</ul>`);
|
|
193
193
|
}
|
|
194
194
|
renderHeader(isCollapsed, headerFocus, onToggleCollapse) {
|
|
195
195
|
return (0, facet_header_cjs_namespaceObject.renderFacetHeader)({
|
|
@@ -33,6 +33,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
33
33
|
});
|
|
34
34
|
const external_marked_namespaceObject = require("marked");
|
|
35
35
|
const utils_cjs_namespaceObject = require("../../../../utils/utils.cjs");
|
|
36
|
+
require("../../atomic-generated-answer-inline-link/atomic-generated-answer-inline-link.cjs");
|
|
36
37
|
const toInlinePlainText = (textWithHtml)=>{
|
|
37
38
|
const withoutHtmlTags = textWithHtml.replace(/<[^>]*>/g, ' ');
|
|
38
39
|
const withCollapsedWhitespaces = withoutHtmlTags.replace(/\s{2,}/g, ' ');
|
|
@@ -32,6 +32,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
32
32
|
});
|
|
33
33
|
const headless_namespaceObject = require("@coveo/headless");
|
|
34
34
|
const template_provider_cjs_namespaceObject = require("../template-provider/template-provider.cjs");
|
|
35
|
+
require("../../search/atomic-result-link/atomic-result-link.cjs");
|
|
35
36
|
class ResultTemplateProvider extends template_provider_cjs_namespaceObject.TemplateProvider {
|
|
36
37
|
makeDefaultTemplate() {
|
|
37
38
|
const content = document.createDocumentFragment();
|
|
@@ -31,6 +31,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
31
31
|
ResultTemplateController: ()=>ResultTemplateController
|
|
32
32
|
});
|
|
33
33
|
const base_template_controller_cjs_namespaceObject = require("../template-controller/base-template-controller.cjs");
|
|
34
|
+
require("../../search/atomic-result-link/atomic-result-link.cjs");
|
|
34
35
|
class ResultTemplateController extends base_template_controller_cjs_namespaceObject.BaseTemplateController {
|
|
35
36
|
getTemplate(conditions) {
|
|
36
37
|
const baseTemplate = this.getBaseTemplate(conditions);
|
|
@@ -100,11 +100,13 @@ class SuggestionManager {
|
|
|
100
100
|
const panelHasActiveDescendant = this.previousActiveDescendantElement && panel.contains(this.previousActiveDescendantElement);
|
|
101
101
|
const newValue = panelHasActiveDescendant ? this.previousActiveDescendantElement : panel.firstElementChild;
|
|
102
102
|
this.updateDescendants(newValue.id);
|
|
103
|
+
this.updateKeyboardActiveDescendant(newValue.id);
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
106
|
clearSuggestions() {
|
|
106
107
|
this.clearSuggestionElements();
|
|
107
108
|
this.updateActiveDescendant();
|
|
109
|
+
this.updateKeyboardActiveDescendant();
|
|
108
110
|
}
|
|
109
111
|
async focusNextValue() {
|
|
110
112
|
if (!this.hasSuggestions || !this.nextOrFirstValue) return;
|
|
@@ -153,6 +155,7 @@ class SuggestionManager {
|
|
|
153
155
|
}
|
|
154
156
|
async executeQuerySuggestion() {
|
|
155
157
|
this.updateActiveDescendant();
|
|
158
|
+
this.updateKeyboardActiveDescendant();
|
|
156
159
|
const settled = await Promise.allSettled(this.suggestions.map((suggestion)=>(0, promise_utils_cjs_namespaceObject.promiseTimeout)(suggestion.onInput ? suggestion.onInput() : Promise.resolve(), this.ownerSearchBoxProps.getSuggestionTimeout())));
|
|
157
160
|
const fulfilledSuggestions = [];
|
|
158
161
|
settled.forEach((prom, j)=>{
|
|
@@ -155,8 +155,8 @@ class AtomicInsightFacet extends external_lit_namespaceObject.LitElement {
|
|
|
155
155
|
label: this.label
|
|
156
156
|
}
|
|
157
157
|
})((0, external_lit_namespaceObject.html)`<ul class="mt-3 ${'box' === this.displayValuesAs ? 'box-container' : ''}" part="values">
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
${children}
|
|
159
|
+
</ul>`);
|
|
160
160
|
}
|
|
161
161
|
renderValues() {
|
|
162
162
|
const firstNewValueIndex = (0, facet_common_cjs_namespaceObject.getFirstNewFacetValueIndex)(this.facet.state.values, this.valuesBeforeShowMore);
|
|
@@ -50,6 +50,7 @@ const error_guard_cjs_namespaceObject = require("../../../decorators/error-guard
|
|
|
50
50
|
const with_tailwind_styles_cjs_namespaceObject = require("../../../decorators/with-tailwind-styles.cjs");
|
|
51
51
|
const attach_cjs_namespaceObject = require("../../../images/attach.cjs");
|
|
52
52
|
var attach_cjs_default = /*#__PURE__*/ __webpack_require__.n(attach_cjs_namespaceObject);
|
|
53
|
+
require("../../common/atomic-icon/atomic-icon.cjs");
|
|
53
54
|
function _ts_decorate(decorators, target, key, desc) {
|
|
54
55
|
var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
55
56
|
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -53,6 +53,7 @@ var flag_cjs_default = /*#__PURE__*/ __webpack_require__.n(flag_cjs_namespaceObj
|
|
|
53
53
|
const three_dots_cjs_namespaceObject = require("../../../images/three-dots.cjs");
|
|
54
54
|
var three_dots_cjs_default = /*#__PURE__*/ __webpack_require__.n(three_dots_cjs_namespaceObject);
|
|
55
55
|
const external_user_action_cjs_namespaceObject = require("./user-action.cjs");
|
|
56
|
+
require("../../common/atomic-icon/atomic-icon.cjs");
|
|
56
57
|
function _ts_decorate(decorators, target, key, desc) {
|
|
57
58
|
var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
58
59
|
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -52,6 +52,7 @@ const quickview_cjs_namespaceObject = require("../../../images/quickview.cjs");
|
|
|
52
52
|
var quickview_cjs_default = /*#__PURE__*/ __webpack_require__.n(quickview_cjs_namespaceObject);
|
|
53
53
|
const search_cjs_namespaceObject = require("../../../images/search.cjs");
|
|
54
54
|
var search_cjs_default = /*#__PURE__*/ __webpack_require__.n(search_cjs_namespaceObject);
|
|
55
|
+
require("../../common/atomic-icon/atomic-icon.cjs");
|
|
55
56
|
const icons = {
|
|
56
57
|
SEARCH: search_cjs_default(),
|
|
57
58
|
CLICK: document_cjs_default(),
|
|
@@ -239,8 +239,8 @@ class AtomicRatingRangeFacet extends external_lit_namespaceObject.LitElement {
|
|
|
239
239
|
label: this.label
|
|
240
240
|
}
|
|
241
241
|
})((0, external_lit_namespaceObject.html)`<ul class="mt-3" part="values">
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
${children}
|
|
243
|
+
</ul>`);
|
|
244
244
|
}
|
|
245
245
|
renderValues() {
|
|
246
246
|
return this.renderValuesContainer(this.valuesToRender.map((value)=>this.renderValue(value, ()=>this.facet.toggleSingleSelect(value))));
|
|
@@ -257,8 +257,7 @@ class AtomicRatingRangeFacet extends external_lit_namespaceObject.LitElement {
|
|
|
257
257
|
}
|
|
258
258
|
});
|
|
259
259
|
if (!this.valuesToRender.length) return external_lit_namespaceObject.nothing;
|
|
260
|
-
return (0, facet_container_cjs_namespaceObject.renderFacetContainer)()((0, external_lit_namespaceObject.html)`${this.renderHeader()}
|
|
261
|
-
${(0, when_js_namespaceObject.when)(!this.isCollapsed, ()=>this.renderValues())}`);
|
|
260
|
+
return (0, facet_container_cjs_namespaceObject.renderFacetContainer)()((0, external_lit_namespaceObject.html)`${this.renderHeader()} ${(0, when_js_namespaceObject.when)(!this.isCollapsed, ()=>this.renderValues())}`);
|
|
262
261
|
})}`;
|
|
263
262
|
}
|
|
264
263
|
constructor(){
|
|
@@ -36,11 +36,14 @@ const external_lit_namespaceObject = require("lit");
|
|
|
36
36
|
const decorators_js_namespaceObject = require("lit/decorators.js");
|
|
37
37
|
const class_map_js_namespaceObject = require("lit/directives/class-map.js");
|
|
38
38
|
const ref_js_namespaceObject = require("lit/directives/ref.js");
|
|
39
|
+
const when_js_namespaceObject = require("lit/directives/when.js");
|
|
40
|
+
const button_cjs_namespaceObject = require("../../common/button.cjs");
|
|
39
41
|
const search_box_wrapper_cjs_namespaceObject = require("../../common/search-box/search-box-wrapper.cjs");
|
|
40
42
|
const search_text_area_cjs_namespaceObject = require("../../common/search-box/search-text-area.cjs");
|
|
41
43
|
const submit_button_cjs_namespaceObject = require("../../common/search-box/submit-button.cjs");
|
|
42
44
|
const suggestion_manager_cjs_namespaceObject = require("../../common/suggestions/suggestion-manager.cjs");
|
|
43
45
|
const suggestions_utils_cjs_namespaceObject = require("../../common/suggestions/suggestions-utils.cjs");
|
|
46
|
+
const validate_props_controller_cjs_namespaceObject = require("../../common/validate-props-controller/validate-props-controller.cjs");
|
|
44
47
|
const boolean_converter_cjs_namespaceObject = require("../../../converters/boolean-converter.cjs");
|
|
45
48
|
const bind_state_cjs_namespaceObject = require("../../../decorators/bind-state.cjs");
|
|
46
49
|
const binding_guard_cjs_namespaceObject = require("../../../decorators/binding-guard.cjs");
|
|
@@ -261,7 +264,7 @@ class AtomicSearchBox extends external_lit_namespaceObject.LitElement {
|
|
|
261
264
|
}
|
|
262
265
|
break;
|
|
263
266
|
case 'Tab':
|
|
264
|
-
this.suggestionManager.clearSuggestions();
|
|
267
|
+
if ('bottom' !== this.clearRecentButtonPosition || !this.clearRecentQueriesElement) this.suggestionManager.clearSuggestions();
|
|
265
268
|
break;
|
|
266
269
|
default:
|
|
267
270
|
if (this.suggestionManager.keyboardActiveDescendant) this.suggestionManager.updateKeyboardActiveDescendant();
|
|
@@ -322,11 +325,59 @@ class AtomicSearchBox extends external_lit_namespaceObject.LitElement {
|
|
|
322
325
|
}
|
|
323
326
|
})}`;
|
|
324
327
|
}
|
|
328
|
+
get clearRecentQueriesElement() {
|
|
329
|
+
const { leftSuggestionElements, rightSuggestionElements } = this.suggestionManager;
|
|
330
|
+
return [
|
|
331
|
+
leftSuggestionElements,
|
|
332
|
+
rightSuggestionElements
|
|
333
|
+
].flatMap((elements)=>elements.slice(0, -1)).find((element)=>'recent-query-clear' === element.key);
|
|
334
|
+
}
|
|
335
|
+
renderRecentQueriesTitle() {
|
|
336
|
+
return (0, external_lit_namespaceObject.html)`<div
|
|
337
|
+
part="recent-query-title"
|
|
338
|
+
class="text-neutral-dark flex min-h-10 items-center px-4 font-bold"
|
|
339
|
+
@mousedown=${(e)=>e.preventDefault()}
|
|
340
|
+
>
|
|
341
|
+
${this.bindings.i18n.t('recent-searches')}
|
|
342
|
+
</div>`;
|
|
343
|
+
}
|
|
344
|
+
renderClearRecentQueriesButton(element) {
|
|
345
|
+
const deselectSuggestion = ()=>{
|
|
346
|
+
this.suggestionManager.updateKeyboardActiveDescendant();
|
|
347
|
+
this.suggestionManager.updateActiveDescendant();
|
|
348
|
+
};
|
|
349
|
+
return (0, external_lit_namespaceObject.html)`<div
|
|
350
|
+
class="border-neutral flex border-t"
|
|
351
|
+
@mousedown=${(e)=>e.preventDefault()}
|
|
352
|
+
@mouseenter=${deselectSuggestion}
|
|
353
|
+
@focusin=${deselectSuggestion}
|
|
354
|
+
@keydown=${(e)=>{
|
|
355
|
+
if ('Escape' !== e.key) return;
|
|
356
|
+
this.textAreaRef.value?.focus();
|
|
357
|
+
this.isExpanded = false;
|
|
358
|
+
this.suggestionManager.clearSuggestions();
|
|
359
|
+
}}
|
|
360
|
+
>
|
|
361
|
+
${(0, button_cjs_namespaceObject.renderButton)({
|
|
362
|
+
props: {
|
|
363
|
+
style: 'text-primary',
|
|
364
|
+
text: this.bindings.i18n.t('clear-recent-searches'),
|
|
365
|
+
part: 'recent-query-clear-button',
|
|
366
|
+
class: 'focus-visible:ring-ring-primary flex min-h-12 w-full items-center justify-center rounded-none px-4 focus-visible:ring-2 focus-visible:ring-inset',
|
|
367
|
+
onClick: (e)=>{
|
|
368
|
+
element.onSelect?.(e);
|
|
369
|
+
this.textAreaRef.value?.focus();
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
})(external_lit_namespaceObject.nothing)}
|
|
373
|
+
</div>`;
|
|
374
|
+
}
|
|
325
375
|
renderSuggestions() {
|
|
326
376
|
const part = `suggestions-wrapper ${this.suggestionManager.isDoubleList ? 'suggestions-double-list' : 'suggestions-single-list'}`;
|
|
327
377
|
const isVisible = this.suggestionManager.hasSuggestions && this.isExpanded && !this.isSearchDisabledForEndUser;
|
|
328
378
|
const classes = {
|
|
329
379
|
'bg-background border-neutral absolute top-full left-0 z-10 flex w-full rounded-md border': true,
|
|
380
|
+
'overflow-hidden': 'bottom' === this.clearRecentButtonPosition,
|
|
330
381
|
hidden: !isVisible
|
|
331
382
|
};
|
|
332
383
|
return (0, external_lit_namespaceObject.html)`<div
|
|
@@ -337,25 +388,43 @@ class AtomicSearchBox extends external_lit_namespaceObject.LitElement {
|
|
|
337
388
|
aria-label=${this.bindings.i18n.t(this.suggestionManager.isDoubleList ? 'search-suggestions-double-list' : 'search-suggestions-single-list')}
|
|
338
389
|
aria-activedescendant=${this.suggestionManager.activeDescendant}
|
|
339
390
|
>
|
|
340
|
-
${this.renderPanel('left', this.suggestionManager.leftSuggestionElements, (
|
|
341
|
-
|
|
342
|
-
}, ()=>this.suggestionManager.leftPanel)}
|
|
343
|
-
${this.renderPanel('right', this.suggestionManager.rightSuggestionElements, (el)=>{
|
|
344
|
-
this.suggestionManager.rightPanel = el;
|
|
345
|
-
}, ()=>this.suggestionManager.rightPanel)}
|
|
391
|
+
${this.renderPanel('left', this.suggestionManager.leftSuggestionElements, this.setLeftPanel, ()=>this.suggestionManager.leftPanel)}
|
|
392
|
+
${this.renderPanel('right', this.suggestionManager.rightSuggestionElements, this.setRightPanel, ()=>this.suggestionManager.rightPanel)}
|
|
346
393
|
</div>`;
|
|
347
394
|
}
|
|
348
395
|
renderPanel(side, elements, setRef, getRef) {
|
|
349
|
-
|
|
396
|
+
let listElements = elements;
|
|
397
|
+
let isListNested = false;
|
|
398
|
+
let recentQueriesTitle;
|
|
399
|
+
let clearRecentQueriesButton;
|
|
400
|
+
switch(this.clearRecentButtonPosition){
|
|
401
|
+
case 'bottom':
|
|
402
|
+
{
|
|
403
|
+
isListNested = true;
|
|
404
|
+
const clearElement = this.clearRecentQueriesElement;
|
|
405
|
+
if (clearElement && elements.includes(clearElement)) {
|
|
406
|
+
listElements = elements.filter((element)=>element !== clearElement);
|
|
407
|
+
clearRecentQueriesButton = this.renderClearRecentQueriesButton(clearElement);
|
|
408
|
+
if (elements[0] === clearElement) recentQueriesTitle = this.renderRecentQueriesTitle();
|
|
409
|
+
}
|
|
410
|
+
break;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
if (!listElements.length) return null;
|
|
414
|
+
const suggestions = listElements.map((suggestion, index)=>this.renderSuggestion(suggestion, index, listElements.length - 1, side));
|
|
350
415
|
return (0, external_lit_namespaceObject.html)`<div
|
|
351
416
|
part="suggestions suggestions-${side}"
|
|
352
|
-
${(0, ref_js_namespaceObject.ref)(setRef)}
|
|
417
|
+
${(0, ref_js_namespaceObject.ref)(isListNested ? void 0 : setRef)}
|
|
353
418
|
class="flex grow basis-1/2 flex-col"
|
|
354
419
|
@mousedown=${(e)=>{
|
|
355
420
|
if (e.target === getRef()) e.preventDefault();
|
|
356
421
|
}}
|
|
357
422
|
>
|
|
358
|
-
${
|
|
423
|
+
${recentQueriesTitle}
|
|
424
|
+
${(0, when_js_namespaceObject.when)(isListNested, ()=>(0, external_lit_namespaceObject.html)`<div class="flex grow flex-col" ${(0, ref_js_namespaceObject.ref)(setRef)}>
|
|
425
|
+
${suggestions}
|
|
426
|
+
</div>`, ()=>suggestions)}
|
|
427
|
+
${clearRecentQueriesButton}
|
|
359
428
|
</div>`;
|
|
360
429
|
}
|
|
361
430
|
renderSuggestion(item, index, lastIndex, side) {
|
|
@@ -418,10 +487,25 @@ class AtomicSearchBox extends external_lit_namespaceObject.LitElement {
|
|
|
418
487
|
${this.renderSlotContent()}
|
|
419
488
|
`;
|
|
420
489
|
}
|
|
421
|
-
constructor(
|
|
422
|
-
super(
|
|
490
|
+
constructor(){
|
|
491
|
+
super(), this.isExpanded = false, this.textAreaRef = (0, ref_js_namespaceObject.createRef)(), this.setLeftPanel = (el)=>{
|
|
492
|
+
this.suggestionManager.leftPanel = el;
|
|
493
|
+
}, this.setRightPanel = (el)=>{
|
|
494
|
+
this.suggestionManager.rightPanel = el;
|
|
495
|
+
}, this.searchBoxSuggestionEventsQueue = [], this.searchBoxAriaMessage = new accessibility_utils_cjs_namespaceObject.AriaLiveRegionController(this, 'search-box'), this.suggestionsAriaMessage = new accessibility_utils_cjs_namespaceObject.AriaLiveRegionController(this, 'search-suggestions', true), this.numberOfQueries = 8, this.suggestionTimeout = 400, this.suggestionDelay = 0, this.disableSearch = false, this.minimumQueryLength = 0, this.clearFilters = true, this.enableQuerySyntax = false, this.clearRecentButtonPosition = 'top', this.updateBreakpoints = (0, utils_cjs_namespaceObject.once)(()=>(0, replace_breakpoint_utils_cjs_namespaceObject.updateBreakpoints)(this));
|
|
496
|
+
new validate_props_controller_cjs_namespaceObject.ValidatePropsController(this, ()=>({
|
|
497
|
+
clearRecentButtonPosition: this.clearRecentButtonPosition
|
|
498
|
+
}), AtomicSearchBox.propsSchema);
|
|
423
499
|
}
|
|
424
500
|
}
|
|
501
|
+
AtomicSearchBox.propsSchema = new bueno_namespaceObject.Schema({
|
|
502
|
+
clearRecentButtonPosition: new bueno_namespaceObject.StringValue({
|
|
503
|
+
constrainTo: [
|
|
504
|
+
'top',
|
|
505
|
+
'bottom'
|
|
506
|
+
]
|
|
507
|
+
})
|
|
508
|
+
});
|
|
425
509
|
AtomicSearchBox.shadowRootOptions = {
|
|
426
510
|
...external_lit_namespaceObject.LitElement.shadowRootOptions,
|
|
427
511
|
delegatesFocus: true
|
|
@@ -503,6 +587,14 @@ _ts_decorate([
|
|
|
503
587
|
converter: boolean_converter_cjs_namespaceObject.booleanConverter
|
|
504
588
|
})
|
|
505
589
|
], AtomicSearchBox.prototype, "enableQuerySyntax", void 0);
|
|
590
|
+
_ts_decorate([
|
|
591
|
+
(0, decorators_js_namespaceObject.property)({
|
|
592
|
+
type: String,
|
|
593
|
+
attribute: 'clear-recent-button-position',
|
|
594
|
+
reflect: true
|
|
595
|
+
}),
|
|
596
|
+
_ts_metadata("design:type", String)
|
|
597
|
+
], AtomicSearchBox.prototype, "clearRecentButtonPosition", void 0);
|
|
506
598
|
_ts_decorate([
|
|
507
599
|
(0, watch_cjs_namespaceObject.watch)('redirectionUrl'),
|
|
508
600
|
_ts_metadata("design:type", Function),
|
|
@@ -519,7 +611,9 @@ _ts_decorate([
|
|
|
519
611
|
AtomicSearchBox = _ts_decorate([
|
|
520
612
|
(0, decorators_js_namespaceObject.customElement)('atomic-search-box'),
|
|
521
613
|
(0, bindings_cjs_namespaceObject.bindings)(),
|
|
522
|
-
with_tailwind_styles_cjs_namespaceObject.withTailwindStyles
|
|
614
|
+
with_tailwind_styles_cjs_namespaceObject.withTailwindStyles,
|
|
615
|
+
_ts_metadata("design:type", Function),
|
|
616
|
+
_ts_metadata("design:paramtypes", [])
|
|
523
617
|
], AtomicSearchBox);
|
|
524
618
|
exports.AtomicSearchBox = __webpack_exports__.AtomicSearchBox;
|
|
525
619
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
@@ -39,6 +39,7 @@ const instant_item_cjs_namespaceObject = require("../../common/suggestions/insta
|
|
|
39
39
|
const suggestions_events_cjs_namespaceObject = require("../../common/suggestions/suggestions-events.cjs");
|
|
40
40
|
const error_guard_cjs_namespaceObject = require("../../../decorators/error-guard.cjs");
|
|
41
41
|
const string_utils_cjs_namespaceObject = require("../../../utils/string-utils.cjs");
|
|
42
|
+
require("../atomic-result/atomic-result.cjs");
|
|
42
43
|
function _ts_decorate(decorators, target, key, desc) {
|
|
43
44
|
var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
44
45
|
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|