cortex-react-ui 0.2.7 → 0.2.8

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.
Files changed (62) hide show
  1. package/lib/cjs/Camera/Camera.d.ts +1 -0
  2. package/lib/cjs/Map/App.d.ts +15 -0
  3. package/lib/cjs/Map/Map.d.ts +16 -0
  4. package/lib/cjs/Map/components/CenterActiveAreaControl.d.ts +5 -0
  5. package/lib/cjs/Map/components/DrawTools.d.ts +18 -0
  6. package/lib/cjs/Map/components/LocationContext.d.ts +7 -0
  7. package/lib/cjs/Map/components/MapFullscreenControl.d.ts +22 -0
  8. package/lib/cjs/Map/components/Maps.d.ts +22 -0
  9. package/lib/cjs/Map/config/appConfig.d.ts +4 -0
  10. package/lib/cjs/Map/config/config.d.ts +6 -0
  11. package/lib/cjs/Map/hooks/getGeoJSONTest.d.ts +16 -0
  12. package/lib/cjs/Map/hooks/useLocationContext.d.ts +1 -0
  13. package/lib/cjs/Map/index.d.ts +1 -0
  14. package/lib/cjs/Map/models/index.d.ts +2 -0
  15. package/lib/cjs/Map/models/location.d.ts +6 -0
  16. package/lib/cjs/Map/models/locationSearch.d.ts +4 -0
  17. package/lib/cjs/Map/models/point.d.ts +6 -0
  18. package/lib/cjs/Map/utils/logger.d.ts +17 -0
  19. package/lib/cjs/Map/utils/toolkit.d.ts +129 -0
  20. package/lib/cjs/Scanner/ScanConfirmationDialog.d.ts +1 -0
  21. package/lib/cjs/Scanner/Scanner.d.ts +1 -0
  22. package/lib/cjs/index.d.ts +1 -0
  23. package/lib/cjs/index.js +15 -3
  24. package/lib/cjs/index.js.map +1 -1
  25. package/lib/cjs/utils/setRef.d.ts +1 -0
  26. package/lib/esm/Camera/Camera.d.ts +1 -0
  27. package/lib/esm/Map/App.d.ts +15 -0
  28. package/lib/esm/Map/Map.d.ts +16 -0
  29. package/lib/esm/Map/components/CenterActiveAreaControl.d.ts +5 -0
  30. package/lib/esm/Map/components/DrawTools.d.ts +18 -0
  31. package/lib/esm/Map/components/LocationContext.d.ts +7 -0
  32. package/lib/esm/Map/components/MapFullscreenControl.d.ts +22 -0
  33. package/lib/esm/Map/components/Maps.d.ts +22 -0
  34. package/lib/esm/Map/config/appConfig.d.ts +4 -0
  35. package/lib/esm/Map/config/config.d.ts +6 -0
  36. package/lib/esm/Map/hooks/getGeoJSONTest.d.ts +16 -0
  37. package/lib/esm/Map/hooks/useLocationContext.d.ts +1 -0
  38. package/lib/esm/Map/index.d.ts +1 -0
  39. package/lib/esm/Map/models/index.d.ts +2 -0
  40. package/lib/esm/Map/models/location.d.ts +6 -0
  41. package/lib/esm/Map/models/locationSearch.d.ts +4 -0
  42. package/lib/esm/Map/models/point.d.ts +6 -0
  43. package/lib/esm/Map/utils/logger.d.ts +17 -0
  44. package/lib/esm/Map/utils/toolkit.d.ts +129 -0
  45. package/lib/esm/Scanner/ScanConfirmationDialog.d.ts +1 -0
  46. package/lib/esm/Scanner/Scanner.d.ts +1 -0
  47. package/lib/esm/index.d.ts +1 -0
  48. package/lib/esm/index.js +15 -3
  49. package/lib/esm/index.js.map +1 -1
  50. package/lib/esm/utils/setRef.d.ts +1 -0
  51. package/lib/images/layers-2x.png +0 -0
  52. package/lib/images/layers.png +0 -0
  53. package/lib/images/marker-icon-2x.png +0 -0
  54. package/lib/images/marker-icon.png +0 -0
  55. package/lib/images/marker-shadow.png +0 -0
  56. package/lib/index.d.ts +84 -1
  57. package/lib/styles/Camera/index.css +192 -0
  58. package/lib/styles/Camera/index.scss +0 -4
  59. package/lib/styles/Map/index.scss +50 -0
  60. package/lib/styles/index.scss +19 -0
  61. package/lib/typings/typings/css.d.ts +3 -0
  62. package/package.json +14 -4
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export default function setRef<T>(ref: React.MutableRefObject<T | null> | ((instance: T | null) => void) | null | undefined, value: T | null): void;
Binary file
Binary file
Binary file
Binary file
Binary file
package/lib/index.d.ts CHANGED
@@ -1,6 +1,9 @@
1
+ /// <reference types="react" />
1
2
  import React$1, { CSSProperties } from 'react';
