cortex-react-ui 0.2.7 → 0.2.9

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 (64) hide show
  1. package/lib/cjs/Camera/Camera.d.ts +2 -0
  2. package/lib/cjs/Map/App.d.ts +15 -0
  3. package/lib/cjs/Map/components/CenterActiveAreaControl.d.ts +5 -0
  4. package/lib/cjs/Map/components/DrawTools.d.ts +16 -0
  5. package/lib/cjs/Map/components/LocationContext.d.ts +7 -0
  6. package/lib/cjs/Map/components/MapFullscreenControl.d.ts +22 -0
  7. package/lib/cjs/Map/components/Maps.d.ts +19 -0
  8. package/lib/cjs/Map/config/appConfig.d.ts +4 -0
  9. package/lib/cjs/Map/config/config.d.ts +6 -0
  10. package/lib/cjs/Map/hooks/getGeoJSONTest.d.ts +16 -0
  11. package/lib/cjs/Map/hooks/useLocationContext.d.ts +1 -0
  12. package/lib/cjs/Map/index.d.ts +1 -0
  13. package/lib/cjs/Map/models/index.d.ts +2 -0
  14. package/lib/cjs/Map/models/location.d.ts +6 -0
  15. package/lib/cjs/Map/models/locationSearch.d.ts +4 -0
  16. package/lib/cjs/Map/models/point.d.ts +6 -0
  17. package/lib/cjs/Map/utils/httpService.d.ts +16 -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 +2 -0
  27. package/lib/esm/Map/App.d.ts +15 -0
  28. package/lib/esm/Map/components/CenterActiveAreaControl.d.ts +5 -0
  29. package/lib/esm/Map/components/DrawTools.d.ts +16 -0
  30. package/lib/esm/Map/components/LocationContext.d.ts +7 -0
  31. package/lib/esm/Map/components/MapFullscreenControl.d.ts +22 -0
  32. package/lib/esm/Map/components/Maps.d.ts +19 -0
  33. package/lib/esm/Map/config/appConfig.d.ts +4 -0
  34. package/lib/esm/Map/config/config.d.ts +6 -0
  35. package/lib/esm/Map/hooks/getGeoJSONTest.d.ts +16 -0
  36. package/lib/esm/Map/hooks/useLocationContext.d.ts +1 -0
  37. package/lib/esm/Map/index.d.ts +1 -0
  38. package/lib/esm/Map/models/index.d.ts +2 -0
  39. package/lib/esm/Map/models/location.d.ts +6 -0
  40. package/lib/esm/Map/models/locationSearch.d.ts +4 -0
  41. package/lib/esm/Map/models/point.d.ts +6 -0
  42. package/lib/esm/Map/utils/httpService.d.ts +16 -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 +79 -1
  57. package/lib/styles/Camera/index.css +196 -0
  58. package/lib/styles/Camera/index.scss +0 -4
  59. package/lib/styles/Map/index.scss +50 -0
  60. package/lib/styles/Scanner/index.css +75 -0
  61. package/lib/styles/index.scss +19 -0
  62. package/lib/typings/typings/css.d.ts +3 -0
  63. package/package.json +1 -1
  64. package/lib/styles/Scanner/index.scss +0 -110
@@ -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";
@@ -107,6 +110,7 @@ type CameraProps = {
107
110
  validateText?: string;
108
111
  resetText?: string;
109
112
  isShowVideoButton?: boolean;
113
+ isShowSwitchButton?: boolean;
110
114
  } & Partial<WebcamProps>;
