@coveo/atomic 3.61.2 → 3.61.3

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.
Files changed (46) hide show
  1. package/custom-elements.json +1226 -1103
  2. package/dist/cjs/components/common/facets/facet-common.tw.css.cjs +4 -0
  3. package/dist/cjs/components/common/facets/facet-visibility-controller.cjs +50 -0
  4. package/dist/cjs/components/common/facets/timeframe-facet-common.cjs +15 -8
  5. package/dist/cjs/components/insight/atomic-insight-facet/atomic-insight-facet.cjs +2 -0
  6. package/dist/cjs/components/insight/atomic-insight-numeric-facet/atomic-insight-numeric-facet.cjs +12 -8
  7. package/dist/cjs/components/insight/atomic-insight-timeframe-facet/atomic-insight-timeframe-facet.cjs +6 -0
  8. package/dist/cjs/components/search/atomic-category-facet/atomic-category-facet.cjs +12 -8
  9. package/dist/cjs/components/search/atomic-color-facet/atomic-color-facet.cjs +2 -0
  10. package/dist/cjs/components/search/atomic-facet/atomic-facet.cjs +2 -0
  11. package/dist/cjs/components/search/atomic-numeric-facet/atomic-numeric-facet.cjs +12 -8
  12. package/dist/cjs/components/search/atomic-rating-facet/atomic-rating-facet.cjs +12 -8
  13. package/dist/cjs/components/search/atomic-rating-range-facet/atomic-rating-range-facet.cjs +12 -8
  14. package/dist/cjs/components/search/atomic-refine-modal/atomic-refine-modal.cjs +4 -2
  15. package/dist/cjs/components/search/atomic-timeframe-facet/atomic-timeframe-facet.cjs +6 -0
  16. package/dist/cjs/global/environment.cjs +1 -1
  17. package/dist/cjs/versions.cjs +1 -1
  18. package/dist/esm/components/common/facets/facet-common.tw.css.js +1 -1
  19. package/dist/esm/components/common/facets/facet-visibility-controller.js +12 -0
  20. package/dist/esm/components/common/facets/timeframe-facet-common.js +15 -8
  21. package/dist/esm/components/insight/atomic-insight-facet/atomic-insight-facet.js +2 -0
  22. package/dist/esm/components/insight/atomic-insight-numeric-facet/atomic-insight-numeric-facet.js +12 -8
  23. package/dist/esm/components/insight/atomic-insight-timeframe-facet/atomic-insight-timeframe-facet.js +6 -0
  24. package/dist/esm/components/search/atomic-category-facet/atomic-category-facet.js +12 -8
  25. package/dist/esm/components/search/atomic-color-facet/atomic-color-facet.js +2 -0
  26. package/dist/esm/components/search/atomic-facet/atomic-facet.js +2 -0
  27. package/dist/esm/components/search/atomic-numeric-facet/atomic-numeric-facet.js +12 -8
  28. package/dist/esm/components/search/atomic-rating-facet/atomic-rating-facet.js +12 -8
  29. package/dist/esm/components/search/atomic-rating-range-facet/atomic-rating-range-facet.js +12 -8
  30. package/dist/esm/components/search/atomic-refine-modal/atomic-refine-modal.js +4 -2
  31. package/dist/esm/components/search/atomic-timeframe-facet/atomic-timeframe-facet.js +6 -0
  32. package/dist/esm/global/environment.js +1 -1
  33. package/dist/esm/versions.js +1 -1
  34. package/dist/types/components/common/facets/facet-visibility-controller.d.ts +7 -0
  35. package/dist/types/components/common/facets/timeframe-facet-common.d.ts +2 -0
  36. package/dist/types/components/insight/atomic-insight-facet/atomic-insight-facet.d.ts +2 -0
  37. package/dist/types/components/insight/atomic-insight-numeric-facet/atomic-insight-numeric-facet.d.ts +3 -0
  38. package/dist/types/components/insight/atomic-insight-timeframe-facet/atomic-insight-timeframe-facet.d.ts +3 -0
  39. package/dist/types/components/search/atomic-category-facet/atomic-category-facet.d.ts +3 -0
  40. package/dist/types/components/search/atomic-color-facet/atomic-color-facet.d.ts +2 -0
  41. package/dist/types/components/search/atomic-facet/atomic-facet.d.ts +2 -0
  42. package/dist/types/components/search/atomic-numeric-facet/atomic-numeric-facet.d.ts +3 -0
  43. package/dist/types/components/search/atomic-rating-facet/atomic-rating-facet.d.ts +3 -0
  44. package/dist/types/components/search/atomic-rating-range-facet/atomic-rating-range-facet.d.ts +3 -0
  45. package/dist/types/components/search/atomic-timeframe-facet/atomic-timeframe-facet.d.ts +3 -0
  46. package/package.json +4 -4
@@ -13,6 +13,7 @@ import { renderNumericFacetValue } from "../../common/facets/numeric-facet/value
13
13
  import { renderNumericFacetValuesGroup } from "../../common/facets/numeric-facet/values-container.js";
