@ambuj.bhaskar/react-component-library 0.30.16 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -2,270 +2,59 @@ import { ComponentProps } from 'react';
2
2
  import { default as default_2 } from 'react';
3
3
  import { Dispatch } from 'react';
4
4
  import { DropdownProps as DropdownProps_2 } from 'antd';
5
+ import { ForwardRefExoticComponent } from 'react';
5
6
  import { JSX as JSX_2 } from 'react/jsx-runtime';
6
7
  import { MenuProps as MenuProps_2 } from 'antd';
7
8
  import { PopoverProps as PopoverProps_2 } from 'antd';
8
9
  import { RangePickerProps } from 'antd/es/date-picker';
9
10
  import * as React_2 from 'react';
10
11
  import { ReactNode } from 'react';
12
+ import { RefAttributes } from 'react';
11
13
  import { RefObject } from 'react';
12
14
  import { Resolver } from 'react-hook-form';
13
15
  import { SetStateAction } from 'react';
14
16
  import { TableProps as TableProps_2 } from 'antd';
15
17
  import { TimeRangePickerProps } from 'antd';
16
18
 
17
- export declare interface Annotation {
18
- awi_id: string;
19
- awi_request_id: number;
20
- awi_content_key: string;
21
- awi_status: AnnotationStatus;
22
- awi_coords: Array<{
23
- x: number;
24
- y: number;
25
- }>;
26
- awi_outline_type: AnnotationType;
27
- awi_outline_status: AnnotationStatus;
28
- awi_classes: MiniData | {
29
- awi_color: string;
30
- }[];
31
- awi_attributes: AnnotationAttributes;
32
- sam_status: string;
33
- awi_last_updation: Date;
34
- awi_added_by: any;
35
- }
36
-
37
- export declare type AnnotationAttributes = {
38
- awi_id: number;
39
- awi_values: string[];
40
- awi_corrected_values: string[];
41
- awi_status: AnnotationStatus;
42
- awi_added_by?: {
43
- awi_id: number;
44
- awi_level: "awi_annotator" | "awi_verifier" | "awi_supervisor";
45
- };
46
- }[];
47
-
48
- export declare const AnnotationComponentLibrary: React.FC<AnnotationComponentLibraryProps>;
49
-
50
- declare type AnnotationComponentLibraryProps = {
51
- imageUrl?: string;
52
- showAnnotations?: boolean;
53
- createAnnotation?: (coords: {
54
- x: number;
55
- y: number;
56
- }[], classId: any, isSam: any, cb?: () => void) => void;
57
- handleMultipleAnnotations?: (payload: any, cb?: () => void) => void;
58
- handleUpdateAnnotationCoordinates?: (coords: {
59
- x: number;
60
- y: number;
61
- }[], annotation_id: string, cb?: () => void) => void;
62
- className?: string;
63
- content_id?: string;
64
- request_id?: number;
65
- isEditing?: boolean;
66
- handleSelectTool?: (tool: "edit" | "annotate") => void;
67
- selectIndex?: string;
68
- handleSelectAnnotationIndex?: (index: string, changeMode?: boolean) => void;
69
- showAnnotationType?: ShowAnnotationStatus;
70
- loggedUser?: any;
71
- isCarousel?: boolean;
72
- classColorMap?: any;
73
- disableAnnotation?: boolean;
74
- SAMToggle?: string;
75
- handleSAMToggle?: (tool: "SAM" | "Normal") => void;
76
- imageNumber?: number;
77
- togglePagination?: (callback: (prev: boolean) => boolean) => void;
78
- unSelectedAnnotationIDsSet?: Set<string>;
79
- setMousePosition?: ({ x, y }: {
80
- x: any;
81
- y: any;
82
- }) => void;
83
- allowedToCopyPreview?: boolean;
84
- copyCallBackHandler?: any;
85
- annotationSession?: any;
86
- SAMToggleValue?: any;
87
- selectedSAMTool?: any;
88
- handleCopyAnnotations?: (annotations: any, copyAll: any) => void;
89
- setOpenRequestDetails?: (a: any) => void;
90
- openRequestDetails?: any;
91
- handleNextPage?: () => void;
92
- handlePreviousPage?: () => void;
93
- handleGoToPage?: (index: number) => void;
94
- currentPage?: any;
95
- handleUpdateImageIndex?: (index: number) => void;
96
- requestId?: any;
97
- showPagination?: any;
98
- isAnnotationCreating?: any;
99
- contentInfo?: any;
100
- content_key?: any;
101
- isAnnotationUpdating?: any;
102
- isDeleteAnnotationMutationLoading?: any;
103
- showGuidelinesFirst?: any;
104
- currentImage?: number;
105
- selectedContent?: any;
106
- switchToEditMode?: () => void;
107
- switchToCreateMode?: () => void;
108
- goToNextImage?: () => void;
109
- goToPreviousImage?: () => void;
110
- handleGoToPendingAnnotations?: () => void;
111
- handlePasteAnnotationsByControlV?: () => void;
112
- annotationsResponse?: any;
113
- isAnnotationFetching?: boolean;
114
- fetchAnnotationsKey?: any;
115
- request?: any;
116
- parentReqData?: any;
117
- clearAnnotationCache?: any;
118
- RequestInfoModal?: any;
119
- getAnnotationFromSAM?: (a: any) => any;
120
- getAnnotationsFromSAMPrompt?: (a: any) => any;
121
- fetchAnnotations?: any;
122
- pageCount?: number;
123
- annotationViewType?: string;
124
- AnnotationPagination?: any;
125
- REACT_APP_SAM_ENABLED?: string;
126
- ImageGenerationHelper: any;
127
- fallbackImageUrl?: string;
128
- activeColor?: any;
129
- Carousel?: any;
130
- showTool?: boolean;
131
- };
132
-
133
- export declare type AnnotationLibraryComponentProps = {
134
- title?: string;
135
- };
19
+ declare function areAllValuesEmpty(obj: any): boolean;
136
20
 
