diff --git a/.changeset/quantic-timeframe-facet-automatic-ranges.md b/.changeset/quantic-timeframe-facet-automatic-ranges.md
new file mode 100644
index 00000000000..6d78c99df47
--- /dev/null
+++ b/.changeset/quantic-timeframe-facet-automatic-ranges.md
@@ -0,0 +1,5 @@
+---
+'@coveo/quantic': minor
+---
+
+Added the `generateAutomaticRanges` public property to `QuanticTimeframeFacet`, allowing the component to display automatically generated date ranges returned by the API in addition to manually defined `c-quantic-timeframe` ranges.
diff --git a/packages/quantic/force-app/examples/main/lwc/exampleQuanticTimeframeFacet/exampleQuanticTimeframeFacet.html b/packages/quantic/force-app/examples/main/lwc/exampleQuanticTimeframeFacet/exampleQuanticTimeframeFacet.html
index 027fb555c4c..007810e2ede 100644
--- a/packages/quantic/force-app/examples/main/lwc/exampleQuanticTimeframeFacet/exampleQuanticTimeframeFacet.html
+++ b/packages/quantic/force-app/examples/main/lwc/exampleQuanticTimeframeFacet/exampleQuanticTimeframeFacet.html
@@ -14,7 +14,8 @@
field={config.field}
label={config.label}
with-date-picker={config.withDatePicker}
- is-collapsed={config.isCollapsed}>
+ is-collapsed={config.isCollapsed}
+ generate-automatic-ranges={config.generateAutomaticRanges}>
diff --git a/packages/quantic/force-app/examples/main/lwc/exampleQuanticTimeframeFacet/exampleQuanticTimeframeFacet.js b/packages/quantic/force-app/examples/main/lwc/exampleQuanticTimeframeFacet/exampleQuanticTimeframeFacet.js
index 7f8f88fd307..2c3617b6198 100644
--- a/packages/quantic/force-app/examples/main/lwc/exampleQuanticTimeframeFacet/exampleQuanticTimeframeFacet.js
+++ b/packages/quantic/force-app/examples/main/lwc/exampleQuanticTimeframeFacet/exampleQuanticTimeframeFacet.js
@@ -33,6 +33,13 @@ export default class ExampleQuanticTimeframeFacet extends LightningElement {
description: 'Whether the facet is initially collapsed.',
defaultValue: false,
},
+ {
+ attribute: 'generateAutomaticRanges',
+ label: 'Generate automatic ranges',
+ description:
+ 'Whether to generate automatic ranges for the facet in addition to the manually defined ranges.',
+ defaultValue: false,
+ },
{
attribute: 'useCase',
label: 'Use Case',
diff --git a/packages/quantic/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js b/packages/quantic/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js
index b44ae7628e7..3c9ab0e4bef 100644
--- a/packages/quantic/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js
+++ b/packages/quantic/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js
@@ -252,6 +252,28 @@ describe('c-quantic-timeframe-facet', () => {
);
});
+ it('should build the facet controller with generateAutomaticRanges set to true when the generateAutomaticRanges property is set to true', async () => {
+ createTestComponent({
+ ...defaultOptions,
+ generateAutomaticRanges: true,
+ });
+ await flushPromises();
+
+ expect(functionsMocks.buildDateFacet).toHaveBeenCalledTimes(1);
+ expect(functionsMocks.buildDateFacet).toHaveBeenCalledWith(
+ exampleEngine,
+ expect.objectContaining({
+ options: expect.objectContaining({
+ field: defaultOptions.field,
+ facetId: defaultOptions.facetId,
+ generateAutomaticRanges: true,
+ sortCriteria: 'descending',
+ injectionDepth: defaultOptions.injectionDepth,
+ }),
+ })
+ );
+ });
+
it('should register the facet to the quantic store', async () => {
const expectedFacetType = 'dateFacets';
const element = createTestComponent();
diff --git a/packages/quantic/force-app/main/default/lwc/quanticTimeframeFacet/quanticTimeframeFacet.js b/packages/quantic/force-app/main/default/lwc/quanticTimeframeFacet/quanticTimeframeFacet.js
index 1b2d0dbfa7d..2b4d056ed2a 100644
--- a/packages/quantic/force-app/main/default/lwc/quanticTimeframeFacet/quanticTimeframeFacet.js
+++ b/packages/quantic/force-app/main/default/lwc/quanticTimeframeFacet/quanticTimeframeFacet.js
@@ -72,7 +72,7 @@ import {api, LightningElement, track} from 'lwc';
* @category Search
* @category Insight Panel
* @example
- *
+ *
*
*
*/
@@ -156,6 +156,13 @@ export default class QuanticTimeframeFacet extends LightningElement {
* @type {DependsOn}
*/
@api dependsOn;
+ /**
+ * Whether to generate automatic ranges for the facet in addition to the manually defined `c-quantic-timeframe` ranges.
+ * @api
+ * @type {boolean}
+ * @defaultValue `false`
+ */
+ @api generateAutomaticRanges = false;
static attributes = [
'facetId',
@@ -165,6 +172,7 @@ export default class QuanticTimeframeFacet extends LightningElement {
'noFilterFacetCount',
'injectionDepth',
'dependsOn',
+ 'generateAutomaticRanges',
];
/** @type {DateFacetState} */
@@ -476,7 +484,7 @@ export default class QuanticTimeframeFacet extends LightningElement {
options: {
field: this.field,
currentValues: this.currentValues,
- generateAutomaticRanges: false,
+ generateAutomaticRanges: this.generateAutomaticRanges,
sortCriteria: 'descending',
filterFacetCount: !this.noFilterFacetCount,
injectionDepth: Number(this.injectionDepth),