-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
image.d.ts
305 lines (300 loc) · 9.72 KB
/
image.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
/**
*
* Displays a single image with preview and tranformation options.
*
* [Live Demo](https://www.primereact.org/image/)
*
* @module image
*
*/
import * as React from 'react';
import { CSSTransitionProps as ReactCSSTransitionProps } from 'react-transition-group/CSSTransition';
import { ComponentHooks } from '../componentbase/componentbase';
import { PassThroughOptions } from '../passthrough';
import { IconType, PassThroughType } from '../utils/utils';
export declare type ImagePassThroughType<T> = PassThroughType<T, ImagePassThroughMethodOptions>;
export declare type ImagePassThroughTransitionType = ReactCSSTransitionProps | ((options: ImagePassThroughMethodOptions) => ReactCSSTransitionProps) | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface ImagePassThroughMethodOptions {
props: ImageProps;
state: ImageState;
}
/**
* Custom passthrough(pt) options.
* @see {@link ImageProps.pt}
*/
export interface ImagePassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: ImagePassThroughType<React.HTMLAttributes<HTMLSpanElement>>;
/**
* Uses to pass attributes to the image's DOM element.
*/
image?: ImagePassThroughType<React.ImgHTMLAttributes<HTMLImageElement>>;
/**
* Uses to pass attributes to the button's DOM element.
*/
button?: ImagePassThroughType<React.HTMLAttributes<HTMLDivElement>>;
/**
* Uses to pass attributes to the icon's DOM element.
*/
icon?: ImagePassThroughType<React.SVGProps<SVGSVGElement> | React.HTMLAttributes<HTMLSpanElement | SVGSVGElement>>;
/**
* Uses to pass attributes to the mask's DOM element.
*/
mask?: ImagePassThroughType<React.HTMLAttributes<HTMLDivElement>>;
/**
* Uses to pass attributes to the toolbar's DOM element.
*/
toolbar?: ImagePassThroughType<React.HTMLAttributes<HTMLDivElement>>;
/**
* Uses to pass attributes to the download button's DOM element.
*/
downloadButton?: ImagePassThroughType<React.HTMLAttributes<HTMLButtonElement>>;
/**
* Uses to pass attributes to the download icon's DOM element.
*/
downloadIcon?: ImagePassThroughType<React.SVGProps<SVGSVGElement> | React.HTMLAttributes<HTMLSpanElement | SVGSVGElement>>;
/**
* Uses to pass attributes to the rotate right button's DOM element.
*/
rotateRightButton?: ImagePassThroughType<React.HTMLAttributes<HTMLDivElement>>;
/**
* Uses to pass attributes to the rotate right icon's DOM element.
*/
rotateRightIcon?: ImagePassThroughType<React.SVGProps<SVGSVGElement> | React.HTMLAttributes<HTMLSpanElement | SVGSVGElement>>;
/**
* Uses to pass attributes to the rotate left button's DOM element.
*/
rotateLeftButton?: ImagePassThroughType<React.HTMLAttributes<HTMLButtonElement>>;
/**
* Uses to pass attributes to the rotate left icon's DOM element.
*/
rotateLeftIcon?: ImagePassThroughType<React.SVGProps<SVGSVGElement> | React.HTMLAttributes<HTMLSpanElement | SVGSVGElement>>;
/**
* Uses to pass attributes to the zoom out button's DOM element.
*/
zoomOutButton?: ImagePassThroughType<React.HTMLAttributes<HTMLButtonElement>>;
/**
* Uses to pass attributes to the zoom out icon's DOM element.
*/
zoomOutIcon?: ImagePassThroughType<React.SVGProps<SVGSVGElement> | React.HTMLAttributes<HTMLSpanElement | SVGSVGElement>>;
/**
* Uses to pass attributes to the zoom in button's DOM element.
*/
zoomInButton?: ImagePassThroughType<React.HTMLAttributes<HTMLButtonElement>>;
/**
* Uses to pass attributes to the zoom in icon's DOM element.
*/
zoomInIcon?: ImagePassThroughType<React.SVGProps<SVGSVGElement> | React.HTMLAttributes<HTMLSpanElement | SVGSVGElement>>;
/**
* Uses to pass attributes to the close button's DOM element.
*/
closeButton?: ImagePassThroughType<React.HTMLAttributes<HTMLButtonElement>>;
/**
* Uses to pass attributes to the close icon's DOM element.
*/
closeIcon?: ImagePassThroughType<React.SVGProps<SVGSVGElement> | React.HTMLAttributes<HTMLSpanElement | SVGSVGElement>>;
/**
* Uses to pass attributes to the preview container's DOM element.
*/
previewContainer?: ImagePassThroughType<React.HTMLAttributes<HTMLDivElement>>;
/**
* Uses to pass attributes to the preview's DOM element.
*/
preview?: ImagePassThroughType<React.ImgHTMLAttributes<HTMLImageElement>>;
/**
* Used to manage all lifecycle hooks
* @see {@link ComponentHooks}
*/
hooks?: ComponentHooks;
/**
* Used to control React Transition API.
*/
transition?: ImagePassThroughTransitionType;
}
/**
* Defines current inline state in Image component.
*/
export interface ImageState {
/**
* Mask visible state as a boolean.
* @defaultValue false
*/
maskVisible: boolean;
/**
* Preview visible state as a boolean.
* @defaultValue false
*/
previewVisible: boolean;
/**
* Rotate state as a number.
* @defaultValue 0
*/
rotate: number;
/**
* Scale state as a boolean.
* @defaultValue 1
*/
scale: number;
}
/**
* Defines valid properties in Image component. In addition to these, all properties of HTMLSpanElement can be used in this component.
* @group Properties
*/
export interface ImageProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, 'ref' | 'pt'> {
/**
* Specifies an alternate text for an area, if the image cannot be displayed.
*/
alt?: string | undefined;
/**
* Used to get the child elements of the component.
* @readonly
*/
children?: React.ReactNode | undefined;
/**
* Specifies if pressing escape key should hide the preview.
* @defaultValue true
*/
closeOnEscape?: boolean | undefined;
/**
* The crossorigin content attribute on media elements is a CORS settings attribute.
*/
crossOrigin?: 'anonymous' | 'use-credentials' | '' | undefined;
/**
* Adds a download button to the preview control menu.
* @default false
*/
downloadable?: boolean | undefined;
/**
* Icon of the download button.
*/
downloadIcon?: IconType<ImageProps> | undefined;
/**
* Specifies whether a browser should load an image immediately or to defer loading of off-screen images until for example the user scrolls near them.
*/
loading?: 'eager' | 'lazy' | undefined;
/**
* Icon of the rotate right button.
*/
rotateRightIcon?: IconType<ImageProps> | undefined;
/**
* Icon of the rotate left button.
*/
rotateLeftIcon?: IconType<ImageProps> | undefined;
/**
* HTTP header controls how much referrer information (sent with the Referer header) should be included with requests.
*/
referrerPolicy?: React.HTMLAttributeReferrerPolicy | undefined;
/**
* Specifies an image as a client-side image map (an image map is an image with clickable areas)
*/
useMap?: string | undefined;
/**
* Icon of the zoom out button.
*/
zoomOutIcon?: IconType<ImageProps> | undefined;
/**
* Icon of the zoom in button.
*/
zoomInIcon?: IconType<ImageProps> | undefined;
/**
* Icon of the close button.
*/
closeIcon?: IconType<ImageProps> | undefined;
/**
* Height of the image element.
*/
height?: string | undefined;
/**
* Style class of the image element.
*/
imageClassName?: string | undefined;
/**
* Inline style of the image element.
*/
imageStyle?: React.CSSProperties | undefined;
/**
* Controls the preview functionality.
* @default false
*/
preview?: boolean | undefined;
/**
* Changing the default icon when the image is hovered in preview mode.
*/
indicatorIcon?: IconType<ImageProps> | undefined;
/**
* Specifies the path to the image.
*/
src?: string | undefined;
/**
* Changing the default icon when the image is hovered in preview mode. Since v9, use `indicatorIcon` instead.
* @deprecated Since v9, use `indicatorIcon` instead.
*/
template?: any | undefined;
/**
* Width of the image element.
*/
width?: string | undefined;
/**
* Zoomed image that may be different than "src" image.
*/
zoomSrc?: string | undefined;
/**
* Triggered when the preview overlay is hidden.
*/
onHide?(): void;
/**
* Triggered when the preview overlay is shown.
*/
onShow?(): void;
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {ImagePassThroughOptions}
*/
pt?: ImagePassThroughOptions;
/**
* Used to configure passthrough(pt) options of the component.
* @type {PassThroughOptions}
*/
ptOptions?: PassThroughOptions;
/**
* When enabled, it removes component related styles in the core.
* @defaultValue false
*/
unstyled?: boolean;
}
/**
* **PrimeReact - Image**
*
* _Displays a single image with preview and tranformation options._
*
* [Live Demo](https://www.primereact.org/image/)
* --- ---
* ![PrimeReact](https://primefaces.org/cdn/primereact/images/logo-100.png)
*
* @group Component
*/
export declare class Image extends React.Component<ImageProps, any> {
/**
* Used to show the overlay.
*/
public show(): void;
/**
* Used to hide the overlay.
*/
public hide(): void;
/**
* Used to get container element.
* @return {HTMLSpanElement} Container element
*/
public getElement(): HTMLSpanElement;
/**
* Used to get image element
* @return {HTMLImageElement} Image element
*/
public getImage(): HTMLImageElement;
}