137
- export declare type AnnotationStatus = "approved" | "rejected" | "pending" | "corrected";
21
+ export declare const AwiCanvas: ForwardRefExoticComponent<AwiCanvasProps & RefAttributes<AwiCanvasRef>>;
138
22
 
139
- export declare type AnnotationType = "rectangle" | "circle" | "polygon" | "dot";
23
+ declare interface AwiCanvasDimensions {
24
+ width?: number | string;
25
+ height?: number | string;
26
+ }
140
27
 
141
- declare function areAllValuesEmpty(obj: any): boolean;
28
+ declare interface AwiCanvasInteractionHandlers {
29
+ handleMouseDown?: (event: default_2.MouseEvent) => void;
30
+ handleMouseUp?: (event: default_2.MouseEvent) => void;
31
+ handleMouseMove?: (event: default_2.MouseEvent) => void;
32
+ handleMouseMoveOut?: (event: default_2.MouseEvent) => void;
33
+ handleOnMouseLeave?: (event: default_2.MouseEvent) => void;
34
+ handleWheel?: (event: default_2.WheelEvent) => void;
35
+ handleTouchStart?: (event: default_2.TouchEvent) => void;
36
+ handleTouchMove?: (event: default_2.TouchEvent) => void;
37
+ handleTouchEnd?: (event: default_2.TouchEvent) => void;
38
+ handleTouchCancel?: (event: default_2.TouchEvent) => void;
39
+ }
142
40
 
143
- export declare const AwiAnnotationHotkeys: default_2.FC<AwiAnnotationHotkeysProps>;
41
+ export declare interface AwiCanvasProps extends AwiCanvasInteractionHandlers {
42
+ imageUrl?: string | null;
43
+ dimensions?: AwiCanvasDimensions;
44
+ backgroundColor?: string;
45
+ showCrosshair?: boolean;
46
+ loader?: default_2.ReactNode;
47
+ rendering?: boolean;
48
+ zoomConfig?: CanvasZoomConfig;
49
+ panConfig?: CanvasPanConfig;
50
+ onZoomChange?: (state: ZoomPanState) => void;
51
+ onPanChange?: (pan: Pick<ZoomPanState, "x" | "y">) => void;
52
+ }
144
53
 
