cortex-react-ui 0.1.166 → 0.1.168

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.
@@ -0,0 +1,13 @@
1
+ import { WebcamProps } from 'react-webcam';
2
+ declare const Camera: ({ onCapture, isOffline, mode, ...props }: CameraProps) => JSX.Element;
3
+ declare type CameraProps = {
4
+ onCapture: ({ fileStoreName, fileRowId, file }: TfileCapturedProps) => void;
5
+ mode?: 'photo' | 'video';
6
+ isOffline?: boolean;
7
+ } & Partial<WebcamProps>;
8
+ declare type TfileCapturedProps = {
9
+ fileStoreName?: string | null;
10
+ fileRowId?: number | null;
11
+ file?: File | null;
12
+ };
13
+ export default Camera;
@@ -0,0 +1,9 @@
1
+ declare class FileStorageDB {
2
+ private dbName;
3
+ private storeName;
4
+ private db;
5
+ openDatabase(): Promise<IDBDatabase>;
6
+ storeFile(file: File): Promise<number>;
7
+ retrieveFile(id: number): Promise<File | null>;
8
+ }
9
+ export default FileStorageDB;
@@ -0,0 +1 @@
1
+ export { default } from './Camera';
@@ -0,0 +1,6 @@
1
+ export declare const useTimer: () => {
2
+ formatTime: (totalSeconds: number) => string;
3
+ startTimer: () => void;
4
+ stopTimer: () => void;
5
+ formatedTime: string;
6
+ };
@@ -1,11 +1,7 @@
1
- import { IDetectedBarcode, IScannerProps } from '@yudiel/react-qr-scanner';
2
- import { TScanConfirmDialogLabels } from './ScanConfirmationDialog';
3
- declare const Scanner: ({ scanConfirmation, scanTrackerType, ...props }: ScannerProps) => JSX.Element;
4
- export declare type TScanTrackerType = 'outline' | 'boundingBox' | 'centerText';
5
- declare type ScannerProps = {
1
+ import { IDetectedBarcode } from '@yudiel/react-qr-scanner';
2
+ export interface ScannerProps {
6
3
  scanConfirmation?: boolean;
7
- scanConfirmDialog?: TScanConfirmDialogLabels;
8
- scanTrackerType?: TScanTrackerType;
9
4
  onScan?: (detectedCodes: IDetectedBarcode[]) => void;
10
- } & IScannerProps;
5
+ }
6
+ declare const Scanner: React.FC<ScannerProps>;
11
7
  export default Scanner;
@@ -2,9 +2,10 @@ export { default as Popper } from './Popper';
2
2
  export { default as DomContainer } from './DomContainer';
3
3
  export { default as Spinner } from './Spinner';
4
4
  export { default as BarLoader } from './BarLoader';
5
+ export { default as Scanner } from './Scanner';
6
+ export { default as Camera } from './Camera';
5
7
  export { default as Selected } from './Selected';
6
8
  export { default as Button } from './Button';
7
- export { default as Scanner } from './Scanner';
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
- import { IDetectedBarcode, IScannerProps } from '@yudiel/react-qr-scanner';
2
+ import { IDetectedBarcode } from '@yudiel/react-qr-scanner';
3
+ import { WebcamProps } from 'react-webcam';
3
4
 
