cortex-react-ui 0.1.176 → 0.1.177
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/lib/cjs/index.js +10 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/types/Camera/Camera.d.ts +15 -0
- package/lib/cjs/types/Camera/FileStorageDb.d.ts +9 -0
- package/lib/cjs/types/Camera/index.d.ts +1 -0
- package/lib/cjs/types/Camera/useTimer.d.ts +6 -0
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/esm/index.js +10 -2
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/types/Camera/Camera.d.ts +15 -0
- package/lib/esm/types/Camera/FileStorageDb.d.ts +9 -0
- package/lib/esm/types/Camera/index.d.ts +1 -0
- package/lib/esm/types/Camera/useTimer.d.ts +6 -0
- package/lib/esm/types/index.d.ts +1 -0
- package/lib/index.d.ts +16 -1
- package/lib/styles/Camera/index.scss +218 -0
- package/lib/styles/index.scss +2 -1
- package/package.json +4 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { WebcamProps } from 'react-webcam';
|
|
2
|
+
declare const Camera: ({ onCapture, isOffline, mode, ...props }: CameraProps) => JSX.Element;
|
|
3
|
+
export declare type CameraProps = {
|
|
4
|
+
onCapture: ({ fileStoreName, fileRowId, file }: TfileCapturedProps) => void;
|
|
5
|
+
mode?: 'photo' | 'video';
|
|
6
|
+
isOffline?: boolean;
|
|
7
|
+
} & Partial<WebcamProps>;
|
|
8
|
+
export declare type TfileCapturedProps = {
|
|
9
|
+
fileStoreName?: string | null;
|
|
10
|
+
fileRowId?: number | null;
|
|
11
|
+
file?: File | null;
|
|
12
|
+
imageSrc?: string | null;
|
|
13
|
+
videoSrc?: string | null;
|
|
14
|
+
};
|
|
15
|
+
export default Camera;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Camera';
|
package/lib/esm/types/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { default as BarLoader } from './BarLoader';
|
|
|
5
5
|
export { default as Selected } from './Selected';
|
|
6
6
|
export { default as Button } from './Button';
|
|
7
7
|
export { default as Scanner } from './Scanner';
|
|
8
|
+
export { default as Camera } from './Camera';
|
|
8
9
|
export { default as ToggleButton } from './ToggleButton';
|
|
9
10
|
export { default as Tooltip } from './Tooltip';
|
|
10
11
|
export { default as TagInput } from './TagInput';
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React$1, { CSSProperties } from 'react';
|
|
2
2
|
import { IDetectedBarcode, IScannerProps } from '@yudiel/react-qr-scanner';
|
|
3
|
+
import { WebcamProps } from 'react-webcam';
|
|
3
4
|
|
|
4
5
|
declare const PopperPlacement: {
|
|
5
6
|
readonly Center: "center";
|
|
@@ -98,6 +99,20 @@ declare type ScannerProps = {
|
|
|
98
99
|
onScan?: (detectedCodes: IDetectedBarcode[]) => void;
|
|
99
100
|
} & IScannerProps;
|
|
100
101
|
|
|
102
|
+
declare const Camera: ({ onCapture, isOffline, mode, ...props }: CameraProps) => JSX.Element;
|
|
103
|
+
declare type CameraProps = {
|
|
104
|
+
onCapture: ({ fileStoreName, fileRowId, file }: TfileCapturedProps) => void;
|
|
105
|
+
mode?: 'photo' | 'video';
|
|
106
|
+
isOffline?: boolean;
|
|
107
|
+
} & Partial<WebcamProps>;
|
|
108
|
+
declare type TfileCapturedProps = {
|
|
109
|
+
fileStoreName?: string | null;
|
|
110
|
+
fileRowId?: number | null;
|
|
111
|
+
file?: File | null;
|
|
112
|
+
imageSrc?: string | null;
|
|
113
|
+
videoSrc?: string | null;
|
|
114
|
+
};
|
|
115
|
+
|
|
101
116
|
interface ToggleButtonProps {
|
|
102
117
|
selected?: boolean;
|
|
103
118
|
value?: string;
|
|
@@ -307,4 +322,4 @@ interface Props {
|
|
|
307
322
|
}
|
|
308
323
|
declare const CrossIcon: React$1.FC<Props>;
|
|
309
324
|
|
|
310
|
-
export { AuthDownloadLink, BarLoader, Button, 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 };
|
|
325
|
+
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 };
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
@import "../global.scss";
|
|
2
|
+
|
|
3
|
+
@mixin camera($props: null, $options: null) {
|
|
4
|
+
$internal-props: (
|
|
5
|
+
bgColor: #ffffff,
|
|
6
|
+
fgColor: $color-grey-darker,
|
|
7
|
+
captureButtonBg: #2196f3,
|
|
8
|
+
captureButtonHover: #1976d2,
|
|
9
|
+
recordButtonBg: #f44336,
|
|
10
|
+
recordButtonHover: #d32f2f,
|
|
11
|
+
downloadButtonBg: #4caf50,
|
|
12
|
+
downloadButtonHover: #388e3c,
|
|
13
|
+
resetButtonBg: #9e9e9e,
|
|
14
|
+
resetButtonHover: #757575,
|
|
15
|
+
offlineModeColor: #d32f2f
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
$internal-props: safe-map-merge($internal-props, $props);
|
|
19
|
+
|
|
20
|
+
.camera-container {
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 100%;
|
|
23
|
+
background-color: #000;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.camera-switch-btn {
|
|
27
|
+
all: initial;
|
|
28
|
+
display: flex;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.camera-recording-dot {
|
|
33
|
+
width: 8px;
|
|
34
|
+
height: 8px;
|
|
35
|
+
border-radius: 50%;
|
|
36
|
+
background-color: map-get($internal-props, recordButtonBg);
|
|
37
|
+
animation: clignote 1s infinite;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.camera-recording-timer {
|
|
41
|
+
z-index: 99;
|
|
42
|
+
position: absolute;
|
|
43
|
+
top: 1rem;
|
|
44
|
+
left: 20px;
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
background: rgba(0, 0, 0, .2);
|
|
49
|
+
border-radius: 4px;
|
|
50
|
+
padding: 3px 7px;
|
|
51
|
+
font-size: 12px;
|
|
52
|
+
color: #fff;
|
|
53
|
+
font-family: sans-serif;
|
|
54
|
+
gap: 6px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.camera-offline-mode {
|
|
58
|
+
position: absolute;
|
|
59
|
+
top: 1rem;
|
|
60
|
+
right: 20px;
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
background: rgba(0, 0, 0, .2);
|
|
65
|
+
border-radius: 4px;
|
|
66
|
+
padding: 3px 7px;
|
|
67
|
+
font-size: 12px;
|
|
68
|
+
color: red;
|
|
69
|
+
font-family: sans-serif;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.camera-mode {
|
|
73
|
+
z-index: 9999;
|
|
74
|
+
position: absolute;
|
|
75
|
+
bottom: 2rem;
|
|
76
|
+
right: 20px;
|
|
77
|
+
padding: 0.5rem;
|
|
78
|
+
border-radius: 6px;
|
|
79
|
+
color: #ffffff;
|
|
80
|
+
border: none;
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
display: flex;
|
|
83
|
+
justify-content: center;
|
|
84
|
+
align-items: center;
|
|
85
|
+
gap: 7px;
|
|
86
|
+
background-color: map-get($internal-props, captureButtonBg);
|
|
87
|
+
transition: background-color 0.3s ease;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.camera-preview {
|
|
91
|
+
position: relative;
|
|
92
|
+
width: 100%;
|
|
93
|
+
height: 100%;
|
|
94
|
+
overflow: hidden;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.camera-controls {
|
|
98
|
+
z-index: 999;
|
|
99
|
+
position: absolute;
|
|
100
|
+
bottom: 2rem;
|
|
101
|
+
left: 0;
|
|
102
|
+
right: 0;
|
|
103
|
+
display: flex;
|
|
104
|
+
justify-content: center;
|
|
105
|
+
gap: 1rem;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.video-play-btn {
|
|
109
|
+
all: initial;
|
|
110
|
+
position: absolute;
|
|
111
|
+
bottom: 10%;
|
|
112
|
+
left: 50%;
|
|
113
|
+
z-index: 9;
|
|
114
|
+
width: 1em;
|
|
115
|
+
height: 1em;
|
|
116
|
+
min-width: 15px;
|
|
117
|
+
min-height: 15px;
|
|
118
|
+
transform: translate(-50%, -50%);
|
|
119
|
+
display: flex;
|
|
120
|
+
justify-content: center;
|
|
121
|
+
align-items: center;
|
|
122
|
+
border-radius: 50%;
|
|
123
|
+
border: 1px solid;
|
|
124
|
+
padding: 20px 20px;
|
|
125
|
+
background-color: map-get($internal-props, bgColor);
|
|
126
|
+
cursor: pointer;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.camera-button {
|
|
130
|
+
padding: 0.5rem;
|
|
131
|
+
border-radius: 6px;
|
|
132
|
+
color: #ffffff;
|
|
133
|
+
border: none;
|
|
134
|
+
cursor: pointer;
|
|
135
|
+
display: flex;
|
|
136
|
+
justify-content: center;
|
|
137
|
+
align-items: center;
|
|
138
|
+
gap: 7px;
|
|
139
|
+
transition: background-color 0.3s ease;
|
|
140
|
+
|
|
141
|
+
&--capture {
|
|
142
|
+
border-radius: 50%;
|
|
143
|
+
color: initial;
|
|
144
|
+
width: 50px;
|
|
145
|
+
height: 50px;
|
|
146
|
+
border: 1px solid black;
|
|
147
|
+
background-color: map-get($internal-props, bgColor);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
&--record {
|
|
151
|
+
border-radius: 50%;
|
|
152
|
+
color: red;
|
|
153
|
+
width: 50px;
|
|
154
|
+
height: 50px;
|
|
155
|
+
border: 1px solid black;
|
|
156
|
+
background-color: map-get($internal-props, bgColor);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&--download {
|
|
160
|
+
background-color: map-get($internal-props, downloadButtonBg);
|
|
161
|
+
&:hover {
|
|
162
|
+
background-color: map-get($internal-props, downloadButtonHover);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
&--reset {
|
|
167
|
+
background-color: map-get($internal-props, resetButtonBg);
|
|
168
|
+
&:hover {
|
|
169
|
+
background-color: map-get($internal-props, resetButtonHover);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.camera-offline-mode {
|
|
175
|
+
font-size: 0.875rem;
|
|
176
|
+
font-family: sans-serif;
|
|
177
|
+
color: map-get($internal-props, offlineModeColor);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.camera-screen-animation {
|
|
181
|
+
animation: fadeIn .3s;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
@keyframes fadeIn {
|
|
185
|
+
0% {
|
|
186
|
+
opacity: 0;
|
|
187
|
+
}
|
|
188
|
+
100% {
|
|
189
|
+
opacity: 1;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
@keyframes pulse {
|
|
194
|
+
0% {
|
|
195
|
+
transform: scale(1);
|
|
196
|
+
}
|
|
197
|
+
50% {
|
|
198
|
+
transform: scale(1.05);
|
|
199
|
+
}
|
|
200
|
+
100% {
|
|
201
|
+
transform: scale(1);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
@keyframes clignote {
|
|
206
|
+
0% {
|
|
207
|
+
opacity: 1;
|
|
208
|
+
}
|
|
209
|
+
50% {
|
|
210
|
+
opacity: 0;
|
|
211
|
+
}
|
|
212
|
+
100% {
|
|
213
|
+
opacity: 1;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
@include camera();
|
package/lib/styles/index.scss
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
@import "ToggleButton";
|
|
14
14
|
@import "Selected";
|
|
15
15
|
@import "BarLoader";
|
|
16
|
-
|
|
16
|
+
@import "Camera";
|
|
17
17
|
|
|
18
18
|
@include icons();
|
|
19
19
|
@include popper();
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
@include toggleButton();
|
|
29
29
|
@include selected();
|
|
30
30
|
@include barLoader();
|
|
31
|
+
@include camera();
|
|
31
32
|
|
|
32
33
|
// @include popper();
|
|
33
34
|
// @include popper(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cortex-react-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.177",
|
|
4
4
|
"description": "React UI",
|
|
5
5
|
"author": "Anthony",
|
|
6
6
|
"license": "MIT",
|
|
@@ -87,9 +87,12 @@
|
|
|
87
87
|
"eslint-plugin-json": "^3.1.0",
|
|
88
88
|
"eslint-plugin-jsx-a11y": "^6.4.1",
|
|
89
89
|
"eslint-plugin-react": "^7.26.1",
|
|
90
|
+
"lodash": "^4.17.21",
|
|
90
91
|
"react": "^18.1.0",
|
|
91
92
|
"react-dom": "^18.1.0",
|
|
93
|
+
"react-icons": "^5.3.0",
|
|
92
94
|
"react-scripts": "^4.0.3",
|
|
95
|
+
"react-webcam": "^7.2.0",
|
|
93
96
|
"rollup": "^2.60.2",
|
|
94
97
|
"rollup-plugin-copy": "^3.4.0",
|
|
95
98
|
"rollup-plugin-dts": "^4.0.1",
|