|
| 1 | +/// <reference types="react" /> |
| 2 | +import * as React from "react"; |
| 3 | + |
| 4 | +export enum Interaction { |
| 5 | + None = "NONE", |
| 6 | + Hover = "HOVER", |
| 7 | + Active = "ACTIVE", |
| 8 | + Resize = "RESIZE", |
| 9 | +} |
| 10 | + |
| 11 | +export interface ILayeredImageProps extends React.HTMLProps<HTMLDivElement> { |
| 12 | + layers: Array<string>; |
| 13 | + aspectRatio: number; |
| 14 | + borderRadius?: React.CSSProperties["borderRadius"]; |
| 15 | + transitionDuration?: React.CSSProperties["transitionDuration"]; |
| 16 | + transitionTimingFunction?: React.CSSProperties["transitionTimingFunction"]; |
| 17 | + lightColor?: React.CSSProperties["color"]; |
| 18 | + lightOpacity?: React.CSSProperties["opacity"]; |
| 19 | + shadowColor?: React.CSSProperties["color"]; |
| 20 | + shadowOpacity?: React.CSSProperties["opacity"]; |
| 21 | +} |
| 22 | + |
| 23 | +export interface ILayeredImageState { |
| 24 | + width?: React.CSSProperties["width"]; |
| 25 | + height?: React.CSSProperties["height"]; |
| 26 | + interaction: Interaction; |
| 27 | + loaded: number; |
| 28 | + error: number; |
| 29 | +} |
| 30 | + |
| 31 | +export default class LayeredImage extends React.Component<ILayeredImageProps, ILayeredImageState> { |
| 32 | + static defaultProps: Partial<ILayeredImageProps>; |
| 33 | + state: ILayeredImageState; |
| 34 | + private elements; |
| 35 | + private refHandlers; |
| 36 | + private images; |
| 37 | + render(): JSX.Element; |
| 38 | + componentDidMount(): void; |
| 39 | + componentWillReceiveProps(nextProps: ILayeredImageProps): void; |
| 40 | + componentWillUnmount(): void; |
| 41 | + private handleMouseInteraction; |
| 42 | + private handleTouchInteraction; |
| 43 | + private handleInteractionEnd; |
| 44 | + private handleWindowResize; |
| 45 | + private getDimensions; |
| 46 | + private computeStyles; |
| 47 | + private applyStyles; |
| 48 | +} |
0 commit comments