From 106d4a8f8d5c8015028d793d4f4495beeac3add1 Mon Sep 17 00:00:00 2001 From: Kiarokh Moattar Date: Thu, 4 Apr 2024 10:45:34 +0200 Subject: [PATCH] feat(interface): add new `Image` interface --- etc/lime-elements.api.md | 8 ++++++++ src/global/shared-types/image.types.ts | 23 +++++++++++++++++++++++ src/interface.ts | 1 + 3 files changed, 32 insertions(+) create mode 100644 src/global/shared-types/image.types.ts diff --git a/etc/lime-elements.api.md b/etc/lime-elements.api.md index 7f6bb057c1..83162f493b 100644 --- a/etc/lime-elements.api.md +++ b/etc/lime-elements.api.md @@ -861,6 +861,14 @@ export interface Icon { // @public (undocumented) export type IconSize = 'x-small' | 'small' | 'medium' | 'large'; +// @public +interface Image_2 { + alt: string; + loading?: 'lazy' | 'eager'; + src: string; +} +export { Image_2 as Image } + // @public (undocumented) export interface InfoTileProgress { displayPercentageColors?: boolean; diff --git a/src/global/shared-types/image.types.ts b/src/global/shared-types/image.types.ts new file mode 100644 index 0000000000..a91be7a31a --- /dev/null +++ b/src/global/shared-types/image.types.ts @@ -0,0 +1,23 @@ +/** + * This interface is used to specify a path to an image, + * along with related properties, like alt text. + * @public + */ +export interface Image { + /** + * The path to the image file. + */ + src: string; + + /** + * The alternative text of the image, used to improve accessibility. + */ + alt: string; + + /** + * The `loading` attribute of the image. + * - `lazy` means that the image will be loaded only when it is in the viewport. + * - `eager` means that the image will be loaded as soon as possible. + */ + loading?: 'lazy' | 'eager'; +} diff --git a/src/interface.ts b/src/interface.ts index be44700988..6902760d06 100644 --- a/src/interface.ts +++ b/src/interface.ts @@ -50,3 +50,4 @@ export * from './components/tab-panel/tab-panel.types'; export * from './components/table/table.types'; export * from './global/shared-types/separator.types'; export * from './global/shared-types/icon.types'; +export * from './global/shared-types/image.types';