111
115
  type TfileCapturedProps = {
112
116
  fileStoreName?: string | null;
@@ -162,6 +166,80 @@ interface TooltipProps {
162
166
  }
163
167
  declare const TagInput: React$1.FC<TooltipProps>;
164
168
 
169
+ declare class Point {
170
+ id: number;
171
+ order: number;
172
+ latitude: number;
173
+ longitude: number;
174
+ }
175
+
176
+ declare class Location {
177
+ id: number;
178
+ objId: string;
179
+ points: Point[];
180
+ }
181
+
182
+ type CenterActiveAreaControlProps = {
183
+ autoCenter?: boolean;
184
+ };
185
+
186
+ /** Props interface for MapFullscreenControl component */
187
+ type MapFullscreenControlProps = {
188
+ /** Change the content of the button, can be HTML, default null */
189
+ content?: string | undefined;
190
+ /** Change the position of the button can be topleft, topright, bottomright or bottomleft, default topleft */
191
+ position?: ControlPosition | undefined;
192
+ /** Change the title of the button, default Full Screen */
193
+ title?: string | undefined;
194
+ /** Change the title of the button when fullscreen is on, default Exit Full Screen */
195
+ titleCancel?: string | undefined;
196
+ /** Force separate button to detach from zoom buttons, default false */
197
+ forceSeparateButton?: boolean | undefined;
198
+ /** Force use of pseudo full screen even if full screen API is available, default false */
199
+ forcePseudoFullscreen?: boolean | undefined;
200
+ /** Use pseudo fullscreen */
201
+ pseudoFullscreen?: boolean | undefined;
202
+ /** Dom element to render in full screen, false by default, fallback to map._container */
203
+ fullscreenElement?: false | HTMLElement | undefined;
204
+ };
205
+
206
+ type DrawToolsProps = {
207
+ position?: ControlPosition | undefined;
208
+ handleOnCreated?: (v: void) => void;
209
+ handleOnDeleted?: (v: void) => void;
210
+ draw?: drawType;
211
+ };
212
+ type drawType = {
213
+ polyline?: boolean;
214
+ polygon?: boolean;
215
+ rectangle?: boolean;
216
+ circle?: boolean;
217
+ marker?: boolean;
218
+ circlemarker?: boolean;
219
+ };
220
+
221
+ type MapsProps = {
222
+ MapContainerProps?: MapContainerProps;
223
+ center?: LatLngTuple;
224
+ fullscreen?: MapFullscreenControlProps | boolean;
225
+ centerActiveArea?: CenterActiveAreaControlProps | boolean;
226
+ drawTools?: DrawToolsProps | boolean;
227
+ minZoom?: number;
228
+ maxZoom?: number;
229
+ zoom?: number;
230
+ data?: Location[];
231
+ };
232
+
233
+ declare const App: React$1.FC<AppProps>;
234
+ type AppProps = MapsProps & {
235
+ onClose: (() => void);
236
+ onSave: ((points: Point[]) => void);
237
+ customButtons?: {
238
+ cancelButton?: HTMLElement;
239
+ saveButton?: HTMLElement;
240
+ };
241
+ };
242
+
165
243
  interface MenuProps {
166
244
  containerRef: React$1.RefObject<HTMLElement>;
167
245
  className?: string;
@@ -325,4 +403,4 @@ interface Props {
325
403
  }
326
404
  declare const CrossIcon: React$1.FC<Props>;
327
405
 
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 };
406
+ 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, App as Map, Menu, MenuGroup, MenuItem, Popper, PopupMenu, Scanner, Selected, Spinner, TagInput, ToggleButton, Tooltip, WarningDialog };
@@ -0,0 +1,196 @@
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
+ display: flex;
77
+ > video {
78
+ margin: 0 auto;
79
+ }
80
+ }
81
+
82
+ .camera-controls {
83
+ z-index: 999;
84
+ position: absolute;
85
+ bottom: 2rem;
86
+ left: 0;
87
+ right: 0;
88
+ display: flex;
89
+ justify-content: center;
90
+ gap: 1rem;
91
+ }
92
+
93
+ .video-play-btn {
94
+ all: initial;
95
+ position: absolute;
96
+ bottom: 10%;
97
+ left: 50%;
98
+ z-index: 9;
99
+ width: 1em;
100
+ height: 1em;
101
+ min-width: 15px;
102
+ min-height: 15px;
103
+ transform: translate(-50%, -50%);
104
+ display: flex;
105
+ justify-content: center;
106
+ align-items: center;
107
+ border-radius: 50%;
108
+ border: 1px solid;
109
+ padding: 20px 20px;
110
+ background-color: #ffffff;
111
+ cursor: pointer;
112
+ }
113
+
114
+ .camera-button {
115
+ padding: 0.5rem;
116
+ border-radius: 6px;
117
+ color: #ffffff;
118
+ border: none;
119
+ cursor: pointer;
120
+ display: flex;
121
+ justify-content: center;
122
+ align-items: center;
123
+ gap: 7px;
124
+ transition: background-color 0.3s ease;
125
+ }
126
+ .camera-button--capture {
127
+ border-radius: 50%;
128
+ color: initial;
129
+ width: 50px;
130
+ height: 50px;
131
+ border: 1px solid black;
132
+ background-color: #ffffff;
133
+ }
134
+ .camera-button--record {
135
+ border-radius: 50%;
136
+ color: red;
137
+ width: 50px;
138
+ height: 50px;
139
+ border: 1px solid black;
140
+ background-color: #ffffff;
141
+ }
142
+ .camera-button--download {
143
+ background-color: #4caf50;
144
+ }
145
+ .camera-button--download:hover {
146
+ background-color: #388e3c;
147
+ }
148
+ .camera-button--reset {
149
+ background-color: #9e9e9e;
150
+ }
151
+ .camera-button--reset:hover {
152
+ background-color: #757575;
153
+ }
154
+
155
+ .camera-offline-mode {
156
+ font-size: 0.875rem;
157
+ font-family: sans-serif;
158
+ color: #d32f2f;
159
+ }
160
+
161
+ .camera-screen-animation {
162
+ animation: fadeIn 0.3s;
163
+ }
164
+
165
+ @keyframes fadeIn {
166
+ 0% {
167
+ opacity: 0;
168
+ }
169
+ 100% {
170
+ opacity: 1;
171
+ }
172
+ }
173
+ @keyframes pulse {
174
+ 0% {
175
+ transform: scale(1);
176
+ }
177
+ 50% {
178
+ transform: scale(1.05);
179
+ }
180
+ 100% {
181
+ transform: scale(1);
182
+ }
183
+ }
184
+ @keyframes clignote {
185
+ 0% {
186
+ opacity: 1;
187
+ }
188
+ 50% {
189
+ opacity: 0;
190
+ }
191
+ 100% {
192
+ opacity: 1;
193
+ }
194
+ }
195
+
196
+ /*# 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
+ }
@@ -0,0 +1,75 @@
1
+ .btn {
2
+ display: flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ padding: 0.5rem 1rem;
6
+ border: 1px solid transparent;
7
+ border-radius: 0.375rem;
8
+ box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
9
+ font-size: 0.875rem;
10
+ font-weight: 500;
11
+ line-height: 1.25rem;
12
+ text-align: center;
13
+ text-transform: none;
14
+ white-space: nowrap;
15
+ vertical-align: middle;
16
+ user-select: none;
17
+ background-color: #4F46E5;
18
+ color: #fff;
19
+ cursor: pointer;
20
+ outline: none;
21
+ transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
22
+ }
23
+
24
+ .btn-default {
25
+ background-color: #4F46E5;
26
+ }
27
+
28
+ .btn-default:hover {
29
+ opacity: 0.8;
30
+ }
31
+
32
+ .select {
33
+ display: block;
34
+ width: 100%;
35
+ padding-left: 0.75rem;
36
+ color: #000;
37
+ padding-right: 2.5rem;
38
+ padding-top: 0.5rem;
39
+ padding-bottom: 0.5rem;
40
+ font-size: 1rem;
41
+ border-radius: 0.375rem;
42
+ }
43
+
44
+ /* DIALOG */
45
+ .dialog-header {
46
+ display: flex;
47
+ justify-content: space-between;
48
+ }
49
+
50
+ .dialog-header h4 {
51
+ margin: 0;
52
+ }
53
+
54
+ .dialog-mask {
55
+ overflow-x: hidden;
56
+ overflow-y: auto;
57
+ display: flex;
58
+ justify-content: center;
59
+ padding-top: 2.5rem;
60
+ padding-bottom: 5rem;
61
+ background-color: #0005;
62
+ position: fixed;
63
+ inset: 0;
64
+ }
65
+
66
+ .dialog-body {
67
+ display: flex;
68
+ flex-direction: column;
69
+ gap: 1.25rem;
70
+ padding: 1.25rem;
71
+ height: max-content;
72
+ background-color: white;
73
+ }
74
+
75
+ /* DIALOG */
@@ -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.9",
4
4
  "description": "React UI",
