@regulaforensics/ui-components 0.0.25 → 1.0.0

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 (3) hide show
  1. package/README.md +70 -0
  2. package/dist/index.js +1910 -1911
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,3 +1,73 @@
1
1
  # Regula React UI components
2
2
 
3
3
  This package contains React UI components for Regula products.
4
+
5
+ ## Document-reader processing result tabs
6
+
7
+ Here is an example of using components to display the results of document-reader processing.
8
+
9
+ ```typescript jsx
10
+ import { FC } from 'react'
11
+ import { createRoot } from 'react-dom/client'
12
+ import { ProcessResponse } from '@regulaforensics/document-reader-typings'
13
+ import {
14
+ DocReaderContainer,
15
+ Status,
16
+ Info,
17
+ Graphics,
18
+ Rfid,
19
+ ResponseViewer,
20
+ RequestViewer,
21
+ Logs,
22
+ PortraitsComparison,
23
+ Tabs,
24
+ } from '@regulaforensics/ui-components'
25
+
26
+
27
+ interface ProcessingResultsProps {
28
+ response: ProcessResponse
29
+ request: any
30
+ language: string
31
+ }
32
+
33
+ const ResultsTab = () => (
34
+ <>
35
+ <Status />
36
+ <Info />
37
+ <Graphics />
38
+ <Rfid />
39
+ <PortraitsComparison />
40
+ </>
41
+ )
42
+
43
+ const ProcessingResultTabs: FC<ProcessingResultsProps> = ({ response, request, language }) => (
44
+ <DocReaderContainer response={ response } request={ request } language={ language }>
45
+ <Tabs
46
+ type={ 'card' }
47
+ items={[
48
+ { id: 'Results', label: 'Results', children: <ResultsTab /> },
49
+ { id: 'Request', label: 'Request', children: <RequestViewer /> },
50
+ { id: 'Response', label: 'Response', children: <ResponseViewer /> },
51
+ { id: 'Logs', label: 'Logs', children: <Logs /> }
52
+ ]}
53
+ />
54
+ </DocReaderContainer>
55
+ )
56
+
57
+ const RESPONSE = ProcessResponse.fromPlain(YOUR_RESPONSE_DATA)
58
+ const REQUEST = YOUR_REQUEST_DATA
59
+
60
+ const Results = () => (
61
+ <ProcessingResultTabs
62
+ response={ RESPONSE }
63
+ request={ REQUEST }
64
+ language={ 'en' }
65
+ />
66
+ )
67
+
68
+ const root = createRoot(document.getElementById('root'));
69
+ root.render(<Results />);
70
+ ```
71
+
72
+
73
+