14
14
  import numeric_facet_common_tw_css from "../../common/facets/numeric-facet-common.tw.css.js";
15
15
  import { initializePopover } from "../../common/facets/popover/popover-type.js";
16
+ import { FacetVisibilityController } from "../../common/facets/facet-visibility-controller.js";
16
17
  import { defaultNumberFormatter } from "../../common/formats/format-common.js";
17
18
  import { ValidatePropsController } from "../../common/validate-props-controller/validate-props-controller.js";
18
19
  import { bindStateToController } from "../../../decorators/bind-state.js";
@@ -35,6 +36,14 @@ function _ts_metadata(metadataKey, metadataValue) {
35
36
  if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(metadataKey, metadataValue);
36
37
  }
37
38
  class AtomicInsightNumericFacet extends LitElement {
39
+ get facetInfo() {
40
+ return {
41
+ label: ()=>this.bindings.i18n.t(this.label),
42
+ facetId: this.facetId,
43
+ element: this,
44
+ isHidden: ()=>this.isHidden
45
+ };
46
+ }
38
47
  initialize() {
39
48
  this.computeFacetId();
40
49
  this.initializeFacetForInput();
@@ -175,14 +184,8 @@ class AtomicInsightNumericFacet extends LitElement {
175
184
  });
176
185
  }
