Skip to content

Commit 411cb9b

Browse files
committed
add atomic-icon
1 parent bec043b commit 411cb9b

File tree

27 files changed

+304
-124
lines changed

27 files changed

+304
-124
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {APP_INITIALIZER, ModuleWithProviders, NgModule, Provider} from '@angular
66

77
import {
88
AtomicComponentError,
9+
AtomicIcon,
910
AtomicAriaLive,
1011
AtomicAutomaticFacet,
1112
AtomicAutomaticFacetGenerator,
@@ -50,7 +51,6 @@ AtomicFormatNumber,
5051
AtomicFormatUnit,
5152
AtomicGeneratedAnswer,
5253
AtomicHtml,
53-
AtomicIcon,
5454
AtomicLayoutSection,
5555
AtomicLoadMoreResults,
5656
AtomicNoResults,
@@ -152,6 +152,7 @@ defineCustomElements(window);
152152

153153
const DECLARATIONS = [
154154
AtomicComponentError,
155+
AtomicIcon,
155156
AtomicAriaLive,
156157
AtomicAutomaticFacet,
157158
AtomicAutomaticFacetGenerator,
@@ -196,7 +197,6 @@ AtomicFormatNumber,
196197
AtomicFormatUnit,
197198
AtomicGeneratedAnswer,
198199
AtomicHtml,
199-
AtomicIcon,
200200
AtomicLayoutSection,
201201
AtomicLoadMoreResults,
202202
AtomicNoResults,

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

+24-23
Original file line numberDiff line numberDiff line change
@@ -1005,28 +1005,6 @@ export class AtomicHtml {
10051005
export declare interface AtomicHtml extends Components.AtomicHtml {}
10061006

10071007

1008-
@ProxyCmp({
1009-
inputs: ['icon']
1010-
})
1011-
@Component({
1012-
selector: 'atomic-icon',
1013-
changeDetection: ChangeDetectionStrategy.OnPush,
1014-
template: '<ng-content></ng-content>',
1015-
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
1016-
inputs: ['icon'],
1017-
})
1018-
export class AtomicIcon {
1019-
protected el: HTMLElement;
1020-
constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
1021-
c.detach();
1022-
this.el = r.nativeElement;
1023-
}
1024-
}
1025-
1026-
1027-
export declare interface AtomicIcon extends Components.AtomicIcon {}
1028-
1029-
10301008
@ProxyCmp({
10311009
inputs: ['maxWidth', 'minWidth', 'section']
10321010
})
@@ -3108,5 +3086,28 @@ export declare interface AtomicComponentError extends LitAtomicComponentError {
31083086

31093087
}
31103088

3111-
import type {AtomicComponentError as LitAtomicComponentError} from '@coveo/atomic/components';
3089+
@ProxyCmp({
3090+
inputs: ['icon']
3091+
})
3092+
@Component({
3093+
selector: 'atomic-icon',
3094+
changeDetection: ChangeDetectionStrategy.OnPush,
3095+
template: '<ng-content></ng-content>',
3096+
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
3097+
inputs: ['icon']
3098+
})
3099+
export class AtomicIcon {
3100+
protected readonly el: HTMLElement;
3101+
constructor(c: ChangeDetectorRef, el: ElementRef, protected z: NgZone) {
3102+
c.detach();
3103+
this.el = el.nativeElement;
3104+
proxyOutputs(this, this.el, []);
3105+
}
3106+
}
3107+
3108+
export declare interface AtomicIcon extends LitAtomicIcon {
3109+
3110+
}
3111+
3112+
import type {AtomicComponentError as LitAtomicComponentError, AtomicIcon as LitAtomicIcon} from '@coveo/atomic/components';
31123113
//#endregion Lit Declarations
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
export {};
1+
import {
2+
AtomicComponentError as LitAtomicComponentError,
3+
AtomicIcon as LitAtomicIcon,
4+
} from '@coveo/atomic/components';
5+
import {createComponent} from '@lit/react';
6+
import React from 'react';
7+
8+
export const AtomicComponentError = createComponent({
9+
tagName: 'atomic-component-error',
10+
react: React,
11+
elementClass: LitAtomicComponentError,
12+
});
13+
14+
export const AtomicIcon = createComponent({
15+
tagName: 'atomic-icon',
16+
react: React,
17+
elementClass: LitAtomicIcon,
18+
});
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
export {};
1+
import {
2+
AtomicComponentError as LitAtomicComponentError,
3+
AtomicIcon as LitAtomicIcon,
4+
} from '@coveo/atomic/components';
5+
import {createComponent} from '@lit/react';
6+
import React from 'react';
7+
8+
export const AtomicComponentError = createComponent({
9+
tagName: 'atomic-component-error',
10+
react: React,
11+
elementClass: LitAtomicComponentError,
12+
});
13+
14+
export const AtomicIcon = createComponent({
15+
tagName: 'atomic-icon',
16+
react: React,
17+
elementClass: LitAtomicIcon,
18+
});

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

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export const AtomicCommerceSearchBoxRecentQueries = /*@__PURE__*/createReactComp
3535
export const AtomicCommerceSortDropdown = /*@__PURE__*/createReactComponent<JSX.AtomicCommerceSortDropdown, HTMLAtomicCommerceSortDropdownElement>('atomic-commerce-sort-dropdown');
3636
export const AtomicCommerceText = /*@__PURE__*/createReactComponent<JSX.AtomicCommerceText, HTMLAtomicCommerceTextElement>('atomic-commerce-text');
3737
export const AtomicCommerceTimeframeFacet = /*@__PURE__*/createReactComponent<JSX.AtomicCommerceTimeframeFacet, HTMLAtomicCommerceTimeframeFacetElement>('atomic-commerce-timeframe-facet');
38-
export const AtomicIcon = /*@__PURE__*/createReactComponent<JSX.AtomicIcon, HTMLAtomicIconElement>('atomic-icon');
3938
export const AtomicLayoutSection = /*@__PURE__*/createReactComponent<JSX.AtomicLayoutSection, HTMLAtomicLayoutSectionElement>('atomic-layout-section');
4039
export const AtomicNumericRange = /*@__PURE__*/createReactComponent<JSX.AtomicNumericRange, HTMLAtomicNumericRangeElement>('atomic-numeric-range');
4140
export const AtomicProduct = /*@__PURE__*/createReactComponent<JSX.AtomicProduct, HTMLAtomicProductElement>('atomic-product');

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

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export const AtomicFormatNumber = /*@__PURE__*/createReactComponent<JSX.AtomicFo
2424
export const AtomicFormatUnit = /*@__PURE__*/createReactComponent<JSX.AtomicFormatUnit, HTMLAtomicFormatUnitElement>('atomic-format-unit');
2525
export const AtomicGeneratedAnswer = /*@__PURE__*/createReactComponent<JSX.AtomicGeneratedAnswer, HTMLAtomicGeneratedAnswerElement>('atomic-generated-answer');
2626
export const AtomicHtml = /*@__PURE__*/createReactComponent<JSX.AtomicHtml, HTMLAtomicHtmlElement>('atomic-html');
27-
export const AtomicIcon = /*@__PURE__*/createReactComponent<JSX.AtomicIcon, HTMLAtomicIconElement>('atomic-icon');
2827
export const AtomicLayoutSection = /*@__PURE__*/createReactComponent<JSX.AtomicLayoutSection, HTMLAtomicLayoutSectionElement>('atomic-layout-section');
2928
export const AtomicLoadMoreResults = /*@__PURE__*/createReactComponent<JSX.AtomicLoadMoreResults, HTMLAtomicLoadMoreResultsElement>('atomic-load-more-results');
3029
export const AtomicNoResults = /*@__PURE__*/createReactComponent<JSX.AtomicNoResults, HTMLAtomicNoResultsElement>('atomic-no-results');

packages/atomic/src/components.d.ts

-37
Original file line numberDiff line numberDiff line change
@@ -1126,16 +1126,6 @@ export namespace Components {
11261126
*/
11271127
"value": string;
11281128
}
1129-
/**
1130-
* The `atomic-icon` component displays an SVG icon with a 1:1 aspect ratio.
1131-
* This component can display an icon from those available in the Atomic package, from a specific location, or as an inline SVG element.
1132-
*/
1133-
interface AtomicIcon {
1134-
/**
1135-
* The SVG icon to display. - Use a value that starts with `http://`, `https://`, `./`, or `../`, to fetch and display an icon from a given location. - Use a value that starts with `assets://`, to display an icon from the Atomic package. - Use a stringified SVG to display it directly.
1136-
*/
1137-
"icon": string;
1138-
}
11391129
interface AtomicInsightEditToggle {
11401130
"clickCallback": () => void;
11411131
"tooltip": string;
@@ -4476,16 +4466,6 @@ declare global {
44764466
prototype: HTMLAtomicHtmlElement;
44774467
new (): HTMLAtomicHtmlElement;
44784468
};
4479-
/**
4480-
* The `atomic-icon` component displays an SVG icon with a 1:1 aspect ratio.
4481-
* This component can display an icon from those available in the Atomic package, from a specific location, or as an inline SVG element.
4482-
*/
4483-
interface HTMLAtomicIconElement extends Components.AtomicIcon, HTMLStencilElement {
4484-
}
4485-
var HTMLAtomicIconElement: {
4486-
prototype: HTMLAtomicIconElement;
4487-
new (): HTMLAtomicIconElement;
4488-
};
44894469
interface HTMLAtomicInsightEditToggleElement extends Components.AtomicInsightEditToggle, HTMLStencilElement {
44904470
}
44914471
var HTMLAtomicInsightEditToggleElement: {
@@ -6128,7 +6108,6 @@ declare global {
61286108
"atomic-generated-answer": HTMLAtomicGeneratedAnswerElement;
61296109
"atomic-generated-answer-feedback-modal": HTMLAtomicGeneratedAnswerFeedbackModalElement;
61306110
"atomic-html": HTMLAtomicHtmlElement;
6131-
"atomic-icon": HTMLAtomicIconElement;
61326111
"atomic-insight-edit-toggle": HTMLAtomicInsightEditToggleElement;
61336112
"atomic-insight-facet": HTMLAtomicInsightFacetElement;
61346113
"atomic-insight-folded-result-list": HTMLAtomicInsightFoldedResultListElement;
@@ -7305,16 +7284,6 @@ declare namespace LocalJSX {
73057284
*/
73067285
"value": string;
73077286
}
7308-
/**
7309-
* The `atomic-icon` component displays an SVG icon with a 1:1 aspect ratio.
7310-
* This component can display an icon from those available in the Atomic package, from a specific location, or as an inline SVG element.
7311-
*/
7312-
interface AtomicIcon {
7313-
/**
7314-
* The SVG icon to display. - Use a value that starts with `http://`, `https://`, `./`, or `../`, to fetch and display an icon from a given location. - Use a value that starts with `assets://`, to display an icon from the Atomic package. - Use a stringified SVG to display it directly.
7315-
*/
7316-
"icon": string;
7317-
}
73187287
interface AtomicInsightEditToggle {
73197288
"clickCallback"?: () => void;
73207289
"tooltip"?: string;
@@ -9944,7 +9913,6 @@ declare namespace LocalJSX {
99449913
"atomic-generated-answer": AtomicGeneratedAnswer;
99459914
"atomic-generated-answer-feedback-modal": AtomicGeneratedAnswerFeedbackModal;
99469915
"atomic-html": AtomicHtml;
9947-
"atomic-icon": AtomicIcon;
99489916
"atomic-insight-edit-toggle": AtomicInsightEditToggle;
99499917
"atomic-insight-facet": AtomicInsightFacet;
99509918
"atomic-insight-folded-result-list": AtomicInsightFoldedResultList;
@@ -10339,11 +10307,6 @@ declare module "@stencil/core" {
1033910307
* Use only with values for which you are certain the content is harmless.
1034010308
*/
1034110309
"atomic-html": LocalJSX.AtomicHtml & JSXBase.HTMLAttributes<HTMLAtomicHtmlElement>;
10342-
/**
10343-
* The `atomic-icon` component displays an SVG icon with a 1:1 aspect ratio.
10344-
* This component can display an icon from those available in the Atomic package, from a specific location, or as an inline SVG element.
10345-
*/
10346-
"atomic-icon": LocalJSX.AtomicIcon & JSXBase.HTMLAttributes<HTMLAtomicIconElement>;
1034710310
"atomic-insight-edit-toggle": LocalJSX.AtomicInsightEditToggle & JSXBase.HTMLAttributes<HTMLAtomicInsightEditToggleElement>;
1034810311
"atomic-insight-facet": LocalJSX.AtomicInsightFacet & JSXBase.HTMLAttributes<HTMLAtomicInsightFacetElement>;
1034910312
"atomic-insight-folded-result-list": LocalJSX.AtomicInsightFoldedResultList & JSXBase.HTMLAttributes<HTMLAtomicInsightFoldedResultListElement>;
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
// Export the class of the components migrated to Lit here, like this:
22
export {AtomicComponentError} from '../common/atomic-component-error/atomic-component-error';
3+
export {AtomicIcon} from '../common/atomic-icon/atomic-icon';

packages/atomic/src/components/commerce/lazy-index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export default {
22
// Add entries as such when new components are added/moved to Lit.
3+
'atomic-icon': async () => await import('../common/atomic-icon/atomic-icon'),
34
'atomic-component-error': async () =>
45
await import('../common/atomic-component-error/atomic-component-error'),
56
} as Record<string, () => Promise<unknown>>;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import {Canvas, ArgTypes, Meta, Title, Description} from '@storybook/blocks';
2+
import * as AtomicIconStories from './atomic-icon.new.stories';
3+
4+
{/* Storybook provides a number of blocs to construct documentation pages */}
5+
{/* https://storybook.js.org/docs/writing-docs/doc-blocks#available-blocks */}
6+
7+
<Meta of={ AtomicIconStories } />
8+
9+
<Title />
10+
<Description />
11+
12+
<Canvas of={ AtomicIconStories.Default } />
13+
14+
## Properties
15+
<ArgTypes />
16+

packages/atomic/src/components/common/atomic-icon/atomic-icon.new.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const {decorator, play} = wrapInSearchInterface();
1818

1919
const meta: Meta = {
2020
component: 'atomic-icon',
21-
title: 'Atomic/Icon',
21+
title: 'Atomic/Common',
2222
id: 'atomic-icon',
2323

2424
render: renderComponent,

packages/atomic/src/components/common/atomic-icon/atomic-icon.pcss

-15
This file was deleted.

0 commit comments

Comments
 (0)