Skip to content

Commit eace955

Browse files
chore(atomic): migrate atomic-result-list (#6189)
Co-authored-by: developer-experience-bot[bot] <91079284+developer-experience-bot[bot]@users.noreply.github.com>
1 parent 7b06c77 commit eace955

File tree

33 files changed

+2161
-710
lines changed

33 files changed

+2161
-710
lines changed

packages/atomic-angular/projects/atomic-angular/src/lib/stencil-generated/atomic-angular.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ AtomicProductText,
6565
AtomicQuerySummary,
6666
AtomicResult,
6767
AtomicResultChildrenTemplate,
68+
AtomicResultList,
6869
AtomicResultSectionActions,
6970
AtomicResultSectionBadges,
7071
AtomicResultSectionBottomMetadata,
@@ -124,7 +125,6 @@ AtomicResultHtml,
124125
AtomicResultIcon,
125126
AtomicResultImage,
126127
AtomicResultLink,
127-
AtomicResultList,
128128
AtomicResultLocalizedText,
129129
AtomicResultMultiValueText,
130130
AtomicResultNumber,
@@ -210,6 +210,7 @@ AtomicProductText,
210210
AtomicQuerySummary,
211211
AtomicResult,
212212
AtomicResultChildrenTemplate,
213+
AtomicResultList,
213214
AtomicResultSectionActions,
214215
AtomicResultSectionBadges,
215216
AtomicResultSectionBottomMetadata,
@@ -269,7 +270,6 @@ AtomicResultHtml,
269270
AtomicResultIcon,
270271
AtomicResultImage,
271272
AtomicResultLink,
272-
AtomicResultList,
273273
AtomicResultLocalizedText,
274274
AtomicResultMultiValueText,
275275
AtomicResultNumber,

packages/atomic-angular/projects/atomic-angular/src/lib/stencil-generated/components.ts

Lines changed: 28 additions & 25 deletions
Large diffs are not rendered by default.

packages/atomic-react/src/components/search/ResultListWrapper.tsx

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,52 @@
1-
import type {JSX as AtomicJSX} from '@coveo/atomic';
1+
import type {AtomicResultList} from '@coveo/atomic/components';
2+
import type {
3+
ItemDisplayDensity,
4+
ItemDisplayImageSize,
5+
ItemDisplayLayout,
6+
} from '@coveo/atomic/loader';
27
import type {Result} from '@coveo/headless';
38
import React, {type JSX, useEffect, useRef} from 'react';
49
import {createRoot} from 'react-dom/client';
510
import {renderToString} from 'react-dom/server';
6-
import {
7-
AtomicResultLink,
8-
AtomicResultList,
9-
} from '../stencil-generated/search/index.js';
11+
import {AtomicResultLink} from '../stencil-generated/search/index.js';
12+
import {AtomicResultList as LitAtomicResultList} from './components.js';
1013

1114
interface Template {
1215
contentTemplate: JSX.Element;
1316
linkTemplate: JSX.Element;
1417
}
1518

19+
interface AtomicResultListProps {
20+
/**
21+
* The spacing of various elements in the result list, including the gap between results, the gap between parts of a result, and the font sizes of different parts in a result.
22+
*/
23+
density?: ItemDisplayDensity;
24+
/**
25+
* The desired layout to use when displaying results. Layouts affect how many results to display per row and how visually distinct they are from each other.
26+
*/
27+
display?: ItemDisplayLayout;
28+
/**
29+
* The expected size of the image displayed for results.
30+
*/
31+
imageSize?: ItemDisplayImageSize;
32+
/**
33+
* The desired number of placeholders to display while the result list is loading.
34+
*/
35+
numberOfPlaceholders?: number;
36+
}
37+
38+
interface HTMLAtomicResultListElement extends AtomicResultList, HTMLElement {}
39+
40+
// biome-ignore lint/correctness/noUnusedVariables: <>
41+
var HTMLAtomicResultListElement: {
42+
prototype: HTMLAtomicResultListElement;
43+
new (): HTMLAtomicResultListElement;
44+
};
45+
1646
/**
1747
* The properties of the AtomicResultList component
1848
*/
19-
interface WrapperProps extends AtomicJSX.AtomicResultList {
49+
interface WrapperProps extends AtomicResultListProps {
2050
/**
2151
* A template function that takes a result item and outputs its target rendering as a JSX element.
2252
* It can be used to conditionally render different type of result templates based on the properties of each result.
@@ -53,7 +83,7 @@ export const ResultListWrapper: React.FC<WrapperProps> = (props) => {
5383
return renderToString(templateResult);
5484
});
5585
}, [otherProps.display, template]);
56-
return <AtomicResultList ref={resultListRef} {...otherProps} />;
86+
return <LitAtomicResultList ref={resultListRef} {...otherProps} />;
5787
};
5888

5989
const hasLinkTemplate = (

packages/atomic-react/src/components/search/components.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
AtomicQuerySummary as LitAtomicQuerySummary,
1212
AtomicResult as LitAtomicResult,
1313
AtomicResultChildrenTemplate as LitAtomicResultChildrenTemplate,
14+
AtomicResultList as LitAtomicResultList,
1415
AtomicResultSectionActions as LitAtomicResultSectionActions,
1516
AtomicResultSectionBadges as LitAtomicResultSectionBadges,
1617
AtomicResultSectionBottomMetadata as LitAtomicResultSectionBottomMetadata,
@@ -102,6 +103,12 @@ export const AtomicResultChildrenTemplate = createComponent({
102103
elementClass: LitAtomicResultChildrenTemplate,
103104
});
104105

106+
export const AtomicResultList = createComponent({
107+
tagName: 'atomic-result-list',
108+
react: React,
109+
elementClass: LitAtomicResultList,
110+
});
111+
105112
export const AtomicResultSectionActions = createComponent({
106113
tagName: 'atomic-result-section-actions',
107114
react: React,

packages/atomic-react/src/components/stencil-generated/search/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export const AtomicResultHtml = /*@__PURE__*/createReactComponent<JSX.AtomicResu
4848
export const AtomicResultIcon = /*@__PURE__*/createReactComponent<JSX.AtomicResultIcon, HTMLAtomicResultIconElement>('atomic-result-icon');
4949
export const AtomicResultImage = /*@__PURE__*/createReactComponent<JSX.AtomicResultImage, HTMLAtomicResultImageElement>('atomic-result-image');
5050
export const AtomicResultLink = /*@__PURE__*/createReactComponent<JSX.AtomicResultLink, HTMLAtomicResultLinkElement>('atomic-result-link');
51-
export const AtomicResultList = /*@__PURE__*/createReactComponent<JSX.AtomicResultList, HTMLAtomicResultListElement>('atomic-result-list');
5251
export const AtomicResultLocalizedText = /*@__PURE__*/createReactComponent<JSX.AtomicResultLocalizedText, HTMLAtomicResultLocalizedTextElement>('atomic-result-localized-text');
5352
export const AtomicResultMultiValueText = /*@__PURE__*/createReactComponent<JSX.AtomicResultMultiValueText, HTMLAtomicResultMultiValueTextElement>('atomic-result-multi-value-text');
5453
export const AtomicResultNumber = /*@__PURE__*/createReactComponent<JSX.AtomicResultNumber, HTMLAtomicResultNumberElement>('atomic-result-number');

packages/atomic/cypress/e2e/result-list/grid-result-list.cypress.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/atomic/cypress/e2e/result-list/result-list.cypress.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/atomic/cypress/e2e/result-list/result-table.cypress.ts

Lines changed: 0 additions & 92 deletions
This file was deleted.

packages/atomic/src/components.d.ts

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,36 +1780,6 @@ export namespace Components {
17801780
*/
17811781
"hrefTemplate"?: string;
17821782
}
1783-
/**
1784-
* The `atomic-result-list` component is responsible for displaying query results by applying one or more result templates.
1785-
*/
1786-
interface AtomicResultList {
1787-
/**
1788-
* The spacing of various elements in the result list, including the gap between results, the gap between parts of a result, and the font sizes of different parts in a result.
1789-
*/
1790-
"density": ItemDisplayDensity;
1791-
/**
1792-
* The desired layout to use when displaying results. Layouts affect how many results to display per row and how visually distinct they are from each other.
1793-
*/
1794-
"display": ItemDisplayLayout;
1795-
/**
1796-
* The expected size of the image displayed in the results.
1797-
*/
1798-
"imageSize": ItemDisplayImageSize;
1799-
/**
1800-
* Sets a rendering function to bypass the standard HTML template mechanism for rendering results. You can use this function while working with web frameworks that don't use plain HTML syntax, e.g., React, Angular or Vue. Do not use this method if you integrate Atomic in a plain HTML deployment.
1801-
* @param resultRenderingFunction
1802-
*/
1803-
"setRenderFunction": (resultRenderingFunction: ItemRenderingFunction) => Promise<void>;
1804-
/**
1805-
* The tabs on which this result list must not be displayed. This property should not be used at the same time as `tabs-included`. Set this property as a stringified JSON array, e.g., ```html <atomic-result-list tabs-excluded='["tabIDA", "tabIDB"]'></atomic-result-list> ``` If you don't set this property, the result list can be displayed on any tab. Otherwise, the result list won't be displayed on any of the specified tabs.
1806-
*/
1807-
"tabsExcluded": string[] | string;
1808-
/**
1809-
* The tabs on which the result list can be displayed. This property should not be used at the same time as `tabs-excluded`. Set this property as a stringified JSON array, e.g., ```html <atomic-result-list tabs-included='["tabIDA", "tabIDB"]'></atomic-result-list snippet> ``` If you don't set this property, the result list can be displayed on any tab. Otherwise, the result list can only be displayed on the specified tabs.
1810-
*/
1811-
"tabsIncluded": string[] | string;
1812-
}
18131783
/**
18141784
* The `atomic-result-localized-text` component renders a target i18n localized string using the values of a target field.
18151785
* Given this i18n configuration:
@@ -3270,15 +3240,6 @@ declare global {
32703240
prototype: HTMLAtomicResultLinkElement;
32713241
new (): HTMLAtomicResultLinkElement;
32723242
};
3273-
/**
3274-
* The `atomic-result-list` component is responsible for displaying query results by applying one or more result templates.
3275-
*/
3276-
interface HTMLAtomicResultListElement extends Components.AtomicResultList, HTMLStencilElement {
3277-
}
3278-
var HTMLAtomicResultListElement: {
3279-
prototype: HTMLAtomicResultListElement;
3280-
new (): HTMLAtomicResultListElement;
3281-
};
32823243
/**
32833244
* The `atomic-result-localized-text` component renders a target i18n localized string using the values of a target field.
32843245
* Given this i18n configuration:
@@ -3755,7 +3716,6 @@ declare global {
37553716
"atomic-result-icon": HTMLAtomicResultIconElement;
37563717
"atomic-result-image": HTMLAtomicResultImageElement;
37573718
"atomic-result-link": HTMLAtomicResultLinkElement;
3758-
"atomic-result-list": HTMLAtomicResultListElement;
37593719
"atomic-result-localized-text": HTMLAtomicResultLocalizedTextElement;
37603720
"atomic-result-multi-value-text": HTMLAtomicResultMultiValueTextElement;
37613721
"atomic-result-number": HTMLAtomicResultNumberElement;
@@ -5474,31 +5434,6 @@ declare namespace LocalJSX {
54745434
*/
54755435
"hrefTemplate"?: string;
54765436
}
5477-
/**
5478-
* The `atomic-result-list` component is responsible for displaying query results by applying one or more result templates.
5479-
*/
5480-
interface AtomicResultList {
5481-
/**
5482-
* The spacing of various elements in the result list, including the gap between results, the gap between parts of a result, and the font sizes of different parts in a result.
5483-
*/
5484-
"density"?: ItemDisplayDensity;
5485-
/**
5486-
* The desired layout to use when displaying results. Layouts affect how many results to display per row and how visually distinct they are from each other.
5487-
*/
5488-
"display"?: ItemDisplayLayout;
5489-
/**
5490-
* The expected size of the image displayed in the results.
5491-
*/
5492-
"imageSize"?: ItemDisplayImageSize;
5493-
/**
5494-
* The tabs on which this result list must not be displayed. This property should not be used at the same time as `tabs-included`. Set this property as a stringified JSON array, e.g., ```html <atomic-result-list tabs-excluded='["tabIDA", "tabIDB"]'></atomic-result-list> ``` If you don't set this property, the result list can be displayed on any tab. Otherwise, the result list won't be displayed on any of the specified tabs.
5495-
*/
5496-
"tabsExcluded"?: string[] | string;
5497-
/**
5498-
* The tabs on which the result list can be displayed. This property should not be used at the same time as `tabs-excluded`. Set this property as a stringified JSON array, e.g., ```html <atomic-result-list tabs-included='["tabIDA", "tabIDB"]'></atomic-result-list snippet> ``` If you don't set this property, the result list can be displayed on any tab. Otherwise, the result list can only be displayed on the specified tabs.
5499-
*/
5500-
"tabsIncluded"?: string[] | string;
5501-
}
55025437
/**
55035438
* The `atomic-result-localized-text` component renders a target i18n localized string using the values of a target field.
55045439
* Given this i18n configuration:
@@ -6145,7 +6080,6 @@ declare namespace LocalJSX {
61456080
"atomic-result-icon": AtomicResultIcon;
61466081
"atomic-result-image": AtomicResultImage;
61476082
"atomic-result-link": AtomicResultLink;
6148-
"atomic-result-list": AtomicResultList;
61496083
"atomic-result-localized-text": AtomicResultLocalizedText;
61506084
"atomic-result-multi-value-text": AtomicResultMultiValueText;
61516085
"atomic-result-number": AtomicResultNumber;
@@ -6484,10 +6418,6 @@ declare module "@stencil/core" {
64846418
* The `atomic-result-link` component automatically transforms a search result title into a clickable link that points to the original item.
64856419
*/
64866420
"atomic-result-link": LocalJSX.AtomicResultLink & JSXBase.HTMLAttributes<HTMLAtomicResultLinkElement>;
6487-
/**
6488-
* The `atomic-result-list` component is responsible for displaying query results by applying one or more result templates.
6489-
*/
6490-
"atomic-result-list": LocalJSX.AtomicResultList & JSXBase.HTMLAttributes<HTMLAtomicResultListElement>;
64916421
/**
64926422
* The `atomic-result-localized-text` component renders a target i18n localized string using the values of a target field.
64936423
* Given this i18n configuration:

packages/atomic/src/components/commerce/atomic-commerce-product-list/atomic-commerce-product-list.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import {
4242
type ItemDisplayDensity,
4343
type ItemDisplayImageSize,
4444
type ItemDisplayLayout,
45-
} from '@/src/components/common/layout/display-options';
45+
} from '@/src/components/common/layout/item-layout-utils';
4646
import {bindStateToController} from '@/src/decorators/bind-state';
4747
import {bindingGuard} from '@/src/decorators/binding-guard';
4848
import {bindings} from '@/src/decorators/bindings';
@@ -166,20 +166,20 @@ export class AtomicCommerceProductList
166166
* product, and the font sizes of different parts in a product.
167167
*/
168168
@property({reflect: true, type: String})
169-
density: ItemDisplayDensity = 'normal';
169+
public density: ItemDisplayDensity = 'normal';
170170

171171
/**
172172
* The desired layout to use when displaying products. Layouts affect how many products to display per row and how
173173
* visually distinct they are from each other.
174174
*/
175175
@property({reflect: true, type: String})
176-
display: ItemDisplayLayout = 'grid';
176+
public display: ItemDisplayLayout = 'grid';
177177

178178
/**
179179
* The expected size of the image displayed for products.
180180
*/
181181
@property({reflect: true, attribute: 'image-size', type: String})
182-
imageSize: ItemDisplayImageSize = 'small';
182+
public imageSize: ItemDisplayImageSize = 'small';
183183

184184
/**
185185
* The desired number of placeholders to display while the product list is loading.

0 commit comments

Comments
 (0)