177
186
  registerFacetToStore() {
178
- const facetInfo = {
179
- label: ()=>this.bindings.i18n.t(this.label),
180
- facetId: this.facetId,
181
- element: this,
182
- isHidden: ()=>this.isHidden
183
- };
184
187
  this.bindings.store.registerFacet('numericFacets', {
185
- ...facetInfo,
188
+ ...this.facetInfo,
186
189
  format: (value)=>formatHumanReadable({
187
190
  facetValue: value,
188
191
  logger: this.bindings.engine.logger,
@@ -193,7 +196,7 @@ class AtomicInsightNumericFacet extends LitElement {
193
196
  })
194
197
  });
195
198
  initializePopover(this, {
196
- ...facetInfo,
199
+ ...this.facetInfo,
197
200
  hasValues: ()=>this.hasValues,
198
201
  numberOfActiveValues: ()=>this.numberOfSelectedValues
199
202
  });
@@ -294,6 +297,7 @@ class AtomicInsightNumericFacet extends LitElement {
294
297
  }
295
298
  constructor(){
296
299
  super(), this.label = 'no-label', this.numberOfValues = 8, this.sortCriteria = 'ascending', this.rangeAlgorithm = 'equiprobable', this.displayValuesAs = 'checkbox', this.isCollapsed = false, this.headingLevel = 0, this.filterFacetCount = true, this.injectionDepth = 1000, this.manualRanges = [], this.formatter = defaultNumberFormatter;
300
+ new FacetVisibilityController(this, ()=>!!this.searchStatus && this.facetInfo.isHidden());
297
301
  new ValidatePropsController(this, ()=>({
298
302
  displayValuesAs: this.displayValuesAs,
299
303
  withInput: this.withInput
@@ -5,6 +5,7 @@ import { customElement, property, state } from "lit/decorators.js";
5
5
  import { when } from "lit/directives/when.js";
6
6
  import { parseDependsOn } from "../../common/facets/depends-on.js";
7
7
  import facet_common_tw_css from "../../common/facets/facet-common.tw.css.js";
8
+ import { FacetVisibilityController } from "../../common/facets/facet-visibility-controller.js";
8
9
  import { renderFacetPlaceholder } from "../../common/facets/facet-placeholder/facet-placeholder.js";
9
10
  import { TimeframeFacetCommon } from "../../common/facets/timeframe-facet-common.js";
10
11
  import { ValidatePropsController } from "../../common/validate-props-controller/validate-props-controller.js";
@@ -26,6 +27,10 @@ function _ts_metadata(metadataKey, metadataValue) {
26
27
  if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(metadataKey, metadataValue);
27
28
  }
28
29
  class AtomicInsightTimeframeFacet extends LitElement {
30
+ get isHidden() {
31
+ if (!this.timeframeFacetCommon || !this.searchStatusState) return false;
32
+ return this.timeframeFacetCommon.isHostHidden(this.searchStatusState);
33
+ }
29
34
  get focusTarget() {
30
35
  if (!this.headerFocus) this.headerFocus = new FocusTargetController(this, this.bindings);
31
36
  return this.headerFocus;
@@ -118,6 +123,7 @@ class AtomicInsightTimeframeFacet extends LitElement {
118
123
  super(), this.label = 'no-label', this.field = 'date', this.withDatePicker = false, this.isCollapsed = false, this.headingLevel = 0, this.filterFacetCount = true, this.injectionDepth = 1000, this.sortCriteria = 'descending', this.handleDateInputApply = ()=>{
119
124
  if (this.facetId) this.bindings.engine.dispatch(loadDateFacetSetActions(this.bindings.engine).deselectAllDateFacetValues(this.facetId));
120
125
  };
126
+ new FacetVisibilityController(this, ()=>this.isHidden);
121
127
  new ValidatePropsController(this, ()=>({
122
128
  injectionDepth: this.injectionDepth,
123
129
  headingLevel: this.headingLevel,
@@ -15,6 +15,7 @@ import { renderCategoryFacetTreeValueContainer } from "../../common/facets/categ
15
15
  import { renderCategoryFacetValueLink } from "../../common/facets/category-facet/value-link.js";
16
16
  import { parseDependsOn } from "../../common/facets/depends-on.js";
17
17
  import facet_common_tw_css from "../../common/facets/facet-common.tw.css.js";
18
+ import { FacetVisibilityController } from "../../common/facets/facet-visibility-controller.js";
18
19
  import { renderFacetContainer } from "../../common/facets/facet-container/facet-container.js";
19
20
  import { renderFacetHeader } from "../../common/facets/facet-header/facet-header.js";
20
21
  import { renderFacetPlaceholder } from "../../common/facets/facet-placeholder/facet-placeholder.js";
@@ -47,6 +48,14 @@ function _ts_metadata(metadataKey, metadataValue) {
47
48
  if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(metadataKey, metadataValue);
48
49
  }
49
50
  class AtomicCategoryFacet extends LitElement {
51
+ get facetInfo() {
52
+ return {
53
+ label: ()=>this.bindings.i18n.t(this.label),
54
+ facetId: this.facetId,
55
+ element: this,
56
+ isHidden: ()=>this.isHidden
57
+ };
58
+ }
50
59
  initialize() {
51
60
  if (this.tabsIncluded.length > 0 && this.tabsExcluded.length > 0) console.warn('Values for both "tabs-included" and "tabs-excluded" have been provided. This could lead to unexpected behaviors.');
52
61
  this.searchStatus = buildSearchStatus(this.bindings.engine);
@@ -76,15 +85,9 @@ class AtomicCategoryFacet extends LitElement {
76
85
  announceFacetSearchResultsWithAriaLive(this.facet, this.label, (msg)=>{
77
86
  this.facetSearchAriaMessage.message = msg;
78
87
  }, this.bindings.i18n);
79
- const facetInfo = {
80
- label: ()=>this.bindings.i18n.t(this.label),
81
- facetId: this.facetId,
82
- element: this,
83
- isHidden: ()=>this.isHidden
84
- };
85
- this.bindings.store.registerFacet('categoryFacets', facetInfo);
88
+ this.bindings.store.registerFacet('categoryFacets', this.facetInfo);
86
89
  initializePopover(this, {
87
- ...facetInfo,
90
+ ...this.facetInfo,
88
91
  hasValues: ()=>!!this.facet.state.valuesAsTrees.length,
89
92
  numberOfActiveValues: ()=>this.facetState.hasActiveValues ? 1 : 0
90
93
  });
@@ -360,6 +363,7 @@ class AtomicCategoryFacet extends LitElement {
360
363
  }
361
364
  constructor(){
362
365
  super(), this.resultIndexToFocusOnShowMore = 0, this.label = 'no-label', this.tabsIncluded = [], this.tabsExcluded = [], this.numberOfValues = 8, this.withSearch = false, this.sortCriteria = 'occurrences', this.delimitingCharacter = ';', this.basePath = [], this.filterByBasePath = true, this.isCollapsed = false, this.headingLevel = 0, this.filterFacetCount = true, this.injectionDepth = 1000, this.facetSearchAriaMessage = new AriaLiveRegionController(this, 'facet-search');
366
+ new FacetVisibilityController(this, ()=>!!this.facet && this.facetInfo.isHidden());
363
367
  new ValidatePropsController(this, ()=>({
364
368
  field: this.field,
365
369
  numberOfValues: this.numberOfValues,
@@ -6,6 +6,7 @@ import { when } from "lit/directives/when.js";
6
6
  import { parseDependsOn } from "../../common/facets/depends-on.js";
7
7
  import { getFirstNewFacetValueIndex } from "../../common/facets/facet-common.js";
8
8
  import facet_common_tw_css from "../../common/facets/facet-common.tw.css.js";
9
+ import { FacetVisibilityController } from "../../common/facets/facet-visibility-controller.js";
9
10
  import { renderFacetContainer } from "../../common/facets/facet-container/facet-container.js";
10
11
  import { renderFacetHeader } from "../../common/facets/facet-header/facet-header.js";
11
12
  import { renderFacetPlaceholder } from "../../common/facets/facet-placeholder/facet-placeholder.js";
@@ -309,6 +310,7 @@ class AtomicColorFacet extends LitElement {
309
310
  }
310
311
  constructor(){
311
312
  super(), this.label = 'no-label', this.tabsIncluded = [], this.tabsExcluded = [], this.numberOfValues = 8, this.withSearch = true, this.sortCriteria = 'automatic', this.resultsMustMatch = 'atLeastOneValue', this.displayValuesAs = 'box', this.isCollapsed = false, this.headingLevel = 0, this.filterFacetCount = true, this.injectionDepth = 1000, this.allowedValues = [], this.customSort = [], this.valuesBeforeShowMore = new Set();
313
+ new FacetVisibilityController(this, ()=>!!this.facet && this.facetInfo.isHidden());
312
314
  new ValidatePropsController(this, ()=>({
313
315
  field: this.field,
314
316
  numberOfValues: this.numberOfValues,
@@ -28,6 +28,7 @@ import { arrayConverter } from "../../../converters/array-converter.js";
28
28
  import { booleanConverter } from "../../../converters/boolean-converter.js";
29
29
  import { bindings } from "../../../decorators/bindings.js";
30
30
  import facet_common_tw_css from "../../common/facets/facet-common.tw.css.js";
31
+ import { FacetVisibilityController } from "../../common/facets/facet-visibility-controller.js";
31
32
  import facet_search_tw_css from "../../common/facets/facet-search/facet-search.tw.css.js";
32
33
  import facet_value_box_tw_css from "../../common/facets/facet-value-box/facet-value-box.tw.css.js";
33
34
  import facet_value_checkbox_tw_css from "../../common/facets/facet-value-checkbox/facet-value-checkbox.tw.css.js";
@@ -290,6 +291,7 @@ class AtomicFacet extends LitElement {
290
291
  }
291
292
  constructor(){
292
293
  super(), this.label = 'no-label', this.tabsIncluded = [], this.tabsExcluded = [], this.numberOfValues = 8, this.withSearch = true, this.sortCriteria = 'automatic', this.resultsMustMatch = 'atLeastOneValue', this.displayValuesAs = 'checkbox', this.isCollapsed = false, this.headingLevel = 0, this.filterFacetCount = true, this.enableExclusion = false, this.injectionDepth = 1000, this.allowedValues = [], this.customSort = [], this.valuesBeforeShowMore = new Set();
294
+ new FacetVisibilityController(this, ()=>!!this.facet && this.facetInfo.isHidden());
293
295
  new ValidatePropsController(this, ()=>({
294
296
  field: this.field,
295
297
  numberOfValues: this.numberOfValues,
@@ -5,6 +5,7 @@ import { customElement, property, state as decorators_js_state } from "lit/decor
5
5
  import { when } from "lit/directives/when.js";
6
6
  import { parseDependsOn } from "../../common/facets/depends-on.js";
7
7
  import { shouldDisplayInputForFacetRange } from "../../common/facets/facet-common.js";
8
+ import { FacetVisibilityController } from "../../common/facets/facet-visibility-controller.js";
8
9
  import { renderFacetContainer } from "../../common/facets/facet-container/facet-container.js";
9
10
  import { renderFacetHeader } from "../../common/facets/facet-header/facet-header.js";
10
11
  import { renderFacetPlaceholder } from "../../common/facets/facet-placeholder/facet-placeholder.js";
@@ -36,6 +37,14 @@ function _ts_metadata(metadataKey, metadataValue) {
36
37
  if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(metadataKey, metadataValue);
37
38
  }
38
39
  class AtomicNumericFacet extends LitElement {
40
+ get facetInfo() {
41
+ return {
42
+ label: ()=>this.bindings.i18n.t(this.label),
43
+ facetId: this.facetId,
44
+ element: this,
45
+ isHidden: ()=>this.isHidden
46
+ };
47
+ }
39
48
  initialize() {
40
49
  this.validateTabs();
41
50
  this.initializeTabManager();
@@ -195,14 +204,8 @@ class AtomicNumericFacet extends LitElement {
195
204
  });
196
205
  }
197
206
  registerFacetToStore() {
198
- const facetInfo = {
199
- label: ()=>this.bindings.i18n.t(this.label),
200
- facetId: this.facetId,
201
- element: this,
202
- isHidden: ()=>this.isHidden
203
- };
204
207
  this.bindings.store.registerFacet('numericFacets', {
205
- ...facetInfo,
208
+ ...this.facetInfo,
206
209
  format: (value)=>formatHumanReadable({
207
210
  facetValue: value,
208
211
  logger: this.bindings.engine.logger,
@@ -213,7 +216,7 @@ class AtomicNumericFacet extends LitElement {
213
216
  })
214
217
  });
215
218
  initializePopover(this, {
216
- ...facetInfo,
219
+ ...this.facetInfo,
217
220
  hasValues: ()=>this.hasValues,
218
221
  numberOfActiveValues: ()=>this.numberOfSelectedValues
219
222
  });
@@ -314,6 +317,7 @@ class AtomicNumericFacet extends LitElement {
314
317
  }
315
318
  constructor(){
316
319
  super(), this.label = 'no-label', this.tabsIncluded = [], this.tabsExcluded = [], this.numberOfValues = 8, this.sortCriteria = 'ascending', this.rangeAlgorithm = 'equiprobable', this.displayValuesAs = 'checkbox', this.isCollapsed = false, this.headingLevel = 0, this.filterFacetCount = true, this.injectionDepth = 1000, this.manualRanges = [], this.formatter = defaultNumberFormatter, this.conditionManagers = [];
320
+ new FacetVisibilityController(this, ()=>!!this.searchStatus && this.facetInfo.isHidden());
317
321
  new ValidatePropsController(this, ()=>({
318
322
  displayValuesAs: this.displayValuesAs,
319
323
  withInput: this.withInput
@@ -7,6 +7,7 @@ import atomic_rating_tw_css from "../../common/atomic-rating/atomic-rating.tw.cs
7
7
  import { renderRating } from "../../common/atomic-rating/rating.js";
8
8
  import { parseDependsOn } from "../../common/facets/depends-on.js";
9
9
  import facet_common_tw_css from "../../common/facets/facet-common.tw.css.js";
10
+ import { FacetVisibilityController } from "../../common/facets/facet-visibility-controller.js";
10
11
  import { renderFacetContainer } from "../../common/facets/facet-container/facet-container.js";
11
12
  import { renderFacetHeader } from "../../common/facets/facet-header/facet-header.js";
12
13
  import { renderFacetPlaceholder } from "../../common/facets/facet-placeholder/facet-placeholder.js";
@@ -40,6 +41,14 @@ class AtomicRatingFacet extends LitElement {
40
41
  if (!this.headerFocus) this.headerFocus = new FocusTargetController(this, this.bindings);
41
42
  return this.headerFocus;
42
43
  }
44
+ get facetInfo() {
45
+ return {
46
+ label: ()=>this.bindings.i18n.t(this.label),
47
+ facetId: this.facetId,
48
+ element: this,
49
+ isHidden: ()=>this.isHidden
50
+ };
51
+ }
43
52
  connectedCallback() {
44
53
  super.connectedCallback();
45
54
  if (void 0 === this.maxValueInIndex) this.maxValueInIndex = this.numberOfIntervals;
@@ -85,19 +94,13 @@ class AtomicRatingFacet extends LitElement {
85
94
  options
86
95
  });
87
96
  this.facetId = this.facet.state.facetId;
88
- const facetInfo = {
89
- label: ()=>this.bindings.i18n.t(this.label),
90
- facetId: this.facetId,
91
- element: this,
92
- isHidden: ()=>this.isHidden
93
- };
94
97
  this.bindings.store.registerFacet('numericFacets', {
95
- ...facetInfo,
98
+ ...this.facetInfo,
96
99
  format: (value)=>this.formatFacetValue(value),
97
100
  content: (value)=>this.ratingContent(value)
98
101
  });
99
102
  initializePopover(this, {
100
- ...facetInfo,
103
+ ...this.facetInfo,
101
104
  hasValues: ()=>!!this.valuesToRender.length,
102
105
  numberOfActiveValues: ()=>this.numberOfSelectedValues
103
106
  });
@@ -224,6 +227,7 @@ class AtomicRatingFacet extends LitElement {
224
227
  }
225
228
  constructor(){
226
229
  super(), this.label = 'no-label', this.numberOfIntervals = 5, this.tabsIncluded = [], this.tabsExcluded = [], this.minValueInIndex = 1, this.displayValuesAs = 'checkbox', this.icon = star, this.isCollapsed = false, this.headingLevel = 0, this.injectionDepth = 1000;
230
+ new FacetVisibilityController(this, ()=>!!this.facet && this.facetInfo.isHidden());
227
231
  new ValidatePropsController(this, ()=>({
228
232
  field: this.field,
229
233
  numberOfIntervals: this.numberOfIntervals,
@@ -7,6 +7,7 @@ import atomic_rating_tw_css from "../../common/atomic-rating/atomic-rating.tw.cs
7
7
  import { renderRating } from "../../common/atomic-rating/rating.js";
8
8
  import { parseDependsOn } from "../../common/facets/depends-on.js";
9
9
  import facet_common_tw_css from "../../common/facets/facet-common.tw.css.js";
10
+ import { FacetVisibilityController } from "../../common/facets/facet-visibility-controller.js";
10
11
  import { renderFacetContainer } from "../../common/facets/facet-container/facet-container.js";
11
12
  import { renderFacetHeader } from "../../common/facets/facet-header/facet-header.js";
12
13
  import { renderFacetPlaceholder } from "../../common/facets/facet-placeholder/facet-placeholder.js";
@@ -35,6 +36,14 @@ function _ts_metadata(metadataKey, metadataValue) {
35
36
  if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(metadataKey, metadataValue);
36
37
  }
37
38
  class AtomicRatingRangeFacet extends LitElement {
39
+ get facetInfo() {
40
+ return {
41
+ label: ()=>this.bindings.i18n.t(this.label),
42
+ facetId: this.facetId,
43
+ element: this,
44
+ isHidden: ()=>this.isHidden
45
+ };
46
+ }
38
47
  connectedCallback() {
39
48
  super.connectedCallback();
40
49
  if (void 0 === this.maxValueInIndex) this.maxValueInIndex = this.numberOfIntervals;
@@ -83,19 +92,13 @@ class AtomicRatingRangeFacet extends LitElement {
83
92
  options
84
93
  });
85
94
  this.facetId = this.facet.state.facetId;
86
- const facetInfo = {
87
- label: ()=>this.bindings.i18n.t(this.label),
88
- facetId: this.facetId,
89
- element: this,
90
- isHidden: ()=>this.isHidden
91
- };
92
95
  this.bindings.store.registerFacet('numericFacets', {
93
- ...facetInfo,
96
+ ...this.facetInfo,
94
97
  format: (value)=>this.formatFacetValue(value),
95
98
  content: (value)=>this.ratingContent(value)
96
99
  });
97
100
  initializePopover(this, {
98
- ...facetInfo,
101
+ ...this.facetInfo,
99
102
  hasValues: ()=>!!this.valuesToRender.length,
100
103
  numberOfActiveValues: ()=>this.numberOfSelectedValues
101
104
  });
@@ -215,6 +218,7 @@ class AtomicRatingRangeFacet extends LitElement {
215
218
  }
216
219
  constructor(){
217
220
  super(), this.label = 'no-label', this.tabsIncluded = [], this.tabsExcluded = [], this.numberOfIntervals = 5, this.minValueInIndex = 1, this.icon = star, this.isCollapsed = false, this.headingLevel = 0, this.injectionDepth = 1000;
221
+ new FacetVisibilityController(this, ()=>!!this.facet && this.facetInfo.isHidden());
218
222
  new ValidatePropsController(this, ()=>({
219
223
  field: this.field,
220
224
  numberOfIntervals: this.numberOfIntervals,
@@ -103,8 +103,10 @@ class AtomicRefineModal extends LitElement {
103
103
  const visibleFacetsClone = this.cloneFacets(visibleFacets);
104
104
  const invisibleFacetsClone = this.cloneFacets(invisibleFacets);
105
105
  collapseFacetsAfter(visibleFacetsClone, this.collapseFacetsAfter);
106
- divSlot.append(...visibleFacetsClone);
107
- divSlot.append(...invisibleFacetsClone);
106
+ const clonesByFacet = new Map();
107
+ visibleFacets.forEach((facet, index)=>clonesByFacet.set(facet, visibleFacetsClone[index]));
108
+ invisibleFacets.forEach((facet, index)=>clonesByFacet.set(facet, invisibleFacetsClone[index]));
109
+ divSlot.append(...sortedFacets.map((facet)=>clonesByFacet.get(facet)));
108
110
  const generator = this.makeAutomaticFacetGenerator();
109
111
  if (generator) {
110
112
  generator.updateCollapseFacetsDependingOnFacetsVisibility(this.collapseFacetsAfter, visibleFacets.length);
@@ -5,6 +5,7 @@ import { customElement, property, state } from "lit/decorators.js";
5
5
  import { when } from "lit/directives/when.js";
6
6
  import { parseDependsOn } from "../../common/facets/depends-on.js";
7
7
  import facet_common_tw_css from "../../common/facets/facet-common.tw.css.js";
8
+ import { FacetVisibilityController } from "../../common/facets/facet-visibility-controller.js";
8
9
  import { renderFacetPlaceholder } from "../../common/facets/facet-placeholder/facet-placeholder.js";
9
10
  import { TimeframeFacetCommon } from "../../common/facets/timeframe-facet-common.js";
10
11
  import { ValidatePropsController } from "../../common/validate-props-controller/validate-props-controller.js";
@@ -27,6 +28,10 @@ function _ts_metadata(metadataKey, metadataValue) {
27
28
  if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(metadataKey, metadataValue);
28
29
  }
29
30
  class AtomicTimeframeFacet extends LitElement {
31
+ get isHidden() {
32
+ if (!this.timeframeFacetCommon || !this.searchStatusState) return false;
33
+ return this.timeframeFacetCommon.isHostHidden(this.searchStatusState);
34
+ }
30
35
  get focusTarget() {
31
36
  if (!this.headerFocus) this.headerFocus = new FocusTargetController(this, this.bindings);
32
37
  return this.headerFocus;
@@ -135,6 +140,7 @@ class AtomicTimeframeFacet extends LitElement {
135
140
  super(), this.label = 'no-label', this.field = 'date', this.tabsIncluded = [], this.tabsExcluded = [], this.withDatePicker = false, this.isCollapsed = false, this.headingLevel = 0, this.filterFacetCount = true, this.injectionDepth = 1000, this.sortCriteria = 'descending', this.handleDateInputApply = ()=>{
136
141
  if (this.facetId) this.bindings.engine.dispatch(loadDateFacetSetActions(this.bindings.engine).deselectAllDateFacetValues(this.facetId));
137
142
  };
143
+ new FacetVisibilityController(this, ()=>this.isHidden);
138
144
  new ValidatePropsController(this, ()=>({
139
145
  injectionDepth: this.injectionDepth,
140
146
  headingLevel: this.headingLevel,
@@ -3,7 +3,7 @@ function getWindow() {
3
3
  }
4
4
  function getAtomicEnvironment(headlessVersion) {
5
5
  return {
6
- version: "3.61.2",
6
+ version: "3.61.3",
7
7
  headlessVersion
8
8
  };
9
9
  }
@@ -1,3 +1,3 @@
1
- const atomicVersion = "3.61.2";
1
+ const atomicVersion = "3.61.3";
2
2
  export { version as headlessVersion } from "@coveo/headless/package.json";
3
3
  export { atomicVersion };
@@ -0,0 +1,7 @@
1
+ import type { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ export declare class FacetVisibilityController implements ReactiveController {
3
+ private readonly isHidden;
4
+ private readonly internals;
5
+ constructor(host: ReactiveControllerHost & HTMLElement, isHidden: () => boolean);
6
+ hostUpdate(): void;
7
+ }
@@ -61,6 +61,8 @@ export declare class TimeframeFacetCommon {
61
61
  private get hasInputRange();
62
62
  get currentValues(): DateRangeRequest[];
63
63
  disconnectedCallback(): void;
64
+ isHostHidden({ hasError, firstSearchExecuted, }: Pick<SearchStatusState, 'hasError' | 'firstSearchExecuted'>): boolean;
65
+ private get facetInfo();
64
66
  private get isHidden();
65
67
  private registerFacetToStore;
66
68
  private getManualTimeframes;
@@ -7,6 +7,8 @@ import '../../common/atomic-facet-placeholder/atomic-facet-placeholder';
7
7
  * The `atomic-insight-facet` component displays a facet of the results for the current query in an Insight interface.
8
8
  * A facet is a list of values for a certain field occurring in the results, ordered using a configurable criteria (for example, number of occurrences).
9
9
  *
10
+ * @cssState hidden - Applied when the facet is hidden.
11
+ *
10
12
  * @part facet - The wrapper for the entire facet.
11
13
  * @part placeholder - The placeholder shown before the first search is executed.
12
14
  * @part label-button - The button that displays the label and allows to expand/collapse the facet.
@@ -9,6 +9,8 @@ import '../../common/atomic-numeric-range/atomic-numeric-range';
9
9
  * The `atomic-insight-numeric-facet` component displays a facet of the results for the current query as numeric ranges.
10
10
  * A facet is a list of values for a certain field occurring in the results, ordered using a configurable criteria.
11
11
  *
12
+ * @cssState hidden - Applied when the facet is hidden.
13
+ *
12
14
  * @part facet - The wrapper for the entire facet.
13
15
  * @part placeholder - The placeholder shown before the first search is executed.
14
16
  * @part label-button - The button that displays the label and allows to expand/collapse the facet.
@@ -134,6 +136,7 @@ export declare class AtomicInsightNumericFacet extends LitElement implements Ini
134
136
  private unsubscribeFacetForRange?;
135
137
  private unsubscribeFacetForInput?;
136
138
  private unsubscribeFilter?;
139
+ private get facetInfo();
137
140
  constructor();
138
141
  initialize(): void;
139
142
  connectedCallback(): void;
@@ -5,6 +5,8 @@ import type { InitializableComponent } from '../../../decorators/types';
5
5
  /**
6
6
  * The `atomic-insight-timeframe-facet` component displays a facet of results for the current query as date intervals.
7
7
  *
8
+ * @cssState hidden - Applied when the facet is hidden.
9
+ *
8
10
  * @slot default - The atomic-timeframe components defining the timeframes to display.
9
11
  *
10
12
  * @part facet - The wrapper for the entire facet.
@@ -96,6 +98,7 @@ export declare class AtomicInsightTimeframeFacet extends LitElement implements I
96
98
  private headerFocus?;
97
99
  private timeframeFacetCommon?;
98
100
  constructor();
101
+ private get isHidden();
99
102
  private get focusTarget();
100
103
  initialize(): void;
101
104
  disconnectedCallback(): void;
@@ -5,6 +5,8 @@ import type { InitializableComponent } from '../../../decorators/types';
5
5
  /**
6
6
  * The `atomic-category-facet` component displays a facet of values in a browsable, hierarchical fashion.
7
7
  *
8
+ * @cssState hidden - Applied when the facet is hidden.
9
+ *
8
10
  * @part facet - The wrapper for the entire facet.
9
11
  * @part placeholder - The placeholder shown before the first search is executed.
10
12
  *
@@ -163,6 +165,7 @@ export declare class AtomicCategoryFacet extends LitElement implements Initializ
163
165
  private headerFocus?;
164
166
  private activeValueFocus?;
165
167
  private facetSearchAriaMessage;
168
+ private get facetInfo();
166
169
  constructor();
167
170
  initialize(): void;
168
171
  disconnectedCallback(): void;
@@ -5,6 +5,8 @@ import type { InitializableComponent } from '../../../decorators/types';
5
5
  /**
6
6
  * The `atomic-color-facet` component displays facet values as color boxes or checkboxes with color indicators.
7
7
  *
8
+ * @cssState hidden - Applied when the facet is hidden.
9
+ *
8
10
  * @part facet - The wrapper for the entire facet.
9
11
  * @part placeholder - The placeholder shown before the first search is executed.
10
12
  *
@@ -7,6 +7,8 @@ import '../../common/atomic-facet-placeholder/atomic-facet-placeholder';
7
7
  * A facet is a list of values for a certain field occurring in the results, ordered using a configurable criteria (for example, number of occurrences).
8
8
  * An `atomic-facet` displays a facet of the results for the current query.
9
9
  *
10
+ * @cssState hidden - Applied when the facet is hidden.
11
+ *
10
12
  * @part facet - The wrapper for the entire facet.
11
13
  * @part placeholder - The placeholder shown before the first search is executed.
12
14
  *
@@ -9,6 +9,8 @@ import '../../common/atomic-numeric-range/atomic-numeric-range';
9
9
  * The `atomic-numeric-facet` component displays a facet of the results for the current query as numeric ranges.
10
10
  * A facet is a list of values for a certain field occurring in the results, ordered using a configurable criteria.
11
11
  *
12
+ * @cssState hidden - Applied when the facet is hidden.
13
+ *
12
14
  * @part facet - The wrapper for the entire facet.
13
15
  * @part placeholder - The placeholder shown before the first search is executed.
14
16
  * @part label-button - The button that displays the label and allows to expand/collapse the facet.
@@ -149,6 +151,7 @@ export declare class AtomicNumericFacet extends LitElement implements Initializa
149
151
  tabManager: TabManager;
150
152
  private manualRanges;
151
153
  private formatter;
154
+ private get facetInfo();
152
155
  constructor();
153
156
  private conditionManagers;
154
157
  private headerFocus?;
@@ -7,6 +7,8 @@ import type { InitializableComponent } from '../../../decorators/types';
7
7
  * An `atomic-rating-facet` displays a facet of the results for the current query as ratings.
8
8
  * It only supports numeric fields.
9
9
  *
10
+ * @cssState hidden - Applied when the facet is hidden.
11
+ *
10
12
  * @part facet - The wrapper for the entire facet.
11
13
  * @part placeholder - The placeholder shown before the first search is executed.
12
14
  *
@@ -135,6 +137,7 @@ export declare class AtomicRatingFacet extends LitElement implements Initializab
135
137
  dependsOn: Record<string, string>;
136
138
  private headerFocus?;
137
139
  private get focusTarget();
140
+ private get facetInfo();
138
141
  constructor();
139
142
  connectedCallback(): void;
140
143
  private get _filterFacetCount();
@@ -7,6 +7,8 @@ import type { InitializableComponent } from '../../../decorators/types';
7
7
  * An `atomic-rating-range-facet` displays a facet of the results for the current query as ratings.
8
8
  * It only supports numeric fields.
9
9
  *
10
+ * @cssState hidden - Applied when the facet is hidden.
11
+ *
10
12
  * @part facet - The wrapper for the entire facet.
11
13
  * @part placeholder - The placeholder shown before the first search is executed.
12
14
  *
@@ -136,6 +138,7 @@ export declare class AtomicRatingRangeFacet extends LitElement implements Initia
136
138
  * ```
137
139
  */
138
140
  dependsOn: Record<string, string>;
141
+ private get facetInfo();
139
142
  constructor();
140
143
  connectedCallback(): void;
141
144
  private get _filterFacetCount();
@@ -5,6 +5,8 @@ import type { InitializableComponent } from '../../../decorators/types';
5
5
  /**
6
6
  * The `atomic-timeframe-facet` component displays a facet of results for the current query as date intervals.
7
7
  *
8
+ * @cssState hidden - Applied when the facet is hidden.
9
+ *
8
10
  * @slot default - The atomic-timeframe components defining the timeframes to display.
9
11
  *
10
12
  * @part facet - The wrapper for the entire facet.
@@ -138,6 +140,7 @@ export declare class AtomicTimeframeFacet extends LitElement implements Initiali
138
140
  private headerFocus?;
139
141
  private timeframeFacetCommon?;
140
142
  constructor();
143
+ private get isHidden();
141
144
  private get focusTarget();
142
145
  initialize(): void;
143
146
  disconnectedCallback(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coveo/atomic",
3
- "version": "3.61.2",
3
+ "version": "3.61.3",
4
4
  "description": "A web-component library for building modern UIs interfacing with the Coveo platform",
5
5
  "homepage": "https://docs.coveo.com/en/atomic/latest/",
6
6
  "license": "Apache-2.0",
@@ -55,9 +55,9 @@
55
55
  "./custom-elements-manifest": "./custom-elements.json"
56
56
  },
57
57
  "dependencies": {
58
- "@coveo/atomic-legacy": "0.1.3",
58
+ "@coveo/atomic-legacy": "0.1.4",
59
59
  "@coveo/bueno": "1.1.9",
60
- "@coveo/headless": "3.55.4",
60
+ "@coveo/headless": "3.56.0",
61
61
  "@coveo/relay-event-types": "20.5.1",
62
62
  "@lit/context": "1.1.6",
63
63
  "@open-wc/lit-helpers": "0.7.0",
@@ -119,7 +119,7 @@
119
119
  },
120
120
  "peerDependencies": {
121
121
  "@coveo/bueno": "^1.1.9",
122
- "@coveo/headless": "^3.55.4",
122
+ "@coveo/headless": "^3.56.0",
123
123
  "typescript": ">=5.0.0"
124
124
  },
125
125
  "peerDependenciesMeta": {