5
5
  "author": "Anthony",
6
6
  "license": "MIT",
@@ -1,110 +0,0 @@
1
- @use "../global.scss";
2
-
3
- @mixin scanner($props: null, $options: null) {
4
- $internal-options: global.$default-options;
5
-
6
- $internal-props: (
7
- bgColor: #ffffff,
8
- fgColor: global.$color-grey-darker,
9
- closeBtnColor: global.$color-grey,
10
- closeBtnHoverColor: global.$color-blue,
11
- closeBtnDisableColor: global.$color-blue-grey-lighter,
12
- confirm: (
13
- headerBgColor: global.$color-orange-dark,
14
- headerFgColor: #ffffff,
15
- bgColor: #ffffff,
16
- fgColor: global.$color-grey-darker,
17
- ),
18
- error: (
19
- headerBgColor: global.$color-red,
20
- headerFgColor: #ffffff,
21
- bgColor: #ffffff,
22
- fgColor: global.$color-grey-darker,
23
- ),
24
- warning: (
25
- headerBgColor: global.$color-grey,
26
- headerFgColor: #ffffff,
27
- bgColor: #ffffff,
28
- fgColor: global.$color-grey-darker,
29
- ),
30
- );
31
-
32
- $internal-props: global.safe-map-merge($internal-props, $props);
33
- $internal-options: global.safe-map-merge($internal-options, $options);
34
-
35
- .btn {
36
- display: flex;
37
- align-items: center;
38
- justify-content: center;
39
- padding: 0.5rem 1rem;
40
- border: 1px solid transparent;
41
- border-radius: 0.375rem;
42
- box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
43
- font-size: 0.875rem;
44
- font-weight: 500;
45
- line-height: 1.25rem;
46
- text-align: center;
47
- text-transform: none;
48
- white-space: nowrap;
49
- vertical-align: middle;
50
- user-select: none;
51
- background-color: #4F46E5;
52
- color: #fff;
53
- cursor: pointer;
54
- outline: none;
55
- transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
56
- }
57
-
58
- .btn-default {
59
- background-color: #4F46E5;
60
- }
61
-
62
- .btn-default:hover {
63
- opacity: 0.8;
64
- }
65
-
66
- .select {
67
- display: block;
68
- width: 100%;
69
- padding-left: 0.75rem;
70
- color: #000;
71
- padding-right: 2.5rem;
72
- padding-top: 0.5rem;
73
- padding-bottom: 0.5rem;
74
- font-size: 1rem;
75
- border-radius: 0.375rem;
76
- }
77
-
78
- /* DIALOG */
79
- .dialog-header {
80
- display: flex;
81
- justify-content: space-between;
82
- }
83
-
84
- .dialog-header h4 {
85
- margin: 0;
86
- }
87
-
88
- .dialog-mask {
89
- overflow-x: hidden;
90
- overflow-y: auto;
91
- display: flex;
92
- justify-content: center;
93
- padding-top: 2.5rem;
94
- padding-bottom: 5rem;
95
- background-color: #0005;
96
- position: fixed;
97
- inset: 0;
98
- }
99
-
100
- .dialog-body {
101
- display: flex;
102
- flex-direction: column;
103
- gap: 1.25rem;
104
- padding: 1.25rem;
105
- height: max-content;
106
- background-color: white;
107
- }
108
-
109
- /* DIALOG */
110
- }