@ambuj.bhaskar/react-component-library 0.24.21-alpha → 0.25.0-alpha

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
@@ -1,14 +1,13 @@
1
1
  import { ComponentProps } from 'react';
2
2
  import { default as default_2 } from 'react';
3
- import { Dispatch } from 'react';
3
+ import { DropdownProps as DropdownProps_2 } from 'antd';
4
4
  import { JSX as JSX_2 } from 'react/jsx-runtime';
5
+ import { MenuProps as MenuProps_2 } from 'antd';
5
6
  import { PopoverProps as PopoverProps_2 } from 'antd';
6
7
  import { RangePickerProps } from 'antd/es/date-picker';
7
8
  import * as React_2 from 'react';
8
9
  import { ReactNode } from 'react';
9
- import { RefObject } from 'react';
10
10
  import { Resolver } from 'react-hook-form';
11
- import { SetStateAction } from 'react';
12
11
  import { TableProps as TableProps_2 } from 'antd';
13
12
  import { TimeRangePickerProps } from 'antd';
14
13
 
@@ -136,46 +135,6 @@ export declare type AnnotationStatus = "approved" | "rejected" | "pending" | "co
136
135
 
137
136
  export declare type AnnotationType = "rectangle" | "circle" | "polygon" | "dot";
138
137
 
139
- declare function areAllValuesEmpty(obj: any): boolean;
140
-
141
- export declare const AWI_ALL_GLOBALS: {
142
- MAX_TOASTS_COUNT: number;
143
- DISPLAY_SEARCH_MINIMUM_RECORDS: number;
144
- SAM_MODEL_NAME: string;
145
- SAM_MODEL_CONFIDENCE: number;
146
- SAM_MODEL_MAX_RESULTS: number;
147
- SAM_MODEL_MAX_RESULTS_MIN: number;
148
- SAM_MODEL_MAX_RESULTS_MAX: number;
149
- SAM_MODEL_DATA: {
150
- awi_id: string;
151
- awi_label: string;
152
- value: string;
153
- }[];
154
- INITIAL_ZOOM_PROPERTIES: {
155
- scale: number;
156
- x: number;
157
- y: number;
158
- };
159
- INITIAL_ZOOM_LEVEL: number;
160
- HOVER_TO_SELECT_ON_ALREADY_SELECTED: boolean;
161
- DEFAULT_CANVAS_RATION: {
162
- w: number;
163
- h: number;
164
- };
165
- MAX_ANNOTATIONS_TO_HOVER: number;
166
- TWO_PIE: number;
167
- POLYGON_POINT_REMOVE_CONFIRM_PROMPT: boolean;
168
- MAX_ANNOTATIONS_TO_RUN_FAST: number;
169
- STATUS_COLOR_MAP: Record<string, string>;
170
- };
171
-
172
- /**
173
- * File for handling and returning background images
174
- */
175
- export declare const AWI_IMAGE_VALIDITY_HELPER: {
176
- checkImageValidity: (url: string, setBackgroundImage: any, contentKey: string | undefined, annotationViewType: string | undefined, fallbackImageUrl: any, defaultImage?: string) => Promise<void>;
177
- };
178
-
179
138
  export declare const AwiAnnotationHotkeys: default_2.FC<AwiAnnotationHotkeysProps>;
180
139
 
