diff --git a/iconify-icon/icon/src/attributes/icon/index.ts b/iconify-icon/icon/src/attributes/icon/index.ts index 3a22fd4..a3668f7 100644 --- a/iconify-icon/icon/src/attributes/icon/index.ts +++ b/iconify-icon/icon/src/attributes/icon/index.ts @@ -23,7 +23,8 @@ export function parseIconValue( onload: IconOnLoadCallback ): CurrentIconData { // Check if icon name is valid - const name = typeof value === 'string' ? stringToIcon(value, true) : null; + const name = + typeof value === 'string' ? stringToIcon(value, true, true) : null; if (!name) { // Test for serialised object const data = testIconObject(value); @@ -35,7 +36,9 @@ export function parseIconValue( // Valid icon name: check if data is available const data = getIconData(name); - if (data !== void 0) { + + // Icon data exists or icon has no prefix. Do not load icon from API if icon has no prefix + if (data !== void 0 || !name.prefix) { return { value, name, diff --git a/iconify-icon/icon/src/index.ts b/iconify-icon/icon/src/index.ts index bd91b88..1f01098 100644 --- a/iconify-icon/icon/src/index.ts +++ b/iconify-icon/icon/src/index.ts @@ -44,6 +44,10 @@ import type { IconifyRenderMode, } from './attributes/types'; import { defineIconifyIcon } from './component'; +import type { + IconifyIconHTMLElement, + IconifyIconHTMLElementClass, +} from './component'; import { exportFunctions } from './functions'; /** @@ -85,7 +89,12 @@ export { IconifyIconBuildResult }; export { IconifyBrowserCacheType }; // Component types -export { IconifyIconAttributes, IconifyRenderMode }; +export { + IconifyIconAttributes, + IconifyRenderMode, + IconifyIconHTMLElement, + IconifyIconHTMLElementClass, +}; /** * Create exported data: either component instance or functions diff --git a/iconify-icon/icon/tests/icon-load-test.ts b/iconify-icon/icon/tests/icon-load-test.ts index 9ca77f7..8dec96f 100644 --- a/iconify-icon/icon/tests/icon-load-test.ts +++ b/iconify-icon/icon/tests/icon-load-test.ts @@ -52,6 +52,11 @@ describe('Testing parseIconValue without API', () => { }); expect(result).toEqual({ value, + name: { + provider: '', + prefix: '', + name: value, + }, }); }); });