2
3
  import { IDetectedBarcode, IScannerProps } from '@yudiel/react-qr-scanner';
3
4
  import { WebcamProps } from 'react-webcam';
5
+ import { MapContainerProps } from 'react-leaflet';
6
+ import { ControlPosition, LatLngTuple } from 'leaflet';
4
7
 
5
8
  declare const PopperPlacement: {
6
9
  readonly Center: "center";
@@ -162,6 +165,86 @@ interface TooltipProps {
162
165
  }
163
166
  declare const TagInput: React$1.FC<TooltipProps>;
164
167
 
168
+ declare class Point {
169
+ id: number;
170
+ order: number;
171
+ latitude: number;
172
+ longitude: number;
173
+ }
174
+
175
+ declare class Location {
176
+ id: number;
177
+ objId: string;
178
+ points: Point[];
179
+ }
180
+
181
+ type CenterActiveAreaControlProps = {
182
+ autoCenter?: boolean;
183
+ };
184
+
185
+ /** Props interface for MapFullscreenControl component */
186
+ type MapFullscreenControlProps = {
187
+ /** Change the content of the button, can be HTML, default null */
188
+ content?: string | undefined;
189
+ /** Change the position of the button can be topleft, topright, bottomright or bottomleft, default topleft */
190
+ position?: ControlPosition | undefined;
191
+ /** Change the title of the button, default Full Screen */
192
+ title?: string | undefined;
193
+ /** Change the title of the button when fullscreen is on, default Exit Full Screen */
194
+ titleCancel?: string | undefined;
195
+ /** Force separate button to detach from zoom buttons, default false */
196
+ forceSeparateButton?: boolean | undefined;
197
+ /** Force use of pseudo full screen even if full screen API is available, default false */
198
+ forcePseudoFullscreen?: boolean | undefined;
199
+ /** Use pseudo fullscreen */
200
+ pseudoFullscreen?: boolean | undefined;
201
+ /** Dom element to render in full screen, false by default, fallback to map._container */
202
+ fullscreenElement?: false | HTMLElement | undefined;
203
+ };
204
+
205
+ type DrawToolsProps = {
206
+ position?: ControlPosition | undefined;
207
+ handleOnCreated?: (v: void) => void;
208
+ handleOnDeleted?: (v: void) => void;
209
+ handleOnEdited?: (v: void) => void;
210
+ draw?: drawType;
211
+ editable?: boolean;
212
+ };
213
+ type drawType = {
214
+ polyline?: boolean;
215
+ polygon?: boolean;
216
+ rectangle?: boolean;
217
+ circle?: boolean;
218
+ marker?: boolean;
219
+ circlemarker?: boolean;
220
+ };
221
+
222
+ type MapsProps = {
223
+ MapContainerProps?: MapContainerProps;
224
+ center?: LatLngTuple;
225
+ fullscreen?: MapFullscreenControlProps | boolean;
226
+ centerActiveArea?: CenterActiveAreaControlProps | boolean;
227
+ drawTools?: DrawToolsProps | boolean;
228
+ minZoom?: number;
229
+ maxZoom?: number;
230
+ zoom?: number;
231
+ data?: Location[];
232
+ toggleSatelliteView?: boolean;
233
+ singlePosition?: boolean;
234
+ onChange?: (locations: Location[]) => void;
235
+ };
236
+
237
+ declare const Map: React$1.FC<AppProps>;
238
+ type AppProps = MapsProps & {
239
+ onClose?: (() => void);
240
+ onSave?: ((locations: Location[]) => void);
241
+ onChange?: ((locations: Location[]) => void);
242
+ customButtons?: {
243
+ cancelButton?: HTMLElement;
244
+ saveButton?: HTMLElement;
245
+ };
246
+ };
247
+
165
248
  interface MenuProps {
166
249
  containerRef: React$1.RefObject<HTMLElement>;
167
250
  className?: string;
@@ -325,4 +408,4 @@ interface Props {
325
408
  }
326
409
  declare const CrossIcon: React$1.FC<Props>;
327
410
 
328
- export { AuthDownloadLink, BarLoader, Button, Camera, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ConfirmDialog, ContextMenu, CrossIcon, Dialog, DialogActions, DialogContent$1 as DialogContent, DialogFooter, DialogHeader, DialogContent as DialogTitle, Divider, DomContainer, ErrorDialog, Menu, MenuGroup, MenuItem, Popper, PopupMenu, Scanner, Selected, Spinner, TagInput, ToggleButton, Tooltip, WarningDialog };
411
+ export { AuthDownloadLink, BarLoader, Button, Camera, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ConfirmDialog, ContextMenu, CrossIcon, Dialog, DialogActions, DialogContent$1 as DialogContent, DialogFooter, DialogHeader, DialogContent as DialogTitle, Divider, DomContainer, ErrorDialog, Map, Menu, MenuGroup, MenuItem, Popper, PopupMenu, Scanner, Selected, Spinner, TagInput, ToggleButton, Tooltip, WarningDialog };
@@ -0,0 +1,192 @@
1
+ .camera-container {
2
+ width: 100%;
3
+ height: 100%;
4
+ background-color: #000;
5
+ }
6
+
7
+ .camera-switch-btn {
8
+ all: initial;
9
+ display: flex;
10
+ cursor: pointer;
11
+ }
12
+
13
+ .camera-recording-dot {
14
+ width: 8px;
15
+ height: 8px;
16
+ border-radius: 50%;
17
+ background-color: #f44336;
18
+ animation: clignote 1s infinite;
19
+ }
20
+
21
+ .camera-recording-timer {
22
+ z-index: 99;
23
+ position: absolute;
24
+ top: 1rem;
25
+ left: 20px;
26
+ display: flex;
27
+ align-items: center;
28
+ justify-content: center;
29
+ background: rgba(0, 0, 0, 0.2);
30
+ border-radius: 4px;
31
+ padding: 3px 7px;
32
+ font-size: 12px;
33
+ color: #fff;
34
+ font-family: sans-serif;
35
+ gap: 6px;
36
+ }
37
+
38
+ .camera-offline-mode {
39
+ position: absolute;
40
+ top: 1rem;
41
+ right: 20px;
42
+ display: flex;
43
+ align-items: center;
44
+ justify-content: center;
45
+ background: rgba(0, 0, 0, 0.2);
46
+ border-radius: 4px;
47
+ padding: 3px 7px;
48
+ font-size: 12px;
49
+ color: red;
50
+ font-family: sans-serif;
51
+ }
52
+
53
+ .camera-mode {
54
+ z-index: 9999;
55
+ position: absolute;
56
+ bottom: 2rem;
57
+ right: 20px;
58
+ padding: 0.5rem;
59
+ border-radius: 6px;
60
+ color: #ffffff;
61
+ border: none;
62
+ cursor: pointer;
63
+ display: flex;
64
+ justify-content: center;
65
+ align-items: center;
66
+ gap: 7px;
67
+ background-color: #2196f3;
68
+ transition: background-color 0.3s ease;
69
+ }
70
+
71
+ .camera-preview {
72
+ position: relative;
73
+ width: 100%;
74
+ height: 100%;
75
+ overflow: hidden;
76
+ }
77
+
78
+ .camera-controls {
79
+ z-index: 999;
80
+ position: absolute;
81
+ bottom: 2rem;
82
+ left: 0;
83
+ right: 0;
84
+ display: flex;
85
+ justify-content: center;
86
+ gap: 1rem;
87
+ }
88
+
89
+ .video-play-btn {
90
+ all: initial;
91
+ position: absolute;
92
+ bottom: 10%;
93
+ left: 50%;
94
+ z-index: 9;
95
+ width: 1em;
96
+ height: 1em;
97
+ min-width: 15px;
98
+ min-height: 15px;
99
+ transform: translate(-50%, -50%);
100
+ display: flex;
101
+ justify-content: center;
102
+ align-items: center;
103
+ border-radius: 50%;
104
+ border: 1px solid;
105
+ padding: 20px 20px;
106
+ background-color: #ffffff;
107
+ cursor: pointer;
108
+ }
109
+
110
+ .camera-button {
111
+ padding: 0.5rem;
112
+ border-radius: 6px;
113
+ color: #ffffff;
114
+ border: none;
115
+ cursor: pointer;
116
+ display: flex;
117
+ justify-content: center;
118
+ align-items: center;
119
+ gap: 7px;
120
+ transition: background-color 0.3s ease;
121
+ }
122
+ .camera-button--capture {
123
+ border-radius: 50%;
124
+ color: initial;
125
+ width: 50px;
126
+ height: 50px;
127
+ border: 1px solid black;
128
+ background-color: #ffffff;
129
+ }
130
+ .camera-button--record {
131
+ border-radius: 50%;
132
+ color: red;
133
+ width: 50px;
134
+ height: 50px;
135
+ border: 1px solid black;
136
+ background-color: #ffffff;
137
+ }
138
+ .camera-button--download {
139
+ background-color: #4caf50;
140
+ }
141
+ .camera-button--download:hover {
142
+ background-color: #388e3c;
143
+ }
144
+ .camera-button--reset {
145
+ background-color: #9e9e9e;
146
+ }
147
+ .camera-button--reset:hover {
148
+ background-color: #757575;
149
+ }
150
+
151
+ .camera-offline-mode {
152
+ font-size: 0.875rem;
153
+ font-family: sans-serif;
154
+ color: #d32f2f;
155
+ }
156
+
157
+ .camera-screen-animation {
158
+ animation: fadeIn 0.3s;
159
+ }
160
+
161
+ @keyframes fadeIn {
162
+ 0% {
163
+ opacity: 0;
164
+ }
165
+ 100% {
166
+ opacity: 1;
167
+ }
168
+ }
169
+ @keyframes pulse {
170
+ 0% {
171
+ transform: scale(1);
172
+ }
173
+ 50% {
174
+ transform: scale(1.05);
175
+ }
176
+ 100% {
177
+ transform: scale(1);
178
+ }
179
+ }
180
+ @keyframes clignote {
181
+ 0% {
182
+ opacity: 1;
183
+ }
184
+ 50% {
185
+ opacity: 0;
186
+ }
187
+ 100% {
188
+ opacity: 1;
189
+ }
190
+ }
191
+
192
+ /*# sourceMappingURL=index.css.map */
@@ -110,10 +110,6 @@
110
110
  width: 100%;
111
111
  height: 90%;
112
112
  overflow: hidden;
113
- > img {
114
- margin: 0 auto;
115
- }
116
-
117
113
  }
118
114
 
119
115
  .camera-controls {
@@ -0,0 +1,50 @@
1
+ @use "../global.scss";
2
+
3
+ @mixin map($props: null, $options: null) {
4
+ $internal-options: global.$default-options;
5
+
6
+ $internal-props: (
7
+ bgColor: #212121,
8
+ fgColor: #fff,
9
+ );
10
+
11
+ $internal-props: global.safe-map-merge($internal-props, $props);
12
+ $internal-options: global.safe-map-merge($internal-options, $options);
13
+
14
+ .cortex-widget-buttons {
15
+ margin: 20px;
16
+ text-align: right;
17
+ }
18
+
19
+ .leaflet-container {
20
+ height: 85% !important;
21
+ }
22
+
23
+ .cortex-widget-viewport {
24
+ position: absolute;
25
+ inset: 100px;
26
+ }
27
+
28
+ .cortex-widget-btn {
29
+ color: #fff;
30
+ font-size: 14px;
31
+ padding: 6px 12px;
32
+ cursor: pointer;
33
+ border: 0;
34
+ border-radius: 3px;
35
+ box-shadow: none;
36
+ width: 100px;
37
+ }
38
+
39
+ .cortex-widget-btn-cancel {
40
+ margin: 10px;
41
+ background-color: #337ab7;
42
+ border-color: #2e6da4;
43
+ }
44
+
45
+ .cortex-widget-btn-save {
46
+ color: #fff;
47
+ background-color: #5cb85c;
48
+ border-color: #4cae4c;
49
+ }
50
+ }
@@ -14,6 +14,7 @@
14
14
  @use "Selected";
15
15
  @use "BarLoader";
16
16
  @use "Camera";
17
+ @use "Map";
17
18
 
18
19
  @include Icons.icons();
19
20
  @include Popper.popper();
@@ -29,3 +30,21 @@
29
30
  @include Selected.selected();
30
31
  @include BarLoader.barLoader();
31
32
  @include Camera.camera();
33
+ @include Map.map();
34
+
35
+ // @include popper();
36
+ // @include popper(
37
+ // (
38
+ // bgColor: red,
39
+ // fgColor: blue,
40
+ // )
41
+ // );
42
+ // @include popper(
43
+ // (
44
+ // bgColor: red,
45
+ // fgColor: blue,
46
+ // ),
47
+ // (
48
+ // properties: false
49
+ // )
50
+ // );
@@ -9,4 +9,7 @@ declare module '*.scss' {
9
9
  }
10
10
 
11
11
  // Add specific CSS module declarations
12
+ declare module 'leaflet/dist/leaflet.css';
13
+ declare module 'leaflet-draw/dist/leaflet.draw.css';
14
+ declare module 'leaflet.fullscreen/Control.FullScreen.css';
12
15
  declare module './css/center-active-control.css';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortex-react-ui",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "React UI",
5
5
  "author": "Anthony",
6
6
  "license": "MIT",
@@ -84,10 +84,13 @@
84
84
  "@testing-library/react": "^11.1.0",
85
85
  "@testing-library/user-event": "^12.1.10",
86
86
  "@types/jest": "^26.0.15",
87
+ "@types/leaflet": "^1.7.10",
88
+ "@types/leaflet-draw": "^1.0.11",
89
+ "@types/leaflet.fullscreen": "^1.6.1",
87
90
  "@types/node": "^22.10.5",
88
91
  "@types/react": "^17.0.0",
89
92
  "@types/react-dom": "^17.0.0",
90
- "@yudiel/react-qr-scanner": "^2.0.2",
93
+ "@yudiel/react-qr-scanner": "^2.1.0",
91
94
  "css-loader": "5.2.6",
92
95
  "eslint-config-airbnb": "^18.2.1",
93
96
  "eslint-plugin-import": "^2.25.2",
@@ -100,7 +103,6 @@
100
103
  "react-dom": "^18.1.0",
101
104
  "react-icons": "^5.3.0",
102
105
  "react-scripts": "^5.0.1",
103
- "react-webcam": "^7.2.0",
104
106
  "rollup": "^2.60.2",
105
107
  "rollup-plugin-copy": "^3.4.0",
106
108
  "rollup-plugin-css-only": "^4.5.2",
@@ -119,6 +121,14 @@
119
121
  "url-loader": "^4.1.1"
120
122
  },
121
123
  "dependencies": {
122
- "@rollup/plugin-replace": "^5.0.2"
124
+ "@rollup/plugin-replace": "^5.0.2",
125
+ "leaflet": "^1.8.0",
126
+ "leaflet-active-area": "^1.2.1",
127
+ "leaflet-draw": "^1.0.4",
128
+ "leaflet.fullscreen": "^2.4.0",
129
+ "react-leaflet": "^4.0.0",
130
+ "react-leaflet-draw": "^0.20.4",
131
+ "react-webcam": "^7.2.0",
132
+ "screenfull": "^6.0.2"
123
133
  }
124
134
  }