1import { CSSProperties, SyntheticEvent } from 'react';
2
3import { SrcSetSource } from './useSourceSelection';
4import { ImageContentPositionObject, ImageProps, ImageSource } from '../Image.types';
5
6export type OnErrorEvent =
7  | (({ source }: { source: ImageSource | null }) => void)
8  | undefined
9  | null;
10export type OnLoadEvent =
11  | ((event: SyntheticEvent<HTMLImageElement, Event>) => void)
12  | undefined
13  | null;
14export type OnTransitionEndEvent = (() => void) | undefined | null;
15export type OnMountEvent = (() => void) | undefined | null;
16
17export type ImageWrapperEvents = {
18  onLoad?: OnLoadEvent[];
19  onError?: OnErrorEvent[];
20  onTransitionEnd?: OnTransitionEndEvent[];
21  onMount?: OnMountEvent[];
22};
23
24export type ImageWrapperProps = {
25  source?: ImageSource | SrcSetSource | null;
26  events?: ImageWrapperEvents;
27  contentPosition?: ImageContentPositionObject;
28  hashPlaceholderContentPosition?: ImageContentPositionObject;
29  priority?: string | null;
30  style: CSSProperties;
31  tintColor?: string | null;
32  hashPlaceholderStyle?: CSSProperties;
33  className?: string;
34  accessibilityLabel?: string;
35  cachePolicy?: ImageProps['cachePolicy'];
36};
37