@regulaforensics/ui-components 0.0.26 → 1.1.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.
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
+
package/dist/index.d.ts CHANGED
@@ -142,6 +142,8 @@ export declare interface ICollapseProps extends HTMLAttributes<HTMLDivElement> {
142
142
  selected?: boolean;
143
143
  onOpen?: (isOpen: boolean) => void;
144
144
  preview?: ReactNode;
145
+ dataTestKey?: string;
146
+ dataTestValue?: string;
145
147
  }
146
148
 
147
149
  export declare const Icon: IIcon;
@@ -389,6 +391,7 @@ export declare interface ITextProps extends HTMLAttributes<HTMLSpanElement> {
389
391
  uppercase?: boolean;
390
392
  children?: ReactNode;
391
393
  size?: Size;
394
+ dataTest?: string;
392
395
  }
393
396
 
394
397
  declare interface IUnknownProps extends HTMLAttributes<HTMLSpanElement> {