diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx index 1054c043e28..23d20226efc 100644 --- a/.storybook/preview.tsx +++ b/.storybook/preview.tsx @@ -11,6 +11,24 @@ import React from 'react'; import type { Preview } from '@storybook/react'; +/* + * Preload all EuiIcons - Storybook does not support dynamic icon loading + * TODO: https://github.com/elastic/eui/issues/5463 + */ +import { typeToPathMap } from '../src/components/icon/icon_map'; +import { appendIconComponentCache } from '../src/components/icon/icon'; +const iconCache: Record = {}; + +Object.entries(typeToPathMap).forEach(async ([iconType, iconFileName]) => { + // eslint-disable-next-line @typescript-eslint/no-var-requires + const iconExport = require(`../src/components/icon/assets/${iconFileName}`); + iconCache[iconType] = iconExport.icon; +}); +appendIconComponentCache(iconCache); + +/* + * Theming + */ import { EuiProvider } from '../src/components/provider'; import { writingModeStyles } from './writing_mode.styles'; @@ -63,6 +81,7 @@ const preview: Preview = { actions: { argTypesRegex: '^on[A-Z].*' }, backgrounds: { disable: true }, // Use colorMode instead controls: { + sort: 'requiredFirst', matchers: { color: /(background|color)$/i, date: /Date$/, diff --git a/src/components/accessibility/skip_link/__snapshots__/skip_link.test.tsx.snap b/src/components/accessibility/skip_link/__snapshots__/skip_link.test.tsx.snap index 53af988e3e1..9f034b50274 100644 --- a/src/components/accessibility/skip_link/__snapshots__/skip_link.test.tsx.snap +++ b/src/components/accessibility/skip_link/__snapshots__/skip_link.test.tsx.snap @@ -3,7 +3,7 @@ exports[`EuiSkipLink is rendered 1`] = ` @@ -34,7 +34,7 @@ exports[`EuiSkipLink props position absolute is rendered 1`] = ` exports[`EuiSkipLink props position fixed is rendered 1`] = ` @@ -59,7 +59,7 @@ exports[`EuiSkipLink props position static is rendered 1`] = ` exports[`EuiSkipLink props tabIndex is rendered 1`] = ` `; @@ -265,7 +266,7 @@ exports[`EuiButtonIcon props isSelected is rendered as false 1`] = `