diff --git a/.changeset/few-buckets-cross.md b/.changeset/few-buckets-cross.md new file mode 100644 index 0000000000..d2f9c9e39f --- /dev/null +++ b/.changeset/few-buckets-cross.md @@ -0,0 +1,4 @@ +--- +"@rhds/elements": patch +--- +``: lazy-load the icon component dependency diff --git a/elements/rh-cta/rh-cta.ts b/elements/rh-cta/rh-cta.ts index 84b6aaa83b..58c7937622 100644 --- a/elements/rh-cta/rh-cta.ts +++ b/elements/rh-cta/rh-cta.ts @@ -12,8 +12,6 @@ import { colorContextConsumer, type ColorTheme } from '../../lib/context/color/c import style from './rh-cta.css'; -import '@patternfly/elements/pf-icon/pf-icon.js'; - export interface CtaData { href?: string; text?: string; @@ -147,6 +145,13 @@ export class RhCta extends LitElement { #logger = new Logger(this); + protected override async getUpdateComplete(): Promise { + if (this.icon) { + await import('@patternfly/elements/pf-icon/pf-icon.js'); + } + return super.getUpdateComplete(); + } + get #isDefault(): boolean { return !this.hasAttribute('variant'); }