import React from 'react'; /** Layout type */ type LayoutType = "rows" | "columns" | "masonry"; /** Photo object */ interface Photo extends Image { /** React `key` attribute. */ key?: string; /** Image `alt` attribute. */ alt?: string; /** Image `title` attribute. */ title?: string; /** Image link URL. */ href?: string; /** ARIA label for the link and button elements */ label?: string; /** Optional array of alternative images to be included in the `srcset` attribute. */ srcSet?: readonly Image[]; } /** Image object */ interface Image { /** Image source. */ src: string; /** Image width in pixels. */ width: number; /** Image height in pixels. */ height: number; } /** Common photo album props */ interface CommonPhotoAlbumProps { /** An array of photos to display in the photo album. */ photos: readonly TPhoto[]; /** Spacing between images. */ spacing?: ResponsiveParameter; /** Padding around each image. */ padding?: ResponsiveParameter; /** Photo album container width in various viewports. */ sizes?: ResponsiveSizes; /** Photo album layout breakpoints. */ breakpoints?: readonly number[]; /** Default container width in SSR. */ defaultContainerWidth?: number; /** Photo click callback. */ onClick?: ClickHandler; /** Custom render functions. */ render?: ResponsiveParameter, number | undefined>; /** Additional HTML attributes to be passed to the rendered elements. */ componentsProps?: ResponsiveParameter, number | undefined>; /** Fallback skeleton in SSR. */ skeleton?: React.ReactNode; } /** Rows photo album props */ interface RowsPhotoAlbumProps extends CommonPhotoAlbumProps { /** Target row height. */ targetRowHeight?: ResponsiveParameter; /** Additional row constraints. */ rowConstraints?: ResponsiveParameter; } /** Columns photo album props */ interface ColumnsPhotoAlbumProps extends CommonPhotoAlbumProps { /** Number of columns. */ columns?: ResponsiveParameter; } /** Masonry photo album props */ interface MasonryPhotoAlbumProps extends ColumnsPhotoAlbumProps { } /** Photo album sizes settings */ type ResponsiveSizes = { /** Default size, e.g. `100vw` or `calc(100vw - 200px)`. */ size: string; /** Array of sizes at various breakpoints. */ sizes?: readonly { /** Viewport size media query, e.g. `(max-width: 600px)`. */ viewport: string; /** Photo album width at a given viewport size, e.g. `calc(100vw - 50px)`. */ size: string; }[]; }; /** Row constraints */ type RowConstraints = { /** Minimum number of photos per row. */ minPhotos?: number; /** Maximum number of photos per row. */ maxPhotos?: number; /** Maximum row height when there is not enough photos to fill more than one row. */ singleRowMaxHeight?: number; }; /** Layout model */ type LayoutModel = { /** Spacing value. */ spacing: number; /** Padding value. */ padding: number; /** Container width. */ containerWidth: number; /** Layout variables. */ variables?: LayoutVariables; /** Layout orientation. */ horizontal?: boolean; /** Layout tracks. */ tracks: readonly { /** Track variables. */ variables?: LayoutVariables; /** Photos array. */ photos: readonly { /** Photo object. */ photo: TPhoto; /** Photo index in the original `photos` array. */ index: number; /** Rendered photo width in pixels. */ width: number; /** Rendered photo height in pixels. */ height: number; }[]; }[]; }; /** Layout variables */ type LayoutVariables = Record; /** Responsive parameter */ type ResponsiveParameter = ((containerWidth: ContainerWidth) => Value) | Value; /** Components props */ type ComponentsProps = { /** Additional HTML attributes for the outer `
` container. */ container?: ContainerComponentProps; /** Additional HTML attributes for the row / column `
` container. */ track?: TrackComponentProps; /** Additional HTML attributes for the image `
` wrapper. */ wrapper?: WrapperComponentProps; /** Additional HTML attributes for the photo `` link. */ link?: LinkComponentProps; /** Additional HTML attributes for the photo `