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 304be28c1a..bf57803e81 100644 --- a/elements/rh-cta/rh-cta.ts +++ b/elements/rh-cta/rh-cta.ts @@ -12,16 +12,10 @@ import { colorContextConsumer, type ColorTheme } from '../../lib/context/color/c import style from './rh-cta.css'; -import '@patternfly/elements/pf-icon/pf-icon.js'; - function isSupportedContent(el: Element | null): el is HTMLAnchorElement | HTMLButtonElement { return el instanceof HTMLAnchorElement || el instanceof HTMLButtonElement; } -function isButton(element: Element | null): element is HTMLButtonElement { - return element?.tagName.toLowerCase() === 'button'; -} - /** * A call to action is a styled link that entices users to make a selection. * @summary Directs users to other pages or displays extra content @@ -211,9 +205,9 @@ export class RhCta extends LitElement { const cta = this.#cta; if (href && cta !== this.shadowRoot?.querySelector('a')) { return this.#logger.warn(`When the href attribute is used, slotted content must not be a link`); - } else if (!href && !isSupportedContent(cta) && !href) { + } else if (!href && !cta) { return this.#logger.warn(`The first child in the light DOM must be a supported call-to-action tag (,