181
140
  export declare type AwiAnnotationHotkeysProps = {
@@ -330,39 +289,6 @@ export declare type AwiEmptyStateProps = {
330
289
  stateTitle?: string;
331
290
  };
332
291
 
333
- export declare const AwiGenerateHeader: default_2.FC<AwiGenerateHeaderProps>;
334
-
335
- declare type AwiGenerateHeaderProps = {
336
- list: string[];
337
- headerClass?: string;
338
- type?: string;
339
- };
340
-
341
- export declare const AwiHelperMethods: {
342
- getStatusDisplayText: (status: string, user: any) => any;
343
- displayVersion: (branch: any, commitId: any, buildDate: any, buildNumber: any) => void;
344
- toAPIQueryString: (params: any) => string;
345
- isSAMAllowed: (type: string | undefined, requestFor?: string) => boolean;
346
- checkValidPassword: (val: any) => boolean;
347
- getRelativeTime: (inputDate: Date) => string;
348
- randomVibrantColor: () => string;
349
- chunkArray: typeof chunkArray;
350
- isValidMobileNumber: (val: any) => boolean;
351
- sleepSystem: (time: number) => Promise<void>;
352
- secondDelayDisplayMessage: (time: number) => string;
353
- areAllValuesEmpty: typeof areAllValuesEmpty;
354
- isEighteenOrOlder: typeof isEighteenOrOlder;
355
- displayTimeAndDateInfo: (date?: any) => string;
356
- hasMoreRecords: (allPages: any) => any;
357
- checkOnboardingComplete: (myDetails: any) => boolean;
358
- checkBillingAvailable: (myDetails: any) => boolean;
359
- capitalizeFirstChar: typeof capitalizeFirstChar;
360
- sendEmptyLabelStatus: (labels: any) => any;
361
- isImageKitURL: (src?: string) => boolean;
362
- byteToSize: (bytes: number) => string;
363
- useThrottle: (func: any, limit: any) => (...args: any) => void;
364
- };
365
-
366
292
  export declare const AwiInput: React.FC<AwiInputProps>;
367
293
 
368
294
  export declare type AwiInputProps = {
@@ -484,15 +410,6 @@ export declare type AwiPaginationProps = {
484
410
  isLoading: boolean;
485
411
  };
486
412
 
487
- export declare const AwiSafeLocalStorage: {
488
- getItem: (key: any) => string | null;
489
- setItem: (key: any, value: any) => void;
490
- removeItem: (key: any) => void;
491
- getToken: () => string;
492
- removeToken: () => void;
493
- removeLogout: () => void;
494
- };
495
-
496
413
  export declare const AwiSamModal: React.FC<AwiSamModalProps>;
497
414
 
498
415
  export declare type AwiSamModalProps = {
@@ -614,11 +531,6 @@ export declare const AwiToastMessage: {
614
531
  }) => void;
615
532
  };
616
533
 
617
- export declare const AwiUseKeyChecker: () => {
618
- isCtrlPressedFunc: () => boolean;
619
- isAltPressedFunc: () => boolean;
620
- };
621
-
622
534
  export declare const Backdrop: default_2.FC<BackdropProps>;
623
535
 
624
536
  export declare interface BackdropProps extends ComponentProps<"div"> {
@@ -702,15 +614,6 @@ export declare type ButtonProps = HTMLButtonProps & {
702
614
 
703
615
  declare type ButtonVariant = "primary" | "secondary" | "tertiary" | "nav";
704
616
 
705
- declare function calculateCentroid(coordinates: any): {
706
- x: number;
707
- y: number;
708
- }[];
709
-
710
- declare function calculateCircleFromCoordinates(coordinates: any): any;
711
-
712
- declare function capitalizeFirstChar(str: any): any;
713
-
714
617
  export declare const Chart: React.FC<ChartProps>;
715
618
 
716
619
  declare type ChartData = {
@@ -741,13 +644,6 @@ export declare type ChartProps = {
741
644
 
742
645
  declare type ChartType = "line" | "bar" | "doughnut" | "pie";
743
646
 
744
- /**
745
- * All Helper methods will be defined here
746
- */
747
- declare function chunkArray<T>(arr: T[], chunkSize?: number): T[][];
748
-
749
- declare function clampValue(value: any, min: any, max: any): number;
750
-
751
647
  declare type Color = string;
752
648
 
753
649
  export declare const CompactEventCard: React.FC<CompactEventCardPropsType>;
@@ -843,8 +739,6 @@ export declare type DateRangePickerProps = {
843
739
 
844
740
  declare type DateTimeFormat = string;
845
741
 
846
- export declare const DEFAULT_THEME: ThemeObject;
847
-
848
742
  export declare const DetectionCarousel: React.FC<DetectionCarouselProps>;
849
743
 
850
744
  export declare type DetectionCarouselProps = {
@@ -854,6 +748,63 @@ export declare type DetectionCarouselProps = {
854
748
  data: BlobType[];
855
749
  };
856
750
 
751
+ export declare const Dropdown: default_2.FC<DropdownProps>;
752
+
753
+ export declare interface DropdownProps extends Omit<DropdownProps_2, "style" | "className"> {
754
+ /**
755
+ * Custom CSS class name
756
+ */
757
+ className?: string;
758
+ /**
759
+ * Custom style object
760
+ */
761
+ style?: React.CSSProperties;
762
+ /**
763
+ * The content to trigger the dropdown
764
+ */
765
+ children?: ReactNode;
766
+ /**
767
+ * Theme configuration for the dropdown
768
+ * Pass simple color and style properties, component handles the rest internally
769
+ */
770
+ theme?: DropdownTheme;
771
+ }
772
+
773
+ declare interface DropdownTheme {
774
+ /**
775
+ * Button styling
776
+ */
777
+ button?: {
778
+ backgroundColor?: string;
779
+ borderColor?: string;
780
+ color?: string;
781
+ hoverBackgroundColor?: string;
782
+ hoverBorderColor?: string;
783
+ hoverColor?: string;
784
+ };
785
+ /**
786
+ * Menu styling
787
+ */
788
+ menu?: {
789
+ backgroundColor?: string;
790
+ borderColor?: string;
791
+ borderRadius?: string;
792
+ boxShadow?: string;
793
+ /**
794
+ * Menu items styling
795
+ */
796
+ item?: {
797
+ color?: string;
798
+ backgroundColor?: string;
799
+ hoverColor?: string;
800
+ hoverBackgroundColor?: string;
801
+ selectedColor?: string;
802
+ selectedBackgroundColor?: string;
803
+ disabledColor?: string;
804
+ };
805
+ };
806
+ }
807
+
857
808
  declare type EventElement = "app" | "source" | "severity" | "date" | "time";
858
809
 
859
810
  export declare const EventPreview: React.FC<EventPreviewProps>;
@@ -986,8 +937,6 @@ export declare type InputProps = HTMLInputProps & {
986
937
  borderColor?: Color;
987
938
  };
988
939
 
989
- declare function isEighteenOrOlder(birthDate: any): boolean;
990
-
991
940
  declare type JustifyContent = "center" | "start" | "end" | "flex-start" | "flex-end" | "left" | "right" | "baseline" | "first baseline" | "last baseline" | "space-between" | "space-around" | "space-evenly" | "stretch";
992
941
 
993
942
  declare type LineVariant = "fill" | "line";
@@ -1085,74 +1034,18 @@ export declare type MapViewProps = {
1085
1034
  onFocusedIndexChange?: (index: number) => void;
1086
1035
  };
1087
1036
 
1088
- export declare const MathAnnotationHelper: {
1089
- gcd: any;
1090
- getDistance: (x1: number, y1: number, x2: number, y2: number) => number;
1091
- isLeft: (P0: any, P1: any, P2: any) => number;
1092
- windingNumber: (P: any, polygon: any, sensitivity?: number) => number;
1093
- getDiameter: (coords: {
1094
- x: number;
1095
- y: number;
1096
- }[]) => number;
1097
- checkPointInsidePolygon: (x: number, y: number, polygon: any, pos_sensitivity: number, neg_sensitivity: number, request: any, scale?: number) => boolean;
1098
- isAnnotationCoordinatesValid: (request: any, coords: {
1099
- x: number;
1100
- y: number;
1101
- }[], usingSamFunction?: boolean, scale?: number) => boolean;
1102
- distanceToSegment: (px: any, py: any, x1: any, y1: any, x2: any, y2: any) => number;
1103
- findClosestSegment: (polygon: any, px: any, py: any) => {
1104
- insertIndex: number;
1105
- minDistance: number;
1106
- };
1107
- transformCoordinatesCheck: (newXTransform: any, newYTransform: any, widthIncreased: any, heightIncreased: any) => {
1108
- newXTransform: any;
1109
- newYTransform: any;
1110
- };
1111
- getBoundingBox: (points: any) => {
1112
- x: number;
1113
- y: number;
1114
- }[];
1115
- translateCoordinatesWithFixedWidth: typeof translateCoordinatesWithFixedWidth;
1116
- clampValue: typeof clampValue;
1117
- calculateCircleFromCoordinates: typeof calculateCircleFromCoordinates;
1118
- calculateCentroid: typeof calculateCentroid;
1119
- minDistanceToPolygon: (point: Point, polygon: Polygon) => number;
1120
- closestCoordinates: (point: Point, polygon: Polygon) => {
1121
- minDistance: number;
1122
- insertIndex: number;
1123
- };
1124
- fineTuneCoordinates: (coordinateList: any) => any;
1125
- zoomLevelValue: (value: any, scale: any) => number;
1126
- createPolygonLoop: (outline: {
1127
- x: number;
1128
- y: number;
1129
- }[]) => {
1130
- x: number;
1131
- y: number;
1132
- }[];
1133
- breakPointCount: (coordinate: any) => number;
1134
- getBoundingBoxValues: (points: Point[]) => {
1135
- minX: number;
1136
- minY: number;
1137
- maxX: number;
1138
- maxY: number;
1139
- };
1140
- shiftPolygon: typeof shiftPolygon;
1141
- getPerfectPointValue: (coordinatePoint?: number) => number;
1142
- adjustToCircle: (coords: any) => any;
1143
- getMousePos: (canvas: any, evt: any) => {
1144
- x: number;
1145
- y: number;
1146
- };
1147
- getMousePosAbsolute: (canvas: any, evt: any) => {
1148
- x: number;
1149
- y: number;
1150
- };
1151
- getUpdatedCoordinates: (canvasRef: any, event: any, initialCoords: any) => {
1152
- x: number;
1153
- y: number;
1154
- }[];
1155
- };
1037
+ export declare const Menu: default_2.FC<MenuProps>;
1038
+
1039
+ export declare interface MenuProps extends Omit<MenuProps_2, "style" | "className"> {
1040
+ /**
1041
+ * Custom CSS class name
1042
+ */
1043
+ className?: string;
1044
+ /**
1045
+ * Custom style object
1046
+ */
1047
+ style?: React.CSSProperties;
1048
+ }
1156
1049
 
1157
1050
  export declare interface MiniData {
1158
1051
  awi_id: number;
@@ -1161,15 +1054,6 @@ export declare interface MiniData {
1161
1054
  awi_creation?: Date;
1162
1055
  }
1163
1056
 
1164
- export declare const MockImageGenerationHelper: {
1165
- HARDCODED_FALL_BACK_IMAGE: string;
1166
- HARDCODED_FALL_BACK_BIG_IMAGE: string;
1167
- DEFAULT_AVATAR_IMAGE: string;
1168
- generateImageUrl: (url: string | undefined | null, _serverLink?: boolean) => string;
1169
- getImageKitUrl: (url: string, _width?: number, _height?: number, _q?: number) => string;
1170
- getUserAvatar: (user: any) => string;
1171
- };
1172
-
1173
1057
  export declare const Modal: default_2.FC<ModalProps>;
1174
1058
 
1175
1059
  export declare interface ModalButtonProps {
@@ -1242,16 +1126,6 @@ export declare type PaginationProps = {
1242
1126
  className?: string;
1243
1127
  };
1244
1128
 
1245
- /**
1246
- * Mathematics helpers for our system, majorly for annotations
1247
- */
1248
- declare type Point = {
1249
- x: number;
1250
- y: number;
1251
- };
1252
-
1253
- declare type Polygon = Point[];
1254
-
1255
1129
  export declare const Popover: React.FC<PopoverProps>;
1256
1130
 
1257
1131
  export declare type PopoverProps = PopoverProps_2 & {
@@ -1322,18 +1196,8 @@ export declare type SelectProps = {
1322
1196
  textSize?: "xs" | "s" | "m" | "l" | "xl";
1323
1197
  };
1324
1198
 
1325
- declare function shiftPolygon(polygon: any): any;
1326
-
1327
1199
  export declare type ShowAnnotationStatus = "approved" | "rejected" | "pending" | "corrected" | "all";
1328
1200
 
1329
- export declare const showToast: ({ type, title, body, }: ShowToastType) => void;
1330
-
1331
- declare type ShowToastType = {
1332
- type: ToastType;
1333
- title?: string;
1334
- body?: string;
1335
- };
1336
-
1337
1201
  export declare const Sidebar: React.FC<SidebarProps>;
1338
1202
 
1339
1203
  export declare type SidebarConfig = {
@@ -1452,29 +1316,6 @@ export declare type TCoordinateType = {
1452
1316
 
1453
1317
  declare type TextSize = "xs" | "s" | "m" | "l" | "xl";
1454
1318
 
1455
- export declare type ThemeObject = {
1456
- name?: string;
1457
- colors?: ThemeSection;
1458
- sizes?: ThemeSection;
1459
- weights?: ThemeSection;
1460
- };
1461
-
1462
- export declare const ThemeProvider: ({ theme, log, children, }: {
1463
- theme?: ThemeObject;
1464
- log?: boolean;
1465
- children: ReactNode;
1466
- }) => JSX_2.Element;
1467
-
1468
- export declare type ThemeProviderProps = {
1469
- theme: ThemeObject;
1470
- log?: boolean;
1471
- children: ReactNode;
1472
- };
1473
-
1474
- export declare type ThemeSection = {
1475
- [key: string]: string | ThemeSection;
1476
- };
1477
-
1478
1319
  export declare const Toast: default_2.FC<ToastProps>;
1479
1320
 
1480
1321
  declare type ToastProps = {
@@ -1487,41 +1328,23 @@ declare type ToastProps = {
1487
1328
  onClose?: () => void;
1488
1329
  };
1489
1330
 
1490
- export declare const ToastProvider: () => JSX_2.Element;
1491
-
1492
1331
  declare type ToastType = "success" | "error" | "info" | "warning";
1493
1332
 
1494
- export declare type TPositionType = {
1495
- lat: number;
1496
- lng: number;
1497
- };
1333
+ export declare const Topbar: React.FC<TopbarProps>;
1498
1334
 
1499
- declare function translateCoordinatesWithFixedWidth(coordinates: any, shiftAmount?: number, targetCoordinate?: any): any;
1500
-
1501
- export declare function usePagination(initialPage?: number, initialTotalPages?: number): {
1502
- currentPage: number;
1503
- setPage: (newPage: number) => void;
1504
- nextPage: () => void;
1505
- prevPage: () => void;
1506
- totalPages: number;
1507
- setTotalPages: Dispatch<SetStateAction<number>>;
1335
+ export declare type TopbarProps = {
1336
+ title?: string;
1337
+ width?: CSSstring;
1338
+ height?: CSSstring;
1339
+ style?: React.CSSProperties;
1340
+ className?: string;
1508
1341
  };
1509
1342
 
1510
- export declare const useResize: () => {
1511
- width: number;
1512
- height: number;
1513
- containerRef: RefObject<HTMLDivElement>;
1343
+ export declare type TPositionType = {
1344
+ lat: number;
1345
+ lng: number;
1514
1346
  };
1515
1347
 
1516
1348
  export declare type userLevel = "awi_root" | "awi_admin" | "awi_manager" | "awi_developer" | "awi_supervisor" | "awi_verifier" | "awi_annotator";
1517
1349
 
1518
- export declare const useTheme: () => Record<string, string>;
1519
-
1520
- export declare const useToast: () => {
1521
- success: (body: string) => void;
1522
- error: (body: string) => void;
1523
- info: (body: string) => void;
1524
- warning: (body: string) => void;
1525
- };
1526
-
1527
1350
  export { }