@coveo/atomic 3.64.0 → 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 +9436 -9292
- 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-focus-trap/atomic-focus-trap.cjs +11 -1
- package/dist/cjs/components/common/atomic-layout-section/layout.cjs +6 -2
- 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/facet-common.cjs +21 -2
- 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-facet-manager/atomic-facet-manager.cjs +7 -3
- package/dist/cjs/components/search/atomic-popover/atomic-popover.cjs +1 -2
- 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/components/search/atomic-search-layout/atomic-search-layout.tw.css.cjs +12 -2
- 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-focus-trap/atomic-focus-trap.js +11 -1
- package/dist/esm/components/common/atomic-layout-section/layout.js +6 -2
- 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/facet-common.js +16 -3
- 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-facet-manager/atomic-facet-manager.js +8 -4
- package/dist/esm/components/search/atomic-popover/atomic-popover.js +1 -2
- 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/components/search/atomic-search-layout/atomic-search-layout.tw.css.js +1 -1
- 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-focus-trap/atomic-focus-trap.d.ts +1 -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/facets/facet-common.d.ts +2 -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-facet-manager/atomic-facet-manager.d.ts +6 -1
- 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 +30 -26
package/dist/esm/components/commerce/atomic-commerce-search-box/atomic-commerce-search-box.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { Schema, StringValue } from "@coveo/bueno";
|
|
1
2
|
import { buildSearchBox, buildStandaloneSearchBox, loadQuerySetActions } from "@coveo/headless/commerce";
|
|
2
|
-
import { LitElement, css, html } from "lit";
|
|
3
|
+
import { LitElement, css, html, nothing } from "lit";
|
|
3
4
|
import { customElement, property, state } from "lit/decorators.js";
|
|
4
5
|
import { classMap } from "lit/directives/class-map.js";
|
|
5
6
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
7
|
+
import { when } from "lit/directives/when.js";
|
|
8
|
+
import { renderButton } from "../../common/button.js";
|
|
9
|
+
import { ValidatePropsController } from "../../common/validate-props-controller/validate-props-controller.js";
|
|
6
10
|
import { booleanConverter } from "../../../converters/boolean-converter.js";
|
|
7
11
|
import { bindStateToController } from "../../../decorators/bind-state.js";
|
|
8
12
|
import { bindingGuard } from "../../../decorators/binding-guard.js";
|
|
@@ -226,7 +230,7 @@ class AtomicCommerceSearchBox extends LitElement {
|
|
|
226
230
|
}
|
|
227
231
|
break;
|
|
228
232
|
case 'Tab':
|
|
229
|
-
this.suggestionManager.clearSuggestions();
|
|
233
|
+
if ('bottom' !== this.clearRecentButtonPosition || !this.clearRecentQueriesElement) this.suggestionManager.clearSuggestions();
|
|
230
234
|
break;
|
|
231
235
|
default:
|
|
232
236
|
if (this.suggestionManager.keyboardActiveDescendant) this.suggestionManager.updateKeyboardActiveDescendant();
|
|
@@ -291,11 +295,59 @@ class AtomicCommerceSearchBox extends LitElement {
|
|
|
291
295
|
}
|
|
292
296
|
})}`;
|
|
293
297
|
}
|
|
298
|
+
get clearRecentQueriesElement() {
|
|
299
|
+
const { leftSuggestionElements, rightSuggestionElements } = this.suggestionManager;
|
|
300
|
+
return [
|
|
301
|
+
leftSuggestionElements,
|
|
302
|
+
rightSuggestionElements
|
|
303
|
+
].flatMap((elements)=>elements.slice(0, -1)).find((element)=>'recent-query-clear' === element.key);
|
|
304
|
+
}
|
|
305
|
+
renderRecentQueriesTitle() {
|
|
306
|
+
return html`<div
|
|
307
|
+
part="recent-query-title"
|
|
308
|
+
class="text-neutral-dark flex min-h-10 items-center px-4 font-bold"
|
|
309
|
+
@mousedown=${(e)=>e.preventDefault()}
|
|
310
|
+
>
|
|
311
|
+
${this.bindings.i18n.t('recent-searches')}
|
|
312
|
+
</div>`;
|
|
313
|
+
}
|
|
314
|
+
renderClearRecentQueriesButton(element) {
|
|
315
|
+
const deselectSuggestion = ()=>{
|
|
316
|
+
this.suggestionManager.updateKeyboardActiveDescendant();
|
|
317
|
+
this.suggestionManager.updateActiveDescendant();
|
|
318
|
+
};
|
|
319
|
+
return html`<div
|
|
320
|
+
class="border-neutral flex border-t"
|
|
321
|
+
@mousedown=${(e)=>e.preventDefault()}
|
|
322
|
+
@mouseenter=${deselectSuggestion}
|
|
323
|
+
@focusin=${deselectSuggestion}
|
|
324
|
+
@keydown=${(e)=>{
|
|
325
|
+
if ('Escape' !== e.key) return;
|
|
326
|
+
this.textAreaRef.value?.focus();
|
|
327
|
+
this.isExpanded = false;
|
|
328
|
+
this.suggestionManager.clearSuggestions();
|
|
329
|
+
}}
|
|
330
|
+
>
|
|
331
|
+
${renderButton({
|
|
332
|
+
props: {
|
|
333
|
+
style: 'text-primary',
|
|
334
|
+
text: this.bindings.i18n.t('clear-recent-searches'),
|
|
335
|
+
part: 'recent-query-clear-button',
|
|
336
|
+
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',
|
|
337
|
+
onClick: (e)=>{
|
|
338
|
+
element.onSelect?.(e);
|
|
339
|
+
this.textAreaRef.value?.focus();
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
})(nothing)}
|
|
343
|
+
</div>`;
|
|
344
|
+
}
|
|
294
345
|
renderSuggestions() {
|
|
295
346
|
const part = `suggestions-wrapper ${this.suggestionManager.isDoubleList ? 'suggestions-double-list' : 'suggestions-single-list'}`;
|
|
296
347
|
const isVisible = this.suggestionManager.hasSuggestions && this.isExpanded && !this.isSearchDisabledForEndUser;
|
|
297
348
|
const classes = {
|
|
298
349
|
'bg-background border-neutral absolute top-full left-0 z-10 flex w-full rounded-md border': true,
|
|
350
|
+
'overflow-hidden': 'bottom' === this.clearRecentButtonPosition,
|
|
299
351
|
hidden: !isVisible
|
|
300
352
|
};
|
|
301
353
|
return html`<div
|
|
@@ -306,25 +358,43 @@ class AtomicCommerceSearchBox extends LitElement {
|
|
|
306
358
|
aria-label=${this.bindings.i18n.t(this.suggestionManager.isDoubleList ? 'search-suggestions-double-list' : 'search-suggestions-single-list')}
|
|
307
359
|
aria-activedescendant=${this.suggestionManager.activeDescendant}
|
|
308
360
|
>
|
|
309
|
-
${this.renderPanel('left', this.suggestionManager.leftSuggestionElements, (
|
|
310
|
-
|
|
311
|
-
}, ()=>this.suggestionManager.leftPanel)}
|
|
312
|
-
${this.renderPanel('right', this.suggestionManager.rightSuggestionElements, (el)=>{
|
|
313
|
-
this.suggestionManager.rightPanel = el;
|
|
314
|
-
}, ()=>this.suggestionManager.rightPanel)}
|
|
361
|
+
${this.renderPanel('left', this.suggestionManager.leftSuggestionElements, this.setLeftPanel, ()=>this.suggestionManager.leftPanel)}
|
|
362
|
+
${this.renderPanel('right', this.suggestionManager.rightSuggestionElements, this.setRightPanel, ()=>this.suggestionManager.rightPanel)}
|
|
315
363
|
</div>`;
|
|
316
364
|
}
|
|
317
365
|
renderPanel(side, elements, setRef, getRef) {
|
|
318
|
-
|
|
366
|
+
let listElements = elements;
|
|
367
|
+
let isListNested = false;
|
|
368
|
+
let recentQueriesTitle;
|
|
369
|
+
let clearRecentQueriesButton;
|
|
370
|
+
switch(this.clearRecentButtonPosition){
|
|
371
|
+
case 'bottom':
|
|
372
|
+
{
|
|
373
|
+
isListNested = true;
|
|
374
|
+
const clearElement = this.clearRecentQueriesElement;
|
|
375
|
+
if (clearElement && elements.includes(clearElement)) {
|
|
376
|
+
listElements = elements.filter((element)=>element !== clearElement);
|
|
377
|
+
clearRecentQueriesButton = this.renderClearRecentQueriesButton(clearElement);
|
|
378
|
+
if (elements[0] === clearElement) recentQueriesTitle = this.renderRecentQueriesTitle();
|
|
379
|
+
}
|
|
380
|
+
break;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
if (!listElements.length) return null;
|
|
384
|
+
const suggestions = listElements.map((suggestion, index)=>this.renderSuggestion(suggestion, index, listElements.length - 1, side));
|
|
319
385
|
return html`<div
|
|
320
386
|
part="suggestions suggestions-${side}"
|
|
321
|
-
${ref(setRef)}
|
|
387
|
+
${ref(isListNested ? void 0 : setRef)}
|
|
322
388
|
class="flex grow basis-1/2 flex-col"
|
|
323
389
|
@mousedown=${(e)=>{
|
|
324
390
|
if (e.target === getRef()) e.preventDefault();
|
|
325
391
|
}}
|
|
326
392
|
>
|
|
327
|
-
${
|
|
393
|
+
${recentQueriesTitle}
|
|
394
|
+
${when(isListNested, ()=>html`<div class="flex grow flex-col" ${ref(setRef)}>
|
|
395
|
+
${suggestions}
|
|
396
|
+
</div>`, ()=>suggestions)}
|
|
397
|
+
${clearRecentQueriesButton}
|
|
328
398
|
</div>`;
|
|
329
399
|
}
|
|
330
400
|
renderSuggestion(item, index, lastIndex, side) {
|
|
@@ -390,10 +460,25 @@ class AtomicCommerceSearchBox extends LitElement {
|
|
|
390
460
|
announceClearSearchBoxToScreenReader() {
|
|
391
461
|
this.searchBoxAriaMessage.message = this.bindings.i18n.t('search-box-cleared');
|
|
392
462
|
}
|
|
393
|
-
constructor(
|
|
394
|
-
super(
|
|
463
|
+
constructor(){
|
|
464
|
+
super(), this.isExpanded = false, this.textAreaRef = createRef(), this.setLeftPanel = (el)=>{
|
|
465
|
+
this.suggestionManager.leftPanel = el;
|
|
466
|
+
}, this.setRightPanel = (el)=>{
|
|
467
|
+
this.suggestionManager.rightPanel = el;
|
|
468
|
+
}, this.searchBoxSuggestionEventsQueue = [], this.searchBoxAriaMessage = new AriaLiveRegionController(this, 'search-box'), this.suggestionsAriaMessage = new AriaLiveRegionController(this, 'search-suggestions', true), this.numberOfQueries = 8, this.suggestionTimeout = 400, this.suggestionDelay = 0, this.disableSearch = false, this.minimumQueryLength = 0, this.clearFilters = true, this.clearRecentButtonPosition = 'top', this.updateBreakpoints = once(()=>updateBreakpoints(this));
|
|
469
|
+
new ValidatePropsController(this, ()=>({
|
|
470
|
+
clearRecentButtonPosition: this.clearRecentButtonPosition
|
|
471
|
+
}), AtomicCommerceSearchBox.propsSchema);
|
|
395
472
|
}
|
|
396
473
|
}
|
|
474
|
+
AtomicCommerceSearchBox.propsSchema = new Schema({
|
|
475
|
+
clearRecentButtonPosition: new StringValue({
|
|
476
|
+
constrainTo: [
|
|
477
|
+
'top',
|
|
478
|
+
'bottom'
|
|
479
|
+
]
|
|
480
|
+
})
|
|
481
|
+
});
|
|
397
482
|
AtomicCommerceSearchBox.shadowRootOptions = {
|
|
398
483
|
...LitElement.shadowRootOptions,
|
|
399
484
|
delegatesFocus: true
|
|
@@ -465,6 +550,14 @@ _ts_decorate([
|
|
|
465
550
|
converter: booleanConverter
|
|
466
551
|
})
|
|
467
552
|
], AtomicCommerceSearchBox.prototype, "clearFilters", void 0);
|
|
553
|
+
_ts_decorate([
|
|
554
|
+
property({
|
|
555
|
+
type: String,
|
|
556
|
+
attribute: 'clear-recent-button-position',
|
|
557
|
+
reflect: true
|
|
558
|
+
}),
|
|
559
|
+
_ts_metadata("design:type", String)
|
|
560
|
+
], AtomicCommerceSearchBox.prototype, "clearRecentButtonPosition", void 0);
|
|
468
561
|
_ts_decorate([
|
|
469
562
|
watch('redirectionUrl'),
|
|
470
563
|
_ts_metadata("design:type", Function),
|
|
@@ -481,6 +574,8 @@ _ts_decorate([
|
|
|
481
574
|
AtomicCommerceSearchBox = _ts_decorate([
|
|
482
575
|
customElement('atomic-commerce-search-box'),
|
|
483
576
|
bindings(),
|
|
484
|
-
withTailwindStyles
|
|
577
|
+
withTailwindStyles,
|
|
578
|
+
_ts_metadata("design:type", Function),
|
|
579
|
+
_ts_metadata("design:paramtypes", [])
|
|
485
580
|
], AtomicCommerceSearchBox);
|
|
486
581
|
export { AtomicCommerceSearchBox };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { buildProductTemplatesManager } from "@coveo/headless/commerce";
|
|
2
2
|
import { TemplateProvider } from "../../common/template-provider/template-provider.js";
|
|
3
3
|
import "../atomic-product-template/atomic-product-template.js";
|
|
4
|
+
import "../atomic-product-section-name/atomic-product-section-name.js";
|
|
5
|
+
import "../atomic-product-section-visual/atomic-product-section-visual.js";
|
|
4
6
|
class ProductTemplateProvider extends TemplateProvider {
|
|
5
7
|
makeDefaultTemplate() {
|
|
6
8
|
const content = document.createDocumentFragment();
|
|
@@ -28,6 +28,10 @@ class AtomicFocusTrap extends LightDomMixin(LitElement) {
|
|
|
28
28
|
if (element.hasAttribute('aria-hidden') || element.hasAttribute('aria-live') || 'atomic-aria-live' === element.tagName.toLowerCase()) return;
|
|
29
29
|
element.setAttribute('aria-hidden', 'true');
|
|
30
30
|
this.hiddenElements.push(element);
|
|
31
|
+
if (!element.hasAttribute('inert')) {
|
|
32
|
+
element.setAttribute('inert', '');
|
|
33
|
+
this.inertElements.push(element);
|
|
34
|
+
}
|
|
31
35
|
}
|
|
32
36
|
showAll() {
|
|
33
37
|
let el = this.hiddenElements.pop();
|
|
@@ -35,6 +39,11 @@ class AtomicFocusTrap extends LightDomMixin(LitElement) {
|
|
|
35
39
|
el.removeAttribute('aria-hidden');
|
|
36
40
|
el = this.hiddenElements.pop();
|
|
37
41
|
}
|
|
42
|
+
let inertElement = this.inertElements.pop();
|
|
43
|
+
while(inertElement){
|
|
44
|
+
inertElement.removeAttribute('inert');
|
|
45
|
+
inertElement = this.inertElements.pop();
|
|
46
|
+
}
|
|
38
47
|
}
|
|
39
48
|
hideSiblingsRecursively(element) {
|
|
40
49
|
const parent = getParent(element);
|
|
@@ -68,6 +77,7 @@ class AtomicFocusTrap extends LightDomMixin(LitElement) {
|
|
|
68
77
|
this.showSelf();
|
|
69
78
|
if (!isInitialLoad) {
|
|
70
79
|
await defer();
|
|
80
|
+
if (!this.active) return;
|
|
71
81
|
getFirstFocusableDescendant(this)?.focus();
|
|
72
82
|
}
|
|
73
83
|
this.hideSiblingsRecursively(this);
|
|
@@ -81,7 +91,7 @@ class AtomicFocusTrap extends LightDomMixin(LitElement) {
|
|
|
81
91
|
return this.container ?? this;
|
|
82
92
|
}
|
|
83
93
|
constructor(...args){
|
|
84
|
-
super(...args), this.active = false, this.shouldHideSelf = true, this.scope = document.body, this.hiddenElements = [], this.onFocusChanged = (e)=>{
|
|
94
|
+
super(...args), this.active = false, this.shouldHideSelf = true, this.scope = document.body, this.hiddenElements = [], this.inertElements = [], this.onFocusChanged = (e)=>{
|
|
85
95
|
if (!e.target || !this.active) return;
|
|
86
96
|
const focusedElement = getFocusedElement();
|
|
87
97
|
if (focusedElement && isAncestorOf(this, focusedElement)) return;
|
|
@@ -64,11 +64,15 @@ function buildCommonLayout(element, mobileBreakpoint, layoutWebComponentTagName,
|
|
|
64
64
|
}
|
|
65
65
|
}`;
|
|
66
66
|
};
|
|
67
|
-
const horizontalFacets = ()
|
|
68
|
-
|
|
67
|
+
const horizontalFacets = ()=>{
|
|
68
|
+
const horizontalFacetsSelector = `${layoutSelector} ${sectionSelector('horizontal-facets')}`;
|
|
69
|
+
return `${mediaQuerySelector} {
|
|
70
|
+
${horizontalFacetsSelector} > atomic-popover:not(.atomic-hidden),
|
|
71
|
+
${horizontalFacetsSelector} > atomic-facet-manager > atomic-popover:not(.atomic-hidden) {
|
|
69
72
|
display: block;
|
|
70
73
|
}
|
|
71
74
|
}`;
|
|
75
|
+
};
|
|
72
76
|
return [
|
|
73
77
|
display,
|
|
74
78
|
search,
|
|
@@ -11,7 +11,8 @@ import { multiClassMap, tw } from "../../../directives/multi-class-map.js";
|
|
|
11
11
|
import { InitializeBindingsMixin } from "../../../mixins/bindings-mixin.js";
|
|
12
12
|
import { buildCustomEvent, listenOnce } from "../../../utils/event-utils.js";
|
|
13
13
|
import { updateBreakpoints } from "../../../utils/replace-breakpoint-utils.js";
|
|
14
|
-
import { once, randomID } from "../../../utils/utils.js";
|
|
14
|
+
import { getFocusedElement, isAncestorOf, once, randomID } from "../../../utils/utils.js";
|
|
15
|
+
import "../atomic-focus-trap/atomic-focus-trap.js";
|
|
15
16
|
function _ts_decorate(decorators, target, key, desc) {
|
|
16
17
|
var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
17
18
|
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -52,7 +53,7 @@ class AtomicModal extends InitializeBindingsMixin(LitElement) {
|
|
|
52
53
|
role="dialog"
|
|
53
54
|
aria-modal=${this.isOpen ? 'true' : 'false'}
|
|
54
55
|
aria-labelledby=${this.headerId}
|
|
55
|
-
.source=${this.source}
|
|
56
|
+
.source=${this.source ?? this.focusedElementBeforeOpen}
|
|
56
57
|
.container=${this.container ?? this}
|
|
57
58
|
${ref(this.focusTrap)}
|
|
58
59
|
.scope=${this.scope ?? this.bindings?.interfaceElement ?? document.body}
|
|
@@ -96,6 +97,8 @@ class AtomicModal extends InitializeBindingsMixin(LitElement) {
|
|
|
96
97
|
}
|
|
97
98
|
async handleModalOpen() {
|
|
98
99
|
const executionId = this.createExecutionTracker();
|
|
100
|
+
const focusedElement = getFocusedElement();
|
|
101
|
+
this.focusedElementBeforeOpen = focusedElement instanceof HTMLElement && !isAncestorOf(this, focusedElement) ? focusedElement : void 0;
|
|
99
102
|
if (!this.shouldRender) {
|
|
100
103
|
this.shouldRender = true;
|
|
101
104
|
await this.updateComplete;
|
|
@@ -272,6 +275,10 @@ _ts_decorate([
|
|
|
272
275
|
}),
|
|
273
276
|
_ts_metadata("design:type", "u" < typeof HTMLElement ? Object : HTMLElement)
|
|
274
277
|
], AtomicModal.prototype, "source", void 0);
|
|
278
|
+
_ts_decorate([
|
|
279
|
+
state(),
|
|
280
|
+
_ts_metadata("design:type", "u" < typeof HTMLElement ? Object : HTMLElement)
|
|
281
|
+
], AtomicModal.prototype, "focusedElementBeforeOpen", void 0);
|
|
275
282
|
_ts_decorate([
|
|
276
283
|
errorGuard(),
|
|
277
284
|
_ts_metadata("design:type", Function),
|
|
@@ -9,6 +9,7 @@ import { bindings } from "../../../decorators/bindings.js";
|
|
|
9
9
|
import { errorGuard } from "../../../decorators/error-guard.js";
|
|
10
10
|
import { withTailwindStyles } from "../../../decorators/with-tailwind-styles.js";
|
|
11
11
|
import arrow_bottom_rounded from "../../../images/arrow-bottom-rounded.js";
|
|
12
|
+
import "../atomic-icon/atomic-icon.js";
|
|
12
13
|
function _ts_decorate(decorators, target, key, desc) {
|
|
13
14
|
var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14
15
|
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -34,9 +34,22 @@ function isAutomaticFacetGenerator(element) {
|
|
|
34
34
|
function isPseudoFacet(el) {
|
|
35
35
|
return 'facetId' in el;
|
|
36
36
|
}
|
|
37
|
+
function isPopover(element) {
|
|
38
|
+
return 'ATOMIC-POPOVER' === element.tagName;
|
|
39
|
+
}
|
|
40
|
+
function isFacetNestedInPopover(facet) {
|
|
41
|
+
return !!facet.parentElement && isPopover(facet.parentElement);
|
|
42
|
+
}
|
|
43
|
+
function getFacetElementToReorder(facet) {
|
|
44
|
+
return isFacetNestedInPopover(facet) ? facet.parentElement : facet;
|
|
45
|
+
}
|
|
37
46
|
function getFacetsInChildren(parent) {
|
|
38
|
-
|
|
39
|
-
|
|
47
|
+
return Array.from(parent.children).flatMap((child)=>{
|
|
48
|
+
if (isPseudoFacet(child)) return [
|
|
49
|
+
child
|
|
50
|
+
];
|
|
51
|
+
return isPopover(child) ? Array.from(child.children).filter(isPseudoFacet) : [];
|
|
52
|
+
});
|
|
40
53
|
}
|
|
41
54
|
function getAutomaticFacetGenerator(parent) {
|
|
42
55
|
return Array.from(parent.children).find(isAutomaticFacetGenerator);
|
|
@@ -58,4 +71,4 @@ function triageFacetsByParents(facets, ...parents) {
|
|
|
58
71
|
}
|
|
59
72
|
return sortedFacets;
|
|
60
73
|
}
|
|
61
|
-
export { collapseFacetsAfter, getAutomaticFacetGenerator, getFacetsInChildren, getFirstNewFacetValueIndex, isAutomaticFacetGenerator, shouldDisplayInputForFacetRange, sortFacetVisibility, triageFacetsByParents };
|
|
74
|
+
export { collapseFacetsAfter, getAutomaticFacetGenerator, getFacetElementToReorder, getFacetsInChildren, getFirstNewFacetValueIndex, isAutomaticFacetGenerator, isFacetNestedInPopover, shouldDisplayInputForFacetRange, sortFacetVisibility, triageFacetsByParents };
|
|
@@ -156,8 +156,8 @@ class TimeframeFacetCommon {
|
|
|
156
156
|
label: this.props.label
|
|
157
157
|
}
|
|
158
158
|
})(html`<ul class="mt-3" part="values">
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
${children}
|
|
160
|
+
</ul>`);
|
|
161
161
|
}
|
|
162
162
|
renderHeader(isCollapsed, headerFocus, onToggleCollapse) {
|
|
163
163
|
return renderFacetHeader({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Marked, Renderer } from "marked";
|
|
2
2
|
import { parseHTML } from "../../../../utils/utils.js";
|
|
3
|
+
import "../../atomic-generated-answer-inline-link/atomic-generated-answer-inline-link.js";
|
|
3
4
|
const toInlinePlainText = (textWithHtml)=>{
|
|
4
5
|
const withoutHtmlTags = textWithHtml.replace(/<[^>]*>/g, ' ');
|
|
5
6
|
const withCollapsedWhitespaces = withoutHtmlTags.replace(/\s{2,}/g, ' ');
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { buildResultTemplatesManager } from "@coveo/headless";
|
|
2
2
|
import { TemplateProvider } from "../template-provider/template-provider.js";
|
|
3
|
+
import "../../search/atomic-result-link/atomic-result-link.js";
|
|
3
4
|
class ResultTemplateProvider extends TemplateProvider {
|
|
4
5
|
makeDefaultTemplate() {
|
|
5
6
|
const content = document.createDocumentFragment();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseTemplateController } from "../template-controller/base-template-controller.js";
|
|
2
|
+
import "../../search/atomic-result-link/atomic-result-link.js";
|
|
2
3
|
class ResultTemplateController extends BaseTemplateController {
|
|
3
4
|
getTemplate(conditions) {
|
|
4
5
|
const baseTemplate = this.getBaseTemplate(conditions);
|
|
@@ -58,11 +58,13 @@ class SuggestionManager {
|
|
|
58
58
|
const panelHasActiveDescendant = this.previousActiveDescendantElement && panel.contains(this.previousActiveDescendantElement);
|
|
59
59
|
const newValue = panelHasActiveDescendant ? this.previousActiveDescendantElement : panel.firstElementChild;
|
|
60
60
|
this.updateDescendants(newValue.id);
|
|
61
|
+
this.updateKeyboardActiveDescendant(newValue.id);
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
clearSuggestions() {
|
|
64
65
|
this.clearSuggestionElements();
|
|
65
66
|
this.updateActiveDescendant();
|
|
67
|
+
this.updateKeyboardActiveDescendant();
|
|
66
68
|
}
|
|
67
69
|
async focusNextValue() {
|
|
68
70
|
if (!this.hasSuggestions || !this.nextOrFirstValue) return;
|
|
@@ -111,6 +113,7 @@ class SuggestionManager {
|
|
|
111
113
|
}
|
|
112
114
|
async executeQuerySuggestion() {
|
|
113
115
|
this.updateActiveDescendant();
|
|
116
|
+
this.updateKeyboardActiveDescendant();
|
|
114
117
|
const settled = await Promise.allSettled(this.suggestions.map((suggestion)=>promiseTimeout(suggestion.onInput ? suggestion.onInput() : Promise.resolve(), this.ownerSearchBoxProps.getSuggestionTimeout())));
|
|
115
118
|
const fulfilledSuggestions = [];
|
|
116
119
|
settled.forEach((prom, j)=>{
|
|
@@ -110,8 +110,8 @@ class AtomicInsightFacet extends LitElement {
|
|
|
110
110
|
label: this.label
|
|
111
111
|
}
|
|
112
112
|
})(html`<ul class="mt-3 ${'box' === this.displayValuesAs ? 'box-container' : ''}" part="values">
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
${children}
|
|
114
|
+
</ul>`);
|
|
115
115
|
}
|
|
116
116
|
renderValues() {
|
|
117
117
|
const firstNewValueIndex = getFirstNewFacetValueIndex(this.facet.state.values, this.valuesBeforeShowMore);
|
|
@@ -8,6 +8,7 @@ import { bindings } from "../../../decorators/bindings.js";
|
|
|
8
8
|
import { errorGuard } from "../../../decorators/error-guard.js";
|
|
9
9
|
import { withTailwindStyles } from "../../../decorators/with-tailwind-styles.js";
|
|
10
10
|
import attach from "../../../images/attach.js";
|
|
11
|
+
import "../../common/atomic-icon/atomic-icon.js";
|
|
11
12
|
function _ts_decorate(decorators, target, key, desc) {
|
|
12
13
|
var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13
14
|
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -9,6 +9,7 @@ import { withTailwindStyles } from "../../../decorators/with-tailwind-styles.js"
|
|
|
9
9
|
import flag from "../../../images/flag.js";
|
|
10
10
|
import three_dots from "../../../images/three-dots.js";
|
|
11
11
|
import { renderUserAction } from "./user-action.js";
|
|
12
|
+
import "../../common/atomic-icon/atomic-icon.js";
|
|
12
13
|
function _ts_decorate(decorators, target, key, desc) {
|
|
13
14
|
var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14
15
|
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -6,6 +6,7 @@ import images_document from "../../../images/document.js";
|
|
|
6
6
|
import point from "../../../images/point.js";
|
|
7
7
|
import quickview from "../../../images/quickview.js";
|
|
8
8
|
import search from "../../../images/search.js";
|
|
9
|
+
import "../../common/atomic-icon/atomic-icon.js";
|
|
9
10
|
const icons = {
|
|
10
11
|
SEARCH: search,
|
|
11
12
|
CLICK: images_document,
|
|
@@ -2,7 +2,7 @@ import { NumberValue, Schema } from "@coveo/bueno";
|
|
|
2
2
|
import { buildFacetManager } from "@coveo/headless";
|
|
3
3
|
import { LitElement, html } from "lit";
|
|
4
4
|
import { customElement, property, state } from "lit/decorators.js";
|
|
5
|
-
import { collapseFacetsAfter, getAutomaticFacetGenerator, getFacetsInChildren, sortFacetVisibility } from "../../common/facets/facet-common.js";
|
|
5
|
+
import { collapseFacetsAfter, getAutomaticFacetGenerator, getFacetElementToReorder, getFacetsInChildren, isFacetNestedInPopover, sortFacetVisibility } from "../../common/facets/facet-common.js";
|
|
6
6
|
import { ValidatePropsController } from "../../common/validate-props-controller/validate-props-controller.js";
|
|
7
7
|
import { bindStateToController } from "../../../decorators/bind-state.js";
|
|
8
8
|
import { bindingGuard } from "../../../decorators/binding-guard.js";
|
|
@@ -45,9 +45,13 @@ class AtomicFacetManager extends ChildrenUpdateCompleteMixin(LightDomMixin(LitEl
|
|
|
45
45
|
const sortedFacets = this.sortFacetsUsingManager(facets, this.facetManager);
|
|
46
46
|
const { visibleFacets, invisibleFacets } = sortFacetVisibility(sortedFacets, this.bindings.store.getAllFacets());
|
|
47
47
|
const generator = getAutomaticFacetGenerator(this);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
this.
|
|
48
|
+
const collapsibleFacets = visibleFacets.filter((facet)=>!isFacetNestedInPopover(facet));
|
|
49
|
+
collapseFacetsAfter(collapsibleFacets, this.collapseFacetsAfter);
|
|
50
|
+
generator?.updateCollapseFacetsDependingOnFacetsVisibility?.(this.collapseFacetsAfter, collapsibleFacets.length);
|
|
51
|
+
this.append(...[
|
|
52
|
+
...visibleFacets,
|
|
53
|
+
...invisibleFacets
|
|
54
|
+
].map((facet)=>getFacetElementToReorder(facet)), ...generator ? [
|
|
51
55
|
generator
|
|
52
56
|
] : []);
|
|
53
57
|
};
|
|
@@ -61,9 +61,8 @@ class AtomicPopover extends LitElement {
|
|
|
61
61
|
.active=${this.isOpen}
|
|
62
62
|
.shouldHideSelf=${false}
|
|
63
63
|
>
|
|
64
|
-
${this.renderPopover()}
|
|
64
|
+
${this.renderPopover()} ${when(this.isOpen, ()=>this.renderBackdrop())}
|
|
65
65
|
</atomic-focus-trap>
|
|
66
|
-
${when(this.isOpen, ()=>this.renderBackdrop())}
|
|
67
66
|
`;
|
|
68
67
|
}
|
|
69
68
|
updated() {
|
|
@@ -194,8 +194,8 @@ class AtomicRatingRangeFacet extends LitElement {
|
|
|
194
194
|
label: this.label
|
|
195
195
|
}
|
|
196
196
|
})(html`<ul class="mt-3" part="values">
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
${children}
|
|
198
|
+
</ul>`);
|
|
199
199
|
}
|
|
200
200
|
renderValues() {
|
|
201
201
|
return this.renderValuesContainer(this.valuesToRender.map((value)=>this.renderValue(value, ()=>this.facet.toggleSingleSelect(value))));
|
|
@@ -212,8 +212,7 @@ class AtomicRatingRangeFacet extends LitElement {
|
|
|
212
212
|
}
|
|
213
213
|
});
|
|
214
214
|
if (!this.valuesToRender.length) return nothing;
|
|
215
|
-
return renderFacetContainer()(html`${this.renderHeader()}
|
|
216
|
-
${when(!this.isCollapsed, ()=>this.renderValues())}`);
|
|
215
|
+
return renderFacetContainer()(html`${this.renderHeader()} ${when(!this.isCollapsed, ()=>this.renderValues())}`);
|
|
217
216
|
})}`;
|
|
218
217
|
}
|
|
219
218
|
constructor(){
|