4
5
  declare const PopperPlacement: {
5
6
  readonly Center: "center";
@@ -59,6 +60,24 @@ interface BarLoaderProps {
59
60
  }
60
61
  declare const BarLoader: React$1.FC<BarLoaderProps>;
61
62
 
63
+ interface ScannerProps {
64
+ scanConfirmation?: boolean;
65
+ onScan?: (detectedCodes: IDetectedBarcode[]) => void;
66
+ }
67
+ declare const Scanner: React.FC<ScannerProps>;
68
+
69
+ declare const Camera: ({ onCapture, isOffline, mode, ...props }: CameraProps) => JSX.Element;
70
+ declare type CameraProps = {
71
+ onCapture: ({ fileStoreName, fileRowId, file }: TfileCapturedProps) => void;
72
+ mode?: 'photo' | 'video';
73
+ isOffline?: boolean;
74
+ } & Partial<WebcamProps>;
75
+ declare type TfileCapturedProps = {
76
+ fileStoreName?: string | null;
77
+ fileRowId?: number | null;
78
+ file?: File | null;
79
+ };
80
+
62
81
  interface SelectedProps {
63
82
  title?: string;
64
83
  data: any[];
@@ -76,28 +95,6 @@ interface ButtonProps {
76
95
  }
77
96
  declare const Button: React$1.FC<ButtonProps>;
78
97
 
79
- declare type TScanConfirmDialogLabels = {
80
- title?: string;
81
- message?: string;
82
- btnOk?: {
83
- label: string;
84
- style?: React.CSSProperties;
85
- };
86
- btnCancel?: {
87
- label: string;
88
- style?: React.CSSProperties;
89
- };
90
- };
91
-
92
- declare const Scanner: ({ scanConfirmation, scanTrackerType, ...props }: ScannerProps) => JSX.Element;
93
- declare type TScanTrackerType = 'outline' | 'boundingBox' | 'centerText';
94
- declare type ScannerProps = {
95
- scanConfirmation?: boolean;
96
- scanConfirmDialog?: TScanConfirmDialogLabels;
97
- scanTrackerType?: TScanTrackerType;
98
- onScan?: (detectedCodes: IDetectedBarcode[]) => void;
99
- } & IScannerProps;
100
-
101
98
  interface ToggleButtonProps {
102
99
  selected?: boolean;
103
100
  value?: string;
@@ -307,4 +304,4 @@ interface Props {
307
304
  }
308
305
  declare const CrossIcon: React$1.FC<Props>;
309
306
 
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 };
307
+ 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,192 @@
1
+ .camera-container {
2
+ width: 100%;
3
+ height: 100%;
4
+ }
5
+
6
+ .camera-switch-btn {
7
+ all: initial;
8
+ display: flex;
9
+ cursor: pointer;
10
+ }
11
+
12
+ .camera-recording-dot {
13
+ width: 8px;
14
+ height: 8px;
15
+ border-radius: 50%;
16
+ background-color: #f44336;
17
+ animation: clignote 1s infinite;
18
+ }
19
+
20
+ .camera-recording-timer {
21
+ z-index: 99;
22
+ position: absolute;
23
+ top: 1rem;
24
+ left: 20px;
25
+ display: flex;
26
+ align-items: center;
27
+ justify-content: center;
28
+ background: rgba(0, 0, 0, 0.2);
29
+ border-radius: 4px;
30
+ padding: 3px 7px;
31
+ font-size: 12px;
32
+ color: #fff;
33
+ font-family: sans-serif;
34
+ gap: 6px;
35
+ }
36
+
37
+ .camera-offline-mode {
38
+ position: absolute;
39
+ top: 1rem;
40
+ right: 20px;
41
+ display: flex;
42
+ align-items: center;
43
+ justify-content: center;
44
+ background: rgba(0, 0, 0, 0.2);
45
+ border-radius: 4px;
46
+ padding: 3px 7px;
47
+ font-size: 12px;
48
+ color: red;
49
+ font-family: sans-serif;
50
+ }
51
+
52
+ .camera-mode {
53
+ z-index: 9999;
54
+ position: absolute;
55
+ bottom: 2rem;
56
+ right: 20px;
57
+ padding: 0.5rem;
58
+ border-radius: 6px;
59
+ color: #ffffff;
60
+ border: none;
61
+ cursor: pointer;
62
+ display: flex;
63
+ justify-content: center;
64
+ align-items: center;
65
+ gap: 7px;
66
+ background-color: #2196f3;
67
+ transition: background-color 0.3s ease;
68
+ }
69
+
70
+ .camera-preview {
71
+ position: relative;
72
+ width: 100%;
73
+ height: 100%;
74
+ border-radius: 0.5rem;
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 */
File without changes
@@ -8,11 +8,11 @@
8
8
  @import "TextField";
9
9
  @import "Menu";
10
10
  @import "Dialog";
11
- @import "Scanner";
12
11
  @import "Button";
13
12
  @import "ToggleButton";
14
13
  @import "Selected";
15
14
  @import "BarLoader";
15
+ @import "Camera";
16
16
 
17
17
 
18
18
  @include icons();
@@ -22,12 +22,12 @@
22
22
  @include taginput();
23
23
  @include input();
24
24
  @include menu();
25
- @include scanner();
26
25
  @include dialog();
27
26
  @include button();
28
27
  @include toggleButton();
29
28
  @include selected();
30
29
  @include barLoader();
30
+ @include camera();
31
31
 
32
32
  // @include popper();
33
33
  // @include popper(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortex-react-ui",
3
- "version": "0.1.166",
3
+ "version": "0.1.168",
4
4
  "description": "React UI",
5
5
  "author": "Anthony",
6
6
  "license": "MIT",
@@ -74,6 +74,7 @@
74
74
  "@types/node": "^12.0.0",
75
75
  "@types/react": "^17.0.0",
76
76
  "@types/react-dom": "^17.0.0",
77
+ "@yudiel/react-qr-scanner": "^2.0.2",
77
78
  "css-loader": "5.2.6",
78
79
  "eslint-config-airbnb": "^18.2.1",
79
80
  "eslint-plugin-import": "^2.25.2",
@@ -97,6 +98,8 @@
97
98
  },
98
99
  "dependencies": {
99
100
  "@rollup/plugin-replace": "^5.0.2",
100
- "@yudiel/react-qr-scanner": "^2.0.2"
101
+ "lodash": "^4.17.21",
102
+ "react-icons": "^5.3.0",
103
+ "react-webcam": "^7.2.0"
101
104
  }
102
105
  }
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- export declare const Dialog: (props: DialogProps) => JSX.Element;
3
- export declare type DialogTitleProps = {
4
- title?: string;
5
- };
6
- export declare type DialogProps = DialogTitleProps & {
7
- open: boolean;
8
- className?: string;
9
- message?: string;
10
- confirmation?: boolean;
11
- children?: React.ReactNode;
12
- onClose?: () => void;
13
- };
@@ -1,3 +0,0 @@
1
- import { HTMLAttributes } from 'react';
2
- export declare const DialogBody: (props: DialogBodyProps) => JSX.Element;
3
- export declare type DialogBodyProps = HTMLAttributes<HTMLDivElement>;
@@ -1,3 +0,0 @@
1
- import { HTMLAttributes } from 'react';
2
- export declare const DialogMask: (props: DialogMaskProps) => JSX.Element;
3
- export declare type DialogMaskProps = HTMLAttributes<HTMLDivElement>;
@@ -1,18 +0,0 @@
1
- export declare const ScanConfirmationDialog: (props: TScanConfirmDialogProps) => JSX.Element;
2
- export declare type TScanConfirmDialogLabels = {
3
- title?: string;
4
- message?: string;
5
- btnOk?: {
6
- label: string;
7
- style?: React.CSSProperties;
8
- };
9
- btnCancel?: {
10
- label: string;
11
- style?: React.CSSProperties;
12
- };
13
- };
14
- export declare type TScanConfirmDialogProps = {
15
- open: boolean;
16
- onConfirm: () => void;
17
- onClose: () => void;
18
- } & TScanConfirmDialogLabels;
@@ -1,75 +0,0 @@
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 */