145
- export declare type AwiAnnotationHotkeysProps = {
146
- title?: string;
147
- toggleSelectAnnotation: (direction: "forward" | "backward" | "last_update") => void;
148
- handleLeftKeyDown: () => void;
149
- handleRightKeyDown: () => void;
150
- handleUpKeyDown: () => void;
151
- handleDownKeyDown: () => void;
152
- handleZoomInClick: () => void;
153
- handleZoomOutClick: () => void;
154
- handleCompleteAnnotation: () => void;
155
- undoAnnotationPoint: () => void;
156
- reLoadAndReDrawAnnotations: () => void;
157
- togglePagination: React.Dispatch<React.SetStateAction<boolean>>;
158
- toggleFullscreen: () => void;
159
- switchToAutoAnnotations: () => void;
160
- openShortCutRequestDetails: () => void;
161
- handleRecentAnnotatedVerifiedImages: () => void;
162
- handleSendToSamFunctionPrompt: () => void;
163
- samAPIactive: boolean;
164
- request?: any;
165
- switchToEditMode?: () => void;
166
- switchToCreateMode?: () => void;
167
- goToNextImage?: () => void;
168
- goToPreviousImage?: () => void;
169
- loggedUser: LoggedUser;
170
- handleGoToPendingAnnotations?: () => void;
171
- handleCopyByCtrlC?: () => void;
172
- handlePasteAnnotationsByControlV?: () => void;
173
- openShortCutKeyModal: any;
174
- setOpenShortCutKeyModal: (boolean: any) => void;
175
- setIsAltViaToolPressHandle: () => void;
176
- isCarousel: boolean;
177
- selectedTool: string;
178
- setCrossHairHandle: () => void;
179
- controlPlusHotkey?: () => void;
180
- controlMinusHotkey?: () => void;
181
- };
182
-
183
- export declare const AwiAnnotationTools: React.FC<AwiAnnotationToolsProps>;
184
-
185
- export declare type AwiAnnotationToolsProps = {
186
- handleSelectTool?: (tool: "edit" | "annotate") => void;
187
- handleSAMToggle?: (tool: "SAM" | "Normal") => void;
188
- isEditing: boolean;
189
- loggedUser: LoggedUser;
190
- annotator_name: string;
191
- hasAnnotation: boolean;
192
- SAMToggleValue: boolean;
193
- currentSelectedSAMTool: any;
194
- handleCopyAnnotations: any;
195
- setOpenRequestDetails?: (a: any) => void;
196
- openRequestDetails: boolean;
197
- show_guidelines_first: boolean;
198
- handleZoomInClick: () => void;
199
- zoomProperties: any;
200
- handleReset: () => void;
201
- handleZoomOutClick: () => void;
202
- handleCompleteAnnotation: () => void;
203
- toggleFullscreen: () => void;
204
- selectAnnotationId?: any;
205
- selectedAnnotationInfo?: any;
206
- undoLastStateAnnotation: () => void;
207
- usingSamFunction: boolean;
208
- samAPIactive: boolean;
209
- handleSendToSamFunction: () => void;
210
- coordinates: any;
211
- handleSendToSamFunctionPrompt: () => void;
212
- reLoadAndReDrawAnnotations: () => void;
213
- showGuidelinesFirst: boolean;
214
- isMobile?: boolean;
215
- toggleSelectAnnotation: () => void;
216
- handleLeftKeyDown: () => void;
217
- handleRightKeyDown: () => void;
218
- handleUpKeyDown: () => void;
219
- handleDownKeyDown: () => void;
220
- undoAnnotationPoint: () => void;
221
- togglePagination: () => void;
222
- switchToEditMode?: () => void;
223
- switchToCreateMode?: () => void;
224
- goToNextImage?: () => void;
225
- goToPreviousImage?: () => void;
226
- handleGoToPendingAnnotations?: () => void;
227
- handleCopyByCtrlC?: () => void;
228
- handlePasteAnnotationsByControlV?: () => void;
229
- showPagination?: boolean;
230
- isControlViaToolPress: boolean;
231
- isAltViaToolPress: boolean;
232
- setIsControlViaToolPress: (boolean: any) => void;
233
- setIsAltViaToolPress: (boolean: any) => void;
234
- isCarousel: boolean;
235
- allowedToCopyPreview: boolean;
236
- classColorMapToSend?: any;
237
- request: any;
238
- parentReqData: any;
239
- RequestInfoModal: any;
240
- setCrossHair: (boolean: any) => void;
241
- isCrossHair: boolean;
242
- annotationViewType?: string;
243
- REACT_APP_SAM_ENABLED?: string;
244
- controlMinusHotkey?: () => void;
245
- controlPlusHotkey?: () => void;
246
- Carousel?: any;
247
- };
248
-
249
- export declare const AwiCanvasContainer: React.FC<AwiCanvasContainerProps>;
250
-
251
- export declare type AwiCanvasContainerProps = {
252
- title?: string;
253
- canvasDimensions: any;
254
- zoomProperties: any;
255
- isEditing: any;
256
- canvasRef: any;
257
- bgCanvasRef: any;
258
- overlayCanvasRef: any;
259
- handleMouseDown: any;
260
- handleMouseUp: any;
261
- handleMouseMove: any;
262
- handleMouseMoveOut: any;
263
- handleOnMouseLeave: any;
264
- handleWheel: any;
265
- handleTouchStart: any;
266
- handleTouchMove: any;
267
- handleTouchEnd: any;
268
- handleTouchCancel: any;
54
+ export declare type AwiCanvasRef = MultiLayerCanvasRef & {
55
+ zoomState: ZoomPanState;
56
+ setZoomState: (next: ZoomPanState | ((prev: ZoomPanState) => ZoomPanState)) => void;
57
+ resetView: () => void;
269
58
  };
270
59
 
271
60
  export declare const AwiCustomConfirmation: default_2.FC<AwiCustomConfirmationProps>;
@@ -449,17 +238,6 @@ export declare const AwiSafeLocalStorage: {
449
238
  removeLogout: () => void;
450
239
  };
451
240
 
452
- export declare const AwiSamModal: React.FC<AwiSamModalProps>;
453
-
454
- export declare type AwiSamModalProps = {
455
- closeSAMPromptModal: () => void;
456
- onSubmit: any;
457
- directPrompt: any;
458
- isLoading: boolean;
459
- requestInfo: any;
460
- title?: string;
461
- };
462
-
463
241
  export declare const AwiScrollableTableCellList: React.FC<AwiListProps>;
464
242
 
465
243
  export declare const AwiSlider: React.FC<AwiSliderProps>;
@@ -658,6 +436,30 @@ export declare type ButtonProps = HTMLButtonProps & {
658
436
 
659
437
  declare type ButtonVariant = "primary" | "secondary" | "tertiary" | "nav";
660
438
 
439
+ declare interface CanvasPanBounds {
440
+ x?: {
441
+ min?: number;
442
+ max?: number;
443
+ };
444
+ y?: {
445
+ min?: number;
446
+ max?: number;
447
+ };
448
+ }
449
+
450
+ declare interface CanvasPanConfig {
451
+ enabled?: boolean;
452
+ bounds?: CanvasPanBounds;
453
+ }
454
+
455
+ declare interface CanvasZoomConfig {
456
+ enabled?: boolean;
457
+ min?: number;
458
+ max?: number;
459
+ initialScale?: number;
460
+ step?: number;
461
+ }
462
+
661
463
  declare function capitalizeFirstChar(str: any): any;
662
464
 
663
465
  export declare const Chart: React.FC<ChartProps>;
@@ -755,19 +557,6 @@ export declare type ContactInputProps = {
755
557
  dsabledColor?: Color;
756
558
  };
757
559
 
758
- export declare type Content = {
759
- url: string;
760
- contentKey: string;
761
- directPrompt: string;
762
- };
763
-
764
- export declare type Coordinate = {
765
- x: number;
766
- y: number;
767
- };
768
-
769
- export declare type CorrectedAnnotationType = "created" | "not-created" | "";
770
-
771
560
  declare type CSSstring = string;
772
561
 
773
562
  declare type CustomOption = {
@@ -1152,23 +941,6 @@ export declare type LiveDotProps = {
1152
941
 
1153
942
  declare type LiveDotSize = "s" | "m" | "l";
1154
943
 
1155
- export declare interface LoggedInUser {
1156
- awi_email: string;
1157
- awi_id: number;
1158
- awi_level: userLevel;
1159
- awi_personal_info: {
1160
- awi_firstname: string;
1161
- awi_lastname: string;
1162
- awi_avatar?: string;
1163
- };
1164
- awi_verification_status?: string;
1165
- }
1166
-
1167
- export declare interface LoggedUser {
1168
- token: string;
1169
- userObj: LoggedInUser;
1170
- }
1171
-
1172
944
  export declare const LoginPage: <TFormValues extends Record<string, any> = any>({ width, height, elementSize, className, bannerImage, showAwirosLogo, title, description, headerImage, headerImageMargin, formConfig, formSchema, formSubmitDisclaimer, formSubmitButtonText, formSubmitLoading, onSubmit, footerItems, footerImage, footerImageMargin, }: LoginPageProps<TFormValues>) => JSX_2.Element;
1173
945
 
1174
946
  export declare type LoginPageProps<TFormValues extends Record<string, any> = any> = {
@@ -1259,13 +1031,6 @@ export declare interface MenuProps extends Omit<MenuProps_2, "style" | "classNam
1259
1031
  style?: React.CSSProperties;
1260
1032
  }
1261
1033
 
1262
- export declare interface MiniData {
1263
- awi_id: number;
1264
- awi_label: string;
1265
- awi_image_assignable_request?: boolean;
1266
- awi_creation?: Date;
1267
- }
1268
-
1269
1034
  export declare const Modal: default_2.FC<ModalProps>;
1270
1035
 
1271
1036
  export declare interface ModalButtonProps {
@@ -1299,6 +1064,13 @@ export declare type MonthPickerProps = {
1299
1064
  popupClassName?: string;
1300
1065
  };
1301
1066
 
1067
+ declare type MultiLayerCanvasRef = {
1068
+ container: RefObject<HTMLDivElement>;
1069
+ previewCanvas: RefObject<HTMLCanvasElement>;
1070
+ annotationCanvas: RefObject<HTMLCanvasElement>;
1071
+ imageCanvas: RefObject<HTMLCanvasElement>;
1072
+ };
1073
+
1302
1074
  export declare const Multiselect: default_2.FC<MultiselectProps>;
1303
1075
 
1304
1076
  export declare type MultiselectProps = {
@@ -1366,20 +1138,6 @@ export declare type PopoverProps = PopoverProps_2 & {
1366
1138
  backgroundColor?: Color;
1367
1139
  };
1368
1140
 
1369
- export declare type PostRequestBody = {
1370
- img_url: string;
1371
- coords: Coordinate[];
1372
- coordinates?: any;
1373
- };
1374
-
1375
- export declare type PostRequestPromptBody = {
1376
- requestId: number;
1377
- contents: Content[];
1378
- confidence: number;
1379
- modelName: string;
1380
- modelMaxResults: number;
1381
- };
1382
-
1383
1141
  export declare const Refresh: default_2.FC<RefreshProps>;
1384
1142
 
1385
1143
  export declare type RefreshIntervalOption = {
@@ -1430,8 +1188,6 @@ export declare type SelectProps = {
1430
1188
  textOverflow?: "ellipsis" | "clip";
1431
1189
  };
1432
1190
 
1433
- export declare type ShowAnnotationStatus = "approved" | "rejected" | "pending" | "corrected" | "all";
1434
-
1435
1191
  export declare const showToast: ({ type, title, body, }: ShowToastType) => void;
1436
1192
 
1437
1193
  declare type ShowToastType = {
@@ -1633,8 +1389,6 @@ export declare const useResize: () => {
1633
1389
  containerRef: RefObject<HTMLDivElement>;
1634
1390
  };
1635
1391
 
1636
- export declare type userLevel = "awi_root" | "awi_admin" | "awi_manager" | "awi_developer" | "awi_supervisor" | "awi_verifier" | "awi_annotator";
1637
-
1638
1392
  export declare const useTheme: () => Record<string, string>;
1639
1393
 
1640
1394
  export declare const useToast: () => {
@@ -1656,4 +1410,10 @@ export declare type WeekPickerProps = {
1656
1410
  popupClassName?: string;
1657
1411
  };
1658
1412
 
1413
+ declare interface ZoomPanState {
1414
+ scale: number;
1415
+ x: number;
1416
+ y: number;
1417
+ }
1418
+
1659
1419
  export { }